[U-Boot] [PATCH v1 1/4] arm, imx6: add mxc_iomux_set_gpr_register function

Heiko Schocher hs at denx.de
Wed May 28 12:16:14 CEST 2014


add mxc_iomux_set_gpr_register fucntion

Signed-off-by: Heiko Schocher <hs at denx.de>
Cc: Stefano Babic <sbabic at denx.de>
---
 arch/arm/imx-common/iomux-v3.c             | 15 +++++++++++++++
 arch/arm/include/asm/imx-common/iomux-v3.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/arch/arm/imx-common/iomux-v3.c b/arch/arm/imx-common/iomux-v3.c
index 6e46ea8..8739b4c 100644
--- a/arch/arm/imx-common/iomux-v3.c
+++ b/arch/arm/imx-common/iomux-v3.c
@@ -63,3 +63,18 @@ void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list,
 	for (i = 0; i < count; i++)
 		imx_iomux_v3_setup_pad(*p++);
 }
+
+void mxc_iomux_set_gpr_register(int group, int start_bit, int num_bits,
+				int value)
+{
+	int i = 0;
+	u32 reg;
+	reg = __raw_readl(base + group * 4);
+	while (num_bits) {
+		reg &= ~(1<<(start_bit + i));
+		i++;
+		num_bits--;
+	}
+	reg |= (value << start_bit);
+	__raw_writel(reg, base + group * 4);
+}
diff --git a/arch/arm/include/asm/imx-common/iomux-v3.h b/arch/arm/include/asm/imx-common/iomux-v3.h
index cca920b..4c83617 100644
--- a/arch/arm/include/asm/imx-common/iomux-v3.h
+++ b/arch/arm/include/asm/imx-common/iomux-v3.h
@@ -174,5 +174,7 @@ typedef u64 iomux_v3_cfg_t;
 void imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad);
 void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list,
 				     unsigned count);
+void mxc_iomux_set_gpr_register(int group, int start_bit, int num_bits,
+				int value);
 
 #endif	/* __MACH_IOMUX_V3_H__*/
-- 
1.8.3.1



More information about the U-Boot mailing list