Skip to contentSkip to conversation

Add driver for Cadence SD6HC SD/eMMC controller

PATCH In review Alex Soo 2 participants 6 messages Dec 28, 2023 – Jan 4, 2024

Subsystems (6)
lore
Share & tools
lore

Alex Soo

author
#0 lore raw

cover Add driver for Cadence SD6HC SD/eMMC controller

Starfive JH8100 SoC consists of a Cadence SD/eMMC host controller (Version 6) with Combo PHY which provides DFI interface to SD/eMMC removable or embedded devices. This patch adds initial SD/eMMC support for JH8100 SoC by providing device drivers for Cadence SD/eMMC Version 6 host controller and Combo PHY. This patch series is depending on the JH8100 base patch series in [1], [2], and [3].
The relevant dt-bindings documentation has been updated accordingly.

[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/
[3] https://lore.kernel.org/lkml/[email protected]/

Alex Soo (3):
dt-bindings: mmc: sdhci-cadence6: add DT bindings documentation
mmc: sdhci-cadence6: add Cadence SD6HC support
riscv: dts: starfive: jh8100: Add SD/eMMC device tree nodes

 .../devicetree/bindings/mmc/cdns,sd6hci.yaml  |  65 +++
 MAINTAINERS                                   |   6 +
 arch/riscv/boot/dts/starfive/jh8100.dtsi      |  34 ++
 drivers/mmc/host/Kconfig                      |  11 +
 drivers/mmc/host/Makefile                     |   2 +
 drivers/mmc/host/sdhci-cadence6-phy.c         | 384 +++++++++++++
 drivers/mmc/host/sdhci-cadence6.c             | 531 ++++++++++++++++++
 drivers/mmc/host/sdhci-cadence6.h             | 148 +++++
 8 files changed, 1181 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/cdns,sd6hci.yaml
 create mode 100644 drivers/mmc/host/sdhci-cadence6-phy.c
 create mode 100644 drivers/mmc/host/sdhci-cadence6.c
 create mode 100644 drivers/mmc/host/sdhci-cadence6.h
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/3 dt-bindings: mmc: sdhci-cadence6: add DT bindings documentation

Add DT bindings documentation for Cadence SD/eMMC host controller (Version 6) driver.

---
 .../devicetree/bindings/mmc/cdns,sd6hci.yaml  | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/cdns,sd6hci.yaml
Documentation/devicetree/bindings/mmc/cdns,sd6hci.yaml new file +65 -0
new file mode 100644
index 000000000000..97e28d720c7b
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mmc/cdns,sd6hci.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cadence SD/SDIO/eMMC Host Controller Version 6.0 (SD6HC)
+
+maintainers:
+  - Alex Soo <[email protected]>
+
+allOf:
+  - $ref: mmc-controller.yaml
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - starfive,jh8100-sd6hc
+      - const: cdns,sd6hc
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clock-names:
+    items:
+      - const: main
+      - const: sdmclk
+
+  clocks:
+    items:
+      - description: main clock gate which controls the gating of all clock signals to SDHCI
+                     controller
+      - description: the SD master clock signal
+
+  resets:
+    items:
+      - description: reset phandle which controls the assert/deassert of all reset lines to
+                     SDHCI controller
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clock-names
+  - clocks
+  - resets
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    emmc: mmc@1f110000 {
+        compatible = "starfive,jh8100-sd6hc", "cdns,sd6hc";
+        reg = <0x1f110000 0x10000>;
+        interrupts = <174>;
+        clock-names = "main", "sdmclk";
+        clocks = <&aoncrg 62>,
+                 <&aoncrg 43>;
+        resets = <&aoncrg 9>;
+        bus-width = <8>;
+    };
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 1/3] dt-bindings: mmc: sdhci-cadence6: add DT bindings documentation

Quoted 4 lines · Alex Soo

Add DT bindings documentation for Cadence SD/eMMC host controller (Version 6) driver.

