[PATCH 2/4] firmware: ti_sci: Unconditionally register reset handler

Andrew Davis posted 4 patches 1 year, 10 months ago
[PATCH 2/4] firmware: ti_sci: Unconditionally register reset handler
Posted by Andrew Davis 1 year, 10 months ago
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
Re: [PATCH 2/4] firmware: ti_sci: Unconditionally register reset handler
Posted by Markus Schneider-Pargmann 1 year, 10 months ago
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
>