From patchwork Fri Jun 17 20:33:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886015 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 AA9FAC433EF for ; Fri, 17 Jun 2022 20:47:13 +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=6ND/h7XEDkI41XAS9awUF1aIsLOx9TiROMW+myZ3VDo=; b=RtunTN1+JP/uuh 6PGvQRONm1vK9cvz4UuJktsS/hU4yj6N64RQrn9+TYXqjFufGEnZM4Aq87fe+oNW/H7XjZ1Wc9V1l PreosYtgd7rPJqf+0N9FZqp2/7sfkRYAPOo/OHlVBnNs/THK9lpk3udwju+eBS4YmrmLAd6cVqWAg drzc4ZKzKcYoC0RABExOe5ROR4RJw6CBEoWWnz7RfebrIHwQRuHsvVUqgXNL5XOIIeK0YAb9c/LoD ceubynnQO+ubH7A/kVbiK5W593gofvZm8Qf5W3Ndy9s/4i70vnRPKZdjs+2+xFucRqxBAvwnJzOzb cXLW/AInielh4SH8Au3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IqP-0091oQ-Iu; Fri, 17 Jun 2022 20:45:31 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfZ-008xNk-Ug for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cL6xGsFdDpbPRv86UUQNsh4SEQNQVt0uOWXP3XDP2/g2tfJ0KdierM37MyIIUBpVc41FTsz3DmtS/dB3IrBK0Ouje518eYWc6pKH8fxeZmzGdHjMMDnZ7OoXbc62g4ijZN4VFPGqEquHrP5eVqiDtqpVW8H2jDPh4QZXFvKVB9LxFYLcoZc2IpUYW9jzzBggcHUUD8oeHGPaJBNz5Ry563LBOQZlS1Pc5tvIcY9OqLeo6JOWYcdDrOsnEzXuafMcqaCpHCQC+xwkQ84vsxscIM5XXiwpDFh4itpd3G0fVFVtVq04Zm5QuNOkFdQKYppBRD4nRqKAO9ug38iJn49XnA== 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=YilwA5Zrogv3QaWa3jbppLG2d8NIsOs1Kb7V6wRF9aE=; b=IiIHt+/WbaYowdAbCgu+Ts3aNEcesEs8MoKcymZ299w8DzFEEW9D/evC6hi6vtI4LuQlVq4abw9BrEK1RWutkf0l60/Oiybnck2EcU+dpBm3AuENaLXzkRa8KxEtrUAzRG3b+GsycF0LtqNw/Cw45yc3pxszBHGE43NfgZZ+bPxLlSrestvoyUeuYXWn0WmEklELqB++bk2gmmrMsanIB2Ur1Sn1jpF738wuxrjdzfpnkC8dLI0AuhRDzsf1XhZoGylykocPjsoBu4tR3vQbUi2yCE4RLLU0IJLk8ImFWjzvD94VN8960JPQ98FtZl4sLU6QJ30FYqRcmzRkwfYkhA== 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=YilwA5Zrogv3QaWa3jbppLG2d8NIsOs1Kb7V6wRF9aE=; b=vn0BKWGCkDX9IsjCpTNdIxBI0vgY6Qg5jQb1KOV05wXWZERW7qaRvDBjJ/RlWjr8dJLEvP4N//k0jwKioeTS7RxhleKiHQOu7XOdTp77gMZaXivoLoYuqKtB/iDAXkTmS3r0ToZlRdmsZSnkLrItpxySL29GUgFPRy5WCDpPU0Jwce/jdj42WL8BZLcspre8GFQT2hRv2fRGkUrLJfme8oj3ND82W0bgCkDF4GR+9NgtMyx+wphkhZbe7ByP8yG2nbicOs7JdteZllJ6hE9p13Zx8cFSd3T5wirMbks5+pnhOqCky2TqQ7crsRUhUtR00IhGKSKkoCDtoYXRJPbFsw== 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 AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:08 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:08 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 17/28] net: fman: Remove internal_phy_node from params Date: Fri, 17 Jun 2022 16:33:01 -0400 Message-Id: <20220617203312.3799646-18-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) 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: 737a7221-0a90-4225-8827-08da50a0baa1 X-MS-TrafficTypeDiagnostic: AS8PR03MB6838: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: MKBzkpu/MeoQE13AEDqQsL0V2HYvyPTthPIwQgYLlX28LorSMI1pAf1Q6DKg2K8aFGWJ0IB3/Q/zSPn/fT5+UKT51lArEh9tLiJe7L/eKfMMZyn3kLfUheULv30u39bGwf6wrN5KCAQhwI0A84kbva6TtLLYfng1iNf0bVKfRxINpDeiqDM9kNDCKcKB96JWP5pfJancIksJ5oaKQ0IqUfoKgDZdM4tnugyw+89gTcXOfySMkb5akWrELEjqk2pWy49feLToSJg9lh5xJYS00mBwBKjb/9XtGFNgjsJln0dYTUdFyfld8NaXQJ8TGMN5xRX886mK6Ffw0k1ehtCCV9N4GuglV9K4aI2lbwnPzTCBSORTcd1v+VfqoH6xib2xA6heF4hlq1GgH1LE8/hbdAV1RQ5u+MKOhQCKn9FyZzx1D5FUFSKp3K463u4Zh6EX8eVbTbzUdoUAqID8jDb3huthKLV21wv1QXtc2lQgoOLVICJe+NH/45vS+vdg440SFEPTkZQaLw0D+avzwl326njlfYzlK19ptF8fK1QfbgEyZzMpII/1wgivXTR8DwWrVoasZlBNIdIjO1K5L7AUHGM9p+BNPLj7+9bxRj3rSRX7Cxm8Xe1/IPN5cV/qQn09JTa5j8R7d5CQ7gps53jQKK43vnFsQyvai0WixVJC0DDfBry/EMVobaYQ0OTVXmvB2RWbzByyF2NwiBujzqbIhg== 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)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(6512007)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pZYuFDIHPvWt0zcgtNgT3C6cNmR/LGbmT+etnS8T0QYyJONIubXLJH8AbwSTJzE5JF9LuebBw+oBoJvRC2aa4Sey5dODl3JrZQ/RN0I9p7zU82TLxrqK8yP9fisQtHXLSfbnbzrdqvQ0lWpl83wZAV/Rp5fcXRRynfvbyM/av81lbEntTE/kHbfVAzEcAh1b3vtPV8Xu7lgqJMpLjD2FMlsU96nqd6WEBqdqr6hNd1ev0IJxT2rw5sbqwwdt4niet5deOkAF3pzSiaMfAy+XmUDipCvx4LSgMB6bS2XJilzmvZlV6+6lAQAORItg81LXjeqy8+gRa6BGumFUFHjNioamO/2ncYV8Yu8BO7qyptcRqi8sbHBBJBMOxVNE3ixaJGNZYeATQuYGKLTMqUme42tCsVWqS25wnf4UtopbkgNE4Tgaz5SVKL5WWSw1BgXzltJMHMllFHCUFYa9yhMzA9GMs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odiG0nuBS35MjYoe+vrIJRtPu3Fkb7HOKlhWWPNy4yF7yWpB1bCHHbVnR1huVVljzs3ysEW+8mx3b56CNdGFOpWgicAGqZhNAjZkbiqtnyj+heY+xmwgvwMxnGws1k/QY11NHlLD6dNlgAkNJF5YVl/7+FxE3uAFzWDGzn0pqmCzDrpeLWSrcZ/AzpE2np884/gG47VBDJm99yUaXzRPx6oZwn0= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 737a7221-0a90-4225-8827-08da50a0baa1 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:08.3890 (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: NoHTSbpJ2YdfdZ8zqTgx9w4ZiXuE6V8MSV/X4bLTNh4kTm4J7T+VqMd64JdNVIno0MxNH3R9Kwx+549EJtcKPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133418_040219_646E19EE X-CRM114-Status: GOOD ( 14.05 ) 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 --- .../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 44718c34c899..b94fbc38cdd9 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; @@ -1495,6 +1480,7 @@ int dtsec_initialization(struct mac_device *mac_dev, struct mac_priv_s *priv; struct fman_mac_params params; struct fman_mac *dtsec; + struct device_node *phy_node; priv = mac_dev->priv; mac_dev->set_promisc = dtsec_set_promiscuous; @@ -1514,7 +1500,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) { @@ -1525,6 +1510,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 a97815287b31..cfa451c98d74 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 mac_priv_s *priv; struct fman_mac_params params; struct fixed_phy_status *fixed_link; @@ -1196,7 +1181,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; @@ -1210,6 +1194,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;