Add RZ/G1C SD/eMMC support
Subsystems (4)
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
Shinobu Uehara (1):
mmc: sdhi: Add EXT_ACC register busy check
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
Wolfram Sang (4):
mmc: sh_mobile_sdhi: don't use array for DT configs
mmc: sh_mobile_sdhi: simplify code for voltage switching
mmc: sh_mobile_sdhi: enable SDIO IRQs for RCar Gen3
mmc: tmio: always unmap DMA before waiting for interrupt
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 ++++
.../host/{sh_mobile_sdhi.c => renesas_sdhi_core.c} | 271 ++++++--------------
drivers/mmc/host/renesas_sdhi_internal_dmac.c | 273 +++++++++++++++++++++
.../{tmio_mmc_dma.c => renesas_sdhi_sys_dmac.c} | 191 +++++++++++---
drivers/mmc/host/tmio_mmc.h | 11 +-
.../mmc/host/{tmio_mmc_pio.c => tmio_mmc_core.c} | 16 +-
include/linux/mfd/tmio.h | 2 +
12 files changed, 706 insertions(+), 247 deletions(-)
create mode 100644 drivers/mmc/host/renesas_sdhi.h
rename drivers/mmc/host/{sh_mobile_sdhi.c => renesas_sdhi_core.c} (65%)
create mode 100644 drivers/mmc/host/renesas_sdhi_internal_dmac.c
rename drivers/mmc/host/{tmio_mmc_dma.c => renesas_sdhi_sys_dmac.c} (55%)
rename drivers/mmc/host/{tmio_mmc_pio.c => tmio_mmc_core.c} (99%)Signature · 1 line
2.7.4
PATCH 1/22 mmc: sdhi: Add EXT_ACC register busy check
From: Shinobu Uehara <[email protected]>
commit ff741cfde98bd867eb4c9477bc9ba0df3507eed8 upstream.
All the docs I have access to say that this register needs the bus busy check.
--- drivers/mmc/host/sh_mobile_sdhi.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/sh_mobile_sdhi.c +1 -0
@@ -510,6 +510,7 @@ static int sh_mobile_sdhi_write16_hook(struct tmio_mmc_host *host, int addr)case CTL_SD_MEM_CARD_OPT :case CTL_TRANSACTION_CTL :case CTL_DMA_ENABLE : +case EXT_ACC :return sh_mobile_sdhi_wait_idle (host); }
Signature · 1 line
2.7.4
PATCH 2/22 mmc: sh_mobile_sdhi: don't use array for DT configs
In reply to Biju DasFrom: Wolfram Sang <[email protected]>
commit 13bbd8af65895c524c27850495fadf23449f9f3d upstream.
We won't access an index based array to get our DT config, but create separate structs instead. So, remove the array which only wastes memory.
--- drivers/mmc/host/sh_mobile_sdhi.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/mmc/host/sh_mobile_sdhi.c +5 -7
@@ -65,10 +65,8 @@ struct sh_mobile_sdhi_of_data {int taps_num; }; -static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = { - { - .tmio_flags =TMIO_MMC_HAS_IDLE_WAIT , - }, +static const struct sh_mobile_sdhi_of_data of_default_cfg = { + .tmio_flags =TMIO_MMC_HAS_IDLE_WAIT , };static const struct sh_mobile_sdhi_of_data of_rcar_gen1_compatible = {
@@ -121,9 +119,9 @@ static const struct sh_mobile_sdhi_of_data of_rcar_gen3_compatible = {static const struct of_device_id sh_mobile_sdhi_of_match[] = { { .compatible ="renesas,sdhi-shmobile" }, { .compatible ="renesas,sdhi-sh7372" }, - { .compatible ="renesas,sdhi-sh73a0" , .data = &sh_mobile_sdhi_of_cfg[0 ], }, - { .compatible ="renesas,sdhi-r8a73a4" , .data = &sh_mobile_sdhi_of_cfg[0 ], }, - { .compatible ="renesas,sdhi-r8a7740" , .data = &sh_mobile_sdhi_of_cfg[0 ], }, + { .compatible ="renesas,sdhi-sh73a0" , .data = &of_default_cfg, }, + { .compatible ="renesas,sdhi-r8a73a4" , .data = &of_default_cfg, }, + { .compatible ="renesas,sdhi-r8a7740" , .data = &of_default_cfg, }, { .compatible ="renesas,sdhi-r8a7778" , .data = &of_rcar_gen1_compatible, }, { .compatible ="renesas,sdhi-r8a7779" , .data = &of_rcar_gen1_compatible, }, { .compatible ="renesas,sdhi-r8a7743" , .data = &of_rcar_gen2_compatible, },
Signature · 1 line
2.7.4
PATCH 3/22 mmc: sh_mobile_sdhi: simplify code for voltage switching
In reply to Biju DasFrom: Wolfram Sang <[email protected]>
commit 2272c841ee301402ea7a01fc727619af1f97f0cc upstream.
A last minute fix applied by Ulf made room for some simplification.
--- drivers/mmc/host/sh_mobile_sdhi.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/mmc/host/sh_mobile_sdhi.c +1 -5
@@ -289,11 +289,7 @@ static int sh_mobile_sdhi_start_signal_voltage_switch(struct mmc_host *mmc,if (ret)return ret; - ret =pinctrl_select_state (priv->pinctrl, pin_state); -if (ret) -return ret; - -return 0 ; +return pinctrl_select_state (priv->pinctrl, pin_state); }/* SCC registers */
Signature · 1 line
2.7.4
PATCH 4/22 mmc: sh_mobile_sdhi: enable SDIO IRQs for RCar Gen3
In reply to Biju DasFrom: Wolfram Sang <[email protected]>
commit 685d29ef1783af0049c4aeeec43722e410d5845d upstream.
Tested on a Salvator-X board with a Spectec SDW-823 WLAN card.
--- drivers/mmc/host/sh_mobile_sdhi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sh_mobile_sdhi.c +1 -1
@@ -109,7 +109,7 @@ static struct sh_mobile_sdhi_scc rcar_gen3_scc_taps[] = {static const struct sh_mobile_sdhi_of_data of_rcar_gen3_compatible = { .tmio_flags =TMIO_MMC_HAS_IDLE_WAIT |TMIO_MMC_WRPROTECT_DISABLE |TMIO_MMC_CLK_ACTUAL |TMIO_MMC_MIN_RCAR2 , - .capabilities =MMC_CAP_SD_HIGHSPEED , + .capabilities =MMC_CAP_SD_HIGHSPEED |MMC_CAP_SDIO_IRQ , .bus_shift =2 , .scc_offset =0x1000 , .taps = rcar_gen3_scc_taps,
Signature · 1 line
2.7.4
PATCH 5/22 mmc: tmio: always unmap DMA before waiting for interrupt
In reply to Biju DasFrom: Wolfram Sang <[email protected]>
commit 5f07ef8f603ace496ca8c20eef446c5ae7a10474 upstream.
In the (maybe academical) case, we don't get a DATAEND interrupt after DMA completed, we will wait endlessly for the completion to complete. This is not bad per se, since we have a more generic completion tracking a timeout. In that rare case, however, the DMA buffer will not get unmapped and we have a leak. Reorder the code, so unmapping will always take place.
--- drivers/mmc/host/tmio_mmc_dma.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mmc/host/tmio_mmc_dma.c +5 -2
@@ -45,8 +45,6 @@ static void tmio_mmc_dma_callback(void *arg) {struct tmio_mmc_host *host = arg; -wait_for_completion (&host->dma_dataend); -spin_lock_irq (&host->lock);if (!host->data)
@@ -61,6 +59,11 @@ static void tmio_mmc_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 · 1 line
2.7.4
PATCH 6/22 mmc: tmio: rename tmio_mmc_{pio => core}.c
In reply to Biju DasFrom: 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_pio.c => tmio_mmc_core.c} | 0
2 files changed, 1 deletion(-)
rename drivers/mmc/host/{tmio_mmc_pio.c => tmio_mmc_core.c} (100%)drivers/mmc/host/Makefile +0 -1
@@ -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 renamed from drivers/mmc/host/tmio_mmc_pio.c +0 -0
Signature · 1 line
2.7.4
PATCH 7/22 mmc: renesas-sdhi: rename tmio_mmc_dma.c => renesas_sdhi_sys_dmac.c
In reply to Biju DasFrom: 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 +++++++
.../{tmio_mmc_dma.c => renesas_sdhi_sys_dmac.c} | 59 ++++++++++++----------
drivers/mmc/host/sh_mobile_sdhi.c | 3 +-
drivers/mmc/host/tmio_mmc.h | 9 ----
5 files changed, 52 insertions(+), 39 deletions(-)
create mode 100644 drivers/mmc/host/renesas_sdhi.h
rename drivers/mmc/host/{tmio_mmc_dma.c => renesas_sdhi_sys_dmac.c} (82%)drivers/mmc/host/Makefile +1 -1
@@ -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
@@ -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 renamed from drivers/mmc/host/tmio_mmc_dma.c +31 -28
158 lines not on this page · raw message
drivers/mmc/host/sh_mobile_sdhi.c +2 -1
@@ -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
@@ -638,7 +639,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
@@ -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 · 1 line
2.7.4
PATCH 8/22 mmc: renesas-sdhi: rename sh_mobile_sdhi.c => renesas_sdhi_core.c
In reply to Biju DasFrom: 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 +-
.../host/{sh_mobile_sdhi.c => renesas_sdhi_core.c} | 136 ++++++++++-----------
3 files changed, 70 insertions(+), 70 deletions(-)
rename drivers/mmc/host/{sh_mobile_sdhi.c => renesas_sdhi_core.c} (82%)drivers/mmc/host/Kconfig +1 -1
@@ -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
@@ -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 renamed from drivers/mmc/host/sh_mobile_sdhi.c +68 -68
383 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 9/22 mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file
In reply to Biju DasFrom: 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.
--- drivers/mmc/host/renesas_sdhi.h | 23 +++++- drivers/mmc/host/renesas_sdhi_core.c | 128 ++----------------------------- drivers/mmc/host/renesas_sdhi_sys_dmac.c | 102 +++++++++++++++++++++++- 3 files changed, 130 insertions(+), 123 deletions(-)
drivers/mmc/host/renesas_sdhi.h +22 -1
@@ -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 +100 -2
120 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 10/22 mmc: renesas-sdhi: improve checkpatch cleanness
In reply to Biju DasFrom: 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
@@ -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
@@ -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
PATCH 11/22 mmc: tmio, renesas-sdhi: add max_{segs, blk_count} to tmio_mmc_data
In reply to Biju DasFrom: 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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH 12/22 mmc: tmio, renesas-sdhi: add dataend to DMA ops
In reply to Biju DasFrom: 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
@@ -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
@@ -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
@@ -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
PATCH 13/22 mmc: renesas-sdhi: add support for R-Car Gen3 SDHI DMAC
In reply to Biju DasFrom: 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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH 14/22 mmc: renesas_sdhi: consolidate DMAC CONFIG options
In reply to Biju DasFrom: 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
@@ -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
@@ -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
PATCH 15/22 dt-bindings: mmc: renesas_sdhi: add R-Car Gen[123] fallback compatibility strings
In reply to Biju DasFrom: 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
@@ -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
PATCH 16/22 mmc: renesas_sdhi: implement R-Car Gen[123] fallback compatibility strings
In reply to Biju DasFrom: 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
@@ -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
PATCH 17/22 dt-bindings: mmc: renesas_sdhi: Add r8a77470 support
In reply to Biju DasFrom: 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
@@ -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
PATCH 18/22 mmc: renesas_sdhi: Add r8a77470 SDHI1 support
In reply to Biju DasFrom: 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.
--- 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
@@ -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
@@ -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
PATCH 19/22 ARM: dts: r8a77470: Add SDHI2 support
In reply to Biju DasFrom: Fabrizio Castro <[email protected]>
commit f068cc816015f8a6af494b584978aa7df96d80fe upstream.
Add SoC specific device tree definitions for the SDHI2 interface.
--- arch/arm/boot/dts/r8a77470.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm/boot/dts/r8a77470.dtsi +14 -0
@@ -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
PATCH 20/22 ARM: dts: r8a77470: Add SDHI0 support
In reply to Biju DasFrom: 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).
--- arch/arm/boot/dts/r8a77470.dtsi | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
arch/arm/boot/dts/r8a77470.dtsi +15 -1
@@ -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
PATCH 21/22 ARM: dts: r8a77470: Add SDHI1 support
In reply to Biju DasFrom: 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.
--- arch/arm/boot/dts/r8a77470.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/boot/dts/r8a77470.dtsi +10 -0
@@ -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
PATCH 22/22 ARM: dts: iwg23s-sbc: Add uSD and eMMC support
In reply to Biju DasFrom: 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
@@ -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 = <®_3p3v>; + vqmmc-supply = <®_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 = <®_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
cover Add RZ/G1C SD/eMMC support
In reply to Biju DasHi!
Quoted 6 lines
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.
Thanks for doing this, and extra thanks for using rename detection so diffs are easy to read :-).
Series looks good, but I got this while applying:
pavel at amd:~/cip/k$ ~/cip/git-am /tmp/delme.h
Applying: mmc: sdhi: Add EXT_ACC register busy check
Applying: mmc: sh_mobile_sdhi: don't use array for DT configs
Applying: mmc: sh_mobile_sdhi: simplify code for voltage switching
Applying: mmc: sh_mobile_sdhi: enable SDIO IRQs for RCar Gen3
Applying: mmc: tmio: always unmap DMA before waiting for interrupt
Applying: mmc: tmio: rename tmio_mmc_{pio => core}.c
Applying: mmc: renesas-sdhi: rename tmio_mmc_dma.c => renesas_sdhi_sys_dmac.c
Applying: mmc: renesas-sdhi: rename sh_mobile_sdhi.c => renesas_sdhi_core.c
Applying: mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file
error: patch failed: drivers/mmc/host/renesas_sdhi_core.c:48
error: drivers/mmc/host/renesas_sdhi_core.c: patch does not apply Patch failed at 0009 mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file
The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
Let me try to apply patches 1-8 and try to get them tested.
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/20191127/8caf9c0a/attachment.sig>
cover Add RZ/G1C SD/eMMC support
In reply to Biju DasHi!
Quoted 7 lines
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.
Ok, that was fun.
AFAICT, this clashed with "Add SDHI/eMMC/USB2.0 support" as I applied them in unexpected order. So #9 and #17 rejected. I fixed up #9 by hand, and simply dropped #17, as it is "just" documentation.
I believe I got it right, and tests seem to pass:
https://gitlab.com/cip-project/cip-kernel/linux-cip/pipelines/99052811
...so I pushed the result. Could you verify that it looks how you expected it, and resubmit patch #17 I dropped?
Thanks and 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/20191127/baf3da52/attachment.sig>
cover Add RZ/G1C SD/eMMC support
Hi Pavel,
Regarding patch #9,
Thanks for the feedback.
Please see the subject line on this patch " From: Simon Horman <[email protected]>"
It is supposed to be " mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file"
regards,
Biju
Quoted 32 lines
Subject: Re: [PATCH 4.4.y-cip 00/22] Add RZ/G1C SD/eMMC support
Hi!
Quoted 3 lines
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.
Quoted 2 lines
Support for internal DMAC is added in 4.14 kernel and support for RZ/G1C
added on 4.20 kernel.
Quoted 2 lines
Backported the relevent patches to linux-4.4.y-cip.
Ok, that was fun.
AFAICT, this clashed with "Add SDHI/eMMC/USB2.0 support" as I applied them in unexpected order. So #9 and #17 rejected. I fixed up #9 by hand, and simply dropped #17, as it is "just" documentation.
I believe I got it right, and tests seem to pass:
https://gitlab.com/cip-project/cip-kernel/linux-cip/pipelines/99052811
...so I pushed the result. Could you verify that it looks how you expected it, and resubmit patch #17 I dropped?
Thanks and best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
cover Add RZ/G1C SD/eMMC support
Hi!
Quoted 9 lines
Regarding patch #9,
Thanks for the feedback.
Please see the subject line on this patch " From: Simon Horman <[email protected]>"
It is supposed to be " mmc: renesas-sdhi: make
renesas_sdhi_sys_dmacmain module file"
Ah, thank you. I fixed the subject and force-pushed.
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/20191128/1e2c0f2b/attachment.sig>