aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-02-14 00:28:40 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-03-20 04:12:46 -0500
commitd5a2aa241aa0babf382d42d6033b30a5112e4c1e (patch)
tree64b0ffb5b321827be583de8167f5f80f0befdb33 /drivers/serial
parent5259d5bfaf5b2953b130e9a500277a905bd37823 (diff)
[SPARC64] sunhv: Bug fixes.
Add udelay to polling console write loop, and increment the loop limit. Name the device "ttyHV" and pass that to add_preferred_console() when we're using hypervisor console. Kill sunhv_console_setup(), it's empty. Handle the case where we don't want to use hypervisor console. (ie. we have a head attached to a sun4v machine) Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/sunhv.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c
index d3a9dd739da3..71c70d7a998c 100644
--- a/drivers/serial/sunhv.c
+++ b/drivers/serial/sunhv.c
@@ -360,7 +360,7 @@ static struct uart_port *sunhv_port;
360static inline void sunhv_console_putchar(struct uart_port *port, char c) 360static inline void sunhv_console_putchar(struct uart_port *port, char c)
361{ 361{
362 unsigned long flags; 362 unsigned long flags;
363 int limit = 10000; 363 int limit = 1000000;
364 364
365 spin_lock_irqsave(&port->lock, flags); 365 spin_lock_irqsave(&port->lock, flags);
366 366
@@ -368,6 +368,7 @@ static inline void sunhv_console_putchar(struct uart_port *port, char c)
368 long status = hypervisor_con_putchar(c); 368 long status = hypervisor_con_putchar(c);
369 if (status == HV_EOK) 369 if (status == HV_EOK)
370 break; 370 break;
371 udelay(2);
371 } 372 }
372 373
373 spin_unlock_irqrestore(&port->lock, flags); 374 spin_unlock_irqrestore(&port->lock, flags);
@@ -385,28 +386,23 @@ static void sunhv_console_write(struct console *con, const char *s, unsigned n)
385 } 386 }
386} 387}
387 388
388static int sunhv_console_setup(struct console *con, char *options)
389{
390 return 0;
391}
392
393static struct console sunhv_console = { 389static struct console sunhv_console = {
394 .name = "ttyS", 390 .name = "ttyHV",
395 .write = sunhv_console_write, 391 .write = sunhv_console_write,
396 .device = uart_console_device, 392 .device = uart_console_device,
397 .setup = sunhv_console_setup,
398 .flags = CON_PRINTBUFFER, 393 .flags = CON_PRINTBUFFER,
399 .index = -1, 394 .index = -1,
400 .data = &sunhv_reg, 395 .data = &sunhv_reg,
401}; 396};
402 397
403static void __init sunhv_console_init(void) 398static inline struct console *SUNHV_CONSOLE(void)
404{ 399{
405 if (con_is_present()) 400 if (con_is_present())
406 return; 401 return NULL;
407 402
408 sunhv_console.index = 0; 403 sunhv_console.index = 0;
409 register_console(&sunhv_console); 404
405 return &sunhv_console;
410} 406}
411 407
412static int __init hv_console_compatible(char *buf, int len) 408static int __init hv_console_compatible(char *buf, int len)
@@ -496,7 +492,6 @@ static int __init sunhv_init(void)
496 492
497 sunhv_reg.minor = sunserial_current_minor; 493 sunhv_reg.minor = sunserial_current_minor;
498 sunhv_reg.nr = 1; 494 sunhv_reg.nr = 1;
499 sunhv_reg.cons = &sunhv_console;
500 495
501 ret = uart_register_driver(&sunhv_reg); 496 ret = uart_register_driver(&sunhv_reg);
502 if (ret < 0) { 497 if (ret < 0) {
@@ -506,11 +501,11 @@ static int __init sunhv_init(void)
506 return ret; 501 return ret;
507 } 502 }
508 503
509 sunhv_port = port;
510
511 sunserial_current_minor += 1; 504 sunserial_current_minor += 1;
512 505
513 sunhv_console_init(); 506 sunhv_reg.cons = SUNHV_CONSOLE();
507
508 sunhv_port = port;
514 509
515 uart_add_one_port(&sunhv_reg, port); 510 uart_add_one_port(&sunhv_reg, port);
516 511