bcm27xx: update to latest patches from RPi foundation

Also removes random module and switches to new bcm2711 thermal driver.
Boot tested on RPi 4B v1.1 4G.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
master
Álvaro Fernández Rojas 2020-05-28 19:08:55 +02:00
parent 5d3a0c6b26
commit 77e97abf12
560 changed files with 373 additions and 220 deletions

View File

@ -50,6 +50,7 @@ CONFIG_ARM_TIMER_SP804=y
CONFIG_ARM_UNWIND=y
CONFIG_AUTO_ZRELADDR=y
CONFIG_BCM2708_VCMEM=y
# CONFIG_BCM2711_THERMAL is not set
CONFIG_BCM2835_DEVGPIOMEM=y
CONFIG_BCM2835_FAST_MEMCPY=y
CONFIG_BCM2835_MBOX=y
@ -73,7 +74,6 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_PM=y
CONFIG_BLK_SCSI_REQUEST=y
# CONFIG_BRCMSTB_THERMAL is not set
CONFIG_BRCM_CHAR_DRIVERS=y
# CONFIG_CACHE_L2X0 is not set
CONFIG_CC_HAS_KASAN_GENERIC=y
@ -247,6 +247,8 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_UID16=y
CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
CONFIG_HW_CONSOLE=y
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_BCM2835=y
CONFIG_HZ=100
CONFIG_HZ_100=y
CONFIG_HZ_FIXED=0

View File

@ -65,6 +65,7 @@ CONFIG_ARM_VIRT_EXT=y
CONFIG_ASSOCIATIVE_ARRAY=y
CONFIG_AUTO_ZRELADDR=y
CONFIG_BCM2708_VCMEM=y
CONFIG_BCM2711_THERMAL=y
CONFIG_BCM2835_DEVGPIOMEM=y
CONFIG_BCM2835_MBOX=y
CONFIG_BCM2835_POWER=y
@ -92,7 +93,6 @@ CONFIG_BLK_MQ_PCI=y
CONFIG_BLK_PM=y
CONFIG_BLK_SCSI_REQUEST=y
CONFIG_BOUNCE=y
CONFIG_BRCMSTB_THERMAL=y
CONFIG_BRCM_CHAR_DRIVERS=y
CONFIG_BROADCOM_PHY=y
# CONFIG_CACHE_L2X0 is not set
@ -314,6 +314,8 @@ CONFIG_HIGHMEM=y
CONFIG_HIGHPTE=y
CONFIG_HOTPLUG_CPU=y
CONFIG_HW_CONSOLE=y
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_BCM2835=y
CONFIG_HZ=100
CONFIG_HZ_100=y
CONFIG_HZ_FIXED=0

View File

@ -125,6 +125,7 @@ CONFIG_ARM_TIMER_SP804=y
CONFIG_ASSOCIATIVE_ARRAY=y
CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
CONFIG_BCM2708_VCMEM=y
# CONFIG_BCM2711_THERMAL is not set
CONFIG_BCM2835_DEVGPIOMEM=y
CONFIG_BCM2835_MBOX=y
CONFIG_BCM2835_POWER=y
@ -147,7 +148,6 @@ CONFIG_BLK_MQ_PCI=y
CONFIG_BLK_PM=y
CONFIG_BLK_SCSI_REQUEST=y
CONFIG_BOUNCE=y
CONFIG_BRCMSTB_THERMAL=y
CONFIG_BRCM_CHAR_DRIVERS=y
CONFIG_CAVIUM_ERRATUM_22375=y
CONFIG_CAVIUM_ERRATUM_23154=y
@ -371,6 +371,8 @@ CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
CONFIG_HOLES_IN_ZONE=y
CONFIG_HOTPLUG_CPU=y
CONFIG_HW_CONSOLE=y
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_BCM2835=y
CONFIG_HZ=250
CONFIG_HZ_250=y
CONFIG_I2C=y

View File

@ -125,6 +125,7 @@ CONFIG_ARM_TIMER_SP804=y
CONFIG_ASSOCIATIVE_ARRAY=y
CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
CONFIG_BCM2708_VCMEM=y
CONFIG_BCM2711_THERMAL=y
CONFIG_BCM2835_DEVGPIOMEM=y
CONFIG_BCM2835_MBOX=y
CONFIG_BCM2835_POWER=y
@ -150,7 +151,6 @@ CONFIG_BLK_MQ_PCI=y
CONFIG_BLK_PM=y
CONFIG_BLK_SCSI_REQUEST=y
CONFIG_BOUNCE=y
CONFIG_BRCMSTB_THERMAL=y
CONFIG_BRCM_CHAR_DRIVERS=y
CONFIG_BROADCOM_PHY=y
CONFIG_CAVIUM_ERRATUM_22375=y
@ -377,6 +377,8 @@ CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
CONFIG_HOLES_IN_ZONE=y
CONFIG_HOTPLUG_CPU=y
CONFIG_HW_CONSOLE=y
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_BCM2835=y
CONFIG_HZ=250
CONFIG_HZ_250=y
CONFIG_I2C=y

View File

@ -23,23 +23,6 @@ endef
$(eval $(call KernelPackage,pwm-bcm2835))
define KernelPackage/random-bcm2835
SUBMENU:=$(OTHER_MENU)
TITLE:=BCM2835 HW Random Number Generator
KCONFIG:= \
CONFIG_HW_RANDOM_BCM2835
FILES:=$(LINUX_DIR)/drivers/char/hw_random/bcm2835-rng.ko
AUTOLOAD:=$(call AutoLoad,11,bcm2835-rng)
DEPENDS:=@TARGET_bcm27xx +kmod-random-core
endef
define KernelPackage/random-bcm2835/description
This package contains the Broadcom 2835 HW random number generator driver
endef
$(eval $(call KernelPackage,random-bcm2835))
define KernelPackage/smi-bcm2835
SUBMENU:=$(OTHER_MENU)
TITLE:=BCM2835 SMI driver

View File

@ -1,152 +0,0 @@
From d1066d775e67c33cc93178475c4485c5ef0a83c9 Mon Sep 17 00:00:00 2001
From: Stefan Wahren <wahrenst@gmx.net>
Date: Sat, 18 May 2019 12:26:11 +0200
Subject: [PATCH] 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 | 61 +++++++++++++++++++---
2 files changed, 54 insertions(+), 9 deletions(-)
--- a/drivers/thermal/broadcom/Kconfig
+++ b/drivers/thermal/broadcom/Kconfig
@@ -9,7 +9,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
@@ -10,6 +10,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>
@@ -22,9 +23,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)
@@ -102,10 +100,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;
};
/* Convert a HW code to a temperature reading (millidegree celsius) */
@@ -142,17 +149,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)
@@ -277,13 +285,34 @@ static int brcmstb_set_trips(void *data,
return 0;
}
-static const 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);
@@ -304,11 +333,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 = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv,
- &of_ops);
+ priv->socdata->of_ops);
if (IS_ERR(thermal)) {
ret = PTR_ERR(thermal);
dev_err(&pdev->dev, "could not register sensor: %d\n", ret);

Some files were not shown because too many files have changed in this diff Show More