Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp666228ybl; Wed, 21 Aug 2019 03:48:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmKInpSV8SH0xlOIYgK6hnazjsh77gsofuq9s3lFXDiCaa1fkTzk0nkndAFIYX4G1LRHTe X-Received: by 2002:a17:90a:9f4a:: with SMTP id q10mr4564964pjv.95.1566384502081; Wed, 21 Aug 2019 03:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566384502; cv=none; d=google.com; s=arc-20160816; b=mdnmRrJw35bsWBMBT/9B/1DfqiFiRlbn2SMz+hv4wO3phI457JOnyPR3ta3LsLfXTn a56UPaqi7oGKivZIYEsZoZeI2+tbpEzEr1xZHuBK+jcgju7qBm8PnD4C11srSmEFYj5d upm5qZXr7yq7jxKrv7O8coSLbkCmgmI2hSpqO+mABw4L10aeqfQ9wuvSoIKiwOzoy8qU iNagr9uRj/jmhLDCJcTQ4T6vAFNVHtsMUK8YwmSDlOJYnZkJPaZ3zfywMT/6XiArEtT9 lTUJEDTbFdgRr0CyR/ltobxKvknlqkgJlP2NRLZWsyd2wV50M56KtKoWehHGVFA+inCv zurA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=21mfaxXpzzpcpjFxLsuOaE64M3Kk3ik/0tTAJe54ZzM=; b=LH7oa68ZuaAv5UQ86478C26A/NlWFEqiFkyoUAkyjlHjigqmA2HFcrsxVnTEJbx6nM fbO8s4SdoerHOk+S78zxmcnLZDM9MSuFZGeKwZJOKpaf6JP4KPzp+p12muHb22xqYYGC qVBI/KGYzRxl+caYmg4s0+ITiSxLdE2RuLCxMPf1bxz95s5YdHtKjOSzTlshGUkF5Shd Kf9SNH/L4dwwPIrXWOOrLT5YbHTPST57VtVQCVmpVLD39Rz8CE2wr0mgR4MM52ZicIIb Jga3NJGB0aC8peF+XroxuQCKl9zmqpzxNK6xH+OaegLTSGtcjzWLIG9RqBsCM5SjxcSk bwHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=T1To62xz; 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 e2si15370451pfn.32.2019.08.21.03.48.06; Wed, 21 Aug 2019 03:48:22 -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=T1To62xz; 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 S1728456AbfHUKoA (ORCPT + 99 others); Wed, 21 Aug 2019 06:44:00 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:35084 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728239AbfHUKnX (ORCPT ); Wed, 21 Aug 2019 06:43:23 -0400 Received: by mail-io1-f67.google.com with SMTP id i22so3580632ioh.2 for ; Wed, 21 Aug 2019 03:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=21mfaxXpzzpcpjFxLsuOaE64M3Kk3ik/0tTAJe54ZzM=; b=T1To62xzjvEzr+9ni5+lpN2/GgC8rIsJ+fA7ZZG22Eib4BoVxDScW9e1mqvuWFc3Tt 8/TUJ1PcvRC7h0FtQJP7KCPLUXakXY8sZjMnMC0HoAZW9AQs+9cNJGiHbPMyuhWALN3H AxKQvPM3cJdyFLqk78GlGCjS/fnp+HKZJGVZXAll95v7op+6lFP2nBem63fteWtn1G7M vuRBZ9F2DPrCF2YviqYUCo3rGBb4dVeV9CydJ1Q8Wlhx5gXzgDauAp2ItU0qeCdKdJBn 30n9Ndn3jEBd3+f8rRS+NDForNpmmj3Wgbmiox77JD4ghaAdl7k/ZPakI46yskWOw1Tv 66gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=21mfaxXpzzpcpjFxLsuOaE64M3Kk3ik/0tTAJe54ZzM=; b=prI5Sxnv0z6qebM+tkaKYyd6Q3B5T5CsKeADq+hQ/NDJOW142GbhGrPwdfmMj4aq0n 1fwqLZdIY7US+0pcUser4XRaop1c66jQILpC4LWbdstelIQf2P6tG7IYGwa7qlpabXVX DJKKAgvttl1dOg3BsEtTGk8M8/Kmi/WsHCM31LTZcYagnqS0C518cwy2hKePw9hPldWa Tj1kzvVRcLUY4QXsG3WRj4uIXudIPanuTd1+pL2bqOcxGRhESsFnBp+fIKoPkdsAazwR Q1g0k/EztiGPyZ+fPHzqsS+mKWHnQCVhtEfVSZc3DobnZbg3Qoehk8BIBXOLaWY87vQn p7nw== X-Gm-Message-State: APjAAAXksVMO+8l417/Gu1Q3xae0aWWfsBHusrqG0Plwn6faOa3yAo9C /ZThQ+oZjR+0IJrpUJpo3Iopyregn2jaBDcYwQ== X-Received: by 2002:a05:6638:303:: with SMTP id w3mr8829447jap.103.1566384202422; Wed, 21 Aug 2019 03:43:22 -0700 (PDT) MIME-Version: 1.0 References: <20190729170354.202374-1-avifishman70@gmail.com> <744188a1-d11a-7edc-79cd-e3c7dbcf6e86@linaro.org> In-Reply-To: <744188a1-d11a-7edc-79cd-e3c7dbcf6e86@linaro.org> From: Avi Fishman Date: Wed, 21 Aug 2019 13:42:27 +0300 Message-ID: Subject: Re: [PATCH] [v5] clocksource/drivers/npcm: fix GENMASK and timer operation To: Daniel Lezcano Cc: Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Thomas Gleixner , OpenBMC Maillist , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks Daniel, It seems more clear now :) Good to know about the need for Fixes tag. On Wed, Aug 21, 2019 at 1:11 PM Daniel Lezcano wrote: > > On 29/07/2019 19:03, Avi Fishman wrote: > > NPCM7XX_Tx_OPER GENMASK bits where wrong, > > Since NPCM7XX_REG_TICR0 register reset value of those bits was 0, > > it did not cause an issue. > > in npcm7xx_timer_oneshot() the original NPCM7XX_REG_TCSR0 register was > > read again after masking it with ~NPCM7XX_Tx_OPER so the masking didn't > > take effect. > > > > npcm7xx_timer_periodic() was not wrong but it wrote to NPCM7XX_REG_TICR= 0 > > in a middle of read modify write to NPCM7XX_REG_TCSR0 which is > > confusing. > > npcm7xx_timer_oneshot() did wrong calculation > > > > Signed-off-by: Avi Fishman > > I've applied the patch and massaged the changelog [1]. > > Let me know if you disagree with it. > > Please, in the future take care of adding the Fixes tag. > > Thanks > > -- Daniel > > [1] > https://git.linaro.org/people/daniel.lezcano/linux.git/commit/?h=3Dclocke= vents/next&id=3Da5f6679fc81e42fcbef0184770d8a3b04c0f153e > > > --- > > 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_d= evice *evt) > > > > val =3D readl(timer_of_base(to) + NPCM7XX_REG_TCSR0); > > val &=3D ~NPCM7XX_Tx_OPER; > > - > > - val =3D readl(timer_of_base(to) + NPCM7XX_REG_TCSR0); > > val |=3D NPCM7XX_START_ONESHOT_Tx; > > writel(val, timer_of_base(to) + NPCM7XX_REG_TCSR0); > > > > @@ -97,12 +95,11 @@ static int npcm7xx_timer_periodic(struct clock_even= t_device *evt) > > struct timer_of *to =3D to_timer_of(evt); > > u32 val; > > > > + writel(timer_of_period(to), timer_of_base(to) + NPCM7XX_REG_TICR0= ); > > + > > val =3D readl(timer_of_base(to) + NPCM7XX_REG_TCSR0); > > val &=3D ~NPCM7XX_Tx_OPER; > > - > > - writel(timer_of_period(to), timer_of_base(to) + NPCM7XX_REG_TICR0= ); > > val |=3D NPCM7XX_START_PERIODIC_Tx; > > - > > writel(val, timer_of_base(to) + NPCM7XX_REG_TCSR0); > > > > return 0; > > > > > -- > Linaro.org =E2=94=82 Open source software for A= RM SoCs > > Follow Linaro: Facebook | > Twitter | > Blog > --=20 Regards, Avi