public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [1/7 v2] usb: otg: enable regulator only on cable/device connect
@ 2011-02-15  9:42 Hema HK
       [not found] ` <1297762958-26199-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Hema HK @ 2011-02-15  9:42 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, Kalliguddi, Hema, Felipe Balbi

From: Kalliguddi, Hema <hemahk-l0cyMroinI0@public.gmane.org>

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.

Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
Cc: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>

---
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Index: linux-2.6/drivers/usb/otg/twl6030-usb.c
===================================================================
--- linux-2.6.orig/drivers/usb/otg/twl6030-usb.c
+++ 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [2/7 v2] usb: otg: Remove one unnecessary I2C read request.
       [not found] ` <1297762958-26199-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
@ 2011-02-15  9:42   ` Hema HK
  2011-02-15  9:42   ` [4/7 v2] usb: otg: OMAP4430: Add phy_suspend function pointer to Hema HK
  2011-02-15  9:42   ` [5/7 v2] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function Hema HK
  2 siblings, 0 replies; 13+ messages in thread
From: Hema HK @ 2011-02-15  9:42 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, Kalliguddi, Hema, Felipe Balbi

From: Kalliguddi, Hema <hemahk-l0cyMroinI0@public.gmane.org>

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

Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
Cc: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>

---
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Index: linux-2.6/drivers/usb/otg/twl6030-usb.c
===================================================================
--- linux-2.6.orig/drivers/usb/otg/twl6030-usb.c
+++ 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);

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

* [3/7 v2] usb: otg: OMAP4430: Introducing suspend function for power management
  2011-02-15  9:42 [1/7 v2] usb: otg: enable regulator only on cable/device connect Hema HK
       [not found] ` <1297762958-26199-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
@ 2011-02-15  9:42 ` Hema HK
  2011-02-15  9:42 ` [6/7 v2] usb: otg: TWL6030 Save the last event in otg_transceiver Hema HK
  2011-02-15  9:42 ` [7/7 v2] usb: musb: OMAP4430: Fix usb device detection if connected during boot Hema HK
  3 siblings, 0 replies; 13+ messages in thread
From: Hema HK @ 2011-02-15  9:42 UTC (permalink / raw)
  To: linux-usb; +Cc: linux-omap, Kalliguddi, Hema, Felipe Balbi, Tony Lindgren

From: Kalliguddi, Hema <hemahk@ti.com>

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.

Signed-off-by: Hema HK <hemahk@ti.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Tony Lindgren <tony@atomide.com>

---
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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Index: linux-2.6/arch/arm/mach-omap2/omap_phy_internal.c
===================================================================
--- linux-2.6.orig/arch/arm/mach-omap2/omap_phy_internal.c
+++ 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;

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

* [4/7 v2] usb: otg: OMAP4430: Add phy_suspend function pointer to
       [not found] ` <1297762958-26199-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
  2011-02-15  9:42   ` [2/7 v2] usb: otg: Remove one unnecessary I2C read request Hema HK
@ 2011-02-15  9:42   ` Hema HK
  2011-02-15 12:18     ` Sergei Shtylyov
  2011-02-15  9:42   ` [5/7 v2] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function Hema HK
  2 siblings, 1 reply; 13+ messages in thread
From: Hema HK @ 2011-02-15  9:42 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, Kalliguddi, Hema, Felipe Balbi,
	Tony Lindgren

From: Kalliguddi, Hema <hemahk-l0cyMroinI0@public.gmane.org>

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.

Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
Cc: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
Cc: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>

---
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Index: linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
===================================================================
--- linux-2.6.orig/arch/arm/mach-omap2/board-4430sdp.c
+++ 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[] = {
Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
===================================================================
--- linux-2.6.orig/arch/arm/mach-omap2/board-omap4panda.c
+++ 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[] = {
Index: linux-2.6/arch/arm/plat-omap/include/plat/usb.h
===================================================================
--- linux-2.6.orig/arch/arm/plat-omap/include/plat/usb.h
+++ 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
 
Index: linux-2.6/include/linux/i2c/twl.h
===================================================================
--- linux-2.6.orig/include/linux/i2c/twl.h
+++ 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [5/7 v2] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function.
       [not found] ` <1297762958-26199-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
  2011-02-15  9:42   ` [2/7 v2] usb: otg: Remove one unnecessary I2C read request Hema HK
  2011-02-15  9:42   ` [4/7 v2] usb: otg: OMAP4430: Add phy_suspend function pointer to Hema HK
@ 2011-02-15  9:42   ` Hema HK
       [not found]     ` <1297762958-26199-5-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
  2 siblings, 1 reply; 13+ messages in thread
From: Hema HK @ 2011-02-15  9:42 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, Kalliguddi, Hema, Felipe Balbi

From: Kalliguddi, Hema <hemahk-l0cyMroinI0@public.gmane.org>

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.

Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
Cc: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>

---
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Index: linux-2.6/drivers/usb/otg/twl6030-usb.c
===================================================================
--- linux-2.6.orig/drivers/usb/otg/twl6030-usb.c
+++ 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [6/7 v2] usb: otg: TWL6030 Save the last event in otg_transceiver
  2011-02-15  9:42 [1/7 v2] usb: otg: enable regulator only on cable/device connect Hema HK
       [not found] ` <1297762958-26199-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
  2011-02-15  9:42 ` [3/7 v2] usb: otg: OMAP4430: Introducing suspend function for power management Hema HK
@ 2011-02-15  9:42 ` Hema HK
  2011-02-15  9:42 ` [7/7 v2] usb: musb: OMAP4430: Fix usb device detection if connected during boot Hema HK
  3 siblings, 0 replies; 13+ messages in thread
From: Hema HK @ 2011-02-15  9:42 UTC (permalink / raw)
  To: linux-usb; +Cc: linux-omap, Kalliguddi, Hema, Felipe Balbi

From: Kalliguddi, Hema <hemahk@ti.com>

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.

Signed-off-by: Hema HK <hemahk@ti.com>
Cc: Felipe Balbi <balbi@ti.com>

---
[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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Index: linux-2.6/drivers/usb/otg/twl6030-usb.c
===================================================================
--- linux-2.6.orig/drivers/usb/otg/twl6030-usb.c
+++ 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  {
Index: linux-2.6/include/linux/usb/otg.h
===================================================================
--- linux-2.6.orig/include/linux/usb/otg.h
+++ 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;

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

* [7/7 v2] usb: musb: OMAP4430: Fix usb device detection if connected during boot
  2011-02-15  9:42 [1/7 v2] usb: otg: enable regulator only on cable/device connect Hema HK
                   ` (2 preceding siblings ...)
  2011-02-15  9:42 ` [6/7 v2] usb: otg: TWL6030 Save the last event in otg_transceiver Hema HK
@ 2011-02-15  9:42 ` Hema HK
  3 siblings, 0 replies; 13+ messages in thread
From: Hema HK @ 2011-02-15  9:42 UTC (permalink / raw)
  To: linux-usb; +Cc: linux-omap, Kalliguddi, Hema, Felipe Balbi

From: Kalliguddi, Hema <hemahk@ti.com>

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.

Signed-off-by: Hema HK <hemahk@ti.com>
Cc: Felipe Balbi <balbi@ti.com>

---
[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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Index: linux-2.6/drivers/usb/musb/musb_gadget.c
===================================================================
--- linux-2.6.orig/drivers/usb/musb/musb_gadget.c
+++ 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);
 		}
 	}
 
Index: linux-2.6/drivers/usb/musb/omap2430.c
===================================================================
--- linux-2.6.orig/drivers/usb/musb/omap2430.c
+++ linux-2.6/drivers/usb/musb/omap2430.c
@@ -350,16 +350,56 @@ static int omap2430_musb_init(struct mus
 	if (status)
 		DBG(1, "notification register failed\n");
 
-	/* check whether cable is already connected */
-	if (musb->xceiv->state ==OTG_STATE_B_IDLE)
-		musb_otg_notifications(&musb->nb, 1,
-					musb->xceiv->gadget);
-
 	setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
 
 	return 0;
 }
 
