cpu.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * arch/arm/mach-ixp4xx/include/mach/cpu.h
  3. *
  4. * IXP4XX cpu type detection
  5. *
  6. * Copyright (C) 2007 MontaVista Software, Inc.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #ifndef __ASM_ARCH_CPU_H__
  14. #define __ASM_ARCH_CPU_H__
  15. #include <linux/io.h>
  16. #include <asm/cputype.h>
  17. /* Processor id value in CP15 Register 0 */
  18. #define IXP42X_PROCESSOR_ID_VALUE 0x690541c0 /* including unused 0x690541Ex */
  19. #define IXP42X_PROCESSOR_ID_MASK 0xffffffc0
  20. #define IXP43X_PROCESSOR_ID_VALUE 0x69054040
  21. #define IXP43X_PROCESSOR_ID_MASK 0xfffffff0
  22. #define IXP46X_PROCESSOR_ID_VALUE 0x69054200 /* including IXP455 */
  23. #define IXP46X_PROCESSOR_ID_MASK 0xfffffff0
  24. #define cpu_is_ixp42x_rev_a0() ((read_cpuid_id() & (IXP42X_PROCESSOR_ID_MASK | 0xF)) == \
  25. IXP42X_PROCESSOR_ID_VALUE)
  26. #define cpu_is_ixp42x() ((read_cpuid_id() & IXP42X_PROCESSOR_ID_MASK) == \
  27. IXP42X_PROCESSOR_ID_VALUE)
  28. #define cpu_is_ixp43x() ((read_cpuid_id() & IXP43X_PROCESSOR_ID_MASK) == \
  29. IXP43X_PROCESSOR_ID_VALUE)
  30. #define cpu_is_ixp46x() ((read_cpuid_id() & IXP46X_PROCESSOR_ID_MASK) == \
  31. IXP46X_PROCESSOR_ID_VALUE)
  32. static inline u32 ixp4xx_read_feature_bits(void)
  33. {
  34. u32 val = ~__raw_readl(IXP4XX_EXP_CFG2);
  35. if (cpu_is_ixp42x_rev_a0())
  36. return IXP42X_FEATURE_MASK & ~(IXP4XX_FEATURE_RCOMP |
  37. IXP4XX_FEATURE_AES);
  38. if (cpu_is_ixp42x())
  39. return val & IXP42X_FEATURE_MASK;
  40. if (cpu_is_ixp43x())
  41. return val & IXP43X_FEATURE_MASK;
  42. return val & IXP46X_FEATURE_MASK;
  43. }
  44. static inline void ixp4xx_write_feature_bits(u32 value)
  45. {
  46. __raw_writel(~value, IXP4XX_EXP_CFG2);
  47. }
  48. #endif /* _ASM_ARCH_CPU_H */