]> www.infradead.org Git - users/hch/misc.git/commitdiff
dpll: zl3073x: Handle missing or corrupted flash configuration
authorIvan Vecera <ivecera@redhat.com>
Wed, 8 Oct 2025 14:14:45 +0000 (16:14 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 14 Oct 2025 00:24:36 +0000 (17:24 -0700)
If the internal flash contains missing or corrupted configuration,
basic communication over the bus still functions, but the device
is not capable of normal operation (for example, using mailboxes).

This condition is indicated in the info register by the ready bit.
If this bit is cleared, the probe procedure times out while fetching
the device state.

Handle this case by checking the ready bit value in zl3073x_dev_start()
and skipping DPLL device and pin registration if it is cleared.
Do not report this condition as an error, allowing the devlink device
to be registered and enabling the user to flash the correct configuration.

Prior this patch:
[   31.112299] zl3073x-i2c 1-0070: Failed to fetch input state: -ETIMEDOUT
[   31.116332] zl3073x-i2c 1-0070: error -ETIMEDOUT: Failed to start device
[   31.136881] zl3073x-i2c 1-0070: probe with driver zl3073x-i2c failed with error -110

After this patch:
[   41.011438] zl3073x-i2c 1-0070: FW not fully ready - missing or corrupted config

Fixes: 75a71ecc24125 ("dpll: zl3073x: Register DPLL devices and pins")
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20251008141445.841113-1-ivecera@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/dpll/zl3073x/core.c
drivers/dpll/zl3073x/regs.h

index 092e7027948a45ec2d2bfd1a402af2bbfc9e850f..e42e527813cf8b3985c8a42cb9be15be4f9277af 100644 (file)
@@ -1038,8 +1038,29 @@ zl3073x_dev_phase_meas_setup(struct zl3073x_dev *zldev)
 int zl3073x_dev_start(struct zl3073x_dev *zldev, bool full)
 {
        struct zl3073x_dpll *zldpll;
+       u8 info;
        int rc;
 
+       rc = zl3073x_read_u8(zldev, ZL_REG_INFO, &info);
+       if (rc) {
+               dev_err(zldev->dev, "Failed to read device status info\n");
+               return rc;
+       }
+
+       if (!FIELD_GET(ZL_INFO_READY, info)) {
+               /* The ready bit indicates that the firmware was successfully
+                * configured and is ready for normal operation. If it is
+                * cleared then the configuration stored in flash is wrong
+                * or missing. In this situation the driver will expose
+                * only devlink interface to give an opportunity to flash
+                * the correct config.
+                */
+               dev_info(zldev->dev,
+                        "FW not fully ready - missing or corrupted config\n");
+
+               return 0;
+       }
+
        if (full) {
                /* Fetch device state */
                rc = zl3073x_dev_state_fetch(zldev);
index 19a25325bd9c74374ef2801759355f0ebd3d3df9..d837bee72b17806ddbdbcb85c4edcfb70d2fcb6f 100644 (file)
@@ -67,6 +67,9 @@
  * Register Page 0, General
  **************************/
 
+#define ZL_REG_INFO                            ZL_REG(0, 0x00, 1)
+#define ZL_INFO_READY                          BIT(7)
+
 #define ZL_REG_ID                              ZL_REG(0, 0x01, 2)
 #define ZL_REG_REVISION                                ZL_REG(0, 0x03, 2)
 #define ZL_REG_FW_VER                          ZL_REG(0, 0x05, 2)