Add proper SPD definitions for DDR1/2/3
Subsystems (2)
PATCH v3 1/16 Add proper SPD definitions for DDR1/2/3
From: James Yang <[email protected]>
Also added a few helper functions for DDR1 & DDR2 to print SPD info and verify the checksum.
--- common/Makefile | 1 + common/ddr_spd.c | 519 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/ddr_spd.h | 292 ++++++++++++++++++++++++++++++ 3 files changed, 812 insertions(+), 0 deletions(-) create mode 100644 common/ddr_spd.c create mode 100644 include/ddr_spd.h
common/Makefile +1 -0
@@ -150,6 +150,7 @@ COBJS-y += cmd_mac.o COBJS-$(CONFIG_CMD_MFSL) += cmd_mfsl.o COBJS-$(CONFIG_MP) += cmd_mp.o COBJS-$(CONFIG_CMD_SF) += cmd_sf.o +COBJS-$(CONFIG_DDR_SPD) += ddr_spd.o COBJS := $(COBJS-y) SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c)
common/ddr_spd.c new file +519 -0
519 lines not on this page · raw message
include/ddr_spd.h new file +292 -0
292 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH v3 2/16 FSL DDR: Rewrite the FSL mpc8xxx DDR controller setup code.
--- cpu/mpc85xx/Makefile | 9 + cpu/mpc86xx/Makefile | 4 + cpu/mpc8xxx/Makefile | 29 + cpu/mpc8xxx/common_timing_params.h | 55 ++ cpu/mpc8xxx/ddr2_dimm_params.h | 86 +++ cpu/mpc8xxx/fsl_ddr_ctrl.c | 1002 +++++++++++++++++++++++++++++++ cpu/mpc8xxx/fsl_ddr_sdram.c | 1134 ++++++++++++++++++++++++++++++++++++ cpu/mpc8xxx/fsl_ddr_sdram.h | 90 +++ cpu/mpc8xxx/fsl_memctrl.h | 44 ++ cpu/mpc8xxx/fsl_util.c | 59 ++ cpu/mpc8xxx/memctl_options.h | 85 +++ 11 files changed, 2597 insertions(+), 0 deletions(-) create mode 100644 cpu/mpc8xxx/Makefile create mode 100644 cpu/mpc8xxx/common_timing_params.h create mode 100644 cpu/mpc8xxx/ddr2_dimm_params.h create mode 100644 cpu/mpc8xxx/fsl_ddr_ctrl.c create mode 100644 cpu/mpc8xxx/fsl_ddr_sdram.c create mode 100644 cpu/mpc8xxx/fsl_ddr_sdram.h create mode 100644 cpu/mpc8xxx/fsl_memctrl.h create mode 100644 cpu/mpc8xxx/fsl_util.c create mode 100644 cpu/mpc8xxx/memctl_options.h
cpu/mpc85xx/Makefile +9 -0
@@ -33,6 +33,15 @@ SOBJS-$(CONFIG_MP) += release.o SOBJS = $(SOBJS-y) COBJS-$(CONFIG_MP) += mp.o COBJS-$(CONFIG_OF_LIBFDT) += fdt.o + +ifneq ($(CONFIG_FSL_DDR3),y) +ifneq ($(CONFIG_FSL_DDR2),y) +ifneq ($(CONFIG_FSL_DDR1),y) +COBJS-y += spd_sdram.o +endif +endif +endif + COBJS = traps.o cpu.o cpu_init.o speed.o interrupts.o tlb.o \ pci.o serial_scc.o commproc.o ether_fcc.o spd_sdram.o qe_io.o \ $(COBJS-y)
cpu/mpc86xx/Makefile +4 -0
@@ -40,6 +40,10 @@ COBJS-y += spd_sdram.o COBJS-$(CONFIG_OF_LIBFDT) += fdt.o +ifneq ($(CONFIG_FSL_DDR2),y) +COBJS-y += spd_sdram.o +endif + SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y)) START := $(addprefix $(obj),$(START))
cpu/mpc8xxx/Makefile new file +29 -0
@@ -0,0 +1,29 @@ +# +# Copyright 2008 Freescale Semiconductor, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# Version 2 as published by the Free Software Foundation. +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)libmpc8xxx.a + +COBJS-$(CONFIG_FSL_DDR1) += fsl_ddr_sdram.o fsl_util.o fsl_ddr_ctrl.o +COBJS-$(CONFIG_FSL_DDR1) += fsl_ddr1.o + +COBJS-$(CONFIG_FSL_DDR2) += fsl_ddr_sdram.o fsl_util.o fsl_ddr_ctrl.o +COBJS-$(CONFIG_FSL_DDR2) += fsl_ddr2.o + +SRCS := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend
cpu/mpc8xxx/common_timing_params.h new file +55 -0
55 lines not on this page · raw message
cpu/mpc8xxx/ddr2_dimm_params.h new file +86 -0
86 lines not on this page · raw message
cpu/mpc8xxx/fsl_ddr_ctrl.c new file +1002 -0
1,002 lines not on this page · raw message
cpu/mpc8xxx/fsl_ddr_sdram.c new file +1134 -0
1,134 lines not on this page · raw message
cpu/mpc8xxx/fsl_ddr_sdram.h new file +90 -0
90 lines not on this page · raw message
cpu/mpc8xxx/fsl_memctrl.h new file +44 -0
44 lines not on this page · raw message
cpu/mpc8xxx/fsl_util.c new file +59 -0
59 lines not on this page · raw message
cpu/mpc8xxx/memctl_options.h new file +85 -0
85 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH v3 3/16 FSL DDR: Add DDR1 support
--- cpu/mpc8xxx/fsl_ddr1.c | 342 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 342 insertions(+), 0 deletions(-) create mode 100644 cpu/mpc8xxx/fsl_ddr1.c
cpu/mpc8xxx/fsl_ddr1.c new file +342 -0
@@ -0,0 +1,342 @@ +/* +* Copyright 2008 Freescale Semiconductor, Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* Version 2 as published by the Free Software Foundation. +*/ + +#include <common.h> + +#include "fsl_ddr_sdram.h" + +/* +* Calculate the Density of each Physical Rank. +* Returned size is in bytes. +* +* Study these table from Byte 31 of JEDEC SPD Spec. +* +* DDR I DDR II +* Bit Size Size +* --- ----- ------ +* 7 high 512MB 512MB +* 6 256MB 256MB +* 5 128MB 128MB +* 4 64MB 16GB +* 3 32MB 8GB +* 2 16MB 4GB +* 1 2GB 2GB +* 0 low 1GB 1GB +* +* Reorder Table to be linear by stripping the bottom +* 2 or 5 bits off and shifting them up to the top. +*/ + +static phys_size_t +compute_ranksize (unsigned int mem_type,unsigned char row_dens) +{ +phys_size_t bsize; + +/* Bottom 2 bits up to the top. */ + bsize = ((row_dens >>2 ) | ((row_dens &3 ) <<6 )); + bsize <<=24ULL ; +debug ("DDR: DDR I rank density = 0x%08x\n" , bsize); + +return bsize; +} + +/* +* Convert a two-nibble BCD value into a cycle time. +* While the spec calls for nano-seconds, picos are returned. +* +* This implements the tables for bytes 9, 23 and 25 for both +* DDR I and II. No allowance for distinguishing the invalid +* fields absent for DDR I yet present in DDR II is made. +* (That is, cycle times of .25, .33, .66 and .75 ns are +* allowed for both DDR II and I.) +*/ +static unsigned int +convert_bcd_tenths_to_cycle_time_ps (unsigned int spd_val) +{ +/* Table look up the lower nibble, allow DDR I & II. */ +unsigned int tenths_ps[16 ] = { +0 , +100 , +200 , +300 , +400 , +500 , +600 , +700 , +800 , +900 , +250 ,/* This and the next 3 entries valid ... */ +330 ,/* ... only for tCK calculations. */ +660 , +750 , +0 ,/* undefined */ +0 /* undefined */ + }; + +unsigned int whole_ns = (spd_val &0xF0 ) >>4 ; +unsigned int tenth_ns = spd_val &0x0F ; +unsigned int ps = whole_ns *1000 + tenths_ps[tenth_ns]; + +return ps; +} + +static unsigned int +convert_bcd_hundredths_to_cycle_time_ps (unsigned int spd_val) +{ +unsigned int tenth_ns = (spd_val &0xF0 ) >>4 ; +unsigned int hundredth_ns = spd_val &0x0F ; +unsigned int ps = tenth_ns *100 + hundredth_ns *10 ; + +return ps; +} + +static unsigned int byte40_table_ps[8 ] = { +0 , +250 , +330 , +500 , +660 , +750 , +0 ,/* supposed to be RFC, but not sure what that means */ +0 /* Undefined */ +}; + +static unsigned int +compute_trfc_ps_from_spd (unsigned char trctrfc_ext,unsigned char trfc) +{ +unsigned int trfc_ps; + + trfc_ps = (((trctrfc_ext &0x1 ) *256 ) + trfc) *1000 + + byte40_table_ps[(trctrfc_ext >>1 ) &0x7 ]; + +return trfc_ps; +} + +static unsigned int +compute_trc_ps_from_spd (unsigned char trctrfc_ext,unsigned char trc) +{ +unsigned int trc_ps; + + trc_ps = trc *1000 + byte40_table_ps[(trctrfc_ext >>4 ) &0x7 ]; + +return trc_ps; +} + +/* +* tCKmax from DDR I SPD Byte 43 +* +* Bits 7:2 == whole ns +* Bits 1:0 == quarter ns +* 00 == 0.00 ns +* 01 == 0.25 ns +* 10 == 0.50 ns +* 11 == 0.75 ns +* +* Returns picoseconds. +*/ +static unsigned int +compute_tckmax_from_spd_ps (unsigned int byte43) +{ +return (byte43 >>2 ) *1000 + (byte43 &0x3 ) *250 ; +} + +/* +* Determine Refresh Rate. Ignore self refresh bit on DDR I. +* Table from SPD Spec, Byte 12, converted to picoseconds and +* filled in with "default" normal values. +*/ +static unsigned int +determine_refresh_rate_ps (const unsigned int spd_refresh) +{ +unsigned int refresh_time_ps[8 ] = { +15625000 ,/* 0 Normal 1.00x */ +3900000 ,/* 1 Reduced .25x */ +7800000 ,/* 2 Extended .50x */ +31300000 ,/* 3 Extended 2.00x */ +62500000 ,/* 4 Extended 4.00x */ +125000000 ,/* 5 Extended 8.00x */ +15625000 ,/* 6 Normal 1.00x filler */ +15625000 ,/* 7 Normal 1.00x filler */ + }; + +return refresh_time_ps[spd_refresh &0x7 ]; +} + +/* +* The purpose of this function is to compute a suitable +* CAS latency given the DRAM clock period. The SPD only +* defines at most 3 CAS latencies. Typically the slower in +* frequency the DIMM runs at, the shorter its CAS latency can be. +* If the DIMM is operating at a sufficiently low frequency, +* it may be able to run at a CAS latency shorter than the +* shortest SPD-defined CAS latency. +* +* If a CAS latency is not found, 0 is returned. +* +* Do this by finding in the standard speed bin table the longest +* tCKmin that doesn't exceed the value of mclk_ps (tCK). +* +* An assumption made is that the SDRAM device allows the +* CL to be programmed for a value that is lower than those +* advertised by the SPD. This is not always the case, +* as those modes not defined in the SPD are optional. +* +* CAS latency de-rating based upon values JEDEC Standard No. 79-E +* Table 11. +* +* ordinal 2, ddr1_speed_bins[1] contains tCK for CL=2 +*/ +/* CL2.0 CL2.5 CL3.0 */ +unsigned short ddr1_speed_bins[] = {0 ,7500 ,6000 ,5000 }; + +unsigned int +compute_derated_DDR1_CAS_latency (unsigned int mclk_ps) +{ +const unsigned int num_speed_bins =ARRAY_SIZE (ddr1_speed_bins); +unsigned int lowest_tCKmin_found =0 ; +unsigned int lowest_tCKmin_CL =0 ; +unsigned int i; + +debug ("mclk_ps = %u\n" , mclk_ps); + +for (i =0 ; i < num_speed_bins; i++) { +unsigned int x = ddr1_speed_bins[i]; +debug ("i=%u, x = %u, lowest_tCKmin_found = %u\n" , + i, x, lowest_tCKmin_found); +if (x && lowest_tCKmin_found <= x && x <= mclk_ps) { + lowest_tCKmin_found = x; + lowest_tCKmin_CL = i +1 ; + } + } + +debug ("lowest_tCKmin_CL = %u\n" , lowest_tCKmin_CL); + +return lowest_tCKmin_CL; +} + +/* +* ddr_compute_dimm_parameters for DDR1 SPD +* +* Compute DIMM parameters based upon the SPD information in spd. +* Writes the results to the dimm_params_t structure pointed by pdimm. +* +* FIXME: use #define for the retvals +*/ +unsigned int +ddr_compute_dimm_parameters (const ddr1_spd_eeprom_t *spd, +dimm_params_t *pdimm, +unsigned int dimm_number) +{ +unsigned int retval; + +if (spd->mem_type) { +if (spd->mem_type !=SPD_MEMTYPE_DDR ) { +printf ("DIMM %u: is not a DDR1 SPD.\n" , dimm_number); +return 1 ; + } + }else { +memset (pdimm,0 ,sizeof (dimm_params_t)); +return 1 ; + } + + retval =ddr1_spd_check (spd); +if (retval) { +printf ("DIMM %u: failed checksum\n" , dimm_number); +return 2 ; + } + +/* +* The part name in ASCII in the SPD EEPROM is not null terminated. +* Guarantee null termination here by presetting all bytes to 0 +* and copying the part name in ASCII from the SPD onto it +*/ +memset (pdimm->mpart,0 ,sizeof (pdimm->mpart)); +memcpy (pdimm->mpart, spd->mpart,sizeof (pdimm->mpart) -1 ); + +/* DIMM organization parameters */ + pdimm->n_ranks = spd->nrows; + pdimm->rank_density =compute_ranksize (spd->mem_type, spd->bank_dens); + pdimm->capacity = pdimm->n_ranks * pdimm->rank_density; + pdimm->data_width = spd->dataw_lsb; + pdimm->primary_sdram_width = spd->primw; + pdimm->ec_sdram_width = spd->ecw; + +/* +* FIXME: Need to determine registered_dimm status. +* 1 == register buffered +* 0 == unbuffered +*/ + pdimm->registered_dimm =0 ;/* unbuffered */ + +/* SDRAM device parameters */ + pdimm->n_row_addr = spd->nrow_addr; + pdimm->n_col_addr = spd->ncol_addr; + pdimm->n_banks_per_sdram_device = spd->nbanks; + pdimm->edc_config = spd->config; + pdimm->burst_lengths_bitmask = spd->burstl; + pdimm->row_density = spd->bank_dens; + +/* +* Calculate the Maximum Data Rate based on the Minimum Cycle time. +* The SPD clk_cycle field (tCKmin) is measured in tenths of +* nanoseconds and represented as BCD. +*/ + pdimm->tCKmin_X_ps + =convert_bcd_tenths_to_cycle_time_ps (spd->clk_cycle); + pdimm->tCKmin_X_minus_1_ps + =convert_bcd_tenths_to_cycle_time_ps (spd->clk_cycle2); + pdimm->tCKmin_X_minus_2_ps + =convert_bcd_tenths_to_cycle_time_ps (spd->clk_cycle3); + + pdimm->tCKmax_ps =compute_tckmax_from_spd_ps (spd->tckmax); + +/* +* Compute CAS latencies defined by SPD +* The SPD caslat_X should have at least 1 and at most 3 bits set. +* +* If cas_lat after masking is 0, the __ilog2 function returns +* 255 into the variable. This behavior is abused once. +*/ + pdimm->caslat_X =__ilog2 (spd->cas_lat); + pdimm->caslat_X_minus_1 =__ilog2 (spd->cas_lat + & ~(1 << pdimm->caslat_X)); + pdimm->caslat_X_minus_2 =__ilog2 (spd->cas_lat + & ~(1 << pdimm->caslat_X) + & ~(1 << pdimm->caslat_X_minus_1)); + +/* Compute CAS latencies below that defined by SPD */ + pdimm->caslat_lowest_derated + =compute_derated_DDR1_CAS_latency (get_memory_clk_period_ps ()); + +/* Compute timing parameters */ + pdimm->tRCD_ps = spd->trcd *250 ; + pdimm->tRP_ps = spd->trp *250 ; + pdimm->tRAS_ps = spd->tras *1000 ; + + pdimm->tWR_ps =mclk_to_picos (3 ); + pdimm->tWTR_ps =mclk_to_picos (1 ); + pdimm->tRFC_ps =compute_trfc_ps_from_spd (0 , spd->trfc); + + pdimm->tRRD_ps = spd->trrd *250 ; + pdimm->tRC_ps =compute_trc_ps_from_spd (0 , spd->trc); + + pdimm->refresh_rate_ps =determine_refresh_rate_ps (spd->refresh); + + pdimm->tIS_ps =convert_bcd_hundredths_to_cycle_time_ps (spd->ca_setup); + pdimm->tIH_ps =convert_bcd_hundredths_to_cycle_time_ps (spd->ca_hold); + pdimm->tDS_ps + =convert_bcd_hundredths_to_cycle_time_ps (spd->data_setup); + pdimm->tDH_ps + =convert_bcd_hundredths_to_cycle_time_ps (spd->data_hold); + + pdimm->tRTP_ps =mclk_to_picos (2 );/* By the book. */ + pdimm->tDQSQ_max_ps = spd->tdqsq *10 ; + pdimm->tQHS_ps = spd->tqhs *10 ; + +return 0 ; +}
Signature · 1 line
1.5.5.1
PATCH v3 4/16 FSL DDR: Add DDR2 support
--- cpu/mpc8xxx/fsl_ddr2.c | 339 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 339 insertions(+), 0 deletions(-) create mode 100644 cpu/mpc8xxx/fsl_ddr2.c
cpu/mpc8xxx/fsl_ddr2.c new file +339 -0
@@ -0,0 +1,339 @@ +/* +* Copyright 2008 Freescale Semiconductor, Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* Version 2 as published by the Free Software Foundation. +*/ + +#include <common.h> + +#include "fsl_ddr_sdram.h" + +/* +* Calculate the Density of each Physical Rank. +* Returned size is in bytes. +* +* Study these table from Byte 31 of JEDEC SPD Spec. +* +* DDR I DDR II +* Bit Size Size +* --- ----- ------ +* 7 high 512MB 512MB +* 6 256MB 256MB +* 5 128MB 128MB +* 4 64MB 16GB +* 3 32MB 8GB +* 2 16MB 4GB +* 1 2GB 2GB +* 0 low 1GB 1GB +* +* Reorder Table to be linear by stripping the bottom +* 2 or 5 bits off and shifting them up to the top. +* +*/ +static phys_size_t +compute_ranksize (unsigned int mem_type,unsigned char row_dens) +{ +phys_size_t bsize; + +/* Bottom 5 bits up to the top. */ + bsize = ((row_dens >>5 ) | ((row_dens &31 ) <<3 )); + bsize <<=27ULL ; +debug ("DDR: DDR II rank density = 0x%08x\n" , bsize); + +return bsize; +} + +/* +* Convert a two-nibble BCD value into a cycle time. +* While the spec calls for nano-seconds, picos are returned. +* +* This implements the tables for bytes 9, 23 and 25 for both +* DDR I and II. No allowance for distinguishing the invalid +* fields absent for DDR I yet present in DDR II is made. +* (That is, cycle times of .25, .33, .66 and .75 ns are +* allowed for both DDR II and I.) +*/ +static unsigned int +convert_bcd_tenths_to_cycle_time_ps (unsigned int spd_val) +{ +/* Table look up the lower nibble, allow DDR I & II. */ +unsigned int tenths_ps[16 ] = { +0 , +100 , +200 , +300 , +400 , +500 , +600 , +700 , +800 , +900 , +250 ,/* This and the next 3 entries valid ... */ +330 ,/* ... only for tCK calculations. */ +660 , +750 , +0 ,/* undefined */ +0 /* undefined */ + }; + +unsigned int whole_ns = (spd_val &0xF0 ) >>4 ; +unsigned int tenth_ns = spd_val &0x0F ; +unsigned int ps = whole_ns *1000 + tenths_ps[tenth_ns]; + +return ps; +} + +static unsigned int +convert_bcd_hundredths_to_cycle_time_ps (unsigned int spd_val) +{ +unsigned int tenth_ns = (spd_val &0xF0 ) >>4 ; +unsigned int hundredth_ns = spd_val &0x0F ; +unsigned int ps = tenth_ns *100 + hundredth_ns *10 ; + +return ps; +} + +static unsigned int byte40_table_ps[8 ] = { +0 , +250 , +330 , +500 , +660 , +750 , +0 ,/* supposed to be RFC, but not sure what that means */ +0 /* Undefined */ +}; + +static unsigned int +compute_trfc_ps_from_spd (unsigned char trctrfc_ext,unsigned char trfc) +{ +unsigned int trfc_ps; + + trfc_ps = (((trctrfc_ext &0x1 ) *256 ) + trfc) *1000 + + byte40_table_ps[(trctrfc_ext >>1 ) &0x7 ]; + +return trfc_ps; +} + +static unsigned int +compute_trc_ps_from_spd (unsigned char trctrfc_ext,unsigned char trc) +{ +unsigned int trc_ps; + + trc_ps = trc *1000 + byte40_table_ps[(trctrfc_ext >>4 ) &0x7 ]; + +return trc_ps; +} + +/* +* Determine Refresh Rate. Ignore self refresh bit on DDR I. +* Table from SPD Spec, Byte 12, converted to picoseconds and +* filled in with "default" normal values. +*/ +static unsigned int +determine_refresh_rate_ps (const unsigned int spd_refresh) +{ +unsigned int refresh_time_ps[8 ] = { +15625000 ,/* 0 Normal 1.00x */ +3900000 ,/* 1 Reduced .25x */ +7800000 ,/* 2 Extended .50x */ +31300000 ,/* 3 Extended 2.00x */ +62500000 ,/* 4 Extended 4.00x */ +125000000 ,/* 5 Extended 8.00x */ +15625000 ,/* 6 Normal 1.00x filler */ +15625000 ,/* 7 Normal 1.00x filler */ + }; + +return refresh_time_ps[spd_refresh &0x7 ]; +} + +/* +* The purpose of this function is to compute a suitable +* CAS latency given the DRAM clock period. The SPD only +* defines at most 3 CAS latencies. Typically the slower in +* frequency the DIMM runs at, the shorter its CAS latency can. +* be. If the DIMM is operating at a sufficiently low frequency, +* it may be able to run at a CAS latency shorter than the +* shortest SPD-defined CAS latency. +* +* If a CAS latency is not found, 0 is returned. +* +* Do this by finding in the standard speed bin table the longest +* tCKmin that doesn't exceed the value of mclk_ps (tCK). +* +* An assumption made is that the SDRAM device allows the +* CL to be programmed for a value that is lower than those +* advertised by the SPD. This is not always the case, +* as those modes not defined in the SPD are optional. +* +* CAS latency de-rating based upon values JEDEC Standard No. 79-2C +* Table 40, "DDR2 SDRAM stanadard speed bins and tCK, tRCD, tRP, tRAS, +* and tRC for corresponding bin" +* +* ordinal 2, ddr2_speed_bins[1] contains tCK for CL=3 +* Not certain if any good value exists for CL=2 +*/ +/* CL2 CL3 CL4 CL5 CL6 */ +unsigned short ddr2_speed_bins[] = {0 ,5000 ,3750 ,3000 ,2500 }; + +unsigned int +compute_derated_DDR2_CAS_latency (unsigned int mclk_ps) +{ +const unsigned int num_speed_bins =ARRAY_SIZE (ddr2_speed_bins); +unsigned int lowest_tCKmin_found =0 ; +unsigned int lowest_tCKmin_CL =0 ; +unsigned int i; + +debug ("mclk_ps = %u\n" , mclk_ps); + +for (i =0 ; i < num_speed_bins; i++) { +unsigned int x = ddr2_speed_bins[i]; +debug ("i=%u, x = %u, lowest_tCKmin_found = %u\n" , + i, x, lowest_tCKmin_found); +if (x && x <= mclk_ps && x >= lowest_tCKmin_found ) { + lowest_tCKmin_found = x; + lowest_tCKmin_CL = i +2 ; + } + } + +debug ("lowest_tCKmin_CL = %u\n" , lowest_tCKmin_CL); + +return lowest_tCKmin_CL; +} + +/* +* ddr_compute_dimm_parameters for DDR2 SPD +* +* Compute DIMM parameters based upon the SPD information in spd. +* Writes the results to the dimm_params_t structure pointed by pdimm. +* +* FIXME: use #define for the retvals +*/ +unsigned int +ddr_compute_dimm_parameters (const ddr2_spd_eeprom_t *spd, +dimm_params_t *pdimm, +unsigned int dimm_number) +{ +unsigned int retval; + +if (spd->mem_type) { +if (spd->mem_type !=SPD_MEMTYPE_DDR2 ) { +printf ("DIMM %u: is not a DDR2 SPD.\n" , dimm_number); +return 1 ; + } + }else { +memset (pdimm,0 ,sizeof (dimm_params_t)); +return 1 ; + } + + retval =ddr2_spd_check (spd); +if (retval) { +printf ("DIMM %u: failed checksum\n" , dimm_number); +return 2 ; + } + +/* +* The part name in ASCII in the SPD EEPROM is not null terminated. +* Guarantee null termination here by presetting all bytes to 0 +* and copying the part name in ASCII from the SPD onto it +*/ +memset (pdimm->mpart,0 ,sizeof (pdimm->mpart)); +memcpy (pdimm->mpart, spd->mpart,sizeof (pdimm->mpart) -1 ); + +/* DIMM organization parameters */ + pdimm->n_ranks = (spd->mod_ranks &0x7 ) +1 ; + pdimm->rank_density =compute_ranksize (spd->mem_type, spd->rank_dens); + pdimm->capacity = pdimm->n_ranks * pdimm->rank_density; + pdimm->data_width = spd->dataw; + pdimm->primary_sdram_width = spd->primw; + pdimm->ec_sdram_width = spd->ecw; + +/* FIXME: what about registered SO-DIMM? */ +switch (spd->dimm_type) { +case 0x01 :/* RDIMM */ +case 0x10 :/* Mini-RDIMM */ + pdimm->registered_dimm =1 ;/* register buffered */ +break ; + +case 0x02 :/* UDIMM */ +case 0x04 :/* SO-DIMM */ +case 0x08 :/* Micro-DIMM */ +case 0x20 :/* Mini-UDIMM */ + pdimm->registered_dimm =0 ;/* unbuffered */ +break ; + +default : +printf ("unknown dimm_type 0x%02X\n" , spd->dimm_type); +return 1 ; +break ; + } + +/* SDRAM device parameters */ + pdimm->n_row_addr = spd->nrow_addr; + pdimm->n_col_addr = spd->ncol_addr; + pdimm->n_banks_per_sdram_device = spd->nbanks; + pdimm->edc_config = spd->config; + pdimm->burst_lengths_bitmask = spd->burstl; + pdimm->row_density = spd->rank_dens; + +/* +* Calculate the Maximum Data Rate based on the Minimum Cycle time. +* The SPD clk_cycle field (tCKmin) is measured in tenths of +* nanoseconds and represented as BCD. +*/ + pdimm->tCKmin_X_ps + =convert_bcd_tenths_to_cycle_time_ps (spd->clk_cycle); + pdimm->tCKmin_X_minus_1_ps + =convert_bcd_tenths_to_cycle_time_ps (spd->clk_cycle2); + pdimm->tCKmin_X_minus_2_ps + =convert_bcd_tenths_to_cycle_time_ps (spd->clk_cycle3); + + pdimm->tCKmax_ps =convert_bcd_tenths_to_cycle_time_ps (spd->tckmax); + +/* +* Compute CAS latencies defined by SPD +* The SPD caslat_X should have at least 1 and at most 3 bits set. +* +* If cas_lat after masking is 0, the __ilog2 function returns +* 255 into the variable. This behavior is abused once. +*/ + pdimm->caslat_X =__ilog2 (spd->cas_lat); + pdimm->caslat_X_minus_1 =__ilog2 (spd->cas_lat + & ~(1 << pdimm->caslat_X)); + pdimm->caslat_X_minus_2 =__ilog2 (spd->cas_lat + & ~(1 << pdimm->caslat_X) + & ~(1 << pdimm->caslat_X_minus_1)); + +/* Compute CAS latencies below that defined by SPD */ + pdimm->caslat_lowest_derated + =compute_derated_DDR2_CAS_latency (get_memory_clk_period_ps ()); + +/* Compute timing parameters */ + pdimm->tRCD_ps = spd->trcd *250 ; + pdimm->tRP_ps = spd->trp *250 ; + pdimm->tRAS_ps = spd->tras *1000 ; + + pdimm->tWR_ps = spd->twr *250 ; + pdimm->tWTR_ps = spd->twtr *250 ; + pdimm->tRFC_ps =compute_trfc_ps_from_spd (spd->trctrfc_ext, spd->trfc); + + pdimm->tRRD_ps = spd->trrd *250 ; + pdimm->tRC_ps =compute_trc_ps_from_spd (spd->trctrfc_ext, spd->trc); + + pdimm->refresh_rate_ps =determine_refresh_rate_ps (spd->refresh); + + pdimm->tIS_ps =convert_bcd_hundredths_to_cycle_time_ps (spd->ca_setup); + pdimm->tIH_ps =convert_bcd_hundredths_to_cycle_time_ps (spd->ca_hold); + pdimm->tDS_ps + =convert_bcd_hundredths_to_cycle_time_ps (spd->data_setup); + pdimm->tDH_ps + =convert_bcd_hundredths_to_cycle_time_ps (spd->data_hold); + + pdimm->tRTP_ps = spd->trtp *250 ; + pdimm->tDQSQ_max_ps = spd->tdqsq *10 ; + pdimm->tQHS_ps = spd->tqhs *10 ; + +return 0 ; +}
Signature · 1 line
1.5.5.1
PATCH v3 5/16 FSL DDR: Add interactive DDR config support
Provide a mechanism to allow interactive configuration of DDR params. This is useful when trying to test various DDR settings to determine optimal configuration values for a given board.
--- cpu/mpc8xxx/Makefile | 2 + cpu/mpc8xxx/fsl_ddr_interactive.c | 1238 +++++++++++++++++++++++++++++++++++++ cpu/mpc8xxx/fsl_ddr_sdram.c | 12 +- cpu/mpc8xxx/fsl_ddr_sdram.h | 3 + 4 files changed, 1254 insertions(+), 1 deletions(-) create mode 100644 cpu/mpc8xxx/fsl_ddr_interactive.c
cpu/mpc8xxx/Makefile +2 -0
@@ -10,6 +10,8 @@ include $(TOPDIR)/config.mk LIB = $(obj)libmpc8xxx.a +COBJS-$(CONFIG_FSL_DDR_INTERACTIVE) += fsl_ddr_interactive.o + COBJS-$(CONFIG_FSL_DDR1) += fsl_ddr_sdram.o fsl_util.o fsl_ddr_ctrl.o COBJS-$(CONFIG_FSL_DDR1) += fsl_ddr1.o
cpu/mpc8xxx/fsl_ddr_interactive.c new file +1238 -0
1,238 lines not on this page · raw message
cpu/mpc8xxx/fsl_ddr_sdram.c +11 -1
@@ -84,7 +84,7 @@ compute_fsl_memctl_config_regs(const memctl_options_t *popts,* | interleaving */ -#ifdef DEBUG +#if defined(DEBUG ) || defined (CONFIG_FSL_DDR_INTERACTIVE )const char *step_string_tbl[] = {"STEP_GET_SPD" , "STEP_COMPUTE_DIMM_PARMS",
@@ -1072,6 +1072,16 @@ phys_size_t fsl_ddr_sdram(void)/* Compute it once normally. */ total_memory =fsl_ddr_compute (&info,STEP_GET_SPD ); +#ifdef CONFIG_FSL_DDR_INTERACTIVE +/* +* The presence of the environment variable "ddrsetup" +* causes the interactive DDR setup prompt to appear. +*/ +if (getenv ("ddrsetup" )) { + total_memory =fsl_ddr_interactive (&info); + } +#endif +/* Check for memory controller interleaving. */ memctl_interleaved =0 ;for (i =0 ; i <CONFIG_NUM_DDR_CONTROLLERS ; i++) {
cpu/mpc8xxx/fsl_ddr_sdram.h +3 -0
@@ -61,6 +61,9 @@ typedef struct {extern phys_size_t fsl_ddr_compute (fsl_ddr_info_t *pinfo,unsigned int start_step); +extern phys_size_t +fsl_ddr_interactive (fsl_ddr_info_t *pinfo); +extern const char *step_to_string (unsigned int step);/* * Compute steps
Signature · 1 line
1.5.5.1
PATCH v3 6/16 FSL DDR: Provide a generic fsl_ddr_sdram_set_lawbar()
Make fsl_ddr_sdram_set_lawbar() a weak function to allow board code to override if desired.
--- drivers/misc/fsl_law.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 88 insertions(+), 0 deletions(-)
drivers/misc/fsl_law.c +88 -0
@@ -121,6 +121,94 @@ void print_laws(void)return ; } +#if defined(CONFIG_FSL_DDR1 ) || \ + defined(CONFIG_FSL_DDR2 ) || \ + defined(CONFIG_FSL_DDR3 ) +#include <../cpu/mpc8xxx/fsl_ddr_sdram.h> + +/* use up to 2 LAWs for DDR, used the last available LAWs */ +int __set_ddr_laws (u64 start,u64 sz,enum law_trgt_if id) +{ +u64 start_align, law_sz; +int law_sz_enc; + +if (start ==0 ) + start_align =1ull << (LAW_SIZE_32G +1 ); +else + start_align =1ull << (ffs64 (start) -1 ); + law_sz =min (start_align, sz); + law_sz_enc =__ilog2_u64 (law_sz) -1 ; + +if (set_last_law (start, law_sz_enc, id) <0 ) +return -1 ; + +/* do we still have anything to map */ + sz = sz - law_sz; +if (sz) { + start += law_sz; + + start_align =1ull << (ffs64 (start) -1 ); + law_sz =min (start_align, sz); + law_sz_enc =__ilog2_u64 (law_sz) -1 ; + +if (set_last_law (start, law_sz_enc, id) <0 ) +return -1 ; + }else { +return 0 ; + } + +/* do we still have anything to map */ + sz = sz - law_sz; +if (sz) +return 1 ; + +return 0 ; +} + +void +__fsl_ddr_set_lawbar (const common_timing_params_t *memctl_common_params, +unsigned int memctl_interleaved, +unsigned int ctrl_num) +{ +/* +* If no DIMMs on this controller, do not proceed any further. +*/ +if (!memctl_common_params->ndimms_present) { +return ; + } + +if (ctrl_num ==0 ) { +/* +* Set up LAW for DDR controller 1 space. +*/ +unsigned int lawbar1_target_id = memctl_interleaved + ?LAW_TRGT_IF_DDR_INTRLV :LAW_TRGT_IF_DDR_1 ; + +if (__set_ddr_laws (memctl_common_params->base_address, + memctl_common_params->total_mem, + lawbar1_target_id) <0 ) { +printf ("ERROR\n" ); +return ; + } + }else if (ctrl_num ==1 ) { +if (__set_ddr_laws (memctl_common_params->base_address, + memctl_common_params->total_mem, +LAW_TRGT_IF_DDR_2 ) <0 ) { +printf ("ERROR\n" ); +return ; + } + }else { +printf ("unexpected controller number %u in %s\n" , + ctrl_num, __FUNCTION__); + } +} + +__attribute__((weak,alias ("__fsl_ddr_set_lawbar" )))void +fsl_ddr_set_lawbar (const common_timing_params_t *memctl_common_params, +unsigned int memctl_interleaved, +unsigned int ctrl_num); +#endif +void init_laws (void ) {int i;
Signature · 1 line
1.5.5.1
PATCH v3 7/16 FSL DDR: Add e500 TLB helper for DDR code
Provide a helper function that board code can call to map TLBs when setting up DDR.
--- cpu/mpc85xx/tlb.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ include/asm-ppc/mmu.h | 1 + 2 files changed, 65 insertions(+), 0 deletions(-)
cpu/mpc85xx/tlb.c +64 -0
@@ -90,3 +90,67 @@ void init_tlbs(void)return ; } + +unsigned int setup_ddr_tlbs (unsigned int memsize_in_meg) +{ +unsigned int tlb_size; +unsigned int ram_tlb_index; +unsigned int ram_tlb_address; + +/* +* Determine size of each TLB1 entry. +*/ +switch (memsize_in_meg) { +case 16 : +case 32 : + tlb_size =BOOKE_PAGESZ_16M ; +break ; +case 64 : +case 128 : + tlb_size =BOOKE_PAGESZ_64M ; +break ; +case 256 : +case 512 : + tlb_size =BOOKE_PAGESZ_256M ; +break ; +case 1024 : +case 2048 : +if (PVR_VER (get_pvr ()) >PVR_VER (PVR_85xx)) + tlb_size =BOOKE_PAGESZ_1G ; +else + tlb_size =BOOKE_PAGESZ_256M ; +break ; +default : +puts ("DDR: only 16M, 32M, 64M, 128M, 256M, 512M, 1G" +" and 2G are supported.\n" ); + +/* +* The memory was not able to be mapped. +* Default to a small size. +*/ + tlb_size =BOOKE_PAGESZ_64M ; + memsize_in_meg =64 ; +break ; + } + +/* +* Configure DDR TLB1 entries. +* Starting at TLB1 8, use no more than 8 TLB1 entries. +*/ + ram_tlb_index =8 ; + ram_tlb_address = (unsigned int )CFG_DDR_SDRAM_BASE ; +while (ram_tlb_address < (memsize_in_meg *1024 *1024 ) + && ram_tlb_index <16 ) { +set_tlb (1 , ram_tlb_address, ram_tlb_address, +MAS3_SX |MAS3_SW |MAS3_SR ,0 , +0 , ram_tlb_index, tlb_size,1 ); + + ram_tlb_address += (0x1000 << ((tlb_size -1 ) *2 )); + ram_tlb_index++; + } + +/* +* Confirm that the requested amount of memory was mapped. +*/ +return memsize_in_meg; +}
include/asm-ppc/mmu.h +1 -0
@@ -431,6 +431,7 @@ extern void set_tlb(u8 tlb, u32 epn, u64 rpn,extern void disable_tlb (u8 esel);extern void invalidate_tlb (u8 tlb);extern void init_tlbs (void ); +extern unsigned int setup_ddr_tlbs (unsigned int memsize_in_meg);#define SET_TLB_ENTRY (_tlb, _epn, _rpn, _perms, _wimge, _ts, _esel, _sz, _iprot) \ { .tlb = _tlb, .epn = _epn, .rpn = _rpn, .perms = _perms, \
Signature · 1 line
1.5.5.1
PATCH v3 8/16 FSL DDR: Convert MPC8641HPCN to new DDR code.
From: Jon Loeliger <[email protected]>
--- Makefile | 3 + board/freescale/mpc8641hpcn/Makefile | 8 +- board/freescale/mpc8641hpcn/ddr.c | 234 +++++++++++++++++++++++++++++ board/freescale/mpc8641hpcn/mpc8641hpcn.c | 5 +- cpu/mpc86xx/Makefile | 1 - include/configs/MPC8641HPCN.h | 117 ++++++++------- 6 files changed, 307 insertions(+), 61 deletions(-) create mode 100644 board/freescale/mpc8641hpcn/ddr.c
Makefile +3 -0
@@ -237,6 +237,9 @@ endif ifeq ($(CPU),mpc85xx) LIBS += drivers/qe/qe.a endif +ifeq ($(CPU),mpc86xx) +LIBS += cpu/mpc8xxx/libmpc8xxx.a +endif LIBS += drivers/rtc/librtc.a LIBS += drivers/serial/libserial.a LIBS += drivers/usb/libusb.a
board/freescale/mpc8641hpcn/Makefile +5 -3
@@ -25,10 +25,12 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o law.o +COBJS-y += $(BOARD).o +COBJS-y += law.o +COBJS-y += ddr.o -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) +SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y)) SOBJS := $(addprefix $(obj),$(SOBJS)) $(LIB): $(obj).depend $(OBJS) $(SOBJS)
board/freescale/mpc8641hpcn/ddr.c new file +234 -0
234 lines not on this page · raw message
board/freescale/mpc8641hpcn/mpc8641hpcn.c +2 -3
@@ -25,18 +25,17 @@#include <asm/processor.h> #include <asm/immap_86xx.h> #include <asm/immap_fsl_pci.h> -#include <spd_sdram.h> #include <asm/io.h> #include <libfdt.h> #include <fdt_support.h> #include "../common/pixis.h" +#include "../cpu/mpc8xxx/fsl_ddr_sdram.h" #if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )extern void ddr_enable_ecc (unsigned int dram_size);#endif -void sdram_init (void );long int fixed_sdram (void );
@@ -61,7 +60,7 @@ initdram(int board_type)long dram_size =0 ;#if defined(CONFIG_SPD_EEPROM ) - dram_size =spd_sdram (); + dram_size =fsl_ddr_sdram ();#else dram_size =fixed_sdram ();#endif
cpu/mpc86xx/Makefile +0 -1
@@ -36,7 +36,6 @@ COBJS-y += cpu.o COBJS-y += cpu_init.o COBJS-y += speed.o COBJS-y += interrupts.o -COBJS-y += spd_sdram.o COBJS-$(CONFIG_OF_LIBFDT) += fdt.o
include/configs/MPC8641HPCN.h +62 -53
134 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH v3 9/16 FSL DDR: Convert MPC8610HPCD to new DDR code.
From: Jon Loeliger <[email protected]>
--- board/freescale/mpc8610hpcd/Makefile | 10 +- board/freescale/mpc8610hpcd/ddr.c | 223 +++++++++++++++++++++++++++++ board/freescale/mpc8610hpcd/mpc8610hpcd.c | 3 +- include/configs/MPC8610HPCD.h | 50 +++++-- 4 files changed, 264 insertions(+), 22 deletions(-) create mode 100644 board/freescale/mpc8610hpcd/ddr.c
board/freescale/mpc8610hpcd/Makefile +5 -5
@@ -23,14 +23,14 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o law.o +COBJS-y += $(BOARD).o +COBJS-y += ddr.o +COBJS-y += law.o COBJS-${CONFIG_FSL_DIU_FB} += mpc8610hpcd_diu.o -COBJS += ${COBJS-y} - -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) +SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y)) SOBJS := $(addprefix $(obj),$(SOBJS)) $(LIB): $(obj).depend $(OBJS) $(SOBJS)
board/freescale/mpc8610hpcd/ddr.c new file +223 -0
223 lines not on this page · raw message
board/freescale/mpc8610hpcd/mpc8610hpcd.c +2 -1
@@ -33,6 +33,7 @@#include <spd_sdram.h> #include "../common/pixis.h" +#include "../cpu/mpc8xxx/fsl_ddr_sdram.h" #if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )extern void ddr_enable_ecc (unsigned int dram_size);
@@ -122,7 +123,7 @@ initdram(int board_type)long dram_size =0 ;#if defined(CONFIG_SPD_EEPROM ) - dram_size =spd_sdram (); + dram_size =fsl_ddr_sdram ();#else dram_size =fixed_sdram ();#endif
include/configs/MPC8610HPCD.h +34 -16
91 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH v3 10/16 FSL DDR: Convert MPC8544DS to new DDR code.
--- Makefile | 1 + board/freescale/mpc8544ds/Makefile | 9 +- board/freescale/mpc8544ds/ddr.c | 242 +++++++++++++++++++++++++++++++++ board/freescale/mpc8544ds/mpc8544ds.c | 11 +- cpu/mpc85xx/Makefile | 2 +- include/configs/MPC8544DS.h | 52 ++++++-- 6 files changed, 298 insertions(+), 19 deletions(-) create mode 100644 board/freescale/mpc8544ds/ddr.c
Makefile +1 -0
@@ -236,6 +236,7 @@ LIBS += drivers/qe/qe.a endif ifeq ($(CPU),mpc85xx) LIBS += drivers/qe/qe.a +LIBS += cpu/mpc8xxx/libmpc8xxx.a endif ifeq ($(CPU),mpc86xx) LIBS += cpu/mpc8xxx/libmpc8xxx.a
board/freescale/mpc8544ds/Makefile +6 -3
@@ -26,10 +26,13 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o law.o tlb.o +COBJS-y += $(BOARD).o +COBJS-y += ddr.o +COBJS-y += law.o +COBJS-y += tlb.o -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) +SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y)) SOBJS := $(addprefix $(obj),$(SOBJS)) $(LIB): $(obj).depend $(OBJS) $(SOBJS)
board/freescale/mpc8544ds/ddr.c new file +242 -0
242 lines not on this page · raw message
board/freescale/mpc8544ds/mpc8544ds.c +7 -4
@@ -24,22 +24,21 @@#include <command.h> #include <pci.h> #include <asm/processor.h> +#include <asm/mmu.h> #include <asm/immap_85xx.h> #include <asm/immap_fsl_pci.h> #include <asm/io.h> -#include <spd_sdram.h> #include <miiphy.h> #include <libfdt.h> #include <fdt_support.h> #include "../common/pixis.h" +#include "../cpu/mpc8xxx/fsl_ddr_sdram.h" #if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )extern void ddr_enable_ecc (unsigned int dram_size);#endif -void sdram_init (void ); -int checkboard (void ) {volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
@@ -69,7 +68,11 @@ initdram(int board_type)puts ("Initializing\n" ); - dram_size =spd_sdram (); + dram_size =fsl_ddr_sdram (); + + dram_size =setup_ddr_tlbs (dram_size /0x100000 ); + + dram_size *=0x100000 ;#if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )/*
cpu/mpc85xx/Makefile +1 -1
@@ -43,7 +43,7 @@ endif endif COBJS = traps.o cpu.o cpu_init.o speed.o interrupts.o tlb.o \ - pci.o serial_scc.o commproc.o ether_fcc.o spd_sdram.o qe_io.o \ + pci.o serial_scc.o commproc.o ether_fcc.o qe_io.o \ $(COBJS-y) SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
include/configs/MPC8544DS.h +41 -11
76 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH v3 11/16 FSL DDR: Convert MPC8540ADS to new DDR code.
--- board/freescale/mpc8540ads/Makefile | 13 +- board/freescale/mpc8540ads/ddr.c | 282 +++++++++++++++++++++++++++++++ board/freescale/mpc8540ads/mpc8540ads.c | 16 ++- include/configs/MPC8540ADS.h | 70 +++++--- 4 files changed, 346 insertions(+), 35 deletions(-) create mode 100644 board/freescale/mpc8540ads/ddr.c
board/freescale/mpc8540ads/Makefile +8 -5
@@ -25,11 +25,14 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o law.o tlb.o - -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) -SOBJS := $(addprefix $(obj),$(SOBJS)) +COBJS-y += $(BOARD).o +COBJS-y += ddr.o +COBJS-y += law.o +COBJS-y += tlb.o + +SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y)) +SOBJS := $(addprefix $(obj),$(SOBJS-y)) $(LIB): $(obj).depend $(OBJS) $(SOBJS) $(AR) $(ARFLAGS) $@ $(OBJS)
board/freescale/mpc8540ads/ddr.c new file +282 -0
282 lines not on this page · raw message
board/freescale/mpc8540ads/mpc8540ads.c +12 -4
@@ -28,11 +28,13 @@#include <common.h> #include <pci.h> #include <asm/processor.h> +#include <asm/mmu.h> #include <asm/immap_85xx.h> -#include <spd_sdram.h> #include <libfdt.h> #include <fdt_support.h> +#include "../cpu/mpc8xxx/fsl_ddr_sdram.h" +#if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )extern void ddr_enable_ecc (unsigned int dram_size);#endif
@@ -82,10 +84,16 @@ initdram(int board_type) }#endif -#if defined(CONFIG_SPD_EEPROM ) - dram_size =spd_sdram (); +#ifdef CONFIG_SPD_EEPROM + dram_size =fsl_ddr_sdram (); +printf ("dram_size = %u\n" , dram_size); + + dram_size =setup_ddr_tlbs (dram_size /0x100000 ); +printf ("dram_size = %u after setup_ddr_tlbs\n" , dram_size); + + dram_size *=0x100000 ;#else - dram_size =fixed_sdram (); + dram_size =fixed_sdram ();#endif #if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )
include/configs/MPC8540ADS.h +43 -25
84 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH v3 12/16 FSL DDR: Convert MPC8560ADS to new DDR code.
From: Jon Loeliger <[email protected]>
--- board/freescale/mpc8560ads/Makefile | 13 +- board/freescale/mpc8560ads/ddr.c | 282 +++++++++++++++++++++++++++++++ board/freescale/mpc8560ads/mpc8560ads.c | 15 ++- include/configs/MPC8560ADS.h | 71 +++++--- 4 files changed, 348 insertions(+), 33 deletions(-) create mode 100644 board/freescale/mpc8560ads/ddr.c
board/freescale/mpc8560ads/Makefile +8 -5
@@ -25,11 +25,14 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o law.o tlb.o - -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) -SOBJS := $(addprefix $(obj),$(SOBJS)) +COBJS-y += $(BOARD).o +COBJS-y += ddr.o +COBJS-y += law.o +COBJS-y += tlb.o + +SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y)) +SOBJS := $(addprefix $(obj),$(SOBJS-y)) $(LIB): $(obj).depend $(OBJS) $(SOBJS) $(AR) $(ARFLAGS) $@ $(OBJS)
board/freescale/mpc8560ads/ddr.c new file +282 -0
282 lines not on this page · raw message
board/freescale/mpc8560ads/mpc8560ads.c +12 -3
@@ -28,6 +28,7 @@#include <common.h> #include <pci.h> #include <asm/processor.h> +#include <asm/mmu.h> #include <asm/immap_85xx.h> #include <ioports.h> #include <spd_sdram.h>
@@ -35,6 +36,8 @@#include <libfdt.h> #include <fdt_support.h> +#include "../cpu/mpc8xxx/fsl_ddr_sdram.h" +#if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )extern void ddr_enable_ecc (unsigned int dram_size);#endif
@@ -285,10 +288,16 @@ initdram(int board_type) }#endif -#if defined(CONFIG_SPD_EEPROM ) - dram_size =spd_sdram (); +#ifdef CONFIG_SPD_EEPROM + dram_size =fsl_ddr_sdram (); +printf ("dram_size = %u\n" , dram_size); + + dram_size =setup_ddr_tlbs (dram_size /0x100000 ); +printf ("dram_size = %u after setup_ddr_tlbs\n" , dram_size); + + dram_size *=0x100000 ;#else - dram_size =fixed_sdram (); + dram_size =fixed_sdram ();#endif #if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )
include/configs/MPC8560ADS.h +46 -25
93 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH v3 13/16 FSL DDR: Convert MPC8555ADS to new DDR code.
From: Jon Loeliger <[email protected]>
--- board/freescale/mpc8555cds/Makefile | 1 + board/freescale/mpc8555cds/ddr.c | 293 +++++++++++++++++++++++++++++++ board/freescale/mpc8555cds/mpc8555cds.c | 12 ++- include/configs/MPC8555CDS.h | 46 ++++- 4 files changed, 341 insertions(+), 11 deletions(-) create mode 100644 board/freescale/mpc8555cds/ddr.c
board/freescale/mpc8555cds/Makefile +1 -0
@@ -27,6 +27,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a COBJS-y += $(BOARD).o +COBJS-y += ddr.o COBJS-y += law.o COBJS-y += tlb.o
board/freescale/mpc8555cds/ddr.c new file +293 -0
293 lines not on this page · raw message
board/freescale/mpc8555cds/mpc8555cds.c +11 -1
@@ -23,6 +23,7 @@#include <common.h> #include <pci.h> #include <asm/processor.h> +#include <asm/mmu.h> #include <asm/immap_85xx.h> #include <ioports.h> #include <spd_sdram.h>
@@ -32,6 +33,7 @@#include "../common/cadmus.h" #include "../common/eeprom.h" #include "../common/via.h" +#include "../cpu/mpc8xxx/fsl_ddr_sdram.h" #if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )extern void ddr_enable_ecc (unsigned int dram_size);
@@ -261,7 +263,14 @@ initdram(int board_type) udelay(200); }#endif - dram_size =spd_sdram (); + + dram_size =fsl_ddr_sdram (); +printf ("dram_size = %u\n" , dram_size); + + dram_size =setup_ddr_tlbs (dram_size /0x100000 ); +printf ("dram_size = %u after setup_ddr_tlbs\n" , dram_size); + + dram_size *=0x100000 ;#if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )/*
@@ -269,6 +278,7 @@ initdram(int board_type)*/ ddr_enable_ecc (dram_size);#endif +/* * SDRAM Initialization */
include/configs/MPC8555CDS.h +36 -10
76 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH v3 14/16 FSL DDR: Convert MPC8541CDS to new DDR code.
From: Jon Loeliger <[email protected]>
--- board/freescale/mpc8541cds/Makefile | 1 + board/freescale/mpc8541cds/ddr.c | 293 +++++++++++++++++++++++++++++++ board/freescale/mpc8541cds/mpc8541cds.c | 10 +- include/configs/MPC8541CDS.h | 44 ++++- 4 files changed, 338 insertions(+), 10 deletions(-) create mode 100644 board/freescale/mpc8541cds/ddr.c
board/freescale/mpc8541cds/Makefile +1 -0
@@ -27,6 +27,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a COBJS-y += $(BOARD).o +COBJS-y += ddr.o COBJS-y += law.o COBJS-y += tlb.o
board/freescale/mpc8541cds/ddr.c new file +293 -0
293 lines not on this page · raw message
board/freescale/mpc8541cds/mpc8541cds.c +9 -1
@@ -25,6 +25,7 @@#include <common.h> #include <pci.h> #include <asm/processor.h> +#include <asm/mmu.h> #include <asm/immap_85xx.h> #include <ioports.h> #include <spd_sdram.h>
@@ -34,6 +35,7 @@#include "../common/cadmus.h" #include "../common/eeprom.h" #include "../common/via.h" +#include "../cpu/mpc8xxx/fsl_ddr_sdram.h" #if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )extern void ddr_enable_ecc (unsigned int dram_size);
@@ -263,7 +265,13 @@ initdram(int board_type) udelay(200); }#endif - dram_size =spd_sdram (); + dram_size =fsl_ddr_sdram (); +printf ("dram_size = %u\n" , dram_size); + + dram_size =setup_ddr_tlbs (dram_size /0x100000 ); +printf ("dram_size = %u after setup_ddr_tlbs\n" , dram_size); + + dram_size *=0x100000 ;#if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )/*
include/configs/MPC8541CDS.h +35 -9
71 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH v3 15/16 FSL DDR: Convert MPC8568MDS to new DDR code.
From: Jon Loeliger <[email protected]>
--- board/freescale/mpc8568mds/Makefile | 14 +- board/freescale/mpc8568mds/ddr.c | 248 +++++++++++++++++++++++++++++++ board/freescale/mpc8568mds/mpc8568mds.c | 12 ++- include/configs/MPC8568MDS.h | 49 +++++-- 4 files changed, 306 insertions(+), 17 deletions(-) create mode 100644 board/freescale/mpc8568mds/ddr.c
board/freescale/mpc8568mds/Makefile +9 -5
@@ -26,11 +26,15 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o bcsr.o law.o tlb.o - -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) -SOBJS := $(addprefix $(obj),$(SOBJS)) +COBJS-y += $(BOARD).o +COBJS-y += bcsr.o +COBJS-y += ddr.o +COBJS-y += law.o +COBJS-y += tlb.o + +SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y)) +SOBJS := $(addprefix $(obj),$(SOBJS-y)) $(LIB): $(obj).depend $(OBJS) $(SOBJS) $(AR) $(ARFLAGS) $@ $(OBJS)
board/freescale/mpc8568mds/ddr.c new file +248 -0
248 lines not on this page · raw message
board/freescale/mpc8568mds/mpc8568mds.c +11 -1
@@ -25,6 +25,7 @@#include <common.h> #include <pci.h> #include <asm/processor.h> +#include <asm/mmu.h> #include <asm/immap_85xx.h> #include <asm/immap_fsl_pci.h> #include <spd_sdram.h>
@@ -34,6 +35,7 @@#include <fdt_support.h> #include "bcsr.h" +#include "../cpu/mpc8xxx/fsl_ddr_sdram.h" const qe_iop_conf_t qe_iop_conf_tab[] = {/* GETH1 */
@@ -163,7 +165,14 @@ initdram(int board_type) udelay(200); }#endif - dram_size =spd_sdram (); + + dram_size =fsl_ddr_sdram (); +printf ("dram_size = %u\n" , dram_size); + + dram_size =setup_ddr_tlbs (dram_size /0x100000 ); +printf ("dram_size = %u after setup_ddr_tlbs\n" , dram_size); + + dram_size *=0x100000 ;#if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )/*
@@ -171,6 +180,7 @@ initdram(int board_type)*/ ddr_enable_ecc (dram_size);#endif +/* * SDRAM Initialization */
include/configs/MPC8568MDS.h +38 -11
76 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH v3 16/16 FSL DDR: Convert MPC8548CDS to new DDR code.
From: Jon Loeliger <[email protected]>
--- board/freescale/mpc8548cds/Makefile | 1 + board/freescale/mpc8548cds/ddr.c | 239 +++++++++++++++++++++++++++++++ board/freescale/mpc8548cds/mpc8548cds.c | 12 ++- include/configs/MPC8548CDS.h | 49 +++++-- 4 files changed, 289 insertions(+), 12 deletions(-) create mode 100644 board/freescale/mpc8548cds/ddr.c
board/freescale/mpc8548cds/Makefile +1 -0
@@ -27,6 +27,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a COBJS-y += $(BOARD).o +COBJS-y += ddr.o COBJS-y += law.o COBJS-y += tlb.o
board/freescale/mpc8548cds/ddr.c new file +239 -0
239 lines not on this page · raw message
board/freescale/mpc8548cds/mpc8548cds.c +11 -1
@@ -25,6 +25,7 @@#include <common.h> #include <pci.h> #include <asm/processor.h> +#include <asm/mmu.h> #include <asm/immap_85xx.h> #include <asm/immap_fsl_pci.h> #include <spd_sdram.h>
@@ -35,6 +36,7 @@#include "../common/cadmus.h" #include "../common/eeprom.h" #include "../common/via.h" +#include "../cpu/mpc8xxx/fsl_ddr_sdram.h" #if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )extern void ddr_enable_ecc (unsigned int dram_size);
@@ -111,7 +113,14 @@ initdram(int board_type) udelay(200); }#endif - dram_size =spd_sdram (); + + dram_size =fsl_ddr_sdram (); +printf ("dram_size = %u\n" , dram_size); + + dram_size =setup_ddr_tlbs (dram_size /0x100000 ); +printf ("dram_size = %u after setup_ddr_tlbs\n" , dram_size); + + dram_size *=0x100000 ;#if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER )/*
@@ -119,6 +128,7 @@ initdram(int board_type)*/ ddr_enable_ecc (dram_size);#endif +/* * SDRAM Initialization */
include/configs/MPC8548CDS.h +38 -11
77 lines not on this page · raw message
Signature · 1 line
1.5.5.1
Wolfgang Denk
AppliedPATCH v3 16/16 FSL DDR: Convert MPC8548CDS to new DDR code.
Dear Kumar Gala,
Quoted 11 lines · In message <[email protected]> you…
From: Jon Loeliger <[email protected]>
Signed-off-by Jon Loeliger <[email protected]>Signed-off-by Kumar Gala <[email protected]>--- board/freescale/mpc8548cds/Makefile | 1 + board/freescale/mpc8548cds/ddr.c | 239 +++++++++++++++++++++++++++++++ board/freescale/mpc8548cds/mpc8548cds.c | 12 ++- include/configs/MPC8548CDS.h | 49 +++++-- 4 files changed, 289 insertions(+), 12 deletions(-) create mode 100644 board/freescale/mpc8548cds/ddr.c
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "In the face of entropy and nothingness, you kind of have to pretend it's not there if you want to keep writing good code." - Karl Lehenbauer
Wolfgang Denk
AppliedPATCH v3 15/16 FSL DDR: Convert MPC8568MDS to new DDR code.
In reply to Kumar GalaDear Kumar Gala,
Quoted 11 lines · In message <[email protected]> you…
From: Jon Loeliger <[email protected]>
Signed-off-by Jon Loeliger <[email protected]>Signed-off-by Kumar Gala <[email protected]>--- board/freescale/mpc8568mds/Makefile | 14 +- board/freescale/mpc8568mds/ddr.c | 248 +++++++++++++++++++++++++++++++ board/freescale/mpc8568mds/mpc8568mds.c | 12 ++- include/configs/MPC8568MDS.h | 49 +++++-- 4 files changed, 306 insertions(+), 17 deletions(-) create mode 100644 board/freescale/mpc8568mds/ddr.c
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The complexity of software is an essential property, not an acciden- tal one. Hence, descriptions of a software entity that abstract away its complexity often abstract away its essence. - Fred Brooks, Jr.
Wolfgang Denk
AppliedPATCH v3 14/16 FSL DDR: Convert MPC8541CDS to new DDR code.
In reply to Kumar GalaDear Kumar Gala,
Quoted 11 lines · In message <[email protected]> you…
From: Jon Loeliger <[email protected]>
Signed-off-by Jon Loeliger <[email protected]>Signed-off-by Kumar Gala <[email protected]>--- board/freescale/mpc8541cds/Makefile | 1 + board/freescale/mpc8541cds/ddr.c | 293 +++++++++++++++++++++++++++++++ board/freescale/mpc8541cds/mpc8541cds.c | 10 +- include/configs/MPC8541CDS.h | 44 ++++- 4 files changed, 338 insertions(+), 10 deletions(-) create mode 100644 board/freescale/mpc8541cds/ddr.c
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Ada is PL/I trying to be Smalltalk. - Codoso diBlini
Wolfgang Denk
AppliedPATCH v3 13/16 FSL DDR: Convert MPC8555ADS to new DDR code.
In reply to Kumar GalaDear Kumar Gala,
Quoted 11 lines · In message <[email protected]> you…
From: Jon Loeliger <[email protected]>
Signed-off-by Jon Loeliger <[email protected]>Signed-off-by Kumar Gala <[email protected]>--- board/freescale/mpc8555cds/Makefile | 1 + board/freescale/mpc8555cds/ddr.c | 293 +++++++++++++++++++++++++++++++ board/freescale/mpc8555cds/mpc8555cds.c | 12 ++- include/configs/MPC8555CDS.h | 46 ++++- 4 files changed, 341 insertions(+), 11 deletions(-) create mode 100644 board/freescale/mpc8555cds/ddr.c
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de All I ask is a chance to prove that money can't make me happy.
Wolfgang Denk
AppliedPATCH v3 12/16 FSL DDR: Convert MPC8560ADS to new DDR code.
In reply to Kumar GalaDear Kumar Gala,
Quoted 11 lines · In message <[email protected]> you…
From: Jon Loeliger <[email protected]>
Signed-off-by Jon Loeliger <[email protected]>Signed-off-by Kumar Gala <[email protected]>--- board/freescale/mpc8560ads/Makefile | 13 +- board/freescale/mpc8560ads/ddr.c | 282 +++++++++++++++++++++++++++++++ board/freescale/mpc8560ads/mpc8560ads.c | 15 ++- include/configs/MPC8560ADS.h | 71 +++++--- 4 files changed, 348 insertions(+), 33 deletions(-) create mode 100644 board/freescale/mpc8560ads/ddr.c
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 8 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The connection between the language in which we think/program and the
problems and solutions we can imagine is very close. For this reason
restricting language features with the intent of eliminating pro-
grammer errors is at best dangerous.
- Bjarne Stroustrup in "The C++ Programming Language"Wolfgang Denk
AppliedPATCH v3 11/16 FSL DDR: Convert MPC8540ADS to new DDR code.
In reply to Kumar GalaDear Kumar Gala,
Quoted 8 lines · In message <[email protected]> you…
Signed-off-by Kumar Gala <[email protected]>--- board/freescale/mpc8540ads/Makefile | 13 +- board/freescale/mpc8540ads/ddr.c | 282 +++++++++++++++++++++++++++++++ board/freescale/mpc8540ads/mpc8540ads.c | 16 ++- include/configs/MPC8540ADS.h | 70 +++++--- 4 files changed, 346 insertions(+), 35 deletions(-) create mode 100644 board/freescale/mpc8540ads/ddr.c
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "...and the fully armed nuclear warheads, are, of course, merely a courtesy detail."
Wolfgang Denk
AppliedPATCH v3 10/16 FSL DDR: Convert MPC8544DS to new DDR code.
In reply to Kumar GalaDear Kumar Gala,
Quoted 10 lines · In message <[email protected]> you…
Signed-off-by Kumar Gala <[email protected]>--- Makefile | 1 + board/freescale/mpc8544ds/Makefile | 9 +- board/freescale/mpc8544ds/ddr.c | 242 +++++++++++++++++++++++++++++++++ board/freescale/mpc8544ds/mpc8544ds.c | 11 +- cpu/mpc85xx/Makefile | 2 +- include/configs/MPC8544DS.h | 52 ++++++-- 6 files changed, 298 insertions(+), 19 deletions(-) create mode 100644 board/freescale/mpc8544ds/ddr.c
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There is is no reason for any individual to have a computer in their
home. -- Ken Olsen (President of Digital Equipment Corporation),
Convention of the World Future Society, in Boston, 1977Wolfgang Denk
AppliedPATCH v3 9/16 FSL DDR: Convert MPC8610HPCD to new DDR code.
In reply to Kumar GalaDear Kumar Gala,
Quoted 11 lines · In message <[email protected]> you…
From: Jon Loeliger <[email protected]>
Signed-off-by Jon Loeliger <[email protected]>Signed-off-by Kumar Gala <[email protected]>--- board/freescale/mpc8610hpcd/Makefile | 10 +- board/freescale/mpc8610hpcd/ddr.c | 223 +++++++++++++++++++++++++++++ board/freescale/mpc8610hpcd/mpc8610hpcd.c | 3 +- include/configs/MPC8610HPCD.h | 50 +++++-- 4 files changed, 264 insertions(+), 22 deletions(-) create mode 100644 board/freescale/mpc8610hpcd/ddr.c
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Am besten betrachten Sie Fehlermeldungen als eine Art Psycho-Test, mit dem herausgefunden werden soll, wie belastbar Sie sind." - Dr. R. Wonneberger, Kompaktf?hrer LaTeX, Kap. 1.6: Fehlermeldungen
Wolfgang Denk
AppliedPATCH v3 8/16 FSL DDR: Convert MPC8641HPCN to new DDR code.
In reply to Kumar GalaDear Kumar Gala,
Quoted 4 lines · In message <[email protected]> you…
From: Jon Loeliger <[email protected]>
Signed-off-by Jon Loeliger <[email protected]>Signed-off-by Kumar Gala <[email protected]>
Quoted 9 lines
--- Makefile | 3 + board/freescale/mpc8641hpcn/Makefile | 8 +- board/freescale/mpc8641hpcn/ddr.c | 234 +++++++++++++++++++++++++++++ board/freescale/mpc8641hpcn/mpc8641hpcn.c | 5 +- cpu/mpc86xx/Makefile | 1 - include/configs/MPC8641HPCN.h | 117 ++++++++------- 6 files changed, 307 insertions(+), 61 deletions(-) create mode 100644 board/freescale/mpc8641hpcn/ddr.c
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Memories of you remind me of you. - Karl Lehenbauer
Wolfgang Denk
AppliedPATCH v3 7/16 FSL DDR: Add e500 TLB helper for DDR code
In reply to Kumar GalaDear Kumar Gala,
Quoted 8 lines · In message <[email protected]> you…
Provide a helper function that board code can call to map TLBs when setting up DDR.
Signed-off-by Kumar Gala <[email protected]>--- cpu/mpc85xx/tlb.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ include/asm-ppc/mmu.h | 1 + 2 files changed, 65 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "We don't have to protect the environment -- the Second Coming is at hand." - James Watt
Wolfgang Denk
AppliedPATCH v3 6/16 FSL DDR: Provide a generic fsl_ddr_sdram_set_lawbar()
In reply to Kumar GalaDear Kumar Gala,
Quoted 7 lines · In message <[email protected]> you…
Make
fsl_ddr_sdram_set_lawbar()a weak function to allow board code to override if desired.Signed-off-by Kumar Gala <[email protected]>--- drivers/misc/fsl_law.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 88 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Research is what I'm doing when I don't know what I'm doing.
-- Wernher von BraunWolfgang Denk
AppliedPATCH v3 5/16 FSL DDR: Add interactive DDR config support
In reply to Kumar GalaDear Kumar Gala,
Quoted 7 lines · In message <[email protected]> you…
Provide a mechanism to allow interactive configuration of DDR params. This is useful when trying to test various DDR settings to determine optimal configuration values for a given board.
Signed-off-by James Yang <[email protected]>Signed-off-by Jon Loeliger <[email protected]>Signed-off-by Kumar Gala <[email protected]>
Quoted 7 lines
--- cpu/mpc8xxx/Makefile | 2 + cpu/mpc8xxx/fsl_ddr_interactive.c | 1238 +++++++++++++++++++++++++++++++++++++ cpu/mpc8xxx/fsl_ddr_sdram.c | 12 +- cpu/mpc8xxx/fsl_ddr_sdram.h | 3 + 4 files changed, 1254 insertions(+), 1 deletions(-) create mode 100644 cpu/mpc8xxx/fsl_ddr_interactive.c
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Those who do not understand Unix are condemned to reinvent it, poorly. - Henry Spencer, University of Toronto Unix hack
Wolfgang Denk
AppliedPATCH v3 4/16 FSL DDR: Add DDR2 support
In reply to Kumar GalaDear Kumar Gala,
Quoted 7 lines · In message <[email protected]> you…
Signed-off-by James Yang <[email protected]>Signed-off-by Jon Loeliger <[email protected]>Signed-off-by Kumar Gala <[email protected]>--- cpu/mpc8xxx/fsl_ddr2.c | 339 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 339 insertions(+), 0 deletions(-) create mode 100644 cpu/mpc8xxx/fsl_ddr2.c
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de All a hacker needs is a tight PUSHJ, a loose pair of UUOs, and a warm place to shift.
Wolfgang Denk
AppliedPATCH v3 3/16 FSL DDR: Add DDR1 support
In reply to Kumar GalaDear Kumar Gala,
Quoted 7 lines · In message <[email protected]> you…
Signed-off-by James Yang <[email protected]>Signed-off-by Jon Loeliger <[email protected]>Signed-off-by Kumar Gala <[email protected]>--- cpu/mpc8xxx/fsl_ddr1.c | 342 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 342 insertions(+), 0 deletions(-) create mode 100644 cpu/mpc8xxx/fsl_ddr1.c
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Any sufficiently advanced technology is indistinguishable from magic.
- Arthur C. ClarkeWolfgang Denk
AppliedPATCH v3 2/16 FSL DDR: Rewrite the FSL mpc8xxx DDR controller setup code.
In reply to Kumar GalaDear Kumar Gala,
Quoted 19 lines · In message <[email protected]> you…
Signed-off-by James Yang <[email protected]>Signed-off-by Jon Loeliger <[email protected]>Signed-off-by Becky Bruce <[email protected]>Signed-off-by Ed Swarthout <[email protected]>Signed-off-by Kumar Gala <[email protected]>--- cpu/mpc85xx/Makefile | 9 + cpu/mpc86xx/Makefile | 4 + cpu/mpc8xxx/Makefile | 29 + cpu/mpc8xxx/common_timing_params.h | 55 ++ cpu/mpc8xxx/ddr2_dimm_params.h | 86 +++ cpu/mpc8xxx/fsl_ddr_ctrl.c | 1002 +++++++++++++++++++++++++++++++ cpu/mpc8xxx/fsl_ddr_sdram.c | 1134 ++++++++++++++++++++++++++++++++++++ cpu/mpc8xxx/fsl_ddr_sdram.h | 90 +++ cpu/mpc8xxx/fsl_memctrl.h | 44 ++ cpu/mpc8xxx/fsl_util.c | 59 ++ cpu/mpc8xxx/memctl_options.h | 85 +++ 11 files changed, 2597 insertions(+), 0 deletions(-) create mode 100644 cpu/mpc8xxx/Makefile
Quoted 8 lines
create mode 100644 cpu/mpc8xxx/common_timing_params.h create mode 100644 cpu/mpc8xxx/ddr2_dimm_params.h create mode 100644 cpu/mpc8xxx/fsl_ddr_ctrl.c create mode 100644 cpu/mpc8xxx/fsl_ddr_sdram.c create mode 100644 cpu/mpc8xxx/fsl_ddr_sdram.h create mode 100644 cpu/mpc8xxx/fsl_memctrl.h create mode 100644 cpu/mpc8xxx/fsl_util.c create mode 100644 cpu/mpc8xxx/memctl_options.h
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I had the rare misfortune of being one of the first people to try and implement a PL/1 compiler. -- T. Cheatham
PATCH v3 2/16 FSL DDR: Rewrite the FSL mpc8xxx DDR controller setup code.
In reply to Kumar GalaHello,
[snip]
Quoted 40 lines
cpu/mpc8xxx/fsl_ddr_ctrl.c new file +40
-0+ +/* DDR SDRAM control configuration 2 (DDR_SDRAM_CFG_2) */ +static void set_ddr_sdram_cfg_2 (fsl_memctl_config_regs_t *ddr, +const memctl_options_t *popts) +{ +unsigned int frc_sr =0 ;/* Force self refresh */ +unsigned int sr_ie =0 ;/* Self-refresh interrupt enable */ +unsigned int dll_rst_dis;/* DLL reset disable */ +unsigned int dqs_cfg;/* DQS configuration */ +unsigned int odt_cfg;/* ODT configuration */ +unsigned int num_pr;/* Number of posted refreshes */ +unsigned int obc_cfg;/* On-The-Fly Burst Chop Cfg */ +unsigned int ap_en;/* Address Parity Enable */ +unsigned int d_init;/* DRAM data initialization */ +unsigned int rcw_en =0 ;/* Register Control Word Enable */ +unsigned int md_en =0 ;/* Mirrored DIMM Enable */ + + dll_rst_dis =1 ;/* Make this configurable */ + dqs_cfg = popts->DQS_config; +if (popts->cs_local_opts[0 ].odt_rd_cfg + || popts->cs_local_opts[0 ].odt_wr_cfg) { +/* FIXME */ + odt_cfg =2 ; + }else { + odt_cfg =0 ; + } + + num_pr =1 ;/* Make this configurable */ + +/* +* 8572 manual says +* {TIMING_CFG_1[PRETOACT] +* + [DDR_SDRAM_CFG_2[NUM_PR] +* * ({EXT_REFREC || REFREC} + 8 + 2)]} +* << DDR_SDRAM_INTERVAL[REFINT] +*/ + + obc_cfg =0 ;/* Make this configurable? */ + ap_en =0 ;/* Make this configurable? */ +
cpu/mpc8xxx/fsl_ddr_ctrl.c line 442
Quoted 10 lines
cpu/mpc8xxx/fsl_ddr_ctrl.c new file +10
-0+#if defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER ) +/* Use the DDR controller to auto initialize memory. */ + d_init =1 ; + ddr->ddr_data_init =CONFIG_MEM_INIT_VALUE ; +debug ("DDR: ddr_data_init = 0x%08x\n" , ddr->ddr_data_init); +#else +/* Memory will be initialized via DMA, or not at all. */ + d_init =0 ; +#endif +
I'm using the current head (33aa4eac66b71c797bbc13b3afe432a2132947d4) on a mpc8572-based board. It uses DDR2 and has support for ECC. While enabling ECC support, I noticed that the "old" CONFIG_ECC_INIT_VIA_DDRCONTROLLER define is still being used to enable memory initialization on bootup while a new ECC_init_using_memctl field in the memctl_options_s structure is also present.
Currently it looks like ECC_init_using_memctl doesn't do anything and is only referenced in one location below:
cpu/mpc8xxx/fsl_ddr_sdram.c line 579
Quoted 7 lines
cpu/mpc8xxx/fsl_ddr_sdram.c new file +7
-0+/* Pick ECC modes */ +#ifdef CONFIG_DDR_ECC + popts->ECC_mode =1 ;/* 0 = disabled, 1 = enabled */ +#else + popts->ECC_mode =0 ;/* 0 = disabled, 1 = enabled */ +#endif + popts->ECC_init_using_memctl =1 ;/* 0 = use DMA, 1 = use memctl */
The intended functionality of CONFIG_ECC_INIT_VIA_DDRCONTROLLER and ECC_init_using_memctl seem to be the same, but only one of them is being used, and they currently are unrelated which is a bit confusing.
Should the ECC_init_using_memctl field be removed, or is the intention to replace CONFIG_ECC_INIT_VIA_DDRCONTROLLER functionality with ECC_init_using_memctl as some point?
Thanks for any insight,
Peter
PATCH v3 2/16 FSL DDR: Rewrite the FSL mpc8xxx DDR controller setup code.
Quoted 81 lines · Peter Tyser
Hello,
[snip]
Quoted 40 lines
cpu/mpc8xxx/fsl_ddr_ctrl.c new file +40
-0+ +/* DDR SDRAM control configuration 2 (DDR_SDRAM_CFG_2) */ +static void set_ddr_sdram_cfg_2 (fsl_memctl_config_regs_t *ddr, +const memctl_options_t *popts) +{ +unsigned int frc_sr =0 ;/* Force self refresh */ +unsigned int sr_ie =0 ;/* Self-refresh interrupt enable */ +unsigned int dll_rst_dis;/* DLL reset disable */ +unsigned int dqs_cfg;/* DQS configuration */ +unsigned int odt_cfg;/* ODT configuration */ +unsigned int num_pr;/* Number of posted refreshes */ +unsigned int obc_cfg;/* On-The-Fly Burst Chop Cfg */ +unsigned int ap_en;/* Address Parity Enable */ +unsigned int d_init;/* DRAM data initialization */ +unsigned int rcw_en =0 ;/* Register Control Word Enable */ +unsigned int md_en =0 ;/* Mirrored DIMM Enable */ + + dll_rst_dis =1 ;/* Make this configurable */ + dqs_cfg = popts->DQS_config; +if (popts->cs_local_opts[0 ].odt_rd_cfg + || popts->cs_local_opts[0 ].odt_wr_cfg) { +/* FIXME */ + odt_cfg =2 ; + }else { + odt_cfg =0 ; + } + + num_pr =1 ;/* Make this configurable */ + +/* +* 8572 manual says +* {TIMING_CFG_1[PRETOACT] +* + [DDR_SDRAM_CFG_2[NUM_PR] +* * ({EXT_REFREC || REFREC} + 8 + 2)]} +* << DDR_SDRAM_INTERVAL[REFINT] +*/ + + obc_cfg =0 ;/* Make this configurable? */ + ap_en =0 ;/* Make this configurable? */ +cpu/mpc8xxx/fsl_ddr_ctrl.c line 442
Quoted 10 lines
cpu/mpc8xxx/fsl_ddr_ctrl.c new file +10
-0+#if defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER ) +/* Use the DDR controller to auto initialize memory. */ + d_init =1 ; + ddr->ddr_data_init =CONFIG_MEM_INIT_VALUE ; +debug ("DDR: ddr_data_init = 0x%08x\n" , ddr->ddr_data_init); +#else +/* Memory will be initialized via DMA, or not at all. */ + d_init =0 ; +#endif +I'm using the current head (
33aa4eac66b71c797bbc13b3afe432a2132947d4) on
a mpc8572-based board. It uses DDR2 and has support for ECC. While enabling ECC support, I noticed that the "old"CONFIG_ECC_INIT_VIA_DDRCONTROLLERdefine is still being used to enable memory initialization on bootup while a newECC_init_using_memctlfield
in thememctl_options_sstructure is also present.Currently it looks like
ECC_init_using_memctldoesn't do anything and is
only referenced in one location below:cpu/mpc8xxx/fsl_ddr_sdram.c line 579
Quoted 7 lines
cpu/mpc8xxx/fsl_ddr_sdram.c new file +7
-0+/* Pick ECC modes */ +#ifdef CONFIG_DDR_ECC + popts->ECC_mode =1 ;/* 0 = disabled, 1 = enabled */ +#else + popts->ECC_mode =0 ;/* 0 = disabled, 1 = enabled */ +#endif + popts->ECC_init_using_memctl =1 ;/* 0 = use DMA, 1 = use memctl */ The intended functionality of
CONFIG_ECC_INIT_VIA_DDRCONTROLLERandECC_init_using_memctlseem to be the same, but only one of them is being
used, and they currently are unrelated which is a bit confusing.
Quoted 3 lines
Should the
ECC_init_using_memctlfield be removed, or is the intention to replaceCONFIG_ECC_INIT_VIA_DDRCONTROLLERfunctionality withECC_init_using_memctlas some point?
Now that the code is unified its will be easier to clean this up. I need to look at the ECC bits a little more to provide a better answer.
- k
Wolfgang Denk
AppliedPATCH v3 1/16 Add proper SPD definitions for DDR1/2/3
In reply to Kumar GalaDear Kumar Gala,
Quoted 5 lines · In message <[email protected]> you…
From: James Yang <[email protected]>
Also added a few helper functions for DDR1 & DDR2 to print SPD info and verify the checksum.
Quoted 8 lines
Signed-off-by Kumar Gala <[email protected]>--- common/Makefile | 1 + common/ddr_spd.c | 519 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/ddr_spd.h | 292 ++++++++++++++++++++++++++++++ 3 files changed, 812 insertions(+), 0 deletions(-) create mode 100644 common/ddr_spd.c create mode 100644 include/ddr_spd.h
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Blast medicine anyway! We've learned to tie into every organ in the human body but one. The brain! The brain is what life is all about. -- McCoy, "The Menagerie", stardate 3012.4