public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: mturquette@linaro.org (Mike Turquette)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: clk: add clk-asm9260 driver
Date: Wed, 14 Jan 2015 15:02:17 -0800	[thread overview]
Message-ID: <20150114230217.22722.88458@quantum> (raw)
In-Reply-To: <1420707567-22760-2-git-send-email-linux@rempel-privat.de>

Quoting Oleksij Rempel (2015-01-08 00:59:27)
> diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c
> new file mode 100644
> index 0000000..6b1c220
> --- /dev/null
> +++ b/drivers/clk/clk-asm9260.c

<snip>

> +static const char *clk_names[] = {
> +       [REFCLK]        = "oscillator",
> +       [SYSPLL]        = "pll",
> +       [I2S0_MCLK]     = "i2s0_mclk",
> +       [I2S1_MCLK]     = "i2s1_mclk",
> +       [RTC_OSC]       = "rtc_osc",
> +       [USB_PLL]       = "usb_pll",
> +};

Why keep this list of names? Only clk_names[REFCLK] is used below and it
is overwritten by the name supplied by DT.

<snip>

> +static void __init asm9260_acc_init(struct device_node *np)
> +{
> +       struct clk *clk;
> +       u32 rate;
> +       int n;
> +       u32 accuracy = 0;
> +
> +       base = of_io_request_and_map(np, 0, np->name);
> +       if (!base)
> +               panic("%s: unable to map resource", np->name);
> +
> +       /* register pll */
> +       rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000;
> +
> +       clk_names[REFCLK] = of_clk_get_parent_name(np, 0);
> +       accuracy = clk_get_accuracy(__clk_lookup(clk_names[REFCLK]));
> +       clk = clk_register_fixed_rate_with_accuracy(NULL, clk_names[SYSPLL],
> +                       clk_names[REFCLK], 0, rate, accuracy);

This is different. Why do the PLLs inherit REFCLKs accuracy? Please see
__clk_recalc_accuracies in drivers/clk/clk.c if you haven't already. We
propagate accuracy through the clock tree already.

> +
> +       if (IS_ERR(clk))
> +               panic("%s: can't register REFCLK. Check DT!", np->name);
> +
> +       for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) {
> +               const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n];
> +
> +               mc->parent_names[0] = clk_names[REFCLK];
> +               clk = clk_register_mux_table(NULL, mc->name, mc->parent_names,
> +                               mc->num_parents, mc->flags, base + mc->offset,
> +                               0, mc->mask, 0, mc->table, &asm9260_clk_lock);
> +       }
> +
> +       /* clock mux gate cells */
> +       for (n = 0; n < ARRAY_SIZE(asm9260_mux_gates); n++) {
> +               const struct asm9260_gate_data *gd = &asm9260_mux_gates[n];
> +
> +               clk = clk_register_gate(NULL, gd->name,
> +                       gd->parent_name, gd->flags | CLK_SET_RATE_PARENT,
> +                       base + gd->reg, gd->bit_idx, 0, &asm9260_clk_lock);
> +       }
> +
> +       /* clock div cells */
> +       for (n = 0; n < ARRAY_SIZE(asm9260_div_clks); n++) {
> +               const struct asm9260_div_clk *dc = &asm9260_div_clks[n];
> +
> +               clks[dc->idx] = clk_register_divider(NULL, dc->name,
> +                               dc->parent_name, CLK_SET_RATE_PARENT,
> +                               base + dc->reg, 0, 8, CLK_DIVIDER_ONE_BASED,
> +                               &asm9260_clk_lock);
> +       }
> +
> +       /* clock ahb gate cells */
> +       for (n = 0; n < ARRAY_SIZE(asm9260_ahb_gates); n++) {
> +               const struct asm9260_gate_data *gd = &asm9260_ahb_gates[n];
> +
> +               clks[gd->idx] = clk_register_gate(NULL, gd->name,
> +                               gd->parent_name, gd->flags, base + gd->reg,
> +                               gd->bit_idx, 0, &asm9260_clk_lock);
> +       }
> +
> +       /* check for errors on leaf clocks */
> +       for (n = 0; n < MAX_CLKS; n++) {
> +               if (!IS_ERR(clks[n]))
> +                       continue;
> +
> +               pr_err("%s: Unable to register leaf clock %d\n",
> +                               np->full_name, n);
> +               goto fail;
> +       }
> +
> +       /* register clk-provider */
> +       clk_data.clks = clks;
> +       clk_data.clk_num = MAX_CLKS;
> +       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
> +       return;
> +fail:
> +       iounmap(base);
> +}
> +CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller",
> +               asm9260_acc_init);

Where is the DT binding definition for this clock provider?

