Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/sameo/mfd-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6:
  mfd: Fix twl4030 boot with twl4030 usb transceiver enabled
  • Loading branch information
Linus Torvalds committed Oct 13, 2009
2 parents 80fa680 + f8ebdff commit 1e103d1
Showing 1 changed file with 46 additions and 43 deletions.
89 changes: 46 additions & 43 deletions drivers/mfd/twl4030-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ static int
add_children(struct twl4030_platform_data *pdata, unsigned long features)
{
struct device *child;
struct device *usb_transceiver = NULL;

if (twl_has_bci() && pdata->bci && !(features & TPS_SUBSET)) {
child = add_child(3, "twl4030_bci",
Expand Down Expand Up @@ -532,16 +531,61 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
}

if (twl_has_usb() && pdata->usb) {

static struct regulator_consumer_supply usb1v5 = {
.supply = "usb1v5",
};
static struct regulator_consumer_supply usb1v8 = {
.supply = "usb1v8",
};
static struct regulator_consumer_supply usb3v1 = {
.supply = "usb3v1",
};

/* First add the regulators so that they can be used by transceiver */
if (twl_has_regulator()) {
/* this is a template that gets copied */
struct regulator_init_data usb_fixed = {
.constraints.valid_modes_mask =
REGULATOR_MODE_NORMAL
| REGULATOR_MODE_STANDBY,
.constraints.valid_ops_mask =
REGULATOR_CHANGE_MODE
| REGULATOR_CHANGE_STATUS,
};

child = add_regulator_linked(TWL4030_REG_VUSB1V5,
&usb_fixed, &usb1v5, 1);
if (IS_ERR(child))
return PTR_ERR(child);

child = add_regulator_linked(TWL4030_REG_VUSB1V8,
&usb_fixed, &usb1v8, 1);
if (IS_ERR(child))
return PTR_ERR(child);

child = add_regulator_linked(TWL4030_REG_VUSB3V1,
&usb_fixed, &usb3v1, 1);
if (IS_ERR(child))
return PTR_ERR(child);

}

child = add_child(0, "twl4030_usb",
pdata->usb, sizeof(*pdata->usb),
true,
/* irq0 = USB_PRES, irq1 = USB */
pdata->irq_base + 8 + 2, pdata->irq_base + 4);

if (IS_ERR(child))
return PTR_ERR(child);

/* we need to connect regulators to this transceiver */
usb_transceiver = child;
if (twl_has_regulator() && child) {
usb1v5.dev = child;
usb1v8.dev = child;
usb3v1.dev = child;
}
}

if (twl_has_watchdog()) {
Expand Down Expand Up @@ -580,47 +624,6 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
return PTR_ERR(child);
}

if (twl_has_regulator() && usb_transceiver) {
static struct regulator_consumer_supply usb1v5 = {
.supply = "usb1v5",
};
static struct regulator_consumer_supply usb1v8 = {
.supply = "usb1v8",
};
static struct regulator_consumer_supply usb3v1 = {
.supply = "usb3v1",
};

/* this is a template that gets copied */
struct regulator_init_data usb_fixed = {
.constraints.valid_modes_mask =
REGULATOR_MODE_NORMAL
| REGULATOR_MODE_STANDBY,
.constraints.valid_ops_mask =
REGULATOR_CHANGE_MODE
| REGULATOR_CHANGE_STATUS,
};

usb1v5.dev = usb_transceiver;
usb1v8.dev = usb_transceiver;
usb3v1.dev = usb_transceiver;

child = add_regulator_linked(TWL4030_REG_VUSB1V5, &usb_fixed,
&usb1v5, 1);
if (IS_ERR(child))
return PTR_ERR(child);

child = add_regulator_linked(TWL4030_REG_VUSB1V8, &usb_fixed,
&usb1v8, 1);
if (IS_ERR(child))
return PTR_ERR(child);

child = add_regulator_linked(TWL4030_REG_VUSB3V1, &usb_fixed,
&usb3v1, 1);
if (IS_ERR(child))
return PTR_ERR(child);
}

/* maybe add LDOs that are omitted on cost-reduced parts */
if (twl_has_regulator() && !(features & TPS_SUBSET)) {
child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2);
Expand Down

0 comments on commit 1e103d1

Please sign in to comment.