Skip to contentSkip to conversation

Add RZ/G1C SD/eMMC support

PATCH New Biju Das 2 participants 29 messages Nov 21, 2019 – Nov 27, 2019

Subsystems (4)
lore
Share & tools
lore

Biju Das

author
#0 lore raw

cover Add RZ/G1C SD/eMMC support

This patch series add SD/eMMC support support for RZ/G1C sbc.

RZ/G1C eMMC IP is different from other RZ/G1 SoC's. It is having an internal DMA for data transfer which is similar to R-Car Gen3.

Support for internal DMAC is added in 4.14 kernel and support for RZ/G1C added on 4.20 kernel.

Backported the relevent patches to linux-4.4.y-cip.

Fabrizio Castro (6):
dt-bindings: mmc: renesas_sdhi: Add r8a77470 support
mmc: renesas_sdhi: Add r8a77470 SDHI1 support
ARM: dts: r8a77470: Add SDHI2 support
ARM: dts: r8a77470: Add SDHI0 support
ARM: dts: r8a77470: Add SDHI1 support
ARM: dts: iwg23s-sbc: Add uSD and eMMC support

Masahiro Yamada (1):
mmc: renesas_sdhi: consolidate DMAC CONFIG options

Simon Horman (9):
mmc: tmio: rename tmio_mmc_{pio => core}.c
mmc: renesas-sdhi: rename tmio_mmc_dma.c => renesas_sdhi_sys_dmac.c
mmc: renesas-sdhi: rename sh_mobile_sdhi.c => renesas_sdhi_core.c
mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file
mmc: renesas-sdhi: improve checkpatch cleanness
mmc: tmio, renesas-sdhi: add dataend to DMA ops
mmc: renesas-sdhi: add support for R-Car Gen3 SDHI DMAC
dt-bindings: mmc: renesas_sdhi: add R-Car Gen[123] fallback
compatibility strings
mmc: renesas_sdhi: implement R-Car Gen[123] fallback compatibility
strings

Yoshihiro Shimoda (1):
mmc: tmio, renesas-sdhi: add max_{segs, blk_count} to tmio_mmc_data

 Documentation/devicetree/bindings/mmc/tmio_mmc.txt |    9 +
 arch/arm/boot/dts/r8a77470-iwg23s-sbc.dts          |   75 ++
 arch/arm/boot/dts/r8a77470.dtsi                    |   38 +
 drivers/mmc/host/Kconfig                           |   21 +-
 drivers/mmc/host/Makefile                          |    5 +-
 drivers/mmc/host/renesas_sdhi.h                    |   41 +
 drivers/mmc/host/renesas_sdhi_core.c               |  632 +++++++++
 drivers/mmc/host/renesas_sdhi_internal_dmac.c      |  273 ++++
 drivers/mmc/host/renesas_sdhi_sys_dmac.c           |  480 +++++++
 drivers/mmc/host/sh_mobile_sdhi.c                  |  745 -----------
 drivers/mmc/host/tmio_mmc.h                        |   11 +-
 drivers/mmc/host/tmio_mmc_core.c                   | 1398 ++++++++++++++++++++
 drivers/mmc/host/tmio_mmc_dma.c                    |  365 -----
 drivers/mmc/host/tmio_mmc_pio.c                    | 1392 -------------------
 include/linux/mfd/tmio.h                           |    2 +
 15 files changed, 2973 insertions(+), 2514 deletions(-)
 create mode 100644 drivers/mmc/host/renesas_sdhi.h
 create mode 100644 drivers/mmc/host/renesas_sdhi_core.c
 create mode 100644 drivers/mmc/host/renesas_sdhi_internal_dmac.c
 create mode 100644 drivers/mmc/host/renesas_sdhi_sys_dmac.c
 delete mode 100644 drivers/mmc/host/sh_mobile_sdhi.c
 create mode 100644 drivers/mmc/host/tmio_mmc_core.c
 delete mode 100644 drivers/mmc/host/tmio_mmc_dma.c
 delete mode 100644 drivers/mmc/host/tmio_mmc_pio.c
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/17 mmc: tmio: rename tmio_mmc_{pio => core}.c

From: Simon Horman <[email protected]>

commit 426e95d1766bad20e59f219af64fdd50c39bcfee upstream.

Rename tmio_mmc_pio.c to tmio_mmc_core.c to more accurately reflect its
function: to provide core code for the tmio-mmc and sh-mobole-sdhi drivers.

---
 drivers/mmc/host/Makefile        |    1 -
 drivers/mmc/host/tmio_mmc_core.c | 1392 ++++++++++++++++++++++++++++++++++++++
 drivers/mmc/host/tmio_mmc_pio.c  | 1392 --------------------------------------
 3 files changed, 1392 insertions(+), 1393 deletions(-)
 create mode 100644 drivers/mmc/host/tmio_mmc_core.c
 delete mode 100644 drivers/mmc/host/tmio_mmc_pio.c
drivers/mmc/host/Makefile +0 -1
index bf399b8..2b75a43 100644
@@ -36,7 +36,6 @@ obj-$(CONFIG_MMC_S3C)   	+= s3cmci.o
 obj-$(CONFIG_MMC_SDRICOH_CS)	+= sdricoh_cs.o
 obj-$(CONFIG_MMC_TMIO)		+= tmio_mmc.o
 obj-$(CONFIG_MMC_TMIO_CORE)	+= tmio_mmc_core.o
-tmio_mmc_core-y			:= tmio_mmc_pio.o
 obj-$(CONFIG_MMC_SDHI)		+= sh_mobile_sdhi.o tmio_mmc_dma.o
 obj-$(CONFIG_MMC_CB710)		+= cb710-mmc.o
 obj-$(CONFIG_MMC_VIA_SDMMC)	+= via-sdmmc.o
drivers/mmc/host/tmio_mmc_core.c new file +1392 -0

1,392 lines not on this page · raw message

drivers/mmc/host/tmio_mmc_pio.c deleted +0 -1392

1,392 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/17 mmc: tmio: rename tmio_mmc_{pio => core}.c

Quoted 6 lines · Biju Das

From: Simon Horman <[email protected]>

commit 426e95d1766bad20e59f219af64fdd50c39bcfee upstream.

Rename tmio_mmc_pio.c to tmio_mmc_core.c to more accurately reflect its
function: to provide core code for the tmio-mmc and sh-mobole-sdhi drivers.

...

Quoted 4 lines
---
 drivers/mmc/host/Makefile        |    1 -
 drivers/mmc/host/tmio_mmc_core.c | 1392 ++++++++++++++++++++++++++++++++++++++
 drivers/mmc/host/tmio_mmc_pio.c  | 1392 --------------------------------------

This is just a rename with no changes. Good.

Best regards,
Pavel

Signature · 9 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191122/8a0cb78f/attachment.sig>
author
#3 lore raw

PATCH 2/17 mmc: renesas-sdhi: rename tmio_mmc_dma.c => renesas_sdhi_sys_dmac.c

In reply to Biju Das

From: Simon Horman <[email protected]>

commit c2a96987c76f093be50550130f5629723b091176 upstream.

Rename the source file for DMA for SDHI as a follow-up to attaching DMA code to the SDHI driver rather than the tmio_core driver.

The name "renesas" is chosen as the SDHI driver is applicable to a wider range of SoCs than SH-Mobile it seems to be a more appropriate name. However, the SDHI driver source itself, is left as sh_mobile_sdhi to avoid unnecessary churn.

The name sys_dmac was chosen to reflect the type of DMA used.

Internal symbols have also been renamed to reflect the filename change.

A follow-up patch will re-organise the SDHI driver removing the need for renesas_sdhi_get_dma_ops().

---
 drivers/mmc/host/Makefile                |   2 +-
 drivers/mmc/host/renesas_sdhi.h          |  18 ++
 drivers/mmc/host/renesas_sdhi_sys_dmac.c | 368 +++++++++++++++++++++++++++++++
 drivers/mmc/host/sh_mobile_sdhi.c        |   3 +-
 drivers/mmc/host/tmio_mmc.h              |   9 -
 drivers/mmc/host/tmio_mmc_dma.c          | 365 ------------------------------
 6 files changed, 389 insertions(+), 376 deletions(-)
 create mode 100644 drivers/mmc/host/renesas_sdhi.h
 create mode 100644 drivers/mmc/host/renesas_sdhi_sys_dmac.c
 delete mode 100644 drivers/mmc/host/tmio_mmc_dma.c
drivers/mmc/host/Makefile +1 -1
index 2b75a43..7ab00194 100644
@@ -36,7 +36,7 @@ obj-$(CONFIG_MMC_S3C)   	+= s3cmci.o
 obj-$(CONFIG_MMC_SDRICOH_CS)	+= sdricoh_cs.o
 obj-$(CONFIG_MMC_TMIO)		+= tmio_mmc.o
 obj-$(CONFIG_MMC_TMIO_CORE)	+= tmio_mmc_core.o
-obj-$(CONFIG_MMC_SDHI)		+= sh_mobile_sdhi.o tmio_mmc_dma.o
+obj-$(CONFIG_MMC_SDHI)		+= sh_mobile_sdhi.o renesas_sdhi_sys_dmac.o
 obj-$(CONFIG_MMC_CB710)		+= cb710-mmc.o
 obj-$(CONFIG_MMC_VIA_SDMMC)	+= via-sdmmc.o
 obj-$(CONFIG_SDH_BFIN)		+= bfin_sdh.o
