All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] ESM support for TI K3 SoCs
@ 2020-02-13  9:33 Tero Kristo
  2020-02-13  9:33 ` [PATCH 1/7] power: pmic: tps65941: Add support for probing the child devices Tero Kristo
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Tero Kristo @ 2020-02-13  9:33 UTC (permalink / raw)
  To: u-boot

Hi,

This series introduces ESM (Error Signaling Module) drivers for TI
K3 generation of SoCs. These are used to handle SoC internal HW
error events from various sources, and they can either trigger
an error interrupt for SW to handle, or trigger a HW event which
can be routed to e.g. PMIC to trigger full device reset.

In this series, the watchdog expire events are routed to an
error event pin, which is handled by PMIC resetting the J721e board.
AM65x boards are not handled, as they currently don't support HW
routing of the signals.

-Tero


--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/7] power: pmic: tps65941: Add support for probing the child devices
  2020-02-13  9:33 [PATCH 0/7] ESM support for TI K3 SoCs Tero Kristo
@ 2020-02-13  9:33 ` Tero Kristo
  2020-02-13  9:33 ` [PATCH 2/7] misc: k3_esm: Add support for Texas Instruments K3 ESM driver Tero Kristo
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Tero Kristo @ 2020-02-13  9:33 UTC (permalink / raw)
  To: u-boot

TPS65941 can have child devices under it (like the ESM support), so
probe these once the master pmic node completes probe.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/power/pmic/tps65941.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/pmic/tps65941.c b/drivers/power/pmic/tps65941.c
index e8f3c950bd..7b3416ae6e 100644
--- a/drivers/power/pmic/tps65941.c
+++ b/drivers/power/pmic/tps65941.c
@@ -59,8 +59,8 @@ static int tps65941_bind(struct udevice *dev)
 	if (!children)
 		printf("%s: %s - no child found\n", __func__, dev->name);
 
-	/* Always return success for this device */
-	return 0;
+	/* Probe all the child devices */
+	return dm_scan_fdt_dev(dev);
 }
 
 static struct dm_pmic_ops tps65941_ops = {
-- 
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/7] misc: k3_esm: Add support for Texas Instruments K3 ESM driver
  2020-02-13  9:33 [PATCH 0/7] ESM support for TI K3 SoCs Tero Kristo
  2020-02-13  9:33 ` [PATCH 1/7] power: pmic: tps65941: Add support for probing the child devices Tero Kristo
@ 2020-02-13  9:33 ` Tero Kristo
  2020-02-13  9:33 ` [PATCH 3/7] misc: pmic_esm: Add support for PMIC " Tero Kristo
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Tero Kristo @ 2020-02-13  9:33 UTC (permalink / raw)
  To: u-boot

The ESM (Error Signaling Module) is used to route error signals within
the K3 SoCs somewhat similar to interrupts. The handling for these is
different though, and can be routed for hardware error handling, to
be handled by safety processor or just as error interrupts handled
by the main processor. The u-boot level ESM driver is just used to
configure the ESM signals so that they get routed to proper destination.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 doc/device-tree-bindings/misc/esm-k3.txt | 25 +++++++
 drivers/misc/Kconfig                     |  5 ++
 drivers/misc/Makefile                    |  1 +
 drivers/misc/k3_esm.c                    | 87 ++++++++++++++++++++++++
 4 files changed, 118 insertions(+)
 create mode 100644 doc/device-tree-bindings/misc/esm-k3.txt
 create mode 100644 drivers/misc/k3_esm.c

