aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Chivers <schivers@csc.com>2014-04-19 19:43:10 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-04-28 03:36:25 -0400
commit13ae40370f62cd73f90aca34feb44bac83f41075 (patch)
tree207e035d047b2101dde5c0a9ea7ecfbcc44de6dc
parent147c05168fc86e824ccd1c0a02b40843e3cbca88 (diff)
powerpc/legacy_serial: Support MVME5100 UARTS with shifted registers
This patch adds support to legacy serial for UARTS with shifted registers. The MVME5100 Single Board Computer is a PowerPC platform that has 16550 style UARTS with register addresses that are 16 bytes apart (shifted by 4). Commit 309257484cc1a592e8ac5fbdd8cd661be2b80bf8 "powerpc: Cleanup udbg_16550 and add support for LPC PIO-only UARTs" added support to udbg_16550 for shifted registers by adding a "stride" parameter to the initialisation operations for Programmed IO and Memory Mapped IO. As a consequence it is now possible to use the services of legacy serial to provide early serial console messages for the MVME5100. An added benefit of this is that the serial console will always be "ttyS0" irrespective of whether the computer is fitted with extra PCI 8250 interface boards or not. I have tested this patch using the four PowerPC platforms available to me: MVME5100 - shifted registers, SAM440EP - unshifted registers, MPC8349 - unshifted registers, MVME4100 - unshifted registers. Signed-off-by: Stephen Chivers <schivers@csc.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/kernel/legacy_serial.c21
-rw-r--r--arch/powerpc/platforms/embedded6xx/Kconfig1
2 files changed, 16 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 40bd7bd4e19a..85fb16e64cef 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -71,8 +71,9 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
71 phys_addr_t taddr, unsigned long irq, 71 phys_addr_t taddr, unsigned long irq,
72 upf_t flags, int irq_check_parent) 72 upf_t flags, int irq_check_parent)
73{ 73{
74 const __be32 *clk, *spd; 74 const __be32 *clk, *spd, *rs;
75 u32 clock = BASE_BAUD * 16; 75 u32 clock = BASE_BAUD * 16;
76 u32 shift = 0;
76 int index; 77 int index;
77 78
78 /* get clock freq. if present */ 79 /* get clock freq. if present */
@@ -83,6 +84,11 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
83 /* get default speed if present */ 84 /* get default speed if present */
84 spd = of_get_property(np, "current-speed", NULL); 85 spd = of_get_property(np, "current-speed", NULL);
85 86
87 /* get register shift if present */
88 rs = of_get_property(np, "reg-shift", NULL);
89 if (rs && *rs)
90 shift = be32_to_cpup(rs);
91
86 /* If we have a location index, then try to use it */ 92 /* If we have a location index, then try to use it */
87 if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS) 93 if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS)
88 index = want_index; 94 index = want_index;
@@ -126,6 +132,7 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
126 legacy_serial_ports[index].uartclk = clock; 132 legacy_serial_ports[index].uartclk = clock;
127 legacy_serial_ports[index].irq = irq; 133 legacy_serial_ports[index].irq = irq;
128 legacy_serial_ports[index].flags = flags; 134 legacy_serial_ports[index].flags = flags;
135 legacy_serial_ports[index].regshift = shift;
129 legacy_serial_infos[index].taddr = taddr; 136 legacy_serial_infos[index].taddr = taddr;
130 legacy_serial_infos[index].np = of_node_get(np); 137 legacy_serial_infos[index].np = of_node_get(np);
131 legacy_serial_infos[index].clock = clock; 138 legacy_serial_infos[index].clock = clock;
@@ -163,9 +170,8 @@ static int __init add_legacy_soc_port(struct device_node *np,
163 if (of_get_property(np, "clock-frequency", NULL) == NULL) 170 if (of_get_property(np, "clock-frequency", NULL) == NULL)
164 return -1; 171 return -1;
165 172
166 /* if reg-shift or offset, don't try to use it */ 173 /* if reg-offset don't try to use it */
167 if ((of_get_property(np, "reg-shift", NULL) != NULL) || 174 if ((of_get_property(np, "reg-offset", NULL) != NULL))
168 (of_get_property(np, "reg-offset", NULL) != NULL))
169 return -1; 175 return -1;
170 176
171 /* if rtas uses this device, don't try to use it as well */ 177 /* if rtas uses this device, don't try to use it as well */
@@ -315,17 +321,20 @@ static void __init setup_legacy_serial_console(int console)
315 struct legacy_serial_info *info = &legacy_serial_infos[console]; 321 struct legacy_serial_info *info = &legacy_serial_infos[console];
316 struct plat_serial8250_port *port = &legacy_serial_ports[console]; 322 struct plat_serial8250_port *port = &legacy_serial_ports[console];
317 void __iomem *addr; 323 void __iomem *addr;
324 unsigned int stride;
325
326 stride = 1 << port->regshift;
318 327
319 /* Check if a translated MMIO address has been found */ 328 /* Check if a translated MMIO address has been found */
320 if (info->taddr) { 329 if (info->taddr) {
321 addr = ioremap(info->taddr, 0x1000); 330 addr = ioremap(info->taddr, 0x1000);
322 if (addr == NULL) 331 if (addr == NULL)
323 return; 332 return;
324 udbg_uart_init_mmio(addr, 1); 333 udbg_uart_init_mmio(addr, stride);
325 } else { 334 } else {
326 /* Check if it's PIO and we support untranslated PIO */ 335 /* Check if it's PIO and we support untranslated PIO */
327 if (port->iotype == UPIO_PORT && isa_io_special) 336 if (port->iotype == UPIO_PORT && isa_io_special)
328 udbg_uart_init_pio(port->iobase, 1); 337 udbg_uart_init_pio(port->iobase, stride);
329 else 338 else
330 return; 339 return;
331 } 340 }
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 2a7024d8d8b1..a25f496c2ef9 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -65,6 +65,7 @@ config MVME5100
65 select PPC_INDIRECT_PCI 65 select PPC_INDIRECT_PCI
66 select PPC_I8259 66 select PPC_I8259
67 select PPC_NATIVE 67 select PPC_NATIVE
68 select PPC_UDBG_16550
68 help 69 help
69 This option enables support for the Motorola (now Emerson) MVME5100 70 This option enables support for the Motorola (now Emerson) MVME5100
70 board. 71 board.