Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1509053 > unrolled thread
| Started by | Alexandre Bailon <abailon@baylibre.com> |
|---|---|
| First post | 2016-10-26 13:00 +0200 |
| Last post | 2016-10-26 13:00 +0200 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 0/3] usb: musb: da8xx: Fix few issues Alexandre Bailon <abailon@baylibre.com> - 2016-10-26 13:00 +0200
[PATCH v2 1/3] usb: musb: da8xx: Call earlier clk_prepare_enable() Alexandre Bailon <abailon@baylibre.com> - 2016-10-26 13:00 +0200
[PATCH v2 3/3] usb: musb: da8xx: Only execute the OTG workaround when phy in OTG mode Alexandre Bailon <abailon@baylibre.com> - 2016-10-26 13:00 +0200
| From | Alexandre Bailon <abailon@baylibre.com> |
|---|---|
| Date | 2016-10-26 13:00 +0200 |
| Subject | [PATCH v2 0/3] usb: musb: da8xx: Fix few issues |
| Message-ID | <swu65-2w2-11@gated-at.bofh.it> |
Currently, the USB OTG of the da8xx doesn't work. This series intend to fix them. Change in v2: * Fix the error path da8xx_musb_init() Alexandre Bailon (3): usb: musb: da8xx: Call earlier clk_prepare_enable() phy: da8xx-usb: Configure CFGCHIP2 to support OTG workaround usb: musb: da8xx: Only execute the OTG workaround when phy in OTG mode drivers/phy/phy-da8xx-usb.c | 17 ++++++++++++----- drivers/usb/musb/da8xx.c | 28 +++++++++++++++++++--------- 2 files changed, 31 insertions(+), 14 deletions(-) -- 2.7.3
[toc] | [next] | [standalone]
| From | Alexandre Bailon <abailon@baylibre.com> |
|---|---|
| Date | 2016-10-26 13:00 +0200 |
| Subject | [PATCH v2 1/3] usb: musb: da8xx: Call earlier clk_prepare_enable() |
| Message-ID | <swu66-2w2-29@gated-at.bofh.it> |
| In reply to | #1509053 |
The first attempt to read a register may fail because the clock may not
be enabled, and then the probe of musb driver will fail.
Call clk_prepare_enable() before the first register read.
Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
---
drivers/usb/musb/da8xx.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 210b7e4..6749aa1 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -366,6 +366,12 @@ static int da8xx_musb_init(struct musb *musb)
musb->mregs += DA8XX_MENTOR_CORE_OFFSET;
+ ret = clk_prepare_enable(glue->clk);
+ if (ret) {
+ dev_err(glue->dev, "failed to enable clock\n");
+ return ret;
+ }
+
/* Returns zero if e.g. not clocked */
rev = musb_readl(reg_base, DA8XX_USB_REVISION_REG);
if (!rev)
@@ -377,12 +383,6 @@ static int da8xx_musb_init(struct musb *musb)
goto fail;
}
- ret = clk_prepare_enable(glue->clk);
- if (ret) {
- dev_err(glue->dev, "failed to enable clock\n");
- goto fail;
- }
-
setup_timer(&otg_workaround, otg_timer, (unsigned long)musb);
/* Reset the controller */
@@ -392,7 +392,7 @@ static int da8xx_musb_init(struct musb *musb)
ret = phy_init(glue->phy);
if (ret) {
dev_err(glue->dev, "Failed to init phy.\n");
- goto err_phy_init;
+ goto fail;
}
ret = phy_power_on(glue->phy);
@@ -412,9 +412,8 @@ static int da8xx_musb_init(struct musb *musb)
err_phy_power_on:
phy_exit(glue->phy);
-err_phy_init:
- clk_disable_unprepare(glue->clk);
fail:
+ clk_disable_unprepare(glue->clk);
return ret;
}
--
2.7.3
[toc] | [prev] | [next] | [standalone]
| From | Alexandre Bailon <abailon@baylibre.com> |
|---|---|
| Date | 2016-10-26 13:00 +0200 |
| Subject | [PATCH v2 3/3] usb: musb: da8xx: Only execute the OTG workaround when phy in OTG mode |
| Message-ID | <swu66-2w2-23@gated-at.bofh.it> |
| In reply to | #1509053 |
When the phy is forced in host mode, only the first hot plug and hot remove works. That is actually because the driver execute the OTG workaround, whereas it is not applicable in host or device mode. Indeed, to work correctly, the VBUS sense and session end comparator must be enabled, what is only possible when the phy is in OTG mode. Only execute the workaround if the phy is in OTG mode. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> --- drivers/usb/musb/da8xx.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 6749aa1..b8a6b65 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -145,6 +145,17 @@ static void otg_timer(unsigned long _musb) unsigned long flags; /* + * We should only execute the OTG workaround when the phy is in OTG + * mode. The workaround require the VBUS sense and the session end + * comparator to be enabled, what is only possible if the phy is in + * OTG mode. As the workaround is only required to detect if the + * controller must act as host or device, we can safely exit OTG is + * not in use. + */ + if (musb->port_mode != MUSB_PORT_MODE_DUAL_ROLE) + return; + + /* * We poll because DaVinci's won't expose several OTG-critical * status change events (from the transceiver) otherwise. */ -- 2.7.3
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web