linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] twl4030: Fix boot with twl4030 usb transceiver enabled
@ 2009-10-01  8:25 Roger Quadros
  2009-10-01  8:36 ` Artem Bityutskiy
  2009-10-09 12:32 ` Roger Quadros
  0 siblings, 2 replies; 6+ messages in thread
From: Roger Quadros @ 2009-10-01  8:25 UTC (permalink / raw)
  To: sameo, tony; +Cc: linux-kernel, linux-omap, ext-roger.quadros

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 |   89 ++++++++++++++++++++++---------------------
 1 files changed, 46 insertions(+), 43 deletions(-)

diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index e424cf6..e832e97 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()) {
@@ -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);
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] twl4030: Fix boot with twl4030 usb transceiver enabled
  2009-10-01  8:25 [PATCH v2] twl4030: Fix boot with twl4030 usb transceiver enabled Roger Quadros
@ 2009-10-01  8:36 ` Artem Bityutskiy
  2009-10-01  8:41   ` Roger Quadros
  2009-10-09 12:32 ` Roger Quadros
  1 sibling, 1 reply; 6+ messages in thread
From: Artem Bityutskiy @ 2009-10-01  8:36 UTC (permalink / raw)
  To: Roger Quadros; +Cc: sameo, tony, linux-kernel, linux-omap

On Thu, 2009-10-01 at 11:25 +0300, Roger Quadros wrote:
>  	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) {
> +
Why is this extra line?

> +		static struct regulator_consumer_supply usb1v5 = {
> +			.supply =	"usb1v5",
> +		};

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] twl4030: Fix boot with twl4030 usb transceiver enabled
  2009-10-01  8:36 ` Artem Bityutskiy
@ 2009-10-01  8:41   ` Roger Quadros
  0 siblings, 0 replies; 6+ messages in thread
From: Roger Quadros @ 2009-10-01  8:41 UTC (permalink / raw)
  To: dedekind1@gmail.com
  Cc: sameo@linux.intel.com, tony@atomide.com,
	linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org

Artem Bityutskiy wrote:
> On Thu, 2009-10-01 at 11:25 +0300, Roger Quadros wrote:
>>  	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) {
>> +
> Why is this extra line?
> 
>> +		static struct regulator_consumer_supply usb1v5 = {
>> +			.supply =	"usb1v5",
>> +		};
> 

oops, my bad. and checkpatch didn't point it out ;)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] twl4030: Fix boot with twl4030 usb transceiver enabled
  2009-10-01  8:25 [PATCH v2] twl4030: Fix boot with twl4030 usb transceiver enabled Roger Quadros
  2009-10-01  8:36 ` Artem Bityutskiy
@ 2009-10-09 12:32 ` Roger Quadros
  2009-10-09 15:55   ` Roger Quadros
  2009-10-09 16:14   ` Samuel Ortiz
  1 sibling, 2 replies; 6+ messages in thread
From: Roger Quadros @ 2009-10-09 12:32 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: tony, linux-kernel, linux-omap, felipe.balbi

Hi Samuel,

What is the status of this patch?
Without this patch we are unable to boot on systems using musb usb controller.

cheers,
-roger.

On Thu, Oct 1, 2009 at 11:25 AM, Roger Quadros
<ext-roger.quadros@nokia.com> wrote:
> 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 |   89 ++++++++++++++++++++++---------------------
>  1 files changed, 46 insertions(+), 43 deletions(-)
>
> diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
> index e424cf6..e832e97 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()) {
> @@ -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);
> --
> 1.6.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] twl4030: Fix boot with twl4030 usb transceiver enabled
  2009-10-09 12:32 ` Roger Quadros
@ 2009-10-09 15:55   ` Roger Quadros
  2009-10-09 16:14   ` Samuel Ortiz
  1 sibling, 0 replies; 6+ messages in thread
From: Roger Quadros @ 2009-10-09 15:55 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: ext Roger Quadros, tony@atomide.com, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org, Balbi Felipe (Nokia-D/Helsinki),
	Felipe Contreras, jouni.hogander

Hi,

I just observed that this patch does not work as intended with 2.6.31.3

It seems that twl4030_usb_probe() and hence twl4030_usb_ldo_init() is called 
before the required regulators have been 'linked' to the device in 
twl4030-core.c, thus causing regulator_get(twl->dev, "usb3v1"); to fail, and the 
boot lockup

Isn't there a better way to avoid such a situation?

cheers,
-roger

ext Roger Quadros wrote:
> Hi Samuel,
> 
> What is the status of this patch?
> Without this patch we are unable to boot on systems using musb usb controller.
> 
> cheers,
> -roger.
> 
> On Thu, Oct 1, 2009 at 11:25 AM, Roger Quadros
> <ext-roger.quadros@nokia.com> wrote:
>> 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 |   89 ++++++++++++++++++++++---------------------
>>  1 files changed, 46 insertions(+), 43 deletions(-)
>>
>> diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
>> index e424cf6..e832e97 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()) {
>> @@ -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);
>> --
>> 1.6.0.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
>>
> --
> 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] 6+ messages in thread

* Re: [PATCH v2] twl4030: Fix boot with twl4030 usb transceiver enabled
  2009-10-09 12:32 ` Roger Quadros
  2009-10-09 15:55   ` Roger Quadros
@ 2009-10-09 16:14   ` Samuel Ortiz
  1 sibling, 0 replies; 6+ messages in thread
From: Samuel Ortiz @ 2009-10-09 16:14 UTC (permalink / raw)
  To: Roger Quadros; +Cc: tony, linux-kernel, linux-omap, felipe.balbi

Hi Roger,

On Fri, Oct 09, 2009 at 03:32:12PM +0300, Roger Quadros wrote:
> Hi Samuel,
> 
> What is the status of this patch?
> Without this patch we are unable to boot on systems using musb usb controller.
I'm applying that patch to my for-next branch. And I will also try to have
Linus pulling it too, as it seems to prevent your machines from booting.

Cheers,
Samuel.


> cheers,
> -roger.
> 
> On Thu, Oct 1, 2009 at 11:25 AM, Roger Quadros
> <ext-roger.quadros@nokia.com> wrote:
> > 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 |   89 ++++++++++++++++++++++---------------------
> >  1 files changed, 46 insertions(+), 43 deletions(-)
> >
> > diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
> > index e424cf6..e832e97 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()) {
> > @@ -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);
> > --
> > 1.6.0.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> >

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-10-09 16:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-01  8:25 [PATCH v2] twl4030: Fix boot with twl4030 usb transceiver enabled Roger Quadros
2009-10-01  8:36 ` Artem Bityutskiy
2009-10-01  8:41   ` Roger Quadros
2009-10-09 12:32 ` Roger Quadros
2009-10-09 15:55   ` Roger Quadros
2009-10-09 16:14   ` Samuel Ortiz

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).