From 075b8783da0db700868c7b391636a85c06a89678 Mon Sep 17 00:00:00 2001 From: Ryan Bradetich Date: Fri, 3 Nov 2006 05:05:01 +0000 Subject: [PARISC] HPPB bus updates for E-Class systems This patch addresses the following issues: * Removes an incorrect comment. * Fixes a couple of compiler warnings. * Properly detects the HP-PB bus on E-Class systems. Signed-off-by: Ryan Bradetich Signed-off-by: Kyle McMartin --- drivers/parisc/hppb.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/parisc/hppb.c b/drivers/parisc/hppb.c index 07dc2b6d4e93..9bb4db552f3c 100644 --- a/drivers/parisc/hppb.c +++ b/drivers/parisc/hppb.c @@ -10,10 +10,6 @@ ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** -** This Driver currently only supports the console (port 0) on the MUX. -** Additional work will be needed on this driver to enable the full -** functionality of the MUX. -** */ #include @@ -67,7 +63,7 @@ static int hppb_probe(struct parisc_device *dev) } card = card->next; } - printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa.start); + printk(KERN_INFO "Found GeckoBoa at 0x%x\n", dev->hpa.start); card->hpa = dev->hpa.start; card->mmio_region.name = "HP-PB Bus"; @@ -78,16 +74,18 @@ static int hppb_probe(struct parisc_device *dev) status = ccio_request_resource(dev, &card->mmio_region); if(status < 0) { - printk(KERN_ERR "%s: failed to claim HP-PB bus space (%08lx, %08lx)\n", + printk(KERN_ERR "%s: failed to claim HP-PB bus space (%08x, %08x)\n", __FILE__, card->mmio_region.start, card->mmio_region.end); } return 0; } - static struct parisc_device_id hppb_tbl[] = { - { HPHW_BCPORT, HVERSION_REV_ANY_ID, 0x500, 0xc }, + { HPHW_BCPORT, HVERSION_REV_ANY_ID, 0x500, 0xc }, /* E25 and K */ + { HPHW_BCPORT, 0x0, 0x501, 0xc }, /* E35 */ + { HPHW_BCPORT, 0x0, 0x502, 0xc }, /* E45 */ + { HPHW_BCPORT, 0x0, 0x503, 0xc }, /* E55 */ { 0, } }; -- cgit v1.2.3 From 4bd5d82779466a2969c631ce283bef926680c9f5 Mon Sep 17 00:00:00 2001 From: Ryan Bradetich Date: Fri, 3 Nov 2006 05:38:39 +0000 Subject: [PARISC] [MUX] Mux driver bug fix This patch addresses the problems identified by Russell King in the following email: http://lists.parisc-linux.org/pipermail/parisc-linux/2005-December/027912.html Signed-off-by: Ryan Bradetich Signed-off-by: Kyle McMartin --- drivers/serial/mux.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'drivers') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 8ad1b8c5ec5d..ec57a616788b 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c @@ -51,7 +51,11 @@ #define MUX_NR 256 static unsigned int port_cnt __read_mostly; -static struct uart_port mux_ports[MUX_NR]; +struct mux_port { + struct uart_port port; + int enabled; +}; +static struct mux_port mux_ports[MUX_NR]; static struct uart_driver mux_driver = { .owner = THIS_MODULE, @@ -250,7 +254,7 @@ static void mux_read(struct uart_port *port) */ static int mux_startup(struct uart_port *port) { - mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); + mux_ports[port->line].enabled = 1; return 0; } @@ -262,6 +266,7 @@ static int mux_startup(struct uart_port *port) */ static void mux_shutdown(struct uart_port *port) { + mux_ports[port->line].enabled = 0; } /** @@ -319,7 +324,7 @@ static int mux_request_port(struct uart_port *port) * @port: Ptr to the uart_port. * @type: Bitmask of required configurations. * - * Perform any autoconfiguration steps for the port. This functino is + * Perform any autoconfiguration steps for the port. This function is * called if the UPF_BOOT_AUTOCONF flag is specified for the port. * [Note: This is required for now because of a bug in the Serial core. * rmk has already submitted a patch to linus, should be available for @@ -357,11 +362,11 @@ static void mux_poll(unsigned long unused) int i; for(i = 0; i < port_cnt; ++i) { - if(!mux_ports[i].info) + if(!mux_ports[i].enabled) continue; - mux_read(&mux_ports[i]); - mux_write(&mux_ports[i]); + mux_read(&mux_ports[i].port); + mux_write(&mux_ports[i].port); } mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); @@ -456,7 +461,7 @@ static int __init mux_probe(struct parisc_device *dev) } for(i = 0; i < ports; ++i, ++port_cnt) { - port = &mux_ports[port_cnt]; + port = &mux_ports[port_cnt].port; port->iobase = 0; port->mapbase = dev->hpa.start + MUX_OFFSET + (i * MUX_LINE_OFFSET); @@ -484,6 +489,8 @@ static int __init mux_probe(struct parisc_device *dev) #ifdef CONFIG_SERIAL_MUX_CONSOLE register_console(&mux_console); #endif + mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); + return 0; } @@ -520,9 +527,9 @@ static void __exit mux_exit(void) int i; for (i = 0; i < port_cnt; i++) { - uart_remove_one_port(&mux_driver, &mux_ports[i]); - if (mux_ports[i].membase) - iounmap(mux_ports[i].membase); + uart_remove_one_port(&mux_driver, &mux_ports[i].port); + if (mux_ports[i].port.membase) + iounmap(mux_ports[i].port.membase); } uart_unregister_driver(&mux_driver); -- cgit v1.2.3 From 3de7b6482b4e9a34f91604ee0fb7a3ace250f3bb Mon Sep 17 00:00:00 2001 From: Ryan Bradetich Date: Fri, 3 Nov 2006 05:52:41 +0000 Subject: [PARISC] [MUX] Mux driver updates This patch changes the Mux console to use the Mux hardware instead of the PDC Software console. Signed-off-by: Ryan Bradetich Signed-off-by: Kyle McMartin --- drivers/serial/mux.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index ec57a616788b..6408b9b1561a 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c @@ -376,8 +376,17 @@ static void mux_poll(unsigned long unused) #ifdef CONFIG_SERIAL_MUX_CONSOLE static void mux_console_write(struct console *co, const char *s, unsigned count) { - while(count--) - pdc_iodc_putc(*s++); + /* Wait until the FIFO drains. */ + while(UART_GET_FIFO_CNT(&mux_ports[0].port)) + udelay(1); + + while(count--) { + if(*s == '\n') { + UART_PUT_CHAR(&mux_ports[0].port, '\r'); + } + UART_PUT_CHAR(&mux_ports[0].port, *s++); + } + } static int mux_console_setup(struct console *co, char *options) -- cgit v1.2.3 From 9c6416ce6a9829ede1594403d19b22d23cf54e2e Mon Sep 17 00:00:00 2001 From: Ryan Bradetich Date: Fri, 3 Nov 2006 06:34:16 +0000 Subject: [PARISC] [MUX] Claim resources for the Mux driver This patch claims the iomem resources for the Mux driver. Signed-off-by: Ryan Bradetich Signed-off-by: Kyle McMartin --- drivers/serial/mux.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 6408b9b1561a..f21faf163955 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c @@ -66,6 +66,13 @@ static struct uart_driver mux_driver = { .nr = MUX_NR, }; +struct mux_card { + int port_count; + struct parisc_device *dev; + struct mux_card *next; +}; + +static struct mux_card *mux_card_head; static struct timer_list mux_timer; #define UART_PUT_CHAR(p, c) __raw_writel((c), (p)->membase + IO_DATA_REG_OFFSET) @@ -433,6 +440,37 @@ static struct uart_ops mux_pops = { .verify_port = mux_verify_port, }; +/** + * get_new_mux_card - Allocate and return a new mux card. + * + * This function is used to allocate and return a new mux card. + */ +static struct mux_card * __init get_new_mux_card(void) +{ + struct mux_card *card = mux_card_head; + + if(card == NULL) { + mux_card_head = kzalloc(sizeof(struct mux_card), GFP_KERNEL); + if(!mux_card_head) { + printk(KERN_ERR "MUX: Unable to allocate memory.\n"); + return NULL; + } + return mux_card_head; + } + + while(card->next) { + card = card->next; + } + + card->next = kzalloc(sizeof(struct mux_card), GFP_KERNEL); + if(!card->next) { + printk(KERN_ERR "MUX: Unable to allocate memory.\n"); + return NULL; + } + + return card->next; +} + /** * mux_probe - Determine if the Serial Mux should claim this device. * @dev: The parisc device. @@ -446,6 +484,7 @@ static int __init mux_probe(struct parisc_device *dev) u8 iodc_data[32]; unsigned long bytecnt; struct uart_port *port; + struct mux_card *card; status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32); if(status != PDC_OK) { @@ -454,7 +493,16 @@ static int __init mux_probe(struct parisc_device *dev) } ports = GET_MUX_PORTS(iodc_data); - printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.3\n", ports); + printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.4\n", ports); + + card = get_new_mux_card(); + if(card == NULL) + return 1; + + card->dev = dev; + card->port_count = ports; + request_mem_region(card->dev->hpa.start + MUX_OFFSET, + card->port_count * MUX_LINE_OFFSET, "Mux"); if(!port_cnt) { mux_driver.cons = MUX_CONSOLE; @@ -534,6 +582,8 @@ static int __init mux_init(void) static void __exit mux_exit(void) { int i; + struct mux_card *next; + struct mux_card *card = mux_card_head; for (i = 0; i < port_cnt; i++) { uart_remove_one_port(&mux_driver, &mux_ports[i].port); @@ -541,6 +591,15 @@ static void __exit mux_exit(void) iounmap(mux_ports[i].port.membase); } + while(card != NULL) { + release_mem_region(card->dev->hpa.start + MUX_OFFSET, + card->port_count * MUX_LINE_OFFSET); + + next = card->next; + kfree(card); + card = next; + } + uart_unregister_driver(&mux_driver); } -- cgit v1.2.3 From c380f057269686e17db74d360c923663889ac702 Mon Sep 17 00:00:00 2001 From: Ryan Bradetich Date: Sun, 5 Nov 2006 01:21:44 +0000 Subject: [PARISC] [MUX] Make the Serial Mux driver work as module The following updates are based off a patch from willy: * Removal of the mux_card list. * Add the mux_remove function. Other updates: * Re-organize the driver structure a bit to make the mux_init and mux_exit functions more symmetrical. * Added the del_timer. * Unregistered the console. At this point I can insmod, rmmod, and re-insmod the mux without any failures. Signed-off-by: Ryan Bradetich Signed-off-by: Kyle McMartin --- drivers/serial/mux.c | 135 ++++++++++++++++++++++----------------------------- 1 file changed, 57 insertions(+), 78 deletions(-) (limited to 'drivers') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index f21faf163955..5ff7e05a1526 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c @@ -66,13 +66,6 @@ static struct uart_driver mux_driver = { .nr = MUX_NR, }; -struct mux_card { - int port_count; - struct parisc_device *dev; - struct mux_card *next; -}; - -static struct mux_card *mux_card_head; static struct timer_list mux_timer; #define UART_PUT_CHAR(p, c) __raw_writel((c), (p)->membase + IO_DATA_REG_OFFSET) @@ -440,37 +433,6 @@ static struct uart_ops mux_pops = { .verify_port = mux_verify_port, }; -/** - * get_new_mux_card - Allocate and return a new mux card. - * - * This function is used to allocate and return a new mux card. - */ -static struct mux_card * __init get_new_mux_card(void) -{ - struct mux_card *card = mux_card_head; - - if(card == NULL) { - mux_card_head = kzalloc(sizeof(struct mux_card), GFP_KERNEL); - if(!mux_card_head) { - printk(KERN_ERR "MUX: Unable to allocate memory.\n"); - return NULL; - } - return mux_card_head; - } - - while(card->next) { - card = card->next; - } - - card->next = kzalloc(sizeof(struct mux_card), GFP_KERNEL); - if(!card->next) { - printk(KERN_ERR "MUX: Unable to allocate memory.\n"); - return NULL; - } - - return card->next; -} - /** * mux_probe - Determine if the Serial Mux should claim this device. * @dev: The parisc device. @@ -480,11 +442,9 @@ static struct mux_card * __init get_new_mux_card(void) */ static int __init mux_probe(struct parisc_device *dev) { - int i, status, ports; + int i, status, port_count; u8 iodc_data[32]; unsigned long bytecnt; - struct uart_port *port; - struct mux_card *card; status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32); if(status != PDC_OK) { @@ -492,17 +452,12 @@ static int __init mux_probe(struct parisc_device *dev) return 1; } - ports = GET_MUX_PORTS(iodc_data); - printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.4\n", ports); + port_count = GET_MUX_PORTS(iodc_data); + printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.5\n", port_count); - card = get_new_mux_card(); - if(card == NULL) - return 1; - - card->dev = dev; - card->port_count = ports; - request_mem_region(card->dev->hpa.start + MUX_OFFSET, - card->port_count * MUX_LINE_OFFSET, "Mux"); + dev_set_drvdata(&dev->dev, (void *)(long)port_count); + request_mem_region(dev->hpa.start + MUX_OFFSET, + port_count * MUX_LINE_OFFSET, "Mux"); if(!port_cnt) { mux_driver.cons = MUX_CONSOLE; @@ -512,13 +467,10 @@ static int __init mux_probe(struct parisc_device *dev) printk(KERN_ERR "Serial mux: Unable to register driver.\n"); return 1; } - - init_timer(&mux_timer); - mux_timer.function = mux_poll; } - for(i = 0; i < ports; ++i, ++port_cnt) { - port = &mux_ports[port_cnt].port; + for(i = 0; i < port_count; ++i, ++port_cnt) { + struct uart_port *port = &mux_ports[port_cnt].port; port->iobase = 0; port->mapbase = dev->hpa.start + MUX_OFFSET + (i * MUX_LINE_OFFSET); @@ -543,11 +495,34 @@ static int __init mux_probe(struct parisc_device *dev) BUG_ON(status); } -#ifdef CONFIG_SERIAL_MUX_CONSOLE - register_console(&mux_console); -#endif - mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); + return 0; +} +static int __devexit mux_remove(struct parisc_device *dev) +{ + int i; + int port_count = (long)dev_get_drvdata(&dev->dev); + + /* Delete the Mux timer. */ + del_timer(&mux_timer); + + /* Find Port 0 for this card in the mux_ports list. */ + for(i = 0; i < port_cnt; ++i) { + if(mux_ports[i].port.mapbase == dev->hpa.start + MUX_OFFSET) + break; + } + BUG_ON(i + port_count > port_cnt); + + /* Release the resources associated with each port on the device. */ + for(; i < port_count; ++i) { + struct uart_port *port = &mux_ports[i].port; + + uart_remove_one_port(&mux_driver, port); + if(port->membase) + iounmap(port->membase); + } + + release_mem_region(dev->hpa.start + MUX_OFFSET, port_count * MUX_LINE_OFFSET); return 0; } @@ -562,6 +537,7 @@ static struct parisc_driver serial_mux_driver = { .name = "serial_mux", .id_table = mux_tbl, .probe = mux_probe, + .remove = __devexit_p(mux_remove), }; /** @@ -571,7 +547,20 @@ static struct parisc_driver serial_mux_driver = { */ static int __init mux_init(void) { - return register_parisc_driver(&serial_mux_driver); + int status = register_parisc_driver(&serial_mux_driver); + + if(port_cnt > 0) { + /* Start the Mux timer */ + init_timer(&mux_timer); + mux_timer.function = mux_poll; + mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); + +#ifdef CONFIG_SERIAL_MUX_CONSOLE + register_console(&mux_console); +#endif + } + + return status; } /** @@ -581,25 +570,15 @@ static int __init mux_init(void) */ static void __exit mux_exit(void) { - int i; - struct mux_card *next; - struct mux_card *card = mux_card_head; - - for (i = 0; i < port_cnt; i++) { - uart_remove_one_port(&mux_driver, &mux_ports[i].port); - if (mux_ports[i].port.membase) - iounmap(mux_ports[i].port.membase); - } - - while(card != NULL) { - release_mem_region(card->dev->hpa.start + MUX_OFFSET, - card->port_count * MUX_LINE_OFFSET); - - next = card->next; - kfree(card); - card = next; + /* Delete the Mux timer. */ + if(port_cnt > 0) { + del_timer(&mux_timer); +#ifdef CONFIG_SERIAL_MUX_CONSOLE + unregister_console(&mux_console); +#endif } + unregister_parisc_driver(&serial_mux_driver); uart_unregister_driver(&mux_driver); } -- cgit v1.2.3 From 752b940359089ee1bcaceeb5c62d626a92586ba2 Mon Sep 17 00:00:00 2001 From: Ryan Bradetich Date: Thu, 9 Nov 2006 04:45:08 +0000 Subject: [PARISC] [MUX] Detect multiple cards in the correct order This patch follows the example of the 8250_gsc driver by probing for specific built-in Mux cards first. This allows the system to preserve the correct detection order with multiple Mux cards. Signed-off-by: Ryan Bradetich Signed-off-by: Kyle McMartin --- drivers/serial/mux.c | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 5ff7e05a1526..87269cca9c7c 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c @@ -453,7 +453,7 @@ static int __init mux_probe(struct parisc_device *dev) } port_count = GET_MUX_PORTS(iodc_data); - printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.5\n", port_count); + printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.6\n", port_count); dev_set_drvdata(&dev->dev, (void *)(long)port_count); request_mem_region(dev->hpa.start + MUX_OFFSET, @@ -491,6 +491,7 @@ static int __init mux_probe(struct parisc_device *dev) */ port->timeout = HZ / 50; spin_lock_init(&port->lock); + status = uart_add_one_port(&mux_driver, port); BUG_ON(status); } @@ -500,12 +501,9 @@ static int __init mux_probe(struct parisc_device *dev) static int __devexit mux_remove(struct parisc_device *dev) { - int i; + int i, j; int port_count = (long)dev_get_drvdata(&dev->dev); - /* Delete the Mux timer. */ - del_timer(&mux_timer); - /* Find Port 0 for this card in the mux_ports list. */ for(i = 0; i < port_cnt; ++i) { if(mux_ports[i].port.mapbase == dev->hpa.start + MUX_OFFSET) @@ -514,7 +512,7 @@ static int __devexit mux_remove(struct parisc_device *dev) BUG_ON(i + port_count > port_cnt); /* Release the resources associated with each port on the device. */ - for(; i < port_count; ++i) { + for(j = 0; j < port_count; ++j, ++i) { struct uart_port *port = &mux_ports[i].port; uart_remove_one_port(&mux_driver, port); @@ -526,13 +524,35 @@ static int __devexit mux_remove(struct parisc_device *dev) return 0; } +/* Hack. This idea was taken from the 8250_gsc.c on how to properly order + * the serial port detection in the proper order. The idea is we always + * want the builtin mux to be detected before addin mux cards, so we + * specifically probe for the builtin mux cards first. + * + * This table only contains the parisc_device_id of known builtin mux + * devices. All other mux cards will be detected by the generic mux_tbl. + */ +static struct parisc_device_id builtin_mux_tbl[] = { + { HPHW_A_DIRECT, HVERSION_REV_ANY_ID, 0x15, 0x0000D }, /* All K-class */ + { HPHW_A_DIRECT, HVERSION_REV_ANY_ID, 0x44, 0x0000D }, /* E35, E45, and E55 */ + { 0, } +}; + static struct parisc_device_id mux_tbl[] = { { HPHW_A_DIRECT, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0000D }, { 0, } }; +MODULE_DEVICE_TABLE(parisc, builtin_mux_tbl); MODULE_DEVICE_TABLE(parisc, mux_tbl); +static struct parisc_driver builtin_serial_mux_driver = { + .name = "builtin_serial_mux", + .id_table = builtin_mux_tbl, + .probe = mux_probe, + .remove = __devexit_p(mux_remove), +}; + static struct parisc_driver serial_mux_driver = { .name = "serial_mux", .id_table = mux_tbl, @@ -547,7 +567,8 @@ static struct parisc_driver serial_mux_driver = { */ static int __init mux_init(void) { - int status = register_parisc_driver(&serial_mux_driver); + register_parisc_driver(&builtin_serial_mux_driver); + register_parisc_driver(&serial_mux_driver); if(port_cnt > 0) { /* Start the Mux timer */ @@ -560,7 +581,7 @@ static int __init mux_init(void) #endif } - return status; + return 0; } /** @@ -578,6 +599,7 @@ static void __exit mux_exit(void) #endif } + unregister_parisc_driver(&builtin_serial_mux_driver); unregister_parisc_driver(&serial_mux_driver); uart_unregister_driver(&mux_driver); } -- cgit v1.2.3 From 614254458452d09ea0376862160662f2a6075ab9 Mon Sep 17 00:00:00 2001 From: Ryan Bradetich Date: Fri, 10 Nov 2006 03:08:45 +0000 Subject: [PARISC] [MUX] Correctly report the number of available ports This patch adds a new function to return the actual number of ports available. Some of the built-in Muxes return the number of supported ports, but not all of these port are available for use. Signed-off-by: Ryan Bradetich Signed-off-by: Kyle McMartin --- drivers/serial/mux.c | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) (limited to 'drivers') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 87269cca9c7c..f5b17f5333fb 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c @@ -70,7 +70,35 @@ static struct timer_list mux_timer; #define UART_PUT_CHAR(p, c) __raw_writel((c), (p)->membase + IO_DATA_REG_OFFSET) #define UART_GET_FIFO_CNT(p) __raw_readl((p)->membase + IO_DCOUNT_REG_OFFSET) -#define GET_MUX_PORTS(iodc_data) ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8 + +/** + * get_mux_port_count - Get the number of available ports on the Mux. + * @dev: The parisc device. + * + * This function is used to determine the number of ports the Mux + * supports. The IODC data reports the number of ports the Mux + * can support, but there are cases where not all the Mux ports + * are connected. This function can override the IODC and + * return the true port count. + */ +static int __init get_mux_port_count(struct parisc_device *dev) +{ + u8 iodc_data[32]; + unsigned long bytecnt; + + int status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32); + BUG_ON(status != PDC_OK); + + /* If this is the built-in Mux for the K-Class (Eole CAP/MUX), + * we only need to allocate resources for 1 port since the + * other 7 ports are not connected. + */ + if(((iodc_data[0] << 4) | ((iodc_data[1] & 0xf0) >> 4)) == 0x15) + return 1; + + /* Return the number of ports specified in the iodc data. */ + return ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8; +} /** * mux_tx_empty - Check if the transmitter fifo is empty. @@ -442,17 +470,9 @@ static struct uart_ops mux_pops = { */ static int __init mux_probe(struct parisc_device *dev) { - int i, status, port_count; - u8 iodc_data[32]; - unsigned long bytecnt; - - status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32); - if(status != PDC_OK) { - printk(KERN_ERR "Serial mux: Unable to read IODC.\n"); - return 1; - } + int i, status; - port_count = GET_MUX_PORTS(iodc_data); + int port_count = get_mux_port_count(dev); printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.6\n", port_count); dev_set_drvdata(&dev->dev, (void *)(long)port_count); -- cgit v1.2.3 From 514fb84e1c5d12a0af808458bcae0c6463041f93 Mon Sep 17 00:00:00 2001 From: Ryan Bradetich Date: Fri, 10 Nov 2006 04:06:14 +0000 Subject: [PARISC] [MUX] Get the hversion directly from the parisc_device Willy pointed out the hversion is already stored in the parisc_device, so I do not need to extract this information directly from the IODC data. Also by using the information in the parisc_device I can avoid re-reading the IODC data for the Muxes with specifed port counts. Signed-off-by: Ryan Bradetich Signed-off-by: Kyle McMartin --- drivers/serial/mux.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index f5b17f5333fb..ea9cbda77965 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c @@ -83,19 +83,20 @@ static struct timer_list mux_timer; */ static int __init get_mux_port_count(struct parisc_device *dev) { + int status; u8 iodc_data[32]; unsigned long bytecnt; - int status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32); - BUG_ON(status != PDC_OK); - /* If this is the built-in Mux for the K-Class (Eole CAP/MUX), * we only need to allocate resources for 1 port since the * other 7 ports are not connected. */ - if(((iodc_data[0] << 4) | ((iodc_data[1] & 0xf0) >> 4)) == 0x15) + if(dev->id.hversion == 0x15) return 1; + status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32); + BUG_ON(status != PDC_OK); + /* Return the number of ports specified in the iodc data. */ return ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8; } -- cgit v1.2.3 From 423c8ece2941a7ee9b003564d5aab789b9b330d8 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Tue, 24 Oct 2006 13:49:54 -0600 Subject: [PARISC] parisc-agp: Fix integer/pointer warning Signed-off-by: Matthew Wilcox Signed-off-by: Kyle McMartin --- drivers/char/agp/parisc-agp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index 17c50b0f83f0..30cc7aeae9ab 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c @@ -235,7 +235,7 @@ static int __init agp_ioc_init(void __iomem *ioc_regs) { struct _parisc_agp_info *info = &parisc_agp_info; - u64 *iova_base, *io_pdir, io_tlb_ps; + u64 iova_base, *io_pdir, io_tlb_ps; int io_tlb_shift; printk(KERN_INFO DRVPFX "IO PDIR shared with sba_iommu\n"); -- cgit v1.2.3 From c2c4798e04ef836b12f5df04e7d1a1710cb39301 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Thu, 26 Oct 2006 10:06:07 -0600 Subject: [PARISC] sparse fixes 0/NULL, missing __user, missing __iomem, non-ANSI prototype. Signed-off-by: Matthew Wilcox Signed-off-by: Kyle McMartin --- drivers/parisc/iosapic_private.h | 2 +- drivers/parisc/lba_pci.c | 2 +- drivers/parisc/sba_iommu.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/parisc/iosapic_private.h b/drivers/parisc/iosapic_private.h index 41e7ec2a44aa..6e05e30a2450 100644 --- a/drivers/parisc/iosapic_private.h +++ b/drivers/parisc/iosapic_private.h @@ -132,7 +132,7 @@ struct iosapic_irt { struct vector_info { struct iosapic_info *iosapic; /* I/O SAPIC this vector is on */ struct irt_entry *irte; /* IRT entry */ - u32 *eoi_addr; /* precalculate EOI reg address */ + u32 __iomem *eoi_addr; /* precalculate EOI reg address */ u32 eoi_data; /* IA64: ? PA: swapped txn_data */ int txn_irq; /* virtual IRQ number for processor */ ulong txn_addr; /* IA64: id_eid PA: partial HPA */ diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index ba6769934c77..ad4a1a12a1ae 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c @@ -980,7 +980,7 @@ LBA_PORT_IN(32, 0) #define LBA_PORT_OUT(size, mask) \ static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \ { \ - void *where = (void *) PIOP_TO_GMMIO(LBA_DEV(l), addr); \ + void __iomem *where = PIOP_TO_GMMIO(LBA_DEV(l), addr); \ DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, l, addr, val); \ WRITE_REG##size(val, where); \ /* flush the I/O down to the elroy at least */ \ diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index f1e7ccd5475b..41abbed51ea7 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c @@ -846,7 +846,7 @@ static void *sba_alloc_consistent(struct device *hwdev, size_t size, if (!hwdev) { /* only support PCI */ *dma_handle = 0; - return 0; + return NULL; } ret = (void *) __get_free_pages(gfp, get_order(size)); -- cgit v1.2.3 From 353dfe1290bdce1d40609e35ca6e42829623ff5f Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Sat, 18 Nov 2006 10:11:03 -0700 Subject: [PARISC] Fix PCI bus numbering in the presence of Cardbus bridges Firmware ignores Cardbus bridges, so when Linux assigns bus numbers, it must override firmware's notion of what the busses are numbered. This is not sufficient to support the Cardbus bridge as there is also no interrupt routing table entry for them. Signed-off-by: Matthew Wilcox Signed-off-by: Kyle McMartin --- drivers/parisc/lba_pci.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'drivers') diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index ad4a1a12a1ae..eae0812f01a5 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c @@ -1406,13 +1406,20 @@ lba_hw_init(struct lba_device *d) return 0; } - +/* + * Unfortunately, when firmware numbers busses, it doesn't take into account + * Cardbus bridges. So we have to renumber the busses to suit ourselves. + * Elroy/Mercury don't actually know what bus number they're attached to; + * we use bus 0 to indicate the directly attached bus and any other bus + * number will be taken care of by the PCI-PCI bridge. + */ +static unsigned int lba_next_bus = 0; /* -** Determine if lba should claim this chip (return 0) or not (return 1). -** If so, initialize the chip and tell other partners in crime they -** have work to do. -*/ + * Determine if lba should claim this chip (return 0) or not (return 1). + * If so, initialize the chip and tell other partners in crime they + * have work to do. + */ static int __init lba_driver_probe(struct parisc_device *dev) { @@ -1478,9 +1485,7 @@ lba_driver_probe(struct parisc_device *dev) return -ENODEV; } - /* - ** Tell I/O SAPIC driver we have a IRQ handler/region. - */ + /* Tell I/O SAPIC driver we have a IRQ handler/region. */ tmp_obj = iosapic_register(dev->hpa.start + LBA_IOSAPIC_BASE); /* NOTE: PCI devices (e.g. 103c:1005 graphics card) which don't @@ -1529,16 +1534,17 @@ lba_driver_probe(struct parisc_device *dev) lba_legacy_resources(dev, lba_dev); } - /* - ** Tell PCI support another PCI bus was found. - ** Walks PCI bus for us too. - */ + if (lba_dev->hba.bus_num.start < lba_next_bus) + lba_dev->hba.bus_num.start = lba_next_bus; + dev->dev.platform_data = lba_dev; lba_bus = lba_dev->hba.hba_bus = pci_scan_bus_parented(&dev->dev, lba_dev->hba.bus_num.start, cfg_ops, NULL); - if (lba_bus) + if (lba_bus) { + lba_next_bus = lba_bus->subordinate + 1; pci_bus_add_devices(lba_bus); + } /* This is in lieu of calling pci_assign_unassigned_resources() */ if (is_pdc_pat()) { -- cgit v1.2.3 From 93ea774bf2d7f2b04ce4c57dbae08b5fa877296d Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Sat, 14 Oct 2006 22:11:32 +0200 Subject: [PARISC] lasi_82596: use BUILD_BUG_ON() and constify static array Signed-off-by: Helge Deller Signed-off-by: Kyle McMartin --- drivers/net/lasi_82596.c | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'drivers') diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c index ea392f2a5aa2..452863d5d498 100644 --- a/drivers/net/lasi_82596.c +++ b/drivers/net/lasi_82596.c @@ -384,7 +384,7 @@ struct i596_private { struct device *dev; }; -static char init_setup[] = +static const char init_setup[] = { 0x8E, /* length, prefetch on */ 0xC8, /* fifo to 8, monitor off */ @@ -683,7 +683,7 @@ static int init_i596_mem(struct net_device *dev) enable_irq(dev->irq); /* enable IRQs from LAN */ DEB(DEB_INIT, printk("%s: queuing CmdConfigure\n", dev->name)); - memcpy(lp->cf_cmd.i596_config, init_setup, 14); + memcpy(lp->cf_cmd.i596_config, init_setup, sizeof(init_setup)); lp->cf_cmd.cmd.command = CmdConfigure; CHECK_WBACK(lp, &(lp->cf_cmd), sizeof(struct cf_cmd)); i596_add_cmd(dev, &lp->cf_cmd.cmd); @@ -1156,32 +1156,12 @@ static int __devinit i82596_probe(struct net_device *dev, dma_addr_t dma_addr; /* This lot is ensure things have been cache line aligned. */ - if (sizeof(struct i596_rfd) != 32) { - printk("82596: sizeof(struct i596_rfd) = %d\n", - (int)sizeof(struct i596_rfd)); - return -ENODEV; - } - if ((sizeof(struct i596_rbd) % 32) != 0) { - printk("82596: sizeof(struct i596_rbd) = %d\n", - (int)sizeof(struct i596_rbd)); - return -ENODEV; - } - if ((sizeof(struct tx_cmd) % 32) != 0) { - printk("82596: sizeof(struct tx_cmd) = %d\n", - (int)sizeof(struct tx_cmd)); - return -ENODEV; - } - if (sizeof(struct i596_tbd) != 32) { - printk("82596: sizeof(struct i596_tbd) = %d\n", - (int)sizeof(struct i596_tbd)); - return -ENODEV; - } + BUILD_BUG_ON(sizeof(struct i596_rfd) != 32); + BUILD_BUG_ON(sizeof(struct i596_rbd) & 31); + BUILD_BUG_ON(sizeof(struct tx_cmd) & 31); + BUILD_BUG_ON(sizeof(struct i596_tbd) != 32); #ifndef __LP64__ - if (sizeof(struct i596_private) > 4096) { - printk("82596: sizeof(struct i596_private) = %d\n", - (int)sizeof(struct i596_private)); - return -ENODEV; - } + BUILD_BUG_ON(sizeof(struct i596_private) > 4096); #endif if (!dev->base_addr || !dev->irq) -- cgit v1.2.3 From 6de187ee17058e7798357994696774a5c2c8a6d9 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Sat, 18 Nov 2006 10:05:16 -0700 Subject: [PARISC] Make Lasi Ethernet depend on GSC only If we separate out LASI and ASP support later, we'll need this. Plus, this makes it consistent with the ncr700 scsi driver. Signed-off-by: Matthew Wilcox Signed-off-by: Kyle McMartin --- drivers/net/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 9de0eed6755b..f59be5eeda9c 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -440,10 +440,10 @@ config HPLANCE config LASI_82596 tristate "Lasi ethernet" - depends on NET_ETHERNET && PARISC && GSC_LASI + depends on NET_ETHERNET && GSC help - Say Y here to support the on-board Intel 82596 ethernet controller - built into Hewlett-Packard PA-RISC machines. + Say Y here to support the builtin Intel 82596 ethernet controller + found in Hewlett-Packard PA-RISC machines with 10Mbit ethernet. config MIPS_JAZZ_SONIC tristate "MIPS JAZZ onboard SONIC Ethernet support" -- cgit v1.2.3 From 6858f3bf6e856d10a932d2d167d3f34e366042c6 Mon Sep 17 00:00:00 2001 From: David Howells Date: Thu, 7 Dec 2006 15:31:38 +0000 Subject: [PATCH] WorkStruct: Fix up some PA-RISC work items Fix up some PA-RISC work items broken by the workstruct reduction. Signed-off-by: David Howells Signed-off-by: Kyle McMartin --- drivers/parisc/led.c | 12 ++++++------ drivers/parisc/power.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index 8dac2ba82bb9..6818c10c0c46 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c @@ -66,8 +66,8 @@ static char lcd_text_default[32] __read_mostly; static struct workqueue_struct *led_wq; -static void led_work_func(void *); -static DECLARE_WORK(led_task, led_work_func, NULL); +static void led_work_func(struct work_struct *); +static DECLARE_DELAYED_WORK(led_task, led_work_func); #if 0 #define DPRINTK(x) printk x @@ -136,7 +136,7 @@ static int start_task(void) /* Create the work queue and queue the LED task */ led_wq = create_singlethread_workqueue("led_wq"); - queue_work(led_wq, &led_task); + queue_delayed_work(led_wq, &led_task, 0); return 0; } @@ -443,7 +443,7 @@ static __inline__ int led_get_diskio_activity(void) #define LED_UPDATE_INTERVAL (1 + (HZ*19/1000)) -static void led_work_func (void *unused) +static void led_work_func (struct work_struct *unused) { static unsigned long last_jiffies; static unsigned long count_HZ; /* counter in range 0..HZ */ @@ -590,7 +590,7 @@ int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long d /* Ensure the work is queued */ if (led_wq) { - queue_work(led_wq, &led_task); + queue_delayed_work(led_wq, &led_task, 0); } return 0; @@ -660,7 +660,7 @@ int lcd_print( char *str ) /* re-queue the work */ if (led_wq) { - queue_work(led_wq, &led_task); + queue_delayed_work(led_wq, &led_task, 0); } return lcd_info.lcd_width; diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c index 97e9dc066f95..9228e210c3bb 100644 --- a/drivers/parisc/power.c +++ b/drivers/parisc/power.c @@ -82,7 +82,7 @@ } ) -static void deferred_poweroff(void *dummy) +static void deferred_poweroff(struct work_struct *unused) { if (kill_cad_pid(SIGINT, 1)) { /* just in case killing init process failed */ @@ -96,7 +96,7 @@ static void deferred_poweroff(void *dummy) * use schedule_work(). */ -static DECLARE_WORK(poweroff_work, deferred_poweroff, NULL); +static DECLARE_WORK(poweroff_work, deferred_poweroff); static void poweroff(void) { -- cgit v1.2.3 From 29a1e1d2732c7bfa94465749285aea0f2ed12213 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Mon, 5 Feb 2007 16:33:59 -0800 Subject: [PATCH] parisc: fix module_param iommu permission Fix/change module_param permissions parameter from an init value to a permission value. Signed-off-by: Randy Dunlap Cc: Kyle McMartin Cc: Matthew Wilcox Signed-off-by: Andrew Morton --- drivers/parisc/sba_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index 41abbed51ea7..26fece45e737 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c @@ -109,7 +109,7 @@ static unsigned long piranha_bad_128k = 0; #ifdef SBA_AGP_SUPPORT static int sba_reserve_agpgart = 1; -module_param(sba_reserve_agpgart, int, 1); +module_param(sba_reserve_agpgart, int, 0444); MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART"); #endif -- cgit v1.2.3