proc-arm740.S 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * linux/arch/arm/mm/arm740.S: utility functions for ARM740
  4. *
  5. * Copyright (C) 2004-2006 Hyok S. Choi (hyok.choi@samsung.com)
  6. */
  7. #include <linux/linkage.h>
  8. #include <linux/init.h>
  9. #include <linux/cfi_types.h>
  10. #include <linux/pgtable.h>
  11. #include <asm/assembler.h>
  12. #include <asm/asm-offsets.h>
  13. #include <asm/hwcap.h>
  14. #include <asm/pgtable-hwdef.h>
  15. #include <asm/ptrace.h>
  16. #include "proc-macros.S"
  17. .text
  18. /*
  19. * cpu_arm740_proc_init()
  20. * cpu_arm740_do_idle()
  21. * cpu_arm740_dcache_clean_area()
  22. * cpu_arm740_switch_mm()
  23. *
  24. * These are not required.
  25. */
  26. SYM_TYPED_FUNC_START(cpu_arm740_proc_init)
  27. ret lr
  28. SYM_FUNC_END(cpu_arm740_proc_init)
  29. SYM_TYPED_FUNC_START(cpu_arm740_do_idle)
  30. ret lr
  31. SYM_FUNC_END(cpu_arm740_do_idle)
  32. SYM_TYPED_FUNC_START(cpu_arm740_dcache_clean_area)
  33. ret lr
  34. SYM_FUNC_END(cpu_arm740_dcache_clean_area)
  35. SYM_TYPED_FUNC_START(cpu_arm740_switch_mm)
  36. ret lr
  37. SYM_FUNC_END(cpu_arm740_switch_mm)
  38. /*
  39. * cpu_arm740_proc_fin()
  40. */
  41. SYM_TYPED_FUNC_START(cpu_arm740_proc_fin)
  42. mrc p15, 0, r0, c1, c0, 0
  43. bic r0, r0, #0x3f000000 @ bank/f/lock/s
  44. bic r0, r0, #0x0000000c @ w-buffer/cache
  45. mcr p15, 0, r0, c1, c0, 0 @ disable caches
  46. ret lr
  47. SYM_FUNC_END(cpu_arm740_proc_fin)
  48. /*
  49. * cpu_arm740_reset(loc)
  50. * Params : r0 = address to jump to
  51. * Notes : This sets up everything for a reset
  52. */
  53. .pushsection .idmap.text, "ax"
  54. SYM_TYPED_FUNC_START(cpu_arm740_reset)
  55. mov ip, #0
  56. mcr p15, 0, ip, c7, c0, 0 @ invalidate cache
  57. mrc p15, 0, ip, c1, c0, 0 @ get ctrl register
  58. bic ip, ip, #0x0000000c @ ............wc..
  59. mcr p15, 0, ip, c1, c0, 0 @ ctrl register
  60. ret r0
  61. SYM_FUNC_END(cpu_arm740_reset)
  62. .popsection
  63. .type __arm740_setup, #function
  64. __arm740_setup:
  65. mov r0, #0
  66. mcr p15, 0, r0, c7, c0, 0 @ invalidate caches
  67. mcr p15, 0, r0, c6, c3 @ disable area 3~7
  68. mcr p15, 0, r0, c6, c4
  69. mcr p15, 0, r0, c6, c5
  70. mcr p15, 0, r0, c6, c6
  71. mcr p15, 0, r0, c6, c7
  72. mov r0, #0x0000003F @ base = 0, size = 4GB
  73. mcr p15, 0, r0, c6, c0 @ set area 0, default
  74. ldr r0, =(CONFIG_DRAM_BASE & 0xFFFFF000) @ base[31:12] of RAM
  75. ldr r3, =(CONFIG_DRAM_SIZE >> 12) @ size of RAM (must be >= 4KB)
  76. mov r4, #10 @ 11 is the minimum (4KB)
  77. 1: add r4, r4, #1 @ area size *= 2
  78. movs r3, r3, lsr #1
  79. bne 1b @ count not zero r-shift
  80. orr r0, r0, r4, lsl #1 @ the area register value
  81. orr r0, r0, #1 @ set enable bit
  82. mcr p15, 0, r0, c6, c1 @ set area 1, RAM
  83. ldr r0, =(CONFIG_FLASH_MEM_BASE & 0xFFFFF000) @ base[31:12] of FLASH
  84. ldr r3, =(CONFIG_FLASH_SIZE >> 12) @ size of FLASH (must be >= 4KB)
  85. cmp r3, #0
  86. moveq r0, #0
  87. beq 2f
  88. mov r4, #10 @ 11 is the minimum (4KB)
  89. 1: add r4, r4, #1 @ area size *= 2
  90. movs r3, r3, lsr #1
  91. bne 1b @ count not zero r-shift
  92. orr r0, r0, r4, lsl #1 @ the area register value
  93. orr r0, r0, #1 @ set enable bit
  94. 2: mcr p15, 0, r0, c6, c2 @ set area 2, ROM/FLASH
  95. mov r0, #0x06
  96. mcr p15, 0, r0, c2, c0 @ Region 1&2 cacheable
  97. #ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
  98. mov r0, #0x00 @ disable whole write buffer
  99. #else
  100. mov r0, #0x02 @ Region 1 write bufferred
  101. #endif
  102. mcr p15, 0, r0, c3, c0
  103. mov r0, #0x10000
  104. sub r0, r0, #1 @ r0 = 0xffff
  105. mcr p15, 0, r0, c5, c0 @ all read/write access
  106. mrc p15, 0, r0, c1, c0 @ get control register
  107. bic r0, r0, #0x3F000000 @ set to standard caching mode
  108. @ need some benchmark
  109. orr r0, r0, #0x0000000d @ MPU/Cache/WB
  110. ret lr
  111. .size __arm740_setup, . - __arm740_setup
  112. __INITDATA
  113. @ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
  114. define_processor_functions arm740, dabort=v4t_late_abort, pabort=legacy_pabort, nommu=1
  115. .section ".rodata"
  116. string cpu_arch_name, "armv4"
  117. string cpu_elf_name, "v4"
  118. string cpu_arm740_name, "ARM740T"
  119. .align
  120. .section ".proc.info.init", "a"
  121. .type __arm740_proc_info,#object
  122. __arm740_proc_info:
  123. .long 0x41807400
  124. .long 0xfffffff0
  125. .long 0
  126. .long 0
  127. initfn __arm740_setup, __arm740_proc_info
  128. .long cpu_arch_name
  129. .long cpu_elf_name
  130. .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB | HWCAP_26BIT
  131. .long cpu_arm740_name
  132. .long arm740_processor_functions
  133. .long 0
  134. .long 0
  135. .long v4_cache_fns @ cache model
  136. .size __arm740_proc_info, . - __arm740_proc_info