public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/6] arm: omap4: create pmu device via hwmod
@ 2012-05-09 21:35 Jon Hunter
  2012-05-10  6:17 ` Shilimkar, Santosh
  2012-05-10  9:56 ` Cousson, Benoit
  0 siblings, 2 replies; 5+ messages in thread
From: Jon Hunter @ 2012-05-09 21:35 UTC (permalink / raw)
  To: linux-omap
  Cc: Ming Lei, Will Deacon, Benoit Cousson, Paul Walmsley,
	Kevin Hilman, Jon Hunter

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,
+	},
+};
+
+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;
-	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);
 }
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/6] arm: omap4: create pmu device via hwmod
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Shilimkar, Santosh @ 2012-05-10  6:17 UTC (permalink / raw)
  To: Jon Hunter
  Cc: linux-omap, Ming Lei, Will Deacon, Benoit Cousson, Paul Walmsley,
	Kevin Hilman

On Thu, May 10, 2012 at 3:05 AM, Jon Hunter <jon-hunter@ti.com> 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>
> ---
$subject:
s/arm: omap4: / ARM: OMAP4
To be consistent with rest of the series. Same comment for patch 1/6 as well

Rest of the patch is fine.

Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/6] arm: omap4: create pmu device via hwmod
  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
  2012-05-18 21:09   ` Jon Hunter
  1 sibling, 1 reply; 5+ messages in thread
From: Cousson, Benoit @ 2012-05-10  9:56 UTC (permalink / raw)
  To: Jon Hunter, Ming Lei; +Cc: linux-omap, Will Deacon, Paul Walmsley, Kevin Hilman

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);
>   }


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/6] arm: omap4: create pmu device via hwmod
  2012-05-10  9:56 ` Cousson, Benoit
@ 2012-05-18 21:09   ` Jon Hunter
  2012-05-21  9:52     ` Cousson, Benoit
  0 siblings, 1 reply; 5+ messages in thread
From: Jon Hunter @ 2012-05-18 21:09 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: Ming Lei, linux-omap, Will Deacon, Paul Walmsley, Kevin Hilman

Hi Benoit,

On 05/10/2012 04:56 AM, Cousson, Benoit wrote:
> 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.

I have removed this now for V2.

>> +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.

Do you know for OMAP2/3 what hwmods are needed for PMU support? Is it
just the MPU?

I see two options here for OMAP2/3 ...

1. Add the appropriate PMU interrupts to the MPU HWMOD and use the MPU
HWMOD to build the pmu device.
2. Create a new PMU HWMOD for OMAP2/3.

Please note that for 4460, I can get PMU to work without needing the EMU
PD if I use the PMU interrupts and not CTI. So this really simplifies
matters for 4460 (and 4470). For 4460 I have created the PMU device by
just using the MPU HWMOD and adding the PMU interrupts to the MPU HWMOD.

Cheers
Jon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/6] arm: omap4: create pmu device via hwmod
  2012-05-18 21:09   ` Jon Hunter
@ 2012-05-21  9:52     ` Cousson, Benoit
  0 siblings, 0 replies; 5+ messages in thread
From: Cousson, Benoit @ 2012-05-21  9:52 UTC (permalink / raw)
  To: Jon Hunter; +Cc: Ming Lei, linux-omap, Will Deacon, Paul Walmsley, Kevin Hilman

Hi Jon,

On 5/18/2012 11:09 PM, Jon Hunter wrote:
> Hi Benoit,
>
> On 05/10/2012 04:56 AM, Cousson, Benoit wrote:
>> 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.
>
> I have removed this now for V2.
>
>>> +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.
>
> Do you know for OMAP2/3 what hwmods are needed for PMU support? Is it
> just the MPU?

Well, in fact I don't have a clue, but I assume the same kind of DEBUGSS 
IPs should be there as well.

> I see two options here for OMAP2/3 ...
>
> 1. Add the appropriate PMU interrupts to the MPU HWMOD and use the MPU
> HWMOD to build the pmu device.
> 2. Create a new PMU HWMOD for OMAP2/3.

I don't really know how the PMU is accessible in OMAP2 & 3. If, it is 
via an internal MPU bus without any PRCM control, it will not worst 
adding a hwmod for it.

Benoit

> Please note that for 4460, I can get PMU to work without needing the EMU
> PD if I use the PMU interrupts and not CTI. So this really simplifies
> matters for 4460 (and 4470). For 4460 I have created the PMU device by
> just using the MPU HWMOD and adding the PMU interrupts to the MPU HWMOD.
>
> Cheers
> Jon


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-21  9:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2012-05-18 21:09   ` Jon Hunter
2012-05-21  9:52     ` Cousson, Benoit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox