Skip to contentSkip to conversation

Add SD/SDIO control driver for Sunplus SP7021 SoC

PATCH In review LH.Kuo 4 participants 13 messages Oct 29, 2021 – Jan 4, 2022 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

LH.Kuo

author
#0 lore raw

cover Add SD/SDIO control 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

LH.Kuo (2):
mmc: Add SD/SDIO driver for Sunplus SP7021 devicetree bindings mmc Add bindings doc for Sunplus SP7021

 .../devicetree/bindings/mmc/sunplus-sd2.yaml       |   82 ++
 MAINTAINERS                                        |   41 +-
 drivers/mmc/host/Kconfig                           |   10 +
 drivers/mmc/host/Makefile                          |    1 +
 drivers/mmc/host/sunplus_sd2.c                     | 1069 ++++++++++++++++++++
 drivers/mmc/host/sunplus_sd2.h                     |  216 ++++
 6 files changed, 1403 insertions(+), 16 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml
 create mode 100644 drivers/mmc/host/sunplus_sd2.c
 create mode 100644 drivers/mmc/host/sunplus_sd2.h
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/2 mmc: Add SD/SDIO driver for Sunplus SP7021

Add SD/SDIO driver for Sunplus SP7021.

---
 MAINTAINERS                    |   40 +-
 drivers/mmc/host/Kconfig       |   10 +
 drivers/mmc/host/Makefile      |    1 +
 drivers/mmc/host/sunplus_sd2.c | 1069 ++++++++++++++++++++++++++++++++++++++++
 drivers/mmc/host/sunplus_sd2.h |  216 ++++++++
 5 files changed, 1320 insertions(+), 16 deletions(-)
 create mode 100644 drivers/mmc/host/sunplus_sd2.c
 create mode 100644 drivers/mmc/host/sunplus_sd2.h
MAINTAINERS +24 -16
index 80eebc1..0fb096d 100644
@@ -3553,7 +3553,7 @@ N:	kona
 
 BROADCOM BCM47XX MIPS ARCHITECTURE
 M:	Hauke Mehrtens <[email protected]>
-M:	Rafał Miłecki <[email protected]>
+M:	Rafa? Mi?ecki <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/mips/brcm/
@@ -3561,7 +3561,7 @@ F:	arch/mips/bcm47xx/*
 F:	arch/mips/include/asm/mach-bcm47xx/*
 
 BROADCOM BCM4908 ETHERNET DRIVER
-M:	Rafał Miłecki <[email protected]>
+M:	Rafa? Mi?ecki <[email protected]>
 M:	[email protected]
 L:	[email protected]
 S:	Maintained
@@ -3571,7 +3571,7 @@ F:	drivers/net/ethernet/broadcom/unimac.h
 
 BROADCOM BCM5301X ARM ARCHITECTURE
 M:	Hauke Mehrtens <[email protected]>
-M:	Rafał Miłecki <[email protected]>
+M:	Rafa? Mi?ecki <[email protected]>
 M:	[email protected]
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
@@ -3581,7 +3581,7 @@ F:	arch/arm/boot/dts/bcm953012*
 F:	arch/arm/mach-bcm/bcm_5301x.c
 
 BROADCOM BCM53573 ARM ARCHITECTURE
-M:	Rafał Miłecki <[email protected]>
+M:	Rafa? Mi?ecki <[email protected]>
 L:	[email protected]
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
@@ -3800,7 +3800,7 @@ N:	hr2
 N:	stingray
 
 BROADCOM IPROC GBIT ETHERNET DRIVER
-M:	Rafał Miłecki <[email protected]>
+M:	Rafa? Mi?ecki <[email protected]>
 M:	[email protected]
 L:	[email protected]
 S:	Maintained
@@ -3835,13 +3835,13 @@ F:	drivers/infiniband/hw/bnxt_re/
 F:	include/uapi/rdma/bnxt_re-abi.h
 
 BROADCOM NVRAM DRIVER
-M:	Rafał Miłecki <[email protected]>
+M:	Rafa? Mi?ecki <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	drivers/firmware/broadcom/*
 
 BROADCOM PMB (POWER MANAGEMENT BUS) DRIVER
-M:	Rafał Miłecki <[email protected]>
+M:	Rafa? Mi?ecki <[email protected]>
 M:	Florian Fainelli <[email protected]>
 M:	[email protected]
 L:	[email protected]
@@ -3851,7 +3851,7 @@ F:	drivers/soc/bcm/bcm63xx/bcm-pmb.c
 F:	include/dt-bindings/soc/bcm-pmb.h
 
 BROADCOM SPECIFIC AMBA DRIVER (BCMA)
-M:	Rafał Miłecki <[email protected]>
+M:	Rafa? Mi?ecki <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	drivers/bcma/
@@ -6947,7 +6947,7 @@ W:	http://www.broadcom.com
 F:	drivers/scsi/elx/
 
 ENE CB710 FLASH CARD READER DRIVER
-M:	Michał Mirosław <[email protected]>
+M:	Micha? Miros?aw <[email protected]>
 S:	Maintained
 F:	drivers/misc/cb710/
 F:	drivers/mmc/host/cb710-mmc.*
@@ -7389,7 +7389,7 @@ F:	include/uapi/video/
 F:	include/video/
 
 FREESCALE CAAM (Cryptographic Acceleration and Assurance Module) DRIVER
-M:	Horia Geantă <[email protected]>
+M:	Horia Geant? <[email protected]>
 M:	Pankaj Gupta <[email protected]>
 L:	[email protected]
 S:	Maintained
@@ -7926,7 +7926,7 @@ F:	fs/gfs2/
 F:	include/uapi/linux/gfs2_ondisk.h
 
 GIGABYTE WMI DRIVER
-M:	Thomas Weißschuh <[email protected]>
+M:	Thomas Wei?schuh <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	drivers/platform/x86/gigabyte-wmi.c
@@ -8871,7 +8871,7 @@ S:	Maintained
 F:	drivers/i2c/i2c-stub.c
 
 I3C DRIVER FOR CADENCE I3C MASTER IP
-M:	Przemysław Gaj <[email protected]>
+M:	Przemys?aw Gaj <[email protected]>
 S:	Maintained
 F:	Documentation/devicetree/bindings/i3c/cdns,i3c-master.txt
 F:	drivers/i3c/master/i3c-master-cdns.c
@@ -14456,7 +14456,7 @@ F:	drivers/pci/controller/pci-v3-semi.c
 PCI ENDPOINT SUBSYSTEM
 M:	Kishon Vijay Abraham I <[email protected]>
 M:	Lorenzo Pieralisi <[email protected]>
-R:	Krzysztof Wilczyński <[email protected]>
+R:	Krzysztof Wilczy?ski <[email protected]>
 L:	[email protected]
 S:	Supported
 F:	Documentation/PCI/endpoint/*
@@ -14504,7 +14504,7 @@ F:	drivers/pci/controller/pci-xgene-msi.c
 PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS
 M:	Lorenzo Pieralisi <[email protected]>
 R:	Rob Herring <[email protected]>
-R:	Krzysztof Wilczyński <[email protected]>
+R:	Krzysztof Wilczy?ski <[email protected]>
 L:	[email protected]
 S:	Supported
 Q:	http://patchwork.ozlabs.org/project/linux-pci/list/
@@ -16490,7 +16490,7 @@ F:	Documentation/devicetree/bindings/rng/samsung,exynos4-rng.yaml
 F:	drivers/crypto/exynos-rng.c
 
 SAMSUNG EXYNOS TRUE RANDOM NUMBER GENERATOR (TRNG) DRIVER
-M:	Łukasz Stelmach <[email protected]>
+M:	?ukasz Stelmach <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.yaml
@@ -16504,7 +16504,7 @@ F:	drivers/video/fbdev/s3c-fb.c
 
 SAMSUNG INTERCONNECT DRIVERS
 M:	Sylwester Nawrocki <[email protected]>
-M:	Artur Świgoń <[email protected]>
+M:	Artur ?wigo? <[email protected]>
 L:	[email protected]
 L:	[email protected]
 S:	Supported
@@ -17947,6 +17947,14 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/dlink/sundance.c
 
+SUNPLUS SD/SDIO HOST CONTROLLER INTERFACE DRIVER
+M:	LH Kuo <[email protected]>
+L:	[email protected] (subscribers-only)
+S:	Maintained
+F:	drivers/mmc/host/Kconfig
+F:	drivers/mmc/host/Makefile
+F:	drivers/mmc/host/sunplus_sd2.*
+
 SUPERH
 M:	Yoshinori Sato <[email protected]>
 M:	Rich Felker <[email protected]>
drivers/mmc/host/Kconfig +10 -0
index 95b3511..6f8bcd6 100644
@@ -14,6 +14,16 @@ config MMC_DEBUG
 	  added host drivers please don't invent their private macro for
 	  debugging.
 
+config SP_SDV2
+	tristate "Sunplus SP7021 SD/SDIO Controller"
+	depends on SOC_SP7021
+	default m
+	help
+	  This selects the Sunplus SP7021 SD/SDIO controller.
+	  If you have a controller with this interface, say Y or M here..
+
+	  If unsure, say N.
+
 config MMC_ARMMMCI
 	tristate "ARM AMBA Multimedia Card Interface support"
 	depends on ARM_AMBA
drivers/mmc/host/Makefile +1 -0
index 14004cc..1db7913 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_SP_SDV2)			+= sunplus_sd2.o
 obj-$(CONFIG_MMC_CQHCI)			+= cqhci.o
 cqhci-y					+= cqhci-core.o
 cqhci-$(CONFIG_MMC_CRYPTO)		+= cqhci-crypto.o
drivers/mmc/host/sunplus_sd2.c new file +1069 -0

1,069 lines not on this page · raw message

drivers/mmc/host/sunplus_sd2.h new file +216 -0

216 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

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

Quoted 7 lines · LH.Kuo
drivers/mmc/host/Kconfig +0 -0
index 95b3511..6f8bcd6 100644
@@ -14,6 +14,16 @@ config MMC_DEBUG
  	  added host drivers please don't invent their private macro for
  	  debugging.

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

Quoted 10 lines
drivers/mmc/host/Kconfig +9 -0
 
+config SP_SDV2
+	tristate "Sunplus SP7021 SD/SDIO Controller"
+	depends on SOC_SP7021
+	default m
+	help
+	  This selects the Sunplus SP7021 SD/SDIO controller.
+	  If you have a controller with this interface, say Y or M here..
+
+	  If unsure, say N.

Hi,
Does SOC_SP7021 require this driver to be built in order to boot?
If not, please remove the "default m" line.

Also, several of your patches seem to have lots of line changes to the MAINTAINERS file, but it looks like they should not be part of your patch submission.

thanks.

Signature · 1 line
~Randy
#3 lore raw

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

In reply to LH.Kuo

On Fri, 2021-10-29 at 13:57 +0800, LH.Kuo wrote:
[...]

Quoted 3 lines
drivers/mmc/host/sunplus_sd2.c new file +0 -0
@@ -0,0 +1,1069 @@

[...]

drivers/mmc/host/sunplus_sd2.c line 591

Quoted 7 lines
drivers/mmc/host/sunplus_sd2.c new file +7 -0
+static void spsdc_controller_init(struct spsdc_host *host)
+{
+	u32 value;
+	int ret = reset_control_assert(host->rstc);
+
+	if (!ret) {
+		mdelay(1);

Consider using usleep_range(), see Documentation/timers/timers-howto.rst

[...]

Quoted 18 lines
drivers/mmc/host/sunplus_sd2.c new file +18 -0
+static int spsdc_drv_probe(struct platform_device *pdev)
+{
+	int ret = 0;
+	struct mmc_host *mmc;
+	struct resource *resource;
+	struct spsdc_host *host;
+	unsigned int mode;
+
+	mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
+	if (!mmc) {
+		ret = -ENOMEM;
+		goto probe_free_host;
+	}
+
+	host = mmc_priv(mmc);
+	host->mmc = mmc;
+	host->power_state = MMC_POWER_OFF;
+	host->dma_int_threshold = 1024;

drivers/mmc/host/sunplus_sd2.c line 862

Quoted 10 lines
drivers/mmc/host/sunplus_sd2.c new file +10 -0
+	host->dmapio_mode = SPSDC_DMA_MODE;
+
+	host->clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(host->clk)) {
+		spsdc_pr(ERROR, "Can not find clock source\n");
+		ret = PTR_ERR(host->clk);
+		goto probe_free_host;
+	}
+
+	host->rstc = devm_reset_control_get(&pdev->dev, NULL);

Please use devm_reset_control_get_exclusive() instead.

regards
Philipp

author
#4 lore raw

PATCH 2/2 devicetree bindings mmc Add bindings doc for Sunplus SP7021

In reply to LH.Kuo

Add devicetree bindings mmc Add bindings doc for Sunplus SP7021

---
 .../devicetree/bindings/mmc/sunplus-sd2.yaml       | 82 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 83 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +82 -0
new file mode 100644
index 0000000..02f0479
@@ -0,0 +1,82 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright (C) Sunplus Co., Ltd. 2021
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mmc/sunplus-sd2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sunplus SD/SDIO controller
+
+maintainers:
+  - lh.kuo <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - sunplus,sp7021-card1
+      - sunplus,sp7021-sdio
+
+  reg:
+    items:
+      - description: Base address and length of the SD/SDIO registers
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  pinctrl-names:
+    description:
+      A pinctrl state named "default" must be defined.
+    const: default
+
+  pinctrl-0:
+    description:
+      A phandle to the default pinctrl state.
+
+  max-frequency: true
+
+allOf:
+  - $ref: "mmc-controller.yaml"
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - resets
+  - pinctrl-names
+  - pinctrl-0
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sp-sp7021.h>
+    #include <dt-bindings/reset/sp-sp7021.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    mmc1: mmc@9C003e80 {
+       compatible = "sunplus,sp7021-card1";
+       reg = <0x9c003e80 0x280>;
+       interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
+       clocks = <&clkc CARD_CTL1>;
+       resets = <&rstc RST_CARD_CTL1>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc1_mux &mmc1_mux_cd>;
+       max-frequency = <52000000>;
+    };
+    sdio: mmc@9C008400 {
+       compatible = "sunplus,sp7021-sdio";
+       reg = <0x9c008400 0x280>;
+       interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
+       clocks = <&clkc CARD_CTL1>;
+       resets = <&rstc RST_CARD_CTL1>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pins_sdio>;
+       max-frequency = <52000000>;
+    };
+...
MAINTAINERS +1 -0
index 0fb096d..83464c4 100644
@@ -17951,6 +17951,7 @@ SUNPLUS SD/SDIO HOST CONTROLLER INTERFACE DRIVER
 M:	LH Kuo <[email protected]>
 L:	[email protected] (subscribers-only)
 S:	Maintained
+F:	Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml
 F:	drivers/mmc/host/Kconfig
 F:	drivers/mmc/host/Makefile
 F:	drivers/mmc/host/sunplus_sd2.*
Signature · 1 line
2.7.4
author
#5 lore raw

v2 cover Add SD/SDIO control driver for Sunplus SP7021 SoC

In reply to LH.Kuo

This is a patch series for SD/SDIO 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

LH.Kuo (2):
mmc: Add SD/SDIO driver for Sunplus SP7021 devicetree bindings mmc Add bindings doc for Sunplus SP7021

 .../devicetree/bindings/mmc/sunplus-sd2.yaml       |   82 ++
 MAINTAINERS                                        |    7 +
 drivers/mmc/host/Kconfig                           |   10 +
 drivers/mmc/host/Makefile                          |    1 +
 drivers/mmc/host/sunplus_sd2.c                     | 1068 ++++++++++++++++++++
 drivers/mmc/host/sunplus_sd2.h                     |  155 +++
 6 files changed, 1323 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml
 create mode 100644 drivers/mmc/host/sunplus_sd2.c
 create mode 100644 drivers/mmc/host/sunplus_sd2.h
Signature · 1 line
2.7.4
author
#6 lore raw

PATCH v2 1/2 mmc: Add SD/SDIO driver for Sunplus SP7021

Add SD/SDIO driver for Sunplus SP7021.

---
Changes in v2:
- Addressed all comments from Mr. Philipp Zabel
- Modified the structure and register access method.
- Modifiedthe path about MAINTAINERS. ( wrong messages PATH in v1).

 MAINTAINERS                    |    6 +
 drivers/mmc/host/Kconfig       |   10 +
 drivers/mmc/host/Makefile      |    1 +
 drivers/mmc/host/sunplus_sd2.c | 1068 ++++++++++++++++++++++++++++++++++++++++
 drivers/mmc/host/sunplus_sd2.h |  155 ++++++
 5 files changed, 1240 insertions(+)
 create mode 100644 drivers/mmc/host/sunplus_sd2.c
 create mode 100644 drivers/mmc/host/sunplus_sd2.h
MAINTAINERS +6 -0
index 170bbbe..2746084 100644
@@ -18189,6 +18189,12 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/dlink/sundance.c
 
+SUNPLUS SD/SDIO HOST CONTROLLER INTERFACE DRIVER
+M:	LH Kuo <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/mmc/host/sunplus_sd2.*
+
 SUPERH
 M:	Yoshinori Sato <[email protected]>
 M:	Rich Felker <[email protected]>
drivers/mmc/host/Kconfig +10 -0
index 5af8494..2aba9eb 100644
@@ -1091,5 +1091,15 @@ config MMC_OWL
 	  This selects support for the SD/MMC Host Controller on
 	  Actions Semi Owl SoCs.
 
+config MMC_SP_SDV2
+	tristate "Sunplus SP7021 SD/SDIO Controller"
+	depends on SOC_SP7021
+	help
+		If you say yes here, you will get support for SD/SDIO host interface
+		on sunplus Socs.
+		If you have a controller with this interface, say Y or M here.
+		If unsure, say N.
+                Sunplus  SD/SDIO Host Controller support"
+
 config MMC_SDHCI_EXTERNAL_DMA
 	bool
drivers/mmc/host/Makefile +1 -0
index ea36d37..167aa5c 100644
@@ -101,6 +101,7 @@ obj-$(CONFIG_MMC_CQHCI)			+= cqhci.o
 cqhci-y					+= cqhci-core.o
 cqhci-$(CONFIG_MMC_CRYPTO)		+= cqhci-crypto.o
 obj-$(CONFIG_MMC_HSQ)			+= mmc_hsq.o
+obj-$(CONFIG_MMC_SP_SDV2)		+= sunplus_sd2.o
 
 ifeq ($(CONFIG_CB710_DEBUG),y)
 	CFLAGS-cb710-mmc	+= -DDEBUG
drivers/mmc/host/sunplus_sd2.c new file +1068 -0

1,068 lines not on this page · raw message

drivers/mmc/host/sunplus_sd2.h new file +155 -0

155 lines not on this page · raw message

Signature · 1 line
2.7.4
#7 lore raw

Re: [PATCH v2 1/2] mmc: Add SD/SDIO driver for Sunplus SP7021

Hi--

Quoted 5 lines · LH.Kuo
drivers/mmc/host/Kconfig +0 -0
index 5af8494..2aba9eb 100644

drivers/mmc/host/Kconfig config MMC_OWL · line 1099

Quoted 9 lines
drivers/mmc/host/Kconfig +6 -0
@@ -1091,5 +1091,15 @@ config MMC_OWL
  	  This selects support for the SD/MMC Host Controller on
  	  Actions Semi Owl SoCs.
 
+config MMC_SP_SDV2
+	tristate "Sunplus SP7021 SD/SDIO Controller"
+	depends on SOC_SP7021
+	help
+		If you say yes here, you will get support for SD/SDIO host interface
+		on sunplus Socs.

Sunplus SoCs.

drivers/mmc/host/Kconfig config MMC_OWL · line 1101

Quoted 2 lines
drivers/mmc/host/Kconfig +2 -0
+		If you have a controller with this interface, say Y or M here.
+		If unsure, say N.

All 4 lines of help text should be indented only with one tab + 2 spaces, not 2 tabs, per coding-style.rst.

drivers/mmc/host/Kconfig config MMC_OWL · line 1102

Quoted 1 line
drivers/mmc/host/Kconfig +1 -0
+                Sunplus  SD/SDIO Host Controller support"

I am thinking that this last line should not be here at all... ???

thanks.

Signature · 1 line
~Randy

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Re: [PATCH v2 1/2] mmc: Add SD/SDIO driver for Sunplus SP7021

Hi--

Quoted 61 lines · Lh Kuo 郭力豪

Hi

Quoted 39 lines

-----Original Message-----
From: Randy Dunlap <[email protected]>
Sent: Wednesday, November 10, 2021 10:33 AM
To: LH.Kuo <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Wells Lu 呂芳騰 <[email protected]>; Lh Kuo 郭力豪 <[email protected]>
Subject: Re: [PATCH v2 1/2] mmc: Add SD/SDIO driver for Sunplus SP7021

Hi--

Quoted 5 lines · LH.Kuo
drivers/mmc/host/Kconfig +0 -0
index 5af8494..2aba9eb 100644

drivers/mmc/host/Kconfig config MMC_OWL · line 1099

Quoted 9 lines
drivers/mmc/host/Kconfig +6 -0
@@ -1091,5 +1091,15 @@ config MMC_OWL
   	  This selects support for the SD/MMC Host Controller on
   	  Actions Semi Owl SoCs.
 
+config MMC_SP_SDV2
+	tristate "Sunplus SP7021 SD/SDIO Controller"
+	depends on SOC_SP7021
+	help
+		If you say yes here, you will get support for SD/SDIO host interface
+		on sunplus Socs.

Sunplus SoCs.

drivers/mmc/host/Kconfig config MMC_OWL · line 1101

Quoted 2 lines
drivers/mmc/host/Kconfig +2 -0
+		If you have a controller with this interface, say Y or M here.
+		If unsure, say N.

All 4 lines of help text should be indented only with one tab + 2 spaces, not 2 tabs, per coding-style.rst.

Quoted 8 lines

drivers/mmc/host/Kconfig config MMC_OWL · line 1102

Quoted 1 line
drivers/mmc/host/Kconfig +1 -0
+                Sunplus  SD/SDIO Host Controller support"

I am thinking that this last line should not be here at all... ???

thanks.
--
~Randy

I will make change as below is it OK ?

config MMC_SP_SDV2
tristate "Sunplus SP7021 SD/SDIO Controller"
depends on SOC_SP7021
help
This selects the Sunplus Host Controller Interface support present in Sunplus SP7021 SOCs. The controller supports SD/SDIO devices.

Quoted 3 lines

If you have a controller with this interface, say Y or M here.

If unsure, say N.

Too much indentation on the last 2 (non-blank) help text lines. Should just be one tab + 2 spaces, not 2 tabs.

Signature · 1 line
~Randy
author
#10 lore raw

PATCH v2 2/2 devicetree bindings mmc Add bindings doc for Sunplus SP7021

In reply to LH.Kuo

Add devicetree bindings mmc Add bindings doc for Sunplus SP7021

---
Changes in v2:
- Addressed all comments from Mr. Philipp Zabel
- Modified the structure and register access method.
- Modifiedthe path about MAINTAINERS. ( wrong messages PATH in v1).

 .../devicetree/bindings/mmc/sunplus-sd2.yaml       | 82 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 83 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +82 -0
new file mode 100644
index 0000000..95dc0bb
@@ -0,0 +1,82 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright (C) Sunplus Co., Ltd. 2021
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mmc/sunplus-sd2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sunplus SD/SDIO controller
+
+maintainers:
+  - lh.kuo <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - sunplus,sp7021-card1
+      - sunplus,sp7021-sdio
+
+  reg:
+    items:
+      - description: Base address and length of the SD/SDIO registers
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  pinctrl-names:
+    description:
+      A pinctrl state named "default" must be defined.
+    const: default
+
+  pinctrl-0:
+    description:
+      A phandle to the default pinctrl state.
+
+  max-frequency: true
+
+allOf:
+  - $ref: "mmc-controller.yaml"
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - resets
+  - pinctrl-names
+  - pinctrl-0
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sp-sp7021.h>
+    #include <dt-bindings/reset/sp-sp7021.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    mmc1: mmc@9C003e80 {
+       compatible = "sunplus,sp7021-card1";
+       reg = <0x9c003e80 0x280>;
+       interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
+       clocks = <&clkc CARD_CTL1>;
+       resets = <&rstc RST_CARD_CTL1>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc1_mux &mmc1_mux_cd>;
+       max-frequency = <52000000>;
+    };
+    sdio: mmc@9C008400 {
+       compatible = "sunplus,sp7021-sdio";
+       reg = <0x9c008400 0x280>;
+       interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
+       clocks = <&clkc CARD_CTL1>;
+       resets = <&rstc RST_CARD_CTL1>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pins_sdio>;
+       max-frequency = <52000000>;
+    };   
+...
MAINTAINERS +1 -0
index 2746084..e653a1d 100644
@@ -18193,6 +18193,7 @@ SUNPLUS SD/SDIO HOST CONTROLLER INTERFACE DRIVER
 M:	LH Kuo <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml
 F:	drivers/mmc/host/sunplus_sd2.*
 
 SUPERH
Signature · 1 line
2.7.4
maintainer
#11 lore raw

Re: [PATCH v2 2/2] devicetree bindings mmc Add bindings doc for Sunplus SP7021

Quoted 27 lines · LH.Kuo

Add devicetree bindings mmc Add bindings doc for Sunplus SP7021

---
Changes in v2:
- Addressed all comments from Mr. Philipp Zabel
- Modified the structure and register access method.
- Modifiedthe path about MAINTAINERS. ( wrong messages PATH in v1).

 .../devicetree/bindings/mmc/sunplus-sd2.yaml       | 82 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 83 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +7 -0
new file mode 100644
index 0000000..95dc0bb
@@ -0,0 +1,82 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright (C) Sunplus Co., Ltd. 2021
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mmc/sunplus-sd2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+

Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml line 17

Quoted 10 lines
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +10 -0
+title: Sunplus SD/SDIO controller
+
+maintainers:
+  - lh.kuo <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - sunplus,sp7021-card1
+      - sunplus,sp7021-sdio

What's the difference between these 2 blocks?

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

Quoted 4 lines
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +4 -0
+
+  reg:
+    items:
+      - description: Base address and length of the SD/SDIO registers

Just 'maxItems: 1' is sufficient.

Quoted 31 lines
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +31 -0
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  pinctrl-names:
+    description:
+      A pinctrl state named "default" must be defined.
+    const: default
+
+  pinctrl-0:
+    description:
+      A phandle to the default pinctrl state.
+
+  max-frequency: true
+
+allOf:
+  - $ref: "mmc-controller.yaml"
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - resets
+  - pinctrl-names

Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml line 62

Quoted 10 lines
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +10 -0
+  - pinctrl-0
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sp-sp7021.h>
+    #include <dt-bindings/reset/sp-sp7021.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    mmc1: mmc@9C003e80 {

Use lower case hex.

Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml line 72

Quoted 10 lines
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +10 -0
+       compatible = "sunplus,sp7021-card1";
+       reg = <0x9c003e80 0x280>;
+       interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
+       clocks = <&clkc CARD_CTL1>;
+       resets = <&rstc RST_CARD_CTL1>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc1_mux &mmc1_mux_cd>;
+       max-frequency = <52000000>;
+    };
+    sdio: mmc@9C008400 {

Use lower case hex.

Quoted 26 lines
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +10 -0
+       compatible = "sunplus,sp7021-sdio";
+       reg = <0x9c008400 0x280>;
+       interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
+       clocks = <&clkc CARD_CTL1>;
+       resets = <&rstc RST_CARD_CTL1>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pins_sdio>;
+       max-frequency = <52000000>;
+    };   
+...
MAINTAINERS +1 -0
index 2746084..e653a1d 100644
@@ -18193,6 +18193,7 @@ SUNPLUS SD/SDIO HOST CONTROLLER INTERFACE DRIVER
 M:	LH Kuo <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml
 F:	drivers/mmc/host/sunplus_sd2.*
 
 SUPERH
Signature · 1 line
2.7.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#13 lore raw

Re: [PATCH v2 2/2] devicetree bindings mmc Add bindings doc for Sunplus SP7021

Quoted 11 lines · Lh Kuo 郭力豪
Quoted 10 lines

Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml line 17

Quoted 7 lines
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +6 -0
+
+properties:
+  compatible:
+    enum:
+      - sunplus,sp7021-card1
+      - sunplus,sp7021-sdio

What's the difference between these 2 blocks?

Quoted 1 line

One for SD card One for SDIO

If the programming model is the same, then it should be the same compatible string. We have various properties to handle differences like bus width, card detect or not, etc.

Quoted 50 lines
Quoted 41 lines

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

Quoted 3 lines
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +3 -0
+  reg:
+    items:
+      - description: Base address and length of the SD/SDIO registers

Just 'maxItems: 1' is sufficient.

Quoted 35 lines
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +35 -0
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  pinctrl-names:
+    description:
+      A pinctrl state named "default" must be defined.
+    const: default
+
+  pinctrl-0:
+    description:
+      A phandle to the default pinctrl state.
+
+  max-frequency: true
+
+allOf:
+  - $ref: "mmc-controller.yaml"
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - resets
+  - pinctrl-names
+  - pinctrl-0
+
+additionalProperties: false
+
Quoted 8 lines

Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml line 62

Quoted 6 lines
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +6 -0
+examples:
+  - |
+    #include <dt-bindings/clock/sp-sp7021.h>
+    #include <dt-bindings/reset/sp-sp7021.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    mmc1: mmc@9C003e80 {

Use lower case hex.

Quoted 3 lines

Do you mean as follows? ?

mmc1: mmc@3e80 {

No, 'mmc@9c003e80 {'

You also don't need 'mmc1'.

Quoted 21 lines
Quoted 11 lines

Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml line 72

Quoted 10 lines
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +10 -0
+       compatible = "sunplus,sp7021-card1";
+       reg = <0x9c003e80 0x280>;
+       interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
+       clocks = <&clkc CARD_CTL1>;
+       resets = <&rstc RST_CARD_CTL1>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc1_mux &mmc1_mux_cd>;
+       max-frequency = <52000000>;
+    };
+    sdio: mmc@9C008400 {

Do you mean as follows? ?

mmc1: mmc@8400 {

Quoted 3 lines

Use lower case hex.

Quoted 1 line

+ compatible = "sunplus,sp7021-sdio";

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#15 lore raw

Re: [PATCH v2 2/2] devicetree bindings mmc Add bindings doc for Sunplus SP7021

Quoted 10 lines · Lh Kuo 郭力豪
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml line 17

Quoted 6 lines
Documentation/devicetree/bindings/mmc/sunplus-sd2.yaml new file +5 -0
+properties:
+  compatible:
+    enum:
+      - sunplus,sp7021-card1
+      - sunplus,sp7021-sdio

What's the difference between these 2 blocks?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

One for SD card One for SDIO

If the programming model is the same, then it should be the same compatible string. We have various properties to handle differences like bus width, card detect or not, etc.

SDIO and SDCARD still need to set the date and CMD decoding differences.

I still don't understand. A host controller should be able to initialize a card enough to tell what kind it is. And we have things defined in DT like 'no-sd' and 'no-mmc'.

Looking at the driver, the difference appears to be just setting a register to the mode (eMMC/SD/SDIO). That's not a difference in the h/w block which is when different compatibles would be appropriate. A property, if anything, is the right thing to do here.

Rob