devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Matthias Brugger <matthias.bgg@gmail.com>
Cc: "thomas.petazzoni@free-electrons.com"
	<thomas.petazzoni@free-electrons.com>,
	"anders.berg@lsi.com" <anders.berg@lsi.com>,
	"linux@arm.linux.org.uk" <linux@arm.linux.org.uk>,
	"arnd@arndb.de" <arnd@arndb.de>, Pawel Moll <Pawel.Moll@arm.com>,
	"ijc+devicetree@hellion.org.uk" <ijc+devicetree@hellion.org.uk>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"srv_yingjoe.chen@mediatek.com" <srv_yingjoe.chen@mediatek.com>,
	"heiko@sntech.de" <heiko@sntech.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stefan@agner.ch" <stefan@agner.ch>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"galak@codeaurora.org" <galak@codeaurora.org>,
	"olof@lixom.net" <olof@lixom.net>,
	"swarren@nvidia.com" <swarren@nvidia.com>,
	"maxime.ripard@free-electrons.com"
	<maxime.ripard@free-electrons.com>,
	sebastian.hesselbart
Subject: Re: [PATCH v2 6/9] arm: mediatek: enable gpt6 on boot up to make arch timer working
Date: Mon, 18 Aug 2014 16:45:48 +0100	[thread overview]
Message-ID: <20140818154548.GA3302@leverpostej> (raw)
In-Reply-To: <1408373917-10002-7-git-send-email-matthias.bgg@gmail.com>

Hi Matthias,

On Mon, Aug 18, 2014 at 03:58:34PM +0100, Matthias Brugger wrote:
> We enable GTP6 which ungates the arch timer clock. Apart we write the
> frequency with which the timer is running in the CNTFREQ register.

We don't seem to set CNTFRQ below. Does it happen to have a consistent
value on current versions of the bootloader?

> In the future this should be done in the bootloader.

Do we know how far in the future that's likely to be?

What's the plan for this code when such a bootloader becomes available?

Thanks,
Mark.

> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
> ---
>  arch/arm/mach-mediatek/mediatek.c |   26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
> index f2acf07..2989f18 100644
> --- a/arch/arm/mach-mediatek/mediatek.c
> +++ b/arch/arm/mach-mediatek/mediatek.c
> @@ -16,6 +16,31 @@
>   */
>  #include <linux/init.h>
>  #include <asm/mach/arch.h>
> +#include <linux/of.h>
> +#include <linux/clk-provider.h>
> +#include <linux/clocksource.h>
> +
> +#define TIMER_CTRL_OP_FREERUN	0x30
> +#define TIMER_CTRL_ENABLE	0x01
> +
> +#define GPT6_CON_MT65xx 0x10008060
> +
> +static void __init mediatek_timer_init(void)
> +{
> +	static void __iomem *gpt_base;
> +
> +	if (of_machine_is_compatible("mediatek,mt6589")) {
> +		/* 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(TIMER_CTRL_OP_FREERUN | TIMER_CTRL_ENABLE, gpt_base);
> +
> +	of_clk_init(NULL);
> +	clocksource_of_init();
> +};
>  
>  static const char * const mediatek_board_dt_compat[] = {
>  	"mediatek,mt6589",
> @@ -24,4 +49,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
> 
> 

  reply	other threads:[~2014-08-18 15:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 14:58 [PATCH v2 0/9] arm: mediatek: Add more basic features Matthias Brugger
2014-08-18 14:58 ` [PATCH v2 1/9] arm: dts: Build dtb for Mediatek board Matthias Brugger
2014-08-18 14:58 ` [PATCH v2 2/9] arm: multi_v7_defconfig: Enable Mediatek platform Matthias Brugger
2014-08-18 14:58 ` [PATCH v2 3/9] arm: dts: mt6589: Fix typo in GIC unit address Matthias Brugger
2014-08-18 14:58 ` [PATCH v2 5/9] arm: dts: mt6589-aquaris5: Add boot argument earlyprintk Matthias Brugger
     [not found] ` <1408373917-10002-1-git-send-email-matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-18 14:58   ` [PATCH v2 4/9] arm: mediatek: Add earlyprintk support for mt6589 Matthias Brugger
2014-08-18 14:58   ` [PATCH v2 6/9] arm: mediatek: enable gpt6 on boot up to make arch timer working Matthias Brugger
2014-08-18 15:45     ` Mark Rutland [this message]
2014-08-21 10:38       ` Matthias Brugger
     [not found]         ` <CABuKBe+oVzQ9_Q__sULLQt8OvJ1Za_uA5x2aXSSQ6r8myvFqnA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-21 10:56           ` Mark Rutland
2014-08-18 14:58 ` [PATCH v2 7/9] arm: dts: mt6589: Add arm arch timer node Matthias Brugger
2014-08-18 14:58 ` [PATCH v2 8/9] arm: dts: mediatek: Add compatible property for aquaris5 Matthias Brugger
2014-08-18 14:58 ` [PATCH v2 9/9] arm: dts: mt6589: Change compatible string for GIC 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=20140818154548.GA3302@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=Pawel.Moll@arm.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=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=matthias.bgg@gmail.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=olof@lixom.net \
    --cc=robh+dt@kernel.org \
    --cc=srv_yingjoe.chen@mediatek.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).