|
@@ -136,3 +136,72 @@ static inline void __indirect_writesl(volatile void __iomem *bus_addr,
|
|
|
|
|
|
static inline unsigned char __indirect_readb(const volatile void __iomem *p)
|
|
|
{
|
|
|
+ u32 addr = (u32)p;
|
|
|
+ u32 n, byte_enables, data;
|
|
|
+
|
|
|
+ if (!is_pci_memory(addr))
|
|
|
+ return __raw_readb(addr);
|
|
|
+
|
|
|
+ n = addr % 4;
|
|
|
+ byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL;
|
|
|
+ if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_MEMREAD, &data))
|
|
|
+ return 0xff;
|
|
|
+
|
|
|
+ return data >> (8*n);
|
|
|
+}
|
|
|
+
|
|
|
+static inline void __indirect_readsb(const volatile void __iomem *bus_addr,
|
|
|
+ u8 *vaddr, u32 count)
|
|
|
+{
|
|
|
+ while (count--)
|
|
|
+ *vaddr++ = readb(bus_addr);
|
|
|
+}
|
|
|
+
|
|
|
+static inline unsigned short __indirect_readw(const volatile void __iomem *p)
|
|
|
+{
|
|
|
+ u32 addr = (u32)p;
|
|
|
+ u32 n, byte_enables, data;
|
|
|
+
|
|
|
+ if (!is_pci_memory(addr))
|
|
|
+ return __raw_readw(addr);
|
|
|
+
|
|
|
+ n = addr % 4;
|
|
|
+ byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL;
|
|
|
+ if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_MEMREAD, &data))
|
|
|
+ return 0xffff;
|
|
|
+
|
|
|
+ return data>>(8*n);
|
|
|
+}
|
|
|
+
|
|
|
+static inline void __indirect_readsw(const volatile void __iomem *bus_addr,
|
|
|
+ u16 *vaddr, u32 count)
|
|
|
+{
|
|
|
+ while (count--)
|
|
|
+ *vaddr++ = readw(bus_addr);
|
|
|
+}
|
|
|
+
|
|
|
+static inline unsigned long __indirect_readl(const volatile void __iomem *p)
|
|
|
+{
|
|
|
+ u32 addr = (__force u32)p;
|
|
|
+ u32 data;
|
|
|
+
|
|
|
+ if (!is_pci_memory(addr))
|
|
|
+ return __raw_readl(p);
|
|
|
+
|
|
|
+ if (ixp4xx_pci_read(addr, NP_CMD_MEMREAD, &data))
|
|
|
+ return 0xffffffff;
|
|
|
+
|
|
|
+ return data;
|
|
|
+}
|
|
|
+
|
|
|
+static inline void __indirect_readsl(const volatile void __iomem *bus_addr,
|
|
|
+ u32 *vaddr, u32 count)
|
|
|
+{
|
|
|
+ while (count--)
|
|
|
+ *vaddr++ = readl(bus_addr);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/*
|
|
|
+ * We can use the built-in functions b/c they end up calling writeb/readb
|
|
|
+ */
|