mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-09 12:13:00 -04:00
mpc83xx: clean up cache operations and unlock_ram_in_cache() functions
Cleans up some latent issues with the data cache control so that dcache_enable() and dcache_disable() will work reliably (after unlock_ram_in_cache() has been called) Signed-off-by: Nick Spence <nick.spence@freescale.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
This commit is contained in:
parent
46497056ae
commit
6eb2a44e27
@ -208,7 +208,7 @@ in_flash:
|
|||||||
bl enable_addr_trans
|
bl enable_addr_trans
|
||||||
sync
|
sync
|
||||||
|
|
||||||
/* enable and invalidate the data cache */
|
/* enable the data cache */
|
||||||
bl dcache_enable
|
bl dcache_enable
|
||||||
sync
|
sync
|
||||||
#ifdef CFG_INIT_RAM_LOCK
|
#ifdef CFG_INIT_RAM_LOCK
|
||||||
@ -496,15 +496,16 @@ init_e300_core: /* time t 10 */
|
|||||||
|
|
||||||
/* Initialize the Hardware Implementation-dependent Registers */
|
/* Initialize the Hardware Implementation-dependent Registers */
|
||||||
/* HID0 also contains cache control */
|
/* HID0 also contains cache control */
|
||||||
|
/* - force invalidation of data and instruction caches */
|
||||||
/*------------------------------------------------------*/
|
/*------------------------------------------------------*/
|
||||||
|
|
||||||
lis r3, CFG_HID0_INIT@h
|
lis r3, CFG_HID0_INIT@h
|
||||||
ori r3, r3, CFG_HID0_INIT@l
|
ori r3, r3, (CFG_HID0_INIT | HID0_ICFI | HID0_DCFI)@l
|
||||||
SYNC
|
SYNC
|
||||||
mtspr HID0, r3
|
mtspr HID0, r3
|
||||||
|
|
||||||
lis r3, CFG_HID0_FINAL@h
|
lis r3, CFG_HID0_FINAL@h
|
||||||
ori r3, r3, CFG_HID0_FINAL@l
|
ori r3, r3, (CFG_HID0_FINAL & ~(HID0_ICFI | HID0_DCFI))@l
|
||||||
SYNC
|
SYNC
|
||||||
mtspr HID0, r3
|
mtspr HID0, r3
|
||||||
|
|
||||||
@ -714,8 +715,7 @@ disable_addr_trans:
|
|||||||
icache_enable:
|
icache_enable:
|
||||||
mfspr r3, HID0
|
mfspr r3, HID0
|
||||||
ori r3, r3, HID0_ICE
|
ori r3, r3, HID0_ICE
|
||||||
lis r4, 0
|
li r4, HID0_ICFI|HID0_ILOCK
|
||||||
ori r4, r4, HID0_ILOCK
|
|
||||||
andc r3, r3, r4
|
andc r3, r3, r4
|
||||||
ori r4, r3, HID0_ICFI
|
ori r4, r3, HID0_ICFI
|
||||||
isync
|
isync
|
||||||
@ -728,13 +728,10 @@ icache_enable:
|
|||||||
icache_disable:
|
icache_disable:
|
||||||
mfspr r3, HID0
|
mfspr r3, HID0
|
||||||
lis r4, 0
|
lis r4, 0
|
||||||
ori r4, r4, HID0_ICE|HID0_ILOCK
|
ori r4, r4, HID0_ICE|HID0_ICFI|HID0_ILOCK
|
||||||
andc r3, r3, r4
|
andc r3, r3, r4
|
||||||
ori r4, r3, HID0_ICFI
|
|
||||||
isync
|
isync
|
||||||
mtspr HID0, r4 /* sets invalidate, clears enable and lock*/
|
mtspr HID0, r3 /* clears invalidate, enable and lock */
|
||||||
isync
|
|
||||||
mtspr HID0, r3 /* clears invalidate */
|
|
||||||
blr
|
blr
|
||||||
|
|
||||||
.globl icache_status
|
.globl icache_status
|
||||||
@ -748,25 +745,24 @@ dcache_enable:
|
|||||||
mfspr r3, HID0
|
mfspr r3, HID0
|
||||||
li r5, HID0_DCFI|HID0_DLOCK
|
li r5, HID0_DCFI|HID0_DLOCK
|
||||||
andc r3, r3, r5
|
andc r3, r3, r5
|
||||||
mtspr HID0, r3 /* no invalidate, unlock */
|
|
||||||
ori r3, r3, HID0_DCE
|
ori r3, r3, HID0_DCE
|
||||||
ori r5, r3, HID0_DCFI
|
|
||||||
mtspr HID0, r5 /* enable + invalidate */
|
|
||||||
mtspr HID0, r3 /* enable */
|
|
||||||
sync
|
sync
|
||||||
|
mtspr HID0, r3 /* enable, no invalidate */
|
||||||
blr
|
blr
|
||||||
|
|
||||||
.globl dcache_disable
|
.globl dcache_disable
|
||||||
dcache_disable:
|
dcache_disable:
|
||||||
|
mflr r4
|
||||||
|
bl flush_dcache /* uses r3 and r5 */
|
||||||
mfspr r3, HID0
|
mfspr r3, HID0
|
||||||
lis r4, 0
|
li r5, HID0_DCE|HID0_DLOCK
|
||||||
ori r4, r4, HID0_DCE|HID0_DLOCK
|
andc r3, r3, r5
|
||||||
andc r3, r3, r4
|
ori r5, r3, HID0_DCFI
|
||||||
ori r4, r3, HID0_DCI
|
|
||||||
sync
|
sync
|
||||||
mtspr HID0, r4 /* sets invalidate, clears enable and lock */
|
mtspr HID0, r5 /* sets invalidate, clears enable and lock */
|
||||||
sync
|
sync
|
||||||
mtspr HID0, r3 /* clears invalidate */
|
mtspr HID0, r3 /* clears invalidate */
|
||||||
|
mtlr r4
|
||||||
blr
|
blr
|
||||||
|
|
||||||
.globl dcache_status
|
.globl dcache_status
|
||||||
@ -775,6 +771,18 @@ dcache_status:
|
|||||||
rlwinm r3, r3, (31 - HID0_DCE_SHIFT + 1), 31, 31
|
rlwinm r3, r3, (31 - HID0_DCE_SHIFT + 1), 31, 31
|
||||||
blr
|
blr
|
||||||
|
|
||||||
|
.globl flush_dcache
|
||||||
|
flush_dcache:
|
||||||
|
lis r3, 0
|
||||||
|
lis r5, CFG_CACHELINE_SIZE
|
||||||
|
1: cmp 0, 1, r3, r5
|
||||||
|
bge 2f
|
||||||
|
lwz r5, 0(r3)
|
||||||
|
lis r5, CFG_CACHELINE_SIZE
|
||||||
|
addi r3, r3, 0x4
|
||||||
|
b 1b
|
||||||
|
2: blr
|
||||||
|
|
||||||
.globl get_pvr
|
.globl get_pvr
|
||||||
get_pvr:
|
get_pvr:
|
||||||
mfspr r3, PVR
|
mfspr r3, PVR
|
||||||
@ -1081,7 +1089,7 @@ lock_ram_in_cache:
|
|||||||
|
|
||||||
/* Lock the data cache */
|
/* Lock the data cache */
|
||||||
mfspr r0, HID0
|
mfspr r0, HID0
|
||||||
ori r0, r0, 0x1000
|
ori r0, r0, HID0_DLOCK
|
||||||
sync
|
sync
|
||||||
mtspr HID0, r0
|
mtspr HID0, r0
|
||||||
sync
|
sync
|
||||||
@ -1108,9 +1116,10 @@ unlock_ram_in_cache:
|
|||||||
li r5, HID0_DLOCK|HID0_DCFI
|
li r5, HID0_DLOCK|HID0_DCFI
|
||||||
andc r3, r3, r5 /* no invalidate, unlock */
|
andc r3, r3, r5 /* no invalidate, unlock */
|
||||||
ori r5, r3, HID0_DCFI /* invalidate, unlock */
|
ori r5, r3, HID0_DCFI /* invalidate, unlock */
|
||||||
mtspr HID0, r5 /* invalidate, unlock */
|
|
||||||
mtspr HID0, r3 /* no invalidate, unlock */
|
|
||||||
sync
|
sync
|
||||||
|
mtspr HID0, r5 /* invalidate, unlock */
|
||||||
|
sync
|
||||||
|
mtspr HID0, r3 /* no invalidate, unlock */
|
||||||
blr
|
blr
|
||||||
#endif /* !CONFIG_NAND_SPL */
|
#endif /* !CONFIG_NAND_SPL */
|
||||||
#endif /* CFG_INIT_RAM_LOCK */
|
#endif /* CFG_INIT_RAM_LOCK */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user