diff options
Diffstat (limited to 'drivers/serial/sunzilog.c')
-rw-r--r-- | drivers/serial/sunzilog.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index cb2e40506379..3271379a36db 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
@@ -1015,6 +1015,7 @@ static struct uart_ops sunzilog_pops = { | |||
1015 | .verify_port = sunzilog_verify_port, | 1015 | .verify_port = sunzilog_verify_port, |
1016 | }; | 1016 | }; |
1017 | 1017 | ||
1018 | static int uart_chip_count; | ||
1018 | static struct uart_sunzilog_port *sunzilog_port_table; | 1019 | static struct uart_sunzilog_port *sunzilog_port_table; |
1019 | static struct zilog_layout __iomem **sunzilog_chip_regs; | 1020 | static struct zilog_layout __iomem **sunzilog_chip_regs; |
1020 | 1021 | ||
@@ -1350,16 +1351,22 @@ static int zilog_irq = -1; | |||
1350 | 1351 | ||
1351 | static int __devinit zs_probe(struct of_device *op, const struct of_device_id *match) | 1352 | static int __devinit zs_probe(struct of_device *op, const struct of_device_id *match) |
1352 | { | 1353 | { |
1353 | static int inst; | 1354 | static int kbm_inst, uart_inst; |
1355 | int inst; | ||
1354 | struct uart_sunzilog_port *up; | 1356 | struct uart_sunzilog_port *up; |
1355 | struct zilog_layout __iomem *rp; | 1357 | struct zilog_layout __iomem *rp; |
1356 | int keyboard_mouse; | 1358 | int keyboard_mouse = 0; |
1357 | int err; | 1359 | int err; |
1358 | 1360 | ||
1359 | keyboard_mouse = 0; | ||
1360 | if (of_find_property(op->node, "keyboard", NULL)) | 1361 | if (of_find_property(op->node, "keyboard", NULL)) |
1361 | keyboard_mouse = 1; | 1362 | keyboard_mouse = 1; |
1362 | 1363 | ||
1364 | /* uarts must come before keyboards/mice */ | ||
1365 | if (keyboard_mouse) | ||
1366 | inst = uart_chip_count + kbm_inst; | ||
1367 | else | ||
1368 | inst = uart_inst; | ||
1369 | |||
1363 | sunzilog_chip_regs[inst] = of_ioremap(&op->resource[0], 0, | 1370 | sunzilog_chip_regs[inst] = of_ioremap(&op->resource[0], 0, |
1364 | sizeof(struct zilog_layout), | 1371 | sizeof(struct zilog_layout), |
1365 | "zs"); | 1372 | "zs"); |
@@ -1427,6 +1434,7 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m | |||
1427 | rp, sizeof(struct zilog_layout)); | 1434 | rp, sizeof(struct zilog_layout)); |
1428 | return err; | 1435 | return err; |
1429 | } | 1436 | } |
1437 | uart_inst++; | ||
1430 | } else { | 1438 | } else { |
1431 | printk(KERN_INFO "%s: Keyboard at MMIO 0x%llx (irq = %d) " | 1439 | printk(KERN_INFO "%s: Keyboard at MMIO 0x%llx (irq = %d) " |
1432 | "is a %s\n", | 1440 | "is a %s\n", |
@@ -1438,12 +1446,11 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m | |||
1438 | op->dev.bus_id, | 1446 | op->dev.bus_id, |
1439 | (unsigned long long) up[1].port.mapbase, | 1447 | (unsigned long long) up[1].port.mapbase, |
1440 | op->irqs[0], sunzilog_type(&up[1].port)); | 1448 | op->irqs[0], sunzilog_type(&up[1].port)); |
1449 | kbm_inst++; | ||
1441 | } | 1450 | } |
1442 | 1451 | ||
1443 | dev_set_drvdata(&op->dev, &up[0]); | 1452 | dev_set_drvdata(&op->dev, &up[0]); |
1444 | 1453 | ||
1445 | inst++; | ||
1446 | |||
1447 | return 0; | 1454 | return 0; |
1448 | } | 1455 | } |
1449 | 1456 | ||
@@ -1491,28 +1498,25 @@ static struct of_platform_driver zs_driver = { | |||
1491 | static int __init sunzilog_init(void) | 1498 | static int __init sunzilog_init(void) |
1492 | { | 1499 | { |
1493 | struct device_node *dp; | 1500 | struct device_node *dp; |
1494 | int err, uart_count; | 1501 | int err; |
1495 | int num_keybms; | 1502 | int num_keybms = 0; |
1496 | int num_sunzilog = 0; | 1503 | int num_sunzilog = 0; |
1497 | 1504 | ||
1498 | num_keybms = 0; | ||
1499 | for_each_node_by_name(dp, "zs") { | 1505 | for_each_node_by_name(dp, "zs") { |
1500 | num_sunzilog++; | 1506 | num_sunzilog++; |
1501 | if (of_find_property(dp, "keyboard", NULL)) | 1507 | if (of_find_property(dp, "keyboard", NULL)) |
1502 | num_keybms++; | 1508 | num_keybms++; |
1503 | } | 1509 | } |
1504 | 1510 | ||
1505 | uart_count = 0; | ||
1506 | if (num_sunzilog) { | 1511 | if (num_sunzilog) { |
1507 | int uart_count; | ||
1508 | |||
1509 | err = sunzilog_alloc_tables(num_sunzilog); | 1512 | err = sunzilog_alloc_tables(num_sunzilog); |
1510 | if (err) | 1513 | if (err) |
1511 | goto out; | 1514 | goto out; |
1512 | 1515 | ||
1513 | uart_count = (num_sunzilog * 2) - (2 * num_keybms); | 1516 | uart_chip_count = num_sunzilog - num_keybms; |
1514 | 1517 | ||
1515 | err = sunserial_register_minors(&sunzilog_reg, uart_count); | 1518 | err = sunserial_register_minors(&sunzilog_reg, |
1519 | uart_chip_count * 2); | ||
1516 | if (err) | 1520 | if (err) |
1517 | goto out_free_tables; | 1521 | goto out_free_tables; |
1518 | } | 1522 | } |