bbtoys wlan adapter (wl1271) and regulators

Hi Beagle friends,

I have a question on how to link regulators to mmc devices on
beagleboard. I see that there's a patch adding wl1271 support to
beagleboard so that the bbtoys wl1271 will work. Looking at this
patch, I see:

http://repo.or.cz/w/openembedded.git/blob/HEAD:/recipes/linux/linux-omap-2.6.37/base/0013-omap3-beagleboard-add-WIP-support-for-beagleboardtoy.patch

  33 + static struct omap2_hsmmc_info mmcbbt[] = {
  34 + {
  35 + .mmc = 1,
  36 + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
  37 + .gpio_wp = 29,
  38 + },
  39 + {
  40 + .name = "wl1271",
  41 + .mmc = 2,
  42 + .caps = MMC_CAP_4_BIT_DATA |
MMC_CAP_POWER_OFF_CARD,
  43 + .gpio_wp = -EINVAL,
  44 + .gpio_cd = -EINVAL,
  45 + .nonremovable = true,
  46 + },
  47 + {} /* Terminator */
  48 + };

I'm not sure why that additional wl1271 entry didn't just get appended
into the regular mmc structure which is just above:

static struct omap2_hsmmc_info mmc[] = {
        {
                .mmc = 1,
                .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
                .gpio_wp = 29,
        },
        {} /* Terminator */
};

I then got really confused by this:

+#if defined(CONFIG_WL1271) || defined(CONFIG_WL1271_MODULE)
  90 + if(!strcmp(expansionboard_name, "bbtoys-wifi")) {
  91 + omap2_hsmmc_init(mmcbbt);
  92 + /* link regulators to MMC adapters */
  93 + beagle_vmmc1_supply.dev = mmcbbt[0].dev;
  94 + beagle_vsim_supply.dev = mmcbbt[0].dev;
  95 + } else {
  96 + omap2_hsmmc_init(mmc);
  97 + /* link regulators to MMC adapters */
  98 + beagle_vmmc1_supply.dev = mmc[0].dev;
  99 + beagle_vsim_supply.dev = mmc[0].dev;
100 + }
101 +#else
102 omap2_hsmmc_init(mmc);
103 -
104 /* link regulators to MMC adapters */
105 beagle_vmmc1_supply.dev = mmc[0].dev;
106 beagle_vsim_supply.dev = mmc[0].dev;
107 +#endif

Is all that conditioning needed? At the end, I don't think any
regulator ends up linked to mmc[1]/wifi anyway.

I ask because I'm trying to get wl1271 to work on MMC3 using a board
that's similar to beagleboard-xm and finding that to be a non-trivial
task. If anyone is interested, I have posted my full board file and
bootlog on the rowboat mailing list:

http://groups.google.com/group/rowboat/browse_thread/thread/02b1cdb272b4c4b1

I would welcome any feedback/advice on this.

Thanks,
jayakumar

[...]

I ask because I'm trying to get wl1271 to work on MMC3 using a board
that's similar to beagleboard-xm and finding that to be a non-trivial
task. If anyone is interested, I have posted my full board file and
bootlog on the rowboat mailing list:

http://groups.google.com/group/rowboat/browse_thread/thread/02b1cdb272b4c4b1

On a short look, I'd suggest adding

.min_uV = 1800000,
.max_uV = 1800000,

to your wiser2_vmmc3.constraints as the voltage to be set is compared to the defined capabilities of the regulator.

Something like:

  .constraints = {
    .valid_ops_mask = REGULATOR_CHANGE_STATUS,
    .valid_modes_mask = REGULATOR_MODE_NORMAL,
    .min_uV = 1800000,
    .max_uV = 1800000,
    .apply_uV = true,
    .always_on = true,
  },

should give you a working configuration.