trouble on serial console for au1100
Subsystems (2)
Hello,
finally I've started port of my code for an au1100 based board to the last kernel version (2.6.17-rc3) and I've a problem on serial console!
I noticed that the serial lines management code is changed from linux-2.6.12 and I'd like to know if someone is running the serial console on ttyS0 on au1100...
Thanks,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems [email protected] UNIX programming phone: +39 349 2432127
Quoted 4 lines · Rodolfo Giometti
I noticed that the serial lines management code is changed from linux-2.6.12 and I'd like to know if someone is running the serial console on ttyS0 on au1100...
Modifying the printk() code and sending the output directly to the serial line (without using the driver since u-boot already init the serial port for me) I get:
<4>Synthesized TLB store handler fastpath (34 instructions). <4>Synthesized TLB modify handler fastpath (33 instructions). <4>PID hash table entries: 512 (order: 9, 2048 bytes) <4>calculating r4koff... 00060ae0(396000)
<4>CPU frequency 396.00 MHz
<4>Break instruction in kernel code[#1]:
<4>Cpu 0
<4>$ 0 : 00000000 1000fc00 0fffff00 00010000 <4>$ 4 : 803bfd30 00000000 8036dbe0 803bfd70 <4>$ 8 : 8036dbe0 00000000 00000000 1000fc01 <4>$12 : 803c0000 fffffffe ffffffff 0000000a <4>$16 : 803b1b78 803b1b80 83fc4000 83fb12e0 <4>$20 : a3eb4462 00000000 83fc4000 00000000 <4>$24 : 00000000 80363e1b <4>$28 : 80362000 80363f30 83fc4000 803a9a88 <4>Hi : 00000000 <4>Lo : 00030570 <4>epc : 80129a0c acquire_console_sem+0xd4/0xf0 Not tainted <4>ra : 803a9a88 con_init+0x24/0x2a0 <4>Status: 1000fc03 KERNEL EXL IE <4>Cause : 00800024 <4>PrId : 02030204 <4>Modules linked in: <4>Process swapper (pid: 0, threadinfo=80362000, task=80364000) <4>Stack : 83fc4000 803a42d4 00000000 00000800 803a9a88 179a7b00 83fc4000 83fb12e0 <4> a3eb4462 00000000 83fc4000 00000000 803b1b78 803b1b80 83fc4000 83fb12e0 <4> a3eb4462 00000000 803a8f58 803b0000 83fc4000 0000018c 00000000 431bde83 <4> 83fb4000 803b0000 8039479c 8039475c 80338f5c 803b4004 80366244 00000000 <4> 80394134 00000000 803b4e2c 00000000 83fb4000 83fb4000 83fb1aac 00000000
<4>
<4>Call Trace:
<4> [<803a42d4>] __alloc_bootmem_nopanic+0x68/0xb0
<4> [<803a9a88>] con_init+0x24/0x2a0
<4> [<803a8f58>] console_init+0x48/0x68
<4> [<8039479c>] start_kernel+0x194/0x3b4
<4> [<8039475c>] start_kernel+0x154/0x3b4
<4> [<80394134>] unknown_bootoption+0x0/0x304
<4>
<4>
<4>Code: 00000040 0804a664 00000000 <0200000d> 0804a657 3c03803b 0c0ca698 00000000 0804a667 <0>Kernel panic - not syncing: Aiee, killing interrupt handler!
So the problem seems to be the "acquire_console_sem()" into "con_init()" function (file «drivers/char/vt.c»).
Suggestions? How is possible that the serial console code is buggy? =:-o
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems [email protected] UNIX programming phone: +39 349 2432127
Hi Rodolfo,
Quoted 3 lines · Rodolfo Giometti
I noticed that the serial lines management code is changed from linux-2.6.12 and I'd like to know if someone is running the serial console on ttyS0 on au1100...
Can it be that you face the same problem I was facing not so long ago? After I applied the patch in the email I attach to this one all my serial troubles on the au1100 disappeared.
At the moment I'm running kernel 2.6.16 and am using a serial console and several other serial applications without any problem.
So, please find attached two emails. One is the answer I received on sort of like the same question like you pose right now and the other is the improved patch by Jon that fixed the problem for me.
Signature · 4 lines
$ cat ~/.signature Freddy Spierenburg <[email protected]> http://freddy.snarl.nl/ GnuPG: 0x7941D1E1=C948 5851 26D2 FA5C 39F1 E588 6F17 FD5D 7941 D1E1 $ # Please read http://www.ietf.org/rfc/rfc2015.txt before complain!
Quoted 9 lines · Freddy Spierenburg
Hi,
I have a problem and yet am not sure where to look. It's a problem in the serial driver for the internal UART's of the AU1100. It appeared ever since 2.6.15. 2.6.14 is working like a charm, but 2.6.15 gives me the trouble.
When I open a tty with the open(2) system call (see attached
open.c) I see that the UART sends a0x36byte on the line.
We had the same problem on Au1200, applying
http://www.linux-mips.org/archives/linux-mips/2006-03/msg00259.html
(or maybe a different version of this patch) fixed it.
Quoted 7 lines
But that's not the only trouble. I also do not receive any bytes received by the UART. All the received bytes stay in the input buffer of the UART only to be send up to userland as soon as the UART is asked to send a byte on the line itself. Then in one take all the bytes are received by the application listening.
I may be way off, but maybe it's just flow control that needs to be turned off.
Domen
Alchemy SoC uart have got a non-standard divisor register that needs some special handling.
This patch adds divisor read/write functions with test and special handling for Alchemy internal uart.
---
3rd edition:
- Removed section covering 16C850 autoconfig.
drivers/serial/8250.c renamed from drivers/serial/8250.c.orig +42 -13
@@ -362,6 +362,40 @@ serial_out(struct uart_8250_port *up, in#define serial_inp (up, offset) serial_in(up, offset)#define serial_outp (up, offset, value) serial_out(up, offset, value) +/* Uart divisor latch read */ +static inline int _serial_dl_read (struct uart_8250_port *up) +{ +return serial_inp (up,UART_DLL ) |serial_inp (up,UART_DLM ) <<8 ; +} + +/* Uart divisor latch write */ +static inline void _serial_dl_write (struct uart_8250_port *up,int value) +{ +serial_outp (up,UART_DLL , value &0xff ); +serial_outp (up,UART_DLM , value >>8 &0xff ); +} + +#ifdef CONFIG_SERIAL_8250_AU1X00 +/* Au1x00 haven't got a standard divisor latch */ +static int serial_dl_read (struct uart_8250_port *up) +{ +if (up->port.iotype ==UPIO_AU ) +return __raw_readl (up->port.membase +0x28 ); +else +return _serial_dl_read (up); +} + +static void serial_dl_write (struct uart_8250_port *up,int value) +{ +if (up->port.iotype ==UPIO_AU ) +__raw_writel (value, up->port.membase +0x28 ); +else +_serial_dl_write (up, value); +} +#else +#define serial_dl_read (up) _serial_dl_read(up) +#define serial_dl_write (up, value) _serial_dl_write(up, value) +#endif /* * For the 16C950
@@ -494,7 +528,8 @@ static void disable_rsa(struct uart_8250*/ static int size_fifo (struct uart_8250_port *up) { -unsigned char old_fcr, old_mcr, old_dll, old_dlm, old_lcr; +unsigned char old_fcr, old_mcr, old_lcr; +unsigned short old_dl;int count; old_lcr =serial_inp (up,UART_LCR );
@@ -505,10 +540,8 @@ static int size_fifo(struct uart_8250_po UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);serial_outp (up,UART_MCR ,UART_MCR_LOOP );serial_outp (up,UART_LCR ,UART_LCR_DLAB ); - old_dll =serial_inp (up,UART_DLL ); - old_dlm =serial_inp (up,UART_DLM ); -serial_outp (up,UART_DLL ,0x01 ); -serial_outp (up,UART_DLM ,0x00 ); + old_dl =serial_dl_read (up); +serial_dl_write (up,0x0001 );serial_outp (up,UART_LCR ,0x03 );for (count =0 ; count <256 ; count++)serial_outp (up,UART_TX , count);
@@ -519,8 +552,7 @@ static int size_fifo(struct uart_8250_poserial_outp (up,UART_FCR , old_fcr);serial_outp (up,UART_MCR , old_mcr);serial_outp (up,UART_LCR ,UART_LCR_DLAB ); -serial_outp (up,UART_DLL , old_dll); -serial_outp (up,UART_DLM , old_dlm); +serial_dl_write (up, old_dl);serial_outp (up,UART_LCR , old_lcr);return count;
@@ -750,8 +780,7 @@ static void autoconfig_16550a(struct uarserial_outp (up,UART_LCR ,0xE0 ); - quot =serial_inp (up,UART_DLM ) <<8 ; - quot +=serial_inp (up,UART_DLL ); + quot =serial_dl_read (up); quot <<=3 ; status1 =serial_in (up,0x04 );/* EXCR1 */
@@ -759,8 +788,7 @@ static void autoconfig_16550a(struct uar status1 |=0x10 ;/* 1.625 divisor for baud_base --> 921600 */ serial_outp (up,0x04 , status1); -serial_outp (up,UART_DLL , quot &0xff ); -serial_outp (up,UART_DLM , quot >>8 ); +serial_dl_write (up, quot);serial_outp (up,UART_LCR ,0 );
@@ -1862,8 +1890,7 @@ serial8250_set_termios(struct uart_portserial_outp (up,UART_LCR , cval |UART_LCR_DLAB );/* set DLAB */ } -serial_outp (up,UART_DLL , quot &0xff );/* LS of divisor */ -serial_outp (up,UART_DLM , quot >>8 );/* MS of divisor */ +serial_dl_write (up, quot);/* * LCR DLAB must be set to enable 64-byte FIFO mode. If the FCR
Quoted 3 lines
Can it be that you face the same problem I was facing not so long ago? After I applied the patch in the email I attach to this one all my serial troubles on the au1100 disappeared.
CCing the serial list too. It could use more testing, but this seems like it might be the answer to the myriad of serial issues that have been reported in the last month or so.
I'm ashamed to admit I have no idea if this patch is even in the system or not. If not, I'm sure somebody
can clean it up and send it in the proper style.
Jordan
Quoted 127 lines
From: Jon Anders Haugum <[email protected]>
Date: Thu, 20 Apr 2006 14:55:59 +0200 (CEST)
To: [email protected]
Cc: [email protected], [email protected]
Subject: [PATCH] serial8250: set divisor register correctly for AMD Alchemy
SoC uart. 3rd edition.Alchemy SoC uart have got a non-standard divisor register that needs some special handling.
This patch adds divisor read/write functions with test and special handling for Alchemy internal uart.
Signed-off-by Jon Anders Haugum <[email protected]>---
3rd edition:
- Removed section covering 16C850 autoconfig.drivers/serial/8250.c renamed from drivers/serial/8250.c.orig +42
-13@@ -362,6 +362,40 @@ serial_out(struct uart_8250_port *up, in#define serial_inp (up, offset) serial_in(up, offset)#define serial_outp (up, offset, value) serial_out(up, offset, value) +/* Uart divisor latch read */ +static inline int _serial_dl_read (struct uart_8250_port *up) +{ +return serial_inp (up,UART_DLL ) |serial_inp (up,UART_DLM ) <<8 ; +} + +/* Uart divisor latch write */ +static inline void _serial_dl_write (struct uart_8250_port *up,int value) +{ +serial_outp (up,UART_DLL , value &0xff ); +serial_outp (up,UART_DLM , value >>8 &0xff ); +} + +#ifdef CONFIG_SERIAL_8250_AU1X00 +/* Au1x00 haven't got a standard divisor latch */ +static int serial_dl_read (struct uart_8250_port *up) +{ +if (up->port.iotype ==UPIO_AU ) +return __raw_readl (up->port.membase +0x28 ); +else +return _serial_dl_read (up); +} + +static void serial_dl_write (struct uart_8250_port *up,int value) +{ +if (up->port.iotype ==UPIO_AU ) +__raw_writel (value, up->port.membase +0x28 ); +else +_serial_dl_write (up, value); +} +#else +#define serial_dl_read (up) _serial_dl_read(up) +#define serial_dl_write (up, value) _serial_dl_write(up, value) +#endif /* * For the 16C950 @@ -494,7 +528,8 @@ static void disable_rsa(struct uart_8250*/ static int size_fifo (struct uart_8250_port *up) { -unsigned char old_fcr, old_mcr, old_dll, old_dlm, old_lcr; +unsigned char old_fcr, old_mcr, old_lcr; +unsigned short old_dl;int count; old_lcr =serial_inp (up,UART_LCR );@@ -505,10 +540,8 @@ static int size_fifo(struct uart_8250_po UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);serial_outp (up,UART_MCR ,UART_MCR_LOOP );serial_outp (up,UART_LCR ,UART_LCR_DLAB ); - old_dll =serial_inp (up,UART_DLL ); - old_dlm =serial_inp (up,UART_DLM ); -serial_outp (up,UART_DLL ,0x01 ); -serial_outp (up,UART_DLM ,0x00 ); + old_dl =serial_dl_read (up); +serial_dl_write (up,0x0001 );serial_outp (up,UART_LCR ,0x03 );for (count =0 ; count <256 ; count++)serial_outp (up,UART_TX , count);@@ -519,8 +552,7 @@ static int size_fifo(struct uart_8250_poserial_outp (up,UART_FCR , old_fcr);serial_outp (up,UART_MCR , old_mcr);serial_outp (up,UART_LCR ,UART_LCR_DLAB ); -serial_outp (up,UART_DLL , old_dll); -serial_outp (up,UART_DLM , old_dlm); +serial_dl_write (up, old_dl);serial_outp (up,UART_LCR , old_lcr);return count;@@ -750,8 +780,7 @@ static void autoconfig_16550a(struct uarserial_outp (up,UART_LCR ,0xE0 ); - quot =serial_inp (up,UART_DLM ) <<8 ; - quot +=serial_inp (up,UART_DLL ); + quot =serial_dl_read (up); quot <<=3 ; status1 =serial_in (up,0x04 );/* EXCR1 */ @@ -759,8 +788,7 @@ static void autoconfig_16550a(struct uar status1 |=0x10 ;/* 1.625 divisor for baud_base --> 921600 */ serial_outp (up,0x04 , status1); -serial_outp (up,UART_DLL , quot &0xff ); -serial_outp (up,UART_DLM , quot >>8 ); +serial_dl_write (up, quot);serial_outp (up,UART_LCR ,0 );@@ -1862,8 +1890,7 @@ serial8250_set_termios(struct uart_portserial_outp (up,UART_LCR , cval |UART_LCR_DLAB );/* set DLAB */ } -serial_outp (up,UART_DLL , quot &0xff );/* LS of divisor */ -serial_outp (up,UART_DLM , quot >>8 );/* MS of divisor */ +serial_dl_write (up, quot);/* * LCR DLAB must be set to enable 64-byte FIFO mode. If the FCR
Quoted 8 lines · Jordan Crouse
CCing the serial list too. It could use more testing, but this seems like it might be the answer to the myriad of serial issues that have been reported in the last month or so.
I'm ashamed to admit I have no idea if this patch is even in the system or not. If not, I'm sure somebody
can clean it up and send it in the proper style.
Here:
http://ftp.enneenne.com/pub/misc/au1100-patches/linux/patch-au1x00-serial-fix
the patch against «linux-2.6.16-stable» branch for serial support tested with an au1100 based board.
Here:
http://ftp.enneenne.com/pub/misc/au1100-patches/linux/patch-au1x00-serial-real-interrupt
my suggestion to get real interrupts from the serial line (I have redefined the function «is_real_interrupt()» for the au1x00 CPUs into the platform «serial.h» file).
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems [email protected] UNIX programming phone: +39 349 2432127
Quoted 8 lines · Freddy Spierenburg
Can it be that you face the same problem I was facing not so long ago? After I applied the patch in the email I attach to this one all my serial troubles on the au1100 disappeared.
At the moment I'm running kernel 2.6.16 and am using a serial console and several other serial applications without any problem.
Yes, this patch fix the problem but it does it only on branch «linux-2.6.16-stable», «master» branch is still buggy!
The problem on master branch is that the console is not initializated at boot and also the «8250_early.c» must be modified in order to support au1x00 serial register... I did it (the patch is at
http://ftp.enneenne.com/pub/misc/au1100-patches/linux/patch-8250_early.c)
but after that I found more problems if VT support is enabled, and even if I disable it the last error was:
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 61080k/65536k available (2168k kernel code, 4400k reserved, 387k data, 124k init, 0k highmem)
kmem_cache_create: Early error in slab size-32
Break instruction in kernel code[#1]:
Cpu 0
$ 0 : 00000000 1000fc00 00000032 80356228
$ 4 : 80356228 80350000 80356240 00000000
...
epc : 8017837c kmem_cache_create+0x74/0x600 Not tainted
ra : 8017837c kmem_cache_create+0x74/0x600
Status: 1000fc03 KERNEL EXL IE
Cause : 00800024
PrId : 02030204
Modules linked in:
Process swapper (pid: 0, threadinfo=80352000, task=80354000)
Stack : 81062ca0 80321e44 8032bf60 00042000 0000044c 00003165 0000007c 00000183
0021e21c 803b0000 00040000 8035849c 80358490 8035855c 8039bdb0 80360000
...
Call Trace:
[<803915fc>] kmem_cache_init+0x194/0x51c
[<80387078>] mem_init+0x1f4/0x218
[<8038703c>] mem_init+0x1b8/0x218
[<803807dc>] start_kernel+0x1d4/0x3b4
[<80380134>] unknown_bootoption+0x0/0x304
Code: 24a51e44 0c04a8e0 02e03021 <0200000d> 3c058036 0c0c6ebe 24a48550 3c03803b 8c70a35c
Kernel panic - not syncing: Aiee, killing interrupt handler! so, I'll continue my work on «linux-2.6.16-stable» branch. :)
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems [email protected] UNIX programming phone: +39 349 2432127