From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751166AbdALPlc (ORCPT ); Thu, 12 Jan 2017 10:41:32 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:50002 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751141AbdALPla (ORCPT ); Thu, 12 Jan 2017 10:41:30 -0500 Subject: Re: [PATCH] usb: dwc2: gadget: Fix GUSBCFG.USBTRDTIM value References: <1484235416-24497-1-git-send-email-amelie.delaunay@st.com> <1484235416-24497-2-git-send-email-amelie.delaunay@st.com> To: John Youn , Greg Kroah-Hartman CC: , From: Amelie DELAUNAY Message-ID: <26c07f46-795b-d561-72ed-0548b63a98d9@st.com> Date: Thu, 12 Jan 2017 16:41:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1484235416-24497-2-git-send-email-amelie.delaunay@st.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.50] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SFHDAG3NODE2.st.com (10.75.127.8) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-01-12_12:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, Sorry, I did not see Pengcheng Li patch which is exactly the same: https://patchwork.kernel.org/patch/9347979/ Regards On 01/12/2017 04:36 PM, Amelie Delaunay wrote: > 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 > --- > 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; >