Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2461106imm; Thu, 7 Jun 2018 10:59:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJn+9Zk2UewpofP6UfPZU91Ap4hiM2EmYmd5vrWbY3pRTq2hn43xkjZED1T6PfS44JhKfbL X-Received: by 2002:a17:902:8210:: with SMTP id x16-v6mr3003650pln.307.1528394371090; Thu, 07 Jun 2018 10:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528394371; cv=none; d=google.com; s=arc-20160816; b=jGX7o6rT3xOAgWX1uvxowbgQswR27rrrfFQuyVSMZ6/wPhN0TtOfQrLbrs6WPYbDHP Hxp9bcLxD9y4EEZ7orfzE/VXmUy0l8JWdsPixeUbmlwo9nR9o5F3hIJZXgXZQs2Bhx4s +w1V1xHaGWH/GfrJoOz0vDNxEpkRrgBXqGfItiWvUuMvpxeYJCCwFod3emDViyWyiT9R U4WtawIqpgG8EpdNyuqeFVki/tiTOCf4hUZWMlqmzOcMqZ8TBo7xgSrDS9Yu+g3kk/Tt Zd2UYrCq1OgLXhvHiICqdK/MHE25KNzboXyDGMDXm+4WH371acA5D1JcJ8GMLFHghzZI v6YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=1Y96TUtKgCbok0FmySMtQ6nmy5OuzGfdueo7l/CuSEI=; b=NgrMemJRaPxoAIQ5jxZLEFLms3vEAtQNGF3nsnD/MnP3gcDuSNyUyXsulw9tlc8Pw2 J6EX2rx5pNmu1+NaxozoRZeY81V65V6d+PLXJ5/RHS2EgXNJ1L0V6QVnQunGtMP4eprI VuZJ0C++MfJQvFugt/KdWyqCRtP+zXu9AYR/GDULzWepL71rYGuAyk45CfH374yT7cXn sFJP9zZbsjVLn37q/acNcuOGKkdGyuAQ9J1um5cs4GxKvkc6Oz5lMPFp5e/gzbBkCNxg LSRQ+aRACGMu6HJT+v6VbX3piOx888znCrBig7667R30XlLtTDqLoRZvZYnUmDXNS96+ hhwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=J8idrU0y; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u13-v6si25136004pfh.282.2018.06.07.10.59.16; Thu, 07 Jun 2018 10:59:31 -0700 (PDT) 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=pass header.i=@googlemail.com header.s=20161025 header.b=J8idrU0y; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935063AbeFGOsV (ORCPT + 99 others); Thu, 7 Jun 2018 10:48:21 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:36477 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934474AbeFGOsR (ORCPT ); Thu, 7 Jun 2018 10:48:17 -0400 Received: by mail-wr0-f194.google.com with SMTP id f16-v6so10169938wrm.3; Thu, 07 Jun 2018 07:48:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=1Y96TUtKgCbok0FmySMtQ6nmy5OuzGfdueo7l/CuSEI=; b=J8idrU0yBfXTSRINE/VInP22sohi+CqzscFUEqXpw41cQUuOXrpLCWxI7DQyocSBiN mdkXB9P28fDKMlLclBtBxqqcPKkMT4qnfn2lkWt+yZLtX32vGYAac813DYM8l40OCzNI C0XI7f7rNvyyPnx/c/6DeoJGzIqweSOSgmGLINdJ3p2qPUNEJmpbwbyBUKsHHvK8IMlV BL4X7/jNIEzCCjajNKBPCniMKb8wiACYuxXQ6qSbhCpzhB7qINnQ9zzIrIp+RX85iV99 nR7hln2fXO/q2gbfbNr4/YjkU3G9WrQKBe2oOUwO6NqEwFqZObK43dTj45QA7Kfxzcsb TQBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=1Y96TUtKgCbok0FmySMtQ6nmy5OuzGfdueo7l/CuSEI=; b=ds4RqM0QM35oF1fPv63E6zfE3wYUJs+91dpDYNrRPpzS6OkVMqdD/e4uJlPFJhMw5H MFDU4b7Vo6pJ3zaujQuLvyjHUXSYMBqKMEcBZw1spMiZhFTPcwe95oqlXYGWj6kjjGrl FnMqgR/H3ltCzWEmlJUOAgZMe/iujRi9sWdz2eIGO3WQGG0Mw2wOjn8Bit53dXOM76W9 jGmCKEbiylX6QsyNCgfDNuXLICMnplyQEC+u6FFtBc3Kkm7X2nAswf8o/Idau416u65d ABepAZW4GpdXH3BI7vif4DMxiyU1MmC4bWDiiS8P2E1IQ3Mn6995aHWuez9smoEF3c/U b3jw== X-Gm-Message-State: APt69E1nchpu8M6Toy2zUWYXHgibbm1spZvNwTQXz/0vnlLuXoXs09v6 /VZpTWch7KZxlMtS01z6tXk= X-Received: by 2002:adf:9724:: with SMTP id r33-v6mr2107216wrb.79.1528382895810; Thu, 07 Jun 2018 07:48:15 -0700 (PDT) Received: from localhost (cable-78-34-23-77.netcologne.de. [78.34.23.77]) by smtp.gmail.com with ESMTPSA id n56-v6sm66496740wrn.72.2018.06.07.07.48.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Jun 2018 07:48:15 -0700 (PDT) Date: Thu, 7 Jun 2018 16:43:59 +0200 (CEST) From: Hans Ulli Kroll X-X-Sender: elektroman@T420s To: Alexandre Belloni cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Ulli Kroll , Linus Walleij , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 3/3] rtc: ftrtc010: let the core handle range In-Reply-To: <20180604141528.15635-3-alexandre.belloni@bootlin.com> Message-ID: References: <20180604141528.15635-1-alexandre.belloni@bootlin.com> <20180604141528.15635-3-alexandre.belloni@bootlin.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) 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 Mon, 4 Jun 2018, Alexandre Belloni wrote: > The current range handling is highly suspicious. Anyway, let the core > handle it. > The RTC has a 32 bit counter on top of days + hh:mm:ss registers. > > Signed-off-by: Alexandre Belloni > --- > drivers/rtc/rtc-ftrtc010.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/rtc/rtc-ftrtc010.c b/drivers/rtc/rtc-ftrtc010.c > index 2cdc78ffeb17..61f798c6101f 100644 > --- a/drivers/rtc/rtc-ftrtc010.c > +++ b/drivers/rtc/rtc-ftrtc010.c > @@ -95,9 +95,6 @@ static int ftrtc010_rtc_set_time(struct device *dev, struct rtc_time *tm) > u32 sec, min, hour, day, offset; > timeu64_t time; > > - if (tm->tm_year >= 2148) /* EPOCH Year + 179 */ > - return -EINVAL; > - > time = rtc_tm_to_time64(tm); > > sec = readl(rtc->rtc_base + FTRTC010_RTC_SECOND); > @@ -120,6 +117,7 @@ static const struct rtc_class_ops ftrtc010_rtc_ops = { > > static int ftrtc010_rtc_probe(struct platform_device *pdev) > { > + u32 days, hour, min, sec; > struct ftrtc010_rtc *rtc; > struct device *dev = &pdev->dev; > struct resource *res; > @@ -172,6 +170,15 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev) > > rtc->rtc_dev->ops = &ftrtc010_rtc_ops; > > + sec = readl(rtc->rtc_base + FTRTC010_RTC_SECOND); > + min = readl(rtc->rtc_base + FTRTC010_RTC_MINUTE); > + hour = readl(rtc->rtc_base + FTRTC010_RTC_HOUR); > + days = readl(rtc->rtc_base + FTRTC010_RTC_DAYS); > + > + rtc->rtc_dev->range_min = (u64)days * 86400 + hour * 3600 + > + min * 60 + sec; > + rtc->rtc_dev->range_max = U32_MAX + rtc->rtc_dev->range_min; > + > ret = devm_request_irq(dev, rtc->rtc_irq, ftrtc010_rtc_interrupt, > IRQF_SHARED, pdev->name, dev); > if (unlikely(ret)) > -- > 2.17.1 > > Acked-by: Hans Ulli Kroll