Skip to contentSkip to conversation

Add mmc driver for Sunplus SP7021 SOC

PATCH In review Tony Huang 4 participants 8 messages Nov 6, 2021 – Nov 8, 2021

Subsystems (2)
lore
Share & tools
lore

Tony Huang

author
#0 lore raw

cover Add mmc driver for Sunplus SP7021 SOC

This is a patch series for mmc driver for Sunplus SP7021 SOC.

Sunplus SP7021 is an ARM Cortex A7 (4 cores) based SoC. It integrates many peripherals (ex: UART, I2C, SPI, SDIO, eMMC, USB, SD card and etc.) into a single chip. It is designed for industrial control.

Refer to:
https://sunplus-tibbo.atlassian.net/wiki/spaces/doc/overview
https://tibbo.com/store/plus1.html

Tony Huang (2):
dt-binding: mmc: Add mmc yaml file for Sunplus SP7021
mmc: Add mmc driver for Sunplus SP7021

 .../devicetree/bindings/mmc/sunplus-mmc.yaml       |   64 +
 MAINTAINERS                                        |    7 +
 drivers/mmc/host/Kconfig                           |    9 +
 drivers/mmc/host/Makefile                          |    1 +
 drivers/mmc/host/sunplus_mmc.c                     | 1593 ++++++++++++++++++++
 drivers/mmc/host/sunplus_mmc.h                     |  181 +++
 6 files changed, 1855 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml
 create mode 100644 drivers/mmc/host/sunplus_mmc.c
 create mode 100644 drivers/mmc/host/sunplus_mmc.h
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/2 dt-binding: mmc: Add mmc yaml file for Sunplus SP7021

Add mmc yaml file for Sunplus SP7021

---
 .../devicetree/bindings/mmc/sunplus-mmc.yaml       | 64 ++++++++++++++++++++++
 MAINTAINERS                                        |  5 ++
 2 files changed, 69 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml
Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml new file +64 -0
new file mode 100644
index 0000000..fc5a5f6
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) Sunplus Ltd. Co. 2021
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mmc/sunplus-mmc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: sunplus MMC controller
+
+allOf:
+  - $ref: "mmc-controller.yaml"
+
+maintainers:
+  - tony.huang <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - sunplus,sp7021-emmc
+      - sunplus,i143-emmc
+      - sunplus,q645-emmc
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    minItems: 1
+
+  resets:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - resets
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/sp-sp7021.h>
+    #include <dt-bindings/reset/sp-sp7021.h>
+    mmc0: mmc@9c003b00 {
+        compatible = "sunplus,sp7021-emmc";
+        reg = <0x9c003b00 0x180>;
+        interrupts = <20 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clkc CARD_CTL0>;
+        resets = <&rstc RST_CARD_CTL0>;
+        bus-width = <8>;
+        max-frequency = <52000000>;
+        non-removable;
+        disable-wp;
+        cap-mmc-highspeed;
+        mmc-ddr-3_3v;
+        no-sdio;
+        no-sd;
+    };
+...
MAINTAINERS +5 -0
index 3b79fd4..179e60a 100644
@@ -17945,6 +17945,11 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/dlink/sundance.c
 
+SUNPLUS MMC DRIVER
+M:	Tony Huang <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/mmc/sunplu-mmc.yaml
+
 SUPERH
 M:	Yoshinori Sato <[email protected]>
 M:	Rich Felker <[email protected]>
Signature · 1 line
2.7.4
maintainer
#2 lore raw

Re: [PATCH 1/2] dt-binding: mmc: Add mmc yaml file for Sunplus SP7021

Quoted 9 lines · Tony Huang

Add mmc yaml file for Sunplus SP7021

---
 .../devicetree/bindings/mmc/sunplus-mmc.yaml       | 64 ++++++++++++++++++++++
 MAINTAINERS                                        |  5 ++
 2 files changed, 69 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/mmc/sunplus-mmc.example.dts:21:18: fatal error: dt-bindings/clock/sp-sp7021.h: No such file or directory
21 | #include <dt-bindings/clock/sp-sp7021.h>

      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated.
make[1]: *** [scripts/Makefile.lib:385: Documentation/devicetree/bindings/mmc/sunplus-mmc.example.dt.yaml] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1441: dt_binding_check] Error 2

doc reference errors (make refcheckdocs):
MAINTAINERS: Documentation/devicetree/bindings/mmc/sunplu-mmc.yaml

See https://patchwork.ozlabs.org/patch/1551671

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.

maintainer
#3 lore raw

Re: [PATCH 1/2] dt-binding: mmc: Add mmc yaml file for Sunplus SP7021

In reply to Tony Huang
Quoted 19 lines · Tony Huang

Add mmc yaml file for Sunplus SP7021

---
 .../devicetree/bindings/mmc/sunplus-mmc.yaml       | 64 ++++++++++++++++++++++
 MAINTAINERS                                        |  5 ++
 2 files changed, 69 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml
Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml new file +4 -0
new file mode 100644
index 0000000..fc5a5f6
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) Sunplus Ltd. Co. 2021
+%YAML 1.2
+---

Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml line 14

Quoted 10 lines
Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml new file +10 -0
+$id: http://devicetree.org/schemas/mmc/sunplus-mmc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: sunplus MMC controller
+
+allOf:
+  - $ref: "mmc-controller.yaml"
+
+maintainers:
+  - tony.huang <[email protected]>

Please fix your name.

Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml line 21

Quoted 7 lines
Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml new file +7 -0
+
+properties:
+  compatible:
+    enum:
+      - sunplus,sp7021-emmc
+      - sunplus,i143-emmc
+      - sunplus,q645-emmc

blank line here.

Quoted 63 lines
Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml new file +43 -0
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    minItems: 1
+
+  resets:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - resets
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/sp-sp7021.h>
+    #include <dt-bindings/reset/sp-sp7021.h>
+    mmc0: mmc@9c003b00 {
+        compatible = "sunplus,sp7021-emmc";
+        reg = <0x9c003b00 0x180>;
+        interrupts = <20 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clkc CARD_CTL0>;
+        resets = <&rstc RST_CARD_CTL0>;
+        bus-width = <8>;
+        max-frequency = <52000000>;
+        non-removable;
+        disable-wp;
+        cap-mmc-highspeed;
+        mmc-ddr-3_3v;
+        no-sdio;
+        no-sd;
+    };
+...
MAINTAINERS +5 -0
index 3b79fd4..179e60a 100644
@@ -17945,6 +17945,11 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/dlink/sundance.c
 
+SUNPLUS MMC DRIVER
+M:	Tony Huang <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/mmc/sunplu-mmc.yaml
+
 SUPERH
 M:	Yoshinori Sato <[email protected]>
 M:	Rich Felker <[email protected]>
Signature · 1 line
2.7.4
#4 lore raw

RE: [PATCH 1/2] dt-binding: mmc: Add mmc yaml file for Sunplus SP7021

Dear Rob:

Quoted 29 lines

Subject: Re: [PATCH 1/2] dt-binding: mmc: Add mmc yaml file for Sunplus SP7021

Quoted 5 lines · Tony Huang

Add mmc yaml file for Sunplus SP7021

---
 .../devicetree/bindings/mmc/sunplus-mmc.yaml       | 64

++++++++++++++++++++++

Quoted 19 lines
 MAINTAINERS                                        |  5 ++
 2 files changed, 69 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml

Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml new file +7 -0
new file mode 100644
index 0000000..fc5a5f6
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) # Copyright
+(C) Sunplus Ltd. Co. 2021 %YAML 1.2
+---
+$id: http://devicetree.org/schemas/mmc/sunplus-mmc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: sunplus MMC controller
Quoted 8 lines

Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml line 14

Quoted 6 lines
Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml new file +6 -0
+
+allOf:
+  - $ref: "mmc-controller.yaml"
+
+maintainers:
+  - tony.huang <[email protected]>

Please fix your name.

OK,I will fix.

Quoted 10 lines

Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml line 21

Quoted 8 lines
Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml new file +7 -0
+
+properties:
+  compatible:
+    enum:
+      - sunplus,sp7021-emmc
+      - sunplus,i143-emmc
+      - sunplus,q645-emmc

blank line here.

OK,I will add blank line.

Quoted 63 lines
Quoted 63 lines
Documentation/devicetree/bindings/mmc/sunplus-mmc.yaml new file +43 -0
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    minItems: 1
+
+  resets:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - resets
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/sp-sp7021.h>
+    #include <dt-bindings/reset/sp-sp7021.h>
+    mmc0: mmc@9c003b00 {
+        compatible = "sunplus,sp7021-emmc";
+        reg = <0x9c003b00 0x180>;
+        interrupts = <20 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clkc CARD_CTL0>;
+        resets = <&rstc RST_CARD_CTL0>;
+        bus-width = <8>;
+        max-frequency = <52000000>;
+        non-removable;
+        disable-wp;
+        cap-mmc-highspeed;
+        mmc-ddr-3_3v;
+        no-sdio;
+        no-sd;
+    };
+...
MAINTAINERS +5 -1
@@ -17945,6 +17945,11 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/dlink/sundance.c
 
+SUNPLUS MMC DRIVER
+M:	Tony Huang <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/mmc/sunplu-mmc.yaml
+
 SUPERH
 M:	Yoshinori Sato <[email protected]>
 M:	Rich Felker <[email protected]>
--

2.7.4

author
#5 lore raw

PATCH 2/2 mmc: Add mmc driver for Sunplus SP7021

In reply to Tony Huang

Add mmc driver for Sunplus SP7021

---
 MAINTAINERS                    |    2 +
 drivers/mmc/host/Kconfig       |    9 +
 drivers/mmc/host/Makefile      |    1 +
 drivers/mmc/host/sunplus_mmc.c | 1593 ++++++++++++++++++++++++++++++++++++++++
 drivers/mmc/host/sunplus_mmc.h |  181 +++++
 5 files changed, 1786 insertions(+)
 create mode 100644 drivers/mmc/host/sunplus_mmc.c
 create mode 100644 drivers/mmc/host/sunplus_mmc.h
MAINTAINERS +2 -0
index 179e60a..47dc9ec 100644
@@ -17949,6 +17949,8 @@ SUNPLUS MMC DRIVER
 M:	Tony Huang <[email protected]>
 S:	Maintained
 F:	Documentation/devicetree/bindings/mmc/sunplu-mmc.yaml
+F:	drivers/mmc/host/sunplus_mmc.c
+F:	drivers/mmc/host/sunplus_mmc.h
 
 SUPERH
 M:	Yoshinori Sato <[email protected]>
drivers/mmc/host/Kconfig +9 -0
index ccc148c..2a78cbc 100644
@@ -14,6 +14,15 @@ config MMC_DEBUG
 	  added host drivers please don't invent their private macro for
 	  debugging.
 
+config MMC_SUNPLUS
+	tristate "Sunplus SP7021 MMC Controller"
+	depends on ARCH_SUNPLUS || SOC_I143 || SOC_Q645
+	default y
+	help
+		If you say yes here, you will get support for eMMC host interface
+		on sunplus Socs.
+		If unsure, say N.
+		Sunplus  eMMC Host Controller v4.51 support"
 config MMC_ARMMMCI
 	tristate "ARM AMBA Multimedia Card Interface support"
 	depends on ARM_AMBA
drivers/mmc/host/Makefile +1 -0
index 14004cc..5de6788 100644
@@ -98,6 +98,7 @@ obj-$(CONFIG_MMC_SDHCI_MICROCHIP_PIC32)	+= sdhci-pic32.o
 obj-$(CONFIG_MMC_SDHCI_BRCMSTB)		+= sdhci-brcmstb.o
 obj-$(CONFIG_MMC_SDHCI_OMAP)		+= sdhci-omap.o
 obj-$(CONFIG_MMC_SDHCI_SPRD)		+= sdhci-sprd.o
+obj-$(CONFIG_MMC_SUNPLUS)			+= sunplus_mmc.o
 obj-$(CONFIG_MMC_CQHCI)			+= cqhci.o
 cqhci-y					+= cqhci-core.o
 cqhci-$(CONFIG_MMC_CRYPTO)		+= cqhci-crypto.o
drivers/mmc/host/sunplus_mmc.c new file +1593 -0

1,593 lines not on this page · raw message

drivers/mmc/host/sunplus_mmc.h new file +181 -0

181 lines not on this page · raw message

Signature · 1 line
2.7.4
#6 lore raw

Re: [PATCH 2/2] mmc: Add mmc driver for Sunplus SP7021

[resending, had some kind of email error on the first try]

drivers/mmc/host/Kconfig config MMC_DEBUG · line 20

Quoted 12 lines · Tony Huang
drivers/mmc/host/Kconfig +4 -0
index ccc148c..2a78cbc 100644
@@ -14,6 +14,15 @@ config MMC_DEBUG
  	  added host drivers please don't invent their private macro for
  	  debugging.
 
+config MMC_SUNPLUS
+	tristate "Sunplus SP7021 MMC Controller"
+	depends on ARCH_SUNPLUS || SOC_I143 || SOC_Q645
+	default y

Is this needed to be able to boot? That's about the only reason that "default y" could be justified.

drivers/mmc/host/Kconfig config MMC_DEBUG · line 23

Quoted 3 lines
drivers/mmc/host/Kconfig +3 -0
+	help
+		If you say yes here, you will get support for eMMC host interface
+		on sunplus Socs.

Sunplus SoCs.

drivers/mmc/host/Kconfig config MMC_DEBUG · line 25

Quoted 2 lines
drivers/mmc/host/Kconfig +2 -0
+		If unsure, say N.
+		Sunplus  eMMC Host Controller v4.51 support"

What is that last line for?

And all lines of the help text should be indented with one tab + 2 spaces per coding-style.rst.

thanks.

Signature · 1 line
~Randy
#7 lore raw

RE: [PATCH 2/2] mmc: Add mmc driver for Sunplus SP7021

Dear Randy:

Quoted 11 lines

[resending, had some kind of email error on the first try]

Quoted 8 lines · Tony Huang
drivers/mmc/host/Kconfig index renamed from drivers/mmc/host/Kconfig +0 -0

ccc148c..2a78cbc 100644

drivers/mmc/host/Kconfig +0 -0
@@ -14,6 +14,15 @@ config MMC_DEBUG
  	  added host drivers please don't invent their private macro for
  	  debugging.
 
Quoted 7 lines

drivers/mmc/host/Kconfig config MMC_DEBUG · line 20

Quoted 4 lines
drivers/mmc/host/Kconfig +4 -0
+config MMC_SUNPLUS
+	tristate "Sunplus SP7021 MMC Controller"
+	depends on ARCH_SUNPLUS || SOC_I143 || SOC_Q645
+	default y

Is this needed to be able to boot? That's about the only reason that "default y" could be justified.

Yes, it needs to be able to be boot.

Quoted 6 lines

drivers/mmc/host/Kconfig config MMC_DEBUG · line 23

Quoted 4 lines
drivers/mmc/host/Kconfig +3 -0
+	help
+		If you say yes here, you will get support for eMMC host interface
+		on sunplus Socs.

Sunplus SoCs.

I will modify.

Quoted 5 lines

drivers/mmc/host/Kconfig config MMC_DEBUG · line 25

Quoted 3 lines
drivers/mmc/host/Kconfig +2 -0
+		If unsure, say N.
+		Sunplus  eMMC Host Controller v4.51 support"

What is that last line for?

I will remove last line.

Quoted 3 lines

And all lines of the help text should be indented with one tab + 2 spaces per coding-style.rst.

Ok, I understand

Quoted 4 lines

thanks.
--
~Randy