drivers/mmc/host/renesas_sdhi.h new file +18 -0
new file mode 100644
index 0000000..f65d936c
@@ -0,0 +1,18 @@
+/*
+ * Renesas Mobile SDHI
+ *
+ * Copyright (C) 2017 Horms Solutions Ltd., Simon Horman
+ * Copyright (C) 2017 Renesas Electronics Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef RENESAS_SDHI_H
+#define RENESAS_SDHI_H
+
+#include "tmio_mmc.h"
+
+const struct tmio_mmc_dma_ops *renesas_sdhi_get_dma_ops(void);
+#endif
drivers/mmc/host/renesas_sdhi_sys_dmac.c new file +368 -0

368 lines not on this page · raw message

drivers/mmc/host/sh_mobile_sdhi.c +2 -1
index 05edac3..8ca9860 100644
@@ -35,6 +35,7 @@
 #include <linux/pinctrl/pinctrl-state.h>
 #include <linux/regulator/consumer.h>
 
+#include "renesas_sdhi.h"
 #include "tmio_mmc.h"
 
 #define EXT_ACC           0xe4
@@ -643,7 +644,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	/* All SDHI have SDIO status bits which must be 1 */
 	mmc_data->flags |= TMIO_MMC_SDIO_STATUS_SETBITS;
 
-	ret = tmio_mmc_host_probe(host, mmc_data, tmio_mmc_get_dma_ops());
+	ret = tmio_mmc_host_probe(host, mmc_data, renesas_sdhi_get_dma_ops());
 	if (ret < 0)
 		goto efree;
 
drivers/mmc/host/tmio_mmc.h +0 -9
index 86aa49f3..cd5b4f3 100644
@@ -212,15 +212,6 @@ void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
 void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
 irqreturn_t tmio_mmc_irq(int irq, void *devid);
 
