All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Couple of dmtimer fixes
@ 2015-03-17  1:14 ` Suman Anna
  0 siblings, 0 replies; 8+ messages in thread
From: Suman Anna @ 2015-03-17  1:14 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Paul Walmsley, linux-omap, linux-arm-kernel, Suman Anna

Hi Tony,

Please find couple of non-urgent fixes to the OMAP dmtimer driver.
The patches are based on 4.0-rc1.

The first patch is a fix for the issue I reported earlier on the
DRA7 dmtimer hwmod patches [1]. DRA7 has timers 13 through 16 disabled
in DT currently, and enabling any of them would cause a kernel hang.
This fix properly checks the pm_runtime_get_sync() calls in the OMAP
dmtimer driver irrespective of whether the hwmods are added or not.
In the case that they are not added, the runtime_pm calls should return
the value as returned from _od_fail_runtime_resume(), and the probe
should bail out properly fixing the boot hang.

Second patch is a minor fix that balances the pm_runtime_enable() call
in probe with pm_runtime_disable() call in remove, so that the devices
can be bound again properly after doing an unbind through sysfs.

regards
Suman

[1] http://marc.info/?l=linux-omap&m=142653933112526&w=2

Suman Anna (2):
  ARM: OMAP: dmtimer: check for pm_runtime_get_sync() failure
  ARM: OMAP: dmtimer: disable pm runtime on remove

 arch/arm/plat-omap/dmtimer.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

-- 
2.3.2


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

* [PATCH 0/2] Couple of dmtimer fixes
@ 2015-03-17  1:14 ` Suman Anna
  0 siblings, 0 replies; 8+ messages in thread
From: Suman Anna @ 2015-03-17  1:14 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Tony,

Please find couple of non-urgent fixes to the OMAP dmtimer driver.
The patches are based on 4.0-rc1.

The first patch is a fix for the issue I reported earlier on the
DRA7 dmtimer hwmod patches [1]. DRA7 has timers 13 through 16 disabled
in DT currently, and enabling any of them would cause a kernel hang.
This fix properly checks the pm_runtime_get_sync() calls in the OMAP
dmtimer driver irrespective of whether the hwmods are added or not.
In the case that they are not added, the runtime_pm calls should return
the value as returned from _od_fail_runtime_resume(), and the probe
should bail out properly fixing the boot hang.

Second patch is a minor fix that balances the pm_runtime_enable() call
in probe with pm_runtime_disable() call in remove, so that the devices
can be bound again properly after doing an unbind through sysfs.

regards
Suman

[1] http://marc.info/?l=linux-omap&m=142653933112526&w=2

Suman Anna (2):
  ARM: OMAP: dmtimer: check for pm_runtime_get_sync() failure
  ARM: OMAP: dmtimer: disable pm runtime on remove

 arch/arm/plat-omap/dmtimer.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

-- 
2.3.2

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

* [PATCH 1/2] ARM: OMAP: dmtimer: check for pm_runtime_get_sync() failure
  2015-03-17  1:14 ` Suman Anna
@ 2015-03-17  1:14   ` Suman Anna
  -1 siblings, 0 replies; 8+ messages in thread
From: Suman Anna @ 2015-03-17  1:14 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Paul Walmsley, linux-omap, linux-arm-kernel, Suman Anna

The current OMAP dmtimer probe does not check for the return
status of pm_runtime_get_sync() before initializing the timer
registers. Any timer with missing hwmod data would return a
failure here, and the access of registers without enabling the
clocks for the timer would trigger a l3_noc interrupt and a
kernel boot hang. Add proper checking so that the probe would
return a failure graciously without hanging the kernel boot.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 arch/arm/plat-omap/dmtimer.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index db10169a08de..f32c74c0e1de 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -799,6 +799,7 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	const struct of_device_id *match;
 	const struct dmtimer_platform_data *pdata;
+	int ret;
 
 	match = of_match_device(of_match_ptr(omap_timer_match), dev);
 	pdata = match ? match->data : dev->platform_data;
