From patchwork Thu Feb 20 13:04:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13983904 X-Patchwork-Delegate: geert@linux-m68k.org Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1747D1F63E8; Thu, 20 Feb 2025 13:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056684; cv=none; b=eAtem/jNq2GzwQ1WpMWQwB/MJQmSuPQwL2PBrHKLcQrjEwVpoOYEG+japynUO46M11ObgCo8VTT64jbGEdVbvRWmaQaBnNw/c57WcwuZmdnS0kQoLMFSryTri7OxSaff2ZmyGWA2ctP2A2iAvglO4kJGG3Bw3NFWSmlXzKeB+rE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056684; c=relaxed/simple; bh=QnNGMwHBs7bPPDzaJS7jitHji+MEZ8dHSZ7c6QuO+q0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Kwx/I6j8kdDS25Pnd1r9p3GVEGLApjsOwXlKJ760E984UkjBAS+JTCN7Iv7jtTeo7pi/OKnZ8T44hWwt07jKOzGZiScNSNd4RanIhclpx0JcmMoKmxVdpuwKwpQgy/AXM02PkDC9+OEijOl3YQ+Ma+WP69PoYgRCqqpov/AVcvM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: mZYL3PD4REqa9MO4SLsmfA== X-CSE-MsgGUID: By8a1dv5RQmrChPs5u5XgQ== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 20 Feb 2025 22:04:40 +0900 Received: from localhost.localdomain (unknown [10.226.92.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id C632F42B36D8; Thu, 20 Feb 2025 22:04:35 +0900 (JST) From: Biju Das To: Marc Kleine-Budde , Vincent Mailhol , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm Cc: Biju Das , Fabrizio Castro , Simon Horman , Duy Nguyen , linux-can@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das Subject: [PATCH v2 1/7] dt-bindings: can: renesas,rcar-canfd: Simplify the conditional schema Date: Thu, 20 Feb 2025 13:04:17 +0000 Message-ID: <20250220130427.217342-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> References: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 RZ/G3E SoC has 20 interrupts, 2 resets and 6 channels that need more branching with conditional schema. Simplify the conditional schema with if statements rather than the complex if-else statements to prepare for supporting RZ/G3E SoC. Signed-off-by: Biju Das Acked-by: Conor Dooley --- This patch depend upon [1] [1] https://lore.kernel.org/all/20250220094516.126598-2-biju.das.jz@bp.renesas.com/ v1->v2: * No change --- .../bindings/net/can/renesas,rcar-canfd.yaml | 123 ++++++++++++------ 1 file changed, 80 insertions(+), 43 deletions(-) diff --git a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml index f6884f6e59e7..f87f90f431e5 100644 --- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml +++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml @@ -45,7 +45,35 @@ properties: reg: maxItems: 1 - interrupts: true + interrupts: + oneOf: + - items: + - description: Channel interrupt + - description: Global interrupt + - items: + - description: CAN global error interrupt + - description: CAN receive FIFO interrupt + - description: CAN0 error interrupt + - description: CAN0 transmit interrupt + - description: CAN0 transmit/receive FIFO receive completion interrupt + - description: CAN1 error interrupt + - description: CAN1 transmit interrupt + - description: CAN1 transmit/receive FIFO receive completion interrupt + + interrupt-names: + oneOf: + - items: + - const: ch_int + - const: g_int + - items: + - const: g_err + - const: g_recc + - const: ch0_err + - const: ch0_rec + - const: ch0_trx + - const: ch1_err + - const: ch1_rec + - const: ch1_trx clocks: maxItems: 3 @@ -117,52 +145,71 @@ allOf: then: properties: interrupts: - items: - - description: CAN global error interrupt - - description: CAN receive FIFO interrupt - - description: CAN0 error interrupt - - description: CAN0 transmit interrupt - - description: CAN0 transmit/receive FIFO receive completion interrupt - - description: CAN1 error interrupt - - description: CAN1 transmit interrupt - - description: CAN1 transmit/receive FIFO receive completion interrupt + minItems: 8 + maxItems: 8 interrupt-names: - items: - - const: g_err - - const: g_recc - - const: ch0_err - - const: ch0_rec - - const: ch0_trx - - const: ch1_err - - const: ch1_rec - - const: ch1_trx + minItems: 8 + maxItems: 8 + - if: + properties: + compatible: + contains: + enum: + - renesas,rcar-gen3-canfd + - renesas,rcar-gen4-canfd + then: + properties: + interrupts: + minItems: 2 + maxItems: 2 + + interrupt-names: + minItems: 2 + maxItems: 2 + + - if: + properties: + compatible: + contains: + const: renesas,rzg2l-canfd + then: + properties: resets: + minItems: 2 maxItems: 2 reset-names: - items: - - const: rstp_n - - const: rstc_n + minItems: 2 + maxItems: 2 required: - reset-names - else: - properties: - interrupts: - items: - - description: Channel interrupt - - description: Global interrupt - - interrupt-names: - items: - - const: ch_int - - const: g_int + - if: + properties: + compatible: + contains: + enum: + - renesas,rcar-gen3-canfd + - renesas,rcar-gen4-canfd + then: + properties: resets: maxItems: 1 + - if: + properties: + compatible: + contains: + enum: + - renesas,rcar-gen3-canfd + - renesas,rzg2l-canfd + then: + patternProperties: + "^channel[2-7]$": false + - if: properties: compatible: @@ -171,16 +218,6 @@ allOf: then: patternProperties: "^channel[4-7]$": false - else: - if: - not: - properties: - compatible: - contains: - const: renesas,rcar-gen4-canfd - then: - patternProperties: - "^channel[2-7]$": false unevaluatedProperties: false From patchwork Thu Feb 20 13:04:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13983905 X-Patchwork-Delegate: geert@linux-m68k.org Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD3781F76B5; Thu, 20 Feb 2025 13:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056688; cv=none; b=UWCbYnD1keghIAzQqGaVJTIeEKQCJbeGsV1ZzQVfUaotyESSoVWxpvcZK1rkFQGt9Lt/cwa1wHyiLXLjKuRistxjmcaaK+auaCkxknwkejhNz179hdk2eYkzCKPjYWVdUyb+vDyb6+koabLA2DtmgzIWVLtXn3MfVSAhXDyj+Ag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056688; c=relaxed/simple; bh=MJDckZ0T+HwzpSqe4utVaHsghh+7mIeyiZRErV9rYdI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VIACfwb53fqyJYDov4G3L3aFBSTsgs3oDWEUQ/nqtgwn17ezl7zZguNyu/coaAtY+Fnxy3syYUrzssIwGrVxpzFt/w+dDf0/OIDxKDGLK9HhwgCnNO5U6Oz9/RLHOUcrE2c857P82Sb21+jAjAPQa4ZF1ttK3F1lwoBxDW/ZwQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: aUXqi2ZZQay0RlVTPlzRMA== X-CSE-MsgGUID: IC36kelaTqSMmuPFBUDFLA== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 20 Feb 2025 22:04:45 +0900 Received: from localhost.localdomain (unknown [10.226.92.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 089B042B36D6; Thu, 20 Feb 2025 22:04:40 +0900 (JST) From: Biju Das To: Marc Kleine-Budde , Vincent Mailhol , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm Cc: Biju Das , Fabrizio Castro , Simon Horman , Duy Nguyen , linux-can@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das Subject: [PATCH v2 2/7] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support Date: Thu, 20 Feb 2025 13:04:18 +0000 Message-ID: <20250220130427.217342-3-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> References: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Document support for the CAN-FD Interface on the RZ/G3E (R9A09G047) SoC, which supports up to six channels. The CAN-FD module on RZ/G3E is very similar to the one on both R-Car V4H and RZ/G2L, but differs in some hardware parameters: * No external clock, but instead has ram clock. * Support up to 6 channels. * 20 interrupts. Signed-off-by: Biju Das --- v1->v2: * No change. --- .../bindings/net/can/renesas,rcar-canfd.yaml | 67 +++++++++++++++++-- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml index f87f90f431e5..189d5303ad75 100644 --- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml +++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml @@ -42,6 +42,8 @@ properties: - renesas,r9a07g054-canfd # RZ/V2L - const: renesas,rzg2l-canfd # RZ/G2L family + - const: renesas,r9a09g047-canfd # RZ/G3E + reg: maxItems: 1 @@ -59,6 +61,19 @@ properties: - description: CAN1 error interrupt - description: CAN1 transmit interrupt - description: CAN1 transmit/receive FIFO receive completion interrupt + - description: CAN2 error interrupt + - description: CAN2 transmit interrupt + - description: CAN2 transmit/receive FIFO receive completion interrupt + - description: CAN3 error interrupt + - description: CAN3 transmit interrupt + - description: CAN3 transmit/receive FIFO receive completion interrupt + - description: CAN4 error interrupt + - description: CAN4 transmit interrupt + - description: CAN4 transmit/receive FIFO receive completion interrupt + - description: CAN5 error interrupt + - description: CAN5 transmit interrupt + - description: CAN5 transmit/receive FIFO receive completion interrupt + minItems: 8 interrupt-names: oneOf: @@ -74,15 +89,33 @@ properties: - const: ch1_err - const: ch1_rec - const: ch1_trx + - const: ch2_err + - const: ch2_rec + - const: ch2_trx + - const: ch3_err + - const: ch3_rec + - const: ch3_trx + - const: ch4_err + - const: ch4_rec + - const: ch4_trx + - const: ch5_err + - const: ch5_rec + - const: ch5_trx + minItems: 8 clocks: maxItems: 3 clock-names: - items: - - const: fck - - const: canfd - - const: can_clk + oneOf: + - items: + - const: fck + - const: canfd + - const: can_clk + - items: + - const: fck + - const: ram_clk + - const: can_clk power-domains: maxItems: 1 @@ -173,7 +206,9 @@ allOf: properties: compatible: contains: - const: renesas,rzg2l-canfd + enum: + - renesas,r9a09g047-canfd + - renesas,rzg2l-canfd then: properties: resets: @@ -187,6 +222,19 @@ allOf: required: - reset-names + - if: + properties: + compatible: + contains: + const: renesas,r9a09g047-canfd + then: + properties: + interrupts: + maxItems: 20 + + interrupt-names: + maxItems: 20 + - if: properties: compatible: @@ -219,6 +267,15 @@ allOf: patternProperties: "^channel[4-7]$": false + - if: + properties: + compatible: + contains: + const: renesas,r9a09g047-canfd + then: + patternProperties: + "^channel[6-7]$": false + unevaluatedProperties: false examples: From patchwork Thu Feb 20 13:04:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13983906 X-Patchwork-Delegate: geert@linux-m68k.org Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0914D1F76B5; Thu, 20 Feb 2025 13:04:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056691; cv=none; b=F6RiJGZVQsmF3FvV1sWj7ztkhxHdJgFigkeH9dG5CYyNWhCkIQdKMY4iLcMmHyfScrd88k+hnuY4+0QRifmXDJfEncXqhrkk79cakiZU3IzIgoP+7QPAzOH3i/jFvRLOLu8VSTk2DnegXPsvs989fLCWM1sqPUXuKwVyX8i7wTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056691; c=relaxed/simple; bh=UwE+9lXUEKVKM4ln1rjdsdjoJ4UkrJerFYIMjw4N1Ps=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SxGtVjv4mWiE0V007sIAF8sj3B3j8AMO7a7N+bFk13uAKlpZOlZ1uwAKewvKIrukbCGRN9T8D/WLdSMcIjFL+jqf9oU9fmDfHo3B0aEuB70KaQD9bM2GYL5oU2YTFmL83weE+mXiJ+oTZFnomnhrtYCqyfEXJInpMz9LgYq2x5M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: 9rCZ/zr3S22XougzjTGRig== X-CSE-MsgGUID: zSt89Nl7S8ySxizgwZAoBA== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 20 Feb 2025 22:04:49 +0900 Received: from localhost.localdomain (unknown [10.226.92.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 3AC3342B36D6; Thu, 20 Feb 2025 22:04:45 +0900 (JST) From: Biju Das To: Marc Kleine-Budde , Vincent Mailhol Cc: Biju Das , Geert Uytterhoeven , Wolfram Sang , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Rob Herring , Ulrich Hecht , linux-can@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das , linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 3/7] can: rcar_canfd: Use of_get_available_child_by_name() Date: Thu, 20 Feb 2025 13:04:19 +0000 Message-ID: <20250220130427.217342-4-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> References: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Simplify rcar_canfd_probe() using of_get_available_child_by_name(). While at it, move of_node_put(child) inside the if block to avoid additional check if of_child is NULL. Reviewed-by: Vincent Mailhol Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven --- v2: * Added to this series as dependency patch hit on can-next. * Added Rb tag from Vincent Mailhol * Dropped redundant comment from commit description. --- drivers/net/can/rcar/rcar_canfd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c index 270f50d836f5..8b326977ddf7 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -1864,13 +1864,13 @@ static int rcar_canfd_probe(struct platform_device *pdev) for (i = 0; i < info->max_channels; ++i) { name[7] = '0' + i; - of_child = of_get_child_by_name(dev->of_node, name); - if (of_child && of_device_is_available(of_child)) { + of_child = of_get_available_child_by_name(dev->of_node, name); + if (of_child) { channels_mask |= BIT(i); transceivers[i] = devm_of_phy_optional_get(dev, of_child, NULL); + of_node_put(of_child); } - of_node_put(of_child); if (IS_ERR(transceivers[i])) return PTR_ERR(transceivers[i]); } From patchwork Thu Feb 20 13:04:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13983907 X-Patchwork-Delegate: geert@linux-m68k.org Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC4E51F6694; Thu, 20 Feb 2025 13:04:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056696; cv=none; b=GT3qgm23UZnHvVeoIjBUVKkZMaicboPmUsU1TTjgzFDsa/viObK1DFr+VdWoMNwGwx4QzuUhnCtP/cgij7W/+50+204Gmu4Q7QLFNyzUJqhvlmiMeHZFz5XFZc7yAitm8GB8Zriuisgxt2uO8pOuVUGoyPOgsQYzAEcSSOWeEig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056696; c=relaxed/simple; bh=avSU492k1TpeyBaiJ6d+8nFcaTlKueWSvhbKozu78pY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OIq8b1LaVsctzN29iwXtqmVfYoLLBJGBnPV1Gi034B8IN64hwM2EvxpafRTncVqd3f+U1tttIdgrSGsxo+3vccikwoYzH8MPTOaC3i1cee9NgQNv4b/6mZX6vdNlKpWw3Q3GCjvYqLu8wyrGhNvl92qpAm3fVuAz8RzPxAKagXI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: zbA9Ls0IQwi6k2z58HF52w== X-CSE-MsgGUID: ck+/fgFbQgOXd1IJVbWlZw== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 20 Feb 2025 22:04:53 +0900 Received: from localhost.localdomain (unknown [10.226.92.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 57EFB42B36D8; Thu, 20 Feb 2025 22:04:50 +0900 (JST) From: Biju Das To: Marc Kleine-Budde , Vincent Mailhol Cc: Biju Das , Wolfram Sang , Geert Uytterhoeven , =?utf-8?q?Uwe_Kleine-K=C3=B6n?= =?utf-8?q?ig?= , linux-can@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das , linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 4/7] can: rcar_canfd: Add gen4_type variable to struct rcar_canfd_hw_info Date: Thu, 20 Feb 2025 13:04:20 +0000 Message-ID: <20250220130427.217342-5-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> References: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Both R-Car Gen4 and RZ/G3E SoCs have similar register layout. Introduce gen4_type variable to struct rcar_canfd_hw_info for the preparation of adding RZ/G3E driver support. Signed-off-by: Biju Das --- v1->v2: * No change. --- drivers/net/can/rcar/rcar_canfd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c index 8b326977ddf7..13eb6aa6ae45 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -516,6 +516,7 @@ struct rcar_canfd_hw_info { /* hardware features */ unsigned shared_global_irqs:1; /* Has shared global irqs */ unsigned multi_channel_irqs:1; /* Has multiple channel irqs */ + unsigned gen4_type:1; /* Has gen4 type reg layout */ }; /* Channel priv data */ @@ -596,6 +597,7 @@ static const struct rcar_canfd_hw_info rcar_gen4_hw_info = { .max_channels = 8, .postdiv = 2, .shared_global_irqs = 1, + .gen4_type = 1, }; static const struct rcar_canfd_hw_info rzg2l_hw_info = { @@ -607,7 +609,7 @@ static const struct rcar_canfd_hw_info rzg2l_hw_info = { /* Helper functions */ static inline bool is_gen4(struct rcar_canfd_global *gpriv) { - return gpriv->info == &rcar_gen4_hw_info; + return gpriv->info->gen4_type; } static inline u32 reg_gen4(struct rcar_canfd_global *gpriv, From patchwork Thu Feb 20 13:04:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13983908 X-Patchwork-Delegate: geert@linux-m68k.org Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD8361F6694; Thu, 20 Feb 2025 13:04:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056699; cv=none; b=coKKkT4NeXTmeAH5h/oG+MZ7Tw144GTWgLoJxG3qlU1brkoDbZz1+T0uesV5KvjkWJG1sLqL8TOk+rX5ZYSn4bVVIWrJjvkU8POEN/mRc+XHvfbTwQ0ptE+oMrhiWMHOzAbZv+XFP66ivayVzWxNtKp2nDbVbpY3ZwhLaGRCzro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056699; c=relaxed/simple; bh=Akk6srXG20NqYY2lsjMlHfVFPw1xFZdnBRw2HFC0a+k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JMnRqXn+q3b/dQmj4U2dl1FiN72uszlYRVcYjg/ocfbLLvlBY5htZuEmz8LZMyF1bBDHIm8qd3nJK7BNWP3itzLCXc1PkleEtxgXBQxMzpQoMDgXL0wzSJ+N7BTfRHUb4C4w9TOWJ1fVM37k13d+0BmMozymf+ZoRMZ/SHu7/GU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: CGE1nMMcTwWoChvtSd+THA== X-CSE-MsgGUID: FkgdgEySQ9Wz8FxRzb66Bg== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 20 Feb 2025 22:04:56 +0900 Received: from localhost.localdomain (unknown [10.226.92.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id E909942B36D8; Thu, 20 Feb 2025 22:04:53 +0900 (JST) From: Biju Das To: Marc Kleine-Budde , Vincent Mailhol Cc: Biju Das , Wolfram Sang , Geert Uytterhoeven , =?utf-8?q?Uwe_Kleine-K=C3=B6n?= =?utf-8?q?ig?= , linux-can@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das , linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 5/7] can: rcar_canfd: Add only_internal_clks variable to struct rcar_canfd_hw_info Date: Thu, 20 Feb 2025 13:04:21 +0000 Message-ID: <20250220130427.217342-6-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> References: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 All SoCs supports extenal clock, but RZ/G3E has only internal clocks. Add only_internal_clks to struct rcar_canfd_hw_info to handle this difference. Signed-off-by: Biju Das --- v1->v2: * No change. --- drivers/net/can/rcar/rcar_canfd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c index 13eb6aa6ae45..f353a9d560e8 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -517,6 +517,7 @@ struct rcar_canfd_hw_info { unsigned shared_global_irqs:1; /* Has shared global irqs */ unsigned multi_channel_irqs:1; /* Has multiple channel irqs */ unsigned gen4_type:1; /* Has gen4 type reg layout */ + unsigned only_internal_clks:1; /* Has only internal clocks */ }; /* Channel priv data */ @@ -1943,7 +1944,7 @@ static int rcar_canfd_probe(struct platform_device *pdev) fcan_freq = clk_get_rate(gpriv->can_clk) / info->postdiv; } else { fcan_freq = clk_get_rate(gpriv->can_clk); - gpriv->extclk = true; + gpriv->extclk = !gpriv->info->only_internal_clks; } addr = devm_platform_ioremap_resource(pdev, 0); From patchwork Thu Feb 20 13:04:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13983909 X-Patchwork-Delegate: geert@linux-m68k.org Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 27D6C1F6694; Thu, 20 Feb 2025 13:05:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056702; cv=none; b=sT2qSY8Fy+uxD8hwC5e5a8B8tOIwii+8ziRiOqlm2LU5Z21Ui8OZnuf6TwZprQppVlSo8ez3qkQhQR7mJC14c/kD9EyILNxbq6tdX/rzCE68f4FHUhO11ypayGn9eE0BHrd5nhj2gE5hL+c0u8bv+hQg/VNu/G4p4XHzghEOvL0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056702; c=relaxed/simple; bh=sRipYo2nz4oHqSK8yvPcMHxObFNNWIl1sR3X4mia0L4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ScJ8kdlU0Vmb9t3RfEesDsvZxKm5nrMgiN1xsO+XP4fwTjVwCvyuNctFpJ/8wfzp06DmEaMyirxLSsQAfJbez0+CAekin+LQX2ZePEyBp4EJsIUsMdGBJUV2Y1xb8Q/Qf8aPS3ht0XKzatIWKzl7w+89W/wprsRJhXtiqUVCsXk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: R/LmcRYAR12828T9RCTYYw== X-CSE-MsgGUID: We60qvn+S3Ksxq+F+NkVJg== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 20 Feb 2025 22:05:00 +0900 Received: from localhost.localdomain (unknown [10.226.92.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 7D7D842B36D8; Thu, 20 Feb 2025 22:04:57 +0900 (JST) From: Biju Das To: Marc Kleine-Budde , Vincent Mailhol Cc: Biju Das , Wolfram Sang , Geert Uytterhoeven , =?utf-8?q?Uwe_Kleine-K=C3=B6n?= =?utf-8?q?ig?= , linux-can@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das , linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 6/7] can: rcar_canfd: Enhance multi_channel_irqs handling Date: Thu, 20 Feb 2025 13:04:22 +0000 Message-ID: <20250220130427.217342-7-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> References: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently multi_channel_irqs has only 2 channels. But RZ/G3E has six channels. Enhance multi_channel_irqs handling to support more than two channels. Signed-off-by: Biju Das --- v1->v2: * No change. --- drivers/net/can/rcar/rcar_canfd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c index f353a9d560e8..bf2561168e98 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -1748,16 +1748,19 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, if (info->multi_channel_irqs) { char *irq_name; + char name[10]; int err_irq; int tx_irq; - err_irq = platform_get_irq_byname(pdev, ch == 0 ? "ch0_err" : "ch1_err"); + scnprintf(name, 10, "ch%u_err", ch); + err_irq = platform_get_irq_byname(pdev, name); if (err_irq < 0) { err = err_irq; goto fail; } - tx_irq = platform_get_irq_byname(pdev, ch == 0 ? "ch0_trx" : "ch1_trx"); + scnprintf(name, 10, "ch%u_trx", ch); + tx_irq = platform_get_irq_byname(pdev, name); if (tx_irq < 0) { err = tx_irq; goto fail; From patchwork Thu Feb 20 13:04:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13983910 X-Patchwork-Delegate: geert@linux-m68k.org Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BDFDC1F6694; Thu, 20 Feb 2025 13:05:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056706; cv=none; b=ZDRUIUEP5Ev7i0+q02aaIcK28oy+oscQ53wtaXMXoFkuMYmlmXkJy3SzLdI6WJeegu7zzvArkovwYjLTp7C1MC8hau/NWZFrt1QgBGH4oRFnWGqUKBpucZOrRLwmm+EOKuaxlwnPQEZhXiLMET0uSLYW0hiKhueW994PX6UZ160= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740056706; c=relaxed/simple; bh=clsoHouoGOfq6VRePgM5/+uiMLZhzape7XlSvjtzISA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JqBHRe5CuRT3mhyvurO7tRt2Ssv4yOLRm7t6vf9yTAEUkNku+/7pF3sZgg8/clGDsvC/9QaJpBLvJSdMSbe3G1FqfuOjQwUnDwVvsbJVuRpGksHx5V6rGpiNaWTYSpvi4EZij3b9wDF7gJ+sh+jSrZVyrLtbzDxppoT/Tjm8iGI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: DgD8et3ASrOxYQXB5+v3rg== X-CSE-MsgGUID: asbsuzU2RkG5aThDPEyIjg== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 20 Feb 2025 22:05:04 +0900 Received: from localhost.localdomain (unknown [10.226.92.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 1AE0E42B36D6; Thu, 20 Feb 2025 22:05:00 +0900 (JST) From: Biju Das To: Marc Kleine-Budde , Vincent Mailhol Cc: Biju Das , Wolfram Sang , Geert Uytterhoeven , =?utf-8?q?Uwe_Kleine-K=C3=B6n?= =?utf-8?q?ig?= , linux-can@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das , linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 7/7] can: rcar_canfd: Add RZ/G3E support Date: Thu, 20 Feb 2025 13:04:23 +0000 Message-ID: <20250220130427.217342-8-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> References: <20250220130427.217342-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The CAN-FD IP found on the RZ/G3E SoC is similar to R-Car Gen4, but it has no external clock instead it has clk_ram, it has 6 channels and supports 20 interrupts. Add support for RZ/G3E CAN-FD driver. Signed-off-by: Biju Das --- v1->v2: * No change. --- drivers/net/can/rcar/rcar_canfd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c index bf2561168e98..667d091bbcc9 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -607,6 +607,14 @@ static const struct rcar_canfd_hw_info rzg2l_hw_info = { .multi_channel_irqs = 1, }; +static const struct rcar_canfd_hw_info r9a09g047_hw_info = { + .max_channels = 6, + .postdiv = 1, + .multi_channel_irqs = 1, + .gen4_type = 1, + .only_internal_clks = 1, +}; + /* Helper functions */ static inline bool is_gen4(struct rcar_canfd_global *gpriv) { @@ -1861,6 +1869,7 @@ static int rcar_canfd_probe(struct platform_device *pdev) u32 rule_entry = 0; bool fdmode = true; /* CAN FD only mode - default */ char name[9] = "channelX"; + struct clk *clk_ram; int i; info = of_device_get_match_data(dev); @@ -1950,6 +1959,11 @@ static int rcar_canfd_probe(struct platform_device *pdev) gpriv->extclk = !gpriv->info->only_internal_clks; } + clk_ram = devm_clk_get_optional_enabled(dev, "ram_clk"); + if (IS_ERR(clk_ram)) + return dev_err_probe(dev, PTR_ERR(clk_ram), + "cannot get ram clock\n"); + addr = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(addr)) { err = PTR_ERR(addr); @@ -2112,6 +2126,7 @@ static SIMPLE_DEV_PM_OPS(rcar_canfd_pm_ops, rcar_canfd_suspend, static const __maybe_unused struct of_device_id rcar_canfd_of_table[] = { { .compatible = "renesas,r8a779a0-canfd", .data = &rcar_gen4_hw_info }, + { .compatible = "renesas,r9a09g047-canfd", .data = &r9a09g047_hw_info }, { .compatible = "renesas,rcar-gen3-canfd", .data = &rcar_gen3_hw_info }, { .compatible = "renesas,rcar-gen4-canfd", .data = &rcar_gen4_hw_info }, { .compatible = "renesas,rzg2l-canfd", .data = &rzg2l_hw_info },