driver: net: fsl-mc: remove unused strcture elements

The phydev structure is present in both ldpaa_eth_priv and
wriop_dpmac_info. the phydev in wriop_dpmac_info is not being used

As the phydev is created based on phy_addr and bus members of
wriop_dpmac_info, it is appropriate to keep phydev in wriop_dpmac_info.

Also phy_regs is not being used, therefore remove it

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
lime2-spi
Pankaj Bansal 6 years ago committed by Joe Hershberger
parent afd6c6b470
commit d75e81d9e0
  1. 58
      drivers/net/ldpaa_eth/ldpaa_eth.c
  2. 1
      drivers/net/ldpaa_eth/ldpaa_eth.h
  3. 2
      drivers/net/ldpaa_eth/ldpaa_wriop.c
  4. 1
      include/fsl-mc/ldpaa_wriop.h

@ -35,7 +35,7 @@ static int init_phy(struct eth_device *dev)
return -1; return -1;
} }
priv->phydev = phydev; wriop_set_phy_dev(priv->dpmac_id, phydev);
return phy_config(phydev); return phy_config(phydev);
} }
@ -388,6 +388,7 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
struct mii_dev *bus; struct mii_dev *bus;
phy_interface_t enet_if; phy_interface_t enet_if;
struct dpni_queue d_queue; struct dpni_queue d_queue;
struct phy_device *phydev = NULL;
if (net_dev->state == ETH_STATE_ACTIVE) if (net_dev->state == ETH_STATE_ACTIVE)
return 0; return 0;
@ -408,38 +409,41 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
goto err_dpmac_setup; goto err_dpmac_setup;
#ifdef CONFIG_PHYLIB #ifdef CONFIG_PHYLIB
if (priv->phydev) { phydev = wriop_get_phy_dev(priv->dpmac_id);
err = phy_startup(priv->phydev); if (phydev) {
err = phy_startup(phydev);
if (err) { if (err) {
printf("%s: Could not initialize\n", printf("%s: Could not initialize\n",
priv->phydev->dev->name); phydev->dev->name);
goto err_dpmac_bind; goto err_dpmac_bind;
} }
} }
#else #else
priv->phydev = (struct phy_device *)malloc(sizeof(struct phy_device)); phydev = (struct phy_device *)malloc(sizeof(struct phy_device));
memset(priv->phydev, 0, sizeof(struct phy_device)); memset(phydev, 0, sizeof(struct phy_device));
wriop_set_phy_dev(priv->dpmac_id, phydev);
priv->phydev->speed = SPEED_1000; phydev->speed = SPEED_1000;
priv->phydev->link = 1; phydev->link = 1;
priv->phydev->duplex = DUPLEX_FULL; phydev->duplex = DUPLEX_FULL;
#endif #endif
bus = wriop_get_mdio(priv->dpmac_id); bus = wriop_get_mdio(priv->dpmac_id);
enet_if = wriop_get_enet_if(priv->dpmac_id); enet_if = wriop_get_enet_if(priv->dpmac_id);
if ((bus == NULL) && if ((bus == NULL) &&
(enet_if == PHY_INTERFACE_MODE_XGMII)) { (enet_if == PHY_INTERFACE_MODE_XGMII)) {
priv->phydev = (struct phy_device *) phydev = (struct phy_device *)
malloc(sizeof(struct phy_device)); malloc(sizeof(struct phy_device));
memset(priv->phydev, 0, sizeof(struct phy_device)); memset(phydev, 0, sizeof(struct phy_device));
wriop_set_phy_dev(priv->dpmac_id, phydev);
priv->phydev->speed = SPEED_10000; phydev->speed = SPEED_10000;
priv->phydev->link = 1; phydev->link = 1;
priv->phydev->duplex = DUPLEX_FULL; phydev->duplex = DUPLEX_FULL;
} }
if (!priv->phydev->link) { if (!phydev->link) {
printf("%s: No link.\n", priv->phydev->dev->name); printf("%s: No link.\n", phydev->dev->name);
err = -1; err = -1;
goto err_dpmac_bind; goto err_dpmac_bind;
} }
@ -476,17 +480,17 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
return err; return err;
} }
dpmac_link_state.rate = priv->phydev->speed; dpmac_link_state.rate = phydev->speed;
if (priv->phydev->autoneg == AUTONEG_DISABLE) if (phydev->autoneg == AUTONEG_DISABLE)
dpmac_link_state.options &= ~DPMAC_LINK_OPT_AUTONEG; dpmac_link_state.options &= ~DPMAC_LINK_OPT_AUTONEG;
else else
dpmac_link_state.options |= DPMAC_LINK_OPT_AUTONEG; dpmac_link_state.options |= DPMAC_LINK_OPT_AUTONEG;
if (priv->phydev->duplex == DUPLEX_HALF) if (phydev->duplex == DUPLEX_HALF)
dpmac_link_state.options |= DPMAC_LINK_OPT_HALF_DUPLEX; dpmac_link_state.options |= DPMAC_LINK_OPT_HALF_DUPLEX;
dpmac_link_state.up = priv->phydev->link; dpmac_link_state.up = phydev->link;
err = dpmac_set_link_state(dflt_mc_io, MC_CMD_NO_FLAGS, err = dpmac_set_link_state(dflt_mc_io, MC_CMD_NO_FLAGS,
priv->dpmac_handle, &dpmac_link_state); priv->dpmac_handle, &dpmac_link_state);
@ -530,7 +534,7 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
goto err_qdid; goto err_qdid;
} }
return priv->phydev->link; return phydev->link;
err_qdid: err_qdid:
err_get_queue: err_get_queue:
@ -556,6 +560,7 @@ static void ldpaa_eth_stop(struct eth_device *net_dev)
#ifdef CONFIG_PHYLIB #ifdef CONFIG_PHYLIB
struct mii_dev *bus = wriop_get_mdio(priv->dpmac_id); struct mii_dev *bus = wriop_get_mdio(priv->dpmac_id);
#endif #endif
struct phy_device *phydev = NULL;
if ((net_dev->state == ETH_STATE_PASSIVE) || if ((net_dev->state == ETH_STATE_PASSIVE) ||
(net_dev->state == ETH_STATE_INIT)) (net_dev->state == ETH_STATE_INIT))
@ -588,11 +593,12 @@ static void ldpaa_eth_stop(struct eth_device *net_dev)
printf("dpni_disable() failed\n"); printf("dpni_disable() failed\n");
#ifdef CONFIG_PHYLIB #ifdef CONFIG_PHYLIB
if (priv->phydev && bus != NULL) phydev = wriop_get_phy_dev(priv->dpmac_id);
phy_shutdown(priv->phydev); if (phydev && bus) {
else { phy_shutdown(phydev);
free(priv->phydev); } else {
priv->phydev = NULL; free(phydev);
wriop_set_phy_dev(priv->dpmac_id, NULL);
} }
#endif #endif

@ -127,7 +127,6 @@ struct ldpaa_eth_priv {
uint16_t tx_flow_id; uint16_t tx_flow_id;
enum ldpaa_eth_type type; /* 1G or 10G ethernet */ enum ldpaa_eth_type type; /* 1G or 10G ethernet */
struct phy_device *phydev;
}; };
struct dprc_endpoint dpmac_endpoint; struct dprc_endpoint dpmac_endpoint;

@ -26,6 +26,7 @@ void wriop_init_dpmac(int sd, int dpmac_id, int lane_prtcl)
dpmac_info[dpmac_id].enabled = 0; dpmac_info[dpmac_id].enabled = 0;
dpmac_info[dpmac_id].id = 0; dpmac_info[dpmac_id].id = 0;
dpmac_info[dpmac_id].phy_addr = -1; dpmac_info[dpmac_id].phy_addr = -1;
dpmac_info[dpmac_id].phydev = NULL;
dpmac_info[dpmac_id].enet_if = PHY_INTERFACE_MODE_NONE; dpmac_info[dpmac_id].enet_if = PHY_INTERFACE_MODE_NONE;
enet_if = wriop_dpmac_enet_if(dpmac_id, lane_prtcl); enet_if = wriop_dpmac_enet_if(dpmac_id, lane_prtcl);
@ -42,6 +43,7 @@ void wriop_init_dpmac_enet_if(int dpmac_id, phy_interface_t enet_if)
dpmac_info[dpmac_id].id = dpmac_id; dpmac_info[dpmac_id].id = dpmac_id;
dpmac_info[dpmac_id].phy_addr = -1; dpmac_info[dpmac_id].phy_addr = -1;
dpmac_info[dpmac_id].enet_if = enet_if; dpmac_info[dpmac_id].enet_if = enet_if;
dpmac_info[dpmac_id].phydev = NULL;
} }

@ -41,7 +41,6 @@ struct wriop_dpmac_info {
u8 id; u8 id;
u8 board_mux; u8 board_mux;
int phy_addr; int phy_addr;
void *phy_regs;
phy_interface_t enet_if; phy_interface_t enet_if;
struct phy_device *phydev; struct phy_device *phydev;
struct mii_dev *bus; struct mii_dev *bus;

Loading…
Cancel
Save