[sdio] 在块配置完成后设置块大小 (#11886)

使用块设备配置完成后的实际块大小初始化存储参数。
This commit is contained in:
Bernard Xiong authored and GitHub committed 2026-11-05 11:15:36 +08:00
1 parent 47831b7386
commit b47754d44b
1 file changed
+7 -2
+7 -2
View File
@@ -111,7 +111,7 @@ static int card_busy_detect(struct rt_mmcsd_card *card, unsigned int timeout_ms,
rt_int32_t mmcsd_num_wr_blocks(struct rt_mmcsd_card *card)
{
rt_int32_t err;
rt_uint32_t blocks;
rt_uint32_t blocks = 0;
struct rt_mmcsd_req req;
struct rt_mmcsd_cmd cmd;
@@ -391,7 +391,6 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
max_blk_size = host->max_blk_count * host->max_blk_size;
blk_dev->max_req_size = (max_dma_size < max_blk_size ? max_dma_size : max_blk_size) / MMCSD_SECTOR_SIZE;
blk_dev->geometry.bytes_per_sector = MMCSD_SECTOR_SIZE;
blk_dev->geometry.block_size = card->card_blksize;
blk_dev->geometry.sector_count = card->card_capacity * (1024 / MMCSD_SECTOR_SIZE);
/* Set blk size before partitions probe, Why? */
@@ -399,6 +398,12 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
{
goto _fail;
}
/*
* mmcsd_set_blksize() configured the card for MMCSD_SECTOR_SIZE transfers.
* Report that value, not card->card_blksize (the CSD read block length),
* as the block size used by the block layer.
*/
blk_dev->geometry.block_size = MMCSD_SECTOR_SIZE;
rt_thread_mdelay(1);
#ifdef RT_USING_DM