A nit, subject: drop second/last, redundant "DT bindings documentation". The "dt-bindings" prefix is already stating that these are bindings.

Basically your subject is pure redundancy.

Documentation/devicetree/bindings/mmc/cdns,sd6hci.yaml

Quoted 10 lines
---
 .../devicetree/bindings/mmc/cdns,sd6hci.yaml  | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/cdns,sd6hci.yaml
Documentation/devicetree/bindings/mmc/cdns,sd6hci.yaml new file +0 -0
new file mode 100644
index 000000000000..97e28d720c7b

There were several other patches adding this, so please consolidate the effort. You just duplicated a lot of code.

Best regards,
Krzysztof

author
#3 lore raw

PATCH 2/3 mmc: sdhci-cadence6: add Cadence SD6HC support

In reply to Alex Soo

Add a driver for the Cadence SD6HC SD/SDIO/eMMC controller.

---
 MAINTAINERS                           |   6 +
 drivers/mmc/host/Kconfig              |  11 +
 drivers/mmc/host/Makefile             |   2 +
 drivers/mmc/host/sdhci-cadence6-phy.c | 384 +++++++++++++++++++
 drivers/mmc/host/sdhci-cadence6.c     | 531 ++++++++++++++++++++++++++
 drivers/mmc/host/sdhci-cadence6.h     | 148 +++++++
 6 files changed, 1082 insertions(+)
 create mode 100644 drivers/mmc/host/sdhci-cadence6-phy.c
 create mode 100644 drivers/mmc/host/sdhci-cadence6.c
 create mode 100644 drivers/mmc/host/sdhci-cadence6.h
MAINTAINERS +6 -0
index 451ee21086a7..88e2120a4cef 100644
@@ -4537,6 +4537,12 @@ S:	Orphan
 F:	Documentation/devicetree/bindings/mtd/cadence-nand-controller.txt
 F:	drivers/mtd/nand/raw/cadence-nand-controller.c
 
+CADENCE SDHCI MMC HOST CONTROLLER VERSION 6 DRIVER
+M:	Alex Soo <[email protected]>
+S:	Supported
+F:	Documentation/devicetree/bindings/mmc/cdns,sd6hci.yaml
+F:	drivers/mmc/host/sdhci-cadence6*
+
 CADENCE USB3 DRD IP DRIVER
 M:	Peter Chen <[email protected]>
 M:	Pawel Laszczak <[email protected]>
drivers/mmc/host/Kconfig +11 -0
index 58bd5fe4cd25..892923ee5a7a 100644
@@ -263,6 +263,17 @@ config MMC_SDHCI_CADENCE
 
 	  If unsure, say N.
 
+config MMC_SDHCI_CADENCE6
+	tristate "SDHCI support for the Cadence SD/SDIO/eMMC (Version 6) controller"
+	depends on MMC_SDHCI_PLTFM
+	depends on OF
+	help
+	  This selects the Cadence SD/SDIO/eMMC (Version 6) driver.
+
+	  If you have a controller with this interface, say Y or M here.
+
+	  If unsure, say N.
+
 config MMC_SDHCI_ESDHC_MCF
 	tristate "SDHCI support for the Freescale eSDHC ColdFire controller"
 	depends on M5441x
drivers/mmc/host/Makefile +2 -0
index d0be4465f3ec..9a4cbedfd196 100644
@@ -109,3 +109,5 @@ endif
 
 obj-$(CONFIG_MMC_SDHCI_XENON)	+= sdhci-xenon-driver.o
 sdhci-xenon-driver-y		+= sdhci-xenon.o sdhci-xenon-phy.o
+obj-$(CONFIG_MMC_SDHCI_CADENCE6)	+= sdhci-cadence6-driver.o
+sdhci-cadence6-driver-y		+= sdhci-cadence6.o sdhci-cadence6-phy.o
drivers/mmc/host/sdhci-cadence6-phy.c new file +384 -0

384 lines not on this page · raw message

drivers/mmc/host/sdhci-cadence6.c new file +531 -0

