Skip to contentSkip to conversation

LoongArch: Introduce the Loongson-2K MMC host controller driver

PATCH Superseded Binbin Zhou 4 participants 10 messages Apr 10, 2025 – May 6, 2025

Subsystems (4)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Binbin Zhou

author maintainer
#0 lore raw

cover LoongArch: Introduce the Loongson-2K MMC host controller driver

Hi all:

This patchset introduce the MMC host controller on Loongson-2K series CPUs.

They are similar, except for the interface characteristics and the use of DMA engine, specifically, the Loongson-2K0500/Loongson-2K1000 use an externally shared APBDMA engine, while the Loongson-2K2000 uses an internally exclusive DMA.

Based on this, I'm splitting the driver into two patches.

List of the patchset:
Patch1: bindings for Loongson-2K0500/Loongson-2K1000;
Patch2: driver for MMC controller using externally shared APBDMA engine;
Patch3: bindings for Loongson-2K2000;
Patch4: driver for MMC controller using internally exclusive DMA.

Thanks.

Binbin Zhou (4):
dt-bindings: mmc: Add Loongson-2K SD/SDIO/eMMC controller binding
mmc: loongson2: Add Loongson-2K SD/SDIO controller driver
dt-bindings: mmc: loongson,ls2k-mmc: Add compatible for

    Loongson-2K2000

mmc: loongson2: Add Loongson-2K2000 SD/SDIO controller driver

 .../bindings/mmc/loongson,ls2k-mmc.yaml       | 110 +++
 MAINTAINERS                                   |   8 +
 drivers/mmc/host/Kconfig                      |  13 +
 drivers/mmc/host/Makefile                     |   1 +
 drivers/mmc/host/loongson2-mmc.c              | 781 ++++++++++++++++++
 drivers/mmc/host/loongson2-mmc.h              | 224 +++++
 6 files changed, 1137 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml
 create mode 100644 drivers/mmc/host/loongson2-mmc.c
 create mode 100644 drivers/mmc/host/loongson2-mmc.h

base-commit: 6b8dba9a7fdba6d669e4119e390a071e44383934

Signature · 1 line
2.47.1
author maintainer
#1 lore raw

PATCH 1/4 dt-bindings: mmc: Add Loongson-2K SD/SDIO/eMMC controller binding

Add the Loongson-2K SoC's SD/SDIO/eMMC controller binding with DT schema format using json-schema.

---
 .../bindings/mmc/loongson,ls2k-mmc.yaml       | 67 +++++++++++++++++++
 MAINTAINERS                                   |  6 ++
 2 files changed, 73 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml
Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml new file +67 -0
new file mode 100644
index 000000000000..f3e94f5f3a35
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mmc/loongson,ls2k-mmc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: The SD/SDIO/eMMC host controller for Loongson-2K family SoCs
+
+description:
+  The MMC host controller on the Loongson-2K0500/2K1000 (using an externally
+  shared apbdma controller) provides the SD and SDIO device interfaces.
+
+maintainers:
+  - Binbin Zhou <[email protected]>
+
+allOf:
+  - $ref: mmc-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - loongson,ls2k0500-mmc
+      - loongson,ls2k1000-mmc
+
+  reg:
+    maxItems: 2
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  dmas:
+    maxItems: 1
+
+  dma-names:
+    const: rx-tx
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - dmas
+  - dma-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/clock/loongson,ls2k-clk.h>
+
+    mmc@1fe2c000 {
+        compatible = "loongson,ls2k1000-mmc";
+        reg = <0x1fe2c000 0x68>,
+              <0x1fe00438 0x8>;
+        interrupt-parent = <&liointc0>;
+        interrupts = <31 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clk LOONGSON2_APB_CLK>;
+        dmas = <&apbdma1 0>;
+        dma-names = "rx-tx";
+        bus-width = <4>;
+        cd-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
+    };
MAINTAINERS +6 -0
index 96b827049501..32c3733a764a 100644
@@ -13935,6 +13935,12 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/hwinfo/loongson,ls2k-chipid.yaml
 F:	drivers/soc/loongson/loongson2_guts.c
 
+LOONGSON-2 SOC SERIES MMC/SD/SDIO CONTROLLER DRIVER
+M:	Binbin Zhou <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml
+
 LOONGSON-2 SOC SERIES PM DRIVER
 M:	Yinbo Zhu <[email protected]>
 L:	[email protected]
Signature · 1 line
2.47.1
author maintainer
#3 lore raw

PATCH 2/4 mmc: loongson2: Add Loongson-2K SD/SDIO controller driver

In reply to Binbin Zhou

The MMC controllers on the Loongson-2K series CPUs are similar, except for the interface characteristics and the use of DMA controllers.

This patch describes the MMC controllers on the Loongson-2K0500/2K1000, with the distinguishing feature being the use of an externally shared APBDMA engine.

---
 MAINTAINERS                      |   2 +
 drivers/mmc/host/Kconfig         |  13 +
 drivers/mmc/host/Makefile        |   1 +
 drivers/mmc/host/loongson2-mmc.c | 636 +++++++++++++++++++++++++++++++
 drivers/mmc/host/loongson2-mmc.h | 177 +++++++++
 5 files changed, 829 insertions(+)
 create mode 100644 drivers/mmc/host/loongson2-mmc.c
 create mode 100644 drivers/mmc/host/loongson2-mmc.h
MAINTAINERS +2 -0
index 32c3733a764a..e218a3e204ef 100644
@@ -13940,6 +13940,8 @@ M:	Binbin Zhou <[email protected]>
 L:	[email protected]
 S:	Supported
 F:	Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml
+F:	drivers/mmc/host/loongson2-mmc.c
+F:	drivers/mmc/host/loongson2-mmc.h
 
 LOONGSON-2 SOC SERIES PM DRIVER
 M:	Yinbo Zhu <[email protected]>
