All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-sh@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com>,
	cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Shawn Guo <shawn.guo@linaro.org>
Subject: Re: [PATCH] cpufreq-cpu0: support Device Tree initialisation
Date: Fri, 26 Jul 2013 07:20:26 -0500	[thread overview]
Message-ID: <51F2698A.5020904@ti.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1307261214430.22137@axis700.grange>

On 07/26/2013 05:19 AM, Guennadi Liakhovetski wrote:
> Currently the cpufreq-cpu0 driver doesn't support Device Tree probing. To
> support it we add an OF match table to it. In principle this alone is
> enough to get the driver working with DT devices, but then the driver
> rewrites the .of_node field of the probed device with a different one,
> which isn't clean. To avoid this we use the cpu0 system device for clock
> and OPP handling, similar to what the arm_big_little CPUFreq driver does.
> This is also less intrusive, since the cpu0 device's .of_node field is
> initially NULL, since this isn't a DT device.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> ---
>   drivers/cpufreq/cpufreq-cpu0.c |   14 +++++++++++---
>   1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> index ad1fde2..d2ad7b8 100644
> --- a/drivers/cpufreq/cpufreq-cpu0.c
> +++ b/drivers/cpufreq/cpufreq-cpu0.c
> @@ -12,6 +12,7 @@
>   #define pr_fmt(fmt)	KBUILD_MODNAME ": " fmt
>
>   #include <linux/clk.h>
> +#include <linux/cpu.h>
>   #include <linux/cpufreq.h>
>   #include <linux/err.h>
>   #include <linux/module.h>
> @@ -194,7 +195,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>   		goto out_put_parent;
>   	}
>
> -	cpu_dev = &pdev->dev;
> +	cpu_dev = get_cpu_device(0);
>   	cpu_dev->of_node = np;
>
>   	cpu_reg = devm_regulator_get(cpu_dev, "cpu0");
> @@ -289,10 +290,17 @@ static int cpu0_cpufreq_remove(struct platform_device *pdev)
>   	return 0;
>   }
>
> +static const struct of_device_id cpu0_cpufreq_of_match[] = {
> +	{.compatible = "cpufreq-cpu0"},
> +	{}
> +};
> +MODULE_DEVICE_TABLE(of, cpu0_cpufreq_of_match);
> +
>   static struct platform_driver cpu0_cpufreq_platdrv = {
>   	.driver = {
> -		.name	= "cpufreq-cpu0",
> -		.owner	= THIS_MODULE,
> +		.name		= "cpufreq-cpu0",
> +		.of_match_table	= cpu0_cpufreq_of_match,
> +		.owner		= THIS_MODULE,
>   	},
>   	.probe		= cpu0_cpufreq_probe,
>   	.remove		= cpu0_cpufreq_remove,
>
Did we not go down this approach[1] previously? Could you explain why 
this path is different now?


[1] http://marc.info/?t=136304320700004&r=1&w=2
-- 
Regards,
Nishanth Menon

WARNING: multiple messages have this Message-ID (diff)
From: Nishanth Menon <nm@ti.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-sh@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com>,
	cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Shawn Guo <shawn.guo@linaro.org>
Subject: Re: [PATCH] cpufreq-cpu0: support Device Tree initialisation
Date: Fri, 26 Jul 2013 12:20:26 +0000	[thread overview]
Message-ID: <51F2698A.5020904@ti.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1307261214430.22137@axis700.grange>

On 07/26/2013 05:19 AM, Guennadi Liakhovetski wrote:
> Currently the cpufreq-cpu0 driver doesn't support Device Tree probing. To
> support it we add an OF match table to it. In principle this alone is
> enough to get the driver working with DT devices, but then the driver
> rewrites the .of_node field of the probed device with a different one,
> which isn't clean. To avoid this we use the cpu0 system device for clock
> and OPP handling, similar to what the arm_big_little CPUFreq driver does.
> This is also less intrusive, since the cpu0 device's .of_node field is
> initially NULL, since this isn't a DT device.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> ---
>   drivers/cpufreq/cpufreq-cpu0.c |   14 +++++++++++---
>   1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> index ad1fde2..d2ad7b8 100644
> --- a/drivers/cpufreq/cpufreq-cpu0.c
> +++ b/drivers/cpufreq/cpufreq-cpu0.c
> @@ -12,6 +12,7 @@
>   #define pr_fmt(fmt)	KBUILD_MODNAME ": " fmt
>
>   #include <linux/clk.h>
> +#include <linux/cpu.h>
>   #include <linux/cpufreq.h>
>   #include <linux/err.h>
>   #include <linux/module.h>
> @@ -194,7 +195,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>   		goto out_put_parent;
>   	}
>
> -	cpu_dev = &pdev->dev;
> +	cpu_dev = get_cpu_device(0);
>   	cpu_dev->of_node = np;
>
>   	cpu_reg = devm_regulator_get(cpu_dev, "cpu0");
> @@ -289,10 +290,17 @@ static int cpu0_cpufreq_remove(struct platform_device *pdev)
>   	return 0;
>   }
>
> +static const struct of_device_id cpu0_cpufreq_of_match[] = {
> +	{.compatible = "cpufreq-cpu0"},
> +	{}
> +};
> +MODULE_DEVICE_TABLE(of, cpu0_cpufreq_of_match);
> +
>   static struct platform_driver cpu0_cpufreq_platdrv = {
>   	.driver = {
> -		.name	= "cpufreq-cpu0",
> -		.owner	= THIS_MODULE,
> +		.name		= "cpufreq-cpu0",
> +		.of_match_table	= cpu0_cpufreq_of_match,
> +		.owner		= THIS_MODULE,
>   	},
>   	.probe		= cpu0_cpufreq_probe,
>   	.remove		= cpu0_cpufreq_remove,
>
Did we not go down this approach[1] previously? Could you explain why 
this path is different now?


[1] http://marc.info/?t\x136304320700004&r=1&w=2
-- 
Regards,
Nishanth Menon

  reply	other threads:[~2013-07-26 12:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-26 10:19 [PATCH] cpufreq-cpu0: support Device Tree initialisation Guennadi Liakhovetski
2013-07-26 10:19 ` Guennadi Liakhovetski
2013-07-26 12:20 ` Nishanth Menon [this message]
2013-07-26 12:20   ` Nishanth Menon
2013-07-26 12:43   ` Guennadi Liakhovetski
2013-07-26 12:43     ` Guennadi Liakhovetski
2013-07-26 13:14     ` Nishanth Menon
2013-07-26 13:14       ` Nishanth Menon
2013-07-29  8:17       ` Viresh Kumar
2013-07-29  8:29         ` Viresh Kumar
2013-07-29  8:31         ` Guennadi Liakhovetski
2013-07-29  8:31           ` Guennadi Liakhovetski

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=51F2698A.5020904@ti.com \
    --to=nm@ti.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=rjw@sisk.pl \
    --cc=shawn.guo@linaro.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.