[parisc-linux-cvs] hil cleanup
Matthew Wilcox
willy@ldl.fc.hp.com
Mon, 27 Aug 2001 19:18:32 -0600
* Simplify the hil_foo() macros a little.
* Move the contents of drivers/gsc/hil.c into drivers/char/hilkbd.c
* Move hil_base & hil_irq from hil.h to hilkbd.c.
Index: include/asm-parisc/hil.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/hil.h,v
retrieving revision 1.4
diff -u -p -r1.4 hil.h
--- include/asm-parisc/hil.h 2000/07/12 12:50:42 1.4
+++ include/asm-parisc/hil.h 2001/08/28 00:42:34
@@ -7,10 +7,7 @@
* (c) 1999 Matthew Wilcox
*/
-extern unsigned long hil_base; /* declared in drivers/gsc/hil.c */
-extern unsigned int hil_irq;
-
-#define HILBASE hil_base /* 0xf0821000 (old) or 0xf0201000 (new) */
+#define HILBASE hil_base
#define HIL_DATA 0x800
#define HIL_CMD 0x801
@@ -18,9 +15,9 @@ extern unsigned int hil_irq;
#define hil_busy() (gsc_readb(HILBASE + HIL_CMD) & HIL_BUSY)
#define hil_data_available() (gsc_readb(HILBASE + HIL_CMD) & HIL_DATA_RDY)
-#define hil_status() (gsc_readb(HILBASE + HIL_CMD))
-#define hil_command(x) do { gsc_writeb((x), HILBASE + HIL_CMD); } while (0)
-#define hil_read_data() (gsc_readb(HILBASE + HIL_DATA))
-#define hil_write_data(x) do { gsc_writeb((x), HILBASE + HIL_DATA); } while (0)
+#define hil_status() gsc_readb(HILBASE + HIL_CMD)
+#define hil_command(x) gsc_writeb((x), HILBASE + HIL_CMD)
+#define hil_read_data() gsc_readb(HILBASE + HIL_DATA)
+#define hil_write_data(x) gsc_writeb((x), HILBASE + HIL_DATA)
#endif
Index: drivers/char/hilkbd.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/char/hilkbd.c,v
retrieving revision 1.11
diff -u -p -r1.11 hilkbd.c
--- drivers/char/hilkbd.c 2001/07/08 18:16:58 1.11
+++ drivers/char/hilkbd.c 2001/08/28 00:42:34
@@ -8,6 +8,8 @@
* on the HP300 series and some of the HP700 series machines.
*/
+#include <linux/errno.h>
+#include <linux/types.h>
#include <linux/stddef.h>
#include <linux/kernel.h>
#include <linux/sched.h>
@@ -16,19 +18,27 @@
#include <linux/kbd_ll.h>
#include <linux/ioport.h>
#include <linux/config.h>
-#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/interrupt.h>
+
#include <asm/io.h>
#include <asm/ptrace.h>
#include <asm/irq.h>
#include <asm/system.h>
#include <asm/gsc.h>
+#include <asm/hardware.h>
+#include "../gsc/busdevice.h"
#if defined(CONFIG_PARISC)
#include <asm/hil.h> /* HP712/715 (PA-RISC) */
#include <asm/keyboard.h>
+unsigned int hil_base; /* HPA for the HIL device */
+unsigned int hil_irq;
+
#elif defined(CONFIG_HP300)
#define HILBASE 0xf0428000 /* HP300 (m86k) specific */
@@ -423,3 +433,42 @@ int __init hil_keyb_init(void)
return 0;
}
+
+static int __init
+hil_init_chip(struct parisc_device *dev)
+{
+ int irq = busdevice_alloc_irq(dev);
+
+ if (!irq) {
+ printk(__FILE__ ": IRQ not found for HIL at 0x%lx\n", dev->hpa);
+ return -ENODEV;
+ }
+
+ hil_base = dev->hpa;
+ hil_irq = irq;
+
+ printk(KERN_INFO "Found HIL at 0x%x, IRQ %d\n", hil_base, hil_irq);
+
+ return hil_keyb_init();
+}
+
+
+static struct parisc_device_id hil_tbl[] = {
+ { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00073 },
+ { 0, }
+};
+
+MODULE_DEVICE_TABLE(parisc, hil_tbl);
+
+static struct parisc_driver hil_driver = {
+ name: "HIL",
+ id_table: hil_tbl,
+ probe: hil_init_chip,
+};
+
+static int __init hil_init(void)
+{
+ return register_parisc_driver(&hil_driver);
+}
+
+module_init(hil_init);