From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iwLoW-0001I0-BO for barebox@lists.infradead.org; Tue, 28 Jan 2020 08:01:37 +0000 Date: Tue, 28 Jan 2020 09:01:30 +0100 From: Sascha Hauer Message-ID: <20200128080130.fcps4emjoudtixzx@pengutronix.de> References: <20200122154908.22635-1-jmaselbas@kalray.eu> <20200122154908.22635-2-jmaselbas@kalray.eu> <20200124143259.7f4hxax2onus7giq@pengutronix.de> <20200127172312.pwkse4ggrmnv4smd@tellis.lin.mbt.kalray.eu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200127172312.pwkse4ggrmnv4smd@tellis.lin.mbt.kalray.eu> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH v2 1/7] usb: dwc2: Add host controller driver To: Jules Maselbas Cc: Barebox List On Mon, Jan 27, 2020 at 06:23:12PM +0100, Jules Maselbas wrote: > Hi Sascha, > > On Fri, Jan 24, 2020 at 03:32:59PM +0100, Sascha Hauer wrote: > > Hi Jules, > > > > I can confirm the driver works on the RaspberryPi with some adjustments, > > see below. Some more comments inline. > > > > > +static int wait_for_chhltd(struct dwc2 *dwc2, u8 hc, uint32_t *sub, u8 *tgl) > > > +{ > > > + int ret; > > > + uint32_t hcint, hctsiz; > > > + > > > + ret = dwc2_wait_bit_set(dwc2, HCINT(hc), HCINTMSK_CHHLTD, 10000); > > > + if (ret) > > > + dwc2_err(dwc2, "%s: Timeout! Channel not halted\n", __func__); > > > > This is not an error, but a normal usecase. This should be: > > > > if (ret) { > > uint32_t val = dwc2_readl(dwc2, HCCHAR(hc)); > > dwc2_writel(dwc2, val | HCCHAR_CHDIS, HCCHAR(hc)); > > dwc2_wait_bit_set(dwc2, HCINT(hc), HCINTMSK_CHHLTD, 10000); > > return ret; > > } > Okay I will make this change, but should this return if the last call to > wait_bit_set() is successful? No. If the last call to wait_bit_set is successful it means that we successfully stopped the ongoing transfer. The transfer itself still timed out and we want to tell this to the caller. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox