patch-2.4.20 linux-2.4.20/drivers/parport/parport_gsc.c

Next file: linux-2.4.20/drivers/parport/parport_mfc3.c
Previous file: linux-2.4.20/drivers/parport/init.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.19/drivers/parport/parport_gsc.c linux-2.4.20/drivers/parport/parport_gsc.c
@@ -7,7 +7,7 @@
  *      the Free Software Foundation; either version 2 of the License, or
  *      (at your option) any later version.
  *
- *	by Helge Deller <deller@gmx.de>
+ *	(C) 1999-2001 by Helge Deller <deller@gmx.de>
  *
  * 
  * based on parport_pc.c by 
@@ -36,6 +36,7 @@
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <asm/uaccess.h>
+#include <asm/superio.h>
 
 #include <linux/parport.h>
 #include <asm/gsc.h>
@@ -47,6 +48,7 @@
 MODULE_AUTHOR("Helge Deller <deller@gmx.de>");
 MODULE_DESCRIPTION("HP-PARISC PC-style parallel port driver");
 MODULE_SUPPORTED_DEVICE("integrated PC-style parallel port");
+MODULE_LICENSE("GPL");
 
 
 /*
@@ -347,13 +349,6 @@
 	struct parport tmp;
 	struct parport *p = &tmp;
 
-#if 1
-#warning Take this out when region handling works again, <deller@gmx,de>
-#else
-	if (check_region(base, 3)) 
-	    return NULL;
-#endif
-	    
 	priv = kmalloc (sizeof (struct parport_gsc_private), GFP_KERNEL);
 	if (!priv) {
 		printk (KERN_DEBUG "parport (0x%lx): no memory!\n", base);
@@ -430,12 +425,6 @@
 	printk("]\n");
 	parport_proc_register(p);
 
-	request_region (p->base, 3, p->name);
-	if (p->size > 3)
-		request_region (p->base + 3, p->size - 3, p->name);
-	if (p->modes & PARPORT_MODE_ECP)
-		request_region (p->base_hi, 3, p->name);
-
 	if (p->irq != PARPORT_IRQ_NONE) {
 		if (request_irq (p->irq, parport_gsc_interrupt,
 				 0, p->name, p)) {
@@ -465,62 +454,56 @@
 
 static int __initdata parport_count;
 
-static int __init parport_init_chip(struct hp_device *d, struct pa_iodc_driver *dri)
+static int __devinit parport_init_chip(struct parisc_device *dev)
 {
 	unsigned long port;
-	int irq;
-
-	irq = busdevice_alloc_irq(d); 
 
-	if (!irq) {
-	    printk(KERN_DEBUG "IRQ not found for parallel device at 0x%p\n", d->hpa);
-	    return -ENODEV;
+	if (!dev->irq) {
+		printk("IRQ not found for parallel device at 0x%lx\n", dev->hpa);
+		return -ENODEV;
 	}
 
-	port = ((unsigned long) d->hpa) + PARPORT_GSC_OFFSET;
+	port = dev->hpa + PARPORT_GSC_OFFSET;
 	
-	/* 
-	    some older machines with ASP-chip don't support the enhanced parport modes 
-	*/
-	if (!pdc_add_valid( (void *)(port+4))) {
-	    /* Initialize bidirectional-mode (0x10) & data-tranfer-mode #1 (0x20) */
-	    printk(KERN_DEBUG "%s: initialize bidirectional-mode.\n", __FUNCTION__);
-	    parport_writeb ( (0x10 + 0x20), port + 4);
+	/* some older machines with ASP-chip don't support
+	 * the enhanced parport modes.
+	 */
+	if (boot_cpu_data.cpu_type > pcxt && !pdc_add_valid(port+4)) {
+
+		/* Initialize bidirectional-mode (0x10) & data-tranfer-mode #1 (0x20) */
+		printk("%s: initialize bidirectional-mode.\n", __FUNCTION__);
+		parport_writeb ( (0x10 + 0x20), port + 4);
+
 	} else {
-	    printk(KERN_DEBUG "%s: enhanced parport-modes not supported.\n", __FUNCTION__);
+		printk("%s: enhanced parport-modes not supported.\n", __FUNCTION__);
 	}
 	
-	if (parport_gsc_probe_port(port, 0, 
-		    irq, /* PARPORT_IRQ_NONE */
-		    PARPORT_DMA_NONE, NULL))
-	    parport_count++;
+	if (parport_gsc_probe_port(port, 0, dev->irq,
+			/* PARPORT_IRQ_NONE */ PARPORT_DMA_NONE, NULL))
+		parport_count++;
 
 	return 0;
 }
 
-static struct pa_iodc_driver parport_drivers_for[] __initdata = {
-  {HPHW_FIO, 0x0, 0x0, 0x74, 0x0, 0,			/* 715/64 */
-	DRIVER_CHECK_SVERSION + DRIVER_CHECK_HWTYPE,
-	"parallel device", "HP 7xx - Series", (void *) parport_init_chip},
-  { 0 }
+static struct parisc_device_id parport_tbl[] = {
+	{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x74 },
+	{ 0, }
 };
 
-int __init parport_gsc_init(void)
-{
-	parport_count = 0;
-	
-	register_driver(parport_drivers_for);
-
-	return 0;
-}
+MODULE_DEVICE_TABLE(parisc, parport_tbl);
 
+static struct parisc_driver parport_driver = {
+	name:		"Parallel",
+	id_table:	parport_tbl,
+	probe:		parport_init_chip,
+};
 
-static int __init parport_gsc_init_module(void)
-{	
-	return !parport_gsc_init();
+int __devinit parport_gsc_init(void)
+{
+	return register_parisc_driver(&parport_driver);
 }
 
-static void __exit parport_gsc_exit_module(void)
+static void __devexit parport_gsc_exit(void)
 {
 	struct parport *p = parport_enumerate(), *tmp;
 	while (p) {
@@ -532,11 +515,6 @@
 				free_dma(p->dma);
 			if (p->irq != PARPORT_IRQ_NONE)
 				free_irq(p->irq, p);
-			release_region(p->base, 3);
-			if (p->size > 3)
-				release_region(p->base + 3, p->size - 3);
-			if (p->modes & PARPORT_MODE_ECP)
-				release_region(p->base_hi, 3);
 			parport_proc_unregister(p);
 			if (priv->dma_buf)
 				pci_free_consistent(priv->dev, PAGE_SIZE,
@@ -548,9 +526,10 @@
 		}
 		p = tmp;
 	}
+	unregister_parisc_driver(&parport_driver);
 }
 
 EXPORT_NO_SYMBOLS;
 
-module_init(parport_gsc_init_module);
-module_exit(parport_gsc_exit_module);
+module_init(parport_gsc_init);
+module_exit(parport_gsc_exit);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)