All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Turquette <mturquette@linaro.org>
To: Stephen Boyd <sboyd@codeaurora.org>,
	Simon Horman <horms@verge.net.au>,
	Magnus Damm <magnus.damm@gmail.com>,
	Marc Zyngier <marc.zyngier@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-sh@vger.kernel.org,
	linux-pm@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: Re: [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
Date: Tue, 24 Mar 2015 16:25:08 -0700	[thread overview]
Message-ID: <20150324232508.7930.89483@quantum> (raw)
In-Reply-To: <1426706164-28309-2-git-send-email-geert+renesas@glider.be>

Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
> 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 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
>     explicitly enable the clock,
>   - 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 quirk to the MSTP
> clock driver to make sure the module clock is never disabled.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
> index 2d2fe773ac8168f9..742af84735a07450 100644
> --- a/drivers/clk/shmobile/clk-mstp.c
> +++ b/drivers/clk/shmobile/clk-mstp.c
> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>         unsigned int i;
>         u32 value;
>  
> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
> +               return 0;
> +       }

Hello Geert,

This is a bit ugly for three reasons:

1) we hit this code for every MSTP clock {en,dis}able call
2) __clk_get_name is kind of gross
3) the enable_count will not be correct. It will be zero but the clock
will actually be enabled

Have you considered Lee's series to express these always-on clocks in
DT? See,

https://lkml.org/lkml/2015/2/24/495

Regards,
Mike

> +
>         spin_lock_irqsave(&group->lock, flags);
>  
>         value = clk_readl(group->smstpcr);
> -- 
> 1.9.1
> 

WARNING: multiple messages have this Message-ID (diff)
From: Michael Turquette <mturquette@linaro.org>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
Date: Tue, 24 Mar 2015 23:25:08 +0000	[thread overview]
Message-ID: <20150324232508.7930.89483@quantum> (raw)
In-Reply-To: <1426706164-28309-2-git-send-email-geert+renesas@glider.be>

Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
> 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 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
>     explicitly enable the clock,
>   - 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 quirk to the MSTP
> clock driver to make sure the module clock is never disabled.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
> index 2d2fe773ac8168f9..742af84735a07450 100644
> --- a/drivers/clk/shmobile/clk-mstp.c
> +++ b/drivers/clk/shmobile/clk-mstp.c
> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>         unsigned int i;
>         u32 value;
>  
> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
> +               return 0;
> +       }

Hello Geert,

This is a bit ugly for three reasons:

1) we hit this code for every MSTP clock {en,dis}able call
2) __clk_get_name is kind of gross
3) the enable_count will not be correct. It will be zero but the clock
will actually be enabled

Have you considered Lee's series to express these always-on clocks in
DT? See,

https://lkml.org/lkml/2015/2/24/495

Regards,
Mike

> +
>         spin_lock_irqsave(&group->lock, flags);
>  
>         value = clk_readl(group->smstpcr);
> -- 
> 1.9.1
> 

WARNING: multiple messages have this Message-ID (diff)
From: mturquette@linaro.org (Michael Turquette)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS
Date: Tue, 24 Mar 2015 16:25:08 -0700	[thread overview]
Message-ID: <20150324232508.7930.89483@quantum> (raw)
In-Reply-To: <1426706164-28309-2-git-send-email-geert+renesas@glider.be>

Quoting Geert Uytterhoeven (2015-03-18 12:16:00)
> 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 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
>     explicitly enable the clock,
>   - 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 quirk to the MSTP
> clock driver to make sure the module clock is never disabled.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/clk/shmobile/clk-mstp.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
> index 2d2fe773ac8168f9..742af84735a07450 100644
> --- a/drivers/clk/shmobile/clk-mstp.c
> +++ b/drivers/clk/shmobile/clk-mstp.c
> @@ -62,6 +62,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
>         unsigned int i;
>         u32 value;
>  
> +       /* INTC-SYS is the module clock of the GIC, and must not be disabled */
> +       if (!enable && !strcmp(__clk_get_name(hw->clk), "intc-sys")) {
> +               pr_debug("MSTP %pC skipping disable\n", hw->clk);
> +               return 0;
> +       }

Hello Geert,

This is a bit ugly for three reasons:

1) we hit this code for every MSTP clock {en,dis}able call
2) __clk_get_name is kind of gross
3) the enable_count will not be correct. It will be zero but the clock
will actually be enabled

Have you considered Lee's series to express these always-on clocks in
DT? See,

https://lkml.org/lkml/2015/2/24/495

Regards,
Mike

> +
>         spin_lock_irqsave(&group->lock, flags);
>  
>         value = clk_readl(group->smstpcr);
> -- 
> 1.9.1
> 

  reply	other threads:[~2015-03-24 23:25 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18 19:15 [PATCH/RFC 0/5] ARM: shmobile: Add INTC-SYS clock to device tree Geert Uytterhoeven
2015-03-18 19:15 ` Geert Uytterhoeven
2015-03-18 19:15 ` Geert Uytterhoeven
2015-03-18 19:16 ` [PATCH/RFC 1/5] clk: shmobile: mstp: Never disable INTC-SYS Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-24 23:25   ` Michael Turquette [this message]
2015-03-24 23:25     ` Michael Turquette
2015-03-24 23:25     ` Michael Turquette
2015-03-25  4:17     ` Geert Uytterhoeven
2015-03-25  4:17       ` Geert Uytterhoeven
2015-03-25  4:17       ` Geert Uytterhoeven
2015-03-25  9:21       ` Marc Zyngier
2015-03-25  9:21         ` Marc Zyngier
2015-03-25  9:21         ` Marc Zyngier
2015-03-25 21:19         ` Geert Uytterhoeven
2015-03-25 21:19           ` Geert Uytterhoeven
2015-03-25 21:19           ` Geert Uytterhoeven
2015-03-26 10:39           ` Marc Zyngier
2015-03-26 10:39             ` Marc Zyngier
2015-03-26 10:39             ` Marc Zyngier
2015-03-18 19:16 ` [PATCH/RFC 2/5] ARM: shmobile: r8a73a4: Add INTC-SYS clock to device tree Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16 ` [PATCH/RFC 3/5] ARM: shmobile: r8a7790: " Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16 ` [PATCH/RFC 4/5] ARM: shmobile: r8a7791: " Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16 ` [PATCH/RFC 5/5] ARM: shmobile: r8a7794: " Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven
2015-03-18 19:16   ` Geert Uytterhoeven

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=20150324232508.7930.89483@quantum \
    --to=mturquette@linaro.org \
    --cc=geert+renesas@glider.be \
    --cc=horms@verge.net.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=marc.zyngier@arm.com \
    --cc=sboyd@codeaurora.org \
    /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.