From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938977AbcIHTGc (ORCPT ); Thu, 8 Sep 2016 15:06:32 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:37836 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937116AbcIHTGa (ORCPT ); Thu, 8 Sep 2016 15:06:30 -0400 Date: Thu, 8 Sep 2016 21:06:25 +0200 From: Richard Cochran To: Harini Katakam Cc: Andrei Pistirica , netdev@vger.kernel.org, "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , davem@davemloft.net, Nicolas Ferre , Harini Katakam , Punnaiah Choudary Kalluri , "michals@xilinx.com" , Anirudha Sarangi , Boris Brezillon , alexandre.belloni@free-electrons.com, tbultel@pixelsurmer.com Subject: Re: [RFC PATCH 1/2] macb: Add 1588 support in Cadence GEM. Message-ID: <20160908190624.GA5237@netboy> References: <1472820817-21874-1-git-send-email-andrei.pistirica@microchip.com> <20160906154809.GA7012@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 08, 2016 at 10:22:43AM +0530, Harini Katakam wrote: > >> + /* get GEM internal time */ > >> + sech = gem_readl(bp, TSH); > >> + secl = gem_readl(bp, TSL); > > > > Does reading TSH latch the time? The TRM is silent about that, and > > most other designs latch on reading the LSB. > > No, it does not latch the time. > When doing a read + adjust + write, this will > mean there's room for some error. It also means that you will have to handle when the TSL value overflows into TSH. That means reading TSH twice, once before and once after reading TSL and retrying if needed. The code as written above will produce apparent jumps backwards in time, whenever the overflow occurs between the two read operations. Thanks, Richard