szemzoa / awboot

small linux bootloader for Allwinner T113-S3 and V851s
76 stars 34 forks source link

SMHC: error 0x100 status 0x0 #22

Closed vvpnet closed 1 year ago

vvpnet commented 1 year ago

Good afternoon. I constantly face such a problem: [I] AWBoot r6160 starting... [I] SMHC: sdhci0 controller v50310 initialized [W] SMHC: error 0x100 status 0x0 [W] SMHC: cmd timeout [W] SMHC: error 0x100 status 0x0 [W] SMHC: cmd timeout [W] SMHC: init failed, trying SPI A successful launch from SD occurs from 3~6 attempts. I have tried different SD. I have tried different boards(T113-S3). There is such a mistake everywhere. Tell me what could be the problem?

tipstrying commented 1 year ago

I have encountered the same problem. Have you made any new discoveries?

vvpnet commented 1 year ago

No. I think I need to use a different loader.

olegk0 commented 1 year ago

this problem was solved by increasing attempts to initialize MMC

changed sdmmc_init in file sdmmc.c as below

int sdmmc_init(sdmmc_pdata_t *data, sdhci_t *hci) {
    data->hci = hci;
    data->online = FALSE;
    int retries = 10;

    do {
        if (sdmmc_detect(data->hci, &data->card) == TRUE) {
            info("SHMC: %s card detected\r\n", data->card.version & SD_VERSION_SD ? "SD" : "MMC");
            return 0;
        }
        mdelay(100);
    } while (retries--);

    return -1;
}
fpoussin commented 1 year ago

@olegk0 feel free to open a PR so we can merge this improvement 😄