Skip to contentSkip to conversation

Enable hardware clock (RTC) on the Milk-V Pioneer

PATCH Applied Michael Orlitzky 3 participants 4 messages Jan 7 – Jan 15

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover Enable hardware clock (RTC) on the Milk-V Pioneer

Add the DTS entries needed for the hardware clock on the Milk-V Pioneer. I was able to get this working with an earlier (6.1.x) vendor kernel, but it is disabled in the upstream DTS.

Changes in v2:
- Trim extraneous information from the commit message
- Link to v1: https://lore.kernel.org/sophgo/[email protected]

Michael Orlitzky (1):
riscv: dts: sophgo: enable hardware clock (RTC) on the Milk-V Pioneer

 .../boot/dts/sophgo/sg2042-milkv-pioneer.dts  | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
Signature · 1 line
2.52.0
#1 lore raw

PATCH v2 1/1 riscv: dts: sophgo: enable hardware clock (RTC) on the Milk-V Pioneer

These boards have a working hardware clock if you put a CR-1220 battery in them. We enable it using information from a 6.1.x vendor kernel.

---
 .../boot/dts/sophgo/sg2042-milkv-pioneer.dts  | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +21 -0
index 54d8386bf9c0..ecf8c1e29079 100644
@@ -52,6 +52,17 @@ &emmc {
 	status = "okay";
 };
 
+&i2c0 {
+	pinctrl-0 = <&i2c0_cfg>;
+	pinctrl-names = "default";
+	status = "okay";
+
+	rtc: rtc@68 {
+		compatible = "dallas,ds1307";
+		reg = <0x68>;
+	};
+};
+
 &i2c1 {
 	pinctrl-0 = <&i2c1_cfg>;
 	pinctrl-names = "default";
@@ -89,6 +100,16 @@ sdhci-emmc-rst-pwr-pins {
 		};
 	};
 
+	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;
+		};
+	};
+
 	i2c1_cfg: i2c1-cfg {
 		i2c1-pins {
 			pinmux = <PINMUX(PIN_IIC1_SDA, 0)>,
Signature · 1 line
2.52.0
#2 lore raw

Re: [PATCH v2 1/1] riscv: dts: sophgo: enable hardware clock (RTC) on the Milk-V Pioneer

Quoted 39 lines · Michael Orlitzky

These boards have a working hardware clock if you put a CR-1220 battery in them. We enable it using information from a 6.1.x vendor kernel.

---
  .../boot/dts/sophgo/sg2042-milkv-pioneer.dts  | 21 +++++++++++++++++++
  1 file changed, 21 insertions(+)
arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +14 -0
index 54d8386bf9c0..ecf8c1e29079 100644
@@ -52,6 +52,17 @@ &emmc {
  	status = "okay";
  };
 
+&i2c0 {
+	pinctrl-0 = <&i2c0_cfg>;
+	pinctrl-names = "default";
+	status = "okay";
+
+	rtc: rtc@68 {
+		compatible = "dallas,ds1307";
+		reg = <0x68>;
+	};
+};
+
  &i2c1 {
  	pinctrl-0 = <&i2c1_cfg>;
  	pinctrl-names = "default";
@@ -89,6 +100,16 @@ sdhci-emmc-rst-pwr-pins {
  		};
  	};
 
+	i2c0_cfg: i2c0-cfg {
+		i2c0-pins {
+			pinmux = <PINMUX(PIN_IIC0_SDA, 0)>,

arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts sdhci-emmc-rst-pwr-pins { · line 115

Quoted 10 lines
arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +7 -0
+				 <PINMUX(PIN_IIC0_SCL, 0)>;
+			bias-pull-up;
+			drive-strength-microamp = <26800>;
+			input-schmitt-enable;
+		};
+	};
+
  	i2c1_cfg: i2c1-cfg {
  		i2c1-pins {
  			pinmux = <PINMUX(PIN_IIC1_SDA, 0)>,

Tested based off 6.19-rc1 and passed.

Thanks,

Chen

maintainer Applied
#3 lore raw
In reply to Michael Orlitzky
Quoted 9 lines · Michael Orlitzky

Add the DTS entries needed for the hardware clock on the Milk-V Pioneer. I was able to get this working with an earlier (6.1.x) vendor kernel, but it is disabled in the upstream DTS.

Changes in v2:
- Trim extraneous information from the commit message
- Link to v1: https://lore.kernel.org/sophgo/[email protected]

[...]

Applied to dt/riscv, thanks!

[1/1] riscv: dts: sophgo: enable hardware clock (RTC) on the Milk-V Pioneer

      https://github.com/sophgo/linux/commit/9e81c522680db5998c872fb91ff7877cf3d8ff42

Thanks,
Inochi