diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2019-08-09 19:50:30 +0200 |
---|---|---|
committer | Álvaro Fernández Rojas <noltari@gmail.com> | 2019-08-27 11:10:01 +0200 |
commit | 2340c646e6a5da658e114be2f721ff90853588d4 (patch) | |
tree | df9744d2344e71e8c5d1b75c3e1528bc474313fe /target/linux/brcm2708/patches-4.19/950-0540-thermal-brcmstb_thermal-Add-BCM2838-support.patch | |
parent | 81d0da118694feb874f992093063a2852285d194 (diff) | |
download | upstream-2340c646e6a5da658e114be2f721ff90853588d4.tar.gz upstream-2340c646e6a5da658e114be2f721ff90853588d4.tar.bz2 upstream-2340c646e6a5da658e114be2f721ff90853588d4.zip |
brcm2708: update to latest patches from RPi foundation
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/brcm2708/patches-4.19/950-0540-thermal-brcmstb_thermal-Add-BCM2838-support.patch')
-rw-r--r-- | target/linux/brcm2708/patches-4.19/950-0540-thermal-brcmstb_thermal-Add-BCM2838-support.patch | 162 |
1 files changed, 0 insertions, 162 deletions
diff --git a/target/linux/brcm2708/patches-4.19/950-0540-thermal-brcmstb_thermal-Add-BCM2838-support.patch b/target/linux/brcm2708/patches-4.19/950-0540-thermal-brcmstb_thermal-Add-BCM2838-support.patch deleted file mode 100644 index 1dcc822b86..0000000000 --- a/target/linux/brcm2708/patches-4.19/950-0540-thermal-brcmstb_thermal-Add-BCM2838-support.patch +++ /dev/null @@ -1,162 +0,0 @@ -From fa0113f19ec808428cad9d92a17d13f17bfbd07e Mon Sep 17 00:00:00 2001 -From: Stefan Wahren <wahrenst@gmx.net> -Date: Sat, 18 May 2019 12:26:11 +0200 -Subject: [PATCH 540/725] thermal: brcmstb_thermal: Add BCM2838 support - -The BCM2838 has an AVS TMON hardware block. This adds the necessary -support to the brcmstb_thermal driver ( no trip handling ). - -Signed-off-by: Stefan Wahren <wahrenst@gmx.net> ---- - drivers/thermal/broadcom/Kconfig | 2 +- - drivers/thermal/broadcom/brcmstb_thermal.c | 65 +++++++++++++++++++--- - 2 files changed, 58 insertions(+), 9 deletions(-) - ---- a/drivers/thermal/broadcom/Kconfig -+++ b/drivers/thermal/broadcom/Kconfig -@@ -8,7 +8,7 @@ config BCM2835_THERMAL - - config BRCMSTB_THERMAL - tristate "Broadcom STB AVS TMON thermal driver" -- depends on ARCH_BRCMSTB || COMPILE_TEST -+ depends on ARCH_BRCMSTB || ARCH_BCM2835 || COMPILE_TEST - help - Enable this driver if you have a Broadcom STB SoC and would like - thermal framework support. ---- a/drivers/thermal/broadcom/brcmstb_thermal.c -+++ b/drivers/thermal/broadcom/brcmstb_thermal.c -@@ -19,6 +19,7 @@ - #define pr_fmt(fmt) DRV_NAME ": " fmt - - #include <linux/bitops.h> -+#include <linux/clk.h> - #include <linux/device.h> - #include <linux/err.h> - #include <linux/io.h> -@@ -31,9 +32,6 @@ - #include <linux/thermal.h> - - #define AVS_TMON_STATUS 0x00 -- #define AVS_TMON_STATUS_valid_msk BIT(11) -- #define AVS_TMON_STATUS_data_msk GENMASK(10, 1) -- #define AVS_TMON_STATUS_data_shift 1 - - #define AVS_TMON_EN_OVERTEMP_RESET 0x04 - #define AVS_TMON_EN_OVERTEMP_RESET_msk BIT(0) -@@ -111,10 +109,19 @@ static struct avs_tmon_trip avs_tmon_tri - }, - }; - -+struct brcmstb_thermal_of_data { -+ const struct thermal_zone_of_device_ops *of_ops; -+ u32 status_valid_mask; -+ u32 status_data_mask; -+ u32 status_data_shift; -+}; -+ - struct brcmstb_thermal_priv { - void __iomem *tmon_base; - struct device *dev; - struct thermal_zone_device *thermal; -+ struct clk *clk; -+ const struct brcmstb_thermal_of_data *socdata; - }; - - static void avs_tmon_get_coeffs(struct thermal_zone_device *tz, int *slope, -@@ -164,17 +171,18 @@ static inline u32 avs_tmon_temp_to_code( - static int brcmstb_get_temp(void *data, int *temp) - { - struct brcmstb_thermal_priv *priv = data; -+ const struct brcmstb_thermal_of_data *socdata = priv->socdata; - u32 val; - long t; - - val = __raw_readl(priv->tmon_base + AVS_TMON_STATUS); - -- if (!(val & AVS_TMON_STATUS_valid_msk)) { -+ if (!(val & socdata->status_valid_mask)) { - dev_err(priv->dev, "reading not valid\n"); - return -EIO; - } - -- val = (val & AVS_TMON_STATUS_data_msk) >> AVS_TMON_STATUS_data_shift; -+ val = (val & socdata->status_data_mask) >> socdata->status_data_shift; - - t = avs_tmon_code_to_temp(priv->thermal, val); - if (t < 0) -@@ -299,13 +307,34 @@ static int brcmstb_set_trips(void *data, - return 0; - } - --static struct thermal_zone_of_device_ops of_ops = { -+static const struct thermal_zone_of_device_ops bcm7445_thermal_of_ops = { - .get_temp = brcmstb_get_temp, - .set_trips = brcmstb_set_trips, - }; - -+static const struct thermal_zone_of_device_ops bcm2838_thermal_of_ops = { -+ .get_temp = brcmstb_get_temp, -+}; -+ -+static const struct brcmstb_thermal_of_data bcm7445_thermal_of_data = { -+ .of_ops = &bcm7445_thermal_of_ops, -+ .status_valid_mask = BIT(11), -+ .status_data_mask = GENMASK(10, 1), -+ .status_data_shift = 1, -+}; -+ -+static const struct brcmstb_thermal_of_data bcm2838_thermal_of_data = { -+ .of_ops = &bcm2838_thermal_of_ops, -+ .status_valid_mask = BIT(10), -+ .status_data_mask = GENMASK(9, 0), -+ .status_data_shift = 0, -+}; -+ - static const struct of_device_id brcmstb_thermal_id_table[] = { -- { .compatible = "brcm,avs-tmon" }, -+ { .compatible = "brcm,avs-tmon", -+ .data = &bcm7445_thermal_of_data }, -+ { .compatible = "brcm,avs-tmon-bcm2838", -+ .data = &bcm2838_thermal_of_data }, - {}, - }; - MODULE_DEVICE_TABLE(of, brcmstb_thermal_id_table); -@@ -326,10 +355,27 @@ static int brcmstb_thermal_probe(struct - if (IS_ERR(priv->tmon_base)) - return PTR_ERR(priv->tmon_base); - -+ priv->socdata = of_device_get_match_data(&pdev->dev); -+ if (!priv->socdata) { -+ dev_err(&pdev->dev, "no device match found\n"); -+ return -ENODEV; -+ } -+ -+ priv->clk = devm_clk_get(&pdev->dev, NULL); -+ if (IS_ERR(priv->clk) && PTR_ERR(priv->clk) == -EPROBE_DEFER) -+ return -EPROBE_DEFER; -+ -+ if (!IS_ERR(priv->clk)) { -+ ret = clk_prepare_enable(priv->clk); -+ if (ret) -+ return ret; -+ } -+ - priv->dev = &pdev->dev; - platform_set_drvdata(pdev, priv); - -- thermal = thermal_zone_of_sensor_register(&pdev->dev, 0, priv, &of_ops); -+ thermal = thermal_zone_of_sensor_register(&pdev->dev, 0, priv, -+ priv->socdata->of_ops); - if (IS_ERR(thermal)) { - ret = PTR_ERR(thermal); - dev_err(&pdev->dev, "could not register sensor: %d\n", ret); -@@ -369,6 +415,9 @@ static int brcmstb_thermal_exit(struct p - if (thermal) - thermal_zone_of_sensor_unregister(&pdev->dev, priv->thermal); - -+ if (!IS_ERR(priv->clk)) -+ clk_disable_unprepare(priv->clk); -+ - return 0; - } - |