Skip to content

Commit 9ac6e7c

Browse files
gclementLinus Walleij
authored andcommitted
pinctrl: armada-37xx: Fix the pin 23 on south bridge
Pin 23 on South bridge does not belong to the rgmii group. It belongs to a separate group which can have 3 functions. Due to this the fix also have to update the way the functions are managed. Until now each groups used NB_FUNCS(which was 2) functions. For the mpp23, 3 functions are available but it is the only group which needs it, so on the loop involving NB_FUNCS an extra test was added to handle only the functions added. The bug was visible with the merge of the commit 07d065a "arm64: dts: marvell: armada-3720-db: Add vqmmc regulator for SD slot", the gpio regulator used the gpio 23, due to this the whole rgmii group was setup to gpio which broke the Ethernet support on the Armada 3720 DB board. Thanks to this patch, the UHS SD cards (which need the vqmmc) _and_ the Ethernet work again. Cc: [email protected] Fixes: 87466cc ("pinctrl: armada-37xx: Add pin controller support for Armada 37xx") Signed-off-by: Gregory CLEMENT <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 2d80bd3 commit 9ac6e7c

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

drivers/pinctrl/mvebu/pinctrl-armada-37xx.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#define IRQ_STATUS 0x10
3838
#define IRQ_WKUP 0x18
3939

40-
#define NB_FUNCS 2
40+
#define NB_FUNCS 3
4141
#define GPIO_PER_REG 32
4242

4343
/**
@@ -126,6 +126,16 @@ struct armada_37xx_pinctrl {
126126
.funcs = {_func1, "gpio"} \
127127
}
128128

129+
#define PIN_GRP_GPIO_3(_name, _start, _nr, _mask, _v1, _v2, _v3, _f1, _f2) \
130+
{ \
131+
.name = _name, \
132+
.start_pin = _start, \
133+
.npins = _nr, \
134+
.reg_mask = _mask, \
135+
.val = {_v1, _v2, _v3}, \
136+
.funcs = {_f1, _f2, "gpio"} \
137+
}
138+
129139
#define PIN_GRP_EXTRA(_name, _start, _nr, _mask, _v1, _v2, _start2, _nr2, \
130140
_f1, _f2) \
131141
{ \
@@ -171,12 +181,13 @@ static struct armada_37xx_pin_group armada_37xx_sb_groups[] = {
171181
PIN_GRP_GPIO("usb32_drvvbus0", 0, 1, BIT(0), "drvbus"),
172182
PIN_GRP_GPIO("usb2_drvvbus1", 1, 1, BIT(1), "drvbus"),
173183
PIN_GRP_GPIO("sdio_sb", 24, 6, BIT(2), "sdio"),
174-
PIN_GRP_EXTRA("rgmii", 6, 12, BIT(3), 0, BIT(3), 23, 1, "mii", "gpio"),
184+
PIN_GRP_GPIO("rgmii", 6, 12, BIT(3), "mii"),
175185
PIN_GRP_GPIO("pcie1", 3, 2, BIT(4), "pcie"),
176186
PIN_GRP_GPIO("ptp", 20, 3, BIT(5), "ptp"),
177187
PIN_GRP("ptp_clk", 21, 1, BIT(6), "ptp", "mii"),
178188
PIN_GRP("ptp_trig", 22, 1, BIT(7), "ptp", "mii"),
179-
PIN_GRP("mii_col", 23, 1, BIT(8), "mii", "mii_err"),
189+
PIN_GRP_GPIO_3("mii_col", 23, 1, BIT(8) | BIT(14), 0, BIT(8), BIT(14),
190+
"mii", "mii_err"),
180191
};
181192

182193
const struct armada_37xx_pin_data armada_37xx_pin_nb = {
@@ -208,7 +219,7 @@ static int armada_37xx_get_func_reg(struct armada_37xx_pin_group *grp,
208219
{
209220
int f;
210221

211-
for (f = 0; f < NB_FUNCS; f++)
222+
for (f = 0; (f < NB_FUNCS) && grp->funcs[f]; f++)
212223
if (!strcmp(grp->funcs[f], func))
213224
return f;
214225

@@ -795,7 +806,7 @@ static int armada_37xx_fill_group(struct armada_37xx_pinctrl *info)
795806
for (j = 0; j < grp->extra_npins; j++)
796807
grp->pins[i+j] = grp->extra_pin + j;
797808

798-
for (f = 0; f < NB_FUNCS; f++) {
809+
for (f = 0; (f < NB_FUNCS) && grp->funcs[f]; f++) {
799810
int ret;
800811
/* check for unique functions and count groups */
801812
ret = armada_37xx_add_function(info->funcs, &funcsize,
@@ -847,7 +858,7 @@ static int armada_37xx_fill_func(struct armada_37xx_pinctrl *info)
847858
struct armada_37xx_pin_group *gp = &info->groups[g];
848859
int f;
849860

850-
for (f = 0; f < NB_FUNCS; f++) {
861+
for (f = 0; (f < NB_FUNCS) && gp->funcs[f]; f++) {
851862
if (strcmp(gp->funcs[f], name) == 0) {
852863
*groups = gp->name;
853864
groups++;

0 commit comments

Comments
 (0)