StarFive's SDIO/eMMC driver support
Subsystems (6)
William Qiu
maintainerv2 cover StarFive's SDIO/eMMC driver support
Hi,
This patchset adds initial rudimentary support for the StarFive designware mobile storage host controller driver. And this driver will be used in StarFive's VisionFive 2 board. The main purpose of adding this driver is to accommodate the ultra-high speed mode of eMMC.
The last patch should be applied after the patchset [1]:
[1] https://lore.kernel.org/all/[email protected]/
Changes since v1:
- Renamed the dt-binding 'starfive,jh7110-sdio.yaml' to 'starfive,jh7110-mmc.yaml'.
- Changed the type of 'starfive,syscon' and modify its description.
- Deleted unused head files like '#include <linux/gpio.h>'.
- Added comment for the 'rise_point' and 'fall_point'.
- Changed the API 'num_caps' to 'common_caps'.
- Changed the node name 'sys_syscon' to 'syscon'.
- Changed the node name 'sdio' to 'mmc'.
The patch series is based on v6.1-rc5.
William Qiu (3):
dt-bindings: mmc: Add bindings for StarFive
mmc: starfive: Add sdio/emmc driver support
riscv: dts: starfive: Add mmc node
.../bindings/mmc/starfive,jh7110-mmc.yaml | 72 +++++++ MAINTAINERS | 6 + .../jh7110-starfive-visionfive-v2.dts | 25 +++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 ++++ drivers/mmc/host/Kconfig | 10 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/dw_mmc-starfive.c | 185 ++++++++++++++++++ 7 files changed, 337 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml create mode 100644 drivers/mmc/host/dw_mmc-starfive.c
--
2.34.1
William Qiu
maintainerPATCH v2 1/3 dt-bindings: mmc: Add bindings for StarFive
Add documentation to describe StarFive
designware mobile storage host controller driver.
--- .../bindings/mmc/starfive,jh7110-mmc.yaml | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml new file +72 -0
@@ -0,0 +1,72 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mmc/starfive,jh7110-mmc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive Designware Mobile Storage Host Controller + +description: + StarFive uses the Synopsys designware mobile storage host controller + to interface a SoC with storage medium such as eMMC or SD/MMC cards. + +allOf: + - $ref: synopsys-dw-mshc-common.yaml# + +maintainers: + - William Qiu <[email protected]> + +properties: + compatible: + const: starfive,jh7110-mmc + + reg: + maxItems: 1 + + clocks: + items: + - description: biu clock + - description: ciu clock + + clock-names: + items: + - const: biu + - const: ciu + + interrupts: + maxItems: 1 + + starfive,syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: + arg0:arg0 is syscon. + arg1:arg1 is syscon register offset, used to enable MMC function. + arg2:arg2 is used to enable the register shift of the MMC function. + arg3:arg3 is used to enable the register mask of the MMC function. + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + - starfive,syscon + +unevaluatedProperties: false + +examples: + - | + mmc@16010000 { + compatible = "starfive,jh7110-mmc"; + reg = <0x16010000 0x10000>; + clocks = <&syscrg 91>, + <&syscrg 93>; + clock-names = "biu","ciu"; + resets = <&syscrg 64>; + reset-names = "reset"; + interrupts = <74>; + fifo-depth = <32>; + fifo-watermark-aligned; + data-addr = <0>; + starfive,syscon = <&syscon 0x14 0x1a 0x7c000000>; + };
Signature · 1 line
2.34.1
Re: [PATCH v2 1/3] dt-bindings: mmc: Add bindings for StarFive
Quoted 2 lines · William Qiu
Add documentation to describe StarFive
designware mobile storage host controller driver.
Please wrap commit message according to Linux coding style / submission process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v5.18-rc4/source/Documentation/process/submitting-patches.rst#L586
The subject is a bit redundant and not precise. No need to mention "bindings" twice but "StarFive" is really too generic. Do you add now all possible devices from StarFive? I see only one. Rephrase (use git log to find examples).
Quoted 42 lines
Signed-off-by William Qiu <[email protected]>--- .../bindings/mmc/starfive,jh7110-mmc.yaml | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yamlDocumentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml new file +29
-0@@ -0,0 +1,72 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mmc/starfive,jh7110-mmc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive Designware Mobile Storage Host Controller + +description: + StarFive uses the Synopsys designware mobile storage host controller + to interface a SoC with storage medium such as eMMC or SD/MMC cards. + +allOf: + - $ref: synopsys-dw-mshc-common.yaml# + +maintainers: + - William Qiu <[email protected]> + +properties: + compatible: + const: starfive,jh7110-mmc + + reg: + maxItems: 1 + + clocks: + items: + - description: biu clock + - description: ciu clock
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml line 39
Quoted 10 lines
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml new file +10
-0+ + clock-names: + items: + - const: biu + - const: ciu + + interrupts: + maxItems: 1 + + starfive,syscon:
Name is not specific enough. What is syscon? Any syscon? This needs to be specific.
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml line 42
Quoted 3 lines
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml new file +3
-0+ $ref: /schemas/types.yaml#/definitions/phandle-array + description: + arg0:arg0 is syscon.
What is syscon?
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml line 43
Quoted 1 line
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml new file +1
-0+ arg1:arg1 is syscon register offset, used to enable MMC function.
Describe the argument, not what it is used for, e.g. "offset of XXX YYY ZZZ"
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml line 45
Quoted 2 lines
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml new file +2
-0+ arg2:arg2 is used to enable the register shift of the MMC function. + arg3:arg3 is used to enable the register mask of the MMC function.
That's not how the phandle array is described. Instead:
Best regards,
Krzysztof
William Qiu
maintainerRe: [PATCH v2 1/3] dt-bindings: mmc: Add bindings for StarFive
Quoted 4 lines · Krzysztof Kozlowski
Quoted 2 lines · William Qiu
Add documentation to describe StarFive
designware mobile storage host controller driver.
Quoted 9 lines
Please wrap commit message according to Linux coding style / submission process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v5.18-rc4/source/Documentation/process/submitting-patches.rst#L586The subject is a bit redundant and not precise. No need to mention "bindings" twice but "StarFive" is really too generic. Do you add now all possible devices from StarFive? I see only one. Rephrase (use git log to find examples).
Will update
Quoted 47 lines
Quoted 47 lines
Signed-off-by William Qiu <[email protected]>--- .../bindings/mmc/starfive,jh7110-mmc.yaml | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yamlDocumentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml new file +34
-0@@ -0,0 +1,72 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mmc/starfive,jh7110-mmc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive Designware Mobile Storage Host Controller + +description: + StarFive uses the Synopsys designware mobile storage host controller + to interface a SoC with storage medium such as eMMC or SD/MMC cards. + +allOf: + - $ref: synopsys-dw-mshc-common.yaml# + +maintainers: + - William Qiu <[email protected]> + +properties: + compatible: + const: starfive,jh7110-mmc + + reg: + maxItems: 1 + + clocks: + items: + - description: biu clock + - description: ciu clock + + clock-names: + items: + - const: biu + - const: ciu
Quoted 9 lines
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml line 39
Quoted 5 lines
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml new file +5
-0+ + interrupts: + maxItems: 1 + + starfive,syscon:Name is not specific enough. What is syscon? Any syscon? This needs to be specific.
Will update.
Quoted 6 lines
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml line 42
Quoted 3 lines
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml new file +3
-0+ $ref: /schemas/types.yaml#/definitions/phandle-array + description: + arg0:arg0 is syscon.What is syscon?
Will update.
Quoted 11 lines
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml line 43
Quoted 1 line
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml new file +1
-0+ arg1:arg1 is syscon register offset, used to enable MMC function.Describe the argument, not what it is used for, e.g. "offset of XXX YYY ZZZ"
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml line 45
Quoted 2 lines
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml new file +2
-0+ arg2:arg2 is used to enable the register shift of the MMC function. + arg3:arg3 is used to enable the register mask of the MMC function.That's not how the phandle array is described. Instead:
Hi Krzysztof,
Thank you for taking time to review and provide helpful comments for this patch. I will fix all the above issues in the next version.
Best Regards,
William Qiu
Quoted 5 lines
Best regards,
Krzysztof
William Qiu
maintainerPATCH v2 2/3 mmc: starfive: Add sdio/emmc driver support
In reply to William QiuAdd sdio/emmc driver support for StarFive JH7110 soc.
--- MAINTAINERS | 6 + drivers/mmc/host/Kconfig | 10 ++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/dw_mmc-starfive.c | 185 +++++++++++++++++++++++++++++ 4 files changed, 202 insertions(+) create mode 100644 drivers/mmc/host/dw_mmc-starfive.c
MAINTAINERS +6 -0
@@ -19623,6 +19623,12 @@ F: Documentation/devicetree/bindings/reset/starfive,jh7100-reset.yaml F: drivers/reset/starfive/ F: include/dt-bindings/reset/starfive* +STARFIVE JH7110 MMC/SD/SDIO DRIVER +M: William Qiu <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/mmc/starfive* +F: drivers/mmc/dw_mmc-starfive.c + STATIC BRANCH/CALL M: Peter Zijlstra <[email protected]> M: Josh Poimboeuf <[email protected]>
drivers/mmc/host/Kconfig +10 -0
@@ -871,6 +871,16 @@ config MMC_DW_ROCKCHIP Synopsys DesignWare Memory Card Interface driver. Select this option for platforms based on RK3066, RK3188 and RK3288 SoC's. +config MMC_DW_STARFIVE + tristate "StarFive specific extensions for Synopsys DW Memory Card Interface" + depends on SOC_STARFIVE + depends on MMC_DW + select MMC_DW_PLTFM + help + This selects support for StarFive JH7110 SoC specific extensions to the + Synopsys DesignWare Memory Card Interface driver. Select this option + for platforms based on StarFive JH7110 SoC. + config MMC_SH_MMCIF tristate "SuperH Internal MMCIF support" depends on SUPERH || ARCH_RENESAS || COMPILE_TEST
drivers/mmc/host/Makefile +1 -0
@@ -56,6 +56,7 @@ obj-$(CONFIG_MMC_DW_HI3798CV200) += dw_mmc-hi3798cv200.o obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o +obj-$(CONFIG_MMC_DW_STARFIVE) += dw_mmc-starfive.o obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o obj-$(CONFIG_MMC_VUB300) += vub300.o
drivers/mmc/host/dw_mmc-starfive.c new file +185 -0
185 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v2 2/3] mmc: starfive: Add sdio/emmc driver support
Quoted 3 lines · William Qiu
Add sdio/emmc driver support for StarFive JH7110 soc.
Signed-off-by William Qiu <[email protected]>
Gave the patch a go w/ a chroot running on the sdcard. Seemed fine :)
Thanks,
Conor.
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
William Qiu
maintainerPATCH v2 3/3 riscv: dts: starfive: Add mmc node
In reply to William QiuThis adds the mmc node for the StarFive JH7110 SoC. Set sdioo node to emmc and set sdio1 node to sd.
--- .../jh7110-starfive-visionfive-v2.dts | 25 ++++++++++++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 +++++++++++++++++++ 2 files changed, 63 insertions(+)
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +25 -0
@@ -47,6 +47,31 @@ &clk_rtc { clock-frequency = <32768>; }; +&mmc0 { + max-frequency = <100000000>; + card-detect-delay = <300>; + bus-width = <8>; + cap-mmc-highspeed; + mmc-ddr-1_8v; + mmc-hs200-1_8v; + non-removable; + cap-mmc-hw-reset; + post-power-on-delay-ms = <200>; + status = "okay"; +}; + +&mmc1 { + max-frequency = <100000000>; + card-detect-delay = <300>; + bus-width = <4>; + no-sdio; + no-mmc; + broken-cd; + cap-sd-highspeed; + post-power-on-delay-ms = <200>; + status = "okay"; +}; + &gmac0_rmii_refin { clock-frequency = <50000000>; };
arch/riscv/boot/dts/starfive/jh7110.dtsi +38 -0
@@ -331,6 +331,11 @@ aoncrg: clock-controller@17000000 { #reset-cells = <1>; }; + syscon: syscon@13030000 { + compatible = "starfive,syscon", "syscon"; + reg = <0x0 0x13030000 0x0 0x1000>; + }; + gpio: gpio@13040000 { compatible = "starfive,jh7110-sys-pinctrl"; reg = <0x0 0x13040000 0x0 0x10000>;
@@ -433,5 +438,38 @@ uart5: serial@12020000 { reg-shift = <2>; status = "disabled"; }; + + /* unremovable emmc as mmcblk0 */ + mmc0: mmc@16010000 { + compatible = "starfive,jh7110-mmc"; + reg = <0x0 0x16010000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_SDIO0_AHB>, + <&syscrg JH7110_SYSCLK_SDIO0_SDCARD>; + clock-names = "biu","ciu"; + resets = <&syscrg JH7110_SYSRST_SDIO0_AHB>; + reset-names = "reset"; + interrupts = <74>; + fifo-depth = <32>; + fifo-watermark-aligned; + data-addr = <0>; + starfive,syscon = <&syscon 0x14 0x1a 0x7c000000>; + status = "disabled"; + }; + + mmc1: mmc@16020000 { + compatible = "starfive,jh7110-mmc"; + reg = <0x0 0x16020000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_SDIO1_AHB>, + <&syscrg JH7110_SYSCLK_SDIO1_SDCARD>; + clock-names = "biu","ciu"; + resets = <&syscrg JH7110_SYSRST_SDIO1_AHB>; + reset-names = "reset"; + interrupts = <75>; + fifo-depth = <32>; + fifo-watermark-aligned; + data-addr = <0>; + starfive,syscon = <&syscon 0x9c 0x1 0x3e>; + status = "disabled"; + }; }; };
Signature · 1 line
2.34.1
Re: [PATCH v2 3/3] riscv: dts: starfive: Add mmc node
Quoted 15 lines · William Qiu
This adds the mmc node for the StarFive JH7110 SoC. Set sdioo node to emmc and set sdio1 node to sd.
Signed-off-by William Qiu <[email protected]>--- .../jh7110-starfive-visionfive-v2.dts | 25 ++++++++++++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 +++++++++++++++++++ 2 files changed, 63 insertions(+)arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +0
-0
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts &clk_rtc { · line 52
Quoted 6 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +3
-0@@ -47,6 +47,31 @@ &clk_rtc { clock-frequency = <32768>; }; +&mmc0 { + max-frequency = <100000000>; + card-detect-delay = <300>;
Nitpick: This seems redundant for a non-removable card!?
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts &clk_rtc { · line 65
Quoted 13 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +13
-0+ bus-width = <8>; + cap-mmc-highspeed; + mmc-ddr-1_8v; + mmc-hs200-1_8v; + non-removable; + cap-mmc-hw-reset; + post-power-on-delay-ms = <200>; + status = "okay"; +}; + +&mmc1 { + max-frequency = <100000000>; + card-detect-delay = <300>;
Nitpick: This looks redundant for polling based card detection (broken-cd is set a few lines below).
Quoted 29 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +9
-0+ bus-width = <4>; + no-sdio; + no-mmc; + broken-cd; + cap-sd-highspeed; + post-power-on-delay-ms = <200>; + status = "okay"; +}; + &gmac0_rmii_refin { clock-frequency = <50000000>; };arch/riscv/boot/dts/starfive/jh7110.dtsi +5
-0@@ -331,6 +331,11 @@ aoncrg: clock-controller@17000000 { #reset-cells = <1>; }; + syscon: syscon@13030000 { + compatible = "starfive,syscon", "syscon"; + reg = <0x0 0x13030000 0x0 0x1000>; + }; + gpio: gpio@13040000 { compatible = "starfive,jh7110-sys-pinctrl"; reg = <0x0 0x13040000 0x0 0x10000>;
arch/riscv/boot/dts/starfive/jh7110.dtsi uart5: serial@12020000 { · line 442
Quoted 5 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +2
-0@@ -433,5 +438,38 @@ uart5: serial@12020000 { reg-shift = <2>; status = "disabled"; }; + + /* unremovable emmc as mmcblk0 */
Don't confuse the mmc0 node name with mmcblk0. There is no guarantee that this is true, unless you also specify an alias.
Quoted 23 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +23
-0+ mmc0: mmc@16010000 { + compatible = "starfive,jh7110-mmc"; + reg = <0x0 0x16010000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_SDIO0_AHB>, + <&syscrg JH7110_SYSCLK_SDIO0_SDCARD>; + clock-names = "biu","ciu"; + resets = <&syscrg JH7110_SYSRST_SDIO0_AHB>; + reset-names = "reset"; + interrupts = <74>; + fifo-depth = <32>; + fifo-watermark-aligned; + data-addr = <0>; + starfive,syscon = <&syscon 0x14 0x1a 0x7c000000>; + status = "disabled"; + }; + + mmc1: mmc@16020000 { + compatible = "starfive,jh7110-mmc"; + reg = <0x0 0x16020000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_SDIO1_AHB>, + <&syscrg JH7110_SYSCLK_SDIO1_SDCARD>; + clock-names = "biu","ciu"; + resets = <&syscrg JH7110_SYSRST_SDIO1_AHB>;
arch/riscv/boot/dts/starfive/jh7110.dtsi uart5: serial@12020000 { · line 475
Quoted 10 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +8
-0+ reset-names = "reset"; + interrupts = <75>; + fifo-depth = <32>; + fifo-watermark-aligned; + data-addr = <0>; + starfive,syscon = <&syscon 0x9c 0x1 0x3e>; + status = "disabled"; + }; }; };
Kind regards
Uffe
William Qiu
maintainerRe: [PATCH v2 3/3] riscv: dts: starfive: Add mmc node
Quoted 19 lines · Ulf Hansson
Quoted 18 lines · William Qiu
This adds the mmc node for the StarFive JH7110 SoC. Set sdioo node to emmc and set sdio1 node to sd.
Signed-off-by William Qiu <[email protected]>--- .../jh7110-starfive-visionfive-v2.dts | 25 ++++++++++++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 +++++++++++++++++++ 2 files changed, 63 insertions(+)arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +0
-0@@ -47,6 +47,31 @@ &clk_rtc { clock-frequency = <32768>; };
Quoted 6 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts &clk_rtc { · line 52
Quoted 3 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +3
-0+&mmc0 { + max-frequency = <100000000>; + card-detect-delay = <300>;Nitpick: This seems redundant for a non-removable card!?
Will drop
Quoted 8 lines
Quoted 8 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +8
-0+ bus-width = <8>; + cap-mmc-highspeed; + mmc-ddr-1_8v; + mmc-hs200-1_8v; + non-removable; + cap-mmc-hw-reset; + post-power-on-delay-ms = <200>; + status = "okay";
Quoted 9 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts &clk_rtc { · line 65
Quoted 5 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +5
-0+}; + +&mmc1 { + max-frequency = <100000000>; + card-detect-delay = <300>;Nitpick: This looks redundant for polling based card detection (broken-cd is set a few lines below).
Will drop
Quoted 29 lines
Quoted 29 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +9
-0+ bus-width = <4>; + no-sdio; + no-mmc; + broken-cd; + cap-sd-highspeed; + post-power-on-delay-ms = <200>; + status = "okay"; +}; + &gmac0_rmii_refin { clock-frequency = <50000000>; };arch/riscv/boot/dts/starfive/jh7110.dtsi +5
-0@@ -331,6 +331,11 @@ aoncrg: clock-controller@17000000 { #reset-cells = <1>; }; + syscon: syscon@13030000 { + compatible = "starfive,syscon", "syscon"; + reg = <0x0 0x13030000 0x0 0x1000>; + }; + gpio: gpio@13040000 { compatible = "starfive,jh7110-sys-pinctrl"; reg = <0x0 0x13040000 0x0 0x10000>;@@ -433,5 +438,38 @@ uart5: serial@12020000 {
Quoted 9 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi uart5: serial@12020000 { · line 442
Quoted 5 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +2
-0reg-shift = <2>; status = "disabled"; }; + + /* unremovable emmc as mmcblk0 */Don't confuse the mmc0 node name with mmcblk0. There is no guarantee that this is true, unless you also specify an alias.
Hi Ulf,
Thank you for taking time to review and provide helpful comments for this patch. Actually we define mmc0 as eMMC, which is mmcblk0 in the kernel, and define mmc1 as SDIO, which is mmcblk1 in the kernel, so it's not confuse.
Best Regards
William Qiu
Quoted 36 lines
Quoted 23 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +23
-0+ mmc0: mmc@16010000 { + compatible = "starfive,jh7110-mmc"; + reg = <0x0 0x16010000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_SDIO0_AHB>, + <&syscrg JH7110_SYSCLK_SDIO0_SDCARD>; + clock-names = "biu","ciu"; + resets = <&syscrg JH7110_SYSRST_SDIO0_AHB>; + reset-names = "reset"; + interrupts = <74>; + fifo-depth = <32>; + fifo-watermark-aligned; + data-addr = <0>; + starfive,syscon = <&syscon 0x14 0x1a 0x7c000000>; + status = "disabled"; + }; + + mmc1: mmc@16020000 { + compatible = "starfive,jh7110-mmc"; + reg = <0x0 0x16020000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_SDIO1_AHB>, + <&syscrg JH7110_SYSCLK_SDIO1_SDCARD>; + clock-names = "biu","ciu"; + resets = <&syscrg JH7110_SYSRST_SDIO1_AHB>;arch/riscv/boot/dts/starfive/jh7110.dtsi uart5: serial@12020000 { · line 475
Quoted 10 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +8
-0+ reset-names = "reset"; + interrupts = <75>; + fifo-depth = <32>; + fifo-watermark-aligned; + data-addr = <0>; + starfive,syscon = <&syscon 0x9c 0x1 0x3e>; + status = "disabled"; + }; }; };Kind regards
Uffe
Re: [PATCH v2 3/3] riscv: dts: starfive: Add mmc node
Quoted 91 lines · William Qiu
Quoted 19 lines · Ulf Hansson
Quoted 18 lines · William Qiu
This adds the mmc node for the StarFive JH7110 SoC. Set sdioo node to emmc and set sdio1 node to sd.
Signed-off-by William Qiu <[email protected]>--- .../jh7110-starfive-visionfive-v2.dts | 25 ++++++++++++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 +++++++++++++++++++ 2 files changed, 63 insertions(+)arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +0
-0@@ -47,6 +47,31 @@ &clk_rtc { clock-frequency = <32768>; };Quoted 6 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts &clk_rtc { · line 52
Quoted 3 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +3
-0+&mmc0 { + max-frequency = <100000000>; + card-detect-delay = <300>;Nitpick: This seems redundant for a non-removable card!?
Will drop
Quoted 8 lines
Quoted 8 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +8
-0+ bus-width = <8>; + cap-mmc-highspeed; + mmc-ddr-1_8v; + mmc-hs200-1_8v; + non-removable; + cap-mmc-hw-reset; + post-power-on-delay-ms = <200>; + status = "okay";Quoted 9 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts &clk_rtc { · line 65
Quoted 5 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +5
-0+}; + +&mmc1 { + max-frequency = <100000000>; + card-detect-delay = <300>;Nitpick: This looks redundant for polling based card detection (broken-cd is set a few lines below).
Will drop
Quoted 29 lines
Quoted 29 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +9
-0+ bus-width = <4>; + no-sdio; + no-mmc; + broken-cd; + cap-sd-highspeed; + post-power-on-delay-ms = <200>; + status = "okay"; +}; + &gmac0_rmii_refin { clock-frequency = <50000000>; };arch/riscv/boot/dts/starfive/jh7110.dtsi +5
-0@@ -331,6 +331,11 @@ aoncrg: clock-controller@17000000 { #reset-cells = <1>; }; + syscon: syscon@13030000 { + compatible = "starfive,syscon", "syscon"; + reg = <0x0 0x13030000 0x0 0x1000>; + }; + gpio: gpio@13040000 { compatible = "starfive,jh7110-sys-pinctrl"; reg = <0x0 0x13040000 0x0 0x10000>;@@ -433,5 +438,38 @@ uart5: serial@12020000 {Quoted 9 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi uart5: serial@12020000 { · line 442
Quoted 5 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +2
-0reg-shift = <2>; status = "disabled"; }; + + /* unremovable emmc as mmcblk0 */Don't confuse the mmc0 node name with mmcblk0. There is no guarantee that this is true, unless you also specify an alias.
Quoted 6 lines
Hi Ulf,
Thank you for taking time to review and provide helpful comments for this patch. Actually we define mmc0 as eMMC, which is mmcblk0 in the kernel, and define mmc1 as SDIO, which is mmcblk1 in the kernel, so it's not confuse.
My point is, mmc0 from DT node perspective doesn't necessarily need to map to mmc0, as that depends on the "probe" order of the devices. At least for the Linux kernel, mmc0 from DT point of view, could end up being mmc1.
To avoid confusion, please drop the "mmcblk*" here. It's anyway a Linux specific thing. Don't get me wrong, feel free to keep the information about eMMC and SDIO for the corresponding mmc controller node.
Moreover, if you can't use PARTID/UUID to find the rootfs device - then you may use an aliases node, to let mmc0 to be enumerated as mmc0, for example. See below.
aliases {
mmc0 = &mmc0;
}Kind regards
Uffe
William Qiu
maintainerRe: [PATCH v2 3/3] riscv: dts: starfive: Add mmc node
Quoted 113 lines · Ulf Hansson
Quoted 91 lines · William Qiu
Quoted 19 lines · Ulf Hansson
Quoted 18 lines · William Qiu
This adds the mmc node for the StarFive JH7110 SoC. Set sdioo node to emmc and set sdio1 node to sd.
Signed-off-by William Qiu <[email protected]>--- .../jh7110-starfive-visionfive-v2.dts | 25 ++++++++++++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 +++++++++++++++++++ 2 files changed, 63 insertions(+)arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +0
-0@@ -47,6 +47,31 @@ &clk_rtc { clock-frequency = <32768>; };Quoted 6 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts &clk_rtc { · line 52
Quoted 3 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +3
-0+&mmc0 { + max-frequency = <100000000>; + card-detect-delay = <300>;Nitpick: This seems redundant for a non-removable card!?
Will drop
Quoted 8 lines
Quoted 8 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +8
-0+ bus-width = <8>; + cap-mmc-highspeed; + mmc-ddr-1_8v; + mmc-hs200-1_8v; + non-removable; + cap-mmc-hw-reset; + post-power-on-delay-ms = <200>; + status = "okay";Quoted 9 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts &clk_rtc { · line 65
Quoted 5 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +5
-0+}; + +&mmc1 { + max-frequency = <100000000>; + card-detect-delay = <300>;Nitpick: This looks redundant for polling based card detection (broken-cd is set a few lines below).
Will drop
Quoted 29 lines
Quoted 29 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +9
-0+ bus-width = <4>; + no-sdio; + no-mmc; + broken-cd; + cap-sd-highspeed; + post-power-on-delay-ms = <200>; + status = "okay"; +}; + &gmac0_rmii_refin { clock-frequency = <50000000>; };arch/riscv/boot/dts/starfive/jh7110.dtsi +5
-0@@ -331,6 +331,11 @@ aoncrg: clock-controller@17000000 { #reset-cells = <1>; }; + syscon: syscon@13030000 { + compatible = "starfive,syscon", "syscon"; + reg = <0x0 0x13030000 0x0 0x1000>; + }; + gpio: gpio@13040000 { compatible = "starfive,jh7110-sys-pinctrl"; reg = <0x0 0x13040000 0x0 0x10000>;@@ -433,5 +438,38 @@ uart5: serial@12020000 {Quoted 9 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi uart5: serial@12020000 { · line 442
Quoted 5 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +2
-0reg-shift = <2>; status = "disabled"; }; + + /* unremovable emmc as mmcblk0 */Don't confuse the mmc0 node name with mmcblk0. There is no guarantee that this is true, unless you also specify an alias.
Quoted 6 lines
Hi Ulf,
Thank you for taking time to review and provide helpful comments for this patch. Actually we define mmc0 as eMMC, which is mmcblk0 in the kernel, and define mmc1 as SDIO, which is mmcblk1 in the kernel, so it's not confuse.
My point is, mmc0 from DT node perspective doesn't necessarily need to map to mmc0, as that depends on the "probe" order of the devices. At least for the Linux kernel, mmc0 from DT point of view, could end up being mmc1.
To avoid confusion, please drop the "mmcblk*" here. It's anyway a Linux specific thing. Don't get me wrong, feel free to keep the information about eMMC and SDIO for the corresponding mmc controller node.
Moreover, if you can't use PARTID/UUID to find the rootfs device - then you may use an aliases node, to let mmc0 to be enumerated as mmc0, for example. See below.
Quoted 6 lines
aliases { mmc0 = &mmc0; }Kind regards
Uffe
Hi Uffe,
Thank you for taking time to review.
I'll take your suggestion into consideration and drop the "mmcblk*".
Best Regards
William Qiu
Conor Dooley
maintainerRe: [PATCH v2 3/3] riscv: dts: starfive: Add mmc node
In reply to William QiuHey William,
Quoted 6 lines · William Qiu
This adds the mmc node for the StarFive JH7110 SoC. Set sdioo node to emmc and set sdio1 node to sd.
Signed-off-by William Qiu <[email protected]>--- .../jh7110-starfive-visionfive-v2.dts | 25 ++++++++++++
FYI, this file does not exist in the v3 Devicetree patchset sent by Hal Feng:
https://lore.kernel.org/linux-riscv/[email protected]
Would you make sure that future revisions take into account that there is now a jh7110-starfive-visionfive-2.dtsi file instead?
Thanks,
Conor.
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
William Qiu
maintainerRe: [PATCH v2 3/3] riscv: dts: starfive: Add mmc node
Quoted 14 lines · Conor Dooley
Hey William,
Quoted 6 lines · William Qiu
This adds the mmc node for the StarFive JH7110 SoC. Set sdioo node to emmc and set sdio1 node to sd.
Signed-off-by William Qiu <[email protected]>--- .../jh7110-starfive-visionfive-v2.dts | 25 ++++++++++++FYI, this file does not exist in the v3 Devicetree patchset sent by Hal Feng:
https://lore.kernel.org/linux-riscv/[email protected]
Quoted 6 lines
Would you make sure that future revisions take into account that there is now a
jh7110-starfive-visionfive-2.dtsifile instead?Thanks,
Conor.
Hi Conor,
I did it based on v2 and will rebase to v3 in the next version.
Best Regards
William Qiu
William Qiu
maintainerQuoted 37 lines · William Qiu
Hi,
This patchset adds initial rudimentary support for the StarFive designware mobile storage host controller driver. And this driver will be used in StarFive's VisionFive 2 board. The main purpose of adding this driver is to accommodate the ultra-high speed mode of eMMC.
The last patch should be applied after the patchset [1]:
[1] https://lore.kernel.org/all/[email protected]/Changes since v1:
- Renamed the dt-binding 'starfive,jh7110-sdio.yaml' to 'starfive,jh7110-mmc.yaml'.
- Changed the type of 'starfive,syscon' and modify its description.
- Deleted unused head files like '#include <linux/gpio.h>'.
- Added comment for the 'rise_point' and 'fall_point'.
- Changed the API 'num_caps' to 'common_caps'.
- Changed the node name 'sys_syscon' to 'syscon'.
- Changed the node name 'sdio' to 'mmc'.The patch series is based on v6.1-rc5.
William Qiu (3):
dt-bindings: mmc: Add bindings for StarFive
mmc: starfive: Add sdio/emmc driver support
riscv: dts: starfive: Add mmc node.../bindings/mmc/starfive,jh7110-mmc.yaml | 72 +++++++ MAINTAINERS | 6 + .../jh7110-starfive-visionfive-v2.dts | 25 +++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 ++++ drivers/mmc/host/Kconfig | 10 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/dw_mmc-starfive.c | 185 ++++++++++++++++++ 7 files changed, 337 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml create mode 100644 drivers/mmc/host/dw_mmc-starfive.c
Quoted 3 lines
--
2.34.1
Hi Rob/Jaehoon,
Could you please help to review and provide comments on this patch series? Thank you in advance.
Best regards,
William Qiu