aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini2022-10-11 17:35:42 -0400
committerTom Rini2022-10-11 17:35:42 -0400
commit8db1fa5a0da78c1a9a16882f2e49beac3ccf5308 (patch)
tree917986046cbdb4c39576bb1d733a33523fe44ca8 /drivers
parent300077cf8cfe6875f3f0a919ec1d0dd32c42b178 (diff)
parentc68e73b65fb9101e3234586db29c3a04e9b37534 (diff)
Merge branch '2022-10-11-assorted-fixes-and-updates'
- Assorted code cleanups and fixes, along with two new commands.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/bootcount/Kconfig2
-rw-r--r--drivers/bootcount/pmic_pfuze100.c2
-rw-r--r--drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c8
-rw-r--r--drivers/pinctrl/pinctrl-generic.c2
-rw-r--r--drivers/thermal/Makefile1
-rw-r--r--drivers/thermal/thermal_sandbox.c36
6 files changed, 44 insertions, 7 deletions
diff --git a/drivers/bootcount/Kconfig b/drivers/bootcount/Kconfig
index e918f746946..8d6424c9da1 100644
--- a/drivers/bootcount/Kconfig
+++ b/drivers/bootcount/Kconfig
@@ -132,7 +132,7 @@ config DM_BOOTCOUNT_PMIC_PFUZE100
depends on DM_PMIC_PFUZE100
help
Enable support for the bootcounter using PMIC PFUZE100 registers.
- This works only, if the PMIC is not connected.
+ This works only, if the PMIC is not connected to a battery.
config DM_BOOTCOUNT_SPI_FLASH
bool "Support SPI flash devices as a backing store for bootcount"
diff --git a/drivers/bootcount/pmic_pfuze100.c b/drivers/bootcount/pmic_pfuze100.c
index ad3bc03829d..df046f1b0ab 100644
--- a/drivers/bootcount/pmic_pfuze100.c
+++ b/drivers/bootcount/pmic_pfuze100.c
@@ -5,7 +5,7 @@
* Philip Oberfichtner <pro@denx.de>
*
* A bootcount driver using the registers MEMA - MEMD on the PFUZE100.
- * This works only, if the PMIC is not connected.
+ * This works only, if the PMIC is not connected to a battery.
*/
#include <common.h>
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
index f6e20415e2e..31678f55379 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
@@ -1388,10 +1388,10 @@ static int npcm7xx_gpio_reset_persist(struct udevice *dev, unsigned int banknum,
dev_dbg(dev, "set gpio persist, bank %d, enable %d\n", banknum, enable);
if (enable) {
- regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD0RCR, BIT(num) | CA9C_RESET, 0);
- regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD1RCR, BIT(num) | CA9C_RESET, 0);
- regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD2RCR, BIT(num) | CA9C_RESET, 0);
- regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_CORSTC, BIT(num) | CA9C_RESET, 0);
+ regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD0RCR, BIT(num), 0);
+ regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD1RCR, BIT(num), 0);
+ regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD2RCR, BIT(num), 0);
+ regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_CORSTC, BIT(num), 0);
} else {
regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD0RCR, BIT(num) | CA9C_RESET, BIT(num) | CA9C_RESET);
regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD1RCR, BIT(num) | CA9C_RESET, BIT(num) | CA9C_RESET);
diff --git a/drivers/pinctrl/pinctrl-generic.c b/drivers/pinctrl/pinctrl-generic.c
index ec21d4ff838..8909b57810a 100644
--- a/drivers/pinctrl/pinctrl-generic.c
+++ b/drivers/pinctrl/pinctrl-generic.c
@@ -237,7 +237,7 @@ enum pinmux_subnode_type {
static const char *alloc_name_with_prefix(const char *name, const char *prefix)
{
if (prefix) {
- char *name_with_prefix = malloc(strlen(prefix) + sizeof("pins"));
+ char *name_with_prefix = malloc(strlen(prefix) + strlen(name) + 1);
if (name_with_prefix)
sprintf(name_with_prefix, "%s%s", prefix, name);
return name_with_prefix;
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 15fe847d9f7..8acc7d20cb9 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -4,6 +4,7 @@
# Author: Nitin Garg <nitin.garg@freescale.com>
obj-$(CONFIG_DM_THERMAL) += thermal-uclass.o
+obj-$(CONFIG_SANDBOX) += thermal_sandbox.o
obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o
obj-$(CONFIG_IMX_SCU_THERMAL) += imx_scu_thermal.o
obj-$(CONFIG_TI_DRA7_THERMAL) += ti-bandgap.o
diff --git a/drivers/thermal/thermal_sandbox.c b/drivers/thermal/thermal_sandbox.c
new file mode 100644
index 00000000000..acc364feb03
--- /dev/null
+++ b/drivers/thermal/thermal_sandbox.c
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2022 Sartura Ltd.
+ * Written by Robert Marko <robert.marko@sartura.hr>
+ *
+ * Sandbox driver for the thermal uclass.
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <thermal.h>
+
+int sandbox_thermal_get_temp(struct udevice *dev, int *temp)
+{
+ /* Simply return 100°C */
+ *temp = 100;
+
+ return 0;
+}
+
+static const struct dm_thermal_ops sandbox_thermal_ops = {
+ .get_temp = sandbox_thermal_get_temp,
+};
+
+static const struct udevice_id sandbox_thermal_ids[] = {
+ { .compatible = "sandbox,thermal" },
+ { }
+};
+
+U_BOOT_DRIVER(thermal_sandbox) = {
+ .name = "thermal-sandbox",
+ .id = UCLASS_THERMAL,
+ .of_match = sandbox_thermal_ids,
+ .ops = &sandbox_thermal_ops,
+ .flags = DM_FLAG_PRE_RELOC,
+};