Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[linux-2.6.git] / drivers / parisc / asp.c
blob6a1ab2512a53625aea4f54ae842bef2c38e77649
1 /*
2 * ASP Device Driver
4 * (c) Copyright 2000 The Puffin Group Inc.
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.
11 * by Helge Deller <deller@gmx.de>
14 #include <linux/errno.h>
15 #include <linux/init.h>
16 #include <linux/interrupt.h>
17 #include <linux/module.h>
18 #include <linux/types.h>
19 #include <asm/io.h>
20 #include <asm/led.h>
22 #include "gsc.h"
24 #define ASP_GSC_IRQ 3 /* hardcoded interrupt for GSC */
26 #define ASP_VER_OFFSET 0x20 /* offset of ASP version */
28 #define ASP_LED_ADDR 0xf0800020
30 #define VIPER_INT_WORD 0xFFFBF088 /* addr of viper interrupt word */
32 static struct gsc_asic asp;
34 static void asp_choose_irq(struct parisc_device *dev, void *ctrl)
36 int irq;
38 switch (dev->id.sversion) {
39 case 0x71: irq = 9; break; /* SCSI */
40 case 0x72: irq = 8; break; /* LAN */
41 case 0x73: irq = 1; break; /* HIL */
42 case 0x74: irq = 7; break; /* Centronics */
43 case 0x75: irq = (dev->hw_path == 4) ? 5 : 6; break; /* RS232 */
44 case 0x76: irq = 10; break; /* EISA BA */
45 case 0x77: irq = 11; break; /* Graphics1 */
46 case 0x7a: irq = 13; break; /* Audio (Bushmaster) */
47 case 0x7b: irq = 13; break; /* Audio (Scorpio) */
48 case 0x7c: irq = 3; break; /* FW SCSI */
49 case 0x7d: irq = 4; break; /* FDDI */
50 case 0x7f: irq = 13; break; /* Audio (Outfield) */
51 default: return; /* Unknown */
54 gsc_asic_assign_irq(ctrl, irq, &dev->irq);
56 switch (dev->id.sversion) {
57 case 0x73: irq = 2; break; /* i8042 High-priority */
58 case 0x76: irq = 0; break; /* EISA BA */
59 default: return; /* Other */
62 gsc_asic_assign_irq(ctrl, irq, &dev->aux_irq);
65 /* There are two register ranges we're interested in. Interrupt /
66 * Status / LED are at 0xf080xxxx and Asp special registers are at
67 * 0xf082fxxx. PDC only tells us that Asp is at 0xf082f000, so for
68 * the purposes of interrupt handling, we have to tell other bits of
69 * the kernel to look at the other registers.
71 #define ASP_INTERRUPT_ADDR 0xf0800000
73 static int __init asp_init_chip(struct parisc_device *dev)
75 struct gsc_irq gsc_irq;
76 int ret;
78 asp.version = gsc_readb(dev->hpa.start + ASP_VER_OFFSET) & 0xf;
79 asp.name = (asp.version == 1) ? "Asp" : "Cutoff";
80 asp.hpa = ASP_INTERRUPT_ADDR;
82 printk(KERN_INFO "%s version %d at 0x%lx found.\n",
83 asp.name, asp.version, (unsigned long)dev->hpa.start);
85 /* the IRQ ASP should use */
86 ret = -EBUSY;
87 dev->irq = gsc_claim_irq(&gsc_irq, ASP_GSC_IRQ);
88 if (dev->irq < 0) {
89 printk(KERN_ERR "%s(): cannot get GSC irq\n", __func__);
90 goto out;
93 asp.eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data;
95 ret = request_irq(gsc_irq.irq, gsc_asic_intr, 0, "asp", &asp);
96 if (ret < 0)
97 goto out;
99 /* Program VIPER to interrupt on the ASP irq */
100 gsc_writel((1 << (31 - ASP_GSC_IRQ)),VIPER_INT_WORD);
102 /* Done init'ing, register this driver */
103 ret = gsc_common_setup(dev, &asp);
104 if (ret)
105 goto out;
107 gsc_fixup_irqs(dev, &asp, asp_choose_irq);
108 /* Mongoose is a sibling of Asp, not a child... */
109 gsc_fixup_irqs(parisc_parent(dev), &asp, asp_choose_irq);
111 /* initialize the chassis LEDs */
112 #ifdef CONFIG_CHASSIS_LCD_LED
113 register_led_driver(DISPLAY_MODEL_OLD_ASP, LED_CMD_REG_NONE,
114 ASP_LED_ADDR);
115 #endif
117 out:
118 return ret;
121 static struct parisc_device_id asp_tbl[] = {
122 { HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00070 },
123 { 0, }
126 struct parisc_driver asp_driver = {
127 .name = "asp",
128 .id_table = asp_tbl,
129 .probe = asp_init_chip,