: OMAP3 SPL updates
cover : OMAP3 SPL updates
Hey all,
The following short series does two things. First, it re-works where we do memory initalization in SPL for OMAP3 to be board-specific. This is needed since in many cases (beagleboard, omap3evm) what timings we set depend on what hardware we detect ourself to be running on. Second, along those same lines what omap_rev_string tells us is doing to be board specific as well so provide a weak version in the common omap SPL code and lets it be replaced as needed.
Signature · 1 line
Tom
PATCH 1/2 OMAP3 SPL: Rework memory initalization and devkit 8000 support
This changes to making the board be responsible for providing a memory initialization function for SPL and converts the existing function to provide these services for devkit 8000. As part of this suffix the Micron DDR settings with their speed.
--- arch/arm/cpu/armv7/omap3/sdrc.c | 46 +++++++++------------------ arch/arm/include/asm/arch-omap3/mem.h | 42 +++++-------------------- arch/arm/include/asm/arch-omap3/sys_proto.h | 1 + board/timll/devkit8000/devkit8000.c | 24 ++++++++++++++ 4 files changed, 48 insertions(+), 65 deletions(-)
arch/arm/cpu/armv7/omap3/sdrc.c +15 -31
@@ -111,13 +111,21 @@ u32 get_sdr_cs_offset(u32 cs)/* * do_sdrc_init - * - Initialize the SDRAM for use. -* - code called once in C-Stack only context for CS0 and a possible 2nd -* time depending on memory configuration from stack+global context +* - Code called once in C-Stack only context for CS0 and with early being +* true and a possible 2nd time depending on memory configuration from +* stack+global context. */ void do_sdrc_init (u32 cs,u32 early) { -struct sdrc_actim *sdrc_actim_base0, *sdrc_actim_base1; +struct sdrc_actim *sdrc_actim_base0 = (struct sdrc_actim *)SDRC_ACTIM_CTRL0_BASE ; +struct sdrc_actim *sdrc_actim_base1 = (struct sdrc_actim *)SDRC_ACTIM_CTRL1_BASE ; +/* +* When called in the early context this may be SPL and we will +* need to set all of the timings. This ends up being board +* specific so we call a helper function to take care of this +* for us. +*/ if (early) {/* reset sdrc controller */ writel (SOFTRESET , &sdrc_base->sysconfig);
@@ -128,40 +136,18 @@ void do_sdrc_init(u32 cs, u32 early)/* setup sdrc to ball mux */ writel (SDRC_SHARING , &sdrc_base->sharing); -/* Disable Power Down of CKE cuz of 1 CKE on combo part */ +/* Disable Power Down of CKE because of 1 CKE on combo part */ writel (WAKEUPPROC |SRFRONRESET |PAGEPOLICY_HIGH , &sdrc_base->power);writel (ENADLL |DLLPHASE_90 , &sdrc_base->dlla_ctrl);sdelay (0x20000 ); - } -/* As long as V_MCFG and V_RFR_CTRL is not defined for all OMAP3 boards we need -* to prevent this to be build in non-SPL build */ #ifdef CONFIG_SPL_BUILD -/* If we use a SPL there is no x-loader nor config header so we have -* to do the job ourselfs -*/ -if (cs ==CS0 ) { - sdrc_actim_base0 = (struct sdrc_actim *)SDRC_ACTIM_CTRL0_BASE ; - -/* General SDRC config */ -writel (V_MCFG , &sdrc_base->cs[cs].mcfg); -writel (V_RFR_CTRL , &sdrc_base->cs[cs].rfr_ctrl); - -/* AC timings */ -writel (V_ACTIMA_165 , &sdrc_actim_base0->ctrla); -writel (V_ACTIMB_165 , &sdrc_actim_base0->ctrlb); - -/* Initialize */ -writel (CMD_NOP , &sdrc_base->cs[cs].manual); -writel (CMD_PRECHARGE , &sdrc_base->cs[cs].manual); -writel (CMD_AUTOREFRESH , &sdrc_base->cs[cs].manual); -writel (CMD_AUTOREFRESH , &sdrc_base->cs[cs].manual); - -writel (V_MR , &sdrc_base->cs[cs].mr); - } +/* setup timings */ +board_early_sdrc_init (sdrc_base, sdrc_actim_base0);#endif + }/* * SDRC timings are set up by x-load or config header
@@ -170,8 +156,6 @@ void do_sdrc_init(u32 cs, u32 early)* configure CS1 to handle this ommission */ if (cs ==CS1 ) { - sdrc_actim_base0 = (struct sdrc_actim *)SDRC_ACTIM_CTRL0_BASE ; - sdrc_actim_base1 = (struct sdrc_actim *)SDRC_ACTIM_CTRL1_BASE ;writel (readl (&sdrc_base->cs[CS0 ].mcfg), &sdrc_base->cs[CS1 ].mcfg); writel(readl(&sdrc_base->cs[CS0].rfr_ctrl),
arch/arm/include/asm/arch-omap3/mem.h +8 -34
55 lines not on this page · raw message
arch/arm/include/asm/arch-omap3/sys_proto.h +1 -0
@@ -38,6 +38,7 @@ void per_clocks_enable(void);void memif_init (void );void sdrc_init (void );void do_sdrc_init (u32 ,u32 ); +void board_early_sdrc_init (struct sdrc *,struct sdrc_actim *);void emif4_init (void );void gpmc_init (void ); void enable_gpmc_cs_config(const u32 *gpmc_config, struct gpmc_cs *cs, u32 base,
board/timll/devkit8000/devkit8000.c +24 -0
@@ -138,3 +138,27 @@ int board_eth_init(bd_t *bis)return dm9000_initialize (bis); }#endif + +/* +* Routine: board_early_sdrc_init +* Description: If we use SPL then there is no x-loader nor config header +* so we have to setup the DDR timings outself on the first bank. +*/ +void board_early_sdrc_init (struct sdrc *sdrc_base,struct sdrc_actim *sdrc_actim_base0) +{ +/* General SDRC config */ +writel (MICRON_V_MCFG_165 , &sdrc_base->cs[CS0 ].mcfg); +writel (MICRON_V_RFR_CTRL_165 , &sdrc_base->cs[CS0 ].rfr_ctrl); + +/* AC timings */ +writel (MICRON_V_ACTIMA_165 , &sdrc_actim_base0->ctrla); +writel (MICRON_V_ACTIMB_165 , &sdrc_actim_base0->ctrlb); + +/* Initialize */ +writel (CMD_NOP , &sdrc_base->cs[CS0 ].manual); +writel (CMD_PRECHARGE , &sdrc_base->cs[CS0 ].manual); +writel (CMD_AUTOREFRESH , &sdrc_base->cs[CS0 ].manual); +writel (CMD_AUTOREFRESH , &sdrc_base->cs[CS0 ].manual); + +writel (MICRON_V_MR , &sdrc_base->cs[CS0 ].mr); +}
Signature · 1 line
1.7.0.4
PATCH 1/2 OMAP3 SPL: Rework memory initalization and devkit 8000 support
Dear Tom Rini,
Quoted 5 lines · In message <[email protected]> you wrote:
This changes to making the board be responsible for providing a memory initialization function for SPL and converts the existing function to provide these services for devkit 8000. As part of this suffix the Micron DDR settings with their speed.
Quoted 8 lines
Cc Frederik Kriewitz <[email protected]>Signed-off-by Tom Rini <[email protected]>--- arch/arm/cpu/armv7/omap3/sdrc.c | 46 +++++++++------------------ arch/arm/include/asm/arch-omap3/mem.h | 42 +++++-------------------- arch/arm/include/asm/arch-omap3/sys_proto.h | 1 + board/timll/devkit8000/devkit8000.c | 24 ++++++++++++++ 4 files changed, 48 insertions(+), 65 deletions(-)
Checkpatch says:
total: 0 errors, 4 warnings, 165 lines checked
Please clean up and resubmit. Thanks.
Best regards,
Wolfgang Denk
Signature · 8 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The manager will be continually amazed that policies he took for com-
mon knowledge are totally unknown by some member of his team. Since
his fundamental job is to keep everybody going in the same direction,
his chief daily task will be communication, not decision-making.
- Fred Brooks, "The Mythical Man Month"PATCH v2 1/1 OMAP3 SPL: Rework memory initalization and devkit 8000 support
This changes to making the board be responsible for providing a memory initialization function for SPL and converts the existing function to provide these services for devkit 8000. As part of this suffix the Micron DDR settings with their speed.
--- arch/arm/cpu/armv7/omap3/sdrc.c | 49 ++++++++++----------------- arch/arm/include/asm/arch-omap3/mem.h | 42 ++++------------------ arch/arm/include/asm/arch-omap3/sys_proto.h | 1 + board/timll/devkit8000/devkit8000.c | 25 ++++++++++++++ 4 files changed, 52 insertions(+), 65 deletions(-)
arch/arm/cpu/armv7/omap3/sdrc.c +18 -31
@@ -111,13 +111,24 @@ u32 get_sdr_cs_offset(u32 cs)/* * do_sdrc_init - * - Initialize the SDRAM for use. -* - code called once in C-Stack only context for CS0 and a possible 2nd -* time depending on memory configuration from stack+global context +* - Code called once in C-Stack only context for CS0 and with early being +* true and a possible 2nd time depending on memory configuration from +* stack+global context. */ void do_sdrc_init (u32 cs,u32 early) { -struct sdrc_actim *sdrc_actim_base0, *sdrc_actim_base1; +struct sdrc_actim *sdrc_actim_base0; +struct sdrc_actim *sdrc_actim_base1; + sdrc_actim_base0 = (struct sdrc_actim *)SDRC_ACTIM_CTRL0_BASE ; + sdrc_actim_base1 = (struct sdrc_actim *)SDRC_ACTIM_CTRL1_BASE ; + +/* +* When called in the early context this may be SPL and we will +* need to set all of the timings. This ends up being board +* specific so we call a helper function to take care of this +* for us. +*/ if (early) {/* reset sdrc controller */ writel (SOFTRESET , &sdrc_base->sysconfig);
@@ -128,40 +139,18 @@ void do_sdrc_init(u32 cs, u32 early)/* setup sdrc to ball mux */ writel (SDRC_SHARING , &sdrc_base->sharing); -/* Disable Power Down of CKE cuz of 1 CKE on combo part */ +/* Disable Power Down of CKE because of 1 CKE on combo part */ writel (WAKEUPPROC |SRFRONRESET |PAGEPOLICY_HIGH , &sdrc_base->power);writel (ENADLL |DLLPHASE_90 , &sdrc_base->dlla_ctrl);sdelay (0x20000 ); - } -/* As long as V_MCFG and V_RFR_CTRL is not defined for all OMAP3 boards we need -* to prevent this to be build in non-SPL build */ #ifdef CONFIG_SPL_BUILD -/* If we use a SPL there is no x-loader nor config header so we have -* to do the job ourselfs -*/ -if (cs ==CS0 ) { - sdrc_actim_base0 = (struct sdrc_actim *)SDRC_ACTIM_CTRL0_BASE ; - -/* General SDRC config */ -writel (V_MCFG , &sdrc_base->cs[cs].mcfg); -writel (V_RFR_CTRL , &sdrc_base->cs[cs].rfr_ctrl); - -/* AC timings */ -writel (V_ACTIMA_165 , &sdrc_actim_base0->ctrla); -writel (V_ACTIMB_165 , &sdrc_actim_base0->ctrlb); - -/* Initialize */ -writel (CMD_NOP , &sdrc_base->cs[cs].manual); -writel (CMD_PRECHARGE , &sdrc_base->cs[cs].manual); -writel (CMD_AUTOREFRESH , &sdrc_base->cs[cs].manual); -writel (CMD_AUTOREFRESH , &sdrc_base->cs[cs].manual); - -writel (V_MR , &sdrc_base->cs[cs].mr); - } +/* setup timings */ +board_early_sdrc_init (sdrc_base, sdrc_actim_base0);#endif + }/* * SDRC timings are set up by x-load or config header
@@ -170,8 +159,6 @@ void do_sdrc_init(u32 cs, u32 early)* configure CS1 to handle this ommission */ if (cs ==CS1 ) { - sdrc_actim_base0 = (struct sdrc_actim *)SDRC_ACTIM_CTRL0_BASE ; - sdrc_actim_base1 = (struct sdrc_actim *)SDRC_ACTIM_CTRL1_BASE ;writel (readl (&sdrc_base->cs[CS0 ].mcfg), &sdrc_base->cs[CS1 ].mcfg); writel(readl(&sdrc_base->cs[CS0].rfr_ctrl),
arch/arm/include/asm/arch-omap3/mem.h +8 -34
55 lines not on this page · raw message
arch/arm/include/asm/arch-omap3/sys_proto.h +1 -0
@@ -38,6 +38,7 @@ void per_clocks_enable(void);void memif_init (void );void sdrc_init (void );void do_sdrc_init (u32 ,u32 ); +void board_early_sdrc_init (struct sdrc *,struct sdrc_actim *);void emif4_init (void );void gpmc_init (void ); void enable_gpmc_cs_config(const u32 *gpmc_config, struct gpmc_cs *cs, u32 base,
board/timll/devkit8000/devkit8000.c +25 -0
@@ -138,3 +138,28 @@ int board_eth_init(bd_t *bis)return dm9000_initialize (bis); }#endif + +/* +* Routine: board_early_sdrc_init +* Description: If we use SPL then there is no x-loader nor config header +* so we have to setup the DDR timings outself on the first bank. +*/ +void board_early_sdrc_init (struct sdrc *sdrc_base,struct sdrc_actim + *sdrc_actim_base0) +{ +/* General SDRC config */ +writel (MICRON_V_MCFG_165 , &sdrc_base->cs[CS0 ].mcfg); +writel (MICRON_V_RFR_CTRL_165 , &sdrc_base->cs[CS0 ].rfr_ctrl); + +/* AC timings */ +writel (MICRON_V_ACTIMA_165 , &sdrc_actim_base0->ctrla); +writel (MICRON_V_ACTIMB_165 , &sdrc_actim_base0->ctrlb); + +/* Initialize */ +writel (CMD_NOP , &sdrc_base->cs[CS0 ].manual); +writel (CMD_PRECHARGE , &sdrc_base->cs[CS0 ].manual); +writel (CMD_AUTOREFRESH , &sdrc_base->cs[CS0 ].manual); +writel (CMD_AUTOREFRESH , &sdrc_base->cs[CS0 ].manual); + +writel (MICRON_V_MR , &sdrc_base->cs[CS0 ].mr); +}
Signature · 1 line
1.7.0.4
PATCH 2/2 OMAP3 SPL: Provide weak omap_rev_string
In reply to Tom RiniWe add an weak version of omap_rev_string in omap-common/spl.c and while at it drop the omap3 version. Move the prototype over to <asm/omap_common.h> with the other SPL functions.
--- arch/arm/cpu/armv7/omap-common/spl.c | 8 ++++++++ arch/arm/cpu/armv7/omap3/board.c | 6 ------ arch/arm/include/asm/arch-omap3/sys_proto.h | 1 - arch/arm/include/asm/arch-omap4/sys_proto.h | 1 - arch/arm/include/asm/omap_common.h | 1 + 5 files changed, 9 insertions(+), 8 deletions(-)
arch/arm/cpu/armv7/omap-common/spl.c +8 -0
@@ -161,3 +161,11 @@ void preloader_console_init(void)omap_rev_string (rev_string_buffer);printf ("Texas Instruments %s\n" , rev_string_buffer); } + +void __omap_rev_string (char *str) +{ +sprintf (str,"Revision detection unimplemented" ); +} + +void omap_rev_string (char *str) + __attribute__((weak,alias ("__omap_rev_string" )));
arch/arm/cpu/armv7/omap3/board.c +0 -6
@@ -450,9 +450,3 @@ void enable_caches(void) dcache_enable(); }#endif - -void omap_rev_string (char *omap_rev_string) -{ -sprintf (omap_rev_string,"OMAP3, sorry revision detection" \ -" unimplemented" ); -}
arch/arm/include/asm/arch-omap3/sys_proto.h +0 -1
@@ -72,5 +72,4 @@ void power_init_r(void);void dieid_num_r (void );void do_omap3_emu_romcode_call (u32 service_id,u32 parameters);void omap3_gp_romcode_call (u32 service_id,u32 parameter); -void omap_rev_string (char *omap_rev_string);#endif
arch/arm/include/asm/arch-omap4/sys_proto.h +0 -1
@@ -43,7 +43,6 @@ void sr32(void *, u32, u32, u32);u32 wait_on_value (u32 ,u32 ,void *,u32 );void sdelay (unsigned long );void set_pl310_ctrl_reg (u32 val); -void omap_rev_string (char *omap4_rev_string);void setup_clocks_for_console (void );void prcm_init (void );void bypass_dpll (u32 *const base);
arch/arm/include/asm/omap_common.h +1 -0
@@ -77,6 +77,7 @@ u32 omap_boot_mode(void);/* SPL common function s*/ void spl_parse_image_header (const struct image_header *header); +void omap_rev_string (char *omap_rev_string);/* NAND SPL functions */ void spl_nand_load_image (void );
Signature · 1 line
1.7.0.4
cover : OMAP3 SPL updates
In reply to Tom RiniQuoted 9 lines · Tom Rini
Hey all,
The following short series does two things. ?First, it re-works where we do memory initalization in SPL for OMAP3 to be board-specific. This is needed since in many cases (beagleboard, omap3evm) what timings we set depend on what hardware we detect ourself to be running on. ?Second, along those same lines what
omap_rev_stringtells us is doing to be board specific as well so provide a weak version in the common omap SPL code and lets it be replaced as needed.
Please disregard this version, I need to do a full v3 with the right set of board_early_sdrc_init, sorry for the noise.
Signature · 1 line
Tom
cover : OMAP3 SPL updates
Quoted 11 lines · Tom Rini
Quoted 9 lines · Tom Rini
Hey all,
The following short series does two things. First, it re-works where we do memory initalization in SPL for OMAP3 to be board-specific. This is needed since in many cases (beagleboard, omap3evm) what timings we set depend on what hardware we detect ourself to be running on. Second, along those same lines what
omap_rev_stringtells us is doing to be board specific as well so provide a weak version in the common omap SPL code and lets it be replaced as needed.
Quoted 2 lines
Please disregard this version, I need to do a full v3 with the right set of
board_early_sdrc_init, sorry for the noise.
While I was looking at the series, I've got similar thoughts. May be this should be facilitated by providing kind of framework for the board file only to set the right settings and not duplicate the board_early_sdrc_init() function (with changed values)?
Signature · 2 lines
Regards, Igor.
cover : OMAP3 SPL updates
Quoted 12 lines · Igor Grinberg
Quoted 11 lines · Tom Rini
Quoted 9 lines · Tom Rini
Hey all,
The following short series does two things. ?First, it re-works where we do memory initalization in SPL for OMAP3 to be board-specific. This is needed since in many cases (beagleboard, omap3evm) what timings we set depend on what hardware we detect ourself to be running on. ?Second, along those same lines what
omap_rev_stringtells us is doing to be board specific as well so provide a weak version in the common omap SPL code and lets it be replaced as needed.
Quoted 7 lines
Quoted 2 lines
Please disregard this version, I need to do a full v3 with the right set of
board_early_sdrc_init, sorry for the noise.While I was looking at the series, I've got similar thoughts. May be this should be facilitated by providing kind of framework for the board file only to set the right settings and not duplicate the
board_early_sdrc_init()function (with changed values)?
The problem is that what to do is very board specific. For example for beagleboard we need to probe the nand driver to see what package we have and then pick from at least 3, maybe 4 or 5 (I don't have the code in front of me) settings. That said, perhaps a function that takes the series of values that do change would be a little clearer in the end so I'll give that a spin once I've gotten beagle and omap3evm spun up again (and maybe finally gotten NAND SPL working there, it seems to be an omap3-specific issue sadly).
Signature · 1 line
Tom
cover : OMAP3 SPL updates
Hi Tom,
Quoted 21 lines · Tom Rini
Quoted 12 lines · Igor Grinberg
Quoted 11 lines · Tom Rini
Quoted 9 lines · Tom Rini
Hey all,
The following short series does two things. First, it re-works where we do memory initalization in SPL for OMAP3 to be board-specific. This is needed since in many cases (beagleboard, omap3evm) what timings we set depend on what hardware we detect ourself to be running on. Second, along those same lines what
omap_rev_stringtells us is doing to be board specific as well so provide a weak version in the common omap SPL code and lets it be replaced as needed.Quoted 7 lines
Quoted 2 lines
Please disregard this version, I need to do a full v3 with the right set of
board_early_sdrc_init, sorry for the noise.While I was looking at the series, I've got similar thoughts. May be this should be facilitated by providing kind of framework for the board file only to set the right settings and not duplicate the
board_early_sdrc_init()function (with changed values)?
Quoted 4 lines
The problem is that what to do is very board specific. For example for beagleboard we need to probe the nand driver to see what package we have and then pick from at least 3, maybe 4 or 5 (I don't have the code in front of me) settings.
This only means that the framework (or just a common function call) should be flexible enough to let the board choose the right configuration in runtime.
After all the DRAM controller should be initialized by the same sequence just with different values.
Quoted 5 lines
That said, perhaps a function that
takes the series of values that do change would be a little clearer in the end so I'll give that a spin once I've gotten beagle and omap3evm spun up again (and maybe finally gotten NAND SPL working there, it seems to be an omap3-specific issue sadly).
How about a something like board_get_dram_params() (defined weak) implemented by a board file and a call added to current DRAM controller initialization sequence?
Signature · 2 lines
Regards, Igor.