From: Zhen Lei <thunder.leizhen@huawei.com>
To: Rob Herring <robh+dt@kernel.org>,
devicetree <devicetree@vger.kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Haojian Zhuang <haojian.zhuang@linaro.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Cc: Zhen Lei <thunder.leizhen@huawei.com>,
Libin <huawei.libin@huawei.com>,
Kefeng Wang <wangkefeng.wang@huawei.com>,
Jianguo Chen <chenjianguo3@huawei.com>
Subject: [PATCH v3 0/9] clocksource: sp804: add support for Hisilicon sp804 timer
Date: Fri, 18 Sep 2020 21:22:28 +0800 [thread overview]
Message-ID: <20200918132237.3552-1-thunder.leizhen@huawei.com> (raw)
v2 --> v3:
1. Move the marcos of Hisilicon 64-bit timer, such as HISI_TIMER_LOAD, from
"drivers/clocksource/timer-sp.h" into "drivers/clocksource/timer-sp804.c",
involved Patch7-8.
2. Because the DT binding of ARM SP-804 has been converted to json-schema recently,
so rewrote Patch9, it based on below patch
https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git/patch/?id=a85a4aa32ab9568751b7aff8bd33e1b44b1cd3a1
3. Other patches have no chnage.
v1 --> v2:
1. Split the Patch 3 of v1 into three patches: Patch 3-5
2. Change compatible "hisi,sp804" to "hisilicon,sp804" in Patch 7.
3. Add dt-binding description of "hisilicon,sp804", Patch 9
Other patches are not changed.
v1:
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
The register offset differences between ARM-SP804 and HISI-SP804 are as follows:
ARM-SP804 HISI-SP804
TIMER_LOAD 0x00 HISI_TIMER_LOAD 0x00
HISI_TIMER_LOAD_H 0x04
TIMER_VALUE 0x04 HISI_TIMER_VALUE 0x08
HISI_TIMER_VALUE_H 0x0c
TIMER_CTRL 0x08 HISI_TIMER_CTRL 0x10
TIMER_INTCLR 0x0c HISI_TIMER_INTCLR 0x14
TIMER_RIS 0x10 HISI_TIMER_RIS 0x18
TIMER_MIS 0x14 HISI_TIMER_MIS 0x1c
TIMER_BGLOAD 0x18 HISI_TIMER_BGLOAD 0x20
HISI_TIMER_BGLOAD_H 0x24
TIMER_2_BASE 0x20 HISI_TIMER_2_BASE 0x40
----------------
In order to make the timer-sp804 driver support both ARM-SP804 and HISI-SP804.
Create a new structure "sp804_clkevt" to record the calculated registers
address in advance, avoid judging and calculating the register address every
place that is used.
For example:
struct sp804_timer arm_sp804_timer = {
.ctrl = TIMER_CTRL,
};
struct sp804_timer hisi_sp804_timer = {
.ctrl = HISI_TIMER_CTRL,
};
struct sp804_clkevt clkevt;
In the initialization phase:
if (hisi_sp804)
clkevt.ctrl = base + hisi_sp804_timer.ctrl;
else if (arm_sp804)
clkevt.ctrl = base + arm_sp804_timer.ctrl;
After initialization:
- writel(0, base + TIMER_CTRL);
+ writel(0, clkevt.ctrl);
----------------
Additional information:
These patch series are the V2 of https://lore.kernel.org/patchwork/cover/681876/
And many of the main ideas in https://lore.kernel.org/patchwork/patch/681875/ have been considered.
Thanks for Daniel Lezcano's review comments.
Kefeng Wang (1):
clocksource: sp804: cleanup clk_get_sys()
Zhen Lei (8):
clocksource: sp804: remove unused sp804_timer_disable() and
timer-sp804.h
clocksource: sp804: delete the leading "__" of some functions
clocksource: sp804: remove a mismatched comment
clocksource: sp804: prepare for support non-standard register offset
clocksource: sp804: support non-standard register offset
clocksource: sp804: add support for Hisilicon sp804 timer
clocksource: sp804: enable Hisilicon sp804 timer 64bit mode
dt-bindings: sp804: add support for Hisilicon sp804 timer
.../devicetree/bindings/timer/arm,sp804.yaml | 7 +-
drivers/clocksource/timer-sp.h | 32 ++++
drivers/clocksource/timer-sp804.c | 210 ++++++++++++++-------
include/clocksource/timer-sp804.h | 29 ---
4 files changed, 185 insertions(+), 93 deletions(-)
delete mode 100644 include/clocksource/timer-sp804.h
--
1.8.3
next reply other threads:[~2020-09-18 13:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-18 13:22 Zhen Lei [this message]
2020-09-18 13:22 ` [PATCH v3 1/9] clocksource: sp804: cleanup clk_get_sys() Zhen Lei
2020-09-27 9:27 ` [tip: timers/core] clocksource/drivers/sp804: Cleanup clk_get_sys() tip-bot2 for Kefeng Wang
2020-09-18 13:22 ` [PATCH v3 2/9] clocksource: sp804: remove unused sp804_timer_disable() and timer-sp804.h Zhen Lei
2020-09-27 9:27 ` [tip: timers/core] clocksource/drivers/sp804: Remove " tip-bot2 for Zhen Lei
2020-09-18 13:22 ` [PATCH v3 3/9] clocksource: sp804: delete the leading "__" of some functions Zhen Lei
2020-09-27 9:27 ` [tip: timers/core] clocksource/drivers/sp804: Delete " tip-bot2 for Zhen Lei
2020-09-18 13:22 ` [PATCH v3 4/9] clocksource: sp804: remove a mismatched comment Zhen Lei
2020-09-27 9:27 ` [tip: timers/core] clocksource/drivers/sp804: Remove " tip-bot2 for Zhen Lei
2020-09-18 13:22 ` [PATCH v3 5/9] clocksource: sp804: prepare for support non-standard register offset Zhen Lei
2020-09-27 9:27 ` [tip: timers/core] clocksource/drivers/sp804: Prepare " tip-bot2 for Zhen Lei
2020-09-18 13:22 ` [PATCH v3 6/9] clocksource: sp804: " Zhen Lei
2020-09-27 9:27 ` [tip: timers/core] clocksource/drivers/sp804: Support " tip-bot2 for Zhen Lei
2020-09-18 13:22 ` [PATCH v3 7/9] clocksource: sp804: add support for Hisilicon sp804 timer Zhen Lei
2020-09-27 9:27 ` [tip: timers/core] clocksource/drivers/sp804: Add " tip-bot2 for Zhen Lei
2020-09-18 13:22 ` [PATCH v3 8/9] clocksource: sp804: enable Hisilicon sp804 timer 64bit mode Zhen Lei
2020-09-27 9:27 ` [tip: timers/core] clocksource/drivers/sp804: Enable " tip-bot2 for Zhen Lei
2020-09-18 13:22 ` [PATCH v3 9/9] dt-bindings: sp804: add support for Hisilicon sp804 timer Zhen Lei
2020-09-19 11:43 ` Daniel Lezcano
2020-09-19 12:36 ` Leizhen (ThunderTown)
2020-09-19 11:51 ` [PATCH v3 0/9] clocksource: " Daniel Lezcano
2020-09-19 12:19 ` Leizhen (ThunderTown)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200918132237.3552-1-thunder.leizhen@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=chenjianguo3@huawei.com \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=haojian.zhuang@linaro.org \
--cc=huawei.libin@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=tglx@linutronix.de \
--cc=wangkefeng.wang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®