Merge pull request #954 from weety/dev

[BSP][DeviceDrivers] Add MMC/SDIO initializer; Change the MMC initialization in each BSP.
This commit is contained in:
Bernard Xiong 2017-11-05 22:58:39 +08:00 committed by GitHub
commit 0e3397b92e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 31 additions and 25 deletions

View File

@ -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))
{

View File

@ -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);

View File

@ -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

View File

@ -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))
{

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -554,9 +554,6 @@ err:
int imxrt_mci_init(void)
{
rt_mmcsd_core_init();
rt_mmcsd_blk_init();
/* initilize sd card */
_imxrt_mci_init();

View File

@ -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);

View File

@ -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);

View File

@ -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 */
return 0;
}
INIT_PREV_EXPORT(rt_mmcsd_blk_init);

View File

@ -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);

View File

@ -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.