Re: Hardware clock on the Pioneer
Chen Wang <[email protected]>
| Newsgroups | dev.linux.lists.sophgo |
|---|---|
| Message-ID | <MA5PR01MB12500FC54D309ED16E01ED380FE86A@MA5PR01MB12500.INDPRD01.PROD.OUTLOOK.COM> |
Hello~
On 12/31/2025 6:56 AM, Michael Orlitzky wrote:
> Hello, I finally have the upstream kernel running on my Pioneer Box,
> and I notice that the hardware clock is not enabled. I've patched this
> in my own kernel (sg2042-milkv-pioneer.dts) by enabling i2c0, defining
> the RTC,
>
> &i2c0 {
> pinctrl-0 = <&i2c0_cfg>;
> pinctrl-names = "default";
> status = "okay";
>
> rtc: rtc@68 {
> compatible = "dallas,ds1307";
> reg = <0x68>;
> };
> };
>
> and copying the pinctrl bits from i2c1:
>
> i2c0_cfg: i2c0-cfg {
> i2c0-pins {
> pinmux = <PINMUX(PIN_IIC0_SDA, 0)>,
> <PINMUX(PIN_IIC0_SCL, 0)>;
> bias-pull-up;
> drive-strength-microamp = <26800>;
> input-schmitt-enable;
> };
> };
>
> It seems to work:
>
> $ sudo hwclock --show
> 2025-12-30 17:54:05.093606-05:00
It looks good to me.
>
> Is there a reason not to do this? The sophgo upstream status page says
> that the RTC is "Low priority, may not be needed." But if the above is
> OK, I will submit a patch for it.
I don't quite remember why I initially said it wasn't needed; perhaps I
just thought it wouldn't significantly impact the main functionality, so
I wasn't in a rush to implement it. Later, I got busy with other things
and didn't have time to work on it.
Therefore, I think it should be ok for you to submit a patch to the
upstream.
BTW, I saw a similar implementation in the sophgo code repository [1],
but it doesn't quite conform to the upstream standard, while your
approach is better.
Link to:
https://github.com/sophgo/linux-riscv/blob/sg2042-rel-6.1.31/arch/riscv/boot/dts/sophgo/mango-milkv-pioneer.dts#L12
[1]
Thanks,
Chen