8250_gsc.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * Serial Device Initialisation for Lasi/Asp/Wax/Dino
  3. *
  4. * (c) Copyright Matthew Wilcox <willy@debian.org> 2001-2002
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #include <linux/errno.h>
  12. #include <linux/init.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/ioport.h>
  15. #include <linux/module.h>
  16. #include <linux/serial_core.h>
  17. #include <linux/signal.h>
  18. #include <linux/slab.h>
  19. #include <linux/types.h>
  20. #include <asm/hardware.h>
  21. #include <asm/parisc-device.h>
  22. #include <asm/io.h>
  23. #include <asm/serial.h> /* for LASI_BASE_BAUD */
  24. #include "8250.h"
  25. static int __init
  26. serial_init_chip(struct parisc_device *dev)
  27. {
  28. struct uart_port port;
  29. unsigned long address;
  30. int err;
  31. if (!dev->irq) {
  32. /* We find some unattached serial ports by walking native
  33. * busses. These should be silently ignored. Otherwise,
  34. * what we have here is a missing parent device, so tell
  35. * the user what they're missing.
  36. */
  37. if (parisc_parent(dev)->id.hw_type != HPHW_IOA) {
  38. printk(KERN_INFO "Serial: device 0x%lx not configured.\n"
  39. "Enable support for Wax, Lasi, Asp or Dino.\n",
  40. dev->hpa.start);
  41. }
  42. return -ENODEV;
  43. }
  44. address = dev->hpa.start;
  45. if (dev->id.sversion != 0x8d) {
  46. address += 0x800;
  47. }
  48. memset(&port, 0, sizeof(port));
  49. port.iotype = UPIO_MEM;
  50. port.uartclk = LASI_BASE_BAUD * 16;
  51. port.mapbase = address;
  52. port.membase = ioremap_nocache(address, 16);
  53. port.irq = dev->irq;
  54. port.flags = UPF_BOOT_AUTOCONF;
  55. port.dev = &dev->dev;
  56. err = serial8250_register_port(&port);
  57. if (err < 0) {
  58. printk(KERN_WARNING "serial8250_register_port returned error %d\n", err);
  59. return err;
  60. }
  61. return 0;
  62. }
  63. static struct parisc_device_id serial_tbl[] = {
  64. { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 },
  65. { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c },
  66. { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d },
  67. { 0 }
  68. };
  69. /* Hack. Some machines have SERIAL_0 attached to Lasi and SERIAL_1
  70. * attached to Dino. Unfortunately, Dino appears before Lasi in the device
  71. * tree. To ensure that ttyS0 == SERIAL_0, we register two drivers; one
  72. * which only knows about Lasi and then a second which will find all the
  73. * other serial ports. HPUX ignores this problem.
  74. */
  75. static struct parisc_device_id lasi_tbl[] = {
  76. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03B, 0x0008C }, /* C1xx/C1xxL */
  77. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03C, 0x0008C }, /* B132L */
  78. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03D, 0x0008C }, /* B160L */
  79. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03E, 0x0008C }, /* B132L+ */
  80. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03F, 0x0008C }, /* B180L+ */
  81. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x046, 0x0008C }, /* Rocky2 120 */
  82. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x047, 0x0008C }, /* Rocky2 150 */
  83. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x04E, 0x0008C }, /* Kiji L2 132 */
  84. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x056, 0x0008C }, /* Raven+ */
  85. { 0 }
  86. };
  87. MODULE_DEVICE_TABLE(parisc, serial_tbl);
  88. static struct parisc_driver lasi_driver = {
  89. .name = "serial_1",
  90. .id_table = lasi_tbl,
  91. .probe = serial_init_chip,
  92. };
  93. static struct parisc_driver serial_driver = {
  94. .name = "serial",
  95. .id_table = serial_tbl,
  96. .probe = serial_init_chip,
  97. };
  98. int __init probe_serial_gsc(void)
  99. {
  100. register_parisc_driver(&lasi_driver);
  101. register_parisc_driver(&serial_driver);
  102. return 0;
  103. }
  104. module_init(probe_serial_gsc);