patch-2.4.0-test9 linux/include/asm-arm/arch-sa1100/ide.h

Next file: linux/include/asm-arm/arch-sa1100/memory.h
Previous file: linux/include/asm-arm/arch-sa1100/hardware.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-sa1100/ide.h linux/include/asm-arm/arch-sa1100/ide.h
@@ -3,14 +3,22 @@
  *
  * Copyright (c) 1998 Hugo Fiennes & Nicolas Pitre
  *
+ * 18-aug-2000: Cleanup by Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
+ *              Get rid of the special ide_init_hwif_ports() functions
+ *              and make a generalised function that can be used by all
+ *              architectures.
  */
 
 #include <linux/config.h>
-
 #include <asm/irq.h>
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
 
+
+#define PCMCIA_IO_0_BASE 0xe0000000
+#define PCMCIA_IO_1_BASE 0xe4000000
+
+
 /*
  * Set up a hw structure for a specified data port, control port and IRQ.
  * This should follow whatever the default interface uses.
@@ -20,47 +28,33 @@
 {
 	ide_ioreg_t reg;
 	int i;
-	int ioshift = 0;
-
+	int regincr = 1;
+	
 	/* The Empeg board has the first two address lines unused */
 	if (machine_is_empeg())
-		ioshift = 2;
-	
+		regincr = 1 << 2;
+
+	/* The LART doesn't use A0 for IDE */
+	if (machine_is_lart())
+		regincr = 1 << 1;
+
 	memset(hw, 0, sizeof(*hw));
 
-	reg = (ide_ioreg_t) (data_port << ioshift);
+	reg = (ide_ioreg_t)data_port;
+
 	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
 		hw->io_ports[i] = reg;
-		reg += (1 << ioshift);
+		reg += regincr;
 	}
 	
-	hw->io_ports[IDE_CONTROL_OFFSET] = 
-		(ide_ioreg_t) (ctrl_port << ioshift);
+	hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port;
 	
 	if (irq)
 		*irq = 0;
 }
 
-/*
- * Special case for the empeg board which has the first two 
- * address lines unused 
- */
-static __inline__ void
-empeg_ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port)
-{
-	ide_ioreg_t reg;
-	int i;
 
-	memset(hw, 0, sizeof(*hw));
 
-	reg = (ide_ioreg_t) (0xe0000000 + (data_port << 2));
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-		hw->io_ports[i] = reg;
-		reg += (1 << 2);
-	}
-	hw->io_ports[IDE_CONTROL_OFFSET] = 
-		(ide_ioreg_t) (0xe0000000 + (ctrl_port << 2));
-}
 
 /*
  * This registers the standard ports for this architecture with the IDE
@@ -92,10 +86,10 @@
 	/* MAC 23/4/1999, swap these round so that the left hand
 	   hard disk is hda when viewed from the front. This
 	   doesn't match the silkscreen however. */
-	empeg_ide_init_hwif_ports(&hw,0x10,0x1e);
+	ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x40, PCMCIA_IO_0_BASE + 0x78, NULL);
 	hw.irq = EMPEG_IRQ_IDE2;
 	ide_register_hw(&hw, NULL);
-	empeg_ide_init_hwif_ports(&hw,0x00,0x0e);
+	ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x00, PCMCIA_IO_0_BASE + 0x38, NULL);
 	hw.irq = ,EMPEG_IRQ_IDE1;
 	ide_register_hw(&hw, NULL);
 #endif
@@ -112,7 +106,7 @@
 	/* set the pcmcia interface timing */
 	MECR = 0x00060006;
 
-	ide_init_hwif_ports(&hw, 0xe00001f0, 0xe00003f6, NULL);
+	ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x1f0, PCMCIA_IO_0_BASE + 0x3f6, NULL);
 	hw.irq = IRQ_GPIO7;
 	ide_register_hw(&hw, NULL);
 #endif
@@ -129,8 +123,7 @@
         MECR = 0x00060006;
 
         /* init the interface */
-/*         ide_init_hwif_ports(&hw, 0xe00000000, 0xe00001000, NULL); */
-        ide_init_hwif_ports(&hw, 0xe00001000, 0xe00000000, NULL);
+	ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x0000, PCMCIA_IO_0_BASE + 0x1000, NULL);
         hw.irq = IRQ_GPIO1;
         ide_register_hw(&hw, NULL);
 #endif

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