From patchwork Fri Dec 4 02:46:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 338797 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F146C433FE for ; Fri, 4 Dec 2020 02:47:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 45F72224BE for ; Fri, 4 Dec 2020 02:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726630AbgLDCre (ORCPT ); Thu, 3 Dec 2020 21:47:34 -0500 Received: from mail-eopbgr140081.outbound.protection.outlook.com ([40.107.14.81]:37121 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725847AbgLDCre (ORCPT ); Thu, 3 Dec 2020 21:47:34 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FfmHCWDDQ4XX/XgoLwXBvyP7w8Jy6afNeVQT3UkFNbXXHAlxrpzyO6TbcFNXo71zOV8+H9+6ph9v7wc9u2RIGCyS7aJSJse4byNgq9HN8yqtZq0ZmG1HCsuanSOsvqWaMIKi5foSzEmWJzURdE4JMA/jrxf6inn9tmT8leSKa0knm4I8SliwMCDu69aK9edIURIpMUfjC1Wffu04Rwx7iC3DLG+FNBGdhMI6Y7Kzi/ZH9mLE2Iqep5NRxsFmxiXtwQplbBakhq1RGgACDZVkn+7x8hxaejWJzz3qGloq/1uBU04TBt4Lk9I4EIQDKnsEzdMZ6SqsRHaYmDrl9k/LiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i3fvrFeNCKOZe1LfevmI8lb66EX3HQ/9xsBhU0yn488=; b=HVdV4uvt51kv9W/fYFoYElxXlUlM4enUV2yCxSt+PuIITM8q3gNT3LnY3HFhLqY+r695EqNsgWoWUd6ydXK+2Kd3qcG3SdL/UaHCRTs5w5NtOxaAxMzraVrD4xoyXDKUuOnwJ+3jvxY4EOYmk7uqF62PTEllXYoqEuUO3zqhsPg1b5HZjsz1llzkMyy2PVoFDIfO5Ix19y2QGFO93s1zVnIP6whZ6ViMhAeqYcQO1/sSrMxudS2PM+2TaLkaMlCgIlMQaPa8FJkdtIa4f4uZXxb084N06tpl+Xj1sI7JJoRpciRD+bQyOs0TRzs+1AoHNuy5etNHj173QpmjOISxWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i3fvrFeNCKOZe1LfevmI8lb66EX3HQ/9xsBhU0yn488=; b=KLfZxJ/4RcmqQMenI6lqFXqTdR8hfqV1V73LbdH/Q7usFi766Co4uX3UZ+N69SdHwyQPQUzZozW+HD4iGm862qrXVdYzXLoXu3FvHiohar1MIUSL2/ou6UnnWPcT+7OPNjRPk0QKicnj3wBV5xCN+FavreeFEYW5idff9mYPBpw= Authentication-Results: st.com; dkim=none (message not signed) header.d=none;st.com; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB3PR0402MB3707.eurprd04.prod.outlook.com (2603:10a6:8:2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.25; Fri, 4 Dec 2020 02:46:25 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666%4]) with mapi id 15.20.3632.021; Fri, 4 Dec 2020 02:46:25 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH V2 1/5] net: stmmac: increase the timeout for dma reset Date: Fri, 4 Dec 2020 10:46:34 +0800 Message-Id: <20201204024638.31351-2-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201204024638.31351-1-qiangqing.zhang@nxp.com> References: <20201204024638.31351-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:54::16) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by SG2PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:54::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Fri, 4 Dec 2020 02:46:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2e58b61a-1a38-4521-9f41-08d897fecaae X-MS-TrafficTypeDiagnostic: DB3PR0402MB3707: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RnlGQLkUd4JNlp9mHI+zSB4nddP2ztudZ+f64DM5M7Iqy6+zE6NBIwYtOb+02PzjgJ47t1wJcRGoKAOEVb6YnHLWmkvXm0OX4muVKM+sLTqY8GUD0+sLgQk2e53rxo+n0XqpAlf+MMoX7iG4HLjqsxVJ7p7S+EiFRZJFTY3e4gAhTdCvECktEJSM5pMLztpzuqnVnQCY6psOuznd7drYtwdXBEA8+08B9+g7KY4VyZ5h/DS916KDSiIhdRWgOLt7q76aY6FGZRllgzNoS41t5yzLAQeQnuz433FNBvk3NqzDz6GJN9QxKD2Qm2b6h17xQagd3nG22+fbd0j2nXS9zVSxKiz6y+f2L0BcJ3Jehky2ZCO8b7xNlfxrbPNFee4F X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(396003)(39860400002)(366004)(346002)(376002)(478600001)(69590400008)(1076003)(6512007)(66946007)(2616005)(4744005)(4326008)(5660300002)(8676002)(956004)(86362001)(66476007)(66556008)(2906002)(316002)(36756003)(83380400001)(6486002)(26005)(6506007)(52116002)(16526019)(8936002)(6666004)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 2hhon/tbjXNaL1Idr71ZZ1/xbBCq8r1Ot30iuiY8DKTdyhlfqJ/n80o3+u6Kjz051D1DY3Xpjcf3T8iiBSpyn3UlpznuYAS/EyXAuu0TPyM0H6WTpQe8DmM+9wXbh5wBAXiRdCm70T8M7Mc9SswaaOh5WUQACZ1W5zJChlBc7Z6UPwIUNMhj5I1kPUB3aH3YTRdeMh2o5tZu03tiMwBpTrnCXUajC8nu7AFbhq8rUTXYsoC7Ak3VynBnAt7/o+eRCcGmrJOgqJ45vudAkdfODsVADksiw/FmQbvliQIV4KHCEzjWyQC5QQa+mxTSna/NUK1ZC+FsxRYzyjYML9xinnb+Ux0LROGgVLk9iF4liE25Bnhk1HaUuOxT7uDshoakP0ItARZT/sUaGSmEUrqU8Y8WHEnR3yxDFgSTJTxq0nptqimF6K259auJun1PHtWx69Am9NdxpNzr74HktxSaJ7Fi1kcZwD8lepBAk+fscF1IBwAGPtJPQVirmLvKp5Bfoh5WRnR1JVTNr0KyRTC94glBe97KzNIpVMPTjwwCeOLQ/PwviCHezazF3txgAmdlyY1Masu8EFaI/myZfZcH6kNUb7wc90rU9dezUYXlVoTQiTlu7dl+0k2O5VvhXeR1FATCqV8ZQ+PURJymM1iqDeF+DYln/kHobIz3fOPDRudDAAATqaU0GVA2rjtysGXWqA6N1+UKFEAETUreEkybWyYLDwWVqLgqySHiJPKghPoGojz8O+jOjbJlov4cKaD8//PQFpaqbTLt0rroHaqeKEjeLVZqWic/AKWyTfiJ2hj4HRGPvlVobUSS1yHVZFlIbnfQcwVNdMOcWBFJDl3yWG5/cn3KJ57LKATtYICG97iQgTWRbnO0up+0i4c8KL97nPDp0kp8SFGirk2lzYDiCxBuKa8Z6hX0NZBnHXiA+ksdaDqLDFk63EvizFs48apoHBVH6r5GPqPx5QfdnZJsjo6oUG9qcOpG1SNyjIwy+aNHLAOS7jnPGr12QozWFGej X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e58b61a-1a38-4521-9f41-08d897fecaae X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 02:46:25.4727 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ULl31ZMdnen5ih2GjnQtrvR2BEfw7jGEl/STQFIkaWBREisNH1EoZySa6+/Ev3GkZaWF/OZbcwm5BG+HbSPCAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3707 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Fugang Duan Current timeout value is not enough for gmac5 dma reset on imx8mp platform, increase the timeout range. Signed-off-by: Fugang Duan Signed-off-by: Joakim Zhang --- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c index 6e30d7eb4983..0b4ee2dbb691 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c @@ -22,7 +22,7 @@ int dwmac4_dma_reset(void __iomem *ioaddr) return readl_poll_timeout(ioaddr + DMA_BUS_MODE, value, !(value & DMA_BUS_MODE_SFT_RESET), - 10000, 100000); + 10000, 1000000); } void dwmac4_set_rx_tail_ptr(void __iomem *ioaddr, u32 tail_ptr, u32 chan) From patchwork Fri Dec 4 02:46:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 338297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE577C4361A for ; Fri, 4 Dec 2020 02:47:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6C18D22511 for ; Fri, 4 Dec 2020 02:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726746AbgLDCrg (ORCPT ); Thu, 3 Dec 2020 21:47:36 -0500 Received: from mail-eopbgr00061.outbound.protection.outlook.com ([40.107.0.61]:4739 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726558AbgLDCrg (ORCPT ); Thu, 3 Dec 2020 21:47:36 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ce6Sl3wLf/kmELZd0/wP5wKRtZE2wQOUSNh2zmbVQF8k3FZPBPLVOVWUDiKDEnHyMSjfe69/47mS4gsyOFeMX+YhjqZaJ7meuamOl/po0nZSaOFBM9pi9c9cgx5Q+/GvngU0BOPRCmek+idFN8uYQLut4ey8FUOvtxLECdNjymXsBcjzZqla8Klaw0/F5A0kyquALvdPSlAbKEfJ26/8BARh7BDdnlJIuggZQw9521MyzIN9XS5kPZ1ymDz+JdHwChXfN76LyDjJcWTnZrfKCecqf+0o4Yzc/oMdyVbVNEAY7uGt8Bu8yzpXW/hI4ec+NtnewyPg9bmTe6x6EG9yeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+zt2LDV5dRpOEIql0oMOFvGRdYBfHx42wiwqunvHWXE=; b=IsZXFiHxNmDy28ZzWivKwHQnm/YdIGBPZ3GhJYNf6IbcHEnoD63JzEn0yZ/ltuXk/RtBr/uvKG7zexvGkFWyzNBDT73DfW9dG55BG/qXRmG03TkhlM6AyHGZn0YkTVwncC2yqp69eHm77fOT/dR6GR/4nF+MDjnLiyhnNuSSeFDwHCElwTJsl0DamsjVOS6dh17dlsz/OrC3aPUsUGcToUkVIqgRG5ftc2CtW541ggy/XKatIX+BX1aV29zbThC3vB4PrSTpAJQkc/mQPbJUyWJ0woWhhddcU/Fnm0KBrgY+tJ2olxwSIBDqAjKn2NtYO8EJqUoL1/HV+dmPeUtTGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+zt2LDV5dRpOEIql0oMOFvGRdYBfHx42wiwqunvHWXE=; b=MoCegcifWx53IKa3H6m+hcnnwATOc9bQ+1VlbkaH3N1jXBwEBDTd85rYCKyzevkqA51no5K1NqsYhnlSuazVNYS5UczbdS2iW3seeWhX6ZgfFG/YLOq/fJOLLb9gysvkNsVKgzbPEB5oY6mXAsaDRRzarbZSZZEcYlkUYN9e6f8= Authentication-Results: st.com; dkim=none (message not signed) header.d=none;st.com; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB3PR0402MB3707.eurprd04.prod.outlook.com (2603:10a6:8:2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.25; Fri, 4 Dec 2020 02:46:28 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666%4]) with mapi id 15.20.3632.021; Fri, 4 Dec 2020 02:46:28 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH V2 2/5] net: stmmac: start phylink instance before stmmac_hw_setup() Date: Fri, 4 Dec 2020 10:46:35 +0800 Message-Id: <20201204024638.31351-3-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201204024638.31351-1-qiangqing.zhang@nxp.com> References: <20201204024638.31351-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:54::16) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by SG2PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:54::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Fri, 4 Dec 2020 02:46:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d3482a1d-ec39-43d9-696d-08d897fecc98 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3707: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +VlqgMUuDV+UAB0bb27b9MxvWFF4JF/CRqiqZ0lRFvcEZTDRnkz2N7CWPMSJdR3faIlIsgWSJ13cuOuumqk15VwWdj5kzCJLC677aApg5HXNfQtKRYKZ672wqPknjp1Qqwipm+9A8oLYDf+Rd4ySQJVI7PQBDq41i9tfLHBuzcFjwPSThd3yTIc6iSmMw1vfMgMy3/4v4QsMdNwi5Rt6850ESo1wBoDf7kfQk8UIOJvXiQI/zO86K+vF9alyl0M6n/SkQD/XuQ8rnUVbUjE2pQk5zsqHQikz/ffki/EW6aN2vSueHze9n+QHfjXqGu7/KnKMyg1bwBDbxvLVW7AHyeC3pbd6lmIgoWkqlZdQNKHhEutftwBqmi1HQBxwJTHB X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(396003)(39860400002)(366004)(346002)(376002)(478600001)(69590400008)(1076003)(6512007)(66946007)(2616005)(4326008)(5660300002)(8676002)(956004)(86362001)(66476007)(66556008)(2906002)(316002)(36756003)(83380400001)(6486002)(26005)(6506007)(52116002)(16526019)(8936002)(6666004)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 05gKR1O/KvAaBBmEMWwZY9LJwTAZrk/+b2MUSwwc0sIaOofJh+J7r7XbB3iMlyhQHDl5Rv7urB/wjg9Q31cQfHy0Aek+GtcYVgfE4xSI2rNx6dfrQFJ90nSDCi+5aEO9OzaKWuyQL4oY+62ccBuoz9t5/Xn/kaEoHno9bLq3XqyEb1+Da5p6urkERsVwL/GHbNp8aDlSU8fGJfvzItnQxoXabAKa2rQXjmDUJ6y4Tg3z+2mkYIanZAs0BBWXgIvGIGw36FRQd7L6iWQcL6F1x3EE7LHqddDz3jJ7OUpOpj7ieI9UfAJDmDZsv+RmIN5+Vb1gBhmRc+CfNgzdCRMuiq1gnevWljApBg0YUIzK2BAQAM5ZhH/QAzLtKnimy3ZPzbL3uhTGmHhvIqgH0b11GDzWTI3zSI6X/qhjoQZmAo2BQv95NIvC+XVm3SHres77WhPTe+wHz+RibR+hjIe7hPohSAmhCvrXhfCOdXZzUqQtPrZ2kRYmlCIy4FpTYXguaEO2/+687zn8vDURSCJSOTRrKLB73TVnmYV6Nz/cWnFvmkJBned5WZOli9/2daxhckJPOjlRomLid19S+6Y3T2YpDyr8jdBD8laBmjAQN1zOYiVuvuVFbEzhZ0TNNcYz9eC8YAbXwvpTpoMWFj5+AloHnfCb24AQPaWVpSf9zmceYXYeP713VtzkrEsziaXFTYu7Q+WFuUir5i8NpCzPjNpq1QYJpwddt24Khxpe2t5EQI7DMFcwFIUzBqd83mnCim/z09fcKCReGDPhyQqmvRwQ4uJU5ua2JYmYV5Kzk4UlwZkFrxsSRoNOaJQnYWka38A059gBlDITTeROtE7RbeS5qtV5+Ai+CpH8qWeD6MuMV8JHmQZQ4FSW5KHx2koo7cVOyeE7vU3ow0swu/nyQOibKiGFyRPqFAdrjGRj78RoqwwYWa2ugHR6+0rXBW0NuoyHxOJdngS4YaiL7G7l1f5LJARHLqs4dHOQnv6K4WRGn+N+c4JNdQBPMtmR6xR1 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3482a1d-ec39-43d9-696d-08d897fecc98 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 02:46:28.5402 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: f6s8gh041tTzi3RhAj1RVAnDwECQVjxGyMkmFbMzjrSIyT9BeU79vH/pYWVag0OVR95VMdKymO1sCaiXJN8Lqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3707 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Fugang Duan Start phylink instance and resume back the PHY to supply RX clock to MAC before MAC layer initialization by calling .stmmac_hw_setup(), since DMA reset depends on the RX clock, otherwise DMA reset cost maximum timeout value then finally timeout. Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic") Signed-off-by: Fugang Duan Signed-off-by: Joakim Zhang --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8c1ac75901ce..107761ef456a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5277,6 +5277,14 @@ int stmmac_resume(struct device *dev) return ret; } + if (!device_may_wakeup(priv->device) || !priv->plat->pmt) { + rtnl_lock(); + phylink_start(priv->phylink); + /* We may have called phylink_speed_down before */ + phylink_speed_up(priv->phylink); + rtnl_unlock(); + } + rtnl_lock(); mutex_lock(&priv->lock); @@ -5295,14 +5303,6 @@ int stmmac_resume(struct device *dev) mutex_unlock(&priv->lock); rtnl_unlock(); - if (!device_may_wakeup(priv->device) || !priv->plat->pmt) { - rtnl_lock(); - phylink_start(priv->phylink); - /* We may have called phylink_speed_down before */ - phylink_speed_up(priv->phylink); - rtnl_unlock(); - } - phylink_mac_change(priv->phylink, true); netif_device_attach(ndev); From patchwork Fri Dec 4 02:46:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 338796 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4B34C433FE for ; Fri, 4 Dec 2020 02:48:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FB22224BE for ; Fri, 4 Dec 2020 02:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726873AbgLDCr5 (ORCPT ); Thu, 3 Dec 2020 21:47:57 -0500 Received: from mail-eopbgr140081.outbound.protection.outlook.com ([40.107.14.81]:37121 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726558AbgLDCr4 (ORCPT ); Thu, 3 Dec 2020 21:47:56 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F0ashuzw67j5K0DdEtt3vWakzuhY5NCIMlp1DVEajR3iFQ6JuN7kL/sxrXQkqwZXxtMqMP9MwPqkGh/1gaVmZdsV1VdPTRaaLxye0pofiA9122ljEPAKr4XEfUImTzOAhM/I/W07ar5ZrriuQi0dapAGgLfVv14aB1Bv2cOhysQRUQgGHJi/WIXgaq4trem+iu0Y83T/JNz/ahO8KZjqBYoq9axY8+MwUFnQtLBpI2zU+xuuV5Y39UELdVknQK4PN2FdvWsjek9cOYC5rB8FrwX9duXuo/BJYSxmxtS3WEApvSqHJ7oVOgmkA18CEaooAB0+DzRx9ENCic12PwpW1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2alYby+BYm+OeHs39H8hqadqbhg1Dg5kKh5UAw988kw=; b=nKaO7EZrjJUdZ8mIu8W+3bJ0ywpwiHbtCcRYHojkQfInIH/1pDrOvYJ6sbLPoz6Kg6Zq4oHq3IMGNa3mBSFta5AfPpdveu8FTaK5g/9Bx4mHnSZAG/IoBVwOjoDcUBdACF9LNAkQawHnwZ5D1zgn2tFciaL1mgyvig5+ctXdu3CIla/wfr0SGQhsVercNxYWitpq4eX+D3pr2FelfwB59S7oya5/6IJT7Laj65xa/74BtJK87JXh0qz/sMKE0GZpajr8hTW6Kh2ra0yIzIXUFu5tTx+dkXj3LNRgZNOPKwi539wNM1QKHnWv4somxgPibsEyg50GqtWjeBUk5708gQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2alYby+BYm+OeHs39H8hqadqbhg1Dg5kKh5UAw988kw=; b=spE9BjW4wr2nKsEZAU8HacVVuTqWr+5kNSvNux4biNcUlZJg6crq1yakm0AOZBKisQA7/rI9esdemFF5h5ugLgU0IwBt4udApV78p4nB7j0ZnlenG+vmOxinltWn7EJm3VfBmEH2q7H2xa9FYyFhFkVyZD4rgUdCinYJPIfsm0o= Authentication-Results: st.com; dkim=none (message not signed) header.d=none;st.com; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB3PR0402MB3707.eurprd04.prod.outlook.com (2603:10a6:8:2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.25; Fri, 4 Dec 2020 02:46:31 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666%4]) with mapi id 15.20.3632.021; Fri, 4 Dec 2020 02:46:31 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH V2 3/5] net: stmmac: free tx skb buffer in stmmac_resume() Date: Fri, 4 Dec 2020 10:46:36 +0800 Message-Id: <20201204024638.31351-4-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201204024638.31351-1-qiangqing.zhang@nxp.com> References: <20201204024638.31351-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:54::16) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by SG2PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:54::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Fri, 4 Dec 2020 02:46:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 834f4403-538d-49b5-5398-08d897fece78 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3707: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b9Tvw/v8rmj/kX3Kg0y8dc942ZYnsXwFAw2gQRWt0IdMhGfZu/iRyOYru6ECKdddPaF+2nt5TBegvfmkjEgLCMkvhxwpZbcaBVkknmpNPn/EQwf4E0aFogWWRY0C92uew2LKFf7LCtTN2EEX60zCpRjpo8K8dEbrVqt/siLffB0SD8jhVOSzo0ZOEQdrk0har2VwjToApIpP0WkO7XGylqTN/2los1IA4k4r8oKMSwQ5bt09KBok7MkOMe76dBiBPj1o34ogTZmhgjsilopNpv9sp9ToLXiKKM2d0LtOzQ3x5O22t7Qu0c2OCu94ljIH9q8lMhxJgWeOq0UbhfdAU82iQnzVloIhxbZYvOMX9INUSW5Yz7zQzQIDfbVNWQBh X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(396003)(39860400002)(366004)(346002)(376002)(45080400002)(478600001)(69590400008)(1076003)(6512007)(66946007)(2616005)(4326008)(5660300002)(8676002)(956004)(86362001)(66476007)(66556008)(2906002)(316002)(36756003)(83380400001)(6486002)(26005)(6506007)(52116002)(16526019)(8936002)(6666004)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: S4VlT2cagsfY5VtmmEo9mQvUR5Ir3zDcTh1xX9f7R6qs4ikJaQIMfIPyCr9XTdhIo5QJ+6T8XCh5hIKOwLduvJgbSIlRQF3hHk+ilz0CJawzty/EhZk1UKUnf8qryMehZ3dN2/K3GkRU+0wI7BpFkMZEb9RRbQGAOHoe2Z6wczpwwo3qV9fERay28cCUGzWELmPZ+LyIOzQuc/mNZLrIk4NZP9wEU/iBVeaa1Rzkn1HouGG9/Tnu76cFoBusK/gpBj4ku+/nKDkctOb8bZQatzif57GZ3B3EwI1OSP13LdDGNT+OJcNI54L3Rn4DseQLe5XLhDqzE+OeFMIQyDSALBA+Vm7raA132bRmgUxFSVBCKwUP+paRATHQqz3Nzagg01VBFZzpAMZ/MK9PhC6CU9NcDAq++bZ4c6j17a8rD5sLMRZha1h8M5qhV3x5PzoBnUPLaW8tLzyeXrFI/Ijs7x2wKh37EI7BojwIfCoF8/tB6WExLJwENNLua42Uf+Md88MLlsV7vlpvwcgoGASSyO+lhHizuPbBmySN8KUKhMUQmVl9RN/xKNY4pkzzRxZPpYst5pQ2orS/hDl85z8JQIWGhTlbZwdpUpCAwv5GVmY726N9zZwv0LyxFu4mfPVq6FBqCHhQVTqEj4h6UV4aMgtElsWttvTx9C7eWvfg+ysy7t1c1XFef+79chMQSRAyME87zLjY6NvNz3ku4s8wkL0WgRTKZs2mq5M4O6XrXAw5XofFLSWQ8dLx3hgpD+4eFJ+0yOgL2HrMROZpJau1bVjMIv/gskztwjyu94DRf3MHVeTCbhe8c9vSZ1lQC8roezpMo7RlhJL7QRSrAtxeQwLE3GSk5lXjSIP7Tahu/PyYAv4agRHnNLnW0KogYvfql2bxhBQBXfWLOImioPb5PQ1MYEeQ/H3+Hn4vsYRgY5j4aKJW2Loa1a7IpSXbLmElK6DeotlpC27QY7pl2qDFzQ9YlO5sRY+ThkDxzkG2RshC358udLG/yrhmw0+LwW+h X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 834f4403-538d-49b5-5398-08d897fece78 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 02:46:31.6853 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FX/gfAhhJ/rdalXnjgSh0fHQAr95fMHeVloswYfqKYxLG4K9rt34AESy/M3VPKpQwkjBi9KRXZVpLCgnZuhVAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3707 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Fugang Duan When do suspend/resume test, there have WARN_ON() log dump from stmmac_xmit() funciton, the code logic: entry = tx_q->cur_tx; first_entry = entry; WARN_ON(tx_q->tx_skbuff[first_entry]); In normal case, tx_q->tx_skbuff[txq->cur_tx] should be NULL because the skb should be handled and freed in stmmac_tx_clean(). But stmmac_resume() reset queue parameters like below, skb buffers may not be freed. tx_q->cur_tx = 0; tx_q->dirty_tx = 0; So free tx skb buffer in stmmac_resume() to avoid warning and memory leak. log: [ 46.139824] ------------[ cut here ]------------ [ 46.144453] WARNING: CPU: 0 PID: 0 at drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3235 stmmac_xmit+0x7a0/0x9d0 [ 46.154969] Modules linked in: crct10dif_ce vvcam(O) flexcan can_dev [ 46.161328] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G O 5.4.24-2.1.0+g2ad925d15481 #1 [ 46.170369] Hardware name: NXP i.MX8MPlus EVK board (DT) [ 46.175677] pstate: 80000005 (Nzcv daif -PAN -UAO) [ 46.180465] pc : stmmac_xmit+0x7a0/0x9d0 [ 46.184387] lr : dev_hard_start_xmit+0x94/0x158 [ 46.188913] sp : ffff800010003cc0 [ 46.192224] x29: ffff800010003cc0 x28: ffff000177e2a100 [ 46.197533] x27: ffff000176ef0840 x26: ffff000176ef0090 [ 46.202842] x25: 0000000000000000 x24: 0000000000000000 [ 46.208151] x23: 0000000000000003 x22: ffff8000119ddd30 [ 46.213460] x21: ffff00017636f000 x20: ffff000176ef0cc0 [ 46.218769] x19: 0000000000000003 x18: 0000000000000000 [ 46.224078] x17: 0000000000000000 x16: 0000000000000000 [ 46.229386] x15: 0000000000000079 x14: 0000000000000000 [ 46.234695] x13: 0000000000000003 x12: 0000000000000003 [ 46.240003] x11: 0000000000000010 x10: 0000000000000010 [ 46.245312] x9 : ffff00017002b140 x8 : 0000000000000000 [ 46.250621] x7 : ffff00017636f000 x6 : 0000000000000010 [ 46.255930] x5 : 0000000000000001 x4 : ffff000176ef0000 [ 46.261238] x3 : 0000000000000003 x2 : 00000000ffffffff [ 46.266547] x1 : ffff000177e2a000 x0 : 0000000000000000 [ 46.271856] Call trace: [ 46.274302] stmmac_xmit+0x7a0/0x9d0 [ 46.277874] dev_hard_start_xmit+0x94/0x158 [ 46.282056] sch_direct_xmit+0x11c/0x338 [ 46.285976] __qdisc_run+0x118/0x5f0 [ 46.289549] net_tx_action+0x110/0x198 [ 46.293297] __do_softirq+0x120/0x23c [ 46.296958] irq_exit+0xb8/0xd8 [ 46.300098] __handle_domain_irq+0x64/0xb8 [ 46.304191] gic_handle_irq+0x5c/0x148 [ 46.307936] el1_irq+0xb8/0x180 [ 46.311076] cpuidle_enter_state+0x84/0x360 [ 46.315256] cpuidle_enter+0x34/0x48 [ 46.318829] call_cpuidle+0x18/0x38 [ 46.322314] do_idle+0x1e0/0x280 [ 46.325539] cpu_startup_entry+0x24/0x40 [ 46.329460] rest_init+0xd4/0xe0 [ 46.332687] arch_call_rest_init+0xc/0x14 [ 46.336695] start_kernel+0x420/0x44c [ 46.340353] ---[ end trace bc1ee695123cbacd ]--- Fixes: 47dd7a540b8a0 ("net: add support for STMicroelectronics Ethernet controllers.") Signed-off-by: Fugang Duan Signed-off-by: Joakim Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 107761ef456a..53c5d77eba57 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1557,6 +1557,19 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv, u32 queue) stmmac_free_tx_buffer(priv, queue, i); } +/** + * stmmac_free_tx_skbufs - free TX skb buffers + * @priv: private structure + */ +static void stmmac_free_tx_skbufs(struct stmmac_priv *priv) +{ + u32 tx_queue_cnt = priv->plat->tx_queues_to_use; + u32 queue; + + for (queue = 0; queue < tx_queue_cnt; queue++) + dma_free_tx_skbufs(priv, queue); +} + /** * free_dma_rx_desc_resources - free RX dma desc resources * @priv: private structure @@ -5290,6 +5303,7 @@ int stmmac_resume(struct device *dev) stmmac_reset_queues_param(priv); + stmmac_free_tx_skbufs(priv); stmmac_clear_descriptors(priv); stmmac_hw_setup(ndev, false); From patchwork Fri Dec 4 02:46:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 338296 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DE13C4361A for ; Fri, 4 Dec 2020 02:48:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C42AF22511 for ; Fri, 4 Dec 2020 02:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbgLDCr7 (ORCPT ); Thu, 3 Dec 2020 21:47:59 -0500 Received: from mail-eopbgr00061.outbound.protection.outlook.com ([40.107.0.61]:4739 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726780AbgLDCr6 (ORCPT ); Thu, 3 Dec 2020 21:47:58 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HTSaFnAgoYO8o7SrPw9BXujISPILC8Wouu7Tfvd4LcscpqRBCDc1yRztoGqOboWfLzx9gtOB10Mfs6leRhaT5xjxV3xDBSnkE4jSs5uy41n/LMlGyzXXQPSbjr2ULNsKD12SIqgs+9wzNtfNrY2mXFwNt6Y+CHMalH5WoaGrrUt5BfUfTvzmZK8qiOY3pNTBP8D9ZQDd4tQHHtgWApSJ5uZVEG1xVzdjfhV+4PqfXcrqAo/SSua6N7qgijavhYFbpVxloG8tirqBTY1GONUvjXTJNfIcSmkRaaJMHkEjvgIbrSIzk7SjXOttoN0eSnd/09kqF6J7kkuujbIB3Yroaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ch/DjUYcGvIpPGFaxHPMdxxti+2VSWbLnImpNceEVaI=; b=oIKxq/JmwUv4ICLewb1v7o2N0zd8QGqXgAlG3mN02E7KVhuWYme0i6acJn55iPQMruCziLt+FBz+QUj7A4VMlhjDiKbDe8gc/7GUGZhryOa1NUJAwp8MVAvtcJ2DJcjH5BF5+3Zet0gnulf8FvGEv4WLeMwWSYdu73xDvZMBCLIJyAVbKutJnkMk0Os0XySnSOMwUk/8ZDVNVYMKP3iRRg0n8er0Z0tNRnUBSWOCaoI8dXm4Msz4dCOPqzi5zg4uJkYS6qPLAwxAYCU17B06L5UPZZ0I+AH03t3ayfCc5Q3M/bsAlXl1FkHAnVp5sm0olJ7pg8H6p2h1+J1NCP9bnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ch/DjUYcGvIpPGFaxHPMdxxti+2VSWbLnImpNceEVaI=; b=sB8RTK/I5N4wPpPeQUkOz8uguvWT7o5tRdiNuQkqbuzusNcFk8JIMda/BgF8D7GOttPCub5P/sp7vFxBGA/6D1KqUfm/KUGxp5bMGIJ2zc1NK8hfuazES8xEhU8+KXhT8nTsD9b19cIKF5vvzJLfebEtb9Y9IyaVTusfyIGowpY= Authentication-Results: st.com; dkim=none (message not signed) header.d=none;st.com; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB3PR0402MB3707.eurprd04.prod.outlook.com (2603:10a6:8:2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.25; Fri, 4 Dec 2020 02:46:34 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666%4]) with mapi id 15.20.3632.021; Fri, 4 Dec 2020 02:46:34 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH V2 4/5] net: stmmac: delete the eee_ctrl_timer after napi disabled Date: Fri, 4 Dec 2020 10:46:37 +0800 Message-Id: <20201204024638.31351-5-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201204024638.31351-1-qiangqing.zhang@nxp.com> References: <20201204024638.31351-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:54::16) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by SG2PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:54::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Fri, 4 Dec 2020 02:46:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2821e27b-1078-44a7-2d86-08d897fed057 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3707: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0m0PrGNWCLtgdzGAYgLO+8WYXfzPqKeJvYpBoEcDLjNlksiYuI2Z5b9NfkDhegvqu6wVD8sH1Yx306uyKZZkQo/txadDhVctk2eaDWHhN05EkIt5JIBjcQ36rGJprI69HuoGwgo7Sy2Dy9rnEYf9iVFGnL9uiKSgjy53kkBfA/Prddeehnavqd75zWvAiNl9kI2ItYwbZ9ZqOSS4NcDEDcY0Q7C8EeM9CbsvDqs0IjkGwUC50FfgmXokYqF5DrBCZ2X/UVvSFaSKLhRL4p1PSr8F70L/WEDTNkIYtVV+ht/6/HxcbTDrZ4IUTTQKQliLojJv5uCH+eTLI54sJRHQjbNqqvg6hbAkHXWYLj25t7pzEkuux3thqMbOfOl1vsED X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(396003)(39860400002)(366004)(346002)(376002)(478600001)(69590400008)(1076003)(6512007)(66946007)(2616005)(4326008)(5660300002)(8676002)(956004)(86362001)(66476007)(66556008)(2906002)(316002)(36756003)(83380400001)(6486002)(26005)(6506007)(52116002)(16526019)(8936002)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 9WbctopTkhcJ1w3otjsrahQLYA734Hc9PfVxKOPcG6hbWUVMAB3VrERwtD20VWCUzMhOiaSCF1f5KuSZSqrcpPQwGiywew3lMQhCBc3PXj6ipGk2R9UpfnbRT67HpL0GPEtJcAP6wGVQmX+oQO8aTLggOK/NhiOdZOHL/WuG06DnIVm0bx/XomwRc47O1HthY6eIUmOeU4OzZk/OH5SGTU+sdSrjcCE6AIH2jgjJbk5cb/5wFC6K8+g1xLvHihUTUOZTsU3UO4dt8ZBcjUcqGb2sGW31PM9zXWJqnp4s4WdaoGSM7RBNxQRTNsHlvOPZY9kVAgY6EjFzzrZooZi7Wl2kmgL4bszH0dzAF0J05Hd8JBezLTVt28iATUrsjdwZKS9i67njvQBzhVDOXN2u5gtA+cxCBit+GUpcjypK7xHihF896NTrbHQH4HwZeKKxn4R4ztuygTxg6eAyQtfG0+Z2KAwd2wakybyoxXG8CSWYHgR31b56eazxQu5ZnlTjYzFfY1kMnxHsvukzsibPymSiq23Ae3xo3vl3WqPEkH2MWVnyiZXGz7to7Q1fGn0RTSeVZb70VD/rjwSdXlotC4YpM+TSOo8mqb+eawM9v7Ta6li2qjljV2YVYOcsjxyGaDmTIdFM4tOYtDFcT5/FishnGx+gm+eRKHZvKVCK2/BJo2tqtMG6/Qcx9p33ThLzm9OR6N9PsG3B0vzp+ZMtvebS+tDmIlUpuEV6FZBwnw4cbqp0wMJf0sW1QOlV7Hjax1RrgfZ+gv9d7f/yxfVL1F9z29XIwRK8YIHmfTDNq3EW22xDn5AT7vwWJTSUk3khyTBT0ZNYAU/uw44jxbg85RptXpgT1bxtyXkJFBp7dUwQxb9FOA7dwE/aDZvAuBcaO/vnhPcdLmAUW7OcbUhJ7/ySYB4kecbFf8ZN1NWsPieK1ajORHZm9l375RRyKaEAU7rEvhD/pa1XfpqF7h0HoIxAsd33fhJSAgzXltyMTKvmbdzdUxH+uLfLTed7BhP8 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2821e27b-1078-44a7-2d86-08d897fed057 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 02:46:34.7857 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GE3df8YIzenQ01xas5PErZUfe+RGlRPgxOx9dZjZiEHo9se+P3iquoGBGmv1bIqrletuM/O8OOD5SS7CH1pp8Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3707 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Fugang Duan There have chance to re-enable the eee_ctrl_timer and fire the timer in napi callback after delete the timer in .stmmac_release(), which introduces to access eee registers in the timer function after clocks are disabled then causes system hang. Found this issue when do suspend/resume and reboot stress test. It is safe to delete the timer after napi disabled and disable lpi mode. Fixes: d765955d2ae0b ("stmmac: add the Energy Efficient Ethernet support") Signed-off-by: Fugang Duan Signed-off-by: Joakim Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 53c5d77eba57..03c6995d276a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2938,9 +2938,6 @@ static int stmmac_release(struct net_device *dev) struct stmmac_priv *priv = netdev_priv(dev); u32 chan; - if (priv->eee_enabled) - del_timer_sync(&priv->eee_ctrl_timer); - if (device_may_wakeup(priv->device)) phylink_speed_down(priv->phylink, false); /* Stop and disconnect the PHY */ @@ -2959,6 +2956,11 @@ static int stmmac_release(struct net_device *dev) if (priv->lpi_irq > 0) free_irq(priv->lpi_irq, dev); + if (priv->eee_enabled) { + priv->tx_path_in_lpi_mode = false; + del_timer_sync(&priv->eee_ctrl_timer); + } + /* Stop TX/RX DMA and clear the descriptors */ stmmac_stop_all_dma(priv); @@ -5185,6 +5187,11 @@ int stmmac_suspend(struct device *dev) for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) hrtimer_cancel(&priv->tx_queue[chan].txtimer); + if (priv->eee_enabled) { + priv->tx_path_in_lpi_mode = false; + del_timer_sync(&priv->eee_ctrl_timer); + } + /* Stop TX/RX DMA */ stmmac_stop_all_dma(priv); From patchwork Fri Dec 4 02:46:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 338795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02790C433FE for ; Fri, 4 Dec 2020 02:48:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 968D622511 for ; Fri, 4 Dec 2020 02:48:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727029AbgLDCsX (ORCPT ); Thu, 3 Dec 2020 21:48:23 -0500 Received: from mail-eopbgr140081.outbound.protection.outlook.com ([40.107.14.81]:37121 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726780AbgLDCsW (ORCPT ); Thu, 3 Dec 2020 21:48:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TcTGCQv+jSnrPWwoOgVG04Jj2Hlf6Z6DgTL3hwwBUaL3K/So0FDHrMqRnybmKgFryWTRO6/nseZZxfUpGt5UugIAP2Am1/sa7ETI4CvEBA3ITmZh4j4go2aYhmX5jFc5nHRgCYc4701CVVGMVt4ZQ70JLy0hcf2TFKHWMYRXZWnPQPKYiHw0aKMJoAVoHv4HXvtfCpIdviVKszSJxJpYxL+xT8DY4alwowkZCmE8AejgTeeTjOBDxIA9NTniWlC4tOXIBOruJoENnDWHv6wYXoB+J3+51eZw7LRUyz3cCZAwDrHVfREu8WRv+ZaAv+3rtjln2LyPUdg38KnWNiNDQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dsgz9Jce5dZwZRw/WYKFxWhpQpYwiT7h07GYN3SKBx0=; b=a5aNjlm6wtITclrU8dw8VMZWka63m3xp1xjX7s36BVtEM1q3cDKcyPG55Zvf5vaG04r2PPeSLdNEJoR/UaB2R2F5XcaHQ+PBuKRl38TUEh16C2E157FjtVYlVUbDXAsCQbT2hJvuL+d5flQ+jPjJGYtLx7hJQaoR3ETKEWE9/u/4yZAYin1Q2IybgP1qtAmp8Wsv0nb2Gawdim+k57QrGBwRBjfNZwGdEK60Z0iD8BHNGRbl24W7Lwi08q1Ie4JN6GHCf2Zsmn1B51Yo6u7FP5JLkwXNKQ5V/ZWXkM90afXq5YlFJeUylmaFoFVWfvTpbE3a98kpFf7XvY+1U/OM0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dsgz9Jce5dZwZRw/WYKFxWhpQpYwiT7h07GYN3SKBx0=; b=pGRwvmm5EPOEJQtsTVuwekQxWid4M6Yxe4gIgFBj4hf2Dfo5wWL45ReoAUZnVZCBHelUJe/Im7jLspGD48dUzTex1T1HjalVxPkYjEhIVz5YV4KeoKOKAJttO9yAdbX5lzRn393KUcBqmrFU8Cqo1troDiMDCB8BpbMXUcDgSA8= Authentication-Results: st.com; dkim=none (message not signed) header.d=none;st.com; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB3PR0402MB3707.eurprd04.prod.outlook.com (2603:10a6:8:2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.25; Fri, 4 Dec 2020 02:46:37 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666%4]) with mapi id 15.20.3632.021; Fri, 4 Dec 2020 02:46:37 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH V2 5/5] net: stmmac: overwrite the dma_cap.addr64 according to HW design Date: Fri, 4 Dec 2020 10:46:38 +0800 Message-Id: <20201204024638.31351-6-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201204024638.31351-1-qiangqing.zhang@nxp.com> References: <20201204024638.31351-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:54::16) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by SG2PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:54::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Fri, 4 Dec 2020 02:46:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b61e4407-f273-48a8-a29f-08d897fed22a X-MS-TrafficTypeDiagnostic: DB3PR0402MB3707: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7OdAdhxhdZv+DtCGHOfddlcJ1PA5q97C0ypwp6ew03fpXXdOVVqYDDWpyESaZRGjFbmgkNsbM3AinZETwu0b91Q/lH/DmFlz6xVkIyr+hiYLeV6WcBsR1DDsm623m+rxTxBCqjsSy4A38+hzOzJVaiFIAft1gNfKg1aFxCoDYrglfEpkGBF74s3Hi+gntRdQhi4K+QINYU7UUleN9gJTOMMaBScnfQoyA5UktnRYz7gON0LgpF0i4NZD5iyH3K2zdS0KHm+lOhzLwO2DE6RJ73Z1Do8K1Re3aquBtVXuF3cGSFTeOzCpdr7uTMSEdX8UApY+vEoryWMN5M4gs1wY2XEBNw20+4V3Fw3nYxhoiIHuBkDMC0QGbo2YkHzV2+8l X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(396003)(39860400002)(366004)(346002)(376002)(478600001)(69590400008)(1076003)(6512007)(66946007)(2616005)(4326008)(5660300002)(8676002)(956004)(86362001)(66476007)(66556008)(2906002)(316002)(36756003)(83380400001)(6486002)(26005)(6506007)(52116002)(16526019)(8936002)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 1eqE+B4e9Ug83NqlDzWuKNZB2KWz+NO6xi2bV2+ljW18xq1z1rYcYpyeCQSyLUmOoitcKx2VoCeNz/6/imGeycxhNHck2Obm7vbGe68jRwPMqLsGozaIinYzHGX4Z3vyaMXRID7RM8XOCHrYDLVVw2SmVGYh1lXLAdd8XvY1tpNyoix/H6LjyR/ybHi2szNxCS7WXKBHkZ/LcSliGwPrdoFa0xJRSumjg06OtcOlQJbYMyConwnUpiXbSWT2CpHz3wsAK3tzoXjlRUdAy0VxD5SvOmdxVz3GbQzpI0jeuekaXsKCXZLzYp65CJ0wuxZIoo4PG3GT+AbZkl3ILS+sFfOdLWGBBx4yzHe6+Z1qHIFQgG1ljwSqcUeOFctFUgE5EL2bCiblfNL4M759UwSVWurcEB+Dl+b4XYYJbwaEiHtaoqs53Qg8P5QnCEmrsrxtQJ8BKXNzZYCLNlZvDS/ABPTvnABOHdz7zfiV3TS3V/okSf6iq9VTJ2gKwPUGrpikq5MyzmDenViN8gz/Ko14cWBOOnyClV1hyPYVM0L8essAhcURkuddjhnUJz51tRqvSI/UDJ9jaFQsCOD+4zdf5QIDbjR/NEwRuTrbgHIxb4RTfsFPurfEl+k/LtSmPdwzx092hqhPtt+mGT+JoRewdztLPfKCxcIl+D2Z6dqybSMVNnT2rc1aTBBFplBcisRS9co13fm0UgKu2rS1EWkcRCEeSLFwCUExc8+4UTxywlBCMXg4Y6ad7VZ54x6LoelO0Xox3vEG92VUoYC4C1NiAbCmFfBjo9GltREPo5CkhDIWnmCLHeDhaEdX8p8hEHs7AGK78n3WX8CC2Dur9ecm5AGEn/CKGX/MeMih5p93LbYwci712cBtIHhSyIy+td0RahJJ3blUX4FK+2yjSDjMMlofJHe/K1N8k3qRAYpH7rNdLOPGwIb2S2DkLrGSR8HL87CoKT+Bii2jBHI/Ea0nyNLO1uIjNXXy9ebY730OQvKiIQ906OIshDFlLoXoXF2d X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b61e4407-f273-48a8-a29f-08d897fed22a X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 02:46:37.8940 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sBMtqSKoq0QX1cWJCbVmCOvcKpD/wSjuAqFxACMt94zBBG/tsaQHvLUKCUc5/EkKIjo5XshuMxylExC3tjgcEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3707 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Fugang Duan The current IP register MAC_HW_Feature1[ADDR64] only defines 32/40/64 bit width, but some SOCs support others like i.MX8MP support 34 bits but it maps to 40 bits width in MAC_HW_Feature1[ADDR64]. So overwrite dma_cap.addr64 according to HW real design. Fixes: 94abdad6974a ("net: ethernet: dwmac: add ethernet glue logic for NXP imx8 chip") Signed-off-by: Fugang Duan Signed-off-by: Joakim Zhang --- drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 9 +-------- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++++++ include/linux/stmmac.h | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c index efef5476a577..223f69da7e95 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c @@ -246,13 +246,7 @@ static int imx_dwmac_probe(struct platform_device *pdev) goto err_parse_dt; } - ret = dma_set_mask_and_coherent(&pdev->dev, - DMA_BIT_MASK(dwmac->ops->addr_width)); - if (ret) { - dev_err(&pdev->dev, "DMA mask set failed\n"); - goto err_dma_mask; - } - + plat_dat->addr64 = dwmac->ops->addr_width; plat_dat->init = imx_dwmac_init; plat_dat->exit = imx_dwmac_exit; plat_dat->fix_mac_speed = imx_dwmac_fix_speed; @@ -272,7 +266,6 @@ static int imx_dwmac_probe(struct platform_device *pdev) err_dwmac_init: err_drv_probe: imx_dwmac_exit(pdev, plat_dat->bsp_priv); -err_dma_mask: err_parse_dt: err_match_data: stmmac_remove_config_dt(pdev, plat_dat); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 03c6995d276a..5b1c12ff98c0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4975,6 +4975,14 @@ int stmmac_dvr_probe(struct device *device, dev_info(priv->device, "SPH feature enabled\n"); } + /* The current IP register MAC_HW_Feature1[ADDR64] only define + * 32/40/64 bit width, but some SOC support others like i.MX8MP + * support 34 bits but it map to 40 bits width in MAC_HW_Feature1[ADDR64]. + * So overwrite dma_cap.addr64 according to HW real design. + */ + if (priv->plat->addr64) + priv->dma_cap.addr64 = priv->plat->addr64; + if (priv->dma_cap.addr64) { ret = dma_set_mask_and_coherent(device, DMA_BIT_MASK(priv->dma_cap.addr64)); diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 628e28903b8b..15ca6b4167cc 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -170,6 +170,7 @@ struct plat_stmmacenet_data { int unicast_filter_entries; int tx_fifo_size; int rx_fifo_size; + u32 addr64; u32 rx_queues_to_use; u32 tx_queues_to_use; u8 rx_sched_algorithm;