Re: Disabled LocalPlus Controller (LPC) clock on MPC512x
From: Alexander Popov
Date: Tue Dec 16 2014 - 07:00:31 EST
02.12.2014 13:47, Matteo Facchinetti ÐÐÑÐÑ:
On 26/11/2014 12:49, Alexander Popov wrote:
Hello.
Hi.
Thanks for your reply, Matteo.
I've looked deeper and have more information about the crash.
My Freescale TWR-MPC5125 board instantly reboots if I touch
any physical address on the LocalPlus Bus (LPB) for the first time
when Linux has already booted.
This effect is reproduced by using /dev/mem or loading a kernel module
which works with any peripherals on LPB.
It took me some time to find out that such crash is caused by
clk_disable_unused() in drivers/clk/clk.c, which disables
LocalPlus Controller (LPC) clock if I don't touch LPB addresses in the
previous initcalls.
My first diagnosis was not correct: clk_disable_unused() doesn't disable
LPC clock because in arch/powerpc/platforms/512x/clock-commonclk.c
we call:
clk_prepare_enable(clks[MPC512x_CLK_LPC]);
But clk_disable_unused() disables NFC clock as unused which seems to be
a real reason of board crash.
So starting Linux with clk_ignore_unused bootparam
or inserting dummy LPB reading to some initcall is a temporary fix.
In fact clk_ignore_unused bootparam helps to avoid disabling NFC clock.
The board crash is reproduced again if I perform the following steps:
1. disable NFC clock in uboot by clearing NFC_EN bit in SCCR1 register,
2. boot Linux with clk_ignore_unused,
3. touch any LPB address.
At the same time disabling NFC clock and reading from LPB certainly
in uboot doesn't make MPC5125 reset instantly. So I can't reproduce
the crash in uboot. It looks like we do something wrong in Linux.
- may be good to enable MPC512x_CLK_LPC only when localbus is enabled
by the dts
- if enabled, MPC512x_CLK_LPC have to setup with CLK_IGNORE_UNUSED
flag because never get claimed by any driver.
This approach didn't help to fix the crash because in fact
clk_disable_unused() doesn't disable LPC clock as I wrote above.
I put in CC "Gerhard Sittig" also beacuse it might be interesting to
know his point of view as the author of mpc512x common clock driver.
Surely. Thanks.
Best regards,
Alexander
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/