Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdhci2 not initialized #17

Closed
hgalindo opened this issue Feb 16, 2024 · 3 comments
Closed

sdhci2 not initialized #17

hgalindo opened this issue Feb 16, 2024 · 3 comments

Comments

@hgalindo
Copy link

I'm trying to make the TinyVision board boot from the onboard SD-NAND (I soldered a chip).
Added the sdhci2 structure to the board.c file

sdhci_t sdhci2 = {
        .name = "sdhci2",
        .reg = (sdhci_reg_t *) 0x04022000,
        .voltage = MMC_VDD_27_36,
        .width = MMC_BUS_WIDTH_4,
        .clock = MMC_CLK_50M,
        .removable = 0,
        .isspi = FALSE,
        .gpio_clk = {GPIO_PIN(GPIO_PORTC, 0), GPIO_PERIPH_MUX3},
        .gpio_cmd = {GPIO_PIN(GPIO_PORTC, 1), GPIO_PERIPH_MUX3},
        .gpio_d0 = {GPIO_PIN(GPIO_PORTC, 4), GPIO_PERIPH_MUX3},
        .gpio_d1 = {GPIO_PIN(GPIO_PORTC, 3), GPIO_PERIPH_MUX3},
        .gpio_d2 = {GPIO_PIN(GPIO_PORTC, 2), GPIO_PERIPH_MUX3},
        .gpio_d3 = {GPIO_PIN(GPIO_PORTC, 5), GPIO_PERIPH_MUX3},
};

added the initialization in the syter_boot/main.c file

    if (sunxi_sdhci_init(&sdhci2) != 0) {
        printk(LOG_LEVEL_ERROR, "SMHC2: %s controller init failed\n", sdhci2.name);
        goto _shell;
    } else {
        printk(LOG_LEVEL_INFO, "SMHC2: %s controller v%x initialized\n", sdhci2.name, sdhci2.reg->vers);
    }

    if (sdmmc_init(&card0, &sdhci2) != 0) {
        printk(LOG_LEVEL_WARNING, "SMHC2: init failed\n");
        goto _shell;
    }
  

compiled and flashed to the SD-NAND, this is the output when booting from it

[    0.000124][I]  _____     _           _____ _ _
[    0.005125][I] |   __|_ _| |_ ___ ___|  |  |_| |_
[    0.010160][I] |__   | | |  _| -_|  _|    -| | _|
[    0.015161][I] |_____|_  |_| |___|_| |__|__|_|_|
[    0.020170][I]       |___|
[    0.025171][I] ***********************************
[    0.030180][I]  SyterKit v0.2.4 Commit:
[    0.034262][I]  github.com/YuzukiHD/SyterKit
[    0.039263][I] ***********************************
[    0.044281][I]  Built by: arm-none-eabi-gcc 8.3.1
[    0.049204][I]
[    0.052332][I] DRAM: size = 64MB
[    0.058609][I] DRAM: simple test OK
[    0.068207][I] SMHC2: sdhci2 controller v0 initialized
[    0.173584][W] SMHC: wait timeout 0 status 0 flag 4
[    0.178431][W] SMHC: cmd timeout
[    0.181698][E] SMHC: set idle state failed
[    0.185824][W] SMHC2: init failed
SyterKit>

There is not hardware issues as I am able to enable the SD2 on the .dts and use it under OpenWRT (booting from SD Card).

This the output when bootng from SD Card

[    0.000125][I]  _____     _           _____ _ _
[    0.005143][I] |   __|_ _| |_ ___ ___|  |  |_| |_
[    0.010187][I] |__   | | |  _| -_|  _|    -| | _|
[    0.015240][I] |_____|_  |_| |___|_| |__|__|_|_|
[    0.020302][I]       |___|
[    0.025319][I] ***********************************
[    0.030346][I]  SyterKit v0.2.4 Commit:
[    0.034523][I]  github.com/YuzukiHD/SyterKit
[    0.039550][I] ***********************************
[    0.044585][I]  Built by: arm-none-eabi-gcc 8.3.1
[    0.049525][I]
[    0.052607][I] DRAM: size = 64MB
[    0.058479][I] DRAM: simple test OK
[    0.062458][I] SMHC0: sdhci0 controller v50400 initialized
[    0.083915][I] SMHC: capacity 31.9GB
[    0.088109][I] SHMC: SD card detected
[    0.165755][I] FATFS: read sunxi.dtb addr=41008000
[    0.183112][I] FATFS: read in 13ms at 2.32MB/S
[    0.187526][I] FATFS: read zImage addr=41800000
[    1.871819][I] FATFS: read in 1680ms at 3.02MB/S
[    1.876363][I] FATFS: read config.ini addr=40008000
[    1.881970][I] FATFS: read in 1ms at 0.19MB/S
[    1.886280][I] FATFS: done in 1722ms
[    1.902492][I] Hit any key to stop autoboot:  0
[    6.910329][I] disable mmu ok...
[    6.913726][I] disable dcache ok...
[    6.917401][I] disable icache ok...
[    6.921075][I] free interrupt ok...
[    6.924750][I] enable kernel smp ok...
[    6.928659][I] jump to kernel address: 0x41800000

Am I missing something to initialize the sdhci2 and boot from it?
Thanks.

@YuzukiTsuru
Copy link
Contributor

SDC2 Currently not supported, due to different controller IP, separate driver adaptation is required

@hgalindo
Copy link
Author

ok, any idea if it will be adapted?

@YuzukiTsuru
Copy link
Contributor

#34

[    0.000115][I]  _____     _           _____ _ _
[    0.005151][I] |   __|_ _| |_ ___ ___|  |  |_| |_
[    0.010246][I] |__   | | |  _| -_|  _|    -| | _|
[    0.015334][I] |_____|_  |_| |___|_| |__|__|_|_|
[    0.020473][I]       |___|
[    0.025491][I] ***********************************
[    0.030535][I]  SyterKit v0.2.6 Commit: 8c20ad8d
[    0.035380][I]  github.com/YuzukiHD/SyterKit
[    0.040415][I] ***********************************
[    0.045459][I]  Built by: arm-none-eabi-gcc 10.3.1
[    0.050486][I]
[    0.053539][I] DRAM: size = 64MB
[    0.059452][I] DRAM: simple test OK
[    0.063463][I] SMHC: sdhci2 controller v50400 initialized
[    0.075170][I] SMHC: capacity 125.8MB
[    0.079447][I] SHMC: SD card detected
[    0.128718][I] FATFS: read sunxi.dtb addr=41008000
[    0.133711][E] FATFS: open, filename: [sunxi.dtb]: error 4
[    0.139234][W] SMHC: loading failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants