Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1557498 > unrolled thread

[PATCH] Fix USBTrdTim value in case of 8-bit UTMI+ phy

Started byAmelie Delaunay <amelie.delaunay@st.com>
First post2017-01-12 16:20 +0100
Last post2017-01-12 16:20 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] Fix USBTrdTim value in case of 8-bit UTMI+ phy Amelie Delaunay <amelie.delaunay@st.com> - 2017-01-12 16:20 +0100
    [PATCH] usb: dwc2: gadget: Fix GUSBCFG.USBTRDTIM value Amelie Delaunay <amelie.delaunay@st.com> - 2017-01-12 16:20 +0100

#1557498 — [PATCH] Fix USBTrdTim value in case of 8-bit UTMI+ phy

FromAmelie Delaunay <amelie.delaunay@st.com>
Date2017-01-12 16:20 +0100
Subject[PATCH] Fix USBTrdTim value in case of 8-bit UTMI+ phy
Message-ID<sYPkt-5y0-13@gated-at.bofh.it>
This problem was spotted during code review. It appears that USBTrdTim value
is not correctly set in case of 8-bit UTMI+ phy, because it is ORed with
USBCFG.USBTRDTIM reset value, which is 0x5.
I have no hardware to test it.

Amelie Delaunay (1):
  usb: dwc2: gadget: Fix GUSBCFG.USBTRDTIM value

 drivers/usb/dwc2/gadget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1557500 — [PATCH] usb: dwc2: gadget: Fix GUSBCFG.USBTRDTIM value

FromAmelie Delaunay <amelie.delaunay@st.com>
Date2017-01-12 16:20 +0100
Subject[PATCH] usb: dwc2: gadget: Fix GUSBCFG.USBTRDTIM value
Message-ID<sYPku-5y0-29@gated-at.bofh.it>
In reply to#1557498
USBTrdTim must be programmed to 0x5 when phy has a UTMI+ 16-bit wide
interface or 0x9 when it has a 8-bit wide interface.
GUSBCFG reset value (Value After Reset: 0x1400) sets USBTrdTim to 0x5.
In case of 8-bit UTMI+, without clearing GUSBCFG.USBTRDTIM mask, USBTrdTim
results in 0xD (0x5 | 0x9).
That's why we need to clear GUSBCFG.USBTRDTIM mask before setting USBTrdTim
value, to ensure USBTrdTim is correctly set in case of 8-bit UTMI+.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/usb/dwc2/gadget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index c55db4a..86b2076 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3169,7 +3169,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
 	/* keep other bits untouched (so e.g. forced modes are not lost) */
 	usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
 	usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
-		GUSBCFG_HNPCAP);
+		GUSBCFG_HNPCAP | GUSBCFG_USBTRDTIM_MASK);
 
 	if (hsotg->params.phy_type == DWC2_PHY_TYPE_PARAM_FS &&
 	    (hsotg->params.speed == DWC2_SPEED_PARAM_FULL ||
@@ -4131,7 +4131,7 @@ static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
 	/* keep other bits untouched (so e.g. forced modes are not lost) */
 	usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
 	usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
-		GUSBCFG_HNPCAP);
+		GUSBCFG_HNPCAP | GUSBCFG_USBTRDTIM_MASK);
 
 	/* set the PLL on, remove the HNP/SRP and set the PHY */
 	trdtim = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
-- 
1.9.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web