setup.S 4.2 KB

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