aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-07-14 23:03:12 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-08-14 00:58:15 -0400
commit309257484cc1a592e8ac5fbdd8cd661be2b80bf8 (patch)
treedf500d08cef6def1e1a2f6ef51e6e91c563c2c08
parent3fafe9c202321a3edc47386d2071af89555c9f45 (diff)
powerpc: Cleanup udbg_16550 and add support for LPC PIO-only UARTs
The udbg_16550 code, which we use for our early consoles and debug backends was fairly messy. Especially for the debug consoles, it would re-implement the "high level" getc/putc/poll functions for each access method. It also had code to configure the UART but only for the straight MMIO method. This changes it to instead abstract at the register accessor level, and have the various functions and configuration routines use these. The result is simpler and slightly smaller code, and free support for non-MMIO mapped PIO UARTs, which such as the ones that can be present on a POWER 8 LPC bus. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/udbg.h9
-rw-r--r--arch/powerpc/kernel/legacy_serial.c46
-rw-r--r--arch/powerpc/kernel/udbg_16550.c344
3 files changed, 206 insertions, 193 deletions
diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/udbg.h
index dc590919f8eb..b51fba10e733 100644
--- a/arch/powerpc/include/asm/udbg.h
+++ b/arch/powerpc/include/asm/udbg.h
@@ -27,10 +27,11 @@ extern void udbg_printf(const char *fmt, ...)
27 __attribute__ ((format (printf, 1, 2))); 27 __attribute__ ((format (printf, 1, 2)));
28extern void udbg_progress(char *s, unsigned short hex); 28extern void udbg_progress(char *s, unsigned short hex);
29 29
30extern void udbg_init_uart(void __iomem *comport, unsigned int speed, 30extern void udbg_uart_init_mmio(void __iomem *addr, unsigned int stride);
31 unsigned int clock); 31extern void udbg_uart_init_pio(unsigned long port, unsigned int stride);
32extern unsigned int udbg_probe_uart_speed(void __iomem *comport, 32
33 unsigned int clock); 33extern void udbg_uart_setup(unsigned int speed, unsigned int clock);
34extern unsigned int udbg_probe_uart_speed(unsigned int clock);
34 35
35struct device_node; 36struct device_node;
36extern void udbg_scc_init(int force_scc); 37extern void udbg_scc_init(int force_scc);
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index af1c63fc7dac..9a4d9fe9ff1c 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -221,14 +221,19 @@ static int __init add_legacy_isa_port(struct device_node *np,
221 /* Translate ISA address. If it fails, we still register the port 221 /* Translate ISA address. If it fails, we still register the port
222 * with no translated address so that it can be picked up as an IO 222 * with no translated address so that it can be picked up as an IO
223 * port later by the serial driver 223 * port later by the serial driver
224 *
225 * Note: Don't even try on P8 lpc, we know it's not directly mapped
224 */ 226 */
225 taddr = of_translate_address(np, reg); 227 if (!of_device_is_compatible(isa_brg, "ibm,power8-lpc")) {
226 if (taddr == OF_BAD_ADDR) 228 taddr = of_translate_address(np, reg);
229 if (taddr == OF_BAD_ADDR)
230 taddr = 0;
231 } else
227 taddr = 0; 232 taddr = 0;
228 233
229 /* Add port, irq will be dealt with later */ 234 /* Add port, irq will be dealt with later */
230 return add_legacy_port(np, index, UPIO_PORT, be32_to_cpu(reg[1]), taddr, 235 return add_legacy_port(np, index, UPIO_PORT, be32_to_cpu(reg[1]),
231 NO_IRQ, UPF_BOOT_AUTOCONF, 0); 236 taddr, NO_IRQ, UPF_BOOT_AUTOCONF, 0);
232 237
233} 238}
234 239
@@ -307,19 +312,31 @@ static int __init add_legacy_pci_port(struct device_node *np,
307 312
308static void __init setup_legacy_serial_console(int console) 313static void __init setup_legacy_serial_console(int console)
309{ 314{
310 struct legacy_serial_info *info = 315 struct legacy_serial_info *info = &legacy_serial_infos[console];
311 &legacy_serial_infos[console]; 316 struct plat_serial8250_port *port = &legacy_serial_ports[console];
312 void __iomem *addr; 317 void __iomem *addr;
313 318
314 if (info->taddr == 0) 319 /* Check if a translated MMIO address has been found */
315 return; 320 if (info->taddr) {
316 addr = ioremap(info->taddr, 0x1000); 321 addr = ioremap(info->taddr, 0x1000);
317 if (addr == NULL) 322 if (addr == NULL)
318 return; 323 return;
324 udbg_uart_init_mmio(addr, 1);
325 } else {
326 /* Check if it's PIO and we support untranslated PIO */
327 if (port->iotype == UPIO_PORT && isa_io_special)
328 udbg_uart_init_pio(port->iobase, 1);
329 else
330 return;
331 }
332
333 /* Try to query the current speed */
319 if (info->speed == 0) 334 if (info->speed == 0)
320 info->speed = udbg_probe_uart_speed(addr, info->clock); 335 info->speed = udbg_probe_uart_speed(info->clock);
336
337 /* Set it up */
321 DBG("default console speed = %d\n", info->speed); 338 DBG("default console speed = %d\n", info->speed);
322 udbg_init_uart(addr, info->speed, info->clock); 339 udbg_uart_setup(info->speed, info->clock);
323} 340}
324 341
325/* 342/*
@@ -367,7 +384,8 @@ void __init find_legacy_serial_ports(void)
367 /* Next, fill our array with ISA ports */ 384 /* Next, fill our array with ISA ports */
368 for_each_node_by_type(np, "serial") { 385 for_each_node_by_type(np, "serial") {
369 struct device_node *isa = of_get_parent(np); 386 struct device_node *isa = of_get_parent(np);
370 if (isa && !strcmp(isa->name, "isa")) { 387 if (isa && (!strcmp(isa->name, "isa") ||
388 !strcmp(isa->name, "lpc"))) {
371 index = add_legacy_isa_port(np, isa); 389 index = add_legacy_isa_port(np, isa);
372 if (index >= 0 && np == stdout) 390 if (index >= 0 && np == stdout)
373 legacy_serial_console = index; 391 legacy_serial_console = index;
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index 6837f839ab78..25c58e81a009 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -18,23 +18,19 @@ extern void real_writeb(u8 data, volatile u8 __iomem *addr);
18extern u8 real_205_readb(volatile u8 __iomem *addr); 18extern u8 real_205_readb(volatile u8 __iomem *addr);
19extern void real_205_writeb(u8 data, volatile u8 __iomem *addr); 19extern void real_205_writeb(u8 data, volatile u8 __iomem *addr);
20 20
21struct NS16550 { 21#define UART_RBR 0
22 /* this struct must be packed */ 22#define UART_IER 1
23 unsigned char rbr; /* 0 */ 23#define UART_FCR 2
24 unsigned char ier; /* 1 */ 24#define UART_LCR 3
25 unsigned char fcr; /* 2 */ 25#define UART_MCR 4
26 unsigned char lcr; /* 3 */ 26#define UART_LSR 5
27 unsigned char mcr; /* 4 */ 27#define UART_MSR 6
28 unsigned char lsr; /* 5 */ 28#define UART_SCR 7
29 unsigned char msr; /* 6 */ 29#define UART_THR UART_RBR
30 unsigned char scr; /* 7 */ 30#define UART_IIR UART_FCR
31}; 31#define UART_DLL UART_RBR
32 32#define UART_DLM UART_IER
33#define thr rbr 33#define UART_DLAB UART_LCR
34#define iir fcr
35#define dll rbr
36#define dlm ier
37#define dlab lcr
38 34
39#define LSR_DR 0x01 /* Data ready */ 35#define LSR_DR 0x01 /* Data ready */
40#define LSR_OE 0x02 /* Overrun */ 36#define LSR_OE 0x02 /* Overrun */
@@ -47,52 +43,62 @@ struct NS16550 {
47 43
48#define LCR_DLAB 0x80 44#define LCR_DLAB 0x80
49 45
50static struct NS16550 __iomem *udbg_comport; 46static u8 (*udbg_uart_in)(unsigned int reg);
47static void (*udbg_uart_out)(unsigned int reg, u8 data);
51 48
52static void udbg_550_flush(void) 49static void udbg_uart_flush(void)
53{ 50{
54 if (udbg_comport) { 51 if (!udbg_uart_in)
55 while ((in_8(&udbg_comport->lsr) & LSR_THRE) == 0) 52 return;
56 /* wait for idle */; 53
57 } 54 /* wait for idle */
55 while ((udbg_uart_in(UART_LSR) & LSR_THRE) == 0)
56 cpu_relax();
58} 57}
59 58
60static void udbg_550_putc(char c) 59static void udbg_uart_putc(char c)
61{ 60{
62 if (udbg_comport) { 61 if (!udbg_uart_out)
63 if (c == '\n') 62 return;
64 udbg_550_putc('\r'); 63
65 udbg_550_flush(); 64 if (c == '\n')
66 out_8(&udbg_comport->thr, c); 65 udbg_uart_putc('\r');
67 } 66 udbg_uart_flush();
67 udbg_uart_out(UART_THR, c);
68} 68}
69 69
70static int udbg_550_getc_poll(void) 70static int udbg_uart_getc_poll(void)
71{ 71{
72 if (udbg_comport) { 72 if (!udbg_uart_in || !(udbg_uart_in(UART_LSR) & LSR_DR))
73 if ((in_8(&udbg_comport->lsr) & LSR_DR) != 0) 73 return udbg_uart_in(UART_RBR);
74 return in_8(&udbg_comport->rbr);
75 else
76 return -1;
77 }
78 return -1; 74 return -1;
79} 75}
80 76
81static int udbg_550_getc(void) 77static int udbg_uart_getc(void)
82{ 78{
83 if (udbg_comport) { 79 if (!udbg_uart_in)
84 while ((in_8(&udbg_comport->lsr) & LSR_DR) == 0) 80 return -1;
85 /* wait for char */; 81 /* wait for char */
86 return in_8(&udbg_comport->rbr); 82 while (!(udbg_uart_in(UART_LSR) & LSR_DR))
87 } 83 cpu_relax();
88 return -1; 84 return udbg_uart_in(UART_RBR);
85}
86
87static void udbg_use_uart(void)
88{
89 udbg_putc = udbg_uart_putc;
90 udbg_flush = udbg_uart_flush;
91 udbg_getc = udbg_uart_getc;
92 udbg_getc_poll = udbg_uart_getc_poll;
89} 93}
90 94
91void udbg_init_uart(void __iomem *comport, unsigned int speed, 95void udbg_uart_setup(unsigned int speed, unsigned int clock)
92 unsigned int clock)
93{ 96{
94 unsigned int dll, base_bauds; 97 unsigned int dll, base_bauds;
95 98
99 if (!udbg_uart_out)
100 return;
101
96 if (clock == 0) 102 if (clock == 0)
97 clock = 1843200; 103 clock = 1843200;
98 if (speed == 0) 104 if (speed == 0)
@@ -101,51 +107,43 @@ void udbg_init_uart(void __iomem *comport, unsigned int speed,
101 base_bauds = clock / 16; 107 base_bauds = clock / 16;
102 dll = base_bauds / speed; 108 dll = base_bauds / speed;
103 109
104 if (comport) { 110 udbg_uart_out(UART_LCR, 0x00);
105 udbg_comport = (struct NS16550 __iomem *)comport; 111 udbg_uart_out(UART_IER, 0xff);
106 out_8(&udbg_comport->lcr, 0x00); 112 udbg_uart_out(UART_IER, 0x00);
107 out_8(&udbg_comport->ier, 0xff); 113 udbg_uart_out(UART_LCR, LCR_DLAB);
108 out_8(&udbg_comport->ier, 0x00); 114 udbg_uart_out(UART_DLL, dll & 0xff);
109 out_8(&udbg_comport->lcr, LCR_DLAB); 115 udbg_uart_out(UART_DLM, dll >> 8);
110 out_8(&udbg_comport->dll, dll & 0xff); 116 /* 8 data, 1 stop, no parity */
111 out_8(&udbg_comport->dlm, dll >> 8); 117 udbg_uart_out(UART_LCR, 0x3);
112 /* 8 data, 1 stop, no parity */ 118 /* RTS/DTR */
113 out_8(&udbg_comport->lcr, 0x03); 119 udbg_uart_out(UART_MCR, 0x3);
114 /* RTS/DTR */ 120 /* Clear & enable FIFOs */
115 out_8(&udbg_comport->mcr, 0x03); 121 udbg_uart_out(UART_FCR, 0x7);
116 /* Clear & enable FIFOs */
117 out_8(&udbg_comport->fcr ,0x07);
118 udbg_putc = udbg_550_putc;
119 udbg_flush = udbg_550_flush;
120 udbg_getc = udbg_550_getc;
121 udbg_getc_poll = udbg_550_getc_poll;
122 }
123} 122}
124 123
125unsigned int udbg_probe_uart_speed(void __iomem *comport, unsigned int clock) 124unsigned int udbg_probe_uart_speed(unsigned int clock)
126{ 125{
127 unsigned int dll, dlm, divisor, prescaler, speed; 126 unsigned int dll, dlm, divisor, prescaler, speed;
128 u8 old_lcr; 127 u8 old_lcr;
129 struct NS16550 __iomem *port = comport;
130 128
131 old_lcr = in_8(&port->lcr); 129 old_lcr = udbg_uart_in(UART_LCR);
132 130
133 /* select divisor latch registers. */ 131 /* select divisor latch registers. */
134 out_8(&port->lcr, LCR_DLAB); 132 udbg_uart_out(UART_LCR, old_lcr | LCR_DLAB);
135 133
136 /* now, read the divisor */ 134 /* now, read the divisor */
137 dll = in_8(&port->dll); 135 dll = udbg_uart_in(UART_DLL);
138 dlm = in_8(&port->dlm); 136 dlm = udbg_uart_in(UART_DLM);
139 divisor = dlm << 8 | dll; 137 divisor = dlm << 8 | dll;
140 138
141 /* check prescaling */ 139 /* check prescaling */
142 if (in_8(&port->mcr) & 0x80) 140 if (udbg_uart_in(UART_MCR) & 0x80)
143 prescaler = 4; 141 prescaler = 4;
144 else 142 else
145 prescaler = 1; 143 prescaler = 1;
146 144
147 /* restore the LCR */ 145 /* restore the LCR */
148 out_8(&port->lcr, old_lcr); 146 udbg_uart_out(UART_LCR, old_lcr);
149 147
150 /* calculate speed */ 148 /* calculate speed */
151 speed = (clock / prescaler) / (divisor * 16); 149 speed = (clock / prescaler) / (divisor * 16);
@@ -157,150 +155,151 @@ unsigned int udbg_probe_uart_speed(void __iomem *comport, unsigned int clock)
157 return speed; 155 return speed;
158} 156}
159 157
160#ifdef CONFIG_PPC_MAPLE 158static union {
161void udbg_maple_real_flush(void) 159 unsigned char __iomem *mmio_base;
160 unsigned long pio_base;
161} udbg_uart;
162
163static unsigned int udbg_uart_stride = 1;
164
165static u8 udbg_uart_in_pio(unsigned int reg)
162{ 166{
163 if (udbg_comport) { 167 return inb(udbg_uart.pio_base + (reg * udbg_uart_stride));
164 while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
165 /* wait for idle */;
166 }
167} 168}
168 169
169void udbg_maple_real_putc(char c) 170static void udbg_uart_out_pio(unsigned int reg, u8 data)
170{ 171{
171 if (udbg_comport) { 172 outb(data, udbg_uart.pio_base + (reg * udbg_uart_stride));
172 if (c == '\n')
173 udbg_maple_real_putc('\r');
174 udbg_maple_real_flush();
175 real_writeb(c, &udbg_comport->thr); eieio();
176 }
177} 173}
178 174
179void __init udbg_init_maple_realmode(void) 175void udbg_uart_init_pio(unsigned long port, unsigned int stride)
180{ 176{
181 udbg_comport = (struct NS16550 __iomem *)0xf40003f8; 177 if (!port)
178 return;
179 udbg_uart.pio_base = port;
180 udbg_uart_stride = stride;
181 udbg_uart_in = udbg_uart_in_pio;
182 udbg_uart_out = udbg_uart_out_pio;
183 udbg_use_uart();
184}
182 185
183 udbg_putc = udbg_maple_real_putc; 186static u8 udbg_uart_in_mmio(unsigned int reg)
184 udbg_flush = udbg_maple_real_flush; 187{
185 udbg_getc = NULL; 188 return in_8(udbg_uart.mmio_base + (reg * udbg_uart_stride));
186 udbg_getc_poll = NULL;
187} 189}
188#endif /* CONFIG_PPC_MAPLE */
189 190
190#ifdef CONFIG_PPC_PASEMI 191static void udbg_uart_out_mmio(unsigned int reg, u8 data)
191void udbg_pas_real_flush(void)
192{ 192{
193 if (udbg_comport) { 193 out_8(udbg_uart.mmio_base + (reg * udbg_uart_stride), data);
194 while ((real_205_readb(&udbg_comport->lsr) & LSR_THRE) == 0) 194}
195 /* wait for idle */; 195
196 } 196
197void udbg_uart_init_mmio(void __iomem *addr, unsigned int stride)
198{
199 if (!addr)
200 return;
201 udbg_uart.mmio_base = addr;
202 udbg_uart_stride = stride;
203 udbg_uart_in = udbg_uart_in_mmio;
204 udbg_uart_out = udbg_uart_out_mmio;
205 udbg_use_uart();
197} 206}
198 207
199void udbg_pas_real_putc(char c) 208#ifdef CONFIG_PPC_MAPLE
209
210#define UDBG_UART_MAPLE_ADDR ((void __iomem *)0xf40003f8)
211
212static u8 udbg_uart_in_maple(unsigned int reg)
200{ 213{
201 if (udbg_comport) { 214 return real_readb(UDBG_UART_MAPLE_ADDR + reg);
202 if (c == '\n')
203 udbg_pas_real_putc('\r');
204 udbg_pas_real_flush();
205 real_205_writeb(c, &udbg_comport->thr); eieio();
206 }
207} 215}
208 216
209void udbg_init_pas_realmode(void) 217static void udbg_uart_out_maple(unsigned int reg, u8 val)
210{ 218{
211 udbg_comport = (struct NS16550 __iomem *)0xfcff03f8UL; 219 real_writeb(val, UDBG_UART_MAPLE_ADDR + reg);
220}
212 221
213 udbg_putc = udbg_pas_real_putc; 222void __init udbg_init_maple_realmode(void)
214 udbg_flush = udbg_pas_real_flush; 223{
215 udbg_getc = NULL; 224 udbg_uart_in = udbg_uart_in_maple;
216 udbg_getc_poll = NULL; 225 udbg_uart_out = udbg_uart_out_maple;
226 udbg_use_uart();
217} 227}
228
218#endif /* CONFIG_PPC_MAPLE */ 229#endif /* CONFIG_PPC_MAPLE */
219 230
220#ifdef CONFIG_PPC_EARLY_DEBUG_44x 231#ifdef CONFIG_PPC_PASEMI
221#include <platforms/44x/44x.h> 232
233#define UDBG_UART_PAS_ADDR ((void __iomem *)0xfcff03f8UL)
222 234
223static void udbg_44x_as1_flush(void) 235static u8 udbg_uart_in_pas(unsigned int reg)
224{ 236{
225 if (udbg_comport) { 237 return real_205_readb(UDBG_UART_PAS_ADDR + reg);
226 while ((as1_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
227 /* wait for idle */;
228 }
229} 238}
230 239
231static void udbg_44x_as1_putc(char c) 240static void udbg_uart_out_pas(unsigned int reg, u8 val)
232{ 241{
233 if (udbg_comport) { 242 real_205_writeb(val, UDBG_UART_PAS_ADDR + reg);
234 if (c == '\n')
235 udbg_44x_as1_putc('\r');
236 udbg_44x_as1_flush();
237 as1_writeb(c, &udbg_comport->thr); eieio();
238 }
239} 243}
240 244
241static int udbg_44x_as1_getc(void) 245void __init udbg_init_pas_realmode(void)
242{ 246{
243 if (udbg_comport) { 247 udbg_uart_in = udbg_uart_in_pas;
244 while ((as1_readb(&udbg_comport->lsr) & LSR_DR) == 0) 248 udbg_uart_out = udbg_uart_out_pas;
245 ; /* wait for char */ 249 udbg_use_uart();
246 return as1_readb(&udbg_comport->rbr);
247 }
248 return -1;
249} 250}
250 251
251void __init udbg_init_44x_as1(void) 252#endif /* CONFIG_PPC_PASEMI */
253
254#ifdef CONFIG_PPC_EARLY_DEBUG_44x
255
256#include <platforms/44x/44x.h>
257
258static u8 udbg_uart_in_44x_as1(unsigned int reg)
252{ 259{
253 udbg_comport = 260 return as1_readb((void __iomem *)PPC44x_EARLY_DEBUG_VIRTADDR + reg);
254 (struct NS16550 __iomem *)PPC44x_EARLY_DEBUG_VIRTADDR; 261}
255 262
256 udbg_putc = udbg_44x_as1_putc; 263static void udbg_uart_out_44x_as1(unsigned int reg, u8 val)
257 udbg_flush = udbg_44x_as1_flush; 264{
258 udbg_getc = udbg_44x_as1_getc; 265 as1_writeb(val, (void __iomem *)PPC44x_EARLY_DEBUG_VIRTADDR + reg);
259} 266}
260#endif /* CONFIG_PPC_EARLY_DEBUG_44x */
261 267
262#ifdef CONFIG_PPC_EARLY_DEBUG_40x 268void __init udbg_init_44x_as1(void)
263static void udbg_40x_real_flush(void)
264{ 269{
265 if (udbg_comport) { 270 udbg_uart_in = udbg_uart_in_44x_as1;
266 while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0) 271 udbg_uart_out = udbg_uart_out_44x_as1;
267 /* wait for idle */; 272 udbg_use_uart();
268 }
269} 273}
270 274
271static void udbg_40x_real_putc(char c) 275#endif /* CONFIG_PPC_EARLY_DEBUG_44x */
276
277#ifdef CONFIG_PPC_EARLY_DEBUG_40x
278
279static u8 udbg_uart_in_40x(unsigned int reg)
272{ 280{
273 if (udbg_comport) { 281 return real_readb((void __iomem *)CONFIG_PPC_EARLY_DEBUG_40x_PHYSADDR
274 if (c == '\n') 282 + reg);
275 udbg_40x_real_putc('\r');
276 udbg_40x_real_flush();
277 real_writeb(c, &udbg_comport->thr); eieio();
278 }
279} 283}
280 284
281static int udbg_40x_real_getc(void) 285static void udbg_uart_out_40x(unsigned int reg, u8 val)
282{ 286{
283 if (udbg_comport) { 287 real_writeb(val, (void __iomem *)CONFIG_PPC_EARLY_DEBUG_40x_PHYSADDR
284 while ((real_readb(&udbg_comport->lsr) & LSR_DR) == 0) 288 + reg);
285 ; /* wait for char */
286 return real_readb(&udbg_comport->rbr);
287 }
288 return -1;
289} 289}
290 290
291void __init udbg_init_40x_realmode(void) 291void __init udbg_init_40x_realmode(void)
292{ 292{
293 udbg_comport = (struct NS16550 __iomem *) 293 udbg_uart_in = udbg_uart_in_40x;
294 CONFIG_PPC_EARLY_DEBUG_40x_PHYSADDR; 294 udbg_uart_out = udbg_uart_out_40x;
295 295 udbg_use_uart();
296 udbg_putc = udbg_40x_real_putc;
297 udbg_flush = udbg_40x_real_flush;
298 udbg_getc = udbg_40x_real_getc;
299 udbg_getc_poll = NULL;
300} 296}
297
301#endif /* CONFIG_PPC_EARLY_DEBUG_40x */ 298#endif /* CONFIG_PPC_EARLY_DEBUG_40x */
302 299
300
303#ifdef CONFIG_PPC_EARLY_DEBUG_WSP 301#ifdef CONFIG_PPC_EARLY_DEBUG_WSP
302
304static void udbg_wsp_flush(void) 303static void udbg_wsp_flush(void)
305{ 304{
306 if (udbg_comport) { 305 if (udbg_comport) {
@@ -339,13 +338,8 @@ static int udbg_wsp_getc_poll(void)
339 338
340void __init udbg_init_wsp(void) 339void __init udbg_init_wsp(void)
341{ 340{
342 udbg_comport = (struct NS16550 __iomem *)WSP_UART_VIRT; 341 udbg_uart_init_mmio(WSP_UART_VIRT, 1);
343 342 udbg_uart_setup(57600, 50000000);
344 udbg_init_uart(udbg_comport, 57600, 50000000);
345
346 udbg_putc = udbg_wsp_putc;
347 udbg_flush = udbg_wsp_flush;
348 udbg_getc = udbg_wsp_getc;
349 udbg_getc_poll = udbg_wsp_getc_poll;
350} 343}
344
351#endif /* CONFIG_PPC_EARLY_DEBUG_WSP */ 345#endif /* CONFIG_PPC_EARLY_DEBUG_WSP */