mx23: Make DDR initialization stable
Subsystems (2)
Fabio Estevam
reviewercover mx23: Make DDR initialization stable
Prior to this series running 'memtester' utility in Linux on a mx23evk always resulted in many errors during stress testing, if the kernel is loaded via U-boot.
Running the same test and loading the kernel via FSL bootlets resulted on zero errors.
Adjust U-boot so that it can also pass the 'memtester' stress test.
After this series was applied, no more DDR errors were observed on a mx23evk.
Fabio Estevam
reviewerPATCH 1/9 mxs: Make the names of the elements of mxs_pinctrl_regs shorter
From: Fabio Estevam <[email protected]>
Currently when accessing an element of mxs_pinctrl_regs structure we do:
&pinctrl_regs->hw_pinctrl_emi_ds_ctrl_set
The 'hw_pinctrl' prefix is a redundant information as we already know that we are accessing a pinctrl register.
--- arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 2 +- arch/arm/include/asm/arch-mxs/regs-pinctrl.h | 168 +++++++++++++------------- 2 files changed, 85 insertions(+), 85 deletions(-)
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +1 -1
@@ -294,7 +294,7 @@ static void mx28_mem_init(void)/* Set DDR2 mode */ writel (PINCTRL_EMI_DS_CTRL_DDR_MODE_DDR2 , - &pinctrl_regs->hw_pinctrl_emi_ds_ctrl_set); + &pinctrl_regs->emi_ds_ctrl_set);/* * Configure the DRAM registers
arch/arm/include/asm/arch-mxs/regs-pinctrl.h +84 -84
213 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 1/9 mxs: Make the names of the elements of mxs_pinctrl_regs shorter
Dear Fabio Estevam,
Quoted 10 lines
From: Fabio Estevam <[email protected]>
Currently when accessing an element of
mxs_pinctrl_regsstructure we do:
&pinctrl_regs->hw_pinctrl_emi_ds_ctrl_setThe '
hw_pinctrl' prefix is a redundant information as we already know that we are accessing a pinctrl register.Signed-off-by Fabio Estevam <[email protected]>
Now this single file is inconsistent with the rest of the register header files.
Best regards,
Marek Vasut
Fabio Estevam
reviewerPATCH 1/9 mxs: Make the names of the elements of mxs_pinctrl_regs shorter
Quoted 6 lines · Marek Vasut
Dear Fabio Estevam,
Quoted 4 lines
From: Fabio Estevam <[email protected]>
Currently when accessing an element of
mxs_pinctrl_regsstructure we do:
Quoted 8 lines
Quoted 6 lines
&pinctrl_regs->hw_pinctrl_emi_ds_ctrl_setThe '
hw_pinctrl' prefix is a redundant information as we already know that we are accessing a pinctrl register.Signed-off-by Fabio Estevam <[email protected]>Now this single file is inconsistent with the rest of the register header files.
I can change the other header files as well.
PATCH 1/9 mxs: Make the names of the elements of mxs_pinctrl_regs shorter
Dear Fabio Estevam,
Quoted 12 lines · Marek Vasut
Quoted 11 lines
Dear Fabio Estevam,
Quoted 9 lines
From: Fabio Estevam <[email protected]>
Currently when accessing an element of
mxs_pinctrl_regsstructure we do:
&pinctrl_regs->hw_pinctrl_emi_ds_ctrl_setThe '
hw_pinctrl' prefix is a redundant information as we already know that we are accessing a pinctrl register.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Fabio Estevam <[email protected]>Now this single file is inconsistent with the rest of the register header files.
I can change the other header files as well.
Yes, but a separate patchset can do that. Let's keep it consistent please.
Best regards,
Marek Vasut
Fabio Estevam
reviewerPATCH 2/9 mx23: regs-pinctrl.h: Add pinctrl support for mx23
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
Provide a mxs_pinctrl_regs structure for mx23.
--- arch/arm/include/asm/arch-mxs/regs-pinctrl.h | 68 ++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
arch/arm/include/asm/arch-mxs/regs-pinctrl.h +68 -0
@@ -29,6 +29,7 @@#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ +#if defined(CONFIG_MX28) struct mxs_pinctrl_regs { mxs_reg_32(ctrl) /* 0x0 */
@@ -154,6 +155,73 @@ struct mxs_pinctrl_regs {mxs_reg_32 (emi_ds_ctrl)/* 0x1b80 */ }; +#elif defined(CONFIG_MX23 ) +struct mxs_pinctrl_regs { +mxs_reg_32 (ctrl)/* 0x0 */ + int reserved1[0x3c]; +mxs_reg_32 (muxsel0)/* 0x100 */ + mxs_reg_32(muxsel1) /* 0x110 */ +mxs_reg_32 (muxsel2)/* 0x120 */ + mxs_reg_32(muxsel3) /* 0x130 */ +mxs_reg_32 (muxsel4)/* 0x140 */ + mxs_reg_32(muxsel5) /* 0x150 */ +mxs_reg_32 (muxsel6)/* 0x160 */ + mxs_reg_32(muxsel7) /* 0x170 */ +int reserved2[0x20 ]; +mxs_reg_32 (drive0)/* 0x200 */ + mxs_reg_32(drive1) /* 0x210 */ +mxs_reg_32 (drive2)/* 0x220 */ + mxs_reg_32(drive3) /* 0x230 */ +mxs_reg_32 (drive4)/* 0x240 */ + mxs_reg_32(drive5) /* 0x250 */ +mxs_reg_32 (drive6)/* 0x260 */ + mxs_reg_32(drive7) /* 0x270 */ +mxs_reg_32 (drive8)/* 0x280 */ + mxs_reg_32(drive9) /* 0x290 */ +mxs_reg_32 (drive10)/* 0x2a0 */ + mxs_reg_32(drive11) /* 0x2b0 */ +mxs_reg_32 (drive12)/* 0x2c0 */ + mxs_reg_32(drive13) /* 0x2d0 */ +mxs_reg_32 (drive14)/* 0x2e0 */ + int reserved3[0x44]; +mxs_reg_32 (pull0)/* 0x400 */ + mxs_reg_32(pull1) /* 0x410 */ +mxs_reg_32 (pull2)/* 0x420 */ + mxs_reg_32(pull3) /* 0x430 */ +int reserved4[0x30 ]; +mxs_reg_32 (dout0)/* 0x500 */ + mxs_reg_32(dout1) /* 0x510 */ +mxs_reg_32 (dout2)/* 0x520 */ + int reserved5[0x34]; +mxs_reg_32 (din0)/* 0x600 */ + mxs_reg_32(din1) /* 0x610 */ +mxs_reg_32 (din2)/* 0x620 */ + int reserved6[0x34]; +mxs_reg_32 (doe0)/* 0x700 */ + mxs_reg_32(doe1) /* 0x710 */ +mxs_reg_32 (doe2)/* 0x720 */ + int reserved7[0x34]; +mxs_reg_32 (pin2irq0)/* 0x800 */ + mxs_reg_32(pin2irq1) /* 0x810 */ +mxs_reg_32 (pin2irq2)/* 0x820 */ + int reserved8[0x34]; +mxs_reg_32 (irqen0)/* 0x900 */ + mxs_reg_32(irqen1) /* 0x910 */ +mxs_reg_32 (irqen2)/* 0x920 */ + int reserved9[0x34]; +mxs_reg_32 (irqlevel0)/* 0xa00 */ + mxs_reg_32(irqlevel1) /* 0xa10 */ +mxs_reg_32 (irqlevel2)/* 0xa20 */ + int reserved10[0x34]; +mxs_reg_32 (irqpol0)/* 0xb00 */ + mxs_reg_32(irqpol1) /* 0xb10 */ +mxs_reg_32 (irqpol2)/* 0xb20 */ + int reserved11[0x34]; +mxs_reg_32 (irqstat0)/* 0xc00 */ + mxs_reg_32(irqstat1) /* 0xc10 */ + mxs_reg_32(irqstat2) /* 0xc20 */ +}; +#endif #endif #define PINCTRL_CTRL_SFTRST (1 << 31)
Signature · 1 line
1.7.9.5
PATCH 2/9 mx23: regs-pinctrl.h: Add pinctrl support for mx23
Dear Fabio Estevam,
Quoted 5 lines
From: Fabio Estevam <[email protected]>
Provide a
mxs_pinctrl_regsstructure for mx23.Signed-off-by Fabio Estevam <[email protected]>
So the pinctrl structure was always wrong on mx23? Otavio?
Best regards,
Marek Vasut
Fabio Estevam
reviewerPATCH 2/9 mx23: regs-pinctrl.h: Add pinctrl support for mx23
Quoted 9 lines · Marek Vasut
Dear Fabio Estevam,
Quoted 5 lines
From: Fabio Estevam <[email protected]>
Provide a
mxs_pinctrl_regsstructure for mx23.Signed-off-by Fabio Estevam <[email protected]>So the pinctrl structure was always wrong on mx23? Otavio?
pinctrl structure was never used on mx23 in U-boot.
PATCH 2/9 mx23: regs-pinctrl.h: Add pinctrl support for mx23
Dear Fabio Estevam,
Quoted 5 lines · Marek Vasut
Quoted 4 lines
Dear Fabio Estevam,
Quoted 2 lines
From: Fabio Estevam <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Provide a
mxs_pinctrl_regsstructure for mx23.Signed-off-by Fabio Estevam <[email protected]>So the pinctrl structure was always wrong on mx23? Otavio?
pinctrl structure was never used on mx23 in U-boot.
How come? Doesn't the board/...mx23.../spl_boot.c use that? Or iomux.c in FSL's parlance.
Best regards,
Marek Vasut
Fabio Estevam
reviewerPATCH 2/9 mx23: regs-pinctrl.h: Add pinctrl support for mx23
Quoted 2 lines · Marek Vasut
How come? Doesn't the
board/...mx23.../spl_boot.cuse that? Oriomux.cin FSL's parlance.
I meant mxs_pinctrl_regs structure is only referenced for mx28 currently:
#ifdef CONFIG_MX28
static void mx28_mem_init(void)
{
struct mxs_pinctrl_regs *pinctrl_regs =
(struct mxs_pinctrl_regs *)MXS_PINCTRL_BASE;
/* Set DDR2 mode */
writel(PINCTRL_EMI_DS_CTRL_DDR_MODE_DDR2,
&pinctrl_regs->hw_pinctrl_emi_ds_ctrl_set);PATCH 2/9 mx23: regs-pinctrl.h: Add pinctrl support for mx23
Dear Fabio Estevam,
Quoted 8 lines · Marek Vasut
Quoted 2 lines
How come? Doesn't the
board/...mx23.../spl_boot.cuse that? Oriomux.cin FSL's parlance.I meant
mxs_pinctrl_regsstructure is only referenced for mx28 currently:#ifdef
CONFIG_MX28
static voidmx28_mem_init(void)
Quoted 7 lines
{
struct mxs_pinctrl_regs *pinctrl_regs =
(struct mxs_pinctrl_regs *)MXS_PINCTRL_BASE;
/* Set DDR2 mode */
writel(PINCTRL_EMI_DS_CTRL_DDR_MODE_DDR2,
&pinctrl_regs->hw_pinctrl_emi_ds_ctrl_set);Ah! Good point, sorry for the prodding then.
Best regards,
Marek Vasut
Fabio Estevam
reviewerPATCH 3/9 mx23evk: Fix DDR pin iomux settings
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
Registers HW_PINCTRL_DRIVE9, HW_PINCTRL_DRIVE10, HW_PINCTRL_DRIVE11, HW_PINCTRL_DRIVE12, HW_PINCTRL_DRIVE13 and HW_PINCTRL_DRIVE14 control the drive strength and the voltage selection for the DDR pins.
The reset values of the voltage selection pins are '1', which is marked as 'reserved' in the mx23 reference manual.
Clear these bits for proper operation of DDR.
Also change MUX_CONFIG_EMI, which results in better stability and match the bootlets code from Freescale.
--- board/freescale/mx23evk/spl_boot.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
board/freescale/mx23evk/spl_boot.c +11 -1
@@ -26,7 +26,7 @@#include <asm/arch/sys_proto.h> #define MUX_CONFIG_SSP1 (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP) -#define MUX_CONFIG_EMI (MXS_PAD_3V3 | MXS_PAD_16MA | MXS_PAD_PULLUP) +#define MUX_CONFIG_EMI MXS_PAD_12MAconst iomux_cfg_t iomux_setup[] = {/* DUART */
@@ -110,5 +110,15 @@ void mxs_adjust_memory_params(uint32_t *dram_vals)void board_init_ll (void ) { +struct mxs_pinctrl_regs *pinctrl = + (struct mxs_pinctrl_regs *)MXS_PINCTRL_BASE ; +/* Clear the voltage bits for EMI pins as the reset value is invalid */ +writel (0 , &pinctrl->drive9); +writel (0 , &pinctrl->drive10); +writel (0 , &pinctrl->drive11); +writel (0 , &pinctrl->drive12); +writel (0 , &pinctrl->drive13); +writel (0 , &pinctrl->drive14); +writel (0 , &pinctrl->drive9);mxs_common_spl_init (iomux_setup,ARRAY_SIZE (iomux_setup)); }
Signature · 1 line
1.7.9.5
PATCH 3/9 mx23evk: Fix DDR pin iomux settings
Dear Fabio Estevam,
Quoted 9 lines
From: Fabio Estevam <[email protected]>
Registers
HW_PINCTRL_DRIVE9,HW_PINCTRL_DRIVE10,HW_PINCTRL_DRIVE11,HW_PINCTRL_DRIVE12,HW_PINCTRL_DRIVE13andHW_PINCTRL_DRIVE14control the drive strength and the voltage selection for the DDR pins.The reset values of the voltage selection pins are '1', which is marked as 'reserved' in the mx23 reference manual.
Quoted 6 lines
Clear these bits for proper operation of DDR.
Also change
MUX_CONFIG_EMI, which results in better stability and match the bootlets code from Freescale.Signed-off-by Fabio Estevam <[email protected]>
Uh, should the pinctrl/iomux stuff not set these up properly?
Quoted 23 lines
--- board/freescale/mx23evk/spl_boot.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/board/freescale/mx23evk/spl_boot.cindex b6f4e7e..035a29c 100644board/freescale/mx23evk/spl_boot.c +3
-1@@ -26,7 +26,7 @@#include <asm/arch/sys_proto.h> #define MUX_CONFIG_SSP1 (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP) -#define MUX_CONFIG_EMI (MXS_PAD_3V3 | MXS_PAD_16MA | MXS_PAD_PULLUP) +#define MUX_CONFIG_EMI MXS_PAD_12MAconst iomux_cfg_t iomux_setup[] = {/* DUART */ @@ -110,5 +110,15 @@ void mxs_adjust_memory_params(uint32_t *dram_vals)void board_init_ll (void ) { +struct mxs_pinctrl_regs *pinctrl = + (struct mxs_pinctrl_regs *)MXS_PINCTRL_BASE ;
board/freescale/mx23evk/spl_boot.c void mxs_adjust_memory_params(uint32_t *dram_vals) · line 124
Quoted 10 lines
board/freescale/mx23evk/spl_boot.c +8
-0+/* Clear the voltage bits for EMI pins as the reset value is invalid */ +writel (0 , &pinctrl->drive9); +writel (0 , &pinctrl->drive10); +writel (0 , &pinctrl->drive11); +writel (0 , &pinctrl->drive12); +writel (0 , &pinctrl->drive13); +writel (0 , &pinctrl->drive14); +writel (0 , &pinctrl->drive9);mxs_common_spl_init (iomux_setup,ARRAY_SIZE (iomux_setup)); }
Best regards,
Marek Vasut
Fabio Estevam
reviewerPATCH 3/9 mx23evk: Fix DDR pin iomux settings
Quoted 1 line · Marek Vasut
Uh, should the pinctrl/iomux stuff not set these up properly?
This is mx23 and EMI pins specific, so I think it is OK to do it in the board file.
PATCH 3/9 mx23evk: Fix DDR pin iomux settings
Dear Fabio Estevam,
Quoted 5 lines · Marek Vasut
Quoted 1 line
Uh, should the pinctrl/iomux stuff not set these up properly?
This is mx23 and EMI pins specific, so I think it is OK to do it in the board file.
Yes, but should the iomux_setup[] configure that already?
Best regards,
Marek Vasut
Fabio Estevam
reviewerPATCH 4/9 mx23_olinuxino: Fix DDR pin iomux settings
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
Registers HW_PINCTRL_DRIVE9, HW_PINCTRL_DRIVE10, HW_PINCTRL_DRIVE11, HW_PINCTRL_DRIVE12, HW_PINCTRL_DRIVE13 and HW_PINCTRL_DRIVE14 control the drive strength and the voltage selection for the DDR pins.
The reset values of the voltage selection pins are '1', which is marked as 'reserved' in the mx23 reference manual.
Clear these bits for proper operation of DDR.
Also change MUX_CONFIG_EMI, which results in better stability and match the bootlets code from Freescale.
--- board/olimex/mx23_olinuxino/spl_boot.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
board/olimex/mx23_olinuxino/spl_boot.c +12 -1
@@ -30,7 +30,7 @@#include <asm/arch/sys_proto.h> #define MUX_CONFIG_EMI (MXS_PAD_3V3 | MXS_PAD_16MA | MXS_PAD_PULLUP) -#define MUX_CONFIG_SSP (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP) +#define MUX_CONFIG_SSP MXS_PAD_12MAconst iomux_cfg_t iomux_setup[] = {/* DUART */
@@ -103,5 +103,16 @@ const iomux_cfg_t iomux_setup[] = {void board_init_ll (void ) { +struct mxs_pinctrl_regs *pinctrl = + (struct mxs_pinctrl_regs *)MXS_PINCTRL_BASE ; + +/* Clear the voltage bits for EMI pins as the reset value is invalid */ +writel (0 , &pinctrl->drive9); +writel (0 , &pinctrl->drive10); +writel (0 , &pinctrl->drive11); +writel (0 , &pinctrl->drive12); +writel (0 , &pinctrl->drive13); +writel (0 , &pinctrl->drive14); +writel (0 , &pinctrl->drive9);mxs_common_spl_init (iomux_setup,ARRAY_SIZE (iomux_setup)); }
Signature · 1 line
1.7.9.5
PATCH 4/9 mx23_olinuxino: Fix DDR pin iomux settings
Dear Fabio Estevam,
Quoted 9 lines
From: Fabio Estevam <[email protected]>
Registers
HW_PINCTRL_DRIVE9,HW_PINCTRL_DRIVE10,HW_PINCTRL_DRIVE11,HW_PINCTRL_DRIVE12,HW_PINCTRL_DRIVE13andHW_PINCTRL_DRIVE14control the drive strength and the voltage selection for the DDR pins.The reset values of the voltage selection pins are '1', which is marked as 'reserved' in the mx23 reference manual.
Quoted 6 lines
Clear these bits for proper operation of DDR.
Also change
MUX_CONFIG_EMI, which results in better stability and match the bootlets code from Freescale.Signed-off-by Fabio Estevam <[email protected]>
Lost of duplicated code here.
Best regards,
Marek Vasut
Fabio Estevam
reviewerPATCH 4/9 mx23_olinuxino: Fix DDR pin iomux settings
Quoted 1 line · Marek Vasut
Lost of duplicated code here.
What do you suggest?
PATCH 4/9 mx23_olinuxino: Fix DDR pin iomux settings
Dear Fabio Estevam,
Quoted 4 lines · Marek Vasut
Quoted 1 line
Lost of duplicated code here.
What do you suggest?
Stuff it into common init sequence, but only if it really is necessary to wipe those registers and iomux_setup[] table doesn't do it for some reason.
But then, if iomux_setup[] table doesn't configure them, there's a deeper problem.
Best regards,
Marek Vasut
Fabio Estevam
reviewerPATCH 4/9 mx23_olinuxino: Fix DDR pin iomux settings
Quoted 5 lines · Marek Vasut
Stuff it into common init sequence, but only if it really is necessary to wipe those registers and iomux_setup[] table doesn't do it for some reason.
But then, if iomux_setup[] table doesn't configure them, there's a deeper problem.
Right, I managed to fix this as you suggested (via iomux_setup).
Will send it in v2.
Thanks for reviewing it.
Fabio Estevam
reviewerPATCH 5/9 mx23evk: Disable the internal pad keepers
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
Disable the internal pad keepers to match the code from FSL bootlets and provide better stability.
--- board/freescale/mx23evk/spl_boot.c | 4 ++++ 1 file changed, 4 insertions(+)
board/freescale/mx23evk/spl_boot.c +4 -0
@@ -120,5 +120,9 @@ void board_init_ll(void)writel (0 , &pinctrl->drive13);writel (0 , &pinctrl->drive14);writel (0 , &pinctrl->drive9); + +/* Disable the internal pad keepers */ +writel (0x3ffff , &pinctrl->pull3); +mxs_common_spl_init (iomux_setup,ARRAY_SIZE (iomux_setup)); }
Signature · 1 line
1.7.9.5
Fabio Estevam
reviewerPATCH 6/9 mx23_olinuxino: Disable the internal pad keepers
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
Disable the internal pad keepers to match the code from FSL bootlets and provide better stability.
--- board/olimex/mx23_olinuxino/spl_boot.c | 4 ++++ 1 file changed, 4 insertions(+)
board/olimex/mx23_olinuxino/spl_boot.c +4 -0
@@ -114,5 +114,9 @@ void board_init_ll(void)writel (0 , &pinctrl->drive13);writel (0 , &pinctrl->drive14);writel (0 , &pinctrl->drive9); + +/* Disable the internal pad keepers */ +writel (0x3ffff , &pinctrl->pull3); +mxs_common_spl_init (iomux_setup,ARRAY_SIZE (iomux_setup)); }
Signature · 1 line
1.7.9.5
Fabio Estevam
reviewerPATCH 7/9 mxs: spl_mem_init: Remove unneeded DRAM configurations
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
There is no need to write to DRAM_CTL8 register prior to nitialize_dram_values().
Fix a comment related to writing to DRAM_CTL8.
Also, DRAM_CTL18 register on mx23 does not contain DRAM init complete bit, so remove this setting as this is also not done by FSL bootlets code.
--- arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +1 -8
@@ -262,12 +262,9 @@ static void mx23_mem_init(void)* Configure the DRAM registers */ -/* Clear START and SREFRESH bit from DRAM_CTL8 */ -clrbits_le32 (MXS_DRAM_BASE +0x20 , (1 <<16 ) | (1 <<8 )); -initialize_dram_values (); -/* Set START bit in DRAM_CTL16 */ +/* Set START bit in DRAM_CTL8 */ setbits_le32 (MXS_DRAM_BASE +0x20 ,1 <<16 );clrbits_le32 (MXS_DRAM_BASE +0x40 ,1 <<17 );
@@ -279,10 +276,6 @@ static void mx23_mem_init(void)setbits_le32 (MXS_DRAM_BASE +0x40 ,1 <<19 ); setbits_le32(MXS_DRAM_BASE + 0x40, 1 << 11); - -/* Wait for bit 10 (DRAM init complete) in DRAM_CTL18 */ -while (!(readl (MXS_DRAM_BASE +0x48 ) & (1 <<10 ))) - ; }#endif
Signature · 1 line
1.7.9.5
PATCH 7/9 mxs: spl_mem_init: Remove unneeded DRAM configurations
Dear Fabio Estevam,
Quoted 20 lines
From: Fabio Estevam <[email protected]>
There is no need to write to
DRAM_CTL8register prior tonitialize_dram_values().Fix a comment related to writing to
DRAM_CTL8.Also,
DRAM_CTL18register on mx23 does not contain DRAM init complete bit, so remove this setting as this is also not done by FSL bootlets code.Signed-off-by Fabio Estevam <[email protected]>--- arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)(quoted diff) +0
-0
b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.cindex 1c509d6..cde883d 100644
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c static void mx23_mem_init(void) · line 267
Quoted 6 lines
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +0
-3@@ -262,12 +262,9 @@ static void mx23_mem_init(void)* Configure the DRAM registers */ -/* Clear START and SREFRESH bit from DRAM_CTL8 */ -clrbits_le32 (MXS_DRAM_BASE +0x20 , (1 <<16 ) | (1 <<8 )); -
Do you not need to stop the DRAM if it's already running? Like after a software reset?
Quoted 8 lines
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +1
-1initialize_dram_values (); -/* Set START bit in DRAM_CTL16 */ +/* Set START bit in DRAM_CTL8 */ setbits_le32 (MXS_DRAM_BASE +0x20 ,1 <<16 );clrbits_le32 (MXS_DRAM_BASE +0x40 ,1 <<17 );
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c static void mx23_mem_init(void) · line 280
Quoted 9 lines
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +0
-4@@ -279,10 +276,6 @@ static void mx23_mem_init(void)setbits_le32 (MXS_DRAM_BASE +0x40 ,1 <<19 ); setbits_le32(MXS_DRAM_BASE + 0x40, 1 << 11); - -/* Wait for bit 10 (DRAM init complete) in DRAM_CTL18 */ -while (!(readl (MXS_DRAM_BASE +0x48 ) & (1 <<10 ))) - ; }#endif
Best regards,
Marek Vasut
Fabio Estevam
reviewerPATCH 7/9 mxs: spl_mem_init: Remove unneeded DRAM configurations
Quoted 2 lines · Marek Vasut
Do you not need to stop the DRAM if it's already running? Like after a software reset?
I don't think this is needed. FSL bootlets code does not do this.
PATCH 7/9 mxs: spl_mem_init: Remove unneeded DRAM configurations
Dear Fabio Estevam,
Quoted 5 lines · Marek Vasut
Quoted 2 lines
Do you not need to stop the DRAM if it's already running? Like after a software reset?
I don't think this is needed. FSL bootlets code does not do this.
You'll end up messing with configuration registers on already-running RAM. That doesn't really make sense and I suspect it can result in some weird behavior.
Best regards,
Marek Vasut
Fabio Estevam
reviewerPATCH 7/9 mxs: spl_mem_init: Remove unneeded DRAM configurations
Quoted 1 line · Marek Vasut
You'll end up messing with configuration registers on already-running RAM. That
HW_DRAM_CTL08, bit 16 (START) is 0 (inactive) after a reset, so no need to turn off the RAM.
Fabio Estevam
reviewerPATCH 8/9 mxs: spl_mem_init: Skip the initialization of some DRAM_CTL registers
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
HW_DRAM_CTL27, HW_DRAM_CTL28 and HW_DRAM_CTL35 are not initialized as per FSL bootlets code.
mx23 Reference Manual mark HW_DRAM_CTL27 and HW_DRAM_CTL28 as "reserved".
HW_DRAM_CTL8 is setup as the last element.
So skip the initialization of these DRAM_CTL registers.
--- arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +6 -3
@@ -116,9 +116,12 @@ static void initialize_dram_values(void)mxs_adjust_memory_params (dram_vals); -for (i =0 ; i <ARRAY_SIZE (dram_vals); i++) -writel (dram_vals[i],MXS_DRAM_BASE + (4 * i)); - +for (i =0 ; i <ARRAY_SIZE (dram_vals); i++) { +#ifdef CONFIG_MX23 + if (!(i == 8 || i == 27 || i == 28 || i == 35)) +#endif +writel (dram_vals[i],MXS_DRAM_BASE + (4 * i)); + }#ifdef CONFIG_MX23 /* * Enable tRAS lockout in HW_DRAM_CTL08 ; it must be the last
Signature · 1 line
1.7.9.5
PATCH 8/9 mxs: spl_mem_init: Skip the initialization of some DRAM_CTL registers
Dear Fabio Estevam,
Quoted 21 lines
From: Fabio Estevam <[email protected]>
HW_DRAM_CTL27,HW_DRAM_CTL28andHW_DRAM_CTL35are not initialized as per FSL bootlets code.mx23 Reference Manual mark
HW_DRAM_CTL27andHW_DRAM_CTL28as "reserved".
HW_DRAM_CTL8is setup as the last element.So skip the initialization of these
DRAM_CTLregisters.Signed-off-by Fabio Estevam <[email protected]>--- arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.cindex cde883d..f500851 100644
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c static void initialize_dram_values(void) · line 121
Quoted 9 lines
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +3
-3@@ -116,9 +116,12 @@ static void initialize_dram_values(void)mxs_adjust_memory_params (dram_vals); -for (i =0 ; i <ARRAY_SIZE (dram_vals); i++) -writel (dram_vals[i],MXS_DRAM_BASE + (4 * i)); - +for (i =0 ; i <ARRAY_SIZE (dram_vals); i++) { +#ifdef CONFIG_MX23 +if (!(i ==8 || i ==27 || i ==28 || i ==35 ))
Stick a "continue" keyword here so it's contained instead of such a semi- complete "if" clause please.
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c static void initialize_dram_values(void) · line 127
Quoted 6 lines
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +3
-0+#endif +writel (dram_vals[i],MXS_DRAM_BASE + (4 * i)); + }#ifdef CONFIG_MX23 /* * Enable tRAS lockout in HW_DRAM_CTL08 ; it must be the last
Best regards,
Marek Vasut
PATCH 8/9 mxs: spl_mem_init: Skip the initialization of some DRAM_CTL registers
In reply to Fabio EstevamQuoted 5 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
HW_DRAM_CTL27,HW_DRAM_CTL28andHW_DRAM_CTL35are not initialized as per FSL bootlets code.
Quoted 8 lines
mx23 Reference Manual mark
HW_DRAM_CTL27andHW_DRAM_CTL28as "reserved".
HW_DRAM_CTL8is setup as the last element.So skip the initialization of these
DRAM_CTLregisters.Signed-off-by Fabio Estevam <[email protected]>---
Hi Fabio,
Quoted 8 lines
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +0
-0
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c static void initialize_dram_values(void) · line 122
Quoted 10 lines
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +4
-3@@ -116,9 +116,12 @@ static void initialize_dram_values(void)mxs_adjust_memory_params (dram_vals); -for (i =0 ; i <ARRAY_SIZE (dram_vals); i++) -writel (dram_vals[i],MXS_DRAM_BASE + (4 * i)); - +for (i =0 ; i <ARRAY_SIZE (dram_vals); i++) { +#ifdef CONFIG_MX23 + if (!(i == 8 || i == 27 || i == 28 || i == 35)) +#endif
I will suggest you add also a comment here telling that the registers are reserved. I know you explain this in commit message, but people look directly into the code and it will be easire to understand why you do that.
Best regards,
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
Fabio Estevam
reviewerPATCH 9/9 mxs: spl_mem_init: Change EMI port priority
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
FSL bootlets code set the PORT_PRIORITY_ORDER field of register HW_EMI_CTRL as 0x2, which means:
PORT0231 = 0x02 Priority Order: AXI0, AHB2, AHB3, AHB1
--- arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c +1 -1
@@ -274,7 +274,7 @@ static void mx23_mem_init(void)early_delay (20000 );/* Adjust EMI port priority. */ -clrsetbits_le32 (0x80020000 ,0x1f <<16 ,0x8 ); +clrsetbits_le32 (0x80020000 ,0x1f <<16 ,0x2 );early_delay (20000 );setbits_le32 (MXS_DRAM_BASE +0x40 ,1 <<19 );
Signature · 1 line
1.7.9.5