Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78981
b: refs/heads/master
c: b0cd2f9
h: refs/heads/master
i:
  78979: 8642183
v: v3
  • Loading branch information
Olof Johansson authored and David S. Miller committed Jan 28, 2008
1 parent c1a005f commit 35ece6f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 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: 8304b633c5e8c9ba34d3cc7f24f52434d3a3b93b
refs/heads/master: b0cd2f9016f75eb8a9fdc45d32f9b41fb16d48c9
41 changes: 33 additions & 8 deletions trunk/drivers/net/pasemi_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,24 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data)
return IRQ_HANDLED;
}

static void pasemi_mac_intf_disable(struct pasemi_mac *mac)
{
unsigned int flags;

flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG);
flags &= ~PAS_MAC_CFG_PCFG_PE;
write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
}

static void pasemi_mac_intf_enable(struct pasemi_mac *mac)
{
unsigned int flags;

flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG);
flags |= PAS_MAC_CFG_PCFG_PE;
write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
}

static void pasemi_adjust_link(struct net_device *dev)
{
struct pasemi_mac *mac = netdev_priv(dev);
Expand All @@ -889,11 +907,14 @@ static void pasemi_adjust_link(struct net_device *dev)
printk(KERN_INFO "%s: Link is down.\n", dev->name);

netif_carrier_off(dev);
pasemi_mac_intf_disable(mac);
mac->link = 0;

return;
} else
} else {
pasemi_mac_intf_enable(mac);
netif_carrier_on(dev);
}

flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG);
new_flags = flags & ~(PAS_MAC_CFG_PCFG_HD | PAS_MAC_CFG_PCFG_SPD_M |
Expand Down Expand Up @@ -1052,8 +1073,7 @@ static int pasemi_mac_open(struct net_device *dev)
pasemi_mac_restart_rx_intr(mac);
pasemi_mac_restart_tx_intr(mac);

flags = PAS_MAC_CFG_PCFG_S1 | PAS_MAC_CFG_PCFG_PE |
PAS_MAC_CFG_PCFG_PR | PAS_MAC_CFG_PCFG_CE;
flags = PAS_MAC_CFG_PCFG_S1 | PAS_MAC_CFG_PCFG_PR | PAS_MAC_CFG_PCFG_CE;

if (mac->type == MAC_TYPE_GMAC)
flags |= PAS_MAC_CFG_PCFG_TSR_1G | PAS_MAC_CFG_PCFG_SPD_1G;
Expand All @@ -1064,11 +1084,16 @@ static int pasemi_mac_open(struct net_device *dev)
write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);

ret = pasemi_mac_phy_init(dev);
/* Warn for missing PHY on SGMII (1Gig) ports.
*/
if (ret && mac->type == MAC_TYPE_GMAC) {
dev_warn(&mac->pdev->dev, "PHY init failed: %d.\n", ret);
dev_warn(&mac->pdev->dev, "Defaulting to 1Gbit full duplex\n");
if (ret) {
/* Since we won't get link notification, just enable RX */
pasemi_mac_intf_enable(mac);
if (mac->type == MAC_TYPE_GMAC) {
/* Warn for missing PHY on SGMII (1Gig) ports */
dev_warn(&mac->pdev->dev,
"PHY init failed: %d.\n", ret);
dev_warn(&mac->pdev->dev,
"Defaulting to 1Gbit full duplex\n");
}
}

netif_start_queue(dev);
Expand Down

0 comments on commit 35ece6f

Please sign in to comment.