2
0

omap_tap.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * TI OMAP TEST-Chip-level TAP emulation.
  3. *
  4. * Copyright (C) 2007-2008 Nokia Corporation
  5. * Written by Andrzej Zaborowski <andrew@openedhand.com>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 or
  10. * (at your option) any later version of the License.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #include "hw.h"
  21. #include "omap.h"
  22. /* TEST-Chip-level TAP */
  23. static uint64_t omap_tap_read(void *opaque, hwaddr addr,
  24. unsigned size)
  25. {
  26. struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
  27. if (size != 4) {
  28. return omap_badwidth_read32(opaque, addr);
  29. }
  30. switch (addr) {
  31. case 0x204: /* IDCODE_reg */
  32. switch (s->mpu_model) {
  33. case omap2420:
  34. case omap2422:
  35. case omap2423:
  36. return 0x5b5d902f; /* ES 2.2 */
  37. case omap2430:
  38. return 0x5b68a02f; /* ES 2.2 */
  39. case omap3430:
  40. return 0x1b7ae02f; /* ES 2 */
  41. default:
  42. hw_error("%s: Bad mpu model\n", __FUNCTION__);
  43. }
  44. case 0x208: /* PRODUCTION_ID_reg for OMAP2 */
  45. case 0x210: /* PRODUCTION_ID_reg for OMAP3 */
  46. switch (s->mpu_model) {
  47. case omap2420:
  48. return 0x000254f0; /* POP ESHS2.1.1 in N91/93/95, ES2 in N800 */
  49. case omap2422:
  50. return 0x000400f0;
  51. case omap2423:
  52. return 0x000800f0;
  53. case omap2430:
  54. return 0x000000f0;
  55. case omap3430:
  56. return 0x000000f0;
  57. default:
  58. hw_error("%s: Bad mpu model\n", __FUNCTION__);
  59. }
  60. case 0x20c:
  61. switch (s->mpu_model) {
  62. case omap2420:
  63. case omap2422:
  64. case omap2423:
  65. return 0xcafeb5d9; /* ES 2.2 */
  66. case omap2430:
  67. return 0xcafeb68a; /* ES 2.2 */
  68. case omap3430:
  69. return 0xcafeb7ae; /* ES 2 */
  70. default:
  71. hw_error("%s: Bad mpu model\n", __FUNCTION__);
  72. }
  73. case 0x218: /* DIE_ID_reg */
  74. return ('Q' << 24) | ('E' << 16) | ('M' << 8) | ('U' << 0);
  75. case 0x21c: /* DIE_ID_reg */
  76. return 0x54 << 24;
  77. case 0x220: /* DIE_ID_reg */
  78. return ('Q' << 24) | ('E' << 16) | ('M' << 8) | ('U' << 0);
  79. case 0x224: /* DIE_ID_reg */
  80. return ('Q' << 24) | ('E' << 16) | ('M' << 8) | ('U' << 0);
  81. }
  82. OMAP_BAD_REG(addr);
  83. return 0;
  84. }
  85. static void omap_tap_write(void *opaque, hwaddr addr,
  86. uint64_t value, unsigned size)
  87. {
  88. if (size != 4) {
  89. return omap_badwidth_write32(opaque, addr, value);
  90. }
  91. OMAP_BAD_REG(addr);
  92. }
  93. static const MemoryRegionOps omap_tap_ops = {
  94. .read = omap_tap_read,
  95. .write = omap_tap_write,
  96. .endianness = DEVICE_NATIVE_ENDIAN,
  97. };
  98. void omap_tap_init(struct omap_target_agent_s *ta,
  99. struct omap_mpu_state_s *mpu)
  100. {
  101. memory_region_init_io(&mpu->tap_iomem, &omap_tap_ops, mpu, "omap.tap",
  102. omap_l4_region_size(ta, 0));
  103. omap_l4_attach(ta, 0, &mpu->tap_iomem);
  104. }