This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new e0ba2efdca boards/risc-v/esp32c6: Add the NCV7410 10BASE-T1S MAC-PHY
support for the ESP32-C6 boards
e0ba2efdca is described below
commit e0ba2efdca2917f66dfadacc326b4362e0095a96
Author: michal matias <[email protected]>
AuthorDate: Wed Jun 25 12:53:11 2025 +0200
boards/risc-v/esp32c6: Add the NCV7410 10BASE-T1S MAC-PHY support for the
ESP32-C6 boards
This commit adds NCV7410 10BASE-T1S SPI MAC-PHY support for
* esp32c6-devkitc
* esp32c6-devkitm
Signed-off-by: michal matias <[email protected]>
---
.../esp32c6/common/include/esp_board_ncv7410.h | 75 +++++++++++++++
boards/risc-v/esp32c6/common/src/Make.defs | 4 +
.../risc-v/esp32c6/common/src/esp_board_ncv7410.c | 105 +++++++++++++++++++++
.../esp32c6-devkitc/configs/ncv7410/defconfig | 75 +++++++++++++++
.../esp32c6/esp32c6-devkitc/src/esp32c6_bringup.c | 12 +++
.../esp32c6-devkitm/configs/ncv7410/defconfig | 75 +++++++++++++++
.../esp32c6/esp32c6-devkitm/src/esp32c6_bringup.c | 12 +++
7 files changed, 358 insertions(+)
diff --git a/boards/risc-v/esp32c6/common/include/esp_board_ncv7410.h
b/boards/risc-v/esp32c6/common/include/esp_board_ncv7410.h
new file mode 100644
index 0000000000..7142b1f8bd
--- /dev/null
+++ b/boards/risc-v/esp32c6/common/include/esp_board_ncv7410.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+ * boards/risc-v/esp32c6/common/include/esp_board_ncv7410.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_RISCV_ESP32C6_COMMON_INCLUDE_ESP_BOARD_NCV7410_H
+#define __BOARDS_RISCV_ESP32C6_COMMON_INCLUDE_ESP_BOARD_NCV7410_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ncv7410_initialize
+ *
+ * Description:
+ * Initialize and register the NCV7410 10BASE-T1S network driver.
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_NCV7410
+int board_ncv7410_initialize(void);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __BOARDS_RISCV_ESP32C6_COMMON_INCLUDE_ESP_BOARD_NCV7410_H */
diff --git a/boards/risc-v/esp32c6/common/src/Make.defs
b/boards/risc-v/esp32c6/common/src/Make.defs
index 8e59200c65..7632f381f3 100644
--- a/boards/risc-v/esp32c6/common/src/Make.defs
+++ b/boards/risc-v/esp32c6/common/src/Make.defs
@@ -86,6 +86,10 @@ ifeq ($(CONFIG_SENSORS_MPU60X0),y)
CSRCS += esp_board_mpu60x0.c
endif
+ifeq ($(CONFIG_NCV7410),y)
+ CSRCS += esp_board_ncv7410.c
+endif
+
DEPPATH += --dep-path src
VPATH += :src
CFLAGS +=
${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src
diff --git a/boards/risc-v/esp32c6/common/src/esp_board_ncv7410.c
b/boards/risc-v/esp32c6/common/src/esp_board_ncv7410.c
new file mode 100644
index 0000000000..2456cba057
--- /dev/null
+++ b/boards/risc-v/esp32c6/common/src/esp_board_ncv7410.c
@@ -0,0 +1,105 @@
+/****************************************************************************
+ * boards/risc-v/esp32c6/common/src/esp_board_ncv7410.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdio.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <nuttx/spi/spi.h>
+#include <nuttx/net/ncv7410.h>
+
+#include <arch/board/board.h>
+
+#include "espressif/esp_spi.h"
+#include "espressif/esp_gpio.h"
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct ncv7410_config_s g_ncv7410_config =
+{
+ .id = SPIDEV_ETHERNET(0)
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ncv7410_initialize
+ *
+ * Description:
+ * Initialize and register the NCV7410 10BASE-T1S network driver.
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+void board_ncv7410_initialize(void)
+{
+ struct spi_dev_s *spi;
+ int irq;
+ int ret;
+
+ spi = esp_spibus_initialize(ESPRESSIF_SPI2);
+ if (!spi)
+ {
+ syslog(LOG_ERR,
+ "ERROR: Failed to initialize SPI port %d\n", ESPRESSIF_SPI2);
+ return;
+ }
+
+ /* initialize the interrupt GPIO pin as input with PULLUP */
+
+ esp_configgpio(CONFIG_NCV7410_INT_PIN, INPUT_FUNCTION_2 | PULLUP);
+ irq = ESP_PIN2IRQ(CONFIG_NCV7410_INT_PIN);
+
+ /* Bind the SPI port and interrupt to the NCV7410 driver */
+
+ ret = ncv7410_initialize(spi, irq, &g_ncv7410_config);
+ if (ret < 0)
+ {
+ syslog(LOG_ERR,
+ "ERROR: Failed to bind interrupt and SPI port to the NCV7410"
+ " network driver: %d\n", ret);
+ return;
+ }
+
+ /* driver attaches function to the interrupt, now it can be enabled */
+
+ esp_gpioirqenable(irq, FALLING);
+
+ syslog(LOG_INFO,
+ "Bound interrupt and SPI port to the NCV7410 network driver\n");
+}
diff --git a/boards/risc-v/esp32c6/esp32c6-devkitc/configs/ncv7410/defconfig
b/boards/risc-v/esp32c6/esp32c6-devkitc/configs/ncv7410/defconfig
new file mode 100644
index 0000000000..b9ff16875d
--- /dev/null
+++ b/boards/risc-v/esp32c6/esp32c6-devkitc/configs/ncv7410/defconfig
@@ -0,0 +1,75 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that
includes your
+# modifications.
+#
+# CONFIG_NSH_ARGCAT is not set
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+CONFIG_ARCH="risc-v"
+CONFIG_ARCH_BOARD="esp32c6-devkitc"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_ESP32C6_DEVKITC=y
+CONFIG_ARCH_CHIP="esp32c6"
+CONFIG_ARCH_CHIP_ESP32C6=y
+CONFIG_ARCH_CHIP_ESP32C6WROOM1=y
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARCH_RISCV=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_BOARDCTL_RESET=y
+CONFIG_BOARD_LOOPSPERMSEC=15000
+CONFIG_BUILTIN=y
+CONFIG_ESPRESSIF_ESP32C6=y
+CONFIG_ESPRESSIF_GPIO_IRQ=y
+CONFIG_ESPRESSIF_SPI2=y
+CONFIG_ESPRESSIF_SPI2_CSPIN=0
+CONFIG_ESPRESSIF_SPI_SWCS=y
+CONFIG_FS_PROCFS=y
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INTELHEX_BINARY=y
+CONFIG_IOB_THROTTLE=24
+CONFIG_LIBC_PERROR_STDOUT=y
+CONFIG_LIBC_STRERROR=y
+CONFIG_MM_DEFAULT_ALIGNMENT=0
+CONFIG_NCV7410=y
+CONFIG_NCV7410_INT_PIN=5
+CONFIG_NET=y
+CONFIG_NETDB_DNSCLIENT=y
+CONFIG_NETDEV_LATEINIT=y
+CONFIG_NETDEV_PHY_IOCTL=y
+CONFIG_NET_BROADCAST=y
+CONFIG_NET_ICMP_SOCKET=y
+CONFIG_NET_ICMPv6=y
+CONFIG_NET_IPFRAG=y
+CONFIG_NET_IPv6=y
+CONFIG_NET_STATISTICS=y
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_DELAYED_ACK=y
+CONFIG_NET_TCP_WRITE_BUFFERS=y
+CONFIG_NET_UDP=y
+CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_READLINE=y
+CONFIG_NSH_STRERROR=y
+CONFIG_PREALLOC_TIMERS=0
+CONFIG_PTHREAD_MUTEX_TYPES=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_BACKTRACE=y
+CONFIG_SCHED_LPWORK=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_SPITOOL_MINBUS=2
+CONFIG_START_DAY=29
+CONFIG_START_MONTH=11
+CONFIG_START_YEAR=2019
+CONFIG_SYSTEM_DHCPC_RENEW=y
+CONFIG_SYSTEM_DUMPSTACK=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_SYSTEM_PING=y
+CONFIG_SYSTEM_SPITOOL=y
+CONFIG_TESTING_GETPRIME=y
+CONFIG_TESTING_OSTEST=y
+CONFIG_UART0_SERIAL_CONSOLE=y
diff --git a/boards/risc-v/esp32c6/esp32c6-devkitc/src/esp32c6_bringup.c
b/boards/risc-v/esp32c6/esp32c6-devkitc/src/esp32c6_bringup.c
index 2f311da29a..54bcece377 100644
--- a/boards/risc-v/esp32c6/esp32c6-devkitc/src/esp32c6_bringup.c
+++ b/boards/risc-v/esp32c6/esp32c6-devkitc/src/esp32c6_bringup.c
@@ -125,6 +125,10 @@
# include "espressif/esp_sdm.h"
#endif
+#ifdef CONFIG_NCV7410
+# include "esp_board_ncv7410.h"
+#endif
+
#include "esp32c6-devkitc.h"
/****************************************************************************
@@ -473,6 +477,14 @@ int esp_bringup(void)
}
#endif
+#ifdef CONFIG_NCV7410
+ ret = board_ncv7410_initialize();
+ if (ret < 0)
+ {
+ syslog(LOG_ERR, "ERROR: esp_ncv7410_initialize failed: %d\n", ret);
+ }
+#endif
+
/* If we got here then perhaps not all initialization was successful, but
* at least enough succeeded to bring-up NSH with perhaps reduced
* capabilities.
diff --git a/boards/risc-v/esp32c6/esp32c6-devkitm/configs/ncv7410/defconfig
b/boards/risc-v/esp32c6/esp32c6-devkitm/configs/ncv7410/defconfig
new file mode 100644
index 0000000000..44366a2ca6
--- /dev/null
+++ b/boards/risc-v/esp32c6/esp32c6-devkitm/configs/ncv7410/defconfig
@@ -0,0 +1,75 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that
includes your
+# modifications.
+#
+# CONFIG_NSH_ARGCAT is not set
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+CONFIG_ARCH="risc-v"
+CONFIG_ARCH_BOARD="esp32c6-devkitm"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_ESP32C6_DEVKITM=y
+CONFIG_ARCH_CHIP="esp32c6"
+CONFIG_ARCH_CHIP_ESP32C6=y
+CONFIG_ARCH_CHIP_ESP32C6MINI1=y
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARCH_RISCV=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_BOARDCTL_RESET=y
+CONFIG_BOARD_LOOPSPERMSEC=15000
+CONFIG_BUILTIN=y
+CONFIG_ESPRESSIF_ESP32C6=y
+CONFIG_ESPRESSIF_GPIO_IRQ=y
+CONFIG_ESPRESSIF_SPI2=y
+CONFIG_ESPRESSIF_SPI2_CSPIN=0
+CONFIG_ESPRESSIF_SPI_SWCS=y
+CONFIG_FS_PROCFS=y
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INTELHEX_BINARY=y
+CONFIG_IOB_THROTTLE=24
+CONFIG_LIBC_PERROR_STDOUT=y
+CONFIG_LIBC_STRERROR=y
+CONFIG_MM_DEFAULT_ALIGNMENT=0
+CONFIG_NCV7410=y
+CONFIG_NCV7410_INT_PIN=5
+CONFIG_NET=y
+CONFIG_NETDB_DNSCLIENT=y
+CONFIG_NETDEV_LATEINIT=y
+CONFIG_NETDEV_PHY_IOCTL=y
+CONFIG_NET_BROADCAST=y
+CONFIG_NET_ICMP_SOCKET=y
+CONFIG_NET_ICMPv6=y
+CONFIG_NET_IPFRAG=y
+CONFIG_NET_IPv6=y
+CONFIG_NET_STATISTICS=y
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_DELAYED_ACK=y
+CONFIG_NET_TCP_WRITE_BUFFERS=y
+CONFIG_NET_UDP=y
+CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_READLINE=y
+CONFIG_NSH_STRERROR=y
+CONFIG_PREALLOC_TIMERS=0
+CONFIG_PTHREAD_MUTEX_TYPES=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_BACKTRACE=y
+CONFIG_SCHED_LPWORK=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_SPITOOL_MINBUS=2
+CONFIG_START_DAY=29
+CONFIG_START_MONTH=11
+CONFIG_START_YEAR=2019
+CONFIG_SYSTEM_DHCPC_RENEW=y
+CONFIG_SYSTEM_DUMPSTACK=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_SYSTEM_PING=y
+CONFIG_SYSTEM_SPITOOL=y
+CONFIG_TESTING_GETPRIME=y
+CONFIG_TESTING_OSTEST=y
+CONFIG_UART0_SERIAL_CONSOLE=y
diff --git a/boards/risc-v/esp32c6/esp32c6-devkitm/src/esp32c6_bringup.c
b/boards/risc-v/esp32c6/esp32c6-devkitm/src/esp32c6_bringup.c
index 3daf019ffd..d2586ea6ec 100644
--- a/boards/risc-v/esp32c6/esp32c6-devkitm/src/esp32c6_bringup.c
+++ b/boards/risc-v/esp32c6/esp32c6-devkitm/src/esp32c6_bringup.c
@@ -113,6 +113,10 @@
# include "espressif/esp_sdm.h"
#endif
+#ifdef CONFIG_NCV7410
+# include "esp_board_ncv7410.h"
+#endif
+
#include "esp32c6-devkitm.h"
/****************************************************************************
@@ -421,6 +425,14 @@ int esp_bringup(void)
}
#endif
+#ifdef CONFIG_NCV7410
+ ret = board_ncv7410_initialize();
+ if (ret < 0)
+ {
+ syslog(LOG_ERR, "ERROR: esp_ncv7410_initialize failed: %d\n", ret);
+ }
+#endif
+
/* If we got here then perhaps not all initialization was successful, but
* at least enough succeeded to bring-up NSH with perhaps reduced
* capabilities.