Exemplo n.º 1
0
int BL_MSDC_DeInit(void)
{
    MSDC_DeInit();

    // reset GPIO to disable MSDC
    DRV_ClearBits(0x80021800, 0x5540);
    DRV_ClearBits(0x80021900, 0x55);

    return 0;
}
int BL_MSDC_Init(void)
{
    // enable GPIO for MSDC
#if defined(MT6235) || defined(MT6235B)
    DRV_SetBits(0x80021800, 0x5540);
    DRV_SetBits(0x80021900, 0x55);
#elif defined(MT6236)
    DRV_SetBits(0x801D0610, 0x3);       // MCOINS: b'11
    DRV_SetBits(0x801D0200, 0xFD00);    // GPIO8 PU SEL (b'8)
#elif defined(MT6253)
    DRV_SetBits(0x80020210, 0x5554);
#elif defined(MT6252)
    //
    // Patch the offset and arguments. The macro only can read/write 16bit data.
    //
    //DRV_ClearBits(0x800201D0, 0xFFFF0000);
    //DRV_SetBits(0x800201D0, 0x11110000);
    DRV_ClearBits(0x800201D2, 0xFFFF);
    DRV_SetBits(0x800201D2, 0x1111);
#elif defined(MT6268)
    DRV_ClearBits(0x84021A00, 0xFF00);
    DRV_SetBits(0x84021A00, 0x5500);
#elif defined(MT6276_S01)
    DRV_ClearBits(0x810A2200, 0x7FC0);
    DRV_SetBits(0x810A2200, 0x1240);
    DRV_ClearBits(0x810A2300, 0x0FFF);
    DRV_SetBits(0x810A2300, 0x0249);
#elif defined(MT6276_S00)
#error Not support MT6276 E1!
#elif defined(MT6251_S01)
    DRV_ClearBits(0x80020200, 0x0FFF);
    DRV_SetBits(0x80020200, 0x0111);
#elif defined(MT6251_S00)
#error Not support MT6251 E1!
#elif defined(MT6255)
    DRV_ClearBits(0x801D0750, 0x00F0);
#elif defined(MT6250)
    DRV_ClearBits(0xA0020c32, 0xFF00);
    DRV_SetBits(0xA0020c32, 0x1100); // CLK and DAT0
    DRV_ClearBits(0xA0020c40, 0x000F);
    DRV_SetBits(0xA0020c40, 0x0001); // CMD
#endif

    DclSD_Initialize();
    //MSDC_Initialize();

    return 0;
}
int BL_MSDC_DeInit(void)
{
    //MSDC_DeInit();
    DclSD_DeInitialize();

    // reset GPIO to disable MSDC
#if defined(MT6235) || defined(MT6235B)
    DRV_ClearBits(0x80021800, 0x5540);
    DRV_ClearBits(0x80021900, 0x55);
#elif defined(MT6236)
    DRV_ClearBits(0x801D0610, 0x3); // MCOINS: b'11
#elif defined(MT6253)
    DRV_ClearBits(0x80020210, 0x5554);
#elif defined(MT6252)
    DRV_ClearBits(0x800201D0, 0xFFFF0000);
#elif defined(MT6268)
    DRV_ClearBits(0x84021A00, 0xFF00);
#elif defined(MT6251_S01)
    DRV_ClearBits(0x80020200, 0x0FFF);
#endif

    return 0;
}