f4a06f202b406f58cfb401b91f820532bbb4a4bd
[15.05/openwrt.git] / target / linux / cavium-octeon / patches / 009-more_chip_specific_feature_tests.patch
1 The octeon-ethernet driver needs to check for additional chip specific
2 features, we add them to the octeon_has_feature() framework.
3
4 Signed-off-by: David Daney <ddaney@caviumnetworks.com>
5 ---
6  arch/mips/include/asm/octeon/octeon-feature.h |   27 +++++++++++++++++++++++++
7  1 files changed, 27 insertions(+), 0 deletions(-)
8
9 diff --git a/arch/mips/include/asm/octeon/octeon-feature.h b/arch/mips/include/asm/octeon/octeon-feature.h
10 index 04fac68..ef24a7b 100644
11 --- a/arch/mips/include/asm/octeon/octeon-feature.h
12 +++ b/arch/mips/include/asm/octeon/octeon-feature.h
13 @@ -57,6 +57,13 @@ enum octeon_feature {
14         OCTEON_FEATURE_RAID,
15         /* Octeon has a builtin USB */
16         OCTEON_FEATURE_USB,
17 +       /* Octeon IPD can run without using work queue entries */
18 +       OCTEON_FEATURE_NO_WPTR,
19 +       /* Octeon has DFA state machines */
20 +       OCTEON_FEATURE_DFA,
21 +       /* Octeon MDIO block supports clause 45 transactions for 10
22 +        * Gig support */
23 +       OCTEON_FEATURE_MDIO_CLAUSE_45,
24  };
25  
26  static inline int cvmx_fuse_read(int fuse);
27 @@ -112,6 +119,26 @@ static inline int octeon_has_feature(enum octeon_feature feature)
28         case OCTEON_FEATURE_USB:
29                 return !(OCTEON_IS_MODEL(OCTEON_CN38XX)
30                          || OCTEON_IS_MODEL(OCTEON_CN58XX));
31 +       case OCTEON_FEATURE_NO_WPTR:
32 +               return (OCTEON_IS_MODEL(OCTEON_CN56XX)
33 +                        || OCTEON_IS_MODEL(OCTEON_CN52XX))
34 +                       && !OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X)
35 +                       && !OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X);
36 +       case OCTEON_FEATURE_DFA:
37 +               if (!OCTEON_IS_MODEL(OCTEON_CN38XX)
38 +                   && !OCTEON_IS_MODEL(OCTEON_CN31XX)
39 +                   && !OCTEON_IS_MODEL(OCTEON_CN58XX))
40 +                       return 0;
41 +               else if (OCTEON_IS_MODEL(OCTEON_CN3020))
42 +                       return 0;
43 +               else if (OCTEON_IS_MODEL(OCTEON_CN38XX_PASS1))
44 +                       return 1;
45 +               else
46 +                       return !cvmx_fuse_read(120);
47 +       case OCTEON_FEATURE_MDIO_CLAUSE_45:
48 +               return !(OCTEON_IS_MODEL(OCTEON_CN3XXX)
49 +                        || OCTEON_IS_MODEL(OCTEON_CN58XX)
50 +                        || OCTEON_IS_MODEL(OCTEON_CN50XX));
51         }
52         return 0;
53  }
54 -- 
55 1.6.0.6
56