diff --git a/doc/device-tree-bindings/misc/esm-k3.txt b/doc/device-tree-bindings/misc/esm-k3.txt
new file mode 100644
index 0000000000..01c8b6b294
--- /dev/null
+++ b/doc/device-tree-bindings/misc/esm-k3.txt
@@ -0,0 +1,25 @@
+Texas Instruments K3 ESM Binding
+======================
+
+ESM (Error Signaling Module) is an IP block on TI K3 devices that allows
+handling of safety events somewhat similar to what interrupt controller
+would do. The safety signals have their separate paths within the SoC,
+and they are handled by the ESM, which routes them to the proper
+destination, which can be system reset, interrupt controller, etc. In
+the simplest configuration the signals are just routed to reset the
+SoC.
+
+Required properties :
+- compatible	: "ti,j721e-esm"
+- ti,esm-pins	: integer array of esm events IDs to route to external event
+		  pin which can be used to reset the SoC. The array can
+		  have arbitrary amount of event IDs listed on it.
+
+Example
+=======
+
+	main_esm: esm at 700000 {
+		compatible = "ti,j721e-esm";
+		reg = <0x0 0x700000 0x0 0x1000>;
+		ti,esm-pins = <344>, <345>;
+	};
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index f18aa8f7ba..38588b2cbd 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"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 2b843de93c..60406c3e0a 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -72,3 +72,4 @@ 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
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,
+};
-- 
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/7] misc: pmic_esm: Add support for PMIC ESM driver
  2020-02-13  9:33 [PATCH 0/7] ESM support for TI K3 SoCs Tero Kristo
  2020-02-13  9:33 ` [PATCH 1/7] power: pmic: tps65941: Add support for probing the child devices Tero Kristo
  2020-02-13  9:33 ` [PATCH 2/7] misc: k3_esm: Add support for Texas Instruments K3 ESM driver Tero Kristo
@ 2020-02-13  9:33 ` Tero Kristo
  2020-02-13  9:34 ` [PATCH 4/7] arm: dts: k3-k721e: Add Main domain ESM support Tero Kristo
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Tero Kristo @ 2020-02-13  9:33 UTC (permalink / raw)
  To: u-boot

The ESM (Error Signal Monitor) is used on certain PMIC versions to
handle error signals propagating from rest of the system. If these
reach the PMIC, it is typically a last resort fatal error which
requires a system reset. The ESM driver does the proper configuration
for the ESM module to reach this end goal. Initially, only TPS65941
PMIC is supported for this.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 doc/device-tree-bindings/misc/esm-pmic.txt | 19 ++++++
 drivers/misc/Kconfig                       |  7 +++
 drivers/misc/Makefile                      |  1 +
 drivers/misc/esm_pmic.c                    | 69 ++++++++++++++++++++++
 4 files changed, 96 insertions(+)
 create mode 100644 doc/device-tree-bindings/misc/esm-pmic.txt
 create mode 100644 drivers/misc/esm_pmic.c

diff --git a/doc/device-tree-bindings/misc/esm-pmic.txt b/doc/device-tree-bindings/misc/esm-pmic.txt
new file mode 100644
index 0000000000..a60ad74679
--- /dev/null
+++ b/doc/device-tree-bindings/misc/esm-pmic.txt
@@ -0,0 +1,19 @@
+PMIC ESM Binding
+======================
+
+Certain Power Management ICs contain safety handling logic within them,
+allowing automatic reset of the board in case a safety error is signaled.
+For this purpose, ESM (Error Signal Monitor) is implemented within
+the PMIC running its own state machine.
+
+Required properties :
+- compatible	: "ti,tps659413-esm"
+
+Example
+=======
+
+&tps659413a {
+	esm: esm {
+		compatible = "ti,tps659413-esm";
+	};
+};
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 38588b2cbd..766402745d 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -486,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 60406c3e0a..68e0e7ad17 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -73,3 +73,4 @@ 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,
+};
-- 
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/7] arm: dts: k3-k721e: Add Main domain ESM support
  2020-02-13  9:33 [PATCH 0/7] ESM support for TI K3 SoCs Tero Kristo
                   ` (2 preceding siblings ...)
  2020-02-13  9:33 ` [PATCH 3/7] misc: pmic_esm: Add support for PMIC " Tero Kristo
