Skip to content

Commit

Permalink
SD/MMC Regulator fixes for BUGBase..
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Isaacs <izzy@buglabs.net>
  • Loading branch information
Matt Isaacs committed Nov 11, 2010
1 parent dbd3dab commit 066f368
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 40 deletions.
115 changes: 78 additions & 37 deletions arch/arm/mach-omap2/board-omap3bug.c
Expand Up @@ -149,13 +149,7 @@ static struct platform_device omap3bug_nand_device = {

static struct regulator_consumer_supply bug_vmmc_supplies[] = {
{
.supply = "vmmc",
},
{
.supply = "vmmc",
},
{
.supply = "vmmc",
.supply = "vmmc0",
},
};

Expand All @@ -174,6 +168,7 @@ static struct regulator_init_data bug_vmmc1 = {
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
| REGULATOR_CHANGE_MODE
| REGULATOR_CHANGE_STATUS,
.boot_on = true,
},
.num_consumer_supplies = ARRAY_SIZE(bug_vmmc_supplies),
.consumer_supplies = bug_vmmc_supplies,
Expand All @@ -182,6 +177,7 @@ static struct regulator_init_data bug_vmmc1 = {
/* VAUX2 for USB PHY (max 100 mA) */
static struct regulator_init_data bug_vaux2 = {
.constraints = {
.name = "VAUX2",
.min_uV = 1800000,
.max_uV = 1800000,
.apply_uV = true,
Expand All @@ -197,34 +193,78 @@ static struct regulator_init_data bug_vaux2 = {
};

/* Supply enable for digital video outputs */
static struct regulator_consumer_supply bug_disp_supplies[] = {
{
.supply= "vdds_dsi",
.dev= &omap3_bug_dss_device.dev,
}
static struct regulator_consumer_supply bug_1_8_supplies[] = {
{
.supply= "vdds_dsi",
.dev= &omap3_bug_dss_device.dev,
},
{
.supply = "vmmc2",
},
};

static struct regulator_init_data bug_disp_data = {
.constraints = {
.always_on = 1,
},
.num_consumer_supplies= ARRAY_SIZE(bug_disp_supplies),
.consumer_supplies= bug_disp_supplies,

static struct regulator_init_data bug_fixed_1_8_data = {
.constraints = {
.min_uV = 1800000,
.max_uV = 1800000,
.apply_uV = true,
.boot_on = true,
.valid_modes_mask = REGULATOR_MODE_NORMAL
| REGULATOR_MODE_STANDBY,
.always_on = true,
},
.num_consumer_supplies= ARRAY_SIZE(bug_1_8_supplies),
.consumer_supplies= bug_1_8_supplies,
};

static struct fixed_voltage_config bug_disp_pwr_pdata = {
.supply_name = "VLCD",
.microvolts = 5000000,
.init_data = &bug_disp_data,
static struct fixed_voltage_config bug_fixed_1_8_pdata = {
.supply_name = "V1.8",
.microvolts = 1800000,
.init_data = &bug_fixed_1_8_data,
.gpio = -1,
};

static struct platform_device bug_disp_pwr = {
static struct platform_device bug_fixed_1_8 = {
.name = "reg-fixed-voltage",
.id = -1,
.dev = {
.platform_data = &bug_disp_pwr_pdata,
.platform_data = &bug_fixed_1_8_pdata,
},
};

static struct regulator_consumer_supply bug_sd_supplies[] = {
{
.supply = "vmmc1",
},
};

static struct regulator_init_data bug_fixed_sd_data = {
.constraints = {
.min_uV = 3300000,
.max_uV = 3300000,
.apply_uV = true,
.boot_on = true,
.valid_modes_mask = REGULATOR_MODE_NORMAL
| REGULATOR_MODE_STANDBY,

.always_on = true,
},
.num_consumer_supplies= ARRAY_SIZE(bug_sd_supplies),
.consumer_supplies= bug_sd_supplies,
};

static struct fixed_voltage_config bug_fixed_sd_pdata = {
.supply_name = "SD",
.microvolts = 300000,
.init_data = &bug_fixed_sd_data,
.gpio = 35,
};

static struct platform_device bug_fixed_sd = {
.name = "reg-fixed-voltage",
.id = -1,
.dev = {
.platform_data = &bug_fixed_sd_pdata,
},
};

Expand Down Expand Up @@ -914,7 +954,7 @@ static struct platform_device omap3_bug_pwm_gpt11 = {

static struct platform_device *omap3_bug_devices[] __initdata = {

&bug_disp_pwr,
&bug_fixed_1_8,
&omap3_bug_dss_device,
&omap3bug_vout_device,
&omap3_bug_pwr_switch,
Expand All @@ -937,18 +977,18 @@ static struct twl4030_hsmmc_info mmc[] __initdata = {
.gpio_wp = -EINVAL,
},
{
.mmc = 2,
.wires = 4,
.gpio_cd = 170,
//.gpio_wp = 63,
.ocr_mask = MMC_VDD_32_33,
.mmc = 2,
.wires = 4,
.gpio_cd = 170,
//.gpio_wp = 63,
.ocr_mask = MMC_VDD_32_33,
},
{
.mmc = 3,
.wires = 1,
.gpio_cd = -EINVAL,
.gpio_wp = -EINVAL,
.ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33,
.mmc = 3,
.wires = 1,
.gpio_cd = -EINVAL,
.gpio_wp = -EINVAL,
.ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33,
},
{} /* Terminator */
};
Expand Down Expand Up @@ -1117,12 +1157,13 @@ void gen_gpio_settings(void)
return;
}
gpio_direction_output(109, 1);

/*
r = gpio_request(35, "mmc1_enable");
if (r) {
printk(KERN_ERR "gen_gpio: failed to get mmc1_enable...\n");
return;
}
*/
gpio_direction_output(35, 1);

r = gpio_request(108, "audio_mute");
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/mach-omap2/mmc-twl4030.c
Expand Up @@ -91,7 +91,6 @@ static int twl_mmc_late_init(struct device *dev)
struct omap_mmc_platform_data *mmc = dev->platform_data;
int ret = 0;
int i;

/* MMC/SD/SDIO doesn't require a card detect switch */
if (gpio_is_valid(mmc->slots[0].switch_pin)) {
ret = gpio_request(mmc->slots[0].switch_pin, "mmc_cd");
Expand All @@ -106,10 +105,11 @@ static int twl_mmc_late_init(struct device *dev)
for (i = 0; i < ARRAY_SIZE(hsmmc); i++) {
if (hsmmc[i].name == mmc->slots[0].name) {
struct regulator *reg;
char reg_name[6];

hsmmc[i].mmc = mmc;

reg = regulator_get(dev, "vmmc");
sprintf(reg_name, "vmmc%d",i);
reg = regulator_get(dev, reg_name);
if (IS_ERR(reg)) {
dev_dbg(dev, "vmmc regulator missing\n");
/* HACK: until fixed.c regulator is usable,
Expand Down

0 comments on commit 066f368

Please sign in to comment.