Skip to content

mt6589: Pinctrl v2 driver#25

Merged
akku1139 merged 32 commits intoblade/v6.16from
dev/v6.16/mt6589-pinctrl-v2
Mar 7, 2026
Merged

mt6589: Pinctrl v2 driver#25
akku1139 merged 32 commits intoblade/v6.16from
dev/v6.16/mt6589-pinctrl-v2

Conversation

@akku1139
Copy link
Copy Markdown
Member

@akku1139 akku1139 commented Mar 2, 2026

No description provided.

@akku1139
Copy link
Copy Markdown
Member Author

akku1139 commented Mar 2, 2026

9f74dcf 676a820
wrong subsystem

@akku1139
Copy link
Copy Markdown
Member Author

akku1139 commented Mar 2, 2026

there are no users in downstream, and mainline.
but bootloader sets it?

https://github.com/bq/aquaris-5/blob/bc1d0d0e35c969670e2d869001be944ad0c9c5e5/mediatek/platform/mt6589/kernel/drivers/mmc-host/sd.c#L1192-L1230

static const struct mtk_pin_field_calc mt6589_pin_tdsel_range[] = {
	/* MSDC0_RSTB */
	PINS_FIELD(4, 4, 0x0700, 0x0, 0, 4),
	/* MSDC0 */
	PINS_FIELD(, , 0x0700, 0x0, 8, 4),
	/* NFI */
	PINS_FIELD(, , 0x0700, 0x0, 24, 4),
	/* EINT */
	PINS_FIELD(, , 0x0710, 0x0, 0, 4),
	/* SPI */
	PINS_FIELD(, , 0x0710, 0x0, 8, 4),
	/* SIM */
	PINS_FIELD(, , 0x0710, 0x0, 16, 4),
	/* I2S */
	PINS_FIELD(, , 0x0710, 0x0, 24, 4),
	/* GPIO */
	PINS_FIELD(, , 0x0720, 0x0, 0, 4),
	/* JTAG */
	PINS_FIELD(, , 0x0730, 0x0, 0, 4),
	/* UART */
	PINS_FIELD(, , 0x0730, 0x0, 8, 4),
	/* PWM */
	PINS_FIELD(, , 0x0730, 0x0, 24, 4),
	/* BPI */
	PINS_FIELD(, , 0x0740, 0x0, 8, 4),
	/* BSI1A */
	PINS_FIELD(, , 0x0740, 0x0, 24, 4),
	/* BSI1B */
	PINS_FIELD(, , 0x0750, 0x0, 0, 4),
	/* BSI1C */
	PINS_FIELD(, , 0x0750, 0x0, 16, 4),
	/* PCM */
	PINS_FIELD1(, , 0x0760, 0x0, 0, 4),
	/* LCD */
	PINS_FIELD1(, , 0x0760, 0x0, 8, 4),
	/* MSDC4_RSTB */
	PINS_FIELD1(, , 0x0760, 0x0, 16, 4),
	/* MSDC4 */
	PINS_FIELD1(, , 0x0760, 0x0, 24, 4),
	/* DPI */
	PINS_FIELD1(, , 0x0770, 0x0, 8, 4),
	/* MSDC1INSI */
	PINS_FIELD1(, , 0x0770, 0x0, 16, 4),
	/* MSDC2 */
	PINS_FIELD(, , 0x0780, 0x0, 0, 4),
	/* MSDC1 */
	PINS_FIELD(, , 0x0780, 0x0, 16, 4),
	/* CAM */
	PINS_FIELD(, , 0x0790, 0x0, 0, 4),
	/* I2C */
	PINS_FIELD(, , 0x0790, 0x0, 8, 4),
	/* MSDC3 */
	PINS_FIELD(, , 0x0790, 0x0, 16, 4),
};

static const struct mtk_pin_field_calc mt6589_pin_rdsel_range[] = {
	/* MSDC0_RSTB */
	PINS_FIELD(4, 4, 0x0700, 0x0, 4, 2),
	/* MSDC0 */
	PINS_FIELD(, , 0x0700, 0x0, 16, 6),
	/* NFI */
	PINS_FIELD(, , 0x0700, 0x0, 28, 2),
	/* EINT */
	PINS_FIELD(, , 0x0710, 0x0, 4, 2),
	/* SPI */
	PINS_FIELD(, , 0x0710, 0x0, 12, 2),
	/* SIM */
	PINS_FIELD(, , 0x0710, 0x0, 20, 2),
	/* I2S */
	PINS_FIELD(, , 0x0710, 0x0, 28, 2),
	/* GPIO */
	PINS_FIELD(, , 0x0720, 0x0, 4, 2),
	/* JTAG */
	PINS_FIELD(, , 0x0730, 0x0, 4, 2),
	/* UART */
	PINS_FIELD(, , 0x0730, 0x0, 16, 6),
	/* PWM */
	PINS_FIELD(, , 0x0740, 0x0, 0, 6),
	/* BPI */
	PINS_FIELD(, , 0x0740, 0x0, 16, 6),
	/* BSI1A */
	PINS_FIELD(, , 0x0740, 0x0, 28, 2),
	/* BSI1B */
	PINS_FIELD(, , 0x0750, 0x0, 8, 6),
	/* BSI1C */
	PINS_FIELD(, , 0x0750, 0x0, 20, 2),
	/* PCM */
	PINS_FIELD1(, , 0x0760, 0x0, 4, 2),
	/* LCD */
	PINS_FIELD1(, , 0x0760, 0x0, 12, 2),
	/* MSDC4_RSTB */
	PINS_FIELD1(, , 0x0760, 0x0, 20, 2),
	/* MSDC4 */
	PINS_FIELD1(, , 0x0770, 0x0, 0, 6),
	/* DPI */
	PINS_FIELD1(, , 0x0770, 0x0, 12, 2),
	/* MSDC1INSI */
	PINS_FIELD1(, , 0x0770, 0x0, 20, 2),
	/* MSDC2 */
	PINS_FIELD(, , 0x0780, 0x0, 8, 6),
	/* MSDC1 */
	PINS_FIELD(, , 0x0780, 0x0, 24, 6),
	/* CAM */
	PINS_FIELD(, , 0x0790, 0x0, 4, 2),
	/* I2C */
	PINS_FIELD(, , 0x0790, 0x0, 12, 2),
	/* MSDC3 */
	PINS_FIELD(, , 0x0790, 0x0, 24, 6),
};

