From patchwork Tue Jun 28 22:13:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899062 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 0768BC43334 for ; Tue, 28 Jun 2022 22:17:15 +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=rrMocwr+rybJ8LR3Xp1RJuFfaeeaAjO6cVneFtwz1Fw=; b=UHnKK/lx/u6HPK eq8BbnUFtLU8zDjjdDgQr3pfegb+dMcp10g70hwsM+KDEwtQz1SLS+l8hbWaQFuEJMPDdJI5jztDK qLvvvPFfOUh4fOvJV3amu2e7Fy+QNx9689KPebyzbZZN+sKhujKf/1/QrYAz/IeTvSZDSf/Csadcw zQ+hpu+G4iFkUwEtf0RLRvsQObZKa5Q3NhxMJAJGbGbC0cSSUIuLfFnPF93TqHUKTgwp2gs8/iHO3 ZT0Xa2RQXO897lNb24FKtzkMt/IyCesYNfYgi0e3bKXfm0HFcCfDzDKbzBj/bgoMacAbz/xV0UBZB BfcuToVLiHVcK8kVoHdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUw-008N9D-K9; Tue, 28 Jun 2022 22:15:55 +0000 Received: from mail-eopbgr00084.outbound.protection.outlook.com ([40.107.0.84] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTa-008MWO-5a; Tue, 28 Jun 2022 22:14:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IV7fXN8Kc/mtxGCmkO1XbbSsayJ9Pah1bZtF/Ju+05hOZrrIW6rxlOGaE9AgJOHdiLJ7tgNo2y34GLk/7CfUeOQbfJDLP8P4lyJ+NM5acfg+7jBNGnFErNDfz26MRZqbtbWkvWj9agbafy+CgHBug4kBmDcdzSdZojpKd3JJZDbHjIWsCNR1xLpUMDYboUGqERPRdIjBZrOLcxuZcYhlsKTuJ/LWZ8e9xawuyiy6ZIygiFY0oInhtG+vMEfwdUFfmnfzYTzHPQG3N+Kdk1JQc0eNLS5kHEfd7ZKPCqMIfHZJqPG2ZY/3kKY683evGCAAzk2Q2DJrqbbJXQfbz9GemQ== 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=n2TOaa23voSbHbIev1E+i5kpuNcV3elS/tbw71Sc9dA=; b=nvulD4D2Z+5ziHPjih16w/OPqgZVa6FjG2BMZbOqk7RpXiNrQQ8n82eY5CpjlKa7S6pdFrfTgHbis8N0MuO2sTuM6x2LsmPMAlPgOlHB6c6kRx0TC574yo3mMyxUH3zJYkpJEDE0OduUfBZv51QAy0r4zaI0djdzOnpwEG3QW8u0cyydeEO31OQ8S18lSyflVu1tqgdNPqkSyyAw0Pi21Mh7Q2DX9GRpxD+LQkgzm7Dxa6dvRamRtglwhErBa+SALHobLMmoYuyQRYaLFgkOyO7kpQsqQv5qKan1mfEqN7j2mvRRxhRO2kWqMWdjkoZhhISevWzbf0D+R+UTF3S6Kw== 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=n2TOaa23voSbHbIev1E+i5kpuNcV3elS/tbw71Sc9dA=; b=qpqwumtIK3919D35Uf21+RnQ1r5mAWmO0jB4XqrPOGJ2xZ6snL4UhL768XkvcIB2JyTaVErh4umGY0ORqq9f4Li2U1ytphlu912ZkAr0AYSokiUkgA/mX2pX33nlmcKVIIAtITtuDhn5ko9aEZ08Fgqjvq5VBvc6D2iXA9MTRM2ter+/zJS45KEjLI1yOtA5BWUXd40Onmiio6Ug6QDCtj/4fJpZe1YcEaU4zu0Bdd7Yh0y5VFlQf1rPPWkz+1d85jnoC8CVW2wCBIaK6RD003dHqOL2p03hL0zHSsk/JK8evO8yLiBzZXbz7FyZVOd8WqMKJb7IqXYELEnPjGifRA== 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 DB6PR03MB3013.eurprd03.prod.outlook.com (2603:10a6:6:3c::28) 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:20 +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:20 +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 , Kishon Vijay Abraham I , Krzysztof Kozlowski , Rob Herring , Vinod Koul , devicetree@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH net-next v2 01/35] dt-bindings: phy: Add QorIQ SerDes binding Date: Tue, 28 Jun 2022 18:13:30 -0400 Message-Id: <20220628221404.1444200-2-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: 3d1e0234-b661-4db6-81cc-08da59538cbf X-MS-TrafficTypeDiagnostic: DB6PR03MB3013:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4BQ5Ej6Bt6b/45hwnHw9cEqPXV3dP3UQVTKdzH2NLEWivAIohIlpvj0TcAVJy0csI2/5d/MCR8zcFvploqP9RWcXl5940BtNt9R0qAJuxub3ng/YgTxTAlbcK3rBS4w6yNrHTbTRBjlb1noG1EZ71tbAWDyV5VkHg6ZtBjPU2DgU5QvPONvtsZ6njO/ZdFe5iSx2Pi0tOLRA5yUoMGjrbNFkO+zSQQ4b4XWqQleQMgMKS6LQpty6YMWrlpF3Ko6HyQbtnw7qf8G0CZzQ/P8rvb6PqyxTEkn1TqZmGNIBlB9yVl+PY7JWXBCHczQqwHb1BX3J0ur+G+hTOYQtn72DcmRwSeLxK7/z9QPAKZnyRYY2MOzSo5hpLIdsbdfJFmof89wgZpaV4huQNOeJktDAqH+527Lwq19Rrz/Ouos5pv3odg2Hq+54hNO0+b2+Z0C1vaaiUhLziIIIVxUEquwJmMBd2YSaZedjWiQaWvh10Be2agQT54cMiTrKI+8COv3ZEgai3v88bgvjo+u6Q7qRlE2/XgMn8ZubXup3/l0w91YzjSszkDUyh7/500s96Y2XE3B25LqQrvwq/3IEZTIh/kocVsznybItb1aQTYjHtHVuKupURWk1PduxBOeRCpB+NzJzhTjACEwE+tGnHUGpXJIZKAugdUgg2qmkNM6WrnNgBdeIXrdUF5bxguARcurDfyg1jErdJWniZsmphZ1Z7QKIGdrsHYxWDl1hF8aH1SKW/wjxIhYfebpQDa3UcDNA2UVZl4wb5jhnsTcboX+WxUbIvknSjY+7YlBXJntavtSxDmvYXz66mv8ayiOXP2O10KX0V2TD/IU8JR7nIepS75O74AAMbNywSAahylz+g4M= 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)(396003)(39850400004)(376002)(366004)(136003)(346002)(2616005)(41300700001)(26005)(1076003)(966005)(66946007)(6666004)(8676002)(6506007)(6512007)(52116002)(186003)(38350700002)(83380400001)(44832011)(6486002)(8936002)(7416002)(66476007)(38100700002)(2906002)(66556008)(86362001)(5660300002)(54906003)(36756003)(110136005)(4326008)(316002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pw7IRmaMfp8kPOgleu0iwyX+kaemhCxR4+nVnFljBw4BmN09/F39oCkrQZmuo6DWN9yWhkQuivh54+C1lCf7YZr/mAsdhxjWN6OPh4q1L00ek/lpqtKnNYsarLKE/SnxbLz/rVQ1Lt3eN3e8QcvMtRa1TzKGmm4O78sWqMpBBid3GEdVxE2hUih2ArU3UEEQZra7znYzaliXO63lK9gzm0Fg4PNTUFW1jC3ZQWFUSX2i7zU26Zm9pKNb3EBO2Zqa9iNJ2Lt/3PSBZEgUSxoah5gbUTUXWzP7vq7lDd4Gft9sgN50rOZ/LxgQJybM86XlcvqlPLS3efqN3FKtfx1eYkfgnR3qg4ljG/T2mO8fSEqPCNzf/jz3YdBLaRcO/W6CGRVz50dY2/4HXQYZb147z68w5lLjWCMdGHwBFWFl2QYKltRpapnLvDRgMcgCRzE9O23fn+bdV+ayd+tuKcvzRjGIFEnl5E5JPH+4OXYBZjHR9CP8Xnp+QaZooKXNTS45ha82XjRvID6QMB13xIiThqF5S6HlP0MxBTtz/AtfrWTuOTe4PYDj8PGBlzz5ilap6hsJHO+meYP3eoyUUopE690ZxtKrHegwwacFsgjztR4iu6dl/RZDYfZUIaY63hNUkjiqUUyRNggsUMmsZW8OLWzaAPzLoe4u0fdu/3InzxyBWpiExTa3yEFUtUMIEuChRMAu5U5RCDa0atyOOD2e5vl+ePGuczsNqKcrI5Pfb/1/Ien9uNXm5Dr13X2TZsSUK0pfxIjZB0l6mMG8pFXYCTUYSez1Z9K9tCMmQvRAKoL6bOzqHQY5XU+18crytoC6UyTOzHf+0RwNWMg0ZDwUCAastGNrhvGDUm8gM8Q/OtTtCyRcSoG5VYCWqR7FeWfhiIYgs4r99dP7dpe+Nluu+UxMrFxzp8jXXj2ghn+VnGSeYQ988Xw0dd5D2i7nOlNSDVIfA5YbCTmAVipYNQevtqrgDYTvBEVSMq2udZMLmxPN/gpiR6QFxf6TJcxwDxTSnl5YgB/Z0vteaqNAHtx79/vEzYoH8piNwoWamV037ExxN3UVB1vIGqGA/6oqCpH5peR2fV96UynfEdVEN7TCPg3K6CuNoJsqO2w6DlIJjF1RZQAGaQuXHSKt9z95qrZvYGBg5C4ltd2c7BJUw1hliNb2fN+bISSOlSCces7+zphdBZn22ct7Ozdc+lPX6NQzlbRI/1Z0cJ4uUlK/4NmTNME8hdwP1htbT7ZVk9h3WTwUxsX+MDjG5yJfIR5l2osnT3ZvQmgZJiukKBuoeXxPe3GfCGIjhZmGKD7cAgwZuNudDSiotC2Zn/mBo5SzW/gkjS6vlVhwHvupM3/8UVBtLGAMyYWqpZjMupezVwv3t3xUD5t1HVb1MjkIZdoFOxfBKsUjMkcVhk+9EM/Lerlw9/2Td/+gDO+oNgCCNa0lCmUVbqNPYz1RBXTEovsopLdJXxZH67QVEx+AIpTRdJKs8YORUv2kdw3QKNMzAdWUgKXncXYe8sr6kS58UsUrk8NSf869Z7JzPKCl/7C37FFOT04P0GU9FBEjWMga7rIr0CzM//T1fisc9YJTwrg23eO8s6PPZODHm0QqYfZUQtOjRQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d1e0234-b661-4db6-81cc-08da59538cbf 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:20.5646 (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: LtUQLoHLKOQIyUUFuoQnsRtp8rMbTVgG6jxHFLNARlr1y9chZUIgGxzT6OaiJ2V743ap8m23MjXGSW7xEjzIrg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB3013 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151430_258326_CFB35EF4 X-CRM114-Status: GOOD ( 27.09 ) 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 adds a binding for the SerDes module found on QorIQ processors. The phy reference has two cells, one for the first lane and one for the last. This should allow for good support of multi-lane protocols when (if) they are added. There is no protocol option, because the driver is designed to be able to completely reconfigure lanes at runtime. Generally, the phy consumer can select the appropriate protocol using set_mode. For the most part there is only one protocol controller (consumer) per lane/protocol combination. The exception to this is the B4860 processor, which has some lanes which can be connected to multiple MACs. For that processor, I anticipate the easiest way to resolve this will be to add an additional cell with a "protocol controller instance" property. Each serdes has a unique set of supported protocols (and lanes). The support matrix is stored in the driver and is selected based on the compatible string. It is anticipated that a new compatible string will need to be added for each serdes on each SoC that drivers support is added for. There is no "generic" compatible string for this reason. There are two PLLs, each of which can be used as the master clock for each lane. Each PLL has its own reference. For the moment they are required, because it simplifies the driver implementation. Absent reference clocks can be modeled by a fixed-clock with a rate of 0. Signed-off-by: Sean Anderson --- Changes in v2: - Add #clock-cells. This will allow using assigned-clocks* to configure the PLLs. - Allow a value of 1 for phy-cells. This allows for compatibility with the similar (but according to Ioana Ciornei different enough) lynx-28g binding. - Document phy cells in the description - Document the structure of the compatible strings - Fix example binding having too many cells in regs - Move compatible first - Refer to the device in the documentation, rather than the binding - Remove minItems - Rename to fsl,lynx-10g.yaml - Use list for clock-names .../devicetree/bindings/phy/fsl,lynx-10g.yaml | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml diff --git a/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml b/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml new file mode 100644 index 000000000000..b5a6f631df9f --- /dev/null +++ b/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml @@ -0,0 +1,93 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/fsl,lynx-10g.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP Lynx 10G SerDes + +maintainers: + - Sean Anderson + +description: | + These Lynx "SerDes" devices are found in NXP's QorIQ line of processors. The + SerDes provides up to eight lanes. Each lane may be configured individually, + or may be combined with adjacent lanes for a multi-lane protocol. The SerDes + supports a variety of protocols, including up to 10G Ethernet, PCIe, SATA, and + others. The specific protocols supported for each lane depend on the + particular SoC. + +properties: + compatible: + description: | + Each compatible is of the form "fsl,-serdes-". + Although many registers are compatible between different SoCs, the + supported protocols and lane assignments tend to be unique to each SerDes. + Additionally, the method of activating protocols may also be unique. + Because of this, each SerDes instance will need its own compatible string. + In cases where two SoCs share the same SerDes implementation (such as the + LS1046A and LS1026A), both SoCs should share the same compatible strings. + enum: + - fsl,ls1046a-serdes-1 + - fsl,ls1046a-serdes-2 + + "#clock-cells": + const: 1 + description: | + The cell contains the index of the PLL, starting from 0. Note that when + assigning a rate to a PLL, the PLLs' rates are divided by 1000 to avoid + overflow. A rate of 5000000 corresponds to 5GHz. + + "#phy-cells": + minimum: 1 + maximum: 2 + description: | + The cells contain the following arguments: + - The first lane in the group. Lanes are numbered based on the register + offsets, not the I/O ports. This corresponds to the letter-based ("Lane + A") naming scheme, and not the number-based ("Lane 0") naming scheme. On + most SoCs, "Lane A" is "Lane 0", but not always. + - Last lane. For single-lane protocols, this should be the same as the + first lane. + If no lanes in a SerDes can be grouped, then #phy-cells may be 1, and the + first cell will specify the only lane in the group. + + clocks: + maxItems: 2 + description: | + Clock for each PLL reference clock input. + + clock-names: + items: + - enum: &clocks + - ref0 + - ref1 + - enum: *clocks + + reg: + maxItems: 1 + +required: + - "#clock-cells" + - "#phy-cells" + - compatible + - clocks + - clock-names + - reg + +additionalProperties: false + +examples: + - | + serdes1: phy@1ea0000 { + #clock-cells = <1>; + #phy-cells = <2>; + compatible = "fsl,ls1046a-serdes-1"; + reg = <0x1ea0000 0x2000>; + clocks = <&clk_100mhz>, <&clk_156mhz>; + clock-names = "ref0", "ref1"; + assigned-clocks = <&serdes1 0>; + assigned-clock-rates = <5000000>; + }; + +... From patchwork Tue Jun 28 22:13:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899063 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 5D9AFCCA47F for ; Tue, 28 Jun 2022 22:17:50 +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=vn8h7vh+l4osOhum9T++VLtgamH9oUpnQMjFBiAOLcM=; b=Z8Ph9Ifj1xcojv 4h4XiKUFyhcO8M8oSbV7btW/3+0ZYgK8KG2nuF7LH9CGEF2l6LQiMTUKvXIJCz2l2f2QtYeJR+aJy PNj0nUNiskJ4CEEdCjERZzI+lWctj+CtjfiP14Cg/+htin/omH0E+ecGde9wtvKhf/6moY+HASRXZ RAqbeiKr5HBdWdHOJGmNJfu9AJXG8BhkNvaFQMH/tYCMDYjdBFLLBPzqdrS5qPlYpS4q/lnMeBHrJ A77BJriQb/DMxaCNS/dJuH73opHUz+uOSKLREnaa6Wa3y3E09KUX8vfDCi5s2NUFar+Geago4khtw HkGKLV9ArhFi+22q3jfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JVR-008NKH-2d; Tue, 28 Jun 2022 22:16:26 +0000 Received: from mail-eopbgr80074.outbound.protection.outlook.com ([40.107.8.74] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTa-008MXM-UJ for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dNVCstv0nCQ5Amn/YkliiVeWCsTcLQ8gzsVHgKk/ZWsv0JOUNlhM9aJTRBPybMd39RHSe5sN4+YlT3DpWGUke85iGzUgsxdny0VXsRnB09n4vsmc1BmvEW0Ik3IFnkN+dEYBzX9muqhccPZz6nW2bgpKpeu0VT+PXcSaRAdEDjZxh3eexMnyA73Cs35IjwsWzkRIBCIvqLOH9CekHRIhfEVbEGzXClstXDE2pnXlj2BGSDWte415fCUK4p/iSc7fx8KgLIKlw0+DSoRlrZJb3Br14bUXpbTub0jwzPFQqgGD8P9tcOCQFxwlBrkrAtZGiGUQ22wjOB7jtN1+cWACdg== 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=cLnSmuKT/lPvS4Ez3izPO9ww9g2gJ+DfRGEU13yGhU4=; b=NN/tQ6dwx6GxEh0XV24vVICJJNFIKIlZsDq9vB3vGJAl71//Z5sQCERGRj41cDJ3D1Z+JTbRIjQRTY4xqS/FtBfl+P4nd4uS9ELCeH3UEHHEDT8kEmZdOBAKSTgD6QpwXOyanHz4aMQvseXTrplfoK+7YGYQ6K9XLCPugAzqnKsbeM/wlRWZaycZlyFIeywQ+otxWzRVI9pUxC0LDp2vhcqH/LYszF1QF1bti/evJNfjaYeI6oggf7KTOaJxfb5cS2bZPmXNmKHlFGAo6nNg8ssGc0AFgRkHWytsEuzJOgcCCSYfbFG/LQtPBwViZpGkoNp5wEJ7lUKb4/RE1EOlog== 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=cLnSmuKT/lPvS4Ez3izPO9ww9g2gJ+DfRGEU13yGhU4=; b=WjKTeaBRaFg1NwSQ4JG0dYv3Ae3JMMaA4aQJ+h+pPmCO4Gz0Kvw7Q/q3PIw5R2jCHbb5R01OSJjF+RdROuMFZ/B4HddTow4IoxTmB4+j/zkCE5srXkL8AKSiUxMOyxwUCemsdR/Fp06APNrktPAL2tQaXUypA96UqNTFCtd0T5Z8ECQFvh92hVZMiS6xlL1+0fmFlLWCrUtsWSrbGy1/U/DfLPsney6NkI3Pgz9mxCpeLEAKYakv0VDQZfqsSk7sooaCKC5vcAVHP2R6mAqdSGH123ZWrjHHVznPfzX1M8Mv4TfuFxzF0ioSXOFRjHZrBSjQE5kh0gQW/aI1+5oNzw== 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:22 +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:22 +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 , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH net-next v2 02/35] dt-bindings: net: Convert FMan MAC bindings to yaml Date: Tue, 28 Jun 2022 18:13:31 -0400 Message-Id: <20220628221404.1444200-3-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: fc0d5d39-c2b7-474f-36b1-08da59538dbc 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: SFmTYc6MvfIFH2RIYkZ3MQPsyTmjuQNwY56kLCkfnEgI9Qnaay7HvFhuTlmZqSmGHaqAgfoj9kT9mBBKR4TImcvYM9os5wgrdn+r7H4kQ4fjbZtYIWFdW8VuG6PPUpLIWiIHocg5mHNso2DTcIBCEjbLhIPWCLZ9moeC5w0g602z1jWExw+2QShZsGbQOIJ1Eg/bmgIirX5Ar9G4eoWxW+NOSqaL76p8Olhj0oQMB5UvNBJzo+HjtEvMV6Q3aPDE7VH67lP0xR88jOaWI3oBkA87zMZS7+hhuiennUWsug53ES/0I7TO1Ss4F1FGy05WKJXu5nQ2qH/7meLextnuPojBN9gy2jZkg2IrlXjjQRhMQAvZG+2xyF3vY+WIdd+3wvNiA39fMm4nroOT/fiFsgFvMZIrYV/8qaIGom53Jt9gJZshMkdgxc82l+jwFCPFus89QWgWDEkUJV3QRdF6m0ZvTqCxX5nroJcv37Ai1YKKV2PmMT/F8rvKBOCX3wlYeXUfX1uXwmGMSg6D6HaDl8IXML4ay7Q8ETqGJOesydllNOWwlFwvqn9YZwcJrd+xxx5Q+HhHk2IIAZ2uuPE6VUR/XT5DX1C4ZB2tqFBzCSpyZ3tpy2GEaZ/mBMEnUAD3MYiGR7j+3ncNaOaXf1NTzgtqkVkOnX+fUeGc2fpBwerHlWzFAVbPW+SViKL5Ed1TomhFn6zjbdZwFuZpg4LpRDYXVIYkfFehtNYoOvzZ0ir9+xQXGD0qesq+WBBTgqmniKOTFwVxnFcOTyR1HHoUsiADUA83myQLeHE51KgqXd+jJTFTuFjCF2KN5oLWVLDV24ljwkTQEBeWX7FqzC+Cu7wJmH3WWae3x4jA+cL8XQk= 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)(7416002)(44832011)(6512007)(6666004)(186003)(38350700002)(1076003)(83380400001)(86362001)(2906002)(66476007)(8936002)(6486002)(966005)(4326008)(41300700001)(8676002)(26005)(52116002)(36756003)(478600001)(66946007)(2616005)(6506007)(316002)(54906003)(66556008)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fHyW0o3ByRBJybjOP5dmXVPxjSE7NE7n64MIhSI1QgbvLIzBnC1Mp5+0x/GekU5kala4nOE3K6tpf6g/FvMJIY+FY+56nkaBWt2vj5fRibZgY4GNcq4ltnUsjyjyU4gsVyPM5ChwB195dhsvF13skeGmuIbJHhu1YX4yCr6OV6k/RQmAasjxMKroGHO8SLuLnxTdjHHAM8dMOKwP3ER9S4vbjZzzzFMiveSdwcGA9XyRiFUB2WQaqU0kA0i8N898uRlKd0IS3cnEnqcpPHsQ1QZJ0lckSlEkKzuaZCj2iiJINXwq85zXV6k/pItzIYtYUXR16eQqO077FcSIyjqcEcNcik9KHGLDh7DHzo0w06R7elqOpj6cMbUlZ+uRjDW7JkmRCARA26dM499vya1kUeaNNhdgkHx+WgHLj3hLSJ9apTkSxwMeNJWGwt9rEZWAWQPgpeGHWJSrQLpXUzEPhYBsnEQikSc+tJ9s46aUeufy0ukBH8qlMs4eowWxB19OlndRTX9opTAQSPkqY+GD5XbPCCKF2iw+3jk2z6gCBjfb8RAyaU7PPjyv3hMI0IEydmTlobxcu/h/k7k/JMpTpXpnm9Y32PGoHHzIZ/egRHzgh+qZaHXUtEwFnQx6qGsz7/kT8V5/h15Mtd4VTKQlTrAKWgbPk24uZ8wKnVIksVTxZrmp8ioEbKJ6qmAQqUWwgbDffgkbhjGkH48OIH5RaDf30/EHxNNLVEiQ7whK4avUBj6Efizq9LJQVW4E+xofaehWofpkH+8zrTpmMUZknv/cjGwoidiecIc2kkraAvX2R0KYNIorQ2Wpbf3ScpqsYBYDzh/K3zN50EJDDGM7vubV/BX8LywlWssY6Pa9hcyW30r3yl8T0GtJWyPD97/mhobwHfJx107fApBF37Fwld4gkiD0r1gjEs1QZ/zpuRVFzwI8q3jPAjypXu2uj2JObuAbrRFjlVmMve6h1SWXAaO9s2NKobhZ78CoGcNPp/f1oktcpfZP2LvGsiUUXrxXQkeuE7ASJEgoHr235+2nPpRQePBOtqYW+Y8CAAZfC02QpewP8WKPmqZTyQ/w9W7HW1i5lDLkFaRXFWMuG/VbNTqRpd+u1e59fqUclDMqK8vxUfXEZlF1gYrW+hLjyti2IWxcP8OwR0xD6ogbcRjnKl1zyE0gBNWjiDAcAQdQgvinKS/vqyLZScEQsgpxeR/7no0BTPJTi9hBdCbqIWHu7Lwf/JleQ21BvtC2fQhu3b3D976MXrb+s0Gf7XNNtMKMGWNXA0dxIDUhD8DD+cNAOS70Yw+4BzC5bHZHfjphHaB1saaj2l479p5+t42LBXq8BInx+/CNCzo3xJbRorRmvzqak/9dzi1WbUSuJur6FNfkcrxTGdto9aviXOZ+Vjq+IImGChIxPF0UbylMcg6DXlh132iZiDwPgxRpblGdIbXFhiofsGiqb77tUIfsam0tuPrtRln8pzOsVcf7GnxYcUy5JdD2GK1YuYKGcBBnqVvA4kMt/pBKMPJZM1UsoCK1JHo5tzXMrUfQQ1mg5ReuZSVR/5PnWtE8Qax3mJWKbI+pNwm8twGKfpANc/ZO2Bm+fZyQvIaEZ5n9CHT0TEX36Q== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc0d5d39-c2b7-474f-36b1-08da59538dbc 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:22.2988 (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: hJWWbYMqBBPZM//ARcAoAFhg6FQOI8DLFThJIYgxl8zknSzt4fmb5yv1dGhWUjIhUPupfbaGzeLB3hSgZHUvvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151431_170806_44D429D6 X-CRM114-Status: GOOD ( 18.29 ) 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 converts the MAC portion of the FMan MAC bindings to yaml. Signed-off-by: Sean Anderson Reviewed-by: Rob Herring --- Changes in v2: - New .../bindings/net/fsl,fman-dtsec.yaml | 144 ++++++++++++++++++ .../devicetree/bindings/net/fsl-fman.txt | 128 +--------------- 2 files changed, 145 insertions(+), 127 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml diff --git a/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml b/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml new file mode 100644 index 000000000000..809df1589f20 --- /dev/null +++ b/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml @@ -0,0 +1,144 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/fsl,fman-dtsec.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP FMan MAC + +maintainers: + - Madalin Bucur + +description: | + Each FMan has several MACs, each implementing an Ethernet interface. Earlier + versions of FMan used the Datapath Three Speed Ethernet Controller (dTSEC) for + 10/100/1000 MBit/s speeds, and the 10-Gigabit Ethernet Media Access Controller + (10GEC) for 10 Gbit/s speeds. Later versions of FMan use the Multirate + Ethernet Media Access Controller (mEMAC) to handle all speeds. + +properties: + compatible: + enum: + - fsl,fman-dtsec + - fsl,fman-xgec + - fsl,fman-memac + + cell-index: + maximum: 64 + description: | + FManV2: + register[bit] MAC cell-index + ============================================================ + FM_EPI[16] XGEC 8 + FM_EPI[16+n] dTSECn n-1 + FM_NPI[11+n] dTSECn n-1 + n = 1,..,5 + + FManV3: + register[bit] MAC cell-index + ============================================================ + FM_EPI[16+n] mEMACn n-1 + FM_EPI[25] mEMAC10 9 + + FM_NPI[11+n] mEMACn n-1 + FM_NPI[10] mEMAC10 9 + FM_NPI[11] mEMAC9 8 + n = 1,..8 + + FM_EPI and FM_NPI are located in the FMan memory map. + + 2. SoC registers: + + - P2041, P3041, P4080 P5020, P5040: + register[bit] FMan MAC cell + Unit index + ============================================================ + DCFG_DEVDISR2[7] 1 XGEC 8 + DCFG_DEVDISR2[7+n] 1 dTSECn n-1 + DCFG_DEVDISR2[15] 2 XGEC 8 + DCFG_DEVDISR2[15+n] 2 dTSECn n-1 + n = 1,..5 + + - T1040, T2080, T4240, B4860: + register[bit] FMan MAC cell + Unit index + ============================================================ + DCFG_CCSR_DEVDISR2[n-1] 1 mEMACn n-1 + DCFG_CCSR_DEVDISR2[11+n] 2 mEMACn n-1 + n = 1,..6,9,10 + + EVDISR, DCFG_DEVDISR2 and DCFG_CCSR_DEVDISR2 are located in + the specific SoC "Device Configuration/Pin Control" Memory + Map. + + reg: + maxItems: 1 + + fsl,fman-ports: + $ref: /schemas/types.yaml#/definitions/phandle-array + maxItems: 2 + description: | + An array of two references: the first is the FMan RX port and the second + is the TX port used by this MAC. + + ptp-timer: + $ref: /schemas/types.yaml#/definitions/phandle + description: A reference to the IEEE1588 timer + + pcsphy-handle: + $ref: /schemas/types.yaml#/definitions/phandle + description: A reference to the PCS (typically found on the SerDes) + + tbi-handle: + $ref: /schemas/types.yaml#/definitions/phandle + description: A reference to the (TBI-based) PCS + +required: + - compatible + - cell-index + - reg + - fsl,fman-ports + - ptp-timer + +allOf: + - $ref: "ethernet-controller.yaml#" + - if: + properties: + compatible: + contains: + const: fsl,fman-dtsec + then: + required: + - tbi-handle + - if: + properties: + compatible: + contains: + const: fsl,fman-memac + then: + required: + - pcsphy-handle + +unevaluatedProperties: false + +examples: + - | + ethernet@e0000 { + compatible = "fsl,fman-dtsec"; + cell-index = <0>; + reg = <0xe0000 0x1000>; + fsl,fman-ports = <&fman1_rx8 &fman1_tx28>; + ptp-timer = <&ptp_timer>; + tbi-handle = <&tbi0>; + }; + - | + ethernet@e8000 { + cell-index = <4>; + compatible = "fsl,fman-memac"; + reg = <0xe8000 0x1000>; + fsl,fman-ports = <&fman0_rx_0x0c &fman0_tx_0x2c>; + ptp-timer = <&ptp_timer0>; + pcsphy-handle = <&pcsphy4>; + phy-handle = <&sgmii_phy1>; + phy-connection-type = "sgmii"; + }; diff --git a/Documentation/devicetree/bindings/net/fsl-fman.txt b/Documentation/devicetree/bindings/net/fsl-fman.txt index 801efc7d6818..b9055335db3b 100644 --- a/Documentation/devicetree/bindings/net/fsl-fman.txt +++ b/Documentation/devicetree/bindings/net/fsl-fman.txt @@ -232,133 +232,7 @@ port@81000 { ============================================================================= FMan dTSEC/XGEC/mEMAC Node -DESCRIPTION - -mEMAC/dTSEC/XGEC are the Ethernet network interfaces - -PROPERTIES - -- compatible - Usage: required - Value type: - Definition: A standard property. - Must include one of the following: - - "fsl,fman-dtsec" for dTSEC MAC - - "fsl,fman-xgec" for XGEC MAC - - "fsl,fman-memac" for mEMAC MAC - -- cell-index - Usage: required - Value type: - Definition: Specifies the MAC id. - - The cell-index value may be used by the FMan or the SoC, to - identify the MAC unit in the FMan (or SoC) memory map. - In the tables below there's a description of the cell-index - use, there are two tables, one describes the use of cell-index - by the FMan, the second describes the use by the SoC: - - 1. FMan Registers - - FManV2: - register[bit] MAC cell-index - ============================================================ - FM_EPI[16] XGEC 8 - FM_EPI[16+n] dTSECn n-1 - FM_NPI[11+n] dTSECn n-1 - n = 1,..,5 - - FManV3: - register[bit] MAC cell-index - ============================================================ - FM_EPI[16+n] mEMACn n-1 - FM_EPI[25] mEMAC10 9 - - FM_NPI[11+n] mEMACn n-1 - FM_NPI[10] mEMAC10 9 - FM_NPI[11] mEMAC9 8 - n = 1,..8 - - FM_EPI and FM_NPI are located in the FMan memory map. - - 2. SoC registers: - - - P2041, P3041, P4080 P5020, P5040: - register[bit] FMan MAC cell - Unit index - ============================================================ - DCFG_DEVDISR2[7] 1 XGEC 8 - DCFG_DEVDISR2[7+n] 1 dTSECn n-1 - DCFG_DEVDISR2[15] 2 XGEC 8 - DCFG_DEVDISR2[15+n] 2 dTSECn n-1 - n = 1,..5 - - - T1040, T2080, T4240, B4860: - register[bit] FMan MAC cell - Unit index - ============================================================ - DCFG_CCSR_DEVDISR2[n-1] 1 mEMACn n-1 - DCFG_CCSR_DEVDISR2[11+n] 2 mEMACn n-1 - n = 1,..6,9,10 - - EVDISR, DCFG_DEVDISR2 and DCFG_CCSR_DEVDISR2 are located in - the specific SoC "Device Configuration/Pin Control" Memory - Map. - -- reg - Usage: required - Value type: - Definition: A standard property. - -- fsl,fman-ports - Usage: required - Value type: - Definition: An array of two phandles - the first references is - the FMan RX port and the second is the TX port used by this - MAC. - -- ptp-timer - Usage required - Value type: - Definition: A phandle for 1EEE1588 timer. - -- pcsphy-handle - Usage required for "fsl,fman-memac" MACs - Value type: - Definition: A phandle for pcsphy. - -- tbi-handle - Usage required for "fsl,fman-dtsec" MACs - Value type: - Definition: A phandle for tbiphy. - -EXAMPLE - -fman1_tx28: port@a8000 { - cell-index = <0x28>; - compatible = "fsl,fman-v2-port-tx"; - reg = <0xa8000 0x1000>; -}; - -fman1_rx8: port@88000 { - cell-index = <0x8>; - compatible = "fsl,fman-v2-port-rx"; - reg = <0x88000 0x1000>; -}; - -ptp-timer: ptp_timer@fe000 { - compatible = "fsl,fman-ptp-timer"; - reg = <0xfe000 0x1000>; -}; - -ethernet@e0000 { - compatible = "fsl,fman-dtsec"; - cell-index = <0>; - reg = <0xe0000 0x1000>; - fsl,fman-ports = <&fman1_rx8 &fman1_tx28>; - ptp-timer = <&ptp-timer>; - tbi-handle = <&tbi0>; -}; +Refer to Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml ============================================================================ FMan IEEE 1588 Node From patchwork Tue Jun 28 22:13:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899061 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 1B18DC43334 for ; Tue, 28 Jun 2022 22:16:18 +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=kWg4N8bEHXzMD0DXNJs59iyqVrD73h1rB4nVZH3IhlY=; b=N+wBcSdWeJiFgI ngHKCAQhebFXTYU0YMzXvbv9/aUIEm/YLZRJlAqaubNpc3gaElYnmI3bs6UYFPCMA4vlD1A5wI+f3 D2mdebAWf6w+KujUssW34lCgyODBWY3ejBTQ76n+cn7Crajg8jE49MV0GqgVYaDrq1RKjPS+Aao+b 3G60XiS7uP51SlFLIMvLfIlg1rpya+ZLFKfNt29/YTPfxUSIMG6IK+SgxkEljFU1if7cF6JCwUKxi RY6PCOMo/oIf4i5jzhwIJaByFtKqYOWAhHBirZ0hXutkg6oTAHrZd1vGZdeq3VR3UEQVnisHOlOmh IPZWWW+dgDE4dYYvNw2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTw-008Mim-Ds; Tue, 28 Jun 2022 22:14:52 +0000 Received: from mail-eopbgr80074.outbound.protection.outlook.com ([40.107.8.74] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTY-008MXM-JD for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iPnmcvqNrETsshstt+Gs57zEJDswvWmu2JiN8AgqAkjZbKSyJPBp7I0+S0SfwvRRp/vRHETHpkqibGrFBIS1ICuoSHkOrpjyhzD2m7GG1VEwfFxR54jhvKIuBjC51tsYJ9yczm6/9JVdqahRIPXnltElIdvJYuxPBSwOyZk+on4vIxqpb9WpWOoTEi1JZ9TkWOlSI5GnLjMlpHjSuHwVcei4uSBNxjrqVu8Lerm+HIh6ri+/3GMuSJKO3Ii9bwLV47bd+PVP3XirYcq6GuekKWDO9+QV3d6WIS9nOeLBPSI5lsnG1yAV376K/VzapaysNchnoTnd5D0MrxDURMeqig== 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=oNBB+gwuLH9EjBRC8EkMePDCkfdtxLDNgHDR4IM0L5M=; b=culEfWa2VFHBxww05uf8oa8biLZc9maRQIWlAMC/phMA6uqstfq4Q6lmIQBhjyFOU7f0GaWwcrTU3nAA8jHMXNWc/w8Kh9tbVLwpBakhbxsyob+Ios6Gai2yCUDjTbsJ6rbIqAxZcd/UiyKtpf92tSZdmRNgU2Iji25ibNClSpt1axSxCU7e02bZQfeMe9ZMt451+/dkUtiNnsIcPB2CAJy9BHBTBE/0pUV/EKI3jnj1bv6ElYA8OD5YAT2uH6+5KPtIQpwTk5eZ9Fz/AjvKmYmgDC26cwh1YrpLbLkzz6SfVW3qUIXV0VHmwaO44ui28NyhWGbnAN1/VaIynl/FPg== 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=oNBB+gwuLH9EjBRC8EkMePDCkfdtxLDNgHDR4IM0L5M=; b=JfAvV1dF/2Ja8T6QkO5tk3G5SwLeDc+jGeSdeFqiD+591mdq4+30M624shh0gDpn+tqyg4ZPPIFG+E5Jhni6CLqrixEzIIxBXspD/Nas77LkaNJ5B/o9yb71ofaw7lFD1AhXRUAPC/FrTrVCEV82Bj9StfqnWfJSAZc1Ov9lAnSfxU5BApmEwX7MVgc2GRFfStYuMso6VIYIYDBdVpnIJScPo1IgAnRBqV+lpakCJOgtuId+MFX3si/ekso7JqiyGTtGnIaU9NqxgFixldlxhFS8onhFivnvoJ+ikWC9rZdjrs0fzsAi0PedEFfGmocT/HomEQFQ9THVlFbfqmSySA== 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:24 +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:24 +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 , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH net-next v2 03/35] dt-bindings: net: fman: Add additional interface properties Date: Tue, 28 Jun 2022 18:13:32 -0400 Message-Id: <20220628221404.1444200-4-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: 3227cfc8-f545-4e48-d72a-08da59538ec4 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: OKOtJAsce2KU+Y37ei39130FhmwDWIv+A7xKvP7qMsLLn66VLOvydqWosEXKT7PGVTsuuze4EKtPvdjcnPM7QmfUk1uZVoRFTyir9oXNNdVyr/djwm+zu6jhI6viAZY67oM9viT9dRjF177JA/XtjwQg7eqbPvd0xIFmXd1sOSG3pOZlWPZ4juw09svKPme8eCTS61eRDx7D4EKu+4Dj1RYTGoJ/WldmActXyamQiq3IUTVUh4LaXKqlZ6Fff7ad/izsg2lNRGVM2NPRkiG1j4s51g8PgjgURSJuvNIG6iZRDrh4SE1MWVTvSJhSD6FH9c/fYdUNVsk/j3G5fNQ0CgE/qJOKjdFDrjd7wMvPERue0hCtK7hPTIT3D6CiNJDlzyGwbX6zMaQMv7eeS1StTBVfEbCrWv6tLdJQ0mYTZW6V2EFuOE9bDHhtTHJsbdUZVOlYwvu+ZJgkI7RCcJGQaY9Ssew9x/0bjxv8SD0K/UWXR+mFziyBnHWGP6eDUGRkqltkty8fuU9niBPuxN//kMmCJ5tKg83GB4YPeCqE2BRICaUE1riq05bEpzdiVtpkwudvdm353+WVt3LcvHp+SEqPf90K45ai7NrEI6y8rqO+t9iw0WM8fpgYuHPVt8f6KO6G+Uv5EinHgv+B63Frz/Y+X/Mu8/HoJ1slg4lV65A0lT6tO2CvtgnbQo/vT1YNORBfTxJ2Yhqj3/TxskQY5IV5KIRdevAZ3PZyWlsi6qJ5uZs4VSMh7TmGxhMYPCBE9VMLnABTuzLfrSLgxewWYArjolZTgRB9q07uDcBGXqc= 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)(7416002)(44832011)(6512007)(6666004)(186003)(38350700002)(1076003)(83380400001)(86362001)(2906002)(66476007)(8936002)(6486002)(4326008)(41300700001)(8676002)(26005)(52116002)(36756003)(478600001)(66946007)(2616005)(6506007)(316002)(54906003)(66556008)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /u4+5wr1NlDsyNJMH65UBkqROZmbKtIc52cW21ByLmkVi5iuooQto8zSjpfiwkl5OXOicGoi6/+c1eCcg7JFAW+7gMiAH0ZnxUfnunIDsGc4BuHzqPCB79ONM0xMuVvVpN3RI/ahM7aEyDX2FZy8hGmGXXpa80DE4z9C1m0RAKniHyvX/4eHe+ikD4G4fW3KNuQG2bPiC2U1yS/C8J1dmEmAXTdyQtBl4f2/4QF8ynyatbF33W6SG0dL9PavIAQV8mDS3lGTA/0NmDQF5p5yhqqc6kE7cbQLFtOxD7xQ2XugLMy3BSuVt8rNQcQsrGVro1LiqJnH8jJDGklZIM+SeuckNmV7pNJAmY61XmW3lvg2VpguDNR66puqxTSgxnuonNlRJG7QG/aWq7Gdun/v1pRpUfCMl5SCxjqc2xD1Nopx81Y4K0AU2m4oYLLMT0+XpDMwSifUqVRdGjsQaHWx54PTA5NizRCwMWSdG/Hj/WyEMUO6dBk80Jj/sumeB20cugkPoCYAQCex84WX8/sRMST3rAe6AqeTt23c5i3iY40Fdv47WMNxM7bH8bg1SPuBo2mZPKG/cwoy2sCca6o4jkmGJGcH3SMx18ACZrtxwF4u/yihcwdCZNjSNJpyk8kIlikpmjZ6salEUBCRtj2pB4c9u43YU97/OH5yJV0esQHjwk5JbV+m46bnCBDeWGRjdgeBwjngVNlb4LkruGpSdmmOCu6ahEf7yHe57//eU/TGFpREgrTfJgJrwRXIUMbTmwQaNKEqCAUODARTCs+9E/UYLLFMkohn0roBJ1k+OJhlS5dtDSwUYlb+SenVOCy1l4kGC/D1heOVQh+fplhskuRp2AdVFfgiS40aIvZiMJ1c9mri+cZqzud2U0zns6gZhL7kdg9dQ4LF3hl4O5snFH1iVCoYtdedzowYlrUWJWZ5f8muxhd4MuwfuOXVSFMueM1IbAyCp7vvEzY3gAPSOVZRIFgIGBqWvpdwKQuLU2MUiMR+JqBJDa0ZlMi/jD7WcQUrC3lNKFH3P+WImnZQc3whKenbp0Qu0AtncI9P/T6j+gQ/Kf6dADgCjmd45V4i4WkkpoX+KWcw1HH5Vc7udE+Nh2AD0FPxMFgNhH/4h7vRyoWSMkkZE/z5C3lfBF+yNd8UGXllIaBboHNg2mSSszlerJOeQ4PDNz8qCtZTjLZqggtR3mBM/G39nbQnK9F7D6NRhjrC5Yyht3P7BBiLmj8zTumWoBn5c1vntxVE9EWQ1G2M5000hPcPkge282YLfuX/1nqKD1zw8hQ24wLC3Sllxw3RTE+4aakvHS21UJgmKTrxDuuQl+9ZQkYhBAvC2oHCVZtEKn9w0EohWybww1uS9NpPfFxIpGnwF8g3ZBuD1YeXVZzDM3jtakWm+EZHWoyY9DDe4TLd8TfpkolLZ3EpxfPZxq8LmIqz2ap8isBS4PKR0pMuKnc4HfjGdC7MKWZdCpG81eRrdS0BXI/b4nsQArKPD8ugXJEa6ENCpv72KzEq7YiLdLKfvPU1hrXsU7AV7FM5UZVgMQ1EjuxoItc2CAzjiFAs+aaihbgO0kXRwWa5zdWOFtgMkLghK+ajrrS4fIrEukHu3MgXb4B5qQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3227cfc8-f545-4e48-d72a-08da59538ec4 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:24.0800 (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: s+S8R0JwA6VofSPTyfjfYDj+riEnyiojUAgNOPwHwzWV3y4Bhv12WCS0DvK7Pn1shdTHyEbLEIKg0SPtvp9NuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151428_838846_BA330D9F X-CRM114-Status: GOOD ( 28.90 ) 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 At the moment, mEMACs are configured almost completely based on the phy-connection-type. That is, if the phy interface is RGMII, it assumed that RGMII is supported. For some interfaces, it is assumed that the RCW/bootloader has set up the SerDes properly. This is generally OK, but restricts runtime reconfiguration. The actual link state is never reported. To address these shortcomings, the driver will need additional information. First, it needs to know how to access the PCS/PMAs (in order to configure them and get the link status). The SGMII PCS/PMA is the only currently-described PCS/PMA. Add the XFI and QSGMII PCS/PMAs as well. The XFI (and 1GBase-KR) PCS/PMA is a c45 "phy" which sits on the same MDIO bus as SGMII PCS/PMA. By default they will have conflicting addresses, but they are also not enabled at the same time by default. Therefore, we can let the XFI PCS/PMA be the default when phy-connection-type is xgmii. This will allow for backwards-compatibility. QSGMII, however, cannot work with the current binding. This is because the QSGMII PCS/PMAs are only present on one MAC's MDIO bus. At the moment this is worked around by having every MAC write to the PCS/PMA addresses (without checking if they are present). This only works if each MAC has the same configuration, and only if we don't need to know the status. Because the QSGMII PCS/PMA will typically be located on a different MDIO bus than the MAC's SGMII PCS/PMA, there is no fallback for the QSGMII PCS/PMA. mEMACs (across all SoCs) support the following protocols: - MII - RGMII - SGMII, 1000Base-X, and 1000Base-KX - 2500Base-X (aka 2.5G SGMII) - QSGMII - 10GBase-R (aka XFI) and 10GBase-KR - XAUI and HiGig Each line documents a set of orthogonal protocols (e.g. XAUI is supported if and only if HiGig is supported). Additionally, - XAUI implies support for 10GBase-R - 10GBase-R is supported if and only if RGMII is not supported - 2500Base-X implies support for 1000Base-X - MII implies support for RGMII To switch between different protocols, we must reconfigure the SerDes. This is done by using the standard phys property. We can also use it to validate whether different protocols are supported (e.g. using phy_validate). This will work for serial protocols, but not RGMII or MII. Additionally, we still need to be compatible when there is no SerDes. While we can detect 10G support by examining the port speed (as set by fsl,fman-10g-port), we cannot determine support for any of the other protocols based on the existing binding. In fact, the binding works against us in some respects, because pcsphy-handle is required even if there is no possible PCS/PMA for that MAC. To allow for backwards- compatibility, we use a boolean-style property for RGMII (instead of presence/absence-style). When the property for RGMII is missing, we will assume that it is supported. The exception is MII, since no existing device trees use it (as far as I could tell). Unfortunately, QSGMII support will be broken for old device trees. There is nothing we can do about this because of the PCS/PMA situation (as described above). Signed-off-by: Sean Anderson --- Changes in v2: - Better document how we select which PCS to use in the default case .../bindings/net/fsl,fman-dtsec.yaml | 52 +++++++++++++++++-- .../devicetree/bindings/net/fsl-fman.txt | 5 +- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml b/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml index 809df1589f20..ecb772258164 100644 --- a/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml +++ b/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml @@ -85,9 +85,41 @@ properties: $ref: /schemas/types.yaml#/definitions/phandle description: A reference to the IEEE1588 timer + phys: + description: A reference to the SerDes lane(s) + maxItems: 1 + + phy-names: + items: + - const: serdes + pcsphy-handle: - $ref: /schemas/types.yaml#/definitions/phandle - description: A reference to the PCS (typically found on the SerDes) + $ref: /schemas/types.yaml#/definitions/phandle-array + minItems: 1 + maxItems: 3 + description: | + A reference to the various PCSs (typically found on the SerDes). If + pcs-names is absent, and phy-connection-type is "xgmii", then the first + reference will be assumed to be for "xfi". Otherwise, if pcs-names is + absent, then the first reference will be assumed to be for "sgmii". + + pcs-names: + $ref: /schemas/types.yaml#/definitions/string-array + minItems: 1 + maxItems: 3 + contains: + enum: + - sgmii + - qsgmii + - xfi + description: The type of each PCS in pcsphy-handle. + + rgmii: + enum: [0, 1] + description: 1 indicates RGMII is supported, and 0 indicates it is not. + + mii: + description: If present, indicates that MII is supported. tbi-handle: $ref: /schemas/types.yaml#/definitions/phandle @@ -100,6 +132,10 @@ required: - fsl,fman-ports - ptp-timer +dependencies: + pcs-names: [pcsphy-handle] + mii: [rgmii] + allOf: - $ref: "ethernet-controller.yaml#" - if: @@ -117,7 +153,11 @@ allOf: const: fsl,fman-memac then: required: - - pcsphy-handle + - rgmii + else: + properties: + rgmii: false + mii: false unevaluatedProperties: false @@ -138,7 +178,11 @@ examples: reg = <0xe8000 0x1000>; fsl,fman-ports = <&fman0_rx_0x0c &fman0_tx_0x2c>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy4>; + pcsphy-handle = <&pcsphy4>, <&qsgmiib_pcs1>; + pcs-names = "sgmii", "qsgmii"; + rgmii = <0>; phy-handle = <&sgmii_phy1>; phy-connection-type = "sgmii"; + phys = <&serdes1 1>; + phy-names = "serdes"; }; diff --git a/Documentation/devicetree/bindings/net/fsl-fman.txt b/Documentation/devicetree/bindings/net/fsl-fman.txt index b9055335db3b..bda4b41af074 100644 --- a/Documentation/devicetree/bindings/net/fsl-fman.txt +++ b/Documentation/devicetree/bindings/net/fsl-fman.txt @@ -320,8 +320,9 @@ For internal PHY device on internal mdio bus, a PHY node should be created. See the definition of the PHY node in booting-without-of.txt for an example of how to define a PHY (Internal PHY has no interrupt line). - For "fsl,fman-mdio" compatible internal mdio bus, the PHY is TBI PHY. -- For "fsl,fman-memac-mdio" compatible internal mdio bus, the PHY is PCS PHY, - PCS PHY addr must be '0'. +- For "fsl,fman-memac-mdio" compatible internal mdio bus, the PHY is PCS PHY. + The PCS PHY address should correspond to the value of the appropriate + MDEV_PORT. EXAMPLE From patchwork Tue Jun 28 22:13:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899073 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 A899AC43334 for ; Tue, 28 Jun 2022 22:18:57 +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=VgDBlhrVBsbYOSqUXtQHs2dAJ5FXYLE4VvgYJqUaBF0=; b=leo9xYOqvP3hHr THbPMxnSbZOZ/v7m0eqj2hvyWm2dAQ2ANEkxfZEFA3VQuIbMpgkZ4uOIXmCJ4QRqmXQ3juCEtd6IS WuYfYk8O7I4NGYcRtUTcrJ3bbRAR5RQDcmP5bE6INxZMwiK7YNbe0OG+sYCj8w7BYA89PdOJmiii5 Ume5jbeRBFTj+NMeZfhTJZeMB5rXjk5TBgaJmchmTp70CPE3bROq+2RZ6AqhhE+uxZhoEmKomqCmx ozw6lwkpstNZp/BUdOL87Qe7qpbT87fV7+XWoe16o7TCIFhMraehJT3ANJgscYxuzkiYtaBvUpqZh jD2vW1BseASZUFNyg0eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JWE-008Nb0-DS; Tue, 28 Jun 2022 22:17:15 +0000 Received: from mail-eopbgr80074.outbound.protection.outlook.com ([40.107.8.74] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTd-008MXM-LD; Tue, 28 Jun 2022 22:14:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=df/r6V/21G7LPOURnuwXKt+Pythy+OeSta04v06tInJg6nNcFtmQh/f2V2YTqDqCr3o5gl2LL+JWGQtndV3igQkwbW9KdXvxtUgHGYFwjzlRXVKQ6ZbGFqySeiCCVwethPzLXvwXKRWTROdHIcJPU8nkJTRkD4Bm74M553uIGj0er+Db1mBPIlDp9e40KsHE6efHZKm48fL5l0n88uUdf8hGHJYIb/WwWNwympK/p0UUU9YhUxQn/5UCAXrrgaRZEIam2UXkiaei8rD4HDNnwyKcZ9WzPqr1W9TGJg+OJiFKCt1RdylVyNX/y39IeLrE2Jr9F4+NmsLgqiiFV+SBFw== 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=856x6AmWuv6mpao6egh/sVqYqN1m+/CnEDCqvevmQ4Y=; b=afM6mnRR+EdbQclh17n11iAoAld/yFVOiI33ejrap5LIhJsN08rHYRw1eewWRORvIeKkN1LcBfPLa3xPyjvVJe0cmKbVFw2IsITgdpz55flCCB3i6PNI98qHSCi6nuWw+091Icij49kXpZ2lhQjXo2Ng1sWvHszu11/tlVHFGpbtUwnb/cuDhvEMwiGM3di0OeRIIU6Dm8mYZDfz69yAWYMcBASauztKzxMOPxy/w2ZJH6KU5IeLakZ1aVzsN2zFWBLkGnnNQCGU4QeoUpIWgGHXRCYTA5VuDaPXPRNrIF8Jw9tBj0P2ZYtn9iFOXaeGAPpLUANJROXTCfjD7bqQYQ== 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=856x6AmWuv6mpao6egh/sVqYqN1m+/CnEDCqvevmQ4Y=; b=vFAlHSZCvfs8gtLC2uP3OEYxTSED7KuOB2J5dtY6jyccVm+4ZNQdA/H3ClWuGuJWT2/74pE8kXyRrdbjQ3SNGEcZaGmU4sxItu2CgOGWawX60BT2wlO/t08Xuxy9TjhBKVbiHFrCm2K0jO7rEs8OZtEAk9GopAr3i78Uk0zcDFhYowxCYd98f7uyyUvPaQnzan6EhP1/+02k441ycA4JVpvBjXmW3OstLyZpGlC/y6eUwlysnJGgsSMyTRFtxJeWN2ukJmaJzNz2/sJvauFkroN3szpVuj7ovBIl3VJ7D9IFLAE9gi/FZW6gcPPzrTwHhu0ss5NmlBmtPAKhk/MI4g== 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:26 +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:26 +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 , Ioana Ciornei , Jonathan Corbet , Kishon Vijay Abraham I , Krzysztof Kozlowski , Rob Herring , Vinod Koul , devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH net-next v2 04/35] [RFC] phy: fsl: Add Lynx 10G SerDes driver Date: Tue, 28 Jun 2022 18:13:33 -0400 Message-Id: <20220628221404.1444200-5-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: 7d2e2624-122c-4596-3654-08da5953902f 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: euZjQs98V64o15SgfXsaupVBlBsG1n5iJX0PNFT76jqO5Qxp/LmQOfFd7xvrsQzSiRTzwTMD30jyw8/7CL2OcrO2EYbIF0CQKuEKPx9ghUR2I9TzzOpdnjiAr+orEq4OO1TXxEb/4D35MdsF0mtWzdIB4vKQZrYNAyADyuTGjdNbnjLfaWY+TnvKi3YaSkAQiM6IdtBvdI3ymr8U3kZ1+hpzHIrUBM7x33rdLhw1bavlLX6x3quz/2p+0AdjZCBtyCsrMI8BoZ4J8zF4RkW7k2nlscQws0ScO7rCypWrd+v9vhCVo9cJ8MbfgLtbaDB3R/yZsA6BKOzZR+H2JxddTO1oZGYXv1CGhENdwdRfLaGIu2krfFNNyh2bLtua1mubwjGTCTazQ0F1MulK3t5oUz+vxh5xoPWth4lfGB6z3lfC7RC3FSQKCCTf9TKWvo03YyJCptmThaKww99g184W+5JoeaNUwqnaeEGK54OMFBKdbc8vuzPqudhgGlM5i2JEh8MaFkFtllhqbtPy3GdQrJKtc3mBUyG44eGNu84Gl+luCUZYuB3mwJW39FPDnHp1xfCs7qicWBgqVXhyc2HjBmE1GPp3kJAq0PhpEQTqUO3E7eMyofFBXYw5rJJ1z5DuUFuQvl+I0mLRfPeQP1rvITwDzCj2j1+ZcvAG+pfeeTA2nnWNBNexEDTnj9aXeGH+SRaZsAHXyPTg6tZniaYKO8NVBV9rXy7cVmMTDCp+M+wmEw06oteTtaYGBLkGc5bjbnAw095YCX6VKAkmfk/0k+BdNwCouF1MLolso/F44ChtmlSNdaOMFQD2asckGYxN 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)(7416002)(44832011)(6512007)(6666004)(186003)(30864003)(38350700002)(1076003)(83380400001)(86362001)(2906002)(66476007)(8936002)(6486002)(4326008)(41300700001)(8676002)(26005)(52116002)(36756003)(478600001)(66946007)(2616005)(6506007)(316002)(54906003)(66556008)(110136005)(21314003)(579004)(559001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xeFxBXF+jsvYf32olORpdkl2BeN5r3Bm40e8JRYXi6Htlqadfz7KwwUPpS2NOvFJvALPdRA+8MldvxxFENgwEo2aHyeaaRJ1X9EbL+1ZbEXT42U/X0hNm4U2uO+RtQETzRo0uj2CCG5PUjAdF/aUyLpUvRv1UwCDkRByvtNxQa+sjCnNbDDsvxpHwiz+U6bz8/0hqhLuR320PQL4lPiHOlp0W5woKe7oItAzXVcSk0ESQP2WyE8583uYz8U6ZAYizGZnPj2Wydpll9jigoUm70PVfwoEdrQS1eOV4dMp+ZzFqZo/nOrhp3/6mZMm2SeGdR/N6BS4xRpbNbpBsj7plr2/zTmmguNWnmOdnRpzdtSaHIo9/xiuMn/M0Fu+iPWOZBdDLlUs18VCSmkrIF4IeiEzDkXz8Gv4/ZuwRZORnZEOiLxeRUH3/Ub5nRT6npB9AejuAf/zIpwO1/WebT2knAi8klH25cyWn4vC3K2DMKFpKBv6lVK4FLTV75Sk/JxDLwsmp0qwpepvgOx8FHGVPlZ9fl7eFwk/2aYb4NXbI3lAcZUZHPXQe4Jjir0LgqHYDGmJ2PIOmsfPqcJLFPDFA5TpWGkiiCg9gS6m8n4dxiX5NcmQxWN5hy9ZUmkfHN6W2cqgcOF3rPfC2xu6SMd1YPBoWScslyFM0Ypb8YU6OufW8Cd+1ej9+oQVbk339hR9T6A5dlwM/lZNF2BKwlf/Znf3jJX38FhRz5vgn8Dp2jS80kK9SMNkEaJopnJWgmdVN2xvHU75uqEYq8P7SYuUfx9prsV57qEaGDKIuvNwBS5pB7uyEdtqGND22gW2CqmIzOP34P1aDddMWRymEgdpFyUOjJ5YPT/TWJl51sotdoAG+0smeVDYOjNfcBiTUSeNJkNqx8fuMxB5WORLiTghBCwo1eoFxT0fbJM9kboP/l0HlJ1EVntuz7KUFs8uEQHxrtJ6HUKJRBp/O9rlME/AQZm142C9tcQv8RTnCSoytndBiTEVhjHEOIAzWJf1QbF7mNvFk71KKljKdL44u6XPxVyFAiEUHcBMyBMmvfxpNaPx6Fgm5zqy8yCqc6nERGRjC9TZxwEydUgJPJ8fEOWsKO51k0odU8dXFS9hEWJc4qGJB7cR6L/1ZDS8uajxgmBTrD/AaKTPAZ1PYLEt5bZzhLxWt5kkpWxIhxNajsDgh+U4Kd0KstAr/7siRROP/2m4fOI3I0NAqyyUDSbXd3V7GnK4nmgV1BDh45sGPuQxej74egegh+rX9aCLQURC6Azzs+SbQI/Q0hfUnpqHYuwfoaLYPAIjmUAWxgUC29NJc0eFxE8uskJ5Qjpz7VMktR+HFJSr+OzWSqVs10P0MLcX+J8sbcgrvWG3XTtSWWeb7d1pyfY6XgDxeXmeqT2+4A/m+UBZtQRA7l57d/g/V/3a9MuLa0XL9+Op/zhYSij9PxL5dDFkiGWZf1FhZ4woFgrOiNL3KHJc7zVZY+M/pxcHHrJUfZsUOcfbaKlu5gjcbzuopFw8KijVLlouhVhHuF8BJjdcmanvdofu7awGCJJqyJRq9n24MJPzkCg4JM9rqKUNInXkAK8axfVAs9ZgwejJcjv39V5IXpqMYzIx5AtK6A== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d2e2624-122c-4596-3654-08da5953902f 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:26.4235 (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: 6evMe7BTkt92U9JminO6gjkVppmDJ/4MI4Bi9MAjkjy7QMuSpIG32UXf4AhnHI8rKoCyM8mmVP7quiKUn2BlSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151433_951618_0B964F5C X-CRM114-Status: GOOD ( 35.32 ) 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 adds support for the Lynx 10G "SerDes" devices found on various NXP QorIQ SoCs. There may be up to four SerDes devices on each SoC, each supporting up to eight lanes. Protocol support for each SerDes is highly heterogeneous, with each SoC typically having a totally different selection of supported protocols for each lane. Additionally, the SerDes devices on each SoC also have differing support. One SerDes will typically support Ethernet on most lanes, while the other will typically support PCIe on most lanes. There is wide hardware support for this SerDes. I have not done extensive digging, but it seems to be used on almost every QorIQ device, including the AMP and Layerscape series. Because each SoC typically has specific instructions and exceptions for its SerDes, I have limited the initial scope of this module to just the LS1046A. Additionally, I have only added support for Ethernet protocols. There is not a great need for dynamic reconfiguration for other protocols (SATA and PCIe handle rate changes in hardware), so support for them may never be added. Nevertheless, I have tried to provide an obvious path for adding support for other SoCs as well as other protocols. SATA just needs support for configuring LNmSSCR0. PCIe may need to configure the equalization registers. It also uses multiple lanes. I have tried to write the driver with multi-lane support in mind, so there should not need to be any large changes. Although there are 6 protocols supported, I have only tested SGMII and XFI. The rest have been implemented as described in the datasheet. The PLLs are modeled as clocks proper. This lets us take advantage of the existing clock infrastructure. I have not given the same treatment to the lane "clocks" (dividers) because they need to be programmed in-concert with the rest of the lane settings. One tricky thing is that the VCO (pll) rate exceeds 2^32 (maxing out at around 5GHz). This will be a problem on 32-bit platforms, since clock rates are stored as unsigned longs. To work around this, the pll clock rate is generally treated in units of kHz. The PLLs are configured rather interestingly. Instead of the usual direct programming of the appropriate divisors, the input and output clock rates are selected directly. Generally, the only restriction is that the input and output must be integer multiples of each other. This suggests some kind of internal look-up table. The datasheets generally list out the supported combinations explicitly, and not all input/output combinations are documented. I'm not sure if this is due to lack of support, or due to an oversight. If this becomes an issue, then some combinations can be blacklisted (or whitelisted). This may also be necessary for other SoCs which have more stringent clock requirements. The general API call list for this PHY is documented under the driver-api docs. I think this is rather standard, except that most driverts configure the mode (protocol) at xlate-time. Unlike some other phys where e.g. PCIe x4 will use 4 separate phys all configured for PCIe, this driver uses one phy configured to use 4 lanes. This is because while the individual lanes may be configured individually, the protocol selection acts on all lanes at once. Additionally, the order which lanes should be configured in is specified by the datasheet. To coordinate this, lanes are reserved in phy_init, and released in phy_exit. When getting a phy, if a phy already exists for those lanes, it is reused. This is to make things like QSGMII work. Four MACs will all want to ensure that the lane is configured properly, and we need to ensure they can all call phy_init, etc. There is refcounting for phy_init and phy_power_on, so the phy will only be powered on once. However, there is no refcounting for phy_set_mode. A "rogue" MAC could set the mode to something non-QSGMII and break the other MACs. Perhaps there is an opportunity for future enhancement here. This driver was written with reference to the LS1046A reference manual. However, it was informed by reference manuals for all processors with mEMACs, especially the T4240 (which appears to have a "maxed-out" configuration). Signed-off-by: Sean Anderson --- As noted later on in this series (in the phylink conversion patch), this driver does not quite function properly. When the bootloader is instructed to not configure the SerDes, only one lane comes up. Changes in v2: - Clear SGMIIaCR1_PCS_EN during probe - Fix not clearing group->pll after disabling it - Handle 1000Base-KX in lynx_proto_mode_prep - Power off lanes during probe - Rename LYNX_PROTO_UNKNOWN to LYNX_PROTO_NONE - Rename driver to Lynx 10G (etc.) - Support 1 and 2 phy-cells Documentation/driver-api/phy/index.rst | 1 + Documentation/driver-api/phy/qoriq.rst | 93 ++ MAINTAINERS | 6 + drivers/phy/freescale/Kconfig | 19 + drivers/phy/freescale/Makefile | 1 + drivers/phy/freescale/phy-fsl-lynx-10g.c | 1483 ++++++++++++++++++++++ 6 files changed, 1603 insertions(+) create mode 100644 Documentation/driver-api/phy/qoriq.rst create mode 100644 drivers/phy/freescale/phy-fsl-lynx-10g.c diff --git a/Documentation/driver-api/phy/index.rst b/Documentation/driver-api/phy/index.rst index 69ba1216de72..cc7ded8b969c 100644 --- a/Documentation/driver-api/phy/index.rst +++ b/Documentation/driver-api/phy/index.rst @@ -7,6 +7,7 @@ Generic PHY Framework .. toctree:: phy + qoriq samsung-usb2 .. only:: subproject and html diff --git a/Documentation/driver-api/phy/qoriq.rst b/Documentation/driver-api/phy/qoriq.rst new file mode 100644 index 000000000000..cbc2ac9ca4aa --- /dev/null +++ b/Documentation/driver-api/phy/qoriq.rst @@ -0,0 +1,93 @@ +.. SPDX-License-Identifier: GPL-2.0 + +======================= +QorIQ SerDes (Lynx 10G) +======================= + +Using this phy +-------------- + +The general order of calls should be:: + + [devm_][of_]phy_get() + phy_init() + phy_power_on() + phy_set_mode[_ext]() + ... + phy_power_off() + phy_exit() + [[of_]phy_put()] + +:c:func:`phy_get` just gets (or creates) a new :c:type:`phy` with the lanes +described in the phandle. :c:func:`phy_init` is what actually reserves the +lanes for use. Unlike some other drivers, when the phy is created, there is no +default protocol. :c:func:`phy_set_mode ` must be called in +order to set the protocol. + +Supporting SoCs +--------------- + +Each new SoC needs a :c:type:`struct lynx_conf ` for each SerDes. +The most important member is `modes`, which is an array of :c:type:`struct +lynx_mode `. Each "mode" represents a configuration which can be +programmed into a protocol control register. Modes can support multiple lanes +(such for PCIe x2 or x4), as well as multiple protocols (such as SGMII and +1000Base-KX). There are several helper macros to make configuring each mode +easier. It is important that the list of modes is complete, even if not all +protocols are supported. This lets the driver know which lanes are available, +and which have been configured by the RCW. + +If a protocol is missing, add it to :c:type:`enum lynx_protocol +`, and to ``UNSUPPORTED_PROTOS``. If the PCCR shifts/masks for +your protocol are missing, you will need to add them to +:c:func:`lynx_proto_mode_mask` and :c:func:`lynx_proto_mode_shift`. + +For example, the configuration for SerDes1 of the LS1046A is:: + + static const struct lynx_mode ls1046a_modes1[] = { + CONF_SINGLE(1, PCIE, 0x0, 1, 0b001), + CONF_1000BASEKX(0, 0x8, 0, 0b001), + CONF_SGMII25KX(1, 0x8, 1, 0b001), + CONF_SGMII25KX(2, 0x8, 2, 0b001), + CONF_SGMII25KX(3, 0x8, 3, 0b001), + CONF_SINGLE(1, QSGMII, 0x9, 2, 0b001), + CONF_XFI(2, 0xB, 0, 0b010), + CONF_XFI(3, 0xB, 1, 0b001), + }; + + static const struct lynx_conf ls1046a_conf1 = { + .modes = ls1046a_modes1, + .mode_count = ARRAY_SIZE(ls1046a_modes1), + .lanes = 4, + .endian = REGMAP_ENDIAN_BIG, + }; + +There is an additional set of configuration for SerDes2, which supports a +different set of modes. Both configurations should be added to the match +table:: + + { .compatible = "fsl,ls1046-serdes-1", .data = &ls1046a_conf1 }, + { .compatible = "fsl,ls1046-serdes-2", .data = &ls1046a_conf2 }, + +Supporting Protocols +-------------------- + +Each protocol is a combination of values which must be programmed into the lane +registers. To add a new protocol, first add it to :c:type:`enum lynx_protocol +`. If it is in ``UNSUPPORTED_PROTOS``, remove it. Add a new +entry to `lynx_proto_params`, and populate the appropriate fields. You may need +to add some new members to support new fields. Modify `lynx_lookup_proto` to +map the :c:type:`enum phy_mode ` to :c:type:`enum lynx_protocol +`. Ensure that :c:func:`lynx_proto_mode_mask` and +:c:func:`lynx_proto_mode_shift` have been updated with support for your +protocol. + +You may need to modify :c:func:`lynx_set_mode` in order to support your +procotol. This can happen when you have added members to :c:type:`struct +lynx_proto_params `. It can also happen if you have specific +clocking requirements, or protocol-specific registers to program. + +Internal API Reference +---------------------- + +.. kernel-doc:: drivers/phy/freescale/phy-fsl-lynx-10g.c diff --git a/MAINTAINERS b/MAINTAINERS index ca95b1833b97..ef65e2acdb48 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7977,6 +7977,12 @@ F: drivers/ptp/ptp_qoriq.c F: drivers/ptp/ptp_qoriq_debugfs.c F: include/linux/fsl/ptp_qoriq.h +FREESCALE QORIQ SERDES DRIVER +M: Sean Anderson +S: Maintained +F: Documentation/driver-api/phy/qoriq.rst +F: drivers/phy/freescale/phy-qoriq.c + FREESCALE QUAD SPI DRIVER M: Han Xu L: linux-spi@vger.kernel.org diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig index f9c54cd02036..857b4d123515 100644 --- a/drivers/phy/freescale/Kconfig +++ b/drivers/phy/freescale/Kconfig @@ -38,3 +38,22 @@ config PHY_FSL_LYNX_28G found on NXP's Layerscape platforms such as LX2160A. Used to change the protocol running on SerDes lanes at runtime. Only useful for a restricted set of Ethernet protocols. + +config PHY_FSL_LYNX_10G + tristate "Freescale Layerscale Lynx 10G SerDes support" + select GENERIC_PHY + select REGMAP_MMIO + help + This adds support for the Lynx "SerDes" devices found on various QorIQ + SoCs. There may be up to four SerDes devices on each SoC, and each + device supports up to eight lanes. The SerDes is configured by default + by the RCW, but this module is necessary in order to support dynamic + reconfiguration (such as to support 1G and 10G ethernet on the same + interface). The hardware supports a variety of protocols, including + Ethernet, SATA, PCIe, and more exotic links such as Interlaken and + Aurora. This driver only supports Ethernet, but it will try not to + touch lanes configured for other protocols. + + If you have a QorIQ processor and want to dynamically reconfigure your + SerDes, say Y. If this driver is compiled as a module, it will be + named phy-qoriq. diff --git a/drivers/phy/freescale/Makefile b/drivers/phy/freescale/Makefile index 3518d5dbe8a7..aa4374ed217c 100644 --- a/drivers/phy/freescale/Makefile +++ b/drivers/phy/freescale/Makefile @@ -2,4 +2,5 @@ obj-$(CONFIG_PHY_FSL_IMX8MQ_USB) += phy-fsl-imx8mq-usb.o obj-$(CONFIG_PHY_MIXEL_MIPI_DPHY) += phy-fsl-imx8-mipi-dphy.o obj-$(CONFIG_PHY_FSL_IMX8M_PCIE) += phy-fsl-imx8m-pcie.o +obj-$(CONFIG_PHY_FSL_LYNX_10G) += phy-fsl-lynx-10g.o obj-$(CONFIG_PHY_FSL_LYNX_28G) += phy-fsl-lynx-28g.o diff --git a/drivers/phy/freescale/phy-fsl-lynx-10g.c b/drivers/phy/freescale/phy-fsl-lynx-10g.c new file mode 100644 index 000000000000..480bd493fbc2 --- /dev/null +++ b/drivers/phy/freescale/phy-fsl-lynx-10g.c @@ -0,0 +1,1483 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2022 Sean Anderson + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define PLL_STRIDE 0x20 +#define PLLa(a, off) ((a) * PLL_STRIDE + (off)) +#define PLLaRSTCTL(a) PLLa(a, 0x00) +#define PLLaCR0(a) PLLa(a, 0x04) + +#define PLLaRSTCTL_RSTREQ BIT(31) +#define PLLaRSTCTL_RST_DONE BIT(30) +#define PLLaRSTCTL_RST_ERR BIT(29) +#define PLLaRSTCTL_PLLRST_B BIT(7) +#define PLLaRSTCTL_SDRST_B BIT(6) +#define PLLaRSTCTL_SDEN BIT(5) + +#define PLLaCR0_POFF BIT(31) +#define PLLaCR0_RFCLK_SEL GENMASK(30, 28) +#define PLLaCR0_PLL_LCK BIT(23) +#define PLLaCR0_FRATE_SEL GENMASK(19, 16) +#define PLLaCR0_DLYDIV_SEL GENMASK(1, 0) + +#define PCCR_BASE 0x200 +#define PCCR_STRIDE 0x4 +#define PCCRn(n) (PCCR_BASE + n * PCCR_STRIDE) + +#define PCCR0_PEXa_MASK GENMASK(2, 0) +#define PCCR0_PEXa_SHIFT(a) (28 - (a) * 4) + +#define PCCR2_SATAa_MASK GENMASK(2, 0) +#define PCCR2_SATAa_SHIFT(a) (28 - (a) * 4) + +#define PCCR8_SGMIIa_KX BIT(3) +#define PCCR8_SGMIIa_MASK GENMASK(3, 0) +#define PCCR8_SGMIIa_SHIFT(a) (28 - (a) * 4) + +#define PCCR9_QSGMIIa_MASK GENMASK(2, 0) +#define PCCR9_QSGMIIa_SHIFT(a) (28 - (a) * 4) + +#define PCCRB_XFIa_MASK GENMASK(2, 0) +#define PCCRB_XFIa_SHIFT(a) (28 - (a) * 4) + +#define LANE_BASE 0x800 +#define LANE_STRIDE 0x40 +#define LNm(m, off) (LANE_BASE + (m) * LANE_STRIDE + (off)) +#define LNmGCR0(m) LNm(m, 0x00) +#define LNmGCR1(m) LNm(m, 0x04) +#define LNmSSCR0(m) LNm(m, 0x0C) +#define LNmRECR0(m) LNm(m, 0x10) +#define LNmRECR1(m) LNm(m, 0x14) +#define LNmTECR0(m) LNm(m, 0x18) +#define LNmSSCR1(m) LNm(m, 0x1C) +#define LNmTTLCR0(m) LNm(m, 0x20) + +#define LNmGCR0_RPLL_LES BIT(31) +#define LNmGCR0_RRAT_SEL GENMASK(29, 28) +#define LNmGCR0_TPLL_LES BIT(27) +#define LNmGCR0_TRAT_SEL GENMASK(25, 24) +#define LNmGCR0_RRST_B BIT(22) +#define LNmGCR0_TRST_B BIT(21) +#define LNmGCR0_RX_PD BIT(20) +#define LNmGCR0_TX_PD BIT(19) +#define LNmGCR0_IF20BIT_EN BIT(18) +#define LNmGCR0_FIRST_LANE BIT(16) +#define LNmGCR0_TTRM_VM_SEL GENMASK(13, 12) +#define LNmGCR0_PROTS GENMASK(11, 7) + +#define LNmGCR0_RAT_SEL_SAME 0b00 +#define LNmGCR0_RAT_SEL_HALF 0b01 +#define LNmGCR0_RAT_SEL_QUARTER 0b10 +#define LNmGCR0_RAT_SEL_DOUBLE 0b11 + +#define LNmGCR0_PROTS_PCIE 0b00000 +#define LNmGCR0_PROTS_SGMII 0b00001 +#define LNmGCR0_PROTS_SATA 0b00010 +#define LNmGCR0_PROTS_XFI 0b01010 + +#define LNmGCR1_RDAT_INV BIT(31) +#define LNmGCR1_TDAT_INV BIT(30) +#define LNmGCR1_OPAD_CTL BIT(26) +#define LNmGCR1_REIDL_TH GENMASK(22, 20) +#define LNmGCR1_REIDL_EX_SEL GENMASK(19, 18) +#define LNmGCR1_REIDL_ET_SEL GENMASK(17, 16) +#define LNmGCR1_REIDL_EX_MSB BIT(15) +#define LNmGCR1_REIDL_ET_MSB BIT(14) +#define LNmGCR1_REQ_CTL_SNP BIT(13) +#define LNmGCR1_REQ_CDR_SNP BIT(12) +#define LNmGCR1_TRSTDIR BIT(7) +#define LNmGCR1_REQ_BIN_SNP BIT(6) +#define LNmGCR1_ISLEW_RCTL GENMASK(5, 4) +#define LNmGCR1_OSLEW_RCTL GENMASK(1, 0) + +#define LNmRECR0_GK2OVD GENMASK(27, 24) +#define LNmRECR0_GK3OVD GENMASK(19, 16) +#define LNmRECR0_GK2OVD_EN BIT(15) +#define LNmRECR0_GK3OVD_EN BIT(16) +#define LNmRECR0_BASE_WAND GENMASK(11, 10) +#define LNmRECR0_OSETOVD GENMASK(5, 0) + +#define LNmRECR0_BASE_WAND_OFF 0b00 +#define LNmRECR0_BASE_WAND_DEFAULT 0b01 +#define LNmRECR0_BASE_WAND_ALTERNATE 0b10 +#define LNmRECR0_BASE_WAND_OSETOVD 0b11 + +#define LNmTECR0_TEQ_TYPE GENMASK(29, 28) +#define LNmTECR0_SGN_PREQ BIT(26) +#define LNmTECR0_RATIO_PREQ GENMASK(25, 22) +#define LNmTECR0_SGN_POST1Q BIT(21) +#define LNmTECR0_RATIO_PST1Q GENMASK(20, 16) +#define LNmTECR0_ADPT_EQ GENMASK(13, 8) +#define LNmTECR0_AMP_RED GENMASK(5, 0) + +#define LNmTECR0_TEQ_TYPE_NONE 0b00 +#define LNmTECR0_TEQ_TYPE_PRE 0b01 +#define LNmTECR0_TEQ_TYPE_BOTH 0b10 + +#define LNmTTLCR0_FLT_SEL GENMASK(29, 24) + +#define PCS_STRIDE 0x10 +#define CR_STRIDE 0x4 +#define PCSa(a, base, cr) (base + (a) * PCS_STRIDE + (cr) * CR_STRIDE) + +#define PCSaCR1_MDEV_PORT GENMASK(31, 27) + +#define SGMII_BASE 0x1800 +#define SGMIIaCR1(a) PCSa(a, SGMII_BASE, 1) + +#define SGMIIaCR1_SGPCS_EN BIT(11) + +#define QSGMII_OFFSET 0x1880 +#define QSGMIIaCR1(a) PCSa(a, QSGMII_BASE, 1) + +#define XFI_OFFSET 0x1980 +#define XFIaCR1(a) PCSa(a, XFI_BASE, 1) + +/* The maximum number of lanes in a single serdes */ +#define MAX_LANES 8 + +enum lynx_protocol { + LYNX_PROTO_NONE = 0, + LYNX_PROTO_SGMII, + LYNX_PROTO_SGMII25, + LYNX_PROTO_1000BASEKX, + LYNX_PROTO_QSGMII, + LYNX_PROTO_XFI, + LYNX_PROTO_10GKR, + LYNX_PROTO_PCIE, /* Not implemented */ + LYNX_PROTO_SATA, /* Not implemented */ + LYNX_PROTO_LAST, +}; + +static const char lynx_proto_str[][16] = { + [LYNX_PROTO_NONE] = "unknown", + [LYNX_PROTO_SGMII] = "SGMII", + [LYNX_PROTO_SGMII25] = "2.5G SGMII", + [LYNX_PROTO_1000BASEKX] = "1000Base-KX", + [LYNX_PROTO_QSGMII] = "QSGMII", + [LYNX_PROTO_XFI] = "XFI", + [LYNX_PROTO_10GKR] = "10GBase-KR", + [LYNX_PROTO_PCIE] = "PCIe", + [LYNX_PROTO_SATA] = "SATA", +}; + +#define PROTO_MASK(proto) BIT(LYNX_PROTO_##proto) +#define UNSUPPORTED_PROTOS (PROTO_MASK(SATA) | PROTO_MASK(PCIE)) + +/** + * struct lynx_proto_params - Parameters for configuring a protocol + * @frate_khz: The PLL rate, in kHz + * @rat_sel: The divider to get the line rate + * @if20bit: Whether the proto is 20 bits or 10 bits + * @prots: Lane protocol select + * @reidl_th: Receiver electrical idle detection threshold + * @reidl_ex: Exit electrical idle filter + * @reidl_et: Enter idle filter + * @slew: Slew control + * @baseline_wander: Enable baseline wander correction + * @gain: Adaptive equalization gain override + * @offset_override: Adaptive equalization offset override + * @teq: Transmit equalization type (none, precursor, or precursor and + * postcursor). The next few values are only used for appropriate + * equalization types. + * @preq_ratio: Ratio of full swing transition bit to pre-cursor + * @postq_ratio: Ratio of full swing transition bit to first post-cursor. + * @adpt_eq: Transmitter Adjustments for 8G/10G + * @amp_red: Overall TX Amplitude Reduction + * @flt_sel: TTL configuration selector + */ +struct lynx_proto_params { + u32 frate_khz; + u8 rat_sel; + u8 prots; + u8 reidl_th; + u8 reidl_ex; + u8 reidl_et; + u8 slew; + u8 gain; + u8 baseline_wander; + u8 offset_override; + u8 teq; + u8 preq_ratio; + u8 postq_ratio; + u8 adpt_eq; + u8 amp_red; + u8 flt_sel; + bool if20bit; +}; + +static const struct lynx_proto_params lynx_proto_params[] = { + [LYNX_PROTO_SGMII] = { + .frate_khz = 5000000, + .rat_sel = LNmGCR0_RAT_SEL_QUARTER, + .if20bit = false, + .prots = LNmGCR0_PROTS_SGMII, + .reidl_th = 0b001, + .reidl_ex = 0b011, + .reidl_et = 0b100, + .slew = 0b01, + .gain = 0b1111, + .offset_override = 0b0011111, + .teq = LNmTECR0_TEQ_TYPE_NONE, + .adpt_eq = 0b110000, + .amp_red = 0b000110, + .flt_sel = 0b111001, + }, + [LYNX_PROTO_1000BASEKX] = { + .frate_khz = 5000000, + .rat_sel = LNmGCR0_RAT_SEL_QUARTER, + .if20bit = false, + .prots = LNmGCR0_PROTS_SGMII, + .slew = 0b01, + .gain = 0b1111, + .offset_override = 0b0011111, + .teq = LNmTECR0_TEQ_TYPE_NONE, + .adpt_eq = 0b110000, + .flt_sel = 0b111001, + }, + [LYNX_PROTO_SGMII25] = { + .frate_khz = 3125000, + .rat_sel = LNmGCR0_RAT_SEL_SAME, + .if20bit = false, + .prots = LNmGCR0_PROTS_SGMII, + .slew = 0b10, + .offset_override = 0b0011111, + .teq = LNmTECR0_TEQ_TYPE_PRE, + .postq_ratio = 0b00110, + .adpt_eq = 0b110000, + }, + [LYNX_PROTO_QSGMII] = { + .frate_khz = 5000000, + .rat_sel = LNmGCR0_RAT_SEL_SAME, + .if20bit = true, + .prots = LNmGCR0_PROTS_SGMII, + .slew = 0b01, + .offset_override = 0b0011111, + .teq = LNmTECR0_TEQ_TYPE_PRE, + .postq_ratio = 0b00110, + .adpt_eq = 0b110000, + .amp_red = 0b000010, + }, + [LYNX_PROTO_XFI] = { + .frate_khz = 5156250, + .rat_sel = LNmGCR0_RAT_SEL_DOUBLE, + .if20bit = true, + .prots = LNmGCR0_PROTS_XFI, + .slew = 0b01, + .baseline_wander = LNmRECR0_BASE_WAND_DEFAULT, + .offset_override = 0b1011111, + .teq = LNmTECR0_TEQ_TYPE_PRE, + .postq_ratio = 0b00011, + .adpt_eq = 0b110000, + .amp_red = 0b000111, + }, + [LYNX_PROTO_10GKR] = { + .frate_khz = 5156250, + .rat_sel = LNmGCR0_RAT_SEL_DOUBLE, + .prots = LNmGCR0_PROTS_XFI, + .slew = 0b01, + .baseline_wander = LNmRECR0_BASE_WAND_DEFAULT, + .offset_override = 0b1011111, + .teq = LNmTECR0_TEQ_TYPE_BOTH, + .preq_ratio = 0b0011, + .postq_ratio = 0b01100, + .adpt_eq = 0b110000, + }, +}; + +/** + * struct lynx_mode - A single configuration of a protocol controller + * @protos: A bitmask of the &enum lynx_protocol this mode supports + * @lanes: A bitmask of the lanes which will be used when this config is + * selected + * @pccr: The number of the PCCR which contains this mode + * @idx: The index of the protocol controller. For example, SGMIIB would have + * index 1. + * @cfg: The value to program into the controller to select this mode + * + * The serdes has multiple protocol controllers which can be each be selected + * independently. Depending on their configuration, they may use multiple lanes + * at once (e.g. AUI or PCIe x4). Additionally, multiple protocols may be + * supported by a single mode (XFI and 10GKR differ only in their protocol + * parameters). + */ +struct lynx_mode { + u16 protos; + u8 lanes; + u8 pccr; + u8 idx; + u8 cfg; +}; + +static_assert(LYNX_PROTO_LAST - 1 <= + sizeof_field(struct lynx_mode, protos) * BITS_PER_BYTE); +static_assert(MAX_LANES <= + sizeof_field(struct lynx_mode, lanes) * BITS_PER_BYTE); + +#define CONF(_lanes, _protos, _pccr, _idx, _cfg) { \ + .lanes = _lanes, \ + .protos = _protos, \ + .pccr = _pccr, \ + .idx = _idx, \ + .cfg = _cfg, \ +} + +#define CONF_SINGLE(lane, proto, pccr, idx, cfg) \ + CONF(BIT(lane), PROTO_MASK(proto), pccr, idx, cfg) + +#define CONF_1000BASEKX(lane, pccr, idx, cfg) \ + CONF(BIT(lane), PROTO_MASK(SGMII) | PROTO_MASK(1000BASEKX), \ + pccr, idx, cfg) + +#define CONF_SGMII25(lane, pccr, idx, cfg) \ + CONF(BIT(lane), PROTO_MASK(SGMII) | PROTO_MASK(SGMII25), \ + pccr, idx, cfg) + +#define CONF_SGMII25KX(lane, pccr, idx, cfg) \ + CONF(BIT(lane), \ + PROTO_MASK(SGMII) | PROTO_MASK(1000BASEKX) | PROTO_MASK(SGMII25), \ + pccr, idx, cfg) + +#define CONF_XFI(lane, pccr, idx, cfg) \ + CONF(BIT(lane), PROTO_MASK(XFI) | PROTO_MASK(10GKR), pccr, idx, cfg) + +/** + * struct lynx_conf - Configuration for a particular serdes + * @modes: Valid protocol controller configurations + * @mode_count: Number of modes in @modes + * @lanes: Number of lanes + * @endian: Endianness of the registers + */ +struct lynx_conf { + const struct lynx_mode *modes; + size_t mode_count; + unsigned int lanes; + enum regmap_endian endian; +}; + +struct lynx_priv; + +/** + * struct lynx_clk - Driver data for the PLLs + * @hw: The clock hardware + * @serdes: The parent serdes + * @idx: Which PLL this clock is for + */ +struct lynx_clk { + struct clk_hw hw; + struct lynx_priv *serdes; + unsigned int idx; +}; + +static struct lynx_clk *lynx_clk_hw_to_priv(struct clk_hw *hw) +{ + return container_of(hw, struct lynx_clk, hw); +} + +/** + * struct lynx_priv - Driver data for the serdes + * @lock: A lock protecting "common" registers in @regmap, as well as the + * members of this struct. Lane-specific registers are protected by the + * phy's lock. PLL registers are protected by the clock's lock. + * @pll: The PLL clocks + * @ref: The reference clocks for the PLLs + * @dev: The serdes device + * @regmap: The backing regmap + * @conf: The configuration for this serdes + * @used_lanes: Bitmap of the lanes currently used by phys + * @groups: List of the created groups + */ +struct lynx_priv { + struct mutex lock; + struct lynx_clk pll[2]; + struct clk *ref[2]; + struct device *dev; + struct regmap *regmap; + const struct lynx_conf *conf; + unsigned int used_lanes; + struct list_head groups; +}; + +/** + * struct lynx_group - Driver data for a group of lanes + * @groups: List of other groups; protected by @serdes->lock. + * @phy: The associated phy + * @serdes: The parent serdes + * @pll: The currently-used pll + * @first_lane: The first lane in the group + * @last_lane: The last lane in the group + * @proto: The currently-configured protocol + * @users: Number of current users; protected by @serdes->lock. + */ +struct lynx_group { + struct list_head groups; + struct phy *phy; + struct lynx_priv *serdes; + struct clk *pll; + unsigned int first_lane; + unsigned int last_lane; + enum lynx_protocol proto; + unsigned int users; +}; + +static u32 lynx_read(struct lynx_priv *serdes, u32 reg) +{ + unsigned int ret = 0; + + WARN_ON_ONCE(regmap_read(serdes->regmap, reg, &ret)); + return ret; +} + +static void lynx_write(struct lynx_priv *serdes, u32 val, u32 reg) +{ + WARN_ON_ONCE(regmap_write(serdes->regmap, reg, val)); +} + +/* XXX: The output rate is in kHz to avoid overflow on 32-bit arches */ + +static void lynx_pll_disable(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_clk_hw_to_priv(hw); + struct lynx_priv *serdes = clk->serdes; + u32 rstctl = lynx_read(serdes, PLLaRSTCTL(clk->idx)); + + dev_dbg(clk->serdes->dev, "%s(pll%d)\n", __func__, clk->idx); + + rstctl &= ~PLLaRSTCTL_SDRST_B; + lynx_write(serdes, rstctl, PLLaRSTCTL(clk->idx)); + ndelay(50); + rstctl &= ~(PLLaRSTCTL_SDEN | PLLaRSTCTL_PLLRST_B); + lynx_write(serdes, rstctl, PLLaRSTCTL(clk->idx)); + ndelay(100); +} + +static int lynx_pll_enable(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_clk_hw_to_priv(hw); + struct lynx_priv *serdes = clk->serdes; + u32 rstctl = lynx_read(serdes, PLLaRSTCTL(clk->idx)); + + dev_dbg(clk->serdes->dev, "%s(pll%d)\n", __func__, clk->idx); + + rstctl |= PLLaRSTCTL_RSTREQ; + lynx_write(serdes, rstctl, PLLaRSTCTL(clk->idx)); + + rstctl &= ~PLLaRSTCTL_RSTREQ; + rstctl |= PLLaRSTCTL_SDEN | PLLaRSTCTL_PLLRST_B | PLLaRSTCTL_SDRST_B; + lynx_write(serdes, rstctl, PLLaRSTCTL(clk->idx)); + + /* TODO: wait for the PLL to lock */ + + return 0; +} + +static int lynx_pll_is_enabled(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_clk_hw_to_priv(hw); + struct lynx_priv *serdes = clk->serdes; + u32 rstctl = lynx_read(serdes, PLLaRSTCTL(clk->idx)); + + dev_dbg(clk->serdes->dev, "%s(pll%d)\n", __func__, clk->idx); + + return rstctl & PLLaRSTCTL_RST_DONE && !(rstctl & PLLaRSTCTL_RST_ERR); +} + +static const u32 rfclk_sel_map[8] = { + [0b000] = 100000000, + [0b001] = 125000000, + [0b010] = 156250000, + [0b011] = 150000000, +}; + +/** + * lynx_rfclk_to_sel() - Convert a reference clock rate to a selector + * @rate: The reference clock rate + * + * To allow for some variation in the reference clock rate, up to 100ppm of + * error is allowed. + * + * Return: An appropriate selector for @rate, or -%EINVAL. + */ +static int lynx_rfclk_to_sel(u32 rate) +{ + int ret; + + for (ret = 0; ret < ARRAY_SIZE(rfclk_sel_map); ret++) { + u32 rfclk_rate = rfclk_sel_map[ret]; + /* Allow an error of 100ppm */ + u32 error = rfclk_rate / 10000; + + if (rate > rfclk_rate - error && rate < rfclk_rate + error) + return ret; + } + + return -EINVAL; +} + +static const u32 frate_sel_map[16] = { + [0b0000] = 5000000, + [0b0101] = 3750000, + [0b0110] = 5156250, + [0b0111] = 4000000, + [0b1001] = 3125000, + [0b1010] = 3000000, +}; + +/** + * lynx_frate_to_sel() - Convert a VCO clock rate to a selector + * @rate_khz: The VCO frequency, in kHz + * + * Return: An appropriate selector for @rate_khz, or -%EINVAL. + */ +static int lynx_frate_to_sel(u32 rate_khz) +{ + int ret; + + for (ret = 0; ret < ARRAY_SIZE(frate_sel_map); ret++) + if (frate_sel_map[ret] == rate_khz) + return ret; + + return -EINVAL; +} + +static u32 lynx_pll_ratio(u32 frate_sel, u32 rfclk_sel) +{ + u64 frate; + u32 rfclk, error, ratio; + + frate = frate_sel_map[frate_sel] * (u64)HZ_PER_KHZ; + rfclk = rfclk_sel_map[rfclk_sel]; + + if (!frate || !rfclk) + return 0; + + ratio = div_u64_rem(frate, rfclk, &error); + if (!error) + return ratio; + return 0; +} + +static unsigned long lynx_pll_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct lynx_clk *clk = lynx_clk_hw_to_priv(hw); + struct lynx_priv *serdes = clk->serdes; + u32 cr0 = lynx_read(serdes, PLLaCR0(clk->idx)); + u32 frate_sel = FIELD_GET(PLLaCR0_FRATE_SEL, cr0); + u32 rfclk_sel = FIELD_GET(PLLaCR0_RFCLK_SEL, cr0); + unsigned long ret; + + dev_dbg(clk->serdes->dev, "%s(pll%d, %lu)\n", __func__, + clk->idx, parent_rate); + + ret = mult_frac(parent_rate, lynx_pll_ratio(frate_sel, rfclk_sel), + HZ_PER_KHZ); + return ret; +} + +static long lynx_pll_round_rate(struct clk_hw *hw, unsigned long rate_khz, + unsigned long *parent_rate) +{ + int frate_sel, rfclk_sel; + struct lynx_clk *clk = lynx_clk_hw_to_priv(hw); + u32 ratio; + + dev_dbg(clk->serdes->dev, "%s(pll%d, %lu, %lu)\n", __func__, + clk->idx, rate_khz, *parent_rate); + + frate_sel = lynx_frate_to_sel(rate_khz); + if (frate_sel < 0) + return frate_sel; + + rfclk_sel = lynx_rfclk_to_sel(*parent_rate); + if (rfclk_sel >= 0) { + ratio = lynx_pll_ratio(frate_sel, rfclk_sel); + if (ratio) + return mult_frac(*parent_rate, ratio, HZ_PER_KHZ); + } + + for (rfclk_sel = 0; + rfclk_sel < ARRAY_SIZE(rfclk_sel_map); + rfclk_sel++) { + ratio = lynx_pll_ratio(frate_sel, rfclk_sel); + if (ratio) { + *parent_rate = rfclk_sel_map[rfclk_sel]; + return mult_frac(*parent_rate, ratio, HZ_PER_KHZ); + } + } + + return -EINVAL; +} + +static int lynx_pll_set_rate(struct clk_hw *hw, unsigned long rate_khz, + unsigned long parent_rate) +{ + int frate_sel, rfclk_sel, ret; + struct lynx_clk *clk = lynx_clk_hw_to_priv(hw); + struct lynx_priv *serdes = clk->serdes; + u32 ratio, cr0 = lynx_read(serdes, PLLaCR0(clk->idx)); + + dev_dbg(clk->serdes->dev, "%s(pll%d, %lu, %lu)\n", __func__, + clk->idx, rate_khz, parent_rate); + + frate_sel = lynx_frate_to_sel(rate_khz); + if (frate_sel < 0) + return frate_sel; + + /* First try the existing rate */ + rfclk_sel = lynx_rfclk_to_sel(parent_rate); + if (rfclk_sel >= 0) { + ratio = lynx_pll_ratio(frate_sel, rfclk_sel); + if (ratio) + goto got_rfclk; + } + + for (rfclk_sel = 0; + rfclk_sel < ARRAY_SIZE(rfclk_sel_map); + rfclk_sel++) { + ratio = lynx_pll_ratio(frate_sel, rfclk_sel); + if (ratio) { + ret = clk_set_rate(serdes->ref[clk->idx], + rfclk_sel_map[rfclk_sel]); + if (!ret) + goto got_rfclk; + } + } + + return ret; + +got_rfclk: + cr0 &= ~(PLLaCR0_RFCLK_SEL | PLLaCR0_FRATE_SEL); + cr0 |= FIELD_PREP(PLLaCR0_RFCLK_SEL, rfclk_sel); + cr0 |= FIELD_PREP(PLLaCR0_FRATE_SEL, frate_sel); + lynx_write(serdes, cr0, PLLaCR0(clk->idx)); + return 0; +} + +static const struct clk_ops lynx_pll_clk_ops = { + .enable = lynx_pll_enable, + .disable = lynx_pll_disable, + .is_enabled = lynx_pll_is_enabled, + .recalc_rate = lynx_pll_recalc_rate, + .round_rate = lynx_pll_round_rate, + .set_rate = lynx_pll_set_rate, +}; + +static struct clk_hw *lynx_clk_get(struct of_phandle_args *clkspec, void *data) +{ + struct lynx_priv *serdes = data; + + if (clkspec->args_count != 1) + return ERR_PTR(-EINVAL); + + if (clkspec->args[0] > 1) + return ERR_PTR(-EINVAL); + + return &serdes->pll[clkspec->args[0]].hw; +} + +/** + * lynx_lane_bitmap() - Get a bitmap for a group of lanes + * @group: The group of lanes + * + * Return: A mask containing all bits between @group->first and @group->last + */ +static unsigned int lynx_lane_bitmap(struct lynx_group *group) +{ + if (group->first_lane > group->last_lane) + return GENMASK(group->first_lane, group->last_lane); + else + return GENMASK(group->last_lane, group->first_lane); +} + +static int lynx_init(struct phy *phy) +{ + int ret = 0; + struct lynx_group *group = phy_get_drvdata(phy); + struct lynx_priv *serdes = group->serdes; + unsigned int lane_mask = lynx_lane_bitmap(group); + + mutex_lock(&serdes->lock); + if (serdes->used_lanes & lane_mask) + ret = -EBUSY; + else + serdes->used_lanes |= lane_mask; + mutex_unlock(&serdes->lock); + return ret; +} + +static int lynx_exit(struct phy *phy) +{ + struct lynx_group *group = phy_get_drvdata(phy); + struct lynx_priv *serdes = group->serdes; + + clk_disable_unprepare(group->pll); + clk_rate_exclusive_put(group->pll); + group->pll = NULL; + + mutex_lock(&serdes->lock); + serdes->used_lanes &= ~lynx_lane_bitmap(group); + mutex_unlock(&serdes->lock); + return 0; +} + +/* + * This is tricky. If first_lane=1 and last_lane=0, the condition will see 2, + * 1, 0. But the loop body will see 1, 0. We do this to avoid underflow. We + * can't pull the same trick when incrementing, because then we might have to + * start at -1 if (e.g.) first_lane = 0. + */ +#define for_range(val, start, end) \ + for (val = start < end ? start : start + 1; \ + start < end ? val <= end : val-- > end; \ + start < end ? val++ : 0) +#define for_each_lane(lane, group) \ + for_range(lane, group->first_lane, group->last_lane) +#define for_each_lane_reverse(lane, group) \ + for_range(lane, group->last_lane, group->first_lane) + +static int lynx_power_on(struct phy *phy) +{ + int i; + struct lynx_group *group = phy_get_drvdata(phy); + u32 gcr0; + + for_each_lane(i, group) { + gcr0 = lynx_read(group->serdes, LNmGCR0(i)); + gcr0 &= ~(LNmGCR0_RX_PD | LNmGCR0_TX_PD); + lynx_write(group->serdes, gcr0, LNmGCR0(i)); + + usleep_range(15, 30); + gcr0 |= LNmGCR0_RRST_B | LNmGCR0_TRST_B; + lynx_write(group->serdes, gcr0, LNmGCR0(i)); + } + + return 0; +} + +static void lynx_power_off_lane(struct lynx_priv *serdes, unsigned int lane) +{ + u32 gcr0 = lynx_read(serdes, LNmGCR0(lane)); + + gcr0 |= LNmGCR0_RX_PD | LNmGCR0_TX_PD; + gcr0 &= ~(LNmGCR0_RRST_B | LNmGCR0_TRST_B); + lynx_write(serdes, gcr0, LNmGCR0(lane)); +} + +static int lynx_power_off(struct phy *phy) +{ + unsigned int i; + struct lynx_group *group = phy_get_drvdata(phy); + + for_each_lane_reverse(i, group) + lynx_power_off_lane(group->serdes, i); + + return 0; +} + +/** + * lynx_lookup_proto() - Convert a phy-subsystem mode to a protocol + * @mode: The mode to convert + * @submode: The submode of @mode + * + * Return: A corresponding serdes-specific mode + */ +static enum lynx_protocol lynx_lookup_proto(enum phy_mode mode, int submode) +{ + switch (mode) { + case PHY_MODE_ETHERNET: + switch (submode) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + return LYNX_PROTO_SGMII; + case PHY_INTERFACE_MODE_2500BASEX: + return LYNX_PROTO_SGMII25; + case PHY_INTERFACE_MODE_QSGMII: + return LYNX_PROTO_QSGMII; + case PHY_INTERFACE_MODE_XGMII: + case PHY_INTERFACE_MODE_10GBASER: + return LYNX_PROTO_XFI; + case PHY_INTERFACE_MODE_10GKR: + return LYNX_PROTO_10GKR; + default: + return LYNX_PROTO_NONE; + } + /* Not implemented (yet) */ + case PHY_MODE_PCIE: + case PHY_MODE_SATA: + default: + return LYNX_PROTO_NONE; + } +} + +/** + * lynx_lookup_mode() - Get the mode for a group/protocol combination + * @group: The group of lanes to use + * @proto: The protocol to use + * + * Return: An appropriate mode to use, or %NULL if none match. + */ +static const struct lynx_mode *lynx_lookup_mode(struct lynx_group *group, + enum lynx_protocol proto) +{ + int i; + const struct lynx_conf *conf = group->serdes->conf; + + for (i = 0; i < conf->mode_count; i++) { + const struct lynx_mode *mode = &conf->modes[i]; + + if (BIT(proto) & mode->protos && + lynx_lane_bitmap(group) == mode->lanes) + return mode; + } + + return NULL; +} + +static int lynx_validate(struct phy *phy, enum phy_mode phy_mode, int submode, + union phy_configure_opts *opts) +{ + enum lynx_protocol proto; + struct lynx_group *group = phy_get_drvdata(phy); + const struct lynx_mode *mode; + + proto = lynx_lookup_proto(phy_mode, submode); + if (proto == LYNX_PROTO_NONE) + return -EINVAL; + + /* Nothing to do */ + if (proto == group->proto) + return 0; + + mode = lynx_lookup_mode(group, proto); + if (!mode) + return -EINVAL; + + return 0; +} + +/** + * lynx_proto_mode_mask() - Get the mask for a PCCR config + * @mode: The mode to use + * + * Return: The mask, shifted down to the lsb. + */ +static u32 lynx_proto_mode_mask(const struct lynx_mode *mode) +{ + switch (mode->pccr) { + case 0x0: + if (mode->protos & PROTO_MASK(PCIE)) + return PCCR0_PEXa_MASK; + break; + case 0x2: + if (mode->protos & PROTO_MASK(SATA)) + return PCCR2_SATAa_MASK; + break; + case 0x8: + if (mode->protos & PROTO_MASK(SGMII)) + return PCCR8_SGMIIa_MASK; + break; + case 0x9: + if (mode->protos & PROTO_MASK(QSGMII)) + return PCCR9_QSGMIIa_MASK; + break; + case 0xB: + if (mode->protos & PROTO_MASK(XFI)) + return PCCRB_XFIa_MASK; + break; + } + pr_err("unknown mode PCCR%X %s%c\n", mode->pccr, + lynx_proto_str[mode->protos], 'A' + mode->idx); + return 0; +} + +/** + * lynx_proto_mode_shift() - Get the shift for a PCCR config + * @mode: The mode to use + * + * Return: The amount of bits to shift the mask. + */ +static u32 lynx_proto_mode_shift(const struct lynx_mode *mode) +{ + switch (mode->pccr) { + case 0x0: + if (mode->protos & PROTO_MASK(PCIE)) + return PCCR0_PEXa_SHIFT(mode->idx); + break; + case 0x2: + if (mode->protos & PROTO_MASK(SATA)) + return PCCR2_SATAa_SHIFT(mode->idx); + break; + case 0x8: + if (mode->protos & PROTO_MASK(SGMII)) + return PCCR8_SGMIIa_SHIFT(mode->idx); + break; + case 0x9: + if (mode->protos & PROTO_MASK(QSGMII)) + return PCCR9_QSGMIIa_SHIFT(mode->idx); + break; + case 0xB: + if (mode->protos & PROTO_MASK(XFI)) + return PCCRB_XFIa_SHIFT(mode->idx); + break; + } + pr_err("unknown mode PCCR%X %s%c\n", mode->pccr, + lynx_proto_str[mode->protos], 'A' + mode->idx); + return 0; +} + +/** + * lynx_proto_mode_get() - Get the current config for a PCCR mode + * @mode: The mode to use + * @pccr: The current value of the PCCR + * + * Return: The current value of the PCCR config for this mode + */ +static u32 lynx_proto_mode_get(const struct lynx_mode *mode, u32 pccr) +{ + return (pccr >> lynx_proto_mode_shift(mode)) & + lynx_proto_mode_mask(mode); +} + +/** + * lynx_proto_mode_prep() - Configure a PCCR for a protocol + * @mode: The mode to use + * @pccr: The current value of the PCCR + * @proto: The protocol to configure + * + * This configures a PCCR for a mode and protocol. To disable a mode, pass + * %LYNX_PROTO_NONE as @proto. If @proto is 1000Base-KX, then the KX bit + * will be set. + * + * Return: The new value for the PCCR + */ +static u32 lynx_proto_mode_prep(const struct lynx_mode *mode, u32 pccr, + enum lynx_protocol proto) +{ + u32 shift = lynx_proto_mode_shift(mode); + + pccr &= ~(lynx_proto_mode_mask(mode) << shift); + if (proto != LYNX_PROTO_NONE) + pccr |= mode->cfg << shift; + + if (proto == LYNX_PROTO_1000BASEKX) { + if (mode->pccr == 8) + pccr |= PCCR8_SGMIIa_KX << shift; + else + pr_err("PCCR%X doesn't have a KX bit\n", mode->pccr); + } + + return pccr; +} + +#define abs_diff(a, b) ({ \ + typeof(a) _a = (a); \ + typeof(b) _b = (b); \ + _a > _b ? _a - _b : _b - _a; \ +}) + +static int lynx_set_mode(struct phy *phy, enum phy_mode phy_mode, int submode) +{ + enum lynx_protocol proto; + const struct lynx_proto_params *params; + const struct lynx_mode *old_mode = NULL, *new_mode; + int i, pll, ret; + struct lynx_group *group = phy_get_drvdata(phy); + struct lynx_priv *serdes = group->serdes; + u32 tmp; + u32 gcr0 = 0, gcr1 = 0, recr0 = 0, tecr0 = 0; + u32 gcr0_mask = 0, gcr1_mask = 0, recr0_mask = 0, tecr0_mask = 0; + + proto = lynx_lookup_proto(phy_mode, submode); + if (proto == LYNX_PROTO_NONE) { + dev_dbg(&phy->dev, "unknown mode/submode %d/%d\n", + phy_mode, submode); + return -EINVAL; + } + + /* Nothing to do */ + if (proto == group->proto) + return 0; + + new_mode = lynx_lookup_mode(group, proto); + if (!new_mode) { + dev_dbg(&phy->dev, "could not find mode for %s on lanes %u to %u\n", + lynx_proto_str[proto], group->first_lane, + group->last_lane); + return -EINVAL; + } + + if (group->proto != LYNX_PROTO_NONE) { + old_mode = lynx_lookup_mode(group, group->proto); + if (!old_mode) { + dev_err(&phy->dev, "could not find mode for %s\n", + lynx_proto_str[group->proto]); + return -EBUSY; + } + } + + clk_disable_unprepare(group->pll); + clk_rate_exclusive_put(group->pll); + group->pll = NULL; + + /* First, try to use a PLL which already has the correct rate */ + params = &lynx_proto_params[proto]; + for (pll = 0; pll < ARRAY_SIZE(serdes->pll); pll++) { + struct clk *clk = serdes->pll[pll].hw.clk; + unsigned long rate = clk_get_rate(clk); + unsigned long error = abs_diff(rate, params->frate_khz); + + dev_dbg(&phy->dev, "pll%d has rate %lu\n", pll, rate); + /* Accept up to 100ppm deviation */ + if ((!error || params->frate_khz / error > 10000) && + !clk_set_rate_exclusive(clk, rate)) + goto got_pll; + /* Someone else got a different rate first */ + } + + /* If neither PLL has the right rate, try setting it */ + for (pll = 0; pll < 2; pll++) { + ret = clk_set_rate_exclusive(serdes->pll[pll].hw.clk, + params->frate_khz); + if (!ret) + goto got_pll; + } + + dev_dbg(&phy->dev, "could not get a pll at %ukHz\n", + params->frate_khz); + return ret; + +got_pll: + group->pll = serdes->pll[pll].hw.clk; + clk_prepare_enable(group->pll); + + gcr0_mask |= LNmGCR0_RRAT_SEL | LNmGCR0_TRAT_SEL; + gcr0_mask |= LNmGCR0_RPLL_LES | LNmGCR0_TPLL_LES; + gcr0_mask |= LNmGCR0_RRST_B | LNmGCR0_TRST_B; + gcr0_mask |= LNmGCR0_RX_PD | LNmGCR0_TX_PD; + gcr0_mask |= LNmGCR0_IF20BIT_EN | LNmGCR0_PROTS; + gcr0 |= FIELD_PREP(LNmGCR0_RPLL_LES, !pll); + gcr0 |= FIELD_PREP(LNmGCR0_TPLL_LES, !pll); + gcr0 |= FIELD_PREP(LNmGCR0_RRAT_SEL, params->rat_sel); + gcr0 |= FIELD_PREP(LNmGCR0_TRAT_SEL, params->rat_sel); + gcr0 |= FIELD_PREP(LNmGCR0_IF20BIT_EN, params->if20bit); + gcr0 |= FIELD_PREP(LNmGCR0_PROTS, params->prots); + + gcr1_mask |= LNmGCR1_RDAT_INV | LNmGCR1_TDAT_INV; + gcr1_mask |= LNmGCR1_OPAD_CTL | LNmGCR1_REIDL_TH; + gcr1_mask |= LNmGCR1_REIDL_EX_SEL | LNmGCR1_REIDL_ET_SEL; + gcr1_mask |= LNmGCR1_REIDL_EX_MSB | LNmGCR1_REIDL_ET_MSB; + gcr1_mask |= LNmGCR1_REQ_CTL_SNP | LNmGCR1_REQ_CDR_SNP; + gcr1_mask |= LNmGCR1_TRSTDIR | LNmGCR1_REQ_BIN_SNP; + gcr1_mask |= LNmGCR1_ISLEW_RCTL | LNmGCR1_OSLEW_RCTL; + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_TH, params->reidl_th); + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_EX_SEL, params->reidl_ex & 3); + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_ET_SEL, params->reidl_et & 3); + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_EX_MSB, params->reidl_ex >> 2); + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_ET_MSB, params->reidl_et >> 2); + gcr1 |= FIELD_PREP(LNmGCR1_TRSTDIR, + group->first_lane > group->last_lane); + gcr1 |= FIELD_PREP(LNmGCR1_ISLEW_RCTL, params->slew); + gcr1 |= FIELD_PREP(LNmGCR1_OSLEW_RCTL, params->slew); + + recr0_mask |= LNmRECR0_GK2OVD | LNmRECR0_GK3OVD; + recr0_mask |= LNmRECR0_GK2OVD_EN | LNmRECR0_GK3OVD_EN; + recr0_mask |= LNmRECR0_BASE_WAND | LNmRECR0_OSETOVD; + if (params->gain) { + recr0 |= FIELD_PREP(LNmRECR0_GK2OVD, params->gain); + recr0 |= FIELD_PREP(LNmRECR0_GK3OVD, params->gain); + recr0 |= LNmRECR0_GK2OVD_EN | LNmRECR0_GK3OVD_EN; + } + recr0 |= FIELD_PREP(LNmRECR0_BASE_WAND, params->baseline_wander); + recr0 |= FIELD_PREP(LNmRECR0_OSETOVD, params->offset_override); + + tecr0_mask |= LNmTECR0_TEQ_TYPE; + tecr0_mask |= LNmTECR0_SGN_PREQ | LNmTECR0_RATIO_PREQ; + tecr0_mask |= LNmTECR0_SGN_POST1Q | LNmTECR0_RATIO_PST1Q; + tecr0_mask |= LNmTECR0_ADPT_EQ | LNmTECR0_AMP_RED; + tecr0 |= FIELD_PREP(LNmTECR0_TEQ_TYPE, params->teq); + if (params->preq_ratio) { + tecr0 |= FIELD_PREP(LNmTECR0_SGN_PREQ, 1); + tecr0 |= FIELD_PREP(LNmTECR0_RATIO_PREQ, params->preq_ratio); + } + if (params->postq_ratio) { + tecr0 |= FIELD_PREP(LNmTECR0_SGN_POST1Q, 1); + tecr0 |= FIELD_PREP(LNmTECR0_RATIO_PST1Q, params->postq_ratio); + } + tecr0 |= FIELD_PREP(LNmTECR0_ADPT_EQ, params->adpt_eq); + tecr0 |= FIELD_PREP(LNmTECR0_AMP_RED, params->amp_red); + + mutex_lock(&serdes->lock); + + /* Disable the old controller */ + if (old_mode) { + tmp = lynx_read(serdes, PCCRn(old_mode->pccr)); + tmp = lynx_proto_mode_prep(old_mode, tmp, LYNX_PROTO_NONE); + lynx_write(serdes, tmp, PCCRn(old_mode->pccr)); + + if (old_mode->protos & PROTO_MASK(SGMII)) { + tmp = lynx_read(serdes, SGMIIaCR1(old_mode->idx)); + tmp &= SGMIIaCR1_SGPCS_EN; + lynx_write(serdes, tmp, SGMIIaCR1(old_mode->idx)); + } + } + + for_each_lane_reverse(i, group) { + tmp = lynx_read(serdes, LNmGCR0(i)); + tmp &= ~(LNmGCR0_RRST_B | LNmGCR0_TRST_B); + lynx_write(serdes, tmp, LNmGCR0(i)); + ndelay(50); + + tmp &= ~gcr0_mask; + tmp |= gcr0; + tmp |= FIELD_PREP(LNmGCR0_FIRST_LANE, i == group->first_lane); + lynx_write(serdes, tmp, LNmGCR0(i)); + + tmp = lynx_read(serdes, LNmGCR1(i)); + tmp &= ~gcr1_mask; + tmp |= gcr1; + lynx_write(serdes, tmp, LNmGCR1(i)); + + tmp = lynx_read(serdes, LNmRECR0(i)); + tmp &= ~recr0_mask; + tmp |= recr0; + lynx_write(serdes, tmp, LNmRECR0(i)); + + tmp = lynx_read(serdes, LNmTECR0(i)); + tmp &= ~tecr0_mask; + tmp |= tecr0; + lynx_write(serdes, tmp, LNmTECR0(i)); + + tmp = lynx_read(serdes, LNmTTLCR0(i)); + tmp &= ~LNmTTLCR0_FLT_SEL; + tmp |= FIELD_PREP(LNmTTLCR0_FLT_SEL, params->flt_sel); + lynx_write(serdes, tmp, LNmTTLCR0(i)); + + ndelay(120); + tmp = lynx_read(serdes, LNmGCR0(i)); + tmp |= LNmGCR0_RRST_B | LNmGCR0_TRST_B; + lynx_write(serdes, tmp, LNmGCR0(i)); + } + + if (proto == LYNX_PROTO_1000BASEKX) { + /* FIXME: this races with clock updates */ + tmp = lynx_read(serdes, PLLaCR0(pll)); + tmp &= ~PLLaCR0_DLYDIV_SEL; + tmp |= FIELD_PREP(PLLaCR0_DLYDIV_SEL, 1); + lynx_write(serdes, tmp, PLLaCR0(pll)); + } + + /* Enable the new controller */ + tmp = lynx_read(serdes, PCCRn(new_mode->pccr)); + tmp = lynx_proto_mode_prep(new_mode, tmp, proto); + lynx_write(serdes, tmp, PCCRn(new_mode->pccr)); + + if (new_mode->protos & PROTO_MASK(SGMII)) { + tmp = lynx_read(serdes, SGMIIaCR1(new_mode->idx)); + tmp |= SGMIIaCR1_SGPCS_EN; + lynx_write(serdes, tmp, SGMIIaCR1(new_mode->idx)); + } + + mutex_unlock(&serdes->lock); + + group->proto = proto; + dev_dbg(&phy->dev, "set mode to %s on lanes %u to %u\n", + lynx_proto_str[proto], group->first_lane, group->last_lane); + return 0; +} + +static void lynx_release(struct phy *phy) +{ + struct lynx_group *group = phy_get_drvdata(phy); + struct lynx_priv *serdes = group->serdes; + + mutex_lock(&serdes->lock); + if (--group->users) { + mutex_unlock(&serdes->lock); + return; + } + list_del(&group->groups); + mutex_unlock(&serdes->lock); + + phy_destroy(phy); + kfree(group); +} + +static const struct phy_ops lynx_phy_ops = { + .init = lynx_init, + .exit = lynx_exit, + .power_on = lynx_power_on, + .power_off = lynx_power_off, + .set_mode = lynx_set_mode, + .validate = lynx_validate, + .release = lynx_release, + .owner = THIS_MODULE, +}; + +static struct phy *lynx_xlate(struct device *dev, struct of_phandle_args *args) +{ + struct phy *phy; + struct list_head *head; + struct lynx_group *group; + struct lynx_priv *serdes = dev_get_drvdata(dev); + unsigned int last_lane; + + if (args->args_count == 1) + last_lane = args->args[0]; + else if (args->args_count == 2) + last_lane = args->args[1]; + else + return ERR_PTR(-EINVAL); + + mutex_lock(&serdes->lock); + + /* Look for an existing group */ + list_for_each(head, &serdes->groups) { + group = container_of(head, struct lynx_group, groups); + if (group->first_lane == args->args[0] && + group->last_lane == last_lane) { + group->users++; + return group->phy; + } + } + + /* None found, create our own */ + group = kzalloc(sizeof(*group), GFP_KERNEL); + if (!group) { + mutex_unlock(&serdes->lock); + return ERR_PTR(-ENOMEM); + } + + group->serdes = serdes; + group->first_lane = args->args[0]; + group->last_lane = last_lane; + group->users = 1; + phy = phy_create(dev, NULL, &lynx_phy_ops); + if (IS_ERR(phy)) { + kfree(group); + } else { + group->phy = phy; + phy_set_drvdata(phy, group); + list_add(&group->groups, &serdes->groups); + } + + mutex_unlock(&serdes->lock); + return phy; +} + +static int lynx_probe(struct platform_device *pdev) +{ + bool grabbed_clocks = false; + int i, ret; + struct device *dev = &pdev->dev; + struct lynx_priv *serdes; + struct regmap_config regmap_config = {}; + const struct lynx_conf *conf; + struct resource *res; + void __iomem *base; + + serdes = devm_kzalloc(dev, sizeof(*serdes), GFP_KERNEL); + if (!serdes) + return -ENOMEM; + platform_set_drvdata(pdev, serdes); + mutex_init(&serdes->lock); + INIT_LIST_HEAD(&serdes->groups); + serdes->dev = dev; + + base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(base)) { + ret = PTR_ERR(base); + dev_err_probe(dev, ret, "could not get/map registers\n"); + return ret; + } + + conf = device_get_match_data(dev); + serdes->conf = conf; + regmap_config.reg_bits = 32; + regmap_config.reg_stride = 4; + regmap_config.val_bits = 32; + regmap_config.val_format_endian = conf->endian; + regmap_config.max_register = res->end - res->start; + regmap_config.disable_locking = true; + serdes->regmap = devm_regmap_init_mmio(dev, base, ®map_config); + if (IS_ERR(serdes->regmap)) { + ret = PTR_ERR(serdes->regmap); + dev_err_probe(dev, ret, "could not create regmap\n"); + return ret; + } + + for (i = 0; i < ARRAY_SIZE(serdes->ref); i++) { + static const char fmt[] = "ref%d"; + char name[sizeof(fmt)]; + + snprintf(name, sizeof(name), fmt, i); + serdes->ref[i] = devm_clk_get(dev, name); + if (IS_ERR(serdes->ref[i])) { + ret = PTR_ERR(serdes->ref[i]); + dev_err_probe(dev, ret, "could not get %s\n", name); + return ret; + } + } + + for (i = 0; i < ARRAY_SIZE(serdes->pll); i++) { + static const char fmt[] = "%s.pll%d"; + char *name; + const struct clk_hw *ref_hw[] = { + __clk_get_hw(serdes->ref[i]), + }; + size_t len; + struct clk_init_data init = {}; + + len = snprintf(NULL, 0, fmt, pdev->name, i); + name = devm_kzalloc(dev, len + 1, GFP_KERNEL); + if (!name) + return -ENOMEM; + + snprintf(name, len + 1, fmt, pdev->name, i); + init.name = name; + init.ops = &lynx_pll_clk_ops; + init.parent_hws = ref_hw; + init.num_parents = 1; + init.flags = CLK_SET_RATE_GATE | CLK_GET_RATE_NOCACHE; + init.flags |= CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE; + + serdes->pll[i].hw.init = &init; + serdes->pll[i].serdes = serdes; + serdes->pll[i].idx = i; + ret = devm_clk_hw_register(dev, &serdes->pll[i].hw); + if (ret) { + dev_err_probe(dev, ret, "could not register %s\n", + name); + return ret; + } + } + + ret = devm_of_clk_add_hw_provider(dev, lynx_clk_get, serdes); + if (ret) { + dev_err_probe(dev, ret, "could not register clock provider\n"); + return ret; + } + + /* Deselect anything configured by the RCW/bootloader */ + for (i = 0; i < conf->mode_count; i++) { + const struct lynx_mode *mode = &conf->modes[i]; + u32 pccr = lynx_read(serdes, PCCRn(mode->pccr)); + + if (lynx_proto_mode_get(mode, pccr) == mode->cfg) { + if (mode->protos & UNSUPPORTED_PROTOS) { + /* Don't mess with modes we don't support */ + serdes->used_lanes |= mode->lanes; + if (grabbed_clocks) + continue; + + grabbed_clocks = true; + clk_prepare_enable(serdes->pll[0].hw.clk); + clk_prepare_enable(serdes->pll[1].hw.clk); + clk_rate_exclusive_get(serdes->pll[0].hw.clk); + clk_rate_exclusive_get(serdes->pll[1].hw.clk); + } else { + /* Otherwise, clear out the existing config */ + pccr = lynx_proto_mode_prep(mode, pccr, + LYNX_PROTO_NONE); + lynx_write(serdes, pccr, PCCRn(mode->pccr)); + } + + /* Disable the SGMII PCS until we're ready for it */ + if (mode->protos & LYNX_PROTO_SGMII) { + u32 cr1; + + cr1 = lynx_read(serdes, SGMIIaCR1(mode->idx)); + cr1 &= ~SGMIIaCR1_SGPCS_EN; + lynx_write(serdes, cr1, SGMIIaCR1(mode->idx)); + } + } + } + + /* Power off all lanes; used ones will be powered on later */ + for (i = 0; i < conf->lanes; i++) + lynx_power_off_lane(serdes, i); + + ret = PTR_ERR_OR_ZERO(devm_of_phy_provider_register(dev, lynx_xlate)); + if (ret) + dev_err_probe(dev, ret, "could not register phy provider\n"); + else + dev_info(dev, "probed with %d lanes\n", conf->lanes); + return ret; +} + +/* + * XXX: For SerDes1, lane A uses pins SD1_RX3_P/N! That is, the lane numbers + * and pin numbers are _reversed_. In addition, the PCCR documentation is + * _inconsistent_ in its usage of these terms! + * + * PCCR "Lane 0" refers to... + * ==== ===================== + * 0 Lane A + * 2 Lane A + * 8 Lane A + * 9 Lane A + * B Lane D! + */ +static const struct lynx_mode ls1046a_modes1[] = { + CONF_SINGLE(1, PCIE, 0x0, 1, 0b001), /* PCIe.1 x1 */ + CONF_1000BASEKX(0, 0x8, 0, 0b001), /* SGMII.6 */ + CONF_SGMII25KX(1, 0x8, 1, 0b001), /* SGMII.5 */ + CONF_SGMII25KX(2, 0x8, 2, 0b001), /* SGMII.10 */ + CONF_SGMII25KX(3, 0x8, 3, 0b001), /* SGMII.9 */ + CONF_SINGLE(1, QSGMII, 0x9, 2, 0b001), /* QSGMII.6,5,10,1 */ + CONF_XFI(2, 0xB, 0, 0b010), /* XFI.10 */ + CONF_XFI(3, 0xB, 1, 0b001), /* XFI.9 */ +}; + +static const struct lynx_conf ls1046a_conf1 = { + .modes = ls1046a_modes1, + .mode_count = ARRAY_SIZE(ls1046a_modes1), + .lanes = 4, + .endian = REGMAP_ENDIAN_BIG, +}; + +static const struct lynx_mode ls1046a_modes2[] = { + CONF_SINGLE(0, PCIE, 0x0, 0, 0b001), /* PCIe.1 x1 */ + CONF(GENMASK(3, 0), PROTO_MASK(PCIE), 0x0, 0, 0b011), /* PCIe.1 x4 */ + CONF_SINGLE(2, PCIE, 0x0, 2, 0b001), /* PCIe.2 x1 */ + CONF(GENMASK(3, 2), PROTO_MASK(PCIE), 0x0, 2, 0b010), /* PCIe.3 x2 */ + CONF_SINGLE(3, PCIE, 0x0, 2, 0b011), /* PCIe.3 x1 */ + CONF_SINGLE(3, SATA, 0x2, 0, 0b001), /* SATA */ + CONF_1000BASEKX(1, 0x8, 1, 0b001), /* SGMII.2 */ +}; + +static const struct lynx_conf ls1046a_conf2 = { + .modes = ls1046a_modes2, + .mode_count = ARRAY_SIZE(ls1046a_modes2), + .lanes = 4, + .endian = REGMAP_ENDIAN_BIG, +}; + +static const struct of_device_id lynx_of_match[] = { + { .compatible = "fsl,ls1046a-serdes-1", .data = &ls1046a_conf1 }, + { .compatible = "fsl,ls1046a-serdes-2", .data = &ls1046a_conf2 }, +}; +MODULE_DEVICE_TABLE(of, lynx_of_match); + +static struct platform_driver lynx_driver = { + .probe = lynx_probe, + .driver = { + .name = "qoriq_serdes", + .of_match_table = lynx_of_match, + }, +}; +module_platform_driver(lynx_driver); + +MODULE_AUTHOR("Sean Anderson "); +MODULE_DESCRIPTION("Lynx 10G SerDes driver"); +MODULE_LICENSE("GPL"); From patchwork Tue Jun 28 22:13:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899075 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 8B61BC43334 for ; Tue, 28 Jun 2022 22:20:45 +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=At63OtqINd8bmoKMBRcReIGdtezZU1HW6DaIcBq0rtk=; b=wW56MdgSsJVTaC uvo6ySAgb3Vi/tcmlAnVbHf9ORdYwkE/PxaUCsOepkHrgXKrCo0ixohfOyt8DOx6qMSDB0+g563bB KH5AfscHpcwp5dWVR8eTrflPOh3Uy15jomkIlxrTblxKNmsuEyUrMrqMXx/vvJVAL3occmbzZ/Itp 8lkUaHAgsKcIH1keeV1Jn+jyjZ8t84dkOi4Zf2821Fy52J6oS4CMxCj1JNXUD+ZcCVyajdKUXjbP8 ZcLFKsJ7d9dQLRO06pUW4eqOdI86FLB7H4qNd5Qxs06silYLqYBHGCSAQ7kK+TRdaiby4tNBZzwSN XVxkDbS7MbR2kCxESK5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JXs-008O94-KM; Tue, 28 Jun 2022 22:18:57 +0000 Received: from mail-eopbgr80074.outbound.protection.outlook.com ([40.107.8.74] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTj-008MXM-K2 for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U0zD5u2M8Bocu/CALFJ83P6ZpX0/T9XxEFF14VEwTDyAxoS78ZPS+wZd2Y2LNSDHzBv2cbVaqdnil+HfNuSqX3ZdPgLuWsSbIr7/V56uVDRUVxl/S2RyzhhLPBolxVU4S71WuxE+7pf5PbiIPqU2qiVtiQBxcauI7DrtB1DFcckxKIQ0dQyXUHMf1AZ6ZscIH7kG9vuwdpjFafGCLZb14NFD9frEh4tWWDAArABZB6KJ7GVHqrf9TsE13gBTdIpoe/5WcR+EsZK9UMGv1PuRlpbJI0yGprp4zppJsA4S0OgDDfRTu8OZdyA1qF6Q0UC947dEp7kgR9q5NuRX0OBgJg== 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=OYvIu+eD8xuwaZeeIpqrGKTF6KIS03fE1xK9b/GiHNM=; b=TzfOpEuKfzvJWIxOKGfXShOyiHmR14xGjvCm3pFI4eI3Kg9G+VuYLJUyBxoc+EedQzvhPlDKiqpG70OPVugD/tAcazeboHgzXOEHZDUeJAIIiHkMQ4EbYO+EhYoRSnA4eg5181EqVFDpj3K+lWQ4TTubkUj02GwaiW6LmL+kp8P68no4GEelkjAK31vfiWt+zqQCF6kLy1vosIrn55Ug/mIclxIbXBrQOuqMRgMZjor0ZMsDCHGEsQfFLB8FyeBsRyyx/0nkhXgsz9cE3GqbhdLhY+UBtLU/KQgfCuIKLxaLf8syNTzhQ7c9V1oVfL8mdKy/aXd/tpugaffbSCxS+g== 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=OYvIu+eD8xuwaZeeIpqrGKTF6KIS03fE1xK9b/GiHNM=; b=efuThoumLVOn/GF/nybS8L6L8ixYMtYKJ94FsEViVi9FSPNGFrvl5GpBQJDq8PUNZxapgpTwmv231iEc625r325iAzGTftADve0jgoR0ZR9Z6LZayXD6gFp87KyK2WDv8HzvExE+NIownuQMvM4FlKxRP5CGFl8/FlMQ0UV1T8G4SwfBU04VrvV5De7iqwz19LOGSUDxC05O4m457WFGX3Mi0ygDjKrbi788xlOTSwS8T3wZSylDaQ/6Ag09ftfqEF6VowOoCMcXqX00vRaKtJKwG8IlF5njxJbT19i8r1amOGub8hcL1yEhcPYVA75pSiw6yqPVWmC86rcLIaEUPg== 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:28 +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:28 +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 , Camelia Groza Subject: [PATCH net-next v2 05/35] net: fman: Convert to SPDX identifiers Date: Tue, 28 Jun 2022 18:13:34 -0400 Message-Id: <20220628221404.1444200-6-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: 380f23fc-d0e5-48e4-ffae-08da5953911f 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: 7zvRt4HpvEZIyPL7mwWBVxSWAIVyPAgDLlN6c7LteD8CCObrO1i2x9d/DsgCmTuRSUZJ+W1o0aWIXAH/GmZSo94YrSZIDdgRWNd/UMFQJWbr1j1zzuf8VkZ2Lbg5tV6tpLKhMldhpp463uiwKsNX1bQVzt0yNB+GUkr8ldcjrxOfheEIVuDL7b53/BAAdVEtF/kOo1P0pV+8BMucvj+8vU/ljWMhpceXwRLRqYyutt4WmcXzIBUxF1qUjl8rXZZgedwSFn4M5KyGHicIDCnurE2qa/nP4VSQY0rA/IN+ATpGmAw5Yev60JEGs4wqp2gK6GwNadrHvU/gWactKbwthhtZzwlPlScyyEq52rql//B8JvNpxidlEcy9C5zf/TY8JJ+C45XnVIJOMwMxqe8dsZZ1+aalMoJNx0RML8kPMSb9Qg/MCwVeUgyFTd+1BFAK4VRk1Ouv8yUeLtmVPKu0lRZvbkXy+sZVDrC3xtVXr08RidLeqiF+1mSMX9hphmAd2IiMXDTSj9IHFs9V2jSDYfwTt4qP0MejjVVuIt0pQFkoukITc2zq39m1YsULM9N6blw5UyT66142oXPkK/Y739UmkkPn8dgWFvXQLke65rTskhZfL5+T16VWCn/UV8+Rqkj0MRyfkSk5voxu/6O+n7DBuaFhAiOcnckcbHHZqGP5IjABaIrLxAnaBZc972aBzdWm+y04axCMpws7sguktGDDDmsh261U6OAmFlwER7gTZg7wjX1t98rxsTVvqHRzuoBzbNcyHVVN8rvJYbqcbf1/GWy2uRRDkRmCmb8/5+dayk3VoZdNl6IsmMvzKMb1 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)(7416002)(44832011)(6512007)(6666004)(186003)(30864003)(38350700002)(1076003)(83380400001)(86362001)(2906002)(66476007)(8936002)(6486002)(4326008)(41300700001)(8676002)(26005)(52116002)(36756003)(478600001)(66946007)(2616005)(6506007)(316002)(54906003)(66556008)(110136005)(2004002)(579004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AZFiSrSRsr0Q/a/Hu9MeeYFU+yIfz6zvIIiGAFPqEYcWO8IiLqB5b15ssy2/0xdZG7PF8fjkEobUq4hIhRQMvTnI6rXLMd1TxBMmkCeva65NEUvEQxHVRRUgPv3wfamczPIh8i8+/mIPkj3Q7Ku4jG9qcFvtxB1t1L2NGnu7iFXB0WQoor9LBLbUp3sEN34+H11QSvMwTYsdM4Uhvhy8R2u1TkOAHfd0dCxc2vp/nXDbFzrMXtlzC6CHpmmv7AWsQsGj5Q/m/xKS0VfYZtCZo4ZnLQnsuV+VQg08Nk4L4bOCb4x61vT4oRZktTgc3LnjnINuWO1neMyif9prKgVBFuo2Y0gZK7LHEzFAcsy5545qs4u20YuJkVwOmS2y7WpKAj83N/0Z7Ok+q1mY+Y1bwwguWbxcqYEiWD0aDtQNnofOUDXB2RwCZXJeqv8yGt+8Z5WRAR8eZJ2va4Uwvv9kyWqojGBJ5DIJUMBc7XvWFrQr6oxbW8BjThQi3EgEnVI2qIuoHod9O/zPptS/IxltUbfHfQi05m0nr15QgYVq1VjBggFr7uwPMf32m+oXhLTWaJ44SwG4bU5wjXp7vGRHepMfBi03U1Er6iTS5qvzv8LMYQz5EW4Ta4PwoGlwIk1OC+IoEt6u7Gfihnq0vyNmFRz0mXobae25a0uqUdjx2fHd4Fac6m9olYraTDbmMI6q+xuwHc1XMPyEQlOR3RNKJHMkD6OyGAbSY9A57a3OeO6HLXZdFbo+gVkkE+e2bcQphxshHbBgKhGXAn8D82gyC9YdhfmpcsH6A6vDLFKYAhHWFZkkLuBFGNREy4THAM5+G5247OACYl1zNbf31nepfCQGwu8HbRx6xeKYm8ZSM9TK2mpj55H6YVwJlA6tmqxq3bODL6Yxm/JPRjcFjLTbeClLKlnecxiOIYjhi+pvxHf3HYDyoJ2QZe6b98n/hQLLw2R+LAr5uY9QwOgCExbIPNM7OBEsbFFk30p63dKXs7zgRZAlkcqPesV8Mo3pMMM2Ti2iI6zkeG6qiF10myL6A7i3f6AkA+iUtqN2jcdScXpbpUu5K+clVt5SMmxIXQrqpPhyJ3UvylQM6iRcFZor3LU5EVGGBzpAOb5bALsgnH49IhmHTiMkwriWK1/FSsySGUIC+FGlyEUW3BdT06UCeKB85WSLEm0KpNwiCbPORRdr700G0vCf6A/OrInZHhcEpa1xx1oIn+6Mrmg5ah36QtoImjVApyT0bnaIEJltLlT8HgP57cQNvFQTxdijJxoXB7buFoq5eWJ/bb3bDbnu9iyXUXrTcGw3+c6Hu6nIuZjk5TwtvoO8xpCJIMJ+ekX2WMI0EEaxjGWQM+LExOXMkn7RMm+XXssOvkz+blZvNv0fhPKcn+eBO426Hrm8XXe7MoBM98mPLwltT5sOgxJJUnlXxEzt3kBG3dvy3x2Mr3OMBfLIIxmtj+fivttnOsOWueFMbwa40Od89E2oBDtnwH/4tpufBjgpf7vzZPFLFe2SvMq/3joA4MRp7yIlkp7CowYjrk9WWLWRhSDtHpek0g3iFhF151y6H5UR2/DbmmhYKr/LxdMUhhVTr6lRMDz8mVUKEjKvpK4sMScsiYZKag== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 380f23fc-d0e5-48e4-ffae-08da5953911f 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:28.0016 (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: YZpoNK5sbmKq+ieO8OOIHvc5+535SiLC6d5BxP3lii5jifpaJP019F5nhzFT4hLFn0qLizjbi18G9VV9a9bpeg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151439_743100_3AD72E36 X-CRM114-Status: GOOD ( 14.44 ) 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 converts the license text of files in the fman directory to use SPDX license identifiers instead. Signed-off-by: Sean Anderson Acked-by: Camelia Groza Tested-by: Camelia Groza --- (no changes since v1) drivers/net/ethernet/freescale/fman/fman.c | 31 ++---------------- drivers/net/ethernet/freescale/fman/fman.h | 31 ++---------------- .../net/ethernet/freescale/fman/fman_dtsec.c | 31 ++---------------- .../net/ethernet/freescale/fman/fman_dtsec.h | 31 ++---------------- .../net/ethernet/freescale/fman/fman_keygen.c | 29 +---------------- .../net/ethernet/freescale/fman/fman_keygen.h | 29 +---------------- .../net/ethernet/freescale/fman/fman_memac.c | 31 ++---------------- .../net/ethernet/freescale/fman/fman_memac.h | 31 ++---------------- .../net/ethernet/freescale/fman/fman_muram.c | 31 ++---------------- .../net/ethernet/freescale/fman/fman_muram.h | 32 ++----------------- .../net/ethernet/freescale/fman/fman_port.c | 29 +---------------- .../net/ethernet/freescale/fman/fman_port.h | 29 +---------------- drivers/net/ethernet/freescale/fman/fman_sp.c | 29 +---------------- drivers/net/ethernet/freescale/fman/fman_sp.h | 28 +--------------- .../net/ethernet/freescale/fman/fman_tgec.c | 31 ++---------------- .../net/ethernet/freescale/fman/fman_tgec.h | 31 ++---------------- drivers/net/ethernet/freescale/fman/mac.c | 32 ++----------------- drivers/net/ethernet/freescale/fman/mac.h | 32 ++----------------- 18 files changed, 33 insertions(+), 515 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c index 8f0db61cb1f6..9d85fb136e34 100644 --- a/drivers/net/ethernet/freescale/fman/fman.c +++ b/drivers/net/ethernet/freescale/fman/fman.c @@ -1,34 +1,7 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later /* - * Copyright 2008-2015 Freescale Semiconductor Inc. + * Copyright 2008 - 2015 Freescale Semiconductor Inc. * Copyright 2020 NXP - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/net/ethernet/freescale/fman/fman.h b/drivers/net/ethernet/freescale/fman/fman.h index f2ede1360f03..2ea575a46675 100644 --- a/drivers/net/ethernet/freescale/fman/fman.h +++ b/drivers/net/ethernet/freescale/fman/fman.h @@ -1,34 +1,7 @@ +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ /* - * Copyright 2008-2015 Freescale Semiconductor Inc. + * Copyright 2008 - 2015 Freescale Semiconductor Inc. * Copyright 2020 NXP - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __FM_H diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 1950a8936bc0..a39d57347d59 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -1,33 +1,6 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later /* - * Copyright 2008-2015 Freescale Semiconductor Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Copyright 2008 - 2015 Freescale Semiconductor Inc. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.h b/drivers/net/ethernet/freescale/fman/fman_dtsec.h index 68512c3bd6e5..3c26b97f8ced 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.h +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.h @@ -1,33 +1,6 @@ +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ /* - * Copyright 2008-2015 Freescale Semiconductor Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Copyright 2008 - 2015 Freescale Semiconductor Inc. */ #ifndef __DTSEC_H diff --git a/drivers/net/ethernet/freescale/fman/fman_keygen.c b/drivers/net/ethernet/freescale/fman/fman_keygen.c index e1bdfed16134..e73f6ef3c6ee 100644 --- a/drivers/net/ethernet/freescale/fman/fman_keygen.c +++ b/drivers/net/ethernet/freescale/fman/fman_keygen.c @@ -1,33 +1,6 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later /* * Copyright 2017 NXP - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of NXP nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY NXP ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL NXP BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/net/ethernet/freescale/fman/fman_keygen.h b/drivers/net/ethernet/freescale/fman/fman_keygen.h index c4640de3f4cb..2cb0df453074 100644 --- a/drivers/net/ethernet/freescale/fman/fman_keygen.h +++ b/drivers/net/ethernet/freescale/fman/fman_keygen.h @@ -1,33 +1,6 @@ +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ /* * Copyright 2017 NXP - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of NXP nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY NXP ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL NXP BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __KEYGEN_H diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 2216b7f51d26..d47e5d282143 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -1,33 +1,6 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later /* - * Copyright 2008-2015 Freescale Semiconductor Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Copyright 2008 - 2015 Freescale Semiconductor Inc. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.h b/drivers/net/ethernet/freescale/fman/fman_memac.h index 3820f7a22983..702df2aa43f9 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.h +++ b/drivers/net/ethernet/freescale/fman/fman_memac.h @@ -1,33 +1,6 @@ +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ /* - * Copyright 2008-2015 Freescale Semiconductor Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Copyright 2008 - 2015 Freescale Semiconductor Inc. */ #ifndef __MEMAC_H diff --git a/drivers/net/ethernet/freescale/fman/fman_muram.c b/drivers/net/ethernet/freescale/fman/fman_muram.c index 7ad317e622bc..f557d68e5b76 100644 --- a/drivers/net/ethernet/freescale/fman/fman_muram.c +++ b/drivers/net/ethernet/freescale/fman/fman_muram.c @@ -1,33 +1,6 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later /* - * Copyright 2008-2015 Freescale Semiconductor Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Copyright 2008 - 2015 Freescale Semiconductor Inc. */ #include "fman_muram.h" diff --git a/drivers/net/ethernet/freescale/fman/fman_muram.h b/drivers/net/ethernet/freescale/fman/fman_muram.h index 453bf849eee1..3643af61bae2 100644 --- a/drivers/net/ethernet/freescale/fman/fman_muram.h +++ b/drivers/net/ethernet/freescale/fman/fman_muram.h @@ -1,34 +1,8 @@ +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ /* - * Copyright 2008-2015 Freescale Semiconductor Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Copyright 2008 - 2015 Freescale Semiconductor Inc. */ + #ifndef __FM_MURAM_EXT #define __FM_MURAM_EXT diff --git a/drivers/net/ethernet/freescale/fman/fman_port.c b/drivers/net/ethernet/freescale/fman/fman_port.c index 4c9d05c45c03..ab90fe2bee5e 100644 --- a/drivers/net/ethernet/freescale/fman/fman_port.c +++ b/drivers/net/ethernet/freescale/fman/fman_port.c @@ -1,33 +1,6 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later /* * Copyright 2008 - 2015 Freescale Semiconductor Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/net/ethernet/freescale/fman/fman_port.h b/drivers/net/ethernet/freescale/fman/fman_port.h index 82f12661a46d..4917fe8f0617 100644 --- a/drivers/net/ethernet/freescale/fman/fman_port.h +++ b/drivers/net/ethernet/freescale/fman/fman_port.h @@ -1,33 +1,6 @@ +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ /* * Copyright 2008 - 2015 Freescale Semiconductor Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __FMAN_PORT_H diff --git a/drivers/net/ethernet/freescale/fman/fman_sp.c b/drivers/net/ethernet/freescale/fman/fman_sp.c index 248f5bcca468..0fac60aa5283 100644 --- a/drivers/net/ethernet/freescale/fman/fman_sp.c +++ b/drivers/net/ethernet/freescale/fman/fman_sp.c @@ -1,33 +1,6 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later /* * Copyright 2008 - 2015 Freescale Semiconductor Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "fman_sp.h" diff --git a/drivers/net/ethernet/freescale/fman/fman_sp.h b/drivers/net/ethernet/freescale/fman/fman_sp.h index 820b7f63088f..a62dd21c81f1 100644 --- a/drivers/net/ethernet/freescale/fman/fman_sp.h +++ b/drivers/net/ethernet/freescale/fman/fman_sp.h @@ -1,32 +1,6 @@ +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ /* * Copyright 2008 - 2015 Freescale Semiconductor Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __FM_SP_H diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 311c1906e044..a3c6576dd99d 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -1,33 +1,6 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later /* - * Copyright 2008-2015 Freescale Semiconductor Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Copyright 2008 - 2015 Freescale Semiconductor Inc. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.h b/drivers/net/ethernet/freescale/fman/fman_tgec.h index b28b20b26148..8df90054495c 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.h +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.h @@ -1,33 +1,6 @@ +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ /* - * Copyright 2008-2015 Freescale Semiconductor Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Copyright 2008 - 2015 Freescale Semiconductor Inc. */ #ifndef __TGEC_H diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 39ae965cd4f6..2b3c6cbefef6 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -1,32 +1,6 @@ -/* Copyright 2008-2015 Freescale Semiconductor, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index daa285a9b8b2..909faf5fa2fe 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -1,32 +1,6 @@ -/* Copyright 2008-2015 Freescale Semiconductor, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Freescale Semiconductor nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * - * ALTERNATIVELY, this software may be distributed under the terms of the - * GNU General Public License ("GPL") as published by the Free Software - * Foundation, either version 2 of that License or (at your option) any - * later version. - * - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. */ #ifndef __MAC_H From patchwork Tue Jun 28 22:13: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: 12899074 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 D6F71C433EF for ; Tue, 28 Jun 2022 22:19:50 +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=35M+dIYMMOYo7OKFVl4/FE4kOZzo5DKbvLpOcUtsAm4=; b=IZKC5Fi7gld6oE gmCgWYrg61vZjhV28mqFLJCs0Z2X8LaPzls2x8M2Z5mzyznS6pqAXxuP1puaH2BsskWTZU+IUb/Sa wsvMqZN2Dk3RXjRughjKR9daBVf3trjSGmxkHy3+fpGVCmxbzH4WusxCqnIbvyey6JbetZFfjrXBZ T1jTubDK6va/KQs/4usa/V5JdFm3sgmd3th/W7gCZAkLkFcR/wEH40GcLPzyUFwcw5jY9g0R9oHcL zvy9EefHBTFLHpIrGNvdSWmTR5aY6BUai+gDzHYOBqeUS9t0LtzYNEk/4fgQHN9Iu1daOq+Kkp674 esoChY0akf1esGTlwCog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JX5-008NvE-4S; Tue, 28 Jun 2022 22:18:07 +0000 Received: from mail-eopbgr80072.outbound.protection.outlook.com ([40.107.8.72] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTk-008Mcr-Hz for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CHrFn2zUNznVdkr/QnmQxGNeL0J7psBJ2Epvrda1X5QyDoALtSXrlEO8lR45HWy6ySUaw5zWC70PEIb3Nuj2lLkRIGx1OvWHWisQS/CIfTvY6Yl1kG0iQaj+3J5ffG3sQ9sNU7Ayss2NRw+HCnhPRlhD/ZZHLOE/aK/u0u370DFztKDtjWfDYzmkSD/gnehRe+6Y5z+t8hs9fPBcQ6hqqVhNnUnogwuQsq78Hnau85pbXFbit/nnQyDQBoQHihaZRrfQRzZi9D39+zp3oBLQ+yWY66mHqSNZ4lnGhIOiPANnm2Fda8pfWCQwJKFQt6FU0QvxA6GH2hHxDVOC5fhQTQ== 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=bxl5ypHVF2yTjwLwhCMIKk+7ahbMUu0knhMwR6YqOck=; b=RIKFTP3lUYZNtwD8dip8UWEVJMBojri0p+sjaqbtYoMbyr990qfeibEGjOLHyJVIZ7VLfMqDf6XQR6TzI7L+8GuAt+QDt15PDpDd3lEvQJ1y+bcZ3FDjJdvV8TBjHtNJJGBvVU/VXQN1f3ORuvIYWqir6G9t6y32c8NVBmqDomVWE8YkMKEwtl+9IjyVxI9Z+mz86fELNxaGsNGRva1XRQgO/525tbw5arWRS/9icewvbNjlu1VJuS1rgK5zrIDCc2IzUqZx5FeZWWddZjBn14VGwEah6yqwUdit97zVOPVzFgSlUaYnKGVZh6RlCjt3jsy7gTnoQoTGynQ4a7lwpg== 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=bxl5ypHVF2yTjwLwhCMIKk+7ahbMUu0knhMwR6YqOck=; b=JpEK6C9TZdqzhIcO/6ZaIYNdqPcwGENnqLTJWceCabVIklnkiLrdsNvKjy9ttXf6CQS12BE61x/pLkwNvl0xBq6zqnwyojJevRkfmqrJENzWX6LuXEL8B65x+oq9fkKgxrgRlBI6Kzhd3cs5v2PmWejUni3rrPJq3tXbpDPvzwaNyRsv19nwCrWemZ6qrLITgDSeWHQwzHW2Zis0MrgmvzHP7eXsA8YmM7UM7qdQXV80nrKeEubUgHXKvVYAwFSu+eh15hVMsMBTxvc7e2fOjpnr4MwoxCdOjzxrtvflm92ZRBpNZn0/4CHRF8ujiE3ypOf9MI82/EMclFi2maW6+Q== 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:29 +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:29 +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 , Camelia Groza Subject: [PATCH net-next v2 06/35] net: fman: Don't pass comm_mode to enable/disable Date: Tue, 28 Jun 2022 18:13:35 -0400 Message-Id: <20220628221404.1444200-7-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: 1b42182f-843a-4072-c8fc-08da59539210 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: Wr9YzFBjG0z9mddzj7DU5z6s4rTdMT9FQHNbbTR0g86zhQVKFAtRxOI8aWmXxMVHSABOIxL/CKNb8f0neLTlGloecCRgGkTdN8yc3n1cVRy9j0ifN7TmJoiXOAyf2nkkq8AlcxBlMlsnoFwKbz1LagzZ5FOh0aahfkAUAEHsNwtCXL9IvUrfxAxRLJO/pzIHdqkZPv3b8x+Z7sicAdl6IVCL1Q6M0B/NFBbxTGFu9XZ7XvHy97kN7ifpoOAqOkcbSKjWm+fAXWpje6tTPjelI3YFXLHV2fuPbOgFSkqGdcGoogTCHbmWYfxlYrdZG1l53voohVFygVH4/ULgKK94DnGXwjeOprsg4+xMvByBhRIiRMBw2gRJixbAs51JVsg/bqoMouyhxPyPQ5u+kZuG5KnbNNj5+O6MSxWlQvQedRonmqiQVnSte50z42rxIeIsh+vaR/Kx2d7VTyE6aPdEExKqg1Ga+gq+1BL/SDwPjtn0PYnMHfzC/+7b9ZZ2r7ojk4DGU783yKPZhpaYSWlhji2OqmBOm63YnfB5QcV1je6us7zONT62g9SPaXQQi4a3tJT4ZLbL/5zVq+MOR+jpODVRJrRyNA1k+3ngsPPBrNuDfUTQKclYYLoWSGV/tKqxDySpMarLEa7VUsEgw5noTLmOkMlQs4YoEkeVPUiGHmh5xGQ07V1h3Pz0mfRNjaX4DLyvIOG88/+rYXSPjiF1mC/6R1YSGOl5ec+FoOOcwtLsUE5xxXx61fARxYAcIhNx5o8vM+roHfqmdoXdpR3wre7wCNIOukXvKxgg/hMne5s= 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)(7416002)(44832011)(6512007)(6666004)(186003)(38350700002)(1076003)(83380400001)(86362001)(2906002)(66476007)(8936002)(6486002)(4326008)(41300700001)(8676002)(26005)(52116002)(36756003)(478600001)(66946007)(2616005)(6506007)(316002)(54906003)(66556008)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: K20RcOsNu/OXCkSik72rA30wWJiX4uL0i2qbkOIajPqDeKCFt5QrdLmA0UdY0mdQjZzhmx+Cp6VHERT4E1vsMI7UZekI5FDPhDwHT8NM6Q0c+bvr1L4081M1BKT4Whw6K5R4B7fULGSA9yYNoyO5VVqxJiZ3P7z2C2h59ciqIX0pqg3Rp36DoRD0+e3+JdTOHRBBpxp65QsEpJwuTbUf4mg4FhjH9we7OGE6a58NJFgGGIZnpymMFY7JKNUhjShqP80+1j9+BEKliVbaXhydQPHPCdypbUpWR8CstgM7Zx8KL00tTQjPFYKrXDZ9ldSTFTmiGTGIkDfJ7dtA8KZctb6U2wtVucz+BjFn8ysH9WOcVlwe82cOUwtgTJWfv4aon5K0vFdFd7UOcM7CtmQDeBiJ1C8gPMPQVLQeV8Y9Y+PVmLZ5HWroj0xT4zEpmqzFWOot1aEx1D8CMyCg9t+FiJovDre6vv/i5adV+RGgXaNB2kmAx2Dax0ida1gQnpr+1a+yT2vaP5C1jepL10Zw0xmjZ5M/l7fzBkW0Iovmno194DRD5AzC4+NGCcDTU46HGGy5O9UrznRQWiiIaMuzHvWfnmXu/N41SLek0kxchiuYLUPSfpsaYlcnIgaYxc5nl8S/zxexf+ArzPUEaENmioMCyMnrzpJ4H5znImx2TR7uFGtbhNiZ2B2QveQPgxeY25x5jzMD5jkCHHyBY9uVUn0kZ/i+QoEaY+0qdR+dyOScPBxFFOExTX53TbFPgjTWx5e21fsYo7+POhKGEHEiN9ep2O2w2XBjAYCvt84l9SxlsksY4F1Rklh10NzXOWkjqTRYUb/+USFHEG195QZZuAqvi5qWiNM1/dKlGsjP+Bh1eOdKKY8lm05NvW7jRYKR9HK7pUrp9B6crgHTgTJbuTp7kDezGZYdZLsTpuMQ3x2TV/a7w+GcOxbc7sinw8YfeaaZMRrOVHmcanx7XZtYm6flpc3JAfPFj/+zdnNk8NSw1ViytPJROjKbw8A64RLfQgGLT4EAFEPed4imGS+mybqD9AbgZtgC5pgR8zV8BuO4fqPt+50K4TAxf0STtjX5oIjg4ZtmKicZWiFULfOBN+MjU4FIm3Os4RmyH/0mcnsnwSYHEYJwnLMgyzfUp2IoMhIxHw+sk9wnk1wO4XfALOt6rbXje+Se4vBJHOowYdt/N6LnIXHRjL/aLx7Nc+9xmn7B08NFuxl/OkITwKy1j09P59CKx8XFE2ZoJn9Sswtj1sZfxoHUyVeQXaRMCAxfOsogjQq8pAVpv52B4J/1b8gIDWZ+GRSQINsU4rvsAXWtcrMwW8kR87z4nOBAVYPirkCEf3Bc5KC3Pc6GeR/WU4v6Hx6d2V5W3k2xYCfe3Imz4pWO6L3974CpCqLuDuuC7dd8SkZotOghdqh8Wkfnts6+ifwC5My6pWAVA/MRQlXGvNnxxUu6Qf8aPvJuH0G3yxORS6+5utpDxMEZjV1q6hVJ/YuSow3ymOnVdUv8jSlBvUKF7G1AsKXng2zEsFXVVnyF9r1287JitDFeinGtU9TGIpYo2jmJn3H7f+BlhuS9piT0uQducwmAQ0S0o0WjFNlukDoCW5J6ysUCwsTUMg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b42182f-843a-4072-c8fc-08da59539210 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:29.5952 (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: 3sIHvo97K9/ZExJaQsOBR2+RDEF8FnuSdWJ2BnRsihCpHO3VTwnjD7G+2YSSC5Xv+DzXvfKAZ5g5uqgc/jTS6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151440_835294_A69646F6 X-CRM114-Status: GOOD ( 11.54 ) 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 mac_priv_s->enable() and ->disable() are always called with a comm_mode of COMM_MODE_RX_AND_TX. Remove this parameter, and refactor the macs appropriately. Signed-off-by: Sean Anderson Acked-by: Camelia Groza Tested-by: Camelia Groza --- (no changes since v1) .../net/ethernet/freescale/fman/fman_dtsec.c | 20 ++++++------------- .../net/ethernet/freescale/fman/fman_dtsec.h | 4 ++-- .../net/ethernet/freescale/fman/fman_memac.c | 16 ++++----------- .../net/ethernet/freescale/fman/fman_memac.h | 4 ++-- .../net/ethernet/freescale/fman/fman_tgec.c | 14 ++++--------- .../net/ethernet/freescale/fman/fman_tgec.h | 4 ++-- drivers/net/ethernet/freescale/fman/mac.c | 8 ++++---- 7 files changed, 24 insertions(+), 46 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index a39d57347d59..167843941fa4 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -879,7 +879,7 @@ static void graceful_stop(struct fman_mac *dtsec, enum comm_mode mode) } } -int dtsec_enable(struct fman_mac *dtsec, enum comm_mode mode) +int dtsec_enable(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; @@ -889,20 +889,16 @@ int dtsec_enable(struct fman_mac *dtsec, enum comm_mode mode) /* Enable */ tmp = ioread32be(®s->maccfg1); - if (mode & COMM_MODE_RX) - tmp |= MACCFG1_RX_EN; - if (mode & COMM_MODE_TX) - tmp |= MACCFG1_TX_EN; - + tmp |= MACCFG1_RX_EN | MACCFG1_TX_EN; iowrite32be(tmp, ®s->maccfg1); /* Graceful start - clear the graceful Rx/Tx stop bit */ - graceful_start(dtsec, mode); + graceful_start(dtsec, COMM_MODE_RX_AND_TX); return 0; } -int dtsec_disable(struct fman_mac *dtsec, enum comm_mode mode) +int dtsec_disable(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; @@ -911,14 +907,10 @@ int dtsec_disable(struct fman_mac *dtsec, enum comm_mode mode) return -EINVAL; /* Graceful stop - Assert the graceful Rx/Tx stop bit */ - graceful_stop(dtsec, mode); + graceful_stop(dtsec, COMM_MODE_RX_AND_TX); tmp = ioread32be(®s->maccfg1); - if (mode & COMM_MODE_RX) - tmp &= ~MACCFG1_RX_EN; - if (mode & COMM_MODE_TX) - tmp &= ~MACCFG1_TX_EN; - + tmp &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN); iowrite32be(tmp, ®s->maccfg1); return 0; diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.h b/drivers/net/ethernet/freescale/fman/fman_dtsec.h index 3c26b97f8ced..f072cdc560ba 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.h +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.h @@ -16,8 +16,8 @@ int dtsec_adjust_link(struct fman_mac *dtsec, int dtsec_restart_autoneg(struct fman_mac *dtsec); int dtsec_cfg_max_frame_len(struct fman_mac *dtsec, u16 new_val); int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val); -int dtsec_enable(struct fman_mac *dtsec, enum comm_mode mode); -int dtsec_disable(struct fman_mac *dtsec, enum comm_mode mode); +int dtsec_enable(struct fman_mac *dtsec); +int dtsec_disable(struct fman_mac *dtsec); int dtsec_init(struct fman_mac *dtsec); int dtsec_free(struct fman_mac *dtsec); int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en); diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index d47e5d282143..c34da49aed31 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -685,7 +685,7 @@ static bool is_init_done(struct memac_cfg *memac_drv_params) return false; } -int memac_enable(struct fman_mac *memac, enum comm_mode mode) +int memac_enable(struct fman_mac *memac) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -694,17 +694,13 @@ int memac_enable(struct fman_mac *memac, enum comm_mode mode) return -EINVAL; tmp = ioread32be(®s->command_config); - if (mode & COMM_MODE_RX) - tmp |= CMD_CFG_RX_EN; - if (mode & COMM_MODE_TX) - tmp |= CMD_CFG_TX_EN; - + tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN; iowrite32be(tmp, ®s->command_config); return 0; } -int memac_disable(struct fman_mac *memac, enum comm_mode mode) +int memac_disable(struct fman_mac *memac) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -713,11 +709,7 @@ int memac_disable(struct fman_mac *memac, enum comm_mode mode) return -EINVAL; tmp = ioread32be(®s->command_config); - if (mode & COMM_MODE_RX) - tmp &= ~CMD_CFG_RX_EN; - if (mode & COMM_MODE_TX) - tmp &= ~CMD_CFG_TX_EN; - + tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); iowrite32be(tmp, ®s->command_config); return 0; diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.h b/drivers/net/ethernet/freescale/fman/fman_memac.h index 702df2aa43f9..535ecd2b2ab4 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.h +++ b/drivers/net/ethernet/freescale/fman/fman_memac.h @@ -19,8 +19,8 @@ int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val); int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable); int memac_cfg_fixed_link(struct fman_mac *memac, struct fixed_phy_status *fixed_link); -int memac_enable(struct fman_mac *memac, enum comm_mode mode); -int memac_disable(struct fman_mac *memac, enum comm_mode mode); +int memac_enable(struct fman_mac *memac); +int memac_disable(struct fman_mac *memac); int memac_init(struct fman_mac *memac); int memac_free(struct fman_mac *memac); int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en); diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index a3c6576dd99d..2b38d22c863d 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -392,7 +392,7 @@ static bool is_init_done(struct tgec_cfg *cfg) return false; } -int tgec_enable(struct fman_mac *tgec, enum comm_mode mode) +int tgec_enable(struct fman_mac *tgec) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; @@ -401,16 +401,13 @@ int tgec_enable(struct fman_mac *tgec, enum comm_mode mode) return -EINVAL; tmp = ioread32be(®s->command_config); - if (mode & COMM_MODE_RX) - tmp |= CMD_CFG_RX_EN; - if (mode & COMM_MODE_TX) - tmp |= CMD_CFG_TX_EN; + tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN; iowrite32be(tmp, ®s->command_config); return 0; } -int tgec_disable(struct fman_mac *tgec, enum comm_mode mode) +int tgec_disable(struct fman_mac *tgec) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; @@ -419,10 +416,7 @@ int tgec_disable(struct fman_mac *tgec, enum comm_mode mode) return -EINVAL; tmp = ioread32be(®s->command_config); - if (mode & COMM_MODE_RX) - tmp &= ~CMD_CFG_RX_EN; - if (mode & COMM_MODE_TX) - tmp &= ~CMD_CFG_TX_EN; + tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); iowrite32be(tmp, ®s->command_config); return 0; diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.h b/drivers/net/ethernet/freescale/fman/fman_tgec.h index 8df90054495c..5b256758cbec 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.h +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.h @@ -12,8 +12,8 @@ struct fman_mac *tgec_config(struct fman_mac_params *params); int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val); int tgec_modify_mac_address(struct fman_mac *tgec, const enet_addr_t *enet_addr); int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val); -int tgec_enable(struct fman_mac *tgec, enum comm_mode mode); -int tgec_disable(struct fman_mac *tgec, enum comm_mode mode); +int tgec_enable(struct fman_mac *tgec); +int tgec_disable(struct fman_mac *tgec); int tgec_init(struct fman_mac *tgec); int tgec_free(struct fman_mac *tgec); int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en); diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 2b3c6cbefef6..a8d521760ffc 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -40,8 +40,8 @@ struct mac_priv_s { u16 speed; u16 max_speed; - int (*enable)(struct fman_mac *mac_dev, enum comm_mode mode); - int (*disable)(struct fman_mac *mac_dev, enum comm_mode mode); + int (*enable)(struct fman_mac *mac_dev); + int (*disable)(struct fman_mac *mac_dev); }; struct mac_address { @@ -247,7 +247,7 @@ static int start(struct mac_device *mac_dev) struct phy_device *phy_dev = mac_dev->phy_dev; struct mac_priv_s *priv = mac_dev->priv; - err = priv->enable(mac_dev->fman_mac, COMM_MODE_RX_AND_TX); + err = priv->enable(mac_dev->fman_mac); if (!err && phy_dev) phy_start(phy_dev); @@ -261,7 +261,7 @@ static int stop(struct mac_device *mac_dev) if (mac_dev->phy_dev) phy_stop(mac_dev->phy_dev); - return priv->disable(mac_dev->fman_mac, COMM_MODE_RX_AND_TX); + return priv->disable(mac_dev->fman_mac); } static int set_multi(struct net_device *net_dev, struct mac_device *mac_dev) From patchwork Tue Jun 28 22:13:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899076 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 40DF9C43334 for ; Tue, 28 Jun 2022 22:21:30 +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=5jDZ6lEio+qTZTwePSIdUVIkMrGAC20lsuMGlaEmvVk=; b=mzAv633VtArIvn 5ecAV5no4SUn8gnJanbHuTe2nEw57bXAnvXS+PKxg7u06eBgur6jdgqyxghfWI8TEA2YsNI5E+we3 aIrjQM5l3O8jvqljcgKkxu9M89p9H6AzTL6FNEMPQl9twCRIiiWelALcRaFNWoVQxaRQ67Z+ZXZud S5RkQDtJpEL++4P23BocC4tg6l4fUe3yrlUv5w4wU7+AhGM343QyV3p9EvlftS9z5ZKs3UafBh07s f6zktvpscQqRfL8yke0CrGb0I1vmHVNjkZerY00Q1NjRtOhAuXyUJOA0kveiRQJydqWZ1cNDQgi2Z o9I+YBlRRhg9OVLbImQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JYp-008OPv-Ib; Tue, 28 Jun 2022 22:19:58 +0000 Received: from mail-eopbgr80072.outbound.protection.outlook.com ([40.107.8.72] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTn-008Mcr-Ip for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LIL8DgTSc/oRGOkQbIBSl1xsW+d0gQgFPxw6WIiWcEjwquKUc5lY7ngcgV2lvFPRoeEpGYP31j1j5IKuBDSf1fQjUtdmgHVoQ76DebXnWMgc+pNFxnknMusPm3nWwPSK9bAm0NEX1L/ymiGxVwlo4JkHH26KTEXhKJIoYnH72SMOXXMW/aoLNKLI5L4ejd/8A4hpgOhcjnyvfwp9ExEIMoUA+6hD2iHSsKy7rpeI3C2v+MC1t+OLMegG4mx8zmAQsAet1fwmuHtf9sKvoVxUsfF80+ITd9zDXGix7NPfJjWYg8kUCYyJU2hIZ80QGAhM/FuJLI2lOezGFrl1QWlnvg== 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=8om8eH2QedUZdijrrSK77S2858Mj/v8BVIBqUQfR/qc=; b=GtGcSKBLpF2pCHGKE7TrRorByOucpfaxn+8kfCccT8kavQLABVMj6et5PtgskoQ4yFBjIa1DKottjdwBX1cW0o8Hns8SUSWGUwx/Mua7lvMjtnzszdj652/TTSI4HXQucNvQ5q/jrwvGIzbG2ZFJ3IzEuuPrBIDq6/aaYGVyilwHRUgQPn7nFNjkql/P6Y99acGgFUomzV20pNSGBS4aNMedNpxAyR0EvUUkZV5RjdB97dow3kYteMgHkbNYQTX/kP/zbpjrJzXzwk7L0lMWrtLtDvwHaYLkU9Mt+vOGUjkiGwZ3KxWSURlDDTo3+QhhJasd88BBGLVJOGHVK6MOyg== 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=8om8eH2QedUZdijrrSK77S2858Mj/v8BVIBqUQfR/qc=; b=OSzIS4IBvOEIf9Z9vv/vQmudmx7H1ebXjQKahJGAWpT3zwISvlA03yuQo4I5+t0N4nreqzhFh3V+U4hPoepYsGT/tuCm+LEwZLtwutP24IasQW+2kRdfwFpjwoQa7na61q6O4UVOIKs+gPmrTrcq0ALDoWY1Nb9Bh0IXI8CZbvz/BLEsbPVYvXYFHCOuhzeBmsgGuxGS0mpdRCdyUYnLv+5nRVlYcb71ZTZfEPx/T4s19pJvbAGGWhqVEPfFkJz51LtvLwCEKHXEO5moqr3CIIMnQBeRM4k8NdLsLIynwopMYQS41270i6nNRuUqR0q7mKlBdYKymEjzDbxsrCwaJg== 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:31 +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:31 +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 , Camelia Groza Subject: [PATCH net-next v2 07/35] net: fman: Store en/disable in mac_device instead of mac_priv_s Date: Tue, 28 Jun 2022 18:13:36 -0400 Message-Id: <20220628221404.1444200-8-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: 57e8d96f-9620-4d32-7be6-08da5953932c 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: nRLyBsPrAwP6PSr+LMslXX/4gxzoMbGrotjLq6NRFrUbWGdUOsprP3WKZFxUvpfu0ZSRwXWBGeGKhGk2SjbyIykuRNPWWTOeN95rZZycZI6m9za1aJFS5atwAXVNy7qAeUZ35GHub1uvB02atDxQdAKaHcbpE4mvYjGojYCABPUUIFiud/L8qKzAlQklZ3NTgLhLa/Ltdipr4/jIL4btrREnq/+WY69nTbvTqs49GUwjHxYGQxzPzPPiDCeqWzPK2hTANRRVMXs69UvFKqbeLqdsf2RdsEkqxEaKZhj5drYA4vnGAKvY3EVwzo1fnBvAMjbh7Ukn+4Rgv0k3rGtmIkGMB6phIFClgAWslDj2HZ4gDeLDh6/mA5uJnIzYoRREgiB0fkbzkN/e76LfU2JWLdHBpxSKmyGV+1vGnie2X9VZatrmBunJjNuw8qs0kymZvjTfy9zRrcqazE8Ma/ED7DPopUqFQRsdzgaHNNOErMQ9ri+rxIQ/OxceUq1T/fALoxTRUPEdvr/7vBFKqVq4qM4gUaNfE21dSEF4r2i1dPF33779PwX3/1NOzRqeMG8R/SB61d7MztoKo1EoekzFJetuuRSWHoRiuFVc+LHBstw38vigamcfd+7MM3okGhIeSiSGVtAUH9J23pgGcWfQqb5e2giTicZKUPoz6CCCyiwl+9lhxxbDe1sZ3ueALzdsUrwiP2ivmUn4kgtp/PaJOT6WZhoo5cllvlBIXlGu6s+FChK118lFMC4AujHbal7kml6lKHkH9mu4q1x9IjalLWOWjI3ZLv7kxAihcwnm1QI= 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)(7416002)(44832011)(6512007)(186003)(38350700002)(1076003)(83380400001)(86362001)(2906002)(66476007)(8936002)(6486002)(4326008)(41300700001)(8676002)(26005)(52116002)(36756003)(478600001)(66946007)(2616005)(6506007)(316002)(54906003)(66556008)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: N1L4Wj8ozuWsEk/ZN0frpmKJ7bVcS0O1Mzblf3aiBqxx0nA3SH2zRlr4dmIvpfWIF4VWooP1xBQNqbAI90MGfAsWdJ4N717+jq+X7Q3m/XwTs7ug/fOpcjxc2W1INovZVH59PodWWK99pZvFA4JPIR/RHPGxelIxEarEEHzzAa3i25S65DnSw+7eqdB/UU9nrg6fBfUKUcmvrERkfFcLyJzkO5wniJoIFLUBWa/NM26L19CScgKaeCak9Q5e+prRTLOJ3ueH9o1CQRasrh0AkVfQ96rrMfcCntV+1O0sPS6NnVGMi1x0ZBIpiJ0KGGRbeP31VDJPqnuRtPmqpw0qzk0UEYJo4zS4scbS/vZdsEd6ztU68hULGcO2AccZE44UAAhowQKmiUciCUWRxh8lUP4Ve5q31nsBPt8ew2ZArzdE3pwMay5kuKk4nSkFjbQJsNSduJ56F3Ik1U2+T7AzC2+Yx0PrBB5g/6lNeBFVNHhzl7f2egCDDC1wIT/gWUoFXTWYs6sLpjNFXYOhVmnRJIoB308l8uAoNXjKIuBDH4SgDSWpwrwVjEiEdf2ZhEl1AtFs2/aCZtmL8a0/QKzTnUbQH62ZfpMRIaFZLjLk+3XJ9XciNl8gHTsmonloWpFqAVpBzps4X32fYpKi3Yr/aFLIgCVYd56ken1k/HPOyf+IxFfcpHW8Lud3AFfVywGIhcDj/D9fuOwhx6Vn48vvNNicGGFoHZYUUBLrBonuHM/Y33o8XSnLI0PBRMn0cEJxnjt47iKSfpqMOjFRctZEMV8xhGzKm6zJw5u4q22/KW/7xRB07xnhu0Jc5TuVGadsZg5L23jjSMFJFDqEo31o5e8Rejnj82tFhaOhkmDvShWbWpVV1BW7x+HBJOL0Bqd4qiV9dWc7guiUuomSbHEMyYtpE9ku9Phy3Wrxt+/985VZlEBkdzDMRS4NyRDQQW9MQjKw2M+m/ZcGAowGVdKMknIz2rPqzGb0xZ6RjK5ZCQbv0zEFmb/TH6JAZoV/Fj+vPbWmkZNY3NmX7EmOZxAWNnBhkKZn1w0oOW4kqZXIAQaRvxHj8RpeOzIjxI1dWVM0/11Ajpek64kTxLTHlWj5Io4CKmWMEFWjU4ELGnl7tklLWbcyAq/YzOTj35EbmQi6nhfL8c+fx0P1/jS8ZSgO2bJdK0hTJI3+yAGUff7lrvFyUK+uoM/vI3+VGxm8lBqkX5j6M1MCRqYrUUkDR280FymELstH4pYpviwSzYNryYzmJl5bZkiD8ORIGTy5xJKmWZsqjtTMz/IdhbRyWbiMiCRqlD+DpyZyOgYDaxlnN5RHmiE/YVtpXIu/XBlbmH2fgmqjDGbeJYpL8yyd0RFfZrLCl06BHLanapr3L2wcdFEktUVs4d1ylyrajvpcWqsRk4OCRhPpYAD+4nu3sPRU9oZNUNU9iF5vvsVCz8WtooLbW3fbceYC9zBDS68Ml90p6Esg5F0WZTL+RkDDUQm3+WLQ1surMF5VRgZkYE3xDtXTNUj88k6/KIlgn5xmnM5KVvpEJGzK/FnbHuHZbgC8pvRZjPCVeC50WF+0NAj485DPDP2GpD8pUxtFL9purDBxbg0JmFAL55TPcgFsC4z0CA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57e8d96f-9620-4d32-7be6-08da5953932c 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:31.3607 (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: 7k4obUcGZCGvIwRKyIWTnYhIRxdzW+cv5wnQrb/kfGBAgIg4X675Eh2uq4TaeMbL59/X6D3S4qnmIdYF1yldXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151443_684963_7B5F0B07 X-CRM114-Status: GOOD ( 13.87 ) 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 All macs use the same start/stop functions. The actual mac-specific code lives in enable/disable. Move these functions to an appropriate struct, and inline the phy enable/disable calls to the caller of start/stop. Signed-off-by: Sean Anderson Acked-by: Camelia Groza Tested-by: Camelia Groza --- (no changes since v1) .../net/ethernet/freescale/dpaa/dpaa_eth.c | 11 +++-- drivers/net/ethernet/freescale/fman/mac.c | 44 +++---------------- drivers/net/ethernet/freescale/fman/mac.h | 4 +- 3 files changed, 15 insertions(+), 44 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 45634579adb6..a548598b2e2d 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -288,9 +288,11 @@ static int dpaa_stop(struct net_device *net_dev) */ msleep(200); - err = mac_dev->stop(mac_dev); + if (mac_dev->phy_dev) + phy_stop(mac_dev->phy_dev); + err = mac_dev->disable(mac_dev->fman_mac); if (err < 0) - netif_err(priv, ifdown, net_dev, "mac_dev->stop() = %d\n", + netif_err(priv, ifdown, net_dev, "mac_dev->disable() = %d\n", err); for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { @@ -2942,11 +2944,12 @@ static int dpaa_open(struct net_device *net_dev) goto mac_start_failed; } - err = priv->mac_dev->start(mac_dev); + err = priv->mac_dev->enable(mac_dev->fman_mac); if (err < 0) { - netif_err(priv, ifup, net_dev, "mac_dev->start() = %d\n", err); + netif_err(priv, ifup, net_dev, "mac_dev->enable() = %d\n", err); goto mac_start_failed; } + phy_start(priv->mac_dev->phy_dev); netif_tx_start_all_queues(net_dev); diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index a8d521760ffc..6a4eaca83700 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -39,9 +39,6 @@ struct mac_priv_s { struct fixed_phy_status *fixed_link; u16 speed; u16 max_speed; - - int (*enable)(struct fman_mac *mac_dev); - int (*disable)(struct fman_mac *mac_dev); }; struct mac_address { @@ -241,29 +238,6 @@ static int memac_initialization(struct mac_device *mac_dev) return err; } -static int start(struct mac_device *mac_dev) -{ - int err; - struct phy_device *phy_dev = mac_dev->phy_dev; - struct mac_priv_s *priv = mac_dev->priv; - - err = priv->enable(mac_dev->fman_mac); - if (!err && phy_dev) - phy_start(phy_dev); - - return err; -} - -static int stop(struct mac_device *mac_dev) -{ - struct mac_priv_s *priv = mac_dev->priv; - - if (mac_dev->phy_dev) - phy_stop(mac_dev->phy_dev); - - return priv->disable(mac_dev->fman_mac); -} - static int set_multi(struct net_device *net_dev, struct mac_device *mac_dev) { struct mac_priv_s *priv; @@ -454,11 +428,9 @@ static void setup_dtsec(struct mac_device *mac_dev) mac_dev->set_allmulti = dtsec_set_allmulti; mac_dev->set_tstamp = dtsec_set_tstamp; mac_dev->set_multi = set_multi; - mac_dev->start = start; - mac_dev->stop = stop; mac_dev->adjust_link = adjust_link_dtsec; - mac_dev->priv->enable = dtsec_enable; - mac_dev->priv->disable = dtsec_disable; + mac_dev->enable = dtsec_enable; + mac_dev->disable = dtsec_disable; } static void setup_tgec(struct mac_device *mac_dev) @@ -474,11 +446,9 @@ static void setup_tgec(struct mac_device *mac_dev) mac_dev->set_allmulti = tgec_set_allmulti; mac_dev->set_tstamp = tgec_set_tstamp; mac_dev->set_multi = set_multi; - mac_dev->start = start; - mac_dev->stop = stop; mac_dev->adjust_link = adjust_link_void; - mac_dev->priv->enable = tgec_enable; - mac_dev->priv->disable = tgec_disable; + mac_dev->enable = tgec_enable; + mac_dev->disable = tgec_disable; } static void setup_memac(struct mac_device *mac_dev) @@ -494,11 +464,9 @@ static void setup_memac(struct mac_device *mac_dev) mac_dev->set_allmulti = memac_set_allmulti; mac_dev->set_tstamp = memac_set_tstamp; mac_dev->set_multi = set_multi; - mac_dev->start = start; - mac_dev->stop = stop; mac_dev->adjust_link = adjust_link_memac; - mac_dev->priv->enable = memac_enable; - mac_dev->priv->disable = memac_disable; + mac_dev->enable = memac_enable; + mac_dev->disable = memac_disable; } #define DTSEC_SUPPORTED \ diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index 909faf5fa2fe..95f67b4efb61 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -36,8 +36,8 @@ struct mac_device { bool allmulti; int (*init)(struct mac_device *mac_dev); - int (*start)(struct mac_device *mac_dev); - int (*stop)(struct mac_device *mac_dev); + int (*enable)(struct fman_mac *mac_dev); + int (*disable)(struct fman_mac *mac_dev); void (*adjust_link)(struct mac_device *mac_dev); int (*set_promisc)(struct fman_mac *mac_dev, bool enable); int (*change_addr)(struct fman_mac *mac_dev, const enet_addr_t *enet_addr); From patchwork Tue Jun 28 22:13:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899077 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 6929CC43334 for ; Tue, 28 Jun 2022 22:22:23 +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=/fOR0B8j9yYWJsqW1+TzmKubAw+H/S8A3qU5pZskNp8=; b=gACknybWxIzNjh CqeQok/MHpSNtgV/GieJaJp+uLx+VsgE9ZB7ay04df9cF0iaUWTdYZedpi12uBpxxBed1ToDaZOvi 6W2wPjBqFtqV3+YBmSAErjw2XyFSkm6I5Mo8Z6p6sCIy8JfZ7VzOc/gBRcmUi2e2jSH2ZLj5hV/Cx I+sR/tY84zbGP6iDOZ+UUfKDCKfV4NzvPqV0UM5aVj0+G4DJn0qBchoEgJyuZoVHw/Y9OwlzxLn4m vzGlgC+1g4myMVBBwNWcTFWstq0OFgJ87yE9uxyUZ/9DCJ0BN4w1UT+F0FpaBIcjW/4U/qFi6A83s NkOy+2NJVjTxR5KoDDVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JZv-008OiW-My; Tue, 28 Jun 2022 22:21:04 +0000 Received: from mail-eopbgr80074.outbound.protection.outlook.com ([40.107.8.74] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTp-008MXM-AA for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eomz4SRN0EF2aAIKc/lYFJ8MYAh/iRo4kOeSEu+D/nSxOvWFlf4X6anicsoUKW5rG6rxT9O//+1Pw2jnwQjM0G2QGniSAh6XWKioGE8ty/bNzYZYiCcU35yn8yP7P6GNtlouckzeIKLV8tTG+WFwxvHAMq5Hc01mNxOI6QLZktQeN8+OeSpOjqwCwr0Q2is4aas6JTKjSha6hCs3W2cihJZAwoAJ4C4eh49A/Fm/DjY2IdOGrx7owUMg28WcQBOkoy8PQ7BgB9d5HqQtpABR0sgwemwubu6FyxXAoXU33NEODi/oFJhjALquwV1Krcm/5ID39x9T6UTIDN5OyKhPMw== 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=9L6FnTqvCduyYhxu+YFwE1dDeiGhnmXGiGrEHy0sXGs=; b=OL15lotRnVZGQlB48q+xtVP7DuZgYXt3iVqQTtE9/XkP+Pap/QRZ48GMp0VMd2KsS2Q/9yHmY/AaXJWpLPuZjSRw5Z+FjF97vR8D9VL1rwtg/uHbBxeIX/Y6wKB24Uz3wayjjGwLWsGBc9V8mdWFJQ04RyTZn6PtanW+zJOcx+8tgIb1fYrFGUz9uP+8nbWIOF5/z0C/xUrjhITalZu/P3PWcNQb/xZU/NBCDnjS9RH5wm1hC39wVlPgUU7r25WvbOaY+zfB0Ahch+U4ktlCzckZEIvMlpaUwtKNLmora8ElkNkBkSaAI67jje7QZjA52pv6f8sGpRNP5SgYmGiDIA== 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=9L6FnTqvCduyYhxu+YFwE1dDeiGhnmXGiGrEHy0sXGs=; b=qqFhGzu0weOs5ScbDS1iqBXNwSwmDEM690T2s3BcKYOc4QIbNsjgwB+MyLD26WQWdeqoYmzSiFLrcGJkSsZnLx7kqSFw6m4D7KK7MHiu+7L1Ahx+zRvqXhQbbUUA9idIbps/O/Jcv2egaZohHMDz2tEmjWHi7gJCVZ/BRuNzYPKwN7JoaEa7w/BhloZnxkiNJptmp1cZ9mWUoQnWeMB4CSaJIKrM+ThFUEzNeHJIyCqk3Qv4xFilI+gHCxBwy0PErkTNiFHbPdsCEdU81HVgakaNc7OleVmhg+pHYJFjc0eoK3MTJcCADatgCLOvX0DjBuPbFmnXkq7srE46+RwvwA== 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:33 +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:32 +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 , Camelia Groza Subject: [PATCH net-next v2 08/35] net: fman: dtsec: Always gracefully stop/start Date: Tue, 28 Jun 2022 18:13:37 -0400 Message-Id: <20220628221404.1444200-9-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: 3f7cd0ad-36b6-4d63-bc03-08da59539413 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: MtoPzsPGOVcsU8flnADO2AjSg+RLG0mhqdP0xrad+PaaUxeGoz1c0hgFpOQenPduabX6Eenok6aTfOcb3Ko4VzF8X+KD6bGgGn4PsnWyQPj9WT4ijSPEzrmGvcRzZg9Q2Mq5rWqyvuXMTemVy9rBHMhZvrXIvOzzamBFkxSb2RxMpPfvZkAw4zvGbTll6RBnhMUA+SJ8S2mjMdqy/ujSG5knYjSB115VkoL0eKdnLRij3NTuOUiM+NgXm0E+fywOhI5z+OvqXfkLzQ37+t+FOLaNr3mN688GnmjwUf5WJbszjk+/CzBTaZg2zw/M3CXLmE6If6hEbX+qmFX7bt3oOL0krCIOkjOgHhPpUJuZcQ9koVD6j4Sws9N16TZtDU6PT+1TnI05HQO9UoNE7Y+QXDTRUBti7yOM0+fK3D4Bh2+YewxWkIZ1c8MRl3VsFePOhWckbt3owxh0w1Tcu5ArEA9/V8/99djldmGLy+e+bVcXpf2nq3cUYHyWN2v2W4OvYs4ItKFwPRrdZzFpJjhOiORN7OydhSiJSnAyQyoKGlt9l53Kp4eqOpySmDYuZYxX0KIIfiYMHQCX+Fk3v/yUA/6XJ6Ru2CQY1n1W6KmfnJvOgtp54krGqWRIdfXDCTM2ozgaLoG7aans8NzdmPwaVBAiDdPVPiLdp9yUjzK0F7bBMvSwxpEhIhtAcIjAFUfRxegYOECEc8lZK1r0HyemeMmRbpXfsZzttGWWcn0LGZBo9uUPe9gKGjimqmKB3ihJVfaG+Owkwnt+T6EqyeuKqbmH+hg2OyeGHV24h6W7w9c= 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)(7416002)(44832011)(6512007)(186003)(38350700002)(1076003)(83380400001)(86362001)(2906002)(66476007)(8936002)(6486002)(4326008)(41300700001)(8676002)(26005)(52116002)(36756003)(478600001)(66946007)(2616005)(6506007)(316002)(54906003)(66556008)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: plk3ml949s9AR893IeE7w90N5vvhsIA7i1k37/bINw56GB0vqKmz8QkSQKSRj3SKt+AOt1aIwRr2guVHEugt9SADCzJEy/1Rai8tdN4ul8D8/bGlA8etl+Xs5C3x8MmuLKLIbVAAgMiXFPlO+Hc9t+lRYg+lpFjsjBFv9mhvdwUD7/lRpQ+VQk3g/O/k1w7Jxk7zUlBnT34Ha4/ZX7L7jQKhvOXktZ1405rzJr+Ed2vOgg/41lRXgtbRXZ0OymszsRNwuck6ySd9IwvTElzrv8tRTFwS4h54v3e6A0e5HhDa7JZ+sdgoi7sAYLLCJ6XJUTtcI7Nsk9P0lEsp8ASl8q/eQZtUtGCOlX7vqfSuXUTaLxnGHEM/zptrZXFSG8iAASBEqfWEHNkE0IJdmirDjqJgPcbCfsXWfMDIc3ojcL3Qwdfry0ay3bX+7mnqSrWl75dupV/39cQB+OXoXgOiE3uxf7lki4Ohj+LEpW4Zlxb1btld821eEUnCm7XPxh/S7DVF8dhylHrV/Y1Zz5wsV/Bejpxgn7oLHpZXm/Qgbqq0PJOvhE+60pExlRzjLy32o9Q3jgH5khTfdu2WGvDOA0yy+k4bRXWFPpGkMUGCI4kpbou5rvjPCxf4qMGoFM1zdakzGswq90MgyD2+QkSuygcNSNemEb8cSjsI1BtTAqakSFXc5egy7ZlW1HGHpBeqzuo/bgibUs7k9Jz1XOF4sM0UAuz/1CGHP6Bz07phrqosNi1Qg8JJ0JjnoMN5A4USuFIX6AgIhakoBEPO3WO/afOwEIh34PyABQv9OgtNWKFqDqzr/bD/Nj5DuOBmibqpbj3ATppL4tjKRbQmWaI6FQeSmvGVBcMOhFon3SYqjGSSIzMAKUGnZP50xAJA3zpmIvjW+dJHLXerWo1BD8SJQRXeHiT9pPTYbLqD2Gl8fKg/pj3jnSvYBA5xS1qnbQRWyAayfPI5f8rYn4xNhgtqdsCPhh2MXQfNuhlDDt2QvkR124grfgXJcKRaMnqcVgrPsdFej4pdssY/ZtLbH7UiI+mGHtPVKg5U0YXT3yb7XgzxleWzJXBwoNcW2jfQBDbo0wXJGt5QgC8QO2CXCpjLY8LdRVWh7OnTOxjCzNXgV26klI9CFfLaSaxNpmusvXZKrPuCxpxnj8fK3u7uUVC8XThgfLVDvRnO/wxm2AQ0PSavqGBDVBCv8/lGVl6tlijf1eR4BPCj2LLq6SSA04wEddAfnJJ2COHZzjRbQdzCduVoW0C/3BkSNeAxmEnUuDM48gcdmpqKkBndUr+kCaKa+PyFVwYeT3hlCPqrwk3kTirqgZFRp19B2upRVXjQOx49puo2jIh6GrspO3wDZq6HHbMGpb6NPmtbJWb640M5gkP9U4DwtEj5oBNYyFNvKimaOT9U2GZVTLbPhA/tMzGVxljJGk0ld3MrDH1acznh124e+PS3gLZ8V1PZ9SNu1yPTOtAa09nRNSMdHYgPFlKUEgHffKRkUQtDawMi301zfKU0OuRFfcSy3Sy4cMy8xxxQ/VaJGbHkAjcmx9IB8BbdcYPxFQKLcjStEDmZfbnV8P6cKx7f+oLtMQz7+pQr6iokV/yCUHkRvoFy1F0twIkTxA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f7cd0ad-36b6-4d63-bc03-08da59539413 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:32.9075 (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: PNegErLT+jTB70XpYKNw3wIXCPZV7DbeutTHnk64Ebtk9s4JHVNLkiYKqQZlC16fKritlznzAw4kGKe/lxSn/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151445_547015_EFE96C4C X-CRM114-Status: GOOD ( 18.32 ) 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 There are two ways that GRS can be set: graceful_stop and dtsec_isr. It is cleared by graceful_start. If it is already set before calling graceful_stop, then that means that dtsec_isr set it. In that case, we will not set GRS nor will we clear it (which seems like a bug?). For GTS the logic is similar, except that there is no one else messing with this bit (so we will always set and clear it). Simplify the logic by always setting/clearing GRS/GTS. This is less racy that the previous behavior, and ensures that we always end up clearing the bits. This can of course clear GRS while dtsec_isr is waiting, but because we have already done our own waiting it should be fine. This is the last user of enum comm_mode, so remove it. Signed-off-by: Sean Anderson Acked-by: Camelia Groza Tested-by: Camelia Groza --- Changes since previous series: - Fix unused variable warning in dtsec_modify_mac_address (no changes since v1) .../net/ethernet/freescale/fman/fman_dtsec.c | 94 ++++++------------- .../net/ethernet/freescale/fman/fman_mac.h | 10 -- 2 files changed, 30 insertions(+), 74 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 167843941fa4..7f4f3d797a8d 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -833,49 +833,41 @@ int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val) return 0; } -static void graceful_start(struct fman_mac *dtsec, enum comm_mode mode) +static void graceful_start(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; - if (mode & COMM_MODE_TX) - iowrite32be(ioread32be(®s->tctrl) & - ~TCTRL_GTS, ®s->tctrl); - if (mode & COMM_MODE_RX) - iowrite32be(ioread32be(®s->rctrl) & - ~RCTRL_GRS, ®s->rctrl); + iowrite32be(ioread32be(®s->tctrl) & ~TCTRL_GTS, ®s->tctrl); + iowrite32be(ioread32be(®s->rctrl) & ~RCTRL_GRS, ®s->rctrl); } -static void graceful_stop(struct fman_mac *dtsec, enum comm_mode mode) +static void graceful_stop(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; /* Graceful stop - Assert the graceful Rx stop bit */ - if (mode & COMM_MODE_RX) { - tmp = ioread32be(®s->rctrl) | RCTRL_GRS; - iowrite32be(tmp, ®s->rctrl); + tmp = ioread32be(®s->rctrl) | RCTRL_GRS; + iowrite32be(tmp, ®s->rctrl); - if (dtsec->fm_rev_info.major == 2) { - /* Workaround for dTSEC Errata A002 */ - usleep_range(100, 200); - } else { - /* Workaround for dTSEC Errata A004839 */ - usleep_range(10, 50); - } + if (dtsec->fm_rev_info.major == 2) { + /* Workaround for dTSEC Errata A002 */ + usleep_range(100, 200); + } else { + /* Workaround for dTSEC Errata A004839 */ + usleep_range(10, 50); } /* Graceful stop - Assert the graceful Tx stop bit */ - if (mode & COMM_MODE_TX) { - if (dtsec->fm_rev_info.major == 2) { - /* dTSEC Errata A004: Do not use TCTRL[GTS]=1 */ - pr_debug("GTS not supported due to DTSEC_A004 Errata.\n"); - } else { - tmp = ioread32be(®s->tctrl) | TCTRL_GTS; - iowrite32be(tmp, ®s->tctrl); + if (dtsec->fm_rev_info.major == 2) { + /* dTSEC Errata A004: Do not use TCTRL[GTS]=1 */ + pr_debug("GTS not supported due to DTSEC_A004 Errata.\n"); + } else { + tmp = ioread32be(®s->tctrl) | TCTRL_GTS; + iowrite32be(tmp, ®s->tctrl); - /* Workaround for dTSEC Errata A0012, A0014 */ - usleep_range(10, 50); - } + /* Workaround for dTSEC Errata A0012, A0014 */ + usleep_range(10, 50); } } @@ -893,7 +885,7 @@ int dtsec_enable(struct fman_mac *dtsec) iowrite32be(tmp, ®s->maccfg1); /* Graceful start - clear the graceful Rx/Tx stop bit */ - graceful_start(dtsec, COMM_MODE_RX_AND_TX); + graceful_start(dtsec); return 0; } @@ -907,7 +899,7 @@ int dtsec_disable(struct fman_mac *dtsec) return -EINVAL; /* Graceful stop - Assert the graceful Rx/Tx stop bit */ - graceful_stop(dtsec, COMM_MODE_RX_AND_TX); + graceful_stop(dtsec); tmp = ioread32be(®s->maccfg1); tmp &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN); @@ -921,18 +913,12 @@ int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, u16 pause_time, u16 __maybe_unused thresh_time) { struct dtsec_regs __iomem *regs = dtsec->regs; - enum comm_mode mode = COMM_MODE_NONE; u32 ptv = 0; if (!is_init_done(dtsec->dtsec_drv_param)) return -EINVAL; - if ((ioread32be(®s->rctrl) & RCTRL_GRS) == 0) - mode |= COMM_MODE_RX; - if ((ioread32be(®s->tctrl) & TCTRL_GTS) == 0) - mode |= COMM_MODE_TX; - - graceful_stop(dtsec, mode); + graceful_stop(dtsec); if (pause_time) { /* FM_BAD_TX_TS_IN_B_2_B_ERRATA_DTSEC_A003 Errata workaround */ @@ -954,7 +940,7 @@ int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, iowrite32be(ioread32be(®s->maccfg1) & ~MACCFG1_TX_FLOW, ®s->maccfg1); - graceful_start(dtsec, mode); + graceful_start(dtsec); return 0; } @@ -962,18 +948,12 @@ int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en) { struct dtsec_regs __iomem *regs = dtsec->regs; - enum comm_mode mode = COMM_MODE_NONE; u32 tmp; if (!is_init_done(dtsec->dtsec_drv_param)) return -EINVAL; - if ((ioread32be(®s->rctrl) & RCTRL_GRS) == 0) - mode |= COMM_MODE_RX; - if ((ioread32be(®s->tctrl) & TCTRL_GTS) == 0) - mode |= COMM_MODE_TX; - - graceful_stop(dtsec, mode); + graceful_stop(dtsec); tmp = ioread32be(®s->maccfg1); if (en) @@ -982,25 +962,17 @@ int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en) tmp &= ~MACCFG1_RX_FLOW; iowrite32be(tmp, ®s->maccfg1); - graceful_start(dtsec, mode); + graceful_start(dtsec); return 0; } int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_addr) { - struct dtsec_regs __iomem *regs = dtsec->regs; - enum comm_mode mode = COMM_MODE_NONE; - if (!is_init_done(dtsec->dtsec_drv_param)) return -EINVAL; - if ((ioread32be(®s->rctrl) & RCTRL_GRS) == 0) - mode |= COMM_MODE_RX; - if ((ioread32be(®s->tctrl) & TCTRL_GTS) == 0) - mode |= COMM_MODE_TX; - - graceful_stop(dtsec, mode); + graceful_stop(dtsec); /* Initialize MAC Station Address registers (1 & 2) * Station address have to be swapped (big endian to little endian @@ -1008,7 +980,7 @@ int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_add dtsec->addr = ENET_ADDR_TO_UINT64(*enet_addr); set_mac_address(dtsec->regs, (const u8 *)(*enet_addr)); - graceful_start(dtsec, mode); + graceful_start(dtsec); return 0; } @@ -1226,18 +1198,12 @@ int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val) int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed) { struct dtsec_regs __iomem *regs = dtsec->regs; - enum comm_mode mode = COMM_MODE_NONE; u32 tmp; if (!is_init_done(dtsec->dtsec_drv_param)) return -EINVAL; - if ((ioread32be(®s->rctrl) & RCTRL_GRS) == 0) - mode |= COMM_MODE_RX; - if ((ioread32be(®s->tctrl) & TCTRL_GTS) == 0) - mode |= COMM_MODE_TX; - - graceful_stop(dtsec, mode); + graceful_stop(dtsec); tmp = ioread32be(®s->maccfg2); @@ -1258,7 +1224,7 @@ int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed) tmp &= ~DTSEC_ECNTRL_R100M; iowrite32be(tmp, ®s->ecntrl); - graceful_start(dtsec, mode); + graceful_start(dtsec); return 0; } diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h index 19f327efdaff..418d1de85702 100644 --- a/drivers/net/ethernet/freescale/fman/fman_mac.h +++ b/drivers/net/ethernet/freescale/fman/fman_mac.h @@ -75,16 +75,6 @@ typedef u8 enet_addr_t[ETH_ALEN]; #define ETH_HASH_ENTRY_OBJ(ptr) \ hlist_entry_safe(ptr, struct eth_hash_entry, node) -/* Enumeration (bit flags) of communication modes (Transmit, - * receive or both). - */ -enum comm_mode { - COMM_MODE_NONE = 0, /* No transmit/receive communication */ - COMM_MODE_RX = 1, /* Only receive communication */ - COMM_MODE_TX = 2, /* Only transmit communication */ - COMM_MODE_RX_AND_TX = 3 /* Both transmit and receive communication */ -}; - /* FM MAC Exceptions */ enum fman_mac_exceptions { FM_MAC_EX_10G_MDIO_SCAN_EVENT = 0 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: 12899078 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 439F0C433EF for ; Tue, 28 Jun 2022 22:22:50 +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=tHFUFC90oc1+JS8ZFHUAmapq9deCzN4hG0SR8qj9IJk=; b=FbOQZIXNGz3qpZ we/jJ+YyAPFCvWdN4IBS5WSLEG7uxlX+WKNAauQ62J1CVruRtdc93oBKqqi+AtxWLsIMmq5bOVk3O oiyP9GZN9MnpALIVCadtiGPOeMCF7Uxbq6BKGHEN0UrfHH5h4xoeHv4Udy+vqT2MM2cp7auIq7Hpf UT/lkrCugv/11pmmitEoO4NPq3cz+yeNvEB8AEsxu46ZKifWXnqkvLo9sr40okYzwTU+IerM2TVKs VExtibq60k2fOKx8tPgppf1Czu2HLAnFak6EUvQY0Iopl14KLK0L/I2B9tt/0j6SgPlww+lsvikL6 iYlQ5v4fSsftVzbD+Z+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JaN-008Oq8-GO; Tue, 28 Jun 2022 22:21:31 +0000 Received: from mail-eopbgr80072.outbound.protection.outlook.com ([40.107.8.72] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTp-008Mcr-NB for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:47 +0000 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)(107886003)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2JW76E8upatzGyOJc1lGdxijCapAdzhNOG5i9a7LZiYrenEc8+HjiVwDp5eiz+7mJYkfWrAkktNub0O9dAXQul7p1Zq6O2dJI+dVNpOqWMWLTtlinBTafsQT+9WY18VbXixmVf4a8rUyHdgDIK2TvItYbmgTIVAtAPemb9HlVItBxCS/t6jweGGSVOyrdrnM7Hy9K0oFMzO0Gpqoa6bTMNpMWxnmI6eebFlidF7Z4wFABxwrDmqQhNkfgHPv/m/t2PsxRxkGKj6+FMePkVPqHFpzivy7bBSGToBJYjHg5hCPws1FCLMVvSs1aRo9OyztUJBLGrVcInOmvR70zSap/s8iDgvstxUKnuOs1tv+OWvV0KXKtAdQfmdW54vRsuLGIkrRh1a9mSzMydS3hAIJuBLwRr0AQDwcyV7ytd1Z3f8p1Uw9tb0JRkIuoMW/UyS2tc+MftMkNJRhBNtzrdyv9bAj3EGfwdKLNFFrnSX6ePPYJF3RrJ5iK1GCTTgqdjqD8b2orZKPe1GSypPoDPr/sooE3Gv2XXSiny3OvdTd1lbA6c14Px75zXNHdroVKB3gDo5zSYkuYTwlRJu5cyw4mV/yQDRgzRftlzVLjGM01WQV+iweDPa/D+1js0BwbSrYfqN2CY5lJ7mq93RP/arMQAhHIJi0w7xS5tX8ammpywz1DuCDu3QWC4SLcG+EGIN0V6O/3klnPXDQB/wk1byIZcAJEFL6QC7oWsFKY89PYngaAlQ0JJxSlWqEuJBu1qlfR+tMWtLPpBa1bTdy/DSF6BvmKwmT6OqYiJYkWw+TNU7yasY6FiRTaFKh3DJKMrGOkyhaiCg4xQbLaRJMxZFoLwIOx7n75pYLojXlLgVajvnYGe6Bus/gi9du7Du/zH9RZzCk0f8yFPJfmNRB95yNU3PMQzdcudqK5hpZxfFP32SneEYpyvf4EHOiH7Nm1rfLl8YRmfwrakPMrl3LJrZ96x1QfJ2efSL+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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151445_843467_E2964CAD X-CRM114-Status: GOOD ( 14.49 ) 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 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); From patchwork Tue Jun 28 22:13:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899080 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 A937AC43334 for ; Tue, 28 Jun 2022 22:24:14 +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=gR/Oh+rpXD5kfU3W1ZrWGOlpMud2DeqlL2icNeyS81g=; b=AWUV14thhvgQ2M eIcuEXYnodJoPYHcWmlBsTAJ8Hhe3N0ynKX+zoVRFngI+M5BV2fmcS0UAPKM+/fQWudx3IiVsd5+T H/bpsgzjNuZ/TRl1Zw3D1BAEqt46ZOC3lOFe+KLa1n4qSuFBfBvwDjq3iGolhvmO2okJDKeGSxjrF J9/rXFqYcAK8xnGDqLdmJUpkqCvo3SmqPphFGIY+p6I+NrbzTXHycnM+pXL9pKO4dL2Hqkdf1afvE AeLDyJv3vKv2Ne9BIgOvdcvvJwBW7lzHOjKzWs2xgbBFMDD81NvIS1wGcbmrQ0nQjtkzO73Q3m+Xt Pvft1WhVUhLiXMWgm1zA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6Jba-008PEq-LI; Tue, 28 Jun 2022 22:22:47 +0000 Received: from mail-eopbgr80072.outbound.protection.outlook.com ([40.107.8.72] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTr-008Mcr-Ty for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DNy/vjZEdo8EaqcmO4HY7M3VB4hytftKojgcmfLxHcj9jUFleDvmkoEaJSeGKHHOV1pzOj/6XDU1sGvaDz3GMfpMzrG7AbrH1tn2sMgV1a1o69KAdNvk7FVhv5saUnTRhhXER300uEMRDs29Bnub156MA92iLIIY/velQLigxzlNEvUyEx3+FaKKw2Rzez1ytiSzCSxro/sKSwUdw7nghI1O5t/ioX6B7lMF9sCSswnXFOdGKRz1NXNmjGUrLmuyAq1V77EK/fqvL3Bbn/ae/W8bt8CEwlTEp6GipLZR3J12AbBHb304kvNAA0GMkewqtCGR4TjS/0nGrMQfXIXWQw== 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=8KqRKo90qF5SMCwXEf7wvpeW8QFnS3p0uFt+0Hs09Vs=; b=f03sVNAPfdqBt7kENE5QfxwAC79o5Nt/3GRGzb5tYTFLo+ta79rl1HL+6FONJMAIotjW+QJJu4tyqFmPTC2yIIS4bzUSkqXU6LKtwDWC6F+LI0G1RiNiTc5xiA4spmFpKZ2NWcrWsu0JnHXzBOHPtjpASO7ItnbA8MH5OfPTs26wBzx0xrNJjDbTfqpKYQKcVCZl0Yof4dNGBDg9g4SpiIzcO1g05ysQS7Im3jLEs3XtToJyIS6tu6sOCf/ODbmU+vq3EGmsF9iolvtIU234XUd8xlD6ATswiH+YFeqS34FvylQ9ItutLio7KYbfco/N6wLlsmz1pFPcNDDw1R/RJw== 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=8KqRKo90qF5SMCwXEf7wvpeW8QFnS3p0uFt+0Hs09Vs=; b=PXwYAEGh6SQivcn6wK6HUCnAIayXNTwgqBX9/FRuZs1LMN/Ka72yyTnHvL5jIW1CSnB/s9rkfrTyPcd9iFT7wj29RJ3JJCqpi0Rc7TOOHBW5GhTc5/bZG6GAbtmEceRiTOVJAeFzkizkzJsp6ZwvAKDhD+Mb7K4bh976BEKX4YAPpu/RFBFCNc+FFa/qRPxEKqGe/EIrg1mD8+zNHDHIE8CsMgTd9rIGrjtRITMQZRI+l87K66L6PFWOhf5s9WV1kBALNiNLvtdTPkDKeklisJ0C106ZYGC6PrZ9iFj1UcWk3PmFd+p1ymYFu4WuNJv649Yprd9dkl8Tag5KdhIRug== 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:35 +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:35 +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 10/35] net: fman: Store initialization function in match data Date: Tue, 28 Jun 2022 18:13:39 -0400 Message-Id: <20220628221404.1444200-11-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: f11d1d2b-50a7-42b8-29bb-08da595395cf 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: Nz1I6x2JLvPkmIBZ64mGETQ1qcW2dXceBNi6SF1mIGy0qdGMeDpPo/a1k1x/xKoPpXIbE3rDvIn1cow9HkL2PnyrsJxrF5SBBBwUxOseY7qYSj/2ezDQKhJOGYAiNpLoWKavwLpNhE9TKzM/I/z4bJZQPOrRktx3T32XgjKuidHRQlWngSOKWPPFSmEAcsTptEva+pgj8VneD0MydhlaFw2rqEFjSXsytx4N6LWPMyx0dd9m/fko3+g9kT66rBsEyTR36sB/j5IGbTAt1uW9tl3q2eBCxhK+M9ecTU8kISXVKj8ZLKoDJ+ot9/gCE4vhytBLmoCBfW/+zgMuyKmtaNvEV4g2XjbLbZ6Jm4r5wdwFk/3pUT36CxErsrH3AngGuySM8TuVRJfRO9NzYBpd2oo0C+P0bfd6Kr7UaEV0H1Mng2snuUWcsohBnuDGxXkWD3lOyyNWGZ6F+zhAVH/2ktMuewhqvTiG3mLAlCsT4vqSmz/uEuX5brkCpc0VNzRtIWZyvxtSbLuezG0ynUwqeFsmaIT1y3jrWNu10FCWXJ9/9ru7KflxVljbPpwG6GG7gkfdjKl0ik1J3OMyYEziEPeO2R87a7OzeCcpWya4fy7jf26CFxyhZKR+jp1nWQ57IDtZWHpeOHnzcLALJUWQBtrfB4vKpUXxyNbTgkCWoX0v7ok2Pm4VZzMew9QJC206WGeQp6Hh1N0p+s7QdeSDAaHLHRuglniSUjerVDUxxgtnef3YWVhsnQtLP+lqoNE8syFd849RVQFeLl8l1Qdj0lsN63jyj4DTxg9gkEU8STQ= 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)(30864003)(38350700002)(1076003)(83380400001)(86362001)(2906002)(66476007)(8936002)(6486002)(4326008)(41300700001)(8676002)(26005)(52116002)(36756003)(478600001)(66946007)(2616005)(6506007)(316002)(54906003)(66556008)(107886003)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z/PoKoCh5BWDOaZUEoWloY/09ac/Nyi4LVMkO9hOm2r0QQyG01ayMZFVTdG9ILnmw2DA4hB1btAfORlEYBBUkpxHoAoGnkeaQbuKRVwCOz5e5blrNZ1kqUQXg2dfZFDdiHC8UWv/bDSOkVRQdQXCU/2q/yUXEIrDvjX5LkzOo9mF+DHGl2osZD7CdE6OpilWhqgJglfrYVyhYrs1PLhv14K2aiasQShkbYZ+NqT1C15+JlhV0XgySbYiRyXB+a8i9MVaJ8fMn1xQXgvePTlI1ML+Can7vIbOrUVmS7ZDYm8Tez7fOdtESb12GHMI5KZkzaNYzHuNN1W4iFn7C4dZC62E+NwU0NkkPWHQ+aJvm4SD9crSE9H4Ud2FVhWfvCFwF/gzxkGAJldXIr2btLmavlTDCIhrkD7hDKUjpFRYmFLJu5RlntOo6Xi3AbinhF26602R7GEPaX4kuKCgzOEC3g8KrXctHb/dSiNywN7KYlAj1Kby6j53yBJyeSMlDClStuGxCv6LFBdiBe5W7r8+2M/SeRJXJ5tayiZbTr2YbeuzwKpTgiSly22pV0XLRm9YsvPg1FXCdjO2czwJR/zf0hBsqsvNMZi204ywJtWshWbDLTpMtWqPI98DHMYK2Hrrk/V4CSHQ0qX1yA/4z78/X2iVJWGX5VuhHhw2p6DG5/xZF2aQ7WqEkuROtIz4Uw4HGwZrNAtUd4uWfhaX/D1BCDbV+4LcwygEPrzZUHcX5ms2h3E6dekmFXM6wgMXGpuchGcf4saat3QFSn7S8wH1A3WhieSkAw7lKYCzo0rh3r6yD+6gEM9lrn23smMoLrwWY1H4DhuVDa0NSdj8dIA9Mt6GwHZgqC/sahx7KyrfN09UUo/z/39kpuf5tMyaD2QE1mF4ncGLMO45aklA7ry8bUXuCs3N2YWRll4BogqtRCQvdza/zN+kc2JB9sR2ci6swT6qzrOpdwi48wL/VpfhlNgcfP5/NDz+E4ElzY9y5wUX56i3+wWSd564ez9Bvm+uavKjGRGunDOIE9aDkm+Avg7qfcAqR0ewhaA/wE1xeEQT5V1ykl7/SaVojyiLzO+AuYSuEhIHl/pH71VT7XGl7X1Qi8z+AtjYyj9CYTC1Vh3tvgDxAHjAcLlOpF1WvvAYCefVKb9FYiXosWFL92vcVZpxGEQxVE8iGfyq0++t2/NLjhamtkTeKxwuOMaeVJpxmViYdnczrUOCj0I8Mdsl83eEXKI1VPCeNq9RRaMF2O3Y9k/9LMiauOYkuxdCyd7IeDXoB+kD/FHnEayLqyjpLsQ+SekBUQDKHB3fGYFE87MmpB2ieNeB2Jhje09hoGD6TpabjMAAK5g5a4xOFJlqiyl7XzXhgEefOSBFxaqGpyQ8fkDUNQLGRilpvErTKzAZbwjijxX7sGttieTD91GTv+99yPjT2fOXrXJRWzz6I3R+XwmLUAUaewcrK+UXFghegTTCS1xbf8IWIJ6J+l+N/ujtsUAx0uVpSh03Zhy/qy7rBHDT13s2+k1nOt2dTVAAXlN9xVCx0dNKyk8OX0PO546o6TTjBnGDNmOnyswGuk+bikPhHFywLo0TTLtKHeYYTQGDFVYISGF8LLVrrKyBhQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: f11d1d2b-50a7-42b8-29bb-08da595395cf 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:35.8292 (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: Dh9AuNVuhMQwbK6m59KCkxhHg+yNqsNXQtXpF8th6hUEJr8vS3bc9kaK10a2Fc3m5lcegxAX4OLz6PKrp3chwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151448_045641_D9558BBC X-CRM114-Status: GOOD ( 14.71 ) 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 Instead of re-matching the compatible string in order to determine the init function, just store it in the match data. This also move the setting of the rest of the functions into init as well. To ensure everything compiles correctly, we move them to the bottom of the file. Signed-off-by: Sean Anderson --- (no changes since v1) drivers/net/ethernet/freescale/fman/mac.c | 356 ++++++++++------------ drivers/net/ethernet/freescale/fman/mac.h | 1 - 2 files changed, 165 insertions(+), 192 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 0af6f6c49284..8dd6a5b12922 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -88,159 +88,6 @@ static int set_fman_mac_params(struct mac_device *mac_dev, return 0; } -static int tgec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) -{ - int err; - struct mac_priv_s *priv; - struct fman_mac_params params; - u32 version; - - priv = mac_dev->priv; - - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; - - mac_dev->fman_mac = tgec_config(¶ms); - if (!mac_dev->fman_mac) { - err = -EINVAL; - goto _return; - } - - err = tgec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = tgec_init(mac_dev->fman_mac); - if (err < 0) - goto _return_fm_mac_free; - - /* For 10G MAC, disable Tx ECC exception */ - err = mac_dev->set_exception(mac_dev->fman_mac, - FM_MAC_EX_10G_TX_ECC_ER, false); - if (err < 0) - goto _return_fm_mac_free; - - err = tgec_get_version(mac_dev->fman_mac, &version); - if (err < 0) - goto _return_fm_mac_free; - - dev_info(priv->dev, "FMan XGEC version: 0x%08x\n", version); - - goto _return; - -_return_fm_mac_free: - tgec_free(mac_dev->fman_mac); - -_return: - return err; -} - -static int dtsec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) -{ - int err; - struct mac_priv_s *priv; - struct fman_mac_params params; - u32 version; - - priv = mac_dev->priv; - - 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) { - err = -EINVAL; - goto _return; - } - - err = dtsec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = dtsec_cfg_pad_and_crc(mac_dev->fman_mac, true); - if (err < 0) - goto _return_fm_mac_free; - - err = dtsec_init(mac_dev->fman_mac); - if (err < 0) - goto _return_fm_mac_free; - - /* For 1G MAC, disable by default the MIB counters overflow interrupt */ - err = mac_dev->set_exception(mac_dev->fman_mac, - FM_MAC_EX_1G_RX_MIB_CNT_OVFL, false); - if (err < 0) - goto _return_fm_mac_free; - - err = dtsec_get_version(mac_dev->fman_mac, &version); - if (err < 0) - goto _return_fm_mac_free; - - dev_info(priv->dev, "FMan dTSEC version: 0x%08x\n", version); - - goto _return; - -_return_fm_mac_free: - dtsec_free(mac_dev->fman_mac); - -_return: - return err; -} - -static int memac_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) -{ - int err; - struct mac_priv_s *priv; - struct fman_mac_params params; - - priv = mac_dev->priv; - - 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; - - mac_dev->fman_mac = memac_config(¶ms); - if (!mac_dev->fman_mac) { - err = -EINVAL; - goto _return; - } - - err = memac_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = memac_cfg_reset_on_init(mac_dev->fman_mac, true); - if (err < 0) - goto _return_fm_mac_free; - - err = memac_cfg_fixed_link(mac_dev->fman_mac, priv->fixed_link); - if (err < 0) - goto _return_fm_mac_free; - - err = memac_init(mac_dev->fman_mac); - if (err < 0) - goto _return_fm_mac_free; - - dev_info(priv->dev, "FMan MEMAC\n"); - - goto _return; - -_return_fm_mac_free: - memac_free(mac_dev->fman_mac); - -_return: - return err; -} - static int set_multi(struct net_device *net_dev, struct mac_device *mac_dev) { struct mac_priv_s *priv; @@ -418,27 +265,15 @@ static void adjust_link_memac(struct mac_device *mac_dev) err); } -static void setup_dtsec(struct mac_device *mac_dev) +static int tgec_initialization(struct mac_device *mac_dev, + struct device_node *mac_node) { - mac_dev->init = dtsec_initialization; - mac_dev->set_promisc = dtsec_set_promiscuous; - mac_dev->change_addr = dtsec_modify_mac_address; - mac_dev->add_hash_mac_addr = dtsec_add_hash_mac_address; - mac_dev->remove_hash_mac_addr = dtsec_del_hash_mac_address; - mac_dev->set_tx_pause = dtsec_set_tx_pause_frames; - mac_dev->set_rx_pause = dtsec_accept_rx_pause_frames; - mac_dev->set_exception = dtsec_set_exception; - mac_dev->set_allmulti = dtsec_set_allmulti; - mac_dev->set_tstamp = dtsec_set_tstamp; - mac_dev->set_multi = set_multi; - mac_dev->adjust_link = adjust_link_dtsec; - mac_dev->enable = dtsec_enable; - mac_dev->disable = dtsec_disable; -} + int err; + struct mac_priv_s *priv; + struct fman_mac_params params; + u32 version; -static void setup_tgec(struct mac_device *mac_dev) -{ - mac_dev->init = tgec_initialization; + priv = mac_dev->priv; mac_dev->set_promisc = tgec_set_promiscuous; mac_dev->change_addr = tgec_modify_mac_address; mac_dev->add_hash_mac_addr = tgec_add_hash_mac_address; @@ -452,11 +287,121 @@ static void setup_tgec(struct mac_device *mac_dev) mac_dev->adjust_link = adjust_link_void; mac_dev->enable = tgec_enable; mac_dev->disable = tgec_disable; + + err = set_fman_mac_params(mac_dev, ¶ms); + if (err) + goto _return; + + mac_dev->fman_mac = tgec_config(¶ms); + if (!mac_dev->fman_mac) { + err = -EINVAL; + goto _return; + } + + err = tgec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); + if (err < 0) + goto _return_fm_mac_free; + + err = tgec_init(mac_dev->fman_mac); + if (err < 0) + goto _return_fm_mac_free; + + /* For 10G MAC, disable Tx ECC exception */ + err = mac_dev->set_exception(mac_dev->fman_mac, + FM_MAC_EX_10G_TX_ECC_ER, false); + if (err < 0) + goto _return_fm_mac_free; + + err = tgec_get_version(mac_dev->fman_mac, &version); + if (err < 0) + goto _return_fm_mac_free; + + dev_info(priv->dev, "FMan XGEC version: 0x%08x\n", version); + + goto _return; + +_return_fm_mac_free: + tgec_free(mac_dev->fman_mac); + +_return: + return err; +} + +static int dtsec_initialization(struct mac_device *mac_dev, + struct device_node *mac_node) +{ + int err; + struct mac_priv_s *priv; + struct fman_mac_params params; + u32 version; + + priv = mac_dev->priv; + mac_dev->set_promisc = dtsec_set_promiscuous; + mac_dev->change_addr = dtsec_modify_mac_address; + mac_dev->add_hash_mac_addr = dtsec_add_hash_mac_address; + mac_dev->remove_hash_mac_addr = dtsec_del_hash_mac_address; + mac_dev->set_tx_pause = dtsec_set_tx_pause_frames; + mac_dev->set_rx_pause = dtsec_accept_rx_pause_frames; + mac_dev->set_exception = dtsec_set_exception; + mac_dev->set_allmulti = dtsec_set_allmulti; + mac_dev->set_tstamp = dtsec_set_tstamp; + mac_dev->set_multi = set_multi; + mac_dev->adjust_link = adjust_link_dtsec; + mac_dev->enable = dtsec_enable; + mac_dev->disable = dtsec_disable; + + 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) { + err = -EINVAL; + goto _return; + } + + err = dtsec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); + if (err < 0) + goto _return_fm_mac_free; + + err = dtsec_cfg_pad_and_crc(mac_dev->fman_mac, true); + if (err < 0) + goto _return_fm_mac_free; + + err = dtsec_init(mac_dev->fman_mac); + if (err < 0) + goto _return_fm_mac_free; + + /* For 1G MAC, disable by default the MIB counters overflow interrupt */ + err = mac_dev->set_exception(mac_dev->fman_mac, + FM_MAC_EX_1G_RX_MIB_CNT_OVFL, false); + if (err < 0) + goto _return_fm_mac_free; + + err = dtsec_get_version(mac_dev->fman_mac, &version); + if (err < 0) + goto _return_fm_mac_free; + + dev_info(priv->dev, "FMan dTSEC version: 0x%08x\n", version); + + goto _return; + +_return_fm_mac_free: + dtsec_free(mac_dev->fman_mac); + +_return: + return err; } -static void setup_memac(struct mac_device *mac_dev) +static int memac_initialization(struct mac_device *mac_dev, + struct device_node *mac_node) { - mac_dev->init = memac_initialization; + int err; + struct mac_priv_s *priv; + struct fman_mac_params params; + + priv = mac_dev->priv; mac_dev->set_promisc = memac_set_promiscuous; mac_dev->change_addr = memac_modify_mac_address; mac_dev->add_hash_mac_addr = memac_add_hash_mac_address; @@ -470,6 +415,46 @@ static void setup_memac(struct mac_device *mac_dev) mac_dev->adjust_link = adjust_link_memac; mac_dev->enable = memac_enable; mac_dev->disable = memac_disable; + + 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; + + mac_dev->fman_mac = memac_config(¶ms); + if (!mac_dev->fman_mac) { + err = -EINVAL; + goto _return; + } + + err = memac_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); + if (err < 0) + goto _return_fm_mac_free; + + err = memac_cfg_reset_on_init(mac_dev->fman_mac, true); + if (err < 0) + goto _return_fm_mac_free; + + err = memac_cfg_fixed_link(mac_dev->fman_mac, priv->fixed_link); + if (err < 0) + goto _return_fm_mac_free; + + err = memac_init(mac_dev->fman_mac); + if (err < 0) + goto _return_fm_mac_free; + + dev_info(priv->dev, "FMan MEMAC\n"); + + goto _return; + +_return_fm_mac_free: + memac_free(mac_dev->fman_mac); + +_return: + return err; } #define DTSEC_SUPPORTED \ @@ -546,9 +531,9 @@ static struct platform_device *dpaa_eth_add_device(int fman_id, } static const struct of_device_id mac_match[] = { - { .compatible = "fsl,fman-dtsec" }, - { .compatible = "fsl,fman-xgec" }, - { .compatible = "fsl,fman-memac" }, + { .compatible = "fsl,fman-dtsec", .data = dtsec_initialization }, + { .compatible = "fsl,fman-xgec", .data = tgec_initialization }, + { .compatible = "fsl,fman-memac", .data = memac_initialization }, {} }; MODULE_DEVICE_TABLE(of, mac_match); @@ -556,6 +541,7 @@ MODULE_DEVICE_TABLE(of, mac_match); static int mac_probe(struct platform_device *_of_dev) { int err, i, nph; + int (*init)(struct mac_device *mac_dev, struct device_node *mac_node); struct device *dev; struct device_node *mac_node, *dev_node; struct mac_device *mac_dev; @@ -568,6 +554,7 @@ static int mac_probe(struct platform_device *_of_dev) dev = &_of_dev->dev; mac_node = dev->of_node; + init = of_device_get_match_data(dev); mac_dev = devm_kzalloc(dev, sizeof(*mac_dev), GFP_KERNEL); if (!mac_dev) { @@ -584,19 +571,6 @@ static int mac_probe(struct platform_device *_of_dev) mac_dev->priv = priv; priv->dev = dev; - if (of_device_is_compatible(mac_node, "fsl,fman-dtsec")) { - setup_dtsec(mac_dev); - } 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); - } else { - dev_err(dev, "MAC node (%pOF) contains unsupported MAC\n", - mac_node); - err = -EINVAL; - goto _return; - } - INIT_LIST_HEAD(&priv->mc_addr_list); /* Get the FM node */ @@ -782,7 +756,7 @@ static int mac_probe(struct platform_device *_of_dev) put_device(&phy->mdio.dev); } - err = mac_dev->init(mac_dev, mac_node); + err = 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 e4329c7d5001..fed3835a8473 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -35,7 +35,6 @@ struct mac_device { bool promisc; bool allmulti; - 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); From patchwork Tue Jun 28 22:13:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899079 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 41299C433EF for ; Tue, 28 Jun 2022 22:23:35 +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=ennwvZ/Grmp8h5TvmeRO3Lz9tSiaijSpVahhkuhIdH4=; b=avG5s4m7qwY4Xa rO1klPhbbOGu/hOciYfTkesxpcs8z1sv1aeK3vAlw8xg9lEkzmaLqwUWSQi79r55ErLfOz2M2uxDx VmUxlDBYkZzwyzWDtUeRgK3u3stISSdKPKxCRkQKxH8S3yPTAqqCEHKuQ9X+8TtwuUf8TYLmPHAZV vTW097w74qIgAgVQL9hZ+E/wwUnhOcFvKycRYmVp6W3viWgNisIpUdLic3BGbq/WxcpijI4m/nwmK DGAZec0ELaijrxvDKpUn16E/dYHqXmaPh3K7FLDPrxCeHSi5Xbie6REAEpAjdNVa3cP+cgUaMSP2B ombxx1b4rWo3uFPk39OQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6Jb1-008P3u-7c; Tue, 28 Jun 2022 22:22:12 +0000 Received: from mail-eopbgr80074.outbound.protection.outlook.com ([40.107.8.74] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTr-008MXM-Ty for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BH2eshoTsQAkxtw08eE40J5LEZyz+fJfr6vJCJoej2FD1KDVeiFwhxQgyah73l+AGnFTgbapwTpdDJLnhu/dwsd9nOPgL5lDX3/t+gE5WoEj41qHbtOpJDXain6u+h8BtAd1eb0yDaSzoJkIsFrQUxD/p4as+SK20R5XAJq/W1YeWfbzVvJFKJgCLxXfV1dU+c2e3SMawsOo/157t1kxJhieUHu4gShOjNfJQo8y6gPBLgG2rUv4nrPdnbGy3jj5YKpyDaUs5VVl60q3CTOyg4p7wJz7oXHKcRdkodjvJKIBKLunDyQZXLlWu9K/aGOnAn2alAaWZPc6C/Hgl9teCQ== 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=oUrfFcuevg9QB5iLWVeqewSedYp3yYzXMgy6YG9oZBw=; b=W9zdKlkBlbzEIwx6Vf42toLlYTLL4ATF6le4RVOtpk+h/64+GZvsPIZqFWOT+wuRaOkLmzkqXDxkN5IDjV3HvLq7X0vgDRFbk6qfdWdTd+I9I1jhSdCxZfz18E1zY+vcffF290CazvIiGH1EYsKVtmjcWFLkt2GKyWZ32khSxeQyzBceQd4U1zP7rTPmFFreEgFE7uuGEvnpzSeBpEPozGvj4c1U5FUuPZ3uXXxefOLutZZwtuSlIPJ8QzqyHCz4kvyZy0UAXl7Eq7D/EA9ITJ0HkcCDOMRUQsbv3FeHhRD1v2PMx4DEiur2iNxJ7ULlADWazEjnRhYUwYHRbOzmuQ== 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=oUrfFcuevg9QB5iLWVeqewSedYp3yYzXMgy6YG9oZBw=; b=RkAMXvYuGk7fKA0NAM03IhPXgbh2RcrPthlk/ydncHfwBY3tMH8gmkJMG3H/cuWxhdG00acja6963iZJg20rX40hSINBWhIEpRTocDBYQ/EXWVGoM0ZsWau4IpVZMueGGnw4WsSelUGagSKgWSzjJPQL3RdXn0Gpgt1VuzOsQ3lAif5gu5KVgyOTawD9s12LhWCOSJrlUVEBpJYw6yGXE6eMvj1Tr7U2Ir3trQJfeZ/E+EB2h9rvK6ZdrYgw1SWAnM4qLRhC3cLeHPalxvrAI59Xfrwl5/NqtOiGolHxtajm5+dEEjW0LSAPLAP/DS0a/DgFUifeGqfpJ089XaSS0Q== 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:37 +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:37 +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 11/35] net: fman: Move struct dev to mac_device Date: Tue, 28 Jun 2022 18:13:40 -0400 Message-Id: <20220628221404.1444200-12-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: 9c671edc-0677-46db-7e4d-08da595396aa 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: 6x+JpDhGMxPZ2NLd98i2UOSpdFPFtPBdJmC5dKhxmlkRIn1PkBWMftwQ+nit5Ikv87SMsdQbpRy3POM6gJlg+kWHDs5Mr/jrc5uWewlZdb0lGMWZ80AkkzRn/WOZArSFuFUZlJrEDI3ZnI6wt3+2DMsxYcjbpqSHH7BSE6yF8oR8Pws47Thkw1g18xY7IxAQPxZdO9spLRiWgOoZxKrqrl/8/zRytVcqYc36EwwRqE+s9GjOZJ8/SL15pPytfUWOpFrPlFRCtc5UDZC0nrqsYj/nXeP+5bBa8W9lQZR10PQ5fc+vfcWeI+ighSE0XQj+ODOAEdlP76MtDWAhG4RsdYuJUPumF/RcqXnLFkkYGXC4QHCy2TiTiYqIDHvQODuSmu0EVZ8qMA43i2gHoFMD0yTubI42T39si4QMxjZJqE2QwFjd2lC6Ob9pW04VMuHH1NWHidQhmJRGey/nejh/9h0KMhkxYdCoQV/FtHQ1P2CbeXgH54SNGKyN11/uW5vvPQOuiZfcx7nION/t4SNGLRzMlFsOylULpEPtJOR1+7qlT7CRMXnskW4qK7ptnQ8FeK1St+R7LyUj2hxbhVrtDTP83h246FzELTJfniAv9hbqHlQvVKRb/0M+x+Q6qCOfc0sSJ9C8mIZriONduUcVqnZzwBPL5/NdMrSnxZz71BsEJD5l0D1KhT2Ue6xfuciSpqEHJxCN6UP7H+OGODSHOzh2jDhNcChK5k9c1XXvF0i+C6gwKCH+d3y44ZNGYOXELqkYMh/chSoiuTMub9O+15Y1qc8V0wQBZU5IEzBjq1Y= 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)(6666004)(186003)(38350700002)(1076003)(83380400001)(86362001)(2906002)(66476007)(8936002)(6486002)(4326008)(41300700001)(8676002)(26005)(52116002)(36756003)(478600001)(66946007)(2616005)(6506007)(316002)(54906003)(66556008)(107886003)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mpHJk+8fAu6wELwsTu1DeQrobsJx3l70/tsVgTu0oWPYVMRnMzERETvGgCNAyQcOXKGI2nbhsPwa1BD6DDC9Qg6NqsxT6Yxae2Y+L/6JPAopr6Rtmy9eWKcVHINANVQjc5nFoHBixV/u25kLw0fJ+FWLiNSopO4diunC1TsWEuzqHgC9pdkfSTzoLJrFshfeYfUSrSYBxLUtdcbSJFcIR6dQWbKJJCfydO2ytJ8fOvdxr+CeaKT2/BNVMGYwjXLtTYe5/tN9IpZOvKoY6pesgFSJZC1043IPQZn4HTCc1xLlJurfNpn01XQ8iuVw6p1jOcyjLRrhCGzDOAKHApn3y3trJVKL0xMp4gkY1QGu1a1dLc9TsNB75u7C3OMJvHqpOCHguVLzDeILZbDQ+3Bz5QS0TjlMU9ru66o1HiUmt2+CrBlvMh88a6H+CgaVvgqXoHdudnmtPwZOwNugUYS/6BkmcRK6pSapPumZ/kQysQ0PYoMlhJtb8SRtbyIzjgUktn/5fmJoALari0A1r02YyCi21RogrGMK0JOemEOVMVfFms9My36UnK3wPhRZy0V33R6rCKGlMPaqlPUmjInZ5aEhPErxIkAVZvOmw7MOJO5fUAX9G2UqnlGwwl8wQkmdwBnIYX7C9MCV5Ka4izVYgMnIP84a3brsiUWtxi7Zuz938dk9NPa8FU1WM5sbU3wwym8oMhN5hSstmGOv2SU0GV1C8hZbi6UBMwnGI8ShBt5JmU5h7r/RlMOwlnHoatQw2LjMTlP1TEqrDxHtP826cFHMar39pXuXI+wPAtejxokb0O2M7hmARg3OOQxIgsYtyhxXR5sjSa4YZ9z+kAErqQnjIQJFRK4EHcJ7tR2LE7hu83LIUxDltkTYo5yhDOHRQQfIhDUk5TMmqI6hEtq2TMD13a0iGF/6hxQwOYqcVWuQLwGKhrckrdWdEO2nZQJgoZEhf3UKOMuMxaSr+ediZrFUA/5X4GtsgIQYorRPPRrQUT93V7kmN/gQJd7AxEDEuXbZ3WmWduEo4iik61egrGEIOtSHwUHiFrDkJu0DHDEj2T/Wc95ELJNyCHZbZ1SzEoB9JMsHgF5QmLfaEDt+aQ+aPHwDeGWbXg8komijCKU1M0gDMKvsnV2btK3sXAw5kepnbXN5aB/eJbqF5gfT21LwLB1R4EJTnlB0ygtY/PoHkmoCQKWGwH8J8mIYRbAAyDwnkyDlJf36ipX6azqhqzcIVCre12TOujaGa0a7IYVJ5ES9hUO81x97m6VXxD4pbdBAJvdCb7uJLRx5nS0WQyDo700BE+VDYcrHvNEund35uhRVELmzZ18vC3rIGDYFvqlelFjKNzQhyzcIDNOfKHXx8oXwBtH41K0ZOIGCt1eeprgJzDnUNTxcKjpuWt45vtlQB3eYUsmM587Ud0Xtiz0J0YZAZljklJ0T5H42WVjg0FDNCXz67U6JeT8xXjhqtS0Tk38I334gSUXHz97upjNetRob0nb2wDZ9WHStJfDl6i21qLKxgW00wHaLeVTbfY1oZkIQ8jTqqHo94AWnw6AdMFG8YBDevUcc4ryXYCfBdo2+7AMYosh48YrlgmspOoUy4DqdbIMDU355tSJ5Fg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c671edc-0677-46db-7e4d-08da595396aa 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:37.2822 (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: wXoVaF32tEZ/h2KoPyXTiKAMnV8OTmBWJAiyqr7/JJevCPBFg9JBdOQUZRX/HTdM3o0ZTtTZL6OiH3OtJJm5oQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151448_082167_CF93800F X-CRM114-Status: GOOD ( 15.12 ) 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 Move the reference to our device to mac_device. This way, macs can use it in their log messages. Signed-off-by: Sean Anderson --- Changes in v2: - Remove some unused variables drivers/net/ethernet/freescale/fman/mac.c | 31 ++++++++--------------- drivers/net/ethernet/freescale/fman/mac.h | 1 + 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 8dd6a5b12922..5b3a6ea2d0e2 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -28,7 +28,6 @@ MODULE_LICENSE("Dual BSD/GPL"); MODULE_DESCRIPTION("FSL FMan MAC API based driver"); struct mac_priv_s { - struct device *dev; void __iomem *vaddr; u8 cell_index; struct fman *fman; @@ -47,20 +46,16 @@ struct mac_address { static void mac_exception(void *handle, enum fman_mac_exceptions ex) { - struct mac_device *mac_dev; - struct mac_priv_s *priv; - - mac_dev = handle; - priv = mac_dev->priv; + struct mac_device *mac_dev = handle; if (ex == FM_MAC_EX_10G_RX_FIFO_OVFL) { /* don't flag RX FIFO after the first */ mac_dev->set_exception(mac_dev->fman_mac, FM_MAC_EX_10G_RX_FIFO_OVFL, false); - dev_err(priv->dev, "10G MAC got RX FIFO Error = %x\n", ex); + dev_err(mac_dev->dev, "10G MAC got RX FIFO Error = %x\n", ex); } - dev_dbg(priv->dev, "%s:%s() -> %d\n", KBUILD_BASENAME ".c", + dev_dbg(mac_dev->dev, "%s:%s() -> %d\n", KBUILD_BASENAME ".c", __func__, ex); } @@ -70,7 +65,7 @@ static int set_fman_mac_params(struct mac_device *mac_dev, struct mac_priv_s *priv = mac_dev->priv; params->base_addr = (typeof(params->base_addr)) - devm_ioremap(priv->dev, mac_dev->res->start, + devm_ioremap(mac_dev->dev, mac_dev->res->start, resource_size(mac_dev->res)); if (!params->base_addr) return -ENOMEM; @@ -244,7 +239,7 @@ static void adjust_link_dtsec(struct mac_device *mac_dev) fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); if (err < 0) - dev_err(mac_dev->priv->dev, "fman_set_mac_active_pause() = %d\n", + dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", err); } @@ -261,7 +256,7 @@ static void adjust_link_memac(struct mac_device *mac_dev) fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); if (err < 0) - dev_err(mac_dev->priv->dev, "fman_set_mac_active_pause() = %d\n", + dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", err); } @@ -269,11 +264,9 @@ static int tgec_initialization(struct mac_device *mac_dev, struct device_node *mac_node) { int err; - struct mac_priv_s *priv; struct fman_mac_params params; u32 version; - priv = mac_dev->priv; mac_dev->set_promisc = tgec_set_promiscuous; mac_dev->change_addr = tgec_modify_mac_address; mac_dev->add_hash_mac_addr = tgec_add_hash_mac_address; @@ -316,7 +309,7 @@ static int tgec_initialization(struct mac_device *mac_dev, if (err < 0) goto _return_fm_mac_free; - dev_info(priv->dev, "FMan XGEC version: 0x%08x\n", version); + dev_info(mac_dev->dev, "FMan XGEC version: 0x%08x\n", version); goto _return; @@ -331,11 +324,9 @@ static int dtsec_initialization(struct mac_device *mac_dev, struct device_node *mac_node) { int err; - struct mac_priv_s *priv; struct fman_mac_params params; u32 version; - priv = mac_dev->priv; mac_dev->set_promisc = dtsec_set_promiscuous; mac_dev->change_addr = dtsec_modify_mac_address; mac_dev->add_hash_mac_addr = dtsec_add_hash_mac_address; @@ -383,7 +374,7 @@ static int dtsec_initialization(struct mac_device *mac_dev, if (err < 0) goto _return_fm_mac_free; - dev_info(priv->dev, "FMan dTSEC version: 0x%08x\n", version); + dev_info(mac_dev->dev, "FMan dTSEC version: 0x%08x\n", version); goto _return; @@ -446,7 +437,7 @@ static int memac_initialization(struct mac_device *mac_dev, if (err < 0) goto _return_fm_mac_free; - dev_info(priv->dev, "FMan MEMAC\n"); + dev_info(mac_dev->dev, "FMan MEMAC\n"); goto _return; @@ -507,7 +498,7 @@ static struct platform_device *dpaa_eth_add_device(int fman_id, goto no_mem; } - pdev->dev.parent = priv->dev; + pdev->dev.parent = mac_dev->dev; ret = platform_device_add_data(pdev, &data, sizeof(data)); if (ret) @@ -569,7 +560,7 @@ static int mac_probe(struct platform_device *_of_dev) /* Save private information */ mac_dev->priv = priv; - priv->dev = dev; + mac_dev->dev = dev; INIT_LIST_HEAD(&priv->mc_addr_list); diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index fed3835a8473..05dbb8b5a704 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -19,6 +19,7 @@ struct fman_mac; struct mac_priv_s; struct mac_device { + struct device *dev; struct resource *res; u8 addr[ETH_ALEN]; struct fman_port *port[2]; From patchwork Tue Jun 28 22:13:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899081 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 E7056C43334 for ; Tue, 28 Jun 2022 22:25:06 +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=bpDk+lURYOVXhrsQbHLqiOKnb0bgL+0LsM/V2YDzXI4=; b=ebSo6YbXMytg8b hKKQTxpUgX32mITOEAkry4QzoPb+Wxms53fee8JhuUoBpNbplEoTogj3R7iWywwmgn/5qwPt/5c+m xV3FbzVzXebTFqHJoS7CnQUomR5soiaZS+lrq37rQbWklHMutOHjUHWVoUqolZEJQAHiucXSloPdM vBfKQBOYHAb0tdbIttAX5D+Myzgj/AQZHlQnMEAtC87uoleq3yhwEf0geUsyAuhlfpkFaAZs/znWq knf5IjJwzCVl1jhiF22jgZgre5nTkfvZb64BNwMHXetEsUG/bD91HzaOxISNmQp+TYugwhhUlKToq j99ddYE7V6XC2jXmJw4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JcV-008PUb-5j; Tue, 28 Jun 2022 22:23:44 +0000 Received: from mail-eopbgr80074.outbound.protection.outlook.com ([40.107.8.74] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTu-008MXM-47 for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i2MRVxC8B/kVzlB5u5Zd4j5N9fLqF8vW6JAYmA/RACVAywUeqBBYneSDlGigvsoQRhIOWf/unb8ZHc78ZjXqYABHd5fj53WkEMXFoRQRaw/2gbedcjuDu8VbqfVZVbQQWc9JGmzIm2wIi5Ifa3+s7NZ5StqCy8cbKtR5QtmgQUod0Q8IiVHAfWic4FZnC4vWNA3CUDph7l9dZCN0QEqAb/bJ8fNlp+sLFLjUPiTkBvAI7caDXRaBSlxOnTagEvOppk4ka84UtU+FmapNCFeK/uzTB69pzhczgkjlgkqcVwLkk9SSSdNBV6WJPLQjhR8hXmP1jcNDSzMOkB5kZLVqcg== 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=X8nna6V9FR6z3TQeYzJFwbNUncpaCJL9LdjjV9RUVos=; b=IRlTL3bfB9/ikfYqHF5G/woeRB5vklsD3OHhAb1ObDfMmav1JyuYzv7RiRLUD2nmGjzcJIKpHKGDkis2JcYmm0cAKFKZN4nyDEzAn/9D6iXwB7jZEbge3yOMvzNY79KkrwLf/AYn6XPkVaJIeEuDpZot9hlEiwnMAmhPGe7MU6wiORxVfSRDE+P5c3l1ld68cN3tmKtqpNCaYvlGHhbQQTI2WTCMcpTd3yhxj7M6/FzkmLkJe+9ckJIyk3D0RGB9YgLQxQMSlX6eP6OGqww06F7uhe0t2U4eKYJ6ve1h8YiJSxIfo2QMdW9E1FdIeTRv4bAuPxrMHuj2H3u2PVcO9w== 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=X8nna6V9FR6z3TQeYzJFwbNUncpaCJL9LdjjV9RUVos=; b=19Ehu7mGKGSBbyXXcv20Qt7UryJjHiMCv09yv/9wYKmRODjlEfDTh6OncMDlbxt0ee4sETtSU+6Qtg5ns1vsi3hKHaitewMyDiYcz5lHWlIdEA2AP5F5S4z864ZUrhVjg/o69N2zxo3C5VlCUsaf8q1pf3Os0IVTSPV0MZtqIWrSAVm/W72CB70+M10hn+MTSvV+IiCs4mmFyIxqg9fjlmIrtRhU/hNRlSe2HPg77JYyP549TDJnCjwlTmplaniffdkg9L3RYb0MlqPO+YjWc1xUt2JKyT0joTLmAaVhYp8TL0QWCu7bC7NAS6YZoSusdJAiQWdnd8hV8ehxG+KMHQ== 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:38 +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:38 +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 12/35] net: fman: Configure fixed link in memac_initialization Date: Tue, 28 Jun 2022 18:13:41 -0400 Message-Id: <20220628221404.1444200-13-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: d53fd346-fb90-43dc-d2d2-08da59539785 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: LXTaf84QeaR6lhGyTQjE2vRCHT65b4+eT6zlIzqm/ucXQsGVD5C/uq8ZjM8Utz7J6Y0WaAFSIckB/pB9phvVlEEx9R8OmeTlaXYXiW1nT6NYz8oX5yRHhqbuznKneb7x1amisyvowYWzmZfgbjihO+HRfrhZ+K8FR+e9kXoCdLFB8LsWyw4oNTi2jXRjSu+jPNMmEgj+wRJ51UWvxPgFH7YJpCoSb8Bxk7bQFRBMUh83S9vEvtIDhPOJTs6ID9mcXmSZmJ3uOPDwutpRItGRJC6QLfhbVQSCbSHHP5tvnYx5W5UH3oNtEkJPJ8cYN1Y+bTkufAWRKFFCLYyZK3Ml8lPLFAqJCV6R9K5cXcsjgSYGxI678EfFKSO+uDHhMzBHF70IKdVvJYEsLRYlqd6lh0Ke+Ixz/lBnZbnWkVK6/okLjBMFfcKHI+HE/JHA1arYbXjKGy7dOYu2t5OzUJAXFgnOnWRkVGOQ38h8E86/mEA2le+u+Xmh18Ap8L4QQhucglQM3mAnBYpcFf+o6xj7sJXMAxdDwr6Qf1DeItgtN0Eexvl+hOLldI9jLI4RvLcx2VvWNSmt3f9cR3Pz6VQ7oI6KCkQFzYm8t1+VA/3z6jV+XpbWBZDZMkO2DmPxELpy/rJ8sxylFrpCVcgjn1ok3ixwfpxUjK/UjwXX93mmfBbE+5aS2vumfABDFP/GuQTgNiUiXjYC87/PtfLXskhtv5L45MvPIwgJgmFTOCtkTHI63YjDEKsVmd83zGYMCrzTooBpdzRO160l+dXL9zpHuvoTB5SrSbM1+MAPLar+Oqs= 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)(6666004)(186003)(38350700002)(1076003)(83380400001)(86362001)(2906002)(66476007)(8936002)(6486002)(4326008)(41300700001)(8676002)(26005)(52116002)(36756003)(478600001)(66946007)(2616005)(6506007)(316002)(54906003)(66556008)(107886003)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Koztm8CvIUEEgMPx3OpRojyiCKaIytZTDXAXO8i102K6XHtf3SO0wOifm8uk3liOHOVYGSkh4AOkjVPg9JkyGJehlXC+qjkFb4ikx3QeOBIVe5qAyWWi9h+KhCBpFfA9C7W/tXQX0Eu4fYjU1uOjEyVGQVV0Ve/III2pNl/9hlNWcKO2WMEirAT8eks2L6tBqtz4r7PQBcFzFAyTYjgtlLISlsCE6+976b8PWcuTHadMptplqwVE4d30t8Ff/lghibkIiOJTrSGWxeh7Vfn1gSKUvhV3mf19vaL6SJHU1cHnnRvZsCS6lWiUm5GXXuq5yqdzBkMtvmjmnJZugKrRxAn9gybTZOabDzLBbJmkHL4onfZ7q4LmS9kecBM48WqbDgVjj9STxt8/iX2BS7ePDQEiOH2RpqNDwJ2p+DlXQ9K8Od3Ylxcu+4//0pBKPineQ/0MiD0LGMdf6nYNfqB1TjvqUJzFnImUGKOqbkiUOQGyBFXf2bUdnXklAKowVRj9EdTM1DSxpIaRSNF+u0KD+sPrXbXtpVRK1I6f8Yw8Muz0molxFtluTnhdIr7B8oyIY4mGfyvL2EeRevw8kz8mGTcFDpuYEOQLTvNORQOjpiKfjveTm4U6T56W79H2kik6fvM8GI+yaCPlcm6XRsqDQDjvqmcLxi9uX+tboTh/MDKxRZqRX1JBUE1dZrCRJsHEor0Z/jfIIUL19uVezX3LmCLOYKrxEd67zHQvZfVdX+s/rE3lKOOfqYVaF55MB86x0mhbR0yxDnHhgWXNQH5wcQkRl523uhU3T00PjPZhNGvnak+06OkXwjhw3zLyA4p/bfF863nSfP8q7x95Njhta4qvcBsXVaUY1K88sUN9JXzKUoZC9oCsu/J9rKSpfRHCeoFs7nDC+bg/2V1+ucBltbZOyzs5+WyAzijrtK9imQdtm67eYTly0p+BL9wVAkHNU0zGKnUDKPh8HGLEvvfCfxRe5K9gPv/XfLD/aBQ0lxCPds4LfvkitSDGwAAE0oQ/EObHlYoniGbAFyGC2VQOxyKWeck+4zVltA1LvsPE3OXaQn5s/dvMZ0CGHlsC60R7GgYzAbuWzYWufJaEkvbeRcIfztO55gpK1blO3w7UlTtXeDRROmzE/VhZB2aW/k5KSj8SU4HWov75r+DzmX0wGQStjeURN9PYCUvbpqJogkA3GS4RCGCb5Qeu25dYGxvBUBrf9N3H17IPb76pSfDguX5ok3YW9ZmMP7AtgtTMPCC2d0oTMf5lSaUACsyf1+0PQMelg/tEUWUzrl+ZZMFUdo17A0BRPLHIUVQFZUOuuH1LHXKygxMYmU8oMZcUTt/sEcobFj6DB+l36INfPxKTNK+NA6beBJb6Db1AAmhMQyUniYOjAYCgsTNuoAYLGv3e6T5L+jBRMuv9TA5amA6tpNDJ6NOJZOnnLrV1eHwHeszqYn7ElOwBhx0+1V5OSykoQCKjUC6ROfIRHABWPp2Uw+N3RsSoK/9nh0bOrbD8kF4s+UszJyOHf5xSGKGqCI/Pxxvt/5l8ana/oGgz1LZIPB4w0xvfEoNGtdtY2wCkVBWgebd6AcsU/hVauuip0/Mg1kHQfcoDa6+Q3iiomMJjpw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: d53fd346-fb90-43dc-d2d2-08da59539785 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:38.6415 (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: CX7wum14BZOmRl5vBmKWLmg3OkEa/31uZxrTiE8zvQ6QDZdbWq7bk9jnti4O1o/BPjwrfZKa+ySRnWbjNYYyiQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151450_205024_C604AEAF X-CRM114-Status: GOOD ( 16.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 memac is the only mac which parses fixed links. Move the parsing/configuring to its initialization function. Signed-off-by: Sean Anderson --- (no changes since v1) drivers/net/ethernet/freescale/fman/mac.c | 93 +++++++++++------------ 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 5b3a6ea2d0e2..af5e5d98e23e 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -34,7 +34,6 @@ struct mac_priv_s { /* List of multicast addresses */ struct list_head mc_addr_list; struct platform_device *eth_dev; - struct fixed_phy_status *fixed_link; u16 speed; u16 max_speed; }; @@ -391,6 +390,7 @@ static int memac_initialization(struct mac_device *mac_dev, int err; struct mac_priv_s *priv; struct fman_mac_params params; + struct fixed_phy_status *fixed_link; priv = mac_dev->priv; mac_dev->set_promisc = memac_set_promiscuous; @@ -429,21 +429,52 @@ static int memac_initialization(struct mac_device *mac_dev, if (err < 0) goto _return_fm_mac_free; - err = memac_cfg_fixed_link(mac_dev->fman_mac, priv->fixed_link); - if (err < 0) - goto _return_fm_mac_free; + if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { + struct phy_device *phy; + + err = of_phy_register_fixed_link(mac_node); + if (err) + goto _return_fm_mac_free; + + fixed_link = kzalloc(sizeof(*fixed_link), GFP_KERNEL); + if (!fixed_link) { + err = -ENOMEM; + goto _return_fm_mac_free; + } + + mac_dev->phy_node = of_node_get(mac_node); + phy = of_phy_find_device(mac_dev->phy_node); + if (!phy) { + err = -EINVAL; + of_node_put(mac_dev->phy_node); + goto _return_fixed_link_free; + } + + fixed_link->link = phy->link; + fixed_link->speed = phy->speed; + fixed_link->duplex = phy->duplex; + fixed_link->pause = phy->pause; + fixed_link->asym_pause = phy->asym_pause; + + put_device(&phy->mdio.dev); + + err = memac_cfg_fixed_link(mac_dev->fman_mac, fixed_link); + if (err < 0) + goto _return_fixed_link_free; + } err = memac_init(mac_dev->fman_mac); if (err < 0) - goto _return_fm_mac_free; + goto _return_fixed_link_free; dev_info(mac_dev->dev, "FMan MEMAC\n"); goto _return; +_return_fixed_link_free: + kfree(fixed_link); _return_fm_mac_free: memac_free(mac_dev->fman_mac); - _return: return err; } @@ -570,7 +601,7 @@ static int mac_probe(struct platform_device *_of_dev) dev_err(dev, "of_get_parent(%pOF) failed\n", mac_node); err = -EINVAL; - goto _return_of_get_parent; + goto _return_of_node_put; } of_dev = of_find_device_by_node(dev_node); @@ -604,7 +635,7 @@ static int mac_probe(struct platform_device *_of_dev) if (err < 0) { dev_err(dev, "of_address_to_resource(%pOF) = %d\n", mac_node, err); - goto _return_of_get_parent; + goto _return_of_node_put; } mac_dev->res = __devm_request_region(dev, @@ -614,7 +645,7 @@ static int mac_probe(struct platform_device *_of_dev) if (!mac_dev->res) { dev_err(dev, "__devm_request_mem_region(mac) failed\n"); err = -EBUSY; - goto _return_of_get_parent; + goto _return_of_node_put; } priv->vaddr = devm_ioremap(dev, mac_dev->res->start, @@ -622,12 +653,12 @@ static int mac_probe(struct platform_device *_of_dev) if (!priv->vaddr) { dev_err(dev, "devm_ioremap() failed\n"); err = -EIO; - goto _return_of_get_parent; + goto _return_of_node_put; } if (!of_device_is_available(mac_node)) { err = -ENODEV; - goto _return_of_get_parent; + goto _return_of_node_put; } /* Get the cell-index */ @@ -635,7 +666,7 @@ static int mac_probe(struct platform_device *_of_dev) if (err) { dev_err(dev, "failed to read cell-index for %pOF\n", mac_node); err = -EINVAL; - goto _return_of_get_parent; + goto _return_of_node_put; } priv->cell_index = (u8)val; @@ -650,14 +681,14 @@ static int mac_probe(struct platform_device *_of_dev) dev_err(dev, "of_count_phandle_with_args(%pOF, fsl,fman-ports) failed\n", mac_node); err = nph; - goto _return_of_get_parent; + goto _return_of_node_put; } if (nph != ARRAY_SIZE(mac_dev->port)) { dev_err(dev, "Not supported number of fman-ports handles of mac node %pOF from device tree\n", mac_node); err = -EINVAL; - goto _return_of_get_parent; + goto _return_of_node_put; } for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { @@ -716,42 +747,12 @@ static int mac_probe(struct platform_device *_of_dev) /* Get the rest of the PHY information */ mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0); - if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { - struct phy_device *phy; - - err = of_phy_register_fixed_link(mac_node); - if (err) - goto _return_of_get_parent; - - priv->fixed_link = kzalloc(sizeof(*priv->fixed_link), - GFP_KERNEL); - if (!priv->fixed_link) { - err = -ENOMEM; - goto _return_of_get_parent; - } - - mac_dev->phy_node = of_node_get(mac_node); - phy = of_phy_find_device(mac_dev->phy_node); - if (!phy) { - err = -EINVAL; - of_node_put(mac_dev->phy_node); - goto _return_of_get_parent; - } - - priv->fixed_link->link = phy->link; - priv->fixed_link->speed = phy->speed; - priv->fixed_link->duplex = phy->duplex; - priv->fixed_link->pause = phy->pause; - priv->fixed_link->asym_pause = phy->asym_pause; - - put_device(&phy->mdio.dev); - } err = init(mac_dev, mac_node); if (err < 0) { dev_err(dev, "mac_dev->init() = %d\n", err); of_node_put(mac_dev->phy_node); - goto _return_of_get_parent; + goto _return_of_node_put; } /* pause frame autonegotiation enabled */ @@ -782,8 +783,6 @@ static int mac_probe(struct platform_device *_of_dev) _return_of_node_put: of_node_put(dev_node); -_return_of_get_parent: - kfree(priv->fixed_link); _return: return err; } From patchwork Tue Jun 28 22:13:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899082 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 2E995C433EF for ; Tue, 28 Jun 2022 22:26:11 +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=v+LQDbX16RY7oIXz7/nVbc4uGcD9DRMnLwzxHFjLeCU=; b=LpgmapFg1RsMqP XEU3vzCeQ0QK4poeI2eSUeWfejgxdQgR1qfD31aMREHzGoQxRhDoFvjU2eWx23cmsJiTEA9X6rfKs U2fz5VJltrRjS18kAtUfDu+goI7+L60qSTos/r68z+1PnN4vKOmzYGZnH/4Bv+5E4USzGapeur0kB ncO7RLF1uzsS+d5e32ZaWi0dIv1/9IqVRYzeomstyIKtaEZ56h/v+AJkp0q8Vid1BiL23EGMOrhYS T9A4UD0EInL4wFS6pDumTa2PNKZUGEWpccwN7FUjH/ErooACSVumWpEYoLxIPMJ0dGDjOktdrXGCn SipereHuH3Rrp7eDbK7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JdG-008PkV-Vq; Tue, 28 Jun 2022 22:24:32 +0000 Received: from mail-eopbgr80072.outbound.protection.outlook.com ([40.107.8.72] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTu-008Mcr-QT for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R5oBmtRvmyIkvf1GcPAY9EYnw/pTO96g4K1EpqsMEW6DvsQoQWI43QlLpE+qXH6NQdUHoXlmOpzlah8x32DReCzXL31rMjDQHJShGT4AE9w5S+1tUdf0zu3sGhIDoIYqeK2WNgiU8yKM7KZPb5jOCxFq7zLzkLON8QJkT5KayyH146WgfSc0IliwPb98AnzHEYLznmnUHovTwvNIIa8L9JDYKSiJhS9pYWJP7NybGtWscVfQbsA32Er35mqhSh2MpTs75RdEu8JuvkxBB9Ah7ovddzY6F6ZEP7ckXsRcSbEbWzolb19/BFUc6gA8Vnrhrr9udDfpRs76UQ0DajnmUw== 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=vYexCKk2TM1BAW0Gp720sPM/RFhxakg/POT0BvAiBMQ=; b=HHapLHBNbQ1Bab8NAdNi/R3zEC7PKXkOq3iDvXF+3G2sx2XAdJlWIZtvw0AI4HHhpHQWqOwJSXCeIyp0ftormBpHsrkxxy2XnRC5F5doRrlJhkcLUOAdv3cEZvMaBoPt8LKpC191w5aIyXhpOedxph98LQ/DGuTurf7waqXPavWMSQ07nNNfaSlfbqYP8pRixi+JJg3yHMm34ShEpUzyy+V12pofcYHDXyCHirS1W9kIeJS5OW9WO3lAZ+woi9H34M4FsEowG2UExIxry4kXfoKw2Vy+/ENdQXrxpFjxAZyGG7n18FjjMRObnMN1p9cZOIqw8w7OsqGEz9DCvSvlCQ== 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=vYexCKk2TM1BAW0Gp720sPM/RFhxakg/POT0BvAiBMQ=; b=SdWfirly7k0IOUzAUcIV32AvS3QXzoFkc1WgnhHebY885ljTtC1KW6xC8fmD/2/ayDAKeyOhwp5OZR1T2TQHq2aYsCVqCgqg66xPRsm3wj46qP00fr9lB1hEjpovSLtlDQ8ifaMPGbCoutTReRnF/Sfp99Ytvu341kFynKkQH80WkM4lLDPl0NhIxHhGuDQSDjJ7ur5Pw/7abvNqhL74gZfPx/pudczuPjN1kn7HJdkZPIjQx8zvZPRn4HdGNBcKpHvm2au+YKqe55ASaqe/eJIOfCDW787wtANKCEkEmq7QLI1HWzDWwanbWrQsz8vkV4Yyfx69hWuJ61v3P3nwHQ== 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:40 +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:40 +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 13/35] net: fman: Export/rename some common functions Date: Tue, 28 Jun 2022 18:13:42 -0400 Message-Id: <20220628221404.1444200-14-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: 723d0471-bbb8-4168-62ca-08da5953985c 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: j0YO9nxxTdOZu+pYjD8LJnjzxmw1wVykExkyoUdDmpm5jCebT1kJ68wTr1nBqqk+qcVoJ//7uVUj9H3wIWD2hE1umNBio37s2lzB2lcQUZ8E88bj3q0+Wm+C7PeSQiSMFmv0Nk/rQO+9NnYendBmoTA2GugizJg1h7hAKQaajfme/P2nDY+QhRAcBdbVDghVOvYQZjU+5nnYsTe+UqfcpqTk8Y4T0mi7LjgM6bv1x8vhFhlYdp/BQAru8T5mwpD6ccPIH8wZrzDZrFVF+/QMHrl2LaSpZeR/YsL/3ELbyhh2nEBJcBkbeLWP6/ALdTgHAbh2P7ZIheOMpZVdQKzOKh6fxQB6U803ZthBvFQl/X3mLcLdjeRXhIAj71V72iSUDWbqJwMuAEJJJIlmGEnss5vvjlSKYMpx/Kv/CTJ94PqwIfcsYon4/LAQqwBxblF8ZbleRzgU1EtPR/XOboPo2ohEJTELIVbCrrXRNUcGfIoWe7fcOylvJrZutrFbRAOaoXKagMSIlTZmh1L/7qP/+hxIfYf9I1jgZTq6KchxmkGD9vCKe19FBvEotTy06BKNo5sEIh9Ph63iacHuAXpmhoE8Jjpr8IR5PZxe3lTP1VBP8V33F50UQzUKQwYlB1Iki252wL44AJOZ2b6AWocqSxgbTkB9QUBv2OVfhFCsWnJWK4voWm00rKTIV/4su8zdoSUsSG5TP/oZiAcqeY6djiwl93+E6VkyarCIrqMawSy3icu2DDvPIKEiCtDuEl++nUrZ+FeOBQ1u3YOCY10QOqAcFHuON1pVZE5BLYR2p3g= 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)(107886003)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OUNNrxT5hbVrDq5sB1/i6s7b46njyK20GFntEh3fzxVVAddQod6sYkFZpzpjIcIXP2fU8PNQpaFjFgQjSpwfdawZyDU9PZ+/Cc2mw7bpQHa85UmLvvgjePomzSzIwLltNN+rW6Nr/zM+dPFazYVKV8rAxA9WQsrugGgLexvkj9QkCo1zMkjvc4qQWXY5rZpxbw3SG0z54jXxcVJIpbdEXtACnQlI4U6w8R/xc5MAF6xudjlSwHpLBB2cQ6cFnpskVDa9H8lW7gu0w6vx8NA1ATxaWgkwkmv3lyusz35Wa4Eld8zGBtQQgoYdb4Y5WmzVIqSIH9K57RCXo5DFPwWzVmO7eQZi43BLBRHJ+yUfdHf0G5P5dBf1r6ySdWNTQxX52R9AVN5uVdHrsEZ6sJUNuwbhTlUgT4qNkAJPH5yHPeA0PljHJW2//bdYBED058rLhE+so43G37h6vOK2vox9hLSS5nImmeAuzBba2VHtl2KW9eT+/B0vKBFhMDFkKy9z+W7w3s/1BrIo5EcY2TuVjMYbgJiTMxpHCXipG8fHHV0P+QbsCFQvXa81eo0U/98cxiE5t6D37aEJXfYnhR+U3WIOBSsDcsg8nmHUBS/HomLSNxD6/44x/XSsb9VYZCDQDSbQJf2H3J7oQ8piX0ZecE4uGqijD2TK/LoyqIfTv/rEoLtS+hbDiB4OlgmCMkQdR9KGBtWD+J8CYLbIiGKZhIasx2eKdIokK3JSRiY3x3c56FEZ4u5b6vbsJAo4hvN+zbhCR7K4yqkQ0m8UkHIsX9KRk7dgKryNHchLPoYWwgN19x9qIDOkSBhx+A/1TJbTiiKPZQzs4aBLknvJzMg3C/jr58b9FpiK0NqOoGhE5RIgRQHPVQxZw5bfCeNVMTkusRKck5575pGb3gk4g7HvgoTpv28mTrOcvEtfRsZaiMkqygsW9JZGxtVRbv6GRKO9BaVEKMWqPM7u40RC0NOmEgdkxQyaEUBUe4C6EXP5gNdIVD8cMLF8AG4JEoM5ZiZ4rxe2j7tTsdza6A5Ps2cmE4MVQCnKRRW1gya5q2NkreN6Ym0PydxdmqjPU5Qury1vYaqI2CP3stpvSMNmN0hG++PItdeBoY5MJOnM+CDrf88ExcJ7t2glrulgj8RlIezbAjed7oMxvl0ZkTzZXC3rinXJX97Wr9kbFs/R/qEmF1CyMBI/aPgtLhBsko0ORIpPP9j/vVsk2ttlWD/+Y7c9+r9YnKa0/55Xy4TshMClZG/JrEGQCeLKYDc9/J+//T4aRbP918kjM8KZGDUgG6HnQsXeFxBi4XAORaD07iZtF/AW2s1RyuUxNmND6tm4s6QC1li3OZQ285a7kLrMwp2XQY3Z15QLQ5EF2ESUMpshKQaezuCCDRAm15eFiJ4JNQ/eZmQ+6iOqHOY2MbogKD34K7IdgvufFzdfqM7gZYiqtwY3R6UXMrEW6Wn5rLCwb3tZHMrBkin0lPY4d1RqSCBbfbcn+Xslbyt3Gq41U1ZcZ/29iZ1Z+hUXyvIG8y31a2xmZWbqz/69q6YT6ZMBlLDDEjNAy8h7fB6z2Aspag9+MltlSy7TMWmW3+REqu6L2gETs9tOa3sje2rW8IMTKR2gbA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 723d0471-bbb8-4168-62ca-08da5953985c 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:40.0789 (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: RLHP459nKouV1fP/dAwO3+YhFcxj8kvi+Mqs4OPwfhRPUN/qCMHqTCX+SWW9/btH/eQJvHEBaYZFpS1RGuPOew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151450_908054_E297ABBD X-CRM114-Status: GOOD ( 12.57 ) 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 In preparation for moving each of the initialization functions to their own file, export some common functions so they can be re-used. This adds an fman prefix to set_multi to make it a bit less genericly-named. Signed-off-by: Sean Anderson --- (no changes since v1) drivers/net/ethernet/freescale/fman/mac.c | 12 ++++++------ drivers/net/ethernet/freescale/fman/mac.h | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index af5e5d98e23e..0ac8df87308a 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -58,8 +58,8 @@ static void mac_exception(void *handle, enum fman_mac_exceptions ex) __func__, ex); } -static int set_fman_mac_params(struct mac_device *mac_dev, - struct fman_mac_params *params) +int set_fman_mac_params(struct mac_device *mac_dev, + struct fman_mac_params *params) { struct mac_priv_s *priv = mac_dev->priv; @@ -82,7 +82,7 @@ static int set_fman_mac_params(struct mac_device *mac_dev, return 0; } -static int set_multi(struct net_device *net_dev, struct mac_device *mac_dev) +int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev) { struct mac_priv_s *priv; struct mac_address *old_addr, *tmp; @@ -275,7 +275,7 @@ static int tgec_initialization(struct mac_device *mac_dev, mac_dev->set_exception = tgec_set_exception; mac_dev->set_allmulti = tgec_set_allmulti; mac_dev->set_tstamp = tgec_set_tstamp; - mac_dev->set_multi = set_multi; + mac_dev->set_multi = fman_set_multi; mac_dev->adjust_link = adjust_link_void; mac_dev->enable = tgec_enable; mac_dev->disable = tgec_disable; @@ -335,7 +335,7 @@ static int dtsec_initialization(struct mac_device *mac_dev, mac_dev->set_exception = dtsec_set_exception; mac_dev->set_allmulti = dtsec_set_allmulti; mac_dev->set_tstamp = dtsec_set_tstamp; - mac_dev->set_multi = set_multi; + mac_dev->set_multi = fman_set_multi; mac_dev->adjust_link = adjust_link_dtsec; mac_dev->enable = dtsec_enable; mac_dev->disable = dtsec_disable; @@ -402,7 +402,7 @@ static int memac_initialization(struct mac_device *mac_dev, mac_dev->set_exception = memac_set_exception; mac_dev->set_allmulti = memac_set_allmulti; mac_dev->set_tstamp = memac_set_tstamp; - mac_dev->set_multi = set_multi; + mac_dev->set_multi = fman_set_multi; mac_dev->adjust_link = adjust_link_memac; mac_dev->enable = memac_enable; mac_dev->disable = memac_disable; diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index 05dbb8b5a704..da410a7d00c9 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -71,5 +71,8 @@ int fman_set_mac_active_pause(struct mac_device *mac_dev, bool rx, bool tx); void fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause, bool *tx_pause); +int set_fman_mac_params(struct mac_device *mac_dev, + struct fman_mac_params *params); +int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev); #endif /* __MAC_H */ From patchwork Tue Jun 28 22:13:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899083 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 AFB4EC433EF for ; Tue, 28 Jun 2022 22:27:29 +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=BFC/upyjv7Aw+x4usCKWIgK5O7OzJaTWYSwKVspLwsk=; b=VePCkY7HRv0bxw Mg6QdjOziPg1p1dwtCTZxj7G0DFYy+5tnY7bpn7tjHCBWfDcqVEqBlZTwBIFbHwBphr2EMwelzAZQ zdcU/MBiryKkg8eH9kOavcOwr/VJk6qjH4vsj0gHi5Uo97dMvRlBEKzwWqEHan84hxTcbOf9t0SdR REmRaIbAXVdWxNesuoFJ5BkKg2NSkaBTMqcIHmOqY49My0mYGB7aUUdEh1O2fhSRBNvnLZa7kUuAo vH+NGkKGS3/4O8zXVtG1t6pOjQlpXuSTgK0HYWuUWHaFXuTh2izQwgzjLtFL37h+BN2WoxDspwRkz bVyB9LH5x5HjyyQUQ0Lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JeT-008Q66-0R; Tue, 28 Jun 2022 22:25:47 +0000 Received: from mail-eopbgr80074.outbound.protection.outlook.com ([40.107.8.74] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTw-008MXM-CX for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jiJcS9/j5h/ABHL6rqvQxg7UsZ5+PrDvI9cmz78PrNGKr/y9m3ccjhUIb9u0zgmXcxcXRF2b/72fFgLPINp+CRj3zHklyX7X9lV3XN9v8XPZ2DNd9KigN+5Sq/L7Wu2hPezo2Dzs82u98atd1rQrj7mvODXGI0Jmm8Lot1oopL23KUKw2pJ+tOoXjoLv8WfcfeWMuVx1Vutge6RZS1dj8neG4zF/n268Uo0O1FKdj8HRrFvZxbXyfLn/dUPCRoOFTeOOgNZLSjQw3i7Dl1OYGJ5BrqtK7kdYr0V7kGlKOoKmwDBc+S0EPKjBC+OfNlFZOOYChC5YdYi5k9DmVW3LAw== 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=6/eCJbGAHSHU8+ge017Q4V8y5RRgZqs6L3IicsKbrO0=; b=BYPJXXIoX5R3BxAnemCo8s4ryYbC8L1HbIS492GyoVtKE+MQu+8j62cwPy8N8DZSoJKbbWybu/qInI6J0QhArxFnN3cjqOHhCmQLk2h7+MmqszYpFmEh8/QBdnX7pzho7YGBn9YJP/9tvvM0HHnhlcbn5UNyWgctZtT2neNOWTcC3+a/K+LFtAm+FnEu+9KYXaLbc/wSOhZ9P9UppuACTqMci6OkoPlg2/+CDQbccZMmEQyxDcY322BrMgNSFuSzZmBbYuRuYqQXk/prXxz5JG54BQCODZPIKq8tMgcNEIYRd7+xm2N4X9EoQd1wCttiIwLqXFC2XjzWMkVy/tpr2A== 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=6/eCJbGAHSHU8+ge017Q4V8y5RRgZqs6L3IicsKbrO0=; b=lanzjjIbeHPeyY+bHGdmx5wQwtZOrznxLaBubUHcce+/4j74zTvIXRDYjzLlKfjeIyjJjC+3T7NktXYt/5BWHI7yQWYa5bZujb+CaTuZg7N8OrgXLym0NUnd4KMLezmlcbAGpQ+gxDFUv3R7GG6tZYMsyHa6ij4dChauRPEgRg+YUZgaU4gSPYHMV41YHse8ax5wCBMh1eoddHAQzS1HQ0wn8IU4TwL5DIUw5eQKanltS1M+R+vsoiM/R4ZjbXRVweVj6VGjLH8Ah/NMkwa9yOloA5gISJOwydhq5PlpJN7B9L163mt9yWV7XHjiffpQTncXJg4i5+yIwAN4gQgZIw== 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:41 +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:41 +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 14/35] net: fman: memac: Use params instead of priv for max_speed Date: Tue, 28 Jun 2022 18:13:43 -0400 Message-Id: <20220628221404.1444200-15-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: f08c42db-1497-434e-6783-08da59539948 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: 0BVYuZ1HuMVYh1xJp8dMuyJD5LL5HNu/xFNztihJqXXmpeVRgGWO444RjU0JfThwaKPZmVOFrQpUBt6TdEZNCIU6/iHYW1TzxesGSEeCbU52uubb9jHTpBgHc/JPSTy9yKPnZUzV6qDQHVaFAPgoMQrrT2vnZ+CUVCdMtwS60DxNiSQGZdZ1zZzjuHrTKU7sxi8eClZc+Lf+Sr9rKrSSOkAZbWhVpnyf9XttUHwqIOmOYePKoM3Ytha19Kssmtuxcr36kFpJRGjlF96dr0QittTC1hbLibADWx1+KdaHgFT9x7tYmR1XNCmIlGASpYDUZxqX8XAX0HvBeaYwZ+QMCbaZniCoVa+Xl3hzLo6iPm1v2jfMNanSewtL8ufEqY49z3r3G1AxwTs702wIw11cqJDqqlAKyB8oyPYLRgvsNeAHx49LDtYc2XaaxMo9giAFWA7TM16FS4tFCboVwza7Rk+lEIhG3SoG5zPIEa9kEhSTD1qlEL4ewTVSYq/pRp03DlgQDjvlWFQW8hUeSYxz0ieF0HqlIkUefFB8bPrqId0EpN1wit6bWQboVYHjYVNCh0wQH/T6KEEzht3u80L8IKfT3G5U+pz/nO+0YKBLu1JRm0CL+Jdx5dmIRwxfA8qEO1Lkm2SdF5sksYuULsey7v6C5+VLvO93Kv0jeXVA4EMlGL41y0FnStOZoqBQCvQ4jHsFctomL5oqkmeKq3fPp5VcxwBCSesPSe23o4YvounKDM9CEC9WsEv4m9D+1Ie+dSzcfYpBDoGUcVxdMVwej3Am3mkOyaK7+smBhIK4OF8= 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)(107886003)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wr3JTbbGTpUQUrJQNbLByUdkWM3AxwVWj/eSPxCX/a9+6cD9bK1tbbuoimRTGcXCNFk2J1vVXkKc0WLYe+taAgVlbuxPWVZFrqX95q8fEZfYB27xleGXrCcTxxakZdr+gqqMQyI2mxNFlRHNrzAxUJ9x57tNX0hnUyklNIuGtJckuepEllyGO1OdvtntvV7+qOSAfNqASt7/hF13gPxD1R7cxxOd2z7lPH0MJ903SWoBgTTX30cydqpehkxmDL/fmR5Y2jNUP9eG5JMoWIokDpLcJZsTGqPL7xAQ24tGzy+Zhf+zjMSieqGQsD6IXGxB5bNroE8N3RRj9fPDVpHK1t6YloSvLgAhzvYWLI6dxF3MSMb90pvF1YZuiUcNdMdqb/QuZzBNffNonENTa7dM8oWCqeTCt2t/xNuCabqzIdvrCvqM9y9vVZVCVKolnQ2KkqseOq6memJ6MYKGINSEdEPUvTrwgXFQKNu9Y4i2sHk7Z7HDb7oeE5CbcnBROHKYwicdk3Z0UJeOLunmiij6u6M/p8cQnO1FDWZPlzMqyjvpTMEoepeqD87Dr9kACd+GZvByoMaGGUgFtuScaf5BZHCcsbvY8TjymHGGS940sQ9L6qlW2TLE2x0mBwxE54mK8Np7oJvvL2XOmuafvdVQc6gHr1fQoFTA3RyNfnNqhlalZ9iecddsl/YT5ctK5PWT8488bN7++843qCVTNEDH/HC/7pfYHZYhAfOoNUg8/LI4mZWP+yPq7CZy/7wVmiotB2zdT+82p4ElB8kx7jfkayOrUYjrrP0kBJuFyvChA3SZpWNciQTSWhfJHLIX17VXmgrPDji9hB/ISpK350RwJrjvP0Gi8wEpMunJ6AjZwpMIh9qMTau9JmbpZSR4sEofbV3xPJ4J6A/myriGspNxKstYy0qYGQLQdngGcUguPhrUuwYJ/GdKUHKxkbL7E97dGbqUbvSuXiWZoUcnTNSU+ufv4vLOT0+UfVXlu4YnEnFdIh8oM6fdzilu49pM8FytQN8ZTSC/p6wjRQGq8UNTYD8W62lTRft3NXufH6QYXkjkdBv3g80EcxUEPDbp0uw1v2sKayOKJjgQAV3laqe6N7z86caMvrNcoLdQkO/JGKkCO5O6Fyu13mRrQlIqxTDnzlkkWSUeLvbTJZxykR9CpgxIzXmeyzb0jr5EfuTeFtXE3NvEZhttGI+PhWGKSQOmUlsdO7/g22q407uZtZKflEPqUawBFMo64jbwzvptWCYs+Wgt20TSQuOUht0WhPfaSKZ7Jf0pjCgpx+J5z9UTvui1AAbc5joAuY0otpGbpsF9yrX9pPGrfJc0y8H4bTHM+ZbIlVkc9XPR+7rKcewvQWcTxr0KkikkDnHNC8gmtpMZMKY0AJ4oviLr1qPmqtJDA/nndVOHsghVpVaGMy71LuH4ksSJTcWaMIX46dP1LM/x50N8q4Sy2Q5UG7iKIQ8IRWPh35vaWwlhMD8kqfSaHiGSpx83eL+AghQXeZcFJEU6dK7Hq/Jl21jkWsusitGHsHAftj4gY1BrmW3O2GoF6R+ierVuw6whhU48juPfEitFrF5A4BiJLaEGAt6i9eDP0VxTTb1NUU/ek3D6f0a7SQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: f08c42db-1497-434e-6783-08da59539948 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:41.7350 (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: eFAutiXMoMCuqA/XnmAPNYYmrE3ziTvFtFgz23+R/o4kzXI83OGS/HfzsR9WKMc5kaZwo/UjzhVoPbdJYbGKxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151452_512710_3F07B619 X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. 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 option is present in params, so use it instead of the fman private version. Signed-off-by: Sean Anderson --- (no changes since v1) drivers/net/ethernet/freescale/fman/mac.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 0ac8df87308a..c376b9bf657d 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -388,11 +388,9 @@ static int memac_initialization(struct mac_device *mac_dev, struct device_node *mac_node) { int err; - struct mac_priv_s *priv; struct fman_mac_params params; struct fixed_phy_status *fixed_link; - priv = mac_dev->priv; mac_dev->set_promisc = memac_set_promiscuous; mac_dev->change_addr = memac_modify_mac_address; mac_dev->add_hash_mac_addr = memac_add_hash_mac_address; @@ -412,7 +410,7 @@ static int memac_initialization(struct mac_device *mac_dev, goto _return; params.internal_phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0); - if (priv->max_speed == SPEED_10000) + if (params.max_speed == SPEED_10000) params.phy_if = PHY_INTERFACE_MODE_XGMII; mac_dev->fman_mac = memac_config(¶ms); From patchwork Tue Jun 28 22:13:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899090 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 DE514C433EF for ; Tue, 28 Jun 2022 22:28:50 +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=H+YyjTyDqMCdV2cOmrX39KSY9zj9EI/nTjXOI7hhpaM=; b=Ja2EHI/XrxZ9aa r6Yz+klI/cuzasQDNAZFPvonyKKz5WqgNzglv9mVCBwJtz9RNN6Rk+n4XaXiUSpEhCPTQ93ajWr4b YrK7TLGZ2BVx/9E+Ei+GUtqsis1xIhmk45dHrHV0XmAYzIyvfYRxE1dSc0mTSCsodYti/dNM0pprw r+qCqcbthmpQbiz0lYQe3QnZZxPFaKE72GTfOi5RCZGhSiPfzvGfxLMWWCg6sHkI/oNUYjJf5P+02 Z2DwenmvzXKNfKAax4dnLlWpVoPVOrdR4XjYldegfqOKQZub4y7iWh2U3SdpdefVNgY4GeXxwmCIX GDzl3cx1yAl7JfinVQfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6Jfp-008QWI-7V; Tue, 28 Jun 2022 22:27:10 +0000 Received: from mail-eopbgr80072.outbound.protection.outlook.com ([40.107.8.72] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTw-008Mcr-Ot for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M6xxZvIYq2hDUpBev45Sot+G15osthQ09qD6tebCh7TA6lEPcpqtI08tVYlcnqADBmOVPM1/sh+85AHdMhIUwURwF82OctD98/HNOYxZosq9f2xEbRfHKZLckVYXw5FHQT9gg4iJlAKcp+4HWlCLaQGO9xQjwhMzCjR4iuzxtRtjxByPJ3UIbAzO7UYDiuotYsi2TOlNSSDJ8r79a47OW4YCF/W/1L5d1g41uIH77dUbDd42Rm7PZzunR3vwvU7gvONnveHn48JZNvWU6WL9Ggw8+1Nr/1IYLC7eOEZYrIJCoMVGAU/EHd/CVQ4wIM0eOP4lMQvy7N9pcc8Sh3+sqw== 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=ZlxXAwRxUHEl+QF20HVm9skJ8pNWO1cyP6OWWH5uXMw=; b=aBlsEVFj6748EgmhDBuelNV8KEyqiPo2YTYRna6pY3Zo4bzZIZGJUTE/NSspGZGsjmUXn1FttwW/IXmYwbslgUHN3ZePNPiVXeTKxOsJiKTYl0e7MmcyXjOTDk3IG8ITATnmuJap0amkRSAq0uKwvSMG3N0buSqJAsgI+yp4kaZ3ZaQ7n20ZJUl5DvwGWH/qg6lFN0eulItY75BiQHi0BXvI1ApjXbtYWV/JCtCsvIXo6Kxm7H/MPm50l85aW4i5cEXAmcLR5Kp0iWDWSfio+XZvkX1Hrv34Vu0ocU6fFFfLqo7HMrDUXH/hMnV12JVl8W+DUcjWqgYlw1XbPZWUVw== 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=ZlxXAwRxUHEl+QF20HVm9skJ8pNWO1cyP6OWWH5uXMw=; b=mRpmtxwybIXCV343dz58FfLv1RW2+bNkudkqOcyqogXigQMWKUVXT1dKOmYDYAHsgAIYxjnUknUOcvzrX9WQv0pxiHI77zjViQvIXR1MPcWAsJ4Awhr8FlGb3zBa7YizYq95jeAx9jNyEEvx6Alk5ZA9X48iQWfkQ8iSVdz99dlUl+r1m48k/knkwlEjelp3ZSXWyedVdEeIBMZ6TdkKBTWpp7dyCc7NqhCdoBy9GzbsAYI/nPnKPjyaXnhOoqt/iTxuJC4rRccF4y57tUYEWKbOqoaHMW5kUcw5qdm2Hyz0w2c7tjxe547fXpTMpmB2VPC0WXXBFPXpPB1P3sdezA== 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:43 +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:43 +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 15/35] net: fman: Move initialization to mac-specific files Date: Tue, 28 Jun 2022 18:13:44 -0400 Message-Id: <20220628221404.1444200-16-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: c1283cc5-eedc-421b-6c47-08da59539a34 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: AvVsTlbVV4NSKpQeyNq8OeFO72/9Gg+IKtz36X7RMk41k2IaihgAl96tDvNncS1q9y9eyBFYCvpLLgY8AFXAUQjror+hwgT0pCAxZk4p8tXAeyyER1A9jIInMjpckbQKZtWo1xzBKx9hWL3O4mrx2wahbqBAnb5jq+mQA5LchJ6Gr2bHkwBU+PqZW4M4bPpA0C30u8UBBN6l3HvWnkKY7FoVI3y20ZUVUV4dBdIeDUPH4GogZ9MFxxPPJ3G46OCgvpeMguODPvKEKyP5u2K49JhLjUVRcZ16hZP9gtd0ZUh2HEyXTmxLYIa3e+BnyHJuB0vwkSZWQAiW2WtxPkfGFrk0X3TUfHI8NnpeYqV36+zDZ97Hg30YUxplY4OR2brnN4T/n2vW62s5xpqrjYTb9DAA6qabLuwu7VNIdCAA6q5Ho8TaPGLloAX+42+wtUfEvEQPZ2dWxe5Uo9KWcQmmrzIbNzD06QSSvcRjiGdMu8hozCp5oDw+bthppLG5UTcT1CxdytrmSGbe26pRzVf5W0t1n0eZ8nObVDg168B3epT21yJhC2LVLdHIP16az2z1PV0OjkW8jZNla40xL1vQ1dQa8FgyYFrN6+Vp160a70b2VRdC3E1UD7x2rhlfp5FOPwAeh125QuyTB6Le6X1gdfzOxOnik/y8ZHyw2q7yT4sdr/IhFACvZfwnYzoOtrHZ7xIW3jfzX8VJpI6zzdMIfYQwqQVjTrm+57XoxSFOa4mpeTWZU7oDYoYXhSI0AqOn3hYRlbTbxcj2CLMGVbA4/zEye7ZfWCM9SD65XvOeFJ8= 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)(30864003)(38350700002)(1076003)(83380400001)(86362001)(2906002)(66476007)(8936002)(6486002)(4326008)(41300700001)(8676002)(26005)(52116002)(36756003)(478600001)(66946007)(2616005)(6506007)(316002)(54906003)(66556008)(107886003)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FOW2R4522oIyhRmlDzH1KN0TRsKhbJVQdM+kJ8BO5aX+GlC1b4/HR+dv/cf8UR4pcZReZAS18sFeKAbFjps4hbVfSPuHaYTWnBOmkZjhjj/bZQ7GVd/BN/js0scdNUdgE65ucKboJFQEsr3ebYmam6BKqtyN0DMdLt18g/RDctz6wjQ8S2vDwim18+kLYDdgA0NoAimGbUl10Q6r+nHFuKwiN6/AX+drkLukTA+siht2r0/jRQOWp1Uu/Iy/Re1BGS85ctSiQeXtVZ1fvtPuKS8BuhwOxw3kR3QLYQSJUwhD9JzsxDv++6OqVx9z1ld+iLaxasAo5nkqHNi2ye8SLIsTM63LYQQZGd9hw3y3DP3ojrsQz2PCTwzLUD8UABpq60NBt5lhGn3qCGQFghOkjhMcWFv8jMkt0ol+dvrYL+fCC1tGVnGxLQjBzacH5w1tsSte4BpjpAT25hg5HREXKbdfE9hO1TDChQ7EZwiqemmLnBKGPsYmS8Sj86LaW46M5JwwUmVnG5DZ8xm224/2xLsZYbA9Cs5km02pX/fb1aF/xLNLWi5ZYjKNU6ZqMc57FDDZDO1QmQLbJi597TxLSJezFuKd6CyDlb7d7JNOJNr4XIDzPsfKAn9SpBDkTmPXFcGnAqnhiUvK4ufCTk+PVqshMTt7ZUL1+IjbRbxM0YlTJ/U6kBYEIlYQwaU3iHkmOmQWwQSnXjww9xJlGU0zQl8QVWC1B0+UneFTKuUyT3WTLnBueXsC0/iaaeyUSK6xdGe5ByrlnhwCjCZYN7m/xzDllw7J0p7rTN20cXmjBIscnC2fNYQ3itBkNGQrbB8PHd6udH7NFojWSy91dXvgJSA/6SWIfZ/6IA/I1/ZIopc63ytNmeFBfm0f4DUQfjt3M/JuJlZ/Rqhhnlwytj9Uy/UAG+LlqMuz3T4igtszyHHoqXzs+2mOO/g38xH585ynHa0RGharxTlHiU32vSlJBudT46wZxOEQO7PRcQXG2HXwPOZrRdtVft3QzTxgnc0z0SVvy0ILM7trYodUjC3OWO7L4mU9fNGZ9D0oa7pcr+XAiAfkPe77EDDXy5TH3ErNG3Fdkl85FhZNkaya93iiy7TfKR4eAnuU8A0uffx7bmyGd397W+5RR+mr2sKOtGx4a99mAa6DsN3XsGEgKy2FDZnNc2mtWGkl0as9GSlYczp3SP+A2xoDM9kNzdD6RpdGBbj7JozDR2scH+fWFUFc4u1gRYbgKp9fkZJogLA77eRIeaoTt/txq73ZMoMxiFpxoiWmfuQHEnt8LDPdC80E2Ydd+qNo3NkcRh8itC/q0OPBeHkSjJTWFe+COrXnn2YGF+ms11nmeUMDtNufK1AXb0nhm323Na2ev+orCp8khzzmPi13VgDEHxXg32MS+LWvHkpEeEiz43qDQiUtasjU+/hlz9EAn3mfo7fhWtUg5EwVCaN+aGWJ/V5efZQQ5gOMe4ICwE9nGm6ZRp3KhoG1s0QdvpET8GBFuRcCS6nbivC7XiJvTL2zQhgaYhBuWCo270lCFSbNV0LSMO7+UGTUK1/tJZNsFgf6wW38Le4Bn7wqOyJWhAJUii9hIk/OWIuvAwhbKS2zG1Lg27dPrVhngg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1283cc5-eedc-421b-6c47-08da59539a34 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:43.2974 (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: gaiR6sCMhCikrpOKXsqIqMzqH9OLrorem5Ocjns1SkABy+pXhgTYP8QSRy0xV4OYr6sTbjwt4xMHgWGeBq2eNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151452_910644_0B9DE5BE X-CRM114-Status: GOOD ( 15.60 ) 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 moves mac-specific initialization to mac-specific files. This will make it easier to work with individual macs. It will also make it easier to refactor the initialization to simplify the control flow. No functional change intended. Signed-off-by: Sean Anderson --- Changes in v2: - Fix prototype for dtsec_initialization .../net/ethernet/freescale/fman/fman_dtsec.c | 88 ++++++ .../net/ethernet/freescale/fman/fman_dtsec.h | 26 +- .../net/ethernet/freescale/fman/fman_memac.c | 111 ++++++++ .../net/ethernet/freescale/fman/fman_memac.h | 25 +- .../net/ethernet/freescale/fman/fman_tgec.c | 65 +++++ .../net/ethernet/freescale/fman/fman_tgec.h | 22 +- drivers/net/ethernet/freescale/fman/mac.c | 261 ------------------ 7 files changed, 276 insertions(+), 322 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 7f4f3d797a8d..92c2e35d3b4f 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -7,6 +7,7 @@ #include "fman_dtsec.h" #include "fman.h" +#include "mac.h" #include #include @@ -1247,6 +1248,28 @@ int dtsec_restart_autoneg(struct fman_mac *dtsec) return 0; } +static void adjust_link_dtsec(struct mac_device *mac_dev) +{ + struct phy_device *phy_dev = mac_dev->phy_dev; + struct fman_mac *fman_mac; + bool rx_pause, tx_pause; + int err; + + fman_mac = mac_dev->fman_mac; + if (!phy_dev->link) { + dtsec_restart_autoneg(fman_mac); + + return; + } + + dtsec_adjust_link(fman_mac, phy_dev->speed); + fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); + err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); + if (err < 0) + dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", + err); +} + int dtsec_get_version(struct fman_mac *dtsec, u32 *mac_version) { struct dtsec_regs __iomem *regs = dtsec->regs; @@ -1492,3 +1515,68 @@ struct fman_mac *dtsec_config(struct fman_mac_params *params) kfree(dtsec); return NULL; } + +int dtsec_initialization(struct mac_device *mac_dev, + struct device_node *mac_node) +{ + int err; + struct fman_mac_params params; + u32 version; + + mac_dev->set_promisc = dtsec_set_promiscuous; + mac_dev->change_addr = dtsec_modify_mac_address; + mac_dev->add_hash_mac_addr = dtsec_add_hash_mac_address; + mac_dev->remove_hash_mac_addr = dtsec_del_hash_mac_address; + mac_dev->set_tx_pause = dtsec_set_tx_pause_frames; + mac_dev->set_rx_pause = dtsec_accept_rx_pause_frames; + mac_dev->set_exception = dtsec_set_exception; + mac_dev->set_allmulti = dtsec_set_allmulti; + mac_dev->set_tstamp = dtsec_set_tstamp; + mac_dev->set_multi = fman_set_multi; + mac_dev->adjust_link = adjust_link_dtsec; + mac_dev->enable = dtsec_enable; + mac_dev->disable = dtsec_disable; + + 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) { + err = -EINVAL; + goto _return; + } + + err = dtsec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); + if (err < 0) + goto _return_fm_mac_free; + + err = dtsec_cfg_pad_and_crc(mac_dev->fman_mac, true); + if (err < 0) + goto _return_fm_mac_free; + + err = dtsec_init(mac_dev->fman_mac); + if (err < 0) + goto _return_fm_mac_free; + + /* For 1G MAC, disable by default the MIB counters overflow interrupt */ + err = mac_dev->set_exception(mac_dev->fman_mac, + FM_MAC_EX_1G_RX_MIB_CNT_OVFL, false); + if (err < 0) + goto _return_fm_mac_free; + + err = dtsec_get_version(mac_dev->fman_mac, &version); + if (err < 0) + goto _return_fm_mac_free; + + dev_info(mac_dev->dev, "FMan dTSEC version: 0x%08x\n", version); + + goto _return; + +_return_fm_mac_free: + dtsec_free(mac_dev->fman_mac); + +_return: + return err; +} diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.h b/drivers/net/ethernet/freescale/fman/fman_dtsec.h index f072cdc560ba..cf3e683c089c 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.h +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.h @@ -8,27 +8,9 @@ #include "fman_mac.h" -struct fman_mac *dtsec_config(struct fman_mac_params *params); -int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val); -int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_addr); -int dtsec_adjust_link(struct fman_mac *dtsec, - u16 speed); -int dtsec_restart_autoneg(struct fman_mac *dtsec); -int dtsec_cfg_max_frame_len(struct fman_mac *dtsec, u16 new_val); -int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val); -int dtsec_enable(struct fman_mac *dtsec); -int dtsec_disable(struct fman_mac *dtsec); -int dtsec_init(struct fman_mac *dtsec); -int dtsec_free(struct fman_mac *dtsec); -int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en); -int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, u8 priority, - u16 pause_time, u16 thresh_time); -int dtsec_set_exception(struct fman_mac *dtsec, - enum fman_mac_exceptions exception, bool enable); -int dtsec_add_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr); -int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr); -int dtsec_get_version(struct fman_mac *dtsec, u32 *mac_version); -int dtsec_set_allmulti(struct fman_mac *dtsec, bool enable); -int dtsec_set_tstamp(struct fman_mac *dtsec, bool enable); +struct mac_device; + +int dtsec_initialization(struct mac_device *mac_dev, + struct device_node *mac_node); #endif /* __DTSEC_H */ diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index c34da49aed31..b2a592a77a2a 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -7,6 +7,7 @@ #include "fman_memac.h" #include "fman.h" +#include "mac.h" #include #include @@ -774,6 +775,23 @@ int memac_adjust_link(struct fman_mac *memac, u16 speed) return 0; } +static void adjust_link_memac(struct mac_device *mac_dev) +{ + struct phy_device *phy_dev = mac_dev->phy_dev; + struct fman_mac *fman_mac; + bool rx_pause, tx_pause; + int err; + + fman_mac = mac_dev->fman_mac; + memac_adjust_link(fman_mac, phy_dev->speed); + + fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); + err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); + if (err < 0) + dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", + err); +} + int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val) { if (is_init_done(memac->memac_drv_param)) @@ -1178,3 +1196,96 @@ struct fman_mac *memac_config(struct fman_mac_params *params) return memac; } + +int memac_initialization(struct mac_device *mac_dev, + struct device_node *mac_node) +{ + int err; + struct fman_mac_params params; + struct fixed_phy_status *fixed_link; + + mac_dev->set_promisc = memac_set_promiscuous; + mac_dev->change_addr = memac_modify_mac_address; + mac_dev->add_hash_mac_addr = memac_add_hash_mac_address; + mac_dev->remove_hash_mac_addr = memac_del_hash_mac_address; + mac_dev->set_tx_pause = memac_set_tx_pause_frames; + mac_dev->set_rx_pause = memac_accept_rx_pause_frames; + mac_dev->set_exception = memac_set_exception; + mac_dev->set_allmulti = memac_set_allmulti; + mac_dev->set_tstamp = memac_set_tstamp; + mac_dev->set_multi = fman_set_multi; + mac_dev->adjust_link = adjust_link_memac; + mac_dev->enable = memac_enable; + mac_dev->disable = memac_disable; + + 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; + + mac_dev->fman_mac = memac_config(¶ms); + if (!mac_dev->fman_mac) { + err = -EINVAL; + goto _return; + } + + err = memac_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); + if (err < 0) + goto _return_fm_mac_free; + + err = memac_cfg_reset_on_init(mac_dev->fman_mac, true); + if (err < 0) + goto _return_fm_mac_free; + + if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { + struct phy_device *phy; + + err = of_phy_register_fixed_link(mac_node); + if (err) + goto _return_fm_mac_free; + + fixed_link = kzalloc(sizeof(*fixed_link), GFP_KERNEL); + if (!fixed_link) { + err = -ENOMEM; + goto _return_fm_mac_free; + } + + mac_dev->phy_node = of_node_get(mac_node); + phy = of_phy_find_device(mac_dev->phy_node); + if (!phy) { + err = -EINVAL; + of_node_put(mac_dev->phy_node); + goto _return_fixed_link_free; + } + + fixed_link->link = phy->link; + fixed_link->speed = phy->speed; + fixed_link->duplex = phy->duplex; + fixed_link->pause = phy->pause; + fixed_link->asym_pause = phy->asym_pause; + + put_device(&phy->mdio.dev); + + err = memac_cfg_fixed_link(mac_dev->fman_mac, fixed_link); + if (err < 0) + goto _return_fixed_link_free; + } + + err = memac_init(mac_dev->fman_mac); + if (err < 0) + goto _return_fixed_link_free; + + dev_info(mac_dev->dev, "FMan MEMAC\n"); + + goto _return; + +_return_fixed_link_free: + kfree(fixed_link); +_return_fm_mac_free: + memac_free(mac_dev->fman_mac); +_return: + return err; +} diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.h b/drivers/net/ethernet/freescale/fman/fman_memac.h index 535ecd2b2ab4..a58215a3b1d9 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.h +++ b/drivers/net/ethernet/freescale/fman/fman_memac.h @@ -11,26 +11,9 @@ #include #include -struct fman_mac *memac_config(struct fman_mac_params *params); -int memac_set_promiscuous(struct fman_mac *memac, bool new_val); -int memac_modify_mac_address(struct fman_mac *memac, const enet_addr_t *enet_addr); -int memac_adjust_link(struct fman_mac *memac, u16 speed); -int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val); -int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable); -int memac_cfg_fixed_link(struct fman_mac *memac, - struct fixed_phy_status *fixed_link); -int memac_enable(struct fman_mac *memac); -int memac_disable(struct fman_mac *memac); -int memac_init(struct fman_mac *memac); -int memac_free(struct fman_mac *memac); -int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en); -int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, - u16 pause_time, u16 thresh_time); -int memac_set_exception(struct fman_mac *memac, - enum fman_mac_exceptions exception, bool enable); -int memac_add_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr); -int memac_del_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr); -int memac_set_allmulti(struct fman_mac *memac, bool enable); -int memac_set_tstamp(struct fman_mac *memac, bool enable); +struct mac_device; + +int memac_initialization(struct mac_device *mac_dev, + struct device_node *mac_node); #endif /* __MEMAC_H */ diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 2b38d22c863d..2f2c4ef45f6f 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -7,6 +7,7 @@ #include "fman_tgec.h" #include "fman.h" +#include "mac.h" #include #include @@ -609,6 +610,10 @@ int tgec_del_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr) return 0; } +static void adjust_link_void(struct mac_device *mac_dev) +{ +} + int tgec_get_version(struct fman_mac *tgec, u32 *mac_version) { struct tgec_regs __iomem *regs = tgec->regs; @@ -794,3 +799,63 @@ struct fman_mac *tgec_config(struct fman_mac_params *params) return tgec; } + +int tgec_initialization(struct mac_device *mac_dev, + struct device_node *mac_node) +{ + int err; + struct fman_mac_params params; + u32 version; + + mac_dev->set_promisc = tgec_set_promiscuous; + mac_dev->change_addr = tgec_modify_mac_address; + mac_dev->add_hash_mac_addr = tgec_add_hash_mac_address; + mac_dev->remove_hash_mac_addr = tgec_del_hash_mac_address; + mac_dev->set_tx_pause = tgec_set_tx_pause_frames; + mac_dev->set_rx_pause = tgec_accept_rx_pause_frames; + mac_dev->set_exception = tgec_set_exception; + mac_dev->set_allmulti = tgec_set_allmulti; + mac_dev->set_tstamp = tgec_set_tstamp; + mac_dev->set_multi = fman_set_multi; + mac_dev->adjust_link = adjust_link_void; + mac_dev->enable = tgec_enable; + mac_dev->disable = tgec_disable; + + err = set_fman_mac_params(mac_dev, ¶ms); + if (err) + goto _return; + + mac_dev->fman_mac = tgec_config(¶ms); + if (!mac_dev->fman_mac) { + err = -EINVAL; + goto _return; + } + + err = tgec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); + if (err < 0) + goto _return_fm_mac_free; + + err = tgec_init(mac_dev->fman_mac); + if (err < 0) + goto _return_fm_mac_free; + + /* For 10G MAC, disable Tx ECC exception */ + err = mac_dev->set_exception(mac_dev->fman_mac, + FM_MAC_EX_10G_TX_ECC_ER, false); + if (err < 0) + goto _return_fm_mac_free; + + err = tgec_get_version(mac_dev->fman_mac, &version); + if (err < 0) + goto _return_fm_mac_free; + + pr_info("FMan XGEC version: 0x%08x\n", version); + + goto _return; + +_return_fm_mac_free: + tgec_free(mac_dev->fman_mac); + +_return: + return err; +} diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.h b/drivers/net/ethernet/freescale/fman/fman_tgec.h index 5b256758cbec..2e45b9fea352 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.h +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.h @@ -8,23 +8,9 @@ #include "fman_mac.h" -struct fman_mac *tgec_config(struct fman_mac_params *params); -int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val); -int tgec_modify_mac_address(struct fman_mac *tgec, const enet_addr_t *enet_addr); -int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val); -int tgec_enable(struct fman_mac *tgec); -int tgec_disable(struct fman_mac *tgec); -int tgec_init(struct fman_mac *tgec); -int tgec_free(struct fman_mac *tgec); -int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en); -int tgec_set_tx_pause_frames(struct fman_mac *tgec, u8 priority, - u16 pause_time, u16 thresh_time); -int tgec_set_exception(struct fman_mac *tgec, - enum fman_mac_exceptions exception, bool enable); -int tgec_add_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr); -int tgec_del_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr); -int tgec_get_version(struct fman_mac *tgec, u32 *mac_version); -int tgec_set_allmulti(struct fman_mac *tgec, bool enable); -int tgec_set_tstamp(struct fman_mac *tgec, bool enable); +struct mac_device; + +int tgec_initialization(struct mac_device *mac_dev, + struct device_node *mac_node); #endif /* __TGEC_H */ diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index c376b9bf657d..7afedd4995c9 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -216,267 +216,6 @@ void fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause, } EXPORT_SYMBOL(fman_get_pause_cfg); -static void adjust_link_void(struct mac_device *mac_dev) -{ -} - -static void adjust_link_dtsec(struct mac_device *mac_dev) -{ - struct phy_device *phy_dev = mac_dev->phy_dev; - struct fman_mac *fman_mac; - bool rx_pause, tx_pause; - int err; - - fman_mac = mac_dev->fman_mac; - if (!phy_dev->link) { - dtsec_restart_autoneg(fman_mac); - - return; - } - - dtsec_adjust_link(fman_mac, phy_dev->speed); - fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); - err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); - if (err < 0) - dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", - err); -} - -static void adjust_link_memac(struct mac_device *mac_dev) -{ - struct phy_device *phy_dev = mac_dev->phy_dev; - struct fman_mac *fman_mac; - bool rx_pause, tx_pause; - int err; - - fman_mac = mac_dev->fman_mac; - memac_adjust_link(fman_mac, phy_dev->speed); - - fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); - err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); - if (err < 0) - dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", - err); -} - -static int tgec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) -{ - int err; - struct fman_mac_params params; - u32 version; - - mac_dev->set_promisc = tgec_set_promiscuous; - mac_dev->change_addr = tgec_modify_mac_address; - mac_dev->add_hash_mac_addr = tgec_add_hash_mac_address; - mac_dev->remove_hash_mac_addr = tgec_del_hash_mac_address; - mac_dev->set_tx_pause = tgec_set_tx_pause_frames; - mac_dev->set_rx_pause = tgec_accept_rx_pause_frames; - mac_dev->set_exception = tgec_set_exception; - mac_dev->set_allmulti = tgec_set_allmulti; - mac_dev->set_tstamp = tgec_set_tstamp; - mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = adjust_link_void; - mac_dev->enable = tgec_enable; - mac_dev->disable = tgec_disable; - - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; - - mac_dev->fman_mac = tgec_config(¶ms); - if (!mac_dev->fman_mac) { - err = -EINVAL; - goto _return; - } - - err = tgec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = tgec_init(mac_dev->fman_mac); - if (err < 0) - goto _return_fm_mac_free; - - /* For 10G MAC, disable Tx ECC exception */ - err = mac_dev->set_exception(mac_dev->fman_mac, - FM_MAC_EX_10G_TX_ECC_ER, false); - if (err < 0) - goto _return_fm_mac_free; - - err = tgec_get_version(mac_dev->fman_mac, &version); - if (err < 0) - goto _return_fm_mac_free; - - dev_info(mac_dev->dev, "FMan XGEC version: 0x%08x\n", version); - - goto _return; - -_return_fm_mac_free: - tgec_free(mac_dev->fman_mac); - -_return: - return err; -} - -static int dtsec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) -{ - int err; - struct fman_mac_params params; - u32 version; - - mac_dev->set_promisc = dtsec_set_promiscuous; - mac_dev->change_addr = dtsec_modify_mac_address; - mac_dev->add_hash_mac_addr = dtsec_add_hash_mac_address; - mac_dev->remove_hash_mac_addr = dtsec_del_hash_mac_address; - mac_dev->set_tx_pause = dtsec_set_tx_pause_frames; - mac_dev->set_rx_pause = dtsec_accept_rx_pause_frames; - mac_dev->set_exception = dtsec_set_exception; - mac_dev->set_allmulti = dtsec_set_allmulti; - mac_dev->set_tstamp = dtsec_set_tstamp; - mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = adjust_link_dtsec; - mac_dev->enable = dtsec_enable; - mac_dev->disable = dtsec_disable; - - 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) { - err = -EINVAL; - goto _return; - } - - err = dtsec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = dtsec_cfg_pad_and_crc(mac_dev->fman_mac, true); - if (err < 0) - goto _return_fm_mac_free; - - err = dtsec_init(mac_dev->fman_mac); - if (err < 0) - goto _return_fm_mac_free; - - /* For 1G MAC, disable by default the MIB counters overflow interrupt */ - err = mac_dev->set_exception(mac_dev->fman_mac, - FM_MAC_EX_1G_RX_MIB_CNT_OVFL, false); - if (err < 0) - goto _return_fm_mac_free; - - err = dtsec_get_version(mac_dev->fman_mac, &version); - if (err < 0) - goto _return_fm_mac_free; - - dev_info(mac_dev->dev, "FMan dTSEC version: 0x%08x\n", version); - - goto _return; - -_return_fm_mac_free: - dtsec_free(mac_dev->fman_mac); - -_return: - return err; -} - -static int memac_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) -{ - int err; - struct fman_mac_params params; - struct fixed_phy_status *fixed_link; - - mac_dev->set_promisc = memac_set_promiscuous; - mac_dev->change_addr = memac_modify_mac_address; - mac_dev->add_hash_mac_addr = memac_add_hash_mac_address; - mac_dev->remove_hash_mac_addr = memac_del_hash_mac_address; - mac_dev->set_tx_pause = memac_set_tx_pause_frames; - mac_dev->set_rx_pause = memac_accept_rx_pause_frames; - mac_dev->set_exception = memac_set_exception; - mac_dev->set_allmulti = memac_set_allmulti; - mac_dev->set_tstamp = memac_set_tstamp; - mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = adjust_link_memac; - mac_dev->enable = memac_enable; - mac_dev->disable = memac_disable; - - 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; - - mac_dev->fman_mac = memac_config(¶ms); - if (!mac_dev->fman_mac) { - err = -EINVAL; - goto _return; - } - - err = memac_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = memac_cfg_reset_on_init(mac_dev->fman_mac, true); - if (err < 0) - goto _return_fm_mac_free; - - if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { - struct phy_device *phy; - - err = of_phy_register_fixed_link(mac_node); - if (err) - goto _return_fm_mac_free; - - fixed_link = kzalloc(sizeof(*fixed_link), GFP_KERNEL); - if (!fixed_link) { - err = -ENOMEM; - goto _return_fm_mac_free; - } - - mac_dev->phy_node = of_node_get(mac_node); - phy = of_phy_find_device(mac_dev->phy_node); - if (!phy) { - err = -EINVAL; - of_node_put(mac_dev->phy_node); - goto _return_fixed_link_free; - } - - fixed_link->link = phy->link; - fixed_link->speed = phy->speed; - fixed_link->duplex = phy->duplex; - fixed_link->pause = phy->pause; - fixed_link->asym_pause = phy->asym_pause; - - put_device(&phy->mdio.dev); - - err = memac_cfg_fixed_link(mac_dev->fman_mac, fixed_link); - if (err < 0) - goto _return_fixed_link_free; - } - - err = memac_init(mac_dev->fman_mac); - if (err < 0) - goto _return_fixed_link_free; - - dev_info(mac_dev->dev, "FMan MEMAC\n"); - - goto _return; - -_return_fixed_link_free: - kfree(fixed_link); -_return_fm_mac_free: - memac_free(mac_dev->fman_mac); -_return: - return err; -} - #define DTSEC_SUPPORTED \ (SUPPORTED_10baseT_Half \ | SUPPORTED_10baseT_Full \ From patchwork Tue Jun 28 22:13:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899091 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 71D97C433EF for ; Tue, 28 Jun 2022 22:30:01 +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=K938wCo/RqojMvvh/yGtmmdEquDLU8t3QkYSXeLT01o=; b=lgh7f3YHc2nmkR p9Jf5hQjWpRT5e4EEzJ7b4X3zD3B4tPiOrJ/mI+YdU/JcAAfOuec4WCB4aenDnPTB77T90q0WTvIg gKUjLhSv46vn3Q4ieg7vhqE9fHP2/iiZDKpSxJQojO5EgaxQo0+MnzBr+DVkqS6bleb2hgdOYwjlk /0hPoL1Uh9fx7qfce//NZQyF9kabmgA+OGamywvW8pXJfH6KASIqS1brmgtPNc8nCQD4wOgJz4CYo +aRGtcTwkG7J0zQ2Y5P83tqlzxeL6KpC/P17rTqfklisJd9gLZs+QwWl5gX1abuPnboLTLqkRou0s 8HyjNJPKg2A+tETw3hUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6Jh3-008Qrd-8A; Tue, 28 Jun 2022 22:28:26 +0000 Received: from mail-eopbgr80074.outbound.protection.outlook.com ([40.107.8.74] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JTy-008MXM-7W for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:14:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qgr6VKAB27J5TVSSqGLtw4T3AgErLq9g6gruQj1tvsHcX65fcMdoVlvo0qNgU524pI5ynEJRfCwLmzvbQjzW6gmoRzIgzkI8jQQaRPV8bFKX5ojEkGW8sfai2tZ0f4wxJGKHM6p582OIif6+4BLJgfmzp1epIF6gZK20PWpK7toUCdiNdP1OobqDBxq/Bf0QKTHzB+lW1ARBWTV3oG6ALGfwQYQWJWxPETBI61vHNbytLPUThVjXF8W3bojJ+cx7GkOuOXQxA1oPjZRJqxqPaW/BvODwET+RCj2tAdiiwSlE2Sm6WwQOFtFx34a6s9PwYQAzxchTP9XKHd+NvWwICA== 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=/GAo4xqLGrDuChDFBZVTNQ1ADb77ImdvHxXZi4XmcDo=; b=MjZltPV1RXJG/lr+zX/FbsMyiXhsjv3XGbG3X9TC02jJaWyLCQvVDysG3G3SMSHsWnfI3cZUVHRX7+1fjUHPtSNrBQA9dNgy5j9TpyZj3G3mP1/I4A8e3WQMlJB8Z1jOuYX9hOong6dfHSlNeXtRC2N1kluO1pww6i/NEX4Y4HmUtsJguDciUZSCVlTPXhLLybp9Jihw4r7vIeN4Bn5yQ/FuUKnbvAj35SVftNuwDJGzznq4M1L1FJEPRwsr+i+qvyg7SpJv/Xigz+5sV08qdXidP/RiP3vZTaxHMa70xN/MB8b6Mhfmjhry6zCDtYHcQtYyqWMA9lVEFmawUvm4Jg== 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=/GAo4xqLGrDuChDFBZVTNQ1ADb77ImdvHxXZi4XmcDo=; b=nglKQMn3/U/BfOLSy2xsAKDnfBWAPTvWeCcd+V65Ov6zJuq6a3NagruTqAFZ43To5+skqhykiliU2MOSvYGUesP7TKTF8F7KV+HRsHD4/+76oBOFgrYqPbONXHaUO0SVZRXF7o6gHFgo+KxWYNBT3yji47nDTGb4wZZIk690oG0TUq3jsSidvr/hnSmsJrtMjR6gncshh5UYowpgO1nc5Rh/9VpNEuP7L1vm5pb2EvsLN7NE4i8cVnbjZA0xbBeh0XyAeYPChT+UjWSSn5sL9Ym0cRouDdNb1GEW/TBSvODGgWtkRkGV0si81aExraiVynPpnj1egp1aMiSWulVTkA== 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:44 +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:44 +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 16/35] net: fman: Mark mac methods static Date: Tue, 28 Jun 2022 18:13:45 -0400 Message-Id: <20220628221404.1444200-17-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: d2bfc9c0-8bec-4ccd-0e9d-08da59539b1e 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: eUaZf9TV9O+JMF/mjerd/GF5H0pORgLw74CWJLGSne77h/A5ZA+5vY8YwhFw0Qu7+u9j/Vgw1k4LQlMnkjS5CIEsuUpFofA+CY08hFSLy/6v4qjOQ+r6u9bczNDPZuIuqkCyP3xuAz5lWU2Ofzoz66Q4dzIarNwOYWwk9h+Ooa0KkL+nlI+HRLAoK8cpnR36+vCVcYnUnliODApWQBshX0AyulGsTA/xSASqXvCB+l/wSbztoY8jSfRVyBsBw9JBq40NE6IQ2rjm8bf2RPpvYVD8XJRGpeW4fbZ1tbM3hkXd92ZxlfPrqiR7M4F0qWptRXJwGK4VrW/EwNleuyexVO16bx4h2I6C37iJK7nMy7nxbyJoiNO7qGCq7YDeSWO1P+LcLoCpd6LOJ7R4Rv23AYKiVZsH0J9R64k6psX8NwxVeKRYsm2Wi5qwjKKPQ1is5zOn7e/Fld8t3qsowEhnsWxo+zyDAt/HoSnVKs+5IVw3j3Gi5MjxE9EdtoIf8YE00sHezECL/1qFpr/xEDDBCOp7l5G7mGDajV6N5QUpLYR2FRYI4IvPhMGUWiIWcDM2tSRySrh5zQZQmssjZHMrb9gWcbPk6imFmUg/M7FzL+2hFfeVwVMzkDkMWCkw7za9sPh/QgD/KxEKGbD8TSRMqRt7r6j/ZAKhZF7+lxzRDaFMGTps84ptfzkpn89LZPAzNAUxLdBFJ01Uet2d+7G2kbgJsnuzbulHCUVypDz7QFtJkPXJ7J97O1Q/bVGWgLZ77kF1wlZhb5rW9W9CMKJKke79df42rhgh/bpOZWzBK+g= 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)(30864003)(38350700002)(1076003)(83380400001)(86362001)(2906002)(66476007)(8936002)(6486002)(4326008)(41300700001)(8676002)(26005)(52116002)(36756003)(478600001)(66946007)(2616005)(6506007)(316002)(54906003)(66556008)(107886003)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m/0gXSfE61lOv20B2JpRUGmOg5zB4uc2Lc8aCB7sOApPnae5IbuDTHOM+xm1EhfbDU9W10xmrQ8ExG7Gyfw+Vy2s3Iw8fRJZdTANc32FKW/44qeTqlC1KlRcOCT+r7VbkZNFKK6x8/zQxCgc4NHiRoYIteKuivdNbQ1LQZdL2g/3RWQr0Iule4hqfGwZPA4htV9mrUDEELBWdNAvYKRIWRawCvBfrIZp3gFnvHD2bzC0QkS//kFrc/eEgezyDhTIRAvC+5U2Q6JIz/xNgtxfJn5IR1HHSNCxrzVl2I88VTrhr1hCv+f9w3/rS5vO9MvnQX0ZEXztvF+DfK4fC2Ynz3q5rM2UbB35XV8iIIoXDaig5K2dufNF8jgUxIolhXZ2Xdf/Ol/vz4zx3Sqop5Bf/+6XAjCWwpjb/OCOOBeFFTAGTTIaN18W7Axvq9bhQ42zV/jkMD3OaC3STLnlwJC36tOKp6pQDiphl7mhlWsf4V5MI1yHoJjXKjVRJvUVoe5BslxHBaDaKr+hBA6ZEOF1spRiMd2bsmJHNe4s/QOq/aOOEj98w0wRuPTJDnlY+d2NoyuafRaI8FfmiUPhGo/HnsTdYX1YKFFa+UuCMZRM4wcp57QpqC/wsd3kizURFsgyhbFypnVO3FZOWMWjeiGEJpSMaB9Xl06atBpfQ7nz6FaqrpermPfEPnIAX5HIgJv1dQ3100jbkUFyXosxCxVu3uVzZtSo0u/1jP8k2EVlCGbQC30hIPiGZHRBSVbVshvqYmQF66MlU3jQkEuIp63VBDCbTmZRNq+r4LuRswteydJWqNPASlKPScNFJg/sX8EJvHmjSpTbUwGpOlaR9YtxJt8vPrVlygaiYGcfJ9Ch+AHC3Qfec37H19GovUUibxsk2BXxuToTCm434eRw8PB9BA7oi+GUhtJgagCCagpNJYdZJ1QtOxBqZLSBDKsfkMA90YvriJ1k3Qi2odnAxl54o8WVacirsnldpKxMg1x/VrakiKT/043xkQLOHaFVcuxNgEpUfPyf6wCY4YdvqwP0b7OWEhtTFhdgBJvKaLfqTrttixBS1JLA7M6ja58J/8/eW9/ZoVHfEA1hjLzHefVljkELlM9MWuBN/wUkf85mfYQaZ7Bdf2siybf8/bzic6By0yQDJWr1kCdN5HEYx/6sYo4moOElQTj+8zTzjmT23XXju1v+ncmNlDn2AaJweJkio0qF0OC9gHW1J+QLjnP42Icb11nIeDdktRRCDUhC+cPI3JzdtpScwdpe4Z3uXmBeOStAio0bovymw5MJ/5Wyl79PO/OYn/eH0nkybiRx7FwS9W8Di5CVaew8rcKxaCfHCOkiPYL0fdDpmYizCAvBM5Hf6465anL1bEwf8vgv1bWXQTWmmLKwlKdG0B83I8PAFTLooCXcIZABJkC4H63g95GffzAORS9zKx/GGtJANrX/fU0vASeoN2rM06I1GQxcAO9sl70EMc2EbxKo18EOIDdTpqY8VxlGeZ59dwU9IHy65QERFMPQlCDvI8LxGMQCpI5gdw3zPCNf0GoZAplA01eSfHYGzuk5mZCjJpwwt2u2PYAuFh7LcKrJEMuLcQ+/QAki6diX4YAAUBvwCJk6Dw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2bfc9c0-8bec-4ccd-0e9d-08da59539b1e 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:44.8129 (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: iF5EWE74xT1GijGkuJ6gWwGlxKOmpml/dFBU+dR4FFHceZiOMCi1NsEx6ru51d3Gj1xgfqeqJOLFZKULTSbXbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151454_371569_B6E8E03E X-CRM114-Status: UNSURE ( 9.97 ) X-CRM114-Notice: Please train this message. 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 These methods are no longer accessed outside of the driver file, so mark them as static. Signed-off-by: Sean Anderson --- (no changes since v1) .../net/ethernet/freescale/fman/fman_dtsec.c | 48 ++++++++++--------- .../net/ethernet/freescale/fman/fman_memac.c | 45 +++++++++-------- .../net/ethernet/freescale/fman/fman_tgec.c | 40 +++++++++------- 3 files changed, 72 insertions(+), 61 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 92c2e35d3b4f..6991586165d7 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -814,7 +814,7 @@ static void free_init_resources(struct fman_mac *dtsec) dtsec->unicast_addr_hash = NULL; } -int dtsec_cfg_max_frame_len(struct fman_mac *dtsec, u16 new_val) +static int dtsec_cfg_max_frame_len(struct fman_mac *dtsec, u16 new_val) { if (is_init_done(dtsec->dtsec_drv_param)) return -EINVAL; @@ -824,7 +824,7 @@ int dtsec_cfg_max_frame_len(struct fman_mac *dtsec, u16 new_val) return 0; } -int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val) +static int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val) { if (is_init_done(dtsec->dtsec_drv_param)) return -EINVAL; @@ -872,7 +872,7 @@ static void graceful_stop(struct fman_mac *dtsec) } } -int dtsec_enable(struct fman_mac *dtsec) +static int dtsec_enable(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; @@ -891,7 +891,7 @@ int dtsec_enable(struct fman_mac *dtsec) return 0; } -int dtsec_disable(struct fman_mac *dtsec) +static int dtsec_disable(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; @@ -909,9 +909,10 @@ int dtsec_disable(struct fman_mac *dtsec) return 0; } -int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, - u8 __maybe_unused priority, - u16 pause_time, u16 __maybe_unused thresh_time) +static int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, + u8 __maybe_unused priority, + u16 pause_time, + u16 __maybe_unused thresh_time) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 ptv = 0; @@ -946,7 +947,7 @@ int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, return 0; } -int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en) +static int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; @@ -968,7 +969,8 @@ int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en) return 0; } -int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_addr) +static int dtsec_modify_mac_address(struct fman_mac *dtsec, + const enet_addr_t *enet_addr) { if (!is_init_done(dtsec->dtsec_drv_param)) return -EINVAL; @@ -986,7 +988,8 @@ int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_add return 0; } -int dtsec_add_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) +static int dtsec_add_hash_mac_address(struct fman_mac *dtsec, + enet_addr_t *eth_addr) { struct dtsec_regs __iomem *regs = dtsec->regs; struct eth_hash_entry *hash_entry; @@ -1052,7 +1055,7 @@ int dtsec_add_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) return 0; } -int dtsec_set_allmulti(struct fman_mac *dtsec, bool enable) +static int dtsec_set_allmulti(struct fman_mac *dtsec, bool enable) { u32 tmp; struct dtsec_regs __iomem *regs = dtsec->regs; @@ -1071,7 +1074,7 @@ int dtsec_set_allmulti(struct fman_mac *dtsec, bool enable) return 0; } -int dtsec_set_tstamp(struct fman_mac *dtsec, bool enable) +static int dtsec_set_tstamp(struct fman_mac *dtsec, bool enable) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 rctrl, tctrl; @@ -1096,7 +1099,8 @@ int dtsec_set_tstamp(struct fman_mac *dtsec, bool enable) return 0; } -int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) +static int dtsec_del_hash_mac_address(struct fman_mac *dtsec, + enet_addr_t *eth_addr) { struct dtsec_regs __iomem *regs = dtsec->regs; struct list_head *pos; @@ -1167,7 +1171,7 @@ int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) return 0; } -int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val) +static int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; @@ -1196,7 +1200,7 @@ int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val) return 0; } -int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed) +static int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; @@ -1230,7 +1234,7 @@ int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed) return 0; } -int dtsec_restart_autoneg(struct fman_mac *dtsec) +static int dtsec_restart_autoneg(struct fman_mac *dtsec) { u16 tmp_reg16; @@ -1270,7 +1274,7 @@ static void adjust_link_dtsec(struct mac_device *mac_dev) err); } -int dtsec_get_version(struct fman_mac *dtsec, u32 *mac_version) +static int dtsec_get_version(struct fman_mac *dtsec, u32 *mac_version) { struct dtsec_regs __iomem *regs = dtsec->regs; @@ -1282,8 +1286,8 @@ int dtsec_get_version(struct fman_mac *dtsec, u32 *mac_version) return 0; } -int dtsec_set_exception(struct fman_mac *dtsec, - enum fman_mac_exceptions exception, bool enable) +static int dtsec_set_exception(struct fman_mac *dtsec, + enum fman_mac_exceptions exception, bool enable) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 bit_mask = 0; @@ -1336,7 +1340,7 @@ int dtsec_set_exception(struct fman_mac *dtsec, return 0; } -int dtsec_init(struct fman_mac *dtsec) +static int dtsec_init(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; struct dtsec_cfg *dtsec_drv_param; @@ -1430,7 +1434,7 @@ int dtsec_init(struct fman_mac *dtsec) return 0; } -int dtsec_free(struct fman_mac *dtsec) +static int dtsec_free(struct fman_mac *dtsec) { free_init_resources(dtsec); @@ -1441,7 +1445,7 @@ int dtsec_free(struct fman_mac *dtsec) return 0; } -struct fman_mac *dtsec_config(struct fman_mac_params *params) +static struct fman_mac *dtsec_config(struct fman_mac_params *params) { struct fman_mac *dtsec; struct dtsec_cfg *dtsec_drv_param; diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index b2a592a77a2a..d3f4c3ec58c5 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -686,7 +686,7 @@ static bool is_init_done(struct memac_cfg *memac_drv_params) return false; } -int memac_enable(struct fman_mac *memac) +static int memac_enable(struct fman_mac *memac) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -701,7 +701,7 @@ int memac_enable(struct fman_mac *memac) return 0; } -int memac_disable(struct fman_mac *memac) +static int memac_disable(struct fman_mac *memac) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -716,7 +716,7 @@ int memac_disable(struct fman_mac *memac) return 0; } -int memac_set_promiscuous(struct fman_mac *memac, bool new_val) +static int memac_set_promiscuous(struct fman_mac *memac, bool new_val) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -735,7 +735,7 @@ int memac_set_promiscuous(struct fman_mac *memac, bool new_val) return 0; } -int memac_adjust_link(struct fman_mac *memac, u16 speed) +static int memac_adjust_link(struct fman_mac *memac, u16 speed) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -792,7 +792,7 @@ static void adjust_link_memac(struct mac_device *mac_dev) err); } -int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val) +static int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val) { if (is_init_done(memac->memac_drv_param)) return -EINVAL; @@ -802,7 +802,7 @@ int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val) return 0; } -int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable) +static int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable) { if (is_init_done(memac->memac_drv_param)) return -EINVAL; @@ -812,8 +812,8 @@ int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable) return 0; } -int memac_cfg_fixed_link(struct fman_mac *memac, - struct fixed_phy_status *fixed_link) +static int memac_cfg_fixed_link(struct fman_mac *memac, + struct fixed_phy_status *fixed_link) { if (is_init_done(memac->memac_drv_param)) return -EINVAL; @@ -823,8 +823,8 @@ int memac_cfg_fixed_link(struct fman_mac *memac, return 0; } -int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, - u16 pause_time, u16 thresh_time) +static int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, + u16 pause_time, u16 thresh_time) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -861,7 +861,7 @@ int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, return 0; } -int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en) +static int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; @@ -880,7 +880,8 @@ int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en) return 0; } -int memac_modify_mac_address(struct fman_mac *memac, const enet_addr_t *enet_addr) +static int memac_modify_mac_address(struct fman_mac *memac, + const enet_addr_t *enet_addr) { if (!is_init_done(memac->memac_drv_param)) return -EINVAL; @@ -890,7 +891,8 @@ int memac_modify_mac_address(struct fman_mac *memac, const enet_addr_t *enet_add return 0; } -int memac_add_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr) +static int memac_add_hash_mac_address(struct fman_mac *memac, + enet_addr_t *eth_addr) { struct memac_regs __iomem *regs = memac->regs; struct eth_hash_entry *hash_entry; @@ -923,7 +925,7 @@ int memac_add_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr) return 0; } -int memac_set_allmulti(struct fman_mac *memac, bool enable) +static int memac_set_allmulti(struct fman_mac *memac, bool enable) { u32 entry; struct memac_regs __iomem *regs = memac->regs; @@ -946,12 +948,13 @@ int memac_set_allmulti(struct fman_mac *memac, bool enable) return 0; } -int memac_set_tstamp(struct fman_mac *memac, bool enable) +static int memac_set_tstamp(struct fman_mac *memac, bool enable) { return 0; /* Always enabled. */ } -int memac_del_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr) +static int memac_del_hash_mac_address(struct fman_mac *memac, + enet_addr_t *eth_addr) { struct memac_regs __iomem *regs = memac->regs; struct eth_hash_entry *hash_entry = NULL; @@ -984,8 +987,8 @@ int memac_del_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr) return 0; } -int memac_set_exception(struct fman_mac *memac, - enum fman_mac_exceptions exception, bool enable) +static int memac_set_exception(struct fman_mac *memac, + enum fman_mac_exceptions exception, bool enable) { u32 bit_mask = 0; @@ -1007,7 +1010,7 @@ int memac_set_exception(struct fman_mac *memac, return 0; } -int memac_init(struct fman_mac *memac) +static int memac_init(struct fman_mac *memac) { struct memac_cfg *memac_drv_param; u8 i; @@ -1124,7 +1127,7 @@ int memac_init(struct fman_mac *memac) return 0; } -int memac_free(struct fman_mac *memac) +static int memac_free(struct fman_mac *memac) { free_init_resources(memac); @@ -1137,7 +1140,7 @@ int memac_free(struct fman_mac *memac) return 0; } -struct fman_mac *memac_config(struct fman_mac_params *params) +static struct fman_mac *memac_config(struct fman_mac_params *params) { struct fman_mac *memac; struct memac_cfg *memac_drv_param; diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 2f2c4ef45f6f..ca0e00386c66 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -393,7 +393,7 @@ static bool is_init_done(struct tgec_cfg *cfg) return false; } -int tgec_enable(struct fman_mac *tgec) +static int tgec_enable(struct fman_mac *tgec) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; @@ -408,7 +408,7 @@ int tgec_enable(struct fman_mac *tgec) return 0; } -int tgec_disable(struct fman_mac *tgec) +static int tgec_disable(struct fman_mac *tgec) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; @@ -423,7 +423,7 @@ int tgec_disable(struct fman_mac *tgec) return 0; } -int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) +static int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; @@ -441,7 +441,7 @@ int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) return 0; } -int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val) +static int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val) { if (is_init_done(tgec->cfg)) return -EINVAL; @@ -451,8 +451,9 @@ int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val) return 0; } -int tgec_set_tx_pause_frames(struct fman_mac *tgec, u8 __maybe_unused priority, - u16 pause_time, u16 __maybe_unused thresh_time) +static int tgec_set_tx_pause_frames(struct fman_mac *tgec, + u8 __maybe_unused priority, u16 pause_time, + u16 __maybe_unused thresh_time) { struct tgec_regs __iomem *regs = tgec->regs; @@ -464,7 +465,7 @@ int tgec_set_tx_pause_frames(struct fman_mac *tgec, u8 __maybe_unused priority, return 0; } -int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en) +static int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; @@ -482,7 +483,8 @@ int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en) return 0; } -int tgec_modify_mac_address(struct fman_mac *tgec, const enet_addr_t *p_enet_addr) +static int tgec_modify_mac_address(struct fman_mac *tgec, + const enet_addr_t *p_enet_addr) { if (!is_init_done(tgec->cfg)) return -EINVAL; @@ -493,7 +495,8 @@ int tgec_modify_mac_address(struct fman_mac *tgec, const enet_addr_t *p_enet_add return 0; } -int tgec_add_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr) +static int tgec_add_hash_mac_address(struct fman_mac *tgec, + enet_addr_t *eth_addr) { struct tgec_regs __iomem *regs = tgec->regs; struct eth_hash_entry *hash_entry; @@ -530,7 +533,7 @@ int tgec_add_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr) return 0; } -int tgec_set_allmulti(struct fman_mac *tgec, bool enable) +static int tgec_set_allmulti(struct fman_mac *tgec, bool enable) { u32 entry; struct tgec_regs __iomem *regs = tgec->regs; @@ -553,7 +556,7 @@ int tgec_set_allmulti(struct fman_mac *tgec, bool enable) return 0; } -int tgec_set_tstamp(struct fman_mac *tgec, bool enable) +static int tgec_set_tstamp(struct fman_mac *tgec, bool enable) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; @@ -573,7 +576,8 @@ int tgec_set_tstamp(struct fman_mac *tgec, bool enable) return 0; } -int tgec_del_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr) +static int tgec_del_hash_mac_address(struct fman_mac *tgec, + enet_addr_t *eth_addr) { struct tgec_regs __iomem *regs = tgec->regs; struct eth_hash_entry *hash_entry = NULL; @@ -614,7 +618,7 @@ static void adjust_link_void(struct mac_device *mac_dev) { } -int tgec_get_version(struct fman_mac *tgec, u32 *mac_version) +static int tgec_get_version(struct fman_mac *tgec, u32 *mac_version) { struct tgec_regs __iomem *regs = tgec->regs; @@ -626,8 +630,8 @@ int tgec_get_version(struct fman_mac *tgec, u32 *mac_version) return 0; } -int tgec_set_exception(struct fman_mac *tgec, - enum fman_mac_exceptions exception, bool enable) +static int tgec_set_exception(struct fman_mac *tgec, + enum fman_mac_exceptions exception, bool enable) { struct tgec_regs __iomem *regs = tgec->regs; u32 bit_mask = 0; @@ -653,7 +657,7 @@ int tgec_set_exception(struct fman_mac *tgec, return 0; } -int tgec_init(struct fman_mac *tgec) +static int tgec_init(struct fman_mac *tgec) { struct tgec_cfg *cfg; enet_addr_t eth_addr; @@ -736,7 +740,7 @@ int tgec_init(struct fman_mac *tgec) return 0; } -int tgec_free(struct fman_mac *tgec) +static int tgec_free(struct fman_mac *tgec) { free_init_resources(tgec); @@ -746,7 +750,7 @@ int tgec_free(struct fman_mac *tgec) return 0; } -struct fman_mac *tgec_config(struct fman_mac_params *params) +static struct fman_mac *tgec_config(struct fman_mac_params *params) { struct fman_mac *tgec; struct tgec_cfg *cfg; From patchwork Tue Jun 28 22:13:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899093 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 163E4C433EF for ; Tue, 28 Jun 2022 22:32:33 +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=snSEgWLW2nxnduBPe1uqwcEAj6UZeBFuCqkIlRRlCq4=; b=Q0aXJb2HnaPxRh x5774YIHMvcPIe6jNZgkjPAzSIMbCMa5367DjGJ1z4icJ+na84IklF1dRq6Rcuk9szDLfTwYVMykp YPOD+I07Jpfu3eq6i17mpdxWJgqR5FKyRilIAa/Sbla4Yo+Oid+SMbf9OCXSiqrlfa6glBYTQ7o/F vrtFdDD8n1NudlyPybNRK3iygnkf2sGGa677akt/cYvYgotWHMTOdklfVOaog56YoZNhOBakr9nwR 2ZDsfcAS8k22kM77zgO9yBwHTGfA21Op6W+F3Vm7eMXFde3wdHU6YItAPDae7JzTKLwgGQRu7G7uu JeW3aP9GvZ1iql8NRrcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JjP-008RT2-OU; Tue, 28 Jun 2022 22:30:53 +0000 Received: from mail-eopbgr80072.outbound.protection.outlook.com ([40.107.8.72] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JU0-008Mcr-G0 for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jAwLEUEfTSbH8JU4ihLEkQekyXlPq8sJ6Q25nIMKeZLb6uF5UG3wuktFbDseDjXCqfbDVhg3Bs62eGMzqoKFMooeBBhiusNBAG/CBSqSvaws6ZNsu46tOu4FcjxYL8lHQbL2baLe4tSn0HtoWQtsATWRzoanZTI6lvpWe0wt/40XbZZvrJrWy8K+zEXhVgJr2VsOOjTgcpaJngX5oAXZPRYRoGZHKQRNhwpexkc1XnwFKo+qa8RTenaqf0r1YGNdnVBul1iUbuQ5RUIqBhxki15vKAKC6XSZutpBhKv9By8jwqarL7+Z8xRRzveifOXvqqAKYhPTdhipQcI0uoxzGA== 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=4qd7EzQyq3QvpjHXKrDtvYwf5S4MGKCtL3v+EBh//8M=; b=ZfA1FcCkjebnPlINNcDXyJrWkv8ZkeuuXaGG9xtTE2gsttyLtusbjUEvoiCA+eoi0JccsX3m/LxGKpa5cD70VkXYOeU2lGRicAND3Q3MMIYRsN316t8ULmgosQMoZRYpLljtauF8A26vsc49rh84FCcc+mTgQEpZfvpDtoXtVtxz4txEacW/61LFCMYHod6qGxurnebayXHkPMi3Payr6dfLa/2xe5ABN6E0H6nL93wGqvrEHZs2ooHxnbUs5xzqgvdvSn0u7Z7hCyTRCbKh6jSc8c+YiB2DuohfasezeCq1RVVAdQYI/rFT2V90NkZ2Ap3XQu2x8gS7bKAX1JM0sw== 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=4qd7EzQyq3QvpjHXKrDtvYwf5S4MGKCtL3v+EBh//8M=; b=oaDnJWTmhpagtUoz/WLLALFipQYPUyPI+5RzcC5+gh5On4B1rZ901xgnwUjGLcKqIks4XT9kiDu838wTy9jFIvFLNFFtRWD8G7mvxJARHMqGUPTGYcow1t1sikUvGMBQUyhZp8KoJKn49NqZJjYd3RZHT3sBPXv+EIvhf5kuir+ZBhGtflAxpH1NDHf0i/LKYqdonA+5eVOCwSUiMjRdM8sZV5mZAQcVYj6mWXsVRlgp/L1zLHjN0EgUgaxCvhcDWOWjwb3E0+7WD1bK/lVVxsbgIDK71qk9cYiIrJVibKvOsSuTX4NJX89pfYcIBBTL85WNorq6c6sXooyK/3YVHw== 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:46 +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:46 +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 17/35] net: fman: Inline several functions into initialization Date: Tue, 28 Jun 2022 18:13:46 -0400 Message-Id: <20220628221404.1444200-18-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: 6906e506-8fe0-4ed5-c38a-08da59539c1a 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: fl8d2rVPLgx1Vc5Il0k5N8TsP44OozLpTOhqXJgPPjcwP40eRZq3afhAnu2HU3xQzYoy/zJmt9cTxsWLw8R+KyU/IDutbSF03wbEdWTbgVKhGBjdUuGqIy0zk6AeNqYAVepWfPe0X1gDL4ERlUcYE4usruNiYmd2N13Ki4E1YqUxhKD0mppGoIsUXxwvoAHXfOW+GUmcozrmqHMk/QVOjRhDIrDFekR1kzrBCN3P4YXTJNzs15lTOgUJPET3M/pkC2rVDicoRcgrFN806Wp6ej1d+1DXEJi9W12LEfHERhNU2rq0BQ+TDo6cqOCrSlA2y6zap75WTNXxwbuVXDsMbgGzwqopNIZDi2nKqDZ8iocAZ5vGdQOrtiyqh/3EdlrhuogNKKLdNNIjRhR9eKFnzP3q9QxJURk4N0YFdsfHRZQRWgKDkidJ5My/Dvz7z3g8Q4qpDJBXxXwTxiJ/zxv3RG3Ai9DyjNfIB8k5zsCSLtIznWrYlvHj+sYuj8yJq7eGOW/LBXOu4H5iGkbcUOYS/7RmcnqbgnhEVVSpLRE+SbL+lOD/iUCSPxr8xXzM9HbwaOIvJeQJbK5+r5xMPWYsNla2fSLI/HtwUKUOcOwamUv/zyiTF9ZO05tlSQ3Un+Nor6TYtJBXZrbXYS9idpX/zK5mcqQvcQKYzWsGe1UbPwYRZK//5wF+H51iTURxC6dlid8t2E6OHIloryJuY5MhDgZnPqYDJ1XL45mko6Ca9En0d1b8jWIgR/XbLOranOddBFGJID6zoDHX1C+ZaXvgjtIq4T5Rz9sPxh+K0wbgRTI= 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)(107886003)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UUjt+MTxyA9T2/6vWzDWErDNY6FIVz2rRnly9JiCN76uoxlVFkzvPujfQ7yrHhW/HqKbtQ/Jp4oGMyb6OFbyNXfDSlFeOSQ2PtOk58myzrNO8pIZuLO3afnO3LaiJJBoQ+M/yog1uHuic1Fi9LuWVkxGZXwYINjN7m7t+Yqg60ufwdEt4MILn5yMCXW2sSEhmD55Ru0C/o9vzMWwfb1Qosq/L911hD9llbqftLBZpcFpeneD+WyV7eWbJtULDB3zmIgM9PECx4jZmAPsWSLUCBwPl68N4O8IwAd9hQsLe46xoHNVG+wCvH5X2f17bkBGBQR3kycF47ZKsWzls2A/QL7uB20GLLKRTOZHpGoREIkAWMXIozqfv1aciUZgtIgngqxAEcQkfPU9YAgkRdAFEJK6Sw52QfN/y5gWZFbMCCaXZhUTWZXYxwM3DJnmQdt3dtqcjgnaY+fG3s07XYnPdNQmeXLgY4mwQW55zYZ8D8zBCoV243m3FfvgNrpdom0l+YBbdL43xzQ+Z6rfq3mBL1zIK+XG28A7BrJ+ux2T5RztHLOGB4a8deoi6os7tblNHYoyYudDYPxV/ijKL+I8upzxV32Hm0frLrNGx5x8GwL19/5oUAiHrA2rk8qV1XQUMKndLzq+mitksY7MOGaFcqwIh96VYZI4XvJyGtNhIB03TWvq6RTxcuvH1ajNg6ihgebaouJzjlvFZwAu2nbBy89zYVHFVxHp9zgucOXF00ROjCnnR3wYF23/AWJqFbZd//eqgnaq5vbo2rQv76pHl3l0HkX3aQJwHPX7AFz8tTdrn14hqXt5IDyADvn2+x4jr3gMPKwxHJ7bafw/j6y+PrHNQBAwihIopepw9/78+mzE/XAc/Mz1dkgMa/gKeBP+qoE3ov/KK8etI5ZbRnlJC/oV7vBdNyvLmUd9uGlSkFfKFJX81GxGtxZNDTeGFtfOdkXcmNt4ehTuFIXSsv7LfPwMu3D3STYPcZXf8KSK4el22akR6D7yKk63QRpoeXS0a88EzjVOTMCoCwZbukT57bDxIpvk3aj41CKLeAXLYxaoMDys/+cTNVxrGbm+Vxxvr1UiphAG7MREDK1L6+uahkN1lHwIzXJ0xX04Oeb2ERTMkY6/I30XGI0N9Ok15eAxL3AyrGOUExgg0CAvRQYRsAX28Tl03J1pw18loYV43QW507zgTVAOEunurrE4Op/8czkzRh+v10Ln0VB852iRo7ke3sj3BNMUzaklZqkktJvolEaqS6mA8M9/FmqIrcd+84NtG2GV5hfzfZgRmXlTiNwO4cY7UGE2RUhuN3sU887kCCYu238wesOEmIXmvse11jLTHpRDTFSh2Zn7Whh+2y/ntmZJDakRQxZzyDdIjX9ykwhs5Nk1H5qKaDg4dGw3OyWGMZu7rVhxxhXY1C/qDpa4ozU6fjFb1MCI9iC8yaX0Mk2L2EqAQfa5EeRnIaQGOrHk+iGXdvxYHoF47CFNoSvhE9HKd3VHc6w52Wzkdy71j9PnV8rqRvypdp7oFvTGUDhXb3p9xQ7zv311V6ES0+KLD49I+xnVvVzALFO0GSGWMFQNgQ4w5qWdM4kg1/776DEZ4420J6y5sww21P8TAA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6906e506-8fe0-4ed5-c38a-08da59539c1a 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:46.3597 (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: 8Gzcl93Z9/8ki5vPUDK9rtnIMsS4Uyj7N9qNCMpcwi0fW2IWh7un26zzFZJFfo86HF/4FtR2DcfPF5DeCmztQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151456_735024_C4B9FB77 X-CRM114-Status: GOOD ( 11.96 ) 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 There are several small functions which weer only necessary because the initialization functions didn't have access to the mac private data. Now that they do, just do things directly. Signed-off-by: Sean Anderson --- (no changes since v1) .../net/ethernet/freescale/fman/fman_dtsec.c | 59 +++---------------- .../net/ethernet/freescale/fman/fman_memac.c | 47 ++------------- .../net/ethernet/freescale/fman/fman_tgec.c | 43 +++----------- 3 files changed, 21 insertions(+), 128 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 6991586165d7..84205be3a817 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -814,26 +814,6 @@ static void free_init_resources(struct fman_mac *dtsec) dtsec->unicast_addr_hash = NULL; } -static int dtsec_cfg_max_frame_len(struct fman_mac *dtsec, u16 new_val) -{ - if (is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - dtsec->dtsec_drv_param->maximum_frame = new_val; - - return 0; -} - -static int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val) -{ - if (is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - dtsec->dtsec_drv_param->tx_pad_crc = new_val; - - return 0; -} - static void graceful_start(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; @@ -1274,18 +1254,6 @@ static void adjust_link_dtsec(struct mac_device *mac_dev) err); } -static int dtsec_get_version(struct fman_mac *dtsec, u32 *mac_version) -{ - struct dtsec_regs __iomem *regs = dtsec->regs; - - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - *mac_version = ioread32be(®s->tsec_id); - - return 0; -} - static int dtsec_set_exception(struct fman_mac *dtsec, enum fman_mac_exceptions exception, bool enable) { @@ -1525,7 +1493,7 @@ int dtsec_initialization(struct mac_device *mac_dev, { int err; struct fman_mac_params params; - u32 version; + struct fman_mac *dtsec; mac_dev->set_promisc = dtsec_set_promiscuous; mac_dev->change_addr = dtsec_modify_mac_address; @@ -1552,34 +1520,25 @@ int dtsec_initialization(struct mac_device *mac_dev, goto _return; } - err = dtsec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = dtsec_cfg_pad_and_crc(mac_dev->fman_mac, true); - if (err < 0) - goto _return_fm_mac_free; - - err = dtsec_init(mac_dev->fman_mac); + dtsec = mac_dev->fman_mac; + dtsec->dtsec_drv_param->maximum_frame = fman_get_max_frm(); + dtsec->dtsec_drv_param->tx_pad_crc = true; + err = dtsec_init(dtsec); if (err < 0) goto _return_fm_mac_free; /* For 1G MAC, disable by default the MIB counters overflow interrupt */ - err = mac_dev->set_exception(mac_dev->fman_mac, - FM_MAC_EX_1G_RX_MIB_CNT_OVFL, false); + err = dtsec_set_exception(dtsec, FM_MAC_EX_1G_RX_MIB_CNT_OVFL, false); if (err < 0) goto _return_fm_mac_free; - err = dtsec_get_version(mac_dev->fman_mac, &version); - if (err < 0) - goto _return_fm_mac_free; - - dev_info(mac_dev->dev, "FMan dTSEC version: 0x%08x\n", version); + dev_info(mac_dev->dev, "FMan dTSEC version: 0x%08x\n", + ioread32be(&dtsec->regs->tsec_id)); goto _return; _return_fm_mac_free: - dtsec_free(mac_dev->fman_mac); + dtsec_free(dtsec); _return: return err; diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index d3f4c3ec58c5..039f71e31efc 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -792,37 +792,6 @@ static void adjust_link_memac(struct mac_device *mac_dev) err); } -static int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val) -{ - if (is_init_done(memac->memac_drv_param)) - return -EINVAL; - - memac->memac_drv_param->max_frame_length = new_val; - - return 0; -} - -static int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable) -{ - if (is_init_done(memac->memac_drv_param)) - return -EINVAL; - - memac->memac_drv_param->reset_on_init = enable; - - return 0; -} - -static int memac_cfg_fixed_link(struct fman_mac *memac, - struct fixed_phy_status *fixed_link) -{ - if (is_init_done(memac->memac_drv_param)) - return -EINVAL; - - memac->memac_drv_param->fixed_link = fixed_link; - - return 0; -} - static int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, u16 pause_time, u16 thresh_time) { @@ -1206,6 +1175,7 @@ int memac_initialization(struct mac_device *mac_dev, int err; struct fman_mac_params params; struct fixed_phy_status *fixed_link; + struct fman_mac *memac; mac_dev->set_promisc = memac_set_promiscuous; mac_dev->change_addr = memac_modify_mac_address; @@ -1235,13 +1205,9 @@ int memac_initialization(struct mac_device *mac_dev, goto _return; } - err = memac_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = memac_cfg_reset_on_init(mac_dev->fman_mac, true); - if (err < 0) - goto _return_fm_mac_free; + 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 (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { struct phy_device *phy; @@ -1271,10 +1237,7 @@ int memac_initialization(struct mac_device *mac_dev, fixed_link->asym_pause = phy->asym_pause; put_device(&phy->mdio.dev); - - err = memac_cfg_fixed_link(mac_dev->fman_mac, fixed_link); - if (err < 0) - goto _return_fixed_link_free; + memac->memac_drv_param->fixed_link = fixed_link; } err = memac_init(mac_dev->fman_mac); diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index ca0e00386c66..32ee1674ff2f 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -441,16 +441,6 @@ static int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) return 0; } -static int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val) -{ - if (is_init_done(tgec->cfg)) - return -EINVAL; - - tgec->cfg->max_frame_length = new_val; - - return 0; -} - static int tgec_set_tx_pause_frames(struct fman_mac *tgec, u8 __maybe_unused priority, u16 pause_time, u16 __maybe_unused thresh_time) @@ -618,18 +608,6 @@ static void adjust_link_void(struct mac_device *mac_dev) { } -static int tgec_get_version(struct fman_mac *tgec, u32 *mac_version) -{ - struct tgec_regs __iomem *regs = tgec->regs; - - if (!is_init_done(tgec->cfg)) - return -EINVAL; - - *mac_version = ioread32be(®s->tgec_id); - - return 0; -} - static int tgec_set_exception(struct fman_mac *tgec, enum fman_mac_exceptions exception, bool enable) { @@ -809,7 +787,7 @@ int tgec_initialization(struct mac_device *mac_dev, { int err; struct fman_mac_params params; - u32 version; + struct fman_mac *tgec; mac_dev->set_promisc = tgec_set_promiscuous; mac_dev->change_addr = tgec_modify_mac_address; @@ -835,26 +813,19 @@ int tgec_initialization(struct mac_device *mac_dev, goto _return; } - err = tgec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm()); - if (err < 0) - goto _return_fm_mac_free; - - err = tgec_init(mac_dev->fman_mac); + tgec = mac_dev->fman_mac; + tgec->cfg->max_frame_length = fman_get_max_frm(); + err = tgec_init(tgec); if (err < 0) goto _return_fm_mac_free; /* For 10G MAC, disable Tx ECC exception */ - err = mac_dev->set_exception(mac_dev->fman_mac, - FM_MAC_EX_10G_TX_ECC_ER, false); + err = tgec_set_exception(tgec, FM_MAC_EX_10G_TX_ECC_ER, false); if (err < 0) goto _return_fm_mac_free; - err = tgec_get_version(mac_dev->fman_mac, &version); - if (err < 0) - goto _return_fm_mac_free; - - pr_info("FMan XGEC version: 0x%08x\n", version); - + pr_info("FMan XGEC version: 0x%08x\n", + ioread32be(&tgec->regs->tgec_id)); goto _return; _return_fm_mac_free: From patchwork Tue Jun 28 22:13:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899094 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 B1EBFC43334 for ; Tue, 28 Jun 2022 22:33:55 +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=MuwE1cwhQJU89/ ws5yvhkN8kSXRLgwZwsjvcYeqwX9Hy7X+QK3SeY6QhLy9xDGKCwW5Kti3DqDfXvieBkKipTrbePWw yB6nisKbS5vUkhrz6jcRVoxCk0E3q35Kfg2kPWt61MINdsVqSTx6ptwESO5pcJ1PhaZT+PoHLY6PA s4kWqUBtoI6fL2oSG0bDpC2et7964dKmi4lxutYQU0VmzoDHklkjKNccjyNu2dLZsvDvvnDHwv8sB O8Idem1lnYl2iJAF8TWbJUHVj9hGjbOtmeXu+TsSUOPdL5p8NHxONeP4iKXKR+PBBf5U8vDhtLdr9 dCP8DJUt/m0BrkIQvyjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6Jkh-008RkP-8c; Tue, 28 Jun 2022 22:32:13 +0000 Received: from mail-eopbgr80074.outbound.protection.outlook.com ([40.107.8.74] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JU1-008MXM-H8 for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I33RLkdqZWvxftyR1wXjz9JAuZ9h1x5VP+LJ58S+0JoMFVn2Frsv8Pdgbbg0u7/6DRQZm6olALj4yzIMimFwx/JSkihKT9dsSCTUvze9ZuAFjf+WZlor2v8ChfcIlqD7e4eObhivNgXB61ehcOpJRzUHLy2HIu3qrNRbPr9Vus5YJHZA7r/+EgFjN5YTeT1pDQJWYEue9AToajBDH/NSMyG6eAYcmLGxGrkNn01qo8u4J3zrXQNEEdAra2nb1i8YYZSg5ZBgQQvry7yM2ZpyEUIIQG7xIq4ea/BsjIEi1YoC0TP5DrnALUP33uXlv0hsQu7oZ+oKKUQkRkvP7WPRzA== 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=DTCDSAF2YdQatXWZWJZOh6FCOaFsn0yumKnCXWKGXkqaQek7KpdDqJHPnrhi0tKmrCr499teDjQ1d8apexMNuc5yXNO4Z5vryI7FOarkZFUU3U3/lYzZ0Otobk74VRNfuBWRxOlm9Br2IGsIgVVGfYf+vgy8Y80608St0YD2s1E8AxWBCD8AnSQolL71+fguzV3nxhVaLb4iL9shkJLC53z/iD41gvmH1Zo+VudPgyrBXYCs/sVYGGyQ/vHz9QjzXOq5x9di5G1OAYYJnOM5Rdq6joAhwxl0OdK2XpRcx+/BG1OzmI7cBfsW9VJXGlSqpEoPtrdzXHvzWVXGEXDegw== 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=wOxTdf4dVRwTFAF79vn9118sdejM/LN42CHsrcXjUj+XSlPY6+t10OMCtSff0x4nB0l438bNjmAiJP6bDuQQMfERcV1IIq9iYcNou67PC5TXYcEDAX9FyLet4mbTasHy8oZ7SKCfzfuCtbwLpgfrcxo0CHouYu+hosgQW9QMfHHigRdY5OhtEuxpYrV/cx3PcVS82RpfyreWbSq4sVgFm+m2prGPzSVvxGXXbur9c/Rbj8U2FCFL05D12+jgjgEsGtjJCSy++/52UxykH8n69QVTazqMx6bi5Y7dhbE29OVISdvHdzV7sAs5WLuQO0FB6t2Z2ONpFIMRzQZry+mbqQ== 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:47 +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:47 +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 18/35] net: fman: Remove internal_phy_node from params Date: Tue, 28 Jun 2022 18:13:47 -0400 Message-Id: <20220628221404.1444200-19-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: 08ee8187-2267-4854-dcb7-08da59539cfa 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: OzlCwpVoSiCpcozBjlXSKk7XFGQOJkzamrLR8VLBTYVsMZiQObgbrnRlElicLXxNPaVqsYo19bNY8tnKUDX8EJXvmUNL6c55PfpLVz1b1SCGaCDPaUWdaXTfl5ejtmfGNXMMWzL8Mjo/4fzUzDWJ5OuqFMPPLnbm+ZXcQTvj8SmsIFkp3vHvryd/axHTfDo/0FEdIypfN+yBaz+dnWgcDW2rmKs3TLXzyisb3l2G8LQzqELhz5B/dzAtSCsrJcQys/cXxIEW14FSyF0UI91lJoIcSAK7U+sfuZbEYcA4uCSE1aP8vZxMJsG3DPYUaYgQYPhTF4Zknin8QtAaIREQH7FfSqm5p+mSh9LlFKqyZKVh58fK6mqAXGgDZwcaO3oBTwgtGnfm5yoeHE5/FEogW5eLmugwDmR05kjpllXrbBUL1OJGenU7esqM6kh2Q9AzFc583K5OZ/YPxDil9kI6WFmgjBTNGW55VDaijEFAsBybsj19RVWxvGHJFWxoAsz9Ndqq+Hf7d5qehMtZMl3cvdyuHz7WEyYv+NaNQ0ZLT51TWqSOKpViYP/qfieHzYoIzsacekPQk2g5Nmb9EPH0bvGbyV77NHP3LTU6VJxqa7WTREgnNR9W2B0dfKqSgxk6KL09cF4h7iie2jX+HqN58t+EU9X2wS2hGefuWJbbDshQI9rFGMhdg6tGrk+pOF/4hudg6uw3ZdNR3pJ8iWvTdmXXuvTeCrka8472fc6YGNK5ds+x61RoyOMIUp8BAO4Amp3i/VxSXJbYKxxuq+lxUeigBT8e8vLjR5jONSEa2Uw= 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)(107886003)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5Fq1J9cOVpDlwsFaCDB8xa/vocUD8A+vfPQ03drxeCiMsq87841jXqs5vhusH1cBhy8GhsFqKrdqIjx21eR78gwOIW0n4GW5zrioAT0s7mcD0tDagkn02Bo0NW+qso7DDfBTe7fb13MlxFwZyDWAOfFXgruIc8K+0YZpuYNpsipWFnCmG8VAbVs+zsakpksKEpb1RXAnA6dSOxJbO6UBS9GHAiJBmS2gm/M5PG4JEH8piGo7Ubb0pDavS+pQ7/XkM4zIVvkd3S6+yri5YwgBKTJ1t2OLjjVGYVW9WUs+9TNYpFewY2BehqzhUWPw2F+YAq+JEX0z4Lqf+ksXfsFC5HlOFTBsOVGYiBny7Ih1FuGifKU5ROPxFnvTfE3lYwGz6+LsTeDQCNPfBjgExFOzO0q0oLkgYKyR8Mlv917vmUBl8Vng7LfNlP2D3uzIRhzk2XeQ0fBH8OTlm0bTk6j52c6PqoBHzVUaM9Fpy18gJ3XzXPlSkj4qS5xNWE4Z6/nc9C/n5GRh0wwRSa9YeqQzXsvPAL5E4+1IMqSj47jp2tG/u4qAm3MUNtPENrsVczRP/vXdeNjNHx7KfIuO3QlZsmt1fQpEPlwhZ0O6633SmssAPxbVeJCg6DQUyApIOrQUDyU/tEg6uQ0s754Q5q8FwKoisLP7wiodBkyrFt3Ee3A7df9yWXcbVDiPW1faCZxhVllF9NU+l/ovuyI0UvuHl58KyxoW0HB3IzFBFTHxZS3ZTIURkHVCLagLBN6o4qc/28QQfl5+hfwH12DDjwfPxs3CH4IJGKtiw4Wh6iXZlpM8qTZoKDIHFC5j+M/fUkNDkHQhemrPUIy/Fvxk1wQqT1nWZQj2y9Jrc3zHUlP7yQxalAcnG8K1kxlj4qWCOLJ4QqOYmfbxMDAvDPmPxBlZBEZ6TA6ssUd7xWZT7hS2L+VpCIGJqO6LwaeQMOjahRloQ+qJQIEzLNbCwg14SjlBVwBIHJrx28WfxAoQsSREn1npMoPpC9oTln5M+fovA8rSw7eaSj1QB0lq8Y4rLJhFYdKCSDNGJPCqCOBRZ3oKahsmeF1MsDrcb2H4EEWhCd5oXPgXQDN02NBPgel/5514f3l/D+ybft6IAD1LhC5VSrNDvaUMl8XD9ORmsQlZ15hr/OqJJY9dmxVAAUDtWw9LVRe2C2YasiJK2iA7JcDYfCCKBlpsDd/TojZONjotJrI1R1rG07nujuc18DYnhrCVCcZzSXqhYYuA6l+bYfcENAqGaL14f19eyvBIb88/DWJuRdkfWDumc3AjtzpU9zuyDyVqtc8vi5k8wHj4606srYVRVsnjOogL3QCXaBktbd716hVBOSKH77GUaiufd6LB7mzZBgztLrfyHI1VLp/eoay9xEayXSKKeZko6ONWhqPQgN9rC8y3HuTTJYSz+JajiVOUKwVQGNvQduObGLJq4Ndf/yamfl7gdBvAKNocuUCQdgsziWOKtzPfY0YTogEY5pDwPQ00g0QO4Xis49PQx44rtlsMrb+pIlzx7dmC9opk5pexL29PibCkhHe9JK+WkISZDhFZQ36ZesEazt9pJDjyRsdpZuCozkIwujbye8rnPadrExJ9e2fvBho7QbW76Q== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08ee8187-2267-4854-dcb7-08da59539cfa 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:47.8284 (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: TyTkw6YQpbxu3TSRynHPdLujXOHrBTxd2qUq2jV/2UBXgh3Nwdn1ipZ2Riwu8MYzgIKt2vLNk/oOXaFhuEfEOw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151457_664232_1545D8CB X-CRM114-Status: GOOD ( 15.04 ) 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 --- (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; From patchwork Tue Jun 28 22:13:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899096 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 26EE2C43334 for ; Tue, 28 Jun 2022 22:38:01 +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=r0dK0sT+swEX0WsfVK+0azIPwKOFLC1RuVKPgqXt2Rs=; b=MJXK6I64qEMbHt CaAaBBgy3aMP9H0wyFccEnmWvkye4jLe/EkXnPcHigIuQNavskT6hX9CQymgDgSJzb8AvZ/n2XkqG IKk1qaiPXQjiq8UAklmsL8jyT4XOhv9owf2dPE40VieXa7k6Co1fKvJh6YK4LXaET5IWDWx0hUxp1 oE2XsyC90XQRh+UIFrvB8SglAvaV3Azxdq45OZrRaNYH+QNFO4IMaWn2ARehrMds+dCchfeqPeCKH k5+SgAXjR3KBcJiWHVNXuU19ZchZQi49EOsIQ53mJ7FLs1k6nPa+TNbgDm794u0KQyAP06lZ2hgMo DzC67EsSUncW6t24JDsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6Jnu-008SS3-Fs; Tue, 28 Jun 2022 22:35:32 +0000 Received: from mail-eopbgr80072.outbound.protection.outlook.com ([40.107.8.72] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JU5-008Mcr-36 for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NOJIoBm4Zom09eQSw1n5v6pQO3a3lEGG+HxGh/2rUlPSsPgTMNc+AYUlJlRpGuqUrTsTMRsLpRMMeJIB9we5Q5RnlK15A1nmSuGu8cePybOF7t/CtEt49/y+pYINTlWCinzbrEFwkyVuHhPV5jyxLCJylVg9otyqvBFxlroudKaRBecf++kL3Ektt7hdlkUjpqbZ/HzBSJC0n3JHXLCiqUhtPO3ccdlnUy5nFzXDrRPt7BT/3JslF9O6jWbzolBfcD2l+tnCjcdEqaWwo5WqpVM3XSrRaXr+1/066WP3GDgkaKo1qhaDM+IAkcpOWtm4QcqDDkYfIif+ecmEme/l4A== 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=+09KfYPSQv7rwZdqNsTjMc+4MLvPaJ/CCu8AuMbiMPQ=; b=b4Z12KgY8Lpou1pRd2CcPcJxhrBstNeTUmYAKR3zqPoKV3VhHVcfEwwQKHQy+r1IUChGoCw+B6f4y442ACXDDKC/TRQp4Pp9auz2G51uhn5GVMBDhGwmYAqNjhiMbuOy0YVtjp3X2CtqbJYATDxBex1TqsvSvYjoSJ8T+Lzr6S1iMtXcg0CtI/Mx6vi7nfQX6/igC0uTMpcVZCTU16GeuiWAfAEPfxXvTAqC5DyWwBDBrzkbHWmmf/bnSCzzF7gPJxnQtpJQ0wRXJp+zrVXAnnbrkpZF6eq24Cg1LWqlz1x1IkeXvYsPTjqbSbuWWonlqoJkVgDNxCNuz+CjpLuMdQ== 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=+09KfYPSQv7rwZdqNsTjMc+4MLvPaJ/CCu8AuMbiMPQ=; b=0ac6WiN1+33dRnWPi61J2NDhPw9OV0wrpXCVlBUIuNy39W0+LG3+b4BCA9hDv9Ln24Ok3te/NvnTQJ9ni81v5zo1r7XxSWCLaTWEWAsVerpNtHffq3HUG6CFmC/7hPM2XmP9N/sJGRaD1BkSLoI3givbFhU8BWyoA8zcc14X5GqH5DIVDz8u6RepmP6wA/YdYzSfGW5XCTjuxZz+1x3f4SqpIYbJ05TKD4qkwRhc7cN0vZxY07JcOcWf/lcecs3oqVbQzwf6kgvi2Vqwz/cwYRTHjneShh/3J/r9sRheeQp8n13SqkvLsmLw835F64XyR49CmOlqiQjWvVNQ8wJXPQ== 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:49 +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:49 +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 19/35] net: fman: Map the base address once Date: Tue, 28 Jun 2022 18:13:48 -0400 Message-Id: <20220628221404.1444200-20-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: 5046625a-d38a-4928-cef4-08da59539dd3 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: cvAcDz45EhBOLsaTDVMKHT/SiV5vTu/0yY1SSPRM2NOS9crNxirzcH/Msbt09Lwl+0CpSxAUrNavUIztnP5TXp6sX8Ev1QwTTItBoQARRd8qkcFOnVjDyptx8exmv66rhmPm+HfmhSKyJmDvuCI6VIW7Vm8az+4pXw13XNBUBYcJIZzKJ2Rf8XauFEh/rxnCbXNMyGdSb2nofBqoKwByjK3f9h5koMOtUlIxeZQp24gq6A4GgbIFQV/vAQU5XdnZ2kTM2luo+BrGcf7G9BsDR3VbIcKBA5rR2TGWdvrHsJrzyM1JS3pd9dPQU+a5cj/EhuaY+p8ewONKwPc5G3YsDlzJwCYuBD/JARI0vz2TCaP5f2T7o/11AEFTQs4H94+rXdmQQ7AKRx81MHkWkST5OmYL6tjCPTvUbM8cYXNBJtwTkSQTAmJhN18bApnBxalgdUqp7DVd7qBkS+EKdief3uVORZms+ncBHBd3rLDS6d+alzjKzzrSAYg4WPpkLpUiTbupro7O4V+ri5FlESZpFz24is5EB1MMW7CvjHFo+uZmGXpWGTZGt/3fpU7KwmMNiX21QHK8Gu9XJwW9Aq2npSEOblALg2vmbxDNw9xwlPo2Nr0gX8f4aPPRdsSJvTtXsONo0ciSvM6xi/HM8aApifEIc79ffX/lBulwqj0xAnCdK4tXFMo6Ic+3ecA3/xuGYmiJimneGN19uaitGXx7fVY9iKZua36kSzK2tdF040sSeU+4MEQd2oUviUsAliyzeYni8jfRJCqyLPKuIYpR/hmbJ4hFjCCF3WRApv+rJPc= 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)(107886003)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9lvBpMoGgUEw93N4rYwtB7DJyLkl6/DPXJEe8m0EUNdMEXjAegvCx00mY70SNobSAjWRXp0h7Nxq1uRg7L7YFz957OmexjDRbySRF3OnNfrmUoVmrWmjVAXl9zPhVEtEZ+tLrOsOQo6pHdE8dkyA61YWlUbvQjtBkiOKejJ1p4GT8leh0zmNOP39a0BNqL6RQVPsOF+g8FZ390cj3aXNi5HWHMPtu/pbXBxGYSGsmmBTGtig1VVgVSVqNzow98ZqACiQ5FbBUTLVyAAh4M8iqiUxCsBR92TkMMiCy9Bid9zTSA7/tW8mfAuH4UhZTW1Y/EVSVq68cROvJlJ9OITMzKn9YorNdL8Ezu72xzgzGf89l4L/9lQhbP5QyUgpJBie2CdzCWV/xXcauDD6+f+clT6LTCibfBJbBczs0evxgS5zUCcRGvG3aOIDrTi9Uy3D5Myw4iG3zY1dOXV8Ur1fTUvmOfOzXi5ugAH4J5h41ZdQqsdz5I1fRKmw3Liz3Nzo15pdbV0HWwHVi1F8MjukMt8rvy7nZGK4czavS8NG6c2jR2Lvy9ECJ7C3jxVrhS6Sy25b89sYcSu/Iy7Axp/W0DUbmrg/GaC+elpN/O5ALsxNwZnypmHmGHlc3RZihrjdh6P9/xgcdUr2gIkrk8jzF6pnpaXZxWMYEt70Qv+q32EToH/sHAYvB1SKrb9Ccf7jnaXdjfkXAWGMqTAvjqk7t0VrM1N+HQ6Ge4qS3aVjCQoqN4bXHB5MYMTUK0mK/q55VzzK5jMpS1DB4nXIcFZh26vMUwoXxm1nY89X+hStEeNUbsHMl3cyghDvdTjtBktLfcJY8ANIy12urwd1a1Yc2Rhg203Hyk2uWa2cuhp2/o4pmcxcoI+gTSwu4BFYJyTY5QL7lPCeQFDtMVs4k4NRngm0x5OfMJ++TA8rqYVpCp/LDk72OF+41VpOLMOf4pt/yo0z7NrU+xgX4Xj4MCagkO8DWKRZm3NkEld7Mvcj3cjP0NFils5gTkzwT/lv/eV/ogmDkIS+NE52HrGt/rYtFaZYFgigk+U6PMAG8JGNafUDme1fkr1lBiYQbK38VfgwKOtmXstxTN2kq7Hg2ZVQIFmbVbxcAh9Fj7chwowvHPi3mEpGICCFSxfEaLWunCgfFAZqJdnVVo99ZQZ1ZO71WlEsoNFfQLUOVq072jimuUO4Zp2xiFOmFNkSE1P2wfD7fOmEnnmXH6Wa+MeSQb6xwyhK5RhAMN7BUrDqel9US4oTApPGbbr5NrC2bFUNUNAj/u8dPg032ZWN1z4IFi1VhfMzcXROtqsHJ7Ml03uxwaqnVQujOjVhhVcd61TTL/n8KeeiBVhsPTW5r4eSC09Te6OcCrSrDgKLVhRwrIYf1B+fB6hHAE7TAJ2GsLKS51/UvrUfRy+/6RcE75kuZDDo8zgobVf5eEMYNvwgKmlAtfv+LlTPLNKcHhB+d46Wa0rbwVQ+knXzhpjMMEKZiTu/VVMUQiOp9850Y+augcbRIXI/aOhjkKgbVToCUIU1uNfm+gU3QNfyvyoifHcrRxJonhYIMolC8fzVlWNTBmIcpY7SUCM26M6in5N/ftxHTP4sh2557YxPHZr2P3sfQExCbQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5046625a-d38a-4928-cef4-08da59539dd3 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:49.2501 (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: 8ZXBb6XhUfybrsOrBnf/wexnJy7PACSCqjbYck4pK3/qoQ606q6BPjCOAMgk+wiXY8jv/1VF20dAmuS7DzV4qA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151501_254713_01EA9DA3 X-CRM114-Status: GOOD ( 20.62 ) 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 We don't need to remap the base address from the resource twice (once in mac_probe() and again in set_fman_mac_params()). We still need the resource to get the end address, but we can use a single function call to get both at once. While we're at it, use platform_get_mem_or_io and devm_request_resource to map the resource. I think this is the more "correct" way to do things here, since we use the pdev resource, instead of creating a new one. It's still a bit tricy, since we need to ensure that the resource is a child of the fman region when it gets requested. Signed-off-by: Sean Anderson --- Changes in v2: - Fix warning if sizeof(void *) != sizeof(resource_size_t) .../net/ethernet/freescale/dpaa/dpaa_eth.c | 4 +-- .../ethernet/freescale/dpaa/dpaa_eth_sysfs.c | 2 +- drivers/net/ethernet/freescale/fman/mac.c | 35 +++++++------------ drivers/net/ethernet/freescale/fman/mac.h | 3 +- 4 files changed, 17 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index a548598b2e2d..d443d53c4504 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -218,8 +218,8 @@ static int dpaa_netdev_init(struct net_device *net_dev, net_dev->netdev_ops = dpaa_ops; mac_addr = priv->mac_dev->addr; - net_dev->mem_start = priv->mac_dev->res->start; - net_dev->mem_end = priv->mac_dev->res->end; + net_dev->mem_start = (unsigned long)priv->mac_dev->vaddr; + net_dev->mem_end = (unsigned long)priv->mac_dev->vaddr_end; net_dev->min_mtu = ETH_MIN_MTU; net_dev->max_mtu = dpaa_get_max_mtu(); diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c index 4fee74c024bd..258eb6c8f4c0 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c @@ -18,7 +18,7 @@ static ssize_t dpaa_eth_show_addr(struct device *dev, if (mac_dev) return sprintf(buf, "%llx", - (unsigned long long)mac_dev->res->start); + (unsigned long long)mac_dev->vaddr); else return sprintf(buf, "none"); } diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 7afedd4995c9..62af81c0c942 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -28,7 +28,6 @@ MODULE_LICENSE("Dual BSD/GPL"); MODULE_DESCRIPTION("FSL FMan MAC API based driver"); struct mac_priv_s { - void __iomem *vaddr; u8 cell_index; struct fman *fman; /* List of multicast addresses */ @@ -63,12 +62,7 @@ int set_fman_mac_params(struct mac_device *mac_dev, { struct mac_priv_s *priv = mac_dev->priv; - params->base_addr = (typeof(params->base_addr)) - devm_ioremap(mac_dev->dev, mac_dev->res->start, - resource_size(mac_dev->res)); - if (!params->base_addr) - return -ENOMEM; - + params->base_addr = mac_dev->vaddr; memcpy(¶ms->addr, mac_dev->addr, sizeof(mac_dev->addr)); params->max_speed = priv->max_speed; params->phy_if = mac_dev->phy_if; @@ -305,7 +299,7 @@ static int mac_probe(struct platform_device *_of_dev) struct device_node *mac_node, *dev_node; struct mac_device *mac_dev; struct platform_device *of_dev; - struct resource res; + struct resource *res; struct mac_priv_s *priv; u32 val; u8 fman_id; @@ -368,30 +362,25 @@ static int mac_probe(struct platform_device *_of_dev) of_node_put(dev_node); /* Get the address of the memory mapped registers */ - err = of_address_to_resource(mac_node, 0, &res); - if (err < 0) { - dev_err(dev, "of_address_to_resource(%pOF) = %d\n", - mac_node, err); - goto _return_of_node_put; + res = platform_get_mem_or_io(_of_dev, 0); + if (!res) { + dev_err(dev, "could not get registers\n"); + return -EINVAL; } - mac_dev->res = __devm_request_region(dev, - fman_get_mem_region(priv->fman), - res.start, resource_size(&res), - "mac"); - if (!mac_dev->res) { - dev_err(dev, "__devm_request_mem_region(mac) failed\n"); - err = -EBUSY; + err = devm_request_resource(dev, fman_get_mem_region(priv->fman), res); + if (err) { + dev_err_probe(dev, err, "could not request resource\n"); goto _return_of_node_put; } - priv->vaddr = devm_ioremap(dev, mac_dev->res->start, - resource_size(mac_dev->res)); - if (!priv->vaddr) { + mac_dev->vaddr = devm_ioremap(dev, res->start, resource_size(res)); + if (!mac_dev->vaddr) { dev_err(dev, "devm_ioremap() failed\n"); err = -EIO; goto _return_of_node_put; } + mac_dev->vaddr_end = mac_dev->vaddr + resource_size(res); if (!of_device_is_available(mac_node)) { err = -ENODEV; diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index da410a7d00c9..7aa71b05bd3e 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -19,8 +19,9 @@ struct fman_mac; struct mac_priv_s; struct mac_device { + void __iomem *vaddr; + void __iomem *vaddr_end; struct device *dev; - struct resource *res; u8 addr[ETH_ALEN]; struct fman_port *port[2]; u32 if_support; From patchwork Tue Jun 28 22:13:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899097 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 3BC7DC43334 for ; Tue, 28 Jun 2022 22:39:35 +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=Dg4de4dNqrybn0p61S/PQmlXrGHJpGAaAM/snchRCzA=; b=I/pICKD/tW9QOU bypKCVcga7j4345SKeOOXvIbJUH5qXpThEvgm8N+PolLH56YKUh4wtlHwwiC58+3OUnq3BVts43U2 +wigMiI7vMoEw6IxtjDYp+4aqCIDrR1pXz+2AFsOONPj+/GsZPye20SpV775hYN69AGRSI9u4yg8E /wjAuxJp8ZsF8akDNUNqYxH7JPm12ZUqWsNw0as8GzT9yr0vZVkW4FL3KPhKSKDI/Ekr1z2KK+49L PXSs3uPHpGKtWf+11WVfYsLlfprlj876k++i28xVLf1Afiaqf7fLZMd0TgjvgLfgmrgTkr7pDXPhb XpAvlApeF4vvKkZ+rGHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JpP-008Sno-4L; Tue, 28 Jun 2022 22:37:06 +0000 Received: from mail-eopbgr80074.outbound.protection.outlook.com ([40.107.8.74] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JU8-008MXM-UV for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bbzhtgffuWa57dQpymGFlDvPtwqVJ50Qm68fFMmlliSeUCrOLyp3xZbaarIhAh8DGjNhXzHL6768RZkfvrreKEKq1QJ9TTCrlWCPkQ7ZYESNpVkcD+8a31O+tPl11pjGyzwn1TwwSlLMP7NZPFMeE+MZMnrrhEqb74Ff7C42b895GHlM0z+4aBHkv/wt/1K95Ek3xke4ar0tyHFrHDeClLhhjiq1nZUp9qX4s8O2mT3QIqKOJvJtxsumaYnBcgMahfOT+3gsboZtdd/xyIA9nr+8Yzy3g6c3nHv2a6XBhGDdil7F1abpF0ba6ZdJtKvEIvY67sKYhaUiU6bs0Vwyqw== 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=n7BrJA5PavkzVyK1KGe8HWlNKAyaHV7WuMzVn0YbMoY=; b=XOX8PZ4gnwFb7q91XhxhZh4EoavvW5KCn5aWQLTAxKFAO9fdHgbIRWLnhr8YVvNLer4RFQK1Rvi4TgTLPAIVZVIsXM1sVSiYuo+dKyNo2Gk7JoxMusgAOVReZny5atuI0mHQJU5bQQ37+m4ewG+p4w4YyRGJR9vvPemwul2OPfXNR9o0bgQBCWF1cbTAUWy/FPDGTzEFkt87h0FNYbBwEdWDO/s51uvVhkk9gB9BV1vpYEnnTEyM2JmAGBIp2+qkphpqMVqSVjCJsJbmPfVbzPNUOpi5jUPYoOwfXfNPs7Xxpm3cGTkXUnAiYjHstQPK5F6JHQIGk+MY736F+77dEA== 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=n7BrJA5PavkzVyK1KGe8HWlNKAyaHV7WuMzVn0YbMoY=; b=sHfNUg6ZcHj90mfHkR0/0RWxbB+IUf6I5We/hfKFXvtfJI13BwBrVslgJrqDs2ORZpF1uxT/5Dg1Sjj9BFKQ+hIfDlYcdaV26baufMJn9smguqD4y1PmTvVvLTOtiJ22rqDcPZk/eijBSC3NYqsczdZtKVATAWDvtkMoYzPTlcoZsMwOfaojIIbI9VGdB5lO797Cla6nqPDyayaAHBOpB1puLHdX2jks72b2PABdNQVs6FcxKdXFqF/4TSbLwD4qRS2KhJz941fFU63UtjS6Q1SGDLGdjSX8AlhPKjyNa2H6ohPBkTO3OsLXfwOkaQ/8rowYMqMhHmfVLavNZF9CMA== 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:50 +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:50 +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 20/35] net: fman: Pass params directly to mac init Date: Tue, 28 Jun 2022 18:13:49 -0400 Message-Id: <20220628221404.1444200-21-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: 429ece03-d872-4ad7-c143-08da59539eac 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: kgC7V+m3fz85ou+LxHagT3E5+D7pRiwhXeHhTF8dmDyGzwfygXybiapWhEVbDXtVq+BNVNxPnFxJNBd2W571etynS9NJo9WEHYz0XMxn/HHPlppe+LMVH3HUlJsrLMPdNcOPKPPBWUHZoTfHl0AGVZpxUDGZcPTGx1TDdrO5KF8s7QBK6nTvYQPXIb34XeDda5BzTLy/z4mh0++FUU77YIlwLkwTUugDeY6ka0aDG3ZVCKVavZc+wscBh9xRkqxskQyYS+gF8Uq3aJvIDpUsINgxi4NXnlZJ03JxKsmqINrfrylGtVsAuAjH2EtnzJ+LfoHSPnb9XVhG6Ou2Y5LEDQyprIxWlE6fCgJJOFYJDNdG/YyR+0keuB7Jqu4nM98a5QJGkvHjP1i5H0vCCu+QrFfR27VksXiI8QTmuK8TeNWURWJCYVlmzDLf4KX5YQ6s1E/N7OU60j3Dsd3zaj8+bN3VKhDMyp5ylAQXRNzCBbVgKaQrUZfw+Sz3growKWei3gR1G/JtGj8tZDSGSqG0X5iKsGv6FEFMqTNOqyb11nE8NVs+KKyus2CJavc/u5FEiZVG68CTBXGfwXo2BKbDRWAgyui6v4Best/zMCqL95d8m5b5r8GoQNL5KS1Hqd3i9/VROC509xwpncnS859GFJRTj953piQ9cYv9AzL/Xd22TOfEoWjbAJ8fmW1sY07FfAFUiUDl5KbsYcM482tlqApNPkmNeWkrfCISbxb0HVzTiX/8YPyHNIWcHiPg8sbKHyLFxQ3NlPmUbi1V07C6/JGZOPuSw9OEzX8vktQrqZs= 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)(107886003)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ijuwlZ8CGMa7HdB3WM8vaK2tSd32oOI0Caskfg4sl3kK0qJe5HNrrXhYLRl04ROSdqoW6ARreIPF/AL6900MA6PB2pef5iQmVU2weFoew46+FQxkFYClcwmij6pb7PTUlHZRE9NIkX4WlZeW6a34MICWHDYXEQdD+7dM0qbISz/bw1UcD7FW2Yj753oU9pzzWUGyRWju31D9NGRzHtH8jp1a8R0/69EceBVCFdO3DBgdYSwe6Hnd3454UIXSsspYtY0BOjZlmvGyNhnoDOy9/LXrgSCJmm0seszO4+7+BX2puz2X95MEOt2cQIFiOWmvVIHVA0osFRAwiKCL53u29r+9bYgUt83pxp3k957Zu+fyzlQ/TNekCJquN6/UAjwjCfmCCOhz7ausGZ/Ebw1jn56LDeYFIbWzjWn5/kpCZD3iZEmc0/gylpAkakUs0TH66zeaIY3jKxxHbMU30ngrH/th89sO4if+zVFSOdM+Oip8BsO+WHXvnBHkx/XwyUKODhlttg/aQem9VqWIS8/75WtiTz0m3Cz8fXdnCK5KU2D+EYz+tdrWJRbuqVXanWWV7nxS0cbIRg9txWB5VHVprOcP8hBwT5X4Un/xVWrnMbt0uIDhZXFrGy/OesH9Zkzo6wttPN78XEPE25pNvkNISPJKR3roK4dfal6uVFNWMXrotxfxz6rZ8ZNwcz1rftkB1szbzzVThY+61ZcrAHZ2v+t/ykqPGctzYrTVOgg0X4K//XTD00XTWRrmBjp6SCBx1kCYSwKhza1usVmMre2Zfr3FmyOZu1I7xJ/eltjrkEzLGBPncP9oPZXz1nHamWE8H3W7mf+PGpigQfQ0kzewY5Owg+HyEdIBtvLMjaCNLHWtTrYgayANNOvG81oGyDoOn8SLLUe9WeCnMnqq06ESQoZASqjYqoi1/MTrmGLAClraTuScoRcM2pxLuSaH91oyw8bJ5lhF2buZKCASgJxJ4SOAN3yg44Wn0CAxXJoaqMqmLKrY8pnT9Gizy6uGZC+/C8eNXY4gTHVrXVY7INyLWAA41H9Irgjq9JR3ftknE6gmw3QHqXJ/X/U00UfNK4U3ieRx/wPpxpNkE9PvoU6MTZjEj07n6x108B6j99Zf3HAxdO7r0nhQUMachHM98c9epS4QYNg4coFduwTEXuJ003/Q7pTgOyrjGOnrrgVC6f3JGefF+rndPr2+1aJHTLvyrJbfes48mjjihZN1bj1MZ2Dq93DrnrTVUHpmXmw9JMOU76tTdu/eP/d2QT+9aXQwSMmOlzXoLvFdo9ERqALkjFKmJ1nYTzpHEmC14t9iHeEHsgrjGyNjsw7YrYVVWuY4dYjMCn1sBeGlVMMGvbchF3RT9N4ZvpzhGuzcPfi23RCMe6ILeMJmt6SfktXvFLe+Z156G1mtyBjUPOz5oGmUivQWVDTau4iB4CJN0WuLbs1oJYZBfueWHAte7t1b75kA2XsTZMSopzx9MyTQra76g+E8He/VciH2g6fy8CnYA2nkYEhSg7x1+5jOY85wOjG4Fvr5qoPJIh6AprfnPXWoi91QbkarUcRfD438quiguEBKvZtJ3/z6Su2ymK5D50ANcl/V2le4igzPApWhWJIYSw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 429ece03-d872-4ad7-c143-08da59539eac 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:50.6563 (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: omGX3ZweyR22vWHp+uYXOiCurb8xp7vWTBq8QbmWUDaGL0SELs5vOVYyItrZjRA/CWhwFMTVwbnTQzm+rZ+PuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151505_214152_84B8B303 X-CRM114-Status: GOOD ( 15.46 ) 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 Instead of having the mac init functions call back into the fman core to get their params, just pass them directly to the init functions. Signed-off-by: Sean Anderson --- (no changes since v1) .../net/ethernet/freescale/fman/fman_dtsec.c | 10 ++---- .../net/ethernet/freescale/fman/fman_dtsec.h | 3 +- .../net/ethernet/freescale/fman/fman_memac.c | 14 +++----- .../net/ethernet/freescale/fman/fman_memac.h | 3 +- .../net/ethernet/freescale/fman/fman_tgec.c | 10 ++---- .../net/ethernet/freescale/fman/fman_tgec.h | 3 +- drivers/net/ethernet/freescale/fman/mac.c | 36 ++++++++----------- drivers/net/ethernet/freescale/fman/mac.h | 2 -- 8 files changed, 32 insertions(+), 49 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index c2c4677451a9..9fabb2dfc972 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -1474,10 +1474,10 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params) } int dtsec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) + struct device_node *mac_node, + struct fman_mac_params *params) { int err; - struct fman_mac_params params; struct fman_mac *dtsec; struct device_node *phy_node; @@ -1495,11 +1495,7 @@ int dtsec_initialization(struct mac_device *mac_dev, mac_dev->enable = dtsec_enable; mac_dev->disable = dtsec_disable; - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; - - mac_dev->fman_mac = dtsec_config(¶ms); + mac_dev->fman_mac = dtsec_config(params); if (!mac_dev->fman_mac) { err = -EINVAL; goto _return; diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.h b/drivers/net/ethernet/freescale/fman/fman_dtsec.h index cf3e683c089c..8c72d280c51a 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.h +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.h @@ -11,6 +11,7 @@ struct mac_device; int dtsec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node); + struct device_node *mac_node, + struct fman_mac_params *params); #endif /* __DTSEC_H */ diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 5c0b837ebcbc..7121be0f958b 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -1154,11 +1154,11 @@ static struct fman_mac *memac_config(struct fman_mac_params *params) } int memac_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) + struct device_node *mac_node, + struct fman_mac_params *params) { int err; struct device_node *phy_node; - struct fman_mac_params params; struct fixed_phy_status *fixed_link; struct fman_mac *memac; @@ -1176,14 +1176,10 @@ int memac_initialization(struct mac_device *mac_dev, mac_dev->enable = memac_enable; mac_dev->disable = memac_disable; - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; + if (params->max_speed == SPEED_10000) + params->phy_if = PHY_INTERFACE_MODE_XGMII; - if (params.max_speed == SPEED_10000) - params.phy_if = PHY_INTERFACE_MODE_XGMII; - - mac_dev->fman_mac = memac_config(¶ms); + mac_dev->fman_mac = memac_config(params); if (!mac_dev->fman_mac) { err = -EINVAL; goto _return; diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.h b/drivers/net/ethernet/freescale/fman/fman_memac.h index a58215a3b1d9..5a3a14f9684f 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.h +++ b/drivers/net/ethernet/freescale/fman/fman_memac.h @@ -14,6 +14,7 @@ struct mac_device; int memac_initialization(struct mac_device *mac_dev, - struct device_node *mac_node); + struct device_node *mac_node, + struct fman_mac_params *params); #endif /* __MEMAC_H */ diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 32ee1674ff2f..f34f89e46a6f 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -783,10 +783,10 @@ static struct fman_mac *tgec_config(struct fman_mac_params *params) } int tgec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node) + struct device_node *mac_node, + struct fman_mac_params *params) { int err; - struct fman_mac_params params; struct fman_mac *tgec; mac_dev->set_promisc = tgec_set_promiscuous; @@ -803,11 +803,7 @@ int tgec_initialization(struct mac_device *mac_dev, mac_dev->enable = tgec_enable; mac_dev->disable = tgec_disable; - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; - - mac_dev->fman_mac = tgec_config(¶ms); + mac_dev->fman_mac = tgec_config(params); if (!mac_dev->fman_mac) { err = -EINVAL; goto _return; diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.h b/drivers/net/ethernet/freescale/fman/fman_tgec.h index 2e45b9fea352..768b8d165e05 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.h +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.h @@ -11,6 +11,7 @@ struct mac_device; int tgec_initialization(struct mac_device *mac_dev, - struct device_node *mac_node); + struct device_node *mac_node, + struct fman_mac_params *params); #endif /* __TGEC_H */ diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 62af81c0c942..fb04c1f9cd3e 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -57,25 +57,6 @@ static void mac_exception(void *handle, enum fman_mac_exceptions ex) __func__, ex); } -int set_fman_mac_params(struct mac_device *mac_dev, - struct fman_mac_params *params) -{ - struct mac_priv_s *priv = mac_dev->priv; - - params->base_addr = mac_dev->vaddr; - memcpy(¶ms->addr, mac_dev->addr, sizeof(mac_dev->addr)); - params->max_speed = priv->max_speed; - params->phy_if = mac_dev->phy_if; - params->basex_if = false; - params->mac_id = priv->cell_index; - params->fm = (void *)priv->fman; - params->exception_cb = mac_exception; - params->event_cb = mac_exception; - params->dev_id = mac_dev; - - return 0; -} - int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev) { struct mac_priv_s *priv; @@ -294,13 +275,15 @@ MODULE_DEVICE_TABLE(of, mac_match); static int mac_probe(struct platform_device *_of_dev) { int err, i, nph; - int (*init)(struct mac_device *mac_dev, struct device_node *mac_node); + int (*init)(struct mac_device *mac_dev, struct device_node *mac_node, + struct fman_mac_params *params); struct device *dev; struct device_node *mac_node, *dev_node; struct mac_device *mac_dev; struct platform_device *of_dev; struct resource *res; struct mac_priv_s *priv; + struct fman_mac_params params; u32 val; u8 fman_id; phy_interface_t phy_if; @@ -474,7 +457,18 @@ static int mac_probe(struct platform_device *_of_dev) /* Get the rest of the PHY information */ mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0); - err = init(mac_dev, mac_node); + params.base_addr = mac_dev->vaddr; + memcpy(¶ms.addr, mac_dev->addr, sizeof(mac_dev->addr)); + params.max_speed = priv->max_speed; + params.phy_if = mac_dev->phy_if; + params.basex_if = false; + params.mac_id = priv->cell_index; + params.fm = (void *)priv->fman; + params.exception_cb = mac_exception; + params.event_cb = mac_exception; + params.dev_id = mac_dev; + + err = init(mac_dev, mac_node, ¶ms); 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 7aa71b05bd3e..c5fb4d46210f 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -72,8 +72,6 @@ int fman_set_mac_active_pause(struct mac_device *mac_dev, bool rx, bool tx); void fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause, bool *tx_pause); -int set_fman_mac_params(struct mac_device *mac_dev, - struct fman_mac_params *params); int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev); #endif /* __MAC_H */ From patchwork Tue Jun 28 22:13:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899092 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 A5E6BC43334 for ; Tue, 28 Jun 2022 22:31:07 +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=cPIunLmawwNipy5HQ4DRFUl91+6pk5N+WQVW7Wt/N4Q=; b=cAIjTNR7UPqPcZ BiFa8jspOj+B9AILZm92DQQjIhFpmiVqqgmbXkCLrGpVMpXFeV3bpjyxloWqJgQv99207qixUtcS0 VzXvoIgyb7du/QpkxylpiLRujWW7XIiyMgb1sAp0vvHxn+zDe6Np7/KtfwKu9yGRtatZfMe1skvJk SkevuJqN4M/fbr3tF1gsmyWvi0rnMBHELXEZ66Z/SdIRsWX47NBq/BiMGAc4jGerSi4QBbf2aUjq9 QfeVAGNxm/U4GHlo9zRqnYTHbi2wUtt/dzbWs9Kcfp3DwbjBSEgkhzaqYd73cFu1BpmIKvaVORsXi z4fttrBcewmKeQl04klQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6Ji5-008R7A-1S; Tue, 28 Jun 2022 22:29:30 +0000 Received: from mail-am5eur02on0608.outbound.protection.outlook.com ([2a01:111:f400:fe07::608] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JU0-008Mk7-JQ for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nLzbiNGC2jCUn2WrXsCLiQuInP8dizCSpL2LIXyM6oWSAZ2OsrcalFrf/rtHQWFF7MYbdlPxYVn8rYTGROJVbGSJo6ziUjqUaq61/YK5i5GotB3QFB3jNWrxQr0CnGwHCD85e/CqCSGCk/vsSs1qObCWZ/ESVTAxQnuZM5JCyNQOymQCQF7NZ8jBO9FbqllRiroSHl1sNjUPpWkOiT8jfNsoJXdBQPyvnhIN4LKrWzSPB/v2SrNWi+3rbWaXed3Wv0+G7CWB7ZIKR4LvsM/KfcldP0p59drYzONBIUg3tFAjgCuLbTlOvzgGiONzgI66fyUqdFRZGxusLXzP48bsUg== 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=Z92nDiFPrY/SLAPUikzBA56YSrw9Hgp2mCAPGnpbtek=; b=UrgHo38pq7V1ihU+dJt7MQ5gnivc0hXaizyvc7DW6F9h9Lhc2IOLIbp5z7MPBWnauveVGrGehF8v80uftLftnJ9djp2BThkAy6/eVH+6nb1FM8ek+mkaZhLr5PorMiz/KLL1sDU/nBRzOOhx1icD7fpg5yMh6SLApoS3A75EW+kVsFu09vS63yusveJjGEQKCVZS17CU8CcdBfA5eTRZ1SsPe8/EmRLouCtTTSOo+BM6sP2xYl903sfJPEOiDn/nQJY1WxLMuPtsxtHHdwYfC+KRyb96RJXrdqEOQ5MomxYOjy80WoRuaTjt34wcijeO51SlM6oy+6vmNnCovGW3jg== 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=Z92nDiFPrY/SLAPUikzBA56YSrw9Hgp2mCAPGnpbtek=; b=JxEnwYgaBY8jXODsHY5cXg6V4puHe1SSwOvGvLJWL0MpeVIYMtRVAVgN10pdRtOGVDh54lpgmrRrijvwbrN/wm8ABL2+5squWRUeVwO5O1VwkXOhEkBNruHn6qG+fwQ8iaXDRuPWQLgCEN3Jr+Ck8L/flRZYYieteGGRp61yQJPAW420d88+64MbmugL0g6yFeYiafMBeJ0oc/khuYG1h700bGAp35Azm55QtnqqptE+G27mCTe7rp2+CsMKkkCZBYP1OcPBGtdiamHuovVJj4UwlBjrOTfDYmrwrUYIgA3PO7EkRz5GGZuUZnNPw7fNXWsvq3JXP/Z5t+hPO4r3Mw== 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 DB6PR03MB3013.eurprd03.prod.outlook.com (2603:10a6:6:3c::28) 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:52 +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:52 +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 21/35] net: fman: Use mac_dev for some params Date: Tue, 28 Jun 2022 18:13:50 -0400 Message-Id: <20220628221404.1444200-22-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: 396f13b0-c9cf-4c00-eec8-08da59539f80 X-MS-TrafficTypeDiagnostic: DB6PR03MB3013:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qFnZRlsLubuh2uZ5MRCnWBuGxEgKtgTmEDIzraQxJJM8cW0ryR61XpP+ppsbecblatO270zNaMi//4oxspsvfQKMaTGtVB5lRSV35BwE5+h7/yVwICm91ottbsyacDGvnl4ewXS2BF4HefZMlY5SF7Xba0y3XfABxqld4TzY0aDh4aJwfaFIjF/rRMXToyYcILbipEFCWaN34oCb/l7yd+2/XLMsPjPLofq2dtiCtZR8x0NsQ++3arYQN7XcrNwie2WAJwf1UcpRgG+xh1lMPJPuwKCH15ak+6sdW5gJ8BHyzIK3OvXfUmKOUJimHANaQSccacMVVmnyQEgUO72943Vl1PDlTJX5cliUgvDkEcpPrBqgIlML/QNqfCUyK3q1AlQ42Vt/Dc3g+mgkMvXidbWvn5Nc+3qWdB8c064Z4xcIKEKKMsNWBooHl5CfPdvxBf6kI++qrv8IqmGvmHu5WHjwB7g6hxiEtr57JfzdyZkEgnLXWx2P4ieuG6yFXVJR5/Yo+ZfRyBXHLZgeDE1GkyNsKTwnOd+j0WP7Wvq/6l3c5884N8PZHthPB2tPDsURGQXNfEoqB3bVj5OjM9Dc+5rx3xJkJX6xcMSYUjOx1vhMWZmowOfnZgxmnUjPiUbrQVENO+7FE4DjavTGkV9du2OdclyT2Z8k3ebLOhOkE1GM48MlHNoBR1RbdbwXPR9aqrlRWNSy5JGmcsANilE7061NQO6hiev3K5UXLcIy/QP2pO32Woj+191zVJDE3rZOWIZI+UAGuoRugu1gD2N2cF1Ni0MC+eIUfJKBm8bFKC4= 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)(396003)(39850400004)(376002)(366004)(136003)(346002)(2616005)(41300700001)(26005)(107886003)(1076003)(66946007)(8676002)(6506007)(6512007)(52116002)(186003)(38350700002)(83380400001)(44832011)(6486002)(8936002)(66476007)(38100700002)(2906002)(66556008)(86362001)(5660300002)(54906003)(36756003)(110136005)(4326008)(316002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nXOWftF6KPe95MbcV6yCc5tNVUzcPmcXZNJDfDkFNSyhr5P76qsg74CgiPHPAlJwFD+D3EwNbH2HE+ZkXN0PxaA6XyhUTKXwTxaxsxCFkCb0PXsdfAJbXqZAQJ+1wDxMokaSlrSQUwWBPLIoO+7v587cVmkPICgHu/keXYYpM0F44HzMZkUqzm17e+SECCUqPoGY4DgaLxJR+pJN52+1j2quiH+GWv89c5noaphb68xhJv0YH08po8CWy8+UTkPADrh5sEVkCNzICnMjh87gnsxKh7FKQ7LDGP+nAES4kKM3BbqgdBEVpjndS+xmSHbnsBoQN+bQQ3ghXv94q3CgVxKU6JAlrZRH9wTrnmnCFOTROQYCeLoKbKHgG7OwrVSGEqNntXrKOc535epkbpfXeImdTlhLFjZ7Q5v0jAkVIcy9BzRkderENQ9/t3waZ3C0+fniLbehOZi7BU6MsebzqwUzTky++cGZ4IW7/sPVLQbMWp3GZUBkUfDJJLXMmdUVTf6Pr84oUkA7QMP4AZCSzC6TBqp22egDfRwrUrSoRmmr4jqyPyfHjtQ5+7WLVCvezUkCZY4Lwk26bja7bBP/vJiVFEAYxr+0nkz0bEB3058ZoipElNI94mRs8vszFMPqFfPua30xlXFz3ntU101lC17UhzXwGto7f38gXZRbTBLoabQOskYEmVw+CaRub6lCDnDQDTBg0/W8piUJIA+dnJPskFHumfZNFyR+TRLIf+WzLIMd0Ro9HJZgS8aoi2aNSQ9r1kifpuZ5oJi9pjszhxHMKHKdK6xdO6mfafGFHelV9O6Ki/krwyLp5j0rH9F6jn3bZ24mfiZcss/UxqOa6HiSP6fUHC8vdzFYRudvvZ+4FMdjcrC9Nh7OGHd7rSNCZQc5NgUYzgEMY+AhHUPTaWX2dvWmq5DKpctN+uTpn1cYgSN2hCihQhsCiSNKZnhFyN3NOZyQoPHm1jsV20Q0RYvQev0HZmvOcAXg9dy0+zKF22JTV7wo1L4ZeOfVNy8sxnQTAnmsQFuhITtUyuSplD6gNBcMrmPu4u8kUBiT8J2dvPmCkf/UDk63bg/O4AzrwScn6YUldf7TnTVIHoZC+fEKuP0Y/s15q5kyNnrt7Twlnux4naVYaJByiq6Gd+8S//DYZrQCbU2aG18QT9d7JM1DoSx4Q7iIAbpF9yfEnPeL5ippQ3zjQjsqC2FX4+ypH2aeWv1MFSaSid/6pF+KKitM72VQ2h1pQ8h6Zq5nPcYzk40G0khdj+EoYOz0G7cu8CXO54t4ktAX6eMUtuE2go+gQLtWWsCRJUX8Qyk0URxicIwRB3MbciPqTCdpBPeGkolDFTnlwFF8NQWVLac1pClt5t5a9tJj9Gu58DQkeSb5tPiu5+ylWrNskMqeIMOqpwVCkLEr2frI4LvxFabY7LchCIg2dO9gEhPILn1EuGQWk3ESYELPxFCtteENwzw4wZr2CZqVozFhDUVCGxPHg/L8ztwnL/VU8M8ufxWzM8DXuR4ev8ZbKBhF0asJ9YlLGoKlE0PFF59edeck3Lq+VsNhhqgZkTC1qvhisyOnennN8VEGtDBVZpN0KDDKsF62lV2GAUWFhyPn1X8hG4HFRg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 396f13b0-c9cf-4c00-eec8-08da59539f80 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:52.1249 (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: qiQAQ7+q81LDJzign3ertkE/BxLE14GpceuI51mYLuinOldNT8AEiXVTKTx4QY2BpniYa4v5VfF3w0zviio70g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB3013 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151456_908830_1CB1607A X-CRM114-Status: GOOD ( 15.71 ) 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 Some params are already present in mac_dev. Use them directly instead of passing them through params. Signed-off-by: Sean Anderson --- (no changes since v1) .../net/ethernet/freescale/fman/fman_dtsec.c | 16 +++++++--------- drivers/net/ethernet/freescale/fman/fman_mac.h | 7 ------- .../net/ethernet/freescale/fman/fman_memac.c | 17 ++++++++--------- drivers/net/ethernet/freescale/fman/fman_tgec.c | 12 +++++------- drivers/net/ethernet/freescale/fman/mac.c | 10 ++-------- 5 files changed, 22 insertions(+), 40 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 9fabb2dfc972..09ad1117005a 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -1413,13 +1413,11 @@ static int dtsec_free(struct fman_mac *dtsec) return 0; } -static struct fman_mac *dtsec_config(struct fman_mac_params *params) +static struct fman_mac *dtsec_config(struct mac_device *mac_dev, + struct fman_mac_params *params) { struct fman_mac *dtsec; struct dtsec_cfg *dtsec_drv_param; - void __iomem *base_addr; - - base_addr = params->base_addr; /* allocate memory for the UCC GETH data structure. */ dtsec = kzalloc(sizeof(*dtsec), GFP_KERNEL); @@ -1436,10 +1434,10 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params) set_dflts(dtsec_drv_param); - dtsec->regs = base_addr; - dtsec->addr = ENET_ADDR_TO_UINT64(params->addr); + dtsec->regs = mac_dev->vaddr; + dtsec->addr = ENET_ADDR_TO_UINT64(mac_dev->addr); dtsec->max_speed = params->max_speed; - dtsec->phy_if = params->phy_if; + dtsec->phy_if = mac_dev->phy_if; dtsec->mac_id = params->mac_id; dtsec->exceptions = (DTSEC_IMASK_BREN | DTSEC_IMASK_RXCEN | @@ -1456,7 +1454,7 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params) DTSEC_IMASK_RDPEEN); dtsec->exception_cb = params->exception_cb; dtsec->event_cb = params->event_cb; - dtsec->dev_id = params->dev_id; + dtsec->dev_id = mac_dev; dtsec->ptp_tsu_enabled = dtsec->dtsec_drv_param->ptp_tsu_en; dtsec->en_tsu_err_exception = dtsec->dtsec_drv_param->ptp_exception_en; @@ -1495,7 +1493,7 @@ int dtsec_initialization(struct mac_device *mac_dev, mac_dev->enable = dtsec_enable; mac_dev->disable = dtsec_disable; - mac_dev->fman_mac = dtsec_config(params); + mac_dev->fman_mac = dtsec_config(mac_dev, params); if (!mac_dev->fman_mac) { err = -EINVAL; goto _return; diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h index 7774af6463e5..730aae7fed13 100644 --- a/drivers/net/ethernet/freescale/fman/fman_mac.h +++ b/drivers/net/ethernet/freescale/fman/fman_mac.h @@ -163,25 +163,18 @@ typedef void (fman_mac_exception_cb)(void *dev_id, /* FMan MAC config input */ struct fman_mac_params { - /* Base of memory mapped FM MAC registers */ - void __iomem *base_addr; - /* MAC address of device; First octet is sent first */ - enet_addr_t addr; /* MAC ID; numbering of dTSEC and 1G-mEMAC: * 0 - FM_MAX_NUM_OF_1G_MACS; * numbering of 10G-MAC (TGEC) and 10G-mEMAC: * 0 - FM_MAX_NUM_OF_10G_MACS */ u8 mac_id; - /* PHY interface */ - phy_interface_t phy_if; /* Note that the speed should indicate the maximum rate that * this MAC should support rather than the actual speed; */ u16 max_speed; /* A handle to the FM object this port related to */ void *fm; - void *dev_id; /* device cookie used by the exception cbs */ fman_mac_exception_cb *event_cb; /* MDIO Events Callback Routine */ fman_mac_exception_cb *exception_cb;/* Exception Callback Routine */ /* SGMII/QSGII interface with 1000BaseX auto-negotiation between MAC diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 7121be0f958b..2f3050df5ab9 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -1109,13 +1109,12 @@ static int memac_free(struct fman_mac *memac) return 0; } -static struct fman_mac *memac_config(struct fman_mac_params *params) +static struct fman_mac *memac_config(struct mac_device *mac_dev, + struct fman_mac_params *params) { struct fman_mac *memac; struct memac_cfg *memac_drv_param; - void __iomem *base_addr; - base_addr = params->base_addr; /* allocate memory for the m_emac data structure */ memac = kzalloc(sizeof(*memac), GFP_KERNEL); if (!memac) @@ -1133,17 +1132,17 @@ static struct fman_mac *memac_config(struct fman_mac_params *params) set_dflts(memac_drv_param); - memac->addr = ENET_ADDR_TO_UINT64(params->addr); + memac->addr = ENET_ADDR_TO_UINT64(mac_dev->addr); - memac->regs = base_addr; + memac->regs = mac_dev->vaddr; memac->max_speed = params->max_speed; - memac->phy_if = params->phy_if; + memac->phy_if = mac_dev->phy_if; memac->mac_id = params->mac_id; memac->exceptions = (MEMAC_IMASK_TSECC_ER | MEMAC_IMASK_TECC_ER | MEMAC_IMASK_RECC_ER | MEMAC_IMASK_MGI); memac->exception_cb = params->exception_cb; memac->event_cb = params->event_cb; - memac->dev_id = params->dev_id; + memac->dev_id = mac_dev; memac->fm = params->fm; memac->basex_if = params->basex_if; @@ -1177,9 +1176,9 @@ int memac_initialization(struct mac_device *mac_dev, mac_dev->disable = memac_disable; if (params->max_speed == SPEED_10000) - params->phy_if = PHY_INTERFACE_MODE_XGMII; + mac_dev->phy_if = PHY_INTERFACE_MODE_XGMII; - mac_dev->fman_mac = memac_config(params); + mac_dev->fman_mac = memac_config(mac_dev, params); if (!mac_dev->fman_mac) { err = -EINVAL; goto _return; diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index f34f89e46a6f..2642a4c27292 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -728,13 +728,11 @@ static int tgec_free(struct fman_mac *tgec) return 0; } -static struct fman_mac *tgec_config(struct fman_mac_params *params) +static struct fman_mac *tgec_config(struct mac_device *mac_dev, struct fman_mac_params *params) { struct fman_mac *tgec; struct tgec_cfg *cfg; - void __iomem *base_addr; - base_addr = params->base_addr; /* allocate memory for the UCC GETH data structure. */ tgec = kzalloc(sizeof(*tgec), GFP_KERNEL); if (!tgec) @@ -752,8 +750,8 @@ static struct fman_mac *tgec_config(struct fman_mac_params *params) set_dflts(cfg); - tgec->regs = base_addr; - tgec->addr = ENET_ADDR_TO_UINT64(params->addr); + tgec->regs = mac_dev->vaddr; + tgec->addr = ENET_ADDR_TO_UINT64(mac_dev->addr); tgec->max_speed = params->max_speed; tgec->mac_id = params->mac_id; tgec->exceptions = (TGEC_IMASK_MDIO_SCAN_EVENT | @@ -773,7 +771,7 @@ static struct fman_mac *tgec_config(struct fman_mac_params *params) TGEC_IMASK_RX_ALIGN_ER); tgec->exception_cb = params->exception_cb; tgec->event_cb = params->event_cb; - tgec->dev_id = params->dev_id; + tgec->dev_id = mac_dev; tgec->fm = params->fm; /* Save FMan revision */ @@ -803,7 +801,7 @@ int tgec_initialization(struct mac_device *mac_dev, mac_dev->enable = tgec_enable; mac_dev->disable = tgec_disable; - mac_dev->fman_mac = tgec_config(params); + mac_dev->fman_mac = tgec_config(mac_dev, params); if (!mac_dev->fman_mac) { err = -EINVAL; goto _return; diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index fb04c1f9cd3e..0f9e3e9e60c6 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -34,7 +34,6 @@ struct mac_priv_s { struct list_head mc_addr_list; struct platform_device *eth_dev; u16 speed; - u16 max_speed; }; struct mac_address { @@ -439,7 +438,7 @@ static int mac_probe(struct platform_device *_of_dev) mac_dev->phy_if = phy_if; priv->speed = phy2speed[mac_dev->phy_if]; - priv->max_speed = priv->speed; + params.max_speed = priv->speed; mac_dev->if_support = DTSEC_SUPPORTED; /* We don't support half-duplex in SGMII mode */ if (mac_dev->phy_if == PHY_INTERFACE_MODE_SGMII) @@ -447,7 +446,7 @@ static int mac_probe(struct platform_device *_of_dev) SUPPORTED_100baseT_Half); /* Gigabit support (no half-duplex) */ - if (priv->max_speed == 1000) + if (params.max_speed == 1000) mac_dev->if_support |= SUPPORTED_1000baseT_Full; /* The 10G interface only supports one mode */ @@ -457,16 +456,11 @@ static int mac_probe(struct platform_device *_of_dev) /* Get the rest of the PHY information */ mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0); - params.base_addr = mac_dev->vaddr; - memcpy(¶ms.addr, mac_dev->addr, sizeof(mac_dev->addr)); - params.max_speed = priv->max_speed; - params.phy_if = mac_dev->phy_if; params.basex_if = false; params.mac_id = priv->cell_index; params.fm = (void *)priv->fman; params.exception_cb = mac_exception; params.event_cb = mac_exception; - params.dev_id = mac_dev; err = init(mac_dev, mac_node, ¶ms); if (err < 0) { From patchwork Tue Jun 28 22:13:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899095 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 0647BC43334 for ; Tue, 28 Jun 2022 22:35:29 +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=TbMKOZR9wUSA+A7nrIvjzJEBhpNtdWqKOdBn9OuGrQw=; b=T4xQrBT0h6t5Xz iRL74tiRUSaSTRHFfhEjZmH32/iFMAezagfxKG3Cif9BW/TgXMEjuukTxhYCUIdT0VQyQFENgSiUt INfPUALNoDhzmVE9MPvMpYP2Kvf/0pdtqbGfUmNJdjCOKKoIV5jKjVO2q7hYtEy8j4oQTzCoSdIUO bQV7OZtZrs3iLEGZex/RXGcPM7FceELjQsCVFmhQr1eC6eVhIJdvgD9X0m2+Ca62ZbccXSWP8ZKsc /fGRPL1TzAbvcFJJm441eR0pOvhhnInyYkfqCrvdlW/FbMRFmNB+N/pe+vX1C9tvwD1aFPPAjesPK tVlGfSm7brvgthcU+juA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6Jm9-008S4M-0p; Tue, 28 Jun 2022 22:33:44 +0000 Received: from mail-am5eur02on0608.outbound.protection.outlook.com ([2a01:111:f400:fe07::608] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JU4-008Mk7-Vm for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bryx4hkifV5M8ISJS20QRI2ZVdgv2xjXNuWtT0QdjHJ8Os9wVrAXeauYaAxM5wmzwe7hYAaEnI15yshrSNrPOx7XVdykbNPiwXyUV0gWnmOgZnVZGYsfOgI2HCkIMSiAQltqjk3DIfeSZoWJqiZ7RSk93wv1LxvxMvgAXksVkAB2zTF7v0AEVVl3TorDmy6fCSanUt7OYlagdFu3E506aPkbLuc6xmI759vR1mW3W5drHOBXWZnHzpDY6zvTNzUGJGwaeCraneIxFB9oOoFBLhL9nuaXOkHphAHLomRCUqdxQ8SCL3+oEFl/YTyIawBybjcLybaVbpxjeX6Lew3OMQ== 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=/xrnQ3BEPKqzcOGdsEl6PELVzYS8aCEaVWAk+Xtejew=; b=PA6L5arZ4WKG4s56IW/1ubKZS/1fS4cGhMZNOOs9X6RikXNQ9AeogR1MEWJ4VBqmYkn33h/wVo18n4KjgfB17KoEBJE/fMNE3sY7/Mevz4cp+qRohTbeXogpK3MII9z/pHGpO+bW6ilUOwG+J9H9M/E6WcIqJw5JWh2bX5rbl0goL/1r7zJviv+JhBJAWEuSJCgGHUpoaloV2r3BuKZ3TreAzitGMB12/w7sV8aBoUMs50Y8LCE3/NCMUFBExdZ6YK2nGFGx4lQBeBXdCaHl9w+P4L1OZF3FxF4zfC9FzsALaUX28PGXT5NMomWN77Om4nVUaM0mCCknCczqJ1m6rg== 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=/xrnQ3BEPKqzcOGdsEl6PELVzYS8aCEaVWAk+Xtejew=; b=lZG1AznNsi+zSPiZptz1IgRTdGv8piZq8YH3Qan3Briy9yu7Vth9Py0TU454Erq57NT+T1zr703BH8Ps8S4tRbHrFOO2FsPt32ONJuF5PUJvQAneLCThlUL6w0SJdvQXJj2PZd4gMoHk4R9X0HFZgP6YYxijXKlU8Ux0LpiDgoIjcM67rOOavj/srHXWrl+g8hpA3S+Vpf9pYOVn8Ht6j3MuROHbe0vdvGnV95ofoEfGKiKNMEaYgKNMZLHxafQpiovzd7uqbvjBSvXOEWXgknrnI1pDwvnnZA3Wsn4nbWdpoMojj9LTJbt+o4AvVi0IRUIy9NRxuwdVVjhSEAGwyg== 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 DB6PR03MB3013.eurprd03.prod.outlook.com (2603:10a6:6:3c::28) 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:53 +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:53 +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 22/35] net: fman: Specify type of mac_dev for exception_cb Date: Tue, 28 Jun 2022 18:13:51 -0400 Message-Id: <20220628221404.1444200-23-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: 234d29c7-080d-4a21-0803-08da5953a061 X-MS-TrafficTypeDiagnostic: DB6PR03MB3013:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pomTAVfWZaP2tTQp1hDuFiywkiRCgz7NryvBh4WUH++vDlJbxCZWDm0Ty9UkXpomPICEzzi18H0EFM1cENfHbvTg6HKEzySQc3D/KDRgcJMJiTc/45MdouMkbuzUVIHYxGxFv4pB5mdegEnrCRb0njBRlFIH6jcXhl2nHtvlRaupwCw/uiwe+GDKC3mGxPqu49pg8VG3U39KUU0LOwy6vA/KFxxj7xE2WhuJPAsdLlAy/tM0vnY/UjiH15tuHF3OnHgKrxtJ213Yh+jwvuaS3VBz563Fp9tXDFCHm5sniSK/WOymzR1ZjIEpd2ZmZ3HT/fyZZiACiqWa9RrrAHfJct2XvJFMvRElbSBlpcJlL+7IQCSRo5LQ8mAYaXrDtC64AIXJVKHxtUdMSCB5nl0eTHwqZ9FD/qbP63wN3DJTPwB28s3OG4eY/wTCGbExF3xbpKq5pSiUy3DDS4fvm13wvEcluURO6WbaJot4t6fWKslfvTubQvXDnjZklyhhIIHyMxAUHOHd4vcyTjtrKTWZPGMLURRcr9emrBW8MD32LqxrEJe8DkIxUxIsuBy46RcbMmOPUnuXHq3WWh3i3SKDsBqYeAvOegb6AKo8isYur2Y/WTPos02bjWNNN684dlXPlCWPRi/FkzNqFONtrcuZENsZmBESUrJVtJsttMYnvgMwWAOQGRExD9EqLS670SrPSTILuJpLE3UoJU2KiUIl8uc11uMNTlcBY4Iz5PZWKw5yIvdzWA3DehUJWgIyWX7EkLU+ajSr2OUlQ3xD7WB4z4uz/YHU6jwkB+mC7YXZDls= 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)(396003)(39850400004)(376002)(366004)(136003)(346002)(2616005)(41300700001)(26005)(107886003)(1076003)(66946007)(8676002)(6506007)(6512007)(52116002)(186003)(38350700002)(83380400001)(44832011)(6486002)(8936002)(66476007)(38100700002)(2906002)(66556008)(86362001)(5660300002)(54906003)(36756003)(110136005)(4326008)(316002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cTA2YzKMvdkAARbTryN1OOfFGpPmZKty2rFnfRGZbXp0wD8sXdjwIZsBz5vmgm/2/banswrp2IOAZURf+yYCK3+NCK6LKyH4fEFcEBQRbNjoHS635aDuIl0+/xJ5gbDXHb39Yc1wTJZdTuwgHFIGbOyhMXy5orfTUB8caV/cWMzopruuekpYmhTITQO0PR67o7+89pZg4zzBgTQIvdEAesoniX6PfBxB0rrWmeus1jN6x/HTws1mBqRqPaQ6aF4H0sZ3OR3PKv+KCRKBc3SFZawltuxu0GDG51zAGNPB3AUcjU98wL7C6KIaBubkMQebF6Ehgrb56yxGfDOsFoEMVrtamfjTGJId31+mKsRVY1SO7GSkXcTY/DkMIbkYLPaw/tDB9tIiGskHsgOqqOwOFLTDoX+ftGJOp1qqKIDJKb2RYrwM7n09RUVj68rcHj+z8fOgQxZGGHK+9OVFwtgihpfQcecsaWqnledEm0ZGinPxFMS9w38aXAkpaC4MERSJl6Re6NvCz3zxLHpewNHTw/jPFyh2Lqx2Naw6ND4JyQE/62EngBAUZz8aZuM9HvMwmeTuLs7iQuIrhDlNtYtCB61WjNjYcDLcled7ybaYwz2WybG9MutO9H2k2jXgzPMOgp4NlEzQFDPJu3nLsVRK+W8bjbPwA6PC5biW40RZllvcypYswnZK68xV2rSyHtcr+kIbo7BjI4Owt36Wz6Xi4s/NWgm8if5JFb6eYZ9dZJfQUQeSGNbOnPx602mGzLOOxVDOH7k7056skvDfkTPquHITM1/MbUTX4D48uVBfWSrdw5yv6Ct/MbI1T4jJYZnw9aZcm5HW3+xG3vM12PvzJUshAT9NTVQxy4I49ut4F+k0saeKUof6JatdUSxQGhdjrg2rymh+OK7tmWPW2QYJbQLzD3oKWc4j8E9RYbNzmPYp1CtorFtkE1n7qdYnx+zKXo9TIBklxQO4cK0qtbksSO6Jw0OwmqBZJ8PGNCUuu0fEuiMYTS/w8HnkUA+CwR4gwA7UUoVlOP5LM23qSoPVgylQHnLQ2r9npCMg1zaGqwGXpM+mH/OdQa4zayKdBl9eJjucNvGBt9c3w1xT7yFd+RmXOEkWxOZfi4O8i9hXSyQ/OLF1hIoehFHrZFTm22AXWud0atNJKs3pmTsLmPyvSvzdfcUG72kyfjidXhKXzAX1ghplEQ+IkDJBEAda78cwAdoqbt2dpGV7nHllcs96/5QK3lVhHICK98FrU4Pk869wpSgqlFh4W4klPbITO0BU1dGDKZD/a0aeI8h4b/jv1vpY8gpQglSb5upEbDBDiSJoOHNdvqi4bR99UKDjTRlodzfQPjTUa8i9N73MCGdvki6zRTQJ7dHQqm4JQDNUdJ+v4ZEfHjA8eScvcizz1xM/bI6+DzabRUWLCR4XhlmdFM6Zf/FQ6TB7HVjP+z20/e7M+J0VY/ruQ2UMdxqvF0UGXywMB1qu4qF0bksPfQwGJUFOJ2agiFONqIjEB6+GXhN474zcruaYDDYB/XACG3R9zccnVnJWUBJz2m7b9BFKzWWk15wi4giK8bE8a4qMWuCde1BYDl+/OX0Zu/TMuvsEiRFG3a5TQLOHS20mDyyllw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 234d29c7-080d-4a21-0803-08da5953a061 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:53.5155 (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: KF8YXc0T4IXLXVSJzvFaZzQ29mGSRFOnYqsf2xqp/UORboKVfn/194BvvVRP0kWvlsPXymuzNJi1q+nbZdOJKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB3013 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151501_131766_F8116CB2 X-CRM114-Status: GOOD ( 13.96 ) 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 Instead of using a void pointer for mac_dev, specify its type explicitly. Signed-off-by: Sean Anderson --- Changes in v2: - New drivers/net/ethernet/freescale/fman/fman_dtsec.c | 2 +- drivers/net/ethernet/freescale/fman/fman_mac.h | 5 +++-- drivers/net/ethernet/freescale/fman/fman_memac.c | 2 +- drivers/net/ethernet/freescale/fman/fman_tgec.c | 2 +- drivers/net/ethernet/freescale/fman/mac.c | 5 ++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 09ad1117005a..7acd57424034 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -301,7 +301,7 @@ struct fman_mac { /* Ethernet physical interface */ phy_interface_t phy_if; u16 max_speed; - void *dev_id; /* device cookie used by the exception cbs */ + struct mac_device *dev_id; /* device cookie used by the exception cbs */ fman_mac_exception_cb *exception_cb; fman_mac_exception_cb *event_cb; /* Number of individual addresses in registers for this station */ diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h index 730aae7fed13..65887a3160d7 100644 --- a/drivers/net/ethernet/freescale/fman/fman_mac.h +++ b/drivers/net/ethernet/freescale/fman/fman_mac.h @@ -41,6 +41,7 @@ #include struct fman_mac; +struct mac_device; /* Ethernet Address */ typedef u8 enet_addr_t[ETH_ALEN]; @@ -158,8 +159,8 @@ struct eth_hash_entry { struct list_head node; }; -typedef void (fman_mac_exception_cb)(void *dev_id, - enum fman_mac_exceptions exceptions); +typedef void (fman_mac_exception_cb)(struct mac_device *dev_id, + enum fman_mac_exceptions exceptions); /* FMan MAC config input */ struct fman_mac_params { diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 2f3050df5ab9..19619af99f9c 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -311,7 +311,7 @@ struct fman_mac { /* Ethernet physical interface */ phy_interface_t phy_if; u16 max_speed; - void *dev_id; /* device cookie used by the exception cbs */ + struct mac_device *dev_id; /* device cookie used by the exception cbs */ fman_mac_exception_cb *exception_cb; fman_mac_exception_cb *event_cb; /* Pointer to driver's global address hash table */ diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 2642a4c27292..010c0e0b57d7 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -180,7 +180,7 @@ struct fman_mac { /* MAC address of device; */ u64 addr; u16 max_speed; - void *dev_id; /* device cookie used by the exception cbs */ + struct mac_device *dev_id; /* device cookie used by the exception cbs */ fman_mac_exception_cb *exception_cb; fman_mac_exception_cb *event_cb; /* pointer to driver's global address hash table */ diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 0f9e3e9e60c6..66a3742a862b 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -41,10 +41,9 @@ struct mac_address { struct list_head list; }; -static void mac_exception(void *handle, enum fman_mac_exceptions ex) +static void mac_exception(struct mac_device *mac_dev, + enum fman_mac_exceptions ex) { - struct mac_device *mac_dev = handle; - if (ex == FM_MAC_EX_10G_RX_FIFO_OVFL) { /* don't flag RX FIFO after the first */ mac_dev->set_exception(mac_dev->fman_mac, From patchwork Tue Jun 28 22:13:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899101 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 89AFAC43334 for ; Tue, 28 Jun 2022 22:43:18 +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=G5AUaWal3yq9uycaCrGyI89/RzwPYqIC9uuUnC0zP8M=; b=ECSmlPdlrCX7IR 7FFyLgw6tYLe+hFGYh3xam3jwmKlkPpibldn1mE2QQ9Bvh0g4rYJi3OQ/iStwTSQzgkfD/CNMYTBm UFB3QB1uUZVXLdeJkq5BJZLiYjPpbhnDQkev+Bw8QIRM9XI9I/9F0Xqt16DGChJKcbEH5nCmNgR1M wi6ouufNcNrrBMo5LUN1hty6LURbaRIgR2vWOw+7/E7mQav7Nxc6xXrcHeYqYikDuMJkD1/YRAxEw wZWfvS09Ti1EnitVEgesogXmwcKXEp4/p5qG4cqSTsW110m93Mn3CXU3BarMov+GT/JXHJmcaOw5X Argtva2fvOvzetgwhkcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6Jts-008Tv9-2w; Tue, 28 Jun 2022 22:41:42 +0000 Received: from mail-eopbgr00086.outbound.protection.outlook.com ([40.107.0.86] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUC-008MrJ-EM for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TFuq4Jn99nKyf5Cmbjur73WrOicv88pI/IULRa71B/BcnIDsf4zgkmK+T+tKPlZB2buzXhL+vtzd0JS4FdFF5F/8u7AVBp5Qa/91lhw3OlROtQBX/CfP34/VEu/u2uwlQxzm4RigpCts0LHbOPzuDuZwDNm3fmZ4QjhF4k6Cb70pBTnwaMGYSMeoCdDtvhIY4M7jvgFXCRVzOXTI5HFc8SfTYTNFtPkf+rnLRAxmnocqZQd5YW8jz7BvPuAp3w63XUSqGFJlpt51mzmCsesQUhuRMHE4WzIBuKotiJ7L9kSwuRJcnPHF7aI3YCBUoHAqlKxzyWajAX0jIaoQfeouWw== 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=t6F6kJr389oREnPSKtMqwsCZtWk3wAG2vXWfopMgx64=; b=EhgYznS9dDZKA2An13/L7mcBdo+dxu1YzugBcRKGTzm0RcPxmOSsd+xUaHIUaeE3Myf7oxK24BN32TbdAy5N6+sv0+F6pqAybWIvGs8bGSjg1LyTdhLY8r/aH/8bUq627NXqeZVJLP+/2KiZjpGhPmU4T/LDQSlecheEGiJDJCbcs+JjpG4sB2UHCZ1YWtm0soRwpb21pE3GwifxV3jz+OToI9ftiqxyj7igjsSgh+9pOJyXDbsYBI8khf1sjQ5+XyHC5+NWjd650oun8tvccOrjAxvBTLonZx0lwOc2aO0hLCWC2yc9N7x6k7V5624C+SzSLm95EZMqAm8t9yZtiA== 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=t6F6kJr389oREnPSKtMqwsCZtWk3wAG2vXWfopMgx64=; b=BidmpD+gSDDZCvObghMndCHfUrc4EorHLFqhGhnhJujh9Q9qr99/M2EVxkFqFJz4gJxFOyd0xSnBbZzsmKLGLJHEQ0dyo7hm74M5IkihB98hNqOuia3k3BS+mM5pp4e6HcKslu4+hrdFBna753selT12xaHvQcXpkRqsZOMSIGXCK0KMuHpYkaZ3z8TB0b5Kj/4nXcO/bXUvJguaGngsAnPL0tACcE7LuIFV8fQo0kmAAttXiMCEMEghh7Zo8IzeFrtLQpqijPlFRkd2q+GbuTx7QyGBB7gJO9WzTF3t0u+sBvUtgaWXEd/KFcDTVERlD7425PnyaUoKxFPWWOSQJA== 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 DB6PR03MB3013.eurprd03.prod.outlook.com (2603:10a6:6:3c::28) 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:55 +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:54 +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 23/35] net: fman: Clean up error handling Date: Tue, 28 Jun 2022 18:13:52 -0400 Message-Id: <20220628221404.1444200-24-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: 40525e28-6bb8-4004-359c-08da5953a135 X-MS-TrafficTypeDiagnostic: DB6PR03MB3013:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 78qwrstOVu44Tf1X18w59fUtPct+QyghECNMH58SNrO5jP0vQ1zd7gbZ1whRXhkl19QucgSWiAyQJAkn9nh5kTVyucODewUKd7ZbmeV4hD0Lhp1C04OYShfK1y89ivRnFkbzUHCev403q0fvTCGHgZOu/ylcSTVSACQys0pCkWHcvcKoemkFJK7tPAeZRHKNQdcs4vwDWkN2brAkRjXpVSJx5Du3Tu+9oUDXFB791UEaySYYKVejcaYb708ehz/HtMy1ocFQMdNNSvd3xPofoiTYY0yO3tYjfH4y7TcTquys5skqt31j0KQH7o29zHu8HC2nevm0R4fD010CjoVgVZWh6ibMY+2uu0CZugRSbduNbBbzDV0YOYd904i3A3pfVTGEV8oLiz9Ubnq/5ClhVdpmB2iEU3ZosrzDGaXicR0/71IF8j3OZcTq/Bukxn57BSlCQEerws2xRkixfFVOz/CHZ1T2jU5oG/vll5UoW6vpjBYX/5tuAxOfIqUZMkanGX0R/8HqZK3E/r3Rd3I88Dmx+XvEhSk9FqeGBqW5p40V0Bd7qZfxcmivnsGFNX2nFFm7+716Im9lyLeubS/7gJZ1IeH7ZCKrkuPKSMAQJlMF6ruOc/9SmHRE3iXiA8ennRhKZU0xCiq3QsKmmHdsQXFlrYCvSLoUB5VZUada/Z6rF4pSLCvikUxXz7PQ2SpSHsCtkjhkyVcVhWRLgY4noHKyuYqQPyVVQYp4pVPI+Krcf6S3HTXZ2nyN0vbyHh+7sn6t2S/zCZBan38DG5zM2jamfwHobRn+wv1PMr2LJ10= 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)(396003)(39850400004)(376002)(366004)(136003)(346002)(2616005)(41300700001)(26005)(107886003)(1076003)(66946007)(8676002)(6506007)(6512007)(52116002)(186003)(38350700002)(83380400001)(44832011)(6486002)(8936002)(66476007)(38100700002)(2906002)(66556008)(86362001)(5660300002)(54906003)(36756003)(110136005)(4326008)(316002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /OGx9e/UbdYdm0bqg/Ei5l3MRoQvxE8l9qXEAjMbCjcB7pGKc5GG6lQ0xj0kCsRUUdrpSawnh/FcybhjpTKz+ZAdAJg0yOE9hFHRSGSgRcR6IYVLLAR9IaNc+Fn0eeoaPdljmNOGpOzlZ+VjHKvWPbc0aza/EW3tDrt6gKjQfGfGo5xajPo4npeKNdJVIRnFwqMjvXpII3Op9GPzuygwIIbRRB2bTOM0kE5zPoEK3wM63Sf5zC3pzZdQ85c8xBM97RJyXXadqkaJWbb2EjH06UmUlGDTI0BvmK3PjE9Xt1kQh7rGTtQva+SHw7H+uuk/f9ZOSvihij6cWLr+1PGlCUxSaR7NYv0iCRgvqLxz8zpJtrMAFHp0uR2x8N3FsgIs8rkzZtPRDSrHJ8BCo1LVKcE1GVliRjMOO0eK0Anzf8zVkkPc4rHMl/5oBlRXPBIgbhSWdZYeVllgq6u3DLuCIxke6GDUxKPX8SX1lKRWgWUXaQpO4yaNi02Cfi+v6as38SQT3T7eCSH/s0M1pwT/kgVnI7eU2Fr8dYBR+F8A4Fu2I20sGIc0CHrOxBzZy6ba8Y8gLqm4VPxh1sDzifLihJtSSs0gLrtI7kt9j7BTMNfCJLqXsVtpJywLDQEV1e6BC3Irj+Ht3UWPyVjX6NSGyN3OK0x5/CFMpQl7obWTubraRkGGJSZJxXAAUwrzHo4d6myhbQDmY42g6/4b+PnvmzkgIXtcExSWtADSEoFw9I+kPB4+ckY6yM/wInCL2VVrejCRqGCiejWS/iGGcyBuwzZVpTLfuZb7DOI8osMjUzo74hI8gXQKQZwWtLZLKbReeL2KtNrGQw8idMh4oitpXO3JGl9UMgOZ2GTvkF5tnETioWOZdGUlfVU8dqLuAvR4zh3kld1nBdXkjwU8Wbs44rwa+nGI1rcp+FVQt3tzGfHV6Y+1ZZMak1vXUt2U8m5QWK2F9xzfqcRsdko06Af9mlYVtbaE+65F183iJUhnbz1+XbTrz5yzaGa+p6zuFjVB5Ie64EZ7Lo5vtEHXZ8WFOJ29WMuxe9HbLeJyAR4H0UD1EhCau56U2IakuFNNVSw28ELyoK/0PldJlroUsMfy1cjkKwwdmnl7w7E93q32obReDZ187wZGZtD7pT0osG9c+psUqk8ZmncXpdXtRcGKYDsLvd4Zd2b61Bra8siTRo3+4trzNNTbiv5jDgESbZ+45xL4MqsphcAevZqgD4ilPAGQXDfTdX4xozfnD7wotBDS1WnnMMlB749wIGTtTBTD8su4FrgmgdwPNFkYSsfHNgRms+rJxsVpUpgCpkzDQ/lcKo8CHXXFy3+vFpYiFL8F2Qeo1G5cMf0odEqRar/q8lHf6kdIoiMUsp9DAT87oD7T1FiRup1Yg9pgqZoNM+1W8Sfr1MpEw7kd9mwbKoOXLMqpVGy23GDQ0Du7i16dqAkmv2lrmdWBtOTsBLTyP5/lOUOBI71ElBqVh+5fbZZ5Z9wGwwhNmri15dC4iKhMj9q3ECoJ3/6pAFfZwmrSrbUlrpII13J+3RE0UFC7qItWZ4Lw94flCtTu3d8NNjR6WOJVZywOCKl/YL46a6735jgqHr5JZ3L4L5rE0r4QJ214tw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40525e28-6bb8-4004-359c-08da5953a135 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:54.9060 (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: jrGaG26RZE3FT+11rgDLEWcWomxpZ6RqD0ZndZrD1obIaOhqNdMn4OKYxtybl3Brl1at3iygJZutb2R2R0ixVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB3013 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151508_568497_E0EFE962 X-CRM114-Status: GOOD ( 14.25 ) 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 removes the _return label, since something like err = -EFOO; goto _return; can be replaced by the briefer return -EFOO; Additionally, this skips going to _return_of_node_put when dev_node has already been put (preventing a double put). Signed-off-by: Sean Anderson --- (no changes since v1) drivers/net/ethernet/freescale/fman/mac.c | 43 ++++++++--------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 66a3742a862b..7b7526fd7da3 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -291,15 +291,11 @@ static int mac_probe(struct platform_device *_of_dev) init = of_device_get_match_data(dev); mac_dev = devm_kzalloc(dev, sizeof(*mac_dev), GFP_KERNEL); - if (!mac_dev) { - err = -ENOMEM; - goto _return; - } + if (!mac_dev) + return -ENOMEM; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - if (!priv) { - err = -ENOMEM; - goto _return; - } + if (!priv) + return -ENOMEM; /* Save private information */ mac_dev->priv = priv; @@ -312,8 +308,7 @@ static int mac_probe(struct platform_device *_of_dev) if (!dev_node) { dev_err(dev, "of_get_parent(%pOF) failed\n", mac_node); - err = -EINVAL; - goto _return_of_node_put; + return -EINVAL; } of_dev = of_find_device_by_node(dev_node); @@ -352,28 +347,24 @@ static int mac_probe(struct platform_device *_of_dev) err = devm_request_resource(dev, fman_get_mem_region(priv->fman), res); if (err) { dev_err_probe(dev, err, "could not request resource\n"); - goto _return_of_node_put; + return err; } mac_dev->vaddr = devm_ioremap(dev, res->start, resource_size(res)); if (!mac_dev->vaddr) { dev_err(dev, "devm_ioremap() failed\n"); - err = -EIO; - goto _return_of_node_put; + return -EIO; } mac_dev->vaddr_end = mac_dev->vaddr + resource_size(res); - if (!of_device_is_available(mac_node)) { - err = -ENODEV; - goto _return_of_node_put; - } + if (!of_device_is_available(mac_node)) + return -ENODEV; /* Get the cell-index */ err = of_property_read_u32(mac_node, "cell-index", &val); if (err) { dev_err(dev, "failed to read cell-index for %pOF\n", mac_node); - err = -EINVAL; - goto _return_of_node_put; + return -EINVAL; } priv->cell_index = (u8)val; @@ -387,15 +378,13 @@ static int mac_probe(struct platform_device *_of_dev) if (unlikely(nph < 0)) { dev_err(dev, "of_count_phandle_with_args(%pOF, fsl,fman-ports) failed\n", mac_node); - err = nph; - goto _return_of_node_put; + return nph; } if (nph != ARRAY_SIZE(mac_dev->port)) { dev_err(dev, "Not supported number of fman-ports handles of mac node %pOF from device tree\n", mac_node); - err = -EINVAL; - goto _return_of_node_put; + return -EINVAL; } for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { @@ -404,8 +393,7 @@ static int mac_probe(struct platform_device *_of_dev) if (!dev_node) { dev_err(dev, "of_parse_phandle(%pOF, fsl,fman-ports) failed\n", mac_node); - err = -EINVAL; - goto _return_of_node_put; + return -EINVAL; } of_dev = of_find_device_by_node(dev_node); @@ -465,7 +453,7 @@ static int mac_probe(struct platform_device *_of_dev) if (err < 0) { dev_err(dev, "mac_dev->init() = %d\n", err); of_node_put(mac_dev->phy_node); - goto _return_of_node_put; + return err; } /* pause frame autonegotiation enabled */ @@ -492,11 +480,10 @@ static int mac_probe(struct platform_device *_of_dev) priv->eth_dev = NULL; } - goto _return; + return err; _return_of_node_put: of_node_put(dev_node); -_return: return err; } From patchwork Tue Jun 28 22:13:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899098 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 E8AD4C433EF for ; Tue, 28 Jun 2022 22:41:14 +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=XwjnQtW59kmCchKdq6euVEi7dq8SP8eGe6n6AdCWju8=; b=iCRSbpI4phDqHB m6kLds+gtTTB4wfjJn6VBNQRjcaPqDkL1rG/n0fAOpmWi35lNuEC7IRlXMbJ6cnsNVEro0LE/iDhS BG0fgUjbzekr1Xo4AHWo/DE06/cWz+Q6aPiZAEPRxF2VMtKeC5Ce2X8fQ1k0FdLQvWCmKQSZCBh3O 00b+9In3yfV4nL5xPuno4m8bkmIW74sO7ZerRjYQcQDVGspWkVgl58CzoI2tf+PgpXucoA62v72r8 il9/0NWfkNZFbTLxOyrbld0T3OYgc06TF0Ba8/XA8XBZCx+zYkgf7Z39wEvJOc1YcLQstbS0736GV xPN2tIR8aVAEw0hxdK/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JrD-008TFv-2S; Tue, 28 Jun 2022 22:38:56 +0000 Received: from mail-am5eur02on0608.outbound.protection.outlook.com ([2a01:111:f400:fe07::608] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUB-008Mk7-Fw for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=frb07D53+EBGRfY0GSDBcuib2FZm9OnAPOmZe8iu+yK4tnYd0SWI2Hj7/HL14T7IS8/eN5DXtSeolTGbxfBOLgow9PkRTdPQTvNj3iGABtM7XzE7yRMylvOkFKRCUL0DrSi84cloCNl3MRq/aCUjbRsVauozloSFF2xnjMcGfwzGT5slyLYcxhW2zCWh2WEuSjSau+PyVUSwohl66rkO/xZdQzD9gJuzEYnbUgx2Ju8VFLoE0G4JmgTfBSVp42pSkGJp+HUOzkOK8VkaoT1w7aleCpJf4AHCxNsiJpZKJZ8oaEFyuYXZ7JrqQxC3Ljkd/+KlXWXbTq0AhrMTgdnvPQ== 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=PCoTL6T2wxI5vKbrkQY83fq1NJAYMLDQw8Kz5R3A8s8=; b=UqxMpy9KKq3+j78FpxRseRnhlcpvfT8v0cavdmFLYluXpEObaxEKKrFAwDwnDLswi6XB3qNVM4prqpuchnw2q3Hu20hOZn6nYBCK8UV5b1Rb4uywTeAEDW7vGfNOe7IOnELUnaJwhmRi2YN5ljRD6IefG04QoYMB0HSrFqKbqRcqNiIEBsd7yVXRTF2/rwIvMEhT+c1F6Bp8HIh1B4Z46R78+/zVgv5Q12BNq2zUsLX3Cm3xpsH+wTon9ooArVJPG7z6uWJeHSwpNfzg48UW498pfdOInsceQn6FfQK5SuuIvDAYGaGEzeHBjlJ+yUDi1AGhdtpXQ8Ll2qVeA49yRQ== 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=PCoTL6T2wxI5vKbrkQY83fq1NJAYMLDQw8Kz5R3A8s8=; b=LxFfS0mRJ39In2EpNfu1gbI/RqWzG82/koAaE3Y/ZVmotEsbzDUyMrzDUNJWVWRV6EFu6q/E6IfFcmeEsQOwFJiTFr3Ydz0eKB5mCOQzyULXwOc1kfoZqfPTwwnBnVXoJJXfGI5tfcGe9+GeNcBFc2c2YK2FMu4TC9p7Qlh7Gz0AqM2wBbQ6v9z9rExT/hh62ZMOBL7wOXtwW4GS++uHe284PmCaoiWCFkjNqmGD2+UQ0VRtb12Lqapjp9KAml2OxCz7KnACte+YS+GzvVSZ790CL23ZL73FjGaVyITdFDg9B7iFiOvcqxa3ftKm3ngkAqEgzKiTjLpjTHPYVSOPPg== 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 DB6PR03MB3013.eurprd03.prod.outlook.com (2603:10a6:6:3c::28) 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:56 +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:56 +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 24/35] net: fman: Change return type of disable to void Date: Tue, 28 Jun 2022 18:13:53 -0400 Message-Id: <20220628221404.1444200-25-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: 355e24e5-1229-4d0f-ea89-08da5953a231 X-MS-TrafficTypeDiagnostic: DB6PR03MB3013:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3r+xKahC6YhyM30guEmpCHf/tiIlKhZGZ77PSfOwkU4oL29Laj/kE2pHyR4MhtRn8sEs/MlgQaemFCQy+zyafLGGzdrw1tHRDldub+Xa1R3RRPSP0sEDyjTJaZpTcivtYVDF4WtFUm8gO/nPt1zk6jqyj12II308HXJl0Pzz2yEeaSM1LKoSEGfTpK0gmy6OLQy0Jae1JNdHwadNUrePJmKrLFmmWbNCSKYhCINKUOZLorq5mOKH5vfoqw/rFdjli6wphIa+/lCOYIDY1u+GQHIPXPj02VeH1tKd5D6onY/KjKX+sBE/3m0sXq/dElOWy6q1sm4b0L17E9zOAPGbFK1iFvoC65aGovBtLTn/u2eVx9LVpSisraqfl4lZuSb5ITE7Xx5HadZ7G62BvqXliVnYq9Vr204IceY/323kaacgEPhMTKYtUVgMtMkZh19oGDCPr0tWwCUDCj7VIUBL3C6HQ21b5WX2svhiwqrMbqzqEoOou3yA7oxf9Uq8jbMREwKDcLEGM+xjX4OCbRVv+cwMnmhLYrDLCTB4/VK3kwVoZhCbcx3zc2EHKpP1IOtHUV/Jz3fxVKl5Ns2HNORnm+eqlCC19WlRN8rXJzAYD2AxWU5wwIXc1bjsbvwoDZTQrU5C/dIUaK1tNrYsAmprGpX4c0bycdEBONEFyDYbl7tjgoAe2YwyLVmr/82u7mr/MUt+Tue38jZXca35ES2wo2PmP3X0Zgsr8BZ1WdjF6IkmDBxRGyzhDU/DlEkVocKcfGzqn/geMTeAD3p6tvDQFjV20JkPY1SKD+BsK7Op3K0= 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)(396003)(39850400004)(376002)(366004)(136003)(346002)(2616005)(41300700001)(26005)(107886003)(1076003)(66946007)(6666004)(8676002)(6506007)(6512007)(52116002)(186003)(38350700002)(83380400001)(44832011)(6486002)(8936002)(66476007)(38100700002)(2906002)(66556008)(86362001)(5660300002)(54906003)(36756003)(110136005)(4326008)(316002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: i/yOAdbZxnXRkUf4SNq4x1bXoJHNu0THAp4WNRfPrdF9XSjfkWSAlLcxa0Ky6lInIjqw1Wsjs6Zm9z9UsmSH0w7PCdt4QD3GJU1FsTBGh3d7cfZsrVrabFKy+phi8AXGYfYWxwWaxLYrg0pgRatieUqaI/a2fIXxHOwTGbjkpS3RdEzMfAp3fCcCdWaDdYz1UMHcDbKmDsUcYf5/wqbNdhcM4F0pV+5S8yz2D3Bic1Enlz372ySBHcvNnGSVwe/WeDyCAQMJZiYCyyU65o+SxDRBKF5SoXpHESQAnCjRc2QoxsNiOuw9gxhSRng5j6azATDAUJjCY7VcjbxSsI0ZokJzxTz5N4Fwy8AbIIS6SqIqSEQlFQBhNRn/v1hJLaem9FhTN03JivsX8ugvP0IikVg7TRlcvSDfXDtKaew+jXhXzRudoj9MGpyuceCXJ8WAJk79NAQYykssxElyjHSIXHVd4mCFtpALITIqLa/iZ8erOmGbVtNAhkY/vjrp+z/DA5B5SfItQTCik4etyqqc/itDX8yOYRpgKtKEh++BhI73mOdjCWKmmP+xbUj6j3ArybcoZ0ce2t5fb6xfB66pRuxBai+LTM0JcDF5WGgTAhaxEZWCMatNHdw66mZa1rLr6yyAa9Kq8fi4negoTlNLMPHU/dMStoFLbe2cT87A7mK390e77fdlGBkgpmqOY8ojSRfmezoLKjEc1dcP56o2RWonOJZwzU8wXAZoFDEN1VbTaV6w+eNboX92F04HZ3sraziIxxNFbf0DFMvQbDGZxj6qksk8nYXJ3fPnv2c3Rj0AzY3d4ILymh9OrVjjyOeZ9vpW8VjA3rG2UEd5DVrF1AZL+3TJN+7Wx+jvPeP4WctqPxav/Von86Zi7OeTDLQ0EGgII6DDnXZ9K7Sbt1oXDuGGaK4Ou5qR1qkDvrsEMbCiTQ9gyq9lANtfgG0L/o9rIen7KAb0TR7AZX4WTEPs2ttLN5+12w4lINM9UedmS1DOrFU5Uo/OBnLZ+J16cw51A9WI01/pxa8mdBv61C1HC0Kt+KvAQqKeLgQiIxPFfJvtVP2EtmR3FCzB/dOBnYRMszwsD70uxDlGkfw0HA5bQ7Qx2PD0/HRbkHSlTJ85hg0FgD8VDIjAw6OCkLx3mAL3GyFzf+99ieByzn+jOHqeG0iAn/xCKDbodEd5n2vjt2jjHlBSIl1x1eNH4bSe2LEfwKjTPJggKXxxfLiTcTpU8FT4+QjiKEYvx4gL1WgAzmhMu0PWNr7g1LwpikGJjuTLNnc/mQf3LLrRw40co1X/mRTT3ogL3jcQw+aeGvUnzZMXBsWjVHuzE9Typ3YJRw8po3oV3txswbjO0QNiWQTbAdh1y/jvMfCPs7bIwltVbN0IWo8NAmW7IYaUg22JaXRyMuzkOz4UbOe5MP0qphhosbrxytBf6qj1+RuCi1V5Yz7/OqUb2jdWS9tdAX13ljX0v/n7+3wpLQ4b+eW18hCNs7rmPXLBsawRic7p+JMVP3/KGSn2Ig78gUio7gzzZqLHmhTxQAZRaWP/qoMxT21zn/lib6RoczHnUg9/OjEvFQTznaROmGVudA0HRYdz0CId0VL4lUMenrN5NVmrFsXbZw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 355e24e5-1229-4d0f-ea89-08da5953a231 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:56.5621 (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: +BKGATnhskW70ZBKX8D8S7FT5h8On7jJNe98WfE81qA2pzqpb1NrvX4rowqsQZ8PnhLTQnO4KGapSniWWEx45A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB3013 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151507_634025_6545E923 X-CRM114-Status: GOOD ( 13.90 ) 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 When disabling, there is nothing we can do about errors. In fact, the only error which can occur is misuse of the API. Just warn in the mac driver instead. Signed-off-by: Sean Anderson --- (no changes since v1) drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 5 +---- drivers/net/ethernet/freescale/fman/fman_dtsec.c | 7 ++----- drivers/net/ethernet/freescale/fman/fman_memac.c | 8 +++----- drivers/net/ethernet/freescale/fman/fman_tgec.c | 7 ++----- drivers/net/ethernet/freescale/fman/mac.h | 2 +- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index d443d53c4504..0ea29f83d0e4 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -290,10 +290,7 @@ static int dpaa_stop(struct net_device *net_dev) if (mac_dev->phy_dev) phy_stop(mac_dev->phy_dev); - err = mac_dev->disable(mac_dev->fman_mac); - if (err < 0) - netif_err(priv, ifdown, net_dev, "mac_dev->disable() = %d\n", - err); + mac_dev->disable(mac_dev->fman_mac); for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { error = fman_port_disable(mac_dev->port[i]); diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 7acd57424034..f2dd07b714ea 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -871,13 +871,12 @@ static int dtsec_enable(struct fman_mac *dtsec) return 0; } -static int dtsec_disable(struct fman_mac *dtsec) +static void dtsec_disable(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; + WARN_ON_ONCE(!is_init_done(dtsec->dtsec_drv_param)); /* Graceful stop - Assert the graceful Rx/Tx stop bit */ graceful_stop(dtsec); @@ -885,8 +884,6 @@ static int dtsec_disable(struct fman_mac *dtsec) tmp = ioread32be(®s->maccfg1); tmp &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN); iowrite32be(tmp, ®s->maccfg1); - - return 0; } static int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 19619af99f9c..8ad93a4c0c21 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -701,19 +701,17 @@ static int memac_enable(struct fman_mac *memac) return 0; } -static int memac_disable(struct fman_mac *memac) +static void memac_disable(struct fman_mac *memac) + { struct memac_regs __iomem *regs = memac->regs; u32 tmp; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; + WARN_ON_ONCE(!is_init_done(memac->memac_drv_param)); tmp = ioread32be(®s->command_config); tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); iowrite32be(tmp, ®s->command_config); - - return 0; } static int memac_set_promiscuous(struct fman_mac *memac, bool new_val) diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 010c0e0b57d7..f4cdf0cf7c32 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -408,19 +408,16 @@ static int tgec_enable(struct fman_mac *tgec) return 0; } -static int tgec_disable(struct fman_mac *tgec) +static void tgec_disable(struct fman_mac *tgec) { struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; - if (!is_init_done(tgec->cfg)) - return -EINVAL; + WARN_ON_ONCE(!is_init_done(tgec->cfg)); tmp = ioread32be(®s->command_config); tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); iowrite32be(tmp, ®s->command_config); - - return 0; } static int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index c5fb4d46210f..a55efcb7998c 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -38,7 +38,7 @@ struct mac_device { bool allmulti; int (*enable)(struct fman_mac *mac_dev); - int (*disable)(struct fman_mac *mac_dev); + void (*disable)(struct fman_mac *mac_dev); void (*adjust_link)(struct mac_device *mac_dev); int (*set_promisc)(struct fman_mac *mac_dev, bool enable); int (*change_addr)(struct fman_mac *mac_dev, const enet_addr_t *enet_addr); From patchwork Tue Jun 28 22:13:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899099 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 52B0AC43334 for ; Tue, 28 Jun 2022 22:41:56 +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=SrY5mhU1k/5bbpR+NPN/Rb0JZRClg+yYl2r5MdATrkQ=; b=RnI0lH5d0UQCMl rXV2xYPjcNNiewRJU38RtCkWtOrnuRDBjU+002EkpnpXYlntlNfMlInOLcxJXnvJsLnZ2JCLRjvkM B9x4OjVViEXk3kC/LElY6QzDozS+JgRWM7QiosLTncYHHCzWQ7GrCg2v82v/tk2xIatiAdtcl8cFV vpv7xfFbaayVi37MipQNL+1bevjS4plaot+8c2g2/H31hHbbhwmTdM7r2NfTXOhhrIqdUERn7y0Gd O/eonT0MIhE32XOMsEj+/zKV1oNnD+d56NeMWSBG5H2lYd8VB2ej8+E43My/UvSu670BwyFw8wARD rGwND2kd8t2Vtbpey3Iw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JsU-008TXu-AW; Tue, 28 Jun 2022 22:40:16 +0000 Received: from mail-am5eur02on0608.outbound.protection.outlook.com ([2a01:111:f400:fe07::608] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUG-008Mk7-JA for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eGqNEFIDJ2IQn8kh1UqQm/s5+wCw26Ntpv/UWbGYf3C+l+3CXgbvaVRCCTvPHSAk3ukAxO7FCBXZUQxauhCcOiTTLiWhBK6QZMstJizXDEsqXuc6/hWheL/gvLSmU2IwnNiVfUp0m1JNlZIbouxqizAEXnJBD1IuCfuh50r2RPMFdAJMlT2jShhADxPxLB+xGe623OPgKoUlbFufQrMbxlfySlZ/jYXgm9wc7ikz+0TShxJnAuZ5oySoaHFHN2JbbbDdOD3gYnKkMd/DKiKmXEZOIu2Qeol9FRpWaM1P8tj/wBKBvUTKcIR9JC/a1Wd/dPQcNeESF2qD5G1TatQTqg== 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=rtA0DbriMocicsVV5jy7nkwHAoHPdx06OSTuOuqk180=; b=R8xS9lu5IsGvSWN7cMq4zNbXYzYjPlPMdidFGq4MZBnpaT3IdUrQQsVZQHDEiUxHIstJNb4QUlgoiuIQ/w5FmMcRGfN1gbZfo3/5pW/kYnfQ+LHg1dwLeyrIzmiKiJfK66ZJph4Pw1ZeAAj4poNlHWWyYT5mNQ2p2yt+PI0tQVaXHmQqqNUbkH9wwVOFpFUe+fTfTXQVMfplZMHKiOiKkentKC8nYJ535MqS9RNBGq7YN4Eg++3CngYxw2cR9G+IvhmQYESbrGYEPZgANqEDyD9hKAzB2B5yQHZlOF5JoVjuUGHR621yaxt7j9z0SkG6ofL6q2wNCSXR7QqFVYNwOg== 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=rtA0DbriMocicsVV5jy7nkwHAoHPdx06OSTuOuqk180=; b=pNTEkEGR1Z11uMhmp3rfTiJMTs3oB0ADPbjVyX/+1oudZJaRC7t/1KOsbjqlZHycbpvuhiH1Io5g1i7EMRvtzRx2DugXRKBvtvv+aubKH+0JeZnoRuYzrdKxyOZyHsa+FG/y7mqnq135wHDb4+hmH9QowpHwQEroO6psqFx3mnvHlDk139/xDhKQCDB8nbQF53RCXuXnmNUxlD4f27S6RMYl3xD3LB+I3z6/dnH2hxArvVSVhePP08glZTveLYpJXKwaahDbWWYPp9XoGTXYf+tdVOOE1I3Nv25DwpWdaQG2+oDFhtbLXaRzCDNROM7zRh4VbUJXfvOQJ6wvV9htHg== 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 DB6PR03MB3013.eurprd03.prod.outlook.com (2603:10a6:6:3c::28) 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:58 +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:58 +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 25/35] net: dpaa: Use mac_dev variable in dpaa_netdev_init Date: Tue, 28 Jun 2022 18:13:54 -0400 Message-Id: <20220628221404.1444200-26-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: 4399cc67-b4d8-4530-dccb-08da5953a30a X-MS-TrafficTypeDiagnostic: DB6PR03MB3013:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7+1r788yuo80u7BIj3RFwtGuwZLeGqmkIlrzxft9iWHgC8s+QqOjec4BKo4JcYTGGLZ9ofHhT7tpv2prNoZHxkQ1Y1EJbpELxyPLqB36nAtMpVKZMY2MxzFgDUlvC+gQAsgbTbCA+WtEiYkNbk3liDKtbZgBQCQzimAVR1Wxw9bRzZXwgaNaG7sBLVtpJ9lPrwRq9nByRFwzSJ4012u/xjaYzJjgIpD1zoPQww+OQ62c9+oK5uI/EmRscU1dXA4yQLJJ6K5eNztbARQoUOZMNXJLObJsPlQXI+Rcptj6Hr04oATwaJd79yBvfkrrOXfVCj0vpIbSDmkWYSGLsAhmKnw/wpt4lZapTKFQ+yVTI2ArURq8mjMg9JeknPdUWww3JLyHuCIaTHuCrqi7wI1Pma66hgxjKxJ+J9aNv00lS2iM+QBEYWo4vOtUbvLDX3if/3DGh/8a1GmJPowDR0oIFs4IoH85rBUMPUPmoAGKYEqZLRyQXeBYNxjzk+GIJANRThQgQmRqsTUwOSHhX5eNFMc3aSRGGVfwuj3myLq1TsKPL56ZTD1sVeFv1dwOQJGnXALIpcr5uRym1Jkw5SrOptsNVn9VratXyJWNfp/5sJaVnLiQCZssXCX13VEEeaP8sPU5ZPcTuOjlduPpldPLniKb9XX9FRO5srcQwjiqUhMFtJRkkILVR4uVTxcCNJO+epIBYWHPRdPUY78ky96EqmWMUh+AwNRSzQjb21WWWZv6/4x4XtJ3GYEzO2jKyBmx+Kt6EXMXfWQ6TMJ/hq5GCy5I3Dl5dcYCygqQvse+EvU= 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)(396003)(39850400004)(376002)(366004)(136003)(346002)(2616005)(41300700001)(26005)(107886003)(1076003)(66946007)(6666004)(8676002)(6506007)(6512007)(52116002)(186003)(38350700002)(83380400001)(44832011)(6486002)(8936002)(66476007)(38100700002)(2906002)(66556008)(86362001)(5660300002)(54906003)(36756003)(110136005)(4326008)(316002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HyWE6RToxTGTAnBua3iswsCbQuHVXek8DszU4/BVTuQ51xQX2+waiAZKrEz9gHnurzQGkCs28ixiA+0SEtZ/y1FsQDoq+6k+m7eUYAjmMaDl18cjmQPjhO4XMgIlPQM3wGUzTZbHsTV1IfvrbjtEmq5s5hBz0pctJB9b9r27Bwm9/KQoxkHsXPEkT3C1NCH3NyPqOB+0ykAR3+9UIOHjf3Wv4qfhWp9wd9+rAGIWCdIQZsuQfV3HKh735wl84w6HByH91TQRnD3up0f9eL3RX8WPl3tZcszbrJY31vFBJ+My06b4hwQ14qvsGdQoMY9JU3fxzmCtY+0RfMiHLqM74o3OZsG5LeXhWfj+RHLHCs33+PE3x4o2mfUH/A8/2gfYo9jlv7AYuK+PLw6N6fsBFnGXQPeaUdpnTEVLhTW2mCD98AVaPB9zWKtVsNkcO8J4fQ8yAEOsRuCMmqkvv/ISA4xGuz7T1vLkRxJr2y1OamEMt/sRXMfMS5AYs393RyPu6C78CdQC/hJ74KCaXx7cqNFVA9i7JvpMNP8tDNHKUBf/OsUUUtN42kbApTyeGLOBm1F2dx8fblk3WLhNDw+pOAxlE9x0KEkUjBKGvSjfzqAe5AT9PnWMS/E6SJNlRaFkoBcVlCMaep/CHyOuXsFQEM2x2kNTpaIWP38AOhYxkdfxhidYlsI+fF6E7Q5zvBdqBoIvWzoFnOUE99nyUZDUUZFZbLTLWaldEEA8fD4RGrRhe3a+bsfKoEjGtkCQAmaaZ7E4QJRmCikUVli8Us0eh0aPfhrVVHys8ZuxNG8hL37M0NVXMgPEWS4bPInoZfqucPUJurt6D3fLl6zXhfGwxcJg6KnOiWIn7pD9EgvYKtixNWVTG8OIvcph1P66RzMpR7GPGYLrhrMnfjHu0QzAEOUpp1+hJyErJEKr4v+wcfcPnR4EJ6sqsJe4HD5VxGKOCEFLrGabdbITcOqylHPm9LFVECkZGd/pa/iTCjmQDVgtlWTdN/nS3/9WkjqsNeMClx5b3c+c0THqSXHGznFLXB8XrNMZlHzLWzyA/jgw/qpaJJm6uW8hUpRYX9fBjXAbs1Rb2PyosgQ3I25h/5lgQWmPeVEeGteMS8VDAznVALAtMvVcr6FjtdWrXoY2JyVNlosXmOW4C72WTmvk0JrNtmDYhmLjmbU9vEEdg8wwwzSARFKWBRFiqH1xe1FLhqCwQiRKGE13AeK/Tcyi5E8ijDqIdxTHpC9+Xv95fcvwuk0AdDjqBZCGDfwjKxqaxfo+f/ykQATEcPkkV6yGQFh2JSRJyenEvAhvruldAxxS2bpFyfwEtAz+m02asOul7L1TA0Qf7Gn72z6Jaj6bl0MdOOSPro4z10KEtSlB7Biq/rOB2ozUs0F5ZLrY4jhbvIeSi1KzLRhRj4r6eu0Q/05vyl2Oxiw/eC/nbJRQP027nbVpkIz8+aBghgH3piQMSvzCdJxo1DpcanGoCy2/U7GKtKHi/fozmESMqdqRZp2uNCuzLwlVWh/4L4cP4yLV1mE9Lm9/6bvUOzlBON3RghCygd1Kb2psMYWecx2e/lP+81ntHwYybBhwWhoYHwu9VXkanQfiQ8IM+Xc4UcTuvMxOmA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4399cc67-b4d8-4530-dccb-08da5953a30a 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:58.0308 (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: 7C1x6grwg7Q6JoZOtnz6ExxXL0KVV8D/p3JT9+XqB7xKtt0lGmSKVxeFu92YTlEPMMNKau7TVHqQn54x9MQQPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB3013 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151512_667910_3FEAB57A X-CRM114-Status: GOOD ( 11.74 ) 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 There are several references to mac_dev in dpaa_netdev_init. Make things a bit more concise by adding a local variable for it. Signed-off-by: Sean Anderson --- (no changes since v1) drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 0ea29f83d0e4..2b1fce99c004 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -203,6 +203,7 @@ static int dpaa_netdev_init(struct net_device *net_dev, { struct dpaa_priv *priv = netdev_priv(net_dev); struct device *dev = net_dev->dev.parent; + struct mac_device *mac_dev = priv->mac_dev; struct dpaa_percpu_priv *percpu_priv; const u8 *mac_addr; int i, err; @@ -216,10 +217,10 @@ static int dpaa_netdev_init(struct net_device *net_dev, } net_dev->netdev_ops = dpaa_ops; - mac_addr = priv->mac_dev->addr; + mac_addr = mac_dev->addr; - net_dev->mem_start = (unsigned long)priv->mac_dev->vaddr; - net_dev->mem_end = (unsigned long)priv->mac_dev->vaddr_end; + net_dev->mem_start = (unsigned long)mac_dev->vaddr; + net_dev->mem_end = (unsigned long)mac_dev->vaddr_end; net_dev->min_mtu = ETH_MIN_MTU; net_dev->max_mtu = dpaa_get_max_mtu(); @@ -246,7 +247,7 @@ static int dpaa_netdev_init(struct net_device *net_dev, eth_hw_addr_set(net_dev, mac_addr); } else { eth_hw_addr_random(net_dev); - err = priv->mac_dev->change_addr(priv->mac_dev->fman_mac, + err = priv->mac_dev->change_addr(mac_dev->fman_mac, (const enet_addr_t *)net_dev->dev_addr); if (err) { dev_err(dev, "Failed to set random MAC address\n"); From patchwork Tue Jun 28 22:13:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899102 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 B3A11C43334 for ; Tue, 28 Jun 2022 22:45:05 +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=cW9h74JqZvDiWnvDR8ZysW2YlymquqnvleWKm+48mxY=; b=br6XxTVWEoY2pw UClXPfchbo3eOKu46XbLkJNCG2zSIW6IzDaJmeMaD83tKBuRBlf90aOMkq+sG+XEWzawgbGQFObeI 23CTp+dffy3fXWwMMISgrZ86xvFxmWGrzTRqKvBBGzjj6xWf8LnSUbNn/hfomdV7Q0qP0QrZ6alTj H49/LgxJ5ebAYwVVQgemUoDufF7ZsVAoJZzAPxX2PzitijpjZIjnONBi2p7UtxPOEoFS4tO/IUkpR SO7FeCoFSxU/aIxLg984j7z5qmbKO8RbRbub7tGmCuw1hpRX89If1FWkn9lOWjevpEgNmbEc0RABm iLSGjFCJGrAU7LsSq3dA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JvV-008UMS-K4; Tue, 28 Jun 2022 22:43:24 +0000 Received: from mail-eopbgr00086.outbound.protection.outlook.com ([40.107.0.86] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUJ-008MrJ-0Y for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N9SQbVhxjACcI+DPQjgd3Mt5M1Hb3vYrhxS5OLHjkl+a1ZOGzSyJmnDWXMIPZt6Gt1OJqL0IjGvuvc0wEXq1JrJQ/6L/vsmNRu2Ms3QNOy76uh1YOD1N5dWoplOv+5ONrHrO3qRZrR1T2gFTLb6NvCkHb1n9zOWh+VjpOOmzMkJsAVNEcuKUQqpDXKgT3r4MkdS2srDNHRPEEhiMEgwnz3aIHhYB27DJt8KrWZ8V+qGgnrylyfdZOR9o83bFRsY0i+rObYVuMnuJOZ1AH6S3j5wkYA3JH5MC3O3gdjwY8ZP6rdukusPp4KmYQDqAccN8rD48+7ctDMPRx1O8DqF7pw== 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=CXjsQxGekWL1pE7LAMA9xyMQz9IG0LkGJwFLh5BpV1E=; b=aX5lViST8rADHFaFGkLz1gWRbIkhEXxkpLc3w5P3Bo/MA8Lroouz1AdMqyDa35juBK+VH3/ScUskiOLlA8hn7sOMCp/9leD8EuqPfiW0Dhe2xGHfmZGgOpziApdcqecSEtneAEeSIKOuiS69u1itopLqXY6Ua3IKnTgjShNYeR/x7CFsyrN1Yp2yuXLMI5zwoBqcbL4AFdQlRuVm4wuCXZ9f2FeB/mFqpGsU7t5FiXG6XEfbUvi7wW4oA80wuCBIu2tGaQWXbcZssmc4KdlenUjN04eCcLQGnI5U5E5OrNoc7fkx7peXY0S3LuCjQ8olHIyNTFWIsCZUJdUQKrR8wA== 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=CXjsQxGekWL1pE7LAMA9xyMQz9IG0LkGJwFLh5BpV1E=; b=0L1IIWGPRBo4YqORQodmdjL+3Y3pF8R4r5Nqt6AWnsIGwW46MMkZLdTWk/Gtc37LGnlFgXq/l2VdG5llM3b9fAkpTfd7UZdpOcxv77qBG4+Ij1h2yZbGn5avDsLhDeg7QLnrIQwRkrk0vV7sstX52d968AcXyunf9KAds0uzGvTSKNa8bPtU9wtDQ/qW53BXd3BMt/CQI9a15QqHnAUb6XQ7TJ6XUgJ43Xn1pmBJYA+OdpWQjYVOItv5pe5VnNxW2gso6A1KYXipOhlWCSmoRgx6qaySOR9UiqV6u73R6qVxMY3RYjjE644m2pdzOpp7fplEeKX6dT2BDyet+5+bHQ== 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 DB6PR03MB3013.eurprd03.prod.outlook.com (2603:10a6:6:3c::28) 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:59 +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:59 +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 , Li Yang , linuxppc-dev@lists.ozlabs.org Subject: [PATCH net-next v2 26/35] soc: fsl: qbman: Add helper for sanity checking cgr ops Date: Tue, 28 Jun 2022 18:13:55 -0400 Message-Id: <20220628221404.1444200-27-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: 93d973d9-4565-4a01-6abb-08da5953a400 X-MS-TrafficTypeDiagnostic: DB6PR03MB3013:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DZDCuvLVU9quB/K1nYzMjMbSn/b6BD8UwYhEoapOo+tHyiuF788PUrdW30kRccymZ1Aqxe0rVVDpkGhJzzFDTVbKDH0flprsGIIm8VyGMWgGGy3eFi5lYiJcDy2JCE+S2VMC/sITfWfioTQELqvUecH92ypc43tjQFvv9c2tRv8gycseyI15EoqNImUnhNHCDVec++4eyKLRAxG3czV5h9Jf7sxtB4GfrCIKuv3pnTH/I0ftyao50oY5QlS4SC+r0Pkr/4SERBJatTmWsu/JnwrNyEal5if7uhxG4BKpEjSEM5RnPWlxJNfAPEy1na/YF8HuJm0CD8V/9ps4szHn5B2NEeaXaGBvLav/CHn6rUmfKEBsGXELhZD0XJDf5BtiMbWMWvcV0DOb7juGq5sMMz0vDz8FDX9lWYsNTNtkSCKfKgT7GNXG5ulSst9Qn+R1vk1NwDUzIqoqS4mxP0Ju/I4cK9OzkiAaKDfGQfVcw1MEhWE8CXiTSdjk5kS13bwLOzCbPZeD+wOuVcysZbinqTka99i+BahFQaOYQv6EgBffcr2MWSYOjAoNRMEJI7qHMaL6nzHe6ZB4CeHU0kQZn67mOD05XMQJUuKu+2g0OWxa5tzynqSc1K+WlUEjfk/cZQwYvCPhYDSNYyxShtkd3M1a03KUpNQpQADnspRJX0surX5vKkRiC0Zm9jD9BAwEwLvVvwTd223VgJbVLMasO3gtTWkHvZJNQU7Xq8vpV1X7Y7J0UWvjWSUpRHwNYsjU32LnNtDnO29E2kYXXMMnaytbovrwSq0/yCMb4R5C5aM= 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)(396003)(39850400004)(376002)(366004)(136003)(346002)(2616005)(41300700001)(26005)(1076003)(66946007)(6666004)(8676002)(6506007)(6512007)(52116002)(186003)(38350700002)(83380400001)(44832011)(6486002)(8936002)(7416002)(66476007)(38100700002)(2906002)(66556008)(86362001)(5660300002)(54906003)(36756003)(110136005)(4326008)(316002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vEaaZh+TDP/XLv5nhIatnHtaCQoFVe9ISdIaEGKqina4pe4WCU+zo1Y3M8aNbbKbtHFWmIYWMGWftiyZfTXr2XAKPxcsA3HcG8QHuxByCUPTeEtPCoeErOvFHXPYiNbMn2fM3pbWQ6CnMKSvzVl26H3apj5/xVzWyeUQtCi0yP1+Um6BIZdRNhdrqGm84w6Zg9k2/oknnX0VtT6EoPCJjYKKda8o95+pYFoR9/O5Dhjr0uVWMS2IfgS7iexjwAG8zTEAs7LR4Q5W1wpEgX22ObGxURf8eLokpEK2Rlc/QW7GD5QMoJAnStOO5oR8YyOlvWgYcViBTTqzv3oKGP3UKFhq13uaGDSijhNYstw2EMHw1Neyivs8aMKeO6jQ1c1MikZnpJNyp2UCUbVs4gBFMh85dskXPZQFqUVtVuLM4gZfc8RX0bM/gcddUvpa7TTGLEQ3+Ezv7MSfJedzq0u7/PEgCH4IOQ7TvYcrkHRj3FLQG2vyL+7F+r1BJ2GuMpw3V3pX5zp2MuqbgpKK+vft7O4vB/kE1xV8Evhf1LSynnQN9ZDcZe4UONHix/GJw8W3RpVtBkwQ4Hxk55k7DzVdnhDln78WqDM8auEvPYbKT0OZ/3B5Q37VlrkMk15bKWhLETGdHoThukRS8tfscUwUAGH8uCmWAQfX49k5B2OPmcT0u3PzH5l+uk7SG9WCSiPdh03QCUUv5H/z6AaNCahlGI7WeXkI7KISxeV7gYAbxq+6ydEPQAE3lgc5o/heTAUuofE+q/WkhSvz3C2g5Z7q8tef7wi+EerxVSxIez8ds88SApbzDGnu45UDAosBv5sXvn6KXuVWCNIETyVlZXUN7dnW0mM9rA6kUXixohVqBuI4gJoWL8s8tO0u9DUv/pt1uegZum5gZhBQjvP3kOR/4QAiil49/CffjG63S5neqKAhDK/LonVHFsB5Gv06VDr5vJqKag+EOSR1MARhfrPVreP2pa742MPHsTmF9wCawrHIcUKBZ8uNAMYLvOYjwsftojjdMsoiZN21NKSNsCDWMJbMWmZDxtyAIvDIRe94a04U7UpA7G76qKxYcFs5CB4egLc8lj6ZC6yzADI3s5BDn81AtNCcsst1Ry1i7Se34YMVDbRZOWApyJQiQb8v4dreTu4ypyyL47HSIgnxHyjJnqtfXpZS/Pf/7ojsS9jQ6C1USD7etEeZlA1uLyGVYDpGzHTfGZ3vT8/r2/7fJVZVjp+eCm56Ef8HvaPpvBgopsgBdi8H1QllHem1axm3mdlEQQGn9laENaHjDupOAyaziythMLwiyVyivXLaWyl8l9F9DAxyrxXvTCqMdWF8tQyzx9kgBiiImEdWiI1mwoBNa6NMPzjmMmiobEGoG2MMg2xnweUM7KGu2hZC3ZCAoi9/cuc8ksG3HyR4POou2k+wiyL9xIbQko/05dI9iWI3t1XFSg3jabwZ9o3zY8hxuUVUWQFGt/CcCGTDBFn02G3zALTd5cIlSCpqjfQMFnQPgceWSm30wHi9LwJxBhPPHcdTBB/hmRvXvEYqUEr+OjQDLvC5WFFx6hudD4EtKvhEDF07dCsmNkb60KmoFWlsB247cbH6vIGve1BL2yCK5Fa1Yw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93d973d9-4565-4a01-6abb-08da5953a400 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:59.5776 (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: +RTihn9HhXbNTCTe1f7qWra6EFBuP5fI3C/lQI+bVd15/npLqHdcZAV4pi+z9VpTbCumvcGREJl2bYMJ8iJVUQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB3013 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151515_171205_74CCF9E5 X-CRM114-Status: GOOD ( 12.25 ) 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 breaks out/combines get_affine_portal and the cgr sanity check in preparation for the next commit. No functional change intended. Signed-off-by: Sean Anderson --- Changes in v2: - New drivers/soc/fsl/qbman/qman.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index fde4edd83c14..eb6600aab09b 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c @@ -2483,13 +2483,8 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags, } EXPORT_SYMBOL(qman_create_cgr); -int qman_delete_cgr(struct qman_cgr *cgr) +static struct qman_portal *qman_cgr_get_affine_portal(struct qman_cgr *cgr) { - unsigned long irqflags; - struct qm_mcr_querycgr cgr_state; - struct qm_mcc_initcgr local_opts; - int ret = 0; - struct qman_cgr *i; struct qman_portal *p = get_affine_portal(); if (cgr->chan != p->config->channel) { @@ -2497,10 +2492,25 @@ int qman_delete_cgr(struct qman_cgr *cgr) dev_err(p->config->dev, "CGR not owned by current portal"); dev_dbg(p->config->dev, " create 0x%x, delete 0x%x\n", cgr->chan, p->config->channel); - - ret = -EINVAL; - goto put_portal; + put_affine_portal(); + return NULL; } + + return p; +} + +int qman_delete_cgr(struct qman_cgr *cgr) +{ + unsigned long irqflags; + struct qm_mcr_querycgr cgr_state; + struct qm_mcc_initcgr local_opts; + int ret = 0; + struct qman_cgr *i; + struct qman_portal *p = qman_cgr_get_affine_portal(cgr); + + if (!p) + return -EINVAL; + memset(&local_opts, 0, sizeof(struct qm_mcc_initcgr)); spin_lock_irqsave(&p->cgr_lock, irqflags); list_del(&cgr->node); @@ -2528,7 +2538,6 @@ int qman_delete_cgr(struct qman_cgr *cgr) list_add(&cgr->node, &p->cgr_cbs); release_lock: spin_unlock_irqrestore(&p->cgr_lock, irqflags); -put_portal: put_affine_portal(); return ret; } From patchwork Tue Jun 28 22:13:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899103 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 12891C43334 for ; Tue, 28 Jun 2022 22:46:34 +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=jrI/XH3WZpzCgOkqo1fdMOU/mmWiuY3s5eRXRKrwXXs=; b=gzNaqGtSWqfN+e GGFs7oSUVO8IPWHACdeU7bgMnnBF9cgklxihQki0QdxtKvhJkfusHkBoMaKzkytBDFPc74Wm5ynjc Sn1Zc4D/7ZeW5RgCRzPaVsT8ts8OklFqfwtTy458nckMW4IZd+SfO4x/4Vtkf2XPSCJlppSEJFCSe JP1S15sfkDIKb1Cbl/SqIQvuHZngTgZTSy+GNwEkvBVdPUz2ui8eKeoYnnbqcoJxcXsWw9FQbXJNI hQIpDQT29IvArsFcYZuVbfKytEybOlLdqPVLBOOzA5gvHMGwNbTHXE0XkBEuOlSW24XFICu+mII04 fXla6/c+CdnYAwkaMbhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6Jx2-008UkV-2s; Tue, 28 Jun 2022 22:44:57 +0000 Received: from mail-am5eur02on0608.outbound.protection.outlook.com ([2a01:111:f400:fe07::608] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUJ-008Mk7-7I for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P1QNadcAEOlSekF4vIipUr2WFxdjDIeUo3qxvGjILGoqabBDklp11k6xOj3FfrMyXD2yPUMX3mP5pAFW9dBwO7Fxrl3tigN1kXjMkDlyQJnx7+He/mbeakd5hWRtPivZtKeZ2gRGw27UOMDoLlhyWBeyXEVjCynxK14pEmXudFJHGxKdzi6a/nartleEGAl+PBgtW39tHcGNXyQbvDlTRgpl39+ZzWgcvVyxu9pq+Z3T2lditHazG350PLmfDQ2yKkn1qM3qxAU8byC0GJ/aUep4jj8/kauz4QdFgG0J34yirmkDRuQ3wYG+rvZVI4qQyz04KHUk024OeMIJbuekMQ== 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=MNP1bY9j13KooahRt99sue55XBhKiRQIhLd2AYN0Gbo=; b=QE18asQcIS1K36qafQRkQBsl/UOO19QDLgfOlr7hwMnYLtbbNYDo+ysOjoGIEXwpTG7JHiXZfHXUdrNUrRJKo/hzRyDLAfFZ1yTMnoUUBze2ApLsvyHptxek6J87SBT0+/6/LYs0Ef+FXPK3+WZOmVvI8OEoDQFYEXjoi0eqjw1+nogWA8AORwDNNCcHYE8TLF6RItbOacu7U24UhjhrJ1hCqQOZt3EIC63I67izYV2w80sq1TSkvIi5dhrRfk3iKAa9By+5WKr25bDeha1TEISBqRa7VxpVUeKGxQxl4vITPjJnTDf2ByFFmaXziEajuQYRDYl24DSOY3qJeluCcQ== 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=MNP1bY9j13KooahRt99sue55XBhKiRQIhLd2AYN0Gbo=; b=Hl+aNusrpwCBQsXTHQ7s78oohkn+MigCBHRxCDq2JSXi/1JHUAB18eoryRP3RkP5HChi0JaxQUxObfn58qpIVoUJ348Ve9lJbC7ELU10SscBOVlt/wG2JjeAOLbaKfVjrcdGZqR7bJz4QFd1EYlIJImWb4Gxp62t2WOiNFbYDm189qz5vuNWntrAqSTsmyWV51bf3JDxjRcvV9k1YCsOriARCYYJtL3ZFSfTY0YAWW/dg3oh5slUjeVxeatelWEAEf7SGrRk4GFAYrqR4OwRuymZRr2uyY/F+SfFE/wpr6d164p0FRG4/EBIfLjLbLRTLkUilS4XjnPtDSdkciRK8A== 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 DB6PR03MB3013.eurprd03.prod.outlook.com (2603:10a6:6:3c::28) 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:15:01 +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:15:01 +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 , Li Yang , linuxppc-dev@lists.ozlabs.org Subject: [PATCH net-next v2 27/35] soc: fsl: qbman: Add CGR update function Date: Tue, 28 Jun 2022 18:13:56 -0400 Message-Id: <20220628221404.1444200-28-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: 6ad23b44-cccf-4850-d1ce-08da5953a4ee X-MS-TrafficTypeDiagnostic: DB6PR03MB3013:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OJGIvOSzH/z3AR4aDdCnQ0U1piecJEME9y50tQqsXW+gsXxpAucNPHqOgZalvEzGyr0SPtFu6pLj6oAOWIu/4cJyuMlICKwuv6UI6tCXUEzRXvv2dWGnbXNM/K9PkulnlBHwT3gVjldhfJidHoDEobNWoHUHEvOclRi8mL2pOrXLGuXob89bhN8urmyofnB9FKXH7Vd5NRctGZftcvV/W28PjDwRJeD9nqv1vwVekGkS9S/WoeHZyZi0ZjbCBeEj4IpQTiF/deaIehdKfcFwTW+kHmajzZLx8i0pqfJTpzsZh2jEOiYfzDHDfN2oj9uObQ4AyJtAnTe4akH71nRvYLdOrYUoePjueh+gCbBqzEZ55Z3ZVkq0s0Fgdu3oGJw022beFYoL86N3qtwNLH606ione3BQr2TxNXXiKLqgXXAt83u0noTXKKch2/Pteh/IriXxH2McppvA/QKzT0C4RV5EnSWqWN8hSA/P8o579g2qHjurdiLrLbWpWWFt3QZcOi4qm9KOky0GZrAQ1HpwJHAme7WfcKD6+6khMnBF88FYqxDSpuDPWDTZM2v2mW4hCjJn2ynsCWD8LzYVgH7dSolzskzFdrciwwpYqORqL0Hg0jdcO2pr9QOcm/U56eTU5BU5HVGu9VKuc+yxLTMktSe26cZZSviv2an3XFVXXokX0D/sV700kp/DbvTTGOALpUPAT0dasHsPzOpX01MiMXwS/D4NJDSjNHUCQJ9sj/ZslmZTZw348uH8ucy/cdUPYMA5XLhet551HTLktyXMMb2+PZ8obVpZrwrGPaPbZnU= 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)(396003)(39850400004)(376002)(366004)(136003)(346002)(2616005)(41300700001)(26005)(1076003)(66946007)(6666004)(8676002)(6506007)(6512007)(52116002)(186003)(38350700002)(83380400001)(44832011)(6486002)(8936002)(7416002)(66476007)(38100700002)(2906002)(66556008)(86362001)(5660300002)(15650500001)(54906003)(36756003)(110136005)(4326008)(316002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hPySJtsRJqmbdkYkIWcuBWONSVpxZv/7v90mg61CBAUcsALhiMWzae6Yv2si2uRgDJv3WEVoJa485y2KD2gT4D1PwKY7Pa6+JgwpR+MHjCb6RKrhbf7TtMypcl9wxK/GQuKcSkOZml75wsitzezYsnFQEqz4PJAiWAVRkOPiNiHb0XOGU0YnuDh+bMVf3UZ9O9AJuGveVm7D7fU5WGv6RNBvvDA7rTuChzVagNAt8VZqQoJvC2PSUHgUEa/1+P90h9sQ7F8Owfoe5QmJOBM/AbP5JpJRFD1xaNrQ5oe1HbqOc5xfU1UJFR+bY9b0L52OqSMo1n9POFLBBDXpv2Qi5BedgOhgun6dcOCo6waAIrv08x9B1I0c1rTkNqfmrcd0Wn96QyBeQuimzdaV7bBTHxVbDK7Ea4OWvX2qiM2IlpLyi1kZpj9FO2Yphoxb29wqfR11by8K+VkT5a7n0Xc3+A+UCtjvsRW0y5vetRlXpBbX2x0ZZjwlSxH3OFpmmBUb95SHSYrJra1e7vsZXNAPw8cPdY+P8nDm1W6DH0VqsxbiSJDmggBZs17aqyDkWK1DE7eWCUWoawrJ2anABPBpD9p4F+tgRVHYDbBbmv8hLg/NKruT1whxADoorc+YZlNoSzQUDq7Dz6iABfw2yzpkec/WC+Uliogt9ogAUijEK7hT7RovAeGRE/6bUIVd7T/Km5J0LP7U8JgueV9VEse7TnDe4iky6PlR0aGEGlR0UBg9Pr5a+nkOMMrY5F6R9IECbKoCxIBcMUPvAWHXO8MFKRwOWPoa5Ko24Jlkne5GESBOQnzslNKKIfGtdjZv1CyTRiOF965TnwInHuOR2s+dwHgsBahKIAQt+P4gKTrjJPcRTibtvAVha+VLivpsqcKNcy72mVU3aO4NntsmqIbCjKJ3EzF415el1wrl3mPJCU+alFI4cqhCtlsf8emqo+0PRWPKBcRMTOqwMXesG4/7lyeffHDgc/cBqLq4dmJVRuWlJROn2OSyrghL5LPJPZHqVjN808cMuNuTsZUmB30Lm/bxf27X/cetJYO4rwbG92QrBiEoB5WQJRBslge38+JT2INY/ClenpsuCJlKxLoGan3oo36av948o0t+cIaGRX+Ngc15TYx+N/67MRGt66TYMtC99AaQnkyYV7kUtfMhd2u5N+Ke2PjEmdY/rhqDqmp5sBwKGBxYv98ZFv9iS50tru+L32jfDvWP3LQnQykYbFoQEEj83bmDLhgLIwdoHsl43tSlARkGjPMezmfk5W2GAgx4Fxg5LxVlIv0XVLl88U7xveAzxOurQr7QlmYbnYhEUrO2Jn2iZ0aEX0K9k8jJTpGO9a5ewSmyFAC3hEAfJy3gSpKKTu3cBj5DTxYN44BFR9OWc9b/7C7nxLQG2dBR5gDajj3nOai3Xf/aHz7PYHnw9dqQ5Gly95/iP9urFZ5J95MLS3S0MQesODrnFjPZSaNZ2TohAeVXiskSPh3uimXJciq9qhIBDBSLekaTRTIdgo0Gf7SCqoLfrxPhZzzXOmikJQXywJyggIk1ySIC39+b0PK6IsUfH0B/KhZilBfXpA8A8ipsnHglsK4CtBJfO6W/K9hp0/yEkAcMOttoYQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ad23b44-cccf-4850-d1ce-08da5953a4ee 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:15:01.1712 (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: aLj3zYBOO5wxfwTqWQE9+pMExXbdA060oYxIMcb3YKYMw+OhVekowaJZpzHPmZ01vRCVYak1LTYz+TSLekHxTA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB3013 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151515_366726_C68ED556 X-CRM114-Status: GOOD ( 13.84 ) 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 adds a function to update a CGR with new parameters. qman_cgr_create can almost be used for this (with flags=0), but it's not suitable because it also registers the callback function. The _safe variant was modeled off of qman_cgr_delete_safe. However, we handle multiple arguments and a return value. Signed-off-by: Sean Anderson --- Changes in v2: - New drivers/soc/fsl/qbman/qman.c | 47 ++++++++++++++++++++++++++++++++++++ include/soc/fsl/qman.h | 9 +++++++ 2 files changed, 56 insertions(+) diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index eb6600aab09b..68b825ea10f1 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c @@ -2568,6 +2568,53 @@ void qman_delete_cgr_safe(struct qman_cgr *cgr) } EXPORT_SYMBOL(qman_delete_cgr_safe); +static int qman_update_cgr(struct qman_cgr *cgr, struct qm_mcc_initcgr *opts) +{ + int ret; + unsigned long irqflags; + struct qman_portal *p = qman_cgr_get_affine_portal(cgr); + + if (!p) + return -EINVAL; + + spin_lock_irqsave(&p->cgr_lock, irqflags); + ret = qm_modify_cgr(cgr, 0, opts); + spin_unlock_irqrestore(&p->cgr_lock, irqflags); + put_affine_portal(); + return ret; +} + +struct update_cgr_params { + struct qman_cgr *cgr; + struct qm_mcc_initcgr *opts; + int ret; +}; + +static void qman_update_cgr_smp_call(void *p) +{ + struct update_cgr_params *params = p; + + params->ret = qman_update_cgr(params->cgr, params->opts); +} + +int qman_update_cgr_safe(struct qman_cgr *cgr, struct qm_mcc_initcgr *opts) +{ + struct update_cgr_params params = { + .cgr = cgr, + .opts = opts, + }; + + preempt_disable(); + if (qman_cgr_cpus[cgr->cgrid] != smp_processor_id()) + smp_call_function_single(qman_cgr_cpus[cgr->cgrid], + qman_update_cgr_smp_call, ¶ms, true); + else + params.ret = qman_update_cgr(cgr, opts); + preempt_enable(); + return params.ret; +} +EXPORT_SYMBOL(qman_update_cgr_safe); + /* Cleanup FQs */ static int _qm_mr_consume_and_match_verb(struct qm_portal *p, int v) diff --git a/include/soc/fsl/qman.h b/include/soc/fsl/qman.h index 59eeba31c192..0d3d6beb7fdb 100644 --- a/include/soc/fsl/qman.h +++ b/include/soc/fsl/qman.h @@ -1171,6 +1171,15 @@ int qman_delete_cgr(struct qman_cgr *cgr); */ void qman_delete_cgr_safe(struct qman_cgr *cgr); +/** + * qman_update_cgr_safe - Modifies a congestion group object from any CPU + * @cgr: the 'cgr' object to modify + * @opts: state of the CGR settings + * + * This will select the proper CPU and modify the CGR settings. + */ +int qman_update_cgr_safe(struct qman_cgr *cgr, struct qm_mcc_initcgr *opts); + /** * qman_query_cgr_congested - Queries CGR's congestion status * @cgr: the 'cgr' object to query From patchwork Tue Jun 28 22:13:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899104 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 CA3F3C433EF for ; Tue, 28 Jun 2022 22:47:58 +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=M2tFr69gHBbLhz0cNjH0y5zg4J0dJNd27ekV0YkEMKE=; b=qHiP4+HQC+xHpJ oHR70dHIQt+FtXbMOvTWnpJ4riCa5nTlflu6abS696sfSBoskN6NtB4HHCvUU54J7iwhGj7yNh45M gjknQf4ceGnWQBeGgq1y/x8fRCwZwlhzuMSpEyGbiW5n77jFy4l+JvpTShDxLgrppiVqtg9wz1WYX I84ewTxMCunZdEGk636E1S1DaTOoh2MFGb6dJGcgKvpSSry0s7H6PazjThQKMKj+k4gS0xpmoutOs hQm4VKEdug91HKwNX1fZJhOhABpjuHbaOr1Yu0m0IqbjCYaz3bNZfcsv4kCJ+u30o5KvoiBEx+GMW a+KIK6FZtmFGGR1sfq2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JyH-008V47-Ps; Tue, 28 Jun 2022 22:46:14 +0000 Received: from mail-eopbgr00086.outbound.protection.outlook.com ([40.107.0.86] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUM-008MrJ-Vs for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aSfULt0gC1lYgnDKp2OPyqTSJiGn2S7CUf+SYtVyRySKxpu74gAQVaRznBjTdbjhiZyR8ksSDlhv4+YC0TBhrEleVyvc0zbogVsGXNN4d3T3JOLRiOxPcFYK6rcikdDh37v9VS+qlYnQw6wlY5n221L605hZ2W16izImHOrmRR4B/ntZO8ZsL0RK4RaH1wQL1EV7t+4jSSU2YACu+NlBNoiQBeAOkWQyjQQ00kXv4Y1IczxELVRIZ/e/JP5o+mg/BXsGg8yaBb061GK5+eTsm4UbgM2QxF0ZSnVbWoyAW4tz5eDi9bZfFTv2mW009I/6JVlhusZD55GWyjSEe0YWuQ== 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=hi4abFH3xalBjEkOAWtjAQIxhr8njJD/p8JHplUsa4s=; b=LAtzw1qqZS0ugJ+Eb8H0X05r9E0N9CS6ZMgNCoUHzXd1OQnBTqR9fQ5GHuKunIqaaaKcGTCtKFYeFam5EIhQWXMMcmcT0GFRRtmzzRfaAvVz07ATXv3I/mDGO0b/gaLPZ7bkVJDHOZDxmtUcnIN10aJ0aucLK1JiWFRV/hD7PUX6AuVeb5LUa6/GbeAfODxrP6l2rILpGkIswS8IhpDUxQhivoUeuJeeR2n0pZdTIClm2DPQM0qbNd7Zhmk3Nt45oMzH4CQZremT992G5WjSJE5S5KeA2h31WckSeJ5jPaSqmsek+DJj8Xj5K/NhwNKX9cIZUwPu2X2aFz/WB2Bb6Q== 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=hi4abFH3xalBjEkOAWtjAQIxhr8njJD/p8JHplUsa4s=; b=GCrDBGTShrLnl6nCyyeWplAd3nYu0kVhqL7PMvR31XhR4OD73kgN4PpCBwj1Nc97LC0/7Ha2TRJAOPGxtP35HzYiZ+NGrGSXKiz6I04+PeRNw3WaYrynB4gy8Pm3CXhi+P/eYXD/JnxJF7vHvkV5SyR5Ly95xx99tEQVxnZEbMZXXYT5zawsu6WVcd4iFHlBZaADgRUbodRugkPS1MUrS4Sr95YjpJ5XYo5kEbTvovOu67xSmVoRYJMJRfsd+5mzFFOV36JQEQNvD5RU7V4VE0Gjqr/DdM27TuqODxiryuCOnuNip9K7satoERh6Hkth/Ihk3X1zB+8yXi72XhPGYw== 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 DB6PR03MB3013.eurprd03.prod.outlook.com (2603:10a6:6:3c::28) 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:15:02 +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:15:02 +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 , Li Yang , linuxppc-dev@lists.ozlabs.org Subject: [PATCH net-next v2 28/35] net: dpaa: Adjust queue depth on rate change Date: Tue, 28 Jun 2022 18:13:57 -0400 Message-Id: <20220628221404.1444200-29-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: 254896b5-d12f-4247-4b43-08da5953a5f0 X-MS-TrafficTypeDiagnostic: DB6PR03MB3013:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jmR+GalwYyhe5zqCRxwfcKGXWZ+gon6jJHM9MH12gmvyTmlgDSivZXH2zcTKt+EelFjSqJcWp05gJd5EL5iTUSedFzA9GzjRatpn03akpOfnQCIN3mhmugBO4pkUGhlBmxIXKxkGUCsUfLeooMCPEtjRMYM2BEIPeeg6ACDFUcXDkyOs85dobOgp77yRUZtesLntV2LN8KP/U9uogjDqcaEYzUVcL89bxekDUqYtfXVmDpJ1ovvjojknVV+f2KUZcUhwhzKYGFJWetZpwErT2aXbeA1jSphGcOfXHU3G20SPVnqeYczk+Yaz2l+Lu4K2iZkbuh1NdKa4X41Ksp2sUHz/KgKzMbHwdCs7o7HOkigdntGA/wLcR9iLTEBON9nn589kEEsEWiopI06oyNL63mMlJds5pLRVrWgC+wReB5FJN4sAteD0f1rVMAHdsnSW+YXxPPNZkjYa4IVyu1aWb8tCocnO6MT2iX5NAxmCTMaNnsOxmf7sJLWCbJuYh4hZ/hOy916JVifCN45BK6jYmAQTMtzND8Lf+CeQ4eoC+/Pb21xmVsq9AeeNyxW3iMdMDhjgZMtmV4z7zNYVYQAg5IHgXS+o8zf/gsil5JTIoyf10SoKucXZz8Q26MAdyOQ8RiytxRz2mPwvS6MmV3ULKzlT/kUsFWYjWa2pB8E1Yut5eJdUgiRnLtVyaTmtm2Aa71/Cfafp/WGpsDe/nBHyUs8uqGDJI8Xnn2nU5UOMa5aUEVtzHi4+hz4E3CZ7frhcxNse9a4A6oq63HoWzz9ZKPC1lHYUBYBHbSFsfDIzWNw= 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)(396003)(39850400004)(376002)(366004)(136003)(346002)(2616005)(41300700001)(26005)(1076003)(66946007)(6666004)(8676002)(6506007)(6512007)(52116002)(186003)(38350700002)(83380400001)(44832011)(6486002)(8936002)(7416002)(66476007)(38100700002)(2906002)(66556008)(86362001)(5660300002)(54906003)(36756003)(110136005)(4326008)(316002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XDjnG+eKS7snCRpmAwy+mFNQYV97WGbFKW5GppoS6dacd5L7RrfiquQcfH2VJtcjRUExvH54tULdVHq7nhUjYiPfwAAnttV0BcVoIKh1fCwCRQQN8BamGRqvFJMZ5KB0R59uaiDWPZLQYuFfaJq35nCUdc4kimMVIPdw0QARdCBe8q1qFa4Dy1KgGCNWCmQdE+ryDs93W0WUpQd0/bB5czVLNP/2EW10ZUByU/Rvcfh0GLAT9ZCeZXbHg0WI9ShMV9FdQFsqUFpCRDCMKtsOso0ZPeYFkTj3FmfpiUNCo7c2svhd2eHeKMqZD0tughm4Ut4T/GAd+k/KARoMd3GC25kD3pcsBaGdN2MP+L2dkGo1dknJWuvIFXezIsTN+J7JYn8KdV7JtqaA3xMxIu7NN8BwV7YpEttI6YEwkZrj4CqkjfWkMlMqvOWM8T24TN+eZeO32aUO3ANmpl5vrvVViMUXxM3q5wG1/4AwYGvIz+rnncwN4XOx4patjegU/hatlgBE3zSdRCwu7upKKQdrm4qSk6dVMBvJkKV8lCC1F9wnnvfvNuNR5R7Y58KXGktoBLPFpZwWJrCdp+xXDVmSjzWWZOnyOL1cmTsb9/A2j0UODFMNYgO4BrjctXFJPmKIPYH0MpTE9tVI4AZgJaDg7HW+4s/6e/M73drhpF5ip/3NF/37Kpa6f3agt48/yxzgO0+s6JXy9UhKMT2TGxRdasS3BTEt+mP/+7sEj7b7VY9ikyeRcX+hbKJYD2PqYTbz+klMtCkfsF5+byf5JpzZAE4GBMcxVvF/ni/R3dUfC9y/ssr0uOSw1LGiB4nbiEojCnz84/VadylSrtZOtPiMZXGTFtH6J1tXnV51si5EqY7V2kft47f2Xes9cIkmzwpFkXR4v2gT1F8/ppEtbjMvUdTa5V+A25hhyWMnPvSCjfVo6DNtwr5Rn8EGoK1IK+BXlZgswiVpqZpJ6ko9eX5Nfqrh+bplrFT7/QEYd4r3L29iE+vpyz7nOP8UHRGtlaY92YURP661AKgQG0Rp5knzuYd69YiZ62/zgjZ2lK2wqkhHp5hF0NaFwJM94531ICkHdyBKafuLQKf0dm4m1iwSXWI/jBp7T8oee0gtSMHVov8WynSXZlZ4Dm2ytviXpvurnixoKiHDcCbQ21SKtLamuuqbJvt+gDcB6Vx5iYMCNUqYVf8CBjy0bsVD5P8JGWKVz+PLiudkoWh6Yu0UcgqJllOQUwA+1bC4g0GWVi0XzSG+q0MR6NYTBWsgrQcJfuqQw746djjf9TRiz2umzAqVpZNZHkLK8IlzItgoKDEvloqTzl7TA5y8SMc+wh9CJxR99tuDrBOllFbIstv1Tl2UctKwwRxhDw1OijVyKyJ4RYDPB3tevj3aDRFRRS0ps0g60U6Hhz9hAzor4hpegebLHb51MIU4jTASVOzbtk37ru16hVAjrY+pPHQq25QI8q59hemySop3ReqCO3A8UQOwPt1BEYqw2b57XvKE0IjTgUw7Pq+6VD/ChxjiwM7AyEUoNAMkmy7C69DVmMYbXUR4EkhRj9PjY5OkM/5m7CFmOMgF7fLFFhXqh2VtjJqBIg3LT7Z8YRDyhpS3KhzEBElTJQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 254896b5-d12f-4247-4b43-08da5953a5f0 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:15:02.8430 (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: 9GXsOim+pjyqBEkNOSlJLx4ph4k18swP6V6qE3B75+Wy0ifZHH0Cz/SBOwdF0QbqMzXLnq2zqhUvpIhz4jVDKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB3013 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151519_116754_7A7E2988 X-CRM114-Status: GOOD ( 23.71 ) 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 Instead of setting the queue depth once during probe, adjust it on the fly whenever we configure the link. This is a bit unusal, since usually the DPAA driver calls into the FMAN driver, but here we do the opposite. We need to add a netdev to struct mac_device for this, but it will soon live in the phylink config. I haven't tested this extensively, but it doesn't seem to break anything. We could possibly optimize this a bit by keeping track of the last rate, but for now we just update every time. 10GEC probably doesn't need to call into this at all, but I've added it for consistency. Signed-off-by: Sean Anderson --- Changes in v2: - New .../net/ethernet/freescale/dpaa/dpaa_eth.c | 38 +++++++++++++++++-- .../net/ethernet/freescale/fman/fman_dtsec.c | 1 + .../net/ethernet/freescale/fman/fman_memac.c | 1 + .../net/ethernet/freescale/fman/fman_tgec.c | 7 +++- drivers/net/ethernet/freescale/fman/mac.h | 3 ++ 5 files changed, 44 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 2b1fce99c004..fd81ebc7be44 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -197,6 +197,8 @@ static int dpaa_rx_extra_headroom; #define dpaa_get_max_mtu() \ (dpaa_max_frm - (VLAN_ETH_HLEN + ETH_FCS_LEN)) +static void dpaa_eth_cgr_set_speed(struct mac_device *mac_dev, int speed); + static int dpaa_netdev_init(struct net_device *net_dev, const struct net_device_ops *dpaa_ops, u16 tx_timeout) @@ -262,6 +264,9 @@ static int dpaa_netdev_init(struct net_device *net_dev, net_dev->needed_headroom = priv->tx_headroom; net_dev->watchdog_timeo = msecs_to_jiffies(tx_timeout); + mac_dev->net_dev = net_dev; + mac_dev->update_speed = dpaa_eth_cgr_set_speed; + /* start without the RUNNING flag, phylib controls it later */ netif_carrier_off(net_dev); @@ -826,10 +831,10 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv) initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CSCN_EN | QM_CGR_WE_CS_THRES); initcgr.cgr.cscn_en = QM_CGR_EN; - /* Set different thresholds based on the MAC speed. - * This may turn suboptimal if the MAC is reconfigured at a speed - * lower than its max, e.g. if a dTSEC later negotiates a 100Mbps link. - * In such cases, we ought to reconfigure the threshold, too. + /* Set different thresholds based on the configured MAC speed. + * This may turn suboptimal if the MAC is reconfigured at another + * speed, so MACs must call dpaa_eth_cgr_set_speed in their adjust_link + * callback. */ if (priv->mac_dev->if_support & SUPPORTED_10000baseT_Full) cs_th = DPAA_CS_THRESHOLD_10G; @@ -858,6 +863,31 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv) return err; } +static void dpaa_eth_cgr_set_speed(struct mac_device *mac_dev, int speed) +{ + struct net_device *net_dev = mac_dev->net_dev; + struct dpaa_priv *priv = netdev_priv(net_dev); + struct qm_mcc_initcgr opts = { }; + u32 cs_th; + int err; + + opts.we_mask = cpu_to_be16(QM_CGR_WE_CS_THRES); + switch (speed) { + case SPEED_10000: + cs_th = DPAA_CS_THRESHOLD_10G; + break; + case SPEED_1000: + default: + cs_th = DPAA_CS_THRESHOLD_1G; + break; + } + qm_cgr_cs_thres_set64(&opts.cgr.cs_thres, cs_th, 1); + + err = qman_update_cgr_safe(&priv->cgr_data.cgr, &opts); + if (err) + netdev_err(net_dev, "could not update speed: %d\n", err); +} + static inline void dpaa_setup_ingress(const struct dpaa_priv *priv, struct dpaa_fq *fq, const struct qman_fq *template) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index f2dd07b714ea..6617932fd3fd 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -1244,6 +1244,7 @@ static void adjust_link_dtsec(struct mac_device *mac_dev) } dtsec_adjust_link(fman_mac, phy_dev->speed); + mac_dev->update_speed(mac_dev, phy_dev->speed); fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); if (err < 0) diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 8ad93a4c0c21..02b3a0a2d5d1 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -782,6 +782,7 @@ static void adjust_link_memac(struct mac_device *mac_dev) fman_mac = mac_dev->fman_mac; memac_adjust_link(fman_mac, phy_dev->speed); + mac_dev->update_speed(mac_dev, phy_dev->speed); fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index f4cdf0cf7c32..33f3b1cc2cfe 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -601,8 +601,11 @@ static int tgec_del_hash_mac_address(struct fman_mac *tgec, return 0; } -static void adjust_link_void(struct mac_device *mac_dev) +static void tgec_adjust_link(struct mac_device *mac_dev) { + struct phy_device *phy_dev = mac_dev->phy_dev; + + mac_dev->update_speed(mac_dev, phy_dev->speed); } static int tgec_set_exception(struct fman_mac *tgec, @@ -794,7 +797,7 @@ int tgec_initialization(struct mac_device *mac_dev, mac_dev->set_allmulti = tgec_set_allmulti; mac_dev->set_tstamp = tgec_set_tstamp; mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = adjust_link_void; + mac_dev->adjust_link = tgec_adjust_link; mac_dev->enable = tgec_enable; mac_dev->disable = tgec_disable; diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index a55efcb7998c..b95d384271bd 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -28,6 +28,7 @@ struct mac_device { struct phy_device *phy_dev; phy_interface_t phy_if; struct device_node *phy_node; + struct net_device *net_dev; bool autoneg_pause; bool rx_pause_req; @@ -56,6 +57,8 @@ struct mac_device { int (*remove_hash_mac_addr)(struct fman_mac *mac_dev, enet_addr_t *eth_addr); + void (*update_speed)(struct mac_device *mac_dev, int speed); + struct fman_mac *fman_mac; struct mac_priv_s *priv; }; From patchwork Tue Jun 28 22:13:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899105 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 65755C43334 for ; Tue, 28 Jun 2022 22:49:52 +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=xO/AC7j5c79jDI0ni08qU0HqZdIR//a+48/UyLePsY8=; b=J58khWuK2+eJHx TztBJ2nrDrMYcYxflTXcnWwEfPjw4D6cemMDd0bhmZgsrsHLs1Uu3bF060UNo5NIgQX6lEl4LzbWf um+jHmR6XODQshhQmX/vSN3/s9qN/tC31kvQ9bN7yVkTIRtYuUHhmM3CR3c6O24aYfmk5YpUTw12V ufo1Vc7XwYRLMApeX8eEVwBGeu5ntZXzzvAzXH+qanvWN9QJrn18HxA3tmt2YIZ7KaGy7LpzdqYNM 7QcRY8zYWlj5I26PzQBU6MpcGU9CmkDXYHmgPVADfspOIe+uY2mjzRih3fx8U/qPkq4ube5uP4hUR rlElvwTvB75ywAONpMkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6K05-008Vau-L6; Tue, 28 Jun 2022 22:48:10 +0000 Received: from mail-am5eur02on0608.outbound.protection.outlook.com ([2a01:111:f400:fe07::608] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUP-008Mk7-BM for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TWVCQVUTpQophqPI3M3SZRHVE41HaHdSHqclP6M6yiZDKXzof1/eR+qLCvLtcZaonWewzKin1/qiF/w41WDC4+moIGUshyVDbRxK8IjMjRt3Gcih3xnZ0qgYQPVUGdrmcMmp1+aDyasWrS6o1X2ZSVPVpiI3jkjk8FauPY1NMsjmJ4PKqhvNmqW/CIhguRCGj3o55vkBnA8MNfy23++YTU5OyFFNEGVTA19baS9tVASdqnnMk1ZoyDzyFSLmiHxOuMVJt2SBTpFTsH/4VYBmql+LcROvylUxp1VG8HiChxWZFYhV2eCe4k9UeNCXMH9glxptXhQU2jmcbsZX42zJHw== 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=UBsoKb0IynL/exrsZCB8tm9m5z0+NmXhH9JcWpEJldM=; b=fkDyi9NzIL9V7/DainpbjxB2DkWAWZjaKIIWlregRh4dc8EjuTCfMdKbnnRTf6D4xMHbbtU5wOBf5EdFLeRdZ1r/pKijDJQa0hbqnT4dPKV1IvA2og0vz0G7tEU0g4V6n0kwIyOSE7acgFwjA4OSdf/AUUJ00qfiXIG0N/yUaDaQ1G9FMMDWl7ULu/U/Ph6BHGmqaP3KfEXr0iBdBOqCZRlV3JHsEv6xGCAFWT4XVQlvCIFlb8kYw6pB2bMM7o+cCYcPF2SP4PoTtwA6lc7ZHuBU6IaMkpVb5CmYY/oDJUgQ2Gxc/QLHKu5yZaTpH3mbnpqNMN5i+jxsN8puL3q8Jg== 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=UBsoKb0IynL/exrsZCB8tm9m5z0+NmXhH9JcWpEJldM=; b=DT+2sS+lDm/1XHjaH0szXIbqy8A34G+m6aXhp0OfCjO58YWiJ3NBvQoC0j6/gFhI+ingYFzMBRjn7w7DfgWyfvuFf/kGbd6zTJvOI4ICMEtfX96GNzB/+CUfk+cbF2BlBMbh1lToMa1Ju7dyiUK3tUf2t+XcsOLtgJ05VHrn4iR43yp3O533v5GdVvjaLhbMABXKKt3Z/nuyu2nw+2twUOXz5Ca03gaKySCWzRABjkDLCLdjXt6Ypx03IJOupxInxbs4NqTIfIPUL87yU1cywSyMwIGGcEWGtQziU0utyZnCLExMQS9phLFmmtUNyPlZNyZ0FIST9KeAvdLUiAHRqA== 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 DB6PR03MB3013.eurprd03.prod.outlook.com (2603:10a6:6:3c::28) 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:15:04 +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:15:04 +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 29/35] net: fman: memac: Add serdes support Date: Tue, 28 Jun 2022 18:13:58 -0400 Message-Id: <20220628221404.1444200-30-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: 1d293c41-9e97-48cf-78e8-08da5953a6c4 X-MS-TrafficTypeDiagnostic: DB6PR03MB3013:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wPBzgbUnmAgRsxNUulW8M+x4ZiCW/ZmmqdBgx1tF3IqM1ARzTTUJUInedb/3FIKTR1M9uGvVxuGb2ujY4NV+Wueft3mTGvbCMOLGisLPdUQ0HPYCgSlnnWkH/O/0WYLKL0NYR9W0g8MAk4Ovxa5YNQ3R4D3YkzO3fGxoeMAog3yyWLysB2XM6ma0NcB2gtNwTB4OPgfQPpqOBqeJ7HNTQGLGMgfGCxL6j4Lek54MgXs/nH97sFv2gg5ruP8kP93rskcEsqQ8B1/L2gbgqz6JJQ/n5uLPp1e/kI1OcRh0Xgb4F99dc1G+ZXbgyl4pVvAiI/9SOAbFID/2RisnhJBHI2L/egVkEcEyTim1qVeMyOTM8nZmM15k+ClQZWqFvxMLXHi3d70zMF/pn5pMK5gDAb/XfSWxA1RCMXVKOFskHyfJ0u7EY78nV6osRHW9LGQGRfI3kZl3BRUjKQOSX9foTm1Ra1t13TZ5YNGYTfHAs+YeP+jK31gpba/Rf03dGJ7l5nmKaNILM1//++YcBmvlhQZO2hV7yHAiZPX4fk03kkuDxQidWK5HqbvBiewzqIGI99DdPAv9SpV+GMPP0pzKWWpuuwltdJ9dJr9ZondrBN+HfdcaKWshQ5tULkMJ/C/pu+ysIQ0OE87hOQqUcp9tWCAbxLyCepEcxkrhZ+n8Sifai4CNUoAbAT/7bCpxSAbTGZFl2SyJJop5H3KZ7U0P12tl/aiQYwnLjh5mQgAQDzI6sy9I8+4muaAhCI8pWRJS69Jx5/0rCEm6/fs0kqMBENYpux3mF47//mkM1TBtqf8= 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)(396003)(39850400004)(376002)(366004)(136003)(346002)(2616005)(41300700001)(26005)(107886003)(1076003)(66946007)(6666004)(8676002)(6506007)(6512007)(52116002)(186003)(38350700002)(83380400001)(44832011)(6486002)(8936002)(66476007)(38100700002)(2906002)(66556008)(86362001)(5660300002)(54906003)(36756003)(110136005)(4326008)(316002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qTvr+DLqDdGvAV+o1aSzj4d1g7hkVVtOIv4zMJU8u63BmWy0kDRoe4YqVAJEwxO9jocb7BZK972gtlr/WlJin1j1b45qMbIoDktUMAIzBAHaO9hxPf7PhWC0JdXUVwU4Q4Si37j1TZKQmN4m9qCGpwWu3jX5J/D6NY0/KFu8P4i0isHXZFwOVbPEud7q2n1RL+u2uVjC0NhPAVWyBpZsJCxteWBgGO/TdiLOylCPTtlwKV9xCSoRrfUWgVeKi1RupB9kJiwl+ccB7jxFThj0ibgtqfstilDTLDQkZIhQ1TnD6sDEK/akjobzeBO+lgkZO1EJ7lBdr5HFAn9NPkEQ52GneSKIjoEUKtgZz8NrdYD2RIbsMG9Yd1mwK1vbH9XUKHgGozMwVsx53DB/vxMM/SRIkPvEinqnyzaoIu1r5GBDuCZoc9612rl9sfjmYATxnQL+85Vo3IZbxNl0DhYr6JxyMAc/xiAyhh3QxKVmjCHTYdL/pHeqRln9+k9WQPMgKfsV5nksaho1Nw7049ye/EMLEhSfDtZc5A2+bMbjW+hHky5YZJ8NNtX+KOWo/+mFAXYT3o+eHfMD8qfv1/gue83FM5Rye6tazfEg5db7DE2tSVVcjUpPapMaQYLKziBN44FvbTly4a8WDXvWTOCUb22ZCalr3ww5JunwnTGIMlqqKEfbIQYYuR3RNtCYDms1BLBmOKC8hpXwDDxFDnYwH1b6azQDa4R7vaINeQmXdT3sHaM0OA0SesPEZjqGzKVyZMxxVzFUkbSb7rjeGqeHi+jyhLtr6CsXiB1tS3VtGEwodYHkFsS/dv0wJJV+pHIotIGhgKzSzKVUZpAejGiWWD0MkJm9Qlh80Urs/NCVaUAC5vgtMWyhwx/KkFzP7r2BFEr2t2PUQQ6JVPelQ/0jjcIcOAGtO7uhdvCFpDNuKYcyOXAkxE7+0gIqPiPj5oPc/8U6iqCW5y1365pMKSm1jRZFfPR7w/IJ7sjoMFF93kC7lfuz1Vha5sd3Scbe/LPQml91S9cVmtjwJyyklU8r90QiWFtyyZNyRFBoii3PzWkqq/+VFwtyAQNBGGYuf+9f+i+zxmTwfExUkXqvPXdqUExBx2dtiLNoCwF4olF0ATh7evqBJAoYp4UaYtW/e+qwF+RoZfj11djIesAD5uactnPK1+uJSn6461qHZz5ZF6OROUWKqFo9NC+5P3V6zWNwCSgB5l5j0FyXD6641O3jaOizlB+zzdrCYrRE2B6E/gTEUL+GFlSC7TcfTTybadi8pTYNWcr/MvABurpYrKQptJRciByXJ2V069kmp4APYOODcHbsmiyRW8xHsVUYjG3RXPYSbZPPn56l2B8NnSJsO+h3v8PHoZGPIp0DlsrQcNUPEGzpj+2KOE38aWRlG9Dm8XK0afmZln32nAdqSp3UBGoB/FLGkABRw+w6o1EEUYnwVGE5yYwzl/4XoImlSmnlhdhemyAaC9AytGXKiHCrNXxyObFfUNoPptrknU1Chane3rNSey1M57lHzSYXznSEFzEymGLsORQQ1y0gE6MSUXexT55b4kxX0XS8h2kh6N+7lR4hI+KAkk8jApRiriS1MPrkRSBr5/4dIdmhsuvsqg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d293c41-9e97-48cf-78e8-08da5953a6c4 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:15:04.2335 (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: XEg93hbFAdIHkoFzpFtzbAYW8oKkmDCXMaLa+VPc326qWWtYca7BQZI6dYL1StMHg9DFeG22y6Qymv0K2ifcMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB3013 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151521_473097_1440655C X-CRM114-Status: GOOD ( 16.52 ) 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 adds support for using a serdes which has to be configured. This is primarly in preparation for the next commit, which will then change the serdes mode dynamically. Signed-off-by: Sean Anderson --- (no changes since v1) .../net/ethernet/freescale/fman/fman_memac.c | 48 ++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 02b3a0a2d5d1..a62fe860b1d0 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -13,6 +13,7 @@ #include #include #include +#include #include /* PCS registers */ @@ -324,6 +325,7 @@ struct fman_mac { void *fm; struct fman_rev_info fm_rev_info; bool basex_if; + struct phy *serdes; struct phy_device *pcsphy; bool allmulti_enabled; }; @@ -1203,17 +1205,55 @@ int memac_initialization(struct mac_device *mac_dev, } } + memac->serdes = devm_of_phy_get(mac_dev->dev, mac_node, "serdes"); + if (PTR_ERR(memac->serdes) == -ENODEV) { + memac->serdes = NULL; + } else if (IS_ERR(memac->serdes)) { + err = PTR_ERR(memac->serdes); + dev_err_probe(mac_dev->dev, err, "could not get serdes\n"); + goto _return_fm_mac_free; + } else { + err = phy_init(memac->serdes); + if (err) { + dev_err_probe(mac_dev->dev, err, + "could not initialize serdes\n"); + goto _return_fm_mac_free; + } + + err = phy_power_on(memac->serdes); + if (err) { + dev_err_probe(mac_dev->dev, err, + "could not power on serdes\n"); + goto _return_phy_exit; + } + + if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || + memac->phy_if == PHY_INTERFACE_MODE_1000BASEX || + memac->phy_if == PHY_INTERFACE_MODE_2500BASEX || + memac->phy_if == PHY_INTERFACE_MODE_QSGMII || + memac->phy_if == PHY_INTERFACE_MODE_XGMII) { + err = phy_set_mode_ext(memac->serdes, PHY_MODE_ETHERNET, + memac->phy_if); + if (err) { + dev_err_probe(mac_dev->dev, err, + "could not set serdes mode to %s\n", + phy_modes(memac->phy_if)); + goto _return_phy_power_off; + } + } + } + if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { struct phy_device *phy; err = of_phy_register_fixed_link(mac_node); if (err) - goto _return_fm_mac_free; + goto _return_phy_power_off; fixed_link = kzalloc(sizeof(*fixed_link), GFP_KERNEL); if (!fixed_link) { err = -ENOMEM; - goto _return_fm_mac_free; + goto _return_phy_power_off; } mac_dev->phy_node = of_node_get(mac_node); @@ -1242,6 +1282,10 @@ int memac_initialization(struct mac_device *mac_dev, goto _return; +_return_phy_power_off: + phy_power_off(memac->serdes); +_return_phy_exit: + phy_exit(memac->serdes); _return_fixed_link_free: kfree(fixed_link); _return_fm_mac_free: From patchwork Tue Jun 28 22:13:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899106 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 1297BC433EF for ; Tue, 28 Jun 2022 22:51:28 +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=JABHtMSxh0jLvohIQsOBH4HdsSPYF714oyXzXnF0Rr0=; b=vI5f60sPrJ3L8e to8q80lPbCbPRTJZpYbvPJS4/j316QkjuSeYSPmwiqOJ7mvglHASibSD1vvogfzjpYkqUUMCKrJss eqquWV2I5e/TnSVwIrMzw78onXRwjiXwP5oe59dzjjQtdCj4ln7AiIGtmYXOuNiqkOi6XfbjanhjO B5fVu3sYZlMl5jcGXa0T9GP8qVwSknpmQo2EL7WKw+AtbXAfgqViXvRXeuS4/uAv4H+22OfArJygZ YvmC9AQDW/UIfEA95gQMy7wBmF8yEuFAzWmV/M3G/xU6Rb5dDUpytLUeAlorzytvmaPDpWc+mjUYP N7Rbc25bIwImh6L+MVuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6K1j-008WEG-FI; Tue, 28 Jun 2022 22:49:48 +0000 Received: from mail-eopbgr00066.outbound.protection.outlook.com ([40.107.0.66] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUh-008N2H-Rh for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V/chMcilN7yUqSLlro7n9h0fkonh/Sy3qFBROox/rOOKBn0VkPD8waMhb7tje5pmCgal13exwrQvlJMShRYZ0OVbAQzKlV9aulkbFFKGzfL8998a/aUvlGpFyyYNHSSrAv6HfQamDg0t9VZzdbGQEtNu9PuWvtIQC/zxmriwDZzBs5h/DsELhkHfN6k6jVOcbwbwsmVZu/aatAaiMI7S2gnkNhvgkms8ohtvPz6TfjxeZn+BufxpOTahGEb9tZoW7+wlaSFnO+WjG2Tpuu8068GqOH6BFAeXayIPL/BSWNgQXXAa+ljMwOknHJ7WM72o3CRUfqQLMz+voymkjRkiQA== 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=pIVXiwaPqN2qpxsdgsEHfCgueG0jFYH93TSiEtZ/GMQ=; b=DkHs/gkxypl6JgpYgsqTCeZ7udaKJs2bkUkZBW/aREj2T2y14VCetQaYotQxzsXh6U6mhBaUVvbKaDqRYcnafG8o1kp+1lSQrM2BU8q/m+ozrWekoLSIHW4/+BG7B3XCAGiFkq62JAL1RsGG9hFTqed5s6eI2XVzqICp4nA+wEzWV8a+4KXFa7wn2Pd/L7G+I/3VtnKraUqJAEBcmIsGg0P+8O8MrMoQXFLTSj6jBfJhhKDpIHLvjpwoR5oV+uIMQvIhavUXNuLHa6g6jzoie/jZHMs1XaE7Ibvsn+hNbOM5rghjNTPvMAQtoUwS4DBeF7Ev9NfgaR4ylIlnAnn76g== 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=pIVXiwaPqN2qpxsdgsEHfCgueG0jFYH93TSiEtZ/GMQ=; b=dMwgTGam1w/0qwVcPWTO1cfCgKErLbvHojn7FdoZGWUHPCowbxdiZerVF/B4QpCfSiRib4f1DsLYzKvmqi2J2NkFyBrkkX5xuOqo8HYPV0PCDfyUcyFBHOv7II1dQQnVtRpYPqUcOyef0GYPraBWFIFM0DqNZvurROtyZ9J16y7+Cxdx2v/EUo+kVQfMw1uQ6hpx7j8jQYNoyH72lstfXaOfvPBswPKuR1WtPeqUJHmR72f1dzzcMafALgIYXH4lBEGzyWVw3KNhwRZtvEXWOXEUEm7WFu48uq+zm9Lny3XttajVRGW1vTblCz/VUy7XeZ0cgvSEG98ZKmnxCm4uSA== 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 DB6PR03MB3013.eurprd03.prod.outlook.com (2603:10a6:6:3c::28) 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:15:35 +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:15:35 +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 30/35] net: fman: memac: Use lynx pcs driver Date: Tue, 28 Jun 2022 18:13:59 -0400 Message-Id: <20220628221404.1444200-31-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: 66db4b53-96b6-4b79-a68f-08da5953a798 X-MS-TrafficTypeDiagnostic: DB6PR03MB3013:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8AUgVzqJqlDU1RZgBin5qJSbtoumLZONr7WuzMqkU+iK+CoYbGG5howKOmLfsWhWIKc9ZAnkBCCw0/tuyeS/CdxMA25brYwsI9KRR1Yt1ZySHET7xY8p2Z5lRRhSqSLxU9Opk0gH5WHbbua3Fy6QDM3VQL+Ajs+og6U8B4yPe/i5SVqhTIF/tIgcTyfw+H8FspGSkx6kMoCNFGsd7IsteGZOvmNgl8I0EDkwCGeux7SKkdyMGd4OQNawFW9lBZc+qQpVnVUVbetZQ80hXUshx8wiGj8vnEvliGljgLWfj2fjwsn8pU4gmIRjCFu1nDWk0svlplLKNc5fEwWeWLXoWhjo5z4ealRyWW9Rv4b12O1Uw4sdEId14HcRidGUfrBWFKxoJQfosp3mTYPnXUvOZH9mIdLabjKpgxZT+7rVH70CCAQ8eD7QhczmDR14/edvWhuCRxc4Qc/DNTiDw+51pwj94DmZbRoSc/E0xZ+wayoBqmFXQ6h4ke77581LNc/1pcQEuJ1xQfySjge6BYcMaLVcWFcWZAiXRkma9ckLjdeDy4XU/BQYMXEVBqLn17O75U2TI3XR5F/Gn34aQKZSzz6gm94v1dtNjsy2SgMOzoIxiIvPl+6nfMce3411t4Ao+jx9K7EbvQsuh4UNroBt2KMoeptWUDp7xRhMiNe4yMkpMr2aG43UJWRpC0KDpVZpnyw6BUlrrymBKQXmkcAD9glT0vwPfk50oR9ME6t9Oh1E62J9S021RuceA5ee7yDqDrlUddFcQg9GBNxXjzQI1eFbV3FBbXj/3PdnWritvJA= 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)(396003)(39850400004)(376002)(366004)(136003)(346002)(2616005)(41300700001)(26005)(107886003)(1076003)(66946007)(6666004)(8676002)(6506007)(6512007)(52116002)(186003)(38350700002)(83380400001)(44832011)(30864003)(6486002)(8936002)(66476007)(38100700002)(2906002)(66556008)(86362001)(5660300002)(54906003)(36756003)(110136005)(4326008)(316002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GJoA7hgnJn9hWaRbFWXKr1C5rLSWO1cwBSIOadqOOr3qxWAuOIQ1jLt8MwqX1UTM0r58RsP/rTVR2jDL/SwI4MV+KEYo1eCY2Iodc6oAlRs4yWAgZeiqmGhJJctump2SN62BousI9fU52kf2TuVPI8EPrS7OWptXpdUUrHtAwiqJ1wFnEP4CkWr8sRg9Z/InLjUFxUcZgjyjvIpySewuXnY4Wi+MqyRgl6ooVkd+CJhucab1Ooq0GTQVI6CYgAkrlvDcQh/isBQHSrQuj+WJxggzBClZDCZejoU1yD5X5tFyP2Y2EYoRKt5TCaMTJVx+qKVALUMdi0MMvHgRuc80+qOzw8LuG17L8jxBdR09U+dW01Swbq7DAKTjKdvjukpV0N01bL6LGNBO6iNrlBDaQw/oK8bTlj6Z23gSmEfeFxb7bawiV7n9JkX9whJqX8HONDOLRTvJFV3kD5OMTNDyxCXD4e/UgX/YLgzMeACGnajZ+TOBVKiJ3rUku1TwSXvulemJziwGeyHVw/UmaaY3K5pRMb5Jwl/6nAxACegC0aCJWGQBIH5xYcYZ9RFQtIZyLB6CyGNx6E7n+ZG0b84xU3IfaVFHaFR98eD9QGgLmmHe0kXSmeYS4BUXa7k0rM8A3qx/jZe/RJ/O6yloZKQHD5//XmHkG3XQGtnHgyN9RXM2g0n4VCTAbXeLy9vJodSL1hjU9s2txr6qRtFSZw+p/iMItFTA+Qzv96EOj4buyWaF0e7pwiDDMpBK4SyjCIz9E3ArA+v+tZWRNlsS5M6IwumQ/ocSswjP9BxVwKsVzHj2lptQ5B4i/8LPiHsD9eiH7Iki6wH4QWF1FGPTCyid7kpBsZdQFoVlm5if56EeOzppwcT8MYR/ys7epqvMaR4bePfrptakBmuGUiGRG/IqcE7cJh/UBAzpDTeqcKNCeEKmKDiAVdPLbeqlKUH8LXJbyeyDfOiqs0BSiX6Gm8nGNg78ZeWXQ1kOQ6wCr1W4dE0P5oL5XRutbw6Og4JynUPXI9tL1NclRLpfjwP2pM4TyumbcCxf1grE7yi16bqZOjqboptU2DZ5j3ZkD31yepuSzNNYSMuFMDrsz+HEQCCfyp/YaLi8yT4BA2knfE1p3VGdQeRGD22vuq9GtNOh1R8WImvbDEqYhly6hZePgI4eZdjkezomCRpaQDfoAh0BXHhk4tOCpzHytNWYd5oiSprwb2O5VIlaJSB0gAGtpizudE+rZMGhC4Z/40ABjdSV7O1P2q1GhDJqrhhCXNJG+ceARhdhdKdvFlB7ik2znjS0e3hXAteYNTMYNUeweZPwIYft6dN3WYcf0A7WsYlW61wLP9r0AKEmcMtkH+X40F8+bLiDYND1UQ7xX0Sfm4rODBs+0pC2/fePFPKyXLsgfCRumwczVRVf6MKBqOs7QIQil7w9e18Ty5r7BOQsJnR2Z2/YFMdFlkNtr6c65yc+jr0CJcXESIzshCgzaJaGvjgSRqDzOi5RFGrFmOvHbT1AdTDrItTFSrmEZRsmnzvFxqlN2SspJbM56c/DNEmnPrI87If4T8u6UYFH7XJ8olr3Bikd0TVy/a/PE4Qi+yZD/qPLWOqvuMHCqCViZO1Zgo/hyA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66db4b53-96b6-4b79-a68f-08da5953a798 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:15:05.6553 (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: pKV8x4pa08f7Dj4tWWeZ2tnvnr/0DSObfqgutwDoHPBkiPXRUE7yNOF6kSq6/dFMTZKFbLG8QM7Tb5YIpXFBdg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB3013 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151540_177116_08A3DD48 X-CRM114-Status: GOOD ( 22.98 ) 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 Although not stated in the datasheet, as far as I can tell PCS for mEMACs is a "Lynx." By reusing the existing driver, we can remove the PCS management code from the memac driver. This requires calling some PCS functions manually which phylink would usually do for us, but we will let it do that soon. One problem is that we don't actually have a PCS for QSGMII. We pretend that each mEMAC's MDIO bus has four QSGMII PCSs, but this is not the case. Only the "base" mEMAC's MDIO bus has the four QSGMII PCSs. This is not an issue yet, because we never get the PCS state. However, it will be once the conversion to phylink is complete, since the links will appear to never come up. To get around this, we allow specifying multiple PCSs in pcsphy. This breaks backwards compatibility with old device trees, but only for QSGMII. IMO this is the only reasonable way to figure out what the actual QSGMII PCS is. Additionally, we now also support a separate XFI PCS. This can allow the SerDes driver to set different addresses for the SGMII and XFI PCSs so they can be accessed at the same time. Signed-off-by: Sean Anderson --- Changes in v2: - Move PCS_LYNX dependency to fman Kconfig drivers/net/ethernet/freescale/fman/Kconfig | 2 + .../net/ethernet/freescale/fman/fman_memac.c | 246 +++++++----------- 2 files changed, 92 insertions(+), 156 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index 48bf8088795d..f5ef42bd2011 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -4,6 +4,8 @@ config FSL_FMAN depends on FSL_SOC || ARCH_LAYERSCAPE || COMPILE_TEST select GENERIC_ALLOCATOR select PHYLIB + select PHYLINK + select PCS_LYNX select CRC32 default n help diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index a62fe860b1d0..2b274d50fafb 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -11,43 +11,12 @@ #include #include +#include #include #include #include #include -/* PCS registers */ -#define MDIO_SGMII_CR 0x00 -#define MDIO_SGMII_DEV_ABIL_SGMII 0x04 -#define MDIO_SGMII_LINK_TMR_L 0x12 -#define MDIO_SGMII_LINK_TMR_H 0x13 -#define MDIO_SGMII_IF_MODE 0x14 - -/* SGMII Control defines */ -#define SGMII_CR_AN_EN 0x1000 -#define SGMII_CR_RESTART_AN 0x0200 -#define SGMII_CR_FD 0x0100 -#define SGMII_CR_SPEED_SEL1_1G 0x0040 -#define SGMII_CR_DEF_VAL (SGMII_CR_AN_EN | SGMII_CR_FD | \ - SGMII_CR_SPEED_SEL1_1G) - -/* SGMII Device Ability for SGMII defines */ -#define MDIO_SGMII_DEV_ABIL_SGMII_MODE 0x4001 -#define MDIO_SGMII_DEV_ABIL_BASEX_MODE 0x01A0 - -/* Link timer define */ -#define LINK_TMR_L 0xa120 -#define LINK_TMR_H 0x0007 -#define LINK_TMR_L_BASEX 0xaf08 -#define LINK_TMR_H_BASEX 0x002f - -/* SGMII IF Mode defines */ -#define IF_MODE_USE_SGMII_AN 0x0002 -#define IF_MODE_SGMII_EN 0x0001 -#define IF_MODE_SGMII_SPEED_100M 0x0004 -#define IF_MODE_SGMII_SPEED_1G 0x0008 -#define IF_MODE_SGMII_DUPLEX_HALF 0x0010 - /* Num of additional exact match MAC adr regs */ #define MEMAC_NUM_OF_PADDRS 7 @@ -326,7 +295,9 @@ struct fman_mac { struct fman_rev_info fm_rev_info; bool basex_if; struct phy *serdes; - struct phy_device *pcsphy; + struct phylink_pcs *sgmii_pcs; + struct phylink_pcs *qsgmii_pcs; + struct phylink_pcs *xfi_pcs; bool allmulti_enabled; }; @@ -487,91 +458,22 @@ static u32 get_mac_addr_hash_code(u64 eth_addr) return xor_val; } -static void setup_sgmii_internal_phy(struct fman_mac *memac, - struct fixed_phy_status *fixed_link) +static void setup_sgmii_internal(struct fman_mac *memac, + struct phylink_pcs *pcs, + struct fixed_phy_status *fixed_link) { - u16 tmp_reg16; - - if (WARN_ON(!memac->pcsphy)) - return; - - /* SGMII mode */ - tmp_reg16 = IF_MODE_SGMII_EN; - if (!fixed_link) - /* AN enable */ - tmp_reg16 |= IF_MODE_USE_SGMII_AN; - else { - switch (fixed_link->speed) { - case 10: - /* For 10M: IF_MODE[SPEED_10M] = 0 */ - break; - case 100: - tmp_reg16 |= IF_MODE_SGMII_SPEED_100M; - break; - case 1000: - default: - tmp_reg16 |= IF_MODE_SGMII_SPEED_1G; - break; - } - if (!fixed_link->duplex) - tmp_reg16 |= IF_MODE_SGMII_DUPLEX_HALF; - } - phy_write(memac->pcsphy, MDIO_SGMII_IF_MODE, tmp_reg16); - - /* Device ability according to SGMII specification */ - tmp_reg16 = MDIO_SGMII_DEV_ABIL_SGMII_MODE; - phy_write(memac->pcsphy, MDIO_SGMII_DEV_ABIL_SGMII, tmp_reg16); - - /* Adjust link timer for SGMII - - * According to Cisco SGMII specification the timer should be 1.6 ms. - * The link_timer register is configured in units of the clock. - * - When running as 1G SGMII, Serdes clock is 125 MHz, so - * unit = 1 / (125*10^6 Hz) = 8 ns. - * 1.6 ms in units of 8 ns = 1.6ms / 8ns = 2*10^5 = 0x30d40 - * - When running as 2.5G SGMII, Serdes clock is 312.5 MHz, so - * unit = 1 / (312.5*10^6 Hz) = 3.2 ns. - * 1.6 ms in units of 3.2 ns = 1.6ms / 3.2ns = 5*10^5 = 0x7a120. - * Since link_timer value of 1G SGMII will be too short for 2.5 SGMII, - * we always set up here a value of 2.5 SGMII. - */ - phy_write(memac->pcsphy, MDIO_SGMII_LINK_TMR_H, LINK_TMR_H); - phy_write(memac->pcsphy, MDIO_SGMII_LINK_TMR_L, LINK_TMR_L); - - if (!fixed_link) - /* Restart AN */ - tmp_reg16 = SGMII_CR_DEF_VAL | SGMII_CR_RESTART_AN; + __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising); + phy_interface_t iface = memac->basex_if ? PHY_INTERFACE_MODE_1000BASEX : + PHY_INTERFACE_MODE_SGMII; + unsigned int mode = fixed_link ? MLO_AN_FIXED : MLO_AN_INBAND; + + linkmode_set_pause(advertising, true, true); + pcs->ops->pcs_config(pcs, mode, iface, advertising, true); + if (fixed_link) + pcs->ops->pcs_link_up(pcs, mode, iface, fixed_link->speed, + fixed_link->duplex); else - /* AN disabled */ - tmp_reg16 = SGMII_CR_DEF_VAL & ~SGMII_CR_AN_EN; - phy_write(memac->pcsphy, 0x0, tmp_reg16); -} - -static void setup_sgmii_internal_phy_base_x(struct fman_mac *memac) -{ - u16 tmp_reg16; - - /* AN Device capability */ - tmp_reg16 = MDIO_SGMII_DEV_ABIL_BASEX_MODE; - phy_write(memac->pcsphy, MDIO_SGMII_DEV_ABIL_SGMII, tmp_reg16); - - /* Adjust link timer for SGMII - - * For Serdes 1000BaseX auto-negotiation the timer should be 10 ms. - * The link_timer register is configured in units of the clock. - * - When running as 1G SGMII, Serdes clock is 125 MHz, so - * unit = 1 / (125*10^6 Hz) = 8 ns. - * 10 ms in units of 8 ns = 10ms / 8ns = 1250000 = 0x1312d0 - * - When running as 2.5G SGMII, Serdes clock is 312.5 MHz, so - * unit = 1 / (312.5*10^6 Hz) = 3.2 ns. - * 10 ms in units of 3.2 ns = 10ms / 3.2ns = 3125000 = 0x2faf08. - * Since link_timer value of 1G SGMII will be too short for 2.5 SGMII, - * we always set up here a value of 2.5 SGMII. - */ - phy_write(memac->pcsphy, MDIO_SGMII_LINK_TMR_H, LINK_TMR_H_BASEX); - phy_write(memac->pcsphy, MDIO_SGMII_LINK_TMR_L, LINK_TMR_L_BASEX); - - /* Restart AN */ - tmp_reg16 = SGMII_CR_DEF_VAL | SGMII_CR_RESTART_AN; - phy_write(memac->pcsphy, 0x0, tmp_reg16); + pcs->ops->pcs_an_restart(pcs); } static int check_init_parameters(struct fman_mac *memac) @@ -983,7 +885,6 @@ static int memac_set_exception(struct fman_mac *memac, static int memac_init(struct fman_mac *memac) { struct memac_cfg *memac_drv_param; - u8 i; enet_addr_t eth_addr; bool slow_10g_if = false; struct fixed_phy_status *fixed_link; @@ -1036,32 +937,10 @@ static int memac_init(struct fman_mac *memac) iowrite32be(reg32, &memac->regs->command_config); } - if (memac->phy_if == PHY_INTERFACE_MODE_SGMII) { - /* Configure internal SGMII PHY */ - if (memac->basex_if) - setup_sgmii_internal_phy_base_x(memac); - else - setup_sgmii_internal_phy(memac, fixed_link); - } else if (memac->phy_if == PHY_INTERFACE_MODE_QSGMII) { - /* Configure 4 internal SGMII PHYs */ - for (i = 0; i < 4; i++) { - u8 qsmgii_phy_addr, phy_addr; - /* QSGMII PHY address occupies 3 upper bits of 5-bit - * phy_address; the lower 2 bits are used to extend - * register address space and access each one of 4 - * ports inside QSGMII. - */ - phy_addr = memac->pcsphy->mdio.addr; - qsmgii_phy_addr = (u8)((phy_addr << 2) | i); - memac->pcsphy->mdio.addr = qsmgii_phy_addr; - if (memac->basex_if) - setup_sgmii_internal_phy_base_x(memac); - else - setup_sgmii_internal_phy(memac, fixed_link); - - memac->pcsphy->mdio.addr = phy_addr; - } - } + if (memac->phy_if == PHY_INTERFACE_MODE_SGMII) + setup_sgmii_internal(memac, memac->sgmii_pcs, fixed_link); + else if (memac->phy_if == PHY_INTERFACE_MODE_QSGMII) + setup_sgmii_internal(memac, memac->qsgmii_pcs, fixed_link); /* Max Frame Length */ err = fman_set_mac_max_frame(memac->fm, memac->mac_id, @@ -1101,8 +980,12 @@ static int memac_free(struct fman_mac *memac) { free_init_resources(memac); - if (memac->pcsphy) - put_device(&memac->pcsphy->mdio.dev); + if (memac->sgmii_pcs) + lynx_pcs_destroy(memac->sgmii_pcs); + if (memac->qsgmii_pcs) + lynx_pcs_destroy(memac->qsgmii_pcs); + if (memac->xfi_pcs) + lynx_pcs_destroy(memac->xfi_pcs); kfree(memac->memac_drv_param); kfree(memac); @@ -1153,12 +1036,29 @@ static struct fman_mac *memac_config(struct mac_device *mac_dev, return memac; } +static struct phylink_pcs *memac_pcs_create(struct device_node *mac_node, + int index) +{ + struct device_node *node; + struct mdio_device *mdiodev = NULL; + + node = of_parse_phandle(mac_node, "pcsphy-handle", index); + if (node && of_device_is_available(node)) + mdiodev = of_mdio_find_device(node); + of_node_put(node); + + if (!mdiodev) + return ERR_PTR(-EPROBE_DEFER); + + return lynx_pcs_create(mdiodev) ?: ERR_PTR(-ENOMEM); +} + int memac_initialization(struct mac_device *mac_dev, struct device_node *mac_node, struct fman_mac_params *params) { int err; - struct device_node *phy_node; + struct phylink_pcs *pcs; struct fixed_phy_status *fixed_link; struct fman_mac *memac; @@ -1188,23 +1088,57 @@ 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; + + err = of_property_match_string(mac_node, "pcs-names", "xfi"); + if (err >= 0) { + memac->xfi_pcs = memac_pcs_create(mac_node, err); + if (IS_ERR(memac->xfi_pcs)) { + err = PTR_ERR(memac->xfi_pcs); + dev_err_probe(mac_dev->dev, err, "missing xfi pcs\n"); goto _return_fm_mac_free; } + } else if (err != -EINVAL && err != -ENODATA) { + 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; + err = of_property_match_string(mac_node, "pcs-names", "qsgmii"); + if (err >= 0) { + memac->qsgmii_pcs = memac_pcs_create(mac_node, err); + if (IS_ERR(memac->qsgmii_pcs)) { + err = PTR_ERR(memac->qsgmii_pcs); + dev_err_probe(mac_dev->dev, err, "missing qsgmii pcs\n"); goto _return_fm_mac_free; } + } else if (err != -EINVAL && err != -ENODATA) { + goto _return_fm_mac_free; + } + + /* For compatibility, if pcs-names is missing, we assume this phy is + * the first one in pcsphy-handle + */ + err = of_property_match_string(mac_node, "pcs-names", "sgmii"); + if (err == -EINVAL) + pcs = memac_pcs_create(mac_node, 0); + else if (err < 0) + goto _return_fm_mac_free; + else + pcs = memac_pcs_create(mac_node, err); + + if (!pcs) { + dev_err(mac_dev->dev, "missing pcs\n"); + err = -ENOENT; + goto _return_fm_mac_free; } + /* If err is set here, it means that pcs-names was missing above (and + * therefore that xfi_pcs cannot be set). If we are defaulting to + * XGMII, assume this is for XFI. Otherwise, assume it is for SGMII. + */ + if (err && mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII) + memac->xfi_pcs = pcs; + else + memac->sgmii_pcs = pcs; + memac->serdes = devm_of_phy_get(mac_dev->dev, mac_node, "serdes"); if (PTR_ERR(memac->serdes) == -ENODEV) { memac->serdes = NULL; From patchwork Tue Jun 28 22:14:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899109 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 E6123C433EF for ; Tue, 28 Jun 2022 22:55:18 +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=Esu64nk6dQM9ox9rhrG+B3y9lkP5TM6e5h+w2pvjs90=; b=AH+3gellpwvJI0 QkE+j+InCEGCVwitnXl1iuMcFs8/Y7R4+Dtsmen0o9Aef495LKU3wnM/XB916R6X0YsvjgbXGutst Fg1+xA/BBZoxdpw6o03zuh0ofcC1MdAUtp3HtpvVipnfmpjF9Pqy+6P6Eyfxvt2YDHLU3ItdlJNSk NPTuZlP0G+QJd1Fclj14EItbBPZDoTCMdT4PRHhVXamu6RorzmMdCHl5+eqHE62TU7R8xXWUgZSN2 QpxzclNQoF5LV2Qb1/WBUFOKYRBNHb8VAcKSLuz0wvLR2cJDnLmCzvy5MbHGWm822ozS5G8843cyQ orCosvVx5tNhV3C//2fg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6K58-008XGb-7h; Tue, 28 Jun 2022 22:53:19 +0000 Received: from mail-eopbgr00066.outbound.protection.outlook.com ([40.107.0.66] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUl-008N2H-PK for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VAuAzX7sy646YUEGffFHEKsvL7xh/6m6K1xEWJ9M0P5eK3cVzbbwngBXTx9FqAc8v4sUGynZq1PCY1n8bMKqzcw/WVN7aKZg2nOhriVpyl+OMqeXCULNV8SDhdqYm5ywYq7OTiixy0EBgxHo6jklsW/EQP5JZF5c7fY7/Eo2m0biVypwSD3nYRTlId9DhIjloJbitOS8RF07UBhwcThgn2A5XZCimkn12Hvx66IahefKX5WUJ+ELv92SYisu7P1A5Sg+lFJS9HfAAPcZ1l7OcTVmavDKlnFC3SiGImODHhrQ0yBJ/DdT/2uvzzy1z5vF1GjumS55JRZaeYXG+zFX4Q== 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=Ovm/e8lx8Wb0gf9WidO8Bq4Iwq5AYX7dvEMSOd6wPXA=; b=QqywAc75m0dIexneQNs0fu7oH5Sz61syDP3ZbUv7TmVpFpJYcrTbVU0BHfVCnZ2hGXmVYIBaASgrQMPRIulih1US/TfTiJv9Jb63EN6vRYsv/mmG393kiGGEYGu1L/d+IKcEoCzuMp9gZWplLh9fC4VAbZzgJVTjAk1GKTkcdKihdYFHytYwreTAkruev62e8/ZEjR/jynUPDQadQDOeu1/nnsOwTdlxnYmkV1XgpAUWQyOp79sYNu0Rucf5WzQMy0gnBmMu6/1AJdL1MNruW/9Fs7tfLTh3G3D795p9baMl9/EqT/f2n3e2Wh09gpu/KiYa6/iRGlx2VBhnSHAjng== 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=Ovm/e8lx8Wb0gf9WidO8Bq4Iwq5AYX7dvEMSOd6wPXA=; b=lDc7KZGaJIm5zxFJUfhF3/+A22vMgd0d5hNNzum39mv7Wu9bjne/EP060RHfc2wajxkqdHE1bdG4E/dyvTI126Oo5cbI8mZjCKmjpPpDccn69n1QbPHwRyz+0GVyg+9J0dyo/mnb6Yu4vNsVbU4ZOU8r8G8HaeZMClHbX1Rr8hxuHenx9nOEQuDLLqrb5gC4PJsFkFvHR0/ykJBFDg9Qw4iM8adWhIrhCaSAQBbaZCPYYdGkyTFp8mpKpJ/gcg1rksMlRibZY0aUnQ+A2l75Se6mhjK369EZbYAZCPKV5im6ujspfEaGKzmXG9cSj9LBICyHNOvQrgbFShqlD4sXmQ== 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 DB6PR03MB3013.eurprd03.prod.outlook.com (2603:10a6:6:3c::28) 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:15:36 +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:15:36 +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 31/35] [RFT] net: dpaa: Convert to phylink Date: Tue, 28 Jun 2022 18:14:00 -0400 Message-Id: <20220628221404.1444200-32-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: 19f4b644-b3fa-4819-220b-08da5953a87b X-MS-TrafficTypeDiagnostic: DB6PR03MB3013:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jMpoZ12bx+2YubX/ipJIx9LHoDhY7X8VHPSJfH1y/wIwLM/pUuG7BW7Uxb+QmxbCRDJuUznpnW2qNGP8jBVkOHAuMcVxNUpWu+qNatwcohz2IfOynyZIbnrCzZ4p86si0QObQJy2LoyXV/Ffoh24hgr8KCyTE4AiN5sCNTMto9xmzYeadMO1g1upSna5nY3YqryPMuWdMWQT6SssQ90c5oht6swSo8qW7g7PFYiCTI5Kdp9Cn4qCeHzY5LQhplfUZ06lw0KLj07dWkCgC3W0/nvlBa52vqH71Cgj+vuWhX+TtzxZaaZTt2AaKHij2lhlS55/CG46+l5DCJZFSZzhaRtvSL5ix4SrRS1ZqDLBaBtFmT0Qnw9kOpQAJgsS+3H91yt8Fr1iX3O4LOHK6/oY8nwD2rVcaKMp6GdHk/XL3CnXFFtgB8WuVI9RrXjxKAXTPOQF6Y3fqAxLnH1TR0taWKWvE66lfqSU+fUef/8jWMVCGoFXL1p/O3yTWWZKxZ9ff1NsdRUip/4YW0WCuXCb2neKGdvtYTYARmLpxPgygH/B0ZWbxE8N5Zf+RTzOLTdNAh5L8q6NqpTuMb5cfpXrKYC3TjvzSzR0QKL5bMlcno8Wa6oq3mTo2fri8E4AduIBeKqQuTnqLITZoVEn4DUbdsZb9p/i7072y7vC2Mte98245YH334NvwtCoa4FE3xcHwe0/joJbj1r/7Rbv9FjjOQiK+pg1uTCkk2E5xZoGiD73sdaPM7qaZXdCubaCxADx2gwQTjnn60BbQthcy5fXgIFQAgw6bxKx3m9ACZTk3vvCaHKZxDg9uwavzJZAPRzx 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)(396003)(39850400004)(376002)(366004)(136003)(346002)(2616005)(41300700001)(26005)(107886003)(1076003)(66946007)(6666004)(8676002)(6506007)(6512007)(52116002)(186003)(38350700002)(83380400001)(44832011)(30864003)(6486002)(8936002)(66476007)(38100700002)(2906002)(66556008)(86362001)(5660300002)(54906003)(36756003)(110136005)(4326008)(316002)(478600001)(579004)(559001)(309714004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Vv/jngjFrl8VqTKMu+AMlgslLSqff+bbMquMQcBNTumdORqx10YW73JhMBvA6oLQ5Md08Tm4uCxzRyrmiNoDWcO0F5rEMmkEae9zpOO4zSws6pv3Vd1VR9zTMfocc5CfnYjaEIwKWFpSw425Y8lpdZANSFN/Jc/s6VwyUs5uiRnSDBDnmFWLLKWFqwsUvP5JkAvOMvyt1H/nan1VX4zmq2xwHl+p94tn9lnDosZ3aHGCnFcGJH6WKIV8vDMYiFInJn0jU/oKUC92hfKdgDxy4sUvaMEX0ormmtjTHbVfVBBVrlcx6t+eCV9myWOzWteS69KlVtSIduqEbCNn36tLOwoCyLOvc4z30L0uAJjQTifYNDAG034EQWaFtzLAG75bir9N+XsOeoZU9ao4989gAgVYQ43le4s9d6+DicXjOv6RwRQpHy6WQ033CQzHLbhsupaOPua+kkaT8j21MFyQKZEXZGCqx5boSYxDGqckpDUf0dnCvzQQ4T81E+psWJrAZYq9WVWoaJnmZ+L62g1AW8x/VAqxsje+GC2BbV9Fq9eejEkrTSCiwzGO8KIKtSIZdTFob6k0Gg92UHvq5+wHPKM15zE3EZ4uSpce39PuooZ9vb38H5L0DXNEzkR9nQJiRnwnFy5T1nhsfXvU2JjAQIwaRKGWOAKlOLPlETqfin+RMrjJEe0SLyFXNWkCoFFN9xjecKaPCZVk3JxivS6ejTgVEc0dYZeLXkHp68LHKX4ZyHOps6l+kC5+GurW0XJZn/xotrx9Vb6XizUghxbboCPQ4p3T1DjfGxqdzf28xA7dLTBzs+RZIxrvEihuza+nTuodC64AlR01KpUuZIHZZNJAGEPSoXi2Yw1khmLL02T1t4MRQiy/i9vGl8SmluXrwlfSay++ECvWGm5mte3AC4cyZVPSWsLGFvRdvQqyuF0QaD1cZkATIqNZTXO5RVndZ+FRVcAI1upyLUxHZaXj5doq7FwFmMOzO5ni+szjGAed9uv6yYeQC/GXWOORDDW7wLa1y/XTIN7rAr6og+Bk4ituWW1pDirhSS7xcocy46MOw3U/5B03edcdrKaRtzP5fAom9Z2um2qr3zfXTkGlch8GIZ/Wb+YdwR0BrcUAVMnsgXLH9mAmvARir6zsKMNqwXJijmk7HS2GXBZoEAZTU++KEBSR1I8Yxlj7OvI3bPVFEyhHLTZY0XWO19ZX2e8hhTAiHuPlBsC2mhr6ccjmDmasAww0hI+3ZNzdlxEpEEhYscPBUYQWEao+sv98ATvhitBiEOAEI1N6acba1Nc2n7/uP8UEEJpXvrqplx10UuAfx9QBkQ46xF53zOgOTgkjR4iO1PTvFEZfHieRMGWV826CG55R5L4lwQSLMIRMXu1kodMDuIgjEYbVxnWn5buMjAT1Qg0pdUoKeRn0VUkdRK2soQ62PdyPTi5LFm3YRIcHrPnMMnLfVHQbXAjLJ6K6dsdkcPr+4FAlpSUEdcDC5VeSxVPMI0E/MSssUQODzY+dq1huUnMtieHiDOQ99mQmNM0hDkHjAIBTn41Fozhk1BVNnU+dbSBxz9pLGWMxXxhj1lL4NVKGEH6O/zu5Gpa2MK3dA9Sgta5BmCBQHyL9wA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19f4b644-b3fa-4819-220b-08da5953a87b 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:15:07.1864 (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: 3FQcXB/buAApy+qLvfOg6kI6AaTMEEXrDvEeWB8jWCB91fFoFHwgbo2y5yPkgtcMI1h6VB9dkAmIg0lrlFkdlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB3013 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151544_283196_0C1FE4D7 X-CRM114-Status: GOOD ( 29.94 ) 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 converts DPAA to phylink. All macs are converted. This should work with no device tree modifications (including those made in this series), except for QSGMII (as noted previously). The mEMAC configuration is one of the tricker areas. I have tried to capture all the restrictions across the various models. Most of the time, we assume that if the serdes supports a mode or the phy-interface-mode specifies it, then we support it. The only place we can't do this is (RG)MII, since there's no serdes. In that case, we rely on a (new) devicetree property. There are also several cases where half-duplex is broken. Unfortunately, only a single compatible is used for the MAC, so we have to use the board compatible instead. The 10GEC conversion is very straightforward, since it only supports XAUI. There is generally nothing to configure. The dTSEC conversion is broadly similar to mEMAC, but is simpler because we don't support configuring the SerDes (though this can be easily added) and we don't have multiple PCSs. From what I can tell, there's nothing different in the driver or documentation between SGMII and 1000Base-X except for the advertising. Similarly, I couldn't find anything about 2500Base-X. In both cases, I treat them like SGMII. These modes aren't used by any in-tree boards. Similarly, despite being mentioned in the driver, I couldn't find any documented SoCs which supported QSGMII. I have left it unimplemented for now. 10GEC and dTSEC have not been tested at all. I would greatly appreciate if someone could try them out. Signed-off-by: Sean Anderson --- This has been tested on an LS1046ARDB. With the serdes driver disabled (e.g. with eveything up to this patch applied), everything works. With the serdes driver enabled, fewer things work. When SRDS_PRTCL_S1 is 1133, everything works but eth3 (aka MAC6). If I configure all lanes for SGMII then MAC6 works (but of course the 10G MACs break). When SRDS_PRTCL_S is 0000 only ETH5 worked. I looked at the serdes registers, but I only saw differences in undocumented registers/fields. I'm still looking into this... With managed=phy , I was unable to get the interfaces to come up at all, hence the default to in-band. Changes in v2: - Configure the SerDes in enable/disable - Convert 10GEC and dTSEC as well - Properly implement all ethtool ops and ioctls. These were mostly stubbed out just enough to compile last time. - Remove unused variable slow_10g_if - Restrict valid link modes based on the phy interface. This is easier to set up, and mostly captures what I intended to do the first time. We now have a custom validate which restricts half-duplex for some SoCs for RGMII, but generally just uses the default phylink validate. drivers/net/ethernet/freescale/dpaa/Kconfig | 4 +- .../net/ethernet/freescale/dpaa/dpaa_eth.c | 85 +-- .../ethernet/freescale/dpaa/dpaa_ethtool.c | 90 +-- drivers/net/ethernet/freescale/fman/Kconfig | 1 - .../net/ethernet/freescale/fman/fman_dtsec.c | 453 +++++++------- .../net/ethernet/freescale/fman/fman_mac.h | 10 - .../net/ethernet/freescale/fman/fman_memac.c | 579 ++++++++++-------- .../net/ethernet/freescale/fman/fman_tgec.c | 131 ++-- drivers/net/ethernet/freescale/fman/mac.c | 168 +---- drivers/net/ethernet/freescale/fman/mac.h | 23 +- 10 files changed, 637 insertions(+), 907 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig b/drivers/net/ethernet/freescale/dpaa/Kconfig index 0e1439fd00bd..2b560661c82a 100644 --- a/drivers/net/ethernet/freescale/dpaa/Kconfig +++ b/drivers/net/ethernet/freescale/dpaa/Kconfig @@ -2,8 +2,8 @@ menuconfig FSL_DPAA_ETH tristate "DPAA Ethernet" depends on FSL_DPAA && FSL_FMAN - select PHYLIB - select FIXED_PHY + select PHYLINK + select PCS_LYNX help Data Path Acceleration Architecture Ethernet driver, supporting the Freescale QorIQ chips. diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index fd81ebc7be44..125e7db3dba8 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -264,8 +264,19 @@ static int dpaa_netdev_init(struct net_device *net_dev, net_dev->needed_headroom = priv->tx_headroom; net_dev->watchdog_timeo = msecs_to_jiffies(tx_timeout); - mac_dev->net_dev = net_dev; + /* The rest of the config is filled in by the mac device already */ + mac_dev->phylink_config.dev = &net_dev->dev; + mac_dev->phylink_config.type = PHYLINK_NETDEV; mac_dev->update_speed = dpaa_eth_cgr_set_speed; + mac_dev->phylink = phylink_create(&mac_dev->phylink_config, + dev_fwnode(mac_dev->dev), + mac_dev->phy_if, + mac_dev->phylink_ops); + if (IS_ERR(mac_dev->phylink)) { + err = PTR_ERR(mac_dev->phylink); + dev_err_probe(dev, err, "Could not create phylink\n"); + return err; + } /* start without the RUNNING flag, phylib controls it later */ netif_carrier_off(net_dev); @@ -273,6 +284,7 @@ static int dpaa_netdev_init(struct net_device *net_dev, err = register_netdev(net_dev); if (err < 0) { dev_err(dev, "register_netdev() = %d\n", err); + phylink_destroy(mac_dev->phylink); return err; } @@ -294,8 +306,7 @@ static int dpaa_stop(struct net_device *net_dev) */ msleep(200); - if (mac_dev->phy_dev) - phy_stop(mac_dev->phy_dev); + phylink_stop(mac_dev->phylink); mac_dev->disable(mac_dev->fman_mac); for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { @@ -304,8 +315,7 @@ static int dpaa_stop(struct net_device *net_dev) err = error; } - if (net_dev->phydev) - phy_disconnect(net_dev->phydev); + phylink_disconnect_phy(mac_dev->phylink); net_dev->phydev = NULL; msleep(200); @@ -833,10 +843,10 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv) /* Set different thresholds based on the configured MAC speed. * This may turn suboptimal if the MAC is reconfigured at another - * speed, so MACs must call dpaa_eth_cgr_set_speed in their adjust_link + * speed, so MACs must call dpaa_eth_cgr_set_speed in their link_up * callback. */ - if (priv->mac_dev->if_support & SUPPORTED_10000baseT_Full) + if (priv->mac_dev->phylink_config.mac_capabilities & MAC_10000FD) cs_th = DPAA_CS_THRESHOLD_10G; else cs_th = DPAA_CS_THRESHOLD_1G; @@ -865,7 +875,7 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv) static void dpaa_eth_cgr_set_speed(struct mac_device *mac_dev, int speed) { - struct net_device *net_dev = mac_dev->net_dev; + struct net_device *net_dev = to_net_dev(mac_dev->phylink_config.dev); struct dpaa_priv *priv = netdev_priv(net_dev); struct qm_mcc_initcgr opts = { }; u32 cs_th; @@ -2904,54 +2914,6 @@ static void dpaa_eth_napi_disable(struct dpaa_priv *priv) } } -static void dpaa_adjust_link(struct net_device *net_dev) -{ - struct mac_device *mac_dev; - struct dpaa_priv *priv; - - priv = netdev_priv(net_dev); - mac_dev = priv->mac_dev; - mac_dev->adjust_link(mac_dev); -} - -/* The Aquantia PHYs are capable of performing rate adaptation */ -#define PHY_VEND_AQUANTIA 0x03a1b400 - -static int dpaa_phy_init(struct net_device *net_dev) -{ - __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; - struct mac_device *mac_dev; - struct phy_device *phy_dev; - struct dpaa_priv *priv; - - priv = netdev_priv(net_dev); - mac_dev = priv->mac_dev; - - phy_dev = of_phy_connect(net_dev, mac_dev->phy_node, - &dpaa_adjust_link, 0, - mac_dev->phy_if); - if (!phy_dev) { - netif_err(priv, ifup, net_dev, "init_phy() failed\n"); - return -ENODEV; - } - - /* Unless the PHY is capable of rate adaptation */ - if (mac_dev->phy_if != PHY_INTERFACE_MODE_XGMII || - ((phy_dev->drv->phy_id & GENMASK(31, 10)) != PHY_VEND_AQUANTIA)) { - /* remove any features not supported by the controller */ - ethtool_convert_legacy_u32_to_link_mode(mask, - mac_dev->if_support); - linkmode_and(phy_dev->supported, phy_dev->supported, mask); - } - - phy_support_asym_pause(phy_dev); - - mac_dev->phy_dev = phy_dev; - net_dev->phydev = phy_dev; - - return 0; -} - static int dpaa_open(struct net_device *net_dev) { struct mac_device *mac_dev; @@ -2962,7 +2924,8 @@ static int dpaa_open(struct net_device *net_dev) mac_dev = priv->mac_dev; dpaa_eth_napi_enable(priv); - err = dpaa_phy_init(net_dev); + err = phylink_of_phy_connect(mac_dev->phylink, + mac_dev->dev->of_node, 0); if (err) goto phy_init_failed; @@ -2977,7 +2940,7 @@ static int dpaa_open(struct net_device *net_dev) netif_err(priv, ifup, net_dev, "mac_dev->enable() = %d\n", err); goto mac_start_failed; } - phy_start(priv->mac_dev->phy_dev); + phylink_start(mac_dev->phylink); netif_tx_start_all_queues(net_dev); @@ -2986,6 +2949,7 @@ static int dpaa_open(struct net_device *net_dev) mac_start_failed: for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) fman_port_disable(mac_dev->port[i]); + phylink_disconnect_phy(mac_dev->phylink); phy_init_failed: dpaa_eth_napi_disable(priv); @@ -3141,10 +3105,12 @@ static int dpaa_ts_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) static int dpaa_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd) { int ret = -EINVAL; + struct dpaa_priv *priv = netdev_priv(net_dev); if (cmd == SIOCGMIIREG) { if (net_dev->phydev) - return phy_mii_ioctl(net_dev->phydev, rq, cmd); + return phylink_mii_ioctl(priv->mac_dev->phylink, rq, + cmd); } if (cmd == SIOCSHWTSTAMP) @@ -3548,6 +3514,7 @@ static int dpaa_remove(struct platform_device *pdev) dev_set_drvdata(dev, NULL); unregister_netdev(net_dev); + phylink_destroy(priv->mac_dev->phylink); err = dpaa_fq_free(dev, &priv->dpaa_fq_list); diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c index 73f07881ce2d..7463ec7f0105 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c @@ -54,27 +54,19 @@ static char dpaa_stats_global[][ETH_GSTRING_LEN] = { static int dpaa_get_link_ksettings(struct net_device *net_dev, struct ethtool_link_ksettings *cmd) { - if (!net_dev->phydev) - return 0; + struct dpaa_priv *priv = netdev_priv(net_dev); + struct mac_device *mac_dev = priv->mac_dev; - phy_ethtool_ksettings_get(net_dev->phydev, cmd); - - return 0; + return phylink_ethtool_ksettings_get(mac_dev->phylink, cmd); } static int dpaa_set_link_ksettings(struct net_device *net_dev, const struct ethtool_link_ksettings *cmd) { - int err; + struct dpaa_priv *priv = netdev_priv(net_dev); + struct mac_device *mac_dev = priv->mac_dev; - if (!net_dev->phydev) - return -ENODEV; - - err = phy_ethtool_ksettings_set(net_dev->phydev, cmd); - if (err < 0) - netdev_err(net_dev, "phy_ethtool_ksettings_set() = %d\n", err); - - return err; + return phylink_ethtool_ksettings_set(mac_dev->phylink, cmd); } static void dpaa_get_drvinfo(struct net_device *net_dev, @@ -99,80 +91,28 @@ static void dpaa_set_msglevel(struct net_device *net_dev, static int dpaa_nway_reset(struct net_device *net_dev) { - int err; + struct dpaa_priv *priv = netdev_priv(net_dev); + struct mac_device *mac_dev = priv->mac_dev; - if (!net_dev->phydev) - return -ENODEV; - - err = 0; - if (net_dev->phydev->autoneg) { - err = phy_start_aneg(net_dev->phydev); - if (err < 0) - netdev_err(net_dev, "phy_start_aneg() = %d\n", - err); - } - - return err; + return phylink_ethtool_nway_reset(mac_dev->phylink); } static void dpaa_get_pauseparam(struct net_device *net_dev, struct ethtool_pauseparam *epause) { - struct mac_device *mac_dev; - struct dpaa_priv *priv; + struct dpaa_priv *priv = netdev_priv(net_dev); + struct mac_device *mac_dev = priv->mac_dev; - priv = netdev_priv(net_dev); - mac_dev = priv->mac_dev; - - if (!net_dev->phydev) - return; - - epause->autoneg = mac_dev->autoneg_pause; - epause->rx_pause = mac_dev->rx_pause_active; - epause->tx_pause = mac_dev->tx_pause_active; + phylink_ethtool_get_pauseparam(mac_dev->phylink, epause); } static int dpaa_set_pauseparam(struct net_device *net_dev, struct ethtool_pauseparam *epause) { - struct mac_device *mac_dev; - struct phy_device *phydev; - bool rx_pause, tx_pause; - struct dpaa_priv *priv; - int err; + struct dpaa_priv *priv = netdev_priv(net_dev); + struct mac_device *mac_dev = priv->mac_dev; - priv = netdev_priv(net_dev); - mac_dev = priv->mac_dev; - - phydev = net_dev->phydev; - if (!phydev) { - netdev_err(net_dev, "phy device not initialized\n"); - return -ENODEV; - } - - if (!phy_validate_pause(phydev, epause)) - return -EINVAL; - - /* The MAC should know how to handle PAUSE frame autonegotiation before - * adjust_link is triggered by a forced renegotiation of sym/asym PAUSE - * settings. - */ - mac_dev->autoneg_pause = !!epause->autoneg; - mac_dev->rx_pause_req = !!epause->rx_pause; - mac_dev->tx_pause_req = !!epause->tx_pause; - - /* Determine the sym/asym advertised PAUSE capabilities from the desired - * rx/tx pause settings. - */ - - phy_set_asym_pause(phydev, epause->rx_pause, epause->tx_pause); - - fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); - err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); - if (err < 0) - netdev_err(net_dev, "set_mac_active_pause() = %d\n", err); - - return err; + return phylink_ethtool_set_pauseparam(mac_dev->phylink, epause); } static int dpaa_get_sset_count(struct net_device *net_dev, int type) diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index f5ef42bd2011..a55542c1ad65 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -3,7 +3,6 @@ config FSL_FMAN tristate "FMan support" depends on FSL_SOC || ARCH_LAYERSCAPE || COMPILE_TEST select GENERIC_ALLOCATOR - select PHYLIB select PHYLINK select PCS_LYNX select CRC32 diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 6617932fd3fd..4ece454e9480 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -17,6 +17,7 @@ #include #include #include +#include /* TBI register addresses */ #define MII_TBICON 0x11 @@ -29,9 +30,6 @@ #define TBICON_CLK_SELECT 0x0020 /* Clock select */ #define TBICON_MI_MODE 0x0010 /* GMII mode (TBI if not set) */ -#define TBIANA_SGMII 0x4001 -#define TBIANA_1000X 0x01a0 - /* Interrupt Mask Register (IMASK) */ #define DTSEC_IMASK_BREN 0x80000000 #define DTSEC_IMASK_RXCEN 0x40000000 @@ -92,9 +90,10 @@ #define DTSEC_ECNTRL_GMIIM 0x00000040 #define DTSEC_ECNTRL_TBIM 0x00000020 -#define DTSEC_ECNTRL_SGMIIM 0x00000002 #define DTSEC_ECNTRL_RPM 0x00000010 #define DTSEC_ECNTRL_R100M 0x00000008 +#define DTSEC_ECNTRL_RMM 0x00000004 +#define DTSEC_ECNTRL_SGMIIM 0x00000002 #define DTSEC_ECNTRL_QSGMIIM 0x00000001 #define TCTRL_TTSE 0x00000040 @@ -318,7 +317,8 @@ struct fman_mac { void *fm; struct fman_rev_info fm_rev_info; bool basex_if; - struct phy_device *tbiphy; + struct mdio_device *tbidev; + struct phylink_pcs pcs; }; static void set_dflts(struct dtsec_cfg *cfg) @@ -356,7 +356,6 @@ static int init(struct dtsec_regs __iomem *regs, struct dtsec_cfg *cfg, phy_interface_t iface, u16 iface_speed, u64 addr, u32 exception_mask, u8 tbi_addr) { - bool is_rgmii, is_sgmii, is_qsgmii; enet_addr_t eth_addr; u32 tmp; int i; @@ -365,47 +364,6 @@ static int init(struct dtsec_regs __iomem *regs, struct dtsec_cfg *cfg, iowrite32be(MACCFG1_SOFT_RESET, ®s->maccfg1); iowrite32be(0, ®s->maccfg1); - /* dtsec_id2 */ - tmp = ioread32be(®s->tsec_id2); - - /* check RGMII support */ - if (iface == PHY_INTERFACE_MODE_RGMII || - iface == PHY_INTERFACE_MODE_RGMII_ID || - iface == PHY_INTERFACE_MODE_RGMII_RXID || - iface == PHY_INTERFACE_MODE_RGMII_TXID || - iface == PHY_INTERFACE_MODE_RMII) - if (tmp & DTSEC_ID2_INT_REDUCED_OFF) - return -EINVAL; - - if (iface == PHY_INTERFACE_MODE_SGMII || - iface == PHY_INTERFACE_MODE_MII) - if (tmp & DTSEC_ID2_INT_REDUCED_OFF) - return -EINVAL; - - is_rgmii = iface == PHY_INTERFACE_MODE_RGMII || - iface == PHY_INTERFACE_MODE_RGMII_ID || - iface == PHY_INTERFACE_MODE_RGMII_RXID || - iface == PHY_INTERFACE_MODE_RGMII_TXID; - is_sgmii = iface == PHY_INTERFACE_MODE_SGMII; - is_qsgmii = iface == PHY_INTERFACE_MODE_QSGMII; - - tmp = 0; - if (is_rgmii || iface == PHY_INTERFACE_MODE_GMII) - tmp |= DTSEC_ECNTRL_GMIIM; - if (is_sgmii) - tmp |= (DTSEC_ECNTRL_SGMIIM | DTSEC_ECNTRL_TBIM); - if (is_qsgmii) - tmp |= (DTSEC_ECNTRL_SGMIIM | DTSEC_ECNTRL_TBIM | - DTSEC_ECNTRL_QSGMIIM); - if (is_rgmii) - tmp |= DTSEC_ECNTRL_RPM; - if (iface_speed == SPEED_100) - tmp |= DTSEC_ECNTRL_R100M; - - iowrite32be(tmp, ®s->ecntrl); - - tmp = 0; - if (cfg->tx_pause_time) tmp |= cfg->tx_pause_time; if (cfg->tx_pause_time_extd) @@ -446,17 +404,10 @@ static int init(struct dtsec_regs __iomem *regs, struct dtsec_cfg *cfg, tmp = 0; - if (iface_speed < SPEED_1000) - tmp |= MACCFG2_NIBBLE_MODE; - else if (iface_speed == SPEED_1000) - tmp |= MACCFG2_BYTE_MODE; - tmp |= (cfg->preamble_len << MACCFG2_PREAMBLE_LENGTH_SHIFT) & MACCFG2_PREAMBLE_LENGTH_MASK; if (cfg->tx_pad_crc) tmp |= MACCFG2_PAD_CRC_EN; - /* Full Duplex */ - tmp |= MACCFG2_FULL_DUPLEX; iowrite32be(tmp, ®s->maccfg2); tmp = (((cfg->non_back_to_back_ipg1 << @@ -525,10 +476,6 @@ static void set_bucket(struct dtsec_regs __iomem *regs, int bucket, static int check_init_parameters(struct fman_mac *dtsec) { - if (dtsec->max_speed >= SPEED_10000) { - pr_err("1G MAC driver supports 1G or lower speeds\n"); - return -EINVAL; - } if ((dtsec->dtsec_drv_param)->rx_prepend > MAX_PACKET_ALIGNMENT) { pr_err("packetAlignmentPadding can't be > than %d\n", @@ -630,22 +577,10 @@ static int get_exception_flag(enum fman_mac_exceptions exception) return bit_mask; } -static bool is_init_done(struct dtsec_cfg *dtsec_drv_params) -{ - /* Checks if dTSEC driver parameters were initialized */ - if (!dtsec_drv_params) - return true; - - return false; -} - static u16 dtsec_get_max_frame_length(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; - if (is_init_done(dtsec->dtsec_drv_param)) - return 0; - return (u16)ioread32be(®s->maxfrm); } @@ -682,6 +617,7 @@ static void dtsec_isr(void *handle) dtsec->exception_cb(dtsec->dev_id, FM_MAC_EX_1G_COL_RET_LMT); if (event & DTSEC_IMASK_XFUNEN) { /* FM_TX_LOCKUP_ERRATA_DTSEC6 Errata workaround */ + /* FIXME: This races with the rest of the driver! */ if (dtsec->fm_rev_info.major == 2) { u32 tpkt1, tmp_reg1, tpkt2, tmp_reg2, i; /* a. Write 0x00E0_0C00 to DTSEC_ID @@ -814,6 +750,43 @@ static void free_init_resources(struct fman_mac *dtsec) dtsec->unicast_addr_hash = NULL; } +static struct fman_mac *pcs_to_dtsec(struct phylink_pcs *pcs) +{ + return container_of(pcs, struct fman_mac, pcs); +} + +static void dtsec_pcs_get_state(struct phylink_pcs *pcs, + struct phylink_link_state *state) +{ + struct fman_mac *dtsec = pcs_to_dtsec(pcs); + + phylink_mii_c22_pcs_get_state(dtsec->tbidev, state); +} + +static int dtsec_pcs_config(struct phylink_pcs *pcs, unsigned int mode, + phy_interface_t interface, + const unsigned long *advertising, + bool permit_pause_to_mac) +{ + struct fman_mac *dtsec = pcs_to_dtsec(pcs); + + return phylink_mii_c22_pcs_config(dtsec->tbidev, mode, interface, + advertising); +} + +static void dtsec_pcs_an_restart(struct phylink_pcs *pcs) +{ + struct fman_mac *dtsec = pcs_to_dtsec(pcs); + + phylink_mii_c22_pcs_an_restart(dtsec->tbidev); +} + +static const struct phylink_pcs_ops dtsec_pcs_ops = { + .pcs_get_state = dtsec_pcs_get_state, + .pcs_config = dtsec_pcs_config, + .pcs_an_restart = dtsec_pcs_an_restart, +}; + static void graceful_start(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; @@ -854,36 +827,11 @@ static void graceful_stop(struct fman_mac *dtsec) static int dtsec_enable(struct fman_mac *dtsec) { - struct dtsec_regs __iomem *regs = dtsec->regs; - u32 tmp; - - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - /* Enable */ - tmp = ioread32be(®s->maccfg1); - tmp |= MACCFG1_RX_EN | MACCFG1_TX_EN; - iowrite32be(tmp, ®s->maccfg1); - - /* Graceful start - clear the graceful Rx/Tx stop bit */ - graceful_start(dtsec); - return 0; } static void dtsec_disable(struct fman_mac *dtsec) { - struct dtsec_regs __iomem *regs = dtsec->regs; - u32 tmp; - - WARN_ON_ONCE(!is_init_done(dtsec->dtsec_drv_param)); - - /* Graceful stop - Assert the graceful Rx/Tx stop bit */ - graceful_stop(dtsec); - - tmp = ioread32be(®s->maccfg1); - tmp &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN); - iowrite32be(tmp, ®s->maccfg1); } static int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, @@ -894,11 +842,6 @@ static int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, struct dtsec_regs __iomem *regs = dtsec->regs; u32 ptv = 0; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - graceful_stop(dtsec); - if (pause_time) { /* FM_BAD_TX_TS_IN_B_2_B_ERRATA_DTSEC_A003 Errata workaround */ if (dtsec->fm_rev_info.major == 2 && pause_time <= 320) { @@ -919,8 +862,6 @@ static int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, iowrite32be(ioread32be(®s->maccfg1) & ~MACCFG1_TX_FLOW, ®s->maccfg1); - graceful_start(dtsec); - return 0; } @@ -929,11 +870,6 @@ static int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en) struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - graceful_stop(dtsec); - tmp = ioread32be(®s->maccfg1); if (en) tmp |= MACCFG1_RX_FLOW; @@ -941,17 +877,120 @@ static int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en) tmp &= ~MACCFG1_RX_FLOW; iowrite32be(tmp, ®s->maccfg1); - graceful_start(dtsec); - return 0; } +static struct phylink_pcs *dtsec_select_pcs(struct phylink_config *config, + phy_interface_t iface) +{ + struct fman_mac *dtsec = fman_config_to_mac(config)->fman_mac; + + switch (iface) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_2500BASEX: + return &dtsec->pcs; + default: + return NULL; + } +} + +static void dtsec_mac_config(struct phylink_config *config, unsigned int mode, + const struct phylink_link_state *state) +{ + struct mac_device *mac_dev = fman_config_to_mac(config); + struct dtsec_regs __iomem *regs = mac_dev->fman_mac->regs; + u32 tmp; + + switch (state->interface) { + case PHY_INTERFACE_MODE_RMII: + tmp = DTSEC_ECNTRL_RMM; + break; + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + tmp = DTSEC_ECNTRL_GMIIM | DTSEC_ECNTRL_RPM; + break; + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_2500BASEX: + tmp = DTSEC_ECNTRL_TBIM | DTSEC_ECNTRL_SGMIIM; + break; + default: + dev_warn(mac_dev->dev, "cannot configure dTSEC for %s\n", + phy_modes(state->interface)); + } + + if (state->speed == SPEED_100) + tmp |= DTSEC_ECNTRL_R100M; + + iowrite32be(tmp, ®s->ecntrl); +} + +static void dtsec_link_up(struct phylink_config *config, struct phy_device *phy, + unsigned int mode, phy_interface_t interface, + int speed, int duplex, bool tx_pause, bool rx_pause) +{ + struct mac_device *mac_dev = fman_config_to_mac(config); + struct fman_mac *dtsec = mac_dev->fman_mac; + struct dtsec_regs __iomem *regs = dtsec->regs; + u16 pause_time = tx_pause ? FSL_FM_PAUSE_TIME_ENABLE : + FSL_FM_PAUSE_TIME_DISABLE; + u32 tmp; + + dtsec_set_tx_pause_frames(dtsec, 0, pause_time, 0); + dtsec_accept_rx_pause_frames(dtsec, rx_pause); + + tmp = ioread32be(®s->maccfg2); + tmp &= ~(MACCFG2_NIBBLE_MODE | MACCFG2_BYTE_MODE | MACCFG2_FULL_DUPLEX); + if (speed >= SPEED_1000) + tmp |= MACCFG2_BYTE_MODE; + else + tmp |= MACCFG2_NIBBLE_MODE; + + if (duplex == DUPLEX_FULL) + tmp |= MACCFG2_FULL_DUPLEX; + + iowrite32be(tmp, ®s->maccfg2); + + mac_dev->update_speed(mac_dev, speed); + + /* Enable */ + tmp = ioread32be(®s->maccfg1); + tmp |= MACCFG1_RX_EN | MACCFG1_TX_EN; + iowrite32be(tmp, ®s->maccfg1); + + /* Graceful start - clear the graceful Rx/Tx stop bit */ + graceful_start(dtsec); +} + +static void dtsec_link_down(struct phylink_config *config, unsigned int mode, + phy_interface_t interface) +{ + struct fman_mac *dtsec = fman_config_to_mac(config)->fman_mac; + struct dtsec_regs __iomem *regs = dtsec->regs; + u32 tmp; + + /* Graceful stop - Assert the graceful Rx/Tx stop bit */ + graceful_stop(dtsec); + + tmp = ioread32be(®s->maccfg1); + tmp &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN); + iowrite32be(tmp, ®s->maccfg1); +} + +static const struct phylink_mac_ops dtsec_mac_ops = { + .validate = phylink_generic_validate, + .mac_select_pcs = dtsec_select_pcs, + .mac_config = dtsec_mac_config, + .mac_link_up = dtsec_link_up, + .mac_link_down = dtsec_link_down, +}; + static int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_addr) { - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - graceful_stop(dtsec); /* Initialize MAC Station Address registers (1 & 2) @@ -975,9 +1014,6 @@ static int dtsec_add_hash_mac_address(struct fman_mac *dtsec, u32 crc = 0xFFFFFFFF; bool mcast, ghtx; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - addr = ENET_ADDR_TO_UINT64(*eth_addr); ghtx = (bool)((ioread32be(®s->rctrl) & RCTRL_GHTX) ? true : false); @@ -1037,9 +1073,6 @@ static int dtsec_set_allmulti(struct fman_mac *dtsec, bool enable) u32 tmp; struct dtsec_regs __iomem *regs = dtsec->regs; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - tmp = ioread32be(®s->rctrl); if (enable) tmp |= RCTRL_MPROM; @@ -1056,9 +1089,6 @@ static int dtsec_set_tstamp(struct fman_mac *dtsec, bool enable) struct dtsec_regs __iomem *regs = dtsec->regs; u32 rctrl, tctrl; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - rctrl = ioread32be(®s->rctrl); tctrl = ioread32be(®s->tctrl); @@ -1087,9 +1117,6 @@ static int dtsec_del_hash_mac_address(struct fman_mac *dtsec, u32 crc = 0xFFFFFFFF; bool mcast, ghtx; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - addr = ENET_ADDR_TO_UINT64(*eth_addr); ghtx = (bool)((ioread32be(®s->rctrl) & RCTRL_GHTX) ? true : false); @@ -1153,9 +1180,6 @@ static int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val) struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - /* Set unicast promiscuous */ tmp = ioread32be(®s->rctrl); if (new_val) @@ -1177,90 +1201,12 @@ static int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val) return 0; } -static int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed) -{ - struct dtsec_regs __iomem *regs = dtsec->regs; - u32 tmp; - - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - graceful_stop(dtsec); - - tmp = ioread32be(®s->maccfg2); - - /* Full Duplex */ - tmp |= MACCFG2_FULL_DUPLEX; - - tmp &= ~(MACCFG2_NIBBLE_MODE | MACCFG2_BYTE_MODE); - if (speed < SPEED_1000) - tmp |= MACCFG2_NIBBLE_MODE; - else if (speed == SPEED_1000) - tmp |= MACCFG2_BYTE_MODE; - iowrite32be(tmp, ®s->maccfg2); - - tmp = ioread32be(®s->ecntrl); - if (speed == SPEED_100) - tmp |= DTSEC_ECNTRL_R100M; - else - tmp &= ~DTSEC_ECNTRL_R100M; - iowrite32be(tmp, ®s->ecntrl); - - graceful_start(dtsec); - - return 0; -} - -static int dtsec_restart_autoneg(struct fman_mac *dtsec) -{ - u16 tmp_reg16; - - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - tmp_reg16 = phy_read(dtsec->tbiphy, MII_BMCR); - - tmp_reg16 &= ~(BMCR_SPEED100 | BMCR_SPEED1000); - tmp_reg16 |= (BMCR_ANENABLE | BMCR_ANRESTART | - BMCR_FULLDPLX | BMCR_SPEED1000); - - phy_write(dtsec->tbiphy, MII_BMCR, tmp_reg16); - - return 0; -} - -static void adjust_link_dtsec(struct mac_device *mac_dev) -{ - struct phy_device *phy_dev = mac_dev->phy_dev; - struct fman_mac *fman_mac; - bool rx_pause, tx_pause; - int err; - - fman_mac = mac_dev->fman_mac; - if (!phy_dev->link) { - dtsec_restart_autoneg(fman_mac); - - return; - } - - dtsec_adjust_link(fman_mac, phy_dev->speed); - mac_dev->update_speed(mac_dev, phy_dev->speed); - fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); - err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); - if (err < 0) - dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", - err); -} - static int dtsec_set_exception(struct fman_mac *dtsec, enum fman_mac_exceptions exception, bool enable) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 bit_mask = 0; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - if (exception != FM_MAC_EX_1G_1588_TS_RX_ERR) { bit_mask = get_exception_flag(exception); if (bit_mask) { @@ -1310,12 +1256,9 @@ static int dtsec_init(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; struct dtsec_cfg *dtsec_drv_param; - u16 max_frm_ln; + u16 max_frm_ln, tbicon; int err; - if (is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - if (DEFAULT_RESET_ON_INIT && (fman_reset_mac(dtsec->fm, dtsec->mac_id) != 0)) { pr_err("Can't reset MAC!\n"); @@ -1330,38 +1273,19 @@ static int dtsec_init(struct fman_mac *dtsec) err = init(dtsec->regs, dtsec_drv_param, dtsec->phy_if, dtsec->max_speed, dtsec->addr, dtsec->exceptions, - dtsec->tbiphy->mdio.addr); + dtsec->tbidev->addr); if (err) { free_init_resources(dtsec); pr_err("DTSEC version doesn't support this i/f mode\n"); return err; } - if (dtsec->phy_if == PHY_INTERFACE_MODE_SGMII) { - u16 tmp_reg16; + /* Configure the TBI PHY Control Register */ + tbicon = TBICON_CLK_SELECT | TBICON_SOFT_RESET; + mdiodev_write(dtsec->tbidev, MII_TBICON, tbicon); - /* Configure the TBI PHY Control Register */ - tmp_reg16 = TBICON_CLK_SELECT | TBICON_SOFT_RESET; - phy_write(dtsec->tbiphy, MII_TBICON, tmp_reg16); - - tmp_reg16 = TBICON_CLK_SELECT; - phy_write(dtsec->tbiphy, MII_TBICON, tmp_reg16); - - tmp_reg16 = (BMCR_RESET | BMCR_ANENABLE | - BMCR_FULLDPLX | BMCR_SPEED1000); - phy_write(dtsec->tbiphy, MII_BMCR, tmp_reg16); - - if (dtsec->basex_if) - tmp_reg16 = TBIANA_1000X; - else - tmp_reg16 = TBIANA_SGMII; - phy_write(dtsec->tbiphy, MII_ADVERTISE, tmp_reg16); - - tmp_reg16 = (BMCR_ANENABLE | BMCR_ANRESTART | - BMCR_FULLDPLX | BMCR_SPEED1000); - - phy_write(dtsec->tbiphy, MII_BMCR, tmp_reg16); - } + tbicon = TBICON_CLK_SELECT; + mdiodev_write(dtsec->tbidev, MII_TBICON, tbicon); /* Max Frame Length */ max_frm_ln = (u16)ioread32be(®s->maxfrm); @@ -1406,6 +1330,8 @@ static int dtsec_free(struct fman_mac *dtsec) kfree(dtsec->dtsec_drv_param); dtsec->dtsec_drv_param = NULL; + if (!IS_ERR_OR_NULL(dtsec->tbidev)) + put_device(&dtsec->tbidev->dev); kfree(dtsec); return 0; @@ -1434,7 +1360,6 @@ static struct fman_mac *dtsec_config(struct mac_device *mac_dev, dtsec->regs = mac_dev->vaddr; dtsec->addr = ENET_ADDR_TO_UINT64(mac_dev->addr); - dtsec->max_speed = params->max_speed; dtsec->phy_if = mac_dev->phy_if; dtsec->mac_id = params->mac_id; dtsec->exceptions = (DTSEC_IMASK_BREN | @@ -1457,7 +1382,6 @@ static struct fman_mac *dtsec_config(struct mac_device *mac_dev, dtsec->en_tsu_err_exception = dtsec->dtsec_drv_param->ptp_exception_en; dtsec->fm = params->fm; - dtsec->basex_if = params->basex_if; /* Save FMan revision */ fman_get_revision(dtsec->fm, &dtsec->fm_rev_info); @@ -1476,18 +1400,18 @@ int dtsec_initialization(struct mac_device *mac_dev, int err; struct fman_mac *dtsec; struct device_node *phy_node; + unsigned long capabilities; + unsigned long *supported; + mac_dev->phylink_ops = &dtsec_mac_ops; mac_dev->set_promisc = dtsec_set_promiscuous; mac_dev->change_addr = dtsec_modify_mac_address; mac_dev->add_hash_mac_addr = dtsec_add_hash_mac_address; mac_dev->remove_hash_mac_addr = dtsec_del_hash_mac_address; - mac_dev->set_tx_pause = dtsec_set_tx_pause_frames; - mac_dev->set_rx_pause = dtsec_accept_rx_pause_frames; mac_dev->set_exception = dtsec_set_exception; mac_dev->set_allmulti = dtsec_set_allmulti; mac_dev->set_tstamp = dtsec_set_tstamp; mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = adjust_link_dtsec; mac_dev->enable = dtsec_enable; mac_dev->disable = dtsec_disable; @@ -1502,19 +1426,56 @@ int dtsec_initialization(struct mac_device *mac_dev, 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"); + if (!phy_node || of_device_is_available(phy_node)) { + of_node_put(phy_node); err = -EINVAL; + dev_err_probe(mac_dev->dev, err, + "TBI PCS node is not available\n"); 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; + dtsec->tbidev = of_mdio_find_device(phy_node); + of_node_put(phy_node); + if (!dtsec->tbidev) { + err = -EPROBE_DEFER; + dev_err_probe(mac_dev->dev, err, + "could not find mdiodev for PCS\n"); goto _return_fm_mac_free; } - put_device(&dtsec->tbiphy->mdio.dev); + dtsec->pcs.ops = &dtsec_pcs_ops; + dtsec->pcs.poll = true; + + supported = mac_dev->phylink_config.supported_interfaces; + + /* FIXME: Can we use DTSEC_ID2_INT_FULL_OFF to determine if these are + * supported? If not, we can determine support via the phy if SerDes + * support is added. + */ + if (mac_dev->phy_if == PHY_INTERFACE_MODE_SGMII || + mac_dev->phy_if == PHY_INTERFACE_MODE_1000BASEX) { + __set_bit(PHY_INTERFACE_MODE_SGMII, supported); + __set_bit(PHY_INTERFACE_MODE_1000BASEX, supported); + } else if (mac_dev->phy_if == PHY_INTERFACE_MODE_2500BASEX) { + __set_bit(PHY_INTERFACE_MODE_2500BASEX, supported); + } + + if (!(ioread32be(&dtsec->regs->tsec_id2) & DTSEC_ID2_INT_REDUCED_OFF)) { + phy_interface_set_rgmii(supported); + + /* DTSEC_ID2_INT_REDUCED_OFF indicates that the dTSEC supports + * RMII and RGMII. However, the only SoCs which support RMII + * are the P1017 and P1023. Avoid advertising this mode on + * other SoCs. This is a bit of a moot point, since there's no + * in-tree support for ethernet on these platforms... + */ + if (of_machine_is_compatible("fsl,P1023") || + of_machine_is_compatible("fsl,P1023RDB")) + __set_bit(PHY_INTERFACE_MODE_RMII, supported); + } + + capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE; + capabilities |= MAC_10 | MAC_100 | MAC_1000FD | MAC_2500FD; + mac_dev->phylink_config.mac_capabilities = capabilities; err = dtsec_init(dtsec); if (err < 0) diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h index 65887a3160d7..e5d6cddea731 100644 --- a/drivers/net/ethernet/freescale/fman/fman_mac.h +++ b/drivers/net/ethernet/freescale/fman/fman_mac.h @@ -170,20 +170,10 @@ struct fman_mac_params { * 0 - FM_MAX_NUM_OF_10G_MACS */ u8 mac_id; - /* Note that the speed should indicate the maximum rate that - * this MAC should support rather than the actual speed; - */ - u16 max_speed; /* A handle to the FM object this port related to */ void *fm; fman_mac_exception_cb *event_cb; /* MDIO Events Callback Routine */ fman_mac_exception_cb *exception_cb;/* Exception Callback Routine */ - /* SGMII/QSGII interface with 1000BaseX auto-negotiation between MAC - * and phy or backplane; Note: 1000BaseX auto-negotiation relates only - * to interface between MAC and phy/backplane, SGMII phy can still - * synchronize with far-end phy at 10Mbps, 100Mbps or 1000Mbps - */ - bool basex_if; }; 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 2b274d50fafb..0abb1b037635 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -278,9 +278,6 @@ struct fman_mac { struct memac_regs __iomem *regs; /* MAC address of device */ u64 addr; - /* Ethernet physical interface */ - phy_interface_t phy_if; - u16 max_speed; struct mac_device *dev_id; /* device cookie used by the exception cbs */ fman_mac_exception_cb *exception_cb; fman_mac_exception_cb *event_cb; @@ -293,12 +290,12 @@ struct fman_mac { struct memac_cfg *memac_drv_param; void *fm; struct fman_rev_info fm_rev_info; - bool basex_if; struct phy *serdes; struct phylink_pcs *sgmii_pcs; struct phylink_pcs *qsgmii_pcs; struct phylink_pcs *xfi_pcs; bool allmulti_enabled; + bool rgmii_no_half_duplex; }; static void add_addr_in_paddr(struct memac_regs __iomem *regs, const u8 *adr, @@ -356,7 +353,6 @@ static void set_exception(struct memac_regs __iomem *regs, u32 val, } static int init(struct memac_regs __iomem *regs, struct memac_cfg *cfg, - phy_interface_t phy_if, u16 speed, bool slow_10g_if, u32 exceptions) { u32 tmp; @@ -384,41 +380,6 @@ static int init(struct memac_regs __iomem *regs, struct memac_cfg *cfg, iowrite32be((u32)cfg->pause_quanta, ®s->pause_quanta[0]); iowrite32be((u32)0, ®s->pause_thresh[0]); - /* IF_MODE */ - tmp = 0; - switch (phy_if) { - case PHY_INTERFACE_MODE_XGMII: - tmp |= IF_MODE_10G; - break; - case PHY_INTERFACE_MODE_MII: - tmp |= IF_MODE_MII; - break; - default: - tmp |= IF_MODE_GMII; - if (phy_if == PHY_INTERFACE_MODE_RGMII || - phy_if == PHY_INTERFACE_MODE_RGMII_ID || - phy_if == PHY_INTERFACE_MODE_RGMII_RXID || - phy_if == PHY_INTERFACE_MODE_RGMII_TXID) - tmp |= IF_MODE_RGMII | IF_MODE_RGMII_AUTO; - } - iowrite32be(tmp, ®s->if_mode); - - /* TX_FIFO_SECTIONS */ - tmp = 0; - if (phy_if == PHY_INTERFACE_MODE_XGMII) { - if (slow_10g_if) { - tmp |= (TX_FIFO_SECTIONS_TX_AVAIL_SLOW_10G | - TX_FIFO_SECTIONS_TX_EMPTY_DEFAULT_10G); - } else { - tmp |= (TX_FIFO_SECTIONS_TX_AVAIL_10G | - TX_FIFO_SECTIONS_TX_EMPTY_DEFAULT_10G); - } - } else { - tmp |= (TX_FIFO_SECTIONS_TX_AVAIL_1G | - TX_FIFO_SECTIONS_TX_EMPTY_DEFAULT_1G); - } - iowrite32be(tmp, ®s->tx_fifo_sections); - /* clear all pending events and set-up interrupts */ iowrite32be(0xffffffff, ®s->ievent); set_exception(regs, exceptions, true); @@ -458,24 +419,6 @@ static u32 get_mac_addr_hash_code(u64 eth_addr) return xor_val; } -static void setup_sgmii_internal(struct fman_mac *memac, - struct phylink_pcs *pcs, - struct fixed_phy_status *fixed_link) -{ - __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising); - phy_interface_t iface = memac->basex_if ? PHY_INTERFACE_MODE_1000BASEX : - PHY_INTERFACE_MODE_SGMII; - unsigned int mode = fixed_link ? MLO_AN_FIXED : MLO_AN_INBAND; - - linkmode_set_pause(advertising, true, true); - pcs->ops->pcs_config(pcs, mode, iface, advertising, true); - if (fixed_link) - pcs->ops->pcs_link_up(pcs, mode, iface, fixed_link->speed, - fixed_link->duplex); - else - pcs->ops->pcs_an_restart(pcs); -} - static int check_init_parameters(struct fman_mac *memac) { if (!memac->exception_cb) { @@ -581,41 +524,31 @@ static void free_init_resources(struct fman_mac *memac) memac->unicast_addr_hash = NULL; } -static bool is_init_done(struct memac_cfg *memac_drv_params) -{ - /* Checks if mEMAC driver parameters were initialized */ - if (!memac_drv_params) - return true; - - return false; -} - static int memac_enable(struct fman_mac *memac) { - struct memac_regs __iomem *regs = memac->regs; - u32 tmp; + int ret; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; + ret = phy_init(memac->serdes); + if (ret) { + dev_err(memac->dev_id->dev, + "could not initialize serdes: %pe\n", ERR_PTR(ret)); + return ret; + } - tmp = ioread32be(®s->command_config); - tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN; - iowrite32be(tmp, ®s->command_config); + ret = phy_power_on(memac->serdes); + if (ret) { + dev_err(memac->dev_id->dev, + "could not power on serdes: %pe\n", ERR_PTR(ret)); + phy_exit(memac->serdes); + } - return 0; + return ret; } static void memac_disable(struct fman_mac *memac) - { - struct memac_regs __iomem *regs = memac->regs; - u32 tmp; - - WARN_ON_ONCE(!is_init_done(memac->memac_drv_param)); - - tmp = ioread32be(®s->command_config); - tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); - iowrite32be(tmp, ®s->command_config); + phy_power_off(memac->serdes); + phy_exit(memac->serdes); } static int memac_set_promiscuous(struct fman_mac *memac, bool new_val) @@ -623,9 +556,6 @@ static int memac_set_promiscuous(struct fman_mac *memac, bool new_val) struct memac_regs __iomem *regs = memac->regs; u32 tmp; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - tmp = ioread32be(®s->command_config); if (new_val) tmp |= CMD_CFG_PROMIS_EN; @@ -637,73 +567,12 @@ static int memac_set_promiscuous(struct fman_mac *memac, bool new_val) return 0; } -static int memac_adjust_link(struct fman_mac *memac, u16 speed) -{ - struct memac_regs __iomem *regs = memac->regs; - u32 tmp; - - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - - tmp = ioread32be(®s->if_mode); - - /* Set full duplex */ - tmp &= ~IF_MODE_HD; - - if (phy_interface_mode_is_rgmii(memac->phy_if)) { - /* Configure RGMII in manual mode */ - tmp &= ~IF_MODE_RGMII_AUTO; - tmp &= ~IF_MODE_RGMII_SP_MASK; - /* Full duplex */ - tmp |= IF_MODE_RGMII_FD; - - switch (speed) { - case SPEED_1000: - tmp |= IF_MODE_RGMII_1000; - break; - case SPEED_100: - tmp |= IF_MODE_RGMII_100; - break; - case SPEED_10: - tmp |= IF_MODE_RGMII_10; - break; - default: - break; - } - } - - iowrite32be(tmp, ®s->if_mode); - - return 0; -} - -static void adjust_link_memac(struct mac_device *mac_dev) -{ - struct phy_device *phy_dev = mac_dev->phy_dev; - struct fman_mac *fman_mac; - bool rx_pause, tx_pause; - int err; - - fman_mac = mac_dev->fman_mac; - memac_adjust_link(fman_mac, phy_dev->speed); - mac_dev->update_speed(mac_dev, phy_dev->speed); - - fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); - err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); - if (err < 0) - dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", - err); -} - static int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, u16 pause_time, u16 thresh_time) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - tmp = ioread32be(®s->tx_fifo_sections); GET_TX_EMPTY_DEFAULT_VALUE(tmp); @@ -738,9 +607,6 @@ static int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en) struct memac_regs __iomem *regs = memac->regs; u32 tmp; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - tmp = ioread32be(®s->command_config); if (en) tmp &= ~CMD_CFG_PAUSE_IGNORE; @@ -752,12 +618,179 @@ static int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en) return 0; } +static void memac_validate(struct phylink_config *config, + unsigned long *supported, + struct phylink_link_state *state) +{ + __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; + struct fman_mac *memac = fman_config_to_mac(config)->fman_mac; + + phylink_generic_validate(config, supported, state); + + if (phy_interface_mode_is_rgmii(state->interface) && + memac->rgmii_no_half_duplex) { + phylink_get_linkmodes(mask, state->interface, + MAC_10HD | MAC_100HD); + linkmode_andnot(supported, supported, mask); + linkmode_andnot(state->advertising, state->advertising, mask); + } +} + +/** + * memac_if_mode() - Convert an interface mode into an IF_MODE config + * @interface: A phy interface mode + * + * Return: A configuration word, suitable for programming into the lower bits + * of %IF_MODE. + */ +static u32 memac_if_mode(phy_interface_t interface) +{ + switch (interface) { + case PHY_INTERFACE_MODE_MII: + return IF_MODE_MII; + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + return IF_MODE_GMII | IF_MODE_RGMII; + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_QSGMII: + return IF_MODE_GMII; + case PHY_INTERFACE_MODE_10GBASER: + return IF_MODE_10G; + default: + WARN_ON_ONCE(1); + return 0; + } +} + +static struct phylink_pcs *memac_select_pcs(struct phylink_config *config, + phy_interface_t iface) +{ + struct fman_mac *memac = fman_config_to_mac(config)->fman_mac; + + switch (iface) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + return memac->sgmii_pcs; + case PHY_INTERFACE_MODE_QSGMII: + return memac->qsgmii_pcs; + case PHY_INTERFACE_MODE_10GBASER: + return memac->xfi_pcs; + default: + return NULL; + } +} + +static int memac_prepare(struct phylink_config *config, unsigned int mode, + phy_interface_t iface) +{ + struct fman_mac *memac = fman_config_to_mac(config)->fman_mac; + + switch (iface) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_QSGMII: + case PHY_INTERFACE_MODE_10GBASER: + return phy_set_mode_ext(memac->serdes, PHY_MODE_ETHERNET, + iface); + default: + return 0; + } +} + +static void memac_mac_config(struct phylink_config *config, unsigned int mode, + const struct phylink_link_state *state) +{ + struct mac_device *mac_dev = fman_config_to_mac(config); + struct memac_regs __iomem *regs = mac_dev->fman_mac->regs; + u32 tmp = ioread32be(®s->if_mode); + + tmp &= ~(IF_MODE_MASK | IF_MODE_RGMII); + tmp |= memac_if_mode(state->interface); + if (phylink_autoneg_inband(mode)) + tmp |= IF_MODE_RGMII_AUTO; + iowrite32be(tmp, ®s->if_mode); +} + +static void memac_link_up(struct phylink_config *config, struct phy_device *phy, + unsigned int mode, phy_interface_t interface, + int speed, int duplex, bool tx_pause, bool rx_pause) +{ + struct mac_device *mac_dev = fman_config_to_mac(config); + struct fman_mac *memac = mac_dev->fman_mac; + struct memac_regs __iomem *regs = memac->regs; + u32 tmp = memac_if_mode(interface); + u16 pause_time = tx_pause ? FSL_FM_PAUSE_TIME_ENABLE : + FSL_FM_PAUSE_TIME_DISABLE; + + memac_set_tx_pause_frames(memac, 0, pause_time, 0); + memac_accept_rx_pause_frames(memac, rx_pause); + + if (duplex == DUPLEX_HALF) + tmp |= IF_MODE_HD; + + switch (speed) { + case SPEED_1000: + tmp |= IF_MODE_RGMII_1000; + break; + case SPEED_100: + tmp |= IF_MODE_RGMII_100; + break; + case SPEED_10: + tmp |= IF_MODE_RGMII_10; + break; + } + iowrite32be(tmp, ®s->if_mode); + + /* TODO: EEE? */ + + if (speed == SPEED_10000) { + if (memac->fm_rev_info.major == 6 && + memac->fm_rev_info.minor == 4) + tmp = TX_FIFO_SECTIONS_TX_AVAIL_SLOW_10G; + else + tmp = TX_FIFO_SECTIONS_TX_AVAIL_10G; + tmp |= TX_FIFO_SECTIONS_TX_EMPTY_DEFAULT_10G; + } else { + tmp = TX_FIFO_SECTIONS_TX_AVAIL_1G | + TX_FIFO_SECTIONS_TX_EMPTY_DEFAULT_1G; + } + iowrite32be(tmp, ®s->tx_fifo_sections); + + mac_dev->update_speed(mac_dev, speed); + + tmp = ioread32be(®s->command_config); + tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN; + iowrite32be(tmp, ®s->command_config); +} + +static void memac_link_down(struct phylink_config *config, unsigned int mode, + phy_interface_t interface) +{ + struct fman_mac *memac = fman_config_to_mac(config)->fman_mac; + struct memac_regs __iomem *regs = memac->regs; + u32 tmp; + + /* TODO: graceful */ + tmp = ioread32be(®s->command_config); + tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); + iowrite32be(tmp, ®s->command_config); +} + +static const struct phylink_mac_ops memac_mac_ops = { + .validate = memac_validate, + .mac_select_pcs = memac_select_pcs, + .mac_prepare = memac_prepare, + .mac_config = memac_mac_config, + .mac_link_up = memac_link_up, + .mac_link_down = memac_link_down, +}; + static int memac_modify_mac_address(struct fman_mac *memac, const enet_addr_t *enet_addr) { - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - add_addr_in_paddr(memac->regs, (const u8 *)(*enet_addr), 0); return 0; @@ -771,9 +804,6 @@ static int memac_add_hash_mac_address(struct fman_mac *memac, u32 hash; u64 addr; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - addr = ENET_ADDR_TO_UINT64(*eth_addr); if (!(addr & GROUP_ADDRESS)) { @@ -802,9 +832,6 @@ static int memac_set_allmulti(struct fman_mac *memac, bool enable) u32 entry; struct memac_regs __iomem *regs = memac->regs; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - if (enable) { for (entry = 0; entry < HASH_TABLE_SIZE; entry++) iowrite32be(entry | HASH_CTRL_MCAST_EN, @@ -834,9 +861,6 @@ static int memac_del_hash_mac_address(struct fman_mac *memac, u32 hash; u64 addr; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - addr = ENET_ADDR_TO_UINT64(*eth_addr); hash = get_mac_addr_hash_code(addr) & HASH_CTRL_ADDR_MASK; @@ -864,9 +888,6 @@ static int memac_set_exception(struct fman_mac *memac, { u32 bit_mask = 0; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - bit_mask = get_exception_flag(exception); if (bit_mask) { if (enable) @@ -886,23 +907,15 @@ static int memac_init(struct fman_mac *memac) { struct memac_cfg *memac_drv_param; enet_addr_t eth_addr; - bool slow_10g_if = false; - struct fixed_phy_status *fixed_link; int err; u32 reg32 = 0; - if (is_init_done(memac->memac_drv_param)) - return -EINVAL; - err = check_init_parameters(memac); if (err) return err; memac_drv_param = memac->memac_drv_param; - if (memac->fm_rev_info.major == 6 && memac->fm_rev_info.minor == 4) - slow_10g_if = true; - /* First, reset the MAC if desired. */ if (memac_drv_param->reset_on_init) { err = reset(memac->regs); @@ -918,10 +931,7 @@ static int memac_init(struct fman_mac *memac) add_addr_in_paddr(memac->regs, (const u8 *)eth_addr, 0); } - fixed_link = memac_drv_param->fixed_link; - - init(memac->regs, memac->memac_drv_param, memac->phy_if, - memac->max_speed, slow_10g_if, memac->exceptions); + init(memac->regs, memac->memac_drv_param, memac->exceptions); /* FM_RX_FIFO_CORRUPT_ERRATA_10GMAC_A006320 errata workaround * Exists only in FMan 6.0 and 6.3. @@ -937,11 +947,6 @@ static int memac_init(struct fman_mac *memac) iowrite32be(reg32, &memac->regs->command_config); } - if (memac->phy_if == PHY_INTERFACE_MODE_SGMII) - setup_sgmii_internal(memac, memac->sgmii_pcs, fixed_link); - else if (memac->phy_if == PHY_INTERFACE_MODE_QSGMII) - setup_sgmii_internal(memac, memac->qsgmii_pcs, fixed_link); - /* Max Frame Length */ err = fman_set_mac_max_frame(memac->fm, memac->mac_id, memac_drv_param->max_frame_length); @@ -970,23 +975,24 @@ static int memac_init(struct fman_mac *memac) fman_register_intr(memac->fm, FMAN_MOD_MAC, memac->mac_id, FMAN_INTR_TYPE_NORMAL, memac_exception, memac); - kfree(memac_drv_param); - memac->memac_drv_param = NULL; - return 0; } +static void pcs_free(struct phylink_pcs *pcs) +{ + if (!IS_ERR_OR_NULL(pcs)) { + put_device(&lynx_get_mdio_device(pcs)->dev); + lynx_pcs_destroy(pcs); + } +} + static int memac_free(struct fman_mac *memac) { free_init_resources(memac); - if (memac->sgmii_pcs) - lynx_pcs_destroy(memac->sgmii_pcs); - if (memac->qsgmii_pcs) - lynx_pcs_destroy(memac->qsgmii_pcs); - if (memac->xfi_pcs) - lynx_pcs_destroy(memac->xfi_pcs); - + pcs_free(memac->sgmii_pcs); + pcs_free(memac->qsgmii_pcs); + pcs_free(memac->xfi_pcs); kfree(memac->memac_drv_param); kfree(memac); @@ -1019,8 +1025,6 @@ static struct fman_mac *memac_config(struct mac_device *mac_dev, memac->addr = ENET_ADDR_TO_UINT64(mac_dev->addr); memac->regs = mac_dev->vaddr; - memac->max_speed = params->max_speed; - memac->phy_if = mac_dev->phy_if; memac->mac_id = params->mac_id; memac->exceptions = (MEMAC_IMASK_TSECC_ER | MEMAC_IMASK_TECC_ER | MEMAC_IMASK_RECC_ER | MEMAC_IMASK_MGI); @@ -1028,7 +1032,6 @@ static struct fman_mac *memac_config(struct mac_device *mac_dev, memac->event_cb = params->event_cb; memac->dev_id = mac_dev; memac->fm = params->fm; - memac->basex_if = params->basex_if; /* Save FMan revision */ fman_get_revision(memac->fm, &memac->fm_rev_info); @@ -1053,32 +1056,41 @@ static struct phylink_pcs *memac_pcs_create(struct device_node *mac_node, return lynx_pcs_create(mdiodev) ?: ERR_PTR(-ENOMEM); } +static bool memac_supports(struct mac_device *mac_dev, phy_interface_t iface) +{ + /* If there's no serdes device, assume that it's been configured for + * whatever the default interface mode is. + */ + if (!mac_dev->fman_mac->serdes) + return mac_dev->phy_if == iface; + /* Otherwise, ask the serdes */ + return !phy_validate(mac_dev->fman_mac->serdes, PHY_MODE_ETHERNET, + iface, NULL); +} + int memac_initialization(struct mac_device *mac_dev, struct device_node *mac_node, struct fman_mac_params *params) { int err; + struct device_node *fixed; struct phylink_pcs *pcs; - struct fixed_phy_status *fixed_link; struct fman_mac *memac; + unsigned long capabilities; + unsigned long *supported; + mac_dev->phylink_ops = &memac_mac_ops; mac_dev->set_promisc = memac_set_promiscuous; mac_dev->change_addr = memac_modify_mac_address; mac_dev->add_hash_mac_addr = memac_add_hash_mac_address; mac_dev->remove_hash_mac_addr = memac_del_hash_mac_address; - mac_dev->set_tx_pause = memac_set_tx_pause_frames; - mac_dev->set_rx_pause = memac_accept_rx_pause_frames; mac_dev->set_exception = memac_set_exception; mac_dev->set_allmulti = memac_set_allmulti; mac_dev->set_tstamp = memac_set_tstamp; mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = adjust_link_memac; mac_dev->enable = memac_enable; mac_dev->disable = memac_disable; - if (params->max_speed == SPEED_10000) - mac_dev->phy_if = PHY_INTERFACE_MODE_XGMII; - mac_dev->fman_mac = memac_config(mac_dev, params); if (!mac_dev->fman_mac) { err = -EINVAL; @@ -1124,9 +1136,9 @@ int memac_initialization(struct mac_device *mac_dev, else pcs = memac_pcs_create(mac_node, err); - if (!pcs) { - dev_err(mac_dev->dev, "missing pcs\n"); - err = -ENOENT; + if (IS_ERR(pcs)) { + err = PTR_ERR(pcs); + dev_err_probe(mac_dev->dev, err, "missing pcs\n"); goto _return_fm_mac_free; } @@ -1146,82 +1158,115 @@ int memac_initialization(struct mac_device *mac_dev, err = PTR_ERR(memac->serdes); dev_err_probe(mac_dev->dev, err, "could not get serdes\n"); goto _return_fm_mac_free; + } + + /* The internal connection to the serdes is XGMII, but this isn't + * really correct for the phy mode (which is the external connection). + * However, this is how all older device trees say that they want + * 10GBase-R (aka XFI), so just convert it for them. + */ + if (mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII) + mac_dev->phy_if = PHY_INTERFACE_MODE_10GBASER; + + /* TODO: The following interface modes are supported by (some) hardware + * but not by this driver: + * - 1000Base-KX + * - 10GBase-KR + * - XAUI/HiGig + */ + supported = mac_dev->phylink_config.supported_interfaces; + + /* Note that half duplex is only supported on 10/100M interfaces. */ + + if (memac->sgmii_pcs && + (memac_supports(mac_dev, PHY_INTERFACE_MODE_SGMII) || + memac_supports(mac_dev, PHY_INTERFACE_MODE_1000BASEX))) { + __set_bit(PHY_INTERFACE_MODE_SGMII, supported); + __set_bit(PHY_INTERFACE_MODE_1000BASEX, supported); + } + + if (memac->sgmii_pcs && + memac_supports(mac_dev, PHY_INTERFACE_MODE_2500BASEX)) + __set_bit(PHY_INTERFACE_MODE_2500BASEX, supported); + + if (memac->qsgmii_pcs && + memac_supports(mac_dev, PHY_INTERFACE_MODE_QSGMII)) + __set_bit(PHY_INTERFACE_MODE_QSGMII, supported); + else if (mac_dev->phy_if == PHY_INTERFACE_MODE_QSGMII) + dev_warn(mac_dev->dev, "no QSGMII pcs specified\n"); + + if (memac->xfi_pcs && + memac_supports(mac_dev, PHY_INTERFACE_MODE_10GBASER)) { + __set_bit(PHY_INTERFACE_MODE_10GBASER, supported); } else { - err = phy_init(memac->serdes); - if (err) { - dev_err_probe(mac_dev->dev, err, - "could not initialize serdes\n"); + /* From what I can tell, only 1G macs support RGMII. */ + /* For compatibility, default to enabled if the rgmii property + * is absent + */ + unsigned int rgmii = 1; + + err = of_property_read_u32(mac_node, "rgmii", &rgmii); + if (err == -EINVAL) + dev_warn(mac_dev->dev, + "missing 'rgmii' property; assuming supported\n"); + else if (err) goto _return_fm_mac_free; - } - err = phy_power_on(memac->serdes); - if (err) { - dev_err_probe(mac_dev->dev, err, - "could not power on serdes\n"); - goto _return_phy_exit; - } + if (rgmii) { + phy_interface_set_rgmii(supported); - if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || - memac->phy_if == PHY_INTERFACE_MODE_1000BASEX || - memac->phy_if == PHY_INTERFACE_MODE_2500BASEX || - memac->phy_if == PHY_INTERFACE_MODE_QSGMII || - memac->phy_if == PHY_INTERFACE_MODE_XGMII) { - err = phy_set_mode_ext(memac->serdes, PHY_MODE_ETHERNET, - memac->phy_if); - if (err) { - dev_err_probe(mac_dev->dev, err, - "could not set serdes mode to %s\n", - phy_modes(memac->phy_if)); - goto _return_phy_power_off; - } + if (of_property_read_bool(mac_node, "mii")) + __set_bit(PHY_INTERFACE_MODE_MII, supported); } } - if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { - struct phy_device *phy; - - err = of_phy_register_fixed_link(mac_node); - if (err) - goto _return_phy_power_off; - - fixed_link = kzalloc(sizeof(*fixed_link), GFP_KERNEL); - if (!fixed_link) { - err = -ENOMEM; - goto _return_phy_power_off; - } - - mac_dev->phy_node = of_node_get(mac_node); - phy = of_phy_find_device(mac_dev->phy_node); - if (!phy) { - err = -EINVAL; - of_node_put(mac_dev->phy_node); - goto _return_fixed_link_free; - } - - fixed_link->link = phy->link; - fixed_link->speed = phy->speed; - fixed_link->duplex = phy->duplex; - fixed_link->pause = phy->pause; - fixed_link->asym_pause = phy->asym_pause; - - put_device(&phy->mdio.dev); - memac->memac_drv_param->fixed_link = fixed_link; - } + capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE; + capabilities |= MAC_10 | MAC_100 | MAC_1000FD | MAC_2500FD | MAC_10000FD; + + /* These SoCs don't support half duplex at all; there's no different + * FMan version or compatible, so we just have to check the machine + * compatible instead + */ + if (of_machine_is_compatible("fsl,ls1043a") || + of_machine_is_compatible("fsl,ls1046a") || + of_machine_is_compatible("fsl,B4QDS")) + capabilities &= ~(MAC_10HD | MAC_100HD); + + mac_dev->phylink_config.mac_capabilities = capabilities; + + /* The T2080 and T4240 don't support half duplex RGMII. There is no + * other way to identify these SoCs, so just use the machine + * compatible. + */ + if (of_machine_is_compatible("fsl,T2080QDS") || + of_machine_is_compatible("fsl,T2080RDB") || + of_machine_is_compatible("fsl,T2081QDS") || + of_machine_is_compatible("fsl,T4240QDS") || + of_machine_is_compatible("fsl,T4240RDB")) + memac->rgmii_no_half_duplex = true; + + /* Most boards should use MLO_AN_INBAND, but existing boards don't have + * a managed property. Default to MLO_AN_INBAND if nothing else is + * specified. We need to be careful and not enable this if we have a + * fixed link or if we are using MII or RGMII, since those + * configurations modes don't use in-band autonegotiation. + */ + fixed = of_get_child_by_name(mac_node, "fixed-link"); + if (!fixed && !of_property_read_bool(mac_node, "fixed-link") && + !of_property_read_bool(mac_node, "managed") && + mac_dev->phy_if != PHY_INTERFACE_MODE_MII && + !phy_interface_mode_is_rgmii(mac_dev->phy_if)) + mac_dev->phylink_config.ovr_an_inband = true; + of_node_put(fixed); err = memac_init(mac_dev->fman_mac); if (err < 0) - goto _return_fixed_link_free; + goto _return_fm_mac_free; dev_info(mac_dev->dev, "FMan MEMAC\n"); goto _return; -_return_phy_power_off: - phy_power_off(memac->serdes); -_return_phy_exit: - phy_exit(memac->serdes); -_return_fixed_link_free: - kfree(fixed_link); _return_fm_mac_free: memac_free(mac_dev->fman_mac); _return: diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 33f3b1cc2cfe..00a8c65cdd56 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -13,6 +13,7 @@ #include #include #include +#include /* Transmit Inter-Packet Gap Length Register (TX_IPG_LENGTH) */ #define TGEC_TX_IPG_LENGTH_MASK 0x000003ff @@ -243,10 +244,6 @@ static int init(struct tgec_regs __iomem *regs, struct tgec_cfg *cfg, static int check_init_parameters(struct fman_mac *tgec) { - if (tgec->max_speed < SPEED_10000) { - pr_err("10G MAC driver only support 10G speed\n"); - return -EINVAL; - } if (!tgec->exception_cb) { pr_err("uninitialized exception_cb\n"); return -EINVAL; @@ -384,40 +381,13 @@ static void free_init_resources(struct fman_mac *tgec) tgec->unicast_addr_hash = NULL; } -static bool is_init_done(struct tgec_cfg *cfg) -{ - /* Checks if tGEC driver parameters were initialized */ - if (!cfg) - return true; - - return false; -} - static int tgec_enable(struct fman_mac *tgec) { - struct tgec_regs __iomem *regs = tgec->regs; - u32 tmp; - - if (!is_init_done(tgec->cfg)) - return -EINVAL; - - tmp = ioread32be(®s->command_config); - tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN; - iowrite32be(tmp, ®s->command_config); - return 0; } static void tgec_disable(struct fman_mac *tgec) { - struct tgec_regs __iomem *regs = tgec->regs; - u32 tmp; - - WARN_ON_ONCE(!is_init_done(tgec->cfg)); - - tmp = ioread32be(®s->command_config); - tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); - iowrite32be(tmp, ®s->command_config); } static int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) @@ -425,9 +395,6 @@ static int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - tmp = ioread32be(®s->command_config); if (new_val) tmp |= CMD_CFG_PROMIS_EN; @@ -444,9 +411,6 @@ static int tgec_set_tx_pause_frames(struct fman_mac *tgec, { struct tgec_regs __iomem *regs = tgec->regs; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - iowrite32be((u32)pause_time, ®s->pause_quant); return 0; @@ -457,9 +421,6 @@ static int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en) struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - tmp = ioread32be(®s->command_config); if (!en) tmp |= CMD_CFG_PAUSE_IGNORE; @@ -470,12 +431,53 @@ static int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en) return 0; } +static void tgec_mac_config(struct phylink_config *config, unsigned int mode, + const struct phylink_link_state *state) +{ +} + +static void tgec_link_up(struct phylink_config *config, struct phy_device *phy, + unsigned int mode, phy_interface_t interface, + int speed, int duplex, bool tx_pause, bool rx_pause) +{ + struct mac_device *mac_dev = fman_config_to_mac(config); + struct fman_mac *tgec = mac_dev->fman_mac; + struct tgec_regs __iomem *regs = tgec->regs; + u16 pause_time = tx_pause ? FSL_FM_PAUSE_TIME_ENABLE : + FSL_FM_PAUSE_TIME_DISABLE; + u32 tmp; + + tgec_set_tx_pause_frames(tgec, 0, pause_time, 0); + tgec_accept_rx_pause_frames(tgec, rx_pause); + mac_dev->update_speed(mac_dev, speed); + + tmp = ioread32be(®s->command_config); + tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN; + iowrite32be(tmp, ®s->command_config); +} + +static void tgec_link_down(struct phylink_config *config, unsigned int mode, + phy_interface_t interface) +{ + struct fman_mac *tgec = fman_config_to_mac(config)->fman_mac; + struct tgec_regs __iomem *regs = tgec->regs; + u32 tmp; + + tmp = ioread32be(®s->command_config); + tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); + iowrite32be(tmp, ®s->command_config); +} + +static const struct phylink_mac_ops tgec_mac_ops = { + .validate = phylink_generic_validate, + .mac_config = tgec_mac_config, + .mac_link_up = tgec_link_up, + .mac_link_down = tgec_link_down, +}; + static int tgec_modify_mac_address(struct fman_mac *tgec, const enet_addr_t *p_enet_addr) { - if (!is_init_done(tgec->cfg)) - return -EINVAL; - tgec->addr = ENET_ADDR_TO_UINT64(*p_enet_addr); set_mac_address(tgec->regs, (const u8 *)(*p_enet_addr)); @@ -490,9 +492,6 @@ static int tgec_add_hash_mac_address(struct fman_mac *tgec, u32 crc = 0xFFFFFFFF, hash; u64 addr; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - addr = ENET_ADDR_TO_UINT64(*eth_addr); if (!(addr & GROUP_ADDRESS)) { @@ -525,9 +524,6 @@ static int tgec_set_allmulti(struct fman_mac *tgec, bool enable) u32 entry; struct tgec_regs __iomem *regs = tgec->regs; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - if (enable) { for (entry = 0; entry < TGEC_HASH_TABLE_SIZE; entry++) iowrite32be(entry | TGEC_HASH_MCAST_EN, @@ -548,9 +544,6 @@ static int tgec_set_tstamp(struct fman_mac *tgec, bool enable) struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - tmp = ioread32be(®s->command_config); if (enable) @@ -572,9 +565,6 @@ static int tgec_del_hash_mac_address(struct fman_mac *tgec, u32 crc = 0xFFFFFFFF, hash; u64 addr; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - addr = ((*(u64 *)eth_addr) >> 16); /* CRC calculation */ @@ -601,22 +591,12 @@ static int tgec_del_hash_mac_address(struct fman_mac *tgec, return 0; } -static void tgec_adjust_link(struct mac_device *mac_dev) -{ - struct phy_device *phy_dev = mac_dev->phy_dev; - - mac_dev->update_speed(mac_dev, phy_dev->speed); -} - static int tgec_set_exception(struct fman_mac *tgec, enum fman_mac_exceptions exception, bool enable) { struct tgec_regs __iomem *regs = tgec->regs; u32 bit_mask = 0; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - bit_mask = get_exception_flag(exception); if (bit_mask) { if (enable) @@ -641,9 +621,6 @@ static int tgec_init(struct fman_mac *tgec) enet_addr_t eth_addr; int err; - if (is_init_done(tgec->cfg)) - return -EINVAL; - if (DEFAULT_RESET_ON_INIT && (fman_reset_mac(tgec->fm, tgec->mac_id) != 0)) { pr_err("Can't reset MAC!\n"); @@ -752,7 +729,6 @@ static struct fman_mac *tgec_config(struct mac_device *mac_dev, struct fman_mac_ tgec->regs = mac_dev->vaddr; tgec->addr = ENET_ADDR_TO_UINT64(mac_dev->addr); - tgec->max_speed = params->max_speed; tgec->mac_id = params->mac_id; tgec->exceptions = (TGEC_IMASK_MDIO_SCAN_EVENT | TGEC_IMASK_REM_FAULT | @@ -787,17 +763,15 @@ int tgec_initialization(struct mac_device *mac_dev, int err; struct fman_mac *tgec; + mac_dev->phylink_ops = &tgec_mac_ops; mac_dev->set_promisc = tgec_set_promiscuous; mac_dev->change_addr = tgec_modify_mac_address; mac_dev->add_hash_mac_addr = tgec_add_hash_mac_address; mac_dev->remove_hash_mac_addr = tgec_del_hash_mac_address; - mac_dev->set_tx_pause = tgec_set_tx_pause_frames; - mac_dev->set_rx_pause = tgec_accept_rx_pause_frames; mac_dev->set_exception = tgec_set_exception; mac_dev->set_allmulti = tgec_set_allmulti; mac_dev->set_tstamp = tgec_set_tstamp; mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = tgec_adjust_link; mac_dev->enable = tgec_enable; mac_dev->disable = tgec_disable; @@ -807,6 +781,19 @@ int tgec_initialization(struct mac_device *mac_dev, goto _return; } + /* The internal connection to the serdes is XGMII, but this isn't + * really correct for the phy mode (which is the external connection). + * However, this is how all older device trees say that they want + * XAUI, so just convert it for them. + */ + if (mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII) + mac_dev->phy_if = PHY_INTERFACE_MODE_XAUI; + + __set_bit(PHY_INTERFACE_MODE_XAUI, + mac_dev->phylink_config.supported_interfaces); + mac_dev->phylink_config.mac_capabilities = + MAC_SYM_PAUSE | MAC_ASYM_PAUSE | MAC_10000FD; + tgec = mac_dev->fman_mac; tgec->cfg->max_frame_length = fman_get_max_frm(); err = tgec_init(tgec); diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 7b7526fd7da3..2b0a30f69147 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -93,130 +94,8 @@ int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev) return 0; } -/** - * fman_set_mac_active_pause - * @mac_dev: A pointer to the MAC device - * @rx: Pause frame setting for RX - * @tx: Pause frame setting for TX - * - * Set the MAC RX/TX PAUSE frames settings - * - * Avoid redundant calls to FMD, if the MAC driver already contains the desired - * active PAUSE settings. Otherwise, the new active settings should be reflected - * in FMan. - * - * Return: 0 on success; Error code otherwise. - */ -int fman_set_mac_active_pause(struct mac_device *mac_dev, bool rx, bool tx) -{ - struct fman_mac *fman_mac = mac_dev->fman_mac; - int err = 0; - - if (rx != mac_dev->rx_pause_active) { - err = mac_dev->set_rx_pause(fman_mac, rx); - if (likely(err == 0)) - mac_dev->rx_pause_active = rx; - } - - if (tx != mac_dev->tx_pause_active) { - u16 pause_time = (tx ? FSL_FM_PAUSE_TIME_ENABLE : - FSL_FM_PAUSE_TIME_DISABLE); - - err = mac_dev->set_tx_pause(fman_mac, 0, pause_time, 0); - - if (likely(err == 0)) - mac_dev->tx_pause_active = tx; - } - - return err; -} -EXPORT_SYMBOL(fman_set_mac_active_pause); - -/** - * fman_get_pause_cfg - * @mac_dev: A pointer to the MAC device - * @rx_pause: Return value for RX setting - * @tx_pause: Return value for TX setting - * - * Determine the MAC RX/TX PAUSE frames settings based on PHY - * autonegotiation or values set by eththool. - * - * Return: Pointer to FMan device. - */ -void fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause, - bool *tx_pause) -{ - struct phy_device *phy_dev = mac_dev->phy_dev; - u16 lcl_adv, rmt_adv; - u8 flowctrl; - - *rx_pause = *tx_pause = false; - - if (!phy_dev->duplex) - return; - - /* If PAUSE autonegotiation is disabled, the TX/RX PAUSE settings - * are those set by ethtool. - */ - if (!mac_dev->autoneg_pause) { - *rx_pause = mac_dev->rx_pause_req; - *tx_pause = mac_dev->tx_pause_req; - return; - } - - /* Else if PAUSE autonegotiation is enabled, the TX/RX PAUSE - * settings depend on the result of the link negotiation. - */ - - /* get local capabilities */ - lcl_adv = linkmode_adv_to_lcl_adv_t(phy_dev->advertising); - - /* get link partner capabilities */ - rmt_adv = 0; - if (phy_dev->pause) - rmt_adv |= LPA_PAUSE_CAP; - if (phy_dev->asym_pause) - rmt_adv |= LPA_PAUSE_ASYM; - - /* Calculate TX/RX settings based on local and peer advertised - * symmetric/asymmetric PAUSE capabilities. - */ - flowctrl = mii_resolve_flowctrl_fdx(lcl_adv, rmt_adv); - if (flowctrl & FLOW_CTRL_RX) - *rx_pause = true; - if (flowctrl & FLOW_CTRL_TX) - *tx_pause = true; -} -EXPORT_SYMBOL(fman_get_pause_cfg); - -#define DTSEC_SUPPORTED \ - (SUPPORTED_10baseT_Half \ - | SUPPORTED_10baseT_Full \ - | SUPPORTED_100baseT_Half \ - | SUPPORTED_100baseT_Full \ - | SUPPORTED_Autoneg \ - | SUPPORTED_Pause \ - | SUPPORTED_Asym_Pause \ - | SUPPORTED_FIBRE \ - | SUPPORTED_MII) - static DEFINE_MUTEX(eth_lock); -static const u16 phy2speed[] = { - [PHY_INTERFACE_MODE_MII] = SPEED_100, - [PHY_INTERFACE_MODE_GMII] = SPEED_1000, - [PHY_INTERFACE_MODE_SGMII] = SPEED_1000, - [PHY_INTERFACE_MODE_TBI] = SPEED_1000, - [PHY_INTERFACE_MODE_RMII] = SPEED_100, - [PHY_INTERFACE_MODE_RGMII] = SPEED_1000, - [PHY_INTERFACE_MODE_RGMII_ID] = SPEED_1000, - [PHY_INTERFACE_MODE_RGMII_RXID] = SPEED_1000, - [PHY_INTERFACE_MODE_RGMII_TXID] = SPEED_1000, - [PHY_INTERFACE_MODE_RTBI] = SPEED_1000, - [PHY_INTERFACE_MODE_QSGMII] = SPEED_1000, - [PHY_INTERFACE_MODE_XGMII] = SPEED_10000 -}; - static struct platform_device *dpaa_eth_add_device(int fman_id, struct mac_device *mac_dev) { @@ -263,8 +142,8 @@ static struct platform_device *dpaa_eth_add_device(int fman_id, } static const struct of_device_id mac_match[] = { - { .compatible = "fsl,fman-dtsec", .data = dtsec_initialization }, - { .compatible = "fsl,fman-xgec", .data = tgec_initialization }, + { .compatible = "fsl,fman-dtsec", .data = dtsec_initialization }, + { .compatible = "fsl,fman-xgec", .data = tgec_initialization }, { .compatible = "fsl,fman-memac", .data = memac_initialization }, {} }; @@ -296,6 +175,7 @@ static int mac_probe(struct platform_device *_of_dev) priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; + platform_set_drvdata(_of_dev, mac_dev); /* Save private information */ mac_dev->priv = priv; @@ -424,57 +304,21 @@ static int mac_probe(struct platform_device *_of_dev) } mac_dev->phy_if = phy_if; - priv->speed = phy2speed[mac_dev->phy_if]; - params.max_speed = priv->speed; - mac_dev->if_support = DTSEC_SUPPORTED; - /* We don't support half-duplex in SGMII mode */ - if (mac_dev->phy_if == PHY_INTERFACE_MODE_SGMII) - mac_dev->if_support &= ~(SUPPORTED_10baseT_Half | - SUPPORTED_100baseT_Half); - - /* Gigabit support (no half-duplex) */ - if (params.max_speed == 1000) - mac_dev->if_support |= SUPPORTED_1000baseT_Full; - - /* The 10G interface only supports one mode */ - if (mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII) - mac_dev->if_support = SUPPORTED_10000baseT_Full; - - /* Get the rest of the PHY information */ - mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0); - - params.basex_if = false; params.mac_id = priv->cell_index; params.fm = (void *)priv->fman; params.exception_cb = mac_exception; params.event_cb = mac_exception; err = init(mac_dev, mac_node, ¶ms); - if (err < 0) { - dev_err(dev, "mac_dev->init() = %d\n", err); - of_node_put(mac_dev->phy_node); - return err; - } - - /* pause frame autonegotiation enabled */ - mac_dev->autoneg_pause = true; - - /* By intializing the values to false, force FMD to enable PAUSE frames - * on RX and TX - */ - mac_dev->rx_pause_req = true; - mac_dev->tx_pause_req = true; - mac_dev->rx_pause_active = false; - mac_dev->tx_pause_active = false; - err = fman_set_mac_active_pause(mac_dev, true, true); if (err < 0) - dev_err(dev, "fman_set_mac_active_pause() = %d\n", err); + return err; if (!is_zero_ether_addr(mac_dev->addr)) dev_info(dev, "FMan MAC address: %pM\n", mac_dev->addr); priv->eth_dev = dpaa_eth_add_device(fman_id, mac_dev); if (IS_ERR(priv->eth_dev)) { + err = PTR_ERR(priv->eth_dev); dev_err(dev, "failed to add Ethernet platform device for MAC %d\n", priv->cell_index); priv->eth_dev = NULL; diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index b95d384271bd..5bf03e1e279a 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "fman_port.h" @@ -24,32 +25,22 @@ struct mac_device { struct device *dev; u8 addr[ETH_ALEN]; struct fman_port *port[2]; - u32 if_support; - struct phy_device *phy_dev; + struct phylink *phylink; + struct phylink_config phylink_config; phy_interface_t phy_if; - struct device_node *phy_node; - struct net_device *net_dev; - bool autoneg_pause; - bool rx_pause_req; - bool tx_pause_req; - bool rx_pause_active; - bool tx_pause_active; bool promisc; bool allmulti; + const struct phylink_mac_ops *phylink_ops; int (*enable)(struct fman_mac *mac_dev); void (*disable)(struct fman_mac *mac_dev); - void (*adjust_link)(struct mac_device *mac_dev); int (*set_promisc)(struct fman_mac *mac_dev, bool enable); int (*change_addr)(struct fman_mac *mac_dev, const enet_addr_t *enet_addr); int (*set_allmulti)(struct fman_mac *mac_dev, bool enable); int (*set_tstamp)(struct fman_mac *mac_dev, bool enable); int (*set_multi)(struct net_device *net_dev, struct mac_device *mac_dev); - int (*set_rx_pause)(struct fman_mac *mac_dev, bool en); - int (*set_tx_pause)(struct fman_mac *mac_dev, u8 priority, - u16 pause_time, u16 thresh_time); int (*set_exception)(struct fman_mac *mac_dev, enum fman_mac_exceptions exception, bool enable); int (*add_hash_mac_addr)(struct fman_mac *mac_dev, @@ -63,6 +54,12 @@ struct mac_device { struct mac_priv_s *priv; }; +static inline struct mac_device +*fman_config_to_mac(struct phylink_config *config) +{ + return container_of(config, struct mac_device, phylink_config); +} + struct dpaa_eth_data { struct mac_device *mac_dev; int mac_hw_id; From patchwork Tue Jun 28 22:14: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: 12899107 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 F1D19C433EF for ; Tue, 28 Jun 2022 22:52:45 +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=qG3CMDx/D1W18Cs50mMWfZwpdNQiCQn6I1FEwjuYtXk=; b=KfmhwY1ztiYNoq 3D/Ph+3j0Osjmr8ApQ3Jj9jQDy50nqSier10pHQHA9wpbn3pjXyEtcZ0J3XnYaf1H3N2Dm9jc2Cxo 2EfuH/PXACHeJqwDHL5h7vzgb0AAnPw3no6L9JnY5y72vjCm+gHV4jka1MGxnmNObJ1kY2hQUves4 n0pgF48V//rqhlviGj1Ahrsibu77A3FZivujb2foz6XtUU2n98oWoi2d1fGYsnKp8k74lkhYqLaEW Jr2V4pM1+soX2l0s6IYtE2E6oBljTJ+gvz0bPwS6iSD7s1mRlTgkThCncQUUtT4ntGxfCvo3bT7mU fHm/pFrNlFbW9t5aCJ0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6K31-008Wc1-LL; Tue, 28 Jun 2022 22:51:10 +0000 Received: from mail-eopbgr50060.outbound.protection.outlook.com ([40.107.5.60] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUl-008N2v-Kn for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y3HH6Dq6w1LNx2uM1AEBCzdLIM2Y9N3vPytv/mihs2gJcgn870SHka1KaiKPjZGHIcjC6tgnVoU7MTc3IQKA5xKevhtE2nKWgy0qK018voiD8JEND5UiMK9uZNGvuIFGo1unehAVwVTn26AuTGFUS09Sayf70jHBIjX+Ol9v70yrQ9ChmzGqguvsH21EwUwAp5chHMu/4H6gnJ7H8wWh7YT+82wyJNVJo9YKyYcv8XsUm/TORw1V674yMGbIb2bRtAeMcrQ55xkzV1VwgLRBuHLRBOAT1fqXdtjzfojxzAEUr54Jd9pTz8qLr2adpFxGaa99f8JoJBfgVeeMkw2iYg== 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=PcuUzxjM6Ktl104Z1vNFaPuXxflg9iQleOwtKYSqx4A=; b=Eqy3T67LHyJv94D/6gEL02WfaSqPZBQgBZgAgU7hPwABcNqPd5dUb2NNp28RNyjmV1S5qF60djYxFgzVFkD85NDfNmTeYfPGuox5muFm236o8fdSHc820jpOuw8d7A6tGD9CBIyzU4qEOQheTKrvOHXNsKEh1HL87HyelhmyJGV/oTWmt13cXyIXeocDADcKFR3jseZtVN4POxhvS+l/Ts5YhvejllKNjgwGn4iSdnMXJQTCqVHTzTXaCGK/aWGZKKV9EtpU9Xa8T0QwwPgKCkFWX6T7sOHe2ou/wlZwKNcIExVyvfmd/C0XuaxzjxbcMlDwRT07T7sqzEG2QK3nHQ== 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=PcuUzxjM6Ktl104Z1vNFaPuXxflg9iQleOwtKYSqx4A=; b=jPEIBDMiQCTRhtHpFFa6maWdh5qnDFdUtDTb+1viD7duSVx8qbniXgjyxJjZ456iaIHfUAsvKHqzeShUV8EqesV6lHH7H4VxBGTraCX+C12qFVHUHVSPOdkLv+u0kpbEhEmY7cR1VdOy5u6UlMR3qy7syrwbcAwhx6VjXuAi9LltkZwapLvvhqpT4E+iZea8DgxcNiTo8RKIX4aFOx3m8GjvIGwrvp+ggvYa36pymZkb/VJpFsbDfTa5wz2kvLbuZlzT6D0PtDvCU11p9egK6sGj0l2AtkErwtYnMw8tbatD2hquyuHjhU5EImtdWdPpK6OBzZTbNAIPgid8sp3tSw== 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 DB7PR03MB3883.eurprd03.prod.outlook.com (2603:10a6:5:34::12) 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:15:36 +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:15:36 +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 , Benjamin Herrenschmidt , Krzysztof Kozlowski , Li Yang , Michael Ellerman , Paul Mackerras , Rob Herring , Shawn Guo , devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH net-next v2 32/35] qoriq: Specify which MACs support RGMII Date: Tue, 28 Jun 2022 18:14:01 -0400 Message-Id: <20220628221404.1444200-33-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: c5572a4d-d4c9-4f70-95a0-08da5953a9d9 X-MS-TrafficTypeDiagnostic: DB7PR03MB3883:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HGDUT3vul2ZSKNTJJAl+QaSRq9PV6s7GIe+GnaM2YoEfkfad97fGtiqm4vEOKN8bnNJXKSxV4Cb7AhwN1c7+1AOsL5ICtlGpjjeGcF6ZKSlBXEVpzBQSnJ6Wd8YODW1oeQwcfewFLtPGx5NlL08t1fp38PZ58HYgZ0JbQuEgbQ/JDbbW69VwuwW+BuUcor1w5v9NRVg2BT9wAqG1lAvThVqqnJSMvwLROm3nxvms6j8ShG1o0ZNYvkdjSmVFzaKf9/aVidKBa1PvJWq8UPYi6s9QWThKUyMkFRTPCD3L9SDvCsWbVaAuFZnq7HRRgoVc2Z+NhjMdSdfFiEEKv5fgV1ySiooqmKO0cDTTkeqhlnBNZfx3qMtDADzHnLDznaIdXHlvalf2TinYgGn6E4T85Zbfs41HjlCEhDA3L4RxbiPvk1/e5RmLHL6NjoU9YYTZU8IL97OxjJGOMzad4nPgbUdnVkbWg3Y5PrALJe0ICFyDJ2itIXtlD900c9cr57GkUknj2QY3gAt/Ku/eoeaheUHijA4vro/eyWT955ed4kR5LRvsn4x/sQRevL34c6XTb8/tO0s0zlMzNFIgvbr5Mw2oEZpJ9Rww4XspsFR8LAAp9k32vimvfwy8iFi0458JOroJcax7pY1loL79sTyskG7vlHU2pQa4RqyyEn63+/FCUaoDFLtxbzmVojx9RcAIkFJ12WoGGOM4hC2FjBur4DC/ikykVbXoWunmIc8C5M27cWYFzCE1MyHo9GaAShvgZZESwTtR4T7pgm86wEuWWo3Pv6XF06RrJrSRrJdArEI= 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)(346002)(396003)(366004)(39850400004)(136003)(376002)(52116002)(6512007)(6506007)(8676002)(38100700002)(36756003)(66556008)(66946007)(38350700002)(66476007)(2906002)(26005)(1076003)(7416002)(86362001)(54906003)(41300700001)(83380400001)(2616005)(6486002)(110136005)(316002)(6666004)(186003)(4326008)(44832011)(5660300002)(478600001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R0TXCoG7fHTaN4qwQT5gFVbak6pVtCbmXuB69VuIKyxFW9D1VrbE0FHvzZrdHmUyHme5fsdsF2w85e2Va9f8CtYsJYh4OwS2B9QFPP685SYmRlPEhhE/gR/KHIykVMtFEWQI/kXLItT7PKEE72TmAMH5iXX9ZDVylHn8KePOuf9dEUAJmRM3XUDOl2YsgX3gTpErGXvhUjRxJBcrJVTTp63on9PUJtoUo9n3VxjN8kP8kG9BQDd4abZqzw8ei3Nr+mhlGSGMRrioWJ730CG1C96GoAy7KithWXUlYvSl4VT54NRz8UcU2Nung0PmicwlLHTcqmmsaS8UO+bNoXTxCAkSjvrInFkWXpgtmOXwTG5Stby6dCG7Cehft+LeXAEOhADrIfix0oJmu53IknFRk9va/MO4UAybeE40mkjKZs5wPZJX9zHTbSaLC8lDLy5n+0N+O2CeOKHInFZXuKyXq+P7bdiRhxYHKG4pQ3ZyGfdSqGl8H0oO64JN4B7Umc8cVhVSONOv2ijP4M+sQ0P802EvreatzTYgludMSnGF3QgMR7xEvJwinnkB/dNm6w6TyZIs3EdCjfnuxxjnVNnK4wrkCq/4MlLdhzFI6bLZHZkblc6xGOlpQ/nXaEvdS5vXxsyzT5QtPz8e3BMt30qmXOnovyL4RRn0pFpHsy2Zk+6HdlMVzL9s9/KW8KFkg2xOJRLqNkN4jDO64OZt7GV/8GXLcCYtFP7UUa055zh+42HB65ESdbxixKflIGmaQA8KEM2CBVJ5QiEoCrbSV3oMB1wifla9LpiU9Z8Gl3Yk3/Ofm+wTITWXeWkCwD110jvMKw3cu/GL+u1JwCZb6K/xW2vl/OaviNNr+92jb7sPk3dt/4sVShFZuhnA6a6Xr8uV5XLzr+f0MnHQ8Ao//Qrp+hCdETOKo+PtYTTBf3wAARdWgXyvjhNBIU0DA4eyWKG3UPfSIe+lcXxGEBprrEmf9S4L0XDqeOEWiLHaTshafPjOQ6OiHdQCtudTaIBPpD1J78v6uaAc8BK7FjgxLWbrD+okoszqz0sug/UVH/q+106QHshyWsTpBkuJCldOHfIGmv9+5S0BZMhh7hSpsRBq3LsUvh3/RRtoN71N52CCkSF9wapvVKqEqZycUCOKE12oilEzGgjcOjo25QB/8F9iKVcpmenbM+JZ7Ky6i8It8LnzYbbLasT9TP21gBL4prRMEqhBn9u3XAjQyK3LCiZ8Ls3oA/E9VH0JswxttWuTtJ6+1Y8zzJSXYFI7n+EdqWs8XBbIGyL100I5Xpe0kpAfi1d5ZjGJww8tLDPX7Hdf8Qvr+9nCJc8MGlNAObxbvOEwpeihivnvuUOkdQwnE6wWHnDzRMBqLT6UAgByQE9T9VCcOVEC0Sx+jUH4/mAIrxtTFob/K7rWl7swBwnFvkLGHlvlbgk4oqQ1WGVFnDIwhr/XfOU3XvtOM4ftKg1Kr/mdkqcs7ldvTWag/iqkTjmNze9VtnyIhY7D7d4bnBYSdGiyQqoXhuvr0TG/c+l61S9TDH2WeuYXjXkf63aBj/ff3cSFQtx3hf4Uj19mJtVz+wBZ/haY2Gyp9rHthK8kF35rKF7yuAm4DQAm7hVzPNp4Zw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5572a4d-d4c9-4f70-95a0-08da5953a9d9 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:15:09.4675 (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: QNYF79gWqnI5cjC5P8GgpZ0orHXRWO7nXNCTxSood7GUSklkfcqNnJIy5n1vUYgDBIhFWnZWrUCCsePuI9RN3w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR03MB3883 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151543_885136_0AA07B48 X-CRM114-Status: GOOD ( 10.13 ) 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 For more precise link mode support, we can add a property specifying which MACs support RGMII. This silences the warning missing 'rgmii' property; assuming supported Signed-off-by: Sean Anderson --- Changes in v2: - Add rgmii property to all DPAA MACs .../boot/dts/freescale/fsl-ls1043-post.dtsi | 7 +++++++ .../boot/dts/freescale/fsl-ls1046-post.dtsi | 8 ++++++++ arch/powerpc/boot/dts/fsl/b4860si-post.dtsi | 4 ++++ arch/powerpc/boot/dts/fsl/b4si-post.dtsi | 4 ++++ arch/powerpc/boot/dts/fsl/t1023si-post.dtsi | 4 ++++ arch/powerpc/boot/dts/fsl/t1040si-post.dtsi | 7 +++++++ arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 8 ++++++++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi | 16 ++++++++++++++++ 8 files changed, 58 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi index d237162a8744..f12d860a2ed4 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi @@ -24,23 +24,30 @@ &fman0 { /* these aliases provide the FMan ports mapping */ enet0: ethernet@e0000 { + rgmii = <0>; }; enet1: ethernet@e2000 { + rgmii = <0>; }; enet2: ethernet@e4000 { + rgmii = <1>; }; enet3: ethernet@e6000 { + rgmii = <1>; }; enet4: ethernet@e8000 { + rgmii = <0>; }; enet5: ethernet@ea000 { + rgmii = <0>; }; enet6: ethernet@f0000 { + rgmii = <0>; }; }; diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi index d6caaea57d90..4bb314388a72 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi @@ -23,26 +23,34 @@ &soc { &fman0 { /* these aliases provide the FMan ports mapping */ enet0: ethernet@e0000 { + rgmii = <0>; }; enet1: ethernet@e2000 { + rgmii = <0>; }; enet2: ethernet@e4000 { + rgmii = <1>; }; enet3: ethernet@e6000 { + rgmii = <1>; }; enet4: ethernet@e8000 { + rgmii = <0>; }; enet5: ethernet@ea000 { + rgmii = <0>; }; enet6: ethernet@f0000 { + rgmii = <0>; }; enet7: ethernet@f2000 { + rgmii = <0>; }; }; diff --git a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi index 868719821106..68f68f8cfa4e 100644 --- a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi @@ -264,15 +264,19 @@ rcpm: global-utilities@e2000 { /include/ "qoriq-fman3-0-10g-1.dtsi" fman@400000 { enet4: ethernet@e8000 { + rgmii = <0>; }; enet5: ethernet@ea000 { + rgmii = <0>; }; enet6: ethernet@f0000 { + rgmii = <0>; }; enet7: ethernet@f2000 { + rgmii = <0>; }; }; diff --git a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi index 4f044b41a776..5e50b96e6b52 100644 --- a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi @@ -465,15 +465,19 @@ muram@0 { }; enet0: ethernet@e0000 { + rgmii = <0>; }; enet1: ethernet@e2000 { + rgmii = <0>; }; enet2: ethernet@e4000 { + rgmii = <0>; }; enet3: ethernet@e6000 { + rgmii = <0>; }; mdio@fc000 { diff --git a/arch/powerpc/boot/dts/fsl/t1023si-post.dtsi b/arch/powerpc/boot/dts/fsl/t1023si-post.dtsi index d552044c5afc..e2a7bf643393 100644 --- a/arch/powerpc/boot/dts/fsl/t1023si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/t1023si-post.dtsi @@ -508,15 +508,19 @@ sata@220000 { /include/ "qoriq-fman3-0-1g-3.dtsi" fman@400000 { enet0: ethernet@e0000 { + rgmii = <0>; }; enet1: ethernet@e2000 { + rgmii = <0>; }; enet2: ethernet@e4000 { + rgmii = <1>; }; enet3: ethernet@e6000 { + rgmii = <1>; }; }; }; diff --git a/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi b/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi index f58eb820eb5e..a585f5faaf9e 100644 --- a/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi @@ -606,18 +606,25 @@ sata@221000 { /include/ "qoriq-fman3-0-1g-4.dtsi" fman@400000 { enet0: ethernet@e0000 { + rgmii = <0>; }; enet1: ethernet@e2000 { + rgmii = <1>; + mii; }; enet2: ethernet@e4000 { + rgmii = <0>; }; enet3: ethernet@e6000 { + rgmii = <1>; + mii; }; enet4: ethernet@e8000 { + rgmii = <1>; }; mdio@fc000 { diff --git a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi index ecbb447920bc..f8a52ce0b590 100644 --- a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi @@ -619,27 +619,35 @@ usb1: usb@211000 { /include/ "qoriq-fman3-0-10g-1.dtsi" fman@400000 { enet0: ethernet@e0000 { + rgmii = <0>; }; enet1: ethernet@e2000 { + rgmii = <0>; }; enet2: ethernet@e4000 { + rgmii = <1>; }; enet3: ethernet@e6000 { + rgmii = <1>; }; enet4: ethernet@e8000 { + rgmii = <0>; }; enet5: ethernet@ea000 { + rgmii = <0>; }; enet6: ethernet@f0000 { + rgmii = <0>; }; enet7: ethernet@f2000 { + rgmii = <1>; }; mdio@fc000 { diff --git a/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi b/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi index fcac73486d48..c0aa26db78b0 100644 --- a/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi @@ -1018,27 +1018,35 @@ usb1: usb@211000 { /include/ "qoriq-fman3-0-10g-1.dtsi" fman@400000 { enet0: ethernet@e0000 { + rgmii = <0>; }; enet1: ethernet@e2000 { + rgmii = <0>; }; enet2: ethernet@e4000 { + rgmii = <0>; }; enet3: ethernet@e6000 { + rgmii = <0>; }; enet4: ethernet@e8000 { + rgmii = <1>; }; enet5: ethernet@ea000 { + rgmii = <0>; }; enet6: ethernet@f0000 { + rgmii = <0>; }; enet7: ethernet@f2000 { + rgmii = <0>; }; mdio@fc000 { @@ -1061,27 +1069,35 @@ mdio@fd000 { /include/ "qoriq-fman3-1-10g-1.dtsi" fman@500000 { enet8: ethernet@e0000 { + rgmii = <0>; }; enet9: ethernet@e2000 { + rgmii = <0>; }; enet10: ethernet@e4000 { + rgmii = <0>; }; enet11: ethernet@e6000 { + rgmii = <0>; }; enet12: ethernet@e8000 { + rgmii = <1>; }; enet13: ethernet@ea000 { + rgmii = <1>; }; enet14: ethernet@f0000 { + rgmii = <0>; }; enet15: ethernet@f2000 { + rgmii = <0>; }; mdio@fc000 { From patchwork Tue Jun 28 22:14:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899110 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 D1AD3C43334 for ; Tue, 28 Jun 2022 22:56:35 +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=Kr7g3YmLsg4LUxDC6lUlmZ2g1nXTeS7UsLwqtaMNYDE=; b=egEzWY0crm8FKu +WTDO23v3ebfFaVtZ0Y7vdWlilTgUI/GUh6FAZvLLOk/zjUQcFEeXSsbUR+ARdd76B3klaJxJwvir F+oLWt6IJ45sBJVOOB8bncfMRfUy8UBa4bClVoL9B72/FQKupa7w35IMHsb65t5y0YfcjmZxKArXA mh7X5XgxgPQVG7R2ntumzsVkSXDOmKE/gff/Hi+mG+r8f7w1FDAhqj/NMJfSq/wYhCiOobwc+6quW 30ABh6D+L0ODLZqbLwiREAs+DMp6b4r5aj7AfiPaMr8x9sPxMvHMztiWUm85LRwBJdXAzhZQFUq16 H/Jwe3O08YpHtFf/x46g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6K6Z-008XdL-8a; Tue, 28 Jun 2022 22:54:49 +0000 Received: from mail-eopbgr50060.outbound.protection.outlook.com ([40.107.5.60] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUq-008N2v-0M for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=azTHfPclRpcqGQVZ3ZR8FuQwjQVMiNGv9Gmw1iV3fvkaNnqIKhUQ3OBwgMFa6dR/JvqfhUJn52njcYKasb+RxOOd3g8sdYZEwDBHIHrv6vjbRv1UfFGzUYkPbw76bltxMXkAQuYNgWUnNRME3SSG2SGZr7KTtN90TZI9g7JQ9/qrfvlxvaHI61wpo0Y1kgjSp/2MCPhDd4VRMNVJ/UQs1lvZgIq8xMQqDUiligS9bhOYF47gA3pOaWlyfErV7nWHcCXnrNBdYV7oDyOBbiNUjilTdUZJvq5RVD8RFqsg4ZFZxg5nDXhQcOEPuKQZDL4sm0C1mhOFFZ0ivgMbZ5pi2A== 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=M+CFiU6qVhtFTr6M+oOeVnxPczmwKKewaBRv0WHqQyM=; b=GZqWQB9aM6AKIw6FQ1712Vc5CLOOTQEcnTCNGBpu5/ZJp3sBSIzFn3Si5/3rAMF3Cg2M5JDDVg5B0cIzSHZN3b+oJvjcdRX+/uqeWz7VK8rsUiJvZ5/TeVUIJcA5/St+XSXG1xP3XvCFCeVU/pPm9mdT0W0I3rTk6O+BMwAhy3md8pJ9cvT0b49IktpxQIa3wrrFy+ICjzuqBDvP9X2cCoK4NSoJLWmgKdQ9068+ElgG+8vMrCK8d0g60BtkF5w/y4ljp/XnTiJDK7xujISm+FoQeOXvt5nE+ohzOwpF7T42gKN4fmz8Vbl9ks0hC5xVQeNgcvDtQ1mfcHSJkwSeHw== 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=M+CFiU6qVhtFTr6M+oOeVnxPczmwKKewaBRv0WHqQyM=; b=yMd5uLNtlcyePTU3z882Yg2CGvFBQtE8ze6FRcYg4RJO3crPKJOTw/yNagHXlwvbQNQBes9Gd6Fwpp2hjRwsOxcEVrLxdeG3jsoNz/yxxDcoL1IEv8JTpLhGV3L5YFWftuN9Mih0CgEUiUYu9xXku7qPlcstIAiw525XKEEqm/ONm3ZrtYoJDbTkGSQiiDRxXDJ2r/fRSa/ywBTX1SpSCH+WHsghjooxU7hNhPUw/hF540g0g4tthxDUcAuF3G+xKlOUyDXrEyk35mWUFDmBPRM/VDEdwp36pHUbquBUJV6QlkQIWCtrQQ6xtgwbknK6mJAD7mmt8EGGDySgLbb2nQ== 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 DB7PR03MB3883.eurprd03.prod.outlook.com (2603:10a6:5:34::12) 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:15:36 +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:15:36 +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 , Benjamin Herrenschmidt , Krzysztof Kozlowski , Li Yang , Michael Ellerman , Paul Mackerras , Rob Herring , Shawn Guo , devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH net-next v2 33/35] qoriq: Add nodes for QSGMII PCSs Date: Tue, 28 Jun 2022 18:14:02 -0400 Message-Id: <20220628221404.1444200-34-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: b64bb631-6dfc-4b5a-e258-08da5953ab30 X-MS-TrafficTypeDiagnostic: DB7PR03MB3883:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vBIZvPtGpaxP4Ir2AQ3yVs8ImQw1TFft7DWup/RKAEgBKyWSgQGskfa4EqddaOK3lSvdGhm0S5JuiVdaUCUMZ3cLL/o3HKK0MacLWC2bWH7r76GhzLpTdtLmUs99wJVJ+PvT/KtauMjJRj4DWSM61KijpuUNGTr2URo6MqxTlOGji/mOEonTr/PVkU5nAJr1x1N/WFoKMsuFdffkDp/RU9T6iYW4rFPmuM1/67ujFuJaddxditxPs6dL/Srqp+qQQWUaZFz6fpdbuNekWatNZIzzOoTBO0MRAb1EnR8Xoh53aLN3HG28CJIpcOAO6nDMarLx93guRdB+8hTe1h6S0AimAdFCz0Z45q047aTnPhZTdvzI4tPjxBvnsSfUx+t+bEqAix5KOiwX6m6myqR999Di0I6buDdeqvVXUtuj9ksgRDrPicWKRQL/KIkcAbzBLPXOhuSsktWwEneJVztVHpI/bJ9h+6pQddy4W2vWa5+KHHmheZUr0MAcNllLADwwsiUKQPk0YQ91IiaNFewNyPVwQVMmaq/6KkLZqgSl89lUvTh76Cvkh5YNwTIRm7jb8fwQNaGC156JJXsftGh1JK041mfQ7uKhXRHRUFpR75ibZS7Fg/RtAoI9BQ3b+XeKfXTCCU/gO/sCbZLsoHTSdtAeAs5tQyTj+PcAIaFmAx3GCCqEaHomt7r8D9c/CjHw2TeoIQxETHIiWZcaLAQQ3JyqR5MGx/A40g5qc6tDBFaUE5ogzoe/mE6WGNUr+r1p2kItomDb4dpT2IgVKVN45Wd+oe3agCmK0Nh3LWNPzZU= 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)(346002)(396003)(366004)(39850400004)(136003)(376002)(52116002)(6512007)(6506007)(8676002)(38100700002)(36756003)(66556008)(66946007)(38350700002)(66476007)(2906002)(26005)(1076003)(7416002)(86362001)(54906003)(41300700001)(83380400001)(2616005)(6486002)(110136005)(316002)(6666004)(186003)(4326008)(44832011)(5660300002)(478600001)(8936002)(30864003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T8CY4rJ1Y/7wVsMsqsk7lVMzhPaffotZKrk3FFDFbWTMo3rBUnSk/PlniM2eJ3ZCEN+5fJAGjZnEoWXwqVPhLHEnPGH2l2Msc9zMb0k1/57OG6hAy1HTUX/YxxvUWMWgQBMmmLL3K63pzQUSnWaRDkY5A+B93NS9+dLSNxzfgXx8NbUKbMfRudaQtDscHTj/wF3Pgu+aSWBor3WjPX35RC/T9qmE2pyFSJ2QDU6I0wHtyQnq/u3QnXCjzvoCzdO2vszAXHF3OFi1/UasT9NRlTjzQQK54sT1sy0+p5vL5v76BKx3J5vy4aQfCrkc9UDboMVXT0CwCfEIhxsWo1faOkqdmBQdT8ZRpmgHO0u0N+0ciU8vKIEktikKJSfxQrI/Ug3t+oFeObcWipBg43PEbEV0hV3ZJhJ/Us3s7eS5totwhvke0wNJExE82PHQ4ruo0ttWrAKginyZsicJ4BP/6d+hWXM/QYKTnU6LduEL58eXmSoOGvYFG9bOgNwT4kqGyNngStlTrbTIXTNaoGwz/GjZdRA22BKWKlAKp6mslwCN4MJGZMWGl0NDUCfHcGmBra1V7mgtX3gUtubxsYDqEq8pDb3wqybZBfA9p6YMBRkWEp1XHrztogqsFd0DZ5xx4Nm9KRMyF+ASQ1duKv2zBiaKjQGPAvaemeloGefthX/SPhPhixVFQOTqrYlQ9hpDiHqdfGHql6QZoRLuytC5EK89RScoQhMEgQPjCBrVTLb8LrXetZ6HX6W3YAbRY85AMpE0JjR2D4AoWO2ANqI9U37YplaNp8VlyopFy7mFIZ/kluGeZnruxBODxLZnfLQC3KmRSgnsDOMdeHcdHTYHhsxH2eVkzG4t2UahyNB5WNYSA78+uoN9Jl1f2pxqP8Or3CSuP+peDvWeYhPSdttgdLxvZ264tvGEKiScNIS87LSESpa6bqYmE2lGra0w1yzL+M9vaFc5HDxJh7UqpVG30JiTnuckygfUTPiaFvWgfKX44xRzFl7RA6ina+/fqohpca8S35cJdXsPB4tESk2yFdlmpGD4566aHVtcJooGq2JU8vbDr4a6aL9L3sG9k1f/TmDA/ypbbbifSu/fl6Y2V69PNegliiPE3pviSyubAJ8AQPgIBUj7urJYS7gt2dHVOD97nhObYZpusAEv+9Y3KPoFAcQ1vXis92m38ykldfc58UcFTJq3XpeQZjlhBo1i+ibXyhvHDZgnXa2idTSt/M6KDfhNOuOqEQCF0KI5Ffy6iho2ASUhpao9V+Rog2VQMRmjr+GLfWWeKIFHe1+LcgECu1P0shIWkWyAB4bYOitldzyr6Tmc2GvZsvX1PH1/rHZWR/KcHyjAUhgmq+MXkgND6mRXZre0OgfS9RqPIWAT1EOPG79KKqJYGx6Ok7HY0WBSkY13KYCghOpBzaLLMzAeIpCuXJMNcHxE4syFhNuGGODTzX1qp/ogNRngdciE4gR/eGjLp1elvyfzcH4mWgmtX8SpIoM96FJkeUCmcMyK/Y0rFShsR/UidNxJHmmvhfqOEYQzpdkTqANgSpP1B3R91o32t9V1qcIIyiOUemY4DUXsISdmvbHO5WPZ8O6pr9WjcQgR6TLbA0+009MCzA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: b64bb631-6dfc-4b5a-e258-08da5953ab30 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:15:11.7330 (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: c/kOLXVFYrjo9iuhtMG79mVnQQh9UhGNDZXskDuH2rc1bm0s0mfSqC4/H0+epxydhfWiA+FcYmphSjRpSQFmUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR03MB3883 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151548_131083_7B772742 X-CRM114-Status: GOOD ( 12.66 ) 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 Now that we actually read registers from QSGMII PCSs, it's important that we have the correct address (instead of hoping that we're the MAC with all the QSGMII PCSs on its bus). Add nodes for the QSGMII PCSs. On the PowerPC platforms, all the QSGMII PCSs have the same structure (e.g. if QSGMIIA is present it's used for MACs 1 through 4). On ARM platforms, the exact mapping of QSGMII to MACs depends on the SoC. Since the first QSGMII PCSs share an address with the SGMII and XFI PCSs, we only add new nodes for PCSs 2-4. This avoids address conflicts on the bus. Signed-off-by: Sean Anderson --- Changes in v2: - New .../boot/dts/freescale/fsl-ls1043-post.dtsi | 21 ++++++++++++++++ .../boot/dts/freescale/fsl-ls1046-post.dtsi | 25 +++++++++++++++++++ .../fsl/qoriq-fman3-0-10g-0-best-effort.dtsi | 3 ++- .../boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi | 9 ++++++- .../fsl/qoriq-fman3-0-10g-1-best-effort.dtsi | 9 ++++++- .../boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi | 9 ++++++- .../boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi | 3 ++- .../boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi | 9 ++++++- .../boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi | 9 ++++++- .../boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi | 9 ++++++- .../boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi | 3 ++- .../boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi | 9 ++++++- .../boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi | 9 ++++++- .../boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi | 9 ++++++- .../boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi | 3 ++- .../boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi | 9 ++++++- .../boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi | 9 ++++++- .../boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi | 9 ++++++- .../boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi | 3 ++- .../boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi | 9 ++++++- 20 files changed, 160 insertions(+), 18 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi index f12d860a2ed4..6fd77ce41466 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi @@ -24,10 +24,13 @@ &fman0 { /* these aliases provide the FMan ports mapping */ enet0: ethernet@e0000 { + pcs-names = "qsgmii"; rgmii = <0>; }; enet1: ethernet@e2000 { + pcsphy-handle = <&pcsphy1>, <&qsgmiib_pcs1>; + pcs-names = "sgmii", "qsgmii"; rgmii = <0>; }; @@ -40,14 +43,32 @@ enet3: ethernet@e6000 { }; enet4: ethernet@e8000 { + pcsphy-handle = <&pcsphy4>, <&qsgmiib_pcs2>; + pcs-names = "sgmii", "qsgmii"; rgmii = <0>; }; enet5: ethernet@ea000 { + pcsphy-handle = <&pcsphy5>, <&qsgmiib_pcs3>; + pcs-names = "sgmii", "qsgmii"; rgmii = <0>; }; enet6: ethernet@f0000 { rgmii = <0>; }; + + mdio@e1000 { + qsgmiib_pcs1: ethernet-pcs@1 { + reg = <0x1>; + }; + + qsgmiib_pcs2: ethernet-pcs@2 { + reg = <0x2>; + }; + + qsgmiib_pcs3: ethernet-pcs@3 { + reg = <0x3>; + }; + }; }; diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi index 4bb314388a72..6a80accd4845 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi @@ -23,6 +23,8 @@ &soc { &fman0 { /* these aliases provide the FMan ports mapping */ enet0: ethernet@e0000 { + pcsphy-handle = <&qsgmiib_pcs3>; + pcs-names = "qsgmii"; rgmii = <0>; }; @@ -39,10 +41,14 @@ enet3: ethernet@e6000 { }; enet4: ethernet@e8000 { + pcsphy-handle = <&pcsphy4>, <&qsgmiib_pcs1>; + pcs-names = "sgmii", "qsgmii"; rgmii = <0>; }; enet5: ethernet@ea000 { + pcsphy-handle = <&pcsphy5>, <&pcsphy5>; + pcs-names = "sgmii", "qsgmii"; rgmii = <0>; }; @@ -51,6 +57,25 @@ enet6: ethernet@f0000 { }; enet7: ethernet@f2000 { + pcsphy-handle = <&pcsphy7>, <&qsgmiib_pcs2>, <&pcsphy7>; + pcs-names = "sgmii", "qsgmii", "xfi"; rgmii = <0>; }; + + mdio@eb000 { + qsgmiib_pcs1: ethernet-pcs@1 { + compatible = "fsl,lynx-10g-qsgmii-pcs"; + reg = <0x1>; + }; + + qsgmiib_pcs2: ethernet-pcs@2 { + compatible = "fsl,lynx-10g-qsgmii-pcs"; + reg = <0x2>; + }; + + qsgmiib_pcs3: ethernet-pcs@3 { + compatible = "fsl,lynx-10g-qsgmii-pcs"; + reg = <0x3>; + }; + }; }; diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi index baa0c503e741..db169d630db3 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi @@ -55,7 +55,8 @@ ethernet@e0000 { reg = <0xe0000 0x1000>; fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy0>; + pcsphy-handle = <&pcsphy0>, <&pcsphy0>; + pcs-names = "sgmii", "qsgmii"; }; mdio@e1000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi index 93095600e808..fc709261c672 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi @@ -52,7 +52,14 @@ ethernet@f0000 { compatible = "fsl,fman-memac"; reg = <0xf0000 0x1000>; fsl,fman-ports = <&fman0_rx_0x10 &fman0_tx_0x30>; - pcsphy-handle = <&pcsphy6>; + pcsphy-handle = <&pcsphy6>, <&qsgmiib_pcs2>, <&pcsphy6>; + pcs-names = "sgmii", "qsgmii", "xfi"; + }; + + mdio@e9000 { + qsgmiib_pcs2: ethernet-pcs@2 { + reg = <2>; + }; }; mdio@f1000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi index ff4bd38f0645..dca4702777ef 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi @@ -55,7 +55,14 @@ ethernet@e2000 { reg = <0xe2000 0x1000>; fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy1>; + pcsphy-handle = <&pcsphy1>, <&qsgmiia_pcs1>; + pcs-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiia_pcs1: ethernet-pcs@1 { + reg = <1>; + }; }; mdio@e3000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi index 1fa38ed6f59e..220a8fe67fc1 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi @@ -52,7 +52,14 @@ ethernet@f2000 { compatible = "fsl,fman-memac"; reg = <0xf2000 0x1000>; fsl,fman-ports = <&fman0_rx_0x11 &fman0_tx_0x31>; - pcsphy-handle = <&pcsphy7>; + pcsphy-handle = <&pcsphy7>, <&qsgmiib_pcs3>, <&pcsphy7>; + pcs-names = "sgmii", "qsgmii", "xfi"; + }; + + mdio@e9000 { + qsgmiib_pcs3: ethernet-pcs@3 { + reg = <3>; + }; }; mdio@f3000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi index a8cc9780c0c4..ce76725e6eb2 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi @@ -51,7 +51,8 @@ ethernet@e0000 { reg = <0xe0000 0x1000>; fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy0>; + pcsphy-handle = <&pcsphy0>, <&pcsphy0>; + pcs-names = "sgmii", "qsgmii"; }; mdio@e1000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi index 8b8bd70c9382..4e54516aea2f 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi @@ -51,7 +51,14 @@ ethernet@e2000 { reg = <0xe2000 0x1000>; fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy1>; + pcsphy-handle = <&pcsphy1>, <&qsgmiia_pcs1>; + pcs-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiia_pcs1: ethernet-pcs@1 { + reg = <1>; + }; }; mdio@e3000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi index 619c880b54d8..0c7459f9efa9 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi @@ -51,7 +51,14 @@ ethernet@e4000 { reg = <0xe4000 0x1000>; fsl,fman-ports = <&fman0_rx_0x0a &fman0_tx_0x2a>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy2>; + pcsphy-handle = <&pcsphy2>, <&qsgmiia_pcs2>; + pcs-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiia_pcs2: ethernet-pcs@2 { + reg = <2>; + }; }; mdio@e5000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi index d7ebb73a400d..2c138ebaa6fc 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi @@ -51,7 +51,14 @@ ethernet@e6000 { reg = <0xe6000 0x1000>; fsl,fman-ports = <&fman0_rx_0x0b &fman0_tx_0x2b>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy3>; + pcsphy-handle = <&pcsphy3>, <&qsgmiia_pcs3>; + pcs-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiia_pcs3: ethernet-pcs@3 { + reg = <3>; + }; }; mdio@e7000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi index b151d696a069..e2174c0fc841 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi @@ -51,7 +51,8 @@ ethernet@e8000 { reg = <0xe8000 0x1000>; fsl,fman-ports = <&fman0_rx_0x0c &fman0_tx_0x2c>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy4>; + pcsphy-handle = <&pcsphy4>, <&pcsphy4>; + pcs-names = "sgmii", "qsgmii"; }; mdio@e9000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi index adc0ae0013a3..8c5e70da4450 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi @@ -51,7 +51,14 @@ ethernet@ea000 { reg = <0xea000 0x1000>; fsl,fman-ports = <&fman0_rx_0x0d &fman0_tx_0x2d>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy5>; + pcsphy-handle = <&pcsphy5>, <&qsgmiib_pcs1>; + pcs-names = "sgmii", "qsgmii"; + }; + + mdio@e9000 { + qsgmiib_pcs1: ethernet-pcs@1 { + reg = <1>; + }; }; mdio@eb000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi index 435047e0e250..24ab7fc89a87 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi @@ -52,7 +52,14 @@ ethernet@f0000 { compatible = "fsl,fman-memac"; reg = <0xf0000 0x1000>; fsl,fman-ports = <&fman1_rx_0x10 &fman1_tx_0x30>; - pcsphy-handle = <&pcsphy14>; + pcsphy-handle = <&pcsphy14>, <&qsgmiid_pcs2>, <&pcsphy14>; + pcs-names = "sgmii", "qsgmii", "xfi"; + }; + + mdio@e9000 { + qsgmiid_pcs2: ethernet-pcs@2 { + reg = <2>; + }; }; mdio@f1000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi index c098657cca0a..16a437edda9a 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi @@ -52,7 +52,14 @@ ethernet@f2000 { compatible = "fsl,fman-memac"; reg = <0xf2000 0x1000>; fsl,fman-ports = <&fman1_rx_0x11 &fman1_tx_0x31>; - pcsphy-handle = <&pcsphy15>; + pcsphy-handle = <&pcsphy15>, <&qsgmiid_pcs3>, <&pcsphy15>; + pcs-names = "sgmii", "qsgmii", "xfi"; + }; + + mdio@e9000 { + qsgmiid_pcs3: ethernet-pcs@3 { + reg = <3>; + }; }; mdio@f3000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi index 9d06824815f3..16fb299f615a 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi @@ -51,7 +51,8 @@ ethernet@e0000 { reg = <0xe0000 0x1000>; fsl,fman-ports = <&fman1_rx_0x08 &fman1_tx_0x28>; ptp-timer = <&ptp_timer1>; - pcsphy-handle = <&pcsphy8>; + pcsphy-handle = <&pcsphy8>, <&pcsphy8>; + pcs-names = "sgmii", "qsgmii"; }; mdio@e1000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi index 70e947730c4b..32af9ed28094 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi @@ -51,7 +51,14 @@ ethernet@e2000 { reg = <0xe2000 0x1000>; fsl,fman-ports = <&fman1_rx_0x09 &fman1_tx_0x29>; ptp-timer = <&ptp_timer1>; - pcsphy-handle = <&pcsphy9>; + pcsphy-handle = <&pcsphy9>, <&qsgmiic_pcs1>; + pcs-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiic_pcs1: ethernet-pcs@1 { + reg = <1>; + }; }; mdio@e3000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi index ad96e6529595..bf830e5b084a 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi @@ -51,7 +51,14 @@ ethernet@e4000 { reg = <0xe4000 0x1000>; fsl,fman-ports = <&fman1_rx_0x0a &fman1_tx_0x2a>; ptp-timer = <&ptp_timer1>; - pcsphy-handle = <&pcsphy10>; + pcsphy-handle = <&pcsphy10>, <&qsgmiic_pcs2>; + pcs-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiic_pcs2: ethernet-pcs@2 { + reg = <2>; + }; }; mdio@e5000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi index 034bc4b71f7a..0fe2c962f72e 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi @@ -51,7 +51,14 @@ ethernet@e6000 { reg = <0xe6000 0x1000>; fsl,fman-ports = <&fman1_rx_0x0b &fman1_tx_0x2b>; ptp-timer = <&ptp_timer1>; - pcsphy-handle = <&pcsphy11>; + pcsphy-handle = <&pcsphy11>, <&qsgmiic_pcs3>; + pcs-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiic_pcs3: ethernet-pcs@3 { + reg = <3>; + }; }; mdio@e7000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi index 93ca23d82b39..9366935ebc02 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi @@ -51,7 +51,8 @@ ethernet@e8000 { reg = <0xe8000 0x1000>; fsl,fman-ports = <&fman1_rx_0x0c &fman1_tx_0x2c>; ptp-timer = <&ptp_timer1>; - pcsphy-handle = <&pcsphy12>; + pcsphy-handle = <&pcsphy12>, <&pcsphy12>; + pcs-names = "sgmii", "qsgmii"; }; mdio@e9000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi index 23b3117a2fd2..b05e7a46e2e3 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi @@ -51,7 +51,14 @@ ethernet@ea000 { reg = <0xea000 0x1000>; fsl,fman-ports = <&fman1_rx_0x0d &fman1_tx_0x2d>; ptp-timer = <&ptp_timer1>; - pcsphy-handle = <&pcsphy13>; + pcsphy-handle = <&pcsphy13>, <&qsgmiid_pcs1>; + pcs-names = "sgmii", "qsgmii"; + }; + + mdio@e9000 { + qsgmiid_pcs1: ethernet-pcs@1 { + reg = <1>; + }; }; mdio@eb000 { From patchwork Tue Jun 28 22:14:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899108 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 BF064C433EF for ; Tue, 28 Jun 2022 22:54:00 +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=KADwmI7w+M9VsoNc7eHdHZa0S3zyYfDhwZ+N9tSy0us=; b=Ziq2eb4vXpz6Gl WH3ZkicE1tSLxMaZa6U9TwbmFrttRctPzuGt8NE+GI+Dq/k8uiKInNMCzLYEOSCX85xEYG7knNyFY /UBjwXSpFIQYKkg5i1/wRyBSOY4uiNdNyxvzHGb8Phe2eAE6wQuovOYZEGgWH9E1lIWKwsScvHcYY HNBaiM2eNQLvYB1jfpPMhOVDnrcFij+/X+2DDskHq7UJl7GLsb8TuHC69n/J5IxAj4j5e8JrMD0J5 tUKUgGIWcoriwW9AZMteG1FQT2NTPemCSxsVyEe6/YvvVDmnlZkNf+FRohzDnWXzvD+poNdqxeDh8 gqFyCL2cU8Gwqs4t/hqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6K4D-008WzW-UW; Tue, 28 Jun 2022 22:52:23 +0000 Received: from mail-eopbgr50060.outbound.protection.outlook.com ([40.107.5.60] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUo-008N2v-1u for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 22:15:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BZmuwjGfQb5d6RY9sVwT5oD6jZSnbxUbmjH+wYL8A+vSxcw836Jb/YIBIUYb6IcRZeejMG9KfTzJR3TEkXFV5I8wOesAGf+bXWmpaznuiNXbGH6i9e+dhN0hFcu0eWq6m9ySaw4BKQoYpKBONa7M7mww1qwRCMv2ZE0j1A9wPe9SSscPcINYfUithSdr0I2i+kshBz/6/dlH8Nf1U2zl4c3FvGttu3pfOa4qBpD4UVIIXwTpCdmhg9Bq9UnG+vGRquxvt/0JZEv4YptuIPzMZRXs6MxIsP6R3Jjpq48HvF5YKFjgWt7tgnIZLS/sk+OdfL3HMltDklfgFgYUNa5TlA== 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=LWMYi4jHuSKoL0PhVCtVd/LenVBaQ7RzU7jnwoLBJQ8=; b=MsBavzD7gFD0kw9t1bQYILG8VRlGJ8i4ZhWxkZS36q+rCG6oMo2Q36IVS3NPT8my8NTg725A24/P3oorQxnHxW21/ikVNkK0E05YZEM63jnX0DBSUrL+eAVsJSt7rTwyudrzufyMm4vPAWywX7lXJRhMuC3PvtnbA8Q33XNTPjc4O2q+4GKZ/EuCmj0URV2YOHs9sTK/SnziT16nHkC/hA8/6B2d1DFSFjwmhsH7XaRgu9TcBknfY0X4wHy6nf8cly2IUeVDOqsWC1MOTF9FjtQ2Faxl9avN8Nz+x2O7jfJlTfzbLp/8bwxD4maW4DGYcOdUDa3gKabUf1EX0yYTZw== 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=LWMYi4jHuSKoL0PhVCtVd/LenVBaQ7RzU7jnwoLBJQ8=; b=Vex1goZz6+iOVaBWoKE4J/cUinlqxdKDYhAF7XKicEQREQmIfVCw76Vv0lp2O1kZa4/h5iNpKJIFgxR3bIRueB9w05rwxJrRU7rhYhze4i0KCFgKsAfeJle+pSbXaS4p2Nzu4IEKlXXzL9byON3er6HkifZI9gJtLF6OohcSeu2rD2cmXMiV6P1CoXEcuU84BdlisAFREwfn5Mf1EOpgO9XwQNdL7CzUrCTnDpOibspXu/lVhbBRp5KDF6aJZCKoxGhQhG53/aIRDQfmk5BI+CGK635du1ff2zTxHinPurt2rt90A4JVjHSWDPBRw90Apl4h6SsRDevVyNWiPA4FCw== 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 DB7PR03MB3883.eurprd03.prod.outlook.com (2603:10a6:5:34::12) 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:15:37 +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:15:37 +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 , Krzysztof Kozlowski , Li Yang , Rob Herring , Shawn Guo , devicetree@vger.kernel.org Subject: [PATCH net-next v2 34/35] arm64: dts: ls1046a: Add serdes bindings Date: Tue, 28 Jun 2022 18:14:03 -0400 Message-Id: <20220628221404.1444200-35-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: 63540b8d-0bf8-4d59-59e6-08da5953ac51 X-MS-TrafficTypeDiagnostic: DB7PR03MB3883:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RNJZMQGfewhIasCgD9M2TMJLLh+QgBwxWOOk5/vMCsdDOO19uV57mvkDkv3ebGOwXWHXBdojbfKcbfU/Pyg7YOVTrDD6KWFkLJGT/pT4gtgHka+C68+NCilZV7l16/N+mHQA4NDvgtZ2+EOkNWeJ7LWXVmNfe2NttYZ4uuC+B/521dnvEs1s4GeDuzja740xeNW7EJ8BRJMwKVmdSVrjog3+ag1HQCBbgKqkmV7hdMZE+Sls3aKE4zLa1n2jcEam06Q1Bz1pMQgxejRnPqEozEJdmAcQ6T3NQDxoSbudzPhE0chQO4NihlZQqE5ry1Gw8AYPTUiqUVbfbFvAVwpr1pCxmw53NzcZhmYI4O/udfXNENG/8fJoG3/aqz/R/NgJYPgOE0Jt/XP6Hzcqjg9dv7jb4afMPS7vNLnKrO7LuOsDPvnCkSn0YjaWw3oRRE64rg2bh9eqMypg8JB6HOD8U2KImN1r9hatYZ2uXeCCu3TZB1dYilNpPcPe9g/X3b2AGKmYwTiY6zjLV1PWCbi4BcrimACR0AT6u6dWT2YarSXzkPPZlPqOZdaKkLc8oaKJIdCs1v5R5iYTqx4QZ+bYuvtTKOBCK+UmTQL3awsRfY0s1sucEXFeD+gdriA7TgogjWOGtZGenkJ4kbWLHKz2VRXXODm0HZIQHznKxHqARaMPHKN2V093G1VMqO9GnRteC+D1IE9L4kcQjK0ksB0REimHxQEYJJn0WFdbLMjAkjpIC4ixu8BX9O8WZIEb6yV291aDtAo69ZT4UDSofPfhcy7CuhQY5t/EJcegBvZYIxY= 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)(346002)(396003)(366004)(39850400004)(136003)(376002)(52116002)(6512007)(6506007)(8676002)(38100700002)(36756003)(66556008)(66946007)(38350700002)(66476007)(2906002)(26005)(1076003)(7416002)(86362001)(54906003)(41300700001)(83380400001)(2616005)(6486002)(110136005)(316002)(6666004)(186003)(4326008)(44832011)(5660300002)(478600001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eFt0s94lkOzGzOnsF7+3nVF/8ugleZlcfA9IcVajftCRcQwD0XjWz7UnyaRBnJEo0Oaik1gAhn+BORDxROUNa8b6SaFM8UIkBeirE/EOLFUqfL0H0r9EY113n1gLdVq/g8URIxIgR/EIZaRp5l7H2JlUSzVlEUpYrT1HOmCTur8KgX9v0l+7UhT34gdyl38bNv2wdxFXY+GCPiNa4lkJ7Lj7n3rvn9UvxWBQPeK8LbIxDIYA+IUtWbFqZBGNyrfXDoXHFv/fx7VfWUB2CJJUrcllEyJfslIh8a294V+ZUHvySZDu5exJSGDn4i2wXw1fFt9vHWrwnJXGVLDlLm/5POGA2minGyBFeWAJY+yQOPZfW8aK+e1IrFpcqZXSfFH2spYGFZ4GfdKCAVLV4g9UpSauNKupfWtPamdddnaZ6AJF4tz3nKmqw2U6POv5YZ7NpEmaev7f2K+WbJRMpaOOS6ChP27qPqORw4N2gb1gpwYJqo+Up8xlBVO6WzuDqCzFmEOHFM0VrHB4SuHYNuQ1F7RFud31PNH1q8Gdb0/2z8DCL20Z1raIVEmwwDHTQzEOQcKVERXEMIhSO1rKeS+AugeWCYM12+FavIA0DI11j0Csi9E6mWiJy6VtgepyYIJy7s34ew676tDeTDdMLQBHl0OHz6vuWTfTl/pkHXjf+rNeZDhroKFRBM8e42PLXyf8n4e4Yf4Kd1+KU0skM6goEX/3r5SpcezLQeWP4AnfYkK27BSynfRJpv8r7aZzb01BVvNkiqXeMb7D8hBmS3yeq3Zkg8m90Bgc43odyYGfH/UIEiz0jYWKQF+p9yGBmyknHlaow6/NODrBrqZDVn+/LfmUq+NEE8UciV+LxvW+jFgE1JbujEi7sPi2QojaaQpDcZXcpcUPVJ4tuzLKSfldQLcjTWRr+A5yUi75w0tn0hkthioLo2diXYEaG/+7xMt+FDMv1fQQzAom1E/HbJcAtaUds1V9xDRQRJcfoxtfBAnd92ZW78HK21jj2BLkdwMvOiwygtLazKL/KlVsmt2VL7vUYNgKqzZDst4vzW4V1QErmxmoXBUZaRcGYN3HOevGCF+5Icd3AlRoaPvPc203rQdbZojKdzduK1wU0USZlY8WOlDtAg1ZdGD9M8gMayp31dGAm/4AvAHCIqUQQhE+z/L02/BYct4dL3R9lrnwzXhPV1pMTfa33+56/2c9SfACTQwZ5svIVQuRnRkBFNFsXIvNXVWo5CaozWVX1BSswGEXwxBck1NLgOCvNVRlwLfQ+kS6GTnj684RiGUIMqJ42ulq0GlKD25J1BHd9wmYjg7yQWBeWtWe07d62u3Tg2h1Ves1+89AtC8HaAZ6y4uPAdtMFfsrP59TxuljY1rljr4d5ePIo1T8yaoDOVM9JZrX2DWQ3gZ10B17PPfqwNe3s6piASlVeyWK2yHvihX3Ix6jL1IT0HUBJSKiAXQpcgfRHlZ6ObTYp0I3qcvj2o2KudHyEejMnsGwCAYBXpA/RPRMAnP1rnWB/jQ0aKAJss9dDqVj3Yco5wyX409svtEL9zIuNOWXr1bWdC8E6hezPVKvxSOIM6z4HJu/3hDh9DCSwL/6aDcIVNKVUhgbXpBg3A== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 63540b8d-0bf8-4d59-59e6-08da5953ac51 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:15:13.6547 (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: wH6TR91AfCtcesfRSvfWYBf3EmHCBR/BD/qGO1BMGAKtxsECLSH+vrxukfjMcB0POFmaBlKwYc0LxRaaUIGiBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR03MB3883 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151546_153328_4A8BC6BA X-CRM114-Status: UNSURE ( 8.93 ) X-CRM114-Notice: Please train this message. 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 adds bindings for the SerDes devices. They are disabled by default to prevent any breakage on existing boards. Signed-off-by: Sean Anderson --- Changes in v2: - Disable SerDes by default to prevent breaking boards inadvertently. - Use one phy cell for SerDes1, since no lanes can be grouped arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi index 0085e83adf65..8b15653607c9 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi @@ -413,6 +413,22 @@ bportals: bman-portals@508000000 { ranges = <0x0 0x5 0x08000000 0x8000000>; }; + serdes1: phy@1ea0000 { + #clock-cells = <1>; + #phy-cells = <1>; + compatible = "fsl,ls1046a-serdes-1"; + reg = <0x0 0x1ea0000 0x0 0x2000>; + status = "disabled"; + }; + + serdes2: phy@1eb0000 { + #clock-cells = <1>; + #phy-cells = <2>; + compatible = "fsl,ls1046a-serdes-2"; + reg = <0x0 0x1eb0000 0x0 0x2000>; + status = "disabled"; + }; + dcfg: dcfg@1ee0000 { compatible = "fsl,ls1046a-dcfg", "syscon"; reg = <0x0 0x1ee0000 0x0 0x1000>; From patchwork Tue Jun 28 22:14:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12899111 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 E3C1AC433EF for ; Tue, 28 Jun 2022 22:58:03 +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=PpQSW8wbn169G2yRJ72j1vfEsJJxBSM5cq3QqC/MbFg=; b=E6INDMVUQeFNlD moD83NPlwky6NGasQGzlsSN3UN+CbuAEOyL3XIAJ82G7JdLB2ipKB1DRZUnkku87e1AXSClVOjpor G7/9BJbPJyBJWKnyJPkG20+ZsoQxbnZHNsnRo0blevzlSB2UhqRsRSlJGTjTnYrtLJafBBW969jUG HrdIQVNOAw7sxbtbRfwNqmh7+HxOzRF4Zrr1bdDXB33awMt7xfKry03Vlz9qcIYdy0he4kUFZvW8b yIyMSubcBMRHCUwC0i5m561EH15EROrxJ70043YdQrJ2heQMG9GS2d6ek1TFPaeP53UBa6loVqC3/ G3attDSDXX1cMon4xZmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6K88-008Y2A-RS; Tue, 28 Jun 2022 22:56:26 +0000 Received: from mail-eopbgr50060.outbound.protection.outlook.com ([40.107.5.60] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6JUt-008N2v-F2; Tue, 28 Jun 2022 22:15:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XMjUJwwxabseaPhgrl3CrS4BJsmFEGlpuAZsV9X0Xzyonw+AU3NErdcjigwDb3V1l8JDM2lopjm94icvJjZmZvCh2JK3bjrbpKvpEt2ZOUij98HNz9TOUxLEqhmbCdJMhIdKm+bku80j5eF+YYQFDz3If7C4rkP1bzF3z6try5wHOArMOoJGadMmpuCnzxsZ6sNrX09aFeh6I/KnIoNraT5vmquJlT7/HuxYw0tx7iwlZmn+0uCS0PDLnnoZptuYV1PPpCOvHFPkmFd7HCFAdXkPtSWbe8ty+g4iRQVI1fTIlyqPjNGGmOjJoarGqo8KvOVlBATq8T3DS64D7DFS5g== 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=Mv/fBJyuMJHaKO9E0HqqZzxOLAFdk0n0PbulaXq1z+A=; b=FYKI7++UWZSmmaZGC83rH1yxiLhZgw46q/8JsFmAIeM96ItroZXngIxBSle3KEorIuEd7YCyqmvH6iGv6WgXgYZkSmdZQiTUEGlMEPL6nYpfNEMDTq3UGpLsTxpt44WKp3q78/dczTMD3yL3408OWZETtplFzdsj/FTsmmndTKtK6FEm1dUfGVVt+0UgBacNFANwE72uHVOX1J7XxdA/Seyy+LYLFi8Xbf7Vup46xMRLv8SaUT3/GAX8n2b1jGadLapsCqCD35dr8zfYsLkKFDvPVjkvug2u5BQGIubpX5tFBm/xOaV3a3pzioBPSZJRA9LW6sL7BAw8epyo5OdWug== 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=Mv/fBJyuMJHaKO9E0HqqZzxOLAFdk0n0PbulaXq1z+A=; b=DVAH7d1ZbK71g6FyYqnPcSFd+KtxDF+iHPsbWlO+08TOxEIdeFUyXFbwPapLh/Fq5xRMIW1puT4DMFyQJFXrt7ZS0e4JrKBIskbndThlmeM2xqZYAPgXWpFg1RqcbBc+q2l7nqQxxcf2LXzoDqr+OpTeMF30EDUjfAGIDNS8KZ/H9GSIJJvni5BdGVniAx2/usg5qP/OXzdb3Sp/bL/U+6vXVVVOd+n9xQ9TBmTjHqiZtwV9CfMlpk1DPjNrNn/D3cg6JWGROZG9SdbrLNu9EU2Nwu8wltgbmvEVH4nCtCYszPmmcU1Q+6Lw8yyR2oJjtnVHDAGOuhknd2+Upa+e9Q== 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 DB7PR03MB3883.eurprd03.prod.outlook.com (2603:10a6:5:34::12) 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:15:37 +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:15:37 +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 , Kishon Vijay Abraham I , Krzysztof Kozlowski , Li Yang , Rob Herring , Shawn Guo , Vinod Koul , devicetree@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH net-next v2 35/35] arm64: dts: ls1046ardb: Add serdes bindings Date: Tue, 28 Jun 2022 18:14:04 -0400 Message-Id: <20220628221404.1444200-36-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: b05888fd-ea4c-4e44-7fb2-08da5953ada1 X-MS-TrafficTypeDiagnostic: DB7PR03MB3883:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zxaEsr25ORtfqPXxTrJ8IClKEYl82Sl6YhJ1XjuyQgwsnfaJ5tNjhcqvhIzQ1NJiuFhqLf+bDYkC3nvka895EmQ731pfKKBts1zG3I8OJcdz/HMtAEe9QzAGiWPw+S7ytUDcJy0osd0X4q0Mt/ciu0yDUVnjLPrMxgu99GnQgx+c/elVrQLGStDk3I/dOspAwQxQlnffUCCasXP/dlr1XBLqj9Z/J9E1XgIomhv951Hwr56/mAm+aJGNoW1eEmfXnEx5y+aNcsHI6N0wFaH1McQsC6bhLS7wdF9zKD4MTQh2jM94zDXIqgK5DAEfJnfvHm2vuqoGcJg0ggPIWH/gVGYb8g3GpKqYNk7YyCtd3q9tU7rfs8AVxiGVfh9aLUa43huG+SS5LOeb5iBRxW9aUHnYQQy2k6qkgyjODHZvC1AzkSTBtYZFqdvpPAwRUL6ETvY5aFTn4IMEDijush1J817AkAIulutRUa4yeBaeBFe38g/uU0WWXjeTrsJMVqCkgQziowxnon9EnmZpvS44LDWUFM7z5+ky77dBDhJmKazhYRVn5vLT2GrRW/WQqFGmI2jKRlo9rsvJssKd20FAIMxHtqa5tkFb69dFA8hpTlloj3PGI4VtEwKyj0U1mY6FXDhmW9Urh4pGnpQlzdVp+TzI5AzCAXk4nniQEW9AOhNUhJYtD0eYISU0KV9nS31jYtG/GPdVYCLoYJWmUxpNY/cl/WfrYuv5mh7Hvg2HquJdccfWRXgPJhQ+tzJ83kiIz2tYxmdCgiMQtgFpYtV2Nb05bjGo7KwOBcQpHppj/Hw= 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)(346002)(396003)(366004)(39850400004)(136003)(376002)(52116002)(6512007)(6506007)(8676002)(38100700002)(36756003)(66556008)(66946007)(38350700002)(66476007)(2906002)(26005)(1076003)(7416002)(86362001)(54906003)(41300700001)(83380400001)(2616005)(6486002)(110136005)(316002)(6666004)(186003)(4326008)(44832011)(5660300002)(478600001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kwdPNYd2TyQoT0btfaTdgu9Q/tdYdf70Z/x6Qb4STpHFxlXK0lSl0UGxKv/B6C8rS30aMmJxTdLOCuW+wjlkQZUhGlA+sJesg3uxLB/KN3BNvW8xpSSiMwiKpP5PvJzxiteDQMKVSlkppmFTTAP733GIEZU+/dDNfzGGwBrCfm/Xvqc1AZnFWyJ+mKTTmRE1uRsmI6HTcUGtqe4nvFu11yq5fcbiTNaZeZSj0RizGUOYgLhVsL/bB9hj6tO9Ltve3PsbWQbsWGHe0DEUndlVx2L0+nigNhxBb6hwv65YSDdlFGE2p+3mlqxEkHihkw6aZEDXgb7EflF2tYnZqx/EAWDbtXF4/PXMOyko3LUrSmfE3BoFacrJnii4bZoiQyztzfTjgq1B/QFTCuuX63vYbObKmzD0L2ecY5JK+fUgXAymYQIIWGAYoyTGuOmYJ+qnUc+mVtqYNyBK7R7ElWETseufN0N9RH53gGEpyRLOw2kUcQlmNidCOsOS6JKH1Ou6EkF/DG35uOm8W1lG2swJQ22FDq3MKs8Wb4cbw09kEPSIJRwc+0mVtyf3ta51qKz4LS38JBb8x8iN7fzIICKOvelP2VnCCDEiwzIfxpsSiLDKDKqvkonDzEVvqmnQwd/Grlx6zKvNgfgHs0yPIiKYoXavn34s0mO7StQ6ubQC9iNr38T6G7FXdKCAyPtpKe+/oRvimZ/ajmxIdIFvDnam1v7Q0zTTLm6rm2ueJwm47LUQbTHvTNLAee/CBrvvr3Rd4xsmpMuVm71mdCqcycuPhZBfGtVyncJv4aBUkmQ9/SLNdxcfv6SzHHb0cl4+M3he6doAw+0lC5QzkNxNSelYt9+ALBG1hlK00sP/sUjyiJa4k8X20PzZWuPg83w+JVEz2nOsVq/fxYJe9dkkBAhT30lg4+Do5qH0IKK/vnbktDXInNWeIffXqBK59AvVQ2ZTanNF79GJGfKcRHAfCQOyaHq5fuFfj25z1tTyWewMVK6Zx8K+y9eKeq/0mBEH0+vjVbsx05eQcd6+bhzYiOwFumgv6DhiVelzQ3rOBD6w8yVJr5dghzROL5w+04tmytqEHEVHdHPXYr8OynxcjF0Zv/rJyHmra+LvhPttbnULP0UUWkgzzbNlBxtLvNkBfCFKH/crgCmTutFhs6eRsJXnAnYrIs102Go24O5wysHASIU6HzXsF0bsGU03wq9LxFbj8gjFLlReiLNiYtIYnjpxoC9J3Ml+yb31WNXARVrT+dnnZ5J41b4qmeGC77/14lpk9JYkonUrZj9x73l8tV7e94mcxeUkc6P+stZSKimBLL72rqEhTb4o7LloZNql9k6rrTy8X7YcRGzhH5t1LFP1h6egUC1Kao/KSEj8DSsDO0UGsakCyL2pMv/GIWIio0RU/928qLfENTz7osHy4sZJ9tpSPJrcGULCAZUafQhVqNRela2x2Ra2qCW+9C7DwWgSNCBcgLYVNl0GDG//UwdNq5N+R9lx90qitVIbgOspmO6y5U4Cen9qpxq00nGCiBE7f7UxQegY/UhStZP9TVK7ZSR/X5Zbjtf89ipEX51J909sgeg/wd6OqY3iy6buLZYJWlC93mlbSS2IDr2rDFBWeQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: b05888fd-ea4c-4e44-7fb2-08da5953ada1 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:15:15.7171 (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: hVb7q+/nZEJ02O8dpo9Hhi8JshKxEhRizjnueMDtWBwElxRml/dpUCQEn0Ly9k4m9JqC8et33IRDgUFkAoY2XQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR03MB3883 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_151551_567800_68E3BDDF X-CRM114-Status: GOOD ( 15.13 ) 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 adds appropriate bindings for the macs which use the SerDes. The 156.25MHz fixed clock is a crystal. The 100MHz clocks (there are actually 3) come from a Renesas 6V49205B at address 69 on i2c0. There is no driver for this device (and as far as I know all you can do with the 100MHz clocks is gate them), so I have chosen to model it as a single fixed clock. Note: the SerDes1 lane numbering for the LS1046A is *reversed*. This means that Lane A (what the driver thinks is lane 0) uses pins SD1_TX3_P/N. Because this will break ethernet if the serdes is not enabled, enable the serdes driver by default on Layerscape. Signed-off-by: Sean Anderson --- Please let me know if there is a better/more specific config I can use here. (no changes since v1) .../boot/dts/freescale/fsl-ls1046a-rdb.dts | 34 +++++++++++++++++++ drivers/phy/freescale/Kconfig | 1 + 2 files changed, 35 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts index 7025aad8ae89..4f4dd0ed8c53 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts @@ -26,6 +26,32 @@ aliases { chosen { stdout-path = "serial0:115200n8"; }; + + clocks { + clk_100mhz: clock-100mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + clk_156mhz: clock-156mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <156250000>; + }; + }; +}; + +&serdes1 { + clocks = <&clk_100mhz>, <&clk_156mhz>; + clock-names = "ref0", "ref1"; + status = "okay"; +}; + +&serdes2 { + clocks = <&clk_100mhz>, <&clk_100mhz>; + clock-names = "ref0", "ref1"; + status = "okay"; }; &duart0 { @@ -140,21 +166,29 @@ ethernet@e6000 { ethernet@e8000 { phy-handle = <&sgmii_phy1>; phy-connection-type = "sgmii"; + phys = <&serdes1 1>; + phy-names = "serdes"; }; ethernet@ea000 { phy-handle = <&sgmii_phy2>; phy-connection-type = "sgmii"; + phys = <&serdes1 0>; + phy-names = "serdes"; }; ethernet@f0000 { /* 10GEC1 */ phy-handle = <&aqr106_phy>; phy-connection-type = "xgmii"; + phys = <&serdes1 3>; + phy-names = "serdes"; }; ethernet@f2000 { /* 10GEC2 */ fixed-link = <0 1 1000 0 0>; phy-connection-type = "xgmii"; + phys = <&serdes1 2>; + phy-names = "serdes"; }; mdio@fc000 { diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig index 857b4d123515..c9f687384c13 100644 --- a/drivers/phy/freescale/Kconfig +++ b/drivers/phy/freescale/Kconfig @@ -43,6 +43,7 @@ config PHY_FSL_LYNX_10G tristate "Freescale Layerscale Lynx 10G SerDes support" select GENERIC_PHY select REGMAP_MMIO + default y if ARCH_LAYERSCAPE help This adds support for the Lynx "SerDes" devices found on various QorIQ SoCs. There may be up to four SerDes devices on each SoC, and each