This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to support MMC/SD1 in TIDM368 SDK v2.0?

code modification points:

1. board-dm368-ipnc.c,add mmc1:

static struct resource mmc1_resources[] = {
    [0] = {            /* registers */
        .start = DM365_MMC_SD1_BASE,
        .end = DM365_MMC_SD1_BASE + SZ_1K - 1,
        .flags = IORESOURCE_MEM,
        },
    [1] = {            /* interrupt */
        .start = IRQ_DM3XX_MMCINT1,
        .end = IRQ_DM3XX_MMCINT1,
        .flags = IORESOURCE_IRQ,
        },
   
    [2] = {            //dma rx
        .start = DM365_DMA_MMC1RXEVT,
        .end = DM365_DMA_MMC1RXEVT,
        .flags = IORESOURCE_DMA | IORESOURCE_DMA_RX_CHAN,
        },
    [3] = {            // dma tx
        .start = DM365_DMA_MMC1TXEVT,
        .end = DM365_DMA_MMC1TXEVT,
        .flags = IORESOURCE_DMA | IORESOURCE_DMA_TX_CHAN,
        },
    [4] = {            // event queue
        .start    = EVENTQ_3,
        .end    = EVENTQ_3,
        .flags    = IORESOURCE_DMA | IORESOURCE_DMA_EVENT_Q,
        },
};

static struct davinci_mmc_platform_data mmc1_platform_data = {
    .mmc_clk = "MMCSDCLK1",
    .rw_threshold = 64,
    .use_4bit_mode = 1,
    .use_8bit_mode = 0,
    .max_frq = 50000000,
    .pio_set_dmatrig = 1,
};

static struct platform_device mmc1_device = {
    .name = "davinci-mmc",
    .id = 1,
    .dev = {
        .platform_data = &mmc1_platform_data,
        },
    .num_resources = ARRAY_SIZE(mmc1_resources),
    .resource = mmc1_resources,
};

2.edma.h, modify :

#define DM365_DMACH2EVENT_MAP0        0xCC00000Cu

I add some debug informations to show that MMC/SD0 works fine, but MMC/SD1 can not work. How could I make MMC/SD1 work? MMC/SD1 is same with MMC/SD0, what's happened? I do not know . Is there anybody can help me?

B.R.

Rick

 

 

  • Hi Rick,

    differently from MMC/SD0, which pins are dedicated to this function, for MMC/SD1 you need to check PINMUX.

    (from arm subsystem datasheet: pag.127  you see the MMC/SD1 pins, at page.116 the offset of PINMUX4  and pag.27 you see the System Control Module base address)

    So:

    devmem2 0x01c40010

    tells you if your MMC/SD1 are correctly set.

    If not, look at arch/arm/mach-davinci/dm365.c and add the lines you need.

    Don't forget to add also lines in arch/arm/mach-davinci/include/mach/mux.h in davinci_dm365_index enum.

    For examples DM365_I2C_SDA enum has to match with

    MUX_CFG(DM365,  I2C_SDA,        3,   23,    3,    2,     false)

    line

    where MUX_CFG works like this:
    3 = number of pinmux .. in your case 4
    23 = less significant position of you setting .. for MMCSD1_CMD it is 30
    3 = the setting mask .. for MMCSD1_CMD you need 2 bits, so you need to set 3
    2 = the pinmux value of the pin .. for MMCSD1_CMD you need to set 1
    false = it means debug not active

    After that you have to see if mmc code use this gpios.

     

    Hoping it helps,
    Raffaele