Merge pull request #15520 from benpicco/cpu/stm32-eth_register
cpu/stm32: periph_eth: register with netdev
This commit is contained in:
commit
3234b918e3
@ -248,7 +248,6 @@ static const adc_conf_t adc_config[] = {
|
|||||||
*/
|
*/
|
||||||
static const eth_conf_t eth_config = {
|
static const eth_conf_t eth_config = {
|
||||||
.mode = RMII,
|
.mode = RMII,
|
||||||
.addr = { 0 },
|
|
||||||
.speed = MII_BMCR_SPEED_100 | MII_BMCR_FULL_DPLX,
|
.speed = MII_BMCR_SPEED_100 | MII_BMCR_FULL_DPLX,
|
||||||
.dma = 6,
|
.dma = 6,
|
||||||
.dma_chan = 8,
|
.dma_chan = 8,
|
||||||
|
|||||||
@ -219,7 +219,6 @@ static const spi_conf_t spi_config[] = {
|
|||||||
*/
|
*/
|
||||||
static const eth_conf_t eth_config = {
|
static const eth_conf_t eth_config = {
|
||||||
.mode = RMII,
|
.mode = RMII,
|
||||||
.addr = { 0 },
|
|
||||||
.speed = MII_BMCR_SPEED_100 | MII_BMCR_FULL_DPLX,
|
.speed = MII_BMCR_SPEED_100 | MII_BMCR_FULL_DPLX,
|
||||||
.dma = 7,
|
.dma = 7,
|
||||||
.dma_chan = 8,
|
.dma_chan = 8,
|
||||||
|
|||||||
@ -167,7 +167,6 @@ static const spi_conf_t spi_config[] = {
|
|||||||
*/
|
*/
|
||||||
static const eth_conf_t eth_config = {
|
static const eth_conf_t eth_config = {
|
||||||
.mode = RMII,
|
.mode = RMII,
|
||||||
.addr = { 0 },
|
|
||||||
.speed = MII_BMCR_SPEED_100 | MII_BMCR_FULL_DPLX,
|
.speed = MII_BMCR_SPEED_100 | MII_BMCR_FULL_DPLX,
|
||||||
.dma = 3,
|
.dma = 3,
|
||||||
.dma_chan = 8,
|
.dma_chan = 8,
|
||||||
|
|||||||
@ -24,7 +24,6 @@ ifneq (,$(filter stm32_eth,$(USEMODULE)))
|
|||||||
FEATURES_REQUIRED += periph_eth
|
FEATURES_REQUIRED += periph_eth
|
||||||
USEMODULE += netdev_eth
|
USEMODULE += netdev_eth
|
||||||
USEMODULE += iolist
|
USEMODULE += iolist
|
||||||
USEMODULE += luid
|
|
||||||
USEMODULE += xtimer
|
USEMODULE += xtimer
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@ -1049,7 +1049,6 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
eth_mode_t mode; /**< Select configuration mode */
|
eth_mode_t mode; /**< Select configuration mode */
|
||||||
uint8_t addr[6]; /**< Ethernet MAC address */
|
|
||||||
uint16_t speed; /**< Speed selection */
|
uint16_t speed; /**< Speed selection */
|
||||||
uint8_t dma; /**< Locical CMA Descriptor used for TX */
|
uint8_t dma; /**< Locical CMA Descriptor used for TX */
|
||||||
uint8_t dma_chan; /**< DMA channel used for TX */
|
uint8_t dma_chan; /**< DMA channel used for TX */
|
||||||
|
|||||||
@ -26,10 +26,10 @@
|
|||||||
|
|
||||||
#include "bitarithm.h"
|
#include "bitarithm.h"
|
||||||
#include "iolist.h"
|
#include "iolist.h"
|
||||||
#include "luid.h"
|
|
||||||
#include "mii.h"
|
#include "mii.h"
|
||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
#include "net/ethernet.h"
|
#include "net/ethernet.h"
|
||||||
|
#include "net/eui_provider.h"
|
||||||
#include "net/netdev/eth.h"
|
#include "net/netdev/eth.h"
|
||||||
#include "periph/gpio.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
@ -407,8 +407,6 @@ static int stm32_eth_init(netdev_t *netdev)
|
|||||||
_link_status_timer.callback = _timer_cb;
|
_link_status_timer.callback = _timer_cb;
|
||||||
_link_status_timer.arg = netdev;
|
_link_status_timer.arg = netdev;
|
||||||
xtimer_set(&_link_status_timer, STM32_ETH_LINK_UP_TIMEOUT_US);
|
xtimer_set(&_link_status_timer, STM32_ETH_LINK_UP_TIMEOUT_US);
|
||||||
#else
|
|
||||||
(void)netdev;
|
|
||||||
#endif
|
#endif
|
||||||
/* enable APB2 clock */
|
/* enable APB2 clock */
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
|
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
|
||||||
@ -459,14 +457,11 @@ static int stm32_eth_init(netdev_t *netdev)
|
|||||||
| ETH_DMABMR_RDP_32Beat | ETH_DMABMR_PBL_32Beat
|
| ETH_DMABMR_RDP_32Beat | ETH_DMABMR_PBL_32Beat
|
||||||
| ETH_DMABMR_EDE;
|
| ETH_DMABMR_EDE;
|
||||||
|
|
||||||
if (eth_config.addr[0] != 0) {
|
netdev_register(netdev, NETDEV_STM32_ETH, 0);
|
||||||
stm32_eth_set_addr(eth_config.addr);
|
|
||||||
}
|
eui48_t hwaddr;
|
||||||
else {
|
netdev_eui48_get(netdev, &hwaddr);
|
||||||
eui48_t hwaddr;
|
stm32_eth_set_addr(hwaddr.uint8);
|
||||||
luid_get_eui48(&hwaddr);
|
|
||||||
stm32_eth_set_addr(hwaddr.uint8);
|
|
||||||
}
|
|
||||||
|
|
||||||
_init_buffer();
|
_init_buffer();
|
||||||
|
|
||||||
|
|||||||
@ -286,6 +286,7 @@ typedef enum {
|
|||||||
NETDEV_KW41ZRF,
|
NETDEV_KW41ZRF,
|
||||||
NETDEV_MRF24J40,
|
NETDEV_MRF24J40,
|
||||||
NETDEV_NRF802154,
|
NETDEV_NRF802154,
|
||||||
|
NETDEV_STM32_ETH,
|
||||||
/* add more if needed */
|
/* add more if needed */
|
||||||
} netdev_type_t;
|
} netdev_type_t;
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user