179642098SSimon Guinot# 279642098SSimon Guinot# Copyright (C) 2011 Simon Guinot <sguinot@lacie.com> 379642098SSimon Guinot# 479642098SSimon Guinot# Based on Kirkwood support: 579642098SSimon Guinot# (C) Copyright 2009 679642098SSimon Guinot# Marvell Semiconductor <www.marvell.com> 779642098SSimon Guinot# Written-by: Prafulla Wadaskar <prafulla@marvell.com> 879642098SSimon Guinot# 9*1a459660SWolfgang Denk# SPDX-License-Identifier: GPL-2.0+ 1079642098SSimon Guinot# 11b1e6c4c3SAnatolij Gustschin# Refer doc/README.kwbimage for more details about how-to configure 1279642098SSimon Guinot# and create kirkwood boot image 1379642098SSimon Guinot# 1479642098SSimon Guinot 1579642098SSimon Guinot# Boot Media configurations 1679642098SSimon GuinotBOOT_FROM spi # Boot from SPI flash 1779642098SSimon Guinot 1879642098SSimon Guinot# SOC registers configuration using bootrom header extension 1979642098SSimon Guinot# Maximum KWBIMAGE_MAX_CONFIG configurations allowed 2079642098SSimon Guinot 2179642098SSimon Guinot# Configure RGMII-0 interface pad voltage to 1.8V 2279642098SSimon GuinotDATA 0xFFD100e0 0x1B1B1B9B 2379642098SSimon Guinot 2479642098SSimon Guinot#Dram initalization for SINGLE x16 CL=5 @ 400MHz 2579642098SSimon GuinotDATA 0xFFD01400 0x43000618 # DDR Configuration register 2679642098SSimon Guinot# bit13-0: 0xa00 (2560 DDR2 clks refresh rate) 2779642098SSimon Guinot# bit23-14: zero 2879642098SSimon Guinot# bit24: 1= enable exit self refresh mode on DDR access 2979642098SSimon Guinot# bit25: 1 required 3079642098SSimon Guinot# bit29-26: zero 3179642098SSimon Guinot# bit31-30: 01 3279642098SSimon Guinot 3379642098SSimon GuinotDATA 0xFFD01404 0x35143000 # DDR Controller Control Low 3479642098SSimon Guinot# bit 4: 0=addr/cmd in smame cycle 3579642098SSimon Guinot# bit 5: 0=clk is driven during self refresh, we don't care for APX 3679642098SSimon Guinot# bit 6: 0=use recommended falling edge of clk for addr/cmd 3779642098SSimon Guinot# bit14: 0=input buffer always powered up 3879642098SSimon Guinot# bit18: 1=cpu lock transaction enabled 3979642098SSimon Guinot# bit23-20: 5=recommended value for CL=5 and STARTBURST_DEL disabled bit31=0 4079642098SSimon Guinot# bit27-24: 8= CL+3, STARTBURST sample stages, for freqs 400MHz, unbuffered DIMM 4179642098SSimon Guinot# bit30-28: 3 required 4279642098SSimon Guinot# bit31: 0=no additional STARTBURST delay 4379642098SSimon Guinot 4479642098SSimon GuinotDATA 0xFFD01408 0x11012228 # DDR Timing (Low) (active cycles value +1) 4579642098SSimon Guinot# bit7-4: TRCD 4679642098SSimon Guinot# bit11- 8: TRP 4779642098SSimon Guinot# bit15-12: TWR 4879642098SSimon Guinot# bit19-16: TWTR 4979642098SSimon Guinot# bit20: TRAS msb 5079642098SSimon Guinot# bit23-21: 0x0 5179642098SSimon Guinot# bit27-24: TRRD 5279642098SSimon Guinot# bit31-28: TRTP 5379642098SSimon Guinot 5479642098SSimon GuinotDATA 0xFFD0140C 0x00000A19 # DDR Timing (High) 5579642098SSimon Guinot# bit6-0: TRFC 5679642098SSimon Guinot# bit8-7: TR2R 5779642098SSimon Guinot# bit10-9: TR2W 5879642098SSimon Guinot# bit12-11: TW2W 5979642098SSimon Guinot# bit31-13: zero required 6079642098SSimon Guinot 61f697997aSSimon GuinotDATA 0xFFD01410 0x0000000C # DDR Address Control 62f697997aSSimon Guinot# bit1-0: 00, Cs0width=x8 6379642098SSimon Guinot# bit3-2: 11, Cs0size=1Gb 6479642098SSimon Guinot# bit5-4: 00, Cs2width=nonexistent 6579642098SSimon Guinot# bit7-6: 00, Cs1size =nonexistent 6679642098SSimon Guinot# bit9-8: 00, Cs2width=nonexistent 6779642098SSimon Guinot# bit11-10: 00, Cs2size =nonexistent 6879642098SSimon Guinot# bit13-12: 00, Cs3width=nonexistent 6979642098SSimon Guinot# bit15-14: 00, Cs3size =nonexistent 7079642098SSimon Guinot# bit16: 0, Cs0AddrSel 7179642098SSimon Guinot# bit17: 0, Cs1AddrSel 7279642098SSimon Guinot# bit18: 0, Cs2AddrSel 7379642098SSimon Guinot# bit19: 0, Cs3AddrSel 7479642098SSimon Guinot# bit31-20: 0 required 7579642098SSimon Guinot 7679642098SSimon GuinotDATA 0xFFD01414 0x00000000 # DDR Open Pages Control 7779642098SSimon Guinot# bit0: 0, OpenPage enabled 7879642098SSimon Guinot# bit31-1: 0 required 7979642098SSimon Guinot 8079642098SSimon GuinotDATA 0xFFD01418 0x00000000 # DDR Operation 8179642098SSimon Guinot# bit3-0: 0x0, DDR cmd 8279642098SSimon Guinot# bit31-4: 0 required 8379642098SSimon Guinot 8479642098SSimon GuinotDATA 0xFFD0141C 0x00000632 # DDR Mode 8579642098SSimon Guinot# bit2-0: 2, BurstLen=2 required 8679642098SSimon Guinot# bit3: 0, BurstType=0 required 8779642098SSimon Guinot# bit6-4: 4, CL=5 8879642098SSimon Guinot# bit7: 0, TestMode=0 normal 8979642098SSimon Guinot# bit8: 0, DLL reset=0 normal 9079642098SSimon Guinot# bit11-9: 6, auto-precharge write recovery ???????????? 9179642098SSimon Guinot# bit12: 0, PD must be zero 9279642098SSimon Guinot# bit31-13: 0 required 9379642098SSimon Guinot 9479642098SSimon GuinotDATA 0xFFD01420 0x00000004 # DDR Extended Mode 9579642098SSimon Guinot# bit0: 0, DDR DLL enabled 9679642098SSimon Guinot# bit1: 1, DDR drive strenght reduced 9779642098SSimon Guinot# bit2: 1, DDR ODT control lsd enabled 9879642098SSimon Guinot# bit5-3: 000, required 9979642098SSimon Guinot# bit6: 1, DDR ODT control msb, enabled 10079642098SSimon Guinot# bit9-7: 000, required 10179642098SSimon Guinot# bit10: 0, differential DQS enabled 10279642098SSimon Guinot# bit11: 0, required 10379642098SSimon Guinot# bit12: 0, DDR output buffer enabled 10479642098SSimon Guinot# bit31-13: 0 required 10579642098SSimon Guinot 10679642098SSimon GuinotDATA 0xFFD01424 0x0000F07F # DDR Controller Control High 10779642098SSimon Guinot# bit2-0: 111, required 10879642098SSimon Guinot# bit3 : 1 , MBUS Burst Chop disabled 10979642098SSimon Guinot# bit6-4: 111, required 11079642098SSimon Guinot# bit7 : 1 , D2P Latency enabled 11179642098SSimon Guinot# bit8 : 1 , add writepath sample stage, must be 1 for DDR freq >= 300MHz 11279642098SSimon Guinot# bit9 : 0 , no half clock cycle addition to dataout 11379642098SSimon Guinot# bit10 : 0 , 1/4 clock cycle skew enabled for addr/ctl signals 11479642098SSimon Guinot# bit11 : 0 , 1/4 clock cycle skew disabled for write mesh 11579642098SSimon Guinot# bit15-12: 1111 required 11679642098SSimon Guinot# bit31-16: 0 required 11779642098SSimon Guinot 11879642098SSimon GuinotDATA 0xFFD01428 0x00085520 # DDR2 ODT Read Timing (default values) 11979642098SSimon GuinotDATA 0xFFD0147C 0x00008552 # DDR2 ODT Write Timing (default values) 12079642098SSimon Guinot 12179642098SSimon GuinotDATA 0xFFD01500 0x00000000 # CS[0]n Base address to 0x0 12279642098SSimon GuinotDATA 0xFFD01504 0x0FFFFFF1 # CS[0]n Size 12379642098SSimon Guinot# bit0: 1, Window enabled 12479642098SSimon Guinot# bit1: 0, Write Protect disabled 12579642098SSimon Guinot# bit3-2: 00, CS0 hit selected 12679642098SSimon Guinot# bit23-4: ones, required 12779642098SSimon Guinot# bit31-24: 0x07, Size (i.e. 128MB) 12879642098SSimon Guinot 12979642098SSimon GuinotDATA 0xFFD0150C 0x00000000 # CS[1]n Size, window disabled 13079642098SSimon GuinotDATA 0xFFD01514 0x00000000 # CS[2]n Size, window disabled 13179642098SSimon GuinotDATA 0xFFD0151C 0x00000000 # CS[3]n Size, window disabled 13279642098SSimon Guinot 13379642098SSimon GuinotDATA 0xFFD01494 0x00010000 # DDR ODT Control (Low) 13479642098SSimon Guinot# bit3-0: 1, ODT0Rd, MODT[0] asserted during read from DRAM CS0 13579642098SSimon Guinot# bit19-16:1, ODT0Wr, MODT[0] asserted during write to DRAM CS0 13679642098SSimon Guinot 13779642098SSimon GuinotDATA 0xFFD01498 0x00000000 # DDR ODT Control (High) 13879642098SSimon Guinot# bit1-0: 00, ODT0 controlled by ODT Control (low) register above 13979642098SSimon Guinot# bit3-2: 01, ODT1 active NEVER! 14079642098SSimon Guinot# bit31-4: zero, required 14179642098SSimon Guinot 14279642098SSimon GuinotDATA 0xFFD0149C 0x0000E40F # CPU ODT Control 14379642098SSimon Guinot# bit3-0: 1, ODT0Rd, Internal ODT asserted during read from DRAM bank0 14479642098SSimon Guinot# bit7-4: 1, ODT0Wr, Internal ODT asserted during write to DRAM bank0 14579642098SSimon Guinot# bit11-10:1, DQ_ODTSel. ODT select turned on 14679642098SSimon Guinot 14779642098SSimon GuinotDATA 0xFFD01480 0x00000001 # DDR Initialization Control 14879642098SSimon Guinot#bit0=1, enable DDR init upon this register write 14979642098SSimon Guinot 15079642098SSimon Guinot# End of Header extension 15179642098SSimon GuinotDATA 0x0 0x0 152