mercoledì 15 aprile 2009

Clock syncronization issue!

Time spent to analyse the imx console driver to found where is the bug that produce scrambling chars on the serial debug and the problem was not there!

The problem is ipg_clk/ipg_per_clk synchronization!
ipg_per_clk clock signal has two possible clock source decided by bit 24 (PERCS) of CCMR register.
On my armadillo 500 board the clock source was set to usb_pll instead of ipg_clk resulting on not synchronized clocks signals on the UART device! producing wired characters on the output.

This patch correct the issue, for me and also for all iMX31 boards (if misconfigured)

diff --git a/arch/arm/mach-mx3/clock.c b/arch/arm/mach-mx3/clock.c
index ca46f48..f1a581d 100644
--- a/arch/arm/mach-mx3/clock.c
+++ b/arch/arm/mach-mx3/clock.c
@@ -581,6 +581,11 @@ int __init mx31_clocks_init(unsigned long fref)
MX32, but still required to be set */
MXC_CCM_CGR2);

+ /* Ensure ipg_per_clk clock is generated by ipg_clk and not by
+ usb_pll (CCMR:24 = 1) to do not turn off UART after disabling
+ usb_pll and mantain ipg_clk and ipg_per_clk syncronization */
+ __raw_writel(__raw_readl(MXC_CCM_CCMR) | (1 << 24), MXC_CCM_CCMR);
+
usb_pll_disable(&usb_pll_clk);

pr_info("Clock input source is %ld\n", clk_get_rate(&ckih_clk));

Nessun commento:

Posta un commento