-#if IS_ENABLED(CONFIG_MMC_SDHI)
-const struct tmio_mmc_dma_ops *tmio_mmc_get_dma_ops(void);
-#else
-static inline const struct tmio_mmc_dma_ops *tmio_mmc_get_dma_ops(void)
-{
-	return NULL;
-}
-#endif
-
 static inline char *tmio_mmc_kmap_atomic(struct scatterlist *sg,
 					 unsigned long *flags)
 {
drivers/mmc/host/tmio_mmc_dma.c deleted +0 -365

365 lines not on this page · raw message

Signature · 1 line
2.7.4
#4 lore raw

PATCH 2/17 mmc: renesas-sdhi: rename tmio_mmc_dma.c => renesas_sdhi_sys_dmac.c

Hi!

Quoted 18 lines

commit c2a96987c76f093be50550130f5629723b091176 upstream.

Rename the source file for DMA for SDHI as a follow-up to attaching DMA code to the SDHI driver rather than the tmio_core driver.

The name "renesas" is chosen as the SDHI driver is applicable to a wider range of SoCs than SH-Mobile it seems to be a more appropriate name. However, the SDHI driver source itself, is left as sh_mobile_sdhi to avoid unnecessary churn.

The name sys_dmac was chosen to reflect the type of DMA used.

Internal symbols have also been renamed to reflect the filename change.

A follow-up patch will re-organise the SDHI driver removing the need for renesas_sdhi_get_dma_ops().

Quoted 6 lines
 drivers/mmc/host/Makefile                |   2 +-
 drivers/mmc/host/renesas_sdhi.h          |  18 ++
 drivers/mmc/host/renesas_sdhi_sys_dmac.c | 368 +++++++++++++++++++++++++++++++
 drivers/mmc/host/sh_mobile_sdhi.c        |   3 +-
 drivers/mmc/host/tmio_mmc.h              |   9 -
 drivers/mmc/host/tmio_mmc_dma.c          | 365 ------------------------------

So there is rename, and function prefixes change accordingly.

The real change is that !IS_ENABLED(CONFIG_MMC_SDHI) fallback below disappeared. I don't how this is related to the rename.

Are you sure it will not cause compile problems in !IS_ENABLED(CONFIG_MMC_SDHI) case?

Best regards,
Pavel

Quoted 44 lines
drivers/mmc/host/renesas_sdhi.h new file +18 -0
new file mode 100644
index 0000000..f65d936c
@@ -0,0 +1,18 @@
+/*
+ * Renesas Mobile SDHI
+ *
+ * Copyright (C) 2017 Horms Solutions Ltd., Simon Horman
+ * Copyright (C) 2017 Renesas Electronics Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef RENESAS_SDHI_H
+#define RENESAS_SDHI_H
+
+#include "tmio_mmc.h"
+
+const struct tmio_mmc_dma_ops *renesas_sdhi_get_dma_ops(void);
+#endif
drivers/mmc/host/tmio_mmc.h +0 -9
index 86aa49f3..cd5b4f3 100644
@@ -212,15 +212,6 @@ void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
 void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
 irqreturn_t tmio_mmc_irq(int irq, void *devid);
 
-#if IS_ENABLED(CONFIG_MMC_SDHI)
-const struct tmio_mmc_dma_ops *tmio_mmc_get_dma_ops(void);
-#else
-static inline const struct tmio_mmc_dma_ops *tmio_mmc_get_dma_ops(void)
-{
-	return NULL;
-}
-#endif
-
 static inline char *tmio_mmc_kmap_atomic(struct scatterlist *sg,
 					 unsigned long *flags)
 {
Signature · 9 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191122/2ec916ff/attachment.sig>
author
#5 lore raw

PATCH 2/17 mmc: renesas-sdhi: rename tmio_mmc_dma.c => renesas_sdhi_sys_dmac.c

Hi Pavel,

Thanks for the feedback.

Quoted 32 lines

Subject: Re: [PATCH 4.4.y-cip 02/17] mmc: renesas-sdhi: rename tmio_mmc_dma.c => renesas_sdhi_sys_dmac.c

Hi!

Quoted 7 lines

commit c2a96987c76f093be50550130f5629723b091176 upstream.

Rename the source file for DMA for SDHI as a follow-up to attaching DMA code to the SDHI driver rather than the tmio_core driver.

The name "renesas" is chosen as the SDHI driver is applicable to a wider range of SoCs than SH-Mobile it seems to be a more appropriate

name.

Quoted 7 lines

However, the SDHI driver source itself, is left as sh_mobile_sdhi to avoid unnecessary churn.

The name sys_dmac was chosen to reflect the type of DMA used.

Internal symbols have also been renamed to reflect the filename change.

Quoted 7 lines

A follow-up patch will re-organise the SDHI driver removing the need for renesas_sdhi_get_dma_ops().

 drivers/mmc/host/Makefile                |   2 +-
 drivers/mmc/host/renesas_sdhi.h          |  18 ++
 drivers/mmc/host/renesas_sdhi_sys_dmac.c | 368

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

Quoted 3 lines
 drivers/mmc/host/sh_mobile_sdhi.c        |   3 +-
 drivers/mmc/host/tmio_mmc.h              |   9 -
 drivers/mmc/host/tmio_mmc_dma.c          | 365 ------------------------------
Quoted 7 lines

So there is rename, and function prefixes change accordingly.

The real change is that !IS_ENABLED(CONFIG_MMC_SDHI) fallback below disappeared. I don't how this is related to the rename.

Are you sure it will not cause compile problems in !IS_ENABLED(CONFIG_MMC_SDHI) case?

I am not seeing any compilation issues with disabling CONFIG_MMC_SDHI.

Quoted 52 lines
Quoted 15 lines
(quoted diff) +0 -0

b/drivers/mmc/host/renesas_sdhi.h new file mode 100644 index 0000000..f65d936c

drivers/mmc/host/renesas_sdhi.h new file +8 -0
@@ -0,0 +1,18 @@
+/*
+ * Renesas Mobile SDHI
+ *
+ * Copyright (C) 2017 Horms Solutions Ltd., Simon Horman
+ * Copyright (C) 2017 Renesas Electronics Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+modify

drivers/mmc/host/renesas_sdhi.h line 18

Quoted 10 lines
drivers/mmc/host/renesas_sdhi.h new file +10 -0
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef RENESAS_SDHI_H
+#define RENESAS_SDHI_H
+
+#include "tmio_mmc.h"
+
+const struct tmio_mmc_dma_ops *renesas_sdhi_get_dma_ops(void);

#endif

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/mmc/host/tmio_mmc.h

drivers/mmc/host/tmio_mmc.h

Quoted 10 lines

index 86aa49f3..cd5b4f3 100644

drivers/mmc/host/tmio_mmc.h +0 -0
@@ -212,15 +212,6 @@ void tmio_mmc_enable_mmc_irqs(struct

tmio_mmc_host *host, u32 i); void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i); irqreturn_t tmio_mmc_irq(int irq, void *devid);

drivers/mmc/host/tmio_mmc.h +0 -2
-#if IS_ENABLED(CONFIG_MMC_SDHI)
-const struct tmio_mmc_dma_ops *tmio_mmc_get_dma_ops(void); -

#else

drivers/mmc/host/tmio_mmc.h void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i); · line 217

Quoted 9 lines

-static inline const struct tmio_mmc_dma_ops
*tmio_mmc_get_dma_ops(void) -{

drivers/mmc/host/tmio_mmc.h +0 -4
-	return NULL;
-}
-#endif
-
 static inline char *tmio_mmc_kmap_atomic(struct scatterlist *sg,
 					 unsigned long *flags)
 {

--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

author
#6 lore raw

PATCH 3/17 mmc: renesas-sdhi: rename sh_mobile_sdhi.c => renesas_sdhi_core.c

In reply to Biju Das

From: Simon Horman <[email protected]>

commit b5b6a5f4f06c0624886b2166e2e8580327f0b943 upstream.

Rename the source file SDHI. A follow-up patch will make it a library file used by a different top-level module file.

The name "renesas" is chosen as the SDHI driver is applicable to a wider range of SoCs than SH-Mobile it seems to be a more appropriate name. However, the SDHI driver source itself, is left as sh_mobile_sdhi to avoid unnecessary churn.

the name "core" was chosen to reflect the desired role of this file, to provide core functionality to the sdhi driver. A follow-up patch will move the file into that role.

Internal symbols have also been renamed to reflect the filename change.

The .name member of struct platform_driver and parameter to MODULE_ALIAS() have not been changed in order to avoid the complication of potentially breaking SH SoCs which still use platform drivers.

---
 drivers/mmc/host/Kconfig             |   2 +-
 drivers/mmc/host/Makefile            |   2 +-
 drivers/mmc/host/renesas_sdhi_core.c | 741 ++++++++++++++++++++++++++++++++++
 drivers/mmc/host/sh_mobile_sdhi.c    | 746 -----------------------------------
 4 files changed, 743 insertions(+), 748 deletions(-)
 create mode 100644 drivers/mmc/host/renesas_sdhi_core.c
 delete mode 100644 drivers/mmc/host/sh_mobile_sdhi.c
drivers/mmc/host/Kconfig +1 -1
index 2e6d2ff..eaf40ec 100644
@@ -565,7 +565,7 @@ config MMC_SDHI
 	select MMC_TMIO_CORE
 	help
 	  This provides support for the SDHI SD/SDIO controller found in
-	  SuperH and ARM SH-Mobile SoCs
+	  Renesas SuperH, ARM and ARM64 based SoCs
 
 config MMC_CB710
 	tristate "ENE CB710 MMC/SD Interface support"
drivers/mmc/host/Makefile +1 -1
index 7ab00194..c3c85c9 100644
@@ -36,7 +36,7 @@ obj-$(CONFIG_MMC_S3C)   	+= s3cmci.o
 obj-$(CONFIG_MMC_SDRICOH_CS)	+= sdricoh_cs.o
 obj-$(CONFIG_MMC_TMIO)		+= tmio_mmc.o
 obj-$(CONFIG_MMC_TMIO_CORE)	+= tmio_mmc_core.o
-obj-$(CONFIG_MMC_SDHI)		+= sh_mobile_sdhi.o renesas_sdhi_sys_dmac.o
+obj-$(CONFIG_MMC_SDHI)		+= renesas_sdhi_core.o renesas_sdhi_sys_dmac.o
 obj-$(CONFIG_MMC_CB710)		+= cb710-mmc.o
 obj-$(CONFIG_MMC_VIA_SDMMC)	+= via-sdmmc.o
 obj-$(CONFIG_SDH_BFIN)		+= bfin_sdh.o
drivers/mmc/host/renesas_sdhi_core.c new file +741 -0

741 lines not on this page · raw message

drivers/mmc/host/sh_mobile_sdhi.c deleted +0 -746

746 lines not on this page · raw message

Signature · 1 line
2.7.4
#7 lore raw

PATCH 3/17 mmc: renesas-sdhi: rename sh_mobile_sdhi.c => renesas_sdhi_core.c

Hi!

Quoted 16 lines

From: Simon Horman <[email protected]>

commit b5b6a5f4f06c0624886b2166e2e8580327f0b943 upstream.

Rename the source file SDHI. A follow-up patch will make it a library file used by a different top-level module file.

The name "renesas" is chosen as the SDHI driver is applicable to a wider range of SoCs than SH-Mobile it seems to be a more appropriate name. However, the SDHI driver source itself, is left as sh_mobile_sdhi to avoid unnecessary churn.

the name "core" was chosen to reflect the desired role of this file, to provide core functionality to the sdhi driver. A follow-up patch will move the file into that role.

Quoted 5 lines

Internal symbols have also been renamed to reflect the filename change.

The .name member of struct platform_driver and parameter to MODULE_ALIAS() have not been changed in order to avoid the complication of potentially breaking SH SoCs which still use platform drivers.

Ok, so this is a big rename.

Quoted 2 lines
 drivers/mmc/host/renesas_sdhi_core.c | 741 ++++++++++++++++++++++++++++++++++
 drivers/mmc/host/sh_mobile_sdhi.c    | 746 -----------------------------------

But there are subtle changes inside. Please avoid doing that when renaming.

I guess array->entry and the cleanup are okay, but can you verify the other two, quoted below?

Thanks and best regards,
Pavel

-static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] =
{
- {
- .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
- },
+static const struct renesas_sdhi_of_data of_default_cfg = {
+ .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
};

(Array -> single entry).

+static const struct renesas_sdhi_of_data of_rcar_gen3_compatible = {
...

-       .capabilities   = MMC_CAP_SD_HIGHSPEED,
+       .capabilities   = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,

(Capability change.)

- ret = pinctrl_select_state(priv->pinctrl, pin_state);
- if (ret)
- return ret;
-
- return 0;
+ return pinctrl_select_state(priv->pinctrl, pin_state);

(Unrelated cleanup.)

@@ -511,13 +505,14 @@ static int sh_mobile_sdhi_write16_hook(struct
...
case CTL_DMA_ENABLE:
- return sh_mobile_sdhi_wait_idle(host);
+ case EXT_ACC:

+               return renesas_sdhi_wait_idle(host);
        }

(Additional case handled in a switch).

Signature · 9 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191122/2ee1c9a0/attachment-0001.sig>
author
#8 lore raw

PATCH 3/17 mmc: renesas-sdhi: rename sh_mobile_sdhi.c => renesas_sdhi_core.c

Hi Pavel,
Thanks for the feedback.

Quoted 51 lines

Subject: Re: [PATCH 4.4.y-cip 03/17] mmc: renesas-sdhi: rename sh_mobile_sdhi.c => renesas_sdhi_core.c

Hi!

Quoted 9 lines

From: Simon Horman <[email protected]>

commit b5b6a5f4f06c0624886b2166e2e8580327f0b943 upstream.

Rename the source file SDHI. A follow-up patch will make it a library file used by a different top-level module file.

The name "renesas" is chosen as the SDHI driver is applicable to a wider range of SoCs than SH-Mobile it seems to be a more appropriate

name.

Quoted 7 lines

However, the SDHI driver source itself, is left as sh_mobile_sdhi to avoid unnecessary churn.

the name "core" was chosen to reflect the desired role of this file, to provide core functionality to the sdhi driver. A follow-up patch will move the file into that role.

Quoted 5 lines

Internal symbols have also been renamed to reflect the filename change.

The .name member of struct platform_driver and parameter to MODULE_ALIAS() have not been changed in order to avoid the complication of potentially breaking SH SoCs which still use platform

drivers.

Ok, so this is a big rename.

Quoted 1 line
 drivers/mmc/host/renesas_sdhi_core.c | 741

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

Quoted 1 line
 drivers/mmc/host/sh_mobile_sdhi.c    | 746 -----------------------------------

But there are subtle changes inside. Please avoid doing that when renaming.

I guess array->entry and the cleanup are okay, but can you verify the other two, quoted below?

Thanks and best regards,
Pavel

-static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = {
- {
- .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
- },
+static const struct renesas_sdhi_of_data of_default_cfg = {
+ .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
};

Quoted 1 line

(Array -> single entry).

Looks like to avoid confusion, We need to backport the patch 13bbd8af65895c524c27850495fadf23449f9f3d (mmc: sh_mobile_sdhi: don't use array for DT configs)

What do you think?

Quoted 6 lines
drivers/mmc/host/renesas_sdhi_core.c new file +2 -1
+static const struct renesas_sdhi_of_data of_rcar_gen3_compatible = {
...
-       .capabilities   = MMC_CAP_SD_HIGHSPEED,
+       .capabilities   = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,

(Capability change.)

Looks like to avoid confusion, We need to backport the patch 685d29ef1783af0049c4aeeec43722e410d5845d (mmc: sh_mobile_sdhi: enable SDIO IRQs for RCar Gen3) What do you think?

Quoted 8 lines
drivers/mmc/host/sh_mobile_sdhi.c deleted +1 -5
-       ret = pinctrl_select_state(priv->pinctrl, pin_state);
-       if (ret)
-               return ret;
-
-       return 0;
+       return pinctrl_select_state(priv->pinctrl, pin_state);

(Unrelated cleanup.)

Looks like to avoid confusion, We need to backport the patch 2272c841ee301402ea7a01fc727619af1f97f0cc (mmc: sh_mobile_sdhi: simplify code for voltage switching) What do you think?

Quoted 10 lines
(quoted diff) +2 -0
@@ -511,13 +505,14 @@ static int sh_mobile_sdhi_write16_hook(struct
...
        case CTL_DMA_ENABLE:
 -               return sh_mobile_sdhi_wait_idle(host);
+       case EXT_ACC:
+               return renesas_sdhi_wait_idle(host)
        }

(Additional case handled in a switch).

Looks like to avoid confusion, We need to backport the patch 13bbd8af65895c524c27850495fadf23449f9f3d (mmc: sh_mobile_sdhi: don't use array for DT configs) What do you think?

Regards,
Biju

#9 lore raw

PATCH 3/17 mmc: renesas-sdhi: rename sh_mobile_sdhi.c => renesas_sdhi_core.c

Hi!

Quoted 5 lines

Looks like to avoid confusion, We need to backport the patch 13bbd8af65895c524c27850495fadf23449f9f3d (mmc: sh_mobile_sdhi: don't use array for DT configs) 685d29ef1783af0049c4aeeec43722e410d5845d (mmc: sh_mobile_sdhi: enable SDIO IRQs for RCar Gen3) 2272c841ee301402ea7a01fc727619af1f97f0cc (mmc: sh_mobile_sdhi: simplify code for voltage switching) What do you think?

Yes, that sounds like reasonable way forward.

Quoted 8 lines
Quoted 8 lines
(quoted diff) +2 -0
@@ -511,13 +505,14 @@ static int sh_mobile_sdhi_write16_hook(struct
...
        case CTL_DMA_ENABLE:
 -               return sh_mobile_sdhi_wait_idle(host);
+       case EXT_ACC:
+               return renesas_sdhi_wait_idle(host)
        }
Quoted 5 lines
Quoted 1 line

(Additional case handled in a switch).

Looks like to avoid confusion, We need to backport the patch 13bbd8af65895c524c27850495fadf23449f9f3d (mmc: sh_mobile_sdhi: don't use array for DT configs) What do you think?

I looked up 13bbd8af65895c524c27850495fadf23449f9f3d, and it does not contain this piece. But yes, backporting patch containing that change will do the trick.

Thanks a lot,
Pavel

Signature · 9 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191126/efaabbe1/attachment.sig>
author
#10 lore raw

PATCH 3/17 mmc: renesas-sdhi: rename sh_mobile_sdhi.c => renesas_sdhi_core.c

Hi Pavel,

Thanks for the feedback.

Quoted 36 lines

-----Original Message-----
From: Pavel Machek <[email protected]>
Sent: Tuesday, November 26, 2019 5:48 PM
To: Biju Das <[email protected]>
Cc: Pavel Machek <[email protected]>; cip-dev at lists.cip-project.org; Nobuhiro Iwamatsu <[email protected]>; Chris Paterson <[email protected]>; Fabrizio Castro <[email protected]>
Subject: Re: [PATCH 4.4.y-cip 03/17] mmc: renesas-sdhi: rename sh_mobile_sdhi.c => renesas_sdhi_core.c

Hi!

Quoted 5 lines

Looks like to avoid confusion, We need to backport the patch 13bbd8af65895c524c27850495fadf23449f9f3d (mmc: sh_mobile_sdhi: don't use array for DT configs) 685d29ef1783af0049c4aeeec43722e410d5845d (mmc: sh_mobile_sdhi: enable SDIO IRQs for RCar Gen3) 2272c841ee301402ea7a01fc727619af1f97f0cc (mmc: sh_mobile_sdhi:

simplify code for voltage switching) What do you think?

Yes, that sounds like reasonable way forward.

Quoted 8 lines
Quoted 8 lines
(quoted diff) +2 -0
@@ -511,13 +505,14 @@ static int sh_mobile_sdhi_write16_hook(struct
...
        case CTL_DMA_ENABLE:
 -               return sh_mobile_sdhi_wait_idle(host);
+       case EXT_ACC:
+               return renesas_sdhi_wait_idle(host)
        }
Quoted 5 lines
Quoted 1 line

(Additional case handled in a switch).

Looks like to avoid confusion, We need to backport the patch 13bbd8af65895c524c27850495fadf23449f9f3d (mmc: sh_mobile_sdhi: don't use array for DT configs) What do you think?

Quoted 3 lines

I looked up 13bbd8af65895c524c27850495fadf23449f9f3d, and it does not contain this piece. But yes, backporting patch containing that change will do the trick.

sorry it was below patch
ff741cfde98bd867eb4c9477bc9ba0df3507eed8 (mmc: sdhi: Add EXT_ACC register busy check)

Any way will send V4 with this changes.

Regards,
Biju

author
#11 lore raw

PATCH 4/17 mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file

In reply to Biju Das

From: Simon Horman <[email protected]>

commit 9d08428afb722fedaea699a32aaf603a8f1ebd5a upstream.

Make renesas_sdhi_sys_dmac.c a top-level module file that makes use of library code supplied by renesas_sdhi_core.c

This is in order to facilitate adding other variants of SDHI; in particular SDHI using different DMA controllers.

[Arnd: Fixed module build error]
[Biju: Backported to 4.4 Kernel]
---
 drivers/mmc/host/renesas_sdhi.h          |  23 +++++-
 drivers/mmc/host/renesas_sdhi_core.c     | 128 ++-----------------------------
 drivers/mmc/host/renesas_sdhi_sys_dmac.c | 109 +++++++++++++++++++++++++-
 3 files changed, 135 insertions(+), 125 deletions(-)
drivers/mmc/host/renesas_sdhi.h +22 -1
index f65d936c..eb3ea15 100644
@@ -12,7 +12,28 @@
 #ifndef RENESAS_SDHI_H
 #define RENESAS_SDHI_H
 
+#include <linux/platform_device.h>
 #include "tmio_mmc.h"
 
-const struct tmio_mmc_dma_ops *renesas_sdhi_get_dma_ops(void);
+struct renesas_sdhi_scc {
+	unsigned long clk_rate;	/* clock rate for SDR104 */
+	u32 tap;		/* sampling clock position for SDR104 */
+};
+
+struct renesas_sdhi_of_data {
+	unsigned long tmio_flags;
+	u32	      tmio_ocr_mask;
+	unsigned long capabilities;
+	unsigned long capabilities2;
+	enum dma_slave_buswidth dma_buswidth;
+	dma_addr_t dma_rx_offset;
+	unsigned bus_shift;
+	int scc_offset;
+	struct renesas_sdhi_scc *taps;
+	int taps_num;
+};
+
+int renesas_sdhi_probe(struct platform_device *pdev,
+                       const struct tmio_mmc_dma_ops *dma_ops);
+int renesas_sdhi_remove(struct platform_device *pdev);
 #endif
