Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 82688
b: refs/heads/master
c: 7cc8f38
h: refs/heads/master
v: v3
  • Loading branch information
Bryan Wu authored and David S. Miller committed Feb 3, 2008
1 parent 2fedd35 commit 6905af9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 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: 6db9e4617e9bdf9d31fbea165b10cb95318adf8c
refs/heads/master: 7cc8f38188133e0c278b9f207d63c2c2b4d98236
16 changes: 12 additions & 4 deletions trunk/drivers/net/bfin_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,20 +412,26 @@ static void bf537_adjust_link(struct net_device *dev)
spin_unlock_irqrestore(&lp->lock, flags);
}

/* MDC = 2.5 MHz */
#define MDC_CLK 2500000

static int mii_probe(struct net_device *dev)
{
struct bf537mac_local *lp = netdev_priv(dev);
struct phy_device *phydev = NULL;
unsigned short sysctl;
int i;
u32 sclk, mdc_div;

/* Enable PHY output early */
if (!(bfin_read_VR_CTL() & PHYCLKOE))
bfin_write_VR_CTL(bfin_read_VR_CTL() | PHYCLKOE);

/* MDC = 2.5 MHz */
sclk = get_sclk();
mdc_div = ((sclk / MDC_CLK) / 2) - 1;

sysctl = bfin_read_EMAC_SYSCTL();
sysctl |= SET_MDCDIV(24);
sysctl |= SET_MDCDIV(mdc_div);
bfin_write_EMAC_SYSCTL(sysctl);

/* search for connect PHY device */
Expand Down Expand Up @@ -477,8 +483,10 @@ static int mii_probe(struct net_device *dev)
lp->phydev = phydev;

printk(KERN_INFO "%s: attached PHY driver [%s] "
"(mii_bus:phy_addr=%s, irq=%d)\n",
DRV_NAME, phydev->drv->name, phydev->dev.bus_id, phydev->irq);
"(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)"
"@sclk=%dMHz)\n",
DRV_NAME, phydev->drv->name, phydev->dev.bus_id, phydev->irq,
MDC_CLK, mdc_div, sclk/1000000);

return 0;
}
Expand Down

0 comments on commit 6905af9

Please sign in to comment.