linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: kernel@martin.sperl.org (kernel at martin.sperl.org)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V4 1/2] clk: bcm2835: mark enabled clocks with CLK_IS_CRITICAL
Date: Fri, 29 Apr 2016 17:42:35 +0000	[thread overview]
Message-ID: <1461951756-16804-2-git-send-email-kernel@martin.sperl.org> (raw)
In-Reply-To: <1461951756-16804-1-git-send-email-kernel@martin.sperl.org>

From: Martin Sperl <kernel@martin.sperl.org>

The bcm2835 firmware enables several clocks and plls before
booting the linux kernel.

These plls should never get disabled as it may result in a
stopped system clock and more.

So during probing we check if the clock is enabled
and if it is then mark that clock with CLK_IS_CRITICAL.

As a consequence this will also enable the corresponding
parent plls and pll-divs.

This is intended as a stop-gap until CLK_ENABLE_HAND_OFF
becomes available, at which point it should be used instead.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
---
 drivers/clk/bcm/clk-bcm2835.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 35f8de7..03b7f01 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -1251,6 +1251,14 @@ static struct clk *bcm2835_register_clock(struct bcm2835_cprman *cprman,
 		init.flags |= CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
 	}
 
+	/* if the clock is running, then enable CRITICAL */
+	if (cprman_read(cprman, data->ctl_reg) & CM_ENABLE) {
+		dev_dbg(cprman->dev,
+			"found firmware enabled clock %s - enabling critical\n",
+			data->name);
+		init.flags |= CLK_IS_CRITICAL;
+	}
+
 	clock = devm_kzalloc(cprman->dev, sizeof(*clock), GFP_KERNEL);
 	if (!clock)
 		return NULL;
-- 
2.1.4

  reply	other threads:[~2016-04-29 17:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29 17:42 [PATCH V4 0/2] clk: bcm2835: use CLK_IS_CRITICAL/CLK_ENABLE_HAND_OFF kernel at martin.sperl.org
2016-04-29 17:42 ` kernel at martin.sperl.org [this message]
2016-05-02 15:36   ` [PATCH V4 1/2] clk: bcm2835: mark enabled clocks with CLK_IS_CRITICAL Eric Anholt
2016-05-02 16:16     ` Martin Sperl
2016-05-03  1:13       ` Eric Anholt
2016-05-03  5:07         ` Martin Sperl
2016-04-29 17:42 ` [PATCH V4 2/2] clk: bcm2835: use CLK_ENABLE_HAND_OFF instead of CLK_IS_CRITICAL kernel at martin.sperl.org

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=1461951756-16804-2-git-send-email-kernel@martin.sperl.org \
    --to=kernel@martin.sperl.org \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).