early console for au1x00
Subsystems (2)
PATCH 1/1 early console for au1x00
Hello,
here a patch to add early console support for au1x00.
I also attach a patch who fixes au1x00 serial address space by using only physical addresses. Please, note that this change allow to simply file "drivers/serial/8250.c" since functions __raw_readl()/__raw_writel() can be replaced by functions readl()/writel().
At boot time I get:
Starting kernel .Linux version 2.6.17-rc4-gde4a1dae-dirty (giometti@zaigor) (gcc version 3.4.3) #83 Mon May 22 22:34:47 CEST 2006 CPU revision is: 02030204
Board WWPC1000 version 1.0
WWPC-setup: uC=off
(PRId 02030204) @ 396MHZ
BCLK switching enabled!
Early serial console at AU 0x11100000 (options '115200')
...
Serial: 8250/16550 driver $Revision: 1.90 $ 3 ports, IRQ sharing disabled
serial8250.8: ttyS0 at MMIO 0x11100000 (irq = 0) is a 16550A
serial8250.8: ttyS1 at MMIO 0x11200000 (irq = 1) is a 16550A
serial8250.8: ttyS2 at MMIO 0x11400000 (irq = 3) is a 16550A
...
Adding console on ttyS0 at AU 0x11100000 (options '115200')
...
and at system running time I get:
hostname:~# cat /proc/iomem
10100000-101fffff : au1xxx-ohci.0
10100000-101fffff : ohci_hcd
10500000-1050ffff : eth-base
10520000-10520003 : eth-mac
11100000-111fffff : serial
11200000-112fffff : serial
11400000-114fffff : serialwhich is coherent with other system devices.
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
arch/mips/kernel/setup.c +5 -0
@@ -32,6 +32,7 @@#include <linux/kdev_t.h> #include <linux/root_dev.h> #include <linux/highmem.h> +#include <linux/serial.h> #include <linux/console.h> #include <linux/mmzone.h> #include <linux/pfn.h>
@@ -517,6 +518,10 @@ void __init setup_arch(char **cmdline_p) *cmdline_p = command_line; +#ifdef CONFIG_SERIAL_8250_CONSOLE +early_serial_console_init (*cmdline_p); +#endif +parse_cmdline_early ();bootmem_init ();sparse_init ();
drivers/serial/8250.c +5 -2
@@ -2336,8 +2336,11 @@ int __init serial8250_start_console(struadd_preferred_console ("ttyS" , line, options);printk ("Adding console on ttyS%d at %s 0x%lx (options '%s')\n" , - line, port->iotype ==UPIO_MEM ?"MMIO" :"I/O port" , - port->iotype ==UPIO_MEM ? (unsigned long ) port->mapbase : + line, + (port->iotype ==UPIO_MEM ) ?"MMIO" : \ + (port->iotype ==UPIO_AU ) ?"AU" :"I/O port" , + (port->iotype ==UPIO_MEM ) || \ + (port->iotype ==UPIO_AU ) ? (unsigned long ) port->mapbase : (unsigned long ) port->iobase, options);if (!(serial8250_console.flags &CON_ENABLED )) { serial8250_console.flags &= ~CON_PRINTBUFFER ;
drivers/serial/8250_early.c +160 -20
279 lines not on this page · raw message
drivers/serial/serial_core.c +1 -0
@@ -2367,6 +2367,7 @@ int uart_match_port(struct uart_port *poreturn (port1->iobase == port2->iobase) && (port1->hub6 == port2->hub6);case UPIO_MEM : +case UPIO_AU :return (port1->mapbase == port2->mapbase); }return 0 ;
drivers/serial/8250.c +4 -13
@@ -311,12 +311,8 @@ static unsigned int serial_in(struct uarreturn readb (up->port.membase + offset);case UPIO_MEM32 : -return readl (up->port.membase + offset); - -#ifdef CONFIG_SERIAL_8250_AU1X00 case UPIO_AU : -return __raw_readl (up->port.membase + offset); -#endif +return readl (up->port.membase + offset);default :return inb (up->port.iobase + offset);
@@ -339,14 +335,9 @@ serial_out(struct uart_8250_port *up, inbreak ;case UPIO_MEM32 : -writel (value, up->port.membase + offset); -break ; - -#ifdef CONFIG_SERIAL_8250_AU1X00 case UPIO_AU : -__raw_writel (value, up->port.membase + offset); +writel (value, up->port.membase + offset);break ; -#endif default :outb (value, up->port.iobase + offset);
@@ -380,7 +371,7 @@ static inline void _serial_dl_write(strustatic int serial_dl_read (struct uart_8250_port *up) {if (up->port.iotype ==UPIO_AU ) -return __raw_readl (up->port.membase +0x28 ); +return readl (up->port.membase +0x28 );else return _serial_dl_read (up); }
@@ -388,7 +379,7 @@ static int serial_dl_read(struct uart_82static void serial_dl_write (struct uart_8250_port *up,int value) {if (up->port.iotype ==UPIO_AU ) -__raw_writel (value, up->port.membase +0x28 ); +writel (value, up->port.membase +0x28 );else _serial_dl_write (up, value); }
drivers/serial/8250_au1x00.c +17 -17
@@ -29,36 +29,36 @@ #define PORT(_base, _irq) \ { \ .iobase = _base, \ - .membase = (void __iomem *)_base,\ - .mapbase = CPHYSADDR(_base), \ + .mapbase = _base, \ .irq = _irq, \ .uartclk = 0, /* filled */ \ .regshift = 2, \ .iotype = UPIO_AU, \ - .flags = UPF_SKIP_TEST \ + .flags = UPF_SKIP_TEST | \ + UPF_IOREMAP \ } static struct plat_serial8250_port au1x00_data[] = {#if defined(CONFIG_SOC_AU1000 ) - PORT(UART0_ADDR, AU1000_UART0_INT), - PORT(UART1_ADDR, AU1000_UART1_INT), - PORT(UART2_ADDR, AU1000_UART2_INT), - PORT(UART3_ADDR, AU1000_UART3_INT), + PORT(UART0_PHYS_ADDR, AU1000_UART0_INT), + PORT(UART1_PHYS_ADDR, AU1000_UART1_INT), + PORT(UART2_PHYS_ADDR, AU1000_UART2_INT), + PORT(UART3_PHYS_ADDR, AU1000_UART3_INT), #elif defined(CONFIG_SOC_AU1500) - PORT(UART0_ADDR, AU1500_UART0_INT), - PORT(UART3_ADDR, AU1500_UART3_INT), + PORT(UART0_PHYS_ADDR, AU1500_UART0_INT), + PORT(UART3_PHYS_ADDR, AU1500_UART3_INT),#elif defined(CONFIG_SOC_AU1100 ) - PORT(UART0_ADDR, AU1100_UART0_INT), - PORT(UART1_ADDR, AU1100_UART1_INT), + PORT(UART0_PHYS_ADDR, AU1100_UART0_INT), + PORT(UART1_PHYS_ADDR, AU1100_UART1_INT), /* The internal UART2 does not exist on the AU1100 processor. */ - PORT(UART3_ADDR, AU1100_UART3_INT), + PORT(UART3_PHYS_ADDR, AU1100_UART3_INT), #elif defined(CONFIG_SOC_AU1550) - PORT(UART0_ADDR, AU1550_UART0_INT), - PORT(UART1_ADDR, AU1550_UART1_INT), - PORT(UART3_ADDR, AU1550_UART3_INT), + PORT(UART0_PHYS_ADDR, AU1550_UART0_INT), + PORT(UART1_PHYS_ADDR, AU1550_UART1_INT), + PORT(UART3_PHYS_ADDR, AU1550_UART3_INT),#elif defined(CONFIG_SOC_AU1200 ) -PORT (UART0_ADDR ,AU1200_UART0_INT ), - PORT(UART1_ADDR, AU1200_UART1_INT), +PORT (UART0_PHYS_ADDR ,AU1200_UART0_INT ), + PORT(UART1_PHYS_ADDR, AU1200_UART1_INT), #endif { }, };