linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] Add TI-SCI reboot driver
@ 2024-01-31 22:19 Andrew Davis
  2024-01-31 22:19 ` [PATCH 01/12] dt-bindings: power: reset: Document ti,sci-reboot compatible Andrew Davis
                   ` (12 more replies)
  0 siblings, 13 replies; 20+ messages in thread
From: Andrew Davis @ 2024-01-31 22:19 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm, Andrew Davis

Hello all,

While PCSI normally handles reboot for K3, this is an available
fallback in case PCSI reboot fails. This driver is registered 
with low priority as we want PSCI to remain the main way these
devices are rebooted.

The important part is the binding/DT changes. Currently in
U-Boot (which use the Linux device trees) we may not have
PSCI available yet (pre TF-A) and so we need this node
to correctly reboot. Adding this node in U-Boot is one of
the last remaining deltas between the two project DT files. 

Thanks,
Andrew

Andrew Davis (12):
  dt-bindings: power: reset: Document ti,sci-reboot compatible
  dt-bindings: arm: keystone: ti-sci: Add reboot-controller child node
  power: reset: Add TI-SCI reboot driver
  arm64: dts: ti: k3-am64: Add reboot-controller node
  arm64: dts: ti: k3-am62: Add reboot-controller node
  arm64: dts: ti: k3-am62a: Add reboot-controller node
  arm64: dts: ti: k3-am62p: Add reboot-controller node
  arm64: dts: ti: k3-am65: Add reboot-controller node
  arm64: dts: ti: k3-j7200: Add reboot-controller node
  arm64: dts: ti: k3-j721e: Add reboot-controller node
  arm64: dts: ti: k3-j721s2: Add reboot-controller node
  arm64: dts: ti: k3-j784s4: Add reboot-controller node

 .../bindings/arm/keystone/ti,sci.yaml         |  8 +++
 .../bindings/power/reset/ti,sci-reboot.yaml   | 33 ++++++++++
 MAINTAINERS                                   |  2 +
 arch/arm64/boot/dts/ti/k3-am62-main.dtsi      |  5 ++
 arch/arm64/boot/dts/ti/k3-am62a-main.dtsi     |  4 ++
 arch/arm64/boot/dts/ti/k3-am62p-main.dtsi     |  5 ++
 arch/arm64/boot/dts/ti/k3-am64-main.dtsi      |  5 ++
 arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi    |  4 ++
 .../boot/dts/ti/k3-j7200-mcu-wakeup.dtsi      |  4 ++
 .../boot/dts/ti/k3-j721e-mcu-wakeup.dtsi      |  4 ++
 .../boot/dts/ti/k3-j721s2-mcu-wakeup.dtsi     |  4 ++
 .../boot/dts/ti/k3-j784s4-mcu-wakeup.dtsi     |  5 ++
 drivers/power/reset/Kconfig                   |  7 +++
 drivers/power/reset/Makefile                  |  1 +
 drivers/power/reset/ti-sci-reboot.c           | 63 +++++++++++++++++++
 15 files changed, 154 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/reset/ti,sci-reboot.yaml
 create mode 100644 drivers/power/reset/ti-sci-reboot.c

-- 
2.39.2


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

* [PATCH 01/12] dt-bindings: power: reset: Document ti,sci-reboot compatible
  2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
@ 2024-01-31 22:19 ` Andrew Davis
  2024-02-01 18:53   ` Conor Dooley
  2024-01-31 22:19 ` [PATCH 02/12] dt-bindings: arm: keystone: ti-sci: Add reboot-controller child node Andrew Davis
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 20+ messages in thread
From: Andrew Davis @ 2024-01-31 22:19 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm, Andrew Davis

This calls into the system firmware using TI-SCI to reboot the system.
Used as a fallback when PSCI is unable or not available to reboot
the system.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 .../bindings/power/reset/ti,sci-reboot.yaml   | 33 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/reset/ti,sci-reboot.yaml

diff --git a/Documentation/devicetree/bindings/power/reset/ti,sci-reboot.yaml b/Documentation/devicetree/bindings/power/reset/ti,sci-reboot.yaml
new file mode 100644
index 0000000000000..aa628be33d122
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/reset/ti,sci-reboot.yaml
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/reset/ti,sci-reboot.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI-SCI reboot controller
+
+maintainers:
+  - Andrew Davis <afd@ti.com>
+
+description: |
+  Some TI SoCs contain a system controller (like the Power Management Micro
+  Controller (PMMC) on Keystone 66AK2G SoC) that are responsible for controlling
+  the state of the various hardware modules present on the SoC. Communication
+  between the host processor running an OS and the system controller happens
+  through a protocol called TI System Control Interface (TI-SCI protocol).
+
+  This reboot controller node uses the TI SCI protocol to perform a device reboot.
+
+  Must be a child node of the associated TI-SCI system controller node.
+
+properties:
+  compatible:
+    const: ti,sci-reboot
+
+additionalProperties: false
+
+examples:
+  - |
+    k3_reboot: reboot-controller {
+        compatible = "ti,sci-reboot";
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 8999497011a26..45983bb174fe4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21751,6 +21751,7 @@ F:	Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
 F:	Documentation/devicetree/bindings/clock/ti,sci-clk.yaml
 F:	Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml
 F:	Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.yaml
+F:	Documentation/devicetree/bindings/power/reset/ti,sci-reboot.yaml
 F:	Documentation/devicetree/bindings/reset/ti,sci-reset.yaml
 F:	Documentation/devicetree/bindings/soc/ti/sci-pm-domain.yaml
 F:	drivers/clk/keystone/sci-clk.c
-- 
2.39.2


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

* [PATCH 02/12] dt-bindings: arm: keystone: ti-sci: Add reboot-controller child node
  2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
  2024-01-31 22:19 ` [PATCH 01/12] dt-bindings: power: reset: Document ti,sci-reboot compatible Andrew Davis
