summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJaiprakash Singh <b44839@freescale.com>2014-10-07 05:23:14 (GMT)
committerMatthew Weigel <Matthew.Weigel@freescale.com>2014-12-11 18:38:00 (GMT)
commitcd11c0ec055a21def103ee75812632e588b5fc0e (patch)
tree57c6148e72db937c48501ba84057b2c9eab0f873 /include/linux
parent6962d5c31cf158ce11a10ea8e4a827e35302c563 (diff)
downloadlinux-fsl-qoriq-cd11c0ec055a21def103ee75812632e588b5fc0e.tar.xz
IFC: Change IO accessor based on endianness
IFC registers can be of type Little Endian or big Endian depending upon Freescale SoC. Here SoC defines the register type of IFC IP.So update accessors functions with common IFC accessors functions to take care both type of endianness. IFC IO accressor are set at run time based on IFC IP registers endianness.IFC node in DTS file contains information about endianness. Signed-off-by: Jaiprakash Singh <b44839@freescale.com> --- This patch is under reviewing at url - https://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg741449.html Change-Id: Ib6d4669a94afa50e71ce522a008232fa21b0bc19 Reviewed-on: http://git.am.freescale.net:8181/20971 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Prabhakar Kushwaha <prabhakar@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/fsl_ifc.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/linux/fsl_ifc.h b/include/linux/fsl_ifc.h
index e06473b..3833238 100644
--- a/include/linux/fsl_ifc.h
+++ b/include/linux/fsl_ifc.h
@@ -832,6 +832,7 @@ struct fsl_ifc_ctrl {
u32 nand_stat;
wait_queue_head_t nand_wait;
+ bool little_endian;
#ifdef CONFIG_PM_SLEEP
/* save regs when system go to deep-sleep */
struct fsl_ifc_regs *saved_regs;
@@ -840,5 +841,46 @@ struct fsl_ifc_ctrl {
extern struct fsl_ifc_ctrl *fsl_ifc_ctrl_dev;
+static inline u32 ifc_in32(void __iomem *addr)
+{
+ if (fsl_ifc_ctrl_dev->little_endian)
+ return ioread32(addr);
+ else
+ return ioread32be(addr);
+}
+
+static inline u16 ifc_in16(void __iomem *addr)
+{
+ if (fsl_ifc_ctrl_dev->little_endian)
+ return ioread16(addr);
+ else
+ return ioread16be(addr);
+}
+
+static inline u8 ifc_in8(void __iomem *addr)
+{
+ return ioread8(addr);
+}
+
+static inline void ifc_out32(u32 val, void __iomem *addr)
+{
+ if (fsl_ifc_ctrl_dev->little_endian)
+ return iowrite32(val, addr);
+ else
+ return iowrite32be(val, addr);
+}
+
+static inline void ifc_out16(u16 val, void __iomem *addr)
+{
+ if (fsl_ifc_ctrl_dev->little_endian)
+ return iowrite16(val, addr);
+ else
+ return iowrite16be(val, addr);
+}
+
+static inline void ifc_out8(u8 val, void __iomem *addr)
+{
+ return iowrite8(val, addr);
+}
#endif /* __ASM_FSL_IFC_H */