struct device *dev;
struct net_device *netdev;
- struct phy_device *phy;
struct device_node *phy_node;
phy_interface_t phy_mode;
static void hix5hd2_adjust_link(struct net_device *dev)
{
struct hix5hd2_priv *priv = netdev_priv(dev);
- struct phy_device *phy = priv->phy;
+ struct phy_device *phy = dev->phydev;
if ((priv->speed != phy->speed) || (priv->duplex != phy->duplex)) {
hix5hd2_config_port(dev, phy->speed, phy->duplex);
static int hix5hd2_net_open(struct net_device *dev)
{
struct hix5hd2_priv *priv = netdev_priv(dev);
+ struct phy_device *phy;
int ret;
ret = clk_prepare_enable(priv->clk);
return ret;
}
- priv->phy = of_phy_connect(dev, priv->phy_node,
- &hix5hd2_adjust_link, 0, priv->phy_mode);
- if (!priv->phy)
+ phy = of_phy_connect(dev, priv->phy_node,
+ &hix5hd2_adjust_link, 0, priv->phy_mode);
+ if (!phy)
return -ENODEV;
- phy_start(priv->phy);
+ phy_start(phy);
hix5hd2_hw_init(priv);
hix5hd2_rx_refill(priv);
netif_stop_queue(dev);
hix5hd2_free_dma_desc_rings(priv);
- if (priv->phy) {
- phy_stop(priv->phy);
- phy_disconnect(priv->phy);
+ if (dev->phydev) {
+ phy_stop(dev->phydev);
+ phy_disconnect(dev->phydev);
}
clk_disable_unprepare(priv->clk);
static int hix5hd2_get_settings(struct net_device *net_dev,
struct ethtool_cmd *cmd)
{
- struct hix5hd2_priv *priv = netdev_priv(net_dev);
-
- if (!priv->phy)
+ if (!net_dev->phydev)
return -ENODEV;
- return phy_ethtool_gset(priv->phy, cmd);
+ return phy_ethtool_gset(net_dev->phydev, cmd);
}
static int hix5hd2_set_settings(struct net_device *net_dev,
struct ethtool_cmd *cmd)
{
- struct hix5hd2_priv *priv = netdev_priv(net_dev);
-
- if (!priv->phy)
+ if (!net_dev->phydev)
return -ENODEV;
- return phy_ethtool_sset(priv->phy, cmd);
+ return phy_ethtool_sset(net_dev->phydev, cmd);
}
static struct ethtool_ops hix5hd2_ethtools_ops = {