dts: bindings: can: mcan: switch to using bosch,mram-cfg property

Switch the Bosch M_CAN devicetree binding to use a bosch,mram-cfg property
for specifying the memory layout of the Bosch M_CAN Message RAM. This is
identical to the Linux kernel devicetree binding for Bosch M_CAN IP core
based CAN controllers.

This introduces an offset cell which can be used for controllers with
shared Message RAM between Bosch M_CAN instances.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2022-05-03 14:04:33 +02:00 committed by Anas Nashif
commit 6cd67e67fe
12 changed files with 35 additions and 86 deletions

View file

@ -389,12 +389,13 @@
#define MCAN_DT_PATH DT_PATH(soc, can) #define MCAN_DT_PATH DT_PATH(soc, can)
#endif #endif
#define NUM_STD_FILTER_ELEMENTS DT_PROP(MCAN_DT_PATH, std_filter_elements) #define NUM_STD_FILTER_ELEMENTS DT_PROP_BY_IDX(MCAN_DT_PATH, bosch_mram_cfg, 1)
#define NUM_EXT_FILTER_ELEMENTS DT_PROP(MCAN_DT_PATH, ext_filter_elements) #define NUM_EXT_FILTER_ELEMENTS DT_PROP_BY_IDX(MCAN_DT_PATH, bosch_mram_cfg, 2)
#define NUM_RX_FIFO0_ELEMENTS DT_PROP(MCAN_DT_PATH, rx_fifo0_elements) #define NUM_RX_FIFO0_ELEMENTS DT_PROP_BY_IDX(MCAN_DT_PATH, bosch_mram_cfg, 3)
#define NUM_RX_FIFO1_ELEMENTS DT_PROP(MCAN_DT_PATH, rx_fifo0_elements) #define NUM_RX_FIFO1_ELEMENTS DT_PROP_BY_IDX(MCAN_DT_PATH, bosch_mram_cfg, 4)
#define NUM_RX_BUF_ELEMENTS DT_PROP(MCAN_DT_PATH, rx_buffer_elements) #define NUM_RX_BUF_ELEMENTS DT_PROP_BY_IDX(MCAN_DT_PATH, bosch_mram_cfg, 5)
#define NUM_TX_BUF_ELEMENTS DT_PROP(MCAN_DT_PATH, tx_buffer_elements) #define NUM_TX_EVENT_FIFO_ELEMENTS DT_PROP_BY_IDX(MCAN_DT_PATH, bosch_mram_cfg, 6)
#define NUM_TX_BUF_ELEMENTS DT_PROP_BY_IDX(MCAN_DT_PATH, bosch_mram_cfg, 7)
#ifdef CONFIG_CAN_STM32FD #ifdef CONFIG_CAN_STM32FD
#define NUM_STD_FILTER_DATA CONFIG_CAN_MAX_STD_ID_FILTER #define NUM_STD_FILTER_DATA CONFIG_CAN_MAX_STD_ID_FILTER
@ -529,7 +530,7 @@ struct can_mcan_msg_sram {
volatile struct can_mcan_rx_fifo rx_fifo0[NUM_RX_FIFO0_ELEMENTS]; volatile struct can_mcan_rx_fifo rx_fifo0[NUM_RX_FIFO0_ELEMENTS];
volatile struct can_mcan_rx_fifo rx_fifo1[NUM_RX_FIFO1_ELEMENTS]; volatile struct can_mcan_rx_fifo rx_fifo1[NUM_RX_FIFO1_ELEMENTS];
volatile struct can_mcan_rx_fifo rx_buffer[NUM_RX_BUF_ELEMENTS]; volatile struct can_mcan_rx_fifo rx_buffer[NUM_RX_BUF_ELEMENTS];
volatile struct can_mcan_tx_event_fifo tx_event_fifo[NUM_TX_BUF_ELEMENTS]; volatile struct can_mcan_tx_event_fifo tx_event_fifo[NUM_TX_EVENT_FIFO_ELEMENTS];
volatile struct can_mcan_tx_buffer tx_buffer[NUM_TX_BUF_ELEMENTS]; volatile struct can_mcan_tx_buffer tx_buffer[NUM_TX_BUF_ELEMENTS];
} __packed __aligned(4); } __packed __aligned(4);

