linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] pinctrl: sunxi: Fix H5 MMC access
@ 2017-11-25 12:01 Andre Przywara
  2017-11-25 12:01 ` [PATCH 1/2] arm64: dts: allwinner: H5: remove redundant MMC0 card detect pin Andre Przywara
  2017-11-25 12:02 ` [PATCH 2/2] pinctrl: sunxi: Disable strict mode for H5 driver Andre Przywara
  0 siblings, 2 replies; 8+ messages in thread
From: Andre Przywara @ 2017-11-25 12:01 UTC (permalink / raw)
  To: linux-arm-kernel

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(-)

-- 
2.14.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] arm64: dts: allwinner: H5: remove redundant MMC0 card detect pin
  2017-11-25 12:01 [PATCH 0/2] pinctrl: sunxi: Fix H5 MMC access Andre Przywara
@ 2017-11-25 12:01 ` Andre Przywara
  2017-11-27  8:23   ` Maxime Ripard
  2017-11-25 12:02 ` [PATCH 2/2] pinctrl: sunxi: Disable strict mode for H5 driver Andre Przywara
  1 sibling, 1 reply; 8+ messages in thread
From: Andre Przywara @ 2017-11-25 12:01 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reported-by: Chris Obbard <obbardc@gmail.com>
---
 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(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dts
index 7c028af58f47..ea1101293892 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dts
@@ -135,7 +135,7 @@
 
 &mmc0 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
+	pinctrl-0 = <&mmc0_pins_a>;
 	vmmc-supply = <&reg_vcc3v3>;
 	bus-width = <4>;
 	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts
index 6eb8092d8e57..f1447003ea3c 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts
@@ -127,7 +127,7 @@
 
 &mmc0 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
+	pinctrl-0 = <&mmc0_pins_a>;
 	vmmc-supply = <&reg_vcc3v3>;
 	bus-width = <4>;
 	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
index a0ca925175aa..9e51d3a5f4e6 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
@@ -161,7 +161,7 @@
 
 &mmc0 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
+	pinctrl-0 = <&mmc0_pins_a>;
 	vmmc-supply = <&reg_vcc3v3>;
 	bus-width = <4>;
 	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts
index b47790650144..0f25c4a6f15d 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts
@@ -168,7 +168,7 @@
 
 &mmc0 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
+	pinctrl-0 = <&mmc0_pins_a>;
 	vmmc-supply = <&reg_vcc3v3>;
 	bus-width = <4>;
 	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
index b6b7a561df8c..69ac04516ddb 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
@@ -68,7 +68,7 @@
 
 &mmc0 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
+	pinctrl-0 = <&mmc0_pins_a>;
 	vmmc-supply = <&reg_vcc3v3>;
 	bus-width = <4>;
 	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] pinctrl: sunxi: Disable strict mode for H5 driver
  2017-11-25 12:01 [PATCH 0/2] pinctrl: sunxi: Fix H5 MMC access Andre Przywara
  2017-11-25 12:01 ` [PATCH 1/2] arm64: dts: allwinner: H5: remove redundant MMC0 card detect pin Andre Przywara
@ 2017-11-25 12:02 ` Andre Przywara
  2017-11-27  8:22   ` Maxime Ripard
  2017-11-30 15:51   ` Linus Walleij
  1 sibling, 2 replies; 8+ messages in thread
From: Andre Przywara @ 2017-11-25 12:02 UTC (permalink / raw)
  To: linux-arm-kernel

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 <andre.przywara@arm.com>
Reported-by: Chris Obbard <obbardc@gmail.com>
---
 drivers/pinctrl/sunxi/pinctrl-sun50i-h5.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-h5.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-h5.c
index 97b48336f84a..a78d7b922ef4 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun50i-h5.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-h5.c
@@ -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)
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] pinctrl: sunxi: Disable strict mode for H5 driver
  2017-11-25 12:02 ` [PATCH 2/2] pinctrl: sunxi: Disable strict mode for H5 driver Andre Przywara
@ 2017-11-27  8:22   ` Maxime Ripard
  2017-11-30 15:51   ` Linus Walleij
  1 sibling, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2017-11-27  8:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Nov 25, 2017 at 12:02:00PM +0000, Andre Przywara wrote:
> 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 <andre.przywara@arm.com>
> Reported-by: Chris Obbard <obbardc@gmail.com>

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Sorry for missing that one...

Thanks!
Maxime

-- 
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>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] arm64: dts: allwinner: H5: remove redundant MMC0 card detect pin
  2017-11-25 12:01 ` [PATCH 1/2] arm64: dts: allwinner: H5: remove redundant MMC0 card detect pin Andre Przywara
@ 2017-11-27  8:23   ` Maxime Ripard
  0 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2017-11-27  8:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Nov 25, 2017 at 12:01:59PM +0000, Andre Przywara wrote:
> 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.
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Reported-by: Chris Obbard <obbardc@gmail.com>

Applied for 4.16, thanks!
Maxime

-- 
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>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] pinctrl: sunxi: Disable strict mode for H5 driver
  2017-11-25 12:02 ` [PATCH 2/2] pinctrl: sunxi: Disable strict mode for H5 driver Andre Przywara
  2017-11-27  8:22   ` Maxime Ripard
@ 2017-11-30 15:51   ` Linus Walleij
  2017-11-30 16:07     ` Andre Przywara
  1 sibling, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2017-11-30 15:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Nov 25, 2017 at 1:02 PM, Andre Przywara <andre.przywara@arm.com> wrote:

> 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 <andre.przywara@arm.com>
> Reported-by: Chris Obbard <obbardc@gmail.com>

Patch applied with Maxime's ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] pinctrl: sunxi: Disable strict mode for H5 driver
  2017-11-30 15:51   ` Linus Walleij
@ 2017-11-30 16:07     ` Andre Przywara
  2017-12-12  8:52       ` Linus Walleij
  0 siblings, 1 reply; 8+ messages in thread
From: Andre Przywara @ 2017-11-30 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 30/11/17 15:51, Linus Walleij wrote:
> On Sat, Nov 25, 2017 at 1:02 PM, Andre Przywara <andre.przywara@arm.com> wrote:
> 
>> 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 <andre.przywara@arm.com>
>> Reported-by: Chris Obbard <obbardc@gmail.com>
> 
> 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] pinctrl: sunxi: Disable strict mode for H5 driver
  2017-11-30 16:07     ` Andre Przywara
@ 2017-12-12  8:52       ` Linus Walleij
  0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2017-12-12  8:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Nov 30, 2017 at 5:07 PM, Andre Przywara <andre.przywara@arm.com> wrote:
> On 30/11/17 15:51, Linus Walleij wrote:
>> On Sat, Nov 25, 2017 at 1:02 PM, Andre Przywara <andre.przywara@arm.com> wrote:
>>
>>> 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 <andre.przywara@arm.com>
>>> Reported-by: Chris Obbard <obbardc@gmail.com>
>>
>> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-12-12  8:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-25 12:01 [PATCH 0/2] pinctrl: sunxi: Fix H5 MMC access Andre Przywara
2017-11-25 12:01 ` [PATCH 1/2] arm64: dts: allwinner: H5: remove redundant MMC0 card detect pin Andre Przywara
2017-11-27  8:23   ` Maxime Ripard
2017-11-25 12:02 ` [PATCH 2/2] pinctrl: sunxi: Disable strict mode for H5 driver Andre Przywara
2017-11-27  8:22   ` Maxime Ripard
2017-11-30 15:51   ` Linus Walleij
2017-11-30 16:07     ` Andre Przywara
2017-12-12  8:52       ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).