GPIO: xilinx: Use __raw_readl/__raw_writel IO functions
authorMichal Simek <michal.simek@xilinx.com>
Mon, 3 Jun 2013 12:31:18 +0000 (14:31 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 17 Jun 2013 05:46:18 +0000 (07:46 +0200)
This driver can be used on Xilinx ARM Zynq platform
where in_be32/out_be32 functions are not implemented.
Use __raw_readl/__raw_writel functions which are
implemented on Microblaze and PowerPC.
For ARM readl/writel functions are used instead.

The correct way how to implement this is to detect
endians directly on IP. But for the gpio case
without interrupt connected(it means without
interrupt logic) there are just 2 registers
data and tristate where auto detection can't be done.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-xilinx.c

index 626eaa876f093821565a5884fe4d6bbbd321eac3..791ddaedbfb42ce58de16426e4ea5372fae8f089 100644 (file)
 #define XGPIO_CHANNEL_OFFSET   0x8
 
 /* Read/Write access to the GPIO registers */
-#define xgpio_readreg(offset)          in_be32(offset)
-#define xgpio_writereg(offset, val)    out_be32(offset, val)
+#ifdef CONFIG_ARCH_ZYNQ
+# define xgpio_readreg(offset)         readl(offset)
+# define xgpio_writereg(offset, val)   writel(val, offset)
+#else
+# define xgpio_readreg(offset)         __raw_readl(offset)
+# define xgpio_writereg(offset, val)   __raw_writel(val, offset)
+#endif
 
 /**
  * struct xgpio_instance - Stores information about GPIO device