[ARM] 4712/2: Adds functions to read and write IXP4xx "feature" bits

Adds functions to read and write IXP4xx "feature" (aka "fuse")
bits, containing information about available/enabled CPU features.

The uncompress.h included by boot/compressed/misc.c resides in
a different space than rest of the kernel and thus can't use
asm/hardware.h (including asm/arch/cpu.h - which, in turn, may use
EXPORTed symbol "processor_id").

Posted to linux-arm-kernel on 2 Dec 2007 and revised.

Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Krzysztof Halasa and committed by
Russell King
c18f6581 a9a424ce

+52 -8
+1
arch/arm/kernel/setup.c
··· 62 extern void _stext, _text, _etext, __data_start, _edata, _end; 63 64 unsigned int processor_id; 65 unsigned int __machine_arch_type; 66 EXPORT_SYMBOL(__machine_arch_type); 67
··· 62 extern void _stext, _text, _etext, __data_start, _edata, _end; 63 64 unsigned int processor_id; 65 + EXPORT_SYMBOL(processor_id); 66 unsigned int __machine_arch_type; 67 EXPORT_SYMBOL(__machine_arch_type); 68
+15
include/asm-arm/arch-ixp4xx/cpu.h
··· 28 #define cpu_is_ixp46x() ((processor_id & IXP4XX_PROCESSOR_ID_MASK) == \ 29 IXP465_PROCESSOR_ID_VALUE) 30 31 #endif /* _ASM_ARCH_CPU_H */
··· 28 #define cpu_is_ixp46x() ((processor_id & IXP4XX_PROCESSOR_ID_MASK) == \ 29 IXP465_PROCESSOR_ID_VALUE) 30 31 + static inline u32 ixp4xx_read_feature_bits(void) 32 + { 33 + unsigned int val = ~*IXP4XX_EXP_CFG2; 34 + val &= ~IXP4XX_FEATURE_RESERVED; 35 + if (!cpu_is_ixp46x()) 36 + val &= ~IXP4XX_FEATURE_IXP46X_ONLY; 37 + 38 + return val; 39 + } 40 + 41 + static inline void ixp4xx_write_feature_bits(u32 value) 42 + { 43 + *IXP4XX_EXP_CFG2 = ~value; 44 + } 45 + 46 #endif /* _ASM_ARCH_CPU_H */
+3 -3
include/asm-arm/arch-ixp4xx/hardware.h
··· 27 28 #define pcibios_assign_all_busses() 1 29 30 #ifndef __ASSEMBLER__ 31 #include <asm/arch/cpu.h> 32 #endif 33 - 34 - /* Register locations and bits */ 35 - #include "ixp4xx-regs.h" 36 37 /* Platform helper functions and definitions */ 38 #include "platform.h"
··· 27 28 #define pcibios_assign_all_busses() 1 29 30 + /* Register locations and bits */ 31 + #include "ixp4xx-regs.h" 32 + 33 #ifndef __ASSEMBLER__ 34 #include <asm/arch/cpu.h> 35 #endif 36 37 /* Platform helper functions and definitions */ 38 #include "platform.h"
+32 -4
include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
··· 15 * 16 */ 17 18 - #ifndef __ASM_ARCH_HARDWARE_H__ 19 - #error "Do not include this directly, instead #include <asm/hardware.h>" 20 - #endif 21 - 22 #ifndef _ASM_ARM_IXP4XX_H_ 23 #define _ASM_ARM_IXP4XX_H_ 24 ··· 602 #define USIR1_IR15 (1 << 7) /* Interrup request ep 15 */ 603 604 #define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */ 605 606 #endif
··· 15 * 16 */ 17 18 #ifndef _ASM_ARM_IXP4XX_H_ 19 #define _ASM_ARM_IXP4XX_H_ 20 ··· 606 #define USIR1_IR15 (1 << 7) /* Interrup request ep 15 */ 607 608 #define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */ 609 + 610 + /* "fuse" bits of IXP_EXP_CFG2 */ 611 + #define IXP4XX_FEATURE_RCOMP (1 << 0) 612 + #define IXP4XX_FEATURE_USB_DEVICE (1 << 1) 613 + #define IXP4XX_FEATURE_HASH (1 << 2) 614 + #define IXP4XX_FEATURE_AES (1 << 3) 615 + #define IXP4XX_FEATURE_DES (1 << 4) 616 + #define IXP4XX_FEATURE_HDLC (1 << 5) 617 + #define IXP4XX_FEATURE_AAL (1 << 6) 618 + #define IXP4XX_FEATURE_HSS (1 << 7) 619 + #define IXP4XX_FEATURE_UTOPIA (1 << 8) 620 + #define IXP4XX_FEATURE_NPEB_ETH0 (1 << 9) 621 + #define IXP4XX_FEATURE_NPEC_ETH (1 << 10) 622 + #define IXP4XX_FEATURE_RESET_NPEA (1 << 11) 623 + #define IXP4XX_FEATURE_RESET_NPEB (1 << 12) 624 + #define IXP4XX_FEATURE_RESET_NPEC (1 << 13) 625 + #define IXP4XX_FEATURE_PCI (1 << 14) 626 + #define IXP4XX_FEATURE_ECC_TIMESYNC (1 << 15) 627 + #define IXP4XX_FEATURE_UTOPIA_PHY_LIMIT (3 << 16) 628 + #define IXP4XX_FEATURE_USB_HOST (1 << 18) 629 + #define IXP4XX_FEATURE_NPEA_ETH (1 << 19) 630 + #define IXP4XX_FEATURE_NPEB_ETH_1_TO_3 (1 << 20) 631 + #define IXP4XX_FEATURE_RSA (1 << 21) 632 + #define IXP4XX_FEATURE_XSCALE_MAX_FREQ (3 << 22) 633 + #define IXP4XX_FEATURE_RESERVED (0xFF << 24) 634 + 635 + #define IXP4XX_FEATURE_IXP46X_ONLY (IXP4XX_FEATURE_ECC_TIMESYNC | \ 636 + IXP4XX_FEATURE_USB_HOST | \ 637 + IXP4XX_FEATURE_NPEA_ETH | \ 638 + IXP4XX_FEATURE_NPEB_ETH_1_TO_3 | \ 639 + IXP4XX_FEATURE_RSA | \ 640 + IXP4XX_FEATURE_XSCALE_MAX_FREQ) 641 642 #endif
+1 -1
include/asm-arm/arch-ixp4xx/uncompress.h
··· 13 #ifndef _ARCH_UNCOMPRESS_H_ 14 #define _ARCH_UNCOMPRESS_H_ 15 16 - #include <asm/hardware.h> 17 #include <asm/mach-types.h> 18 #include <linux/serial_reg.h> 19
··· 13 #ifndef _ARCH_UNCOMPRESS_H_ 14 #define _ARCH_UNCOMPRESS_H_ 15 16 + #include "ixp4xx-regs.h" 17 #include <asm/mach-types.h> 18 #include <linux/serial_reg.h> 19