drivers/mmc/host/Kconfig +13 -0
index 264e11fa58ea..c8f46901c0e8 100644
@@ -1097,6 +1097,19 @@ config MMC_OWL
 	  This selects support for the SD/MMC Host Controller on
 	  Actions Semi Owl SoCs.
 
+config MMC_LOONGSON2
+	tristate "Loongso-2K SD/SDIO/eMMC Host Interface support"
+	depends on LOONGARCH || COMPILE_TEST
+	depends on HAS_DMA
+	help
+	  This selects support for the SD/SDIO/eMMC Host Controller on
+	  Loongson-2K series CPUs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called mmc_loongson2.
+
+	  If unsure, say N.
+
 config MMC_SDHCI_EXTERNAL_DMA
 	bool
 
drivers/mmc/host/Makefile +1 -0
index 5147467ec825..ad09453d65da 100644
@@ -72,6 +72,7 @@ obj-$(CONFIG_MMC_USDHI6ROL0)	+= usdhi6rol0.o
 obj-$(CONFIG_MMC_TOSHIBA_PCI)	+= toshsd.o
 obj-$(CONFIG_MMC_BCM2835)	+= bcm2835.o
 obj-$(CONFIG_MMC_OWL)		+= owl-mmc.o
+obj-$(CONFIG_MMC_LOONGSON2)	+= loongson2-mmc.o
 
 obj-$(CONFIG_MMC_REALTEK_PCI)	+= rtsx_pci_sdmmc.o
 obj-$(CONFIG_MMC_REALTEK_USB)	+= rtsx_usb_sdmmc.o
drivers/mmc/host/loongson2-mmc.c new file +636 -0

636 lines not on this page · raw message

drivers/mmc/host/loongson2-mmc.h new file +177 -0

177 lines not on this page · raw message

Signature · 1 line
2.47.1
author maintainer
#6 lore raw

PATCH 3/4 dt-bindings: mmc: loongson,ls2k-mmc: Add compatible for Loongson-2K2000

In reply to Binbin Zhou

Add the devicetree compatible for Loongson-2K2000 EMMC/SD/SDIO controller.

---
 .../bindings/mmc/loongson,ls2k-mmc.yaml       | 47 ++++++++++++++++++-
 1 file changed, 45 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml +45 -2
index f3e94f5f3a35..24d217a9bbe6 100644
@@ -9,6 +9,9 @@ title: The SD/SDIO/eMMC host controller for Loongson-2K family SoCs
 description:
   The MMC host controller on the Loongson-2K0500/2K1000 (using an externally
   shared apbdma controller) provides the SD and SDIO device interfaces.
+  The two MMC host controllers on the Loongson-2K2000 are similar,
+  except that they use internal exclusive DMA. one controller provides
+  the eMMC interface and the other provides the SD/SDIO interface.
 
 maintainers:
   - Binbin Zhou <[email protected]>
@@ -21,8 +24,10 @@ properties:
     enum:
       - loongson,ls2k0500-mmc
       - loongson,ls2k1000-mmc
+      - loongson,ls2k2000-mmc
 
   reg:
+    minItems: 1
     maxItems: 2
 
   interrupts:
@@ -42,11 +47,31 @@ required:
   - reg
   - interrupts
   - clocks
-  - dmas
-  - dma-names
 
 unevaluatedProperties: false
 
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - loongson,ls2k0500-mmc
+          - loongson,ls2k1000-mmc
+
+then:
+  properties:
+    reg:
+      minItems: 2
+
+  required:
+    - dmas
+    - dma-names
+
+else:
+  properties:
+    reg:
+      maxItems: 1
+
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
@@ -65,3 +90,21 @@ examples:
         bus-width = <4>;
         cd-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
     };
+
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/clock/loongson,ls2k-clk.h>
+
+    mmc@79990000 {
+        compatible = "loongson,ls2k2000-mmc";
+        reg = <0x79990000 0x1000>;
+        interrupt-parent = <&pic>;
+        interrupts = <51 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clk LOONGSON2_EMMC_CLK>;
+        bus-width = <8>;
+        non-removable;
+        cap-mmc-highspeed;
+        mmc-hs200-1_8v;
+        no-sd;
+        no-sdio;
+    };
Signature · 1 line
2.47.1
author maintainer
#9 lore raw

PATCH 4/4 mmc: loongson2: Add Loongson-2K2000 SD/SDIO controller driver

In reply to Binbin Zhou

This patch introduces the eMMC controller and SDIO controller built into the Loongson-2K2000 SoC. They have similar register structures and both support only exclusive DMA communication.

---
 drivers/mmc/host/loongson2-mmc.c | 149 ++++++++++++++++++++++++++++++-
 drivers/mmc/host/loongson2-mmc.h |  47 ++++++++++
 2 files changed, 194 insertions(+), 2 deletions(-)
drivers/mmc/host/loongson2-mmc.c +147 -2
index 6348728694e7..7e1cca47b496 100644
@@ -98,7 +98,7 @@ static int loongson2_mmc_prepare_dma(struct loongson2_mmc_host *host,
 
 static void loongson2_mmc_send_request(struct mmc_host *mmc)
 {
-	int ret;
+	int ret, val;
 	struct loongson2_mmc_host *host = mmc_priv(mmc);
 	struct mmc_request *mrq = host->mrq;
 	struct mmc_command *cmd = host->cmd_is_stop ? mrq->stop : mrq->cmd;
@@ -112,6 +112,14 @@ static void loongson2_mmc_send_request(struct mmc_host *mmc)
 		return;
 	}
 
+	if (cmd->opcode == MMC_WRITE_BLOCK || cmd->opcode == MMC_WRITE_MULTIPLE_BLOCK) {
+		ret = regmap_read_poll_timeout(host->regmap, LOONGSON2_MMC_REG_FSTS, val,
+					       (val & LOONGSON2_MMC_FSTS_TXFULL), 0, 500);
+		if (ret < 0)
+			return;
+	}
+
+	/* Send command */
 	loongson2_mmc_send_command(host, cmd);
 
 	/* Fix deselect card no irq */
@@ -254,6 +262,36 @@ static irqreturn_t loongson2_mmc_irq(int irq, void *dev_id)
 	return IRQ_WAKE_THREAD;
 }
 
