Linux Audio

Check our new training course

Loading...
v5.9
  1// SPDX-License-Identifier: GPL-2.0-or-later
  2/*
  3 *	WAX Device Driver
  4 *
  5 *	(c) Copyright 2000 The Puffin Group Inc.
  6 *
 
 
 
 
 
  7 *	by Helge Deller <deller@gmx.de>
  8 */
  9
 10#include <linux/errno.h>
 11#include <linux/init.h>
 12#include <linux/interrupt.h>
 13#include <linux/ioport.h>
 14#include <linux/slab.h>
 15#include <linux/module.h>
 16#include <linux/types.h>
 17
 18#include <asm/io.h>
 19#include <asm/hardware.h>
 20
 21#include "gsc.h"
 22
 23#define WAX_GSC_IRQ	7	/* Hardcoded Interrupt for GSC */
 24
 25static void wax_choose_irq(struct parisc_device *dev, void *ctrl)
 26{
 27	int irq;
 28
 29	switch (dev->id.sversion) {
 30		case 0x73:	irq =  1; break; /* i8042 General */
 31		case 0x8c:	irq =  6; break; /* Serial */
 32		case 0x90:	irq = 10; break; /* EISA */
 33		default:	return;		 /* Unknown */
 34	}
 35
 36	gsc_asic_assign_irq(ctrl, irq, &dev->irq);
 37
 38	switch (dev->id.sversion) {
 39		case 0x73:	irq =  2; break; /* i8042 High-priority */
 40		case 0x90:	irq =  0; break; /* EISA NMI */
 41		default:	return;		 /* No secondary IRQ */
 42	}
 43
 44	gsc_asic_assign_irq(ctrl, irq, &dev->aux_irq);
 45}
 46
 47static void __init
 48wax_init_irq(struct gsc_asic *wax)
 49{
 50	unsigned long base = wax->hpa;
 51
 52	/* Wax-off */
 53	gsc_writel(0x00000000, base+OFFSET_IMR);
 54
 55	/* clear pending interrupts */
 56	gsc_readl(base+OFFSET_IRR);
 57
 58	/* We're not really convinced we want to reset the onboard
 59         * devices. Firmware does it for us...
 60	 */
 61
 62	/* Resets */
 63//	gsc_writel(0xFFFFFFFF, base+0x1000); /* HIL */
 64//	gsc_writel(0xFFFFFFFF, base+0x2000); /* RS232-B on Wax */
 65}
 66
 67static int __init wax_init_chip(struct parisc_device *dev)
 68{
 69	struct gsc_asic *wax;
 70	struct parisc_device *parent;
 71	struct gsc_irq gsc_irq;
 72	int ret;
 73
 74	wax = kzalloc(sizeof(*wax), GFP_KERNEL);
 75	if (!wax)
 76		return -ENOMEM;
 77
 78	wax->name = "wax";
 79	wax->hpa = dev->hpa.start;
 80
 81	wax->version = 0;   /* gsc_readb(wax->hpa+WAX_VER); */
 82	printk(KERN_INFO "%s at 0x%lx found.\n", wax->name, wax->hpa);
 83
 84	/* Stop wax hissing for a bit */
 85	wax_init_irq(wax);
 86
 87	/* the IRQ wax should use */
 88	dev->irq = gsc_claim_irq(&gsc_irq, WAX_GSC_IRQ);
 89	if (dev->irq < 0) {
 90		printk(KERN_ERR "%s(): cannot get GSC irq\n",
 91				__func__);
 92		kfree(wax);
 93		return -EBUSY;
 94	}
 95
 96	wax->eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data;
 97
 98	ret = request_irq(gsc_irq.irq, gsc_asic_intr, 0, "wax", wax);
 99	if (ret < 0) {
100		kfree(wax);
101		return ret;
102	}
103
104	/* enable IRQ's for devices below WAX */
105	gsc_writel(wax->eim, wax->hpa + OFFSET_IAR);
106
107	/* Done init'ing, register this driver */
108	ret = gsc_common_setup(dev, wax);
109	if (ret) {
110		kfree(wax);
111		return ret;
112	}
113
114	gsc_fixup_irqs(dev, wax, wax_choose_irq);
115	/* On 715-class machines, Wax EISA is a sibling of Wax, not a child. */
116	parent = parisc_parent(dev);
117	if (parent->id.hw_type != HPHW_IOA) {
118		gsc_fixup_irqs(parent, wax, wax_choose_irq);
119	}
120
121	return ret;
122}
123
124static const struct parisc_device_id wax_tbl[] __initconst = {
125  	{ HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008e },
126	{ 0, }
127};
128
129MODULE_DEVICE_TABLE(parisc, wax_tbl);
130
131struct parisc_driver wax_driver __refdata = {
132	.name =		"wax",
133	.id_table =	wax_tbl,
134	.probe =	wax_init_chip,
135};
v3.1
 
  1/*
  2 *	WAX 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
 14#include <linux/errno.h>
 15#include <linux/init.h>
 16#include <linux/interrupt.h>
 17#include <linux/ioport.h>
 18#include <linux/slab.h>
 19#include <linux/module.h>
 20#include <linux/types.h>
 21
 22#include <asm/io.h>
 23#include <asm/hardware.h>
 24
 25#include "gsc.h"
 26
 27#define WAX_GSC_IRQ	7	/* Hardcoded Interrupt for GSC */
 28
 29static void wax_choose_irq(struct parisc_device *dev, void *ctrl)
 30{
 31	int irq;
 32
 33	switch (dev->id.sversion) {
 34		case 0x73:	irq =  1; break; /* i8042 General */
 35		case 0x8c:	irq =  6; break; /* Serial */
 36		case 0x90:	irq = 10; break; /* EISA */
 37		default:	return;		 /* Unknown */
 38	}
 39
 40	gsc_asic_assign_irq(ctrl, irq, &dev->irq);
 41
 42	switch (dev->id.sversion) {
 43		case 0x73:	irq =  2; break; /* i8042 High-priority */
 44		case 0x90:	irq =  0; break; /* EISA NMI */
 45		default:	return;		 /* No secondary IRQ */
 46	}
 47
 48	gsc_asic_assign_irq(ctrl, irq, &dev->aux_irq);
 49}
 50
 51static void __init
 52wax_init_irq(struct gsc_asic *wax)
 53{
 54	unsigned long base = wax->hpa;
 55
 56	/* Wax-off */
 57	gsc_writel(0x00000000, base+OFFSET_IMR);
 58
 59	/* clear pending interrupts */
 60	gsc_readl(base+OFFSET_IRR);
 61
 62	/* We're not really convinced we want to reset the onboard
 63         * devices. Firmware does it for us...
 64	 */
 65
 66	/* Resets */
 67//	gsc_writel(0xFFFFFFFF, base+0x1000); /* HIL */
 68//	gsc_writel(0xFFFFFFFF, base+0x2000); /* RS232-B on Wax */
 69}
 70
 71static int __init wax_init_chip(struct parisc_device *dev)
 72{
 73	struct gsc_asic *wax;
 74	struct parisc_device *parent;
 75	struct gsc_irq gsc_irq;
 76	int ret;
 77
 78	wax = kzalloc(sizeof(*wax), GFP_KERNEL);
 79	if (!wax)
 80		return -ENOMEM;
 81
 82	wax->name = "wax";
 83	wax->hpa = dev->hpa.start;
 84
 85	wax->version = 0;   /* gsc_readb(wax->hpa+WAX_VER); */
 86	printk(KERN_INFO "%s at 0x%lx found.\n", wax->name, wax->hpa);
 87
 88	/* Stop wax hissing for a bit */
 89	wax_init_irq(wax);
 90
 91	/* the IRQ wax should use */
 92	dev->irq = gsc_claim_irq(&gsc_irq, WAX_GSC_IRQ);
 93	if (dev->irq < 0) {
 94		printk(KERN_ERR "%s(): cannot get GSC irq\n",
 95				__func__);
 96		kfree(wax);
 97		return -EBUSY;
 98	}
 99
100	wax->eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data;
101
102	ret = request_irq(gsc_irq.irq, gsc_asic_intr, 0, "wax", wax);
103	if (ret < 0) {
104		kfree(wax);
105		return ret;
106	}
107
108	/* enable IRQ's for devices below WAX */
109	gsc_writel(wax->eim, wax->hpa + OFFSET_IAR);
110
111	/* Done init'ing, register this driver */
112	ret = gsc_common_setup(dev, wax);
113	if (ret) {
114		kfree(wax);
115		return ret;
116	}
117
118	gsc_fixup_irqs(dev, wax, wax_choose_irq);
119	/* On 715-class machines, Wax EISA is a sibling of Wax, not a child. */
120	parent = parisc_parent(dev);
121	if (parent->id.hw_type != HPHW_IOA) {
122		gsc_fixup_irqs(parent, wax, wax_choose_irq);
123	}
124
125	return ret;
126}
127
128static struct parisc_device_id wax_tbl[] = {
129  	{ HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008e },
130	{ 0, }
131};
132
133MODULE_DEVICE_TABLE(parisc, wax_tbl);
134
135struct parisc_driver wax_driver = {
136	.name =		"wax",
137	.id_table =	wax_tbl,
138	.probe =	wax_init_chip,
139};