@ 2020-02-13  9:34 ` Tero Kristo
  2020-02-13 10:49   ` Lokesh Vutla
  2020-02-13  9:34 ` [PATCH 5/7] arm: dts: k3-j721e: Add ESM PMIC support for tps659413 based board Tero Kristo
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Tero Kristo @ 2020-02-13  9:34 UTC (permalink / raw)
  To: u-boot

Main domain ESM support is needed to configure main domain watchdogs
to generate ESM pin events by default. On J7 processor board these
propagate to the PMIC to generate a reset when watchdog expires.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi | 4 ++++
 arch/arm/dts/k3-j721e-main.dtsi                     | 6 ++++++
 arch/arm/dts/k3-j721e.dtsi                          | 1 +
 3 files changed, 11 insertions(+)

diff --git a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi
index a3a8193216..158598f5a7 100644
--- a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi
@@ -349,3 +349,7 @@
 &exp2 {
 	u-boot,dm-spl;
 };
+
+&main_esm {
+	u-boot,dm-spl;
+};
diff --git a/arch/arm/dts/k3-j721e-main.dtsi b/arch/arm/dts/k3-j721e-main.dtsi
index 45ac98c47e..ef4282f608 100644
--- a/arch/arm/dts/k3-j721e-main.dtsi
+++ b/arch/arm/dts/k3-j721e-main.dtsi
@@ -532,4 +532,10 @@
 		clocks = <&k3_clks 193 0>;
 		power-domains = <&k3_pds 193 TI_SCI_PD_EXCLUSIVE>;
 	};
+
+	main_esm: esm at 700000 {
+		compatible = "ti,j721e-esm";
+		reg = <0x0 0x700000 0x0 0x1000>;
+		ti,esm-pins = <344>, <345>;
+	};
 };
diff --git a/arch/arm/dts/k3-j721e.dtsi b/arch/arm/dts/k3-j721e.dtsi
index 68ba517e50..e470d3a1b5 100644
--- a/arch/arm/dts/k3-j721e.dtsi
+++ b/arch/arm/dts/k3-j721e.dtsi
@@ -135,6 +135,7 @@
 		#size-cells = <2>;
 		ranges = <0x00 0x00100000 0x00 0x00100000 0x00 0x00020000>, /* ctrl mmr */
 			 <0x00 0x00600000 0x00 0x00600000 0x00 0x00031100>, /* GPIO */
+			 <0x00 0x00700000 0x00 0x00700000 0x00 0x00001000>, /* ESM */
 			 <0x00 0x00900000 0x00 0x00900000 0x00 0x00012000>, /* serdes */
 			 <0x00 0x00A40000 0x00 0x00A40000 0x00 0x00000800>, /* timesync router */
 			 <0x00 0x01000000 0x00 0x01000000 0x00 0x0af02400>, /* Most peripherals */
-- 
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/7] arm: dts: k3-j721e: Add ESM PMIC support for tps659413 based board
  2020-02-13  9:33 [PATCH 0/7] ESM support for TI K3 SoCs Tero Kristo
                   ` (3 preceding siblings ...)
  2020-02-13  9:34 ` [PATCH 4/7] arm: dts: k3-k721e: Add Main domain ESM support Tero Kristo
@ 2020-02-13  9:34 ` Tero Kristo
  2020-02-13  9:34 ` [PATCH 6/7] arm: mach-k3: j721e_init: initialize ESM support Tero Kristo
  2020-02-13  9:34 ` [PATCH 7/7] configs: j721e_evm_r5_defconfig: Enable ESM modules Tero Kristo
  6 siblings, 0 replies; 12+ messages in thread
From: Tero Kristo @ 2020-02-13  9:34 UTC (permalink / raw)
  To: u-boot

The ESM handling on J7 processor board requires routing the
MCU_SAFETY_ERROR signal to the PMIC on the board for critical safety
error handling. The PMIC itself should then reset the board based on
receiving it. Enable the support for the board by adding the esm
node in place.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 .../arm/dts/k3-j721e-r5-common-proc-board-u-boot.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 arch/arm/dts/k3-j721e-r5-common-proc-board-u-boot.dtsi

diff --git a/arch/arm/dts/k3-j721e-r5-common-proc-board-u-boot.dtsi b/arch/arm/dts/k3-j721e-r5-common-proc-board-u-boot.dtsi
new file mode 100644
index 0000000000..c6c60b44ec
--- /dev/null
+++ b/arch/arm/dts/k3-j721e-r5-common-proc-board-u-boot.dtsi
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
+ */
+
+&tps659413a {
+	esm: esm {
+		compatible = "ti,tps659413-esm";
+		u-boot,dm-spl;
+	};
+};
-- 
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/7] arm: mach-k3: j721e_init: initialize ESM support
  2020-02-13  9:33 [PATCH 0/7] ESM support for TI K3 SoCs Tero Kristo
                   ` (4 preceding siblings ...)
  2020-02-13  9:34 ` [PATCH 5/7] arm: dts: k3-j721e: Add ESM PMIC support for tps659413 based board Tero Kristo
@ 2020-02-13  9:34 ` Tero Kristo
  2020-02-13 10:47   ` Lokesh Vutla
  2020-02-13  9:34 ` [PATCH 7/7] configs: j721e_evm_r5_defconfig: Enable ESM modules Tero Kristo
  6 siblings, 1 reply; 12+ messages in thread
From: Tero Kristo @ 2020-02-13  9:34 UTC (permalink / raw)
  To: u-boot

Initialize both ESM and ESM_PMIC support if available for the board.
If support is not available for either, a warning is printed out.

ESM signals are only properly routed on PM2 version of the J721E SOM,
so only probe the drivers on this device.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 arch/arm/mach-k3/j721e_init.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index f7f7398081..2de9583937 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -18,6 +18,7 @@
 #include <dm.h>
 #include <dm/uclass-internal.h>
 #include <dm/pinctrl.h>
+#include "../../../board/ti/common/board_detect.h"
 
 #ifdef CONFIG_SPL_BUILD
 #ifdef CONFIG_K3_LOAD_SYSFW
@@ -114,7 +115,8 @@ static void store_boot_index_from_rom(void)
 
 void board_init_f(ulong dummy)
 {
-#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW)
+#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW) || \
+	defined(CONFIG__ESM_K3) || defined(CONFIG_ESM_PMIC)
 	struct udevice *dev;
 	int ret;
 #endif
@@ -181,6 +183,25 @@ void board_init_f(ulong dummy)
 		printf("AVS init failed: %d\n", ret);
 #endif
 
+#ifdef CONFIG_ESM_K3
+	if (board_ti_k3_is("J721EX-PM2-SOM")) {
+		ret = uclass_get_device_by_driver(UCLASS_MISC,
+						  DM_GET_DRIVER(k3_esm), &dev);
+		if (ret)
+			printf("MISC init failed: %d\n", ret);
+	}
+#endif
+
+#ifdef CONFIG_ESM_PMIC
+	if (board_ti_k3_is("J721EX-PM2-SOM")) {
+		ret = uclass_get_device_by_driver(UCLASS_MISC,
+						  DM_GET_DRIVER(pmic_esm),
+						  &dev);
+		if (ret)
+			printf("ESM PMIC init failed: %d\n", ret);
+	}
+#endif
+
 #if defined(CONFIG_K3_J721E_DDRSS)
 	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
 	if (ret)
-- 
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 7/7] configs: j721e_evm_r5_defconfig: Enable ESM modules
  2020-02-13  9:33 [PATCH 0/7] ESM support for TI K3 SoCs Tero Kristo
                   ` (5 preceding siblings ...)
  2020-02-13  9:34 ` [PATCH 6/7] arm: mach-k3: j721e_init: initialize ESM support Tero Kristo
@ 2020-02-13  9:34 ` Tero Kristo
  6 siblings, 0 replies; 12+ messages in thread
From: Tero Kristo @ 2020-02-13  9:34 UTC (permalink / raw)
  To: u-boot

