Skip to contentSkip to conversation

RK3328 / Rock64 eMMC regression

DISCUSSION Huang-Huang Bao 2 participants 5 messages Jul 8, 2024 – Jul 9, 2024 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi richard,

So the 96903ed0e846 ("pinctrl: rockchip: fix pinmux bits for RK3328 GPIO2-B pins") changed pinmux bits for GPIO2 B0-B3,B5-B6 from 2-bit width to 3-bit width.

Before the commit, we have the following pinmux bits, note the bit numbers in [start:end] are both inclusive.

GPIO2-B0: GRF_GPIO2BL_iomux[0:2]
GPIO2-B1: GRF_GPIO2BL_iomux[3:5]
GPIO2-B2: GRF_GPIO2BL_iomux[6:8]
GPIO2-B3: GRF_GPIO2BL_iomux[9:11]
GPIO2-B4: GRF_GPIO2BL_iomux[8:9] (unchanged)
GPIO2-B5: GRF_GPIO2BH_iomux[0:2]
GPIO2-B6: GRF_GPIO2BH_iomux[3:5]
GPIO2-B7: GRF_GPIO2BH_iomux[0:2] (unchanged)

(GRF_GPIO2BL_iomux[0:11], GRF_GPIO2BH_iomux[0:5] are used)

Notice that there are conflicting pinmux bits within GPIO2-B2, GPIO2-B3 and GPIO2-B4, and within GPIO2-B5 and GPIO2-B7. So this apparently looks wrong.

After the commit, pinmux bits for these pins changed to

GPIO2-B0: GRF_GPIO2BL_iomux[0:1]
GPIO2-B1: GRF_GPIO2BL_iomux[2:3]
GPIO2-B2: GRF_GPIO2BL_iomux[4:5]
GPIO2-B3: GRF_GPIO2BL_iomux[6:7]
GPIO2-B4: GRF_GPIO2BL_iomux[8:9] (unchanged)
GPIO2-B5: GRF_GPIO2BL_iomux[10:11]
GPIO2-B6: GRF_GPIO2BL_iomux[12:13]
GPIO2-B7: GRF_GPIO2BH_iomux[0:2] (unchanged)

(GRF_GPIO2BL_iomux[0:13], GRF_GPIO2BH_iomux[0:2] are used)

According to RK3328 datasheet, the eMMC pins of RK3328 are GPIO0_A7/EMMC_D0, GPIO2_D4/EMMC_D1, GPIO2_D5/EMMC_D2, GPIO3_C1/EMMC_D6, GPIO3_C2/EMMC_D7, GPIO3_C3/EMMC_CMD, GPIO3_C5/EMMC_CLKOUT and GPIO3_C6/EMMC_PWREN, which are not the subject of the commit. So I don't know why these changes cause mmc module failure.

Comparing pinmux bits before and after the commit, the GRF_GPIO2BL_iomux[12:13] are being used and GRF_GPIO2BH_iomux[3:5] are no longer used. Maybe it's because the eMMC functionality depends on some of these bits to be set or not set?

The patch below is equivalent to revert 96903ed0e846 however is made easier to edit pinmux data for each pin. Try to apply the patch and reduce the changed items in rk3328_mux_recalced_data[] array as much as possible to figure out exactly which pinmux data fixed you issue.

drivers/pinctrl/pinctrl-rockchip.c +42 -0
index 3f56991f5b89..db835d7f053c 100644
@@ -640,6 +640,48 @@ static struct rockchip_mux_recalced_data rk3328_mux_recalced_data[] = {
                .reg = 0x28,
                .bit = 0,
                .mask = 0x7
+       }, {
+               /* gpio2_b0_sel 3-bit */
+               .num = 2,
+               .pin = 8,
+               .reg = 0x24,
+               .bit = 0,
+               .mask = 0x7
+       }, {
+               /* gpio2_b1_sel 3-bit */
+               .num = 2,
+               .pin = 9,
+               .reg = 0x24,
+               .bit = 3,
+               .mask = 0x7
+       }, {
+               /* gpio2_b2_sel 3-bit, conflicting gpio2_b4_sel */
+               .num = 2,
+               .pin = 10,
+               .reg = 0x24,
+               .bit = 6,
+               .mask = 0x7
+       }, {
+               /* gpio2_b3_sel 3-bit, conflicting gpio2_b4_sel */
+               .num = 2,
+               .pin = 11,
+               .reg = 0x24,
+               .bit = 9,
+               .mask = 0x7
+       }, {
+               /* gpio2_b5_sel 3-bit, conflicting gpio2_b7_sel */
+               .num = 2,
+               .pin = 13,
+               .reg = 0x28,
+               .bit = 0,
+               .mask = 0x7
+       }, {
+               /* gpio2_b6_sel 3-bit */
+               .num = 2,
+               .pin = 14,
+               .reg = 0x28,
+               .bit = 3,
+               .mask = 0x7
        }, {
                /* gpio2_c7_sel */
                .num = 2,

Bao

Quoted 18 lines · On 7/8/24 02:45, [email protected] wrote:

Dear developers,

I am using a Rock64 board with an emmc module. I've upgraded kernel from 5.15.161 to .162, and since then the board wont boot up. Kernel messages show:

[   49.117131] mmc1: switch to bus width 8 failed [   49.124709] 

mmc1: mmc_select_hs200 failed, error -110 [ 49.125190] mmc1: error
-110 whilst initialising MMC card [ 49.139566] mmc_host mmc1: Bus
speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div =
0) [ 105.437111] mmc1: switch to bus width 8 failed [ 105.446739]
mmc1: mmc_select_hs200 failed, error -110 [ 105.447246] mmc1: error -110 whilst initialising MMC card [ 105.461639] mmc_host mmc1: Bus speed (slot 0) = 200000Hz (slot req 200000Hz, actual 200000HZ div =
0)

I am using rk3328-rock64.dts from the kernel.

Quoted 7 lines

Bisecting the kernel revealed 96903ed0e846 as first bad commit. Reverting this commit on top of v5.15.162 makes my board bootup again.

Can you please take a look?

Thanks in advance, Richard

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#2 lore raw

Dear Bao,

Thanks for your response. Although these are deep technicals for me, I'll try to follow your instructions to debug the case. Does it matter in which order I'll try to remove recalc items? I'll need a day or two to finish with these, thanks for your patience. I'll report as soon as I can.

Regards,
Richard

2024-07-08 09:54 időpontban Huang-Huang Bao ezt írta:

Quoted 110 lines

Hi richard,

So the 96903ed0e846 ("pinctrl: rockchip: fix pinmux bits for RK3328 GPIO2-B pins") changed pinmux bits for GPIO2 B0-B3,B5-B6 from 2-bit width to 3-bit width.

Before the commit, we have the following pinmux bits, note the bit numbers in [start:end] are both inclusive.

GPIO2-B0: GRF_GPIO2BL_iomux[0:2]
GPIO2-B1: GRF_GPIO2BL_iomux[3:5]
GPIO2-B2: GRF_GPIO2BL_iomux[6:8]
GPIO2-B3: GRF_GPIO2BL_iomux[9:11]
GPIO2-B4: GRF_GPIO2BL_iomux[8:9] (unchanged)
GPIO2-B5: GRF_GPIO2BH_iomux[0:2]
GPIO2-B6: GRF_GPIO2BH_iomux[3:5]
GPIO2-B7: GRF_GPIO2BH_iomux[0:2] (unchanged)

(GRF_GPIO2BL_iomux[0:11], GRF_GPIO2BH_iomux[0:5] are used)

Notice that there are conflicting pinmux bits within GPIO2-B2, GPIO2-B3 and GPIO2-B4, and within GPIO2-B5 and GPIO2-B7. So this apparently looks wrong.

After the commit, pinmux bits for these pins changed to

GPIO2-B0: GRF_GPIO2BL_iomux[0:1]
GPIO2-B1: GRF_GPIO2BL_iomux[2:3]
GPIO2-B2: GRF_GPIO2BL_iomux[4:5]
GPIO2-B3: GRF_GPIO2BL_iomux[6:7]
GPIO2-B4: GRF_GPIO2BL_iomux[8:9] (unchanged)
GPIO2-B5: GRF_GPIO2BL_iomux[10:11]
GPIO2-B6: GRF_GPIO2BL_iomux[12:13]
GPIO2-B7: GRF_GPIO2BH_iomux[0:2] (unchanged)

(GRF_GPIO2BL_iomux[0:13], GRF_GPIO2BH_iomux[0:2] are used)

According to RK3328 datasheet, the eMMC pins of RK3328 are GPIO0_A7/EMMC_D0, GPIO2_D4/EMMC_D1, GPIO2_D5/EMMC_D2, GPIO3_C1/EMMC_D6, GPIO3_C2/EMMC_D7, GPIO3_C3/EMMC_CMD, GPIO3_C5/EMMC_CLKOUT and GPIO3_C6/EMMC_PWREN, which are not the subject of the commit. So I don't know why these changes cause mmc module failure.

Comparing pinmux bits before and after the commit, the GRF_GPIO2BL_iomux[12:13] are being used and GRF_GPIO2BH_iomux[3:5] are no longer used. Maybe it's because the eMMC functionality depends on some of these bits to be set or not set?

The patch below is equivalent to revert 96903ed0e846 however is made easier to edit pinmux data for each pin. Try to apply the patch and reduce the changed items in rk3328_mux_recalced_data[] array as much as possible to figure out exactly which pinmux data fixed you issue.

drivers/pinctrl/pinctrl-rockchip.c +42 -0
index 3f56991f5b89..db835d7f053c 100644
@@ -640,6 +640,48 @@ static struct rockchip_mux_recalced_data 
 rk3328_mux_recalced_data[] = {
                .reg = 0x28,
                .bit = 0,
                .mask = 0x7
+       }, {
+               /* gpio2_b0_sel 3-bit */
+               .num = 2,
+               .pin = 8,
+               .reg = 0x24,
+               .bit = 0,
+               .mask = 0x7
+       }, {
+               /* gpio2_b1_sel 3-bit */
+               .num = 2,
+               .pin = 9,
+               .reg = 0x24,
+               .bit = 3,
+               .mask = 0x7
+       }, {
+               /* gpio2_b2_sel 3-bit, conflicting gpio2_b4_sel */
+               .num = 2,
+               .pin = 10,
+               .reg = 0x24,
+               .bit = 6,
+               .mask = 0x7
+       }, {
+               /* gpio2_b3_sel 3-bit, conflicting gpio2_b4_sel */
+               .num = 2,
+               .pin = 11,
+               .reg = 0x24,
+               .bit = 9,
+               .mask = 0x7
+       }, {
+               /* gpio2_b5_sel 3-bit, conflicting gpio2_b7_sel */
+               .num = 2,
+               .pin = 13,
+               .reg = 0x28,
+               .bit = 0,
+               .mask = 0x7
+       }, {
+               /* gpio2_b6_sel 3-bit */
+               .num = 2,
+               .pin = 14,
+               .reg = 0x28,
+               .bit = 3,
+               .mask = 0x7
        }, {
                /* gpio2_c7_sel */
                .num = 2,
Quoted 28 lines

Bao

Quoted 25 lines · On 7/8/24 02:45, [email protected] wrote:

Dear developers,

I am using a Rock64 board with an emmc module. I've upgraded kernel from 5.15.161 to .162, and since then the board wont boot up. Kernel messages show:

[   49.117131] mmc1: switch to bus width 8 failed [   49.124709]

mmc1: mmc_select_hs200 failed, error -110 [ 49.125190] mmc1: error
-110 whilst initialising MMC card [ 49.139566] mmc_host mmc1: Bus
speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div =
0) [ 105.437111] mmc1: switch to bus width 8 failed [ 105.446739]
mmc1: mmc_select_hs200 failed, error -110 [ 105.447246] mmc1: error -110 whilst initialising MMC card [ 105.461639] mmc_host mmc1: Bus speed (slot 0) = 200000Hz (slot req 200000Hz, actual 200000HZ div =
0)

I am using rk3328-rock64.dts from the kernel.

Bisecting the kernel revealed 96903ed0e846 as first bad commit. Reverting this commit on top of v5.15.162 makes my board bootup again.

Can you please take a look?

Thanks in advance, Richard

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#3 lore raw
Quoted 7 lines · On 7/9/24 02:05, [email protected] wrote:

Dear Bao,

Thanks for your response. Although these are deep technicals for me, I'll try to follow your instructions to debug the case. Does it matter in which order I'll try to remove recalc items? I'll need a day or two to finish with these, thanks for your patience. I'll report as soon as I can.

The order does not matter as we are trying to find exact "good" pinmux change from "good" pinmux change series. You can try to remove any item in each iteration. If your board still boots, then keep it removed and move on to next iteration. If your board does not boot, then the removed item is a "good" pinmux change so add it back to rk3328_mux_recalced_data[] array.

Eventually you would get one or multiple "good" pinmux items after multiple iterations. And this information would help us to triage the issue.

Bao

Quoted 144 lines

Regards,
Richard

2024-07-08 09:54 időpontban Huang-Huang Bao ezt írta:

Quoted 139 lines

Hi richard,

So the 96903ed0e846 ("pinctrl: rockchip: fix pinmux bits for RK3328 GPIO2-B pins") changed pinmux bits for GPIO2 B0-B3,B5-B6 from 2-bit width to 3-bit width.

Before the commit, we have the following pinmux bits, note the bit numbers in [start:end] are both inclusive.

GPIO2-B0: GRF_GPIO2BL_iomux[0:2]
GPIO2-B1: GRF_GPIO2BL_iomux[3:5]
GPIO2-B2: GRF_GPIO2BL_iomux[6:8]
GPIO2-B3: GRF_GPIO2BL_iomux[9:11]
GPIO2-B4: GRF_GPIO2BL_iomux[8:9] (unchanged)
GPIO2-B5: GRF_GPIO2BH_iomux[0:2]
GPIO2-B6: GRF_GPIO2BH_iomux[3:5]
GPIO2-B7: GRF_GPIO2BH_iomux[0:2] (unchanged)

(GRF_GPIO2BL_iomux[0:11], GRF_GPIO2BH_iomux[0:5] are used)

Notice that there are conflicting pinmux bits within GPIO2-B2, GPIO2-B3 and GPIO2-B4, and within GPIO2-B5 and GPIO2-B7. So this apparently looks wrong.

After the commit, pinmux bits for these pins changed to

GPIO2-B0: GRF_GPIO2BL_iomux[0:1]
GPIO2-B1: GRF_GPIO2BL_iomux[2:3]
GPIO2-B2: GRF_GPIO2BL_iomux[4:5]
GPIO2-B3: GRF_GPIO2BL_iomux[6:7]
GPIO2-B4: GRF_GPIO2BL_iomux[8:9] (unchanged)
GPIO2-B5: GRF_GPIO2BL_iomux[10:11]
GPIO2-B6: GRF_GPIO2BL_iomux[12:13]
GPIO2-B7: GRF_GPIO2BH_iomux[0:2] (unchanged)

(GRF_GPIO2BL_iomux[0:13], GRF_GPIO2BH_iomux[0:2] are used)

