1*320cf350SYoshihiro Shimoda/* 2*320cf350SYoshihiro Shimoda * Copyright (C) 2013 Renesas Solutions Corp. 3*320cf350SYoshihiro Shimoda * 4*320cf350SYoshihiro Shimoda * SPDX-License-Identifier: GPL-2.0+ 5*320cf350SYoshihiro Shimoda */ 6*320cf350SYoshihiro Shimoda 7*320cf350SYoshihiro Shimoda#include <config.h> 8*320cf350SYoshihiro Shimoda#include <version.h> 9*320cf350SYoshihiro Shimoda#include <asm/processor.h> 10*320cf350SYoshihiro Shimoda#include <asm/macro.h> 11*320cf350SYoshihiro Shimoda 12*320cf350SYoshihiro Shimoda.macro or32, addr, data 13*320cf350SYoshihiro Shimoda mov.l \addr, r1 14*320cf350SYoshihiro Shimoda mov.l \data, r0 15*320cf350SYoshihiro Shimoda mov.l @r1, r2 16*320cf350SYoshihiro Shimoda or r2, r0 17*320cf350SYoshihiro Shimoda mov.l r0, @r1 18*320cf350SYoshihiro Shimoda.endm 19*320cf350SYoshihiro Shimoda 20*320cf350SYoshihiro Shimoda.macro wait_DBCMD 21*320cf350SYoshihiro Shimoda mov.l DBWAIT_A, r0 22*320cf350SYoshihiro Shimoda mov.l @r0, r1 23*320cf350SYoshihiro Shimoda.endm 24*320cf350SYoshihiro Shimoda 25*320cf350SYoshihiro Shimoda .global lowlevel_init 26*320cf350SYoshihiro Shimoda .section .spiboot1.text 27*320cf350SYoshihiro Shimoda .align 2 28*320cf350SYoshihiro Shimoda 29*320cf350SYoshihiro Shimodalowlevel_init: 30*320cf350SYoshihiro Shimoda mov #0, r14 31*320cf350SYoshihiro Shimoda mova 2f, r0 32*320cf350SYoshihiro Shimoda mov.l PC_MASK, r1 33*320cf350SYoshihiro Shimoda tst r0, r1 34*320cf350SYoshihiro Shimoda bf 2f 35*320cf350SYoshihiro Shimoda 36*320cf350SYoshihiro Shimoda bra exit_pmb 37*320cf350SYoshihiro Shimoda nop 38*320cf350SYoshihiro Shimoda 39*320cf350SYoshihiro Shimoda .align 2 40*320cf350SYoshihiro Shimoda 41*320cf350SYoshihiro Shimoda/* If CPU runs on SDRAM (PC=0x5???????) or not. */ 42*320cf350SYoshihiro ShimodaPC_MASK: .long 0x20000000 43*320cf350SYoshihiro Shimoda 44*320cf350SYoshihiro Shimoda2: 45*320cf350SYoshihiro Shimoda mov #1, r14 46*320cf350SYoshihiro Shimoda 47*320cf350SYoshihiro Shimoda mov.l EXPEVT_A, r0 48*320cf350SYoshihiro Shimoda mov.l @r0, r0 49*320cf350SYoshihiro Shimoda mov.l EXPEVT_POWER_ON_RESET, r1 50*320cf350SYoshihiro Shimoda cmp/eq r0, r1 51*320cf350SYoshihiro Shimoda bt 1f 52*320cf350SYoshihiro Shimoda 53*320cf350SYoshihiro Shimoda /* 54*320cf350SYoshihiro Shimoda * If EXPEVT value is manual reset or tlb multipul-hit, 55*320cf350SYoshihiro Shimoda * initialization of DBSC3 is not necessary. 56*320cf350SYoshihiro Shimoda */ 57*320cf350SYoshihiro Shimoda bra exit_ddr 58*320cf350SYoshihiro Shimoda nop 59*320cf350SYoshihiro Shimoda 60*320cf350SYoshihiro Shimoda1: 61*320cf350SYoshihiro Shimoda /*------- Reset -------*/ 62*320cf350SYoshihiro Shimoda write32 MRSTCR0_A, MRSTCR0_D 63*320cf350SYoshihiro Shimoda write32 MRSTCR1_A, MRSTCR1_D 64*320cf350SYoshihiro Shimoda 65*320cf350SYoshihiro Shimoda /* For Core Reset */ 66*320cf350SYoshihiro Shimoda mov.l DBACEN_A, r0 67*320cf350SYoshihiro Shimoda mov.l @r0, r0 68*320cf350SYoshihiro Shimoda cmp/eq #0, r0 69*320cf350SYoshihiro Shimoda bt 3f 70*320cf350SYoshihiro Shimoda 71*320cf350SYoshihiro Shimoda /* 72*320cf350SYoshihiro Shimoda * If DBACEN == 1(DBSC was already enabled), we have to avoid the 73*320cf350SYoshihiro Shimoda * initialization of DDR3-SDRAM. 74*320cf350SYoshihiro Shimoda */ 75*320cf350SYoshihiro Shimoda bra exit_ddr 76*320cf350SYoshihiro Shimoda nop 77*320cf350SYoshihiro Shimoda 78*320cf350SYoshihiro Shimoda3: 79*320cf350SYoshihiro Shimoda /*------- DBSC3 -------*/ 80*320cf350SYoshihiro Shimoda /* oscillation stabilization time */ 81*320cf350SYoshihiro Shimoda wait_timer WAIT_OSC_TIME 82*320cf350SYoshihiro Shimoda 83*320cf350SYoshihiro Shimoda /* step 3 */ 84*320cf350SYoshihiro Shimoda write32 DBKIND_A, DBKIND_D 85*320cf350SYoshihiro Shimoda 86*320cf350SYoshihiro Shimoda /* step 4 */ 87*320cf350SYoshihiro Shimoda write32 DBCONF_A, DBCONF_D 88*320cf350SYoshihiro Shimoda write32 DBTR0_A, DBTR0_D 89*320cf350SYoshihiro Shimoda write32 DBTR1_A, DBTR1_D 90*320cf350SYoshihiro Shimoda write32 DBTR2_A, DBTR2_D 91*320cf350SYoshihiro Shimoda write32 DBTR3_A, DBTR3_D 92*320cf350SYoshihiro Shimoda write32 DBTR4_A, DBTR4_D 93*320cf350SYoshihiro Shimoda write32 DBTR5_A, DBTR5_D 94*320cf350SYoshihiro Shimoda write32 DBTR6_A, DBTR6_D 95*320cf350SYoshihiro Shimoda write32 DBTR7_A, DBTR7_D 96*320cf350SYoshihiro Shimoda write32 DBTR8_A, DBTR8_D 97*320cf350SYoshihiro Shimoda write32 DBTR9_A, DBTR9_D 98*320cf350SYoshihiro Shimoda write32 DBTR10_A, DBTR10_D 99*320cf350SYoshihiro Shimoda write32 DBTR11_A, DBTR11_D 100*320cf350SYoshihiro Shimoda write32 DBTR12_A, DBTR12_D 101*320cf350SYoshihiro Shimoda write32 DBTR13_A, DBTR13_D 102*320cf350SYoshihiro Shimoda write32 DBTR14_A, DBTR14_D 103*320cf350SYoshihiro Shimoda write32 DBTR15_A, DBTR15_D 104*320cf350SYoshihiro Shimoda write32 DBTR16_A, DBTR16_D 105*320cf350SYoshihiro Shimoda write32 DBTR17_A, DBTR17_D 106*320cf350SYoshihiro Shimoda write32 DBTR18_A, DBTR18_D 107*320cf350SYoshihiro Shimoda write32 DBTR19_A, DBTR19_D 108*320cf350SYoshihiro Shimoda write32 DBRNK0_A, DBRNK0_D 109*320cf350SYoshihiro Shimoda write32 DBADJ0_A, DBADJ0_D 110*320cf350SYoshihiro Shimoda write32 DBADJ2_A, DBADJ2_D 111*320cf350SYoshihiro Shimoda 112*320cf350SYoshihiro Shimoda /* step 5 */ 113*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_RSTL_VAL 114*320cf350SYoshihiro Shimoda wait_timer WAIT_30US 115*320cf350SYoshihiro Shimoda 116*320cf350SYoshihiro Shimoda /* step 6 */ 117*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_PDEN_VAL 118*320cf350SYoshihiro Shimoda 119*320cf350SYoshihiro Shimoda /* step 7 */ 120*320cf350SYoshihiro Shimoda write32 DBPDCNT3_A, DBPDCNT3_D 121*320cf350SYoshihiro Shimoda 122*320cf350SYoshihiro Shimoda /* step 8 */ 123*320cf350SYoshihiro Shimoda write32 DBPDCNT1_A, DBPDCNT1_D 124*320cf350SYoshihiro Shimoda write32 DBPDCNT2_A, DBPDCNT2_D 125*320cf350SYoshihiro Shimoda write32 DBPDLCK_A, DBPDLCK_D 126*320cf350SYoshihiro Shimoda write32 DBPDRGA_A, DBPDRGA_D 127*320cf350SYoshihiro Shimoda write32 DBPDRGD_A, DBPDRGD_D 128*320cf350SYoshihiro Shimoda 129*320cf350SYoshihiro Shimoda /* step 9 */ 130*320cf350SYoshihiro Shimoda wait_timer WAIT_30US 131*320cf350SYoshihiro Shimoda 132*320cf350SYoshihiro Shimoda /* step 10 */ 133*320cf350SYoshihiro Shimoda write32 DBPDCNT0_A, DBPDCNT0_D 134*320cf350SYoshihiro Shimoda 135*320cf350SYoshihiro Shimoda /* step 11 */ 136*320cf350SYoshihiro Shimoda wait_timer WAIT_30US 137*320cf350SYoshihiro Shimoda wait_timer WAIT_30US 138*320cf350SYoshihiro Shimoda 139*320cf350SYoshihiro Shimoda /* step 12 */ 140*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_WAIT_VAL 141*320cf350SYoshihiro Shimoda wait_DBCMD 142*320cf350SYoshihiro Shimoda 143*320cf350SYoshihiro Shimoda /* step 13 */ 144*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_RSTH_VAL 145*320cf350SYoshihiro Shimoda wait_DBCMD 146*320cf350SYoshihiro Shimoda 147*320cf350SYoshihiro Shimoda /* step 14 */ 148*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_WAIT_VAL 149*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_WAIT_VAL 150*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_WAIT_VAL 151*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_WAIT_VAL 152*320cf350SYoshihiro Shimoda 153*320cf350SYoshihiro Shimoda /* step 15 */ 154*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_PDXT_VAL 155*320cf350SYoshihiro Shimoda 156*320cf350SYoshihiro Shimoda /* step 16 */ 157*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_MRS2_VAL 158*320cf350SYoshihiro Shimoda 159*320cf350SYoshihiro Shimoda /* step 17 */ 160*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_MRS3_VAL 161*320cf350SYoshihiro Shimoda 162*320cf350SYoshihiro Shimoda /* step 18 */ 163*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_MRS1_VAL 164*320cf350SYoshihiro Shimoda 165*320cf350SYoshihiro Shimoda /* step 19 */ 166*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_MRS0_VAL 167*320cf350SYoshihiro Shimoda write32 DBPDNCNF_A, DBPDNCNF_D 168*320cf350SYoshihiro Shimoda 169*320cf350SYoshihiro Shimoda /* step 20 */ 170*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_ZQCL_VAL 171*320cf350SYoshihiro Shimoda 172*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_REF_VAL 173*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_REF_VAL 174*320cf350SYoshihiro Shimoda wait_DBCMD 175*320cf350SYoshihiro Shimoda 176*320cf350SYoshihiro Shimoda /* step 21 */ 177*320cf350SYoshihiro Shimoda write32 DBCALTR_A, DBCALTR_D 178*320cf350SYoshihiro Shimoda 179*320cf350SYoshihiro Shimoda /* step 22 */ 180*320cf350SYoshihiro Shimoda write32 DBRFCNF0_A, DBRFCNF0_D 181*320cf350SYoshihiro Shimoda write32 DBRFCNF1_A, DBRFCNF1_D 182*320cf350SYoshihiro Shimoda write32 DBRFCNF2_A, DBRFCNF2_D 183*320cf350SYoshihiro Shimoda 184*320cf350SYoshihiro Shimoda /* step 23 */ 185*320cf350SYoshihiro Shimoda write32 DBCALCNF_A, DBCALCNF_D 186*320cf350SYoshihiro Shimoda 187*320cf350SYoshihiro Shimoda /* step 24 */ 188*320cf350SYoshihiro Shimoda write32 DBRFEN_A, DBRFEN_D 189*320cf350SYoshihiro Shimoda write32 DBCMD_A, DBCMD_SRXT_VAL 190*320cf350SYoshihiro Shimoda 191*320cf350SYoshihiro Shimoda /* step 25 */ 192*320cf350SYoshihiro Shimoda write32 DBACEN_A, DBACEN_D 193*320cf350SYoshihiro Shimoda 194*320cf350SYoshihiro Shimoda /* step 26 */ 195*320cf350SYoshihiro Shimoda wait_DBCMD 196*320cf350SYoshihiro Shimoda 197*320cf350SYoshihiro Shimoda bra exit_ddr 198*320cf350SYoshihiro Shimoda nop 199*320cf350SYoshihiro Shimoda 200*320cf350SYoshihiro Shimoda .align 2 201*320cf350SYoshihiro Shimoda 202*320cf350SYoshihiro ShimodaEXPEVT_A: .long 0xff000024 203*320cf350SYoshihiro ShimodaEXPEVT_POWER_ON_RESET: .long 0x00000000 204*320cf350SYoshihiro Shimoda 205*320cf350SYoshihiro Shimoda/*------- Reset -------*/ 206*320cf350SYoshihiro ShimodaMRSTCR0_A: .long 0xffd50030 207*320cf350SYoshihiro ShimodaMRSTCR0_D: .long 0xfe1ffe7f 208*320cf350SYoshihiro ShimodaMRSTCR1_A: .long 0xffd50034 209*320cf350SYoshihiro ShimodaMRSTCR1_D: .long 0xfff3ffff 210*320cf350SYoshihiro Shimoda 211*320cf350SYoshihiro Shimoda/*------- DBSC3 -------*/ 212*320cf350SYoshihiro ShimodaDBCMD_A: .long 0xfe800018 213*320cf350SYoshihiro ShimodaDBKIND_A: .long 0xfe800020 214*320cf350SYoshihiro ShimodaDBCONF_A: .long 0xfe800024 215*320cf350SYoshihiro ShimodaDBTR0_A: .long 0xfe800040 216*320cf350SYoshihiro ShimodaDBTR1_A: .long 0xfe800044 217*320cf350SYoshihiro ShimodaDBTR2_A: .long 0xfe800048 218*320cf350SYoshihiro ShimodaDBTR3_A: .long 0xfe800050 219*320cf350SYoshihiro ShimodaDBTR4_A: .long 0xfe800054 220*320cf350SYoshihiro ShimodaDBTR5_A: .long 0xfe800058 221*320cf350SYoshihiro ShimodaDBTR6_A: .long 0xfe80005c 222*320cf350SYoshihiro ShimodaDBTR7_A: .long 0xfe800060 223*320cf350SYoshihiro ShimodaDBTR8_A: .long 0xfe800064 224*320cf350SYoshihiro ShimodaDBTR9_A: .long 0xfe800068 225*320cf350SYoshihiro ShimodaDBTR10_A: .long 0xfe80006c 226*320cf350SYoshihiro ShimodaDBTR11_A: .long 0xfe800070 227*320cf350SYoshihiro ShimodaDBTR12_A: .long 0xfe800074 228*320cf350SYoshihiro ShimodaDBTR13_A: .long 0xfe800078 229*320cf350SYoshihiro ShimodaDBTR14_A: .long 0xfe80007c 230*320cf350SYoshihiro ShimodaDBTR15_A: .long 0xfe800080 231*320cf350SYoshihiro ShimodaDBTR16_A: .long 0xfe800084 232*320cf350SYoshihiro ShimodaDBTR17_A: .long 0xfe800088 233*320cf350SYoshihiro ShimodaDBTR18_A: .long 0xfe80008c 234*320cf350SYoshihiro ShimodaDBTR19_A: .long 0xfe800090 235*320cf350SYoshihiro ShimodaDBRNK0_A: .long 0xfe800100 236*320cf350SYoshihiro ShimodaDBPDCNT0_A: .long 0xfe800200 237*320cf350SYoshihiro ShimodaDBPDCNT1_A: .long 0xfe800204 238*320cf350SYoshihiro ShimodaDBPDCNT2_A: .long 0xfe800208 239*320cf350SYoshihiro ShimodaDBPDCNT3_A: .long 0xfe80020c 240*320cf350SYoshihiro ShimodaDBPDLCK_A: .long 0xfe800280 241*320cf350SYoshihiro ShimodaDBPDRGA_A: .long 0xfe800290 242*320cf350SYoshihiro ShimodaDBPDRGD_A: .long 0xfe8002a0 243*320cf350SYoshihiro ShimodaDBADJ0_A: .long 0xfe8000c0 244*320cf350SYoshihiro ShimodaDBADJ2_A: .long 0xfe8000c8 245*320cf350SYoshihiro ShimodaDBRFCNF0_A: .long 0xfe8000e0 246*320cf350SYoshihiro ShimodaDBRFCNF1_A: .long 0xfe8000e4 247*320cf350SYoshihiro ShimodaDBRFCNF2_A: .long 0xfe8000e8 248*320cf350SYoshihiro ShimodaDBCALCNF_A: .long 0xfe8000f4 249*320cf350SYoshihiro ShimodaDBRFEN_A: .long 0xfe800014 250*320cf350SYoshihiro ShimodaDBACEN_A: .long 0xfe800010 251*320cf350SYoshihiro ShimodaDBWAIT_A: .long 0xfe80001c 252*320cf350SYoshihiro ShimodaDBCALTR_A: .long 0xfe8000f8 253*320cf350SYoshihiro ShimodaDBPDNCNF_A: .long 0xfe800180 254*320cf350SYoshihiro Shimoda 255*320cf350SYoshihiro ShimodaWAIT_OSC_TIME: .long 6000 256*320cf350SYoshihiro ShimodaWAIT_30US: .long 13333 257*320cf350SYoshihiro Shimoda 258*320cf350SYoshihiro ShimodaDBCMD_RSTL_VAL: .long 0x20000000 259*320cf350SYoshihiro ShimodaDBCMD_PDEN_VAL: .long 0x1000d73c 260*320cf350SYoshihiro ShimodaDBCMD_WAIT_VAL: .long 0x0000d73c 261*320cf350SYoshihiro ShimodaDBCMD_RSTH_VAL: .long 0x2100d73c 262*320cf350SYoshihiro ShimodaDBCMD_PDXT_VAL: .long 0x110000c8 263*320cf350SYoshihiro ShimodaDBCMD_MRS0_VAL: .long 0x28000930 264*320cf350SYoshihiro ShimodaDBCMD_MRS1_VAL: .long 0x29000004 265*320cf350SYoshihiro ShimodaDBCMD_MRS2_VAL: .long 0x2a000008 266*320cf350SYoshihiro ShimodaDBCMD_MRS3_VAL: .long 0x2b000000 267*320cf350SYoshihiro ShimodaDBCMD_ZQCL_VAL: .long 0x03000200 268*320cf350SYoshihiro ShimodaDBCMD_REF_VAL: .long 0x0c000000 269*320cf350SYoshihiro ShimodaDBCMD_SRXT_VAL: .long 0x19000000 270*320cf350SYoshihiro ShimodaDBKIND_D: .long 0x00000007 271*320cf350SYoshihiro ShimodaDBCONF_D: .long 0x0f030a01 272*320cf350SYoshihiro ShimodaDBTR0_D: .long 0x00000007 273*320cf350SYoshihiro ShimodaDBTR1_D: .long 0x00000006 274*320cf350SYoshihiro ShimodaDBTR2_D: .long 0x00000000 275*320cf350SYoshihiro ShimodaDBTR3_D: .long 0x00000007 276*320cf350SYoshihiro ShimodaDBTR4_D: .long 0x00070007 277*320cf350SYoshihiro ShimodaDBTR5_D: .long 0x0000001b 278*320cf350SYoshihiro ShimodaDBTR6_D: .long 0x00000014 279*320cf350SYoshihiro ShimodaDBTR7_D: .long 0x00000004 280*320cf350SYoshihiro ShimodaDBTR8_D: .long 0x00000014 281*320cf350SYoshihiro ShimodaDBTR9_D: .long 0x00000004 282*320cf350SYoshihiro ShimodaDBTR10_D: .long 0x00000008 283*320cf350SYoshihiro ShimodaDBTR11_D: .long 0x00000007 284*320cf350SYoshihiro ShimodaDBTR12_D: .long 0x0000000e 285*320cf350SYoshihiro ShimodaDBTR13_D: .long 0x000000a0 286*320cf350SYoshihiro ShimodaDBTR14_D: .long 0x00060006 287*320cf350SYoshihiro ShimodaDBTR15_D: .long 0x00000003 288*320cf350SYoshihiro ShimodaDBTR16_D: .long 0x00160002 289*320cf350SYoshihiro ShimodaDBTR17_D: .long 0x000c0000 290*320cf350SYoshihiro ShimodaDBTR18_D: .long 0x00000200 291*320cf350SYoshihiro ShimodaDBTR19_D: .long 0x00000040 292*320cf350SYoshihiro ShimodaDBRNK0_D: .long 0x00000001 293*320cf350SYoshihiro ShimodaDBPDCNT0_D: .long 0x00000001 294*320cf350SYoshihiro ShimodaDBPDCNT1_D: .long 0x00000001 295*320cf350SYoshihiro ShimodaDBPDCNT2_D: .long 0x00000000 296*320cf350SYoshihiro ShimodaDBPDCNT3_D: .long 0x00004010 297*320cf350SYoshihiro ShimodaDBPDLCK_D: .long 0x0000a55a 298*320cf350SYoshihiro ShimodaDBPDRGA_D: .long 0x00000028 299*320cf350SYoshihiro ShimodaDBPDRGD_D: .long 0x00017100 300*320cf350SYoshihiro Shimoda 301*320cf350SYoshihiro ShimodaDBADJ0_D: .long 0x00010000 302*320cf350SYoshihiro ShimodaDBADJ2_D: .long 0x18061806 303*320cf350SYoshihiro ShimodaDBRFCNF0_D: .long 0x000001ff 304*320cf350SYoshihiro ShimodaDBRFCNF1_D: .long 0x00081040 305*320cf350SYoshihiro ShimodaDBRFCNF2_D: .long 0x00000000 306*320cf350SYoshihiro ShimodaDBCALCNF_D: .long 0x0000ffff 307*320cf350SYoshihiro ShimodaDBRFEN_D: .long 0x00000001 308*320cf350SYoshihiro ShimodaDBACEN_D: .long 0x00000001 309*320cf350SYoshihiro ShimodaDBCALTR_D: .long 0x08200820 310*320cf350SYoshihiro ShimodaDBPDNCNF_D: .long 0x00000001 311*320cf350SYoshihiro Shimoda 312*320cf350SYoshihiro Shimoda .align 2 313*320cf350SYoshihiro Shimodaexit_ddr: 314*320cf350SYoshihiro Shimoda#if defined(CONFIG_SH_32BIT) 315*320cf350SYoshihiro Shimoda /*------- set PMB -------*/ 316*320cf350SYoshihiro Shimoda write32 PASCR_A, PASCR_29BIT_D 317*320cf350SYoshihiro Shimoda write32 MMUCR_A, MMUCR_D 318*320cf350SYoshihiro Shimoda 319*320cf350SYoshihiro Shimoda /***************************************************************** 320*320cf350SYoshihiro Shimoda * ent virt phys v sz c wt 321*320cf350SYoshihiro Shimoda * 0 0xa0000000 0x00000000 1 128M 0 1 322*320cf350SYoshihiro Shimoda * 1 0xa8000000 0x48000000 1 128M 0 1 323*320cf350SYoshihiro Shimoda * 5 0x88000000 0x48000000 1 128M 1 1 324*320cf350SYoshihiro Shimoda */ 325*320cf350SYoshihiro Shimoda write32 PMB_ADDR_SPIBOOT_A, PMB_ADDR_SPIBOOT_D 326*320cf350SYoshihiro Shimoda write32 PMB_DATA_SPIBOOT_A, PMB_DATA_SPIBOOT_D 327*320cf350SYoshihiro Shimoda write32 PMB_ADDR_DDR_C1_A, PMB_ADDR_DDR_C1_D 328*320cf350SYoshihiro Shimoda write32 PMB_DATA_DDR_C1_A, PMB_DATA_DDR_C1_D 329*320cf350SYoshihiro Shimoda write32 PMB_ADDR_DDR_N1_A, PMB_ADDR_DDR_N1_D 330*320cf350SYoshihiro Shimoda write32 PMB_DATA_DDR_N1_A, PMB_DATA_DDR_N1_D 331*320cf350SYoshihiro Shimoda 332*320cf350SYoshihiro Shimoda write32 PMB_ADDR_ENTRY2, PMB_ADDR_NOT_USE_D 333*320cf350SYoshihiro Shimoda write32 PMB_ADDR_ENTRY3, PMB_ADDR_NOT_USE_D 334*320cf350SYoshihiro Shimoda write32 PMB_ADDR_ENTRY4, PMB_ADDR_NOT_USE_D 335*320cf350SYoshihiro Shimoda write32 PMB_ADDR_ENTRY6, PMB_ADDR_NOT_USE_D 336*320cf350SYoshihiro Shimoda write32 PMB_ADDR_ENTRY7, PMB_ADDR_NOT_USE_D 337*320cf350SYoshihiro Shimoda write32 PMB_ADDR_ENTRY8, PMB_ADDR_NOT_USE_D 338*320cf350SYoshihiro Shimoda write32 PMB_ADDR_ENTRY9, PMB_ADDR_NOT_USE_D 339*320cf350SYoshihiro Shimoda write32 PMB_ADDR_ENTRY10, PMB_ADDR_NOT_USE_D 340*320cf350SYoshihiro Shimoda write32 PMB_ADDR_ENTRY11, PMB_ADDR_NOT_USE_D 341*320cf350SYoshihiro Shimoda write32 PMB_ADDR_ENTRY12, PMB_ADDR_NOT_USE_D 342*320cf350SYoshihiro Shimoda write32 PMB_ADDR_ENTRY13, PMB_ADDR_NOT_USE_D 343*320cf350SYoshihiro Shimoda write32 PMB_ADDR_ENTRY14, PMB_ADDR_NOT_USE_D 344*320cf350SYoshihiro Shimoda write32 PMB_ADDR_ENTRY15, PMB_ADDR_NOT_USE_D 345*320cf350SYoshihiro Shimoda 346*320cf350SYoshihiro Shimoda write32 PASCR_A, PASCR_INIT 347*320cf350SYoshihiro Shimoda mov.l DUMMY_ADDR, r0 348*320cf350SYoshihiro Shimoda icbi @r0 349*320cf350SYoshihiro Shimoda#endif /* if defined(CONFIG_SH_32BIT) */ 350*320cf350SYoshihiro Shimoda 351*320cf350SYoshihiro Shimodaexit_pmb: 352*320cf350SYoshihiro Shimoda /* CPU is running on ILRAM? */ 353*320cf350SYoshihiro Shimoda mov r14, r0 354*320cf350SYoshihiro Shimoda tst #1, r0 355*320cf350SYoshihiro Shimoda bt 1f 356*320cf350SYoshihiro Shimoda 357*320cf350SYoshihiro Shimoda mov.l _stack_ilram, r15 358*320cf350SYoshihiro Shimoda mov.l _spiboot_main, r0 359*320cf350SYoshihiro Shimoda100: bsrf r0 360*320cf350SYoshihiro Shimoda nop 361*320cf350SYoshihiro Shimoda 362*320cf350SYoshihiro Shimoda .align 2 363*320cf350SYoshihiro Shimoda_spiboot_main: .long (spiboot_main - (100b + 4)) 364*320cf350SYoshihiro Shimoda_stack_ilram: .long 0xe5204000 365*320cf350SYoshihiro Shimoda 366*320cf350SYoshihiro Shimoda1: 367*320cf350SYoshihiro Shimoda write32 CCR_A, CCR_D 368*320cf350SYoshihiro Shimoda 369*320cf350SYoshihiro Shimoda rts 370*320cf350SYoshihiro Shimoda nop 371*320cf350SYoshihiro Shimoda 372*320cf350SYoshihiro Shimoda .align 2 373*320cf350SYoshihiro Shimoda 374*320cf350SYoshihiro Shimoda#if defined(CONFIG_SH_32BIT) 375*320cf350SYoshihiro Shimoda/*------- set PMB -------*/ 376*320cf350SYoshihiro ShimodaPMB_ADDR_SPIBOOT_A: .long PMB_ADDR_BASE(0) 377*320cf350SYoshihiro ShimodaPMB_ADDR_DDR_N1_A: .long PMB_ADDR_BASE(1) 378*320cf350SYoshihiro ShimodaPMB_ADDR_DDR_C1_A: .long PMB_ADDR_BASE(5) 379*320cf350SYoshihiro ShimodaPMB_ADDR_ENTRY2: .long PMB_ADDR_BASE(2) 380*320cf350SYoshihiro ShimodaPMB_ADDR_ENTRY3: .long PMB_ADDR_BASE(3) 381*320cf350SYoshihiro ShimodaPMB_ADDR_ENTRY4: .long PMB_ADDR_BASE(4) 382*320cf350SYoshihiro ShimodaPMB_ADDR_ENTRY6: .long PMB_ADDR_BASE(6) 383*320cf350SYoshihiro ShimodaPMB_ADDR_ENTRY7: .long PMB_ADDR_BASE(7) 384*320cf350SYoshihiro ShimodaPMB_ADDR_ENTRY8: .long PMB_ADDR_BASE(8) 385*320cf350SYoshihiro ShimodaPMB_ADDR_ENTRY9: .long PMB_ADDR_BASE(9) 386*320cf350SYoshihiro ShimodaPMB_ADDR_ENTRY10: .long PMB_ADDR_BASE(10) 387*320cf350SYoshihiro ShimodaPMB_ADDR_ENTRY11: .long PMB_ADDR_BASE(11) 388*320cf350SYoshihiro ShimodaPMB_ADDR_ENTRY12: .long PMB_ADDR_BASE(12) 389*320cf350SYoshihiro ShimodaPMB_ADDR_ENTRY13: .long PMB_ADDR_BASE(13) 390*320cf350SYoshihiro ShimodaPMB_ADDR_ENTRY14: .long PMB_ADDR_BASE(14) 391*320cf350SYoshihiro ShimodaPMB_ADDR_ENTRY15: .long PMB_ADDR_BASE(15) 392*320cf350SYoshihiro Shimoda 393*320cf350SYoshihiro ShimodaPMB_ADDR_SPIBOOT_D: .long mk_pmb_addr_val(0xa0) 394*320cf350SYoshihiro ShimodaPMB_ADDR_DDR_C1_D: .long mk_pmb_addr_val(0x88) 395*320cf350SYoshihiro ShimodaPMB_ADDR_DDR_N1_D: .long mk_pmb_addr_val(0xa8) 396*320cf350SYoshihiro ShimodaPMB_ADDR_NOT_USE_D: .long 0x00000000 397*320cf350SYoshihiro Shimoda 398*320cf350SYoshihiro ShimodaPMB_DATA_SPIBOOT_A: .long PMB_DATA_BASE(0) 399*320cf350SYoshihiro ShimodaPMB_DATA_DDR_N1_A: .long PMB_DATA_BASE(1) 400*320cf350SYoshihiro ShimodaPMB_DATA_DDR_C1_A: .long PMB_DATA_BASE(5) 401*320cf350SYoshihiro Shimoda 402*320cf350SYoshihiro Shimoda/* ppn ub v s1 s0 c wt */ 403*320cf350SYoshihiro ShimodaPMB_DATA_SPIBOOT_D: .long mk_pmb_data_val(0x00, 0, 1, 1, 0, 0, 1) 404*320cf350SYoshihiro ShimodaPMB_DATA_DDR_C1_D: .long mk_pmb_data_val(0x48, 0, 1, 1, 0, 1, 1) 405*320cf350SYoshihiro ShimodaPMB_DATA_DDR_N1_D: .long mk_pmb_data_val(0x48, 1, 1, 1, 0, 0, 1) 406*320cf350SYoshihiro Shimoda 407*320cf350SYoshihiro ShimodaPASCR_A: .long 0xff000070 408*320cf350SYoshihiro ShimodaDUMMY_ADDR: .long 0xa0000000 409*320cf350SYoshihiro ShimodaPASCR_29BIT_D: .long 0x00000000 410*320cf350SYoshihiro ShimodaPASCR_INIT: .long 0x80000080 411*320cf350SYoshihiro ShimodaMMUCR_A: .long 0xff000010 412*320cf350SYoshihiro ShimodaMMUCR_D: .long 0x00000004 /* clear ITLB */ 413*320cf350SYoshihiro Shimoda#endif /* CONFIG_SH_32BIT */ 414*320cf350SYoshihiro Shimoda 415*320cf350SYoshihiro ShimodaCCR_A: .long CCR 416*320cf350SYoshihiro ShimodaCCR_D: .long CCR_CACHE_INIT 417