From patchwork Thu Mar 7 09:55:02 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: 13585294 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B8DB84FD2; Thu, 7 Mar 2024 09:55:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805320; cv=none; b=gcPWTH4cfEtnfRO11iuRaxM6MrsCjlHtWKMAYyojNihLT9XlcP0FobdfcqetWQg3Cd2Y0rhB1St2s3iob63HTxM7yix7AfOAfaURWNRqMgbWYSxy3mtJN8Qt2Ps1OizPLO4851fz/snv0DMmBnTk+ZjVRC/ylYlPYkN5PrJV4K4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805320; c=relaxed/simple; bh=3vDQZq4bBTHIKrUEtadqb5Tze2IMHI6WZ9emMoHzC5U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FzqXgrXmdmDaJglOAUelJjYsZqg02nygbcudEd1rJZcPNRmQ/0ukyFFpOcoJ70Q9kEtP/YNIPS915hJhvWjjIgo5oDTHoUWiM2gyqMlkzcZTuyA/qHCk2hcuzF/2J3nG12Luf6yp+idFI+O5spsJ6OSjj/DWLBHrqCPdP0rVVO8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ZZywsdz/; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ZZywsdz/" Received: by mail.gandi.net (Postfix) with ESMTPSA id 23F351C0009; Thu, 7 Mar 2024 09:55:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709805309; 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=RRn8ycTUfkJDoPr5o1S7rMU5q43x9RS8jtz5zW234a8=; b=ZZywsdz/p1+lSsuNoJE7ZwP0r54L3buzp7ZaBwS6Ztgd3phy7M5FV/wNtfU7sd7arxFS40 TA4gbgo/PmlsOUYXYY7BK21ywt74DO3VY+3ZNnCsnCT3UN2zeir74cNiGQlVA7pXNvc8aT r1bwfV2Zk8/+IKzPTXueqDnlbZOhFN2yiU//X65Wzw32wBsA/NRuZ4fAuqzW0cJK0vDq3b dPnqb1g2+FkUrfWZ0dETU/yVnQkqfSVdQnMpmV2zhOZDGs+p13Dq4yhSZy4iQJd2LBBjkR XAwqsCKZVFAf7/ufAoz81NI12tWvFELNMWC7wV3y3lu8H7a7rEsltB/DA3cAgQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 07 Mar 2024 10:55:02 +0100 Subject: [PATCH v4 1/9] dt-bindings: usb: ti,j721e-usb: fix compatible list Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240307-j7200-usb-suspend-v4-1-5ec7615431f3@bootlin.com> References: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@bootlin.com> In-Reply-To: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@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 Compatible can be A or B+A, not A or B or A+B. B got added afterwards, we want B+A not A+B. A=ti,j721e-usb and B=ti,am64-usb. Signed-off-by: Théo Lebrun Reviewed-by: Rob Herring Reviewed-by: Conor Dooley --- Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml index 95ff9791baea..653a89586f4e 100644 --- a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml +++ b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml @@ -13,10 +13,9 @@ properties: compatible: oneOf: - const: ti,j721e-usb - - const: ti,am64-usb - items: - - const: ti,j721e-usb - const: ti,am64-usb + - const: ti,j721e-usb reg: maxItems: 1 From patchwork Thu Mar 7 09:55:03 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: 13585291 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B92F84FD3; Thu, 7 Mar 2024 09:55:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805319; cv=none; b=n9ibx9hkEJVlM615Kkcku9gTGSERi80/5PH9KVQ2X8Qq2VPsD9I1lXW6we2RsQXMgvz5+nk7ZHKB0BzBbeO0j5zLF9MnnrrDalzfieLrvTBAQtkGvGBmhrO3TH4Us8SCJuTaTnKqlmik8M5xkGpJwUX7ul6l5W2J/Asla0RvWog= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805319; c=relaxed/simple; bh=KLfycGuMheC04tlvb9jrC4igb5MjblkT22SldYTJ4b4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rM0AejSQyl+NqNr5pq4RiOAPEDj+p9ggiGKzaBFhxSqvs0ml8Rjpg3senMJGnNc05XGp0q/uP3HlquuApb5k+02Qyzam4WCXqMT/E6u8C4UV4P/dOIxJLjMTFlwDOx+c+7LjKRmoYZxQ7YP9SL7Bvj+uhREF7BjIzPVZ3iayM1E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ITa+m7jn; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ITa+m7jn" Received: by mail.gandi.net (Postfix) with ESMTPSA id EBB111C000F; Thu, 7 Mar 2024 09:55:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709805310; 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=r3Qj18SJPoB5IwOhH7muoEgWJF0E8Qgb24UW7SZrSqs=; b=ITa+m7jnPWAcRiCcJYCCi1AgHywl45B/yVWuxpFOxZ7h1ysXWWk/QxBE35BexIV1rb5lxm 6nxGzpH4CViZJUJ4pHBKDtJZLzxbZTOHTHlGxLHM3MLdPP38KfVW5Vsf25NW4GNGzbq/Gi 8ALGDVsbE0QnmN36OcfRw+TbYVjr12v/qBf7ozn3H9O5M1oASnX0LMzHkL/G0FNpWhVfBk pco+RTSqV4VCEdUPclI18d+HWviFdJGATJXnUT9NHT6OKKBSaTI5ipsX3FfRRKjuoV7G0W miO+01g3P57Pspt5BTlqhozQk4XbIl9i+7tky10FnalLU4y9NXWVx3J8je4WxQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 07 Mar 2024 10:55:03 +0100 Subject: [PATCH v4 2/9] dt-bindings: usb: ti,j721e-usb: add ti,j7200-usb compatible Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240307-j7200-usb-suspend-v4-2-5ec7615431f3@bootlin.com> References: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@bootlin.com> In-Reply-To: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@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 On J7200, the controller & its wrapper are reset on resume. It has the same behavior as ti,j721e-usb with a different SoC integration. Signed-off-by: Théo Lebrun --- Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml index 653a89586f4e..e8f7e7511483 100644 --- a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml +++ b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml @@ -16,6 +16,9 @@ properties: - items: - const: ti,am64-usb - const: ti,j721e-usb + - items: + - const: ti,j7200-usb + - const: ti,j721e-usb reg: maxItems: 1 From patchwork Thu Mar 7 09:55:04 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: 13585295 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BFCD83A06; Thu, 7 Mar 2024 09:55:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805320; cv=none; b=HIDvRcv/NnxZ+Nzk3jT+7glKCfWp5KFdFQX69uzTuNPblkpGonFSUPTxro1gI+1Cy1NwmIb/Rri976JxiKRyMaYGBxMg2HMHxnifVm33gDGzSDndIMwvAANlJPNIH8rdqmURQHgOInQM5pZ/CKh4sGwEFizj8oJytwg4cR0hAy4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805320; c=relaxed/simple; bh=9K6dlFecVjdiaofvQZmFf1HLeSgphBh5m11nBf8m5dI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ieUnb1e3R7nZgg/AP1SbBH3kM58gSjUewYeh+4HCq5jfM/Jw2RGmjqZ3t/lhSZJATTBWz/5FIpOFoOf082LtWhGWBOqbkwttHYWyUsx7ZtUizBR+jSvWXoak3VhYCgg5VdKeSjxJM9G1Cbf5l04xnMiIQJ2E5Iyecp2frmJTFm4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ReThVaVZ; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ReThVaVZ" Received: by mail.gandi.net (Postfix) with ESMTPSA id C56FA1C0005; Thu, 7 Mar 2024 09:55:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709805311; 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=6DqnLNP1foaJv1btQXdf+rlQ3lZPfqXjWVpv49y/Boc=; b=ReThVaVZSOzqMKfWSrJdW302IizxyaGAeh4iW7KYMnbJm5CHIsMwyoIlo6Ugz+mYV2qWoT vpwlbS9LPOID0rpvhRQCVS7fV/H9pIuyAk0+WmlNSvuMv5Z9PlSI0J7mRrn8qHSfDu97lN BFj2wcZKD7VkqI6hA7+24CVUBy+nMPfHw5bLUT+u2BJOyTLEYu6zxk8DYSXlojHF6GI+kW qyQTtQCu8pQARc8w9pcgefWxtAdA9hXOLJo7wwaVIRnFMynGMM0rTYlo/OXCAgnn5PDQvx BfMYP5Ni5v4Zayt3EokEi6q+YoeMv55fElomTnJy9uGTnKPhcS5TsHz2dJncsA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 07 Mar 2024 10:55:04 +0100 Subject: [PATCH v4 3/9] usb: cdns3-ti: move reg writes from probe into ->runtime_resume() Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240307-j7200-usb-suspend-v4-3-5ec7615431f3@bootlin.com> References: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@bootlin.com> In-Reply-To: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@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 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 Thu Mar 7 09:55:05 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: 13585296 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A42384FC8; Thu, 7 Mar 2024 09:55:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805321; cv=none; b=GIV7M0B6V4vIPDo+MlbKPWnEwLrZ6XxEO6KaG+AzxUVqo8cIHFQkSM+vRhj56vQuDtQPYrlGhR5Fmp7SpX++rkzf3kvIAEakAqHQITIBdezCANKG0XzPLqFZNH+WBYogdoDrNOLeiXtaPC2xhZ6wLnBpI9cTMiL9Rm54T1VoKrg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805321; c=relaxed/simple; bh=ywTxIisOOTpj+HDN2NsOLT9qLjcBWovcybVHSKaAnsk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lVpa4cShoaSOQPILw+z8iWi/1PnFhRuW1Vpyh4snxwp9rkOysW8jtHYKlBWFnxzo5dVSIg4C3UZJyHiTtRQb71hvKVzeOhzOOY329g/Z/FwGebWIQ+mgKN4JLigGLjxqbe9peKzEptkjtiFU4EFmKJRGOve3faHSKmmGucNWLUs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=eDt6wKeW; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="eDt6wKeW" Received: by mail.gandi.net (Postfix) with ESMTPSA id A77021C000C; Thu, 7 Mar 2024 09:55:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709805312; 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=ORK3ooFzTv7MrS/tadWslkKnebORiux/zlJ4WhF6LKM=; b=eDt6wKeW0kg+C/fqGb1QlxB5PIOaEmhPkzdXT1ncVRdX9OLvPmnke2BQSNI4Ll+kWP3Tt0 RDQvSJO6++eZVDNwgVvncNk2Wt7HjxvOx3FiANhP95MYHAjx17LNeNtVUFdlGnhWziCrfw IpET2iwG6JPfM6F/i51B+xlKMOZWIGoDB7aZGWZDcGxkDf3d4uzkn1sADVACcvuIvUB7S5 pwl9f6lwlwMCP+CKOPA04stLPE6t82LkB5QLIJsnqKjZ/tV6byty9Pc+r7K0c6K8Ji+Uun +Rpz3sz/4Zi6LtXUogCEAO5iA+nRtefKXrLMDzTt6iUwnmVO4CXuDUujRT02ag== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 07 Mar 2024 10:55:05 +0100 Subject: [PATCH v4 4/9] usb: cdns3-ti: support reset-on-resume behavior Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240307-j7200-usb-suspend-v4-4-5ec7615431f3@bootlin.com> References: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@bootlin.com> In-Reply-To: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@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 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 Thu Mar 7 09:55:06 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: 13585297 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 689098562A; Thu, 7 Mar 2024 09:55:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805322; cv=none; b=iknBk4yhL4TKkvFoBE2jqHECS7pL42cdrynOo71EBbKsrG7e5vHkAkiQ2Z5oiTdO7SfNWz8Nmk+TMF6G/tLjoAvaQahDQ5mieqz3KEk5WnzRqY+gsf6DOrY4bPg7IvKagw+fq12YcmOJQ+ivRIMHlT8w/oxWJqAsuOABdX2eliQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805322; c=relaxed/simple; bh=DFDQiyzlGF6+kLshWht4zWnnot6KQjotNmJUWDkVAh4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DjwZwbisnVFKaG843/Ng9XGTiVqOt03ZE9DzjAdted+thEfWRbFZhToynrMhgyowdK512vdvfZ5fL1mcF73bqOY3wsXu4wFI9AHLOy2fVYN6jxcUUuLUHFwoTv1732cH910ZD2wX2fWBtn2cP7s/Kw2rCO7HKAmyov5qfCFha98= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Y/Ue+XNx; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Y/Ue+XNx" Received: by mail.gandi.net (Postfix) with ESMTPSA id 72B7C1C0011; Thu, 7 Mar 2024 09:55:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709805313; 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=/o7zeZi0zs41+v++mktfx9Xs/6T+zXBb880PpMxs3XU=; b=Y/Ue+XNxcZlqlJGaFIwGKKSLD8dA0fGKW3q4L8bEf/bQp7WsSccqGHjhMJNJZB4IOuxkxf qLLvFkravYeg5ilEedkhHHoWaIZ6UUjabBbkHX/6rR5tktrCPpU1H84u6PLbS6mDE3WMez wtSUsgRNFgOUuS7MzC43jX4qrXA1RA5/WIy1IlLk/L8s+/0IfM8IULJeAb+iRwS8Q6hYkx u0cIcknTLkwrzVwLGa/cwkC0tZThreVt6NprIV357IKKQrrdZnM+Rf3EHeCJJoWcSgjZPD S3YSLdAgluojq2+FGTFdd92LG8yAobqPRnAFBwrzxnqsqDG3VaE+OG3Mj/yitw== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 07 Mar 2024 10:55:06 +0100 Subject: [PATCH v4 5/9] usb: cdns3-ti: pass auxdata from match data to of_platform_populate() Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240307-j7200-usb-suspend-v4-5-5ec7615431f3@bootlin.com> References: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@bootlin.com> In-Reply-To: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@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 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 Thu Mar 7 09:55:07 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: 13585298 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68C78128396; Thu, 7 Mar 2024 09:55:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805323; cv=none; b=CEeiJWS8j0kZ/Pgse4nB6pMPvxSfVyh0OcjSNT+j0T/BUKLIXlXmFZIm8ta65dKbtrhN5tcAiyS2/q9mHja3As1chlwZK4a3vsOFJqrmqA5zrlNKF92SIPtxJsCP/KVjubirdvkwD67S0ciBFesalQjbKd7M2lBHinvpxFC9guE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805323; c=relaxed/simple; bh=0tZdFeijHB9YMUxabiDXE3y6atvPRlg0wA4sm39K8sA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Fj3f8b26AKUrMT5HZhiwvMgbcjYfFQ2FUM9w9LOA2k8RbMt0HlxXBcmrtZgnHCvwzwPLXvskcXM/G7JZU7eFxw/55XJOUdh02VlWRisb2v/WMdIgCjey/3L85iF8zYjFT+JXkv03GHAA5x+4HLlnh7l42kq2TsYyHFMhBhweIFw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=GVyKiu3m; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="GVyKiu3m" Received: by mail.gandi.net (Postfix) with ESMTPSA id 44F551C0014; Thu, 7 Mar 2024 09:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709805314; 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=SGwpJdmrXnr5kCZ7jekdFRDPw/Wb1kTlGDHTcb2LulM=; b=GVyKiu3mOGix73RAAo10YDgwzKGGEwexrved6rLPs2VZBOhJie6KSBxn8ebNTKl+kLGejA BXWvO0aJeEsv6ulxFQZkCBcf8kHJ6mq5nydhLme3zyJTliHtOumKpM+T5wMwt/25IKh6Im ukjRVrDDrQRxYLXa6swnz+1DOgwNB1AS5TXG0ML6ealSEo+wBTp/1POJQtd8WBucIyMCKC f2AftKM/PFvJQCJtv9pF3f4jFJzQEH34YOiIm+ePS8QpNxuXz+cdBULjdS/UUR+pbBCM7O ta5VSCFxl+Oka+t1+qZQVCm1yYyMiEjXTuk9orIEI+C3th5QxDjlMUj2/FBijQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 07 Mar 2024 10:55:07 +0100 Subject: [PATCH v4 6/9] usb: cdns3: add quirk to platform data for reset-on-resume Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240307-j7200-usb-suspend-v4-6-5ec7615431f3@bootlin.com> References: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@bootlin.com> In-Reply-To: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@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 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 Thu Mar 7 09:55:08 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: 13585290 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62D8884FCF; Thu, 7 Mar 2024 09:55:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805319; cv=none; b=fsmW3QGBxUzChj+oj+inVq9SSZgQPvBJBvpFnFgcU6vd6BWUaWFD7OoJwjg+6LaP7Icmb/ulULenfOVt4bjHcG7CdcxuFQmfTnYB0sKiMFHvq5xGw1n8ywNJQs3iThBD9bUa+H8m3PjOPfhTVGpYvzkMdGL2HtSZWOtsdszDHVg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805319; c=relaxed/simple; bh=HiXQrBsfMjb2fjnPjAaH+keyJAXsK+83DEOBx1prXAc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gEirpYyMNrBgsArEzC7M8odUbLU1S+tsgHrOmfoazQb8l1YmU/3HAluhawu+GKE8cPneutfhn0u5oq+f6Ia3OB1EAR0ufp3qWcrXJH6MvOAT13ZhVJwcKdbupXmgwkk23p2iI1zWCjMD3Sl6XzgqBV8R0IDsw6KGDH/Zsm78B7M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=k5CD1p26; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="k5CD1p26" Received: by mail.gandi.net (Postfix) with ESMTPSA id 20B4D1C0007; Thu, 7 Mar 2024 09:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709805314; 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=VBad9+782slCv5Qy3FoQAjnODyjhm1RvWeZ1RJq9nxg=; b=k5CD1p26mVRjdWhzTx+n0zObpEKSqgXeW1htxo1cDxzY6KFL5w5fIkE6zmyq021wepeUAs SM6bYG+VOTT5F2p6abg4uLFwonEiGK7RxUJm5amVo1F6fo4481e8nuf1N33PjWTgfMAVGO hhJ1qfyfLanmXMwqm/XPTgxld9lzUAkL/AWKwy36VGlS5IzjSFQjuTDd9wN7lZyQFh627X eBeLJbtfavMh1qX05pF77RuGBuPVYo8BebWMHaTOcomidaEShUlXdCsixmD/rugTOwSR1w 0hBiyWIpxpb4gMb+jWCatDLMl6rhS0x7Vaz4o/yJcP0CSqIJSSE4U+TU2b0qvA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 07 Mar 2024 10:55:08 +0100 Subject: [PATCH v4 7/9] usb: cdns3-ti: add J7200 support with reset-on-resume behavior Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240307-j7200-usb-suspend-v4-7-5ec7615431f3@bootlin.com> References: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@bootlin.com> In-Reply-To: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@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 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 Thu Mar 7 09:55:09 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: 13585292 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B89F84FD0; Thu, 7 Mar 2024 09:55:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805320; cv=none; b=JPUg20cGcZl5y6Wiw0AeU+T2xllL2/l0/Z9Nnn7zeaiLQVUFKuex7jP6Gpl93pyiLiUBy8q4joFGIrM2/adjAUjUsoxoJACX59z9nOJmlKQ/3zrb9VODqSRfZ4DmCd5E4dHpGp0trSP/BlL0diDOuP4rEZQtazWeIxhRfoxq7No= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805320; c=relaxed/simple; bh=iVPpoNAELPlEJYPnNQsbq28fPzIRmzcMdPSBSZq0Ze8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gCiyOTyqgPLDqp1rYd3HP9Lo1Fv99MHJsFKdzG2X6eJDuS6ppdL2z3kXmg7on3OvPvrq5TU6hGk6+hD3Erog1h6C9XESmgDvY/Ui+UyoeG4Z8ajc4mXj15HVZemhw2nV38xzlLusB/IRbpgk5CYpqi+wfIIqiImwOj+B0R4BsSc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=RFdy9Rat; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="RFdy9Rat" Received: by mail.gandi.net (Postfix) with ESMTPSA id F0C6D1C0017; Thu, 7 Mar 2024 09:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709805315; 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=tGmmzectwKENjidKkA3JUu18FpasOENIW7PuvpAJ7AA=; b=RFdy9RatkkVJzZWY2jzeBhOtVP7Z0BqYN0xQlfYiX5zknR/Ux1aD0IIIpGDBZ1TrjYoLt9 52JGNt9Y4uni5gksWqVkq0wCzgCjULBGFxRXazgA53fcWzrghPY7f4a3DEKkSshWs+OZaC eetyPFbfpSj9oXxyXWeV1YwpXAZFRCQw25WYo9v6DJUUOpv3AYiTWR3L81sHiUEzNX5St8 qMM83TPNxarQ7bvTupNi0IkGa19w5ecAquonSKMVXlBcASSQgemq4LWpwK5Vr0Yc4G9WVo 0x2iouQOfv+NrV6vzHKLTXPx0rpVF/OiocsJjmsGmclUQtM+mz67czvTO2N5bQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 07 Mar 2024 10:55:09 +0100 Subject: [PATCH v4 8/9] arm64: dts: ti: k3-j7200: use J7200-specific USB compatible Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240307-j7200-usb-suspend-v4-8-5ec7615431f3@bootlin.com> References: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@bootlin.com> In-Reply-To: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@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 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..81a799792978 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", "ti,j721e-usb"; reg = <0x00 0x4104000 0x00 0x100>; dma-coherent; power-domains = <&k3_pds 288 TI_SCI_PD_EXCLUSIVE>; From patchwork Thu Mar 7 09:55:10 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: 13585293 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78BEB82880; Thu, 7 Mar 2024 09:55:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805320; cv=none; b=mcq9CJ9o+ch9+C5VbMyHv2KJ1VhmdfpYNoyCAQT8xjpa1atHzyIF0ehFiPmDZBBK6zaNEGgrePTUvIhUn1abURmyJH0wHvuYXhgkwxslZNjq8eLydL7e3D3IAEWmeQgcS2FmvFwERPWpiZPZ70SvPZMA+LcNlbgnYsX40Nm/vWw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709805320; c=relaxed/simple; bh=1wxo3NL9cihA8oLsXh0fu4ANYi/oi24/gNs9zqxECF0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oUhrmTDLwk5Lka5BYVNxK1+T16ApnuZgZfOaeZiEjMLEDF9sXYE4KwVbdyslVd/2C+QTEUF8l6zgZoO1bP2FZa/2FnInhB4yMKkMbf9GdfOQjANPZg3JvWOQHGhykatIOx7g0vCqps/IJzxsT34Y08RLm7auenFUuEJqvVyupbU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=edEuJ4f6; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="edEuJ4f6" Received: by mail.gandi.net (Postfix) with ESMTPSA id CDD991C0018; Thu, 7 Mar 2024 09:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709805316; 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=+kC1PY9mz+tc5NmqAdWmmc1QQ0klaL3U6KF0CqTuul0=; b=edEuJ4f6KZAELqYxzDFFGoSw6ohghuznupCRzUhofziUyE3O0A3TYAdnJBvGpDtvzfEiul q5GXMWMjotgNJD3VYCd1FKawt8VuW/+7sFx4nBOlLUzlQXrnS0ifhhomOWyWQrIbi3N7Q+ AfeQoDXRHQSsuSIYXE6vkHK/srAa2cOf/4UjiCqEJbE9nFhWseDFDWrbKxblJACxvkdZTc puHm97vbSfEf/eKMnQHGlo6VZhlHkQGWjq6dipQTZku6+p18PkqTTYbIA0cOEgVf1W7Aur wz0mx1PYUZNYH2lPSpU2JFeCpwN6nFXWS/4ZB7FJOuQo+SgYD03V9a+n6WBKeQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 07 Mar 2024 10:55:10 +0100 Subject: [PATCH v4 9/9] arm64: dts: ti: k3-am64: add USB fallback compatible to J721E Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240307-j7200-usb-suspend-v4-9-5ec7615431f3@bootlin.com> References: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@bootlin.com> In-Reply-To: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@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 USB on AM64 is the same peripheral as on J721E. It has a specific compatible for potential integration details. Express this relationship, matching what the dt-bindings indicate. Signed-off-by: Théo Lebrun --- arch/arm64/boot/dts/ti/k3-am64-main.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/ti/k3-am64-main.dtsi b/arch/arm64/boot/dts/ti/k3-am64-main.dtsi index e348114f42e0..de04f4350a9e 100644 --- a/arch/arm64/boot/dts/ti/k3-am64-main.dtsi +++ b/arch/arm64/boot/dts/ti/k3-am64-main.dtsi @@ -749,7 +749,7 @@ timesync_router: pinctrl@a40000 { }; usbss0: cdns-usb@f900000 { - compatible = "ti,am64-usb"; + compatible = "ti,am64-usb", "ti,j721e-usb"; reg = <0x00 0xf900000 0x00 0x100>; power-domains = <&k3_pds 161 TI_SCI_PD_EXCLUSIVE>; clocks = <&k3_clks 161 9>, <&k3_clks 161 1>;