+static void loongson2_mmc_ddr_mode_init(struct loongson2_mmc_host *host)
+{
+	u32 val, pad_delay, delay, ret;
+
+	regmap_update_bits(host->regmap, LOONGSON2_MMC_REG_SEL,
+			   LOONGSON2_MMC_SEL_DATA, LOONGSON2_MMC_SEL_DATA);
+
+	val = FIELD_PREP(LOONGSON2_MMC_DLLCTL_TIME, 0xc8)
+	    | FIELD_PREP(LOONGSON2_MMC_DLLCTL_INCRE, 0x1)
+	    | FIELD_PREP(LOONGSON2_MMC_DLLCTL_START, 0x1)
+	    | FIELD_PREP(LOONGSON2_MMC_DLLCTL_CLK_MODE, 0x1)
+	    | FIELD_PREP(LOONGSON2_MMC_DLLCTL_START_BIT, 0x1)
+	    | FIELD_PREP(LOONGSON2_MMC_DLLCTL_TIME_BYPASS, 0xf);
+
+	regmap_write(host->regmap, LOONGSON2_MMC_REG_DLLCTL, val);
+
+	ret = regmap_read_poll_timeout(host->regmap, LOONGSON2_MMC_REG_DLLVAL, val,
+				       (val & LOONGSON2_MMC_DLLVAL_DONE), 0, 4000);
+	if (ret < 0)
+		return;
+
+	regmap_read(host->regmap, LOONGSON2_MMC_REG_DLLVAL, &val);
+	pad_delay = FIELD_GET(GENMASK(7, 1), val);
+
+	delay = FIELD_PREP(LOONGSON2_MMC_DELAY_PAD, pad_delay)
+	      | FIELD_PREP(LOONGSON2_MMC_DELAY_RD, pad_delay + 1);
+
+	regmap_write(host->regmap, LOONGSON2_MMC_REG_DELAY, delay);
+}
+
 static void loongson2_mmc_set_clk(struct loongson2_mmc_host *host, struct mmc_ios *ios)
 {
 	u32 pre;
@@ -263,6 +301,10 @@ static void loongson2_mmc_set_clk(struct loongson2_mmc_host *host, struct mmc_io
 		pre = 255;
 
 	regmap_write(host->regmap, LOONGSON2_MMC_REG_PRE, pre | LOONGSON2_MMC_PRE_EN);
+
+	/* EMMC DDR mode setting */
+	if (ios->timing == MMC_TIMING_UHS_DDR50 || ios->timing == MMC_TIMING_MMC_DDR52)
+		loongson2_mmc_ddr_mode_init(host);
 }
 
 static void loongson2_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
@@ -469,6 +511,108 @@ static struct loongson2_mmc_pdata ls2k1000_mmc_pdata = {
 	.release_dma		= loongson2_mmc_release_external_dma,
 };
 
+static const struct regmap_config ls2k2000_mmc_regmap_config = {
+	.reg_bits = 32,
+	.val_bits = 32,
+	.reg_stride = 4,
+	.max_register = LOONGSON2_MMC_REG_RDMA_HI,
+};
+
+static int loongson2_mmc_set_internal_dma(struct loongson2_mmc_host *host,
+					  struct platform_device *pdev)
+{
+	host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE,
+					  &host->sg_dma, GFP_KERNEL);
+	if (!host->sg_cpu)
+		return -ENOMEM;
+
+	memset(host->sg_cpu, 0, PAGE_SIZE);
+	return 0;
+}
+
+static void loongson2_mmc_release_internal_dma(struct loongson2_mmc_host *host,
+					       struct device *dev)
+{
+	dma_free_coherent(dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
+}
+
+static void ls2k2000_mmc_reorder_cmd_data(struct loongson2_mmc_host *host,
+					  struct mmc_command *cmd)
+{
+	struct scatterlist *sg;
+	u32 *data;
+	int i, j;
+
+	if (cmd->opcode != SD_SWITCH || mmc_cmd_type(cmd) != MMC_CMD_ADTC)
+		return;
+
+	for_each_sg(cmd->data->sg, sg, cmd->data->sg_len, i) {
+		data = sg_virt(&sg[i]);
+		for (j = 0; j < (sg_dma_len(&sg[i]) / 4); j++)
+			data[j] = bitrev8x4(data[j]);
+	}
+}
+
+static int loongson2_mmc_prepare_internal_dma(struct loongson2_mmc_host *host,
+					      struct mmc_data *data)
+{
+	struct loongson2_dma_desc *pdes = (struct loongson2_dma_desc *)host->sg_cpu;
+	dma_addr_t next_desc = host->sg_dma;
+	struct scatterlist *sg;
+	int reg_lo, reg_hi;
+	u64 dma_order;
+	int i, ret;
+
+	ret = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
+			 mmc_get_dma_dir(data));
+	if (!ret)
+		return -ENOMEM;
+
+	for_each_sg(data->sg, sg, data->sg_len, i) {
+		pdes[i].len = sg_dma_len(&sg[i]) / 4;
+		pdes[i].step_len = 0;
+		pdes[i].step_times = 1;
+		pdes[i].mem_addr = lower_32_bits(sg_dma_address(&sg[i]));
+		pdes[i].high_mem_addr = upper_32_bits(sg_dma_address(&sg[i]));
+		pdes[i].apb_addr = host->res->start + LOONGSON2_MMC_REG_DATA;
+		pdes[i].cmd = LOONGSON2_MMC_DMA_INT;
+
+		if (data->flags & MMC_DATA_READ) {
+			reg_lo = LOONGSON2_MMC_REG_RDMA_LO;
+			reg_hi = LOONGSON2_MMC_REG_RDMA_HI;
+		} else {
+			pdes[i].cmd |= LOONGSON2_MMC_DMA_DATA_DIR;
+			reg_lo = LOONGSON2_MMC_REG_WDMA_LO;
+			reg_hi = LOONGSON2_MMC_REG_WDMA_HI;
+		}
+
+		next_desc += sizeof(struct loongson2_dma_desc);
+		pdes[i].ndesc_addr = lower_32_bits(next_desc) |
+				     LOONGSON2_MMC_DMA_DESC_EN;
+		pdes[i].high_ndesc_addr = upper_32_bits(next_desc);
+	}
+
+	/* Setting the last descriptor enable bit */
+	pdes[i - 1].ndesc_addr &= ~LOONGSON2_MMC_DMA_DESC_EN;
+
+	dma_order = (host->sg_dma & ~LOONGSON2_MMC_DMA_CONFIG_MASK) |
+		    LOONGSON2_MMC_DMA_64BIT_EN |
+		    LOONGSON2_MMC_DMA_START;
+
+	regmap_write(host->regmap, reg_hi, upper_32_bits(dma_order));
+	regmap_write(host->regmap, reg_lo, lower_32_bits(dma_order));
+
+	return 0;
+}
+
+static struct loongson2_mmc_pdata ls2k2000_mmc_pdata = {
+	.regmap_config		= ls2k2000_mmc_regmap_config,
+	.reorder_cmd_data	= ls2k2000_mmc_reorder_cmd_data,
+	.setting_dma		= loongson2_mmc_set_internal_dma,
+	.prepare_dma		= loongson2_mmc_prepare_internal_dma,
+	.release_dma		= loongson2_mmc_release_internal_dma,
+};
+
 static int loongson2_mmc_resource_request(struct platform_device *pdev,
 					  struct loongson2_mmc_host *host)
 {
@@ -593,7 +737,8 @@ static void loongson2_mmc_remove(struct platform_device *pdev)
 static const struct of_device_id loongson2_mmc_of_ids[] = {
 	{ .compatible = "loongson,ls2k0500-mmc", .data = &ls2k0500_mmc_pdata },
 	{ .compatible = "loongson,ls2k1000-mmc", .data = &ls2k1000_mmc_pdata },
-	{ },
+	{ .compatible = "loongson,ls2k2000-mmc", .data = &ls2k2000_mmc_pdata },
+	{},
 };
 MODULE_DEVICE_TABLE(of, loongson2_mmc_of_ids);
 
drivers/mmc/host/loongson2-mmc.h +47 -0

71 lines not on this page · raw message

Signature · 1 line
2.47.1
maintainer Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH v1 1/4] dt-bindings: mmc: Add Loongson-2K SD/SDIO/eMMC controller binding

