LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Bryan Wu <bryan.wu@analog.com>
To: jeff@garzik.org, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Bryan Wu <bryan.wu@analog.com>
Subject: [PATCH 2/8] [Blackfin] EMAC driver: define MDC_CLK=2.5MHz and caculate mdc_div according to SCLK.
Date: Wed, 30 Jan 2008 16:52:22 +0800 [thread overview]
Message-ID: <1201683148-23931-3-git-send-email-bryan.wu@analog.com> (raw)
In-Reply-To: <1201683148-23931-1-git-send-email-bryan.wu@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
---
drivers/net/bfin_mac.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 4006a5d..ee39819 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -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 */
@@ -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;
}
--
1.5.3.4
next prev parent reply other threads:[~2008-01-30 8:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-30 8:52 [PATCH 0/8] [Blackfin] EMAC driver updates Bryan Wu
2008-01-30 8:52 ` [PATCH 1/8] [Blackfin] EMAC driver: shorten the mdelay value to solve netperf performance issue Bryan Wu
2008-01-30 9:00 ` Jeff Garzik
2008-01-30 8:52 ` Bryan Wu [this message]
2008-01-30 8:52 ` [PATCH 3/8] [Blackfin] EMAC driver: bf537 MAC multicast hash filtering patch Bryan Wu
2008-01-30 8:52 ` [PATCH 4/8] [Blackfin] EMAC driver: use simpler comment headers and strip out information that is maintained in the scm's log Bryan Wu
2008-01-30 8:52 ` [PATCH 5/8] [Blackfin] EMAC driver: ADSP-BF52x arch/mach support Bryan Wu
2008-01-30 8:52 ` [PATCH 6/8] [Blackfin] EMAC driver: add power down mode Bryan Wu
2008-01-30 8:52 ` [PATCH 7/8] [Blackfin] EMAC driver: fix bug - invalidate data cache of new_skb->data range when cache is WB Bryan Wu
2008-01-30 8:52 ` [PATCH 8/8] [Blackfin] EMAC driver: Fix bug: The clock divisor is set to all ones at reset Bryan Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1201683148-23931-3-git-send-email-bryan.wu@analog.com \
--to=bryan.wu@analog.com \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--subject='Re: [PATCH 2/8] [Blackfin] EMAC driver: define MDC_CLK=2.5MHz and caculate mdc_div according to SCLK.' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).