devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Yingjoe Chen <yingjoe.chen@mediatek.com>
Cc: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com>,
	Lee Jones <lee.jones@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Eddie Huang <eddie.huang@mediatek.com>,
	linux-rtc@vger.kernel.org, devicetree@vger.kernel.org,
	srv_heupstream@mediatek.com,
	Alessandro Zummo <a.zummo@towertech.it>,
	Marc Zyngier <marc.zyngier@arm.com>, Ran Bi <ran.bi@mediatek.com>,
	Sean Wang <sean.wang@mediatek.com>,
	linux-kernel@vger.kernel.org, Liam Girdwood <lgirdwood@gmail.com>,
	linux-mediatek@lists.infradead.org,
	Mark Rutland <mark.rutland@arm.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 9/9] rtc: Add support for the MediaTek MT6358 RTC
Date: Tue, 2 Apr 2019 16:06:27 +0200	[thread overview]
Message-ID: <20190402140627.GC22216@piout.net> (raw)
In-Reply-To: <1553161886.13384.7.camel@mtksdaap41>

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 <ran.bi@mediatek.com>
> > 
> > This add support for the MediaTek MT6358 RTC. MT6397 mfd will pass
> > RTC_WRTGR address offset to RTC driver.
> > 
> > Signed-off-by: Ran Bi <ran.bi@mediatek.com>
> > ---
> >  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

  reply	other threads:[~2019-04-02 14:06 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-11  3:46 [PATCH v2 0/9] Add Support for MediaTek PMIC MT6358 Hsin-Hsiung Wang
2019-03-11  3:46 ` [PATCH v2 1/9] mfd: mt6397: clean up code Hsin-Hsiung Wang
2019-03-11 19:01   ` Sean Wang
2019-03-12 14:49     ` Matthias Brugger
2019-04-02  6:48   ` Lee Jones
2019-03-11  3:46 ` [PATCH v2 2/9] mfd: mt6397: extract irq related code from core driver Hsin-Hsiung Wang
2019-03-11 19:10   ` Sean Wang
2019-03-14 23:25   ` Nicolas Boichat
2019-03-11  3:46 ` [PATCH v2 3/9] dt-bindings: mfd: Add compatible for the MediaTek MT6358 PMIC Hsin-Hsiung Wang
2019-03-11 19:19   ` Sean Wang
2019-03-11 22:06     ` Rob Herring
2019-03-12  2:25       ` Sean Wang
2019-04-02  7:00   ` Lee Jones
2019-03-11  3:46 ` [PATCH v2 4/9] regulator: Add document for MT6358 regulator Hsin-Hsiung Wang
2019-03-11 19:43   ` Sean Wang
2019-03-11  3:46 ` [PATCH v2 5/9] mfd: Add support for the MediaTek MT6358 PMIC Hsin-Hsiung Wang
2019-03-11  8:22   ` Nicolas Boichat
     [not found]   ` <1552275991-34648-6-git-send-email-hsin-hsiung.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-03-11 20:05     ` Sean Wang
2019-03-15  7:10   ` Nicolas Boichat
2019-03-15  7:25     ` Claire Chang
2019-03-15  7:37     ` Claire Chang
2019-03-11  3:46 ` [PATCH v2 6/9] regulator: mt6358: Add support for MT6358 regulator Hsin-Hsiung Wang
2019-03-13 15:01   ` Mark Brown
2019-03-11  3:46 ` [PATCH v2 7/9] arm64: dts: mt6358: add PMIC MT6358 related nodes Hsin-Hsiung Wang
2019-03-11 20:23   ` Sean Wang
2019-03-11  3:46 ` [PATCH v2 8/9] rtc: mt6397: fix alarm register overwrite Hsin-Hsiung Wang
2019-03-11  6:05   ` Eddie Huang
2019-03-11 20:50   ` Sean Wang
2019-03-14  2:46     ` mtk14576
2019-04-02 14:07   ` Alexandre Belloni
2019-03-11  3:46 ` [PATCH v2 9/9] rtc: Add support for the MediaTek MT6358 RTC Hsin-Hsiung Wang
2019-03-11  6:10   ` Eddie Huang
2019-03-21  9:51   ` Yingjoe Chen
2019-04-02 14:06     ` Alexandre Belloni [this message]
2019-03-11 21:21 ` [PATCH v2 0/9] Add Support for MediaTek PMIC MT6358 Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190402140627.GC22216@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=eddie.huang@mediatek.com \
    --cc=hsin-hsiung.wang@mediatek.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=ran.bi@mediatek.com \
    --cc=robh+dt@kernel.org \
    --cc=sean.wang@mediatek.com \
    --cc=srv_heupstream@mediatek.com \
    --cc=yingjoe.chen@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).