From patchwork Wed Mar 9 17:27:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12775364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 423EEC433EF for ; Wed, 9 Mar 2022 17:42:31 +0000 (UTC) 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=WD4QmJnsPF/fRlms5CwPFK03OEhm2osyLz4jQOBH41c=; b=O5lWL5G+avll2c 02ZIUF4lbKlIUoMGn7VzL1Oz21bZUfOhz8VujiCM3juBYHbht5mi0CJGFJjI17vYuWinMwAbEXcSn C4fsRoDucX1m9M5F/jm6HOhpG+aRaFpVmHJg02kPHw+gFJqmjRFjjPyFxXM6CgCpYxg7xTRLDrI57 BvDfKAjRZ+jhgdQOQHwXsV3bMxPDKs4ah0Ta0mt/ttWSw4XnTdl71LY6/67j96At0nrKa1gKGsiNI II8M9lIvJyneX0d3HlwGPjJTNMgPwMmFAtCJBD75yIEaVJ7SCctWFRp8smiIh4mHT6dZuV9XHJjrz 6eWrce0GzfE9WEd7r6aQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nS0KU-009qUI-O4; Wed, 09 Mar 2022 17:42:30 +0000 Received: from mail-db8eur05on2061d.outbound.protection.outlook.com ([2a01:111:f400:7e1a::61d] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nS0KR-009qTS-RF for linux-phy@lists.infradead.org; Wed, 09 Mar 2022 17:42:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eko9n25adjvGxGegNeSxz1kxLZArUD0CWw8zL2r5JKuzTmwPYJ/1H8Eva0eiXICbXEdJ5dVaRflnSqjk1hwKlj7lATl/JIsoaGuTmojYu/V/Vn5zdhIODwj+nt9K6r9rn5e/aC+cGOXXEZoGIlG1XWhmnZ2Jbb88PTyf40C3DH+wanMGhQ/1K6XcV3J0db8X1msfKnWffknLuz9ucpYMLs97iPZX1G/g8y9pA4yseFsqND8juq3RgllW87xXi5T+q19uZhZBFE8+QxipdeUnBPUcAsMqWuzOWuuvxnMAfhFx6Lecj42wikfcngi6a7PK3FaO0Wwgdnd3N5865rddBA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CjzYIQLdKTdgyHM+oE25auI3Au1YkRyHQ8i+TqxPTRU=; b=ViHwxvw6a/LW9oV3qtopshWqrLp3Y2OXudg6gfpF1ATVcy+aTl6BHp3seEd6mxnb6lXENC+kb8gw4e8NRmdWXAi14pe64ig6WHbgJOpE1j1BGEarWHldBTIh0NmESkUTdPxRo4FixzxOfnHnTN2qrhZg/LUKhSXd3X6bXcpPfn/NCBjEWnSb5zte6VpqxaRiMQvMKYKWMQ4sKMXUtdmKicZ9DUqyHXLKEXWfGNCVFzwUPs8Fc2r4OEmeoyKPjcGdQ5HTiMF690rSxni4bLBmXT9vDc23ijdh0Gj64JFhq/2MWSHNDi/5+DmswOOSQmTgbOaLPjK16Kmy4O68xWEZ5Q== 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=CjzYIQLdKTdgyHM+oE25auI3Au1YkRyHQ8i+TqxPTRU=; b=awHXOf7lIHUeQaNsdIY2jC9EsHKD0VP8cTVCHx6oHr2gOugRJTX38TnbI4V6R2DYmR3oUmNnafXcygAaS7MVd9wjw78Jfn+Et2neWQwZnScbvVGuKa6ZFusepg7YHbUMlu3r2dmZaFCj+Eg7Im3o8Nj5Oyz+FIoqwyfmJXHUXiA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) by PAXPR04MB9422.eurprd04.prod.outlook.com (2603:10a6:102:2b4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.19; Wed, 9 Mar 2022 17:28:13 +0000 Received: from AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579]) by AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 17:28:13 +0000 From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org, leoyang.li@nxp.com, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux@armlinux.org.uk, shawnguo@kernel.org, hongxing.zhu@nxp.com, Ioana Ciornei Subject: [PATCH net-next v2 6/8] dpaa2-mac: move setting up supported_interfaces into a function Date: Wed, 9 Mar 2022 19:27:46 +0200 Message-Id: <20220309172748.3460862-7-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220309172748.3460862-1-ioana.ciornei@nxp.com> References: <20220309172748.3460862-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM4PR07CA0014.eurprd07.prod.outlook.com (2603:10a6:205:1::27) To AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eea7f833-a1cc-4073-3953-08da01f230a4 X-MS-TrafficTypeDiagnostic: PAXPR04MB9422:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SYL7gz/j9N6KsiA/COt1Q+nAWl6YO9kqPxVrfLBmN0pn8rtH+e5LWk/Pm26CF4a5sXbUpXpc8Gn2hsJJFgVqRIELWw6AlsxbHwwXCGGH8ABm45F5rGqF6OGgI06G8w5GLZnJwE55g2UlO0o+jwL3hilg8Z7EFP1i69M78D2ReYqasxcBTnmypdZvH+CWC94P/lH4I5FWnQQ1RFZFG3oCl2OZDV79EhO3gBC+qLAni+tkfCJbRCKuW/iGoM3KN0yO23zD8D57YrQ31BWirSO+cYm/rItnTkt4bbXaDX6ygsf+RmEhCL9z8Jx36bSN9BDK+zIY8cm90VJVeNV/ro7F5HBEZSPWhCGkfK5lHR7hJ7ND1kaiO1Y6s95/wx0tbtJ467ggiyeyCAviQb5cZmIGqiNJzZRW9vye3SYR619vLgG5RbR7z3RknuTqcga93mFkam4JqS1toBaVKTkBvlwkaeW4pXPpBwusXRIWl1iRkAovZRoWsNE0reBPkyicQ4mpzhWtQ4qexVjUk3KVAniQE5UU6ZlEnPcC7sCZpw0yDxDIuoxJw1LK6OGzXan5fGzLogB6eVMia9tX87o2+sMJMY3NsTN37XadhSIBGFjLwJlLIgfxnbDnYkdKCUVbjtCe+l37Z6jUqx2u8wXF/VsCfW+hUAywzFvsIMkLBDInDwnAj3RJUePjieb14IJVJcibTYa2LkLNCAAgIbEe2lY2/g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8555.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6486002)(8936002)(52116002)(2616005)(6666004)(6512007)(498600001)(6506007)(5660300002)(66946007)(7416002)(36756003)(86362001)(38350700002)(38100700002)(2906002)(1076003)(44832011)(66476007)(66556008)(4326008)(83380400001)(8676002)(186003)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sBN2jM6/1srNL7zhS0OhVO8CKOtQkLZ+S4buU/KiO1XT6rG3Jv6TaJ8MFXgtQTZpQ7I0BA8Fza6qUsC/W2hvUfZk+xXGGkdseIusW9Y1eXvwngL5qSIhmn4Tb5zfVYGMwNH3HRfHBRpZlsvIeX8V7KAtAa5tZCPaK0veUuU3M7SnRyHSS5kRRkpDc3GPJhdzn/eiM3uNer+Vj+nCvgnDJjaS4n3/g80RQvFLdANKAzjOVoD6fId+8BTDc4ouhmCGvc0kPB5fa7eCWNhAtBX3Tje28/iDk2iYHFH3bwDBrAuQEegQaKO3dsd0xcqsmr6DFtbWFwWw6suWQpUaTcpazKPQFKU8HFfkCLuOKCWf19dQ8eNpM661OnyA8fmfpG7+HiXeqjwinx0ikWdRO4MDvJNQ9FYUPGuN5thEBZ4kDHVTCaIkyVjo7Q424UYs5J4e3JDOU/6PB2EUn7SvrMg69f39ID67YWNOCgpbIQXSHPmRyrMoEXg0KUrrOqApwZhK/uwDyoxTIGdnJjcRedoaP5D+ibN0NLYApgkZ2LFNHTLj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YTo= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eea7f833-a1cc-4073-3953-08da01f230a4 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 17:28:13.7391 (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: Ta01wLUu1fHK1CmHekj9jsxz0+bRIcYV/d9AYLGVmQUYy338uG8xA3txvdG1YCk7taZO5aZnDJMbZjoREQBcEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9422 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_094227_968175_57408C57 X-CRM114-Status: GOOD ( 12.91 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The logic to setup the supported interfaces will get annotated based on what the configuration of the SerDes PLLs supports. Move the current setup into a separate function just to try to keep it clean. Signed-off-by: Ioana Ciornei --- Changes in v2: - none .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c index c4a49bf10156..e6e758eaafea 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c @@ -257,6 +257,29 @@ static void dpaa2_pcs_destroy(struct dpaa2_mac *mac) } } +static void dpaa2_mac_set_supported_interfaces(struct dpaa2_mac *mac) +{ + /* We support the current interface mode, and if we have a PCS + * similar interface modes that do not require the SerDes lane to be + * reconfigured. + */ + __set_bit(mac->if_mode, mac->phylink_config.supported_interfaces); + if (mac->pcs) { + switch (mac->if_mode) { + case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_SGMII: + __set_bit(PHY_INTERFACE_MODE_1000BASEX, + mac->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_SGMII, + mac->phylink_config.supported_interfaces); + break; + + default: + break; + } + } +} + int dpaa2_mac_connect(struct dpaa2_mac *mac) { struct net_device *net_dev = mac->net_dev; @@ -305,25 +328,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) MAC_10FD | MAC_100FD | MAC_1000FD | MAC_2500FD | MAC_5000FD | MAC_10000FD; - /* We support the current interface mode, and if we have a PCS - * similar interface modes that do not require the PLLs to be - * reconfigured. - */ - __set_bit(mac->if_mode, mac->phylink_config.supported_interfaces); - if (mac->pcs) { - switch (mac->if_mode) { - case PHY_INTERFACE_MODE_1000BASEX: - case PHY_INTERFACE_MODE_SGMII: - __set_bit(PHY_INTERFACE_MODE_1000BASEX, - mac->phylink_config.supported_interfaces); - __set_bit(PHY_INTERFACE_MODE_SGMII, - mac->phylink_config.supported_interfaces); - break; - - default: - break; - } - } + dpaa2_mac_set_supported_interfaces(mac); phylink = phylink_create(&mac->phylink_config, dpmac_node, mac->if_mode,