Re: [PATCH v3 7/9] clocksource: realtek: Add timer driver for rtl-otto platforms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27/06/24 23:17, Marek Behún wrote:
> On Thu, 27 Jun 2024 16:33:15 +1200
> Chris Packham <chris.packham@xxxxxxxxxxxxxxxxxxx> wrote:
>
>> +/* Simple internal register functions */
>> +static inline void rttm_set_counter(void __iomem *base, unsigned int counter)
>> +{
>> +	iowrite32(counter, base + RTTM_CNT);
> These require #include <asm/io.h>
linux/io.h I'm guessing.
>> +/* Aggregated control functions for kernel clock framework */
>> +#define RTTM_DEBUG(base)			\
>> +	pr_debug("------------- %d %p\n",	\
>> +		 smp_processor_id(), base)
> #include <linux/printk.h>
ack
>> +static irqreturn_t rttm_timer_interrupt(int irq, void *dev_id)
>> +{
>> +	struct clock_event_device *clkevt = dev_id;
>> +	struct timer_of *to = to_timer_of(clkevt);
>> +
>> +	rttm_ack_irq(to->of_base.base);
>> +	RTTM_DEBUG(to->of_base.base);
>> +	clkevt->event_handler(clkevt);
> Although you include "timer-of.h", which includes clockchips.h, please
> do also explicit #include <linux/clockchips.h>
>
>> +	rttm_set_period(to->of_base.base, RTTM_TICKS_PER_SEC / HZ);
> HZ -> linux/jiffies.h, or maybe asm/param.h
ack
>> +static u64 rttm_read_clocksource(struct clocksource *cs)
>> +{
>> +	struct rttm_cs *rcs = container_of(cs, struct rttm_cs, cs);
>> +
>> +	return (u64)rttm_get_counter(rcs->to.of_base.base);
> Redundant cast to u64.
ack
>> +	rttm_enable_timer(rcs->to.of_base.base, RTTM_CTRL_TIMER,
>> +			  rcs->to.of_clk.rate / RTTM_TICKS_PER_SEC);
> Is this correct? Sometimes it makes sense to use DIV_ROUND_CLOSEST, but
> maybe not here.

It's OK for me because the Lexra bus clock is 175mhz so plain division 
works fine. The docs do say something about a configurable divisor but 
the range seems fairly limited so I don't think there's a specific need 
to use DIV_ROUND_CLOSEST.

>
>> +static u64 notrace rttm_read_clock(void)
>> +{
>> +	return (u64)rttm_get_counter(rttm_cs.to.of_base.base);
> Redundant cast to u64.
ack
>> +static int __init rttm_probe(struct device_node *np)
>> +{
>> +	int cpu, cpu_rollback;
> unsigned int?
ack
>> +	struct timer_of *to;
>> +	int clkidx = num_possible_cpus();
> linux/cpumask.h, unsigned int
ack
> Marek




[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux