omap3: Consolidate SDRC related operations
PATCH v3 2/2 omap3: Consolidate SDRC related operations
From: Vaibhav Hiremath <[email protected]>
Consolidated SDRC related functions into one file - sdrc.c
And also replaced sdrc_init with generic memory init function (mem_init), this generalization of omap memory setup is necessary to support the new emif4 interface introduced in AM3517.
Changes from V2:
- Removed all instances of #ifdef CONFIG_SDRC
Changes from V1:
- Refreshed against latest denx/master
Signed-off-by Vaibhav Hiremath <[email protected]>
Signed-off-by Sanjeev Premi <[email protected]>
--- arch/arm/cpu/arm_cortexa8/omap3/Makefile | 4 +- arch/arm/cpu/arm_cortexa8/omap3/board.c | 35 +----- arch/arm/cpu/arm_cortexa8/omap3/mem.c | 90 ------------ arch/arm/cpu/arm_cortexa8/omap3/sdrc.c | 202 +++++++++++++++++++++++++++ arch/arm/cpu/arm_cortexa8/omap3/sys_info.c | 41 ------ arch/arm/include/asm/arch-omap3/cpu.h | 1 + arch/arm/include/asm/arch-omap3/mem.h | 13 ++ arch/arm/include/asm/arch-omap3/sys_proto.h | 2 - include/configs/devkit8000.h | 2 + include/configs/omap3_beagle.h | 2 + include/configs/omap3_evm.h | 2 + include/configs/omap3_overo.h | 2 + include/configs/omap3_pandora.h | 2 + include/configs/omap3_sdp3430.h | 2 + include/configs/omap3_zoom1.h | 2 + include/configs/omap3_zoom2.h | 2 + 16 files changed, 236 insertions(+), 168 deletions(-) create mode 100644 arch/arm/cpu/arm_cortexa8/omap3/sdrc.c
arch/arm/cpu/arm_cortexa8/omap3/Makefile +3 -1
@@ -37,8 +37,10 @@ COBJS += syslib.o COBJS += sys_info.o COBJS += timer.o +COBJS-$(CONFIG_SDRC) += sdrc.o + SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) +OBJS := $(addprefix $(obj),$(COBJS) $(COBJS-y) $(SOBJS)) all: $(obj).depend $(LIB)
arch/arm/cpu/arm_cortexa8/omap3/board.c +1 -34
@@ -40,8 +40,6 @@extern omap3_sysinfo sysinfo; -extern u32 is_mem_sdr (void ); -/****************************************************************************** * Routine: delay * Description: spinning delay to use before udelay works
@@ -233,7 +231,7 @@ void s_init(void)per_clocks_enable ();if (!in_sdram) -sdrc_init (); +mem_init (); }/******************************************************************************
@@ -274,37 +272,6 @@ void watchdog_init(void) }/****************************************************************************** -* Routine: dram_init -* Description: sets uboots idea of sdram size -*****************************************************************************/ -int dram_init (void ) -{ -DECLARE_GLOBAL_DATA_PTR ; -unsigned int size0 =0 , size1 =0 ; - - size0 =get_sdr_cs_size (CS0 ); - -/* -* If a second bank of DDR is attached to CS1 this is -* where it can be started. Early init code will init -* memory on CS0. -*/ -if ((sysinfo.mtype ==DDR_COMBO ) || (sysinfo.mtype ==DDR_STACKED )) { -do_sdrc_init (CS1 ,NOT_EARLY ); -make_cs1_contiguous (); - - size1 =get_sdr_cs_size (CS1 ); - } - - gd->bd->bi_dram[0 ].start =PHYS_SDRAM_1 ; - gd->bd->bi_dram[0 ].size = size0; - gd->bd->bi_dram[1 ].start =PHYS_SDRAM_1 +get_sdr_cs_offset (CS1 ); - gd->bd->bi_dram[1 ].size = size1; - -return 0 ; -} - -/****************************************************************************** * Dummy function to handle errors for EABI incompatibility *****************************************************************************/ void abort (void )
arch/arm/cpu/arm_cortexa8/omap3/mem.c +0 -90
102 lines not on this page · raw message
arch/arm/cpu/arm_cortexa8/omap3/sdrc.c new file +202 -0
202 lines not on this page · raw message
arch/arm/cpu/arm_cortexa8/omap3/sys_info.c +0 -41
53 lines not on this page · raw message
arch/arm/include/asm/arch-omap3/cpu.h +1 -0
@@ -215,6 +215,7 @@ struct sdrc {u8 res4[0xC ];struct sdrc_cs cs[2 ];/* 0x80 || 0xB0 */ }; +#endif /* __ASSEMBLY__ */ #endif /* __KERNEL_STRICT_NAMES */
arch/arm/include/asm/arch-omap3/mem.h +13 -0
@@ -270,4 +270,17 @@ enum {#define PISMO1_ONEN_BASE ONENAND_MAP#define DBG_MPDB_BASE DEBUG_BASE +#ifndef __ASSEMBLY__ + +/* Function prototypes */ +void mem_init (void ); + +u32 is_mem_sdr (void ); +u32 mem_ok (u32 cs); + +u32 get_sdr_cs_size (u32 ); +u32 get_sdr_cs_offset (u32 ); + +#endif /* __ASSEMBLY__ */ +#endif /* endif _MEM_H_ */
arch/arm/include/asm/arch-omap3/sys_proto.h +0 -2
@@ -46,8 +46,6 @@ u32 get_sysboot_value(void);u32 is_gpmc_muxed (void );u32 get_gpmc0_type (void );u32 get_gpmc0_width (void ); -u32 get_sdr_cs_size (u32 ); -u32 get_sdr_cs_offset (u32 );u32 is_running_in_sdram (void );u32 is_running_in_sram (void );u32 is_running_in_flash (void );
include/configs/devkit8000.h +2 -0
@@ -38,6 +38,8 @@#define CONFIG_OMAP3430 1/* which is in a 3430 */ #define CONFIG_OMAP3_DEVKIT8000 1/* working with DevKit8000 */ +#define CONFIG_SDRC /* The chip has SDRC controller */ +#include <asm/arch/cpu.h> /* get chip and board defs */ #include <asm/arch/omap3.h>
include/configs/omap3_beagle.h +2 -0
@@ -37,6 +37,8 @@#define CONFIG_OMAP3430 1/* which is in a 3430 */ #define CONFIG_OMAP3_BEAGLE 1/* working with BEAGLE */ +#define CONFIG_SDRC /* The chip has SDRC controller */ +#include <asm/arch/cpu.h> /* get chip and board defs */ #include <asm/arch/omap3.h>
include/configs/omap3_evm.h +2 -0
@@ -42,6 +42,8 @@#define CONFIG_OMAP3430 1/* which is in a 3430 */ #define CONFIG_OMAP3_EVM 1/* working with EVM */ +#define CONFIG_SDRC /* The chip has SDRC controller */ +#include <asm/arch/cpu.h> /* get chip and board defs */ #include <asm/arch/omap3.h>
include/configs/omap3_overo.h +2 -0
@@ -29,6 +29,8 @@#define CONFIG_OMAP3430 1/* which is in a 3430 */ #define CONFIG_OMAP3_OVERO 1/* working with overo */ +#define CONFIG_SDRC /* The chip has SDRC controller */ +#include <asm/arch/cpu.h> /* get chip and board defs */ #include <asm/arch/omap3.h>
include/configs/omap3_pandora.h +2 -0
@@ -32,6 +32,8 @@#define CONFIG_OMAP3430 1/* which is in a 3430 */ #define CONFIG_OMAP3_PANDORA 1/* working with pandora */ +#define CONFIG_SDRC /* The chip has SDRC controller */ +#include <asm/arch/cpu.h> /* get chip and board defs */ #include <asm/arch/omap3.h>
include/configs/omap3_sdp3430.h +2 -0
@@ -42,6 +42,8 @@#define CONFIG_OMAP3430 1/* which is in a 3430 */ #define CONFIG_OMAP3_3430SDP 1/* working with SDP Rev2 */ +#define CONFIG_SDRC /* The chip has SDRC controller */ +#include <asm/arch/cpu.h> /* get chip and board defs */ #include <asm/arch/omap3.h>
include/configs/omap3_zoom1.h +2 -0
@@ -38,6 +38,8 @@#define CONFIG_OMAP3430 1/* which is in a 3430 */ #define CONFIG_OMAP3_ZOOM1 1/* working with Zoom MDK Rev1 */ +#define CONFIG_SDRC /* The chip has SDRC controller */ +#include <asm/arch/cpu.h> /* get chip and board defs */ #include <asm/arch/omap3.h>
include/configs/omap3_zoom2.h +2 -0
@@ -39,6 +39,8 @@#define CONFIG_OMAP3430 1/* which is in a 3430 */ #define CONFIG_OMAP3_ZOOM2 1/* working with Zoom II */ +#define CONFIG_SDRC /* The chip has SDRC controller */ +#include <asm/arch/cpu.h> /* get chip and board defs */ #include <asm/arch/omap3.h>
--
1.6.2.4