1*83d290c5STom Rini# SPDX-License-Identifier: GPL-2.0+ 237235496SSimon Guinot# 337235496SSimon Guinot# Copyright (C) 2011 Simon Guinot <sguinot@lacie.com> 437235496SSimon Guinot# 537235496SSimon Guinot# Based on Kirkwood support: 637235496SSimon Guinot# (C) Copyright 2009 737235496SSimon Guinot# Marvell Semiconductor <www.marvell.com> 837235496SSimon Guinot# Written-by: Prafulla Wadaskar <prafulla@marvell.com> 9b1e6c4c3SAnatolij Gustschin# Refer doc/README.kwbimage for more details about how-to configure 1037235496SSimon Guinot# and create kirkwood boot image 1137235496SSimon Guinot# 1237235496SSimon Guinot 1337235496SSimon Guinot# Boot Media configurations 1437235496SSimon GuinotBOOT_FROM spi # Boot from SPI flash 1537235496SSimon Guinot 1637235496SSimon Guinot# SOC registers configuration using bootrom header extension 1737235496SSimon Guinot# Maximum KWBIMAGE_MAX_CONFIG configurations allowed 1837235496SSimon Guinot 1937235496SSimon Guinot# Configure RGMII-0 interface pad voltage to 1.8V 2037235496SSimon GuinotDATA 0xFFD100e0 0x1B1B1B9B 2137235496SSimon Guinot 2237235496SSimon Guinot#Dram initalization for SINGLE x16 CL=5 @ 400MHz 2337235496SSimon GuinotDATA 0xFFD01400 0x43000618 # DDR Configuration register 2437235496SSimon Guinot# bit13-0: 0xa00 (2560 DDR2 clks refresh rate) 2537235496SSimon Guinot# bit23-14: zero 2637235496SSimon Guinot# bit24: 1= enable exit self refresh mode on DDR access 2737235496SSimon Guinot# bit25: 1 required 2837235496SSimon Guinot# bit29-26: zero 2937235496SSimon Guinot# bit31-30: 01 3037235496SSimon Guinot 3137235496SSimon GuinotDATA 0xFFD01404 0x34143000 # DDR Controller Control Low 3237235496SSimon Guinot# bit 4: 0=addr/cmd in smame cycle 3337235496SSimon Guinot# bit 5: 0=clk is driven during self refresh, we don't care for APX 3437235496SSimon Guinot# bit 6: 0=use recommended falling edge of clk for addr/cmd 3537235496SSimon Guinot# bit14: 0=input buffer always powered up 3637235496SSimon Guinot# bit18: 1=cpu lock transaction enabled 3737235496SSimon Guinot# bit23-20: 5=recommended value for CL=5 and STARTBURST_DEL disabled bit31=0 3837235496SSimon Guinot# bit27-24: 8= CL+3, STARTBURST sample stages, for freqs 400MHz, unbuffered DIMM 3937235496SSimon Guinot# bit30-28: 3 required 4037235496SSimon Guinot# bit31: 0=no additional STARTBURST delay 4137235496SSimon Guinot 4237235496SSimon GuinotDATA 0xFFD01408 0x11012228 # DDR Timing (Low) (active cycles value +1) 4337235496SSimon Guinot# bit7-4: TRCD 4437235496SSimon Guinot# bit11- 8: TRP 4537235496SSimon Guinot# bit15-12: TWR 4637235496SSimon Guinot# bit19-16: TWTR 4737235496SSimon Guinot# bit20: TRAS msb 4837235496SSimon Guinot# bit23-21: 0x0 4937235496SSimon Guinot# bit27-24: TRRD 5037235496SSimon Guinot# bit31-28: TRTP 5137235496SSimon Guinot 5237235496SSimon GuinotDATA 0xFFD0140C 0x00000A19 # DDR Timing (High) 5337235496SSimon Guinot# bit6-0: TRFC 5437235496SSimon Guinot# bit8-7: TR2R 5537235496SSimon Guinot# bit10-9: TR2W 5637235496SSimon Guinot# bit12-11: TW2W 5737235496SSimon Guinot# bit31-13: zero required 5837235496SSimon Guinot 5937235496SSimon GuinotDATA 0xFFD01410 0x0000DDDD # DDR Address Control 6037235496SSimon Guinot# bit1-0: 00, Cs0width=x8 6137235496SSimon Guinot# bit3-2: 10, Cs0size=512Mb 6237235496SSimon Guinot# bit5-4: 00, Cs2width=nonexistent 6337235496SSimon Guinot# bit7-6: 00, Cs1size =nonexistent 6437235496SSimon Guinot# bit9-8: 00, Cs2width=nonexistent 6537235496SSimon Guinot# bit11-10: 00, Cs2size =nonexistent 6637235496SSimon Guinot# bit13-12: 00, Cs3width=nonexistent 6737235496SSimon Guinot# bit15-14: 00, Cs3size =nonexistent 6837235496SSimon Guinot# bit16: 0, Cs0AddrSel 6937235496SSimon Guinot# bit17: 0, Cs1AddrSel 7037235496SSimon Guinot# bit18: 0, Cs2AddrSel 7137235496SSimon Guinot# bit19: 0, Cs3AddrSel 7237235496SSimon Guinot# bit31-20: 0 required 7337235496SSimon Guinot 7437235496SSimon GuinotDATA 0xFFD01414 0x00000000 # DDR Open Pages Control 7537235496SSimon Guinot# bit0: 0, OpenPage enabled 7637235496SSimon Guinot# bit31-1: 0 required 7737235496SSimon Guinot 7837235496SSimon GuinotDATA 0xFFD01418 0x00000000 # DDR Operation 7937235496SSimon Guinot# bit3-0: 0x0, DDR cmd 8037235496SSimon Guinot# bit31-4: 0 required 8137235496SSimon Guinot 8237235496SSimon GuinotDATA 0xFFD0141C 0x00000632 # DDR Mode 8337235496SSimon Guinot# bit2-0: 2, BurstLen=2 required 8437235496SSimon Guinot# bit3: 0, BurstType=0 required 8537235496SSimon Guinot# bit6-4: 4, CL=5 8637235496SSimon Guinot# bit7: 0, TestMode=0 normal 8737235496SSimon Guinot# bit8: 0, DLL reset=0 normal 8837235496SSimon Guinot# bit11-9: 6, auto-precharge write recovery ???????????? 8937235496SSimon Guinot# bit12: 0, PD must be zero 9037235496SSimon Guinot# bit31-13: 0 required 9137235496SSimon Guinot 9237235496SSimon GuinotDATA 0xFFD01420 0x00000004 # DDR Extended Mode 9337235496SSimon Guinot# bit0: 0, DDR DLL enabled 9437235496SSimon Guinot# bit1: 1, DDR drive strenght reduced 9537235496SSimon Guinot# bit2: 1, DDR ODT control lsd enabled 9637235496SSimon Guinot# bit5-3: 000, required 9737235496SSimon Guinot# bit6: 1, DDR ODT control msb, enabled 9837235496SSimon Guinot# bit9-7: 000, required 9937235496SSimon Guinot# bit10: 0, differential DQS enabled 10037235496SSimon Guinot# bit11: 0, required 10137235496SSimon Guinot# bit12: 0, DDR output buffer enabled 10237235496SSimon Guinot# bit31-13: 0 required 10337235496SSimon Guinot 10437235496SSimon GuinotDATA 0xFFD01424 0x0000F07F # DDR Controller Control High 10537235496SSimon Guinot# bit2-0: 111, required 10637235496SSimon Guinot# bit3 : 1 , MBUS Burst Chop disabled 10737235496SSimon Guinot# bit6-4: 111, required 10837235496SSimon Guinot# bit7 : 1 , D2P Latency enabled 10937235496SSimon Guinot# bit8 : 1 , add writepath sample stage, must be 1 for DDR freq >= 300MHz 11037235496SSimon Guinot# bit9 : 0 , no half clock cycle addition to dataout 11137235496SSimon Guinot# bit10 : 0 , 1/4 clock cycle skew enabled for addr/ctl signals 11237235496SSimon Guinot# bit11 : 0 , 1/4 clock cycle skew disabled for write mesh 11337235496SSimon Guinot# bit15-12: 1111 required 11437235496SSimon Guinot# bit31-16: 0 required 11537235496SSimon Guinot 11637235496SSimon GuinotDATA 0xFFD01428 0x00085520 # DDR2 ODT Read Timing (default values) 11737235496SSimon GuinotDATA 0xFFD0147C 0x00008552 # DDR2 ODT Write Timing (default values) 11837235496SSimon Guinot 11937235496SSimon GuinotDATA 0xFFD01500 0x00000000 # CS[0]n Base address to 0x0 12037235496SSimon GuinotDATA 0xFFD01504 0x07FFFFF1 # CS[0]n Size 12137235496SSimon Guinot# bit0: 1, Window enabled 12237235496SSimon Guinot# bit1: 0, Write Protect disabled 12337235496SSimon Guinot# bit3-2: 00, CS0 hit selected 12437235496SSimon Guinot# bit23-4: ones, required 12537235496SSimon Guinot# bit31-24: 0x07, Size (i.e. 128MB) 12637235496SSimon Guinot 12737235496SSimon GuinotDATA 0xFFD0150C 0x00000000 # CS[1]n Size, window disabled 12837235496SSimon GuinotDATA 0xFFD01514 0x00000000 # CS[2]n Size, window disabled 12937235496SSimon GuinotDATA 0xFFD0151C 0x00000000 # CS[3]n Size, window disabled 13037235496SSimon Guinot 13137235496SSimon GuinotDATA 0xFFD01494 0x00010000 # DDR ODT Control (Low) 13237235496SSimon Guinot# bit3-0: 1, ODT0Rd, MODT[0] asserted during read from DRAM CS0 13337235496SSimon Guinot# bit19-16:1, ODT0Wr, MODT[0] asserted during write to DRAM CS0 13437235496SSimon Guinot 13537235496SSimon GuinotDATA 0xFFD01498 0x00000000 # DDR ODT Control (High) 13637235496SSimon Guinot# bit1-0: 00, ODT0 controlled by ODT Control (low) register above 13737235496SSimon Guinot# bit3-2: 01, ODT1 active NEVER! 13837235496SSimon Guinot# bit31-4: zero, required 13937235496SSimon Guinot 14037235496SSimon GuinotDATA 0xFFD0149C 0x0000E40F # CPU ODT Control 14137235496SSimon Guinot# bit3-0: 1, ODT0Rd, Internal ODT asserted during read from DRAM bank0 14237235496SSimon Guinot# bit7-4: 1, ODT0Wr, Internal ODT asserted during write to DRAM bank0 14337235496SSimon Guinot# bit11-10:1, DQ_ODTSel. ODT select turned on 14437235496SSimon Guinot 14537235496SSimon GuinotDATA 0xFFD01480 0x00000001 # DDR Initialization Control 14637235496SSimon Guinot#bit0=1, enable DDR init upon this register write 14737235496SSimon Guinot 14837235496SSimon Guinot# End of Header extension 14937235496SSimon GuinotDATA 0x0 0x0 150