332-MIPS-BCM63XX-detect-BCM6328-variants.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From d59120f23279ef62a48d9f94847254b061d0a8b6 Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <jogo@openwrt.org>
  3. Date: Sat, 7 Dec 2013 14:30:59 +0100
  4. Subject: [PATCH 22/45] MIPS: BCM63XX: detect BCM6328 variants
  5. Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  6. ---
  7. arch/mips/bcm63xx/cpu.c | 10 ++++++++++
  8. arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 8 ++++++--
  9. 2 files changed, 16 insertions(+), 2 deletions(-)
  10. --- a/arch/mips/bcm63xx/cpu.c
  11. +++ b/arch/mips/bcm63xx/cpu.c
  12. @@ -305,6 +305,7 @@ void __init bcm63xx_cpu_init(void)
  13. unsigned int tmp;
  14. unsigned int cpu = smp_processor_id();
  15. u32 chipid_reg;
  16. + u8 __maybe_unused varid = 0;
  17. /* soc registers location depends on cpu type */
  18. chipid_reg = 0;
  19. @@ -344,6 +345,7 @@ void __init bcm63xx_cpu_init(void)
  20. bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT;
  21. bcm63xx_cpu_variant = bcm63xx_cpu_id;
  22. bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT;
  23. + varid = (tmp & REV_VARID_MASK) >> REV_VARID_SHIFT;
  24. switch (bcm63xx_cpu_id) {
  25. case BCM3368_CPU_ID:
  26. @@ -353,6 +355,14 @@ void __init bcm63xx_cpu_init(void)
  27. case BCM6328_CPU_ID:
  28. bcm63xx_regs_base = bcm6328_regs_base;
  29. bcm63xx_irqs = bcm6328_irqs;
  30. +
  31. + if (varid == 1)
  32. + bcm63xx_cpu_variant = BCM63281_CPU_ID;
  33. + else if (varid == 3)
  34. + bcm63xx_cpu_variant = BCM63283_CPU_ID;
  35. + else
  36. + pr_warn("unknown BCM6328 variant: %x\n", varid);
  37. +
  38. break;
  39. case BCM6338_CPU_ID:
  40. bcm63xx_regs_base = bcm6338_regs_base;
  41. --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
  42. +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
  43. @@ -11,6 +11,8 @@
  44. */
  45. #define BCM3368_CPU_ID 0x3368
  46. #define BCM6328_CPU_ID 0x6328
  47. +#define BCM63281_CPU_ID 0x63281
  48. +#define BCM63283_CPU_ID 0x63283
  49. #define BCM6338_CPU_ID 0x6338
  50. #define BCM6345_CPU_ID 0x6345
  51. #define BCM6348_CPU_ID 0x6348
  52. @@ -85,8 +87,10 @@ static inline u16 __pure bcm63xx_get_cpu
  53. #define BCMCPU_VARIANT_IS_3368() \
  54. (bcm63xx_get_cpu_variant() == BCM3368_CPU_ID)
  55. -#define BCMCPU_VARIANT_IS_6328() \
  56. - (bcm63xx_get_cpu_variant() == BCM6328_CPU_ID)
  57. +#define BCMCPU_VARIANT_IS_63281() \
  58. + (bcm63xx_get_cpu_variant() == BCM63281_CPU_ID)
  59. +#define BCMCPU_VARIANT_IS_63283() \
  60. + (bcm63xx_get_cpu_variant() == BCM63283_CPU_ID)
  61. #define BCMCPU_VARIANT_IS_6338() \
  62. (bcm63xx_get_cpu_variant() == BCM6338_CPU_ID)
  63. #define BCMCPU_VARIANT_IS_6345() \