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