Skip to contentSkip to conversation

Fix FRV PCI config space write

PATCH New David Howells 1 participant 1 message Nov 23, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix FRV PCI config space write

The attached patch makes byte and word writes to PCI config space work. The problem was that the pointer to the appropriate chunk of the config port needs to be juggled to allow for the fact that FRV is big endian in this case.

---
warthog>diffstat pci-write-2610rc2mm3.diff

 pci-vdk.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
arch/frv/mb93090-mb00/pci-vdk.c renamed from warthog/kernels/linux-2.6.10-rc2-mm3/arch/frv/mb93090-mb00/pci-vdk.c +8 -3
diff -uNr /warthog/kernels/linux-2.6.10-rc2-mm3/arch/frv/mb93090-mb00/pci-vdk.c linux-2.6.10-rc2-mm3-frv/arch/frv/mb93090-mb00/pci-vdk.c
@@ -44,9 +44,14 @@
 #define __get_PciCfgDataW(A) readw((volatile void __iomem *) __region_CS1 + 0x88 + ((A) & 2))
 #define __get_PciCfgDataL(A) readl((volatile void __iomem *) __region_CS1 + 0x88)
 
-#define __set_PciCfgDataB(A,V) writeb((V), (volatile void __iomem *) __region_CS1 + 0x88 + ((A) & 3))
-#define __set_PciCfgDataW(A,V) writew((V), (volatile void __iomem *) __region_CS1 + 0x88 + ((A) & 2))
-#define __set_PciCfgDataL(A,V) writel((V), (volatile void __iomem *) __region_CS1 + 0x88)
+#define __set_PciCfgDataB(A,V) \
+	writeb((V), (volatile void __iomem *) __region_CS1 + 0x88 + (3 - ((A) & 3)))
+
+#define __set_PciCfgDataW(A,V) \
+	writew((V), (volatile void __iomem *) __region_CS1 + 0x88 + (2 - ((A) & 2)))
+
+#define __set_PciCfgDataL(A,V) \
+	writel((V), (volatile void __iomem *) __region_CS1 + 0x88)
 
 #define __get_PciBridgeDataB(A) readb((volatile void __iomem *) __region_CS1 + 0x800 + (A))
 #define __get_PciBridgeDataW(A) readw((volatile void __iomem *) __region_CS1 + 0x800 + (A))