* [PATCH net-next 0/3] dpll: zl3073x: add device reset via devlink reload
@ 2026-12-03 18:06 Ivan Vecera
2026-12-03 18:06 ` [PATCH net-next 1/3] dpll: zl3073x: factor device CPU reset into a helper Ivan Vecera
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Ivan Vecera @ 2026-12-03 18:06 UTC (permalink / raw)
To: netdev
Cc: Jiri Pirko, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Jonathan Corbet, Shuah Khan,
Randy Dunlap, Min Li, Vadim Fedorenko, Arkadiusz Kubalewski,
linux-doc
The ZL3073x chips can reboot the firmware and reload the whole
configuration from flash. This series exposes this full device reset
through the devlink 'fw_activate' reload action. As the reset affects
the whole chip, devlink is used rather than the per-DPLL netlink
interface.
Patch 1 factors the HW register sequence used by
zl3073x_flash_mode_leave() to reset the device CPU into a reusable
helper. Patch 2 makes the driver fetch the device state on every start,
as a reset changes it. Patch 3 adds the 'fw_activate' reload action and
documents the supported reload actions.
Ivan Vecera (3):
dpll: zl3073x: factor device CPU reset into a helper
dpll: zl3073x: always fetch device state on start
dpll: zl3073x: add device reset via devlink reload
Documentation/networking/devlink/zl3073x.rst | 25 ++++++
drivers/dpll/zl3073x/core.c | 91 +++++++++++++++-----
drivers/dpll/zl3073x/core.h | 8 +-
drivers/dpll/zl3073x/devlink.c | 81 ++++++++++++-----
drivers/dpll/zl3073x/flash.c | 79 ++++-------------
5 files changed, 172 insertions(+), 112 deletions(-)
base-commit: fe4597b13a535ebf999053d2ed9993ec534be192
--
2.56.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 1/3] dpll: zl3073x: factor device CPU reset into a helper
2026-12-03 18:06 [PATCH net-next 0/3] dpll: zl3073x: add device reset via devlink reload Ivan Vecera
@ 2026-12-03 18:06 ` Ivan Vecera
2026-12-03 18:06 ` [PATCH net-next 2/3] dpll: zl3073x: always fetch device state on start Ivan Vecera
2026-12-03 18:06 ` [PATCH net-next 3/3] dpll: zl3073x: add device reset via devlink reload Ivan Vecera
2 siblings, 0 replies; 6+ messages in thread
From: Ivan Vecera @ 2026-12-03 18:06 UTC (permalink / raw)
To: netdev
Cc: Jiri Pirko, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Jonathan Corbet, Shuah Khan,
Randy Dunlap, Min Li, Vadim Fedorenko, Arkadiusz Kubalewski,
linux-doc
zl3073x_flash_mode_leave() resets the device CPU back to normal
firmware processing via an open-coded HW register write sequence in
flash.c. The same core reset is needed for a full device reset that
reboots the firmware and reloads the configuration from flash,
introduced later in this series. Factor it into a reusable helper,
zl3073x_dev_hw_reset(), in core.c.
Drop the 'wait' field from struct zl3073x_hwreg_seq_item and the
HWREG_SEQ_ITEM() macro. zl3073x_write_hwreg_seq() tested seq->wait
instead of seq[i].wait, so only the first item of a sequence was
considered and, as that is zero in all the sequences, the 1000 ms
waits requested by the flash mode enter sequences never took place.
The flash update has worked without them, so drop them instead of
fixing the test. zl3073x_flash_mode_leave() waits after the core reset
with msleep() on its own, and that wait moves into the helper.
Reviewed-by: Min Li <min.li@microchip.com>
Tested-by: Min Li <min.li@microchip.com>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
drivers/dpll/zl3073x/core.c | 58 ++++++++++++++++++++++++--
drivers/dpll/zl3073x/core.h | 6 +--
drivers/dpll/zl3073x/flash.c | 79 ++++++++----------------------------
3 files changed, 74 insertions(+), 69 deletions(-)
diff --git a/drivers/dpll/zl3073x/core.c b/drivers/dpll/zl3073x/core.c
index 230df08e27cd19..27a55d810d5b05 100644
--- a/drivers/dpll/zl3073x/core.c
+++ b/drivers/dpll/zl3073x/core.c
@@ -497,14 +497,66 @@ int zl3073x_write_hwreg_seq(struct zl3073x_dev *zldev,
seq[i].value, seq[i].mask);
if (rc)
return rc;
-
- if (seq->wait)
- msleep(seq->wait);
}
return rc;
}
+/**
+ * zl3073x_dev_hw_reset - Reset the device CPU and reload firmware and config
+ * @zldev: zl3073x device pointer
+ *
+ * Triggers a core reset that reboots the firmware and reloads the whole
+ * configuration from flash. The device is inaccessible on the control bus
+ * while the reset is in progress.
+ *
+ * Context: Process context. The caller must stop normal operation with
+ * zl3073x_dev_stop() first.
+ *
+ * Return: 0 on success, <0 on error
+ */
+int zl3073x_dev_hw_reset(struct zl3073x_dev *zldev)
+{
+ static const struct zl3073x_hwreg_seq_item hw_seq[] = {
+ HWREG_SEQ_ITEM(0x80000404, 1, BIT(0)),
+ HWREG_SEQ_ITEM(0x80000410, 1, BIT(0)),
+ };
+ u8 reset_status;
+ int rc;
+
+ /* Read reset status register */
+ rc = zl3073x_read_u8(zldev, ZL_REG_RESET_STATUS, &reset_status);
+ if (rc)
+ return rc;
+
+ /* Arm the reset detection flag */
+ reset_status |= ZL_REG_RESET_STATUS_RESET;
+ rc = zl3073x_write_u8(zldev, ZL_REG_RESET_STATUS, reset_status);
+ if (rc)
+ return rc;
+
+ /* Trigger the core reset. The last write typically errors out as
+ * the device CPU resets mid-transaction, so its return value is
+ * not checked.
+ */
+ zl3073x_write_hwreg_seq(zldev, hw_seq, ARRAY_SIZE(hw_seq));
+
+ msleep(500);
+
+ /* Read again the reset status register */
+ rc = zl3073x_read_u8(zldev, ZL_REG_RESET_STATUS, &reset_status);
+ if (rc)
+ return rc;
+
+ /* Check the reset flag was cleared by the firmware */
+ if (reset_status & ZL_REG_RESET_STATUS_RESET) {
+ dev_err(zldev->dev, "Device reset not confirmed\n");
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int
zl3073x_dev_state_fetch(struct zl3073x_dev *zldev)
{
diff --git a/drivers/dpll/zl3073x/core.h b/drivers/dpll/zl3073x/core.h
index 67c10e2595118c..4d979543500c4e 100644
--- a/drivers/dpll/zl3073x/core.h
+++ b/drivers/dpll/zl3073x/core.h
@@ -125,21 +125,18 @@ int zl3073x_dev_phase_avg_factor_set(struct zl3073x_dev *zldev, u8 factor);
* @addr: HW register to be written
* @value: value to be written to HW register
* @mask: bitmask indicating bits to be updated
- * @wait: number of ms to wait after register write
*/
struct zl3073x_hwreg_seq_item {
u32 addr;
u32 value;
u32 mask;
- u32 wait;
};
-#define HWREG_SEQ_ITEM(_addr, _value, _mask, _wait) \
+#define HWREG_SEQ_ITEM(_addr, _value, _mask) \
{ \
.addr = _addr, \
.value = FIELD_PREP_CONST(_mask, _value), \
.mask = _mask, \
- .wait = _wait, \
}
int zl3073x_mb_op(struct zl3073x_dev *zldev, unsigned int op_reg, u8 op_val,
@@ -161,6 +158,7 @@ int zl3073x_update_hwreg(struct zl3073x_dev *zldev, u32 addr, u32 value,
int zl3073x_write_hwreg_seq(struct zl3073x_dev *zldev,
const struct zl3073x_hwreg_seq_item *seq,
size_t num_items);
+int zl3073x_dev_hw_reset(struct zl3073x_dev *zldev);
/*****************
* Misc operations
diff --git a/drivers/dpll/zl3073x/flash.c b/drivers/dpll/zl3073x/flash.c
index f85535c8ad2469..306e7c857b2313 100644
--- a/drivers/dpll/zl3073x/flash.c
+++ b/drivers/dpll/zl3073x/flash.c
@@ -529,22 +529,22 @@ int zl3073x_flash_mode_enter(struct zl3073x_dev *zldev, const void *util_ptr,
{
/* Sequence to be written prior utility download */
static const struct zl3073x_hwreg_seq_item pre_seq[] = {
- HWREG_SEQ_ITEM(0x80000400, 1, BIT(0), 0),
- HWREG_SEQ_ITEM(0x80206340, 1, BIT(4), 0),
- HWREG_SEQ_ITEM(0x10000000, 1, BIT(2), 0),
- HWREG_SEQ_ITEM(0x10000024, 0x00000001, U32_MAX, 0),
- HWREG_SEQ_ITEM(0x10000020, 0x00000001, U32_MAX, 0),
- HWREG_SEQ_ITEM(0x10000000, 1, BIT(10), 1000),
+ HWREG_SEQ_ITEM(0x80000400, 1, BIT(0)),
+ HWREG_SEQ_ITEM(0x80206340, 1, BIT(4)),
+ HWREG_SEQ_ITEM(0x10000000, 1, BIT(2)),
+ HWREG_SEQ_ITEM(0x10000024, 0x00000001, U32_MAX),
+ HWREG_SEQ_ITEM(0x10000020, 0x00000001, U32_MAX),
+ HWREG_SEQ_ITEM(0x10000000, 1, BIT(10)),
};
/* Sequence to be written after utility download */
static const struct zl3073x_hwreg_seq_item post_seq[] = {
- HWREG_SEQ_ITEM(0x10400004, 0x000000C0, U32_MAX, 0),
- HWREG_SEQ_ITEM(0x10400008, 0x00000000, U32_MAX, 0),
- HWREG_SEQ_ITEM(0x10400010, 0x20000000, U32_MAX, 0),
- HWREG_SEQ_ITEM(0x10400014, 0x20000004, U32_MAX, 0),
- HWREG_SEQ_ITEM(0x10000000, 1, GENMASK(10, 9), 0),
- HWREG_SEQ_ITEM(0x10000020, 0x00000000, U32_MAX, 0),
- HWREG_SEQ_ITEM(0x10000000, 0, BIT(0), 1000),
+ HWREG_SEQ_ITEM(0x10400004, 0x000000C0, U32_MAX),
+ HWREG_SEQ_ITEM(0x10400008, 0x00000000, U32_MAX),
+ HWREG_SEQ_ITEM(0x10400010, 0x20000000, U32_MAX),
+ HWREG_SEQ_ITEM(0x10400014, 0x20000004, U32_MAX),
+ HWREG_SEQ_ITEM(0x10000000, 1, GENMASK(10, 9)),
+ HWREG_SEQ_ITEM(0x10000020, 0x00000000, U32_MAX),
+ HWREG_SEQ_ITEM(0x10000000, 0, BIT(0)),
};
int rc;
@@ -604,62 +604,17 @@ int zl3073x_flash_mode_enter(struct zl3073x_dev *zldev, const void *util_ptr,
* @extack: netlink extack pointer to report errors
*
* The function instructs the device to leave the flash mode and
- * to return back to normal operation.
- *
- * The procedure:
- * 1) Set reset flag
- * 2) Reset the device CPU by specific HW register sequence
- * 3) Wait for the device to be ready
- * 4) Check the reset flag was cleared
+ * to return back to normal operation by resetting the device CPU
+ * with zl3073x_dev_hw_reset().
*
* Return: 0 on success, <0 on error
*/
int zl3073x_flash_mode_leave(struct zl3073x_dev *zldev,
struct netlink_ext_ack *extack)
{
- /* Sequence to be written after flash */
- static const struct zl3073x_hwreg_seq_item fw_reset_seq[] = {
- HWREG_SEQ_ITEM(0x80000404, 1, BIT(0), 0),
- HWREG_SEQ_ITEM(0x80000410, 1, BIT(0), 0),
- };
- u8 reset_status;
- int rc;
-
zl3073x_devlink_flash_notify(zldev, "Leaving flash mode", "utility",
0, 0);
- /* Read reset status register */
- rc = zl3073x_read_u8(zldev, ZL_REG_RESET_STATUS, &reset_status);
- if (rc)
- return rc;
-
- /* Set reset bit */
- reset_status |= ZL_REG_RESET_STATUS_RESET;
-
- /* Update reset status register */
- rc = zl3073x_write_u8(zldev, ZL_REG_RESET_STATUS, reset_status);
- if (rc)
- return rc;
-
- /* We do not check the return value here as the sequence resets
- * the device CPU and the last write always return an error.
- */
- zl3073x_write_hwreg_seq(zldev, fw_reset_seq, ARRAY_SIZE(fw_reset_seq));
-
- /* Wait for the device to be ready */
- msleep(500);
-
- /* Read again the reset status register */
- rc = zl3073x_read_u8(zldev, ZL_REG_RESET_STATUS, &reset_status);
- if (rc)
- return rc;
-
- /* Check the reset bit was cleared */
- if (reset_status & ZL_REG_RESET_STATUS_RESET) {
- dev_err(zldev->dev,
- "Reset not confirmed after switch to normal mode\n");
- return -EINVAL;
- }
-
- return 0;
+ /* Reset the device CPU to resume normal firmware processing */
+ return zl3073x_dev_hw_reset(zldev);
}
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/3] dpll: zl3073x: always fetch device state on start
2026-12-03 18:06 [PATCH net-next 0/3] dpll: zl3073x: add device reset via devlink reload Ivan Vecera
2026-12-03 18:06 ` [PATCH net-next 1/3] dpll: zl3073x: factor device CPU reset into a helper Ivan Vecera
@ 2026-12-03 18:06 ` Ivan Vecera
2026-12-04 18:55 ` netdev-bot+sashiko
2026-12-03 18:06 ` [PATCH net-next 3/3] dpll: zl3073x: add device reset via devlink reload Ivan Vecera
2 siblings, 1 reply; 6+ messages in thread
From: Ivan Vecera @ 2026-12-03 18:06 UTC (permalink / raw)
To: netdev
Cc: Jiri Pirko, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Jonathan Corbet, Shuah Khan,
Randy Dunlap, Min Li, Vadim Fedorenko, Arkadiusz Kubalewski,
linux-doc
zl3073x_dev_start() fetches the device state and sets up the phase
offset measurement block only when asked for a full start. Probe and
the devlink flash update ask for it, the devlink DRIVER_REINIT reload
does not, as a 'clock_id' change does not change the device state.
The devlink FW_ACTIVATE reload, added later in this series, resets the
device, which reloads the whole configuration from flash. If the
restart after the reset fails, a following DRIVER_REINIT reload would
register the DPLLs with cached state that predates the reset, and would
not set up the phase offset measurement block again. The device CPU
reset at the end of a flash update already allows the same.
Always fetch the device state and set up the phase offset measurement
block on start, and drop the 'full' parameter. A DRIVER_REINIT reload
is rare, so fetching the state again there costs little.
Reviewed-by: Min Li <min.li@microchip.com>
Tested-by: Min Li <min.li@microchip.com>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
drivers/dpll/zl3073x/core.c | 33 ++++++++++++++-------------------
drivers/dpll/zl3073x/core.h | 2 +-
drivers/dpll/zl3073x/devlink.c | 6 +++---
3 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/drivers/dpll/zl3073x/core.c b/drivers/dpll/zl3073x/core.c
index 27a55d810d5b05..5495d2c67848ac 100644
--- a/drivers/dpll/zl3073x/core.c
+++ b/drivers/dpll/zl3073x/core.c
@@ -860,16 +860,14 @@ zl3073x_dev_phase_meas_setup(struct zl3073x_dev *zldev)
/**
* zl3073x_dev_start - Start normal operation
* @zldev: zl3073x device pointer
- * @full: perform full initialization
*
- * The function starts normal operation, which means registering all DPLLs and
- * their pins, and starting monitoring. If full initialization is requested,
- * the function additionally initializes the phase offset measurement block and
- * fetches hardware-invariant parameters.
+ * The function starts normal operation, which means fetching the device
+ * state, initializing the phase offset measurement block, registering all
+ * DPLLs and their pins, and starting monitoring.
*
* Return: 0 on success, <0 on error
*/
-int zl3073x_dev_start(struct zl3073x_dev *zldev, bool full)
+int zl3073x_dev_start(struct zl3073x_dev *zldev)
{
struct zl3073x_dpll *zldpll;
u8 info;
@@ -895,19 +893,16 @@ int zl3073x_dev_start(struct zl3073x_dev *zldev, bool full)
return 0;
}
- if (full) {
- /* Fetch device state */
- rc = zl3073x_dev_state_fetch(zldev);
- if (rc)
- return rc;
+ /* Fetch device state */
+ rc = zl3073x_dev_state_fetch(zldev);
+ if (rc)
+ return rc;
- /* Setup phase offset measurement block */
- rc = zl3073x_dev_phase_meas_setup(zldev);
- if (rc) {
- dev_err(zldev->dev,
- "Failed to setup phase measurement\n");
- return rc;
- }
+ /* Setup phase offset measurement block */
+ rc = zl3073x_dev_phase_meas_setup(zldev);
+ if (rc) {
+ dev_err(zldev->dev, "Failed to setup phase measurement\n");
+ return rc;
}
/* Register all DPLLs */
@@ -1012,7 +1007,7 @@ zl3073x_devm_dpll_init(struct zl3073x_dev *zldev)
zldev->kworker = kworker;
/* Start normal operation */
- rc = zl3073x_dev_start(zldev, true);
+ rc = zl3073x_dev_start(zldev);
if (rc) {
dev_err_probe(zldev->dev, rc, "Failed to start device\n");
goto error;
diff --git a/drivers/dpll/zl3073x/core.h b/drivers/dpll/zl3073x/core.h
index 4d979543500c4e..728782e33332ba 100644
--- a/drivers/dpll/zl3073x/core.h
+++ b/drivers/dpll/zl3073x/core.h
@@ -106,7 +106,7 @@ extern const struct regmap_config zl3073x_regmap_config;
struct zl3073x_dev *zl3073x_devm_alloc(struct device *dev);
int zl3073x_dev_probe(struct zl3073x_dev *zldev);
-int zl3073x_dev_start(struct zl3073x_dev *zldev, bool full);
+int zl3073x_dev_start(struct zl3073x_dev *zldev);
void zl3073x_dev_stop(struct zl3073x_dev *zldev);
static inline u8 zl3073x_dev_phase_avg_factor_get(struct zl3073x_dev *zldev)
diff --git a/drivers/dpll/zl3073x/devlink.c b/drivers/dpll/zl3073x/devlink.c
index 218b08fd8a3065..10143ec81a1167 100644
--- a/drivers/dpll/zl3073x/devlink.c
+++ b/drivers/dpll/zl3073x/devlink.c
@@ -125,7 +125,7 @@ zl3073x_devlink_reload_up(struct devlink *devlink,
}
/* Restart normal operation */
- rc = zl3073x_dev_start(zldev, false);
+ rc = zl3073x_dev_start(zldev);
if (rc)
dev_warn(zldev->dev, "Failed to re-start normal operation\n");
@@ -180,7 +180,7 @@ zl3073x_devlink_flash_prepare(struct zl3073x_dev *zldev,
NULL, 0, 0);
/* Resume normal operation */
- zl3073x_dev_start(zldev, true);
+ zl3073x_dev_start(zldev);
return rc;
}
@@ -208,7 +208,7 @@ zl3073x_devlink_flash_finish(struct zl3073x_dev *zldev,
zl3073x_flash_mode_leave(zldev, extack);
/* Resume normal operation */
- rc = zl3073x_dev_start(zldev, true);
+ rc = zl3073x_dev_start(zldev);
if (rc)
zl3073x_devlink_flash_notify(zldev,
"Failed to start normal operation",
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 3/3] dpll: zl3073x: add device reset via devlink reload
2026-12-03 18:06 [PATCH net-next 0/3] dpll: zl3073x: add device reset via devlink reload Ivan Vecera
2026-12-03 18:06 ` [PATCH net-next 1/3] dpll: zl3073x: factor device CPU reset into a helper Ivan Vecera
2026-12-03 18:06 ` [PATCH net-next 2/3] dpll: zl3073x: always fetch device state on start Ivan Vecera
@ 2026-12-03 18:06 ` Ivan Vecera
2026-12-04 18:55 ` netdev-bot+sashiko
2 siblings, 1 reply; 6+ messages in thread
From: Ivan Vecera @ 2026-12-03 18:06 UTC (permalink / raw)
To: netdev
Cc: Jiri Pirko, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Jonathan Corbet, Shuah Khan,
Randy Dunlap, Min Li, Vadim Fedorenko, Arkadiusz Kubalewski,
linux-doc
The ZL3073x chips can perform a full device reset that reboots the
firmware and reloads the whole configuration from flash. Expose it
through the devlink 'fw_activate' reload action using the previously
added zl3073x_dev_hw_reset() helper.
reload_down() stops normal operation for both DRIVER_REINIT and
FW_ACTIVATE. reload_up() additionally resets the device for
FW_ACTIVATE before restarting normal operation. Normal operation is
always restarted on a best-effort basis even if the reset fails, so
the dpll device is not left unregistered, but the reset failure is
still propagated as the overall reload_up() error so devlink reports
a failed reload and does not claim FW_ACTIVATE was performed in
actions_performed.
The 'clock_id' devlink param update is only meaningful for
DRIVER_REINIT, since the devlink core only loads a new driverinit
param value ahead of that action; factor it into a helper and call it
only from that case.
reload_up() now also propagates the error from the restart step
instead of always returning success, so devlink correctly reports a
failed reload. A missing or corrupted configuration in flash is not
treated as a failure. As during probe, only the devlink interface is
kept so that a correct configuration can be flashed.
Document the supported reload actions in the driver's devlink
documentation. Also state there, as recommended by Microchip, that the
output clocks may glitch during a flash update or a device reset.
Reviewed-by: Min Li <min.li@microchip.com>
Tested-by: Min Li <min.li@microchip.com>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
Documentation/networking/devlink/zl3073x.rst | 25 +++++++
drivers/dpll/zl3073x/devlink.c | 77 ++++++++++++++------
2 files changed, 81 insertions(+), 21 deletions(-)
diff --git a/Documentation/networking/devlink/zl3073x.rst b/Documentation/networking/devlink/zl3073x.rst
index fc5a8dc272a774..a653b9e1fa9d61 100644
--- a/Documentation/networking/devlink/zl3073x.rst
+++ b/Documentation/networking/devlink/zl3073x.rst
@@ -62,4 +62,29 @@ During the flash procedure, the standard firmware interface is not available,
so the driver unregisters all DPLLs and associated pins, and re-registers them
once the flash procedure is complete.
+The output clocks may glitch during the flash procedure unless they are stopped
+and disabled before the flash utility is loaded and the power-up configuration
+stored in flash has them disabled. The driver does not stop or disable the
+output clocks itself.
+
The driver does not support any overwrite mask flags.
+
+Reload
+======
+
+The ``zl3073x`` driver supports the following ``devlink-reload`` actions:
+
+``driver_reinit``
+ Unregisters all DPLLs and associated pins and registers them again. A new
+ value of the ``clock_id`` parameter is applied by this action.
+
+``fw_activate``
+ Resets the device, which reboots the firmware and reloads the whole
+ configuration from flash, and registers all DPLLs and associated pins again.
+ A new value of the ``clock_id`` parameter is not applied by this action.
+ The output clocks may glitch during the reset unless they are stopped and
+ disabled before the reset and the power-up configuration stored in flash has
+ them disabled.
+
+If the configuration stored in flash is wrong or missing, the DPLLs stay
+unregistered and only the devlink interface remains available.
diff --git a/drivers/dpll/zl3073x/devlink.c b/drivers/dpll/zl3073x/devlink.c
index 10143ec81a1167..0ff93889acd503 100644
--- a/drivers/dpll/zl3073x/devlink.c
+++ b/drivers/dpll/zl3073x/devlink.c
@@ -89,29 +89,26 @@ zl3073x_devlink_reload_down(struct devlink *devlink, bool netns_change,
{
struct zl3073x_dev *zldev = devlink_priv(devlink);
- if (action != DEVLINK_RELOAD_ACTION_DRIVER_REINIT)
- return -EOPNOTSUPP;
+ switch (action) {
+ case DEVLINK_RELOAD_ACTION_DRIVER_REINIT:
+ case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
+ /* Stop normal operation */
+ zl3073x_dev_stop(zldev);
- /* Stop normal operation */
- zl3073x_dev_stop(zldev);
+ return 0;
- return 0;
+ default:
+ return -EOPNOTSUPP;
+ }
}
static int
-zl3073x_devlink_reload_up(struct devlink *devlink,
- enum devlink_reload_action action,
- enum devlink_reload_limit limit,
- u32 *actions_performed,
- struct netlink_ext_ack *extack)
+zl3073x_devlink_clock_id_update(struct zl3073x_dev *zldev)
{
- struct zl3073x_dev *zldev = devlink_priv(devlink);
+ struct devlink *devlink = priv_to_devlink(zldev);
union devlink_param_value val;
int rc;
- if (action != DEVLINK_RELOAD_ACTION_DRIVER_REINIT)
- return -EOPNOTSUPP;
-
rc = devl_param_driverinit_value_get(devlink,
DEVLINK_PARAM_GENERIC_ID_CLOCK_ID,
&val);
@@ -124,14 +121,51 @@ zl3073x_devlink_reload_up(struct devlink *devlink,
zldev->clock_id = val.vu64;
}
- /* Restart normal operation */
- rc = zl3073x_dev_start(zldev);
- if (rc)
- dev_warn(zldev->dev, "Failed to re-start normal operation\n");
+ return rc;
+}
- *actions_performed = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT);
+static int
+zl3073x_devlink_reload_up(struct devlink *devlink,
+ enum devlink_reload_action action,
+ enum devlink_reload_limit limit,
+ u32 *actions_performed,
+ struct netlink_ext_ack *extack)
+{
+ struct zl3073x_dev *zldev = devlink_priv(devlink);
+ int rc, restart_rc;
+
+ *actions_performed = 0;
+ switch (action) {
+ case DEVLINK_RELOAD_ACTION_DRIVER_REINIT:
+ rc = zl3073x_devlink_clock_id_update(zldev);
+ if (rc)
+ NL_SET_ERR_MSG_MOD(extack, "Failed to update clock_id");
+ break;
+ case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
+ /* Reset the device CPU to reboot the firmware and reload the
+ * configuration from flash. On failure, normal operation is
+ * still restarted below on a best-effort basis.
+ */
+ rc = zl3073x_dev_hw_reset(zldev);
+ if (rc) {
+ NL_SET_ERR_MSG_MOD(extack, "Hardware reset failed");
+ break;
+ }
+ *actions_performed |= BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE);
+ break;
+ default:
+ return -EOPNOTSUPP;
+ }
- return 0;
+ /* Restart normal operation */
+ restart_rc = zl3073x_dev_start(zldev);
+ if (restart_rc)
+ NL_SET_ERR_MSG_WEAK_MOD(extack,
+ "Failed to re-start normal operation");
+ else
+ *actions_performed |= BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT);
+
+ return rc ? : restart_rc;
}
void zl3073x_devlink_flash_notify(struct zl3073x_dev *zldev, const char *msg,
@@ -270,7 +304,8 @@ zl3073x_devlink_flash_update(struct devlink *devlink,
static const struct devlink_ops zl3073x_devlink_ops = {
.info_get = zl3073x_devlink_info_get,
- .reload_actions = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT),
+ .reload_actions = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) |
+ BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE),
.reload_down = zl3073x_devlink_reload_down,
.reload_up = zl3073x_devlink_reload_up,
.flash_update = zl3073x_devlink_flash_update,
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 2/3] dpll: zl3073x: always fetch device state on start
2026-12-03 18:06 ` [PATCH net-next 2/3] dpll: zl3073x: always fetch device state on start Ivan Vecera
@ 2026-12-04 18:55 ` netdev-bot+sashiko
0 siblings, 0 replies; 6+ messages in thread
From: netdev-bot+sashiko @ 2026-12-04 18:55 UTC (permalink / raw)
To: ivecera
Cc: netdev, jiri, davem, edumazet, kuba, pabeni, horms, corbet, skhan,
rdunlap, min.li, vadim.fedorenko, arkadiusz.kubalewski, linux-doc
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] Regression: a devlink DRIVER_REINIT reload now throws away the
cached NCO frequency offset (chan->df_offset) of any DPLL channel the…
- [Low] The commit message admits an existing defect ('The device CPU
reset at the end of a flash update already allows the same.') and this…
--
dpll: zl3073x: always fetch device state on start
This commit removes the 'full' parameter from zl3073x_dev_start(). The
function now always fetches the device state and sets up the phase offset
measurement block. The devlink DRIVER_REINIT reload, which used to skip
both steps, now goes through them as well.
> The devlink FW_ACTIVATE reload, added later in this series, resets the
> device, which reloads the whole configuration from flash. If the
> restart after the reset fails, a following DRIVER_REINIT reload would
> register the DPLLs with cached state that predates the reset, and would
> not set up the phase offset measurement block again. The device CPU
> reset at the end of a flash update already allows the same.
[Severity: Low]
This describes an existing problem in the flash update path, and this patch
fixes it. Should the patch carry a Fixes: tag for that?
Before this patch, zl3073x_devlink_flash_finish() reset the device CPU
through zl3073x_flash_mode_leave() and then called
zl3073x_dev_start(zldev, true). If that start failed partway through
zl3073x_dev_state_fetch(), or returned early because the ready bit was not
yet set, a later DRIVER_REINIT reload called zl3073x_dev_start(zldev,
false). That path skipped both the state fetch and
zl3073x_dev_phase_meas_setup().
The patch is presented only as preparation for FW_ACTIVATE. Without a
Fixes: tag, it probably won't be picked up for stable trees.
> diff --git a/drivers/dpll/zl3073x/core.c b/drivers/dpll/zl3073x/core.c
> index 27a55d810d5b0..5495d2c67848a 100644
> --- a/drivers/dpll/zl3073x/core.c
> +++ b/drivers/dpll/zl3073x/core.c
[ ... ]
> @@ -895,19 +893,16 @@ int zl3073x_dev_start(struct zl3073x_dev *zldev, bool full)
> return 0;
> }
>
> - if (full) {
> - /* Fetch device state */
> - rc = zl3073x_dev_state_fetch(zldev);
> - if (rc)
> - return rc;
> + /* Fetch device state */
> + rc = zl3073x_dev_state_fetch(zldev);
> + if (rc)
> + return rc;
[Severity: Medium]
Does this lose the cached NCO frequency offset on a DRIVER_REINIT reload?
Before this patch, zl3073x_devlink_reload_up() called
zl3073x_dev_start(zldev, false), so zldev->chan[].df_offset was kept
across the reload. Now the path is:
zl3073x_devlink_reload_up()
zl3073x_dev_start()
zl3073x_dev_state_fetch()
zl3073x_chan_state_fetch()
and zl3073x_chan_state_fetch() does this unconditionally:
drivers/dpll/zl3073x/chan.c:zl3073x_chan_state_fetch() {
...
/* If firmware left the channel in NCO mode, mark df_offset as
* unknown - we cannot know whether the preconditions for a valid
* nco_auto_read capture were met.
*/
if (zl3073x_chan_mode_is_nco(chan))
chan->df_offset = ZL_DPLL_DF_OFFSET_UNKNOWN;
...
}
On DRIVER_REINIT nothing resets the hardware. reload_down only runs
zl3073x_dev_stop(). If the driver itself put the channel into NCO mode,
the channel stays in NCO mode with a known offset. That offset came from
zl3073x_chan_nco_mode_set() or from adjfine.
zl3073x_chan_state_update() keeps df_offset in NCO mode on purpose.
After the reload, the cached value is ZL_DPLL_DF_OFFSET_UNKNOWN, and
zl3073x_dpll_nco_pin_ffo_get() returns -ENODATA:
df_offset = zl3073x_chan_df_offset_get(chan);
if (df_offset == ZL_DPLL_DF_OFFSET_UNKNOWN)
return -ENODATA;
This lasts until user space calls adjfine again or leaves and re-enters
NCO mode. Re-entering means going through FREERUN, and
zl3073x_chan_nco_mode_set() from FREERUN also marks the offset unknown.
The commit message says "A DRIVER_REINIT reload is rare, so fetching the
state again there costs little", but it doesn't mention this lost state.
Should df_offset be preserved across a DRIVER_REINIT reload, or should the
NCO check in zl3073x_chan_state_fetch() apply only when the firmware set
NCO mode?
The code is the same at the end of the series: "dpll: zl3073x: add device
reset via devlink reload" calls zl3073x_dev_start() unconditionally from
reload_up for both actions and doesn't change chan.c.
>
> - /* Setup phase offset measurement block */
> - rc = zl3073x_dev_phase_meas_setup(zldev);
> - if (rc) {
> - dev_err(zldev->dev,
> - "Failed to setup phase measurement\n");
> - return rc;
> - }
> + /* Setup phase offset measurement block */
> + rc = zl3073x_dev_phase_meas_setup(zldev);
> + if (rc) {
> + dev_err(zldev->dev, "Failed to setup phase measurement\n");
> + return rc;
> }
[ ... ]
> diff --git a/drivers/dpll/zl3073x/devlink.c b/drivers/dpll/zl3073x/devlink.c
> index 218b08fd8a306..10143ec81a116 100644
> --- a/drivers/dpll/zl3073x/devlink.c
> +++ b/drivers/dpll/zl3073x/devlink.c
> @@ -125,7 +125,7 @@ zl3073x_devlink_reload_up(struct devlink *devlink,
> }
>
> /* Restart normal operation */
> - rc = zl3073x_dev_start(zldev, false);
> + rc = zl3073x_dev_start(zldev);
> if (rc)
> dev_warn(zldev->dev, "Failed to re-start normal operation\n");
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203180627.215256-1-ivecera%40redhat.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 3/3] dpll: zl3073x: add device reset via devlink reload
2026-12-03 18:06 ` [PATCH net-next 3/3] dpll: zl3073x: add device reset via devlink reload Ivan Vecera
@ 2026-12-04 18:55 ` netdev-bot+sashiko
0 siblings, 0 replies; 6+ messages in thread
From: netdev-bot+sashiko @ 2026-12-04 18:55 UTC (permalink / raw)
To: ivecera
Cc: netdev, jiri, davem, edumazet, kuba, pabeni, horms, corbet, skhan,
rdunlap, min.li, vadim.fedorenko, arkadiusz.kubalewski, linux-doc
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The new FW_ACTIVATE path in zl3073x_devlink_reload_up() resets
the device CPU with zl3073x_dev_hw_reset() and then calls…
- [Low] The patch also fixes a bug in the existing DRIVER_REINIT reload,
but it does this inside a feature commit and gives no Fixes: tag.
--
dpll: zl3073x: add device reset via devlink reload
This commit adds the devlink fw_activate reload action. The action resets
the device so the firmware reboots and reloads its configuration from
flash. The patch also moves the clock_id update into a helper that only
driver_reinit uses, and makes reload_up() return the error from
zl3073x_dev_start().
> diff --git a/drivers/dpll/zl3073x/devlink.c b/drivers/dpll/zl3073x/devlink.c
> index 10143ec81a116..0ff93889acd50 100644
> --- a/drivers/dpll/zl3073x/devlink.c
> +++ b/drivers/dpll/zl3073x/devlink.c
[ ... ]
> @@ -124,14 +121,51 @@ zl3073x_devlink_reload_up(struct devlink *devlink,
> zldev->clock_id = val.vu64;
> }
>
> - /* Restart normal operation */
> - rc = zl3073x_dev_start(zldev);
> - if (rc)
> - dev_warn(zldev->dev, "Failed to re-start normal operation\n");
> + return rc;
> +}
>
> - *actions_performed = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT);
> +static int
> +zl3073x_devlink_reload_up(struct devlink *devlink,
> + enum devlink_reload_action action,
> + enum devlink_reload_limit limit,
> + u32 *actions_performed,
> + struct netlink_ext_ack *extack)
> +{
> + struct zl3073x_dev *zldev = devlink_priv(devlink);
> + int rc, restart_rc;
> +
> + *actions_performed = 0;
> + switch (action) {
[ ... ]
> + case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
> + /* Reset the device CPU to reboot the firmware and reload the
> + * configuration from flash. On failure, normal operation is
> + * still restarted below on a best-effort basis.
> + */
> + rc = zl3073x_dev_hw_reset(zldev);
> + if (rc) {
> + NL_SET_ERR_MSG_MOD(extack, "Hardware reset failed");
> + break;
> + }
> + *actions_performed |= BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE);
> + break;
[Severity: Medium]
After the reset, does anything wait for the firmware to finish loading
its configuration from flash?
After the reset, zl3073x_dev_hw_reset() only sleeps for a fixed time and
then checks the reset flag once:
drivers/dpll/zl3073x/core.c:zl3073x_dev_hw_reset() {
...
msleep(500);
/* Read again the reset status register */
rc = zl3073x_read_u8(zldev, ZL_REG_RESET_STATUS, &reset_status);
...
if (reset_status & ZL_REG_RESET_STATUS_RESET) {
...
}
zl3073x_dev_start() then reads ZL_REG_INFO once. If the ready bit is
clear, it returns success:
drivers/dpll/zl3073x/core.c:zl3073x_dev_start() {
...
if (!FIELD_GET(ZL_INFO_READY, info)) {
...
dev_info(zldev->dev,
"FW not fully ready - missing or corrupted config\n");
return 0;
}
...
}
Suppose the firmware clears ZL_REG_RESET_STATUS_RESET before it sets
ZL_INFO_READY, or takes longer than 500ms to apply the configuration.
Wouldn't a device that is still booting then be treated as having a
missing configuration?
In that case reload_up() returns 0 with both FW_ACTIVATE and
DRIVER_REINIT set in actions_performed. devlink reports a successful
reload, but the DPLLs, pins and PTP clocks stay unregistered until
another reload is done.
Before this patch, this reset-then-start sequence only ran at the end of
a flash update. With this patch it can be triggered at any time with
"devlink dev reload ... action fw_activate".
Would a bounded poll of the reset flag and ZL_INFO_READY work better
here than the fixed delay?
> + default:
> + return -EOPNOTSUPP;
> + }
>
> - return 0;
> + /* Restart normal operation */
> + restart_rc = zl3073x_dev_start(zldev);
> + if (restart_rc)
> + NL_SET_ERR_MSG_WEAK_MOD(extack,
> + "Failed to re-start normal operation");
> + else
> + *actions_performed |= BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT);
> +
> + return rc ? : restart_rc;
[Severity: Low]
This isn't a bug, but this change also fixes existing driver_reinit
behaviour. Should that fix be a separate patch with a Fixes: tag?
Before this patch, reload_up() logged a zl3073x_dev_start() failure with
dev_warn(). It then set DRIVER_REINIT in actions_performed and returned
0. By that point reload_down() had already unregistered the DPLLs and
pins.
As a result, devlink_reload() cleared reload_failed and updated the
reload stats as if the reload had worked, while the DPLLs stayed
unregistered.
That behaviour came from:
ebb1031c5137 ("dpll: zl3073x: Refactor DPLL initialization")
2df8e64e01c1 ("dpll: Add basic Microchip ZL3073x support")
The new code returns the restart error and only sets the DRIVER_REINIT
bit when the restart succeeds. Because this is mixed in with the new
FW_ACTIVATE support and has no Fixes: tag, stable trees with the reload
code will keep reporting success for a failed reload.
The other side effect, where a clock_id lookup failure now falls through
to the restart, doesn't seem reachable in practice.
zl3073x_devlink_register() calls devl_param_driverinit_value_set() for
CLOCK_ID, so devl_param_driverinit_value_get() can't fail here.
> }
>
> void zl3073x_devlink_flash_notify(struct zl3073x_dev *zldev, const char *msg,
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203180627.215256-1-ivecera%40redhat.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-12-04 18:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 18:06 [PATCH net-next 0/3] dpll: zl3073x: add device reset via devlink reload Ivan Vecera
2026-12-03 18:06 ` [PATCH net-next 1/3] dpll: zl3073x: factor device CPU reset into a helper Ivan Vecera
2026-12-03 18:06 ` [PATCH net-next 2/3] dpll: zl3073x: always fetch device state on start Ivan Vecera
2026-12-04 18:55 ` netdev-bot+sashiko
2026-12-03 18:06 ` [PATCH net-next 3/3] dpll: zl3073x: add device reset via devlink reload Ivan Vecera
2026-12-04 18:55 ` netdev-bot+sashiko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox