All of lore.kernel.org
 help / color / mirror / Atom feed
From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 3/8] ARM: sunxi: Move the clock protection to machine hooks
Date: Wed, 23 Apr 2014 15:17:20 +0200	[thread overview]
Message-ID: <20140423131720.GS24905@lukather> (raw)
In-Reply-To: <201404231439.02913.arnd@arndb.de>

On Wed, Apr 23, 2014 at 02:39:02PM +0200, Arnd Bergmann wrote:
> On Thursday 17 April 2014, Maxime Ripard wrote:
> > Since we start to have a lot of clocks to protect, some of them in a few boards
> > only, it becomes difficult to handle the clock protection without having to add
> > per machine exceptions.
> > 
> > Move these where they belong, in the machine definition code.
> > 
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> 
> I don't like the fact that these are required to be hardcoded
> anywhere in source code.

I agree, but that would also mean having a driver for everything that
would need a clock: a CPU, the RAM. I'm not sure we want that either.

> > +#include <linux/clk.h>
> >  #include <linux/init.h>
> >  #include <linux/of_platform.h>
> >  
> > @@ -19,9 +20,17 @@
> >  
> >  static void __init sun4i_dt_init(void)
> >  {
> > +       struct clk *clk;
> > +
> >         sunxi_setup_restart();
> >  
> >         of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> > +
> > +       /* Make sure the clocks we absolutely need are enabled */
> > +       /* DDR clock */
> > +       clk = clk_get(NULL, "pll5_ddr");
> > +       if (!IS_ERR(clk))
> > +               clk_prepare_enable(clk);
> >  }
> 
> Isn't there already DT syntax to do the same? If not, should there be?

I don't think there is, and I gave some thought about it too. But
something a la regulator-always-on wouldn't work with clocks with
multiple outputs (like pll5), because you might need to leave only one
of the output enabled, but not the others, and I couldn't think of a
nice way to do so.

If you have one, I'd be happy to implement it.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140423/683b2315/attachment-0001.sig>

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Emilio Lopez <emilio-0Z03zUJReD5OxF6Tv1QG9Q@public.gmane.org>,
	Dan Williams
	<dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Mike Turquette
	<mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	andriy.shevchenko-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	zhuzhenhua-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf@public.gmane.org,
	shuge-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf@public.gmane.org,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	kevin.z.m.zh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	sunny-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf@public.gmane.org,
	dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v6 3/8] ARM: sunxi: Move the clock protection to machine hooks
Date: Wed, 23 Apr 2014 15:17:20 +0200	[thread overview]
Message-ID: <20140423131720.GS24905@lukather> (raw)
In-Reply-To: <201404231439.02913.arnd-r2nGTMty4D4@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1871 bytes --]

On Wed, Apr 23, 2014 at 02:39:02PM +0200, Arnd Bergmann wrote:
> On Thursday 17 April 2014, Maxime Ripard wrote:
> > Since we start to have a lot of clocks to protect, some of them in a few boards
> > only, it becomes difficult to handle the clock protection without having to add
> > per machine exceptions.
> > 
> > Move these where they belong, in the machine definition code.
> > 
> > Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> 
> I don't like the fact that these are required to be hardcoded
> anywhere in source code.

I agree, but that would also mean having a driver for everything that
would need a clock: a CPU, the RAM. I'm not sure we want that either.

> > +#include <linux/clk.h>
> >  #include <linux/init.h>
> >  #include <linux/of_platform.h>
> >  
> > @@ -19,9 +20,17 @@
> >  
> >  static void __init sun4i_dt_init(void)
> >  {
> > +       struct clk *clk;
> > +
> >         sunxi_setup_restart();
> >  
> >         of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> > +
> > +       /* Make sure the clocks we absolutely need are enabled */
> > +       /* DDR clock */
> > +       clk = clk_get(NULL, "pll5_ddr");
> > +       if (!IS_ERR(clk))
> > +               clk_prepare_enable(clk);
> >  }
> 
> Isn't there already DT syntax to do the same? If not, should there be?

I don't think there is, and I gave some thought about it too. But
something a la regulator-always-on wouldn't work with clocks with
multiple outputs (like pll5), because you might need to leave only one
of the output enabled, but not the others, and I couldn't think of a
nice way to do so.

If you have one, I'd be happy to implement it.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org,
	Emilio Lopez <emilio@elopez.com.ar>,
	Dan Williams <dan.j.williams@intel.com>,
	Vinod Koul <vinod.koul@intel.com>,
	devicetree@vger.kernel.org,
	Mike Turquette <mturquette@linaro.org>,
	andriy.shevchenko@intel.com, linux-kernel@vger.kernel.org,
	zhuzhenhua@allwinnertech.com, shuge@allwinnertech.com,
	linux-sunxi@googlegroups.com, kevin.z.m.zh@gmail.com,
	sunny@allwinnertech.com, dmaengine@vger.kernel.org
