diff options
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/cadence/macb.c | 23 | ||||
-rw-r--r-- | drivers/net/ethernet/cadence/macb.h | 19 |
2 files changed, 42 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); |
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 1367b92edb3..71424aae9c5 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h | |||
@@ -69,6 +69,13 @@ | |||
69 | #define GEM_SA1B 0x0088 | 69 | #define GEM_SA1B 0x0088 |
70 | #define GEM_SA1T 0x008C | 70 | #define GEM_SA1T 0x008C |
71 | #define GEM_OTX 0x0100 | 71 | #define GEM_OTX 0x0100 |
72 | #define GEM_DCFG1 0x0280 | ||
73 | #define GEM_DCFG2 0x0284 | ||
74 | #define GEM_DCFG3 0x0288 | ||
75 | #define GEM_DCFG4 0x028c | ||
76 | #define GEM_DCFG5 0x0290 | ||
77 | #define GEM_DCFG6 0x0294 | ||
78 | #define GEM_DCFG7 0x0298 | ||
72 | 79 | ||
73 | /* Bitfields in NCR */ | 80 | /* Bitfields in NCR */ |
74 | #define MACB_LB_OFFSET 0 | 81 | #define MACB_LB_OFFSET 0 |
@@ -139,6 +146,14 @@ | |||
139 | /* GEM specific NCFGR bitfields. */ | 146 | /* GEM specific NCFGR bitfields. */ |
140 | #define GEM_CLK_OFFSET 18 | 147 | #define GEM_CLK_OFFSET 18 |
141 | #define GEM_CLK_SIZE 3 | 148 | #define GEM_CLK_SIZE 3 |
149 | #define GEM_DBW_OFFSET 21 | ||
150 | #define GEM_DBW_SIZE 2 | ||
151 | |||
152 | /* Constants for data bus width. */ | ||
153 | #define GEM_DBW32 0 | ||
154 | #define GEM_DBW64 1 | ||
155 | #define GEM_DBW128 2 | ||
156 | |||
142 | /* Bitfields in NSR */ | 157 | /* Bitfields in NSR */ |
143 | #define MACB_NSR_LINK_OFFSET 0 | 158 | #define MACB_NSR_LINK_OFFSET 0 |
144 | #define MACB_NSR_LINK_SIZE 1 | 159 | #define MACB_NSR_LINK_SIZE 1 |
@@ -247,6 +262,10 @@ | |||
247 | #define MACB_REV_OFFSET 0 | 262 | #define MACB_REV_OFFSET 0 |
248 | #define MACB_REV_SIZE 16 | 263 | #define MACB_REV_SIZE 16 |
249 | 264 | ||
265 | /* Bitfields in DCFG1. */ | ||
266 | #define GEM_DBWDEF_OFFSET 25 | ||
267 | #define GEM_DBWDEF_SIZE 3 | ||
268 | |||
250 | /* Constants for CLK */ | 269 | /* Constants for CLK */ |
251 | #define MACB_CLK_DIV8 0 | 270 | #define MACB_CLK_DIV8 0 |
252 | #define MACB_CLK_DIV16 1 | 271 | #define MACB_CLK_DIV16 1 |