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.

Detect sd card insert

Hi,

I am booting from NAND flash, after linux is booted I insert a sd card of FAT£2 the linux fails to detect it, If I do fdisk -l it doesnt show up any pointers on what could be missing ?


Thanks And Regards

Mike

  • Mike,

    Check if "Assume MMC/SD cards are non-removable" option is enabled in your linux kernel. If yes, remove/disable this option. Refer to the below wiki for more info:

    processors.wiki.ti.com/.../TI81XX_PSP_MMC_SD_Driver_User_Guide

    BR
    Pavel
  • Hi Pavel,

    [ ] Assume MMC/SD cards are non-removable (DANGEROUS)

    Is not selected in my current config.

    Thanks And Regards,
    Mike
  • Mike,

    I made a test in the past.

    The test is made with:

    1. DM8148 Mistral TI EVM

    2. DM8148 silicon revision 2.1

    3. EZSDK 5.05.02.00

    4. PSP 04.04.00.01

    5. Micro SDHC card, ADATA, 4GB (plugged into ADATA Micro SD adapter)

    6. Boot u-boot (1st and 2nd stage) from UART, TFTP uImage through the EMAC port 0, NFS filesystem (targetfs)

    When testing with the default EZSDK/PSP source code, the SD card can be identified for more then 10 times of pluging in and out rapidly. The MMC/SD hot insertion (plug) and hot removal feature seems to work fine. These are the messages, when  make hot insertion:

    root@dm814x-evm:~# mmc0: new high speed SDHC card at address 0002

    mmcblk0: mmc0:0002 00000 3.70 GiB

    mmcblk0: p1 p2

    FAT: bogus number of reserved sectors

    VFS: Can't find a valid FAT filesystem on dev mmcblk0.

    EXT3-fs: barriers not enabled

    kjournald starting.  Commit interval 5 seconds

    EXT3-fs (mmcblk0p2): using internal journal

    EXT3-fs (mmcblk0p2): recovery complete

    EXT3-fs (mmcblk0p2): mounted filesystem with writeback data mode

    Then the Enter is pressed, and the SDHC card can be accessed successfully. The SDHC card successful identification is reported through the below messages:

    mmc0: new high speed SDHC card at address 0002

    mmcblk0: mmc0:0002 00000 3.70 GiB

    mmcblk0: p1 p2

    These are the messages when make hot removal:

    root@dm814x-evm:/# mmc0: card 0002 removed

    EXT3-fs (mmcblk0p2): I/O error while writing superblock

    Then the Enter is pressed, and the SDHC card is removed successfully.

    Can you try to reproduce this issue on DM814x EVM? Is the issue valid only on your custom board?

    Can you try with different MMC/SD card?


    The below wiki pages states that MMC/SD hot plug/insert is supported:

    Support:

    MMC/SD card hot insertion and removal

    The driver supports the following features:

    5. MMC/SD card hot insertion and removal

    See also if the below pointers will help:

    BR
    Pavel

  • Hi Pavel,

    static struct omap2_hsmmc_info mmc[] = {
    #ifdef CONFIG_WL12XX_PLATFORM_DATA
        {
            .mmc        = 1,
            .caps        = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
            .gpio_cd    = -EINVAL,
            .gpio_wp    = -EINVAL,
            .ocr_mask    = MMC_VDD_33_34,
            .nonremovable    = true,
        },
    #endif
        {
            .mmc        = 2,
            .caps        = MMC_CAP_4_BIT_DATA,
            .gpio_cd        = -EINVAL, /* check setup_mmc2_pin_mux() */
            .gpio_wp    = -EINVAL,
            .ocr_mask    = MMC_VDD_33_34,
        },
        {}    /* Terminator */
    };

    Do I need to add GPIO pins to detect the hot plug ? because I see cd is connected to GP1[6] and wp to GP1[3] ?

    Thanks And Regards,

    Mike

  • Mike,

    mike A said:
    because I see cd is connected to GP1[6] and wp to GP1[3] ?

    Where do you see this?

    mike A said:
    Do I need to add GPIO pins to detect the hot plug ?

    If not using the SD card connector CD pin, then yes, GPIO pin is needed. DM814x TI EVM is using MMC1/SD1 controller, connect SD1_SDCD/MMC1_SD_CD (pin AE5) to SD card connector CD pin 15, no GPIO is needed.

    linux-kernel/arch/arm/mach-omap2/board-ti8148evm.c

    static struct omap2_hsmmc_info mmc[] = {
        {
            .mmc        = 2,
            .caps        = MMC_CAP_4_BIT_DATA,
            .gpio_cd        = -EINVAL, /* check setup_mmc2_pin_mux() */
            .gpio_wp    = -EINVAL,
            .ocr_mask    = MMC_VDD_33_34,
        },
        {}    /* Terminator */
    };

    I see that GPIO pin for CD is used in J5Eco/TI811x EVM and DM814x IPNC board:

    linux-kernel/arch/arm/mach-omap2/board-ti811xevm.c

    static struct omap2_hsmmc_info mmc[] = {
        {
            .mmc        = 1,
            .caps        = MMC_CAP_4_BIT_DATA,
            .gpio_cd    = GPIO_TO_PIN(1, 6), /* Dedicated pins for CD and WP */
            .gpio_wp    = GPIO_TO_PIN(1, 3),
            .ocr_mask    = MMC_VDD_33_34,
        },
        {}    /* Terminator */
    };

     

    linux-kernel/arch/arm/mach-omap2/board-ti8148ipnc.c

    static struct omap2_hsmmc_info mmc[] = {
           {
    #ifdef CONFIG_WL12XX_PLATFORM_DATA
    /* WLAN_EN is GP2[22] */
    #define GPIO_WLAN_EN    ((2 * 32) + 22)
    /* WLAN_IRQ is GP2[24] */
    #define GPIO_WLAN_IRQ    ((2 * 32) + 24)
            .mmc        = 1,
            .caps        = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
            .gpio_cd    = -EINVAL,
            .gpio_wp    = -EINVAL,
            .ocr_mask    = MMC_VDD_165_195,
            .nonremovable    = true,
        },
        {
            .mmc            = 2,
    #else
            .mmc        = 1,
    #endif
            .caps        = MMC_CAP_4_BIT_DATA,
                   .gpio_cd        = 79,/* Dedicated pins for CD and WP */
                   .gpio_wp        = 80,
                   .ocr_mask       = MMC_VDD_33_34,
           },
           {}      /* Terminator */
    };

    BR
    Pavel
     

  • See also if the below pointers will help:

    7651.MMC.rtf

    BR
    Pavel

  • Hi Pavel,

    I included the .gpio_cd = GPIO_TO_PIN(1, 6), and it can detect hot plugs now.

    Thanks And Regards,
    Mike