Skip to contentSkip to conversation

clocksource/drivers/timer-ti-dm: Don't fail probe if int not found

PATCH RESEND Superseded Judith Mendez 3 participants 4 messages Oct 10, 2024 – Oct 12, 2024 Clocksource, clockevent drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 clocksource/drivers/timer-ti-dm: Don't fail probe if int not found

Some timers may not have an interrupt routed to the A53 GIC, but the timer PWM functionality can still be used by Linux Kernel. Therefore, do not fail probe if interrupt is not found and ti,timer-pwm exists.

Fixes df28472a1b28 ("ARM: OMAP: dmtimer: platform driver")

---
Changes since v1:
- Rebased, add to CC list, add fixes tag

---
 drivers/clocksource/timer-ti-dm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/clocksource/timer-ti-dm.c +6 -2
index b7a34b1a975e..1b61fefed213 100644
@@ -1104,8 +1104,12 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 		return  -ENOMEM;
 
 	timer->irq = platform_get_irq(pdev, 0);
-	if (timer->irq < 0)
-		return timer->irq;
+	if (timer->irq < 0) {
+		if (of_property_read_bool(dev->of_node, "ti,timer-pwm"))
+			dev_err(dev, "Did not find timer interrupt, timer usable in PWM mode only\n");
+		else
+			return timer->irq;
+	}
 
 	timer->io_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(timer->io_base))

base-commit: d3d1556696c1a993eec54ac585fe5bf677e07474

Signature · 1 line
2.46.2
#1 lore raw

On October 10, 2024 thus sayeth Judith Mendez:

Quoted 19 lines

Some timers may not have an interrupt routed to the A53 GIC, but the timer PWM functionality can still be used by Linux Kernel. Therefore, do not fail probe if interrupt is not found and ti,timer-pwm exists.

Fixes df28472a1b28 ("ARM: OMAP: dmtimer: platform driver")

---
Changes since v1:
- Rebased, add to CC list, add fixes tag

---
 drivers/clocksource/timer-ti-dm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/clocksource/timer-ti-dm.c +0 -0
index b7a34b1a975e..1b61fefed213 100644

drivers/clocksource/timer-ti-dm.c static int omap_dm_timer_probe(struct platform_device *pdev) · line 1109

Quoted 8 lines
drivers/clocksource/timer-ti-dm.c +3 -2
@@ -1104,8 +1104,12 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 		return  -ENOMEM;
 
 	timer->irq = platform_get_irq(pdev, 0);
-	if (timer->irq < 0)
-		return timer->irq;
+	if (timer->irq < 0) {
+		if (of_property_read_bool(dev->of_node, "ti,timer-pwm"))
+			dev_err(dev, "Did not find timer interrupt, timer usable in PWM mode only\n");

Is this really an error? or more of a dev_info() type problem. It looks like we changed how we integrated the timer in K3 chips that broke some assumptions made in OMAP.

~Bryan

#2 lore raw

Hi Bryan,

Quoted 22 lines · Bryan Brattlof

On October 10, 2024 thus sayeth Judith Mendez:

Quoted 21 lines

Some timers may not have an interrupt routed to the A53 GIC, but the timer PWM functionality can still be used by Linux Kernel. Therefore, do not fail probe if interrupt is not found and ti,timer-pwm exists.

Fixes df28472a1b28 ("ARM: OMAP: dmtimer: platform driver")

---
Changes since v1:
- Rebased, add to CC list, add fixes tag

---
  drivers/clocksource/timer-ti-dm.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
drivers/clocksource/timer-ti-dm.c +0 -0
index b7a34b1a975e..1b61fefed213 100644
@@ -1104,8 +1104,12 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
  		return  -ENOMEM;
 
Quoted 10 lines

drivers/clocksource/timer-ti-dm.c static int omap_dm_timer_probe(struct platform_device *pdev) · line 1109

Quoted 6 lines
drivers/clocksource/timer-ti-dm.c +3 -2
  	timer->irq = platform_get_irq(pdev, 0);
-	if (timer->irq < 0)
-		return timer->irq;
+	if (timer->irq < 0) {
+		if (of_property_read_bool(dev->of_node, "ti,timer-pwm"))
+			dev_err(dev, "Did not find timer interrupt, timer usable in PWM mode only\n");

Is this really an error? or more of a dev_info() type problem. It looks like we changed how we integrated the timer in K3 chips that broke some assumptions made in OMAP.

I can switch to dev_info() no problem, thanks for reviewing!

~ Judith

Quoted 2 lines

~Bryan

#3 lore raw
In reply to Judith Mendez
Quoted 19 lines · Judith Mendez

Some timers may not have an interrupt routed to the A53 GIC, but the timer PWM functionality can still be used by Linux Kernel. Therefore, do not fail probe if interrupt is not found and ti,timer-pwm exists.

Fixes df28472a1b28 ("ARM: OMAP: dmtimer: platform driver")

---
Changes since v1:
- Rebased, add to CC list, add fixes tag

---
 drivers/clocksource/timer-ti-dm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/clocksource/timer-ti-dm.c +0 -0
index b7a34b1a975e..1b61fefed213 100644

drivers/clocksource/timer-ti-dm.c static int omap_dm_timer_probe(struct platform_device *pdev) · line 1108

Quoted 7 lines
drivers/clocksource/timer-ti-dm.c +2 -2
@@ -1104,8 +1104,12 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 		return  -ENOMEM;
 
 	timer->irq = platform_get_irq(pdev, 0);
-	if (timer->irq < 0)
-		return timer->irq;
+	if (timer->irq < 0) {
+		if (of_property_read_bool(dev->of_node, "ti,timer-pwm"))

nit: this propoery is read from the DT again just a bit lower. Rather than parse the DT for this property twice, can you move this after the DT properties are already parsed, and then just check for (timer->capability & OMAP_TIMER_HAS_PWM) ?

Kevin