SD card with VMMC2 in 2.6.37 with TPS65950/DM3730

Hi Rowboat and Beagle friends,

With 2.6.32, I have fully working SD card interface via 2nd MMC on a
DM3730 board based on Beagle-XM. That is, upon insertion of the SD
card, I see:

mmc1: new SD card at address a95c
mmcblk1: mmc1:a95c SD128 120 MiB
mmcblk1: p1
# mkdir /tmp/b
root@localhost:/# mount /dev/block/mmcblk1p1 /tmp/b
root@localhost:/# find /tmp/b
/tmp/b
/tmp/b/files
<snip>

So everything is happy.

With 2.6.37 on the same setup, I'm not able to talk to 2nd MMC and am
having difficulty figuring out why not. Here's what I see upon
insertion of the SD card:

# [ 42.995117] mmc1: mmc_rescan: trying to init card at 400000 Hz
[ 43.001525] twl4030ldo_set_voltage:343 min=3100000, max=3150000
[ 120.837036] mmc1: clock 0Hz busmode 1 powermode 1 cs 0 Vdd 19 width
0 timing 0
[ 120.861968] mmc1: clock 400000Hz busmode 1 powermode 2 cs 0 Vdd 19
width 0 timing 0
[ 120.885284] mmc1: starting CMD52 arg 00000c00 flags 00000195
[ 120.885284] mmci-omap-hs mmci-omap-hs.1: mmc1: CMD52, argument 0x00000c00
[ 120.885711] mmc1: req done (CMD52): -110: 00000000 00000000 00000000 00000000
[ 120.885742] mmc1: starting CMD52 arg 80000c08 flags 00000195
[ 120.885772] mmci-omap-hs mmci-omap-hs.1: mmc1: CMD52, argument 0x80000c08
[ 120.886169] mmc1: req done (CMD52): -110: 00000000 00000000 00000000 00000000
[ 120.886199] mmc1: clock 400000Hz busmode 1 powermode 2 cs 1 Vdd 19
width 0 timing 0
[ 120.887207] mmc1: starting CMD0 arg 00000000 flags 000000c0
[ 120.887237] mmci-omap-hs mmci-omap-hs.1: mmc1: CMD0, argument 0x00000000
[ 120.887451] mmc1: req done (CMD0): 0: 00000000 00000000 00000000 00000000
[ 120.888458] mmc1: clock 400000Hz busmode 1 powermode 2 cs 0 Vdd 19
width 0 timing 0
[ 120.889465] mmc1: starting CMD8 arg 000001aa flags 000002f5
[ 120.889495] mmci-omap-hs mmci-omap-hs.1: mmc1: CMD8, argument 0x000001aa
[ 120.889892] mmc1: req done (CMD8): -110: 00000000 00000000 00000000 00000000
[ 120.889923] mmc1: starting CMD5 arg 00000000 flags 000002e1
[ 120.889953] mmci-omap-hs mmci-omap-hs.1: mmc1: CMD5, argument 0x00000000
[ 120.890350] mmc1: req failed (CMD5): -110, retrying...
[ 120.890350] mmci-omap-hs mmci-omap-hs.1: mmc1: CMD5, argument 0x00000000
[ 120.890777] mmc1: req failed (CMD5): -110, retrying...
[ 120.890777] mmci-omap-hs mmci-omap-hs.1: mmc1: CMD5, argument 0x00000000
[ 120.891174] mmc1: req failed (CMD5): -110, retrying...
[ 120.891204] mmci-omap-hs mmci-omap-hs.1: mmc1: CMD5, argument 0x00000000
[ 120.891601] mmc1: req done (CMD5): -110: 00000000 00000000 00000000 00000000
[ 120.891632] mmc1: starting CMD55 arg 00000000 flags 000000f5
[ 120.891632] mmci-omap-hs mmci-omap-hs.1: mmc1: CMD55, argument 0x00000000
[ 120.892059] mmc1: req done (CMD55): -110: 00000000 00000000 00000000 00000000
[ 120.892089] mmc1: starting CMD55 arg 00000000 flags 000000f5
[ 120.892089] mmci-omap-hs mmci-omap-hs.1: mmc1: CMD55, argument 0x00000000
[ 120.892517] mmc1: req done (CMD55): -110: 00000000 00000000 00000000 00000000
[ 120.892517] mmc1: starting CMD55 arg 00000000 flags 000000f5
[ 120.892547] mmci-omap-hs mmci-omap-hs.1: mmc1: CMD55, argument 0x00000000
[ 120.892944] mmc1: req done (CMD55): -110: 00000000 00000000 00000000 00000000
[ 120.892974] mmc1: starting CMD55 arg 00000000 flags 000000f5
[ 120.893005] mmci-omap-hs mmci-omap-hs.1: mmc1: CMD55, argument 0x00000000
[ 120.893402] mmc1: req done (CMD55): -110: 00000000 00000000 00000000 00000000
[ 120.893432] mmc1: starting CMD1 arg 00000000 flags 000000e1
[ 120.893432] mmci-omap-hs mmci-omap-hs.1: mmc1: CMD1, argument 0x00000000
[ 120.893859] mmc1: req done (CMD1): -110: 00000000 00000000 00000000 00000000
[ 120.893890] mmc1: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0 timing 0

As shown above, mmc1 detection fails. I put debug into the twl4030
regulator code since I suspect that the VMMC2 regulator on the
TPS65950 isn't getting enabled. When I measure the voltage at the
VMMC2 pin of the SD card connector (with 2.6.37 running) and the SD
inserted, I see it reading 0V. With 2.6.32, I see the same pin read as
3.11V. That said, the call to twl4030ldo_set_voltage succeeds and I
don't see any errors reported about regulators or voltage. I've got
regulator debug and mmc debug enabled and still don't see any error
messages. Here's the bootup regulator report on 2.6.37:

[ 0.037567] omap_device: omap_i2c.1: new worst case activate latency 0: 30517
[ 0.045532] omap_i2c omap_i2c.1: bus 1 rev4.0 at 2600 kHz
[ 0.048492] twl4030: PIH (irq 7) chaining IRQs 368..375
[ 0.048522] twl4030: power (irq 373) chaining IRQs 376..383
[ 0.049072] twl4030: gpio (irq 368) chaining IRQs 384..401
[ 0.051818] regulator: VUSB1V5: 1500 mV normal standby
[ 0.052520] regulator: VUSB1V8: 1800 mV normal standby
[ 0.053222] regulator: VUSB3V1: 3100 mV normal standby
[ 0.056610] twl4030_usb twl4030_usb: Initialized TWL4030 USB module
[ 0.057891] regulator: VMMC1: 1850 <--> 3150 mV at 3000 mV normal standby
[ 0.058563] regulator: VDAC: 1800 mV normal standby
[ 0.059265] regulator: VDVI: 1800 mV normal standby
[ 0.060028] regulator: VMMC2: 1850 <--> 3150 mV at 2600 mV normal standby
[ 0.060791] regulator: VSIM: 1800 <--> 3000 mV at 1800 mV normal standby
[ 0.061523] twl4030ldo_set_voltage:343 min=1800000, max=1800000
[ 0.061614] regulator: VAUX3: 1800 mV normal standby
[ 0.062316] twl4030ldo_set_voltage:343 min=1800000, max=1800000
[ 0.062408] regulator: VAUX4: 1800 mV normal standby

All looks fine, just like with 2.6.32, which shows:
i2c_omap i2c_omap.1: bus 1 rev4.0 at 2600 kHz
twl4030: PIH (irq 7) chaining IRQs 368..375
twl4030: power (irq 373) chaining IRQs 376..383
twl4030: gpio (irq 368) chaining IRQs 384..401
regulator: VUSB1V5: 1500 mV normal standby
regulator: VUSB1V8: 1800 mV normal standby
regulator: VUSB3V1: 3100 mV normal standby
twl4030_usb twl4030_usb: Initialized TWL4030 USB module
regulator: VMMC1: 1850 <--> 3150 mV normal standby
regulator: VDAC: 1800 mV normal standby
regulator: VPLL2: 1800 mV normal standby
regulator: VMMC2: 1850 <--> 3150 mV normal standby
regulator: VSIM: 1800 <--> 3000 mV normal standby
regulator: VAUX1: 3000 mV normal standby
i2c_omap i2c_omap.2: bus 2 rev4.0 at 400 kHz
i2c_omap i2c_omap.3: bus 3 rev4.0 at 100 kHz

I'm scratching my head as to where things are going wrong. Here's the
code I'm using on 2.6.37:

static struct omap2_hsmmc_info mmc[] = {
        {
                .mmc = 1,
                .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
                .gpio_wp = -EINVAL,
        },
#if 1
        {
                .mmc = 2,
                .caps = MMC_CAP_4_BIT_DATA,
                .transceiver = true,
                .gpio_wp = 108,
                .gpio_cd = 107,
        },
#endif
#ifdef CONFIG_WL12XX_PLATFORM_DATA
        {
        .name = "wl1271",
        .mmc = 3,
        .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
        .gpio_wp = -EINVAL,
        .gpio_cd = -EINVAL,
        .ocr_mask = MMC_VDD_165_195,
        .nonremovable = true,
        },
#endif
        {} /* Terminator */
};

static struct regulator_consumer_supply wiser2_vmmc2_supply = {
        .supply = "vmmc",
};

static int wiser2_twl_gpio_setup(struct device *dev,
                unsigned gpio, unsigned ngpio)
{
        /* gpio + 0 is "mmc0_cd" (input/IRQ) */
        mmc[0].gpio_cd = gpio + 0;
        omap2_hsmmc_init(mmc);

        /* link regulators to MMC adapters */
        wiser2_vmmc1_supply.dev = mmc[0].dev;
        wiser2_vmmc2_supply.dev = mmc[1].dev;

static struct regulator_init_data wiser2_vmmc2 = {
        .constraints = {
                .min_uV = 1850000,
                .max_uV = 3150000,
                .valid_modes_mask = REGULATOR_MODE_NORMAL
                                        > REGULATOR_MODE_STANDBY,
                .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
                                        > REGULATOR_CHANGE_MODE
                                        > REGULATOR_CHANGE_STATUS,
        },
        .num_consumer_supplies = 1,
        .consumer_supplies = &wiser2_vmmc2_supply,
};

static struct twl4030_platform_data wiser2_twldata = {
        .irq_base = TWL4030_IRQ_BASE,
        .irq_end = TWL4030_IRQ_END,

        /* platform_data for children goes here */
        .usb = &wiser2_usb_data,
        .gpio = &wiser2_gpio_data,
        .codec = &wiser2_codec_data,
        .vmmc1 = &wiser2_vmmc1,
        .vmmc2 = &wiser2_vmmc2,
        .vsim = &wiser2_vsim,
        .vdac = &wiser2_vdac,
        .vpll2 = &wiser2_vpll2,
        .vaux3 = &wiser2_vaux3,
        .vaux4 = &wiser2_vaux4,
};

Any advice or debug suggestions would be greatly welcome.

btw, MMC1 (mmc0) and MMC3 (mmc2) work fine on 2.6.37.
[ 4.435211] mmc0: mmc_rescan: trying to init card at 400000 Hz
[ 4.441772] twl4030ldo_set_voltage:343 min=3100000, max=3150000
[ 5.010437] mmc0: new high speed SD card at address 0002
[ 5.016479] mmcblk0: mmc0:0002 00000 1.86 GiB
[ 5.025177] mmcblk0: p1 p2 p3
[ 5.029602] mmc2: mmc_rescan: trying to init card at 400000 Hz
[ 5.155975] mmc2: card claims to support voltages below the defined
range. These will be ignored.
[ 5.204559] mmc2: queuing unknown CIS tuple 0x91 (3 bytes)
[ 5.213623] mmc2: new SDIO card at address 0001

Thanks,
jaya

Please ignore this mail. After a stiff drink, I noticed that I had
MUXed MMC2_CLK as an output. Problem went away after that. I guess the
regulator was getting turned off sufficiently fast after the timeout
that it looked like it wasn't coming on.

hello ,
i am working on BeagleBoard xm with angstrom distribution. i want communicate with tps65950 chip on BeagleBoard and change Register contents. What I was found, It is possible through I2C communication. Problem is I not able to get chip address of TPS65950 .
and other Problem is What is twl4030.

replay as soon as possible.
thank you.

Hi,

It is possible to communicate to TPS via I2C. The twl4030 driver can work with TPS65950. Please use twl_i2c_write_u8 calls to communicate.

Regards,
Arun

I want to work SD card interface MMC3 2nd MMC on a DM3730 board based on beagle-xm .but I dont know how to do. i know you have finished it.please tell me you how to do it. thank you very much .