drivers/mmc/host/renesas_sdhi_core.c +8 -120

167 lines not on this page · raw message

drivers/mmc/host/renesas_sdhi_sys_dmac.c +105 -4

139 lines not on this page · raw message

Signature · 1 line
2.7.4
#12 lore raw

PATCH 4/17 mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file

Hi!

Quoted 7 lines

From: Simon Horman <[email protected]>

commit 9d08428afb722fedaea699a32aaf603a8f1ebd5a upstream.

Make renesas_sdhi_sys_dmac.c a top-level module file that makes use of library code supplied by renesas_sdhi_core.c

Quoted 6 lines

This is in order to facilitate adding other variants of SDHI; in particular SDHI using different DMA controllers.

 drivers/mmc/host/renesas_sdhi.h          |  23 +++++-
 drivers/mmc/host/renesas_sdhi_core.c     | 128 ++-----------------------------
 drivers/mmc/host/renesas_sdhi_sys_dmac.c | 109 +++++++++++++++++++++++++-

There is real code change hidden between the move. Is that intentional / is that okay thing to do? Unmapping DMA buffers before the DMA is completed sounds strange.

Best regards,
Pavel

Quoted 21 lines
drivers/mmc/host/renesas_sdhi_sys_dmac.c +5 -2
@@ -46,8 +119,6 @@ static void renesas_sdhi_sys_dmac_dma_callback(void *arg)
 {
 	struct tmio_mmc_host *host = arg;
 
-	wait_for_completion(&host->dma_dataend);
-
 	spin_lock_irq(&host->lock);
 
 	if (!host->data)
@@ -62,6 +133,11 @@ static void renesas_sdhi_sys_dmac_dma_callback(void *arg)
 			     host->sg_ptr, host->sg_len,
 			     DMA_TO_DEVICE);
 
+	spin_unlock_irq(&host->lock);
+
+	wait_for_completion(&host->dma_dataend);
+
+	spin_lock_irq(&host->lock);
 	tmio_mmc_do_data_irq(host);
 out:
 	spin_unlock_irq(&host->lock);
Signature · 9 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191122/4e057f3e/attachment.sig>
author
#13 lore raw

PATCH 4/17 mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file

Hi Pavel,

Thanks for the feedback.

Quoted 15 lines

Subject: Re: [PATCH 4.4.y-cip 04/17] mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file

Hi!

Quoted 9 lines

From: Simon Horman <[email protected]>

commit 9d08428afb722fedaea699a32aaf603a8f1ebd5a upstream.

Make renesas_sdhi_sys_dmac.c a top-level module file that makes use of library code supplied by renesas_sdhi_core.c

This is in order to facilitate adding other variants of SDHI; in particular SDHI using different DMA controllers.

Quoted 9 lines
Quoted 4 lines
 drivers/mmc/host/renesas_sdhi.h          |  23 +++++-
 drivers/mmc/host/renesas_sdhi_core.c     | 128 ++-----------------------------
 drivers/mmc/host/renesas_sdhi_sys_dmac.c | 109

+++++++++++++++++++++++++-

There is real code change hidden between the move. Is that intentional / is that okay thing to do? Unmapping DMA buffers before the DMA is completed sounds strange.

Looks like to avoid confusion, We need to backport this patch before the renaming.

5f07ef8f603ace496ca8c20eef446c5ae7a10474 (mmc: tmio: always unmap DMA before waiting for interrupt)

What do you think?

Regards,
Biju

Quoted 31 lines

Review static void

Quoted 3 lines
(quoted diff) +0 -0
@@ -46,8 +119,6 @@ static void

renesas_sdhi_sys_dmac_dma_callback(void

drivers/mmc/host/renesas_sdhi_sys_dmac.c static void

Quoted 9 lines
drivers/mmc/host/renesas_sdhi_sys_dmac.c +0 -2
 *arg)  {
 	struct tmio_mmc_host *host = arg;
 
-	wait_for_completion(&host->dma_dataend);
-
 	spin_lock_irq(&host->lock);
 
 	if (!host->data)
@@ -62,6 +133,11 @@ static void

renesas_sdhi_sys_dmac_dma_callback(void *arg)

drivers/mmc/host/renesas_sdhi_sys_dmac.c static void renesas_sdhi_sys_dmac_dma_callback(void *arg) · line 143

Quoted 11 lines
drivers/mmc/host/renesas_sdhi_sys_dmac.c +5 -0
 			     host->sg_ptr, host->sg_len,
 			     DMA_TO_DEVICE);
 
+	spin_unlock_irq(&host->lock);
+
+	wait_for_completion(&host->dma_dataend);
+
+	spin_lock_irq(&host->lock);
 	tmio_mmc_do_data_irq(host);
 out:
 	spin_unlock_irq(&host->lock);

--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

#14 lore raw

PATCH 4/17 mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file

Hi!

Quoted 10 lines
Quoted 4 lines

There is real code change hidden between the move. Is that intentional / is that okay thing to do? Unmapping DMA buffers before the DMA is completed sounds strange.

Looks like to avoid confusion, We need to backport this patch before the renaming.

