Patchwork [U-Boot,v2,1/9] mpc8xxx: Display RDIMM if detected

login
register
mail settings
Submitter York Sun
Date Dec. 17, 2010, 11:59 p.m.
Message ID <1292630381-23022-1-git-send-email-yorksun@freescale.com>
Download mbox | patch
Permalink /patch/76043/
State Changes Requested
Headers show

Comments

York Sun - Dec. 17, 2010, 11:59 p.m.
Print a message when a RDIMM is detected.

Signed-off-by: York Sun <yorksun@freescale.com>
---
 .../cpu/mpc8xxx/ddr/lc_common_dimm_params.c        |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)
Wolfgang Denk - Dec. 18, 2010, 10:21 p.m.
Dear York Sun,

In message <1292630381-23022-1-git-send-email-yorksun@freescale.com> you wrote:
> Print a message when a RDIMM is detected.
...
> +	} else
>  		printf("ERROR:  Mix of registered buffered and unbuffered "
>  				"DIMMs detected!\n");
> -	}

Mutli-line statement needs braces.


Best regards,

Wolfgang Denk
Sergei Shtylyov - Dec. 21, 2010, 1:36 p.m.
Hello.

On 19-12-2010 1:21, Wolfgang Denk wrote:

>> Print a message when a RDIMM is detected.
> ...
>> +	} else
>>   		printf("ERROR:  Mix of registered buffered and unbuffered "
>>   				"DIMMs detected!\n");
>> -	}

> Mutli-line statement needs braces.

    Well, not only that. CodingStyle requires that if some parts of the *if* 
statement used {}, then all parts need to use {}.

> Best regards,

> Wolfgang Denk

WBR, Sergei

Patch

diff --git a/arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c b/arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c
index 029e566..af0250d 100644
--- a/arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c
+++ b/arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c
@@ -98,7 +98,7 @@  compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 	unsigned int tDQSQ_max_ps = 0;
 	unsigned int tQHS_ps = 0;
 
-	unsigned int temp1, temp2, temp3;
+	unsigned int temp1, temp2;
 	unsigned int additive_latency = 0;
 #if !defined(CONFIG_FSL_DDR3)
 	const unsigned int mclk_ps = get_memory_clk_period_ps();
@@ -215,21 +215,16 @@  compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 	}
 
 	outpdimm->all_DIMMs_registered = 0;
+	outpdimm->all_DIMMs_unbuffered = 0;
 	if (temp1 && !temp2) {
 		outpdimm->all_DIMMs_registered = 1;
-	}
-
-	outpdimm->all_DIMMs_unbuffered = 0;
-	if (!temp1 && temp2) {
+		printf("Detected RDIMM(s)\n");
+	} else if (!temp1 && temp2) {
 		outpdimm->all_DIMMs_unbuffered = 1;
-	}
-
-	/* CHECKME: */
-	if (!outpdimm->all_DIMMs_registered
-	    && !outpdimm->all_DIMMs_unbuffered) {
+		printf("Detected UDIMM(s)\n");
+	} else
 		printf("ERROR:  Mix of registered buffered and unbuffered "
 				"DIMMs detected!\n");
-	}
 
 	temp1 = 0;
 	if (outpdimm->all_DIMMs_registered)
@@ -237,7 +232,7 @@  compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 			outpdimm->rcw[j] = dimm_params[0].rcw[j];
 			for (i = 1; i < number_of_dimms; i++)
 				if (dimm_params[i].rcw[j] != dimm_params[0].rcw[j]) {
-					temp3 = 1;
+					temp1 = 1;
 					break;
 				}
 		}