In reply to Binbin Zhou
Quoted 10 lines · Binbin Zhou

Add the Loongson-2K SoC's SD/SDIO/eMMC controller binding with DT schema format using json-schema.

---
 .../bindings/mmc/loongson,ls2k-mmc.yaml       | 67 +++++++++++++++++++
 MAINTAINERS                                   |  6 ++
 2 files changed, 73 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml
maintainer
#7 lore raw

Re: [PATCH v1 3/4] dt-bindings: mmc: loongson,ls2k-mmc: Add compatible for Loongson-2K2000

In reply to Binbin Zhou
Quoted 22 lines · Binbin Zhou

Add the devicetree compatible for Loongson-2K2000 EMMC/SD/SDIO controller.

---
 .../bindings/mmc/loongson,ls2k-mmc.yaml       | 47 ++++++++++++++++++-
 1 file changed, 45 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml +3 -0
index f3e94f5f3a35..24d217a9bbe6 100644
@@ -9,6 +9,9 @@ title: The SD/SDIO/eMMC host controller for Loongson-2K family SoCs
 description:
   The MMC host controller on the Loongson-2K0500/2K1000 (using an externally
   shared apbdma controller) provides the SD and SDIO device interfaces.
+  The two MMC host controllers on the Loongson-2K2000 are similar,
+  except that they use internal exclusive DMA. one controller provides
+  the eMMC interface and the other provides the SD/SDIO interface.
 
 maintainers:
   - Binbin Zhou <[email protected]>

Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml properties: · line 31

Quoted 8 lines
Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml +2 -0
@@ -21,8 +24,10 @@ properties:
     enum:
       - loongson,ls2k0500-mmc
       - loongson,ls2k1000-mmc
+      - loongson,ls2k2000-mmc
 
   reg:
+    minItems: 1
     maxItems: 2

Missed this in the first patch, but you need to define what each entry is.

Quoted 61 lines
Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml +40 -2
   interrupts:
@@ -42,11 +47,31 @@ required:
   - reg
   - interrupts
   - clocks
-  - dmas
-  - dma-names
 
 unevaluatedProperties: false
 
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - loongson,ls2k0500-mmc
+          - loongson,ls2k1000-mmc
+
+then:
+  properties:
+    reg:
+      minItems: 2
+
+  required:
+    - dmas
+    - dma-names
+
+else:
+  properties:
+    reg:
+      maxItems: 1
+
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
@@ -65,3 +90,21 @@ examples:
         bus-width = <4>;
         cd-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
     };
+
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/clock/loongson,ls2k-clk.h>
+
+    mmc@79990000 {
+        compatible = "loongson,ls2k2000-mmc";
+        reg = <0x79990000 0x1000>;
+        interrupt-parent = <&pic>;
+        interrupts = <51 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clk LOONGSON2_EMMC_CLK>;
+        bus-width = <8>;
+        non-removable;
+        cap-mmc-highspeed;
+        mmc-hs200-1_8v;
+        no-sd;
+        no-sdio;
+    };
Signature · 1 line
2.47.1
#8 lore raw

Re: [PATCH v1 3/4] dt-bindings: mmc: loongson,ls2k-mmc: Add compatible for Loongson-2K2000

Hi Rob:

Thanks for your reply.

Quoted 29 lines · Rob Herring
Quoted 27 lines · Binbin Zhou

Add the devicetree compatible for Loongson-2K2000 EMMC/SD/SDIO controller.

---
 .../bindings/mmc/loongson,ls2k-mmc.yaml       | 47 ++++++++++++++++++-
 1 file changed, 45 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml +4 -0
index f3e94f5f3a35..24d217a9bbe6 100644
@@ -9,6 +9,9 @@ title: The SD/SDIO/eMMC host controller for Loongson-2K family SoCs
 description:
   The MMC host controller on the Loongson-2K0500/2K1000 (using an externally
   shared apbdma controller) provides the SD and SDIO device interfaces.
+  The two MMC host controllers on the Loongson-2K2000 are similar,
+  except that they use internal exclusive DMA. one controller provides
+  the eMMC interface and the other provides the SD/SDIO interface.
 
 maintainers:
   - Binbin Zhou <[email protected]>
@@ -21,8 +24,10 @@ properties:
     enum:
       - loongson,ls2k0500-mmc
       - loongson,ls2k1000-mmc
+      - loongson,ls2k2000-mmc
 
Quoted 6 lines

Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml properties: · line 31

Quoted 3 lines
Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml +1 -0
   reg:
+    minItems: 1
     maxItems: 2

Missed this in the first patch, but you need to define what each entry is.

Are you thinking that “minItems” should be added in patch-1? I'm not sure if I'm right, but for patch-1 (Loongson-2K1000), his reg count must be 2, so it doesn't need the “ minItems: 1” limitation, whereas Loongson-2K2000 needs this limitation, and so it was put in this patch.

Of course, for the reg description, it is true that I missed it, and I will add it in patch-1.

Quoted 54 lines
Quoted 54 lines
Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml +35 -2
   interrupts:
@@ -42,11 +47,31 @@ required:
   - reg
   - interrupts
   - clocks
-  - dmas
-  - dma-names
 
 unevaluatedProperties: false
 
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - loongson,ls2k0500-mmc
+          - loongson,ls2k1000-mmc
+
+then:
+  properties:
+    reg:
+      minItems: 2
+
+  required:
+    - dmas
+    - dma-names
+
+else:
+  properties:
+    reg:
+      maxItems: 1
+
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
@@ -65,3 +90,21 @@ examples:
         bus-width = <4>;
         cd-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
     };
+
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/clock/loongson,ls2k-clk.h>
+
+    mmc@79990000 {
+        compatible = "loongson,ls2k2000-mmc";
+        reg = <0x79990000 0x1000>;
+        interrupt-parent = <&pic>;
+        interrupts = <51 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clk LOONGSON2_EMMC_CLK>;
+        bus-width = <8>;
+        non-removable;
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml +5 -1
+        cap-mmc-highspeed;
+        mmc-hs200-1_8v;
+        no-sd;
+        no-sdio;
+    };
--

2.47.1

--
Thanks.
Binbin

#4 lore raw

Re: [PATCH v1 2/4] mmc: loongson2: Add Loongson-2K SD/SDIO controller driver

In reply to Binbin Zhou
Quoted 9 lines · Binbin Zhou

The MMC controllers on the Loongson-2K series CPUs are similar, except for the interface characteristics and the use of DMA controllers.

This patch describes the MMC controllers on the Loongson-2K0500/2K1000, with the distinguishing feature being the use of an externally shared APBDMA engine.

Overall this looks good to me. A few things though, please have a look below.

Quoted 9 lines
---
 MAINTAINERS                      |   2 +
 drivers/mmc/host/Kconfig         |  13 +
 drivers/mmc/host/Makefile        |   1 +
 drivers/mmc/host/loongson2-mmc.c | 636 +++++++++++++++++++++++++++++++
 drivers/mmc/host/loongson2-mmc.h | 177 +++++++++
 5 files changed, 829 insertions(+)
 create mode 100644 drivers/mmc/host/loongson2-mmc.c
 create mode 100644 drivers/mmc/host/loongson2-mmc.h

I think we can put all code in the c-file, no need for a separate header file.

Quoted 12 lines
MAINTAINERS +2 -0
index 32c3733a764a..e218a3e204ef 100644
@@ -13940,6 +13940,8 @@ M:      Binbin Zhou <[email protected]>
 L:     [email protected]
 S:     Supported
 F:     Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml
+F:     drivers/mmc/host/loongson2-mmc.c
+F:     drivers/mmc/host/loongson2-mmc.h
 

[...]