5f07ef8f603ace496ca8c20eef446c5ae7a10474 (mmc: tmio: always unmap DMA before waiting for interrupt)

What do you think?

Yes, that is good way forward.

Best regards,
Pavel

Signature · 9 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191126/46e94ae0/attachment.sig>
author
#15 lore raw

PATCH 4/17 mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file

Hi Pavel,

Thanks for the feedback.

Quoted 13 lines

Subject: Re: [PATCH 4.4.y-cip 04/17] mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file

Hi!

Quoted 6 lines
Quoted 4 lines

There is real code change hidden between the move. Is that intentional / is that okay thing to do? Unmapping DMA buffers before the DMA is completed sounds strange.

Looks like to avoid confusion, We need to backport this patch before the

renaming.

Quoted 1 line
Quoted 7 lines
Quoted 1 line

5f07ef8f603ace496ca8c20eef446c5ae7a10474 (mmc: tmio: always unmap

DMA

Quoted 3 lines

before waiting for interrupt)

What do you think?

Yes, that is good way forward.

OK. Will send V4.

Regards,
Biju

author
#16 lore raw

PATCH 5/17 mmc: renesas-sdhi: improve checkpatch cleanness

In reply to Biju Das

From: Simon Horman <[email protected]>

commit 2fe35968feccaee61413edbe54bec66bc80a67a7 upstream.

Trivial updates to improve checkpatch cleanness.

---
 drivers/mmc/host/renesas_sdhi.h          |  2 +-
 drivers/mmc/host/renesas_sdhi_core.c     | 43 ++++++++++++++++----------------
 drivers/mmc/host/renesas_sdhi_sys_dmac.c | 25 +++++++++++--------
 3 files changed, 37 insertions(+), 33 deletions(-)
drivers/mmc/host/renesas_sdhi.h +1 -1
index eb3ea15..781fe4c 100644
@@ -34,6 +34,6 @@ struct renesas_sdhi_of_data {
 };
 
 int renesas_sdhi_probe(struct platform_device *pdev,
-                       const struct tmio_mmc_dma_ops *dma_ops);
+		       const struct tmio_mmc_dma_ops *dma_ops);
 int renesas_sdhi_remove(struct platform_device *pdev);
 #endif
drivers/mmc/host/renesas_sdhi_core.c +22 -21

134 lines not on this page · raw message

drivers/mmc/host/renesas_sdhi_sys_dmac.c +14 -11
index 82a37d1..d7757dd 100644
@@ -92,7 +92,6 @@ static const struct of_device_id renesas_sdhi_sys_dmac_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, renesas_sdhi_sys_dmac_of_match);
 
-
 static void renesas_sdhi_sys_dmac_enable_dma(struct tmio_mmc_host *host,
 					     bool enable)
 {
@@ -184,8 +183,8 @@ static void renesas_sdhi_sys_dmac_start_dma_rx(struct tmio_mmc_host *host)
 
 	ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_FROM_DEVICE);
 	if (ret > 0)
-		desc = dmaengine_prep_slave_sg(chan, sg, ret,
-			DMA_DEV_TO_MEM, DMA_CTRL_ACK);
+		desc = dmaengine_prep_slave_sg(chan, sg, ret, DMA_DEV_TO_MEM,
+					       DMA_CTRL_ACK);
 
 	if (desc) {
 		reinit_completion(&host->dma_dataend);
@@ -253,6 +252,7 @@ static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host)
 	if (!aligned) {
 		unsigned long flags;
 		void *sg_vaddr = tmio_mmc_kmap_atomic(sg, &flags);
+
 		sg_init_one(&host->bounce_sg, host->bounce_buf, sg->length);
 		memcpy(host->bounce_buf, sg_vaddr, host->bounce_sg.length);
 		tmio_mmc_kunmap_atomic(sg, &flags, sg_vaddr);
@@ -262,8 +262,8 @@ static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host)
 
 	ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_TO_DEVICE);
 	if (ret > 0)
-		desc = dmaengine_prep_slave_sg(chan, sg, ret,
-			DMA_MEM_TO_DEV, DMA_CTRL_ACK);
+		desc = dmaengine_prep_slave_sg(chan, sg, ret, DMA_MEM_TO_DEV,
+					       DMA_CTRL_ACK);
 
 	if (desc) {
 		reinit_completion(&host->dma_dataend);
@@ -296,7 +296,7 @@ pio:
 }
 
 static void renesas_sdhi_sys_dmac_start_dma(struct tmio_mmc_host *host,
-			       struct mmc_data *data)
+					    struct mmc_data *data)
 {
 	if (data->flags & MMC_DATA_READ) {
 		if (host->chan_rx)
@@ -334,7 +334,7 @@ static void renesas_sdhi_sys_dmac_request_dma(struct tmio_mmc_host *host,
 {
 	/* We can only either use DMA for both Tx and Rx or not use it at all */
 	if (!host->dma || (!host->pdev->dev.of_node &&
-		(!pdata->chan_priv_tx || !pdata->chan_priv_rx)))
+			   (!pdata->chan_priv_tx || !pdata->chan_priv_rx)))
 		return;
 
 	if (!host->chan_tx && !host->chan_rx) {
@@ -360,7 +360,8 @@ static void renesas_sdhi_sys_dmac_request_dma(struct tmio_mmc_host *host,
 			return;
 
 		cfg.direction = DMA_MEM_TO_DEV;
-		cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->bus_shift);
+		cfg.dst_addr = res->start +
+			(CTL_SD_DATA_PORT << host->bus_shift);
 		cfg.dst_addr_width = host->dma->dma_buswidth;
 		if (!cfg.dst_addr_width)
 			cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
@@ -416,11 +417,13 @@ static void renesas_sdhi_sys_dmac_release_dma(struct tmio_mmc_host *host)
 {
 	if (host->chan_tx) {
 		struct dma_chan *chan = host->chan_tx;
+
 		host->chan_tx = NULL;
 		dma_release_channel(chan);
 	}
 	if (host->chan_rx) {
 		struct dma_chan *chan = host->chan_rx;
+
 		host->chan_rx = NULL;
 		dma_release_channel(chan);
 	}
@@ -445,10 +448,10 @@ static int renesas_sdhi_sys_dmac_probe(struct platform_device *pdev)
 
 static const struct dev_pm_ops renesas_sdhi_sys_dmac_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-			pm_runtime_force_resume)
+				pm_runtime_force_resume)
 	SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
-			tmio_mmc_host_runtime_resume,
-			NULL)
+			   tmio_mmc_host_runtime_resume,
+			   NULL)
 };
 
 static struct platform_driver renesas_sys_dmac_sdhi_driver = {
Signature · 1 line
2.7.4
author
#17 lore raw

PATCH 6/17 mmc: tmio, renesas-sdhi: add max_{segs, blk_count} to tmio_mmc_data

In reply to Biju Das

From: Yoshihiro Shimoda <[email protected]>

commit 603aa14d3daaa7073bab4c472025c4963030e0cc upstream.

Allow TMIO and SDHI driver implementations to provide values for max_segs and max_blk_count.

A follow-up patch will set these values for Renesas Gen3 SoCs the using an SDHI driver.

---
 drivers/mmc/host/renesas_sdhi.h      | 2 ++
 drivers/mmc/host/renesas_sdhi_core.c | 2 ++
 drivers/mmc/host/tmio_mmc_core.c     | 6 +++---
 include/linux/mfd/tmio.h             | 2 ++
 4 files changed, 9 insertions(+), 3 deletions(-)
drivers/mmc/host/renesas_sdhi.h +2 -0
index 781fe4c..6e33266 100644
@@ -31,6 +31,8 @@ struct renesas_sdhi_of_data {
 	int scc_offset;
 	struct renesas_sdhi_scc *taps;
 	int taps_num;
+	unsigned int max_blk_count;
+	unsigned short max_segs;
 };
 
 int renesas_sdhi_probe(struct platform_device *pdev,
drivers/mmc/host/renesas_sdhi_core.c +2 -0
index a64a3ba..2f8c7b8 100644
@@ -502,6 +502,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 		mmc_data->capabilities |= of_data->capabilities;
 		mmc_data->capabilities2 |= of_data->capabilities2;
 		mmc_data->dma_rx_offset = of_data->dma_rx_offset;
+		mmc_data->max_blk_count = of_data->max_blk_count;
+		mmc_data->max_segs = of_data->max_segs;
 		dma_priv->dma_buswidth = of_data->dma_buswidth;
 		host->bus_shift = of_data->bus_shift;
 	}
drivers/mmc/host/tmio_mmc_core.c +3 -3
index 0132a52..f93a773 100644
@@ -1222,10 +1222,10 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
 
 	mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities;
 	mmc->caps2 |= pdata->capabilities2;
-	mmc->max_segs = 32;
+	mmc->max_segs = pdata->max_segs ? : 32;
 	mmc->max_blk_size = 512;
-	mmc->max_blk_count = (PAGE_CACHE_SIZE / mmc->max_blk_size) *
-		mmc->max_segs;
+	mmc->max_blk_count = pdata->max_blk_count ? :
+		(PAGE_SIZE / mmc->max_blk_size) * mmc->max_segs;
 	mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
 	mmc->max_seg_size = mmc->max_req_size;
 
include/linux/mfd/tmio.h +2 -0
index a1520d8..662fedc 100644
@@ -128,6 +128,8 @@ struct tmio_mmc_data {
 	unsigned int			cd_gpio;
 	int				alignment_shift;
 	dma_addr_t			dma_rx_offset;
+	unsigned int			max_blk_count;
+	unsigned short			max_segs;
 	void (*set_pwr)(struct platform_device *host, int state);
 	void (*set_clk_div)(struct platform_device *host, int state);
 };
Signature · 1 line
2.7.4
author
#18 lore raw

PATCH 7/17 mmc: tmio, renesas-sdhi: add dataend to DMA ops

In reply to Biju Das

From: Simon Horman <[email protected]>

commit 92d0f925e6344a24b12a6eeb4f1030ec0e70e8d1 upstream.

Add dataend to DMA ops to allow DMAC implementation dependent handling of DMA data end.

Also implement the operation for SDHI.

---
 drivers/mmc/host/renesas_sdhi_sys_dmac.c |  6 ++++++
 drivers/mmc/host/tmio_mmc.h              |  1 +
 drivers/mmc/host/tmio_mmc_core.c         | 10 ++++++++--
 3 files changed, 15 insertions(+), 2 deletions(-)
drivers/mmc/host/renesas_sdhi_sys_dmac.c +6 -0
index d7757dd..86a81fd 100644
@@ -114,6 +114,11 @@ static void renesas_sdhi_sys_dmac_abort_dma(struct tmio_mmc_host *host)
 	renesas_sdhi_sys_dmac_enable_dma(host, true);
 }
 
