diff options
author | Albert ARIBAUD <albert.u.boot@aribaud.net> | 2013-11-05 20:50:39 +0100 |
---|---|---|
committer | Albert ARIBAUD <albert.u.boot@aribaud.net> | 2013-11-05 20:50:39 +0100 |
commit | c0e5dd88c438a41bf180dde0c2dc4c67dcd8058d (patch) | |
tree | da81a7a9b2616bfb0db1331089b390c7c92af247 /drivers/net/macb.c | |
parent | f6723794fd8f3362c4f3b5d0f36607a6a6f107b2 (diff) | |
parent | c12f941bece9ed79efccfe9e4a9fd977da6975f9 (diff) |
Merge branch 'u-boot-atmel/master' into 'u-boot-arm/master'
Diffstat (limited to 'drivers/net/macb.c')
-rw-r--r-- | drivers/net/macb.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index bf3983a00c6..781a272cff2 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); } |