fdcavalcanti commented on code in PR #16623:
URL: https://github.com/apache/nuttx/pull/16623#discussion_r2166616049


##########
boards/risc-v/esp32c6/common/src/esp_board_ncv7410.c:
##########
@@ -0,0 +1,87 @@
+/****************************************************************************
+ * 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"
+
+#ifdef CONFIG_NCV7410

Review Comment:
   ```suggestion
   ```
   No need, you already take this into consideration on Make.defs.
   



##########
drivers/net/Kconfig:
##########
@@ -287,6 +287,30 @@ config ENC28J60_REGDEBUG
 
 endif # ENC28J60
 
+menuconfig NCV7410
+       bool "onsemi NCV7410 support"
+       default n
+       select SPI
+       select ARCH_HAVE_NETDEV_STATISTICS
+       ---help---
+                Enable support for onsemi NCV7410 10BASE-T1S MAC-PHY

Review Comment:
   Your help text has different indentation on all three new entries. Equalize 
and check on Kconfig if it is showing normally, maybe it is throwing some 
warnings



##########
boards/risc-v/esp32c6/common/src/esp_board_ncv7410.c:
##########
@@ -0,0 +1,87 @@
+/****************************************************************************
+ * 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"
+
+#ifdef CONFIG_NCV7410
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ncv7410_initialize

Review Comment:
   Add description



##########
boards/risc-v/esp32c6/common/src/esp_board_ncv7410.c:
##########
@@ -0,0 +1,87 @@
+/****************************************************************************
+ * 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"
+
+#ifdef CONFIG_NCV7410
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ncv7410_initialize
+ ****************************************************************************/
+
+void board_ncv7410_initialize(void)
+{
+  struct spi_dev_s *spi;
+  int irq;
+  int ret;
+
+  spi = esp_spibus_initialize(ESPRESSIF_SPI2);
+  if (!spi)
+    {
+      nerr("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);
+  if (ret < 0)
+    {
+      nerr("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);
+
+  ninfo("Bound interrupt and SPI port to the NCV7410 network driver\n");

Review Comment:
   Same



##########
boards/risc-v/esp32c6/common/src/esp_board_ncv7410.c:
##########
@@ -0,0 +1,87 @@
+/****************************************************************************
+ * 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"
+
+#ifdef CONFIG_NCV7410
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ncv7410_initialize
+ ****************************************************************************/
+
+void board_ncv7410_initialize(void)
+{
+  struct spi_dev_s *spi;
+  int irq;
+  int ret;
+
+  spi = esp_spibus_initialize(ESPRESSIF_SPI2);
+  if (!spi)
+    {
+      nerr("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);
+  if (ret < 0)
+    {
+      nerr("ERROR: Failed to bind interrupt and SPI port to the NCV7410"

Review Comment:
   Same change here regarding syslog



##########
boards/risc-v/esp32c6/common/src/esp_board_ncv7410.c:
##########
@@ -0,0 +1,87 @@
+/****************************************************************************
+ * 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"
+
+#ifdef CONFIG_NCV7410
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ncv7410_initialize
+ ****************************************************************************/
+
+void board_ncv7410_initialize(void)
+{
+  struct spi_dev_s *spi;
+  int irq;
+  int ret;
+
+  spi = esp_spibus_initialize(ESPRESSIF_SPI2);
+  if (!spi)
+    {
+      nerr("ERROR: Failed to initialize SPI port %d\n", ESPRESSIF_SPI2);

Review Comment:
   Use `syslog` instead of `nerr` on board level, please. See the 
`esp_board_adc.c` file as example.



##########
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

Review Comment:
   ```suggestion
    *   None.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to