531 lines not on this page · raw message

drivers/mmc/host/sdhci-cadence6.h new file +148 -0

148 lines not on this page · raw message

Signature · 1 line
2.25.1
#4 lore raw

Re: [PATCH 2/3] mmc: sdhci-cadence6: add Cadence SD6HC support

Quoted 14 lines · Alex Soo

Add a driver for the Cadence SD6HC SD/SDIO/eMMC controller.

---
 MAINTAINERS                           |   6 +
 drivers/mmc/host/Kconfig              |  11 +
 drivers/mmc/host/Makefile             |   2 +
 drivers/mmc/host/sdhci-cadence6-phy.c | 384 +++++++++++++++++++
 drivers/mmc/host/sdhci-cadence6.c     | 531 ++++++++++++++++++++++++++
 drivers/mmc/host/sdhci-cadence6.h     | 148 +++++++
 6 files changed, 1082 insertions(+)
 create mode 100644 drivers/mmc/host/sdhci-cadence6-phy.c
 create mode 100644 drivers/mmc/host/sdhci-cadence6.c
 create mode 100644 drivers/mmc/host/sdhci-cadence6.h

Please work with existing submissions:

https://lore.kernel.org/all/?q=sd6hc

Best regards,
Krzysztof

author
#5 lore raw

PATCH 3/3 riscv: dts: starfive: jh8100: Add SD/eMMC device tree nodes

In reply to Alex Soo

Add SD/eMMC device tree nodes.

---
 arch/riscv/boot/dts/starfive/jh8100.dtsi | 34 ++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
arch/riscv/boot/dts/starfive/jh8100.dtsi +34 -0
index 9c8ca73fffe0..545109ca6c49 100644
@@ -484,6 +484,15 @@ syscrg_sw: syscrg_sw@12720000 {
 			#reset-cells = <1>;
 		};
 
+		sd1: mmc@12740000 {
+			compatible = "starfive,jh8100-sd6hc", "cdns,sd6hc";
+			reg = <0x0 0x12740000 0x0 0x10000>;
+			interrupts = <91>;
+			bus-width = <4>;
+			cap-sd-highspeed;
+			status = "disabled";
+		};
+
 		pinctrl_gmac: pinctrl@12770000 {
 			compatible = "starfive,jh8100-sys-pinctrl-gmac",
 				     "syscon", "simple-mfd";
@@ -509,6 +518,31 @@ uart6: serial@127e0000  {
 			status = "disabled";
 		};
 
+		emmc: mmc@1f110000 {
+			compatible = "starfive,jh8100-sd6hc", "cdns,sd6hc";
+			reg = <0x0 0x1f110000 0x0 0x10000>;
+			interrupts = <174>;
+			clock-names = "main", "sdmclk";
+			clocks = <&aoncrg AONCRG_CLK_EMMC_ICG_EN>,
+				 <&aoncrg AONCRG_CLK_EMMC_SDMCLK>;
+			resets = <&aoncrg AONCRG_RSTN_EMMC>;
+			bus-width = <8>;
+			status = "disabled";
+		};
+
+		sd0: mmc@1f120000 {
+			compatible = "starfive,jh8100-sd6hc", "cdns,sd6hc";
+			reg = <0x0 0x1f120000 0x0 0x10000>;
+			interrupts = <175>;
+			clock-names = "main", "sdmclk";
+			clocks = <&aoncrg AONCRG_CLK_SDIO0_ICG_EN>,
+				 <&aoncrg AONCRG_CLK_SDIO0_SDMCLK>;
+			resets = <&aoncrg AONCRG_RSTN_SDIO0>;
+			bus-width = <4>;
+			cap-sd-highspeed;
+			status = "disabled";
+		};
+
 		pinctrl_aon: pinctrl@1f300000 {
 			compatible = "starfive,jh8100-aon-pinctrl",
 				     "syscon", "simple-mfd";
Signature · 1 line
2.25.1