diff options
Diffstat (limited to 'arch/arm/plat-mxc/include')
-rw-r--r-- | arch/arm/plat-mxc/include/mach/iomux-v3.h | 90 |
1 files changed, 37 insertions, 53 deletions
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 | * | |
47 | typedef 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 | 56 | typedef u64 iomux_v3_cfg_t; | |
57 | static 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) | |
62 | static 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) | |
67 | static 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) | |
72 | static 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) | \ | |
77 | static 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 | |||
82 | static 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 | */ |
140 | int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t *pad); | 124 | int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t pad); |
141 | 125 | ||
142 | /* | 126 | /* |
143 | * setups mutliple pads | 127 | * setups mutliple pads |