According to RK3328 datasheet, the eMMC pins of RK3328 are GPIO0_A7/EMMC_D0, GPIO2_D4/EMMC_D1, GPIO2_D5/EMMC_D2, GPIO3_C1/EMMC_D6, GPIO3_C2/EMMC_D7, GPIO3_C3/EMMC_CMD, GPIO3_C5/EMMC_CLKOUT and GPIO3_C6/EMMC_PWREN, which are not the subject of the commit. So I don't know why these changes cause mmc module failure.

Comparing pinmux bits before and after the commit, the GRF_GPIO2BL_iomux[12:13] are being used and GRF_GPIO2BH_iomux[3:5] are no longer used. Maybe it's because the eMMC functionality depends on some of these bits to be set or not set?

The patch below is equivalent to revert 96903ed0e846 however is made easier to edit pinmux data for each pin. Try to apply the patch and reduce the changed items in rk3328_mux_recalced_data[] array as much as possible to figure out exactly which pinmux data fixed you issue.

drivers/pinctrl/pinctrl-rockchip.c +0 -0
index 3f56991f5b89..db835d7f053c 100644
@@ -640,6 +640,48 @@ static struct rockchip_mux_recalced_data
 rk3328_mux_recalced_data[] = {
                 .reg = 0x28,
                 .bit = 0,

                .mask = 0x7
+       }, {
+               /* gpio2_b0_sel 3-bit */
+               .num = 2,
+               .pin = 8,
+               .reg = 0x24,
+               .bit = 0,
+               .mask = 0x7
+       }, {
+               /* gpio2_b1_sel 3-bit */
+               .num = 2,
+               .pin = 9,
+               .reg = 0x24,
+               .bit = 3,
+               .mask = 0x7
+       }, {
+               /* gpio2_b2_sel 3-bit, conflicting gpio2_b4_sel */ +               .num = 2,
+               .pin = 10,
+               .reg = 0x24,
+               .bit = 6,
+               .mask = 0x7
+       }, {
+               /* gpio2_b3_sel 3-bit, conflicting gpio2_b4_sel */ +               .num = 2,
+               .pin = 11,
+               .reg = 0x24,
+               .bit = 9,
+               .mask = 0x7
+       }, {
+               /* gpio2_b5_sel 3-bit, conflicting gpio2_b7_sel */ +               .num = 2,
+               .pin = 13,
+               .reg = 0x28,
+               .bit = 0,
+               .mask = 0x7
+       }, {
+               /* gpio2_b6_sel 3-bit */
+               .num = 2,
+               .pin = 14,
+               .reg = 0x28,
+               .bit = 3,
+               .mask = 0x7
        }, {
                /* gpio2_c7_sel */
                .num = 2,

Bao

Quoted 25 lines · On 7/8/24 02:45, [email protected] wrote:

Dear developers,

I am using a Rock64 board with an emmc module. I've upgraded kernel from 5.15.161 to .162, and since then the board wont boot up. Kernel messages show:

[   49.117131] mmc1: switch to bus width 8 failed [   49.124709]
mmc1: mmc_select_hs200 failed, error -110 [   49.125190] mmc1: error -110 whilst initialising MMC card [   49.139566] mmc_host mmc1: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div =
0) [  105.437111] mmc1: switch to bus width 8 failed [  105.446739]
mmc1: mmc_select_hs200 failed, error -110 [  105.447246] mmc1: error -110 whilst initialising MMC card [  105.461639] mmc_host mmc1: Bus speed (slot 0) = 200000Hz (slot req 200000Hz, actual 200000HZ div =
0)

I am using rk3328-rock64.dts from the kernel.

Bisecting the kernel revealed 96903ed0e846 as first bad commit. Reverting this commit on top of v5.15.162 makes my board bootup again.

Can you please take a look?

Thanks in advance, Richard

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#4 lore raw
In reply to a message not in the archive

Hi Richard,

I think I have figured out where the problem is, the wrong IOMUX_WIDTH_ flag(0) caused all pinmux offsets after GPIO2-B to be calculated wrong. The patch below should fixes the issue.

