From patchwork Thu Jul 31 16:42:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Brugger X-Patchwork-Id: 4657751 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 9EEF3C0338 for ; Thu, 31 Jul 2014 16:45:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D05192017A for ; Thu, 31 Jul 2014 16:45:56 +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 0E5A92015E for ; Thu, 31 Jul 2014 16:45:56 +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 1XCtSa-0000MM-3u; Thu, 31 Jul 2014 16:44:08 +0000 Received: from mail-we0-x22f.google.com ([2a00:1450:400c:c03::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XCtRf-00087A-Jg for linux-arm-kernel@lists.infradead.org; Thu, 31 Jul 2014 16:43:12 +0000 Received: by mail-we0-f175.google.com with SMTP id t60so3060939wes.6 for ; Thu, 31 Jul 2014 09:42:49 -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=NKlhbpQEyt8ujfhwFMLb2FqvRPMZq4tdXVdXbens4Aw=; b=AsdbzWSfF7uLEUXVK4s86eJuyJcnI+CP2zMtOSVpSDSkY1eBUO+7P5G/IS64E8NFIr ocdQvEGE8Q6sVgLg9zEJg78TP1wk1tsPbWfec7dK64PAuwg8/ZESzyR4QU63QaHB6PBL 0G3JbAq6cf592keOdi6em3Wa4+/97m2f5s5FYEg+fAr321N5wL0Zs3n/d2jmPaf2i37J YBJur9NAAZOwPSJHDuZe9zvQItEWj9AR2H9s0+YZeLqvrKY9XQ3ib1BOUjQbzpNzdrsr n3vmwfmTAsKnqKBud3zLptlfRdqVZDleIuYLEvQWBg5UyAvOq/b5kSSA+6KSRZAU3+P3 bg1g== X-Received: by 10.180.82.166 with SMTP id j6mr18413718wiy.71.1406824969069; Thu, 31 Jul 2014 09:42:49 -0700 (PDT) Received: from localhost.localdomain (146.Red-83-38-149.dynamicIP.rima-tde.net. [83.38.149.146]) by mx.google.com with ESMTPSA id t6sm22132732wib.4.2014.07.31.09.42.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Jul 2014 09:42:48 -0700 (PDT) From: Matthias Brugger To: linux-kernel@vger.kernel.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 Message-Id: <1406824943-24052-7-git-send-email-matthias.bgg@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1406824943-24052-1-git-send-email-matthias.bgg@gmail.com> References: <1406824943-24052-1-git-send-email-matthias.bgg@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140731_094311_808432_2415FD5D X-CRM114-Status: GOOD ( 13.98 ) X-Spam-Score: -0.8 (/) Cc: mark.rutland@arm.com, thomas.petazzoni@free-electrons.com, linux@arm.linux.org.uk, arnd@arndb.de, pawel.moll@arm.com, ijc+devicetree@hellion.org.uk, linus.walleij@linaro.org, heiko@sntech.de, stefan@agner.ch, matthias.bgg@gmail.com, devicetree@vger.kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, galak@codeaurora.org, olof@lixom.net, swarren@nvidia.com, maxime.ripard@free-electrons.com, sebastian.hesselbarth@gmail.com, anders.berg@lsi.com, jason@lakedaemon.net 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, 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 | 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 #include +#include +#include +#include + + +#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