asp.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * ASP Device Driver
  4. *
  5. * (c) Copyright 2000 The Puffin Group Inc.
  6. *
  7. * by Helge Deller <[email protected]>
  8. */
  9. #include <linux/errno.h>
  10. #include <linux/init.h>
  11. #include <linux/interrupt.h>
  12. #include <linux/module.h>
  13. #include <linux/types.h>
  14. #include <asm/io.h>
  15. #include <asm/led.h>
  16. #include "gsc.h"
  17. #define ASP_GSC_IRQ 3 /* hardcoded interrupt for GSC */
  18. #define ASP_VER_OFFSET 0x20 /* offset of ASP version */
  19. #define ASP_LED_ADDR 0xf0800020
  20. #define VIPER_INT_WORD 0xFFFBF088 /* addr of viper interrupt word */
  21. static struct gsc_asic asp;
  22. static void asp_choose_irq(struct parisc_device *dev, void *ctrl)
  23. {
  24. int irq;
  25. switch (dev->id.sversion) {
  26. case 0x71: irq = 9; break; /* SCSI */
  27. case 0x72: irq = 8; break; /* LAN */
  28. case 0x73: irq = 1; break; /* HIL */
  29. case 0x74: irq = 7; break; /* Centronics */
  30. case 0x75: irq = (dev->hw_path == 4) ? 5 : 6; break; /* RS232 */
  31. case 0x76: irq = 10; break; /* EISA BA */
  32. case 0x77: irq = 11; break; /* Graphics1 */
  33. case 0x7a: irq = 13; break; /* Audio (Bushmaster) */
  34. case 0x7b: irq = 13; break; /* Audio (Scorpio) */
  35. case 0x7c: irq = 3; break; /* FW SCSI */
  36. case 0x7d: irq = 4; break; /* FDDI */
  37. case 0x7f: irq = 13; break; /* Audio (Outfield) */
  38. default: return; /* Unknown */
  39. }
  40. gsc_asic_assign_irq(ctrl, irq, &dev->irq);
  41. switch (dev->id.sversion) {
  42. case 0x73: irq = 2; break; /* i8042 High-priority */
  43. case 0x76: irq = 0; break; /* EISA BA */
  44. default: return; /* Other */
  45. }
  46. gsc_asic_assign_irq(ctrl, irq, &dev->aux_irq);
  47. }
  48. /* There are two register ranges we're interested in. Interrupt /
  49. * Status / LED are at 0xf080xxxx and Asp special registers are at
  50. * 0xf082fxxx. PDC only tells us that Asp is at 0xf082f000, so for
  51. * the purposes of interrupt handling, we have to tell other bits of
  52. * the kernel to look at the other registers.
  53. */
  54. #define ASP_INTERRUPT_ADDR 0xf0800000
  55. static int __init asp_init_chip(struct parisc_device *dev)
  56. {
  57. struct gsc_irq gsc_irq;
  58. int ret;
  59. asp.version = gsc_readb(dev->hpa.start + ASP_VER_OFFSET) & 0xf;
  60. asp.name = (asp.version == 1) ? "Asp" : "Cutoff";
  61. asp.hpa = ASP_INTERRUPT_ADDR;
  62. printk(KERN_INFO "%s version %d at 0x%lx found.\n",
  63. asp.name, asp.version, (unsigned long)dev->hpa.start);
  64. /* the IRQ ASP should use */
  65. ret = -EBUSY;
  66. dev->irq = gsc_claim_irq(&gsc_irq, ASP_GSC_IRQ);
  67. if (dev->irq < 0) {
  68. printk(KERN_ERR "%s(): cannot get GSC irq\n", __func__);
  69. goto out;
  70. }
  71. asp.eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data;
  72. ret = request_irq(gsc_irq.irq, gsc_asic_intr, 0, "asp", &asp);
  73. if (ret < 0)
  74. goto out;
  75. /* Program VIPER to interrupt on the ASP irq */
  76. gsc_writel((1 << (31 - ASP_GSC_IRQ)),VIPER_INT_WORD);
  77. /* Done init'ing, register this driver */
  78. ret = gsc_common_setup(dev, &asp);
  79. if (ret)
  80. goto out;
  81. gsc_fixup_irqs(dev, &asp, asp_choose_irq);
  82. /* Mongoose is a sibling of Asp, not a child... */
  83. gsc_fixup_irqs(parisc_parent(dev), &asp, asp_choose_irq);
  84. /* initialize the chassis LEDs */
  85. #ifdef CONFIG_CHASSIS_LCD_LED
  86. register_led_driver(DISPLAY_MODEL_OLD_ASP, LED_CMD_REG_NONE,
  87. ASP_LED_ADDR);
  88. #endif
  89. out:
  90. return ret;
  91. }
  92. static const struct parisc_device_id asp_tbl[] __initconst = {
  93. { HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00070 },
  94. { 0, }
  95. };
  96. struct parisc_driver asp_driver __refdata = {
  97. .name = "asp",
  98. .id_table = asp_tbl,
  99. .probe = asp_init_chip,
  100. };