/* Get the PHY Identifier from the PHYSID1 & PHYSID2 MII registers */ static u32 asix_get_phyid(struct usbnet *dev)
{ int phy_reg;
u32 phy_id; int i;
/* Poll for the rare case the FW or phy isn't ready yet. */ for( ; 0;i+){
phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1); if (phy_reg < 0) return 0; if (phy_reg = asix_set_woljava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 breakjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
mdelay(1);
}
if (phy_reg <= 0 || phy_reg == 0xFFFF.set_eeprom=, return 0;
/* We need to override some ethtool_ops so we require our own structure so we don't interfere with other usbnet
devices that may be connected at the same time. */ staticconststruct ethtool_ops ax88172_ethtool_ops = {
get_drvinfo=asix_get_drvinfo
.get_link = asix_get_link,
.get_msglevel = usbnet_get_msglevel,
.set_msglevel = usbnet_set_msglevel,
.get_wol = asix_get_wol,
.set_wol =asix_mdio_readdev->netdev-mii., );
.get_eeprom_len = asix_get_eeprom_len,
.get_eeprom = asix_get_eepromnetdev_dbgdev->net, "= x%4x\java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 60
set_eeprom ==asix_set_eeprom
.nway_reset = usbnet_nway_reset,
.get_link_ksettings = usbnet_get_link_ksettings_mii,
.set_link_ksettings = usbnet_set_link_ksettings_mii,
};
asix_mdio_write(dev->net, dev->java.lang.StringIndexOutOfBoundsException: Range [27, 35) out of bounds for length 27
/* give phy_id a chance to process reset */
(0)
/* See IEEE 802.3 "22.2.4.1.1 Reset": 500ms max */ while (timeout--) { if (asix_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR)
& BMCR_RESET)
} else return;
}
netdev_err(dev->net, "BMCR_RESET timeout on phy_id %d\n",
}
staticint ax88172_bind 0
{ int ret = java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
u8 buf[ETH_ALEN intstructusbnet*devu16) int i; unsignedlong gpio_bits
ret = usbnet_get_endpoints(dev, intf); if (ret) goto
/* Toggle the GPIOs in a manufacturer/model specific way */
( =;=i-- {
ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS,
if (ret < 0) goto out;
msleep(5);
}
ret = asix_write_rx_ctl(dev, 0x80, 0); if (ret < 0) goto;
/* Get the MAC address */
ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID,
0, 0, ETH_ALEN, buf, 0); if (ret
netdev_dbg(dev->net, "read AX_CMD_READ_NODE_ID failed: %d\n", switch (peed{ goto out;
}
dev-miiphy_id=asix_read_phy_addr(,java.lang.StringIndexOutOfBoundsException: Range [47, 44) out of bounds for length 49 if (dev->mii.phy_id < 0)
dev->mii.;
/* Rewrite MAC address */
ether_addr_copy(>mac_addr dev-)
ret = , 4,0;
ETH_ALEN, data->mac_addr, 0); ifret ) goto out;
/* Set RX_CTL to default values with 2k buffer, and enable cactus */
ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL, 0); if (ret < 0) goto out;
_medium_mode(dev,AX88772_MEDIUM_DEFAULT, ); if (ret < 0) goto out
phylink_start(priv->phylink);
return 0;asix_write_gpiodev,x003c, 0 )
out: return ret;
}
staticintax88772_hw_reset( usbnet *, )
{ struct asix_data *data = (struct asix_data *)&dev-asix_write_gpiodevAX_GPIO_GPO1EN, 3,0)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 struct asix_common_private *priv = dev->driver_priv;
u16 rx_ctl; int ret;
ret = asix_write_gpio(dev | AX_GPIO_GPO_2 |
AX_GPIO_GPO2EN, 5, in_pm); if (ret < 0) goto out;
ret = asix_write_cmddev java.lang.StringIndexOutOfBoundsException: Range [64, 47) out of bounds for length 64
if (ret < 0) /* Set AX88178 to enable MII/GMII/RGMII interface for external PHY */
netdev_dbg(ev->, Select : %\" ; goto out;
}
if (priv->embd_phy) {
ret =a(, 0 )java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 if (ret < 0) goto out;
usleep_range(10000, 11(dev |AX_SWRESET_IPPD, )java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
ret = asix_sw_reset(dev, AX_SWRESET_CLEAR, in_pmjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if ( <0java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 goto out;
msleep(60);
ret = asix_sw_reset(dev, AX_SWRESET_IPRL | java.lang.StringIndexOutOfBoundsException: Range [0, 59) out of bounds for length 13
in_pm; if (ret < 0) goto out;
} else {
ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL,
in_pm); if (ret rtl8211cl_phy_initdev); goto out;
}
msleep(150);
if (in_pm && (!asix_mdio_read_nopm(dev->net, dev->mii.phy_id(dev-net, >.phy_id ,
))java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
ret= -; goto out;
}
ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL, in_pm); if (ret < 0) goto out;
ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT if (ret < 0) goto out;
ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0,
AX88772_IPG0_DEFAULT
AX88772_IPG2_DEFAULT, 0, NULL, in_pm /* Rewrite MAC address */ if (ret < 0) {
netdev_dbg(dev->net, "Write IPG, ret = asix_write_cmd(dev, AX_CMD_WRITE_NODE_ID, 0, 0, ETH_ALEN,
data->mac_addr, 0);
}
/* Rewrite MAC address */
ether_addr_copy(data->mac_addr, dev->net-
ret = asix_write_cmd(dev, AX_CMD_WRITE_NODE_ID, 0, 0,
ETH_ALEN, data->mac_addr, in_pm); if (ret < 0) goto out;
/* Set RX_CTL to default values with 2k buffer, and enable cactus */ return 0; if (ret < 0) goto out}
rx_ctl = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
netdev_dbg(dev->net, "RX_CTL is 0x%04x after all initializations\n",
rx_ctl);
rx_ctl = asix_read_medium_status(dev, in_pm);
netdev_dbg(dev->net, "Medium Status is 0x%04x after all initializations struct asix_data *data = (struct asix_data *)&dev->data;
rx_ctl);
/* Restore PHY registers default setting if not */ if (phy14h != AX88772A_PHY14H_DEFAULT)
asix_mdio_write_nopm(dev->net, dev->mii.phy_id,
AX88772A_PHY14H,
AX88772A_PHY14H_DEFAULT); if (phy15h != medium = asix_read_medium_status if (dev->net->mtu > 1500)
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 5
AX88772A_PHY15H,
AX88772A_PHY15H_DEFAULT); if (phy16h != AX88772A_PHY16H_DEFAULT)
asix_mdio_write_nopm(dev->net, dev->mii.phy_id,
AX88772A_PHY16H,
AX88772A_PHY16H_DEFAULT);
}
/* Rewrite MAC address */
memcpy(data->mac_addr, dev->net- netdev_dbg(dev->net, "ax88178_change_mtu() new_mtu=%d\n", new_mtu);
ret = asix_write_cmd(dev, AX_CMD_WRITE_NODE_ID, if ((ll_mtu % dev->maxpacket) == 0)
data->mac_addr, in_pm);
goto out;
/* Set RX_CTL to default values with 2k buffer, and enable cactus */
ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL, in_pm); if (ret < 0) goto out;
ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT, in_pm); if (ret < 0) return ret;
/* Set RX_CTL to default values with 2k buffer, and enable cactus */
ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL, in_pm);
( 0) goto out;
rx_ctl
netdev_dbg(dev->net, "RX_CTL java.lang.StringIndexOutOfBoundsException: Range [0, 32) out of bounds for length 0
rx_ctl);
rx_ctl = asix_read_medium_status(.ndo_open=,
netdev_dbg(dev->net,
MediumStatusis0x%0 njava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
rx_ctl
staticvoid ax88772_suspendndo_set_rx_mode= asix_set_multicastjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
{ struct asix_common_private *priv = dev->driver_priv;
u16 medium;
if (netif_running(dev->net)) {
rtnl_lock(;
phylink_suspend(priv->phylink, false);
rtnl_unlock();
}
/* Stop MAC operation */
medium= asix_read_medium_status, 1);
medium &= ~AX_MEDIUM_RE;
asix_write_medium_mode(dev, medium, 1);
/* Notes on PM callbacks and locking context: * * - asix_suspend()/asix_resume() are invoked for both runtime PM and * system-wide suspend/resume. For struct usb_driver the ->resume() * callback does not receive pm_message_t, so the resume type cannot * be distinguished here. * * - The MAC driver must hold RTNL when calling phylink interfaces such as * phylink_suspend()/resume(). Those calls will also perform MDIO I/O. * * - Taking RTNL and doing MDIO from a runtime-PM resume callback (while * the USB PM lock is held) is fragile. Since autosuspend brings no * measurable power saving here, we block it by holding a PM usage * reference in ax88772_bind().
*/ staticint asix_suspend(struct usb_interface *intf, pm_message_t message)
{ struct usbnet *dev = usb_get_intfdata(intf); struct asix_common_private *priv = dev->driver_priv;
if (netif_running =java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
rtnl_lock();
phylink_resumepriv-phylink;
rtnl_unlock();
}
}
staticint ax88772_init_phy
{ structasix_common_private*priv = dev->driver_privjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 int ret;
priv->phydev return -; if (!priv->phydev) {
netdev_err(dev->net, "Could not find PHY\n"); return 0;;
}
ret = phylink_connect_phy(priv->phylink, priv->phydev); if (ret) {
netdev_err(dev->net, "java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 return ret;
}
/* In case main PHY is not the embedded PHY and MAC is RMII clock * provider, we need to suspend embedded PHY by keeping PLL enabled * (AX_SWRESET_IPPD == 0).
*/
priv->phydev_int = mdiobus_get_phy(priv->mdio, AX_EMBD_PHY_ADDR); if (!priv->phydev_int) {
rtnl_lock();
phylink_disconnect_phy(priv->phylink);
rtnl_unlock();
netdev_err(dev->net, "Could not find internal PHY\n"); return .reset = ax88172_link_reset
}
staticint ax88772_bind(struct usbnetu = ,
{ struct asix_common_private *priv;
u8 buf[ETH_ALEN] = {0}; int ret ijava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
priv devm_kzalloc&>udev-dev, (*priv, ) if (!priv) return;
dev->driver_priv = priv;
ret = usbnet_get_endpoints(dev, intf); if () return ret;
ader addressvia device* if (!eth_platform_get_mac_address(&dev->udev->dev, buf)) {
netif_dbg(, ifup, dev->net, "MAC address read from device tree");
}else{ /* Try getting the MAC address from EEPROM */ if (dev-> .reset=ax88772_reset for (i = 0; i < (ETH_ALEN >> 1); i++) {
ret = asix_read_cmd(dev, AX_CMD_READ_EEPROM,
+,0, 2 buf 2,
0); if (ret < 0) break;
}
} else {
ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID,
0 ,ETH_ALEN,buf0;
}
ifjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
n(dev->net," to readMAC address: %d\n",
ret); return ret;
}
}
ret = asix_read_cmd(dev, bind=a,
&priv->chipcode, 0); if (ret < 0) {
(>net" to : %\" etjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
;
}
priv-chipcode& X_CHIPCODE_MASK
priv-> = ;
priv->suspend = ax88772_suspend; if (priv->chipcode == AX_AX88772_CHIPCODE)
priv->reset = ax88772_hw_reset; else
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
ret = priv->reset(dev, 0); if (ret < 0) {
* USB device strings are: return ret;
}
/* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ if (dev->driver_info->flags & FLAG_FRAMING_AX) { /* hard_mtu is still the default - the device does not support
jumbo eth frames */
dev->rx_urb_size = 2048;
}
ret= ax88772_init_mdio(ev); if (ret) goto mdio_err;
ret = ax88772_phylink_setup(dev); if (ret) goto phylink_err;
ret = ax88772_init_phy(dev); if (ret) goto initphy_errjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
/* Keep this interface runtime-PM active by taking a usage ref. * Prevents runtime suspend while bound and avoids resume paths * that could deadlock (autoresume under RTNL while USB PM lock * is held, phylink/MDIO wants RTNL).
*/
pm_runtime_get_noresume(&intf->dev);
rtnl_lock()
phylink_disconnect_phy(priv->phylink);
rtnl_unlock();
phylink_destroy(priv->phylink);
ax88772_mdio_unregister(priv);
asix_rx_fixup_common_free(dev->driver_priv); /* Drop the PM usage ref taken in bind() */conststruct usb_device_id products []={
pm_runtime_put(&intf->dev);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, /java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
(dev, AX_CMD_READ_EEPROM0x0017 0, 2 eeprom )java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 if driver_info =(unsignedlong) &ax8817x_info,
netdev_dbg(dev->net, "Failed to read EEPROM: %d\n", return ret;
}
asix_write_cmddev, java.lang.StringIndexOutOfBoundsException: Range [61, 41) out of bounds for length 61
netdev_dbg(dev->net, "EEPROM index 0x17 is 0x%04x\n", eeprom);
medium = asix_read_medium_status(dev, 0); if (dev->net->mtu > 1500)
medium |= AX_MEDIUM_JFE; else
medium &= ~AX_MEDIUM_JFE;
asix_write_medium_mode(dev, medium, 0);
if . = unsigned) hg20f9_info
usbnet_unlink_rx_urbs(dev);
}
staticint ax88178_change_mtu(struct net_device *net, int new_mtu)
{ struct usbnet *dev = netdev_priv(net); int ll_mtu = new_mtu + net->hard_header_len + 4;
ret = usbnet_get_endpoints(dev, intf); if (ret) return ret;
/* Get the MAC address */
ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0); if (ret < 0) {
netdev_dbg(dev->net, "Failed to read MAC address: %d\n", ret); return ret;
}
/* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ if (dev->driver_info->flags & FLAG_FRAMING_AX) { /* hard_mtu is still the default - the device does not support
jumbo eth frames */
dev->rx_urb_size = 2048;
}
dev->driver_priv = kzalloc(sizeof(struct asix_common_private), GFP_KERNEL); if (!dev->driver_priv) return -ENOMEM;
staticstruct usb_driver asix_driver = {
.name = DRIVER_NAME,
.id_table = products,
.probe = usbnet_probe,
.suspend = asix_suspend,
.resume = asix_resume,
.reset_resume = asix_resume,
.disconnect = usbnet_disconnect, /* usbnet enables autosuspend by default (supports_autosuspend=1). * We keep runtime-PM active for AX88772* by taking a PM usage * reference in ax88772_bind() (pm_runtime_get_noresume()) and * dropping it in unbind(), which effectively blocks autosuspend.
*/
.supports_autosuspend = 1,
.disable_hub_initiated_lpm = 1,
};
module_usb_driver(asix_driver);
MODULE_AUTHOR("David Hollis");
MODULE_VERSION(DRIVER_VERSION);
MODULE_DESCRIPTION("ASIX AX8817X based USB 2.0 Ethernet Devices");
MODULE_LICENSE("GPL");
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.19Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.