From patchwork Tue Jun 28 22:13:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899038 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 737D5C433EF for ; Tue, 28 Jun 2022 22:15:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231496AbiF1WPj (ORCPT ); Tue, 28 Jun 2022 18:15:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiF1WO5 (ORCPT ); Tue, 28 Jun 2022 18:14:57 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80074.outbound.protection.outlook.com [40.107.8.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AA0539156; Tue, 28 Jun 2022 15:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yi+ykHFxrukPHtKu6XbzCxIPx3G/6JEP2W63RE2DA+UubfuM5wJ4A8WCJvx2nwB2W4XeXDOVGgGKbMHPYRX1QSkOm7bIiX7VXC9jFq9fFbBFvdNj8itrDZCerg0kXuImkFItqV90krCqAA+gCmTgi2Lgilw6FpYs7O9J8XJSbsZ7F1WaEmTA3jKC5jYZ9RDdVQdfXQ5sGwhj2HZm5JTLDpiS5CUK97VgHVZdntSRikzOoh3yur6Amg9vzZmSnyQJnMO5tsBLkmvs1EDS1w29dBquYHnq2I0UdlMal8zJpu5fJPiOSN/WUrdxdnXMjSr05GpdIdpDAymdolRtUKkq5Q== 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=olcQBbmzRcg1gnh3qf6bLgAGov4YUNKRcu6ttbNphqI=; b=LieFkWcx4YDOAzQq86v/ZZz+ytvjZijHDTI3kiYITs2iJI3t17E6KV4tFde0jL4HZHJInjRse3dfZvZCWDqfbso1EwO1AaMLX1S5+/3JcQSvuIuV3sgiTh6RIlPuigN1A13sAR+w24rh/kRVWnaq7TxDHcDt1zwdkV0d17jfQFb8M2NNJ88CY3FtkOvI4QI4SWIMKLl5nwQoul/POfKWm0+iSQTV7XdLJ6NPsb8SDc/bpBp6E+oFRNSGKuINkgJ12CilQ74yITPL9CnzyuhtTbdufQuzM292Pp218GE7bqi59wXEi8uXzb7zp3/ruaer7gZ8WDPxAiGg4OQblR4ZkQ== 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=olcQBbmzRcg1gnh3qf6bLgAGov4YUNKRcu6ttbNphqI=; b=esHaUh2WlT3H8s+0xJM8xZDhP2BBCGCTHcG3Pj/c8l45f63c42cgFdAZh7Nc7ThXQB0nmrF7976Xtv14Zg0yCJApfjt/z0x1Zz+QTxoJGqPPgC9KvUHQKXiVpxbSsqCW3Yk+r4GYYvaCDh/EO6Mr1UP5vVXfIQ0FDGR8688TSmmleeG0TKqfTRV42NijOmYoulyHOrwff+aew42+EfBYkfSi/1hC40+jw3v4FZTsNH7bAXAY7ns+Mz7HUvWrV9VMnWwNKUIb8QjO4cGgvEFbNXLLYDRpImpazSoZg/ypHTSlJI9sLXWk+CIcMoXK0wHTO6g6V09zJrygB+jbgEo47Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AS8PR03MB7399.eurprd03.prod.outlook.com (2603:10a6:20b:2e2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.18; Tue, 28 Jun 2022 22:14:34 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::757e:b75f:3449:45b1]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::757e:b75f:3449:45b1%6]) with mapi id 15.20.5373.018; Tue, 28 Jun 2022 22:14:34 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Russell King , Paolo Abeni , linux-arm-kernel@lists.infradead.org, Eric Dumazet , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v2 09/35] net: fman: Get PCS node in per-mac init Date: Tue, 28 Jun 2022 18:13:38 -0400 Message-Id: <20220628221404.1444200-10-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220628221404.1444200-1-sean.anderson@seco.com> References: <20220628221404.1444200-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P222CA0011.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::16) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6ff96db7-9063-4b5c-1098-08da595394ef X-MS-TrafficTypeDiagnostic: AS8PR03MB7399:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0DYpzNVA7tCOsxtgrqBScsiFrBAlFEdp5OiPsTyBCYj/k4m6NXsaKWEfOQwiJXy5w0Kez3Csw29qf9AbbIgnTPOWTf8MOvK7wMSi3ULiUffK+m7VShznpBEnzKYNx5On45Q2U266bUX5VcLPKAJapVqgeHk6DyRpnHRl3sUDzXRFRz+T1wy/ehyvfniz+obYpQP+8lzVPsLOhpTg/GaDlPkMm0c9vvTkgSQK8gUq+gqFB+npWt7vVR8/pZTggZDuC7NZugMcqsqJp7FOCuQN1oUzE0YUz/JLtT28t9wg+pvylQbqT/mV/Q5wJxwmQyH4TSVVfQYnSnPvcfIZzh7pX1v+Gnkz3OUCbbsOLUA031h88Jyxf5R4bNsfzNI0NrTVQyfEzLynigrF8PnA7fTEmCpV66fJYJBdvlhD0+oBbkFUqnwSOpThCzb+BJXpXVktnZlKgZw1ixgQ6bOv6fssmxuGYN8xWX/SCVPHd/vRmANP5l7tPS5If26zKbNdBfJWXJBpHGYvIQaX1pnrdJdHi9ZRytUwn6Uv+avsAOv2G5VCFTdTZnJxoJuGX3b9tYLGSt1RT/3SatipcL9hHkcsUp/Srkz8KJqP9aoMOYUmz61UYC23aGOznjCUF97YA0zseW5k20U/ubhb41cprSWivBHc88Ll7ohk5sOqO+WdtNsmwMMmod9QN5hCLumK+DM8j0zmrLhopvybLcXTG8OJHsoZGAmxUm7+6lxCOv8tO//DCytmLZ48JcK+48NcwMK5u326lsKp2p2WPgI2E87RHtLzxw5fYALxQOoGt4XPCkE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(136003)(396003)(39850400004)(346002)(366004)(38100700002)(5660300002)(44832011)(6512007)(186003)(38350700002)(1076003)(83380400001)(86362001)(2906002)(66476007)(8936002)(6486002)(4326008)(41300700001)(8676002)(26005)(52116002)(36756003)(478600001)(66946007)(2616005)(6506007)(316002)(54906003)(66556008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+VfTCilxzP1NbZDgICshRJOZIjvLRFrKVReXXd1ciWuN5p14Avvk+LEgtix6bsph+pfPA5TlDbpEBRTRflgirf6npCtACr2iuHayEeVrkWWA8z5SOYT/FLJHN4sRVoNfXtYcards1VIXV0AGsv8X0ISB8wci4h2V8Ptj1SpqIp8d0Cr9j9Sk4BrUxiB+0UmQk6k31GNpV5BpeEO3ODRSUh9w3+p6jalUWsHe+TulWcnWPgps4VLJ/88aDteuo7vuQmFi7JZAir/K8XsNr6r3nHEK7W7sln8weSihwMNXGRJtpyP/Uvl3WEtMa+b8mECl/nI/RbkqKtbEjWeWPCNgRWxI/6fxUgioKIRP3uT4qw8uTJoBcuHU+JoPdQ8pZwv52UxzLH4fT7C5F/hadBn0R/fkMiOr38wvz1qgrcT1sJXAYSCFoiSYz0WZEEDQA775lG2UxV99HSwmcqvOnF+ekNO3avzcTKTY22+RZ3Fjt5lo8fAZc1OfNMCk1R7MnSMywBuAHpshHVHY5c65Mvj324nmpnIH8shlerAHvpo3Mf3ZefMeETGfJe6JBSB65sP0ZMGmCFqKebf/KU+vJ/wnCcvCGGwpbmTDsQSLyBNBXmc6mh8EK8rTEbg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ff96db7-9063-4b5c-1098-08da595394ef X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2022 22:14:34.3605 (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: icMy9mXW8sJh1oJSxPhTGwd31n87BgdnWdWvSNhmZy7RNU5z+P6PLNbcVxDCrVLeGacItse8MjvbtbZC0kyW9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This moves the reading of the PCS property out of the generic probe and into the mac-specific initialization function. This reduces the mac-specific jobs done in the top-level probe function. Signed-off-by: Sean Anderson --- (no changes since v1) drivers/net/ethernet/freescale/fman/mac.c | 19 +++++++++---------- drivers/net/ethernet/freescale/fman/mac.h | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 6a4eaca83700..0af6f6c49284 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -32,7 +32,6 @@ struct mac_priv_s { void __iomem *vaddr; u8 cell_index; struct fman *fman; - struct device_node *internal_phy_node; /* List of multicast addresses */ struct list_head mc_addr_list; struct platform_device *eth_dev; @@ -85,12 +84,12 @@ static int set_fman_mac_params(struct mac_device *mac_dev, params->exception_cb = mac_exception; params->event_cb = mac_exception; params->dev_id = mac_dev; - params->internal_phy_node = priv->internal_phy_node; return 0; } -static int tgec_initialization(struct mac_device *mac_dev) +static int tgec_initialization(struct mac_device *mac_dev, + struct device_node *mac_node) { int err; struct mac_priv_s *priv; @@ -138,7 +137,8 @@ static int tgec_initialization(struct mac_device *mac_dev) return err; } -static int dtsec_initialization(struct mac_device *mac_dev) +static int dtsec_initialization(struct mac_device *mac_dev, + struct device_node *mac_node) { int err; struct mac_priv_s *priv; @@ -150,6 +150,7 @@ static 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) { @@ -190,7 +191,8 @@ static int dtsec_initialization(struct mac_device *mac_dev) return err; } -static int memac_initialization(struct mac_device *mac_dev) +static int memac_initialization(struct mac_device *mac_dev, + struct device_node *mac_node) { int err; struct mac_priv_s *priv; @@ -201,6 +203,7 @@ static 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 (priv->max_speed == SPEED_10000) params.phy_if = PHY_INTERFACE_MODE_XGMII; @@ -583,14 +586,10 @@ static int mac_probe(struct platform_device *_of_dev) if (of_device_is_compatible(mac_node, "fsl,fman-dtsec")) { setup_dtsec(mac_dev); - priv->internal_phy_node = of_parse_phandle(mac_node, - "tbi-handle", 0); } else if (of_device_is_compatible(mac_node, "fsl,fman-xgec")) { setup_tgec(mac_dev); } else if (of_device_is_compatible(mac_node, "fsl,fman-memac")) { setup_memac(mac_dev); - priv->internal_phy_node = of_parse_phandle(mac_node, - "pcsphy-handle", 0); } else { dev_err(dev, "MAC node (%pOF) contains unsupported MAC\n", mac_node); @@ -783,7 +782,7 @@ static int mac_probe(struct platform_device *_of_dev) put_device(&phy->mdio.dev); } - err = mac_dev->init(mac_dev); + err = mac_dev->init(mac_dev, mac_node); if (err < 0) { dev_err(dev, "mac_dev->init() = %d\n", err); of_node_put(mac_dev->phy_node); diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index 95f67b4efb61..e4329c7d5001 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -35,7 +35,7 @@ struct mac_device { bool promisc; bool allmulti; - int (*init)(struct mac_device *mac_dev); + int (*init)(struct mac_device *mac_dev, struct device_node *mac_node); int (*enable)(struct fman_mac *mac_dev); int (*disable)(struct fman_mac *mac_dev); void (*adjust_link)(struct mac_device *mac_dev);