diff options
author | Paul Mackerras <paulus@samba.org> | 2006-07-31 20:37:25 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-07-31 20:37:25 -0400 |
commit | 57cad8084e0837e0f2c97da789ec9b3f36809be9 (patch) | |
tree | e9c790afb4286f78cb08d9664f58baa7e876fe55 /drivers/serial | |
parent | cb18bd40030c879cd93fef02fd579f74dbab473d (diff) | |
parent | 49b1e3ea19b1c95c2f012b8331ffb3b169e4c042 (diff) |
Merge branch 'merge'
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/8250.c | 25 | ||||
-rw-r--r-- | drivers/serial/dz.c | 2 | ||||
-rw-r--r-- | drivers/serial/ip22zilog.c | 3 | ||||
-rw-r--r-- | drivers/serial/serial_core.c | 1 | ||||
-rw-r--r-- | drivers/serial/sunsab.c | 7 | ||||
-rw-r--r-- | drivers/serial/sunsu.c | 40 | ||||
-rw-r--r-- | drivers/serial/sunzilog.c | 125 | ||||
-rw-r--r-- | drivers/serial/vr41xx_siu.c | 1 |
8 files changed, 130 insertions, 74 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 0995430e4cf1..0ae9ced00ed4 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -299,6 +299,7 @@ static inline int map_8250_out_reg(struct uart_8250_port *up, int offset) | |||
299 | 299 | ||
300 | static unsigned int serial_in(struct uart_8250_port *up, int offset) | 300 | static unsigned int serial_in(struct uart_8250_port *up, int offset) |
301 | { | 301 | { |
302 | unsigned int tmp; | ||
302 | offset = map_8250_in_reg(up, offset) << up->port.regshift; | 303 | offset = map_8250_in_reg(up, offset) << up->port.regshift; |
303 | 304 | ||
304 | switch (up->port.iotype) { | 305 | switch (up->port.iotype) { |
@@ -317,6 +318,13 @@ static unsigned int serial_in(struct uart_8250_port *up, int offset) | |||
317 | return __raw_readl(up->port.membase + offset); | 318 | return __raw_readl(up->port.membase + offset); |
318 | #endif | 319 | #endif |
319 | 320 | ||
321 | case UPIO_TSI: | ||
322 | if (offset == UART_IIR) { | ||
323 | tmp = readl((u32 *)(up->port.membase + UART_RX)); | ||
324 | return (cpu_to_le32(tmp) >> 8) & 0xff; | ||
325 | } else | ||
326 | return readb(up->port.membase + offset); | ||
327 | |||
320 | default: | 328 | default: |
321 | return inb(up->port.iobase + offset); | 329 | return inb(up->port.iobase + offset); |
322 | } | 330 | } |
@@ -346,6 +354,10 @@ serial_out(struct uart_8250_port *up, int offset, int value) | |||
346 | __raw_writel(value, up->port.membase + offset); | 354 | __raw_writel(value, up->port.membase + offset); |
347 | break; | 355 | break; |
348 | #endif | 356 | #endif |
357 | case UPIO_TSI: | ||
358 | if (!((offset == UART_IER) && (value & UART_IER_UUE))) | ||
359 | writeb(value, up->port.membase + offset); | ||
360 | break; | ||
349 | 361 | ||
350 | default: | 362 | default: |
351 | outb(value, up->port.iobase + offset); | 363 | outb(value, up->port.iobase + offset); |
@@ -2240,10 +2252,14 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
2240 | 2252 | ||
2241 | touch_nmi_watchdog(); | 2253 | touch_nmi_watchdog(); |
2242 | 2254 | ||
2243 | if (oops_in_progress) { | 2255 | local_irq_save(flags); |
2244 | locked = spin_trylock_irqsave(&up->port.lock, flags); | 2256 | if (up->port.sysrq) { |
2257 | /* serial8250_handle_port() already took the lock */ | ||
2258 | locked = 0; | ||
2259 | } else if (oops_in_progress) { | ||
2260 | locked = spin_trylock(&up->port.lock); | ||
2245 | } else | 2261 | } else |
2246 | spin_lock_irqsave(&up->port.lock, flags); | 2262 | spin_lock(&up->port.lock); |
2247 | 2263 | ||
2248 | /* | 2264 | /* |
2249 | * First save the IER then disable the interrupts | 2265 | * First save the IER then disable the interrupts |
@@ -2265,7 +2281,8 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
2265 | serial_out(up, UART_IER, ier); | 2281 | serial_out(up, UART_IER, ier); |
2266 | 2282 | ||
2267 | if (locked) | 2283 | if (locked) |
2268 | spin_unlock_irqrestore(&up->port.lock, flags); | 2284 | spin_unlock(&up->port.lock); |
2285 | local_irq_restore(flags); | ||
2269 | } | 2286 | } |
2270 | 2287 | ||
2271 | static int serial8250_console_setup(struct console *co, char *options) | 2288 | static int serial8250_console_setup(struct console *co, char *options) |
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c index d119c8296a78..8a98aae80e22 100644 --- a/drivers/serial/dz.c +++ b/drivers/serial/dz.c | |||
@@ -673,7 +673,7 @@ static void dz_reset(struct dz_port *dport) | |||
673 | } | 673 | } |
674 | 674 | ||
675 | #ifdef CONFIG_SERIAL_DZ_CONSOLE | 675 | #ifdef CONFIG_SERIAL_DZ_CONSOLE |
676 | static void dz_console_putchar(struct uart_port *port, int ch) | 676 | static void dz_console_putchar(struct uart_port *uport, int ch) |
677 | { | 677 | { |
678 | struct dz_port *dport = (struct dz_port *)uport; | 678 | struct dz_port *dport = (struct dz_port *)uport; |
679 | unsigned long flags; | 679 | unsigned long flags; |
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c index 342042889f6e..5ff269fb604c 100644 --- a/drivers/serial/ip22zilog.c +++ b/drivers/serial/ip22zilog.c | |||
@@ -1143,9 +1143,8 @@ static void __init ip22zilog_prepare(void) | |||
1143 | up[(chip * 2) + 1].port.fifosize = 1; | 1143 | up[(chip * 2) + 1].port.fifosize = 1; |
1144 | up[(chip * 2) + 1].port.ops = &ip22zilog_pops; | 1144 | up[(chip * 2) + 1].port.ops = &ip22zilog_pops; |
1145 | up[(chip * 2) + 1].port.type = PORT_IP22ZILOG; | 1145 | up[(chip * 2) + 1].port.type = PORT_IP22ZILOG; |
1146 | up[(chip * 2) + 1].port.flags |= IP22ZILOG_FLAG_IS_CHANNEL_A; | ||
1147 | up[(chip * 2) + 1].port.line = (chip * 2) + 1; | 1146 | up[(chip * 2) + 1].port.line = (chip * 2) + 1; |
1148 | up[(chip * 2) + 1].flags = 0; | 1147 | up[(chip * 2) + 1].flags |= IP22ZILOG_FLAG_IS_CHANNEL_A; |
1149 | } | 1148 | } |
1150 | } | 1149 | } |
1151 | 1150 | ||
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index d5f636fbf29a..80ef7d482756 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -2036,6 +2036,7 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port) | |||
2036 | case UPIO_MEM: | 2036 | case UPIO_MEM: |
2037 | case UPIO_MEM32: | 2037 | case UPIO_MEM32: |
2038 | case UPIO_AU: | 2038 | case UPIO_AU: |
2039 | case UPIO_TSI: | ||
2039 | snprintf(address, sizeof(address), | 2040 | snprintf(address, sizeof(address), |
2040 | "MMIO 0x%lx", port->mapbase); | 2041 | "MMIO 0x%lx", port->mapbase); |
2041 | break; | 2042 | break; |
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index 0dbd4df44c05..dc673e1b6fd9 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
@@ -1047,12 +1047,13 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id * | |||
1047 | up = &sunsab_ports[inst * 2]; | 1047 | up = &sunsab_ports[inst * 2]; |
1048 | 1048 | ||
1049 | err = sunsab_init_one(&up[0], op, | 1049 | err = sunsab_init_one(&up[0], op, |
1050 | sizeof(union sab82532_async_regs), | 1050 | 0, |
1051 | (inst * 2) + 0); | 1051 | (inst * 2) + 0); |
1052 | if (err) | 1052 | if (err) |
1053 | return err; | 1053 | return err; |
1054 | 1054 | ||
1055 | err = sunsab_init_one(&up[0], op, 0, | 1055 | err = sunsab_init_one(&up[1], op, |
1056 | sizeof(union sab82532_async_regs), | ||
1056 | (inst * 2) + 1); | 1057 | (inst * 2) + 1); |
1057 | if (err) { | 1058 | if (err) { |
1058 | of_iounmap(up[0].port.membase, | 1059 | of_iounmap(up[0].port.membase, |
@@ -1117,7 +1118,7 @@ static int __init sunsab_init(void) | |||
1117 | int err; | 1118 | int err; |
1118 | 1119 | ||
1119 | num_channels = 0; | 1120 | num_channels = 0; |
1120 | for_each_node_by_name(dp, "su") | 1121 | for_each_node_by_name(dp, "se") |
1121 | num_channels += 2; | 1122 | num_channels += 2; |
1122 | for_each_node_by_name(dp, "serial") { | 1123 | for_each_node_by_name(dp, "serial") { |
1123 | if (of_device_is_compatible(dp, "sab82532")) | 1124 | if (of_device_is_compatible(dp, "sab82532")) |
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index f9013baba05b..d3a5aeee73a3 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
@@ -1200,6 +1200,11 @@ static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up) | |||
1200 | if (up->port.type == PORT_UNKNOWN) | 1200 | if (up->port.type == PORT_UNKNOWN) |
1201 | return -ENODEV; | 1201 | return -ENODEV; |
1202 | 1202 | ||
1203 | printk("%s: %s port at %lx, irq %u\n", | ||
1204 | to_of_device(up->port.dev)->node->full_name, | ||
1205 | (up->su_type == SU_PORT_KBD) ? "Keyboard" : "Mouse", | ||
1206 | up->port.mapbase, up->port.irq); | ||
1207 | |||
1203 | #ifdef CONFIG_SERIO | 1208 | #ifdef CONFIG_SERIO |
1204 | serio = &up->serio; | 1209 | serio = &up->serio; |
1205 | serio->port_data = up; | 1210 | serio->port_data = up; |
@@ -1406,25 +1411,35 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m | |||
1406 | struct device_node *dp = op->node; | 1411 | struct device_node *dp = op->node; |
1407 | struct uart_sunsu_port *up; | 1412 | struct uart_sunsu_port *up; |
1408 | struct resource *rp; | 1413 | struct resource *rp; |
1414 | enum su_type type; | ||
1409 | int err; | 1415 | int err; |
1410 | 1416 | ||
1411 | if (inst >= UART_NR) | 1417 | type = su_get_type(dp); |
1412 | return -EINVAL; | 1418 | if (type == SU_PORT_PORT) { |
1419 | if (inst >= UART_NR) | ||
1420 | return -EINVAL; | ||
1421 | up = &sunsu_ports[inst]; | ||
1422 | } else { | ||
1423 | up = kzalloc(sizeof(*up), GFP_KERNEL); | ||
1424 | if (!up) | ||
1425 | return -ENOMEM; | ||
1426 | } | ||
1413 | 1427 | ||
1414 | up = &sunsu_ports[inst]; | ||
1415 | up->port.line = inst; | 1428 | up->port.line = inst; |
1416 | 1429 | ||
1417 | spin_lock_init(&up->port.lock); | 1430 | spin_lock_init(&up->port.lock); |
1418 | 1431 | ||
1419 | up->su_type = su_get_type(dp); | 1432 | up->su_type = type; |
1420 | 1433 | ||
1421 | rp = &op->resource[0]; | 1434 | rp = &op->resource[0]; |
1422 | up->port.mapbase = op->resource[0].start; | 1435 | up->port.mapbase = rp->start; |
1423 | |||
1424 | up->reg_size = (rp->end - rp->start) + 1; | 1436 | up->reg_size = (rp->end - rp->start) + 1; |
1425 | up->port.membase = of_ioremap(rp, 0, up->reg_size, "su"); | 1437 | up->port.membase = of_ioremap(rp, 0, up->reg_size, "su"); |
1426 | if (!up->port.membase) | 1438 | if (!up->port.membase) { |
1439 | if (type != SU_PORT_PORT) | ||
1440 | kfree(up); | ||
1427 | return -ENOMEM; | 1441 | return -ENOMEM; |
1442 | } | ||
1428 | 1443 | ||
1429 | up->port.irq = op->irqs[0]; | 1444 | up->port.irq = op->irqs[0]; |
1430 | 1445 | ||
@@ -1436,8 +1451,11 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m | |||
1436 | err = 0; | 1451 | err = 0; |
1437 | if (up->su_type == SU_PORT_KBD || up->su_type == SU_PORT_MS) { | 1452 | if (up->su_type == SU_PORT_KBD || up->su_type == SU_PORT_MS) { |
1438 | err = sunsu_kbd_ms_init(up); | 1453 | err = sunsu_kbd_ms_init(up); |
1439 | if (err) | 1454 | if (err) { |
1455 | kfree(up); | ||
1440 | goto out_unmap; | 1456 | goto out_unmap; |
1457 | } | ||
1458 | dev_set_drvdata(&op->dev, up); | ||
1441 | 1459 | ||
1442 | return 0; | 1460 | return 0; |
1443 | } | 1461 | } |
@@ -1476,8 +1494,12 @@ static int __devexit su_remove(struct of_device *dev) | |||
1476 | #ifdef CONFIG_SERIO | 1494 | #ifdef CONFIG_SERIO |
1477 | serio_unregister_port(&up->serio); | 1495 | serio_unregister_port(&up->serio); |
1478 | #endif | 1496 | #endif |
1479 | } else if (up->port.type != PORT_UNKNOWN) | 1497 | kfree(up); |
1498 | } else if (up->port.type != PORT_UNKNOWN) { | ||
1480 | uart_remove_one_port(&sunsu_reg, &up->port); | 1499 | uart_remove_one_port(&sunsu_reg, &up->port); |
1500 | } | ||
1501 | |||
1502 | dev_set_drvdata(&dev->dev, NULL); | ||
1481 | 1503 | ||
1482 | return 0; | 1504 | return 0; |
1483 | } | 1505 | } |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index a1456d9352cb..47bc3d57e019 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
@@ -68,9 +68,6 @@ static int num_sunzilog; | |||
68 | #define NUM_SUNZILOG num_sunzilog | 68 | #define NUM_SUNZILOG num_sunzilog |
69 | #define NUM_CHANNELS (NUM_SUNZILOG * 2) | 69 | #define NUM_CHANNELS (NUM_SUNZILOG * 2) |
70 | 70 | ||
71 | #define KEYBOARD_LINE 0x2 | ||
72 | #define MOUSE_LINE 0x3 | ||
73 | |||
74 | #define ZS_CLOCK 4915200 /* Zilog input clock rate. */ | 71 | #define ZS_CLOCK 4915200 /* Zilog input clock rate. */ |
75 | #define ZS_CLOCK_DIVISOR 16 /* Divisor this driver uses. */ | 72 | #define ZS_CLOCK_DIVISOR 16 /* Divisor this driver uses. */ |
76 | 73 | ||
@@ -1225,12 +1222,10 @@ static void __init sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channe | |||
1225 | { | 1222 | { |
1226 | int baud, brg; | 1223 | int baud, brg; |
1227 | 1224 | ||
1228 | if (channel == KEYBOARD_LINE) { | 1225 | if (up->flags & SUNZILOG_FLAG_CONS_KEYB) { |
1229 | up->flags |= SUNZILOG_FLAG_CONS_KEYB; | ||
1230 | up->cflag = B1200 | CS8 | CLOCAL | CREAD; | 1226 | up->cflag = B1200 | CS8 | CLOCAL | CREAD; |
1231 | baud = 1200; | 1227 | baud = 1200; |
1232 | } else { | 1228 | } else { |
1233 | up->flags |= SUNZILOG_FLAG_CONS_MOUSE; | ||
1234 | up->cflag = B4800 | CS8 | CLOCAL | CREAD; | 1229 | up->cflag = B4800 | CS8 | CLOCAL | CREAD; |
1235 | baud = 4800; | 1230 | baud = 4800; |
1236 | } | 1231 | } |
@@ -1243,14 +1238,14 @@ static void __init sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channe | |||
1243 | } | 1238 | } |
1244 | 1239 | ||
1245 | #ifdef CONFIG_SERIO | 1240 | #ifdef CONFIG_SERIO |
1246 | static void __init sunzilog_register_serio(struct uart_sunzilog_port *up, int channel) | 1241 | static void __init sunzilog_register_serio(struct uart_sunzilog_port *up) |
1247 | { | 1242 | { |
1248 | struct serio *serio = &up->serio; | 1243 | struct serio *serio = &up->serio; |
1249 | 1244 | ||
1250 | serio->port_data = up; | 1245 | serio->port_data = up; |
1251 | 1246 | ||
1252 | serio->id.type = SERIO_RS232; | 1247 | serio->id.type = SERIO_RS232; |
1253 | if (channel == KEYBOARD_LINE) { | 1248 | if (up->flags & SUNZILOG_FLAG_CONS_KEYB) { |
1254 | serio->id.proto = SERIO_SUNKBD; | 1249 | serio->id.proto = SERIO_SUNKBD; |
1255 | strlcpy(serio->name, "zskbd", sizeof(serio->name)); | 1250 | strlcpy(serio->name, "zskbd", sizeof(serio->name)); |
1256 | } else { | 1251 | } else { |
@@ -1259,7 +1254,8 @@ static void __init sunzilog_register_serio(struct uart_sunzilog_port *up, int ch | |||
1259 | strlcpy(serio->name, "zsms", sizeof(serio->name)); | 1254 | strlcpy(serio->name, "zsms", sizeof(serio->name)); |
1260 | } | 1255 | } |
1261 | strlcpy(serio->phys, | 1256 | strlcpy(serio->phys, |
1262 | (channel == KEYBOARD_LINE ? "zs/serio0" : "zs/serio1"), | 1257 | ((up->flags & SUNZILOG_FLAG_CONS_KEYB) ? |
1258 | "zs/serio0" : "zs/serio1"), | ||
1263 | sizeof(serio->phys)); | 1259 | sizeof(serio->phys)); |
1264 | 1260 | ||
1265 | serio->write = sunzilog_serio_write; | 1261 | serio->write = sunzilog_serio_write; |
@@ -1286,8 +1282,8 @@ static void __init sunzilog_init_hw(struct uart_sunzilog_port *up) | |||
1286 | (void) read_zsreg(channel, R0); | 1282 | (void) read_zsreg(channel, R0); |
1287 | } | 1283 | } |
1288 | 1284 | ||
1289 | if (up->port.line == KEYBOARD_LINE || | 1285 | if (up->flags & (SUNZILOG_FLAG_CONS_KEYB | |
1290 | up->port.line == MOUSE_LINE) { | 1286 | SUNZILOG_FLAG_CONS_MOUSE)) { |
1291 | sunzilog_init_kbdms(up, up->port.line); | 1287 | sunzilog_init_kbdms(up, up->port.line); |
1292 | up->curregs[R9] |= (NV | MIE); | 1288 | up->curregs[R9] |= (NV | MIE); |
1293 | write_zsreg(channel, R9, up->curregs[R9]); | 1289 | write_zsreg(channel, R9, up->curregs[R9]); |
@@ -1313,37 +1309,26 @@ static void __init sunzilog_init_hw(struct uart_sunzilog_port *up) | |||
1313 | spin_unlock_irqrestore(&up->port.lock, flags); | 1309 | spin_unlock_irqrestore(&up->port.lock, flags); |
1314 | 1310 | ||
1315 | #ifdef CONFIG_SERIO | 1311 | #ifdef CONFIG_SERIO |
1316 | if (up->port.line == KEYBOARD_LINE || up->port.line == MOUSE_LINE) | 1312 | if (up->flags & (SUNZILOG_FLAG_CONS_KEYB | |
1317 | sunzilog_register_serio(up, up->port.line); | 1313 | SUNZILOG_FLAG_CONS_MOUSE)) |
1314 | sunzilog_register_serio(up); | ||
1318 | #endif | 1315 | #endif |
1319 | } | 1316 | } |
1320 | 1317 | ||
1321 | static int __devinit zs_get_instance(struct device_node *dp) | ||
1322 | { | ||
1323 | int ret; | ||
1324 | |||
1325 | ret = of_getintprop_default(dp, "slave", -1); | ||
1326 | if (ret != -1) | ||
1327 | return ret; | ||
1328 | |||
1329 | if (of_find_property(dp, "keyboard", NULL)) | ||
1330 | ret = 1; | ||
1331 | else | ||
1332 | ret = 0; | ||
1333 | |||
1334 | return ret; | ||
1335 | } | ||
1336 | |||
1337 | static int zilog_irq = -1; | 1318 | static int zilog_irq = -1; |
1338 | 1319 | ||
1339 | static int __devinit zs_probe(struct of_device *dev, const struct of_device_id *match) | 1320 | static int __devinit zs_probe(struct of_device *op, const struct of_device_id *match) |
1340 | { | 1321 | { |
1341 | struct of_device *op = to_of_device(&dev->dev); | 1322 | static int inst; |
1342 | struct uart_sunzilog_port *up; | 1323 | struct uart_sunzilog_port *up; |
1343 | struct zilog_layout __iomem *rp; | 1324 | struct zilog_layout __iomem *rp; |
1344 | int inst = zs_get_instance(dev->node); | 1325 | int keyboard_mouse; |
1345 | int err; | 1326 | int err; |
1346 | 1327 | ||
1328 | keyboard_mouse = 0; | ||
1329 | if (of_find_property(op->node, "keyboard", NULL)) | ||
1330 | keyboard_mouse = 1; | ||
1331 | |||
1347 | sunzilog_chip_regs[inst] = of_ioremap(&op->resource[0], 0, | 1332 | sunzilog_chip_regs[inst] = of_ioremap(&op->resource[0], 0, |
1348 | sizeof(struct zilog_layout), | 1333 | sizeof(struct zilog_layout), |
1349 | "zs"); | 1334 | "zs"); |
@@ -1352,16 +1337,8 @@ static int __devinit zs_probe(struct of_device *dev, const struct of_device_id * | |||
1352 | 1337 | ||
1353 | rp = sunzilog_chip_regs[inst]; | 1338 | rp = sunzilog_chip_regs[inst]; |
1354 | 1339 | ||
1355 | if (zilog_irq == -1) { | 1340 | if (zilog_irq == -1) |
1356 | zilog_irq = op->irqs[0]; | 1341 | zilog_irq = op->irqs[0]; |
1357 | err = request_irq(zilog_irq, sunzilog_interrupt, IRQF_SHARED, | ||
1358 | "zs", sunzilog_irq_chain); | ||
1359 | if (err) { | ||
1360 | of_iounmap(rp, sizeof(struct zilog_layout)); | ||
1361 | |||
1362 | return err; | ||
1363 | } | ||
1364 | } | ||
1365 | 1342 | ||
1366 | up = &sunzilog_port_table[inst * 2]; | 1343 | up = &sunzilog_port_table[inst * 2]; |
1367 | 1344 | ||
@@ -1378,7 +1355,7 @@ static int __devinit zs_probe(struct of_device *dev, const struct of_device_id * | |||
1378 | up[0].port.line = (inst * 2) + 0; | 1355 | up[0].port.line = (inst * 2) + 0; |
1379 | up[0].port.dev = &op->dev; | 1356 | up[0].port.dev = &op->dev; |
1380 | up[0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A; | 1357 | up[0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A; |
1381 | if (inst == 1) | 1358 | if (keyboard_mouse) |
1382 | up[0].flags |= SUNZILOG_FLAG_CONS_KEYB; | 1359 | up[0].flags |= SUNZILOG_FLAG_CONS_KEYB; |
1383 | sunzilog_init_hw(&up[0]); | 1360 | sunzilog_init_hw(&up[0]); |
1384 | 1361 | ||
@@ -1395,11 +1372,11 @@ static int __devinit zs_probe(struct of_device *dev, const struct of_device_id * | |||
1395 | up[1].port.line = (inst * 2) + 1; | 1372 | up[1].port.line = (inst * 2) + 1; |
1396 | up[1].port.dev = &op->dev; | 1373 | up[1].port.dev = &op->dev; |
1397 | up[1].flags |= 0; | 1374 | up[1].flags |= 0; |
1398 | if (inst == 1) | 1375 | if (keyboard_mouse) |
1399 | up[1].flags |= SUNZILOG_FLAG_CONS_MOUSE; | 1376 | up[1].flags |= SUNZILOG_FLAG_CONS_MOUSE; |
1400 | sunzilog_init_hw(&up[1]); | 1377 | sunzilog_init_hw(&up[1]); |
1401 | 1378 | ||
1402 | if (inst != 1) { | 1379 | if (!keyboard_mouse) { |
1403 | err = uart_add_one_port(&sunzilog_reg, &up[0].port); | 1380 | err = uart_add_one_port(&sunzilog_reg, &up[0].port); |
1404 | if (err) { | 1381 | if (err) { |
1405 | of_iounmap(rp, sizeof(struct zilog_layout)); | 1382 | of_iounmap(rp, sizeof(struct zilog_layout)); |
@@ -1411,9 +1388,18 @@ static int __devinit zs_probe(struct of_device *dev, const struct of_device_id * | |||
1411 | of_iounmap(rp, sizeof(struct zilog_layout)); | 1388 | of_iounmap(rp, sizeof(struct zilog_layout)); |
1412 | return err; | 1389 | return err; |
1413 | } | 1390 | } |
1391 | } else { | ||
1392 | printk(KERN_INFO "%s: Keyboard at MMIO %lx (irq = %d) " | ||
1393 | "is a zs\n", | ||
1394 | op->dev.bus_id, up[0].port.mapbase, op->irqs[0]); | ||
1395 | printk(KERN_INFO "%s: Mouse at MMIO %lx (irq = %d) " | ||
1396 | "is a zs\n", | ||
1397 | op->dev.bus_id, up[1].port.mapbase, op->irqs[0]); | ||
1414 | } | 1398 | } |
1415 | 1399 | ||
1416 | dev_set_drvdata(&dev->dev, &up[0]); | 1400 | dev_set_drvdata(&op->dev, &up[0]); |
1401 | |||
1402 | inst++; | ||
1417 | 1403 | ||
1418 | return 0; | 1404 | return 0; |
1419 | } | 1405 | } |
@@ -1462,36 +1448,65 @@ static struct of_platform_driver zs_driver = { | |||
1462 | static int __init sunzilog_init(void) | 1448 | static int __init sunzilog_init(void) |
1463 | { | 1449 | { |
1464 | struct device_node *dp; | 1450 | struct device_node *dp; |
1465 | int err; | 1451 | int err, uart_count; |
1452 | int num_keybms; | ||
1466 | 1453 | ||
1467 | NUM_SUNZILOG = 0; | 1454 | NUM_SUNZILOG = 0; |
1468 | for_each_node_by_name(dp, "zs") | 1455 | num_keybms = 0; |
1456 | for_each_node_by_name(dp, "zs") { | ||
1469 | NUM_SUNZILOG++; | 1457 | NUM_SUNZILOG++; |
1458 | if (of_find_property(dp, "keyboard", NULL)) | ||
1459 | num_keybms++; | ||
1460 | } | ||
1470 | 1461 | ||
1462 | uart_count = 0; | ||
1471 | if (NUM_SUNZILOG) { | 1463 | if (NUM_SUNZILOG) { |
1472 | int uart_count; | 1464 | int uart_count; |
1473 | 1465 | ||
1474 | err = sunzilog_alloc_tables(); | 1466 | err = sunzilog_alloc_tables(); |
1475 | if (err) | 1467 | if (err) |
1476 | return err; | 1468 | goto out; |
1477 | 1469 | ||
1478 | /* Subtract 1 for keyboard, 1 for mouse. */ | 1470 | uart_count = (NUM_SUNZILOG * 2) - (2 * num_keybms); |
1479 | uart_count = (NUM_SUNZILOG * 2) - 2; | ||
1480 | 1471 | ||
1481 | sunzilog_reg.nr = uart_count; | 1472 | sunzilog_reg.nr = uart_count; |
1482 | sunzilog_reg.minor = sunserial_current_minor; | 1473 | sunzilog_reg.minor = sunserial_current_minor; |
1483 | err = uart_register_driver(&sunzilog_reg); | 1474 | err = uart_register_driver(&sunzilog_reg); |
1484 | if (err) { | 1475 | if (err) |
1485 | sunzilog_free_tables(); | 1476 | goto out_free_tables; |
1486 | return err; | 1477 | |
1487 | } | ||
1488 | sunzilog_reg.tty_driver->name_base = sunzilog_reg.minor - 64; | 1478 | sunzilog_reg.tty_driver->name_base = sunzilog_reg.minor - 64; |
1489 | sunzilog_reg.cons = SUNZILOG_CONSOLE(); | 1479 | sunzilog_reg.cons = SUNZILOG_CONSOLE(); |
1490 | 1480 | ||
1491 | sunserial_current_minor += uart_count; | 1481 | sunserial_current_minor += uart_count; |
1492 | } | 1482 | } |
1493 | 1483 | ||
1494 | return of_register_driver(&zs_driver, &of_bus_type); | 1484 | err = of_register_driver(&zs_driver, &of_bus_type); |
1485 | if (err) | ||
1486 | goto out_unregister_uart; | ||
1487 | |||
1488 | if (zilog_irq != -1) { | ||
1489 | err = request_irq(zilog_irq, sunzilog_interrupt, IRQF_SHARED, | ||
1490 | "zs", sunzilog_irq_chain); | ||
1491 | if (err) | ||
1492 | goto out_unregister_driver; | ||
1493 | } | ||
1494 | |||
1495 | out: | ||
1496 | return err; | ||
1497 | |||
1498 | out_unregister_driver: | ||
1499 | of_unregister_driver(&zs_driver); | ||
1500 | |||
1501 | out_unregister_uart: | ||
1502 | if (NUM_SUNZILOG) { | ||
1503 | uart_unregister_driver(&sunzilog_reg); | ||
1504 | sunzilog_reg.cons = NULL; | ||
1505 | } | ||
1506 | |||
1507 | out_free_tables: | ||
1508 | sunzilog_free_tables(); | ||
1509 | goto out; | ||
1495 | } | 1510 | } |
1496 | 1511 | ||
1497 | static void __exit sunzilog_exit(void) | 1512 | static void __exit sunzilog_exit(void) |
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c index e93d0edc2e08..6c8b0ea83c3c 100644 --- a/drivers/serial/vr41xx_siu.c +++ b/drivers/serial/vr41xx_siu.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/tty_flip.h> | 38 | #include <linux/tty_flip.h> |
39 | 39 | ||
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | #include <asm/vr41xx/irq.h> | ||
41 | #include <asm/vr41xx/siu.h> | 42 | #include <asm/vr41xx/siu.h> |
42 | #include <asm/vr41xx/vr41xx.h> | 43 | #include <asm/vr41xx/vr41xx.h> |
43 | 44 | ||