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.

DM365 MMC1 problem

Hi,

  I have a problem using dm365 mmc1,but mmc1 clk pin is always high,console is always print error as below:

mmc1: host doesn't support card's voltages
mmc1: error -22 whilst initialising SDIO card

dm365 sdk is dvsdk_dm365-evm_4_02_00_06,linux kernel 2.6.32

I config mmc1 as below,I want to know why the mmc1 couldnot work?why mmc1 clock pin is always high?

arch\arm\mach-davinci\board-dm365-evm.c,added the last two line

static __init void dm365_evm_init(void)
{
 evm_init_i2c();
 davinci_serial_init(&uart_config);

 dm365evm_emac_configure();
 dm365evm_usb_configure();

 davinci_setup_mmc(0, &dm365evm_mmc_config);
 /* maybe setup mmc1/etc ... _after_ mmc0 */
 dm365evm_mmc_configure();
 davinci_setup_mmc(1, &dm365evm_mmc_config);

arch\arm\mach-davinci\devices.c function davinci_setup_mmc()

 case 1:
  if (cpu_is_davinci_dm355()) {
   /* REVISIT we may not need all these pins if e.g. this
    * is a hard-wired SDIO device...
    */
   davinci_cfg_reg(DM355_SD1_CMD);
   davinci_cfg_reg(DM355_SD1_CLK);
   davinci_cfg_reg(DM355_SD1_DATA0);
   davinci_cfg_reg(DM355_SD1_DATA1);
   davinci_cfg_reg(DM355_SD1_DATA2);
   davinci_cfg_reg(DM355_SD1_DATA3);
  } else if (cpu_is_davinci_dm365()) {
   void __iomem *pupdctl1 =
    IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE + 0x7c);

   /* Configure pull down control */
   __raw_writel((__raw_readl(pupdctl1) & ~0xfc0),
     pupdctl1);

   mmcsd1_resources[0].start = DM365_MMCSD1_BASE;
   mmcsd1_resources[0].end = DM365_MMCSD1_BASE +
       SZ_4K - 1;
   mmcsd1_resources[2].start = IRQ_DM365_SDIOINT1;
  } else
   break;

  pdev = &davinci_mmcsd1_device;

 

  • have you checked your pin mux in dm365.c?

  • I have checked my pin mux in dm365.c

    static const struct mux_config dm365_pins[] = {
    #ifdef CONFIG_DAVINCI_MUX
    MUX_CFG(DM365, MMCSD0,  0,   24,     1,   0,  false)

    MUX_CFG(DM365, SD1_CLK, 0,   16,    3,   1,  false)
    MUX_CFG(DM365, SD1_CMD, 4,   30,    3,   1,  false)
    MUX_CFG(DM365, SD1_DATA3, 4,   28,    3,   1,  false)
    MUX_CFG(DM365, SD1_DATA2, 4,   26,    3,   1,  false)
    MUX_CFG(DM365, SD1_DATA1, 4,   24,    3,   1,  false)
    MUX_CFG(DM365, SD1_DATA0, 4,   22,    3,   1,  false)

    in datasheet describe as below:

  • The MUX_CFG entries in dm365.c define the mux register address and value for a particular function. Definition is that array does not mean that the mux is configured. MMC1 pinmux config appears to be configure in the board-dm365-evm.c: evm_init_cpld(). That function also contains the lines that you added.  You should remove those lines. The evm_init_cpld() function will enable MMC1 if there is no imager. I am not familiar with your EVM. Is there an imager plugged in?

  • My EVB has support for imager interface,and the log include this line:

    EVM: HD imager video input

  • I would guess that MMC1 and the imager are mutually exclusive. I thought it might be an auto-detect via HW thing but it looks like it is a kernel config thing. From the kernel menuconfig see:

    Device Drivers
    ->Multimedia Support
    -->Video for Linux and device drivers
    --->Multimedia Support
    ---->Video Capture Adapters
    ----->mt9p031 support

    Disabling mt9p031 should cause MMC1 to be enabled. The bootup message should change. You will lose your imager if you have one.

  • what hardware are you using?

    I have a custom dm368 board, with SD0 , SD1 and CMOS image sensor, and they are working fine.
    I compared your code with mine, I don't see anything different. Is it possible you have other modules overwriting your configuration after SD1 initialization? You can verify this by reading back the pinmux registers after Linux is up and running.

  • Some observations from inspection of the code. Likely all wrong. I'm happy to be corrected.

    I believe board-dm365-evm.c is written for the TI endorsed EVM from Spectrum Digital. The board has an external mux that switches those DM365 pins between the SD Card socket and the imager GPIOs (via the CPLD). The external mux is controlled by the CPLD. The CPLD mux is configured in dm365evm_setup_video_input(). If the kernel is configured for the MT9P031 imager, the CPLD will be configured to externally mux in the imager GPIOs and unmux the SD Card socket. So regardless of the internal DM365 pinmux, the SD Card socket will be disconnected.

    From the code, it appears that only one of the shared pins are actually used. In dm365evm_reset_imager(), GPIO 40 is used to reset the sensor. If there was another way to reset the sensor and the imager GPIOs are not used, it is plausible that MMC1 could be used at the same time as the imager. All depends if the CPLD has any internal dependencies on the its mux register setting.

  • Thank you very much,I disable mt9p031 in my kernel config,and the MMC can work now,but it appeared a command CRC error,after some times is OK

    Please wait: booting...
    mmc1: card claims to support voltages below the defined range. These will be ignored.
    davinci_mmc davinci_mmc.1: Command CRC error
    mmc1: error -84 whilst initialising SDIO card
    Starting udev
    mmc1: card claims to support voltages below the defined range. These will be ignored.
    davinci_mmc davinci_mmc.1: Command CRC error
    mmc1: error -84 whilst initialising SDIO card
    mmc1: card claims to support voltages below the defined range. These will be ignored.
    mmc1: new SDIO card at address 0001
    udev: starting version 141
    Remounting root file system...
    Caching udev devnodes

  • No idea about those errors. Perhaps the external mux takes time to settle. Maybe try inserting the SD card after fully booted.