Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3836652imu; Mon, 12 Nov 2018 01:02:56 -0800 (PST) X-Google-Smtp-Source: AJdET5fC8c79Oq74eTEqLEqQLx3XyupwwQwBHn5lQwNK9DeQMj7XJcZl/C3Bl6a1Qrlse2oH0khO X-Received: by 2002:a17:902:d708:: with SMTP id w8-v6mr136211ply.72.1542013376513; Mon, 12 Nov 2018 01:02:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542013376; cv=none; d=google.com; s=arc-20160816; b=VccHHeFxVUBoIdpzzLsZh3ifEY76FSV0vsbciZQkoLNgjIXfWzOes9byAuJbXkWAmQ QBJfWyXwEB6sv582M7xTp/TfY56RcJBZ4z396AL4LrpwbMDmXIWDvrQAclrlYfcDH92U DnkLVTkGVQICX0KFEz1gF1t2hjxrzOhnst7lmmfrTGJbr8nYvXwpAtmiwm3eLXJ64+b0 No9mhnf8ij+F+PXPqfJdyPnlSXDiZotR5iWS/VFlJecmykdOrqFvx8mf+hubj1Radm53 tXPv+7dh5nSxvWdjAJbXHmHvwQzXWIft8zHrjyh3Dp3fbzeiSFE18S0z1NlMPwwWosWM naPQ== 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=8FI96f/QiRAl7mcgh6YM+M4riGclTfraQs4QqFLvAsU=; b=Mq2ijjIndQc3kcm3HXDXNRJoEqoTJTD3DeXssbeu27qVVVK05bEGtTSgGAfPUNCRiI Rhj0Hlcf+XxJ993Br3KBLfzi5BDXs08UvwI6xsEY/95cOtgd3bHOGv6s/G0DzQU8Fom3 7UzovG3+nUtUUgRZ2qiwjnNn9mObUqeb6P1mHIiuEh4h+pvC1GJ0Ept2zRZCf+l3K5Dm rJtw2yo5D/2u0M/b46Fy9SSC5DgK6S9ZBmZRAJ6Srmd8LgP0dZRweqLt3bUnIdydyyGJ +++dKZEVrOzVgx0q3bzPQOmHrwVFyyfe2sY/mk0aMW0VfVdgiLJZhQS7f7+Y7TeFqIxN q4wA== 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 g69-v6si16824115plb.400.2018.11.12.01.02.41; Mon, 12 Nov 2018 01:02:56 -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 S1729178AbeKLSya (ORCPT + 99 others); Mon, 12 Nov 2018 13:54:30 -0500 Received: from mail-vs1-f65.google.com ([209.85.217.65]:39420 "EHLO mail-vs1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728400AbeKLSya (ORCPT ); Mon, 12 Nov 2018 13:54:30 -0500 Received: by mail-vs1-f65.google.com with SMTP id h78so4652246vsi.6 for ; Mon, 12 Nov 2018 01:02:15 -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=8FI96f/QiRAl7mcgh6YM+M4riGclTfraQs4QqFLvAsU=; b=F1BTWTxqHiuycASscBrBkpHm6hifFQJAOGgH1Q6+/p77zYYLJc3Y+qdV2GncIfZaOy ygkAhh+u19raYfOH6FpMNTVYJo9zFhACKPfUpN5hkCwtGiTJVoisjuiiVlH5NVrQ+F1V fEEt6myx2jYoQz2dAc3Jxj7cUftnyR1oo7Z3vy5dz97wraUHmQIuoTeuSeoTrMPD5wZz 1GnlrOvTiyx+KL6T6f8Nn1XpJJz7aO27+CMPtI3AA0hyuKmPJMGPvcrMrv2gV6r7Kw8S Qr3PokfIc/v06cBjo5Fyc1F1RAaRM8fill8U5ZpW3Hrd5S3zvE907eYIMkY1NldJIFGe 3tyg== X-Gm-Message-State: AGRZ1gKtronG/c86Giv/TYx3cCZ9csVuMlyvXmKmjrVyKtC45y5sSW2f 40jKsT1zMxVHcqtFxVzWc+sQELGw77vlEH6//y4= X-Received: by 2002:a67:f43:: with SMTP id 64mr54905vsp.166.1542013334742; Mon, 12 Nov 2018 01:02:14 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Geert Uytterhoeven Date: Mon, 12 Nov 2018 10:02:02 +0100 Message-ID: Subject: Re: [RFC PATCH 07/13] m68k: amiga: Convert to clocksource API To: Finn Thain Cc: Arnd Bergmann , Stephen N Chivers , Thomas Gleixner , Daniel Lezcano , John Stultz , 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 Mon, Nov 12, 2018 at 5:46 AM Finn Thain wrote: > Add a platform clocksource by adapting the existing arch_gettimeoffset > implementation. > > Signed-off-by: Finn Thain Thanks for your patch! > --- a/arch/m68k/amiga/config.c > +++ b/arch/m68k/amiga/config.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -461,7 +462,30 @@ void __init config_amiga(void) > *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80; > } > > +static u64 amiga_read_clk(struct clocksource *cs); > + > +static struct clocksource amiga_clk = { > + .name = "ciab", > + .rating = 250, > + .read = amiga_read_clk, > + .mask = CLOCKSOURCE_MASK(32), > + .flags = CLOCK_SOURCE_IS_CONTINUOUS, > +}; > + > static unsigned short jiffy_ticks; > +static u32 clk_total; Shouldn't clk_total be u64? > + > +static irqreturn_t ciab_timer_handler(int irq, void *data) > +{ > + irq_handler_t timer_routine = data; > + unsigned long flags; > + > + local_irq_save(flags); > + clk_total += jiffy_ticks; > + local_irq_restore(flags); > + > + return timer_routine(irq, data); > +} [...] > -static u32 amiga_gettimeoffset(void) > +static u64 amiga_read_clk(struct clocksource *cs) > { > unsigned long flags; > unsigned short hi, lo, hi2; > @@ -512,14 +537,13 @@ static u32 amiga_gettimeoffset(void) > if (ticks > jiffy_ticks / 2) > /* check for pending interrupt */ > if (cia_set_irq(&ciab_base, 0) & CIA_ICR_TA) > - offset = 10000; > + offset = jiffy_ticks; > > local_irq_restore(flags); > > ticks = jiffy_ticks - ticks; > - ticks = (10000 * ticks) / jiffy_ticks; > > - return (ticks + offset) * 1000; > + return clk_total + ticks + offset; ... to return a full 64-bit value here? 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