aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Chen <jason.chen@linaro.org>2011-12-21 15:23:45 +0800
committerEric Miao <eric.miao@linaro.org>2012-01-11 21:38:21 +0800
commite1118486d6e7aded49c223730690bfa0f7beb1bd (patch)
tree166748333fbb454f6a6cd41a67b191ba5d79f8b0
parent49dc67c3156e74cc86402a7c8aad2af73383f158 (diff)
downloadlinux-linaro-e1118486d6e7aded49c223730690bfa0f7beb1bd.tar.gz
iomux: add and export mxc_iomux_set_gpr_register()
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-v3.h4
-rw-r--r--arch/arm/plat-mxc/iomux-v3.c17
2 files changed, 20 insertions, 1 deletions
diff --git a/arch/arm/plat-mxc/include/mach/iomux-v3.h b/arch/arm/plat-mxc/include/mach/iomux-v3.h
index d41a070a1ed..2606b95c42c 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-v3.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-v3.h
@@ -168,5 +168,9 @@ int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count);
*/
void mxc_iomux_v3_init(void __iomem *iomux_v3_base);
+/*
+ * Set bits for general purpose registers
+ */
+void mxc_iomux_set_gpr_register(int group, int start_bit, int num_bits, int value);
#endif /* __MACH_IOMUX_V3_H__*/
diff --git a/arch/arm/plat-mxc/iomux-v3.c b/arch/arm/plat-mxc/iomux-v3.c
index 99a9cdb9d6b..f7bc8718684 100644
--- a/arch/arm/plat-mxc/iomux-v3.c
+++ b/arch/arm/plat-mxc/iomux-v3.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2004-2011 Freescale Semiconductor, Inc.
* Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
* Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH,
* <armlinux@phytec.de>
@@ -72,6 +72,21 @@ int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count)
}
EXPORT_SYMBOL(mxc_iomux_v3_setup_multiple_pads);
+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);
+}
+EXPORT_SYMBOL(mxc_iomux_set_gpr_register);
+
void mxc_iomux_v3_init(void __iomem *iomux_v3_base)
{
base = iomux_v3_base;