[PATCH 2/9] clocksource: ti-dm: make available in PBL

Daniel Lezcano daniel.lezcano at linaro.org
Tue Apr 29 06:09:21 PDT 2025


On 29/04/2025 11:31, Ahmad Fatoum wrote:
> Hello Daniel,
> 
> On 4/29/25 11:08, Daniel Lezcano wrote:
>> On Tue, Apr 22, 2025 at 07:26:28AM +0200, Ahmad Fatoum wrote:
>>> +int omap_dmtimer_init(void __iomem *mmio_start, unsigned clk_speed)
>>> +{
>>> +	base = mmio_start;
>>> +
>>> +	dmtimer_cs.mult = clocksource_hz2mult(clk_speed, dmtimer_cs.shift);
>>> +
>>> +	/* Enable counter */
>>> +	writel(0x3, base + TCLR);
>>> +
>>> +	return init_clock(&dmtimer_cs);
>>> +}
>>
>> Can you take the opportunity to fix the function prototype with the correct types 'u32' ?
> 
> Why is u32 more correct than unsigned? The value is not written to a
> register, but instead used as input to computing the multiplier.

It is to match the call to clocksource_hz2mult() which has a u32 as 
parameter.

>> And replacing the litteral 0x3 with a macro ?
> 
> Sure thing.
> 
> Thanks,
> Ahmad
> 
>>
>>> +
>>>   static int omap_dmtimer_probe(struct device *dev)
>>>   {
>>>   	struct resource *iores;
>>> @@ -90,12 +102,7 @@ static int omap_dmtimer_probe(struct device *dev)
>>>   	if (clk_speed < 0)
>>>   		return clk_speed;
>>>   
>>> -	dmtimer_cs.mult = clocksource_hz2mult(clk_speed, dmtimer_cs.shift);
>>> -
>>> -	/* Enable counter */
>>> -	writel(0x3, base + TCLR);
>>> -
>>> -	return init_clock(&dmtimer_cs);
>>> +	return omap_dmtimer_init(IOMEM(iores->start), clk_speed);
>>>   }
>>>   
>>>   static int am335x_get_clock(struct device *dev)
>>> diff --git a/include/mach/omap/am33xx-clock.h b/include/mach/omap/am33xx-clock.h
>>> index af47a0f3e77a..b064337ac4f8 100644
>>> --- a/include/mach/omap/am33xx-clock.h
>>> +++ b/include/mach/omap/am33xx-clock.h
>>> @@ -191,4 +191,7 @@ void am33xx_pll_init(int mpupll_M, int ddrpll_M);
>>>   void am33xx_enable_ddr_clocks(void);
>>>   int am33xx_get_osc_clock(void);
>>>   
>>> +int omap_dmtimer_init(void __iomem *mmio_start,
>>> +		      unsigned clk_speed);
>>> +
>>>   #endif  /* endif _AM33XX_CLOCKS_H_ */
>>> -- 
>>> 2.39.5
>>>
>>>
>>>
>>
> 


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog



More information about the barebox mailing list