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/serial/mux.c') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 8ad1b8c..ec57a61 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.1 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/serial/mux.c') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index ec57a61..6408b9b 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.1 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/serial/mux.c') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 6408b9b..f21faf1 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) @@ -434,6 +441,37 @@ static struct uart_ops mux_pops = { }; /** + * 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.1 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/serial/mux.c') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index f21faf1..5ff7e05 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) @@ -441,37 +434,6 @@ static struct uart_ops mux_pops = { }; /** - * 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.1 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/serial/mux.c') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 5ff7e05..87269cc 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.1 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/serial/mux.c') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 87269cc..f5b17f5 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.1 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/serial/mux.c') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index f5b17f5..ea9cbda 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.1