mx7ulp_plugin.S 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright 2019 NXP
  4. */
  5. #include <config.h>
  6. #define ROM_API_TABLE_BASE_ADDR_LEGACY 0x180
  7. #define ROM_VERSION_OFFSET 0x80
  8. #define ROM_API_HWCNFG_SETUP_OFFSET 0x08
  9. plugin_start:
  10. push {r0-r4, lr}
  11. imx7ulp_ddr_setting
  12. imx7ulp_clock_gating
  13. imx7ulp_qos_setting
  14. normal_boot:
  15. /*
  16. * The following is to fill in those arguments for this ROM function
  17. * pu_irom_hwcnfg_setup(void **start, size_t *bytes, const void *boot_data)
  18. * This function is used to copy data from the storage media into DDR.
  19. * start - Initial (possibly partial) image load address on entry.
  20. * Final image load address on exit.
  21. * bytes - Initial (possibly partial) image size on entry.
  22. * Final image size on exit.
  23. * boot_data - Initial @ref ivt Boot Data load address.
  24. */
  25. adr r0, boot_data2
  26. adr r1, image_len2
  27. adr r2, boot_data2
  28. /*
  29. * check the _pu_irom_api_table for the address
  30. */
  31. before_calling_rom___pu_irom_hwcnfg_setup:
  32. ldr r3, =ROM_VERSION_OFFSET
  33. ldr r4, [r3]
  34. ldr r3, =ROM_API_TABLE_BASE_ADDR_LEGACY
  35. ldr r4, [r3, #ROM_API_HWCNFG_SETUP_OFFSET]
  36. blx r4
  37. after_calling_rom___pu_irom_hwcnfg_setup:
  38. /*
  39. * To return to ROM from plugin, we need to fill in these argument.
  40. * Here is what need to do:
  41. * Need to construct the parameters for this function before return to ROM:
  42. * plugin_download(void **start, size_t *bytes, UINT32 *ivt_offset)
  43. */
  44. pop {r0-r4, lr}
  45. push {r5}
  46. ldr r5, boot_data2
  47. str r5, [r0]
  48. ldr r5, image_len2
  49. str r5, [r1]
  50. ldr r5, second_ivt_offset
  51. str r5, [r2]
  52. mov r0, #1
  53. pop {r5}
  54. /* return back to ROM code */
  55. bx lr
  56. /* make the following data right in the end of the output*/
  57. .ltorg
  58. #define FLASH_OFFSET 0x400
  59. /*
  60. * second_ivt_offset is the offset from the "second_ivt_header" to
  61. * "image_copy_start", which involves FLASH_OFFSET, plus the first
  62. * ivt_header, the plugin code size itself recorded by "ivt2_header"
  63. */
  64. second_ivt_offset: .long (ivt2_header + 0x2C + FLASH_OFFSET)
  65. /*
  66. * The following is the second IVT header plus the second boot data
  67. */
  68. ivt2_header: .long 0x0
  69. app2_code_jump_v: .long 0x0
  70. reserv3: .long 0x0
  71. dcd2_ptr: .long 0x0
  72. boot_data2_ptr: .long 0x0
  73. self_ptr2: .long 0x0
  74. app_code_csf2: .long 0x0
  75. reserv4: .long 0x0
  76. boot_data2: .long 0x0
  77. image_len2: .long 0x0
  78. plugin2: .long 0x0