aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sunzilog.c
diff options
context:
space:
mode:
authorRobert Reif <reif@earthlink.net>2008-04-24 06:37:51 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-24 06:37:51 -0400
commit227739bf4c110bbd02d0c0f13b272c32de406e4c (patch)
tree3b585ec678bf162606c9d69f8a22197e4277739d /drivers/serial/sunzilog.c
parent77c664fa58624079f7a0fc29b46e8a32883633a5 (diff)
sparc: sunzilog uart order
I have a sparcstation 20 clone with a lot of on board serial ports. The serial core code assumes that uarts are assigned contiguously and that may not be the case when there are multiple zs devices present. This patch insures that uart chips are placed in front of keyboard/mouse chips in the port table. ffd37420: ttyS0 at MMIO 0xf1100000 (irq = 44) is a zs (ESCC) Console: ttyS0 (SunZilog zs0) console [ttyS0] enabled ffd37420: ttyS1 at MMIO 0xf1100004 (irq = 44) is a zs (ESCC) ffd37500: Keyboard at MMIO 0xf1000000 (irq = 44) is a zs ffd37500: Mouse at MMIO 0xf1000004 (irq = 44) is a zs ffd3c5c0: ttyS2 at MMIO 0xf1100008 (irq = 44) is a zs (ESCC) ffd3c5c0: ttyS3 at MMIO 0xf110000c (irq = 44) is a zs (ESCC) ffd3c6a0: ttyS4 at MMIO 0xf1100010 (irq = 44) is a zs (ESCC) ffd3c6a0: ttyS5 at MMIO 0xf1100014 (irq = 44) is a zs (ESCC) ffd3c780: ttyS6 at MMIO 0xf1100018 (irq = 44) is a zs (ESCC) ffd3c780: ttyS7 at MMIO 0xf110001c (irq = 44) is a zs (ESCC) Signed-off-by: Robert Reif <reif@earthlink.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/serial/sunzilog.c')
-rw-r--r--drivers/serial/sunzilog.c30
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
1018static int uart_chip_count;
1018static struct uart_sunzilog_port *sunzilog_port_table; 1019static struct uart_sunzilog_port *sunzilog_port_table;
1019static struct zilog_layout __iomem **sunzilog_chip_regs; 1020static struct zilog_layout __iomem **sunzilog_chip_regs;
1020 1021
@@ -1350,16 +1351,22 @@ static int zilog_irq = -1;
1350 1351
1351static int __devinit zs_probe(struct of_device *op, const struct of_device_id *match) 1352static 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 = {
1491static int __init sunzilog_init(void) 1498static 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 }