Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4052296ybi; Mon, 15 Jul 2019 03:07:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwWfRsWrosakrrJ/w7VA3J6dATQ4b8QEjLUByTi4j/dFNJqefYELCGuK+yzySTK4VtZX07F X-Received: by 2002:a17:902:2aab:: with SMTP id j40mr26202319plb.76.1563185234366; Mon, 15 Jul 2019 03:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563185234; cv=none; d=google.com; s=arc-20160816; b=OQjqOKduEBcEs7d+oFe9ysVrfyG/F82Q0Z8ZvxqERSAl7ko57I7bAVN5Xd9J8EONen +YX/TpVu6YRV1OrMYSFPqoZVFWZtwJ7WJExJ3YDn/k15ajA1lve9pNnzj7nXv2fWOD29 fu+g73eZc6b6vdkTDsW6vLqy847D+GRwotG3Dysq1T4Z9rkAwuGsO62+FtddQcJsM4td bb2+URGbyhvqh6MpXjbr2zz2Z8hkWaR6iyxlfYaFpK4FPvoQH7fWXz8QSZ7tHBcOl1NB 7skTG1tep1sMrSg7oMMIMjrBZapE24gD+N3YVMTxNwCbH7T4PncGOdkqXbjnj01JuadM C9KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :mime-version:dkim-signature; bh=7BCsDJdR5KYaMX3UQplQ6QtuJPUxTxnY/Qc6vVf7TgQ=; b=R8isKCaZJpPf67AMba+c5WH6Phku8x0pPAuUiP+pFmDfAmRYfk8ZloTC3LuJLKw6G7 fmFbjFenqLKtUVF6WrFhN2uc+02vPPy7Z+6l98OTqyPnn78kbyi4toBhgUM1/7oF9EKG f84U+xg3Hd99VdHk1PG5wcMKWyVUtJYeEegVgtNRzEjLxnOBrKhfibCgy6/DHVHs+3lb HwTnluogwcwGZLpzzzxwfE+1eEPTWLy6BMyQVy4Ne5sLLH5mqs9Das11qpR/VIKyTws5 e5A93GRtSV3djQV9aNTFlDv+Xu2Gv48iJA6LoW75+S3vBNTsfojHb9D2t/H+BfBn3U+6 J3yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GYy92tES; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si14915317pgv.86.2019.07.15.03.06.57; Mon, 15 Jul 2019 03:07:14 -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=@gmail.com header.s=20161025 header.b=GYy92tES; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729591AbfGOKGj (ORCPT + 99 others); Mon, 15 Jul 2019 06:06:39 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:35469 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729428AbfGOKGj (ORCPT ); Mon, 15 Jul 2019 06:06:39 -0400 Received: by mail-io1-f68.google.com with SMTP id m24so33182529ioo.2 for ; Mon, 15 Jul 2019 03:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=7BCsDJdR5KYaMX3UQplQ6QtuJPUxTxnY/Qc6vVf7TgQ=; b=GYy92tES6qIGd/FIHRU6kRF7gZ31p54OfCxRbJbYisMyC/+rU33OJmZIF2+efTUmQA GHp9oJGW0ZvI+rDBtptxV+fhyWMBj8rDCYHXlGOH5Q1i9ohJfLEs5Rxg+TNq8MR5fUqL Zm5Z03pX2eIT8pG0HmDf6gvujkAK7Z8YwCm9QsiXxmwsnps2gOc7KhM8VDvPnYQrvj9Z +DEDygP/VQtYtkycxkPHBjbDOjuK8DbUHf2Yy85pghaRqGvCzUOqzycLGo4Kgy+nu+tT aWOGUXSDvF3EVXr8kp407JlZhQzWOKoaG3Hm2Th2ThpVRed+QFUEAHvAKSgXvCvbI0Bq YMvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=7BCsDJdR5KYaMX3UQplQ6QtuJPUxTxnY/Qc6vVf7TgQ=; b=HtK+dZXMNBgY4pivr/XAnaqJldaP/ao+sLiiD4B9RV3gx780l2JEf/RfXzSy9VChNr mcw56LT8CqhGKpuK23Adgrh8ou0EcziahyCin2C5uXSQtIaUiCgymvB6t0Bvyt9BhpMq +OCYsYRSi2sRM+HN0aOs/6Eiz+Oapt9BvR1m3aNcs/RmKtArXLLfkvMH86+B4muZjpQn FO3kEbHL17+JKCix3PKFlkwJY6wjFW6fiutb0rsLgeWUL+WQqyL8K2yJYMURgxy62m50 ktu2HjQcnKegj0sX7xJphT8GjpTsO1MWvSqhEUUSHK1Lz1cxgK862n9EVNVNC8ljaeu0 ThmQ== X-Gm-Message-State: APjAAAXDFsi+HNno9ArSGMpbFiumUjecV/uyUiD3PTm1OpUl1xkQm/1j gjlrEyYzcsMO/18qD9ic2IQphoAktFvccwhdlw== X-Received: by 2002:a5d:96cc:: with SMTP id r12mr13141421iol.99.1563185198579; Mon, 15 Jul 2019 03:06:38 -0700 (PDT) MIME-Version: 1.0 From: Avi Fishman Date: Mon, 15 Jul 2019 13:05:51 +0300 Message-ID: Subject: [PATCH] clocksource/drivers/npcm: fix GENMASK and timer operation To: Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Daniel Lezcano , Thomas Gleixner Cc: OpenBMC Maillist , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org NPCM7XX_Tx_OPER GENMASK was wrong, npcm7xx_timer_oneshot() did wrong calculation Signed-off-by: Avi Fishman --- drivers/clocksource/timer-npcm7xx.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/clocksource/timer-npcm7xx.c b/drivers/clocksource/timer-npcm7xx.c index 8a30da7f083b..9780ffd8010e 100644 --- a/drivers/clocksource/timer-npcm7xx.c +++ b/drivers/clocksource/timer-npcm7xx.c @@ -32,7 +32,7 @@ #define NPCM7XX_Tx_INTEN BIT(29) #define NPCM7XX_Tx_COUNTEN BIT(30) #define NPCM7XX_Tx_ONESHOT 0x0 -#define NPCM7XX_Tx_OPER GENMASK(27, 3) +#define NPCM7XX_Tx_OPER GENMASK(28, 27) #define NPCM7XX_Tx_MIN_PRESCALE 0x1 #define NPCM7XX_Tx_TDR_MASK_BITS 24 #define NPCM7XX_Tx_MAX_CNT 0xFFFFFF @@ -84,8 +84,6 @@ static int npcm7xx_timer_oneshot(struct clock_event_device *evt) val = readl(timer_of_base(to) + NPCM7XX_REG_TCSR0); val &= ~NPCM7XX_Tx_OPER; - - val = readl(timer_of_base(to) + NPCM7XX_REG_TCSR0); val |= NPCM7XX_START_ONESHOT_Tx; writel(val, timer_of_base(to) + NPCM7XX_REG_TCSR0); @@ -97,12 +95,11 @@ static int npcm7xx_timer_periodic(struct clock_event_device *evt) struct timer_of *to = to_timer_of(evt); u32 val; + writel(timer_of_period(to), timer_of_base(to) + NPCM7XX_REG_TICR0); + val = readl(timer_of_base(to) + NPCM7XX_REG_TCSR0); val &= ~NPCM7XX_Tx_OPER; - - writel(timer_of_period(to), timer_of_base(to) + NPCM7XX_REG_TICR0); val |= NPCM7XX_START_PERIODIC_Tx; - writel(val, timer_of_base(to) + NPCM7XX_REG_TCSR0); return 0; -- 2.18.0