diff options
author | Lothar Waßmann <LW@KARO-electronics.de> | 2010-11-22 03:39:51 -0500 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-12-15 06:42:49 -0500 |
commit | 96f3e2568456402769f3998e111746941f549dc6 (patch) | |
tree | 20b942c2881fcb43254c48c328b9b1e599c8565f /arch/arm/plat-mxc/iomux-v3.c | |
parent | 28a4f908acb342350b9ecbfcdf0a999cb83e05aa (diff) |
MXC IOMUX-V3 replace struct pad_desc with bitmapped cookie (step 2)
This patch actually replaces the 'struct pad_desc' with a u64 cookie
to facilitate adding platform specific pad_ctrl settings to an
existing pad definition.
So, instead of:
iomux_v3_cfg_t power_key = MX51_PAD_EIM_A27__GPIO_2_21;
power_key.pad_ctrl = MX51_GPIO_PAD_CTRL_2;
mxc_iomux_v3_setup_pad(&power_key);
one can write:
mxc_iomux_v3_setup_pad((MX51_PAD_EIM_A27__GPIO_2_21 & ~MUX_PAD_CTRL_MASK) | MX51_GPIO_PAD_CTRL_2);
Patch applies to branch 'imx-for-2.6.38' of git://git.pengutronix.de/git/imx/linux-2.6
Signed-Off-By: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/plat-mxc/iomux-v3.c')
-rw-r--r-- | arch/arm/plat-mxc/iomux-v3.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/arch/arm/plat-mxc/iomux-v3.c b/arch/arm/plat-mxc/iomux-v3.c index 4cbbf2c6ea74..99a9cdb9d6be 100644 --- a/arch/arm/plat-mxc/iomux-v3.c +++ b/arch/arm/plat-mxc/iomux-v3.c | |||
@@ -34,17 +34,24 @@ static void __iomem *base; | |||
34 | /* | 34 | /* |
35 | * configures a single pad in the iomuxer | 35 | * configures a single pad in the iomuxer |
36 | */ | 36 | */ |
37 | int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t *pad) | 37 | int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t pad) |
38 | { | 38 | { |
39 | if (MUX_CTRL_OFS(pad)) | 39 | u32 mux_ctrl_ofs = (pad & MUX_CTRL_OFS_MASK) >> MUX_CTRL_OFS_SHIFT; |
40 | __raw_writel(MUX_MODE(pad), base + MUX_CTRL_OFS(pad)); | 40 | u32 mux_mode = (pad & MUX_MODE_MASK) >> MUX_MODE_SHIFT; |
41 | u32 sel_input_ofs = (pad & MUX_SEL_INPUT_OFS_MASK) >> MUX_SEL_INPUT_OFS_SHIFT; | ||
42 | u32 sel_input = (pad & MUX_SEL_INPUT_MASK) >> MUX_SEL_INPUT_SHIFT; | ||
43 | u32 pad_ctrl_ofs = (pad & MUX_PAD_CTRL_OFS_MASK) >> MUX_PAD_CTRL_OFS_SHIFT; | ||
44 | u32 pad_ctrl = (pad & MUX_PAD_CTRL_MASK) >> MUX_PAD_CTRL_SHIFT; | ||
41 | 45 | ||
42 | if (MUX_SELECT_INPUT_OFS(pad)) | 46 | if (mux_ctrl_ofs) |
43 | __raw_writel(MUX_SELECT_INPUT(pad), | 47 | __raw_writel(mux_mode, base + mux_ctrl_ofs); |
44 | base + MUX_SELECT_INPUT_OFS(pad)); | 48 | |
49 | if (sel_input_ofs) | ||
50 | __raw_writel(sel_input, base + sel_input_ofs); | ||
51 | |||
52 | if (!(pad_ctrl & NO_PAD_CTRL) && pad_ctrl_ofs) | ||
53 | __raw_writel(pad_ctrl, base + pad_ctrl_ofs); | ||
45 | 54 | ||
46 | if (!(MUX_PAD_CTRL(pad) & NO_PAD_CTRL) && MUX_PAD_CTRL_OFS(pad)) | ||
47 | __raw_writel(MUX_PAD_CTRL(pad), base + MUX_PAD_CTRL_OFS(pad)); | ||
48 | return 0; | 55 | return 0; |
49 | } | 56 | } |
50 | EXPORT_SYMBOL(mxc_iomux_v3_setup_pad); | 57 | EXPORT_SYMBOL(mxc_iomux_v3_setup_pad); |
@@ -56,7 +63,7 @@ int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count) | |||
56 | int ret; | 63 | int ret; |
57 | 64 | ||
58 | for (i = 0; i < count; i++) { | 65 | for (i = 0; i < count; i++) { |
59 | ret = mxc_iomux_v3_setup_pad(p); | 66 | ret = mxc_iomux_v3_setup_pad(*p); |
60 | if (ret) | 67 | if (ret) |
61 | return ret; | 68 | return ret; |
62 | p++; | 69 | p++; |