From patchwork Thu Dec 9 02:55:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: York Sun X-Patchwork-Id: 74839 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id BFBAAB6F11 for ; Thu, 9 Dec 2010 13:57:14 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A8B28281C3; Thu, 9 Dec 2010 03:56:42 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cRT9pOWU5Fut; Thu, 9 Dec 2010 03:56:42 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ACD15281DD; Thu, 9 Dec 2010 03:56:16 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0813128191 for ; Thu, 9 Dec 2010 03:56:14 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YDzdmw+HR-GX for ; Thu, 9 Dec 2010 03:56:12 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from TX2EHSOBE009.bigfish.com (tx2ehsobe004.messaging.microsoft.com [65.55.88.14]) by theia.denx.de (Postfix) with ESMTPS id 05F632818B for ; Thu, 9 Dec 2010 03:55:56 +0100 (CET) Received: from mail143-tx2-R.bigfish.com (10.9.14.244) by TX2EHSOBE009.bigfish.com (10.9.40.29) with Microsoft SMTP Server id 14.1.225.8; Thu, 9 Dec 2010 02:55:54 +0000 Received: from mail143-tx2 (localhost.localdomain [127.0.0.1]) by mail143-tx2-R.bigfish.com (Postfix) with ESMTP id B31071B0010C for ; Thu, 9 Dec 2010 02:55:54 +0000 (UTC) X-SpamScore: 3 X-BigFish: VS3(zz853kzz1202hzz8275bhz2dh2a8h668h63h) X-Spam-TCS-SCL: 2:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:de01egw02.freescale.net; RD:de01egw02.freescale.net; EFVD:NLI Received: from mail143-tx2 (localhost.localdomain [127.0.0.1]) by mail143-tx2 (MessageSwitch) id 1291863354378331_11647; Thu, 9 Dec 2010 02:55:54 +0000 (UTC) Received: from TX2EHSMHS029.bigfish.com (unknown [10.9.14.240]) by mail143-tx2.bigfish.com (Postfix) with ESMTP id 5942D368050 for ; Thu, 9 Dec 2010 02:55:54 +0000 (UTC) Received: from de01egw02.freescale.net (192.88.165.103) by TX2EHSMHS029.bigfish.com (10.9.99.129) with Microsoft SMTP Server (TLS) id 14.1.225.8; Thu, 9 Dec 2010 02:55:53 +0000 Received: from az33smr02.freescale.net (az33smr02.freescale.net [10.64.34.200]) by de01egw02.freescale.net (8.14.3/8.14.3) with ESMTP id oB92tqAt001165 for ; Wed, 8 Dec 2010 19:55:53 -0700 (MST) Received: from localhost.localdomain (mvp-10-214-72-131.am.freescale.net [10.214.72.131]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id oB92tg6n025877; Wed, 8 Dec 2010 20:55:51 -0600 (CST) From: York Sun To: Date: Wed, 8 Dec 2010 18:55:40 -0800 Message-ID: <1291863340-4354-10-git-send-email-yorksun@freescale.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1291863340-4354-1-git-send-email-yorksun@freescale.com> References: <1291863340-4354-1-git-send-email-yorksun@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com Subject: [U-Boot] [PATCH 10/10] Extend board specific parameters X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Extend board specific parameters to include write leveling start override Extend write leveling sample to 0xf Adding rcw overrid for quad-rank RDIMMs Signed-off-by: York Sun --- board/freescale/corenet_ds/ddr.c | 120 +++++++++++++++++++++----------------- 1 files changed, 66 insertions(+), 54 deletions(-) diff --git a/board/freescale/corenet_ds/ddr.c b/board/freescale/corenet_ds/ddr.c index 0eb290d..74339b5 100644 --- a/board/freescale/corenet_ds/ddr.c +++ b/board/freescale/corenet_ds/ddr.c @@ -145,6 +145,7 @@ typedef struct { u32 datarate_mhz_high; u32 n_ranks; u32 clk_adjust; + u32 wrlvl_start; u32 cpo; u32 write_data_delay; u32 force_2T; @@ -164,57 +165,57 @@ typedef struct { /* XXX: Single rank at 800 MHz is OK. */ const board_specific_parameters_t board_specific_parameters[][30] = { { - /* memory controller 0 */ - /* lo| hi| num| clk| cpo|wrdata|2T */ - /* mhz| mhz|ranks|adjst| | delay| */ - { 0, 333, 4, 5, 0xff, 2, 0}, - {334, 400, 4, 5, 0xff, 2, 0}, - {401, 549, 4, 5, 0xff, 2, 0}, - {550, 680, 4, 5, 0xff, 2, 0}, - {681, 850, 4, 5, 0xff, 2, 0}, - {851, 1050, 4, 5, 0xff, 2, 0}, - {1051, 1250, 4, 5, 0xff, 2, 0}, - {1251, 1350, 4, 5, 0xff, 2, 0}, - { 0, 333, 2, 5, 0xff, 2, 0}, - {334, 400, 2, 5, 0xff, 2, 0}, - {401, 549, 2, 5, 0xff, 2, 0}, - {550, 680, 2, 5, 0xff, 2, 0}, - {681, 850, 2, 5, 0xff, 2, 0}, - {851, 1050, 2, 5, 0xff, 2, 0}, - {1051, 1250, 2, 5, 0xff, 2, 0}, - {1251, 1350, 2, 5, 0xff, 2, 0}, - { 0, 333, 1, 5, 0xff, 2, 0}, - {334, 400, 1, 5, 0xff, 2, 0}, - {401, 549, 1, 5, 0xff, 2, 0}, - {550, 680, 1, 5, 0xff, 2, 0}, - {681, 850, 1, 5, 0xff, 2, 0} + /* memory controller 0 */ + /* lo| hi| num| clk| wrlvl | cpo |wrdata|2T */ + /* mhz| mhz|ranks|adjst| start | delay| */ + { 0, 333, 4, 5, 7, 0xff, 2, 0}, + {334, 400, 4, 5, 7, 0xff, 2, 0}, + {401, 549, 4, 5, 7, 0xff, 2, 0}, + {550, 680, 4, 5, 7, 0xff, 2, 0}, + {681, 850, 4, 5, 7, 0xff, 2, 0}, + {851, 1050, 4, 5, 7, 0xff, 2, 0}, + {1051, 1250, 4, 5, 8, 0xff, 2, 0}, + {1251, 1350, 4, 5, 9, 0xff, 2, 0}, + { 0, 333, 2, 5, 7, 0xff, 2, 0}, + {334, 400, 2, 5, 7, 0xff, 2, 0}, + {401, 549, 2, 5, 7, 0xff, 2, 0}, + {550, 680, 2, 5, 7, 0xff, 2, 0}, + {681, 850, 2, 5, 7, 0xff, 2, 0}, + {851, 1050, 2, 5, 7, 0xff, 2, 0}, + {1051, 1250, 2, 5, 7, 0xff, 2, 0}, + {1251, 1350, 2, 5, 7, 0xff, 2, 0}, + { 0, 333, 1, 5, 7, 0xff, 2, 0}, + {334, 400, 1, 5, 7, 0xff, 2, 0}, + {401, 549, 1, 5, 7, 0xff, 2, 0}, + {550, 680, 1, 5, 7, 0xff, 2, 0}, + {681, 850, 1, 5, 7, 0xff, 2, 0} }, { - /* memory controller 1 */ - /* lo| hi| num| clk| cpo|wrdata|2T */ - /* mhz| mhz|ranks|adjst| | delay| */ - { 0, 333, 4, 5, 0xff, 2, 0}, - {334, 400, 4, 5, 0xff, 2, 0}, - {401, 549, 4, 5, 0xff, 2, 0}, - {550, 680, 4, 5, 0xff, 2, 0}, - {681, 850, 4, 5, 0xff, 2, 0}, - {851, 1050, 4, 5, 0xff, 2, 0}, - {1051, 1250, 4, 5, 0xff, 2, 0}, - {1251, 1350, 4, 5, 0xff, 2, 0}, - { 0, 333, 2, 5, 0xff, 2, 0}, - {334, 400, 2, 5, 0xff, 2, 0}, - {401, 549, 2, 5, 0xff, 2, 0}, - {550, 680, 2, 5, 0xff, 2, 0}, - {681, 850, 2, 5, 0xff, 2, 0}, - {851, 1050, 2, 5, 0xff, 2, 0}, - {1051, 1250, 2, 5, 0xff, 2, 0}, - {1251, 1350, 2, 5, 0xff, 2, 0}, - { 0, 333, 1, 5, 0xff, 2, 0}, - {334, 400, 1, 5, 0xff, 2, 0}, - {401, 549, 1, 5, 0xff, 2, 0}, - {550, 680, 1, 5, 0xff, 2, 0}, - {681, 850, 1, 5, 0xff, 2, 0} + /* memory controller 1 */ + /* lo| hi| num| clk| wrlvl | cpo |wrdata|2T */ + /* mhz| mhz|ranks|adjst| start | delay| */ + { 0, 333, 4, 5, 7, 0xff, 2, 0}, + {334, 400, 4, 5, 7, 0xff, 2, 0}, + {401, 549, 4, 5, 7, 0xff, 2, 0}, + {550, 680, 4, 5, 7, 0xff, 2, 0}, + {681, 850, 4, 5, 7, 0xff, 2, 0}, + {851, 1050, 4, 5, 7, 0xff, 2, 0}, + {1051, 1250, 4, 5, 8, 0xff, 2, 0}, + {1251, 1350, 4, 5, 9, 0xff, 2, 0}, + { 0, 333, 2, 5, 7, 0xff, 2, 0}, + {334, 400, 2, 5, 7, 0xff, 2, 0}, + {401, 549, 2, 5, 7, 0xff, 2, 0}, + {550, 680, 2, 5, 7, 0xff, 2, 0}, + {681, 850, 2, 5, 7, 0xff, 2, 0}, + {851, 1050, 2, 5, 7, 0xff, 2, 0}, + {1051, 1250, 2, 5, 7, 0xff, 2, 0}, + {1251, 1350, 2, 5, 7, 0xff, 2, 0}, + { 0, 333, 1, 5, 7, 0xff, 2, 0}, + {334, 400, 1, 5, 7, 0xff, 2, 0}, + {401, 549, 1, 5, 7, 0xff, 2, 0}, + {550, 680, 1, 5, 7, 0xff, 2, 0}, + {681, 850, 1, 5, 7, 0xff, 2, 0} } }; @@ -236,12 +237,12 @@ void fsl_ddr_board_options(memctl_options_t *popts, for (i = 0; i < num_params; i++) { if (ddr_freq >= pbsp->datarate_mhz_low && ddr_freq <= pbsp->datarate_mhz_high && - pdimm->n_ranks == pbsp->n_ranks) { + pdimm[0].n_ranks == pbsp->n_ranks) { popts->cpo_override = pbsp->cpo; popts->write_data_delay = pbsp->write_data_delay; popts->clk_adjust = pbsp->clk_adjust; + popts->wrlvl_start = pbsp->wrlvl_start; popts->twoT_en = pbsp->force_2T; - popts->wrlvl_start = pbsp->clk_adjust + 2; } pbsp++; } @@ -255,7 +256,8 @@ void fsl_ddr_board_options(memctl_options_t *popts, * Write leveling override */ popts->wrlvl_override = 1; - popts->wrlvl_sample = 0xa; + popts->wrlvl_sample = 0xf; + /* * Rtt and Rtt_WR override */ @@ -267,9 +269,19 @@ void fsl_ddr_board_options(memctl_options_t *popts, /* DHC_EN =1, ODT = 60 Ohm */ popts->ddr_cdr1 = 0x80080000; - popts->rcw_override = 1; - popts->rcw_1 = 0x000a5000; - popts->rcw_2 = 0x00100000; + /* override SPD values. rcw_2 should vary at differnt speed */ + if (pdimm[0].n_ranks == 4) { + popts->rcw_override = 1; + popts->rcw_1 = 0x000a5a00; + if (ddr_freq <= 800) + popts->rcw_2 = 0x00000000; + else if (ddr_freq <= 1066) + popts->rcw_2 = 0x00100000; + else if (ddr_freq <= 1333) + popts->rcw_2 = 0x00200000; + else + popts->rcw_2 = 0x00300000; + } } phys_size_t initdram(int board_type)