netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH V2] ptp: clockmatrix: Add Defer probe if firmware load fails
@ 2023-06-18  0:54 Vincent Cheng
  0 siblings, 0 replies; 3+ messages in thread
From: Vincent Cheng @ 2023-06-18  0:54 UTC (permalink / raw)
  To: Sarath Babu Naidu Gaddam, richardcochran, netdev
  Cc: simon.horman, andrew, linux-kernel, harini.katakam, git

On Sun, Jun 18, 2023 at 12:51:08AM +0000, Vincent Cheng wrote:
> 
> 
> -----Original Message-----
> From: Sarath Babu Naidu Gaddam <sarath.babu.naidu.gaddam@amd.com> 
> Sent: Wednesday, June 14, 2023 1:12 AM
> To: richardcochran@gmail.com; netdev@vger.kernel.org
> Cc: simon.horman@corigine.com; andrew@lunn.ch; linux-kernel@vger.kernel.org; Vincent Cheng <vincent.cheng.xh@renesas.com>; harini.katakam@amd.com; git@amd.com; sarath.babu.naidu.gaddam@amd.com
> Subject: [PATCH V2] ptp: clockmatrix: Add Defer probe if firmware load fails
> 
> Clock matrix driver can be probed before the rootfs containing firmware/initialization .bin is available. The current driver throws a warning and proceeds to execute probe even when firmware is not ready. Instead, defer probe and wait for the .bin file to be available.
> 
> Signed-off-by: Sarath Babu Naidu Gaddam <sarath.babu.naidu.gaddam@amd.com>

Reviewed-by: Vincent Cheng <vincent.cheng.xh@renesas.com>

> ---
> Changes in V2:
> 1) Added mutex_unlock(idtcm->lock); before returning EPROBE_DEFER.
> 2) Moved failure log after defer probe.
> ---
>  drivers/ptp/ptp_clockmatrix.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c index c9d451bf89e2..b3cb136257e3 100644
> --- a/drivers/ptp/ptp_clockmatrix.c
> +++ b/drivers/ptp/ptp_clockmatrix.c
> @@ -2424,8 +2424,13 @@ static int idtcm_probe(struct platform_device *pdev)
>  
>  	err = idtcm_load_firmware(idtcm, &pdev->dev);
>  
> -	if (err)
> +	if (err) {
> +		if (err == -ENOENT) {
> +			mutex_unlock(idtcm->lock);
> +			return -EPROBE_DEFER;
> +		}
>  		dev_warn(idtcm->dev, "loading firmware failed with %d", err);
> +	}
>  
>  	wait_for_chip_ready(idtcm);
>  
> --
> 2.25.1
> 

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

* Re: [PATCH V2] ptp: clockmatrix: Add Defer probe if firmware load fails
  2023-06-14  5:12 Sarath Babu Naidu Gaddam
@ 2023-06-15 20:05 ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2023-06-15 20:05 UTC (permalink / raw)
  To: Sarath Babu Naidu Gaddam
  Cc: richardcochran, netdev, simon.horman, andrew, linux-kernel,
	vincent.cheng.xh, harini.katakam, git

On Wed, 14 Jun 2023 10:42:04 +0530 Sarath Babu Naidu Gaddam wrote:
> Clock matrix driver can be probed before the rootfs containing
> firmware/initialization .bin is available. The current driver
> throws a warning and proceeds to execute probe even when firmware
> is not ready. Instead, defer probe and wait for the .bin file to
> be available.

The first-step fix should be to try to get the FW into initramfs.
For that driver should specify MODULE_FIRMWARE(), which I don't see
here.
-- 
pw-bot: cr

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

* [PATCH V2] ptp: clockmatrix: Add Defer probe if firmware load fails
@ 2023-06-14  5:12 Sarath Babu Naidu Gaddam
  2023-06-15 20:05 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Sarath Babu Naidu Gaddam @ 2023-06-14  5:12 UTC (permalink / raw)
  To: richardcochran, netdev
  Cc: simon.horman, andrew, linux-kernel, vincent.cheng.xh,
	harini.katakam, git, sarath.babu.naidu.gaddam

Clock matrix driver can be probed before the rootfs containing
firmware/initialization .bin is available. The current driver
throws a warning and proceeds to execute probe even when firmware
is not ready. Instead, defer probe and wait for the .bin file to
be available.

Signed-off-by: Sarath Babu Naidu Gaddam <sarath.babu.naidu.gaddam@amd.com>
---
Changes in V2:
1) Added mutex_unlock(idtcm->lock); before returning EPROBE_DEFER.
2) Moved failure log after defer probe.
---
 drivers/ptp/ptp_clockmatrix.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c
index c9d451bf89e2..b3cb136257e3 100644
--- a/drivers/ptp/ptp_clockmatrix.c
+++ b/drivers/ptp/ptp_clockmatrix.c
@@ -2424,8 +2424,13 @@ static int idtcm_probe(struct platform_device *pdev)
 
 	err = idtcm_load_firmware(idtcm, &pdev->dev);
 
-	if (err)
+	if (err) {
+		if (err == -ENOENT) {
+			mutex_unlock(idtcm->lock);
+			return -EPROBE_DEFER;
+		}
 		dev_warn(idtcm->dev, "loading firmware failed with %d", err);
+	}
 
 	wait_for_chip_ready(idtcm);
 
-- 
2.25.1


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

end of thread, other threads:[~2023-06-18  0:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-18  0:54 [PATCH V2] ptp: clockmatrix: Add Defer probe if firmware load fails Vincent Cheng
  -- strict thread matches above, loose matches on Subject: below --
2023-06-14  5:12 Sarath Babu Naidu Gaddam
2023-06-15 20:05 ` Jakub Kicinski

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).