@ 2024-01-31 22:19 ` Andrew Davis
  2024-02-01 18:42   ` Conor Dooley
  2024-02-01 23:03   ` Rob Herring
  2024-01-31 22:19 ` [PATCH 03/12] power: reset: Add TI-SCI reboot driver Andrew Davis
                   ` (10 subsequent siblings)
  12 siblings, 2 replies; 20+ messages in thread
From: Andrew Davis @ 2024-01-31 22:19 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm, Andrew Davis

The TI-SCI firmware supports rebooting the system in addition to the
functions already listed here, document child node for the same.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 .../devicetree/bindings/arm/keystone/ti,sci.yaml          | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
index c24ad0968f3ef..e392175b33c74 100644
--- a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
+++ b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
@@ -83,6 +83,10 @@ properties:
     type: object
     $ref: /schemas/reset/ti,sci-reset.yaml#
 
+  reboot-controller:
+    type: object
+    $ref: /schemas/power/reset/ti,sci-reboot.yaml#
+
 required:
   - compatible
   - mbox-names
@@ -126,4 +130,8 @@ examples:
         compatible = "ti,sci-reset";
         #reset-cells = <2>;
       };
+
+      k3_reboot: reboot-controller {
+        compatible = "ti,sci-reboot";
+      };
     };
-- 
2.39.2


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

* [PATCH 03/12] power: reset: Add TI-SCI reboot driver
  2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
  2024-01-31 22:19 ` [PATCH 01/12] dt-bindings: power: reset: Document ti,sci-reboot compatible Andrew Davis
  2024-01-31 22:19 ` [PATCH 02/12] dt-bindings: arm: keystone: ti-sci: Add reboot-controller child node Andrew Davis
@ 2024-01-31 22:19 ` Andrew Davis
  2024-02-01 21:15   ` Nishanth Menon
  2024-01-31 22:19 ` [PATCH 04/12] arm64: dts: ti: k3-am64: Add reboot-controller node Andrew Davis
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 20+ messages in thread
From: Andrew Davis @ 2024-01-31 22:19 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm, Andrew Davis

This reboot driver calls into firmware using TI-SCI to reboot the system.
We register the handler with low priority as we want PSCI to remain the
main way these devices are rebooted. This driver acts as a fallback if
PSCI is not able to reboot the system.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 MAINTAINERS                         |  1 +
 drivers/power/reset/Kconfig         |  7 ++++
 drivers/power/reset/Makefile        |  1 +
 drivers/power/reset/ti-sci-reboot.c | 63 +++++++++++++++++++++++++++++
 4 files changed, 72 insertions(+)
 create mode 100644 drivers/power/reset/ti-sci-reboot.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 45983bb174fe4..ee67ea497fc56 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21758,6 +21758,7 @@ F:	drivers/clk/keystone/sci-clk.c
 F:	drivers/firmware/ti_sci*
 F:	drivers/irqchip/irq-ti-sci-inta.c
 F:	drivers/irqchip/irq-ti-sci-intr.c
+F:	drivers/power/reset/ti-sci-reboot.c
 F:	drivers/reset/reset-ti-sci.c
 F:	drivers/soc/ti/ti_sci_inta_msi.c
 F:	drivers/pmdomain/ti/ti_sci_pm_domains.c
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index fece990af4a75..d3e91e54cae24 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -205,6 +205,13 @@ config POWER_RESET_ST
 	help
 	  Reset support for STMicroelectronics boards.
 
+config POWER_RESET_TI_SCI
+	tristate "TI System Control Interface (TI-SCI) reboot driver"
+	depends on TI_SCI_PROTOCOL
+	help
+	  This enables the reboot driver support over TI System Control
+	  Interface available on some TI's SoCs.
+
 config POWER_RESET_TPS65086
 	bool "TPS65086 restart driver"
 	depends on MFD_TPS65086
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index a95d1bd275d18..881ca58a43b9c 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o
 obj-$(CONFIG_POWER_RESET_REGULATOR) += regulator-poweroff.o
 obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o
 obj-$(CONFIG_POWER_RESET_ST) += st-poweroff.o
+obj-$(CONFIG_POWER_RESET_TI_SCI) += ti-sci-reboot.o
 obj-$(CONFIG_POWER_RESET_TPS65086) += tps65086-restart.o
 obj-$(CONFIG_POWER_RESET_VERSATILE) += arm-versatile-reboot.o
 obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o
diff --git a/drivers/power/reset/ti-sci-reboot.c b/drivers/power/reset/ti-sci-reboot.c
new file mode 100644
index 0000000000000..400bd5d740f8b
--- /dev/null
+++ b/drivers/power/reset/ti-sci-reboot.c
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Texas Instrument's System Control Interface (TI-SCI) reboot driver
+ *
+ * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
+ *	Andrew Davis <afd@ti.com>
+ */
+
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+
+#include <linux/soc/ti/ti_sci_protocol.h>
+
+static int ti_sci_reboot_handler(struct sys_off_data *data)
+{
+	const struct ti_sci_handle *sci = data->cb_data;
+	const struct ti_sci_core_ops *core_ops = &sci->ops.core_ops;
+
+	core_ops->reboot_device(sci);
+
+	return NOTIFY_DONE;
+}
+
+static int ti_sci_reboot_probe(struct platform_device *pdev)
+{
+	const struct ti_sci_handle *sci;
+	int err;
+
+	sci = devm_ti_sci_get_handle(&pdev->dev);
+	if (IS_ERR(sci))
+		return PTR_ERR(sci);
+
+	err = devm_register_sys_off_handler(&pdev->dev,
+					    SYS_OFF_MODE_RESTART,
+					    SYS_OFF_PRIO_LOW,
+					    ti_sci_reboot_handler,
+					    (void *)sci);
+	if (err)
+		return dev_err_probe(&pdev->dev, err, "Cannot register restart handler\n");
+
+	return 0;
+}
+
+static const struct of_device_id ti_sci_reboot_of_match[] = {
+	{ .compatible = "ti,sci-reboot", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, ti_sci_reboot_of_match);
+
+static struct platform_driver ti_sci_reboot_driver = {
+	.probe = ti_sci_reboot_probe,
+	.driver = {
+		.name = "ti-sci-reboot",
+		.of_match_table = ti_sci_reboot_of_match,
+	},
+};
+module_platform_driver(ti_sci_reboot_driver);
+
+MODULE_AUTHOR("Andrew Davis <afd@ti.com>");
+MODULE_DESCRIPTION("TI System Control Interface (TI SCI) Reboot driver");
+MODULE_LICENSE("GPL");
-- 
2.39.2


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

* [PATCH 04/12] arm64: dts: ti: k3-am64: Add reboot-controller node
  2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
                   ` (2 preceding siblings ...)
  2024-01-31 22:19 ` [PATCH 03/12] power: reset: Add TI-SCI reboot driver Andrew Davis
@ 2024-01-31 22:19 ` Andrew Davis
  2024-01-31 22:19 ` [PATCH 05/12] arm64: dts: ti: k3-am62: " Andrew Davis
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Andrew Davis @ 2024-01-31 22:19 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm, Andrew Davis

While PCSI normally handles reboot for K3, this is an available
fallback in case PCSI reboot fails. Add direct reboot TI-SCI
node to system-controller.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am64-main.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am64-main.dtsi b/arch/arm64/boot/dts/ti/k3-am64-main.dtsi
index e348114f42e01..f9d2d1b67282d 100644
--- a/arch/arm64/boot/dts/ti/k3-am64-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am64-main.dtsi
@@ -228,6 +228,11 @@ k3_reset: reset-controller {
 			compatible = "ti,sci-reset";
 			#reset-cells = <2>;
 		};
+
+		k3_reboot: reboot-controller {
+			bootph-all;
+			compatible = "ti,sci-reboot";
+		};
 	};
 
 	main_pmx0: pinctrl@f4000 {
-- 
2.39.2


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

* [PATCH 05/12] arm64: dts: ti: k3-am62: Add reboot-controller node
  2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
                   ` (3 preceding siblings ...)
  2024-01-31 22:19 ` [PATCH 04/12] arm64: dts: ti: k3-am64: Add reboot-controller node Andrew Davis
@ 2024-01-31 22:19 ` Andrew Davis
  2024-01-31 22:19 ` [PATCH 06/12] arm64: dts: ti: k3-am62a: " Andrew Davis
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Andrew Davis @ 2024-01-31 22:19 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm, Andrew Davis

While PCSI normally handles reboot for K3, this is an available
fallback in case PCSI reboot fails. Add direct reboot TI-SCI
node to system-controller.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am62-main.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am62-main.dtsi b/arch/arm64/boot/dts/ti/k3-am62-main.dtsi
index 464b7565d085d..eb71523e85c36 100644
--- a/arch/arm64/boot/dts/ti/k3-am62-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62-main.dtsi
@@ -203,6 +203,11 @@ k3_reset: reset-controller {
 			compatible = "ti,sci-reset";
 			#reset-cells = <2>;
 		};
+
+		k3_reboot: reboot-controller {
+			bootph-all;
+			compatible = "ti,sci-reboot";
+		};
 	};
 
 	crypto: crypto@40900000 {
-- 
2.39.2


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

* [PATCH 06/12] arm64: dts: ti: k3-am62a: Add reboot-controller node
  2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
                   ` (4 preceding siblings ...)
  2024-01-31 22:19 ` [PATCH 05/12] arm64: dts: ti: k3-am62: " Andrew Davis
@ 2024-01-31 22:19 ` Andrew Davis
  2024-01-31 22:19 ` [PATCH 07/12] arm64: dts: ti: k3-am62p: " Andrew Davis
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Andrew Davis @ 2024-01-31 22:19 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm, Andrew Davis

While PCSI normally handles reboot for K3, this is an available
fallback in case PCSI reboot fails. Add direct reboot TI-SCI
node to system-controller.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am62a-main.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am62a-main.dtsi b/arch/arm64/boot/dts/ti/k3-am62a-main.dtsi
index f0b8c9ab14593..222505edc15bb 100644
--- a/arch/arm64/boot/dts/ti/k3-am62a-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62a-main.dtsi
@@ -215,6 +215,10 @@ k3_reset: reset-controller {
 			compatible = "ti,sci-reset";
 			#reset-cells = <2>;
 		};
+
+		k3_reboot: reboot-controller {
+			compatible = "ti,sci-reboot";
+		};
 	};
 
 	secure_proxy_sa3: mailbox@43600000 {
-- 
2.39.2


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

* [PATCH 07/12] arm64: dts: ti: k3-am62p: Add reboot-controller node
  2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
                   ` (5 preceding siblings ...)
  2024-01-31 22:19 ` [PATCH 06/12] arm64: dts: ti: k3-am62a: " Andrew Davis
@ 2024-01-31 22:19 ` Andrew Davis
  2024-01-31 22:19 ` [PATCH 08/12] arm64: dts: ti: k3-am65: " Andrew Davis
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Andrew Davis @ 2024-01-31 22:19 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm, Andrew Davis

While PCSI normally handles reboot for K3, this is an available
fallback in case PCSI reboot fails. Add direct reboot TI-SCI
node to system-controller.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am62p-main.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am62p-main.dtsi b/arch/arm64/boot/dts/ti/k3-am62p-main.dtsi
index 4c51bae06b57e..7a10ed7a41a23 100644
--- a/arch/arm64/boot/dts/ti/k3-am62p-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62p-main.dtsi
@@ -185,6 +185,11 @@ k3_reset: reset-controller {
 			#reset-cells = <2>;
 			bootph-all;
 		};
+
+		k3_reboot: reboot-controller {
+			compatible = "ti,sci-reboot";
+			bootph-all;
+		};
 	};
 
 	crypto: crypto@40900000 {
-- 
2.39.2


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

* [PATCH 08/12] arm64: dts: ti: k3-am65: Add reboot-controller node
  2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
                   ` (6 preceding siblings ...)
  2024-01-31 22:19 ` [PATCH 07/12] arm64: dts: ti: k3-am62p: " Andrew Davis
@ 2024-01-31 22:19 ` Andrew Davis
  2024-01-31 22:19 ` [PATCH 09/12] arm64: dts: ti: k3-j7200: " Andrew Davis
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Andrew Davis @ 2024-01-31 22:19 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm, Andrew Davis

While PCSI normally handles reboot for K3, this is an available
fallback in case PCSI reboot fails. Add direct reboot TI-SCI
node to system-controller.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
index f037b36243ced..986684b7a7c43 100644
--- a/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
@@ -32,6 +32,10 @@ k3_reset: reset-controller {
 			compatible = "ti,sci-reset";
 			#reset-cells = <2>;
 		};
+
+		k3_reboot: reboot-controller {
+			compatible = "ti,sci-reboot";
+		};
 	};
 
 	wkup_conf: bus@43000000 {
-- 
2.39.2


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

* [PATCH 09/12] arm64: dts: ti: k3-j7200: Add reboot-controller node
  2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
                   ` (7 preceding siblings ...)
  2024-01-31 22:19 ` [PATCH 08/12] arm64: dts: ti: k3-am65: " Andrew Davis
@ 2024-01-31 22:19 ` Andrew Davis
  2024-01-31 22:19 ` [PATCH 10/12] arm64: dts: ti: k3-j721e: " Andrew Davis
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Andrew Davis @ 2024-01-31 22:19 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm, Andrew Davis

While PCSI normally handles reboot for K3, this is an available
fallback in case PCSI reboot fails. Add direct reboot TI-SCI
node to system-controller.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi
index 60b26374ae0cc..a37d66bcf93e9 100644
--- a/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi
@@ -32,6 +32,10 @@ k3_reset: reset-controller {
 			compatible = "ti,sci-reset";
 			#reset-cells = <2>;
 		};
+
+		k3_reboot: reboot-controller {
+			compatible = "ti,sci-reboot";
+		};
 	};
 
 	mcu_timer0: timer@40400000 {
-- 
2.39.2


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

* [PATCH 10/12] arm64: dts: ti: k3-j721e: Add reboot-controller node
  2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
                   ` (8 preceding siblings ...)
  2024-01-31 22:19 ` [PATCH 09/12] arm64: dts: ti: k3-j7200: " Andrew Davis
@ 2024-01-31 22:19 ` Andrew Davis
  2024-01-31 22:19 ` [PATCH 11/12] arm64: dts: ti: k3-j721s2: " Andrew Davis
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Andrew Davis @ 2024-01-31 22:19 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm, Andrew Davis

While PCSI normally handles reboot for K3, this is an available
fallback in case PCSI reboot fails. Add direct reboot TI-SCI
node to system-controller.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi
index a74912d9e4daf..a1512d9fbb92f 100644
--- a/arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi
@@ -32,6 +32,10 @@ k3_reset: reset-controller {
 			compatible = "ti,sci-reset";
 			#reset-cells = <2>;
 		};
+
+		k3_reboot: reboot-controller {
+			compatible = "ti,sci-reboot";
+		};
 	};
 
 	mcu_conf: syscon@40f00000 {
-- 
2.39.2


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

* [PATCH 11/12] arm64: dts: ti: k3-j721s2: Add reboot-controller node
  2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
                   ` (9 preceding siblings ...)
  2024-01-31 22:19 ` [PATCH 10/12] arm64: dts: ti: k3-j721e: " Andrew Davis
@ 2024-01-31 22:19 ` Andrew Davis
  2024-01-31 22:19 ` [PATCH 12/12] arm64: dts: ti: k3-j784s4: " Andrew Davis
  2024-02-01 21:14 ` [PATCH 00/12] Add TI-SCI reboot driver Nishanth Menon
  12 siblings, 0 replies; 20+ messages in thread
From: Andrew Davis @ 2024-01-31 22:19 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm, Andrew Davis

While PCSI normally handles reboot for K3, this is an available
fallback in case PCSI reboot fails. Add direct reboot TI-SCI
node to system-controller.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm64/boot/dts/ti/k3-j721s2-mcu-wakeup.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-j721s2-mcu-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-j721s2-mcu-wakeup.dtsi
index 80aa33c58a452..1f1125208dedf 100644
--- a/arch/arm64/boot/dts/ti/k3-j721s2-mcu-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j721s2-mcu-wakeup.dtsi
@@ -32,6 +32,10 @@ k3_reset: reset-controller {
 			compatible = "ti,sci-reset";
 			#reset-cells = <2>;
 		};
+
+		k3_reboot: reboot-controller {
+			compatible = "ti,sci-reboot";
+		};
 	};
 
 	wkup_conf: bus@43000000 {
-- 
2.39.2


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

* [PATCH 12/12] arm64: dts: ti: k3-j784s4: Add reboot-controller node
  2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
                   ` (10 preceding siblings ...)
  2024-01-31 22:19 ` [PATCH 11/12] arm64: dts: ti: k3-j721s2: " Andrew Davis
@ 2024-01-31 22:19 ` Andrew Davis
  2024-02-01 21:14 ` [PATCH 00/12] Add TI-SCI reboot driver Nishanth Menon
  12 siblings, 0 replies; 20+ messages in thread
From: Andrew Davis @ 2024-01-31 22:19 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm, Andrew Davis

While PCSI normally handles reboot for K3, this is an available
fallback in case PCSI reboot fails. Add direct reboot TI-SCI
node to system-controller.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm64/boot/dts/ti/k3-j784s4-mcu-wakeup.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-j784s4-mcu-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-j784s4-mcu-wakeup.dtsi
index 3902a921d7e58..6a66de4f6e549 100644
--- a/arch/arm64/boot/dts/ti/k3-j784s4-mcu-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j784s4-mcu-wakeup.dtsi
@@ -36,6 +36,11 @@ k3_reset: reset-controller {
 			compatible = "ti,sci-reset";
 			#reset-cells = <2>;
 		};
+
+		k3_reboot: reboot-controller {
+			bootph-all;
+			compatible = "ti,sci-reboot";
+		};
 	};
 
 	wkup_conf: bus@43000000 {
-- 
2.39.2


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

* Re: [PATCH 02/12] dt-bindings: arm: keystone: ti-sci: Add reboot-controller child node
  2024-01-31 22:19 ` [PATCH 02/12] dt-bindings: arm: keystone: ti-sci: Add reboot-controller child node Andrew Davis
@ 2024-02-01 18:42   ` Conor Dooley
  2024-02-01 23:03   ` Rob Herring
  1 sibling, 0 replies; 20+ messages in thread
From: Conor Dooley @ 2024-02-01 18:42 UTC (permalink / raw)
  To: Andrew Davis
  Cc: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm

[-- Attachment #1: Type: text/plain, Size: 1284 bytes --]

On Wed, Jan 31, 2024 at 04:19:47PM -0600, Andrew Davis wrote:
> The TI-SCI firmware supports rebooting the system in addition to the
> functions already listed here, document child node for the same.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>

Acked-by: Conor Dooley <conor.dooley@microchip.com>

Cheers,
Conor.

> ---
>  .../devicetree/bindings/arm/keystone/ti,sci.yaml          | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
> index c24ad0968f3ef..e392175b33c74 100644
> --- a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
> +++ b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
> @@ -83,6 +83,10 @@ properties:
>      type: object
>      $ref: /schemas/reset/ti,sci-reset.yaml#
>  
> +  reboot-controller:
> +    type: object
> +    $ref: /schemas/power/reset/ti,sci-reboot.yaml#
> +
>  required:
>    - compatible
>    - mbox-names
> @@ -126,4 +130,8 @@ examples:
>          compatible = "ti,sci-reset";
>          #reset-cells = <2>;
>        };
> +
> +      k3_reboot: reboot-controller {
> +        compatible = "ti,sci-reboot";
> +      };
>      };
> -- 
> 2.39.2
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH 01/12] dt-bindings: power: reset: Document ti,sci-reboot compatible
  2024-01-31 22:19 ` [PATCH 01/12] dt-bindings: power: reset: Document ti,sci-reboot compatible Andrew Davis
@ 2024-02-01 18:53   ` Conor Dooley
  0 siblings, 0 replies; 20+ messages in thread
From: Conor Dooley @ 2024-02-01 18:53 UTC (permalink / raw)
  To: Andrew Davis
  Cc: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm

[-- Attachment #1: Type: text/plain, Size: 2185 bytes --]

On Wed, Jan 31, 2024 at 04:19:46PM -0600, Andrew Davis wrote:
> This calls into the system firmware using TI-SCI to reboot the system.
> Used as a fallback when PSCI is unable or not available to reboot
> the system.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
>  .../bindings/power/reset/ti,sci-reboot.yaml   | 33 +++++++++++++++++++
>  MAINTAINERS                                   |  1 +
>  2 files changed, 34 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/power/reset/ti,sci-reboot.yaml
> 
> diff --git a/Documentation/devicetree/bindings/power/reset/ti,sci-reboot.yaml b/Documentation/devicetree/bindings/power/reset/ti,sci-reboot.yaml
> new file mode 100644
> index 0000000000000..aa628be33d122
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/reset/ti,sci-reboot.yaml
> @@ -0,0 +1,33 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/reset/ti,sci-reboot.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: TI-SCI reboot controller
> +
> +maintainers:
> +  - Andrew Davis <afd@ti.com>
> +
> +description: |
> +  Some TI SoCs contain a system controller (like the Power Management Micro
> +  Controller (PMMC) on Keystone 66AK2G SoC) that are responsible for controlling
> +  the state of the various hardware modules present on the SoC. Communication
> +  between the host processor running an OS and the system controller happens
> +  through a protocol called TI System Control Interface (TI-SCI protocol).
> +
> +  This reboot controller node uses the TI SCI protocol to perform a device reboot.
> +
> +  Must be a child node of the associated TI-SCI system controller node.
> +
> +properties:
> +  compatible:
> +    const: ti,sci-reboot
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    k3_reboot: reboot-controller {
> +        compatible = "ti,sci-reboot";
> +    };

I'd drop the example since this has no use standalone and just rely on
the one in the parent. Otherwise I think this is fine.

Acked-by: Conor Dooley <conor.dooley@microchip.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH 00/12] Add TI-SCI reboot driver
  2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
                   ` (11 preceding siblings ...)
  2024-01-31 22:19 ` [PATCH 12/12] arm64: dts: ti: k3-j784s4: " Andrew Davis
@ 2024-02-01 21:14 ` Nishanth Menon
  12 siblings, 0 replies; 20+ messages in thread
From: Nishanth Menon @ 2024-02-01 21:14 UTC (permalink / raw)
  To: Andrew Davis
  Cc: Tero Kristo, Santosh Shilimkar, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Sebastian Reichel, Vignesh Raghavendra,
	linux-arm-kernel, devicetree, linux-kernel, linux-pm

On 16:19-20240131, Andrew Davis wrote:
> Hello all,
> 
> While PCSI normally handles reboot for K3, this is an available
> fallback in case PCSI reboot fails. This driver is registered 
> with low priority as we want PSCI to remain the main way these
> devices are rebooted.
> 
> The important part is the binding/DT changes. Currently in
> U-Boot (which use the Linux device trees) we may not have
> PSCI available yet (pre TF-A) and so we need this node
> to correctly reboot. Adding this node in U-Boot is one of
> the last remaining deltas between the two project DT files. 
> 
> Thanks,
> Andrew
> 
> Andrew Davis (12):
>   dt-bindings: power: reset: Document ti,sci-reboot compatible
>   dt-bindings: arm: keystone: ti-sci: Add reboot-controller child node
>   power: reset: Add TI-SCI reboot driver
>   arm64: dts: ti: k3-am64: Add reboot-controller node
>   arm64: dts: ti: k3-am62: Add reboot-controller node
>   arm64: dts: ti: k3-am62a: Add reboot-controller node
>   arm64: dts: ti: k3-am62p: Add reboot-controller node
>   arm64: dts: ti: k3-am65: Add reboot-controller node
>   arm64: dts: ti: k3-j7200: Add reboot-controller node
>   arm64: dts: ti: k3-j721e: Add reboot-controller node
>   arm64: dts: ti: k3-j721s2: Add reboot-controller node
>   arm64: dts: ti: k3-j784s4: Add reboot-controller node

Maybe after the driver has been accepted, a defconfig patch(module) might be
useful?

> 
>  .../bindings/arm/keystone/ti,sci.yaml         |  8 +++
>  .../bindings/power/reset/ti,sci-reboot.yaml   | 33 ++++++++++
>  MAINTAINERS                                   |  2 +
>  arch/arm64/boot/dts/ti/k3-am62-main.dtsi      |  5 ++
>  arch/arm64/boot/dts/ti/k3-am62a-main.dtsi     |  4 ++
>  arch/arm64/boot/dts/ti/k3-am62p-main.dtsi     |  5 ++
>  arch/arm64/boot/dts/ti/k3-am64-main.dtsi      |  5 ++
>  arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi    |  4 ++
>  .../boot/dts/ti/k3-j7200-mcu-wakeup.dtsi      |  4 ++
>  .../boot/dts/ti/k3-j721e-mcu-wakeup.dtsi      |  4 ++
>  .../boot/dts/ti/k3-j721s2-mcu-wakeup.dtsi     |  4 ++
>  .../boot/dts/ti/k3-j784s4-mcu-wakeup.dtsi     |  5 ++
>  drivers/power/reset/Kconfig                   |  7 +++
>  drivers/power/reset/Makefile                  |  1 +
>  drivers/power/reset/ti-sci-reboot.c           | 63 +++++++++++++++++++
>  15 files changed, 154 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/power/reset/ti,sci-reboot.yaml
>  create mode 100644 drivers/power/reset/ti-sci-reboot.c

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D

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

* Re: [PATCH 03/12] power: reset: Add TI-SCI reboot driver
  2024-01-31 22:19 ` [PATCH 03/12] power: reset: Add TI-SCI reboot driver Andrew Davis
