From patchwork Thu May 26 23:25:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: York Sun X-Patchwork-Id: 97637 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 58762B6F70 for ; Fri, 27 May 2011 09:26:24 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2FAA428153; Fri, 27 May 2011 01:26:18 +0200 (CEST) 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 uqTy-Go2-xYj; Fri, 27 May 2011 01:26:17 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5A5D528150; Fri, 27 May 2011 01:26:13 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5445028146 for ; Fri, 27 May 2011 01:26:07 +0200 (CEST) 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 fluGZ6mUzk0o for ; Fri, 27 May 2011 01:26:06 +0200 (CEST) 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 AM1EHSOBE001.bigfish.com (am1ehsobe001.messaging.microsoft.com [213.199.154.204]) by theia.denx.de (Postfix) with ESMTPS id 04DE12813D for ; Fri, 27 May 2011 01:26:03 +0200 (CEST) Received: from mail52-am1-R.bigfish.com (10.3.201.252) by AM1EHSOBE001.bigfish.com (10.3.204.21) with Microsoft SMTP Server id 14.1.225.22; Thu, 26 May 2011 23:26:03 +0000 Received: from mail52-am1 (localhost.localdomain [127.0.0.1]) by mail52-am1-R.bigfish.com (Postfix) with ESMTP id 76E4E1780336 for ; Thu, 26 May 2011 23:26:03 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839h) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail52-am1 (localhost.localdomain [127.0.0.1]) by mail52-am1 (MessageSwitch) id 1306452363327625_1744; Thu, 26 May 2011 23:26:03 +0000 (UTC) Received: from AM1EHSMHS013.bigfish.com (unknown [10.3.201.253]) by mail52-am1.bigfish.com (Postfix) with ESMTP id 4474C7C8050 for ; Thu, 26 May 2011 23:26:03 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by AM1EHSMHS013.bigfish.com (10.3.207.151) with Microsoft SMTP Server (TLS) id 14.1.225.22; Thu, 26 May 2011 23:26:02 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server id 14.1.270.2; Thu, 26 May 2011 18:26:01 -0500 Received: from localhost.localdomain (vpn-10-214-200-8.ap.freescale.net [10.214.200.8]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p4QNPv9n000699; Thu, 26 May 2011 18:25:59 -0500 (CDT) From: York Sun To: Date: Fri, 27 May 2011 07:25:48 +0800 Message-ID: <1306452353-11611-2-git-send-email-yorksun@freescale.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1306452353-11611-1-git-send-email-yorksun@freescale.com> References: <1306452353-11611-1-git-send-email-yorksun@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com Subject: [U-Boot] [PATCH 2/7] powerpc/mpc8xxx: adjust DDR burst length and chop accroding to sdram width 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 From: york If the bus width is 32-bit, burst chop should be disabled and burst length should be 8. Read from SPD or other source to determine the width. Signed-off-by: York Sun --- arch/powerpc/cpu/mpc8xxx/ddr/options.c | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/cpu/mpc8xxx/ddr/options.c b/arch/powerpc/cpu/mpc8xxx/ddr/options.c index 6ccc3b0..80c7046 100644 --- a/arch/powerpc/cpu/mpc8xxx/ddr/options.c +++ b/arch/powerpc/cpu/mpc8xxx/ddr/options.c @@ -418,8 +418,19 @@ unsigned int populate_memctl_options(int all_DIMMs_registered, /* Choose dynamic power management mode. */ popts->dynamic_power = 0; - /* 0 = 64-bit, 1 = 32-bit, 2 = 16-bit */ - popts->data_bus_width = 0; + /* + * check first dimm for primary sdram width + * presuming all dimms are similar + * 0 = 64-bit, 1 = 32-bit, 2 = 16-bit + */ + if (pdimm[0].primary_sdram_width == 64) + popts->data_bus_width = 0; + else if (pdimm[0].primary_sdram_width == 32) + popts->data_bus_width = 1; + else if (pdimm[0].primary_sdram_width == 16) + popts->data_bus_width = 2; + else + panic("Error: invalid primary sdram width!\n"); /* Choose burst length. */ #if defined(CONFIG_FSL_DDR3) @@ -427,8 +438,13 @@ unsigned int populate_memctl_options(int all_DIMMs_registered, popts->OTF_burst_chop_en = 0; /* on-the-fly burst chop disable */ popts->burst_length = DDR_BL8; /* Fixed 8-beat burst len */ #else - popts->OTF_burst_chop_en = 1; /* on-the-fly burst chop */ - popts->burst_length = DDR_OTF; /* on-the-fly BC4 and BL8 */ + if (popts->data_bus_width == 1) { /* 32-bit bus */ + popts->OTF_burst_chop_en = 0; + popts->burst_length = DDR_BL8; + } else { + popts->OTF_burst_chop_en = 1; /* on-the-fly burst chop */ + popts->burst_length = DDR_OTF; /* on-the-fly BC4 and BL8 */ + } #endif #else popts->burst_length = DDR_BL4; /* has to be 4 for DDR2 */