[octeon] move generic config and patches directory to be 2.6.30 specific
[openwrt-10.03/.git] / target / linux / octeon / patches-2.6.30 / 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 --- a/arch/mips/include/asm/octeon/octeon-feature.h
10 +++ b/arch/mips/include/asm/octeon/octeon-feature.h
11 @@ -57,6 +57,13 @@ enum octeon_feature {
12         OCTEON_FEATURE_RAID,
13         /* Octeon has a builtin USB */
14         OCTEON_FEATURE_USB,
15 +       /* Octeon IPD can run without using work queue entries */
16 +       OCTEON_FEATURE_NO_WPTR,
17 +       /* Octeon has DFA state machines */
18 +       OCTEON_FEATURE_DFA,
19 +       /* Octeon MDIO block supports clause 45 transactions for 10
20 +        * Gig support */
21 +       OCTEON_FEATURE_MDIO_CLAUSE_45,
22  };
23  
24  static inline int cvmx_fuse_read(int fuse);
25 @@ -112,6 +119,26 @@ static inline int octeon_has_feature(enu
26         case OCTEON_FEATURE_USB:
27                 return !(OCTEON_IS_MODEL(OCTEON_CN38XX)
28                          || OCTEON_IS_MODEL(OCTEON_CN58XX));
29 +       case OCTEON_FEATURE_NO_WPTR:
30 +               return (OCTEON_IS_MODEL(OCTEON_CN56XX)
31 +                        || OCTEON_IS_MODEL(OCTEON_CN52XX))
32 +                       && !OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X)
33 +                       && !OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X);
34 +       case OCTEON_FEATURE_DFA:
35 +               if (!OCTEON_IS_MODEL(OCTEON_CN38XX)
36 +                   && !OCTEON_IS_MODEL(OCTEON_CN31XX)
37 +                   && !OCTEON_IS_MODEL(OCTEON_CN58XX))
38 +                       return 0;
39 +               else if (OCTEON_IS_MODEL(OCTEON_CN3020))
40 +                       return 0;
41 +               else if (OCTEON_IS_MODEL(OCTEON_CN38XX_PASS1))
42 +                       return 1;
43 +               else
44 +                       return !cvmx_fuse_read(120);
45 +       case OCTEON_FEATURE_MDIO_CLAUSE_45:
46 +               return !(OCTEON_IS_MODEL(OCTEON_CN3XXX)
47 +                        || OCTEON_IS_MODEL(OCTEON_CN58XX)
48 +                        || OCTEON_IS_MODEL(OCTEON_CN50XX));
49         }
50         return 0;
51  }