ALL WINNER high temp. stop

Daniel Braniss danny at cs.huji.ac.il
Mon Sep 26 12:52:47 UTC 2016


> On 21 Sep 2016, at 14:22, Daniel Braniss <danny at cs.huji.ac.il> wrote:
> 
>> 
>> On 21 Sep 2016, at 14:13, Daniel Braniss <danny at cs.huji.ac.il <mailto:danny at cs.huji.ac.il>> wrote:
>> 
>> 
>>> On 21 Sep 2016, at 13:49, Jared McNeill <jmcneill at invisible.ca> wrote:
>>> 
>>> CPU frequency scaling is supported now. Have you added operating points to the dts? Without a heatsink or fan, you need to set a reasonable set of operating points.
>>> 
>>> 64C does seem quite low, the thermal driver uses the power-on default temperature for the shutdown temperature though (which should be > 100C).
>>> 
>>> Are you sure you are using the correct compat string for the thermal driver in your dts? Different SoCs use a different formula for reading the temperature.
>> 
>> I’m using what you sent me :-)
>> https://github.com/jaredmcneill/freebsd/blob/allwinner-h3/sys/boot/fdt/dts/arm/orangepi-plus-2e.dts#L12 <https://github.com/jaredmcneill/freebsd/blob/allwinner-h3/sys/boot/fdt/dts/arm/orangepi-plus-2e.dts#L12> <https://github.com/jaredmcneill/freebsd/blob/allwinner-h3/sys/boot/fdt/dts/arm/orangepi-plus-2e.dts#L121 <https://github.com/jaredmcneill/freebsd/blob/allwinner-h3/sys/boot/fdt/dts/arm/orangepi-plus-2e.dts#L121>>
>> 
> 
> here is my dts for the orange-one:
> /*-
> * Copyright (c) 2016 Jared McNeill <jmcneill at invisible.ca <mailto:jmcneill at invisible.ca>>
> * All rights reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> * 1. Redistributions of source code must retain the above copyright
> *    notice, this list of conditions and the following disclaimer.
> * 2. Redistributions in binary form must reproduce the above copyright
> *    notice, this list of conditions and the following disclaimer in the
> *    documentation and/or other materials provided with the distribution.
> *
> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> *
> * $FreeBSD$
> */
> #include "sun8i-h3-orangepi-one.dts"
> 
> / {
>        clocks {
> 	       ths_clk: clk at 1c20074 {
> 	       	       #clock-cells = <0>;
> 		       compatible = "allwinner,sun8i-h3-ths-clk";
> 		       reg = <0x01c20074 0x4>;
> 		       clocks = <&osc24M>;
> 		       clock-output-names = "ths";
> 		};
>        };
> 	soc {
> 		emac: ethernet at 1c30000 {
> 			compatible = "allwinner,sun8i-h3-emac";
> 			reg = <0x01c30000 0x104>, <0x01c00030 0x4>;
> 			reg-names = "emac", "syscon";
> 			interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
> 			resets = <&ahb_rst 17>;
> 			reset-names = "ahb";
> 			clocks = <&bus_gates 17>;
> 			clock-names = "ahb";
> 			#address-cells = <1>;
> 			#size-cells = <0>;
> 			status = "disabled";
> 		};
> 		
> 		sid: eeprom at 01c14000 {
> 			compatible = "allwinner,sun8i-h3-sid";
> 			reg = <0x01c14000 0x400>;
> 		};
> 
> 		rtp: rtp at 1c25000 {
> 			compatible = "allwinner,sun8i-h3-ts";
> 			reg = <0x01c25000 0x400>;
> 			interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
> 			clocks = <&bus_gates 72>,<&ths_clk>;
> 			clock-names = "ahb", "ths";
> 			resets = <&apb1_rst 8>;
> 			#thermal-sensor-cells = <0>;
> 		};
> 
> 	};
> };
> 
> &mmc0_pins_a {
> 	allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
> };
> 
> &pio {
>        emac_pins_rgmii_a: emac_rgmii at 0 {
>                allwinner,pins = "PD0", "PD1", "PD2", "PD3", "PD4", "PD5",
>                		 "PD7", "PD8", "PD9", "PD10", "PD12", "PD13",
> 				 "PD15", "PD16", "PD17";
>                allwinner,function = "emac";
>                allwinner,drive = <SUN4I_PINCTRL_40_MA>;
>                allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
>        };
> 
> 	emac_phy_reset_pin: emac_phy_reset_pin at 0 {
> 		allwinner,pins = "PD6";
> 		allwinner,function = "gpio_out";
> 		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> 		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> 	};
> };
> 
> 
> /*
> * Board-specific stuff here
> */
> 
> / {
> 	/*
> 	model = "Xunlong Orange Pi One";
> 	compatible = "xunlong,orangepi-one", "allwinner,sun8i-h3";
> 	*/
> 	reg_gmac_3v3: gmac-3v3 {
> 		compatible = "regulator-fixed";
> 		pinctrl-names = "default";
> 		pinctrl-0 = <&emac_phy_reset_pin>;
> 		regulator-name = "gmac-3v3";
> 		regulator-min-microvolt = <3300000>;
> 		regulator-max-microvolt = <3300000>;
> 		startup-delay-us = <100000>;
> 		enable-active-high;
> 		gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
> 	};
> };
> 
> &emac {
> 	phy-supply = <&reg_gmac_3v3>;
> 	phy-mode = "mii";
> 	phy = <&phy1>;
> 
> 	allwinner,leds-active-low;
> 	status = "okay";
> 
> 	allwinner,use-internal-phy;
> 	resets = <&ahb_rst 17>,<&ahb_rst 66>;
> 	reset-names = "ahb", "ephy";
> 	clocks = <&bus_gates 17>,<&bus_gates 128>;
> 	clock-names = "ahb","ephy";
> 
> 	phy1: ethernet-phy at 1 {
> 		reg = <1>;
> 	};
> };
> 
> &ehci2 {
> 	status = "okay";
> };
> 
> 
>> 
>>> 
>>> Cheers,
>>> Jared
>>> 
>>> On Wed, 21 Sep 2016, Daniel Braniss wrote:
>>> 
>>>> hi all,
>>>> now that there is thermal control, trying to compile e.g. from ports
>>>> portmaster, heats up the cpu, which somewhere around 64C
>>>> decides to halt.
>>>> Now, I remember some weeks ago, with a kernel version
>>>> without the thermal stuff compiling python and all went ok,
>>>> so
>>>> Q: what is the thermal high water mark?
>>>> Q: are the latest changes overheating the cpu, or is the thermal driver over
>>>>  cautious?
>>>> 
>>>> danny
>>>> 
>>>> 
>>>> 


I added a printf to see what is read off the thermal sensor, and the first surprise is that it prints it twice for each
sysctl call, next, if I apply the formula from the docs:
	temp = (val - 2794) / -14.882
the numbers are much higher! 

val	C	C’
5ef: 32C  85.67C
5f4: 32C  85.34C
5e0: 34C  86.68C
5e6: 34C  86.28C
5de: 35C  86.82C
5d2: 36C  87.62C
5ca: 37C  88.16C
5ba: 39C  89.24C
5ae: 40C  90.04C
5a9: 41C  90.38C
59d: 42C  91.18C
581: 46C  93.07C
549: 53C  96.83C
541: 54C  97.37C
536: 55C  98.11C
51e: 58C  99.72C
516: 59C 100.26C
509: 60C 101.13C
502: 61C 101.60C
4f7: 62C 102.34C
4ef: 63C 102.88C
4f4: 63C 102.54C
4ea: 64C 103.21C
4eb: 64C 103.14C

Accordingly, the the SHUT0_T_HOT is 0x4E9, and so it shuts down at ~ 64/103, but I checking the temperature
externally and when it shows 35C, sysctl says 38C but val is 0x5C0

so what the f…. is going on here?

danny




More information about the freebsd-arm mailing list