Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  *  ASP Device Driver
0004  *
0005  *  (c) Copyright 2000 The Puffin Group Inc.
0006  *
0007  *  by Helge Deller <deller@gmx.de>
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       /* hardcoded interrupt for GSC */
0021 
0022 #define ASP_VER_OFFSET  0x20        /* offset of ASP version */
0023 
0024 #define ASP_LED_ADDR    0xf0800020
0025 
0026 #define VIPER_INT_WORD  0xFFFBF088      /* addr of viper interrupt word */
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; /* SCSI */
0036     case 0x72:  irq =  8; break; /* LAN */
0037     case 0x73:  irq =  1; break; /* HIL */
0038     case 0x74:  irq =  7; break; /* Centronics */
0039     case 0x75:  irq = (dev->hw_path == 4) ? 5 : 6; break; /* RS232 */
0040     case 0x76:  irq = 10; break; /* EISA BA */
0041     case 0x77:  irq = 11; break; /* Graphics1 */
0042     case 0x7a:  irq = 13; break; /* Audio (Bushmaster) */
0043     case 0x7b:  irq = 13; break; /* Audio (Scorpio) */
0044     case 0x7c:  irq =  3; break; /* FW SCSI */
0045     case 0x7d:  irq =  4; break; /* FDDI */
0046     case 0x7f:  irq = 13; break; /* Audio (Outfield) */
0047     default:    return;      /* Unknown */
0048     }
0049 
0050     gsc_asic_assign_irq(ctrl, irq, &dev->irq);
0051 
0052     switch (dev->id.sversion) {
0053     case 0x73:  irq =  2; break; /* i8042 High-priority */
0054     case 0x76:  irq =  0; break; /* EISA BA */
0055     default:    return;      /* Other */
0056     }
0057 
0058     gsc_asic_assign_irq(ctrl, irq, &dev->aux_irq);
0059 }
0060 
0061 /* There are two register ranges we're interested in.  Interrupt /
0062  * Status / LED are at 0xf080xxxx and Asp special registers are at
0063  * 0xf082fxxx.  PDC only tells us that Asp is at 0xf082f000, so for
0064  * the purposes of interrupt handling, we have to tell other bits of
0065  * the kernel to look at the other registers.
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     /* the IRQ ASP should use */
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     /* Program VIPER to interrupt on the ASP irq */
0096     gsc_writel((1 << (31 - ASP_GSC_IRQ)),VIPER_INT_WORD);
0097 
0098     /* Done init'ing, register this driver */
0099     ret = gsc_common_setup(dev, &asp);
0100     if (ret)
0101         goto out;
0102 
0103     gsc_fixup_irqs(dev, &asp, asp_choose_irq);
0104     /* Mongoose is a sibling of Asp, not a child... */
0105     gsc_fixup_irqs(parisc_parent(dev), &asp, asp_choose_irq);
0106 
0107     /* initialize the chassis LEDs */ 
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 };