未验证 提交 493c3338 编写于 作者: o777788's avatar o777788 提交者: GitHub

[imxrt1170]修复SD卡作为引导器后,系统无法挂载SD卡的问题 (#6600)

* 修复SD卡作为引导器后,系统无法挂载SD卡的问题

* Update Kconfig
Co-authored-by: mysterywolf's avatarMan, Jianting (Meco) <920369182@qq.com>
上级 1755750b
...@@ -51,11 +51,11 @@ static int filesystem_mount(void) ...@@ -51,11 +51,11 @@ static int filesystem_mount(void)
if (ret != 0) if (ret != 0)
{ {
rt_kprintf("ret: %d\n",ret); rt_kprintf("ret: %d\n",ret);
LOG_E("sd0p0 mount to '/' failed!"); LOG_E("sd0 mount to '/' failed!");
return ret; return ret;
} }
return RT_EOK; return RT_EOK;
} }
INIT_APP_EXPORT(filesystem_mount); INIT_ENV_EXPORT(filesystem_mount);
#endif #endif
...@@ -34,6 +34,14 @@ menu "On-chip Peripheral Drivers" ...@@ -34,6 +34,14 @@ menu "On-chip Peripheral Drivers"
select RT_USING_DFS select RT_USING_DFS
default n default n
if BSP_USING_SDIO
config CODE_STORED_ON_SDCARD
bool "Enable Code STORED On SDCARD"
default n
help
"SD CARD work as boot devive"
endif
menuconfig BSP_USING_LPUART menuconfig BSP_USING_LPUART
bool "Enable UART" bool "Enable UART"
select RT_USING_SERIAL select RT_USING_SERIAL
......
...@@ -91,11 +91,14 @@ struct imxrt_mmcsd ...@@ -91,11 +91,14 @@ struct imxrt_mmcsd
uint32_t *usdhc_adma2_table; uint32_t *usdhc_adma2_table;
}; };
#ifndef CODE_STORED_ON_SDCARD
static void _mmcsd_gpio_init(struct imxrt_mmcsd *mmcsd) static void _mmcsd_gpio_init(struct imxrt_mmcsd *mmcsd)
{ {
// CLOCK_EnableClock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03u */ // CLOCK_EnableClock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03u */
} }
#endif
static void SDMMCHOST_ErrorRecovery(USDHC_Type *base) static void SDMMCHOST_ErrorRecovery(USDHC_Type *base)
{ {
uint32_t status = 0U; uint32_t status = 0U;
...@@ -115,6 +118,7 @@ static void SDMMCHOST_ErrorRecovery(USDHC_Type *base) ...@@ -115,6 +118,7 @@ static void SDMMCHOST_ErrorRecovery(USDHC_Type *base)
} }
} }
#ifndef CODE_STORED_ON_SDCARD
static void _mmcsd_host_init(struct imxrt_mmcsd *mmcsd) static void _mmcsd_host_init(struct imxrt_mmcsd *mmcsd)
{ {
usdhc_host_t *usdhc_host = &mmcsd->usdhc_host; usdhc_host_t *usdhc_host = &mmcsd->usdhc_host;
...@@ -143,6 +147,7 @@ static void _mmcsd_isr_init(struct imxrt_mmcsd *mmcsd) ...@@ -143,6 +147,7 @@ static void _mmcsd_isr_init(struct imxrt_mmcsd *mmcsd)
{ {
//NVIC_SetPriority(USDHC1_IRQn, 5U); //NVIC_SetPriority(USDHC1_IRQn, 5U);
} }
#endif
static void _mmc_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req) static void _mmc_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req)
{ {
...@@ -449,10 +454,12 @@ rt_int32_t _imxrt_mci_init(void) ...@@ -449,10 +454,12 @@ rt_int32_t _imxrt_mci_init(void)
#endif #endif
mmcsd->host = host; mmcsd->host = host;
#ifndef CODE_STORED_ON_SDCARD
_mmcsd_clk_init(mmcsd); _mmcsd_clk_init(mmcsd);
_mmcsd_isr_init(mmcsd); _mmcsd_isr_init(mmcsd);
_mmcsd_gpio_init(mmcsd); _mmcsd_gpio_init(mmcsd);
_mmcsd_host_init(mmcsd); _mmcsd_host_init(mmcsd);
#endif
host->private_data = mmcsd; host->private_data = mmcsd;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册