Commit 035167cb authored by Jens Kuske's avatar Jens Kuske Committed by Siarhei Siamashka
Browse files

fel: only read MMU control registers if MMU is enabled



This workaround is necessary for A80, which sometimes
fails at reading DACR.
Signed-off-by: default avatarJens Kuske <jenskuske@gmail.com>
Reviewed-by: default avatarSiarhei Siamashka <siarhei.siamashka@gmail.com>
parent 472ac475
...@@ -767,10 +767,7 @@ uint32_t *aw_backup_and_disable_mmu(libusb_device_handle *usb, ...@@ -767,10 +767,7 @@ uint32_t *aw_backup_and_disable_mmu(libusb_device_handle *usb,
soc_sram_info *sram_info) soc_sram_info *sram_info)
{ {
uint32_t *tt = NULL; uint32_t *tt = NULL;
uint32_t ttbr0 = aw_get_ttbr0(usb, sram_info); uint32_t sctlr, ttbr0, ttbcr, dacr;
uint32_t sctlr = aw_get_sctlr(usb, sram_info);
uint32_t ttbcr = aw_get_ttbcr(usb, sram_info);
uint32_t dacr = aw_get_dacr(usb, sram_info);
uint32_t i; uint32_t i;
uint32_t arm_code[] = { uint32_t arm_code[] = {
...@@ -796,6 +793,7 @@ uint32_t *aw_backup_and_disable_mmu(libusb_device_handle *usb, ...@@ -796,6 +793,7 @@ uint32_t *aw_backup_and_disable_mmu(libusb_device_handle *usb,
*/ */
/* Basically, ignore M/Z/I bits and expect no TEX remap */ /* Basically, ignore M/Z/I bits and expect no TEX remap */
sctlr = aw_get_sctlr(usb, sram_info);
if ((sctlr & ~((1 << 12) | (1 << 11) | 1)) != 0x00C52078) { if ((sctlr & ~((1 << 12) | (1 << 11) | 1)) != 0x00C52078) {
fprintf(stderr, "Unexpected SCTLR (%08X)\n", sctlr); fprintf(stderr, "Unexpected SCTLR (%08X)\n", sctlr);
exit(1); exit(1);
...@@ -806,16 +804,19 @@ uint32_t *aw_backup_and_disable_mmu(libusb_device_handle *usb, ...@@ -806,16 +804,19 @@ uint32_t *aw_backup_and_disable_mmu(libusb_device_handle *usb,
return NULL; return NULL;
} }
dacr = aw_get_dacr(usb, sram_info);
if (dacr != 0x55555555) { if (dacr != 0x55555555) {
fprintf(stderr, "Unexpected DACR (%08X)\n", dacr); fprintf(stderr, "Unexpected DACR (%08X)\n", dacr);
exit(1); exit(1);
} }
ttbcr = aw_get_ttbcr(usb, sram_info);
if (ttbcr != 0x00000000) { if (ttbcr != 0x00000000) {
fprintf(stderr, "Unexpected TTBCR (%08X)\n", ttbcr); fprintf(stderr, "Unexpected TTBCR (%08X)\n", ttbcr);
exit(1); exit(1);
} }
ttbr0 = aw_get_ttbr0(usb, sram_info);
if (ttbr0 & 0x3FFF) { if (ttbr0 & 0x3FFF) {
fprintf(stderr, "Unexpected TTBR0 (%08X)\n", ttbr0); fprintf(stderr, "Unexpected TTBR0 (%08X)\n", ttbr0);
exit(1); exit(1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment