Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134567
b: refs/heads/master
c: 6bdf576
h: refs/heads/master
i:
  134565: 37990cb
  134563: 09014bd
  134559: a9eda06
v: v3
  • Loading branch information
Lennert Buytenhek authored and David S. Miller committed Feb 16, 2009
1 parent 9257eb1 commit 5b7c03b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aa611f85d0d656870dbb906e75d8cac6acb58943
refs/heads/master: 6bdf576e4b068e86381280c58393cad42ffc8cc8
56 changes: 23 additions & 33 deletions trunk/drivers/net/mv643xx_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1279,9 +1279,9 @@ static const struct mv643xx_eth_stats mv643xx_eth_stats[] = {
};

static int
mv643xx_eth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
mv643xx_eth_get_settings_phy(struct mv643xx_eth_private *mp,
struct ethtool_cmd *cmd)
{
struct mv643xx_eth_private *mp = netdev_priv(dev);
int err;

err = phy_read_status(mp->phy);
Expand All @@ -1298,10 +1298,9 @@ mv643xx_eth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
}

static int
mv643xx_eth_get_settings_phyless(struct net_device *dev,
mv643xx_eth_get_settings_phyless(struct mv643xx_eth_private *mp,
struct ethtool_cmd *cmd)
{
struct mv643xx_eth_private *mp = netdev_priv(dev);
u32 port_status;

port_status = rdlp(mp, PORT_STATUS);
Expand Down Expand Up @@ -1333,11 +1332,25 @@ mv643xx_eth_get_settings_phyless(struct net_device *dev,
return 0;
}

static int
mv643xx_eth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct mv643xx_eth_private *mp = netdev_priv(dev);

if (mp->phy != NULL)
return mv643xx_eth_get_settings_phy(mp, cmd);
else
return mv643xx_eth_get_settings_phyless(mp, cmd);
}

static int
mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct mv643xx_eth_private *mp = netdev_priv(dev);

if (mp->phy == NULL)
return -EINVAL;

/*
* The MAC does not support 1000baseT_Half.
*/
Expand All @@ -1346,13 +1359,6 @@ mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return phy_ethtool_sset(mp->phy, cmd);
}

static int
mv643xx_eth_set_settings_phyless(struct net_device *dev,
struct ethtool_cmd *cmd)
{
return -EINVAL;
}

static void mv643xx_eth_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *drvinfo)
{
Expand All @@ -1367,12 +1373,10 @@ static int mv643xx_eth_nway_reset(struct net_device *dev)
{
struct mv643xx_eth_private *mp = netdev_priv(dev);

return genphy_restart_aneg(mp->phy);
}
if (mp->phy == NULL)
return -EINVAL;

static int mv643xx_eth_nway_reset_phyless(struct net_device *dev)
{
return -EINVAL;
return genphy_restart_aneg(mp->phy);
}

static u32 mv643xx_eth_get_link(struct net_device *dev)
Expand Down Expand Up @@ -1440,18 +1444,6 @@ static const struct ethtool_ops mv643xx_eth_ethtool_ops = {
.get_sset_count = mv643xx_eth_get_sset_count,
};

static const struct ethtool_ops mv643xx_eth_ethtool_ops_phyless = {
.get_settings = mv643xx_eth_get_settings_phyless,
.set_settings = mv643xx_eth_set_settings_phyless,
.get_drvinfo = mv643xx_eth_get_drvinfo,
.nway_reset = mv643xx_eth_nway_reset_phyless,
.get_link = mv643xx_eth_get_link,
.set_sg = ethtool_op_set_sg,
.get_strings = mv643xx_eth_get_strings,
.get_ethtool_stats = mv643xx_eth_get_ethtool_stats,
.get_sset_count = mv643xx_eth_get_sset_count,
};


/* address handling *********************************************************/
static void uc_addr_get(struct mv643xx_eth_private *mp, unsigned char *addr)
Expand Down Expand Up @@ -2673,12 +2665,10 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
if (pd->phy_addr != MV643XX_ETH_PHY_NONE)
mp->phy = phy_scan(mp, pd->phy_addr);

if (mp->phy != NULL) {
if (mp->phy != NULL)
phy_init(mp, pd->speed, pd->duplex);
SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops);
} else {
SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops_phyless);
}

SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops);

init_pscr(mp, pd->speed, pd->duplex);

Expand Down

0 comments on commit 5b7c03b

Please sign in to comment.