boards/risc-v/esp32p4: Add TWAI2 support for esp32p4

Add TWAI2 support for esp32p4

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
This commit is contained in:
Eren Terzioglu 2026-06-19 17:49:49 +02:00 committed by Xiang Xiao
parent 6a2eef788d
commit 66084dafb7
2 changed files with 22 additions and 0 deletions

View file

@ -98,6 +98,17 @@ int board_twai_setup(int port)
}
#endif /* CONFIG_ESPRESSIF_TWAI1 */
#ifdef CONFIG_ESPRESSIF_TWAI2
/* Register the TWAI driver at "/dev/can2" */
ret = can_register("/dev/can2", twai);
if (ret < 0)
{
canerr("ERROR: TWAI2 register failed: %d\n", ret);
return ret;
}
#endif /* CONFIG_ESPRESSIF_TWAI2 */
return OK;
#else
return -ENODEV;

View file

@ -401,6 +401,17 @@ int esp_bringup(void)
}
#endif
#ifdef CONFIG_ESPRESSIF_TWAI2
/* Initialize TWAI and register the TWAI driver. */
ret = board_twai_setup(2);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: TWAI2 board_twai_setup failed: %d\n", ret);
}
#endif
#ifdef CONFIG_DEV_GPIO
ret = esp_gpio_init();
if (ret < 0)