Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1337437yba; Tue, 2 Apr 2019 07:07:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOlB5zaI/gUPlm8NLoFiKtLD/TPwpdVgd8diO6LgF7FEv5tg+Kwz0X+WYjTm9nsGMXqOI/ X-Received: by 2002:a62:58c7:: with SMTP id m190mr68814160pfb.4.1554214047418; Tue, 02 Apr 2019 07:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554214047; cv=none; d=google.com; s=arc-20160816; b=ZDzH8uLqTnpOVMCMhh+NabKDhOvzbfL7ips4p6fi4UPZczMAG7JbuEisyxWEWmt6kU uum49zwJbwGTfiwXRcehMG3QR6COaJaWx3l6Dm4opY0UW5+C/fKybybdJpYEZr9aQerW uvG2rt81wVtpScEY+pHkoQQdMtUXq+mc3Z/xdzUiEwPWb5HtrywKySQuD5DW7KEYrgp8 A+JTjkJwbyGrplA255Y1kSElyr3TZnCs7oUfiFtoPMg4y5MpLUBJoJV98zZym3zXv0C8 BbhKRGs7bex69VouW0cg+RH+7CnNcqdmIEgCzc/dpJnsZfCYfQtF5LSDNNm5Orwp0w7S 5ZHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=r6FtkbJua1T4/WYV/x0LjgXOLhZzPYYU2G250dGXyk4=; b=TxonUD/leS70hBCQ5kZSNttOqmLvUMzcckQ+P+G2NYjUSzbN7e1OLCwfRbXsn7w/QY j7chmlYMOfyUfq5UWZSHErhE+gwneYv+TA8Gb7t+wn5Y8P6mWxk5gIJJqWPKM5UTW7Cv zxRqu+bFhB+YzfY9l+ncABXxwLSZSXJMyBY1Vy1mYnClmIKdGY8ENNfQw5yXLi4ksb5n UIxhwK4ObSakY0Ipo/1jK4nlOEKjdf38lpRFfv3AbbcdW2kqP3lXmxLGGAYHA0fuxvpy X5dJQrp7mVWQHfRxWxC1cX9jWIeEc/x0SLrnyfov0sGoFSZNqxbV2YQgz/l01pYKeZHa OABQ== 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 cy1si11665082plb.429.2019.04.02.07.07.10; Tue, 02 Apr 2019 07:07:27 -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; 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 S1730788AbfDBOGd (ORCPT + 99 others); Tue, 2 Apr 2019 10:06:33 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:54189 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726903AbfDBOGd (ORCPT ); Tue, 2 Apr 2019 10:06:33 -0400 X-Originating-IP: 109.213.83.19 Received: from localhost (alyon-652-1-60-19.w109-213.abo.wanadoo.fr [109.213.83.19]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 1B9CD6001E; Tue, 2 Apr 2019 14:06:27 +0000 (UTC) Date: Tue, 2 Apr 2019 16:06:27 +0200 From: Alexandre Belloni To: Yingjoe Chen Cc: Hsin-Hsiung Wang , Lee Jones , Rob Herring , Matthias Brugger , Mark Brown , Eddie Huang , linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, srv_heupstream@mediatek.com, Alessandro Zummo , Marc Zyngier , Ran Bi , Sean Wang , linux-kernel@vger.kernel.org, Liam Girdwood , linux-mediatek@lists.infradead.org, Mark Rutland , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 9/9] rtc: Add support for the MediaTek MT6358 RTC Message-ID: <20190402140627.GC22216@piout.net> References: <1552275991-34648-1-git-send-email-hsin-hsiung.wang@mediatek.com> <1552275991-34648-10-git-send-email-hsin-hsiung.wang@mediatek.com> <1553161886.13384.7.camel@mtksdaap41> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1553161886.13384.7.camel@mtksdaap41> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/03/2019 17:51:26+0800, Yingjoe Chen wrote: > > Hi, > > > Should use 'rtc: mt6397: ' as prefix for this patch. > > > On Mon, 2019-03-11 at 11:46 +0800, Hsin-Hsiung Wang wrote: > > From: Ran Bi > > > > This add support for the MediaTek MT6358 RTC. MT6397 mfd will pass > > RTC_WRTGR address offset to RTC driver. > > > > Signed-off-by: Ran Bi > > --- > > drivers/rtc/rtc-mt6397.c | 16 ++++++++++++++-- > > 1 file changed, 14 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c > > index f85f1fc..c8a0090 100644 > > --- a/drivers/rtc/rtc-mt6397.c > > +++ b/drivers/rtc/rtc-mt6397.c > > @@ -27,7 +27,7 @@ > > #define RTC_BBPU 0x0000 > > #define RTC_BBPU_CBUSY BIT(6) > > > > -#define RTC_WRTGR 0x003c > > +#define RTC_WRTGR_DEFAULT 0x003c > > > > #define RTC_IRQ_STA 0x0002 > > #define RTC_IRQ_STA_AL BIT(0) > > @@ -78,6 +78,7 @@ struct mt6397_rtc { > > struct regmap *regmap; > > int irq; > > u32 addr_base; > > + u32 wrtgr_offset; > > }; > > > > static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) > > @@ -86,7 +87,8 @@ static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) > > int ret; > > u32 data; > > > > - ret = regmap_write(rtc->regmap, rtc->addr_base + RTC_WRTGR, 1); > > + ret = regmap_write(rtc->regmap, > > + rtc->addr_base + rtc->wrtgr_offset, 1); > > if (ret < 0) > > return ret; > > > > @@ -341,6 +343,15 @@ static int mtk_rtc_probe(struct platform_device *pdev) > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > rtc->addr_base = res->start; > > > > + res = platform_get_resource(pdev, IORESOURCE_REG, 0); > > + if (res) { > > + rtc->wrtgr_offset = res->start; > > + dev_info(&pdev->dev, "register offset:%d\n", rtc->wrtgr_offset); > > + } else { > > + rtc->wrtgr_offset = RTC_WRTGR_DEFAULT; > > + dev_err(&pdev->dev, "Failed to get register offset\n"); > > + } > > + > > Since this will be passed by MFD, do we still need to keep the DEFAULT? > Any case this platform_get_resource will failed? > > It's too bad HW changed this offset, but I'm not sure about passing this > information from MFD. We have 1 register that have different offset now, > and might have others for future chips, adding each one by > IORESOURCE_IRQ doesn't looks like a good solution. Keeping this > information in RTC driver only also looks better. > I agree, this would be better. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com