Lines Matching +full:full +full:- +full:duplex
5 * SPDX-License-Identifier: Apache-2.0
12 * - no link monitoring through PHY interrupt
53 eth->NETWORKCTRL &= ~(ETH_NETWORKCTRL_ENBTX | ETH_NETWORKCTRL_ENBRX); in link_configure()
55 /* Set duplex mode and speed */ in link_configure()
56 val = eth->NETWORKCFG; in link_configure()
60 eth->NETWORKCFG = val; in link_configure()
63 eth->NETWORKCTRL |= (ETH_NETWORKCTRL_ENBTX | ETH_NETWORKCTRL_ENBRX); in link_configure()
69 ETH_TypeDef *eth = cfg->regs; in eth_gecko_setup_mac()
73 /* PHY auto-negotiate link parameters */ in eth_gecko_setup_mac()
74 result = phy_gecko_auto_negotiate(&cfg->phy, &link_status); in eth_gecko_setup_mac()
76 LOG_ERR("ETH PHY auto-negotiate sequence failed"); in eth_gecko_setup_mac()
82 LOG_INF("%s duplex", in eth_gecko_setup_mac()
83 link_status & ETH_NETWORKCFG_FULLDUPLEX ? "Full" : "Half"); in eth_gecko_setup_mac()
102 dma_tx_desc_tab[i - 1].status |= ETH_TX_WRAP; in eth_init_tx_buf_desc()
118 dma_rx_desc_tab[i - 1].address |= ETH_RX_WRAP; in eth_init_rx_buf_desc()
131 eth->RXQPTR = (uint32_t)dma_rx_desc_tab; in rx_error_handler()
141 ETH_TypeDef *eth = cfg->regs; in frame_get()
156 /* Check if a full frame is received (SOF/EOF present) in frame_get()
162 j -= ETH_RX_BUF_COUNT; in frame_get()
191 /* Verify we found a full frame */ in frame_get()
193 /* Allocate room for full frame */ in frame_get()
194 rx_frame = net_pkt_rx_alloc_with_buffer(dev_data->iface, in frame_get()
200 eth->RXQPTR = (uint32_t)dma_rx_desc_tab; in frame_get()
223 total_len -= frag_len; in frame_get()
225 j -= ETH_RX_BUF_COUNT; in frame_get()
229 rx_buf_idx -= ETH_RX_BUF_COUNT; in frame_get()
250 res = net_recv_data(dev_data->iface, rx_frame); in eth_rx()
254 eth_stats_update_errors_rx(dev_data->iface); in eth_rx()
267 ETH_TypeDef *eth = cfg->regs; in eth_tx()
277 __ASSERT(pkt->frags, "Frame data missing"); in eth_tx()
283 res = -EIO; in eth_tx()
287 if (k_sem_take(&dev_data->tx_sem, K_MSEC(100)) != 0) { in eth_tx()
289 res = -EIO; in eth_tx()
296 res = -EIO; in eth_tx()
303 res = -EIO; in eth_tx()
307 if (tx_buf_idx < (ETH_TX_BUF_COUNT - 1)) { in eth_tx()
319 eth->NETWORKCTRL |= ETH_NETWORKCTRL_TXSTRT; in eth_tx()
339 res = k_sem_take(&dev_data->rx_sem, K_MSEC( in rx_thread()
342 if (dev_data->link_up != true) { in rx_thread()
343 dev_data->link_up = true; in rx_thread()
346 net_eth_carrier_on(dev_data->iface); in rx_thread()
351 } else if (res == -EAGAIN) { in rx_thread()
352 if (phy_gecko_is_linked(&cfg->phy)) { in rx_thread()
353 if (dev_data->link_up != true) { in rx_thread()
354 dev_data->link_up = true; in rx_thread()
357 net_eth_carrier_on(dev_data->iface); in rx_thread()
360 if (dev_data->link_up != false) { in rx_thread()
361 dev_data->link_up = false; in rx_thread()
363 net_eth_carrier_off(dev_data->iface); in rx_thread()
374 ETH_TypeDef *eth = cfg->regs; in eth_isr()
376 uint32_t int_stat = eth->IFCR; in eth_isr()
390 k_sem_give(&dev_data->rx_sem); in eth_isr()
415 k_sem_give(&dev_data->tx_sem); in eth_isr()
419 eth->IFCR = int_clr; in eth_isr()
433 ETH_TypeDef *eth = cfg->regs; in eth_init_pins()
439 eth->ROUTELOC1 = 0; in eth_init_pins()
440 eth->ROUTEPEN = 0; in eth_init_pins()
443 for (idx = 0; idx < ARRAY_SIZE(cfg->pin_list->rmii); idx++) in eth_init_pins()
444 soc_gpio_configure(&cfg->pin_list->rmii[idx]); in eth_init_pins()
446 eth->ROUTELOC1 |= (DT_INST_PROP(0, location_rmii) << in eth_init_pins()
448 eth->ROUTEPEN |= ETH_ROUTEPEN_RMIIPEN; in eth_init_pins()
452 for (idx = 0; idx < ARRAY_SIZE(cfg->pin_list->mdio); idx++) in eth_init_pins()
453 soc_gpio_configure(&cfg->pin_list->mdio[idx]); in eth_init_pins()
455 eth->ROUTELOC1 |= (DT_INST_PROP(0, location_mdio) << in eth_init_pins()
457 eth->ROUTEPEN |= ETH_ROUTEPEN_MDIOPEN; in eth_init_pins()
465 ETH_TypeDef *eth = cfg->regs; in eth_init()
478 eth->CTRL = ETH_CTRL_GBLCLKEN | ETH_CTRL_MIISEL_RMII; in eth_init()
482 cfg->config_func(); in eth_init()
494 mac_addr[0] = DEVINFO->EUI48H >> 8; in generate_mac()
495 mac_addr[1] = DEVINFO->EUI48H >> 0; in generate_mac()
496 mac_addr[2] = DEVINFO->EUI48L >> 24; in generate_mac()
497 mac_addr[3] = DEVINFO->EUI48L >> 16; in generate_mac()
498 mac_addr[4] = DEVINFO->EUI48L >> 8; in generate_mac()
499 mac_addr[5] = DEVINFO->EUI48L >> 0; in generate_mac()
508 ETH_TypeDef *eth = cfg->regs; in eth_iface_init()
518 dev_data->iface = iface; in eth_iface_init()
519 dev_data->link_up = false; in eth_iface_init()
525 generate_mac(dev_data->mac_addr); in eth_iface_init()
529 dev_data->mac_addr[0], dev_data->mac_addr[1], in eth_iface_init()
530 dev_data->mac_addr[2], dev_data->mac_addr[3], in eth_iface_init()
531 dev_data->mac_addr[4], dev_data->mac_addr[5]); in eth_iface_init()
533 net_if_set_link_addr(iface, dev_data->mac_addr, in eth_iface_init()
534 sizeof(dev_data->mac_addr), NET_LINK_ETHERNET); in eth_iface_init()
537 eth->NETWORKCTRL = 0; in eth_iface_init()
538 eth->NETWORKCFG = 0; in eth_iface_init()
541 eth->SPECADDR1BOTTOM = in eth_iface_init()
542 (dev_data->mac_addr[0] << 0) | in eth_iface_init()
543 (dev_data->mac_addr[1] << 8) | in eth_iface_init()
544 (dev_data->mac_addr[2] << 16) | in eth_iface_init()
545 (dev_data->mac_addr[3] << 24); in eth_iface_init()
546 eth->SPECADDR1TOP = in eth_iface_init()
547 (dev_data->mac_addr[4] << 0) | in eth_iface_init()
548 (dev_data->mac_addr[5] << 8); in eth_iface_init()
550 eth->SPECADDR2BOTTOM = 0; in eth_iface_init()
551 eth->SPECADDR3BOTTOM = 0; in eth_iface_init()
552 eth->SPECADDR4BOTTOM = 0; in eth_iface_init()
555 eth->HASHBOTTOM = 0; in eth_iface_init()
556 eth->HASHTOP = 0; in eth_iface_init()
563 eth->TXQPTR = (uint32_t)dma_tx_desc_tab; in eth_iface_init()
564 eth->RXQPTR = (uint32_t)dma_rx_desc_tab; in eth_iface_init()
567 eth->DMACFG = (eth->DMACFG & ~_ETH_DMACFG_RXBUFSIZE_MASK) | in eth_iface_init()
571 eth->IFCR |= _ETH_IFCR_MASK; in eth_iface_init()
572 eth->TXSTATUS = ETH_TXSTATUS_TXUNDERRUN | ETH_TXSTATUS_TXCMPLT | in eth_iface_init()
576 eth->RXSTATUS = ETH_RXSTATUS_RESPNOTOK | ETH_RXSTATUS_RXOVERRUN | in eth_iface_init()
580 eth->IENS = ETH_IENS_RXCMPLT | in eth_iface_init()
589 eth->DMACFG |= _ETH_DMACFG_AMBABRSTLEN_MASK | in eth_iface_init()
592 eth->DMACFG &= ~ETH_DMACFG_HDRDATASPLITEN; in eth_iface_init()
595 eth->NETWORKCFG |= ETH_NETWORKCFG_FCSREMOVE | in eth_iface_init()
602 eth->NETWORKCFG |= (4 << _ETH_NETWORKCFG_MDCCLKDIV_SHIFT) & in eth_iface_init()
604 eth->NETWORKCTRL |= ETH_NETWORKCTRL_MANPORTEN; in eth_iface_init()
607 result = phy_gecko_init(&cfg->phy); in eth_iface_init()
614 k_sem_init(&dev_data->tx_sem, 1, ETH_TX_BUF_COUNT); in eth_iface_init()
615 k_sem_init(&dev_data->rx_sem, 0, K_SEM_MAX_LIMIT); in eth_iface_init()
617 /* Start interruption-poll thread */ in eth_iface_init()
618 k_thread_create(&dev_data->rx_thread, dev_data->rx_thread_stack, in eth_iface_init()
619 K_KERNEL_STACK_SIZEOF(dev_data->rx_thread_stack), in eth_iface_init()