From patchwork Thu May 18 20:17:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 100127 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp6264qge; Thu, 18 May 2017 13:18:12 -0700 (PDT) X-Received: by 10.84.173.195 with SMTP id p61mr7002404plb.83.1495138692730; Thu, 18 May 2017 13:18:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495138692; cv=none; d=google.com; s=arc-20160816; b=FmOPQUzHP0UfJLoO6BCb5QPGXo2D//2b4Vw436YlemuVY3V4DoaGIB2fFGl0LeQCWl GxiAh8k4JuyBeU5UQIU+zwI4yRLeG9/d2vlV0Id40b4HDee9zwtC3fO+lDSMCl8gNX74 3Hi0ZsIwNO2j5N3P+ciCc6T8jg4gVngAzoBJ0/GohryjiDM9syYzj08x2+B1tDHb/BJS xxjyMV08rzAicmGcZRLw0CVCNBc7O1Y0Bpy2x6CT+Il8eqrXuttX2GgVeQed9QRku+6b 8pe3KhuFP9+c7PohOfJUolrsglqHOOCaUyq9JYz+fVami///Dr52z75orpDCRNCqXPdF MumQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=oSPVC/2T5g8tja7hpHKzpYEqqAu3BI3wl4mu4w3COrs=; b=JHRmOTEB2ailNdW5CQE0dh48igUCEzKz6vUlb3+9OO4ShY/XbAcWJMqpEU/abzoEaU PjtQ0w9lsz+sxZf8/Vm4AVOv+VKJ4t6J/c1kpQ0ck7aUa3ytFH++QOy4AnI4JtkI0qip TQgKuMGX45yjywCn64ES3xAV0vFaUZb8upbraNj051EFVEQ3pxbZOlCUxmsd7C1yw5o9 TTQDzofoJ4+1BM5oVzLy/PrANgpy+jd1VN7UqRYZwrsBE9y37Nf1j1K77nV6ih1qMUjN 1KW+5UWz5zU/Yxx3k+H1WqSAZ4Xm6YXG1/suPGo22bsecQK2JO035yZpOMmTwuJOW1eF 8Qeg== ARC-Authentication-Results: i=1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8si4984374ple.2.2017.05.18.13.18.12; Thu, 18 May 2017 13:18:12 -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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755946AbdERUSG (ORCPT + 25 others); Thu, 18 May 2017 16:18:06 -0400 Received: from mail-wr0-f169.google.com ([209.85.128.169]:36093 "EHLO mail-wr0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755890AbdERURo (ORCPT ); Thu, 18 May 2017 16:17:44 -0400 Received: by mail-wr0-f169.google.com with SMTP id l50so3049996wrc.3 for ; Thu, 18 May 2017 13:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oSPVC/2T5g8tja7hpHKzpYEqqAu3BI3wl4mu4w3COrs=; b=ZvvAzINoQEjWYqpf+ZEK1zPNHl3g/Xd0ZppG1KFi0fNk5z0rKphALp/rtISu+LAptF ay1hC9dL9xTUO3gi7WuEusOvps45a3C02+5fIVMRFsqWi8VqDL53y/p/s2jLumgxO6Zn bk3rwfgJuqMcVHG5E7tgIUaRbmyDLMTUaUrf4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oSPVC/2T5g8tja7hpHKzpYEqqAu3BI3wl4mu4w3COrs=; b=sOCyLOIM/3Whyhiw6DU8fTc75g3MRdBAbo6vnUDkOF1n09X3RGlQZ5u/yktogS936W 0qGfnKANFXKJ04xbacW5UOmLJwhDOffCQ45nOkfXn/8uAhOn2fmXC0nq7eZVs4fEZE1U 4EoMfuFjZ0dBIryc/1g6HEQAi7drf4G1f4DnbbNx41hntM5LWLZAeg5noifSh2sgMT/1 KWAPzlmbUvMF+gYx/ovMlrf0TXNrUAhfzbYCWAWzrBlVGymkUx3eDwuiVBF1wzw4rKC+ L/C+jRI9qPYP2CFf0u8hhgO0jKp20nng5cnpTguRtgJUEO9GKZ4fu32i5d1cZK8D9Tq3 SM/Q== X-Gm-Message-State: AODbwcAeZt7d6INfpYmZLDK00yXWXGPBmOmJLka54n/ZjRg4iKuZ1aKN M+ngsd+uPWr3Q3dE X-Received: by 10.46.75.17 with SMTP id y17mr1604542lja.77.1495138653464; Thu, 18 May 2017 13:17:33 -0700 (PDT) Received: from fabina.bredbandsbolaget.se (c-787571d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.117.120]) by smtp.gmail.com with ESMTPSA id y1sm1103615lja.24.2017.05.18.13.17.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2017 13:17:32 -0700 (PDT) From: Linus Walleij To: Daniel Lezcano , Thomas Gleixner , Joel Stanley , Jonas Jensen Cc: Janos Laube , Paulius Zaleckas , linux-arm-kernel@lists.infradead.org, Hans Ulli Kroll , Florian Fainelli , linux-kernel@vger.kernel.org, Linus Walleij Subject: [PATCH 6/8 v2] clocksource/drivers/fttmr010: Switch to use TIMER2 src Date: Thu, 18 May 2017 22:17:03 +0200 Message-Id: <20170518201705.28790-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170518201705.28790-1-linus.walleij@linaro.org> References: <20170518201705.28790-1-linus.walleij@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This switches the clocksource to TIMER2 like the Moxart driver does. Mainly to make it more similar to the Moxart/Aspeed driver but also because it seems more neat to use the timers in order: use timer 1, then timer 2. Cc: Joel Stanley Tested-by: Jonas Jensen Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Added Jonas' Tested-by, no functional changes. --- drivers/clocksource/timer-fttmr010.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) -- 2.9.3 diff --git a/drivers/clocksource/timer-fttmr010.c b/drivers/clocksource/timer-fttmr010.c index 9df14cf13808..2d915d1455ab 100644 --- a/drivers/clocksource/timer-fttmr010.c +++ b/drivers/clocksource/timer-fttmr010.c @@ -49,9 +49,6 @@ #define TIMER_1_CR_UPDOWN BIT(9) #define TIMER_2_CR_UPDOWN BIT(10) #define TIMER_3_CR_UPDOWN BIT(11) -#define TIMER_DEFAULT_FLAGS (TIMER_1_CR_UPDOWN | \ - TIMER_3_CR_ENABLE | \ - TIMER_3_CR_UPDOWN) #define TIMER_1_INT_MATCH1 BIT(0) #define TIMER_1_INT_MATCH2 BIT(1) @@ -80,7 +77,7 @@ static inline struct fttmr010 *to_fttmr010(struct clock_event_device *evt) static u64 notrace fttmr010_read_sched_clock(void) { - return readl(local_fttmr->base + TIMER3_COUNT); + return readl(local_fttmr->base + TIMER2_COUNT); } static int fttmr010_timer_set_next_event(unsigned long cycles, @@ -230,19 +227,21 @@ static int __init fttmr010_timer_init(struct device_node *np) */ writel(TIMER_INT_ALL_MASK, fttmr010->base + TIMER_INTR_MASK); writel(0, fttmr010->base + TIMER_INTR_STATE); - writel(TIMER_DEFAULT_FLAGS, fttmr010->base + TIMER_CR); + /* Enable timer 1 count up, timer 2 count up */ + writel((TIMER_1_CR_UPDOWN | TIMER_2_CR_ENABLE | TIMER_2_CR_UPDOWN), + fttmr010->base + TIMER_CR); /* * Setup free-running clocksource timer (interrupts * disabled.) */ local_fttmr = fttmr010; - writel(0, fttmr010->base + TIMER3_COUNT); - writel(0, fttmr010->base + TIMER3_LOAD); - writel(0, fttmr010->base + TIMER3_MATCH1); - writel(0, fttmr010->base + TIMER3_MATCH2); - clocksource_mmio_init(fttmr010->base + TIMER3_COUNT, - "FTTMR010-TIMER3", + writel(0, fttmr010->base + TIMER2_COUNT); + writel(0, fttmr010->base + TIMER2_LOAD); + writel(0, fttmr010->base + TIMER2_MATCH1); + writel(0, fttmr010->base + TIMER2_MATCH2); + clocksource_mmio_init(fttmr010->base + TIMER2_COUNT, + "FTTMR010-TIMER2", fttmr010->tick_rate, 300, 32, clocksource_mmio_readl_up); sched_clock_register(fttmr010_read_sched_clock, 32,