aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-12-04 19:14:29 -0500
committerJeff Garzik <jeff@garzik.org>2007-12-07 15:09:06 -0500
commitbff713b562d495658093f1716a80c6ad76920e8b (patch)
tree584374279b328d171b158f51faeb94766fce2421
parent1f57877a39105ec4d99d63d02058f6db6ca6abe0 (diff)
ibm_newemac: Cleanup/fix support for STACR register variants
There are a few variants of the STACR register that affect more than just the "AXON" version of EMAC. Replace the current test of various chip models with tests for generic properties in the device-tree. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Stefan Roese <sr@denx.de> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--arch/powerpc/boot/dts/sequoia.dts4
-rw-r--r--drivers/net/ibm_newemac/core.c23
-rw-r--r--drivers/net/ibm_newemac/core.h6
3 files changed, 20 insertions, 13 deletions
diff --git a/arch/powerpc/boot/dts/sequoia.dts b/arch/powerpc/boot/dts/sequoia.dts
index 3d0dfaecc7b6..10784ff45dd6 100644
--- a/arch/powerpc/boot/dts/sequoia.dts
+++ b/arch/powerpc/boot/dts/sequoia.dts
@@ -274,6 +274,8 @@
274 zmii-channel = <0>; 274 zmii-channel = <0>;
275 rgmii-device = <&RGMII0>; 275 rgmii-device = <&RGMII0>;
276 rgmii-channel = <0>; 276 rgmii-channel = <0>;
277 has-inverted-stacr-oc;
278 has-new-stacr-staopc;
277 }; 279 };
278 280
279 EMAC1: ethernet@ef600f00 { 281 EMAC1: ethernet@ef600f00 {
@@ -302,6 +304,8 @@
302 zmii-channel = <1>; 304 zmii-channel = <1>;
303 rgmii-device = <&RGMII0>; 305 rgmii-device = <&RGMII0>;
304 rgmii-channel = <1>; 306 rgmii-channel = <1>;
307 has-inverted-stacr-oc;
308 has-new-stacr-staopc;
305 }; 309 };
306 }; 310 };
307 }; 311 };
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index e0eae09febfa..ac9fd46509c1 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -711,7 +711,7 @@ static int __emac_mdio_read(struct emac_instance *dev, u8 id, u8 reg)
711 r = EMAC_STACR_BASE(dev->opb_bus_freq); 711 r = EMAC_STACR_BASE(dev->opb_bus_freq);
712 if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT)) 712 if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT))
713 r |= EMAC_STACR_OC; 713 r |= EMAC_STACR_OC;
714 if (emac_has_feature(dev, EMAC_FTR_HAS_AXON_STACR)) 714 if (emac_has_feature(dev, EMAC_FTR_HAS_NEW_STACR))
715 r |= EMACX_STACR_STAC_READ; 715 r |= EMACX_STACR_STAC_READ;
716 else 716 else
717 r |= EMAC_STACR_STAC_READ; 717 r |= EMAC_STACR_STAC_READ;
@@ -783,7 +783,7 @@ static void __emac_mdio_write(struct emac_instance *dev, u8 id, u8 reg,
783 r = EMAC_STACR_BASE(dev->opb_bus_freq); 783 r = EMAC_STACR_BASE(dev->opb_bus_freq);
784 if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT)) 784 if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT))
785 r |= EMAC_STACR_OC; 785 r |= EMAC_STACR_OC;
786 if (emac_has_feature(dev, EMAC_FTR_HAS_AXON_STACR)) 786 if (emac_has_feature(dev, EMAC_FTR_HAS_NEW_STACR))
787 r |= EMACX_STACR_STAC_WRITE; 787 r |= EMACX_STACR_STAC_WRITE;
788 else 788 else
789 r |= EMAC_STACR_STAC_WRITE; 789 r |= EMAC_STACR_STAC_WRITE;
@@ -2480,16 +2480,19 @@ static int __devinit emac_init_config(struct emac_instance *dev)
2480 /* Check EMAC version */ 2480 /* Check EMAC version */
2481 if (of_device_is_compatible(np, "ibm,emac4")) 2481 if (of_device_is_compatible(np, "ibm,emac4"))
2482 dev->features |= EMAC_FTR_EMAC4; 2482 dev->features |= EMAC_FTR_EMAC4;
2483 if (of_device_is_compatible(np, "ibm,emac-axon") 2483
2484 || of_device_is_compatible(np, "ibm,emac-440epx")) 2484 /* Fixup some feature bits based on the device tree */
2485 dev->features |= EMAC_FTR_HAS_AXON_STACR 2485 if (of_get_property(np, "has-inverted-stacr-oc", NULL))
2486 | EMAC_FTR_STACR_OC_INVERT;
2487 if (of_device_is_compatible(np, "ibm,emac-440spe"))
2488 dev->features |= EMAC_FTR_STACR_OC_INVERT; 2486 dev->features |= EMAC_FTR_STACR_OC_INVERT;
2487 if (of_get_property(np, "has-new-stacr-staopc", NULL))
2488 dev->features |= EMAC_FTR_HAS_NEW_STACR;
2489 2489
2490 /* Fixup some feature bits based on the device tree and verify 2490 /* CAB lacks the appropriate properties */
2491 * we have support for them compiled in 2491 if (of_device_is_compatible(np, "ibm,emac-axon"))
2492 */ 2492 dev->features |= EMAC_FTR_HAS_NEW_STACR |
2493 EMAC_FTR_STACR_OC_INVERT;
2494
2495 /* Enable TAH/ZMII/RGMII features as found */
2493 if (dev->tah_ph != 0) { 2496 if (dev->tah_ph != 0) {
2494#ifdef CONFIG_IBM_NEW_EMAC_TAH 2497#ifdef CONFIG_IBM_NEW_EMAC_TAH
2495 dev->features |= EMAC_FTR_HAS_TAH; 2498 dev->features |= EMAC_FTR_HAS_TAH;
diff --git a/drivers/net/ibm_newemac/core.h b/drivers/net/ibm_newemac/core.h
index a010b2463fd9..04105f939cfd 100644
--- a/drivers/net/ibm_newemac/core.h
+++ b/drivers/net/ibm_newemac/core.h
@@ -293,9 +293,9 @@ struct emac_instance {
293 */ 293 */
294#define EMAC_FTR_HAS_RGMII 0x00000020 294#define EMAC_FTR_HAS_RGMII 0x00000020
295/* 295/*
296 * Set if we have axon-type STACR 296 * Set if we have new type STACR with STAOPC
297 */ 297 */
298#define EMAC_FTR_HAS_AXON_STACR 0x00000040 298#define EMAC_FTR_HAS_NEW_STACR 0x00000040
299 299
300 300
301/* Right now, we don't quite handle the always/possible masks on the 301/* Right now, we don't quite handle the always/possible masks on the
@@ -307,7 +307,7 @@ enum {
307 307
308 EMAC_FTRS_POSSIBLE = 308 EMAC_FTRS_POSSIBLE =
309#ifdef CONFIG_IBM_NEW_EMAC_EMAC4 309#ifdef CONFIG_IBM_NEW_EMAC_EMAC4
310 EMAC_FTR_EMAC4 | EMAC_FTR_HAS_AXON_STACR | 310 EMAC_FTR_EMAC4 | EMAC_FTR_HAS_NEW_STACR |
311 EMAC_FTR_STACR_OC_INVERT | 311 EMAC_FTR_STACR_OC_INVERT |
312#endif 312#endif
313#ifdef CONFIG_IBM_NEW_EMAC_TAH 313#ifdef CONFIG_IBM_NEW_EMAC_TAH