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@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox