From patchwork Thu Sep 24 15:38:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yingjoe Chen X-Patchwork-Id: 54113 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 9222922DC2 for ; Thu, 24 Sep 2015 15:40:36 +0000 (UTC) Received: by lamf6 with SMTP id f6sf42578484lam.1 for ; Thu, 24 Sep 2015 08:40:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=DJbl8lKq+I009qH8OsP2eImLtAcgBF0yR5uxhraUl4Y=; b=K2iKGfUyXDXCOoLilxavxmES4m75vRQ/l1nB1wzH3KnSN+8LDYT65w66peE0Hm7J2w dOgSJbiZ9bAf6K1GOmx1+brAmp23MhzWJLWhgOEeCwm96yxLO3NxGksMllxRu3DUvRg5 hWXfyQfzWfcedCP9J9PPHqo9R5rLtnt0K/0/t35lby5cdmTfjhNLS9N12zioMttcM6B3 590E3ZJwjJQvbQpeXIrMPsAtULfLZgwOc2hHKrZpAs7TjgNBlIW5AzkJO5E3FdMrUfpW SgmcLc91JoaGgN5sJDQK+V4D1/NB2urLFTIJHsHiFBcA3TZFVp8IeJ6oGfUy0alfhY/D 4P1w== X-Gm-Message-State: ALoCoQkcXzX2DHe1KSVN1S9olKuW+NBbbrtCkXN3yWxBusHwjo6kl2+OCTrwzJiuynXMFOwc6Jr3 X-Received: by 10.180.208.108 with SMTP id md12mr76510wic.1.1443109235521; Thu, 24 Sep 2015 08:40:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.152.199 with SMTP id a190ls181114lfe.62.gmail; Thu, 24 Sep 2015 08:40:35 -0700 (PDT) X-Received: by 10.112.17.70 with SMTP id m6mr120694lbd.0.1443109235228; Thu, 24 Sep 2015 08:40:35 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id ge3si4968121lbc.33.2015.09.24.08.40.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Sep 2015 08:40:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lacao8 with SMTP id ao8so68201253lac.3 for ; Thu, 24 Sep 2015 08:40:34 -0700 (PDT) X-Received: by 10.152.5.170 with SMTP id t10mr100850lat.112.1443109234908; Thu, 24 Sep 2015 08:40:34 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp416429lbq; Thu, 24 Sep 2015 08:40:34 -0700 (PDT) X-Received: by 10.66.155.231 with SMTP id vz7mr443271pab.58.1443109233830; Thu, 24 Sep 2015 08:40:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cj4si19155798pbc.126.2015.09.24.08.40.33; Thu, 24 Sep 2015 08:40:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754417AbbIXPkc (ORCPT + 7 others); Thu, 24 Sep 2015 11:40:32 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:38185 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753350AbbIXPkb (ORCPT ); Thu, 24 Sep 2015 11:40:31 -0400 X-Listener-Flag: 11101 Received: from mtkhts09.mediatek.inc [(172.21.101.70)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1962741576; Thu, 24 Sep 2015 23:40:30 +0800 Received: from mtksdtcf02.mediatek.inc (10.21.12.142) by mtkhts09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.181.6; Thu, 24 Sep 2015 23:40:29 +0800 From: Yingjoe Chen To: Russell King - ARM Linux , Matthias Brugger CC: , Arnd Bergmann , Stephen Boyd , , Rob Herring , , Sascha Hauer , Olof Johansson , , , Yingjoe Chen Subject: [PATCH v4 1/5] ARM: mediatek: enable gpt6 on boot up to make arch timer working Date: Thu, 24 Sep 2015 23:38:56 +0800 Message-ID: <1443109140-5406-2-git-send-email-yingjoe.chen@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443109140-5406-1-git-send-email-yingjoe.chen@mediatek.com> References: <1443109140-5406-1-git-send-email-yingjoe.chen@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: yingjoe.chen@mediatek.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Matthias Brugger We enable GTP6 which ungates the arch timer clock. In the future this should be done in the bootloader. Signed-off-by: Matthias Brugger Signed-off-by: Yingjoe Chen --- 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 a954900..19dc738 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 +#define GPT_ENABLE 0x31 + +static void __init mediatek_timer_init(void) +{ + void __iomem *gpt_base; + + if (of_machine_is_compatible("mediatek,mt6589") || + of_machine_is_compatible("mediatek,mt8135") || + of_machine_is_compatible("mediatek,mt8127")) { + /* turn on GPT6 which ungates arch timer clocks */ + gpt_base = ioremap(GPT6_CON_MT65xx, 0x04); + + /* enable clock and set to free-run */ + writel(GPT_ENABLE, gpt_base); + iounmap(gpt_base); + } + + of_clk_init(NULL); + clocksource_of_init(); +}; static const char * const mediatek_board_dt_compat[] = { "mediatek,mt6589", @@ -27,4 +53,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