aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2020-04-14 19:05:17 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2020-04-14 19:05:17 +0000
commitd6b44474961cb52be87177d81ac6c14ddc737f0f (patch)
tree3f3407ac1bffb2c4d2f89d569d07fe52fb07afa5
parent211b4e42597ebf9e9807d3ec20e566794284d9ec (diff)
downloadsrc-d6b44474961cb52be87177d81ac6c14ddc737f0f.tar.gz
src-d6b44474961cb52be87177d81ac6c14ddc737f0f.zip
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
Notes
Notes: svn path=/head/; revision=359935
-rw-r--r--UPDATING8
-rw-r--r--sys/arm/allwinner/aw_sid.c13
-rw-r--r--sys/arm/allwinner/aw_thermal.c14
-rw-r--r--sys/dts/arm/overlays/sun8i-h3-sid.dtso19
-rw-r--r--sys/dts/arm/overlays/sun8i-h3-ths.dtso27
-rw-r--r--sys/dts/arm64/overlays/sun50i-a64-sid.dtso17
-rw-r--r--sys/dts/arm64/overlays/sun50i-a64-ths.dtso27
-rw-r--r--sys/dts/arm64/overlays/sun50i-h5-sid.dtso17
-rw-r--r--sys/dts/arm64/overlays/sun50i-h5-ths.dtso26
9 files changed, 21 insertions, 147 deletions
diff --git a/UPDATING b/UPDATING
index ed0ba85efe29..8f65faaed643 100644
--- a/UPDATING
+++ b/UPDATING
@@ -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
diff --git a/sys/arm/allwinner/aw_sid.c b/sys/arm/allwinner/aw_sid.c
index 3a481933e832..42a667b5a4b1 100644
--- a/sys/arm/allwinner/aw_sid.c
+++ b/sys/arm/allwinner/aw_sid.c
@@ -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 size, uint8_t *buffer)
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;
}
diff --git a/sys/arm/allwinner/aw_thermal.c b/sys/arm/allwinner/aw_thermal.c
index 8d2610e6cbea..90836124ad66 100644
--- a/sys/arm/allwinner/aw_thermal.c
+++ b/sys/arm/allwinner/aw_thermal.c
@@ -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");
diff --git a/sys/dts/arm/overlays/sun8i-h3-sid.dtso b/sys/dts/arm/overlays/sun8i-h3-sid.dtso
deleted file mode 100644
index 16502d3e4e64..000000000000
--- a/sys/dts/arm/overlays/sun8i-h3-sid.dtso
+++ /dev/null
@@ -1,19 +0,0 @@
-/dts-v1/;
-/plugin/;
-
-/ {
- compatible = "allwinner,sun8i-h3";
-};
-
-&{/soc} {
- sid: eeprom@1c14000 {
- compatible = "allwinner,sun8i-h3-sid";
- reg = <0x1c14000 0x400>;
- status = "okay";
-
- /* Data cells */
- ths_calib: calib@234 {
- reg = <0x234 0x2>;
- };
- };
-};
diff --git a/sys/dts/arm/overlays/sun8i-h3-ths.dtso b/sys/dts/arm/overlays/sun8i-h3-ths.dtso
deleted file mode 100644
index ba65caf74da1..000000000000
--- a/sys/dts/arm/overlays/sun8i-h3-ths.dtso
+++ /dev/null
@@ -1,27 +0,0 @@
-/dts-v1/;
-/plugin/;
-
-#include <dt-bindings/interrupt-controller/arm-gic.h>
-#include <dt-bindings/clock/sun8i-h3-ccu.h>
-#include <dt-bindings/reset/sun8i-h3-ccu.h>
-
-/ {
- compatible = "allwinner,sun8i-h3";
-};
-
-&{/soc} {
- ths: thermal_sensor@1c25000 {
- compatible = "allwinner,sun8i-h3-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 = <0>;
- status = "okay";
-
- nvmem-cells = <&ths_calib>;
- nvmem-cell-names = "ths-calib";
- };
-};
diff --git a/sys/dts/arm64/overlays/sun50i-a64-sid.dtso b/sys/dts/arm64/overlays/sun50i-a64-sid.dtso
deleted file mode 100644
index 3d1b351b53c9..000000000000
--- a/sys/dts/arm64/overlays/sun50i-a64-sid.dtso
+++ /dev/null
@@ -1,17 +0,0 @@
-/dts-v1/;
-/plugin/;
-
-/ {
- compatible = "allwinner,sun50i-a64";
-};
-
-&{/soc} {
- sid: eeprom@1c14000 {
- compatible = "allwinner,sun50i-a64-sid";
- reg = <0x1c14000 0x400>;
-
- ths_calib: calib@234 {
- reg = <0x234 0x6>;
- };
- };
-};
diff --git a/sys/dts/arm64/overlays/sun50i-a64-ths.dtso b/sys/dts/arm64/overlays/sun50i-a64-ths.dtso
deleted file mode 100644
index a7c7dd21b2d0..000000000000
--- a/sys/dts/arm64/overlays/sun50i-a64-ths.dtso
+++ /dev/null
@@ -1,27 +0,0 @@
-/dts-v1/;
-/plugin/;
-
-#include <dt-bindings/interrupt-controller/arm-gic.h>
-#include <dt-bindings/clock/sun50i-a64-ccu.h>
-#include <dt-bindings/reset/sun50i-a64-ccu.h>
-
-/ {
- compatible = "allwinner,sun50i-a64";
-};
-
-&{/soc} {
- 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";
-
- nvmem-cells = <&ths_calib>;
- nvmem-cell-names = "ths-calib";
- };
-};
diff --git a/sys/dts/arm64/overlays/sun50i-h5-sid.dtso b/sys/dts/arm64/overlays/sun50i-h5-sid.dtso
deleted file mode 100644
index 9a87348dbc57..000000000000
--- a/sys/dts/arm64/overlays/sun50i-h5-sid.dtso
+++ /dev/null
@@ -1,17 +0,0 @@
-/dts-v1/;
-/plugin/;
-
-/ {
- compatible = "allwinner,sun50i-h5";
-};
-
-&{/soc} {
- sid: eeprom@1c14000 {
- compatible = "allwinner,sun50i-h5-sid";
- reg = <0x1c14000 0x400>;
-
- ths_calib: calib@234 {
- reg = <0x234 0x4>;
- };
- };
-};
diff --git a/sys/dts/arm64/overlays/sun50i-h5-ths.dtso b/sys/dts/arm64/overlays/sun50i-h5-ths.dtso
deleted file mode 100644
index 9099f1660d11..000000000000
--- a/sys/dts/arm64/overlays/sun50i-h5-ths.dtso
+++ /dev/null
@@ -1,26 +0,0 @@
-/dts-v1/;
-/plugin/;
-
-#include <dt-bindings/interrupt-controller/arm-gic.h>
-#include <dt-bindings/clock/sun8i-h3-ccu.h>
-#include <dt-bindings/reset/sun8i-h3-ccu.h>
-
-/ {
- compatible = "allwinner,sun50i-h5";
-};
-
-&{/soc} {
- ths: thermal_sensor@1c25000 {
- compatible = "allwinner,sun50i-h5-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 = <1>;
-
- nvmem-cells = <&ths_calib>;
- nvmem-cell-names = "ths-calib";
- };
-};