From a33bc0f32183b137c744c6f1012e69ba77e4333b Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Thu, 12 Mar 2020 08:43:16 +0800 Subject: [component] sdio: Fix mmc mount function if the whole device is a partition If the whole sd card was formatted as a partition, current code break out the loop mistakenly, so it skips dfs_mount_device later. Simply remove the broken 'break' to solve this problem. Signed-off-by: Shawn Lin --- components/drivers/sdio/block_dev.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'components') diff --git a/components/drivers/sdio/block_dev.c b/components/drivers/sdio/block_dev.c index 5db0f38c08..602acb9aa7 100644 --- a/components/drivers/sdio/block_dev.c +++ b/components/drivers/sdio/block_dev.c @@ -460,8 +460,6 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card) rt_device_register(&blk_dev->dev, "sd0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE); rt_list_insert_after(&blk_devices, &blk_dev->list); - - break; } else { -- cgit v1.3.1 From 11277014a3361a67e5f939f58aa0540f2016cc02 Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Thu, 12 Mar 2020 08:52:56 +0800 Subject: [Components] sdio: try bus width depends on host's capability It makes no sense to try bus width if not supported by drivers or BSP, since we know it must be failed. It saves a lot for booting in time critical environment. Signed-off-by: Shawn Lin --- components/drivers/sdio/mmc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'components') diff --git a/components/drivers/sdio/mmc.c b/components/drivers/sdio/mmc.c index 7b1f7ee193..f77fbd959e 100644 --- a/components/drivers/sdio/mmc.c +++ b/components/drivers/sdio/mmc.c @@ -318,8 +318,17 @@ static int mmc_select_bus_width(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd) * the device to work in 8bit transfer mode. If the * mmc switch command returns error then switch to * 4bit transfer mode. On success set the corresponding - * bus width on the host. + * bus width on the host. Meanwhile, mmc core would + * bail out early if corresponding bus capable wasn't + * set by drivers. */ + if ((!(host->flags & MMCSD_BUSWIDTH_8) && + ext_csd_bits[idx] == EXT_CSD_BUS_WIDTH_8) || + (!(host->flags & MMCSD_BUSWIDTH_4) && + (ext_csd_bits[idx] == EXT_CSD_BUS_WIDTH_4 || + ext_csd_bits[idx] == EXT_CSD_BUS_WIDTH_8))) + continue; + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, ext_csd_bits[idx]); -- cgit v1.3.1