wax.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. int __init
  57. wax_init_chip(struct parisc_device *dev)
  58. {
  59. struct gsc_asic *wax;
  60. struct parisc_device *parent;
  61. struct gsc_irq gsc_irq;
  62. int ret;
  63. wax = kzalloc(sizeof(*wax), GFP_KERNEL);
  64. if (!wax)
  65. return -ENOMEM;
  66. wax->name = "wax";
  67. wax->hpa = dev->hpa.start;
  68. wax->version = 0; /* gsc_readb(wax->hpa+WAX_VER); */
  69. printk(KERN_INFO "%s at 0x%lx found.\n", wax->name, wax->hpa);
  70. /* Stop wax hissing for a bit */
  71. wax_init_irq(wax);
  72. /* the IRQ wax should use */
  73. dev->irq = gsc_claim_irq(&gsc_irq, WAX_GSC_IRQ);
  74. if (dev->irq < 0) {
  75. printk(KERN_ERR "%s(): cannot get GSC irq\n",
  76. __FUNCTION__);
  77. kfree(wax);
  78. return -EBUSY;
  79. }
  80. wax->eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data;
  81. ret = request_irq(gsc_irq.irq, gsc_asic_intr, 0, "wax", wax);
  82. if (ret < 0) {
  83. kfree(wax);
  84. return ret;
  85. }
  86. /* enable IRQ's for devices below WAX */
  87. gsc_writel(wax->eim, wax->hpa + OFFSET_IAR);
  88. /* Done init'ing, register this driver */
  89. ret = gsc_common_setup(dev, wax);
  90. if (ret) {
  91. kfree(wax);
  92. return ret;
  93. }
  94. gsc_fixup_irqs(dev, wax, wax_choose_irq);
  95. /* On 715-class machines, Wax EISA is a sibling of Wax, not a child. */
  96. parent = parisc_parent(dev);
  97. if (parent->id.hw_type != HPHW_IOA) {
  98. gsc_fixup_irqs(parent, wax, wax_choose_irq);
  99. }
  100. return ret;
  101. }
  102. static struct parisc_device_id wax_tbl[] = {
  103. { HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008e },
  104. { 0, }
  105. };
  106. MODULE_DEVICE_TABLE(parisc, wax_tbl);
  107. struct parisc_driver wax_driver = {
  108. .name = "wax",
  109. .id_table = wax_tbl,
  110. .probe = wax_init_chip,
  111. };