* [PATCH v3 0/3] Renesas RZ/G2L CANFD support @ 2021-07-21 19:49 Lad Prabhakar 2021-07-21 19:49 ` [PATCH v3 1/3] dt-bindings: net: can: renesas,rcar-canfd: Document RZ/G2L SoC Lad Prabhakar ` (2 more replies) 0 siblings, 3 replies; 17+ messages in thread From: Lad Prabhakar @ 2021-07-21 19:49 UTC (permalink / raw) To: Geert Uytterhoeven, Rob Herring, Fabrizio Castro, Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller, Jakub Kicinski, Philipp Zabel, linux-can, netdev, devicetree Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar Hi All, This patch series adds CANFD support to Renesas RZ/G2L family. CANFD block on RZ/G2L SoC is almost identical to one found on R-Car Gen3 SoC's. On RZ/G2L SoC interrupt sources for each channel are split into individual sources. Cheers, Prabhakar Changes for v3: * Dropped core clock addition patches from this series (its queued up already in renesas-clk-for-v5.15) * Added reset-names in binding doc as suggested by Philipp * Updated interrupt names in binding doc as suggested by Geert * Updated the driver to handle the above DT binding changes Changes for v2: * Added interrupt-names property and marked it as required for RZ/G2L family * Added descriptions for reset property * Re-used irq handlers on RZ/G2L SoC * Added new enum for chip_id * Dropped R9A07G044_LAST_CORE_CLK * Dropped patch (clk: renesas: r9a07g044-cpg: Add clock and reset entries for CANFD) as its been merged into renesas tree Lad Prabhakar (3): dt-bindings: net: can: renesas,rcar-canfd: Document RZ/G2L SoC can: rcar_canfd: Add support for RZ/G2L family arm64: dts: renesas: r9a07g044: Add CANFD node .../bindings/net/can/renesas,rcar-canfd.yaml | 69 ++++++- arch/arm64/boot/dts/renesas/r9a07g044.dtsi | 41 +++++ drivers/net/can/rcar/rcar_canfd.c | 173 +++++++++++++++--- 3 files changed, 253 insertions(+), 30 deletions(-) -- 2.17.1 ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v3 1/3] dt-bindings: net: can: renesas,rcar-canfd: Document RZ/G2L SoC 2021-07-21 19:49 [PATCH v3 0/3] Renesas RZ/G2L CANFD support Lad Prabhakar @ 2021-07-21 19:49 ` Lad Prabhakar 2021-07-26 22:46 ` Rob Herring 2021-07-21 19:49 ` [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family Lad Prabhakar 2021-07-21 19:49 ` [PATCH v3 3/3] arm64: dts: renesas: r9a07g044: Add CANFD node Lad Prabhakar 2 siblings, 1 reply; 17+ messages in thread From: Lad Prabhakar @ 2021-07-21 19:49 UTC (permalink / raw) To: Geert Uytterhoeven, Rob Herring, Fabrizio Castro, Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller, Jakub Kicinski, Philipp Zabel, linux-can, netdev, devicetree Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar Add CANFD binding documentation for Renesas RZ/G2L SoC. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> --- .../bindings/net/can/renesas,rcar-canfd.yaml | 69 +++++++++++++++++-- 1 file changed, 63 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml index 0b33ba9ccb47..546c6e6d2fb0 100644 --- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml +++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml @@ -30,13 +30,15 @@ properties: - renesas,r8a77995-canfd # R-Car D3 - const: renesas,rcar-gen3-canfd # R-Car Gen3 and RZ/G2 + - items: + - enum: + - renesas,r9a07g044-canfd # RZ/G2{L,LC} + - const: renesas,rzg2l-canfd # RZ/G2L family + reg: maxItems: 1 - interrupts: - items: - - description: Channel interrupt - - description: Global interrupt + interrupts: true clocks: maxItems: 3 @@ -50,8 +52,7 @@ properties: power-domains: maxItems: 1 - resets: - maxItems: 1 + resets: true renesas,no-can-fd: $ref: /schemas/types.yaml#/definitions/flag @@ -91,6 +92,62 @@ required: - channel0 - channel1 +if: + properties: + compatible: + contains: + enum: + - renesas,rzg2l-canfd +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 + + 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 + + resets: + maxItems: 2 + + reset-names: + items: + - const: rstp_n + - const: rstc_n + + required: + - interrupt-names + - reset-names +else: + properties: + interrupts: + items: + - description: Channel interrupt + - description: Global interrupt + + interrupt-names: + items: + - const: ch_int + - const: g_int + + resets: + maxItems: 1 + unevaluatedProperties: false examples: -- 2.17.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v3 1/3] dt-bindings: net: can: renesas,rcar-canfd: Document RZ/G2L SoC 2021-07-21 19:49 ` [PATCH v3 1/3] dt-bindings: net: can: renesas,rcar-canfd: Document RZ/G2L SoC Lad Prabhakar @ 2021-07-26 22:46 ` Rob Herring 0 siblings, 0 replies; 17+ messages in thread From: Rob Herring @ 2021-07-26 22:46 UTC (permalink / raw) To: Lad Prabhakar Cc: Wolfgang Grandegger, Jakub Kicinski, Philipp Zabel, Biju Das, devicetree, Geert Uytterhoeven, linux-renesas-soc, Prabhakar, David S. Miller, Marc Kleine-Budde, Fabrizio Castro, linux-can, netdev, Rob Herring, linux-kernel On Wed, 21 Jul 2021 20:49:49 +0100, Lad Prabhakar wrote: > Add CANFD binding documentation for Renesas RZ/G2L SoC. > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> > --- > .../bindings/net/can/renesas,rcar-canfd.yaml | 69 +++++++++++++++++-- > 1 file changed, 63 insertions(+), 6 deletions(-) > Reviewed-by: Rob Herring <robh@kernel.org> ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family 2021-07-21 19:49 [PATCH v3 0/3] Renesas RZ/G2L CANFD support Lad Prabhakar 2021-07-21 19:49 ` [PATCH v3 1/3] dt-bindings: net: can: renesas,rcar-canfd: Document RZ/G2L SoC Lad Prabhakar @ 2021-07-21 19:49 ` Lad Prabhakar 2021-07-25 5:39 ` kernel test robot 2021-07-26 9:53 ` Geert Uytterhoeven 2021-07-21 19:49 ` [PATCH v3 3/3] arm64: dts: renesas: r9a07g044: Add CANFD node Lad Prabhakar 2 siblings, 2 replies; 17+ messages in thread From: Lad Prabhakar @ 2021-07-21 19:49 UTC (permalink / raw) To: Geert Uytterhoeven, Rob Herring, Fabrizio Castro, Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller, Jakub Kicinski, Philipp Zabel, linux-can, netdev, devicetree Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar CANFD block on RZ/G2L SoC is almost identical to one found on R-Car Gen3 SoC's. On RZ/G2L SoC interrupt sources for each channel are split into different sources and the IP doesn't divide (1/2) CANFD clock within the IP. This patch adds compatible string for RZ/G2L family and registers the irq handlers required for CANFD operation. IRQ numbers are now fetched based on names instead of indices. For backward compatibility on non RZ/G2L SoC's we fallback reading based on indices. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> --- drivers/net/can/rcar/rcar_canfd.c | 173 +++++++++++++++++++++++++----- 1 file changed, 149 insertions(+), 24 deletions(-) diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c index 311e6ca3bdc4..04747573fc48 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -37,9 +37,15 @@ #include <linux/bitmap.h> #include <linux/bitops.h> #include <linux/iopoll.h> +#include <linux/reset.h> #define RCANFD_DRV_NAME "rcar_canfd" +enum rcanfd_chip_id { + RENESAS_RCAR_GEN3 = 0, + RENESAS_RZG2L, +}; + /* Global register bits */ /* RSCFDnCFDGRMCFG */ @@ -513,6 +519,9 @@ struct rcar_canfd_global { enum rcar_canfd_fcanclk fcan; /* CANFD or Ext clock */ unsigned long channels_mask; /* Enabled channels mask */ bool fdmode; /* CAN FD or Classical CAN only mode */ + struct reset_control *rstc1; + struct reset_control *rstc2; + enum rcanfd_chip_id chip_id; }; /* CAN FD mode nominal rate constants */ @@ -1577,6 +1586,53 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, priv->can.clock.freq = fcan_freq; dev_info(&pdev->dev, "can_clk rate is %u\n", priv->can.clock.freq); + if (gpriv->chip_id == RENESAS_RZG2L) { + char *irq_name; + int err_irq; + int tx_irq; + + err_irq = platform_get_irq_byname(pdev, ch == 0 ? "ch0_err" : "ch1_err"); + if (err_irq < 0) { + err = err_irq; + goto fail; + } + + tx_irq = platform_get_irq_byname(pdev, ch == 0 ? "ch0_trx" : "ch1_trx"); + if (tx_irq < 0) { + err = tx_irq; + goto fail; + } + + irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, + "canfd.ch%d_err", ch); + if (!irq_name) { + err = -ENOMEM; + goto fail; + } + err = devm_request_irq(&pdev->dev, err_irq, + rcar_canfd_channel_interrupt, 0, + irq_name, gpriv); + if (err) { + dev_err(&pdev->dev, "devm_request_irq CH Err(%d) failed, error %d\n", + err_irq, err); + goto fail; + } + irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, + "canfd.ch%d_trx", ch); + if (!irq_name) { + err = -ENOMEM; + goto fail; + } + err = devm_request_irq(&pdev->dev, tx_irq, + rcar_canfd_channel_interrupt, 0, + irq_name, gpriv); + if (err) { + dev_err(&pdev->dev, "devm_request_irq Tx (%d) failed, error %d\n", + tx_irq, err); + goto fail; + } + } + if (gpriv->fdmode) { priv->can.bittiming_const = &rcar_canfd_nom_bittiming_const; priv->can.data_bittiming_const = @@ -1636,7 +1692,11 @@ static int rcar_canfd_probe(struct platform_device *pdev) struct device_node *of_child; unsigned long channels_mask = 0; int err, ch_irq, g_irq; + int g_err_irq, g_recc_irq; bool fdmode = true; /* CAN FD only mode - default */ + enum rcanfd_chip_id chip_id; + + chip_id = (enum rcanfd_chip_id)of_device_get_match_data(&pdev->dev); if (of_property_read_bool(pdev->dev.of_node, "renesas,no-can-fd")) fdmode = false; /* Classical CAN only mode */ @@ -1649,16 +1709,30 @@ static int rcar_canfd_probe(struct platform_device *pdev) if (of_child && of_device_is_available(of_child)) channels_mask |= BIT(1); /* Channel 1 */ - ch_irq = platform_get_irq(pdev, 0); - if (ch_irq < 0) { - err = ch_irq; - goto fail_dev; - } + if (chip_id == RENESAS_RCAR_GEN3) { + ch_irq = platform_get_irq_byname_optional(pdev, "ch_int"); + if (ch_irq < 0) { + /* For backward compatibility get irq by index */ + ch_irq = platform_get_irq(pdev, 0); + if (ch_irq < 0) + return ch_irq; + } - g_irq = platform_get_irq(pdev, 1); - if (g_irq < 0) { - err = g_irq; - goto fail_dev; + g_irq = platform_get_irq_byname_optional(pdev, "g_int"); + if (g_irq < 0) { + /* For backward compatibility get irq by index */ + g_irq = platform_get_irq(pdev, 1); + if (g_irq < 0) + return g_irq; + } + } else { + g_err_irq = platform_get_irq_byname(pdev, "g_err"); + if (g_err_irq < 0) + return g_err_irq; + + g_recc_irq = platform_get_irq_byname(pdev, "g_recc"); + if (g_recc_irq < 0) + return g_recc_irq; } /* Global controller context */ @@ -1670,6 +1744,19 @@ static int rcar_canfd_probe(struct platform_device *pdev) gpriv->pdev = pdev; gpriv->channels_mask = channels_mask; gpriv->fdmode = fdmode; + gpriv->chip_id = chip_id; + + if (gpriv->chip_id == RENESAS_RZG2L) { + gpriv->rstc1 = devm_reset_control_get_exclusive(&pdev->dev, "rstp_n"); + if (IS_ERR(gpriv->rstc1)) + return dev_err_probe(&pdev->dev, PTR_ERR(gpriv->rstc1), + "failed to get rstp_n\n"); + + gpriv->rstc2 = devm_reset_control_get_exclusive(&pdev->dev, "rstc_n"); + if (IS_ERR(gpriv->rstc2)) + return dev_err_probe(&pdev->dev, PTR_ERR(gpriv->rstc2), + "failed to get rstc_n\n"); + } /* Peripheral clock */ gpriv->clkp = devm_clk_get(&pdev->dev, "fck"); @@ -1699,7 +1786,7 @@ static int rcar_canfd_probe(struct platform_device *pdev) } fcan_freq = clk_get_rate(gpriv->can_clk); - if (gpriv->fcan == RCANFD_CANFDCLK) + if (gpriv->fcan == RCANFD_CANFDCLK && gpriv->chip_id == RENESAS_RCAR_GEN3) /* CANFD clock is further divided by (1/2) within the IP */ fcan_freq /= 2; @@ -1711,20 +1798,51 @@ static int rcar_canfd_probe(struct platform_device *pdev) gpriv->base = addr; /* Request IRQ that's common for both channels */ - err = devm_request_irq(&pdev->dev, ch_irq, - rcar_canfd_channel_interrupt, 0, - "canfd.chn", gpriv); - if (err) { - dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", - ch_irq, err); - goto fail_dev; + if (gpriv->chip_id == RENESAS_RCAR_GEN3) { + err = devm_request_irq(&pdev->dev, ch_irq, + rcar_canfd_channel_interrupt, 0, + "canfd.ch_int", gpriv); + if (err) { + dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", + ch_irq, err); + goto fail_dev; + } + + err = devm_request_irq(&pdev->dev, g_irq, + rcar_canfd_global_interrupt, 0, + "canfd.g_int", gpriv); + if (err) { + dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", + g_irq, err); + goto fail_dev; + } + } else { + err = devm_request_irq(&pdev->dev, g_recc_irq, + rcar_canfd_global_interrupt, 0, + "canfd.g_recc", gpriv); + + if (err) { + dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", + g_recc_irq, err); + goto fail_dev; + } + + err = devm_request_irq(&pdev->dev, g_err_irq, + rcar_canfd_global_interrupt, 0, + "canfd.g_err", gpriv); + if (err) { + dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", + g_err_irq, err); + goto fail_dev; + } } - err = devm_request_irq(&pdev->dev, g_irq, - rcar_canfd_global_interrupt, 0, - "canfd.gbl", gpriv); + + err = reset_control_reset(gpriv->rstc1); + if (err) + goto fail_dev; + err = reset_control_reset(gpriv->rstc2); if (err) { - dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", - g_irq, err); + reset_control_assert(gpriv->rstc1); goto fail_dev; } @@ -1733,7 +1851,7 @@ static int rcar_canfd_probe(struct platform_device *pdev) if (err) { dev_err(&pdev->dev, "failed to enable peripheral clock, error %d\n", err); - goto fail_dev; + goto fail_reset; } err = rcar_canfd_reset_controller(gpriv); @@ -1790,6 +1908,9 @@ static int rcar_canfd_probe(struct platform_device *pdev) rcar_canfd_disable_global_interrupts(gpriv); fail_clk: clk_disable_unprepare(gpriv->clkp); +fail_reset: + reset_control_assert(gpriv->rstc1); + reset_control_assert(gpriv->rstc2); fail_dev: return err; } @@ -1810,6 +1931,9 @@ static int rcar_canfd_remove(struct platform_device *pdev) /* Enter global sleep mode */ rcar_canfd_set_bit(gpriv->base, RCANFD_GCTR, RCANFD_GCTR_GSLPR); clk_disable_unprepare(gpriv->clkp); + reset_control_assert(gpriv->rstc1); + reset_control_assert(gpriv->rstc2); + return 0; } @@ -1827,7 +1951,8 @@ static SIMPLE_DEV_PM_OPS(rcar_canfd_pm_ops, rcar_canfd_suspend, rcar_canfd_resume); static const struct of_device_id rcar_canfd_of_table[] = { - { .compatible = "renesas,rcar-gen3-canfd" }, + { .compatible = "renesas,rcar-gen3-canfd", .data = (void *)RENESAS_RCAR_GEN3 }, + { .compatible = "renesas,rzg2l-canfd", .data = (void *)RENESAS_RZG2L }, { } }; -- 2.17.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family 2021-07-21 19:49 ` [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family Lad Prabhakar @ 2021-07-25 5:39 ` kernel test robot 2021-07-26 9:53 ` Geert Uytterhoeven 1 sibling, 0 replies; 17+ messages in thread From: kernel test robot @ 2021-07-25 5:39 UTC (permalink / raw) To: Lad Prabhakar, Geert Uytterhoeven, Rob Herring, Fabrizio Castro, Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller, Jakub Kicinski, Philipp Zabel, linux-can Cc: clang-built-linux, kbuild-all, netdev [-- Attachment #1: Type: text/plain, Size: 10231 bytes --] Hi Lad, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on renesas-devel/next] [also build test WARNING on v5.14-rc2 next-20210723] [cannot apply to mkl-can-next/testing robh/for-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 base: https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next config: arm64-randconfig-r031-20210723 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9625ca5b602616b2f5584e8a49ba93c52c141e40) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/0day-ci/linux/commit/082d605e73c5922419a736aa9ecd3a76c0241bf7 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 git checkout 082d605e73c5922419a736aa9ecd3a76c0241bf7 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/net/can/rcar/rcar_canfd.c:1699:12: warning: cast to smaller integer type 'enum rcanfd_chip_id' from 'const void *' [-Wvoid-pointer-to-enum-cast] chip_id = (enum rcanfd_chip_id)of_device_get_match_data(&pdev->dev); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. vim +1699 drivers/net/can/rcar/rcar_canfd.c 1686 1687 static int rcar_canfd_probe(struct platform_device *pdev) 1688 { 1689 void __iomem *addr; 1690 u32 sts, ch, fcan_freq; 1691 struct rcar_canfd_global *gpriv; 1692 struct device_node *of_child; 1693 unsigned long channels_mask = 0; 1694 int err, ch_irq, g_irq; 1695 int g_err_irq, g_recc_irq; 1696 bool fdmode = true; /* CAN FD only mode - default */ 1697 enum rcanfd_chip_id chip_id; 1698 > 1699 chip_id = (enum rcanfd_chip_id)of_device_get_match_data(&pdev->dev); 1700 1701 if (of_property_read_bool(pdev->dev.of_node, "renesas,no-can-fd")) 1702 fdmode = false; /* Classical CAN only mode */ 1703 1704 of_child = of_get_child_by_name(pdev->dev.of_node, "channel0"); 1705 if (of_child && of_device_is_available(of_child)) 1706 channels_mask |= BIT(0); /* Channel 0 */ 1707 1708 of_child = of_get_child_by_name(pdev->dev.of_node, "channel1"); 1709 if (of_child && of_device_is_available(of_child)) 1710 channels_mask |= BIT(1); /* Channel 1 */ 1711 1712 if (chip_id == RENESAS_RCAR_GEN3) { 1713 ch_irq = platform_get_irq_byname_optional(pdev, "ch_int"); 1714 if (ch_irq < 0) { 1715 /* For backward compatibility get irq by index */ 1716 ch_irq = platform_get_irq(pdev, 0); 1717 if (ch_irq < 0) 1718 return ch_irq; 1719 } 1720 1721 g_irq = platform_get_irq_byname_optional(pdev, "g_int"); 1722 if (g_irq < 0) { 1723 /* For backward compatibility get irq by index */ 1724 g_irq = platform_get_irq(pdev, 1); 1725 if (g_irq < 0) 1726 return g_irq; 1727 } 1728 } else { 1729 g_err_irq = platform_get_irq_byname(pdev, "g_err"); 1730 if (g_err_irq < 0) 1731 return g_err_irq; 1732 1733 g_recc_irq = platform_get_irq_byname(pdev, "g_recc"); 1734 if (g_recc_irq < 0) 1735 return g_recc_irq; 1736 } 1737 1738 /* Global controller context */ 1739 gpriv = devm_kzalloc(&pdev->dev, sizeof(*gpriv), GFP_KERNEL); 1740 if (!gpriv) { 1741 err = -ENOMEM; 1742 goto fail_dev; 1743 } 1744 gpriv->pdev = pdev; 1745 gpriv->channels_mask = channels_mask; 1746 gpriv->fdmode = fdmode; 1747 gpriv->chip_id = chip_id; 1748 1749 if (gpriv->chip_id == RENESAS_RZG2L) { 1750 gpriv->rstc1 = devm_reset_control_get_exclusive(&pdev->dev, "rstp_n"); 1751 if (IS_ERR(gpriv->rstc1)) 1752 return dev_err_probe(&pdev->dev, PTR_ERR(gpriv->rstc1), 1753 "failed to get rstp_n\n"); 1754 1755 gpriv->rstc2 = devm_reset_control_get_exclusive(&pdev->dev, "rstc_n"); 1756 if (IS_ERR(gpriv->rstc2)) 1757 return dev_err_probe(&pdev->dev, PTR_ERR(gpriv->rstc2), 1758 "failed to get rstc_n\n"); 1759 } 1760 1761 /* Peripheral clock */ 1762 gpriv->clkp = devm_clk_get(&pdev->dev, "fck"); 1763 if (IS_ERR(gpriv->clkp)) { 1764 err = PTR_ERR(gpriv->clkp); 1765 dev_err(&pdev->dev, "cannot get peripheral clock, error %d\n", 1766 err); 1767 goto fail_dev; 1768 } 1769 1770 /* fCAN clock: Pick External clock. If not available fallback to 1771 * CANFD clock 1772 */ 1773 gpriv->can_clk = devm_clk_get(&pdev->dev, "can_clk"); 1774 if (IS_ERR(gpriv->can_clk) || (clk_get_rate(gpriv->can_clk) == 0)) { 1775 gpriv->can_clk = devm_clk_get(&pdev->dev, "canfd"); 1776 if (IS_ERR(gpriv->can_clk)) { 1777 err = PTR_ERR(gpriv->can_clk); 1778 dev_err(&pdev->dev, 1779 "cannot get canfd clock, error %d\n", err); 1780 goto fail_dev; 1781 } 1782 gpriv->fcan = RCANFD_CANFDCLK; 1783 1784 } else { 1785 gpriv->fcan = RCANFD_EXTCLK; 1786 } 1787 fcan_freq = clk_get_rate(gpriv->can_clk); 1788 1789 if (gpriv->fcan == RCANFD_CANFDCLK && gpriv->chip_id == RENESAS_RCAR_GEN3) 1790 /* CANFD clock is further divided by (1/2) within the IP */ 1791 fcan_freq /= 2; 1792 1793 addr = devm_platform_ioremap_resource(pdev, 0); 1794 if (IS_ERR(addr)) { 1795 err = PTR_ERR(addr); 1796 goto fail_dev; 1797 } 1798 gpriv->base = addr; 1799 1800 /* Request IRQ that's common for both channels */ 1801 if (gpriv->chip_id == RENESAS_RCAR_GEN3) { 1802 err = devm_request_irq(&pdev->dev, ch_irq, 1803 rcar_canfd_channel_interrupt, 0, 1804 "canfd.ch_int", gpriv); 1805 if (err) { 1806 dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", 1807 ch_irq, err); 1808 goto fail_dev; 1809 } 1810 1811 err = devm_request_irq(&pdev->dev, g_irq, 1812 rcar_canfd_global_interrupt, 0, 1813 "canfd.g_int", gpriv); 1814 if (err) { 1815 dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", 1816 g_irq, err); 1817 goto fail_dev; 1818 } 1819 } else { 1820 err = devm_request_irq(&pdev->dev, g_recc_irq, 1821 rcar_canfd_global_interrupt, 0, 1822 "canfd.g_recc", gpriv); 1823 1824 if (err) { 1825 dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", 1826 g_recc_irq, err); 1827 goto fail_dev; 1828 } 1829 1830 err = devm_request_irq(&pdev->dev, g_err_irq, 1831 rcar_canfd_global_interrupt, 0, 1832 "canfd.g_err", gpriv); 1833 if (err) { 1834 dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", 1835 g_err_irq, err); 1836 goto fail_dev; 1837 } 1838 } 1839 1840 err = reset_control_reset(gpriv->rstc1); 1841 if (err) 1842 goto fail_dev; 1843 err = reset_control_reset(gpriv->rstc2); 1844 if (err) { 1845 reset_control_assert(gpriv->rstc1); 1846 goto fail_dev; 1847 } 1848 1849 /* Enable peripheral clock for register access */ 1850 err = clk_prepare_enable(gpriv->clkp); 1851 if (err) { 1852 dev_err(&pdev->dev, 1853 "failed to enable peripheral clock, error %d\n", err); 1854 goto fail_reset; 1855 } 1856 1857 err = rcar_canfd_reset_controller(gpriv); 1858 if (err) { 1859 dev_err(&pdev->dev, "reset controller failed\n"); 1860 goto fail_clk; 1861 } 1862 1863 /* Controller in Global reset & Channel reset mode */ 1864 rcar_canfd_configure_controller(gpriv); 1865 1866 /* Configure per channel attributes */ 1867 for_each_set_bit(ch, &gpriv->channels_mask, RCANFD_NUM_CHANNELS) { 1868 /* Configure Channel's Rx fifo */ 1869 rcar_canfd_configure_rx(gpriv, ch); 1870 1871 /* Configure Channel's Tx (Common) fifo */ 1872 rcar_canfd_configure_tx(gpriv, ch); 1873 1874 /* Configure receive rules */ 1875 rcar_canfd_configure_afl_rules(gpriv, ch); 1876 } 1877 1878 /* Configure common interrupts */ 1879 rcar_canfd_enable_global_interrupts(gpriv); 1880 1881 /* Start Global operation mode */ 1882 rcar_canfd_update_bit(gpriv->base, RCANFD_GCTR, RCANFD_GCTR_GMDC_MASK, 1883 RCANFD_GCTR_GMDC_GOPM); 1884 1885 /* Verify mode change */ 1886 err = readl_poll_timeout((gpriv->base + RCANFD_GSTS), sts, 1887 !(sts & RCANFD_GSTS_GNOPM), 2, 500000); 1888 if (err) { 1889 dev_err(&pdev->dev, "global operational mode failed\n"); 1890 goto fail_mode; 1891 } 1892 1893 for_each_set_bit(ch, &gpriv->channels_mask, RCANFD_NUM_CHANNELS) { 1894 err = rcar_canfd_channel_probe(gpriv, ch, fcan_freq); 1895 if (err) 1896 goto fail_channel; 1897 } 1898 1899 platform_set_drvdata(pdev, gpriv); 1900 dev_info(&pdev->dev, "global operational state (clk %d, fdmode %d)\n", 1901 gpriv->fcan, gpriv->fdmode); 1902 return 0; 1903 1904 fail_channel: 1905 for_each_set_bit(ch, &gpriv->channels_mask, RCANFD_NUM_CHANNELS) 1906 rcar_canfd_channel_remove(gpriv, ch); 1907 fail_mode: 1908 rcar_canfd_disable_global_interrupts(gpriv); 1909 fail_clk: 1910 clk_disable_unprepare(gpriv->clkp); 1911 fail_reset: 1912 reset_control_assert(gpriv->rstc1); 1913 reset_control_assert(gpriv->rstc2); 1914 fail_dev: 1915 return err; 1916 } 1917 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 51713 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family @ 2021-07-25 5:39 ` kernel test robot 0 siblings, 0 replies; 17+ messages in thread From: kernel test robot @ 2021-07-25 5:39 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 10509 bytes --] Hi Lad, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on renesas-devel/next] [also build test WARNING on v5.14-rc2 next-20210723] [cannot apply to mkl-can-next/testing robh/for-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 base: https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next config: arm64-randconfig-r031-20210723 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9625ca5b602616b2f5584e8a49ba93c52c141e40) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/0day-ci/linux/commit/082d605e73c5922419a736aa9ecd3a76c0241bf7 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 git checkout 082d605e73c5922419a736aa9ecd3a76c0241bf7 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/net/can/rcar/rcar_canfd.c:1699:12: warning: cast to smaller integer type 'enum rcanfd_chip_id' from 'const void *' [-Wvoid-pointer-to-enum-cast] chip_id = (enum rcanfd_chip_id)of_device_get_match_data(&pdev->dev); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. vim +1699 drivers/net/can/rcar/rcar_canfd.c 1686 1687 static int rcar_canfd_probe(struct platform_device *pdev) 1688 { 1689 void __iomem *addr; 1690 u32 sts, ch, fcan_freq; 1691 struct rcar_canfd_global *gpriv; 1692 struct device_node *of_child; 1693 unsigned long channels_mask = 0; 1694 int err, ch_irq, g_irq; 1695 int g_err_irq, g_recc_irq; 1696 bool fdmode = true; /* CAN FD only mode - default */ 1697 enum rcanfd_chip_id chip_id; 1698 > 1699 chip_id = (enum rcanfd_chip_id)of_device_get_match_data(&pdev->dev); 1700 1701 if (of_property_read_bool(pdev->dev.of_node, "renesas,no-can-fd")) 1702 fdmode = false; /* Classical CAN only mode */ 1703 1704 of_child = of_get_child_by_name(pdev->dev.of_node, "channel0"); 1705 if (of_child && of_device_is_available(of_child)) 1706 channels_mask |= BIT(0); /* Channel 0 */ 1707 1708 of_child = of_get_child_by_name(pdev->dev.of_node, "channel1"); 1709 if (of_child && of_device_is_available(of_child)) 1710 channels_mask |= BIT(1); /* Channel 1 */ 1711 1712 if (chip_id == RENESAS_RCAR_GEN3) { 1713 ch_irq = platform_get_irq_byname_optional(pdev, "ch_int"); 1714 if (ch_irq < 0) { 1715 /* For backward compatibility get irq by index */ 1716 ch_irq = platform_get_irq(pdev, 0); 1717 if (ch_irq < 0) 1718 return ch_irq; 1719 } 1720 1721 g_irq = platform_get_irq_byname_optional(pdev, "g_int"); 1722 if (g_irq < 0) { 1723 /* For backward compatibility get irq by index */ 1724 g_irq = platform_get_irq(pdev, 1); 1725 if (g_irq < 0) 1726 return g_irq; 1727 } 1728 } else { 1729 g_err_irq = platform_get_irq_byname(pdev, "g_err"); 1730 if (g_err_irq < 0) 1731 return g_err_irq; 1732 1733 g_recc_irq = platform_get_irq_byname(pdev, "g_recc"); 1734 if (g_recc_irq < 0) 1735 return g_recc_irq; 1736 } 1737 1738 /* Global controller context */ 1739 gpriv = devm_kzalloc(&pdev->dev, sizeof(*gpriv), GFP_KERNEL); 1740 if (!gpriv) { 1741 err = -ENOMEM; 1742 goto fail_dev; 1743 } 1744 gpriv->pdev = pdev; 1745 gpriv->channels_mask = channels_mask; 1746 gpriv->fdmode = fdmode; 1747 gpriv->chip_id = chip_id; 1748 1749 if (gpriv->chip_id == RENESAS_RZG2L) { 1750 gpriv->rstc1 = devm_reset_control_get_exclusive(&pdev->dev, "rstp_n"); 1751 if (IS_ERR(gpriv->rstc1)) 1752 return dev_err_probe(&pdev->dev, PTR_ERR(gpriv->rstc1), 1753 "failed to get rstp_n\n"); 1754 1755 gpriv->rstc2 = devm_reset_control_get_exclusive(&pdev->dev, "rstc_n"); 1756 if (IS_ERR(gpriv->rstc2)) 1757 return dev_err_probe(&pdev->dev, PTR_ERR(gpriv->rstc2), 1758 "failed to get rstc_n\n"); 1759 } 1760 1761 /* Peripheral clock */ 1762 gpriv->clkp = devm_clk_get(&pdev->dev, "fck"); 1763 if (IS_ERR(gpriv->clkp)) { 1764 err = PTR_ERR(gpriv->clkp); 1765 dev_err(&pdev->dev, "cannot get peripheral clock, error %d\n", 1766 err); 1767 goto fail_dev; 1768 } 1769 1770 /* fCAN clock: Pick External clock. If not available fallback to 1771 * CANFD clock 1772 */ 1773 gpriv->can_clk = devm_clk_get(&pdev->dev, "can_clk"); 1774 if (IS_ERR(gpriv->can_clk) || (clk_get_rate(gpriv->can_clk) == 0)) { 1775 gpriv->can_clk = devm_clk_get(&pdev->dev, "canfd"); 1776 if (IS_ERR(gpriv->can_clk)) { 1777 err = PTR_ERR(gpriv->can_clk); 1778 dev_err(&pdev->dev, 1779 "cannot get canfd clock, error %d\n", err); 1780 goto fail_dev; 1781 } 1782 gpriv->fcan = RCANFD_CANFDCLK; 1783 1784 } else { 1785 gpriv->fcan = RCANFD_EXTCLK; 1786 } 1787 fcan_freq = clk_get_rate(gpriv->can_clk); 1788 1789 if (gpriv->fcan == RCANFD_CANFDCLK && gpriv->chip_id == RENESAS_RCAR_GEN3) 1790 /* CANFD clock is further divided by (1/2) within the IP */ 1791 fcan_freq /= 2; 1792 1793 addr = devm_platform_ioremap_resource(pdev, 0); 1794 if (IS_ERR(addr)) { 1795 err = PTR_ERR(addr); 1796 goto fail_dev; 1797 } 1798 gpriv->base = addr; 1799 1800 /* Request IRQ that's common for both channels */ 1801 if (gpriv->chip_id == RENESAS_RCAR_GEN3) { 1802 err = devm_request_irq(&pdev->dev, ch_irq, 1803 rcar_canfd_channel_interrupt, 0, 1804 "canfd.ch_int", gpriv); 1805 if (err) { 1806 dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", 1807 ch_irq, err); 1808 goto fail_dev; 1809 } 1810 1811 err = devm_request_irq(&pdev->dev, g_irq, 1812 rcar_canfd_global_interrupt, 0, 1813 "canfd.g_int", gpriv); 1814 if (err) { 1815 dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", 1816 g_irq, err); 1817 goto fail_dev; 1818 } 1819 } else { 1820 err = devm_request_irq(&pdev->dev, g_recc_irq, 1821 rcar_canfd_global_interrupt, 0, 1822 "canfd.g_recc", gpriv); 1823 1824 if (err) { 1825 dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", 1826 g_recc_irq, err); 1827 goto fail_dev; 1828 } 1829 1830 err = devm_request_irq(&pdev->dev, g_err_irq, 1831 rcar_canfd_global_interrupt, 0, 1832 "canfd.g_err", gpriv); 1833 if (err) { 1834 dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", 1835 g_err_irq, err); 1836 goto fail_dev; 1837 } 1838 } 1839 1840 err = reset_control_reset(gpriv->rstc1); 1841 if (err) 1842 goto fail_dev; 1843 err = reset_control_reset(gpriv->rstc2); 1844 if (err) { 1845 reset_control_assert(gpriv->rstc1); 1846 goto fail_dev; 1847 } 1848 1849 /* Enable peripheral clock for register access */ 1850 err = clk_prepare_enable(gpriv->clkp); 1851 if (err) { 1852 dev_err(&pdev->dev, 1853 "failed to enable peripheral clock, error %d\n", err); 1854 goto fail_reset; 1855 } 1856 1857 err = rcar_canfd_reset_controller(gpriv); 1858 if (err) { 1859 dev_err(&pdev->dev, "reset controller failed\n"); 1860 goto fail_clk; 1861 } 1862 1863 /* Controller in Global reset & Channel reset mode */ 1864 rcar_canfd_configure_controller(gpriv); 1865 1866 /* Configure per channel attributes */ 1867 for_each_set_bit(ch, &gpriv->channels_mask, RCANFD_NUM_CHANNELS) { 1868 /* Configure Channel's Rx fifo */ 1869 rcar_canfd_configure_rx(gpriv, ch); 1870 1871 /* Configure Channel's Tx (Common) fifo */ 1872 rcar_canfd_configure_tx(gpriv, ch); 1873 1874 /* Configure receive rules */ 1875 rcar_canfd_configure_afl_rules(gpriv, ch); 1876 } 1877 1878 /* Configure common interrupts */ 1879 rcar_canfd_enable_global_interrupts(gpriv); 1880 1881 /* Start Global operation mode */ 1882 rcar_canfd_update_bit(gpriv->base, RCANFD_GCTR, RCANFD_GCTR_GMDC_MASK, 1883 RCANFD_GCTR_GMDC_GOPM); 1884 1885 /* Verify mode change */ 1886 err = readl_poll_timeout((gpriv->base + RCANFD_GSTS), sts, 1887 !(sts & RCANFD_GSTS_GNOPM), 2, 500000); 1888 if (err) { 1889 dev_err(&pdev->dev, "global operational mode failed\n"); 1890 goto fail_mode; 1891 } 1892 1893 for_each_set_bit(ch, &gpriv->channels_mask, RCANFD_NUM_CHANNELS) { 1894 err = rcar_canfd_channel_probe(gpriv, ch, fcan_freq); 1895 if (err) 1896 goto fail_channel; 1897 } 1898 1899 platform_set_drvdata(pdev, gpriv); 1900 dev_info(&pdev->dev, "global operational state (clk %d, fdmode %d)\n", 1901 gpriv->fcan, gpriv->fdmode); 1902 return 0; 1903 1904 fail_channel: 1905 for_each_set_bit(ch, &gpriv->channels_mask, RCANFD_NUM_CHANNELS) 1906 rcar_canfd_channel_remove(gpriv, ch); 1907 fail_mode: 1908 rcar_canfd_disable_global_interrupts(gpriv); 1909 fail_clk: 1910 clk_disable_unprepare(gpriv->clkp); 1911 fail_reset: 1912 reset_control_assert(gpriv->rstc1); 1913 reset_control_assert(gpriv->rstc2); 1914 fail_dev: 1915 return err; 1916 } 1917 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org [-- Attachment #2: config.gz --] [-- Type: application/gzip, Size: 51713 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family 2021-07-25 5:39 ` kernel test robot @ 2021-07-25 9:46 ` Marc Kleine-Budde -1 siblings, 0 replies; 17+ messages in thread From: Marc Kleine-Budde @ 2021-07-25 9:46 UTC (permalink / raw) To: kernel test robot Cc: Lad Prabhakar, Geert Uytterhoeven, Rob Herring, Fabrizio Castro, Wolfgang Grandegger, David S. Miller, Jakub Kicinski, Philipp Zabel, linux-can, clang-built-linux, kbuild-all, netdev [-- Attachment #1: Type: text/plain, Size: 2622 bytes --] On 25.07.2021 13:39:37, kernel test robot wrote: > Hi Lad, > > Thank you for the patch! Perhaps something to improve: > > [auto build test WARNING on renesas-devel/next] > [also build test WARNING on v5.14-rc2 next-20210723] > [cannot apply to mkl-can-next/testing robh/for-next] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > > url: https://github.com/0day-ci/linux/commits/Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 > base: https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next > config: arm64-randconfig-r031-20210723 (attached as .config) > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9625ca5b602616b2f5584e8a49ba93c52c141e40) > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # install arm64 cross compiling tool for clang build > # apt-get install binutils-aarch64-linux-gnu > # https://github.com/0day-ci/linux/commit/082d605e73c5922419a736aa9ecd3a76c0241bf7 > git remote add linux-review https://github.com/0day-ci/linux > git fetch --no-tags linux-review Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 > git checkout 082d605e73c5922419a736aa9ecd3a76c0241bf7 > # save the attached .config to linux build tree > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > All warnings (new ones prefixed by >>): > > >> drivers/net/can/rcar/rcar_canfd.c:1699:12: warning: cast to smaller integer type 'enum rcanfd_chip_id' from 'const void *' [-Wvoid-pointer-to-enum-cast] > chip_id = (enum rcanfd_chip_id)of_device_get_match_data(&pdev->dev); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 1 warning generated. Seems we need the cast (uintptr_t), that I asked you to remove. Can you test if | chip_id = (enum rcanfd_chip_id)(uintptr_t)of_device_get_match_data(&pdev->dev); works? Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family @ 2021-07-25 9:46 ` Marc Kleine-Budde 0 siblings, 0 replies; 17+ messages in thread From: Marc Kleine-Budde @ 2021-07-25 9:46 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 2622 bytes --] On 25.07.2021 13:39:37, kernel test robot wrote: > Hi Lad, > > Thank you for the patch! Perhaps something to improve: > > [auto build test WARNING on renesas-devel/next] > [also build test WARNING on v5.14-rc2 next-20210723] > [cannot apply to mkl-can-next/testing robh/for-next] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > > url: https://github.com/0day-ci/linux/commits/Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 > base: https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next > config: arm64-randconfig-r031-20210723 (attached as .config) > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9625ca5b602616b2f5584e8a49ba93c52c141e40) > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # install arm64 cross compiling tool for clang build > # apt-get install binutils-aarch64-linux-gnu > # https://github.com/0day-ci/linux/commit/082d605e73c5922419a736aa9ecd3a76c0241bf7 > git remote add linux-review https://github.com/0day-ci/linux > git fetch --no-tags linux-review Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 > git checkout 082d605e73c5922419a736aa9ecd3a76c0241bf7 > # save the attached .config to linux build tree > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > All warnings (new ones prefixed by >>): > > >> drivers/net/can/rcar/rcar_canfd.c:1699:12: warning: cast to smaller integer type 'enum rcanfd_chip_id' from 'const void *' [-Wvoid-pointer-to-enum-cast] > chip_id = (enum rcanfd_chip_id)of_device_get_match_data(&pdev->dev); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 1 warning generated. Seems we need the cast (uintptr_t), that I asked you to remove. Can you test if | chip_id = (enum rcanfd_chip_id)(uintptr_t)of_device_get_match_data(&pdev->dev); works? Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family 2021-07-25 9:46 ` Marc Kleine-Budde @ 2021-07-26 8:06 ` Geert Uytterhoeven -1 siblings, 0 replies; 17+ messages in thread From: Geert Uytterhoeven @ 2021-07-26 8:06 UTC (permalink / raw) To: Marc Kleine-Budde Cc: kernel test robot, Lad Prabhakar, Rob Herring, Fabrizio Castro, Wolfgang Grandegger, David S. Miller, Jakub Kicinski, Philipp Zabel, linux-can, clang-built-linux, kbuild-all, netdev Hi Marc, On Sun, Jul 25, 2021 at 11:46 AM Marc Kleine-Budde <mkl@pengutronix.de> wrote: > On 25.07.2021 13:39:37, kernel test robot wrote: > > [auto build test WARNING on renesas-devel/next] > > [also build test WARNING on v5.14-rc2 next-20210723] > > [cannot apply to mkl-can-next/testing robh/for-next] > > [If your patch is applied to the wrong git tree, kindly drop us a note. > > And when submitting patch, we suggest to use '--base' as documented in > > https://git-scm.com/docs/git-format-patch] > > > > url: https://github.com/0day-ci/linux/commits/Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 > > base: https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next > > config: arm64-randconfig-r031-20210723 (attached as .config) > > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9625ca5b602616b2f5584e8a49ba93c52c141e40) > > reproduce (this is a W=1 build): > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # install arm64 cross compiling tool for clang build > > # apt-get install binutils-aarch64-linux-gnu > > # https://github.com/0day-ci/linux/commit/082d605e73c5922419a736aa9ecd3a76c0241bf7 > > git remote add linux-review https://github.com/0day-ci/linux > > git fetch --no-tags linux-review Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 > > git checkout 082d605e73c5922419a736aa9ecd3a76c0241bf7 > > # save the attached .config to linux build tree > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 > > > > If you fix the issue, kindly add following tag as appropriate > > Reported-by: kernel test robot <lkp@intel.com> > > > > All warnings (new ones prefixed by >>): > > > > >> drivers/net/can/rcar/rcar_canfd.c:1699:12: warning: cast to smaller integer type 'enum rcanfd_chip_id' from 'const void *' [-Wvoid-pointer-to-enum-cast] > > chip_id = (enum rcanfd_chip_id)of_device_get_match_data(&pdev->dev); > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > 1 warning generated. > > Seems we need the cast (uintptr_t), that I asked you to remove. Can you Bummer, I had seen your comment while reading email on my phone, but forgot to reply when I got back to my computer... > test if > > | chip_id = (enum rcanfd_chip_id)(uintptr_t)of_device_get_match_data(&pdev->dev); > > works? Just chip_id = (uintptr_t)of_device_get_match_data(&pdev->dev); should be fine. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family @ 2021-07-26 8:06 ` Geert Uytterhoeven 0 siblings, 0 replies; 17+ messages in thread From: Geert Uytterhoeven @ 2021-07-26 8:06 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 3003 bytes --] Hi Marc, On Sun, Jul 25, 2021 at 11:46 AM Marc Kleine-Budde <mkl@pengutronix.de> wrote: > On 25.07.2021 13:39:37, kernel test robot wrote: > > [auto build test WARNING on renesas-devel/next] > > [also build test WARNING on v5.14-rc2 next-20210723] > > [cannot apply to mkl-can-next/testing robh/for-next] > > [If your patch is applied to the wrong git tree, kindly drop us a note. > > And when submitting patch, we suggest to use '--base' as documented in > > https://git-scm.com/docs/git-format-patch] > > > > url: https://github.com/0day-ci/linux/commits/Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 > > base: https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next > > config: arm64-randconfig-r031-20210723 (attached as .config) > > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9625ca5b602616b2f5584e8a49ba93c52c141e40) > > reproduce (this is a W=1 build): > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # install arm64 cross compiling tool for clang build > > # apt-get install binutils-aarch64-linux-gnu > > # https://github.com/0day-ci/linux/commit/082d605e73c5922419a736aa9ecd3a76c0241bf7 > > git remote add linux-review https://github.com/0day-ci/linux > > git fetch --no-tags linux-review Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 > > git checkout 082d605e73c5922419a736aa9ecd3a76c0241bf7 > > # save the attached .config to linux build tree > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 > > > > If you fix the issue, kindly add following tag as appropriate > > Reported-by: kernel test robot <lkp@intel.com> > > > > All warnings (new ones prefixed by >>): > > > > >> drivers/net/can/rcar/rcar_canfd.c:1699:12: warning: cast to smaller integer type 'enum rcanfd_chip_id' from 'const void *' [-Wvoid-pointer-to-enum-cast] > > chip_id = (enum rcanfd_chip_id)of_device_get_match_data(&pdev->dev); > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > 1 warning generated. > > Seems we need the cast (uintptr_t), that I asked you to remove. Can you Bummer, I had seen your comment while reading email on my phone, but forgot to reply when I got back to my computer... > test if > > | chip_id = (enum rcanfd_chip_id)(uintptr_t)of_device_get_match_data(&pdev->dev); > > works? Just chip_id = (uintptr_t)of_device_get_match_data(&pdev->dev); should be fine. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert(a)linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family 2021-07-26 8:06 ` Geert Uytterhoeven @ 2021-07-26 21:56 ` Lad, Prabhakar -1 siblings, 0 replies; 17+ messages in thread From: Lad, Prabhakar @ 2021-07-26 21:56 UTC (permalink / raw) To: Geert Uytterhoeven, Marc Kleine-Budde Cc: kernel test robot, Lad Prabhakar, Rob Herring, Fabrizio Castro, Wolfgang Grandegger, David S. Miller, Jakub Kicinski, Philipp Zabel, linux-can, clang-built-linux, kbuild-all, netdev Hi Geert, Marc, On Mon, Jul 26, 2021 at 9:07 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote: > > Hi Marc, > > On Sun, Jul 25, 2021 at 11:46 AM Marc Kleine-Budde <mkl@pengutronix.de> wrote: > > On 25.07.2021 13:39:37, kernel test robot wrote: > > > [auto build test WARNING on renesas-devel/next] > > > [also build test WARNING on v5.14-rc2 next-20210723] > > > [cannot apply to mkl-can-next/testing robh/for-next] > > > [If your patch is applied to the wrong git tree, kindly drop us a note. > > > And when submitting patch, we suggest to use '--base' as documented in > > > https://git-scm.com/docs/git-format-patch] > > > > > > url: https://github.com/0day-ci/linux/commits/Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 > > > base: https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next > > > config: arm64-randconfig-r031-20210723 (attached as .config) > > > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9625ca5b602616b2f5584e8a49ba93c52c141e40) > > > reproduce (this is a W=1 build): > > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > > chmod +x ~/bin/make.cross > > > # install arm64 cross compiling tool for clang build > > > # apt-get install binutils-aarch64-linux-gnu > > > # https://github.com/0day-ci/linux/commit/082d605e73c5922419a736aa9ecd3a76c0241bf7 > > > git remote add linux-review https://github.com/0day-ci/linux > > > git fetch --no-tags linux-review Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 > > > git checkout 082d605e73c5922419a736aa9ecd3a76c0241bf7 > > > # save the attached .config to linux build tree > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 > > > > > > If you fix the issue, kindly add following tag as appropriate > > > Reported-by: kernel test robot <lkp@intel.com> > > > > > > All warnings (new ones prefixed by >>): > > > > > > >> drivers/net/can/rcar/rcar_canfd.c:1699:12: warning: cast to smaller integer type 'enum rcanfd_chip_id' from 'const void *' [-Wvoid-pointer-to-enum-cast] > > > chip_id = (enum rcanfd_chip_id)of_device_get_match_data(&pdev->dev); > > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > 1 warning generated. > > > > Seems we need the cast (uintptr_t), that I asked you to remove. Can you > > Bummer, I had seen your comment while reading email on my phone, > but forgot to reply when I got back to my computer... > > > test if > > > > | chip_id = (enum rcanfd_chip_id)(uintptr_t)of_device_get_match_data(&pdev->dev); > > > > works? > > Just > > chip_id = (uintptr_t)of_device_get_match_data(&pdev->dev); > > should be fine. > Above works, cast is not required. Cheers, Prabhakar > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family @ 2021-07-26 21:56 ` Lad, Prabhakar 0 siblings, 0 replies; 17+ messages in thread From: Lad, Prabhakar @ 2021-07-26 21:56 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 3284 bytes --] Hi Geert, Marc, On Mon, Jul 26, 2021 at 9:07 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote: > > Hi Marc, > > On Sun, Jul 25, 2021 at 11:46 AM Marc Kleine-Budde <mkl@pengutronix.de> wrote: > > On 25.07.2021 13:39:37, kernel test robot wrote: > > > [auto build test WARNING on renesas-devel/next] > > > [also build test WARNING on v5.14-rc2 next-20210723] > > > [cannot apply to mkl-can-next/testing robh/for-next] > > > [If your patch is applied to the wrong git tree, kindly drop us a note. > > > And when submitting patch, we suggest to use '--base' as documented in > > > https://git-scm.com/docs/git-format-patch] > > > > > > url: https://github.com/0day-ci/linux/commits/Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 > > > base: https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next > > > config: arm64-randconfig-r031-20210723 (attached as .config) > > > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9625ca5b602616b2f5584e8a49ba93c52c141e40) > > > reproduce (this is a W=1 build): > > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > > chmod +x ~/bin/make.cross > > > # install arm64 cross compiling tool for clang build > > > # apt-get install binutils-aarch64-linux-gnu > > > # https://github.com/0day-ci/linux/commit/082d605e73c5922419a736aa9ecd3a76c0241bf7 > > > git remote add linux-review https://github.com/0day-ci/linux > > > git fetch --no-tags linux-review Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 > > > git checkout 082d605e73c5922419a736aa9ecd3a76c0241bf7 > > > # save the attached .config to linux build tree > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 > > > > > > If you fix the issue, kindly add following tag as appropriate > > > Reported-by: kernel test robot <lkp@intel.com> > > > > > > All warnings (new ones prefixed by >>): > > > > > > >> drivers/net/can/rcar/rcar_canfd.c:1699:12: warning: cast to smaller integer type 'enum rcanfd_chip_id' from 'const void *' [-Wvoid-pointer-to-enum-cast] > > > chip_id = (enum rcanfd_chip_id)of_device_get_match_data(&pdev->dev); > > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > 1 warning generated. > > > > Seems we need the cast (uintptr_t), that I asked you to remove. Can you > > Bummer, I had seen your comment while reading email on my phone, > but forgot to reply when I got back to my computer... > > > test if > > > > | chip_id = (enum rcanfd_chip_id)(uintptr_t)of_device_get_match_data(&pdev->dev); > > > > works? > > Just > > chip_id = (uintptr_t)of_device_get_match_data(&pdev->dev); > > should be fine. > Above works, cast is not required. Cheers, Prabhakar > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert(a)linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family 2021-07-21 19:49 ` [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family Lad Prabhakar 2021-07-25 5:39 ` kernel test robot @ 2021-07-26 9:53 ` Geert Uytterhoeven 2021-07-26 21:58 ` Lad, Prabhakar 1 sibling, 1 reply; 17+ messages in thread From: Geert Uytterhoeven @ 2021-07-26 9:53 UTC (permalink / raw) To: Lad Prabhakar Cc: Rob Herring, Fabrizio Castro, Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller, Jakub Kicinski, Philipp Zabel, linux-can, netdev, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux Kernel Mailing List, Linux-Renesas, Prabhakar, Biju Das Hi Prabhakar, On Wed, Jul 21, 2021 at 9:50 PM Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote: > CANFD block on RZ/G2L SoC is almost identical to one found on > R-Car Gen3 SoC's. On RZ/G2L SoC interrupt sources for each channel > are split into different sources and the IP doesn't divide (1/2) > CANFD clock within the IP. > > This patch adds compatible string for RZ/G2L family and registers > the irq handlers required for CANFD operation. IRQ numbers are now > fetched based on names instead of indices. For backward compatibility > on non RZ/G2L SoC's we fallback reading based on indices. > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Thanks for the update! I think you misunderstood my comment on v1 about the interrupt handlers, cfr. below. > --- a/drivers/net/can/rcar/rcar_canfd.c > +++ b/drivers/net/can/rcar/rcar_canfd.c > @@ -1577,6 +1586,53 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, > priv->can.clock.freq = fcan_freq; > dev_info(&pdev->dev, "can_clk rate is %u\n", priv->can.clock.freq); > > + if (gpriv->chip_id == RENESAS_RZG2L) { > + char *irq_name; > + int err_irq; > + int tx_irq; > + > + err_irq = platform_get_irq_byname(pdev, ch == 0 ? "ch0_err" : "ch1_err"); > + if (err_irq < 0) { > + err = err_irq; > + goto fail; > + } > + > + tx_irq = platform_get_irq_byname(pdev, ch == 0 ? "ch0_trx" : "ch1_trx"); > + if (tx_irq < 0) { > + err = tx_irq; > + goto fail; > + } > + > + irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, > + "canfd.ch%d_err", ch); > + if (!irq_name) { > + err = -ENOMEM; > + goto fail; > + } > + err = devm_request_irq(&pdev->dev, err_irq, > + rcar_canfd_channel_interrupt, 0, This is the same interrupt handler... > + irq_name, gpriv); > + if (err) { > + dev_err(&pdev->dev, "devm_request_irq CH Err(%d) failed, error %d\n", > + err_irq, err); > + goto fail; > + } > + irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, > + "canfd.ch%d_trx", ch); > + if (!irq_name) { > + err = -ENOMEM; > + goto fail; > + } > + err = devm_request_irq(&pdev->dev, tx_irq, > + rcar_canfd_channel_interrupt, 0, ... as this one. > + irq_name, gpriv); > + if (err) { > + dev_err(&pdev->dev, "devm_request_irq Tx (%d) failed, error %d\n", > + tx_irq, err); > + goto fail; > + } > + } > + > if (gpriv->fdmode) { > priv->can.bittiming_const = &rcar_canfd_nom_bittiming_const; > priv->can.data_bittiming_const = > @@ -1711,20 +1798,51 @@ static int rcar_canfd_probe(struct platform_device *pdev) > gpriv->base = addr; > > /* Request IRQ that's common for both channels */ > - err = devm_request_irq(&pdev->dev, ch_irq, > - rcar_canfd_channel_interrupt, 0, > - "canfd.chn", gpriv); > - if (err) { > - dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", > - ch_irq, err); > - goto fail_dev; > + if (gpriv->chip_id == RENESAS_RCAR_GEN3) { > + err = devm_request_irq(&pdev->dev, ch_irq, > + rcar_canfd_channel_interrupt, 0, > + "canfd.ch_int", gpriv); > + if (err) { > + dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", > + ch_irq, err); > + goto fail_dev; > + } > + > + err = devm_request_irq(&pdev->dev, g_irq, > + rcar_canfd_global_interrupt, 0, > + "canfd.g_int", gpriv); > + if (err) { > + dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", > + g_irq, err); > + goto fail_dev; > + } > + } else { > + err = devm_request_irq(&pdev->dev, g_recc_irq, > + rcar_canfd_global_interrupt, 0, This is the same interrupt handler... > + "canfd.g_recc", gpriv); > + > + if (err) { > + dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", > + g_recc_irq, err); > + goto fail_dev; > + } > + > + err = devm_request_irq(&pdev->dev, g_err_irq, > + rcar_canfd_global_interrupt, 0, ... as this one. > + "canfd.g_err", gpriv); > + if (err) { > + dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", > + g_err_irq, err); > + goto fail_dev; > + } > } > - err = devm_request_irq(&pdev->dev, g_irq, > - rcar_canfd_global_interrupt, 0, > - "canfd.gbl", gpriv); > + > + err = reset_control_reset(gpriv->rstc1); > + if (err) > + goto fail_dev; > + err = reset_control_reset(gpriv->rstc2); > if (err) { > - dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", > - g_irq, err); > + reset_control_assert(gpriv->rstc1); > goto fail_dev; > } I did not object to having fine-grained interrupt handlers on RZ/G2L. I did object to duplicating code in global and fine-grained interrupt handlers. The trick to have both is to let the global interrupt handlers call (conditionally) into the fine-grained handlers. In pseudo-code: global_interrupt_handler() { if (...) fine_grained_handler1(); if (...) fine_grained_handler2(); ... } On R-Car Gen3, you register the global interrupt handlers, as before. On RZ/G2L, you register the fine-grained interrupt handlers instead. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family 2021-07-26 9:53 ` Geert Uytterhoeven @ 2021-07-26 21:58 ` Lad, Prabhakar 0 siblings, 0 replies; 17+ messages in thread From: Lad, Prabhakar @ 2021-07-26 21:58 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Lad Prabhakar, Rob Herring, Fabrizio Castro, Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller, Jakub Kicinski, Philipp Zabel, linux-can, netdev, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, Linux Kernel Mailing List, Linux-Renesas, Biju Das Hi Geert, Thank you for the review. On Mon, Jul 26, 2021 at 10:53 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote: > > Hi Prabhakar, > > On Wed, Jul 21, 2021 at 9:50 PM Lad Prabhakar > <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote: > > CANFD block on RZ/G2L SoC is almost identical to one found on > > R-Car Gen3 SoC's. On RZ/G2L SoC interrupt sources for each channel > > are split into different sources and the IP doesn't divide (1/2) > > CANFD clock within the IP. > > > > This patch adds compatible string for RZ/G2L family and registers > > the irq handlers required for CANFD operation. IRQ numbers are now > > fetched based on names instead of indices. For backward compatibility > > on non RZ/G2L SoC's we fallback reading based on indices. > > > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > > Thanks for the update! > > I think you misunderstood my comment on v1 about the interrupt > handlers, cfr. below. > Argh my bad I took it the other way round! > > --- a/drivers/net/can/rcar/rcar_canfd.c > > +++ b/drivers/net/can/rcar/rcar_canfd.c > > > @@ -1577,6 +1586,53 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, > > priv->can.clock.freq = fcan_freq; > > dev_info(&pdev->dev, "can_clk rate is %u\n", priv->can.clock.freq); > > > > + if (gpriv->chip_id == RENESAS_RZG2L) { > > + char *irq_name; > > + int err_irq; > > + int tx_irq; > > + > > + err_irq = platform_get_irq_byname(pdev, ch == 0 ? "ch0_err" : "ch1_err"); > > + if (err_irq < 0) { > > + err = err_irq; > > + goto fail; > > + } > > + > > + tx_irq = platform_get_irq_byname(pdev, ch == 0 ? "ch0_trx" : "ch1_trx"); > > + if (tx_irq < 0) { > > + err = tx_irq; > > + goto fail; > > + } > > + > > + irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, > > + "canfd.ch%d_err", ch); > > + if (!irq_name) { > > + err = -ENOMEM; > > + goto fail; > > + } > > + err = devm_request_irq(&pdev->dev, err_irq, > > + rcar_canfd_channel_interrupt, 0, > > This is the same interrupt handler... > > > + irq_name, gpriv); > > + if (err) { > > + dev_err(&pdev->dev, "devm_request_irq CH Err(%d) failed, error %d\n", > > + err_irq, err); > > + goto fail; > > + } > > + irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, > > + "canfd.ch%d_trx", ch); > > + if (!irq_name) { > > + err = -ENOMEM; > > + goto fail; > > + } > > + err = devm_request_irq(&pdev->dev, tx_irq, > > + rcar_canfd_channel_interrupt, 0, > > ... as this one. > > > + irq_name, gpriv); > > + if (err) { > > + dev_err(&pdev->dev, "devm_request_irq Tx (%d) failed, error %d\n", > > + tx_irq, err); > > + goto fail; > > + } > > + } > > + > > if (gpriv->fdmode) { > > priv->can.bittiming_const = &rcar_canfd_nom_bittiming_const; > > priv->can.data_bittiming_const = > > > @@ -1711,20 +1798,51 @@ static int rcar_canfd_probe(struct platform_device *pdev) > > gpriv->base = addr; > > > > /* Request IRQ that's common for both channels */ > > - err = devm_request_irq(&pdev->dev, ch_irq, > > - rcar_canfd_channel_interrupt, 0, > > - "canfd.chn", gpriv); > > - if (err) { > > - dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", > > - ch_irq, err); > > - goto fail_dev; > > + if (gpriv->chip_id == RENESAS_RCAR_GEN3) { > > + err = devm_request_irq(&pdev->dev, ch_irq, > > + rcar_canfd_channel_interrupt, 0, > > + "canfd.ch_int", gpriv); > > + if (err) { > > + dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", > > + ch_irq, err); > > + goto fail_dev; > > + } > > + > > + err = devm_request_irq(&pdev->dev, g_irq, > > + rcar_canfd_global_interrupt, 0, > > + "canfd.g_int", gpriv); > > + if (err) { > > + dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", > > + g_irq, err); > > + goto fail_dev; > > + } > > + } else { > > + err = devm_request_irq(&pdev->dev, g_recc_irq, > > + rcar_canfd_global_interrupt, 0, > > This is the same interrupt handler... > > > + "canfd.g_recc", gpriv); > > + > > + if (err) { > > + dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", > > + g_recc_irq, err); > > + goto fail_dev; > > + } > > + > > + err = devm_request_irq(&pdev->dev, g_err_irq, > > + rcar_canfd_global_interrupt, 0, > > ... as this one. > > > + "canfd.g_err", gpriv); > > + if (err) { > > + dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", > > + g_err_irq, err); > > + goto fail_dev; > > + } > > } > > - err = devm_request_irq(&pdev->dev, g_irq, > > - rcar_canfd_global_interrupt, 0, > > - "canfd.gbl", gpriv); > > + > > + err = reset_control_reset(gpriv->rstc1); > > + if (err) > > + goto fail_dev; > > + err = reset_control_reset(gpriv->rstc2); > > if (err) { > > - dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n", > > - g_irq, err); > > + reset_control_assert(gpriv->rstc1); > > goto fail_dev; > > } > > I did not object to having fine-grained interrupt handlers on RZ/G2L. > I did object to duplicating code in global and fine-grained interrupt > handlers. > > The trick to have both is to let the global interrupt handlers call > (conditionally) into the fine-grained handlers. In pseudo-code: > > global_interrupt_handler() > { > if (...) > fine_grained_handler1(); > > if (...) > fine_grained_handler2(); > ... > } > > On R-Car Gen3, you register the global interrupt handlers, as before. > On RZ/G2L, you register the fine-grained interrupt handlers instead. > Agreed will re-spin with the fine-grained version tomorrow. Cheers, Prabhakar > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v3 3/3] arm64: dts: renesas: r9a07g044: Add CANFD node 2021-07-21 19:49 [PATCH v3 0/3] Renesas RZ/G2L CANFD support Lad Prabhakar 2021-07-21 19:49 ` [PATCH v3 1/3] dt-bindings: net: can: renesas,rcar-canfd: Document RZ/G2L SoC Lad Prabhakar 2021-07-21 19:49 ` [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family Lad Prabhakar @ 2021-07-21 19:49 ` Lad Prabhakar 2021-07-22 12:53 ` kernel test robot 2 siblings, 1 reply; 17+ messages in thread From: Lad Prabhakar @ 2021-07-21 19:49 UTC (permalink / raw) To: Geert Uytterhoeven, Rob Herring, Fabrizio Castro, Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller, Jakub Kicinski, Philipp Zabel, linux-can, netdev, devicetree Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar Add CANFD node to R9A07G044 (RZ/G2L) SoC DTSI. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> --- arch/arm64/boot/dts/renesas/r9a07g044.dtsi | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r9a07g044.dtsi b/arch/arm64/boot/dts/renesas/r9a07g044.dtsi index 9a7489dc70d1..51655c09f1f8 100644 --- a/arch/arm64/boot/dts/renesas/r9a07g044.dtsi +++ b/arch/arm64/boot/dts/renesas/r9a07g044.dtsi @@ -13,6 +13,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>; + }; + /* clock can be either from exclk or crystal oscillator (XIN/XOUT) */ extal_clk: extal { compatible = "fixed-clock"; @@ -89,6 +96,40 @@ status = "disabled"; }; + canfd: can@10050000 { + compatible = "renesas,r9a07g044-canfd", "renesas,rzg2l-canfd"; + reg = <0 0x10050000 0 0x8000>; + interrupts = <GIC_SPI 426 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 427 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 422 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 424 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 428 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 423 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 425 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 429 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "g_err", "g_recc", + "ch0_err", "ch0_rec", "ch0_trx", + "ch1_err", "ch1_rec", "ch1_trx"; + clocks = <&cpg CPG_MOD R9A07G044_CANFD_PCLK>, + <&cpg CPG_CORE R9A07G044_CLK_P0_DIV2>, + <&can_clk>; + clock-names = "fck", "canfd", "can_clk"; + assigned-clocks = <&cpg CPG_CORE R9A07G044_CLK_P0_DIV2>; + assigned-clock-rates = <50000000>; + resets = <&cpg R9A07G044_CANFD_RSTP_N>, + <&cpg R9A07G044_CANFD_RSTC_N>; + reset-names = "rstp_n", "rstc_n"; + power-domains = <&cpg>; + status = "disabled"; + + channel0 { + status = "disabled"; + }; + channel1 { + status = "disabled"; + }; + }; + i2c0: i2c@10058000 { #address-cells = <1>; #size-cells = <0>; -- 2.17.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v3 3/3] arm64: dts: renesas: r9a07g044: Add CANFD node 2021-07-21 19:49 ` [PATCH v3 3/3] arm64: dts: renesas: r9a07g044: Add CANFD node Lad Prabhakar @ 2021-07-22 12:53 ` kernel test robot 0 siblings, 0 replies; 17+ messages in thread From: kernel test robot @ 2021-07-22 12:53 UTC (permalink / raw) To: Lad Prabhakar, Geert Uytterhoeven, Rob Herring, Fabrizio Castro, Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller, Jakub Kicinski, Philipp Zabel, linux-can Cc: kbuild-all, netdev [-- Attachment #1: Type: text/plain, Size: 1721 bytes --] Hi Lad, Thank you for the patch! Yet something to improve: [auto build test ERROR on renesas-devel/next] [also build test ERROR on next-20210722] [cannot apply to mkl-can-next/testing robh/for-next v5.14-rc2] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 base: https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next config: arm64-buildonly-randconfig-r001-20210720 (attached as .config) compiler: aarch64-linux-gcc (GCC) 10.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/90a103694ef5a19dbdaa11476a1d6f0bbcea42ad git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 git checkout 90a103694ef5a19dbdaa11476a1d6f0bbcea42ad # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=arm64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> Error: arch/arm64/boot/dts/renesas/r9a07g044.dtsi:114.14-15 syntax error FATAL ERROR: Unable to parse input tree --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 32362 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 3/3] arm64: dts: renesas: r9a07g044: Add CANFD node @ 2021-07-22 12:53 ` kernel test robot 0 siblings, 0 replies; 17+ messages in thread From: kernel test robot @ 2021-07-22 12:53 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 1759 bytes --] Hi Lad, Thank you for the patch! Yet something to improve: [auto build test ERROR on renesas-devel/next] [also build test ERROR on next-20210722] [cannot apply to mkl-can-next/testing robh/for-next v5.14-rc2] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 base: https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next config: arm64-buildonly-randconfig-r001-20210720 (attached as .config) compiler: aarch64-linux-gcc (GCC) 10.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/90a103694ef5a19dbdaa11476a1d6f0bbcea42ad git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Lad-Prabhakar/Renesas-RZ-G2L-CANFD-support/20210722-035332 git checkout 90a103694ef5a19dbdaa11476a1d6f0bbcea42ad # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=arm64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> Error: arch/arm64/boot/dts/renesas/r9a07g044.dtsi:114.14-15 syntax error FATAL ERROR: Unable to parse input tree --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org [-- Attachment #2: config.gz --] [-- Type: application/gzip, Size: 32362 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2021-07-26 22:46 UTC | newest] Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-07-21 19:49 [PATCH v3 0/3] Renesas RZ/G2L CANFD support Lad Prabhakar 2021-07-21 19:49 ` [PATCH v3 1/3] dt-bindings: net: can: renesas,rcar-canfd: Document RZ/G2L SoC Lad Prabhakar 2021-07-26 22:46 ` Rob Herring 2021-07-21 19:49 ` [PATCH v3 2/3] can: rcar_canfd: Add support for RZ/G2L family Lad Prabhakar 2021-07-25 5:39 ` kernel test robot 2021-07-25 5:39 ` kernel test robot 2021-07-25 9:46 ` Marc Kleine-Budde 2021-07-25 9:46 ` Marc Kleine-Budde 2021-07-26 8:06 ` Geert Uytterhoeven 2021-07-26 8:06 ` Geert Uytterhoeven 2021-07-26 21:56 ` Lad, Prabhakar 2021-07-26 21:56 ` Lad, Prabhakar 2021-07-26 9:53 ` Geert Uytterhoeven 2021-07-26 21:58 ` Lad, Prabhakar 2021-07-21 19:49 ` [PATCH v3 3/3] arm64: dts: renesas: r9a07g044: Add CANFD node Lad Prabhakar 2021-07-22 12:53 ` kernel test robot 2021-07-22 12:53 ` kernel test robot
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.