aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-mx3/mach-pcm043.c14
-rw-r--r--arch/arm/mach-mx5/board-mx51_babbage.c12
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-v3.h90
-rw-r--r--arch/arm/plat-mxc/iomux-v3.c25
4 files changed, 66 insertions, 75 deletions
diff --git a/arch/arm/mach-mx3/mach-pcm043.c b/arch/arm/mach-mx3/mach-pcm043.c
index e229a7476f0a..bcf83fc7e701 100644
--- a/arch/arm/mach-mx3/mach-pcm043.c
+++ b/arch/arm/mach-mx3/mach-pcm043.c
@@ -237,7 +237,7 @@ static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
237 return; 237 return;
238 } 238 }
239 239
240 mxc_iomux_v3_setup_pad(&txfs_gpio); 240 mxc_iomux_v3_setup_pad(txfs_gpio);
241 241
242 /* warm reset */ 242 /* warm reset */
243 gpio_direction_output(AC97_GPIO_TXFS, 1); 243 gpio_direction_output(AC97_GPIO_TXFS, 1);
@@ -245,7 +245,7 @@ static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
245 gpio_set_value(AC97_GPIO_TXFS, 0); 245 gpio_set_value(AC97_GPIO_TXFS, 0);
246 246
247 gpio_free(AC97_GPIO_TXFS); 247 gpio_free(AC97_GPIO_TXFS);
248 mxc_iomux_v3_setup_pad(&txfs); 248 mxc_iomux_v3_setup_pad(txfs);
249} 249}
250 250
251static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97) 251static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)
@@ -269,9 +269,9 @@ static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)
269 if (ret) 269 if (ret)
270 goto err3; 270 goto err3;
271 271
272 mxc_iomux_v3_setup_pad(&txfs_gpio); 272 mxc_iomux_v3_setup_pad(txfs_gpio);
273 mxc_iomux_v3_setup_pad(&txd_gpio); 273 mxc_iomux_v3_setup_pad(txd_gpio);
274 mxc_iomux_v3_setup_pad(&reset_gpio); 274 mxc_iomux_v3_setup_pad(reset_gpio);
275 275
276 gpio_direction_output(AC97_GPIO_TXFS, 0); 276 gpio_direction_output(AC97_GPIO_TXFS, 0);
277 gpio_direction_output(AC97_GPIO_TXD, 0); 277 gpio_direction_output(AC97_GPIO_TXD, 0);
@@ -281,8 +281,8 @@ static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)
281 udelay(10); 281 udelay(10);
282 gpio_direction_output(AC97_GPIO_RESET, 1); 282 gpio_direction_output(AC97_GPIO_RESET, 1);
283 283
284 mxc_iomux_v3_setup_pad(&txd); 284 mxc_iomux_v3_setup_pad(txd);
285 mxc_iomux_v3_setup_pad(&txfs); 285 mxc_iomux_v3_setup_pad(txfs);
286 286
287 gpio_free(AC97_GPIO_RESET); 287 gpio_free(AC97_GPIO_RESET);
288err3: 288err3:
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index 368a315e9ace..24e335ca7627 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -193,7 +193,7 @@ static int gpio_usbh1_active(void)
193 int ret; 193 int ret;
194 194
195 /* Set USBH1_STP to GPIO and toggle it */ 195 /* Set USBH1_STP to GPIO and toggle it */
196 mxc_iomux_v3_setup_pad(&usbh1stp_gpio); 196 mxc_iomux_v3_setup_pad(usbh1stp_gpio);
197 ret = gpio_request(BABBAGE_USBH1_STP, "usbh1_stp"); 197 ret = gpio_request(BABBAGE_USBH1_STP, "usbh1_stp");
198 198
199 if (ret) { 199 if (ret) {
@@ -206,7 +206,7 @@ static int gpio_usbh1_active(void)
206 gpio_free(BABBAGE_USBH1_STP); 206 gpio_free(BABBAGE_USBH1_STP);
207 207
208 /* De-assert USB PHY RESETB */ 208 /* De-assert USB PHY RESETB */
209 mxc_iomux_v3_setup_pad(&phyreset_gpio); 209 mxc_iomux_v3_setup_pad(phyreset_gpio);
210 ret = gpio_request(BABBAGE_PHY_RESET, "phy_reset"); 210 ret = gpio_request(BABBAGE_PHY_RESET, "phy_reset");
211 211
212 if (ret) { 212 if (ret) {
@@ -352,7 +352,8 @@ static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = {
352static void __init mxc_board_init(void) 352static void __init mxc_board_init(void)
353{ 353{
354 iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP; 354 iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP;
355 iomux_v3_cfg_t power_key = MX51_PAD_EIM_A27__GPIO_2_21; 355 iomux_v3_cfg_t power_key = (MX51_PAD_EIM_A27__GPIO_2_21 &
356 ~MUX_PAD_CTRL_MASK) | MX51_GPIO_PAD_CTRL_2;
356 357
357#if defined(CONFIG_CPU_FREQ_IMX) 358#if defined(CONFIG_CPU_FREQ_IMX)
358 get_cpu_op = mx51_get_cpu_op; 359 get_cpu_op = mx51_get_cpu_op;
@@ -364,8 +365,7 @@ static void __init mxc_board_init(void)
364 imx51_add_fec(NULL); 365 imx51_add_fec(NULL);
365 366
366 /* Set the PAD settings for the pwr key. */ 367 /* Set the PAD settings for the pwr key. */
367 power_key.pad_ctrl = MX51_GPIO_PAD_CTRL_2; 368 mxc_iomux_v3_setup_pad(power_key);
368 mxc_iomux_v3_setup_pad(&power_key);
369 imx51_add_gpio_keys(&imx_button_data); 369 imx51_add_gpio_keys(&imx_button_data);
370 370
371 imx51_add_imx_i2c(0, &babbage_i2c_data); 371 imx51_add_imx_i2c(0, &babbage_i2c_data);
@@ -382,7 +382,7 @@ static void __init mxc_board_init(void)
382 gpio_usbh1_active(); 382 gpio_usbh1_active();
383 mxc_register_device(&mxc_usbh1_device, &usbh1_config); 383 mxc_register_device(&mxc_usbh1_device, &usbh1_config);
384 /* setback USBH1_STP to be function */ 384 /* setback USBH1_STP to be function */
385 mxc_iomux_v3_setup_pad(&usbh1stp); 385 mxc_iomux_v3_setup_pad(usbh1stp);
386 babbage_usbhub_reset(); 386 babbage_usbhub_reset();
387 387
388 imx51_add_sdhci_esdhc_imx(0, NULL); 388 imx51_add_sdhci_esdhc_imx(0, NULL);
diff --git a/arch/arm/plat-mxc/include/mach/iomux-v3.h b/arch/arm/plat-mxc/include/mach/iomux-v3.h
index 811716fbfbe6..1462a1c18940 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-v3.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-v3.h
@@ -42,58 +42,42 @@
42 * If <padname> or <padmode> refers to a GPIO, it is named 42 * If <padname> or <padmode> refers to a GPIO, it is named
43 * GPIO_<unit>_<num> 43 * GPIO_<unit>_<num>
44 * 44 *
45 */ 45 * IOMUX/PAD Bit field definitions
46 46 *
47typedef struct deprecated_pad_desc { 47 * MUX_CTRL_OFS: 0..11 (12)
48 unsigned mux_ctrl_ofs:12; /* IOMUXC_SW_MUX_CTL_PAD offset */ 48 * PAD_CTRL_OFS: 12..23 (12)
49 unsigned mux_mode:8; 49 * SEL_INPUT_OFS: 24..35 (12)
50 unsigned pad_ctrl_ofs:12; /* IOMUXC_SW_PAD_CTRL offset */ 50 * MUX_MODE + SION: 36..40 (5)
51#define NO_PAD_CTRL (1 << 16) 51 * PAD_CTRL + NO_PAD_CTRL: 41..57 (17)
52 unsigned pad_ctrl:17; 52 * SEL_INP: 58..61 (4)
53 unsigned select_input_ofs:12; /* IOMUXC_SELECT_INPUT offset */ 53 * reserved: 63 (1)
54 unsigned select_input:3; 54*/
55} iomux_v3_cfg_t; 55
56 56typedef u64 iomux_v3_cfg_t;
57static inline unsigned int MUX_CTRL_OFS(iomux_v3_cfg_t *pad) 57
58{ 58#define MUX_CTRL_OFS_SHIFT 0
59 return pad->mux_ctrl_ofs; 59#define MUX_CTRL_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_CTRL_OFS_SHIFT)
60} 60#define MUX_PAD_CTRL_OFS_SHIFT 12
61 61#define MUX_PAD_CTRL_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_PAD_CTRL_OFS_SHIFT)
62static inline unsigned int MUX_MODE(iomux_v3_cfg_t *pad) 62#define MUX_SEL_INPUT_OFS_SHIFT 24
63{ 63#define MUX_SEL_INPUT_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_SEL_INPUT_OFS_SHIFT)
64 return pad->mux_mode; 64
65} 65#define MUX_MODE_SHIFT 36
66 66#define MUX_MODE_MASK ((iomux_v3_cfg_t)0x1f << MUX_MODE_SHIFT)
67static inline unsigned int MUX_SELECT_INPUT_OFS(iomux_v3_cfg_t *pad) 67#define MUX_PAD_CTRL_SHIFT 41
68{ 68#define MUX_PAD_CTRL_MASK ((iomux_v3_cfg_t)0x1ffff << MUX_PAD_CTRL_SHIFT)
69 return pad->select_input_ofs; 69#define NO_PAD_CTRL ((iomux_v3_cfg_t)1 << (MUX_PAD_CTRL_SHIFT + 16))
70} 70#define MUX_SEL_INPUT_SHIFT 58
71 71#define MUX_SEL_INPUT_MASK ((iomux_v3_cfg_t)0xf << MUX_SEL_INPUT_SHIFT)
72static inline unsigned int MUX_SELECT_INPUT(iomux_v3_cfg_t *pad) 72
73{ 73#define IOMUX_PAD(_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _sel_input_ofs, \
74 return pad->select_input; 74 _sel_input, _pad_ctrl) \
75} 75 (((iomux_v3_cfg_t)(_mux_ctrl_ofs) << MUX_CTRL_OFS_SHIFT) | \
76 76 ((iomux_v3_cfg_t)(_mux_mode) << MUX_MODE_SHIFT) | \
77static inline unsigned int MUX_PAD_CTRL_OFS(iomux_v3_cfg_t *pad) 77 ((iomux_v3_cfg_t)(_pad_ctrl_ofs) << MUX_PAD_CTRL_OFS_SHIFT) | \
78{ 78 ((iomux_v3_cfg_t)(_pad_ctrl) << MUX_PAD_CTRL_SHIFT) | \
79 return pad->pad_ctrl_ofs; 79 ((iomux_v3_cfg_t)(_sel_input_ofs) << MUX_SEL_INPUT_OFS_SHIFT) | \
80} 80 ((iomux_v3_cfg_t)(_sel_input) << MUX_SEL_INPUT_SHIFT))
81
82static inline unsigned int MUX_PAD_CTRL(iomux_v3_cfg_t *pad)
83{
84 return pad->pad_ctrl;
85}
86
87#define IOMUX_PAD(_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _select_input_ofs, \
88 _select_input, _pad_ctrl) \
89 { \
90 .mux_ctrl_ofs = _mux_ctrl_ofs, \
91 .mux_mode = _mux_mode, \
92 .pad_ctrl_ofs = _pad_ctrl_ofs, \
93 .pad_ctrl = _pad_ctrl, \
94 .select_input_ofs = _select_input_ofs, \
95 .select_input = _select_input, \
96 }
97 81
98/* 82/*
99 * Use to set PAD control 83 * Use to set PAD control
@@ -137,7 +121,7 @@ static inline unsigned int MUX_PAD_CTRL(iomux_v3_cfg_t *pad)
137/* 121/*
138 * setups a single pad in the iomuxer 122 * setups a single pad in the iomuxer
139 */ 123 */
140int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t *pad); 124int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t pad);
141 125
142/* 126/*
143 * setups mutliple pads 127 * setups mutliple pads
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 */
37int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t *pad) 37int 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}
50EXPORT_SYMBOL(mxc_iomux_v3_setup_pad); 57EXPORT_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++;