From: Dave Klotz <[email protected]>

spacemit_sdhci_get_b_max() limits every SD read in the SPL to a single
block, so loading a 1 MiB u-boot.itb takes about 2000 commands. The
limit came with the driver without a recorded hardware reason. The
driver uses PIO and does not advertise MMC_CAP_CMD23, so a multi-block
read is a CMD18 followed by a CMD12.

Multi-block reads in the SPL failed on the Banana Pi BPI-F3 with a
Data End Bit error and returned no blocks on the Milk-V Jupiter. Both
failures came from the SD I/O rail being left at 1.8 V; with the rail
at 3.3 V, multi-block reads in the SPL work on both boards. The SPL
now sets the rail to 3.3 V through vqmmc-supply.

Drop the limit and use the host's b_max.

Signed-off-by: Dave Klotz <[email protected]>
Signed-off-by: Tanmay Kathpalia <[email protected]>
---
Changes in v3:
- Commit message explains the BPI-F3 and Jupiter failures and the
  CMD18/CMD12 sequence; code unchanged
---
 drivers/mmc/spacemit_sdhci.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/mmc/spacemit_sdhci.c b/drivers/mmc/spacemit_sdhci.c
index f5578f38bdd..d3748847e48 100644
--- a/drivers/mmc/spacemit_sdhci.c
+++ b/drivers/mmc/spacemit_sdhci.c
@@ -324,16 +324,6 @@ static int spacemit_sdhci_wait_dat0(struct udevice *dev, 
int state,
        return 0;
 }
 
-static int spacemit_sdhci_get_b_max(struct udevice *dev, void *dst,
-                                   lbaint_t blkcnt)
-{
-       struct mmc *mmc = mmc_get_mmc_dev(dev);
-
-       if (IS_ENABLED(CONFIG_SPL_BUILD) && mmc && IS_SD(mmc))
-               return 1;
-       return mmc->cfg->b_max;
-}
-
 static void spacemit_sdhci_set_control_reg(struct sdhci_host *host)
 {
        struct mmc *mmc = host->mmc;
@@ -574,7 +564,6 @@ static int spacemit_sdhci_probe(struct udevice *dev)
 
        spacemit_mmc_ops = sdhci_ops;
        spacemit_mmc_ops.wait_dat0 = spacemit_sdhci_wait_dat0;
-       spacemit_mmc_ops.get_b_max = spacemit_sdhci_get_b_max;
 
        ret = clk_get_bulk(dev, &plat->clks);
        if (ret) {
-- 
2.43.7

Reply via email to