Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp84467imi; Wed, 20 Jul 2022 17:45:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vQ0sN0XvpUpLeEKvDO7MMTvwrnZHoI0eCFe/yscC1dgRKXydFm3r3C1z2zpSePBtA4+91C X-Received: by 2002:a05:6402:438d:b0:43a:ae23:b77e with SMTP id o13-20020a056402438d00b0043aae23b77emr54393415edc.233.1658364309372; Wed, 20 Jul 2022 17:45:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658364309; cv=none; d=google.com; s=arc-20160816; b=u1tEoYNIa4bH+d2/yPjmR1EY0/4l8U0MeLFW0U/m0V6MmDYvyMmt3xMei3rI64gduk 8eRUJcpc9/s8Ma+vujP0ASrZel0+/uXBJIkLAXsUmRyQcD+Q1yV8fI/Om+CA/2t2QZ0/ f3ocOugC2lbcQBAdgDYlInvee3y3GNSKts87SSAiU2hSfYRdniPrSwKS7shX2yFh+0V7 vgq74+WY09w/IIVJQqnA47IApJ9E8EpXw/Hjyhg+dnpwXLo8C2fGijg7QnvTP9BaY1gx coWfpj+aQ26Bne4Mn9iLTM6+bgCHMKeUmbUpodS24OKu0QulshMQrYLSFYTaBGb4n2Sc h4XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=oYqwhUvuzOKnMbHAPG9U5QnaJ2YWw3cAfEUA2j4IMXU=; b=yGIdwuD2sJus1WjeUYZmKuHw05hbdPv/8M18YS8KqgcwdN/KrYz6NvTAg5w5jBQuMK 2s1RGuChlDjCtRTK1RWWiBd2kj6PUZSGZmUxhmdyqEq5igpjqzZZqPFn/b89cDn2uiKI Ak7QF+JJMLYlb/DM81D517+Tu4V0jrybphjDaGFG1yCaFiJHqVt1N6hjYkgjkbePkK1T OoKmmBS3UPO82CBS3gyE0UApXerA6d8FAfts6I2t95+nfC2gI3HXApnYap8FiECAv5u/ kTIkEClxJ6xsqBvsByoLSNIXoJM4i9T1D2B2gDJ+hJ0WTZVsvSKXT+lgrbur1qH6DnRO 2WQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QKoH+8Q6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y19-20020aa7ce93000000b0043578ded62esi490579edv.352.2022.07.20.17.44.44; Wed, 20 Jul 2022 17:45:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QKoH+8Q6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231297AbiGUA2k (ORCPT + 99 others); Wed, 20 Jul 2022 20:28:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230470AbiGUA2c (ORCPT ); Wed, 20 Jul 2022 20:28:32 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6F8362A4C; Wed, 20 Jul 2022 17:28:31 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id w7so294491ply.12; Wed, 20 Jul 2022 17:28:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oYqwhUvuzOKnMbHAPG9U5QnaJ2YWw3cAfEUA2j4IMXU=; b=QKoH+8Q6OhWT+Tc75DidMLHVOSVR8+BVWbfRGuVGxGEQ5I15+ifRAgExh0v8b+ucRx qikNa45KYWXZCvq/FPrMeZSAltEXWoVxZ/cXgfSOO6SJmY5X3due06l9FOPD2BZq2cZ+ 6MhrR8x/1FJMPRIKj4MZYZ4xnDddLgKdHx/EIl0wJK8Y0JahRa6leXTImVlhWIiHa2EX Vytll/bZQDvLhUUNB050D0IlJhYXVDkmFnyBMNfcux7+UnkhrWRggGJXF14jLnxf/OEC 4tMkSvhqManVS3lLwfhIcknh75Fb38leJZw8r7N078FcOGi0EBSKG/3GfS3pN1cUqwx0 DKJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oYqwhUvuzOKnMbHAPG9U5QnaJ2YWw3cAfEUA2j4IMXU=; b=IzvrhnwalR32pFP0mTDQCLOae2IPyvXLxXUSxcfAkfc+AE3sADpQaybUfb4RVbrfS8 VzxdyQ3uj3KN5Su6USrGNF1Nh97x0ddGtrdhsPvGVsSv3Jrmql1AWn9lD9j0rOMoil9w RdB13i7v37ImvXtpco/LIj2tpUKLJWeZuB+ZGGFO4uhgzmNoJTHjPDX4BAnfs0Zi22UA kanjLk0VRkMpurv0rw6bCjvbLLi3Vz5TWY7RprjJViVXkbQhJSEY/1ZIF+vTcDlH+0cv 5/TaTxlRULcxChJ2L1KgYQSXZ2zyFAdQGtKNhf58/yCV/BeEpnSjA7mqyr26/pj3M5/j Ce6Q== X-Gm-Message-State: AJIora/vKEr50/VaU2Rll0UNRnskDmaOLMDOJvPbvDNjW8ay0DrWa5Eo mOIU/3dMicf4nJmSc0UsTqM= X-Received: by 2002:a17:90b:4a47:b0:1f0:3f92:8c80 with SMTP id lb7-20020a17090b4a4700b001f03f928c80mr8188906pjb.199.1658363311120; Wed, 20 Jul 2022 17:28:31 -0700 (PDT) Received: from stbirv-lnx-2.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m5-20020a170902db0500b0016bc4a6ce28sm163226plx.98.2022.07.20.17.28.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2022 17:28:30 -0700 (PDT) From: justinpopo6@gmail.com To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, joalonsof@gmail.com, jesionowskigreg@gmail.com, jackychou@asix.com.tw, jannh@google.com, linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: f.fainelli@gmail.com, justin.chen@broadcom.com, Justin Chen Subject: [PATCH v2 3/5] net: usb: ax88179_178a: restore state on resume Date: Wed, 20 Jul 2022 17:28:14 -0700 Message-Id: <1658363296-15734-4-git-send-email-justinpopo6@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1658363296-15734-1-git-send-email-justinpopo6@gmail.com> References: <1658363296-15734-1-git-send-email-justinpopo6@gmail.com> X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Justin Chen The hardware state was only partially restored, which meant certain functionality was broken on resume. Do a full HW reset on resume to fix this. Signed-off-by: Justin Chen --- drivers/net/usb/ax88179_178a.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index c641fd4..1cc388a 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -465,37 +465,12 @@ static int ax88179_auto_detach(struct usbnet *dev) static int ax88179_resume(struct usb_interface *intf) { struct usbnet *dev = usb_get_intfdata(intf); - u16 tmp16; - u8 tmp8; ax88179_set_pm_mode(dev, true); usbnet_link_change(dev, 0, 0); - /* Power up ethernet PHY */ - tmp16 = 0; - ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, - 2, 2, &tmp16); - udelay(1000); - - tmp16 = AX_PHYPWR_RSTCTL_IPRL; - ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, - 2, 2, &tmp16); - msleep(200); - - /* Ethernet PHY Auto Detach*/ - ax88179_auto_detach(dev); - - /* Enable clock */ - ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8); - tmp8 |= AX_CLK_SELECT_ACS | AX_CLK_SELECT_BCS; - ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8); - msleep(100); - - /* Configure RX control register => start operation */ - tmp16 = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_IPE | AX_RX_CTL_START | - AX_RX_CTL_AP | AX_RX_CTL_AMALL | AX_RX_CTL_AB; - ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &tmp16); + ax88179_reset(dev); ax88179_set_pm_mode(dev, false); -- 2.7.4