From patchwork Fri Feb 23 16:05:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 775724 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 9CFB383CC4; Fri, 23 Feb 2024 16:05:33 +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=1708704335; cv=none; b=DIEqvT/4R2Aegv1wemiIL578vKlAHo4/NwvJ4wrEIK4Tp/zWq0VU+zqYp4rd/DwyXbQ1VIGjeC4d18a2qBpm16FbIvFK78zxznCOmzuWlZKCPddO+wfmQxfRA4C3/WLpehgIesK4KaD/cp9nrg63IZH0pBPL+Mo7H7YrkB7na0E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704335; c=relaxed/simple; bh=ceuENLTMAkBaDWsdWKmub/JNtRRYyaA6Cy/uv9r7MNw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QRQuyUWKw57w/fHtKm4vsfw2Mm7smkw8/f8OF5rtlFgoHUK3gQENa2LaLQzPAVw4rVs9h0Wgsjnkz1CgOLL+f+4IC9umFw/GkNXDWVRVkd7pWyUC2oFMbbn6yQfzSxO6jONW67sA8EfpSeNEoTj4df5vhsTqbk0ToszDuxdDQD0= 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=Nn7zMY6H; 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="Nn7zMY6H" Received: by mail.gandi.net (Postfix) with ESMTPSA id 5BC811C0003; Fri, 23 Feb 2024 16:05:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FtY8B6yYjBR+Rfp7/Ypf4+btFZdyTE+hN6hS7cZZSmw=; b=Nn7zMY6HzfNBbGDyTqI/ZEqzRvwjboOPEXmoAo9vCHxj/v+INYHF3WUXiAR6ycghf5kQdm 2CMgMRfM5iCBR6jlPc6/eev5Nj45vlyMMh/EyeQJwxLeLAtv9T70F560iI3lpoS561C1tU Z6SUDkbLU2EYYQ4KNHViU+ofzUxv5YBjdtpLgn6mZHbDgnHbPc/8D/RGsm/Q661bVc+ecn O1/QGmn+PtpoDJRY/NXOvgVE05013sskrUA32AnQriQcDnrcKd8oXgd8Bosc9+4qy7sHMy +bjgWlnGoW9lXp0/Uv8MJcr2zg1ua0g79GRZh1OCaqiQ4IdCJgvoJ/PAxRaGCQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:25 +0100 Subject: [PATCH v3 1/8] dt-bindings: usb: ti,j721e-usb: drop useless compatible list Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-1-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com Compatible can be A or B, not A or B or A+B. Remove last option. A=ti,j721e-usb and B=ti,am64-usb. Signed-off-by: Théo Lebrun --- Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml index 95ff9791baea..949f45eb45c2 100644 --- a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml +++ b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml @@ -11,12 +11,9 @@ maintainers: properties: compatible: - oneOf: - - const: ti,j721e-usb - - const: ti,am64-usb - - items: - - const: ti,j721e-usb - - const: ti,am64-usb + enum: + - ti,j721e-usb + - ti,am64-usb reg: maxItems: 1 From patchwork Fri Feb 23 16:05:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 775723 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 99E9682C94; Fri, 23 Feb 2024 16:05:34 +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=1708704336; cv=none; b=ONGMgD+XTp3ADHtO7yXT/88yI9nO9QxefiBxjs9N81DrL8Y0QfuXjIe9RM+v7S+UlCxRdbN57M2up3mlzO+xf/Vr9egRRoR0r+hP1pd7K/gXqhHOfVwNP5thW81477M4HOdY4nit3jezNQ9lIRze6ZWZssJ7WeVn3+q3dsyzuhY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704336; c=relaxed/simple; bh=vE5VgPP6Zm7bCL/kEb3+VHnXXFs1xbBqGLEwnPNNXLg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=twqZhVvHbjnJio6zCxIcRVL5ipbR7nUv4sNZrXllJsauPCTWrnHjKcsQgJFZeLVgO6UfcupcIUt9OynLSmAXUtbXHNvLI8/E/0RBC+JmHVz/A4OBmLc0Dr/GrdntS/4ZGIaa1O1h8uEafr5aoxaIepNBhk/sq2QWBvU8A1yH3w4= 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=kF1uRtGJ; 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="kF1uRtGJ" Received: by mail.gandi.net (Postfix) with ESMTPSA id 1EBC81C0004; Fri, 23 Feb 2024 16:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rbIZMwtxQIO+hXns/iDo1uxK2FfPOqD7m7muGpA+4qM=; b=kF1uRtGJZjdQLHjQC+iq+zv9FIHFE8XcIXdKRpKFrlQAVWPUH6P4uS9KFI/gC9OtnqNoZO JW58FYyVdiQ3FGxNCvMHqukattXpUCx16iLkt6Hdbo1dFFPhNrt5AR8FbFpXHVMj9QKIZc V6FQCLsXDLjnhRX57QT5xGbP2hxZ6eyI5F/V4winePg/yPVYA/gBrc17r1VOUxgUZyljiz bRVU0mdHdioz/UcIVyYY3NLgtTN+GvOOB/g05X7fH5i4qC3GvD82ECOWJw3jql0pBRGSBv ryS6xX+gKGAMTz92bT3JjqOxUGsiBK60PIV5+F2wO1PrN1oAJF1qPmm9nb4zWA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:26 +0100 Subject: [PATCH v3 2/8] dt-bindings: usb: ti,j721e-usb: add ti,j7200-usb compatible Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-2-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com On J7200, the controller & its wrapper are reset on resume. This makes it have a different behavior from other platforms. Signed-off-by: Théo Lebrun --- Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml index 949f45eb45c2..d52d5b2965aa 100644 --- a/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml +++ b/Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml @@ -14,6 +14,7 @@ properties: enum: - ti,j721e-usb - ti,am64-usb + - ti,j7200-usb reg: maxItems: 1 From patchwork Fri Feb 23 16:05:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 775478 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 463F74C79; Fri, 23 Feb 2024 16:05:34 +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=1708704337; cv=none; b=C335d7Ev1ArUFWRnSNNFW8b4E3NaJzhRl75tWydI891F+uJcxRBOqx3vESrJ4Uyg4aScPA7TIviKM1nzEznkQopxDAKSX/MgjI3dtLWs3p4zPI0nS3sJNa0eVnpIHkC5duOTPRcEFh/K66X1o0jK3ZI6xt0r9+Arq+ny9WRtQ9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704337; c=relaxed/simple; bh=cgrG/lkmnv622fu4VKM2CWXUoXsPzdZfZxvEzXF3BbM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=erXKkLo73H05VgFZl8gNXChGfrjzfjM5WgL3x435kbaqEQhGhLPtTV2Iu6muo7jTmt0J54t3GDuBaaku98Mq47M3tZ+lfJhX03U2i47C9c5tHQUp/SJTq6EDoYOOHjc1oX77ic0vsJKQ1hgKhK6PXOSgQ/nIsphlTNc/WLLXIYo= 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=drQue52u; 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="drQue52u" Received: by mail.gandi.net (Postfix) with ESMTPSA id E90951C0006; Fri, 23 Feb 2024 16:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G36dyCsQS4BXpbV31b880qblN6dPbFme1l75T2Hw+Zk=; b=drQue52ulO+fuP1tUE11b21wt5CykxH2xQBy3/wI1NsvFmYUQsP5Pu8sX79JledvSmebZE INzRYr5fgMHge+zoW8S4PgVmcH/BK5jStiwnqU2h4dgG7stSNXTKqXyRwZY235LZMEORpr QwrmGtm58EW/INkHY3YgIaENj0HK/2rBkVtIzSTjttXK6sLL1Q6aZoFA8Sr9apEsrAb4Cm oRP04uQwJ6E84JcxjUEF4w6Q7WnxQqpwRwMMFkz0DeMqAAqYWSQu2w5PnNllgIREKIFBoK W/e1ctnjlUMERh85pezeu9GBN+k83wVPTb+AUMLl7OWqYOc0ef/0EP4GOaI23Q== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:27 +0100 Subject: [PATCH v3 3/8] usb: cdns3-ti: move reg writes from probe into ->runtime_resume() Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-3-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com The hardware initialisation register write sequence is only used at probe. Move it from being done at explicitely at probe to being done implicitely by pm_runtime_get_sync() that calls ->runtime_resume(). Keep devicetree parsing in probe and add a new field in the private struct to remember the USB2 refclk rate code computation result. This opens the door to having the init sequence being executed later down the road, at system-wide resume for example. This is NOT currently happening because runtime PM is disabled at suspend without the refcount being affected. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/cdns3-ti.c | 90 +++++++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 38 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index 5945c4b1e11f..4c8a557e6a6f 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -57,6 +57,7 @@ struct cdns_ti { unsigned vbus_divider:1; struct clk *usb2_refclk; struct clk *lpm_clk; + int usb2_refclk_rate_code; }; static const int cdns_ti_rate_table[] = { /* in KHZ */ @@ -90,10 +91,8 @@ static int cdns_ti_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *node = pdev->dev.of_node; struct cdns_ti *data; - int error; - u32 reg; - int rate_code, i; unsigned long rate; + int error, i; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) @@ -133,7 +132,9 @@ static int cdns_ti_probe(struct platform_device *pdev) return -EINVAL; } - rate_code = i; + data->usb2_refclk_rate_code = i; + data->vbus_divider = device_property_read_bool(dev, "ti,vbus-divider"); + data->usb2_only = device_property_read_bool(dev, "ti,usb2-only"); pm_runtime_enable(dev); error = pm_runtime_get_sync(dev); @@ -142,40 +143,6 @@ static int cdns_ti_probe(struct platform_device *pdev) goto err; } - /* assert RESET */ - reg = cdns_ti_readl(data, USBSS_W1); - reg &= ~USBSS_W1_PWRUP_RST; - cdns_ti_writel(data, USBSS_W1, reg); - - /* set static config */ - reg = cdns_ti_readl(data, USBSS_STATIC_CONFIG); - reg &= ~USBSS1_STATIC_PLL_REF_SEL_MASK; - reg |= rate_code << USBSS1_STATIC_PLL_REF_SEL_SHIFT; - - reg &= ~USBSS1_STATIC_VBUS_SEL_MASK; - data->vbus_divider = device_property_read_bool(dev, "ti,vbus-divider"); - if (data->vbus_divider) - reg |= 1 << USBSS1_STATIC_VBUS_SEL_SHIFT; - - cdns_ti_writel(data, USBSS_STATIC_CONFIG, reg); - reg = cdns_ti_readl(data, USBSS_STATIC_CONFIG); - - /* set USB2_ONLY mode if requested */ - reg = cdns_ti_readl(data, USBSS_W1); - data->usb2_only = device_property_read_bool(dev, "ti,usb2-only"); - if (data->usb2_only) - reg |= USBSS_W1_USB2_ONLY; - - /* set default modestrap */ - reg |= USBSS_W1_MODESTRAP_SEL; - reg &= ~USBSS_W1_MODESTRAP_MASK; - reg |= USBSS_MODESTRAP_MODE_NONE << USBSS_W1_MODESTRAP_SHIFT; - cdns_ti_writel(data, USBSS_W1, reg); - - /* de-assert RESET */ - reg |= USBSS_W1_PWRUP_RST; - cdns_ti_writel(data, USBSS_W1, reg); - error = of_platform_populate(node, NULL, NULL, dev); if (error) { dev_err(dev, "failed to create children: %d\n", error); @@ -211,6 +178,52 @@ static void cdns_ti_remove(struct platform_device *pdev) platform_set_drvdata(pdev, NULL); } +static int cdns_ti_runtime_resume(struct device *dev) +{ + struct cdns_ti *data = dev_get_drvdata(dev); + u32 reg; + + /* assert RESET */ + reg = cdns_ti_readl(data, USBSS_W1); + reg &= ~USBSS_W1_PWRUP_RST; + cdns_ti_writel(data, USBSS_W1, reg); + + /* set static config */ + reg = cdns_ti_readl(data, USBSS_STATIC_CONFIG); + reg &= ~USBSS1_STATIC_PLL_REF_SEL_MASK; + reg |= data->usb2_refclk_rate_code << USBSS1_STATIC_PLL_REF_SEL_SHIFT; + + reg &= ~USBSS1_STATIC_VBUS_SEL_MASK; + + if (data->vbus_divider) + reg |= 1 << USBSS1_STATIC_VBUS_SEL_SHIFT; + + cdns_ti_writel(data, USBSS_STATIC_CONFIG, reg); + reg = cdns_ti_readl(data, USBSS_STATIC_CONFIG); + + /* set USB2_ONLY mode if requested */ + reg = cdns_ti_readl(data, USBSS_W1); + + if (data->usb2_only) + reg |= USBSS_W1_USB2_ONLY; + + /* set default modestrap */ + reg |= USBSS_W1_MODESTRAP_SEL; + reg &= ~USBSS_W1_MODESTRAP_MASK; + reg |= USBSS_MODESTRAP_MODE_NONE << USBSS_W1_MODESTRAP_SHIFT; + cdns_ti_writel(data, USBSS_W1, reg); + + /* de-assert RESET */ + reg |= USBSS_W1_PWRUP_RST; + cdns_ti_writel(data, USBSS_W1, reg); + + return 0; +} + +static const struct dev_pm_ops cdns_ti_pm_ops = { + RUNTIME_PM_OPS(NULL, cdns_ti_runtime_resume, NULL) +}; + static const struct of_device_id cdns_ti_of_match[] = { { .compatible = "ti,j721e-usb", }, { .compatible = "ti,am64-usb", }, @@ -224,6 +237,7 @@ static struct platform_driver cdns_ti_driver = { .driver = { .name = "cdns3-ti", .of_match_table = cdns_ti_of_match, + .pm = pm_ptr(&cdns_ti_pm_ops), }, }; From patchwork Fri Feb 23 16:05:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 775722 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 1FFEC84A3B; Fri, 23 Feb 2024 16:05:35 +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=1708704338; cv=none; b=Mq8OGpmUE7sVIDMYJmjg1OjeWhu9xAoy+ldrrqxXklFmKj6Ug2SDsHfTh7boKXW7+qIY0ygHZ9xlYeEgW2rGed4yZfI6ysWwywEd1bgoxpaiUMDpoO6FEiTem0sYmuGmCXc/RHrRQbhUhx6Gl5kaR+0jwYsJtx7SjEtOHbve2U4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704338; c=relaxed/simple; bh=97EOv05Zvt8CODTX+l/7VHsmXG1xRa8W1GdqMMOu4S4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R7c8hIRz6IV14Hn21Mu2Bg/vj/7swX/hBhFrslifUHtXM5MrdrbEZQTUuUo3B9SQBLCIhzkwiwRmDrqo0J9WGmJuRVtipkfvjXhexEARqXXaRnhJVW4+oRLOTQr9kkRJIvbmjxLZxUeq2XFcyWkt35U2inqHBEIajCITB0eUxmQ= 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=cOD7OspL; 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="cOD7OspL" Received: by mail.gandi.net (Postfix) with ESMTPSA id B24741C0008; Fri, 23 Feb 2024 16:05:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9FINWLp/w0HN6A+6t4rg5b6XzSr+dwLhUgwTrZyKrbg=; b=cOD7OspLvGU9jVADF5Hs8xu3HGeAENLLkI5Ccu/rnM7Nb6QAN993aq6F6blcocec/8zYOU kt1fGZgX3RevRgRzg0stoXbRmz/b7rTLu+uNiqGkX5jIrPy9HYWZFdm7TmqdGiwLqv527R C9SQ4kyCbS5k5Fk04BCbRQCa5S3lUF5sbzzT8sbVDP11szXnSuq6OKmHVybNDt3fa77CSj zYPTB8ZXxt2friE/EDQ+gAx7+JAwDLtxOO8YHo8RtqqFGy665GLQgcWqxQhnO+h19JoxX3 Ep6/7ylAX6DHDXwMBPHUlFp1EB3h+ETaxlQQ0SLC0lqFyLtplZ6A1RwLXBFlVA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:28 +0100 Subject: [PATCH v3 4/8] usb: cdns3-ti: support reset-on-resume behavior Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-4-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com Add match data support, with one boolean to indicate whether the hardware resets after a system-wide suspend. If hardware resets, we force execute ->runtime_resume() at system-wide resume to run the hardware init sequence. No compatible exploits this functionality, just yet. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/cdns3-ti.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index 4c8a557e6a6f..f76327566798 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -57,9 +57,14 @@ struct cdns_ti { unsigned vbus_divider:1; struct clk *usb2_refclk; struct clk *lpm_clk; + const struct cdns_ti_match_data *match_data; int usb2_refclk_rate_code; }; +struct cdns_ti_match_data { + bool reset_on_resume; +}; + static const int cdns_ti_rate_table[] = { /* in KHZ */ 9600, 10000, @@ -101,6 +106,7 @@ static int cdns_ti_probe(struct platform_device *pdev) platform_set_drvdata(pdev, data); data->dev = dev; + data->match_data = device_get_match_data(dev); data->usbss = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(data->usbss)) { @@ -220,8 +226,29 @@ static int cdns_ti_runtime_resume(struct device *dev) return 0; } +static int cdns_ti_suspend(struct device *dev) +{ + struct cdns_ti *data = dev_get_drvdata(dev); + + if (data->match_data && data->match_data->reset_on_resume) + return pm_runtime_force_suspend(dev); + else + return 0; +} + +static int cdns_ti_resume(struct device *dev) +{ + struct cdns_ti *data = dev_get_drvdata(dev); + + if (data->match_data && data->match_data->reset_on_resume) + return pm_runtime_force_resume(dev); + else + return 0; +} + static const struct dev_pm_ops cdns_ti_pm_ops = { RUNTIME_PM_OPS(NULL, cdns_ti_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(cdns_ti_suspend, cdns_ti_resume) }; static const struct of_device_id cdns_ti_of_match[] = { From patchwork Fri Feb 23 16:05:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 775477 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 051CA84FB1; Fri, 23 Feb 2024 16:05:36 +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=1708704339; cv=none; b=hz56/IvNGiOdk3rHrCxkarANnTFxQzQZBRCOkSby1HgUaWiAQ/Ic5QcK7/k0qQuhvywUED4Gi+1fs/OvRguLIujuWWkAoLO38oLMKm7lrLH/XO9pvrKTC1td3GwI16QT7xwyQAC0rvnCzCduKk5jVUw+HD8aRi4gbb83Q5bQwG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704339; c=relaxed/simple; bh=rpv4qi5Z6eTUa2IMqz85N1MvbMDX7qjpFaTwD8sTp3E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RkfudhE4mnNutvdnsZ82D5ihK9CgG0CDlSlCH09y8qJaaTXIbgtZv/olbEUfoZokBkQedweW7fwOQMhAl5IceXV8wnP8ykHVYk01xyzvVzt0xHbDEcXmt+Sk5gXGbUpt99l/inIuyxSmeWX+OdrxROGg7SQLbbjqsd5wKxHUuZE= 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=mLuKiL/Y; 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="mLuKiL/Y" Received: by mail.gandi.net (Postfix) with ESMTPSA id 820951C0002; Fri, 23 Feb 2024 16:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704335; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gQ4y/VEIeiumEnjB4J+Uqc13LinCxq5gzHE+LkRNKeM=; b=mLuKiL/YjpInWAvicL9rw00uFm5cJOy0efmORr8oL2qc7i+CLbyBhQtE8gjJ0hsZDsAUhc aQL1K+k/N+D1RNfQbCsstk+mXxrRlmBdtSSL6oX+Mq3YKU03m6MCGeGLVBh0/DuETcHxYd 2x/y9k1XwUBNp/OOKksMsiMc22SubR0orf6rEN2FNv1+aU5XPQFUFhDOG5aYaqs0TPM2+b 0yufs8EcgQ2wyo9kPAUyetqeYnxhKUUxyH0DtCnvHrW8yS7oaIEVYN+O8GFeIdyayp0lKS qZRUS3607Gkw3hSqhYTjWvtc5JgQ+d1PucmK1lQQTHSU8ZpCOq7mK8iz6Jn5jw== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:29 +0100 Subject: [PATCH v3 5/8] usb: cdns3-ti: pass auxdata from match data to of_platform_populate() Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-5-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com Allow compatible to pick auxdata given to child platform devices. No compatible exploits this functionality, just yet. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/cdns3-ti.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index f76327566798..29fb24c811b3 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -62,7 +62,8 @@ struct cdns_ti { }; struct cdns_ti_match_data { - bool reset_on_resume; + bool reset_on_resume; + const struct of_dev_auxdata *auxdata; }; static const int cdns_ti_rate_table[] = { /* in KHZ */ @@ -95,6 +96,7 @@ static int cdns_ti_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *node = pdev->dev.of_node; + const struct of_dev_auxdata *auxdata = NULL; struct cdns_ti *data; unsigned long rate; int error, i; @@ -149,7 +151,9 @@ static int cdns_ti_probe(struct platform_device *pdev) goto err; } - error = of_platform_populate(node, NULL, NULL, dev); + if (data->match_data) + auxdata = data->match_data->auxdata; + error = of_platform_populate(node, NULL, auxdata, dev); if (error) { dev_err(dev, "failed to create children: %d\n", error); goto err; From patchwork Fri Feb 23 16:05:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 775721 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 99A678528C; Fri, 23 Feb 2024 16:05:37 +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=1708704339; cv=none; b=ZObeik9mcIHBjRo8UMzlrOJpHoZYQdgnCwrrHYCfJ/Fy7cIp8bq8cm8a1Y4xfxOBL32YJq4gXmwzMGmqjZ1lCezJTGYqVZRWZRHqOCE/m9vHafeiUNuYmPPdDwVbzCENb2GirSlDIqI5QVPI6sfiBXaCjNEkAIWqSY/C8IuhRWE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704339; c=relaxed/simple; bh=bFDA1LotbYhuGH+XHfjRA2gzFAO3dmkWnhvDgj5Uwl0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UmQTP0xaRpZF5wtSDCCDkIe85yO0mLAmyC/SlZKE0daAgI9J6+F1ELSyDYqPRPcKGbRIQ84dwXBdcq8I9vbfHckjePTq0mEqI3y0GFBPdH/cRFBAdmNDXUHcwKa2jI53mqu7Brwk7IW1nurtwDR/2pzfdm8Ez4JBL7pa/6JbkoQ= 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=CbYTeVT1; 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="CbYTeVT1" Received: by mail.gandi.net (Postfix) with ESMTPSA id 542621C0009; Fri, 23 Feb 2024 16:05:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=niMPY3vxyYJLUrRJjUWlI9ZbKbPa7LOQCtP7P5fEvVA=; b=CbYTeVT1n4jzdpnFH9hgwWoam5OME+Lgp6+zcANJCgji931QgArC204kIdPKTiWfmTMYOq QMf/i9pOg4wRb5xEx3KOlcRaTUjd5ikZvEz1ohjrfky6plUOkYG0FNNN/T9R/BbDCedvqW o4EBWRNCNqcCaeASWWpfi/b9m3yUESL/GE04dD83N40PUyL9Z2pkRNo8R4Q4sKb+Nj/h1v zFIZyPDbBdOpaQx8Zs8ciIn9o+dE1fZnHxhhBQspkwUEMaiCZ9k/8kLxMfIpBOE9s5G+rL CiF4MHfz2XyLyUKrQ7F+d0Kd097nOjAk/Voqs6YXrN58oXTCjA4YKituAIx2tQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:30 +0100 Subject: [PATCH v3 6/8] usb: cdns3: add quirk to platform data for reset-on-resume Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-6-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com The cdns3 host role does not care about reset-on-resume. xHCI however reconfigures itself in silence rather than printing a warning about a resume error. Related warning example: [ 16.017462] xhci-hcd xhci-hcd.1.auto: xHC error in resume, USBSTS 0x401, Reinit Allow passing a CDNS3_RESET_ON_RESUME quirk flag from cdns3 pdata down to xHCI pdata. The goal is to allow signaling about reset-on-resume behavior from platform wrapper drivers. When used, remote wakeup is not expected to work. Acked-by: Peter Chen Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/core.h | 1 + drivers/usb/cdns3/host.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/usb/cdns3/core.h b/drivers/usb/cdns3/core.h index 81a9c9d6be08..7487067ba23f 100644 --- a/drivers/usb/cdns3/core.h +++ b/drivers/usb/cdns3/core.h @@ -44,6 +44,7 @@ struct cdns3_platform_data { bool suspend, bool wakeup); unsigned long quirks; #define CDNS3_DEFAULT_PM_RUNTIME_ALLOW BIT(0) +#define CDNS3_RESET_ON_RESUME BIT(1) }; /** diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c index 6164fc4c96a4..28c4d1deb231 100644 --- a/drivers/usb/cdns3/host.c +++ b/drivers/usb/cdns3/host.c @@ -91,6 +91,9 @@ static int __cdns_host_init(struct cdns *cdns) if (cdns->pdata && (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW)) cdns->xhci_plat_data->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; + if (cdns->pdata && (cdns->pdata->quirks & CDNS3_RESET_ON_RESUME)) + cdns->xhci_plat_data->quirks |= XHCI_RESET_ON_RESUME; + ret = platform_device_add_data(xhci, cdns->xhci_plat_data, sizeof(struct xhci_plat_priv)); if (ret) From patchwork Fri Feb 23 16:05:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 775476 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 7126384A47; Fri, 23 Feb 2024 16:05:38 +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=1708704340; cv=none; b=JXfxiVZ2rGHjtAtGMTOn64W1Sk3hYGZV2Bjgc53VY4pt6sYDEjs7f3w4mE92oC+JiIVcm8cOGfohkLVAJfXz62Tyb50llNiIIzBJnhIRAixyqe7DAyrDLfIKKp8WOVBl3btDtqVAeVtJFVYGwwMeeGAfQlCuHUJbIc8DgjANJ0E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704340; c=relaxed/simple; bh=pOwI5GqJccR2V6G6RA9AszwHgBeEwP4jFC1YS6Zf6zk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZBYF79hdPZtvpcl0zASU9qLOhAWuqndNVFltFgf/c84Pp2X2GiIWQoINbnWwnBLYKhZMXCBis9gGUpxZ4bnBgG77D9DgklLcYulzyH0AC0PvYoMk/dwZ3mxu3HjDoVw1xb7WUmvR0hh4rzGf/Z+KZk+zpsSfBg98GedGBy2S+Kg= 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=NEzmvm4U; 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="NEzmvm4U" Received: by mail.gandi.net (Postfix) with ESMTPSA id 215831C000C; Fri, 23 Feb 2024 16:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wF2GEFIGDf1EoCX/WDH7UWK4GOrP+0T9MYnwKzq1lNc=; b=NEzmvm4U1Qt5t0hcgSEFjjIouzNmvAR3cOFKlNu6MbUu5OjE0Y0X4ZUFs7DDWGon/MJIKN I7oOYJ7kqC0SlplEaxb0OWaz3xPegu3mcqr6jLLzUwHb6YY6j+OOOrVF7y7otmDsN0Fx0m HUShbNCkwob8+61DMz5BXnH2nuyM9eR3Ag17mHuSpfN9Z7bmx/yfqe5KbfhNBjsu8wgFGI anSQFw4RD8Lv8+p3ty3HQSl5HQC3kEHnBmmUzXdoV8xupZnarmXsh5snp4ldezmo9+lwgA V2Qmj8DgVA9GCOTP4ctqnPJQqOs2VrhT/QPWuh8/aU5C1D1q3X4JB32KP6hC2Q== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:31 +0100 Subject: [PATCH v3 7/8] usb: cdns3-ti: add J7200 support with reset-on-resume behavior Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-7-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com Add ti,j7200-usb compatible. Match data indicates the controller resets on resume meaning: - The cdns3-ti wrapper init sequence must be ran at resume. - Tell the cdns3 core that we reset on resume. This silences a xHCI warning visible in cases of unexpected resets. Signed-off-by: Théo Lebrun --- drivers/usb/cdns3/cdns3-ti.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index 29fb24c811b3..648243a27987 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -17,6 +17,8 @@ #include #include +#include "core.h" + /* USB Wrapper register offsets */ #define USBSS_PID 0x0 #define USBSS_W1 0x4 @@ -255,7 +257,25 @@ static const struct dev_pm_ops cdns_ti_pm_ops = { SYSTEM_SLEEP_PM_OPS(cdns_ti_suspend, cdns_ti_resume) }; +static struct cdns3_platform_data cdns_ti_j7200_pdata = { + .quirks = CDNS3_RESET_ON_RESUME, +}; + +static const struct of_dev_auxdata cdns_ti_j7200_auxdata[] = { + { + .compatible = "cdns,usb3", + .platform_data = &cdns_ti_j7200_pdata, + }, + {}, +}; + +static const struct cdns_ti_match_data cdns_ti_j7200_match_data = { + .reset_on_resume = true, + .auxdata = cdns_ti_j7200_auxdata, +}; + static const struct of_device_id cdns_ti_of_match[] = { + { .compatible = "ti,j7200-usb", .data = &cdns_ti_j7200_match_data, }, { .compatible = "ti,j721e-usb", }, { .compatible = "ti,am64-usb", }, {}, From patchwork Fri Feb 23 16:05:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 775720 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 03C0D126F2D; Fri, 23 Feb 2024 16:05:38 +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=1708704341; cv=none; b=t8U3msBaWHLpZQki5xhgK1FJ2vx9hQcIfMGdtIMzUcj9MlzV9zN93o39VGTlITGnP9tBQl3Mi1Ol87KlJzg0w7XIxvC/WmO41PLeOxoWuhDr1uLXA5nlD0zxiqdCDrK1HbUvCeYkVGm1hMepl9inZdEJmiMevIENtq+o0MaI+IQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708704341; c=relaxed/simple; bh=aug1EGBO9quV8KuGNaFq1P9VzUHdgRvZNwTEI+MXNnA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=clszwSW2IWIFXssinEW/UVHgvY8jt5eCd1TfWzDUDd2yTNDYy2yKl6Sxzkzk/HJOkLF2n1odGkk5t6VKgsW3x/+yKpvg8g4gR/wOx/eVdKR94T6biYFf4ULhz/hOGNELa9npAI0MeQ+Q5h1vKuX3Tb/vjZOToAmmvBZ1++kDV0Q= 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=m9+GDKH5; 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="m9+GDKH5" Received: by mail.gandi.net (Postfix) with ESMTPSA id DE0851C000D; Fri, 23 Feb 2024 16:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708704337; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6xOpzacrMjQXeUvPNnUvJ9wpAt1ylGpzt8dxUAtY2fY=; b=m9+GDKH5e7Qotwc5ISt6ICucycRwJmKWEts5I8vhAwxfRn/31OH0ALy0DnGj5suVNMrdUA gBqM3HHCfrs/8g78pNr03uyFoJm1TW9TWddCcmipAO05w8QzTqauMsa4/Fy+PMJpaEPN4H 93Jfj+XDXBHe4z1jJV8fLiwgy7C0/ZaZxK9rRqEmZIdbCK3Y+z4tIKg5mUmfW2sv/iUtQ1 g/EXTjiSpNO7fwZf3j1XE9oL5eqvBvMQ7A5f9XoX6VJjpqF3hilrjxeTSgVBZ1i3Ab9QWZ 0z3t4pz/EQQ+3sLCEdO3o2Iy1F6jmBeECDpEhUgWKlROQsDvOLLF6QQvsMqNcg== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 23 Feb 2024 17:05:32 +0100 Subject: [PATCH v3 8/8] arm64: dts: ti: k3-j7200: use J7200-specific USB compatible Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-j7200-usb-suspend-v3-8-b41c9893a130@bootlin.com> References: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> In-Reply-To: <20240223-j7200-usb-suspend-v3-0-b41c9893a130@bootlin.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Roger Quadros , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?utf-8?q?Gr=C3=A9gory_?= =?utf-8?q?Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com On our platform, suspend-to-idle or suspend-to-RAM turn the controller off. This compatible triggers reset-on-resume behavior to reconfigure the hardware. Signed-off-by: Théo Lebrun --- arch/arm64/boot/dts/ti/k3-j7200-main.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi index 45ba9c2d0344..134d6e5f3b01 100644 --- a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi @@ -793,7 +793,7 @@ pcie1_ep: pcie-ep@2910000 { }; usbss0: cdns-usb@4104000 { - compatible = "ti,j721e-usb"; + compatible = "ti,j7200-usb"; reg = <0x00 0x4104000 0x00 0x100>; dma-coherent; power-domains = <&k3_pds 288 TI_SCI_PD_EXCLUSIVE>;