+static void omap2430_musb_enable(struct musb *musb)
+{
+	u8		devctl;
+	unsigned long timeout = jiffies + msecs_to_jiffies(1000);
+	struct device *dev = musb->controller;
+	struct musb_hdrc_platform_data *pdata = dev->platform_data;
+	struct omap_musb_board_data *data = pdata->board_data;
+
+	switch (musb->xceiv->last_event) {
+
+	case USB_EVENT_ID:
+		otg_init(musb->xceiv);
+		if (data->interface_type == MUSB_INTERFACE_UTMI) {
+			devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
+			/* start the session */
+			devctl |= MUSB_DEVCTL_SESSION;
+			musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
+			while (musb_readb(musb->mregs, MUSB_DEVCTL) &
+						MUSB_DEVCTL_BDEVICE) {
+				cpu_relax();
+
+				if (time_after(jiffies, timeout)) {
+					dev_err(musb->controller,
+					"configured as A device timeout");
+					break;
+				}
+			}
+		}
+		break;
+
+	case USB_EVENT_VBUS:
+		otg_init(musb->xceiv);
+		break;
+
+	default:
+		break;
+	}
+}
+
+static void omap2430_musb_disable(struct musb *musb)
+{
+	if (musb->xceiv->last_event)
+		otg_shutdown(musb->xceiv);
+}
+
 static int omap2430_musb_exit(struct musb *musb)
 {
 
@@ -377,6 +417,9 @@ static const struct musb_platform_ops om
 	.try_idle	= omap2430_musb_try_idle,
 
 	.set_vbus	= omap2430_musb_set_vbus,
+
+	.enable		= omap2430_musb_enable,
+	.disable	= omap2430_musb_disable,
 };
 
 static u64 omap2430_dmamask = DMA_BIT_MASK(32);

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

* Re: [4/7 v2] usb: otg: OMAP4430: Add phy_suspend function pointer to
  2011-02-15  9:42   ` [4/7 v2] usb: otg: OMAP4430: Add phy_suspend function pointer to Hema HK
@ 2011-02-15 12:18     ` Sergei Shtylyov
       [not found]       ` <4D5A6F20.5060109-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2011-02-15 12:18 UTC (permalink / raw)
  To: Hema HK; +Cc: linux-usb, linux-omap, Felipe Balbi, Tony Lindgren

Hello.

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

    The subject seems incomplete.

> From: Kalliguddi, Hema<hemahk@ti.com>

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

> Signed-off-by: Hema HK<hemahk@ti.com>
> Cc: Felipe Balbi<balbi@ti.com>
> Cc: Tony Lindgren<tony@atomide.com>

[...]

> Index: linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
> ===================================================================
> --- linux-2.6.orig/arch/arm/mach-omap2/board-4430sdp.c
> +++ 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[] = {
> Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
> ===================================================================
> --- linux-2.6.orig/arch/arm/mach-omap2/board-omap4panda.c
> +++ 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[] = {
> Index: linux-2.6/arch/arm/plat-omap/include/plat/usb.h
> ===================================================================
> --- linux-2.6.orig/arch/arm/plat-omap/include/plat/usb.h
> +++ 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);

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

>   #endif
>
> Index: linux-2.6/include/linux/i2c/twl.h
> ===================================================================
> --- linux-2.6.orig/include/linux/i2c/twl.h
> +++ 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);
>   };

    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

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

* Re: [5/7 v2] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function.
       [not found]     ` <1297762958-26199-5-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
@ 2011-02-15 12:22       ` Sergei Shtylyov
  2011-02-16  5:16         ` Hema Kalliguddi
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2011-02-15 12:22 UTC (permalink / raw)
  To: Hema HK
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Felipe Balbi

Hello.

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

> From: Kalliguddi, Hema<hemahk-l0cyMroinI0@public.gmane.org>

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

> Signed-off-by: Hema HK<hemahk-l0cyMroinI0@public.gmane.org>
> Cc: Felipe Balbi<balbi-l0cyMroinI0@public.gmane.org>

[...]

> Index: linux-2.6/drivers/usb/otg/twl6030-usb.c
> ===================================================================
> --- linux-2.6.orig/drivers/usb/otg/twl6030-usb.c
> +++ 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;

    Why not do all the above in the intializers?

> +	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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [4/7 v2] usb: otg: OMAP4430: Add phy_suspend function pointer to
       [not found]       ` <4D5A6F20.5060109-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
@ 2011-02-16  5:14         ` Hema Kalliguddi
       [not found]           ` <137f7a77ed983ac5f3d08eaea0b2bb66-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Hema Kalliguddi @ 2011-02-16  5:14 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Felipe Balbi, Tony Lindgren

Hi,

>-----Original Message-----
>From: Sergei Shtylyov [mailto:sshtylyov-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org]
>Sent: Tuesday, February 15, 2011 5:49 PM
>To: Hema HK
>Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org;
>Felipe Balbi; Tony Lindgren
>Subject: 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.
Yes. it suppose to be "usb: otg: OMAP4430: Add phy_suspend function
pointer
to twl4030_usb_data"

I will correct it
>
>> From: Kalliguddi, Hema<hemahk-l0cyMroinI0@public.gmane.org>
>
>> 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.
>
>> Signed-off-by: Hema HK<hemahk-l0cyMroinI0@public.gmane.org>
>> Cc: Felipe Balbi<balbi-l0cyMroinI0@public.gmane.org>
>> Cc: Tony Lindgren<tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
>
>[...]
>
>> Index: linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
>> ===================================================================
>> --- linux-2.6.orig/arch/arm/mach-omap2/board-4430sdp.c
>> +++ 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[] = {
>> Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
>> ===================================================================
>> --- linux-2.6.orig/arch/arm/mach-omap2/board-omap4panda.c
>> +++ 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[] = {
>> Index: linux-2.6/arch/arm/plat-omap/include/plat/usb.h
>> ===================================================================
>> --- linux-2.6.orig/arch/arm/plat-omap/include/plat/usb.h
>> +++ 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);
>
>    I think this *extern* declaration should be a part of the
>previous patch.

What is the problem if extern when using?

>
>>   #endif
>>
>> Index: linux-2.6/include/linux/i2c/twl.h
>> ===================================================================
>> --- linux-2.6.orig/include/linux/i2c/twl.h
>> +++ 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);
>>   };
>
>    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
>WBR, Sergei
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [5/7 v2] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function.
  2011-02-15 12:22       ` Sergei Shtylyov
@ 2011-02-16  5:16         ` Hema Kalliguddi
  0 siblings, 0 replies; 13+ messages in thread
From: Hema Kalliguddi @ 2011-02-16  5:16 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-usb, linux-omap, Felipe Balbi

 Hi,

>-----Original Message-----
>From: Sergei Shtylyov [mailto:sshtylyov@mvista.com]
>Sent: Tuesday, February 15, 2011 5:52 PM
>To: Hema HK
>Cc: linux-usb@vger.kernel.org; linux-omap@vger.kernel.org; Felipe Balbi
>Subject: Re: [5/7 v2] usb: otg: TWL6030: Introduce the
>twl6030_phy_suspend function.
>
>Hello.
>
>On 15-02-2011 12:42, Hema HK wrote:
>
>> From: Kalliguddi, Hema<hemahk@ti.com>
>
>> 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.
>
>> Signed-off-by: Hema HK<hemahk@ti.com>
>> Cc: Felipe Balbi<balbi@ti.com>
>
>[...]
>
>> Index: linux-2.6/drivers/usb/otg/twl6030-usb.c
>> ===================================================================
>> --- linux-2.6.orig/drivers/usb/otg/twl6030-usb.c
>> +++ 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;
>
>    Why not do all the above in the intializers?

Can be done that way as well.

Regards,
Hema
>
>> +	pdata->phy_suspend(twl->dev, suspend);
>> +
>> +	return 0;
>> +}
>> +
>
>WBR, Sergei
>

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

* Re: [4/7 v2] usb: otg: OMAP4430: Add phy_suspend function pointer to
       [not found]           ` <137f7a77ed983ac5f3d08eaea0b2bb66-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-02-16 11:36             ` Sergei Shtylyov
       [not found]               ` <4D5BB6BF.7050603-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2011-02-16 11:36 UTC (permalink / raw)
  To: Hema Kalliguddi
  Cc: Sergei Shtylyov, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Felipe Balbi, Tony Lindgren

Hello.

On 16-02-2011 8:14, Hema Kalliguddi wrote:

>>> From: Kalliguddi, Hema<hemahk-l0cyMroinI0@public.gmane.org>

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

>>> Signed-off-by: Hema HK<hemahk-l0cyMroinI0@public.gmane.org>
>>> Cc: Felipe Balbi<balbi-l0cyMroinI0@public.gmane.org>
>>> Cc: Tony Lindgren<tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>

>> [...]

>>> Index: linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
>>> ===================================================================
>>> --- linux-2.6.orig/arch/arm/mach-omap2/board-4430sdp.c
>>> +++ 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[] = {
>>> Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
>>> ===================================================================
>>> --- linux-2.6.orig/arch/arm/mach-omap2/board-omap4panda.c
>>> +++ 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[] = {
>>> Index: linux-2.6/arch/arm/plat-omap/include/plat/usb.h
>>> ===================================================================
>>> --- linux-2.6.orig/arch/arm/plat-omap/include/plat/usb.h
>>> +++ 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);

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

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

>>>    #endif
>>>
>>> Index: linux-2.6/include/linux/i2c/twl.h
>>> ===================================================================
>>> --- linux-2.6.orig/include/linux/i2c/twl.h
>>> +++ 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);
>>>    };

>>     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?

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

> Regards,
> Hema

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

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

* RE: [4/7 v2] usb: otg: OMAP4430: Add phy_suspend function pointer to
       [not found]               ` <4D5BB6BF.7050603-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
@ 2011-02-16 13:48                 ` Hema Kalliguddi
  0 siblings, 0 replies; 13+ messages in thread
From: Hema Kalliguddi @ 2011-02-16 13:48 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Felipe Balbi, Tony Lindgren

Hi,

>-----Original Message-----
>From: Sergei Shtylyov [mailto:sshtylyov-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org]
>Sent: Wednesday, February 16, 2011 5:07 PM
>To: Hema Kalliguddi
>Cc: Sergei Shtylyov; linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org;
>linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Felipe Balbi; Tony Lindgren
>Subject: Re: [4/7 v2] usb: otg: OMAP4430: Add phy_suspend
>function pointer to
>
>Hello.
>
>On 16-02-2011 8:14, Hema Kalliguddi wrote:
>
>>>> From: Kalliguddi, Hema<hemahk-l0cyMroinI0@public.gmane.org>
>
>>>> 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.
>
>>>> Signed-off-by: Hema HK<hemahk-l0cyMroinI0@public.gmane.org>
>>>> Cc: Felipe Balbi<balbi-l0cyMroinI0@public.gmane.org>
>>>> Cc: Tony Lindgren<tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
>
>>> [...]
>
>>>> Index: linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
>>>> ===================================================================
>>>> --- linux-2.6.orig/arch/arm/mach-omap2/board-4430sdp.c
>>>> +++ 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[] = {
>>>> Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
>>>> ===================================================================
>>>> --- linux-2.6.orig/arch/arm/mach-omap2/board-omap4panda.c
>>>> +++ 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[] = {
>>>> Index: linux-2.6/arch/arm/plat-omap/include/plat/usb.h
>>>> ===================================================================
>>>> --- linux-2.6.orig/arch/arm/plat-omap/include/plat/usb.h
>>>> +++ 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);
>
>>>     I think this *extern* declaration should be a part of the
>>> previous patch.
>
>> 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...
>
>>>>    #endif
>>>>
>>>> Index: linux-2.6/include/linux/i2c/twl.h
>>>> ===================================================================
>>>> --- linux-2.6.orig/include/linux/i2c/twl.h
>>>> +++ 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);
>>>>    };
>
>>>     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?
>
>> 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.
>

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

Regards,
Hema

>> Regards,
>> Hema
>
>WBR, Sergei
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2011-02-16 13:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-15  9:42 [1/7 v2] usb: otg: enable regulator only on cable/device connect Hema HK
     [not found] ` <1297762958-26199-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
2011-02-15  9:42   ` [2/7 v2] usb: otg: Remove one unnecessary I2C read request Hema HK
2011-02-15  9:42   ` [4/7 v2] usb: otg: OMAP4430: Add phy_suspend function pointer to Hema HK
2011-02-15 12:18     ` Sergei Shtylyov
     [not found]       ` <4D5A6F20.5060109-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2011-02-16  5:14         ` Hema Kalliguddi
     [not found]           ` <137f7a77ed983ac5f3d08eaea0b2bb66-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-16 11:36             ` Sergei Shtylyov
     [not found]               ` <4D5BB6BF.7050603-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2011-02-16 13:48                 ` Hema Kalliguddi
2011-02-15  9:42   ` [5/7 v2] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function Hema HK
     [not found]     ` <1297762958-26199-5-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
2011-02-15 12:22       ` Sergei Shtylyov
2011-02-16  5:16         ` Hema Kalliguddi
2011-02-15  9:42 ` [3/7 v2] usb: otg: OMAP4430: Introducing suspend function for power management Hema HK
2011-02-15  9:42 ` [6/7 v2] usb: otg: TWL6030 Save the last event in otg_transceiver Hema HK
2011-02-15  9:42 ` [7/7 v2] usb: musb: OMAP4430: Fix usb device detection if connected during boot Hema HK

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox