From 8b090e008ef2c4cb9a97c20426f1ac03f9f15555 Mon Sep 17 00:00:00 2001 From: Khang Nguyen Date: Mon, 18 Jun 2018 11:06:36 +0700 Subject: rcar-gen3: linux-renesas: WORKAROUND for mini SD card issue on M3ULCB This commit adds a WORKAROUND patch for the issue that mini SD partition information cannot be read correctly. Signed-off-by: Khang Nguyen Signed-off-by: Takamitsu Honda --- ...renesas_sdhi_internal_dmac-limit-DMA-RX-f.patch | 112 +++++++++++++++++++++ .../linux-libc-headers/linux-libc-headers_4.14.bb | 5 + ...renesas_sdhi_internal_dmac-limit-DMA-RX-f.patch | 112 +++++++++++++++++++++ .../recipes-kernel/linux/linux-renesas_4.14.bb | 5 + 4 files changed, 234 insertions(+) create mode 100644 meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-Revert-mmc-renesas_sdhi_internal_dmac-limit-DMA-RX-f.patch create mode 100644 meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-Revert-mmc-renesas_sdhi_internal_dmac-limit-DMA-RX-f.patch (limited to 'meta-rcar-gen3') diff --git a/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-Revert-mmc-renesas_sdhi_internal_dmac-limit-DMA-RX-f.patch b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-Revert-mmc-renesas_sdhi_internal_dmac-limit-DMA-RX-f.patch new file mode 100644 index 0000000..1d7fa7a --- /dev/null +++ b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-Revert-mmc-renesas_sdhi_internal_dmac-limit-DMA-RX-f.patch @@ -0,0 +1,112 @@ +From 001e18801fa28bbcd02c86707bc56d87ebabca60 Mon Sep 17 00:00:00 2001 +From: Masaharu Hayakawa +Date: Fri, 15 Jun 2018 17:57:43 +0900 +Subject: [PATCH] Revert "mmc: renesas_sdhi_internal_dmac: limit DMA RX for old + SoCs" + +This reverts commit fbd708880ca045a4583a4d2ca2f67e8a41ddab62. + +It solves the problem that SD card / eMMC partition information can not +be read correctly on a device operating with force_pio. + +This revert is a workaround due to difference effect with upstream code. + +Signed-off-by: Masaharu Hayakawa +Signed-off-by: Takeshi Kihara + +Conflicts: + drivers/mmc/host/renesas_sdhi_internal_dmac.c +--- + drivers/mmc/host/renesas_sdhi_internal_dmac.c | 32 +------------------ + 1 file changed, 1 insertion(+), 31 deletions(-) + +diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c +index 2f24a4890418..ba15ea2c9b9f 100644 +--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c ++++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c +@@ -9,7 +9,6 @@ + * published by the Free Software Foundation. + */ + +-#include + #include + #include + #include +@@ -64,17 +63,6 @@ + * need a custom accessor. + */ + +-static unsigned long global_flags; +-/* +- * Workaround for avoiding to use RX DMAC by multiple channels. +- * On R-Car H3 ES1.* and M3-W ES1.0, when multiple SDHI channels use +- * RX DMAC simultaneously, sometimes hundreds of bytes data are not +- * stored into the system memory even if the DMAC interrupt happened. +- * So, this driver then uses one RX DMAC channel only. +- */ +-#define SDHI_INTERNAL_DMAC_ONE_RX_ONLY 0 +-#define SDHI_INTERNAL_DMAC_RX_IN_USE 1 +- + /* Definitions for sampling clocks */ + static struct renesas_sdhi_scc rcar_gen3_scc_taps[] = { + { +@@ -150,9 +138,6 @@ renesas_sdhi_internal_dmac_abort_dma(struct tmio_mmc_host *host) { + renesas_sdhi_internal_dmac_dm_write(host, DM_CM_RST, + RST_RESERVED_BITS | val); + +- if (host->data && host->data->flags & MMC_DATA_READ) +- clear_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags); +- + renesas_sdhi_internal_dmac_enable_dma(host, true); + } + +@@ -176,9 +161,6 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host, + + if (data->flags & MMC_DATA_READ) { + dtran_mode |= DTRAN_MODE_CH_NUM_CH1; +- if (test_bit(SDHI_INTERNAL_DMAC_ONE_RX_ONLY, &global_flags) && +- test_and_set_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags)) +- goto force_pio; + } else { + dtran_mode |= DTRAN_MODE_CH_NUM_CH0; + } +@@ -227,9 +209,6 @@ static void renesas_sdhi_internal_dmac_complete_tasklet_fn(unsigned long arg) + host->data->host_cookie = COOKIE_UNMAPPED; + } + +- if (host->data->flags & MMC_DATA_READ) +- clear_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags); +- + tmio_mmc_do_data_irq(host); + out: + spin_unlock_irq(&host->lock); +@@ -298,11 +277,6 @@ static const struct tmio_mmc_dma_ops renesas_sdhi_internal_dmac_dma_ops = { + * implementation as others may use a different implementation. + */ + static const struct soc_device_attribute gen3_soc_whitelist[] = { +- /* specific ones */ +- { .soc_id = "r8a7795", .revision = "ES1.*", +- .data = (void *)BIT(SDHI_INTERNAL_DMAC_ONE_RX_ONLY) }, +- { .soc_id = "r8a7796", .revision = "ES1.0", +- .data = (void *)BIT(SDHI_INTERNAL_DMAC_ONE_RX_ONLY) }, + /* generic ones */ + { .soc_id = "r8a7795" }, + { .soc_id = "r8a7796" }, +@@ -314,13 +288,9 @@ static const struct soc_device_attribute gen3_soc_whitelist[] = { + + static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev) + { +- const struct soc_device_attribute *soc = soc_device_match(gen3_soc_whitelist); +- +- if (!soc) ++ if (!soc_device_match(gen3_soc_whitelist)) + return -ENODEV; + +- global_flags |= (unsigned long)soc->data; +- + #ifndef CONFIG_MMC_SDHI_PIO + return renesas_sdhi_probe(pdev, &renesas_sdhi_internal_dmac_dma_ops); + #else +-- +2.17.1 + diff --git a/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers_4.14.bb b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers_4.14.bb index 4c659c3..043ba21 100644 --- a/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers_4.14.bb +++ b/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers_4.14.bb @@ -8,6 +8,11 @@ SRCREV = "118adc53e8e9806d76f40859ba96290f289f8839" SRC_URI = "${RENESAS_BSP_URL};branch=${BRANCH}" +# Fix micro SD card issue on M3ULCB +SRC_URI_append = " \ + file://0001-Revert-mmc-renesas_sdhi_internal_dmac-limit-DMA-RX-f.patch \ +" + # Enable RPMSG_VIRTIO depend on ICCOM SRC_URI_append = " \ ${@base_conditional("USE_ICCOM", "1", " file://0001-rpmsg-Add-message-to-be-able-to-configure-RPMSG_VIRT.patch", "", d)} \ diff --git a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-Revert-mmc-renesas_sdhi_internal_dmac-limit-DMA-RX-f.patch b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-Revert-mmc-renesas_sdhi_internal_dmac-limit-DMA-RX-f.patch new file mode 100644 index 0000000..1d7fa7a --- /dev/null +++ b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-Revert-mmc-renesas_sdhi_internal_dmac-limit-DMA-RX-f.patch @@ -0,0 +1,112 @@ +From 001e18801fa28bbcd02c86707bc56d87ebabca60 Mon Sep 17 00:00:00 2001 +From: Masaharu Hayakawa +Date: Fri, 15 Jun 2018 17:57:43 +0900 +Subject: [PATCH] Revert "mmc: renesas_sdhi_internal_dmac: limit DMA RX for old + SoCs" + +This reverts commit fbd708880ca045a4583a4d2ca2f67e8a41ddab62. + +It solves the problem that SD card / eMMC partition information can not +be read correctly on a device operating with force_pio. + +This revert is a workaround due to difference effect with upstream code. + +Signed-off-by: Masaharu Hayakawa +Signed-off-by: Takeshi Kihara + +Conflicts: + drivers/mmc/host/renesas_sdhi_internal_dmac.c +--- + drivers/mmc/host/renesas_sdhi_internal_dmac.c | 32 +------------------ + 1 file changed, 1 insertion(+), 31 deletions(-) + +diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c +index 2f24a4890418..ba15ea2c9b9f 100644 +--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c ++++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c +@@ -9,7 +9,6 @@ + * published by the Free Software Foundation. + */ + +-#include + #include + #include + #include +@@ -64,17 +63,6 @@ + * need a custom accessor. + */ + +-static unsigned long global_flags; +-/* +- * Workaround for avoiding to use RX DMAC by multiple channels. +- * On R-Car H3 ES1.* and M3-W ES1.0, when multiple SDHI channels use +- * RX DMAC simultaneously, sometimes hundreds of bytes data are not +- * stored into the system memory even if the DMAC interrupt happened. +- * So, this driver then uses one RX DMAC channel only. +- */ +-#define SDHI_INTERNAL_DMAC_ONE_RX_ONLY 0 +-#define SDHI_INTERNAL_DMAC_RX_IN_USE 1 +- + /* Definitions for sampling clocks */ + static struct renesas_sdhi_scc rcar_gen3_scc_taps[] = { + { +@@ -150,9 +138,6 @@ renesas_sdhi_internal_dmac_abort_dma(struct tmio_mmc_host *host) { + renesas_sdhi_internal_dmac_dm_write(host, DM_CM_RST, + RST_RESERVED_BITS | val); + +- if (host->data && host->data->flags & MMC_DATA_READ) +- clear_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags); +- + renesas_sdhi_internal_dmac_enable_dma(host, true); + } + +@@ -176,9 +161,6 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host, + + if (data->flags & MMC_DATA_READ) { + dtran_mode |= DTRAN_MODE_CH_NUM_CH1; +- if (test_bit(SDHI_INTERNAL_DMAC_ONE_RX_ONLY, &global_flags) && +- test_and_set_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags)) +- goto force_pio; + } else { + dtran_mode |= DTRAN_MODE_CH_NUM_CH0; + } +@@ -227,9 +209,6 @@ static void renesas_sdhi_internal_dmac_complete_tasklet_fn(unsigned long arg) + host->data->host_cookie = COOKIE_UNMAPPED; + } + +- if (host->data->flags & MMC_DATA_READ) +- clear_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags); +- + tmio_mmc_do_data_irq(host); + out: + spin_unlock_irq(&host->lock); +@@ -298,11 +277,6 @@ static const struct tmio_mmc_dma_ops renesas_sdhi_internal_dmac_dma_ops = { + * implementation as others may use a different implementation. + */ + static const struct soc_device_attribute gen3_soc_whitelist[] = { +- /* specific ones */ +- { .soc_id = "r8a7795", .revision = "ES1.*", +- .data = (void *)BIT(SDHI_INTERNAL_DMAC_ONE_RX_ONLY) }, +- { .soc_id = "r8a7796", .revision = "ES1.0", +- .data = (void *)BIT(SDHI_INTERNAL_DMAC_ONE_RX_ONLY) }, + /* generic ones */ + { .soc_id = "r8a7795" }, + { .soc_id = "r8a7796" }, +@@ -314,13 +288,9 @@ static const struct soc_device_attribute gen3_soc_whitelist[] = { + + static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev) + { +- const struct soc_device_attribute *soc = soc_device_match(gen3_soc_whitelist); +- +- if (!soc) ++ if (!soc_device_match(gen3_soc_whitelist)) + return -ENODEV; + +- global_flags |= (unsigned long)soc->data; +- + #ifndef CONFIG_MMC_SDHI_PIO + return renesas_sdhi_probe(pdev, &renesas_sdhi_internal_dmac_dma_ops); + #else +-- +2.17.1 + diff --git a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb index d1eb75b..6f88d52 100644 --- a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb +++ b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb @@ -14,6 +14,11 @@ SRCREV = "118adc53e8e9806d76f40859ba96290f289f8839" SRC_URI = "${RENESAS_BSP_URL};protocol=git;nocheckout=1;branch=${BRANCH}" +# Fix micro SD card issue on M3ULCB +SRC_URI_append = " \ + file://0001-Revert-mmc-renesas_sdhi_internal_dmac-limit-DMA-RX-f.patch \ +" + LINUX_VERSION ?= "4.14.35" PV = "${LINUX_VERSION}+git${SRCPV}" PR = "r1" -- cgit 1.2.3-korg