Enable ESM modules for both PMIC and SoC side for proper watchdog
handling on the board.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 configs/j721e_evm_r5_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig
index 19fbd450c7..12264ae61d 100644
--- a/configs/j721e_evm_r5_defconfig
+++ b/configs/j721e_evm_r5_defconfig
@@ -122,3 +122,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x6163
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_FS_EXT4=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
+CONFIG_ESM_K3=y
+CONFIG_ESM_PMIC=y
-- 
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/7] arm: mach-k3: j721e_init: initialize ESM support
  2020-02-13  9:34 ` [PATCH 6/7] arm: mach-k3: j721e_init: initialize ESM support Tero Kristo
@ 2020-02-13 10:47   ` Lokesh Vutla
  2020-02-13 12:02     ` Tero Kristo
  0 siblings, 1 reply; 12+ messages in thread
From: Lokesh Vutla @ 2020-02-13 10:47 UTC (permalink / raw)
  To: u-boot



On 13/02/20 3:04 PM, Tero Kristo wrote:
> Initialize both ESM and ESM_PMIC support if available for the board.
> If support is not available for either, a warning is printed out.
> 
> ESM signals are only properly routed on PM2 version of the J721E SOM,
> so only probe the drivers on this device.
> 
> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> ---
>  arch/arm/mach-k3/j721e_init.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
> index f7f7398081..2de9583937 100644
> --- a/arch/arm/mach-k3/j721e_init.c
> +++ b/arch/arm/mach-k3/j721e_init.c
> @@ -18,6 +18,7 @@
>  #include <dm.h>
>  #include <dm/uclass-internal.h>
>  #include <dm/pinctrl.h>
> +#include "../../../board/ti/common/board_detect.h"
>  
>  #ifdef CONFIG_SPL_BUILD
>  #ifdef CONFIG_K3_LOAD_SYSFW
> @@ -114,7 +115,8 @@ static void store_boot_index_from_rom(void)
>  
>  void board_init_f(ulong dummy)
>  {
> -#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW)
> +#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW) || \
> +	defined(CONFIG__ESM_K3) || defined(CONFIG_ESM_PMIC)
>  	struct udevice *dev;
>  	int ret;
>  #endif
> @@ -181,6 +183,25 @@ void board_init_f(ulong dummy)
>  		printf("AVS init failed: %d\n", ret);
>  #endif
>  
> +#ifdef CONFIG_ESM_K3
> +	if (board_ti_k3_is("J721EX-PM2-SOM")) {
> +		ret = uclass_get_device_by_driver(UCLASS_MISC,
> +						  DM_GET_DRIVER(k3_esm), &dev);
> +		if (ret)
> +			printf("MISC init failed: %d\n", ret);
> +	}
> +#endif
> +
> +#ifdef CONFIG_ESM_PMIC
> +	if (board_ti_k3_is("J721EX-PM2-SOM")) {
> +		ret = uclass_get_device_by_driver(UCLASS_MISC,
> +						  DM_GET_DRIVER(pmic_esm),
> +						  &dev);
> +		if (ret)
> +			printf("ESM PMIC init failed: %d\n", ret);
> +	}
> +#endif

Since this is board specific, can you call this under spl_board_init() and add
it in board/ti/j721e ?

Thanks and regards,
Lokesh

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 4/7] arm: dts: k3-k721e: Add Main domain ESM support
  2020-02-13  9:34 ` [PATCH 4/7] arm: dts: k3-k721e: Add Main domain ESM support Tero Kristo
@ 2020-02-13 10:49   ` Lokesh Vutla
  2020-02-13 12:01     ` Tero Kristo
  0 siblings, 1 reply; 12+ messages in thread
From: Lokesh Vutla @ 2020-02-13 10:49 UTC (permalink / raw)
  To: u-boot



