IXP4xx: Goramo MultiLink now uses generic IXP4xx PCI access routines.

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 3dcf479..ea1933d 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -224,7 +224,7 @@
 	return 0xffffffff;
 }
 
-static int ixp4xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value)
+int ixp4xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value)
 {
 	u32 n, byte_enables, addr, data;
 	u8 bus_num = bus->number;
@@ -247,7 +247,7 @@
 	return PCIBIOS_SUCCESSFUL;
 }
 
-static int ixp4xx_pci_write_config(struct pci_bus *bus,  unsigned int devfn, int where, int size, u32 value)
+int ixp4xx_pci_write_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
 {
 	u32 n, byte_enables, addr, data;
 	u8 bus_num = bus->number;
diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c
index 88231d8..7d2d138 100644
--- a/arch/arm/mach-ixp4xx/goramo_mlr.c
+++ b/arch/arm/mach-ixp4xx/goramo_mlr.c
@@ -662,27 +662,6 @@
 
 static u8 cs5536_slave_irq_mask = 0xFF; /* IDE and USB only */
 
-static u32 byte_lane_enable_bits(u32 n, int size)
-{
-	if (size == 1)
-		return (0xF & ~BIT(n)) << 4;
-	if (size == 2)
-		return (0xF & ~(BIT(n) | BIT(n + 1))) << 4;
-	if (size == 4)
-		return 0;
-	return 0xFFFFFFFF;
-}
-
-static u32 ixp4xx_config_addr(u8 bus_num, u16 devfn, int where)
-{
-	if (!bus_num)		/* type 0 */
-		return BIT(32 - PCI_SLOT(devfn)) | ((PCI_FUNC(devfn)) << 8) |
-			(where & ~3);
-	else			/* type 1 */
-		return (bus_num << 16) | ((PCI_SLOT(devfn)) << 11) |
-			((PCI_FUNC(devfn)) << 8) | (where & ~3) | 1;
-}
-
 static u32 msr_id(u32 msr)
 {
 	return ((msr << 9) & 0xFF800000) | (msr & 0x3FFF);
@@ -1134,48 +1113,21 @@
 static int gmlr_pci_read_config(struct pci_bus *bus, unsigned int devfn,
 				int where, int size, u32 *value)
 {
-	u32 n, byte_enables, addr, data;
-	u8 bus_num = bus->number;
-
-	if (bus_num == 0 && PCI_SLOT(devfn) == SLOT_CS5536 &&
+	if (!bus->number && PCI_SLOT(devfn) == SLOT_CS5536 &&
 	    (PCI_FUNC(devfn) != DEV_CS5536_SB || where < 0x10))
 		return cs5536_pci_read(devfn, where, size, value);
 
-	*value = 0xFFFFFFFF;
-	n = where % 4;
-	byte_enables = byte_lane_enable_bits(n, size);
-	if (byte_enables == 0xffffffff)
-		return PCIBIOS_BAD_REGISTER_NUMBER;
-
-	addr = ixp4xx_config_addr(bus_num, devfn, where);
-	if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_CONFIGREAD, &data))
-		return PCIBIOS_DEVICE_NOT_FOUND;
-
-	*value = (data >> (8 * n)) & bytemask[size];
-	return PCIBIOS_SUCCESSFUL;
+	return ixp4xx_pci_read_config(bus, devfn, where, size, value);
 }
 
 static int gmlr_pci_write_config(struct pci_bus *bus, unsigned int devfn,
 				 int where, int size, u32 value)
 {
-	u32 n, byte_enables, addr, data;
-	u8 bus_num = bus->number;
-
-	if (bus_num == 0 && PCI_SLOT(devfn) == SLOT_CS5536 &&
+	if (!bus->number && PCI_SLOT(devfn) == SLOT_CS5536 &&
 	    (PCI_FUNC(devfn) != DEV_CS5536_SB || where < 0x10))
 		return cs5536_pci_write(devfn, where, size, value);
 
-	n = where % 4;
-	byte_enables = byte_lane_enable_bits(n, size);
-	if (byte_enables == 0xFFFFFFFF)
-		return PCIBIOS_BAD_REGISTER_NUMBER;
-
-	addr = ixp4xx_config_addr(bus_num, devfn, where);
-	data = value << (8 * n);
-	if (ixp4xx_pci_write(addr, byte_enables | NP_CMD_CONFIGWRITE, data))
-		return PCIBIOS_DEVICE_NOT_FOUND;
-
-	return PCIBIOS_SUCCESSFUL;
+	return ixp4xx_pci_write_config(bus, devfn, where, size, value);
 }
 
 struct pci_ops gmlr_ops = {
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h
index b49c3ab..5a39e5f 100644
--- a/arch/arm/mach-ixp4xx/include/mach/io.h
+++ b/arch/arm/mach-ixp4xx/include/mach/io.h
@@ -20,7 +20,8 @@
 
 extern int ixp4xx_pci_read(u32 addr, u32 cmd, u32* data);
 extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
-
+int ixp4xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value);
+int ixp4xx_pci_write_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value);
 
 /*
  * IXP4xx provides two methods of accessing PCI memory space: