diff options
Diffstat (limited to 'drivers/net/ethernet/cadence/macb.c')
-rw-r--r-- | drivers/net/ethernet/cadence/macb.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 6a7d3eae8cc..38f1932013d 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -835,6 +835,27 @@ static u32 macb_mdc_clk_div(struct macb *bp) | |||
835 | return config; | 835 | return config; |
836 | } | 836 | } |
837 | 837 | ||
838 | /* | ||
839 | * Get the DMA bus width field of the network configuration register that we | ||
840 | * should program. We find the width from decoding the design configuration | ||
841 | * register to find the maximum supported data bus width. | ||
842 | */ | ||
843 | static u32 macb_dbw(struct macb *bp) | ||
844 | { | ||
845 | if (!macb_is_gem(bp)) | ||
846 | return 0; | ||
847 | |||
848 | switch (GEM_BFEXT(DBWDEF, gem_readl(bp, DCFG1))) { | ||
849 | case 4: | ||
850 | return GEM_BF(DBW, GEM_DBW128); | ||
851 | case 2: | ||
852 | return GEM_BF(DBW, GEM_DBW64); | ||
853 | case 1: | ||
854 | default: | ||
855 | return GEM_BF(DBW, GEM_DBW32); | ||
856 | } | ||
857 | } | ||
858 | |||
838 | static void macb_init_hw(struct macb *bp) | 859 | static void macb_init_hw(struct macb *bp) |
839 | { | 860 | { |
840 | u32 config; | 861 | u32 config; |
@@ -850,6 +871,7 @@ static void macb_init_hw(struct macb *bp) | |||
850 | config |= MACB_BIT(CAF); /* Copy All Frames */ | 871 | config |= MACB_BIT(CAF); /* Copy All Frames */ |
851 | if (!(bp->dev->flags & IFF_BROADCAST)) | 872 | if (!(bp->dev->flags & IFF_BROADCAST)) |
852 | config |= MACB_BIT(NBC); /* No BroadCast */ | 873 | config |= MACB_BIT(NBC); /* No BroadCast */ |
874 | config |= macb_dbw(bp); | ||
853 | macb_writel(bp, NCFGR, config); | 875 | macb_writel(bp, NCFGR, config); |
854 | 876 | ||
855 | /* Initialize TX and RX buffers */ | 877 | /* Initialize TX and RX buffers */ |
@@ -1276,6 +1298,7 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1276 | 1298 | ||
1277 | /* Set MII management clock divider */ | 1299 | /* Set MII management clock divider */ |
1278 | config = macb_mdc_clk_div(bp); | 1300 | config = macb_mdc_clk_div(bp); |
1301 | config |= macb_dbw(bp); | ||
1279 | macb_writel(bp, NCFGR, config); | 1302 | macb_writel(bp, NCFGR, config); |
1280 | 1303 | ||
1281 | macb_get_hwaddr(bp); | 1304 | macb_get_hwaddr(bp); |