public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: emilio@elopez•com.ar (Emilio López)
To: linux-arm-kernel@lists•infradead.org
Subject: [linux-sunxi] [PATCH v2 1/5] clk: sunxi: Add support for USB clock-register reset bits
Date: Tue, 28 Jan 2014 16:38:46 -0300	[thread overview]
Message-ID: <52E80746.9020500@elopez.com.ar> (raw)
In-Reply-To: <1390426587-16287-2-git-send-email-hdegoede@redhat.com>

Hi Hans,

El 22/01/14 18:36, Hans de Goede escribi?:
> The usb-clk register is special in that it not only contains clk gate bits,
> but also has a few reset bits. This commit adds support for this by allowing
> gates type sunxi clks to also register a reset controller.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat•com>
> ---
(snip)
>   static const struct gates_data sun4i_axi_gates_data __initconst = {
> @@ -818,6 +873,7 @@ static void __init sunxi_gates_clk_setup(struct device_node *node,
>   					 struct gates_data *data)
>   {
>   	struct clk_onecell_data *clk_data;
> +	struct gates_reset_data *reset_data;
>   	const char *clk_parent;
>   	const char *clk_name;
>   	void *reg;
> @@ -861,6 +917,21 @@ static void __init sunxi_gates_clk_setup(struct device_node *node,
>   	clk_data->clk_num = i;
>
>   	of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
> +
> +	/* Register a reset controler for gates with reset bits */
> +	if (data->reset_mask == 0)
> +		return;
> +
> +	reset_data = kzalloc(sizeof(*reset_data), GFP_KERNEL);
> +	if (!reset_data)
> +		return;
> +
> +	reset_data->reg = reg;
> +	reset_data->lock = &clk_lock;
> +	reset_data->rcdev.nr_resets = hweight32(data->reset_mask);

I know I made you change this, but after having a second look into 
nr_resets, I think your original implementation makes more sense. This 
will break if you use a mask with holes on it. Sorry :(

> +	reset_data->rcdev.ops = &sunxi_gates_reset_ops;
> +	reset_data->rcdev.of_node = node;
> +	reset_controller_register(&reset_data->rcdev);
>   }

Emilio

  reply	other threads:[~2014-01-28 19:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-22 21:36 [PATCH v2 0/5] clk: sunxi: Add support for USB clocks and reset bits Hans de Goede
2014-01-22 21:36 ` [PATCH v2 1/5] clk: sunxi: Add support for USB clock-register " Hans de Goede
2014-01-28 19:38   ` Emilio López [this message]
2014-02-06 16:58     ` [linux-sunxi] " Hans de Goede
2014-01-22 21:36 ` [PATCH v2 2/5] clk: sunxi: Add USB clock register defintions Hans de Goede
2014-01-27 14:43   ` Maxime Ripard
2014-01-27 14:54     ` Hans de Goede
2014-01-28  9:44       ` Maxime Ripard
2014-01-28 10:00         ` Hans de Goede
2014-02-04  9:40           ` Maxime Ripard
2014-02-04 10:14             ` Hans de Goede
2014-02-07 13:48               ` Maxime Ripard
2014-02-07 13:53                 ` Hans de Goede
2014-01-22 21:36 ` [PATCH v2 3/5] ARM: sun4i: dt: Add bindings for USB clocks Hans de Goede
2014-01-22 21:36 ` [PATCH v2 4/5] ARM: sun5i: " Hans de Goede
2014-01-22 21:36 ` [PATCH v2 5/5] ARM: sun7i: " Hans de Goede
2014-01-27 14:45 ` [PATCH v2 0/5] clk: sunxi: Add support for USB clocks and reset bits 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=52E80746.9020500@elopez.com.ar \
    --to=emilio@elopez$(echo .)com.ar \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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