方法1:
# cd /sys/class/tty/
# ls -l ttyS*
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS0 -> ../../devices/platform/2k300-soc/16100000.serial/tty/ttyS0
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS1 -> ../../devices/platform/2k300-soc/16100400.serial/tty/ttyS1
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS10 -> ../../devices/platform/serial8250/tty/ttyS10
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS11 -> ../../devices/platform/serial8250/tty/ttyS11
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS12 -> ../../devices/platform/serial8250/tty/ttyS12
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS13 -> ../../devices/platform/serial8250/tty/ttyS13
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS14 -> ../../devices/platform/serial8250/tty/ttyS14
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS15 -> ../../devices/platform/serial8250/tty/ttyS15
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS2 -> ../../devices/platform/2k300-soc/16100800.serial/tty/ttyS2
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS3 -> ../../devices/platform/2k300-soc/16100c00.serial/tty/ttyS3
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS4 -> ../../devices/platform/serial8250/tty/ttyS4
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS5 -> ../../devices/platform/serial8250/tty/ttyS5
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS6 -> ../../devices/platform/serial8250/tty/ttyS6
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS7 -> ../../devices/platform/serial8250/tty/ttyS7
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS8 -> ../../devices/platform/serial8250/tty/ttyS8
lrwxrwxrwx 1 root root 0 Feb 3 23:21 ttyS9 -> ../../devices/platform/serial8250/tty/ttyS9
方法2:
# cd /sys/devices/platform/2k300-soc
# find . -name "ttyS*"
./16100800.serial/tty/ttyS2
./16100c00.serial/tty/ttyS3
./16100400.serial/tty/ttyS1
./16100000.serial/tty/ttyS0
得到的结果中【数字.serail】部分中的数字为uart 的寄存器地址,末尾为tty的名字。查看芯片手册的寄存器描述或u-boot, kernel 中的dts 描述,便可知对应关系。
更多回帖