[LINUX PATCH v2 1/3] clocksource: timer-cadence-ttc: Do not probe TTC device configured as PWM

Sayyed, Mubin mubin.sayyed at amd.com
Tue Nov 14 21:55:22 PST 2023


Hi,

> -----Original Message-----
> From: Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>
> Sent: Wednesday, November 15, 2023 2:41 AM
> To: Sayyed, Mubin <mubin.sayyed at amd.com>;
> krzysztof.kozlowski+dt at linaro.org; u.kleine-koenig at pengutronix.de;
> thierry.reding at gmail.com; robh+dt at kernel.org; conor+dt at kernel.org;
> tglx at linutronix.de; daniel.lezcano at linaro.org; Simek, Michal
> <michal.simek at amd.com>
> Cc: linux-arm-kernel at lists.infradead.org; linux-kernel at vger.kernel.org;
> devicetree at vger.kernel.org; linux-pwm at vger.kernel.org; git (AMD-Xilinx)
> <git at amd.com>; mubin10 at gmail.com
> Subject: Re: [LINUX PATCH v2 1/3] clocksource: timer-cadence-ttc: Do not
> probe TTC device configured as PWM
> 
> On 14/11/2023 13:47, Mubin Sayyed wrote:
> > TTC device can act either as clocksource/clockevent or PWM generator,
> > it would be decided by pwm-cells property.
> > TTC PWM feature would be supported through separate driver based on
> > PWM framework.
> >
> > If pwm-cells property is present in TTC node, it would be treated as
> > PWM device, and clocksource driver should just skip it.
> >
> > Signed-off-by: Mubin Sayyed <mubin.sayyed at amd.com>
> > ---
> > Changes for v2:
> >     - Added comment regarding pwm-cells property
> > ---
> >  drivers/clocksource/timer-cadence-ttc.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/clocksource/timer-cadence-ttc.c
> > b/drivers/clocksource/timer-cadence-ttc.c
> > index 32daaac9b132..f8fcb1a4bdd0 100644
> > --- a/drivers/clocksource/timer-cadence-ttc.c
> > +++ b/drivers/clocksource/timer-cadence-ttc.c
> > @@ -477,6 +477,13 @@ static int __init ttc_timer_probe(struct
> platform_device *pdev)
> >  	u32 timer_width = 16;
> >  	struct device_node *timer = pdev->dev.of_node;
> >
> > +	/*
> > +	 * If pwm-cells property is present in TTC node,
> > +	 * it would be treated as PWM device.
> > +	 */
> > +	if (of_property_read_bool(timer, "#pwm-cells"))
> > +		return -ENODEV;
> 
> You will introduce dmesg errors, so regressions.
> 
[Mubin]: I will change it to "return 0" to avoid dmesg errors.

> This does not look right. What you want is to bind one device driver and
> choose different functionality based on properties.
[Mubin]:  I am doing it based on earlier discussion related to AXI Timer PWM driver.  It was suggested to use #pwm-cells property for identifying role of device(PWM/clocksource) https://lore.kernel.org/linux-devicetree/20210513021631.GA878860@robh.at.kernel.org/. 
	
Thanks,
Mubin
> 
> Best regards,
> Krzysztof



More information about the linux-arm-kernel mailing list