drivers: can: initial support for Renesas RA CANFD
Add support for CAN driver running on Renesas RA CANFD Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
This commit is contained in:
parent
e876c5d487
commit
95cc5f53b8
14 changed files with 1356 additions and 20 deletions
|
|
@ -36,4 +36,13 @@
|
|||
psels = <RA_PSEL(RA_PSEL_GPT1, 10, 6)>;
|
||||
};
|
||||
};
|
||||
|
||||
canfd0_default: canfd0_default {
|
||||
group1 {
|
||||
/* CRX0 CTX0 */
|
||||
psels = <RA_PSEL(RA_PSEL_CANFD, 4, 2)>,
|
||||
<RA_PSEL(RA_PSEL_CANFD, 4, 1)>;
|
||||
drive-strength = "high";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
zephyr,shell-uart = &uart9;
|
||||
zephyr,entropy = &trng;
|
||||
zephyr,flash-controller = &flash1;
|
||||
zephyr,canbus = &canfd0;
|
||||
};
|
||||
|
||||
leds {
|
||||
|
|
@ -74,6 +75,12 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&canfdclk {
|
||||
clocks = <&pll>;
|
||||
div = <5>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&ioport1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
|
@ -132,3 +139,13 @@
|
|||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&canfd_global {
|
||||
status = "okay";
|
||||
canfd0 {
|
||||
pinctrl-0 = <&canfd0_default>;
|
||||
pinctrl-names = "default";
|
||||
rx-max-filters = <16>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -64,4 +64,13 @@
|
|||
psels = <RA_PSEL(RA_PSEL_GPT1, 6, 2)>;
|
||||
};
|
||||
};
|
||||
|
||||
canfd0_default: canfd0_default {
|
||||
group1 {
|
||||
/* CRX0 CTX0 */
|
||||
psels = <RA_PSEL(RA_PSEL_CANFD, 3, 11)>,
|
||||
<RA_PSEL(RA_PSEL_CANFD, 3, 12)>;
|
||||
drive-strength = "high";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
zephyr,console = &uart9;
|
||||
zephyr,shell-uart = &uart9;
|
||||
zephyr,entropy = &trng;
|
||||
zephyr,canbus = &canfd0;
|
||||
};
|
||||
|
||||
leds {
|
||||
|
|
@ -65,6 +66,13 @@
|
|||
aliases {
|
||||
led0 = &led1;
|
||||
};
|
||||
|
||||
transceiver0: can-phy0 {
|
||||
compatible = "nxp,tja1040t", "can-transceiver-gpio";
|
||||
standby-gpios = <&ioport2 7 GPIO_ACTIVE_HIGH>;
|
||||
max-bitrate = <5000000>;
|
||||
#phy-cells = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
&xtal {
|
||||
|
|
@ -97,6 +105,12 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&canfdclk {
|
||||
clocks = <&pll>;
|
||||
div = <5>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&ioport0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
|
@ -105,6 +119,10 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&ioport2 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&ioport3 {
|
||||
status = "okay";
|
||||
};
|
||||
|
|
@ -189,3 +207,14 @@ mikrobus_serial: &uart3 {};
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
&canfd_global {
|
||||
status = "okay";
|
||||
canfd0 {
|
||||
pinctrl-0 = <&canfd0_default>;
|
||||
pinctrl-names = "default";
|
||||
phys = <&transceiver0>;
|
||||
rx-max-filters = <16>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,4 +36,13 @@
|
|||
psels = <RA_PSEL(RA_PSEL_GPT1, 1, 14)>;
|
||||
};
|
||||
};
|
||||
|
||||
canfd1_default: canfd1_default {
|
||||
group1 {
|
||||
/* CRX1 CTX1 */
|
||||
psels = <RA_PSEL(RA_PSEL_CANFD, 4, 14)>,
|
||||
<RA_PSEL(RA_PSEL_CANFD, 4, 15)>;
|
||||
drive-strength = "high";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
zephyr,shell-uart = &uart3;
|
||||
zephyr,entropy = &trng;
|
||||
zephyr,flash-controller = &flash1;
|
||||
zephyr,canbus = &canfd1;
|
||||
};
|
||||
|
||||
leds {
|
||||
|
|
@ -78,6 +79,12 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&canfdclk {
|
||||
clocks = <&pll>;
|
||||
div = <5>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&ioport6 {
|
||||
status = "okay";
|
||||
};
|
||||
|
|
@ -126,3 +133,13 @@
|
|||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&canfd_global {
|
||||
status = "okay";
|
||||
canfd1 {
|
||||
pinctrl-0 = <&canfd1_default>;
|
||||
pinctrl-names = "default";
|
||||
rx-max-filters = <16>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,26 +5,27 @@ zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/can.h)
|
|||
zephyr_library()
|
||||
zephyr_sources_ifdef(CONFIG_CAN_MCUX_MCAN can_mcux_mcan.c)
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN can_common.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_FAKE can_fake.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_LOOPBACK can_loopback.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_MCAN can_mcan.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_MCP2515 can_mcp2515.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_MCP251XFD can_mcp251xfd.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_MCUX_FLEXCAN can_mcux_flexcan.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_SAM can_sam.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_SAM0 can_sam0.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_STM32_BXCAN can_stm32_bxcan.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_STM32_FDCAN can_stm32_fdcan.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_STM32H7_FDCAN can_stm32h7_fdcan.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_TCAN4X5X can_tcan4x5x.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_RCAR can_rcar.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_NUMAKER can_numaker.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_XMC4XXX can_xmc4xxx.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_SJA1000 can_sja1000.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_ESP32_TWAI can_esp32_twai.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_KVASER_PCI can_kvaser_pci.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_NRF can_nrf.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN can_common.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_FAKE can_fake.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_LOOPBACK can_loopback.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_MCAN can_mcan.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_MCP2515 can_mcp2515.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_MCP251XFD can_mcp251xfd.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_MCUX_FLEXCAN can_mcux_flexcan.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_SAM can_sam.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_SAM0 can_sam0.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_STM32_BXCAN can_stm32_bxcan.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_STM32_FDCAN can_stm32_fdcan.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_STM32H7_FDCAN can_stm32h7_fdcan.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_TCAN4X5X can_tcan4x5x.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_RCAR can_rcar.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_NUMAKER can_numaker.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_XMC4XXX can_xmc4xxx.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_SJA1000 can_sja1000.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_ESP32_TWAI can_esp32_twai.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_KVASER_PCI can_kvaser_pci.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_NRF can_nrf.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_RENESAS_RA_CANFD can_renesas_ra.c)
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_USERSPACE can_handlers.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CAN_SHELL can_shell.c)
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ source "drivers/can/Kconfig.tcan4x5x"
|
|||
source "drivers/can/Kconfig.mcp251xfd"
|
||||
source "drivers/can/Kconfig.xmc4xxx"
|
||||
source "drivers/can/Kconfig.nrf"
|
||||
source "drivers/can/Kconfig.renesas_ra"
|
||||
|
||||
source "drivers/can/transceiver/Kconfig"
|
||||
|
||||
|
|
|
|||
11
drivers/can/Kconfig.renesas_ra
Normal file
11
drivers/can/Kconfig.renesas_ra
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Copyright (c) 2024 Renesas Electronics Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config CAN_RENESAS_RA_CANFD
|
||||
bool "Renesas RA CANFD"
|
||||
default y
|
||||
depends on DT_HAS_RENESAS_RA_CANFD_ENABLED
|
||||
select USE_RA_FSP_CANFD
|
||||
select PINCTRL
|
||||
help
|
||||
Enable Renesas RA CANFD driver
|
||||
1158
drivers/can/can_renesas_ra.c
Normal file
1158
drivers/can/can_renesas_ra.c
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -527,6 +527,36 @@
|
|||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
canfd_global: canfd_global@40380000 {
|
||||
compatible = "renesas,ra-canfd-global";
|
||||
interrupts = <40 1>, <41 1>;
|
||||
interrupt-names = "rxf", "glerr";
|
||||
clocks = <&pclka 0 0>, <&pclke 0 0>;
|
||||
clock-names = "opclk", "ramclk";
|
||||
reg = <0x40380000 0x4000>;
|
||||
status = "disabled";
|
||||
|
||||
canfd0: canfd0 {
|
||||
compatible = "renesas,ra-canfd";
|
||||
channel = <0>;
|
||||
interrupts = <43 12>, <44 12>, <45 12>;
|
||||
interrupt-names = "err", "tx", "rx";
|
||||
clocks = <&canfdclk MSTPC 27>;
|
||||
clock-names = "dllclk";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
canfd1: canfd1 {
|
||||
compatible = "renesas,ra-canfd";
|
||||
channel = <1>;
|
||||
interrupts = <46 1>, <47 1>, <48 1>;
|
||||
interrupt-names = "err", "tx", "rx";
|
||||
clocks = <&canfdclk MSTPC 26>;
|
||||
clock-names = "dllclk";
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
15
dts/bindings/can/renesas,ra-canfd-global.yaml
Normal file
15
dts/bindings/can/renesas,ra-canfd-global.yaml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Copyright (c) 2024 Renesas Electronics Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
description: Renesas RA CANFD controller global
|
||||
|
||||
compatible: "renesas,ra-canfd-global"
|
||||
|
||||
include: [base.yaml]
|
||||
|
||||
properties:
|
||||
interrupts:
|
||||
required: true
|
||||
|
||||
clocks:
|
||||
required: true
|
||||
25
dts/bindings/can/renesas,ra-canfd.yaml
Normal file
25
dts/bindings/can/renesas,ra-canfd.yaml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Copyright (c) 2024 Renesas Electronics Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
description: Renesas RA CANFD controller
|
||||
|
||||
compatible: "renesas,ra-canfd"
|
||||
|
||||
include: [can-fd-controller.yaml, pinctrl-device.yaml]
|
||||
|
||||
properties:
|
||||
interrupts:
|
||||
required: true
|
||||
|
||||
clocks:
|
||||
required: true
|
||||
|
||||
channel:
|
||||
type: int
|
||||
required: true
|
||||
|
||||
rx-max-filters:
|
||||
type: int
|
||||
description: |
|
||||
To determine the maximum rx filters can be added on this CAN device.
|
||||
Valid range: 0 - 16
|
||||
|
|
@ -71,4 +71,9 @@ config USE_RA_FSP_AGT
|
|||
help
|
||||
Enable RA FSP AGT driver
|
||||
|
||||
config USE_RA_FSP_CANFD
|
||||
bool
|
||||
help
|
||||
Enable RA FSP CANFD driver
|
||||
|
||||
endif # HAS_RENESAS_RA_FSP
|
||||
|
|
|
|||
Loading…
Reference in a new issue