From patchwork Fri Jul 15 21:59:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919856 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 77950C433EF for ; Fri, 15 Jul 2022 22:35:21 +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=ziLJeXo1iiW6yayDGZrHQpY6sQY0hE0I8wWlfb4DKQM=; b=h0Vy6N/3uzNTpH gQz1J6ixnaV81kpulQQRo9vi9yWEdkL/6ioUbOYtzkxJgjFn+uE5+7Fhfv2n4lbZMkcidTnuK1gCH /C/OencEBRvwLEw47uJ4umq2BpdJQ4m8a+0o7gsdMbqSgJDcnjDvCVQZoC9E9m1j8cinfrK+ZJftW CqJ6V7UN6jVXHgI0Tzh+wpT6uI7c2Jp8LuSQLFAcOWkEnMAssU0JFRFKofuPSOifyl9cZ0yn8hLYb ydk7a4RzE2U1krme4WPMWQtXpvy6483ZKu7MY8eGQ3BEfezY4k2D7KyQOBjt7wVE+lg3Kvomb/L8/ uXzFmszfM/zhthaTtpHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTsZ-00AnpW-5c; Fri, 15 Jul 2022 22:33:50 +0000 Received: from mail-eopbgr60055.outbound.protection.outlook.com ([40.107.6.55] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNF-00AbL9-OH for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XLxXMLbb5Z687wf7m1V2y//PCuJI3IvIMPaaUBWkQWUF3wYC7sm2IZm+mvjSGqwoPOkdQgrEtM3Gz7mL7CFxBMCATalxrhks1baHFo2z9AuFRiska+m9wNMuTbEC5ciOEXslNNEN1fUbo4K0xp/or3Dc00g34QvqbaVH3Duhwi9fwQiO6AACY/Ntg9uOaJbA8e/gGthTvL0hmRDq8XCAJ0oVPBvjbUJ3HIwmV/GLsfpofCP340tq1FSh11IBk2I6TMxqASM47784Z8M/voL+8X3xP8/i7wEoaoFaqe1AA7esFWeAKtfP3mcR1UcR/52BwjbQ//RJxfA5wQXps1+Efw== 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=6GDp9p2z19h9IzDM8RWXvgmOXQ38jj8WkWnhniK7X7A=; b=dRVoF6FmNM/u8irh09sroKxG7nswVC69Sm+tzm6MngWHSGdcVJu8tEok2igWM8/TiBY0RL8YmrdZop9yEiDMzisUzuH6b7r+87PDbqYGvsxr0F8JC4doxaVk5lX8F26e5tyz4Tkz0cU0L1QAekwuCTmOXH+wzlaGkK2jO2I44Tci03FS5ztNEZlSyAeIZmGm+7aBgAI2aoSdMuq4/P/9aLpKd6/a82gusQPcZM6dCQcbp2xAvvwwrQWpQWHzfCJJ0lXsqW5SZaa07iCnr7tS14aHuHiG0a8WXfyWQjm0p5/1rfuKWDJM+YzXRxl7MxIMQJLRngXe1qjlYE4VwqBM2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6GDp9p2z19h9IzDM8RWXvgmOXQ38jj8WkWnhniK7X7A=; b=C2Jcz+L/vKkb1HSYJrXNO7CIwsrDQExQMeJyvt7g2FiWQYaMKNvjdONtTaoohhBcgFIerz57BkaCPbrypnbl25Z+lt1sfUy95T7RDJaU80Z/CwP4KC4e6M/Lhn4nIKJvyn/mgwC46V7FM+W/U2ruofEdE17pydS47HhAC31+qOqbnnGp4T3rlyqtWaeUZFjHncOvgxc+EViOY1a2wVg9D4rkr7muOczIiTH6jDP4slqJiDslhIeJAmlM/YfFDVc++ExPqg7udrDyxPouFLYXutJfTqTDn5GGx/m3xuPxCiOBpTgiV1q0EeL0XgOFe/s2GVUxJKqnL/DFm8HtCv3viw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB6PR03MB2902.eurprd03.prod.outlook.com (2603:10a6:6:34::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Fri, 15 Jul 2022 22:01:17 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:16 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 28/47] net: fman: Remove internal_phy_node from params Date: Fri, 15 Jul 2022 17:59:35 -0400 Message-Id: <20220715215954.1449214-29-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77fce30f-9344-4b05-cdbe-08da66ad8aa5 X-MS-TrafficTypeDiagnostic: DB6PR03MB2902:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4nADs2FYDHIdoUseaLPS+FQkd0nJj3XXMziPUOlPmNuTaMvczB1w4fCDF4heQh8wIP6zUKEw2dB7HD1mqKeimYK7TK7H5zvMXXByPKUVwstIQHKxbgbiCl1/q+A2qaB7Iv/y8NBQFQgIYQfeph0tM15alcUF27KpN6fGRKG9oyCvaBlHTkp3nnQKNagUG/3vSGLr1YHe3sidljNGuaqUtt8wmP2L4hW7ivHLP0rxEQBziapTL1lYEZKbVd2Tlc6zioje1DbvW66QHhycmJJJn2fv2p/YVzTHFwVDhRtjBNmL8QDqDyKYtJFPa/0rO2vYTTD9D78fk2E1BFP9fttNMsvPsrJs2TnH5FTAjB+B9srTuWAejsvX0zG8FnoKEH9SQ0HMCfUqi0HEWXnhdoNaV0uA/AWC/xEvpCx3XeH4+1oW4xx2SWD2YP2XcNt6ZsVqDM93abc6beUkbPiJ4/Dj5WdyV9RGoPtHPMj+Q2oDmUBi3ppwn1762yHqNB/oNePH+mKu/7mlhiGLhPbHayWbq+nfFEayvrXiPSRzX2pbDF48UncdOSlbQGY0mc8vWZdGYw9nDzvnG9sxtXZLKNpRvCFsz4p59kf/vN1wgyNvuMzd++7Ki8CQbM/fcTTdLKZWolAz/Xz8WQGpmz5UiRL60rWoPG6eypaDJnjy9tp+myzYZZakBEVVQJW2oS2rykUe5HGCZsCrF659jHHiT/l6dEk1Y7ke3614E3I0ptcupxbnM9na/9Ep0Ex2nOJDrendBHzJ0no8lpR3V05MK5NUx9OxfCvRfPKYBIOZFfOtn0U/0N4gGsR+MgsqCS0TsRXk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(366004)(39840400004)(136003)(376002)(396003)(86362001)(5660300002)(83380400001)(6512007)(1076003)(107886003)(38350700002)(38100700002)(186003)(2616005)(36756003)(26005)(6486002)(52116002)(316002)(41300700001)(6666004)(478600001)(6506007)(110136005)(54906003)(2906002)(8676002)(66946007)(66476007)(66556008)(44832011)(4326008)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hsi82WSBPH+OL5/jrHbp61wSS3nRciGYg0SKRj9aGfVS1oMc0Z5/+J0U7T1h7o0zUioOXAyaPFEGznM3PIn6g+RrD5MidLNBUgGtn4SOw/hcmy66IACNXy0H7sABCQK2WnfgFS4aWZ0VwyLnqxL5uv5SRv4vrj8xPu8T2UdCm6lDeiT87oKAyC6nhgiLS0HXsTzkD4TOnF3fwdNFDOOm934Ni+/wAAkDvfg0fGmOsBkTBQybVn91K5D1CboudP65NOAVjk4llipUskcFhZ3YFptlcqSWQmxgPVcFhaFadqJQ9ZWr2g7zPJDu4eOZ5bi+EQeEFo9vv0l08V36V1lNxM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IcdZAKl3LvuGbkHmoxtZ/kkDfsKIpmqOs7OaT9KMK8LE093b61ZlgMJjbwZ9S+tRvIiEU4sG0intXoVwUg2Ip0ZWiunMiwbcHjPm8kMzKGMB2l762lCygydXAxG/paVnqPZHAkag7E75Jv6n9cnlYXK2zGTPSfswFUxpVb+uBgsqpR9qzUg2mTa9I7Xm5y0miWhL0SJI3K1envYvpOdOnb69MtATmRlw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77fce30f-9344-4b05-cdbe-08da66ad8aa5 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:16.9093 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JIuI+O6adgfjLUkm2LtR8CcO8hhmNUCtP9Gevo3GIHblwF8J6rTxemrkO6QxfxnQayVKgRGX5I0kQpGwWPPQ4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB2902 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150125_901339_C60A6CB3 X-CRM114-Status: GOOD ( 14.55 ) 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 This member was used to pass the phy node between mac_probe and the mac-specific initialization function. But now that the phy node is gotten in the initialization function, this parameter does not serve a purpose. Remove it, and do the grabbing of the node/grabbing of the phy in the same place. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v1) .../net/ethernet/freescale/fman/fman_dtsec.c | 33 +++++++++--------- .../net/ethernet/freescale/fman/fman_mac.h | 2 -- .../net/ethernet/freescale/fman/fman_memac.c | 34 +++++++++---------- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 84205be3a817..c2c4677451a9 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -1463,26 +1463,11 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params) dtsec->fm = params->fm; dtsec->basex_if = params->basex_if; - if (!params->internal_phy_node) { - pr_err("TBI PHY node is not available\n"); - goto err_dtsec_drv_param; - } - - dtsec->tbiphy = of_phy_find_device(params->internal_phy_node); - if (!dtsec->tbiphy) { - pr_err("of_phy_find_device (TBI PHY) failed\n"); - goto err_dtsec_drv_param; - } - - put_device(&dtsec->tbiphy->mdio.dev); - /* Save FMan revision */ fman_get_revision(dtsec->fm, &dtsec->fm_rev_info); return dtsec; -err_dtsec_drv_param: - kfree(dtsec_drv_param); err_dtsec: kfree(dtsec); return NULL; @@ -1494,6 +1479,7 @@ int dtsec_initialization(struct mac_device *mac_dev, int err; struct fman_mac_params params; struct fman_mac *dtsec; + struct device_node *phy_node; mac_dev->set_promisc = dtsec_set_promiscuous; mac_dev->change_addr = dtsec_modify_mac_address; @@ -1512,7 +1498,6 @@ int dtsec_initialization(struct mac_device *mac_dev, err = set_fman_mac_params(mac_dev, ¶ms); if (err) goto _return; - params.internal_phy_node = of_parse_phandle(mac_node, "tbi-handle", 0); mac_dev->fman_mac = dtsec_config(¶ms); if (!mac_dev->fman_mac) { @@ -1523,6 +1508,22 @@ int dtsec_initialization(struct mac_device *mac_dev, dtsec = mac_dev->fman_mac; dtsec->dtsec_drv_param->maximum_frame = fman_get_max_frm(); dtsec->dtsec_drv_param->tx_pad_crc = true; + + phy_node = of_parse_phandle(mac_node, "tbi-handle", 0); + if (!phy_node) { + pr_err("TBI PHY node is not available\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + + dtsec->tbiphy = of_phy_find_device(phy_node); + if (!dtsec->tbiphy) { + pr_err("of_phy_find_device (TBI PHY) failed\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + put_device(&dtsec->tbiphy->mdio.dev); + err = dtsec_init(dtsec); if (err < 0) goto _return_fm_mac_free; diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h index 418d1de85702..7774af6463e5 100644 --- a/drivers/net/ethernet/freescale/fman/fman_mac.h +++ b/drivers/net/ethernet/freescale/fman/fman_mac.h @@ -190,8 +190,6 @@ struct fman_mac_params { * synchronize with far-end phy at 10Mbps, 100Mbps or 1000Mbps */ bool basex_if; - /* Pointer to TBI/PCS PHY node, used for TBI/PCS PHY access */ - struct device_node *internal_phy_node; }; struct eth_hash_t { diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 039f71e31efc..5c0b837ebcbc 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -1150,22 +1150,6 @@ static struct fman_mac *memac_config(struct fman_mac_params *params) /* Save FMan revision */ fman_get_revision(memac->fm, &memac->fm_rev_info); - if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || - memac->phy_if == PHY_INTERFACE_MODE_QSGMII) { - if (!params->internal_phy_node) { - pr_err("PCS PHY node is not available\n"); - memac_free(memac); - return NULL; - } - - memac->pcsphy = of_phy_find_device(params->internal_phy_node); - if (!memac->pcsphy) { - pr_err("of_phy_find_device (PCS PHY) failed\n"); - memac_free(memac); - return NULL; - } - } - return memac; } @@ -1173,6 +1157,7 @@ int memac_initialization(struct mac_device *mac_dev, struct device_node *mac_node) { int err; + struct device_node *phy_node; struct fman_mac_params params; struct fixed_phy_status *fixed_link; struct fman_mac *memac; @@ -1194,7 +1179,6 @@ int memac_initialization(struct mac_device *mac_dev, err = set_fman_mac_params(mac_dev, ¶ms); if (err) goto _return; - params.internal_phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0); if (params.max_speed == SPEED_10000) params.phy_if = PHY_INTERFACE_MODE_XGMII; @@ -1208,6 +1192,22 @@ int memac_initialization(struct mac_device *mac_dev, memac = mac_dev->fman_mac; memac->memac_drv_param->max_frame_length = fman_get_max_frm(); memac->memac_drv_param->reset_on_init = true; + if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || + memac->phy_if == PHY_INTERFACE_MODE_QSGMII) { + phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0); + if (!phy_node) { + pr_err("PCS PHY node is not available\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + + memac->pcsphy = of_phy_find_device(phy_node); + if (!memac->pcsphy) { + pr_err("of_phy_find_device (PCS PHY) failed\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + } if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { struct phy_device *phy;