From 338f40b3b4ff925985d3a2055ef09200778d1cd6 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 10 Jul 2024 00:16:36 +0800 Subject: [PATCH] ramips: make SoC dtsi compatible with upstream mmc-mtk driver Add all essential MTK SDHC properties to support the new mmc-mtk driver. Since this driver relies on power regulators, we also need to enable this feature for MT7620, just like MT762{1,8}. Signed-off-by: Shiji Yang Co-authored-by: John Thomson --- target/linux/ramips/dts/mt7620a.dtsi | 54 +++++++++++++++++-- target/linux/ramips/dts/mt7621.dtsi | 51 ++++++++++++++++-- target/linux/ramips/dts/mt7628an.dtsi | 54 +++++++++++++++++-- .../dts/mt7628an_hak5_wifi-pineapple-mk7.dts | 12 ++--- target/linux/ramips/mt7620/config-6.6 | 2 + 5 files changed, 153 insertions(+), 20 deletions(-) diff --git a/target/linux/ramips/dts/mt7620a.dtsi b/target/linux/ramips/dts/mt7620a.dtsi index a0429ade45..0e925b4dcc 100644 --- a/target/linux/ramips/dts/mt7620a.dtsi +++ b/target/linux/ramips/dts/mt7620a.dtsi @@ -32,6 +32,35 @@ compatible = "mti,cpu-interrupt-controller"; }; + mmc_clk: mmc-clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <48000000>; + clock-accuracy = <100>; + }; + + mmc_reg_1v8: regulator-1v8 { + compatible = "regulator-fixed"; + + enable-active-high; + + regulator-always-on; + regulator-max-microvolt = <1800000>; + regulator-min-microvolt = <1800000>; + regulator-name = "mmc_io"; + }; + + mmc_reg_3v3: regulator-3v3 { + compatible = "regulator-fixed"; + + enable-active-high; + + regulator-always-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "mmc_power"; + }; + palmbus: palmbus@10000000 { compatible = "palmbus"; reg = <0x10000000 0x200000>; @@ -493,15 +522,34 @@ interrupts = <17>; }; - sdhci: sdhci@10130000 { - compatible = "ralink,mt7620-sdhci"; + sdhci: mmc@10130000 { + compatible = "mediatek,mt7620-mmc", "ralink,mt7620-sdhci"; reg = <0x10130000 0x4000>; + bus-width = <4>; + + cap-mmc-highspeed; + cap-sd-highspeed; + + clocks = <&mmc_clk>, <&mmc_clk>; + clock-names = "source", "hclk"; + + disable-wp; + interrupt-parent = <&intc>; interrupts = <14>; - pinctrl-names = "default"; + max-frequency = <48000000>; + + pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&sdhci_pins>; + pinctrl-1 = <&sdhci_pins>; + + resets = <&sysc 30>; + reset-names = "hrst"; + + vmmc-supply = <&mmc_reg_3v3>; + vqmmc-supply = <&mmc_reg_1v8>; status = "disabled"; }; diff --git a/target/linux/ramips/dts/mt7621.dtsi b/target/linux/ramips/dts/mt7621.dtsi index 54fe13123d..033ba95dd7 100644 --- a/target/linux/ramips/dts/mt7621.dtsi +++ b/target/linux/ramips/dts/mt7621.dtsi @@ -42,6 +42,28 @@ bootargs = "console=ttyS0,57600"; }; + mmc_reg_1v8: regulator-1v8 { + compatible = "regulator-fixed"; + + enable-active-high; + + regulator-always-on; + regulator-max-microvolt = <1800000>; + regulator-min-microvolt = <1800000>; + regulator-name = "mmc_io"; + }; + + mmc_reg_3v3: regulator-3v3 { + compatible = "regulator-fixed"; + + enable-active-high; + + regulator-always-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "mmc_power"; + }; + palmbus: palmbus@1e000000 { compatible = "palmbus"; reg = <0x1e000000 0x100000>; @@ -326,17 +348,36 @@ }; }; - sdhci: sdhci@1e130000 { - status = "disabled"; - - compatible = "ralink,mt7620-sdhci"; + sdhci: mmc@1e130000 { + compatible = "mediatek,mt7620-mmc", "ralink,mt7620-sdhci"; reg = <0x1e130000 0x4000>; + bus-width = <4>; + + cap-mmc-highspeed; + cap-sd-highspeed; + + clocks = <&sysc MT7621_CLK_SHXC>, <&sysc MT7621_CLK_SHXC>; + clock-names = "source", "hclk"; + + disable-wp; + interrupt-parent = <&gic>; interrupts = ; - pinctrl-names = "default"; + max-frequency = <50000000>; + + pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&sdhci_pins>; + pinctrl-1 = <&sdhci_pins>; + + resets = <&sysc MT7621_RST_SDXC>; + reset-names = "hrst"; + + vmmc-supply = <&mmc_reg_3v3>; + vqmmc-supply = <&mmc_reg_1v8>; + + status = "disabled"; }; xhci: xhci@1e1c0000 { diff --git a/target/linux/ramips/dts/mt7628an.dtsi b/target/linux/ramips/dts/mt7628an.dtsi index be80c11d11..445c530815 100644 --- a/target/linux/ramips/dts/mt7628an.dtsi +++ b/target/linux/ramips/dts/mt7628an.dtsi @@ -30,6 +30,35 @@ compatible = "mti,cpu-interrupt-controller"; }; + mmc_clk: mmc-clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <48000000>; + clock-accuracy = <100>; + }; + + mmc_reg_1v8: regulator-1v8 { + compatible = "regulator-fixed"; + + enable-active-high; + + regulator-always-on; + regulator-max-microvolt = <1800000>; + regulator-min-microvolt = <1800000>; + regulator-name = "mmc_io"; + }; + + mmc_reg_3v3: regulator-3v3 { + compatible = "regulator-fixed"; + + enable-active-high; + + regulator-always-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "mmc_power"; + }; + palmbus: palmbus@10000000 { compatible = "palmbus"; reg = <0x10000000 0x200000>; @@ -355,15 +384,34 @@ reset-names = "host", "device"; }; - sdhci: sdhci@10130000 { - compatible = "ralink,mt7620-sdhci"; + sdhci: mmc@10130000 { + compatible = "mediatek,mt7620-mmc", "ralink,mt7620-sdhci"; reg = <0x10130000 0x4000>; + bus-width = <4>; + + cap-mmc-highspeed; + cap-sd-highspeed; + + clocks = <&mmc_clk>, <&mmc_clk>; + clock-names = "source", "hclk"; + + disable-wp; + interrupt-parent = <&intc>; interrupts = <14>; - pinctrl-names = "default"; + max-frequency = <48000000>; + + pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&sdxc_pins>; + pinctrl-1 = <&sdxc_pins>; + + resets = <&sysc 30>; + reset-names = "hrst"; + + vmmc-supply = <&mmc_reg_3v3>; + vqmmc-supply = <&mmc_reg_1v8>; status = "disabled"; }; diff --git a/target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts b/target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts index 51731c3c64..c7e3640d88 100644 --- a/target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts +++ b/target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts @@ -55,16 +55,10 @@ gpios = <&gpio 5 GPIO_ACTIVE_LOW>; }; }; +}; - sdhci@10130000 { - compatible = "ralink,mt7620-sdhci"; - reg = <0x10130000 4000>; - - interrupt-parent = <&intc>; - interrupts = <14>; - - status = "okay"; - }; +&sdhci { + status = "okay"; }; &state_default { diff --git a/target/linux/ramips/mt7620/config-6.6 b/target/linux/ramips/mt7620/config-6.6 index a142efd43b..20bba0c5a4 100644 --- a/target/linux/ramips/mt7620/config-6.6 +++ b/target/linux/ramips/mt7620/config-6.6 @@ -186,6 +186,8 @@ CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y CONFIG_REGMAP=y CONFIG_REGMAP_MMIO=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_RESET_CONTROLLER=y CONFIG_SERIAL_8250_RT288X=y CONFIG_SERIAL_MCTRL_GPIO=y