[OpenWrt-Devel] [PATCH v2] ramips: mmc: Read mmc-caps from dt with mmc_of_parse

Benedikt-Alexander Mokroß openwrt at bamkrs.de
Tue Apr 28 03:55:07 EDT 2020


On 4/28/20 9:26 AM, Benedikt-Alexander Mokroß wrote:
> The original mmc-driver for ramips used hardcoded mmc-caps for bus-width.
> Further it used custom bindings for cd-polling and cd-invert that are 
> not conform to the standard mmc-bindings.
> 
> This patch removes the hardcoded bus-width, enables dt parsing with
> mmc_of_parse and enables the use of standard mmc-bindings.
> 
> Signed-off-by: Benedikt-Alexander Mokroß <openwrt at bamkrs.de>
> ---
> v2:
>    * Added bus-width = <4>; to all affected device-trees
>    * Reworded the patch comment for clarity
>    * Enabled usage of standard mmc-bindings for cd-polling and cd-invert
> 
>   .../ramips/dts/mt7620a_bdcom_wap2100-sk.dts     |  1 +
>   .../ramips/dts/mt7620a_glinet_gl-mt300a.dts     |  1 +
>   .../ramips/dts/mt7620a_glinet_gl-mt750.dts      |  1 +
>   .../ramips/dts/mt7620a_head-weblink_hdrm200.dts |  1 +
>   .../linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi |  1 +
>   target/linux/ramips/dts/mt7620a_hnet_c108.dts   |  1 +
>   .../linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts |  1 +
>   .../linux/ramips/dts/mt7620a_planex_cs-qr10.dts |  1 +
>   .../ramips/dts/mt7620a_ralink_mt7620a-evb.dts   |  1 +
>   .../dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts  |  1 +
>   .../ramips/dts/mt7620a_sanlinking_d240.dts      |  1 +
>   target/linux/ramips/dts/mt7620a_youku_yk1.dts   |  1 +
>   .../ramips/dts/mt7620a_zbtlink_zbt-we1026.dtsi  |  1 +
>   .../ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi   |  1 +
>   target/linux/ramips/dts/mt7620a_zte_q7.dts      |  1 +
>   .../linux/ramips/dts/mt7621_afoundry_ew1200.dts |  1 +
>   .../ramips/dts/mt7621_alfa-network_quad-e4g.dts |  1 +
>   .../linux/ramips/dts/mt7621_asiarf_ap7621.dtsi  |  1 +
>   .../linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi  |  1 +
>   .../linux/ramips/dts/mt7621_d-team_pbr-m1.dts   |  1 +
>   .../linux/ramips/dts/mt7621_firefly_firewrt.dts |  1 +
>   .../linux/ramips/dts/mt7621_gnubee_gb-pc1.dts   |  1 +
>   .../linux/ramips/dts/mt7621_gnubee_gb-pc2.dts   |  1 +
>   .../ramips/dts/mt7621_lenovo_newifi-d1.dts      |  1 +
>   .../dts/mt7621_mediatek_ap-mt7621a-v60.dts      |  1 +
>   .../dts/mt7621_mediatek_mt7621-eval-board.dts   |  1 +
>   .../dts/mt7621_mikrotik_routerboard-750gr3.dts  |  1 +
>   .../dts/mt7621_mikrotik_routerboard-m33g.dts    |  1 +
>   target/linux/ramips/dts/mt7621_mqmaker_witi.dts |  1 +
>   target/linux/ramips/dts/mt7621_mtc_wr1201.dts   |  1 +
>   .../ramips/dts/mt7621_thunder_timecloud.dts     |  1 +
>   .../ramips/dts/mt7621_unielec_u7621-06.dtsi     |  1 +
>   .../ramips/dts/mt7621_xzwifi_creativebox-v1.dts |  1 +
>   target/linux/ramips/dts/mt7621_youku_yk-l2.dts  |  1 +
>   .../ramips/dts/mt7621_zbtlink_zbt-we1326.dts    |  1 +
>   .../ramips/dts/mt7621_zbtlink_zbt-we3526.dts    |  1 +
>   .../ramips/dts/mt7621_zbtlink_zbt-wg2626.dts    |  1 +
>   .../ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi   |  1 +
>   .../linux/ramips/dts/mt7628an_d-team_pbr-d1.dts |  3 ++-
>   target/linux/ramips/dts/mt7628an_duzun_dm06.dts |  1 +
>   .../dts/mt7628an_mediatek_linkit-smart-7688.dts |  3 ++-
>   .../linux/ramips/dts/mt7628an_onion_omega2.dtsi |  1 +
>   .../linux/ramips/dts/mt7628an_widora_neo.dtsi   |  1 +
>   .../ramips/dts/mt7628an_wiznet_wizfi630s.dts    |  3 ++-
>   .../ramips/dts/mt7628an_wrtnode_wrtnode2.dtsi   |  1 +
>   .../ramips/files/drivers/mmc/host/mtk-mmc/sd.c  | 17 +++++++++++------
>   46 files changed, 59 insertions(+), 9 deletions(-)
> 
> diff --git a/target/linux/ramips/dts/mt7620a_bdcom_wap2100-sk.dts 
> b/target/linux/ramips/dts/mt7620a_bdcom_wap2100-sk.dts
> index 64aafd0a52..38f0b92f0f 100644
> --- a/target/linux/ramips/dts/mt7620a_bdcom_wap2100-sk.dts
> +++ b/target/linux/ramips/dts/mt7620a_bdcom_wap2100-sk.dts
> @@ -111,6 +111,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &ehci {
> diff --git a/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts 
> b/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts
> index 9a9d9f45ae..dde729eb19 100644
> --- a/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts
> +++ b/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts
> @@ -126,6 +126,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &ehci {
> diff --git a/target/linux/ramips/dts/mt7620a_glinet_gl-mt750.dts 
> b/target/linux/ramips/dts/mt7620a_glinet_gl-mt750.dts
> index 9df5f464c7..9dd802303f 100644
> --- a/target/linux/ramips/dts/mt7620a_glinet_gl-mt750.dts
> +++ b/target/linux/ramips/dts/mt7620a_glinet_gl-mt750.dts
> @@ -121,6 +121,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &ehci {
> diff --git a/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts 
> b/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts
> index fbee809893..c900288044 100644
> --- a/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts
> +++ b/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts
> @@ -111,6 +111,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &ehci {
> diff --git a/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi 
> b/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi
> index 82bc8c9957..c6846c8bf3 100644
> --- a/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi
> +++ b/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi
> @@ -117,6 +117,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &wmac {
> diff --git a/target/linux/ramips/dts/mt7620a_hnet_c108.dts 
> b/target/linux/ramips/dts/mt7620a_hnet_c108.dts
> index 15b2a12af7..9078ea367f 100644
> --- a/target/linux/ramips/dts/mt7620a_hnet_c108.dts
> +++ b/target/linux/ramips/dts/mt7620a_hnet_c108.dts
> @@ -154,6 +154,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &ehci {
> diff --git a/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts 
> b/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts
> index b8f86fad50..bf53713987 100644
> --- a/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts
> +++ b/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts
> @@ -117,6 +117,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &ehci {
> diff --git a/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts 
> b/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts
> index 3998ea6019..96c8311ecd 100644
> --- a/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts
> +++ b/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts
> @@ -140,6 +140,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &ehci {
> diff --git a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-evb.dts 
> b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-evb.dts
> index 34f870906e..abcaf4932c 100644
> --- a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-evb.dts
> +++ b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-evb.dts
> @@ -112,6 +112,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &pcie {
> diff --git 
> a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts 
> b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts
> index b4554675c7..b0fab5381e 100644
> --- a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts
> +++ b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts
> @@ -83,6 +83,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &pcie {
> diff --git a/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts 
> b/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts
> index 2bbd68cf7a..162c5a7b55 100644
> --- a/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts
> +++ b/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts
> @@ -156,6 +156,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>       /* the pins function is already set during pinmux driver load */
>       /delete-property/ pinctrl-0;
>   };
> diff --git a/target/linux/ramips/dts/mt7620a_youku_yk1.dts 
> b/target/linux/ramips/dts/mt7620a_youku_yk1.dts
> index a95f1e9320..9ddce40d1f 100644
> --- a/target/linux/ramips/dts/mt7620a_youku_yk1.dts
> +++ b/target/linux/ramips/dts/mt7620a_youku_yk1.dts
> @@ -129,6 +129,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &ehci {
> diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026.dtsi 
> b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026.dtsi
> index 91bbd4a044..52517e009e 100644
> --- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026.dtsi
> +++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026.dtsi
> @@ -76,6 +76,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &ehci {
> diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi 
> b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi
> index a2051efaad..386fc3c391 100644
> --- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi
> +++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi
> @@ -63,6 +63,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &ehci {
> diff --git a/target/linux/ramips/dts/mt7620a_zte_q7.dts 
> b/target/linux/ramips/dts/mt7620a_zte_q7.dts
> index 182b7db905..8ff8f8ad9c 100644
> --- a/target/linux/ramips/dts/mt7620a_zte_q7.dts
> +++ b/target/linux/ramips/dts/mt7620a_zte_q7.dts
> @@ -107,6 +107,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &ehci {
> diff --git a/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts 
> b/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts
> index 97f13b0bb0..321c5d8719 100644
> --- a/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts
> +++ b/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts
> @@ -49,6 +49,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &spi0 {
> diff --git a/target/linux/ramips/dts/mt7621_alfa-network_quad-e4g.dts 
> b/target/linux/ramips/dts/mt7621_alfa-network_quad-e4g.dts
> index 6ac9e337fc..c70536b05c 100644
> --- a/target/linux/ramips/dts/mt7621_alfa-network_quad-e4g.dts
> +++ b/target/linux/ramips/dts/mt7621_alfa-network_quad-e4g.dts
> @@ -204,6 +204,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &spi0 {
> diff --git a/target/linux/ramips/dts/mt7621_asiarf_ap7621.dtsi 
> b/target/linux/ramips/dts/mt7621_asiarf_ap7621.dtsi
> index bd6642fe51..5cc18a4dd7 100644
> --- a/target/linux/ramips/dts/mt7621_asiarf_ap7621.dtsi
> +++ b/target/linux/ramips/dts/mt7621_asiarf_ap7621.dtsi
> @@ -37,6 +37,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &spi0 {
> diff --git a/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi 
> b/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi
> index 37056c7934..736234f0e2 100644
> --- a/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi
> +++ b/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi
> @@ -62,6 +62,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &nand {
> diff --git a/target/linux/ramips/dts/mt7621_d-team_pbr-m1.dts 
> b/target/linux/ramips/dts/mt7621_d-team_pbr-m1.dts
> index 49d8648f8a..880c0cb365 100644
> --- a/target/linux/ramips/dts/mt7621_d-team_pbr-m1.dts
> +++ b/target/linux/ramips/dts/mt7621_d-team_pbr-m1.dts
> @@ -103,6 +103,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &spi0 {
> diff --git a/target/linux/ramips/dts/mt7621_firefly_firewrt.dts 
> b/target/linux/ramips/dts/mt7621_firefly_firewrt.dts
> index 10b33993ac..f863b316eb 100644
> --- a/target/linux/ramips/dts/mt7621_firefly_firewrt.dts
> +++ b/target/linux/ramips/dts/mt7621_firefly_firewrt.dts
> @@ -48,6 +48,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &spi0 {
> diff --git a/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts 
> b/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts
> index 6b1c9a8f9d..7064edf2c7 100644
> --- a/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts
> +++ b/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts
> @@ -57,6 +57,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &spi0 {
> diff --git a/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts 
> b/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts
> index a015a5e84a..98eccf74c8 100644
> --- a/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts
> +++ b/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts
> @@ -67,6 +67,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &spi0 {
> diff --git a/target/linux/ramips/dts/mt7621_lenovo_newifi-d1.dts 
> b/target/linux/ramips/dts/mt7621_lenovo_newifi-d1.dts
> index 5654a6f196..96af204e1b 100644
> --- a/target/linux/ramips/dts/mt7621_lenovo_newifi-d1.dts
> +++ b/target/linux/ramips/dts/mt7621_lenovo_newifi-d1.dts
> @@ -71,6 +71,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &spi0 {
> diff --git a/target/linux/ramips/dts/mt7621_mediatek_ap-mt7621a-v60.dts 
> b/target/linux/ramips/dts/mt7621_mediatek_ap-mt7621a-v60.dts
> index 731eb4d8e2..1b9021242c 100644
> --- a/target/linux/ramips/dts/mt7621_mediatek_ap-mt7621a-v60.dts
> +++ b/target/linux/ramips/dts/mt7621_mediatek_ap-mt7621a-v60.dts
> @@ -116,6 +116,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &gmac0 {
> diff --git 
> a/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts 
> b/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts
> index 8321caae6e..40e6755313 100644
> --- a/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts
> +++ b/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts
> @@ -43,6 +43,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &switch0 {
> diff --git 
> a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts 
> b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts
> index 3f37155f24..d36378776a 100644
> --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts
> +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts
> @@ -175,4 +175,5 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> diff --git 
> a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts 
> b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts
> index 19e1a71e99..bf1f397854 100644
> --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts
> +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts
> @@ -197,6 +197,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &i2c {
> diff --git a/target/linux/ramips/dts/mt7621_mqmaker_witi.dts 
> b/target/linux/ramips/dts/mt7621_mqmaker_witi.dts
> index 87421486a9..0b8572816f 100644
> --- a/target/linux/ramips/dts/mt7621_mqmaker_witi.dts
> +++ b/target/linux/ramips/dts/mt7621_mqmaker_witi.dts
> @@ -38,6 +38,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &spi0 {
> diff --git a/target/linux/ramips/dts/mt7621_mtc_wr1201.dts 
> b/target/linux/ramips/dts/mt7621_mtc_wr1201.dts
> index 66b4f92852..851b369011 100644
> --- a/target/linux/ramips/dts/mt7621_mtc_wr1201.dts
> +++ b/target/linux/ramips/dts/mt7621_mtc_wr1201.dts
> @@ -141,6 +141,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &pcie {
> diff --git a/target/linux/ramips/dts/mt7621_thunder_timecloud.dts 
> b/target/linux/ramips/dts/mt7621_thunder_timecloud.dts
> index 60eea877b1..21420a5b73 100644
> --- a/target/linux/ramips/dts/mt7621_thunder_timecloud.dts
> +++ b/target/linux/ramips/dts/mt7621_thunder_timecloud.dts
> @@ -53,6 +53,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &spi0 {
> diff --git a/target/linux/ramips/dts/mt7621_unielec_u7621-06.dtsi 
> b/target/linux/ramips/dts/mt7621_unielec_u7621-06.dtsi
> index ca0e2d7dcd..e5786ff18f 100644
> --- a/target/linux/ramips/dts/mt7621_unielec_u7621-06.dtsi
> +++ b/target/linux/ramips/dts/mt7621_unielec_u7621-06.dtsi
> @@ -98,6 +98,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &pcie {
> diff --git a/target/linux/ramips/dts/mt7621_xzwifi_creativebox-v1.dts 
> b/target/linux/ramips/dts/mt7621_xzwifi_creativebox-v1.dts
> index 0db8b34474..e32776fee0 100644
> --- a/target/linux/ramips/dts/mt7621_xzwifi_creativebox-v1.dts
> +++ b/target/linux/ramips/dts/mt7621_xzwifi_creativebox-v1.dts
> @@ -130,6 +130,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &pcie {
> diff --git a/target/linux/ramips/dts/mt7621_youku_yk-l2.dts 
> b/target/linux/ramips/dts/mt7621_youku_yk-l2.dts
> index e43ee8451a..0f5f49fa90 100644
> --- a/target/linux/ramips/dts/mt7621_youku_yk-l2.dts
> +++ b/target/linux/ramips/dts/mt7621_youku_yk-l2.dts
> @@ -62,6 +62,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &xhci {
> diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts 
> b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts
> index f91f0d77d4..aa3990b269 100644
> --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts
> +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts
> @@ -131,4 +131,5 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we3526.dts 
> b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we3526.dts
> index 1f43f2a2dc..4e50db68c9 100644
> --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we3526.dts
> +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we3526.dts
> @@ -32,6 +32,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &spi0 {
> diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg2626.dts 
> b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg2626.dts
> index 5e8e250432..1f2e7ff51a 100644
> --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg2626.dts
> +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg2626.dts
> @@ -48,6 +48,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &spi0 {
> diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi 
> b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi
> index 8c9d31325a..f1d9028cf0 100644
> --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi
> +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi
> @@ -46,6 +46,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &spi0 {
> diff --git a/target/linux/ramips/dts/mt7628an_d-team_pbr-d1.dts 
> b/target/linux/ramips/dts/mt7628an_d-team_pbr-d1.dts
> index d406bac0e8..1c2ec916f0 100644
> --- a/target/linux/ramips/dts/mt7628an_d-team_pbr-d1.dts
> +++ b/target/linux/ramips/dts/mt7628an_d-team_pbr-d1.dts
> @@ -159,5 +159,6 @@
> 
>   &sdhci {
>       status = "okay";
> -    mediatek,cd-high;
> +    bus-width = <4>;
> +    cd-inverted;
>   };
> diff --git a/target/linux/ramips/dts/mt7628an_duzun_dm06.dts 
> b/target/linux/ramips/dts/mt7628an_duzun_dm06.dts
> index 4164bae184..4d08c8a849 100644
> --- a/target/linux/ramips/dts/mt7628an_duzun_dm06.dts
> +++ b/target/linux/ramips/dts/mt7628an_duzun_dm06.dts
> @@ -85,6 +85,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &gdma {
> diff --git 
> a/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts 
> b/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts
> index ebc4c3d6f9..b4a5fb0793 100644
> --- a/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts
> +++ b/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts
> @@ -154,7 +154,8 @@
> 
>   &sdhci {
>       status = "okay";
> -    mediatek,cd-high;
> +    bus-width = <4>;
> +    cd-inverted;
>   };
> 
>   &wmac {
> diff --git a/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi 
> b/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi
> index f8fad35c05..ed582e5c46 100644
> --- a/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi
> +++ b/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi
> @@ -156,6 +156,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>       mediatek,cd-low;
>   };
> 
> diff --git a/target/linux/ramips/dts/mt7628an_widora_neo.dtsi 
> b/target/linux/ramips/dts/mt7628an_widora_neo.dtsi
> index 252ffd71f5..4bd548f386 100644
> --- a/target/linux/ramips/dts/mt7628an_widora_neo.dtsi
> +++ b/target/linux/ramips/dts/mt7628an_widora_neo.dtsi
> @@ -110,6 +110,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>       mediatek,cd-low;
>   };
> 
> diff --git a/target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts 
> b/target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts
> index 0aeff750e9..ddea3cb700 100644
> --- a/target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts
> +++ b/target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts
> @@ -176,7 +176,8 @@
> 
>   &sdhci {
>       status = "okay";
> -    mediatek,cd-high;
> +    bus-width = <4>;
> +    cd-inverted;
>   };
> 
>   &wmac {
> diff --git a/target/linux/ramips/dts/mt7628an_wrtnode_wrtnode2.dtsi 
> b/target/linux/ramips/dts/mt7628an_wrtnode_wrtnode2.dtsi
> index 882a8838dd..c7788e9964 100644
> --- a/target/linux/ramips/dts/mt7628an_wrtnode_wrtnode2.dtsi
> +++ b/target/linux/ramips/dts/mt7628an_wrtnode_wrtnode2.dtsi
> @@ -79,6 +79,7 @@
> 
>   &sdhci {
>       status = "okay";
> +    bus-width = <4>;
>   };
> 
>   &pcie {
> diff --git a/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c 
> b/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c
> index 8cbc87da3a..9094270818 100644
> --- a/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c
> +++ b/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c
> @@ -2235,15 +2235,22 @@ static int msdc_drv_probe(struct platform_device 
> *pdev)
>       mmc->f_max      = HOST_MAX_MCLK;
>       mmc->ocr_avail  = MSDC_OCR_AVAIL;
> 
> -    mmc->caps   = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
> +    ret = mmc_of_parse(mmc);
> +    if (ret)
> +        goto release;
> 
> -    //TODO: read this as bus-width from dt (via mmc_of_parse)
> -    mmc->caps  |= MMC_CAP_4_BIT_DATA;
> +    if (mmc->f_max > HOST_MAX_MCLK) {
> +        dev_warn(mmc->parent,
> +                "\"max-frequency\" property greater than max-frequency 
> of %d, using %d.\n",
> +                HOST_MAX_MCLK, HOST_MAX_MCLK);
> +        mmc->f_max = HOST_MAX_MCLK;
> +    }
> 
> -    cd_active_low = !of_property_read_bool(pdev->dev.of_node, 
> "mediatek,cd-high");
> +    /* It seems these caps must be set regardles of the dt */
> +    mmc->caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
> 
> -    if (of_property_read_bool(pdev->dev.of_node, "mediatek,cd-poll"))
> -        mmc->caps |= MMC_CAP_NEEDS_POLL;
> +    /* Get cd_active_low from caps2's MMC_CAP2_CD_ACTIVE_HIGH flag */
> +    cd_active_low = (host->caps2 & MMC_CAP2_CD_ACTIVE_HIGH) == 0;
> 
>       /* MMC core transfer sizes tunable parameters */
>       mmc->max_segs      = MAX_HW_SGMTS;

I accidently submitted the wrong commit as patch. This one is flawed:

 > +    /* Get cd_active_low from caps2's MMC_CAP2_CD_ACTIVE_HIGH flag */
 > +    cd_active_low = (host->caps2 & MMC_CAP2_CD_ACTIVE_HIGH) == 0;

should be

 > +    /* Get cd_active_low from caps2's MMC_CAP2_CD_ACTIVE_HIGH flag */
 > +    cd_active_low = (mmc->caps2 & MMC_CAP2_CD_ACTIVE_HIGH) == 0;

Notice the host->caps2 is replaced with mmc->caps2. Somehow this got 
lost when I squashed the commits to one.

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list