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.

AM1808 + Micro SDcard

Other Parts Discussed in Thread: AM1808

Hi,

I have interfaced AM1808 MMCSD0 to micro sdcard, below are the pin configuration.

SD_CLK --> MMCSD0_CLK

SD_CMD --> MMCSD0_CMD

SD_DATA0 --> MMCSD0_DAT[0]

SD_DATA1 --> MMCSD0_DAT[1]

SD_DATA2 --> MMCSD0_DAT[2]

SD_DATA3 --> MMCSD0_DAT[3]

There is no card detect and write protect pin... When i boot the kernel no mmc blocks are detected. What changes in the kernel i need to do for card detection.

Kernel version : 

root@am180x-evm:~# uname -a
Linux am180x-evm 2.6.33-rc4 #9 PREEMPT Tue Sep 27 11:02:26 IST 2016 armv5tejl GNU/Linux

Thanks and Regards,

Dileep

  • Are you using EVM board or custom board ?
    Please make sure that you enabled the Davinci MMC support in linux kernel through make menuconfig option.
    Also you should do PINMUX code for MMC interface in board file.
  • Hi Titus,

    I am working on a custom board. Have enabled Davinci MMC support in kernel.

    Pin mux
    /* MMC/SD0 function */
    MUX_CFG(DA850, MMCSD0_DAT_0, 10, 8, 15, 2, false)
    MUX_CFG(DA850, MMCSD0_DAT_1, 10, 12, 15, 2, false)
    MUX_CFG(DA850, MMCSD0_DAT_2, 10, 16, 15, 2, false)
    MUX_CFG(DA850, MMCSD0_DAT_3, 10, 20, 15, 2, false)
    MUX_CFG(DA850, MMCSD0_CLK, 10, 0, 15, 2, false)
    MUX_CFG(DA850, MMCSD0_CMD, 10, 4, 15, 2, false)
    /* EMIF2.5/EMIFA function */
    ...
    ...
    MUX_CFG(DA850, EMA_A_16, 10, 28, 15, 1, false)
    MUX_CFG(DA850, EMA_A_17, 10, 24, 15, 1, false)
    // MUX_CFG(DA850, EMA_A_18, 10, 20, 15, 1, false)
    // MUX_CFG(DA850, EMA_A_19, 10, 16, 15, 1, false)
    // MUX_CFG(DA850, EMA_A_20, 10, 12, 15, 1, false)
    // MUX_CFG(DA850, EMA_A_21, 10, 8, 15, 1, false)
    // MUX_CFG(DA850, EMA_A_22, 10, 4, 15, 1, false)
    // MUX_CFG(DA850, EMA_A_23, 10, 0, 15, 1, false)


    Still not able to detect sdcard.

    Regards,
    Dileep
  • How did you connect the CARD DETECT to AM1808 ?
    Did you enable the below option in MMC driver via make menuconfig ?

    [* ] Assume MMC/SD cards are non-removable


    You can try to connect the CARD DETECT (CD) pin to GPIO and control it.

  • That is a very old kernel. Newer kernels handle SD/WP differently. There are many threads on this forum about handling a microSD. The code that you noted just defines the mux register location and setting. It does not actuallly configure the mux. The following changes assume that you have a card or memory permanently installed and permanently writeable.

    arch/arm/mach-davinci/da850.c
    const short da850_mmcsd0_pins[] __initdata = {
      DA850_MMCSD0_DAT_0, DA850_MMCSD0_DAT_1, DA850_MMCSD0_DAT_2,
      DA850_MMCSD0_DAT_3, DA850_MMCSD0_CLK, DA850_MMCSD0_CMD,
    //DA850_GPIO4_0, DA850_GPIO4_1, ////Comment out or remove
      -1
    };
    
    arch_arm_mach-davinci_board-da850-evm.c
    //#define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0) ////Comment out or remove
    //#define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1) ////Comment out or remove
    ...
    static int da850_evm_mmc_get_ro(int index)
    {
    //return gpio_get_value(DA850_MMCSD_WP_PIN); ////Comment out or remove
      return 0; ////Add. 1 for read only, 0 for writeable
    }
    
    static int da850_evm_mmc_get_cd(int index)
    {
    //return !gpio_get_value(DA850_MMCSD_CD_PIN); ////Comment out or remove
      return 1; ////Add. 1 for permanently inserted
    }
    ...
    static __init void da850_evm_init(void)
    {
      ////Comment out or remove following
      //ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
      //if (ret)
      //  pr_warning("da850_evm_init: can not open GPIO %d\n",
      //    DA850_MMCSD_CD_PIN);
      //gpio_direction_input(DA850_MMCSD_CD_PIN);
      //
      //ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n");
      //if (ret)
      //pr_warning("da850_evm_init: can not open GPIO %d\n",
      //  DA850_MMCSD_WP_PIN);
      //gpio_direction_input(DA850_MMCSD_WP_PIN);
      //
      ret = da8xx_register_mmcsd0(&da850_mmc_config);
      if (ret)
        pr_warning("da850_evm_init: mmcsd0 registration failed:"
          " %d\n", ret);
    

    Some people replace the SD/WP with buttons connected to GPIOs. Others use flags set in some GUI. I've seen tablets and smartphones do this.