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.

am335x mmc setup

Other Parts Discussed in Thread: WL1271, AM3352

Hi All,

I am having trouble figuring out what is wrong with my mmc2 setup.  I am trying to talk to a WL1271 module.  I can see that the clock and cmd toggle when the AM3352 boots Linux... but they never toggle again. 

I have reviewed the following threads:

http://processors.wiki.ti.com/index.php/WL127x_Porting_Guide

http://e2e.ti.com/support/arm/sitara_arm/f/791/t/245394.aspx

I have checked the voltage domains, 3.3v for both.

I have checked my init code in arch/arm/march_omap2/board_am335x.c

(see next post)

I have looked at the mmc clock and cmd.  They only toggle on boot up.

I have looked in /sys/kernel/debug/..../mmc2 and the clocks are all set to 0.  While mmc1 and mmc0 have reasonable numbers.

Is there configuration in the Kernel that needs to change compared to the AM335x SK?

What I would like help with is getting the basic MMC up and running.  What Linux commands can I use to poke the MMC.  It seems to me that getting the MMC talking is the first step that needs to take place.

Thanks for your help!  

I am quite frustrated.

Chuck


  • static struct omap2_hsmmc_info am335x_mmc[] __initdata = {
    {
    .mmc = 1,
    .caps = MMC_CAP_4_BIT_DATA,
    .gpio_cd = GPIO_TO_PIN(0, 20),
    .gpio_wp = -EINVAL,
    .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3V3 */
    },
    {
    .mmc = 2,
    .caps = MMC_CAP_8_BIT_DATA,
    .nonremovable = true,
    .gpio_cd = -EINVAL,
    .gpio_wp = -EINVAL,
    .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3V3 */
    },
    {
    .mmc = 3,
    .name = "wl1271",
    .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
    .nonremovable = true,
    .gpio_cd = -EINVAL,
    .gpio_wp = -EINVAL,
    .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3V3 */
    },
    {} /* Terminator */
    };

    #define AM335XEVM_WLAN_IRQ_GPIO GPIO_TO_PIN(1, 25)

    struct wl12xx_platform_data am335xevm_wlan_data = {
    .irq = OMAP_GPIO_IRQ(AM335XEVM_WLAN_IRQ_GPIO),
    .board_ref_clock = WL12XX_REFCLOCK_38_XTAL, /* 38.4Mhz */
    .bt_enable_gpio = GPIO_TO_PIN(1, 24),
    .wlan_enable_gpio = GPIO_TO_PIN(1, 23),
    };

    /* Module pin mux for wlan */

    static struct pinmux_config mmc2_wl12xx_pin_mux[] = {
    {"gpmc_a1.mmc2_dat0", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
    {"gpmc_a2.mmc2_dat1", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
    {"gpmc_a3.mmc2_dat2", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
    {"gpmc_ben1.mmc2_dat3", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
    {"gpmc_csn3.mmc2_cmd", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
    {"gpmc_clk.mmc2_clk", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
    {NULL, 0},
    };


    static struct pinmux_config wl12xx_pin_mux[] = {
    {"gpmc_a7.gpio1_23", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT_PULLUP}, // wlan enable... note:added pullup
    {"gpmc_a9.gpio1_25", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, // wlan irq
    {"gpmc_a8.gpio1_24", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // BT enable
    // note: got rid of pull up on BT
    {NULL, 0},
    };


    static void wl12xx_bluetooth_enable(void)
    {
    int status = gpio_request(am335xevm_wlan_data.bt_enable_gpio, "bt_en");
    if (status < 0)
    pr_err("Failed to request gpio for bt_enable");

    pr_info("Configure Bluetooth Enable pin...\n");
    gpio_direction_output(am335xevm_wlan_data.bt_enable_gpio, 0);
    }


    static int wl12xx_set_power(struct device *dev, int slot, int on, int vdd)
    {
    if (on) {
    gpio_direction_output(am335xevm_wlan_data.wlan_enable_gpio, 1);

    mdelay(70);
    } else {
    gpio_direction_output(am335xevm_wlan_data.wlan_enable_gpio, 0);
    }

    return 0;
    }


    static void wl12xx_init(void)
    {
    struct device *dev;
    struct omap_mmc_platform_data *pdata;
    int ret;

    setup_pin_mux(wl12xx_pin_mux);
    am335xevm_wlan_data.platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ;
    wl12xx_bluetooth_enable();

    if (wl12xx_set_platform_data(&am335xevm_wlan_data))
    pr_err("error setting wl12xx data\n");

    dev = am335x_mmc[2].dev;
    if (!dev) {
    pr_err("wl12xx mmc device initialization failed\n");
    goto out;
    }

    pdata = dev->platform_data;
    if (!pdata) {
    pr_err("Platfrom data of wl12xx device not set\n");
    goto out;
    }

    ret = gpio_request_one(am335xevm_wlan_data.wlan_enable_gpio,GPIOF_OUT_INIT_HIGH, "wlan_en");
    if (ret) {
    pr_err("Error requesting wlan enable gpio: %d\n", ret);
    goto out;
    }


    pdata->slots[0].set_power = wl12xx_set_power;
    out:
    return;
    }


    static void mmc_init(void)
    {
    setup_pin_mux(mmc0_pin_mux);
    setup_pin_mux(mmc1_pin_mux);
    setup_pin_mux(mmc2_wl12xx_pin_mux);

    omap2_hsmmc_init(am335x_mmc);
    return;
    }

    /* Called as part of board initialization, defined in MACHINE_START */
    static void __init am335x_evm_init(void)
    {
    ...

    pr_info("mmc_init()\n");
    mmc_init();

    pr_info("wl12xx_init()\n");
    wl12xx_init();

    ....

  • Biser,

    Thank you.. Yes I have checked out that post.  I have implimented the changes to the hsmmc.c and ompa_hwmod_3xx_data.c and have had no better results.

    question:  I have hooked up the scope to clock, cmd, and dat0.  I see what looks like SPI traffice on clock and cmd and nothing at all on dat0.  Am I right to assume that the SDIO/MMC interface does not recognize the WL12XX module since it never tries to talk over dat0?

    When I type: ifup wlan0
    Successfully initialized wpa_supplicant
    Could not set interface wlan0 flags: Cannot assign requested address
    WEXT: Could not set interface 'wlan0' UP
    wlan0: Failed to initialize driver interface
    ifconfig: SIOCSIFFLAGS: Cannot assign requested address

    Is this more evidence that I am not getting very far in the init process?

    Thanks,

    Chuck

  • Hi Chuck,

    I'm afraid I cannot help much more on this. It seems that your communication with the WLAN module is failing. Maybe you should ask for support on the WiFi forum: http://e2e.ti.com/support/wireless_connectivity/f/307.aspx

  • Biser,

    Let me limit my question to the MMC only then, ignoring, for the time being, the Wl12XX module. 

    How do I verify correct behavior of the MMC on the AM335x?

    Steps taken so far:

    1) verified pin mux settings.

    2) verified mmc driver set up a la: http://e2e.ti.com/support/arm/sitara_arm/f/791/p/245394/1207567.aspx#1207567

    and: http://e2e.ti.com/support/wireless_connectivity/f/307/p/164162/729299.aspx#729299

    What else can I check?  What are the sw tools that I can use to tickle the MMC and verify its correct behavior?

    Thank you,

    Chuck

  • From what you posted before it seems to me that the MMC driver is working, since it's trying to establish communication. I suggested the other forum to you, because I don't know how SDIO is supported over the MMC. It seems to me that the WLAN responds over the interface with something that the basic SD/MMC driver does not understand.