From patchwork Fri Jul 26 18:17:49 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: 814762 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 27C9038FAD; Fri, 26 Jul 2024 18:18:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017885; cv=none; b=libSq3W/HW2bX+7FIY1fk/gtbzsb8nEWo7VOhPDTZi5u35n35WoNKSvAmWFSflJUZLa+AYv/M/gbG2t2ewnVoyYCYHpmqeNyOVe5P0p4yC/scM15nHxahO0RN6X/CbOCdUDei3n2ul2oYQwM/EFaLGKGYWRMXBRmVWnfqxC9kDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017885; c=relaxed/simple; bh=M8kT7XTM54d+VqSVtR7ra8gjgpddLbn1IZokTOD5/D4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ij39RbyV8gq6GTszmfnwqtIXqGegzcbu83rNoD804uQoYS1rIXBG2yZRAlz7PD64uApwBOLIAXDYOZiHDhForCWdqv8X5U/3L6KbDd9WClxvxQvf/6ubyAq6k9je0vWLNYE+D56AObvpqhRtchwo+//8PT7f1Abr6oGx796rNZI= 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=J4/6+VLe; arc=none smtp.client-ip=217.70.183.198 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="J4/6+VLe" Received: by mail.gandi.net (Postfix) with ESMTPSA id 02AC0C0003; Fri, 26 Jul 2024 18:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1722017874; 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=6hlY/jskfFjLvf2CkYp2cXADUxnfZgmP+k1J65XVhjQ=; b=J4/6+VLeoBY7oJ1KT8elG55jruOUf7u4wlH+m+huKtpF7fvSHgd0BTXZsSU+xkK42AzJzE W4lARncevLveoRibHvSQxNz7HwccX9G9EaCAD/P3noX1SjjO36pDx53y7O3Ib2zeuv11HR l/zptPpvGHWmm7+9iQKYuTkTZqQwMd3RH1plH/t5n7q0J07dIGXU6QLcm9d/VFG4aSp0P7 bHrhBHja9AQL7D7KlElfEaTQ2Q69SY31OuGX7qP01+4pvN/NT0z/c4uEuP+v3BK87e0By9 SxpFy4Kt2GY8vBa5lfuaOCqp92i6J/36bDOWVp+3kNBimCJYLi5VUcdObrVjVQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 26 Jul 2024 20:17:49 +0200 Subject: [PATCH v5 01/12] 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: <20240726-s2r-cdns-v5-1-8664bfb032ac@bootlin.com> References: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> In-Reply-To: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Mathias Nyman , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , =?utf-8?q?Th=C3=A9o_Lebru?= =?utf-8?q?n?= , Conor Dooley X-Mailer: b4 0.14.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. Reviewed-by: Rob Herring Reviewed-by: Conor Dooley Signed-off-by: Théo Lebrun --- 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 Fri Jul 26 18:17:50 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: 814877 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 27C3238FA8; Fri, 26 Jul 2024 18:18:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017884; cv=none; b=VdMKCY1c62kG90WJO7sNz2fRkdK/bfaPeBPq6XxQGbB48RXA2M6SNErREMSIXIzvpZT9QdNospGTpSHoibTTGVUZE/4UGzTswlUMP/8ItnoaQ8kxqFV4FBfDODiW3fpXG2Qyx/zWn0BjXIqkuIJzxz9qLVEM2egZQWtrZNZsJWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017884; c=relaxed/simple; bh=LMjr38px/uwtqVLxo9LnKsWDTKiWBJ+juaV59U63100=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MiijJWZiv7GMJGSv/qmJVxei8eyibTrpv0XGB9/TA2OnWWK6XytDqwi1KN2V+dOWHZUgsA0y6StRAv+I6jOyFy9Lv5Kc2CsqhKKD327aiYJgqxBdzY9g8KDLYCSdZQOiP6upRPYjiMiPE/d3jEvTbVv4xkvaCszpXg3Og9HQOQ0= 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=JGmQ6y8i; arc=none smtp.client-ip=217.70.183.198 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="JGmQ6y8i" Received: by mail.gandi.net (Postfix) with ESMTPSA id CCB57C0005; Fri, 26 Jul 2024 18:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1722017875; 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=wUvbczHasNSXYbLrtASntXaaRYM876jaQmbG3YSsJHs=; b=JGmQ6y8iMVspfKfeIgjSAH4IQ9SYmrlcCs4vVSk/ja0JTxjpsrDPd8cGRslr7gZ9/mWLMU 0wAow8JJj9jEiGSfQ9iaPNrGR5JOrXXE5XeQM433RAkDyoS1WqWiz/ASEaUvoS72CZr7ou HMdVE2t9jnQxDN4vt6lUClUh7LK/q/A0hddvZ3NfgVTjxXoLhUPxdO+KxDbZjmDf9NPG5F 66/SYgrLhx0I9LFTdl/SN5PmCwNrNSnYCu77naOMLaLiQ1dqf+F7RoN8Yb6J8Wjo/ZJbOF PMDvbC4vmZPMGDi1bIygRWjP1PGydtMUt4ol3IGMALu6pg7RsHEIO9X3OkMmjQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 26 Jul 2024 20:17:50 +0200 Subject: [PATCH v5 02/12] 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: <20240726-s2r-cdns-v5-2-8664bfb032ac@bootlin.com> References: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> In-Reply-To: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Mathias Nyman , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , =?utf-8?q?Th=C3=A9o_Lebru?= =?utf-8?q?n?= X-Mailer: b4 0.14.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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml index 653a89586f4e..038fdf173841 100644 --- a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml +++ b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml @@ -14,7 +14,9 @@ properties: oneOf: - const: ti,j721e-usb - items: - - const: ti,am64-usb + - enum: + - const: ti,am64-usb + - const: ti,j7200-usb - const: ti,j721e-usb reg: From patchwork Fri Jul 26 18:17:51 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: 814875 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 48E303BBDE; Fri, 26 Jul 2024 18:18:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017885; cv=none; b=c9iYjWFnxVHwecuvytSVlLbijajRyZ0iMluikiEZ4mDnruPgsX9G4hJGYXjVNMawZVzvOB4csp9oQ8nIuUJ8GTbU9TJv9xnI9FhexddmxmLpCq7Cep6T+QLFgTHmHVWB07PE1Brcch1b9wC2UkQGn2GgxGVuA44xcKklae5mFeM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017885; c=relaxed/simple; bh=ZlX7Idabu2YnjBsJlfc7O/B86C2fZMMDbW7t8VjLJAE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NKruKIJrgQAGtqfFkLuyNdtE8GUFGAoJ6/AJ0vCDPJ6yZoNYSumLe60+z1eAHr5+FGMUpupXL6X/ZiF7YnGoCkdhR02+piRR2xDr+oh3ceN49Azwca2Okj2c/CFRfmyJMSJ0FXzEEN2SP3PxqONc3kpRXEBH+NEfYL1GPEpNVdY= 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=RF13gQD0; arc=none smtp.client-ip=217.70.183.198 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="RF13gQD0" Received: by mail.gandi.net (Postfix) with ESMTPSA id 9A375C0006; Fri, 26 Jul 2024 18:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1722017876; 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=kZDH+vYVZ0sd+e3v/cz3AWvqXHr6SWRTVQNIEwVs3rE=; b=RF13gQD0rDtCumVc75IlykaY3O4SaZfqjB2d54aFpfW7NfsKoD4zET7Exks6JRVxiNduqx MReFmI4uF0XPep8nmBom6s2WI7pazGnRHvVgqyx7Xs+LbVd9ucaI96uakbV9tUlZQm27Jl HweOIjLOnyEhMaVO7ePS+zxQ2sWDArtZfyArlPNkiHRHequzmMHYaQt1yTpgYyfknN1GoT 4eE1LEMiXULz3MkgVwSsU8If2rZ7MRUlKiTPmhtgdqhsxo89ieN+NxKW/V8zCEVydOs8gO d+qIAftV8KkvHUkG3LBAXDT0wuxmlgnV+3/GEICiDQBqXEur/pzgGX3+D0SkiA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 26 Jul 2024 20:17:51 +0200 Subject: [PATCH v5 03/12] usb: cdns3-ti: move reg writes to separate function Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240726-s2r-cdns-v5-3-8664bfb032ac@bootlin.com> References: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> In-Reply-To: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Mathias Nyman , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , =?utf-8?q?Th=C3=A9o_Lebru?= =?utf-8?q?n?= X-Mailer: b4 0.14.0 X-GND-Sasl: theo.lebrun@bootlin.com The device probe function mixes management code and hardware initialisation code. Extract the latter into an explicitly named cdns_ti_reset_and_init_hw() function to clarify intent. It also will allow easier transition to using runtime PM for triggering HW init. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/cdns3-ti.c | 84 ++++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index cfabc12ee0e3..5253829ea1d8 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -58,6 +58,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 */ @@ -98,15 +99,52 @@ static const struct of_dev_auxdata cdns_ti_auxdata[] = { {}, }; +static void cdns_ti_reset_and_init_hw(struct cdns_ti *data) +{ + 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); +} + 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) @@ -146,7 +184,11 @@ 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"); + + cdns_ti_reset_and_init_hw(data); pm_runtime_enable(dev); error = pm_runtime_get_sync(dev); @@ -155,40 +197,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, cdns_ti_auxdata, dev); if (error) { dev_err(dev, "failed to create children: %d\n", error); From patchwork Fri Jul 26 18:17:52 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: 814761 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 64D734963A; Fri, 26 Jul 2024 18:18:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017886; cv=none; b=XrMU38g9dRCUQ9dh6jK5SeIN8er7O/208pFA7znB0NcQQyF/XRV02W9Wbo4gaJduDVHLThFg3Ac6LbBS2lxzU2l4/g6J6xZoUbZimUYD5tbQxs18RA7CHxEAdODuidYc8WiDlqslBH4jSfQRYBCghsrvVB2nRWCfLPFMHCy7ls8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017886; c=relaxed/simple; bh=400w7OVYcBUGnBGxpiXLcM4sNI7cCJW3QPiT2aDKQl0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WKi2BFM39JFk4B7Ylu7FRNT3e4AKnA89ZWAzmnTdCC2zO4JorfL+uQrpkddCpMpcFoW1HmduZjwrkcAAIgClmIswi0y7794zkItjQETSnLmHHiMUUJQMEE7uQS+ixCh5j8mp1kxDiiFjBNkvKCe4NK/nV0kYnXfA3JKwYXiV3jM= 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=Dq/p01nr; arc=none smtp.client-ip=217.70.183.198 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="Dq/p01nr" Received: by mail.gandi.net (Postfix) with ESMTPSA id 74BABC0004; Fri, 26 Jul 2024 18:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1722017877; 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=ygFH1F/pP0x+mZLwLKNqGnH8mKaQf8msoqiAQ1GXuLM=; b=Dq/p01nrtDgkQW5H4QQBTf9w+n/h/3v2cu8ppA4toGNKWA6PMxSmFHBHjYxZ1c4BV7eLAq wAYfNP2to+B3+Ji9oHR9ldUO4IDI08GeP/sbF73EvBc7B/YEIcM2ywKhfNrfdbwCaFvS4f EOv70ZyfWgfmpFxAcM0h4kw7CshQwJKhobFZzLOhaev/ARgU2gGhtJMcv6S+vB6F+fXzj6 NgiDP3CZWSJdE61PA6wScZig5YM175d1w4TaVGveuNeyyCKwsbPqlpAIcfj5mwdt2kFqyw +L6uysXUZgYMzPOgghHIAK4c6DgdC2H69F2P92+8WZgQdFKXzdF5fOeF8yX0Rg== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 26 Jul 2024 20:17:52 +0200 Subject: [PATCH v5 04/12] usb: cdns3-ti: run HW init at resume() if HW was reset Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240726-s2r-cdns-v5-4-8664bfb032ac@bootlin.com> References: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> In-Reply-To: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Mathias Nyman , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , =?utf-8?q?Th=C3=A9o_Lebru?= =?utf-8?q?n?= X-Mailer: b4 0.14.0 X-GND-Sasl: theo.lebrun@bootlin.com At runtime_resume(), read the W1 (Wrapper Register 1) register to detect if an hardware reset occurred. If it did, run the hardware init sequence. This callback will be called at system-wide resume. Previously, if a reset occurred during suspend, we would crash. The wrapper config had not been written, leading to invalid register accesses inside cdns3. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/cdns3-ti.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index 5253829ea1d8..618fba5fa2bb 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -188,6 +188,12 @@ static int cdns_ti_probe(struct platform_device *pdev) data->vbus_divider = device_property_read_bool(dev, "ti,vbus-divider"); data->usb2_only = device_property_read_bool(dev, "ti,usb2-only"); + /* + * The call below to pm_runtime_get_sync() MIGHT reset hardware, if it + * detects it as uninitialised. We want to enforce a reset at probe, + * and so do it manually here. This means the first runtime_resume() + * will be a no-op. + */ cdns_ti_reset_and_init_hw(data); pm_runtime_enable(dev); @@ -232,6 +238,24 @@ static void cdns_ti_remove(struct platform_device *pdev) platform_set_drvdata(pdev, NULL); } +static int cdns_ti_runtime_resume(struct device *dev) +{ + const u32 mask = USBSS_W1_PWRUP_RST | USBSS_W1_MODESTRAP_SEL; + struct cdns_ti *data = dev_get_drvdata(dev); + u32 w1; + + w1 = cdns_ti_readl(data, USBSS_W1); + if ((w1 & mask) != mask) + cdns_ti_reset_and_init_hw(data); + + 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(pm_runtime_force_suspend, pm_runtime_force_resume) +}; + static const struct of_device_id cdns_ti_of_match[] = { { .compatible = "ti,j721e-usb", }, { .compatible = "ti,am64-usb", }, @@ -245,6 +269,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 Jul 26 18:17:53 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: 814760 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 20D0A76025; Fri, 26 Jul 2024 18:18:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017887; cv=none; b=tbhYkCY0jg3HiEpkFYaMjHnPa8BAE+twNm8scjSx5lHra3Fj7wug59/NBL1/WDEhivIGdUhr61uqqf7WxRkz7mxoWESZRRraBpxtmZ7+fvOB//LJx/16iIweogkafwp/I26rSsCxoj+kmjuNeJA7Zwy93dWMbUiCMriraHTUZZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017887; c=relaxed/simple; bh=rYnGXjSRCRrtol49qQV4Bn9yrJ+qw4IRbEIVU55OEr4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AkpZeQr2t5o6RPw39opjnNfGvD91YVmmc9FvfC4lv53RRf5BXrkxUGv1UF+qwEyeOxL9zXS5KacUcPpJ/p0DX6QCMWaiDyRz7CaCXtTtMNCNhArqvN9ca2tBE+wSCZma24BKrtgau4c5PTcZBTI24hJksuMsnTYk9wqZSGZ6wxc= 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=E9JgL+qk; arc=none smtp.client-ip=217.70.183.198 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="E9JgL+qk" Received: by mail.gandi.net (Postfix) with ESMTPSA id 5231DC0007; Fri, 26 Jul 2024 18:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1722017878; 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=Rs1+QAvC+jZKXsMcSqVeWFXio+625byt2ino+7lcNkU=; b=E9JgL+qkpiuGRDvWxLP3R3OdEU1cluDeiFz53pCJFaTMQvq6VwcVygV3CV9xX7fY+8pBJJ jt0vPJY2NChKEYExC/ZDHfO1hATCIrOL+cqgzjqBAU1LCtM7pz0qRGGWWneN7a/05pcdmn VHXXCLN60j/tx/HZaNkb13AwyWynr5mJPDactO7E6qlQ9SG7hsWNDjXZkgAJwUDJlJYV4m HjsjZ6jJyKxt8AyKr7plXHke3C8cLzki8LD9o2HOCxxV8s1c+tI5cVu1P2AgZXB8hpOZAS 5iS/we8p6JG77MQHilKQDo5kAzWdwJHon5O9Pty1UuZrf/w4TsbCIaOdKWUg7Q== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 26 Jul 2024 20:17:53 +0200 Subject: [PATCH v5 05/12] 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: <20240726-s2r-cdns-v5-5-8664bfb032ac@bootlin.com> References: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> In-Reply-To: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Mathias Nyman , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , =?utf-8?q?Th=C3=A9o_Lebru?= =?utf-8?q?n?= X-Mailer: b4 0.14.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 Reviewed-by: Roger Quadros --- 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 57d47348dc19..9207bd6365f7 100644 --- a/drivers/usb/cdns3/core.h +++ b/drivers/usb/cdns3/core.h @@ -45,6 +45,7 @@ struct cdns3_platform_data { unsigned long quirks; #define CDNS3_DEFAULT_PM_RUNTIME_ALLOW BIT(0) #define CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE BIT(1) +#define CDNS3_RESET_ON_RESUME BIT(2) }; /** diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c index ceca4d839dfd..d2cb529630e4 100644 --- a/drivers/usb/cdns3/host.c +++ b/drivers/usb/cdns3/host.c @@ -103,6 +103,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 Jul 26 18:17:54 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: 814872 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 517021494C4; Fri, 26 Jul 2024 18:18:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017888; cv=none; b=rPksxPzbhO/x7ebE8WOZujRqI873oKN8vnuFmThbETVLkYyPsnkvm37OdIJSUuf9A0BuOqDl/FAnlrYdfU/243sCjK85ZA2/3h4vH2T2SS11vQ0oIDRttRR+TciAENZN6FTKB1Wtq7Q/4hUfqp6ZJru/IOzN7T3Lzv3rNtOlb74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017888; c=relaxed/simple; bh=WjEYjyDPZ04uHH112vUG09pL2xgwPjzyI56gEphZaJ8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fBZPcOTi+ZYkI+2cjdEI5WG4xVBX8S7Z4G0S0I72VpqJ5w3rz5Nhnh7C8ywbb7k6M93nSJNu9UvzuxBjvzDhD0F9c6ont6uDEplXBVaNmiQvzjcoGvGG13JFapGTE6hGCg+8j2rPzvVt6C32TG5ZvNsytGi4dRJfaPkW6tJ/Lro= 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=V4plbe+J; arc=none smtp.client-ip=217.70.183.198 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="V4plbe+J" Received: by mail.gandi.net (Postfix) with ESMTPSA id 2DEEDC0008; Fri, 26 Jul 2024 18:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1722017878; 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=UB2yJwdnYb2P4da/POGQoMfTHp7V1lBWEjlzymwP8HU=; b=V4plbe+JHBZ+BcsSSbMU3fD9SNLkG2/Xq0mSl2tN4CoE9T1+Fk2dKc/FeXqPhuq/Gfqg+Z BEbxnR4Yp5WUThk2P4kv8TLW7wQqzZzt5/7AS0URzoSC36hPZw2Pwb/fQ7p9/Dk2Sbe7ON leZ94Xgyf4TmW4TUTz3oCbP8pqEUzSbXP5TS9I3kOq4jqCZfzC72c0rDIcIp01+0uGjuoa rSSpA543jj9t5RR86KhDTafRh4mArEVIrU1fst/yc+vqFCr/UxVL8VM63SicJbDIRmy3yr eQKC3u7loCRRXtMu5uiJ94GuLUm7UNlMIkaQg5HyoxHO6xl/0Lxs6W+ddyj9cg== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 26 Jul 2024 20:17:54 +0200 Subject: [PATCH v5 06/12] usb: cdns3-ti: grab auxdata from match data Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240726-s2r-cdns-v5-6-8664bfb032ac@bootlin.com> References: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> In-Reply-To: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Mathias Nyman , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , =?utf-8?q?Th=C3=A9o_Lebru?= =?utf-8?q?n?= X-Mailer: b4 0.14.0 X-GND-Sasl: theo.lebrun@bootlin.com Current code uses the global `cdns_ti_auxdata` variable as auxiliary data passed to of_platform_populate(). Use match data to store a pointer to auxdata. Current behavior is not changed; it allows future compatibles to provide different auxiliary data. Signed-off-by: Théo Lebrun Reviewed-by: Roger Quadros --- drivers/usb/cdns3/cdns3-ti.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index 618fba5fa2bb..159814dfc856 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -87,18 +87,6 @@ static inline void cdns_ti_writel(struct cdns_ti *data, u32 offset, u32 value) writel(value, data->usbss + offset); } -static struct cdns3_platform_data cdns_ti_pdata = { - .quirks = CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE, /* Errata i2409 */ -}; - -static const struct of_dev_auxdata cdns_ti_auxdata[] = { - { - .compatible = "cdns,usb3", - .platform_data = &cdns_ti_pdata, - }, - {}, -}; - static void cdns_ti_reset_and_init_hw(struct cdns_ti *data) { u32 reg; @@ -142,6 +130,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; struct cdns_ti *data; unsigned long rate; int error, i; @@ -203,7 +192,8 @@ static int cdns_ti_probe(struct platform_device *pdev) goto err; } - error = of_platform_populate(node, NULL, cdns_ti_auxdata, dev); + auxdata = device_get_match_data(dev); + error = of_platform_populate(node, NULL, auxdata, dev); if (error) { dev_err(dev, "failed to create children: %d\n", error); goto err; @@ -256,9 +246,21 @@ static const struct dev_pm_ops cdns_ti_pm_ops = { SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) }; +static struct cdns3_platform_data cdns_ti_pdata = { + .quirks = CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE, /* Errata i2409 */ +}; + +static const struct of_dev_auxdata cdns_ti_auxdata[] = { + { + .compatible = "cdns,usb3", + .platform_data = &cdns_ti_pdata, + }, + {}, +}; + static const struct of_device_id cdns_ti_of_match[] = { - { .compatible = "ti,j721e-usb", }, - { .compatible = "ti,am64-usb", }, + { .compatible = "ti,j721e-usb", .data = cdns_ti_auxdata }, + { .compatible = "ti,am64-usb", .data = cdns_ti_auxdata }, {}, }; MODULE_DEVICE_TABLE(of, cdns_ti_of_match); From patchwork Fri Jul 26 18:17:55 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: 814878 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 4C56338385; Fri, 26 Jul 2024 18:18:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017883; cv=none; b=fiQ/LmxxXupe9pA2rCMwwkuUBYOtRm4IH1Y6B86nDz0QYxzdfYlXmZ7qdwWYJ14kj514mQtV+24rwiXWie9LxJ9nfQzWWnlUq9eNCmZ3MqV2qm4PPFSEkfdXCGVHsXpbP/kPpxOX7hiccfls9fmgyp15/BbU9VDFlLiOGs1aLy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017883; c=relaxed/simple; bh=cFFBq9xftAOJ8+raON3AZMUJgV5YQctWnS/lEPft84E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=U+dEkFGlIOOOGyOPUt2hQ+7pcAMLhATgEbsXlXic7dBipaCauTCaQB9fga7dZw92lhKjLzUO2wsgxG2kIQvTWfTNnNN1Q4PoUpzEZ3jmvAlpdV1q1g1Wum+1t2NhDHH+tExXolmNTpvZFGFu91h+VDQbsbSFyhuDS9Yx7LrSK4Q= 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=m01kwFZH; arc=none smtp.client-ip=217.70.183.198 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="m01kwFZH" Received: by mail.gandi.net (Postfix) with ESMTPSA id 0577FC000A; Fri, 26 Jul 2024 18:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1722017879; 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=3Eayj+ntAEk18/DRsjd8aPm4OTkARNCkPfWA6i3HBMw=; b=m01kwFZH8OlhF1iaJg8FIvKh749lS2UavKUm42AMknQ0S5TwCAd+CbX2PovnmjtTekR6rM P8lLwHZHsX3zYZHBaKfZ9D3+S/kZ6Z+5Y47CKc5NJh7qgfXPKKuiwIo6bobXfXjkZX5TBC rCSsuVtQ/Mgu6fS0Sf2Z4YfsGWDq/hCpi1rh3JC7DZ9H10Kjm2N/EnnFJLPmz1v9gwNWtl C+GC3hlpt8W4kRXDUTBWFuVg7r0zf8gNUOjvaR0Wm7PGa4SGeMGoIZtPv1dFyRXUpBohL6 kH2eE37QGFs+X8gBTsSxIYT0gDGo2vkPj2a8yGrCguftORJEDoVbg7b3iRnoIg== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 26 Jul 2024 20:17:55 +0200 Subject: [PATCH v5 07/12] 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: <20240726-s2r-cdns-v5-7-8664bfb032ac@bootlin.com> References: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> In-Reply-To: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Mathias Nyman , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , =?utf-8?q?Th=C3=A9o_Lebru?= =?utf-8?q?n?= X-Mailer: b4 0.14.0 X-GND-Sasl: theo.lebrun@bootlin.com Add ti,j7200-usb compatible. Match data indicates the controller resets on resume which tells that to the cdns3 core. This in turn silences a xHCI warning visible in cases of unexpected resets. We also inherit the errata quirk CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE from the default `cdns_ti_auxdata` configuration. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/cdns3-ti.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index 159814dfc856..65b8b6f4c654 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -258,7 +258,21 @@ static const struct of_dev_auxdata cdns_ti_auxdata[] = { {}, }; +static struct cdns3_platform_data cdns_ti_j7200_pdata = { + .quirks = CDNS3_RESET_ON_RESUME | + CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE, /* Errata i2409 */ +}; + +static const struct of_dev_auxdata cdns_ti_j7200_auxdata[] = { + { + .compatible = "cdns,usb3", + .platform_data = &cdns_ti_j7200_pdata, + }, + {}, +}; + static const struct of_device_id cdns_ti_of_match[] = { + { .compatible = "ti,j7200-usb", .data = cdns_ti_j7200_auxdata }, { .compatible = "ti,j721e-usb", .data = cdns_ti_auxdata }, { .compatible = "ti,am64-usb", .data = cdns_ti_auxdata }, {}, From patchwork Fri Jul 26 18:17:56 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: 814763 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 0A47038DEE; Fri, 26 Jul 2024 18:18:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017884; cv=none; b=WE39/zfBNPz/kmgK7s8BBmVOhK4VyyNVEwVpTPQ5MbiT7Xe7UCj1UMq0qFoLphT570d7pxWLFXmEAwg3sph2Mm/o6IBi/3bAVjqKA9femV4/s7btxs1LJL2FIC1hg/Hu5HwMa0lnQgD3SjJFkrWm4/N5IhM/V/DBsvdT07vqqBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017884; c=relaxed/simple; bh=Pyq5KT99mvHZELjIb9ex4V6SAyN0u6Ln0t+wD17lvWc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HOSgSzD08ZvwP1ggUO5dcnRiHKkyBrDZIuUOs4eC3NDagSD+xZNco4uO1u+z6Bp5nGzJY+hQjy30F2HUBA4YCivvJH8td9to+5qppeufbv4UGwIP9Vh4GlcLTzbWxs0vb5XTRUzl5jC9PhQYLoL0hM5M1lH5SKqK3GCDRDvrxl4= 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=RzgIV18g; arc=none smtp.client-ip=217.70.183.198 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="RzgIV18g" Received: by mail.gandi.net (Postfix) with ESMTPSA id CB411C000B; Fri, 26 Jul 2024 18:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1722017880; 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=L8BqOp+imFT7RCmJiTvOqUvgDym7zUG3PG+O/IVmdxE=; b=RzgIV18gLAeLOEqwiANRhZCopxKO9YmyJJyevs1sTSbgS55Q9aGhSlG/hMCEWGAJQB6fh+ 8p8e4/6fSJIKHac24zvNF1heB4MCuYeMm3/UbQpNjAGA4V72LfW93xPIQK7vSEWWJ7+PKN c8y8NtXMJMbbKpDEP0vvn+GQtOTQ03iiqkL3pa6/GSrzTeC4E8Fo8YUV4UqUksKzgVbO1f dx9KPVKGjgQiHKsZ8W6+o7s9C6rwc7S+y6vU5ioTlRIus6tMTRGpcgdKXoTwEguxc77o69 4CWjV56xDYBKTT+9q+qWSY84yV2IyASebwOuuhyED7308sGHT2iIV/K8q5Hqug== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 26 Jul 2024 20:17:56 +0200 Subject: [PATCH v5 08/12] usb: cdns3: rename hibernated argument of role->resume() to lost_power Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240726-s2r-cdns-v5-8-8664bfb032ac@bootlin.com> References: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> In-Reply-To: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Mathias Nyman , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , =?utf-8?q?Th=C3=A9o_Lebru?= =?utf-8?q?n?= X-Mailer: b4 0.14.0 X-GND-Sasl: theo.lebrun@bootlin.com The cdns_role_driver->resume() callback takes a second boolean argument named `hibernated` in its implementations. This is mistaken; the only potential caller is: int cdns_resume(struct cdns *cdns) { /* ... */ if (cdns->roles[cdns->role]->resume) cdns->roles[cdns->role]->resume(cdns, cdns_power_is_lost(cdns)); return 0; } The argument can be true in cases outside of return from hibernation. Reflect the true meaning by renaming both arguments to `lost_power`. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/cdns3-gadget.c | 4 ++-- drivers/usb/cdns3/cdnsp-gadget.c | 2 +- drivers/usb/cdns3/core.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c index fd1beb10bba7..694aa1457739 100644 --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -3468,7 +3468,7 @@ __must_hold(&cdns->lock) return 0; } -static int cdns3_gadget_resume(struct cdns *cdns, bool hibernated) +static int cdns3_gadget_resume(struct cdns *cdns, bool lost_power) { struct cdns3_device *priv_dev = cdns->gadget_dev; @@ -3476,7 +3476,7 @@ static int cdns3_gadget_resume(struct cdns *cdns, bool hibernated) return 0; cdns3_gadget_config(priv_dev); - if (hibernated) + if (lost_power) writel(USB_CONF_DEVEN, &priv_dev->regs->usb_conf); return 0; diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c index 4a3f0f958256..7d05180442fb 100644 --- a/drivers/usb/cdns3/cdnsp-gadget.c +++ b/drivers/usb/cdns3/cdnsp-gadget.c @@ -1973,7 +1973,7 @@ static int cdnsp_gadget_suspend(struct cdns *cdns, bool do_wakeup) return 0; } -static int cdnsp_gadget_resume(struct cdns *cdns, bool hibernated) +static int cdnsp_gadget_resume(struct cdns *cdns, bool lost_power) { struct cdnsp_device *pdev = cdns->gadget_dev; enum usb_device_speed max_speed; diff --git a/drivers/usb/cdns3/core.h b/drivers/usb/cdns3/core.h index 9207bd6365f7..f385d3980545 100644 --- a/drivers/usb/cdns3/core.h +++ b/drivers/usb/cdns3/core.h @@ -30,7 +30,7 @@ struct cdns_role_driver { int (*start)(struct cdns *cdns); void (*stop)(struct cdns *cdns); int (*suspend)(struct cdns *cdns, bool do_wakeup); - int (*resume)(struct cdns *cdns, bool hibernated); + int (*resume)(struct cdns *cdns, bool lost_power); const char *name; #define CDNS_ROLE_STATE_INACTIVE 0 #define CDNS_ROLE_STATE_ACTIVE 1 From patchwork Fri Jul 26 18:17:57 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: 814876 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 D7C763BBC0; Fri, 26 Jul 2024 18:18:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017885; cv=none; b=I9iVKhLX3jogwmyLpC1LEQRfBetDGlE93/z19u3s7io/cFMkYxkaA4A+XEMtZhVAjKMBiRb5nYIaglfZGIZhdqD9vNMFIjo0Wc1qmRR4en/HQtOEcdWpe4DTgW1wyyLdJJNRzqf4GFYbVhEcAO+KPz2qL1HLFS3s0Tl6cNkOxfQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017885; c=relaxed/simple; bh=L9WuGK3/+JBnFAYDNw+LiekWRfrj2s7kyJZfovAMN50=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e0J5uBQLjptXmG3f2RvslB4IbQJi+FFqF/9jnCZAnGYxtGSQiay6pUkIHatz1gCwufr3W3HnXdzb8D6Lz9FTK14xwrB6NR/Fy4MK/9shjOjkA5kbbeUvVGeHvuRhJwn9keZr3GEjcXrtUgK4OIKoeHRcexNT5+zLpSjrXoqqz4g= 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=YISZNTAS; arc=none smtp.client-ip=217.70.183.198 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="YISZNTAS" Received: by mail.gandi.net (Postfix) with ESMTPSA id 95BDCC0009; Fri, 26 Jul 2024 18:18:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1722017881; 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=wZYia7FGurB9of6IzHnVjgaTJVQiLrxPMBa0JK9qcOU=; b=YISZNTASZcu9lL4M+MHFMKTHcQtXdc/AEFh0XrKSLydZP3UUmXSCJOMXkGLnVzUf2h4hhR cRTZwaTCyGUiUPTanbVXyq4AS4ucXZblnM4ZfludQbknbf0L51ZwxGz4T59bNwMbO2/6lI jWsnuAtyyuvG9uIdMk/trfGZWv68HiwENG7boPnhQnpVQ/Sn32GnyA4g9JTOTknZr2/tOp 1JCF6C4aLPetxME1h5Bni6uWpgmVUUVZMybB8LsFex272FPRGBQtQHNKZKFEzvPwiwUrZ+ 1Ssg8B1gwrH4UbjZ9WLnLdGX+TOzw07OXu3ok1zShDm2WaFurfCq3CqaYQECKA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 26 Jul 2024 20:17:57 +0200 Subject: [PATCH v5 09/12] xhci: introduce xhci->lost_power flag Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240726-s2r-cdns-v5-9-8664bfb032ac@bootlin.com> References: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> In-Reply-To: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Mathias Nyman , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , =?utf-8?q?Th=C3=A9o_Lebru?= =?utf-8?q?n?= X-Mailer: b4 0.14.0 X-GND-Sasl: theo.lebrun@bootlin.com The XHCI_RESET_ON_RESUME quirk allows wrappers to signal that they expect a reset after resume. It is also used by some to enforce a XHCI reset on resume (see needs-reset-on-resume DT prop). Some wrappers are unsure beforehands if they will reset. Add a mechanism to signal *at resume* if power has been lost. Parent devices can set this flag, that defaults to the XHCI_RESET_ON_RESUME value. The XHCI_RESET_ON_RESUME quirk still triggers a runtime_pm_get() on the controller. This is required as we do not know if a suspend will trigger a reset, so the best guess is to avoid runtime PM. Reset the xhci->lost_power value each time in xhci_resume(), making it safe for devices to only set lost_power on some resumes. Signed-off-by: Théo Lebrun --- drivers/usb/host/xhci.c | 8 +++++++- drivers/usb/host/xhci.h | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 0a8cf6c17f82..2c9b32d339f9 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1029,9 +1029,12 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg) spin_lock_irq(&xhci->lock); - if (hibernated || xhci->quirks & XHCI_RESET_ON_RESUME || xhci->broken_suspend) + if (hibernated || xhci->lost_power || xhci->broken_suspend) reinit_xhc = true; + /* Reset to default value, parent devices might correct it at next resume. */ + xhci->lost_power = !!(xhci->quirks & XHCI_RESET_ON_RESUME); + if (!reinit_xhc) { /* * Some controllers might lose power during suspend, so wait @@ -5228,6 +5231,9 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) if (get_quirks) get_quirks(dev, xhci); + /* Default value, that can be corrected at resume. */ + xhci->lost_power = !!(xhci->quirks & XHCI_RESET_ON_RESUME); + /* In xhci controllers which follow xhci 1.0 spec gives a spurious * success event after a short transfer. This quirk will ignore such * spurious event. diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index ebd0afd59a60..ec7c6061363f 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1640,6 +1640,12 @@ struct xhci_hcd { unsigned broken_suspend:1; /* Indicates that omitting hcd is supported if root hub has no ports */ unsigned allow_single_roothub:1; + /* + * Signal from upper stacks that we lost power during system-wide + * suspend. Its default value is based on XHCI_RESET_ON_RESUME, meaning + * it is safe for wrappers to not modify lost_power at resume. + */ + unsigned lost_power:1; /* cached extended protocol port capabilities */ struct xhci_port_cap *port_caps; unsigned int num_port_caps; From patchwork Fri Jul 26 18:17:58 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: 814874 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 20CCD73514; Fri, 26 Jul 2024 18:18:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017887; cv=none; b=X+9fiaKr65qWVNAfI2T8mTYhmpLEqY4I85mbhiDSrev9OEbfm5V7c+YXiERcREvTWxR8tSfnM0K8INcGx3licpqzqWcB9BXxDtaaTfXIRQBVr+FFuPhiPtO+5fPYezzi1BnK9H7rzCY9Be3s7/JkFMa8Nz3lp59Ql7OXQUS2HQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017887; c=relaxed/simple; bh=6Daa08I6itJcAFS9/xCN/oDOprQU3OGIjFNs0OxlHgY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fw5iO1p5DArGrCSHHrEnN2nkQRBv0o7B6ikX666KBLo0ytirpsKOzW27zJUn5wN4hv3jxjeSM+GIBkKUvMmavNHELbq3yUi4qSea6p/x4XYbHWztwgQn01b2nU70u53ZIkKRnGDQJiOI9Sgmni3c5ct8SXqzXnnobQl7Q8RI8eo= 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=Ls+AnFBC; arc=none smtp.client-ip=217.70.183.198 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="Ls+AnFBC" Received: by mail.gandi.net (Postfix) with ESMTPSA id 6C3A2C000C; Fri, 26 Jul 2024 18:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1722017882; 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=nVKDcHNw5TaBkw7ykMrWc0qPl//SaW0x/mq86RauHgc=; b=Ls+AnFBCzBN0HwcYy9zP6koWjLz/YO08/2MPGZeHVW+/8c9SdnUo4Yr1yXevYIIdA+JYoE lro7oeDBX4Wh3+5DHbesFtvd4e24dVubijUvREJ9hj/WeNhdwbSukzJCWQd9SF1IXydDjb 4XY+vNTR/4UuTlxtrqISnuDNvRt8QXq85DVzfPnH8QcbGXKUAL8QF0OmFq3XkLt73mL/Ct mKBON+s+4BjiAgo4yKjZElTfJZcLFX6qK1ri4g3lMYeXEE3q99Y0xISPQctKBdMSmG2xpN 29eEr7sHUel6nlcKiS9YtvkEC6nhbD2R/03GTtaxA79IFS8RY7lQO4+2NFPy2g== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 26 Jul 2024 20:17:58 +0200 Subject: [PATCH v5 10/12] usb: cdns3: host: transmit lost_power signal from wrapper to XHCI Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240726-s2r-cdns-v5-10-8664bfb032ac@bootlin.com> References: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> In-Reply-To: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Mathias Nyman , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , =?utf-8?q?Th=C3=A9o_Lebru?= =?utf-8?q?n?= X-Mailer: b4 0.14.0 X-GND-Sasl: theo.lebrun@bootlin.com cdns_role_driver->resume() receives the information if power was lost across suspend (ie if a reset occurred). Transmit that to the XHCI core using the newly introduced lost_power flag. We therefore override its default value that is based on XHCI_RESET_ON_RESUME. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/host.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c index d2cb529630e4..edef39ab8d15 100644 --- a/drivers/usb/cdns3/host.c +++ b/drivers/usb/cdns3/host.c @@ -139,6 +139,15 @@ static void cdns_host_exit(struct cdns *cdns) cdns_drd_host_off(cdns); } +static int cdns_host_resume(struct cdns *cdns, bool lost_power) +{ + struct usb_hcd *hcd = platform_get_drvdata(cdns->host_dev); + struct xhci_hcd *xhci = hcd_to_xhci(hcd); + + xhci->lost_power = lost_power; + return 0; +} + int cdns_host_init(struct cdns *cdns) { struct cdns_role_driver *rdrv; @@ -149,6 +158,7 @@ int cdns_host_init(struct cdns *cdns) rdrv->start = __cdns_host_init; rdrv->stop = cdns_host_exit; + rdrv->resume = cdns_host_resume; rdrv->state = CDNS_ROLE_STATE_INACTIVE; rdrv->name = "host"; From patchwork Fri Jul 26 18:17:59 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: 814759 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 20C667347D; Fri, 26 Jul 2024 18:18:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017888; cv=none; b=Kh5z4IkcHyoknRacLuDnlGKQi5pOJ5D2XjhoHEwIPdwZGTj4KbcUdupIXqEqjoHAGvPMYdSqVUxxBxfKAEO5paVafmdnN/HPfkxrQXh2akfmwhTYNwV1V3zyaBXEFJpC5IxvoYaR5aPXLcVCke5wIY5WSbb9WwtLsBBPFZ1xCQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017888; c=relaxed/simple; bh=95rG1YZ2UtrC8XMcpAiWyTjy7YQj9bjkJ0w9oWd8hII=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cEoZmYfJlASzWpKwzeB/l1yllSEo5cGwIOmqVih2ITIR1yOzgYpPKH2v5l6xC3jnzbyTyE/HtsVryKmj4D2mlq4kcB0DIicMDe8SiPkrKGIlmlEccqxBDfLuwsNfVR5WhKrYX7AFr+lLAQ8semeYDl3zd+gUpWrsqWteIb+Oa7k= 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=kfbw/Q+Q; arc=none smtp.client-ip=217.70.183.198 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="kfbw/Q+Q" Received: by mail.gandi.net (Postfix) with ESMTPSA id 43B4CC000E; Fri, 26 Jul 2024 18:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1722017883; 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=ih+kvx1EySeuO8rTTlNvuYdd21gOB8JWUrmwahT1dOc=; b=kfbw/Q+QBan9UTaP6HuJ77llt2vFWlvZpOKS3Av1JequqWPDFAHbb2QOk8eZazcs4Hv+03 R4xPpHj6knTcAUImEbRK6i8YNuqymlar61qVlryTH+DMasExG35Zv2WALwLZnqUzbxwP++ OJKRhGH4Mvr3lvIBxyhpglPe13jxK/Rvirs4rviwk2iVoiZNfwa/AR8py6n4kL5tpuc2Hs R608HRMzfXRiNujGDZbh4k3UaUQTAkcHdtU1g73dVG/YVFLb/eNt/XuC4Yb6S8Uv0sTX5t R7QThnoWYn/qXLSF2/kUexkcCiSmmywqI3Pb+BYTGJOnwbodqZqtBVN19urgZw== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 26 Jul 2024 20:17:59 +0200 Subject: [PATCH v5 11/12] 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: <20240726-s2r-cdns-v5-11-8664bfb032ac@bootlin.com> References: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> In-Reply-To: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Mathias Nyman , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , =?utf-8?q?Th=C3=A9o_Lebru?= =?utf-8?q?n?= X-Mailer: b4 0.14.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 Reviewed-by: Roger Quadros --- 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 9386bf3ef9f6..6b8e8672b386 100644 --- a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi @@ -766,7 +766,7 @@ pcie1_rc: pcie@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 Fri Jul 26 18:18:00 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: 814873 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 5E7751E493; Fri, 26 Jul 2024 18:18:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017887; cv=none; b=aXXlg8s3YuqTBRVHaLOMiziJP6E5aAHFcSTnkm4B7oZCbZJZ8DRRF4n8Pj9tfQ/93smgoCgdsOvfjcLiB7fyEpu+zVOgu1Xc4Z6SoZ+0y8iA0+ityrft8roY73fSdCU3tHce2dpmz8bo/013qPVI723EsZV6dNv78wq8yQ/MVfQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722017887; c=relaxed/simple; bh=ahpHSbsY5snByWpT+psWqdNXneHz5eR2UhTXSOpSJuo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WrTwSsQiw4djyqoXwD5XFQrbeLB4j+njwfLRHXEJLLG45asIt64Q97fUWqwocvBX90JOrGnJKe9FcR2PY8Q/ZOluoBTkSX7XIFy2L1WadZB1TkoXZPry/4a3AMHKMynaHbtvCnUmjkWy83JddcnWAyzqBuAdyNbZsvCNP8eruOQ= 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=A5/P1Rgq; arc=none smtp.client-ip=217.70.183.198 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="A5/P1Rgq" Received: by mail.gandi.net (Postfix) with ESMTPSA id 1148BC0011; Fri, 26 Jul 2024 18:18:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1722017883; 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=nzzwZRIMf3Tzxd7N00x3LQAknBs3IrccO6DEWuel4oQ=; b=A5/P1RgqlIFjF5ttDIOfjWKIeVVj56YVzB3p0s8T2Il7RtaZRahYcaiLSXMpgmmAhPAvLD ip7/SUDvfi30x5DYnHTyAtxyq+wu9Y+a4XlTiCVwrbqegCSy/TrUp5AcM0KIyJ/BcVIZuw ndNENrH4uTdyp0HPps44ihMR6udGO01j/2yzFI8+F3ir+NWplXrlfr4AVwPQqc86b7pupI COXVA5z8Wzy3yOmsns9q2fKRxz2PXIuPmCUqLqWv1OR56LyGuOm0rlFT7jo4RiMR/pon9L Hr6Tq92iXBSQirjgIm3lHBq3wrt3/G2+w1uu748soK3HONgIEcJDrNtd2/c0KA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 26 Jul 2024 20:18:00 +0200 Subject: [PATCH v5 12/12] 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: <20240726-s2r-cdns-v5-12-8664bfb032ac@bootlin.com> References: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> In-Reply-To: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Mathias Nyman , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , =?utf-8?q?Th=C3=A9o_Lebru?= =?utf-8?q?n?= X-Mailer: b4 0.14.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 Reviewed-by: Roger Quadros --- 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 f8370dd03350..02c8ed93730f 100644 --- a/arch/arm64/boot/dts/ti/k3-am64-main.dtsi +++ b/arch/arm64/boot/dts/ti/k3-am64-main.dtsi @@ -759,7 +759,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>;