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 4a40a7c3d7700cfd94fdaffb5898c4bb05a74dc3
Author: Peter van der Perk <peter.vanderp...@nxp.com>
AuthorDate: Tue Jun 30 12:17:29 2020 +0200

    S32K148EVB netdev lateinit to support Enet & CAN at the same time
---
 arch/arm/src/s32k1xx/s32k1xx_enet.h                | 27 +++++++++++++++++++++-
 arch/arm/src/s32k1xx/s32k1xx_start.c               |  4 ++++
 .../arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c   | 24 +++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/arch/arm/src/s32k1xx/s32k1xx_enet.h 
b/arch/arm/src/s32k1xx/s32k1xx_enet.h
index ef89913..fe7cbea 100644
--- a/arch/arm/src/s32k1xx/s32k1xx_enet.h
+++ b/arch/arm/src/s32k1xx/s32k1xx_enet.h
@@ -55,7 +55,7 @@
 #define EMAC_INTF 0
 
 
/************************************************************************************
- * Public Functions
+ * Public Function Prototypes
  
************************************************************************************/
 
 #ifndef __ASSEMBLY__
@@ -69,6 +69,8 @@ extern "C"
 #define EXTERN extern
 #endif
 
+#if !defined(CONFIG_NETDEV_LATEINIT)
+
 
/************************************************************************************
  * Function: arm_netinitialize
  *
@@ -91,6 +93,29 @@ extern "C"
 
 void arm_netinitialize(void);
 
+#else
+
+/************************************************************************************
+ * Function: s32k1xx_netinitialize
+ *
+ * Description:
+ *   Initialize the Ethernet controller and driver
+ *
+ * Input Parameters:
+ *   intf - In the case where there are multiple EMACs, this value
+ *          identifies which EMAC is to be initialized.
+ *
+ * Returned Value:
+ *   OK on success; Negated errno on failure.
+ *
+ * Assumptions:
+ *
+ 
************************************************************************************/
+
+int s32k1xx_netinitialize(int intf);
+
+#endif
+
 
/************************************************************************************
  * Function: s32k1xx_phy_boardinitialize
  *
diff --git a/arch/arm/src/s32k1xx/s32k1xx_start.c 
b/arch/arm/src/s32k1xx/s32k1xx_start.c
index 3ad3620..85c352d 100644
--- a/arch/arm/src/s32k1xx/s32k1xx_start.c
+++ b/arch/arm/src/s32k1xx/s32k1xx_start.c
@@ -69,6 +69,10 @@
 #include "s32k1xx_progmem.h"
 #endif
 
+#ifdef CONFIG_S32K1XX_EEEPROM
+#include "s32k1xx_eeeprom.h"
+#endif
+
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
diff --git a/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c 
b/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c
index 178c992..62a977e 100644
--- a/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c
+++ b/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c
@@ -55,6 +55,10 @@
 #  include "s32k1xx_eeeprom.h"
 #endif
 
+#ifdef CONFIG_S32K1XX_FLEXCAN
+#  include "s32k1xx_flexcan.h"
+#endif
+
 #include "s32k148evb.h"
 
 /****************************************************************************
@@ -115,5 +119,25 @@ int s32k1xx_bringup(void)
       s32k1xx_eeeprom_register(0, 4096);
 #endif
 
+#ifdef CONFIG_NETDEV_LATEINIT
+
+# ifdef CONFIG_S32K1XX_ENET
+  s32k1xx_netinitialize(0);
+# endif
+
+# ifdef CONFIG_S32K1XX_FLEXCAN0
+  s32k1xx_caninitialize(0);
+# endif
+
+# ifdef CONFIG_S32K1XX_FLEXCAN1
+  s32k1xx_caninitialize(1);
+# endif
+
+# ifdef CONFIG_S32K1XX_FLEXCAN2
+  s32k1xx_caninitialize(2);
+# endif
+
+#endif
+
   return ret;
 }

Reply via email to