Re: [LEDE-DEV] [PATCH] brcm2708: backport upstream thermal driver
On 2017-04-14 01:01, Álvaro Fernández Rojas wrote: > Maybe you should also provide a new kernel module in modules.mk for this > one... Please don't. Simply enable it in the kernel config instead. - Felix ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [PATCH] brcm2708: backport upstream thermal driver
Maybe you should also provide a new kernel module in modules.mk for this one... Acked-by: Álvaro Fernández RojasEl 02/04/2017 a las 0:34, Rafał Miłecki escribió: > From: Rafał Miłecki > > Signed-off-by: Rafał Miłecki > --- > ...cm2835-add-thermal-driver-for-bcm2835-SoC.patch | 365 > + > 1 file changed, 365 insertions(+) > create mode 100644 > target/linux/brcm2708/patches-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch > > diff --git > a/target/linux/brcm2708/patches-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch > > b/target/linux/brcm2708/patches-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch > new file mode 100644 > index 00..a11c542913 > --- /dev/null > +++ > b/target/linux/brcm2708/patches-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch > @@ -0,0 +1,365 @@ > +From bcb7dd9ef206f7d646ed8dac6fe7772083714253 Mon Sep 17 00:00:00 2001 > +From: Stefan Wahren > +Date: Fri, 31 Mar 2017 20:03:06 + > +Subject: [PATCH] thermal: bcm2835: add thermal driver for bcm2835 SoC > +MIME-Version: 1.0 > +Content-Type: text/plain; charset=UTF-8 > +Content-Transfer-Encoding: 8bit > + > +Add basic thermal driver for bcm2835 SoC. > + > +This driver currently make sure that tsense HW block is set up > +correctly. > + > +Tested-by: Rafał Miłecki > +Signed-off-by: Martin Sperl > +Signed-off-by: Stefan Wahren > +Acked-by: Eric Anholt > +Acked-by: Eduardo Valentin > +Signed-off-by: Eduardo Valentin > +--- > + drivers/thermal/Kconfig | 8 + > + drivers/thermal/Makefile | 1 + > + drivers/thermal/bcm2835_thermal.c | 314 > ++ > + 3 files changed, 323 insertions(+) > + create mode 100644 drivers/thermal/bcm2835_thermal.c > + > +--- a/drivers/thermal/Kconfig > b/drivers/thermal/Kconfig > +@@ -434,4 +434,12 @@ depends on (ARCH_QCOM && OF) || COMPILE_ > + source "drivers/thermal/qcom/Kconfig" > + endmenu > + > ++config BCM2835_THERMAL > ++tristate "Thermal sensors on bcm2835 SoC" > ++depends on ARCH_BCM2835 || COMPILE_TEST > ++depends on HAS_IOMEM > ++depends on THERMAL_OF > ++help > ++ Support for thermal sensors on Broadcom bcm2835 SoCs. > ++ > + endif > +--- a/drivers/thermal/Makefile > b/drivers/thermal/Makefile > +@@ -55,3 +55,4 @@ obj-$(CONFIG_TEGRA_SOCTHERM) += tegra/ > + obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o > + obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o > + obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o > ++obj-$(CONFIG_BCM2835_THERMAL) += bcm2835_thermal.o > +--- /dev/null > b/drivers/thermal/bcm2835_thermal.c > +@@ -0,0 +1,314 @@ > ++/* > ++ * Driver for Broadcom BCM2835 SoC temperature sensor > ++ * > ++ * Copyright (C) 2016 Martin Sperl > ++ * > ++ * This program is free software; you can redistribute it and/or modify > ++ * it under the terms of the GNU General Public License as published by > ++ * the Free Software Foundation; either version 2 of the License, or > ++ * (at your option) any later version. > ++ * > ++ * This program is distributed in the hope that it will be useful, > ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of > ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > ++ * GNU General Public License for more details. > ++ */ > ++ > ++#include > ++#include > ++#include > ++#include > ++#include > ++#include > ++#include > ++#include > ++#include > ++#include > ++#include > ++#include > ++ > ++#define BCM2835_TS_TSENSCTL 0x00 > ++#define BCM2835_TS_TSENSSTAT0x04 > ++ > ++#define BCM2835_TS_TSENSCTL_PRWDW BIT(0) > ++#define BCM2835_TS_TSENSCTL_RSTBBIT(1) > ++ > ++/* > ++ * bandgap reference voltage in 6 mV increments > ++ * 000b = 1178 mV, 001b = 1184 mV, ... 111b = 1220 mV > ++ */ > ++#define BCM2835_TS_TSENSCTL_CTRL_BITS 3 > ++#define BCM2835_TS_TSENSCTL_CTRL_SHIFT 2 > ++#define BCM2835_TS_TSENSCTL_CTRL_MASK \ > ++GENMASK(BCM2835_TS_TSENSCTL_CTRL_BITS + \ > ++BCM2835_TS_TSENSCTL_CTRL_SHIFT - 1, \ > ++BCM2835_TS_TSENSCTL_CTRL_SHIFT) > ++#define BCM2835_TS_TSENSCTL_CTRL_DEFAULT1 > ++#define BCM2835_TS_TSENSCTL_EN_INT BIT(5) > ++#define BCM2835_TS_TSENSCTL_DIRECT BIT(6) > ++#define BCM2835_TS_TSENSCTL_CLR_INT BIT(7) > ++#define BCM2835_TS_TSENSCTL_THOLD_SHIFT 8 > ++#define BCM2835_TS_TSENSCTL_THOLD_BITS 10 > ++#define BCM2835_TS_TSENSCTL_THOLD_MASK \ > ++GENMASK(BCM2835_TS_TSENSCTL_THOLD_BITS + \ > ++BCM2835_TS_TSENSCTL_THOLD_SHIFT - 1, \ > ++
[LEDE-DEV] [PATCH] brcm2708: backport upstream thermal driver
From: Rafał MiłeckiSigned-off-by: Rafał Miłecki --- ...cm2835-add-thermal-driver-for-bcm2835-SoC.patch | 365 + 1 file changed, 365 insertions(+) create mode 100644 target/linux/brcm2708/patches-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch diff --git a/target/linux/brcm2708/patches-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch b/target/linux/brcm2708/patches-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch new file mode 100644 index 00..a11c542913 --- /dev/null +++ b/target/linux/brcm2708/patches-4.9/081-0001-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch @@ -0,0 +1,365 @@ +From bcb7dd9ef206f7d646ed8dac6fe7772083714253 Mon Sep 17 00:00:00 2001 +From: Stefan Wahren +Date: Fri, 31 Mar 2017 20:03:06 + +Subject: [PATCH] thermal: bcm2835: add thermal driver for bcm2835 SoC +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add basic thermal driver for bcm2835 SoC. + +This driver currently make sure that tsense HW block is set up +correctly. + +Tested-by: Rafał Miłecki +Signed-off-by: Martin Sperl +Signed-off-by: Stefan Wahren +Acked-by: Eric Anholt +Acked-by: Eduardo Valentin +Signed-off-by: Eduardo Valentin +--- + drivers/thermal/Kconfig | 8 + + drivers/thermal/Makefile | 1 + + drivers/thermal/bcm2835_thermal.c | 314 ++ + 3 files changed, 323 insertions(+) + create mode 100644 drivers/thermal/bcm2835_thermal.c + +--- a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig +@@ -434,4 +434,12 @@ depends on (ARCH_QCOM && OF) || COMPILE_ + source "drivers/thermal/qcom/Kconfig" + endmenu + ++config BCM2835_THERMAL ++ tristate "Thermal sensors on bcm2835 SoC" ++ depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on HAS_IOMEM ++ depends on THERMAL_OF ++ help ++Support for thermal sensors on Broadcom bcm2835 SoCs. ++ + endif +--- a/drivers/thermal/Makefile b/drivers/thermal/Makefile +@@ -55,3 +55,4 @@ obj-$(CONFIG_TEGRA_SOCTHERM) += tegra/ + obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o + obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o + obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o ++obj-$(CONFIG_BCM2835_THERMAL) += bcm2835_thermal.o +--- /dev/null b/drivers/thermal/bcm2835_thermal.c +@@ -0,0 +1,314 @@ ++/* ++ * Driver for Broadcom BCM2835 SoC temperature sensor ++ * ++ * Copyright (C) 2016 Martin Sperl ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define BCM2835_TS_TSENSCTL 0x00 ++#define BCM2835_TS_TSENSSTAT 0x04 ++ ++#define BCM2835_TS_TSENSCTL_PRWDW BIT(0) ++#define BCM2835_TS_TSENSCTL_RSTB BIT(1) ++ ++/* ++ * bandgap reference voltage in 6 mV increments ++ * 000b = 1178 mV, 001b = 1184 mV, ... 111b = 1220 mV ++ */ ++#define BCM2835_TS_TSENSCTL_CTRL_BITS 3 ++#define BCM2835_TS_TSENSCTL_CTRL_SHIFT2 ++#define BCM2835_TS_TSENSCTL_CTRL_MASK \ ++ GENMASK(BCM2835_TS_TSENSCTL_CTRL_BITS + \ ++ BCM2835_TS_TSENSCTL_CTRL_SHIFT - 1, \ ++ BCM2835_TS_TSENSCTL_CTRL_SHIFT) ++#define BCM2835_TS_TSENSCTL_CTRL_DEFAULT 1 ++#define BCM2835_TS_TSENSCTL_EN_INTBIT(5) ++#define BCM2835_TS_TSENSCTL_DIRECTBIT(6) ++#define BCM2835_TS_TSENSCTL_CLR_INT BIT(7) ++#define BCM2835_TS_TSENSCTL_THOLD_SHIFT 8 ++#define BCM2835_TS_TSENSCTL_THOLD_BITS10 ++#define BCM2835_TS_TSENSCTL_THOLD_MASK \ ++ GENMASK(BCM2835_TS_TSENSCTL_THOLD_BITS + \ ++ BCM2835_TS_TSENSCTL_THOLD_SHIFT - 1, \ ++ BCM2835_TS_TSENSCTL_THOLD_SHIFT) ++/* ++ * time how long the block to be asserted in reset ++ * which based on a clock counter (TSENS clock assumed) ++ */ ++#define BCM2835_TS_TSENSCTL_RSTDELAY_SHIFT18 ++#define BCM2835_TS_TSENSCTL_RSTDELAY_BITS 8 ++#define BCM2835_TS_TSENSCTL_REGULEN BIT(26) ++ ++#define BCM2835_TS_TSENSSTAT_DATA_BITS10 ++#define BCM2835_TS_TSENSSTAT_DATA_SHIFT