From: Alexander Popov <alex.popov@linux.com>
To: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>
Cc: Gerhard Sittig <gsi@denx.de>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: Disabled LocalPlus Controller (LPC) clock on MPC512x
Date: Tue, 16 Dec 2014 15:00:19 +0300 [thread overview]
Message-ID: <54901ED3.30207@linux.com> (raw)
In-Reply-To: <547D98DF.9000708@sirius-es.it>
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
WARNING: multiple messages have this Message-ID (diff)
From: Alexander Popov <alex.popov@linux.com>
To: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Gerhard Sittig <gsi@denx.de>
Subject: Re: Disabled LocalPlus Controller (LPC) clock on MPC512x
Date: Tue, 16 Dec 2014 15:00:19 +0300 [thread overview]
Message-ID: <54901ED3.30207@linux.com> (raw)
In-Reply-To: <547D98DF.9000708@sirius-es.it>
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
next prev parent reply other threads:[~2014-12-16 12:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 11:49 Disabled LocalPlus Controller (LPC) clock on MPC512x Alexander Popov
2014-12-02 10:47 ` Matteo Facchinetti
2014-12-02 10:47 ` Matteo Facchinetti
2014-12-16 12:00 ` Alexander Popov [this message]
2014-12-16 12:00 ` Alexander Popov
2014-12-19 9:38 ` Matteo Facchinetti
2014-12-19 9:38 ` Matteo Facchinetti
2015-02-10 10:36 ` Alexander Popov
2015-02-10 10:36 ` Alexander Popov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54901ED3.30207@linux.com \
--to=alex.popov@linux.com \
--cc=gsi@denx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=matteo.facchinetti@sirius-es.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.