wax.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * WAX Device Driver
  3. *
  4. * (c) Copyright 2000 The Puffin Group Inc.
  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. * by Helge Deller <deller@gmx.de>
  12. */
  13. #include <linux/errno.h>
  14. #include <linux/init.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/ioport.h>
  17. #include <linux/slab.h>
  18. #include <linux/module.h>
  19. #include <linux/types.h>
  20. #include <asm/io.h>
  21. #include <asm/hardware.h>
  22. #include "gsc.h"
  23. #define WAX_GSC_IRQ 7 /* Hardcoded Interrupt for GSC */
  24. static void wax_choose_irq(struct parisc_device *dev, void *ctrl)
  25. {
  26. int irq;
  27. switch (dev->id.sversion) {
  28. case 0x73: irq = 1; break; /* i8042 General */
  29. case 0x8c: irq = 6; break; /* Serial */
  30. case 0x90: irq = 10; break; /* EISA */
  31. default: return; /* Unknown */
  32. }
  33. gsc_asic_assign_irq(ctrl, irq, &dev->irq);
  34. switch (dev->id.sversion) {
  35. case 0x73: irq = 2; break; /* i8042 High-priority */
  36. case 0x90: irq = 0; break; /* EISA NMI */
  37. default: return; /* No secondary IRQ */
  38. }
  39. gsc_asic_assign_irq(ctrl, irq, &dev->aux_irq);
  40. }
  41. static void __init
  42. wax_init_irq(struct gsc_asic *wax)
  43. {
  44. unsigned long base = wax->hpa;
  45. /* Wax-off */
  46. gsc_writel(0x00000000, base+OFFSET_IMR);
  47. /* clear pending interrupts */
  48. gsc_readl(base+OFFSET_IRR);
  49. /* We're not really convinced we want to reset the onboard
  50. * devices. Firmware does it for us...
  51. */
  52. /* Resets */
  53. // gsc_writel(0xFFFFFFFF, base+0x1000); /* HIL */
  54. // gsc_writel(0xFFFFFFFF, base+0x2000); /* RS232-B on Wax */
  55. }
  56. static int __init wax_init_chip(struct parisc_device *dev)
  57. {
  58. struct gsc_asic *wax;
  59. struct parisc_device *parent;
  60. struct gsc_irq gsc_irq;
  61. int ret;
  62. wax = kzalloc(sizeof(*wax), GFP_KERNEL);
  63. if (!wax)
  64. return -ENOMEM;
  65. wax->name = "wax";
  66. wax->hpa = dev->hpa.start;
  67. wax->version = 0; /* gsc_readb(wax->hpa+WAX_VER); */
  68. printk(KERN_INFO "%s at 0x%lx found.\n", wax->name, wax->hpa);
  69. /* Stop wax hissing for a bit */
  70. wax_init_irq(wax);
  71. /* the IRQ wax should use */
  72. dev->irq = gsc_claim_irq(&gsc_irq, WAX_GSC_IRQ);
  73. if (dev->irq < 0) {
  74. printk(KERN_ERR "%s(): cannot get GSC irq\n",
  75. __func__);
  76. kfree(wax);
  77. return -EBUSY;
  78. }
  79. wax->eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data;
  80. ret = request_irq(gsc_irq.irq, gsc_asic_intr, 0, "wax", wax);
  81. if (ret < 0) {
  82. kfree(wax);
  83. return ret;
  84. }
  85. /* enable IRQ's for devices below WAX */
  86. gsc_writel(wax->eim, wax->hpa + OFFSET_IAR);
  87. /* Done init'ing, register this driver */
  88. ret = gsc_common_setup(dev, wax);
  89. if (ret) {
  90. kfree(wax);
  91. return ret;
  92. }
  93. gsc_fixup_irqs(dev, wax, wax_choose_irq);
  94. /* On 715-class machines, Wax EISA is a sibling of Wax, not a child. */
  95. parent = parisc_parent(dev);
  96. if (parent->id.hw_type != HPHW_IOA) {
  97. gsc_fixup_irqs(parent, wax, wax_choose_irq);
  98. }
  99. return ret;
  100. }
  101. static struct parisc_device_id wax_tbl[] = {
  102. { HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008e },
  103. { 0, }
  104. };
  105. MODULE_DEVICE_TABLE(parisc, wax_tbl);
  106. struct parisc_driver wax_driver = {
  107. .name = "wax",
  108. .id_table = wax_tbl,
  109. .probe = wax_init_chip,
  110. };