From owner-freebsd-arm@freebsd.org Mon Oct 24 15:03:32 2016 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F05CC1ED9F for ; Mon, 24 Oct 2016 15:03:32 +0000 (UTC) (envelope-from freebsd-arm@dino.sk) Received: from mailhost.netlabit.sk (mailhost.netlabit.sk [84.245.65.72]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0076DAD4 for ; Mon, 24 Oct 2016 15:03:31 +0000 (UTC) (envelope-from freebsd-arm@dino.sk) Received: from zeta.dino.sk (fw3.dino.sk [84.245.95.254]) (AUTH: LOGIN milan) by mailhost.netlabit.sk with ESMTPA; Mon, 24 Oct 2016 16:58:20 +0200 id 00EC2001.580E218D.0000FE7E Date: Mon, 24 Oct 2016 16:58:20 +0200 From: Milan Obuch To: freebsd-arm@freebsd.org Subject: aw_thermal breakage on Allwinner H3 SoC Message-ID: <20161024165820.16e6dd6f@zeta.dino.sk> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.29; i386-portbld-freebsd10.3) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_mailhost.netlabit.sk-65150-1477321101-0001-2" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Oct 2016 15:03:32 -0000 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--