Skip to contentSkip to conversation

Driver/DDR: Moving Freescale DDR driver to a common driver

PATCH New York Sun 2 participants 10 messages Nov 25, 2013 – Dec 3, 2013

Subsystems (5)
lore
Share & tools
lore

York Sun

author
#0 lore raw

PATCH v4 1/6 Driver/DDR: Moving Freescale DDR driver to a common driver

Freescale DDR driver has been used for mpc83xx, mpc85xx, mpc86xx SoCs. The similar DDR controllers will be used for ARM-based SoCs.

---
Change log
v4: Rebase to latest master branch
Fix conflict after the patches moving stuff to arch/powerpc/cpu/
v3: Split the patch again to separate "combine ccsr_ddr for 83xx, 85xx and 86xx"
Fix git bisect broken caused by v1 patch.
v2: Replace macro CONFIG_FSL_DDR1 with CONFIG_SYS_FSL_DDR1
same to CONFIG_FSL_DDR2, CONFIG_FSL_DDR3
Replace macro CONFIG_SYS_FSL_DDR_PPC_GEN1 with CONFIG_SYS_FSL_DDRC_GEN3 same to CONFIG_SYS_FSL_DDR_PPC_GEN2, CONFIG_SYS_FSL_DDR_PPC_GEN3 Squash with v1 2/6 "combine ccsr_ddr for 83xx, 85xx and 86xx"

 Makefile                                           |    1 +
 README                                             |   41 ++++++++++--
 arch/powerpc/cpu/mpc83xx/Makefile                  |    6 +-
 arch/powerpc/cpu/mpc83xx/ecc.c                     |    4 +-
 arch/powerpc/cpu/mpc85xx/Makefile                  |   45 --------------
 arch/powerpc/cpu/mpc85xx/cpu.c                     |   16 ++---
 arch/powerpc/cpu/mpc85xx/mp.c                      |    2 +-
 arch/powerpc/cpu/mpc86xx/Makefile                  |    3 -
 arch/powerpc/cpu/mpc8xxx/Makefile                  |    6 --
 arch/powerpc/cpu/mpc8xxx/ddr/Makefile              |   29 ---------
 arch/powerpc/include/asm/config.h                  |    6 ++
 arch/powerpc/include/asm/config_mpc85xx.h          |   13 ++++
 arch/powerpc/include/asm/config_mpc86xx.h          |    2 +
 arch/powerpc/include/asm/immap_83xx.h              |    6 +-
 arch/powerpc/include/asm/immap_85xx.h              |    6 +-
 arch/powerpc/include/asm/immap_86xx.h              |    4 +-
 board/exmeritus/hww1u1a/ddr.c                      |    4 +-
 board/exmeritus/hww1u1a/hww1u1a.c                  |    4 +-
 board/freescale/b4860qds/ddr.c                     |    6 +-
 board/freescale/bsc9131rdb/ddr.c                   |    4 +-
 board/freescale/bsc9131rdb/spl_minimal.c           |    4 +-
 board/freescale/bsc9132qds/bsc9132qds.c            |    4 +-
 board/freescale/bsc9132qds/ddr.c                   |    4 +-
 board/freescale/bsc9132qds/spl_minimal.c           |    4 +-
 board/freescale/c29xpcie/ddr.c                     |    4 +-
 board/freescale/corenet_ds/ddr.c                   |    4 +-
 board/freescale/corenet_ds/eth_p4080.c             |    2 +-
 board/freescale/corenet_ds/p3041ds_ddr.c           |    2 +-
 board/freescale/corenet_ds/p4080ds_ddr.c           |    2 +-
 board/freescale/corenet_ds/p5020ds_ddr.c           |    2 +-
 board/freescale/corenet_ds/p5040ds_ddr.c           |    2 +-
 board/freescale/mpc8349emds/Makefile               |    2 +-
 board/freescale/mpc8349emds/ddr.c                  |    4 +-
 board/freescale/mpc8349emds/mpc8349emds.c          |    6 +-
 board/freescale/mpc8536ds/ddr.c                    |    4 +-
 board/freescale/mpc8536ds/mpc8536ds.c              |    2 +-
 board/freescale/mpc8540ads/ddr.c                   |    4 +-
 board/freescale/mpc8540ads/mpc8540ads.c            |    4 +-
 board/freescale/mpc8541cds/ddr.c                   |    4 +-
 board/freescale/mpc8541cds/mpc8541cds.c            |    2 +-
 board/freescale/mpc8544ds/ddr.c                    |    4 +-
 board/freescale/mpc8544ds/mpc8544ds.c              |    2 +-
 board/freescale/mpc8548cds/ddr.c                   |    4 +-
 board/freescale/mpc8548cds/mpc8548cds.c            |    2 +-
 board/freescale/mpc8555cds/ddr.c                   |    4 +-
 board/freescale/mpc8555cds/mpc8555cds.c            |    2 +-
 board/freescale/mpc8560ads/ddr.c                   |    4 +-
 board/freescale/mpc8560ads/mpc8560ads.c            |    4 +-
 board/freescale/mpc8568mds/ddr.c                   |    4 +-
 board/freescale/mpc8568mds/mpc8568mds.c            |    2 +-
 board/freescale/mpc8569mds/ddr.c                   |    4 +-
 board/freescale/mpc8569mds/mpc8569mds.c            |    4 +-
 board/freescale/mpc8572ds/ddr.c                    |    4 +-
 board/freescale/mpc8572ds/mpc8572ds.c              |    2 +-
 board/freescale/mpc8610hpcd/Makefile               |    2 +-
 board/freescale/mpc8610hpcd/ddr.c                  |    4 +-
 board/freescale/mpc8610hpcd/mpc8610hpcd.c          |    2 +-
 board/freescale/mpc8641hpcn/Makefile               |    2 +-
 board/freescale/mpc8641hpcn/ddr.c                  |    4 +-
 board/freescale/mpc8641hpcn/mpc8641hpcn.c          |    2 +-
 board/freescale/p1010rdb/ddr.c                     |    4 +-
 board/freescale/p1010rdb/spl_minimal.c             |    4 +-
 board/freescale/p1022ds/ddr.c                      |    4 +-
 board/freescale/p1022ds/p1022ds.c                  |    2 +-
 board/freescale/p1022ds/spl_minimal.c              |    2 +-
 board/freescale/p1023rdb/ddr.c                     |    4 +-
 board/freescale/p1023rdb/p1023rdb.c                |    2 +-
 board/freescale/p1023rds/p1023rds.c                |    4 +-
 board/freescale/p1_p2_rdb/ddr.c                    |    2 +-
 board/freescale/p1_p2_rdb_pc/ddr.c                 |    4 +-
 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c        |    2 +-
 board/freescale/p1_p2_rdb_pc/spl_minimal.c         |    2 +-
 board/freescale/p1_twr/ddr.c                       |    4 +-
 board/freescale/p1_twr/p1_twr.c                    |    2 +-
 board/freescale/p2020come/ddr.c                    |    4 +-
 board/freescale/p2020ds/ddr.c                      |    6 +-
 board/freescale/p2020ds/p2020ds.c                  |    4 +-
 board/freescale/p2041rdb/ddr.c                     |    4 +-
 board/freescale/t1040qds/ddr.c                     |    4 +-
 board/freescale/t104xrdb/ddr.c                     |    4 +-
 board/freescale/t4qds/ddr.c                        |    4 +-
 board/freescale/t4qds/eth.c                        |    2 +-
 board/gdsys/p1022/controlcenterd.c                 |    2 +-
 board/gdsys/p1022/ddr.c                            |    4 +-
 board/keymile/kmp204x/ddr.c                        |    4 +-
 board/sbc8548/Makefile                             |    2 +-
 board/sbc8548/ddr.c                                |    6 +-
 board/sbc8548/sbc8548.c                            |    2 +-
 board/sbc8641d/Makefile                            |    2 +-
 board/sbc8641d/ddr.c                               |    4 +-
 board/sbc8641d/sbc8641d.c                          |    2 +-
 board/socrates/Makefile                            |    2 +-
 board/socrates/ddr.c                               |    4 +-
 board/socrates/sdram.c                             |    4 +-
 board/stx/stxgp3/Makefile                          |    2 +-
 board/stx/stxgp3/ddr.c                             |    4 +-
 board/stx/stxgp3/stxgp3.c                          |    2 +-
 board/stx/stxssa/Makefile                          |    2 +-
 board/stx/stxssa/ddr.c                             |    4 +-
 board/stx/stxssa/stxssa.c                          |    2 +-
 board/xes/xpedite517x/ddr.c                        |    4 +-
 board/xes/xpedite517x/xpedite517x.c                |    2 +-
 board/xes/xpedite520x/ddr.c                        |    4 +-
 board/xes/xpedite537x/ddr.c                        |    4 +-
 board/xes/xpedite550x/ddr.c                        |    4 +-
 drivers/ddr/fsl/Makefile                           |   34 ++++++++++
 .../mpc8xxx/ddr => drivers/ddr/fsl}/ctrl_regs.c    |   65 ++++++++++----------
 .../ddr => drivers/ddr/fsl}/ddr1_dimm_params.c     |    4 +-
 .../ddr => drivers/ddr/fsl}/ddr2_dimm_params.c     |    4 +-
 .../ddr => drivers/ddr/fsl}/ddr3_dimm_params.c     |    4 +-
 .../mpc8xxx/ddr => drivers/ddr/fsl}/interactive.c  |   21 ++++---
 .../ddr/fsl}/lc_common_dimm_params.c               |   18 +++---
 .../cpu/mpc8xxx/ddr => drivers/ddr/fsl}/main.c     |    4 +-
 .../ddr/fsl/mpc85xx_ddr_gen1.c                     |    6 +-
 .../ddr/fsl/mpc85xx_ddr_gen2.c                     |    4 +-
 .../ddr/fsl/mpc85xx_ddr_gen3.c                     |   16 ++---
 .../ddr-8641.c => drivers/ddr/fsl/mpc86xx_ddr.c    |    6 +-
 .../cpu/mpc8xxx/ddr => drivers/ddr/fsl}/options.c  |   32 +++++-----
 .../cpu/mpc8xxx/ddr => drivers/ddr/fsl}/util.c     |    9 +--
 .../mpc8xxx/ddr => include}/common_timing_params.h |    0
 include/configs/B4860QDS.h                         |    2 +-
 include/configs/BSC9131RDB.h                       |    2 +-
 include/configs/BSC9132QDS.h                       |    2 +-
 include/configs/C29XPCIE.h                         |    2 +-
 include/configs/HWW1U1A.h                          |    2 +-
 include/configs/MPC8349EMDS.h                      |    6 +-
 include/configs/MPC8536DS.h                        |    2 +-
 include/configs/MPC8540ADS.h                       |    2 +-
 include/configs/MPC8541CDS.h                       |    2 +-
 include/configs/MPC8544DS.h                        |    2 +-
 include/configs/MPC8548CDS.h                       |    2 +-
 include/configs/MPC8555CDS.h                       |    2 +-
 include/configs/MPC8560ADS.h                       |    2 +-
 include/configs/MPC8568MDS.h                       |    2 +-
 include/configs/MPC8569MDS.h                       |    2 +-
 include/configs/MPC8572DS.h                        |    2 +-
 include/configs/MPC8610HPCD.h                      |    2 +-
 include/configs/MPC8641HPCN.h                      |    2 +-
 include/configs/P1010RDB.h                         |    2 +-
 include/configs/P1022DS.h                          |    2 +-
 include/configs/P1023RDB.h                         |    2 +-
 include/configs/P1_P2_RDB.h                        |    2 +-
 include/configs/P2020COME.h                        |    2 +-
 include/configs/P2020DS.h                          |    4 +-
 include/configs/P2041RDB.h                         |    2 +-
 include/configs/T1040QDS.h                         |    2 +-
 include/configs/T1040RDB.h                         |    2 +-
 include/configs/T1042RDB_PI.h                      |    2 +-
 include/configs/controlcenterd.h                   |    2 +-
 include/configs/corenet_ds.h                       |    2 +-
 include/configs/km/kmp204x-common.h                |    2 +-
 include/configs/mpq101.h                           |    2 +-
 include/configs/p1_p2_rdb_pc.h                     |    2 +-
 include/configs/p1_twr.h                           |    2 +-
 include/configs/sbc8548.h                          |    2 +-
 include/configs/socrates.h                         |    2 +-
 include/configs/stxgp3.h                           |    2 +-
 include/configs/stxssa.h                           |    2 +-
 include/configs/t4qds.h                            |    2 +-
 include/configs/xpedite517x.h                      |    2 +-
 include/configs/xpedite520x.h                      |    2 +-
 include/configs/xpedite537x.h                      |    2 +-
 include/configs/xpedite550x.h                      |    2 +-
 .../cpu/mpc8xxx/ddr/ddr.h => include/fsl_ddr.h     |    6 +-
 .../include/asm => include}/fsl_ddr_dimm_params.h  |    0
 .../include/asm => include}/fsl_ddr_sdram.h        |    8 +--
 nand_spl/board/freescale/mpc8569mds/nand_boot.c    |    2 +-
 nand_spl/board/freescale/p1023rds/nand_boot.c      |    4 +-
 nand_spl/board/freescale/p1_p2_rdb/nand_boot.c     |    2 +-
 spl/Makefile                                       |    1 +
 170 files changed, 416 insertions(+), 408 deletions(-)
 delete mode 100644 arch/powerpc/cpu/mpc8xxx/ddr/Makefile
 create mode 100644 drivers/ddr/fsl/Makefile
 rename {arch/powerpc/cpu/mpc8xxx/ddr => drivers/ddr/fsl}/ctrl_regs.c (97%)
 rename {arch/powerpc/cpu/mpc8xxx/ddr => drivers/ddr/fsl}/ddr1_dimm_params.c (99%)
 rename {arch/powerpc/cpu/mpc8xxx/ddr => drivers/ddr/fsl}/ddr2_dimm_params.c (99%)
 rename {arch/powerpc/cpu/mpc8xxx/ddr => drivers/ddr/fsl}/ddr3_dimm_params.c (99%)
 rename {arch/powerpc/cpu/mpc8xxx/ddr => drivers/ddr/fsl}/interactive.c (99%)
 rename {arch/powerpc/cpu/mpc8xxx/ddr => drivers/ddr/fsl}/lc_common_dimm_params.c (98%)
 rename {arch/powerpc/cpu/mpc8xxx/ddr => drivers/ddr/fsl}/main.c (99%)
 rename arch/powerpc/cpu/mpc85xx/ddr-gen1.c => drivers/ddr/fsl/mpc85xx_ddr_gen1.c (93%)
 rename arch/powerpc/cpu/mpc85xx/ddr-gen2.c => drivers/ddr/fsl/mpc85xx_ddr_gen2.c (96%)
 rename arch/powerpc/cpu/mpc85xx/ddr-gen3.c => drivers/ddr/fsl/mpc85xx_ddr_gen3.c (97%)
 rename arch/powerpc/cpu/mpc86xx/ddr-8641.c => drivers/ddr/fsl/mpc86xx_ddr.c (95%)
 rename {arch/powerpc/cpu/mpc8xxx/ddr => drivers/ddr/fsl}/options.c (97%)
 rename {arch/powerpc/cpu/mpc8xxx/ddr => drivers/ddr/fsl}/util.c (96%)
 rename {arch/powerpc/cpu/mpc8xxx/ddr => include}/common_timing_params.h (100%)
 rename arch/powerpc/cpu/mpc8xxx/ddr/ddr.h => include/fsl_ddr.h (97%)
 rename {arch/powerpc/include/asm => include}/fsl_ddr_dimm_params.h (100%)
 rename {arch/powerpc/include/asm => include}/fsl_ddr_sdram.h (98%)
Makefile +1 -0
index b8713a4..2ad1d37 100644
@@ -267,6 +267,7 @@ LIBS-y += drivers/power/ \
 	drivers/power/battery/
 LIBS-y += drivers/spi/
 LIBS-$(CONFIG_FMAN_ENET) += drivers/net/fm/
+LIBS-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
 LIBS-y += drivers/serial/
 LIBS-y += drivers/usb/eth/
 LIBS-y += drivers/usb/gadget/
README +36 -5

59 lines not on this page · raw message

arch/powerpc/cpu/mpc83xx/Makefile +3 -3
index d3f7001..c345dd6 100644
@@ -38,11 +38,11 @@ obj-$(CONFIG_OF_LIBFDT) += fdt.o
 # Stub implementations of cache management functions for USB
 obj-y += cache.o
 
-ifdef CONFIG_FSL_DDR2
-obj-$(CONFIG_MPC8349) += ../mpc85xx/ddr-gen2.o
+ifdef CONFIG_SYS_FSL_DDR2
+obj-$(CONFIG_MPC8349) += $(SRCTREE)/drivers/ddr/fsl/mpc85xx_ddr_gen2.o
 else
 obj-y += spd_sdram.o
 endif
-obj-$(CONFIG_FSL_DDR2) += law.o
+obj-$(CONFIG_SYS_FSL_DDR2) += law.o
 
 endif # not minimal
arch/powerpc/cpu/mpc83xx/ecc.c +2 -2
index 120b37b..6b7f72a 100644
@@ -15,7 +15,7 @@
 void ecc_print_status(void)
 {
 	immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-#ifdef CONFIG_FSL_DDR2
+#ifdef CONFIG_SYS_FSL_DDR2
 	ccsr_ddr_t *ddr = &immap->ddr;
 #else
 	ddr83xx_t *ddr = &immap->ddr;
@@ -99,7 +99,7 @@ void ecc_print_status(void)
 int do_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
 	immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-#ifdef CONFIG_FSL_DDR2
+#ifdef CONFIG_SYS_FSL_DDR2
 	ccsr_ddr_t *ddr = &immap->ddr;
 #else
 	ddr83xx_t *ddr = &immap->ddr;
arch/powerpc/cpu/mpc85xx/Makefile +0 -45

51 lines not on this page · raw message

arch/powerpc/cpu/mpc85xx/cpu.c +8 -8
index 1a0196c..552acc6 100644
@@ -22,7 +22,7 @@
 #include <asm/fsl_lbc.h>
 #include <post.h>
 #include <asm/processor.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -453,21 +453,21 @@ static void dump_spd_ddr_reg(void)
 	for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++) {
 		switch (i) {
 		case 0:
-			ddr[i] = (void *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+			ddr[i] = (void *)CONFIG_SYS_FSL_DDR_ADDR;
 			break;
-#if defined(CONFIG_SYS_MPC8xxx_DDR2_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 1)
+#if defined(CONFIG_SYS_FSL_DDR2_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 1)
 		case 1:
-			ddr[i] = (void *)CONFIG_SYS_MPC8xxx_DDR2_ADDR;
+			ddr[i] = (void *)CONFIG_SYS_FSL_DDR2_ADDR;
 			break;
 #endif
-#if defined(CONFIG_SYS_MPC8xxx_DDR3_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 2)
+#if defined(CONFIG_SYS_FSL_DDR3_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 2)
 		case 2:
-			ddr[i] = (void *)CONFIG_SYS_MPC8xxx_DDR3_ADDR;
+			ddr[i] = (void *)CONFIG_SYS_FSL_DDR3_ADDR;
 			break;
 #endif
-#if defined(CONFIG_SYS_MPC8xxx_DDR4_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 3)
+#if defined(CONFIG_SYS_FSL_DDR4_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 3)
 		case 3:
-			ddr[i] = (void *)CONFIG_SYS_MPC8xxx_DDR4_ADDR;
+			ddr[i] = (void *)CONFIG_SYS_FSL_DDR4_ADDR;
 			break;
 #endif
 		default:
arch/powerpc/cpu/mpc85xx/mp.c +1 -1
index 5f198eb..88c8e65 100644
@@ -11,7 +11,7 @@
 #include <asm/io.h>
 #include <asm/mmu.h>
 #include <asm/fsl_law.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include "mp.h"
 
 DECLARE_GLOBAL_DATA_PTR;
arch/powerpc/cpu/mpc86xx/Makefile +0 -3
index bcb786d..0f790b0 100644
@@ -16,9 +16,6 @@ obj-$(CONFIG_MP) += release.o
 
 obj-y	+= cpu.o
 obj-y	+= cpu_init.o
-# 8610 & 8641 are identical w/regards to DDR
-obj-$(CONFIG_MPC8610) += ddr-8641.o
-obj-$(CONFIG_MPC8641) += ddr-8641.o
 obj-$(CONFIG_OF_LIBFDT) += fdt.o
 obj-y	+= interrupts.o
 obj-$(CONFIG_MP) += mp.o
arch/powerpc/cpu/mpc8xxx/Makefile +0 -6
index 1d083bf..395fed1 100644
@@ -31,9 +31,3 @@ obj-$(CONFIG_SYS_SRIO) += srio.o
 obj-$(CONFIG_FSL_LAW) += law.o
 
 endif
-
-ifdef CONFIG_SPL_BUILD
-obj-$(CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT) += ddr/
-else
-obj-y += ddr/
-endif
arch/powerpc/cpu/mpc8xxx/ddr/Makefile deleted +0 -29
deleted file mode 100644
index 8cbc06c..0000000
@@ -1,29 +0,0 @@
-#
-# Copyright 2008-2011 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.
-#
-
-obj-$(CONFIG_FSL_DDR1)	+= main.o util.o ctrl_regs.o options.o \
-				   lc_common_dimm_params.o
-
-obj-$(CONFIG_FSL_DDR2)	+= main.o util.o ctrl_regs.o options.o \
-				   lc_common_dimm_params.o
-
-obj-$(CONFIG_FSL_DDR3)	+= main.o util.o ctrl_regs.o options.o \
-				   lc_common_dimm_params.o
-ifdef CONFIG_DDR_SPD
-SPD := y
-endif
-ifdef CONFIG_SPD_EEPROM
-SPD := y
-endif
-ifdef SPD
-obj-$(CONFIG_FSL_DDR1)	+= ddr1_dimm_params.o
-obj-$(CONFIG_FSL_DDR2)	+= ddr2_dimm_params.o
-obj-$(CONFIG_FSL_DDR3)	+= ddr3_dimm_params.o
-endif
-
-obj-$(CONFIG_FSL_DDR_INTERACTIVE) += interactive.o
arch/powerpc/include/asm/config.h +6 -0
index 3c17c99..423a6fb 100644
@@ -9,10 +9,16 @@
 
 #ifdef CONFIG_MPC85xx
 #include <asm/config_mpc85xx.h>
+#define CONFIG_SYS_FSL_DDR
 #endif
 
 #ifdef CONFIG_MPC86xx
 #include <asm/config_mpc86xx.h>
+#define CONFIG_SYS_FSL_DDR
+#endif
+
+#ifdef CONFIG_MPC83xx
+#define CONFIG_SYS_FSL_DDR
 #endif
 
 #ifndef HWCONFIG_BUFFER_SIZE
arch/powerpc/include/asm/config_mpc85xx.h +13 -0
index d4cd27d..047fdf1 100644
@@ -40,17 +40,20 @@
 #elif defined(CONFIG_MPC8540)
 #define CONFIG_MAX_CPUS			1
 #define CONFIG_SYS_FSL_NUM_LAWS		8
+#define CONFIG_SYS_FSL_DDRC_GEN1
 #define CONFIG_SYS_CCSRBAR_DEFAULT	0xff700000
 
 #elif defined(CONFIG_MPC8541)
 #define CONFIG_MAX_CPUS			1
 #define CONFIG_SYS_FSL_NUM_LAWS		8
+#define CONFIG_SYS_FSL_DDRC_GEN1
 #define CONFIG_SYS_FSL_SEC_COMPAT	2
 #define CONFIG_SYS_CCSRBAR_DEFAULT	0xff700000
 
 #elif defined(CONFIG_MPC8544)
 #define CONFIG_MAX_CPUS			1
 #define CONFIG_SYS_FSL_NUM_LAWS		10
+#define CONFIG_SYS_FSL_DDRC_GEN2
 #define CONFIG_SYS_PPC_E500_DEBUG_TLB	0
 #define CONFIG_SYS_FSL_SEC_COMPAT	2
 #define CONFIG_SYS_CCSRBAR_DEFAULT	0xff700000
@@ -59,6 +62,7 @@
 #elif defined(CONFIG_MPC8548)
 #define CONFIG_MAX_CPUS			1
 #define CONFIG_SYS_FSL_NUM_LAWS		10
+#define CONFIG_SYS_FSL_DDRC_GEN2
 #define CONFIG_SYS_PPC_E500_DEBUG_TLB	0
 #define CONFIG_SYS_FSL_SEC_COMPAT	2
 #define CONFIG_SYS_CCSRBAR_DEFAULT	0xff700000
@@ -77,17 +81,20 @@
 #elif defined(CONFIG_MPC8555)
 #define CONFIG_MAX_CPUS			1
 #define CONFIG_SYS_FSL_NUM_LAWS		8
+#define CONFIG_SYS_FSL_DDRC_GEN1
 #define CONFIG_SYS_FSL_SEC_COMPAT	2
 #define CONFIG_SYS_CCSRBAR_DEFAULT	0xff700000
 
 #elif defined(CONFIG_MPC8560)
 #define CONFIG_MAX_CPUS			1
 #define CONFIG_SYS_FSL_NUM_LAWS		8
+#define CONFIG_SYS_FSL_DDRC_GEN1
 #define CONFIG_SYS_CCSRBAR_DEFAULT	0xff700000
 
 #elif defined(CONFIG_MPC8568)
 #define CONFIG_MAX_CPUS			1
 #define CONFIG_SYS_FSL_NUM_LAWS		10
+#define CONFIG_SYS_FSL_DDRC_GEN2
 #define CONFIG_SYS_FSL_SEC_COMPAT	2
 #define QE_MURAM_SIZE			0x10000UL
 #define MAX_QE_RISC			2
@@ -738,4 +745,10 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)
 #define CONFIG_SYS_FSL_THREADS_PER_CORE 1
 #endif
 
+#if !defined(CONFIG_SYS_FSL_DDRC_GEN1) && \
+	!defined(CONFIG_SYS_FSL_DDRC_GEN2) && \
+	!defined(CONFIG_SYS_FSL_DDRC_GEN3)
+#define CONFIG_SYS_FSL_DDRC_GEN3
+#endif
+
 #endif /* _ASM_MPC85xx_CONFIG_H_ */
arch/powerpc/include/asm/config_mpc86xx.h +2 -0
index 694b110..4f9b225 100644
@@ -7,6 +7,8 @@
 #ifndef _ASM_MPC86xx_CONFIG_H_
 #define _ASM_MPC86xx_CONFIG_H_
 
+#define CONFIG_SYS_FSL_DDR_86XX
+
 /* SoC specific defines for Freescale MPC86xx processors */
 
 #if defined(CONFIG_MPC8610)
arch/powerpc/include/asm/immap_83xx.h +3 -3
index 289f7ca..1042b0c 100644
@@ -279,7 +279,7 @@ typedef struct qesba83xx {
 /*
  * DDR Memory Controller Memory Map
  */
-#if defined(CONFIG_FSL_DDR2) || defined(CONFIG_FSL_DDR3)
+#if defined(CONFIG_SYS_FSL_DDR2) || defined(CONFIG_SYS_FSL_DDR3)
 typedef struct ccsr_ddr {
 	u32	cs0_bnds;		/* Chip Select 0 Memory Bounds */
 	u8	res1[4];
@@ -739,7 +739,7 @@ typedef struct immap {
 	u8			dll_ddr[0x100];
 	u8			dll_lbc[0x100];
 	u8			res1[0xE00];
-#if defined(CONFIG_FSL_DDR2) || defined(CONFIG_FSL_DDR3)
+#if defined(CONFIG_SYS_FSL_DDR2) || defined(CONFIG_SYS_FSL_DDR3)
 	ccsr_ddr_t		ddr;	/* DDR Memory Controller Memory */
 #else
 	ddr83xx_t		ddr;	/* DDR Memory Controller Memory */
@@ -1029,7 +1029,7 @@ typedef struct immap {
 #endif
 
 #define CONFIG_SYS_MPC8xxx_DDR_OFFSET	(0x2000)
-#define CONFIG_SYS_MPC8xxx_DDR_ADDR \
+#define CONFIG_SYS_FSL_DDR_ADDR \
 			(CONFIG_SYS_IMMR + CONFIG_SYS_MPC8xxx_DDR_OFFSET)
 #define CONFIG_SYS_MPC83xx_DMA_OFFSET	(0x8000)
 #define CONFIG_SYS_MPC83xx_DMA_ADDR \
arch/powerpc/include/asm/immap_85xx.h +3 -3
index 6312618..d479216 100644
@@ -3048,11 +3048,11 @@ struct ccsr_pman {
 	(CONFIG_SYS_IMMR + CONFIG_SYS_FSL_CORENET_RCPM_OFFSET)
 #define CONFIG_SYS_MPC85xx_ECM_ADDR \
 	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_ECM_OFFSET)
-#define CONFIG_SYS_MPC8xxx_DDR_ADDR \
+#define CONFIG_SYS_FSL_DDR_ADDR \
 	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC8xxx_DDR_OFFSET)
-#define CONFIG_SYS_MPC8xxx_DDR2_ADDR \
+#define CONFIG_SYS_FSL_DDR2_ADDR \
 	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC8xxx_DDR2_OFFSET)
-#define CONFIG_SYS_MPC8xxx_DDR3_ADDR \
+#define CONFIG_SYS_FSL_DDR3_ADDR \
 	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC8xxx_DDR3_OFFSET)
 #define CONFIG_SYS_LBC_ADDR \
 	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_LBC_OFFSET)
arch/powerpc/include/asm/immap_86xx.h +2 -2
index 2a704fe..046a434 100644
@@ -1253,9 +1253,9 @@ typedef struct immap {
 extern immap_t  *immr;
 
 #define CONFIG_SYS_MPC8xxx_DDR_OFFSET	0x2000
-#define CONFIG_SYS_MPC8xxx_DDR_ADDR	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC8xxx_DDR_OFFSET)
+#define CONFIG_SYS_FSL_DDR_ADDR	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC8xxx_DDR_OFFSET)
 #define CONFIG_SYS_MPC8xxx_DDR2_OFFSET	0x6000
-#define CONFIG_SYS_MPC8xxx_DDR2_ADDR	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC8xxx_DDR2_OFFSET)
+#define CONFIG_SYS_FSL_DDR2_ADDR	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC8xxx_DDR2_OFFSET)
 #define CONFIG_SYS_MPC86xx_DMA_OFFSET	0x21000
 #define CONFIG_SYS_MPC86xx_DMA_ADDR	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC86xx_DMA_OFFSET)
 #define CONFIG_SYS_MPC86xx_PIC_OFFSET	0x40000
board/exmeritus/hww1u1a/ddr.c +2 -2
index 23a71d5..e1f6865 100644
@@ -9,8 +9,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/exmeritus/hww1u1a/hww1u1a.c +2 -2
index 7c11e38..104987a 100644
@@ -13,7 +13,7 @@
 #include <asm/cache.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/io.h>
 #include <miiphy.h>
 #include <libfdt.h>
@@ -89,7 +89,7 @@ int checkboard(void)
 	 * and delay a while before we continue.
 	 */
 	if (mpc85xx_gpio_get(GPIO_RESETS)) {
-		ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+		ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
 
 		puts("Debugger detected... extra device reset enabled!\n");
 
board/freescale/b4860qds/ddr.c +3 -3
index 2d14923..187c3b3 100644
@@ -9,11 +9,11 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <fsl_ddr.h>
 #include <asm/mmu.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 #include <asm/fsl_law.h>
-#include <../arch/powerpc/cpu/mpc8xxx/ddr/ddr.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
board/freescale/bsc9131rdb/ddr.c +2 -2
index a9e92f2..339c576 100644
@@ -8,8 +8,8 @@
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/processor.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 #include <asm/io.h>
 #include <asm/fsl_law.h>
 
board/freescale/bsc9131rdb/spl_minimal.c +2 -2
index dd5ea95..9746271 100644
@@ -10,7 +10,7 @@
 #include <nand.h>
 #include <linux/compiler.h>
 #include <asm/fsl_law.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -20,7 +20,7 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 static void sdram_init(void)
 {
-	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
 
 	__raw_writel(CONFIG_SYS_DDR_CS0_BNDS, &ddr->cs0_bnds);
 	__raw_writel(CONFIG_SYS_DDR_CS0_CONFIG, &ddr->cs0_config);
board/freescale/bsc9132qds/bsc9132qds.c +2 -2
index a895e4e..31bbf62 100644
@@ -20,7 +20,7 @@
 #include <asm/fsl_ifc.h>
 #include <hwconfig.h>
 #include <i2c.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
 #ifdef CONFIG_PCI
 #include <pci.h>
@@ -134,7 +134,7 @@ void dsp_ddr_configure(void)
 	 *to the DSP DDR controller as connected DDR memories are similar.
 	 */
 	ccsr_ddr_t __iomem *pa_ddr =
-			(ccsr_ddr_t __iomem *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+			(ccsr_ddr_t __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
 	ccsr_ddr_t temp_ddr;
 	ccsr_ddr_t __iomem *dsp_ddr =
 			(ccsr_ddr_t __iomem *)CONFIG_SYS_FSL_DSP_CCSR_DDR_ADDR;
board/freescale/bsc9132qds/ddr.c +2 -2
index b3130be..43f163a 100644
@@ -8,8 +8,8 @@
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/processor.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 #include <asm/io.h>
 #include <asm/fsl_law.h>
 
board/freescale/bsc9132qds/spl_minimal.c +2 -2
index 2bf0a0c..0249dc5 100644
@@ -10,14 +10,14 @@
 #include <nand.h>
 #include <linux/compiler.h>
 #include <asm/fsl_law.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 static void sdram_init(void)
 {
-	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
 #if CONFIG_DDR_CLK_FREQ == 100000000
 	__raw_writel(CONFIG_SYS_DDR_CS0_BNDS, &ddr->cs0_bnds);
 	__raw_writel(CONFIG_SYS_DDR_CS0_CONFIG, &ddr->cs0_config);
board/freescale/c29xpcie/ddr.c +2 -2
index 57a9b61..968655c 100644
@@ -6,8 +6,8 @@
 
 #include <common.h>
 #include <asm/fsl_law.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 #include "cpld.h"
 
board/freescale/corenet_ds/ddr.c +2 -2
index 18e2ff6..e7e893a 100644
@@ -10,8 +10,8 @@
 #include <i2c.h>
 #include <hwconfig.h>
 #include <asm/mmu.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 #include <asm/fsl_law.h>
 
 DECLARE_GLOBAL_DATA_PTR;
board/freescale/corenet_ds/eth_p4080.c +1 -1
index e5beb55..5cbec7f 100644
@@ -12,7 +12,7 @@
 #include <asm/cache.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_law.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <asm/fsl_portals.h>
 #include <asm/fsl_liodn.h>
board/freescale/corenet_ds/p3041ds_ddr.c +1 -1
index 5a8ed94..4dead9c 100644
@@ -7,7 +7,7 @@
  */
 
 #include <common.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
 fixed_ddr_parm_t fixed_ddr_parm_0[] = {
 	{0, 0, NULL}
board/freescale/corenet_ds/p4080ds_ddr.c +1 -1
index 844e1d7..d572a5f 100644
@@ -7,7 +7,7 @@
  */
 
 #include <common.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
 #define CONFIG_SYS_DDR_TIMING_3_1200	0x01030000
 #define CONFIG_SYS_DDR_TIMING_0_1200	0xCC550104
board/freescale/corenet_ds/p5020ds_ddr.c +1 -1
index e65de36..9aaf6db 100644
@@ -7,7 +7,7 @@
  */
 
 #include <common.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
 fixed_ddr_parm_t fixed_ddr_parm_0[] = {
 	{0, 0, NULL}
board/freescale/corenet_ds/p5040ds_ddr.c +1 -1
index e65de36..9aaf6db 100644
@@ -7,7 +7,7 @@
  */
 
 #include <common.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
 fixed_ddr_parm_t fixed_ddr_parm_0[] = {
 	{0, 0, NULL}
board/freescale/mpc8349emds/Makefile +1 -1
index 23880f5..5c315f9 100644
@@ -7,4 +7,4 @@
 
 obj-y += mpc8349emds.o
 obj-$(CONFIG_PCI) += pci.o
-obj-$(CONFIG_FSL_DDR2) += ddr.o
+obj-$(CONFIG_SYS_FSL_DDR2) += ddr.o
board/freescale/mpc8349emds/ddr.c +2 -2
index 3d257d0..aae003d 100644
@@ -6,8 +6,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 struct board_specific_parameters {
 	u32 n_ranks;
board/freescale/mpc8349emds/mpc8349emds.c +3 -3
index ec48487..d909220 100644
@@ -12,8 +12,8 @@
 #include <i2c.h>
 #include <spi.h>
 #include <miiphy.h>
-#ifdef CONFIG_FSL_DDR2
-#include <asm/fsl_ddr_sdram.h>
+#ifdef CONFIG_SYS_FSL_DDR2
+#include <fsl_ddr_sdram.h>
 #else
 #include <spd_sdram.h>
 #endif
@@ -57,7 +57,7 @@ phys_size_t initdram (int board_type)
 	/* DDR SDRAM - Main SODIMM */
 	im->sysconf.ddrlaw[0].bar = CONFIG_SYS_DDR_BASE & LAWBAR_BAR;
 #if defined(CONFIG_SPD_EEPROM)
-#ifndef CONFIG_FSL_DDR2
+#ifndef CONFIG_SYS_FSL_DDR2
 	msize = spd_sdram() * 1024 * 1024;
 #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 	ddr_enable_ecc(msize);
board/freescale/mpc8536ds/ddr.c +2 -2
index d10370c..ebe3ba4 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/freescale/mpc8536ds/mpc8536ds.c +1 -1
index 5daab69..59e9a35 100644
@@ -12,7 +12,7 @@
 #include <asm/cache.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/io.h>
 #include <asm/fsl_serdes.h>
 #include <spd.h>
board/freescale/mpc8540ads/ddr.c +2 -2
index 9e79815..41d4cfe 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/freescale/mpc8540ads/mpc8540ads.c +2 -2
index 175eefc..97a5d19 100644
@@ -14,7 +14,7 @@
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <libfdt.h>
 #include <fdt_support.h>
 
@@ -168,7 +168,7 @@ void lbc_sdram_init(void)
 phys_size_t fixed_sdram(void)
 {
   #ifndef CONFIG_SYS_RAMBOOT
-	volatile ccsr_ddr_t *ddr= (void *)(CONFIG_SYS_MPC8xxx_DDR_ADDR);
+	volatile ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_FSL_DDR_ADDR);
 
 	ddr->cs0_bnds = CONFIG_SYS_DDR_CS0_BNDS;
 	ddr->cs0_config = CONFIG_SYS_DDR_CS0_CONFIG;
board/freescale/mpc8541cds/ddr.c +2 -2
index 78d73b0..d2ac6c4 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/freescale/mpc8541cds/mpc8541cds.c +1 -1
index 8115e5c..7b264dd 100644
@@ -11,7 +11,7 @@
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <ioports.h>
 #include <spd_sdram.h>
 #include <libfdt.h>
board/freescale/mpc8544ds/ddr.c +2 -2
index 6cf9bc1..aa30cab 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/freescale/mpc8544ds/mpc8544ds.c +1 -1
index dfd8fa6..1b33db6 100644
@@ -11,7 +11,7 @@
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <asm/io.h>
 #include <miiphy.h>
board/freescale/mpc8548cds/ddr.c +2 -2
index 996ffe2..b31ea34 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/freescale/mpc8548cds/mpc8548cds.c +1 -1
index 51e4bb5..ca9b43c 100644
@@ -12,7 +12,7 @@
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <miiphy.h>
 #include <libfdt.h>
board/freescale/mpc8555cds/ddr.c +2 -2
index 78d73b0..d2ac6c4 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/freescale/mpc8555cds/mpc8555cds.c +1 -1
index e2093d1..de5f566 100644
@@ -9,7 +9,7 @@
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <ioports.h>
 #include <spd_sdram.h>
 #include <libfdt.h>
board/freescale/mpc8560ads/ddr.c +2 -2
index 9e79815..41d4cfe 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/freescale/mpc8560ads/mpc8560ads.c +2 -2
index 90a2522..7104e33 100644
@@ -14,7 +14,7 @@
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <ioports.h>
 #include <spd_sdram.h>
 #include <miiphy.h>
@@ -373,7 +373,7 @@ void lbc_sdram_init(void)
 phys_size_t fixed_sdram(void)
 {
   #ifndef CONFIG_SYS_RAMBOOT
-	volatile ccsr_ddr_t *ddr= (void *)(CONFIG_SYS_MPC8xxx_DDR_ADDR);
+	volatile ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_FSL_DDR_ADDR);
 
 	ddr->cs0_bnds = CONFIG_SYS_DDR_CS0_BNDS;
 	ddr->cs0_config = CONFIG_SYS_DDR_CS0_CONFIG;
board/freescale/mpc8568mds/ddr.c +2 -2
index b1f4f1f..6db92ef 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/freescale/mpc8568mds/mpc8568mds.c +1 -1
index ae80697..a8fdcb5 100644
@@ -12,7 +12,7 @@
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <spd_sdram.h>
 #include <i2c.h>
board/freescale/mpc8569mds/ddr.c +2 -2
index 68f686b..ef404b1 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/freescale/mpc8569mds/mpc8569mds.c +2 -2
index c928a96..60f5577 100644
@@ -14,7 +14,7 @@
 #include <asm/cache.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <asm/io.h>
 #include <spd_sdram.h>
@@ -231,7 +231,7 @@ int checkboard (void)
 #if !defined(CONFIG_SPD_EEPROM)
 phys_size_t fixed_sdram(void)
 {
-	volatile ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+	volatile ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
 	uint d_init;
 
 	out_be32(&ddr->cs0_bnds, CONFIG_SYS_DDR_CS0_BNDS);
board/freescale/mpc8572ds/ddr.c +2 -2
index 52e4f42..2bfc1a1 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 struct board_specific_parameters {
 	u32 n_ranks;
board/freescale/mpc8572ds/mpc8572ds.c +1 -1
index 657df6a..2fb4257 100644
@@ -12,7 +12,7 @@
 #include <asm/cache.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/io.h>
 #include <asm/fsl_serdes.h>
 #include <miiphy.h>
board/freescale/mpc8610hpcd/Makefile +1 -1
index 933ea17..2613004 100644
@@ -4,6 +4,6 @@
 #
 
 obj-y	+= mpc8610hpcd.o
-obj-$(CONFIG_FSL_DDR2) += ddr.o
+obj-$(CONFIG_SYS_FSL_DDR2) += ddr.o
 obj-y	+= law.o
 obj-$(CONFIG_FSL_DIU_FB)	+= mpc8610hpcd_diu.o
board/freescale/mpc8610hpcd/ddr.c +2 -2
index 6cf9bc1..aa30cab 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/freescale/mpc8610hpcd/mpc8610hpcd.c +1 -1
index ffdcf24..aa99623 100644
@@ -10,7 +10,7 @@
 #include <asm/processor.h>
 #include <asm/immap_86xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <i2c.h>
 #include <asm/io.h>
board/freescale/mpc8641hpcn/Makefile +1 -1
index 8d53af8..86c70bc 100644
@@ -7,4 +7,4 @@
 
 obj-y	+= mpc8641hpcn.o
 obj-y	+= law.o
-obj-$(CONFIG_FSL_DDR2) += ddr.o
+obj-$(CONFIG_SYS_FSL_DDR2) += ddr.o
board/freescale/mpc8641hpcn/ddr.c +2 -2
index 651652a..7cd0395 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 struct board_specific_parameters {
 	u32 n_ranks;
board/freescale/mpc8641hpcn/mpc8641hpcn.c +1 -1
index 46a543e..0cd9df1 100644
@@ -9,7 +9,7 @@
 #include <asm/processor.h>
 #include <asm/immap_86xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <asm/io.h>
 #include <libfdt.h>
board/freescale/p1010rdb/ddr.c +2 -2
index ab1b41d..b0d95ea 100644
@@ -8,8 +8,8 @@
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/processor.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 #include <asm/io.h>
 #include <asm/fsl_law.h>
 
board/freescale/p1010rdb/spl_minimal.c +2 -2
index d0e712e..aa2a344 100644
@@ -10,7 +10,7 @@
 #include <nand.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_law.h>
 #include <asm/global_data.h>
 
@@ -19,7 +19,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void sdram_init(void)
 {
-	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
 	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
 	u32 ddr_ratio;
 	unsigned long ddr_freq_mhz;
board/freescale/p1022ds/ddr.c +2 -2
index 94d2c2b..09212bc 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 struct board_specific_parameters {
 	u32 n_ranks;
board/freescale/p1022ds/p1022ds.c +1 -1
index 3d1951c..ba789a4 100644
@@ -14,7 +14,7 @@
 #include <asm/cache.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <asm/io.h>
 #include <libfdt.h>
board/freescale/p1022ds/spl_minimal.c +1 -1
index 8b34396..6c7e1ac 100644
@@ -9,7 +9,7 @@
 #include <asm/io.h>
 #include <nand.h>
 #include <asm/fsl_law.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
 
 const static u32 sysclk_tbl[] = {
board/freescale/p1023rdb/ddr.c +2 -2
index 9fb61fd..d587df5 100644
@@ -8,8 +8,8 @@
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/processor.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 #include <asm/io.h>
 #include <asm/fsl_law.h>
 
board/freescale/p1023rdb/p1023rdb.c +1 -1
index b52b092..d2d4f83 100644
@@ -16,7 +16,7 @@
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_portals.h>
 #include <libfdt.h>
 #include <fdt_support.h>
board/freescale/p1023rds/p1023rds.c +2 -2
index 7c54b65..2cfcdc4 100644
@@ -16,7 +16,7 @@
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_portals.h>
 #include <libfdt.h>
 #include <fdt_support.h>
@@ -58,7 +58,7 @@ int checkboard(void)
 phys_size_t fixed_sdram(void)
 {
 #ifndef CONFIG_SYS_RAMBOOT
-	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
 
 	set_next_law(0, LAW_SIZE_2G, LAW_TRGT_IF_DDR_1);
 
board/freescale/p1_p2_rdb/ddr.c +1 -1
index 5bee22e..17d3bea 100644
@@ -8,7 +8,7 @@
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/processor.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/io.h>
 #include <asm/fsl_law.h>
 
board/freescale/p1_p2_rdb_pc/ddr.c +2 -2
index 81cc093..946d503 100644
@@ -10,8 +10,8 @@
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/processor.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 #include <asm/io.h>
 #include <asm/fsl_law.h>
 
board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c +1 -1
index 50553da..966abb2 100644
@@ -14,7 +14,7 @@
 #include <asm/cache.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/io.h>
 #include <asm/fsl_law.h>
 #include <asm/fsl_lbc.h>
board/freescale/p1_p2_rdb_pc/spl_minimal.c +1 -1
index adfa7b1..92437bc 100644
@@ -10,7 +10,7 @@
 #include <nand.h>
 #include <linux/compiler.h>
 #include <asm/fsl_law.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
board/freescale/p1_twr/ddr.c +2 -2
index 67f69d7..a2ce75a 100644
@@ -8,8 +8,8 @@
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/processor.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 #include <asm/io.h>
 #include <asm/fsl_law.h>
 
board/freescale/p1_twr/p1_twr.c +1 -1
index ea8db6f..0e0d058 100644
@@ -14,7 +14,7 @@
 #include <asm/cache.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/io.h>
 #include <asm/fsl_law.h>
 #include <asm/fsl_lbc.h>
board/freescale/p2020come/ddr.c +2 -2
index da80477..b642e12 100644
@@ -5,8 +5,8 @@
  */
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/freescale/p2020ds/ddr.c +3 -3
index b12141f..debe70b 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 struct board_specific_parameters {
 	u32 n_ranks;
@@ -37,7 +37,7 @@ static const struct board_specific_parameters dimm0[] = {
 	 *   num|  hi|  clk| cpo|wrdata|2T
 	 * ranks| mhz|adjst|    | delay|
 	 */
-#ifdef CONFIG_FSL_DDR2
+#ifdef CONFIG_SYS_FSL_DDR2
 	{2,  549,    4,   0x1f,    2,  0},
 	{2,  680,    4,   0x1f,    3,  0},
 	{2,  850,    4,   0x1f,    4,  0},
board/freescale/p2020ds/p2020ds.c +2 -2
index 58a4223..dd8c6b1 100644
@@ -12,7 +12,7 @@
 #include <asm/cache.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/io.h>
 #include <asm/fsl_serdes.h>
 #include <miiphy.h>
@@ -68,7 +68,7 @@ int checkboard(void)
 
 phys_size_t fixed_sdram(void)
 {
-	volatile ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+	volatile ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
 	uint d_init;
 
 	ddr->cs0_config = CONFIG_SYS_DDR_CS0_CONFIG;
board/freescale/p2041rdb/ddr.c +2 -2
index cc1bfae..b8bbcdf 100644
@@ -10,8 +10,8 @@
 #include <i2c.h>
 #include <hwconfig.h>
 #include <asm/mmu.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 #include <asm/fsl_law.h>
 
 struct board_specific_parameters {
board/freescale/t1040qds/ddr.c +2 -2
index 4fd17da..da89a36 100644
@@ -8,8 +8,8 @@
 #include <i2c.h>
 #include <hwconfig.h>
 #include <asm/mmu.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 #include <asm/fsl_law.h>
 #include "ddr.h"
 
board/freescale/t104xrdb/ddr.c +2 -2
index 8f58dd6..9009afa 100644
@@ -8,8 +8,8 @@
 #include <i2c.h>
 #include <hwconfig.h>
 #include <asm/mmu.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 #include <asm/fsl_law.h>
 #include "ddr.h"
 
board/freescale/t4qds/ddr.c +2 -2
index d70c310..7586cc3 100644
@@ -10,8 +10,8 @@
 #include <i2c.h>
 #include <hwconfig.h>
 #include <asm/mmu.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 #include <asm/fsl_law.h>
 #include "ddr.h"
 
board/freescale/t4qds/eth.c +1 -1
index b5f488b..24cf907 100644
@@ -12,7 +12,7 @@
 #include <asm/cache.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_law.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <asm/fsl_portals.h>
 #include <asm/fsl_liodn.h>
board/gdsys/p1022/controlcenterd.c +1 -1
index 81c22bc..8ccd9ce 100644
@@ -29,7 +29,7 @@
 #include <asm/cache.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <asm/io.h>
 #include <libfdt.h>
board/gdsys/p1022/ddr.c +2 -2
index 4a652de..7596736 100644
@@ -12,8 +12,8 @@
 #include <common.h>
 #include <i2c.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts, dimm_params_t *pdimm,
 			   unsigned int ctrl_num)
board/keymile/kmp204x/ddr.c +2 -2
index bd425aa..34ac697 100644
@@ -11,8 +11,8 @@
 #include <i2c.h>
 #include <hwconfig.h>
 #include <asm/mmu.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/sbc8548/Makefile +1 -1
index b1e32a6..4c9b6cd 100644
@@ -11,4 +11,4 @@
 obj-y	+= sbc8548.o
 obj-y	+= law.o
 obj-y	+= tlb.o
-obj-$(CONFIG_FSL_DDR2) += ddr.o
+obj-$(CONFIG_SYS_FSL_DDR2) += ddr.o
board/sbc8548/ddr.c +3 -3
index 9508561..8817103 100644
@@ -9,8 +9,8 @@
 #include <common.h>
 #include <i2c.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
@@ -91,7 +91,7 @@ void get_spd(generic_spd_eeprom_t *spd, u8 i2c_address)
  */
 phys_size_t fixed_sdram(void)
 {
-	volatile ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_MPC8xxx_DDR_ADDR);
+	volatile ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_FSL_DDR_ADDR);
 
 	out_be32(&ddr->cs0_bnds,	0x0000007f);
 	out_be32(&ddr->cs1_bnds,	0x008000ff);
board/sbc8548/sbc8548.c +1 -1
index 3cd945f..d584276 100644
@@ -15,7 +15,7 @@
 #include <asm/processor.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <spd_sdram.h>
 #include <netdev.h>
board/sbc8641d/Makefile +1 -1
index 9626b06..a9b2026 100644
@@ -7,4 +7,4 @@
 
 obj-y	+= sbc8641d.o
 obj-y	+= law.o
-obj-$(CONFIG_FSL_DDR2) += ddr.o
+obj-$(CONFIG_SYS_FSL_DDR2) += ddr.o
board/sbc8641d/ddr.c +2 -2
index 996ffe2..b31ea34 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/sbc8641d/sbc8641d.c +1 -1
index 0b5e8dc..8160c7b 100644
@@ -18,7 +18,7 @@
 #include <asm/processor.h>
 #include <asm/immap_86xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <libfdt.h>
 #include <fdt_support.h>
board/socrates/Makefile +1 -1
index 0a08810..79bda71 100644
@@ -12,4 +12,4 @@ obj-y	+= law.o
 obj-y	+= tlb.o
 obj-y	+= nand.o
 obj-y	+= sdram.o
-obj-$(CONFIG_FSL_DDR2) += ddr.o
+obj-$(CONFIG_SYS_FSL_DDR2) += ddr.o
board/socrates/ddr.c +2 -2
index e9db476..6bad4da 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/socrates/sdram.c +2 -2
index 313efae..356e8e8 100644
@@ -8,7 +8,7 @@
 #include <common.h>
 #include <asm/processor.h>
 #include <asm/immap_85xx.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <spd_sdram.h>
@@ -24,7 +24,7 @@
  */
 phys_size_t fixed_sdram(void)
 {
-	volatile ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_MPC8xxx_DDR_ADDR);
+	volatile ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_FSL_DDR_ADDR);
 
 	/*
 	 * Disable memory controller.
board/stx/stxgp3/Makefile +1 -1
index 9b72434..78e2d6c 100644
@@ -9,4 +9,4 @@ obj-y	+= stxgp3.o
 obj-y	+= law.o
 obj-y	+= tlb.o
 obj-y	+= flash.o
-obj-$(CONFIG_FSL_DDR1) += ddr.o
+obj-$(CONFIG_SYS_FSL_DDR1) += ddr.o
board/stx/stxgp3/ddr.c +2 -2
index 9e79815..41d4cfe 100644
@@ -8,8 +8,8 @@
 
 #include <common.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/stx/stxgp3/stxgp3.c +1 -1
index bd683f6..c80d525 100644
@@ -18,7 +18,7 @@
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <ioports.h>
 #include <asm/io.h>
 #include <spd_sdram.h>
board/stx/stxssa/Makefile +1 -1
index 17e0aae..b1d4b0a 100644
@@ -8,4 +8,4 @@
 obj-y	+= stxssa.o
 obj-y	+= law.o
 obj-y	+= tlb.o
-obj-$(CONFIG_FSL_DDR1) += ddr.o
+obj-$(CONFIG_SYS_FSL_DDR1) += ddr.o
board/stx/stxssa/ddr.c +2 -2
index 71be3bf..1ccd4c5 100644
@@ -9,8 +9,8 @@
 #include <common.h>
 #include <i2c.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
board/stx/stxssa/stxssa.c +1 -1
index c08a18b..f5c3d75 100644
@@ -19,7 +19,7 @@
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_pci.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <ioports.h>
 #include <asm/io.h>
 #include <spd_sdram.h>
board/xes/xpedite517x/ddr.c +2 -2
index f48c02f..fd602ea 100644
@@ -7,8 +7,8 @@
 
 #include <common.h>
 #include <i2c.h>
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void get_spd(ddr2_spd_eeprom_t *spd, u8 i2c_address)
 {
board/xes/xpedite517x/xpedite517x.c +1 -1
index 1782042..b7ad349 100644
@@ -6,7 +6,7 @@
 
 #include <common.h>
 #include <asm/processor.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/mmu.h>
 #include <asm/io.h>
 #include <fdt_support.h>
board/xes/xpedite520x/ddr.c +2 -2
index 3671cb8..5c5eadc 100644
@@ -9,8 +9,8 @@
 #include <common.h>
 #include <i2c.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void get_spd(ddr2_spd_eeprom_t *spd, unsigned char i2c_address)
 {
board/xes/xpedite537x/ddr.c +2 -2
index f41ae73..56b5a18 100644
@@ -8,8 +8,8 @@
 #include <common.h>
 #include <i2c.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void get_spd(ddr2_spd_eeprom_t *spd, u8 i2c_address)
 {
board/xes/xpedite550x/ddr.c +2 -2
index 9fc6f04..0c0605e 100644
@@ -8,8 +8,8 @@
 #include <common.h>
 #include <i2c.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
 void get_spd(ddr3_spd_eeprom_t *spd, u8 i2c_address)
 {
drivers/ddr/fsl/Makefile new file +34 -0
new file mode 100644
index 0000000..a328b43
@@ -0,0 +1,34 @@
+#
+# Copyright 2008-2011 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.
+#
+
+obj-$(CONFIG_SYS_FSL_DDR1)	+= main.o util.o ctrl_regs.o options.o \
+				   lc_common_dimm_params.o
+
+obj-$(CONFIG_SYS_FSL_DDR2)	+= main.o util.o ctrl_regs.o options.o \
+				   lc_common_dimm_params.o
+
+obj-$(CONFIG_SYS_FSL_DDR3)	+= main.o util.o ctrl_regs.o options.o \
+				   lc_common_dimm_params.o
+ifdef CONFIG_DDR_SPD
+SPD := y
+endif
+ifdef CONFIG_SPD_EEPROM
+SPD := y
+endif
+ifdef SPD
+obj-$(CONFIG_SYS_FSL_DDR1)	+= ddr1_dimm_params.o
+obj-$(CONFIG_SYS_FSL_DDR2)	+= ddr2_dimm_params.o
+obj-$(CONFIG_SYS_FSL_DDR3)	+= ddr3_dimm_params.o
+endif
+
+obj-$(CONFIG_FSL_DDR_INTERACTIVE)	+= interactive.o
+obj-$(CONFIG_SYS_FSL_DDRC_GEN1)	+= mpc85xx_ddr_gen1.o
+obj-$(CONFIG_SYS_FSL_DDRC_GEN2)	+= mpc85xx_ddr_gen2.o
+obj-$(CONFIG_SYS_FSL_DDRC_GEN3)	+= mpc85xx_ddr_gen3.o
+obj-$(CONFIG_SYS_FSL_DDR_86XX)		+= mpc86xx_ddr.o
+obj-$(CONFIG_FSL_DDR_INTERACTIVE)	+= interactive.o
drivers/ddr/fsl/ctrl_regs.c renamed from arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +33 -32

223 lines not on this page · raw message

drivers/ddr/fsl/ddr1_dimm_params.c renamed from arch/powerpc/cpu/mpc8xxx/ddr/ddr1_dimm_params.c +2 -2
similarity index 99%
rename from arch/powerpc/cpu/mpc8xxx/ddr/ddr1_dimm_params.c
rename to drivers/ddr/fsl/ddr1_dimm_params.c
index f137fce..7df27b9 100644
@@ -7,9 +7,9 @@
  */
 
 #include <common.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
-#include "ddr.h"
+#include <fsl_ddr.h>
 
 /*
  * Calculate the Density of each Physical Rank.
drivers/ddr/fsl/ddr2_dimm_params.c renamed from arch/powerpc/cpu/mpc8xxx/ddr/ddr2_dimm_params.c +2 -2
similarity index 99%
rename from arch/powerpc/cpu/mpc8xxx/ddr/ddr2_dimm_params.c
rename to drivers/ddr/fsl/ddr2_dimm_params.c
index e4d02e8..d865df7 100644
@@ -7,9 +7,9 @@
  */
 
 #include <common.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
-#include "ddr.h"
+#include <fsl_ddr.h>
 /*
  * Calculate the Density of each Physical Rank.
  * Returned size is in bytes.
drivers/ddr/fsl/ddr3_dimm_params.c renamed from arch/powerpc/cpu/mpc8xxx/ddr/ddr3_dimm_params.c +2 -2
similarity index 99%
rename from arch/powerpc/cpu/mpc8xxx/ddr/ddr3_dimm_params.c
rename to drivers/ddr/fsl/ddr3_dimm_params.c
index 4c8645d..a4b8c10 100644
@@ -12,9 +12,9 @@
  */
 
 #include <common.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
-#include "ddr.h"
+#include <fsl_ddr.h>
 
 /*
  * Calculate the Density of each Physical Rank.
drivers/ddr/fsl/interactive.c renamed from arch/powerpc/cpu/mpc8xxx/ddr/interactive.c +11 -10
similarity index 99%
rename from arch/powerpc/cpu/mpc8xxx/ddr/interactive.c
rename to drivers/ddr/fsl/interactive.c
index 3b66112..ebf3ed6 100644
@@ -14,9 +14,10 @@
 #include <common.h>
 #include <linux/ctype.h>
 #include <asm/types.h>
+#include <asm/io.h>
 
-#include <asm/fsl_ddr_sdram.h>
-#include "ddr.h"
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr.h>
 
 /* Option parameter Structures */
 struct options_string {
@@ -402,7 +403,7 @@ static void fsl_ddr_options_edit(fsl_ddr_info_t *pinfo,
 		CTRL_OPTIONS_CS(3, odt_rd_cfg),
 		CTRL_OPTIONS_CS(3, odt_wr_cfg),
 #endif
-#if defined(CONFIG_FSL_DDR3)
+#if defined(CONFIG_SYS_FSL_DDR3)
 		CTRL_OPTIONS_CS(0, odt_rtt_norm),
 		CTRL_OPTIONS_CS(0, odt_rtt_wr),
 #if (CONFIG_CHIP_SELECTS_PER_CTRL > 1)
@@ -647,7 +648,7 @@ static void print_memctl_options(const memctl_options_t *popts)
 		CTRL_OPTIONS_CS(3, odt_rd_cfg),
 		CTRL_OPTIONS_CS(3, odt_wr_cfg),
 #endif
-#if defined(CONFIG_FSL_DDR3)
+#if defined(CONFIG_SYS_FSL_DDR3)
 		CTRL_OPTIONS_CS(0, odt_rtt_norm),
 		CTRL_OPTIONS_CS(0, odt_rtt_wr),
 #if (CONFIG_CHIP_SELECTS_PER_CTRL > 1)
@@ -710,7 +711,7 @@ static void print_memctl_options(const memctl_options_t *popts)
 	print_option_table(options, n_opts, popts);
 }
 
-#ifdef CONFIG_FSL_DDR1
+#ifdef CONFIG_SYS_FSL_DDR1
 void ddr1_spd_dump(const ddr1_spd_eeprom_t *spd)
 {
 	unsigned int i;
@@ -859,7 +860,7 @@ void ddr1_spd_dump(const ddr1_spd_eeprom_t *spd)
 }
 #endif
 
-#ifdef CONFIG_FSL_DDR2
+#ifdef CONFIG_SYS_FSL_DDR2
 void ddr2_spd_dump(const ddr2_spd_eeprom_t *spd)
 {
 	unsigned int i;
@@ -1051,7 +1052,7 @@ void ddr2_spd_dump(const ddr2_spd_eeprom_t *spd)
 }
 #endif
 
-#ifdef CONFIG_FSL_DDR3
+#ifdef CONFIG_SYS_FSL_DDR3
 void ddr3_spd_dump(const ddr3_spd_eeprom_t *spd)
 {
 	unsigned int i;
@@ -1246,11 +1247,11 @@ void ddr3_spd_dump(const ddr3_spd_eeprom_t *spd)
 
 static inline void generic_spd_dump(const generic_spd_eeprom_t *spd)
 {
-#if defined(CONFIG_FSL_DDR1)
+#if defined(CONFIG_SYS_FSL_DDR1)
 	ddr1_spd_dump(spd);
-#elif defined(CONFIG_FSL_DDR2)
+#elif defined(CONFIG_SYS_FSL_DDR2)
 	ddr2_spd_dump(spd);
-#elif defined(CONFIG_FSL_DDR3)
+#elif defined(CONFIG_SYS_FSL_DDR3)
 	ddr3_spd_dump(spd);
 #endif
 }
drivers/ddr/fsl/lc_common_dimm_params.c renamed from arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c +9 -9
similarity index 98%
rename from arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c
rename to drivers/ddr/fsl/lc_common_dimm_params.c
index 332fe25..610318a 100644
@@ -7,11 +7,11 @@
  */
 
 #include <common.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
-#include "ddr.h"
+#include <fsl_ddr.h>
 
-#if defined(CONFIG_FSL_DDR3)
+#if defined(CONFIG_SYS_FSL_DDR3)
 static unsigned int
 compute_cas_latency_ddr3(const dimm_params_t *dimm_params,
 			 common_timing_params_t *outpdimm,
@@ -103,7 +103,7 @@ compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 
 	unsigned int temp1, temp2;
 	unsigned int additive_latency = 0;
-#if !defined(CONFIG_FSL_DDR3)
+#if !defined(CONFIG_SYS_FSL_DDR3)
 	const unsigned int mclk_ps = get_memory_clk_period_ps();
 	unsigned int lowest_good_caslat;
 	unsigned int not_ok;
@@ -265,7 +265,7 @@ compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 	if (temp1 != 0)
 		printf("ERROR: Mix different RDIMM detected!\n");
 
-#if defined(CONFIG_FSL_DDR3)
+#if defined(CONFIG_SYS_FSL_DDR3)
 	if (compute_cas_latency_ddr3(dimm_params, outpdimm, number_of_dimms))
 		return 1;
 #else
@@ -386,7 +386,7 @@ compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 	}
 	outpdimm->highest_common_derated_caslat = temp1;
 	debug("highest common dereated CAS latency = %u\n", temp1);
-#endif /* #if defined(CONFIG_FSL_DDR3) */
+#endif /* #if defined(CONFIG_SYS_FSL_DDR3) */
 
 	/* Determine if all DIMMs ECC capable. */
 	temp1 = 1;
@@ -404,7 +404,7 @@ compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 	}
 	outpdimm->all_dimms_ecc_capable = temp1;
 
-#ifndef CONFIG_FSL_DDR3
+#ifndef CONFIG_SYS_FSL_DDR3
 	/* FIXME: move to somewhere else to validate. */
 	if (mclk_ps > tckmax_max_ps) {
 		printf("Warning: some of the installed DIMMs "
@@ -467,7 +467,7 @@ compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 
 	additive_latency = 0;
 
-#if defined(CONFIG_FSL_DDR2)
+#if defined(CONFIG_SYS_FSL_DDR2)
 	if (lowest_good_caslat < 4) {
 		additive_latency = (picos_to_mclk(trcd_ps) > lowest_good_caslat)
 			? picos_to_mclk(trcd_ps) - lowest_good_caslat : 0;
@@ -478,7 +478,7 @@ compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 		}
 	}
 
-#elif defined(CONFIG_FSL_DDR3)
+#elif defined(CONFIG_SYS_FSL_DDR3)
 	/*
 	 * The system will not use the global auto-precharge mode.
 	 * However, it uses the page mode, so we set AL=0
drivers/ddr/fsl/main.c renamed from arch/powerpc/cpu/mpc8xxx/ddr/main.c +2 -2
similarity index 99%
rename from arch/powerpc/cpu/mpc8xxx/ddr/main.c
rename to drivers/ddr/fsl/main.c
index 34d8bc3a..c1cdbdf 100644
@@ -14,10 +14,10 @@
 
 #include <common.h>
 #include <i2c.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_law.h>
 
-#include "ddr.h"
+#include <fsl_ddr.h>
 
 void fsl_ddr_set_lawbar(
 		const common_timing_params_t *memctl_common_params,
drivers/ddr/fsl/mpc85xx_ddr_gen1.c renamed from arch/powerpc/cpu/mpc85xx/ddr-gen1.c +3 -3
similarity index 93%
rename from arch/powerpc/cpu/mpc85xx/ddr-gen1.c
rename to drivers/ddr/fsl/mpc85xx_ddr_gen1.c
index 4dd8c0b..ff7d979 100644
@@ -8,7 +8,7 @@
 
 #include <common.h>
 #include <asm/io.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
 #if (CONFIG_CHIP_SELECTS_PER_CTRL > 4)
 #error Invalid setting for CONFIG_CHIP_SELECTS_PER_CTRL
@@ -18,7 +18,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 			     unsigned int ctrl_num, int step)
 {
 	unsigned int i;
-	volatile ccsr_ddr_t *ddr = (void *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+	volatile ccsr_ddr_t *ddr = (void *)CONFIG_SYS_FSL_DDR_ADDR;
 
 	if (ctrl_num != 0) {
 		printf("%s unexpected ctrl_num = %u\n", __FUNCTION__, ctrl_num);
@@ -73,7 +73,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 void
 ddr_enable_ecc(unsigned int dram_size)
 {
-	volatile ccsr_ddr_t *ddr= (void *)(CONFIG_SYS_MPC8xxx_DDR_ADDR);
+	volatile ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_FSL_DDR_ADDR);
 
 	dma_meminit(CONFIG_MEM_INIT_VALUE, dram_size);
 
drivers/ddr/fsl/mpc85xx_ddr_gen2.c renamed from arch/powerpc/cpu/mpc85xx/ddr-gen2.c +2 -2
similarity index 96%
rename from arch/powerpc/cpu/mpc85xx/ddr-gen2.c
rename to drivers/ddr/fsl/mpc85xx_ddr_gen2.c
index 542bc84..c22dea5 100644
@@ -9,7 +9,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/processor.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
 #if (CONFIG_CHIP_SELECTS_PER_CTRL > 4)
 #error Invalid setting for CONFIG_CHIP_SELECTS_PER_CTRL
@@ -19,7 +19,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 			     unsigned int ctrl_num, int step)
 {
 	unsigned int i;
-	ccsr_ddr_t *ddr = (void *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+	ccsr_ddr_t *ddr = (void *)CONFIG_SYS_FSL_DDR_ADDR;
 
 #if defined(CONFIG_SYS_FSL_ERRATUM_NMG_DDR120) && defined(CONFIG_MPC85xx)
 	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
drivers/ddr/fsl/mpc85xx_ddr_gen3.c renamed from arch/powerpc/cpu/mpc85xx/ddr-gen3.c +8 -8
similarity index 97%
rename from arch/powerpc/cpu/mpc85xx/ddr-gen3.c
rename to drivers/ddr/fsl/mpc85xx_ddr_gen3.c
index 1be51d3..7b4e8ec 100644
@@ -8,7 +8,7 @@
 
 #include <common.h>
 #include <asm/io.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/processor.h>
 
 #if (CONFIG_CHIP_SELECTS_PER_CTRL > 4)
@@ -42,21 +42,21 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 
 	switch (ctrl_num) {
 	case 0:
-		ddr = (void *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+		ddr = (void *)CONFIG_SYS_FSL_DDR_ADDR;
 		break;
-#if defined(CONFIG_SYS_MPC8xxx_DDR2_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 1)
+#if defined(CONFIG_SYS_FSL_DDR2_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 1)
 	case 1:
-		ddr = (void *)CONFIG_SYS_MPC8xxx_DDR2_ADDR;
+		ddr = (void *)CONFIG_SYS_FSL_DDR2_ADDR;
 		break;
 #endif
-#if defined(CONFIG_SYS_MPC8xxx_DDR3_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 2)
+#if defined(CONFIG_SYS_FSL_DDR3_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 2)
 	case 2:
-		ddr = (void *)CONFIG_SYS_MPC8xxx_DDR3_ADDR;
+		ddr = (void *)CONFIG_SYS_FSL_DDR3_ADDR;
 		break;
 #endif
-#if defined(CONFIG_SYS_MPC8xxx_DDR4_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 3)
+#if defined(CONFIG_SYS_FSL_DDR4_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 3)
 	case 3:
-		ddr = (void *)CONFIG_SYS_MPC8xxx_DDR4_ADDR;
+		ddr = (void *)CONFIG_SYS_FSL_DDR4_ADDR;
 		break;
 #endif
 	default:
drivers/ddr/fsl/mpc86xx_ddr.c renamed from arch/powerpc/cpu/mpc86xx/ddr-8641.c +3 -3
similarity index 95%
rename from arch/powerpc/cpu/mpc86xx/ddr-8641.c
rename to drivers/ddr/fsl/mpc86xx_ddr.c
index 33a91f9..caffbaf 100644
@@ -8,7 +8,7 @@
 
 #include <common.h>
 #include <asm/io.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
 #if (CONFIG_CHIP_SELECTS_PER_CTRL > 4)
 #error Invalid setting for CONFIG_CHIP_SELECTS_PER_CTRL
@@ -22,10 +22,10 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 
 	switch (ctrl_num) {
 	case 0:
-		ddr = (void *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+		ddr = (void *)CONFIG_SYS_FSL_DDR_ADDR;
 		break;
 	case 1:
-		ddr = (void *)CONFIG_SYS_MPC8xxx_DDR2_ADDR;
+		ddr = (void *)CONFIG_SYS_FSL_DDR2_ADDR;
 		break;
 	default:
 		printf("%s unexpected ctrl_num = %u\n", __FUNCTION__, ctrl_num);
drivers/ddr/fsl/options.c renamed from arch/powerpc/cpu/mpc8xxx/ddr/options.c +16 -16
similarity index 97%
rename from arch/powerpc/cpu/mpc8xxx/ddr/options.c
rename to drivers/ddr/fsl/options.c
index 1297845..4aafcce 100644
@@ -6,9 +6,9 @@
 
 #include <common.h>
 #include <hwconfig.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 
-#include "ddr.h"
+#include <fsl_ddr.h>
 
 /*
  * Use our own stack based buffer before relocation to allow accessing longer
@@ -29,7 +29,7 @@ struct dynamic_odt {
 	unsigned int odt_rtt_wr;
 };
 
-#ifdef CONFIG_FSL_DDR3
+#ifdef CONFIG_SYS_FSL_DDR3
 static const struct dynamic_odt single_Q[4] = {
 	{	/* cs0 */
 		FSL_DDR_ODT_NEVER,
@@ -259,7 +259,7 @@ static const struct dynamic_odt odt_unknown[4] = {
 		DDR3_RTT_OFF
 	}
 };
-#else	/* CONFIG_FSL_DDR3 */
+#else	/* CONFIG_SYS_FSL_DDR3 */
 static const struct dynamic_odt single_Q[4] = {
 	{0, 0, 0, 0},
 	{0, 0, 0, 0},
@@ -507,7 +507,7 @@ unsigned int populate_memctl_options(int all_dimms_registered,
 	unsigned int i;
 	char buffer[HWCONFIG_BUFFER_SIZE];
 	char *buf = NULL;
-#if defined(CONFIG_FSL_DDR3) || defined(CONFIG_FSL_DDR2)
+#if defined(CONFIG_SYS_FSL_DDR3) || defined(CONFIG_SYS_FSL_DDR2)
 	const struct dynamic_odt *pdodt = odt_unknown;
 #endif
 	ulong ddr_freq;
@@ -519,7 +519,7 @@ unsigned int populate_memctl_options(int all_dimms_registered,
 	if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
 		buf = buffer;
 
-#if defined(CONFIG_FSL_DDR3) || defined(CONFIG_FSL_DDR2)
+#if defined(CONFIG_SYS_FSL_DDR3) || defined(CONFIG_SYS_FSL_DDR2)
 	/* Chip select options. */
 	if (CONFIG_DIMM_SLOTS_PER_CTLR == 1) {
 		switch (pdimm[0].n_ranks) {
@@ -585,7 +585,7 @@ unsigned int populate_memctl_options(int all_dimms_registered,
 
 	/* Pick chip-select local options. */
 	for (i = 0; i < CONFIG_CHIP_SELECTS_PER_CTRL; i++) {
-#if defined(CONFIG_FSL_DDR3) || defined(CONFIG_FSL_DDR2)
+#if defined(CONFIG_SYS_FSL_DDR3) || defined(CONFIG_SYS_FSL_DDR2)
 		popts->cs_local_opts[i].odt_rd_cfg = pdodt[i].odt_rd_cfg;
 		popts->cs_local_opts[i].odt_wr_cfg = pdodt[i].odt_wr_cfg;
 		popts->cs_local_opts[i].odt_rtt_norm = pdodt[i].odt_rtt_norm;
@@ -655,9 +655,9 @@ unsigned int populate_memctl_options(int all_dimms_registered,
 	 * 0 for DDR1
 	 * 1 for DDR2
 	 */
-#if defined(CONFIG_FSL_DDR1)
+#if defined(CONFIG_SYS_FSL_DDR1)
 	popts->dqs_config = 0;
-#elif defined(CONFIG_FSL_DDR2) || defined(CONFIG_FSL_DDR3)
+#elif defined(CONFIG_SYS_FSL_DDR2) || defined(CONFIG_SYS_FSL_DDR3)
 	popts->dqs_config = 1;
 #endif
 
@@ -672,7 +672,7 @@ unsigned int populate_memctl_options(int all_dimms_registered,
 	 * presuming all dimms are similar
 	 * 0 = 64-bit, 1 = 32-bit, 2 = 16-bit
 	 */
-#if defined(CONFIG_FSL_DDR1) || defined(CONFIG_FSL_DDR2)
+#if defined(CONFIG_SYS_FSL_DDR1) || defined(CONFIG_SYS_FSL_DDR2)
 	if (pdimm[0].n_ranks != 0) {
 		if ((pdimm[0].data_width >= 64) && \
 			(pdimm[0].data_width <= 72))
@@ -703,7 +703,7 @@ unsigned int populate_memctl_options(int all_dimms_registered,
 	popts->x4_en = (pdimm[0].device_width == 4) ? 1 : 0;
 
 	/* Choose burst length. */
-#if defined(CONFIG_FSL_DDR3)
+#if defined(CONFIG_SYS_FSL_DDR3)
 #if defined(CONFIG_E500MC)
 	popts->otf_burst_chop_en = 0;	/* on-the-fly burst chop disable */
 	popts->burst_length = DDR_BL8;	/* Fixed 8-beat burst len */
@@ -722,7 +722,7 @@ unsigned int populate_memctl_options(int all_dimms_registered,
 #endif
 
 	/* Choose ddr controller address mirror mode */
-#if defined(CONFIG_FSL_DDR3)
+#if defined(CONFIG_SYS_FSL_DDR3)
 	popts->mirrored_dimm = pdimm[0].mirrored_dimm;
 #endif
 
@@ -785,22 +785,22 @@ unsigned int populate_memctl_options(int all_dimms_registered,
 	 * FIXME: varies depending upon number of column addresses or data
 	 * FIXME: width, was considering looking at pdimm->primary_sdram_width
 	 */
-#if defined(CONFIG_FSL_DDR1)
+#if defined(CONFIG_SYS_FSL_DDR1)
 	popts->tfaw_window_four_activates_ps = mclk_to_picos(1);
 
-#elif defined(CONFIG_FSL_DDR2)
+#elif defined(CONFIG_SYS_FSL_DDR2)
 	/*
 	 * x4/x8;  some datasheets have 35000
 	 * x16 wide columns only?  Use 50000?
 	 */
 	popts->tfaw_window_four_activates_ps = 37500;
 
-#elif defined(CONFIG_FSL_DDR3)
+#elif defined(CONFIG_SYS_FSL_DDR3)
 	popts->tfaw_window_four_activates_ps = pdimm[0].tfaw_ps;
 #endif
 	popts->zq_en = 0;
 	popts->wrlvl_en = 0;
-#if defined(CONFIG_FSL_DDR3)
+#if defined(CONFIG_SYS_FSL_DDR3)
 	/*
 	 * due to ddr3 dimm is fly-by topology
 	 * we suggest to enable write leveling to
drivers/ddr/fsl/util.c renamed from arch/powerpc/cpu/mpc8xxx/ddr/util.c +5 -4
similarity index 96%
rename from arch/powerpc/cpu/mpc8xxx/ddr/util.c
rename to drivers/ddr/fsl/util.c
index acfe1f0..45a7bcc 100644
@@ -10,7 +10,8 @@
 #include <asm/fsl_law.h>
 #include <div64.h>
 
-#include "ddr.h"
+#include <fsl_ddr.h>
+#include <asm/io.h>
 
 /* To avoid 64-bit full-divides, we factor this here */
 #define ULL_2E12 2000000000000ULL
@@ -133,7 +134,7 @@ u32 fsl_ddr_get_intl3r(void)
 
 void board_add_ram_info(int use_default)
 {
-	ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_MPC8xxx_DDR_ADDR);
+	ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_FSL_DDR_ADDR);
 
 #if	defined(CONFIG_E6500) && (CONFIG_NUM_DDR_CONTROLLERS == 3)
 	u32 *mcintl3r = (void *) (CONFIG_SYS_IMMR + 0x18004);
@@ -146,13 +147,13 @@ void board_add_ram_info(int use_default)
 
 #if CONFIG_NUM_DDR_CONTROLLERS >= 2
 	if (!(sdram_cfg & SDRAM_CFG_MEM_EN)) {
-		ddr = (void __iomem *)CONFIG_SYS_MPC8xxx_DDR2_ADDR;
+		ddr = (void __iomem *)CONFIG_SYS_FSL_DDR2_ADDR;
 		sdram_cfg = in_be32(&ddr->sdram_cfg);
 	}
 #endif
 #if CONFIG_NUM_DDR_CONTROLLERS >= 3
 	if (!(sdram_cfg & SDRAM_CFG_MEM_EN)) {
-		ddr = (void __iomem *)CONFIG_SYS_MPC8xxx_DDR3_ADDR;
+		ddr = (void __iomem *)CONFIG_SYS_FSL_DDR3_ADDR;
 		sdram_cfg = in_be32(&ddr->sdram_cfg);
 	}
 #endif
include/common_timing_params.h renamed from arch/powerpc/cpu/mpc8xxx/ddr/common_timing_params.h +0 -0
similarity index 100%
rename from arch/powerpc/cpu/mpc8xxx/ddr/common_timing_params.h
rename to include/common_timing_params.h
include/configs/B4860QDS.h +1 -1
index 268f66e..b2a5c19 100644
@@ -193,7 +193,7 @@ unsigned long get_board_ddr_clk(void);
 
 #define CONFIG_DDR_SPD
 #define CONFIG_SYS_DDR_RAW_TIMING
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 #define CONFIG_FSL_DDR_INTERACTIVE
 
 #define CONFIG_SYS_SPD_BUS_NUM	0
include/configs/BSC9131RDB.h +1 -1
index 036f264..499d8c2 100644
@@ -80,7 +80,7 @@
 #define CONFIG_SYS_MEMTEST_END		0x01ffffff
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 #undef CONFIG_SYS_DDR_RAW_TIMING
 #undef CONFIG_DDR_SPD
 #define CONFIG_SYS_SPD_BUS_NUM		0
include/configs/BSC9132QDS.h +1 -1
index 75889b3..a6601fe 100644
@@ -134,7 +134,7 @@
 #define CONFIG_SYS_MEMTEST_END		0x01ffffff
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 #define CONFIG_SYS_SPD_BUS_NUM		0
 #define SPD_EEPROM_ADDRESS1		0x54 /* I2C access */
 #define SPD_EEPROM_ADDRESS2		0x56 /* I2C access */
include/configs/C29XPCIE.h +1 -1
index 08156c5..f173b07 100644
@@ -103,7 +103,7 @@
 #define CONFIG_PANIC_HANG
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 #define CONFIG_DDR_SPD
 #define CONFIG_SYS_SPD_BUS_NUM		0
 #define SPD_EEPROM_ADDRESS		0x50
include/configs/HWW1U1A.h +1 -1
index f3f2136..bbfee7d 100644
@@ -255,7 +255,7 @@
 /* -------------------------------------------------------------------- */
 
 /* FreeScale DDR2/3 SDRAM Controller */
-#define CONFIG_FSL_DDR2		/* Our SDRAM slot is DDR2		*/
+#define CONFIG_SYS_FSL_DDR2		/* Our SDRAM slot is DDR2		*/
 #define CONFIG_DDR_ECC		/* Enable ECC by default		*/
 #define CONFIG_DDR_SPD		/* Detect DDR config from SPD EEPROM	*/
 #define CONFIG_SPD_EEPROM	/* ...why 2 config variables for this?	*/
include/configs/MPC8349EMDS.h +3 -3
index 3f742a2..a80a696 100644
@@ -62,11 +62,11 @@
 #define CONFIG_SPD_EEPROM		/* use SPD EEPROM for DDR setup*/
 
 /*
- * define CONFIG_FSL_DDR2 to use unified DDR driver
+ * define CONFIG_SYS_FSL_DDR2 to use unified DDR driver
  * undefine it to use old spd_sdram.c
  */
-#define CONFIG_FSL_DDR2
-#ifdef CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
+#ifdef CONFIG_SYS_FSL_DDR2
 #define CONFIG_SYS_SPD_BUS_NUM	0
 #define SPD_EEPROM_ADDRESS1	0x52
 #define SPD_EEPROM_ADDRESS2	0x51
include/configs/MPC8536DS.h +1 -1
index 8197f89..9ab1bc1 100644
@@ -122,7 +122,7 @@
 
 /* DDR Setup */
 #define CONFIG_VERY_BIG_RAM
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #undef CONFIG_FSL_DDR_INTERACTIVE
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup */
 #define CONFIG_DDR_SPD
include/configs/MPC8540ADS.h +1 -1
index 6689368..046b14b 100644
@@ -78,7 +78,7 @@
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR1
+#define CONFIG_SYS_FSL_DDR1
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup*/
 #define CONFIG_DDR_SPD
 #undef CONFIG_FSL_DDR_INTERACTIVE
include/configs/MPC8541CDS.h +1 -1
index e24c597..eca3b53 100644
@@ -51,7 +51,7 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR1
+#define CONFIG_SYS_FSL_DDR1
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup*/
 #define CONFIG_DDR_SPD
 #undef CONFIG_FSL_DDR_INTERACTIVE
include/configs/MPC8544DS.h +1 -1
index 2e76df6..8132ec0 100644
@@ -63,7 +63,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #undef CONFIG_FSL_DDR_INTERACTIVE
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup */
 #define CONFIG_DDR_SPD
include/configs/MPC8548CDS.h +1 -1
index 9ff048a..6acd54d 100644
@@ -75,7 +75,7 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #undef CONFIG_FSL_DDR_INTERACTIVE
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup*/
 #define CONFIG_DDR_SPD
include/configs/MPC8555CDS.h +1 -1
index 7f0f927..5ffdd01 100644
@@ -51,7 +51,7 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR1
+#define CONFIG_SYS_FSL_DDR1
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup*/
 #define CONFIG_DDR_SPD
 #undef CONFIG_FSL_DDR_INTERACTIVE
include/configs/MPC8560ADS.h +1 -1
index b7c4a60..bb9ae2d 100644
@@ -75,7 +75,7 @@
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR1
+#define CONFIG_SYS_FSL_DDR1
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup*/
 #define CONFIG_DDR_SPD
 #undef CONFIG_FSL_DDR_INTERACTIVE
include/configs/MPC8568MDS.h +1 -1
index c9a1539..7406ac3 100644
@@ -60,7 +60,7 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #undef CONFIG_FSL_DDR_INTERACTIVE
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup*/
 #define CONFIG_DDR_SPD
include/configs/MPC8569MDS.h +1 -1
index 341f6a8..df5572b 100644
@@ -98,7 +98,7 @@ extern unsigned long get_clock_freq(void);
 #endif
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 #undef CONFIG_FSL_DDR_INTERACTIVE
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup*/
 #define CONFIG_DDR_SPD
include/configs/MPC8572DS.h +1 -1
index c751144..afb195f 100644
@@ -106,7 +106,7 @@
 
 /* DDR Setup */
 #define CONFIG_VERY_BIG_RAM
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #undef CONFIG_FSL_DDR_INTERACTIVE
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup */
 #define CONFIG_DDR_SPD
include/configs/MPC8610HPCD.h +1 -1
index 97f5c87..41ebe31 100644
@@ -92,7 +92,7 @@
 #define CONFIG_SYS_CCSRBAR_PHYS		CONFIG_SYS_CCSRBAR_PHYS_LOW
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #undef CONFIG_FSL_DDR_INTERACTIVE
 #define CONFIG_SPD_EEPROM		/* Use SPD for DDR */
 #define CONFIG_DDR_SPD
include/configs/MPC8641HPCN.h +1 -1
index 8ed5050..0e666ba 100644
@@ -108,7 +108,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 /*
  * DDR Setup
  */
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #undef CONFIG_FSL_DDR_INTERACTIVE
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup */
 #define CONFIG_DDR_SPD
include/configs/P1010RDB.h +1 -1
index 50c365a..eab386a 100644
@@ -178,7 +178,7 @@
 #define CONFIG_PANIC_HANG		/* do not reset board on panic */
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 #define CONFIG_SYS_DDR_RAW_TIMING
 #define CONFIG_DDR_SPD
 #define CONFIG_SYS_SPD_BUS_NUM		1
include/configs/P1022DS.h +1 -1
index 1470526..262c3e5 100644
@@ -177,7 +177,7 @@
 /* DDR Setup */
 #define CONFIG_DDR_SPD
 #define CONFIG_VERY_BIG_RAM
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 
 #ifdef CONFIG_DDR_ECC
 #define CONFIG_ECC_INIT_VIA_DDRCONTROLLER
include/configs/P1023RDB.h +1 -1
index e49523e..7de6814 100644
@@ -74,7 +74,7 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_CHIP_SELECTS_PER_CTRL	1
 
 #define CONFIG_DDR_SPD
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 #define CONFIG_FSL_DDR_INTERACTIVE
 #define CONFIG_SYS_SDRAM_SIZE		512u	/* DDR is 512M */
 #define CONFIG_SYS_SPD_BUS_NUM          0
include/configs/P1_P2_RDB.h +1 -1
index 282f5c1..b592c19 100644
@@ -141,7 +141,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #endif
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #undef CONFIG_FSL_DDR_INTERACTIVE
 #undef CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup */
 
include/configs/P2020COME.h +1 -1
index 9cc219e..15d2a43 100644
@@ -105,7 +105,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup */
 #define CONFIG_DDR_SPD
 
include/configs/P2020DS.h +2 -2
index 8a29eaa..9d3d9b3 100644
@@ -109,9 +109,9 @@
 /* DDR Setup */
 #define CONFIG_VERY_BIG_RAM
 #ifdef CONFIG_DDR2
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #else
-#define CONFIG_FSL_DDR3		1
+#define CONFIG_SYS_FSL_DDR3		1
 #endif
 
 /* ECC will be enabled based on perf_mode environment variable */
include/configs/P2041RDB.h +1 -1
index 0df6f1a..b238574 100644
@@ -175,7 +175,7 @@ unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_CHIP_SELECTS_PER_CTRL	(4 * CONFIG_DIMM_SLOTS_PER_CTLR)
 
 #define CONFIG_DDR_SPD
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 
 #define CONFIG_SYS_SPD_BUS_NUM	0
 #define SPD_EEPROM_ADDRESS	0x52
include/configs/T1040QDS.h +1 -1
index 7c6bec8..43a5778 100644
@@ -170,7 +170,7 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_CHIP_SELECTS_PER_CTRL	(4 * CONFIG_DIMM_SLOTS_PER_CTLR)
 
 #define CONFIG_DDR_SPD
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 #define CONFIG_FSL_DDR_INTERACTIVE
 
 #define CONFIG_SYS_SPD_BUS_NUM	0
include/configs/T1040RDB.h +1 -1
index 620387f..7931231 100644
@@ -156,7 +156,7 @@
 
 #define CONFIG_DDR_SPD
 #define CONFIG_SYS_DDR_RAW_TIMING
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 
 #define CONFIG_SYS_SPD_BUS_NUM	0
 #define SPD_EEPROM_ADDRESS	0x51
include/configs/T1042RDB_PI.h +1 -1
index 4b023f9..eff08e3 100644
@@ -156,7 +156,7 @@
 
 #define CONFIG_DDR_SPD
 #define CONFIG_SYS_DDR_RAW_TIMING
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 
 #define CONFIG_SYS_SPD_BUS_NUM	0
 #define SPD_EEPROM_ADDRESS	0x51
include/configs/controlcenterd.h +1 -1
index 413f086..46d4f98 100644
@@ -138,7 +138,7 @@
 #define CONFIG_SYS_SDRAM_SIZE 1024
 #define CONFIG_VERY_BIG_RAM
 
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 #define CONFIG_NUM_DDR_CONTROLLERS	1
 #define CONFIG_DIMM_SLOTS_PER_CTLR	1
 #define CONFIG_CHIP_SELECTS_PER_CTRL	(2 * CONFIG_DIMM_SLOTS_PER_CTLR)
include/configs/corenet_ds.h +1 -1
index 562caa5..665295c 100644
@@ -173,7 +173,7 @@
 #define CONFIG_CHIP_SELECTS_PER_CTRL	(4 * CONFIG_DIMM_SLOTS_PER_CTLR)
 
 #define CONFIG_DDR_SPD
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 
 #define CONFIG_SYS_SPD_BUS_NUM	1
 #define SPD_EEPROM_ADDRESS1	0x51
include/configs/km/kmp204x-common.h +1 -1
index 2d5320b..7700b38 100644
@@ -111,7 +111,7 @@ unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_CHIP_SELECTS_PER_CTRL	(4 * CONFIG_DIMM_SLOTS_PER_CTLR)
 
 #define CONFIG_DDR_SPD
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 #define CONFIG_FSL_DDR_INTERACTIVE
 
 #define CONFIG_SYS_SPD_BUS_NUM	0
include/configs/mpq101.h +1 -1
index 6d0d392..ec09e15 100644
@@ -52,7 +52,7 @@
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 
 #define CONFIG_ECC_INIT_VIA_DDRCONTROLLER /* DDR controller or DMA? */
 
include/configs/p1_p2_rdb_pc.h +1 -1
index 91a6782..57ed019 100644
@@ -325,7 +325,7 @@
 #endif
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 #define CONFIG_SYS_DDR_RAW_TIMING
 #define CONFIG_DDR_SPD
 #define CONFIG_SYS_SPD_BUS_NUM 1
include/configs/p1_twr.h +1 -1
index 76189e1..9837100 100644
@@ -89,7 +89,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 
 #define CONFIG_SYS_SDRAM_SIZE_LAW	LAW_SIZE_512M
 #define CONFIG_CHIP_SELECTS_PER_CTRL	1
include/configs/sbc8548.h +1 -1
index 6d97060..bdb8eb5 100644
@@ -102,7 +102,7 @@
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #undef CONFIG_FSL_DDR_INTERACTIVE
 #undef CONFIG_DDR_ECC			/* only for ECC DDR module */
 /*
include/configs/socrates.h +1 -1
index b6fbe23..0e6b864 100644
@@ -80,7 +80,7 @@
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #undef CONFIG_FSL_DDR_INTERACTIVE
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup */
 #define CONFIG_DDR_SPD
include/configs/stxgp3.h +1 -1
index 9b3f0cc..ee1f1f3 100644
@@ -98,7 +98,7 @@
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR1
+#define CONFIG_SYS_FSL_DDR1
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup*/
 #define CONFIG_DDR_SPD
 #undef CONFIG_FSL_DDR_INTERACTIVE
include/configs/stxssa.h +1 -1
index 805814f..63dd767 100644
@@ -112,7 +112,7 @@
 #define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR
 
 /* DDR Setup */
-#define CONFIG_FSL_DDR1
+#define CONFIG_SYS_FSL_DDR1
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup*/
 #define CONFIG_DDR_SPD
 #undef CONFIG_FSL_DDR_INTERACTIVE
include/configs/t4qds.h +1 -1
index 3f54f14..d9b0ed0 100644
@@ -87,7 +87,7 @@
 #define CONFIG_FSL_DDR_FIRST_SLOT_QUAD_CAPABLE
 
 #define CONFIG_DDR_SPD
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 
 
 /*
include/configs/xpedite517x.h +1 -1
index 4738c23..88d7f88 100644
@@ -40,7 +40,7 @@
 /*
  * DDR config
  */
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup */
 #define CONFIG_DDR_SPD
 #define CONFIG_MEM_INIT_VALUE		0xdeadbeef
include/configs/xpedite520x.h +1 -1
index 3342880..f39d6f9 100644
@@ -39,7 +39,7 @@
 /*
  * DDR config
  */
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #undef CONFIG_FSL_DDR_INTERACTIVE
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup */
 #define CONFIG_DDR_SPD
include/configs/xpedite537x.h +1 -1
index 9da845d..e1bdf90 100644
@@ -49,7 +49,7 @@
 /*
  * DDR config
  */
-#define CONFIG_FSL_DDR2
+#define CONFIG_SYS_FSL_DDR2
 #undef CONFIG_FSL_DDR_INTERACTIVE
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup */
 #define CONFIG_DDR_SPD
include/configs/xpedite550x.h +1 -1
index 4137cc9..2328c7a 100644
@@ -49,7 +49,7 @@
 /*
  * DDR config
  */
-#define CONFIG_FSL_DDR3
+#define CONFIG_SYS_FSL_DDR3
 #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup */
 #define CONFIG_DDR_SPD
 #define CONFIG_MEM_INIT_VALUE		0xdeadbeef
include/fsl_ddr.h renamed from arch/powerpc/cpu/mpc8xxx/ddr/ddr.h +3 -3
similarity index 97%
rename from arch/powerpc/cpu/mpc8xxx/ddr/ddr.h
rename to include/fsl_ddr.h
index e3b414e..e03f9db 100644
@@ -9,10 +9,10 @@
 #ifndef FSL_DDR_MAIN_H
 #define FSL_DDR_MAIN_H
 
-#include <asm/fsl_ddr_sdram.h>
-#include <asm/fsl_ddr_dimm_params.h>
+#include <fsl_ddr_sdram.h>
+#include <fsl_ddr_dimm_params.h>
 
-#include "common_timing_params.h"
+#include <common_timing_params.h>
 
 #if defined(CONFIG_DDR_SPD) || defined(CONFIG_SPD_EEPROM)
 /*
include/fsl_ddr_dimm_params.h renamed from arch/powerpc/include/asm/fsl_ddr_dimm_params.h +0 -0
similarity index 100%
rename from arch/powerpc/include/asm/fsl_ddr_dimm_params.h
rename to include/fsl_ddr_dimm_params.h
include/fsl_ddr_sdram.h renamed from arch/powerpc/include/asm/fsl_ddr_sdram.h +4 -4
similarity index 98%
rename from arch/powerpc/include/asm/fsl_ddr_sdram.h
rename to include/fsl_ddr_sdram.h
index 2c3c514..16cccc7 100644
@@ -36,25 +36,25 @@
 #define DDR2_RTT_150_OHM	2
 #define DDR2_RTT_50_OHM		3
 
-#if defined(CONFIG_FSL_DDR1)
+#if defined(CONFIG_SYS_FSL_DDR1)
 #define FSL_DDR_MIN_TCKE_PULSE_WIDTH_DDR	(1)
 typedef ddr1_spd_eeprom_t generic_spd_eeprom_t;
 #ifndef CONFIG_FSL_SDRAM_TYPE
 #define CONFIG_FSL_SDRAM_TYPE	SDRAM_TYPE_DDR1
 #endif
-#elif defined(CONFIG_FSL_DDR2)
+#elif defined(CONFIG_SYS_FSL_DDR2)
 #define FSL_DDR_MIN_TCKE_PULSE_WIDTH_DDR	(3)
 typedef ddr2_spd_eeprom_t generic_spd_eeprom_t;
 #ifndef CONFIG_FSL_SDRAM_TYPE
 #define CONFIG_FSL_SDRAM_TYPE	SDRAM_TYPE_DDR2
 #endif
-#elif defined(CONFIG_FSL_DDR3)
+#elif defined(CONFIG_SYS_FSL_DDR3)
 #define FSL_DDR_MIN_TCKE_PULSE_WIDTH_DDR	(3)	/* FIXME */
 typedef ddr3_spd_eeprom_t generic_spd_eeprom_t;
 #ifndef CONFIG_FSL_SDRAM_TYPE
 #define CONFIG_FSL_SDRAM_TYPE	SDRAM_TYPE_DDR3
 #endif
-#endif	/* #if defined(CONFIG_FSL_DDR1) */
+#endif	/* #if defined(CONFIG_SYS_FSL_DDR1) */
 
 #define FSL_DDR_ODT_NEVER		0x0
 #define FSL_DDR_ODT_CS			0x1
nand_spl/board/freescale/mpc8569mds/nand_boot.c +1 -1
index 716b737..ce7f619 100644
@@ -10,7 +10,7 @@
 #include <nand.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_law.h>
 
 #define SYSCLK_66       66666666
nand_spl/board/freescale/p1023rds/nand_boot.c +2 -2
index 9468000..58e6cbf 100644
@@ -10,7 +10,7 @@
 #include <asm/io.h>
 #include <nand.h>
 #include <asm/fsl_law.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -18,7 +18,7 @@ DECLARE_GLOBAL_DATA_PTR;
 /* Fixed sdram init -- doesn't use serial presence detect. */
 void sdram_init(void)
 {
-	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
 
 	set_next_law(0, LAW_SIZE_2G, LAW_TRGT_IF_DDR_1);
 
nand_spl/board/freescale/p1_p2_rdb/nand_boot.c +1 -1
index 3244c8f..f7e8438 100644
@@ -10,7 +10,7 @@
 #include <nand.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
-#include <asm/fsl_ddr_sdram.h>
+#include <fsl_ddr_sdram.h>
 #include <asm/fsl_law.h>
 
 #define SYSCLK_MASK     0x00200000
spl/Makefile +1 -0
index 29d7818..2a787af 100644
@@ -70,6 +70,7 @@ LIBS-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
 LIBS-$(CONFIG_SPL_I2C_SUPPORT) += drivers/i2c/
 LIBS-$(CONFIG_SPL_GPIO_SUPPORT) += drivers/gpio/
 LIBS-$(CONFIG_SPL_MMC_SUPPORT) += drivers/mmc/
+LIBS-$(CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT) += drivers/ddr/fsl/
 LIBS-$(CONFIG_SPL_SERIAL_SUPPORT) += drivers/serial/
 LIBS-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += drivers/mtd/spi/
 LIBS-$(CONFIG_SPL_SPI_SUPPORT) += drivers/spi/
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v4 2/6 Driver/DDR: combine ccsr_ddr for 83xx, 85xx and 86xx

Fix ccsr_ddr structure to avoid using typedef. Combine DDR2 and DDR3 structure for 83xx, 85xx and 86xx.

---
Change log
v4: Rebase to latest master
v3: Split again, as review feedback requested
v2: Merge to "Driver/DDR: Moving Freescale DDR driver to a common driver"

 arch/powerpc/cpu/mpc83xx/ecc.c                |    4 +-
 arch/powerpc/cpu/mpc85xx/cpu.c                |    4 +-
 arch/powerpc/include/asm/immap_83xx.h         |  106 ++---------------------
 arch/powerpc/include/asm/immap_85xx.h         |  100 +---------------------
 arch/powerpc/include/asm/immap_86xx.h         |   74 +---------------
 board/exmeritus/hww1u1a/hww1u1a.c             |    3 +-
 board/freescale/bsc9131rdb/spl_minimal.c      |    3 +-
 board/freescale/bsc9132qds/bsc9132qds.c       |   14 ++--
 board/freescale/bsc9132qds/spl_minimal.c      |    3 +-
 board/freescale/mpc8536ds/mpc8536ds.c         |    2 +-
 board/freescale/mpc8540ads/mpc8540ads.c       |    3 +-
 board/freescale/mpc8569mds/mpc8569mds.c       |    3 +-
 board/freescale/mpc8572ds/mpc8572ds.c         |    2 +-
 board/freescale/mpc8610hpcd/mpc8610hpcd.c     |    2 +-
 board/freescale/mpc8641hpcn/mpc8641hpcn.c     |    2 +-
 board/freescale/p1010rdb/spl_minimal.c        |    3 +-
 board/freescale/p1023rds/p1023rds.c           |    3 +-
 board/freescale/p2020ds/p2020ds.c             |    3 +-
 board/sbc8548/ddr.c                           |    3 +-
 board/sbc8641d/sbc8641d.c                     |    6 +-
 board/socrates/sdram.c                        |    3 +-
 drivers/ddr/fsl/ctrl_regs.c                   |    3 +-
 drivers/ddr/fsl/mpc85xx_ddr_gen1.c            |    6 +-
 drivers/ddr/fsl/mpc85xx_ddr_gen2.c            |    3 +-
 drivers/ddr/fsl/mpc85xx_ddr_gen3.c            |    2 +-
 drivers/ddr/fsl/mpc86xx_ddr.c                 |    4 +-
 drivers/ddr/fsl/util.c                        |    4 +-
 include/fsl_immap.h                           |  112 +++++++++++++++++++++++++
 nand_spl/board/freescale/p1023rds/nand_boot.c |    3 +-
 29 files changed, 175 insertions(+), 308 deletions(-)
 create mode 100644 include/fsl_immap.h
arch/powerpc/cpu/mpc83xx/ecc.c +2 -2
index 6b7f72a..985a024 100644
@@ -16,7 +16,7 @@ void ecc_print_status(void)
 {
 	immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
 #ifdef CONFIG_SYS_FSL_DDR2
-	ccsr_ddr_t *ddr = &immap->ddr;
+	struct ccsr_ddr __iomem *ddr = &immap->ddr;
 #else
 	ddr83xx_t *ddr = &immap->ddr;
 #endif
@@ -100,7 +100,7 @@ int do_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
 	immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
 #ifdef CONFIG_SYS_FSL_DDR2
-	ccsr_ddr_t *ddr = &immap->ddr;
+	struct ccsr_ddr __iomem *ddr = &immap->ddr;
 #else
 	ddr83xx_t *ddr = &immap->ddr;
 #endif
arch/powerpc/cpu/mpc85xx/cpu.c +2 -2
index 552acc6..b5a0242 100644
@@ -416,7 +416,7 @@ static void dump_spd_ddr_reg(void)
 	int i, j, k, m;
 	u8 *p_8;
 	u32 *p_32;
-	ccsr_ddr_t *ddr[CONFIG_NUM_DDR_CONTROLLERS];
+	struct ccsr_ddr __iomem *ddr[CONFIG_NUM_DDR_CONTROLLERS];
 	generic_spd_eeprom_t
 		spd[CONFIG_NUM_DDR_CONTROLLERS][CONFIG_DIMM_SLOTS_PER_CTLR];
 
@@ -482,7 +482,7 @@ static void dump_spd_ddr_reg(void)
 	for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++)
 		printf("     Base + 0x%04x", (u32)ddr[i] & 0xFFFF);
 	puts("\n");
-	for (k = 0; k < sizeof(ccsr_ddr_t)/4; k++) {
+	for (k = 0; k < sizeof(struct ccsr_ddr)/4; k++) {
 		m = 0;
 		printf("%6d (0x%04x)", k * 4, k * 4);
 		for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++) {
arch/powerpc/include/asm/immap_83xx.h +5 -101

125 lines not on this page · raw message

arch/powerpc/include/asm/immap_85xx.h +1 -99

112 lines not on this page · raw message

arch/powerpc/include/asm/immap_86xx.h +3 -71

95 lines not on this page · raw message

board/exmeritus/hww1u1a/hww1u1a.c +2 -1
index 104987a..97b84b3 100644
@@ -37,6 +37,7 @@ int checkboard(void)
 	unsigned int gpio_low  = 0;
 	unsigned int gpio_in   = 0;
 	unsigned int i;
+	struct ccsr_ddr __iomem *ddr;
 
 	puts("Board: HWW-1U-1A ");
 
@@ -89,7 +90,7 @@ int checkboard(void)
 	 * and delay a while before we continue.
 	 */
 	if (mpc85xx_gpio_get(GPIO_RESETS)) {
-		ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
+		ddr = (struct ccsr_ddr __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
 
 		puts("Debugger detected... extra device reset enabled!\n");
 
board/freescale/bsc9131rdb/spl_minimal.c +2 -1
index 9746271..bd8560b 100644
@@ -20,7 +20,8 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 static void sdram_init(void)
 {
-	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
 
 	__raw_writel(CONFIG_SYS_DDR_CS0_BNDS, &ddr->cs0_bnds);
 	__raw_writel(CONFIG_SYS_DDR_CS0_CONFIG, &ddr->cs0_config);
board/freescale/bsc9132qds/bsc9132qds.c +7 -7
index 31bbf62..c1ebcf8 100644
@@ -133,16 +133,16 @@ void dsp_ddr_configure(void)
 	 *copy the ddr controller settings from PowerPC side DDR controller
 	 *to the DSP DDR controller as connected DDR memories are similar.
 	 */
-	ccsr_ddr_t __iomem *pa_ddr =
-			(ccsr_ddr_t __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
-	ccsr_ddr_t temp_ddr;
-	ccsr_ddr_t __iomem *dsp_ddr =
-			(ccsr_ddr_t __iomem *)CONFIG_SYS_FSL_DSP_CCSR_DDR_ADDR;
+	struct ccsr_ddr __iomem *pa_ddr =
+			(struct ccsr_ddr __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
+	struct ccsr_ddr temp_ddr;
+	struct ccsr_ddr __iomem *dsp_ddr =
+			(struct ccsr_ddr __iomem *)CONFIG_SYS_FSL_DSP_CCSR_DDR_ADDR;
 
-	memcpy(&temp_ddr, pa_ddr, sizeof(ccsr_ddr_t));
+	memcpy(&temp_ddr, pa_ddr, sizeof(struct ccsr_ddr));
 	temp_ddr.cs0_bnds = CONFIG_SYS_DDR1_CS0_BNDS;
 	temp_ddr.sdram_cfg &= ~SDRAM_CFG_MEM_EN;
-	memcpy(dsp_ddr, &temp_ddr, sizeof(ccsr_ddr_t));
+	memcpy(dsp_ddr, &temp_ddr, sizeof(struct ccsr_ddr));
 	dsp_ddr->sdram_cfg |= SDRAM_CFG_MEM_EN;
 }
 
board/freescale/bsc9132qds/spl_minimal.c +2 -1
index 0249dc5..8f71431 100644
@@ -17,7 +17,8 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static void sdram_init(void)
 {
-	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
 #if CONFIG_DDR_CLK_FREQ == 100000000
 	__raw_writel(CONFIG_SYS_DDR_CS0_BNDS, &ddr->cs0_bnds);
 	__raw_writel(CONFIG_SYS_DDR_CS0_CONFIG, &ddr->cs0_config);
board/freescale/mpc8536ds/mpc8536ds.c +1 -1
index 59e9a35..467f4f2 100644
@@ -90,7 +90,7 @@ int checkboard (void)
 phys_size_t fixed_sdram (void)
 {
 	volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
-	volatile ccsr_ddr_t *ddr= &immap->im_ddr;
+	struct ccsr_ddr __iomem *ddr = &immap->im_ddr;
 	uint d_init;
 
 	ddr->cs0_bnds = CONFIG_SYS_DDR_CS0_BNDS;
board/freescale/mpc8540ads/mpc8540ads.c +2 -1
index 97a5d19..93288c7 100644
@@ -168,7 +168,8 @@ void lbc_sdram_init(void)
 phys_size_t fixed_sdram(void)
 {
   #ifndef CONFIG_SYS_RAMBOOT
-	volatile ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_FSL_DDR_ADDR);
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)(CONFIG_SYS_FSL_DDR_ADDR);
 
 	ddr->cs0_bnds = CONFIG_SYS_DDR_CS0_BNDS;
 	ddr->cs0_config = CONFIG_SYS_DDR_CS0_CONFIG;
board/freescale/mpc8569mds/mpc8569mds.c +2 -1
index 60f5577..cb55e1c 100644
@@ -231,7 +231,8 @@ int checkboard (void)
 #if !defined(CONFIG_SPD_EEPROM)
 phys_size_t fixed_sdram(void)
 {
-	volatile ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
 	uint d_init;
 
 	out_be32(&ddr->cs0_bnds, CONFIG_SYS_DDR_CS0_BNDS);
board/freescale/mpc8572ds/mpc8572ds.c +1 -1
index 2fb4257..5686322 100644
@@ -62,7 +62,7 @@ int checkboard (void)
 phys_size_t fixed_sdram (void)
 {
 	volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
-	volatile ccsr_ddr_t *ddr= &immap->im_ddr;
+	struct ccsr_ddr __iomem *ddr = &immap->im_ddr;
 	uint d_init;
 
 	ddr->cs0_bnds = CONFIG_SYS_DDR_CS0_BNDS;
board/freescale/mpc8610hpcd/mpc8610hpcd.c +1 -1
index aa99623..d8740dd 100644
@@ -143,7 +143,7 @@ phys_size_t fixed_sdram(void)
 {
 #if !defined(CONFIG_SYS_RAMBOOT)
 	volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
-	volatile ccsr_ddr_t *ddr = &immap->im_ddr1;
+	struct ccsr_ddr __iomem *ddr = &immap->im_ddr1;
 	uint d_init;
 
 	ddr->cs0_bnds = 0x0000001f;
board/freescale/mpc8641hpcn/mpc8641hpcn.c +1 -1
index 0cd9df1..a58b5f9 100644
@@ -64,7 +64,7 @@ fixed_sdram(void)
 {
 #if !defined(CONFIG_SYS_RAMBOOT)
 	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-	volatile ccsr_ddr_t *ddr = &immap->im_ddr1;
+	struct ccsr_ddr __iomem *ddr = &immap->im_ddr1;
 
 	ddr->cs0_bnds = CONFIG_SYS_DDR_CS0_BNDS;
 	ddr->cs0_config = CONFIG_SYS_DDR_CS0_CONFIG;
board/freescale/p1010rdb/spl_minimal.c +2 -1
index aa2a344..39a5a0f 100644
@@ -19,7 +19,8 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void sdram_init(void)
 {
-	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
 	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
 	u32 ddr_ratio;
 	unsigned long ddr_freq_mhz;
board/freescale/p1023rds/p1023rds.c +2 -1
index 2cfcdc4..d8c8745 100644
@@ -58,7 +58,8 @@ int checkboard(void)
 phys_size_t fixed_sdram(void)
 {
 #ifndef CONFIG_SYS_RAMBOOT
-	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
 
 	set_next_law(0, LAW_SIZE_2G, LAW_TRGT_IF_DDR_1);
 
board/freescale/p2020ds/p2020ds.c +2 -1
index dd8c6b1..a0cf927 100644
@@ -68,7 +68,8 @@ int checkboard(void)
 
 phys_size_t fixed_sdram(void)
 {
-	volatile ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
 	uint d_init;
 
 	ddr->cs0_config = CONFIG_SYS_DDR_CS0_CONFIG;
board/sbc8548/ddr.c +2 -1
index 8817103..24cc776 100644
@@ -91,7 +91,8 @@ void get_spd(generic_spd_eeprom_t *spd, u8 i2c_address)
  */
 phys_size_t fixed_sdram(void)
 {
-	volatile ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_FSL_DDR_ADDR);
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)(CONFIG_SYS_FSL_DDR_ADDR);
 
 	out_be32(&ddr->cs0_bnds,	0x0000007f);
 	out_be32(&ddr->cs1_bnds,	0x008000ff);
board/sbc8641d/sbc8641d.c +3 -3
index 8160c7b..4906be4 100644
@@ -93,7 +93,7 @@ long int fixed_sdram (void)
 {
 #if !defined(CONFIG_SYS_RAMBOOT)
 	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-	volatile ccsr_ddr_t *ddr = &immap->im_ddr1;
+	volatile struct ccsr_ddr *ddr = &immap->im_ddr1;
 
 	ddr->cs0_bnds = CONFIG_SYS_DDR_CS0_BNDS;
 	ddr->cs1_bnds = CONFIG_SYS_DDR_CS1_BNDS;
@@ -111,7 +111,7 @@ long int fixed_sdram (void)
 	ddr->sdram_cfg_2 = CONFIG_SYS_DDR_CFG_2;
 	ddr->sdram_mode = CONFIG_SYS_DDR_MODE_1;
 	ddr->sdram_mode_2 = CONFIG_SYS_DDR_MODE_2;
-	ddr->sdram_mode_cntl = CONFIG_SYS_DDR_MODE_CTL;
+	ddr->sdram_md_cntl = CONFIG_SYS_DDR_MODE_CTL;
 	ddr->sdram_interval = CONFIG_SYS_DDR_INTERVAL;
 	ddr->sdram_data_init = CONFIG_SYS_DDR_DATA_INIT;
 	ddr->sdram_clk_cntl = CONFIG_SYS_DDR_CLK_CTRL;
@@ -142,7 +142,7 @@ long int fixed_sdram (void)
 	ddr->sdram_cfg_2 = CONFIG_SYS_DDR2_CFG_2;
 	ddr->sdram_mode = CONFIG_SYS_DDR2_MODE_1;
 	ddr->sdram_mode_2 = CONFIG_SYS_DDR2_MODE_2;
-	ddr->sdram_mode_cntl = CONFIG_SYS_DDR2_MODE_CTL;
+	ddr->sdram_md_cntl = CONFIG_SYS_DDR2_MODE_CTL;
 	ddr->sdram_interval = CONFIG_SYS_DDR2_INTERVAL;
 	ddr->sdram_data_init = CONFIG_SYS_DDR2_DATA_INIT;
 	ddr->sdram_clk_cntl = CONFIG_SYS_DDR2_CLK_CTRL;
board/socrates/sdram.c +2 -1
index 356e8e8..aebd02f 100644
@@ -24,7 +24,8 @@
  */
 phys_size_t fixed_sdram(void)
 {
-	volatile ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_FSL_DDR_ADDR);
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)(CONFIG_SYS_FSL_DDR_ADDR);
 
 	/*
 	 * Disable memory controller.
drivers/ddr/fsl/ctrl_regs.c +2 -1
index aed4569..5f3ea59 100644
@@ -14,13 +14,14 @@
 #include <fsl_ddr_sdram.h>
 
 #include <fsl_ddr.h>
+#include <fsl_immap.h>
 #include <asm/io.h>
 
 #define _DDR_ADDR CONFIG_SYS_FSL_DDR_ADDR
 
 static u32 fsl_ddr_get_version(void)
 {
-	ccsr_ddr_t *ddr;
+	struct ccsr_ddr __iomem *ddr;
 	u32 ver_major_minor_errata;
 
 	ddr = (void *)_DDR_ADDR;
drivers/ddr/fsl/mpc85xx_ddr_gen1.c +4 -2
index ff7d979..8dd4a91 100644
@@ -18,7 +18,8 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 			     unsigned int ctrl_num, int step)
 {
 	unsigned int i;
-	volatile ccsr_ddr_t *ddr = (void *)CONFIG_SYS_FSL_DDR_ADDR;
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
 
 	if (ctrl_num != 0) {
 		printf("%s unexpected ctrl_num = %u\n", __FUNCTION__, ctrl_num);
@@ -73,7 +74,8 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 void
 ddr_enable_ecc(unsigned int dram_size)
 {
-	volatile ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_FSL_DDR_ADDR);
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)(CONFIG_SYS_FSL_DDR_ADDR);
 
 	dma_meminit(CONFIG_MEM_INIT_VALUE, dram_size);
 
drivers/ddr/fsl/mpc85xx_ddr_gen2.c +2 -1
index c22dea5..988b4a4 100644
@@ -19,7 +19,8 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 			     unsigned int ctrl_num, int step)
 {
 	unsigned int i;
-	ccsr_ddr_t *ddr = (void *)CONFIG_SYS_FSL_DDR_ADDR;
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
 
 #if defined(CONFIG_SYS_FSL_ERRATUM_NMG_DDR120) && defined(CONFIG_MPC85xx)
 	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
drivers/ddr/fsl/mpc85xx_ddr_gen3.c +1 -1
index 7b4e8ec..9f04133 100644
@@ -29,7 +29,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 			     unsigned int ctrl_num, int step)
 {
 	unsigned int i, bus_width;
-	volatile ccsr_ddr_t *ddr;
+	struct ccsr_ddr __iomem *ddr;
 	u32 temp_sdram_cfg;
 	u32 total_gb_size_per_controller;
 	int timeout;
drivers/ddr/fsl/mpc86xx_ddr.c +2 -2
index caffbaf..4551ed8 100644
@@ -18,7 +18,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 			     unsigned int ctrl_num, int step)
 {
 	unsigned int i;
-	volatile ccsr_ddr_t *ddr;
+	struct ccsr_ddr __iomem *ddr;
 
 	switch (ctrl_num) {
 	case 0:
@@ -58,7 +58,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 	out_be32(&ddr->sdram_cfg_2, regs->ddr_sdram_cfg_2);
 	out_be32(&ddr->sdram_mode, regs->ddr_sdram_mode);
 	out_be32(&ddr->sdram_mode_2, regs->ddr_sdram_mode_2);
-	out_be32(&ddr->sdram_mode_cntl, regs->ddr_sdram_md_cntl);
+	out_be32(&ddr->sdram_md_cntl, regs->ddr_sdram_md_cntl);
 	out_be32(&ddr->sdram_interval, regs->ddr_sdram_interval);
 	out_be32(&ddr->sdram_data_init, regs->ddr_data_init);
 	out_be32(&ddr->sdram_clk_cntl, regs->ddr_sdram_clk_cntl);
drivers/ddr/fsl/util.c +3 -1
index 45a7bcc..5d6b362 100644
@@ -11,6 +11,7 @@
 #include <div64.h>
 
 #include <fsl_ddr.h>
+#include <fsl_immap.h>
 #include <asm/io.h>
 
 /* To avoid 64-bit full-divides, we factor this here */
@@ -134,7 +135,8 @@ u32 fsl_ddr_get_intl3r(void)
 
 void board_add_ram_info(int use_default)
 {
-	ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_FSL_DDR_ADDR);
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)(CONFIG_SYS_FSL_DDR_ADDR);
 
 #if	defined(CONFIG_E6500) && (CONFIG_NUM_DDR_CONTROLLERS == 3)
 	u32 *mcintl3r = (void *) (CONFIG_SYS_IMMR + 0x18004);
include/fsl_immap.h new file +112 -0

112 lines not on this page · raw message

nand_spl/board/freescale/p1023rds/nand_boot.c +2 -1
index 58e6cbf..d9afa6d 100644
@@ -18,7 +18,8 @@ DECLARE_GLOBAL_DATA_PTR;
 /* Fixed sdram init -- doesn't use serial presence detect. */
 void sdram_init(void)
 {
-	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_FSL_DDR_ADDR;
+	struct ccsr_ddr __iomem *ddr =
+		(struct ccsr_ddr __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
 
 	set_next_law(0, LAW_SIZE_2G, LAW_TRGT_IF_DDR_1);
 
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH v4 3/6 Driver/DDR: Add Freescale DDR driver for ARM

In reply to York Sun

Make PowerPC specific code conditional so ARM SoCs can reuse this driver. Add DDR3 driver for ARM.

---
Change log
v4: Rebase to latest master
v3: no change
v2: Replace macro CONFIG_SYS_FSL_DDR_ARM_GEN3 with CONFIG_SYS_FSL_DDRC_ARM_GEN3
Updated README

 README                         |    3 +
 drivers/ddr/fsl/Makefile       |    2 +-
 drivers/ddr/fsl/arm_ddr_gen3.c |  213 ++++++++++++++++++++++++++++++++++++++++
 drivers/ddr/fsl/main.c         |   12 ++-
 drivers/ddr/fsl/util.c         |    4 +
 5 files changed, 230 insertions(+), 4 deletions(-)
 create mode 100644 drivers/ddr/fsl/arm_ddr_gen3.c
README +3 -0
index 49f4b3a..d6006f5 100644
@@ -450,6 +450,9 @@ The following options need to be configured:
 		CONFIG_SYS_FSL_DDRC_GEN3
 		Freescale DDR3 controller.
 
+		CONFIG_SYS_FSL_DDRC_ARM_GEN3
+		Freescale DDR3 controller for ARM-based SoCs.
+
 		CONFIG_SYS_FSL_DDR1
 		Board config to use DDR1. It can be enabled for SoCs with
 		Freescale DDR1 or DDR2 controllers, depending on the board
drivers/ddr/fsl/Makefile +1 -1
index a328b43..265204f 100644
@@ -31,4 +31,4 @@ obj-$(CONFIG_SYS_FSL_DDRC_GEN1)	+= mpc85xx_ddr_gen1.o
 obj-$(CONFIG_SYS_FSL_DDRC_GEN2)	+= mpc85xx_ddr_gen2.o
 obj-$(CONFIG_SYS_FSL_DDRC_GEN3)	+= mpc85xx_ddr_gen3.o
 obj-$(CONFIG_SYS_FSL_DDR_86XX)		+= mpc86xx_ddr.o
-obj-$(CONFIG_FSL_DDR_INTERACTIVE)	+= interactive.o
+obj-$(CONFIG_SYS_FSL_DDRC_ARM_GEN3)	+= arm_ddr_gen3.o
drivers/ddr/fsl/arm_ddr_gen3.c new file +213 -0

213 lines not on this page · raw message

drivers/ddr/fsl/main.c +9 -3
index c1cdbdf..b4988e1 100644
@@ -15,16 +15,18 @@
 #include <common.h>
 #include <i2c.h>
 #include <fsl_ddr_sdram.h>
-#include <asm/fsl_law.h>
-
 #include <fsl_ddr.h>
 
+#ifdef CONFIG_PPC
+#include <asm/fsl_law.h>
+
 void fsl_ddr_set_lawbar(
 		const common_timing_params_t *memctl_common_params,
 		unsigned int memctl_interleaved,
 		unsigned int ctrl_num);
-void fsl_ddr_set_intl3r(const unsigned int granule_size);
+#endif
 
+void fsl_ddr_set_intl3r(const unsigned int granule_size);
 #if defined(SPD_EEPROM_ADDRESS) || \
     defined(SPD_EEPROM_ADDRESS1) || defined(SPD_EEPROM_ADDRESS2) || \
     defined(SPD_EEPROM_ADDRESS3) || defined(SPD_EEPROM_ADDRESS4)
@@ -549,7 +551,9 @@ fsl_ddr_compute(fsl_ddr_info_t *pinfo, unsigned int start_step,
 phys_size_t fsl_ddr_sdram(void)
 {
 	unsigned int i;
+#ifdef CONFIG_PPC
 	unsigned int law_memctl = LAW_TRGT_IF_DDR_1;
+#endif
 	unsigned long long total_memory;
 	fsl_ddr_info_t info;
 	int deassert_reset;
@@ -621,6 +625,7 @@ phys_size_t fsl_ddr_sdram(void)
 		}
 	}
 
+#ifdef CONFIG_PPC
 	/* program LAWs */
 	for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++) {
 		if (info.memctl_opts[i].memctl_interleaving) {
@@ -681,6 +686,7 @@ phys_size_t fsl_ddr_sdram(void)
 					law_memctl, i);
 		}
 	}
+#endif
 
 	debug("total_memory by %s = %llu\n", __func__, total_memory);
 
drivers/ddr/fsl/util.c +4 -0
index 5d6b362..0658261 100644
@@ -7,7 +7,9 @@
  */
 
 #include <common.h>
+#ifdef CONFIG_PPC
 #include <asm/fsl_law.h>
+#endif
 #include <div64.h>
 
 #include <fsl_ddr.h>
@@ -79,6 +81,7 @@ unsigned int mclk_to_picos(unsigned int mclk)
 	return get_memory_clk_period_ps() * mclk;
 }
 
+#ifdef CONFIG_PPC
 void
 __fsl_ddr_set_lawbar(const common_timing_params_t *memctl_common_params,
 			   unsigned int law_memctl,
@@ -113,6 +116,7 @@ __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 fsl_ddr_set_intl3r(const unsigned int granule_size)
 {
Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH v4 4/6 powerpc/mpc8xxx: Extend DDR registers' fields

In reply to York Sun

Some DDR registers' fields have expanded to accommodate larger values. These changes are backward compatible. Some fields are removed for newer DDR controllers. Writing to those fields are safely ignored.

TIMING_CFG_2 register is fixed. Additive latency is added to RD_TO_PRE automatically. It was a misunderstanding in commit c360ceac.

---
Change log
v4: rebase to latest master
v3: no change
v2: no change since v1

 drivers/ddr/fsl/ctrl_regs.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/ddr/fsl/ctrl_regs.c +12 -8
index 5f3ea59..6bf22cf 100644
@@ -325,10 +325,10 @@ static void set_timing_cfg_0(fsl_ddr_cfg_regs_t *ddr,
 		| ((twrt_mclk & 0x3) << 28)	/* WRT */
 		| ((trrt_mclk & 0x3) << 26)	/* RRT */
 		| ((twwt_mclk & 0x3) << 24)	/* WWT */
-		| ((act_pd_exit_mclk & 0x7) << 20)  /* ACT_PD_EXIT */
+		| ((act_pd_exit_mclk & 0xf) << 20)  /* ACT_PD_EXIT */
 		| ((pre_pd_exit_mclk & 0xF) << 16)  /* PRE_PD_EXIT */
 		| ((taxpd_mclk & 0xf) << 8)	/* ODT_PD_EXIT */
-		| ((tmrd_mclk & 0xf) << 0)	/* MRS_CYC */
+		| ((tmrd_mclk & 0x1f) << 0)	/* MRS_CYC */
 		);
 	debug("FSLDDR: timing_cfg_0 = 0x%08x\n", ddr->timing_cfg_0);
 }
@@ -338,7 +338,8 @@ static void set_timing_cfg_0(fsl_ddr_cfg_regs_t *ddr,
 static void set_timing_cfg_3(fsl_ddr_cfg_regs_t *ddr,
 			       const memctl_options_t *popts,
 			       const common_timing_params_t *common_dimm,
-			       unsigned int cas_latency)
+			       unsigned int cas_latency,
+			       unsigned int additive_latency)
 {
 	/* Extended precharge to activate interval (tRP) */
 	unsigned int ext_pretoact = 0;
@@ -350,6 +351,8 @@ static void set_timing_cfg_3(fsl_ddr_cfg_regs_t *ddr,
 	unsigned int ext_refrec;
 	/* Extended MCAS latency from READ cmd */
 	unsigned int ext_caslat = 0;
+	/* Extended additive latency */
+	unsigned int ext_add_lat = 0;
 	/* Extended last data to precharge interval (tWR) */
 	unsigned int ext_wrrec = 0;
 	/* Control Adjust */
@@ -359,6 +362,7 @@ static void set_timing_cfg_3(fsl_ddr_cfg_regs_t *ddr,
 	ext_acttopre = picos_to_mclk(common_dimm->tras_ps) >> 4;
 	ext_acttorw = picos_to_mclk(common_dimm->trcd_ps) >> 4;
 	ext_caslat = (2 * cas_latency - 1) >> 4;
+	ext_add_lat = additive_latency >> 4;
 	ext_refrec = (picos_to_mclk(common_dimm->trfc_ps) - 8) >> 4;
 	/* ext_wrrec only deals with 16 clock and above, or 14 with OTF */
 	ext_wrrec = (picos_to_mclk(common_dimm->twr_ps) +
@@ -370,6 +374,7 @@ static void set_timing_cfg_3(fsl_ddr_cfg_regs_t *ddr,
 		| ((ext_acttorw & 0x1) << 22)
 		| ((ext_refrec & 0x1F) << 16)
 		| ((ext_caslat & 0x3) << 12)
+		| ((ext_add_lat & 0x1) << 10)
 		| ((ext_wrrec & 0x1) << 8)
 		| ((cntl_adj & 0x7) << 0)
 		);
@@ -531,8 +536,6 @@ static void set_timing_cfg_2(fsl_ddr_cfg_regs_t *ddr,
 	if (rd_to_pre < 4)
 		rd_to_pre = 4;
 #endif
-	if (additive_latency)
-		rd_to_pre += additive_latency;
 	if (popts->otf_burst_chop_en)
 		rd_to_pre += 2; /* according to UM */
 
@@ -1592,8 +1595,8 @@ compute_fsl_memctl_config_regs(const memctl_options_t *popts,
 
 		if (cs_en) {
 			ddr->cs[i].bnds = (0
-				| ((sa & 0xFFF) << 16)/* starting address MSB */
-				| ((ea & 0xFFF) << 0)	/* ending address MSB */
+				| ((sa & 0xffff) << 16) /* starting address */
+				| ((ea & 0xffff) << 0)	/* ending address */
 				);
 		} else {
 			/* setting bnds to 0xffffffff for inactive CS */
@@ -1618,7 +1621,8 @@ compute_fsl_memctl_config_regs(const memctl_options_t *popts,
 	set_timing_cfg_0(ddr, popts, dimm_params);
 #endif
 
-	set_timing_cfg_3(ddr, popts, common_dimm, cas_latency);
+	set_timing_cfg_3(ddr, popts, common_dimm, cas_latency,
+			 additive_latency);
 	set_timing_cfg_1(ddr, popts, common_dimm, cas_latency);
 	set_timing_cfg_2(ddr, popts, common_dimm,
 				cas_latency, additive_latency);
Signature · 1 line
1.7.9.5
author
#4 lore raw

PATCH v4 5/6 Driver/DDR: Update DDR driver to allow non-zero base address

In reply to York Sun

The DRAM base has been zero for Power SoCs. It could be non-zero for ARM SoCs. Use a macro instead of hard-coding to zero.

---
Change log
v4: rebase to latset master
v3: no change
v2: no change since v1

 drivers/ddr/fsl/main.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ddr/fsl/main.c +3 -3
index b4988e1..d0cd589 100644
@@ -255,7 +255,7 @@ static unsigned long long __step_assign_addresses(fsl_ddr_info_t *pinfo,
 		debug("dbw_cap_adj[%d]=%d\n", i, dbw_cap_adj[i]);
 	}
 
-	current_mem_base = 0ull;
+	current_mem_base = CONFIG_SYS_DDR_SDRAM_BASE;
 	total_mem = 0;
 	if (pinfo->memctl_opts[0].memctl_interleaving) {
 		rank_density = pinfo->dimm_params[0][0].rank_density >>
@@ -535,8 +535,8 @@ fsl_ddr_compute(fsl_ddr_info_t *pinfo, unsigned int start_step,
 			}
 		}
 
-		total_mem = 1 + (((unsigned long long)max_end << 24ULL)
-				    | 0xFFFFFFULL);
+		total_mem = 1 + (((unsigned long long)max_end << 24ULL) |
+			    0xFFFFFFULL) - CONFIG_SYS_DDR_SDRAM_BASE;
 	}
 
 	return total_mem;
Signature · 1 line
1.7.9.5
author
#5 lore raw

PATCH v4 6/6 Driver/IFC: Move Freescale IFC driver to a common driver

In reply to York Sun

Freescale IFC controller has been used for mpc8xxx. It will be used for ARM-based SoC as well. This patch moves the driver to driver/misc and fix the header file includes.

---
Change log
v4: rebase to latest master
v3: no change
v2: Move to driver/misc instead of driver/mtd

 arch/powerpc/cpu/mpc85xx/cpu.c                     |    2 +-
 arch/powerpc/cpu/mpc85xx/spl_minimal.c             |    2 +-
 arch/powerpc/cpu/mpc8xxx/Makefile                  |    1 -
 arch/powerpc/include/asm/immap_85xx.h              |    2 +-
 board/freescale/bsc9132qds/bsc9132qds.c            |    2 +-
 board/freescale/c29xpcie/c29xpcie.c                |    2 +-
 board/freescale/p1010rdb/p1010rdb.c                |    2 +-
 drivers/misc/Makefile                              |    1 +
 .../powerpc/cpu/mpc8xxx => drivers/misc}/fsl_ifc.c |    2 +-
 drivers/mtd/nand/fsl_ifc_nand.c                    |    2 +-
 drivers/mtd/nand/fsl_ifc_spl.c                     |    2 +-
 {arch/powerpc/include/asm => include}/fsl_ifc.h    |    6 +++---
 12 files changed, 13 insertions(+), 13 deletions(-)
 rename {arch/powerpc/cpu/mpc8xxx => drivers/misc}/fsl_ifc.c (99%)
 rename {arch/powerpc/include/asm => include}/fsl_ifc.h (99%)
arch/powerpc/cpu/mpc85xx/cpu.c +1 -1
index b5a0242..3e99b07 100644
@@ -17,7 +17,7 @@
 #include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/mmu.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <asm/fsl_law.h>
 #include <asm/fsl_lbc.h>
 #include <post.h>
arch/powerpc/cpu/mpc85xx/spl_minimal.c +1 -1
index 199b33e..9e4c6c9 100644
@@ -7,7 +7,7 @@
 #include <common.h>
 #include <asm/processor.h>
 #include <asm/global_data.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
arch/powerpc/cpu/mpc8xxx/Makefile +0 -1
index 395fed1..f66ee2e 100644
@@ -25,7 +25,6 @@ obj-y	+= cpu.o
 endif
 
 obj-$(CONFIG_OF_LIBFDT) += fdt.o
-obj-$(CONFIG_FSL_IFC) += fsl_ifc.o
 obj-$(CONFIG_FSL_LBC) += fsl_lbc.o
 obj-$(CONFIG_SYS_SRIO) += srio.o
 obj-$(CONFIG_FSL_LAW) += law.o
arch/powerpc/include/asm/immap_85xx.h +1 -1
index 80817dc..9b386ee 100644
@@ -15,7 +15,7 @@
 #include <asm/types.h>
 #include <asm/fsl_dma.h>
 #include <asm/fsl_i2c.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <asm/fsl_lbc.h>
 #include <asm/fsl_fman.h>
 #include <fsl_immap.h>
board/freescale/bsc9132qds/bsc9132qds.c +1 -1
index c1ebcf8..9377280 100644
@@ -17,7 +17,7 @@
 #include <tsec.h>
 #include <mmc.h>
 #include <netdev.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <hwconfig.h>
 #include <i2c.h>
 #include <fsl_ddr_sdram.h>
board/freescale/c29xpcie/c29xpcie.c +1 -1
index 48c4b30..f964d61 100644
@@ -18,7 +18,7 @@
 #include <mmc.h>
 #include <netdev.h>
 #include <pci.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <asm/fsl_pci.h>
 
 #include "cpld.h"
board/freescale/p1010rdb/p1010rdb.c +1 -1
index e940d22..62caf67 100644
@@ -19,7 +19,7 @@
 #include <netdev.h>
 #include <pci.h>
 #include <asm/fsl_serdes.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <asm/fsl_pci.h>
 #include <hwconfig.h>
 #include <i2c.h>
drivers/misc/Makefile +1 -0
index d8ff9c6..c77e40a 100644
@@ -20,3 +20,4 @@ obj-$(CONFIG_NS87308) += ns87308.o
 obj-$(CONFIG_PDSP188x) += pdsp188x.o
 obj-$(CONFIG_STATUS_LED) += status_led.o
 obj-$(CONFIG_TWL4030_LED) += twl4030_led.o
+obj-$(CONFIG_FSL_IFC) += fsl_ifc.o
drivers/misc/fsl_ifc.c renamed from arch/powerpc/cpu/mpc8xxx/fsl_ifc.c +1 -1
similarity index 99%
rename from arch/powerpc/cpu/mpc8xxx/fsl_ifc.c
rename to drivers/misc/fsl_ifc.c
index 2d0fb43..507c4de 100644
@@ -6,7 +6,7 @@
  */
 
 #include <common.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 
 void print_ifc_regs(void)
 {
drivers/mtd/nand/fsl_ifc_nand.c +1 -1
index 98a09c0..3b845b9 100644
@@ -17,7 +17,7 @@
 
 #include <asm/io.h>
 #include <asm/errno.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 
 #define FSL_IFC_V1_1_0	0x01010000
 #define MAX_BANKS	4
drivers/mtd/nand/fsl_ifc_spl.c +1 -1
index d462265..3c8278d 100644
@@ -9,7 +9,7 @@
 
 #include <common.h>
 #include <asm/io.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <linux/mtd/nand.h>
 
 static inline int is_blank(uchar *addr, int page_size)
include/fsl_ifc.h renamed from arch/powerpc/include/asm/fsl_ifc.h +3 -3
similarity index 99%
rename from arch/powerpc/include/asm/fsl_ifc.h
rename to include/fsl_ifc.h
index a945e4b..3e9b01b 100644
@@ -5,8 +5,8 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-#ifndef __ASM_PPC_FSL_IFC_H
-#define __ASM_PPC_FSL_IFC_H
+#ifndef __FSL_IFC_H
+#define __FSL_IFC_H
 
 #ifdef CONFIG_FSL_IFC
 #include <config.h>
@@ -983,4 +983,4 @@ struct fsl_ifc {
 #endif /* CONFIG_FSL_IFC */
 
 #endif /* __ASSEMBLY__ */
-#endif /* __ASM_PPC_FSL_IFC_H */
+#endif /* __FSL_IFC_H */
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH v4 1/6 Driver/DDR: Moving Freescale DDR driver to a common driver

In reply to York Sun

Hello York.

arch/powerpc/cpu/mpc83xx/Makefile obj-$(CONFIG_OF_LIBFDT) += fdt.o · line 42

Quoted 10 lines
arch/powerpc/cpu/mpc83xx/Makefile +2 -2
@@ -38,11 +38,11 @@ obj-$(CONFIG_OF_LIBFDT) += fdt.o
 # Stub implementations of cache management functions for USB
 obj-y += cache.o
 
-ifdef CONFIG_FSL_DDR2
-obj-$(CONFIG_MPC8349) += ../mpc85xx/ddr-gen2.o
+ifdef CONFIG_SYS_FSL_DDR2
+obj-$(CONFIG_MPC8349) += $(SRCTREE)/drivers/ddr/fsl/mpc85xx_ddr_gen2.o

This Makefile is NG.
The object file, mpc85xx_ddr_gen2.o, is created under a strange path.

Just build with O= and find out where this object is created.

$ rm -rf build/
$ make O=build MPC8349EMDS_config
Configuring for MPC8349EMDS board...
$ make O=build CROSS_COMPILE=powerpc-linux-
<<snip>>
$ find . -name mpc85xx_ddr_gen2.o
./build/arch/powerpc/cpu/mpc83xx/home/yamada/workspace/u-boot/drivers/ddr/fsl/mpc85xx_ddr_gen2.o

And it also looks weird to me.

Why did you put this code in arch/powerpc/cpu/mpc83xx/Makefie, not drivers/ddr/fsl/Makefile ?

Best Regards
Masahiro Yamada

author
#7 lore raw

PATCH v4 1/6 Driver/DDR: Moving Freescale DDR driver to a common driver

Quoted 8 lines · Masahiro Yamada

Hello York.

Quoted 6 lines
arch/powerpc/cpu/mpc83xx/Makefile +0 -0
@@ -38,11 +38,11 @@ obj-$(CONFIG_OF_LIBFDT) += fdt.o
 # Stub implementations of cache management functions for USB

obj-y += cache.o

Quoted 7 lines

arch/powerpc/cpu/mpc83xx/Makefile obj-$(CONFIG_OF_LIBFDT) += fdt.o · line 42

Quoted 4 lines
arch/powerpc/cpu/mpc83xx/Makefile +2 -2
-ifdef CONFIG_FSL_DDR2
-obj-$(CONFIG_MPC8349) += ../mpc85xx/ddr-gen2.o
+ifdef CONFIG_SYS_FSL_DDR2
+obj-$(CONFIG_MPC8349) += $(SRCTREE)/drivers/ddr/fsl/mpc85xx_ddr_gen2.o

This Makefile is NG.
The object file, mpc85xx_ddr_gen2.o, is created under a strange path.

It has been this way. I am not saying it is good. Explained below.

Quoted 13 lines

Just build with O= and find out where this object is created.

$ rm -rf build/
$ make O=build MPC8349EMDS_config
Configuring for MPC8349EMDS board...
$ make O=build CROSS_COMPILE=powerpc-linux-
<<snip>>
$ find . -name mpc85xx_ddr_gen2.o
./build/arch/powerpc/cpu/mpc83xx/home/yamada/workspace/u-boot/drivers/ddr/fsl/mpc85xx_ddr_gen2.o
Quoted 5 lines

And it also looks weird to me.

Why did you put this code in arch/powerpc/cpu/mpc83xx/Makefie, not drivers/ddr/fsl/Makefile ?

I understand this looks weird. Most 83xx didn't use the same driver as 85xx SoCs do. Freescale DDR driver has two parts. One is the calculation. This can be shared by all families. The other, smaller, is the writing registers part. Each family has its own driver. You may have noticed one for 85xx, and one for 86xx. We could create one for 83xx. But till now, there is no other 83xx SoC uses it.

After this patch set, we have consolidated Freescale DDR drivers and header files into one set. It becomes more clear that we can and probably should merge this one as well. It's on my list to clean up, but this one has low priority.

Hope I explained it clearly.

York

#8 lore raw

PATCH v4 1/6 Driver/DDR: Moving Freescale DDR driver to a common driver

Hello York.

Quoted 11 lines
Quoted 5 lines

And it also looks weird to me.

Why did you put this code in arch/powerpc/cpu/mpc83xx/Makefie, not drivers/ddr/fsl/Makefile ?

I understand this looks weird. Most 83xx didn't use the same driver as 85xx SoCs do. Freescale DDR driver has two parts. One is the calculation. This can be shared by all families. The other, smaller, is the writing registers part. Each family has its own driver. You may have noticed one for 85xx, and one for 86xx. We could create one for 83xx. But till now, there is no other 83xx SoC uses it.

After this patch set, we have consolidated Freescale DDR drivers and header files into one set. It becomes more clear that we can and probably should merge this one as well. It's on my list to clean up, but this one has low priority.

Hope I explained it clearly.

OK.
This refactoring is up to you.
But, anyway, we can't use absolute paths for obj-y.

So, I posted a patch:
http://patchwork.ozlabs.org/patch/296086/

Best Regards
Masahiro Yamada

author
#9 lore raw

PATCH v4 1/6 Driver/DDR: Moving Freescale DDR driver to a common driver

Quoted 12 lines · Masahiro Yamada

Hello York.

Quoted 10 lines
Quoted 5 lines

And it also looks weird to me.

Why did you put this code in arch/powerpc/cpu/mpc83xx/Makefie, not drivers/ddr/fsl/Makefile ?

I understand this looks weird. Most 83xx didn't use the same driver as 85xx SoCs do. Freescale DDR driver has two parts. One is the calculation. This can be shared by all families. The other, smaller, is the writing registers part. Each family has its own driver. You may have noticed one for 85xx, and one for 86xx. We could create one for 83xx. But till now, there is no other 83xx SoC uses it.

After this patch set, we have consolidated Freescale DDR drivers and header files into one set. It becomes more clear that we can and probably should merge this one as well. It's on my list to clean up, but this one has low priority.

Quoted 8 lines
Quoted 1 line

Hope I explained it clearly.

OK.
This refactoring is up to you.
But, anyway, we can't use absolute paths for obj-y.

So, I posted a patch:
http://patchwork.ozlabs.org/patch/296086/

Thanks for the patch. I am not against either way. I noticed the path for out of tree compiling and I didn't see which one is better. I found examples of both. I personally think using $(SRCTREE) is cleaner. Let's wait for others to chime in.

York