This is an automated email from the ASF dual-hosted git repository. gnutt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit eca1011b1ef3aa770e1d92c4a9784e25b9f83084 Author: Peter van der Perk <peter.vanderp...@nxp.com> AuthorDate: Tue Jun 30 11:44:17 2020 +0200 Expose xxx_caninitialize() correctly so it's usable in latedev init when there are multiple net devices --- arch/arm/src/kinetis/kinetis.h | 2 +- arch/arm/src/s32k1xx/s32k1xx_flexcan.c | 24 ++++++++++++------------ arch/arm/src/s32k1xx/s32k1xx_flexcan.h | 29 ++++++++++++++++++----------- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/arch/arm/src/kinetis/kinetis.h b/arch/arm/src/kinetis/kinetis.h index cdabde5..5af8f8e 100644 --- a/arch/arm/src/kinetis/kinetis.h +++ b/arch/arm/src/kinetis/kinetis.h @@ -777,7 +777,7 @@ int kinetis_netinitialize(int intf); * Assumptions: * ************************************************************************************/ -#ifdef CONFIG_KINETIS_CAN +#ifdef CONFIG_KINETIS_FLEXCAN int kinetis_caninitialize(int intf) #endif diff --git a/arch/arm/src/s32k1xx/s32k1xx_flexcan.c b/arch/arm/src/s32k1xx/s32k1xx_flexcan.c index a49480b..abc4c22 100644 --- a/arch/arm/src/s32k1xx/s32k1xx_flexcan.c +++ b/arch/arm/src/s32k1xx/s32k1xx_flexcan.c @@ -1698,14 +1698,14 @@ static void s32k1xx_reset(struct s32k1xx_driver_s *priv) ****************************************************************************/ /**************************************************************************** - * Function: s32k1xx_netinitialize + * Function: s32k1xx_caninitialize * * Description: - * Initialize the Ethernet controller and driver + * Initialize the CAN controller and driver * * Input Parameters: - * intf - In the case where there are multiple EMACs, this value - * identifies which EMAC is to be initialized. + * intf - In the case where there are multiple CAN devices, this value + * identifies which CAN device is to be initialized. * * Returned Value: * OK on success; Negated errno on failure. @@ -1714,7 +1714,7 @@ static void s32k1xx_reset(struct s32k1xx_driver_s *priv) * ****************************************************************************/ -int s32k1xx_netinitialize(int intf) +int s32k1xx_caninitialize(int intf) { struct s32k1xx_driver_s *priv; int ret; @@ -1894,10 +1894,10 @@ int s32k1xx_netinitialize(int intf) * Name: arm_netinitialize * * Description: - * Initialize the first network interface. If there are more than one - * interface in the chip, then board-specific logic will have to provide - * this function to determine which, if any, Ethernet controllers should - * be initialized. + * Initialize the enabled CAN device interfaces. If there are more + * different network devices in the chip, then board-specific logic will + * have to provide this function to determine which, if any, network + * devices should be initialized. * ****************************************************************************/ @@ -1905,15 +1905,15 @@ int s32k1xx_netinitialize(int intf) void arm_netinitialize(void) { #ifdef CONFIG_S32K1XX_FLEXCAN0 - s32k1xx_netinitialize(0); + s32k1xx_caninitialize(0); #endif #ifdef CONFIG_S32K1XX_FLEXCAN1 - s32k1xx_netinitialize(1); + s32k1xx_caninitialize(1); #endif #ifdef CONFIG_S32K1XX_FLEXCAN2 - s32k1xx_netinitialize(2); + s32k1xx_caninitialize(2); #endif } #endif diff --git a/arch/arm/src/s32k1xx/s32k1xx_flexcan.h b/arch/arm/src/s32k1xx/s32k1xx_flexcan.h index 3b19332..cd763fc 100644 --- a/arch/arm/src/s32k1xx/s32k1xx_flexcan.h +++ b/arch/arm/src/s32k1xx/s32k1xx_flexcan.h @@ -65,14 +65,16 @@ extern "C" #define EXTERN extern #endif +#if !defined(CONFIG_NETDEV_LATEINIT) + /************************************************************************************ * Function: arm_netinitialize * * Description: - * Initialize the first network interface. If there are more than one - * interface in the chip, then board-specific logic will have to provide - * this function to determine which, if any, Ethernet controllers should - * be initialized. Also prototyped in up_internal.h. + * Initialize the enabled CAN device interfaces. If there are more + * different network devices in the chip, then board-specific logic will + * have to provide this function to determine which, if any, network + * devices should be initialized. * * Input Parameters: * None @@ -87,24 +89,29 @@ extern "C" void arm_netinitialize(void); +#else + /************************************************************************************ - * Function: s32k1xx_phy_boardinitialize + * Function: s32k1xx_caninitialize * * Description: - * Some boards require specialized initialization of the PHY before it can be - * used. This may include such things as configuring GPIOs, resetting the PHY, - * etc. If CONFIG_S32K1XX_FLEXCAN_PHYINIT is defined in the configuration then the - * board specific logic must provide s32k1xx_phyinitialize(); The i.MX RT Ethernet - * driver will call this function one time before it first uses the PHY. + * Initialize the CAN controller and driver * * Input Parameters: - * intf - Always zero for now. + * intf - In the case where there are multiple CAN devices, this value + * identifies which CAN device is to be initialized. * * Returned Value: * OK on success; Negated errno on failure. * + * Assumptions: + * ************************************************************************************/ +int s32k1xx_caninitialize(int intf); + +#endif + #undef EXTERN #if defined(__cplusplus) }