asp.c 3.5 KB

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