On 13/02/20 3:04 PM, Tero Kristo wrote:
> Main domain ESM support is needed to configure main domain watchdogs
> to generate ESM pin events by default. On J7 processor board these
> propagate to the PMIC to generate a reset when watchdog expires.
> 
> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> ---
>  arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi | 4 ++++
>  arch/arm/dts/k3-j721e-main.dtsi                     | 6 ++++++
>  arch/arm/dts/k3-j721e.dtsi                          | 1 +
>  3 files changed, 11 insertions(+)
> 
> diff --git a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi
> index a3a8193216..158598f5a7 100644
> --- a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi
> +++ b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi
> @@ -349,3 +349,7 @@
>  &exp2 {
>  	u-boot,dm-spl;
>  };
> +
> +&main_esm {
> +	u-boot,dm-spl;
> +};
> diff --git a/arch/arm/dts/k3-j721e-main.dtsi b/arch/arm/dts/k3-j721e-main.dtsi
> index 45ac98c47e..ef4282f608 100644
> --- a/arch/arm/dts/k3-j721e-main.dtsi
> +++ b/arch/arm/dts/k3-j721e-main.dtsi
> @@ -532,4 +532,10 @@
>  		clocks = <&k3_clks 193 0>;
>  		power-domains = <&k3_pds 193 TI_SCI_PD_EXCLUSIVE>;
>  	};
> +
> +	main_esm: esm at 700000 {
> +		compatible = "ti,j721e-esm";
> +		reg = <0x0 0x700000 0x0 0x1000>;
> +		ti,esm-pins = <344>, <345>;
> +	};

This might never be defined in kernel dts. So it will be a problem when syncing
kernel dts. Can you move this to r5 dts?

Thanks and regards,
Lokesh

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 4/7] arm: dts: k3-k721e: Add Main domain ESM support
  2020-02-13 10:49   ` Lokesh Vutla
@ 2020-02-13 12:01     ` Tero Kristo
  0 siblings, 0 replies; 12+ messages in thread
From: Tero Kristo @ 2020-02-13 12:01 UTC (permalink / raw)
  To: u-boot

On 13/02/2020 12:49, Lokesh Vutla wrote:
> 
> 
> On 13/02/20 3:04 PM, Tero Kristo wrote:
>> Main domain ESM support is needed to configure main domain watchdogs
>> to generate ESM pin events by default. On J7 processor board these
>> propagate to the PMIC to generate a reset when watchdog expires.
>>
>> Signed-off-by: Tero Kristo <t-kristo@ti.com>
>> ---
>>   arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi | 4 ++++
>>   arch/arm/dts/k3-j721e-main.dtsi                     | 6 ++++++
>>   arch/arm/dts/k3-j721e.dtsi                          | 1 +
>>   3 files changed, 11 insertions(+)
>>
>> diff --git a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi
>> index a3a8193216..158598f5a7 100644
>> --- a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi
>> +++ b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi
>> @@ -349,3 +349,7 @@
>>   &exp2 {
>>   	u-boot,dm-spl;
>>   };
>> +
>> +&main_esm {
>> +	u-boot,dm-spl;
>> +};
>> diff --git a/arch/arm/dts/k3-j721e-main.dtsi b/arch/arm/dts/k3-j721e-main.dtsi
>> index 45ac98c47e..ef4282f608 100644
>> --- a/arch/arm/dts/k3-j721e-main.dtsi
>> +++ b/arch/arm/dts/k3-j721e-main.dtsi
>> @@ -532,4 +532,10 @@
>>   		clocks = <&k3_clks 193 0>;
>>   		power-domains = <&k3_pds 193 TI_SCI_PD_EXCLUSIVE>;
>>   	};
>> +
>> +	main_esm: esm at 700000 {
>> +		compatible = "ti,j721e-esm";
>> +		reg = <0x0 0x700000 0x0 0x1000>;
>> +		ti,esm-pins = <344>, <345>;
>> +	};
> 
> This might never be defined in kernel dts. So it will be a problem when syncing
> kernel dts. Can you move this to r5 dts?

Yeah, I can't see this ever going to be defined in kernel dts.

I can move it to r5 file.

-Tero
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 6/7] arm: mach-k3: j721e_init: initialize ESM support
  2020-02-13 10:47   ` Lokesh Vutla
@ 2020-02-13 12:02     ` Tero Kristo
  0 siblings, 0 replies; 12+ messages in thread
From: Tero Kristo @ 2020-02-13 12:02 UTC (permalink / raw)
  To: u-boot

