From patchwork Mon Aug 18 14:58:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Brugger X-Patchwork-Id: 4737471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E5C5AC0338 for ; Mon, 18 Aug 2014 15:05:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CEEB22011D for ; Mon, 18 Aug 2014 15:05:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0EBA120120 for ; Mon, 18 Aug 2014 15:05:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJOPh-0002Ix-GW; Mon, 18 Aug 2014 15:00:01 +0000 Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJOP8-0001wN-Ba for linux-arm-kernel@lists.infradead.org; Mon, 18 Aug 2014 14:59:26 +0000 Received: by mail-wi0-f174.google.com with SMTP id d1so3873167wiv.1 for ; Mon, 18 Aug 2014 07:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=f7AVfyHXdmTn4VKCpb0ItfzpYA9Dz+UP0SB0kqGUeMo=; b=t3FT+yF7jrG+Wr4r+oRNswfuo3E0nvaxn02jPqOnJS+efwvCIXfQCr5rke0ldK+2ld LvwMfSoG4oiTJKkBVCvHk1Sty/qmTUq4IIxu9AACu0peYFAt6py2bat9qIpBD2DlHduR H6OF1gr4o8NocODXDJg9DY1eO9RMDJE+eziqB0JGd09/1HSYZxmxSNPOdP/6XAiMskQH m902UjhepLRQ8pOgd0kziMb6JmSuD3N8t/VfJ+DDeOrA2SRqjRXZtRXcNRDk6vN4djo8 uesP/Zz+Uli4z48Lyp6/zsVeAvhDuT0uHlkgDsoAcp+uLmUjwVg51PHHkpKhwCzsOScO IpDQ== X-Received: by 10.194.57.67 with SMTP id g3mr10957983wjq.60.1408373944024; Mon, 18 Aug 2014 07:59:04 -0700 (PDT) Received: from localhost.localdomain (72.Red-81-33-165.dynamicIP.rima-tde.net. [81.33.165.72]) by mx.google.com with ESMTPSA id u10sm38675326wix.14.2014.08.18.07.59.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Aug 2014 07:59:03 -0700 (PDT) From: Matthias Brugger To: linux-kernel@vger.kernel.org Subject: [PATCH v2 6/9] arm: mediatek: enable gpt6 on boot up to make arch timer working Date: Mon, 18 Aug 2014 16:58:34 +0200 Message-Id: <1408373917-10002-7-git-send-email-matthias.bgg@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1408373917-10002-1-git-send-email-matthias.bgg@gmail.com> References: <1408373917-10002-1-git-send-email-matthias.bgg@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140818_075926_567905_6C709CC5 X-CRM114-Status: GOOD ( 13.68 ) X-Spam-Score: -0.1 (/) Cc: mark.rutland@arm.com, heiko@sntech.de, anders.berg@lsi.com, linus.walleij@linaro.org, stefan@agner.ch, lee.jones@linaro.org, linux@arm.linux.org.uk, pawel.moll@arm.com, srv_yingjoe.chen@mediatek.com, sebastian.hesselbarth@gmail.com, devicetree@vger.kernel.org, jason@lakedaemon.net, arnd@arndb.de, ijc+devicetree@hellion.org.uk, robh+dt@kernel.org, matthias.bgg@gmail.com, swarren@nvidia.com, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, galak@codeaurora.org, olof@lixom.net, maxime.ripard@free-electrons.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 #include +#include +#include +#include + +#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