From patchwork Thu Aug 5 07:46:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 12420543 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 CF330C4338F for ; Thu, 5 Aug 2021 07:49:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 944646105A for ; Thu, 5 Aug 2021 07:49:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 944646105A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KON3E0Vz3vsBAURlvDK7F/RnbizOPEsL2OJqWt16JQ8=; b=sbW5GTaSCej287 IvCNaUg32ckUMQkPexn/JUnREbNo+D9MdDZIJ1IY0vG7q6hdt9ULl9az0CYExDTHqYH+Tti0hVEuR wfKWLAqkp8JeqRPD6Z/qR8ODYtLGvjRFAqYNhJhPvZl1RPF3J44sA58CyOyuMX2v7Plcy2NQ7wpms yT31w3a8bZJ1lw77OyUOLeXKl9saH7peWk0yEr4XDRYJnSQOmxvifDd/UyBjR2HwKh23VbAko4nEb rkw0JKrp48ZpGLGXWxGNxYSzrWjD0rC2b3AJNTJ0/19/Tv3yUiz7eTes0L2631+L1qZksRWTrUgoS Y+u+Qg1U5XjZR6QXyoQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mBY6A-008SS3-7b; Thu, 05 Aug 2021 07:47:26 +0000 Received: from mail-eopbgr60088.outbound.protection.outlook.com ([40.107.6.88] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mBY5o-008SOn-LF for linux-arm-kernel@lists.infradead.org; Thu, 05 Aug 2021 07:47:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QYWjV+FtmBNG+yvCNetKr9IF8rd4sUrI9dbKXvm9b53YN813YIN4XxF65HwqSJ91bjHld/oY6FrRRE+aoM5ieN6P0fL+b0TXPXZvbaLkHlKxnLBTVuaR7NIepR1eo/fHgM6MHFBG/u1TmlLFNzfsrEiPH/7iQlstfJ4/iMse2xtbwgMEk53zO5GIyoou8F8o7Rbm11PzsleiBf8jLTOQ6WC9U9jQQLQjZiQY+wpArYKRSzYz0SWEINeeCmPAlW4ddveDuu933c0zlcz3ot1WPOcP0kTYsEOOngmwuuy9nXpPfRa4tz66wY3NPdaE8WxC9hMCfNmZV2v13lZOAzvYtA== 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=+3LBZz64V8Naet+pT0+Bv01e8DPE3/aTQaiv7S8JHlk=; b=MgUr5lmeXe++eL7j3ro4vOPLzvHYAp/z1P3Vo7+i2NhyJmRxFUH/91Ik0I2clgfHfQlvb/1dRfjn4YElYiw+Fx/9svtSkKsa3jQLR92hoY57Z82dvBpnpShmmF6A5aFSVV8HJuLWaw0Uz+4S8nGmkswfZEA/IskEzzYwXdtGMQyt0xjRHKSUy0Y1zh4xlZ3iDvzslrIvTY63Px32bIziETTtTbwmBJ71eV1lHzlTiLaAE7E79J+U764Wctl1g3HlRzvw4jnnIQZ0RqI1B10aoJrbRJYdv2F56tiMJNTZAgesyeCDsBP3Hhh1AwRmqIiP+g9U6/oyvv8hcFcvuCrcjw== 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=+3LBZz64V8Naet+pT0+Bv01e8DPE3/aTQaiv7S8JHlk=; b=gvE/bxMbl2j0Cx20tUlbmGUmK17pmDP50Iy0A6y4ssl3HBT+qkrVGKx+IFbVOrOkZSYu2+zE2pSFIDxNCI05yds6eZaU+7sEJG14Y/DU8zTu8LuyriBIwp/kzSc/pIO7bjDdpejXpE9DGMPVC8nDs5MW9p3AcGHju5BCuZfAlpw= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DBBPR04MB6249.eurprd04.prod.outlook.com (2603:10a6:10:c6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15; Thu, 5 Aug 2021 07:47:01 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::9c70:fd2f:f676:4802]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::9c70:fd2f:f676:4802%9]) with mapi id 15.20.4373.026; Thu, 5 Aug 2021 07:47:01 +0000 From: Joakim Zhang To: davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, andrew@lunn.ch Cc: kernel@pengutronix.de, linux-imx@nxp.com, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 2/3] net: fec: add support to select wakeup irq source Date: Thu, 5 Aug 2021 15:46:14 +0800 Message-Id: <20210805074615.29096-3-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210805074615.29096-1-qiangqing.zhang@nxp.com> References: <20210805074615.29096-1-qiangqing.zhang@nxp.com> X-ClientProxiedBy: SG2P153CA0009.APCP153.PROD.OUTLOOK.COM (2603:1096::19) 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 SG2P153CA0009.APCP153.PROD.OUTLOOK.COM (2603:1096::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.1 via Frontend Transport; Thu, 5 Aug 2021 07:46:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 15dc6f66-f72d-43a8-7ce8-08d957e5360f X-MS-TrafficTypeDiagnostic: DBBPR04MB6249: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:327; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MGvuHsdAPC3nj9RM0mJuxybQiKoYB2mu64wBepiWTGQXaXXLBJwPHqLKTTS2pFzkrxEVisWb7YOeVAKFWd24hvSQBhuFoGP/z3OagVQ9tWQuePCpJAzhig5Fko+m7lhi3WglH8XSxvufVMmfD4SOjjTI101ee3ky7mhUekREwb25yElavUTBk+vU53idEksQtTGuocscdZcSQQDme89T2BF/3Sm7hCq8W7UknGDYqepYkkaFWjDOvy/YArq2U2kuGbZLOj3l0B4G1m74B3IcV6F/F19+zAUQgv9/1M6Wla7vGPS2Vbe8+Uc9kXYA5niqeeOD3m4JKythEtiapVo5Cus+AUI0hUu/oLIvIauTzptwDKCjZ4+X8zkfv2qlGhfNW/7XBT39+0GQnv2inWcaxza4hOLihWa7rMlLUlD9EU+QYA4b9cmaZklAJi9cdIMHN/X3x63Rcuu8GbvzucZLI6m0OBnShoQNgdyF+U7hhtF/Hs0thPmkrMwbol9SxWtNjc46OjT+MNQi673hKnN/WbDtX7Gtn7eQmU7o3cQtIczEPkcl4a/5xRJFYEYLZIEKaMRRgNquueDsG4mJ7GIaiosDs2lxxPVYglKQr/wWrs+DYpopGXYtEaenOlfAD6TtrfH5oT3BimjSVEjtGkHnhvem4/SuvGUgaiNBai5P0d0Ag48TXjWDT1JcK/POjUhy0FVr8Zt+3f84dJroLPRAyg== 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)(376002)(346002)(366004)(396003)(136003)(39860400002)(2906002)(83380400001)(186003)(66476007)(956004)(316002)(7416002)(2616005)(66946007)(66556008)(6486002)(86362001)(6512007)(1076003)(6506007)(52116002)(4326008)(8676002)(8936002)(26005)(38350700002)(478600001)(6666004)(5660300002)(38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0Eqxh45Jfuw9L312qTTN4HRZOqWQn1rPPjyMDBeqE6HNzDm6yGXKf7RpV9JFFWLjuY9TNTxhI5fb0i45NyU4WEAsiC6IpYL/tjA+nkyhOTmNG+ZPOvrMrciecVHY3o9L9w5R5lLGvafC8bSNVVG1TwCB1Ocwg3TAJ8l55p4Dl+AtZm2Es0iBIsuq7GMItLy7el7ebcjh+R93NL/0fbVy0A3UF5ej41x144vpokCdbiw7p+YtvjotKbAsjCYCxW2X/UZNdCvSEgrzp0snPJZpeMYLPrE/2223R8hZoOhagWRXFPVax8Dtx5j1DTzAk8zyV5E77IyFwclioa82D63+PabyKJLB8xTHGygNU2/CcWr X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15dc6f66-f72d-43a8-7ce8-08d957e5360f X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2021 07:47:01.7848 (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: hpxFkhxyj1pZbW4d87qtTcxxGdTGW0/aIshrQ/etciW4FULDUKl6ucUzd0+5Z75vizdp3qECI1Js6b5JEjR0SQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6249 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210805_004704_752255_1E554BA5 X-CRM114-Status: GOOD ( 13.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The FEC driver default treats irq[0] as wakeup source, but this situation changed on i.MX8M SoCs, this patch adds support to select wakeup irq source with "fsl,wakeup-irq" property. Signed-off-by: Fugang Duan Signed-off-by: Joakim Zhang --- drivers/net/ethernet/freescale/fec.h | 1 + drivers/net/ethernet/freescale/fec_main.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index ae3259164395..fe4dfe2d25ea 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h @@ -578,6 +578,7 @@ struct fec_enet_private { bool bufdesc_ex; int pause_flag; int wol_flag; + int wake_irq; u32 quirks; struct napi_struct napi; diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 1201c13afa6f..c422a309d33c 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -2878,12 +2878,12 @@ fec_enet_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol) device_set_wakeup_enable(&ndev->dev, wol->wolopts & WAKE_MAGIC); if (device_may_wakeup(&ndev->dev)) { fep->wol_flag |= FEC_WOL_FLAG_ENABLE; - if (fep->irq[0] > 0) - enable_irq_wake(fep->irq[0]); + if (fep->wake_irq > 0) + enable_irq_wake(fep->wake_irq); } else { fep->wol_flag &= (~FEC_WOL_FLAG_ENABLE); - if (fep->irq[0] > 0) - disable_irq_wake(fep->irq[0]); + if (fep->wake_irq > 0) + disable_irq_wake(fep->wake_irq); } return 0; @@ -3935,6 +3935,13 @@ fec_probe(struct platform_device *pdev) fep->irq[i] = irq; } + /* Get wakeup irq */ + ret = of_property_read_u32(np, "fsl,wakeup-irq", &irq); + if (!ret && irq >= 0 && irq < irq_cnt) + fep->wake_irq = fep->irq[irq]; + else + fep->wake_irq = fep->irq[0]; + ret = fec_enet_mii_init(pdev); if (ret) goto failed_mii_init;