9
0
Fork 0

Adding IPU clock query functions for i.MX31 and i.MX35

Adding IPU clock query functions for i.MX31 and i.MX35
(used to generate their LCD timing).

BTW: All functions are declared with the 'ulong' return type, but some are
defined with 'unsigned long'. And yes, its the same, but IMHO one type should
be used for all.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Juergen Beisert 2009-11-24 17:04:17 +01:00 committed by Sascha Hauer
parent 19b98a87fc
commit 81b044f3b6
2 changed files with 43 additions and 0 deletions

View File

@ -41,6 +41,18 @@ ulong imx_get_mcu_main_clk(void)
return imx_get_mpl_dpdgck_clk();
}
/**
* Calculate the current pixel clock speed (aka HSP or IPU)
* @return 0 on failure or current frequency in Hz
*/
ulong imx_get_lcdclk(void)
{
ulong hsp_podf = (readl(IMX_CCM_BASE + CCM_PDR0) >> 11) & 0x03;
ulong base_clk = imx_get_mcu_main_clk();
return base_clk / (hsp_podf + 1);
}
ulong imx_get_perclk1(void)
{
u32 freq = imx_get_mcu_main_clk();

View File

@ -118,6 +118,37 @@ unsigned long imx_get_gptclk(void)
return imx_get_ipgclk();
}
/**
* Calculate the current pixel clock speed (aka HSP or IPU)
* @return 0 on failure or current frequency in Hz
*/
unsigned long imx_get_lcdclk(void)
{
unsigned long hsp_podf = (readl(IMX_CCM_BASE + CCM_PDR0) >> 20) & 0x03;
unsigned long base_clk = imx_get_armclk();
if (base_clk > 400 * 1000 * 1000) {
switch(hsp_podf) {
case 0:
return base_clk >> 2;
case 1:
return base_clk >> 3;
case 2:
return base_clk / 3;
}
} else {
switch(hsp_podf) {
case 0:
case 2:
return base_clk / 3;
case 1:
return base_clk / 6;
}
}
return 0;
}
unsigned long imx_get_uartclk(void)
{
unsigned long pdr3 = readl(IMX_CCM_BASE + CCM_PDR3);