@ 2024-02-01 21:15   ` Nishanth Menon
  2024-02-02 17:04     ` Sebastian Reichel
  0 siblings, 1 reply; 20+ messages in thread
From: Nishanth Menon @ 2024-02-01 21:15 UTC (permalink / raw)
  To: Andrew Davis
  Cc: Tero Kristo, Santosh Shilimkar, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Sebastian Reichel, Vignesh Raghavendra,
	linux-arm-kernel, devicetree, linux-kernel, linux-pm

On 16:19-20240131, Andrew Davis wrote:
> This reboot driver calls into firmware using TI-SCI to reboot the system.
> We register the handler with low priority as we want PSCI to remain the
> main way these devices are rebooted. This driver acts as a fallback if
> PSCI is not able to reboot the system.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
>  MAINTAINERS                         |  1 +
>  drivers/power/reset/Kconfig         |  7 ++++
>  drivers/power/reset/Makefile        |  1 +
>  drivers/power/reset/ti-sci-reboot.c | 63 +++++++++++++++++++++++++++++
>  4 files changed, 72 insertions(+)
>  create mode 100644 drivers/power/reset/ti-sci-reboot.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 45983bb174fe4..ee67ea497fc56 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -21758,6 +21758,7 @@ F:	drivers/clk/keystone/sci-clk.c
>  F:	drivers/firmware/ti_sci*
>  F:	drivers/irqchip/irq-ti-sci-inta.c
>  F:	drivers/irqchip/irq-ti-sci-intr.c
> +F:	drivers/power/reset/ti-sci-reboot.c
>  F:	drivers/reset/reset-ti-sci.c
>  F:	drivers/soc/ti/ti_sci_inta_msi.c
>  F:	drivers/pmdomain/ti/ti_sci_pm_domains.c
> diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
> index fece990af4a75..d3e91e54cae24 100644
> --- a/drivers/power/reset/Kconfig
> +++ b/drivers/power/reset/Kconfig
> @@ -205,6 +205,13 @@ config POWER_RESET_ST
>  	help
>  	  Reset support for STMicroelectronics boards.
>  
> +config POWER_RESET_TI_SCI
> +	tristate "TI System Control Interface (TI-SCI) reboot driver"
> +	depends on TI_SCI_PROTOCOL
> +	help
> +	  This enables the reboot driver support over TI System Control
> +	  Interface available on some TI's SoCs.
> +
>  config POWER_RESET_TPS65086
>  	bool "TPS65086 restart driver"
>  	depends on MFD_TPS65086
> diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
> index a95d1bd275d18..881ca58a43b9c 100644
> --- a/drivers/power/reset/Makefile
> +++ b/drivers/power/reset/Makefile
> @@ -23,6 +23,7 @@ obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o
>  obj-$(CONFIG_POWER_RESET_REGULATOR) += regulator-poweroff.o
>  obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o
>  obj-$(CONFIG_POWER_RESET_ST) += st-poweroff.o
> +obj-$(CONFIG_POWER_RESET_TI_SCI) += ti-sci-reboot.o
>  obj-$(CONFIG_POWER_RESET_TPS65086) += tps65086-restart.o
>  obj-$(CONFIG_POWER_RESET_VERSATILE) += arm-versatile-reboot.o
>  obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o
> diff --git a/drivers/power/reset/ti-sci-reboot.c b/drivers/power/reset/ti-sci-reboot.c
> new file mode 100644
> index 0000000000000..400bd5d740f8b
> --- /dev/null
> +++ b/drivers/power/reset/ti-sci-reboot.c
> @@ -0,0 +1,63 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Texas Instrument's System Control Interface (TI-SCI) reboot driver
> + *
> + * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
> + *	Andrew Davis <afd@ti.com>
> + */
> +
> +#include <linux/mod_devicetable.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/reboot.h>
> +
> +#include <linux/soc/ti/ti_sci_protocol.h>
> +
> +static int ti_sci_reboot_handler(struct sys_off_data *data)
> +{
> +	const struct ti_sci_handle *sci = data->cb_data;
> +	const struct ti_sci_core_ops *core_ops = &sci->ops.core_ops;
> +
> +	core_ops->reboot_device(sci);
> +
> +	return NOTIFY_DONE;
> +}
> +
> +static int ti_sci_reboot_probe(struct platform_device *pdev)
> +{
> +	const struct ti_sci_handle *sci;
> +	int err;
> +
> +	sci = devm_ti_sci_get_handle(&pdev->dev);
> +	if (IS_ERR(sci))
> +		return PTR_ERR(sci);
> +
> +	err = devm_register_sys_off_handler(&pdev->dev,
> +					    SYS_OFF_MODE_RESTART,
> +					    SYS_OFF_PRIO_LOW,
> +					    ti_sci_reboot_handler,
> +					    (void *)sci);
> +	if (err)
> +		return dev_err_probe(&pdev->dev, err, "Cannot register restart handler\n");
> +
> +	return 0;
> +}
> +
> +static const struct of_device_id ti_sci_reboot_of_match[] = {
> +	{ .compatible = "ti,sci-reboot", },
> +	{ /* sentinel */ },
> +};
> +MODULE_DEVICE_TABLE(of, ti_sci_reboot_of_match);
> +
> +static struct platform_driver ti_sci_reboot_driver = {
> +	.probe = ti_sci_reboot_probe,
> +	.driver = {
> +		.name = "ti-sci-reboot",
> +		.of_match_table = ti_sci_reboot_of_match,
> +	},
> +};
> +module_platform_driver(ti_sci_reboot_driver);
> +
> +MODULE_AUTHOR("Andrew Davis <afd@ti.com>");
> +MODULE_DESCRIPTION("TI System Control Interface (TI SCI) Reboot driver");
> +MODULE_LICENSE("GPL");
> -- 
> 2.39.2

