mmc: sdhci-esdhci-imx: fix cd/wp regression
Subsystems (5)
v2 cover mmc: sdhci-esdhci-imx: fix cd/wp regression
This is a rebase version of former two patch series:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-June/351167.html
http://www.spinics.net/lists/arm-kernel/msg426156.html
No other changes.
Commit 8d86e4f mmc: sdhci-esdhc-imx: Call mmc_of_parse() seriously break the sd card detect/write protect function of most IMX platforms since a lot of GPIO flags of cd-gpios/wp-gpios are wrongly set in devicetree.
It breaks the following things:
1) cd-gpio function enable
Most IMX boards GPIO card detect function becomes unwork and using card polling mode instead by mistake.
Openning CONFIG_MMC_DEBUG will easily see that.
It is caused by the default quirk SDHCI_QUIRK_BROKEN_CARD_DETECTION is not cleared for dt platform by commit 8d86e4f, then MMC_CAP_NEEDS_POLL is wrongly set.
This is fixed by patch 6~7
2) cd-gpio/wp-gpio polarity
Before commit 8d86e4f, we do not use GPIO flags passed from devicetree. But after it, GPIO flags specfied in dt becomes valid and will affect the normal cd/wp function.
This is fixed by patch 1~5
3) max-frequency not work in sdhcimmc_of_parse will parse the max-frequency from devicetree, however, its value will be overwritten by common sdhci driver finnally,so it does not actually work.
Patch 8 is to fix it.
4) patch 9~11 clear unneeded parsing code after switch to mmc_of_parse().
The series is based on ulf/next tree.
I also CCed this patch series to all board maintainer related in this change, hope they can help test it.
I only tested some freescale IMX boards.
Dong Aisheng (11):
dts: imx51: fix sd card gpio polarity specified in device tree
dts: imx53: fix sd card gpio polarity specified in device tree
dts: imx6: fix sd card gpio polarity specified in device tree
dts: imx25: fix sd card gpio polarity specified in device tree
dts: imx7: fix sd card gpio polarity specified in device tree
mmc: sdhci-esdhc-imx: fix cd regression for dt platform
mmc: sdhci-esdhc-imx: move all non dt probe code into one function
mmc: sdhci: make max-frequency property in device tree work
mmc: sdhci-esdhc-imx: remove duplicated dts parsing
mmc: sdhci-esdhc-imx: clear f_max in boarddata
dts: mmc: fsl-imx-esdhc: remove fsl,cd-controller support
.../devicetree/bindings/mmc/fsl-imx-esdhc.txt | 2 - arch/arm/boot/dts/imx25-pdk.dts | 4 +- arch/arm/boot/dts/imx51-apf51dev.dts | 2 +- arch/arm/boot/dts/imx53-ard.dts | 4 +- arch/arm/boot/dts/imx53-m53evk.dts | 4 +- arch/arm/boot/dts/imx53-qsb-common.dtsi | 4 +- arch/arm/boot/dts/imx53-smd.dts | 4 +- arch/arm/boot/dts/imx53-tqma53.dtsi | 4 +- arch/arm/boot/dts/imx53-tx53.dtsi | 4 +- arch/arm/boot/dts/imx53-voipac-bsb.dts | 4 +- arch/arm/boot/dts/imx6dl-riotboard.dts | 8 +- arch/arm/boot/dts/imx6q-arm2.dts | 5 +- arch/arm/boot/dts/imx6q-gk802.dts | 3 +- arch/arm/boot/dts/imx6q-tbs2910.dts | 4 +- arch/arm/boot/dts/imx6qdl-aristainetos.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-cubox-i.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-gw52xx.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-gw53xx.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-gw54xx.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-hummingboard.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi | 8 +- arch/arm/boot/dts/imx6qdl-rex.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-sabrelite.dtsi | 6 +- arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 8 +- arch/arm/boot/dts/imx6qdl-tx6.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-wandboard.dtsi | 6 +- arch/arm/boot/dts/imx6sl-evk.dts | 10 +- arch/arm/boot/dts/imx6sx-sabreauto.dts | 4 +- arch/arm/boot/dts/imx6sx-sdb.dtsi | 4 +- arch/arm/boot/dts/imx7d-sdb.dts | 4 +- drivers/mmc/host/sdhci-esdhc-imx.c | 210 ++++++++++----------- drivers/mmc/host/sdhci.c | 9 +- include/linux/platform_data/mmc-esdhc-imx.h | 1 - 37 files changed, 185 insertions(+), 179 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/11 dts: imx51: fix sd card gpio polarity specified in device tree
cd-gpios polarity should be changed to GPIO_ACTIVE_LOW and wp-gpios should be changed to GPIO_ACTIVE_HIGH.
Otherwise, the SD may not work properly due to wrong polarity inversion specified in DT after switch to common parsing function mmc_of_parse().
--- arch/arm/boot/dts/imx51-apf51dev.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx51-apf51dev.dts +1 -1
@@ -98,7 +98,7 @@ &esdhc1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_esdhc1>; - cd-gpios = <&gpio2 29 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio2 29 GPIO_ACTIVE_LOW>; bus-width = <4>; status = "okay"; };
Signature · 1 line
1.9.1
PATCH v2 2/11 dts: imx53: fix sd card gpio polarity specified in device tree
In reply to Dong Aishengcd-gpios polarity should be changed to GPIO_ACTIVE_LOW and wp-gpios should be changed to GPIO_ACTIVE_HIGH.
Otherwise, the SD may not work properly due to wrong polarity inversion specified in DT after switch to common parsing function mmc_of_parse().
--- arch/arm/boot/dts/imx53-ard.dts | 4 ++-- arch/arm/boot/dts/imx53-m53evk.dts | 4 ++-- arch/arm/boot/dts/imx53-qsb-common.dtsi | 4 ++-- arch/arm/boot/dts/imx53-smd.dts | 4 ++-- arch/arm/boot/dts/imx53-tqma53.dtsi | 4 ++-- arch/arm/boot/dts/imx53-tx53.dtsi | 4 ++-- arch/arm/boot/dts/imx53-voipac-bsb.dts | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-)
arch/arm/boot/dts/imx53-ard.dts +2 -2
@@ -103,8 +103,8 @@ &esdhc1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_esdhc1>; - cd-gpios = <&gpio1 1 0>; - wp-gpios = <&gpio1 9 0>; + cd-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; status = "okay"; };
arch/arm/boot/dts/imx53-m53evk.dts +2 -2
@@ -124,8 +124,8 @@ &esdhc1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_esdhc1>; - cd-gpios = <&gpio1 1 0>; - wp-gpios = <&gpio1 9 0>; + cd-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; status = "okay"; };
arch/arm/boot/dts/imx53-qsb-common.dtsi +2 -2
@@ -147,8 +147,8 @@ &esdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_esdhc3>; - cd-gpios = <&gpio3 11 0>; - wp-gpios = <&gpio3 12 0>; + cd-gpios = <&gpio3 11 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio3 12 GPIO_ACTIVE_HIGH>; bus-width = <8>; status = "okay"; };
arch/arm/boot/dts/imx53-smd.dts +2 -2
@@ -41,8 +41,8 @@ &esdhc1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_esdhc1>; - cd-gpios = <&gpio3 13 0>; - wp-gpios = <&gpio4 11 0>; + cd-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio4 11 GPIO_ACTIVE_HIGH>; status = "okay"; };
arch/arm/boot/dts/imx53-tqma53.dtsi +2 -2
@@ -41,8 +41,8 @@ pinctrl-0 = <&pinctrl_esdhc2>, <&pinctrl_esdhc2_cdwp>; vmmc-supply = <®_3p3v>; - wp-gpios = <&gpio1 2 0>; - cd-gpios = <&gpio1 4 0>; + wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; status = "disabled"; };
arch/arm/boot/dts/imx53-tx53.dtsi +2 -2
@@ -183,7 +183,7 @@ }; &esdhc1 { - cd-gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio3 24 GPIO_ACTIVE_LOW>; fsl,wp-controller; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_esdhc1>;
@@ -191,7 +191,7 @@ }; &esdhc2 { - cd-gpios = <&gpio3 25 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio3 25 GPIO_ACTIVE_LOW>; fsl,wp-controller; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_esdhc2>;
arch/arm/boot/dts/imx53-voipac-bsb.dts +2 -2
@@ -119,8 +119,8 @@ &esdhc2 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_esdhc2>; - cd-gpios = <&gpio3 25 0>; - wp-gpios = <&gpio2 19 0>; + cd-gpios = <&gpio3 25 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio2 19 GPIO_ACTIVE_HIGH>; vmmc-supply = <®_3p3v>; status = "okay"; };
Signature · 1 line
1.9.1
PATCH v2 3/11 dts: imx6: fix sd card gpio polarity specified in device tree
In reply to Dong Aishengcd-gpios polarity should be changed to GPIO_ACTIVE_LOW and wp-gpios should be changed to GPIO_ACTIVE_HIGH.
Otherwise, the SD may not work properly due to wrong polarity inversion specified in DT after switch to common parsing function mmc_of_parse().
--- arch/arm/boot/dts/imx6dl-riotboard.dts | 8 ++++---- arch/arm/boot/dts/imx6q-arm2.dts | 5 +++-- arch/arm/boot/dts/imx6q-gk802.dts | 3 ++- arch/arm/boot/dts/imx6q-tbs2910.dts | 4 ++-- arch/arm/boot/dts/imx6qdl-aristainetos.dtsi | 4 ++-- arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi | 4 ++-- arch/arm/boot/dts/imx6qdl-cubox-i.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi | 4 +++- arch/arm/boot/dts/imx6qdl-gw52xx.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-gw53xx.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-gw54xx.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-hummingboard.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi | 4 ++-- arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi | 8 ++++---- arch/arm/boot/dts/imx6qdl-rex.dtsi | 4 ++-- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 4 ++-- arch/arm/boot/dts/imx6qdl-sabrelite.dtsi | 6 +++--- arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 8 ++++---- arch/arm/boot/dts/imx6qdl-tx6.dtsi | 4 ++-- arch/arm/boot/dts/imx6qdl-wandboard.dtsi | 6 ++++-- arch/arm/boot/dts/imx6sl-evk.dts | 10 +++++----- arch/arm/boot/dts/imx6sx-sabreauto.dts | 4 ++-- arch/arm/boot/dts/imx6sx-sdb.dtsi | 4 ++-- 23 files changed, 55 insertions(+), 49 deletions(-)
arch/arm/boot/dts/imx6dl-riotboard.dts +4 -4
@@ -305,8 +305,8 @@ &usdhc2 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; - cd-gpios = <&gpio1 4 0>; - wp-gpios = <&gpio1 2 0>; + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; vmmc-supply = <®_3p3v>; status = "okay"; };
@@ -314,8 +314,8 @@ &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio7 0 0>; - wp-gpios = <&gpio7 1 0>; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6q-arm2.dts +3 -2
@@ -11,6 +11,7 @@ */ /dts-v1/; +#include <dt-bindings/gpio/gpio.h> #include "imx6q.dtsi" / {
@@ -196,8 +197,8 @@ }; &usdhc3 { - cd-gpios = <&gpio6 11 0>; - wp-gpios = <&gpio6 14 0>; + cd-gpios = <&gpio6 11 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio6 14 GPIO_ACTIVE_HIGH>; vmmc-supply = <®_3p3v>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3
arch/arm/boot/dts/imx6q-gk802.dts +2 -1
@@ -7,6 +7,7 @@ */ /dts-v1/; +#include <dt-bindings/gpio/gpio.h> #include "imx6q.dtsi" / {
@@ -161,7 +162,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; bus-width = <4>; - cd-gpios = <&gpio6 11 0>; + cd-gpios = <&gpio6 11 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6q-tbs2910.dts +2 -2
@@ -251,7 +251,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; bus-width = <4>; - cd-gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
@@ -260,7 +260,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; bus-width = <4>; - cd-gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; vmmc-supply = <®_3p3v>; status = "okay";
arch/arm/boot/dts/imx6qdl-aristainetos.dtsi +2 -2
@@ -173,7 +173,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc1>; vmmc-supply = <®_3p3v>; - cd-gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio4 7 GPIO_ACTIVE_LOW>; status = "okay"; };
@@ -181,7 +181,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; vmmc-supply = <®_3p3v>; - cd-gpios = <&gpio4 8 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio4 8 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi +2 -2
@@ -392,7 +392,7 @@ &usdhc1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc1>; - cd-gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; no-1-8-v; status = "okay"; };
@@ -400,7 +400,7 @@ &usdhc2 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; - cd-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio4 5 GPIO_ACTIVE_LOW>; wp-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>; no-1-8-v; status = "okay";
arch/arm/boot/dts/imx6qdl-cubox-i.dtsi +1 -1
@@ -258,6 +258,6 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_cubox_i_usdhc2_aux &pinctrl_cubox_i_usdhc2>; vmmc-supply = <®_3p3v>; - cd-gpios = <&gpio1 4 0>; + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi +3 -1
@@ -1,3 +1,5 @@ +#include <dt-bindings/gpio/gpio.h> + / { regulators { compatible = "simple-bus";
@@ -181,7 +183,7 @@ &usdhc2 { /* module slot */ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; - cd-gpios = <&gpio2 2 0>; + cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-gw52xx.dtsi +1 -1
@@ -318,7 +318,7 @@ &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-gw53xx.dtsi +1 -1
@@ -324,7 +324,7 @@ &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-gw54xx.dtsi +1 -1
@@ -417,7 +417,7 @@ &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-hummingboard.dtsi +1 -1
@@ -299,6 +299,6 @@ &pinctrl_hummingboard_usdhc2 >; vmmc-supply = <®_3p3v>; - cd-gpios = <&gpio1 4 0>; + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi +2 -2
@@ -453,7 +453,7 @@ &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio7 0 0>; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
@@ -461,7 +461,7 @@ &usdhc4 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc4>; - cd-gpios = <&gpio2 6 0>; + cd-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi +4 -4
@@ -409,8 +409,8 @@ &usdhc2 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; - cd-gpios = <&gpio1 4 0>; - wp-gpios = <&gpio1 2 0>; + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; status = "disabled"; };
@@ -418,7 +418,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3 &pinctrl_usdhc3_cdwp>; - cd-gpios = <&gpio1 27 0>; - wp-gpios = <&gpio1 29 0>; + cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>; status = "disabled"; };
arch/arm/boot/dts/imx6qdl-rex.dtsi +2 -2
@@ -342,7 +342,7 @@ pinctrl-0 = <&pinctrl_usdhc2>; bus-width = <4>; cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; - wp-gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>; status = "okay"; };
@@ -351,6 +351,6 @@ pinctrl-0 = <&pinctrl_usdhc3>; bus-width = <4>; cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; - wp-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +2 -2
@@ -467,8 +467,8 @@ pinctrl-0 = <&pinctrl_usdhc3>; pinctrl-1 = <&pinctrl_usdhc3_100mhz>; pinctrl-2 = <&pinctrl_usdhc3_200mhz>; - cd-gpios = <&gpio6 15 0>; - wp-gpios = <&gpio1 13 0>; + cd-gpios = <&gpio6 15 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +3 -3
@@ -448,8 +448,8 @@ &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio7 0 0>; - wp-gpios = <&gpio7 1 0>; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>; vmmc-supply = <®_3p3v>; status = "okay"; };
@@ -457,7 +457,7 @@ &usdhc4 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc4>; - cd-gpios = <&gpio2 6 0>; + cd-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +4 -4
@@ -562,8 +562,8 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; bus-width = <8>; - cd-gpios = <&gpio2 2 0>; - wp-gpios = <&gpio2 3 0>; + cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>; status = "okay"; };
@@ -571,8 +571,8 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; bus-width = <8>; - cd-gpios = <&gpio2 0 0>; - wp-gpios = <&gpio2 1 0>; + cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-tx6.dtsi +2 -2
@@ -680,7 +680,7 @@ pinctrl-0 = <&pinctrl_usdhc1>; bus-width = <4>; no-1-8-v; - cd-gpios = <&gpio7 2 0>; + cd-gpios = <&gpio7 2 GPIO_ACTIVE_LOW>; fsl,wp-controller; status = "okay"; };
@@ -690,7 +690,7 @@ pinctrl-0 = <&pinctrl_usdhc2>; bus-width = <4>; no-1-8-v; - cd-gpios = <&gpio7 3 0>; + cd-gpios = <&gpio7 3 GPIO_ACTIVE_LOW>; fsl,wp-controller; status = "okay"; };
arch/arm/boot/dts/imx6qdl-wandboard.dtsi +4 -2
@@ -9,6 +9,8 @@ * */ +#include <dt-bindings/gpio/gpio.h> + / { regulators { compatible = "simple-bus";
@@ -250,13 +252,13 @@ &usdhc1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc1>; - cd-gpios = <&gpio1 2 0>; + cd-gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; status = "okay"; }; &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio3 9 0>; + cd-gpios = <&gpio3 9 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/boot/dts/imx6sl-evk.dts +5 -5
@@ -617,8 +617,8 @@ pinctrl-1 = <&pinctrl_usdhc1_100mhz>; pinctrl-2 = <&pinctrl_usdhc1_200mhz>; bus-width = <8>; - cd-gpios = <&gpio4 7 0>; - wp-gpios = <&gpio4 6 0>; + cd-gpios = <&gpio4 7 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; status = "okay"; };
@@ -627,8 +627,8 @@ pinctrl-0 = <&pinctrl_usdhc2>; pinctrl-1 = <&pinctrl_usdhc2_100mhz>; pinctrl-2 = <&pinctrl_usdhc2_200mhz>; - cd-gpios = <&gpio5 0 0>; - wp-gpios = <&gpio4 29 0>; + cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>; status = "okay"; };
@@ -637,6 +637,6 @@ pinctrl-0 = <&pinctrl_usdhc3>; pinctrl-1 = <&pinctrl_usdhc3_100mhz>; pinctrl-2 = <&pinctrl_usdhc3_200mhz>; - cd-gpios = <&gpio3 22 0>; + cd-gpios = <&gpio3 22 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/boot/dts/imx6sx-sabreauto.dts +2 -2
@@ -49,7 +49,7 @@ pinctrl-1 = <&pinctrl_usdhc3_100mhz>; pinctrl-2 = <&pinctrl_usdhc3_200mhz>; bus-width = <8>; - cd-gpios = <&gpio7 10 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio7 10 GPIO_ACTIVE_LOW>; wp-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>; keep-power-in-suspend; enable-sdio-wakeup;
@@ -61,7 +61,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc4>; bus-width = <8>; - cd-gpios = <&gpio7 11 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio7 11 GPIO_ACTIVE_LOW>; no-1-8-v; keep-power-in-suspend; enable-sdio-wakup;
arch/arm/boot/dts/imx6sx-sdb.dtsi +2 -2
@@ -293,7 +293,7 @@ pinctrl-1 = <&pinctrl_usdhc3_100mhz>; pinctrl-2 = <&pinctrl_usdhc3_200mhz>; bus-width = <8>; - cd-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; wp-gpios = <&gpio2 15 GPIO_ACTIVE_HIGH>; keep-power-in-suspend; enable-sdio-wakeup;
@@ -304,7 +304,7 @@ &usdhc4 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc4>; - cd-gpios = <&gpio6 21 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio6 21 GPIO_ACTIVE_LOW>; wp-gpios = <&gpio6 20 GPIO_ACTIVE_HIGH>; status = "okay"; };
Signature · 1 line
1.9.1
PATCH v2 4/11 dts: imx25: fix sd card gpio polarity specified in device tree
In reply to Dong Aishengcd-gpios polarity should be changed to GPIO_ACTIVE_LOW and wp-gpios should be changed to GPIO_ACTIVE_HIGH.
Otherwise, the SD may not work properly due to wrong polarity inversion specified in DT after switch to common parsing function mmc_of_parse().
--- arch/arm/boot/dts/imx25-pdk.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx25-pdk.dts +2 -2
@@ -114,8 +114,8 @@ &esdhc1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_esdhc1>; - cd-gpios = <&gpio2 1 0>; - wp-gpios = <&gpio2 0 0>; + cd-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>; status = "okay"; };
Signature · 1 line
1.9.1
PATCH v2 5/11 dts: imx7: fix sd card gpio polarity specified in device tree
In reply to Dong Aishengcd-gpios polarity should be changed to GPIO_ACTIVE_LOW and wp-gpios should be changed to GPIO_ACTIVE_HIGH.
Otherwise, the SD may not work properly due to wrong polarity inversion specified in DT after switch to common parsing function mmc_of_parse().
--- arch/arm/boot/dts/imx7d-sdb.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx7d-sdb.dts +2 -2
@@ -234,8 +234,8 @@ &usdhc1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc1>; - cd-gpios = <&gpio5 0 0>; - wp-gpios = <&gpio5 1 0>; + cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; enable-sdio-wakeup; keep-power-in-suspend; status = "okay";
Signature · 1 line
1.9.1
PATCH v2 6/11 mmc: sdhci-esdhc-imx: fix cd regression for dt platform
In reply to Dong AishengCurrent card detect probe process is that when driver finds a valid ESDHC_CD_GPIO, it will clear the quirk SDHCI_QUIRK_BROKEN_CARD_DETECTION which is set by default for all esdhc/usdhc controllers. Then host driver will know there's a valid card detect function.
Commit 8d86e4fcccf6 ("mmc: sdhci-esdhc-imx: Call mmc_of_parse()") breaks GPIO CD function for dt platform that it will return directly when find ESDHC_CD_GPIO for dt platform which result in the later wrongly to keep SDHCI_QUIRK_BROKEN_CARD_DETECTION for all dt platforms. Then MMC_CAP_NEEDS_POLL will be used instead even there's a valid GPIO card detect.
This patch adds back this function and follows the original approach to clear the quirk if find an valid CD GPIO for dt platforms.
--- drivers/mmc/host/sdhci-esdhc-imx.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-esdhc-imx.c +9 -1
@@ -881,6 +881,7 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, struct esdhc_platform_data *boarddata) {struct device_node *np = pdev->dev.of_node; +int ret;if (!np)return -ENODEV ;
@@ -917,7 +918,14 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,mmc_of_parse_voltage (np, &host->ocr_mask);/* call to generic mmc_of_parse to support additional capabilities */ -return mmc_of_parse (host->mmc); + ret =mmc_of_parse (host->mmc); +if (ret) +return ret; + +if (!IS_ERR_VALUE (mmc_gpio_get_cd (host->mmc))) + host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION ; + +return 0 ; }#else static inline int
Signature · 1 line
1.9.1
PATCH v2 6/11 mmc: sdhci-esdhc-imx: fix cd regression for dt platform
Hi Dong,
Just hit that issue in 4.1, could we add that patch also to stable?
--
Stefan
Quoted 50 lines · Dong Aisheng
Current card detect probe process is that when driver finds a valid
ESDHC_CD_GPIO, it will clear the quirkSDHCI_QUIRK_BROKEN_CARD_DETECTIONwhich is set by default for all esdhc/usdhc controllers. Then host driver will know there's a valid card detect function.Commit
8d86e4fcccf6("mmc: sdhci-esdhc-imx: Callmmc_of_parse()") breaks GPIO CD function for dt platform that it will return directly when findESDHC_CD_GPIOfor dt platform which result in the later wrongly to keepSDHCI_QUIRK_BROKEN_CARD_DETECTIONfor all dt platforms. ThenMMC_CAP_NEEDS_POLLwill be used instead even there's a valid GPIO card detect.This patch adds back this function and follows the original approach to clear the quirk if find an valid CD GPIO for dt platforms.
Fixes 8d86e4fcccf6 ("mmc: sdhci-esdhc-imx: Call mmc_of_parse()")Signed-off-by Dong Aisheng <[email protected]>--- drivers/mmc/host/sdhci-esdhc-imx.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci-esdhc-imx.c +9
-1@@ -881,6 +881,7 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, struct esdhc_platform_data *boarddata) {struct device_node *np = pdev->dev.of_node; +int ret;if (!np)return -ENODEV ;@@ -917,7 +918,14 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,mmc_of_parse_voltage (np, &host->ocr_mask);/* call to generic mmc_of_parse to support additional capabilities */ -return mmc_of_parse (host->mmc); + ret =mmc_of_parse (host->mmc); +if (ret) +return ret; + +if (!IS_ERR_VALUE (mmc_gpio_get_cd (host->mmc))) + host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION ; + +return 0 ; }#else static inline int
Fabio Estevam
reviewerPATCH v2 6/11 mmc: sdhci-esdhc-imx: fix cd regression for dt platform
Hi Stefan,
Quoted 3 lines · Stefan Agner
Hi Dong,
Just hit that issue in 4.1, could we add that patch also to stable?
I sent the series to stable, but Greg has not applied it yet.
Fabio Estevam
reviewerPATCH v2 6/11 mmc: sdhci-esdhc-imx: fix cd regression for dt platform
Quoted 8 lines · Fabio Estevam
Hi Stefan,
Quoted 3 lines · Stefan Agner
Hi Dong,
Just hit that issue in 4.1, could we add that patch also to stable?
I sent the series to stable, but Greg has not applied it yet.
Greg applied the series and it appears now in 4.1.11.
PATCH v2 6/11 mmc: sdhci-esdhc-imx: fix cd regression for dt platform
Quoted 11 lines · Fabio Estevam
Quoted 8 lines · Fabio Estevam
Hi Stefan,
Quoted 3 lines · Stefan Agner
Hi Dong,
Just hit that issue in 4.1, could we add that patch also to stable?
I sent the series to stable, but Greg has not applied it yet.
Greg applied the series and it appears now in 4.1.11.
I need to finish a full bisect run, but one of these sdhci-esdhci-imx fixes broke the wandboard..
v4.1.10:
voodoo at a3-imx6q-wandboard-2gb:~$ dmesg | grep mmc2
[ 4.844563] mmc2: SDHCI controller on 2198000.usdhc [2198000.usdhc] using ADMA [ 5.132859] mmc2: host does not support reading read-only switch, assuming write-enable [ 5.147150] mmc2: new high speed SDHC card at address 0007 [ 5.153245] mmcblk0: mmc2:0007 SD8GB 7.42 GiB voodoo at a3-imx6q-wandboard-2gb:~$ dmesg | grep 2198000.usdhc [ 4.779415] sdhci-esdhc-imx 2198000.usdhc: could not get ultra high speed state, work on normal mode [ 4.788589] sdhci-esdhc-imx 2198000.usdhc: Got CD GPIO [ 4.793910] sdhci-esdhc-imx 2198000.usdhc: No vmmc regulator found [ 4.800133] sdhci-esdhc-imx 2198000.usdhc: No vqmmc regulator found [ 4.844563] mmc2: SDHCI controller on 2198000.usdhc [2198000.usdhc]
using ADMA
v4.1.11:
root at a4-imx6q-wandboard-2gb:~# dmesg | grep mmc2
[ 4.854721] mmc2: SDHCI controller on 2198000.usdhc [2198000.usdhc] using ADMA root at a4-imx6q-wandboard-2gb:~# dmesg | grep 2198000.usdhc [ 4.781491] sdhci-esdhc-imx 2198000.usdhc: Got CD GPIO [ 4.786689] sdhci-esdhc-imx 2198000.usdhc: could not get ultra high speed state, work on normal mode [ 4.796023] sdhci-esdhc-imx 2198000.usdhc: No vmmc regulator found [ 4.802229] sdhci-esdhc-imx 2198000.usdhc: No vqmmc regulator found [ 4.854721] mmc2: SDHCI controller on 2198000.usdhc [2198000.usdhc]
using ADMA
Regards,
Signature · 2 lines
Robert Nelson https://rcn-ee.com/
Fabio Estevam
reviewerPATCH v2 6/11 mmc: sdhci-esdhc-imx: fix cd regression for dt platform
Quoted 2 lines · Robert Nelson
I need to finish a full bisect run, but one of these sdhci-esdhci-imx fixes broke the wandboard..
Could you please try to apply the attached patch?
Looks like this one was not applied.
-------------- next part --------------
Quoted 1 line
From
15b04d12d0e8ae4f81eca0a29e4453733a5b6624Mon Sep 17 00:00:00 2001
From: Dong Aisheng <[email protected]>
Date: Wed, 22 Jul 2015 20:53:02 +0800
Subject: [PATCH 6/7] dts: imx6: fix sd card gpio polarity specified in device tree
commit 89c1a8cf63f8c69dfddb6e377c04df8b25ab1c88 upstream.
cd-gpios polarity should be changed to GPIO_ACTIVE_LOW and wp-gpios should be changed to GPIO_ACTIVE_HIGH.
Otherwise, the SD may not work properly due to wrong polarity inversion specified in DT after switch to common parsing function mmc_of_parse().
[fabio: Include <dt-bindings/gpio/gpio.h> for imx6qdl-hummingboard.dtsi]
--- arch/arm/boot/dts/imx6dl-riotboard.dts | 8 ++++---- arch/arm/boot/dts/imx6q-arm2.dts | 5 +++-- arch/arm/boot/dts/imx6q-gk802.dts | 3 ++- arch/arm/boot/dts/imx6q-tbs2910.dts | 4 ++-- arch/arm/boot/dts/imx6qdl-aristainetos.dtsi | 4 ++-- arch/arm/boot/dts/imx6qdl-cubox-i.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi | 4 +++- arch/arm/boot/dts/imx6qdl-gw52xx.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-gw53xx.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-gw54xx.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-hummingboard.dtsi | 3 ++- arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi | 4 ++-- arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi | 8 ++++---- arch/arm/boot/dts/imx6qdl-rex.dtsi | 4 ++-- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 4 ++-- arch/arm/boot/dts/imx6qdl-sabrelite.dtsi | 6 +++--- arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 8 ++++---- arch/arm/boot/dts/imx6qdl-tx6.dtsi | 4 ++-- arch/arm/boot/dts/imx6qdl-wandboard.dtsi | 6 ++++-- arch/arm/boot/dts/imx6sl-evk.dts | 10 +++++----- arch/arm/boot/dts/imx6sx-sabreauto.dts | 4 ++-- arch/arm/boot/dts/imx6sx-sdb.dtsi | 4 ++-- 22 files changed, 54 insertions(+), 47 deletions(-)
arch/arm/boot/dts/imx6dl-riotboard.dts +4 -4
@@ -305,8 +305,8 @@ &usdhc2 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; - cd-gpios = <&gpio1 4 0>; - wp-gpios = <&gpio1 2 0>; + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; vmmc-supply = <®_3p3v>; status = "okay"; };
@@ -314,8 +314,8 @@ &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio7 0 0>; - wp-gpios = <&gpio7 1 0>; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6q-arm2.dts +3 -2
@@ -11,6 +11,7 @@ */ /dts-v1/; +#include <dt-bindings/gpio/gpio.h> #include "imx6q.dtsi" / {
@@ -196,8 +197,8 @@ }; &usdhc3 { - cd-gpios = <&gpio6 11 0>; - wp-gpios = <&gpio6 14 0>; + cd-gpios = <&gpio6 11 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio6 14 GPIO_ACTIVE_HIGH>; vmmc-supply = <®_3p3v>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3
arch/arm/boot/dts/imx6q-gk802.dts +2 -1
@@ -7,6 +7,7 @@ */ /dts-v1/; +#include <dt-bindings/gpio/gpio.h> #include "imx6q.dtsi" / {
@@ -161,7 +162,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; bus-width = <4>; - cd-gpios = <&gpio6 11 0>; + cd-gpios = <&gpio6 11 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6q-tbs2910.dts +2 -2
@@ -251,7 +251,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; bus-width = <4>; - cd-gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
@@ -260,7 +260,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; bus-width = <4>; - cd-gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; vmmc-supply = <®_3p3v>; status = "okay";
arch/arm/boot/dts/imx6qdl-aristainetos.dtsi +2 -2
@@ -173,7 +173,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc1>; vmmc-supply = <®_3p3v>; - cd-gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio4 7 GPIO_ACTIVE_LOW>; status = "okay"; };
@@ -181,7 +181,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; vmmc-supply = <®_3p3v>; - cd-gpios = <&gpio4 8 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio4 8 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-cubox-i.dtsi +1 -1
@@ -259,6 +259,6 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_cubox_i_usdhc2_aux &pinctrl_cubox_i_usdhc2>; vmmc-supply = <®_3p3v>; - cd-gpios = <&gpio1 4 0>; + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi +3 -1
@@ -1,3 +1,5 @@ +#include <dt-bindings/gpio/gpio.h> + / { regulators { compatible = "simple-bus";
@@ -181,7 +183,7 @@ &usdhc2 { /* module slot */ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; - cd-gpios = <&gpio2 2 0>; + cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-gw52xx.dtsi +1 -1
@@ -318,7 +318,7 @@ &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-gw53xx.dtsi +1 -1
@@ -324,7 +324,7 @@ &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-gw54xx.dtsi +1 -1
@@ -417,7 +417,7 @@ &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-hummingboard.dtsi +2 -1
@@ -41,6 +41,7 @@ */ #include "imx6qdl-microsom.dtsi" #include "imx6qdl-microsom-ar8035.dtsi" +#include <dt-bindings/gpio/gpio.h> / { chosen {
@@ -288,6 +289,6 @@ &pinctrl_hummingboard_usdhc2 >; vmmc-supply = <®_3p3v>; - cd-gpios = <&gpio1 4 0>; + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi +2 -2
@@ -449,7 +449,7 @@ &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio7 0 0>; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
@@ -457,7 +457,7 @@ &usdhc4 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc4>; - cd-gpios = <&gpio2 6 0>; + cd-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi +4 -4
@@ -409,8 +409,8 @@ &usdhc2 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; - cd-gpios = <&gpio1 4 0>; - wp-gpios = <&gpio1 2 0>; + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; status = "disabled"; };
@@ -418,7 +418,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3 &pinctrl_usdhc3_cdwp>; - cd-gpios = <&gpio1 27 0>; - wp-gpios = <&gpio1 29 0>; + cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>; status = "disabled"; };
arch/arm/boot/dts/imx6qdl-rex.dtsi +2 -2
@@ -342,7 +342,7 @@ pinctrl-0 = <&pinctrl_usdhc2>; bus-width = <4>; cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; - wp-gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>; status = "okay"; };
@@ -351,6 +351,6 @@ pinctrl-0 = <&pinctrl_usdhc3>; bus-width = <4>; cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; - wp-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +2 -2
@@ -467,8 +467,8 @@ pinctrl-0 = <&pinctrl_usdhc3>; pinctrl-1 = <&pinctrl_usdhc3_100mhz>; pinctrl-2 = <&pinctrl_usdhc3_200mhz>; - cd-gpios = <&gpio6 15 0>; - wp-gpios = <&gpio1 13 0>; + cd-gpios = <&gpio6 15 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +3 -3
@@ -444,8 +444,8 @@ &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio7 0 0>; - wp-gpios = <&gpio7 1 0>; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>; vmmc-supply = <®_3p3v>; status = "okay"; };
@@ -453,7 +453,7 @@ &usdhc4 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc4>; - cd-gpios = <&gpio2 6 0>; + cd-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +4 -4
@@ -562,8 +562,8 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc2>; bus-width = <8>; - cd-gpios = <&gpio2 2 0>; - wp-gpios = <&gpio2 3 0>; + cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>; status = "okay"; };
@@ -571,8 +571,8 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; bus-width = <8>; - cd-gpios = <&gpio2 0 0>; - wp-gpios = <&gpio2 1 0>; + cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; status = "okay"; };
arch/arm/boot/dts/imx6qdl-tx6.dtsi +2 -2
@@ -680,7 +680,7 @@ pinctrl-0 = <&pinctrl_usdhc1>; bus-width = <4>; no-1-8-v; - cd-gpios = <&gpio7 2 0>; + cd-gpios = <&gpio7 2 GPIO_ACTIVE_LOW>; fsl,wp-controller; status = "okay"; };
@@ -690,7 +690,7 @@ pinctrl-0 = <&pinctrl_usdhc2>; bus-width = <4>; no-1-8-v; - cd-gpios = <&gpio7 3 0>; + cd-gpios = <&gpio7 3 GPIO_ACTIVE_LOW>; fsl,wp-controller; status = "okay"; };
arch/arm/boot/dts/imx6qdl-wandboard.dtsi +4 -2
@@ -9,6 +9,8 @@ * */ +#include <dt-bindings/gpio/gpio.h> + / { regulators { compatible = "simple-bus";
@@ -250,13 +252,13 @@ &usdhc1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc1>; - cd-gpios = <&gpio1 2 0>; + cd-gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; status = "okay"; }; &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - cd-gpios = <&gpio3 9 0>; + cd-gpios = <&gpio3 9 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/boot/dts/imx6sl-evk.dts +5 -5
@@ -617,8 +617,8 @@ pinctrl-1 = <&pinctrl_usdhc1_100mhz>; pinctrl-2 = <&pinctrl_usdhc1_200mhz>; bus-width = <8>; - cd-gpios = <&gpio4 7 0>; - wp-gpios = <&gpio4 6 0>; + cd-gpios = <&gpio4 7 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; status = "okay"; };
@@ -627,8 +627,8 @@ pinctrl-0 = <&pinctrl_usdhc2>; pinctrl-1 = <&pinctrl_usdhc2_100mhz>; pinctrl-2 = <&pinctrl_usdhc2_200mhz>; - cd-gpios = <&gpio5 0 0>; - wp-gpios = <&gpio4 29 0>; + cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>; status = "okay"; };
@@ -637,6 +637,6 @@ pinctrl-0 = <&pinctrl_usdhc3>; pinctrl-1 = <&pinctrl_usdhc3_100mhz>; pinctrl-2 = <&pinctrl_usdhc3_200mhz>; - cd-gpios = <&gpio3 22 0>; + cd-gpios = <&gpio3 22 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/boot/dts/imx6sx-sabreauto.dts +2 -2
@@ -49,7 +49,7 @@ pinctrl-1 = <&pinctrl_usdhc3_100mhz>; pinctrl-2 = <&pinctrl_usdhc3_200mhz>; bus-width = <8>; - cd-gpios = <&gpio7 10 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio7 10 GPIO_ACTIVE_LOW>; wp-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>; keep-power-in-suspend; enable-sdio-wakeup;
@@ -61,7 +61,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc4>; bus-width = <8>; - cd-gpios = <&gpio7 11 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio7 11 GPIO_ACTIVE_LOW>; no-1-8-v; keep-power-in-suspend; enable-sdio-wakup;
arch/arm/boot/dts/imx6sx-sdb.dtsi +2 -2
@@ -293,7 +293,7 @@ pinctrl-1 = <&pinctrl_usdhc3_100mhz>; pinctrl-2 = <&pinctrl_usdhc3_200mhz>; bus-width = <8>; - cd-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; wp-gpios = <&gpio2 15 GPIO_ACTIVE_HIGH>; keep-power-in-suspend; enable-sdio-wakeup;
@@ -304,7 +304,7 @@ &usdhc4 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc4>; - cd-gpios = <&gpio6 21 GPIO_ACTIVE_HIGH>; + cd-gpios = <&gpio6 21 GPIO_ACTIVE_LOW>; wp-gpios = <&gpio6 20 GPIO_ACTIVE_HIGH>; status = "okay"; };
Signature · 1 line
1.9.1
PATCH v2 6/11 mmc: sdhci-esdhc-imx: fix cd regression for dt platform
Quoted 8 lines · Fabio Estevam
Quoted 2 lines · Robert Nelson
I need to finish a full bisect run, but one of these sdhci-esdhci-imx fixes broke the wandboard..
Could you please try to apply the attached patch?
Looks like this one was not applied.
Thanks Fabio, that fixes the regression on v4.1.11 on my wand's... Too bad it's also not in:
https://lkml.org/lkml/2015/10/23/516
Regards,
Signature · 2 lines
Robert Nelson https://rcn-ee.com/
Fabio Estevam
reviewerPATCH v2 6/11 mmc: sdhci-esdhc-imx: fix cd regression for dt platform
Quoted 6 lines · Robert Nelson
Quoted 5 lines · Fabio Estevam
Quoted 2 lines · Robert Nelson
I need to finish a full bisect run, but one of these sdhci-esdhci-imx fixes broke the wandboard..
Quoted 8 lines
Quoted 3 lines
Could you please try to apply the attached patch?
Looks like this one was not applied.
Thanks Fabio, that fixes the regression on v4.1.11 on my wand's... Too bad it's also not in:
This is strange. I have an automatic email from Greg in my Inbox saying that the mx6 patch has been applied to stable, but for some reason it was not applied.
I will ask Greg if I need to resend it.
Thanks for reporting it.
Fabio Estevam
reviewerPATCH v2 6/11 mmc: sdhci-esdhc-imx: fix cd regression for dt platform
In reply to Robert NelsonHi Robert,
Quoted 4 lines · Robert Nelson
Thanks Fabio, that fixes the regression on v4.1.11 on my wand's... Too bad it's also not in:
The fix is in 4.1.13 now.
PATCH v2 7/11 mmc: sdhci-esdhc-imx: move all non dt probe code into one function
In reply to Dong AishengThis is an incremental fix of commite62bd351b("mmc: sdhci-esdhc-imx: Do not break platform data boards").
After commit 8d86e4fcccf6 ("mmc: sdhci-esdhc-imx: Call mmc_of_parse()"), we do not need to run the check of boarddata->wp_type/cd_type/max_bus_width again for dt platform since those are already handled by mmc_of_parse().
Current code only exclude the checking of wp_type for dt platform which does not make sense.
This patch moves all non dt probe code into one function. Besides, since we only support SD3.0/eMMC HS200 for dt platform, the support_vsel checking and ultra high speed pinctrl state are also merged into sdhci_esdhc_imx_probe_dt.
Then we have two separately probe function for dt and non dt type. This can make the driver probe more clearly.
--- drivers/mmc/host/sdhci-esdhc-imx.c | 179 +++++++++++++++++++------------------ 1 file changed, 94 insertions(+), 85 deletions(-)
drivers/mmc/host/sdhci-esdhc-imx.c +94 -85
@@ -878,14 +878,12 @@ static const struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {static int sdhci_esdhc_imx_probe_dt (struct platform_device *pdev,struct sdhci_host *host, -struct esdhc_platform_data *boarddata) +struct pltfm_imx_data *imx_data) {struct device_node *np = pdev->dev.of_node; +struct esdhc_platform_data *boarddata = &imx_data->boarddata;int ret; -if (!np) -return -ENODEV ; -if (of_get_property (np,"non-removable" ,NULL )) boarddata->cd_type =ESDHC_CD_PERMANENT ;
@@ -917,6 +915,26 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,mmc_of_parse_voltage (np, &host->ocr_mask); +/* sdr50 and sdr104 needs work on 1.8v signal voltage */ +if ((boarddata->support_vsel) &&esdhc_is_usdhc (imx_data) && + !IS_ERR (imx_data->pins_default)) { + imx_data->pins_100mhz =pinctrl_lookup_state (imx_data->pinctrl, +ESDHC_PINCTRL_STATE_100MHZ ); + imx_data->pins_200mhz =pinctrl_lookup_state (imx_data->pinctrl, +ESDHC_PINCTRL_STATE_200MHZ ); +if (IS_ERR (imx_data->pins_100mhz) || +IS_ERR (imx_data->pins_200mhz)) { +dev_warn (mmc_dev (host->mmc), +"could not get ultra high speed state, work on normal mode\n" ); +/* +* fall back to not support uhs by specify no 1.8v quirk +*/ + host->quirks2 |=SDHCI_QUIRK2_NO_1_8_V ; + } + }else { + host->quirks2 |=SDHCI_QUIRK2_NO_1_8_V ; + } +/* call to generic mmc_of_parse to support additional capabilities */ ret =mmc_of_parse (host->mmc);if (ret)
@@ -931,22 +949,85 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,static inline int sdhci_esdhc_imx_probe_dt (struct platform_device *pdev,struct sdhci_host *host, -struct esdhc_platform_data *boarddata) +struct pltfm_imx_data *imx_data) {return -ENODEV ; }#endif +static int sdhci_esdhc_imx_probe_nondt (struct platform_device *pdev, +struct sdhci_host *host, +struct pltfm_imx_data *imx_data) +{ +struct esdhc_platform_data *boarddata = &imx_data->boarddata; +int err; + +if (!host->mmc->parent->platform_data) { +dev_err (mmc_dev (host->mmc),"no board data!\n" ); +return -EINVAL ; + } + + imx_data->boarddata = *((struct esdhc_platform_data *) + host->mmc->parent->platform_data); +/* write_protect */ +if (boarddata->wp_type ==ESDHC_WP_GPIO ) { + err =mmc_gpio_request_ro (host->mmc, boarddata->wp_gpio); +if (err) { +dev_err (mmc_dev (host->mmc), +"failed to request write-protect gpio!\n" ); +return err; + } + host->mmc->caps2 |=MMC_CAP2_RO_ACTIVE_HIGH ; + } + +/* card_detect */ +switch (boarddata->cd_type) { +case ESDHC_CD_GPIO : + err =mmc_gpio_request_cd (host->mmc, boarddata->cd_gpio,0 ); +if (err) { +dev_err (mmc_dev (host->mmc), +"failed to request card-detect gpio!\n" ); +return err; + } +/* fall through */ + +case ESDHC_CD_CONTROLLER : +/* we have a working card_detect back */ + host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION ; +break ; + +case ESDHC_CD_PERMANENT : + host->mmc->caps |=MMC_CAP_NONREMOVABLE ; +break ; + +case ESDHC_CD_NONE : +break ; + } + +switch (boarddata->max_bus_width) { +case 8 : + host->mmc->caps |=MMC_CAP_8_BIT_DATA |MMC_CAP_4_BIT_DATA ; +break ; +case 4 : + host->mmc->caps |=MMC_CAP_4_BIT_DATA ; +break ; +case 1 : +default : + host->quirks |=SDHCI_QUIRK_FORCE_1_BIT_DATA ; +break ; + } + +return 0 ; +} +static int sdhci_esdhc_imx_probe (struct platform_device *pdev) {const struct of_device_id *of_id =of_match_device (imx_esdhc_dt_ids, &pdev->dev);struct sdhci_pltfm_host *pltfm_host;struct sdhci_host *host; -struct esdhc_platform_data *boarddata;int err;struct pltfm_imx_data *imx_data; -bool dt = true; host =sdhci_pltfm_init (pdev, &sdhci_esdhc_imx_pdata,0 );if (IS_ERR (host))
@@ -1038,84 +1119,12 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)if (imx_data->socdata->flags &ESDHC_FLAG_ERR004536 ) host->quirks |=SDHCI_QUIRK_BROKEN_ADMA ; - boarddata = &imx_data->boarddata; -if (sdhci_esdhc_imx_probe_dt (pdev, host, boarddata) <0 ) { -if (!host->mmc->parent->platform_data) { -dev_err (mmc_dev (host->mmc),"no board data!\n" ); - err = -EINVAL ; - goto disable_clk; - } - imx_data->boarddata = *((struct esdhc_platform_data *) - host->mmc->parent->platform_data); - dt = false; - } -/* write_protect */ -if (boarddata->wp_type ==ESDHC_WP_GPIO && !dt) { - err =mmc_gpio_request_ro (host->mmc, boarddata->wp_gpio); -if (err) { -dev_err (mmc_dev (host->mmc), -"failed to request write-protect gpio!\n" ); - goto disable_clk; - } - host->mmc->caps2 |=MMC_CAP2_RO_ACTIVE_HIGH ; - } - -/* card_detect */ -switch (boarddata->cd_type) { -case ESDHC_CD_GPIO : -if (dt) -break ; - err =mmc_gpio_request_cd (host->mmc, boarddata->cd_gpio,0 ); -if (err) { -dev_err (mmc_dev (host->mmc), -"failed to request card-detect gpio!\n" ); - goto disable_clk; - } -/* fall through */ - -case ESDHC_CD_CONTROLLER : -/* we have a working card_detect back */ - host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION ; -break ; - -case ESDHC_CD_PERMANENT : - host->mmc->caps |=MMC_CAP_NONREMOVABLE ; -break ; - -case ESDHC_CD_NONE : -break ; - } - -switch (boarddata->max_bus_width) { -case 8 : - host->mmc->caps |=MMC_CAP_8_BIT_DATA |MMC_CAP_4_BIT_DATA ; -break ; -case 4 : - host->mmc->caps |=MMC_CAP_4_BIT_DATA ; -break ; -case 1 : -default : - host->quirks |=SDHCI_QUIRK_FORCE_1_BIT_DATA ; -break ; - } - -/* sdr50 and sdr104 needs work on 1.8v signal voltage */ -if ((boarddata->support_vsel) &&esdhc_is_usdhc (imx_data) && - !IS_ERR (imx_data->pins_default)) { - imx_data->pins_100mhz =pinctrl_lookup_state (imx_data->pinctrl, -ESDHC_PINCTRL_STATE_100MHZ ); - imx_data->pins_200mhz =pinctrl_lookup_state (imx_data->pinctrl, -ESDHC_PINCTRL_STATE_200MHZ ); -if (IS_ERR (imx_data->pins_100mhz) || -IS_ERR (imx_data->pins_200mhz)) { -dev_warn (mmc_dev (host->mmc), -"could not get ultra high speed state, work on normal mode\n" ); -/* fall back to not support uhs by specify no 1.8v quirk */ - host->quirks2 |=SDHCI_QUIRK2_NO_1_8_V ; - } - }else { - host->quirks2 |=SDHCI_QUIRK2_NO_1_8_V ; - } +if (of_id) + err =sdhci_esdhc_imx_probe_dt (pdev, host, imx_data); +else + err =sdhci_esdhc_imx_probe_nondt (pdev, host, imx_data); +if (err) + goto disable_clk; err =sdhci_add_host (host);if (err)
Signature · 1 line
1.9.1
PATCH v2 8/11 mmc: sdhci: make max-frequency property in device tree work
In reply to Dong AishengDevice tree provides option to specify the max freqency with property "max-frequency" in dts and common parse function mmc_of_parse() will parse it and use this value to set host->f_max to tell the MMC core the maxinum frequency the host works.
However, current sdhci driver will finally overwrite this value with host->max_clk regardless of the max-frequency property.
This patch makes sure not overwrite the max-frequency set from device tree and do basic sanity check.
--- drivers/mmc/host/sdhci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +7 -2
@@ -2874,6 +2874,7 @@ int sdhci_add_host(struct sdhci_host *host)u32 max_current_caps;unsigned int ocr_avail;unsigned int override_timeout_clk; +u32 max_clk;int ret;WARN_ON (host ==NULL );
@@ -3058,18 +3059,22 @@ int sdhci_add_host(struct sdhci_host *host)* Set host parameters. */ mmc->ops = &sdhci_ops; - mmc->f_max = host->max_clk; + max_clk = host->max_clk; +if (host->ops->get_min_clock) mmc->f_min = host->ops->get_min_clock (host);else if (host->version >=SDHCI_SPEC_300 ) {if (host->clk_mul) { mmc->f_min = (host->max_clk * host->clk_mul) /1024 ; - mmc->f_max = host->max_clk * host->clk_mul; + max_clk = host->max_clk * host->clk_mul; }else mmc->f_min = host->max_clk /SDHCI_MAX_DIV_SPEC_300 ; }else mmc->f_min = host->max_clk /SDHCI_MAX_DIV_SPEC_200 ; +if (!mmc->f_max || (mmc->f_max && (mmc->f_max > max_clk))) + mmc->f_max = max_clk; +if (!(host->quirks &SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK )) { host->timeout_clk = (caps[0 ] &SDHCI_TIMEOUT_CLK_MASK ) >>SDHCI_TIMEOUT_CLK_SHIFT ;
Signature · 1 line
1.9.1
PATCH v2 9/11 mmc: sdhci-esdhc-imx: remove duplicated dts parsing
In reply to Dong AishengAfter commit 8d86e4fcccf6 ("mmc: sdhci-esdhc-imx: Call mmc_of_parse()"), we do not need those duplicated parsing anymore.
Note: fsl,cd-controller is also deleted due to the driver does not support controller card detection anymore after switch to runtime pm. And there's no user of it right now in device tree.
wp-gpios is kept because we're still support fsl,wp-controller, so we need a way to check if it's gpio wp or controller wp.
--- drivers/mmc/host/sdhci-esdhc-imx.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/mmc/host/sdhci-esdhc-imx.c +0 -14
@@ -884,27 +884,13 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,struct esdhc_platform_data *boarddata = &imx_data->boarddata;int ret; -if (of_get_property (np,"non-removable" ,NULL )) - boarddata->cd_type =ESDHC_CD_PERMANENT ; - -if (of_get_property (np,"fsl,cd-controller" ,NULL )) - boarddata->cd_type =ESDHC_CD_CONTROLLER ; -if (of_get_property (np,"fsl,wp-controller" ,NULL )) boarddata->wp_type =ESDHC_WP_CONTROLLER ; - boarddata->cd_gpio =of_get_named_gpio (np,"cd-gpios" ,0 ); -if (gpio_is_valid (boarddata->cd_gpio)) - boarddata->cd_type =ESDHC_CD_GPIO ; - boarddata->wp_gpio =of_get_named_gpio (np,"wp-gpios" ,0 );if (gpio_is_valid (boarddata->wp_gpio)) boarddata->wp_type =ESDHC_WP_GPIO ; -of_property_read_u32 (np,"bus-width" , &boarddata->max_bus_width); - -of_property_read_u32 (np,"max-frequency" , &boarddata->f_max); -if (of_find_property (np,"no-1-8-v" ,NULL )) boarddata->support_vsel = false;else
Signature · 1 line
1.9.1
PATCH v2 10/11 mmc: sdhci-esdhc-imx: clear f_max in boarddata
In reply to Dong AishengAfter commit 8d86e4fcccf6 ("mmc: sdhci-esdhc-imx: Call mmc_of_parse()"), it's not used anymore.
--- drivers/mmc/host/sdhci-esdhc-imx.c | 7 +------ include/linux/platform_data/mmc-esdhc-imx.h | 1 - 2 files changed, 1 insertion(+), 7 deletions(-)
drivers/mmc/host/sdhci-esdhc-imx.c +1 -6
@@ -581,13 +581,8 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)static unsigned int esdhc_pltfm_get_max_clock (struct sdhci_host *host) {struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); -struct pltfm_imx_data *imx_data = pltfm_host->priv; -struct esdhc_platform_data *boarddata = &imx_data->boarddata; -if (boarddata->f_max && (boarddata->f_max < pltfm_host->clock)) -return boarddata->f_max; -else -return pltfm_host->clock; +return pltfm_host->clock; }static unsigned int esdhc_pltfm_get_min_clock (struct sdhci_host *host)
include/linux/platform_data/mmc-esdhc-imx.h +0 -1
@@ -43,7 +43,6 @@ struct esdhc_platform_data {enum wp_types wp_type;enum cd_types cd_type;int max_bus_width; -unsigned int f_max;bool support_vsel;unsigned int delay_line; };
Signature · 1 line
1.9.1
PATCH v2 11/11 dts: mmc: fsl-imx-esdhc: remove fsl, cd-controller support
In reply to Dong AishengIt's not supported by driver anymore after using runtime pm and there's no user of it, so delete it now.
--- Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt | 2 -- 1 file changed, 2 deletions(-)
Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt +0 -2
@@ -17,7 +17,6 @@ Required properties: "fsl,imx6sx-usdhc" Optional properties: -- fsl,cd-controller : Indicate to use controller internal card detection - fsl,wp-controller : Indicate to use controller internal write protection - fsl,delay-line : Specify the number of delay cells for override mode. This is used to set the clock delay for DLL(Delay Line) on override mode
@@ -35,7 +34,6 @@ esdhc at 70004000 { compatible = "fsl,imx51-esdhc"; reg = <0x70004000 0x4000>; interrupts = <1>; - fsl,cd-controller; fsl,wp-controller; };
Signature · 1 line
1.9.1
v2 cover mmc: sdhci-esdhci-imx: fix cd/wp regression
In reply to Dong AishengQuoted 6 lines · Dong Aisheng
Dong Aisheng (11):
dts: imx51: fix sd card gpio polarity specified in device tree
dts: imx53: fix sd card gpio polarity specified in device tree
dts: imx6: fix sd card gpio polarity specified in device tree
dts: imx25: fix sd card gpio polarity specified in device tree
dts: imx7: fix sd card gpio polarity specified in device tree
Ulf Hansson
Appliedv2 cover mmc: sdhci-esdhci-imx: fix cd/wp regression
In reply to Dong Aisheng+Johan Derycke
Quoted 95 lines · Dong Aisheng
This is a rebase version of former two patch series:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-June/351167.html
http://www.spinics.net/lists/arm-kernel/msg426156.htmlNo other changes.
Commit 8d86e4f mmc: sdhci-esdhc-imx: Call
mmc_of_parse()seriously break the sd card detect/write protect function of most IMX platforms since a lot of GPIO flags of cd-gpios/wp-gpios are wrongly set in devicetree.It breaks the following things:
1) cd-gpio function enable
Most IMX boards GPIO card detect function becomes unwork and using card polling mode instead by mistake.
OpenningCONFIG_MMC_DEBUGwill easily see that.
It is caused by the default quirkSDHCI_QUIRK_BROKEN_CARD_DETECTIONis not cleared for dt platform by commit 8d86e4f, thenMMC_CAP_NEEDS_POLLis wrongly set.This is fixed by patch 6~7
2) cd-gpio/wp-gpio polarity
Before commit 8d86e4f, we do not use GPIO flags passed from devicetree. But after it, GPIO flags specfied in dt becomes valid and will affect the normal cd/wp function.This is fixed by patch 1~5
3) max-frequency not work in sdhci
mmc_of_parsewill parse the max-frequency from devicetree, however, its value will be overwritten by common sdhci driver finnally,so it does not actually work.
Patch 8 is to fix it.4) patch 9~11 clear unneeded parsing code after switch to
mmc_of_parse().The series is based on ulf/next tree.
I also CCed this patch series to all board maintainer related in this change, hope they can help test it.
I only tested some freescale IMX boards.Dong Aisheng (11):
dts: imx51: fix sd card gpio polarity specified in device tree
dts: imx53: fix sd card gpio polarity specified in device tree
dts: imx6: fix sd card gpio polarity specified in device tree
dts: imx25: fix sd card gpio polarity specified in device tree
dts: imx7: fix sd card gpio polarity specified in device tree
mmc: sdhci-esdhc-imx: fix cd regression for dt platform
mmc: sdhci-esdhc-imx: move all non dt probe code into one function
mmc: sdhci: make max-frequency property in device tree work
mmc: sdhci-esdhc-imx: remove duplicated dts parsing
mmc: sdhci-esdhc-imx: clearf_maxin boarddata
dts: mmc: fsl-imx-esdhc: remove fsl,cd-controller support.../devicetree/bindings/mmc/fsl-imx-esdhc.txt | 2 - arch/arm/boot/dts/imx25-pdk.dts | 4 +- arch/arm/boot/dts/imx51-apf51dev.dts | 2 +- arch/arm/boot/dts/imx53-ard.dts | 4 +- arch/arm/boot/dts/imx53-m53evk.dts | 4 +- arch/arm/boot/dts/imx53-qsb-common.dtsi | 4 +- arch/arm/boot/dts/imx53-smd.dts | 4 +- arch/arm/boot/dts/imx53-tqma53.dtsi | 4 +- arch/arm/boot/dts/imx53-tx53.dtsi | 4 +- arch/arm/boot/dts/imx53-voipac-bsb.dts | 4 +- arch/arm/boot/dts/imx6dl-riotboard.dts | 8 +- arch/arm/boot/dts/imx6q-arm2.dts | 5 +- arch/arm/boot/dts/imx6q-gk802.dts | 3 +- arch/arm/boot/dts/imx6q-tbs2910.dts | 4 +- arch/arm/boot/dts/imx6qdl-aristainetos.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-cubox-i.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-gw52xx.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-gw53xx.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-gw54xx.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-hummingboard.dtsi | 2 +- arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi | 8 +- arch/arm/boot/dts/imx6qdl-rex.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-sabrelite.dtsi | 6 +- arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 8 +- arch/arm/boot/dts/imx6qdl-tx6.dtsi | 4 +- arch/arm/boot/dts/imx6qdl-wandboard.dtsi | 6 +- arch/arm/boot/dts/imx6sl-evk.dts | 10 +- arch/arm/boot/dts/imx6sx-sabreauto.dts | 4 +- arch/arm/boot/dts/imx6sx-sdb.dtsi | 4 +- arch/arm/boot/dts/imx7d-sdb.dts | 4 +- drivers/mmc/host/sdhci-esdhc-imx.c | 210 ++++++++++----------- drivers/mmc/host/sdhci.c | 9 +- include/linux/platform_data/mmc-esdhc-imx.h | 1 - 37 files changed, 185 insertions(+), 179 deletions(-)
Quoted 3 lines
--
1.9.1
I have applied this for my fixes branch, with a small change to fix some white-spaces in patch3 which checkpatch complained about.
Thanks!
Kind regards
Uffe