All of lore.kernel.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

WARNING: multiple messages have this Message-ID (diff)
From: "Emilio López" <emilio-0Z03zUJReD5OxF6Tv1QG9Q@public.gmane.org>
To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	Emilio Lopez <emilio-0Z03zUJReD5OxF6Tv1QG9Q@public.gmane.org>
Cc: Mike Turquette
	<mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Philipp Zabel
	<philipp.zabel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [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-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

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-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
(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

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.

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

Thread overview: 34+ 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 ` 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-22 21:36   ` Hans de Goede
2014-01-28 19:38   ` Emilio López [this message]
2014-01-28 19:38     ` Emilio López
2014-02-06 16:58     ` [linux-sunxi] " Hans de Goede
2014-02-06 16:58       ` Hans de Goede
2014-01-22 21:36 ` [PATCH v2 2/5] clk: sunxi: Add USB clock register defintions Hans de Goede
2014-01-22 21:36   ` Hans de Goede
2014-01-27 14:43   ` Maxime Ripard
2014-01-27 14:43     ` Maxime Ripard
2014-01-27 14:54     ` Hans de Goede
2014-01-27 14:54       ` Hans de Goede
2014-01-28  9:44       ` Maxime Ripard
2014-01-28  9:44         ` Maxime Ripard
2014-01-28 10:00         ` Hans de Goede
2014-01-28 10:00           ` Hans de Goede
2014-02-04  9:40           ` Maxime Ripard
2014-02-04  9:40             ` Maxime Ripard
2014-02-04 10:14             ` Hans de Goede
2014-02-04 10:14               ` Hans de Goede
2014-02-07 13:48               ` Maxime Ripard
2014-02-07 13:48                 ` Maxime Ripard
2014-02-07 13:53                 ` Hans de Goede
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   ` Hans de Goede
2014-01-22 21:36 ` [PATCH v2 4/5] ARM: sun5i: " Hans de Goede
2014-01-22 21:36   ` Hans de Goede
2014-01-22 21:36 ` [PATCH v2 5/5] ARM: sun7i: " Hans de Goede
2014-01-22 21:36   ` Hans de Goede
2014-01-27 14:45 ` [PATCH v2 0/5] clk: sunxi: Add support for USB clocks and reset bits Maxime Ripard
2014-01-27 14:45   ` 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.com.ar \
    --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.