Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1790056imu; Wed, 21 Nov 2018 01:54:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/U5rcxjFF1UFH3l8hLGV2HuVAZCtfkzuk818XJrZjevASt44qwMqnhbdKK+G16bs2by4mV2 X-Received: by 2002:a63:d104:: with SMTP id k4mr5196906pgg.227.1542794054749; Wed, 21 Nov 2018 01:54:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542794054; cv=none; d=google.com; s=arc-20160816; b=EEh5MXB9s6MgJLxHz2Gnvp1ekJjioQrlRYGrz6rADQs3LnAF5vi/yImP1gcF5gc98j 0UQ7XA7X9rOqgeR0jVZBSjRfWfww8DErZ29iWbh1qyoQMIS2OzkURP+5EqSLT9SmthMA 6V8BEYkmc6C9IUacwPY0lkPtQSx+8ajGP+v5qc9dKlkb2x2yBpPC1EaDTYbOTYb6l+ya lBYrZezZGAiteZyG/QeVvxfbcMhw6qmrM6J7JF1GNFpxF3USPZZBbjcGMfeF/2sRoiDY nNeVhbBdLAApM7676paU4Z2NFQuH2C64VIjT65TCewQXrsWPE89gM4xPbY9iKtF9B7V7 vokw== 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; bh=jHSeRCPm/Q1a14fKwEg2Q9aGrmsElIml1S5CCfKoJrE=; b=zf2xAZWVk6mLgEJaH3SFRMrL+SBYHafzLE9sSBgk9rYOIZtKwWEDo04wCooRMhZRQB PTMK6c8votSnkVxWWpRbLuWaR/iWoIYtXct0GmsKQuBshgtr5MYfO2jnoH2GMZxJIlfd spYDx8ZP4WL5blEeNBkplHMuq1xhwrvEi3BuhzP2XZMV3Jlm+rOz3LOJMGPUtSPLT50W iEoHjSMhUbvLI3nfRwLAA6k0af1GbCnvWvRG+jvfCrSVrjrwH7SZoZ6+FkqnSAzZawV0 AsL/nICM/IpzFhgPim4kYCD/IlYNvlyNuLcVwM7WsPcbg81gpd80Iz+bPHDDlWEmRIWP vSWA== 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 t19si29704681pgk.163.2018.11.21.01.54.00; Wed, 21 Nov 2018 01:54:14 -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 S1729085AbeKUT3R (ORCPT + 99 others); Wed, 21 Nov 2018 14:29:17 -0500 Received: from mail-vs1-f66.google.com ([209.85.217.66]:43704 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729060AbeKUT3Q (ORCPT ); Wed, 21 Nov 2018 14:29:16 -0500 Received: by mail-vs1-f66.google.com with SMTP id x1so2777363vsc.10 for ; Wed, 21 Nov 2018 00:55:37 -0800 (PST) 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=jHSeRCPm/Q1a14fKwEg2Q9aGrmsElIml1S5CCfKoJrE=; b=iijHn1pXjT7QXoqnrXKbX5SnIvEzArl/Hdq0keRHM310MA6R7BPS0d77v5qSegN18P XER0e2avWUcH4NKcnCQGgnC/xeMQH05xApptdYrmpiVuxblYMXLnSLO3RuyD7Ho6YNAB 9PME4Tko2zgsq780XRp8lsgEMDu33QnVSiA9Hjr2RoVx+vH8VyoHR+5U9eU/r5MJkMH2 U+oPamde/ogot7wxqLHRuwpHxfEzeN6eidq85ULfcJqrFmcHwYSDWRq3ehR4iUw8HXYC VRRCANN9jlWnH9Qkr2gtgoXuMBXYZoxoMDAhHwJVUCU8CbE5yxqREinBwBk8o1CxJFMt o6+w== X-Gm-Message-State: AA+aEWazm9LTSO/JZSEtI73pSPnz24TeTZUQCWi/LLRQAUaUouAKQDdd H8fYPA0eJ4GYXjYUZE0Ts3JDjZZRFQZ8PWK6MfA= X-Received: by 2002:a67:c202:: with SMTP id i2mr2190741vsj.11.1542790537098; Wed, 21 Nov 2018 00:55:37 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Geert Uytterhoeven Date: Wed, 21 Nov 2018 09:55:24 +0100 Message-ID: Subject: Re: [RFC PATCH v2 09/14] m68k: hp300: Remove hp300_gettimeoffset() To: Finn Thain 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 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 Hi Finn, On Wed, Nov 21, 2018 at 9:41 AM Finn Thain wrote: > On Wed, 21 Nov 2018, Geert Uytterhoeven wrote: > > 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 assume 0xFFFF. The 8520 CIA is almost identical to the 6526 CIA, as used in the C64, which is a direct descendant of the 6522 VIA. > > 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? On older Amigas (most plain 68000, unless expanded), video modes are fixed. Some have a jumper to select the power supply tick instead of the VSYNC signal, which is more accurate, but still runs at a low 50 or 60 Hz. On anything more modern (A3000 and up), video modes are programmable. In addition, blanking the screen according to VESA will disable sync signals, thus stopping the clock, I assume. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds