ramips: make SoC dtsi compatible with upstream mmc-mtk driver
authorShiji Yang <yangshiji66@qq.com>
Tue, 9 Jul 2024 16:16:36 +0000 (00:16 +0800)
committerNick Hainke <vincent@systemli.org>
Thu, 11 Jul 2024 16:57:41 +0000 (18:57 +0200)
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 <yangshiji66@qq.com>
Co-authored-by: John Thomson <git@johnthomson.fastmail.com.au>
target/linux/ramips/dts/mt7620a.dtsi
target/linux/ramips/dts/mt7621.dtsi
target/linux/ramips/dts/mt7628an.dtsi
target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts
target/linux/ramips/mt7620/config-6.6

index a0429ade454136fe31c8f499cb9aff4fc8b7dfac..0e925b4dcce1b03c1e1e6487cd3abf0a3d9df906 100644 (file)
                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>;
                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";
        };
index 54fe13123db13423207b7bc5d8e12489f4d5b3c0..033ba95dd7a7de07496a7020b906b75cc165d9bf 100644 (file)
                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>;
                };
        };
 
-       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 = <GIC_SHARED 20 IRQ_TYPE_LEVEL_HIGH>;
 
-               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 {
index be80c11d1153ca97771d9ecab855b331083ab851..445c53081509c192416cde48dabd8a4c9df78181 100644 (file)
                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>;
                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";
        };
index 51731c3c649b12e35aaf17d9f87d34654b6e3185..c7e3640d8892c7a1d7fcc1f0dcba51d4cc437e6a 100644 (file)
                        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 {
index a142efd43b971e3303904f8ad15b9a77e62d6ccf..20bba0c5a47dcf812fb4b4490c89332ee3d0bccd 100644 (file)
@@ -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