aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ibm_newemac
diff options
context:
space:
mode:
authorVictor Gallardo <vgallardo@amcc.com>2008-09-18 08:41:26 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-08 18:27:14 -0400
commit6fbc779c03591ee536fef9efb7d7e20f281d0b5c (patch)
tree2721ba739886a19f600082c97aeba48a6358f680 /drivers/net/ibm_newemac
parentc6d6a511d768cf7627ab54fc18f40edf85097362 (diff)
ibm_newemac: Fix EMAC soft reset on 460EX/GT
This patch fixes EMAC soft reset on 460EX/GT when no external clock is available. Signed-off-by: Victor Gallardo <vgallardo@amcc.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ibm_newemac')
-rw-r--r--drivers/net/ibm_newemac/core.c18
-rw-r--r--drivers/net/ibm_newemac/core.h5
2 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index ccd9d9058f6d..58dfd32ccca8 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -130,6 +130,7 @@ static inline void emac_report_timeout_error(struct emac_instance *dev,
130 const char *error) 130 const char *error)
131{ 131{
132 if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX | 132 if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX |
133 EMAC_FTR_460EX_PHY_CLK_FIX |
133 EMAC_FTR_440EP_PHY_CLK_FIX)) 134 EMAC_FTR_440EP_PHY_CLK_FIX))
134 DBG(dev, "%s" NL, error); 135 DBG(dev, "%s" NL, error);
135 else if (net_ratelimit()) 136 else if (net_ratelimit())
@@ -351,10 +352,24 @@ static int emac_reset(struct emac_instance *dev)
351 emac_tx_disable(dev); 352 emac_tx_disable(dev);
352 } 353 }
353 354
355#ifdef CONFIG_PPC_DCR_NATIVE
356 /* Enable internal clock source */
357 if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX))
358 dcri_clrset(SDR0, SDR0_ETH_CFG,
359 0, SDR0_ETH_CFG_ECS << dev->cell_index);
360#endif
361
354 out_be32(&p->mr0, EMAC_MR0_SRST); 362 out_be32(&p->mr0, EMAC_MR0_SRST);
355 while ((in_be32(&p->mr0) & EMAC_MR0_SRST) && n) 363 while ((in_be32(&p->mr0) & EMAC_MR0_SRST) && n)
356 --n; 364 --n;
357 365
366#ifdef CONFIG_PPC_DCR_NATIVE
367 /* Enable external clock source */
368 if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX))
369 dcri_clrset(SDR0, SDR0_ETH_CFG,
370 SDR0_ETH_CFG_ECS << dev->cell_index, 0);
371#endif
372
358 if (n) { 373 if (n) {
359 dev->reset_failed = 0; 374 dev->reset_failed = 0;
360 return 0; 375 return 0;
@@ -2559,6 +2574,9 @@ static int __devinit emac_init_config(struct emac_instance *dev)
2559 /* Check EMAC version */ 2574 /* Check EMAC version */
2560 if (of_device_is_compatible(np, "ibm,emac4sync")) { 2575 if (of_device_is_compatible(np, "ibm,emac4sync")) {
2561 dev->features |= (EMAC_FTR_EMAC4 | EMAC_FTR_EMAC4SYNC); 2576 dev->features |= (EMAC_FTR_EMAC4 | EMAC_FTR_EMAC4SYNC);
2577 if (of_device_is_compatible(np, "ibm,emac-460ex") ||
2578 of_device_is_compatible(np, "ibm,emac-460gt"))
2579 dev->features |= EMAC_FTR_460EX_PHY_CLK_FIX;
2562 } else if (of_device_is_compatible(np, "ibm,emac4")) { 2580 } else if (of_device_is_compatible(np, "ibm,emac4")) {
2563 dev->features |= EMAC_FTR_EMAC4; 2581 dev->features |= EMAC_FTR_EMAC4;
2564 if (of_device_is_compatible(np, "ibm,emac-440gx")) 2582 if (of_device_is_compatible(np, "ibm,emac-440gx"))
diff --git a/drivers/net/ibm_newemac/core.h b/drivers/net/ibm_newemac/core.h
index 6545e69d12c3..5ca70e55b6c5 100644
--- a/drivers/net/ibm_newemac/core.h
+++ b/drivers/net/ibm_newemac/core.h
@@ -317,6 +317,10 @@ struct emac_instance {
317 * The 405EX and 460EX contain the EMAC4SYNC core 317 * The 405EX and 460EX contain the EMAC4SYNC core
318 */ 318 */
319#define EMAC_FTR_EMAC4SYNC 0x00000200 319#define EMAC_FTR_EMAC4SYNC 0x00000200
320/*
321 * Set if we need phy clock workaround for 460ex or 460gt
322 */
323#define EMAC_FTR_460EX_PHY_CLK_FIX 0x00000400
320 324
321 325
322/* Right now, we don't quite handle the always/possible masks on the 326/* Right now, we don't quite handle the always/possible masks on the
@@ -341,6 +345,7 @@ enum {
341#ifdef CONFIG_IBM_NEW_EMAC_RGMII 345#ifdef CONFIG_IBM_NEW_EMAC_RGMII
342 EMAC_FTR_HAS_RGMII | 346 EMAC_FTR_HAS_RGMII |
343#endif 347#endif
348 EMAC_FTR_460EX_PHY_CLK_FIX |
344 EMAC_FTR_440EP_PHY_CLK_FIX, 349 EMAC_FTR_440EP_PHY_CLK_FIX,
345}; 350};
346 351