/* compute the CAS write latency according to DDR3 spec CWL = 5 if tCK >= 2.5ns 6 if 2.5ns > tCK >= 1.875ns 7 if 1.875ns > tCK >= 1.5ns 8 if 1.5ns > tCK >= 1.25ns  */
static unsigned int compute_cas_write_latency(void)
/* compute the CAS write latency according to DDR3 spec CWL = 5 if tCK >= 2.5ns 6 if 2.5ns > tCK >= 1.875ns 7 if 1.875ns > tCK >= 1.5ns 8 if 1.5ns > tCK >= 1.25ns  */
static unsigned int compute_cas_write_latency(void)
{
	unsigned int cwl;
	const unsigned int mclk_ps = get_memory_clk_period_ps();
	if (mclk_ps >= 2500)
		cwl = 5;
	else if (mclk_ps >= 1875)
		cwl = 6;
	else if (mclk_ps >= 1500)
		cwl = 7;
	else if (mclk_ps >= 1250)
		cwl = 8;
	else
		cwl = 8;
	return cwl;
}