X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fserial%2F8250_hp300.c;h=0e1410f2c03394362f25a07b6ce27981dff38ab2;hb=144b2a91468bdc0d4fa64b220c152fb58b8ffe05;hp=4315afe9c080a6beb1103643e6f3509a28f31cd2;hpb=07342d623b8e1ac9501a36a0da55cbce1117aeaf;p=powerpc.git diff --git a/drivers/serial/8250_hp300.c b/drivers/serial/8250_hp300.c index 4315afe9c0..0e1410f2c0 100644 --- a/drivers/serial/8250_hp300.c +++ b/drivers/serial/8250_hp300.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -35,7 +36,7 @@ static struct hp300_port *hp300_ports; #ifdef CONFIG_HPDCA static int __devinit hpdca_init_one(struct dio_dev *d, - const struct dio_device_id *ent); + const struct dio_device_id *ent); static void __devexit hpdca_remove_one(struct dio_dev *d); static struct dio_device_id hpdca_dio_tbl[] = { @@ -55,6 +56,8 @@ static struct dio_driver hpdca_driver = { #endif +static unsigned int num_ports; + extern int hp300_uart_scode; /* Offset to UART registers from base of DCA */ @@ -82,7 +85,7 @@ extern int hp300_uart_scode; #ifdef CONFIG_SERIAL_8250_CONSOLE /* - * Parse the bootinfo to find descriptions for headless console and + * Parse the bootinfo to find descriptions for headless console and * debug serial ports and register them with the 8250 driver. * This function should be called before serial_console_init() is called * to make sure the serial console will be available for use. IA-64 kernel @@ -123,13 +126,11 @@ int __init hp300_setup_serial_console(void) printk(KERN_WARNING "Serial console is APCI but support is disabled (CONFIG_HPAPCI)!\n"); return 0; #endif - } - else { + } else { #ifdef CONFIG_HPDCA unsigned long pa = dio_scodetophysaddr(scode); - if (!pa) { + if (!pa) return 0; - } printk(KERN_INFO "Serial console is HP DCA at select code %d\n", scode); @@ -142,26 +143,23 @@ int __init hp300_setup_serial_console(void) /* Enable board-interrupts */ out_8(pa + DIO_VIRADDRBASE + DCA_IC, DCA_IC_IE); - if (DIO_ID(pa + DIO_VIRADDRBASE) & 0x80) { + if (DIO_ID(pa + DIO_VIRADDRBASE) & 0x80) add_preferred_console("ttyS", port.line, "9600n8"); - } #else printk(KERN_WARNING "Serial console is DCA but support is disabled (CONFIG_HPDCA)!\n"); return 0; #endif } - if (early_serial_setup(&port) < 0) { + if (early_serial_setup(&port) < 0) printk(KERN_WARNING "hp300_setup_serial_console(): early_serial_setup() failed.\n"); - } - return 0; } #endif /* CONFIG_SERIAL_8250_CONSOLE */ #ifdef CONFIG_HPDCA static int __devinit hpdca_init_one(struct dio_dev *d, - const struct dio_device_id *ent) + const struct dio_device_id *ent) { struct uart_port port; int line; @@ -199,14 +197,15 @@ static int __devinit hpdca_init_one(struct dio_dev *d, out_8(d->resource.start + DIO_VIRADDRBASE + DCA_ID, 0xff); udelay(100); + num_ports++; + return 0; } #endif static int __init hp300_8250_init(void) { - static int called = 0; - int num_ports; + static int called; #ifdef CONFIG_HPAPCI int line; unsigned long base; @@ -221,11 +220,8 @@ static int __init hp300_8250_init(void) if (!MACH_IS_HP300) return -ENODEV; - num_ports = 0; - #ifdef CONFIG_HPDCA - if (dio_module_init(&hpdca_driver) == 0) - num_ports++; + dio_register_driver(&hpdca_driver); #endif #ifdef CONFIG_HPAPCI if (hp300_model < HP_400) { @@ -238,13 +234,12 @@ static int __init hp300_8250_init(void) * Port 1 is either the console or the DCA. */ for (i = 1; i < 4; i++) { - /* Port 1 is the console on a 425e, on other machines it's mapped to - * DCA. + /* Port 1 is the console on a 425e, on other machines it's + * mapped to DCA. */ #ifdef CONFIG_SERIAL_8250_CONSOLE - if (i == 1) { + if (i == 1) continue; - } #endif /* Create new serial device */ @@ -258,7 +253,8 @@ static int __init hp300_8250_init(void) /* Memory mapped I/O */ uport.iotype = UPIO_MEM; - uport.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF; + uport.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ \ + | UPF_BOOT_AUTOCONF; /* XXX - no interrupt support yet */ uport.irq = 0; uport.uartclk = HPAPCI_BAUD_BASE * 16; @@ -269,8 +265,8 @@ static int __init hp300_8250_init(void) line = serial8250_register_port(&uport); if (line < 0) { - printk(KERN_NOTICE "8250_hp300: register_serial() APCI %d" - " irq %d failed\n", i, uport.irq); + printk(KERN_NOTICE "8250_hp300: register_serial() APCI" + " %d irq %d failed\n", i, uport.irq); kfree(port); continue; }