Tuesday, January 29, 2019

sysutils/u-boot - thermal readings for Pine A64(+)

Hi ports@,
OpenBSD supports temperature readings for Pine A64 (sxitemp.c,
allwinner,sun50i-a64-ths) but dts file in u-boot port does not contain necessary
entry.

Its based on FreeBSD overlay[1] with small changes (no sensor calibration in OpenBSD
yet). Built with FLAVOR=aarch64.

before:
$ sysctl hw
hw.machine=arm64
hw.model=ARM Cortex-A53 r0p4
[…]
hw.sensors.axppmic0.temp0=36.28 degC
hw.sensors.axppmic0.indicator0=On (ACIN), OK
hw.sensors.axppmic0.indicator1=Off (VBUS)
[…]
hw.product=Pine64+
[…]

after:
$ sysctl hw
[…]
hw.sensors.axppmic0.temp0=37.45 degC
hw.sensors.axppmic0.indicator0=On (ACIN), OK
hw.sensors.axppmic0.indicator1=Off (VBUS)
hw.sensors.sxitemp0.temp0=43.57 degC (CPU)
hw.sensors.sxitemp0.temp1=43.57 degC (GPU)
hw.sensors.sxitemp0.temp2=44.39 degC
[…]

Krystian

[1] https://github.com/freebsd/freebsd/blob/master/sys/dts/arm64/overlays/sun50i-a64-ths.dtso

Index: patches/patch-arch_arm_dts_sun50i-a64_dtsi
===================================================================
RCS file: patches/patch-arch_arm_dts_sun50i-a64_dtsi
diff -N patches/patch-arch_arm_dts_sun50i-a64_dtsi
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-arch_arm_dts_sun50i-a64_dtsi 29 Jan 2019 17:31:45 -0000
@@ -0,0 +1,24 @@
+$OpenBSD$
+
+Index: arch/arm/dts/sun50i-a64.dtsi
+--- arch/arm/dts/sun50i-a64.dtsi.orig
++++ arch/arm/dts/sun50i-a64.dtsi
+@@ -666,6 +666,18 @@
+ status = "disabled";
+ };
+
++ ths: thermal-sensor@1c25000 {
++ compatible = "allwinner,sun50i-a64-ths";
++ reg = <0x01c25000 0x100>;
++ interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_THS>;
++ clock-names = "apb", "ths";
++ resets = <&ccu RST_BUS_THS>;
++ reset-names = "apb";
++ #thermal-sensor-cells = <2>;
++ status = "okay";
++ };
++
+ uart0: serial@1c28000 {
+ compatible = "snps,dw-apb-uart";
+ reg = <0x01c28000 0x400>;

No comments:

Post a Comment