Exemplo n.º 1
0
int mmc_boot_up(int id, int reset)
{
    int err = MMC_ERR_FAILED;
    struct mmc_host *host;

    host = mmc_get_host(id);
    mmc_init_host(host, id);

    msdc_emmc_boot_reset(host, reset);
    
    err = msdc_emmc_boot_start(host, 25000000, 0, EMMC_BOOT_RST_CMD_MODE, 0);
    if (err) {
        printf("[EMMC] Boot Error: %d\n", err);
        goto done;
    }
    err = msdc_emmc_boot_read(host, 128 * 1024, MMC_BUF_ADDR);
    msdc_emmc_boot_stop(host, EMMC_BOOT_RST_CMD_MODE);
done:
    if (!err) {
        int i, j;
        char *buf = MMC_BUF_ADDR;
        for (i = 0; i < 16; i++) {            
            for (j = 0; j < MMC_BLOCK_SIZE; j++) {
                if (j % 16 == 0)
                    printf("\n%.8xh: ", i * MMC_BLOCK_SIZE + j);
                printf("%.2x ",  buf[j]);
            }
            printf("\n");
            buf += MMC_BLOCK_SIZE;
        }
    }
    return err;
}
Exemplo n.º 2
0
int mmc_boot_up_test(int id, int reset, u32 freq, int in_idle)
{
    int err = MMC_ERR_FAILED;
    struct mmc_host *host;
    struct mmc_card *card;

    host = mmc_get_host(id);
    card = mmc_get_card(id);
    mmc_init_host(host, id);

    if (in_idle) {
        printf("[EMMC] Card is in idle mode \n");
        /* card in idle mode */
        //mmc_go_idle(host);
        mmc_init_card(host, card);
        /* note: requires delay before issue boot reset command */
        mdelay(5);
    } else {
        /* card not in idle mode */
        printf("[EMMC] Card is not in idle mode \n");
    }

    msdc_emmc_boot_reset(host, reset);
    
    err = msdc_emmc_boot_start(host, freq, 0, EMMC_BOOT_RST_CMD_MODE, 0);
    if (err) {
        printf("[EMMC] Boot Error: %d\n", err);
        goto done;
    }
    err = msdc_emmc_boot_read(host, 128 * 1024, MMC_BUF_ADDR);
    msdc_emmc_boot_stop(host, EMMC_BOOT_RST_CMD_MODE);
    if (err) {
        printf("[EMMC] Boot Read Error: %d\n", err);
        goto done;
    }

done:
    if (!err) {
        int i, j;
        char *buf = (char*)MMC_BUF_ADDR;
        for (i = 0; i < 16; i++) {            
            for (j = 0; j < MMC_BLOCK_SIZE; j++) {
                if (j % 16 == 0)
                    printf("\n%xh: ", i * MMC_BLOCK_SIZE + j);
                printf("%x ",  buf[j]);
            }
            printf("\n");
            buf += MMC_BLOCK_SIZE;
        }
    }
    return err;
}