Quoted 7 lines
MAINTAINERS +7 -0
+static irqreturn_t loongson2_mmc_irq(int irq, void *dev_id)
+{
+       struct loongson2_mmc_host *host = dev_id;
+       struct mmc_command *cmd;
+       unsigned long iflags;
+       u32 dsts, imsk;
+

MAINTAINERS

Quoted 10 lines
MAINTAINERS +10 -0
+       regmap_read(host->regmap, LOONGSON2_MMC_REG_INT, &imsk);
+       regmap_read(host->regmap, LOONGSON2_MMC_REG_DSTS, &dsts);
+
+       if ((dsts & LOONGSON2_MMC_DSTS_IRQ) &&
+           (imsk & LOONGSON2_MMC_INT_SDIOIRQ)) {
+               regmap_update_bits(host->regmap, LOONGSON2_MMC_REG_INT,
+                                  LOONGSON2_MMC_INT_SDIOIRQ,
+                                  LOONGSON2_MMC_INT_SDIOIRQ);
+
+               mmc_signal_sdio_irq(host->mmc);

mmc_signal_sdio_irq() is the legacy interface for managing SDIO irqs.

Please convert to use sdio_signal_irq() instead, along with the ->ack_sdio_irq() callback.

Quoted 63 lines
MAINTAINERS +63 -0
+               return IRQ_HANDLED;
+       }
+
+       spin_lock_irqsave(&host->lock, iflags);
+
+       if (host->state == STATE_NONE || host->state == STATE_FINALIZE ||
+           !host->mrq)
+               goto irq_out;
+
+       cmd = host->cmd_is_stop ? host->mrq->stop : host->mrq->cmd;
+       if (!cmd)
+               goto irq_out;
+
+       cmd->error = 0;
+
+       if (imsk & LOONGSON2_MMC_INT_CTIMEOUT) {
+               cmd->error = -ETIMEDOUT;
+               goto close_transfer;
+       }
+
+       if (imsk & LOONGSON2_MMC_INT_CSENT) {
+               if (host->state == STATE_RSPFIN || host->state == STATE_CMDSENT)
+                       goto close_transfer;
+
+               if (host->state == STATE_XFERFINISH_RSPFIN)
+                       host->state = STATE_XFERFINISH;
+       }
+
+       if (!cmd->data)
+               goto irq_out;
+
+       if (imsk & (LOONGSON2_MMC_INT_RXCRC | LOONGSON2_MMC_INT_TXCRC)) {
+               cmd->data->error = -EILSEQ;
+               goto close_transfer;
+       }
+
+       if (imsk & LOONGSON2_MMC_INT_DTIMEOUT) {
+               cmd->data->error = -ETIMEDOUT;
+               goto close_transfer;
+       }
+
+       if (imsk & LOONGSON2_MMC_INT_DFIN) {
+               if (host->state == STATE_XFERFINISH) {
+                       host->dma_complete = 1;
+                       goto close_transfer;
+               }
+
+               if (host->state == STATE_XFERFINISH_RSPFIN)
+                       host->state = STATE_RSPFIN;
+       }
+
+irq_out:
+       regmap_write(host->regmap, LOONGSON2_MMC_REG_INT, imsk);
+       spin_unlock_irqrestore(&host->lock, iflags);
+       return IRQ_HANDLED;
+
+close_transfer:
+       host->state = STATE_FINALIZE;
+       host->pdata->reorder_cmd_data(host, cmd);
+       regmap_write(host->regmap, LOONGSON2_MMC_REG_INT, imsk);
+       spin_unlock_irqrestore(&host->lock, iflags);
+       return IRQ_WAKE_THREAD;
+}

[...]

Quoted 19 lines
MAINTAINERS +19 -0
+
+static int loongson2_mmc_resource_request(struct platform_device *pdev,
+                                         struct loongson2_mmc_host *host)
+{
+       struct device *dev = &pdev->dev;
+       void __iomem *base;
+       int ret, irq;
+
+       base = devm_platform_get_and_ioremap_resource(pdev, 0, &host->res);
+       if (IS_ERR(base))
+               return PTR_ERR(base);
+
+       host->regmap = devm_regmap_init_mmio(dev, base, &host->pdata->regmap_config);
+       if (IS_ERR(host->regmap))
+               return PTR_ERR(host->regmap);
+
+       host->clk = devm_clk_get_optional_enabled(dev, NULL);
+       if (IS_ERR(host->clk))
+               return PTR_ERR(host->clk);

MAINTAINERS

Quoted 10 lines
MAINTAINERS +10 -0
+
+       if (host->clk) {
+               ret = devm_clk_rate_exclusive_get(dev, host->clk);
+               if (ret)
+                       return PTR_ERR(host->clk);
+
+               host->rate = clk_get_rate(host->clk);
+       } else {
+               /* For ACPI, we get rate through clock-frequency attribute */
+               device_property_read_u64(dev, "clock-frequency", &host->rate);

Is ACPI supported too?

Quoted 17 lines
MAINTAINERS +17 -0
+       }
+
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0)
+               return irq;
+
+       ret = devm_request_threaded_irq(dev, irq, loongson2_mmc_irq,
+                                       loongson2_mmc_irq_worker,
+                                       IRQF_ONESHOT, "loongson2-mmc", host);
+       if (ret)
+               return ret;
+
+       ret = host->pdata->setting_dma(host, pdev);
+       if (ret)
+               return ret;
+
+       return dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));

MAINTAINERS

Quoted 10 lines
MAINTAINERS +10 -0
+}
+
+static int loongson2_mmc_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct loongson2_mmc_host *host;
+       struct mmc_host *mmc;
+       int ret;
+
+       mmc = mmc_alloc_host(sizeof(*host), dev);

We have devm_mmc_alloc_host() too, perhaps worth to use it to simplify the code a bit.

Quoted 17 lines
MAINTAINERS +17 -0
+       if (!mmc) {
+               dev_err(dev, "Failed to alloc mmc host\n");
+               return -ENOMEM;
+       }
+
+       platform_set_drvdata(pdev, mmc);
+
+       host = mmc_priv(mmc);
+       host->mmc = mmc;
+       host->state = STATE_NONE;
+       spin_lock_init(&host->lock);
+
+       host->pdata = device_get_match_data(dev);
+       if (!host->pdata) {
+               dev_err(dev, "Failed to get match data\n");
+               ret = -EINVAL;
+               goto free_host;

MAINTAINERS

Quoted 10 lines
MAINTAINERS +10 -0
+       }
+
+       ret = loongson2_mmc_resource_request(pdev, host);
+       if (ret) {
+               dev_err(dev, "Failed to request resource\n");
+               goto free_host;
+       }
+
+       mmc->ops = &loongson2_mmc_ops;
+       mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;

How is power to the card controlled for these platforms?

The preferred way is to use the regulator API to manage this - and the mmc core also provides a couple of helper functions for this, like mmc_regulator_get_supply(), for example.

Quoted 19 lines
MAINTAINERS +19 -0
+       mmc->f_min = DIV_ROUND_UP(host->rate, 256);
+       mmc->f_max = host->rate;
+       mmc->max_blk_count = 4095;
+       mmc->max_blk_size = 4095;
+       mmc->max_req_size = mmc->max_blk_count * mmc->max_blk_size;
+       mmc->max_segs = 1;
+       mmc->max_seg_size = mmc->max_req_size;
+
+       ret = mmc_of_parse(mmc);
+       if (ret) {
+               dev_err(dev, "Failed to parse device node\n");
+               goto free_dma;
+       }
+
+       ret = mmc_add_host(mmc);
+       if (ret) {
+               dev_err(dev, "Failed to add mmc host.\n");
+               goto free_dma;
+       }

MAINTAINERS

Quoted 10 lines
MAINTAINERS +10 -0
+
+       return 0;
+
+free_dma:
+       host->pdata->release_dma(host, dev);
+free_host:
+       mmc_free_host(mmc);
+       return ret;
+}
+

[...]

Kind regards
Uffe

#5 lore raw

Re: [PATCH v1 2/4] mmc: loongson2: Add Loongson-2K SD/SDIO controller driver

Hi Ulf:

Thanks for your review and sorry for the late reply.

Quoted 24 lines · Ulf Hansson
Quoted 9 lines · Binbin Zhou

The MMC controllers on the Loongson-2K series CPUs are similar, except for the interface characteristics and the use of DMA controllers.

This patch describes the MMC controllers on the Loongson-2K0500/2K1000, with the distinguishing feature being the use of an externally shared APBDMA engine.

Overall this looks good to me. A few things though, please have a look below.

Quoted 9 lines
---
 MAINTAINERS                      |   2 +
 drivers/mmc/host/Kconfig         |  13 +
 drivers/mmc/host/Makefile        |   1 +
 drivers/mmc/host/loongson2-mmc.c | 636 +++++++++++++++++++++++++++++++
 drivers/mmc/host/loongson2-mmc.h | 177 +++++++++
 5 files changed, 829 insertions(+)
 create mode 100644 drivers/mmc/host/loongson2-mmc.c
 create mode 100644 drivers/mmc/host/loongson2-mmc.h
Quoted 1 line

I think we can put all code in the c-file, no need for a separate header file.

OK, I will do it.

Quoted 36 lines
Quoted 13 lines
MAINTAINERS +2 -0
index 32c3733a764a..e218a3e204ef 100644
@@ -13940,6 +13940,8 @@ M:      Binbin Zhou <[email protected]>
 L:     [email protected]
 S:     Supported
 F:     Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml
+F:     drivers/mmc/host/loongson2-mmc.c
+F:     drivers/mmc/host/loongson2-mmc.h
 

[...]

Quoted 7 lines
MAINTAINERS +7 -0
+static irqreturn_t loongson2_mmc_irq(int irq, void *dev_id)
+{
+       struct loongson2_mmc_host *host = dev_id;
+       struct mmc_command *cmd;
+       unsigned long iflags;
+       u32 dsts, imsk;
+

MAINTAINERS

Quoted 10 lines
MAINTAINERS +10 -0
+       regmap_read(host->regmap, LOONGSON2_MMC_REG_INT, &imsk);
+       regmap_read(host->regmap, LOONGSON2_MMC_REG_DSTS, &dsts);
+
+       if ((dsts & LOONGSON2_MMC_DSTS_IRQ) &&
+           (imsk & LOONGSON2_MMC_INT_SDIOIRQ)) {
+               regmap_update_bits(host->regmap, LOONGSON2_MMC_REG_INT,
+                                  LOONGSON2_MMC_INT_SDIOIRQ,
+                                  LOONGSON2_MMC_INT_SDIOIRQ);
+
+               mmc_signal_sdio_irq(host->mmc);

mmc_signal_sdio_irq() is the legacy interface for managing SDIO irqs.

Quoted 2 lines

Please convert to use sdio_signal_irq() instead, along with the ->ack_sdio_irq() callback.

OK..

Quoted 90 lines
Quoted 64 lines
MAINTAINERS +63 -0
+               return IRQ_HANDLED;
+       }
+
+       spin_lock_irqsave(&host->lock, iflags);
+
+       if (host->state == STATE_NONE || host->state == STATE_FINALIZE ||
+           !host->mrq)
+               goto irq_out;
+
+       cmd = host->cmd_is_stop ? host->mrq->stop : host->mrq->cmd;
+       if (!cmd)
+               goto irq_out;
+
+       cmd->error = 0;
+
+       if (imsk & LOONGSON2_MMC_INT_CTIMEOUT) {
+               cmd->error = -ETIMEDOUT;
+               goto close_transfer;
+       }
+
+       if (imsk & LOONGSON2_MMC_INT_CSENT) {
+               if (host->state == STATE_RSPFIN || host->state == STATE_CMDSENT)
+                       goto close_transfer;
+
+               if (host->state == STATE_XFERFINISH_RSPFIN)
+                       host->state = STATE_XFERFINISH;
+       }
+
+       if (!cmd->data)
+               goto irq_out;
+
+       if (imsk & (LOONGSON2_MMC_INT_RXCRC | LOONGSON2_MMC_INT_TXCRC)) {
+               cmd->data->error = -EILSEQ;
+               goto close_transfer;
+       }
+
+       if (imsk & LOONGSON2_MMC_INT_DTIMEOUT) {
+               cmd->data->error = -ETIMEDOUT;
+               goto close_transfer;
+       }
+
+       if (imsk & LOONGSON2_MMC_INT_DFIN) {
+               if (host->state == STATE_XFERFINISH) {
+                       host->dma_complete = 1;
+                       goto close_transfer;
+               }
+
+               if (host->state == STATE_XFERFINISH_RSPFIN)
+                       host->state = STATE_RSPFIN;
+       }
+
+irq_out:
+       regmap_write(host->regmap, LOONGSON2_MMC_REG_INT, imsk);
+       spin_unlock_irqrestore(&host->lock, iflags);
+       return IRQ_HANDLED;
+
+close_transfer:
+       host->state = STATE_FINALIZE;
+       host->pdata->reorder_cmd_data(host, cmd);
+       regmap_write(host->regmap, LOONGSON2_MMC_REG_INT, imsk);
+       spin_unlock_irqrestore(&host->lock, iflags);
+       return IRQ_WAKE_THREAD;
+}

