Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Oct 2016 16:58:20 +0200
From:      Milan Obuch <freebsd-arm@dino.sk>
To:        freebsd-arm@freebsd.org
Subject:   aw_thermal breakage on Allwinner H3 SoC
Message-ID:  <20161024165820.16e6dd6f@zeta.dino.sk>

next in thread | raw e-mail | index | archive | help
This is a MIME-formatted message.  If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_mailhost.netlabit.sk-65150-1477321101-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

today I svnup'ped sources for 12-CURRENT I use to test on Orange Pi One
to svn revision 307846 and there was no aw_thermal device anymore.
After some fiddling I found reason is in aw_sid.c, namely in function
aw_sid_read_tscalib. I managed to get it working, somehow, giving the
patch in attachment. This way "sun8i-h3-sid" is defined and attaches,
which in turn makes aw_thermal attached and working, a bit.

Almost identical patch, without the last chunk was necessary in past,
but now behavior changed a bit - namely, sysctl dev.aw_thermal.0.cpu
shows 99C right after start, now, running for almost six hours idle,
100C. This is surely wrong. SoC is not that hot given I can put my
finger on it without risk of being immediatelly burned. Before this
change it showed some 49 degrees right after power on and rises slowly
up to 60 - 63 degrees. This values were not correct, too, temperature
is maybe 45 degrees or so according to my finger integrated
thermometer :)

Did anybody test this on H3 based board? If yes, is there anything
special to be put into FDT definition file?

Has anybody a clue what's going on? If someone has an idea what to
check, I am ready to check it, but currently have not much experience
with sensors in SoC.

Regards,
Milan

--=_mailhost.netlabit.sk-65150-1477321101-0001-2
Content-Type: text/x-patch; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=aw_sid.c.diff

Index: /usr/src/sys/arm/allwinner/aw_sid.c
===================================================================
--- /usr/src/sys/arm/allwinner/aw_sid.c	(revision 307846)
+++ /usr/src/sys/arm/allwinner/aw_sid.c	(working copy)
@@ -54,6 +54,7 @@
 
 #define	A10_ROOT_KEY_OFF	0x0
 #define	A83T_ROOT_KEY_OFF	SID_SRAM
+#define	H3_ROOT_KEY_OFF		SID_SRAM
 
 #define	ROOT_KEY_SIZE		4
 
@@ -61,6 +62,7 @@
 	A10_SID = 1,
 	A20_SID,
 	A83T_SID,
+	H3_SID,
 };
 
 static struct ofw_compat_data compat_data[] = {
@@ -67,6 +69,7 @@
 	{ "allwinner,sun4i-a10-sid",		A10_SID},
 	{ "allwinner,sun7i-a20-sid",		A20_SID},
 	{ "allwinner,sun8i-a83t-sid",		A83T_SID},
+	{ "allwinner,sun8i-h3-sid",		H3_SID},
 	{ NULL,					0 }
 };
 
@@ -124,6 +127,9 @@
 	case A83T_SID:
 		sc->root_key_off = A83T_ROOT_KEY_OFF;
 		break;
+	case H3_SID:
+		sc->root_key_off = H3_ROOT_KEY_OFF;
+		break;
 	default:
 		sc->root_key_off = A10_ROOT_KEY_OFF;
 		break;
@@ -146,7 +152,7 @@
 	sc = aw_sid_sc;
 	if (sc == NULL)
 		return (ENXIO);
-	if (sc->type != A83T_SID)
+	if (sc->type != A83T_SID && sc->type != H3_SID)
 		return (ENXIO);
 
 	*calib0 = RD4(sc, SID_THERMAL_CALIB0);

--=_mailhost.netlabit.sk-65150-1477321101-0001-2--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20161024165820.16e6dd6f>