Writing a Line discpline driver to talk to a stm32 controller

Oliver Graute oliver.graute at gmail.com
Fri Mar 23 04:18:14 EDT 2018


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?

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



More information about the Kernelnewbies mailing list