From 11e33449093bc219f3ab31f8d036da05ae29c27a Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 13 Sep 2022 16:39:06 -0500 Subject: [PATCH] sd: enable 4 bit bus width for high speed cards Enable 4 bit bus width for high speed cards, so that host and card combinations that cannot use UHS mode will still benefit from the speed increase of using 4 data lines. Signed-off-by: Daniel DeGrasse --- subsys/sd/sdmmc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/subsys/sd/sdmmc.c b/subsys/sd/sdmmc.c index 8787ba2f97e..f2614419ce6 100644 --- a/subsys/sd/sdmmc.c +++ b/subsys/sd/sdmmc.c @@ -950,6 +950,14 @@ static int sdmmc_init_hs(struct sd_card *card) LOG_ERR("Failed to switch card to HS mode"); return ret; } + if (card->flags & SD_4BITS_WIDTH) { + /* Raise bus width to 4 bits */ + ret = sdmmc_set_bus_width(card, SDHC_BUS_WIDTH4BIT); + if (ret) { + LOG_ERR("Failed to change card bus width to 4 bits"); + return ret; + } + } return 0; }