Writing a Line discpline driver to talk to a stm32 controller

Stefan Wahren info at lategoodbye.de
Mon Mar 26 17:20:05 EDT 2018


Hello Oliver,

Am 23.03.2018 um 09:18 schrieb Oliver Graute:
> Hello list,
> 
> I have a imx6ul connected to a stm32 controller via a serial interface. I need
> to implement a little protocol to talk towards the stm32 controller for send
> and receive ontop of the serial line. I found out that I have to write my own
> line discpline driver for doing this. After digging around in drivers/tty/n_*
> I have a little idea what to do here. I already attached my demo ldisc to a
> /dev/ttymxc7 via the ldattach command in userspace. This looks fine so far.
> 
> Here my first Questions:
> 
> Is there a way to permanent attach the ldisc to an serial interface in the
> Kernel?

take a look at the serial device bus as an alternative for ldisc [1]

Stefan

[1] - https://elinux.org/images/0/0e/Serdev-elce-2017-2.pdf

> 
> I have a reset GPIO to reset the stm32 controller. I would like to toggle this
> GPIO on opening the device. But the open() method in the ldisc driver seems
> the wrong place to do this. But in which open() should I do this? the
> underlying serial imx.c driver do not have any open() and I'am using this
> driver also for other serial lines?
> 
> useful links to the ldisc topic:
> 
> https://www.kernel.org/doc/Documentation/serial/tty.txt
> http://www.embeddedlinux.org.cn/essentiallinuxdevicedrivers/
> 
> Best Regards,
> 
> Oliver
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 




More information about the Kernelnewbies mailing list