UARTs and Kernel modules/drivers

Recommended Posts

Hi folks,


 I'd like to build a simple rs485 interface onto an A20-OLinuxino-Micro board.
Therefore I was looking into utilizing one of the UARTs (6 or 7) on EXT1 or EXT2, add an external driver chip to it and 'fork' the according kernel module to implement support for switching send/receive with the RTS line.


While that seemed to be an easy approach, I already got stuck with the basics. :-(


dmesg shows me

[    2.822776] printk: console [ttyS0] disabled
[    2.842962] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 53, base_baud = 1500000) is a U6_16550A
[    2.843045] printk: console [ttyS0] enabled
[    2.866650] 1c29800.serial: ttyS1 at MMIO 0x1c29800 (irq = 54, base_baud = 1500000) is a U6_16550A
[    2.889933] 1c29c00.serial: ttyS2 at MMIO 0x1c29c00 (irq = 55, base_baud = 1500000) is a U6_16550A

that during the boot process, the kernel seems to 'find' an initialize UART0 (ttyS0 on 0x1c28000), UART6 (ttyS1 on 0x1c29800) and UART7 (ttyS2 on 0x1c29c00).


Nevertheless, if I look into sysfs

# find /sys/devices/ -name 'ttyS*'

I see that all the other UARTs are also already recognized.


How can I find out
- which module/driver is loaded/used to access ttyS0, ttyS1 and ttyS2
- if ttyS3 - ttyS7 are 'active' and which module/driver was used
- how to prevent the kernel from automatically loading a module for an 'active' ttySx ?





Link to post
Share on other sites
Armbian is a community driven open source project. Do you like to contribute your code?

50 minutes ago, KlausA20 said:

I see that all the other UARTs are also already recognized.

No ! They are not recognised, but defined, due to the following kernel configs :


The only ones that are recognised are the one you see in "dmesg", therefore the UART6/UART7 are accessible from /dev/ttyS1 and /dev/ttyS2 respectively ...


If you enable some other UARTs using overlays, this order will of course be changed.

Link to post
Share on other sites
18 minutes ago, KlausA20 said:

If I now 'disable' UART7 to prevent the kernel to initialize/recognize that UART, is there a way to later 'enable' this UART with a different  module/driver that the kernel usually (8250 ?) uses.

I don't understand your question, all A20 UARTs are always using the 8250dw driver, as well as any other Allwinner SoC.


EDIT: If you mean that you simply wish to enable later from userspace, yes, that is possible by loading overlays dynamically ...

Link to post
Share on other sites
1 hour ago, KlausA20 said:

Basically I would like to replace the 8250dw driver with a modified version of itself for only UART7 (or UART6).

Do you mean a custom version of 8250dw with RS485 emulation ?


In this case, I've used some patches similar to those one :


Doing such custom kernel build applied to all UARTs, enabling RS485 mode is done by an userspace ioctl call.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.