Skip to contentSkip to conversation

usb: otg: enable regulator only on cable/device connect

PATCH Superseded Hema HK 4 participants 13 messages Feb 15, 2011 – Feb 16, 2011 5 messages not in the archive

Subsystems (6)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Hema HK

author
#0 lore raw

PATCH v2 1/7 usb: otg: enable regulator only on cable/device connect

From: Kalliguddi, Hema <[email protected]>

Remove the regulator enable while driver loading and enable it only when the cable/device is connected and disable it when disconnected.

Remove the configuration of config_state and config_trans register configuration as these registers are programmed when regulator enable/disable is called.

Cc Felipe Balbi <[email protected]>

---
drivers/usb/otg/twl6030-usb.c | 27 ++++++++++++---------------

 1 file changed, 12 insertions(+), 15 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

drivers/usb/otg/twl6030-usb.c +12 -15
Index: linux-2.6/drivers/usb/otg/twl6030-usb.c
===================================================================
@@ -158,8 +158,6 @@ static int twl6030_phy_init(struct otg_t
 	dev  = twl->dev;
 	pdata = dev->platform_data;
 
-	regulator_enable(twl->usb3v3);
-
 	hw_state = twl6030_readb(twl, TWL6030_MODULE_ID0, STS_HW_CONDITIONS);
 
 	if (hw_state & STS_USB_ID)
@@ -180,7 +178,6 @@ static void twl6030_phy_shutdown(struct 
 	dev  = twl->dev;
 	pdata = dev->platform_data;
 	pdata->phy_power(twl->dev, 0, 0);
-	regulator_disable(twl->usb3v3);
 }
 
 static int twl6030_usb_ldo_init(struct twl6030_usb *twl)
@@ -199,16 +196,6 @@ static int twl6030_usb_ldo_init(struct t
 	if (IS_ERR(twl->usb3v3))
 		return -ENODEV;
 
-	regulator_enable(twl->usb3v3);
-
-	/* Program the VUSB_CFG_TRANS for ACTIVE state. */
-	twl6030_writeb(twl, TWL_MODULE_PM_RECEIVER, 0x3F,
-						VUSB_CFG_TRANS);
-
-	/* Program the VUSB_CFG_STATE register to ON on all groups. */
-	twl6030_writeb(twl, TWL_MODULE_PM_RECEIVER, 0xE1,
-						VUSB_CFG_STATE);
-
 	/* Program the USB_VBUS_CTRL_SET and set VBUS_ACT_COMP bit */
 	twl6030_writeb(twl, TWL_MODULE_USB, 0x4, USB_VBUS_CTRL_SET);
 
@@ -261,16 +248,23 @@ static irqreturn_t twl6030_usb_irq(int i
 						CONTROLLER_STAT1);
 	if (!(hw_state & STS_USB_ID)) {
 		if (vbus_state & VBUS_DET) {
+			regulator_enable(twl->usb3v3);
+			twl->asleep = 1;
 			status = USB_EVENT_VBUS;
 			twl->otg.default_a = false;
 			twl->otg.state = OTG_STATE_B_IDLE;
+			twl->linkstat = status;
+			blocking_notifier_call_chain(&twl->otg.notifier,
+						status, twl->otg.gadget);
 		} else {
 			status = USB_EVENT_NONE;
-		}
-		if (status >= 0) {
 			twl->linkstat = status;
 			blocking_notifier_call_chain(&twl->otg.notifier,
 						status, twl->otg.gadget);
+			if (twl->asleep) {
+				regulator_disable(twl->usb3v3);
+				twl->asleep = 0;
+			}
 		}
 	}
 	sysfs_notify(&twl->dev->kobj, NULL, "vbus");
@@ -288,6 +282,8 @@ static irqreturn_t twl6030_usbotg_irq(in
 
 	if (hw_state & STS_USB_ID) {
 
+		regulator_enable(twl->usb3v3);
+		twl->asleep = 1;
 		twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR, 0x1);
 		twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET,
 								0x10);
@@ -437,6 +433,7 @@ static int __devinit twl6030_usb_probe(s
 		return status;
 	}
 
+	twl->asleep = 0;
 	pdata->phy_init(dev);
 	twl6030_enable_irq(&twl->otg);
 	dev_info(&pdev->dev, "Initialized TWL6030 USB module\n");

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1297762958-26199-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org

author
#2 lore raw

PATCH v2 2/7 usb: otg: Remove one unnecessary I2C read request.

From: Kalliguddi, Hema <[email protected]>

To get the ID status there was an I2C read transfer. Removed this I2C read transfer as this info can be used from existing variable(linkstat).

Cc Felipe Balbi <[email protected]>

---
drivers/usb/otg/twl6030-usb.c | 7 ++-----

 1 file changed, 2 insertions(+), 5 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

drivers/usb/otg/twl6030-usb.c +0 -2
Index: linux-2.6/drivers/usb/otg/twl6030-usb.c
===================================================================
@@ -149,7 +149,6 @@ static int twl6030_set_phy_clk(struct ot
 
 static int twl6030_phy_init(struct otg_transceiver *x)
 {
-	u8 hw_state;
 	struct twl6030_usb *twl;
 	struct device *dev;
 	struct twl4030_usb_data *pdata;
@@ -158,9 +157,7 @@ static int twl6030_phy_init(struct otg_t
 	dev  = twl->dev;
 	pdata = dev->platform_data;
 
-	hw_state = twl6030_readb(twl, TWL6030_MODULE_ID0, STS_HW_CONDITIONS);
author
#3 lore raw

PATCH v2 4/7 usb: otg: OMAP4430: Add phy_suspend function pointer to

In reply to a message not in the archive

From: Kalliguddi, Hema <[email protected]>

Introduce the .phy_suspend function pointer to twl4030_usb_data structure. assign the function to it for both sdp board and panda boards. This will be used by the twl6030-usb transceiver driver.

Cc Felipe Balbi <[email protected]>
Cc Tony Lindgren <[email protected]>

---
arch/arm/mach-omap2/board-4430sdp.c | 1 +

 arch/arm/mach-omap2/board-omap4panda.c |    1 +
 arch/arm/plat-omap/include/plat/usb.h  |    1 +
 include/linux/i2c/twl.h                |    2 ++
 4 files changed, 5 insertions(+)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

arch/arm/mach-omap2/board-4430sdp.c +1 -0
Index: linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
===================================================================
@@ -272,6 +272,7 @@ static struct twl4030_usb_data omap4_usb
 	.phy_exit	= omap4430_phy_exit,
 	.phy_power	= omap4430_phy_power,
 	.phy_set_clock	= omap4430_phy_set_clk,
+	.phy_suspend	= omap4430_phy_suspend,
 };
 
 static struct omap2_hsmmc_info mmc[] = {
arch/arm/mach-omap2/board-omap4panda.c +1 -0
Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
===================================================================
@@ -153,6 +153,7 @@ static struct twl4030_usb_data omap4_usb
 	.phy_exit	= omap4430_phy_exit,
 	.phy_power	= omap4430_phy_power,
 	.phy_set_clock	= omap4430_phy_set_clk,
+	.phy_suspend	= omap4430_phy_suspend,
 };
 
 static struct omap2_hsmmc_info mmc[] = {
arch/arm/plat-omap/include/plat/usb.h +1 -0
Index: linux-2.6/arch/arm/plat-omap/include/plat/usb.h
===================================================================
@@ -88,6 +88,7 @@ extern int omap4430_phy_power(struct dev
 extern int omap4430_phy_set_clk(struct device *dev, int on);
 extern int omap4430_phy_init(struct device *dev);
 extern int omap4430_phy_exit(struct device *dev);
+extern int omap4430_phy_suspend(struct device *dev, int suspend);
 
 #endif
 
include/linux/i2c/twl.h +2 -0
Index: linux-2.6/include/linux/i2c/twl.h
===================================================================
@@ -600,6 +600,8 @@ struct twl4030_usb_data {
 	int		(*phy_power)(struct device *dev, int iD, int on);
 	/* enable/disable  phy clocks */
 	int		(*phy_set_clock)(struct device *dev, int on);
+	/* suspend/resume of phy */
+	int		(*phy_suspend)(struct device *dev, int suspend);
 };
 
 struct twl4030_ins {

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [4/7 v2] usb: otg: OMAP4430: Add phy_suspend function pointer to

Hello.

On 15-02-2011 12:42, Hema HK wrote:

The subject seems incomplete.

Quoted 9 lines

From: Kalliguddi, Hema<[email protected]>

Introduce the .phy_suspend function pointer to twl4030_usb_data structure. assign the function to it for both sdp board and panda boards. This will be used by the twl6030-usb transceiver driver.

Cc Felipe Balbi<[email protected]>
Cc Tony Lindgren<[email protected]>

[...]

Quoted 29 lines

Index: linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
===================================================================

arch/arm/mach-omap2/board-4430sdp.c +1 -0
@@ -272,6 +272,7 @@ static struct twl4030_usb_data omap4_usb
  	.phy_exit	= omap4430_phy_exit,
  	.phy_power	= omap4430_phy_power,
  	.phy_set_clock	= omap4430_phy_set_clk,
+	.phy_suspend	= omap4430_phy_suspend,
  };
 
  static struct omap2_hsmmc_info mmc[] = {

Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
===================================================================

arch/arm/mach-omap2/board-omap4panda.c +1 -0
@@ -153,6 +153,7 @@ static struct twl4030_usb_data omap4_usb
  	.phy_exit	= omap4430_phy_exit,
  	.phy_power	= omap4430_phy_power,
  	.phy_set_clock	= omap4430_phy_set_clk,
+	.phy_suspend	= omap4430_phy_suspend,
  };
 
  static struct omap2_hsmmc_info mmc[] = {

Index: linux-2.6/arch/arm/plat-omap/include/plat/usb.h
===================================================================

arch/arm/plat-omap/include/plat/usb.h extern int omap4430_phy_power(struct dev · line 91

Quoted 4 lines
arch/arm/plat-omap/include/plat/usb.h +1 -0
@@ -88,6 +88,7 @@ extern int omap4430_phy_power(struct dev
  extern int omap4430_phy_set_clk(struct device *dev, int on);
  extern int omap4430_phy_init(struct device *dev);
  extern int omap4430_phy_exit(struct device *dev);
+extern int omap4430_phy_suspend(struct device *dev, int suspend);

I think this *extern* declaration should be a part of the previous patch.

include/linux/i2c/twl.h struct twl4030_usb_data { · line 605

Quoted 13 lines
arch/arm/plat-omap/include/plat/usb.h +0 -0
  #endif
 

Index: linux-2.6/include/linux/i2c/twl.h
===================================================================

include/linux/i2c/twl.h +2 -0
@@ -600,6 +600,8 @@ struct twl4030_usb_data {
  	int		(*phy_power)(struct device *dev, int iD, int on);
  	/* enable/disable  phy clocks */
  	int		(*phy_set_clock)(struct device *dev, int on);
+	/* suspend/resume of phy */
+	int		(*phy_suspend)(struct device *dev, int suspend);
  };

I'd make the above the only change in this patch, and add all the other
changes into the previous patch (which then I'd change places with that one).

WBR, Sergei

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

RE: [4/7 v2] usb: otg: OMAP4430: Add phy_suspend function pointer to

Hi,

Quoted 9 lines

-----Original Message-----
From: Sergei Shtylyov [mailto:[email protected]]
Sent: Tuesday, February 15, 2011 5:49 PM
To: Hema HK
Cc: [email protected]; [email protected]; Felipe Balbi; Tony Lindgren
Subject: Re: [4/7 v2] usb: otg: OMAP4430: Add phy_suspend
function pointer to

Quoted 5 lines

Hello.

On 15-02-2011 12:42, Hema HK wrote:

The subject seems incomplete.

Yes. it suppose to be "usb: otg: OMAP4430: Add phy_suspend function pointer
to twl4030_usb_data"

I will correct it

Quoted 37 lines
Quoted 4 lines

From: Kalliguddi, Hema<[email protected]>

Introduce the .phy_suspend function pointer to

twl4030_usb_data structure.

Quoted 6 lines

assign the function to it for both sdp board and panda boards. This will be used by the twl6030-usb transceiver driver.

Cc Felipe Balbi<[email protected]>
Cc Tony Lindgren<[email protected]>

[...]

Quoted 23 lines

Index: linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
===================================================================

arch/arm/mach-omap2/board-4430sdp.c +1 -0
@@ -272,6 +272,7 @@ static struct twl4030_usb_data omap4_usb
  	.phy_exit	= omap4430_phy_exit,
  	.phy_power	= omap4430_phy_power,
  	.phy_set_clock	= omap4430_phy_set_clk,
+	.phy_suspend	= omap4430_phy_suspend,
  };
 
  static struct omap2_hsmmc_info mmc[] = {

Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
===================================================================

arch/arm/mach-omap2/board-omap4panda.c +1 -0
@@ -153,6 +153,7 @@ static struct twl4030_usb_data omap4_usb
  	.phy_exit	= omap4430_phy_exit,
  	.phy_power	= omap4430_phy_power,
  	.phy_set_clock	= omap4430_phy_set_clk,
+	.phy_suspend	= omap4430_phy_suspend,
  };
 
Quoted 13 lines

arch/arm/plat-omap/include/plat/usb.h extern int omap4430_phy_power(struct dev · line 91

Quoted 10 lines
arch/arm/mach-omap2/board-omap4panda.c +0 -0
  static struct omap2_hsmmc_info mmc[] = {

Index: linux-2.6/arch/arm/plat-omap/include/plat/usb.h
===================================================================

arch/arm/plat-omap/include/plat/usb.h +1 -0
@@ -88,6 +88,7 @@ extern int omap4430_phy_power(struct dev
  extern int omap4430_phy_set_clk(struct device *dev, int on);
  extern int omap4430_phy_init(struct device *dev);
  extern int omap4430_phy_exit(struct device *dev);
+extern int omap4430_phy_suspend(struct device *dev, int suspend);

I think this *extern* declaration should be a part of the
previous patch.

What is the problem if extern when using?

Quoted 10 lines

include/linux/i2c/twl.h struct twl4030_usb_data { · line 600

Quoted 9 lines
arch/arm/plat-omap/include/plat/usb.h +0 -0
  #endif
 

Index: linux-2.6/include/linux/i2c/twl.h
===================================================================

include/linux/i2c/twl.h +0 -0
@@ -600,6 +600,8 @@ struct twl4030_usb_data {
  	int		(*phy_power)(struct device *dev, int

iD, int on);

Quoted 11 lines

include/linux/i2c/twl.h struct twl4030_usb_data { · line 605

Quoted 5 lines
include/linux/i2c/twl.h +2 -0
  	/* enable/disable  phy clocks */
  	int		(*phy_set_clock)(struct device *dev, int on);
+	/* suspend/resume of phy */
+	int		(*phy_suspend)(struct device *dev, int suspend);
  };

I'd make the above the only change in this patch, and add
all the other
changes into the previous patch (which then I'd change places with that one).

No. if I do that git bisect fails.
Initializer does not make any sense without function poointer declaration.

Regards,
Hema

Quoted 2 lines

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 137f7a77ed983ac5f3d08eaea0b2bb66-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#8 lore raw

Re: [4/7 v2] usb: otg: OMAP4430: Add phy_suspend function pointer to

Hello.

Quoted 50 lines · Hema Kalliguddi
Quoted 36 lines
Quoted 3 lines

From: Kalliguddi, Hema<[email protected]>

Introduce the .phy_suspend function pointer to

twl4030_usb_data structure.

Quoted 6 lines

assign the function to it for both sdp board and panda boards. This will be used by the twl6030-usb transceiver driver.

Cc Felipe Balbi<[email protected]>
Cc Tony Lindgren<[email protected]>

[...]

Quoted 23 lines

Index: linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
===================================================================

arch/arm/mach-omap2/board-4430sdp.c +1 -0
@@ -272,6 +272,7 @@ static struct twl4030_usb_data omap4_usb
   	.phy_exit	= omap4430_phy_exit,
   	.phy_power	= omap4430_phy_power,
   	.phy_set_clock	= omap4430_phy_set_clk,
+	.phy_suspend	= omap4430_phy_suspend,
   };
 
   static struct omap2_hsmmc_info mmc[] = {

Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
===================================================================

arch/arm/mach-omap2/board-omap4panda.c +1 -0
@@ -153,6 +153,7 @@ static struct twl4030_usb_data omap4_usb
   	.phy_exit	= omap4430_phy_exit,
   	.phy_power	= omap4430_phy_power,
   	.phy_set_clock	= omap4430_phy_set_clk,
+	.phy_suspend	= omap4430_phy_suspend,
   };
 
Quoted 13 lines

arch/arm/plat-omap/include/plat/usb.h extern int omap4430_phy_power(struct dev · line 91

Quoted 10 lines
arch/arm/mach-omap2/board-omap4panda.c +0 -0
   static struct omap2_hsmmc_info mmc[] = {

Index: linux-2.6/arch/arm/plat-omap/include/plat/usb.h
===================================================================

arch/arm/plat-omap/include/plat/usb.h +1 -0
@@ -88,6 +88,7 @@ extern int omap4430_phy_power(struct dev
   extern int omap4430_phy_set_clk(struct device *dev, int on);
   extern int omap4430_phy_init(struct device *dev);
   extern int omap4430_phy_exit(struct device *dev);
+extern int omap4430_phy_suspend(struct device *dev, int suspend);

I think this *extern* declaration should be a part of the
previous patch.

Quoted 1 line

What is the problem if extern when using?

I think 'extern' declaration should be in the same place where this
function is defined, else you're just defining an unused function. Same goes for the 'phy_suspend' initializers...

Quoted 19 lines
Quoted 18 lines

include/linux/i2c/twl.h struct twl4030_usb_data { · line 605

Quoted 13 lines
arch/arm/plat-omap/include/plat/usb.h +0 -0
   #endif
 

Index: linux-2.6/include/linux/i2c/twl.h
===================================================================

include/linux/i2c/twl.h +2 -0
@@ -600,6 +600,8 @@ struct twl4030_usb_data {
   	int		(*phy_power)(struct device *dev, int iD, int on);
   	/* enable/disable  phy clocks */
   	int		(*phy_set_clock)(struct device *dev, int on);
+	/* suspend/resume of phy */
+	int		(*phy_suspend)(struct device *dev, int suspend);
   };

I'd make the above the only change in this patch, and add
all the other
changes into the previous patch (which then I'd change places with that one).

Quoted 1 line

No. if I do that git bisect fails.

How in the world it will fail?

Quoted 1 line

Initializer does not make any sense without function poointer declaration.

I said "which then I'd changed places with that one", i.e. put this patch
first and the previous patch second. Otherwise, you're just doing things beckwards: first you define the method implementation, and then you declare the method itself... it should be vice versa.

Quoted 2 lines

Regards,
Hema

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

RE: [4/7 v2] usb: otg: OMAP4430: Add phy_suspend function pointer to

Hi,

Quoted 99 lines

-----Original Message-----
From: Sergei Shtylyov [mailto:[email protected]]
Sent: Wednesday, February 16, 2011 5:07 PM
To: Hema Kalliguddi
Cc: Sergei Shtylyov; [email protected]; [email protected]; Felipe Balbi; Tony Lindgren
Subject: Re: [4/7 v2] usb: otg: OMAP4430: Add phy_suspend
function pointer to

Hello.

Quoted 50 lines · Hema Kalliguddi
Quoted 36 lines
Quoted 3 lines

From: Kalliguddi, Hema<[email protected]>

Introduce the .phy_suspend function pointer to

twl4030_usb_data structure.

Quoted 6 lines

assign the function to it for both sdp board and panda boards. This will be used by the twl6030-usb transceiver driver.

Cc Felipe Balbi<[email protected]>
Cc Tony Lindgren<[email protected]>

[...]

Quoted 23 lines

Index: linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
===================================================================

arch/arm/mach-omap2/board-4430sdp.c +1 -0
@@ -272,6 +272,7 @@ static struct twl4030_usb_data omap4_usb
   	.phy_exit	= omap4430_phy_exit,
   	.phy_power	= omap4430_phy_power,
   	.phy_set_clock	= omap4430_phy_set_clk,
+	.phy_suspend	= omap4430_phy_suspend,
   };
 
   static struct omap2_hsmmc_info mmc[] = {

Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
===================================================================

arch/arm/mach-omap2/board-omap4panda.c +1 -0
@@ -153,6 +153,7 @@ static struct twl4030_usb_data omap4_usb
   	.phy_exit	= omap4430_phy_exit,
   	.phy_power	= omap4430_phy_power,
   	.phy_set_clock	= omap4430_phy_set_clk,
+	.phy_suspend	= omap4430_phy_suspend,
   };
 
Quoted 13 lines

arch/arm/plat-omap/include/plat/usb.h extern int omap4430_phy_power(struct dev · line 91

Quoted 10 lines
arch/arm/mach-omap2/board-omap4panda.c +0 -0
   static struct omap2_hsmmc_info mmc[] = {

Index: linux-2.6/arch/arm/plat-omap/include/plat/usb.h
===================================================================

arch/arm/plat-omap/include/plat/usb.h +1 -0
@@ -88,6 +88,7 @@ extern int omap4430_phy_power(struct dev
   extern int omap4430_phy_set_clk(struct device *dev, int on);
   extern int omap4430_phy_init(struct device *dev);
   extern int omap4430_phy_exit(struct device *dev);
+extern int omap4430_phy_suspend(struct device *dev, int suspend);

I think this *extern* declaration should be a part of the
previous patch.

Quoted 1 line

What is the problem if extern when using?

I think 'extern' declaration should be in the same place
where this
function is defined, else you're just defining an unused function. Same goes
for the 'phy_suspend' initializers...

Quoted 8 lines
Quoted 8 lines

include/linux/i2c/twl.h struct twl4030_usb_data { · line 600

Quoted 8 lines
arch/arm/plat-omap/include/plat/usb.h +0 -0
   #endif
 

Index: linux-2.6/include/linux/i2c/twl.h
===================================================================

include/linux/i2c/twl.h +0 -0
@@ -600,6 +600,8 @@ struct twl4030_usb_data {
   	int		(*phy_power)(struct device

*dev, int iD, int on);

Quoted 2 lines
Quoted 2 lines

include/linux/i2c/twl.h struct twl4030_usb_data { · line 602

Quoted 2 lines
include/linux/i2c/twl.h +0 -0
   	/* enable/disable  phy clocks */
   	int		(*phy_set_clock)(struct device

*dev, int on);

Quoted 10 lines
Quoted 8 lines

include/linux/i2c/twl.h struct twl4030_usb_data { · line 605

Quoted 3 lines
include/linux/i2c/twl.h +2 -0
+	/* suspend/resume of phy */
+	int		(*phy_suspend)(struct device *dev, int suspend);
   };

I'd make the above the only change in this patch, and add
all the other
changes into the previous patch (which then I'd change places with that one).

No. if I do that git bisect fails.

How in the world it will fail?

Quoted 1 line

Initializer does not make any sense without function

poointer declaration.

Quoted 8 lines

I said "which then I'd changed places with that one", i.e.
put this patch
first and the previous patch second. Otherwise, you're just doing things
beckwards: first you define the method implementation, and then you declare
the method itself... it should be vice versa.

I understand that. I will change it and send the patches.

Regards,
Hema

Quoted 5 lines
Quoted 2 lines

Regards,
Hema

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#11 lore raw

PATCH v2 5/7 usb: otg: TWL6030: Introduce the twl6030_phy_suspend function.

In reply to a message not in the archive

From: Kalliguddi, Hema <[email protected]>

Introduce the twl6030_phy_suspend function and assign to otg.set_suspend function pointer.
This function is used by the musb-omap2430 platform driver during suspend/resume.

Cc Felipe Balbi <[email protected]>

---
drivers/usb/otg/twl6030-usb.c | 16 ++++++++++++++++

 1 file changed, 16 insertions(+)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

drivers/usb/otg/twl6030-usb.c +16 -0
Index: linux-2.6/drivers/usb/otg/twl6030-usb.c
===================================================================
@@ -177,6 +177,20 @@ static void twl6030_phy_shutdown(struct 
 	pdata->phy_power(twl->dev, 0, 0);
 }
 
+static int twl6030_phy_suspend(struct otg_transceiver *x, int suspend)
+{
+	struct twl6030_usb *twl;
+	struct device *dev;
+	struct twl4030_usb_data *pdata;
+
+	twl = xceiv_to_twl(x);
+	dev  = twl->dev;
+	pdata = dev->platform_data;
+	pdata->phy_suspend(twl->dev, suspend);
+
+	return 0;
+}
+
 static int twl6030_usb_ldo_init(struct twl6030_usb *twl)
 {
 
@@ -388,6 +402,7 @@ static int __devinit twl6030_usb_probe(s
 	twl->otg.set_vbus	= twl6030_set_vbus;
 	twl->otg.init		= twl6030_phy_init;
 	twl->otg.shutdown	= twl6030_phy_shutdown;
+	twl->otg.set_suspend	= twl6030_phy_suspend;
 
 	/* init spinlock for workqueue */
 	spin_lock_init(&twl->lock);
@@ -432,6 +447,7 @@ static int __devinit twl6030_usb_probe(s
 
 	twl->asleep = 0;
 	pdata->phy_init(dev);
+	twl6030_phy_suspend(&twl->otg, 0);
 	twl6030_enable_irq(&twl->otg);
 	dev_info(&pdev->dev, "Initialized TWL6030 USB module\n");
 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1297762958-26199-5-git-send-email-hemahk-l0cyMroinI0@public.gmane.org

#13 lore raw

Re: [5/7 v2] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function.

Hello.

Quoted 9 lines · Hema HK

From: Kalliguddi, Hema<[email protected]>

Introduce the twl6030_phy_suspend function and assign to otg.set_suspend function pointer.
This function is used by the musb-omap2430 platform driver during suspend/resume.

Cc Felipe Balbi<[email protected]>

[...]

Quoted 7 lines

Index: linux-2.6/drivers/usb/otg/twl6030-usb.c
===================================================================

drivers/usb/otg/twl6030-usb.c +0 -0
@@ -177,6 +177,20 @@ static void twl6030_phy_shutdown(struct
  	pdata->phy_power(twl->dev, 0, 0);
  }

drivers/usb/otg/twl6030-usb.c static void twl6030_phy_shutdown(struct · line 188

Quoted 10 lines
drivers/usb/otg/twl6030-usb.c +9 -0
 
+static int twl6030_phy_suspend(struct otg_transceiver *x, int suspend)
+{
+	struct twl6030_usb *twl;
+	struct device *dev;
+	struct twl4030_usb_data *pdata;
+
+	twl = xceiv_to_twl(x);
+	dev  = twl->dev;
+	pdata = dev->platform_data;

Why not do all the above in the intializers?

drivers/usb/otg/twl6030-usb.c static void twl6030_phy_shutdown(struct · line 193

Quoted 5 lines
drivers/usb/otg/twl6030-usb.c +5 -0
+	pdata->phy_suspend(twl->dev, suspend);
+
+	return 0;
+}
+

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw

RE: [5/7 v2] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function.

Hi,

Quoted 35 lines

-----Original Message-----
From: Sergei Shtylyov [mailto:[email protected]]
Sent: Tuesday, February 15, 2011 5:52 PM
To: Hema HK
Cc: [email protected]; [email protected]; Felipe Balbi
Subject: Re: [5/7 v2] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function.

Hello.

Quoted 3 lines · Hema HK

From: Kalliguddi, Hema<[email protected]>

Introduce the twl6030_phy_suspend function and assign to

otg.set_suspend

Quoted 6 lines

function pointer.
This function is used by the musb-omap2430 platform driver during suspend/resume.

Cc Felipe Balbi<[email protected]>

[...]

drivers/usb/otg/twl6030-usb.c static void twl6030_phy_shutdown(struct · line 180

Quoted 9 lines

Index: linux-2.6/drivers/usb/otg/twl6030-usb.c
===================================================================

drivers/usb/otg/twl6030-usb.c +1 -0
@@ -177,6 +177,20 @@ static void twl6030_phy_shutdown(struct
  	pdata->phy_power(twl->dev, 0, 0);
  }
 
+static int twl6030_phy_suspend(struct otg_transceiver *x,

int suspend)

Quoted 10 lines

drivers/usb/otg/twl6030-usb.c static void twl6030_phy_shutdown(struct · line 188

Quoted 8 lines
drivers/usb/otg/twl6030-usb.c +8 -0
+{
+	struct twl6030_usb *twl;
+	struct device *dev;
+	struct twl4030_usb_data *pdata;
+
+	twl = xceiv_to_twl(x);
+	dev  = twl->dev;
+	pdata = dev->platform_data;

Why not do all the above in the intializers?

Can be done that way as well.

Regards,
Hema

Quoted 9 lines

drivers/usb/otg/twl6030-usb.c static void twl6030_phy_shutdown(struct · line 193

Quoted 6 lines
drivers/usb/otg/twl6030-usb.c +5 -0
+	pdata->phy_suspend(twl->dev, suspend);
+
+	return 0;
+}
+

WBR, Sergei

#15 lore raw

PATCH v2 3/7 usb: otg: OMAP4430: Introducing suspend function for power management

In reply to Hema HK

From: Kalliguddi, Hema <[email protected]>

Introduced the suspend/resume function for the OMAP4430 internal PHY. This will be used by the twl6030-usb transceiver driver. Moved the clock enable/disable function calls and power on/off of the PHY code from power on/off functions to suspend/resume function.

Cc Felipe Balbi <[email protected]>
Cc Tony Lindgren <[email protected]>

---
arch/arm/mach-omap2/omap_phy_internal.c | 22 +++++++++++++++-------

 1 file changed, 15 insertions(+), 7 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

arch/arm/mach-omap2/omap_phy_internal.c +15 -7
Index: linux-2.6/arch/arm/mach-omap2/omap_phy_internal.c
===================================================================
@@ -103,13 +103,6 @@ int omap4430_phy_set_clk(struct device *
 int omap4430_phy_power(struct device *dev, int ID, int on)
 {
 	if (on) {
-		/* enabled the clocks */
-		omap4430_phy_set_clk(dev, 1);
-		/* power on the phy */
-		if (__raw_readl(ctrl_base + CONTROL_DEV_CONF) & PHY_PD) {
-			__raw_writel(~PHY_PD, ctrl_base + CONTROL_DEV_CONF);
-			mdelay(200);
-		}
 		if (ID)
 			/* enable VBUS valid, IDDIG groung */
 			__raw_writel(AVALID | VBUSVALID, ctrl_base +
@@ -125,10 +118,25 @@ int omap4430_phy_power(struct device *de
 		/* Enable session END and IDIG to high impedence. */
 		__raw_writel(SESSEND | IDDIG, ctrl_base +
 					USBOTGHS_CONTROL);
+	}
+	return 0;
+}
+
+int omap4430_phy_suspend(struct device *dev, int suspend)
+{
+	if (suspend) {
 		/* Disable the clocks */
 		omap4430_phy_set_clk(dev, 0);
 		/* Power down the phy */
 		__raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
+	} else {
+		/* Enable the internel phy clcoks */
+		omap4430_phy_set_clk(dev, 1);
+		/* power on the phy */
+		if (__raw_readl(ctrl_base + CONTROL_DEV_CONF) & PHY_PD) {
+			__raw_writel(~PHY_PD, ctrl_base + CONTROL_DEV_CONF);
+			mdelay(200);
+		}
 	}
 
 	return 0;
#16 lore raw

PATCH v2 6/7 usb: otg: TWL6030 Save the last event in otg_transceiver

In reply to Hema HK

From: Kalliguddi, Hema <[email protected]>

Save the last event in the otg_transceiver so that it can used in the musb driver and gadget driver to configure the musb and enable the vbus for host mode and OTG mode, if the device is connected during boot.

Cc Felipe Balbi <[email protected]>

---
[Reusing some part of the patch[1] posted by Arnaud Mandy]
[1] http://permalink.gmane.org/gmane.linux.usb.general/37123

---
 drivers/usb/otg/twl6030-usb.c |    3 +++
 include/linux/usb/otg.h       |    1 +
 2 files changed, 4 insertions(+)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

drivers/usb/otg/twl6030-usb.c +3 -0
Index: linux-2.6/drivers/usb/otg/twl6030-usb.c
===================================================================
@@ -265,11 +265,13 @@ static irqreturn_t twl6030_usb_irq(int i
 			twl->otg.default_a = false;
 			twl->otg.state = OTG_STATE_B_IDLE;
 			twl->linkstat = status;
+			twl->otg.last_event = status;
 			blocking_notifier_call_chain(&twl->otg.notifier,
 						status, twl->otg.gadget);
 		} else {
 			status = USB_EVENT_NONE;
 			twl->linkstat = status;
+			twl->otg.last_event = status;
 			blocking_notifier_call_chain(&twl->otg.notifier,
 						status, twl->otg.gadget);
 			if (twl->asleep) {
@@ -302,6 +304,7 @@ static irqreturn_t twl6030_usbotg_irq(in
 		twl->otg.default_a = true;
 		twl->otg.state = OTG_STATE_A_IDLE;
 		twl->linkstat = status;
+		twl->otg.last_event = status;
 		blocking_notifier_call_chain(&twl->otg.notifier, status,
 							twl->otg.gadget);
 	} else  {
include/linux/usb/otg.h +1 -0
Index: linux-2.6/include/linux/usb/otg.h
===================================================================
@@ -66,6 +66,7 @@ struct otg_transceiver {
 
 	u8			default_a;
 	enum usb_otg_state	state;
+	enum usb_xceiv_events	last_event;
 
 	struct usb_bus		*host;
 	struct usb_gadget	*gadget;
#17 lore raw

PATCH v2 7/7 usb: musb: OMAP4430: Fix usb device detection if connected during boot

In reply to Hema HK

From: Kalliguddi, Hema <[email protected]>

OMAP4430 is embedded with UTMI PHY. This PHY does not support the OTG features like ID pin detection and VBUS detection. This function is exported to an external companion chip TWL6030. Software must retrieve the OTG HNP and SRP status from the TWL6030 and configure the bits inside the control module that drive the related USBOTGHS UTMI interface signals. It must also read back the UTMI signals needed to configure the TWL6030 OTG module.

Can find more details in the TRM[1]. [1]:http://focus.ti.com/pdfs/wtbu/OMAP4430_ES2.0_Public_TRM_vJ.pdf

In OMAP4430 musb driver VBUS and ID notifications are received from the transceiver driver. If the cable/device is connected during boot, notifications from transceiver driver will be missed till musb driver is loaded.
Patch to configure the transceiver in the platform_enable/disable functions and enable the vbus in the gadget driver based on the last_event of the otg_transceiver.

Cc Felipe Balbi <[email protected]>

---
[Fixed the comments from Felipe]

drivers/usb/musb/musb_gadget.c | 4 +++

 drivers/usb/musb/omap2430.c    |   49 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 48 insertions(+), 5 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

drivers/usb/musb/musb_gadget.c +4 -0
Index: linux-2.6/drivers/usb/musb/musb_gadget.c
===================================================================
@@ -1855,6 +1855,10 @@ int usb_gadget_probe_driver(struct usb_g
 			} else {
 				hcd->self.uses_pio_for_control = 1;
 			}
+
+			if ((musb->xceiv->last_event == USB_EVENT_ID)
+						&& musb->xceiv->set_vbus)
+				otg_set_vbus(musb->xceiv, 1);
 		}
 	}
 
drivers/usb/musb/omap2430.c +48 -5

70 lines not on this page · raw message