1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 2 /* 3 * IXP4XX cpu type detection 3 * IXP4XX cpu type detection 4 * 4 * 5 * Copyright (C) 2007 MontaVista Software, Inc 5 * Copyright (C) 2007 MontaVista Software, Inc. 6 */ 6 */ 7 7 8 #ifndef __SOC_IXP4XX_CPU_H__ 8 #ifndef __SOC_IXP4XX_CPU_H__ 9 #define __SOC_IXP4XX_CPU_H__ 9 #define __SOC_IXP4XX_CPU_H__ 10 10 11 #include <linux/io.h> 11 #include <linux/io.h> 12 #include <linux/regmap.h> 12 #include <linux/regmap.h> 13 #ifdef CONFIG_ARM 13 #ifdef CONFIG_ARM 14 #include <asm/cputype.h> 14 #include <asm/cputype.h> 15 #endif 15 #endif 16 16 17 /* Processor id value in CP15 Register 0 */ 17 /* Processor id value in CP15 Register 0 */ 18 #define IXP42X_PROCESSOR_ID_VALUE 0x6905 18 #define IXP42X_PROCESSOR_ID_VALUE 0x690541c0 /* including unused 0x690541Ex */ 19 #define IXP42X_PROCESSOR_ID_MASK 0xffff 19 #define IXP42X_PROCESSOR_ID_MASK 0xffffffc0 20 20 21 #define IXP43X_PROCESSOR_ID_VALUE 0x6905 21 #define IXP43X_PROCESSOR_ID_VALUE 0x69054040 22 #define IXP43X_PROCESSOR_ID_MASK 0xffff 22 #define IXP43X_PROCESSOR_ID_MASK 0xfffffff0 23 23 24 #define IXP46X_PROCESSOR_ID_VALUE 0x6905 24 #define IXP46X_PROCESSOR_ID_VALUE 0x69054200 /* including IXP455 */ 25 #define IXP46X_PROCESSOR_ID_MASK 0xffff 25 #define IXP46X_PROCESSOR_ID_MASK 0xfffffff0 26 26 27 /* Feature register in the expansion bus contr 27 /* Feature register in the expansion bus controller */ 28 #define IXP4XX_EXP_CNFG2 0x2c 28 #define IXP4XX_EXP_CNFG2 0x2c 29 29 30 /* "fuse" bits of IXP_EXP_CFG2 */ 30 /* "fuse" bits of IXP_EXP_CFG2 */ 31 /* All IXP4xx CPUs */ 31 /* All IXP4xx CPUs */ 32 #define IXP4XX_FEATURE_RCOMP (1 << 32 #define IXP4XX_FEATURE_RCOMP (1 << 0) 33 #define IXP4XX_FEATURE_USB_DEVICE (1 << 33 #define IXP4XX_FEATURE_USB_DEVICE (1 << 1) 34 #define IXP4XX_FEATURE_HASH (1 << 34 #define IXP4XX_FEATURE_HASH (1 << 2) 35 #define IXP4XX_FEATURE_AES (1 << 35 #define IXP4XX_FEATURE_AES (1 << 3) 36 #define IXP4XX_FEATURE_DES (1 << 36 #define IXP4XX_FEATURE_DES (1 << 4) 37 #define IXP4XX_FEATURE_HDLC (1 << 37 #define IXP4XX_FEATURE_HDLC (1 << 5) 38 #define IXP4XX_FEATURE_AAL (1 << 38 #define IXP4XX_FEATURE_AAL (1 << 6) 39 #define IXP4XX_FEATURE_HSS (1 << 39 #define IXP4XX_FEATURE_HSS (1 << 7) 40 #define IXP4XX_FEATURE_UTOPIA (1 << 40 #define IXP4XX_FEATURE_UTOPIA (1 << 8) 41 #define IXP4XX_FEATURE_NPEB_ETH0 (1 << 41 #define IXP4XX_FEATURE_NPEB_ETH0 (1 << 9) 42 #define IXP4XX_FEATURE_NPEC_ETH (1 << 42 #define IXP4XX_FEATURE_NPEC_ETH (1 << 10) 43 #define IXP4XX_FEATURE_RESET_NPEA (1 << 43 #define IXP4XX_FEATURE_RESET_NPEA (1 << 11) 44 #define IXP4XX_FEATURE_RESET_NPEB (1 << 44 #define IXP4XX_FEATURE_RESET_NPEB (1 << 12) 45 #define IXP4XX_FEATURE_RESET_NPEC (1 << 45 #define IXP4XX_FEATURE_RESET_NPEC (1 << 13) 46 #define IXP4XX_FEATURE_PCI (1 << 46 #define IXP4XX_FEATURE_PCI (1 << 14) 47 #define IXP4XX_FEATURE_UTOPIA_PHY_LIMIT (3 << 47 #define IXP4XX_FEATURE_UTOPIA_PHY_LIMIT (3 << 16) 48 #define IXP4XX_FEATURE_XSCALE_MAX_FREQ (3 << 48 #define IXP4XX_FEATURE_XSCALE_MAX_FREQ (3 << 22) 49 #define IXP42X_FEATURE_MASK (IXP4X 49 #define IXP42X_FEATURE_MASK (IXP4XX_FEATURE_RCOMP | \ 50 IXP4X 50 IXP4XX_FEATURE_USB_DEVICE | \ 51 IXP4X 51 IXP4XX_FEATURE_HASH | \ 52 IXP4X 52 IXP4XX_FEATURE_AES | \ 53 IXP4X 53 IXP4XX_FEATURE_DES | \ 54 IXP4X 54 IXP4XX_FEATURE_HDLC | \ 55 IXP4X 55 IXP4XX_FEATURE_AAL | \ 56 IXP4X 56 IXP4XX_FEATURE_HSS | \ 57 IXP4X 57 IXP4XX_FEATURE_UTOPIA | \ 58 IXP4X 58 IXP4XX_FEATURE_NPEB_ETH0 | \ 59 IXP4X 59 IXP4XX_FEATURE_NPEC_ETH | \ 60 IXP4X 60 IXP4XX_FEATURE_RESET_NPEA | \ 61 IXP4X 61 IXP4XX_FEATURE_RESET_NPEB | \ 62 IXP4X 62 IXP4XX_FEATURE_RESET_NPEC | \ 63 IXP4X 63 IXP4XX_FEATURE_PCI | \ 64 IXP4X 64 IXP4XX_FEATURE_UTOPIA_PHY_LIMIT | \ 65 IXP4X 65 IXP4XX_FEATURE_XSCALE_MAX_FREQ) 66 66 67 67 68 /* IXP43x/46x CPUs */ 68 /* IXP43x/46x CPUs */ 69 #define IXP4XX_FEATURE_ECC_TIMESYNC (1 << 69 #define IXP4XX_FEATURE_ECC_TIMESYNC (1 << 15) 70 #define IXP4XX_FEATURE_USB_HOST (1 << 70 #define IXP4XX_FEATURE_USB_HOST (1 << 18) 71 #define IXP4XX_FEATURE_NPEA_ETH (1 << 71 #define IXP4XX_FEATURE_NPEA_ETH (1 << 19) 72 #define IXP43X_FEATURE_MASK (IXP42 72 #define IXP43X_FEATURE_MASK (IXP42X_FEATURE_MASK | \ 73 IXP4X 73 IXP4XX_FEATURE_ECC_TIMESYNC | \ 74 IXP4X 74 IXP4XX_FEATURE_USB_HOST | \ 75 IXP4X 75 IXP4XX_FEATURE_NPEA_ETH) 76 76 77 /* IXP46x CPU (including IXP455) only */ 77 /* IXP46x CPU (including IXP455) only */ 78 #define IXP4XX_FEATURE_NPEB_ETH_1_TO_3 (1 << 78 #define IXP4XX_FEATURE_NPEB_ETH_1_TO_3 (1 << 20) 79 #define IXP4XX_FEATURE_RSA (1 << 79 #define IXP4XX_FEATURE_RSA (1 << 21) 80 #define IXP46X_FEATURE_MASK (IXP43 80 #define IXP46X_FEATURE_MASK (IXP43X_FEATURE_MASK | \ 81 IXP4X 81 IXP4XX_FEATURE_NPEB_ETH_1_TO_3 | \ 82 IXP4X 82 IXP4XX_FEATURE_RSA) 83 83 84 #ifdef CONFIG_ARCH_IXP4XX 84 #ifdef CONFIG_ARCH_IXP4XX 85 #define cpu_is_ixp42x_rev_a0() ((read_cpuid_id 85 #define cpu_is_ixp42x_rev_a0() ((read_cpuid_id() & (IXP42X_PROCESSOR_ID_MASK | 0xF)) == \ 86 IXP42X_PROCESS 86 IXP42X_PROCESSOR_ID_VALUE) 87 #define cpu_is_ixp42x() ((read_cpuid_id() & IX 87 #define cpu_is_ixp42x() ((read_cpuid_id() & IXP42X_PROCESSOR_ID_MASK) == \ 88 IXP42X_PROCESSOR_ID_V 88 IXP42X_PROCESSOR_ID_VALUE) 89 #define cpu_is_ixp43x() ((read_cpuid_id() & IX 89 #define cpu_is_ixp43x() ((read_cpuid_id() & IXP43X_PROCESSOR_ID_MASK) == \ 90 IXP43X_PROCESSOR_ID_V 90 IXP43X_PROCESSOR_ID_VALUE) 91 #define cpu_is_ixp46x() ((read_cpuid_id() & IX 91 #define cpu_is_ixp46x() ((read_cpuid_id() & IXP46X_PROCESSOR_ID_MASK) == \ 92 IXP46X_PROCESSOR_ID_V 92 IXP46X_PROCESSOR_ID_VALUE) 93 static inline u32 cpu_ixp4xx_features(struct r 93 static inline u32 cpu_ixp4xx_features(struct regmap *rmap) 94 { 94 { 95 u32 val; 95 u32 val; 96 96 97 regmap_read(rmap, IXP4XX_EXP_CNFG2, &v 97 regmap_read(rmap, IXP4XX_EXP_CNFG2, &val); 98 /* For some reason this register is in 98 /* For some reason this register is inverted */ 99 val = ~val; 99 val = ~val; 100 if (cpu_is_ixp42x_rev_a0()) 100 if (cpu_is_ixp42x_rev_a0()) 101 return IXP42X_FEATURE_MASK & ~ 101 return IXP42X_FEATURE_MASK & ~(IXP4XX_FEATURE_RCOMP | 102 102 IXP4XX_FEATURE_AES); 103 if (cpu_is_ixp42x()) 103 if (cpu_is_ixp42x()) 104 return val & IXP42X_FEATURE_MA 104 return val & IXP42X_FEATURE_MASK; 105 if (cpu_is_ixp43x()) 105 if (cpu_is_ixp43x()) 106 return val & IXP43X_FEATURE_MA 106 return val & IXP43X_FEATURE_MASK; 107 return val & IXP46X_FEATURE_MASK; 107 return val & IXP46X_FEATURE_MASK; 108 } 108 } 109 #else 109 #else 110 #define cpu_is_ixp42x_rev_a0() 0 110 #define cpu_is_ixp42x_rev_a0() 0 111 #define cpu_is_ixp42x() 0 111 #define cpu_is_ixp42x() 0 112 #define cpu_is_ixp43x() 0 112 #define cpu_is_ixp43x() 0 113 #define cpu_is_ixp46x() 0 113 #define cpu_is_ixp46x() 0 114 static inline u32 cpu_ixp4xx_features(struct r 114 static inline u32 cpu_ixp4xx_features(struct regmap *rmap) 115 { 115 { 116 return 0; 116 return 0; 117 } 117 } 118 #endif 118 #endif 119 119 120 #endif /* _ASM_ARCH_CPU_H */ 120 #endif /* _ASM_ARCH_CPU_H */ 121 121
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.