diff options
Diffstat (limited to 'arch/arm/plat-mxc/include/mach/iomux-v3.h')
-rw-r--r-- | arch/arm/plat-mxc/include/mach/iomux-v3.h | 64 |
1 files changed, 40 insertions, 24 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..2277b01c855d 100644 --- a/arch/arm/plat-mxc/include/mach/iomux-v3.h +++ b/arch/arm/plat-mxc/include/mach/iomux-v3.h | |||
@@ -42,28 +42,44 @@ | |||
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 | * | |
47 | struct 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 | }; | 55 | |
56 | 56 | typedef u64 iomux_v3_cfg_t; | |
57 | #define IOMUX_PAD(_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _select_input_ofs, \ | 57 | |
58 | _select_input, _pad_ctrl) \ | 58 | #define MUX_CTRL_OFS_SHIFT 0 |
59 | { \ | 59 | #define MUX_CTRL_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_CTRL_OFS_SHIFT) |
60 | .mux_ctrl_ofs = _mux_ctrl_ofs, \ | 60 | #define MUX_PAD_CTRL_OFS_SHIFT 12 |
61 | .mux_mode = _mux_mode, \ | 61 | #define MUX_PAD_CTRL_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_PAD_CTRL_OFS_SHIFT) |
62 | .pad_ctrl_ofs = _pad_ctrl_ofs, \ | 62 | #define MUX_SEL_INPUT_OFS_SHIFT 24 |
63 | .pad_ctrl = _pad_ctrl, \ | 63 | #define MUX_SEL_INPUT_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_SEL_INPUT_OFS_SHIFT) |
64 | .select_input_ofs = _select_input_ofs, \ | 64 | |
65 | .select_input = _select_input, \ | 65 | #define MUX_MODE_SHIFT 36 |
66 | } | 66 | #define MUX_MODE_MASK ((iomux_v3_cfg_t)0x1f << MUX_MODE_SHIFT) |
67 | #define MUX_PAD_CTRL_SHIFT 41 | ||
68 | #define MUX_PAD_CTRL_MASK ((iomux_v3_cfg_t)0x1ffff << MUX_PAD_CTRL_SHIFT) | ||
69 | #define NO_PAD_CTRL ((iomux_v3_cfg_t)1 << (MUX_PAD_CTRL_SHIFT + 16)) | ||
70 | #define MUX_SEL_INPUT_SHIFT 58 | ||
71 | #define MUX_SEL_INPUT_MASK ((iomux_v3_cfg_t)0xf << MUX_SEL_INPUT_SHIFT) | ||
72 | |||
73 | #define MUX_PAD_CTRL(x) ((iomux_v3_cfg_t)(x) << MUX_PAD_CTRL_SHIFT) | ||
74 | |||
75 | #define IOMUX_PAD(_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _sel_input_ofs, \ | ||
76 | _sel_input, _pad_ctrl) \ | ||
77 | (((iomux_v3_cfg_t)(_mux_ctrl_ofs) << MUX_CTRL_OFS_SHIFT) | \ | ||
78 | ((iomux_v3_cfg_t)(_mux_mode) << MUX_MODE_SHIFT) | \ | ||
79 | ((iomux_v3_cfg_t)(_pad_ctrl_ofs) << MUX_PAD_CTRL_OFS_SHIFT) | \ | ||
80 | ((iomux_v3_cfg_t)(_pad_ctrl) << MUX_PAD_CTRL_SHIFT) | \ | ||
81 | ((iomux_v3_cfg_t)(_sel_input_ofs) << MUX_SEL_INPUT_OFS_SHIFT) | \ | ||
82 | ((iomux_v3_cfg_t)(_sel_input) << MUX_SEL_INPUT_SHIFT)) | ||
67 | 83 | ||
68 | /* | 84 | /* |
69 | * Use to set PAD control | 85 | * Use to set PAD control |
@@ -107,13 +123,13 @@ struct pad_desc { | |||
107 | /* | 123 | /* |
108 | * setups a single pad in the iomuxer | 124 | * setups a single pad in the iomuxer |
109 | */ | 125 | */ |
110 | int mxc_iomux_v3_setup_pad(struct pad_desc *pad); | 126 | int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t pad); |
111 | 127 | ||
112 | /* | 128 | /* |
113 | * setups mutliple pads | 129 | * setups mutliple pads |
114 | * convenient way to call the above function with tables | 130 | * convenient way to call the above function with tables |
115 | */ | 131 | */ |
116 | int mxc_iomux_v3_setup_multiple_pads(struct pad_desc *pad_list, unsigned count); | 132 | int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count); |
117 | 133 | ||
118 | /* | 134 | /* |
119 | * Initialise the iomux controller | 135 | * Initialise the iomux controller |