[sdio]开启emmc内部cache加快传输 (#7896)
This commit is contained in:
parent
43e0423b7b
commit
a98b11747f
|
@ -127,7 +127,10 @@ struct rt_sdio_function {
|
||||||
|
|
||||||
#define SDIO_MAX_FUNCTIONS 7
|
#define SDIO_MAX_FUNCTIONS 7
|
||||||
|
|
||||||
|
struct rt_mmc_ext_csd
|
||||||
|
{
|
||||||
|
rt_uint32_t cache_size;
|
||||||
|
};
|
||||||
|
|
||||||
struct rt_mmcsd_card {
|
struct rt_mmcsd_card {
|
||||||
struct rt_mmcsd_host *host;
|
struct rt_mmcsd_host *host;
|
||||||
|
@ -164,6 +167,8 @@ struct rt_mmcsd_card {
|
||||||
struct rt_sdio_cis cis; /* common tuple info */
|
struct rt_sdio_cis cis; /* common tuple info */
|
||||||
struct rt_sdio_function *sdio_function[SDIO_MAX_FUNCTIONS + 1]; /* SDIO functions (devices) */
|
struct rt_sdio_function *sdio_function[SDIO_MAX_FUNCTIONS + 1]; /* SDIO functions (devices) */
|
||||||
rt_list_t blk_devices; /* for block device list */
|
rt_list_t blk_devices; /* for block device list */
|
||||||
|
|
||||||
|
struct rt_mmc_ext_csd ext_csd;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -209,6 +209,12 @@ static int mmc_parse_ext_csd(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd)
|
||||||
card->hs_max_data_rate = 52000000;
|
card->hs_max_data_rate = 52000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
card->ext_csd.cache_size =
|
||||||
|
ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 |
|
||||||
|
ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 |
|
||||||
|
ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 |
|
||||||
|
ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24;
|
||||||
|
|
||||||
card_capacity = *((rt_uint32_t *)&ext_csd[EXT_CSD_SEC_CNT]);
|
card_capacity = *((rt_uint32_t *)&ext_csd[EXT_CSD_SEC_CNT]);
|
||||||
card->card_sec_cnt = card_capacity;
|
card->card_sec_cnt = card_capacity;
|
||||||
card_capacity *= card->card_blksize;
|
card_capacity *= card->card_blksize;
|
||||||
|
@ -613,6 +619,12 @@ static rt_int32_t mmcsd_mmc_init_card(struct rt_mmcsd_host *host,
|
||||||
goto err0;
|
goto err0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (card->ext_csd.cache_size > 0)
|
||||||
|
{
|
||||||
|
mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
|
||||||
|
EXT_CSD_CACHE_CTRL, 1);
|
||||||
|
}
|
||||||
|
|
||||||
host->card = card;
|
host->card = card;
|
||||||
|
|
||||||
rt_free(ext_csd);
|
rt_free(ext_csd);
|
||||||
|
|
Loading…
Reference in New Issue