Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

UARTs and Kernel modules/drivers

Featured Replies

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*'
/sys/devices/platform/soc/1c28000,serial/tty/ttyS0
/sys/devices/platform/soc/1c29c00,serial/tty/ttyS2
/sys/devices/platform/soc/1c29800,serial/tty/ttyS1
/sys/devices/platform/serial8250/tty/ttyS6
/sys/devices/platform/serial8250/tty/ttyS4
/sys/devices/platform/serial8250/tty/ttyS7
/sys/devices/platform/serial8250/tty/ttyS5
/sys/devices/platform/serial8250/tty/ttyS3

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 ?

 

Cheers,

Klaus

 

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 :

CONFIG_SERIAL_8250_NR_UARTS=8
CONFIG_SERIAL_8250_RUNTIME_UARTS=8

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.

  • Author

Thanks, the first question cleared. :)

 

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.

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 ...

  • Author

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

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 : https://lkml.org/lkml/2018/6/1/344

 

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

  • Author

Exactly that was what I wanted to achieve. Seems I'm a few years to late. ;-)

Nevertheless, can you steer me towards some documentation, maybe even regarding A20 APUs?

  • Author

No, more like custom version of 8250dw with RS485 emulation in regards to the UARTs used in the A20 CPUs .

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.