Received: by 10.223.185.116 with SMTP id b49csp6260293wrg; Wed, 28 Feb 2018 06:36:40 -0800 (PST) X-Google-Smtp-Source: AH8x224XxUhn93u+u7K3RDti1wHQhDe4DtZhFUYbX529h4RRUI46e8iXU57LEyiebwhpD1quy5UP X-Received: by 10.99.107.202 with SMTP id g193mr14141100pgc.38.1519828600352; Wed, 28 Feb 2018 06:36:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519828600; cv=none; d=google.com; s=arc-20160816; b=x7hauno70jE4LcblWUA3RCHJCzuCBoZlWUb0iyueScGTUzapA4fm0/Nkg2Nybm92tC mWbkkVSnXZl1dQJU1ZrhQskSd97uu8JZDXAWB65oJcB2bznB6Fl2f1T2kPxA2bevG7Cj QWSqmKjhFZMMiA0Nx0Dgu6e/O8h7Ftc4o0p0hUO7KymQZM/AkPgrm3BurOR2JSQU0EYD ICCZQTM1u50+ty4f8wDnQncCQYAaexJAPwHLrsBhNUx61aDdiMQzJ16X9tHZ9zAJvOGz WjOjSUd+QCUtDauBq4YWpsQqspUAxwcbPYR8R7e5YBahQQr76MIhHbMs1gFNyVy3Mf4x 1yjw== 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:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=jnUAQWllQl7S6vKEBrHMXsejmA4OVWcmX88QEfB3i4U=; b=XTSJlAxrVOErYdopNBrOSuMWDovyE11+8hRAY2mdwkTdHFaIZu4rdK448xXT3FTjaW IhBphId8GW4g934rkc8VpgDCDHALLf7iT/BkJPrSeazfUCiGPuAHRTq+5Nsk94Y0kE1D vhtKMhtZ2lc/22LHYHewniCXhWB2leiJj1be3ndDEy4l6mldDgVwN66Q4O86uxLD17TW GLI4yqQOKUI2y2dJTyw7cPkBpEo9hj8zbVeYwlS5GVKnIXJ2Hc1+YY+wPBHGPwjh05V4 G7v2sthc5rQiucLwVjrk5QIbweJ8K0mb2eXs/en5AuDjmITN4XlJHofcESHE6B+n0VZD jhQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=mBse/THE; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m10-v6si1384102pll.436.2018.02.28.06.36.25; Wed, 28 Feb 2018 06:36:40 -0800 (PST) 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=fail header.i=@gmail.com header.s=20161025 header.b=mBse/THE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752604AbeB1Ofq (ORCPT + 99 others); Wed, 28 Feb 2018 09:35:46 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:38552 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752157AbeB1Ofo (ORCPT ); Wed, 28 Feb 2018 09:35:44 -0500 Received: by mail-pf0-f196.google.com with SMTP id d26so1061197pfn.5; Wed, 28 Feb 2018 06:35:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=jnUAQWllQl7S6vKEBrHMXsejmA4OVWcmX88QEfB3i4U=; b=mBse/THEsu3kC0rZ+f8eGmLZEw0oAeE0cXwAYFTW39iwbE7hN+lShtwmpL4/i5yVSs 6u6ZMClK8lXRoFotE4CmvrTMXaYYvMKInQqkdxmWH9F1pVUYIN4oRw97rTb4d4COJsgw cHA8wTrR+umeXvVoQ5Qur6ViFOpnm/AGhr1fgYRCW9t+dz0g9ceW8yVsY5QzkJq2aKKb J8F61MBYuT3/e5pGH260MHcJZ2DfyexEfZ3zf1FngXPVnEWIPbRZlqQ/CIJ6nVYvRWbo uCHNlgXOis479F5pbPg8FpIDm9fuNmSIEEf/J0j3SUSdhIxBMQCsun0rQaaDk8NLuwF0 x05Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jnUAQWllQl7S6vKEBrHMXsejmA4OVWcmX88QEfB3i4U=; b=hy5X1cvDQBTB1EYIm2Gw8Gqk2cKp3hktFugFOLmw5gcSi664kXrlQHE7d0gmCAiyCc hOeJvLCBC8+p49FVTLkOTGXim2il6UE+DBuPgIRwgqVRbLqvkOS8lymJDG54Sqj1Jubq mfBJq3PTWjIjuI4AbOTrqcV20CFMfCM/bTRBf+jfz2qfxPN1Wy+U28Q/cRXbnfN0XraD eYsQGYVsQEC/eA5Oc1LW3tnJ0FJkX3mpr0sIOlfJhyHoKwOYBwv8Cy3EadSPV1+t6c3i jZ7pf0+LLUyCvdCgW+O4icT6lBuiPoaX8ASpkt6DCydPD6QCVOQizd8QlW7Nr1FpZjJF nRlw== X-Gm-Message-State: APf1xPAzdlpZYxtjunpvcku+sdWAD9Jh7uOMOmNu1YirFa6FVtkGsZRE X+5iVP/P4rOb9kJc5K7BtTnzJzYB X-Received: by 10.99.173.3 with SMTP id g3mr14813224pgf.213.1519828544255; Wed, 28 Feb 2018 06:35:44 -0800 (PST) Received: from server.roeck-us.net (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id c7sm4414279pfg.36.2018.02.28.06.35.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 06:35:43 -0800 (PST) Subject: Re: [PATCH] watchdog: sbsa: use 32-bit read for WCV To: Jayachandran C , Wim Van Sebroeck , linux-watchdog@vger.kernel.org Cc: Fu Wei , linux-kernel@vger.kernel.org References: <1519815140-5336-1-git-send-email-jnair@caviumnetworks.com> From: Guenter Roeck Message-ID: <265c171f-8a08-2799-53b5-c6e3a5bf44b5@roeck-us.net> Date: Wed, 28 Feb 2018 06:35:42 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1519815140-5336-1-git-send-email-jnair@caviumnetworks.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/28/2018 02:52 AM, Jayachandran C wrote: > According to SBSA spec v3.1 section 5.3: > All registers are 32 bits in size and should be accessed using > 32-bit reads and writes. If an access size other than 32 bits > is used then the results are IMPLEMENTATION DEFINED. > [...] > The Generic Watchdog is little-endian > > The current code uses readq to read the watchdog compare register > which does a 64-bit access. This fails on ThunderX2 which does not > implement 64-bit access to this register. > > Fix this by using lo_hi_readq() that does two 32-bit reads. > > Signed-off-by: Jayachandran C Reviewed-by: Guenter Roeck > --- > drivers/watchdog/sbsa_gwdt.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c > index 316c2eb..e8bd988 100644 > --- a/drivers/watchdog/sbsa_gwdt.c > +++ b/drivers/watchdog/sbsa_gwdt.c > @@ -50,6 +50,7 @@ > */ > > #include > +#include > #include > #include > #include > @@ -159,7 +160,7 @@ static unsigned int sbsa_gwdt_get_timeleft(struct watchdog_device *wdd) > !(readl(gwdt->control_base + SBSA_GWDT_WCS) & SBSA_GWDT_WCS_WS0)) > timeleft += readl(gwdt->control_base + SBSA_GWDT_WOR); > > - timeleft += readq(gwdt->control_base + SBSA_GWDT_WCV) - > + timeleft += lo_hi_readq(gwdt->control_base + SBSA_GWDT_WCV) - > arch_counter_get_cntvct(); > > do_div(timeleft, gwdt->clk); >