From patchwork Fri Feb 23 16:05:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 13569399 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 08218C5478C for ; Fri, 23 Feb 2024 16:06:02 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=T8jgcMCvZfb6QjwOpZbxJ6H96rgkjcydTeyt+nFwKoc=; b=XY+1YnzTzNJ8C+ xxYYLW3EwvRzcL/vqodYCGQq3zItzJS7+7uu2yLJl101xXq/+pt4qbbRJ/1eazcatmzEThUkzvtl4 R4bgCDOyc/KyNs89XOea9a9rmJreSConUTDO3QGpB0o91CoI3suXVoLCRt+tdoCeMdtSaP3AZhtzQ p0iYIod1PeS6VimsQzP8EIRS0ZXUqXvRiWpfswvo+5DKHM36/RxGwuGgEpSetBpEKqeOFdO+ykCGL G90zfR4W10wV6wQ21AzQEf/rS04bFt8MwSSCGs8pWwJlSvChB0rHU5tawIx7OupaquCR1TA38TFrz LPKWYMKgwL5+ar/LPC+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY3S-0000000A80v-3fTi; Fri, 23 Feb 2024 16:05:42 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY3L-0000000A7wS-39At for linux-arm-kernel@lists.infradead.org; Fri, 23 Feb 2024 16:05:37 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 5BC811C0003; Fri, 23 Feb 2024 16:05:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FtY8B6yYjBR+Rfp7/Ypf4+btFZdyTE+hN6hS7cZZSmw=; b=Nn7zMY6HzfNBbGDyTqI/ZEqzRvwjboOPEXmoAo9vCHxj/v+INYHF3WUXiAR6ycghf5kQdm 2CMgMRfM5iCBR6jlPc6/eev5Nj45vlyMMh/EyeQJwxLeLAtv9T70F560iI3lpoS561C1tU Z6SUDkbLU2EYYQ4KNHViU+ofzUxv5YBjdtpLgn6mZHbDgnHbPc/8D/RGsm/Q661bVc+ecn O1/QGmn+PtpoDJRY/NXOvgVE05013sskrUA32AnQriQcDnrcKd8oXgd8Bosc9+4qy7sHMy +bjgWlnGoW9lXp0/Uv8MJcr2zg1ua0g79GRZh1OCaqiQ4IdCJgvoJ/PAxRaGCQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:25 +0100 Subject: [PATCH v3 1/8] dt-bindings: usb: ti,j721e-usb: drop useless compatible list MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-1-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240223_080535_989317_8E689BB8 X-CRM114-Status: UNSURE ( 8.17 ) X-CRM114-Notice: Please train this message. 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 Compatible can be A or B, not A or B or A+B. Remove last option. A=ti,j721e-usb and B=ti,am64-usb. Signed-off-by: Théo Lebrun --- Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml index 95ff9791baea..949f45eb45c2 100644 --- a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml +++ b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml @@ -11,12 +11,9 @@ maintainers: properties: compatible: - oneOf: - - const: ti,j721e-usb - - const: ti,am64-usb - - items: - - const: ti,j721e-usb - - const: ti,am64-usb + enum: + - ti,j721e-usb + - ti,am64-usb reg: maxItems: 1 From patchwork Fri Feb 23 16:05:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 13569398 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 84D57C54798 for ; Fri, 23 Feb 2024 16:05:58 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xw463jqEroJWSjgUG4mGgcaK4MwPLI2ksPhIRhoynDQ=; b=SFFZqaTV8FMo37 w7AMK2hASSIiymZTI3DEP4ayM0Emt39cROnQ767A2FOe5VI7v/ZHwYD2zhYdNh+ewL/lpzHlB/t34 TBNeD6QQJoJSlnWRlyi4Joh/6Yhw27rYG7py4cEQ8YukqkFAf5ioOVdYaEwUOhuZsob65+0dvBewU eCxYjz1rkV5uNLl6TtxdqGLRqHJ7UzxZY/RS/vN/9YgJbI2gmUZ/EESXGzNL9LiGETpUN58h0OUZH 7FngEGa9Jm9sdmWJ+ddZ32vZSi0zdOHPWgNbn8fodAPHWLyGGl2Q6JkXwZWEYFpqTUP+JGQ663dOc +lrCHqqv5ueVziTX9Xkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY3P-0000000A7zr-3ZyR; Fri, 23 Feb 2024 16:05:39 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY3L-0000000A7wY-3FSE for linux-arm-kernel@lists.infradead.org; Fri, 23 Feb 2024 16:05:37 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 1EBC81C0004; Fri, 23 Feb 2024 16:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rbIZMwtxQIO+hXns/iDo1uxK2FfPOqD7m7muGpA+4qM=; b=kF1uRtGJZjdQLHjQC+iq+zv9FIHFE8XcIXdKRpKFrlQAVWPUH6P4uS9KFI/gC9OtnqNoZO JW58FYyVdiQ3FGxNCvMHqukattXpUCx16iLkt6Hdbo1dFFPhNrt5AR8FbFpXHVMj9QKIZc V6FQCLsXDLjnhRX57QT5xGbP2hxZ6eyI5F/V4winePg/yPVYA/gBrc17r1VOUxgUZyljiz bRVU0mdHdioz/UcIVyYY3NLgtTN+GvOOB/g05X7fH5i4qC3GvD82ECOWJw3jql0pBRGSBv ryS6xX+gKGAMTz92bT3JjqOxUGsiBK60PIV5+F2wO1PrN1oAJF1qPmm9nb4zWA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:26 +0100 Subject: [PATCH v3 2/8] dt-bindings: usb: ti,j721e-usb: add ti,j7200-usb compatible MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-2-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240223_080536_005651_E824D9A8 X-CRM114-Status: UNSURE ( 7.93 ) X-CRM114-Notice: Please train this message. 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 On J7200, the controller & its wrapper are reset on resume. This makes it have a different behavior from other platforms. Signed-off-by: Théo Lebrun Acked-by: Conor Dooley --- Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml index 949f45eb45c2..d52d5b2965aa 100644 --- a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml +++ b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml @@ -14,6 +14,7 @@ properties: enum: - ti,j721e-usb - ti,am64-usb + - ti,j7200-usb reg: maxItems: 1 From patchwork Fri Feb 23 16:05:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 13569400 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 47FAEC54798 for ; Fri, 23 Feb 2024 16:06:02 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5n/MSyulGTESnwXspVdEHrEiD4wORkm+/b+0ru3kzXE=; b=RtWR42uVYHxilD u3KIbblK4CDOPvGfPu27Z1PotpKVbi+ESqqOhWnKe+G4wc+R0AusWTS4mES6PnSxCv0DYVGYv/G7h lcje6Gc1qjJUuZbgeGplH40PXnjLjiem++3SOw3EiOSdH+7CmoB4iXt8ojEmlXqlYfILwfIDxqj4m SsCGLrD5uc/NMCLlsGwpe/NR4tGu3LyGR/YGwiOf0Cn9ZG7BVJ49uTQgoDfiNizCJ7aQeA63wxIJ/ Z3tFDX2Fq4yku4POevlnsUisPsbRK3MNIpxkbGysv4UaB9SrzrwtKPgn4HRd4IWhwike8x/4AkZXK mKe7GdpB+Q9rOuFigOwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY3U-0000000A81Y-1GB5; Fri, 23 Feb 2024 16:05:44 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY3M-0000000A7wZ-1dgU for linux-arm-kernel@lists.infradead.org; Fri, 23 Feb 2024 16:05:38 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id E90951C0006; Fri, 23 Feb 2024 16:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G36dyCsQS4BXpbV31b880qblN6dPbFme1l75T2Hw+Zk=; b=drQue52ulO+fuP1tUE11b21wt5CykxH2xQBy3/wI1NsvFmYUQsP5Pu8sX79JledvSmebZE INzRYr5fgMHge+zoW8S4PgVmcH/BK5jStiwnqU2h4dgG7stSNXTKqXyRwZY235LZMEORpr QwrmGtm58EW/INkHY3YgIaENj0HK/2rBkVtIzSTjttXK6sLL1Q6aZoFA8Sr9apEsrAb4Cm oRP04uQwJ6E84JcxjUEF4w6Q7WnxQqpwRwMMFkz0DeMqAAqYWSQu2w5PnNllgIREKIFBoK W/e1ctnjlUMERh85pezeu9GBN+k83wVPTb+AUMLl7OWqYOc0ef/0EP4GOaI23Q== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:27 +0100 Subject: [PATCH v3 3/8] usb: cdns3-ti: move reg writes from probe into ->runtime_resume() MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-3-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240223_080536_857312_8735DAB4 X-CRM114-Status: GOOD ( 18.48 ) 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 hardware initialisation register write sequence is only used at probe. Move it from being done at explicitely at probe to being done implicitely by pm_runtime_get_sync() that calls ->runtime_resume(). Keep devicetree parsing in probe and add a new field in the private struct to remember the USB2 refclk rate code computation result. This opens the door to having the init sequence being executed later down the road, at system-wide resume for example. This is NOT currently happening because runtime PM is disabled at suspend without the refcount being affected. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/cdns3-ti.c | 90 +++++++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 38 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index 5945c4b1e11f..4c8a557e6a6f 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -57,6 +57,7 @@ struct cdns_ti { unsigned vbus_divider:1; struct clk *usb2_refclk; struct clk *lpm_clk; + int usb2_refclk_rate_code; }; static const int cdns_ti_rate_table[] = { /* in KHZ */ @@ -90,10 +91,8 @@ static int cdns_ti_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *node = pdev->dev.of_node; struct cdns_ti *data; - int error; - u32 reg; - int rate_code, i; unsigned long rate; + int error, i; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) @@ -133,7 +132,9 @@ static int cdns_ti_probe(struct platform_device *pdev) return -EINVAL; } - rate_code = i; + data->usb2_refclk_rate_code = i; + data->vbus_divider = device_property_read_bool(dev, "ti,vbus-divider"); + data->usb2_only = device_property_read_bool(dev, "ti,usb2-only"); pm_runtime_enable(dev); error = pm_runtime_get_sync(dev); @@ -142,40 +143,6 @@ static int cdns_ti_probe(struct platform_device *pdev) goto err; } - /* assert RESET */ - reg = cdns_ti_readl(data, USBSS_W1); - reg &= ~USBSS_W1_PWRUP_RST; - cdns_ti_writel(data, USBSS_W1, reg); - - /* set static config */ - reg = cdns_ti_readl(data, USBSS_STATIC_CONFIG); - reg &= ~USBSS1_STATIC_PLL_REF_SEL_MASK; - reg |= rate_code << USBSS1_STATIC_PLL_REF_SEL_SHIFT; - - reg &= ~USBSS1_STATIC_VBUS_SEL_MASK; - data->vbus_divider = device_property_read_bool(dev, "ti,vbus-divider"); - if (data->vbus_divider) - reg |= 1 << USBSS1_STATIC_VBUS_SEL_SHIFT; - - cdns_ti_writel(data, USBSS_STATIC_CONFIG, reg); - reg = cdns_ti_readl(data, USBSS_STATIC_CONFIG); - - /* set USB2_ONLY mode if requested */ - reg = cdns_ti_readl(data, USBSS_W1); - data->usb2_only = device_property_read_bool(dev, "ti,usb2-only"); - if (data->usb2_only) - reg |= USBSS_W1_USB2_ONLY; - - /* set default modestrap */ - reg |= USBSS_W1_MODESTRAP_SEL; - reg &= ~USBSS_W1_MODESTRAP_MASK; - reg |= USBSS_MODESTRAP_MODE_NONE << USBSS_W1_MODESTRAP_SHIFT; - cdns_ti_writel(data, USBSS_W1, reg); - - /* de-assert RESET */ - reg |= USBSS_W1_PWRUP_RST; - cdns_ti_writel(data, USBSS_W1, reg); - error = of_platform_populate(node, NULL, NULL, dev); if (error) { dev_err(dev, "failed to create children: %d\n", error); @@ -211,6 +178,52 @@ static void cdns_ti_remove(struct platform_device *pdev) platform_set_drvdata(pdev, NULL); } +static int cdns_ti_runtime_resume(struct device *dev) +{ + struct cdns_ti *data = dev_get_drvdata(dev); + u32 reg; + + /* assert RESET */ + reg = cdns_ti_readl(data, USBSS_W1); + reg &= ~USBSS_W1_PWRUP_RST; + cdns_ti_writel(data, USBSS_W1, reg); + + /* set static config */ + reg = cdns_ti_readl(data, USBSS_STATIC_CONFIG); + reg &= ~USBSS1_STATIC_PLL_REF_SEL_MASK; + reg |= data->usb2_refclk_rate_code << USBSS1_STATIC_PLL_REF_SEL_SHIFT; + + reg &= ~USBSS1_STATIC_VBUS_SEL_MASK; + + if (data->vbus_divider) + reg |= 1 << USBSS1_STATIC_VBUS_SEL_SHIFT; + + cdns_ti_writel(data, USBSS_STATIC_CONFIG, reg); + reg = cdns_ti_readl(data, USBSS_STATIC_CONFIG); + + /* set USB2_ONLY mode if requested */ + reg = cdns_ti_readl(data, USBSS_W1); + + if (data->usb2_only) + reg |= USBSS_W1_USB2_ONLY; + + /* set default modestrap */ + reg |= USBSS_W1_MODESTRAP_SEL; + reg &= ~USBSS_W1_MODESTRAP_MASK; + reg |= USBSS_MODESTRAP_MODE_NONE << USBSS_W1_MODESTRAP_SHIFT; + cdns_ti_writel(data, USBSS_W1, reg); + + /* de-assert RESET */ + reg |= USBSS_W1_PWRUP_RST; + cdns_ti_writel(data, USBSS_W1, reg); + + return 0; +} + +static const struct dev_pm_ops cdns_ti_pm_ops = { + RUNTIME_PM_OPS(NULL, cdns_ti_runtime_resume, NULL) +}; + static const struct of_device_id cdns_ti_of_match[] = { { .compatible = "ti,j721e-usb", }, { .compatible = "ti,am64-usb", }, @@ -224,6 +237,7 @@ static struct platform_driver cdns_ti_driver = { .driver = { .name = "cdns3-ti", .of_match_table = cdns_ti_of_match, + .pm = pm_ptr(&cdns_ti_pm_ops), }, }; From patchwork Fri Feb 23 16:05:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 13569403 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 0B43CC54E4C for ; Fri, 23 Feb 2024 16:07: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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ml4JfiN7asRVM4HYqftKuTL6P2PlE8zhYida8I5JgPc=; b=5ClvE1ldaSSkDZ jrNDefI9TjmApv6WKeoaJJ7JHJWVQeD5MjgfB6L3hEAr0OEfHYxc5eLBmEjVHJjLyKF9XwC3381Yv VVuJyKXnYRvHGtjiJr5O2ifa7Zn5NftGGhW8YaKjrI+MHbUsq6iYYGaeRoEXdDfYGBa2jsAYeKc0B Fqe/zWYBpDSphsUapi72iIPXuwhc0VOXq4xukOSNDl1cJr3M0hiUFusM3C+bC1IlXvP2kTwoER+Vw 6lKO7Kw7hZuLrniPTJbCPG5rZ0sZZO5/NYRXkEpb7vktW5MAPqij8h1Z6hUv1xWYzRoM0+I/yO09S w+0RefBOAyZCSSjPWGAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY57-0000000A8nF-0dpa; Fri, 23 Feb 2024 16:07:25 +0000 Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY3M-0000000A7wb-237v for linux-arm-kernel@lists.infradead.org; Fri, 23 Feb 2024 16:05:39 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id B24741C0008; Fri, 23 Feb 2024 16:05:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9FINWLp/w0HN6A+6t4rg5b6XzSr+dwLhUgwTrZyKrbg=; b=cOD7OspLvGU9jVADF5Hs8xu3HGeAENLLkI5Ccu/rnM7Nb6QAN993aq6F6blcocec/8zYOU kt1fGZgX3RevRgRzg0stoXbRmz/b7rTLu+uNiqGkX5jIrPy9HYWZFdm7TmqdGiwLqv527R C9SQ4kyCbS5k5Fk04BCbRQCa5S3lUF5sbzzT8sbVDP11szXnSuq6OKmHVybNDt3fa77CSj zYPTB8ZXxt2friE/EDQ+gAx7+JAwDLtxOO8YHo8RtqqFGy665GLQgcWqxQhnO+h19JoxX3 Ep6/7ylAX6DHDXwMBPHUlFp1EB3h+ETaxlQQ0SLC0lqFyLtplZ6A1RwLXBFlVA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:28 +0100 Subject: [PATCH v3 4/8] usb: cdns3-ti: support reset-on-resume behavior MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-4-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240223_080536_901328_36B6BB18 X-CRM114-Status: GOOD ( 13.52 ) 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 Add match data support, with one boolean to indicate whether the hardware resets after a system-wide suspend. If hardware resets, we force execute ->runtime_resume() at system-wide resume to run the hardware init sequence. No compatible exploits this functionality, just yet. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/cdns3-ti.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index 4c8a557e6a6f..f76327566798 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -57,9 +57,14 @@ struct cdns_ti { unsigned vbus_divider:1; struct clk *usb2_refclk; struct clk *lpm_clk; + const struct cdns_ti_match_data *match_data; int usb2_refclk_rate_code; }; +struct cdns_ti_match_data { + bool reset_on_resume; +}; + static const int cdns_ti_rate_table[] = { /* in KHZ */ 9600, 10000, @@ -101,6 +106,7 @@ static int cdns_ti_probe(struct platform_device *pdev) platform_set_drvdata(pdev, data); data->dev = dev; + data->match_data = device_get_match_data(dev); data->usbss = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(data->usbss)) { @@ -220,8 +226,29 @@ static int cdns_ti_runtime_resume(struct device *dev) return 0; } +static int cdns_ti_suspend(struct device *dev) +{ + struct cdns_ti *data = dev_get_drvdata(dev); + + if (data->match_data && data->match_data->reset_on_resume) + return pm_runtime_force_suspend(dev); + else + return 0; +} + +static int cdns_ti_resume(struct device *dev) +{ + struct cdns_ti *data = dev_get_drvdata(dev); + + if (data->match_data && data->match_data->reset_on_resume) + return pm_runtime_force_resume(dev); + else + return 0; +} + static const struct dev_pm_ops cdns_ti_pm_ops = { RUNTIME_PM_OPS(NULL, cdns_ti_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(cdns_ti_suspend, cdns_ti_resume) }; static const struct of_device_id cdns_ti_of_match[] = { From patchwork Fri Feb 23 16:05:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 13569401 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 CD278C5478C for ; Fri, 23 Feb 2024 16:07:38 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/U4Psgb5QDETI7rr9EbQdz65LNiS9o6JhvadP6gTdfg=; b=E1w2j43xXseTDJ aaeDCC1BjYD+L1rt6EU3LZlZmqvRAU5+KzusxfLuruny1IZfCle0B4wD1bq1pQLTuQqgBy+EsiZp1 8p5whksGjFXR8fp90QyteyRDQ3yhPEsezcc+UpXF7HWcmUc2qnUk8Xjse5HJBR6Q9EMRhbIKzosdX eQYNT8LWJIeiAHVLdcn/nh7jY35Z5JgjAhRYj7pXRESvGW/6kDkJJCSbY+WApOfyCsAGQc8O7j5F3 sVnlXKWnIcFOnumGb7GZELqUGwnDuQVsfbSgj0MA5tStjRS9pYp713Jx43yg3/U9rWTkY9U+6fa4V ImfEdM4CJq6vyP/ULxyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY56-0000000A8ml-0dK7; Fri, 23 Feb 2024 16:07:24 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY3M-0000000A7wh-33QJ for linux-arm-kernel@lists.infradead.org; Fri, 23 Feb 2024 16:05:39 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 820951C0002; Fri, 23 Feb 2024 16:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704335; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gQ4y/VEIeiumEnjB4J+Uqc13LinCxq5gzHE+LkRNKeM=; b=mLuKiL/YjpInWAvicL9rw00uFm5cJOy0efmORr8oL2qc7i+CLbyBhQtE8gjJ0hsZDsAUhc aQL1K+k/N+D1RNfQbCsstk+mXxrRlmBdtSSL6oX+Mq3YKU03m6MCGeGLVBh0/DuETcHxYd 2x/y9k1XwUBNp/OOKksMsiMc22SubR0orf6rEN2FNv1+aU5XPQFUFhDOG5aYaqs0TPM2+b 0yufs8EcgQ2wyo9kPAUyetqeYnxhKUUxyH0DtCnvHrW8yS7oaIEVYN+O8GFeIdyayp0lKS qZRUS3607Gkw3hSqhYTjWvtc5JgQ+d1PucmK1lQQTHSU8ZpCOq7mK8iz6Jn5jw== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:29 +0100 Subject: [PATCH v3 5/8] usb: cdns3-ti: pass auxdata from match data to of_platform_populate() MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-5-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240223_080537_021650_B13A4A58 X-CRM114-Status: GOOD ( 13.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 Allow compatible to pick auxdata given to child platform devices. No compatible exploits this functionality, just yet. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/cdns3-ti.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index f76327566798..29fb24c811b3 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -62,7 +62,8 @@ struct cdns_ti { }; struct cdns_ti_match_data { - bool reset_on_resume; + bool reset_on_resume; + const struct of_dev_auxdata *auxdata; }; static const int cdns_ti_rate_table[] = { /* in KHZ */ @@ -95,6 +96,7 @@ static int cdns_ti_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *node = pdev->dev.of_node; + const struct of_dev_auxdata *auxdata = NULL; struct cdns_ti *data; unsigned long rate; int error, i; @@ -149,7 +151,9 @@ static int cdns_ti_probe(struct platform_device *pdev) goto err; } - error = of_platform_populate(node, NULL, NULL, dev); + if (data->match_data) + auxdata = data->match_data->auxdata; + error = of_platform_populate(node, NULL, auxdata, dev); if (error) { dev_err(dev, "failed to create children: %d\n", error); goto err; From patchwork Fri Feb 23 16:05:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 13569404 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 B52FEC54E41 for ; Fri, 23 Feb 2024 16:07:42 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=B9QVlmPZO/e4cTnbWJEjfUhx52Yqk6Xg1TL5MegJhiM=; b=H/6pn9h/IFgukw m+yKlwcy82mmVuJ0Ykm5RqVqQp1ukgZVEY6qTwbE0rCwg1PUFIVrUl0+AYF5NrBfMEWuvVXX5my5E BuKdF3M233ESqWEYJGaSUMqnxpx2GrhnhlfqiO/QCERwRxismRGmn/NfeztRjRjMAaf3qgLFITkMU zI4GnakfVqYISrtTj/3sBeoLnzbbfxoa6cDOH1u4ZZzkUmiXAcag2FMC+Gafz8Yds3o9C+UfUjEIN xwWz6Y5xPHoQ65ixJvQ25/xsajvOnoexV0Fvc4bMruhRjGWw+yvExGKDUfzrJbv7IFjac6xxZ0O9P x2EAu4vib/rDBHCjruWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY58-0000000A8nk-005f; Fri, 23 Feb 2024 16:07:26 +0000 Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY3N-0000000A7xM-1nbR for linux-arm-kernel@lists.infradead.org; Fri, 23 Feb 2024 16:05:40 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 542621C0009; Fri, 23 Feb 2024 16:05:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=niMPY3vxyYJLUrRJjUWlI9ZbKbPa7LOQCtP7P5fEvVA=; b=CbYTeVT1n4jzdpnFH9hgwWoam5OME+Lgp6+zcANJCgji931QgArC204kIdPKTiWfmTMYOq QMf/i9pOg4wRb5xEx3KOlcRaTUjd5ikZvEz1ohjrfky6plUOkYG0FNNN/T9R/BbDCedvqW o4EBWRNCNqcCaeASWWpfi/b9m3yUESL/GE04dD83N40PUyL9Z2pkRNo8R4Q4sKb+Nj/h1v zFIZyPDbBdOpaQx8Zs8ciIn9o+dE1fZnHxhhBQspkwUEMaiCZ9k/8kLxMfIpBOE9s5G+rL CiF4MHfz2XyLyUKrQ7F+d0Kd097nOjAk/Voqs6YXrN58oXTCjA4YKituAIx2tQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:30 +0100 Subject: [PATCH v3 6/8] usb: cdns3: add quirk to platform data for reset-on-resume MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-6-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240223_080537_730333_7A977F37 X-CRM114-Status: GOOD ( 10.94 ) 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 cdns3 host role does not care about reset-on-resume. xHCI however reconfigures itself in silence rather than printing a warning about a resume error. Related warning example: [ 16.017462] xhci-hcd xhci-hcd.1.auto: xHC error in resume, USBSTS 0x401, Reinit Allow passing a CDNS3_RESET_ON_RESUME quirk flag from cdns3 pdata down to xHCI pdata. The goal is to allow signaling about reset-on-resume behavior from platform wrapper drivers. When used, remote wakeup is not expected to work. Acked-by: Peter Chen Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/core.h | 1 + drivers/usb/cdns3/host.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/usb/cdns3/core.h b/drivers/usb/cdns3/core.h index 81a9c9d6be08..7487067ba23f 100644 --- a/drivers/usb/cdns3/core.h +++ b/drivers/usb/cdns3/core.h @@ -44,6 +44,7 @@ struct cdns3_platform_data { bool suspend, bool wakeup); unsigned long quirks; #define CDNS3_DEFAULT_PM_RUNTIME_ALLOW BIT(0) +#define CDNS3_RESET_ON_RESUME BIT(1) }; /** diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c index 6164fc4c96a4..28c4d1deb231 100644 --- a/drivers/usb/cdns3/host.c +++ b/drivers/usb/cdns3/host.c @@ -91,6 +91,9 @@ static int __cdns_host_init(struct cdns *cdns) if (cdns->pdata && (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW)) cdns->xhci_plat_data->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; + if (cdns->pdata && (cdns->pdata->quirks & CDNS3_RESET_ON_RESUME)) + cdns->xhci_plat_data->quirks |= XHCI_RESET_ON_RESUME; + ret = platform_device_add_data(xhci, cdns->xhci_plat_data, sizeof(struct xhci_plat_priv)); if (ret) From patchwork Fri Feb 23 16:05:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 13569402 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 7C6F1C54798 for ; Fri, 23 Feb 2024 16:07:40 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4wrUY9HH4QxHqpqE4zeuBEguKVsIFb3050zidhJPiX8=; b=SZtE/UffsNyP0v yEPlMH4l7K3EBIzKdg+YI7ViRc2UGR4XZjp58AY142THn0viUdHRXK8ArOMLQ28mBy9cp26p2N40Z FuHW9tn7iV0rjFRUz39mOd3nuMUu1sLrqK23nd+VpIjrjCRQrix+JkU8zHeF2Q8A3tZ8e5t7n0Ddo A6wLx/JbFWwolKG5KCjaifHJ4TrvZ6A3bHby49ri2/KEN1F36BAYEtpjVizNABwmhp3n/VdhhPbWb HS+cv0QtBUZ926sdTOOeFpKqwv+BdkCKuVIDupm/8MPtuYN0J1euiwEMFykYlTOxBhaFxQYUVtsJM DCmvmL8g5X+DPi3Bfd8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY59-0000000A8oJ-1G7L; Fri, 23 Feb 2024 16:07:27 +0000 Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY3O-0000000A7y3-1OjB for linux-arm-kernel@lists.infradead.org; Fri, 23 Feb 2024 16:05:40 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 215831C000C; Fri, 23 Feb 2024 16:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wF2GEFIGDf1EoCX/WDH7UWK4GOrP+0T9MYnwKzq1lNc=; b=NEzmvm4U1Qt5t0hcgSEFjjIouzNmvAR3cOFKlNu6MbUu5OjE0Y0X4ZUFs7DDWGon/MJIKN I7oOYJ7kqC0SlplEaxb0OWaz3xPegu3mcqr6jLLzUwHb6YY6j+OOOrVF7y7otmDsN0Fx0m HUShbNCkwob8+61DMz5BXnH2nuyM9eR3Ag17mHuSpfN9Z7bmx/yfqe5KbfhNBjsu8wgFGI anSQFw4RD8Lv8+p3ty3HQSl5HQC3kEHnBmmUzXdoV8xupZnarmXsh5snp4ldezmo9+lwgA V2Qmj8DgVA9GCOTP4ctqnPJQqOs2VrhT/QPWuh8/aU5C1D1q3X4JB32KP6hC2Q== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:31 +0100 Subject: [PATCH v3 7/8] usb: cdns3-ti: add J7200 support with reset-on-resume behavior MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-7-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240223_080538_689691_C1EC2178 X-CRM114-Status: GOOD ( 11.39 ) 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 Add ti,j7200-usb compatible. Match data indicates the controller resets on resume meaning: - The cdns3-ti wrapper init sequence must be ran at resume. - Tell the cdns3 core that we reset on resume. This silences a xHCI warning visible in cases of unexpected resets. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/cdns3-ti.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index 29fb24c811b3..648243a27987 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -17,6 +17,8 @@ #include #include +#include "core.h" + /* USB Wrapper register offsets */ #define USBSS_PID 0x0 #define USBSS_W1 0x4 @@ -255,7 +257,25 @@ static const struct dev_pm_ops cdns_ti_pm_ops = { SYSTEM_SLEEP_PM_OPS(cdns_ti_suspend, cdns_ti_resume) }; +static struct cdns3_platform_data cdns_ti_j7200_pdata = { + .quirks = CDNS3_RESET_ON_RESUME, +}; + +static const struct of_dev_auxdata cdns_ti_j7200_auxdata[] = { + { + .compatible = "cdns,usb3", + .platform_data = &cdns_ti_j7200_pdata, + }, + {}, +}; + +static const struct cdns_ti_match_data cdns_ti_j7200_match_data = { + .reset_on_resume = true, + .auxdata = cdns_ti_j7200_auxdata, +}; + static const struct of_device_id cdns_ti_of_match[] = { + { .compatible = "ti,j7200-usb", .data = &cdns_ti_j7200_match_data, }, { .compatible = "ti,j721e-usb", }, { .compatible = "ti,am64-usb", }, {}, From patchwork Fri Feb 23 16:05:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 13569405 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 2924AC5478C for ; Fri, 23 Feb 2024 16:07:44 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=a0D/KosKmGHBgRHHsE+Xc4Az0K4EV8MUcUwt2aSe374=; b=jGbfcUheCQlZtz i38yjn57IMGGjXtr6KYS1Ib16uWHIj5lTYtjgUKCeYBNiTZ7nzfjJZfBvEnrbNmTs+xbQZeYslrsM lyCB0cT/glnF3z/l+XhCeA7Yr/6HMfklT53BlM3nQLRZgDBY3+1raNJcsBGVwBqvJGs8XUH/caWM1 BOlR56sN++hJCwvz1Cj1Oykgqkj3MJHQYvi1RLGvlFglUpk7AVp6Kiu/lg8erVVDWGxA2NG2f7jWa biV8KHxTRjv3yeT39F6G/fQ8GBfs06jtGv54RpHNHn2NcBoD62U9gCk2HK6HzW2gXgK+39ftt8lyh WyLTiXrv0+J2iwwMlSBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY5A-0000000A8og-18zi; Fri, 23 Feb 2024 16:07:28 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdY3P-0000000A7yf-0V2E for linux-arm-kernel@lists.infradead.org; Fri, 23 Feb 2024 16:05:41 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id DE0851C000D; Fri, 23 Feb 2024 16:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704337; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6xOpzacrMjQXeUvPNnUvJ9wpAt1ylGpzt8dxUAtY2fY=; b=m9+GDKH5e7Qotwc5ISt6ICucycRwJmKWEts5I8vhAwxfRn/31OH0ALy0DnGj5suVNMrdUA gBqM3HHCfrs/8g78pNr03uyFoJm1TW9TWddCcmipAO05w8QzTqauMsa4/Fy+PMJpaEPN4H 93Jfj+XDXBHe4z1jJV8fLiwgy7C0/ZaZxK9rRqEmZIdbCK3Y+z4tIKg5mUmfW2sv/iUtQ1 g/EXTjiSpNO7fwZf3j1XE9oL5eqvBvMQ7A5f9XoX6VJjpqF3hilrjxeTSgVBZ1i3Ab9QWZ 0z3t4pz/EQQ+3sLCEdO3o2Iy1F6jmBeECDpEhUgWKlROQsDvOLLF6QQvsMqNcg== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:32 +0100 Subject: [PATCH v3 8/8] arm64: dts: ti: k3-j7200: use J7200-specific USB compatible MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-8-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240223_080539_465928_E7DC01EA X-CRM114-Status: GOOD ( 10.39 ) 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 On our platform, suspend-to-idle or suspend-to-RAM turn the controller off. This compatible triggers reset-on-resume behavior to reconfigure the hardware. Signed-off-by: Théo Lebrun --- arch/arm64/boot/dts/ti/k3-j7200-main.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi index 45ba9c2d0344..134d6e5f3b01 100644 --- a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi @@ -793,7 +793,7 @@ pcie1_ep: pcie-ep@2910000 { }; usbss0: cdns-usb@4104000 { - compatible = "ti,j721e-usb"; + compatible = "ti,j7200-usb"; reg = <0x00 0x4104000 0x00 0x100>; dma-coherent; power-domains = <&k3_pds 288 TI_SCI_PD_EXCLUSIVE>;