From nobody Mon Feb 9 01:31:08 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 38F1B201270; Sat, 22 Feb 2025 07:43:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740210202; cv=none; b=VYOIYlv4xfuKpbl9c2pWgajfLXTL5elBWa3stxwxnB8dUI8sRpKpcc2uZ3Ev4suBB7f6HF/MpYF7ijc3Q9NMhsPn4rSbkI9ZfPaqXlCeSEtUyef4atdtz/1hUMnkVYQBs9V1Ac8dWvNYCrfq3xrlXT7tR8aF00aesf7ivJSKdhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740210202; c=relaxed/simple; bh=lx38Ii4qB/AI3pWRJSXPUS3zXu9HaBtlPizO41uROZw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p74Z5oDxgs/zomrCjnA9X6cOLVmwfI85aUO/D2IcaCK/GspAXflCTEWLTI5bh8C/VgxoBPuDSf3dFwUJffcp/dNlpsGGDy48F4LX0I+YTkn/5Dsu7xB/XVjlPIDtdYqvkdCfJAOA2OK+QW3fxihcpcfHNpDKNIWNiWskcqLz6Yc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I0qlhudm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I0qlhudm" Received: by smtp.kernel.org (Postfix) with ESMTPS id B175FC4CEE6; Sat, 22 Feb 2025 07:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740210201; bh=lx38Ii4qB/AI3pWRJSXPUS3zXu9HaBtlPizO41uROZw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=I0qlhudmD2QDht3ZDp3hHAAjIs6pXmiwLET/vwloNQ1aIBReLXqhwEchH4/KYF527 5JOftlPQM4y7O1pYJBP4zKSW+EagZcXkFx4EchbckMVn27dlhQv8KX3cnESbZm/fhj HRoH3vOBXBCDmDyTNvYPYHv8XJ6EJ26OEDX62xfl5Zeq7xwgyws7+UQKq/mZYJx+qa bUh4LUgmyAwMBkS9m/2ehMPSTZn+h0iBz05a86FeiTTeINTnv+ARQ3B9rExO23N9+5 vb7V1EfGs+99udRmcXBIqapFoO5tbtjxpd8tV3foCwfLWgoVMSgLxEKWZe67tfTysM zsRsX9fJz379w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D3F3C021B6; Sat, 22 Feb 2025 07:43:21 +0000 (UTC) From: Dimitri Fedrau via B4 Relay Date: Sat, 22 Feb 2025 08:43:13 +0100 Subject: [PATCH v4 1/2] dt-bindings: can: fsl,flexcan: add transceiver capabilities Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250222-flexcan-add-transceiver-caps-v4-1-a38dfadab763@liebherr.com> References: <20250222-flexcan-add-transceiver-caps-v4-0-a38dfadab763@liebherr.com> In-Reply-To: <20250222-flexcan-add-transceiver-caps-v4-0-a38dfadab763@liebherr.com> To: Marc Kleine-Budde , Vincent Mailhol , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-can@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Dimitri Fedrau , Dimitri Fedrau , Conor Dooley X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740210200; l=1240; i=dimitri.fedrau@liebherr.com; s=20241202; h=from:subject:message-id; bh=62w1D1rpX0pQNS5ptfX/YuY6csaGTzAr13ql41pZT30=; b=3WQsjjRLq1qmsSqQn1ymItbHsijT3UMwRseDCr6TGzSEUFdPeWyKO6S12bXBstobD6S13ZK0m 0NG98sr2XVkDVPC4Ym6Ee5RbUjNyKAGJ+7TjsC4lmMLlwBo/35FX0LF X-Developer-Key: i=dimitri.fedrau@liebherr.com; a=ed25519; pk=rT653x09JSQvotxIqQl4/XiI4AOiBZrdOGvxDUbb5m8= X-Endpoint-Received: by B4 Relay for dimitri.fedrau@liebherr.com/20241202 with auth_id=290 X-Original-From: Dimitri Fedrau Reply-To: dimitri.fedrau@liebherr.com From: Dimitri Fedrau Currently the flexcan driver does only support adding PHYs by using the "old" regulator bindings. Add support for CAN transceivers as a PHY. Acked-by: Conor Dooley Signed-off-by: Dimitri Fedrau --- Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/D= ocumentation/devicetree/bindings/net/can/fsl,flexcan.yaml index 73252fe56fe6c8e9fd19142208bb655dc86d47cd..37e3e4f487629f4df427dd8f711= dc632f8dc5a2a 100644 --- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml @@ -77,6 +77,9 @@ properties: xceiver-supply: description: Regulator that powers the CAN transceiver. =20 + phys: + maxItems: 1 + big-endian: $ref: /schemas/types.yaml#/definitions/flag description: | @@ -171,6 +174,12 @@ allOf: interrupts: maxItems: 1 interrupt-names: false + - if: + required: + - xceiver-supply + then: + properties: + phys: false =20 additionalProperties: false =20 --=20 2.39.5 From nobody Mon Feb 9 01:31:08 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 38EBB13C3F2; Sat, 22 Feb 2025 07:43:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740210202; cv=none; b=BdgagUwp9ZBTxrIwK/5Lbr8U5Zc36iud8pCdcKiWu2NtOXPXQRW+ETIDMU1JA0Ktknbqfqi6MVZIngDOFPJ7wNgMgDYAJviIImW3DCTy/gWJAqvfga9cnw6ChMQCaD1SYY8MdMacq11eTpWY3uaWgyMAUOENAzF3d+HEhFkSCVs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740210202; c=relaxed/simple; bh=BtOhGRVLO/4z5tXwtnomJn5XJEhbKXaC1bZE6yJRkys=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VushFf0QZY4lWREpSeIn8Va+sHenYPJh0bTA7NV1oCEbrZuKx4jomyv0vmlGPmX0USOeyvfS5Uu5fWpqTJ12FJXUrSBqRRwJM3IkPC2WhPGKbx3UbD472gCNJj4fEKP2A6/VoXvhnmKR3+pIgI7qiSXXRuhso+sihQMO7yUAn4U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iMcFSZje; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iMcFSZje" Received: by smtp.kernel.org (Postfix) with ESMTPS id BDB76C4CEE4; Sat, 22 Feb 2025 07:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740210201; bh=BtOhGRVLO/4z5tXwtnomJn5XJEhbKXaC1bZE6yJRkys=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=iMcFSZje3PgpqKm+BkYlSwWcte7cB2VzLuzR8X2aWEqfV3zPau3GZnqAOX9VZkA0l sXJIu0uhRbwdC8vhIFDNUw4ctlm5QowJ5qBNWttIJytV9bH1fnbyi9fHkaRd0w3s7A vunkxfsqUQmfOOJqyipUn8TarM8F8ed40Y7IgwfUNMoHDdzLXdrDEfeOaRqle70DK4 rSGsYRffAnm6949E7uovk/q42AzMrP7T2nVDRmz9GPks9hkIr6Z5lyEYYwzGaB5pK8 Y1nY6RDD7XlqYnfUXd2KJnAB10BJtUVJMk0VtYSj3g1hwUSr32suy4FWL62l3C1DQU Qs9cRjL92hkxQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE5E8C021B7; Sat, 22 Feb 2025 07:43:21 +0000 (UTC) From: Dimitri Fedrau via B4 Relay Date: Sat, 22 Feb 2025 08:43:14 +0100 Subject: [PATCH v4 2/2] can: flexcan: add transceiver capabilities Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250222-flexcan-add-transceiver-caps-v4-2-a38dfadab763@liebherr.com> References: <20250222-flexcan-add-transceiver-caps-v4-0-a38dfadab763@liebherr.com> In-Reply-To: <20250222-flexcan-add-transceiver-caps-v4-0-a38dfadab763@liebherr.com> To: Marc Kleine-Budde , Vincent Mailhol , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-can@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Dimitri Fedrau , Dimitri Fedrau X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740210200; l=3555; i=dimitri.fedrau@liebherr.com; s=20241202; h=from:subject:message-id; bh=kSxxiQHxl//wCevFJfiq2EaHcqBYYuWBjHktSM+Fwds=; b=cwtIoowK6jS+eb7vY9RSnnv3BPYga+3nZ1PaYEn9/e8LFvbWetnG+b3HCPn7YruHyZyvCVW8P qFGtmbg1xw7D8+UajmCa9LQZwSSXk+2HI3YzF+OWiYb8Ajiy4aNgLLb X-Developer-Key: i=dimitri.fedrau@liebherr.com; a=ed25519; pk=rT653x09JSQvotxIqQl4/XiI4AOiBZrdOGvxDUbb5m8= X-Endpoint-Received: by B4 Relay for dimitri.fedrau@liebherr.com/20241202 with auth_id=290 X-Original-From: Dimitri Fedrau Reply-To: dimitri.fedrau@liebherr.com From: Dimitri Fedrau Currently the flexcan driver does only support adding PHYs by using the "old" regulator bindings. Add support for CAN transceivers as a PHY. Add the capability to ensure that the PHY is in operational state when the link is set to an "up" state. Signed-off-by: Dimitri Fedrau --- drivers/net/can/flexcan/flexcan-core.c | 27 +++++++++++++++++++++------ drivers/net/can/flexcan/flexcan.h | 1 + 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexc= an/flexcan-core.c index b347a1c93536d54efaa5f7d3347bd47c20860b3e..7588cb54a909af065522ddbcb06= cc3acb9669893 100644 --- a/drivers/net/can/flexcan/flexcan-core.c +++ b/drivers/net/can/flexcan/flexcan-core.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -644,18 +645,22 @@ static void flexcan_clks_disable(const struct flexcan= _priv *priv) =20 static inline int flexcan_transceiver_enable(const struct flexcan_priv *pr= iv) { - if (!priv->reg_xceiver) - return 0; + if (priv->reg_xceiver) + return regulator_enable(priv->reg_xceiver); + else if (priv->transceiver) + return phy_power_on(priv->transceiver); =20 - return regulator_enable(priv->reg_xceiver); + return 0; } =20 static inline int flexcan_transceiver_disable(const struct flexcan_priv *p= riv) { - if (!priv->reg_xceiver) - return 0; + if (priv->reg_xceiver) + return regulator_disable(priv->reg_xceiver); + else if (priv->transceiver) + return phy_power_off(priv->transceiver); =20 - return regulator_disable(priv->reg_xceiver); + return 0; } =20 static int flexcan_chip_enable(struct flexcan_priv *priv) @@ -2086,6 +2091,7 @@ static int flexcan_probe(struct platform_device *pdev) struct net_device *dev; struct flexcan_priv *priv; struct regulator *reg_xceiver; + struct phy *transceiver; struct clk *clk_ipg =3D NULL, *clk_per =3D NULL; struct flexcan_regs __iomem *regs; struct flexcan_platform_data *pdata; @@ -2101,6 +2107,11 @@ static int flexcan_probe(struct platform_device *pde= v) else if (IS_ERR(reg_xceiver)) return PTR_ERR(reg_xceiver); =20 + transceiver =3D devm_phy_optional_get(&pdev->dev, NULL); + if (IS_ERR(transceiver)) + return dev_err_probe(&pdev->dev, PTR_ERR(transceiver), + "failed to get phy\n"); + if (pdev->dev.of_node) { of_property_read_u32(pdev->dev.of_node, "clock-frequency", &clock_freq); @@ -2198,6 +2209,10 @@ static int flexcan_probe(struct platform_device *pde= v) priv->clk_per =3D clk_per; priv->clk_src =3D clk_src; priv->reg_xceiver =3D reg_xceiver; + priv->transceiver =3D transceiver; + + if (transceiver) + priv->can.bitrate_max =3D transceiver->attrs.max_link_rate; =20 if (priv->devtype_data.quirks & FLEXCAN_QUIRK_NR_IRQ_3) { priv->irq_boff =3D platform_get_irq(pdev, 1); diff --git a/drivers/net/can/flexcan/flexcan.h b/drivers/net/can/flexcan/fl= excan.h index 2cf886618c9621166173b865f266830b3f6c1fb0..16692a2502eba26575eeeec83df= ffdf35f07b034 100644 --- a/drivers/net/can/flexcan/flexcan.h +++ b/drivers/net/can/flexcan/flexcan.h @@ -107,6 +107,7 @@ struct flexcan_priv { struct clk *clk_per; struct flexcan_devtype_data devtype_data; struct regulator *reg_xceiver; + struct phy *transceiver; struct flexcan_stop_mode stm; =20 int irq_boff; --=20 2.39.5