116b76705SSiddarth Gore# 216b76705SSiddarth Gore# (C) Copyright 2009 316b76705SSiddarth Gore# Marvell Semiconductor <www.marvell.com> 416b76705SSiddarth Gore# Written-by: Siddarth Gore <gores@marvell.com> 516b76705SSiddarth Gore# 6*1a459660SWolfgang Denk# SPDX-License-Identifier: GPL-2.0+ 716b76705SSiddarth Gore# 8b1e6c4c3SAnatolij Gustschin# Refer doc/README.kwbimage for more details about how-to configure 916b76705SSiddarth Gore# and create kirkwood boot image 1016b76705SSiddarth Gore# 1116b76705SSiddarth Gore 1216b76705SSiddarth Gore# Boot Media configurations 1316b76705SSiddarth GoreBOOT_FROM nand 1416b76705SSiddarth GoreNAND_ECC_MODE default 1516b76705SSiddarth GoreNAND_PAGE_SIZE 0x0800 1616b76705SSiddarth Gore 1716b76705SSiddarth Gore# SOC registers configuration using bootrom header extension 1816b76705SSiddarth Gore# Maximum KWBIMAGE_MAX_CONFIG configurations allowed 1916b76705SSiddarth Gore 2016b76705SSiddarth Gore# Configure RGMII-0/1 interface pad voltage to 1.8V 2116b76705SSiddarth GoreDATA 0xFFD100e0 0x1b1b9b9b 2216b76705SSiddarth Gore 2316b76705SSiddarth Gore#Dram initalization for SINGLE x16 CL=5 @ 400MHz 2416b76705SSiddarth GoreDATA 0xFFD01400 0x43000c30 # DDR Configuration register 2516b76705SSiddarth Gore# bit13-0: 0xc30 (3120 DDR2 clks refresh rate) 2616b76705SSiddarth Gore# bit23-14: zero 2716b76705SSiddarth Gore# bit24: 1= enable exit self refresh mode on DDR access 2816b76705SSiddarth Gore# bit25: 1 required 2916b76705SSiddarth Gore# bit29-26: zero 3016b76705SSiddarth Gore# bit31-30: 01 3116b76705SSiddarth Gore 3216b76705SSiddarth GoreDATA 0xFFD01404 0x37543000 # DDR Controller Control Low 3316b76705SSiddarth Gore# bit 4: 0=addr/cmd in smame cycle 3416b76705SSiddarth Gore# bit 5: 0=clk is driven during self refresh, we don't care for APX 3516b76705SSiddarth Gore# bit 6: 0=use recommended falling edge of clk for addr/cmd 3616b76705SSiddarth Gore# bit14: 0=input buffer always powered up 3716b76705SSiddarth Gore# bit18: 1=cpu lock transaction enabled 3816b76705SSiddarth Gore# bit23-20: 5=recommended value for CL=5 and STARTBURST_DEL disabled bit31=0 3916b76705SSiddarth Gore# bit27-24: 7= CL+2, STARTBURST sample stages, for freqs 400MHz, unbuffered DIMM 4016b76705SSiddarth Gore# bit30-28: 3 required 4116b76705SSiddarth Gore# bit31: 0=no additional STARTBURST delay 4216b76705SSiddarth Gore 4316b76705SSiddarth GoreDATA 0xFFD01408 0x22125451 # DDR Timing (Low) (active cycles value +1) 4416b76705SSiddarth Gore# bit3-0: TRAS lsbs 4516b76705SSiddarth Gore# bit7-4: TRCD 4616b76705SSiddarth Gore# bit11- 8: TRP 4716b76705SSiddarth Gore# bit15-12: TWR 4816b76705SSiddarth Gore# bit19-16: TWTR 4916b76705SSiddarth Gore# bit20: TRAS msb 5016b76705SSiddarth Gore# bit23-21: 0x0 5116b76705SSiddarth Gore# bit27-24: TRRD 5216b76705SSiddarth Gore# bit31-28: TRTP 5316b76705SSiddarth Gore 5416b76705SSiddarth GoreDATA 0xFFD0140C 0x00000a33 # DDR Timing (High) 5516b76705SSiddarth Gore# bit6-0: TRFC 5616b76705SSiddarth Gore# bit8-7: TR2R 5716b76705SSiddarth Gore# bit10-9: TR2W 5816b76705SSiddarth Gore# bit12-11: TW2W 5916b76705SSiddarth Gore# bit31-13: zero required 6016b76705SSiddarth Gore 6116b76705SSiddarth GoreDATA 0xFFD01410 0x000000cc # DDR Address Control 6216b76705SSiddarth Gore# bit1-0: 01, Cs0width=x8 6316b76705SSiddarth Gore# bit3-2: 10, Cs0size=1Gb 6416b76705SSiddarth Gore# bit5-4: 01, Cs1width=x8 6516b76705SSiddarth Gore# bit7-6: 10, Cs1size=1Gb 6616b76705SSiddarth Gore# bit9-8: 00, Cs2width=nonexistent 6716b76705SSiddarth Gore# bit11-10: 00, Cs2size =nonexistent 6816b76705SSiddarth Gore# bit13-12: 00, Cs3width=nonexistent 6916b76705SSiddarth Gore# bit15-14: 00, Cs3size =nonexistent 7016b76705SSiddarth Gore# bit16: 0, Cs0AddrSel 7116b76705SSiddarth Gore# bit17: 0, Cs1AddrSel 7216b76705SSiddarth Gore# bit18: 0, Cs2AddrSel 7316b76705SSiddarth Gore# bit19: 0, Cs3AddrSel 7416b76705SSiddarth Gore# bit31-20: 0 required 7516b76705SSiddarth Gore 7616b76705SSiddarth GoreDATA 0xFFD01414 0x00000000 # DDR Open Pages Control 7716b76705SSiddarth Gore# bit0: 0, OpenPage enabled 7816b76705SSiddarth Gore# bit31-1: 0 required 7916b76705SSiddarth Gore 8016b76705SSiddarth GoreDATA 0xFFD01418 0x00000000 # DDR Operation 8116b76705SSiddarth Gore# bit3-0: 0x0, DDR cmd 8216b76705SSiddarth Gore# bit31-4: 0 required 8316b76705SSiddarth Gore 8416b76705SSiddarth GoreDATA 0xFFD0141C 0x00000C52 # DDR Mode 8516b76705SSiddarth Gore# bit2-0: 2, BurstLen=2 required 8616b76705SSiddarth Gore# bit3: 0, BurstType=0 required 8716b76705SSiddarth Gore# bit6-4: 4, CL=5 8816b76705SSiddarth Gore# bit7: 0, TestMode=0 normal 8916b76705SSiddarth Gore# bit8: 0, DLL reset=0 normal 9016b76705SSiddarth Gore# bit11-9: 6, auto-precharge write recovery ???????????? 9116b76705SSiddarth Gore# bit12: 0, PD must be zero 9216b76705SSiddarth Gore# bit31-13: 0 required 9316b76705SSiddarth Gore 9416b76705SSiddarth GoreDATA 0xFFD01420 0x00000040 # DDR Extended Mode 9516b76705SSiddarth Gore# bit0: 0, DDR DLL enabled 9616b76705SSiddarth Gore# bit1: 0, DDR drive strenght normal 9716b76705SSiddarth Gore# bit2: 0, DDR ODT control lsd (disabled) 9816b76705SSiddarth Gore# bit5-3: 000, required 9916b76705SSiddarth Gore# bit6: 1, DDR ODT control msb, (disabled) 10016b76705SSiddarth Gore# bit9-7: 000, required 10116b76705SSiddarth Gore# bit10: 0, differential DQS enabled 10216b76705SSiddarth Gore# bit11: 0, required 10316b76705SSiddarth Gore# bit12: 0, DDR output buffer enabled 10416b76705SSiddarth Gore# bit31-13: 0 required 10516b76705SSiddarth Gore 10616b76705SSiddarth GoreDATA 0xFFD01424 0x0000F17F # DDR Controller Control High 10716b76705SSiddarth Gore# bit2-0: 111, required 10816b76705SSiddarth Gore# bit3 : 1 , MBUS Burst Chop disabled 10916b76705SSiddarth Gore# bit6-4: 111, required 11016b76705SSiddarth Gore# bit7 : 0 11116b76705SSiddarth Gore# bit8 : 1 , add writepath sample stage, must be 1 for DDR freq >= 300MHz 11216b76705SSiddarth Gore# bit9 : 0 , no half clock cycle addition to dataout 11316b76705SSiddarth Gore# bit10 : 0 , 1/4 clock cycle skew enabled for addr/ctl signals 11416b76705SSiddarth Gore# bit11 : 0 , 1/4 clock cycle skew disabled for write mesh 11516b76705SSiddarth Gore# bit15-12: 1111 required 11616b76705SSiddarth Gore# bit31-16: 0 required 11716b76705SSiddarth Gore 11816b76705SSiddarth GoreDATA 0xFFD01428 0x00085520 # DDR2 ODT Read Timing (default values) 11916b76705SSiddarth GoreDATA 0xFFD0147C 0x00008552 # DDR2 ODT Write Timing (default values) 12016b76705SSiddarth Gore 12116b76705SSiddarth GoreDATA 0xFFD01500 0x00000000 # CS[0]n Base address to 0x0 12216b76705SSiddarth GoreDATA 0xFFD01504 0x0FFFFFF1 # CS[0]n Size 12316b76705SSiddarth Gore# bit0: 1, Window enabled 12416b76705SSiddarth Gore# bit1: 0, Write Protect disabled 12516b76705SSiddarth Gore# bit3-2: 00, CS0 hit selected 12616b76705SSiddarth Gore# bit23-4: ones, required 12716b76705SSiddarth Gore# bit31-24: 0x0F, Size (i.e. 256MB) 12816b76705SSiddarth Gore 12916b76705SSiddarth GoreDATA 0xFFD01508 0x10000000 # CS[1]n Base address to 256Mb 13016b76705SSiddarth GoreDATA 0xFFD0150C 0x0FFFFFF5 # CS[1]n Size 256Mb Window enabled for CS1 13116b76705SSiddarth Gore 13216b76705SSiddarth GoreDATA 0xFFD01514 0x00000000 # CS[2]n Size, window disabled 13316b76705SSiddarth GoreDATA 0xFFD0151C 0x00000000 # CS[3]n Size, window disabled 13416b76705SSiddarth Gore 13516b76705SSiddarth GoreDATA 0xFFD01494 0x00030000 # DDR ODT Control (Low) 13616b76705SSiddarth GoreDATA 0xFFD01498 0x00000000 # DDR ODT Control (High) 13716b76705SSiddarth Gore# bit1-0: 00, ODT0 controlled by ODT Control (low) register above 13816b76705SSiddarth Gore# bit3-2: 01, ODT1 active NEVER! 13916b76705SSiddarth Gore# bit31-4: zero, required 14016b76705SSiddarth Gore 14116b76705SSiddarth GoreDATA 0xFFD0149C 0x0000E803 # CPU ODT Control 14216b76705SSiddarth GoreDATA 0xFFD01480 0x00000001 # DDR Initialization Control 14316b76705SSiddarth Gore#bit0=1, enable DDR init upon this register write 14416b76705SSiddarth Gore 14516b76705SSiddarth Gore# End of Header extension 14616b76705SSiddarth GoreDATA 0x0 0x0 147