proc-arm740.S 3.9 KB

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