On 13/02/2020 12:47, Lokesh Vutla wrote:
> 
> 
> On 13/02/20 3:04 PM, Tero Kristo wrote:
>> Initialize both ESM and ESM_PMIC support if available for the board.
>> If support is not available for either, a warning is printed out.
>>
>> ESM signals are only properly routed on PM2 version of the J721E SOM,
>> so only probe the drivers on this device.
>>
>> Signed-off-by: Tero Kristo <t-kristo@ti.com>
>> ---
>>   arch/arm/mach-k3/j721e_init.c | 23 ++++++++++++++++++++++-
>>   1 file changed, 22 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
>> index f7f7398081..2de9583937 100644
>> --- a/arch/arm/mach-k3/j721e_init.c
>> +++ b/arch/arm/mach-k3/j721e_init.c
>> @@ -18,6 +18,7 @@
>>   #include <dm.h>
>>   #include <dm/uclass-internal.h>
>>   #include <dm/pinctrl.h>
>> +#include "../../../board/ti/common/board_detect.h"
>>   
>>   #ifdef CONFIG_SPL_BUILD
>>   #ifdef CONFIG_K3_LOAD_SYSFW
>> @@ -114,7 +115,8 @@ static void store_boot_index_from_rom(void)
>>   
>>   void board_init_f(ulong dummy)
>>   {
>> -#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW)
>> +#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW) || \
>> +	defined(CONFIG__ESM_K3) || defined(CONFIG_ESM_PMIC)
>>   	struct udevice *dev;
>>   	int ret;
>>   #endif
>> @@ -181,6 +183,25 @@ void board_init_f(ulong dummy)
>>   		printf("AVS init failed: %d\n", ret);
>>   #endif
>>   
>> +#ifdef CONFIG_ESM_K3
>> +	if (board_ti_k3_is("J721EX-PM2-SOM")) {
>> +		ret = uclass_get_device_by_driver(UCLASS_MISC,
>> +						  DM_GET_DRIVER(k3_esm), &dev);
>> +		if (ret)
>> +			printf("MISC init failed: %d\n", ret);
>> +	}
>> +#endif
>> +
>> +#ifdef CONFIG_ESM_PMIC
>> +	if (board_ti_k3_is("J721EX-PM2-SOM")) {
>> +		ret = uclass_get_device_by_driver(UCLASS_MISC,
>> +						  DM_GET_DRIVER(pmic_esm),
>> +						  &dev);
>> +		if (ret)
>> +			printf("ESM PMIC init failed: %d\n", ret);
>> +	}
>> +#endif
> 
> Since this is board specific, can you call this under spl_board_init() and add
> it in board/ti/j721e ?

Right, let me try that out.

-Tero
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-02-13 12:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13  9:33 [PATCH 0/7] ESM support for TI K3 SoCs Tero Kristo
2020-02-13  9:33 ` [PATCH 1/7] power: pmic: tps65941: Add support for probing the child devices Tero Kristo
2020-02-13  9:33 ` [PATCH 2/7] misc: k3_esm: Add support for Texas Instruments K3 ESM driver Tero Kristo
2020-02-13  9:33 ` [PATCH 3/7] misc: pmic_esm: Add support for PMIC " Tero Kristo
2020-02-13  9:34 ` [PATCH 4/7] arm: dts: k3-k721e: Add Main domain ESM support Tero Kristo
2020-02-13 10:49   ` Lokesh Vutla
2020-02-13 12:01     ` Tero Kristo
2020-02-13  9:34 ` [PATCH 5/7] arm: dts: k3-j721e: Add ESM PMIC support for tps659413 based board Tero Kristo
2020-02-13  9:34 ` [PATCH 6/7] arm: mach-k3: j721e_init: initialize ESM support Tero Kristo
2020-02-13 10:47   ` Lokesh Vutla
2020-02-13 12:02     ` Tero Kristo
2020-02-13  9:34 ` [PATCH 7/7] configs: j721e_evm_r5_defconfig: Enable ESM modules Tero Kristo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.