From 0a37bd8d4f45f84a78f3e06ee7ec0780e08f12e0 Mon Sep 17 00:00:00 2001 From: JacobCrabill Date: Sun, 10 Apr 2022 11:33:11 -0700 Subject: [PATCH] stm32: SocketCAN: allow non-late netdev initialization --- arch/arm/src/stm32/stm32_can_sock.c | 25 +++++++++++++++++++++++++ arch/arm/src/stm32/stm32_fdcan_sock.c | 25 +++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/arch/arm/src/stm32/stm32_can_sock.c b/arch/arm/src/stm32/stm32_can_sock.c index ede1261f26..6125f64a02 100644 --- a/arch/arm/src/stm32/stm32_can_sock.c +++ b/arch/arm/src/stm32/stm32_can_sock.c @@ -2461,3 +2461,28 @@ int stm32_cansockinitialize(int port) errout: return ret; } + +/**************************************************************************** + * Name: arm_netinitialize + * + * Description: + * Initialize the CAN device interfaces. If there is more than one device + * interface in the chip, then board-specific logic will have to provide + * this function to determine which, if any, CAN interfaces should be + * initialized. + * + ****************************************************************************/ + +#if !defined(CONFIG_NETDEV_LATEINIT) +void arm_netinitialize(void) +{ +#ifdef CONFIG_STM32_CAN1 + stm32_cansockinitialize(0); +#endif + +#ifdef CONFIG_STM32_CAN2 + stm32_cansockinitialize(1); +#endif +} +#endif + diff --git a/arch/arm/src/stm32/stm32_fdcan_sock.c b/arch/arm/src/stm32/stm32_fdcan_sock.c index e38bad9dc4..a2c2ee6551 100644 --- a/arch/arm/src/stm32/stm32_fdcan_sock.c +++ b/arch/arm/src/stm32/stm32_fdcan_sock.c @@ -3293,3 +3293,28 @@ int stm32_fdcansockinitialize(int port) errout: return ret; } + +/**************************************************************************** + * Name: arm_netinitialize + * + * Description: + * Initialize the CAN device interfaces. If there is more than one device + * interface in the chip, then board-specific logic will have to provide + * this function to determine which, if any, CAN interfaces should be + * initialized. + * + ****************************************************************************/ + +#if !defined(CONFIG_NETDEV_LATEINIT) +void arm_netinitialize(void) +{ +#ifdef CONFIG_STM32_CAN1 + stm32_fdcansockinitialize(0); +#endif + +#ifdef CONFIG_STM32_CAN2 + stm32_fdcansockinitialize(1); +#endif +} +#endif +