lan78xx.c (07fa3fa2572f2dee85beb8137f90ccf33d7206af) | lan78xx.c (3c1bcc8614db10803f1f57ef0295363917448cb2) |
---|---|
1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Copyright (C) 2015 Microchip Technology 4 */ 5#include <linux/version.h> 6#include <linux/module.h> 7#include <linux/netdevice.h> 8#include <linux/etherdevice.h> 9#include <linux/ethtool.h> 10#include <linux/usb.h> 11#include <linux/crc32.h> 12#include <linux/signal.h> 13#include <linux/slab.h> 14#include <linux/if_vlan.h> 15#include <linux/uaccess.h> | 1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Copyright (C) 2015 Microchip Technology 4 */ 5#include <linux/version.h> 6#include <linux/module.h> 7#include <linux/netdevice.h> 8#include <linux/etherdevice.h> 9#include <linux/ethtool.h> 10#include <linux/usb.h> 11#include <linux/crc32.h> 12#include <linux/signal.h> 13#include <linux/slab.h> 14#include <linux/if_vlan.h> 15#include <linux/uaccess.h> |
16#include <linux/linkmode.h> |
|
16#include <linux/list.h> 17#include <linux/ip.h> 18#include <linux/ipv6.h> 19#include <linux/mdio.h> 20#include <linux/phy.h> 21#include <net/ip6_checksum.h> 22#include <linux/interrupt.h> 23#include <linux/irqdomain.h> --- 1557 unchanged lines hidden (view full) --- 1581 dev->fc_request_control = 0; 1582 if (pause->rx_pause) 1583 dev->fc_request_control |= FLOW_CTRL_RX; 1584 1585 if (pause->tx_pause) 1586 dev->fc_request_control |= FLOW_CTRL_TX; 1587 1588 if (ecmd.base.autoneg) { | 17#include <linux/list.h> 18#include <linux/ip.h> 19#include <linux/ipv6.h> 20#include <linux/mdio.h> 21#include <linux/phy.h> 22#include <net/ip6_checksum.h> 23#include <linux/interrupt.h> 24#include <linux/irqdomain.h> --- 1557 unchanged lines hidden (view full) --- 1582 dev->fc_request_control = 0; 1583 if (pause->rx_pause) 1584 dev->fc_request_control |= FLOW_CTRL_RX; 1585 1586 if (pause->tx_pause) 1587 dev->fc_request_control |= FLOW_CTRL_TX; 1588 1589 if (ecmd.base.autoneg) { |
1590 __ETHTOOL_DECLARE_LINK_MODE_MASK(fc) = { 0, }; |
|
1589 u32 mii_adv; | 1591 u32 mii_adv; |
1590 u32 advertising; | |
1591 | 1592 |
1592 ethtool_convert_link_mode_to_legacy_u32( 1593 &advertising, ecmd.link_modes.advertising); 1594 1595 advertising &= ~(ADVERTISED_Pause | ADVERTISED_Asym_Pause); | 1593 linkmode_clear_bit(ETHTOOL_LINK_MODE_Pause_BIT, 1594 ecmd.link_modes.advertising); 1595 linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, 1596 ecmd.link_modes.advertising); |
1596 mii_adv = (u32)mii_advertise_flowctrl(dev->fc_request_control); | 1597 mii_adv = (u32)mii_advertise_flowctrl(dev->fc_request_control); |
1597 advertising |= mii_adv_to_ethtool_adv_t(mii_adv); | 1598 mii_adv_to_linkmode_adv_t(fc, mii_adv); 1599 linkmode_or(ecmd.link_modes.advertising, fc, 1600 ecmd.link_modes.advertising); |
1598 | 1601 |
1599 ethtool_convert_legacy_u32_to_link_mode( 1600 ecmd.link_modes.advertising, advertising); 1601 | |
1602 phy_ethtool_ksettings_set(phydev, &ecmd); 1603 } 1604 1605 dev->fc_autoneg = pause->autoneg; 1606 1607 ret = 0; 1608exit: 1609 return ret; --- 480 unchanged lines hidden (view full) --- 2090 2091 phydev->is_internal = false; 2092 } 2093 return phydev; 2094} 2095 2096static int lan78xx_phy_init(struct lan78xx_net *dev) 2097{ | 1602 phy_ethtool_ksettings_set(phydev, &ecmd); 1603 } 1604 1605 dev->fc_autoneg = pause->autoneg; 1606 1607 ret = 0; 1608exit: 1609 return ret; --- 480 unchanged lines hidden (view full) --- 2090 2091 phydev->is_internal = false; 2092 } 2093 return phydev; 2094} 2095 2096static int lan78xx_phy_init(struct lan78xx_net *dev) 2097{ |
2098 __ETHTOOL_DECLARE_LINK_MODE_MASK(fc) = { 0, }; |
|
2098 int ret; 2099 u32 mii_adv; 2100 struct phy_device *phydev; 2101 2102 switch (dev->chipid) { 2103 case ID_REV_CHIP_ID_7801_: 2104 phydev = lan7801_phy_init(dev); 2105 if (!phydev) { --- 47 unchanged lines hidden (view full) --- 2153 return -EIO; 2154 } 2155 2156 /* MAC doesn't support 1000T Half */ 2157 phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT); 2158 2159 /* support both flow controls */ 2160 dev->fc_request_control = (FLOW_CTRL_RX | FLOW_CTRL_TX); | 2099 int ret; 2100 u32 mii_adv; 2101 struct phy_device *phydev; 2102 2103 switch (dev->chipid) { 2104 case ID_REV_CHIP_ID_7801_: 2105 phydev = lan7801_phy_init(dev); 2106 if (!phydev) { --- 47 unchanged lines hidden (view full) --- 2154 return -EIO; 2155 } 2156 2157 /* MAC doesn't support 1000T Half */ 2158 phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT); 2159 2160 /* support both flow controls */ 2161 dev->fc_request_control = (FLOW_CTRL_RX | FLOW_CTRL_TX); |
2161 phydev->advertising &= ~(ADVERTISED_Pause | ADVERTISED_Asym_Pause); | 2162 linkmode_clear_bit(ETHTOOL_LINK_MODE_Pause_BIT, 2163 phydev->advertising); 2164 linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, 2165 phydev->advertising); |
2162 mii_adv = (u32)mii_advertise_flowctrl(dev->fc_request_control); | 2166 mii_adv = (u32)mii_advertise_flowctrl(dev->fc_request_control); |
2163 phydev->advertising |= mii_adv_to_ethtool_adv_t(mii_adv); | 2167 mii_adv_to_linkmode_adv_t(fc, mii_adv); 2168 linkmode_or(phydev->advertising, fc, phydev->advertising); |
2164 2165 if (phydev->mdio.dev.of_node) { 2166 u32 reg; 2167 int len; 2168 2169 len = of_property_count_elems_of_size(phydev->mdio.dev.of_node, 2170 "microchip,led-modes", 2171 sizeof(u32)); --- 2022 unchanged lines hidden --- | 2169 2170 if (phydev->mdio.dev.of_node) { 2171 u32 reg; 2172 int len; 2173 2174 len = of_property_count_elems_of_size(phydev->mdio.dev.of_node, 2175 "microchip,led-modes", 2176 sizeof(u32)); --- 2022 unchanged lines hidden --- |