summaryrefslogtreecommitdiffstats
path: root/drivers/net/macb.c
diff options
context:
space:
mode:
authorBo Shen <voice.shen@atmel.com>2013-09-18 15:07:44 +0800
committerAndreas Bießmann <andreas.devel@googlemail.com>2013-11-04 20:32:31 +0100
commit32e4f6bf2e35e99e1742c005e1ede4e0cf5f066c (patch)
tree162f3cf8b80d96149c4a1a8fe337139bd80be12d /drivers/net/macb.c
parent304db0b38cfb04cfdb05a740d5ef27da06ea98ea (diff)
downloadtalos-obmc-uboot-32e4f6bf2e35e99e1742c005e1ede4e0cf5f066c.tar.gz
talos-obmc-uboot-32e4f6bf2e35e99e1742c005e1ede4e0cf5f066c.zip
net: macb: get DMA bus width from design config register
Get DMA bus width from design config register Signed-off-by: Bo Shen <voice.shen@atmel.com> Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Diffstat (limited to 'drivers/net/macb.c')
-rw-r--r--drivers/net/macb.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index bf3983a00c..781a272cff 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -621,6 +621,24 @@ static u32 gem_mdc_clk_div(int id, struct macb_device *macb)
return config;
}
+/*
+ * Get the DMA bus width field of the network configuration register that we
+ * should program. We find the width from decoding the design configuration
+ * register to find the maximum supported data bus width.
+ */
+static u32 macb_dbw(struct macb_device *macb)
+{
+ switch (GEM_BFEXT(DBWDEF, gem_readl(macb, DCFG1))) {
+ case 4:
+ return GEM_BF(DBW, GEM_DBW128);
+ case 2:
+ return GEM_BF(DBW, GEM_DBW64);
+ case 1:
+ default:
+ return GEM_BF(DBW, GEM_DBW32);
+ }
+}
+
int macb_eth_initialize(int id, void *regs, unsigned int phy_addr)
{
struct macb_device *macb;
@@ -665,7 +683,7 @@ int macb_eth_initialize(int id, void *regs, unsigned int phy_addr)
*/
if (macb_is_gem(macb)) {
ncfgr = gem_mdc_clk_div(id, macb);
- ncfgr |= GEM_BF(DBW, 1);
+ ncfgr |= macb_dbw(macb);
} else {
ncfgr = macb_mdc_clk_div(id, macb);
}
OpenPOWER on IntegriCloud