Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 Renesas Solutions Corp. |
| 3 | * Copyright (C) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com> |
| 4 | * |
| 5 | * board/ap325rxa/lowlevel_init.S |
| 6 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 7 | * SPDX-License-Identifier: GPL-2.0+ |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include <config.h> |
| 11 | #include <version.h> |
| 12 | #include <asm/processor.h> |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 13 | #include <asm/macro.h> |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 14 | |
| 15 | /* |
| 16 | * Board specific low level init code, called _very_ early in the |
| 17 | * startup sequence. Relocation to SDRAM has not happened yet, no |
| 18 | * stack is available, bss section has not been initialised, etc. |
| 19 | * |
| 20 | * (Note: As no stack is available, no subroutines can be called...). |
| 21 | */ |
| 22 | |
| 23 | .global lowlevel_init |
| 24 | |
| 25 | .text |
| 26 | .align 2 |
| 27 | |
| 28 | lowlevel_init: |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 29 | write16 DRVCRA_A, DRVCRA_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 30 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 31 | write16 DRVCRB_A, DRVCRB_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 32 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 33 | write16 RWTCSR_A, RWTCSR_D1 |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 34 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 35 | write16 RWTCNT_A, RWTCNT_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 36 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 37 | write16 RWTCSR_A, RWTCSR_D2 |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 38 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 39 | write32 FRQCR_A, FRQCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 40 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 41 | write32 CMNCR_A, CMNCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 42 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 43 | write32 CS0BCR_A, CS0BCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 44 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 45 | write32 CS4BCR_A, CS4BCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 46 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 47 | write32 CS5ABCR_A, CS5ABCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 48 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 49 | write32 CS5BBCR_A, CS5BBCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 50 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 51 | write32 CS6ABCR_A, CS6ABCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 52 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 53 | write32 CS6BBCR_A, CS6BBCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 54 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 55 | write32 CS0WCR_A, CS0WCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 56 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 57 | write32 CS4WCR_A, CS4WCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 58 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 59 | write32 CS5AWCR_A, CS5AWCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 60 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 61 | write32 CS5BWCR_A, CS5BWCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 62 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 63 | write32 CS6AWCR_A, CS6AWCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 64 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 65 | write32 CS6BWCR_A, CS6BWCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 66 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 67 | write32 SBSC_SDCR_A, SBSC_SDCR_D1 |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 68 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 69 | write32 SBSC_SDWCR_A, SBSC_SDWCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 70 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 71 | write32 SBSC_SDPCR_A, SBSC_SDPCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 72 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 73 | write32 SBSC_RTCSR_A, SBSC_RTCSR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 74 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 75 | write32 SBSC_RTCNT_A, SBSC_RTCNT_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 76 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 77 | write32 SBSC_RTCOR_A, SBSC_RTCOR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 78 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 79 | write8 SBSC_SDMR3_A1, SBSC_SDMR3_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 80 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 81 | write8 SBSC_SDMR3_A2, SBSC_SDMR3_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 82 | |
| 83 | mov.l SLEEP_CNT, r1 |
| 84 | 2: tst r1, r1 |
| 85 | nop |
| 86 | bf/s 2b |
| 87 | dt r1 |
| 88 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 89 | write8 SBSC_SDMR3_A3, SBSC_SDMR3_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 90 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 91 | write32 SBSC_SDCR_A, SBSC_SDCR_D2 |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 92 | |
Jean-Christophe PLAGNIOL-VILLARD | b9c2172 | 2008-12-20 19:29:49 +0100 | [diff] [blame] | 93 | write32 CCR_A, CCR_D |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 94 | |
Jean-Christophe PLAGNIOL-VILLARD | bd96370 | 2008-12-20 19:29:48 +0100 | [diff] [blame] | 95 | ! BL bit off (init = ON) (?!?) |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 96 | |
| 97 | stc sr, r0 ! BL bit off(init=ON) |
| 98 | mov.l SR_MASK_D, r1 |
| 99 | and r1, r0 |
| 100 | ldc r0, sr |
| 101 | |
| 102 | rts |
| 103 | mov #0, r0 |
| 104 | |
| 105 | .align 2 |
| 106 | |
| 107 | DRVCRA_A: .long DRVCRA |
| 108 | DRVCRB_A: .long DRVCRB |
Nobuhiro Iwamatsu | bf61d19 | 2010-07-22 15:22:10 +0900 | [diff] [blame] | 109 | DRVCRA_D: .word 0x4555 |
| 110 | DRVCRB_D: .word 0x0005 |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 111 | |
| 112 | RWTCSR_A: .long RWTCSR |
| 113 | RWTCNT_A: .long RWTCNT |
| 114 | FRQCR_A: .long FRQCR |
Nobuhiro Iwamatsu | bf61d19 | 2010-07-22 15:22:10 +0900 | [diff] [blame] | 115 | RWTCSR_D1: .word 0xa507 |
| 116 | RWTCSR_D2: .word 0xa504 |
| 117 | RWTCNT_D: .word 0x5a00 |
Nobuhiro Iwamatsu | 5e64f9e | 2010-07-22 16:04:08 +0900 | [diff] [blame] | 118 | .align 2 |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 119 | FRQCR_D: .long 0x0b04474a |
| 120 | |
| 121 | SBSC_SDCR_A: .long SBSC_SDCR |
| 122 | SBSC_SDWCR_A: .long SBSC_SDWCR |
| 123 | SBSC_SDPCR_A: .long SBSC_SDPCR |
| 124 | SBSC_RTCSR_A: .long SBSC_RTCSR |
| 125 | SBSC_RTCNT_A: .long SBSC_RTCNT |
| 126 | SBSC_RTCOR_A: .long SBSC_RTCOR |
| 127 | SBSC_SDMR3_A1: .long 0xfe510000 |
| 128 | SBSC_SDMR3_A2: .long 0xfe500242 |
| 129 | SBSC_SDMR3_A3: .long 0xfe5c0042 |
| 130 | |
| 131 | SBSC_SDCR_D1: .long 0x92810112 |
| 132 | SBSC_SDCR_D2: .long 0x92810912 |
| 133 | SBSC_SDWCR_D: .long 0x05162482 |
| 134 | SBSC_SDPCR_D: .long 0x00300087 |
| 135 | SBSC_RTCSR_D: .long 0xa55a0212 |
| 136 | SBSC_RTCNT_D: .long 0xa55a0000 |
| 137 | SBSC_RTCOR_D: .long 0xa55a0040 |
| 138 | SBSC_SDMR3_D: .long 0x00 |
| 139 | |
| 140 | CMNCR_A: .long CMNCR |
| 141 | CS0BCR_A: .long CS0BCR |
| 142 | CS4BCR_A: .long CS4BCR |
Jean-Christophe PLAGNIOL-VILLARD | bd96370 | 2008-12-20 19:29:48 +0100 | [diff] [blame] | 143 | CS5ABCR_A: .long CS5ABCR |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 144 | CS5BBCR_A: .long CS5BBCR |
| 145 | CS6ABCR_A: .long CS6ABCR |
| 146 | CS6BBCR_A: .long CS6BBCR |
| 147 | CS0WCR_A: .long CS0WCR |
| 148 | CS4WCR_A: .long CS4WCR |
| 149 | CS5AWCR_A: .long CS5AWCR |
| 150 | CS5BWCR_A: .long CS5BWCR |
| 151 | CS6AWCR_A: .long CS6AWCR |
| 152 | CS6BWCR_A: .long CS6BWCR |
| 153 | |
| 154 | CMNCR_D: .long 0x00000013 |
| 155 | CS0BCR_D: .long 0x24920400 |
| 156 | CS4BCR_D: .long 0x24920400 |
| 157 | CS5ABCR_D: .long 0x24920400 |
| 158 | CS5BBCR_D: .long 0x7fff0600 |
| 159 | CS6ABCR_D: .long 0x24920400 |
| 160 | CS6BBCR_D: .long 0x24920600 |
| 161 | CS0WCR_D: .long 0x00000480 |
| 162 | CS4WCR_D: .long 0x00000480 |
| 163 | CS5AWCR_D: .long 0x00000380 |
Yusuke.Goda | 2b1d8be | 2009-03-13 16:08:18 +0900 | [diff] [blame] | 164 | CS5BWCR_D: .long 0x00000080 |
Nobuhiro Iwamatsu | 3e59043 | 2008-08-22 17:39:09 +0900 | [diff] [blame] | 165 | CS6AWCR_D: .long 0x00000300 |
| 166 | CS6BWCR_D: .long 0x00000540 |
| 167 | |
| 168 | CCR_A: .long 0xff00001c |
| 169 | CCR_D: .long 0x0000090d |
| 170 | |
| 171 | SLEEP_CNT: .long 0x00000800 |
| 172 | SR_MASK_D: .long 0xEFFFFF0F |