未验证 提交 0e3397b9 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #954 from weety/dev

[BSP][DeviceDrivers] Add MMC/SDIO initializer; Change the MMC initialization in each BSP.
......@@ -73,9 +73,6 @@ int main(void)
#endif
#ifdef RT_USING_SDIO
rt_mmcsd_core_init();
rt_mmcsd_blk_init();
at91_mci_init();
timeout = 0;
while ((rt_device_find("sd0") == RT_NULL) && (timeout++ < RT_TICK_PER_SECOND*2))
{
......
......@@ -834,7 +834,7 @@ static void mci_gpio_init()
#endif
}
rt_int32_t at91_mci_init(void)
int at91_mci_init(void)
{
struct rt_mmcsd_host *host;
struct at91_mci *mci;
......@@ -903,6 +903,7 @@ err:
return -RT_ENOMEM;
}
INIT_DEVICE_EXPORT(at91_mci_init);
#include "finsh.h"
FINSH_FUNCTION_EXPORT(at91_mci_init, at91sam9260 sd init);
......
......@@ -119,6 +119,6 @@
#define AT91_MCI_IDR 0x48 /* Interrupt Disable Register */
#define AT91_MCI_IMR 0x4c /* Interrupt Mask Register */
extern rt_int32_t at91_mci_init(void);
extern int at91_mci_init(void);
#endif
......@@ -67,9 +67,6 @@ int main(void)
#endif
#ifdef RT_USING_SDIO
rt_mmcsd_core_init();
rt_mmcsd_blk_init();
rt_hw_mmcsd_init();
timeout = 0;
while ((rt_device_find("sd0") == RT_NULL) && (timeout++ < RT_TICK_PER_SECOND*2))
{
......
......@@ -1388,7 +1388,7 @@ static void rt_hw_edma_init(void)
** 调用模块: 无
**
********************************************************************************************************/
rt_int32_t rt_hw_mmcsd_init(void)
int rt_hw_mmcsd_init(void)
{
struct clk *clk;
struct mmc_dm365_host *dm365_host;
......@@ -1477,3 +1477,6 @@ err:
return -RT_ENOMEM;
}
INIT_DEVICE_EXPORT(rt_hw_mmcsd_init);
......@@ -140,6 +140,6 @@ typedef struct {
volatile rt_uint32_t MMCFIFOCTL;
}mmcsd_regs_t;
extern rt_int32_t rt_hw_mmcsd_init(void);
extern int rt_hw_mmcsd_init(void);
#endif
......@@ -584,10 +584,6 @@ void rt_board_driver_init(){
#ifdef RT_USING_SDIO
#ifndef RT_USING_WIFI_MARVEL
rt_mmcsd_core_init();
rt_kprintf("MMC CORE initialized!\n");
rt_mmcsd_blk_init();
rt_kprintf("MMC BLK initialized!\n");
rt_hw_mmc_init();
rt_kprintf("MMC initialized!\n");
rt_thread_delay(RT_TICK_PER_SECOND*2);
......
......@@ -554,9 +554,6 @@ err:
int imxrt_mci_init(void)
{
rt_mmcsd_core_init();
rt_mmcsd_blk_init();
/* initilize sd card */
_imxrt_mci_init();
......
......@@ -30,9 +30,6 @@
int mnt_init(void)
{
#ifdef RT_USING_SDIO
rt_mmcsd_core_init();
rt_mmcsd_blk_init();
jz47xx_sdio_init();
rt_thread_delay(RT_TICK_PER_SECOND * 1);
......
......@@ -247,9 +247,9 @@ void mmcsd_change(struct rt_mmcsd_host *host);
void mmcsd_detect(void *param);
struct rt_mmcsd_host *mmcsd_alloc_host(void);
void mmcsd_free_host(struct rt_mmcsd_host *host);
void rt_mmcsd_core_init(void);
int rt_mmcsd_core_init(void);
void rt_mmcsd_blk_init(void);
int rt_mmcsd_blk_init(void);
rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card);
void rt_mmcsd_blk_remove(struct rt_mmcsd_card *card);
......
......@@ -479,8 +479,11 @@ void rt_mmcsd_blk_remove(struct rt_mmcsd_card *card)
* @deprecated since 2.1.0, this function does not need to be invoked
* in the system initialization.
*/
void rt_mmcsd_blk_init(void)
int rt_mmcsd_blk_init(void)
{
/* nothing */
/* nothing */
return 0;
}
INIT_PREV_EXPORT(rt_mmcsd_blk_init);
......@@ -726,7 +726,7 @@ void mmcsd_free_host(struct rt_mmcsd_host *host)
rt_free(host);
}
void rt_mmcsd_core_init(void)
int rt_mmcsd_core_init(void)
{
rt_err_t ret;
......@@ -751,3 +751,5 @@ void rt_mmcsd_core_init(void)
rt_sdio_init();
}
INIT_PREV_EXPORT(rt_mmcsd_core_init);
......@@ -141,6 +141,19 @@ rt_inline unsigned int rt_list_len(const rt_list_t *l)
&pos->member != (head); \
pos = rt_list_entry(pos->member.next, typeof(*pos), member))
/**
* rt_list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define rt_list_for_each_entry_safe(pos, n, head, member) \
for (pos = rt_list_entry((head)->next, typeof(*pos), member), \
n = rt_list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = rt_list_entry(n->member.next, typeof(*n), member))
/**
* rt_list_first_entry - get the first element from a list
* @ptr: the list head to take the element from.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册