mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH v2 22/22] mci: am654-sdhci: Use PIO for small transfers
Date: Mon, 06 Jan 2025 14:47:19 +0100	[thread overview]
Message-ID: <20250106-k3-r5-v2-22-9de6270089ef@pengutronix.de> (raw)
In-Reply-To: <20250106-k3-r5-v2-0-9de6270089ef@pengutronix.de>

When the R5 boot CPU on a AM62x initializes the SD/eMMC controller it is
not able to read the SCR. The command returns successfully, but the
returned data only contains 0x0. Work around this by doing the smaller
blocksize transfers using PIO.

The same DMA transfer works when doing it on the A53 CPU

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mci/am654-sdhci.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/mci/am654-sdhci.c b/drivers/mci/am654-sdhci.c
index 9787642011..24d73f4c63 100644
--- a/drivers/mci/am654-sdhci.c
+++ b/drivers/mci/am654-sdhci.c
@@ -467,7 +467,7 @@ static int am654_sdhci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
 	struct am654_sdhci_plat *host = container_of(mci, struct am654_sdhci_plat, mci);
 	u32 command, xfer;
 	int ret;
-	dma_addr_t dma;
+	dma_addr_t dma = SDHCI_NO_DMA;
 
 	ret = sdhci_wait_idle_data(&host->sdhci, cmd);
 	if (ret)
@@ -477,7 +477,10 @@ static int am654_sdhci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
 
 	sdhci_write8(&host->sdhci, SDHCI_TIMEOUT_CONTROL, 0xe);
 
-	sdhci_setup_data_dma(&host->sdhci, data, &dma);
+	if (data && data->blocksize < 512)
+		sdhci_setup_data_pio(&host->sdhci, data);
+	else
+		sdhci_setup_data_dma(&host->sdhci, data, &dma);
 
 	sdhci_set_cmd_xfer_mode(&host->sdhci, cmd, data,
 				dma == SDHCI_NO_DMA ? false : true,
@@ -494,7 +497,10 @@ static int am654_sdhci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
 	sdhci_read_response(&host->sdhci, cmd);
 	sdhci_write32(&host->sdhci, SDHCI_INT_STATUS, SDHCI_INT_CMD_COMPLETE);
 
-	ret = sdhci_transfer_data_dma(&host->sdhci, data, dma);
+	if (data && data->blocksize < 512)
+		ret = sdhci_transfer_data_pio(&host->sdhci, data);
+	else
+		ret = sdhci_transfer_data_dma(&host->sdhci, data, dma);
 
 error:
 	if (ret) {

-- 
2.39.5




      parent reply	other threads:[~2025-01-06 14:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-06 13:46 [PATCH v2 00/22] ARM: K3: Add R5 boot support Sascha Hauer
2025-01-06 13:46 ` [PATCH v2 01/22] ARM: add ARMv7R MPU support Sascha Hauer
2025-01-06 13:46 ` [PATCH v2 02/22] lib/rationale: compile for pbl Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 03/22] DDR: Add k3 DDR driver Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 04/22] ARM: move ARM_CPU_PART_* defines to header Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 05/22] nommu_v7_vectors_init: disable for r5 Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 06/22] clocksource: timer-ti-dm: add support for K3 SoCs Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 07/22] ARM: K3: mount /boot even with env handling disabled Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 08/22] clk: add K3 clk driver Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 09/22] pmdomain: add K3 driver Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 10/22] rproc: add K3 arm64 rproc driver Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 11/22] ARM: k3: add k3_debug_ll_init() Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 12/22] ARM: K3: use debug_ll code for regular PBL console Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 13/22] elf: use iomem regions as fallback when loading to non-sdram memory Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 14/22] rproc: add K3 system_controller Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 15/22] firmware: ti_sci: add function to get global handle Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 16/22] ARM: k3: Add initial r5 support Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 17/22] ARM: k3: Add k3img tool Sascha Hauer
2025-01-06 14:34   ` Ahmad Fatoum
2025-01-06 13:47 ` [PATCH v2 18/22] ARM: beagleplay: add binary files Sascha Hauer
2025-01-06 14:33   ` Ahmad Fatoum
2025-01-07  7:44     ` Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 19/22] ARM: beagleplay: add Cortex-R5 boot support Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 20/22] Documentation: add build documentation for TI K3 SoCs Sascha Hauer
2025-01-06 13:47 ` [PATCH v2 21/22] ARM: am625: disable secondary watchdogs Sascha Hauer
2025-01-06 13:47 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250106-k3-r5-v2-22-9de6270089ef@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox