From patchwork Mon Dec 7 10:51: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: 11955285 X-Patchwork-Delegate: kuba@kernel.org 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 DDC44C433FE for ; Mon, 7 Dec 2020 10:52:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A769523339 for ; Mon, 7 Dec 2020 10:52:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726456AbgLGKwd (ORCPT ); Mon, 7 Dec 2020 05:52:33 -0500 Received: from mail-db8eur05on2084.outbound.protection.outlook.com ([40.107.20.84]:34337 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726346AbgLGKwc (ORCPT ); Mon, 7 Dec 2020 05:52:32 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EERGnoYdDXuHWcTrg0uYPL//15ypcjS4ox8mMlA7ngsdPeKM74RAgU8GF66xY4De/Ew103tQu0CGFOSdsuDU13yi1ZHoOlanCySXWBV6BMy5MDUQsZT0LAmpwdd3itOiSV93+JftutNbUv0WujrBYhxn2JHvpOIh6lF55OOWcLxUGFjoQAVo3muMLXOLMFgwfvOhAP2S1FTdlnsGAO5YNTGnpheHmENZMmt5AjqpoSX2VaHMHCf+nBscOsohP9LgFepm1mVpJrYsT8H1pxU946FEIFSzTHGE7yoacdsCsQbh7bvq1MV76IEtJK2HstTRhqtWhyhDZ0LYBsBFu8r+bw== 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=aVqmpTBNFrkEfxzI96UejD1R0xLaOTZme8rH1eVfXg8myParFr67K8U0V/8Aes6MWwRfrh/MjnTC4IUxzCTRwqj3FtaHvdcV4yOtSEePWBND9WszDMdskcG1yEP4d/2c0IeWF8wTPMscYlfIv3NfObjvjoXjXRbhq1uWsbZnk4qqrVMRpTgZeUAsvzJUJrZv5Sewe+XLTJM+dnXPuOpTwcN9TiQXvxQoZxdr7BzvYU1mMP6pac0Awrjhr/VUlR95BELV7o2NbEt1W/+zmlvZRKMh2omWtHLaTHhOTzhF5gULHnLxtjvagk1VWTGCD1SIUvwKyryND6oJIaRCkNOGuA== 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=lPmGN19/YZoxkt5ji/lHJUHx3MqeEMLaK+4eC4AJiR3lS4t3TRGqzwoCrsnFz3k4Xk2POjbgxC2z/ZW3/80WoBHEvPGuHcpWYk7eAk1xj2opy/fceRlCZXkXgnpzmE0+ZnGDIeuImPCHSBdE8zWfDMpE5bYzfkS8ppDTpkiJ9iI= 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 DB6PR0401MB2328.eurprd04.prod.outlook.com (2603:10a6:4:46::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.21; Mon, 7 Dec 2020 10:51:30 +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.023; Mon, 7 Dec 2020 10:51:30 +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 V3 1/5] net: stmmac: increase the timeout for dma reset Date: Mon, 7 Dec 2020 18:51:37 +0800 Message-Id: <20201207105141.12550-2-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201207105141.12550-1-qiangqing.zhang@nxp.com> References: <20201207105141.12550-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR0601CA0018.apcprd06.prod.outlook.com (2603:1096:3::28) 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 SG2PR0601CA0018.apcprd06.prod.outlook.com (2603:1096:3::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Mon, 7 Dec 2020 10:51:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e6928c28-e007-40f1-b23d-08d89a9e0df3 X-MS-TrafficTypeDiagnostic: DB6PR0401MB2328: 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: IgMRqIeDPJioKEFrWIhlTAUfif234NgutSM3LLCeniAY4URpLFCuWsC14xUz6++urkuZKOEX4D8kTN1Qd6YqTcjJKYn48LxdeXO4EyX1hKsz/xi0nrvLAg2nwaQsVjo8bA1Vx/mugGmhIJqbUcO2YpYZqsERL9BXMJwtt4eUA+d7A5GTlrGNk4d3ChUSpiJAJ5uONu2f1TuJQty1sHjXuqyIUkHCtTByM49l7wPCtaNT7LVQF/JbSWSSKW5AAiqNNb8lMrFgbUR2iCErRYYzS9LemwlPyvlU0uIEbpHOZve35VoK6DJXo0sxtd1DYYFoUnBpjt8jSThtYoOcAU5PllcJrZyrOpX7Kb2bYm8VUV0m/AccZSLYoTtafIFblAGX 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)(366004)(39860400002)(396003)(346002)(136003)(376002)(66556008)(66476007)(6486002)(186003)(956004)(16526019)(6506007)(8936002)(1076003)(86362001)(26005)(4326008)(8676002)(66946007)(316002)(83380400001)(2906002)(52116002)(478600001)(69590400008)(5660300002)(6512007)(4744005)(6666004)(36756003)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 6qZ/GnBLR5IzLNwf2T0RRGiepbAoZSLzztXGR34s1BUseuQngYt7Q7mrj3bVp2UitlMorLL6eVOOU5AYEkJT9ZwzT2h/s8gNaJU+DKdPEbu1zaQjHp27u/TIDjzbbiIVqKvHqKprD3eUozpRgLdE1+Y7Uru/YkOqkPKd0pc8NhnjklRYI9IgLWRR771unuBxCfiCtvQldACp6eNQW9l7O+5XTuFGPj17LjRvVAeM6CjdquV7TQNxuiuEAvgS4guy0sn27zV4gXsPangoKPvYUC8hR1U/7LflKbNiePCZb+lzd9HlwfheWPbIU1P5SMSD1zX1WcgzdShRim8c+VCuK+RaaXHftnEttrN6YC5YpnHzEjmQVgi4dCCVDa9jwjzfIQzAHUAxEcpfwDlH1afMIKeO890TPLx5XGFGyHx/Ik3oNUITkINo2WWJ0+wZ/7uSKBwPfnUSOFE9dBEAiuCK68Z9D/Mp4A9hMHGq/bqRRnoseTBKmfPAHZs5Erwam7KkjXRQYzSrGfp2taT5ytRsD043GJa9Zx5GpxQiLjnVZDUqfpheXnnjeojPgmMUJd6BKFZ23YyTGIhV8cEAy7mOZcWGBRCHbJ7m6Hncw25QYZ391RtwOIIe9AL9QnHPdWf2RUfT+NtvpvHxHyI0E7sCm87q4b1zq8Pp89Rx0APbJatwHn2rLGt425QH3NIx9fMFlVp6AalbyMgD4gDBMv4iXAyhiwDlysSj3npFMFx+HZ656Z8pDChKWHrUBxR66I9KCLx58xVNf+3aBOnGVatD20NFB6oYb4p1NW+vhP5X0v5Oin55VxWkhq1mmW4RcE9XtsegE70n4uWUidZol+k1Uf2JA/5RjWcF1TQ52OeBaGi1EwhAvbgIhf9EGkNPYoI3tiH5a+niwj0hK28U7q4hnrqgqumUZL6o8+Ly2DrGWHoo1fEhoDZJd0fzhtAEZMJXauRkLNh+GCZ0yAHTHaTDCVgJQcBSMVdRYrEhf9ctq8NdE57YVV6MWZ0oQ3mbBo1e X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6928c28-e007-40f1-b23d-08d89a9e0df3 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2020 10:51:30.5706 (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: +cC/JPlagM/MlRmrecUgFky7miuP3yCH69YONPMzovjIxOuJRXA1XlOLhp/+64OVT97lKnayIoG2BgDhrDzg4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2328 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 Mon Dec 7 10:51: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: 11955291 X-Patchwork-Delegate: kuba@kernel.org 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 25F43C433FE for ; Mon, 7 Dec 2020 10:53:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE8FA23339 for ; Mon, 7 Dec 2020 10:53:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726524AbgLGKxD (ORCPT ); Mon, 7 Dec 2020 05:53:03 -0500 Received: from mail-db8eur05on2040.outbound.protection.outlook.com ([40.107.20.40]:45665 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726254AbgLGKxC (ORCPT ); Mon, 7 Dec 2020 05:53:02 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ht4tBIF2RzKQJtCyqAaJa9xc/YIh5/Uipc5Y27QmCR68D717MWJMEDWUfZ23iUJAHl6uKQSanfxIocUQtPVJ1RRh7VhX2xYwaEoLce32rI8IyDcRjnxH19+2yxn0I4AbUqkKfZXp6PfONSAoEJ5X0gaCNY29L+drX3U+goeROWfiC0kK5C+K1b2SoCF3Alu8oU5Vtp2Qbo9rlNPUXHAHN4LTaXdMMzGMFzr/sYxhe7qr7OqCJ3UZwYTO+hwGrkq4ioV3VXbqf00quROwgtP8bwGGJx1qA3iIpA6zo27kfmjRYibu3IA3ZvTFJY+UsMIAp3Oi/aEAqyr/eKK79JrU8g== 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=Gm0cGqJ25vmOmxC3QOO04sjnIKhgRfNY29lKWlSTcMo=; b=JAD21XOcWS+B3kB469KjzGNtC78a+A004WNhF0RjoS0R+U4K2fzbfO/tvCUf+vsN0J+yfah59b0+4E1vGfO8qJGM/AAJkHh5IY5s9eu7E7ZEfksy64/BXym48MR+prCheqeScdQdtBXqAm91kvYaqhI606UT0dMYJ59x9B22Rv/Drg/FFkobpG3Epl9PYbAoiTSUEUB7OkRvOEZWcPE+2qMbPqzde8lovn0K8GRolboaS0n0oDE27+nn8DWEWlG58cXvNKtmcGkP5kTySMDYf0H4cVYNJ1wV5DqZ0PJpc0YWPB1Q5wvkMjS4De6KSi/Q5R8BqOzW1Q2i7WrQIzHqLg== 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=Gm0cGqJ25vmOmxC3QOO04sjnIKhgRfNY29lKWlSTcMo=; b=fcKYRWexCFSAUDeTvpwG3XmufgZH/VkZDhgQKuBqUJIuXztG8R39K4aocVCRnItlhlHhgj3Z3sDk8bkeCUqP7CTrkiinHcjyjq74t7v0Jxz6669zddYivCBL8T+22LoWGfQxq1K3YxAM6FqysNANMWdsdTNraYkAvsQepyVYoHU= 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 DB6PR0401MB2328.eurprd04.prod.outlook.com (2603:10a6:4:46::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.21; Mon, 7 Dec 2020 10:51:33 +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.023; Mon, 7 Dec 2020 10:51:33 +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 V3 2/5] net: stmmac: start phylink instance before stmmac_hw_setup() Date: Mon, 7 Dec 2020 18:51:38 +0800 Message-Id: <20201207105141.12550-3-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201207105141.12550-1-qiangqing.zhang@nxp.com> References: <20201207105141.12550-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR0601CA0018.apcprd06.prod.outlook.com (2603:1096:3::28) 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 SG2PR0601CA0018.apcprd06.prod.outlook.com (2603:1096:3::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Mon, 7 Dec 2020 10:51:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4e46c1d2-637f-4747-0679-08d89a9e0fb9 X-MS-TrafficTypeDiagnostic: DB6PR0401MB2328: 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: baWH0KEzkneAJk8SjMxGFLaD1R3xtCRDf5ml/aDzhXlCgoPPFSaDJHu9QsV3GLhLjRrxXwO7yeBLh2bjgF6IYR0nUQbWUqpoL7F6Pe00KPhd2ZsNkwCSAU40SgEDZ8XFUoN1DtlVcptbOoYEJh5TFpKXNcu20bqN38anYl9wai4KwiEyQqY3x3jmL0mQj6wIjck3QqnkZI1/3HwPuXQr3+xE5wppxhUkvBxA+5OYBwNVXzfy/UiOfUezchMibDG5pcma9Ja3qDEmZusRWm/LTpSYUB/IaoOBRjozyKYViVgMuj+0zP/IwSN3UyG/L9uofZ2WcXjVjCHe7QMC/jBtRt7reiPa2P+yb2oZKREKspgd4xpjV6lMN8azqfPYylSb 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)(366004)(39860400002)(396003)(346002)(136003)(376002)(66556008)(66476007)(6486002)(186003)(956004)(16526019)(6506007)(8936002)(1076003)(86362001)(26005)(4326008)(8676002)(66946007)(316002)(83380400001)(2906002)(52116002)(478600001)(69590400008)(5660300002)(6512007)(36756003)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: NfOhKy+d016AnizFN51YMlup8yj/L9ubGLaYtZqtFDA5KncdH2QgoMdmsy8suYYgJ8XIirhFYSsXnaWT9YvgjedviHZ7Ix5z/obEMBu5ZTd4FjuLC7u4pHIVCg1BGiLofrj9aRS+vPCQc7zRpR+FxDKtphwRF6O2f0QYyOFmPj7sU2S92ooG8+3Rakb2kfPjthAK340KpKC2MaF2jC3tckLNPpO6wF6ivY17uS6mK2GxveOZ3dZMiJzLoTwGHHVhqv/dgknFSa5fXV2QBo8rfrYBE1uZ7XpDVhdwn+kFNJYBNDvnuhysDEJQf2yljQJHVJOS3Rl5tLpEXyNz+YVVd9PRTKjZz2RKGzs+lpFHdfeYCTxl1nJIk4+RLQSTuarPXULd8lYnQ+pV5lJzjPUoQ+xC83sG26RyNqFV0DxmswyHctnQUd2wCAOZy+bF1dKa+JbAEO9wGNEl2ZG3r87yyHNnRGQd9Bi6oE4clFhO/OlxYqv2+qO1AzKD5JYnwkzCucswGFCaMqK+CDgDAJ3L1c2SEO4vElUy7LeqNZGtGjYi4NjwXr9FCaJuGyjeYCfBw5V4nEeTMlKy5OfaVx8akb044Peya/jNCuHFgJ9hiMmrPv5ltJLW1/z7QdqYiRp/FUxsvU02ujuObKUJlYmeXC20AC14xxSIJwxMvs3vrv/z5um4NrQW38h8bCXWHEf0RkTUk1lecOGsJnUaJXHbi8jDYgGdxXwsWUDJeGVmiJRROcUN4Mgk161pQYQx1YbxvybJX/tB+ClcbF7lHybEUSnFny7VfuLGBxGJ0UjtU1Q8qaAJUE3TWvgZmdQmqpmjQyJlLjG7e9erIrRa70WliQaBm+UNjsH/uCfNftKMOnjCIKINoGVnNeU6DBXdN/Dbx4kU35X2TCVpI9TgVsV/HOrdPdfLUcShlvH3WBCTEkxpPsQWF1fbloV4Dx3OYmF6udZFc/f6uzHpxua/1WNJADpdDYQiMT+VLcU4PJWz+lhRm6nUl9JP9yBkdRkgDZ1j X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e46c1d2-637f-4747-0679-08d89a9e0fb9 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2020 10:51:33.4101 (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: RgA4XyVztX2uEN+qxfT/2CC2t9HTKftnm4w/1UvNI3Qe3O+/7JvbNv6JFJ3lzWcMzFrNKy59Qhywo2kPrBJ3HQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2328 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 ba45fe237512..0cef414f1289 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5247,6 +5247,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); @@ -5265,14 +5273,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 Mon Dec 7 10:51:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 11955287 X-Patchwork-Delegate: kuba@kernel.org 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 0CFAEC433FE for ; Mon, 7 Dec 2020 10:52:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AAEB823340 for ; Mon, 7 Dec 2020 10:52:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726506AbgLGKwn (ORCPT ); Mon, 7 Dec 2020 05:52:43 -0500 Received: from mail-db8eur05on2057.outbound.protection.outlook.com ([40.107.20.57]:27758 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726320AbgLGKwm (ORCPT ); Mon, 7 Dec 2020 05:52:42 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iss7yf3/4nLMUpOVrb2M4r08vIE1BhLe4tlybShoA19y8hiaLfA6iJ9+Rg1cF3VLWvlVN/Uyoi5djG1zkXEfY+NP+krwCq5FXnxPWnTvM5ZOZGiQSxKaLGuWWbHcJJvuGFI2IG5uKzCE0omvfLZd5GWI+coTo065+vLkI8h+8aYyiS/kViLlj67EYZTEmsilHhEmZn9cEW/vaw6m4yWhqIIj6yau3d6E7Bi4dSVnuMthD7CYPDcOWq0CgKIi/1kv/wMjsAt0qNv3hBkFkOFwnI3DEchhWa/lzpBfKpzNCNCy9Fvna8x3+fqtjX5xKeqe4dGVfT7tJ2BorSpEh41T0A== 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=kfmJJvxpcTdxHvvAwCBkAl2RjPods4f4wLpMXPMKVyc=; b=GK5P7OEYejkJkXlP69TFLDGgicfL1LhMWoinjyfha5LeQNOzlqK6NmoxhnmmVh6DYCxeEUqlaJth6j0mSO1NKUXDmmDSqAwS06GX1Y+hRhYJdOQaKoMC4hbU2j400YBqPDi+ulXNybNyX+Tklgm0zcsFHLWytokeQ8IwmOSheVSUoogMbA45J7IS9kY1HUCxSHmLE9iRU/krEMAH1qvRd+KbJSiOXqMjIP1RWx3cQldDsAwaZ0TA26kvt9e3FjScxHMWuTNqMQ9Ot+RGHssIg7xl1FDarwzosENc4t3lKD5B82u84tT81r2bv22RA3xFurhhpYKejM7UTWswRcsyAg== 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=kfmJJvxpcTdxHvvAwCBkAl2RjPods4f4wLpMXPMKVyc=; b=bbcReuwjQvJZEYWqHuV2mrNmQXpBZ59OsK91N+UsVuBK7zwli/+RQWhWrSKc36F8ZFYFTyUzm/uYC5AtazKS1TQqtxNuOJ8r+5LH2F4OlpDaz4917XplPRdS7CDZaxNXSnQxMAKHphNmQqmGimHC9E2McE4Hl4hS2SoB4gNArbg= 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 DB6PR0401MB2328.eurprd04.prod.outlook.com (2603:10a6:4:46::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.21; Mon, 7 Dec 2020 10:51:36 +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.023; Mon, 7 Dec 2020 10:51:36 +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 V3 3/5] net: stmmac: free tx skb buffer in stmmac_resume() Date: Mon, 7 Dec 2020 18:51:39 +0800 Message-Id: <20201207105141.12550-4-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201207105141.12550-1-qiangqing.zhang@nxp.com> References: <20201207105141.12550-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR0601CA0018.apcprd06.prod.outlook.com (2603:1096:3::28) 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 SG2PR0601CA0018.apcprd06.prod.outlook.com (2603:1096:3::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Mon, 7 Dec 2020 10:51:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c95e2b6b-6606-44ab-32ec-08d89a9e1166 X-MS-TrafficTypeDiagnostic: DB6PR0401MB2328: 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: ZiUoX3SkCZFyKAvxCwbgUS17nlgQBAf8zL1xPmvT1yuAqMSfZMoWNjJJHaYaKO4ZvXFfk0zYQeB4miZDZGCBe4YIyqRbNtof3EyaI+tkJ3Nk9SNRSNo9RDSIO0S3OyZDCQ001VV8BlofVov02J/GpgFPhVsDwOpbGG+Ftpj2KsOFUmVXN7nnOBs1Ydbm1Hc0xJ9hbbK+wgl7yB0HNhi7M1To+RqIP4d4QnKHXkFLDxb/lNUIbZK1L9kVQFD6rf4GPbni8OpUhU1iP1H5sLrH98S7akYjszWwLg0i4LYjBfYSPhLeDgWRPMAz6BGwQ0vGZ5lmCh81SEO1WnjUpAY32SGbcWdHiQbRb31qlfbMVl8NhvD2cqbFBrT6YEjKZoMY 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)(366004)(39860400002)(396003)(346002)(136003)(376002)(66556008)(45080400002)(66476007)(6486002)(186003)(956004)(16526019)(6506007)(8936002)(1076003)(86362001)(26005)(4326008)(8676002)(66946007)(316002)(83380400001)(2906002)(52116002)(478600001)(69590400008)(5660300002)(6512007)(36756003)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: rkI93DfEdzIiW9kupi8Kffw55Kjpv7FADmCKJPAFvSLAfbkNqV4lOAjSvh20dNBSU3ZZI6Sw8+upd/zApHK+bKIMp4ja6eDMYdmi6ShZfy7o5gMs0wY0IPx3jnHLfW9glGwttns/NS8wTPkdRgRF03cOHtTgGn0MzBM0o30EliakJz5XEwtq/kHeQqpOb+tErf543yNq3qeMOOUhnF8+O1R6YhxydB8iyynt6NBDpQL0uTEIlzRxf6OwiZt8Pm4053rvig1YvgfN3WcK+42hnNJP+fMLFKoK7WxNuA25AxNdQD42YRBFih/bG0SDodfYIh2lSAKEWZVYN6ODN6s3yBKLEU92q9Kq+j9qQEUIiZ6sAM8HoXAuru9++QdpjezrQQjPN03zUnKGXBhyWCzzj9lNYm/FEzhmmpDiXhKknYA+IdRjhbllQhBQWQqgIOv6LhTWopfBMhKHlL20hdav3TMHKwh7T0/dhLxejqD8vMXAu+F/4imi9DtO+9VSr2/fg7Zcz2hfbNRNoEDlyRypkZ6nYwv2+qs2zQmea2IjFrl7W2oSDvqUi5nN0fpRi5WXS58nHbjMXRFd1cc5IFYL+aGYTVPGhCvy5UDNpAlqZl3hCxuTvFXxDT4lKf4nLnPizIeFRJNtNK75zVKGvv/Lqw1IkCiZsMKK+51xwyqq4TXgQQLdZ/2XV61j1hxmKzEJpqgmoTHbFDWroK9aj+KoKGpi1kOfhGTkVt96eo1NU6WDlEkSzK6jOKTRfT5baEMTSFhkTTz6z3s0VuuVe23ru9OBrXCxYFUpgkx1YHnoxA6i7J7FCzZ+DXivXIlHPG1h/IHh/uvtxjdcx/b/nkGnMoaeRMdojcpKH3zEF80FFHcNYfoj7ur5u+70gHXZkb+3SLRrK/w2+fYVKOM5dFJGHmHcy3MlA58UaN7SNndHR8+JDvH9qEgZWnGbdQvXI/hpvLboU0F+7lODxk9mJB+asiimxyL4o/xyqskvUdU5JZk8+uU+onh6FSzdJX3+LI4J X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c95e2b6b-6606-44ab-32ec-08d89a9e1166 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2020 10:51:36.2327 (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: fWV15BoFXLHFCoi/BPYY4m0oi6xgNu085pJ4qUI3saEZNU46Pv+FJJZefgKoWnKkjyFZabNjct05pdO5MeGW+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2328 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 0cef414f1289..7452f3c1cab9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1533,6 +1533,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 @@ -5260,6 +5273,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 Mon Dec 7 10:51:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 11955289 X-Patchwork-Delegate: kuba@kernel.org 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 4E8FFC433FE for ; Mon, 7 Dec 2020 10:52:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15B4B23340 for ; Mon, 7 Dec 2020 10:52:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726417AbgLGKwz (ORCPT ); Mon, 7 Dec 2020 05:52:55 -0500 Received: from mail-db8eur05on2084.outbound.protection.outlook.com ([40.107.20.84]:34337 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726254AbgLGKwz (ORCPT ); Mon, 7 Dec 2020 05:52:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xbtg1M22eAxLUqWWcFuaEL4IKtnqGc1LqKZx0yMhYCUXQRCyEeaBmNZ3EPP0i+p9YAin4Nj8Y6AyHlGZYS240+COCGHn4ATu8S29v3nQ/X2WG9gjjpMhJBpQmRjQvoZwf4VpS9Ck1fmexnvrrqQE1FNDyjF5ZlVD5AX8g3bE6QysRJV8RH+f6I/lYhQfcGoQD8uXZtZDdeX+ax8U2Kp2cTiEzesl7+BkIT1UZ5sxtIU2Fmunj4mSAXEUzQoLAhtRvHVqw6tEsvT973+hVVXyysLORzTWqWgocj6HCEFDfo1y/3H+in4/CZEXiqBHgEOkvm8cMF3WZ6LfH0vo7fPe9A== 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=GzDPwhdyu71mVieaZyBRqDf9erJKSQi54+AsIZn48YI=; b=DzcBYvfsIab6v0rhrna+xI9D4lA65CW5GPqSf6W0opJL1SKlE9nGJqig6GZuMgxjBwXiEZjaDyq5T2HfF0yRr9E8LsOOcWDo0SYXjq7/zxtwmN9TABh/QKaQeESjA1eMdgbgy/KI1fIes1j9nElchr9XvSLb77HnDIw4pbBdSebfSXVoZm/Ut/hvZAf3OCk1+ZEABwWzyg+++czmerkcsvUi1idi4+w+DJI3abbPpOtYkI1MDW2NTDjH19xHNSvTH3fa8zGD4Y575TajnjIIlWuJRs5amrjJX6au73mC5VzBB7iwZw+zhU7OE8k1HwqVLaaCtyctRXf8jrugj5JfBg== 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=GzDPwhdyu71mVieaZyBRqDf9erJKSQi54+AsIZn48YI=; b=Us3xx48OljpxNOXM69ayfK3CMom7fNA9L6VHKQoHpvqIKbr6BkXhprfmkwh80wiu4xg0Wsz4uXIvyhdQ6vZzckHlk0rkNS47FTzZ/w8wS+Qm8TNsYKzy1pPoLoXF4rdwnao0sn7n8ex7YL4ScHKlMB6YFXXdnIKhlSmzWF12TWQ= 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 DB6PR0401MB2328.eurprd04.prod.outlook.com (2603:10a6:4:46::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.21; Mon, 7 Dec 2020 10:51:39 +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.023; Mon, 7 Dec 2020 10:51:39 +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 V3 4/5] net: stmmac: delete the eee_ctrl_timer after napi disabled Date: Mon, 7 Dec 2020 18:51:40 +0800 Message-Id: <20201207105141.12550-5-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201207105141.12550-1-qiangqing.zhang@nxp.com> References: <20201207105141.12550-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR0601CA0018.apcprd06.prod.outlook.com (2603:1096:3::28) 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 SG2PR0601CA0018.apcprd06.prod.outlook.com (2603:1096:3::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Mon, 7 Dec 2020 10:51:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a19804dd-64e7-4418-1b6b-08d89a9e1316 X-MS-TrafficTypeDiagnostic: DB6PR0401MB2328: 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: j50NmpUjRWAjTykg6c3Z6sp73G1RInpoEeuxWCGttks6X4dbstZ/se0wQL170GV9EufWjdslEYpfLhiAgVDfSgxMmjbjoqBwYObRGq7WUGXf6vVuSAjIUf3iJLPYv+b3wjqA9549m6ALJ98N4XjrU3a6CnvaVj3OnhnRGFACp8A9xO/z2yU37/EpbwOJcDPFb9bk+G7mE8XHfyYKAPn03g2N0jD/AhVa8kppcisFY1N8G4h19vsbhDSFFxap4+YLJbXRutuoUQQdZ/JfcmvSzGHS0jUxBwLCohHzBY2QVw8y81O5T62HCwb5MObMgk7zJ06ULiP9bqghjUIOQ+L2hyu858k/Dbe7F29gFaO/uA60S79XIBB4lGmicAXo3++4 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)(366004)(39860400002)(396003)(346002)(136003)(376002)(66556008)(66476007)(6486002)(186003)(956004)(16526019)(6506007)(8936002)(1076003)(86362001)(26005)(4326008)(8676002)(66946007)(316002)(83380400001)(2906002)(52116002)(478600001)(69590400008)(5660300002)(6512007)(6666004)(36756003)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 5EsQp6jviOkQzVVV94fpbReSyR9oi4Pp+Lvx68kTRzd4Odtkw4IKvlW+IGSBANcphfOW5bL9YHCaCl2Ggu0XpKGg5Ar3pCHNzvdTbyFFEYSJzfE5uIBEjISamUu/MZvXQsiQ0yQbMjLcOxUGSu/PjpoazF+uybAn7/fYNC01lXO9sfKY50H8dEV0WtfZbwXprm0P+M7NqsYNl4H5+WD+SkxSO/d/CP/5vrFNdFn5Z10v8wW0y+4oDEkrAM+xuqLqYNmZnR1ZlhaRB1SvVZvc8W58pwQYlPG+6mOuZEykuHXoLqDR07vruPlaXHQV6fnbJbSU7PprIXXdNMq+mX2VX2jSPwvJjUrsIv2dwo5Mv5JaTGyy23Xk2lbzy3n6P1gx66KZcebAq9IolLvB9NWsc1nxra+2xYcCRizDB4bXshBIJ3uH8tjzzW0NahKBeCYmq+s5uSGpC2lqFtU2qjOk9Y/rZVsFqWUQjRwNrtRwVq4NdXlrSNgTZWP5UATyV5OoVWatBQoff1rS2OZEZoz2joCgPH5AJRHXrTPfAKCe+mxmeK07ZVBE9LvNzOBwkXSEdq0w/KFuekWHdjEK3gQJo6rc8kJ+y4rmbTPEtUDWgiJU97DBpW1dYEJU2SvIGxUCXhOcagqXCm6KxI72x1m6+gy3zsl1OlKM55mYibx3/TPcuGid133eZHhl2B8ROOn2mvWGYbeq/DZLi1KG3BdUqpYAXjRlBXXZPi2poN2Xmsh3oIHmxY4yadA7l8jDUoEIOFeua9BxzaNaaa37FCEZevD6JcI5jIn51xyGY1UHujeaqfvB5uMUrcuNiHZGH3vbz5sW2sjuPab3Gr1q48C3YwTz7Q59zyB9FXV/b5auUiX5OafT9xnf4A1DvQk0nYMCOuVTydighBeWPbwTmsnOwaSyF45h9M+Ou67+h3Xpavuk7icWgl4DSE2fxm7/GeuFGD79PwyWjdhrl9abpNAKHornOszFlXnmGB5VpYo62ka6YNCn89qGFtY47Ya8UyUm X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a19804dd-64e7-4418-1b6b-08d89a9e1316 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2020 10:51:39.1040 (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: fARApCz95SwAFXF+aUTmZAlogGakq879syhWG2A90DZKFnKOKV416odEQ+/45ngnusJchSTWGWzWK2BJToKlhg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2328 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 7452f3c1cab9..d2521ebb8217 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2908,9 +2908,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 */ @@ -2929,6 +2926,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); @@ -5155,6 +5157,11 @@ int stmmac_suspend(struct device *dev) for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) del_timer_sync(&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 Mon Dec 7 10:51:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 11955293 X-Patchwork-Delegate: kuba@kernel.org 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 0D52DC4361B for ; Mon, 7 Dec 2020 10:53:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5A7623340 for ; Mon, 7 Dec 2020 10:53:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726384AbgLGKxG (ORCPT ); Mon, 7 Dec 2020 05:53:06 -0500 Received: from mail-db8eur05on2057.outbound.protection.outlook.com ([40.107.20.57]:27758 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726480AbgLGKxF (ORCPT ); Mon, 7 Dec 2020 05:53:05 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QoqOVLrUgZTbpSVjLcrM/lKNiKecEPmJ2fRIkUYBx3C3ZCH3tZtpf9yS3KkGJzhtdp9Eay7oWw2UYDnhK30R2UCaITILJ6FbQDg3DMJE3IT1XZ4mxYEkLa93Jfb8RZGIm/e3y13FTIkFgW3w5hhbriEKpm8tQavk4F4G85j0OwMWi2kKuluAIJ6AVa1ASyapjxPJMKMLYK5K6Piy8p0lGB0nTvg7TDkQeW3NWg7pLliANw4+UTjdQW2q5tG9wUV479dn9jPlfF+UxjWMvCkHFnt809MphGdFdK6vsoATmAxWt6ShLylVLI93YMzCT4j8yHQtXoWiFvEFvQEBocT9PA== 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=78exCnGjJAAEKlouXkm7QU3nrpOEJkK++3fT/BbDEj4=; b=kQ7rigJDiECMyUP16Jss/mWpGEe1RNEwyr8AzogEVVBmKcL6q279xRNVFIa13s2JtYqT4XEvyzDN3AOB6NYpXnLX0M65SQtR8gR41UUB1A49/FLBpBPTTOLSaOXpGAvIhBkZ2r45OpV73IrQ9QzT8bEyn+vhRPcAf9I9qKsbQp78Ibl3P5Qy2ZoIjeG0YdoCuB4fQXkluxAJ67l9Gl03aQrSMQi0ZNbz+OPqvRKf+7cDMAWzjRDBb1P4DnwkD25z9Kb5BAdn0xm86NSb0FZX0JsC3RLmEmvsLgf5Qje21A/4tAyVZlK7cJFhy4wO94haZ4vZckN8jcoiF93M2FBaCw== 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=78exCnGjJAAEKlouXkm7QU3nrpOEJkK++3fT/BbDEj4=; b=N13FL6VHyov/Sd4Hxd3Kb67gdRYcdz9IrMTlQEzvCcTpVOZHAPBfcFFHU1NNyzOgDIXnX81rMk/GY9dEe4ngNNFrcq6Jag3oqvwFJBrIe4naL2ZWPGVcq+wsk52B9sxsQgPaq5oB48pXfEqJGEhPbdeiKJqr+dofM0TNkZJeMVI= 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 DB6PR0401MB2328.eurprd04.prod.outlook.com (2603:10a6:4:46::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.21; Mon, 7 Dec 2020 10:51:41 +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.023; Mon, 7 Dec 2020 10:51:41 +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 V3 5/5] net: stmmac: overwrite the dma_cap.addr64 according to HW design Date: Mon, 7 Dec 2020 18:51:41 +0800 Message-Id: <20201207105141.12550-6-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201207105141.12550-1-qiangqing.zhang@nxp.com> References: <20201207105141.12550-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR0601CA0018.apcprd06.prod.outlook.com (2603:1096:3::28) 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 SG2PR0601CA0018.apcprd06.prod.outlook.com (2603:1096:3::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Mon, 7 Dec 2020 10:51:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 92aadb24-1f1a-4071-2474-08d89a9e14c8 X-MS-TrafficTypeDiagnostic: DB6PR0401MB2328: 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: 4u7jRM4I5ZHd/wtB1zfpgZTIYJl733w2Tr++jgypXUBYTOpYhaLgzrU/mZnEcmt/NIISpw8qxr1EQm1ThXy2F/1lvfqkfvf8yJGlWhych7x4OAoFTCxUtDHHzC/VdnCbt9dhW5pPQmN7l3zivxrObUvBN3vIxc90nubEv/NzZI7ip8OxtrW2pbt62xnFA5HmcgIDbN5vdHMYnIKeq94cHPdeneU6jKr0EboO6uqctyKpzirxOF+bbAIKaFgIr7suBZo0z6OdEANblHDVoRuyh+9dGKxqSTAWclvBBUacMMcKxGcOzDEr3PHMrYzFIVJLIGNElpVh6tZfY2giTT9cvqICG1lnQFAVlyPMX5mjz6vXpCneeh77RhBRx4IcagQ2 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)(366004)(39860400002)(396003)(346002)(136003)(376002)(66556008)(66476007)(6486002)(186003)(956004)(16526019)(6506007)(8936002)(1076003)(86362001)(26005)(4326008)(8676002)(66946007)(316002)(83380400001)(2906002)(52116002)(478600001)(69590400008)(5660300002)(6512007)(6666004)(36756003)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: nu9aA+CEdEict4Sycz2tSooaxfz6WlIH0/f6H/RCfRlV8iLuhr/jAlTOZ018FRH3vcPzqp6/kObVS1mFsf+gb46z8nCPTgrBr3Ic5CmNcB3eOjm6dmkeYmToDOffliBaYLvMAnVI/ovEllXa3PNRBFA75gY6qhPhhRDYkT/UhKlKYKCGferMJ5KZjUXS8aWH3UendjJiZH7RAIA1zW8Hh+q8Z2mz4HEcgkJ4AkoM3Syx9TlTWHITf9F3lGm4iF4f1s2+5qg9fNMq1JcieVZvuPp1QiD0n22l9y9Jt3B99rqJEicGQ/FEEw5fU6Pb5jvdLAUOcFpBTYGBebR3sAxq+19qo1uUCZ2o3mdHSZaUKTvWHg6zlXDwjLhlMNcyLdvl/oOaQ7m1jXFimKZWl4qcBlU4Ca/BHszWz6NH7PBmObZjgcGO+bsEAyOz46OauaDE/o35oL2g8uB1TShSdLUICMZgsXvgPFtWdJoLWjYdfKk00z1gwdJxttkPMz6a6+bPs0r7Z38jd1dD7+3nj2ompZ/SkWKaxXGsEsBKHaP2bOocAM7Ou7wMJYdsB06WISFsNebZKyd1DBadPMwsncUMNMSn+mR5Xm6widywTyyYb7D+VacbtMY7VrYn1L5nsHaexHarSaopyTjg/inlwM6QsZbPYoGowoAJ/xJVX/wZPlKIBSNupmJR5BkiZ70qvOtudGfmRwGjYR3TzOVrPzK0PRJTTSXM918EU8QuAnKwfW0AQfZR91EXfakJyDkowCM89uynyFnFGtXbh7GvBsqOgF7R3EBvetes2wUTdVf3URhErzsNx3ahNRrX0FDFyOAW6fYoVp+sFAcHNSeQ7v2pTIFapgb4brGEk4BedHhHHzAGv3HG2WL9muj+BigZL4MCdxfcOCMKt5/AcQiFI6nHYWLzGlGlo4HxVtqwOqk35V7T0UgCOKr8Tc+j0Ojo6xj3s6hlzWv5C/c+WslTNX1APxAbiwLpu9ZJukORIffO3Pe1/lI+DesM0nfQmRYNVi7B X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92aadb24-1f1a-4071-2474-08d89a9e14c8 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2020 10:51:41.8968 (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: MjrBmoXf47/4sCAWx0OoddmoHlRAKIqHevSv41W127V1Aryvim3RFjfjOVdycHGofc8uWhglcdUClcM8gQDz2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2328 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 d2521ebb8217..c33db79cdd0a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4945,6 +4945,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;