Linux RTC
 help / color / mirror / Atom feed
From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
To: Inochi Amaoto <inochiama@gmail.com>,
	sophgo@lists.linux.dev,  linux-rtc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v15] rtc: sophgo: add rtc support for Sophgo CV1800 SoC
Date: Sat, 10 May 2025 16:30:07 +0200	[thread overview]
Message-ID: <4d15d7b363869080da825ddc700e553a68928c85.camel@gmail.com> (raw)
In-Reply-To: <dm4l3wfcuygmuylz6uqn2g7wztg4tyrjbm24hqcpffjnpkwany@ib2nvjibq2wl>

Hi Inochi!

On Fri, 2025-05-09 at 06:21 +0800, Inochi Amaoto wrote:
> On Wed, May 07, 2025 at 09:56:20PM +0200, Alexander Sverdlin wrote:
> > From: Jingbao Qiu <qiujingbao.dlmu@gmail.com>
> > 
> > Implement the RTC driver for CV1800, which able to provide time alarm.
> > 
> > Signed-off-by: Jingbao Qiu <qiujingbao.dlmu@gmail.com>
> > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>

...

> > +static int cv1800_rtc_probe(struct platform_device *pdev)
> > +{
> > +	struct cv1800_rtc_priv *rtc;
> > +	int ret;
> > +
> > +	rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
> > +	if (!rtc)
> > +		return -ENOMEM;
> > +
> > +	rtc->rtc_map = device_node_to_regmap(pdev->dev.parent->of_node);
> > +	if (IS_ERR(rtc->rtc_map))
> > +		return dev_err_probe(&pdev->dev, PTR_ERR(rtc->rtc_map),
> > +				     "cannot get parent regmap\n");
> > +
> > +	rtc->irq = platform_get_irq(pdev, 0);
> > +	if (rtc->irq < 0)
> > +		return rtc->irq;
> > +
> > +	rtc->clk = devm_clk_get_enabled(pdev->dev.parent, "rtc");
> > +	if (IS_ERR(rtc->clk))
> > +		return dev_err_probe(&pdev->dev, PTR_ERR(rtc->clk),
> > +				     "rtc clk not found\n");
> > +
> > +	platform_set_drvdata(pdev, rtc);
> > +
> > +	device_init_wakeup(&pdev->dev, 1);
> > +
> > +	rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
> > +	if (IS_ERR(rtc->rtc_dev))
> > +		return PTR_ERR(rtc->rtc_dev);
> > +
> > +	rtc->rtc_dev->ops = &cv1800_rtc_ops;
> > +	rtc->rtc_dev->range_max = U32_MAX;
> > +
> > +	ret = devm_request_irq(&pdev->dev, rtc->irq, cv1800_rtc_irq_handler,
> > +			       IRQF_TRIGGER_HIGH, "rtc alarm", rtc);
> > +	if (ret)
> > +		return dev_err_probe(&pdev->dev, ret,
> > +				     "cannot register interrupt handler\n");
> > +
> > +	return devm_rtc_register_device(rtc->rtc_dev);
> > +}
> > +
> 
> I wonder whether the rtc driver may need reset (maybe optional) for this?
> If so, please add it.

I'm not sure which reset you are referring to... RTC module can carry out
system-wide resets, but cannot be reset itself (as I understand).

Initially I was thinking about providing a reboot driver for Linux utilizing
the RTC module but it turns out PSCI interface is not optional on ARM64, which
means PSCI reset interface has to be provided by the firmware (I'm thinking
about U-Boot) and Linux will rely on PSCI reboot.

-- 
Alexander Sverdlin.

  reply	other threads:[~2025-05-10 14:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07 19:56 [PATCH v15] rtc: sophgo: add rtc support for Sophgo CV1800 SoC Alexander Sverdlin
2025-05-08 22:21 ` Inochi Amaoto
2025-05-10 14:30   ` Alexander Sverdlin [this message]
2025-05-10 22:34     ` Inochi Amaoto
2025-05-24 22:17 ` 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=4d15d7b363869080da825ddc700e553a68928c85.camel@gmail.com \
    --to=alexander.sverdlin@gmail.com \
    --cc=inochiama@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=sophgo@lists.linux.dev \
    /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