omap_tap.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 uint32_t omap_tap_read(void *opaque, target_phys_addr_t addr)
  24. {
  25. struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
  26. switch (addr) {
  27. case 0x204: /* IDCODE_reg */
  28. switch (s->mpu_model) {
  29. case omap2420:
  30. case omap2422:
  31. case omap2423:
  32. return 0x5b5d902f; /* ES 2.2 */
  33. case omap2430:
  34. return 0x5b68a02f; /* ES 2.2 */
  35. case omap3430:
  36. return 0x1b7ae02f; /* ES 2 */
  37. default:
  38. hw_error("%s: Bad mpu model\n", __FUNCTION__);
  39. }
  40. case 0x208: /* PRODUCTION_ID_reg for OMAP2 */
  41. case 0x210: /* PRODUCTION_ID_reg for OMAP3 */
  42. switch (s->mpu_model) {
  43. case omap2420:
  44. return 0x000254f0; /* POP ESHS2.1.1 in N91/93/95, ES2 in N800 */
  45. case omap2422:
  46. return 0x000400f0;
  47. case omap2423:
  48. return 0x000800f0;
  49. case omap2430:
  50. return 0x000000f0;
  51. case omap3430:
  52. return 0x000000f0;
  53. default:
  54. hw_error("%s: Bad mpu model\n", __FUNCTION__);
  55. }
  56. case 0x20c:
  57. switch (s->mpu_model) {
  58. case omap2420:
  59. case omap2422:
  60. case omap2423:
  61. return 0xcafeb5d9; /* ES 2.2 */
  62. case omap2430:
  63. return 0xcafeb68a; /* ES 2.2 */
  64. case omap3430:
  65. return 0xcafeb7ae; /* ES 2 */
  66. default:
  67. hw_error("%s: Bad mpu model\n", __FUNCTION__);
  68. }
  69. case 0x218: /* DIE_ID_reg */
  70. return ('Q' << 24) | ('E' << 16) | ('M' << 8) | ('U' << 0);
  71. case 0x21c: /* DIE_ID_reg */
  72. return 0x54 << 24;
  73. case 0x220: /* DIE_ID_reg */
  74. return ('Q' << 24) | ('E' << 16) | ('M' << 8) | ('U' << 0);
  75. case 0x224: /* DIE_ID_reg */
  76. return ('Q' << 24) | ('E' << 16) | ('M' << 8) | ('U' << 0);
  77. }
  78. OMAP_BAD_REG(addr);
  79. return 0;
  80. }
  81. static void omap_tap_write(void *opaque, target_phys_addr_t addr,
  82. uint32_t value)
  83. {
  84. OMAP_BAD_REG(addr);
  85. }
  86. static CPUReadMemoryFunc * const omap_tap_readfn[] = {
  87. omap_badwidth_read32,
  88. omap_badwidth_read32,
  89. omap_tap_read,
  90. };
  91. static CPUWriteMemoryFunc * const omap_tap_writefn[] = {
  92. omap_badwidth_write32,
  93. omap_badwidth_write32,
  94. omap_tap_write,
  95. };
  96. void omap_tap_init(struct omap_target_agent_s *ta,
  97. struct omap_mpu_state_s *mpu)
  98. {
  99. omap_l4_attach(ta, 0, l4_register_io_memory(
  100. omap_tap_readfn, omap_tap_writefn, mpu));
  101. }