From: Matthias Brugger <matthias.bgg@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux@arm.linux.org.uk, robh+dt@kernel.org, pawel.moll@arm.com,
mark.rutland@arm.com, ijc+devicetree@hellion.org.uk,
galak@codeaurora.org, olof@lixom.net, arnd@arndb.de,
jason@lakedaemon.net, thomas.petazzoni@free-electrons.com,
swarren@nvidia.com, sebastian.hesselbarth@gmail.com,
stefan@agner.ch, maxime.ripard@free-electrons.com,
matthias.bgg@gmail.com, anders.berg@lsi.com,
linus.walleij@linaro.org, heiko@sntech.de,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/7] arm: mediatek: enable gpt6 on boot up to make arch timer working
Date: Thu, 31 Jul 2014 18:42:22 +0200 [thread overview]
Message-ID: <1406824943-24052-7-git-send-email-matthias.bgg@gmail.com> (raw)
In-Reply-To: <1406824943-24052-1-git-send-email-matthias.bgg@gmail.com>
We enable GTP6 which ungates the arch timer clock. Apart we write the
frequency with which the timer is running in the CNTFREQ register.
In the future this should be done in the bootloader.
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
---
arch/arm/mach-mediatek/mediatek.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
index f2acf07..b7c5c60 100644
--- a/arch/arm/mach-mediatek/mediatek.c
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -16,6 +16,32 @@
*/
#include <linux/init.h>
#include <asm/mach/arch.h>
+#include <linux/of.h>
+#include <linux/clk-provider.h>
+#include <linux/clocksource.h>
+
+
+#define GPT6_CON_MT65xx 0x10008060
+
+static void __init mediatek_timer_init(void)
+{
+ static void __iomem *gpt_base;
+
+ if (of_machine_is_compatible("mediatek,mt6589")) {
+ /* set cntfreq register which is not done in bootloader */
+ asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (13000000));
+
+ /* turn on GPT6 which ungates arch timer clocks */
+ gpt_base = ioremap(GPT6_CON_MT65xx, 0x04);
+ }
+
+ /* enabel clock and set to free-run */
+ if (gpt_base)
+ writel(0x31, gpt_base);
+
+ of_clk_init(NULL);
+ clocksource_of_init();
+};
static const char * const mediatek_board_dt_compat[] = {
"mediatek,mt6589",
@@ -24,4 +50,5 @@ static const char * const mediatek_board_dt_compat[] = {
DT_MACHINE_START(MEDIATEK_DT, "Mediatek Cortex-A7 (Device Tree)")
.dt_compat = mediatek_board_dt_compat,
+ .init_time = mediatek_timer_init,
MACHINE_END
--
1.7.9.5
next prev parent reply other threads:[~2014-07-31 16:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-31 16:42 [PATCH 0/7] arm: mediatek: Add more basic features Matthias Brugger
2014-07-31 16:42 ` [PATCH 1/7] arm: dts: Build dtb for Mediatek board Matthias Brugger
2014-07-31 16:42 ` [PATCH 2/7] arm: multi_v7_defconfig: Enable Mediatek platform Matthias Brugger
2014-07-31 16:42 ` [PATCH 3/7] arm: dts: mt6589: Fix typo in GIC unit address Matthias Brugger
2014-07-31 16:42 ` [PATCH 4/7] arm: mediatek: Add earlyprintk support for mt6589 Matthias Brugger
2014-07-31 16:42 ` [PATCH 5/7] arm: dts: mt6589-aquaris5: Add boot argument earlyprintk Matthias Brugger
2014-07-31 16:42 ` Matthias Brugger [this message]
2014-08-11 7:15 ` [PATCH 6/7] arm: mediatek: enable gpt6 on boot up to make arch timer working Linus Walleij
2014-08-12 9:02 ` Matthias Brugger
[not found] ` <CABuKBe+Q3tnN0s22EMY-dK_6FeN_xN9SmrsW3dPONR6QDJ+V_w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-12 15:03 ` Rob Herring
2014-08-13 8:47 ` Linus Walleij
2014-08-13 9:29 ` Matthias Brugger
2014-10-24 13:53 ` Yingjoe Chen
2014-10-27 10:28 ` Matthias Brugger
2014-10-30 3:23 ` Yingjoe Chen
2014-10-30 9:01 ` Matthias Brugger
2014-08-14 2:24 ` Joe.C
2014-08-14 9:35 ` Matthias Brugger
2014-07-31 16:42 ` [PATCH 7/7] arm: dts: mt6589: Add arm arch timer node Matthias Brugger
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=1406824943-24052-7-git-send-email-matthias.bgg@gmail.com \
--to=matthias.bgg@gmail.com \
--cc=anders.berg@lsi.com \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=heiko@sntech.de \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jason@lakedaemon.net \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.rutland@arm.com \
--cc=maxime.ripard@free-electrons.com \
--cc=olof@lixom.net \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=sebastian.hesselbarth@gmail.com \
--cc=stefan@agner.ch \
--cc=swarren@nvidia.com \
--cc=thomas.petazzoni@free-electrons.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;
as well as URLs for NNTP newsgroup(s).