* [PATCH] twl4030: Fix boot with twl4030 usb transceiver enabled
@ 2009-09-30 15:47 Roger Quadros
2009-09-30 17:30 ` Tony Lindgren
2009-09-30 17:36 ` [APPLIED] " Tony Lindgren
0 siblings, 2 replies; 3+ messages in thread
From: Roger Quadros @ 2009-09-30 15:47 UTC (permalink / raw)
To: linux-omap; +Cc: dbrownell, jouni.hogander
The usb regulator supplies (usb1v5, usb1v8 & usb3v1) must be available
before adding the twl4030_usb child, else twl4030_usb_ldo_init() will
always fail thus causing boot lock-up.
This patch fixes boot on OMAP systems using the twl4030 usb transceiver.
CONFIG_TWL4030_USB=y
Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com>
---
drivers/mfd/twl4030-core.c | 112 ++++++++++++++++++--------------------------
1 files changed, 46 insertions(+), 66 deletions(-)
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index e424cf6..dcd27be 100644
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -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",
@@ -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()) {
@@ -557,70 +601,6 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
return PTR_ERR(child);
}
- if (twl_has_regulator()) {
- /*
- child = add_regulator(TWL4030_REG_VPLL1, pdata->vpll1);
- if (IS_ERR(child))
- return PTR_ERR(child);
- */
-
- child = add_regulator(TWL4030_REG_VMMC1, pdata->vmmc1);
- if (IS_ERR(child))
- return PTR_ERR(child);
-
- child = add_regulator(TWL4030_REG_VDAC, pdata->vdac);
- if (IS_ERR(child))
- return PTR_ERR(child);
-
- child = add_regulator((features & TWL4030_VAUX2)
- ? TWL4030_REG_VAUX2_4030
- : TWL4030_REG_VAUX2,
- pdata->vaux2);
- if (IS_ERR(child))
- 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);
--
1.6.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] twl4030: Fix boot with twl4030 usb transceiver enabled
2009-09-30 15:47 [PATCH] twl4030: Fix boot with twl4030 usb transceiver enabled Roger Quadros
@ 2009-09-30 17:30 ` Tony Lindgren
2009-09-30 17:36 ` [APPLIED] " Tony Lindgren
1 sibling, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2009-09-30 17:30 UTC (permalink / raw)
To: Roger Quadros; +Cc: linux-omap, dbrownell, jouni.hogander, sameo
* Roger Quadros <ext-roger.quadros@nokia.com> [090930 08:48]:
> The usb regulator supplies (usb1v5, usb1v8 & usb3v1) must be available
> before adding the twl4030_usb child, else twl4030_usb_ldo_init() will
> always fail thus causing boot lock-up.
>
> This patch fixes boot on OMAP systems using the twl4030 usb transceiver.
> CONFIG_TWL4030_USB=y
This fix should go to Samuel for integration:
$ grep -a4 drivers/mfd MAINTAINERS
MULTIFUNCTION DEVICES (MFD)
M: Samuel Ortiz <sameo@linux.intel.com>
T: git git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6.git
S: Supported
F: drivers/mfd/
...
Regards,
Tony
> Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com>
> ---
> drivers/mfd/twl4030-core.c | 112 ++++++++++++++++++--------------------------
> 1 files changed, 46 insertions(+), 66 deletions(-)
>
> diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
> index e424cf6..dcd27be 100644
> --- a/drivers/mfd/twl4030-core.c
> +++ b/drivers/mfd/twl4030-core.c
> @@ -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",
> @@ -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()) {
> @@ -557,70 +601,6 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
> return PTR_ERR(child);
> }
>
> - if (twl_has_regulator()) {
> - /*
> - child = add_regulator(TWL4030_REG_VPLL1, pdata->vpll1);
> - if (IS_ERR(child))
> - return PTR_ERR(child);
> - */
> -
> - child = add_regulator(TWL4030_REG_VMMC1, pdata->vmmc1);
> - if (IS_ERR(child))
> - return PTR_ERR(child);
> -
> - child = add_regulator(TWL4030_REG_VDAC, pdata->vdac);
> - if (IS_ERR(child))
> - return PTR_ERR(child);
> -
> - child = add_regulator((features & TWL4030_VAUX2)
> - ? TWL4030_REG_VAUX2_4030
> - : TWL4030_REG_VAUX2,
> - pdata->vaux2);
> - if (IS_ERR(child))
> - 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);
> --
> 1.6.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* [APPLIED] [PATCH] twl4030: Fix boot with twl4030 usb transceiver enabled
2009-09-30 15:47 [PATCH] twl4030: Fix boot with twl4030 usb transceiver enabled Roger Quadros
2009-09-30 17:30 ` Tony Lindgren
@ 2009-09-30 17:36 ` Tony Lindgren
1 sibling, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2009-09-30 17:36 UTC (permalink / raw)
To: linux-omap
This patch has been applied to the linux-omap
by youw fwiendly patch wobot.
Branch in linux-omap: omap-fixes-testing
Initial commit ID (Likely to change): 160bb884083cc4e3afa1b8d0fdc82f0720eb3f0a
PatchWorks
http://patchwork.kernel.org/patch/50721/
Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=160bb884083cc4e3afa1b8d0fdc82f0720eb3f0a
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-09-30 17:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-30 15:47 [PATCH] twl4030: Fix boot with twl4030 usb transceiver enabled Roger Quadros
2009-09-30 17:30 ` Tony Lindgren
2009-09-30 17:36 ` [APPLIED] " Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).