* [PATCH 1/4] firmware: ti_sci: Use devm_register_restart_handler()
2024-03-26 22:37 [PATCH 0/4] Unconditionally register TI-SCI reset handler Andrew Davis
@ 2024-03-26 22:37 ` Andrew Davis
2024-04-02 8:14 ` Markus Schneider-Pargmann
2024-03-26 22:37 ` [PATCH 2/4] firmware: ti_sci: Unconditionally register reset handler Andrew Davis
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Andrew Davis @ 2024-03-26 22:37 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Santosh Shilimkar,
Nishanth Menon, Vignesh Raghavendra
Cc: devicetree, linux-arm-kernel, linux-kernel, Andrew Davis
Use device life-cycle managed register function to simplify probe.
Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Gabriel Somlo <gsomlo@gmail.com>
---
drivers/firmware/ti_sci.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 8b9a2556de16d..9885e1763591b 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -87,7 +87,6 @@ struct ti_sci_desc {
* struct ti_sci_info - Structure representing a TI SCI instance
* @dev: Device pointer
* @desc: SoC description for this instance
- * @nb: Reboot Notifier block
* @d: Debugfs file entry
* @debug_region: Memory region where the debug message are available
* @debug_region_size: Debug region size
@@ -103,7 +102,6 @@ struct ti_sci_desc {
*/
struct ti_sci_info {
struct device *dev;
- struct notifier_block nb;
const struct ti_sci_desc *desc;
struct dentry *d;
void __iomem *debug_region;
@@ -122,7 +120,6 @@ struct ti_sci_info {
#define cl_to_ti_sci_info(c) container_of(c, struct ti_sci_info, cl)
#define handle_to_ti_sci_info(h) container_of(h, struct ti_sci_info, handle)
-#define reboot_to_ti_sci_info(n) container_of(n, struct ti_sci_info, nb)
#ifdef CONFIG_DEBUG_FS
@@ -3254,10 +3251,9 @@ devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
}
EXPORT_SYMBOL_GPL(devm_ti_sci_get_resource);
-static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,
- void *cmd)
+static int tisci_reboot_handler(struct sys_off_data *data)
{
- struct ti_sci_info *info = reboot_to_ti_sci_info(nb);
+ struct ti_sci_info *info = data->cb_data;
const struct ti_sci_handle *handle = &info->handle;
ti_sci_cmd_core_reboot(handle);
@@ -3400,10 +3396,9 @@ static int ti_sci_probe(struct platform_device *pdev)
ti_sci_setup_ops(info);
if (reboot) {
- info->nb.notifier_call = tisci_reboot_handler;
- info->nb.priority = 128;
-
- ret = register_restart_handler(&info->nb);
+ ret = devm_register_restart_handler(dev,
+ tisci_reboot_handler,
+ info);
if (ret) {
dev_err(dev, "reboot registration fail(%d)\n", ret);
goto out;
--
2.39.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 1/4] firmware: ti_sci: Use devm_register_restart_handler()
2024-03-26 22:37 ` [PATCH 1/4] firmware: ti_sci: Use devm_register_restart_handler() Andrew Davis
@ 2024-04-02 8:14 ` Markus Schneider-Pargmann
0 siblings, 0 replies; 9+ messages in thread
From: Markus Schneider-Pargmann @ 2024-04-02 8:14 UTC (permalink / raw)
To: Andrew Davis
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Santosh Shilimkar,
Nishanth Menon, Vignesh Raghavendra, devicetree, linux-arm-kernel,
linux-kernel
On Tue, Mar 26, 2024 at 05:37:27PM -0500, Andrew Davis wrote:
> Use device life-cycle managed register function to simplify probe.
>
> Signed-off-by: Andrew Davis <afd@ti.com>
> Reviewed-by: Gabriel Somlo <gsomlo@gmail.com>
Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>
Best
Markus
> ---
> drivers/firmware/ti_sci.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> index 8b9a2556de16d..9885e1763591b 100644
> --- a/drivers/firmware/ti_sci.c
> +++ b/drivers/firmware/ti_sci.c
> @@ -87,7 +87,6 @@ struct ti_sci_desc {
> * struct ti_sci_info - Structure representing a TI SCI instance
> * @dev: Device pointer
> * @desc: SoC description for this instance
> - * @nb: Reboot Notifier block
> * @d: Debugfs file entry
> * @debug_region: Memory region where the debug message are available
> * @debug_region_size: Debug region size
> @@ -103,7 +102,6 @@ struct ti_sci_desc {
> */
> struct ti_sci_info {
> struct device *dev;
> - struct notifier_block nb;
> const struct ti_sci_desc *desc;
> struct dentry *d;
> void __iomem *debug_region;
> @@ -122,7 +120,6 @@ struct ti_sci_info {
>
> #define cl_to_ti_sci_info(c) container_of(c, struct ti_sci_info, cl)
> #define handle_to_ti_sci_info(h) container_of(h, struct ti_sci_info, handle)
> -#define reboot_to_ti_sci_info(n) container_of(n, struct ti_sci_info, nb)
>
> #ifdef CONFIG_DEBUG_FS
>
> @@ -3254,10 +3251,9 @@ devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
> }
> EXPORT_SYMBOL_GPL(devm_ti_sci_get_resource);
>
> -static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,
> - void *cmd)
> +static int tisci_reboot_handler(struct sys_off_data *data)
> {
> - struct ti_sci_info *info = reboot_to_ti_sci_info(nb);
> + struct ti_sci_info *info = data->cb_data;
> const struct ti_sci_handle *handle = &info->handle;
>
> ti_sci_cmd_core_reboot(handle);
> @@ -3400,10 +3396,9 @@ static int ti_sci_probe(struct platform_device *pdev)
> ti_sci_setup_ops(info);
>
> if (reboot) {
> - info->nb.notifier_call = tisci_reboot_handler;
> - info->nb.priority = 128;
> -
> - ret = register_restart_handler(&info->nb);
> + ret = devm_register_restart_handler(dev,
> + tisci_reboot_handler,
> + info);
> if (ret) {
> dev_err(dev, "reboot registration fail(%d)\n", ret);
> goto out;
> --
> 2.39.2
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/4] firmware: ti_sci: Unconditionally register reset handler
2024-03-26 22:37 [PATCH 0/4] Unconditionally register TI-SCI reset handler Andrew Davis
2024-03-26 22:37 ` [PATCH 1/4] firmware: ti_sci: Use devm_register_restart_handler() Andrew Davis
@ 2024-03-26 22:37 ` Andrew Davis
2024-04-02 8:19 ` Markus Schneider-Pargmann
2024-03-26 22:37 ` [PATCH 3/4] ARM: dts: ti: keystone: k2g: Remove ti,system-reboot-controller property Andrew Davis
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Andrew Davis @ 2024-03-26 22:37 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Santosh Shilimkar,
Nishanth Menon, Vignesh Raghavendra
Cc: devicetree, linux-arm-kernel, linux-kernel, Andrew Davis
There was once a limitation that there could only be one system
reset handler. Due to that we only would register this handler
when a non-standard device tree property was found, else we left
the default handler in place (usually PSCI). Now that we can
have multiple handlers, and TI-SCI reset is always available
in the firmware, register this handler unconditionally.
This priority is left at the default so higher priority handlers
(like PSCI) are still attempted first.
Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/firmware/ti_sci.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 9885e1763591b..160968301b1fb 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -3299,7 +3299,6 @@ static int ti_sci_probe(struct platform_device *pdev)
struct mbox_client *cl;
int ret = -EINVAL;
int i;
- int reboot = 0;
u32 h_id;
desc = device_get_match_data(dev);
@@ -3323,8 +3322,6 @@ static int ti_sci_probe(struct platform_device *pdev)
}
}
- reboot = of_property_read_bool(dev->of_node,
- "ti,system-reboot-controller");
INIT_LIST_HEAD(&info->node);
minfo = &info->minfo;
@@ -3395,14 +3392,10 @@ static int ti_sci_probe(struct platform_device *pdev)
ti_sci_setup_ops(info);
- if (reboot) {
- ret = devm_register_restart_handler(dev,
- tisci_reboot_handler,
- info);
- if (ret) {
- dev_err(dev, "reboot registration fail(%d)\n", ret);
- goto out;
- }
+ ret = devm_register_restart_handler(dev, tisci_reboot_handler, info);
+ if (ret) {
+ dev_err(dev, "reboot registration fail(%d)\n", ret);
+ goto out;
}
dev_info(dev, "ABI: %d.%d (firmware rev 0x%04x '%s')\n",
--
2.39.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 2/4] firmware: ti_sci: Unconditionally register reset handler
2024-03-26 22:37 ` [PATCH 2/4] firmware: ti_sci: Unconditionally register reset handler Andrew Davis
@ 2024-04-02 8:19 ` Markus Schneider-Pargmann
0 siblings, 0 replies; 9+ messages in thread
From: Markus Schneider-Pargmann @ 2024-04-02 8:19 UTC (permalink / raw)
To: Andrew Davis
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Santosh Shilimkar,
Nishanth Menon, Vignesh Raghavendra, devicetree, linux-arm-kernel,
linux-kernel
On Tue, Mar 26, 2024 at 05:37:28PM -0500, Andrew Davis wrote:
> There was once a limitation that there could only be one system
> reset handler. Due to that we only would register this handler
> when a non-standard device tree property was found, else we left
> the default handler in place (usually PSCI). Now that we can
> have multiple handlers, and TI-SCI reset is always available
> in the firmware, register this handler unconditionally.
>
> This priority is left at the default so higher priority handlers
> (like PSCI) are still attempted first.
>
> Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>
Best
Markus
> ---
> drivers/firmware/ti_sci.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> index 9885e1763591b..160968301b1fb 100644
> --- a/drivers/firmware/ti_sci.c
> +++ b/drivers/firmware/ti_sci.c
> @@ -3299,7 +3299,6 @@ static int ti_sci_probe(struct platform_device *pdev)
> struct mbox_client *cl;
> int ret = -EINVAL;
> int i;
> - int reboot = 0;
> u32 h_id;
>
> desc = device_get_match_data(dev);
> @@ -3323,8 +3322,6 @@ static int ti_sci_probe(struct platform_device *pdev)
> }
> }
>
> - reboot = of_property_read_bool(dev->of_node,
> - "ti,system-reboot-controller");
> INIT_LIST_HEAD(&info->node);
> minfo = &info->minfo;
>
> @@ -3395,14 +3392,10 @@ static int ti_sci_probe(struct platform_device *pdev)
>
> ti_sci_setup_ops(info);
>
> - if (reboot) {
> - ret = devm_register_restart_handler(dev,
> - tisci_reboot_handler,
> - info);
> - if (ret) {
> - dev_err(dev, "reboot registration fail(%d)\n", ret);
> - goto out;
> - }
> + ret = devm_register_restart_handler(dev, tisci_reboot_handler, info);
> + if (ret) {
> + dev_err(dev, "reboot registration fail(%d)\n", ret);
> + goto out;
> }
>
> dev_info(dev, "ABI: %d.%d (firmware rev 0x%04x '%s')\n",
> --
> 2.39.2
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/4] ARM: dts: ti: keystone: k2g: Remove ti,system-reboot-controller property
2024-03-26 22:37 [PATCH 0/4] Unconditionally register TI-SCI reset handler Andrew Davis
2024-03-26 22:37 ` [PATCH 1/4] firmware: ti_sci: Use devm_register_restart_handler() Andrew Davis
2024-03-26 22:37 ` [PATCH 2/4] firmware: ti_sci: Unconditionally register reset handler Andrew Davis
@ 2024-03-26 22:37 ` Andrew Davis
2024-03-26 22:37 ` [PATCH 4/4] dt-bindings: arm: keystone: " Andrew Davis
2024-04-09 19:53 ` [PATCH 0/4] Unconditionally register TI-SCI reset handler Nishanth Menon
4 siblings, 0 replies; 9+ messages in thread
From: Andrew Davis @ 2024-03-26 22:37 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Santosh Shilimkar,
Nishanth Menon, Vignesh Raghavendra
Cc: devicetree, linux-arm-kernel, linux-kernel, Andrew Davis
The property ti,system-reboot-controller is no longer needed as the reboot
handler is now always registered. Remove this property.
While here remove the comment about delete-property, all K2G platforms use
PMMC, and it wasn't good advice anyway.
Signed-off-by: Andrew Davis <afd@ti.com>
---
arch/arm/boot/dts/ti/keystone/keystone-k2g.dtsi | 5 -----
1 file changed, 5 deletions(-)
diff --git a/arch/arm/boot/dts/ti/keystone/keystone-k2g.dtsi b/arch/arm/boot/dts/ti/keystone/keystone-k2g.dtsi
index 790b29ab0fa2c..dafe485dfe197 100644
--- a/arch/arm/boot/dts/ti/keystone/keystone-k2g.dtsi
+++ b/arch/arm/boot/dts/ti/keystone/keystone-k2g.dtsi
@@ -256,11 +256,6 @@ msgmgr: mailbox@2a00000 {
pmmc: system-controller@2921c00 {
compatible = "ti,k2g-sci";
- /*
- * In case of rare platforms that does not use k2g as
- * system master, use /delete-property/
- */
- ti,system-reboot-controller;
mbox-names = "rx", "tx";
mboxes = <&msgmgr 5 2>,
<&msgmgr 0 0>;
--
2.39.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 4/4] dt-bindings: arm: keystone: Remove ti,system-reboot-controller property
2024-03-26 22:37 [PATCH 0/4] Unconditionally register TI-SCI reset handler Andrew Davis
` (2 preceding siblings ...)
2024-03-26 22:37 ` [PATCH 3/4] ARM: dts: ti: keystone: k2g: Remove ti,system-reboot-controller property Andrew Davis
@ 2024-03-26 22:37 ` Andrew Davis
2024-03-27 8:08 ` Krzysztof Kozlowski
2024-04-09 19:53 ` [PATCH 0/4] Unconditionally register TI-SCI reset handler Nishanth Menon
4 siblings, 1 reply; 9+ messages in thread
From: Andrew Davis @ 2024-03-26 22:37 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Santosh Shilimkar,
Nishanth Menon, Vignesh Raghavendra
Cc: devicetree, linux-arm-kernel, linux-kernel, Andrew Davis
This property was only ever used in one device. It is no longer needed as
what it signaled is now default. Remove this unneeded/unused property.
Signed-off-by: Andrew Davis <afd@ti.com>
---
Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml | 5 -----
1 file changed, 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
index c24ad0968f3ef..7f06b10802449 100644
--- a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
+++ b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
@@ -61,10 +61,6 @@ properties:
mboxes:
minItems: 2
- ti,system-reboot-controller:
- description: Determines If system reboot can be triggered by SoC reboot
- type: boolean
-
ti,host-id:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
@@ -94,7 +90,6 @@ examples:
- |
pmmc: system-controller@2921800 {
compatible = "ti,k2g-sci";
- ti,system-reboot-controller;
mbox-names = "rx", "tx";
mboxes = <&msgmgr 5 2>,
<&msgmgr 0 0>;
--
2.39.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 4/4] dt-bindings: arm: keystone: Remove ti,system-reboot-controller property
2024-03-26 22:37 ` [PATCH 4/4] dt-bindings: arm: keystone: " Andrew Davis
@ 2024-03-27 8:08 ` Krzysztof Kozlowski
0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-03-27 8:08 UTC (permalink / raw)
To: Andrew Davis, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Santosh Shilimkar, Nishanth Menon, Vignesh Raghavendra
Cc: devicetree, linux-arm-kernel, linux-kernel
On 26/03/2024 23:37, Andrew Davis wrote:
> This property was only ever used in one device. It is no longer needed as
> what it signaled is now default. Remove this unneeded/unused property.
>
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
> Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml | 5 -----
> 1 file changed, 5 deletions(-)
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] Unconditionally register TI-SCI reset handler
2024-03-26 22:37 [PATCH 0/4] Unconditionally register TI-SCI reset handler Andrew Davis
` (3 preceding siblings ...)
2024-03-26 22:37 ` [PATCH 4/4] dt-bindings: arm: keystone: " Andrew Davis
@ 2024-04-09 19:53 ` Nishanth Menon
4 siblings, 0 replies; 9+ messages in thread
From: Nishanth Menon @ 2024-04-09 19:53 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Santosh Shilimkar,
Vignesh Raghavendra, Andrew Davis
Cc: Nishanth Menon, devicetree, linux-arm-kernel, linux-kernel
Hi Andrew Davis,
On Tue, 26 Mar 2024 17:37:26 -0500, Andrew Davis wrote:
> This series is the replacement for this series[0] and is based on a
> comment in that series by Rob here[1].
>
> First patch is just a fixup, second patch is the core of the series.
>
> Thanks,
> Andrew
>
> [...]
I have applied the following to branch ti-drivers-soc-next on [1].
Thank you!
[1/4] firmware: ti_sci: Use devm_register_restart_handler()
commit: c0e5a431442d7bbfbd3704212680e49faa8ee46c
[2/4] firmware: ti_sci: Unconditionally register reset handler
commit: 8c8ff39838e02b6df91b80e086426dcb9ac86908
and the following to branch ti-keystone-dts-next on [1].
[3/4] ARM: dts: ti: keystone: k2g: Remove ti,system-reboot-controller property
commit: 345d22f4f45369a33b416a96c92bc273e41d695b
[4/4] dt-bindings: arm: keystone: Remove ti,system-reboot-controller property
commit: 60242b20fe784ef9142050be8b68bd85e94be557
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent up the chain during
the next merge window (or sooner if it is a relevant bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git
--
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread