svn commit: r359935 - in head: . sys/arm/allwinner sys/dts/arm/overlays sys/dts/arm64/overlays

Emmanuel Vadot manu at FreeBSD.org
Tue Apr 14 19:05:18 UTC 2020


Author: manu
Date: Tue Apr 14 19:05:17 2020
New Revision: 359935
URL: https://svnweb.freebsd.org/changeset/base/359935

Log:
  allwinner: aw_thermal: Cope with DTS changes
  
  The upstream DTS now include the thermal device node and the SID
  calibration entry.
  Update our driver to cope with this change and remove the DTB
  overlays that aren't needed anymore.
  
  MFC after:	2 months
  X-MFC-With:	r359934

Deleted:
  head/sys/dts/arm/overlays/sun8i-h3-sid.dtso
  head/sys/dts/arm/overlays/sun8i-h3-ths.dtso
  head/sys/dts/arm64/overlays/sun50i-a64-sid.dtso
  head/sys/dts/arm64/overlays/sun50i-a64-ths.dtso
  head/sys/dts/arm64/overlays/sun50i-h5-sid.dtso
  head/sys/dts/arm64/overlays/sun50i-h5-ths.dtso
Modified:
  head/UPDATING
  head/sys/arm/allwinner/aw_sid.c
  head/sys/arm/allwinner/aw_thermal.c

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Tue Apr 14 18:57:00 2020	(r359934)
+++ head/UPDATING	Tue Apr 14 19:05:17 2020	(r359935)
@@ -26,6 +26,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
 	disable the most expensive debugging functionality run
 	"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20200414:
+	Upstream DTS from Linux 5.6 was merged and they now have the SID
+	and THS (Secure ID controller and THermal Sensor) node present.
+	The DTB overlays have now been removed from the tree for the H3/H5 and
+	A64 SoCs and the aw_sid and aw_thermal driver have been updated to
+	deal with upstream DTS. If you are using those overlays you need to
+	remove them from loader.conf and update the DTBs on the FAT partition.
+
 20200310:
 	Clang, llvm, lld, lldb, compiler-rt, libc++, libunwind and openmp have
 	been upgraded to 10.0.0.  Please see the 20141231 entry below for

Modified: head/sys/arm/allwinner/aw_sid.c
==============================================================================
--- head/sys/arm/allwinner/aw_sid.c	Tue Apr 14 18:57:00 2020	(r359934)
+++ head/sys/arm/allwinner/aw_sid.c	Tue Apr 14 19:05:17 2020	(r359935)
@@ -100,7 +100,7 @@ static struct aw_sid_efuse a64_efuses[] = {
 		.public = true,
 	},
 	{
-		.name = "ths-calib",
+		.name = "calibration",
 		.desc = "Thermal Sensor Calibration Data",
 		.base = EFUSE_OFFSET,
 		.offset = 0x34,
@@ -121,7 +121,7 @@ static struct aw_sid_efuse a83t_efuses[] = {
 		.public = true,
 	},
 	{
-		.name = "ths-calib",
+		.name = "calibration",
 		.desc = "Thermal Sensor Calibration Data",
 		.base = EFUSE_OFFSET,
 		.offset = 0x34,
@@ -142,11 +142,11 @@ static struct aw_sid_efuse h3_efuses[] = {
 		.public = true,
 	},
 	{
-		.name = "ths-calib",
+		.name = "calibration",
 		.desc = "Thermal Sensor Calibration Data",
 		.base = EFUSE_OFFSET,
 		.offset = 0x34,
-		.size = 2,
+		.size = 4,
 		.id = AW_SID_FUSE_THSSENSOR,
 		.public = false,
 	},
@@ -163,7 +163,7 @@ static struct aw_sid_efuse h5_efuses[] = {
 		.public = true,
 	},
 	{
-		.name = "ths-calib",
+		.name = "calibration",
 		.desc = "Thermal Sensor Calibration Data",
 		.base = EFUSE_OFFSET,
 		.offset = 0x34,
@@ -350,8 +350,7 @@ aw_sid_read(device_t dev, uint32_t offset, uint32_t si
 	sc = device_get_softc(dev);
 
 	for (i = 0; i < sc->sid_conf->nfuses; i++)
-		if (offset == (sc->sid_conf->efuses[i].base +
-		    sc->sid_conf->efuses[i].offset)) {
+		if (offset == sc->sid_conf->efuses[i].offset) {
 			fuse_id = sc->sid_conf->efuses[i].id;
 			break;
 		}

Modified: head/sys/arm/allwinner/aw_thermal.c
==============================================================================
--- head/sys/arm/allwinner/aw_thermal.c	Tue Apr 14 18:57:00 2020	(r359934)
+++ head/sys/arm/allwinner/aw_thermal.c	Tue Apr 14 19:05:17 2020	(r359935)
@@ -267,7 +267,7 @@ static const struct aw_thermal_config h3_config = {
 	.thermal_per = H3_THERMAL_PER,
 	.to_temp = h3_to_temp,
 	.to_reg = h3_to_reg,
-	.calib0_mask = 0xffff,
+	.calib0_mask = 0xffffffff,
 };
 
 static int
@@ -387,12 +387,12 @@ aw_thermal_init(struct aw_thermal_softc *sc)
 	int error;
 
 	node = ofw_bus_get_node(sc->dev);
-	if (nvmem_get_cell_len(node, "ths-calib") > sizeof(calib)) {
-		device_printf(sc->dev, "ths-calib nvmem cell is too large\n");
+	if (nvmem_get_cell_len(node, "calibration") > sizeof(calib)) {
+		device_printf(sc->dev, "calibration nvmem cell is too large\n");
 		return (ENXIO);
 	}
-	error = nvmem_read_cell_by_name(node, "ths-calib",
-	    (void *)&calib, nvmem_get_cell_len(node, "ths-calib"));
+	error = nvmem_read_cell_by_name(node, "calibration",
+	    (void *)&calib, nvmem_get_cell_len(node, "calibration"));
 	/* Read calibration settings from EFUSE */
 	if (error != 0) {
 		device_printf(sc->dev, "Cannot read THS efuse\n");
@@ -624,7 +624,7 @@ aw_thermal_attach(device_t dev)
 		return (ENXIO);
 	}
 
-	if (clk_get_by_ofw_name(dev, 0, "apb", &sc->clk_apb) == 0) {
+	if (clk_get_by_ofw_name(dev, 0, "bus", &sc->clk_apb) == 0) {
 		error = clk_enable(sc->clk_apb);
 		if (error != 0) {
 			device_printf(dev, "cannot enable apb clock\n");
@@ -632,7 +632,7 @@ aw_thermal_attach(device_t dev)
 		}
 	}
 
-	if (clk_get_by_ofw_name(dev, 0, "ths", &sc->clk_ths) == 0) {
+	if (clk_get_by_ofw_name(dev, 0, "mod", &sc->clk_ths) == 0) {
 		error = clk_set_freq(sc->clk_ths, sc->conf->clk_rate, 0);
 		if (error != 0) {
 			device_printf(dev, "cannot set ths clock rate\n");


More information about the svn-src-all mailing list