.. | .. |
---|
61 | 61 | #define of_machine_is_compatible(x) (0) |
---|
62 | 62 | #endif |
---|
63 | 63 | |
---|
64 | | -#if defined (CONFIG_SERIAL_PMACZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) |
---|
65 | | -#define SUPPORT_SYSRQ |
---|
66 | | -#endif |
---|
67 | | - |
---|
68 | 64 | #include <linux/serial.h> |
---|
69 | 65 | #include <linux/serial_core.h> |
---|
70 | 66 | |
---|
.. | .. |
---|
217 | 213 | } |
---|
218 | 214 | |
---|
219 | 215 | static bool pmz_receive_chars(struct uart_pmac_port *uap) |
---|
| 216 | + __must_hold(&uap->port.lock) |
---|
220 | 217 | { |
---|
221 | 218 | struct tty_port *port; |
---|
222 | | - unsigned char ch, r1, drop, error, flag; |
---|
| 219 | + unsigned char ch, r1, drop, flag; |
---|
223 | 220 | int loops = 0; |
---|
224 | 221 | |
---|
225 | 222 | /* Sanity check, make sure the old bug is no longer happening */ |
---|
.. | .. |
---|
231 | 228 | port = &uap->port.state->port; |
---|
232 | 229 | |
---|
233 | 230 | while (1) { |
---|
234 | | - error = 0; |
---|
235 | 231 | drop = 0; |
---|
236 | 232 | |
---|
237 | 233 | r1 = read_zsreg(uap, R1); |
---|
.. | .. |
---|
273 | 269 | uap->port.icount.rx++; |
---|
274 | 270 | |
---|
275 | 271 | if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR | BRK_ABRT)) { |
---|
276 | | - error = 1; |
---|
277 | 272 | if (r1 & BRK_ABRT) { |
---|
278 | 273 | pmz_debug("pmz: got break !\n"); |
---|
279 | 274 | r1 &= ~(PAR_ERR | CRC_ERR); |
---|
.. | .. |
---|
1566 | 1561 | * to work around bugs in ancient Apple device-trees |
---|
1567 | 1562 | */ |
---|
1568 | 1563 | if (macio_request_resources(uap->dev, "pmac_zilog")) |
---|
1569 | | - printk(KERN_WARNING "%s: Failed to request resource" |
---|
| 1564 | + printk(KERN_WARNING "%pOFn: Failed to request resource" |
---|
1570 | 1565 | ", port still active\n", |
---|
1571 | | - uap->node->name); |
---|
| 1566 | + uap->node); |
---|
1572 | 1567 | else |
---|
1573 | 1568 | uap->flags |= PMACZILOG_FLAG_RSRC_REQUESTED; |
---|
1574 | 1569 | |
---|
.. | .. |
---|
1649 | 1644 | * TODO: Add routines with proper locking to do that... |
---|
1650 | 1645 | */ |
---|
1651 | 1646 | node_a = node_b = NULL; |
---|
1652 | | - for (np = NULL; (np = of_get_next_child(node_p, np)) != NULL;) { |
---|
1653 | | - if (strncmp(np->name, "ch-a", 4) == 0) |
---|
| 1647 | + for_each_child_of_node(node_p, np) { |
---|
| 1648 | + if (of_node_name_prefix(np, "ch-a")) |
---|
1654 | 1649 | node_a = of_node_get(np); |
---|
1655 | | - else if (strncmp(np->name, "ch-b", 4) == 0) |
---|
| 1650 | + else if (of_node_name_prefix(np, "ch-b")) |
---|
1656 | 1651 | node_b = of_node_get(np); |
---|
1657 | 1652 | } |
---|
1658 | 1653 | if (!node_a && !node_b) { |
---|
.. | .. |
---|
1698 | 1693 | |
---|
1699 | 1694 | #else |
---|
1700 | 1695 | |
---|
| 1696 | +/* On PCI PowerMacs, pmz_probe() does an explicit search of the OpenFirmware |
---|
| 1697 | + * tree to obtain the device_nodes needed to start the console before the |
---|
| 1698 | + * macio driver. On Macs without OpenFirmware, global platform_devices take |
---|
| 1699 | + * the place of those device_nodes. |
---|
| 1700 | + */ |
---|
1701 | 1701 | extern struct platform_device scc_a_pdev, scc_b_pdev; |
---|
1702 | 1702 | |
---|
1703 | 1703 | static int __init pmz_init_port(struct uart_pmac_port *uap) |
---|
1704 | 1704 | { |
---|
1705 | | - struct resource *r_ports; |
---|
1706 | | - int irq; |
---|
| 1705 | + struct resource *r_ports, *r_irq; |
---|
1707 | 1706 | |
---|
1708 | 1707 | r_ports = platform_get_resource(uap->pdev, IORESOURCE_MEM, 0); |
---|
1709 | | - irq = platform_get_irq(uap->pdev, 0); |
---|
1710 | | - if (!r_ports || irq <= 0) |
---|
| 1708 | + r_irq = platform_get_resource(uap->pdev, IORESOURCE_IRQ, 0); |
---|
| 1709 | + if (!r_ports || !r_irq) |
---|
1711 | 1710 | return -ENODEV; |
---|
1712 | 1711 | |
---|
1713 | 1712 | uap->port.mapbase = r_ports->start; |
---|
1714 | 1713 | uap->port.membase = (unsigned char __iomem *) r_ports->start; |
---|
1715 | 1714 | uap->port.iotype = UPIO_MEM; |
---|
1716 | | - uap->port.irq = irq; |
---|
| 1715 | + uap->port.irq = r_irq->start; |
---|
1717 | 1716 | uap->port.uartclk = ZS_CLOCK; |
---|
1718 | 1717 | uap->port.fifosize = 1; |
---|
1719 | 1718 | uap->port.ops = &pmz_pops; |
---|
.. | .. |
---|
1723 | 1722 | uap->control_reg = uap->port.membase; |
---|
1724 | 1723 | uap->data_reg = uap->control_reg + 4; |
---|
1725 | 1724 | uap->port_type = 0; |
---|
| 1725 | + uap->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PMACZILOG_CONSOLE); |
---|
1726 | 1726 | |
---|
1727 | 1727 | pmz_convert_to_zs(uap, CS8, 0, 9600); |
---|
1728 | 1728 | |
---|