300-ARM-BCM5301X-Disable-MMU-and-Dcache-for-decompression.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. From: Florian Fainelli <f.fainelli@gmail.com>
  2. Subject: [PATCH] ARM: BCM5301x: Disable MMU and Dcache during decompression
  3. Date: Tue, 14 Jul 2015 16:12:08 -0700
  4. Use the existing __armv7_mmu_cache_flush() to perform the cache flush
  5. since this does what we are after.
  6. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
  7. ---
  8. arch/arm/boot/compressed/Makefile | 4 +++
  9. arch/arm/boot/compressed/head-bcm_5301x-mpcore.S | 37 ++++++++++++++++++++++++
  10. arch/arm/boot/compressed/head.S | 2 ++
  11. 3 files changed, 43 insertions(+)
  12. create mode 100644 arch/arm/boot/compressed/head-bcm_5301x-mpcore.S
  13. --- a/arch/arm/boot/compressed/Makefile
  14. +++ b/arch/arm/boot/compressed/Makefile
  15. @@ -31,6 +31,10 @@ ifeq ($(CONFIG_ARCH_ACORN),y)
  16. OBJS += ll_char_wr.o font.o
  17. endif
  18. +ifeq ($(CONFIG_ARCH_BCM_5301X),y)
  19. +OBJS += head-bcm_5301x-mpcore.o
  20. +endif
  21. +
  22. ifeq ($(CONFIG_ARCH_SA1100),y)
  23. OBJS += head-sa1100.o
  24. endif
  25. --- /dev/null
  26. +++ b/arch/arm/boot/compressed/head-bcm_5301x-mpcore.S
  27. @@ -0,0 +1,37 @@
  28. +/*
  29. + *
  30. + * Platform specific tweaks. This is merged into head.S by the linker.
  31. + *
  32. + */
  33. +
  34. +#include <linux/linkage.h>
  35. +#include <asm/assembler.h>
  36. +#include <asm/cp15.h>
  37. +
  38. + .section ".start", "ax"
  39. +
  40. +/*
  41. + * This code section is spliced into the head code by the linker
  42. + */
  43. +
  44. +__plat_uncompress_start:
  45. +
  46. + @ Preserve r8/r7 i.e. kernel entry values
  47. + mov r12, r8
  48. +
  49. + @ Clear MMU enable and Dcache enable bits
  50. + mrc p15, 0, r0, c1, c0, 0 @ Read SCTLR
  51. + bic r0, #CR_C|CR_M
  52. + mcr p15, 0, r0, c1, c0, 0 @ Write SCTLR
  53. + nop
  54. +
  55. + @ Call the cache invalidation routine
  56. + bl __armv7_mmu_cache_flush_fn
  57. + nop
  58. + mov r0,#0
  59. + ldr r3, =0x19022000 @ L2 cache controller, control reg
  60. + str r0, [r3, #0x100] @ Disable L2 cache
  61. + nop
  62. +
  63. + @ Restore
  64. + mov r8, r12
  65. --- a/arch/arm/boot/compressed/head.S
  66. +++ b/arch/arm/boot/compressed/head.S
  67. @@ -1152,6 +1152,7 @@ __armv7_mmu_cache_flush:
  68. hierarchical:
  69. mcr p15, 0, r10, c7, c10, 5 @ DMB
  70. stmfd sp!, {r0-r7, r9-r11}
  71. +ENTRY(__armv7_mmu_cache_flush_fn)
  72. mrc p15, 1, r0, c0, c0, 1 @ read clidr
  73. ands r3, r0, #0x7000000 @ extract loc from clidr
  74. mov r3, r3, lsr #23 @ left align loc bit field
  75. @@ -1201,6 +1202,7 @@ iflush:
  76. mcr p15, 0, r10, c7, c10, 4 @ DSB
  77. mcr p15, 0, r10, c7, c5, 4 @ ISB
  78. mov pc, lr
  79. +ENDPROC(__armv7_mmu_cache_flush_fn)
  80. __armv5tej_mmu_cache_flush:
  81. tst r4, #1