drivers/pinctrl/pinctrl-rockchip.c +1 -1
index 3f56991f5b89..f6da91941fbd 100644
@@ -3813,7 +3813,7 @@ static struct rockchip_pin_bank rk3328_pin_banks[] = {
        PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", 0, 0, 0, 0),
        PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0),
        PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0,
-                            0,
+                            IOMUX_WIDTH_2BIT,
                             IOMUX_WIDTH_3BIT,
                             0),
        PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3",

Please let me know if this works. I will send a formal patch later.

Sorry for the incident,
Bao

Quoted 19 lines · On 7/8/24 02:45, [email protected] wrote:

Dear developers,

I am using a Rock64 board with an emmc module. I've upgraded kernel from 5.15.161 to .162, and since then the board wont boot up. Kernel messages show:

[   49.117131] mmc1: switch to bus width 8 failed
[   49.124709] mmc1: mmc_select_hs200 failed, error -110
[   49.125190] mmc1: error -110 whilst initialising MMC card [   49.139566] mmc_host mmc1: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div = 0)
[  105.437111] mmc1: switch to bus width 8 failed
[  105.446739] mmc1: mmc_select_hs200 failed, error -110
[  105.447246] mmc1: error -110 whilst initialising MMC card [  105.461639] mmc_host mmc1: Bus speed (slot 0) = 200000Hz (slot req 200000Hz, actual 200000HZ div = 0)

I am using rk3328-rock64.dts from the kernel.

Quoted 7 lines

Bisecting the kernel revealed 96903ed0e846 as first bad commit. Reverting this commit on top of v5.15.162 makes my board bootup again.

Can you please take a look?

Thanks in advance,
Richard

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#5 lore raw

Hi Bao,

This change seems to be working.

Your quick response is really valuable. Thanks again.

Best regards,
Richard

2024-07-09 05:06 időpontban Huang-Huang Bao ezt írta:

Quoted 22 lines

Hi Richard,

I think I have figured out where the problem is, the wrong IOMUX_WIDTH_ flag(0) caused all pinmux offsets after GPIO2-B to be calculated wrong. The patch below should fixes the issue.

drivers/pinctrl/pinctrl-rockchip.c +1 -1
index 3f56991f5b89..f6da91941fbd 100644
@@ -3813,7 +3813,7 @@ static struct rockchip_pin_bank 
 rk3328_pin_banks[] = {
        PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", 0, 0, 0, 0),
        PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0),
        PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0,
-                            0,
+                            IOMUX_WIDTH_2BIT,
                             IOMUX_WIDTH_3BIT,
                             0),
        PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3",
Quoted 32 lines

Please let me know if this works. I will send a formal patch later.

Sorry for the incident,
Bao

Quoted 26 lines · On 7/8/24 02:45, [email protected] wrote:

Dear developers,

I am using a Rock64 board with an emmc module. I've upgraded kernel from 5.15.161 to .162, and since then the board wont boot up. Kernel messages show:

[   49.117131] mmc1: switch to bus width 8 failed
[   49.124709] mmc1: mmc_select_hs200 failed, error -110
[   49.125190] mmc1: error -110 whilst initialising MMC card [   49.139566] mmc_host mmc1: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div = 0)
[  105.437111] mmc1: switch to bus width 8 failed
[  105.446739] mmc1: mmc_select_hs200 failed, error -110
[  105.447246] mmc1: error -110 whilst initialising MMC card [  105.461639] mmc_host mmc1: Bus speed (slot 0) = 200000Hz (slot req 200000Hz, actual 200000HZ div = 0)

I am using rk3328-rock64.dts from the kernel.

Bisecting the kernel revealed 96903ed0e846 as first bad commit. Reverting this commit on top of v5.15.162 makes my board bootup again.

Can you please take a look?

Thanks in advance,
Richard

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip