]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
clocksource/drivers/sp804: Support non-standard register offset
authorZhen Lei <thunder.leizhen@huawei.com>
Fri, 18 Sep 2020 13:22:34 +0000 (21:22 +0800)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Thu, 24 Sep 2020 08:51:04 +0000 (10:51 +0200)
commit23c788cd48db9e2646fb5455f004e4a5626e4230
tree0dd3dde07bc62482898c2bc9529c515fd9347950
parente69aae713bef63b357d4ff85bcb3f8f63dbf4ba3
clocksource/drivers/sp804: Support non-standard register offset

The ARM SP804 supports a maximum of 32-bit counter, but Hisilicon extends
it to 64-bit. That means, the registers: TimerXload, TimerXValue and
TimerXBGLoad are 64bits, all other registers are the same as those in the
SP804. The driver code can be completely reused except that the register
offset is different.

Currently, we get a timer register address by: add the constant register
offset to the timer base address. e.g. "base + TIMER_CTRL". It can not be
dynamically adjusted at run time.

So create a new structure "sp804_timer" to record the original registers
offset, and create a new structure "sp804_clkevt" to record the
calculated registers address. So the "base + TIMER_CTRL" is changed to
"clkevt->ctrl", this will faster than "base + timer->ctrl".

For example:
struct sp804_timer arm_sp804_timer = {
.ctrl = TIMER_CTRL,
};

struct sp804_clkevt clkevt;

clkevt.ctrl = base + arm_sp804_timer.ctrl.

- writel(0, base + TIMER_CTRL);
+ writel(0, clkevt->ctrl);

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200918132237.3552-7-thunder.leizhen@huawei.com
drivers/clocksource/timer-sp.h
drivers/clocksource/timer-sp804.c