1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (c) 2023 Realtek Semiconductor Corp.
*/
#define NA 0xffffffff
#define PADDRI_4_8 1
#define PADDRI_2_4 0
struct rtd_pin_group_desc {
const char *name;
const unsigned int *pins;
unsigned int num_pins;
};
struct rtd_pin_func_desc {
const char *name;
const char * const *groups;
unsigned int num_groups;
};
struct rtd_pin_mux_desc {
const char *name;
u32 mux_value;
};
struct rtd_pin_config_desc {
const char *name;
unsigned int reg_offset;
unsigned int base_bit;
unsigned int pud_en_offset;
unsigned int pud_sel_offset;
unsigned int curr_offset;
unsigned int smt_offset;
unsigned int power_offset;
unsigned int curr_type;
};
struct rtd_pin_sconfig_desc {
const char *name;
unsigned int reg_offset;
unsigned int dcycle_offset;
unsigned int dcycle_maskbits;
unsigned int ndrive_offset;
unsigned int ndrive_maskbits;
unsigned int pdrive_offset;
unsigned int pdrive_maskbits;
};
struct rtd_pin_desc {
const char *name;
unsigned int mux_offset;
u32 mux_mask;
const struct rtd_pin_mux_desc *functions;
};
struct rtd_pin_reg_list {
unsigned int reg_offset;
unsigned int val;
};
#define SHIFT_LEFT(_val, _shift) ((_val) << (_shift))
#define RTK_PIN_MUX(_name, _mux_off, _mux_mask, ...) \
{ \
.name = # _name, \
.mux_offset = _mux_off, \
.mux_mask = _mux_mask, \
.functions = (const struct rtd_pin_mux_desc []) { \
__VA_ARGS__, { } \
}, \
}
#define RTK_PIN_CONFIG(_name, _reg_off, _base_bit, _pud_en_off, \
_pud_sel_off, _curr_off, _smt_off, _pow_off, _curr_type) \
{ \
.name = # _name, \
.reg_offset = _reg_off, \
.base_bit = _base_bit, \
.pud_en_offset = _pud_en_off, \
.pud_sel_offset = _pud_sel_off, \
.curr_offset = _curr_off, \
.smt_offset = _smt_off, \
.power_offset = _pow_off, \
.curr_type = _curr_type, \
}
#define RTK_PIN_SCONFIG(_name, _reg_off, _d_offset, _d_mask, \
_n_offset, _n_mask, _p_offset, _p_mask) \
{ \
.name = # _name, \
.reg_offset = _reg_off, \
.dcycle_offset = _d_offset, \
.dcycle_maskbits = _d_mask, \
.ndrive_offset = _n_offset, \
.ndrive_maskbits = _n_mask, \
.pdrive_offset = _p_offset, \
.pdrive_maskbits = _p_mask, \
}
#define RTK_PIN_FUNC(_mux_val, _name) \
{ \
.name = _name, \
.mux_value = _mux_val, \
}
struct rtd_pinctrl_desc {
const struct pinctrl_pin_desc *pins;
unsigned int num_pins;
const struct rtd_pin_group_desc *groups;
unsigned int num_groups;
const struct rtd_pin_func_desc *functions;
unsigned int num_functions;
const struct rtd_pin_desc *muxes;
unsigned int num_muxes;
const struct rtd_pin_config_desc *configs;
unsigned int num_configs;
const struct rtd_pin_sconfig_desc *sconfigs;
unsigned int num_sconfigs;
struct rtd_pin_reg_list *lists;
unsigned int num_regs;
};
int rtd_pinctrl_probe(struct platform_device *pdev, const struct rtd_pinctrl_desc *desc);
|