All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cousson, Benoit" <b-cousson@ti.com>
To: Jon Hunter <jon-hunter@ti.com>, Ming Lei <ming.lei@canonical.com>
Cc: linux-omap <linux-omap@vger.kernel.org>,
	Will Deacon <will.deacon@arm.com>, Paul Walmsley <paul@pwsan.com>,
	Kevin Hilman <khilman@ti.com>
Subject: Re: [PATCH 2/6] arm: omap4: create pmu device via hwmod
Date: Thu, 10 May 2012 11:56:57 +0200	[thread overview]
Message-ID: <4FAB90E9.30408@ti.com> (raw)
In-Reply-To: <1336599343-10905-1-git-send-email-jon-hunter@ti.com>

Hi Jon & Ming,

On 5/9/2012 11:35 PM, Jon Hunter wrote:
> From: Ming Lei<ming.lei@canonical.com>
>
> The following modules is required to be enabled before configuring
> cross trigger interface for enabling pmu irq:
>
>          l3_instr, l3_main_3, debugss
>
> so build the arm-pmu device via the three hwmods.
>
> Cc: Ming Lei<ming.lei@canonical.com>
> Cc: Will Deacon<will.deacon@arm.com>
> Cc: Benoit Cousson<b-cousson@ti.com>
> Cc: Paul Walmsley<paul@pwsan.com>
> Cc: Kevin Hilman<khilman@ti.com>
>
> Signed-off-by: Ming Lei<ming.lei@canonical.com>
> Signed-off-by: Will Deacon<will.deacon@arm.com>
> Signed-off-by: Jon Hunter<jon-hunter@ti.com>
> ---
>   arch/arm/mach-omap2/devices.c |   61 ++++++++++++++++++++++++++++++++++++++---
>   1 files changed, 57 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
> index 58682d1..d75b7d3 100644
> --- a/arch/arm/mach-omap2/devices.c
> +++ b/arch/arm/mach-omap2/devices.c
> @@ -423,14 +423,67 @@ static struct platform_device omap_pmu_device = {
>   	.num_resources	= 1,
>   };
>
> -static void omap_init_pmu(void)
> +static struct arm_pmu_platdata omap4_pmu_data;
> +static struct omap_device_pm_latency omap_pmu_latency[] = {
> +	[0] = {
> +		.deactivate_func = omap_device_idle_hwmods,
> +		.activate_func   = omap_device_enable_hwmods,
> +		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
> +	},
> +};

You can get rid of that, and use a NULL value during 
omap_device_build_ss. It will use the default value automatically.

> +static struct platform_device* __init omap4_init_pmu(void)
>   {
> -	if (cpu_is_omap24xx())
> +	int id = -1;
> +	const char *hw;
> +	struct platform_device *pd;
> +	struct omap_hwmod* oh[3];
> +	char *dev_name = "arm-pmu";
> +
> +	hw = "l3_main_3";
> +	oh[0] = omap_hwmod_lookup(hw);
> +	if (!oh[0]) {
> +		pr_err("Could not look up %s hwmod\n", hw);
> +		return NULL;
> +	}
> +	hw = "l3_instr";
> +	oh[1] = omap_hwmod_lookup(hw);
> +	if (!oh[1]) {
> +		pr_err("Could not look up %s hwmod\n", hw);
> +		return NULL;
> +	}
> +	hw = "debugss";
> +	oh[2] = omap_hwmod_lookup(hw);
> +	if (!oh[2]) {
> +		pr_err("Could not look up %s hwmod\n", hw);
> +		return NULL;
> +	}
> +
> +	pd = omap_device_build_ss(dev_name, id, oh, 3,&omap4_pmu_data,
> +				sizeof(omap4_pmu_data),
> +				omap_pmu_latency,
> +				ARRAY_SIZE(omap_pmu_latency), 0);
> +	WARN(IS_ERR(pd), "Can't build omap_device for %s.\n",
> +				dev_name);
> +	return pd;
> +}
> +static void __init omap_init_pmu(void)
> +{
> +	if (cpu_is_omap24xx()) {
>   		omap_pmu_device.resource =&omap2_pmu_resource;

Ideally, OMAP2 and 3 should use the hwmod device creation as well.

Regards,
Benoit

> -	else if (cpu_is_omap34xx())
> +	} else if (cpu_is_omap34xx()) {
>   		omap_pmu_device.resource =&omap3_pmu_resource;
> -	else
> +	} else if (cpu_is_omap44xx()) {
> +		struct platform_device *pd;
> +
> +		pd = omap4_init_pmu();
> +		if (!pd)
> +			return;
> +		omap_device_enable(pd);
> +		return;
> +	} else {
>   		return;
> +	}
>
>   	platform_device_register(&omap_pmu_device);
>   }


  parent reply	other threads:[~2012-05-10  9:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-09 21:35 [PATCH 2/6] arm: omap4: create pmu device via hwmod Jon Hunter
2012-05-10  6:17 ` Shilimkar, Santosh
2012-05-10  9:56 ` Cousson, Benoit [this message]
2012-05-18 21:09   ` Jon Hunter
2012-05-21  9:52     ` Cousson, Benoit

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=4FAB90E9.30408@ti.com \
    --to=b-cousson@ti.com \
    --cc=jon-hunter@ti.com \
    --cc=khilman@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    --cc=paul@pwsan.com \
    --cc=will.deacon@arm.com \
    /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.