1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef __DRIVERS_PINCTRL_IMX_H
16#define __DRIVERS_PINCTRL_IMX_H
17
18#include <linux/pinctrl/pinconf-generic.h>
19#include <linux/pinctrl/pinmux.h>
20
21struct platform_device;
22
23extern struct pinmux_ops imx_pmx_ops;
24
25
26
27
28
29
30
31
32
33
34struct imx_pin {
35 unsigned int pin;
36 unsigned int mux_mode;
37 u16 input_reg;
38 unsigned int input_val;
39 unsigned long config;
40};
41
42
43
44
45
46
47struct imx_pin_reg {
48 s16 mux_reg;
49 s16 conf_reg;
50};
51
52
53struct imx_cfg_params_decode {
54 enum pin_config_param param;
55 u32 mask;
56 u8 shift;
57 bool invert;
58};
59
60struct imx_pinctrl_soc_info {
61 struct device *dev;
62 const struct pinctrl_pin_desc *pins;
63 unsigned int npins;
64 struct imx_pin_reg *pin_regs;
65 unsigned int group_index;
66 unsigned int flags;
67 const char *gpr_compatible;
68 struct mutex mutex;
69
70
71 unsigned int mux_mask;
72 u8 mux_shift;
73
74
75 bool generic_pinconf;
76 const struct pinconf_generic_params *custom_params;
77 unsigned int num_custom_params;
78 struct imx_cfg_params_decode *decodes;
79 unsigned int num_decodes;
80 void (*fixup)(unsigned long *configs, unsigned int num_configs,
81 u32 *raw_config);
82
83 int (*gpio_set_direction)(struct pinctrl_dev *pctldev,
84 struct pinctrl_gpio_range *range,
85 unsigned offset,
86 bool input);
87};
88
89
90
91
92
93struct imx_pinctrl {
94 struct device *dev;
95 struct pinctrl_dev *pctl;
96 void __iomem *base;
97 void __iomem *input_sel_base;
98 struct imx_pinctrl_soc_info *info;
99};
100
101#define IMX_CFG_PARAMS_DECODE(p, m, o) \
102 { .param = p, .mask = m, .shift = o, .invert = false, }
103
104#define IMX_CFG_PARAMS_DECODE_INVERT(p, m, o) \
105 { .param = p, .mask = m, .shift = o, .invert = true, }
106
107#define SHARE_MUX_CONF_REG 0x1
108#define ZERO_OFFSET_VALID 0x2
109
110#define NO_MUX 0x0
111#define NO_PAD 0x0
112
113#define IMX_PINCTRL_PIN(pin) PINCTRL_PIN(pin, #pin)
114
115#define PAD_CTL_MASK(len) ((1 << len) - 1)
116#define IMX_MUX_MASK 0x7
117#define IOMUXC_CONFIG_SION (0x1 << 4)
118
119int imx_pinctrl_probe(struct platform_device *pdev,
120 struct imx_pinctrl_soc_info *info);
121#endif
122