Thanks,
Mike

  reply	other threads:[~2015-01-14 23:02 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21 10:40 [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel
2014-10-21 10:40 ` [PATCH v8 1/9] ARM: add mach-asm9260 Oleksij Rempel
2014-10-21 10:40 ` [PATCH v8 2/9] ARM: add lolevel debug support for asm9260 Oleksij Rempel
2014-10-21 10:40 ` [PATCH v8 3/9] ARM: clk: add clk-asm9260 driver Oleksij Rempel
2014-10-21 10:40 ` [PATCH v8 4/9] ARM: irqchip: mxs: prepare driver for HW with different offsets Oleksij Rempel
2014-10-21 10:40 ` [PATCH v8 5/9] ARM: irqchip: mxs: add Alpascale ASM9260 support Oleksij Rempel
2014-11-02  2:19   ` Jason Cooper
2014-11-04 13:03   ` Shawn Guo
2014-11-04 13:13     ` Russell King - ARM Linux
2014-11-04 13:15       ` Oleksij Rempel
2014-11-04 13:16     ` Oleksij Rempel
2014-11-04 19:12     ` [PATCH v2] " Oleksij Rempel
2014-11-04 20:20       ` Thomas Gleixner
2014-11-04 20:27         ` Oleksij Rempel
2014-11-04 21:13           ` Thomas Gleixner
2014-10-21 10:40 ` [PATCH v8 6/9] ARM: clocksource: add asm9260_timer driver Oleksij Rempel
2014-10-21 10:40 ` [PATCH v8 7/9] ARM: dts: add DT for Alphascale ASM9260 SoC Oleksij Rempel
2014-10-21 10:40 ` [PATCH v8 8/9] ARM: add alphascale,acc.txt bindings documentation Oleksij Rempel
2014-10-21 10:40 ` [PATCH v8 9/9] add Alphascale to vendor-prefixes.txt Oleksij Rempel
2014-10-26 14:39 ` [PATCH v8 0/9] initial suport for Alphascale ASM9260 Oleksij Rempel
2014-10-26 15:26   ` Thomas Gleixner
2014-11-02  2:11   ` Jason Cooper
2014-11-02  6:51     ` Oleksij Rempel
2014-11-02 18:31       ` Jason Cooper
2014-11-02 19:56         ` Oleksij Rempel
2014-11-02 20:34           ` Jason Cooper
2014-11-03 14:14             ` [PATCH v3 0/2] " Oleksij Rempel
2014-11-03 14:14               ` [PATCH v3 1/2] ARM: add mach-asm9260 Oleksij Rempel
2014-11-03 14:14               ` [PATCH v3 2/2] ARM: add lolevel debug support for asm9260 Oleksij Rempel
2014-11-03 14:46                 ` Rob Herring
2014-11-04  7:34                   ` [PATCH v4] " Oleksij Rempel
2014-11-24 11:08                     ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Oleksij Rempel
2014-11-24 11:08                       ` [PATCH v4 1/2] ARM: add mach-asm9260 Oleksij Rempel
2014-11-24 11:08                       ` [PATCH v4 2/2] ARM: add lolevel debug support for asm9260 Oleksij Rempel
2014-11-28 14:09                       ` [PATCH v4 0/2] initial suport for Alphascale ASM9260 Arnd Bergmann
2014-11-28 14:13                         ` Oleksij Rempel
2014-11-28 15:05                         ` [PATCH] suport for Alphascale ASM9260, part 2 Oleksij Rempel
2014-11-28 15:05                           ` [PATCH] ARM: clk: add clk-asm9260 driver Oleksij Rempel
2014-11-28 16:34                           ` [PATCH] suport for Alphascale ASM9260, part 2 Arnd Bergmann
2015-01-08  8:59                           ` [PATCH] clk support for Alphascale asm9260 Oleksij Rempel
2015-01-08  8:59                             ` [PATCH] ARM: clk: add clk-asm9260 driver Oleksij Rempel
2015-01-14 23:02                               ` Mike Turquette [this message]
2015-01-15  9:45                                 ` Oleksij Rempel
2015-01-19 17:22                                   ` Mike Turquette
2014-11-28 16:50                         ` [PATCH 0/2] suport for Alphascale ASM9260, part 3 Oleksij Rempel
2014-11-28 16:50                           ` [PATCH 1/2] ARM: irqchip: mxs: prepare driver for HW with different offsets Oleksij Rempel
2014-11-28 16:50                           ` [PATCH 2/2] ARM: irqchip: mxs: add Alpascale ASM9260 support Oleksij Rempel
2015-09-17 13:17                             ` Oleksij Rempel
2015-09-17 14:29                               ` Thomas Gleixner
2015-01-08  9:01                           ` [PATCH 0/2] suport for Alphascale ASM9260, part 3 Oleksij Rempel
2014-11-28 16:54                         ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel
2014-11-28 16:54                           ` [PATCH 1/4] ARM: clocksource: add asm9260_timer driver Oleksij Rempel
2015-01-08  9:07                             ` [PATCH] clocksource driver for Alphascale asm9260 Oleksij Rempel
2015-01-08  9:07                               ` [PATCH] ARM: clocksource: add asm9260_timer driver Oleksij Rempel
2015-01-20 13:56                                 ` Daniel Lezcano
2014-11-28 16:54                           ` [PATCH 2/4] ARM: dts: add DT for Alphascale ASM9260 SoC Oleksij Rempel
2014-11-28 16:54                           ` [PATCH 3/4] ARM: add alphascale,acc.txt bindings documentation Oleksij Rempel
2014-11-28 16:54                           ` [PATCH 4/4] add Alphascale to vendor-prefixes.txt Oleksij Rempel
2015-01-06 11:06                           ` [PATCH 0/4] suport for Alphascale ASM9260, part 4 Oleksij Rempel
2015-01-06 14:11                             ` Arnd Bergmann
2015-01-08  9:16                               ` [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 Oleksij Rempel
2015-01-08  9:16                                 ` [PATCH 1/3] ARM: dts: add DT for Alphascale ASM9260 SoC Oleksij Rempel
2015-01-08  9:16                                 ` [PATCH 2/3] ARM: add alphascale,acc.txt bindings documentation Oleksij Rempel
2015-01-08  9:16                                 ` [PATCH 3/3] add Alphascale to vendor-prefixes.txt Oleksij Rempel
2015-01-20  0:30                                 ` [PATCH 0/3] [MERGE REQUEST] DT support for Alphascale asm9260 Olof Johansson
2015-01-20  9:19                                   ` Oleksij Rempel
2014-11-05  7:13                   ` [PATCH v3 2/2] ARM: add lolevel debug support for asm9260 Oleksij Rempel

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=20150114230217.22722.88458@quantum \
    --to=mturquette@linaro.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