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

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Apr 29 02:31:22 PDT 2025


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.

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

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list