pinctrl: sunxi: Fix H5 MMC access
Subsystems (4)
cover pinctrl: sunxi: Fix H5 MMC access
Commit 1396007286b1 ("pinctrl: sunxi: Enforce the strict mode by default") enabled the strict mode for the H5 pin controller driver, so that it denies multiple requests for a single pin.
However the existing DTs for the Allwinner H5 boards reference the CD pin for the micro SD card (MMC0) *twice* in their node, so that the driver stumbles upon the new strict mode and refuses to load:
...
sun50i-h5-pinctrl 1c20800.pinctrl: pin PF6 already requested by 1c0f000.mmc; cannot claim for 1c20800.pinctrl:166 sun50i-h5-pinctrl 1c20800.pinctrl: pin-166 (1c20800.pinctrl:166) status -22
sunxi-mmc: probe of 1c0f000.mmc failed with error -22
...
This prevents booting (from SD cards) on H5 boards.
This can be rather easily fixed by removing the redundant CD pin reference from the pinctrl-0 property of the MMC0 node, which patch 1/2 actually does.
However this now prevents existing DTs to boot with newer kernels (current Linus' HEAD, for instance), so we have to disable strict mode for the H5 as well (as we do with other SoCs already, including the H3).
Tested on the OrangePi PC2:
- current 4.15-rc0 boots with fixed DT (patch 1/2), but fails with older DTs
- 4.14 (and older) kernels boot with both older and this fixed DT
- 4.15-rc0 with patch 2/2 applied boots with both older and this fixed DTs
Thanks to Chris Obbard for reporting this.
Cheers,
Andre.
P.S. I was wondering if we should teach the MMC driver to cope with failing CD pin requests or let it detect the redundancy and avoid the second GPIO request instead. AFAICT this would allow to enable strict mode for the H5 again?
Andre Przywara (2):
arm64: dts: allwinner: H5: remove redundant MMC0 card detect pin
pinctrl: sunxi: Disable strict mode for H5 driver
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dts | 2 +- arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts | 2 +- arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts | 2 +- arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts | 2 +- arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts | 2 +- drivers/pinctrl/sunxi/pinctrl-sun50i-h5.c | 6 ++++-- 6 files changed, 9 insertions(+), 7 deletions(-)
Signature · 1 line
2.14.1
PATCH 1/2 arm64: dts: allwinner: H5: remove redundant MMC0 card detect pin
PF6 is mostly used as the CD pin for the microSD slot on H5 based boards. So far we were referencing this pin twice: once using the mmc0_cd_pin phandle, and then again directly as a GPIO via the pinctrl phandle.
This will cause problems if the pinctrl driver enables strict mode, as the second request will fail now, leading to a driver init failure. Remove the redundant pin reference via the mmc0_cd_pin phandle.
--- arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dts | 2 +- arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts | 2 +- arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts | 2 +- arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts | 2 +- arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dts +1 -1
@@ -135,7 +135,7 @@ &mmc0 { pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>; + pinctrl-0 = <&mmc0_pins_a>; vmmc-supply = <®_vcc3v3>; bus-width = <4>; cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts +1 -1
@@ -127,7 +127,7 @@ &mmc0 { pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>; + pinctrl-0 = <&mmc0_pins_a>; vmmc-supply = <®_vcc3v3>; bus-width = <4>; cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts +1 -1
@@ -161,7 +161,7 @@ &mmc0 { pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>; + pinctrl-0 = <&mmc0_pins_a>; vmmc-supply = <®_vcc3v3>; bus-width = <4>; cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts +1 -1
@@ -168,7 +168,7 @@ &mmc0 { pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>; + pinctrl-0 = <&mmc0_pins_a>; vmmc-supply = <®_vcc3v3>; bus-width = <4>; cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts +1 -1
@@ -68,7 +68,7 @@ &mmc0 { pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>; + pinctrl-0 = <&mmc0_pins_a>; vmmc-supply = <®_vcc3v3>; bus-width = <4>; cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
Signature · 1 line
2.14.1
PATCH 2/2 pinctrl: sunxi: Disable strict mode for H5 driver
In reply to Andre PrzywaraAll of the H5 boards in the kernel reference the MMC0 CD pin twice in their DT, so strict mode will make the MMC driver fail to load. To keep existing DTs working, disable strict mode in the H5 driver.
--- drivers/pinctrl/sunxi/pinctrl-sun50i-h5.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sun50i-h5.c +4 -2
@@ -535,14 +535,16 @@ static const struct sunxi_pinctrl_desc sun50i_h5_pinctrl_data_broken = { .pins = sun50i_h5_pins, .npins = ARRAY_SIZE(sun50i_h5_pins), .irq_banks = 2, - .irq_read_needs_mux = true + .irq_read_needs_mux = true, + .disable_strict_mode = true, };static const struct sunxi_pinctrl_desc sun50i_h5_pinctrl_data = { .pins = sun50i_h5_pins, .npins =ARRAY_SIZE (sun50i_h5_pins), .irq_banks =3 , - .irq_read_needs_mux = true + .irq_read_needs_mux = true, + .disable_strict_mode = true, };static int sun50i_h5_pinctrl_probe (struct platform_device *pdev)
Signature · 1 line
2.14.1
PATCH 2/2 pinctrl: sunxi: Disable strict mode for H5 driver
Quoted 6 lines · Andre Przywara
All of the H5 boards in the kernel reference the MMC0 CD pin twice in their DT, so strict mode will make the MMC driver fail to load. To keep existing DTs working, disable strict mode in the H5 driver.
Signed-off-by Andre Przywara <[email protected]>Reported-by Chris Obbard <[email protected]>
Sorry for missing that one...
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171127/9ab5f5ee/attachment.sig>
PATCH 1/2 arm64: dts: allwinner: H5: remove redundant MMC0 card detect pin
In reply to Andre PrzywaraQuoted 10 lines · Andre Przywara
PF6 is mostly used as the CD pin for the microSD slot on H5 based boards. So far we were referencing this pin twice: once using the
mmc0_cd_pinphandle, and then again directly as a GPIO via the pinctrl phandle.
This will cause problems if the pinctrl driver enables strict mode, as the second request will fail now, leading to a driver init failure. Remove the redundant pin reference via themmc0_cd_pinphandle.Signed-off-by Andre Przywara <[email protected]>Reported-by Chris Obbard <[email protected]>
Applied for 4.16, thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171127/bdda0a9e/attachment.sig>
PATCH 2/2 pinctrl: sunxi: Disable strict mode for H5 driver
In reply to Andre PrzywaraQuoted 6 lines · Andre Przywara
All of the H5 boards in the kernel reference the MMC0 CD pin twice in their DT, so strict mode will make the MMC driver fail to load. To keep existing DTs working, disable strict mode in the H5 driver.
Signed-off-by Andre Przywara <[email protected]>Reported-by Chris Obbard <[email protected]>
Patch applied with Maxime's ACK.
Yours,
Linus Walleij
PATCH 2/2 pinctrl: sunxi: Disable strict mode for H5 driver
Hi,
Quoted 10 lines · Linus Walleij
Quoted 6 lines · Andre Przywara
All of the H5 boards in the kernel reference the MMC0 CD pin twice in their DT, so strict mode will make the MMC driver fail to load. To keep existing DTs working, disable strict mode in the H5 driver.
Signed-off-by Andre Przywara <[email protected]>Reported-by Chris Obbard <[email protected]>Patch applied with Maxime's ACK.
Thanks for that (also to Maxime and Chen-Yu) and the smooth handling!
Sorry, I just see that I didn't point this out explicitly, but this is to fix a regression introduced in 4.15-rc1, so is this on a branch that will be pushed for 4.15-rc, still? (Couldn't find anything quickly on kernel.org)
Cheers,
Andre.
PATCH 2/2 pinctrl: sunxi: Disable strict mode for H5 driver
Quoted 10 lines · Andre Przywara
Quoted 9 lines · Linus Walleij
Quoted 6 lines · Andre Przywara
All of the H5 boards in the kernel reference the MMC0 CD pin twice in their DT, so strict mode will make the MMC driver fail to load. To keep existing DTs working, disable strict mode in the H5 driver.
Signed-off-by Andre Przywara <[email protected]>Reported-by Chris Obbard <[email protected]>
Quoted 8 lines
Quoted 1 line
Patch applied with Maxime's ACK.
Thanks for that (also to Maxime and Chen-Yu) and the smooth handling!
Sorry, I just see that I didn't point this out explicitly, but this is to fix a regression introduced in 4.15-rc1, so is this on a branch that will be pushed for 4.15-rc, still? (Couldn't find anything quickly on kernel.org)
Should be upstream as:
commit 07c43a382d7de3db01cc28bf2e17ed151cde2046
Yours,
Linus Walleij
Re: [PATCH 2/2] pinctrl: sunxi: Disable strict mode for H5 driver
In reply to a message not in the archiveExcellent, thanks Linus. The new DTS files are not in mainline, but this can wait ;-)
Cheers!
Quoted 28 lines · Linus Walleij
Quoted 2 lines · Andre Przywara
Quoted 1 line · Linus Walleij
On Sat, Nov 25, 2017 at 1:02 PM, Andre Przywara <[email protected]>
Quoted 8 lines · wrote:
Quoted 8 lines
Quoted 7 lines
All of the H5 boards in the kernel reference the MMC0 CD pin twice in their DT, so strict mode will make the MMC driver fail to load. To keep existing DTs working, disable strict mode in the H5 driver.
Signed-off-by Andre Przywara <[email protected]>Reported-by Chris Obbard <[email protected]>Quoted 8 lines
Quoted 1 line
Patch applied with Maxime's ACK.
Thanks for that (also to Maxime and Chen-Yu) and the smooth handling!
Sorry, I just see that I didn't point this out explicitly, but this is to fix a regression introduced in 4.15-rc1, so is this on a branch that will be pushed for 4.15-rc, still? (Couldn't find anything quickly on kernel.org)
Should be upstream as:
commit07c43a382d7de3db01cc28bf2e17ed151cde2046Yours,
Linus Walleij
Signature · 3 lines
You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit https://groups.google.com/d/optout.