From patchwork Mon May 30 23:28:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 68856 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1640722qge; Mon, 30 May 2016 16:29:00 -0700 (PDT) X-Received: by 10.98.100.83 with SMTP id y80mr50553993pfb.84.1464650940193; Mon, 30 May 2016 16:29:00 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yj10si40988685pac.31.2016.05.30.16.28.59; Mon, 30 May 2016 16:29:00 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162237AbcE3X26 (ORCPT + 30 others); Mon, 30 May 2016 19:28:58 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:37468 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161966AbcE3X2y (ORCPT ); Mon, 30 May 2016 19:28:54 -0400 Received: by mail-wm0-f44.google.com with SMTP id z87so86381089wmh.0 for ; Mon, 30 May 2016 16:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=B5Ul7hLCH01k0CIvCnxB2tiXNUj6iBOUWfQZHHb7r60=; b=iJ5kq7BFX9HyqOeY13q9iEfVIUrC2RCJjFXpZ7HTsl7/f+Fg9lEVNNWmvzYF3j/LqV IX9BybIxr148ZIFE6OU7k0eKPnhYKU/2AzyZNhv1hSZ+RN4OUdiyZR27Kuu3WMIif7Dn bXF6Fx4DO+/Kq3Je6aBnay2NNQfeGRF9St0QY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=B5Ul7hLCH01k0CIvCnxB2tiXNUj6iBOUWfQZHHb7r60=; b=bXRlLXSKRbU4nms/Kmf2SZXWOnHjQakPeDifde/gowLDEFn9nmC0JM1SKogtYXUvL/ lrzs+iN1cMl38WBQs68J2chKgQWLYso7n2CHfMmz0FCkihAl8Hm8RFEPO6WMxu+flxzc cYlkSkRDavvHYxeks5xGjcT6FqY8NabjIPRErdTFCYTpfn9MCZ8jMT5JiBUvCSUWA2+5 bEA363jO6Idm/i5IM9gE02Ykkj67ZMXmE+tjgRaHkQKxqClJY81kJRXMssU6VsvL7ORW TteyCpbGKZqOPn04HNOmFvEwFLBXgJglhgsTCsKbzCNuiOuTUyZhJ11eIotpLgEyDX/+ UbmA== X-Gm-Message-State: ALyK8tLVR68YgfiqVEQ6wK+Lq2h61qReRBq+7Ms/wjvILTZak43Yw6+wX3LwefT+4qCPOCvg X-Received: by 10.28.139.208 with SMTP id n199mr12855623wmd.68.1464650933429; Mon, 30 May 2016 16:28:53 -0700 (PDT) Received: from ?IPv6:2a01:e34:ed2f:f020:e8cf:80c1:101:fef4? ([2a01:e34:ed2f:f020:e8cf:80c1:101:fef4]) by smtp.googlemail.com with ESMTPSA id 63sm26150479wmz.5.2016.05.30.16.28.52 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 May 2016 16:28:52 -0700 (PDT) Subject: Re: [PATCH 4/5] clocksource: rockchip: add support for rk3399 SoC To: Caesar Wang , Heiko Stuebner References: <1464169802-6033-1-git-send-email-wxt@rock-chips.com> <1464169802-6033-5-git-send-email-wxt@rock-chips.com> Cc: dianders@chromium.org, briannorris@google.com, smbarber@google.com, linux-rockchip@lists.infradead.org, Thomas Gleixner , cf@rock-chips.com, huangtao@rock-chips.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Daniel Lezcano Message-ID: <574CCCB4.1030001@linaro.org> Date: Tue, 31 May 2016 01:28:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1464169802-6033-5-git-send-email-wxt@rock-chips.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/25/2016 11:50 AM, Caesar Wang wrote: > From: Huang Tao > > The CONTROL register offset is different from old SoCs. > For Linux driver, there are not functional changes at all. > Let's call it v2. > > Signed-off-by: Huang Tao > Cc: Daniel Lezcano > Cc: Thomas Gleixner > Cc: Heiko Stuebner > Tested-by: Jianqun Xu > Signed-off-by: Caesar Wang > --- That's hackish. Please consider something like: static void rk_timer_update_counter(unsigned long cycles, @@ -179,4 +186,18 @@ out_unmap: iounmap(bc_timer.base); } -CLOCKSOURCE_OF_DECLARE(rk_timer, "rockchip,rk3288-timer", rk_timer_init); +static void __init rk3288_timer_init(struct device_node *np) +{ + bc_timer.ctrl = TIMER_CONTROL_REG3288; + rk_timer_init(np); +} + +static void __init rk3399_timer_init(struct device_node *np) +{ + bc_timer.ctrl = TIMER_CONTROL_REG3399; + rk_timer_init(np); +} + + +CLOCKSOURCE_OF_DECLARE(rk_timer, "rockchip,rk3288-timer", rk3288_timer_init); +CLOCKSOURCE_OF_DECLARE(rk_timer, "rockchip,rk3399-timer", rk3399_timer_init); -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c index b991b28..b6ba6f9 100644 --- a/drivers/clocksource/rockchip_timer.c +++ b/drivers/clocksource/rockchip_timer.c @@ -19,7 +19,8 @@ #define TIMER_LOAD_COUNT0 0x00 #define TIMER_LOAD_COUNT1 0x04 -#define TIMER_CONTROL_REG 0x10 +#define TIMER_CONTROL_REG3288 0x10 +#define TIMER_CONTROL_REG3399 0x1C #define TIMER_INT_STATUS 0x18 #define TIMER_DISABLE 0x0 @@ -31,6 +32,7 @@ struct bc_timer { struct clock_event_device ce; void __iomem *base; + void __iomem *ctrl; u32 freq; }; @@ -46,15 +48,20 @@ static inline void __iomem *rk_base(struct clock_event_device *ce) return rk_timer(ce)->base; } +static inline void __iomem *rk_ctrl(struct clock_event_device *ce) +{ + return rk_timer(ce)->ctrl; +} + static inline void rk_timer_disable(struct clock_event_device *ce) { - writel_relaxed(TIMER_DISABLE, rk_base(ce) + TIMER_CONTROL_REG); + writel_relaxed(TIMER_DISABLE, rk_ctrl(ce)); } static inline void rk_timer_enable(struct clock_event_device *ce, u32 flags) { writel_relaxed(TIMER_ENABLE | TIMER_INT_UNMASK | flags, - rk_base(ce) + TIMER_CONTROL_REG); + rk_ctrl(ce)); }