Lines Matching +full:lpc +full:- +full:interrupts

1 // SPDX-License-Identifier: GPL-2.0
16 #include <asm/pci-bridge.h>
17 #include <asm/ppc-pci.h>
43 {.type = "tsi-bridge",},
46 {.compatible = "simple-bus",},
47 {.compatible = "wrs,epld-localbus",},
52 static int legacy_serial_console = -1;
61 offset = offset << p->regshift; in tsi_serial_in()
63 tmp = readl(p->membase + (UART_IIR & ~3)); in tsi_serial_in()
66 return readb(p->membase + offset); in tsi_serial_in()
71 offset = offset << p->regshift; in tsi_serial_out()
73 writeb(value, p->membase + offset); in tsi_serial_out()
89 clk = of_get_property(np, "clock-frequency", NULL); in add_legacy_port()
94 spd = of_get_property(np, "current-speed", NULL); in add_legacy_port()
97 rs = of_get_property(np, "reg-shift", NULL); in add_legacy_port()
112 return -1; in add_legacy_port()
120 if (legacy_info->np != NULL) { in add_legacy_port()
123 printk(KERN_DEBUG "Moved legacy port %d -> %d\n", in add_legacy_port()
136 legacy_port->iobase = base; in add_legacy_port()
138 legacy_port->mapbase = base; in add_legacy_port()
140 legacy_port->iotype = iotype; in add_legacy_port()
141 legacy_port->uartclk = clock; in add_legacy_port()
142 legacy_port->irq = irq; in add_legacy_port()
143 legacy_port->flags = flags; in add_legacy_port()
144 legacy_port->regshift = shift; in add_legacy_port()
145 legacy_info->taddr = taddr; in add_legacy_port()
146 legacy_info->np = of_node_get(np); in add_legacy_port()
147 legacy_info->clock = clock; in add_legacy_port()
148 legacy_info->speed = spd ? be32_to_cpup(spd) : 0; in add_legacy_port()
149 legacy_info->irq_check_parent = irq_check_parent; in add_legacy_port()
152 legacy_port->serial_in = tsi_serial_in; in add_legacy_port()
153 legacy_port->serial_out = tsi_serial_out; in add_legacy_port()
159 &base, &taddr, irq, legacy_port->uartclk, legacy_info->speed); in add_legacy_port()
172 * encoded in the device-tree. in add_legacy_soc_port()
174 if (!of_property_present(np, "clock-frequency")) in add_legacy_soc_port()
175 return -1; in add_legacy_soc_port()
177 /* if reg-offset don't try to use it */ in add_legacy_soc_port()
178 if (of_property_present(np, "reg-offset")) in add_legacy_soc_port()
179 return -1; in add_legacy_soc_port()
182 if (of_property_read_bool(np, "used-by-rtas")) in add_legacy_soc_port()
183 return -1; in add_legacy_soc_port()
188 return -1; in add_legacy_soc_port()
192 return -1; in add_legacy_soc_port()
197 if (of_node_is_type(tsi, "tsi-bridge")) in add_legacy_soc_port()
198 return add_legacy_port(np, -1, UPIO_TSI, addr, addr, in add_legacy_soc_port()
201 return add_legacy_port(np, -1, UPIO_MEM, addr, addr, in add_legacy_soc_port()
210 int index = -1; in add_legacy_isa_port()
213 DBG(" -> add_legacy_isa_port(%pOF)\n", np); in add_legacy_isa_port()
218 return -1; in add_legacy_isa_port()
222 return -1; in add_legacy_isa_port()
224 /* Now look for an "ibm,aix-loc" property that gives us ordering in add_legacy_isa_port()
227 typep = of_get_property(np, "ibm,aix-loc", NULL); in add_legacy_isa_port()
231 index = simple_strtol(typep+1, NULL, 0) - 1; in add_legacy_isa_port()
237 * Note: Don't even try on P8 lpc, we know it's not directly mapped in add_legacy_isa_port()
239 if (!of_device_is_compatible(isa_brg, "ibm,power8-lpc") || in add_legacy_isa_port()
260 int iotype, index = -1, lindex = 0; in add_legacy_pci_port()
262 DBG(" -> add_legacy_pci_port(%pOF)\n", np); in add_legacy_pci_port()
265 * encoded in the device-tree (that is have an fcode). Anything in add_legacy_pci_port()
271 if (!of_property_present(np, "clock-frequency")) in add_legacy_pci_port()
272 return -1; in add_legacy_pci_port()
277 return -1; in add_legacy_pci_port()
283 return -1; in add_legacy_pci_port()
332 stride = 1 << port->regshift; in setup_legacy_serial_console()
335 if (info->taddr) { in setup_legacy_serial_console()
336 info->early_addr = early_ioremap(info->taddr, 0x1000); in setup_legacy_serial_console()
337 if (info->early_addr == NULL) in setup_legacy_serial_console()
339 udbg_uart_init_mmio(info->early_addr, stride); in setup_legacy_serial_console()
342 if (port->iotype == UPIO_PORT && isa_io_special) in setup_legacy_serial_console()
343 udbg_uart_init_pio(port->iobase, stride); in setup_legacy_serial_console()
349 if (info->speed == 0) in setup_legacy_serial_console()
350 info->speed = udbg_probe_uart_speed(info->clock); in setup_legacy_serial_console()
353 DBG("default console speed = %d\n", info->speed); in setup_legacy_serial_console()
354 udbg_uart_setup(info->speed, info->clock); in setup_legacy_serial_console()
369 if (!info->early_addr) in ioremap_legacy_serial_console()
372 vaddr = ioremap(info->taddr, 0x1000); in ioremap_legacy_serial_console()
374 return -ENOMEM; in ioremap_legacy_serial_console()
376 udbg_uart_init_mmio(vaddr, 1 << port->regshift); in ioremap_legacy_serial_console()
377 early_iounmap(info->early_addr, 0x1000); in ioremap_legacy_serial_console()
378 info->early_addr = NULL; in ioremap_legacy_serial_console()
387 * will try to build a list of all the available 8250-compatible serial ports
388 * in the machine using the Open Firmware device-tree. It currently only deals
391 * the machine non-PCI ports and to properly pick the default console port
399 DBG(" -> find_legacy_serial_port()\n"); in find_legacy_serial_ports()
402 path = of_get_property(of_chosen, "linux,stdout-path", NULL); in find_legacy_serial_ports()
404 path = of_get_property(of_chosen, "stdout-path", NULL); in find_legacy_serial_ports()
410 DBG(" no linux,stdout-path !\n"); in find_legacy_serial_ports()
431 if (of_node_name_eq(isa, "isa") || of_node_name_eq(isa, "lpc")) { in find_legacy_serial_ports()
479 DBG(" <- find_legacy_serial_port()\n"); in find_legacy_serial_ports()
509 port->irq = virq; in fixup_port_irq()
514 port->handle_irq = fsl8250_handle_irq; in fixup_port_irq()
515 port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); in fixup_port_irq()
534 unsigned long offset = (unsigned long)hose->io_base_virt - in fixup_port_pio()
540 DBG("port %d, IO %lx -> %lx\n", in fixup_port_pio()
541 index, port->iobase, port->iobase + offset); in fixup_port_pio()
542 port->iobase += offset; in fixup_port_pio()
553 port->membase = ioremap(port->mapbase, 0x100); in fixup_port_mmio()
574 return -ENODEV; in serial_dev_init()
578 * to fixup their interrupts and their IO ports. in serial_dev_init()
580 DBG("Fixing serial ports interrupts and IO ports ...\n"); in serial_dev_init()
586 if (!port->irq) in serial_dev_init()
588 if (port->iotype == UPIO_PORT) in serial_dev_init()
590 if ((port->iotype == UPIO_MEM) || (port->iotype == UPIO_TSI)) in serial_dev_init()
616 DBG(" -> check_legacy_serial_console()\n"); in check_legacy_serial_console()
621 return -EBUSY; in check_legacy_serial_console()
626 return -ENODEV; in check_legacy_serial_console()
631 return -ENODEV; in check_legacy_serial_console()
635 name = of_get_property(of_chosen, "linux,stdout-path", NULL); in check_legacy_serial_console()
637 name = of_get_property(of_chosen, "stdout-path", NULL); in check_legacy_serial_console()
639 DBG(" no stdout-path !\n"); in check_legacy_serial_console()
640 return -ENODEV; in check_legacy_serial_console()
645 return -ENODEV; in check_legacy_serial_console()
654 spd = of_get_property(prom_stdout, "current-speed", NULL); in check_legacy_serial_console()
686 return -ENODEV; in check_legacy_serial_console()