[...]

Quoted 23 lines
MAINTAINERS +23 -0
+
+static int loongson2_mmc_resource_request(struct platform_device *pdev,
+                                         struct loongson2_mmc_host *host)
+{
+       struct device *dev = &pdev->dev;
+       void __iomem *base;
+       int ret, irq;
+
+       base = devm_platform_get_and_ioremap_resource(pdev, 0, &host->res);
+       if (IS_ERR(base))
+               return PTR_ERR(base);
+
+       host->regmap = devm_regmap_init_mmio(dev, base, &host->pdata->regmap_config);
+       if (IS_ERR(host->regmap))
+               return PTR_ERR(host->regmap);
+
+       host->clk = devm_clk_get_optional_enabled(dev, NULL);
+       if (IS_ERR(host->clk))
+               return PTR_ERR(host->clk);
+
+       if (host->clk) {
+               ret = devm_clk_rate_exclusive_get(dev, host->clk);
+               if (ret)
Quoted 8 lines

MAINTAINERS

Quoted 6 lines
MAINTAINERS +6 -0
+                       return PTR_ERR(host->clk);
+
+               host->rate = clk_get_rate(host->clk);
+       } else {
+               /* For ACPI, we get rate through clock-frequency attribute */
+               device_property_read_u64(dev, "clock-frequency", &host->rate);

Is ACPI supported too?

Yes, like on the Loongson-2K2000 platform, we support ACPI and FDT. For ACPI, we also match by compatible strings, so the interface is the same as for FDT, except that the in-node attribute descriptions are not exactly the same, e.g. clock-frequency.

Quoted 23 lines
Quoted 23 lines
MAINTAINERS +22 -0
+       }
+
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0)
+               return irq;
+
+       ret = devm_request_threaded_irq(dev, irq, loongson2_mmc_irq,
+                                       loongson2_mmc_irq_worker,
+                                       IRQF_ONESHOT, "loongson2-mmc", host);
+       if (ret)
+               return ret;
+
+       ret = host->pdata->setting_dma(host, pdev);
+       if (ret)
+               return ret;
+
+       return dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
+}
+
+static int loongson2_mmc_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
Quoted 8 lines

MAINTAINERS

Quoted 5 lines
MAINTAINERS +5 -0
+       struct loongson2_mmc_host *host;
+       struct mmc_host *mmc;
+       int ret;
+
+       mmc = mmc_alloc_host(sizeof(*host), dev);

We have devm_mmc_alloc_host() too, perhaps worth to use it to simplify the code a bit.

This is good news and I will do it.

Quoted 31 lines
Quoted 18 lines
MAINTAINERS +17 -0
+       if (!mmc) {
+               dev_err(dev, "Failed to alloc mmc host\n");
+               return -ENOMEM;
+       }
+
+       platform_set_drvdata(pdev, mmc);
+
+       host = mmc_priv(mmc);
+       host->mmc = mmc;
+       host->state = STATE_NONE;
+       spin_lock_init(&host->lock);
+
+       host->pdata = device_get_match_data(dev);
+       if (!host->pdata) {
+               dev_err(dev, "Failed to get match data\n");
+               ret = -EINVAL;
+               goto free_host;

MAINTAINERS

Quoted 10 lines
MAINTAINERS +10 -0
+       }
+
+       ret = loongson2_mmc_resource_request(pdev, host);
+       if (ret) {
+               dev_err(dev, "Failed to request resource\n");
+               goto free_host;
+       }
+
+       mmc->ops = &loongson2_mmc_ops;
+       mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;

How is power to the card controlled for these platforms?

Quoted 3 lines

The preferred way is to use the regulator API to manage this - and the mmc core also provides a couple of helper functions for this, like mmc_regulator_get_supply(), for example.

Emm, I will try to use this API.

Quoted 35 lines
Quoted 20 lines
MAINTAINERS +19 -0
+       mmc->f_min = DIV_ROUND_UP(host->rate, 256);
+       mmc->f_max = host->rate;
+       mmc->max_blk_count = 4095;
+       mmc->max_blk_size = 4095;
+       mmc->max_req_size = mmc->max_blk_count * mmc->max_blk_size;
+       mmc->max_segs = 1;
+       mmc->max_seg_size = mmc->max_req_size;
+
+       ret = mmc_of_parse(mmc);
+       if (ret) {
+               dev_err(dev, "Failed to parse device node\n");
+               goto free_dma;
+       }
+
+       ret = mmc_add_host(mmc);
+       if (ret) {
+               dev_err(dev, "Failed to add mmc host.\n");
+               goto free_dma;
+       }

MAINTAINERS

Quoted 10 lines
MAINTAINERS +10 -0
+
+       return 0;
+
+free_dma:
+       host->pdata->release_dma(host, dev);
+free_host:
+       mmc_free_host(mmc);
+       return ret;
+}
+

[...]

Kind regards
Uffe

Signature · 2 lines
Thanks.
Binbin