View file

@ -48,12 +48,7 @@
compatible = "bosch,m_can-base"; compatible = "bosch,m_can-base";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
std-filter-elements = <28>; bosch,mram-cfg = <0x0 28 8 3 3 0 1 1>;
ext-filter-elements = <8>;
rx-fifo0-elements = <3>;
rx-fifo1-elements = <3>;
rx-buffer-elements = <0>;
tx-buffer-elements = <1>;
can0: can@42001c00 { can0: can@42001c00 {
compatible = "atmel,sam0-can"; compatible = "atmel,sam0-can";

View file

@ -412,12 +412,7 @@
compatible = "bosch,m_can-base"; compatible = "bosch,m_can-base";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
std-filter-elements = <28>; bosch,mram-cfg = <0x0 28 8 3 3 0 1 1>;
ext-filter-elements = <8>;
rx-fifo0-elements = <3>;
rx-fifo1-elements = <3>;
rx-buffer-elements = <0>;
tx-buffer-elements = <1>;
can0: can@40030000 { can0: can@40030000 {
compatible = "atmel,sam-can"; compatible = "atmel,sam-can";

View file

@ -222,12 +222,7 @@
reg = <0x9d000 0x1000>; reg = <0x9d000 0x1000>;
interrupts = <43 0>, <44 0>; interrupts = <43 0>, <44 0>;
clocks = <&syscon MCUX_MCAN_CLK>; clocks = <&syscon MCUX_MCAN_CLK>;
std-filter-elements = <15>; bosch,mram-cfg = <0x0 15 15 8 8 0 15 15>;
ext-filter-elements = <15>;
rx-fifo0-elements = <8>;
rx-fifo1-elements = <8>;
rx-buffer-elements = <8>;
tx-buffer-elements = <15>;
sjw = <1>; sjw = <1>;
sample-point = <875>; sample-point = <875>;
sjw-data = <1>; sjw-data = <1>;

View file

@ -216,12 +216,7 @@
reg = <0x9d000 0x1000>; reg = <0x9d000 0x1000>;
interrupts = <43 0>, <44 0>; interrupts = <43 0>, <44 0>;
clocks = <&syscon MCUX_MCAN_CLK>; clocks = <&syscon MCUX_MCAN_CLK>;
std-filter-elements = <15>; bosch,mram-cfg = <0x0 15 15 8 8 0 15 15>;
ext-filter-elements = <15>;
rx-fifo0-elements = <8>;
rx-fifo1-elements = <8>;
rx-buffer-elements = <8>;
tx-buffer-elements = <15>;
sjw = <1>; sjw = <1>;
sample-point = <875>; sample-point = <875>;
sjw-data = <1>; sjw-data = <1>;

View file

@ -254,12 +254,7 @@
reg = <0x4009d000 0x1000>; reg = <0x4009d000 0x1000>;
interrupts = <43 0>, <44 0>; interrupts = <43 0>, <44 0>;
clocks = <&syscon MCUX_MCAN_CLK>; clocks = <&syscon MCUX_MCAN_CLK>;
std-filter-elements = <15>; bosch,mram-cfg = <0x0 15 15 8 8 0 15 15>;
ext-filter-elements = <15>;
rx-fifo0-elements = <8>;
rx-fifo1-elements = <8>;
rx-buffer-elements = <8>;
tx-buffer-elements = <15>;
sjw = <1>; sjw = <1>;
sample-point = <875>; sample-point = <875>;
sjw-data = <1>; sjw-data = <1>;

View file

@ -34,12 +34,7 @@
compatible = "bosch,m_can-base"; compatible = "bosch,m_can-base";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
std-filter-elements = <28>; bosch,mram-cfg = <0x0 28 8 3 3 0 3 3>;
ext-filter-elements = <8>;
rx-fifo0-elements = <3>;
rx-fifo1-elements = <3>;
rx-buffer-elements = <0>;
tx-buffer-elements = <3>;
can1: can@40006400 { can1: can@40006400 {
compatible = "st,stm32-fdcan"; compatible = "st,stm32-fdcan";

View file

@ -385,12 +385,7 @@
compatible = "bosch,m_can-base"; compatible = "bosch,m_can-base";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
std-filter-elements = <28>; bosch,mram-cfg = <0x0 28 8 3 3 0 3 3>;
ext-filter-elements = <8>;
rx-fifo0-elements = <3>;
rx-fifo1-elements = <3>;
rx-buffer-elements = <0>;
tx-buffer-elements = <3>;
can1: can@40006400 { can1: can@40006400 {
compatible = "st,stm32-fdcan"; compatible = "st,stm32-fdcan";

View file

@ -440,12 +440,7 @@
compatible = "bosch,m_can-base"; compatible = "bosch,m_can-base";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
std-filter-elements = <28>; bosch,mram-cfg = <0x0 28 8 3 3 0 3 3>;
ext-filter-elements = <8>;
rx-fifo0-elements = <3>;
rx-fifo1-elements = <3>;
rx-buffer-elements = <0>;
tx-buffer-elements = <3>;
can1: can@4000a400 { can1: can@4000a400 {
compatible = "st,stm32-fdcan"; compatible = "st,stm32-fdcan";

View file

@ -469,12 +469,7 @@
compatible = "bosch,m_can-base"; compatible = "bosch,m_can-base";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
std-filter-elements = <28>; bosch,mram-cfg = <0x0 28 8 3 3 0 3 3>;
ext-filter-elements = <8>;
rx-fifo0-elements = <3>;
rx-fifo1-elements = <3>;
rx-buffer-elements = <3>;
tx-buffer-elements = <3>;
can1: can@4000a000 { can1: can@4000a000 {
compatible = "st,stm32h7-fdcan"; compatible = "st,stm32h7-fdcan";

View file

@ -774,12 +774,7 @@
compatible = "bosch,m_can-base"; compatible = "bosch,m_can-base";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
std-filter-elements = <28>; bosch,mram-cfg = <0x0 28 8 3 3 0 3 3>;
ext-filter-elements = <8>;
rx-fifo0-elements = <3>;
rx-fifo1-elements = <3>;
rx-buffer-elements = <0>;
tx-buffer-elements = <3>;
can1: can@4000a400 { can1: can@4000a400 {
compatible = "st,stm32-fdcan"; compatible = "st,stm32-fdcan";

View file

@ -3,26 +3,24 @@ description: Bosch M_CAN CAN-FD controller base
compatible: "bosch,m_can-base" compatible: "bosch,m_can-base"
properties: properties:
std-filter-elements: bosch,mram-cfg:
type: int type: array
required: true required: true
description: |
Bosch M_CAN message RAM configuration. The cells in the array have the following format:
ext-filter-elements: <offset std-filter-elements ext-filter-elements rx-fifo0-elements rx-fifo1-elements
type: int rx-buffer-elements tx-event-fifo-elements tx-buffer-elements>
required: true
rx-fifo0-elements: The 'offset' is an address offset of the message RAM where the following elements start
type: int from. This is normally set to 0x0 when using a non-shared message RAM. The remaining cells
required: true specify how many elements are allocated for each filter type/FIFO/buffer.
rx-fifo1-elements: The Bosch M_CAN IP supports the following elements:
type: int 11-bit Filter 0-128 elements / 0-128 words
required: true 29-bit Filter 0-64 elements / 0-128 words
Rx FIFO 0 0-64 elements / 0-1152 words
rx-buffer-elements: Rx FIFO 1 0-64 elements / 0-1152 words
type: int Rx Buffers 0-64 elements / 0-1152 words
required: true Tx Event FIFO 0-32 elements / 0-64 words
Tx Buffers 0-32 elements / 0-576 words
tx-buffer-elements:
type: int
required: true