Lines Matching refs:skge
66 static void genesis_link_up(struct skge_port *skge);
135 static void skge_led(struct skge_port *skge, enum led_mode mode) in skge_led() argument
137 struct skge_hw *hw = skge->hw; in skge_led()
138 int port = skge->port; in skge_led()
197 (skge->speed == SPEED_100 ? in skge_led()
340 static void skge_rx_setup(struct skge_port *skge __unused, in skge_rx_setup()
380 static void skge_rx_clean(struct skge_port *skge) in skge_rx_clean() argument
382 struct skge_ring *ring = &skge->rx_ring; in skge_rx_clean()
396 static void skge_link_up(struct skge_port *skge) in skge_link_up() argument
398 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), in skge_link_up()
401 netdev_link_up(skge->netdev); in skge_link_up()
404 skge->netdev->name, skge->speed, in skge_link_up()
405 skge->duplex == DUPLEX_FULL ? "full" : "half"); in skge_link_up()
408 static void skge_link_down(struct skge_port *skge) in skge_link_down() argument
410 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF); in skge_link_down()
411 netdev_link_down(skge->netdev); in skge_link_down()
413 DBG2(PFX "%s: Link is down.\n", skge->netdev->name); in skge_link_down()
420 struct skge_port *skge = netdev_priv(dev); in xm_link_down() local
425 skge_link_down(skge); in xm_link_down()
558 struct skge_port *skge = netdev_priv(dev); in bcom_check_link() local
570 if (skge->autoneg == AUTONEG_ENABLE) { in bcom_check_link()
588 skge->duplex = DUPLEX_FULL; in bcom_check_link()
591 skge->duplex = DUPLEX_HALF; in bcom_check_link()
602 skge->flow_status = FLOW_STAT_SYMMETRIC; in bcom_check_link()
605 skge->flow_status = FLOW_STAT_REM_SEND; in bcom_check_link()
608 skge->flow_status = FLOW_STAT_LOC_SEND; in bcom_check_link()
611 skge->flow_status = FLOW_STAT_NONE; in bcom_check_link()
613 skge->speed = SPEED_1000; in bcom_check_link()
617 genesis_link_up(skge); in bcom_check_link()
623 static void bcom_phy_init(struct skge_port *skge) in bcom_phy_init() argument
625 struct skge_hw *hw = skge->hw; in bcom_phy_init()
626 int port = skge->port; in bcom_phy_init()
688 if (skge->autoneg == AUTONEG_ENABLE) { in bcom_phy_init()
695 if (skge->advertising & ADVERTISED_1000baseT_Half) in bcom_phy_init()
697 if (skge->advertising & ADVERTISED_1000baseT_Full) in bcom_phy_init()
703 if (skge->duplex == DUPLEX_FULL) in bcom_phy_init()
711 phy_pause_map[skge->flow_control] | PHY_AN_CSMA); in bcom_phy_init()
720 static void xm_phy_init(struct skge_port *skge) in xm_phy_init() argument
722 struct skge_hw *hw = skge->hw; in xm_phy_init()
723 int port = skge->port; in xm_phy_init()
726 if (skge->autoneg == AUTONEG_ENABLE) { in xm_phy_init()
727 if (skge->advertising & ADVERTISED_1000baseT_Half) in xm_phy_init()
729 if (skge->advertising & ADVERTISED_1000baseT_Full) in xm_phy_init()
732 ctrl |= fiber_pause_map[skge->flow_control]; in xm_phy_init()
740 if (skge->duplex == DUPLEX_FULL) in xm_phy_init()
751 skge->use_xm_link_timer = 1; in xm_phy_init()
756 struct skge_port *skge = netdev_priv(dev); in xm_check_link() local
757 struct skge_hw *hw = skge->hw; in xm_check_link()
758 int port = skge->port; in xm_check_link()
770 if (skge->autoneg == AUTONEG_ENABLE) { in xm_check_link()
788 skge->duplex = DUPLEX_FULL; in xm_check_link()
791 skge->duplex = DUPLEX_HALF; in xm_check_link()
800 if ((skge->flow_control == FLOW_MODE_SYMMETRIC || in xm_check_link()
801 skge->flow_control == FLOW_MODE_SYM_OR_REM) && in xm_check_link()
803 skge->flow_status = FLOW_STAT_SYMMETRIC; in xm_check_link()
804 else if (skge->flow_control == FLOW_MODE_SYM_OR_REM && in xm_check_link()
807 skge->flow_status = FLOW_STAT_REM_SEND; in xm_check_link()
808 else if (skge->flow_control == FLOW_MODE_LOC_SEND && in xm_check_link()
811 skge->flow_status = FLOW_STAT_LOC_SEND; in xm_check_link()
813 skge->flow_status = FLOW_STAT_NONE; in xm_check_link()
815 skge->speed = SPEED_1000; in xm_check_link()
819 genesis_link_up(skge); in xm_check_link()
829 static void xm_link_timer(struct skge_port *skge) in xm_link_timer() argument
831 struct net_device *dev = skge->netdev; in xm_link_timer()
832 struct skge_hw *hw = skge->hw; in xm_link_timer()
833 int port = skge->port; in xm_link_timer()
857 struct skge_port *skge = netdev_priv(dev); in genesis_mac_init() local
898 xm_phy_init(skge); in genesis_mac_init()
901 bcom_phy_init(skge); in genesis_mac_init()
925 if (skge->duplex == DUPLEX_HALF) { in genesis_mac_init()
1000 static void genesis_stop(struct skge_port *skge) in genesis_stop() argument
1002 struct skge_hw *hw = skge->hw; in genesis_stop()
1003 int port = skge->port; in genesis_stop()
1047 static void genesis_link_up(struct skge_port *skge) in genesis_link_up() argument
1049 struct skge_hw *hw = skge->hw; in genesis_link_up()
1050 int port = skge->port; in genesis_link_up()
1060 if (skge->flow_status == FLOW_STAT_NONE || in genesis_link_up()
1061 skge->flow_status == FLOW_STAT_LOC_SEND) in genesis_link_up()
1071 if (skge->flow_status== FLOW_STAT_SYMMETRIC || in genesis_link_up()
1072 skge->flow_status == FLOW_STAT_LOC_SEND) { in genesis_link_up()
1110 if (hw->phy_type != SK_PHY_XMAC && skge->duplex == DUPLEX_FULL) in genesis_link_up()
1127 skge_link_up(skge); in genesis_link_up()
1131 static inline void bcom_phy_intr(struct skge_port *skge) in bcom_phy_intr() argument
1133 struct skge_hw *hw = skge->hw; in bcom_phy_intr()
1134 int port = skge->port; in bcom_phy_intr()
1139 skge->netdev->name, isrc); in bcom_phy_intr()
1214 struct skge_port *skge = netdev_priv(hw->dev[port]); in yukon_init() local
1217 if (skge->autoneg == AUTONEG_ENABLE) { in yukon_init()
1230 if (skge->autoneg == AUTONEG_DISABLE) in yukon_init()
1240 if (skge->autoneg == AUTONEG_ENABLE) { in yukon_init()
1242 if (skge->advertising & ADVERTISED_1000baseT_Full) in yukon_init()
1244 if (skge->advertising & ADVERTISED_1000baseT_Half) in yukon_init()
1246 if (skge->advertising & ADVERTISED_100baseT_Full) in yukon_init()
1248 if (skge->advertising & ADVERTISED_100baseT_Half) in yukon_init()
1250 if (skge->advertising & ADVERTISED_10baseT_Full) in yukon_init()
1252 if (skge->advertising & ADVERTISED_10baseT_Half) in yukon_init()
1256 adv |= phy_pause_map[skge->flow_control]; in yukon_init()
1258 if (skge->advertising & ADVERTISED_1000baseT_Full) in yukon_init()
1260 if (skge->advertising & ADVERTISED_1000baseT_Half) in yukon_init()
1263 adv |= fiber_pause_map[skge->flow_control]; in yukon_init()
1272 if (skge->duplex == DUPLEX_FULL) in yukon_init()
1275 switch (skge->speed) { in yukon_init()
1293 if (skge->autoneg == AUTONEG_ENABLE) in yukon_init()
1330 struct skge_port *skge = netdev_priv(hw->dev[port]); in yukon_mac_init() local
1366 if (skge->autoneg == AUTONEG_DISABLE) { in yukon_mac_init()
1371 switch (skge->speed) { in yukon_mac_init()
1385 if (skge->duplex == DUPLEX_FULL) in yukon_mac_init()
1390 switch (skge->flow_control) { in yukon_mac_init()
1494 static void yukon_stop(struct skge_port *skge) in yukon_stop() argument
1496 struct skge_hw *hw = skge->hw; in yukon_stop()
1497 int port = skge->port; in yukon_stop()
1526 static void yukon_link_up(struct skge_port *skge) in yukon_link_up() argument
1528 struct skge_hw *hw = skge->hw; in yukon_link_up()
1529 int port = skge->port; in yukon_link_up()
1536 if (skge->duplex == DUPLEX_FULL || skge->autoneg == AUTONEG_ENABLE) in yukon_link_up()
1544 skge_link_up(skge); in yukon_link_up()
1547 static void yukon_link_down(struct skge_port *skge) in yukon_link_down() argument
1549 struct skge_hw *hw = skge->hw; in yukon_link_down()
1550 int port = skge->port; in yukon_link_down()
1557 if (skge->flow_status == FLOW_STAT_REM_SEND) { in yukon_link_down()
1564 skge_link_down(skge); in yukon_link_down()
1569 static void yukon_phy_intr(struct skge_port *skge) in yukon_phy_intr() argument
1571 struct skge_hw *hw = skge->hw; in yukon_phy_intr()
1572 int port = skge->port; in yukon_phy_intr()
1580 skge->netdev->name, istatus, phystat); in yukon_phy_intr()
1599 skge->duplex = (phystat & PHY_M_PS_FULL_DUP) in yukon_phy_intr()
1601 skge->speed = yukon_speed(hw, phystat); in yukon_phy_intr()
1606 skge->flow_status = FLOW_STAT_SYMMETRIC; in yukon_phy_intr()
1609 skge->flow_status = FLOW_STAT_REM_SEND; in yukon_phy_intr()
1612 skge->flow_status = FLOW_STAT_LOC_SEND; in yukon_phy_intr()
1615 skge->flow_status = FLOW_STAT_NONE; in yukon_phy_intr()
1618 if (skge->flow_status == FLOW_STAT_NONE || in yukon_phy_intr()
1619 (skge->speed < SPEED_1000 && skge->duplex == DUPLEX_HALF)) in yukon_phy_intr()
1623 yukon_link_up(skge); in yukon_phy_intr()
1628 skge->speed = yukon_speed(hw, phystat); in yukon_phy_intr()
1631 skge->duplex = (phystat & PHY_M_PS_FULL_DUP) ? DUPLEX_FULL : DUPLEX_HALF; in yukon_phy_intr()
1634 yukon_link_up(skge); in yukon_phy_intr()
1636 yukon_link_down(skge); in yukon_phy_intr()
1641 skge->netdev->name, reason); in yukon_phy_intr()
1677 static void skge_qset(struct skge_port *skge, u16 q, in skge_qset() argument
1680 struct skge_hw *hw = skge->hw; in skge_qset()
1682 u64 base = skge->dma + (e->desc - skge->mem); in skge_qset()
1696 struct skge_port *skge = netdev_priv(dev); in skge_free() local
1698 free(skge->rx_ring.start); in skge_free()
1699 skge->rx_ring.start = NULL; in skge_free()
1701 free(skge->tx_ring.start); in skge_free()
1702 skge->tx_ring.start = NULL; in skge_free()
1704 free_dma(skge->mem, RING_SIZE); in skge_free()
1705 skge->mem = NULL; in skge_free()
1706 skge->dma = 0; in skge_free()
1711 struct skge_port *skge = netdev_priv(dev); in skge_up() local
1712 struct skge_hw *hw = skge->hw; in skge_up()
1713 int port = skge->port; in skge_up()
1719 skge->mem = malloc_dma(RING_SIZE, SKGE_RING_ALIGN); in skge_up()
1720 skge->dma = virt_to_bus(skge->mem); in skge_up()
1721 if (!skge->mem) in skge_up()
1723 memset(skge->mem, 0, RING_SIZE); in skge_up()
1725 assert(!(skge->dma & 7)); in skge_up()
1728 if ((u64)skge->dma >> 32 != ((u64) skge->dma + RING_SIZE) >> 32) { in skge_up()
1734 err = skge_ring_alloc(&skge->rx_ring, skge->mem, skge->dma, NUM_RX_DESC); in skge_up()
1744 err = skge_ring_alloc(&skge->tx_ring, skge->mem + RX_RING_SIZE, in skge_up()
1745 skge->dma + RX_RING_SIZE, NUM_TX_DESC); in skge_up()
1760 skge_qset(skge, rxqaddr[port], skge->rx_ring.to_clean); in skge_up()
1762 assert(!(skge->tx_ring.to_use != skge->tx_ring.to_clean)); in skge_up()
1764 skge_qset(skge, txqaddr[port], skge->tx_ring.to_use); in skge_up()
1769 skge_led(skge, LED_MODE_ON); in skge_up()
1777 skge_rx_clean(skge); in skge_up()
1794 struct skge_port *skge = netdev_priv(dev); in skge_down() local
1795 struct skge_hw *hw = skge->hw; in skge_down()
1796 int port = skge->port; in skge_down()
1798 if (skge->mem == NULL) in skge_down()
1804 skge->use_xm_link_timer = 0; in skge_down()
1811 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF); in skge_down()
1813 genesis_stop(skge); in skge_down()
1815 yukon_stop(skge); in skge_down()
1848 skge_led(skge, LED_MODE_OFF); in skge_down()
1852 skge_rx_clean(skge); in skge_down()
1867 struct skge_port *skge = netdev_priv(dev); in skge_xmit_frame() local
1868 struct skge_hw *hw = skge->hw; in skge_xmit_frame()
1874 if (skge_tx_avail(&skge->tx_ring) < 1) in skge_xmit_frame()
1877 e = skge->tx_ring.to_use; in skge_xmit_frame()
1895 skge_write8(hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_START); in skge_xmit_frame()
1898 dev->name, e - skge->tx_ring.start, (unsigned int)len); in skge_xmit_frame()
1900 skge->tx_ring.to_use = e->next; in skge_xmit_frame()
1903 if (skge_tx_avail(&skge->tx_ring) <= 1) { in skge_xmit_frame()
1913 struct skge_port *skge = netdev_priv(dev); in skge_tx_clean() local
1916 for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) { in skge_tx_clean()
1921 skge->tx_ring.to_clean = e; in skge_tx_clean()
1946 struct skge_port *skge = netdev_priv(dev); in skge_tx_done() local
1947 struct skge_ring *ring = &skge->tx_ring; in skge_tx_done()
1950 skge_write8(skge->hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_IRQ_CL_F); in skge_tx_done()
1960 skge->tx_ring.to_clean = e; in skge_tx_done()
1968 struct skge_port *skge = netdev_priv(dev); in skge_rx_refill() local
1969 struct skge_ring *ring = &skge->rx_ring; in skge_rx_refill()
1990 skge_rx_setup(skge, e, iob, RX_BUF_SIZE); in skge_rx_refill()
2001 skge_rx_setup(skge, e, NULL, 0); in skge_rx_refill()
2010 struct skge_port *skge = netdev_priv(dev); in skge_rx_done() local
2011 struct skge_ring *ring = &skge->rx_ring; in skge_rx_done()
2036 if ((bad_phy_status(skge->hw, rd->status)) || in skge_rx_done()
2037 (phy_length(skge->hw, rd->status) != len)) { in skge_rx_done()
2057 struct skge_port *skge = netdev_priv(dev); in skge_poll() local
2058 struct skge_hw *hw = skge->hw; in skge_poll()
2067 if (skge->use_xm_link_timer) in skge_poll()
2068 xm_link_timer(skge); in skge_poll()
2073 skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_IRQ_CL_F); in skge_poll()
2079 skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_START); in skge_poll()
2092 struct skge_port *skge = netdev_priv(dev); in skge_phyirq() local
2095 yukon_phy_intr(skge); in skge_phyirq()
2097 bcom_phy_intr(skge); in skge_phyirq()
2299 struct skge_port *skge; in skge_devinit() local
2300 struct net_device *dev = alloc_etherdev(sizeof(*skge)); in skge_devinit()
2309 skge = netdev_priv(dev); in skge_devinit()
2310 skge->netdev = dev; in skge_devinit()
2311 skge->hw = hw; in skge_devinit()
2314 skge->autoneg = AUTONEG_ENABLE; in skge_devinit()
2315 skge->flow_control = FLOW_MODE_SYM_OR_REM; in skge_devinit()
2316 skge->duplex = -1; in skge_devinit()
2317 skge->speed = -1; in skge_devinit()
2318 skge->advertising = skge_supported_modes(hw); in skge_devinit()
2322 skge->port = port; in skge_devinit()
2456 struct skge_port *skge = netdev_priv(dev); in skge_net_irq() local
2457 struct skge_hw *hw = skge->hw; in skge_net_irq()
2460 hw->intr_mask |= portmask[skge->port]; in skge_net_irq()
2462 hw->intr_mask &= ~portmask[skge->port]; in skge_net_irq()