lowlevel_init.S 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Memory Setup stuff - taken from blob memsetup.S
  3. *
  4. * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) and
  5. * Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
  6. * 2003-2004 (c) MontaVista Software, Inc.
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of
  14. * the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  24. * MA 02111-1307 USA
  25. */
  26. #include "config.h"
  27. #include "version.h"
  28. .globl lowlevel_init
  29. lowlevel_init:
  30. /* The ADS GC+ for Linux Boot Rom Ver. 1.73 does memory init for us.
  31. * However the darn thing leaves the MMU enabled before handing control
  32. * over to us. So we need to disable the MMU and we use lowlevel_init
  33. * to do it.
  34. */
  35. @ The following code segment was borrowed with gratitude from:
  36. @ linux-2.4.19-rmk7/arch/arm/boot/compressed/head-sa1100.S
  37. @ Data cache might be active.
  38. @ Be sure to flush kernel binary out of the cache,
  39. @ whatever state it is, before it is turned off.
  40. @ This is done by fetching through currently executed
  41. @ memory to be sure we hit the same cache.
  42. bic r2, pc, #0x1f
  43. add r3, r2, #0x4000 @ 16 kb is quite enough...
  44. 1: ldr r0, [r2], #32
  45. teq r2, r3
  46. bne 1b
  47. mcr p15, 0, r0, c7, c10, 4 @ drain WB
  48. mcr p15, 0, r0, c7, c7, 0 @ flush I & D caches
  49. @ disabling MMU and caches
  50. mrc p15, 0, r0, c1, c0, 0 @ read control reg
  51. bic r0, r0, #0x0d @ clear WB, DC, MMU
  52. bic r0, r0, #0x1000 @ clear Icache
  53. mcr p15, 0, r0, c1, c0, 0
  54. nop
  55. nop
  56. nop
  57. nop
  58. nop
  59. b 2f
  60. 2:
  61. nop
  62. nop
  63. nop
  64. nop
  65. nop
  66. mov pc, lr