From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796321218; b=m9WVunlcXtjbnZaiPR9muTxZiwxYxx78CKSIt5AwLA0hwSeBWEkkemaJAzcdjIUFcmkA WAvHWCsZqltqKSQzjXIYxu0bzROkitL3OxOmm2o+cK/YRyk7TDEvirbflR8+Jv77VnazD Ft+Xk8t/qNC7AYMtYXsTCdLc44M+hW/32RRTBZddjSVdhfq2QNWnIMtskyEmrffdpaKUl 5PlxH9NCS7YFRy3JTh9AnDHXB4yHZ38Z7Ct8/pTCm56vm7W5n3pxq9r1+spICQRv2zwxs 0BegX9gG8Kvi4CPBjmzP4YDoJBcWHC1WJQm9aZzDHSvtSB+WL9tvYT+k1cTKLxp0qiw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796321218; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:From:To:Cc:Subject:Date: Message-ID:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Scanned-By; bh=zyJ1dyc/AJgcUBVutrd7zYBDgd+ySKMI3L92PT7exSw=; b=5AF1lQN7chJEDikfmLlOCkybZqIv+oJSpxtcBT3qiHh/7coE86E3pUqseKoi9JULEXB5 fGjOs74/SsrmXwr0X36E2dxWTA6xE7Q2iN2Ef+qpdGrUVAmyIjan6d4YAtlMeLatTFMtF +V+rs2Msn60cr4nAcMjUq5oyxeu3ckV7G87S1TFF1HNNaejEqUv6vbxLmNP9TKkHif8pR 5TpEq+FAAdiSKxKcgrKKf5wZFQ2MYEhuaWjHaTMQPLlPTshB6qRMAyl7urMYg+TKtBoMm rhgkp3edY4PGAmFRGlb3C7wB3h9a8gpAqKH9Vb09Mmgup3avkDIkoLoojUuB3FhEehw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fwWjV5oh; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A0A5606A333 for ; Thu, 3 Dec 2026 18:06:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7A0A5606A333 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fwWjV5oh DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796321217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zyJ1dyc/AJgcUBVutrd7zYBDgd+ySKMI3L92PT7exSw=; b=fwWjV5ohlB4tLz5yFs4WC1lM4rZCa8t14hWZZCV7tUzy7iUF2y5tU9q/j8lguo2q4GJ0cs ADIBEH+pj4eDt+3sgF9ELgGo7XtL6oP8i3QeLnCqFpkHM6xRsZkMRMpbxgRxHOZlsm8vBF uqpgKP8TIaY6ZrYThzSjtwWo5mBA37Y= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-86-SNrVDbz8P5q6e-H8EYa5Vw-1; Thu, 3 Dec 2026 18:06:49 +0000 X-MC-Unique: SNrVDbz8P5q6e-H8EYa5Vw-1 X-Mimecast-MFC-AGG-ID: SNrVDbz8P5q6e-H8EYa5Vw_1796321207 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D4761188EED9; Thu, 3 Dec 2026 18:06:46 +0000 (UTC) Received: from ivecera-thinkpadp16vgen1.tpbc.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 324753002D13; Thu, 3 Dec 2026 18:06:42 +0000 (UTC) From: Ivan Vecera To: netdev@vger.kernel.org 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@vger.kernel.org Subject: [PATCH net-next 3/3] dpll: zl3073x: add device reset via devlink reload Date: Thu, 3 Dec 2026 19:06:27 +0100 Message-ID: <20261203180627.215256-4-ivecera@redhat.com> In-Reply-To: <20261203180627.215256-1-ivecera@redhat.com> References: <20261203180627.215256-1-ivecera@redhat.com> X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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 Tested-by: Min Li Signed-off-by: Ivan Vecera --- 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