Patchwork [U-Boot] powerpc/mpc8xxx: Fix compiling error caused in DDR driver

login
register
mail settings
Submitter York Sun
Date Nov. 7, 2012, 11:47 p.m.
Message ID <1352332059-29352-1-git-send-email-yorksun@freescale.com>
Download mbox | patch
Permalink /patch/197740/
State Rejected
Delegated to: Andy Fleming
Headers show

Comments

York Sun - Nov. 7, 2012, 11:47 p.m.
mpc86xx platforms should use CONFIG_SYS_MPC86xx_DDR2_ADDR in utils.c
if applicable.

Signed-off-by: York Sun <yorksun@freescale.com>
---
 arch/powerpc/cpu/mpc8xxx/ddr/util.c |    4 ++++
 1 file changed, 4 insertions(+)
Andy Fleming - Nov. 7, 2012, 11:57 p.m.
On Nov 7, 2012, at 5:47 PM, York Sun wrote:

> mpc86xx platforms should use CONFIG_SYS_MPC86xx_DDR2_ADDR in utils.c
> if applicable.
> 
> Signed-off-by: York Sun <yorksun@freescale.com>
> ---
> arch/powerpc/cpu/mpc8xxx/ddr/util.c |    4 ++++
> 1 file changed, 4 insertions(+)
> 
> diff --git a/arch/powerpc/cpu/mpc8xxx/ddr/util.c b/arch/powerpc/cpu/mpc8xxx/ddr/util.c
> index 940ffff..9a07d9d 100644
> --- a/arch/powerpc/cpu/mpc8xxx/ddr/util.c
> +++ b/arch/powerpc/cpu/mpc8xxx/ddr/util.c
> @@ -152,7 +152,11 @@ void board_add_ram_info(int use_default)
> 
> #if CONFIG_NUM_DDR_CONTROLLERS >= 2
> 	if (!(sdram_cfg & SDRAM_CFG_MEM_EN)) {
> +#ifdef CONFIG_MPC86xx
> +		ddr = (void __iomem *)CONFIG_SYS_MPC86xx_DDR2_ADDR;
> +#else
> 		ddr = (void __iomem *)CONFIG_SYS_MPC85xx_DDR2_ADDR;
> +#endif


Argh, I submitted a patch to fix this more completely, but haven't applied it, yet. See: http://patchwork.ozlabs.org/patch/193611/


Andy
York Sun - Nov. 8, 2012, 12:08 a.m.
On 11/07/2012 03:57 PM, Fleming Andy-AFLEMING wrote:
>
> On Nov 7, 2012, at 5:47 PM, York Sun wrote:
>
>> mpc86xx platforms should use CONFIG_SYS_MPC86xx_DDR2_ADDR in utils.c
>> if applicable.
>>
>> Signed-off-by: York Sun <yorksun@freescale.com>
>> ---
>> arch/powerpc/cpu/mpc8xxx/ddr/util.c |    4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/powerpc/cpu/mpc8xxx/ddr/util.c b/arch/powerpc/cpu/mpc8xxx/ddr/util.c
>> index 940ffff..9a07d9d 100644
>> --- a/arch/powerpc/cpu/mpc8xxx/ddr/util.c
>> +++ b/arch/powerpc/cpu/mpc8xxx/ddr/util.c
>> @@ -152,7 +152,11 @@ void board_add_ram_info(int use_default)
>>
>> #if CONFIG_NUM_DDR_CONTROLLERS >= 2
>> 	if (!(sdram_cfg & SDRAM_CFG_MEM_EN)) {
>> +#ifdef CONFIG_MPC86xx
>> +		ddr = (void __iomem *)CONFIG_SYS_MPC86xx_DDR2_ADDR;
>> +#else
>> 		ddr = (void __iomem *)CONFIG_SYS_MPC85xx_DDR2_ADDR;
>> +#endif
>
>
> Argh, I submitted a patch to fix this more completely, but haven't applied it, yet. See: http://patchwork.ozlabs.org/patch/193611/
>
>
Thanks. You may want to add #else clause to catch errors. I'd rather see 
compiling error than debugging run time error.

York

Patch

diff --git a/arch/powerpc/cpu/mpc8xxx/ddr/util.c b/arch/powerpc/cpu/mpc8xxx/ddr/util.c
index 940ffff..9a07d9d 100644
--- a/arch/powerpc/cpu/mpc8xxx/ddr/util.c
+++ b/arch/powerpc/cpu/mpc8xxx/ddr/util.c
@@ -152,7 +152,11 @@  void board_add_ram_info(int use_default)
 
 #if CONFIG_NUM_DDR_CONTROLLERS >= 2
 	if (!(sdram_cfg & SDRAM_CFG_MEM_EN)) {
+#ifdef CONFIG_MPC86xx
+		ddr = (void __iomem *)CONFIG_SYS_MPC86xx_DDR2_ADDR;
+#else
 		ddr = (void __iomem *)CONFIG_SYS_MPC85xx_DDR2_ADDR;
+#endif
 		sdram_cfg = in_be32(&ddr->sdram_cfg);
 	}
 #endif