From patchwork Fri May 23 10:31:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 30718 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4FEEC20369 for ; Fri, 23 May 2014 10:38:00 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id m20sf15106407qcx.1 for ; Fri, 23 May 2014 03:38:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=+klSGE8G09WVUdrYsn0HHOKYQ4/XGXNkB7ty/qB4iIw=; b=Yvhsi1vMEvEHW/LEmnJVyhKAdzPRWHWRFMSON0zeOW4K+Fby/587mktjdefF8P+fH1 ZxBJV8PYTtoR4j94SFLsVlr8OlZf6mn2KqY6Hc0C9Zdd+sW2dDDK2N247WMmgZZbYt1B otUuKM0mGx3v8T8EbxfmJk5za5xlmKEm3BKmoTJCpy3F3MoibKvWsp+3JMf7cGQ01G0F 0NctQy90UdEpaCG/6oBbCGP9ycqyrMajYAd3xcOH8g35PShaNePa+5dR6EKUPwvTWnPG p3bQx0yTAtZ8nIWWYfJjS6AUFVl3ee1r/5KPJCx0Ss96T7ZagYSWuemxEKl07vIeG7xy JbmQ== X-Gm-Message-State: ALoCoQlX8dj2E/3CJiwbstxDw2b9raGw15MBTrUPGczdJgp07LnEUapKpneh9gQyDESqx8PSgDnE X-Received: by 10.224.90.2 with SMTP id g2mr1792307qam.1.1400841480065; Fri, 23 May 2014 03:38:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.107.97 with SMTP id g88ls1753703qgf.40.gmail; Fri, 23 May 2014 03:38:00 -0700 (PDT) X-Received: by 10.52.190.138 with SMTP id gq10mr319955vdc.47.1400841479949; Fri, 23 May 2014 03:37:59 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id u13si1394802vem.26.2014.05.23.03.37.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:37:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.179 as permitted sender) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id oy12so6008824veb.38 for ; Fri, 23 May 2014 03:37:59 -0700 (PDT) X-Received: by 10.52.164.237 with SMTP id yt13mr2926877vdb.18.1400841479865; Fri, 23 May 2014 03:37:59 -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.220.221.72 with SMTP id ib8csp20153vcb; Fri, 23 May 2014 03:37:59 -0700 (PDT) X-Received: by 10.68.89.4 with SMTP id bk4mr4503334pbb.153.1400841479113; Fri, 23 May 2014 03:37:59 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cd2si3282776pbb.90.2014.05.23.03.37.58 for ; Fri, 23 May 2014 03:37:58 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753241AbaEWKhu (ORCPT + 27 others); Fri, 23 May 2014 06:37:50 -0400 Received: from mail-we0-f172.google.com ([74.125.82.172]:37360 "EHLO mail-we0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753107AbaEWKct (ORCPT ); Fri, 23 May 2014 06:32:49 -0400 Received: by mail-we0-f172.google.com with SMTP id k48so4717042wev.3 for ; Fri, 23 May 2014 03:32:48 -0700 (PDT) X-Received: by 10.180.100.129 with SMTP id ey1mr2395815wib.60.1400841168759; Fri, 23 May 2014 03:32:48 -0700 (PDT) Received: from localhost.localdomain (AToulouse-654-1-404-187.w82-125.abo.wanadoo.fr. [82.125.3.187]) by mx.google.com with ESMTPSA id s9sm2200908wix.13.2014.05.23.03.32.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:32:47 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, mingo@kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 58/71] clocksource: sun5i: Add support for reset controller Date: Fri, 23 May 2014 12:31:38 +0200 Message-Id: <1400841111-6683-58-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400841111-6683-1-git-send-email-daniel.lezcano@linaro.org> References: <537F214C.8000700@linaro.org> <1400841111-6683-1-git-send-email-daniel.lezcano@linaro.org> 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: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.179 as permitted sender) smtp.mail=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: Maxime Ripard The Allwinner A31 that uses this timer has the timer IP asserted in reset. Add an optional reset property to the DT, and deassert the timer from reset if it's there. Signed-off-by: Maxime Ripard Signed-off-by: Daniel Lezcano --- .../bindings/timer/allwinner,sun5i-a13-hstimer.txt | 4 ++++ drivers/clocksource/timer-sun5i.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/timer/allwinner,sun5i-a13-hstimer.txt b/Documentation/devicetree/bindings/timer/allwinner,sun5i-a13-hstimer.txt index 7c26154..27cfc7d 100644 --- a/Documentation/devicetree/bindings/timer/allwinner,sun5i-a13-hstimer.txt +++ b/Documentation/devicetree/bindings/timer/allwinner,sun5i-a13-hstimer.txt @@ -9,6 +9,9 @@ Required properties: one) - clocks: phandle to the source clock (usually the AHB clock) +Optionnal properties: +- resets: phandle to a reset controller asserting the timer + Example: timer@01c60000 { @@ -19,4 +22,5 @@ timer@01c60000 { <0 53 1>, <0 54 1>; clocks = <&ahb1_gates 19>; + resets = <&ahb1rst 19>; }; diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c index deebcd6..0226844 100644 --- a/drivers/clocksource/timer-sun5i.c +++ b/drivers/clocksource/timer-sun5i.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -143,6 +144,7 @@ static u64 sun5i_timer_sched_read(void) static void __init sun5i_timer_init(struct device_node *node) { + struct reset_control *rstc; unsigned long rate; struct clk *clk; int ret, irq; @@ -162,6 +164,10 @@ static void __init sun5i_timer_init(struct device_node *node) clk_prepare_enable(clk); rate = clk_get_rate(clk); + rstc = of_reset_control_get(node, NULL); + if (!IS_ERR(rstc)) + reset_control_deassert(rstc); + writel(~0, timer_base + TIMER_INTVAL_LO_REG(1)); writel(TIMER_CTL_ENABLE | TIMER_CTL_RELOAD, timer_base + TIMER_CTL_REG(1));