Netdev List
 help / color / mirror / Atom feed
From: Ivan Vecera <ivecera@redhat.com>
To: netdev@vger.kernel.org
Cc: Jiri Pirko <jiri@resnulli.us>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Min Li <min.li@microchip.com>,
	Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>,
	linux-doc@vger.kernel.org
Subject: [PATCH net-next 2/3] dpll: zl3073x: always fetch device state on start
Date: Thu,  3 Dec 2026 19:06:26 +0100	[thread overview]
Message-ID: <20261203180627.215256-3-ivecera@redhat.com> (raw)
In-Reply-To: <20261203180627.215256-1-ivecera@redhat.com>

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


      parent reply	other threads:[~2026-12-03 18:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203180627.215256-3-ivecera@redhat.com \
    --to=ivecera@redhat.com \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=min.li@microchip.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --cc=vadim.fedorenko@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox