Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340580
b: refs/heads/master
c: 140b755
h: refs/heads/master
v: v3
  • Loading branch information
Patrice Vilchez authored and David S. Miller committed Nov 1, 2012
1 parent 8b58777 commit 20704c4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 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: 65f8f9a1c1db831e5159e3e3e50912d1f214cd0c
refs/heads/master: 140b7552fdff04bbceeb842f0e04f0b4015fe97b
15 changes: 12 additions & 3 deletions trunk/drivers/net/ethernet/cadence/macb.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,17 @@ static void macb_handle_link_change(struct net_device *dev)

reg = macb_readl(bp, NCFGR);
reg &= ~(MACB_BIT(SPD) | MACB_BIT(FD));
if (macb_is_gem(bp))
reg &= ~GEM_BIT(GBE);

if (phydev->duplex)
reg |= MACB_BIT(FD);
if (phydev->speed == SPEED_100)
reg |= MACB_BIT(SPD);
if (phydev->speed == SPEED_1000)
reg |= GEM_BIT(GBE);

macb_writel(bp, NCFGR, reg);
macb_or_gem_writel(bp, NCFGR, reg);

bp->speed = phydev->speed;
bp->duplex = phydev->duplex;
Expand Down Expand Up @@ -216,7 +220,10 @@ static int macb_mii_probe(struct net_device *dev)
}

/* mask with MAC supported features */
phydev->supported &= PHY_BASIC_FEATURES;
if (macb_is_gem(bp))
phydev->supported &= PHY_GBIT_FEATURES;
else
phydev->supported &= PHY_BASIC_FEATURES;

phydev->advertising = phydev->supported;

Expand Down Expand Up @@ -1388,7 +1395,9 @@ static int __init macb_probe(struct platform_device *pdev)
bp->phy_interface = err;
}

if (bp->phy_interface == PHY_INTERFACE_MODE_RMII)
if (bp->phy_interface == PHY_INTERFACE_MODE_RGMII)
macb_or_gem_writel(bp, USRIO, GEM_BIT(RGMII));
else if (bp->phy_interface == PHY_INTERFACE_MODE_RMII)
#if defined(CONFIG_ARCH_AT91)
macb_or_gem_writel(bp, USRIO, (MACB_BIT(RMII) |
MACB_BIT(CLKEN)));
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/net/ethernet/cadence/macb.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@
#define MACB_IRXFCS_SIZE 1

/* GEM specific NCFGR bitfields. */
#define GEM_GBE_OFFSET 10
#define GEM_GBE_SIZE 1
#define GEM_CLK_OFFSET 18
#define GEM_CLK_SIZE 3
#define GEM_DBW_OFFSET 21
Expand Down Expand Up @@ -252,6 +254,8 @@
/* Bitfields in USRIO (AT91) */
#define MACB_RMII_OFFSET 0
#define MACB_RMII_SIZE 1
#define GEM_RGMII_OFFSET 0 /* GEM gigabit mode */
#define GEM_RGMII_SIZE 1
#define MACB_CLKEN_OFFSET 1
#define MACB_CLKEN_SIZE 1

Expand Down

0 comments on commit 20704c4

Please sign in to comment.