8250_gsc.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 "8250.h"
  24. static int __init
  25. serial_init_chip(struct parisc_device *dev)
  26. {
  27. struct uart_port port;
  28. unsigned long address;
  29. int err;
  30. if (!dev->irq) {
  31. /* We find some unattached serial ports by walking native
  32. * busses. These should be silently ignored. Otherwise,
  33. * what we have here is a missing parent device, so tell
  34. * the user what they're missing.
  35. */
  36. if (parisc_parent(dev)->id.hw_type != HPHW_IOA) {
  37. printk(KERN_INFO "Serial: device 0x%lx not configured.\n"
  38. "Enable support for Wax, Lasi, Asp or Dino.\n",
  39. dev->hpa.start);
  40. }
  41. return -ENODEV;
  42. }
  43. address = dev->hpa.start;
  44. if (dev->id.sversion != 0x8d) {
  45. address += 0x800;
  46. }
  47. memset(&port, 0, sizeof(port));
  48. port.iotype = UPIO_MEM;
  49. /* 7.272727MHz on Lasi. Assumed the same for Dino, Wax and Timi. */
  50. port.uartclk = 7272727;
  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. iounmap(port.membase);
  60. return err;
  61. }
  62. return 0;
  63. }
  64. static struct parisc_device_id serial_tbl[] = {
  65. { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 },
  66. { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c },
  67. { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d },
  68. { 0 }
  69. };
  70. /* Hack. Some machines have SERIAL_0 attached to Lasi and SERIAL_1
  71. * attached to Dino. Unfortunately, Dino appears before Lasi in the device
  72. * tree. To ensure that ttyS0 == SERIAL_0, we register two drivers; one
  73. * which only knows about Lasi and then a second which will find all the
  74. * other serial ports. HPUX ignores this problem.
  75. */
  76. static struct parisc_device_id lasi_tbl[] = {
  77. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03B, 0x0008C }, /* C1xx/C1xxL */
  78. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03C, 0x0008C }, /* B132L */
  79. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03D, 0x0008C }, /* B160L */
  80. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03E, 0x0008C }, /* B132L+ */
  81. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03F, 0x0008C }, /* B180L+ */
  82. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x046, 0x0008C }, /* Rocky2 120 */
  83. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x047, 0x0008C }, /* Rocky2 150 */
  84. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x04E, 0x0008C }, /* Kiji L2 132 */
  85. { HPHW_FIO, HVERSION_REV_ANY_ID, 0x056, 0x0008C }, /* Raven+ */
  86. { 0 }
  87. };
  88. MODULE_DEVICE_TABLE(parisc, serial_tbl);
  89. static struct parisc_driver lasi_driver = {
  90. .name = "serial_1",
  91. .id_table = lasi_tbl,
  92. .probe = serial_init_chip,
  93. };
  94. static struct parisc_driver serial_driver = {
  95. .name = "serial",
  96. .id_table = serial_tbl,
  97. .probe = serial_init_chip,
  98. };
  99. int __init probe_serial_gsc(void)
  100. {
  101. register_parisc_driver(&lasi_driver);
  102. register_parisc_driver(&serial_driver);
  103. return 0;
  104. }
  105. module_init(probe_serial_gsc);