setup.S 4.2 KB

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