diff mbox

[2/2] clk: renesas: mstp: Make INTC-SYS a critical clock

Message ID 1484657190-12838-3-git-send-email-geert+renesas@glider.be (mailing list archive)
State Accepted
Headers show

Commit Message

Geert Uytterhoeven Jan. 17, 2017, 12:46 p.m. UTC
INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
disabled causes:

    Unhandled fault: asynchronous external abort (0x1211) at 0x00000000

Currently, the GIC-400 driver cannot enable its module clock for several
reasons:
  - It does not use a platform device, so Runtime PM is not an option,
  - gic_of_init() runs before any clocks are registered, so it cannot
    enable the clock explicitly,
  - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
    doesn't support deferred probing.

Hence we have to keep on relying on the boot loader for enabling the
module clock.

To prevent the module clock from being disabled when the CCF core thinks
it is unused, and thus causing a system lock-up, add a check to the MSTP
clock driver and enable CLK_IS_CRITICAL. This will make sure the module
clock is never disabled.

This is a hard dependency for describing the INTC-SYS clock in DT on
R-Mobile APE6 and R-Car Gen2.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This is v2 of "[PATCH/RFC 1/5] clk: renesas: mstp: Never disable
INTC-SYS".

v2:
  - Use the new CLK_ENABLE_HAND_OFF flag instead of adding a quirk to
    cpg_mstp_clock_endisable(),
  - drivers/clk/shmobile/ was renamed to drivers/clk/renesas/,
  - Migrate from CLK_ENABLE_HAND_OFF to CLK_IS_CRITICAL.
---
 drivers/clk/renesas/clk-mstp.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Stephen Boyd Jan. 20, 2017, 11:12 p.m. UTC | #1
On 01/17, Geert Uytterhoeven wrote:
> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
> disabled causes:
> 
>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
> 
> Currently, the GIC-400 driver cannot enable its module clock for several
> reasons:
>   - It does not use a platform device, so Runtime PM is not an option,
>   - gic_of_init() runs before any clocks are registered, so it cannot
>     enable the clock explicitly,
>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>     doesn't support deferred probing.
> 
> Hence we have to keep on relying on the boot loader for enabling the
> module clock.
> 
> To prevent the module clock from being disabled when the CCF core thinks
> it is unused, and thus causing a system lock-up, add a check to the MSTP
> clock driver and enable CLK_IS_CRITICAL. This will make sure the module
> clock is never disabled.
> 
> This is a hard dependency for describing the INTC-SYS clock in DT on
> R-Mobile APE6 and R-Car Gen2.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Acked-by: Stephen Boyd <sboyd@codeaurora.org>

> diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c
> index 9375777776d99407..c0319b8acf3521a2 100644
> --- a/drivers/clk/renesas/clk-mstp.c
> +++ b/drivers/clk/renesas/clk-mstp.c
> @@ -144,6 +144,11 @@ static int cpg_mstp_clock_is_enabled(struct clk_hw *hw)

Sad that git gets confused about which function this is in.

>  	init.name = name;
>  	init.ops = &cpg_mstp_clock_ops;
>  	init.flags = CLK_IS_BASIC | CLK_SET_RATE_PARENT;
> +	/* INTC-SYS is the module clock of the GIC, and must not be disabled */
> +	if (!strcmp(name, "intc-sys")) {
> +		pr_debug("MSTP %s setting CLK_IS_CRITICAL\n", name);
> +		init.flags |= CLK_IS_CRITICAL;
> +	}
>  	init.parent_names = &parent_name;
>  	init.num_parents = 1;
>
Geert Uytterhoeven Jan. 23, 2017, 9:50 a.m. UTC | #2
Hi Stephen,

On Sat, Jan 21, 2017 at 12:12 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 01/17, Geert Uytterhoeven wrote:
>> INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
>> disabled causes:
>>
>>     Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
>>
>> Currently, the GIC-400 driver cannot enable its module clock for several
>> reasons:
>>   - It does not use a platform device, so Runtime PM is not an option,
>>   - gic_of_init() runs before any clocks are registered, so it cannot
>>     enable the clock explicitly,
>>   - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
>>     doesn't support deferred probing.
>>
>> Hence we have to keep on relying on the boot loader for enabling the
>> module clock.
>>
>> To prevent the module clock from being disabled when the CCF core thinks
>> it is unused, and thus causing a system lock-up, add a check to the MSTP
>> clock driver and enable CLK_IS_CRITICAL. This will make sure the module
>> clock is never disabled.
>>
>> This is a hard dependency for describing the INTC-SYS clock in DT on
>> R-Mobile APE6 and R-Car Gen2.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>
> Acked-by: Stephen Boyd <sboyd@codeaurora.org>

Thanks!

>> diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c
>> index 9375777776d99407..c0319b8acf3521a2 100644
>> --- a/drivers/clk/renesas/clk-mstp.c
>> +++ b/drivers/clk/renesas/clk-mstp.c
>> @@ -144,6 +144,11 @@ static int cpg_mstp_clock_is_enabled(struct clk_hw *hw)
>
> Sad that git gets confused about which function this is in.

Indeed. Will send a patch to fix that...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c
index 9375777776d99407..c0319b8acf3521a2 100644
--- a/drivers/clk/renesas/clk-mstp.c
+++ b/drivers/clk/renesas/clk-mstp.c
@@ -144,6 +144,11 @@  static int cpg_mstp_clock_is_enabled(struct clk_hw *hw)
 	init.name = name;
 	init.ops = &cpg_mstp_clock_ops;
 	init.flags = CLK_IS_BASIC | CLK_SET_RATE_PARENT;
+	/* INTC-SYS is the module clock of the GIC, and must not be disabled */
+	if (!strcmp(name, "intc-sys")) {
+		pr_debug("MSTP %s setting CLK_IS_CRITICAL\n", name);
+		init.flags |= CLK_IS_CRITICAL;
+	}
 	init.parent_names = &parent_name;
 	init.num_parents = 1;