linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [linux-sunxi] Re: [PATCH v3 05/13] ARM: dts: sun9i: Add clock-indices property for bus gate clocks
Date: Thu, 15 Jan 2015 16:51:56 +0100	[thread overview]
Message-ID: <20150115155156.GA1837@lukather> (raw)
In-Reply-To: <CAGb2v65g-HMH5ezGd29SxSNCA6J5H6Q1X1H3rLKh0=nqdHDgMA@mail.gmail.com>

On Thu, Jan 15, 2015 at 11:35:42PM +0800, Chen-Yu Tsai wrote:
> On Thu, Jan 15, 2015 at 11:20 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > On Thu, Jan 15, 2015 at 10:24:04AM +0800, Chen-Yu Tsai wrote:
> >> On Thu, Jan 15, 2015 at 12:33 AM, Maxime Ripard
> >> <maxime.ripard@free-electrons.com> wrote:
> >> > On Tue, Jan 13, 2015 at 09:37:27AM +0800, Chen-Yu Tsai wrote:
> >> >> of_clk_get_parent_name() uses the clock-indices property to resolve
> >> >> clock phandle arguments in case that the argument index does not
> >> >> match the clock-output-names sequence.
> >> >>
> >> >> This is the case on sunxi, where we use the actual bit index as the
> >> >> argument to the phandle. Add the clock-indices property so that
> >> >> of_clk_get_parent_name() resolves the names correctly.
> >> >>
> >> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> >> >
> >> > Applied. Are the mask in the clock driver still of any use now? I
> >> > don't think they are, and if we're going that way, I'd rather have
> >> > them removed from the driver.
> >>
> >> Yes they are still passed through factors_data, for mux_clk_ops to
> >> know about the width of the mux, which is 3 bits on older SoCs vs
> >> 4 bits on sun9i.
> >
> > Erm.... These are gates. They are not muxable and are not handled
> > through clk-factors, so I'm not sure how it is relevant :)
> 
> Sorry. I jumped to the mux mask stuff. Yes the gate masks are still
> used, and the gates are still referenced by the bit offset.
> 
> As described in the commit message, clock-indices is used by
> of_clk_get_parent_name() to match the index used in the phandle
> to the correct name in clock-names.
> 
> Take apb1 for example:
> 
>                        clock-indices = <0>, <1>, <2>, <3>, <4>,
>                                        <16>, <17>, <18>, <19>, <20>, <21>;
>                        clock-output-names = "apb1_i2c0", "apb1_i2c1",
>                                        "apb1_i2c2", "apb1_i2c3", "apb1_i2c4",
>                                        "apb1_uart0", "apb1_uart1", ...
> 
> If we have "clocks = <&apb1 16>;" in some device, and we call
> of_clk_get_parent_name() on said clock, it would try to get
> clock_output_names[16], which obviously is the wrong one.
> 
> With clock-indices, of_clk_get_parent_name first looks at
> that array, finds an entry matching 16, then uses the
> index of the matching entry to get the name from
> clock-output-names.

Yeah, I know what it does, and we do agree on the fact that it's
needed.

> So, we are still using the gate bitmask to declare valid
> clock gates. The sunxi driver does not use clock-indices
> directly. Nor do I think it was intended to be used by
> clock drivers directly.

However, the gate bitmask itself carries exactly the same information
than clock-indices. It's the exact same list of numbers, just with two
different ways of defining it.

If we go with clock-indices, which is the right solution, then we can
just drop the other one.

I actually started to do just this last evening. A31 boots without any
gates bit mask but the USB clocks one so far, I intend on converting
the others as well.

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: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150115/7b35f4af/attachment.sig>

  reply	other threads:[~2015-01-15 15:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13  1:37 [PATCH v3 00/13] ARM: sun9i: Enable MMC support on Allwinner A80 Chen-Yu Tsai
2015-01-13  1:37 ` [PATCH v3 01/13] clk: sunxi: Add a common setup function for mmc module clocks Chen-Yu Tsai
2015-01-14 16:26   ` Maxime Ripard
2015-01-13  1:37 ` [PATCH v3 02/13] clk: sunxi: Add mod0 and mmc module clock support for A80 Chen-Yu Tsai
2015-01-14 16:28   ` Maxime Ripard
2015-01-15  2:34     ` Chen-Yu Tsai
2015-01-13  1:37 ` [PATCH v3 03/13] ARM: dts: sun9i: Add mmc module clock nodes " Chen-Yu Tsai
2015-01-14 16:30   ` Maxime Ripard
2015-01-13  1:37 ` [PATCH v3 04/13] clk: sunxi: Add driver for A80 MMC config clocks/resets Chen-Yu Tsai
2015-01-14 16:37   ` Maxime Ripard
2015-01-15  2:29     ` Chen-Yu Tsai
2015-01-13  1:37 ` [PATCH v3 05/13] ARM: dts: sun9i: Add clock-indices property for bus gate clocks Chen-Yu Tsai
2015-01-14 16:33   ` Maxime Ripard
2015-01-15  2:24     ` Chen-Yu Tsai
2015-01-15 15:20       ` Maxime Ripard
2015-01-15 15:35         ` [linux-sunxi] " Chen-Yu Tsai
2015-01-15 15:51           ` Maxime Ripard [this message]
2015-01-15 16:09             ` Chen-Yu Tsai
2015-01-15 21:46               ` Maxime Ripard
2015-01-13  1:37 ` [PATCH v3 06/13] ARM: dts: sun9i: Add mmc config clock nodes Chen-Yu Tsai
2015-01-14 16:38   ` Maxime Ripard
2015-01-13  1:37 ` [PATCH v3 07/13] ARM: dts: sunxi: Use label to reference pio in sunxi-common-regulators Chen-Yu Tsai
2015-01-14 16:39   ` Maxime Ripard
2015-01-13  1:37 ` [PATCH v3 08/13] ARM: dts: sun9i: Add mmc controller nodes to the A80 dtsi Chen-Yu Tsai
2015-01-13  1:37 ` [PATCH v3 09/13] ARM: dts: sun9i: Add pinmux setting for mmc0 Chen-Yu Tsai
2015-01-14 16:40   ` Maxime Ripard
2015-01-13  1:37 ` [PATCH v3 10/13] ARM: dts: sun9i: Convert a80 optimus board dts to label referencing Chen-Yu Tsai
2015-01-13  1:37 ` [PATCH v3 11/13] ARM: dts: sun9i: Enable mmc0 on A80 Optimus Board Chen-Yu Tsai
2015-01-13  1:37 ` [PATCH v3 12/13] ARM: dts: sun9i: Add 8 bit mmc pinmux setting for mmc2 Chen-Yu Tsai
2015-01-13  1:37 ` [PATCH v3 13/13] ARM: dts: sun9i: Enable mmc2 on A80 Optimus Board Chen-Yu Tsai

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=20150115155156.GA1837@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 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).