Will assume the patch to go via Sebastien. Will be good for the dts to
go via SoC tree. So hoping Sebastien will just pick the driver and
bindings.

Reviewed-by: Nishanth Menon <nm@ti.com>
-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D

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

* Re: [PATCH 02/12] dt-bindings: arm: keystone: ti-sci: Add reboot-controller child node
  2024-01-31 22:19 ` [PATCH 02/12] dt-bindings: arm: keystone: ti-sci: Add reboot-controller child node Andrew Davis
  2024-02-01 18:42   ` Conor Dooley
@ 2024-02-01 23:03   ` Rob Herring
  2024-02-01 23:50     ` Andrew Davis
  1 sibling, 1 reply; 20+ messages in thread
From: Rob Herring @ 2024-02-01 23:03 UTC (permalink / raw)
  To: Andrew Davis
  Cc: Nishanth Menon, Tero Kristo, Santosh Shilimkar,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm

On Wed, Jan 31, 2024 at 04:19:47PM -0600, Andrew Davis wrote:
> The TI-SCI firmware supports rebooting the system in addition to the
> functions already listed here, document child node for the same.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
>  .../devicetree/bindings/arm/keystone/ti,sci.yaml          | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
> index c24ad0968f3ef..e392175b33c74 100644
> --- a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
> +++ b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
> @@ -83,6 +83,10 @@ properties:
>      type: object
>      $ref: /schemas/reset/ti,sci-reset.yaml#
>  
> +  reboot-controller:
> +    type: object
> +    $ref: /schemas/power/reset/ti,sci-reboot.yaml#

Don't need a ref just for a single property.

But then why do we need a node here at all? Can't you assume reboot 
support for TI-SCI firmware (i.e. based on the parent node). Then you 
don't need a DT update to add the feature.

Rob

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

* Re: [PATCH 02/12] dt-bindings: arm: keystone: ti-sci: Add reboot-controller child node
  2024-02-01 23:03   ` Rob Herring
@ 2024-02-01 23:50     ` Andrew Davis
  0 siblings, 0 replies; 20+ messages in thread
From: Andrew Davis @ 2024-02-01 23:50 UTC (permalink / raw)
  To: Rob Herring
  Cc: Nishanth Menon, Tero Kristo, Santosh Shilimkar,
	Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel,
	Vignesh Raghavendra, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm

On 2/1/24 5:03 PM, Rob Herring wrote:
> On Wed, Jan 31, 2024 at 04:19:47PM -0600, Andrew Davis wrote:
>> The TI-SCI firmware supports rebooting the system in addition to the
>> functions already listed here, document child node for the same.
>>
>> Signed-off-by: Andrew Davis <afd@ti.com>
>> ---
>>   .../devicetree/bindings/arm/keystone/ti,sci.yaml          | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
>> index c24ad0968f3ef..e392175b33c74 100644
>> --- a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
>> +++ b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
>> @@ -83,6 +83,10 @@ properties:
>>       type: object
>>       $ref: /schemas/reset/ti,sci-reset.yaml#
>>   
>> +  reboot-controller:
>> +    type: object
>> +    $ref: /schemas/power/reset/ti,sci-reboot.yaml#
> 
> Don't need a ref just for a single property.
> 
> But then why do we need a node here at all? Can't you assume reboot
> support for TI-SCI firmware (i.e. based on the parent node). Then you
> don't need a DT update to add the feature.
> 

We could yes, but then again we could do the same for all the
child nodes of this system-controller parent node. Might even
have been better that way, for now I'm trying to be consistent
with what is already here (child node per service provided,
even though the services are always the same).

Andrew

> Rob

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

* Re: [PATCH 03/12] power: reset: Add TI-SCI reboot driver
  2024-02-01 21:15   ` Nishanth Menon
@ 2024-02-02 17:04     ` Sebastian Reichel
  0 siblings, 0 replies; 20+ messages in thread
From: Sebastian Reichel @ 2024-02-02 17:04 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Andrew Davis, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Vignesh Raghavendra,
	linux-arm-kernel, devicetree, linux-kernel, linux-pm

[-- Attachment #1: Type: text/plain, Size: 5216 bytes --]

Hi,

On Thu, Feb 01, 2024 at 03:15:34PM -0600, Nishanth Menon wrote:
> On 16:19-20240131, Andrew Davis wrote:
> > This reboot driver calls into firmware using TI-SCI to reboot the system.
> > We register the handler with low priority as we want PSCI to remain the
> > main way these devices are rebooted. This driver acts as a fallback if
> > PSCI is not able to reboot the system.
> > 
> > Signed-off-by: Andrew Davis <afd@ti.com>
> > ---
> >  MAINTAINERS                         |  1 +
> >  drivers/power/reset/Kconfig         |  7 ++++
> >  drivers/power/reset/Makefile        |  1 +
> >  drivers/power/reset/ti-sci-reboot.c | 63 +++++++++++++++++++++++++++++
> >  4 files changed, 72 insertions(+)
> >  create mode 100644 drivers/power/reset/ti-sci-reboot.c
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 45983bb174fe4..ee67ea497fc56 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -21758,6 +21758,7 @@ F:	drivers/clk/keystone/sci-clk.c
> >  F:	drivers/firmware/ti_sci*
> >  F:	drivers/irqchip/irq-ti-sci-inta.c
> >  F:	drivers/irqchip/irq-ti-sci-intr.c
> > +F:	drivers/power/reset/ti-sci-reboot.c
> >  F:	drivers/reset/reset-ti-sci.c
> >  F:	drivers/soc/ti/ti_sci_inta_msi.c
> >  F:	drivers/pmdomain/ti/ti_sci_pm_domains.c
> > diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
> > index fece990af4a75..d3e91e54cae24 100644
> > --- a/drivers/power/reset/Kconfig
> > +++ b/drivers/power/reset/Kconfig
> > @@ -205,6 +205,13 @@ config POWER_RESET_ST
> >  	help
> >  	  Reset support for STMicroelectronics boards.
> >  
> > +config POWER_RESET_TI_SCI
> > +	tristate "TI System Control Interface (TI-SCI) reboot driver"
> > +	depends on TI_SCI_PROTOCOL
> > +	help
> > +	  This enables the reboot driver support over TI System Control
> > +	  Interface available on some TI's SoCs.
> > +
> >  config POWER_RESET_TPS65086
> >  	bool "TPS65086 restart driver"
> >  	depends on MFD_TPS65086
> > diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
> > index a95d1bd275d18..881ca58a43b9c 100644
> > --- a/drivers/power/reset/Makefile
> > +++ b/drivers/power/reset/Makefile
> > @@ -23,6 +23,7 @@ obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o
> >  obj-$(CONFIG_POWER_RESET_REGULATOR) += regulator-poweroff.o
> >  obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o
> >  obj-$(CONFIG_POWER_RESET_ST) += st-poweroff.o
> > +obj-$(CONFIG_POWER_RESET_TI_SCI) += ti-sci-reboot.o
> >  obj-$(CONFIG_POWER_RESET_TPS65086) += tps65086-restart.o
> >  obj-$(CONFIG_POWER_RESET_VERSATILE) += arm-versatile-reboot.o
> >  obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o
> > diff --git a/drivers/power/reset/ti-sci-reboot.c b/drivers/power/reset/ti-sci-reboot.c
> > new file mode 100644
> > index 0000000000000..400bd5d740f8b
> > --- /dev/null
> > +++ b/drivers/power/reset/ti-sci-reboot.c
> > @@ -0,0 +1,63 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * Texas Instrument's System Control Interface (TI-SCI) reboot driver
> > + *
> > + * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
> > + *	Andrew Davis <afd@ti.com>
> > + */
> > +
> > +#include <linux/mod_devicetable.h>
> > +#include <linux/module.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/reboot.h>
> > +
> > +#include <linux/soc/ti/ti_sci_protocol.h>
> > +
> > +static int ti_sci_reboot_handler(struct sys_off_data *data)
> > +{
> > +	const struct ti_sci_handle *sci = data->cb_data;
> > +	const struct ti_sci_core_ops *core_ops = &sci->ops.core_ops;
> > +
> > +	core_ops->reboot_device(sci);
> > +
> > +	return NOTIFY_DONE;
> > +}
> > +
> > +static int ti_sci_reboot_probe(struct platform_device *pdev)
> > +{
> > +	const struct ti_sci_handle *sci;
> > +	int err;
> > +
> > +	sci = devm_ti_sci_get_handle(&pdev->dev);
> > +	if (IS_ERR(sci))
> > +		return PTR_ERR(sci);
> > +
> > +	err = devm_register_sys_off_handler(&pdev->dev,
> > +					    SYS_OFF_MODE_RESTART,
> > +					    SYS_OFF_PRIO_LOW,
> > +					    ti_sci_reboot_handler,
> > +					    (void *)sci);
> > +	if (err)
> > +		return dev_err_probe(&pdev->dev, err, "Cannot register restart handler\n");
> > +
> > +	return 0;
> > +}
> > +
> > +static const struct of_device_id ti_sci_reboot_of_match[] = {
> > +	{ .compatible = "ti,sci-reboot", },
> > +	{ /* sentinel */ },
> > +};
> > +MODULE_DEVICE_TABLE(of, ti_sci_reboot_of_match);
> > +
> > +static struct platform_driver ti_sci_reboot_driver = {
> > +	.probe = ti_sci_reboot_probe,
> > +	.driver = {
> > +		.name = "ti-sci-reboot",
> > +		.of_match_table = ti_sci_reboot_of_match,
> > +	},
> > +};
> > +module_platform_driver(ti_sci_reboot_driver);
> > +
> > +MODULE_AUTHOR("Andrew Davis <afd@ti.com>");
> > +MODULE_DESCRIPTION("TI System Control Interface (TI SCI) Reboot driver");
> > +MODULE_LICENSE("GPL");
> > -- 
> > 2.39.2
> 
> Will assume the patch to go via Sebastien. Will be good for the dts to
> go via SoC tree. So hoping Sebastien will just pick the driver and
> bindings.

I will wait for the DT binding discussion to have settled. The
driver itself LGTM.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2024-02-02 17:04 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-31 22:19 [PATCH 00/12] Add TI-SCI reboot driver Andrew Davis
2024-01-31 22:19 ` [PATCH 01/12] dt-bindings: power: reset: Document ti,sci-reboot compatible Andrew Davis
2024-02-01 18:53   ` Conor Dooley
2024-01-31 22:19 ` [PATCH 02/12] dt-bindings: arm: keystone: ti-sci: Add reboot-controller child node Andrew Davis
2024-02-01 18:42   ` Conor Dooley
2024-02-01 23:03   ` Rob Herring
2024-02-01 23:50     ` Andrew Davis
2024-01-31 22:19 ` [PATCH 03/12] power: reset: Add TI-SCI reboot driver Andrew Davis
2024-02-01 21:15   ` Nishanth Menon
2024-02-02 17:04     ` Sebastian Reichel
2024-01-31 22:19 ` [PATCH 04/12] arm64: dts: ti: k3-am64: Add reboot-controller node Andrew Davis
2024-01-31 22:19 ` [PATCH 05/12] arm64: dts: ti: k3-am62: " Andrew Davis
2024-01-31 22:19 ` [PATCH 06/12] arm64: dts: ti: k3-am62a: " Andrew Davis
2024-01-31 22:19 ` [PATCH 07/12] arm64: dts: ti: k3-am62p: " Andrew Davis
2024-01-31 22:19 ` [PATCH 08/12] arm64: dts: ti: k3-am65: " Andrew Davis
2024-01-31 22:19 ` [PATCH 09/12] arm64: dts: ti: k3-j7200: " Andrew Davis
2024-01-31 22:19 ` [PATCH 10/12] arm64: dts: ti: k3-j721e: " Andrew Davis
2024-01-31 22:19 ` [PATCH 11/12] arm64: dts: ti: k3-j721s2: " Andrew Davis
2024-01-31 22:19 ` [PATCH 12/12] arm64: dts: ti: k3-j784s4: " Andrew Davis
2024-02-01 21:14 ` [PATCH 00/12] Add TI-SCI reboot driver Nishanth Menon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).