diff options
| author | heyuanjie87 <[email protected]> | 2023-08-01 01:48:50 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-08-01 14:48:50 +0800 |
| commit | a98b11747fc6b4cd25abaf3b6a896ff4ee574976 (patch) | |
| tree | 614c31154116cd43ddb0e03313d42f1b67b2df2d /components | |
| parent | 43e0423b7b969213892af8c6c3596e6220013226 (diff) | |
[sdio]开启emmc内部cache加快传输 (#7896)
Diffstat (limited to 'components')
| -rw-r--r-- | components/drivers/include/drivers/mmcsd_card.h | 7 | ||||
| -rw-r--r-- | components/drivers/sdio/mmc.c | 12 |
2 files changed, 18 insertions, 1 deletions
diff --git a/components/drivers/include/drivers/mmcsd_card.h b/components/drivers/include/drivers/mmcsd_card.h index da10d1ecc6..d348c9affa 100644 --- a/components/drivers/include/drivers/mmcsd_card.h +++ b/components/drivers/include/drivers/mmcsd_card.h @@ -127,7 +127,10 @@ struct rt_sdio_function { #define SDIO_MAX_FUNCTIONS 7 - +struct rt_mmc_ext_csd +{ + rt_uint32_t cache_size; +}; struct rt_mmcsd_card { struct rt_mmcsd_host *host; @@ -164,6 +167,8 @@ struct rt_mmcsd_card { struct rt_sdio_cis cis; /* common tuple info */ struct rt_sdio_function *sdio_function[SDIO_MAX_FUNCTIONS + 1]; /* SDIO functions (devices) */ rt_list_t blk_devices; /* for block device list */ + + struct rt_mmc_ext_csd ext_csd; }; #ifdef __cplusplus diff --git a/components/drivers/sdio/mmc.c b/components/drivers/sdio/mmc.c index 567c1a4fa5..47c543396d 100644 --- a/components/drivers/sdio/mmc.c +++ b/components/drivers/sdio/mmc.c @@ -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->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->card_sec_cnt = card_capacity; card_capacity *= card->card_blksize; @@ -613,6 +619,12 @@ static rt_int32_t mmcsd_mmc_init_card(struct rt_mmcsd_host *host, 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; rt_free(ext_csd); |
