cpu_setup_fsl_booke.S 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * This file contains low level CPU setup functions.
  3. * Kumar Gala <galak@kernel.crashing.org>
  4. * Copyright 2009 Freescale Semiconductor, Inc.
  5. *
  6. * Based on cpu_setup_6xx code by
  7. * Benjamin Herrenschmidt <benh@kernel.crashing.org>
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version
  12. * 2 of the License, or (at your option) any later version.
  13. *
  14. */
  15. #include <asm/processor.h>
  16. #include <asm/cputable.h>
  17. #include <asm/ppc_asm.h>
  18. _GLOBAL(__e500_icache_setup)
  19. mfspr r0, SPRN_L1CSR1
  20. andi. r3, r0, L1CSR1_ICE
  21. bnelr /* Already enabled */
  22. oris r0, r0, L1CSR1_CPE@h
  23. ori r0, r0, (L1CSR1_ICFI | L1CSR1_ICLFR | L1CSR1_ICE)
  24. mtspr SPRN_L1CSR1, r0 /* Enable I-Cache */
  25. isync
  26. blr
  27. _GLOBAL(__e500_dcache_setup)
  28. mfspr r0, SPRN_L1CSR0
  29. andi. r3, r0, L1CSR0_DCE
  30. bnelr /* Already enabled */
  31. msync
  32. isync
  33. li r0, 0
  34. mtspr SPRN_L1CSR0, r0 /* Disable */
  35. msync
  36. isync
  37. li r0, (L1CSR0_DCFI | L1CSR0_CLFC)
  38. mtspr SPRN_L1CSR0, r0 /* Invalidate */
  39. isync
  40. 1: mfspr r0, SPRN_L1CSR0
  41. andi. r3, r0, L1CSR0_CLFC
  42. bne+ 1b /* Wait for lock bits reset */
  43. oris r0, r0, L1CSR0_CPE@h
  44. ori r0, r0, L1CSR0_DCE
  45. msync
  46. isync
  47. mtspr SPRN_L1CSR0, r0 /* Enable */
  48. isync
  49. blr
  50. #ifdef CONFIG_PPC32
  51. _GLOBAL(__setup_cpu_e200)
  52. /* enable dedicated debug exception handling resources (Debug APU) */
  53. mfspr r3,SPRN_HID0
  54. ori r3,r3,HID0_DAPUEN@l
  55. mtspr SPRN_HID0,r3
  56. b __setup_e200_ivors
  57. _GLOBAL(__setup_cpu_e500v1)
  58. _GLOBAL(__setup_cpu_e500v2)
  59. mflr r4
  60. bl __e500_icache_setup
  61. bl __e500_dcache_setup
  62. bl __setup_e500_ivors
  63. mtlr r4
  64. blr
  65. _GLOBAL(__setup_cpu_e500mc)
  66. mflr r4
  67. bl __e500_icache_setup
  68. bl __e500_dcache_setup
  69. bl __setup_e500mc_ivors
  70. mtlr r4
  71. blr
  72. #endif
  73. /* Right now, restore and setup are the same thing */
  74. _GLOBAL(__restore_cpu_e5500)
  75. _GLOBAL(__setup_cpu_e5500)
  76. mflr r4
  77. bl __e500_icache_setup
  78. bl __e500_dcache_setup
  79. #ifdef CONFIG_PPC_BOOK3E_64
  80. bl .__setup_base_ivors
  81. #else
  82. bl __setup_e500mc_ivors
  83. #endif
  84. mtlr r4
  85. blr