From d800cca1c32d054e8b7ee860b3a891807d07a7d6 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 30 Mar 2022 16:07:29 +0200 Subject: [PATCH] drivers/atwinc15x0: register with netdev --- drivers/atwinc15x0/atwinc15x0_netdev.c | 4 +++- drivers/include/atwinc15x0.h | 3 ++- drivers/include/net/netdev.h | 1 + pkg/lwip/init_devs/auto_init_atwinc15x0.c | 2 +- sys/net/gnrc/netif/init_devs/auto_init_atwinc15x0.c | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/atwinc15x0/atwinc15x0_netdev.c b/drivers/atwinc15x0/atwinc15x0_netdev.c index 1fcf3da46d..5ba0666478 100644 --- a/drivers/atwinc15x0/atwinc15x0_netdev.c +++ b/drivers/atwinc15x0/atwinc15x0_netdev.c @@ -575,13 +575,15 @@ const netdev_driver_t atwinc15x0_netdev_driver = { .set = _atwinc15x0_set, }; -void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params) +void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params, uint8_t idx) { assert(dev); atwinc15x0 = dev; atwinc15x0->netdev.driver = &atwinc15x0_netdev_driver; atwinc15x0->params = *params; + + netdev_register(&dev->netdev, NETDEV_ATWINC15X0, idx); } void atwinc15x0_irq(void) diff --git a/drivers/include/atwinc15x0.h b/drivers/include/atwinc15x0.h index 538331a358..13ce1a4840 100644 --- a/drivers/include/atwinc15x0.h +++ b/drivers/include/atwinc15x0.h @@ -80,8 +80,9 @@ typedef struct atwinc15x0 { * * @param[in] dev Device descriptor * @param[in] params Parameters for device initialization + * @param[in] idx Index in the params struct */ -void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params); +void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params, uint8_t idx); #ifdef __cplusplus } diff --git a/drivers/include/net/netdev.h b/drivers/include/net/netdev.h index 871139c069..5195c24f22 100644 --- a/drivers/include/net/netdev.h +++ b/drivers/include/net/netdev.h @@ -326,6 +326,7 @@ typedef enum { NETDEV_TAP, NETDEV_W5100, NETDEV_ENCX24J600, + NETDEV_ATWINC15X0, /* add more if needed */ } netdev_type_t; /** @} */ diff --git a/pkg/lwip/init_devs/auto_init_atwinc15x0.c b/pkg/lwip/init_devs/auto_init_atwinc15x0.c index 11b98f58f7..66342c571a 100644 --- a/pkg/lwip/init_devs/auto_init_atwinc15x0.c +++ b/pkg/lwip/init_devs/auto_init_atwinc15x0.c @@ -33,7 +33,7 @@ static atwinc15x0_t atwinc15x0_devs[NETIF_ATWINC_NUMOF]; static void auto_init_atwinc15x0(void) { for (unsigned i = 0; i < NETIF_ATWINC_NUMOF; i++) { - atwinc15x0_setup(&atwinc15x0_devs[i], &atwinc15x0_params[i]); + atwinc15x0_setup(&atwinc15x0_devs[i], &atwinc15x0_params[i], i); if (lwip_add_ethernet(&netif[i], &atwinc15x0_devs[i].netdev) == NULL) { DEBUG("Could not add atwinc15x0 device\n"); return; diff --git a/sys/net/gnrc/netif/init_devs/auto_init_atwinc15x0.c b/sys/net/gnrc/netif/init_devs/auto_init_atwinc15x0.c index edb338d17f..50f558c87a 100644 --- a/sys/net/gnrc/netif/init_devs/auto_init_atwinc15x0.c +++ b/sys/net/gnrc/netif/init_devs/auto_init_atwinc15x0.c @@ -59,7 +59,7 @@ void auto_init_atwinc15x0(void) LOG_DEBUG("[auto_init_netif] initializing atwinc15x0 #%u\n", i); /* setup netdev device */ - atwinc15x0_setup(&dev[i], &atwinc15x0_params[i]); + atwinc15x0_setup(&dev[i], &atwinc15x0_params[i], i); gnrc_netif_ethernet_create(&_netif[i], stack[i], ATWINC15X0_MAC_STACKSIZE, ATWINC15X0_MAC_PRIO, "atwinc15x0",