Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

clocksource/drivers/vf-pit: Encapsulate the PTLCVAL macro

Pass the channel and the base address to the PITLCVAL macro so it is
possible to use multiple instances of the timer with the macro.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20250804152344.1109310-12-daniel.lezcano@linaro.org

+7 -7
+7 -7
drivers/clocksource/timer-vf-pit.c
··· 17 17 #define PIT0_OFFSET 0x100 18 18 #define PIT_CH(n) (PIT0_OFFSET + 0x10 * (n)) 19 19 20 - #define PITCVAL 0x04 21 - 22 20 #define PITMCR_MDIS BIT(1) 23 21 24 22 #define PITLDVAL(__base) (__base) 25 23 #define PITTCTRL(__base) ((__base) + 0x08) 24 + 25 + #define PITCVAL_OFFSET 0x04 26 + #define PITCVAL(__base) ((__base) + 0x04) 26 27 27 28 #define PITTCTRL_TEN BIT(0) 28 29 #define PITTCTRL_TIE BIT(1) ··· 40 39 struct clocksource cs; 41 40 }; 42 41 43 - static void __iomem *clksrc_base; 42 + static void __iomem *sched_clock_base; 44 43 45 44 static inline struct pit_timer *ced_to_pit(struct clock_event_device *ced) 46 45 { ··· 69 68 70 69 static u64 notrace pit_read_sched_clock(void) 71 70 { 72 - return ~readl(clksrc_base + PITCVAL); 71 + return ~readl(sched_clock_base); 73 72 } 74 73 75 74 static u64 pit_timer_clocksource_read(struct clocksource *cs) 76 75 { 77 76 struct pit_timer *pit = cs_to_pit(cs); 78 77 79 - return (u64)~readl(pit->clksrc_base + PITCVAL); 78 + return (u64)~readl(PITCVAL(pit->clksrc_base)); 80 79 } 81 80 82 81 static int __init pit_clocksource_init(struct pit_timer *pit, void __iomem *base, ··· 99 98 writel(~0, PITLDVAL(pit->clksrc_base)); 100 99 writel(PITTCTRL_TEN, PITTCTRL(pit->clksrc_base)); 101 100 102 - clksrc_base = pit->clksrc_base; 103 - 101 + sched_clock_base = pit->clksrc_base + PITCVAL_OFFSET; 104 102 sched_clock_register(pit_read_sched_clock, 32, rate); 105 103 106 104 return clocksource_register_hz(&pit->cs, rate);