From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935233AbcLTOUe (ORCPT ); Tue, 20 Dec 2016 09:20:34 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:59535 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935205AbcLTOUZ (ORCPT ); Tue, 20 Dec 2016 09:20:25 -0500 Date: Tue, 20 Dec 2016 15:19:59 +0100 (CET) From: Stefan Wahren To: John Youn , Sevak Arakelyan , Greg Kroah-Hartman Cc: Michael Niewoehner , Felipe Balbi , Razmik Karapetyan , Dinh Nguyen , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Heiko Stuebner , Vardan Mikayelyan Message-ID: <977487332.280476.1482243599217@email.1und1.de> In-Reply-To: <15C49E4896EAA041B5EC6E28053E94311CF8B321@am04wembxb.internal.synopsys.com> References: <1482165496-6917-1-git-send-email-stefan.wahren@i2se.com> <15C49E4896EAA041B5EC6E28053E94311CF8B321@am04wembxb.internal.synopsys.com> Subject: Re: [PATCH RFT] usb: dwc2: gadget: Fix fifo size configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.1-Rev27 X-Originating-Client: open-xchange-appsuite X-Provags-ID: V03:K0:afcPPl2GXbjZdY6rW4TszX5sruiaWHr18QslpMB80qiyr6+bbib oEGHyj2Tif5VnLXeb1fDAAvkDRYlFxAslg5AIeF2FKywZV33k2paCMlEAQSXiEWMrFx2M0A VuMzMNKPEKZTB9yyVwBYAqiB50cbUNRjBndvyROV61GSYJQu9bjAZSA8DeufMQAXuCr+Zq0 Ntq/5YTRKw7TC7WdVR/oA== X-UI-Out-Filterresults: notjunk:1;V01:K0:YVxgaocR6D4=:zTwjcC3g/acXjnAqMu6i2r 6SWDdrt0ZkaZt51iWgdt5B60GUn252F+e/XXY24OTtkUgolbiHD/zH1KCeSjRDHoKYV9ueQ/k /L1675FN62NDybS+PoqE7obkeCuho7QjpewJ9+d6me3Cze9u9FiGN7WDAO0onzrJPRxdJOoTd Pvc0LnkQTExw7rMDnS5MiFTvNIaSx6uoHTtBW0TEvfW6PrKUxleOsxdS5fDRhhk2Yjlg71aN4 ZgYNOyNmRSJK6roFZS3pSZnHvwfF9Jy8gELU+3pbU1lvTPQggHWCWmOP2+5DpNlOKjzZMCexv O3akYKLmSw9sSYxoeP+Thwgq0TDCwY3Kvp1rz3ia1HX/gZmSquq186JQPNRN/NY/Mqdha07HA oaIa7Td1gapDCUHDqUWYw0kz6Hhy9J8M0R5CR78Et8TUsPjKD0QU1F81MjhIGgw3+9vLOHkr1 T7481fDNnhKY63fmqeajeb9t4HwWR2uslzjQ/ySQCc+QMdNi4EFzWGCA/KNTngoNsWdk20mVD UIUDk+15yivCLqr54ZlfslLhKOBIYU0lKm94E/N2pNJJWRxcHjTDdEHa1tbpumb6RmoVnkOrB mm7AHEk2+hatXMkDigKOdjar30/RMubEKifpqyHbx6kB4b3NntTnEdfmfYAk/1qL0fNNQmqxZ EUgMQN+3b/B7BQRDlph+urNVmgW6Dh/kxGqBQsp5EsJb4XWv/phE/RyAksuj+hmPllTZm0aSB fWq79jvk4ZGBAdYE Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sevak, > Sevak Arakelyan hat am 20. Dezember 2016 um 13:57 geschrieben: > > > On 12/19/2016 8:39 PM, Stefan Wahren wrote: > > Currently the upper limit for the endpoint index during fifo size > > config was always 16 instead of the available endpoints. So fix this > > by using the determined amount of endpoints and avoid a warning about > > "insufficient fifo memory" on bcm2835 which has only 8 endpoints. > > > > Signed-off-by: Stefan Wahren > > Fixes: 0a176279db68 ("usb: dwc2: gadget: configure fifos from device tree") > > --- > > drivers/usb/dwc2/gadget.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > Since revert of ("usb: dwc2: gadget: fix TX FIFO size and address") which > > caused regressions on some platforms this is the second attempt to fix > > gadget support for bcm2835. > > > > diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c > > index b95930f..b00184c 100644 > > --- a/drivers/usb/dwc2/gadget.c > > +++ b/drivers/usb/dwc2/gadget.c > > @@ -228,7 +228,7 @@ static void dwc2_hsotg_init_fifo(struct dwc2_hsotg *hsotg) > > * them to endpoints dynamically according to maxpacket size value of > > * given endpoint. > > */ > > - for (ep = 1; ep < MAX_EPS_CHANNELS; ep++) { > > + for (ep = 1; ep < hsotg->num_of_eps; ep++) { > > if (!txfsz[ep]) > > continue; > > val = addr; > > Hi Stefan, > > This patch is only temporary, not full solution for bcm2835 and in > the loop you need to use hsotg->num_of_eps in shared FIFO mode and the > number of device IN EPs which is in GHWCFG4 with mask > GHWCFG4_NUM_IN_EPS_MASK in dedicated FIFO mode. i don't have any documentation for this. So i tried to fix this obviously error. > > The upper limit is up to 15 but the actual number of FIFOa are being > configured according to the given legacy array > DWC2_G_P_LEGACY_TX_FIFO_SIZE {256, 256, 256, 256, 768, 768, 768, 768, 0, > 0, 0, 0, 0, 0, 0}, in that case it is 8 FIFOs. The legacy values are the > main issue. We must do correct calculation according to FIFO operation > mode, device operation mode, take into consideration the EP Info Block > which must be at the end of total FIFO and after that configure correct > number of FIFOs with correct size of depth on every setup. We prepared a > patch series to fix that issue and it is under internal review and > testing process and will be submitted soon. I wanted to avoid this by providing the TX FIFO sizes via DT [1]. Sorry for my impatience. [1] - https://github.com/lategoodbye/rpi-zero/commit/a6ec75dd8ea6a7ce0609ae082d3fa748beaba22c > > Thanks, > Sevak >