diff options
author | Claudiu Manoil <claudiu.manoil@freescale.com> | 2013-10-09 13:20:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-09 14:02:02 -0400 |
commit | 2969b1f7259179b6810b02aa6770c8765d9674ad (patch) | |
tree | 6df80f34ad3ec94b7cab26f4f39dd2aea97d428e /drivers/net | |
parent | ad3660c242adf34a3f598dd8ba8c8d59811788f3 (diff) |
gianfar: Use mpc85xx support for errata detection
Use the macros and defines from mpc85xx.h to simplify
and prevent errors in identifying a mpc85xx based SoC
for errata detection.
This should help enabling (and identifying) workarounds
for various mpc85xx based chips and revisions.
For instance, express MPC8548 Rev.2 as:
(SVR_SOC_VER(svr) == SVR_8548) && (SVR_REV(svr) == 0x20)
instead of:
(pvr == 0x80210020 && mod == 0x8030 && rev == 0x0020)
Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/freescale/gianfar.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index db5fc7b16082..329a20626721 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
@@ -88,6 +88,7 @@ | |||
88 | 88 | ||
89 | #include <asm/io.h> | 89 | #include <asm/io.h> |
90 | #include <asm/reg.h> | 90 | #include <asm/reg.h> |
91 | #include <asm/mpc85xx.h> | ||
91 | #include <asm/irq.h> | 92 | #include <asm/irq.h> |
92 | #include <asm/uaccess.h> | 93 | #include <asm/uaccess.h> |
93 | #include <linux/module.h> | 94 | #include <linux/module.h> |
@@ -939,17 +940,13 @@ static void gfar_init_filer_table(struct gfar_private *priv) | |||
939 | } | 940 | } |
940 | } | 941 | } |
941 | 942 | ||
942 | static void gfar_detect_errata(struct gfar_private *priv) | 943 | static void __gfar_detect_errata_83xx(struct gfar_private *priv) |
943 | { | 944 | { |
944 | struct device *dev = &priv->ofdev->dev; | ||
945 | unsigned int pvr = mfspr(SPRN_PVR); | 945 | unsigned int pvr = mfspr(SPRN_PVR); |
946 | unsigned int svr = mfspr(SPRN_SVR); | 946 | unsigned int svr = mfspr(SPRN_SVR); |
947 | unsigned int mod = (svr >> 16) & 0xfff6; /* w/o E suffix */ | 947 | unsigned int mod = (svr >> 16) & 0xfff6; /* w/o E suffix */ |
948 | unsigned int rev = svr & 0xffff; | 948 | unsigned int rev = svr & 0xffff; |
949 | 949 | ||
950 | /* no plans to fix */ | ||
951 | priv->errata |= GFAR_ERRATA_A002; | ||
952 | |||
953 | /* MPC8313 Rev 2.0 and higher; All MPC837x */ | 950 | /* MPC8313 Rev 2.0 and higher; All MPC837x */ |
954 | if ((pvr == 0x80850010 && mod == 0x80b0 && rev >= 0x0020) || | 951 | if ((pvr == 0x80850010 && mod == 0x80b0 && rev >= 0x0020) || |
955 | (pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0)) | 952 | (pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0)) |
@@ -960,10 +957,30 @@ static void gfar_detect_errata(struct gfar_private *priv) | |||
960 | (pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0)) | 957 | (pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0)) |
961 | priv->errata |= GFAR_ERRATA_76; | 958 | priv->errata |= GFAR_ERRATA_76; |
962 | 959 | ||
963 | /* MPC8313 Rev < 2.0, MPC8548 rev 2.0 */ | 960 | /* MPC8313 Rev < 2.0 */ |
964 | if ((pvr == 0x80850010 && mod == 0x80b0 && rev < 0x0020) || | 961 | if (pvr == 0x80850010 && mod == 0x80b0 && rev < 0x0020) |
965 | (pvr == 0x80210020 && mod == 0x8030 && rev == 0x0020)) | 962 | priv->errata |= GFAR_ERRATA_12; |
963 | } | ||
964 | |||
965 | static void __gfar_detect_errata_85xx(struct gfar_private *priv) | ||
966 | { | ||
967 | unsigned int svr = mfspr(SPRN_SVR); | ||
968 | |||
969 | if ((SVR_SOC_VER(svr) == SVR_8548) && (SVR_REV(svr) == 0x20)) | ||
966 | priv->errata |= GFAR_ERRATA_12; | 970 | priv->errata |= GFAR_ERRATA_12; |
971 | } | ||
972 | |||
973 | static void gfar_detect_errata(struct gfar_private *priv) | ||
974 | { | ||
975 | struct device *dev = &priv->ofdev->dev; | ||
976 | |||
977 | /* no plans to fix */ | ||
978 | priv->errata |= GFAR_ERRATA_A002; | ||
979 | |||
980 | if (pvr_version_is(PVR_VER_E500V1) || pvr_version_is(PVR_VER_E500V2)) | ||
981 | __gfar_detect_errata_85xx(priv); | ||
982 | else /* non-mpc85xx parts, i.e. e300 core based */ | ||
983 | __gfar_detect_errata_83xx(priv); | ||
967 | 984 | ||
968 | if (priv->errata) | 985 | if (priv->errata) |
969 | dev_info(dev, "enabled errata workarounds, flags: 0x%x\n", | 986 | dev_info(dev, "enabled errata workarounds, flags: 0x%x\n", |