Hi, I'm trying to get the second UART working on a WR841N v8. The AR9341 SoC does have a AR9330 and a 8250 style UART, which is normally the console.
I'm facing some problems to get it working. Does anybody
tried to get similar working ?
AFAIK the only difference between the AR934x high speed Uart and
the AR9330 Uart is the FIFO size (only 4 instead of 16 bytes)
and the missing DMA capability, which isn't used.
The existing AR9330-uart code in the kernel should provide
all necessary routines. To debug the code I'm using it as
module (please find attached code) with some light modifications
providing the necessary mods.
Here is the snpippet of the init code:
#define AR71XX_APB_BASE 0x18000000
#define AR71XX_UART_SIZE 0x100
#define AR934X_UART1_BASE (AR71XX_APB_BASE + 0x00500000)
#define AR934X_UART1_FIFO_SIZE 4
static struct resource ar933x_uart_resources[] = {
{
.start = AR934X_UART1_BASE,
.end = AR934X_UART1_BASE + AR71XX_UART_SIZE - 1,
.flags = IORESOURCE_MEM,
},
{
.start = ATH79_MISC_IRQ(6),
.end = ATH79_MISC_IRQ(6),
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device ar933x_uart_device = {
.name = DRIVER_NAME,
.id = -1,
.resource = ar933x_uart_resources,
.num_resources = ARRAY_SIZE(ar933x_uart_resources),
};
....
platform_device_register(&ar933x_uart_device);
Before loading the module, I see this:
root@OpenWrt:~# find /sys/ -name ar9*art
/sys/bus/platform/drivers/ar933x-uart
root@OpenWrt:~#
root@OpenWrt:~# show-gpio | head -4
JP2 pin 9 GPIO00 O - UART1_TD
JP2 pin 3 GPIO01 I l GPIO
JP2 pin 5 GPIO02 O h GPIO
JP2 pin 7 GPIO03 I - UART1_RD
root@OpenWrt:~# find /sys/ -name ar9*art
/sys/bus/platform/drivers/ar933x-uart
root@OpenWrt:~# ls -l /dev/ttyATH*
ls: /dev/ttyATH*: No such file or directory
root@OpenWrt:~# io -4 -l 0x14 0x18500000
18500000: 00000266 00000200 00000000 00000282
18500010: 00000000
Loading the module:
root@OpenWrt:~# modprobe ar934x_uart
root@OpenWrt:~# dmesg | tail -1
[ 1343.780000] ar934x-uart: ttyATH0 at MMIO 0x18500000 (irq = 14) is a AR933X
UART
root@OpenWrt:~# find /sys/ -name ar9*art
/sys/bus/platform/devices/ar934x-uart
/sys/bus/platform/drivers/ar933x-uart
/sys/bus/platform/drivers/ar934x-uart
/sys/bus/platform/drivers/ar934x-uart/ar934x-uart
/sys/devices/platform/ar934x-uart
/sys/module/ar934x_uart
root@OpenWrt:~# io -4 -l 0x14 0x18500000
18500000: 00000266 00000200 00000000 00000282
18500010: 00000000
root@OpenWrt:~# ls -l /dev/ttyATH0
crw-rw-rw- 1 root root 253, 0 Nov 15 20:43 /dev/ttyATH0
ttyATH0 was dynamicly generated. Reading the setup of ttyATH0 stty seems to
setup the registers.
root@OpenWrt:~# stty -a -F /dev/ttyATH0
speed 9600 baud;stty: /dev/ttyATH0
line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 =
<undef>; swtch =
<undef>;
start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush =
^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel
-iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
root@OpenWrt:~# io -4 -l 0x14 0x18500000
18500000: 00000355 0000a008 004e0f88 00000383
18500010: 00000000
but a simple 'cat /dev/ttyATH0' doesn't show any data (there is a PIC MCU
connected, which sends
a 0x55 and 0x66 every second). A put a printk just before a the tty is fed:
static void ar933x_uart_rx_chars(struct ar933x_uart_port *up)
{
...
if ((up->port.ignore_status_mask & AR933X_DUMMY_STATUS_RD) == 0)
printk(KERN_INFO "%s send 0x%02X to tty\n", __func__,
ch);
tty_insert_flip_char(port, ch, TTY_NORMAL);
which show some data coming:
[ 2051.000000] ar933x_uart_rx_chars send 0x55 to tty
[ 2052.000000] ar933x_uart_rx_chars send 0x66 to tty
[ 2053.000000] ar933x_uart_rx_chars send 0x55 to tty
[ 2054.000000] ar933x_uart_rx_chars send 0x66 to tty
root@OpenWrt:~# cat /proc/interrupts
CPU0
4: 0 MIPS eth0
5: 3724 MIPS eth1
7: 274415 MIPS timer
11: 62 MISC serial
14: 32 MISC
47: 0 dummy ath9k
ERR: 0
but no output on 'cat /dev/ttyATH0'. The questions is : Why is there no data
printed ?
There seems to be something missing in the tty_port setup. Does anybody have a
hint ?
Regards
Gerd
ar934x_uart.c
Description: Binary data
_______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
