Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Wahren <wahrenst@gmx.net>
To: Sander Speetjens <sander.speetjens@gmail.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Jonathan Bell <jonathan@raspberrypi.com>,
	linux-rtc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, pbrobinson@gmail.com,
	Dom Cobley <popcornmix@gmail.com>
Subject: Re: [PATCH v8 2/2] rtc: Add Raspberry Pi 5 RTC driver
Date: Wed, 30 Sep 2026 20:44:26 +0200	[thread overview]
Message-ID: <550045ab-fe74-4445-8f6c-4a031f5b436b@gmx.net> (raw)
In-Reply-To: <2872a37d-4f24-4429-aba5-34f020740821@gmail.com>

Am 30.09.26 um 19:29 schrieb Sander Speetjens:
> Hi Stefan,
>
>>> +    // Check if our model is a Raspberry Pi 5, as the RTC is only 
>>> present on that model.
>>> +    if (!of_machine_is_compatible("brcm,bcm2712"))
>>> +        return;
>> I don't like the comment, because it doesn't check for Raspberry Pi 
>> 5, the code checks for a BCM2712 SoC which could also be on a CM5 or 
>> a Raspberry Pi 500+ 
> I changed it to BCM2712, but isn't RPi 5 the generation/platform name 
> and RPi 5b the specific board?
The specific model name for the Raspberry Pi 5 board is "Raspberry Pi 5" 
and it's devicetree compatible is "raspberrypi,5-model-b". Both doesn't 
have anything to do with the generation. "brcm,bcm2712" is the used 
System on chip (SoC), which is common for all board of the 5th generation.

So you can write something like
// Check if our Raspberry Pi board is from the 5th gen ...
>
>>> +#define RPI_FIRMWARE_GET_RTC_REG 0x00030087
>>> +#define RPI_FIRMWARE_SET_RTC_REG 0x00038087
>> Was there a specific reason to not include these defines to 
>> include/soc/bcm2835/raspberry-pi-firmware.h as all the others 
>> firmware tags? 
> No specific reason, this is how Raspberry Pi originally did it, I 
> moved them to raspberrypi-firmware.h
>
>>> +
>>> +enum {
>>> +    RTC_TIME,
>>> +    RTC_ALARM,
>>> +    RTC_ALARM_PENDING,
>>> +    RTC_ALARM_ENABLE,
>>> +    RTC_BBAT_CHG_VOLTS,
>>> +    RTC_BBAT_CHG_VOLTS_MIN,
>>> +    RTC_BBAT_CHG_VOLTS_MAX,
>>> +    RTC_BBAT_VOLTS
>>> +};
>> Hm, an enum suggests that we simply can add / remove items, but 
>> that's not the case. The Raspberry Pi firmware defines the values.
> Should I also move those to raspberrypi-firmware.h or is this not what 
> you imply?
No this wasn't my implication. One way to make this ABI more explicit 
would be to use #define. I think there is no need to move to 
raspberrypi-firmware.
>
>> In case rpi_rtc_set_limits() fails, both limit would be initialized 
>> with 0 and this always fail. Maybe we should dev_warn to 
>> rpi_rtc_set_limits()?
>
> I added a warning for failing to set the min and max values.
>
>> Just to be sure, both calls are optional and not critical for the 
>> drivers function?
>> Why does rpi_rtc_set_charge_voltage have a return value at all?
> I removed the return value
>
>>> +MODULE_ALIAS("platform:raspberrypi-rtc");
>> Is this really necessary for module autoloading?
> I'm not sure, it was used in the previous versions when using the 
> platform device register on the register_clk driver before it had a 
> custom dt node.
You can test by removing the line and compile it as a module. In case 
the RTC driver is still automatically loaded, we can drop it.
>
>
> Kind regards,
>
> Sander Speetjens



  reply	other threads:[~2026-09-30 18:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30  9:52 [PATCH v8 0/2] Raspberry Pi 5 RTC driver Sander Speetjens
2026-09-30  9:52 ` [PATCH v8 1/2] dt-bindings: rtc: Add property for Raspberry Pi 5 RTC Sander Speetjens
2026-09-30  9:52 ` [PATCH v8 2/2] rtc: Add Raspberry Pi 5 RTC driver Sander Speetjens
2026-09-30 16:50   ` Stefan Wahren
2026-09-30 17:29     ` Sander Speetjens
2026-09-30 18:44       ` Stefan Wahren [this message]
2026-09-30 19:07         ` Sander Speetjens

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=550045ab-fe74-4445-8f6c-4a031f5b436b@gmx.net \
    --to=wahrenst@gmx.net \
    --cc=alexandre.belloni@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=jonathan@raspberrypi.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=pbrobinson@gmail.com \
    --cc=popcornmix@gmail.com \
    --cc=robh@kernel.org \
    --cc=sander.speetjens@gmail.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