[PATCH] cpukit: Add nxp-sc16is752 serial device driver

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Sep 20 05:41:43 UTC 2016


Ok, it will be probably next week, since Alex is on holiday.

For an example SPI driver see

https://git.rtems.org/rtems/tree/c/src/lib/libbsp/arm/atsam/spi/atsam_spi_bus.c

The main part of the driver is the bus transfer handler, e.g.

|static int atsam_spi_transfer( spi_bus *base, const spi_ioc_transfer 
*msgs, uint32_t msg_count ) { int rv; atsam_spi_bus *bus = 
(atsam_spi_bus *)base; if (msg_count == 0) { return 0; } bus->msgs = 
&msgs[0]; bus->msg_todo = msg_count; bus->task_id = rtems_task_self(); 
rv = atsam_spi_setup_transfer(bus); return rv; }|


On 19/09/16 21:29, Alan Cudmore wrote:
> Thanks.. No hurry, I need to implement the new SPI api for the Pi anyway,
>
> Alan
>
>> On Sep 19, 2016, at 2:56 PM, Sebastian Huber <sebastian.huber at embedded-brains.de> wrote:
>>
>> Sorry, this is a bug in the driver.  We will fix this before we commit it.
>>
>> ----- Am 19. Sep 2016 um 20:53 schrieb Alan Cudmore alan.cudmore at gmail.com:
>>
>>> I applied this patch and tried building the raspberrypi BSP and got this error:
>>> ../../../../../../../rtems-src/rtems/c/src/../../cpukit/dev/serial/nxp-sc16is752.c:17:27:
>>> fatal error: bsp/atsam-spi.h: No such file or directory
>>> #include <bsp/atsam-spi.h>
>>>
>>> Will this only build for the atsam BSP?
>>>
>>> I am interested in this driver. The Raspberry Pi only has one usable UART. I
>>> have a SC16IS750 device I would like to use to add a couple of UARTs to my
>>> board so I could connect a GPS and keep the original UART free.
>>>
>>> To use this, we will have to supply the new Linux user API SPI driver for the
>>> Raspberry Pi similar to the spi driver in the atsam BSP, correct?
>>>
>>> Thanks,
>>> Alan
>>>
>>>
>>>> On Sep 19, 2016, at 12:13 PM, Sebastian Huber
>>>> <sebastian.huber at embedded-brains.de> wrote:
>>>>
>>>> Hello Joel,
>>>>
>>>> ----- Joel Sherrill <joel.sherrill at gmail.com> schrieb:
>>>>> Sebastian,
>>>>>
>>>>> This is yet another style of serial port driver in recent history and
>>>>> the software tax hasn't been paid on the last round of changes.
>>>> this is not a new style of serial port drivers.  It uses the new Termios device
>>>> driver model which I changed in the last patch set to use IMFS generic nodes.
>>>> This particular serial device (NXP SC16IS752) is attached via an I2C or SPI
>>>> bus.  So, this is highly board/application specific.  Adding such a device to a
>>>> particular BSP would end up in a configuration nightmare.
>>>>
>>>>> Merging this will result in three different styles of serial port drivers
>>>>> by my count.
>>>>>
>>>>> I am not opposed to improvement but this is rapidly heading
>>>>> down the "old vs new PowerPC interrupt" path and that sucked
>>>>> for years.
>>>> With the recent change for the new Termios device driver model its easier to
>>>> move the existing console drivers, since there is no need to maintain
>>>> major/minor numbers anymore.  The drawback is that you have to use IMFS as the
>>>> base file system.  However, its just a matter of doing it to strip down the
>>>> IMFS to have similar size demands than the current devfs.
>>>>
>>>>> --joel
>>>>>
>>>>>
>>>>> On Mon, Sep 19, 2016 at 8:57 AM, Gedare Bloom <gedare at rtems.org> wrote:
>>>>>
>>>>>> It will be good to have some documentation (BSP/driver manual) about
>>>>>> how to write these kind of termios drivers. Usually without it we will
>>>>>> see someone just copy-paste this one and modify until they get it
>>>>>> right... So lacking a plain english doc, this "first" implementation
>>>>>> should provide enough comments to make it easy to copy-paste-modify.
>>>>>>
>>>>>> On Mon, Sep 19, 2016 at 4:11 AM, Sebastian Huber
>>>>>> <sebastian.huber at embedded-brains.de> wrote:
>>>>>>> Please note that this is the first Termios device driver that is
>>>>>> independent
>>>>>>> of a BSP, CPU architecture and console driver. It is currently work in
>>>>>>> progress and lacks support for interrupts. We will add this probably in
>>>>>> one
>>>>>>> or two weeks.
>>>>>>>
>>>>>>> --
>>>>>>> Sebastian Huber, embedded brains GmbH
>>>>>>>
>>>>>>> Address : Dornierstr. 4, D-82178 Puchheim, Germany
>>>>>>> Phone   : +49 89 189 47 41-16
>>>>>>> Fax     : +49 89 189 47 41-09
>>>>>>> E-Mail  : sebastian.huber at embedded-brains.de
>>>>>>> PGP     : Public key available on request.
>>>>>>>
>>>>>>> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> devel mailing list
>>>>>>> devel at rtems.org
>>>>>>> http://lists.rtems.org/mailman/listinfo/devel
>>>>>> _______________________________________________
>>>>>> devel mailing list
>>>>>> devel at rtems.org
>>>>>> http://lists.rtems.org/mailman/listinfo/devel
>>>>>>
>>>> --
>>>> Sebastian Huber, embedded brains GmbH
>>>>
>>>> Address : Dornierstr. 4, D-82178 Puchheim, Germany
>>>> Phone   : +49 89 189 47 41-16
>>>> Fax     : +49 89 189 47 41-09
>>>> E-Mail  : sebastian.huber at embedded-brains.de
>>>> PGP     : Public key available on request.
>>>>
>>>> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>>>> _______________________________________________
>>>> devel mailing list
>>>> devel at rtems.org
>>>> http://lists.rtems.org/mailman/listinfo/devel

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list