8250_gsc.c 3.5 KB

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