@@ -860,7 +861,12 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 	}
 
 	if (!timer->reserved) {
-		pm_runtime_get_sync(dev);
+		ret = pm_runtime_get_sync(dev);
+		if (ret < 0) {
+			dev_err(dev, "%s: pm_runtime_get_sync failed!\n",
+				__func__);
+			goto err_get_sync;
+		}
 		__omap_dm_timer_init_regs(timer);
 		pm_runtime_put(dev);
 	}
@@ -873,6 +879,11 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 	dev_dbg(dev, "Device Probed.\n");
 
 	return 0;
+
+err_get_sync:
+	pm_runtime_put_noidle(dev);
+	pm_runtime_disable(dev);
+	return ret;
 }
 
 /**
-- 
2.3.2


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

* [PATCH 1/2] ARM: OMAP: dmtimer: check for pm_runtime_get_sync() failure
@ 2015-03-17  1:14   ` Suman Anna
  0 siblings, 0 replies; 8+ messages in thread
From: Suman Anna @ 2015-03-17  1:14 UTC (permalink / raw)
  To: linux-arm-kernel

The current OMAP dmtimer probe does not check for the return
status of pm_runtime_get_sync() before initializing the timer
registers. Any timer with missing hwmod data would return a
failure here, and the access of registers without enabling the
clocks for the timer would trigger a l3_noc interrupt and a
kernel boot hang. Add proper checking so that the probe would
return a failure graciously without hanging the kernel boot.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 arch/arm/plat-omap/dmtimer.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index db10169a08de..f32c74c0e1de 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -799,6 +799,7 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	const struct of_device_id *match;
 	const struct dmtimer_platform_data *pdata;
+	int ret;
 
 	match = of_match_device(of_match_ptr(omap_timer_match), dev);
 	pdata = match ? match->data : dev->platform_data;
@@ -860,7 +861,12 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 	}
 
 	if (!timer->reserved) {
-		pm_runtime_get_sync(dev);
+		ret = pm_runtime_get_sync(dev);
+		if (ret < 0) {
+			dev_err(dev, "%s: pm_runtime_get_sync failed!\n",
+				__func__);
+			goto err_get_sync;
+		}
 		__omap_dm_timer_init_regs(timer);
 		pm_runtime_put(dev);
 	}
@@ -873,6 +879,11 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 	dev_dbg(dev, "Device Probed.\n");
 
 	return 0;
+
+err_get_sync:
+	pm_runtime_put_noidle(dev);
+	pm_runtime_disable(dev);
+	return ret;
 }
 
 /**
-- 
2.3.2

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

* [PATCH 2/2] ARM: OMAP: dmtimer: disable pm runtime on remove
  2015-03-17  1:14 ` Suman Anna
@ 2015-03-17  1:14   ` Suman Anna
  -1 siblings, 0 replies; 8+ messages in thread
From: Suman Anna @ 2015-03-17  1:14 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Paul Walmsley, linux-omap, linux-arm-kernel, Suman Anna

Disable the pm_runtime of the device upon remove. This is
added to balance the pm_runtime_enable() invoked in the probe.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 arch/arm/plat-omap/dmtimer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index f32c74c0e1de..8ca94d379bc3 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -910,6 +910,8 @@ static int omap_dm_timer_remove(struct platform_device *pdev)
 		}
 	spin_unlock_irqrestore(&dm_timer_lock, flags);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return ret;
 }
 
-- 
2.3.2


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

* [PATCH 2/2] ARM: OMAP: dmtimer: disable pm runtime on remove
@ 2015-03-17  1:14   ` Suman Anna
  0 siblings, 0 replies; 8+ messages in thread
From: Suman Anna @ 2015-03-17  1:14 UTC (permalink / raw)
  To: linux-arm-kernel

Disable the pm_runtime of the device upon remove. This is
added to balance the pm_runtime_enable() invoked in the probe.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 arch/arm/plat-omap/dmtimer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index f32c74c0e1de..8ca94d379bc3 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -910,6 +910,8 @@ static int omap_dm_timer_remove(struct platform_device *pdev)
 		}
 	spin_unlock_irqrestore(&dm_timer_lock, flags);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return ret;
 }
 
-- 
2.3.2

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

* Re: [PATCH 0/2] Couple of dmtimer fixes
  2015-03-17  1:14 ` Suman Anna
@ 2015-03-17 17:45   ` Tony Lindgren
  -1 siblings, 0 replies; 8+ messages in thread
From: Tony Lindgren @ 2015-03-17 17:45 UTC (permalink / raw)
  To: Suman Anna; +Cc: Paul Walmsley, linux-omap, linux-arm-kernel

* Suman Anna <s-anna@ti.com> [150316 18:14]:
> Hi Tony,
> 
> Please find couple of non-urgent fixes to the OMAP dmtimer driver.
> The patches are based on 4.0-rc1.
> 
> The first patch is a fix for the issue I reported earlier on the
> DRA7 dmtimer hwmod patches [1]. DRA7 has timers 13 through 16 disabled
> in DT currently, and enabling any of them would cause a kernel hang.
> This fix properly checks the pm_runtime_get_sync() calls in the OMAP
> dmtimer driver irrespective of whether the hwmods are added or not.
> In the case that they are not added, the runtime_pm calls should return
> the value as returned from _od_fail_runtime_resume(), and the probe
> should bail out properly fixing the boot hang.
> 
> Second patch is a minor fix that balances the pm_runtime_enable() call
> in probe with pm_runtime_disable() call in remove, so that the devices
> can be bound again properly after doing an unbind through sysfs.

OK thanks applying both into omap-for-v4.0/fixes.

Tony
 
> [1] http://marc.info/?l=linux-omap&m=142653933112526&w=2
> 
> Suman Anna (2):
>   ARM: OMAP: dmtimer: check for pm_runtime_get_sync() failure
>   ARM: OMAP: dmtimer: disable pm runtime on remove
> 
>  arch/arm/plat-omap/dmtimer.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> -- 
> 2.3.2
> 

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

* [PATCH 0/2] Couple of dmtimer fixes
@ 2015-03-17 17:45   ` Tony Lindgren
  0 siblings, 0 replies; 8+ messages in thread
From: Tony Lindgren @ 2015-03-17 17:45 UTC (permalink / raw)
  To: linux-arm-kernel

* Suman Anna <s-anna@ti.com> [150316 18:14]:
> Hi Tony,
> 
> Please find couple of non-urgent fixes to the OMAP dmtimer driver.
> The patches are based on 4.0-rc1.
> 
> The first patch is a fix for the issue I reported earlier on the
> DRA7 dmtimer hwmod patches [1]. DRA7 has timers 13 through 16 disabled
> in DT currently, and enabling any of them would cause a kernel hang.
> This fix properly checks the pm_runtime_get_sync() calls in the OMAP
> dmtimer driver irrespective of whether the hwmods are added or not.
> In the case that they are not added, the runtime_pm calls should return
> the value as returned from _od_fail_runtime_resume(), and the probe
> should bail out properly fixing the boot hang.
> 
> Second patch is a minor fix that balances the pm_runtime_enable() call
> in probe with pm_runtime_disable() call in remove, so that the devices
> can be bound again properly after doing an unbind through sysfs.

OK thanks applying both into omap-for-v4.0/fixes.

Tony
 
> [1] http://marc.info/?l=linux-omap&m=142653933112526&w=2
> 
> Suman Anna (2):
>   ARM: OMAP: dmtimer: check for pm_runtime_get_sync() failure
>   ARM: OMAP: dmtimer: disable pm runtime on remove
> 
>  arch/arm/plat-omap/dmtimer.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> -- 
> 2.3.2
> 

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

end of thread, other threads:[~2015-03-17 17:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17  1:14 [PATCH 0/2] Couple of dmtimer fixes Suman Anna
2015-03-17  1:14 ` Suman Anna
2015-03-17  1:14 ` [PATCH 1/2] ARM: OMAP: dmtimer: check for pm_runtime_get_sync() failure Suman Anna
2015-03-17  1:14   ` Suman Anna
2015-03-17  1:14 ` [PATCH 2/2] ARM: OMAP: dmtimer: disable pm runtime on remove Suman Anna
2015-03-17  1:14   ` Suman Anna
2015-03-17 17:45 ` [PATCH 0/2] Couple of dmtimer fixes Tony Lindgren
2015-03-17 17:45   ` Tony Lindgren

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.