Subject: Re: [PATCH v6 3/8] ARM: sunxi: Move the clock protection to machine hooks
Date: Wed, 23 Apr 2014 15:17:20 +0200	[thread overview]
Message-ID: <20140423131720.GS24905@lukather> (raw)
In-Reply-To: <201404231439.02913.arnd@arndb.de>

[-- Attachment #1: Type: text/plain, Size: 1840 bytes --]

On Wed, Apr 23, 2014 at 02:39:02PM +0200, Arnd Bergmann wrote:
> On Thursday 17 April 2014, Maxime Ripard wrote:
> > Since we start to have a lot of clocks to protect, some of them in a few boards
> > only, it becomes difficult to handle the clock protection without having to add
> > per machine exceptions.
> > 
> > Move these where they belong, in the machine definition code.
> > 
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> 
> I don't like the fact that these are required to be hardcoded
> anywhere in source code.

I agree, but that would also mean having a driver for everything that
would need a clock: a CPU, the RAM. I'm not sure we want that either.

> > +#include <linux/clk.h>
> >  #include <linux/init.h>
> >  #include <linux/of_platform.h>
> >  
> > @@ -19,9 +20,17 @@
> >  
> >  static void __init sun4i_dt_init(void)
> >  {
> > +       struct clk *clk;
> > +
> >         sunxi_setup_restart();
> >  
> >         of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> > +
> > +       /* Make sure the clocks we absolutely need are enabled */
> > +       /* DDR clock */
> > +       clk = clk_get(NULL, "pll5_ddr");
> > +       if (!IS_ERR(clk))
> > +               clk_prepare_enable(clk);
> >  }
> 
> Isn't there already DT syntax to do the same? If not, should there be?

I don't think there is, and I gave some thought about it too. But
something a la regulator-always-on wouldn't work with clocks with
multiple outputs (like pll5), because you might need to leave only one
of the output enabled, but not the others, and I couldn't think of a
nice way to do so.

If you have one, I'd be happy to implement it.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-04-23 13:17 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-17  8:46 [PATCH v6 0/8] Add support for the Allwinner A31 DMA Controller Maxime Ripard
2014-04-17  8:46 ` Maxime Ripard
2014-04-17  8:46 ` Maxime Ripard
2014-04-17  8:46 ` [PATCH v6 1/8] clk: sunxi: Remove calls to clk_put Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-17  8:46 ` [PATCH v6 2/8] ARM: sunxi: Split out the various machines into separate files Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-23 12:33   ` Arnd Bergmann
2014-04-23 12:33     ` Arnd Bergmann
2014-04-23 12:33     ` Arnd Bergmann
2014-04-23 13:28     ` Maxime Ripard
2014-04-23 13:28       ` Maxime Ripard
2014-04-23 13:28       ` Maxime Ripard
2014-04-23 13:33       ` Arnd Bergmann
2014-04-23 13:33         ` Arnd Bergmann
2014-04-23 13:33         ` Arnd Bergmann
2014-04-17  8:46 ` [PATCH v6 3/8] ARM: sunxi: Move the clock protection to machine hooks Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-23 12:39   ` Arnd Bergmann
2014-04-23 12:39     ` Arnd Bergmann
2014-04-23 13:17     ` Maxime Ripard [this message]
2014-04-23 13:17       ` Maxime Ripard
2014-04-23 13:17       ` Maxime Ripard
2014-04-23 13:31       ` Arnd Bergmann
2014-04-23 13:31         ` Arnd Bergmann
2014-04-23 13:31         ` Arnd Bergmann
2014-05-13  1:30         ` Mike Turquette
2014-05-13  1:30           ` Mike Turquette
2014-05-13  1:30           ` Mike Turquette
2014-04-17  8:46 ` [PATCH v6 4/8] ARM: sun6i: Protect CPU clock Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-17  8:46 ` [PATCH v6 5/8] ARM: sun6i: Protect SDRAM gating bit Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-17  8:46 ` [PATCH v6 6/8] ARM: sun6i: Sort the NMI node by physical address Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-23 12:39   ` Arnd Bergmann
2014-04-23 12:39     ` Arnd Bergmann
2014-04-23 12:39     ` Arnd Bergmann
2014-04-23 13:11     ` Maxime Ripard
2014-04-23 13:11       ` Maxime Ripard
2014-04-23 13:11       ` Maxime Ripard
2014-04-17  8:46 ` [PATCH v6 7/8] DMA: sun6i: Add driver for the Allwinner A31 DMA controller Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-17  8:46 ` [PATCH v6 8/8] ARM: sun6i: dt: Add A31 DMA controller to DTSI Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard
2014-04-17  8:46   ` Maxime Ripard

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=20140423131720.GS24905@lukather \
    --to=maxime.ripard@free-electrons.com \
    --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 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.