omap_tap.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 "qemu/osdep.h"
  21. #include "hw/hw.h"
  22. #include "hw/arm/omap.h"
  23. /* TEST-Chip-level TAP */
  24. static uint64_t omap_tap_read(void *opaque, hwaddr addr,
  25. unsigned size)
  26. {
  27. struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
  28. if (size != 4) {
  29. return omap_badwidth_read32(opaque, addr);
  30. }
  31. switch (addr) {
  32. case 0x204: /* IDCODE_reg */
  33. switch (s->mpu_model) {
  34. case omap2420:
  35. case omap2422:
  36. case omap2423:
  37. return 0x5b5d902f; /* ES 2.2 */
  38. case omap2430:
  39. return 0x5b68a02f; /* ES 2.2 */
  40. case omap3430:
  41. return 0x1b7ae02f; /* ES 2 */
  42. default:
  43. hw_error("%s: Bad mpu model\n", __func__);
  44. }
  45. case 0x208: /* PRODUCTION_ID_reg for OMAP2 */
  46. case 0x210: /* PRODUCTION_ID_reg for OMAP3 */
  47. switch (s->mpu_model) {
  48. case omap2420:
  49. return 0x000254f0; /* POP ESHS2.1.1 in N91/93/95, ES2 in N800 */
  50. case omap2422:
  51. return 0x000400f0;
  52. case omap2423:
  53. return 0x000800f0;
  54. case omap2430:
  55. return 0x000000f0;
  56. case omap3430:
  57. return 0x000000f0;
  58. default:
  59. hw_error("%s: Bad mpu model\n", __func__);
  60. }
  61. case 0x20c:
  62. switch (s->mpu_model) {
  63. case omap2420:
  64. case omap2422:
  65. case omap2423:
  66. return 0xcafeb5d9; /* ES 2.2 */
  67. case omap2430:
  68. return 0xcafeb68a; /* ES 2.2 */
  69. case omap3430:
  70. return 0xcafeb7ae; /* ES 2 */
  71. default:
  72. hw_error("%s: Bad mpu model\n", __func__);
  73. }
  74. case 0x218: /* DIE_ID_reg */
  75. return ('Q' << 24) | ('E' << 16) | ('M' << 8) | ('U' << 0);
  76. case 0x21c: /* DIE_ID_reg */
  77. return 0x54 << 24;
  78. case 0x220: /* DIE_ID_reg */
  79. return ('Q' << 24) | ('E' << 16) | ('M' << 8) | ('U' << 0);
  80. case 0x224: /* DIE_ID_reg */
  81. return ('Q' << 24) | ('E' << 16) | ('M' << 8) | ('U' << 0);
  82. }
  83. OMAP_BAD_REG(addr);
  84. return 0;
  85. }
  86. static void omap_tap_write(void *opaque, hwaddr addr,
  87. uint64_t value, unsigned size)
  88. {
  89. if (size != 4) {
  90. omap_badwidth_write32(opaque, addr, value);
  91. return;
  92. }
  93. OMAP_BAD_REG(addr);
  94. }
  95. static const MemoryRegionOps omap_tap_ops = {
  96. .read = omap_tap_read,
  97. .write = omap_tap_write,
  98. .endianness = DEVICE_NATIVE_ENDIAN,
  99. };
  100. void omap_tap_init(struct omap_target_agent_s *ta,
  101. struct omap_mpu_state_s *mpu)
  102. {
  103. memory_region_init_io(&mpu->tap_iomem, NULL, &omap_tap_ops, mpu, "omap.tap",
  104. omap_l4_region_size(ta, 0));
  105. omap_l4_attach(ta, 0, &mpu->tap_iomem);
  106. }