From patchwork Thu Nov 10 03:27:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Youn X-Patchwork-Id: 9420553 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 789C3601C2 for ; Thu, 10 Nov 2016 03:29:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DC6D29467 for ; Thu, 10 Nov 2016 03:29:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32A6A2948C; Thu, 10 Nov 2016 03:29:58 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable 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 A46C529467 for ; Thu, 10 Nov 2016 03:29:57 +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 1c4g2T-0002ds-79; Thu, 10 Nov 2016 03:28:33 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c4g1x-0002Xu-Vq; Thu, 10 Nov 2016 03:28:03 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id A7D9920B3E; Wed, 9 Nov 2016 22:27:43 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Wed, 09 Nov 2016 22:27:43 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:in-reply-to:message-id :references:subject:to:to:to:to:to:to:to:to:to:to:to:to:to:to:to :to:to:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=qXFU2Lj/c1tAwSQdlZTiwdFBVV4=; b=YqybHJONfy/uwEyaCpom zFmT4Cz21Dynwgqpt1F+WIY48Xfas6lmvbg0omk0ED8pLIb5Qj8FnJZPJ5VLWwOV 4uf8qD4Cjy17jf6905Nm1r6MVmW6Um3PQU/Jiuq/qnz6jHWkEq8jjhyhMg9Hu2jk PUn+PVhp44GVh9rmjuewGx0= X-ME-Sender: X-Sasl-enc: cwmkdM+uSPmKDkXejB/TMzXJwkHMN5gbEOc1c1+6Z3jg 1478748462 Received: from starbug (us02-cip.synopsys.com [198.182.56.5]) by mail.messagingengine.com (Postfix) with ESMTPA id D9C17F29CF; Wed, 9 Nov 2016 22:27:40 -0500 (EST) Received: by starbug (sSMTP sendmail emulation); Wed, 09 Nov 2016 19:27:40 -0800 Date: Wed, 09 Nov 2016 19:27:40 -0800 Message-Id: <966d342a5a7fee9ac3ef8140b60c228c4a87c7d3.1478748145.git.johnyoun@synopsys.com> In-Reply-To: References: From: John Youn To: John Youn To: Felipe Balbi To: linux-usb@vger.kernel.org To: devicetree@vger.kernel.org To: Rob Herring To: Caesar Wang To: Shawn Lin To: linux-rockchip@lists.infradead.org To: linux-arm-kernel@lists.infradead.org To: Russell King To: Matthias Brugger To: Wei Xu To: Eduardo Valentin To: Andy Yan To: Mark Rutland To: Will Deacon To: Catalin Marinas To: Heiko Stuebner Subject: [PATCH v2 01/30] usb: dwc2: Deprecate g-use-dma binding X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161109_192802_231180_30220CAF X-CRM114-Status: GOOD ( 13.87 ) 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: , 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 This is not needed as the gadget now fully supports DMA and it can autodetect it. This was initially added because gadget DMA mode was only partially implemented so could not be automatically enabled. Signed-off-by: John Youn Acked-by: Rob Herring --- Documentation/devicetree/bindings/usb/dwc2.txt | 4 +++- arch/arm/boot/dts/rk3036.dtsi | 1 - arch/arm/boot/dts/rk3288.dtsi | 1 - arch/arm/boot/dts/rk3xxx.dtsi | 1 - arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 1 - arch/arm64/boot/dts/rockchip/rk3368.dtsi | 1 - drivers/usb/dwc2/core.h | 4 +--- drivers/usb/dwc2/params.c | 17 ++++++++++++++--- drivers/usb/dwc2/pci.c | 1 - 9 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt index 9472111..389bb13 100644 --- a/Documentation/devicetree/bindings/usb/dwc2.txt +++ b/Documentation/devicetree/bindings/usb/dwc2.txt @@ -26,11 +26,13 @@ Refer to phy/phy-bindings.txt for generic phy consumer properties - dr_mode: shall be one of "host", "peripheral" and "otg" Refer to usb/generic.txt - snps,host-dma-disable: disable host DMA mode. -- g-use-dma: enable dma usage in gadget driver. - g-rx-fifo-size: size of rx fifo size in gadget mode. - g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode. - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode. +Deprecated properties: +- g-use-dma: gadget DMA mode is automatically detected + Example: usb@101c0000 { diff --git a/arch/arm/boot/dts/rk3036.dtsi b/arch/arm/boot/dts/rk3036.dtsi index a935523..7c2dc19 100644 --- a/arch/arm/boot/dts/rk3036.dtsi +++ b/arch/arm/boot/dts/rk3036.dtsi @@ -204,7 +204,6 @@ g-np-tx-fifo-size = <16>; g-rx-fifo-size = <275>; g-tx-fifo-size = <256 128 128 64 64 32>; - g-use-dma; status = "disabled"; }; diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index 17ec2e2..74a749c 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -596,7 +596,6 @@ g-np-tx-fifo-size = <16>; g-rx-fifo-size = <275>; g-tx-fifo-size = <256 128 128 64 64 32>; - g-use-dma; phys = <&usbphy0>; phy-names = "usb2-phy"; status = "disabled"; diff --git a/arch/arm/boot/dts/rk3xxx.dtsi b/arch/arm/boot/dts/rk3xxx.dtsi index e15beb3..8fbd3c8 100644 --- a/arch/arm/boot/dts/rk3xxx.dtsi +++ b/arch/arm/boot/dts/rk3xxx.dtsi @@ -181,7 +181,6 @@ g-np-tx-fifo-size = <16>; g-rx-fifo-size = <275>; g-tx-fifo-size = <256 128 128 64 64 32>; - g-use-dma; phys = <&usbphy0>; phy-names = "usb2-phy"; status = "disabled"; diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi index 17839db..e0ea603 100644 --- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi +++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi @@ -747,7 +747,6 @@ clocks = <&sys_ctrl HI6220_USBOTG_HCLK>; clock-names = "otg"; dr_mode = "otg"; - g-use-dma; g-rx-fifo-size = <512>; g-np-tx-fifo-size = <128>; g-tx-fifo-size = <128 128 128 128 128 128>; diff --git a/arch/arm64/boot/dts/rockchip/rk3368.dtsi b/arch/arm64/boot/dts/rockchip/rk3368.dtsi index 0fcb214..df231c4 100644 --- a/arch/arm64/boot/dts/rockchip/rk3368.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3368.dtsi @@ -537,7 +537,6 @@ g-np-tx-fifo-size = <16>; g-rx-fifo-size = <275>; g-tx-fifo-size = <256 128 128 64 64 32>; - g-use-dma; status = "disabled"; }; diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index a1075ad..f8c97f5 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -418,9 +418,7 @@ enum dwc2_ep0_state { * needed. * 0 - No (default) * 1 - Yes - * @g_dma: If true, enables dma usage on the device. This - * setting is not auto-detected. It must be - * explicitly enabled (default: false). + * @g_dma: Enables gadget dma usage (default: autodetect). * @g_rx_fifo_size: The periodic rx fifo size for the device, in * DWORDS from 16-32768 (default: 2048 if * possible, otherwise autodetect). diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c index 2eb79e8..74c3728 100644 --- a/drivers/usb/dwc2/params.c +++ b/drivers/usb/dwc2/params.c @@ -1086,6 +1086,19 @@ static void dwc2_set_param_tx_fifo_sizes(struct dwc2_hsotg *hsotg) } } +static void dwc2_set_gadget_dma(struct dwc2_hsotg *hsotg) +{ + struct dwc2_hw_params *hw = &hsotg->hw_params; + struct dwc2_core_params *p = &hsotg->params; + bool dma_capable = !(hw->arch == GHWCFG2_SLAVE_ONLY_ARCH); + + /* Buffer DMA */ + dwc2_set_param_bool(hsotg, &p->g_dma, + false, "gadget-dma", + true, false, + dma_capable); +} + /** * dwc2_set_parameters() - Set all core parameters. * @@ -1161,9 +1174,7 @@ static void dwc2_set_parameters(struct dwc2_hsotg *hsotg, (hsotg->dr_mode == USB_DR_MODE_OTG)) { dev_dbg(hsotg->dev, "Setting peripheral device properties\n"); - dwc2_set_param_bool(hsotg, &p->g_dma, true, "g-use-dma", - false, false, - dma_capable); + dwc2_set_gadget_dma(hsotg); /* * The values for g_rx_fifo_size (2048) and diff --git a/drivers/usb/dwc2/pci.c b/drivers/usb/dwc2/pci.c index b3f3b58..a23329e 100644 --- a/drivers/usb/dwc2/pci.c +++ b/drivers/usb/dwc2/pci.c @@ -67,7 +67,6 @@ static int dwc2_pci_quirks(struct pci_dev *pdev, struct platform_device *dwc2) if (pdev->vendor == PCI_VENDOR_ID_SYNOPSYS && pdev->device == PCI_PRODUCT_ID_HAPS_HSOTG) { struct property_entry properties[] = { - PROPERTY_ENTRY_BOOL("g-use-dma"), { }, };