From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3DCF173 for ; Sun, 25 Jul 2021 05:51:31 +0000 (UTC) Received: by mail-ed1-f51.google.com with SMTP id x14so2249907edr.12 for ; Sat, 24 Jul 2021 22:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YHRp36bG7u+FDs07iyp7QzfPeLS/I55OgAKDF8o9L94=; b=FZOPUJR1gQbr22sAT5Saa+mI22aj6qruvYvSs7/wIydCI6ebW1KtLYSILQMlvbenhB EjO8eU+szBhrfNefXbiPc1J3lIi5BV9cECBAdd0EhZMkNMQ4c5zJuYVrEHKTjGVcX3cK dKYDJs7neavGxXy8QYHzo12oBgHLhwLKivtOdyDH6kRbKKCIfKoWE5gAUEp5mxmu4jrI bfqGo+G00yWMtsC03MdGaMklz7VgAGPEH7brzWu/CC/IBGbJeuXzR1820u5TDq1O/hHP JoDY9kswbb1IZ0lbJIWW+56YREJWNcta7618eFGWNlHkDi9GJW8URzW+uKbhdfRtHsPY Yynw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YHRp36bG7u+FDs07iyp7QzfPeLS/I55OgAKDF8o9L94=; b=AB4Dog5sXtm/2YyMaNz0CeXt6p3Ic6+XTi7Ptyvzz7QxrZgkKCjD3+9A2B1F0w9qwR of5YUO6P8iH94DPJRt+wGtXMO17V5l+FonmWa20qZZ0PyQSh0z/ioGNyjF9SU214mg2m j3JMzx7nhxgMxIiKSZh5qZcPL2CAkvl2hrRRwRtBazYbhWivCuj5J+AZuHHnFR8Cs1YK oz4mUmbuFGjsXMZuHjUuzvh7JN4nIYEgdJTHF/WEs0nYsqlhhYaiQOJaB/iaXCYpaQFG 4+DgYQoUcuc4u2SpIaFPly3eVbcwCl/BYHf2Cx+Zx1jsVKkl8xAaOWEjPTyt7bNbZj9a NB6A== X-Gm-Message-State: AOAM531acWXGqphj/Tq9yxlS6+7MSxJt8IpRho80cTMxcAeZtSOjhfMP cIFgSpczkLaeGzsAMl62yCo= X-Google-Smtp-Source: ABdhPJzBif2Cr3WzuHeQVHxcmoB882c4Z1w13ZVQVWoBKMdPjMB6SiODhbMqbZA2/zvIzxObdMgnCA== X-Received: by 2002:a05:6402:22c6:: with SMTP id dm6mr14793005edb.228.1627192290109; Sat, 24 Jul 2021 22:51:30 -0700 (PDT) Received: from kista.localnet (cpe-86-58-46-198.static.triera.net. [86.58.46.198]) by smtp.gmail.com with ESMTPSA id n17sm135390edr.84.2021.07.24.22.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 22:51:29 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Maxime Ripard , Chen-Yu Tsai , Andre Przywara Cc: Rob Herring , Icenowy Zheng , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Ondrej Jirman , Alessandro Zummo , Alexandre Belloni , linux-rtc@vger.kernel.org Subject: Re: [PATCH v8 04/11] rtc: sun6i: Add support for linear day storage Date: Sun, 25 Jul 2021 07:51:28 +0200 Message-ID: <2045295.MUk6NRVmsd@kista> In-Reply-To: <20210723153838.6785-5-andre.przywara@arm.com> References: <20210723153838.6785-1-andre.przywara@arm.com> <20210723153838.6785-5-andre.przywara@arm.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi Andre! Dne petek, 23. julij 2021 ob 17:38:31 CEST je Andre Przywara napisal(a): > Newer versions of the Allwinner RTC, as for instance found in the H616 > SoC, no longer store a broken-down day/month/year representation in the > RTC_DAY_REG, but just a linear day number. > The user manual does not give any indication about the expected epoch > time of this day count, but the BSP kernel uses the UNIX epoch, which > allows easy support due to existing conversion functions in the kernel. > > Allow tagging a compatible string with a flag, and use that to mark > those new RTCs. Then convert between a UNIX day number (converted into > seconds) and the broken-down day representation using mktime64() and > time64_to_tm() in the set_time/get_time functions. > > That enables support for the RTC in those new chips. > > Signed-off-by: Andre Przywara > --- > drivers/rtc/rtc-sun6i.c | 66 +++++++++++++++++++++++++++-------------- > 1 file changed, 44 insertions(+), 22 deletions(-) Reviewed-by: Jernej Skrabec Best regards, Jernej From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14155C4338F for ; Sun, 25 Jul 2021 05:53:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEAE960F13 for ; Sun, 25 Jul 2021 05:53:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BEAE960F13 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LQwa4OeEfoc3sWV+72hYfRCEYXApAtPlcBti+ik3gtc=; b=O9W3rmcYRtiiwX SysnlpE6q765wx0fawnvT73G4/2kNtt351Lju9Z2yMJXKBW96obXMXGJHuQwrEvF2Qn9P9zUyuCKe dPah6vV4MLYEyBlMVjazr99kUGgpOvpx5ms/3HbLXUMUsfTOgMoybkWQQhvQMD5UE/2fNSMihJVoW D4bQwi4IVoFVB90r2kq2/HWVRfEWoah8/6GHUdw/iLkV/2R091YCr6OBLpbxkFboc7sHdR7BnbrAi yNbLSHiLK6QHxIiEAXJW8ce7TXsQbFqYNbsV8jZuGKcafcEyub+7z9ipBXJhctLbDzcQduYMnBeTw HglPpzb+opKEEDjwYjIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m7X31-008FGV-1x; Sun, 25 Jul 2021 05:51:35 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m7X2x-008FG1-H4 for linux-arm-kernel@lists.infradead.org; Sun, 25 Jul 2021 05:51:32 +0000 Received: by mail-ed1-x52d.google.com with SMTP id f13so4331500edq.13 for ; Sat, 24 Jul 2021 22:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YHRp36bG7u+FDs07iyp7QzfPeLS/I55OgAKDF8o9L94=; b=FZOPUJR1gQbr22sAT5Saa+mI22aj6qruvYvSs7/wIydCI6ebW1KtLYSILQMlvbenhB EjO8eU+szBhrfNefXbiPc1J3lIi5BV9cECBAdd0EhZMkNMQ4c5zJuYVrEHKTjGVcX3cK dKYDJs7neavGxXy8QYHzo12oBgHLhwLKivtOdyDH6kRbKKCIfKoWE5gAUEp5mxmu4jrI bfqGo+G00yWMtsC03MdGaMklz7VgAGPEH7brzWu/CC/IBGbJeuXzR1820u5TDq1O/hHP JoDY9kswbb1IZ0lbJIWW+56YREJWNcta7618eFGWNlHkDi9GJW8URzW+uKbhdfRtHsPY Yynw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YHRp36bG7u+FDs07iyp7QzfPeLS/I55OgAKDF8o9L94=; b=KgOXKDZtdLOg147nLm7AzU+mxu+wfdXThTPhhUSgbhSw7hFoFVVkKakKs556pB2gU+ e6zX160niswAn31w6knmU4+4Q32t5NO929QwWFbNHuKohAQG3ycUcHOZUOkQ+PYJRcVz nuPCoM7RLIfduEO0UkdbuPqeq2JHtrxpZ64yc6FIp/Vsw7b2Td6b0rUVuuZx4I4qpafF yKVUHyiuNaMb0MFoL9I8SvmbuzQUs33i9gTwHMWDv21kI1nFJj9wNlU1K29IbjcxBE6o GMlxeZmSx/IvmteZqrrXD8FUWwzfwZRiGBq6L8zG7rHwI1mqi22GWO8hkNO7Xi9e4ltn kUUA== X-Gm-Message-State: AOAM531PGo6phwLnvkVPr68vIiPbCfSrabVM6IlMtp6gGvt2ZlQ68b3I 9DoQYZ+QdgvBEY/RQVvqOeM= X-Google-Smtp-Source: ABdhPJzBif2Cr3WzuHeQVHxcmoB882c4Z1w13ZVQVWoBKMdPjMB6SiODhbMqbZA2/zvIzxObdMgnCA== X-Received: by 2002:a05:6402:22c6:: with SMTP id dm6mr14793005edb.228.1627192290109; Sat, 24 Jul 2021 22:51:30 -0700 (PDT) Received: from kista.localnet (cpe-86-58-46-198.static.triera.net. [86.58.46.198]) by smtp.gmail.com with ESMTPSA id n17sm135390edr.84.2021.07.24.22.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 22:51:29 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Maxime Ripard , Chen-Yu Tsai , Andre Przywara Cc: Rob Herring , Icenowy Zheng , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Ondrej Jirman , Alessandro Zummo , Alexandre Belloni , linux-rtc@vger.kernel.org Subject: Re: [PATCH v8 04/11] rtc: sun6i: Add support for linear day storage Date: Sun, 25 Jul 2021 07:51:28 +0200 Message-ID: <2045295.MUk6NRVmsd@kista> In-Reply-To: <20210723153838.6785-5-andre.przywara@arm.com> References: <20210723153838.6785-1-andre.przywara@arm.com> <20210723153838.6785-5-andre.przywara@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210724_225131_640304_8FB33E14 X-CRM114-Status: GOOD ( 16.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Andre! Dne petek, 23. julij 2021 ob 17:38:31 CEST je Andre Przywara napisal(a): > Newer versions of the Allwinner RTC, as for instance found in the H616 > SoC, no longer store a broken-down day/month/year representation in the > RTC_DAY_REG, but just a linear day number. > The user manual does not give any indication about the expected epoch > time of this day count, but the BSP kernel uses the UNIX epoch, which > allows easy support due to existing conversion functions in the kernel. > > Allow tagging a compatible string with a flag, and use that to mark > those new RTCs. Then convert between a UNIX day number (converted into > seconds) and the broken-down day representation using mktime64() and > time64_to_tm() in the set_time/get_time functions. > > That enables support for the RTC in those new chips. > > Signed-off-by: Andre Przywara > --- > drivers/rtc/rtc-sun6i.c | 66 +++++++++++++++++++++++++++-------------- > 1 file changed, 44 insertions(+), 22 deletions(-) Reviewed-by: Jernej Skrabec Best regards, Jernej _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel