From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796459970; b=JIduTwcArfZScIzSRktoQRvIP8BBUVRPLB43uua4lCqOBA7zVisgyhAg5f3l2+PWPNoO rsmV95AomkWn5N65Topw6BLGNgtSbClqWZl+LXAPAFusWSY2Dd6wr0ONRwFiaUOSGJa9A o5/5643RXknQgZm5wUM8QCtaUnA0NmH5mMxTF9ak1PAxIHQUmcxCMqGwAWHDDqmaT6qu1 wFuxLbv45laI9iWLtyyYB5A56GmiWvqaQ4Q03q5e8w2KF/hHQNB2RjZxPNXfHbrmMZTF3 rVc7dL9rGx+vf0gimGRqFzaQbq4tEozkhOyTJ4rmgNxSexOM/FUNdqBDJQXUvrEyqzw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796459970; 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=46aouEwaz6IibRdgQWiBcXKCKoNl3xbxq+uwRQL0cKE=; b=mQJ+NjuvBLM2fxCwv0Av6s9ZNmVg8W1WJNeek5gyaQuhTk7fJ3kXSJZlGGebGxTPlG9a 5gWMicrTnySHQ1mtttIH0P//aJ+n447OiMBvOOlrqcA+84ky3iyWv0lkJueHPWdQ6zEOo 5gXByYksGnpeBJNGss/hl3JOm8pOI/VY7i2fAvBR1jgsMnQ6DyqUTMSaAO2bkWXxM2wpn FCWQ+ns22rCfPduwfoD5CBifh8KC6VlnywIWgHWe7UAbq/AVyYgbgs2RDLkOelq6QuvuS qQ4iT8/1C45q92a/QWkFiXhlTYPyAntcVZZQZeucpMyispuW8ykhVAm3F0RlqZNvhtw== 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=PhQtrQrP; arc=none smtp.remote-ip=170.10.129.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 809AE606A32F for ; Sat, 5 Dec 2026 08:39:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 809AE606A32F 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=PhQtrQrP DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796459969; 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=46aouEwaz6IibRdgQWiBcXKCKoNl3xbxq+uwRQL0cKE=; b=PhQtrQrPQMpQxG5NZe/yDRqvzOSWlUt9AZZ0+GffY+NBsOUr9DiqxPW/mmaxOHOWNSELw4 JmaMKF0mVsLC1iNz6mSBCaYfHZQ5PNCwehpz3ODXpYCaJNjuuYd+K3AlOdA+zZcky3CXKi 3SSxzhVHMNhlszKNULrPgEFOO8xjl34= Received: from mx-prod-mc-06.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 with 8BITMIME (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-175-9h9W_sLyP3SI01gM2XXf5Q-1; Sat, 5 Dec 2026 08:39:22 +0000 X-MC-Unique: 9h9W_sLyP3SI01gM2XXf5Q-1 X-Mimecast-MFC-AGG-ID: 9h9W_sLyP3SI01gM2XXf5Q_1796459960 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D2EB9188CD83; Sat, 5 Dec 2026 08:39:19 +0000 (UTC) Received: from ivecera-thinkpadp16vgen1.tpbc.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4F3FA1955E9C; Sat, 5 Dec 2026 08:39:16 +0000 (UTC) From: Ivan Vecera To: netdev@vger.kernel.org Cc: Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Simon Horman , Jonathan Corbet , Shuah Khan , Randy Dunlap , Min Li , Vadim Fedorenko , Arkadiusz Kubalewski , linux-doc@vger.kernel.org Subject: [PATCH net-next v2 3/3] dpll: zl3073x: add device reset via devlink reload Date: Sat, 5 Dec 2026 09:39:00 +0100 Message-ID: <20261205083900.595822-4-ivecera@redhat.com> In-Reply-To: <20261205083900.595822-1-ivecera@redhat.com> References: <20261205083900.595822-1-ivecera@redhat.com> X-Mailing-List: netdev@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.0 on 10.30.177.12 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 --- No changes since v1 --- 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