From patchwork Tue Jul 26 18:53:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 9248697 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 92804607F2 for ; Tue, 26 Jul 2016 18:56:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8345E208C2 for ; Tue, 26 Jul 2016 18:56:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77DF926A4D; Tue, 26 Jul 2016 18:56:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2183E208C2 for ; Tue, 26 Jul 2016 18:56:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bS7V9-00012D-7Z; Tue, 26 Jul 2016 18:54:47 +0000 Received: from mout.kundenserver.de ([212.227.126.130]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bS7V4-0000zO-IM; Tue, 26 Jul 2016 18:54:43 +0000 Received: from localhost.localdomain ([95.91.40.150]) by mrelayeu.kundenserver.de (mreue001) with ESMTPSA (Nemesis) id 0LrEdQ-1bKKUQ2jHg-0136cz; Tue, 26 Jul 2016 20:54:10 +0200 From: Stefan Wahren To: Rob Herring , Mark Rutland , Eric Anholt , John Youn Subject: [PATCH V2 RFC 1/6] usb: dwc2: core: Avoid nonsense error in gadget mode Date: Tue, 26 Jul 2016 18:53:28 +0000 Message-Id: <1469559213-16160-2-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1469559213-16160-1-git-send-email-stefan.wahren@i2se.com> References: <1469559213-16160-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K0:t/lk4auQh4wsLHaePP/Xx4e6jRWR0htmjif+jO3PclLa/RWwxe3 4lX/NKcwDXBkGVx3no+MpXbFyr69IA6PU5Dg9VDLPb5pqJIcPdl3iN71/G8xgxhyX3W9G30 BP2/NMWmqyg2hXLdXF6ThzBr1FIIQctdUKhvR/gnV0p+S1nBktNZoWgI4W01tkT3SRKojz9 e1ANOFqDpIRZv3EFy/lsQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:xqvxAbmXpYU=:UX3Mtxgunnr3Mt1FEE0wbp B3Y0RseUUEd0rFJBZVGBSWv6+2JK8oPB0S+ka09zwzd/+whNFqsoefP9Z2m4p4QmR10fm6Q9t +UwNPsnAKrhUVtCr77nZxNnAe5GUD8taiagJfj246ub70mykC0gMgEDtLuBlkjj0soQ4kAcWA rBkHhGwP+IBx2qkj+iokPVA1OEgJZo82cTAFSOaj/aB7CE0p+9Rshiozm1U3WeFh9XfFWWQ6X nem0I6eQe5w1xZycfeJWnQKgXd3wvI2lpAwa9urWzCJ4sZaGHhm94ymzcl0Plwl3pndwLZxHt 3Ljknxld8yHnSI/QMCsMKVySWUueeO5bJ5VFk1ArbDoBcQ7WciN0F7WkQuy+F/m17eTWydzV/ 5Pge4nY5XUIl9kZWSZ10GbGkw1Yqqb2molqWKbmSdOcFAEo+3Hz1r6w8I0qdJEgHn1MEYyKPb vFfdZnCE1FktnvA3L+nR11x2p8UmSFDAUnjBGUAk42q2/rkCoe43FtiR1QER5ZrMMye1gXt6A WNKUmTZNYL7PlZWV3pt3ghRj9s5DHnKVeUZ2rhyztPSm/OAhandpShJxHW7uceK+7j+Vu3Ou+ EPNSH+AQilxn8W1OkUHNe5AaAu60YHRmz983l9KbTx2ZsqDDaUVBS+QP2dYT9vbb2OcZiB04Y G9GMJXRKaukoHVwywfbj5tEd8woxqENm9Pzcr5uBf0Y2a2h1slDc/9JqpZcEIbVxdWSc= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160726_115442_994911_3CD7B6C6 X-CRM114-Status: UNSURE ( 9.74 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , Felipe Balbi , Stephen Warren , devicetree@vger.kernel.org, Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In gadget mode On bcm2835 platform the host tx fifo size could be zero. So add zero to range and avoid such nonsense errors: dwc2 20980000.usb: 0 invalid for host_nperio_tx_fifo_size. dwc2 20980000.usb: Setting host_nperio_tx_fifo_size to 0 dwc2 20980000.usb: 0 invalid for host_perio_tx_fifo_size. dwc2 20980000.usb: Setting host_perio_tx_fifo_size to 0 Signed-off-by: Stefan Wahren --- drivers/usb/dwc2/core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 4135a5f..5645528 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -819,7 +819,10 @@ void dwc2_set_param_host_nperio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val) { int valid = 1; - if (val < 16 || val > hsotg->hw_params.host_nperio_tx_fifo_size) + if (val && (val < 16)) + valid = 0; + + if (val > hsotg->hw_params.host_nperio_tx_fifo_size) valid = 0; if (!valid) { @@ -839,7 +842,10 @@ void dwc2_set_param_host_perio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val) { int valid = 1; - if (val < 16 || val > hsotg->hw_params.host_perio_tx_fifo_size) + if (val && (val < 16)) + valid = 0; + + if (val > hsotg->hw_params.host_perio_tx_fifo_size) valid = 0; if (!valid) {