ip27-console.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2001, 2002 Ralf Baechle
  7. */
  8. #include <linux/init.h>
  9. #include <linux/console.h>
  10. #include <linux/kdev_t.h>
  11. #include <linux/major.h>
  12. #include <linux/termios.h>
  13. #include <linux/sched.h>
  14. #include <linux/tty.h>
  15. #include <asm/page.h>
  16. #include <asm/semaphore.h>
  17. #include <asm/sn/addrs.h>
  18. #include <asm/sn/sn0/hub.h>
  19. #include <asm/sn/klconfig.h>
  20. #include <asm/sn/ioc3.h>
  21. #include <asm/sn/sn_private.h>
  22. #include <linux/serial.h>
  23. #include <linux/serial_core.h>
  24. #define IOC3_CLK (22000000 / 3)
  25. #define IOC3_FLAGS (0)
  26. static inline struct ioc3_uartregs *console_uart(void)
  27. {
  28. struct ioc3 *ioc3;
  29. nasid_t nasid;
  30. nasid = (master_nasid == INVALID_NASID) ? get_nasid() : master_nasid;
  31. ioc3 = (struct ioc3 *)KL_CONFIG_CH_CONS_INFO(nasid)->memory_base;
  32. return &ioc3->sregs.uarta;
  33. }
  34. void prom_putchar(char c)
  35. {
  36. struct ioc3_uartregs *uart = console_uart();
  37. while ((uart->iu_lsr & 0x20) == 0);
  38. uart->iu_thr = c;
  39. }
  40. char __init prom_getchar(void)
  41. {
  42. return 0;
  43. }
  44. static void inline ioc3_console_probe(void)
  45. {
  46. struct uart_port up;
  47. /*
  48. * Register to interrupt zero because we share the interrupt with
  49. * the serial driver which we don't properly support yet.
  50. */
  51. memset(&up, 0, sizeof(up));
  52. up.membase = (unsigned char *) console_uart();
  53. up.irq = 0;
  54. up.uartclk = IOC3_CLK;
  55. up.regshift = 0;
  56. up.iotype = UPIO_MEM;
  57. up.flags = IOC3_FLAGS;
  58. up.line = 0;
  59. if (early_serial_setup(&up))
  60. printk(KERN_ERR "Early serial init of port 0 failed\n");
  61. }
  62. __init void ip27_setup_console(void)
  63. {
  64. ioc3_console_probe();
  65. }