diff options
author | Lothar Waßmann <LW@KARO-electronics.de> | 2010-10-26 14:28:31 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-11-24 09:56:58 +0100 |
commit | 8f5260c8c1a1f9b25dfedd5ca749e4faef1b3eb9 (patch) | |
tree | 56f3a67b1cf74a670c026ab14cc872cf3accccb8 /arch/arm/plat-mxc | |
parent | 2a85927c79634e89b9cd683dd2bae65966d9b216 (diff) | |
download | linux-8f5260c8c1a1f9b25dfedd5ca749e4faef1b3eb9.tar.gz linux-8f5260c8c1a1f9b25dfedd5ca749e4faef1b3eb9.tar.bz2 linux-8f5260c8c1a1f9b25dfedd5ca749e4faef1b3eb9.zip |
ARM: i.MX IOMUX-V3 replace struct pad_desc with bitmapped cookie
The following patch is a first step to convert the 'struct pad_desc'
to a bitmapped cookie to facilitate adding platform specific pullup or
drive strength definitions to existing pad definitions without need to
rewrite the complete pad def.
The patch wraps 'struct pad_desc' in an opaque data type and
introduces macros to access the individual members.
This patch does not constitute any functional change!
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')
-rw-r--r-- | arch/arm/plat-mxc/include/mach/iomux-v3.h | 38 | ||||
-rw-r--r-- | arch/arm/plat-mxc/iomux-v3.c | 22 |
2 files changed, 45 insertions, 15 deletions
diff --git a/arch/arm/plat-mxc/include/mach/iomux-v3.h b/arch/arm/plat-mxc/include/mach/iomux-v3.h index 0880a4a1aed1..811716fbfbe6 100644 --- a/arch/arm/plat-mxc/include/mach/iomux-v3.h +++ b/arch/arm/plat-mxc/include/mach/iomux-v3.h @@ -44,7 +44,7 @@ * */ -struct pad_desc { +typedef struct deprecated_pad_desc { unsigned mux_ctrl_ofs:12; /* IOMUXC_SW_MUX_CTL_PAD offset */ unsigned mux_mode:8; unsigned pad_ctrl_ofs:12; /* IOMUXC_SW_PAD_CTRL offset */ @@ -52,7 +52,37 @@ struct pad_desc { unsigned pad_ctrl:17; unsigned select_input_ofs:12; /* IOMUXC_SELECT_INPUT offset */ unsigned select_input:3; -}; +} iomux_v3_cfg_t; + +static inline unsigned int MUX_CTRL_OFS(iomux_v3_cfg_t *pad) +{ + return pad->mux_ctrl_ofs; +} + +static inline unsigned int MUX_MODE(iomux_v3_cfg_t *pad) +{ + return pad->mux_mode; +} + +static inline unsigned int MUX_SELECT_INPUT_OFS(iomux_v3_cfg_t *pad) +{ + return pad->select_input_ofs; +} + +static inline unsigned int MUX_SELECT_INPUT(iomux_v3_cfg_t *pad) +{ + return pad->select_input; +} + +static inline unsigned int MUX_PAD_CTRL_OFS(iomux_v3_cfg_t *pad) +{ + return pad->pad_ctrl_ofs; +} + +static inline unsigned int MUX_PAD_CTRL(iomux_v3_cfg_t *pad) +{ + return pad->pad_ctrl; +} #define IOMUX_PAD(_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _select_input_ofs, \ _select_input, _pad_ctrl) \ @@ -107,13 +137,13 @@ struct pad_desc { /* * setups a single pad in the iomuxer */ -int mxc_iomux_v3_setup_pad(struct pad_desc *pad); +int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t *pad); /* * setups mutliple pads * convenient way to call the above function with tables */ -int mxc_iomux_v3_setup_multiple_pads(struct pad_desc *pad_list, unsigned count); +int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count); /* * Initialise the iomux controller diff --git a/arch/arm/plat-mxc/iomux-v3.c b/arch/arm/plat-mxc/iomux-v3.c index b318c6a222d5..975ca7cdf9ad 100644 --- a/arch/arm/plat-mxc/iomux-v3.c +++ b/arch/arm/plat-mxc/iomux-v3.c @@ -32,26 +32,26 @@ static void __iomem *base; /* - * setups a single pad in the iomuxer + * configures a single pad in the iomuxer */ -int mxc_iomux_v3_setup_pad(struct pad_desc *pad) +int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t *pad) { - if (pad->mux_ctrl_ofs) - __raw_writel(pad->mux_mode, base + pad->mux_ctrl_ofs); + if (MUX_CTRL_OFS(pad)) + __raw_writel(MUX_MODE(pad), base + MUX_CTRL_OFS(pad)); - if (pad->select_input_ofs) - __raw_writel(pad->select_input, - base + pad->select_input_ofs); + if (MUX_SELECT_INPUT_OFS(pad)) + __raw_writel(MUX_SELECT_INPUT(pad), + base + MUX_SELECT_INPUT(pad)); - if (!(pad->pad_ctrl & NO_PAD_CTRL) && pad->pad_ctrl_ofs) - __raw_writel(pad->pad_ctrl, base + pad->pad_ctrl_ofs); + if (!(MUX_PAD_CTRL(pad) & NO_PAD_CTRL) && MUX_PAD_CTRL_OFS(pad)) + __raw_writel(MUX_PAD_CTRL(pad), base + MUX_PAD_CTRL_OFS(pad)); return 0; } EXPORT_SYMBOL(mxc_iomux_v3_setup_pad); -int mxc_iomux_v3_setup_multiple_pads(struct pad_desc *pad_list, unsigned count) +int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count) { - struct pad_desc *p = pad_list; + iomux_v3_cfg_t *p = pad_list; int i; int ret; |