[PATCH] ptp: clockmatrix: Add Defer probe if firmware load fails

From: Sarath Babu Naidu Gaddam
Date: Mon Jun 12 2023 - 06:23:51 EST


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@xxxxxxx>
---
drivers/ptp/ptp_clockmatrix.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c
index c9d451bf89e2..96328dfb7e55 100644
--- a/drivers/ptp/ptp_clockmatrix.c
+++ b/drivers/ptp/ptp_clockmatrix.c
@@ -2424,9 +2424,13 @@ static int idtcm_probe(struct platform_device *pdev)

err = idtcm_load_firmware(idtcm, &pdev->dev);

- if (err)
+ if (err) {
dev_warn(idtcm->dev, "loading firmware failed with %d", err);

+ if (err == -ENOENT)
+ return -EPROBE_DEFER;
+ }
+
wait_for_chip_ready(idtcm);

if (idtcm->tod_mask) {
--
2.25.1