aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/fec_8xx/Kconfig8
-rw-r--r--drivers/net/fec_8xx/fec_mii.c42
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c21
-rw-r--r--drivers/net/ibm_emac/ibm_emac.h22
-rw-r--r--drivers/net/ibm_emac/ibm_emac_core.c20
-rw-r--r--drivers/net/ibm_emac/ibm_emac_mal.h5
-rw-r--r--drivers/net/ibm_emac/ibm_emac_phy.c12
8 files changed, 109 insertions, 23 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 6d4f9ceb0a32..97760c1e6b21 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1203,7 +1203,7 @@ config IBM_EMAC_RX_SKB_HEADROOM
1203 1203
1204config IBM_EMAC_PHY_RX_CLK_FIX 1204config IBM_EMAC_PHY_RX_CLK_FIX
1205 bool "PHY Rx clock workaround" 1205 bool "PHY Rx clock workaround"
1206 depends on IBM_EMAC && (405EP || 440GX || 440EP) 1206 depends on IBM_EMAC && (405EP || 440GX || 440EP || 440GR)
1207 help 1207 help
1208 Enable this if EMAC attached to a PHY which doesn't generate 1208 Enable this if EMAC attached to a PHY which doesn't generate
1209 RX clock if there is no link, if this is the case, you will 1209 RX clock if there is no link, if this is the case, you will
diff --git a/drivers/net/fec_8xx/Kconfig b/drivers/net/fec_8xx/Kconfig
index db36ac3ea453..4560026ed419 100644
--- a/drivers/net/fec_8xx/Kconfig
+++ b/drivers/net/fec_8xx/Kconfig
@@ -1,6 +1,6 @@
1config FEC_8XX 1config FEC_8XX
2 tristate "Motorola 8xx FEC driver" 2 tristate "Motorola 8xx FEC driver"
3 depends on NET_ETHERNET && 8xx && (NETTA || NETPHONE) 3 depends on NET_ETHERNET
4 select MII 4 select MII
5 5
6config FEC_8XX_GENERIC_PHY 6config FEC_8XX_GENERIC_PHY
@@ -12,3 +12,9 @@ config FEC_8XX_DM9161_PHY
12 bool "Support DM9161 PHY" 12 bool "Support DM9161 PHY"
13 depends on FEC_8XX 13 depends on FEC_8XX
14 default n 14 default n
15
16config FEC_8XX_LXT971_PHY
17 bool "Support LXT971/LXT972 PHY"
18 depends on FEC_8XX
19 default n
20
diff --git a/drivers/net/fec_8xx/fec_mii.c b/drivers/net/fec_8xx/fec_mii.c
index 803eb095cf8e..3b44ac1a7bfe 100644
--- a/drivers/net/fec_8xx/fec_mii.c
+++ b/drivers/net/fec_8xx/fec_mii.c
@@ -203,6 +203,39 @@ static void dm9161_shutdown(struct net_device *dev)
203 203
204#endif 204#endif
205 205
206#ifdef CONFIG_FEC_8XX_LXT971_PHY
207
208/* Support for LXT971/972 PHY */
209
210#define MII_LXT971_PCR 16 /* Port Control Register */
211#define MII_LXT971_SR2 17 /* Status Register 2 */
212#define MII_LXT971_IER 18 /* Interrupt Enable Register */
213#define MII_LXT971_ISR 19 /* Interrupt Status Register */
214#define MII_LXT971_LCR 20 /* LED Control Register */
215#define MII_LXT971_TCR 30 /* Transmit Control Register */
216
217static void lxt971_startup(struct net_device *dev)
218{
219 struct fec_enet_private *fep = netdev_priv(dev);
220
221 fec_mii_write(dev, fep->mii_if.phy_id, MII_LXT971_IER, 0x00F2);
222}
223
224static void lxt971_ack_int(struct net_device *dev)
225{
226 struct fec_enet_private *fep = netdev_priv(dev);
227
228 fec_mii_read(dev, fep->mii_if.phy_id, MII_LXT971_ISR);
229}
230
231static void lxt971_shutdown(struct net_device *dev)
232{
233 struct fec_enet_private *fep = netdev_priv(dev);
234
235 fec_mii_write(dev, fep->mii_if.phy_id, MII_LXT971_IER, 0x0000);
236}
237#endif
238
206/**********************************************************************************/ 239/**********************************************************************************/
207 240
208static const struct phy_info phy_info[] = { 241static const struct phy_info phy_info[] = {
@@ -215,6 +248,15 @@ static const struct phy_info phy_info[] = {
215 .shutdown = dm9161_shutdown, 248 .shutdown = dm9161_shutdown,
216 }, 249 },
217#endif 250#endif
251#ifdef CONFIG_FEC_8XX_LXT971_PHY
252 {
253 .id = 0x0001378e,
254 .name = "LXT971/972",
255 .startup = lxt971_startup,
256 .ack_int = lxt971_ack_int,
257 .shutdown = lxt971_shutdown,
258 },
259#endif
218#ifdef CONFIG_FEC_8XX_GENERIC_PHY 260#ifdef CONFIG_FEC_8XX_GENERIC_PHY
219 { 261 {
220 .id = 0, 262 .id = 0,
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 44fac7373289..9342d5bc7bb4 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -130,7 +130,7 @@ static int fs_enet_rx_napi(struct net_device *dev, int *budget)
130 130
131 skb = fep->rx_skbuff[curidx]; 131 skb = fep->rx_skbuff[curidx];
132 132
133 dma_unmap_single(fep->dev, skb->data, 133 dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp),
134 L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), 134 L1_CACHE_ALIGN(PKT_MAXBUF_SIZE),
135 DMA_FROM_DEVICE); 135 DMA_FROM_DEVICE);
136 136
@@ -144,7 +144,7 @@ static int fs_enet_rx_napi(struct net_device *dev, int *budget)
144 144
145 skb = fep->rx_skbuff[curidx]; 145 skb = fep->rx_skbuff[curidx];
146 146
147 dma_unmap_single(fep->dev, skb->data, 147 dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp),
148 L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), 148 L1_CACHE_ALIGN(PKT_MAXBUF_SIZE),
149 DMA_FROM_DEVICE); 149 DMA_FROM_DEVICE);
150 150
@@ -268,7 +268,7 @@ static int fs_enet_rx_non_napi(struct net_device *dev)
268 268
269 skb = fep->rx_skbuff[curidx]; 269 skb = fep->rx_skbuff[curidx];
270 270
271 dma_unmap_single(fep->dev, skb->data, 271 dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp),
272 L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), 272 L1_CACHE_ALIGN(PKT_MAXBUF_SIZE),
273 DMA_FROM_DEVICE); 273 DMA_FROM_DEVICE);
274 274
@@ -278,7 +278,7 @@ static int fs_enet_rx_non_napi(struct net_device *dev)
278 278
279 skb = fep->rx_skbuff[curidx]; 279 skb = fep->rx_skbuff[curidx];
280 280
281 dma_unmap_single(fep->dev, skb->data, 281 dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp),
282 L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), 282 L1_CACHE_ALIGN(PKT_MAXBUF_SIZE),
283 DMA_FROM_DEVICE); 283 DMA_FROM_DEVICE);
284 284
@@ -399,7 +399,8 @@ static void fs_enet_tx(struct net_device *dev)
399 fep->stats.collisions++; 399 fep->stats.collisions++;
400 400
401 /* unmap */ 401 /* unmap */
402 dma_unmap_single(fep->dev, skb->data, skb->len, DMA_TO_DEVICE); 402 dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp),
403 skb->len, DMA_TO_DEVICE);
403 404
404 /* 405 /*
405 * Free the sk buffer associated with this last transmit. 406 * Free the sk buffer associated with this last transmit.
@@ -547,17 +548,19 @@ void fs_cleanup_bds(struct net_device *dev)
547{ 548{
548 struct fs_enet_private *fep = netdev_priv(dev); 549 struct fs_enet_private *fep = netdev_priv(dev);
549 struct sk_buff *skb; 550 struct sk_buff *skb;
551 cbd_t *bdp;
550 int i; 552 int i;
551 553
552 /* 554 /*
553 * Reset SKB transmit buffers. 555 * Reset SKB transmit buffers.
554 */ 556 */
555 for (i = 0; i < fep->tx_ring; i++) { 557 for (i = 0, bdp = fep->tx_bd_base; i < fep->tx_ring; i++, bdp++) {
556 if ((skb = fep->tx_skbuff[i]) == NULL) 558 if ((skb = fep->tx_skbuff[i]) == NULL)
557 continue; 559 continue;
558 560
559 /* unmap */ 561 /* unmap */
560 dma_unmap_single(fep->dev, skb->data, skb->len, DMA_TO_DEVICE); 562 dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp),
563 skb->len, DMA_TO_DEVICE);
561 564
562 fep->tx_skbuff[i] = NULL; 565 fep->tx_skbuff[i] = NULL;
563 dev_kfree_skb(skb); 566 dev_kfree_skb(skb);
@@ -566,12 +569,12 @@ void fs_cleanup_bds(struct net_device *dev)
566 /* 569 /*
567 * Reset SKB receive buffers 570 * Reset SKB receive buffers
568 */ 571 */
569 for (i = 0; i < fep->rx_ring; i++) { 572 for (i = 0, bdp = fep->rx_bd_base; i < fep->rx_ring; i++, bdp++) {
570 if ((skb = fep->rx_skbuff[i]) == NULL) 573 if ((skb = fep->rx_skbuff[i]) == NULL)
571 continue; 574 continue;
572 575
573 /* unmap */ 576 /* unmap */
574 dma_unmap_single(fep->dev, skb->data, 577 dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp),
575 L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), 578 L1_CACHE_ALIGN(PKT_MAXBUF_SIZE),
576 DMA_FROM_DEVICE); 579 DMA_FROM_DEVICE);
577 580
diff --git a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h
index 28c476f28c20..644edbff4f94 100644
--- a/drivers/net/ibm_emac/ibm_emac.h
+++ b/drivers/net/ibm_emac/ibm_emac.h
@@ -26,7 +26,8 @@
26/* This is a simple check to prevent use of this driver on non-tested SoCs */ 26/* This is a simple check to prevent use of this driver on non-tested SoCs */
27#if !defined(CONFIG_405GP) && !defined(CONFIG_405GPR) && !defined(CONFIG_405EP) && \ 27#if !defined(CONFIG_405GP) && !defined(CONFIG_405GPR) && !defined(CONFIG_405EP) && \
28 !defined(CONFIG_440GP) && !defined(CONFIG_440GX) && !defined(CONFIG_440SP) && \ 28 !defined(CONFIG_440GP) && !defined(CONFIG_440GX) && !defined(CONFIG_440SP) && \
29 !defined(CONFIG_440EP) && !defined(CONFIG_NP405H) 29 !defined(CONFIG_440EP) && !defined(CONFIG_NP405H) && !defined(CONFIG_440SPE) && \
30 !defined(CONFIG_440GR)
30#error "Unknown SoC. Please, check chip user manual and make sure EMAC defines are OK" 31#error "Unknown SoC. Please, check chip user manual and make sure EMAC defines are OK"
31#endif 32#endif
32 33
@@ -246,6 +247,25 @@ struct emac_regs {
246#define EMAC_STACR_PCDA_SHIFT 5 247#define EMAC_STACR_PCDA_SHIFT 5
247#define EMAC_STACR_PRA_MASK 0x1f 248#define EMAC_STACR_PRA_MASK 0x1f
248 249
250/*
251 * For the 440SPe, AMCC inexplicably changed the polarity of
252 * the "operation complete" bit in the MII control register.
253 */
254#if defined(CONFIG_440SPE)
255static inline int emac_phy_done(u32 stacr)
256{
257 return !(stacr & EMAC_STACR_OC);
258};
259#define EMAC_STACR_START EMAC_STACR_OC
260
261#else /* CONFIG_440SPE */
262static inline int emac_phy_done(u32 stacr)
263{
264 return stacr & EMAC_STACR_OC;
265};
266#define EMAC_STACR_START 0
267#endif /* !CONFIG_440SPE */
268
249/* EMACx_TRTR */ 269/* EMACx_TRTR */
250#if !defined(CONFIG_IBM_EMAC4) 270#if !defined(CONFIG_IBM_EMAC4)
251#define EMAC_TRTR_SHIFT 27 271#define EMAC_TRTR_SHIFT 27
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c
index 943fbd1546ff..eb7d69478715 100644
--- a/drivers/net/ibm_emac/ibm_emac_core.c
+++ b/drivers/net/ibm_emac/ibm_emac_core.c
@@ -87,10 +87,11 @@ MODULE_LICENSE("GPL");
87 */ 87 */
88static u32 busy_phy_map; 88static u32 busy_phy_map;
89 89
90#if defined(CONFIG_IBM_EMAC_PHY_RX_CLK_FIX) && (defined(CONFIG_405EP) || defined(CONFIG_440EP)) 90#if defined(CONFIG_IBM_EMAC_PHY_RX_CLK_FIX) && \
91 (defined(CONFIG_405EP) || defined(CONFIG_440EP) || defined(CONFIG_440GR))
91/* 405EP has "EMAC to PHY Control Register" (CPC0_EPCTL) which can help us 92/* 405EP has "EMAC to PHY Control Register" (CPC0_EPCTL) which can help us
92 * with PHY RX clock problem. 93 * with PHY RX clock problem.
93 * 440EP has more sane SDR0_MFR register implementation than 440GX, which 94 * 440EP/440GR has more sane SDR0_MFR register implementation than 440GX, which
94 * also allows controlling each EMAC clock 95 * also allows controlling each EMAC clock
95 */ 96 */
96static inline void EMAC_RX_CLK_TX(int idx) 97static inline void EMAC_RX_CLK_TX(int idx)
@@ -100,7 +101,7 @@ static inline void EMAC_RX_CLK_TX(int idx)
100 101
101#if defined(CONFIG_405EP) 102#if defined(CONFIG_405EP)
102 mtdcr(0xf3, mfdcr(0xf3) | (1 << idx)); 103 mtdcr(0xf3, mfdcr(0xf3) | (1 << idx));
103#else /* CONFIG_440EP */ 104#else /* CONFIG_440EP || CONFIG_440GR */
104 SDR_WRITE(DCRN_SDR_MFR, SDR_READ(DCRN_SDR_MFR) | (0x08000000 >> idx)); 105 SDR_WRITE(DCRN_SDR_MFR, SDR_READ(DCRN_SDR_MFR) | (0x08000000 >> idx));
105#endif 106#endif
106 107
@@ -546,7 +547,7 @@ static int __emac_mdio_read(struct ocp_enet_private *dev, u8 id, u8 reg)
546 547
547 /* Wait for management interface to become idle */ 548 /* Wait for management interface to become idle */
548 n = 10; 549 n = 10;
549 while (!(in_be32(&p->stacr) & EMAC_STACR_OC)) { 550 while (!emac_phy_done(in_be32(&p->stacr))) {
550 udelay(1); 551 udelay(1);
551 if (!--n) 552 if (!--n)
552 goto to; 553 goto to;
@@ -556,11 +557,12 @@ static int __emac_mdio_read(struct ocp_enet_private *dev, u8 id, u8 reg)
556 out_be32(&p->stacr, 557 out_be32(&p->stacr,
557 EMAC_STACR_BASE(emac_opb_mhz()) | EMAC_STACR_STAC_READ | 558 EMAC_STACR_BASE(emac_opb_mhz()) | EMAC_STACR_STAC_READ |
558 (reg & EMAC_STACR_PRA_MASK) 559 (reg & EMAC_STACR_PRA_MASK)
559 | ((id & EMAC_STACR_PCDA_MASK) << EMAC_STACR_PCDA_SHIFT)); 560 | ((id & EMAC_STACR_PCDA_MASK) << EMAC_STACR_PCDA_SHIFT)
561 | EMAC_STACR_START);
560 562
561 /* Wait for read to complete */ 563 /* Wait for read to complete */
562 n = 100; 564 n = 100;
563 while (!((r = in_be32(&p->stacr)) & EMAC_STACR_OC)) { 565 while (!emac_phy_done(r = in_be32(&p->stacr))) {
564 udelay(1); 566 udelay(1);
565 if (!--n) 567 if (!--n)
566 goto to; 568 goto to;
@@ -594,7 +596,7 @@ static void __emac_mdio_write(struct ocp_enet_private *dev, u8 id, u8 reg,
594 596
595 /* Wait for management interface to be idle */ 597 /* Wait for management interface to be idle */
596 n = 10; 598 n = 10;
597 while (!(in_be32(&p->stacr) & EMAC_STACR_OC)) { 599 while (!emac_phy_done(in_be32(&p->stacr))) {
598 udelay(1); 600 udelay(1);
599 if (!--n) 601 if (!--n)
600 goto to; 602 goto to;
@@ -605,11 +607,11 @@ static void __emac_mdio_write(struct ocp_enet_private *dev, u8 id, u8 reg,
605 EMAC_STACR_BASE(emac_opb_mhz()) | EMAC_STACR_STAC_WRITE | 607 EMAC_STACR_BASE(emac_opb_mhz()) | EMAC_STACR_STAC_WRITE |
606 (reg & EMAC_STACR_PRA_MASK) | 608 (reg & EMAC_STACR_PRA_MASK) |
607 ((id & EMAC_STACR_PCDA_MASK) << EMAC_STACR_PCDA_SHIFT) | 609 ((id & EMAC_STACR_PCDA_MASK) << EMAC_STACR_PCDA_SHIFT) |
608 (val << EMAC_STACR_PHYD_SHIFT)); 610 (val << EMAC_STACR_PHYD_SHIFT) | EMAC_STACR_START);
609 611
610 /* Wait for write to complete */ 612 /* Wait for write to complete */
611 n = 100; 613 n = 100;
612 while (!(in_be32(&p->stacr) & EMAC_STACR_OC)) { 614 while (!emac_phy_done(in_be32(&p->stacr))) {
613 udelay(1); 615 udelay(1);
614 if (!--n) 616 if (!--n)
615 goto to; 617 goto to;
diff --git a/drivers/net/ibm_emac/ibm_emac_mal.h b/drivers/net/ibm_emac/ibm_emac_mal.h
index 15b0bdae26ac..2a2d3b24b037 100644
--- a/drivers/net/ibm_emac/ibm_emac_mal.h
+++ b/drivers/net/ibm_emac/ibm_emac_mal.h
@@ -32,9 +32,10 @@
32 * reflect the fact that 40x and 44x have slightly different MALs. --ebs 32 * reflect the fact that 40x and 44x have slightly different MALs. --ebs
33 */ 33 */
34#if defined(CONFIG_405GP) || defined(CONFIG_405GPR) || defined(CONFIG_405EP) || \ 34#if defined(CONFIG_405GP) || defined(CONFIG_405GPR) || defined(CONFIG_405EP) || \
35 defined(CONFIG_440EP) || defined(CONFIG_NP405H) 35 defined(CONFIG_440EP) || defined(CONFIG_440GR) || defined(CONFIG_NP405H)
36#define MAL_VERSION 1 36#define MAL_VERSION 1
37#elif defined(CONFIG_440GP) || defined(CONFIG_440GX) || defined(CONFIG_440SP) 37#elif defined(CONFIG_440GP) || defined(CONFIG_440GX) || defined(CONFIG_440SP) || \
38 defined(CONFIG_440SPE)
38#define MAL_VERSION 2 39#define MAL_VERSION 2
39#else 40#else
40#error "Unknown SoC, please check chip manual and choose MAL 'version'" 41#error "Unknown SoC, please check chip manual and choose MAL 'version'"
diff --git a/drivers/net/ibm_emac/ibm_emac_phy.c b/drivers/net/ibm_emac/ibm_emac_phy.c
index a27e49cfe43b..67935dd33a65 100644
--- a/drivers/net/ibm_emac/ibm_emac_phy.c
+++ b/drivers/net/ibm_emac/ibm_emac_phy.c
@@ -236,12 +236,16 @@ static struct mii_phy_def genmii_phy_def = {
236}; 236};
237 237
238/* CIS8201 */ 238/* CIS8201 */
239#define MII_CIS8201_10BTCSR 0x16
240#define TENBTCSR_ECHO_DISABLE 0x2000
239#define MII_CIS8201_EPCR 0x17 241#define MII_CIS8201_EPCR 0x17
240#define EPCR_MODE_MASK 0x3000 242#define EPCR_MODE_MASK 0x3000
241#define EPCR_GMII_MODE 0x0000 243#define EPCR_GMII_MODE 0x0000
242#define EPCR_RGMII_MODE 0x1000 244#define EPCR_RGMII_MODE 0x1000
243#define EPCR_TBI_MODE 0x2000 245#define EPCR_TBI_MODE 0x2000
244#define EPCR_RTBI_MODE 0x3000 246#define EPCR_RTBI_MODE 0x3000
247#define MII_CIS8201_ACSR 0x1c
248#define ACSR_PIN_PRIO_SELECT 0x0004
245 249
246static int cis8201_init(struct mii_phy *phy) 250static int cis8201_init(struct mii_phy *phy)
247{ 251{
@@ -269,6 +273,14 @@ static int cis8201_init(struct mii_phy *phy)
269 } 273 }
270 274
271 phy_write(phy, MII_CIS8201_EPCR, epcr); 275 phy_write(phy, MII_CIS8201_EPCR, epcr);
276
277 /* MII regs override strap pins */
278 phy_write(phy, MII_CIS8201_ACSR,
279 phy_read(phy, MII_CIS8201_ACSR) | ACSR_PIN_PRIO_SELECT);
280
281 /* Disable TX_EN -> CRS echo mode, otherwise 10/HDX doesn't work */
282 phy_write(phy, MII_CIS8201_10BTCSR,
283 phy_read(phy, MII_CIS8201_10BTCSR) | TENBTCSR_ECHO_DISABLE);
272 284
273 return 0; 285 return 0;
274} 286}