From patchwork Wed Jan 26 14:13:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12725081 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 53C3DC28CF5 for ; Wed, 26 Jan 2022 14:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=A6fl2VAo96zL/WTPcXlwPDBvowcLAUBOIW7DOPFqBQA=; b=dIXrF3/4SalgHw 0AJpCBXaCL20qlvOpGme+3mi6Co+jJXlSGmzD19+Qm6mcUcBLa5Fxtsu8Ygkn2SozxxNIc2u/NIxX Y+mVIkvE4hmC6KHGdj1X/62AbEN7zGqmipCBDiiYRaPc1Ug31SOr/4n85z6BPDxwZXcXN7svGMCuA Aet8eg9SkdvqlWY/eQXqZB435azfwn+CBjAfhY5Lx0/HhLUem1bA5K784yVbjfOwC5PEDvwAWuDcp 4aN06gSYJK5AccCLNwx+Qt/NzNazdCLKzOLBcoJdwYoU7cEQRhaETWABFE2TQhl/aCEy+VHjW6TMq iVwzqmHJbxdY3xogQgVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCj3n-00Bxdf-I2; Wed, 26 Jan 2022 14:14:07 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCj3c-00BxaO-Br for linux-arm-kernel@lists.infradead.org; Wed, 26 Jan 2022 14:13:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1643206436; x=1674742436; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6DdLsqqroNMKr6Xyes2xsy1sE+X7bKTqbAbUFZzzPF8=; b=pGSSmMc6OB6ms7aJAd+NmITVWPRKTYbFYa+iTj9TN9ytJH5rs7RifHXp enuOGVygIr0taQZC6e8AiDfL2XkPw2OG9svEXEWG1kj9n2VXGTUxsLrFb x+1jwOnSDdffpAq72OHHhBfOtkk011B8jbZtNfademM33VBaNNwbuW+q1 WcDttp4XRGHmj1nosyrUzORc6Dtwwhe5sn5Y1NujCgMnhGp0gXPYAakCJ LAYHLk8kuQf126iiGkxKJlRPwXqo78UalNWxWJEKKFDzdps9I6gvZWGxL LbF7EpGGNced0QR/jVE9Hj10fJFdD1Ddb+r6rtX0hoQmSPFaZdqcTRsFV g==; X-IronPort-AV: E=Sophos;i="5.88,318,1635199200"; d="scan'208";a="21725568" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 26 Jan 2022 15:13:51 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 26 Jan 2022 15:13:51 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 26 Jan 2022 15:13:51 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1643206431; x=1674742431; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6DdLsqqroNMKr6Xyes2xsy1sE+X7bKTqbAbUFZzzPF8=; b=iXRd2SPNodDerQ0RSu+4O2IrceJFqtcoaj5XIJHMzq45Uo3GYpCOe4gi Q5ijvJadMXuRa2PTpZDWsajnJzVzQRMxUNMeSjRq32IJ+H4JpBJTFYlo1 L+lrELoXO1J/OEj+FHlSwJFozUQnUR1uEOsUE7odxpxOY1IeZosu0xvEt 8vHOD/wJmcQoRsmjUarwZS8UUdLIy16xi+avlL30qvsyn+49wlEfveViw YyFYnYoW4AZZSVcyLK4d+DNiQr1/9wtNR8sIzicW+gE644QaDQYl3g788 CdBetaXzwI0py65zX/6vj6XfaEc/Vb8I4I2NxzE9F4CoXnQ0RHGqrq5Y1 w==; X-IronPort-AV: E=Sophos;i="5.88,318,1635199200"; d="scan'208";a="21725564" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 26 Jan 2022 15:13:51 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 00C4A280065; Wed, 26 Jan 2022 15:13:50 +0100 (CET) From: Alexander Stein To: Greg Kroah-Hartman , Rob Herring , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Alexander Stein , NXP Linux Team , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Li Jun Subject: [PATCH v4 1/4] usb: dwc3: imx8mp: rename iomem base pointer Date: Wed, 26 Jan 2022 15:13:37 +0100 Message-Id: <20220126141340.234125-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126141340.234125-1-alexander.stein@ew.tq-group.com> References: <20220126141340.234125-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220126_061356_746129_73716345 X-CRM114-Status: GOOD ( 18.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Until now the iomem used is not USB glue as the name suggests, but HSIO BLK_CTL. Rename the struct member accordingly. This is a preparing patch for when USB glue is actually used. Signed-off-by: Alexander Stein Reviewed-by: Li Jun --- drivers/usb/dwc3/dwc3-imx8mp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c index d328d20abfbc..1c8fe657b3a9 100644 --- a/drivers/usb/dwc3/dwc3-imx8mp.c +++ b/drivers/usb/dwc3/dwc3-imx8mp.c @@ -39,7 +39,7 @@ struct dwc3_imx8mp { struct device *dev; struct platform_device *dwc3; - void __iomem *glue_base; + void __iomem *hsio_blk_base; struct clk *hsio_clk; struct clk *suspend_clk; int irq; @@ -55,7 +55,7 @@ static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx) if (!dwc3) return; - val = readl(dwc3_imx->glue_base + USB_WAKEUP_CTRL); + val = readl(dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL); if ((dwc3->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc3->xhci) val |= USB_WAKEUP_EN | USB_WAKEUP_SS_CONN | @@ -64,16 +64,16 @@ static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx) val |= USB_WAKEUP_EN | USB_WAKEUP_VBUS_EN | USB_WAKEUP_VBUS_SRC_SESS_VAL; - writel(val, dwc3_imx->glue_base + USB_WAKEUP_CTRL); + writel(val, dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL); } static void dwc3_imx8mp_wakeup_disable(struct dwc3_imx8mp *dwc3_imx) { u32 val; - val = readl(dwc3_imx->glue_base + USB_WAKEUP_CTRL); + val = readl(dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL); val &= ~(USB_WAKEUP_EN | USB_WAKEUP_EN_MASK); - writel(val, dwc3_imx->glue_base + USB_WAKEUP_CTRL); + writel(val, dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL); } static irqreturn_t dwc3_imx8mp_interrupt(int irq, void *_dwc3_imx) @@ -115,9 +115,9 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) dwc3_imx->dev = dev; - dwc3_imx->glue_base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(dwc3_imx->glue_base)) - return PTR_ERR(dwc3_imx->glue_base); + dwc3_imx->hsio_blk_base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(dwc3_imx->hsio_blk_base)) + return PTR_ERR(dwc3_imx->hsio_blk_base); dwc3_imx->hsio_clk = devm_clk_get(dev, "hsio"); if (IS_ERR(dwc3_imx->hsio_clk)) { From patchwork Wed Jan 26 14:13:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12725082 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 73B27C3526D for ; Wed, 26 Jan 2022 14:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=87GyjdK6h1Q/uitwFkWW4E4YNo16MO3Q8xZUxMyO1JQ=; b=V98r130wYCstZr S3vwKEo/cTFoZF2kLDAQcTUSzgE42tkBHk//HNYzF3ojy3Ms55hngtVSlEgJpEOidYck+UVQHAfjF xjqdBCNcAxVBL4I1nWNBLoifJ6zq3754IAdcvjLbvBrhFqxMRonqLJImvUcGWugjgrotpZL1k1Gv5 mlLYAXWFCyyJQ1nxQ8YMJ7JcefzvB92ODwqLN5GyTDoCiy2B7zBhPwUvkqB4n0haObdc/nGLdBZY6 yIdt/nXuqrumG1PGDMA7V7h4EA23ME3ceuzEvFosRIxtH+mGyrvU3HzWfvu49nslaSZzCYt5G6Vrk uQzAJuPWptDLkaxWVx3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCj3x-00Bxeq-41; Wed, 26 Jan 2022 14:14:17 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCj3d-00BxbP-Fe for linux-arm-kernel@lists.infradead.org; Wed, 26 Jan 2022 14:13:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1643206437; x=1674742437; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l1nUXsM59Ui0doiVm12hhhwuohicemAjdr43H7R6YUg=; b=ALCuOhcCwJk73LQH2yhyfvzQno7Ne5HnVwZIuWOwhTjwlwpVTQ2JUWB9 hG06IEugMnyywSQpHzRbbO/8o6YOKAxlFcATJJiFWH+Qtj7DhYfpkWKeC pe7oaVlCk5ptlOc2Dw5btxq+olCxyNmuiucQlz3u0SePwxWVH116dhP0k dx727nGGb6Yuvis61AalyWIddODxkbvA3qXV3WqdmdoeIq190webZDaVt 3QuzP6LvQGV7hcPPVLuC7v1pOCq9C0o8rSeTallUmm8XVTD4ciinfwkSU q3326jGzCPyJjRw0upkZXNq3N33v7u9dIyaEJCJ7k+FUBE1GF/aEQdp0a A==; X-IronPort-AV: E=Sophos;i="5.88,318,1635199200"; d="scan'208";a="21725569" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 26 Jan 2022 15:13:51 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 26 Jan 2022 15:13:51 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 26 Jan 2022 15:13:51 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1643206431; x=1674742431; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l1nUXsM59Ui0doiVm12hhhwuohicemAjdr43H7R6YUg=; b=KKU+55Z4pD+fDkoFvrY6v7ry80/FFmV6RHiIttpB1AVSMNp/3V/3mLKS DbVAjh3U6+RRHOipFr0meGWDB0p52DIrBeKwQMR+v+cRsz/U+sa52Zz8D FQiVueRKEfJlgwNlYrdC0tmwlxRkaUTaBglMnhw8D0TeQ2NvsE6qDyR5t nDdWmQNBCBkSPPWeiwofdCTGHQ/ZKf0G6Aj5psVlzfohzwBrYswPyDxgf 6ysYnfnWxEsPLiqeUdB5ZTSXqlKBazmSnoahbOyfHTOZA8/YqzLF2nOaJ cvQUCF99bo9RX39HV5wDL0IUddds/tLeGfc8Z/MgAiDzIDAjAuEkZmAj/ A==; X-IronPort-AV: E=Sophos;i="5.88,318,1635199200"; d="scan'208";a="21725565" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 26 Jan 2022 15:13:51 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 3299F280078; Wed, 26 Jan 2022 15:13:51 +0100 (CET) From: Alexander Stein To: Greg Kroah-Hartman , Rob Herring , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Alexander Stein , NXP Linux Team , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Li Jun Subject: [PATCH v4 2/4] dt-bindings: usb: dwc3-imx8mp: Add imx8mp specific flags Date: Wed, 26 Jan 2022 15:13:38 +0100 Message-Id: <20220126141340.234125-3-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126141340.234125-1-alexander.stein@ew.tq-group.com> References: <20220126141340.234125-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220126_061357_861059_0B9CDD00 X-CRM114-Status: GOOD ( 15.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This adds bindings for features in the USB glue block. They allow setting polarity of PWR and OC as well as disabling port power control. Also permanently attached can be annotated as well. Additional IO address and clock are needed. Signed-off-by: Alexander Stein Reviewed-by: Rob Herring --- .../bindings/usb/fsl,imx8mp-dwc3.yaml | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml b/Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml index 974032b1fda0..01ab0f922ae8 100644 --- a/Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml +++ b/Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml @@ -15,9 +15,9 @@ properties: const: fsl,imx8mp-dwc3 reg: - maxItems: 1 - description: Address and length of the register set for the wrapper of - dwc3 core on the SOC. + items: + - description: Address and length of the register set for HSIO Block Control + - description: Address and length of the register set for the wrapper of dwc3 core on the SOC. "#address-cells": enum: [ 1, 2 ] @@ -49,6 +49,28 @@ properties: - const: hsio - const: suspend + fsl,permanently-attached: + type: boolean + description: + Indicates if the device atached to a downstream port is + permanently attached. + + fsl,disable-port-power-control: + type: boolean + description: + Indicates whether the host controller implementation includes port + power control. Defines Bit 3 in capability register (HCCPARAMS). + + fsl,over-current-active-low: + type: boolean + description: + Over current signal polarity is active low. + + fsl,power-active-low: + type: boolean + description: + Power pad (PWR) polarity is active low. + # Required child node: patternProperties: @@ -74,7 +96,8 @@ examples: #include usb3_0: usb@32f10100 { compatible = "fsl,imx8mp-dwc3"; - reg = <0x32f10100 0x8>; + reg = <0x32f10100 0x8>, + <0x381f0000 0x20>; clocks = <&clk IMX8MP_CLK_HSIO_ROOT>, <&clk IMX8MP_CLK_USB_ROOT>; clock-names = "hsio", "suspend"; From patchwork Wed Jan 26 14:13:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12725083 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29EF8C28CF5 for ; Wed, 26 Jan 2022 14:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HVhApjJvOcPtzyuR6V+tA/ZAoepOQ/CZLTY1ysuIkPE=; b=BX+sqjRJQVY2S8 rXl2AXldGG/nvod3N19kOtH2UOPaOiwVlser6VaQ3btiUJyIBIkbI4zZS08/8fPb3Y6Eb8O7XX3vB yHkH4pLDT+MnvKQABRClWp97Hbjux039Fc/MQGo1EUV6x0A+3jtn1S7RO4A+nxYAEkn4uB639nmRB fL0kUq3izrZ+8H3BDVfR7nFyleGb6k+rqmRDuGGU1WGzQyTwfE3Dr2nofYps8Sa+HUK5Cw/8l3Add 0HJ4gq4M7T6Bp7WehFxK0RVUYRY4jqTRQy/QiN/le71cqrSG8NCGFkbD1ofSak7rs+pY8JDGaJJ/U WWIhgFQiNwlVBkeLsibA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCj47-00Bxgg-Qg; Wed, 26 Jan 2022 14:14:28 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCj3e-00BxaO-Eo for linux-arm-kernel@lists.infradead.org; Wed, 26 Jan 2022 14:14:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1643206438; x=1674742438; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RV/5YeOGDAQg1u/U4sZSFk88Iu6qh0WQ/KjyJuEePj8=; b=FWJ6Q1ThuWG6n/1Jl8Xty4gSj1ps5uO2zWRNMA+CvEkW1wsxe+OZbS07 cKOTs1lqBckCl18sWZWaYGm1JqFQC3/kF/K955mtBmU0248ONgU7gbeoV Dlzs2x+IXWko7919NuTRlpdyPZP0D3LOkoqDh797RWygAyWE+BjAMmcwJ FmbEqyc1os85WK5RHPEbdlnACdXvF+fSZ+gEpcvz3ZlcZ/W6MWahqtRPu dKKVTaaRrBKbakASD63Ok4curWhnZAGC5F8UXOOXu09ogA2Ky2DUsE0Zk 9qyniujpCuM5dWZWytS5UMMqpPhb8d9cZtQX3gWPA/0fLZ5tzmyuQ9JNJ w==; X-IronPort-AV: E=Sophos;i="5.88,318,1635199200"; d="scan'208";a="21725571" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 26 Jan 2022 15:13:51 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 26 Jan 2022 15:13:51 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 26 Jan 2022 15:13:51 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1643206431; x=1674742431; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RV/5YeOGDAQg1u/U4sZSFk88Iu6qh0WQ/KjyJuEePj8=; b=DhiV6f5zZ0jymbJ/Q7zPtgnFR34msObm3eGrQo5klhhAGNTS4XbT4Ld9 x376rWtUvnddsQ1IzshuMcMqNIQCbAUJO9Hw4seZNxMVXbzY4rPLY2aRo pzYVC7Dya3wt7zzrF8rTmArJuid9DtG4C4JaXKVPP/5ws7006R498AO6q 0mmQkBbUDy0SgOt1f5YnwUjD9gRSUwlLLV3c1hOM4B/OV6+aW1spHa/7t xez5XH0W6dWlDSOcK6I15B4DWuLW3q3noVm/VuxRoAg3HwBCB5cA33eCt u93UBy2Rk2kF2X8yxCJtJvqWOkk6iQLwqrUXm7MNA6qa3Fyr+zGU94lz+ g==; X-IronPort-AV: E=Sophos;i="5.88,318,1635199200"; d="scan'208";a="21725567" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 26 Jan 2022 15:13:51 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 6C3AE28007C; Wed, 26 Jan 2022 15:13:51 +0100 (CET) From: Alexander Stein To: Greg Kroah-Hartman , Rob Herring , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Alexander Stein , NXP Linux Team , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Li Jun Subject: [PATCH v4 3/4] usb: dwc3: imx8mp: Add support for setting SOC specific flags Date: Wed, 26 Jan 2022 15:13:39 +0100 Message-Id: <20220126141340.234125-4-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126141340.234125-1-alexander.stein@ew.tq-group.com> References: <20220126141340.234125-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220126_061358_839795_B71E165F X-CRM114-Status: GOOD ( 20.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The i.MX8MP glue layer has support for the following flags: * over-current polarity * PWR pad polarity * controlling PPC flag in HCCPARAMS register * permanent port attach for usb2 & usb3 port Allow setting these flags by supporting specific flags in the glue node. In order to get this to work an additional IORESOURCE_MEM and clock is necessary. For backward compatibility this is purely optional. Signed-off-by: Alexander Stein --- drivers/usb/dwc3/dwc3-imx8mp.c | 62 ++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c index 1c8fe657b3a9..5a96b66bf237 100644 --- a/drivers/usb/dwc3/dwc3-imx8mp.c +++ b/drivers/usb/dwc3/dwc3-imx8mp.c @@ -36,10 +36,22 @@ #define USB_WAKEUP_EN_MASK GENMASK(5, 0) +/* USB glue registers */ +#define USB_CTRL0 0x00 +#define USB_CTRL1 0x04 + +#define USB_CTRL0_PORTPWR_EN BIT(12) /* 1 - PPC enabled (default) */ +#define USB_CTRL0_USB3_FIXED BIT(22) /* 1 - USB3 permanent attached */ +#define USB_CTRL0_USB2_FIXED BIT(23) /* 1 - USB2 permanent attached */ + +#define USB_CTRL1_OC_POLARITY BIT(16) /* 0 - HIGH / 1 - LOW */ +#define USB_CTRL1_PWR_POLARITY BIT(17) /* 0 - HIGH / 1 - LOW */ + struct dwc3_imx8mp { struct device *dev; struct platform_device *dwc3; void __iomem *hsio_blk_base; + void __iomem *glue_base; struct clk *hsio_clk; struct clk *suspend_clk; int irq; @@ -47,6 +59,42 @@ struct dwc3_imx8mp { bool wakeup_pending; }; +static void imx8mp_configure_glue(struct dwc3_imx8mp *dwc3_imx) +{ + struct device *dev = dwc3_imx->dev; + u32 value; + + if (!dwc3_imx->glue_base) + return; + + value = readl(dwc3_imx->glue_base + USB_CTRL0); + + if (device_property_read_bool(dev, "fsl,permanently-attached")) + value |= (USB_CTRL0_USB2_FIXED | USB_CTRL0_USB3_FIXED); + else + value &= ~(USB_CTRL0_USB2_FIXED | USB_CTRL0_USB3_FIXED); + + if (device_property_read_bool(dev, "fsl,disable-port-power-control")) + value &= ~(USB_CTRL0_PORTPWR_EN); + else + value |= USB_CTRL0_PORTPWR_EN; + + writel(value, dwc3_imx->glue_base + USB_CTRL0); + + value = readl(dwc3_imx->glue_base + USB_CTRL1); + if (device_property_read_bool(dev, "fsl,over-current-active-low")) + value |= USB_CTRL1_OC_POLARITY; + else + value &= ~USB_CTRL1_OC_POLARITY; + + if (device_property_read_bool(dev, "fsl,power-active-low")) + value |= USB_CTRL1_PWR_POLARITY; + else + value &= ~USB_CTRL1_PWR_POLARITY; + + writel(value, dwc3_imx->glue_base + USB_CTRL1); +} + static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx) { struct dwc3 *dwc3 = platform_get_drvdata(dwc3_imx->dwc3); @@ -100,6 +148,7 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *dwc3_np, *node = dev->of_node; struct dwc3_imx8mp *dwc3_imx; + struct resource *res; int err, irq; if (!node) { @@ -119,6 +168,15 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) if (IS_ERR(dwc3_imx->hsio_blk_base)) return PTR_ERR(dwc3_imx->hsio_blk_base); + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (!res) { + dev_warn(dev, "Base address for glue layer missing. Continuing without, some features are missing though."); + } else { + dwc3_imx->glue_base = devm_ioremap_resource(dev, res); + if (IS_ERR(dwc3_imx->glue_base)) + return PTR_ERR(dwc3_imx->glue_base); + } + dwc3_imx->hsio_clk = devm_clk_get(dev, "hsio"); if (IS_ERR(dwc3_imx->hsio_clk)) { err = PTR_ERR(dwc3_imx->hsio_clk); @@ -152,6 +210,8 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) } dwc3_imx->irq = irq; + imx8mp_configure_glue(dwc3_imx); + pm_runtime_set_active(dev); pm_runtime_enable(dev); err = pm_runtime_get_sync(dev); @@ -252,6 +312,8 @@ static int __maybe_unused dwc3_imx8mp_resume(struct dwc3_imx8mp *dwc3_imx, dwc3_imx8mp_wakeup_disable(dwc3_imx); dwc3_imx->pm_suspended = false; + imx8mp_configure_glue(dwc3_imx); + if (dwc3_imx->wakeup_pending) { dwc3_imx->wakeup_pending = false; if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_DEVICE) { From patchwork Wed Jan 26 14:13:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12725084 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CEF47C2BA4C for ; Wed, 26 Jan 2022 14:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JA+ySmsTbLGvCApziK45pfCBtr52g3D1t13Y30Grttk=; b=2am/zAT+J+84HX L3wFiE2A8rqpGMgbkKRob86+92dAjLmX4eURX1EMURNWFOWVgRo/m3wF5zWcXEPNnQcHR7QGy5fDs zmw8Fs5mEAsfDzdLlLRI+SeXNXRyYM+NlDVSDvFOM+Sg8A7sKxSLMn4I70i6scqtcupSfq9vW6lDc LWMoFevofV6W6saUBWWFJrdWiC6lTF3y76xT2qq+CuplHCRw3Vn2VRZTjUULQDRNhITpHHCfJX/6M lq9uSLddeY2hBaOu42wSNtPCYAOoToxOhTurTuImQwE1A+G+wf5TVLzywmr1dqKqHhbXZEFR+M9sQ n1ENpo2dWThMlzBeiyRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCj4H-00BxjO-Q8; Wed, 26 Jan 2022 14:14:37 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCj3f-00BxcT-Jb for linux-arm-kernel@lists.infradead.org; Wed, 26 Jan 2022 14:14:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1643206439; x=1674742439; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WWiIdXtyw56Rqfds2qB4Yd2Fj1coCEHLkEHNeGkzWGg=; b=GM1FdqxUoog2pOKM+gt1zhP1Vk0Lb7JvFqq48lzNTvmEtV4/b+XSzUvA JZwd1IZ13gNdzHbdFNuYfDp9w9pBVR0Jmz9Zwr23zgvtEHAkbtr3GTIJl 2KyQj8wO7SAl/3lHcLvQIy6cx29frfaPabVysNONJiOlcXglCTP6ZQ7Cy lTysX/55MGJHn396yYsBqrvZ7N7oqIp9OUxP5m1LA+W7TRcGUMvE5m8X2 8wZe1gLJNC5l9grbnZJ3Dx7YQBeMeAtuEqdM2pLBAyquOTr1huXbRlZQ4 lY8+f2YDON9Atrt33zINmBChpn28GA3XLwIxTpVpRrCV7RNvo3bQQghNB A==; X-IronPort-AV: E=Sophos;i="5.88,318,1635199200"; d="scan'208";a="21725572" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 26 Jan 2022 15:13:51 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 26 Jan 2022 15:13:51 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 26 Jan 2022 15:13:51 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1643206431; x=1674742431; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WWiIdXtyw56Rqfds2qB4Yd2Fj1coCEHLkEHNeGkzWGg=; b=AHSU8Gu7R6pE3wBOrrAKkpr+EJFy68F25TJSemeRgQfMgqG37EGotUWv e5kwPpcEefUGoTx6k/4tj71iHuzNY/3TBDUg4uUyK4i8NYWtZmFs9vlA5 QepEkKJub7k60Chkaqfpxwpu7czdZH8uhynJ+arfWNAf6fKOBwFrT3RKX eAeNRwMFienJit2vJ4NN+nFYSJVOl0UfaxswUQDpZ4jrQ/kTfuLBwJknK vf+alctqwECV/CrvxLS1S/9uJP3fIEHR+kKzrCJVkndskZYNaNnApznVq GjOVGDIxvjgU+ZDhWSGsZ7JCfCDpAaesJgMTcOGH5CUJni6aaErEbE8cj g==; X-IronPort-AV: E=Sophos;i="5.88,318,1635199200"; d="scan'208";a="21725570" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 26 Jan 2022 15:13:51 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 9ACE0280065; Wed, 26 Jan 2022 15:13:51 +0100 (CET) From: Alexander Stein To: Greg Kroah-Hartman , Rob Herring , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Alexander Stein , NXP Linux Team , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Li Jun Subject: [PATCH v4 4/4] arm64: dts: imx8mp: Add memory for USB3 glue layer to usb3 nodes Date: Wed, 26 Jan 2022 15:13:40 +0100 Message-Id: <20220126141340.234125-5-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126141340.234125-1-alexander.stein@ew.tq-group.com> References: <20220126141340.234125-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220126_061359_987116_DC9BEEEE X-CRM114-Status: GOOD ( 14.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The USB3 glue layer has 2 areas in the register set, see RM Rev.1 section 11.2.5.2.1 GLUE_usb3 memory map: * USB3 control/status * PHY control/status Provide the memory area to the usb3 nodes for accessing the features in the USB3 control area. Signed-off-by: Alexander Stein Reviewed-by: Li Jun --- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi index e61ac5f136ad..d4aadb434d36 100644 --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi @@ -1030,7 +1030,8 @@ usb3_phy0: usb-phy@381f0040 { usb3_0: usb@32f10100 { compatible = "fsl,imx8mp-dwc3"; - reg = <0x32f10100 0x8>; + reg = <0x32f10100 0x8>, + <0x381f0000 0x20>; clocks = <&clk IMX8MP_CLK_HSIO_ROOT>, <&clk IMX8MP_CLK_USB_ROOT>; clock-names = "hsio", "suspend"; @@ -1070,7 +1071,8 @@ usb3_phy1: usb-phy@382f0040 { usb3_1: usb@32f10108 { compatible = "fsl,imx8mp-dwc3"; - reg = <0x32f10108 0x8>; + reg = <0x32f10108 0x8>, + <0x382f0000 0x20>; clocks = <&clk IMX8MP_CLK_HSIO_ROOT>, <&clk IMX8MP_CLK_USB_ROOT>; clock-names = "hsio", "suspend";