Commit 715a0227 authored by Philippe Reynes's avatar Philippe Reynes Committed by David S. Miller

net: ethernet: bcmsysport: use phydev from struct net_device

The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phydev in the private structure, and update the driver to use the
one contained in struct net_device.
Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 90789322
...@@ -99,23 +99,19 @@ static inline void tdma_port_write_desc_addr(struct bcm_sysport_priv *priv, ...@@ -99,23 +99,19 @@ static inline void tdma_port_write_desc_addr(struct bcm_sysport_priv *priv,
static int bcm_sysport_set_settings(struct net_device *dev, static int bcm_sysport_set_settings(struct net_device *dev,
struct ethtool_cmd *cmd) struct ethtool_cmd *cmd)
{ {
struct bcm_sysport_priv *priv = netdev_priv(dev);
if (!netif_running(dev)) if (!netif_running(dev))
return -EINVAL; return -EINVAL;
return phy_ethtool_sset(priv->phydev, cmd); return phy_ethtool_sset(dev->phydev, cmd);
} }
static int bcm_sysport_get_settings(struct net_device *dev, static int bcm_sysport_get_settings(struct net_device *dev,
struct ethtool_cmd *cmd) struct ethtool_cmd *cmd)
{ {
struct bcm_sysport_priv *priv = netdev_priv(dev);
if (!netif_running(dev)) if (!netif_running(dev))
return -EINVAL; return -EINVAL;
return phy_ethtool_gset(priv->phydev, cmd); return phy_ethtool_gset(dev->phydev, cmd);
} }
static int bcm_sysport_set_rx_csum(struct net_device *dev, static int bcm_sysport_set_rx_csum(struct net_device *dev,
...@@ -1127,7 +1123,7 @@ static void bcm_sysport_tx_timeout(struct net_device *dev) ...@@ -1127,7 +1123,7 @@ static void bcm_sysport_tx_timeout(struct net_device *dev)
static void bcm_sysport_adj_link(struct net_device *dev) static void bcm_sysport_adj_link(struct net_device *dev)
{ {
struct bcm_sysport_priv *priv = netdev_priv(dev); struct bcm_sysport_priv *priv = netdev_priv(dev);
struct phy_device *phydev = priv->phydev; struct phy_device *phydev = dev->phydev;
unsigned int changed = 0; unsigned int changed = 0;
u32 cmd_bits = 0, reg; u32 cmd_bits = 0, reg;
...@@ -1182,7 +1178,7 @@ static void bcm_sysport_adj_link(struct net_device *dev) ...@@ -1182,7 +1178,7 @@ static void bcm_sysport_adj_link(struct net_device *dev)
umac_writel(priv, reg, UMAC_CMD); umac_writel(priv, reg, UMAC_CMD);
} }
phy_print_status(priv->phydev); phy_print_status(phydev);
} }
static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv, static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv,
...@@ -1525,7 +1521,7 @@ static void bcm_sysport_netif_start(struct net_device *dev) ...@@ -1525,7 +1521,7 @@ static void bcm_sysport_netif_start(struct net_device *dev)
/* Enable RX interrupt and TX ring full interrupt */ /* Enable RX interrupt and TX ring full interrupt */
intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE | INTRL2_0_TX_RING_FULL); intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE | INTRL2_0_TX_RING_FULL);
phy_start(priv->phydev); phy_start(dev->phydev);
/* Enable TX interrupts for the 32 TXQs */ /* Enable TX interrupts for the 32 TXQs */
intrl2_1_mask_clear(priv, 0xffffffff); intrl2_1_mask_clear(priv, 0xffffffff);
...@@ -1546,6 +1542,7 @@ static void rbuf_init(struct bcm_sysport_priv *priv) ...@@ -1546,6 +1542,7 @@ static void rbuf_init(struct bcm_sysport_priv *priv)
static int bcm_sysport_open(struct net_device *dev) static int bcm_sysport_open(struct net_device *dev)
{ {
struct bcm_sysport_priv *priv = netdev_priv(dev); struct bcm_sysport_priv *priv = netdev_priv(dev);
struct phy_device *phydev;
unsigned int i; unsigned int i;
int ret; int ret;
...@@ -1570,9 +1567,9 @@ static int bcm_sysport_open(struct net_device *dev) ...@@ -1570,9 +1567,9 @@ static int bcm_sysport_open(struct net_device *dev)
/* Read CRC forward */ /* Read CRC forward */
priv->crc_fwd = !!(umac_readl(priv, UMAC_CMD) & CMD_CRC_FWD); priv->crc_fwd = !!(umac_readl(priv, UMAC_CMD) & CMD_CRC_FWD);
priv->phydev = of_phy_connect(dev, priv->phy_dn, bcm_sysport_adj_link, phydev = of_phy_connect(dev, priv->phy_dn, bcm_sysport_adj_link,
0, priv->phy_interface); 0, priv->phy_interface);
if (!priv->phydev) { if (!phydev) {
netdev_err(dev, "could not attach to PHY\n"); netdev_err(dev, "could not attach to PHY\n");
return -ENODEV; return -ENODEV;
} }
...@@ -1650,7 +1647,7 @@ static int bcm_sysport_open(struct net_device *dev) ...@@ -1650,7 +1647,7 @@ static int bcm_sysport_open(struct net_device *dev)
out_free_irq0: out_free_irq0:
free_irq(priv->irq0, dev); free_irq(priv->irq0, dev);
out_phy_disconnect: out_phy_disconnect:
phy_disconnect(priv->phydev); phy_disconnect(phydev);
return ret; return ret;
} }
...@@ -1661,7 +1658,7 @@ static void bcm_sysport_netif_stop(struct net_device *dev) ...@@ -1661,7 +1658,7 @@ static void bcm_sysport_netif_stop(struct net_device *dev)
/* stop all software from updating hardware */ /* stop all software from updating hardware */
netif_tx_stop_all_queues(dev); netif_tx_stop_all_queues(dev);
napi_disable(&priv->napi); napi_disable(&priv->napi);
phy_stop(priv->phydev); phy_stop(dev->phydev);
/* mask all interrupts */ /* mask all interrupts */
intrl2_0_mask_set(priv, 0xffffffff); intrl2_0_mask_set(priv, 0xffffffff);
...@@ -1708,7 +1705,7 @@ static int bcm_sysport_stop(struct net_device *dev) ...@@ -1708,7 +1705,7 @@ static int bcm_sysport_stop(struct net_device *dev)
free_irq(priv->irq1, dev); free_irq(priv->irq1, dev);
/* Disconnect from PHY */ /* Disconnect from PHY */
phy_disconnect(priv->phydev); phy_disconnect(dev->phydev);
return 0; return 0;
} }
...@@ -1929,7 +1926,7 @@ static int bcm_sysport_suspend(struct device *d) ...@@ -1929,7 +1926,7 @@ static int bcm_sysport_suspend(struct device *d)
bcm_sysport_netif_stop(dev); bcm_sysport_netif_stop(dev);
phy_suspend(priv->phydev); phy_suspend(dev->phydev);
netif_device_detach(dev); netif_device_detach(dev);
...@@ -2055,7 +2052,7 @@ static int bcm_sysport_resume(struct device *d) ...@@ -2055,7 +2052,7 @@ static int bcm_sysport_resume(struct device *d)
goto out_free_rx_ring; goto out_free_rx_ring;
} }
phy_resume(priv->phydev); phy_resume(dev->phydev);
bcm_sysport_netif_start(dev); bcm_sysport_netif_start(dev);
......
...@@ -670,7 +670,6 @@ struct bcm_sysport_priv { ...@@ -670,7 +670,6 @@ struct bcm_sysport_priv {
/* PHY device */ /* PHY device */
struct device_node *phy_dn; struct device_node *phy_dn;
struct phy_device *phydev;
phy_interface_t phy_interface; phy_interface_t phy_interface;
int old_pause; int old_pause;
int old_link; int old_link;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment