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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54459C433F5 for ; Mon, 9 May 2022 15:00:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237847AbiEIPD6 (ORCPT ); Mon, 9 May 2022 11:03:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237851AbiEIPD5 (ORCPT ); Mon, 9 May 2022 11:03:57 -0400 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF5742C8BD7; Mon, 9 May 2022 07:59:53 -0700 (PDT) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 8AEDC1BF212; Mon, 9 May 2022 14:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1652108390; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IVtqCvMASNA9pIuuP5Mp+l/ROYTNTakgxxTILKeChdg=; b=aw45/FZaVjTb17yj4n2Oy5F6bGOQQ9BIXmRgF+KQELYjWOeueUkBw06kLfa3MJnQ9owKOy Oa7Hzhe3oCxsvUzaquM4ffJR8IL9auOMQZL9SJGV1PBcqw3DCsVlDyRM9isDG3ODrKaUtL K8r6jlRXe0vVLPzlT7Q7/3mM9WzfM2eRFRPjAzba4SdS44Rx7tb5++HjN+BtuN/VtsrvmS pzkFN4JqwVULprj3+LxGd64jQjjBfdeSVusYcS+7NWO9FokClJKdKB98edKSPP8EBhHVvC N4Rkbh4k552hLhtjlDSeu+O2AU+V1JEMrPNyYe4ZKL+vLqGJQ1rxbzrbtc3dlQ== Date: Mon, 9 May 2022 16:59:46 +0200 From: Miquel Raynal To: Geert Uytterhoeven Cc: Alessandro Zummo , Alexandre Belloni , Rob Herring , Krzysztof Kozlowski , Magnus Damm , linux-rtc@vger.kernel.org, Linux-Renesas , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Gareth Williams , Milan Stevanovic , Jimmy Lalande , Pascal Eberhard , Thomas Petazzoni , Herve Codina , Clement Leger , Michel Pollet Subject: Re: [PATCH v3 2/6] rtc: rzn1: Add new RTC driver Message-ID: <20220509165946.1e2d581d@xps13> In-Reply-To: References: <20220429104602.368055-1-miquel.raynal@bootlin.com> <20220429104602.368055-3-miquel.raynal@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Geert, geert@linux-m68k.org wrote on Mon, 2 May 2022 16:41:20 +0200: > Hi Miquel, >=20 > On Fri, Apr 29, 2022 at 12:46 PM Miquel Raynal > wrote: > > From: Michel Pollet > > > > Add a basic RTC driver for the RZ/N1. > > > > Signed-off-by: Michel Pollet > > Co-developed-by: Miquel Raynal > > Signed-off-by: Miquel Raynal =20 >=20 > Thanks for your patch! >=20 > > --- /dev/null > > +++ b/drivers/rtc/rtc-rzn1.c > > @@ -0,0 +1,246 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * Renesas RZN1 Real Time Clock interface for Linux =20 >=20 > RZ/N1 Done. >=20 > > +static int rzn1_rtc_probe(struct platform_device *pdev) > > +{ > > + struct rzn1_rtc *rtc; > > + int ret; > > + > > + rtc =3D devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); > > + if (!rtc) > > + return -ENOMEM; > > + > > + platform_set_drvdata(pdev, rtc); > > + > > + rtc->base =3D devm_platform_ioremap_resource(pdev, 0); > > + if (IS_ERR(rtc->base)) > > + return dev_err_probe(&pdev->dev, PTR_ERR(rtc->base), "M= issing reg\n"); > > + > > + rtc->rtcdev =3D devm_rtc_allocate_device(&pdev->dev); > > + if (IS_ERR(rtc->rtcdev)) > > + return PTR_ERR(rtc); > > + > > + rtc->rtcdev->range_min =3D RTC_TIMESTAMP_BEGIN_2000; > > + rtc->rtcdev->range_max =3D RTC_TIMESTAMP_END_2099; > > + rtc->rtcdev->ops =3D &rzn1_rtc_ops; > > + clear_bit(RTC_FEATURE_ALARM, rtc->rtcdev->features); > > + clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->rtcdev->features); > > + > > + pm_runtime_enable(&pdev->dev); > > + pm_runtime_get_sync(&pdev->dev); =20 >=20 > While this call cannot really fail on this platform, you may want to > call pm_runtime_resume_and_get() instead, and check its return > value (else the janitors will make that change later ;-) Right, I misunderstood the doc, I'll change it. >=20 > > + > > + /* > > + * Ensure the clock counter is enabled. > > + * Set 24-hour mode and possible oscillator offset compensation= in SUBU mode. > > + */ > > + writel(RZN1_RTC_CTL0_CE | RZN1_RTC_CTL0_AMPM | RZN1_RTC_CTL0_SL= SB_SUBU, > > + rtc->base + RZN1_RTC_CTL0); > > + > > + /* Disable all interrupts */ > > + writel(0, rtc->base + RZN1_RTC_CTL1); > > + > > + ret =3D devm_rtc_register_device(rtc->rtcdev); > > + if (ret) > > + goto dis_runtime_pm; > > + > > + return 0; > > + > > +dis_runtime_pm: > > + pm_runtime_put_sync(&pdev->dev); =20 >=20 > pm_runtime_put() should be fine, no need for the synchronous version. Right, there is no need for the _sync() version here and below I believe. >=20 > > + pm_runtime_disable(&pdev->dev); > > + > > + return ret; > > +} > > + > > +static int rzn1_rtc_remove(struct platform_device *pdev) > > +{ > > + pm_runtime_put_sync(&pdev->dev); =20 >=20 > pm_runtime_put(). >=20 > > + pm_runtime_disable(&pdev->dev); > > + > > + return 0; > > +} =20 >=20 > Gr{oetje,eeting}s, >=20 > Geert >=20 > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m6= 8k.org >=20 > 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 Thanks, Miqu=C3=A8l