Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1773623imu; Wed, 21 Nov 2018 01:34:20 -0800 (PST) X-Google-Smtp-Source: AJdET5dFGGK+X4aBnSvbig3RNsYyIHoLf2Nn51y3XlD0mqB3yWuRT2uH0dl0AtbLDUX5CFal4ZZz X-Received: by 2002:a62:938f:: with SMTP id r15mr5984158pfk.27.1542792860695; Wed, 21 Nov 2018 01:34:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542792860; cv=none; d=google.com; s=arc-20160816; b=b0LqiSJxpH/uh+TAg9dl/d2W/134w89sH4G9/DzNSJsWqv1G7OhpiCCItmkaf+wc78 5Fi8bXY5K4lg1g1ln0xe8rDEJJPiMQMLBUDWAWwHRtt35/ab++IwQKEDpFWyLluA7W5G z0Q5wh39jcrHcl4CKo0brig0aH2otQQFdnzISZ00j2TCcYy1cD/3pmIpnWYyvkh6IMH1 jGTImGfIOhBMGUZRDHDv6fpbKFCbR2DruWId7mx2tOrhLsUp3/XS32EmWVf3/IepVAV2 F4QfNh/y/CZy4vo11dJ99jGDQiK+zaZE4bMNHk3/QI0YWx2iCSx2f4kDkoN6QwTqvkl6 BG8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date; bh=TRfAn0zzxdzLNGE8rqLRbT6k9S2niyIFQh2IN4o4pqs=; b=jkdfBGwaY6VuF0pe7PPx/JWvbgzwaS6+GWiTAGn2CCrZ9McZk59h4ylByrhY/m81SB QB3bleemGQ0ym48KtwUbrW0c30WR9W7V1NxtnbiVomm7uOeI+isFSuhVj3ycPe6xdtnM mI8FiK8qBgRpce84cFtty1MRMmCxZuQeK+8dhylPTMPrmRHT+bGJIajYZY15k3Cf+Pgy CEG9w6RfudiXbvFcWemYwFmtQBZcYFAqpygsDD819RQse+ja9KgZYPukae5abrylA/Zi RDfwciD7YauSlu7byttxx45dtgU3pJkUwIRvoXUTWgZmEOWVCRjYeAketbU91kK+0fTG x/cg== ARC-Authentication-Results: i=1; mx.google.com; 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 v30si38357858pga.45.2018.11.21.01.34.02; Wed, 21 Nov 2018 01:34:20 -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; 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 S1728812AbeKUTPG (ORCPT + 99 others); Wed, 21 Nov 2018 14:15:06 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:57980 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728676AbeKUTPF (ORCPT ); Wed, 21 Nov 2018 14:15:05 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id 4267722D7F; Wed, 21 Nov 2018 03:41:25 -0500 (EST) Date: Wed, 21 Nov 2018 19:41:30 +1100 (AEDT) From: Finn Thain To: Geert Uytterhoeven cc: Kars de Jong , Philip Blundell , Andreas Schwab , Arnd Bergmann , Stephen N Chivers , Thomas Gleixner , Daniel Lezcano , Michael Schmitz , John Stultz , Linus Walleij , linux-m68k , Linux Kernel Mailing List Subject: Re: [RFC PATCH v2 09/14] m68k: hp300: Remove hp300_gettimeoffset() In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 21 Nov 2018, Geert Uytterhoeven wrote: > Hi Finn, > > On Wed, Nov 21, 2018 at 12:13 AM Finn Thain wrote: > > On atari, the 68901 counts down to 0x01 and raises an interrupt. On > > mac, the 6522 counts down to 0xFFFF then raises an interrupt. No idea > > about amiga (Geert?) -- this has to be handled correctly to get a > > monotonic clocksource. I'll fix this in v3 (where the information is > > available). > > The docs state that the CIA generates on interrupt on underflow, so I > guess that's the same behavior as the 6522 VIA. > Difficult to say. The sequence varies from one implementation to another. Let's ignore the MSB and LSB and pretend it's one register: MC68901: N, N-1, N-2, ..., 2, 1, N, N-1, N-2, ... MC6840: N, N-1, N-2, ..., 2, 1, 0, N, N-1, N-2, ... SY6522: N, N-1, N-2, ..., 2, 1, 0, 0xFFFF, N, N-1, N-2, ... Now the question is, when the timer asserts its interrupt, and the count register is fetched immediately, what value does it have? For the MC68901, you get 1. For the SY6522, you get 0xFFFF. For MC6840, as far as I can tell, you'd get 0. I'll add some code to my github repo to find out what happens with CIA. > Unfortunately the 24-bit ("TOD") counters in the two CIAs run from HSYNC > resp. VSYNC, which depends on the video mode, and thus can't be used as > a monotonic clock source. > Is that because of video mode changes? Could the clocksource be unregistered before the mode change and then re-registered at a different frequency afterwards? -- > Gr{oetje,eeting}s, > > Geert > >