15628fb75SSimon Guinot# 25628fb75SSimon Guinot# Copyright (C) 2011 Simon Guinot <sguinot@lacie.com> 35628fb75SSimon Guinot# 45628fb75SSimon Guinot# Based on Kirkwood support: 55628fb75SSimon Guinot# (C) Copyright 2009 65628fb75SSimon Guinot# Marvell Semiconductor <www.marvell.com> 75628fb75SSimon Guinot# Written-by: Prafulla Wadaskar <prafulla@marvell.com> 85628fb75SSimon Guinot# 9*1a459660SWolfgang Denk# SPDX-License-Identifier: GPL-2.0+ 105628fb75SSimon Guinot# 11b1e6c4c3SAnatolij Gustschin# Refer doc/README.kwbimage for more details about how-to configure 125628fb75SSimon Guinot# and create kirkwood boot image 135628fb75SSimon Guinot# 145628fb75SSimon Guinot 155628fb75SSimon Guinot# Boot Media configurations 165628fb75SSimon GuinotBOOT_FROM spi # Boot from SPI flash 175628fb75SSimon Guinot 185628fb75SSimon Guinot# SOC registers configuration using bootrom header extension 195628fb75SSimon Guinot# Maximum KWBIMAGE_MAX_CONFIG configurations allowed 205628fb75SSimon Guinot 215628fb75SSimon Guinot# Configure RGMII-0 interface pad voltage to 1.8V 225628fb75SSimon GuinotDATA 0xFFD100e0 0x1B1B1B9B 235628fb75SSimon Guinot 245628fb75SSimon Guinot#Dram initalization for SINGLE x16 CL=5 @ 400MHz 255628fb75SSimon GuinotDATA 0xFFD01400 0x43000C30 # DDR Configuration register 265628fb75SSimon Guinot# bit13-0: 0xa00 (2560 DDR2 clks refresh rate) 275628fb75SSimon Guinot# bit23-14: zero 285628fb75SSimon Guinot# bit24: 1= enable exit self refresh mode on DDR access 295628fb75SSimon Guinot# bit25: 1 required 305628fb75SSimon Guinot# bit29-26: zero 315628fb75SSimon Guinot# bit31-30: 01 325628fb75SSimon Guinot 335628fb75SSimon GuinotDATA 0xFFD01404 0x38743000 # DDR Controller Control Low 345628fb75SSimon Guinot# bit 4: 0=addr/cmd in smame cycle 355628fb75SSimon Guinot# bit 5: 0=clk is driven during self refresh, we don't care for APX 365628fb75SSimon Guinot# bit 6: 0=use recommended falling edge of clk for addr/cmd 375628fb75SSimon Guinot# bit14: 0=input buffer always powered up 385628fb75SSimon Guinot# bit18: 1=cpu lock transaction enabled 395628fb75SSimon Guinot# bit23-20: 5=recommended value for CL=5 and STARTBURST_DEL disabled bit31=0 405628fb75SSimon Guinot# bit27-24: 8= CL+3, STARTBURST sample stages, for freqs 400MHz, unbuffered DIMM 415628fb75SSimon Guinot# bit30-28: 3 required 425628fb75SSimon Guinot# bit31: 0=no additional STARTBURST delay 435628fb75SSimon Guinot 445628fb75SSimon GuinotDATA 0xFFD01408 0x22125451 # DDR Timing (Low) (active cycles value +1) 455628fb75SSimon Guinot# bit7-4: TRCD 465628fb75SSimon Guinot# bit11- 8: TRP 475628fb75SSimon Guinot# bit15-12: TWR 485628fb75SSimon Guinot# bit19-16: TWTR 495628fb75SSimon Guinot# bit20: TRAS msb 505628fb75SSimon Guinot# bit23-21: 0x0 515628fb75SSimon Guinot# bit27-24: TRRD 525628fb75SSimon Guinot# bit31-28: TRTP 535628fb75SSimon Guinot 545628fb75SSimon GuinotDATA 0xFFD0140C 0x00000A32 # DDR Timing (High) 555628fb75SSimon Guinot# bit6-0: TRFC 565628fb75SSimon Guinot# bit8-7: TR2R 575628fb75SSimon Guinot# bit10-9: TR2W 585628fb75SSimon Guinot# bit12-11: TW2W 595628fb75SSimon Guinot# bit31-13: zero required 605628fb75SSimon Guinot 615628fb75SSimon GuinotDATA 0xFFD01410 0x0000CCCC # DDR Address Control 625628fb75SSimon Guinot# bit1-0: 01, Cs0width=x16 635628fb75SSimon Guinot# bit3-2: 11, Cs0size=1Gb 645628fb75SSimon Guinot# bit5-4: 00, Cs2width=nonexistent 655628fb75SSimon Guinot# bit7-6: 00, Cs1size =nonexistent 665628fb75SSimon Guinot# bit9-8: 00, Cs2width=nonexistent 675628fb75SSimon Guinot# bit11-10: 00, Cs2size =nonexistent 685628fb75SSimon Guinot# bit13-12: 00, Cs3width=nonexistent 695628fb75SSimon Guinot# bit15-14: 00, Cs3size =nonexistent 705628fb75SSimon Guinot# bit16: 0, Cs0AddrSel 715628fb75SSimon Guinot# bit17: 0, Cs1AddrSel 725628fb75SSimon Guinot# bit18: 0, Cs2AddrSel 735628fb75SSimon Guinot# bit19: 0, Cs3AddrSel 745628fb75SSimon Guinot# bit31-20: 0 required 755628fb75SSimon Guinot 765628fb75SSimon GuinotDATA 0xFFD01414 0x00000000 # DDR Open Pages Control 775628fb75SSimon Guinot# bit0: 0, OpenPage enabled 785628fb75SSimon Guinot# bit31-1: 0 required 795628fb75SSimon Guinot 805628fb75SSimon GuinotDATA 0xFFD01418 0x00000000 # DDR Operation 815628fb75SSimon Guinot# bit3-0: 0x0, DDR cmd 825628fb75SSimon Guinot# bit31-4: 0 required 835628fb75SSimon Guinot 845628fb75SSimon GuinotDATA 0xFFD0141C 0x00000662 # DDR Mode 855628fb75SSimon Guinot# bit2-0: 2, BurstLen=2 required 865628fb75SSimon Guinot# bit3: 0, BurstType=0 required 875628fb75SSimon Guinot# bit6-4: 4, CL=5 885628fb75SSimon Guinot# bit7: 0, TestMode=0 normal 895628fb75SSimon Guinot# bit8: 0, DLL reset=0 normal 905628fb75SSimon Guinot# bit11-9: 6, auto-precharge write recovery ???????????? 915628fb75SSimon Guinot# bit12: 0, PD must be zero 925628fb75SSimon Guinot# bit31-13: 0 required 935628fb75SSimon Guinot 945628fb75SSimon GuinotDATA 0xFFD01420 0x00000044 # DDR Extended Mode 955628fb75SSimon Guinot# bit0: 0, DDR DLL enabled 965628fb75SSimon Guinot# bit1: 1, DDR drive strenght reduced 975628fb75SSimon Guinot# bit2: 1, DDR ODT control lsd enabled 985628fb75SSimon Guinot# bit5-3: 000, required 995628fb75SSimon Guinot# bit6: 1, DDR ODT control msb, enabled 1005628fb75SSimon Guinot# bit9-7: 000, required 1015628fb75SSimon Guinot# bit10: 0, differential DQS enabled 1025628fb75SSimon Guinot# bit11: 0, required 1035628fb75SSimon Guinot# bit12: 0, DDR output buffer enabled 1045628fb75SSimon Guinot# bit31-13: 0 required 1055628fb75SSimon Guinot 1065628fb75SSimon GuinotDATA 0xFFD01424 0x0000F17F # DDR Controller Control High 1075628fb75SSimon Guinot# bit2-0: 111, required 1085628fb75SSimon Guinot# bit3 : 1 , MBUS Burst Chop disabled 1095628fb75SSimon Guinot# bit6-4: 111, required 1105628fb75SSimon Guinot# bit7 : 1 , D2P Latency enabled 1115628fb75SSimon Guinot# bit8 : 1 , add writepath sample stage, must be 1 for DDR freq >= 300MHz 1125628fb75SSimon Guinot# bit9 : 0 , no half clock cycle addition to dataout 1135628fb75SSimon Guinot# bit10 : 0 , 1/4 clock cycle skew enabled for addr/ctl signals 1145628fb75SSimon Guinot# bit11 : 0 , 1/4 clock cycle skew disabled for write mesh 1155628fb75SSimon Guinot# bit15-12: 1111 required 1165628fb75SSimon Guinot# bit31-16: 0 required 1175628fb75SSimon Guinot 1185628fb75SSimon GuinotDATA 0xFFD01428 0x00096630 # DDR2 ODT Read Timing (default values) 1195628fb75SSimon GuinotDATA 0xFFD0147C 0x00009663 # DDR2 ODT Write Timing (default values) 1205628fb75SSimon Guinot 1215628fb75SSimon GuinotDATA 0xFFD01500 0x00000000 # CS[0]n Base address to 0x0 1225628fb75SSimon GuinotDATA 0xFFD01504 0x0FFFFFF1 # CS[0]n Size 1235628fb75SSimon Guinot# bit0: 1, Window enabled 1245628fb75SSimon Guinot# bit1: 0, Write Protect disabled 1255628fb75SSimon Guinot# bit3-2: 00, CS0 hit selected 1265628fb75SSimon Guinot# bit23-4: ones, required 1275628fb75SSimon Guinot# bit31-24: 0x07, Size (i.e. 128MB) 1285628fb75SSimon Guinot 1295628fb75SSimon GuinotDATA 0xFFD0150C 0x00000000 # CS[1]n Size, window disabled 1305628fb75SSimon GuinotDATA 0xFFD01514 0x00000000 # CS[2]n Size, window disabled 1315628fb75SSimon GuinotDATA 0xFFD0151C 0x00000000 # CS[3]n Size, window disabled 1325628fb75SSimon Guinot 1335628fb75SSimon GuinotDATA 0xFFD01494 0x00010000 # DDR ODT Control (Low) 1345628fb75SSimon Guinot# bit3-0: 1, ODT0Rd, MODT[0] asserted during read from DRAM CS0 1355628fb75SSimon Guinot# bit19-16:1, ODT0Wr, MODT[0] asserted during write to DRAM CS0 1365628fb75SSimon Guinot 1375628fb75SSimon GuinotDATA 0xFFD01498 0x00000000 # DDR ODT Control (High) 1385628fb75SSimon Guinot# bit1-0: 00, ODT0 controlled by ODT Control (low) register above 1395628fb75SSimon Guinot# bit3-2: 01, ODT1 active NEVER! 1405628fb75SSimon Guinot# bit31-4: zero, required 1415628fb75SSimon Guinot 1425628fb75SSimon GuinotDATA 0xFFD0149C 0x0000E40F # CPU ODT Control 1435628fb75SSimon Guinot# bit3-0: 1, ODT0Rd, Internal ODT asserted during read from DRAM bank0 1445628fb75SSimon Guinot# bit7-4: 1, ODT0Wr, Internal ODT asserted during write to DRAM bank0 1455628fb75SSimon Guinot# bit11-10:1, DQ_ODTSel. ODT select turned on 1465628fb75SSimon Guinot 1475628fb75SSimon GuinotDATA 0xFFD01480 0x00000001 # DDR Initialization Control 1485628fb75SSimon Guinot#bit0=1, enable DDR init upon this register write 1495628fb75SSimon Guinot 1505628fb75SSimon Guinot# End of Header extension 1515628fb75SSimon GuinotDATA 0x0 0x0 152