setup.S 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*
  2. * linux/arch/m32r/boot/setup.S -- A setup code.
  3. *
  4. * Copyright (C) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata,
  5. * and Hitoshi Yamamoto
  6. *
  7. */
  8. /* $Id$ */
  9. #include <linux/linkage.h>
  10. #include <asm/segment.h>
  11. #include <asm/page.h>
  12. #include <asm/pgtable.h>
  13. #include <linux/config.h>
  14. #include <asm/assembler.h>
  15. #include <asm/mmu_context.h>
  16. #include <asm/m32r.h>
  17. /*
  18. * References to members of the boot_cpu_data structure.
  19. */
  20. #define CPU_PARAMS boot_cpu_data
  21. #define M32R_MCICAR 0xfffffff0
  22. #define M32R_MCDCAR 0xfffffff4
  23. #define M32R_MCCR 0xfffffffc
  24. #define M32R_BSCR0 0xffffffd2
  25. ;BSEL
  26. #define BSEL0CR0 0x00ef5000
  27. #define BSEL0CR1 0x00ef5004
  28. #define BSEL1CR0 0x00ef5100
  29. #define BSEL1CR1 0x00ef5104
  30. #define BSEL0CR0_VAL 0x00000000
  31. #define BSEL0CR1_VAL 0x01200100
  32. #define BSEL1CR0_VAL 0x01018000
  33. #define BSEL1CR1_VAL 0x00200001
  34. ;SDRAMC
  35. #define SDRAMC_SDRF0 0x00ef6000
  36. #define SDRAMC_SDRF1 0x00ef6004
  37. #define SDRAMC_SDIR0 0x00ef6008
  38. #define SDRAMC_SDIR1 0x00ef600c
  39. #define SDRAMC_SD0ADR 0x00ef6020
  40. #define SDRAMC_SD0ER 0x00ef6024
  41. #define SDRAMC_SD0TR 0x00ef6028
  42. #define SDRAMC_SD0MOD 0x00ef602c
  43. #define SDRAMC_SD1ADR 0x00ef6040
  44. #define SDRAMC_SD1ER 0x00ef6044
  45. #define SDRAMC_SD1TR 0x00ef6048
  46. #define SDRAMC_SD1MOD 0x00ef604c
  47. #define SDRAM0 0x18000000
  48. #define SDRAM1 0x1c000000
  49. /*------------------------------------------------------------------------
  50. * start up
  51. */
  52. /*------------------------------------------------------------------------
  53. * Kernel entry
  54. */
  55. .section .boot, "ax"
  56. ENTRY(boot)
  57. /* Set cache mode */
  58. #if defined(CONFIG_CHIP_XNUX2)
  59. ldi r0, #-2 ;LDIMM (r0, M32R_MCCR)
  60. ldi r1, #0x0101 ; cache on (with invalidation)
  61. ; ldi r1, #0x00 ; cache off
  62. sth r1, @r0
  63. #elif defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_VDEC2) \
  64. || defined(CONFIG_CHIP_OPSP)
  65. ldi r0, #-4 ;LDIMM (r0, M32R_MCCR)
  66. ldi r1, #0x73 ; cache on (with invalidation)
  67. ; ldi r1, #0x00 ; cache off
  68. st r1, @r0
  69. #elif defined(CONFIG_CHIP_M32102)
  70. ldi r0, #-4 ;LDIMM (r0, M32R_MCCR)
  71. ldi r1, #0x101 ; cache on (with invalidation)
  72. ; ldi r1, #0x00 ; cache off
  73. st r1, @r0
  74. #else
  75. #error unknown chip configuration
  76. #endif
  77. #ifdef CONFIG_SMP
  78. ;; if not BSP (CPU#0) goto AP_loop
  79. seth r5, #shigh(M32R_CPUID_PORTL)
  80. ld r5, @(low(M32R_CPUID_PORTL), r5)
  81. bnez r5, AP_loop
  82. #if !defined(CONFIG_PLAT_USRV)
  83. ;; boot AP
  84. ld24 r5, #0xeff2f8 ; IPICR7
  85. ldi r6, #0x2 ; IPI to CPU1
  86. st r6, @r5
  87. #endif
  88. #endif
  89. /*
  90. * Now, Jump to stext
  91. * if with MMU, TLB on.
  92. * if with no MMU, only jump.
  93. */
  94. .global eit_vector
  95. mmu_on:
  96. LDIMM (r13, stext)
  97. #ifdef CONFIG_MMU
  98. bl init_tlb
  99. LDIMM (r2, eit_vector) ; set EVB(cr5)
  100. mvtc r2, cr5
  101. seth r0, #high(MMU_REG_BASE) ; Set MMU_REG_BASE higher
  102. or3 r0, r0, #low(MMU_REG_BASE) ; Set MMU_REG_BASE lower
  103. ldi r1, #0x01
  104. st r1, @(MATM_offset,r0) ; Set MATM (T bit ON)
  105. ld r0, @(MATM_offset,r0) ; Check
  106. #else
  107. seth r0,#high(M32R_MCDCAR)
  108. or3 r0,r0,#low(M32R_MCDCAR)
  109. ld24 r1,#0x8080
  110. st r1,@r0
  111. #endif /* CONFIG_MMU */
  112. jmp r13
  113. nop
  114. nop
  115. #ifdef CONFIG_SMP
  116. /*
  117. * AP wait loop
  118. */
  119. ENTRY(AP_loop)
  120. ;; disable interrupt
  121. clrpsw #0x40
  122. ;; reset EVB
  123. LDIMM (r4, _AP_RE)
  124. seth r5, #high(__PAGE_OFFSET)
  125. or3 r5, r5, #low(__PAGE_OFFSET)
  126. not r5, r5
  127. and r4, r5
  128. mvtc r4, cr5
  129. ;; disable maskable interrupt
  130. seth r4, #high(M32R_ICU_IMASK_PORTL)
  131. or3 r4, r4, #low(M32R_ICU_IMASK_PORTL)
  132. ldi r5, #0
  133. st r5, @r4
  134. ld r5, @r4
  135. ;; enable only IPI
  136. setpsw #0x40
  137. ;; LOOOOOOOOOOOOOOP!!!
  138. .fillinsn
  139. 2:
  140. nop
  141. nop
  142. bra 2b
  143. nop
  144. nop
  145. #ifdef CONFIG_CHIP_M32700_TS1
  146. .global dcache_dummy
  147. .balign 16, 0
  148. dcache_dummy:
  149. .byte 16
  150. #endif /* CONFIG_CHIP_M32700_TS1 */
  151. #endif /* CONFIG_SMP */
  152. .end