/* What's not entirely clear is "which" field represents the key field. Some might argue L3-DDR, others ARM, others IVA. This code is simple and just uses the ARM rates.  */
long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
/* What's not entirely clear is "which" field represents the key field. Some might argue L3-DDR, others ARM, others IVA. This code is simple and just uses the ARM rates.  */
long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
{
	const struct prcm_config *ptr;
	long highest_rate;
	long sys_ck_rate;
	sys_ck_rate = clk_get_rate(sclk);
	highest_rate = -EINVAL;
	for (ptr = rate_table; ptr->mpu_speed; ptr++) {
		if (!(ptr->flags & cpu_mask))
			continue;
		if (ptr->xtal_speed != sys_ck_rate)
			continue;
		highest_rate = ptr->mpu_speed;
		if (ptr->mpu_speed <= rate)
			break;
	}
	return highest_rate;
}