From nobody Tue Dec 30 14:49:33 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21920C4332F for ; Tue, 14 Nov 2023 12:52:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230434AbjKNMwV (ORCPT ); Tue, 14 Nov 2023 07:52:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232733AbjKNMwO (ORCPT ); Tue, 14 Nov 2023 07:52:14 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCC1419B for ; Tue, 14 Nov 2023 04:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699966331; 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=la5RFiMg+JrdLhvixNwm6Ub4+jxVH4yoA9Qpf/FxprM=; b=bidRqQvLUlV1X+xjOqr/r/WoKwdC190fyE+ASsD+tECJg7B4O0TmEvxiifRygbYBW2Rjul HMKWIIANrsn8UbyXB8zqBmRykU5R5x/o0FQhI2DkALM9KKa5b5KsXdyNOmH2u8aUaz9t2L uakomWFVY7M7QX/aZgar5i5J+oJ/c3k= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-30-1Z_k2wUQN2OdiBD4GUp-vw-1; Tue, 14 Nov 2023 07:52:07 -0500 X-MC-Unique: 1Z_k2wUQN2OdiBD4GUp-vw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1CF2C1C05149; Tue, 14 Nov 2023 12:52:07 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.193.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id E68062026D4C; Tue, 14 Nov 2023 12:52:04 +0000 (UTC) From: Jose Ignacio Tornos Martinez To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: jtornosm@redhat.com, weihao.bj@ieisystem.com Subject: [PATCH 1/2] net: usb: ax88179_178a: fix failed operations during ax88179_reset Date: Tue, 14 Nov 2023 13:50:44 +0100 Message-ID: <20231114125111.313229-2-jtornosm@redhat.com> In-Reply-To: <20231114125111.313229-1-jtornosm@redhat.com> References: <20231114125111.313229-1-jtornosm@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Using generic ASIX Electronics Corp. AX88179 Gigabit Ethernet device, the following test cycle has been implemented: - power on - check logs - shutdown - after detecting the system shutdown, disconnect power - after approximately 60 seconds of sleep, power is restored Running some cycles, sometimes error logs like this appear: kernel: ax88179_178a 2-9:1.0 (unnamed net_device) (uninitialized): Fail= ed to write reg index 0x0001: -19 kernel: ax88179_178a 2-9:1.0 (unnamed net_device) (uninitialized): Fail= ed to read reg index 0x0001: -19 ... These failed operation are happening during ax88179_reset execution, so the initialization could not be correct. In order to avoid this, we need to increase the delay after reset and clock initial operations. By using these larger values, many cycles have been run and no failed operations appear. Reported-by: Herb Wei Tested-by: Herb Wei Signed-off-by: Jose Ignacio Tornos Martinez --- drivers/net/usb/ax88179_178a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index aff39bf3161d..4ea0e155bb0d 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -1583,11 +1583,11 @@ static int ax88179_reset(struct usbnet *dev) =20 *tmp16 =3D AX_PHYPWR_RSTCTL_IPRL; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, tmp16); - msleep(200); + msleep(500); =20 *tmp =3D AX_CLK_SELECT_ACS | AX_CLK_SELECT_BCS; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, tmp); - msleep(100); + msleep(200); =20 /* Ethernet PHY Auto Detach*/ ax88179_auto_detach(dev); --=20 2.41.0 From nobody Tue Dec 30 14:49:33 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94792C4332F for ; Tue, 14 Nov 2023 12:52:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233155AbjKNMwd (ORCPT ); Tue, 14 Nov 2023 07:52:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232900AbjKNMwa (ORCPT ); Tue, 14 Nov 2023 07:52:30 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2346C1B9 for ; Tue, 14 Nov 2023 04:52:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699966341; 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=0Jhat7KDUqTbI93qaMLpGRZrsMWo+iYIHbgAS0px2Rg=; b=QP3jlvjPCR3vjzhHtaNjC+0q8boLruKWH85vwFXeL7L+B62K2aHpEQ+N3MimA/gVdMmbff ABiEL3wPFH6MJrfAbFsQcbw0I6CqnOwV6wf1GRtBus1/mIVeWr/b7/YJ5OIuoQQP+SdSZN f79G4mYrUyXXnfX9+lxQfOdy+/tGUJE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-49-YYnEDd8IOxCJD4I2CY7DRw-1; Tue, 14 Nov 2023 07:52:19 -0500 X-MC-Unique: YYnEDd8IOxCJD4I2CY7DRw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 799D6828AC2; Tue, 14 Nov 2023 12:52:19 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.193.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A1A52026D4C; Tue, 14 Nov 2023 12:52:17 +0000 (UTC) From: Jose Ignacio Tornos Martinez To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: jtornosm@redhat.com, weihao.bj@ieisystem.com Subject: [PATCH 2/2] net: usb: ax88179_178a: avoid two consecutive device resets Date: Tue, 14 Nov 2023 13:50:45 +0100 Message-ID: <20231114125111.313229-3-jtornosm@redhat.com> In-Reply-To: <20231114125111.313229-1-jtornosm@redhat.com> References: <20231114125111.313229-1-jtornosm@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The device is always reset two consecutive times (ax88179_reset is called twice), one from usbnet_probe during the device binding and the other from usbnet_open. Let only the reset during the device binding to prepare the device as soon as possible and not repeat the reset operation (tested with generic ASIX Electronics Corp. AX88179 Gigabit Ethernet device). Reported-by: Herb Wei Tested-by: Herb Wei Signed-off-by: Jose Ignacio Tornos Martinez --- drivers/net/usb/ax88179_178a.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 4ea0e155bb0d..864c6fc2db33 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -1678,7 +1678,6 @@ static const struct driver_info ax88179_info =3D { .unbind =3D ax88179_unbind, .status =3D ax88179_status, .link_reset =3D ax88179_link_reset, - .reset =3D ax88179_reset, .stop =3D ax88179_stop, .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, @@ -1691,7 +1690,6 @@ static const struct driver_info ax88178a_info =3D { .unbind =3D ax88179_unbind, .status =3D ax88179_status, .link_reset =3D ax88179_link_reset, - .reset =3D ax88179_reset, .stop =3D ax88179_stop, .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, @@ -1704,7 +1702,6 @@ static const struct driver_info cypress_GX3_info =3D { .unbind =3D ax88179_unbind, .status =3D ax88179_status, .link_reset =3D ax88179_link_reset, - .reset =3D ax88179_reset, .stop =3D ax88179_stop, .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, @@ -1717,7 +1714,6 @@ static const struct driver_info dlink_dub1312_info = =3D { .unbind =3D ax88179_unbind, .status =3D ax88179_status, .link_reset =3D ax88179_link_reset, - .reset =3D ax88179_reset, .stop =3D ax88179_stop, .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, @@ -1730,7 +1726,6 @@ static const struct driver_info sitecom_info =3D { .unbind =3D ax88179_unbind, .status =3D ax88179_status, .link_reset =3D ax88179_link_reset, - .reset =3D ax88179_reset, .stop =3D ax88179_stop, .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, @@ -1743,7 +1738,6 @@ static const struct driver_info samsung_info =3D { .unbind =3D ax88179_unbind, .status =3D ax88179_status, .link_reset =3D ax88179_link_reset, - .reset =3D ax88179_reset, .stop =3D ax88179_stop, .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, @@ -1756,7 +1750,6 @@ static const struct driver_info lenovo_info =3D { .unbind =3D ax88179_unbind, .status =3D ax88179_status, .link_reset =3D ax88179_link_reset, - .reset =3D ax88179_reset, .stop =3D ax88179_stop, .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, @@ -1769,7 +1762,6 @@ static const struct driver_info belkin_info =3D { .unbind =3D ax88179_unbind, .status =3D ax88179_status, .link_reset =3D ax88179_link_reset, - .reset =3D ax88179_reset, .stop =3D ax88179_stop, .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, @@ -1782,7 +1774,6 @@ static const struct driver_info toshiba_info =3D { .unbind =3D ax88179_unbind, .status =3D ax88179_status, .link_reset =3D ax88179_link_reset, - .reset =3D ax88179_reset, .stop =3D ax88179_stop, .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, @@ -1795,7 +1786,6 @@ static const struct driver_info mct_info =3D { .unbind =3D ax88179_unbind, .status =3D ax88179_status, .link_reset =3D ax88179_link_reset, - .reset =3D ax88179_reset, .stop =3D ax88179_stop, .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, @@ -1808,7 +1798,6 @@ static const struct driver_info at_umc2000_info =3D { .unbind =3D ax88179_unbind, .status =3D ax88179_status, .link_reset =3D ax88179_link_reset, - .reset =3D ax88179_reset, .stop =3D ax88179_stop, .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, @@ -1821,7 +1810,6 @@ static const struct driver_info at_umc200_info =3D { .unbind =3D ax88179_unbind, .status =3D ax88179_status, .link_reset =3D ax88179_link_reset, - .reset =3D ax88179_reset, .stop =3D ax88179_stop, .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, @@ -1834,7 +1822,6 @@ static const struct driver_info at_umc2000sp_info =3D= { .unbind =3D ax88179_unbind, .status =3D ax88179_status, .link_reset =3D ax88179_link_reset, - .reset =3D ax88179_reset, .stop =3D ax88179_stop, .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, --=20 2.41.0