prom.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * This program is free software; you can redistribute it and/or modify it
  3. * under the terms of the GNU General Public License version 2 as published
  4. * by the Free Software Foundation.
  5. *
  6. * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
  7. */
  8. #include <linux/export.h>
  9. #include <linux/clk.h>
  10. #include <asm/bootinfo.h>
  11. #include <asm/time.h>
  12. #include <lantiq_soc.h>
  13. #include "../prom.h"
  14. #define SOC_DANUBE "Danube"
  15. #define SOC_TWINPASS "Twinpass"
  16. #define SOC_AMAZON_SE "Amazon_SE"
  17. #define SOC_AR9 "AR9"
  18. #define SOC_GR9 "GR9"
  19. #define SOC_VR9 "VR9"
  20. #define COMP_DANUBE "lantiq,danube"
  21. #define COMP_TWINPASS "lantiq,twinpass"
  22. #define COMP_AMAZON_SE "lantiq,ase"
  23. #define COMP_AR9 "lantiq,ar9"
  24. #define COMP_GR9 "lantiq,gr9"
  25. #define COMP_VR9 "lantiq,vr9"
  26. #define PART_SHIFT 12
  27. #define PART_MASK 0x0FFFFFFF
  28. #define REV_SHIFT 28
  29. #define REV_MASK 0xF0000000
  30. void __init ltq_soc_detect(struct ltq_soc_info *i)
  31. {
  32. i->partnum = (ltq_r32(LTQ_MPS_CHIPID) & PART_MASK) >> PART_SHIFT;
  33. i->rev = (ltq_r32(LTQ_MPS_CHIPID) & REV_MASK) >> REV_SHIFT;
  34. sprintf(i->rev_type, "1.%d", i->rev);
  35. switch (i->partnum) {
  36. case SOC_ID_DANUBE1:
  37. case SOC_ID_DANUBE2:
  38. i->name = SOC_DANUBE;
  39. i->type = SOC_TYPE_DANUBE;
  40. i->compatible = COMP_DANUBE;
  41. break;
  42. case SOC_ID_TWINPASS:
  43. i->name = SOC_TWINPASS;
  44. i->type = SOC_TYPE_DANUBE;
  45. i->compatible = COMP_TWINPASS;
  46. break;
  47. case SOC_ID_ARX188:
  48. case SOC_ID_ARX168_1:
  49. case SOC_ID_ARX168_2:
  50. case SOC_ID_ARX182:
  51. i->name = SOC_AR9;
  52. i->type = SOC_TYPE_AR9;
  53. i->compatible = COMP_AR9;
  54. break;
  55. case SOC_ID_GRX188:
  56. case SOC_ID_GRX168:
  57. i->name = SOC_GR9;
  58. i->type = SOC_TYPE_AR9;
  59. i->compatible = COMP_GR9;
  60. break;
  61. case SOC_ID_AMAZON_SE_1:
  62. case SOC_ID_AMAZON_SE_2:
  63. #ifdef CONFIG_PCI
  64. panic("ase is only supported for non pci kernels");
  65. #endif
  66. i->name = SOC_AMAZON_SE;
  67. i->type = SOC_TYPE_AMAZON_SE;
  68. i->compatible = COMP_AMAZON_SE;
  69. break;
  70. case SOC_ID_VRX282:
  71. case SOC_ID_VRX268:
  72. case SOC_ID_VRX288:
  73. i->name = SOC_VR9;
  74. i->type = SOC_TYPE_VR9;
  75. i->compatible = COMP_VR9;
  76. break;
  77. case SOC_ID_GRX268:
  78. case SOC_ID_GRX288:
  79. i->name = SOC_GR9;
  80. i->type = SOC_TYPE_VR9;
  81. i->compatible = COMP_GR9;
  82. break;
  83. case SOC_ID_VRX268_2:
  84. case SOC_ID_VRX288_2:
  85. i->name = SOC_VR9;
  86. i->type = SOC_TYPE_VR9_2;
  87. i->compatible = COMP_VR9;
  88. break;
  89. case SOC_ID_GRX282_2:
  90. case SOC_ID_GRX288_2:
  91. i->name = SOC_GR9;
  92. i->type = SOC_TYPE_VR9_2;
  93. i->compatible = COMP_GR9;
  94. break;
  95. default:
  96. unreachable();
  97. break;
  98. }
  99. }