MIPS: Octeon: Delete potentially dangerous feature checks
authorAaro Koskinen <aaro.koskinen@nsn.com>
Mon, 8 Sep 2014 15:25:41 +0000 (18:25 +0300)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 24 Nov 2014 06:45:32 +0000 (07:45 +0100)
We should not need to read fuses during normal operation, also the current
code has issues with that (not safe for concurrent access). Since there
are no in-kernel users for these, just delete them. Drivers should
not need such OCTEON_HAS_FEATURE mechanism in any case, instead the
information should be passed via device tree.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nsn.com>
Cc: David Daney <david.daney@cavium.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7665/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/octeon/cvmx.h
arch/mips/include/asm/octeon/octeon-feature.h

index 6852dfa50010df7ac59c022076b540e2af5b05e8..b0b544f96b70ed64626b402704fcbe9ef404127f 100644 (file)
@@ -453,47 +453,4 @@ static inline uint32_t cvmx_octeon_num_cores(void)
 
 uint8_t cvmx_fuse_read_byte(int byte_addr);
 
-/**
- * Read a single fuse bit
- *
- * @fuse:   Fuse number (0-1024)
- *
- * Returns fuse value: 0 or 1
- */
-static inline int cvmx_fuse_read(int fuse)
-{
-       return (cvmx_fuse_read_byte(fuse >> 3) >> (fuse & 0x7)) & 1;
-}
-
-static inline int cvmx_octeon_model_CN36XX(void)
-{
-       return OCTEON_IS_MODEL(OCTEON_CN38XX)
-               && !cvmx_octeon_is_pass1()
-               && cvmx_fuse_read(264);
-}
-
-static inline int cvmx_octeon_zip_present(void)
-{
-       return octeon_has_feature(OCTEON_FEATURE_ZIP);
-}
-
-static inline int cvmx_octeon_dfa_present(void)
-{
-       if (!OCTEON_IS_MODEL(OCTEON_CN38XX)
-           && !OCTEON_IS_MODEL(OCTEON_CN31XX)
-           && !OCTEON_IS_MODEL(OCTEON_CN58XX))
-               return 0;
-       else if (OCTEON_IS_MODEL(OCTEON_CN3020))
-               return 0;
-       else if (cvmx_octeon_is_pass1())
-               return 1;
-       else
-               return !cvmx_fuse_read(120);
-}
-
-static inline int cvmx_octeon_crypto_present(void)
-{
-       return octeon_has_feature(OCTEON_FEATURE_CRYPTO);
-}
-
 #endif /*  __CVMX_H__  */
index 90e05a8d4b152add46184784d3e9707009deb4f6..c4fe81f47f53670fb535aba2895defe0e55d7b30 100644 (file)
@@ -86,8 +86,6 @@ enum octeon_feature {
        OCTEON_MAX_FEATURE
 };
 
-static inline int cvmx_fuse_read(int fuse);
-
 /**
  * Determine if the current Octeon supports a specific feature. These
  * checks have been optimized to be fairly quick, but they should still
@@ -105,33 +103,6 @@ static inline int octeon_has_feature(enum octeon_feature feature)
        case OCTEON_FEATURE_SAAD:
                return !OCTEON_IS_MODEL(OCTEON_CN3XXX);
 
-       case OCTEON_FEATURE_ZIP:
-               if (OCTEON_IS_MODEL(OCTEON_CN30XX)
-                   || OCTEON_IS_MODEL(OCTEON_CN50XX)
-                   || OCTEON_IS_MODEL(OCTEON_CN52XX))
-                       return 0;
-               else if (OCTEON_IS_MODEL(OCTEON_CN38XX_PASS1))
-                       return 1;
-               else
-                       return !cvmx_fuse_read(121);
-
-       case OCTEON_FEATURE_CRYPTO:
-               if (OCTEON_IS_MODEL(OCTEON_CN6XXX)) {
-                       union cvmx_mio_fus_dat2 fus_2;
-                       fus_2.u64 = cvmx_read_csr(CVMX_MIO_FUS_DAT2);
-                       if (fus_2.s.nocrypto || fus_2.s.nomul) {
-                               return 0;
-                       } else if (!fus_2.s.dorm_crypto) {
-                               return 1;
-                       } else {
-                               union cvmx_rnm_ctl_status st;
-                               st.u64 = cvmx_read_csr(CVMX_RNM_CTL_STATUS);
-                               return st.s.eer_val;
-                       }
-               } else {
-                       return !cvmx_fuse_read(90);
-               }
-
        case OCTEON_FEATURE_DORM_CRYPTO:
                if (OCTEON_IS_MODEL(OCTEON_CN6XXX)) {
                        union cvmx_mio_fus_dat2 fus_2;
@@ -188,29 +159,6 @@ static inline int octeon_has_feature(enum octeon_feature feature)
                          && !OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X)
                          && !OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X);
 
-       case OCTEON_FEATURE_DFA:
-               if (!OCTEON_IS_MODEL(OCTEON_CN38XX)
-                   && !OCTEON_IS_MODEL(OCTEON_CN31XX)
-                   && !OCTEON_IS_MODEL(OCTEON_CN58XX))
-                       return 0;
-               else if (OCTEON_IS_MODEL(OCTEON_CN3020))
-                       return 0;
-               else
-                       return !cvmx_fuse_read(120);
-
-       case OCTEON_FEATURE_HFA:
-               if (!OCTEON_IS_MODEL(OCTEON_CN6XXX))
-                       return 0;
-               else
-                       return !cvmx_fuse_read(90);
-
-       case OCTEON_FEATURE_DFM:
-               if (!(OCTEON_IS_MODEL(OCTEON_CN63XX)
-                     || OCTEON_IS_MODEL(OCTEON_CN66XX)))
-                       return 0;
-               else
-                       return !cvmx_fuse_read(90);
-
        case OCTEON_FEATURE_MDIO_CLAUSE_45:
                return !(OCTEON_IS_MODEL(OCTEON_CN3XXX)
                         || OCTEON_IS_MODEL(OCTEON_CN58XX)