[parisc-linux-cvs] [PATCH] Add the hppc bus driver.

Ryan Bradetich rbradetich@uswest.net
14 Nov 2002 23:42:57 -0700


--=-ZPyr2sf3U4ylNKFzKbJ2
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Add preliminary support for the hppb bus driver.

- Ryan




--=-ZPyr2sf3U4ylNKFzKbJ2
Content-Disposition: attachment; filename=hppb.diff
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-patch; name=hppb.diff; charset=ISO-8859-1

Index: Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/linux-2.5/Makefile,v
retrieving revision 1.41
diff -u -p -r1.41 Makefile
--- Makefile	15 Nov 2002 06:37:28 -0000	1.41
+++ Makefile	15 Nov 2002 06:39:40 -0000
@@ -1,7 +1,7 @@
 VERSION =3D 2
 PATCHLEVEL =3D 5
 SUBLEVEL =3D 47
-EXTRAVERSION =3D -pa2
+EXTRAVERSION =3D -pa3
=20
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
Index: arch/parisc/kernel/setup.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/linux-2.5/arch/parisc/kernel/setup.c,v
retrieving revision 1.9
diff -u -p -r1.9 setup.c
--- arch/parisc/kernel/setup.c	5 Nov 2002 22:16:49 -0000	1.9
+++ arch/parisc/kernel/setup.c	15 Nov 2002 06:39:40 -0000
@@ -270,6 +270,7 @@ int __init parisc_init_resources(void)
 extern void gsc_init(void);
 extern void processor_init(void);
 extern void ccio_init(void);
+extern void hppb_init(void);
 extern void dino_init(void);
 extern void iosapic_init(void);
 extern void lba_init(void);
@@ -321,6 +322,11 @@ static int __init parisc_init(void)
 #ifdef CONFIG_EISA
 	eisa_init();
 #endif
+
+#if defined(CONFIG_HPPB)
+	hppb_init();
+#endif
+
 #if defined(CONFIG_GSC_DINO)
 	dino_init();
 #endif
Index: drivers/parisc/Kconfig
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/linux-2.5/drivers/parisc/Kconfig,v
retrieving revision 1.9
diff -u -p -r1.9 Kconfig
--- drivers/parisc/Kconfig	11 Nov 2002 18:37:16 -0000	1.9
+++ drivers/parisc/Kconfig	15 Nov 2002 06:39:40 -0000
@@ -10,6 +10,13 @@ config GSC
 	  are not found in B1000, C3000, J5000, A500, L1000, N4000 and upwards.
 	  If in doubt, say "Y".
=20
+config HPPB
+	bool "HP-PB bus support"
+	depends on GSC
+	help
+	  The HP-PB bus was used in the Nova class and K-class servers.
+	  If in doubt, say "Y"
+
 config IOMMU_CCIO
 	bool "U2/Uturn I/O MMU"
 	depends on GSC
Index: drivers/parisc/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/linux-2.5/drivers/parisc/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- drivers/parisc/Makefile	3 Nov 2002 03:24:59 -0000	1.9
+++ drivers/parisc/Makefile	15 Nov 2002 06:39:40 -0000
@@ -23,3 +23,4 @@ obj-$(CONFIG_IOMMU_SBA) +=3D sba_iommu.o
 # obj-$(CONFIG_IOMMU_CCIO) +=3D ccio-rm-dma.o
 obj-$(CONFIG_IOMMU_CCIO) +=3D ccio-dma.o
 obj-$(CONFIG_CHASSIS_LCD_LED) +=3D led.o
+obj-$(CONFIG_HPPB) +=3D hppb.o
Index: drivers/parisc/hppb.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: drivers/parisc/hppb.c
diff -N drivers/parisc/hppb.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ drivers/parisc/hppb.c	15 Nov 2002 06:39:40 -0000
@@ -0,0 +1,108 @@
+/*
+** hppb.c:
+**      HP-PB bus driver for the NOVA and K-Class systems.
+**
+**      (c) Copyright 2002 Ryan Bradetich
+**      (c) Copyright 2002 Hewlett-Packard Company
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This Driver currently only supports the console (port 0) on the MUX.
+** Additional work will be needed on this driver to enable the full
+** functionality of the MUX.
+**
+*/
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/init.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
+#include <linux/ioport.h>
+
+#include <asm/io.h>
+#include <asm/hardware.h>
+#include <asm/pci.h>
+
+struct hppb_card {
+	unsigned long hpa;
+	struct resource mmio_region;
+	struct hppb_card *next;
+};
+
+struct hppb_card hppb_card_head =3D {
+	.hpa =3D 0,
+	.next =3D NULL,
+};
+
+#define IO_IO_LOW  offsetof(struct bc_module, io_io_low)
+#define IO_IO_HIGH offsetof(struct bc_module, io_io_high)
+
+/**
+ * hppb_probe - Determine if the hppb driver should claim this device.
+ * @dev: The device which has been found
+ *
+ * Determine if hppb driver should claim this chip (return 0) or not=20
+ * (return 1). If so, initialize the chip and tell other partners in crime=
=20
+ * they have work to do.
+ */
+static int hppb_probe(struct parisc_device *dev)
+{
+	int status;
+	struct hppb_card *card =3D &hppb_card_head;
+
+	while(card->next) {
+		card =3D card->next;
+	}
+
+	if(card->hpa) {
+		card->next =3D kmalloc(sizeof(struct hppb_card), GFP_KERNEL);
+		if(!card->next) {
+			printk(KERN_ERR "HP-PB: Unable to allocate memory.\n");
+			return 1;
+		}
+		memset(card->next, '\0', sizeof(struct hppb_card));
+		card =3D card->next;
+	}
+        printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa);
+
+	card->hpa =3D dev->hpa;
+	card->mmio_region.name =3D "HP-PB Bus";
+	card->mmio_region.flags =3D IORESOURCE_MEM;
+
+	card->mmio_region.start =3D __raw_readl(dev->hpa + IO_IO_LOW);
+	card->mmio_region.end =3D __raw_readl(dev->hpa + IO_IO_HIGH) - 1;
+
+	status =3D ccio_request_resource(dev, &card->mmio_region);
+	if(status < 0) {
+		printk(KERN_ERR "%s: failed to claim HP-PB bus space (%08lx, %08lx)\n",
+			__FILE__, card->mmio_region.start, card->mmio_region.end);
+	}
+
+        return 0;
+}
+
+
+static struct parisc_device_id hppb_tbl[] =3D {
+        { HPHW_BCPORT, HVERSION_REV_ANY_ID, 0x500, 0xc },=20
+        { 0, }
+};
+
+static struct parisc_driver hppb_driver =3D {
+        .name =3D         "Gecko Boa",
+        .id_table =3D     hppb_tbl,
+        .probe =3D        hppb_probe,
+};
+
+/**
+ * hppb_init - HP-PB bus initalization procedure.
+ *
+ * Register this driver.  =20
+ */
+void __init hppb_init(void)
+{
+        register_parisc_driver(&hppb_driver);
+}

--=-ZPyr2sf3U4ylNKFzKbJ2--