From patchwork Fri Oct 2 15:19:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yingjoe Chen X-Patchwork-Id: 54447 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 471A7218EF for ; Fri, 2 Oct 2015 15:20:21 +0000 (UTC) Received: by lana8 with SMTP id a8sf17931952lan.1 for ; Fri, 02 Oct 2015 08:20:20 -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=au7KuMZCLgUn9H0UDnHV9eJgxx73ZtF+3KzvKLzzZLY=; b=LX5+HKbeyWEDASDnCBNGkALB2uHFN+XEj/URr4yYiCTC9kAcT0rJQKikHfqxGP0h78 xZZSMJhmRwsWk6/zariLGPTa1zJU9FYkgzAEQz2PudNClx9sUUkutTFhuYsLNN8bh2MX x34QdwLGph/kKaGgKAo/Au1UPc1cpV8k/BIbIpuzcyfYV0K4uj34W/nYJYMSxFWvnY/n HNpppG8ORFw/tbh1bqe93FZmsDu/9/ctF2OLgN5eESLvYPlf6xdCsTLBpKAfk9zPGbV9 i7xarY013chbpGd6X2F4XleL0oFN9HhgRauNqoKB7j9RwKXnr5eXMFzw9AM92TmRaox9 hKMA== X-Gm-Message-State: ALoCoQku6fj2EluS9DgxNrZN27tV/lmqNfCHkrkYj6Q4A4np7bzxqkj5INJvwwzkkmnyWRIzicD0 X-Received: by 10.112.142.195 with SMTP id ry3mr2774579lbb.22.1443799220160; Fri, 02 Oct 2015 08:20:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.151.203 with SMTP id z194ls226034lfd.57.gmail; Fri, 02 Oct 2015 08:20:20 -0700 (PDT) X-Received: by 10.25.148.212 with SMTP id w203mr3843732lfd.71.1443799219987; Fri, 02 Oct 2015 08:20:19 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id xt10si6536970lbb.62.2015.10.02.08.20.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Oct 2015 08:20:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by laer8 with SMTP id r8so94317551lae.2 for ; Fri, 02 Oct 2015 08:20:19 -0700 (PDT) X-Received: by 10.112.163.131 with SMTP id yi3mr5913067lbb.36.1443799219733; Fri, 02 Oct 2015 08:20:19 -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 w3csp1309205lbq; Fri, 2 Oct 2015 08:20:17 -0700 (PDT) X-Received: by 10.66.165.106 with SMTP id yx10mr20994691pab.102.1443799217617; Fri, 02 Oct 2015 08:20:17 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vx7si17415160pab.139.2015.10.02.08.20.17; Fri, 02 Oct 2015 08:20:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 S1753227AbbJBPUO (ORCPT + 30 others); Fri, 2 Oct 2015 11:20:14 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:37723 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752080AbbJBPUK (ORCPT ); Fri, 2 Oct 2015 11:20:10 -0400 X-Listener-Flag: 11101 Received: from mtkhts07.mediatek.inc [(172.21.101.69)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1628091482; Fri, 02 Oct 2015 23:20:08 +0800 Received: from mtksdtcf02.mediatek.inc (10.21.12.142) by mtkhts07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.181.6; Fri, 2 Oct 2015 23:20:06 +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 v5 1/5] ARM: mediatek: enable gpt6 on boot up to make arch timer working Date: Fri, 2 Oct 2015 23:19:37 +0800 Message-ID: <1443799181-50409-2-git-send-email-yingjoe.chen@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443799181-50409-1-git-send-email-yingjoe.chen@mediatek.com> References: <1443799181-50409-1-git-send-email-yingjoe.chen@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@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.46 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