summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-03-17 11:59:58 -0400
committerTom Rini <trini@konsulko.com>2020-03-17 11:59:58 -0400
commit2738f0edea7d19960d692284d1f378b1a2b4c4a5 (patch)
tree47bc76ea90ab5395d30785b4aa83e43b15bc7a70 /drivers/misc
parentb180e32ea39d03021655a31a19d527529a2eb980 (diff)
parent445b45042c63c79546124489362ba4e64b61bfdc (diff)
Merge tag 'ti-v2020.07-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti into next
K3 J721E: * OSPI boot support * Support for loading remote cores in R5 SPL * PMIC ESM Support * Minor fixes for R5F and C7x remoteproc drivers K3 AM654: * Update AVS class 0 voltages. * Add I2C nodes DRA7xx/AM57xx: * Fixed Android boot on AM57xx AM33/AM43/Davinci: * switch to driver model for the net and mdio driver for baltos * Add DM/DTS support for omap video driver * Enable fastboot on am335x-evm
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/Kconfig12
-rw-r--r--drivers/misc/Makefile2
-rw-r--r--drivers/misc/esm_pmic.c69
-rw-r--r--drivers/misc/k3_avs.c12
-rw-r--r--drivers/misc/k3_esm.c87
5 files changed, 176 insertions, 6 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index f18aa8f7ba..766402745d 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -462,6 +462,11 @@ config IHS_FPGA
gdsys devices, which supply the majority of the functionality offered
by the devices. This driver supports both CON and CPU variants of the
devices, depending on the device tree entry.
+config ESM_K3
+ bool "Enable K3 ESM driver"
+ depends on ARCH_K3
+ help
+ Support ESM (Error Signaling Module) on TI K3 SoCs.
config MICROCHIP_FLEXCOM
bool "Enable Microchip Flexcom driver"
@@ -481,4 +486,11 @@ config K3_AVS0
optimized voltage from the efuse, so that it can be programmed
to the PMIC on board.
+config ESM_PMIC
+ bool "Enable PMIC ESM driver"
+ depends on DM_PMIC
+ help
+ Support ESM (Error Signal Monitor) on PMIC devices. ESM is used
+ typically to reboot the board in error condition.
+
endmenu
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 2b843de93c..68e0e7ad17 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -72,3 +72,5 @@ obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o
obj-$(CONFIG_JZ4780_EFUSE) += jz4780_efuse.o
obj-$(CONFIG_MICROCHIP_FLEXCOM) += microchip_flexcom.o
obj-$(CONFIG_K3_AVS0) += k3_avs.o
+obj-$(CONFIG_ESM_K3) += k3_esm.o
+obj-$(CONFIG_ESM_PMIC) += esm_pmic.o
diff --git a/drivers/misc/esm_pmic.c b/drivers/misc/esm_pmic.c
new file mode 100644
index 0000000000..92c8d68f7c
--- /dev/null
+++ b/drivers/misc/esm_pmic.c
@@ -0,0 +1,69 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * PMIC Error Signal Monitor driver
+ *
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ * Tero Kristo <t-kristo@ti.com>
+ *
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <power/pmic.h>
+#include <dm/device_compat.h>
+
+#define INT_ESM_REG 0x6c
+#define INT_ESM_MASK 0x3f
+
+#define ESM_MCU_START_REG 0x8f
+
+#define ESM_MCU_START BIT(0)
+
+#define ESM_MCU_MODE_CFG_REG 0x92
+
+#define ESM_MCU_EN BIT(6)
+#define ESM_MCU_ENDRV BIT(5)
+
+/**
+ * pmic_esm_probe: configures and enables PMIC ESM functionality
+ *
+ * Configures ESM PMIC support and enables it.
+ */
+static int pmic_esm_probe(struct udevice *dev)
+{
+ int ret;
+
+ ret = pmic_reg_write(dev->parent, INT_ESM_REG, INT_ESM_MASK);
+ if (ret) {
+ dev_err(dev, "clearing ESM irqs failed: %d\n", ret);
+ return ret;
+ }
+
+ ret = pmic_reg_write(dev->parent, ESM_MCU_MODE_CFG_REG,
+ ESM_MCU_EN | ESM_MCU_ENDRV);
+ if (ret) {
+ dev_err(dev, "setting ESM mode failed: %d\n", ret);
+ return ret;
+ }
+
+ ret = pmic_reg_write(dev->parent, ESM_MCU_START_REG, ESM_MCU_START);
+ if (ret) {
+ dev_err(dev, "starting ESM failed: %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+
+static const struct udevice_id pmic_esm_ids[] = {
+ { .compatible = "ti,tps659413-esm" },
+ {}
+};
+
+U_BOOT_DRIVER(pmic_esm) = {
+ .name = "esm_pmic",
+ .of_match = pmic_esm_ids,
+ .id = UCLASS_MISC,
+ .probe = pmic_esm_probe,
+};
diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c
index 90df377250..d8048e1b70 100644
--- a/drivers/misc/k3_avs.c
+++ b/drivers/misc/k3_avs.c
@@ -316,15 +316,15 @@ static struct vd_data am654_vd_data[] = {
.opp = AM6_OPP_NOM,
.opps = {
[AM6_OPP_NOM] = {
- .volt = 1000000,
+ .volt = 1100000,
.freq = 800000000,
},
[AM6_OPP_OD] = {
- .volt = 1100000,
+ .volt = 1200000,
.freq = 1000000000,
},
[AM6_OPP_TURBO] = {
- .volt = 1220000,
+ .volt = 1240000,
.freq = 1100000000,
},
},
@@ -336,15 +336,15 @@ static struct vd_data am654_vd_data[] = {
.clk_id = 0, /* ARM clock */
.opps = {
[AM6_OPP_NOM] = {
- .volt = 1000000,
+ .volt = 1100000,
.freq = 800000000,
},
[AM6_OPP_OD] = {
- .volt = 1100000,
+ .volt = 1200000,
.freq = 1000000000,
},
[AM6_OPP_TURBO] = {
- .volt = 1220000,
+ .volt = 1240000,
.freq = 1100000000,
},
},
diff --git a/drivers/misc/k3_esm.c b/drivers/misc/k3_esm.c
new file mode 100644
index 0000000000..8f270f3b5c
--- /dev/null
+++ b/drivers/misc/k3_esm.c
@@ -0,0 +1,87 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Texas Instruments' K3 Error Signalling Module driver
+ *
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ * Tero Kristo <t-kristo@ti.com>
+ *
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <asm/io.h>
+#include <dm/device_compat.h>
+
+#define ESM_SFT_RST 0x0c
+#define ESM_SFT_RST_KEY 0x0f
+
+#define ESM_STS(i) (0x404 + (i) / 32 * 0x20)
+#define ESM_PIN_EN_SET_OFFSET(i) (0x414 + (i) / 32 * 0x20)
+#define ESM_PIN_MASK(i) BIT((i) & 0x1f)
+
+static void esm_pin_enable(void __iomem *base, int pin)
+{
+ /* Enable event */
+ writel(ESM_PIN_MASK(pin), base + ESM_PIN_EN_SET_OFFSET(pin));
+}
+
+/**
+ * k3_esm_probe: configures ESM based on DT data
+ *
+ * Parses ESM info from device tree, and configures the module accordingly.
+ */
+static int k3_esm_probe(struct udevice *dev)
+{
+ int ret;
+ void __iomem *base;
+ int num_pins;
+ u32 *pins;
+ int i;
+
+ base = dev_remap_addr_index(dev, 0);
+ if (!base)
+ return -ENODEV;
+
+ num_pins = dev_read_size(dev, "ti,esm-pins");
+ if (num_pins < 0) {
+ dev_err(dev, "ti,esm-pins property missing or invalid: %d\n",
+ num_pins);
+ return num_pins;
+ }
+
+ num_pins /= sizeof(u32);
+
+ pins = kmalloc(num_pins * sizeof(u32), __GFP_ZERO);
+ if (!pins)
+ return -ENOMEM;
+
+ ret = dev_read_u32_array(dev, "ti,esm-pins", pins, num_pins);
+ if (ret < 0) {
+ dev_err(dev, "failed to read ti,esm-pins property: %d\n",
+ ret);
+ goto free_pins;
+ }
+
+ /* Clear any pending events */
+ writel(ESM_SFT_RST_KEY, base + ESM_SFT_RST);
+
+ for (i = 0; i < num_pins; i++)
+ esm_pin_enable(base, pins[i]);
+
+free_pins:
+ kfree(pins);
+ return ret;
+}
+
+static const struct udevice_id k3_esm_ids[] = {
+ { .compatible = "ti,j721e-esm" },
+ {}
+};
+
+U_BOOT_DRIVER(k3_esm) = {
+ .name = "k3_esm",
+ .of_match = k3_esm_ids,
+ .id = UCLASS_MISC,
+ .probe = k3_esm_probe,
+};