return freq / (uart_podf + 1);
}
+static u32 get_lcd_clk(unsigned int ifnum)
+{
+ u32 pll_rate;
+ u32 pred, postd;
+
+ if (!is_mx6sx() && !is_mx6ul() && !is_mx6ull() && !is_mx6sl() &&
+ !is_mx6sll()) {
+ debug("This chip does't support lcd\n");
+ return 0;
+ }
+
+ pll_rate = decode_pll(PLL_VIDEO, MXC_HCLK);
+ if (ifnum == 1) {
+ if (!is_mx6sl()) {
+ pred = __raw_readl(&imx_ccm->cscdr2);
+ pred &= MXC_CCM_CSCDR2_LCDIF1_PRE_DIV_MASK;
+ pred = pred >> MXC_CCM_CSCDR2_LCDIF1_PRE_DIV_OFFSET;
+
+ postd = readl(&imx_ccm->cbcmr);
+ postd &= MXC_CCM_CBCMR_LCDIF1_PODF_MASK;
+ postd = postd >> MXC_CCM_CBCMR_LCDIF1_PODF_OFFSET;
+ } else {
+ pred = __raw_readl(&imx_ccm->cscdr2);
+ pred &= MXC_CCM_CSCDR2_LCDIF_PIX_PRE_DIV_MASK;
+ pred = pred >> MXC_CCM_CSCDR2_LCDIF_PIX_PRE_DIV_OFFSET;
+
+ postd = readl(&imx_ccm->cscmr1);
+ postd &= MXC_CCM_CSCMR1_LCDIF_PIX_PODF_OFFSET;
+ postd = postd >> MXC_CCM_CBCMR_LCDIF1_PODF_OFFSET;
+ }
+ } else if (ifnum == 2) {
+ if (is_mx6sx()) {
+ pred = __raw_readl(&imx_ccm->cscdr2);
+ pred &= MXC_CCM_CSCDR2_LCDIF2_PRE_DIV_MASK;
+ pred = pred >> MXC_CCM_CSCDR2_LCDIF2_PRE_DIV_OFFSET;
+
+ postd = readl(&imx_ccm->cscmr1);
+ postd &= MXC_CCM_CSCMR1_LCDIF2_PODF_MASK;
+ postd = postd >> MXC_CCM_CSCMR1_LCDIF2_PODF_OFFSET;
+
+ } else {
+ goto if_err;
+ }
+ } else {
+ goto if_err;
+ }
+
+ return DIV_ROUND_UP_ULL((u64)pll_rate, (postd + 1) * (pred + 1));
+
+if_err:
+ debug("This chip not support lcd iterface %d\n", ifnum);
+ return 0;
+}
+
static u32 get_cspi_clk(void)
{
u32 reg, cspi_podf;
return get_usdhc_clk(3);
case MXC_SATA_CLK:
return get_ahb_clk();
+ case MXC_LCDIF1_CLK:
+ return get_lcd_clk(1);
+ case MXC_LCDIF2_CLK:
+ return get_lcd_clk(2);
default:
printf("Unsupported MXC CLK: %d\n", clk);
break;