+static void renesas_sdhi_sys_dmac_dataend_dma(struct tmio_mmc_host *host)
+{
+	complete(&host->dma_dataend);
+}
+
 static void renesas_sdhi_sys_dmac_dma_callback(void *arg)
 {
 	struct tmio_mmc_host *host = arg;
@@ -439,6 +444,7 @@ static const struct tmio_mmc_dma_ops renesas_sdhi_sys_dmac_dma_ops = {
 	.request = renesas_sdhi_sys_dmac_request_dma,
 	.release = renesas_sdhi_sys_dmac_release_dma,
 	.abort = renesas_sdhi_sys_dmac_abort_dma,
+	.dataend = renesas_sdhi_sys_dmac_dataend_dma,
 };
 
 static int renesas_sdhi_sys_dmac_probe(struct platform_device *pdev)
drivers/mmc/host/tmio_mmc.h +1 -0
index cd5b4f3..17ea4b6 100644
@@ -120,6 +120,7 @@ struct tmio_mmc_dma_ops {
 			struct tmio_mmc_data *pdata);
 	void (*release)(struct tmio_mmc_host *host);
 	void (*abort)(struct tmio_mmc_host *host);
+	void (*dataend)(struct tmio_mmc_host *host);
 };
 
 struct tmio_mmc_host {
drivers/mmc/host/tmio_mmc_core.c +8 -2
index f93a773..ed49a76 100644
@@ -86,6 +86,12 @@ static inline void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
 		host->dma_ops->abort(host);
 }
 
+static inline void tmio_mmc_dataend_dma(struct tmio_mmc_host *host)
+{
+	if (host->dma_ops)
+		host->dma_ops->dataend(host);
+}
+
 void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i)
 {
 	host->sdcard_irq_mask &= ~(i & TMIO_MASK_IRQ);
@@ -636,11 +642,11 @@ static void tmio_mmc_data_irq(struct tmio_mmc_host *host, unsigned int stat)
 
 		if (done) {
 			tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_DATAEND);
-			complete(&host->dma_dataend);
+			tmio_mmc_dataend_dma(host);
 		}
 	} else if (host->chan_rx && (data->flags & MMC_DATA_READ) && !host->force_pio) {
 		tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_DATAEND);
-		complete(&host->dma_dataend);
+		tmio_mmc_dataend_dma(host);
 	} else {
 		tmio_mmc_do_data_irq(host);
 		tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_READOP | TMIO_MASK_WRITEOP);
Signature · 1 line
2.7.4
author
#19 lore raw

PATCH 8/17 mmc: renesas-sdhi: add support for R-Car Gen3 SDHI DMAC

In reply to Biju Das

From: Simon Horman <[email protected]>

commit 2a68ea7896e3277d875c5d5e7f34cf2937cb55c3 upstream.

Add a new variant of the SDHI driver to support R-Car Gen3 with DMA via on-chip bus mastering. Since the DMAC is in a part of the SDHI module it is not suitable to be used via DMA Engine.

Clearing of DM_CM_INFO1 after DMA thanks to Dirk Behme

---
 drivers/mmc/host/Kconfig                      |  19 ++
 drivers/mmc/host/Makefile                     |   8 +-
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 272 ++++++++++++++++++++++++++
 drivers/mmc/host/renesas_sdhi_sys_dmac.c      |   2 +-
 drivers/mmc/host/tmio_mmc.h                   |   1 +
 5 files changed, 300 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mmc/host/renesas_sdhi_internal_dmac.c
drivers/mmc/host/Kconfig +19 -0
index eaf40ec..54d98ee 100644
@@ -563,10 +563,29 @@ config MMC_SDHI
 	depends on SUPERH || ARM
 	depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST
 	select MMC_TMIO_CORE
+	select MMC_SDHI_SYS_DMAC if (SUPERH || ARM)
+	select MMC_SDHI_INTERNAL_DMAC if ARM64
 	help
 	  This provides support for the SDHI SD/SDIO controller found in
 	  Renesas SuperH, ARM and ARM64 based SoCs
 
+config MMC_SDHI_SYS_DMAC
+	tristate "DMA for SDHI SD/SDIO controllers using SYS-DMAC"
+	depends on MMC_SDHI
+	help
+	  This provides DMA support for SDHI SD/SDIO controllers
+	  using SYS-DMAC via DMA Engine. This supports the controllers
+	  found in SuperH and Renesas ARM based SoCs.
+
+config MMC_SDHI_INTERNAL_DMAC
+	tristate "DMA for SDHI SD/SDIO controllers using on-chip bus mastering"
+	depends on ARM64 || COMPILE_TEST
+	depends on MMC_SDHI
+	help
+	  This provides DMA support for SDHI SD/SDIO controllers
+	  using on-chip bus mastering. This supports the controllers
+	  found in arm64 based SoCs.
+
 config MMC_CB710
 	tristate "ENE CB710 MMC/SD Interface support"
 	depends on PCI
drivers/mmc/host/Makefile +7 -1
index c3c85c9..f10bb0c 100644
@@ -36,7 +36,13 @@ obj-$(CONFIG_MMC_S3C)   	+= s3cmci.o
 obj-$(CONFIG_MMC_SDRICOH_CS)	+= sdricoh_cs.o
 obj-$(CONFIG_MMC_TMIO)		+= tmio_mmc.o
 obj-$(CONFIG_MMC_TMIO_CORE)	+= tmio_mmc_core.o
-obj-$(CONFIG_MMC_SDHI)		+= renesas_sdhi_core.o renesas_sdhi_sys_dmac.o
+obj-$(CONFIG_MMC_SDHI)		+= renesas_sdhi_core.o
+ifeq ($(subst m,y,$(CONFIG_MMC_SDHI_SYS_DMAC)),y)
+obj-$(CONFIG_MMC_SDHI)		+= renesas_sdhi_sys_dmac.o
+endif
+ifeq ($(subst m,y,$(CONFIG_MMC_SDHI_INTERNAL_DMAC)),y)
+obj-$(CONFIG_MMC_SDHI)		+= renesas_sdhi_internal_dmac.o
+endif
 obj-$(CONFIG_MMC_CB710)		+= cb710-mmc.o
 obj-$(CONFIG_MMC_VIA_SDMMC)	+= via-sdmmc.o
 obj-$(CONFIG_SDH_BFIN)		+= bfin_sdh.o
drivers/mmc/host/renesas_sdhi_internal_dmac.c new file +272 -0

272 lines not on this page · raw message

drivers/mmc/host/renesas_sdhi_sys_dmac.c +1 -1
index 86a81fd..84bb945 100644
@@ -1,5 +1,5 @@
 /*
- * DMA function for TMIO MMC implementations
+ * DMA support use of SYS DMAC with SDHI SD/SDIO controller
  *
  * Copyright (C) 2010-2011 Guennadi Liakhovetski
  *
drivers/mmc/host/tmio_mmc.h +1 -0
index 17ea4b6..16a3064 100644
@@ -150,6 +150,7 @@ struct tmio_mmc_host {
 	struct dma_chan		*chan_rx;
 	struct dma_chan		*chan_tx;
 	struct completion	dma_dataend;
+	struct tasklet_struct	dma_complete;
 	struct tasklet_struct	dma_issue;
 	struct scatterlist	bounce_sg;
 	u8			*bounce_buf;
Signature · 1 line
2.7.4
author
#20 lore raw

PATCH 9/17 mmc: renesas_sdhi: consolidate DMAC CONFIG options

In reply to Biju Das

From: Masahiro Yamada <[email protected]>

commit c813e10a6bbad9ef56bc115c64d48c5a7d0a7dd5 upstream.

The description in the Makefile is odd. Fix the CONFIG selection in a cleaner way.

---
 drivers/mmc/host/Kconfig  | 4 ++--
 drivers/mmc/host/Makefile | 8 ++------
 2 files changed, 4 insertions(+), 8 deletions(-)
drivers/mmc/host/Kconfig +2 -2
index 54d98ee..7b947ce 100644
@@ -563,8 +563,6 @@ config MMC_SDHI
 	depends on SUPERH || ARM
 	depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST
 	select MMC_TMIO_CORE
-	select MMC_SDHI_SYS_DMAC if (SUPERH || ARM)
-	select MMC_SDHI_INTERNAL_DMAC if ARM64
 	help
 	  This provides support for the SDHI SD/SDIO controller found in
 	  Renesas SuperH, ARM and ARM64 based SoCs
@@ -572,6 +570,7 @@ config MMC_SDHI
 config MMC_SDHI_SYS_DMAC
 	tristate "DMA for SDHI SD/SDIO controllers using SYS-DMAC"
 	depends on MMC_SDHI
+	default MMC_SDHI if (SUPERH || ARM)
 	help
 	  This provides DMA support for SDHI SD/SDIO controllers
 	  using SYS-DMAC via DMA Engine. This supports the controllers
@@ -581,6 +580,7 @@ config MMC_SDHI_INTERNAL_DMAC
 	tristate "DMA for SDHI SD/SDIO controllers using on-chip bus mastering"
 	depends on ARM64 || COMPILE_TEST
 	depends on MMC_SDHI
+	default MMC_SDHI if ARM64
 	help
 	  This provides DMA support for SDHI SD/SDIO controllers
 	  using on-chip bus mastering. This supports the controllers
drivers/mmc/host/Makefile +2 -6
index f10bb0c..5de0c72 100644
@@ -37,12 +37,8 @@ obj-$(CONFIG_MMC_SDRICOH_CS)	+= sdricoh_cs.o
 obj-$(CONFIG_MMC_TMIO)		+= tmio_mmc.o
 obj-$(CONFIG_MMC_TMIO_CORE)	+= tmio_mmc_core.o
 obj-$(CONFIG_MMC_SDHI)		+= renesas_sdhi_core.o
-ifeq ($(subst m,y,$(CONFIG_MMC_SDHI_SYS_DMAC)),y)
-obj-$(CONFIG_MMC_SDHI)		+= renesas_sdhi_sys_dmac.o
-endif
-ifeq ($(subst m,y,$(CONFIG_MMC_SDHI_INTERNAL_DMAC)),y)
-obj-$(CONFIG_MMC_SDHI)		+= renesas_sdhi_internal_dmac.o
-endif
+obj-$(CONFIG_MMC_SDHI_SYS_DMAC)		+= renesas_sdhi_sys_dmac.o
+obj-$(CONFIG_MMC_SDHI_INTERNAL_DMAC)	+= renesas_sdhi_internal_dmac.o
 obj-$(CONFIG_MMC_CB710)		+= cb710-mmc.o
 obj-$(CONFIG_MMC_VIA_SDMMC)	+= via-sdmmc.o
 obj-$(CONFIG_SDH_BFIN)		+= bfin_sdh.o
Signature · 1 line
2.7.4
author
#21 lore raw

PATCH 10/17 dt-bindings: mmc: renesas_sdhi: add R-Car Gen[123] fallback compatibility strings

In reply to Biju Das

From: Simon Horman <[email protected]>

commit 54839d012d5f98cde2fa102fdcd22e1da661d138 upstream.

Add fallback compatibility strings for R-Car Gen 1, 2 and 3.

In the case of Renesas R-Car hardware we know that there are generations of SoCs, f.e. Gen 1 and 2. But beyond that its not clear what the relationship between IP blocks might be. For example, I believe that r8a7790 is older than r8a7791 but that doesn't imply that the latter is a descendant of the former or vice versa.

We can, however, by examining the documentation and behaviour of the hardware at run-time observe that the current driver implementation appears to be compatible with the IP blocks on SoCs within a given generation.

For the above reasons and convenience when enabling new SoCs a per-generation fallback compatibility string scheme is being adopted for drivers for Renesas SoCs.

---
 Documentation/devicetree/bindings/mmc/tmio_mmc.txt | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/mmc/tmio_mmc.txt +7 -0
index 1d23a43..25f06e6 100644
@@ -24,6 +24,13 @@ Required properties:
 		"renesas,sdhi-r8a7792" - SDHI IP on R8A7792 SoC
 		"renesas,sdhi-r8a7793" - SDHI IP on R8A7793 SoC
 		"renesas,sdhi-r8a7794" - SDHI IP on R8A7794 SoC
+		"renesas,rcar-gen1-sdhi" - a generic R-Car Gen1 SDHI controller
+		"renesas,rcar-gen2-sdhi" - a generic R-Car Gen2 or RZ/G1
+					   SDHI controller
+
+		When compatible with the generic version, nodes must list
+		the SoC-specific version corresponding to the platform
+		first followed by the generic version.
 
 Optional properties:
 - toshiba,mmc-wrprotect-disable: write-protect detection is unavailable
Signature · 1 line
2.7.4
author
#22 lore raw

PATCH 11/17 mmc: renesas_sdhi: implement R-Car Gen[123] fallback compatibility strings

In reply to Biju Das

From: Simon Horman <[email protected]>

commit d6dc425ae595e14026beac3720e43edd70215dc8 upstream.

Implement fallback compatibility strings for R-Car Gen 1, 2 and 3.

In the case of Renesas R-Car hardware we know that there are generations of SoCs, f.e. Gen 1 and 2. But beyond that its not clear what the relationship between IP blocks might be. For example, I believe that r8a7790 is older than r8a7791 but that doesn't imply that the latter is a descendant of the former or vice versa.

We can, however, by examining the documentation and behaviour of the hardware at run-time observe that the current driver implementation appears to be compatible with the IP blocks on SoCs within a given generation.

For the above reasons and convenience when enabling new SoCs a per-generation fallback compatibility string scheme is being adopted for drivers for Renesas SoCs.

Also, improve readability by listing the shmobile fallback compatibility string after the more-specific compatibility strings they provide a fallback for.

---
 drivers/mmc/host/renesas_sdhi_sys_dmac.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/renesas_sdhi_sys_dmac.c +3 -1
index 84bb945..77f3af4 100644
@@ -75,7 +75,6 @@ static const struct renesas_sdhi_of_data of_rcar_gen3_compatible = {
 };
 
 static const struct of_device_id renesas_sdhi_sys_dmac_of_match[] = {
-	{ .compatible = "renesas,sdhi-shmobile" },
 	{ .compatible = "renesas,sdhi-sh73a0", .data = &of_default_cfg, },
 	{ .compatible = "renesas,sdhi-r8a73a4", .data = &of_default_cfg, },
 	{ .compatible = "renesas,sdhi-r8a7740", .data = &of_default_cfg, },
@@ -88,6 +87,9 @@ static const struct of_device_id renesas_sdhi_sys_dmac_of_match[] = {
 	{ .compatible = "renesas,sdhi-r8a7792", .data = &of_rcar_gen2_compatible, },
 	{ .compatible = "renesas,sdhi-r8a7793", .data = &of_rcar_gen2_compatible, },
 	{ .compatible = "renesas,sdhi-r8a7794", .data = &of_rcar_gen2_compatible, },
+	{ .compatible = "renesas,rcar-gen1-sdhi", .data = &of_rcar_gen1_compatible, },
+	{ .compatible = "renesas,rcar-gen2-sdhi", .data = &of_rcar_gen2_compatible, },
+	{ .compatible = "renesas,sdhi-shmobile" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, renesas_sdhi_sys_dmac_of_match);
Signature · 1 line
2.7.4
author
#23 lore raw

PATCH 12/17 dt-bindings: mmc: renesas_sdhi: Add r8a77470 support

In reply to Biju Das

From: Fabrizio Castro <[email protected]>

commit be6f8db406a49511a8d213f9443ae79fe5b086c3 upstream.

The RZ/G1C (a.k.a. R8A77470) comes with three SDHI interfaces, SDHI0 and SDHI2 are compatible with R-Car Gen2 SDHIs, and SDHI1 is compatible with R-Car Gen3 SDHIs, as it comes with an internal DMAC, therefore SDHI1 is fully compatible with driver renesas_sdhi_internal_dmac driver. As a result, the compatible strings for the R8A77470 SDHI interfaces are a little bit special. Document SDHI support for the RZ/G1C SoC.

---
 Documentation/devicetree/bindings/mmc/tmio_mmc.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/mmc/tmio_mmc.txt +4 -2
index 25f06e6..cbce1e6 100644
@@ -17,6 +17,8 @@ Required properties:
 		"renesas,sdhi-r8a7740" - SDHI IP on R8A7740 SoC
 		"renesas,sdhi-r8a7743" - SDHI IP on R8A7743 SoC
 		"renesas,sdhi-r8a7745" - SDHI IP on R8A7745 SoC
+		"renesas,sdhi-r8a77470" - SDHI IP on R8A77470 SoC
+		"renesas,sdhi-mmc-r8a77470" - SDHI/MMC IP on R8A77470 SoC
 		"renesas,sdhi-r8a7778" - SDHI IP on R8A7778 SoC
 		"renesas,sdhi-r8a7779" - SDHI IP on R8A7779 SoC
 		"renesas,sdhi-r8a7790" - SDHI IP on R8A7790 SoC
@@ -25,8 +27,8 @@ Required properties:
 		"renesas,sdhi-r8a7793" - SDHI IP on R8A7793 SoC
 		"renesas,sdhi-r8a7794" - SDHI IP on R8A7794 SoC
 		"renesas,rcar-gen1-sdhi" - a generic R-Car Gen1 SDHI controller
-		"renesas,rcar-gen2-sdhi" - a generic R-Car Gen2 or RZ/G1
-					   SDHI controller
+		"renesas,rcar-gen2-sdhi" - a generic R-Car Gen2 and RZ/G1 SDHI
+					   (not SDHI/MMC) controller
 
 		When compatible with the generic version, nodes must list
 		the SoC-specific version corresponding to the platform
Signature · 1 line
2.7.4
author
#24 lore raw

PATCH 13/17 mmc: renesas_sdhi: Add r8a77470 SDHI1 support

In reply to Biju Das

From: Fabrizio Castro <[email protected]>

commit 60ab43ba6b6e0f888aab3ce0f84a8aaf15d15079 upstream.

The RZ/G1C (a.k.a. R8A77470) comes with three SDHI interfaces, SDHI0 and SDHI2 are compatible with the R-Car Gen2 SDHIs, SDHI1 is compatible with R-Car Gen3 SDHIs and it can be used as eMMC as well. This patch adds driver compatibility, and makes sure both drivers get compiled for the R8A77470.

[biju: Removed reset and updated clk and power domain properties]
---
 drivers/mmc/host/Kconfig                      | 4 ++--
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/Kconfig +2 -2
index 7b947ce..359ec493 100644
@@ -578,9 +578,9 @@ config MMC_SDHI_SYS_DMAC
 
 config MMC_SDHI_INTERNAL_DMAC
 	tristate "DMA for SDHI SD/SDIO controllers using on-chip bus mastering"
-	depends on ARM64 || COMPILE_TEST
+	depends on ARM64 || ARCH_R8A77470 || COMPILE_TEST
 	depends on MMC_SDHI
-	default MMC_SDHI if ARM64
+	default MMC_SDHI if (ARM64 || ARCH_R8A77470)
 	help
 	  This provides DMA support for SDHI SD/SDIO controllers
 	  using on-chip bus mastering. This supports the controllers
drivers/mmc/host/renesas_sdhi_internal_dmac.c +1 -0
index d41ff35..8056325 100644
@@ -84,6 +84,7 @@ static const struct renesas_sdhi_of_data of_rcar_gen3_compatible = {
 };
 
 static const struct of_device_id renesas_sdhi_internal_dmac_of_match[] = {
+	{ .compatible = "renesas,sdhi-mmc-r8a77470", .data = &of_rcar_gen3_compatible, },
 	{},
 };
 MODULE_DEVICE_TABLE(of, renesas_sdhi_internal_dmac_of_match);
Signature · 1 line
2.7.4
author
#25 lore raw

PATCH 14/17 ARM: dts: r8a77470: Add SDHI2 support

In reply to Biju Das

From: Fabrizio Castro <[email protected]>

commit f068cc816015f8a6af494b584978aa7df96d80fe upstream.

Add SoC specific device tree definitions for the SDHI2 interface.

[biju: Removed reset and updated clk and power domain properties]
---
 arch/arm/boot/dts/r8a77470.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm/boot/dts/r8a77470.dtsi +14 -0
index 9774ab0..603a57c 100644
@@ -664,6 +664,20 @@
 			status = "disabled";
 		};
 
+		sdhi2: sd at ee160000 {
+			compatible = "renesas,sdhi-r8a77470",
+				     "renesas,rcar-gen2-sdhi";
+			reg = <0 0xee160000 0 0x328>;
+			interrupts = <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&mstp3_clks R8A77470_CLK_SDHI2>;
+			dmas = <&dmac0 0xd3>, <&dmac0 0xd4>,
+			       <&dmac1 0xd3>, <&dmac1 0xd4>;
+			dma-names = "tx", "rx", "tx", "rx";
+			max-frequency = <97500000>;
+			power-domains = <&cpg_clocks>;
+			status = "disabled";
+		};
+
 		gic: interrupt-controller at f1001000 {
 			compatible = "arm,gic-400";
 			#interrupt-cells = <3>;
Signature · 1 line
2.7.4
author
#26 lore raw

PATCH 15/17 ARM: dts: r8a77470: Add SDHI0 support

In reply to Biju Das

From: Fabrizio Castro <[email protected]>

commit 15aa5a95e820e8183aa34535131e7c97789b8504 upstream.

RZ/G1C comes with two different types of IP for the SDHI interfaces, SDHI0 and SDHI2 share the same IP type, and such an IP is also compatible with the one found in R-Car Gen2. SDHI1 IP on the other hand is compatible with R-Car Gen3 with internal DMA.
This patch completes the SDHI support of the R-Car Gen2 compatible IPs, including fixing the max-frequency definition of SDHI2, as it turns out there is a bug in Section 1.3.9 of the RZ/G1C Hardware User's Manual (Rev. 1.00 Oct. 2017).

[biju: Removed reset and updated clk and power domain properties]
---
 arch/arm/boot/dts/r8a77470.dtsi | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
arch/arm/boot/dts/r8a77470.dtsi +15 -1
index 603a57c..ca184f4 100644
@@ -664,6 +664,20 @@
 			status = "disabled";
 		};
 
+		sdhi0: sd at ee100000 {
+			compatible = "renesas,sdhi-r8a77470",
+				     "renesas,rcar-gen2-sdhi";
+			reg = <0 0xee100000 0 0x328>;
+			interrupts = <GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&mstp3_clks R8A77470_CLK_SDHI0>;
+			dmas = <&dmac0 0xcd>, <&dmac0 0xce>,
+			       <&dmac1 0xcd>, <&dmac1 0xce>;
+			dma-names = "tx", "rx", "tx", "rx";
+			max-frequency = <156000000>;
+			power-domains = <&cpg_clocks>;
+			status = "disabled";
+		};
+
 		sdhi2: sd at ee160000 {
 			compatible = "renesas,sdhi-r8a77470",
 				     "renesas,rcar-gen2-sdhi";
@@ -673,7 +687,7 @@
 			dmas = <&dmac0 0xd3>, <&dmac0 0xd4>,
 			       <&dmac1 0xd3>, <&dmac1 0xd4>;
 			dma-names = "tx", "rx", "tx", "rx";
-			max-frequency = <97500000>;
+			max-frequency = <78000000>;
 			power-domains = <&cpg_clocks>;
 			status = "disabled";
 		};
Signature · 1 line
2.7.4
author
#27 lore raw

PATCH 16/17 ARM: dts: r8a77470: Add SDHI1 support

In reply to Biju Das

From: Fabrizio Castro <[email protected]>

commit 0485da788028ecd525291974c8efe2d072607476 upstream.

Althought interface SDHI1 found on the RZ/G1C SoC (a.k.a. r8a77470) is compatible with the R-Car Gen3 ones, its OF compatibility is restricted to the SoC specific compatible string to avoid confusion, as from a more generic perspective the RZ/G1C is sharing the most similarities with the R-Car Gen2 family of SoCs, and there is a combination of R-Car Gen2 compatible SDHI IPs and R-Car Gen3 compatible SDHI IP on this specific chip.
This patch adds the SoC specific part of SDHI1 support, and since SDHI1 comes with internal DMA, its DT node looks fairly different from SDHI0 and SDHI2.

[biju: Removed reset and updated clk and power domain properties]
---
 arch/arm/boot/dts/r8a77470.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/r8a77470.dtsi +10 -0
index ca184f4..dc34575 100644
@@ -678,6 +678,16 @@
 			status = "disabled";
 		};
 
+		sdhi1: sd at ee300000 {
+			compatible = "renesas,sdhi-mmc-r8a77470";
+			reg = <0 0xee300000 0 0x2000>;
+			interrupts = <GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&mstp3_clks R8A77470_CLK_SDHI1>;
+			max-frequency = <156000000>;
+			power-domains = <&cpg_clocks>;
+			status = "disabled";
+		};
+
 		sdhi2: sd at ee160000 {
 			compatible = "renesas,sdhi-r8a77470",
 				     "renesas,rcar-gen2-sdhi";
Signature · 1 line
2.7.4
author
#28 lore raw

PATCH 17/17 ARM: dts: iwg23s-sbc: Add uSD and eMMC support

In reply to Biju Das

From: Fabrizio Castro <[email protected]>

commit 9eb36b945b5c21d57c02a26cc629dd9484ced9aa upstream.

Add uSD card and eMMC support to the iwg23s single board computer powered by the RZ/G1C SoC (a.k.a. r8a77470).

---
 arch/arm/boot/dts/r8a77470-iwg23s-sbc.dts | 75 +++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)
arch/arm/boot/dts/r8a77470-iwg23s-sbc.dts +75 -0
index 8c9c312d..3490f6f 100644
@@ -6,6 +6,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include "r8a77470.dtsi"
 / {
 	model = "iWave iW-RainboW-G23S single board computer based on RZ/G1C";
@@ -25,6 +26,37 @@
 		device_type = "memory";
 		reg = <0 0x40000000 0 0x20000000>;
 	};
+
+	reg_1p8v: reg-1p8v {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-1.8V";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	reg_3p3v: reg-3p3v {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	vccq_sdhi2: regulator-vccq-sdhi2 {
+		compatible = "regulator-gpio";
+
+		regulator-name = "SDHI2 VccQ";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <3300000>;
+
+		gpios = <&gpio2 24 GPIO_ACTIVE_HIGH>;
+		gpios-states = <1>;
+		states = <3300000 1
+			  1800000 0>;
+	};
 };
 
 &avb {
@@ -88,6 +120,12 @@
 		function = "i2c3";
 	};
 
+	mmc_pins_uhs: mmc_uhs {
+		groups = "mmc_data8", "mmc_ctrl";
+		function = "mmc";
+		power-source = <1800>;
+	};
+
 	qspi0_pins: qspi0 {
 		groups = "qspi0_ctrl", "qspi0_data2";
 		function = "qspi0";
@@ -98,6 +136,18 @@
 		function = "scif1";
 	};
 
+	sdhi2_pins: sd2 {
+		groups = "sdhi2_data4", "sdhi2_ctrl";
+		function = "sdhi2";
+		power-source = <3300>;
+	};
+
+	sdhi2_pins_uhs: sd2_uhs {
+		groups = "sdhi2_data4", "sdhi2_ctrl";
+		function = "sdhi2";
+		power-source = <1800>;
+	};
+
 	usb0_pins: usb0 {
 		groups = "usb0";
 		function = "usb0";
@@ -142,6 +192,31 @@
 	status = "okay";
 };
 
+&sdhi1 {
+	pinctrl-0 = <&mmc_pins_uhs>;
+	pinctrl-names = "state_uhs";
+
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&reg_1p8v>;
+	bus-width = <8>;
+	mmc-hs200-1_8v;
+	non-removable;
+	fixed-emmc-driver-type = <1>;
+	status = "okay";
+};
+
+&sdhi2 {
+	pinctrl-0 = <&sdhi2_pins>;
+	pinctrl-1 = <&sdhi2_pins_uhs>;
+	pinctrl-names = "default", "state_uhs";
+
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&vccq_sdhi2>;
+	bus-width = <4>;
+	cd-gpios = <&gpio4 20 GPIO_ACTIVE_LOW>;
+	status = "okay";
+};
+
 &usb2_phy0 {
 	status = "okay";
 };
Signature · 1 line
2.7.4