[PINCTRL_PIN_REG_TDSEL] = MTK_RANGE(mt6589_pin_tdsel_range),
[PINCTRL_PIN_REG_RDSEL] = MTK_RANGE(mt6589_pin_rdsel_range),

f6efb67

TODO: Detailed Pin Description

@akku1139
Copy link
Copy Markdown
Member Author

akku1139 commented Mar 2, 2026

/*
 * mt6589_drv_grp: DRV_GRP
 * grp 0: DRV_GRP4
 * grp 1: DRV_GRP1
 * grp 2: DRV_GRP3
 * grp 3: DRV_GRP5
 */

/*
* E2, E4, E8, E16: Drive
* SR: ???
* DM: Dummy
* MSB <-> LSB
*/
static const struct mtk_drv_group_desc mt6589_drv_grp[] = {
/* grp 0: SR E8 E4 E2: 2/4/6/8/10/12/14/16mA */
MTK_DRV_GRP(2, 16, 0, 2, 2),
/* grp 1: SR E8 E4 DM: 4/8/12/16mA */
MTK_DRV_GRP(4, 16, 1, 2, 4),
/* grp 2: SR E4 E2 DM: 2/4/6/8mA */
MTK_DRV_GRP(2, 8, 1, 2, 2),
/* grp 3: SR E16 E8 E4 4/8/12/16/20/24/28/32mA */
MTK_DRV_GRP(4, 32, 0, 2, 4),
};

/**
* struct mtk_drive_desc - the structure that holds the information
* of the driving current
* @min: the minimum current of this group
* @max: the maximum current of this group
* @step: the step current of this group
* @scal: the weight factor
*
* formula: output = ((input) / step - 1) * scal
*/
struct mtk_drive_desc {
u8 min;
u8 max;
u8 step;
u8 scal;
};
/* The groups of drive strength */
static const struct mtk_drive_desc mtk_drive[] = {
[DRV_GRP0] = { 4, 16, 4, 1 },
[DRV_GRP1] = { 4, 16, 4, 2 },
[DRV_GRP2] = { 2, 8, 2, 1 },
[DRV_GRP3] = { 2, 8, 2, 2 },
[DRV_GRP4] = { 2, 16, 2, 1 },
[DRV_GRP5] = { 4, 32, 4, 1 },
};

@akku1139
Copy link
Copy Markdown
Member Author

akku1139 commented Mar 3, 2026

note: MT6589's pullen means R1

This was referenced Mar 3, 2026
@akku1139
Copy link
Copy Markdown
Member Author

akku1139 commented Mar 4, 2026

TODO: fix MTK_EINT_FUNCTION eintmux

done

@akku1139
Copy link
Copy Markdown
Member Author

akku1139 commented Mar 4, 2026

grep MTK_EINT_FUNCTION pinctrl-mtk-mt6589.h | grep -v NO_EINT_SUPPORT | cut -d' ' -f2 | rev | cut -c 3- | rev | sort -n | less

0
0
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
10
11
11
11
16
16
16
17
17
18
18
19
19
20
20
21
21
22
22
23
23
24
24
25
25
26
26
27
27
28
28
29
29
30
30
31
32
33
34
34
35
35
36
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191

missing eint 12,13,14,15

@akku1139
Copy link
Copy Markdown
Member Author

akku1139 commented Mar 7, 2026

TODO: fix PIN_FIELD_DRV, PINS_FIELD_DRV
x_bits: 4bit
but drv uses 3bit, sr uses 1bit

done

@akku1139 akku1139 marked this pull request as ready for review March 7, 2026 12:08
@akku1139 akku1139 merged commit 10683b2 into blade/v6.16 Mar 7, 2026
akku1139 added a commit that referenced this pull request Mar 7, 2026
@akku1139
Copy link
Copy Markdown
Member Author

akku1139 commented Mar 7, 2026

note:
this driver doesn't support TDSEL/RDSEL due to lack of Information

@akku1139 akku1139 deleted the dev/v6.16/mt6589-pinctrl-v2 branch April 8, 2026 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant