id.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2010
  3. *
  4. * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
  5. * License terms: GNU General Public License (GPL) version 2
  6. */
  7. #include <linux/kernel.h>
  8. #include <linux/init.h>
  9. #include <linux/io.h>
  10. #include <asm/cputype.h>
  11. #include <asm/tlbflush.h>
  12. #include <asm/cacheflush.h>
  13. #include <asm/mach/map.h>
  14. #include <mach/hardware.h>
  15. #include <mach/setup.h>
  16. struct dbx500_asic_id dbx500_id;
  17. static unsigned int ux500_read_asicid(phys_addr_t addr)
  18. {
  19. phys_addr_t base = addr & ~0xfff;
  20. struct map_desc desc = {
  21. .virtual = IO_ADDRESS(base),
  22. .pfn = __phys_to_pfn(base),
  23. .length = SZ_16K,
  24. .type = MT_DEVICE,
  25. };
  26. iotable_init(&desc, 1);
  27. /* As in devicemaps_init() */
  28. local_flush_tlb_all();
  29. flush_cache_all();
  30. return readl(__io_address(addr));
  31. }
  32. static void ux500_print_soc_info(unsigned int asicid)
  33. {
  34. unsigned int rev = dbx500_revision();
  35. pr_info("DB%4x ", dbx500_partnumber());
  36. if (rev == 0x01)
  37. pr_cont("Early Drop");
  38. else if (rev >= 0xA0)
  39. pr_cont("v%d.%d" , (rev >> 4) - 0xA + 1, rev & 0xf);
  40. else
  41. pr_cont("Unknown");
  42. pr_cont(" [%#010x]\n", asicid);
  43. }
  44. static unsigned int partnumber(unsigned int asicid)
  45. {
  46. return (asicid >> 8) & 0xffff;
  47. }
  48. /*
  49. * SOC MIDR ASICID ADDRESS ASICID VALUE
  50. * DB8500ed 0x410fc090 0x9001FFF4 0x00850001
  51. * DB8500v1 0x411fc091 0x9001FFF4 0x008500A0
  52. * DB8500v1.1 0x411fc091 0x9001FFF4 0x008500A1
  53. * DB8500v2 0x412fc091 0x9001DBF4 0x008500B0
  54. * DB5500v1 0x412fc091 0x9001FFF4 0x005500A0
  55. */
  56. void __init ux500_map_io(void)
  57. {
  58. unsigned int cpuid = read_cpuid_id();
  59. unsigned int asicid = 0;
  60. phys_addr_t addr = 0;
  61. switch (cpuid) {
  62. case 0x410fc090: /* DB8500ed */
  63. case 0x411fc091: /* DB8500v1 */
  64. addr = 0x9001FFF4;
  65. break;
  66. case 0x412fc091: /* DB8500v2 / DB5500v1 */
  67. asicid = ux500_read_asicid(0x9001DBF4);
  68. if (partnumber(asicid) == 0x8500)
  69. /* DB8500v2 */
  70. break;
  71. /* DB5500v1 */
  72. addr = 0x9001FFF4;
  73. break;
  74. }
  75. if (addr)
  76. asicid = ux500_read_asicid(addr);
  77. if (!asicid) {
  78. pr_err("Unable to identify SoC\n");
  79. ux500_unknown_soc();
  80. }
  81. dbx500_id.process = asicid >> 24;
  82. dbx500_id.partnumber = partnumber(asicid);
  83. dbx500_id.revision = asicid & 0xff;
  84. ux500_print_soc_info(asicid);
  85. }