0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <linux/errno.h>
0011 #include <linux/init.h>
0012 #include <linux/interrupt.h>
0013 #include <linux/module.h>
0014 #include <linux/types.h>
0015 #include <asm/io.h>
0016 #include <asm/led.h>
0017
0018 #include "gsc.h"
0019
0020 #define ASP_GSC_IRQ 3
0021
0022 #define ASP_VER_OFFSET 0x20
0023
0024 #define ASP_LED_ADDR 0xf0800020
0025
0026 #define VIPER_INT_WORD 0xFFFBF088
0027
0028 static struct gsc_asic asp;
0029
0030 static void asp_choose_irq(struct parisc_device *dev, void *ctrl)
0031 {
0032 int irq;
0033
0034 switch (dev->id.sversion) {
0035 case 0x71: irq = 9; break;
0036 case 0x72: irq = 8; break;
0037 case 0x73: irq = 1; break;
0038 case 0x74: irq = 7; break;
0039 case 0x75: irq = (dev->hw_path == 4) ? 5 : 6; break;
0040 case 0x76: irq = 10; break;
0041 case 0x77: irq = 11; break;
0042 case 0x7a: irq = 13; break;
0043 case 0x7b: irq = 13; break;
0044 case 0x7c: irq = 3; break;
0045 case 0x7d: irq = 4; break;
0046 case 0x7f: irq = 13; break;
0047 default: return;
0048 }
0049
0050 gsc_asic_assign_irq(ctrl, irq, &dev->irq);
0051
0052 switch (dev->id.sversion) {
0053 case 0x73: irq = 2; break;
0054 case 0x76: irq = 0; break;
0055 default: return;
0056 }
0057
0058 gsc_asic_assign_irq(ctrl, irq, &dev->aux_irq);
0059 }
0060
0061
0062
0063
0064
0065
0066
0067 #define ASP_INTERRUPT_ADDR 0xf0800000
0068
0069 static int __init asp_init_chip(struct parisc_device *dev)
0070 {
0071 struct gsc_irq gsc_irq;
0072 int ret;
0073
0074 asp.version = gsc_readb(dev->hpa.start + ASP_VER_OFFSET) & 0xf;
0075 asp.name = (asp.version == 1) ? "Asp" : "Cutoff";
0076 asp.hpa = ASP_INTERRUPT_ADDR;
0077
0078 printk(KERN_INFO "%s version %d at 0x%lx found.\n",
0079 asp.name, asp.version, (unsigned long)dev->hpa.start);
0080
0081
0082 ret = -EBUSY;
0083 dev->irq = gsc_claim_irq(&gsc_irq, ASP_GSC_IRQ);
0084 if (dev->irq < 0) {
0085 printk(KERN_ERR "%s(): cannot get GSC irq\n", __func__);
0086 goto out;
0087 }
0088
0089 asp.eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data;
0090
0091 ret = request_irq(gsc_irq.irq, gsc_asic_intr, 0, "asp", &asp);
0092 if (ret < 0)
0093 goto out;
0094
0095
0096 gsc_writel((1 << (31 - ASP_GSC_IRQ)),VIPER_INT_WORD);
0097
0098
0099 ret = gsc_common_setup(dev, &asp);
0100 if (ret)
0101 goto out;
0102
0103 gsc_fixup_irqs(dev, &asp, asp_choose_irq);
0104
0105 gsc_fixup_irqs(parisc_parent(dev), &asp, asp_choose_irq);
0106
0107
0108 #ifdef CONFIG_CHASSIS_LCD_LED
0109 register_led_driver(DISPLAY_MODEL_OLD_ASP, LED_CMD_REG_NONE,
0110 ASP_LED_ADDR);
0111 #endif
0112
0113 out:
0114 return ret;
0115 }
0116
0117 static const struct parisc_device_id asp_tbl[] __initconst = {
0118 { HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00070 },
0119 { 0, }
0120 };
0121
0122 struct parisc_driver asp_driver __refdata = {
0123 .name = "asp",
0124 .id_table = asp_tbl,
0125 .probe = asp_init_chip,
0126 };