From: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org,
rob-VoJi6FS/r0vR7s880joybQ@public.gmane.org,
linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
kishon-l0cyMroinI0@public.gmane.org,
balbi-l0cyMroinI0@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: Moiz Sonasath <m-sonasath-l0cyMroinI0@public.gmane.org>
Subject: [PATCH 3/4] usb: phy: omap-usb3: Decrease the number of transitions to recovery
Date: Wed, 19 Sep 2012 17:00:28 +0530 [thread overview]
Message-ID: <1348054229-27362-4-git-send-email-kishon@ti.com> (raw)
In-Reply-To: <1348054229-27362-1-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
Power-cycling the PHY (partially) decreases the number of transitions to
"Recovery" state. Hence changed the power up sequence to a partial
power-up before a full power-up of the PHY.
Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
Signed-off-by: Moiz Sonasath <m-sonasath-l0cyMroinI0@public.gmane.org>
---
drivers/usb/phy/omap-usb3.c | 43 ++++++++++++++++++++++++++++++++++++------
include/linux/usb/omap_usb.h | 1 +
2 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/phy/omap-usb3.c b/drivers/usb/phy/omap-usb3.c
index 26402d5..fb3c5e6 100644
--- a/drivers/usb/phy/omap-usb3.c
+++ b/drivers/usb/phy/omap-usb3.c
@@ -35,13 +35,15 @@ static struct usb_dpll_params omap_usb3_dpll_params[NUM_SYS_CLKS] = {
};
/**
- * omap5_usb_phy_power - power on/off the serializer using control module
+ * omap5_usb_phy_partial_powerup - power on the serializer using control module
* @phy: struct omap_usb *
- * @on: 0 to off and 1 to on based on powering on or off the PHY
*
- * omap_usb3 can call this API to power on or off the PHY.
+ * After the dwc3 module is disabled and enabled again the synchronization
+ * between dwc3 and phy goes bad and the device does not get enumerated
+ * in superspeed mode. After some trials it was found powering up TX and
+ * part of RX PHY helped to solve the issue.
*/
-static int omap5_usb_phy_power(struct omap_usb *phy, bool on)
+static int omap5_usb_phy_partial_powerup(struct omap_usb *phy)
{
u32 val;
unsigned long rate;
@@ -58,10 +60,32 @@ static int omap5_usb_phy_power(struct omap_usb *phy, bool on)
val = readl(phy->control_dev);
+ val &= ~(USB_PWRCTL_CLK_CMD_MASK | USB_PWRCTL_CLK_FREQ_MASK);
+ val |= (USB3_PHY_PARTIAL_RX_POWERON | USB3_PHY_TX_RX_POWERON)
+ << USB_PWRCTL_CLK_CMD_SHIFT;
+ val |= rate << USB_PWRCTL_CLK_FREQ_SHIFT;
+
+ writel(val, phy->control_dev);
+
+ return 0;
+}
+
+/**
+ * omap5_usb_phy_power - power on/off the serializer using control module
+ * @phy: struct omap_usb *
+ * @on: 0 to off and 1 to on based on powering on or off the PHY
+ *
+ * omap_usb3 can call this API to power on or off the PHY.
+ */
+static int omap5_usb_phy_power(struct omap_usb *phy, bool on)
+{
+ u32 val;
+
+ val = readl(phy->control_dev);
+
if (on) {
- val &= ~(USB_PWRCTL_CLK_CMD_MASK | USB_PWRCTL_CLK_FREQ_MASK);
+ val &= ~USB_PWRCTL_CLK_CMD_MASK;
val |= USB3_PHY_TX_RX_POWERON << USB_PWRCTL_CLK_CMD_SHIFT;
- val |= rate << USB_PWRCTL_CLK_FREQ_SHIFT;
} else {
val &= ~USB_PWRCTL_CLK_CMD_MASK;
val |= USB3_PHY_TX_RX_POWEROFF << USB_PWRCTL_CLK_CMD_SHIFT;
@@ -207,6 +231,13 @@ static int omap_usb3_init(struct usb_phy *x)
struct omap_usb *phy = phy_to_omapusb(x);
omap_usb_dpll_lock(phy);
+ omap5_usb_phy_partial_powerup(phy);
+ /*
+ * Give enough time for the PHY to partially power-up before
+ * powering it up completely. delay value suggested by the HW
+ * team.
+ */
+ mdelay(100);
omap5_usb_phy_power(phy, 1);
return 0;
diff --git a/include/linux/usb/omap_usb.h b/include/linux/usb/omap_usb.h
index 01ed008..62b637c 100644
--- a/include/linux/usb/omap_usb.h
+++ b/include/linux/usb/omap_usb.h
@@ -92,6 +92,7 @@ struct omap_usb {
#define USB3_PHY_TX_RX_POWERON 0x3
#define USB3_PHY_TX_RX_POWEROFF 0x0
+#define USB3_PHY_PARTIAL_RX_POWERON (0x1 << 6)
#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy)
--
1.7.9.5
next prev parent reply other threads:[~2012-09-19 11:30 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-19 11:30 [PATCH 0/4] usb: phy: add usb3 phy driver Kishon Vijay Abraham I
[not found] ` <1348054229-27362-1-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
2012-09-19 11:30 ` [PATCH 1/4] usb: phy: add a new driver for usb3 phy Kishon Vijay Abraham I
2012-09-19 14:41 ` Marc Kleine-Budde
2012-09-21 6:08 ` ABRAHAM, KISHON VIJAY
[not found] ` <1348054229-27362-2-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
2012-10-11 0:59 ` Tony Lindgren
2012-10-12 9:08 ` kishon
2012-10-12 15:03 ` Tony Lindgren
2012-09-19 11:30 ` [PATCH 2/4] usb: dwc3: Fix gadget pullup in SS mode Kishon Vijay Abraham I
2012-09-19 11:53 ` Felipe Balbi
2012-09-19 15:02 ` Sonasath, Moiz
2012-09-19 16:04 ` Felipe Balbi
2012-09-19 16:50 ` Sonasath, Moiz
[not found] ` <CAEgRx2yXStORBknr2hoMcobMO8wFGuKr4bvzZwEQHQQcHVH76Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-19 17:24 ` Felipe Balbi
2012-09-19 17:29 ` Felipe Balbi
2012-09-19 11:30 ` Kishon Vijay Abraham I [this message]
2012-09-19 11:55 ` [PATCH 3/4] usb: phy: omap-usb3: Decrease the number of transitions to recovery Felipe Balbi
2012-09-19 11:30 ` [PATCH 4/4] usb: phy: omap-usb2: enable 960Mhz clock for omap5 Kishon Vijay Abraham I
2012-09-19 11:56 ` Felipe Balbi
[not found] ` <20120919115647.GI3772-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2012-09-19 14:45 ` Marc Kleine-Budde
2012-09-19 14:42 ` Felipe Balbi
2012-09-19 14:50 ` Marc Kleine-Budde
2012-09-26 5:40 ` ABRAHAM, KISHON VIJAY
2012-09-26 18:27 ` Felipe Balbi
2012-09-27 5:13 ` ABRAHAM, KISHON VIJAY
2012-09-27 5:13 ` Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1348054229-27362-4-git-send-email-kishon@ti.com \
--to=kishon-l0cymroini0@public.gmane.org \
--cc=balbi-l0cyMroinI0@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=m-sonasath-l0cyMroinI0@public.gmane.org \
--cc=rob-VoJi6FS/r0vR7s880joybQ@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).