diff options
author | Will Deacon <will.deacon@arm.com> | 2013-01-22 05:37:51 -0500 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2013-03-26 05:55:33 -0400 |
commit | 3ef52f2a00efc5f83ae6d40e55cae96ce275893f (patch) | |
tree | 176effeb48436fda5f89a2dc7999d4289428eaab | |
parent | 82d9b0d0c6c4cbd5d0022d7df5e6bf071a9eb6c7 (diff) |
ARM: mm: fix numerous hideous errors in proc-arm740.S
The setup code in proc-arm740.S is completely broken and, as far as I
can tell, always has been. I was >this< close to ripping it out, when a
740t core-tile materialised in the office, so I've had a crack at fixing
things up:
- Fix the ram/flash area calculations so that we actually set
the condition flags before testing them...
- Fix the proc_info structure so that __cpu_io_mmu_flags are
defined as 0, placing the __cpu_flush pointer at the correct
offset
- Re-number the registers used during __arm740_setup so that
we don't clobber the machine ID et al
- Advertise Thumb support via the hwcaps, since 740T is the only
740 implementation.
Acked-by: Hyok S. Choi <hyok.choi@samsung.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r-- | arch/arm/mm/proc-arm740.S | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/arch/arm/mm/proc-arm740.S b/arch/arm/mm/proc-arm740.S index 2088234978c4..fde2d2a794cf 100644 --- a/arch/arm/mm/proc-arm740.S +++ b/arch/arm/mm/proc-arm740.S | |||
@@ -77,24 +77,27 @@ __arm740_setup: | |||
77 | mcr p15, 0, r0, c6, c0 @ set area 0, default | 77 | mcr p15, 0, r0, c6, c0 @ set area 0, default |
78 | 78 | ||
79 | ldr r0, =(CONFIG_DRAM_BASE & 0xFFFFF000) @ base[31:12] of RAM | 79 | ldr r0, =(CONFIG_DRAM_BASE & 0xFFFFF000) @ base[31:12] of RAM |
80 | ldr r1, =(CONFIG_DRAM_SIZE >> 12) @ size of RAM (must be >= 4KB) | 80 | ldr r3, =(CONFIG_DRAM_SIZE >> 12) @ size of RAM (must be >= 4KB) |
81 | mov r2, #10 @ 11 is the minimum (4KB) | 81 | mov r4, #10 @ 11 is the minimum (4KB) |
82 | 1: add r2, r2, #1 @ area size *= 2 | 82 | 1: add r4, r4, #1 @ area size *= 2 |
83 | mov r1, r1, lsr #1 | 83 | movs r3, r3, lsr #1 |
84 | bne 1b @ count not zero r-shift | 84 | bne 1b @ count not zero r-shift |
85 | orr r0, r0, r2, lsl #1 @ the area register value | 85 | orr r0, r0, r4, lsl #1 @ the area register value |
86 | orr r0, r0, #1 @ set enable bit | 86 | orr r0, r0, #1 @ set enable bit |
87 | mcr p15, 0, r0, c6, c1 @ set area 1, RAM | 87 | mcr p15, 0, r0, c6, c1 @ set area 1, RAM |
88 | 88 | ||
89 | ldr r0, =(CONFIG_FLASH_MEM_BASE & 0xFFFFF000) @ base[31:12] of FLASH | 89 | ldr r0, =(CONFIG_FLASH_MEM_BASE & 0xFFFFF000) @ base[31:12] of FLASH |
90 | ldr r1, =(CONFIG_FLASH_SIZE >> 12) @ size of FLASH (must be >= 4KB) | 90 | ldr r3, =(CONFIG_FLASH_SIZE >> 12) @ size of FLASH (must be >= 4KB) |
91 | mov r2, #10 @ 11 is the minimum (4KB) | 91 | cmp r3, #0 |
92 | 1: add r2, r2, #1 @ area size *= 2 | 92 | moveq r0, #0 |
93 | mov r1, r1, lsr #1 | 93 | beq 2f |
94 | mov r4, #10 @ 11 is the minimum (4KB) | ||
95 | 1: add r4, r4, #1 @ area size *= 2 | ||
96 | movs r3, r3, lsr #1 | ||
94 | bne 1b @ count not zero r-shift | 97 | bne 1b @ count not zero r-shift |
95 | orr r0, r0, r2, lsl #1 @ the area register value | 98 | orr r0, r0, r4, lsl #1 @ the area register value |
96 | orr r0, r0, #1 @ set enable bit | 99 | orr r0, r0, #1 @ set enable bit |
97 | mcr p15, 0, r0, c6, c2 @ set area 2, ROM/FLASH | 100 | 2: mcr p15, 0, r0, c6, c2 @ set area 2, ROM/FLASH |
98 | 101 | ||
99 | mov r0, #0x06 | 102 | mov r0, #0x06 |
100 | mcr p15, 0, r0, c2, c0 @ Region 1&2 cacheable | 103 | mcr p15, 0, r0, c2, c0 @ Region 1&2 cacheable |
@@ -137,10 +140,11 @@ __arm740_proc_info: | |||
137 | .long 0x41807400 | 140 | .long 0x41807400 |
138 | .long 0xfffffff0 | 141 | .long 0xfffffff0 |
139 | .long 0 | 142 | .long 0 |
143 | .long 0 | ||
140 | b __arm740_setup | 144 | b __arm740_setup |
141 | .long cpu_arch_name | 145 | .long cpu_arch_name |
142 | .long cpu_elf_name | 146 | .long cpu_elf_name |
143 | .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT | 147 | .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB | HWCAP_26BIT |
144 | .long cpu_arm740_name | 148 | .long cpu_arm740_name |
145 | .long arm740_processor_functions | 149 | .long arm740_processor_functions |
146 | .long 0 | 150 | .long 0 |