All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haiying Wang <Haiying.Wang@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] (no subject)
Date: Fri,  3 Oct 2008 12:33:47 -0400	[thread overview]
Message-ID: <1223051627-22529-1-git-send-email-Haiying.Wang@freescale.com> (raw)

* Add board specific parameter table to choose correct cpo, clk_adjust,
write_data_delay, 2T based on board ddr frequency and n_ranks.

* Set odt_rd_cfg and odt_wr_cfg based on the dimm# and CS#.

* Set memory controller interleaving mode to bank interleaving, and disable
bank(chip select) interleaving mode by default, because the default on-board
DDR DIMMs are 2x512MB single-rank.

* Change CONFIG_ICS307_REFCLK_HZ from 33333333 to 33333000.

Signed-off-by: James Yang <James.Yang@freescale.com>
Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>
---
 board/freescale/mpc8572ds/ddr.c |  123 ++++++++++++++++++++++++++++++---------
 include/configs/MPC8572DS.h     |    3 +-
 2 files changed, 97 insertions(+), 29 deletions(-)

diff --git a/board/freescale/mpc8572ds/ddr.c b/board/freescale/mpc8572ds/ddr.c
index 435893a..171a8d5 100644
--- a/board/freescale/mpc8572ds/ddr.c
+++ b/board/freescale/mpc8572ds/ddr.c
@@ -39,42 +39,109 @@ void fsl_ddr_get_spd(ddr2_spd_eeprom_t *ctrl_dimms_spd,
 	}
 }
 
+typedef struct {
+	u32 datarate_mhz_low;
+	u32 datarate_mhz_high;
+	u32 n_ranks;
+	u32 clk_adjust;
+	u32 cpo;
+	u32 write_data_delay;
+	u32 force_2T;
+} board_specific_parameters_t;
+
+/* ranges for parameters:
+ *  wr_data_delay = 0-6
+ *  clk adjust = 0-8
+ *  cpo 2-0x1E (30)
+ */
+
+
+/* XXX: these values need to be checked for all interleaving modes.  */
+/* XXX: No reliable dual-rank 800 MHz setting has been found.  It may
+ *      seem reliable, but errors will appear when memory intensive
+ *      program is run. */
+/* XXX: Single rank at 800 MHz is OK.  */
+const board_specific_parameters_t board_specific_parameters[][20] = {
+	{
+	/* 	memory controller 0 			*/
+	/*	  lo|  hi|  num|  clk| cpo|wrdata|2T	*/
+	/*	 mhz| mhz|ranks|adjst|    | delay|	*/
+		{  0, 333,    2,    6,   7,    3,  0},
+		{334, 400,    2,    6,   9,    3,  0},
+		{401, 549,    2,    6,  11,    3,  0},
+		{550, 680,    2,    1,  10,    5,  0},
+		{681, 850,    2,    1,  12,    5,  1},
+		{  0, 333,    1,    6,   7,    3,  0},
+		{334, 400,    1,    6,   9,    3,  0},
+		{401, 549,    1,    6,  11,    3,  0},
+		{550, 680,    1,    1,  10,    5,  0},
+		{681, 850,    1,    1,  12,    5,  0}
+	},
+
+	{
+	/*	memory controller 1			*/
+	/*	  lo|  hi|  num|  clk| cpo|wrdata|2T	*/
+	/*	 mhz| mhz|ranks|adjst|    | delay|	*/
+		{  0, 333,    2,     6,  7,    3,  0},
+		{334, 400,    2,     6,  9,    3,  0},
+		{401, 549,    2,     6, 11,    3,  0},
+		{550, 680,    2,     1, 11,    6,  0},
+		{681, 850,    2,     1, 13,    6,  1},
+		{  0, 333,    1,     6,  7,    3,  0},
+		{334, 400,    1,     6,  9,    3,  0},
+		{401, 549,    1,     6, 11,    3,  0},
+		{550, 680,    1,     1, 11,    6,  0},
+		{681, 850,    1,     1, 13,    6,  0}
+	}
+};
+
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
 				unsigned int ctrl_num)
 {
-	/*
-	 * Factors to consider for clock adjust:
-	 *	- number of chips on bus
-	 *	- position of slot
-	 *	- DDR1 vs. DDR2?
-	 *	- ???
-	 *
-	 * This needs to be determined on a board-by-board basis.
-	 *	0110	3/4 cycle late
-	 *	0111	7/8 cycle late
-	 */
-	popts->clk_adjust = 7;
+	const board_specific_parameters_t *pbsp =
+				&(board_specific_parameters[ctrl_num][0]);
+	const char *p;
+	u32 num_params = sizeof(board_specific_parameters[ctrl_num]) /
+				sizeof(board_specific_parameters[0][0]);
+	u32 i;
+	ulong ddr_freq;
 
-	/*
-	 * Factors to consider for CPO:
-	 *	- frequency
-	 *	- ddr1 vs. ddr2
+	/* set odt_rd_cfg and odt_wr_cfg. If the there is only one dimm in
+	 * that controller, set odt_wr_cfg to 4 for CS0, and 0 to CS1. If
+	 * there are two dimms in the controller, set odt_rd_cfg to 3 and
+	 * odt_wr_cfg to 3 for the even CS, 0 for the odd CS.
 	 */
-	popts->cpo_override = 10;
+	for (i = 0; i < CONFIG_CHIP_SELECTS_PER_CTRL; i++) {
+		if (i&1) {	/* odd CS */
+			popts->cs_local_opts[i].odt_rd_cfg = 0;
+			popts->cs_local_opts[i].odt_wr_cfg = 0;
+		} else {	/* even CS */
+			if (CONFIG_DIMM_SLOTS_PER_CTLR == 1) {
+				popts->cs_local_opts[i].odt_rd_cfg = 0;
+				popts->cs_local_opts[i].odt_wr_cfg = 4;
+			} else if (CONFIG_DIMM_SLOTS_PER_CTLR == 2) {
+			popts->cs_local_opts[i].odt_rd_cfg = 3;
+			popts->cs_local_opts[i].odt_wr_cfg = 3;
+			}
+		}
+	}
 
-	/*
-	 * Factors to consider for write data delay:
-	 *	- number of DIMMs
-	 *
-	 * 1 = 1/4 clock delay
-	 * 2 = 1/2 clock delay
-	 * 3 = 3/4 clock delay
-	 * 4 = 1   clock delay
-	 * 5 = 5/4 clock delay
-	 * 6 = 3/2 clock delay
+	/* Get clk_adjust, cpo, write_data_delay,2T, according to the board ddr
+	 * freqency and n_banks specified in board_specific_parameters table.
 	 */
-	popts->write_data_delay = 5;
+	ddr_freq = get_ddr_freq(0) / 1000000;
+	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) {
+			popts->clk_adjust = pbsp->clk_adjust;
+			popts->cpo_override = pbsp->cpo;
+			popts->write_data_delay = pbsp->write_data_delay;
+			popts->twoT_en = pbsp->force_2T;
+		}
+		pbsp++;
+	}
 
 	/*
 	 * Factors to consider for half-strength driver enable:
diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h
index d7e3a88..82c2334 100644
--- a/include/configs/MPC8572DS.h
+++ b/include/configs/MPC8572DS.h
@@ -61,7 +61,7 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy);
 #endif
 #define CONFIG_SYS_CLK_FREQ	get_board_sys_clk(0) /* sysclk for MPC85xx */
 #define CONFIG_DDR_CLK_FREQ	get_board_ddr_clk(0) /* ddrclk for MPC85xx */
-#define CONFIG_ICS307_REFCLK_HZ	33333333  /* ICS307 clock chip ref freq */
+#define CONFIG_ICS307_REFCLK_HZ	33333000  /* ICS307 clock chip ref freq */
 #define CONFIG_GET_CLK_FROM_ICS307	  /* decode sysclk and ddrclk freq
 					     from ICS307 instead of switches */
 
@@ -532,6 +532,7 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy);
 #define CONFIG_BAUDRATE	115200
 
 #define	CONFIG_EXTRA_ENV_SETTINGS				\
+ "memctl_intlv_ctl=2\0"						\
  "netdev=eth0\0"						\
  "uboot=" MK_STR(CONFIG_UBOOTPATH) "\0"				\
  "tftpflash=tftpboot $loadaddr $uboot; "			\
-- 
1.6.0.2

             reply	other threads:[~2008-10-03 16:33 UTC|newest]

Thread overview: 229+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-03 16:33 Haiying Wang [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-08-29 13:40 [U-Boot] (no subject) Thomas Schaefer
2019-08-29 13:53 ` Fabio Estevam
2019-08-29 15:12   ` Thomas Schaefer
2019-08-29 15:21     ` Fabio Estevam
2019-06-30  2:06 Thomas Chou
2019-06-30 10:31 ` Bin Meng
2019-07-01 13:19   ` Tom Rini
2019-07-04  2:00     ` Thomas Chou
2019-07-04  1:58   ` Thomas Chou
2019-07-01 13:20 ` Tom Rini
2019-07-04  2:11   ` Thomas Chou
2019-04-28 21:45 Adam Ford
2019-04-10 14:35 [U-Boot] [PATCH v2] imx: Extend PCL063 support for phyCORE-i.MX6ULL SOM Parthiban Nallathambi
2019-04-26  8:02 ` Parthiban Nallathambi
2019-04-26  8:27   ` [U-Boot] (no subject) Stefano Babic
2019-01-19  9:37 Angelo Dureghello
2018-11-22 20:08 sjg at google.com
2018-09-20 21:07 Angelo Dureghello
2018-09-18 21:49 Jeremy Gebben
2017-05-15  9:49 [U-Boot] [PATCH v2 0/7] Add basic support for Rockchip RK3368 SOC Andy Yan
2017-05-15  9:53 ` [U-Boot] (no subject) Andy Yan
2017-04-21  3:01 Zhikang Zhang
2016-11-25 18:16 Rick Bronson
2016-07-13 14:11 [U-Boot] [PATCH] arm: imx: Add support for Advantech DMS-BA16 board Akshay Bhat
2016-07-20 16:25 ` [U-Boot] (no subject) Stefano Babic
2016-07-12 17:16 Joe Hershberger
2016-07-12 17:16 Joe Hershberger
2016-07-12 17:16 Joe Hershberger
2016-07-12 17:16 Joe Hershberger
2016-07-12 17:16 Joe Hershberger
2016-06-17 10:00 [U-Boot] [RFC] omap3: single binary supporting all flash types Ladislav Michl
2016-06-17 10:07 ` [U-Boot] (no subject) Ladislav Michl
2016-06-17 10:09 ` Ladislav Michl
2016-02-03 12:42 Peter Robinson
2016-01-20 12:25 Wenbin Song
2015-12-09  7:15 Peter Robinson
2015-11-17 12:16 wd at denx.de
2015-07-10 13:16 Samuel Egli
2014-09-12 14:45 Mariusz Boguszewski
2014-09-12 20:00 ` Michael Trimarchi
2014-09-15  8:08   ` Michael Trimarchi
2014-06-03  0:04 rajshekar_py at yahoo.com
2014-02-11 19:20 John de la Garza
     [not found] <CAP8r_=BJdRNRisEgmFmPcGbyOtpta69DtveY6iFgOqdocDy+zg@mail.gmail.com>
     [not found] ` <528D649C.1030701@boundarydevices.com>
2013-11-21  8:09   ` Bojan Buić
2013-11-21  8:34     ` Stefano Babic
2013-11-21  9:23       ` Bojan Buić
2013-11-21 14:01       ` Bojan Buić
2013-11-21 14:40         ` Stefano Babic
2013-11-21 15:08           ` Bojan Buić
2013-11-21 15:20             ` Bojan Buić
2013-11-22  7:04               ` Wolfgang Denk
     [not found] <A3D1B805C7AF9343B5A0FF6EBB7E3D34915FBE@039-SN2MPN1-023.039d.mgd.msft.net>
2013-02-08 11:44 ` Marek Vasut
2012-09-19  0:02 Troy Kisky
2012-07-19 17:38 Gigin Jose
2012-06-22 20:08 apple pie
2012-06-21  1:37 Pascal Levesque
2012-06-03  9:27 Stijn Souffriau
     [not found] <http://lists.denx.de/pipermail/u-boot/2012-March/120899.html>
2012-03-25 23:00 ` Eric Nelson
2012-03-06 21:29 Wolfgang Denk
2012-03-06 22:02 ` Mike Frysinger
2012-03-07 11:25   ` Wolfgang Denk
2012-03-08  6:37     ` Simon Glass
2012-03-08  8:16       ` Wolfgang Denk
2012-03-09 13:59         ` Simon Glass
2012-03-09  3:28       ` Mike Frysinger
2012-03-09  3:29     ` Mike Frysinger
2012-02-16  2:59 [U-Boot] [PATCH 1/5] msm7x30: Add support for low speed uart on msm7x30 mohamed.haneef at lntinfotech.com
2012-04-23  9:24 ` [U-Boot] (no subject) mohamed.haneef at lntinfotech.com
2011-12-25 15:17 larrybizz at aol.com
2011-12-17 14:22 larrybizz at aol.com
2011-11-28  0:53 Sgt.Williams Moore.
2011-11-25 20:57 ALANTIC LOANS HAPPY OFFER
2011-11-25 14:59 UK End of Year Award Notice!
2011-11-25  8:48 Gift Ismaila
2011-11-25  3:41 EQUITY LOAN FINANCE
2011-11-20 13:27 Mrs Veronica James
2011-11-17  6:20 Kenoye Eke
2011-11-17  5:32 Western Union Office
2011-11-15  0:23 Western Union Office
2011-11-14  9:02 Nokia XMAS Bonanza
2011-11-13  4:50 Uk Lottery
2011-11-09  7:08 FeDEX Logistics
2011-11-07  9:44 COCA-COLA COMPANY
2011-11-04 16:07 Loan2Day
2011-11-02 18:35 jobhunts02 at aol.com
2011-10-31 21:21 Tahani Kalender
2011-10-31 14:34 vmujica at uc.edu.ve
2011-10-31  9:21 Bar Yasser
2011-10-30 11:37 Henry, Sherie
2011-10-29  5:49 MAY BANK INTERNATIONAL PLS
2011-10-23 23:12 E-Loan & Credit Home
2011-10-20  8:23 CHEVRON OIL & GAS ANNUAL EMAIL NOTIFICATIONS
2011-10-16 22:36 Tom Kaplan
2011-10-16 12:04 jobhunts02 at aol.com
2011-10-14 13:06 COCA-COLA COMPANY PROMOTION
2011-10-09  8:06 victor casunuran
2011-10-10 14:39 ` Detlev Zundel
2011-10-07 20:48 Mr. Wen Lee
2011-10-07 20:42 Mr. Wen Lee
2011-10-05 21:54 Mr.Abdulrahman Ibrahim
2011-10-05 20:49 Mr.Wen Lee
2011-10-04 22:11 jobhunts02 at aol.com
2011-09-29  1:54 Mr. Abdulrahman Ibrahim
2011-09-20  4:40 IRISH LOTTERY
2011-09-13 21:52 Mr. Song Lile Transfer Offer 2011
2011-09-12 22:45 Mr.Wen Lee
2011-09-12  2:10 Elo Petteri
2011-09-10 20:08 UK INTERNATIONAL LOTTERY
2011-09-09 22:29 Wen Lee
2011-09-08 21:48 Coca-Cola Great Britain
     [not found] <[PATCH 5/5] coldfire: Remove board with major build issues>
2011-08-31 11:33 ` Stany MARCEL
     [not found] <[PATCH 4/5] coldfire: Remove link files entries to prevent multiple definitions>
2011-08-31 11:32 ` Stany MARCEL
2011-08-31 11:55   ` Marek Vasut
     [not found] <[PATCH 3/5] coldfire: Permit build in a different directory>
2011-08-31 11:31 ` Stany MARCEL
     [not found] <[PATCH 2/5] coldfire: Add creation of include directories for _config rules>
2011-08-31 11:30 ` Stany MARCEL
     [not found] <[PATCH 1/5] coldfire: Change timer_init return type from void to int>
2011-08-31 11:28 ` Stany MARCEL
2011-08-31 11:55   ` Stany MARCEL
2011-08-31 12:11   ` Wolfgang Denk
2011-08-30 12:49 [U-Boot] [PATCH V2] console: Implement pre-console buffer Graeme Russ
2011-08-31 12:35 ` [U-Boot] (no subject) Graeme Russ
2011-08-31 12:38   ` Graeme Russ
2011-08-27 16:54 Ronny D
2011-08-26  0:07 Ronny D
2011-08-21  5:05 Ronny D
2011-08-21  0:39 Exxon Promo
2011-08-14  3:02 shawn Bai
2011-08-13 14:48 favour good
2011-08-13  7:18 UK INTERNATIONAL LOTTERY PRIZE AWARD DEPT
2011-08-12 14:29 Ronny D
2011-08-06 19:33 Bar Yasser
2011-08-04 18:53 Thomas Petazzoni
2011-07-29  3:52 SEUMAS MCCOMBE
2011-07-25 17:20 Western Union®
2011-07-19 19:52 SURESH FINANCE
2011-07-07 21:17 SEUMAS MCCOMBE
2011-07-06  7:55 Art of England Magazine
2011-07-03 20:37 Mr Cohen Emerson
2011-07-01  2:36 THE COCA COLA COMPANY
2011-06-30 10:55 kifkifads at yahoo.fr
2011-06-26  4:47 Mr. Allan Davis
2011-06-21  3:47 Ronny D
2011-06-17  0:16 FROM JORDAN GLOBAL LOANCORPORATION
2011-06-16  9:13 MRS STITI MONA
2011-06-03 14:19 Microsoft Inc
2011-06-03 12:53 Mr Wen Lee
2011-06-03 12:51 Mr Wen Lee
2011-05-26  8:02 Yuping Luo
2011-05-24 22:29 Mr. Mark Seumas
2011-05-24 15:48 buffetcampinas at sercomtel.com.br
2011-05-17  3:01 jobhunts02 at aol.com
2011-05-15 23:28 jobhunts02 at aol.com
2011-04-30  1:09 Western Union
2011-04-25  6:53 E-Mail Admin
2011-04-22  8:32 manohar kallutla
2011-04-21 15:11 terri nechwa
2011-04-20 18:05 jeffhemstreet at yahoo.com
2011-04-20 15:32 Norton Financial Loan Company Inc
2011-04-19 21:56 jeffhemstreet at yahoo.com
2011-04-16 21:44 jeffhemstreet at yahoo.com
2011-04-07 15:32 MONDAY LOTTERY BOARD
2011-04-07 14:23 MONDAY LOTTERY BOARD
2011-04-01 12:25 DARY HARTSON
2011-03-31 20:43 E-Mail Admin
2011-03-25 13:03 Robert Pasquantonio
2011-03-24  8:37 Erik Hansen
2011-03-23  7:34 ystradgynlais.sports.centre at powys.gov.uk
2011-03-22 15:55 Norton Financial Loan Company Inc
2011-03-21 12:39 ystradgynlais.sports.centre at powys.gov.uk
2011-03-19 22:09 EURO MILLION 2011
2011-03-19 17:47 xzxcv6 at cox.net
2011-03-13 11:07 Luz Nury Fajardo Ortiz
2011-03-05  1:32 L'ALTRA DIMENSIONE
2011-02-15  9:34 [U-Boot] [PATCH] [RFC] SF: Add "sf erase offset +len" command handler Mike Frysinger
2011-02-16 20:27 ` [U-Boot] (no subject) Richard Retanubun
2011-02-17  5:46   ` Mike Frysinger
2011-01-18  4:45 Kumar Gala
2011-01-13  8:36 MrGates
2011-01-13 11:25 ` Albert ARIBAUD
2010-11-28 20:14 Wolfgang Denk
2010-12-01  6:38 ` Minkyu Kang
2010-11-28 19:43 Wolfgang Denk
2010-11-17  9:00 Jinson Wang
2010-11-16  9:29 Money Gram Transfer
2010-10-15  9:34 WESTERN UNION TRANSFER
2010-10-10  8:35 Wolfgang Denk
2010-10-11  7:49 ` Stefan Roese
2010-10-11 13:19   ` Stefan Roese
2010-10-11 13:26     ` Wolfgang Denk
2010-10-06 20:55 [U-Boot] [PATCH] board_init_r: Removed unused cmdtp variable Wolfgang Denk
2010-10-19 14:29 ` [U-Boot] (no subject) Richard Retanubun
2010-10-04 21:35 Mrs.Turner Clarissa Ann
2010-06-19 23:48 Wolfgang Denk
2010-06-02 22:09 [U-Boot] (No subject) Mr Michael Smith
2010-06-02 22:09 Mr Michael Smith
2010-06-02  5:24 [U-Boot] (no subject) SuperStore Armenia
2010-05-24 10:59 David
2010-05-24 10:50 David
2010-05-12 23:25 Important Notice
2010-05-03 15:45 Irish Online Claim
2010-04-23  3:56 BARCLAYS BANK UK
2010-04-03  4:36 Irish Online Promo
2010-02-23 18:08 Eloan Finance International Loans
2010-02-16  0:12 The uknl
2010-02-15 13:13 SHELL INTERNATIONAL LOTTERY
2010-02-06 13:14 Global Springer Link Finance
2010-02-06 11:47 Global Springer Link Finance
2010-01-27 11:21 Lancaster Terrace
2009-12-09  4:42 星杨
2009-11-10  5:03 Helen Mathew
2009-10-28  5:51 HeLei
2009-09-15  8:38 Konrad Mattheis
2009-08-21  8:55 HONDA AWARD 2009
2009-06-29  7:18 Krishna, Mahith
2009-06-29  7:47 ` Nishanth Menon
2009-06-04 10:27 Daniel Mack
2009-05-30  3:59 UKL-DEPT
2009-05-25 13:57 xiaojing mao
2009-05-25 18:12 ` Wolfgang Denk
2009-05-02 18:23 JMC INVESTMENT
2009-04-24  6:55 John Tobias
2009-04-03 22:37 Neeraj Tandon
2009-04-01  2:44 卫 王
2009-02-26 10:24 POLETTE Simon
2009-02-26 11:36 ` Wolfgang Denk
2009-02-19 13:30 md ks
2009-02-19 13:42 ` Nishanth Menon
2009-02-24  6:24   ` md ks
2009-02-19 13:48 ` Wolfgang Denk
2009-02-03  7:58 abby.zhang at semgfab.cn
2008-12-16 21:42 Cote, Sylvain
2008-10-03 16:34 Haiying Wang
2008-10-03 16:33 Haiying Wang
2008-10-03 16:33 Haiying Wang
2008-10-03 16:32 Haiying Wang
2008-10-03 16:32 Haiying Wang
2008-10-03 23:35 ` Wolfgang Denk
2008-10-04  2:39   ` Haiying Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1223051627-22529-1-git-send-email-Haiying.Wang@freescale.com \
    --to=haiying.wang@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.