-
Notifications
You must be signed in to change notification settings - Fork 8.2k
NXP: CAN: Add LPC MCAN support #35832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d1858ce
458b22c
d38269a
30b6e4b
7bf390c
81f0b60
47f2b94
21cff9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,8 @@ supported: | |
| - arduino_gpio | ||
| - arduino_i2c | ||
| - arduino_spi | ||
| - can | ||
| - canfd | ||
| - gpio | ||
| - i2c | ||
| - spi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,14 +8,20 @@ | |
| #ifndef ZEPHYR_DRIVERS_CAN_MCAN_H_ | ||
| #define ZEPHYR_DRIVERS_CAN_MCAN_H_ | ||
|
|
||
| #define NUM_STD_FILTER_ELEMENTS DT_PROP(DT_PATH(soc, can), std_filter_elements) | ||
| #define NUM_EXT_FILTER_ELEMENTS DT_PROP(DT_PATH(soc, can), ext_filter_elements) | ||
| #define NUM_RX_FIFO0_ELEMENTS DT_PROP(DT_PATH(soc, can), rx_fifo0_elements) | ||
| #define NUM_RX_FIFO1_ELEMENTS DT_PROP(DT_PATH(soc, can), rx_fifo0_elements) | ||
| #define NUM_RX_BUF_ELEMENTS DT_PROP(DT_PATH(soc, can), rx_buffer_elements) | ||
| #ifdef CONFIG_CAN_MCUX_MCAN | ||
| #define MCAN_DT_PATH DT_NODELABEL(can0) | ||
|
||
| #else | ||
| #define MCAN_DT_PATH DT_PATH(soc, can) | ||
| #endif | ||
|
|
||
| #define NUM_STD_FILTER_ELEMENTS DT_PROP(MCAN_DT_PATH, std_filter_elements) | ||
| #define NUM_EXT_FILTER_ELEMENTS DT_PROP(MCAN_DT_PATH, ext_filter_elements) | ||
| #define NUM_RX_FIFO0_ELEMENTS DT_PROP(MCAN_DT_PATH, rx_fifo0_elements) | ||
| #define NUM_RX_FIFO1_ELEMENTS DT_PROP(MCAN_DT_PATH, rx_fifo0_elements) | ||
| #define NUM_RX_BUF_ELEMENTS DT_PROP(MCAN_DT_PATH, rx_buffer_elements) | ||
| #define NUM_TX_EVENT_FIFO_ELEMENTS \ | ||
| DT_PROP(DT_PATH(soc, can), tx_event_fifo_elements) | ||
| #define NUM_TX_BUF_ELEMENTS DT_PROP(DT_PATH(soc, can), tx_buffer_elements) | ||
| DT_PROP(MCAN_DT_PATH, tx_event_fifo_elements) | ||
| #define NUM_TX_BUF_ELEMENTS DT_PROP(MCAN_DT_PATH, tx_buffer_elements) | ||
|
|
||
|
|
||
| #ifdef CONFIG_CAN_STM32FD | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So much magic ;-). Just curious but why is this done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will need to revisit it. As I recall it, there were some issues with CAN-FD with the current solution.
One of the commits is touching the generic Bosch M-CAN driver, and thus needed to make a change to the STM32 front-end. I still need to decide if this is the right fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the bug in the generic driver, that I was trying to work-around with the commit that touched the STM32 front-end. I have fixed it properly and removed the STM32 changes + label.
The "magic" above is to calculate the relative addresses of the various elements of the Message RAM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addressing part is getting tricky as more front-ends are dropping in.
I propose to merge this as is (and also the new STM32H7) and refactor it.
My idea is to have a function ptr in the config structure that is called somewhere during the init.
Somehow a vendor-specific config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexanderwachter Does that mean you approve this PR?