Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4432820ybi; Mon, 15 Jul 2019 08:51:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBsHg/d7kqTqqcEjMsg2WncbRQ2iLyK4HI77mropNcYR0wFq2kY7R+/1nX861hqkBdtjsr X-Received: by 2002:a65:4304:: with SMTP id j4mr28217624pgq.419.1563205860423; Mon, 15 Jul 2019 08:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563205860; cv=none; d=google.com; s=arc-20160816; b=T+q3CsDLF3DXuE/CAAQTelJh0Egm3WuAZJ4FTvXx5zCkckNoFG2U/GbNWgkRDgs2SL xVnY2OWKIPy3Jo9Ita/aIx4gXEvXeWYZIEetuwDokavukiq1pRupRcP6O/UQCq2mrdOZ HQ9y7rDQRKEHlMDETumrmbYCyOLzDgB9x/IfwyozYjcPCpvz/8HuXgcXiTsUvnuvr5J/ v/gHig1oTZ9ceQAlnlGPxcHS09mlTWyv9i1ZMxg8hq4vCrmT7U89y5zw1eRtmnPsscCT nfol6TqlTY9VOyzcOPMuA1KCsQVqlgmMiPZno4rknYXINNIHWpNIShDAtzyIXjT+15AK pmnw== 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 :in-reply-to:references:mime-version:dkim-signature; bh=G2ekqYXyWScZdGL4/IuVQy9DAJhZ8DCtVpPL9rbaqvU=; b=OVYQ6cByn2ZOhrozbRZUuywohnYmHH/U55B9yHqWShWakJem1dHd2gMqU8R9vBxlkN vW6aJ5f264VYxSeaFBGH4l3ZrfWQRhJCYD0AY9r+iPNPZZPeAv+3ODQwulIcjdtUTL8E l1xGMkBoXBVuZAyrKzbBSzmezH70GJebY2HGklH5gk22XP1mddhjruoxyTWz9C/gq73a hMBo9Z/Ohj/knHZqUdBpd02DlSaF/l25d1uas7e/cX/8fwiVDzj9y5dM+0iRGdOM1Hkm 9WaMBdFiFV/m2HBHKDM1BkqCY+//ey+Wf8TqukPdREh6EqZSZVg/ZtRV8Y3iYCqXqxoj StxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ucGBCVwe; 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 j9si61104pgh.159.2019.07.15.08.50.43; Mon, 15 Jul 2019 08:51: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=@gmail.com header.s=20161025 header.b=ucGBCVwe; 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 S1730934AbfGOPsx (ORCPT + 99 others); Mon, 15 Jul 2019 11:48:53 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:44308 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730610AbfGOPsw (ORCPT ); Mon, 15 Jul 2019 11:48:52 -0400 Received: by mail-io1-f67.google.com with SMTP id s7so34762670iob.11 for ; Mon, 15 Jul 2019 08:48:52 -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; bh=G2ekqYXyWScZdGL4/IuVQy9DAJhZ8DCtVpPL9rbaqvU=; b=ucGBCVwecdtUME+/YMeojNAwXZakBMGomin0nC9x95dHz5KQWKy9gXTcoyw8E6fg3b CWkR/aAVtbNnslyfoP0cLRICgvftKEgRUSA36BDa3LFP9HVAd//Xrgld9bpJcFNsbqPk n1FBLBPhZqmQ7aSSbFNgpB0B1yrGC4JGBtUIk42U8jJqFKlOz2q4dH0qsLE3q8hlf5JB v07NBeI1jXhnIaKe30/HtIUoOfpk90slS+/MzpK7YNTNhxwp7Rs6wPc+RHI9JCL3WSc+ RwndnjrIIr63JSK30QtIONNkeICalsol8ZDl1UxeAcNAd/nMqS/8uAUdKAsO2I2HiljZ hi+g== 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; bh=G2ekqYXyWScZdGL4/IuVQy9DAJhZ8DCtVpPL9rbaqvU=; b=g9U9fP5f3GKxBmthXDGqXbtFvOX7y6u7lamBhAyFtnPud6aKUCx9OlUpnJbmla4rEq XMY1W5d/epX7QsquBcCo4cKP7Ib8ehg/IiJdTE4Vak2hYxp85P16DkjX7aLP85b9Vcsr 2PgnyVcSzxVVJP7uQXros+zFzMGh6XEwNAFIrddgh72GVubM7d+tf4eWMjGWdNg0+RWu 69N6phL/qpCFU5m5wyvrIOzpKroRNGA36q7mZ1SywPm9TbR7wgTdu44Ipgp2reamabMf r7o2QACuhBMz1bm0NcTA3MFSsFuAD/UQjOK7dLXlIzUptoWDIsLEJ/hJjPaiKnwtZXTf JMSQ== X-Gm-Message-State: APjAAAV8snsX2ZiuWsdT4rNhCFoWtffc2t2YBfv7JdP3Va3WmoyVix8m rxvVpL0Rge02NLtA2IxQnduMLAEL3+LtFmJSSg== X-Received: by 2002:a5e:a712:: with SMTP id b18mr25034142iod.220.1563205732236; Mon, 15 Jul 2019 08:48:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Avi Fishman Date: Mon, 15 Jul 2019 18:48:05 +0300 Message-ID: Subject: Re: [PATCH] [v2] clocksource/drivers/npcm: fix GENMASK and timer operation To: Joe Perches Cc: Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Daniel Lezcano , Thomas Gleixner , 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 On Mon, Jul 15, 2019 at 6:25 PM Joe Perches wrote: > > On Mon, 2019-07-15 at 18:19 +0300, Avi Fishman wrote: > > clocksource/drivers/npcm: fix GENMASK and timer operation > > > > NPCM7XX_Tx_OPER GENMASK() changed from (27, 3) to (28, 27) > > > > 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_TICR0 > > in a middle of read modify write to NPCM7XX_REG_TCSR0 which is > > confusing. > > You might mention how the original use of GENMASK(3, 27) > was defective or correct without effect. Done, see v3 of this patch. > > > 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; > > > -- Regards, Avi