From patchwork Mon Jan 23 19:06:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13112818 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF709C05027 for ; Mon, 23 Jan 2023 19:07:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rH/r8ctV508V7E1jVcVAyoz6n7X1hgwKyk8SzlJNhio=; b=n8sVmBxodFy2lW IW5U4JupHEop3ikPbG3wJtyRl5sXp/hlniNQuM1ZON5oSFPY/TEpHTRZy1EiIr0xIkenbhhZii4Uc hPLoVyRnzhKqoeQFiBUwb125516fVoF1GI52j+k9FS2Dm+FoXfi7yeDigeHM/M9NlHl2M/YUe2EzN xOde+y9xULIKyegBudMuqNeTls7BXz6OHfXnu05m1RdLWjrkYcV/fX9/MgJUuE3VesFj0TV6A01LW lxdLsIGf2cWn9z8lSVIiw/oidnk4bDSzgPCsQxgLauoatrqMRZpxshJ0nS96V/U8o/TalknFyObaE 4h+8olEoM8hOtrJHjZHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pK29N-0016I9-Lz; Mon, 23 Jan 2023 19:06:37 +0000 Received: from baptiste.telenet-ops.be ([2a02:1800:120:4::f00:13]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pK29H-0016Fw-GX for linux-arm-kernel@lists.infradead.org; Mon, 23 Jan 2023 19:06:35 +0000 Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed50:6083:1fd7:ba05:ea8d]) by baptiste.telenet-ops.be with bizsmtp id CK6L2900P4604Ck01K6LwW; Mon, 23 Jan 2023 20:06:21 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1pK28y-0076NU-L1; Mon, 23 Jan 2023 20:06:20 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1pK296-00Ekpu-IJ; Mon, 23 Jan 2023 20:06:20 +0100 From: Geert Uytterhoeven To: Magnus Damm Cc: Wolfram Sang , Ulrich Hecht , linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 1/2] arm64: dts: renesas: r8a779g0: Add CAN-FD node Date: Mon, 23 Jan 2023 20:06:18 +0100 Message-Id: <6c55d0995089917216ee261a8b8cbb980c7b5304.1674500205.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230123_110631_709800_5F316EE3 X-CRM114-Status: GOOD ( 11.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add device nodes for the CAN-FD interface and the related external CAN clock on the Renesas R-Car V4H (R8A779G0) SoC. Based on a patch in the BSP by Kazuya Mizuguch. Signed-off-by: Geert Uytterhoeven --- Changes compared to the BSP: - Add family-specific compatible value, - Correct reg size, - Add missing interrupt-names. --- arch/arm64/boot/dts/renesas/r8a779g0.dtsi | 57 +++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r8a779g0.dtsi b/arch/arm64/boot/dts/renesas/r8a779g0.dtsi index 83d1666a2ea16de2..d4cc89e49c68d52e 100644 --- a/arch/arm64/boot/dts/renesas/r8a779g0.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a779g0.dtsi @@ -14,6 +14,13 @@ / { #address-cells = <2>; #size-cells = <2>; + /* External CAN clock - to be overridden by boards that provide it */ + can_clk: can { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <0>; + }; + cluster0_opp: opp-table-0 { compatible = "operating-points-v2"; opp-shared; @@ -676,6 +683,56 @@ hscif3: serial@e66a0000 { status = "disabled"; }; + canfd: can@e6660000 { + compatible = "renesas,r8a779g0-canfd", + "renesas,rcar-gen4-canfd"; + reg = <0 0xe6660000 0 0x8500>; + interrupts = , + ; + interrupt-names = "ch_int", "g_int"; + clocks = <&cpg CPG_MOD 328>, + <&cpg CPG_CORE R8A779G0_CLK_CANFD>, + <&can_clk>; + clock-names = "fck", "canfd", "can_clk"; + assigned-clocks = <&cpg CPG_CORE R8A779G0_CLK_CANFD>; + assigned-clock-rates = <80000000>; + power-domains = <&sysc R8A779G0_PD_ALWAYS_ON>; + resets = <&cpg 328>; + status = "disabled"; + + channel0 { + status = "disabled"; + }; + + channel1 { + status = "disabled"; + }; + + channel2 { + status = "disabled"; + }; + + channel3 { + status = "disabled"; + }; + + channel4 { + status = "disabled"; + }; + + channel5 { + status = "disabled"; + }; + + channel6 { + status = "disabled"; + }; + + channel7 { + status = "disabled"; + }; + }; + avb0: ethernet@e6800000 { compatible = "renesas,etheravb-r8a779g0", "renesas,etheravb-rcar-gen4"; From patchwork Mon Jan 23 19:06:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13112820 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F21CC05027 for ; Mon, 23 Jan 2023 19:07:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RZWgb7Ngegq97EWlwGZMbX4xBE8/eHsXcS0o2tAI6pc=; b=Dc8MVPYol+Kl/z vSEC5IIEvr+c1G6srKeaApNGy/GOcwt6/CDDa/Zdb6drHbQ7rJcWW8UdM52gadaOHoiJXlZpi9lzv E5BHWC0X5QIHJxVairCXC4efuizp593P+C/MB4T3Q6V80WdqGjSdpittc97R+GgqTL39waQbXDu2n IBIxOs1FaeHdTNz6GkfguxnY0Mdlsm94/CQn9G6/EBc9LdP0S2bQvy+Yb88O6SfMlnyA666/Fwtmt Krr8oZmZTeR73aDWD5D176kDe0Kzcdt0JETvZTFynOfdxOlCIhlenTXTIRMGqplXWNBZXSJaWxstl gV54piqBYT5yGE7NfKMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pK29c-0016J8-Bx; Mon, 23 Jan 2023 19:06:52 +0000 Received: from michel.telenet-ops.be ([2a02:1800:110:4::f00:18]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pK29H-0016G0-Fq for linux-arm-kernel@lists.infradead.org; Mon, 23 Jan 2023 19:06:38 +0000 Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed50:6083:1fd7:ba05:ea8d]) by michel.telenet-ops.be with bizsmtp id CK6L2900F4604Ck06K6Lbw; Mon, 23 Jan 2023 20:06:22 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1pK28y-0076NW-LM; Mon, 23 Jan 2023 20:06:20 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1pK296-00Ekpx-Iu; Mon, 23 Jan 2023 20:06:20 +0100 From: Geert Uytterhoeven To: Magnus Damm Cc: Wolfram Sang , Ulrich Hecht , linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 2/2] arm64: dts: renesas: white-hawk: Add CAN-FD support Date: Mon, 23 Jan 2023 20:06:19 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230123_110631_716034_466E408C X-CRM114-Status: GOOD ( 13.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enable confirmed-working CAN-FD channels 0 and 1 on the White-Hawk development board: - Channel 0 uses an NXP TJR1443AT CAN transceiver, which is be enabled through a GPIO, - Channels 1-7 use Microchip MCP2558FD-H/SN CAN transceivers (not mounted for channels 4-7), which do not need explicit description, but channels 2-3 do not seem to work. Inspired by a patch in the BSP by Kazuya Mizuguch. Signed-off-by: Geert Uytterhoeven --- This depends on "[PATCH 2/2] phy: phy-can-transceiver: Add support for NXP TJR1443" https://lore.kernel.org/all/0bfa1e4c43632e49c9512b4e7daa970545545dcf.1674037830.git.geert+renesas@glider.be Changed compared to the BSP: - Add can_clk, - Add missing can_transceiver0, - Disable channels 2-7. Tested using cansend, candump, and canfdtest. - Channel 2 does not work: "bus-off" error message. - Channel 3 does not work: - Using cansend on another interface, and candump on can3 shows that nothing is received. However, my scope does see the data on the bus, and it is not sent repeatedly, hence it must have been acked by the receiver. - Using canfdtest on can3 gives: can3: Message ID mismatch! expected: 0078: [8] 01 02 03 04 05 06 07 08 received: 0077: [8] 00 01 02 03 04 05 06 07 Note that describing a plain gpio-hog instead of can_transceiver0 is not sufficient, as the enable signal must not be asserted before initialization of the CAN-FD controller, --- .../boot/dts/renesas/r8a779g0-white-hawk.dts | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r8a779g0-white-hawk.dts b/arch/arm64/boot/dts/renesas/r8a779g0-white-hawk.dts index 04a2b6b83e743f32..eff1ef6e2cc83aba 100644 --- a/arch/arm64/boot/dts/renesas/r8a779g0-white-hawk.dts +++ b/arch/arm64/boot/dts/renesas/r8a779g0-white-hawk.dts @@ -13,6 +13,33 @@ / { model = "Renesas White Hawk CPU and Breakout boards based on r8a779g0"; compatible = "renesas,white-hawk-breakout", "renesas,white-hawk-cpu", "renesas,r8a779g0"; + + can_transceiver0: can-phy0 { + compatible = "nxp,tjr1443"; + #phy-cells = <0>; + enable-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; + max-bitrate = <5000000>; + }; +}; + +&can_clk { + clock-frequency = <40000000>; +}; + +&canfd { + pinctrl-0 = <&canfd0_pins>, <&canfd1_pins>, <&can_clk_pins>; + pinctrl-names = "default"; + + status = "okay"; + + channel0 { + status = "okay"; + phys = <&can_transceiver0>; + }; + + channel1 { + status = "okay"; + }; }; &i2c0 { @@ -23,3 +50,20 @@ eeprom@51 { pagesize = <8>; }; }; + +&pfc { + can_clk_pins: can-clk { + groups = "can_clk"; + function = "can_clk"; + }; + + canfd0_pins: canfd0 { + groups = "canfd0_data"; + function = "canfd0"; + }; + + canfd1_pins: canfd1 { + groups = "canfd1_data"; + function = "canfd1"; + }; +};