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: 47334 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1771190wrn; Mon, 23 Jan 2023 11:07:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXsITDHWBrT9CDWxpiyDBSPhs7l2I1CgNGm9xHaPITWnQX45SA8iT12NQ4n909TxTXfF2uku X-Received: by 2002:a17:906:b247:b0:871:3919:cbef with SMTP id ce7-20020a170906b24700b008713919cbefmr26651553ejb.53.1674500864870; Mon, 23 Jan 2023 11:07:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674500864; cv=none; d=google.com; s=arc-20160816; b=LWVr31vWdGG0kA7t//HB+wIXwLxlxWQ2ljUSqhTOmaONI05VcDIWRfzsKM4hTppfHY d03oRtuqxp6TUA4A1JIuUEuYDvqVgE+nBrLDOGyj77ucLetltNKYiHlSipXjJiwuh7wk 9fGnn52wmP53X7bMjnCiHG8ANWe+plpdr8T13kd29aVH1sEwRwVmuSpGDuzu7P9Qs55X s/XrGsem8OFlzGjtcz63MAaghAVoG0Alz+zWs2g+reHeFMClUynaTaJzoRBRzq3nx4bW GVM8srC27F32fSN3gvFxN4oguAc/OUZzzK9xdybPxt0XIcbW7ExkswBpcjAUJ/RT8box bCXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=PsktFf5zKdNQzoTiznu45Z7GNZkd/7qIGEWQr/ERPqs=; b=FoUMwm99sarEbBWYUL6+93zLqFQvA3CHD+xQqvsArrqQY1Gfh7qFOE5kAwgEcXpdDe 8Ne32c8AYqnGJsKkrcf+gSG0ApsqTglDatRsSWJTWmc7acm5MRp6qtY48cjz4RqtNus1 oY+O58+/3G/Dwb9QKy6cOB8gSMHmoJiG/OsiSFJX+huyx9Xv410DDnASZXHykHNHzitg AjrhmajUhc9R73vMPMSFXmx30Rb2Neff6J047zS2nFcUnE3pkrp/KNx+Q8OWvE8eUQwz N+obcYxMGhRMVEpb39o4L6rY3JLNkl2E9B/y2FmyKwqaPAbVk0bBuwyJgyBUhMa5YsgR t7JQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hu8-20020a170907a08800b008778924dd6esi14392357ejc.958.2023.01.23.11.07.21; Mon, 23 Jan 2023 11:07:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231818AbjAWTGZ (ORCPT + 99 others); Mon, 23 Jan 2023 14:06:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231501AbjAWTGY (ORCPT ); Mon, 23 Jan 2023 14:06:24 -0500 Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [IPv6:2a02:1800:120:4::f00:13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7616F2FCEA for ; Mon, 23 Jan 2023 11:06:22 -0800 (PST) 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-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755841418701346429?= X-GMAIL-MSGID: =?utf-8?q?1755841418701346429?= 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: 47335 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1771246wrn; Mon, 23 Jan 2023 11:07:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXvcd84UDHz1RvboSf3putEYOfwPYs7Xgg8Fx5NfpmJj6ewCbRrgN1OIjPITwczcT7IA5NCn X-Received: by 2002:a17:906:d19a:b0:86f:3d33:4750 with SMTP id c26-20020a170906d19a00b0086f3d334750mr30488207ejz.1.1674500873450; Mon, 23 Jan 2023 11:07:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674500873; cv=none; d=google.com; s=arc-20160816; b=W/FEY3/C/IV3OOtxagron8Q9Fg9ukTlKDd//AEK3TmNjPUsFZ0RJ885I4TxN6UMi0a NFf/83zGmQriW7YwaUjTBkxU6iPD5dXLPx/bcVSU4UUOuEPE+DUHdCYgxWIbuq4JSOSg gDwaoEIlAa5bvPnpmCp1uE5x+wkPgsqP8NS7k+L6y3zbf8Y+LCQD6OZE9sXB42fBA5w5 O2UM3TO55eSfmFlp6TfG6STOf+9HIOLBwfLtPEtkDOADFXfgjT81sBIuKX18V3+PSLxQ 8svQeRG7EmXf10ocKJ8X68vAwwgQub+/z70XAeuN9t+iWmhKBiSyN3u/4OCxpGYeTxKn KY2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Q87dvJSM3OgzE3r2AUcnLwMIxfaNvinvqoBLHFQhDts=; b=jM4bn+vV78dr8fn1E6BcOgbqEgFzFXNN6hYDbLBUdldWuksQdKDe60msLHlN+8BspP pCehxFYwzVG23BOinHSkEQ+BkAgjGq64c1G2TPXK/Aijeb57iHeWyVt9W39tteCadr0T NwWvWSd++tSIP2ygT45nYSgqkGBLWKYdeMMGpkF5Dwyxug5vapUL86FCetS3Fk779Kyk SEuAvHsg4sgXw6X0A2QLXSC0FXZopbh4JxaihQQESc0j0RQ+lBC2/CUHYptBtqfUbvP5 cJ/4J2j1a3PwPnwddnewLkz1PJ5GoCri1bd8JLbqS0rKGpLnfkRgeZn3ryg1ySC/FRrl oofg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc41-20020a17090716a900b007c0dcc62e49si32387778ejc.56.2023.01.23.11.07.29; Mon, 23 Jan 2023 11:07:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231752AbjAWTG2 (ORCPT + 99 others); Mon, 23 Jan 2023 14:06:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231501AbjAWTG0 (ORCPT ); Mon, 23 Jan 2023 14:06:26 -0500 Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1166C2FCF6 for ; Mon, 23 Jan 2023 11:06:23 -0800 (PST) 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-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755841427688972276?= X-GMAIL-MSGID: =?utf-8?q?1755841427688972276?= 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"; + }; +};