
Dear Martha M Stan,
In message 12538848343158-git-send-email-mmarx@silicontkx.com you wrote:
Signed-off-by: Martha M Stan mmarx@silicontkx.com
cpu/mpc512x/fixed_sdram.c | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/cpu/mpc512x/fixed_sdram.c b/cpu/mpc512x/fixed_sdram.c index 673d61e..7617e31 100644 --- a/cpu/mpc512x/fixed_sdram.c +++ b/cpu/mpc512x/fixed_sdram.c @@ -26,13 +26,14 @@ #include <asm/mpc512x.h>
/*
- MDDRC Config Runtime Settings in order of the 4 MDDRC cfg registers
*/
- MDDRC Config Runtime Settings in MEMORY order of the 4 MDDRC cfg registers
u32 default_mddrc_config[4] = {
- CONFIG_SYS_MDDRC_SYS_CFG, /* sys_config */ CONFIG_SYS_MDDRC_TIME_CFG0, /* time_config0 */ CONFIG_SYS_MDDRC_TIME_CFG1, /* time_config1 */ CONFIG_SYS_MDDRC_TIME_CFG2, /* time_config2 */
- CONFIG_SYS_MDDRC_SYS_CFG, /* sys_config */
};
This is an array of u32.
u32 default_init_seq[] = { @@ -79,6 +80,7 @@ long int fixed_sdram(u32 *mddrc_config, u32 *dram_init_seq, int seq_sz) volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR; u32 msize = CONFIG_SYS_DDR_SIZE * 1024 * 1024; u32 msize_log2 = __ilog2(msize);
- struct ddr512x_t *ddr_cfg_4regs;
And this is (a pointer to) a struct with u32 entries.
- /* using struct's first 4 regs only */
- mddrc_4regs = (struct ddr512x_t *)mddrc_config;
What gives you the guarantee that the struct and the array use the same padding / alignment?
This is extremely bad style. If you want to use a struct, then please declare one, and refer to indivisual elements through their names. You could also turn default_mddrc_config into s "struct ddr512x_t" and just initialize the first 4 elements, but note that the memory footprint will go up significantly.
NAK for this code.
Best regards,
Wolfgang Denk