Re: [PATCH v4] ARM: dts: exynos: Add Samsung Galaxy Tab 3 8.0 boards

Artur Weber
2023-06-22T12:52:44Z

On 04/06/2023 21:15, Krzysztof Kozlowski wrote:
> On 04/06/2023 18:56, Artur Weber wrote:
>> +/*
>> + * This device does not use the built-in RTC; instead, the RTC in the
>> + * S5M8786 PMIC is used instead. Remove the unused node to avoid DTB check
>> + * warnings.
>> + */
>> +/delete-node/ &rtc;
>
> This is not the solution. The S3C RTC is there. Just like all other
> boards we have two RTCs and DTS should be complete. Definitely you
> should not remove something just because there were warnings. Instead
> warnings should be fixed.

The problem is that the built-in RTC does not seem to work on this
device. I attempted to add it, using the same clocks as other devices
in mainline using the S5M8676 PMIC:

&rtc {
status = "okay";
clocks = <&clock CLK_RTC>, <&s5m8767_osc S2MPS11_CLK_AP>;
clock-names = "rtc", "rtc_src";
};

However, it just prints the following on startup:

s3c-rtc 10070000.rtc: rtc disabled, re-enabling
s3c-rtc 10070000.rtc: registered as rtc0
s3c-rtc 10070000.rtc: hctosys: unable to read the hardware clock

Since the internal RTC gets registered as rtc0, it's used as the default
by the OS, whereas the working RTC from the PMIC is registered as rtc1.
Writing to the internal RTC succeeds but the settings are not kept after
a reboot. The PMIC's RTC works fine.

This isn't a mainline-only issue; the internal RTC does not work in the
downstream kernel on this device either.

Not adding the RTC node results in a warning about missing clocks
(exynos4.dtsi only provides 1 clock, whereas bindings require 2):

arch/arm/boot/dts/exynos4212-tab3-3g8.dtb: rtc@10070000: clocks: [[5, 346]] is too short
From schema: /mnt/linux/Documentation/devicetree/bindings/rtc/s3c-rtc.yaml
arch/arm/boot/dts/exynos4212-tab3-3g8.dtb: rtc@10070000: clock-names: ['rtc'] is too short
From schema: /mnt/linux/Documentation/devicetree/bindings/rtc/s3c-rtc.yaml

...which makes sense, since we don't want to add clocks given that we're
not going to be using this RTC. I suppose deleting the node with
delete-node is a bit too destructive though.

I guess a good solution would be to set up the &rtc node as seen in
the snippet I sent earlier, but keep it disabled + add a note explaining
why it's done.

In your opinion, what would be the best solution?

Best regards
Artur