Skip to content

Commit 6fbc779

Browse files
Victor Gallardodavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c6d6a51 commit 6fbc779

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

arch/powerpc/include/asm/dcr-regs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@
6868
#define SDR0_UART3 0x0123
6969
#define SDR0_CUST0 0x4000
7070

71+
/* SDRs (460EX/460GT) */
72+
#define SDR0_ETH_CFG 0x4103
73+
#define SDR0_ETH_CFG_ECS 0x00000100 /* EMAC int clk source */
74+
7175
/*
7276
* All those DCR register addresses are offsets from the base address
7377
* for the SRAM0 controller (e.g. 0x20 on 440GX). The base address is

drivers/net/ibm_newemac/core.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ static inline void emac_report_timeout_error(struct emac_instance *dev,
130130
const char *error)
131131
{
132132
if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX |
133+
EMAC_FTR_460EX_PHY_CLK_FIX |
133134
EMAC_FTR_440EP_PHY_CLK_FIX))
134135
DBG(dev, "%s" NL, error);
135136
else if (net_ratelimit())
@@ -351,10 +352,24 @@ static int emac_reset(struct emac_instance *dev)
351352
emac_tx_disable(dev);
352353
}
353354

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+
354362
out_be32(&p->mr0, EMAC_MR0_SRST);
355363
while ((in_be32(&p->mr0) & EMAC_MR0_SRST) && n)
356364
--n;
357365

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+
358373
if (n) {
359374
dev->reset_failed = 0;
360375
return 0;
@@ -2559,6 +2574,9 @@ static int __devinit emac_init_config(struct emac_instance *dev)
25592574
/* Check EMAC version */
25602575
if (of_device_is_compatible(np, "ibm,emac4sync")) {
25612576
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;
25622580
} else if (of_device_is_compatible(np, "ibm,emac4")) {
25632581
dev->features |= EMAC_FTR_EMAC4;
25642582
if (of_device_is_compatible(np, "ibm,emac-440gx"))

drivers/net/ibm_newemac/core.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ struct emac_instance {
317317
* The 405EX and 460EX contain the EMAC4SYNC core
318318
*/
319319
#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
320324

321325

322326
/* Right now, we don't quite handle the always/possible masks on the
@@ -341,6 +345,7 @@ enum {
341345
#ifdef CONFIG_IBM_NEW_EMAC_RGMII
342346
EMAC_FTR_HAS_RGMII |
343347
#endif
348+
EMAC_FTR_460EX_PHY_CLK_FIX |
344349
EMAC_FTR_440EP_PHY_CLK_FIX,
345350
};
346351

0 commit comments

Comments
 (0)