head-shmobile.S 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * The head-file for SH-Mobile ARM platforms
  3. *
  4. * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  5. * Simon Horman <horms@verge.net.au>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; version 2 of the License.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifdef CONFIG_ZBOOT_ROM
  21. .section ".start", "ax"
  22. /* load board-specific initialization code */
  23. #include <mach/zboot.h>
  24. #if defined(CONFIG_ZBOOT_ROM_MMCIF) || defined(CONFIG_ZBOOT_ROM_SH_MOBILE_SDHI)
  25. /* Load image from MMC/SD */
  26. adr sp, __tmp_stack + 256
  27. ldr r0, __image_start
  28. ldr r1, __image_end
  29. subs r1, r1, r0
  30. ldr r0, __load_base
  31. bl mmc_loader
  32. /* Jump to loaded code */
  33. ldr r0, __loaded
  34. ldr r1, __image_start
  35. sub r0, r0, r1
  36. ldr r1, __load_base
  37. add pc, r0, r1
  38. __image_start:
  39. .long _start
  40. __image_end:
  41. .long _got_end
  42. __load_base:
  43. .long MEMORY_START + 0x02000000 @ Load at 32Mb into SDRAM
  44. __loaded:
  45. .long __continue
  46. .align
  47. __tmp_stack:
  48. .space 256
  49. __continue:
  50. #endif /* CONFIG_ZBOOT_ROM_MMC || CONFIG_ZBOOT_ROM_SH_MOBILE_SDHI */
  51. adr r0, dtb_info
  52. ldmia r0, {r1, r3, r4, r5, r7}
  53. sub r0, r0, r1 @ calculate the delta offset
  54. add r5, r5, r0 @ _edata
  55. ldr lr, [r5, #0] @ check if valid DTB is present
  56. cmp lr, r3
  57. bne 0f
  58. add r9, r7, #31 @ rounded up to a multiple
  59. bic r9, r9, #31 @ ... of 32 bytes
  60. add r6, r9, r5 @ copy from _edata
  61. add r9, r9, r4 @ to MEMORY_START
  62. 1: ldmdb r6!, {r0 - r3, r10 - r12, lr}
  63. cmp r6, r5
  64. stmdb r9!, {r0 - r3, r10 - r12, lr}
  65. bhi 1b
  66. /* Success: Zero board ID, pointer to start of memory for atag/dtb */
  67. mov r7, #0
  68. mov r8, r4
  69. b 2f
  70. .align 2
  71. dtb_info:
  72. .word dtb_info
  73. #ifndef __ARMEB__
  74. .word 0xedfe0dd0 @ sig is 0xd00dfeed big endian
  75. #else
  76. .word 0xd00dfeed
  77. #endif
  78. .word MEMORY_START
  79. .word _edata
  80. .word 0x4000 @ maximum DTB size
  81. 0:
  82. /* Failure: Zero board ID, NULL atag/dtb */
  83. mov r7, #0
  84. mov r8, #0 @ pass null pointer as atag
  85. 2 :
  86. #endif /* CONFIG_ZBOOT_ROM */