cpu_setup_fsl_booke.S 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. #ifdef CONFIG_FSL_RIO
  64. /* Ensure that RFXE is set */
  65. mfspr r3,SPRN_HID1
  66. oris r3,r3,HID1_RFXE@h
  67. mtspr SPRN_HID1,r3
  68. #endif
  69. mtlr r4
  70. blr
  71. _GLOBAL(__setup_cpu_e500mc)
  72. mflr r4
  73. bl __e500_icache_setup
  74. bl __e500_dcache_setup
  75. bl __setup_e500mc_ivors
  76. mtlr r4
  77. blr
  78. #endif
  79. /* Right now, restore and setup are the same thing */
  80. _GLOBAL(__restore_cpu_e5500)
  81. _GLOBAL(__setup_cpu_e5500)
  82. mflr r4
  83. bl __e500_icache_setup
  84. bl __e500_dcache_setup
  85. #ifdef CONFIG_PPC_BOOK3E_64
  86. bl .__setup_base_ivors
  87. bl .setup_perfmon_ivor
  88. bl .setup_doorbell_ivors
  89. bl .setup_ehv_ivors
  90. #else
  91. bl __setup_e500mc_ivors
  92. #endif
  93. mtlr r4
  94. blr