1
2
3
4
5
6
7 #ifndef __PINCTRL_ZX_H
8 #define __PINCTRL_ZX_H
9
10
11
12
13
14
15 struct zx_mux_desc {
16 const char *name;
17 u8 muxval;
18 };
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 struct zx_pin_data {
37 bool aon_pin;
38 u16 offset;
39 u16 bitpos;
40 u16 width;
41 u16 coffset;
42 u16 cbitpos;
43 struct zx_mux_desc *muxes;
44 };
45
46 struct zx_pinctrl_soc_info {
47 const struct pinctrl_pin_desc *pins;
48 unsigned int npins;
49 };
50
51 #define TOP_PIN(pin, off, bp, wd, coff, cbp, ...) { \
52 .number = pin, \
53 .name = #pin, \
54 .drv_data = &(struct zx_pin_data) { \
55 .aon_pin = false, \
56 .offset = off, \
57 .bitpos = bp, \
58 .width = wd, \
59 .coffset = coff, \
60 .cbitpos = cbp, \
61 .muxes = (struct zx_mux_desc[]) { \
62 __VA_ARGS__, { } }, \
63 }, \
64 }
65
66 #define AON_PIN(pin, off, bp, wd, coff, cbp, ...) { \
67 .number = pin, \
68 .name = #pin, \
69 .drv_data = &(struct zx_pin_data) { \
70 .aon_pin = true, \
71 .offset = off, \
72 .bitpos = bp, \
73 .width = wd, \
74 .coffset = coff, \
75 .cbitpos = cbp, \
76 .muxes = (struct zx_mux_desc[]) { \
77 __VA_ARGS__, { } }, \
78 }, \
79 }
80
81 #define ZX_RESERVED(pin) PINCTRL_PIN(pin, #pin)
82
83 #define TOP_MUX(_val, _name) { \
84 .name = _name, \
85 .muxval = _val, \
86 }
87
88
89
90
91
92 #define AON_MUX_FLAG BIT(7)
93
94 #define AON_MUX(_val, _name) { \
95 .name = _name, \
96 .muxval = _val | AON_MUX_FLAG, \
97 }
98
99 int zx_pinctrl_init(struct platform_device *pdev,
100 struct zx_pinctrl_soc_info *info);
101
102 #endif