Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp634454ybl; Wed, 21 Aug 2019 03:13:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGMA+4c/DqJMeRCTRoPi8L8MwzxhRugUP2Rxo2v4ISdJ1nP16T5ota5QLgU+obbNK4Q6iX X-Received: by 2002:a17:902:9889:: with SMTP id s9mr33580453plp.100.1566382436122; Wed, 21 Aug 2019 03:13:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566382436; cv=none; d=google.com; s=arc-20160816; b=K4hFJJ50IfUwDNT0dlCh3+v29QxzjfhJ8I6UbH+VB0aAXapytyHO3oSmVyVBA2g4VV +8TjkPFNv4RUxSH0JU+tUZTleJDLjUbnXsiGqaZFiRLD83yitxFmTk8tHBrER/2THQ7N Z8oR194T/Ex0xS7zBJ74Zl+U8JkqS4JC9KV45lwtzzue7JOJiv8kku3j1e61ZnmJB0PL 92Mk/OtWNbV0s/M0ZPIqcveEqO8rSx9YdiXY0LPNhhGRvJvrVFdLYRTlpTFTk82ISIyH 65eWHqpadGi5UriTTJM/lO1RU5YKV046OH78Bno1s5qCuheqUeLKDVim5LRJDpOWapDZ 1BQA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=jrQICpWLHoOKA51TYZF4wdTk0Hlmd2hBlo/FIA7QGZo=; b=ZjvtONo3yl0pukuwXpnikZT0b/xR8n4/+PjDaDVW4S/k9oqrpMKSS7xr35BRt4LWpT vwlnDYDcV36QkGYpvZJT1Dq4hP0OquGvqGVq88f8qsiEXynUDCi7Cv3tmkyX6cy47uwB p0En+ikITT0X/Fn/yspOs2B/4MkxXWBk8nf+5MOpCWiJIgZAzYaRfgUVaGRmLpkO2wdA VHSkgmDemYMVQfDwoBuVkFcalBU+V1TOgcUdW8YqVLT9cHEMfwoZ7i3SPmIHMIWnciJy n4nzOraGpO8M3AtfyNJ1s5Raaqp2XGnO6kWHF7rFZW1U8nIrQDhzZC4x/7Gje+SbkmOb NTnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CbIXVfFO; 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 t25si14539009pgn.160.2019.08.21.03.13.41; Wed, 21 Aug 2019 03:13:56 -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 header.s=google header.b=CbIXVfFO; 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 S1726825AbfHUKLZ (ORCPT + 99 others); Wed, 21 Aug 2019 06:11:25 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38763 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726217AbfHUKLY (ORCPT ); Wed, 21 Aug 2019 06:11:24 -0400 Received: by mail-wm1-f66.google.com with SMTP id m125so1522556wmm.3 for ; Wed, 21 Aug 2019 03:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jrQICpWLHoOKA51TYZF4wdTk0Hlmd2hBlo/FIA7QGZo=; b=CbIXVfFOJtxVCS5XepCddU8NQviPa3DQa8nyoEesyWgIjk6D5VIcUZaIsYZ2DAS+Gr JA33INSo73e5TAHFo9cfpfia9/DQ2mwhkI7Vnh3ukcrQpW9TlvOxe+pa2+XZs7GGNCNV 20wDnqOW+pUnZXjnVRxrEPeU1OZY8xPBeLhpA73VnwnfIZMypEMvP4REs5nbPUOeT199 4YzL6S1BuCCVQtv7kZhi/PZqfdJOoeaAfmDjMSUsf0rh5IUU+iCNnF2DfsmAGg0RMMwT ij/hk/IU+MRWcIW8aGXTaFL369V28xSKp7dKMfzXZrY2m9tGqgyfjuVFZIo8Ye/dg5xE T6bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=jrQICpWLHoOKA51TYZF4wdTk0Hlmd2hBlo/FIA7QGZo=; b=i7/UiY2gEB+7VGDIW5ttjcbZcotkpqwAVZ7qUB7NxUn8qdbTO9xU785Jkw0jOmELa7 zsBl54edqaiUVxfl+V9DUSIUo7uUY/QOPd0ZSQPLcNZO3s23t13UDZKX2RQhUo7ryr3+ 0RzyIVB02PFwpT3gRiVzwXIoZcVEfGydTIpqXzXvi3k2Rpo/N5Is5bfsYoVg8pneWRvO quCo/HBrju5/PdCtgADhOfWi7+WPhNDJY69TlnkhFLzG3pee9GrnJ/7C6y/ZFs0CdjQA msbzoTzv3kBI0cR09hAs7JSLqAYf+QrD2E57G4nIMtm1jACT7q/ANy9n2y3gOLR26TET 3gqA== X-Gm-Message-State: APjAAAV8YbK1Gb5+AkZ/YAw/Sk6q28LDAhA+YAeBBgUCiZ5dx6dE5gfL k6oNT6eQGh5MiX1TfOS+I82Rvp6Z03M= X-Received: by 2002:a1c:a503:: with SMTP id o3mr4898652wme.37.1566382280840; Wed, 21 Aug 2019 03:11:20 -0700 (PDT) Received: from ?IPv6:2a01:e34:ed2f:f020:9c18:ddf6:f0bb:53f8? ([2a01:e34:ed2f:f020:9c18:ddf6:f0bb:53f8]) by smtp.googlemail.com with ESMTPSA id u129sm3575299wmb.12.2019.08.21.03.11.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Aug 2019 03:11:20 -0700 (PDT) Subject: Re: [PATCH] [v5] clocksource/drivers/npcm: fix GENMASK and timer operation To: Avi Fishman , tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, tglx@linutronix.de Cc: openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20190729170354.202374-1-avifishman70@gmail.com> From: Daniel Lezcano Openpgp: preference=signencrypt Autocrypt: addr=daniel.lezcano@linaro.org; prefer-encrypt=mutual; keydata= mQINBFv/yykBEADDdW8RZu7iZILSf3zxq5y8YdaeyZjI/MaqgnvG/c3WjFaunoTMspeusiFE sXvtg3ehTOoyD0oFjKkHaia1Zpa1m/gnNdT/WvTveLfGA1gH+yGes2Sr53Ht8hWYZFYMZc8V 2pbSKh8wepq4g8r5YI1XUy9YbcTdj5mVrTklyGWA49NOeJz2QbfytMT3DJmk40LqwK6CCSU0 9Ed8n0a+vevmQoRZJEd3Y1qXn2XHys0F6OHCC+VLENqNNZXdZE9E+b3FFW0lk49oLTzLRNIq 0wHeR1H54RffhLQAor2+4kSSu8mW5qB0n5Eb/zXJZZ/bRiXmT8kNg85UdYhvf03ZAsp3qxcr xMfMsC7m3+ADOtW90rNNLZnRvjhsYNrGIKH8Ub0UKXFXibHbafSuq7RqyRQzt01Ud8CAtq+w P9EftUysLtovGpLSpGDO5zQ++4ZGVygdYFr318aGDqCljKAKZ9hYgRimPBToDedho1S1uE6F 6YiBFnI3ry9+/KUnEP6L8Sfezwy7fp2JUNkUr41QF76nz43tl7oersrLxHzj2dYfWUAZWXva wW4IKF5sOPFMMgxoOJovS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hisTESeesbvWSPO5uNqqy1dAFw+dqRcF5gXIh3NKX0gqiAA87NM7nL5ym/CNpJ7z7nRC8 qePOXubgouxumi5RQs1+crBmCDa/AyJHKdG2mqCt9fx5EPbDpw6Zzx7hgURh4ikHoS7/tLjK iqWjuat8/HWc01yEd8rtkGuUcMqbCi1XhcAmkaOnX8FYscMRoyyMrWClRZEQRokqZIj79+PR adkDXtr4MeL8BaB7Ij2oyRVjXUwhFQNKi5Z5Rve0a3zvGkkqw8Mz20BOksjSWjAF6g9byukl CUVjC03PdMSufNLK06x5hPc/c4tFR4J9cLrV+XxdCX7r0zGos9SzTPGNuIk1LK++S3EJhLFj 4eoWtNhMWc1uiTf9ENza0ntqH9XBWEQ6IA1gubCniGG+Xg== Message-ID: <744188a1-d11a-7edc-79cd-e3c7dbcf6e86@linaro.org> Date: Wed, 21 Aug 2019 12:11:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190729170354.202374-1-avifishman70@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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_TICR0 > 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=clockevents/next&id=a5f6679fc81e42fcbef0184770d8a3b04c0f153e > --- > 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; > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog