From patchwork Fri Jul 15 21:59:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919788 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 A9DE7C433EF for ; Fri, 15 Jul 2022 22:02: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=ED0D4xN74U2agD273HfYWriXRfQiVF3YI+3pkTS4Wn0=; b=U76NwdV72SWzI3 CSsifdw8P5EVA2qh3ijt71gW5k9v8yNPXrawcs4zKc8gpWf1TYHXHsPvwRpiMW5EaMT/iaiRQYdn/ B+uOdFbJ6e6/jUkn9VwbTpaq+qx16kzMUdSV+eOXTH75Uq4FW0uhWVADerQGrPg/JBhqI2RixvVn6 7yqMpjK9iDW1eQXIQoxSCJMW+VT2IilLbwpg4t+8PohXm8RuB8tgNwRkHbQXE1XvLOuCT7iodbpdT quOSMFmkA226c1nz1bfJ2GqEWhZiOUn4C0ReKDA60EjIwvMCGggfwWkvtjdo4+Mhid5Xvj919BSA8 i5d0bu8/VbGxKBXzFK8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMR-00Ab3j-PP; Fri, 15 Jul 2022 22:00:35 +0000 Received: from mail-eopbgr50055.outbound.protection.outlook.com ([40.107.5.55] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTME-00Aar5-FI; Fri, 15 Jul 2022 22:00:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IGVeSd/4QEFE7w5e7WRs7qOh/oO3ZASAgRM2ST3G4mgqvKE/9b+31Seskqotge9weWkZpkTqtVvRD1WnjJ0o2/q1lXcbYu1dhzo7BI3wogkfMapQkTGZWju2AcCy+M6UdWk4B+dksIDRu8uhHj+UnD3hBw0i8xm3nHhJJGnd8zj+XiCGqhGYEUhuhZz+65g5pPds5Bto9nbDM42VCVvhpEWNEM2wSDIp74ZXOLkCSTW84oHwndDctmbKG7oXGjsqqaNwm/tqhbIbpiA5MOwHH4VL6wcyDkM/IkX/wzXL4VTT6z5kTiEfYq5QAXAoJY7hUlyItBSI3DkTz2fPlYsl/w== 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=rzVIwzNMrkwZxhxqNQ3gDqq2qVzLHZ0a671vqf+uEB0=; b=PCs4/uMnAPkViyU9Q8YPU/KJKEHkXYnWLzdyUkfoBMZtz69dfGJOyI8Zx/R9lalFKZqMVFeDdS8W9aojiO18jpLKFf1qEHHkJqJkWSQCzC60si9tXBssnXWNdo0VRQ3N3ZkX8x2RLqNNgYX1WLTVXlG2x8cS3dFxrlDmNrKZCR5OoZVHHHhv8bp7DHs4D1CswPS2Wi46fem13AYJCfNxlJWhtiqY1v88+So+NU3ovm1WFQF568DT1l7Dq3/HOuhsL//5AB8rTOsJ0Fk0e5AIvsTq/F8T5yX8BFhBcpFENtEJU68znVA9zaEJ2r2n3EtciHjLlSGFh++chySDnPUoZw== 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=rzVIwzNMrkwZxhxqNQ3gDqq2qVzLHZ0a671vqf+uEB0=; b=lGWv5W48rRzeJHA/9RJJCDg0bZSEbNGxWpfN1hVwsAUfSWcSdGXBNSjshWQPTXHJTxm8hGVN8PUuuZK6JUPDhijtcaiv/nPjCyts2AgurjnqxLpP1h+GXKc+qJLF98loMzrjDVuu+kbvFiE2hDvdQjpgzjBhxzwmq7r2W3Ho3glFSMP2IGdjlK/jPQsMq8Ix77N9cXK81Eu40GPyG088GAtzMkruBV+ap3+QVDzbX5kH0cKK6M5iXBQsrco7HyeyU8IYg57TEjvbjS2kfeoBqOvEMPcz/Wh8YfzOGtVyBzmxOlypW/h1M2/8X7EJwZT4Ide0G5kmCAk8a6wER2O8og== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DU0PR03MB8598.eurprd03.prod.outlook.com (2603:10a6:10:3e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.15; Fri, 15 Jul 2022 22:00:13 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:13 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Kishon Vijay Abraham I , Krzysztof Kozlowski , Rob Herring , Vinod Koul , devicetree@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH net-next v3 01/47] dt-bindings: phy: Add Lynx 10G phy binding Date: Fri, 15 Jul 2022 17:59:08 -0400 Message-Id: <20220715215954.1449214-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6240f76b-e7a4-4004-5bbd-08da66ad6466 X-MS-TrafficTypeDiagnostic: DU0PR03MB8598:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3+izDLO+KLazzR4qUGmePmnUo0C7c9hQpG5NdS9tXukCO2NMkKVOcdidMtD5BOA/a0LUHdRLNjAvS2FlJm4YcQfxs+JCFOWjMVvqN5UYHru6MEJiN/nkPwhgi9xbPJ/Nb4xWeXgQ6fMg5fLnkXKT6Nl4TiGQ6hO+Wp4WYXrRaFmsl6XwMNDsKk+AfBgFthyM5xosrUMKsk/dYb+WeDX0IzF2DhkErs88GMn9zxsFDe2ybSGK1B8EnQTzJTdqCB0yLzbzxdBPffg6nPpuWkKh5rIkBqCrBZQB8Q4l2Ed1YnKukF96CNjzzkO//qvXjZe4zQY6razAB5HQrr8t8yACcf7xkxsN6bnCtN+f9J6vg+4lOS1pferovib3QlxQCCOFfNx87VLR9PwCP892M35LCoQSjRZyOpkTDr1j45xMtBAyTbiDL4MVRZ3rnP/hSd9u35FAYS7z8mnVUzfAVhDDB/NfM1x+fWVdXFKqLzjhWUQxWIOvsdli61vk/Ls9C1nxGRyNql9eOv/bci9gas7itKeVgVEgwCLUeiTCWofcNeWjfZwbBDNqnWURd7j2U7s/ZB9aRPy9evXkBUqey2uaQGo7EyhwTYQMRjA+qIMI0Hog1r/CNObFlPLtWJuf+IXPvnViMLR9Sm2LPW+99bPKP57+o7ejXl3FaHy986LZ6G7DuaC5zXJ98odqn9d2NnAKXFVtQqh2xAQPZuXfs6+dloVlqJfaH7JacTSu8PVrV7yH++J4AGtH9a8mVqN4e7xVIRAZ24lOdLbt6G/f536Fd85yissMLJ18hWEMF6RioIRSOesiyCNWIdDM0NqIbWtvNCgospvBhCOdHk6TC+e8Hw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(366004)(39850400004)(376002)(346002)(396003)(5660300002)(8936002)(44832011)(7416002)(2906002)(54906003)(66556008)(4326008)(8676002)(66476007)(66946007)(110136005)(86362001)(316002)(186003)(2616005)(26005)(38350700002)(52116002)(36756003)(6666004)(41300700001)(478600001)(6486002)(966005)(1076003)(6506007)(83380400001)(6512007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ATpelNNnp6VEa6TR42bVtnGYs/9iMOcFopwmShzjY5jI+hEdUuB0ArHGzRgv0Ypjzabr56SlY4jm5JjMtkSNfgDdgN4coUHiY+Th3qmY/CNrVfnd7Ghpe+CSAAGvYzUfYkaFRPvzyH28igtk44CK8M3IHzmt4fshkPYviRVk8QgLza5b5fTCRNuUltyGcHdQ/BgU1H5FSiW9FyMDSpKfSvfU1IEqpLLEPYDu2kmJ9C9M9VJ1lvauGSWKMJULW9QCth20komEPiyeq7TUf8SoppAFJpEFCvr4hg6mvDbakiig4vp6/JwuAz6/PrW8kRxL0oiDCOGmfhMaGFyyAG4CLjaGKIy2PzAjl66yVHrMGBRGPutNJnFjfnzWFopUngk/MzrMhqKGPePYpkPTQrUIwiVVHHPu+NrOKZzr4OsHjQ8/ZB/aBf23fQn2D/eKbfr3fsO0JiBp8xa9skI84hhtn+JfnIGWfzqn1GiwS60bDrD5DsjInuhklPypb4Gs1sjyBDiCqTSTz0rW3ki2xkBnaR938eeYyKlEKTyy9Q8tZcOVYHhWfHG71HAW1bWCHYx9voiHGayyJ50pYKdgEiQQ8AVXZEH7FSv8kGvTe50YPbTFIdACYs51GJ7fE6Z23WmhIMxSyQL2jJYay4Qzbau3xNf1Tabyz9S9VTTQkBMFF4zvqFNBi/0ee08+wHdmL4KvdLxufkPbnDJi0NhyZ3szfa1ixCm/narJIqwZ2Zn0taBT3s4gG6nPOEgFM75zRQfwqQq0nKPl3Un82rHeEfg7JGrvC+bVzy6tGVAyQIUh6O6ho4unNOJ/Mulnea7dSI7B+Zse2psKA1VlnoIRDc89foCvNs678ofDVyvT5FPZZkUpPkoSfzSI5YIpLRJPpcvrsqocJLo2HdJBrA/Z9q8F047SinZQIuHYW1fJzNkfhyJIs1jePBHb59vSV/RnRgheGXy7M7zPiV2y6zX7+lOOwRMOSxpaa/6qORedvtBZ9lrbWK7KgAoHZaAlZZHtd6hhL0CgzIk78DjK4JOfZIYpkQdD6Imu87qCQDVMH/W6ujV3R1BEJfMvICdiuLx5Ze0aPvaZQ921a+Yt/RnB8AzZb1MYFArD+Xu/NslYAN8ZWRjon7hBQNGEiQtE0waQ0qa5NcQSwKYtU2jH5R/5yG4QJzPqZhaHWXk8gnX9qGUkbG2GG5TVmTKeMTHUy5jy//beSUDhnofW3Hay5Qg1kzr+IXh6twJqfraBiD6axRQaQ7ZVbIYeXlwlbmea4fcr/+KBDNOrGncx1O/CdvmrCZmrQFX4SXjiwU5h2OMD/UW3T5BLSlzZXgnt9vhYZg19FsImG3jP6UyrexBchxO4ASWaIWdJfDeQSl+1FugfCLfGExY6DaPzRZ74gJsLL3051jEBtEB1J/Yw8JIlhsYNEkYer3CJ5CU3mXAtHrexJoCsZ18CdwSz6MrHobAbLE4OKJiSE1awBYSjwNXRFirq8tzE0gZgYKk2urPz9UP8AV+nVKgq6ucQ+Hc8vZ0cH6eePqvkHst+JCtiDuytaOh7XfVWi+Vfkwue5IAV/j9WYrPk6jtZUl7POGMYYPAVYmhgGLuSZ1FemV5+885TDF5S/iwg9A== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6240f76b-e7a4-4004-5bbd-08da66ad6466 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:12.9588 (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: Me/zVX2WDrRCdj8zMuw17NDmsft3zh9cXL63w3zHVtqavuPFLbWpbiHLzhYSRA84fj93nzT+n3uiLnt/Yo27iQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB8598 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150022_554564_D7E0D0B3 X-CRM114-Status: GOOD ( 28.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This 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 configured in the device tree. The format of each PCCR (protocol configuration register) is modeled. Although the general format is typically the same across different SoCs, the specific supported protocols (and the values necessary to select them) are particular to individual SerDes. A nested structure is used to reduce duplication of data. 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 v3: - Manually expand yaml references - Add mode configuration to device tree Changes in v2: - Rename to fsl,lynx-10g.yaml - Refer to the device in the documentation, rather than the binding - Move compatible first - Document phy cells in the description - 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. - Remove minItems - Use list for clock-names - Fix example binding having too many cells in regs - Add #clock-cells. This will allow using assigned-clocks* to configure the PLLs. - Document the structure of the compatible strings .../devicetree/bindings/phy/fsl,lynx-10g.yaml | 311 ++++++++++++++++++ 1 file changed, 311 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..a2c37225bb67 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml @@ -0,0 +1,311 @@ +# 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. + +definitions: + fsl,cfg: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + description: | + The configuration value to program into the field. + + fsl,first-lane: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 7 + description: | + The first lane in the group configured by fsl,cfg. This lane will have + the FIRST_LANE bit set in GCR0. The reset direction will also be set + based on whether this property is less than or greater than + fsl,last-lane. + + fsl,last-lane: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 7 + description: | + The last lane configured by fsl,cfg. If this property is absent, + then it will default to the value of fsl,first-lane. + +properties: + compatible: + items: + - enum: + - fsl,ls1046a-serdes + - fsl,ls1088a-serdes + - const: fsl,lynx-10g + + "#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: + minItems: 2 + maxItems: 2 + items: + enum: + - ref0 + - ref1 + + reg: + maxItems: 1 + +patternProperties: + '^pccr-': + type: object + + description: | + One of the protocol configuration registers (PCCRs). These contains + several fields, each of which mux a particular protocol onto a particular + lane. + + properties: + fsl,pccr: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + The index of the PCCR. This is the same as the register name suffix. + For example, a node for PCCRB would use a value of '0xb' for an + offset of 0x22C (0x200 + 4 * 0xb). + + patternProperties: + '^(q?sgmii|xfi|pcie|sata)-': + type: object + + description: | + A configuration field within a PCCR. Each field configures one + protocol controller. The value of the field determines the lanes the + controller is connected to, if any. + + properties: + fsl,index: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + The index of the field. This corresponds to the suffix in the + documentation. For example, PEXa would be 0, PEXb 1, etc. + Generally, higher fields occupy lower bits. + + If there are any subnodes present, they will be preferred over + fsl,cfg et. al. + + fsl,cfg: + $ref: "#/definitions/fsl,cfg" + + fsl,first-lane: + $ref: "#/definitions/fsl,first-lane" + + fsl,last-lane: + $ref: "#/definitions/fsl,last-lane" + + fsl,proto: + $ref: /schemas/types.yaml#/definitions/string + enum: + - sgmii + - sgmii25 + - qsgmii + - xfi + - pcie + - sata + description: | + Indicates the basic group protocols supported by this field. + Individual protocols are selected by configuring the protocol + controller. + + - sgmii: 1000BASE-X, SGMII, and 1000BASE-KX (depending on the + SoC) + - sgmii25: 2500BASE-X, 1000BASE-X, SGMII, and 1000BASE-KX + (depending on the SoC) + - qsgmii: QSGMII + - xfi: 10GBASE-R and 10GBASE-KR (depending on the SoC) + - pcie: PCIe + - sata: SATA + + patternProperties: + '^cfg-': + type: object + + description: | + A single field may have multiple values which, when programmed, + connect the protocol controller to different lanes. If this is the + case, multiple sub-nodes may be provided, each describing a + single muxing. + + properties: + fsl,cfg: + $ref: "#/definitions/fsl,cfg" + + fsl,first-lane: + $ref: "#/definitions/fsl,first-lane" + + fsl,last-lane: + $ref: "#/definitions/fsl,last-lane" + + required: + - fsl,cfg + - fsl,first-lane + + dependencies: + fsl,last-lane: + - fsl,first-lane + + additionalProperties: false + + required: + - fsl,index + - fsl,proto + + dependencies: + fsl,last-lane: + - fsl,first-lane + fsl,cfg: + - fsl,first-lane + fsl,first-lane: + - fsl,cfg + + # I would like to require either a config subnode or the config + # properties (and not both), but from what I can tell that can't be + # expressed in json schema. In particular, it is not possible to + # require a pattern property. + + additionalProperties: false + + required: + - fsl,pccr + + additionalProperties: false + +required: + - "#clock-cells" + - "#phy-cells" + - compatible + - clocks + - clock-names + - reg + +additionalProperties: false + +examples: + - | + serdes1: phy@1ea0000 { + #clock-cells = <1>; + #phy-cells = <2>; + compatible = "fsl,ls1088a-serdes", "fsl,lynx-10g"; + reg = <0x1ea0000 0x2000>; + clocks = <&clk_100mhz>, <&clk_156_mhz>; + clock-names = "ref0", "ref1"; + assigned-clocks = <&serdes1 0>; + assigned-clock-rates = <5000000>; + + pccr-8 { + fsl,pccr = <0x8>; + + sgmii-0 { + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,first-lane = <3>; + fsl,proto = "sgmii"; + }; + + sgmii-1 { + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,first-lane = <2>; + fsl,proto = "sgmii"; + }; + + sgmii-2 { + fsl,index = <2>; + fsl,cfg = <0x1>; + fsl,first-lane = <1>; + fsl,proto = "sgmii25"; + }; + + sgmii-3 { + fsl,index = <3>; + fsl,cfg = <0x1>; + fsl,first-lane = <0>; + fsl,proto = "sgmii25"; + }; + }; + + pccr-9 { + fsl,pccr = <0x9>; + + qsgmii-0 { + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,first-lane = <3>; + fsl,proto = "qsgmii"; + }; + + qsgmii-1 { + fsl,index = <1>; + fsl,proto = "qsgmii"; + + cfg-1 { + fsl,cfg = <0x1>; + fsl,first-lane = <2>; + }; + + cfg-2 { + fsl,cfg = <0x2>; + fsl,first-lane = <0>; + }; + }; + }; + + pccr-b { + fsl,pccr = <0xb>; + + xfi-0 { + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,first-lane = <1>; + fsl,proto = "xfi"; + }; + + xfi-1 { + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,first-lane = <0>; + fsl,proto = "xfi"; + }; + }; + }; +... From patchwork Fri Jul 15 21:59:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919789 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 62712C43334 for ; Fri, 15 Jul 2022 22:02:17 +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=diX/gV10jC9OJQyL/e1fGmn4uq+b/iMFtKW5XvS/78w=; b=aONyf3Git5GJEN mE2pU8pdLDZUpbgq9m29oLhJmWFFWwLNgFgOpcuKSevrIfXEU9F5B3KL7mdzCubTZ/fbDsx0s+z87 WippCVtYx1TVrefaCtUSBoa+10OU2cbhdY8YO2NtQPLPCZP72BqiGj0WFA+zoaEqDSRTAHvd2Rc06 nhsmNU0nXyx+JrPJWjzDRk8d2H0a+q8P1C5LhQ7GxCXiOgbWK1zRBcX3hw5+OXq/GXW8rz04hANX7 SKqOKHVvZS45kuPnIEAwafmHHe5JAJ6R63ee/WCI1NVmscNqf+qincyGk5gqqA+jSPvetaf8En3RO TfJQruR2gLUgTowFN1ZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMg-00AbAt-Ha; Fri, 15 Jul 2022 22:00:51 +0000 Received: from mail-eopbgr50055.outbound.protection.outlook.com ([40.107.5.55] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMH-00Aar5-6D for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:00:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aRs+pga8Oqjs6yYdcG7HXgdFadqxAnsfHma+EWRKmg3nst6f70w7YIYtvpu7Bj3h/NqPpsuyQaZc60k6JMjmqCjpMAQrx985xmtKCxVKfjr69/iqxzgB98i1HXgV8+E3w0lio7K5i1sF0kejp6xggud68wgMPdlS6V70835xuXHj6WYc6GNKhvQ89eZ9sD5lK8ntmYK7BJyshvtayhHTHDVF0JhDFWbhkwkgIWyozjUXT09b/mUrdssSl7VuYvq392DmVEosXykVcz5yS9HoDqIV1mmB65s70Q56cgYk+pkmVI1yTBhTE05a1I+mm2CsegZ9qamoTDu+GfZL9ntACw== 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=LGRZp8xi5T9B/fugG8PjeWl7roGT65YGvH/GFXawhLc=; b=G2KURUbz/TFqe6L/SNBIpie9x3i5GiqrhpH6b0ZDOwEuB0Lz22sVwy/i37OW7KRxBo84RpvE4eIy4LtD7S/Ejx3LgjGGAvUsQvadmPPm3XXjVBXWovgy8a1y/qi73ArdMzoLgIKYGLOkrMCughppl23ghC0TEuSNGGKpgIdwl0ikTyVtsPmLL78PHkuyy0NKbPB3NFBh1QxruGGuAqNg+aJ/HvvG8JwacRtbhI+vs7RnlFNylDLoA5z9LnoHl39rF3NCHN9qh1ZVa1hECm4M+DAJQBsorNTcQhQTyhMreaPfR+InSA1xmDK/fWPCUrLSgU6BAh98MAfbDQIUvKCfkw== 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=LGRZp8xi5T9B/fugG8PjeWl7roGT65YGvH/GFXawhLc=; b=DW989nTOpubiIZsAkKqWpKRLCnJOMEQrHKVWF8Xt36sgghrRzQIkgN39hWpoD7WjMhwH7pdGOIXLMRM2S7LADFMM2WRGNBdTTPSDinyVoJ9K46dDT3jwgr50NvcKlYQ3HTtwUiRzHp4s0xHfFF97xjeQ0F7SSG8Y1RkNZ2JcM+VO/3neUjls3WSm5VVP8E3jH4bEFDhFI7vfDGFjKy/D55AvxYjJhS9NZeJjJxH8OXRHvNLVkfQlE4A7CgArAfyJNoonm+ngJZTCC+rlt4gPVyJtM+ClznV9NijURmYgpO21MPxIsEgtsJ1idaOyav7UBigFj9SdyLAfz7LQySOL0g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DU0PR03MB8598.eurprd03.prod.outlook.com (2603:10a6:10:3e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.15; Fri, 15 Jul 2022 22:00:15 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:15 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 02/47] dt-bindings: net: Expand pcs-handle to an array Date: Fri, 15 Jul 2022 17:59:09 -0400 Message-Id: <20220715215954.1449214-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cafd906d-7a0b-4148-5b17-08da66ad65ce X-MS-TrafficTypeDiagnostic: DU0PR03MB8598:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TmD+8+9FkU5QUkMqNJ5NlZi8ukxKxQA0RceNznVIZfVVLPshAe8QZwc0tt2+E9GxPMeJYOJTdEBMHgADS+qPsWPevJG/1rU90sZEFzvxHhJ3MI9jv3ujeLOzVFxvclGFOUD0tvLngsFW7o5W/iWJAo2LHYYoT13klzHEEl6Lvg+BEtCCME2y5m7DYJFjd9B0tCh187duK389pvIGlNiNmokjURTNfavl0YVM6s831Jf8aOO0NFqtyPCaA3MS/bZMKez753GN6Z2b5g7XEOhZqe+9EGTut+bk/jkxd70RpVb2sj2ctIRuCAppho35USKat0ksVGjnHN5aLuhIh3Qh7vP56rTjah9fM1V8oSrjGNbIoFv14+lYOG4WsyYDrMHcPtwnFycpiufwtiAJxSluWvgXoHhHXYKBVJD3cMe0NwJ8zOQ9JdDncSwZz+8GYWOoxYosivf+3x7N8XbAhainNY8VhiWBv1/RvXQa9fuZwnwVk87xWF/+M2GiXVf6VttJdNhH+IjmYc2ikGTVSyOiYU8zJcbxPno66OUtaCRbBpqn/IkQ9PXfW8egm3JMUEDRflRAAi1ZzLTm0uja2FUqop9Gn7wjchX5KHgn3zfq9WDVi1OlNgps8xxKhQMnGg8iDwOkDFgxg/EvybHqAzSsFBO+lPpysE7HCK07SiWKDrubsMsUeo17XqXIQfl56pJLKu7lmPmdSGTEjIzSoNVZtAgkLjPJDvssfJmtbQoIq+nzcKqy60qPQRDnFWtYZAkfJpB81Es0y7akov5f00LoXV1J3VybHXgRvrp/tSJ/MEqLjNYgiJNDkNAXL0Pa3GOXtd9iSgX4GbkHX2hsg6er0g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(366004)(39850400004)(376002)(346002)(396003)(5660300002)(8936002)(44832011)(2906002)(54906003)(66556008)(4326008)(8676002)(66476007)(66946007)(110136005)(86362001)(316002)(186003)(107886003)(2616005)(26005)(38350700002)(52116002)(36756003)(6666004)(41300700001)(478600001)(6486002)(966005)(1076003)(6506007)(83380400001)(6512007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wGrDAder7szXKoIW0ysq9At+db5PyNo4BRDpiGALmgeCp8f6qBWFp/m7joFDtI0noRJjF2SNFkksV/ssTcuXcpZJTUHAIEafHPTz/gpSlK71dvYhFS9kpi2DQwwmvvFz61994bLpBguh8NrT1jQ6ntQocMkUWHu931+MBzYwctpgAGNhrKW0rPtdP1zyafephOL1s6Kw0VtQ0TjWSubF0hEgUWJChsrF2/Z8BtO/Pr9piqUgcFPs+ZH9f/6aiiKhNzhhOVpHgyiIn4HjguI0l8vonHEVoNG1pvDB3T43dF4dEI9Y+Arf5bjIduvGjtWPip1Ci3hxgzlc2wWybDAAM2q+jpVVFMW74+G4SYb0BHZjeW5UNRR+ogTjU8mWM5DVHDZ1Rdd9cxmfZ3m5HOAhw8gITbpAzzSg+2WLo+P+feApU+5XGwclDcn35rcP8zXD0yYJJ5rhFgg+RnjiNDuIt5YXyMYbp1P5uEC3ggS1hVUHGyBpvDRdb7NSxna2jmJ1tGl4TCz/l6pj8iklFlr0yUoZqEBQFxa1AjGfy7fWoRvKM+GX4pi0I96RgwNIrB9c0/8HO+FCFz1/OIZm6PAmikM7YcJE77gxuDteM2mEyjO3/xKSUYN/qbrcqM/nLSQXNMjK0WO2KRlkGuJm68IoKmQNfW9WeVGhJxOrVyVu4bRXjKMSrL1cZ0sKeJ9bRQU95nXpIbDTfuuZt7bev2VwVxTwzWyHfSWHm/IRrJu488tM1lknKGz8mzjionwhYVW90ng4uBqv+RWdRdRGOLMxHrspz9n4Bl0RSBVd4+5s+e93ACAe+nUCCEzfemKmLl1fv+2p5NtAiSJdfBHGWwjI2giSGo/O9BI+ybsBEtPAa0T//rqIBBICRgUygVHd1uEhJF7npCWHDGoO3bD5rHU0nuGORqMilhZHQ7TJHEKIN8P1a6EnUFZemiwMenzvX2xsoanraM4Rn/Y2RIKcsnjhdCRgMAOSDYSqVK+zq7IlZ37qinR/vrpVpR1uHD7EiE+4gTUtyp0y5ZBHNq2UvIorQ5U9eczqyNo0005CvKdj78bEw9epjc6Sul1M3bM8KmWS7bLJh5vOcugvJw4tZvhweKGQHUIQHCgwSg+hwQF5N9UOwk25mw1+0IX9bKWlj2wnraAM+LFL+wu0pT0ZvukzG2bkhtJgiB5j0XfPrlh10LBxh0RqFSYFgTMjKhoZcyC0nl+etS4ieJGrsQSHRm9zyYeS116kEMtulg93iKufqffHQCtTfuIIiwsh/HnAKr2ynYvskRtXxrXe6GUAbzBFL0ACkb5utODnz3krTV6StHS+XuLGUOEs/q+EzeBK68KfBSHFdZ1NIXEo/QizdPWEMAEw2XjMXO9QipPVAUgdQ612QCQm5TJGBJUoZfy25LjdT7n29a9uV3kCsRllFriLWXxv4lYMrghkoY5WEkNN3efieNSu6ijOmPWo/FqBjGyhW6U0vzzzIgs4Ni3wcA5XHXhVKmqJQsy0wSbNg5Xg71qbTt4z/D/D6jdl1Fot2VjlujnVvv1Tj5KVgtw9j2ubNhM03gLhys3AkfQZd2feC7yjnOE2047J25MEvHcJHWQwMj8QlZJIOFCemX9rTxWKog== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: cafd906d-7a0b-4148-5b17-08da66ad65ce X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:15.1306 (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: MILqSzg8n4Nw3O90oniB8DqzxfhGbY75Nna3sRuMylhX2c107GzuIDzNpRxqn1c90S8Rj3UBaqsm+9SYh3Mggg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB8598 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150025_261229_40F9AC14 X-CRM114-Status: GOOD ( 12.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 This allows multiple phandles to be specified for pcs-handle, such as when multiple PCSs are present for a single MAC. To differentiate between them, also add a pcs-names property. Signed-off-by: Sean Anderson --- This was previously submitted as [1]. I expect to update this series more, so I have moved it here. Changes from that version include: - Add maxItems to existing bindings - Add a depenendency from pcs-names to pcs-handle. [1] https://lore.kernel.org/netdev/20220711160519.741990-3-sean.anderson@seco.com/ Changes in v3: - New .../bindings/net/dsa/renesas,rzn1-a5psw.yaml | 1 + .../devicetree/bindings/net/ethernet-controller.yaml | 10 +++++++++- .../devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml index 4d428f5ad044..b87574549df3 100644 --- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml +++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml @@ -74,6 +74,7 @@ properties: properties: pcs-handle: + maxItems: 1 description: phandle pointing to a PCS sub-node compatible with renesas,rzn1-miic.yaml# diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml index 56d9aca8c954..0eb1f3bd6f92 100644 --- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml +++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml @@ -107,11 +107,16 @@ properties: $ref: "#/properties/phy-connection-type" pcs-handle: - $ref: /schemas/types.yaml#/definitions/phandle + $ref: /schemas/types.yaml#/definitions/phandle-array description: Specifies a reference to a node representing a PCS PHY device on a MDIO bus to link with an external PHY (phy-handle) if exists. + pcs-names: + $ref: /schemas/types.yaml#/definitions/string-array + description: + The name of each PCS in pcs-handle. + phy-handle: $ref: /schemas/types.yaml#/definitions/phandle description: @@ -220,6 +225,9 @@ properties: required: - speed +dependencies: + pcs-names: [pcs-handle] + allOf: - if: properties: diff --git a/Documentation/devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml b/Documentation/devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml index 7f620a71a972..600240281e8c 100644 --- a/Documentation/devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml +++ b/Documentation/devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml @@ -31,7 +31,7 @@ properties: phy-mode: true pcs-handle: - $ref: /schemas/types.yaml#/definitions/phandle + maxItems: 1 description: A reference to a node representing a PCS PHY device found on the internal MDIO bus. From patchwork Fri Jul 15 21:59:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919790 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 30D37C43334 for ; Fri, 15 Jul 2022 22:02: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=WZh7sPZhSNle0RsRoN/VFd5Lxx8GzVXwnlx4kpLEqSU=; b=LlMBYwTjIR0F2d CpI8iZBv6jDLihVhimtFQ+qeu4JoHxJ0c7DPOLhMOu6x7g9I0VcdQaDyrrj10Ez3L6OeyLztRZyQP M6PWWAy8++wncNbREOAlyCGqoFu3zXmgCyG3nbPw6gEQB5+OQSxPMYzH1Mu6/plq8X/Bdroohc4qO 4dsnD1WB5IPDkvEGlb2urQ+/UH+idQUONrXgjMKzUPfq3k+6IO3pwpibV66nNTsZVbGR8iu0nj+xn 8TTDWizD+STYcF7sALDf8Re71LEZRnBJ1KqRxorwEsqVfw/5EZsOfbhu+JSGd6H7iDUe8CW/NxTV/ Qvr01sZZqpXhocv/pjAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNE-00AbU1-NW; Fri, 15 Jul 2022 22:01:26 +0000 Received: from mail-eopbgr50055.outbound.protection.outlook.com ([40.107.5.55] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMJ-00Aar5-6m for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:00:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CprOmOyVGob3mQYFzbVK9eOaFG2gVUtqmNuynhSlZo063oStlkpPfD5Lw9S0V7VXuvhwT7eeGAE2F86bC6dAHYWELefuh487ZzhdrARLrGDGAwBbseGKPnwDu42Kmeq02Xjhxjl9/MvMd+SqvwGidCC/qRf+LCBf1AbfNnxPRj+PnOin5Kv30Pycm6y19F/zWbJHq44sLmEHf14BbTQLG2s79+l1cKA5s8yXaAR7sfAWCQdqfhX5A2HGpGcVbxChPjtcODuWGYWYShGeAlyq7VETaVWF0YYFFRxcy5pJR6Zns6NbKOll84snC450koahe4OhyGy8CRFNKIzkkz1g+Q== 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=4oGS0BA7YPnZMylAOCZf6r95AVRgACXITcb4wnUVKXA=; b=VhKNkKBKCUr+at4NEjDhjxKLFcVlcVlp5r4D7UpuU7MCcyZINaL1Qsyf/eRPc882uPU2GPen7HoGs8FbMyGpcJpmKPCz6HVtm3+6d/aXaIwtUWZUsrdIfpsgFhm/qaccWCE6NTzsryTT04I1Nug6HrXjyZ9al/OPIeH4ncTo/VcwxJxqg343aMyZS1iz0JhMuDVDVBtspzQPt7k3R6tGD/G+apzgRGFPgByLL1xjZcEks4q5945AfCm6GhMiXMWSfGTMmPwvKe0XV6NJavJ6Q3yu6XqvFMncwM6EA4I1OhWFZnjDPGJ0RDowwlkpk4+3IIsplhj9GWHtRHrGeqjkaA== 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=4oGS0BA7YPnZMylAOCZf6r95AVRgACXITcb4wnUVKXA=; b=Y5UErRFKHf19CgkUChhPFnC+uQr3crc0zLx3TejHWrfh0OVIdP37pmDKtIBPrfcgjOnxI+NqwqNaGT3HXpBpemrujZ5Enm+x6rJd50D3aPDpzm0d0PQVvKziM4AIBGVqXZr1Mz9nMyAJJfuHftXICySwPWn7Zji1kvwGnEhHCzdsHUKQWIawzLIO9U4OJhOcwTvZlMd4KLL4bMfZAHdCRkmGK1L1NHSFvauuF/reZ7j7COIN34yJ9exF8u0DbvcmXlfyQTYsAxO8FXeh+PeYdIWHzrxT8dFU6L2/gfZ/Tj0STBzxHKDdpybkAK69X8YZblklVKfzjzgTGhHnAee87w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DU0PR03MB8598.eurprd03.prod.outlook.com (2603:10a6:10:3e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.15; Fri, 15 Jul 2022 22:00:17 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:17 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Rob Herring , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH net-next v3 03/47] dt-bindings: net: Convert FMan MAC bindings to yaml Date: Fri, 15 Jul 2022 17:59:10 -0400 Message-Id: <20220715215954.1449214-4-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b529b101-63a4-48ad-4462-08da66ad6761 X-MS-TrafficTypeDiagnostic: DU0PR03MB8598:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jywGjyFbO47exNdp+lBV7Alve3JJMKjhoRNtsFkCS3Ys79gGLjbRxNTUp2sCa+RuoW15Bm/Lh49bZYnd77Fgo1bsDLxjZ5UzLgEJG2qMY31jdfJuENYPQuJyf12bHSCIJWL0UDvZUgN86zG/eG9lUS6QHf7Od8ma478L3ciXv2EMsVySTfERBi81k2Soe9ieg9nBG9UJUsv0MCUHNrH4xdlKxCaILLg6EtZtDjc1QVzivu5A1bY5YDCBI7Occc9HwQ4yMcdestL3QbvPkWrrPBnI86tak72XtN+huxSpN4broxwHdTC+QxIwUsxIFKatUXTqRmw4AiGz1zr4NEpG2GV8m8JVmm/eYs/imlMxVaTn1w4xGEZwcJlGOYbjOu46IRfuV1pUGKQA1n9m+rjXqTN+Fhq4qdkcanlHHdsMqyOamJGZdgzP3sx75PNxzHnzO4U3QLJe2z1z2vb5E9OezofLo85pKTOWJKhXNuxKHK1b4/PvL2Iu9uzFJpA2Lsz5uHZDizu3Zq62Y3cP+fulkmIyf0kbJ0xAzQg1/Qe8zEFRxPZ4QT5f38bEjRkNVt7dOfBzbvysJtaNYTQ7pWHUz/QOWOtMNwlk5SCkmvdhfKMEoye57+38dNgWZGdyPO+Kng08nx+z9ryRPE6JKGD3L9WUoMTwNGtgdiZ4Q6VMT24PMAj689Ma8v+C9O3A2NvDMmPqTkPShZZh/RxaTkzp6B17jpI9rj9CtRYmfE22v0SZB/N+PzkdjPuhSoWThhp4u3vtyOP0Ovx/l29nSCC5d6Fg5Ylm8TEZkcXKINH0EYx570y3PCGPRI28yuBTxa9WHupAlVqydy4hNI8beQ5N8w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(366004)(39850400004)(376002)(346002)(396003)(5660300002)(8936002)(44832011)(7416002)(2906002)(54906003)(66556008)(4326008)(8676002)(66476007)(66946007)(110136005)(86362001)(316002)(186003)(2616005)(26005)(38350700002)(52116002)(36756003)(6666004)(41300700001)(478600001)(6486002)(966005)(1076003)(6506007)(83380400001)(6512007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q1Xmz8dFDVFhr1SBkVhfSDcTqIz5lDQRnO3nteB1//C0fQmw3z3tzK4xCYv2vG4Ox0Q3CB0U/P+4bwksKdtRIKva7LQ5ervOT82+cXP3PWhgLIWywgCNvYTdbZTmpiRCNJoeWE0/cn17zNjMlV/vlGykORVR867H/WRkog9IBQqvwfBdlTC7GYVcgDX2cipHGgtIkBLrY9E+rxnByM0Er4d6paAVW7sg2EgO4aWP10Munp0bNarxU7oQguj93I0sUd6TBpzmMfT/6rd3mvUQ46WZJVmQToB48I+7Dwafm1jEha/UY57Fw56p+dk2XYopCX7NYvIJDSYin+404Dlj+zswIhFPryDMwDRtW9hZlSO87UoXAJPIVQ++XCVi5J9Yq9KbVGV1ZhYt+Nzhh7p6QSibSHxTBieDfy6UvXrtYk/hqdb4zHUZ8I/WRa6vP0yjbmMQuVf6lPpgj3JfVrPhsrUDLdtfOCMqerdNbVV/Fbe9J4nCZ6ry9kWiN7Q+FopjlRJUCMKDCEDLVJO+GBxDafQe2UrkpqHsXHw6ounzFcA/VbIrWSZpbCgAANhjl0EjARqS908Jg0O+hg/t3pwxCnOTZkB1kIOoyBuKvVW1Cd5FghUQ92uUO+iQ5Gxgpix9YRzpIXT3UXLH4Nbr2IIsXz+6kgs+KvgG1AsVO1yfLz8SVwqdttxSFrx7EecwFb1SM5YvRHolZSESWlOo8sCcNgtZV+Q5VN8GJWqEAv7hQN22S61/aZv7MrKk2Z1PfW6W4q3PKBOkFTxJPsg4yVewOIASayS5r25AfSfBVD844CzRhV/5DOdbvDSX0jFHAm2ucPn9mPw0afm1i/4R0l4ZobC8ggFsO4BDQv3G33cSU4cjf3x4QsPbZFx8XpoYQzCcUHLJj2rFDBxaGQu8nL2BcWufRmbEUKCVATgWJiRJlcG0jUqLbKCLxOOrHGXqj4DD06UXmNUJGQfqz6fmM6QehlheG7Xw4jVm/JyX+s281uM5SsgZK9J9tm9oz2nitgr4SllvpbmC3QXWBBESgN+a32xltiWbGr1WhsHCKNPMyDBU8SzZME87jjU68ibqrDwQcum4oCcTZmsp0tS3wBX69Gs82sqN8puAU0Cl/djnndRNbRCqGaiMpPEU7aNwjlC+Eyk8a8o5uFATWam3aLNfvIq2yqK2jJgRr247ff1vfTeYkdsO6LiAmDwpBPa9QJE96tXoFGVWqHNN3l79jCDJ8sK51CR2nxLr13Wa9JPscMEzHW8lrIvXgt0S+AjGFsVoPsis3EMv40i5eWHCS4o42+v8GrBPyHeNwSCmkrxjs5GuidH519xROLRHzKYUlMxk+mReL34Y3zmZhtaq27zIceAl4KNfj8Aeni+myIfzCBGQ8vucJ5fWN4OQPNsxx+Ea8JGqzT+U1KmiDLpVQkrxv/0cjNHVhqHmz5YRbS7nOfGGjXxwAEPjlpzDeSIT8cIfXPQqGIGPEiABgMTm+DmbnTh447NBlb+Hde6hzA7fmNO9S1YvH/RcCmiDfzTYxNqAV2I2Ho8j+tsp3j/PVblf2AQjGU7tccgnzEaUcGdoJFtnRmiba2WDb0xCF0mvKgHkjv76gDqTDGYwAaJNB6QTmA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: b529b101-63a4-48ad-4462-08da66ad6761 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:17.8024 (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: cEnzoxEYczvHTjy6X3PUT4BRavD598tzKl0aZLGwo0thHxiV1EOvhtcIc7HoTJW4DFDeMYc0Ug+WVawIt9xzGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB8598 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150027_285612_4EFDFFE8 X-CRM114-Status: GOOD ( 17.85 ) 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 v3: - Incorperate some minor changes into the first FMan binding commit Changes in v2: - New .../bindings/net/fsl,fman-dtsec.yaml | 145 ++++++++++++++++++ .../devicetree/bindings/net/fsl-fman.txt | 128 +--------------- 2 files changed, 146 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..78579ef839bf --- /dev/null +++ b/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml @@ -0,0 +1,145 @@ +# 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 + +additionalProperties: 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 Fri Jul 15 21:59:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919824 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 AA7B2C43334 for ; Fri, 15 Jul 2022 22:04:32 +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=VQuC7qixm7WzsUQIy2njPOJHvZQ3BTRxtlyzYuXWN1I=; b=dKnO+Fnp6DkDhJ CwL2j2WGzsRszQceAy/LIr2xyjHISuvIQSENAOvLjKV9b7lol8YxlxtCfSFkZbYLbaHY3HkrbSe6L y9oYFR9/akfA8VXl5P5I7gh/PT/wEnU4tQVr73ccrV6cB13d3OIZAzCnwso8M5Hcf3Z8nB//0978m VF6JuDinlHlP67IJaN6FPELNv9fZdeGQ+Dx+W96hQjYMP/InRSDdiFhjJaAW/U5U+ei083p77jbq7 HLiz+KGSgWA20RyHoIOA7JyPoba06MxemhPs8laCrqZh6tGFlJ35bl7lahCMayeTrmIQlij5a+TWB h28QDPEc8RtOjATQceGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTOr-00AcDS-8g; Fri, 15 Jul 2022 22:03:07 +0000 Received: from mail-eopbgr50055.outbound.protection.outlook.com ([40.107.5.55] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTML-00Aar5-Ls for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:00:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SPr/ZdjMjGNaQ7Up96Z9Y6516ci6cBjqYL0QnOhRo2ymCaD1t6NRXZfdwZXCAykMcqnsMYDtl0B8RDna0/E2qYoPR2KRXaMSTGRUtJufJLzG5lezwpiS8CTf+UxQoxmaGmVu2Jjpvwdra3g7qmonhHEpZDDrt4JFXxlYyCzU760BntqQV01Q9E+KoousGyx218Vjf7RGf2OhXEvlbM4GSUt8tX3czuzBg2ZUaaJFUYfbFQ5qzidzcR1mRbXTaD7MKY8frlNiKFX2pc7B76bxNnRWS9TvHbrfADIK4N5cmqUIoFTC6C5b1kFProPx7b/8jEgMbH9e/qMO/rC7kFGWMw== 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=ve9pJWJMASAwB2OXaGeelUfBiI+3VPKgKeX7hfLraVU=; b=dmurX1lVFuzEbFCCM00eOJZwPBnT62g7FdOF9ZBrN1Y+jtZ3W+UlFVobaIzcc6nE+Xq5AHKIbUXcCAsollAeKke9pxtvz+LajkdqaA3/ca3QaP1cb6HSXBo8MovKrb6ffx7+OsA2kMo0N/SU7jtmSz50dgRttRBe3Iu6gS8pb6EhsOfNfcqHok6ZsRIOyC83DCwSNAF9G3lclmOwsgzTs70sRZYD7fw+O+zSQ2pdPEC+r5U/BkgX1EcBJSlHzqhcQKYUk5QOFOMAgQqlURZq7uI88HqPvwK7ogmjMPFE4xvoOerZPOpx7TgwMBEITg3gQTdHQkxG2qCexdMJtu381g== 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=ve9pJWJMASAwB2OXaGeelUfBiI+3VPKgKeX7hfLraVU=; b=kHgD0s579DAeTdsd8jqvLicpGWCpD3YogI5foIy1Aa8Ix/ZxnnOwk/hBKMsGrbJdEsSaibB14cipb8Mm1c7hZRmIdyNJoZMmOA+1vn8LvO/sgOS9XaRLKn3QZDhL3UAYGMBZRbPrTvTVuxeV0i5DFN8ahUNyBcn+ALoxSOwTS8C6J49RHjzqC8ru/+bWfWpGQhtZXJg1mwKTY6MaCUxsPxltgIwf3SMH0yMR9tWZN7yvHkKZsUvbYdQ+s6fDkD2DEw+293lAumENaco7tgg4VkkMBUGVTYYTwrDL+vvzRWaxb9T/i55YQU0+G5Da+A4QXnjnbqYcyoZTOhgf3Bc+8Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DU0PR03MB8598.eurprd03.prod.outlook.com (2603:10a6:10:3e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.15; Fri, 15 Jul 2022 22:00:20 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:20 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH net-next v3 04/47] dt-bindings: net: fman: Add additional interface properties Date: Fri, 15 Jul 2022 17:59:11 -0400 Message-Id: <20220715215954.1449214-5-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2ea68d7c-9f95-4b56-7d75-08da66ad68e3 X-MS-TrafficTypeDiagnostic: DU0PR03MB8598:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G+IRDmspXC0J/Y+w5GUAb8QwGUSAFzdhQWJkUXIOcf8SUgRGFdAR8RlTb1SgzfPbInCwWntlTnd1cfIqUh0ZwRAxoopZpxkidvROI1wudQXXYdO8BnY4ZvtbOjr6U+pBhsscUmuU8ez5cwS+qT9OuJ08lJujw7rx+ONRDVaBEtLCi/GXT3P3fhaxcsD2q9qI4tYk6wF8+ca5lGzsWFuRuIinMJy2h3+MnGL1q7pfq8OSsvEWP+a+C9A8b9On5xM077JZfhbdbXO/jVHk37ycoTF/fQag4JCqAo2lOAh8EFs64kQTIHkEHzM24vv4wAeT1nf4pe4V4sq8h+IzrC+S7ZnKL6b7PPY6BSDNpPQMd3c8JO5mnVaWmHo76Uxfr0G/Q4y026DqpTQnW0GF3aiWmBnhMEu+pbxZ8Z2lWo82jENkxEhZ+PVAP9CiP1ydI97PY//wPg7ulCYqgFG46pg811P9HkQuuPmVGOyOw6oUAHisgSCYV02j65BohHkJL/IpMjM8nVXTqHhVZDmo/X3dnX4KvDIi1opgBPuwosOfctZIhPwfxhvohnpvw34Xx+QJ9dI9sMKdmragPS7B2BVtLew5sCpeYMXYTyL1RRanh5Zun58dXEsHV6lCm6G9kuGk9ripELgo3nv6j0qPJGM8oXQSznRhNBSWQ2tpXI31N8GVRWDrSZPXwKg/W10SxkYiql0351t5fNoH++BQBsBdEVByr0fafjZFzup6ZQUQGASM32ZbJEe2Rv6hBqEXzQNoflxf2xFqUNV+tvabVmrzfLdhkodHVUt4m221MgqPsGjHlbaVuZ6AL+RYHU0FIutH X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(366004)(39850400004)(376002)(346002)(396003)(5660300002)(8936002)(44832011)(7416002)(2906002)(54906003)(66556008)(4326008)(8676002)(66476007)(66946007)(110136005)(86362001)(316002)(186003)(2616005)(26005)(38350700002)(52116002)(36756003)(6666004)(41300700001)(478600001)(6486002)(1076003)(6506007)(83380400001)(6512007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wVV1UL/E+6gGXUUaAAac+GH/cTP6gntEdy4Xn2IPg7Npl/+Lt5rswwa5CEXMueI8BEVjMy9AB0NnLcsx+PkMb3kz/2XqwGLgonWHMsX4/KQ8S6UQSQ1f2GWSV7JveFttpG2P9D0lwa9J7cgyYmu+yMbb8INP5P4aRtbMjLASnFXyHT8aI7M/9HEfeUejb5ziQ+3jmY0UL0sLr2wRU34NMiSKvxaG2RYo6/XecwZ1Ymmem7Sp6JXrw1KdFCuAfQP1pzY0TvSrIWq1OTM2rcoU7MZl1FIIUA+22RWvEneSCgEWGJLYO/n4p1z8MVKFCAYi9fH8epYIMoir7WJ5QF6IXhLuHadnYlgM1Q2rOnPWwapMAEnrDhjSnSua1dLs6i5Hi699X30Vb5FqEn+WkU+aNa4P1qc+SOgKICNc+P9ZMmmJq/uDUcn2IYKEngUp5qqf2EMesxm3EnJXzCIFOgpD2RYQfhzlTFgYcFhe9gLTQXLm7Pedhi6WV7zCjmJh4snvpcmDq1E71xaAPQDCkBEvX2jUxNhbt95/aJQXTvgCkmZbCfczsBmUOUaD8c3N/QYTt4ddmtNGdcxZLBzjAmgMLjxTjrZQkThPjgvVG3HAy9veRxvtCwc3fex/ZqT6izCgIza3yoPMNB+6mrt8c7PVtNJq5Y9kB743RAUTJOeNFxMkVPz0X9BrRWsocpyM15jFgDUp6YMyzYltMpD7qjw5qj/3/LwOgrNE94mvHm4u0mvv06Si1Op5qILYmFY1SkjL/YID2doBYHKleAbq3y+X7F58DrzjhO6niWkQDZ2N+5Be6KLRUHWZdhRhuEZ3Ignh40yp0anh02IqaaG5zVsLqllR2orRbOOIi2IdP3AgtEUwQ4vyRdedTUn/AA/aXGP9TdUpobnPgoVnef7wY9ItAGEE91l3IxLWuUCYyUGXDiV5a7sHdj0a8GgJdmKwzxI1FKY1gyF9ekzCFu671ngPCyneVTrd+/0SMJGZGDMrnumyqaPiQbgXVKFdNSj2VVN5v9YuRShFEN1ay8kjhvTh9dZVZC3w1U100U+VbUrcMKpmhWsdgTK1SFXqcgJ4sxdxMp0Da3gJUl7OleQbE3TpHHdbjRoKFZRk1cX6v4UO2Ga6mJI8DAiVkCj7DP20XFWlj4Gfx/qGDYCSrn3y44zs8pGCjiqRuYefrCnCtB6E7quL8/YkzvKOzzUw5o3boAskcMd2ZM0JmmttK+DfrUNdUU7ql+T+coWiyuSj8k5lLGeGcMdKnK7rRnRHFcyNmu7w/zwmmyfluF/cgCQGqkz4X/ilqXLw6UbK/pZoScvwvqGcoSW7eXtgTHNEWyCda9e7o1VuaBaWf1y/D7gWoBMzz5iYqTZO1/wtOLEkVYO2CswOiqpc8IqdojkOC+S59V3D+LeATAsLCaMYLQT/uf6CKQZ6+8iyH+iWs2IG21lZ4q/a1VnvHW8Mh0Wo3tmb/AIaRMvmzUUhK7gZDCwSQA5IZft/9GvuojHTqrZqW8ZB40wdcA9Dkn856iFMtOfvx4+4kwkr8iuB4T2M/KIgmMtUnz9UIajiCXkh93HzfDeCYo719ekXDVGnawKOARxLBV7ERs+MyNyS3qBOyt7YMiX1DA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ea68d7c-9f95-4b56-7d75-08da66ad68e3 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:20.2554 (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: iGkFXs2tTrOb3Q005D8eo0RVuSh8y48XawjQ07Ds1HWbkmh+AEmANvqEauFFkW7F1akeRjLIE64y2R80qevruw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB8598 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150029_775020_08EBD6E5 X-CRM114-Status: GOOD ( 22.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 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 10GBASE-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. Signed-off-by: Sean Anderson --- Changes in v3: - Add vendor prefix 'fsl,' to rgmii and mii properties. - Set maxItems for pcs-names - Remove phy-* properties from example because dt-schema complains and I can't be bothered to figure out how to make it work. - Add pcs-handle as a preferred version of pcsphy-handle - Deprecate pcsphy-handle - Remove mii/rmii properties Changes in v2: - Better document how we select which PCS to use in the default case .../bindings/net/fsl,fman-dtsec.yaml | 53 ++++++++++++++----- .../devicetree/bindings/net/fsl-fman.txt | 5 +- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml b/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml index 78579ef839bf..4abf2f93667e 100644 --- a/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml +++ b/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml @@ -85,9 +85,39 @@ 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 + deprecated: true + description: See pcs-handle. + + pcs-handle: + 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: + minItems: 1 + maxItems: 3 + items: + enum: + - sgmii + - qsgmii + - xfi + description: The type of each PCS in pcsphy-handle. tbi-handle: $ref: /schemas/types.yaml#/definitions/phandle @@ -100,6 +130,10 @@ required: - fsl,fman-ports - ptp-timer +dependencies: + pcs-names: + - pcs-handle + allOf: - $ref: ethernet-controller.yaml# - if: @@ -110,14 +144,6 @@ allOf: then: required: - tbi-handle - - if: - properties: - compatible: - contains: - const: fsl,fman-memac - then: - required: - - pcsphy-handle additionalProperties: false @@ -138,8 +164,9 @@ examples: 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"; + pcs-handle = <&pcsphy4>, <&qsgmiib_pcs1>; + pcs-names = "sgmii", "qsgmii"; + 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 Fri Jul 15 21:59:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919823 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 E1CA3CCA47F for ; Fri, 15 Jul 2022 22:03: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=ZybRTnXvpgaWuHzVwB5KYmKgfdOcwZowwt5z/57iG2c=; b=cT+4hq5obm67EG x/yP+pbRdNipp3Iyl7pnCjOtHzCE1Tcq3dSWco3zBZP6wbO5pWAg0GIR4kmxUQB6i1da/wOASTKW5 U96Vml8vRZ2s/TzyATQiDZfIJvtYMC+uqFShc4PRPRue1ykIN1NAgrptIyo9Web/ENOi861S3t/hL Kip9JCTwrd8csVnHQbp17vceg/7f0+qR5QFeSDbyv07uil+RAt+El/ZsAyIktDs/IvQji6RSPJFai jkSDO2vXtZD3ahhrs3D6tpnU6v3PGwyv0NejI2XW9jZ8NLbDsTASXuVCdtuFIpyAYHliPsNzU0TWD vqefA6DArk4uDczxri6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTOD-00AbzK-Rd; Fri, 15 Jul 2022 22:02:26 +0000 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMK-00AaxO-4Y for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:00:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KJBLXH+IHgUDvHAHFuongdKV0j09zXHTBQKQsqD3tnJlHfxzB7SgNHGpdKly5ct/wzri328a7O3MBNwz8x9v28NwlOIMPivGg3H0MJyJtFUJ7SHX2GHr+Up0zNdAYYwZusBy/JZ/C477srURtZVzxAZu1EB0Bo4WQpHIhkG67xvG51U99CItQE6mS6hGKb8RJrHWKxRjrMRljCiK44Nsq+jJ/c1joBe4FekkhYTG5jyjPhTNX1UzeCPf0Atiakuh/OH1PRI3/gGXqxSxAzBCAEIy2DB3qyFfuGmxSFSWp/5FVqij9PuZfnNOEY7bzj/orLMDx0Evlibh+VvthbAqCA== 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=uXQ9opzBr06BLL1ikcEru/1VsrmTN+Awo+3ub4RTHmY=; b=LwMwvJIfr2M7Lnbya9nhNIID0HJfkWX3O8wKG++WO6mJgBTPGaL+BPHKOeZqOlRrTS5msFjgGiKcG6cfiKuMS1f9B3tQf1KTL1wqJFGCzsgM5ihv2gXHIFvNsQmwMtTbltBmqKWORacOLCVejwFDnGbD9Fb27lu0Uu1J3VrL+q5jztUGwavGCtXF7AgxqRR2Pd2pv0Cp7HKNaVDPA142gMZVWHuKhWEd1QJ5ECiQY77bM36dwjdzVqIXRnoE/cducvg+Ov2jiGWW7a9vuiklFQfCuA7cdtHFqdVdGypPtyrWSAqmaRTH1ETp5ENB2FEicb54aRrgBeyBS4OGBRz5TQ== 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=uXQ9opzBr06BLL1ikcEru/1VsrmTN+Awo+3ub4RTHmY=; b=lHjGeCT/Rfvo64xmLR8BHZVNqTp14jo+h5M2rlPXt8LgNBfuw97mgfeQI/TwvMXgNcj2HW7ETVCNvETpak6X7cNFnEbYcHJx/fRIsYVsks4FFIgtOFCOjuhrU9BvQFWeh6ZTAzRD6JpwyMz2B0lyfBDfgfSPKfDj0cfKoVMTAAsPMr6k9xQKa1wGfQIx2i+PbtLKiYJKKCieEa3HsDDR96YvG0p5pT9cbDd6L9chJWaqyGQW7qDW10xYa0lwciqQvnRGAo6VxsYa9ZyDlslHVjI06wHvDglUxisnsSL2hi4XDJHlvjMVlsI3/KVZnIGNV/+HfKb/P5H12O4a6n93Sw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DBBPR03MB5302.eurprd03.prod.outlook.com (2603:10a6:10:f5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12; Fri, 15 Jul 2022 22:00:22 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:22 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Heiner Kallweit Subject: [PATCH net-next v3 05/47] net: phy: Add 1000BASE-KX interface mode Date: Fri, 15 Jul 2022 17:59:12 -0400 Message-Id: <20220715215954.1449214-6-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1d275da1-effc-44db-07ca-08da66ad6a36 X-MS-TrafficTypeDiagnostic: DBBPR03MB5302:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AyIxQWHQjNJWqn683cGZreAdiM5rsEzmGNAZCNdkQ//AKuenEwV4ennpbS2ipeGhUDQEb4bMcoaYo+DCMJWWe022eITKmWm89AWxnQ9+f2r/seBdeQlsWf+caPhU2wfIfGxHFN5X8EQWvSqU6hVNrLC/kA3haRCdO+DkbBB2XuecVWO34Cz07yQ4qdsYkNoaJ2xKsnb6/uZVf3p97WT44k4o+bhmlnbvtH3vz0L9EsSSLjpE/uu1Hn1it0AxWsBARQaks+PzJZEbNLZl9Os0v01A/IDL4QC5AXEa4AnRrJTL1UIEdCgvnKamaAQUoxtf/Xp1hdPnYwwEEOTt10QtrdRVEHzcuvxdBgsROao4SxJJzgMCMe6Ha8+t153zBKnN990IkVAlsacrHQEF5HCO8AjPEoJ4Z9KcVL4FlxKxIj64gksLj8DWFjoBe4yQUNwNqMJVgyXhj/R7Vxn5oNLQupn5UcB3d/u8JHFyXnh+qZiqng2kiNHxgPOSvxaGFbv8MzobVFiv4DTU5ga2NGzVwQfzUai8m2fFs911MTKcll1XNkUEgZ3bAVgphLNv3nyVQgfaxhix6uPgFqFkq/f5unXOBIGN70ljvBoGs0UFEq5CMP8WbrWyggcscK3F2ZjpCKAGvhdKiTEjBEKvrGaJqMxOKhfk+W0DO5PBwtpspqjv10DdRr7Folnld41iqCJVI1LCnXQuupkPexXrpn7mJq72x6jb6OcjOBeRpZHa04jfKRAEcwX4h4wnnW0K9WDbnU+aOCjIyf7/C7/celJ9YfwkLJa5tZKrGqVQAlDYk6Qt42Mi8FZiQhoDfCHPEhOy X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(366004)(396003)(136003)(39850400004)(346002)(478600001)(66556008)(41300700001)(66476007)(52116002)(6506007)(6486002)(6512007)(26005)(8676002)(6666004)(54906003)(86362001)(66946007)(316002)(8936002)(4326008)(38350700002)(2616005)(1076003)(186003)(7416002)(36756003)(110136005)(38100700002)(2906002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hLcB2g7OULU7Pyd13R3JavXXJQ24naiY9weqkUXpWe2FoyZlWoAqNoOUVmke34XO2EwALeObuHRd2UomSF8IR0cHJf4Gi7q0ycNhfmdhB4fGjuQe+77WKEwBqL3Gqzq5AUbFRlLArP4KRF4S+0NlxfB/ugRffN6WXKifB+Ccx751doP2j2PmBHfK51B26j5ppyuJJo4XvOuooZdMUro8RmiJ06uO0han9YqoHgKkSGTx8c3MBnIpgc9sKGb2pNEhEkW/n9HAwNRB2mU2YJ07xDvRUbSDUgHbCf/jbMG4DBZvwthAnYIpv0xPssz/n7AxjZ1UprsfYZ4wQPrd4njjZY88lVJEF/K5aeYmMukqMtiKB7iRa9b8NdemXm1ahjGQ6TApPs7jtv2dfGqE9GwFqPlqrRsulYVGtm4xchGEhOCjfaA+kcf9BeX151deaYCHlIGHZa7Q86NaA4X7yEYG7SPX6L0xFDkWDZA3YaZLy3BUjptJ9dDEVRiGlZvpS0DIPOv5JXmuZSV2jOhDua4K+Fwg/wYic+9EQq/fF+J6kpbxQCjlqXmAV0RIhEmBf163bIc/TMtT7naHDq6JTFaYNuT2tFyz8P2bd2DLOKWzqsZ3NNr+DHpaIkJardx3jfGDueOzsxTHIu7Un0NnUroY+nMDp2+VrV57m9Zvp0hrotZDzwfq5tZ/1M4nB3hEzUP+sEU6kdXkXLhrDVidAvVJiEpHH9Ak75ScAkqtTIsHUxR7vzO8CBf3XKdgMIjcZl4WsiYAUxOr6uPPgShOKFSArfGJlHPybUS52bZYFU8ITy6KhOieVvOds95S2AUS+rSSMXjtpPJcWpiiM2gb12aB0fWJMBnNQurKuKoLJptzHhdN3l4/pXbOyTN8LItqX4Mh4M1FVJldFG/SbgLhN48irtU4NzXN1cXXPuBc8KErINi4vc3OxjZL80/on3Mruqka8T1L8uINZXHiskDyZ+mFEs6YQ+ilfatasTfqaa2k2PY5rGc59LGPeIbeLKZVEsXnPPluV+lnUVsGSL5shQdWNouOLFCSo3/Hpnjkd0G+eVDMZuMpWPNCfZzYFoOH7l9Qzo5iTFHca/wTM7sd92iIaqVSNtkWMr4RsXoaKvyAnEo1JCIrGKCrRts8I+FD58v9Qea4s5iBVZ2tqhtfnMmohvpphShNC1meSH5n1JsjuOSdthg42qCjxScsnqXMN2XA0S5R1OzkVwOVi9VNMgsRHw8IlfzRKl3L0y/1JgixiIngC9UWQl1/3+ef1fhCCgVWwuH8TkpY4SWkgo5ekmhhtH3uzQgmygL0/HQau5tii+s+UhzbRfV0Q3R0uIHuIDmH/WQyOCfNfK+7hqsG4cyqm6M0ojWV9Py9UPx9EFncO++hThliZRyGB99n/+loqCLtUItqGu/jl+HrlHqSZc8ORyaKh+J1uh71lR3DXIbtUMgjW1Jd+d/5x/0RXgLjgYG4LTk78geiLa+K46Bk3pGSxsTLAII3WncnzPXS01v9xF+YX3Ph+dYi3iX16Wt6Sn5lCDOCMWojT0Bm1js8+wFiPnP2F2eGOlsplrsjp+nggmRIwiRDrKSyOYZyYRXda7cw2iVLXX8qmtXWgphNKJb8+Q== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d275da1-effc-44db-07ca-08da66ad6a36 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:22.5053 (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: Q0zObRK9R6IQpJwkNrHa/c+m7XEBeHdtzeAZZJHcDhj4WRudDmwK/bb1Bepv+9vW7Zqe/qhXD5c+kYAbsvGwUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB5302 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150028_226806_517CFEB0 X-CRM114-Status: GOOD ( 10.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 Add 1000BASE-KX interface mode. This 1G backplane ethernet as described in clause 70. Clause 73 autonegotiation is mandatory, and only full duplex operation is supported. Signed-off-by: Sean Anderson --- Changes in v3: - New drivers/net/phy/phylink.c | 1 + include/linux/phy.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 9bd69328dc4d..b08716fe22c1 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -344,6 +344,7 @@ void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface, case PHY_INTERFACE_MODE_1000BASEX: caps |= MAC_1000HD; fallthrough; + case PHY_INTERFACE_MODE_1000BASEKX: case PHY_INTERFACE_MODE_TRGMII: caps |= MAC_1000FD; break; diff --git a/include/linux/phy.h b/include/linux/phy.h index 87638c55d844..81ce76c3e799 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -115,6 +115,7 @@ extern const int phy_10gbit_features_array[1]; * @PHY_INTERFACE_MODE_25GBASER: 25G BaseR * @PHY_INTERFACE_MODE_USXGMII: Universal Serial 10GE MII * @PHY_INTERFACE_MODE_10GKR: 10GBASE-KR - with Clause 73 AN + * @PHY_INTERFACE_MODE_1000BASEKX: 1000Base-KX - with Clause 73 AN * @PHY_INTERFACE_MODE_MAX: Book keeping * * Describes the interface between the MAC and PHY. @@ -152,6 +153,7 @@ typedef enum { PHY_INTERFACE_MODE_USXGMII, /* 10GBASE-KR - with Clause 73 AN */ PHY_INTERFACE_MODE_10GKR, + PHY_INTERFACE_MODE_1000BASEKX, PHY_INTERFACE_MODE_MAX, } phy_interface_t; @@ -249,6 +251,8 @@ static inline const char *phy_modes(phy_interface_t interface) return "trgmii"; case PHY_INTERFACE_MODE_1000BASEX: return "1000base-x"; + case PHY_INTERFACE_MODE_1000BASEKX: + return "1000base-kx"; case PHY_INTERFACE_MODE_2500BASEX: return "2500base-x"; case PHY_INTERFACE_MODE_5GBASER: From patchwork Fri Jul 15 21:59:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919825 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 31914CCA47F for ; Fri, 15 Jul 2022 22:05: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=N8AwXp2xpnFltzWl2TDJBPX2JwDMeBbWLJLKx6xkoi0=; b=ZnPVh/tmUDsygA EIcNKcn1iVmV9oabD/xac3Op/yz/v2XcssKYnMxYNPCouQYce0kulgrNtV5PDyTS52eHwNrXHKO13 2tkFC8DlCPjIM9QCz1yixwp+2NoKrI+rs/JKAkaYEmp3y4CFZBXVu6rzAcqEYBYHBN6ZEOF1uZGVg w+k/hf83tPS8kHpO5SmVnS5Yly5cuTYX2lzY2rTZnF+oT56nw6vHuw1t7UMApVMlrxM97Sps+IyoK 61T8MbApCWSME6NdxOS1cKiYEMZBoEBKS0ESV85S6I74Rndg68DbCsa4lpD+mWZi3apvTsONl8+Re klACYi5qA9JV3m4FOMsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTPP-00AcRS-Kc; Fri, 15 Jul 2022 22:03:39 +0000 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTML-00AaxO-VW; Fri, 15 Jul 2022 22:00:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AyDEpGnYh6yHoHVJ//NLrocYW04NVGGBqHTU3px8qUkBfKYDdcVZ0DCtXqTXL19bhwZEFKGFgHXS3VcuqLlFZZB/XyFxbwRc27XI/nFdPt96fGCIZmacZUK4IN3OzyfRNtLpchQ+D/3PEyvzMCgoyQ1QE3i32lf29iEakMUgJHYmZsQfAP8PJMbRqkjUB5Y8FMJSCopI89wGlbzN+R2zE2hQy3dIG8tmODcvRsSEjvaSyhUuD+o3Tg2IWBK5Jnp27XJN48aUusUfLUsgpIs2R1k2r6zRX+5r49e7r4R/CaCoWqPCgAzxLrA6C8DLCD5+IhO93gXhJrv3rAqxW5PGYA== 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=nhXYKzwGmvPyofrMP2vBV1cm1Pa0dwO5x068v8/itII=; b=jQvqHMufqlVHdCaLvNXFJ1TMH7NmtU4xGl9Z84tUkCjObOjZ62swbKk2g/Ni+blBGVhPFIwMP8Pu00HoktrBwoEoG6qoMwRCalzGBhQfjiHNfWy/0EfXfwWeKYYNihVLYC81fQpUAMiL+LXifOgy3zsssVtzmp1WRmJjF79Xju3DL7J9nUiiC4yF8mo2HoL4AkRk9JFr269LLWulekapgIUhZAj2tEwT66QSd029UTnvyxnk27Ym7hfSo+YlHFihU/CreCYqPRxrjrDINQhQG684/tyVpOQ+c075/1zGqcGzKr1TO5B5NCI685aBWKv7UTFI+8LK/uInpnoTw77dZw== 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=nhXYKzwGmvPyofrMP2vBV1cm1Pa0dwO5x068v8/itII=; b=LzKWQYfBVVHWdHYIYI/eVOUGS4h0Gq3xgSCzFjSsARH+rrzCsO12Y/sc63/BMhxU/IrQHMBaKEgatE6o1ljcVz89zgjo3g+idb7MqIGKqTtbi4m2xxtbyL/HUpp2PhVU2B2n7KOb3FOZxvkGwSUWE0u6fFV69wh7yWBgxoB9v+GC2N9xOE4vXsoqMaya3dGpcMJnVGuNHOSSBs2ZGJtqgQ+enjgSfYVcEHthNU+UUTIOqleB8mF17dvWyM2J67MddleT2CABl965NexeLc53nr4kW9wQuwynhZB9fs5vql0QClehqIK4PrxFXMTv0bjAITOxWYlXxegl2amiMo1vIg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DBBPR03MB5302.eurprd03.prod.outlook.com (2603:10a6:10:f5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12; Fri, 15 Jul 2022 22:00:26 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:26 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , 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 v3 06/47] [RFT] phy: fsl: Add Lynx 10G SerDes driver Date: Fri, 15 Jul 2022 17:59:13 -0400 Message-Id: <20220715215954.1449214-7-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 688c4eb6-72e6-4c8d-12ac-08da66ad6c2d X-MS-TrafficTypeDiagnostic: DBBPR03MB5302:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uLL+kWA25QbsWEfqwT6SyiziYX6eEL5BeCrgJ4cWPj+ZiU4f6oEdhdnKCaoyvenH6wFJKnbPiO2FKJQ+VJfPFhP4D/5p0VDX3WuA4mH6cbzsAR9L5eEWn4Fu7xKzYQK4l/JeANr1GeGOxqWV6M3EBzxbat1Rc/JmVucfMS0/CQ1sgLP9sR2hWKMZNSZ21NT3zi3gdXzwBvJaZ6aVowVcinn0qE00CM+3aQ5n9PZVDBnSHfaX04U1QVPYmfb9YTyMbF5cX000tWPCQa4XkgKwnE3bP5g+5WR0sGaJDmZXX2H8TuLn3zCb9+ByYdEFvsCzEM8JfZu/gMGZT8iBUHggdFkH3qKIMcIlKJqMCH5bV8PSACg1BQNKzqa0I2tBFiS8qPdb0c4Pw2DiTFQI6zsGkskl1n4tk5UmHeNyf13LFeE50kM1ylE1Y1kM/wu9oS8LdRvoOJuatbNy6ebqQ6EoHGBq9Fh+Is3mfgCegl3+THDQN+uKi1b9M8PDbpSNaRtF67M8iw2rFMVS/EDKexmXHUP6n9POyxNpsV8W9CAghYN2UCzBWPHYVl4ksUM6iZmH/jpGnWJDeFLJd82MeZW3AVIFZQNUQ03orSN4guJvLZMU0zkmVXhtwl49reRtHTEM0b1d/nezaPZ5UTN6aqzfg9hmaqnoF7jbWQ49fm6SpFmbCyCMBm8FqhAzUTScsjXNAWu7erp8Q8tplMH1kvh3zXSyu7PGSsDy3tdT2hOMCWmD44hSYtjicciMTRNS/mmrKMMNDD6ugqmT+GaDFVqDznA7b81kVXICFaxWP+Ec734O8RCZlYO0litwb2VUnNKRK1woS93pfqcN+3RD89W3d8aGDaXYJ2Jkr97RjaOZ0EQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(366004)(396003)(136003)(39850400004)(346002)(478600001)(66556008)(41300700001)(66476007)(52116002)(966005)(6506007)(6486002)(6512007)(26005)(8676002)(6666004)(54906003)(86362001)(66946007)(316002)(8936002)(4326008)(83380400001)(38350700002)(2616005)(30864003)(1076003)(186003)(7416002)(36756003)(110136005)(38100700002)(2906002)(44832011)(5660300002)(21314003)(579004)(559001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Rj7EDFLsSyMvtwqKmxf+TpozdJxNk0k4mVAf+ytETDaKgav+e+NSZ21caqWFT4u5nBYjNmT7Cg8F1nmeMy0LRadCgBrLxjFeCI5rPSF9n1yuKcVKl6HKe6n1r8zxXF2eKzpo9pyOydvzkl1LAOrEM9Me0USZIr/zJ7HXoUmmBgYvX9UhxM0/U13ETJPrUkg44OjIiFxJJFSenJ8l1OUKecnlcO9T9PmGqPpR1dEHsjOtG2p5LcZhSvJ6qhw/QnEx/uXyWWXA0TmXrx7x0JZiML28iJ+Ak9lb2znP2ex/VzEBY+jYYwg523W9VRhm7slhRprzRYotD4t9PwuRMjVDAokuUWl1C/ZhQSc8ekhwKzn8Ev8C+lFaMw+vgVzOtrH1dVuylk/OQzHD2Pn7IC1Vp1xvv6e2amVxMoxT0l9ZK3P5JHdET6hqIeCjQAZ05Sdx6jraW11jv4fwuhcQJWWaCw/EkGXxlzXEMXLxfjS2I/S0T7SdYI5xmnzRdN29H/dCVE5NKVHGnUfwwOU51b5Bn9/vfSc+xg23gQV7rk0o5UQ4exPX1hTv9cLddeMhWgUsoEO29HpY15emUNfyvVQprs3uGUQdcrlAQWaRqeP0Y1T0taIQbYboAVPBM/nAtcaDmZTTmDtufN7phpbhULdU9cZYDVvdn06ZrGK1nuQcDd/NXbt3WnZ3nL2A2DaSU71Wb6UxhsPdxsyHmIUgvrkn8O4f0LYW+9mokmJkGzqETGRYAGKxwcxkh/MdTp4uKRAXKNgn9TXiSlC5rmJ27ePTYnGXrvSmzTCcZogQSfIbSFJNDf5utZeVQPgXDGVxAHc520bntmt9ChuDpnn43XdpnerERlK2SnEmD8buYu1+UVo8O4dTSs8WhjrK5U3lg2k9nnoujmlfh42fD5mFf+ZCtQwQBLVWuLa8EuciaHoQL97FkzV80MeA8Y47BlcwoxEQSy2lyAYY/8gHhmZSqwqPkjNgcSyLQtWG1Pnnmdjt17Wsj1uEcUVh5D0Tas1Vm/e6vati1Ut0kDMGQPjoFOYTIxwTcujthsz2u02Qtnrvkccw1tkXz+TgcnMwEUYWuc6CWF+CWC2clsueFeiT6GlkgJDzu3ObHV4UZ6w9BxdzPKGS0DrhXfhY2aONRcUzL9tLnK+jaYLxjh0SfGHR4Pri+zJ02oKXvOghBNAvD7kq66OU6jHTJ3gmKwZq5meoVQNq0HeKJ5ZemoSaLOxmRrhCCLfO6/cf9w/0du93hYp6/Q8K72OpubRfUVdOytX0lxJ4DAVuyjTsmqYlztQIob3TSOZj5a3fHUCIQakJ5OW+krXBng0lPnAf+nosaZ4OU13oDXe6lou5TpdE4lcd9ADcf+YEqCZh8qkf2Hi82M/59ODj9KQUY15MEfEj7DDeWeyRBbioGZk7Xnsd3G8+gRpd5Br85n8xuKIQsNgwkWsgXszqGtM24l44kVdu3S6BSbYW6Owvv1W6k2vgRtSnpokyCq9X1y3eFCPw0rChdfkdocfHsmv68FX0elk4BecYE95leeRi6DGGKGD2YhBwmwoopnJKQIbBwXO71fbKjoEXBb1tXRql2tJcSpFXh8CwQPaqr//I3K9UbTHCnsrnwogXNg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 688c4eb6-72e6-4c8d-12ac-08da66ad6c2d X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:26.0364 (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: zJLkyzZcv4s6YALCdSJ+HDnZ50UnoKJ+AR9U44ZwD6Q7e2AbkuszMsSyxE5X+EFSHHX38ObddQJKlScGbkEhMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB5302 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150030_298755_CD8B7EF1 X-CRM114-Status: GOOD ( 36.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 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 and LS1088A. 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. Most of these protocols should work "as-is", but 10GBASE-KR will need PCS support for link training. 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 drivers 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 (backed by struct lynx_group), 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). The earlier PXXX processors appear to be similar, but have a different overall register layout (using "banks" instead of separate SerDes). Signed-off-by: Sean Anderson Reported-by: kernel test robot --- XFI does not work when not selected in the RCW. This will not break any existing boards (since they all select it if they use it). Changes in v3: - Rename remaining references to QorIQ SerDes to Lynx 10G - Fix PLL enable sequence by waiting for our reset request to be cleared before continuing. Do the same for the lock, even though it isn't as critical. Because we will delay for 1.5ms on average, use prepare instead of enable so we can sleep. - Document the status of each protocol - Fix offset of several bitfields in RECR0 - Take into account PLLRST_B, SDRST_B, and SDEN when considering whether a PLL is "enabled." - Only power off unused lanes. - Split mode lane mask into first/last lane (like group) - Read modes from device tree - Use caps to determine whether KX/KR are supported - Move modes to lynx_priv - Ensure that the protocol controller is not already in-use when we try to configure a new mode. This should only occur if the device tree is misconfigured (e.g. when QSGMII is selected on two lanes but there is only one QSGMII controller). - Split PLL drivers off into their own file - Add clock for "ext_dly" instead of writing the bit directly (and racing with any clock code). - Use kasprintf instead of open-coding the snprintf dance - Support 1000BASE-KX in lynx_lookup_proto. This still requires PCS support, so nothing is truly "enabled" yet. Changes in v2: - Rename driver to Lynx 10G (etc.) - Fix not clearing group->pll after disabling it - Support 1 and 2 phy-cells - Power off lanes during probe - Clear SGMIIaCR1_PCS_EN during probe - Rename LYNX_PROTO_UNKNOWN to LYNX_PROTO_NONE - Handle 1000BASE-KX in lynx_proto_mode_prep Documentation/driver-api/phy/index.rst | 1 + Documentation/driver-api/phy/lynx_10g.rst | 73 + MAINTAINERS | 6 + drivers/phy/freescale/Kconfig | 19 + drivers/phy/freescale/Makefile | 3 + drivers/phy/freescale/lynx-10g.h | 36 + drivers/phy/freescale/phy-fsl-lynx-10g-clk.c | 438 ++++++ drivers/phy/freescale/phy-fsl-lynx-10g.c | 1297 ++++++++++++++++++ 8 files changed, 1873 insertions(+) create mode 100644 Documentation/driver-api/phy/lynx_10g.rst create mode 100644 drivers/phy/freescale/lynx-10g.h create mode 100644 drivers/phy/freescale/phy-fsl-lynx-10g-clk.c 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..c9b7a4698dab 100644 --- a/Documentation/driver-api/phy/index.rst +++ b/Documentation/driver-api/phy/index.rst @@ -7,6 +7,7 @@ Generic PHY Framework .. toctree:: phy + lynx_10g samsung-usb2 .. only:: subproject and html diff --git a/Documentation/driver-api/phy/lynx_10g.rst b/Documentation/driver-api/phy/lynx_10g.rst new file mode 100644 index 000000000000..aa445911d77d --- /dev/null +++ b/Documentation/driver-api/phy/lynx_10g.rst @@ -0,0 +1,73 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=========================== +Lynx 10G Phy (QorIQ SerDes) +=========================== + +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 `, containing the +number of lanes in each device, the endianness of the device, and a bitmask of +capabilities ("caps"). For example, the configuration for the LS1046A is:: + + static const struct lynx_conf ls1046a_conf = { + .lanes = 4, + .caps = BIT(LYNX_HAS_1000BASEKX) | BIT(LYNX_HAS_10GKR), + .endian = REGMAP_ENDIAN_BIG, + }; + +In addition, you will need to add a device node as documented in +``Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml``. 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`. Lastly, you +will also need to add the mode to :c:func:`lynx_parse_pccrs`. + +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 +protocol. 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 66738c8330db..085e110da079 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11799,6 +11799,12 @@ S: Maintained W: http://linux-test-project.github.io/ T: git git://github.com/linux-test-project/ltp.git +LYNX 10G SERDES DRIVER +M: Sean Anderson +S: Maintained +F: Documentation/driver-api/phy/lynx_10g.rst +F: drivers/phy/freescale/phy-fsl-lynx-10g.c + LYNX 28G SERDES PHY DRIVER M: Ioana Ciornei L: netdev@vger.kernel.org diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig index f9c54cd02036..fe2a3efe0ba4 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-fsl-lynx-10g-drv. diff --git a/drivers/phy/freescale/Makefile b/drivers/phy/freescale/Makefile index 3518d5dbe8a7..bd54ecef8b48 100644 --- a/drivers/phy/freescale/Makefile +++ b/drivers/phy/freescale/Makefile @@ -2,4 +2,7 @@ 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 +phy-fsl-lynx-10g-drv-y += phy-fsl-lynx-10g.o +phy-fsl-lynx-10g-drv-y += phy-fsl-lynx-10g-clk.o +obj-$(CONFIG_PHY_FSL_LYNX_10G) += phy-fsl-lynx-10g-drv.o obj-$(CONFIG_PHY_FSL_LYNX_28G) += phy-fsl-lynx-28g.o diff --git a/drivers/phy/freescale/lynx-10g.h b/drivers/phy/freescale/lynx-10g.h new file mode 100644 index 000000000000..882ab9da00bd --- /dev/null +++ b/drivers/phy/freescale/lynx-10g.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2022 Sean Anderson + */ + +#ifndef LYNX_10G +#define LYNX_10G + +struct device; +struct regmap; + +#include + +/** + * struct lynx_clk - Driver data for the PLLs + * @pll: The PLL clock + * @ex_dly: The "PLLa_ex_dly_clk" clock + * @ref: Our reference clock + * @dev: The serdes device + * @regmap: Our registers + * @idx: Which PLL this clock is for + */ +struct lynx_clk { + struct clk_hw pll, ex_dly; + struct clk *ref; + struct device *dev; + struct regmap *regmap; + unsigned int idx; +}; + +void lynx_pll_disable(struct clk_hw *hw); + +int lynx_clks_init(struct lynx_clk clks[2], struct device *dev, + struct regmap *regmap); + +#endif /* LYNX 10G */ diff --git a/drivers/phy/freescale/phy-fsl-lynx-10g-clk.c b/drivers/phy/freescale/phy-fsl-lynx-10g-clk.c new file mode 100644 index 000000000000..dac5d2872a27 --- /dev/null +++ b/drivers/phy/freescale/phy-fsl-lynx-10g-clk.c @@ -0,0 +1,438 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2022 Sean Anderson + * + * This file contains the implementation for the PLLs found on Lynx 10G phys. + */ + +#include +#include +#include +#include +#include +#include + +#include "lynx-10g.h" + +#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 PLLaRSTCTL_ENABLE_SET (PLLaRSTCTL_RST_DONE | PLLaRSTCTL_PLLRST_B | \ + PLLaRSTCTL_SDRST_B | PLLaRSTCTL_SDEN) +#define PLLaRSTCTL_ENABLE_MASK (PLLaRSTCTL_ENABLE_SET | PLLaRSTCTL_RST_ERR) + +#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 PLLaCR0_DLYDIV_SEL_16 0b01 + +static u32 lynx_read(struct lynx_clk *clk, u32 reg) +{ + unsigned int ret = 0; + + WARN_ON_ONCE(regmap_read(clk->regmap, reg, &ret)); + return ret; +} + +static void lynx_write(struct lynx_clk *clk, u32 val, u32 reg) +{ + WARN_ON_ONCE(regmap_write(clk->regmap, reg, val)); +} + +static struct lynx_clk *lynx_pll_to_clk(struct clk_hw *hw) +{ + return container_of(hw, struct lynx_clk, pll); +} + +static struct lynx_clk *lynx_ex_dly_to_clk(struct clk_hw *hw) +{ + return container_of(hw, struct lynx_clk, ex_dly); +} + +/* XXX: The output rate is in kHz to avoid overflow on 32-bit arches */ + +void lynx_pll_disable(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 rstctl = lynx_read(clk, PLLaRSTCTL(clk->idx)); + + dev_dbg(clk->dev, "%s(pll%d)\n", __func__, clk->idx); + + rstctl &= ~PLLaRSTCTL_SDRST_B; + lynx_write(clk, rstctl, PLLaRSTCTL(clk->idx)); + ndelay(50); + rstctl &= ~(PLLaRSTCTL_SDEN | PLLaRSTCTL_PLLRST_B); + lynx_write(clk, rstctl, PLLaRSTCTL(clk->idx)); + ndelay(100); +} + +static int lynx_pll_prepare(struct clk_hw *hw) +{ + int ret; + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 rstctl = lynx_read(clk, PLLaRSTCTL(clk->idx)); + + dev_dbg(clk->dev, "%s(pll%d) %.8x\n", __func__, clk->idx, rstctl); + + /* + * "Enabling" the PLL involves resetting it (and all attached lanes). + * Avoid doing this if we are already enabled. + */ + if (clk_hw_is_enabled(hw)) + return 0; + + rstctl |= PLLaRSTCTL_RSTREQ; + lynx_write(clk, rstctl, PLLaRSTCTL(clk->idx)); + /* Wait for the reset request to clear */ + ret = read_poll_timeout(lynx_read, rstctl, + !(rstctl & PLLaRSTCTL_RSTREQ), 10, 1000, true, + clk, PLLaRSTCTL(clk->idx)); + if (ret) { + dev_err(clk->dev, + "timed out waiting for reset request to clear\n"); + return ret; + } + + rstctl &= ~PLLaRSTCTL_RSTREQ; + rstctl |= PLLaRSTCTL_SDEN | PLLaRSTCTL_PLLRST_B | PLLaRSTCTL_SDRST_B; + lynx_write(clk, rstctl, PLLaRSTCTL(clk->idx)); + ret = read_poll_timeout(lynx_read, rstctl, + rstctl & (PLLaRSTCTL_RST_DONE | PLLaRSTCTL_RST_ERR), + 100, 5000, true, clk, PLLaRSTCTL(clk->idx)); + if (ret) { + dev_err(clk->dev, "timed out waiting for lock\n"); + return ret; + } + return rstctl & PLLaRSTCTL_RST_ERR ? -EIO : 0; +} + +static int lynx_pll_is_enabled(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 rstctl = lynx_read(clk, PLLaRSTCTL(clk->idx)); + + dev_dbg(clk->dev, "%s(pll%d)\n", __func__, clk->idx); + + return (rstctl & PLLaRSTCTL_ENABLE_MASK) == PLLaRSTCTL_ENABLE_SET; +} + +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_pll_to_clk(hw); + u32 cr0 = lynx_read(clk, 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->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_pll_to_clk(hw); + u32 ratio; + + dev_dbg(clk->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_pll_to_clk(hw); + u32 ratio, cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + + dev_dbg(clk->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(clk->ref, 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(clk, cr0, PLLaCR0(clk->idx)); + return 0; +} + +static const struct clk_ops lynx_pll_clk_ops = { + .prepare = lynx_pll_prepare, + .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 void lynx_ex_dly_disable(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_ex_dly_to_clk(hw); + u32 cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + + cr0 &= ~PLLaCR0_DLYDIV_SEL; + lynx_write(clk, PLLaCR0(clk->idx), cr0); +} + +static int lynx_ex_dly_enable(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_ex_dly_to_clk(hw); + u32 cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + + cr0 &= ~PLLaCR0_DLYDIV_SEL; + cr0 |= FIELD_PREP(PLLaCR0_DLYDIV_SEL, PLLaCR0_DLYDIV_SEL_16); + lynx_write(clk, PLLaCR0(clk->idx), cr0); + return 0; +} + +static int lynx_ex_dly_is_enabled(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_ex_dly_to_clk(hw); + + return lynx_read(clk, PLLaCR0(clk->idx)) & PLLaCR0_DLYDIV_SEL; +} + +static unsigned long lynx_ex_dly_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + return parent_rate / 16; +} + +static const struct clk_ops lynx_ex_dly_clk_ops = { + .enable = lynx_ex_dly_enable, + .disable = lynx_ex_dly_disable, + .is_enabled = lynx_ex_dly_is_enabled, + .recalc_rate = lynx_ex_dly_recalc_rate, +}; + +static int lynx_clk_init(struct lynx_clk *clk, struct device *dev, + struct regmap *regmap, unsigned int index) +{ + const struct clk_hw *pll_parents, *ex_dly_parents; + struct clk_init_data pll_init = { + .ops = &lynx_pll_clk_ops, + .parent_hws = &pll_parents, + .num_parents = 1, + .flags = CLK_SET_RATE_GATE | CLK_GET_RATE_NOCACHE | + CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, + }; + struct clk_init_data ex_dly_init = { + .ops = &lynx_ex_dly_clk_ops, + .parent_hws = &ex_dly_parents, + .num_parents = 1, + }; + char *ref_name; + int ret; + + clk->dev = dev; + clk->regmap = regmap; + clk->idx = index; + + ref_name = kasprintf(GFP_KERNEL, "ref%d", index); + pll_init.name = kasprintf(GFP_KERNEL, "%s.pll%d", dev_name(dev), index); + ex_dly_init.name = kasprintf(GFP_KERNEL, "%s_ex_dly", pll_init.name); + if (!ref_name || !pll_init.name || !ex_dly_init.name) { + ret = -ENOMEM; + goto out; + } + + clk->ref = devm_clk_get(dev, ref_name); + if (IS_ERR(clk->ref)) { + ret = PTR_ERR(clk->ref); + dev_err_probe(dev, ret, "could not get %s\n", ref_name); + goto out; + } + + pll_parents = __clk_get_hw(clk->ref); + clk->pll.init = &pll_init; + ret = devm_clk_hw_register(dev, &clk->pll); + if (ret) { + dev_err_probe(dev, ret, "could not register %s\n", + pll_init.name); + goto out; + } + + ex_dly_parents = &clk->pll; + clk->ex_dly.init = &ex_dly_init; + ret = devm_clk_hw_register(dev, &clk->ex_dly); + if (ret) + dev_err_probe(dev, ret, "could not register %s\n", + ex_dly_init.name); + +out: + kfree(ref_name); + kfree(pll_init.name); + kfree(ex_dly_init.name); + return ret; +} + +static struct clk_hw *lynx_clk_get(struct of_phandle_args *clkspec, void *data) +{ + struct lynx_clk *clks = data; + + if (clkspec->args_count != 1) + return ERR_PTR(-EINVAL); + + if (clkspec->args[0] > 1) + return ERR_PTR(-EINVAL); + + return &clks[clkspec->args[0]].pll; +} + +int lynx_clks_init(struct lynx_clk clks[2], struct device *dev, + struct regmap *regmap) +{ + int ret, i; + + for (i = 0; i < 2; i++) { + ret = lynx_clk_init(&clks[i], dev, regmap, i); + if (ret) + return ret; + } + + ret = devm_of_clk_add_hw_provider(dev, lynx_clk_get, clks); + if (ret) + dev_err_probe(dev, ret, "could not register clock provider\n"); + return ret; +} 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..675f919092f1 --- /dev/null +++ b/drivers/phy/freescale/phy-fsl-lynx-10g.c @@ -0,0 +1,1297 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2022 Sean Anderson + * + * This driver is for the Lynx 10G phys found on many QorIQ devices, including + * the Layerscape series. + */ + +#include +#include +#include +#include +#include + +#include "lynx-10g.h" + +#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_RXEQ_BST BIT(28) +#define LNmRECR0_GK2OVD GENMASK(27, 24) +#define LNmRECR0_GK3OVD GENMASK(19, 16) +#define LNmRECR0_GK2OVD_EN BIT(15) +#define LNmRECR0_GK3OVD_EN BIT(14) +#define LNmRECR0_OSETOVD_EN BIT(13) +#define LNmRECR0_BASE_WAND GENMASK(11, 10) +#define LNmRECR0_OSETOVD GENMASK(6, 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) + +enum lynx_protocol { + LYNX_PROTO_NONE = 0, + LYNX_PROTO_SGMII, + LYNX_PROTO_SGMII25, /* Not tested */ + LYNX_PROTO_1000BASEKX, /* Not tested */ + LYNX_PROTO_QSGMII, /* Not tested */ + LYNX_PROTO_XFI, + LYNX_PROTO_10GKR, /* Link training unimplemented */ + 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 + * @first_lane: the first lane which will be used when this config is selected + * @last_lane: the last lane 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 first_lane; + u8 last_lane; + u8 pccr; + u8 idx; + u8 cfg; +}; + +static_assert(LYNX_PROTO_LAST - 1 <= + sizeof_field(struct lynx_mode, protos) * BITS_PER_BYTE); + +/** + * enum lynx_caps - serdes hardware capabilities + * @LYNX_HAS_1000BASEKX: 1000BASE-KX supported + * @LYNX_HAS_10GKR: 10GBASE-KR supported + */ +enum lynx_caps { + LYNX_HAS_1000BASEKX, + LYNX_HAS_10GKR, +}; + +/** + * struct lynx_conf - Configuration for a particular serdes + * @lanes: Number of lanes + * @caps: A bitmask of &enum lynx_caps + * @endian: Endianness of the registers + */ +struct lynx_conf { + unsigned int lanes; + unsigned int caps; + enum regmap_endian endian; +}; + +struct lynx_priv; + +/** + * 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. + * @clks: The PLL clocks + * @dev: The serdes device + * @regmap: The backing regmap + * @conf: The configuration for this serdes + * @modes: Valid protocol controller configurations + * @mode_count: Number of modes in @modes + * @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 clks[2]; + struct device *dev; + struct regmap *regmap; + const struct lynx_conf *conf; + const struct lynx_mode *modes; + size_t mode_count; + 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 + * @ex_dly: The ex_dly clock, if used + * @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; + struct clk *ex_dly; + 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)); +} + +/** + * 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->ex_dly); + group->ex_dly = NULL; + + 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_1000BASEKX: + return LYNX_PROTO_1000BASEKX; + 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_priv *serdes = group->serdes; + + for (i = 0; i < serdes->mode_count; i++) { + const struct lynx_mode *mode = &serdes->modes[i]; + + if (BIT(proto) & mode->protos && + group->first_lane == mode->first_lane && + group->last_lane == mode->last_lane) + 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; + } + } + + mutex_lock(&serdes->lock); + + tmp = lynx_read(serdes, PCCRn(new_mode->pccr)); + if (lynx_proto_mode_get(new_mode, tmp)) { + mutex_unlock(&serdes->lock); + dev_dbg(&phy->dev, "%s%c already in use\n", + lynx_proto_str[new_mode->protos], 'A' + new_mode->idx); + return -EBUSY; + } + + /* 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)); + } + } + group->proto = LYNX_PROTO_NONE; + + clk_disable_unprepare(group->ex_dly); + group->ex_dly = NULL; + + 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->clks); pll++) { + struct clk *clk = serdes->clks[pll].pll.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->clks[pll].pll.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->clks[pll].pll.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_RXEQ_BST | LNmRECR0_BASE_WAND; + recr0_mask |= LNmRECR0_GK2OVD | LNmRECR0_GK3OVD; + recr0_mask |= LNmRECR0_GK2OVD_EN | LNmRECR0_GK3OVD_EN; + recr0_mask |= LNmRECR0_OSETOVD_EN | 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); + + 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)); + } + + /* 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 (proto == LYNX_PROTO_1000BASEKX) { + group->ex_dly = serdes->clks[pll].ex_dly.clk; + /* This should never fail since it's from our internal driver */ + WARN_ON_ONCE(clk_prepare_enable(group->ex_dly)); + } + + 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++; + phy = group->phy; + goto out; + } + } + + /* None found, create our own */ + group = kzalloc(sizeof(*group), GFP_KERNEL); + if (!group) { + phy = ERR_PTR(-ENOMEM); + goto out; + } + + 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); + } + +out: + mutex_unlock(&serdes->lock); + return phy; +} + +static int lynx_read_u32(struct device *dev, struct fwnode_handle *fwnode, + const char *prop, u32 *val) +{ + int ret; + + ret = fwnode_property_read_u32(fwnode, prop, val); + if (ret) + dev_err(dev, "could not read %s from %pfwP: %d\n", prop, + fwnode, ret); + return ret; +} + +static int lynx_parse_mode(struct lynx_priv *serdes, struct fwnode_handle *fwnode, + struct lynx_mode *mode, u16 protos, u8 pccr, u8 idx) +{ + struct device *dev = serdes->dev; + int ret; + u32 val; + + ret = lynx_read_u32(dev, fwnode, "fsl,cfg", &val); + if (ret) + return ret; + mode->cfg = val; + + ret = lynx_read_u32(dev, fwnode, "fsl,first-lane", &val); + if (ret) + return ret; + mode->first_lane = val; + + ret = fwnode_property_read_u32(fwnode, "fsl,last-lane", &val); + if (ret && ret != -EINVAL) { + dev_err(dev, "could not read %s from %pfwP: %d\n", + "fsl,last-lane", fwnode, ret); + return ret; + } + mode->last_lane = val; + + if (mode->first_lane >= serdes->conf->lanes) { + dev_err(dev, + "value of %s (%u) in %pfwP exceeds lane count (%u)\n", + "fsl,first-lane", mode->first_lane, fwnode, + serdes->conf->lanes); + return -EINVAL; + } else if (mode->last_lane >= serdes->conf->lanes) { + dev_err(dev, + "value of %s (%u) in %pfwP exceeds lane count (%u)\n", + "fsl,last-lane", mode->last_lane, fwnode, + serdes->conf->lanes); + return -EINVAL; + } + + mode->protos = protos; + mode->pccr = pccr; + mode->idx = idx; + return 0; +} + +static int lynx_parse_pccrs(struct lynx_priv *serdes) +{ + struct fwnode_handle *pccr_node, *proto_node, *config_node; + struct device *dev = serdes->dev; + size_t mode = 0, mode_total = 0; + struct lynx_mode *modes; + int ret; + + /* To ease memory management, calculate our allocation up-front */ + device_for_each_child_node(dev, pccr_node) { + fwnode_for_each_child_node(pccr_node, proto_node) { + size_t mode_subtotal = 0; + + fwnode_for_each_child_node(proto_node, config_node) + mode_subtotal++; + mode_total += mode_subtotal ?: 1; + } + } + + modes = devm_kcalloc(dev, mode_total, sizeof(*modes), + GFP_KERNEL); + if (!modes) + return -ENOMEM; + + device_for_each_child_node(dev, pccr_node) { + u32 pccr; + + lynx_read_u32(dev, pccr_node, "fsl,pccr", &pccr); + if (ret) + return ret; + + fwnode_for_each_child_node(pccr_node, proto_node) { + const char *proto_str; + bool children = false; + u16 protos; + u32 index; + + lynx_read_u32(dev, proto_node, "fsl,index", &index); + if (ret) + return ret; + + ret = fwnode_property_read_string(proto_node, + "fsl,proto", + &proto_str); + if (ret) { + dev_err(dev, + "could not read %s from %pfwP: %d\n", + "fsl,proto", proto_node, ret); + return ret; + } + + if (strstarts(proto_str, "sgmii")) { + protos = PROTO_MASK(SGMII); + if (serdes->conf->caps & + BIT(LYNX_HAS_1000BASEKX)) + protos |= PROTO_MASK(1000BASEKX); + if (!strcmp(proto_str, "sgmii25")) + protos |= PROTO_MASK(SGMII25); + } else if (!strcmp(proto_str, "qsgmii")) { + protos = PROTO_MASK(QSGMII); + } else if (!strcmp(proto_str, "xfi")) { + protos = PROTO_MASK(XFI); + if (serdes->conf->caps & BIT(LYNX_HAS_10GKR)) + protos |= PROTO_MASK(10GKR); + } else if (!strcmp(proto_str, "pcie")) { + protos = PROTO_MASK(PCIE); + } else if (!strcmp(proto_str, "sata")) { + protos = PROTO_MASK(SATA); + } else { + dev_warn(dev, + "unknown protocol %s for fsl,proto in %pfwP\n", + proto_str, proto_node); + continue; + } + + fwnode_for_each_child_node(proto_node, config_node) { + children = true; + ret = lynx_parse_mode(serdes, config_node, + &modes[mode++], + protos, pccr, index); + if (ret) + return ret; + } + + if (!children) { + ret = lynx_parse_mode(serdes, proto_node, + &modes[mode++], + protos, pccr, index); + if (ret) + return ret; + } + } + } + + serdes->modes = modes; + WARN_ON(mode != mode_total); + serdes->mode_count = mode; + return 0; +} + +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 = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .disable_locking = true, + }; + struct resource *res; + void __iomem *base; + + serdes = devm_kzalloc(dev, sizeof(*serdes), GFP_KERNEL); + if (!serdes) + return -ENOMEM; + + serdes->dev = dev; + platform_set_drvdata(pdev, serdes); + mutex_init(&serdes->lock); + INIT_LIST_HEAD(&serdes->groups); + serdes->conf = device_get_match_data(dev); + + ret = lynx_parse_pccrs(serdes); + if (ret) + return ret; + + 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; + } + + regmap_config.val_format_endian = serdes->conf->endian; + regmap_config.max_register = res->end - res->start; + 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; + } + + ret = lynx_clks_init(serdes->clks, dev, serdes->regmap); + if (ret) + return ret; + + /* Deselect anything configured by the RCW/bootloader */ + for (i = 0; i < serdes->mode_count; i++) { + const struct lynx_mode *mode = &serdes->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 */ + if (mode->first_lane > mode->last_lane) + serdes->used_lanes |= + GENMASK(mode->first_lane, + mode->last_lane); + else + serdes->used_lanes |= + GENMASK(mode->last_lane, + mode->first_lane); + if (grabbed_clocks) + continue; + + grabbed_clocks = true; + clk_prepare_enable(serdes->clks[0].pll.clk); + clk_prepare_enable(serdes->clks[1].pll.clk); + clk_rate_exclusive_get(serdes->clks[0].pll.clk); + clk_rate_exclusive_get(serdes->clks[1].pll.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 non-used lanes */ + for (i = 0; i < serdes->conf->lanes; i++) { + if (serdes->used_lanes & BIT(i)) + continue; + 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", serdes->conf->lanes); + return ret; +} + +static const struct lynx_conf ls1046a_conf = { + .lanes = 4, + .caps = BIT(LYNX_HAS_1000BASEKX) | BIT(LYNX_HAS_10GKR), + .endian = REGMAP_ENDIAN_BIG, +}; + +static const struct lynx_conf ls1088a_conf = { + .lanes = 4, + .caps = BIT(LYNX_HAS_1000BASEKX) | BIT(LYNX_HAS_10GKR), + .endian = REGMAP_ENDIAN_LITTLE, +}; + +static const struct of_device_id lynx_of_match[] = { + { .compatible = "fsl,ls1046a-serdes", .data = &ls1046a_conf }, + { .compatible = "fsl,ls1088a-serdes", .data = &ls1088a_conf }, + { }, +}; +MODULE_DEVICE_TABLE(of, lynx_of_match); + +static struct platform_driver lynx_driver = { + .probe = lynx_probe, + .driver = { + .name = "lynx_10g", + .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 Fri Jul 15 21:59:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919826 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 667FCC43334 for ; Fri, 15 Jul 2022 22:05:39 +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=GQYItI6BNiY/CyGTWkrZQFcAzK1SAhQKuBtgSrmrvnQ=; b=z1IgNaFkhbu+Hv p5uZFjCBwLbnBpXDZvRldtpaeoa36baD7gmL5uDjnlEbrzVmVm9zU25Z1EM/uS5feK1KPdwaoILOf aactDHliIgfKZOu1RBFW5AGZ5ymFh85gOfZaocoqryGJ/6V4OzHY4YyPD/g4xtGrOwEsHsDFUe6uE l0+xnjMhsB4F3LZDFnReRDIOn+CLwJxQWw+VknOCzD6KU/aIspAUAorHmOZJnL/LXP3lsl43ziVqa SZtfJSS0ICA0Djzr/IkY6g1yZf7BWG4KkNJEQ8G+qb/IJvZgeX8bcsDpPNGwulnbNezZpHgOQKCyS fsz0PiCu7BOzLfN7v2dA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTQ8-00AckT-HU; Fri, 15 Jul 2022 22:04:25 +0000 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMS-00AaxO-5K for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:00:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NYk9lu0CiPkLEm5KxqP6oEF/TLC+Pzq7rf2jZaciFTVOVHcCdcKOo5/23eB63JiWVNKXlr8zI5gRUCAkjUoyDfgKAO6Sm+xA8PDtnNko/XWMmpI/lR7RsfMak0U58GBoQwnVwUca+824AqNUS9Z2S+xX2/7jf2YI/fGBFdU+BQy/kfY/GgjF/Lkonobe/DW7XRhkt2bKMd2Unv9J7ilYvzHrir6a5a1y2TmnAlF+57VHNx8HTMK2xNRc1qy79wUISGJ+xl1+P+Ga+mDsoUGFydbdXreQarvGKi+rpQkHl2qZJd+Y8VlGvGzpvJsZsrQ9RF5vr2pau7fPRuiGAe3yug== 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=TgYV3xwT5XrKc75lJUSiXz3xK2FaCx3SvoKQdGIo2zs=; b=OJFW5urVvDrNeXj/P8l9E2WFtejMzbdPDyfjgrhn8jLvf9vDXF1xkOkThV4rWZXxDbA+UMA0f+F7WpKrdX7yyEwVT+s0tHqJqr5yUJaEITWc+vN/bsQIgioF0cWqTMifgJ54k/HBA44Pu7L01AewQ8AY58IZPuerLmLOncXZ7jmKo4FVQJKk4vEHwj+qvVgDKiQSh1owvzoG57g3vjW2eM9nM/q/1jJaQDPkCRW7D4yLfe/pS07DkQjTuznpZ8ihIEk3v314EYhcJcCLr664koeHtG+LneXrQAcdwtWNAfZ8mAk/HvVMRpWG6RYUz7XUoJlg/di1QhXR/h4ZKtTFdg== 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=TgYV3xwT5XrKc75lJUSiXz3xK2FaCx3SvoKQdGIo2zs=; b=hDrGJhGVvLm/pOczhqtpKzQ5cEERem3YDrQtFw2vqhlTS5Hf4Y6Eoregp7/XlZ84nsHKxeTNreB8XaZWeO5lLQCHIJoQ/d/K/G9ElyhzMuz0NarSsirlIvk0U61q1SDx9O7KjSCDDT8FaTShjZ/AgOqejn0OtwZIDmuBxfU1UVig99ldhdK/PHXKN8z8HQETbdnhnxPs8Vz8OoCzQt1iYWQ7ytFY87WsZKR8CDb41+Xzw6b5fZLw/u4mNXoM3LROa3av7C2hn9LqY1s+DJaLdF+Ok9Nfx1TFY9RBahaUXFgEnvdvzQhSKYxDlJQLrn27o01ltobS3HvTKseNMLAMMQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DBBPR03MB5302.eurprd03.prod.outlook.com (2603:10a6:10:f5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12; Fri, 15 Jul 2022 22:00:28 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:28 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Alexandru Marginean , Andrew Lunn , Heiner Kallweit , Vladimir Oltean Subject: [PATCH net-next v3 07/47] net: phy: Add support for rate adaptation Date: Fri, 15 Jul 2022 17:59:14 -0400 Message-Id: <20220715215954.1449214-8-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f5d582b-bd99-495f-0cbb-08da66ad6df2 X-MS-TrafficTypeDiagnostic: DBBPR03MB5302:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p4sm75Nf4Kgs66vFSN+kKIUqvMZCxwxQTJyMZAhMh7o5LicIKijViVvscvlW9jKBXbWk2KgFtqhBs6fIfLQImQ5R9KikdBJDmSXSb6ooIZhuKvHDcVTATx0WaoFuSLWfZNChYdgI4dF17rg6Rfwt9taxEUs8lxlHsESfL9vggtfVjBShT3XQVYmdQhTey3kvqCkLK5y3wZHW9CORoERKV0dwA0CYUBJfUCHb5iBAiloqEEwm92dkip/o9bO1/BxMwX5lY1wGPU7BToIvp6Ax4HDWxWJxGmbr3V6YKZoCDa/6+fKxKvdvBfdWU5EggcgyZCcVsk9JxyJ9rfk+LH/98uxw0DBF1xFWOhkB4kGang5SRRpfkWG0yAkX3yb3JyZW3tqrhtLCFFsNCRxppoOXmw4K+AedzcsNnZMiCVVC6SDjHxCaTdLsVZccAu9cByIFHQudq9qEVB+uZytFEDcl/eNL4c/IV54GJaNAAgaxo0/9EeIS96+9rJ4H3e8YHzRPARZ++QGl1/vhVnNklIA8Ht4Mq2cNghUyT8GqiBdEjXyfrUcPZlX737kktirgT1F+tgv1E1ol1pkZuvPfvBeARh/xldyZKsyBIauhKy00aeFLct8NQQPUjUSIeqYWVmyTgaaTUx1jNa4ZM2zCpvooyWBgebNAQDyvlVv4J3WvPktY9dsiBUHV8mq0XH8waxA0P8yO4k7DBRtFHE/YyeJkxkt5fjAft9jJHAw07MNALkeeYdUqJIjHOHPrF8EsaY6Nl2md8EKr37xPEhzX052DR44dapnKrNlaw9gH6zDMggsNwqNITwJmR/AvsUxtKNdm5qnbO3ReEwDCMF1pB3MfAw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(366004)(396003)(136003)(39850400004)(346002)(478600001)(66556008)(41300700001)(66476007)(52116002)(966005)(6506007)(6486002)(6512007)(26005)(8676002)(6666004)(54906003)(86362001)(66946007)(316002)(8936002)(4326008)(83380400001)(38350700002)(2616005)(1076003)(186003)(7416002)(36756003)(110136005)(38100700002)(2906002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YvA4M4MiD2Mx8q2CT4B8ZUDmDgGpmZbW4fJ0pmPOnT6yC4iwIzUmp0IkMby2xoXiHRn9pHaVuDK6xx0PJiWS4nLLildTK2M/R746L7YJFM82sJOYOUDCI/qR5jwLuoPvg0+I09ra5H7IBtRRYFoosjpHB97oHUgFUmZYg/ssN2rMyccC3RjqiiMeodcT948Bg6qALiUP96A29Q8Ms19msjLpp7/K8sulB3OXyJgFMykG6JWyHkvRbnIAT0G1q+nA5rOVi5UGtXDbFg1OyIP+tYWYxBXgKGcvTjqk8uhrhHD9RJjfOqB+QRgjcgfw/aFrLaDGlmCjQI9+uQ3zW7q/6QF8B3IZpo0hFY7tOOnmpjFMvibIEyeSBZFOSVcjfE0q5SPSKCgfybF9DReSQ55VC/r2DrntOsSRaLphogOMBBvN9oRakmLviEtdxRkmyvlVHLrpDSMSxriUuHsYG+uZgzNl0J3CKqbNi7XpyadIvmlTSFmpQ2njjvQkUYbGrWhvJlX/Yvup9JBl+up+61xHbCleMGY1nXyQ7B0yrbmybv5n+jXdL/gHuUJuIrMT2MPUGx+QfgjxFFCh8j4DQeq72KX20dNsRk5paQJe9qoAWONg0tNHbc416SM/Ifu9hoyUC7i5v/zMlrVk0H9zK/Dk7zcs1BnDK+TtJpHyFI3j+aoEx1UnntZ3l6+91psB9NxTtg1T9llEqc3zBDNKE74OCiD3PJ7ddOIqnbt9fS+5hFX6ZBdpPDHSVOiVlyHOoagveCKOjgXd9BNN28aORzyPUnRci6JPhtSa0h/gmDOgHhBOTR/uGw6rY9AZbv9fPsPaxfzYrjuVusFMU2yJHRpDS6Xj9nGuIip1wm6Qal+ziTbkJkPVzKDAHl2e2EbaxjHkA7ZBPRCKnS7vs9V8mwfrH/mKwvuIfMPwWmdFOQCbTsysuyW7TP/1reRFQgi2UIkzZ0eUKD53DRmTnsh8jSit7Wuq/prhVo5fq/aIURxkX1oGbWSgEYr3xR3p7ENOF/bsGiYYqL0cP6KuCKf69H5JpSvIKbSuVkPmYkFD4fnP+xPs7a2HIw+Hei0OLs+cGzdHHNgCWy2Rk9PlaEwt6VgENVQIG5pkfgztnF3hG471J0eaIRfYkCU8qFiEowZ+e+3pvzBPL865B46rMiHw6AEzttSPH9uB7ULXPaLzU4WgnRaQwPN+31xt76ODdd11eWssX9x82AbLP36L/2ec1MnLQxIaWfHucxcwq9DteIWwPxFYDVrgIe4eubyzcqidBYUueXZl9Q0gUYq4nRxnSqOt3YIhPP/bRto0avMevDEChU+J0F0osgdHrVPQTxRmSljy3somHjamoWXHxB0RMNZ2cG3jsS3RM5tUF6O8odwactbiSKsWjoUaGNn82KNbrZUaS7vlRu9EVGA4wvv6RbbJobYXOEG/97PEyhDL5uJpomhM6Lym83Hjky5A0IwLPfP2VjlLm90oZ6jL6NcR5MMebaf9D0aqq/1AG0D1HJkMBkijyKqVmPv8K10EzACw18/oVA4tFjU5Z+obhBdg/BCuxnwBve23V339mvbdyDf0cd8YzBoRloq+01H9vxOe+PpLnFu7WDYDHBgCGUZtSVuRbw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f5d582b-bd99-495f-0cbb-08da66ad6df2 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:28.7395 (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: E44aMyyf6LBiUOWDhNWImNbNfrWQqL6FqmJYBxUboh9x1m6OqqxrXBsXsGmpF2yfbolVYgzksmrKaSyyl+zG3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB5302 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150036_474653_C8F29A70 X-CRM114-Status: GOOD ( 26.88 ) 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 general support for rate adaptation to the phy subsystem. The general idea is that the phy interface runs at one speed, and the MAC throttles the rate at which it sends packets to the link speed. There's a good overview of several techniques for achieving this at [1]. This patch adds support for three: pause-frame based (such as in Aquantia phys), CRS-based (such as in 10PASS-TS and 2BASE-TL), and open-loop-based (such as in 10GBASE-W). This patch makes a few assumptions and a few non assumptions about the types of rate adaptation available. First, it assumes that different phys may use different forms of rate adaptation. Second, it assumes that phys can use rate adaptation for any of their supported link speeds (e.g. if a phy supports 10BASE-T and XGMII, then it can adapt XGMII to 10BASE-T). Third, it does not assume that all interface modes will use the same form of rate adaptation. Fourth, it does not assume that all phy devices will support rate adaptation (even some do). Relaxing or strengthening these (non-)assumptions could result in a different API. For example, if all interface modes were assumed to use the same form of rate adaptation, then a bitmask of interface modes supportting rate adaptation would suffice. We need support for rate adaptation for two reasons. First, the phy consumer needs to know if the phy will perform rate adaptation in order to program the correct advertising. An unaware consumer will only program support for link modes at the phy interface mode's native speed. This will cause autonegotiation to fail if the link partner only advertises support for lower speed link modes. Second, to reduce packet loss it may be desirable to throttle packet throughput. In past discussions [2-4], this behavior has been controversial. It is the opinion of several developers that it is the responsibility of the system integrator or end user to set the link settings appropriately for rate adaptation. In particular, it was argued that it is difficult to determine whether a particular phy has rate adaptation enabled, and it is simpler to keep such determinations out of the kernel. Another criticism is that packet loss may happen anyway, such as if a faster link is used with a switch or repeater that does not support pause frames. I believe that our current approach is limiting, especially when considering that rate adaptation (in two forms) has made it into IEEE standards. In general, When we have appropriate information we should set sensible defaults. To consider use a contrasting example, we enable pause frames by default for switches which autonegotiate for them. When it's the phy itself generating these frames, we don't even have to autonegotiate to know that we should enable pause frames. Our current approach also encourages workarounds, such as commit 73a21fa817f0 ("dpaa_eth: support all modes with rate adapting PHYs"). These workarounds are fine for phylib drivers, but phylink drivers cannot use this approach (since there is no direct access to the phy). Note that even when we determine (e.g.) the pause settings based on whether rate adaptation is enabled, they can still be overridden by userspace (using ethtool). It might be prudent to allow disabling of rate adaptation generally in ethtool as well. [1] https://www.ieee802.org/3/efm/baseline/marris_1_0302.pdf [2] https://lore.kernel.org/netdev/1579701573-6609-1-git-send-email-madalin.bucur@oss.nxp.com/ [3] https://lore.kernel.org/netdev/1580137671-22081-1-git-send-email-madalin.bucur@oss.nxp.com/ [4] https://lore.kernel.org/netdev/20200116181933.32765-1-olteanv@gmail.com/ Signed-off-by: Sean Anderson --- Changes in v3: - New drivers/net/phy/phy.c | 21 +++++++++++++++++++++ include/linux/phy.h | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 8d3ee3a6495b..cf4a8b055a42 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -114,6 +114,27 @@ void phy_print_status(struct phy_device *phydev) } EXPORT_SYMBOL(phy_print_status); +/** + * phy_get_rate_adaptation - determine if rate adaptation is supported + * @phydev: The phy device to return rate adaptation for + * @iface: The interface mode to use + * + * This determines the type of rate adaptation (if any) that @phy supports + * using @iface. @iface may be %PHY_INTERFACE_MODE_NA to determine if any + * interface supports rate adaptation. + * + * Return: The type of rate adaptation @phy supports for @iface, or + * %RATE_ADAPT_NONE. + */ +enum rate_adaptation phy_get_rate_adaptation(struct phy_device *phydev, + phy_interface_t iface) +{ + if (phydev->drv->get_rate_adaptation) + return phydev->drv->get_rate_adaptation(phydev, iface); + return RATE_ADAPT_NONE; +} +EXPORT_SYMBOL_GPL(phy_get_rate_adaptation); + /** * phy_config_interrupt - configure the PHY device for the requested interrupts * @phydev: the phy_device struct diff --git a/include/linux/phy.h b/include/linux/phy.h index 81ce76c3e799..e983711f6c8b 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -276,6 +276,24 @@ static inline const char *phy_modes(phy_interface_t interface) } } +/** + * enum rate_adaptation - methods of rate adaptation + * @RATE_ADAPT_NONE: No rate adaptation performed. + * @RATE_ADAPT_PAUSE: The phy sends pause frames to throttle the MAC. + * @RATE_ADAPT_CRS: The phy asserts CRS to prevent the MAC from transmitting. + * @RATE_ADAPT_OPEN_LOOP: The MAC is programmed with a sufficiently-large IPG. + * + * These are used to throttle the rate of data on the phy interface when the + * native speed of the interface is higher than the link speed. These should + * not be used for phy interfaces which natively support multiple speeds (e.g. + * MII or SGMII). + */ +enum rate_adaptation { + RATE_ADAPT_NONE = 0, + RATE_ADAPT_PAUSE, + RATE_ADAPT_CRS, + RATE_ADAPT_OPEN_LOOP, +}; #define PHY_INIT_TIMEOUT 100000 #define PHY_FORCE_TIMEOUT 10 @@ -570,6 +588,7 @@ struct macsec_ops; * @lp_advertising: Current link partner advertised linkmodes * @eee_broken_modes: Energy efficient ethernet modes which should be prohibited * @autoneg: Flag autoneg being used + * @rate_adaptation: Current rate adaptation mode * @link: Current link state * @autoneg_complete: Flag auto negotiation of the link has completed * @mdix: Current crossover @@ -637,6 +656,8 @@ struct phy_device { unsigned irq_suspended:1; unsigned irq_rerun:1; + enum rate_adaptation rate_adaptation; + enum phy_state state; u32 dev_flags; @@ -801,6 +822,21 @@ struct phy_driver { */ int (*get_features)(struct phy_device *phydev); + /** + * @get_rate_adaptation: Get the supported type of rate adaptation for a + * particular phy interface. This is used by phy consumers to determine + * whether to advertise lower-speed modes for that interface. It is + * assumed that if a rate adaptation mode is supported on an interface, + * then that interface's rate can be adapted to all slower link speeds + * supported by the phy. If iface is %PHY_INTERFACE_MODE_NA, and the phy + * supports any kind of rate adaptation for any interface, then it must + * return that rate adaptation mode (preferring %RATE_ADAPT_PAUSE, to + * %RATE_ADAPT_CRS). If the interface is not supported, this should + * return %RATE_ADAPT_NONE. + */ + enum rate_adaptation (*get_rate_adaptation)(struct phy_device *phydev, + phy_interface_t iface); + /* PHY Power Management */ /** @suspend: Suspend the hardware, saving state if needed */ int (*suspend)(struct phy_device *phydev); @@ -1681,6 +1717,8 @@ int phy_disable_interrupts(struct phy_device *phydev); void phy_request_interrupt(struct phy_device *phydev); void phy_free_interrupt(struct phy_device *phydev); void phy_print_status(struct phy_device *phydev); +enum rate_adaptation phy_get_rate_adaptation(struct phy_device *phydev, + phy_interface_t iface); void phy_set_max_speed(struct phy_device *phydev, u32 max_speed); void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode); void phy_advertise_supported(struct phy_device *phydev); From patchwork Fri Jul 15 21:59:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919827 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 B6A27C43334 for ; Fri, 15 Jul 2022 22:06: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=1jTmMnJRlkTOlCXkYbZ5fEuvk5D4ptlhZCXn1M0g3BY=; b=3K1oHv+c5bYgUL Ms8mAJ/+DzgnQaqztQIjujeMt8FMmmuDeFJ/Zj+fEwC+PiO9M3fZOyBYTRot1shJGHyZ/bZzdcaG5 GucVgJLQo+QALNYSMFXyZYSRLoUJbpSnzGgQ658sp0QWwNXRGCH/2qVcDoldur14Doe8oyWCzipIi UWD/JgGP6e9vjHT/nlmhlui4woPLHOQyUY5XzQLTg2oKVXXNsjbuV4UpNx8258zmHCcXMwdCnfGp0 tHYGkxtpILDNjXFuOWfpuHBoOsVxvC1K/I45r3AXolVIBXjrs3Xc6dpSxsXdYCj6OuvqoZZncTQdh D6H8x/zHqVJOaWyjyw1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTQv-00AdA1-Ss; Fri, 15 Jul 2022 22:05:15 +0000 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMV-00AaxO-8J for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:00:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FlbvdtyTkFvIczoEdR+ApEnrL7sZUUoI6Oi5NS7uX8fIp6LLVZysHY/wHgYSnW7UV4FEgZSW4gQqJkARXT3GDHxS7Bka6TWD8JoqaVx+Mes0ypDRY5TfmHZ6IxBYt0oyK5e9Zh5/UUgJ1TxFfjH895qVkeyfmlSR+lyHje/B+/mA0c/d1Hxl+93m89rl1i5ZPP95FrwhYtsrHply5GbZ4QR4w1XQcXu0Zh2jqI81brclaTD/FGZXFG6rQKPRgCEYkuhuU2zawMWLNTwt0hpShsVUKry7xSaFfkjNGN3gJwowLJnlCUTv/LBlTnHkEqqDFUBLTQNVKSGl7/WYSSR0Qg== 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=IKyIEPmxdQWxr0xKNkYQ5OCHp19pkWfoYCluchWDGzM=; b=bbBBjEJXdFuQk7f4MhKtRekaENqgzfDzeYjF70967UBEcWs4ncaqSfBNdFyFiCtDks1QkaG2/gOLapTKsYCtU0cG4jGM2UCYjyruNwrgpMnP4YMOTN20v/U/9XW6C1B8ILEg/qKFuUxTPtluHQeUyfU7Vl2am8Ew9NE+bDE71W4OmJNnVVibgkARhI/H71JD28GXICrLfgdXFUM4WF9GAX7gEi6yO8KU/dGYT4L5ru76qy852NzS0tOU5bR9GHt9uI8d/PrWCzok8D1XLoI8DUyH82vd07wWbreXDdQ13/7PsSJDbD6ncbCF3slI0+L5djWJNMgtcS+DN8YaTXQLHA== 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=IKyIEPmxdQWxr0xKNkYQ5OCHp19pkWfoYCluchWDGzM=; b=GOcPyYEnNpED5onEAkWzuUxADuN46IsVfbJsETEOzMagLPqpG0E5IAyAcUPVwWFNOn1NYRDipCWprRZt8lRjuK2Cu+4uJbmLQzPyOJCDquXjlkuZzBvhF2/PkViUPWTatoolZT53HluFQzMtFZChIGk29QjIX4WWVyr5qXArJvsQcl8mlDX23GGrf882DCXAa1vJkKjMwZ6nqb/buVsx5MJJsaTFdT+lEea4+8RlY4iaY2Q/f7gvxxjZ+i8W+f62kiaHjQUpWhpXT3JuqSW5J9kNsmCL8oe17c6/n/0qSk6dUBCbpLE2zPVw1cTGjfJ249YI3GyeU7CDqqUq/tnLoA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DBBPR03MB5302.eurprd03.prod.outlook.com (2603:10a6:10:f5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12; Fri, 15 Jul 2022 22:00:31 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:31 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Alexandru Marginean , Andrew Lunn , Heiner Kallweit , Vladimir Oltean Subject: [PATCH net-next v3 08/47] net: phylink: Support differing link speeds and interface speeds Date: Fri, 15 Jul 2022 17:59:15 -0400 Message-Id: <20220715215954.1449214-9-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0d570eeb-b41a-45a2-f5f2-08da66ad6f84 X-MS-TrafficTypeDiagnostic: DBBPR03MB5302:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XPefRGTeTxNWly2bWJws7NeqIFAW48Fycknlt7s2tYWouYGEKgLfkijquY4OpNaYLlrj1/UnNUHYh/QiaTNZ5FEPj3rc9/sSWjd6CMdB+hP8JB5Vfor0CZelwDssXn1+fJia3W3gRAAqilokSB1c2fGw8G7hPBXfVZRbIqIq9ILrBD3SBvSfvSWNHwX95GY/e75jU4YyMMZWfvNXoRvKaIQsg1NDy6siEey6we9+C57NNWpfYM8hk1DbORASONfme2cvylswXt8ffwZJAkC07ypnF9YLxPHDrirSDbrPXONL3ZATziA3XJjUUFr7R/NwsWRYPz72Rr4pYIBbBrGaN+kve46QxFm71+93QDB3PLD+Nu2RChRA1Dy8cvxn0TpaED2IgFXE2uc598Wm/tOfWfw3JN2zvLxUfyLclvnoFbWgYWiPKghW4quIAcmq2fvl8OzD5O5pcMgFv6RkMNcErIhZYy/qXTOjmLSaYvxTkIo367FBWFJmLmHP8dXXMZ2Vvl2TL5hRMDslElj/4mpHwXxiMsrHOGVF+0rmyfb8rtQSa94DKGn/+m1EguiLtmbUg7La96osHUU2Ot202haAZvTJLjIP1M4SFFb3Su9XcvAQLvkkvTfG8hjIdKLCQsi7FJ1SCCN+QprsXk3WYRI0NLcDUbZ5Eq2yjfwHfsuLPikoMDJbd1PqO+d/QYoAhoj3a7pUTEMPbuv+u5JT4baFDL7lz4Y5ZK/34FM/XsTQkYv4X+c/rb9+67EImy9RSvby0CGVorbQ+GM1a7bBXBjA2sMqnAZv0yMdjnTPlcMsL3NndqwFkm0Z+Zpc85lVBEXm X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(366004)(396003)(136003)(39850400004)(346002)(478600001)(66556008)(41300700001)(66476007)(52116002)(6506007)(6486002)(6512007)(26005)(8676002)(6666004)(54906003)(86362001)(66946007)(316002)(8936002)(4326008)(83380400001)(38350700002)(2616005)(1076003)(186003)(7416002)(36756003)(110136005)(38100700002)(2906002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aC3Ocn1vbLMVDDIdyFw4cM/MahJkNGsxWYD1tpKHd8B/gvHTGZKWCugrYHECZlASOdi5CY9DE8y+rNpWtJ9y+r+PLGNifltpRhyLIlZPcSOZ3KCSGowzoH4fAYx5EUfb2Xp3drRD8O+ot+oZzwwICXPefOy1xUXiVvNhdh5ZKFccGJRAdLNd6GXymb2rDAe/9ayvCHIpowYT9cY788tg3aE2Zd93N15dCQvubUgUJkrFrxJf/eEQ7QLdWEXAmv4BmA0630sbSbw+a4bzAQX2yWL2Sm+DefmQqCUms6O7G2EqBIOiEXnTUSMbELVsIqg0ekqctSzfa73biLqPCJDDKOi3kRgDz5nVGe3tqy+cnGYZGPH3qvTEktN1t3A7bthA4SyHrC/r5kDwgHNQQClSMBYcjOEcmClwL3GxC9+JXvaMtkh2NquGgL251bcQQHIA4Y5jwHcVifztincgf50O76M4Ta63xQ2WZxJgtCiFk2ooHj5VIEf4oReYbngTJDzu8gvfE+HtHqDrIfYDlVaIj+IL3oFHceILfHvflduTfox/GnIDp4R83Ym5vfOHknNzhlcG6cjBDzRjIeyiKUEt8LmqUeLJRUTwomCBen/g5q1nHX0wZXbiDskLE/AgmnClIXOLyiBtbpDzjsa77JE+9XSPLLECwy5O4WKMqwnSSNUzQ+KqOtxKFGe1qyo2DkIw/MY/R9+fFxAiRNyQHICeUmUGLpHzon7zq1FBC1X+tmZ4TF+HZ+RphZtHy0/uFGWPBN9LWRbQWQPfpjI9IbyMz9+1wtwngbQ4fN+7hu/NqrNXNBmrUaATGyhBEDl4jRS4n2h5a6kIXJT3H5pqusluDKEgRl0EEkZA3s9rqKGOJqj6M33qNPmu9omQUILAocdmsYnMidIjkFp+/guDnyaQspwtoRsbWOLVj6V5BSVMQoz2jQBtfG71q7G3P7QVJ9m9DbL2TyB7VQA2cP5CVMoH4eCts2SqOwRsJS5pq1pDfEbhChJWJu3NeNuN4wVwPrPxw8Bf/exQZPg25LwEo3vdVHcGiumaQfw1boJdnekqUezyf3snjAfKOJLSg/A33GIDl4gIACVruLNUaugyKJKjuw4+ZHEfhLVoWloph/QJnRdWNdyAUSXFfgHq+Zhbp8yuk84T8ulmGPx0ya2soZnYL9jjF5OW8W3y4h/CPpCrRUudxhIrcwgE+9wu8+DNNEnnfzq+7twN5CaJHriQabLT38ZdYZeiHOjJGPmurdeSbL06LH8+3iPk1dT+NZ69w13Slky5DuMV8mP3OM6X8wku+9trreJgYPe6tzWzIaQcnNEhHsVUAp2KMRRtO3YCpazVXvm+aZY0h0d0rm2W1XCKmGXbRVopsoOl8A5VYFgL25aqaeubbQYT8358n1+kGzes/ABRqQrWeFSO2ZIs9aSBVjsomQloLscVilmMGP9Xee/mnrj6CHMP8aoDbgWTvHlWwnkd1EvqeA/Eaz3oXYpcfoT+vnWqKxcNXMsL9DlfA221r5TLlglAltForqfhdMZbQG2q3Us6Ho78KUZtShmwg9iYcDhg3LedbRAdRH5CXewrjPbg4ds/z14J+JttLqSFrFeSdGUAzQ6gT7F4JxJQ8Q== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d570eeb-b41a-45a2-f5f2-08da66ad6f84 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:31.3800 (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: NW/GzIHXjGXo13hrI/ii4bL7oxXzq3k1fgjF/7EOU+g9xKZGEpkHle0WE5sXBXfbQkoTLma6m151j87/0piYHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB5302 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150039_404002_C635A01E 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 adds support for cases when the link speed differs from the speed of the phy interface mode. Such cases can occur when some kind of rate adaptation is occurring. The interface speed is used for the link state speed member. This is done for compatibility with existing drivers. For example, if the link mode is 1000BASE-T, and the phy interface mode is XGMII, then the MAC will expect SPEED_10000 for speed (which is what would have been passed previously). On the other hand, external APIs use link_speed instead of speed. This is so the speed reported to userspace matches the resolved link mode. phy_interface_speed assumes that certain interfaces adapt to the link rate and others do not. Generally, interface speed adaptation occurs by changing the clock rate (such as for MII), or by repeating symbols (such as for SGMII). This assumptation precludes using rate adaptation for interfaces which already adapt their speed. For example, a phy which performed rate adaptation with GMII (keeping the frequency at 125MHz) would not be supported. Although speed is one of the more prominent ways the link mode can differ from the phy interface mode, they can also differ in duplex. With pause-based rate adaptation, both the interface and link must be full duplex. However, with CRS-based rate adaptation, the interface must be half duplex, but the link mode may be full duplex. This can occur with 10PASS-TS and 2BASE-TL. In these cases, ethtool will report the "wrong" duplex. To fix this, a similar process could be performed for duplex. Signed-off-by: Sean Anderson --- Changes in v3: - New drivers/net/phy/phylink.c | 105 +++++++++++++++++++++++++++++++++----- include/linux/phylink.h | 6 ++- 2 files changed, 97 insertions(+), 14 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index b08716fe22c1..a952cdc7c96e 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -296,6 +296,75 @@ static void phylink_caps_to_linkmodes(unsigned long *linkmodes, } } +/** + * phy_interface_speed() - get the speed of a phy interface + * @interface: phy interface mode defined by &typedef phy_interface_t + * @link_speed: the speed of the link + * + * Some phy interfaces modes adapt to the speed of the underlying link (such as + * by duplicating data or changing the clock rate). Others, however, are fixed + * at a particular rate. Determine the speed of a phy interface mode for a + * particular link speed. + * + * Return: The speed of @interface + */ +static int phy_interface_speed(phy_interface_t interface, int link_speed) +{ + switch (interface) { + case PHY_INTERFACE_MODE_100BASEX: + return SPEED_100; + + case PHY_INTERFACE_MODE_TBI: + case PHY_INTERFACE_MODE_MOCA: + case PHY_INTERFACE_MODE_RTBI: + case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_1000BASEKX: + case PHY_INTERFACE_MODE_TRGMII: + return SPEED_1000; + + case PHY_INTERFACE_MODE_2500BASEX: + return SPEED_2500; + + case PHY_INTERFACE_MODE_5GBASER: + return SPEED_5000; + + case PHY_INTERFACE_MODE_XGMII: + case PHY_INTERFACE_MODE_RXAUI: + case PHY_INTERFACE_MODE_XAUI: + case PHY_INTERFACE_MODE_10GBASER: + case PHY_INTERFACE_MODE_10GKR: + return SPEED_10000; + + case PHY_INTERFACE_MODE_25GBASER: + return SPEED_25000; + + case PHY_INTERFACE_MODE_XLGMII: + return SPEED_40000; + + case PHY_INTERFACE_MODE_USXGMII: + case PHY_INTERFACE_MODE_RGMII_TXID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_QSGMII: + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_GMII: + case PHY_INTERFACE_MODE_REVRMII: + case PHY_INTERFACE_MODE_RMII: + case PHY_INTERFACE_MODE_SMII: + case PHY_INTERFACE_MODE_REVMII: + case PHY_INTERFACE_MODE_MII: + case PHY_INTERFACE_MODE_INTERNAL: + return link_speed; + + case PHY_INTERFACE_MODE_NA: + case PHY_INTERFACE_MODE_MAX: + break; + } + + return SPEED_UNKNOWN; +} + /** * phylink_get_linkmodes() - get acceptable link modes * @linkmodes: ethtool linkmode mask (must be already initialised) @@ -515,7 +584,7 @@ static int phylink_parse_fixedlink(struct phylink *pl, if (fixed_node) { ret = fwnode_property_read_u32(fixed_node, "speed", &speed); - pl->link_config.speed = speed; + pl->link_config.link_speed = speed; pl->link_config.duplex = DUPLEX_HALF; if (fwnode_property_read_bool(fixed_node, "full-duplex")) @@ -559,7 +628,7 @@ static int phylink_parse_fixedlink(struct phylink *pl, if (!ret) { pl->link_config.duplex = prop[1] ? DUPLEX_FULL : DUPLEX_HALF; - pl->link_config.speed = prop[2]; + pl->link_config.link_speed = prop[2]; if (prop[3]) __set_bit(ETHTOOL_LINK_MODE_Pause_BIT, pl->link_config.lp_advertising); @@ -569,11 +638,13 @@ static int phylink_parse_fixedlink(struct phylink *pl, } } - if (pl->link_config.speed > SPEED_1000 && + if (pl->link_config.link_speed > SPEED_1000 && pl->link_config.duplex != DUPLEX_FULL) phylink_warn(pl, "fixed link specifies half duplex for %dMbps link?\n", - pl->link_config.speed); + pl->link_config.link_speed); + pl->link_config.speed = phy_interface_speed(pl->link_config.interface, + pl->link_config.link_speed); bitmap_fill(pl->supported, __ETHTOOL_LINK_MODE_MASK_NBITS); linkmode_copy(pl->link_config.advertising, pl->supported); phylink_validate(pl, pl->supported, &pl->link_config); @@ -1270,7 +1341,8 @@ struct phylink *phylink_create(struct phylink_config *config, pl->link_port = PORT_MII; pl->link_config.interface = iface; pl->link_config.pause = MLO_PAUSE_AN; - pl->link_config.speed = SPEED_UNKNOWN; + pl->link_config.link_speed = SPEED_UNKNOWN; + pl->link_config.speed = phy_interface_speed(iface, SPEED_UNKNOWN); pl->link_config.duplex = DUPLEX_UNKNOWN; pl->link_config.an_enabled = true; pl->mac_ops = mac_ops; @@ -1335,7 +1407,9 @@ static void phylink_phy_change(struct phy_device *phydev, bool up) phy_get_pause(phydev, &tx_pause, &rx_pause); mutex_lock(&pl->state_mutex); - pl->phy_state.speed = phydev->speed; + pl->phy_state.link_speed = phydev->speed; + pl->phy_state.speed = phy_interface_speed(phydev->interface, + phydev->speed); pl->phy_state.duplex = phydev->duplex; pl->phy_state.pause = MLO_PAUSE_NONE; if (tx_pause) @@ -1413,7 +1487,8 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, pl->phydev = phy; pl->phy_state.interface = interface; pl->phy_state.pause = MLO_PAUSE_NONE; - pl->phy_state.speed = SPEED_UNKNOWN; + pl->phy_state.link_speed = SPEED_UNKNOWN; + pl->phy_state.speed = phy_interface_speed(interface, SPEED_UNKNOWN); pl->phy_state.duplex = DUPLEX_UNKNOWN; linkmode_copy(pl->supported, supported); linkmode_copy(pl->link_config.advertising, config.advertising); @@ -1857,7 +1932,7 @@ static void phylink_get_ksettings(const struct phylink_link_state *state, { phylink_merge_link_mode(kset->link_modes.advertising, state->advertising); linkmode_copy(kset->link_modes.lp_advertising, state->lp_advertising); - kset->base.speed = state->speed; + kset->base.speed = state->link_speed; kset->base.duplex = state->duplex; kset->base.autoneg = state->an_enabled ? AUTONEG_ENABLE : AUTONEG_DISABLE; @@ -1974,13 +2049,13 @@ int phylink_ethtool_ksettings_set(struct phylink *pl, * If the link parameters match, accept them but do nothing. */ if (pl->cur_link_an_mode == MLO_AN_FIXED) { - if (s->speed != pl->link_config.speed || + if (s->speed != pl->link_config.link_speed || s->duplex != pl->link_config.duplex) return -EINVAL; return 0; } - config.speed = s->speed; + config.link_speed = s->speed; config.duplex = s->duplex; break; @@ -1996,7 +2071,7 @@ int phylink_ethtool_ksettings_set(struct phylink *pl, return 0; } - config.speed = SPEED_UNKNOWN; + config.link_speed = SPEED_UNKNOWN; config.duplex = DUPLEX_UNKNOWN; break; @@ -2046,7 +2121,10 @@ int phylink_ethtool_ksettings_set(struct phylink *pl, if (config.an_enabled && phylink_is_empty_linkmode(config.advertising)) return -EINVAL; + config.speed = phy_interface_speed(config.interface, config.link_speed); + mutex_lock(&pl->state_mutex); + pl->link_config.link_speed = config.link_speed; pl->link_config.speed = config.speed; pl->link_config.duplex = config.duplex; pl->link_config.an_enabled = config.an_enabled; @@ -2291,7 +2369,7 @@ static int phylink_mii_emul_read(unsigned int reg, int val; fs.link = state->link; - fs.speed = state->speed; + fs.speed = state->link_speed; fs.duplex = state->duplex; fs.pause = test_bit(ETHTOOL_LINK_MODE_Pause_BIT, lpa); fs.asym_pause = test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, lpa); @@ -2588,7 +2666,8 @@ static int phylink_sfp_config(struct phylink *pl, u8 mode, memset(&config, 0, sizeof(config)); linkmode_copy(config.advertising, advertising); config.interface = PHY_INTERFACE_MODE_NA; - config.speed = SPEED_UNKNOWN; + config.link_speed = SPEED_UNKNOWN; + config.speed = PHY_INTERFACE_MODE_NA; config.duplex = DUPLEX_UNKNOWN; config.pause = MLO_PAUSE_AN; config.an_enabled = pl->link_config.an_enabled; diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 6d06896fc20d..30e3fbe19fb4 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -56,7 +56,10 @@ static inline bool phylink_autoneg_inband(unsigned int mode) * @lp_advertising: ethtool bitmask containing link partner advertised link * modes * @interface: link &typedef phy_interface_t mode - * @speed: link speed, one of the SPEED_* constants. + * @speed: interface speed, one of the SPEED_* constants. If + * @rate_adaptation is being performed, this will be different from + * @link_speed. + * @link_speed: link speed, one of the SPEED_* constants. * @duplex: link duplex mode, one of DUPLEX_* constants. * @pause: link pause state, described by MLO_PAUSE_* constants. * @link: true if the link is up. @@ -68,6 +71,7 @@ struct phylink_link_state { __ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising); phy_interface_t interface; int speed; + int link_speed; int duplex; int pause; unsigned int link:1; From patchwork Fri Jul 15 21:59:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919828 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 E1736C433EF for ; Fri, 15 Jul 2022 22:07:19 +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=8X4w6ttSYP70zYzpHAdjyuybMrA++Lk7IHDz04Q6FKw=; b=KUT3fahdnekypq YbyJ9JdrHHSrfu+D3XWrlzF9mo2TVx5a1Eb3UZ9f9p4dv9OiRO2ZhPZg02zQKGjKE9YvctOj9QvTZ ncvxMsPAhHWBFkNTtd6e8ZOmBrGllkkcyT1fgHN/340mKiE3PN9GthxTlEQy0eY288JmvPtYHWLRk mIhRSUTNiDyei4+NlEMiM2GP0lK7i535NRIa5wTY9d9oxrO8JTBLa7zaR5EdoDV5/9PitDoDsPM5q EWvtnlnqpKfXJi12/b2TJBYgggbhdHj/plfmwmMyv++TQeymE/yQuwg5ppq5V0fS5WKzglmLo4Bfm TALRSnzw4k+PHhToGScg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTRT-00AdOH-E7; Fri, 15 Jul 2022 22:05:48 +0000 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMX-00AaxO-PW for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:00:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bk4U1QvUIZvnEDOzMcds6sXSjVvsQJuZPrZzWerilzufdkHrGlxPkZhUptivw468zklyE5mqbpMacdocLY5yTwbhPUPaBFy2RjuRLyCMXXTZp/+yZYf0hph6ooB2/fNBcvCVW2DLGg9LqLsePJLPVzojVAm8qLevGoh1CE1cIZWfqdBDCf2Fp4Klb7PQx1DFdHjXs7QqcoeoIZgLtQ/qJ9DvDg79jHfmydwYe9TLi/pv1popvLTT4cEDYYXuyjD/e7dlvvuQDlm1PlysCazAKHKku7WiAd+MCkYbsoalFUnLCT09S6rSg2oVfAtoAS1+PXEa3ZVY6r59kIMIF25Urw== 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=s8S5vkHCVHFaGXHiSxQF0e0KS1/gsy/16H/z6qRK3mM=; b=Fag0cLLHQcQYwju/wkp84bxUg8o5BhJEFbpgGZ2ZgxBm7vbl+3x8bkVgE6dRoZI4AxoIE5rtLtJ/LaPgYfLJ2fMl5s30/hRxXqJTUlhSoevsonOIi+8ticubuTAnAu6eP1dfjwH6IY9vJ0DNXeRLMuCYm9jHEPFYxoO5cH8RYgrJhz9XCmfmQ6lD2eVPsJGTDs4IqRRE2cJmLLoz6IbwJjlE2/p1HJ4eStYhYBHKqLJwdf9flvfcf1zrNIIwxpft/6niWboimC+HpriyzV2u0/IAh3k/I7j6NBVvws2DAEiBNN2FbzCuL8ZB0U/JOeZpa4qLkGJ+uKDtgixHAAIiOw== 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=s8S5vkHCVHFaGXHiSxQF0e0KS1/gsy/16H/z6qRK3mM=; b=TyWnnxCkcbaqc789oWLz1gsMbBJm0+2epen7gHonxtqdN29+4QW846NTjwyT4AxXYcU+qYrJe0Bmp+rftDkXWA1fpqvB/cjgDc4s2sYMSxcUYZYZDWT+1f2BOYdsWRBY+vf2b0LPHOKnzXoB//rkZvAVnxhPsQ3/x61ORcAM+Mqksx+pB8cZJMvKwYhs5cvlr+MhY5xthq318j+ZdZ6NimLDgmMLpypxrI7xtmYKkBV0kU3h+M+Xq9ZfPIMC68AHKrEAiD2ZfN1bEZwlbH0OM2YOWYMCX7dME2/rPjHBpi8rwpsCJPlrB3SIiu31aO8FhVZ/sRPAQrtrijyTnKJ0vw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DBBPR03MB5302.eurprd03.prod.outlook.com (2603:10a6:10:f5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12; Fri, 15 Jul 2022 22:00:34 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:34 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Alexandru Marginean , Andrew Lunn , Heiner Kallweit , Vladimir Oltean Subject: [PATCH net-next v3 09/47] net: phylink: Adjust advertisement based on rate adaptation Date: Fri, 15 Jul 2022 17:59:16 -0400 Message-Id: <20220715215954.1449214-10-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 645de9af-2dac-43aa-7cce-08da66ad7115 X-MS-TrafficTypeDiagnostic: DBBPR03MB5302:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v3FzSN3JvqrBx0LzcJthB1/qHKUpMT8A6nzKGXdHuSLkIUkvCO4lebuNEqXpRg3ab2D5ev607YDIFtmE7Yw/zQw2Od2ydk3ZrKTVlavdKo88ywU9fhtQHzA31B+BI8tDnq1S06BNf4CSvxEFZzHfQl7Rq53eT+xjChN5xYm9knH3kbLr7o11rC8mB6SLS8IOYFJnRSJU7JRPBkkAfJa2pPlRWIuMmiV2GjXmWThXghLr+Rl++lzmZhpBtDRiZFFiTTq2+8mBBQ9ZuygI9HtQiDda+DeXF4+K2lcSGmCfgqiQuJ0hACTNHbROrw7HDcQSPiYxjQWJwZTOAetx8tU4Mo2yR8MyLfqGmD+l3wq/KRWYjrlY6wYzgd6Zyb86m/nQRSGGW54aS2eJqqe5Meq3vfeFpm67k9sRudnAxsEv4f7wRMYMsJ7LTEqvUxIExZaVVn+lHz6VOHqjReVuqaFf+esKwFMsq7zoUqwwNb4BtOOCRXfgtfj1XgRC6P720FhatAQ6ESEHWwCdb2fSVG4Y1Dg3rss/Uez4Y8oX5RG4jjKGc5Y8PB3A4Ol5aj5nzHSMutBGXhSVhy9L7hYpErpi3ASOh/DBQmbh+UblJz2YDvQd9KOl8rVK1zOWtWTIG9kZHWqlf5GhTzSGGF3nOWDz/S1UUDEmsbQ0c8inLGr6jPPA68l27IiL5KYr6Ssq8hBLGjGu7KeGf8kslJnM80Mh6B30+2reqwlREX1v2PYJqFujzoAW8/r5PDck/466ZwI1L5JzRJ2il2yZivtcl1EiamsI7PIg2zT32xec3ydc7i8puJlFE1kdszaw5L9vqY5o X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(366004)(396003)(136003)(39850400004)(346002)(478600001)(66556008)(41300700001)(66476007)(52116002)(6506007)(6486002)(6512007)(26005)(8676002)(6666004)(54906003)(86362001)(66946007)(316002)(8936002)(4326008)(83380400001)(38350700002)(2616005)(1076003)(186003)(7416002)(36756003)(110136005)(38100700002)(2906002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CjRl3b7uWQUcHAetC38hyD5KFLyj5AKY+KyzJIO06vA3C257CbfuGO2sYdjV1grvzd2jFOZAGrYTkKsbixBGohJFyHk8y6PBs4X7gNrhPxh/47CTUOLdLhun4V7QQwjI3IwtL5HKZYW3qtDh9DvdEdNxakO3K81++aOFPZoqT/9JRvmxYLLPdr8k0Q9ETHVDAKflTgcWpF564afwuhsptAAIa5h1+ujvm616OuG130URiHqxXmQa0+4m+hLgmp+zQcFc5YKNaH6xRowyYlZBu6T14SJUhsNKQ4X+Jsd0lj1smDt8I5v/x617Z3DRIRPUpU/7fBj2yaWCoxowhbG8N36/YEeOfwpi+hp/80odFESDyRI9cAxwscRw5H5xOdAuIetfXu6f6IPnWgc/nGBJ5EEqUFgwPMvuaXA+/7N64lr5iWYgUcgRw4Rj6W1XGcL+OQb3E+gdtOgg1hT5RGYSwrCtGJFw/UBAVMehVKire9rLmw6X1NSqBGHNE6Jo9Hn2FYDNI4Y8F974jG9mzs5zYIEDkzj2eHy3A3XzCgpWxEqybsw2eHfxrAyDRHf2VW4bLx+1NZIVfDjtYR/LI6EasajuLzhRjIogdYvyj2sJHYp8UUUsZFKYByBzb3QkyxybWAQDaaOa0ClAXIn7LXaScHUuoidLcXY8pGOYgtQaznQ7WKNMCteklSQVs8Ge6H1h4xBmLZsmOkgLJhixNHK18V0WN8/jJIjalHwxIVp4vk8VX8t/bRtSNubefDuTjzHLSDCEk85BFgsbUphZ9b8o129QPv10aFwpRCths5fYbpEIPUZkdBN+I6VdejkRbvKUp0QKNrFjp6bIBkiuD1VG6laShdjTw0/2/C4tDsU5ynp1khUNR7vLqWMNhEajta+laFiwCMIRgyvUjjGfnx7yl05KDpBhGyn2ckAyqh1fYvx5nyXP/9p4SOPUy9EhQtAfGiJ2Oo1yJB+gRNnmXxBy+9dJm5rWc3L8e5RZEdz/PxdMca9l7UIHDidVy70GvxfEktGoLgw9fAsvUEDI5jYihEkhmwj7EXzsoI/54AWIXT0v/PLcGwej7zZKlJeomxItOm+pgJHCv8OS/oVUf2OsR6TxPsZnZyCyP+gkNcb4/eMHMpy2gAP5/73XCB99qzfL3AN5iN54cumwagryOAixmuCNq7F5JcWDs2FWVBRsrRRYFVwHNBPnA4P0l6eNE28ZulrP/eKmb1gR3MasV+1E661iIAuUMVcu+07eOUGp41XJv/8bengdVW+axtlPsqC2RMoqP+L6nVvXOYAmIEVEy4hDPsqOTiuXjR536IzKxXTKozrKH+SFUoV8kfWVQXQ4IzYY2sFeeKQzmY/zZWLqhvKIcP6PeOF7JZFZYS3KkjkZXtkdH5uzDpo0sizPBgLixqpWmplnnLCqzs1ZjwIJTs4+7swNG/TVdi9n8/m8m/ZLa6ZPJD7SChN8PajZE36nm+wbqLejD2lAcLi7XxGBsUtM+oFWR9GIdDJnAEvnOfJIlK6KCMxH0pLwzh9owmT5AC/iCEX3wrbViDu0zkvF0dmdXvVyvfTZsIKS9PSyACwuTIk18GmYxqU31AzOspBBrND1JSJ+c/8X9ArSzMt/qw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 645de9af-2dac-43aa-7cce-08da66ad7115 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:34.0205 (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: 9QTpK5MDKwQkWM6SP0nGI7mwL/7D5QPVyplcbprzPBf+VyiUlRUpmA2IQXmXG9vdO4k8oBOI0f9niPrj1rDiBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB5302 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150041_879950_D0D5B260 X-CRM114-Status: GOOD ( 15.70 ) 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 adjusting the advertisement for pause-based rate adaptation. This may result in a lossy link, since the final link settings are not adjusted. Asymmetric pause support is necessary. It would be possible for a MAC supporting only symmetric pause to use pause-based rate adaptation, but only if pause reception was enabled as well. Signed-off-by: Sean Anderson --- Changes in v3: - New drivers/net/phy/phylink.c | 41 ++++++++++++++++++++++++++++++++++++--- include/linux/phylink.h | 6 +++++- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index a952cdc7c96e..7fa21941878e 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -370,13 +370,15 @@ static int phy_interface_speed(phy_interface_t interface, int link_speed) * @linkmodes: ethtool linkmode mask (must be already initialised) * @interface: phy interface mode defined by &typedef phy_interface_t * @mac_capabilities: bitmask of MAC capabilities + * @rate_adaptation: type of rate adaptation being performed * * Set all possible pause, speed and duplex linkmodes in @linkmodes that * are supported by the @interface mode and @mac_capabilities. @linkmodes * must have been initialised previously. */ void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface, - unsigned long mac_capabilities) + unsigned long mac_capabilities, + enum rate_adaptation rate_adaptation) { unsigned long caps = MAC_SYM_PAUSE | MAC_ASYM_PAUSE; @@ -451,7 +453,38 @@ void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface, break; } - phylink_caps_to_linkmodes(linkmodes, caps & mac_capabilities); + caps = caps & mac_capabilities; + + switch (rate_adaptation) { + case RATE_ADAPT_NONE: + break; + case RATE_ADAPT_PAUSE: { + unsigned long adapted_caps; + + /* The mac must support pause for this */ + if (!(caps & MAC_ASYM_PAUSE)) + goto open_loop; + + /* Can't adapt if there's nothing slower */ + if (__fls(caps) <= __fls(MAC_10)) + break; + + adapted_caps = GENMASK(__fls(caps), __fls(MAC_10HD)); + /* We can't use pause frames in half-duplex mode */ + adapted_caps &= ~(MAC_1000HD | MAC_100HD | MAC_10HD); + caps |= adapted_caps; + break; + } + case RATE_ADAPT_CRS: + /* TODO */ + break; + case RATE_ADAPT_OPEN_LOOP: +open_loop: + /* TODO */ + break; + } + + phylink_caps_to_linkmodes(linkmodes, caps); } EXPORT_SYMBOL_GPL(phylink_get_linkmodes); @@ -473,7 +506,8 @@ void phylink_generic_validate(struct phylink_config *config, phylink_set_port_modes(mask); phylink_set(mask, Autoneg); - phylink_get_linkmodes(mask, state->interface, config->mac_capabilities); + phylink_get_linkmodes(mask, state->interface, config->mac_capabilities, + state->rate_adaptation); linkmode_and(supported, supported, mask); linkmode_and(state->advertising, state->advertising, mask); @@ -1462,6 +1496,7 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, config.interface = PHY_INTERFACE_MODE_NA; else config.interface = interface; + config.rate_adaptation = phy_get_rate_adaptation(phy, config.interface); ret = phylink_validate(pl, supported, &config); if (ret) { diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 30e3fbe19fb4..f990f8eab655 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -65,6 +65,8 @@ static inline bool phylink_autoneg_inband(unsigned int mode) * @link: true if the link is up. * @an_enabled: true if autonegotiation is enabled/desired. * @an_complete: true if autonegotiation has completed. + * @rate_adaptation: method of throttling @interface_speed to @speed, one of + * RATE_ADAPT_* constants. */ struct phylink_link_state { __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising); @@ -74,6 +76,7 @@ struct phylink_link_state { int link_speed; int duplex; int pause; + enum rate_adaptation rate_adaptation; unsigned int link:1; unsigned int an_enabled:1; unsigned int an_complete:1; @@ -523,7 +526,8 @@ void pcs_link_up(struct phylink_pcs *pcs, unsigned int mode, #endif void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface, - unsigned long mac_capabilities); + unsigned long mac_capabilities, + enum rate_adaptation rate_adaptation); void phylink_generic_validate(struct phylink_config *config, unsigned long *supported, struct phylink_link_state *state); From patchwork Fri Jul 15 21:59:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919829 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 05814C43334 for ; Fri, 15 Jul 2022 22:07:53 +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=SsFF8nbDqo/IGScN2aO9z/ypEEu+KnWSCmv0boq1g2Y=; b=TqasYju6mbOInD k+/ZmeKifZRtlmwhyvo4J4vH3NbrsTGqo4jOLhK64JlF+vqfZnl6CY/UR0jxcNFsdvXiPLGoYR/S7 7bsd8w/vBDJ48KGZ3B3PaPVj9zIRR1cWfNzJuVaORGhfhliWHLuxGLBtFzHIPRQ5+vakuHNoNlVL3 k5Q6DVhivmZVz04P4zQ2/WI7ylCATp56h5HaoD/UfvZzd7aNPdglVTrU2fHc0HBThq6tC9j26HgiK ugsAh3W82EVex0UPzOo5h6dKDJTFCE3T3RlnLtvzdJ05jkipSw+7O2cAndttOeUe4NkOi0z4kfvHj H0J9dhgZzgzwlZF8o/1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTS3-00AdeL-2v; Fri, 15 Jul 2022 22:06:24 +0000 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMZ-00AaxO-Ou for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:00:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q3KfH0k+3lFOmAebcdTpD+JdxJCSjH73qlB2DgJHS0IPHX4rV3Id8N8+inytOmPWQe5Y3oTQGxdFzhojScBV5qRRxc7y+WIy1sePWc3wNj2Ry7cDQqk+L2TQGx2O44anCTT9mXjZPs96f1rrVa3Z2s2AKZWY7OGsJOaEYQvvAD1ZH9iTTcTFdwKx1zGJqhWoJ+/uDItJDMUhR0EY3ZopI54vQNvKzvi8bFCvQtZbaPVoBSqDCr2DCBoJVlKW0UdntllAtJZXrALjWChdwHgpLpaKGSkRh+EtKM6MzunYbcWHPoIMkiythzkoaHG6Ly9CZLgI+Y31pRpF39ErmYRAHQ== 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=cg+cQIc2FCegiIrEJm1vgOxmPE0VZWdYu4MNifUz/hE=; b=a84FKrKy4mP2ukgYPDxG4GWEDWvwfvSn3U9/gtlKcA6Bc90257vbSjlmWuDXP1mfqYCiCJOXWYl52qWzlS/XvtLk8D2bc+1oq3Aw4ziV1qOe56NEJxpW1qm9F3fXffJ7NpOETzf8agsjqEIu0ZI6bIaE+l8mDycmqvmARVYQ3zb/IMOpVnKQVSWQsBkO3gR9FAoQzv3LKkOQoDPfBso/QH7rTiDrwKRB/oULIn6OzsEX9PewZk5TGk5GnWblPPJTlGZe/qOzAQNu4pgnwiIof5DOfYLcKPPTXjXQhDc5uf04pDe6Wib6JZLyyNcjIyinbLpzAAgbp/Wgu3K1Fzkktg== 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=cg+cQIc2FCegiIrEJm1vgOxmPE0VZWdYu4MNifUz/hE=; b=KczAAExYZ+FmO6xHiNJW3p4R1xJWtNtb+j0J2Bxrg84I01sycuBXMHhDwrKNWLTKWZyLejHlKdhoopMpYCswoSnJnu9xM8wwLxyP+Sako6UkuVmevfgHlPCNz0MNjkxyuntFwGIG5bihx3sG7hqUaOJs9K1CbvqtaGrubwvvSqMiJU53dPHmStxcGd6/JCDRDSuKkyfWeBS0eTLaSaF2Bl6TlVzIcweH5v3rgolmYoq1adDGl75QsBejDnV15o6BZYw1xlGfbEU89hwu9guo5dkHdvzj2576upxiWlpCOZjkvZgyzPB8W35oeQ1HmXH746h3s1FF9+bp0fvhbCuOsQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DBBPR03MB5302.eurprd03.prod.outlook.com (2603:10a6:10:f5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12; Fri, 15 Jul 2022 22:00:36 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:36 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Alexandru Marginean , Andrew Lunn , Heiner Kallweit , Vladimir Oltean Subject: [PATCH net-next v3 10/47] net: phylink: Adjust link settings based on rate adaptation Date: Fri, 15 Jul 2022 17:59:17 -0400 Message-Id: <20220715215954.1449214-11-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4649dcbe-6849-45dc-03ac-08da66ad72a6 X-MS-TrafficTypeDiagnostic: DBBPR03MB5302:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W3IR3uvBcAd91RqBLqkDIQlVadFWDTfntzBkNXJ4UwROAL0de8Hm0CHUFmu91naETOHDkrNndOhCoRowtV1CxBy7q3mEPJkQF9HGxVT2VvZcnCQ4zgCfuemCwOwtSM/nDFNYjRr7ZPvmar2l9ExjJJdKnSp0WhY7h6b31Q9qAtAtpa/90hdsIDAgp/j2j3RzhsjABkLrZ8WsQRjp3K8b4tf4JaMnESUUIqkNym3hS8WzgXpN4mKFi1P5tmcmZREOqERxG+1NBlvW76No2DgsOaYZa3ZVY68imoaNZfIqMnnNfzQOdKMwG05ArBMowrLyVXqRBixHrNXxkJ+WvnePXmQDRJZ7MDGcd8d1mGMYSy0sFeFuSQnmOTi+rAeSNWJ1nm60vH+CGByLmyq7h1GFK3Mr3Z98ms5QVxtQzZ8jwwZ41p3pe7PPk00gU9aaFYJVhB7P1JpJTgJSWUpWO2HlrabV0yCBFEBOlIuiwAqGNMNds/KzFWBVDdMqVCdrJbw+DqQlb7wj9Kv/WLGOoHfnVVv7iZTg5ORf3m8f7u274TL4Ms5HqCA7hjVMLEYE7m9Vk/jQkCkkRRLhw9f3GIyivbZFPxKOTHiWJstPf/Tc80CekOqMc7T3+HOWtEbeHzgAvdsTbjpiTWn6NMmxZm6JWbiVHEhMNJb60pWuk1aA2VKpIsrQQf2SUBhXxcrkbnJ/fPWxDAd6PsUAcHijakrXD28T9r4cmdN66XMtzktmck6kqvAPUKz7HRYkXoEf1B9EVAyrSqm4bMBnaFoJG0PbXs2HYfZTC7gWL57K2Xyn3rFC0YLK9FtcXJg836Z+QouN X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(366004)(396003)(136003)(39850400004)(346002)(478600001)(66556008)(41300700001)(66476007)(52116002)(6506007)(6486002)(6512007)(26005)(8676002)(6666004)(54906003)(86362001)(66946007)(316002)(8936002)(4326008)(38350700002)(2616005)(1076003)(186003)(7416002)(36756003)(4744005)(110136005)(38100700002)(2906002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gQvWoKs+Dm2Lw8jDw6WoO3TdjHsk0GpJpNe43thPT7Dy4EfSnxFtop4yEtnnguH1PvmU+JveOG/2vOfL47PygdCsBfayUGKjvaYiQXVFVnGfqz6pmGKvvwUCzRBw6GwXrVjGcnXVqbXBabz2Wm/3HqRn6jukLJHYAgh1mvIWcwkNZl6XmCBbVie/2JKVgqPxdvmxMBk0h3CzFAWJmIxyn+a8ktOnXNaliJpJ4K08SAcBqHv4LMlNklxGLed5aEplVZ5Eehj87G8GP9MQhlkAdvLbrlgEJ6UoYjTubTheoxVaF92OAlgTcUymOKFQzeM3pwIVW5E3WLdmRovYsYojiqHZb6Y3ld+/0OwAzTA3D/xQHO4E8PjC9idam3m/0eh7gajIDoq3x/Mw7/ltB6oDvsfRBV28vrV9gfX4Tj00o9M/wqAEDqfZwgJP8giK7ueuVwHiVuv6cqrMme8fj6T5UQrlP3+KrYWUWkM6hZDgIYkYEFs753cSXv/cfCzNfzzaDypTXvuC+TDn7lJDq1AU4WoxsuyyGDdsCBRoQ2h2XIP4pTrEgLvI/vyNOFCJGGAOEiHsuj1hx9+WMiNW4J//Yi4DPKBhB4oLwQHY2yBHN3faEpINEHthAtw2pkWfAVywpU2YWgCKxWkpAgztt+yicH6PJ7CGSrsRWpMpZqk5ExnbNgQrYd2eZYChe/SsSY4Zb1iZhB0BxMY2dPcb7qmwvxXRyKhAckdTo7kUDTEh4539+cnyJV06Wlx4RTt/ZDvytl3LzW9b12cCRRM/nvY8g2JhsWDfQkVn+ayaNcrr3+oYnXGGSnhB8Q/dL4rPxeq9LtO5IRe+TRwmPcPV7YmE0KgpAEcefLab6XaZWA8aUde//KU5L+OVwNIDDQK0ClS7g7hg//8coi+HpJmrMCQd3dYzUMgCNbVcTqrXZpjrUj+lcuXlZjEe/1B1xvbfjPG4Zw00ZEgTlNxA20tAnhtBxfgfEs8EpmDF5i0z/OAfAeF91/PlwQ6Vc5ZgSwqXXrqBp5uMkxb6ZQW8rczfPGZeMXjeBGSwzm59ODFvMOCjbuLps+Go/g3tbDsBCJtcyMEsluWBHPzX0bueW5NiLDfAAZ14ZqKNK7McXW6SS7TPaumNvw3/XlIuhdrefB6rUTeEMTqZYu+AhjOYfkEk1+Gpl04ooJpdg+mMxQyEgjaoFo4nYE8EZrOdBztYFSLTKeZv0RZiyB3jSRyqzX8diu53VYnAzkZlerpjvDnURjahNYP9aCicbrEfPZLJyo5q4DPAoWGFn4cFUtq3E/42yI1mw2nXi7tkfji4DgE4UxmP+oXTca6Dk32jrlHHHafC6ez136lMwarKYgVnvzRGASJCCibdaN35htL9fXpkNMYp2c+LimJsfOWTYlWzzQVgOIvi/1T5tdYFLy2BhpS6pZ22cLajVhQnP7mpIPsRFO6y+dA3he6RnTqof1WAuR/uqdzZhhmB9tQgOsPioPOW0WfkJ9hRJKr/PeceWd8h+ZapVWuTNt+uHK81cA8KxJe/7hQtWEQ1Cep9L0XwyieQkXJK+Xh3c65/n+LWSMFsZiA+RXk5ZI9afxQNopt21jRiTemgV8/thrsSD3TTR8MVlBWW2Q== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4649dcbe-6849-45dc-03ac-08da66ad72a6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:36.7391 (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: /dkRvH94JsITO3oYo4yPGMdI6klXNuTXkUXz36twTIIMaFFF/Sq9YC1s4fu3Oz5b6Dy+a/M2opFLxfv+aoMTkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB5302 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150043_852858_BA276D8B X-CRM114-Status: UNSURE ( 8.78 ) 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 If the phy is configured to use pause-based rate adaptation, ensure that the link is full duplex with pause frame reception enabled. Note that these settings may be overridden by ethtool. Signed-off-by: Sean Anderson --- Changes in v3: - New drivers/net/phy/phylink.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 7fa21941878e..7f65413aa778 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1445,6 +1445,10 @@ static void phylink_phy_change(struct phy_device *phydev, bool up) pl->phy_state.speed = phy_interface_speed(phydev->interface, phydev->speed); pl->phy_state.duplex = phydev->duplex; + if (phydev->rate_adaptation == RATE_ADAPT_PAUSE) { + pl->phy_state.duplex = DUPLEX_FULL; + rx_pause = true; + } pl->phy_state.pause = MLO_PAUSE_NONE; if (tx_pause) pl->phy_state.pause |= MLO_PAUSE_TX; From patchwork Fri Jul 15 21:59:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919832 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 A1114C433EF for ; Fri, 15 Jul 2022 22:08:54 +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=AY1FVZR0nGPLhNK0rayYC8bonbWHeke4GVg9lTKcsI4=; b=FlORme9IA8akNi y5PlT+p6sFd0oSEW8RbxoVPAanH0Rj17jMrR/szKdsbEn8YWcADQuvaGlMIOhyuGOwI2pPRB1NOzG p/mHX2ehYZ2ENyfGFGMzLxU78UQaw0RrsXm0AmDg1B/tD8HA+XXxDQ/uQmg6avJSAMY8LhHfHylPu jhBhasmTC+/SAC0Jd4Ufn/9zCl5X2/hcXxdW1C1Q5z8K03+c+Vtrj5nCXq32YVUfrh1L9aj7ve882 gy+2+hLG3Jjl4CpkMz02eO/pBGGrJwcQX4Dch4OfkOVXV15L2EOe1Th0hcGan3fxvqciUMo0zUOXX d4isDaS/31AxZM2n5iqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTTE-00AeAa-Ny; Fri, 15 Jul 2022 22:07:38 +0000 Received: from mail-vi1eur05on2060.outbound.protection.outlook.com ([40.107.21.60] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMb-00AaxO-KD for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:00:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eyIddqJ5i+7583/fATQabBlrg05q5GqltoZABYXN+NJKUoHxf1tBCmwKrgzkRaYtsDZaTye/uHWT6s7qEd9xScL7jaZ0zc2iLZHKninhE3TnDYw4W/WkH1cRL1hNB2nuEWhvCGTJBjQLV8K79XZTewN6Gp+O1/rqGWC4uiLluymJU4ku5PDI2QwDebGbHApRuiRN0zKVvY0fEqrhmCmtX0HY35+lRoOwEIbETnouPh01Aq1ytZntq4uoJYUeEv2s4UNEQuEayi+aa5a/OpHpDUhrgz/ltmFaBUJu3sTpoV+z0X29WKRYiIJPO4ePc5tyCldF32mFLnZaMQ8QflsL7w== 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=Rj1f/6Q3rCM+U+fKBQWiPEzPTplB//hSzLGZK1FkSg8=; b=PIkdmpKNzHmDLPS6oXlDz6GwSZMvw39S/4AUbWiu3KeuYpgqFmhKPBmGAgc4/D1Zf8lVM2Wie+mckcdsvZ3pgRYrqxir8qg7U+zpEhZBZPq5PfxmFNRhoWpO7hch6jGvSxbzrn5DbUXbAWXh3esK/b4UnoE5dxLspT+LAte7TuKjao8GouCQNQ+4hkov0QFqJXvwuQGiVHiRj1WKUFl9wiIfUCHfdZ815KhxHG2aJOLFNDfHmhayu17mfsNBrs5dzVun7wFpFj+5BxMHRADOb+Q5NgnS3MzRSnaV8CNYS8/urnOTi37gX8WTi5Ty9ROtwRfJzO3lbnNljM5rxF/r/w== 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=Rj1f/6Q3rCM+U+fKBQWiPEzPTplB//hSzLGZK1FkSg8=; b=pRYpGMrn/in0zr0b88AAdRwbbjf176axf+mc6UMjbst2jG4iMgd4ePkQqPqwii6PoB8bqJBNQsIs7EzcfXfDs3qKemxv63r4nE7YJZd/YCsRabrT2Db5D3qLmeC5hFE4i9etAO52EbmvIwoQ3zjGNZesd5FBURXytxFKnLO4/YtAfJP4hH20x5A/2vK+X9mA0OLtMwpDO5Zd+wCsLggvaqGJ42BBaM6CcIj4NPWTnBnrTtidbqm3AKzTsVjkGyj9cJoCiS6vS1BqDmxnt3h6Qr+7Og22itTW09kPqrxOda6yV2PxQnqU6HlF52gncVvoDo2JckDZKhqyyZ/RMv/qUA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DBBPR03MB5302.eurprd03.prod.outlook.com (2603:10a6:10:f5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12; Fri, 15 Jul 2022 22:00:38 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:38 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 11/47] [RFC] net: phylink: Add support for CRS-based rate adaptation Date: Fri, 15 Jul 2022 17:59:18 -0400 Message-Id: <20220715215954.1449214-12-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a6873a7-c932-4ad1-04ab-08da66ad73ef X-MS-TrafficTypeDiagnostic: DBBPR03MB5302:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QtUfj3aOnZ78oDU2z4JgNwJIC3j4OZcSe73n4ObtobzMpMRmwm5xgzu0RGccuLtdPGDZbAlEm9R/N8nLyliovEymc3IG/D6g4JvgEi5QolUNF+Nb+3ue1v3tctU6T7IG5x5HnT6go8BiwxUmsqe7fbeV+Sxol9lHdzN+9OcoISwkmYINPhD0Xgy8C/eGyZFsgy5rOkKrDg0X+vksKKef7uiFyDsYxPU0HrJQ2wAmG9/CQCqfCInEpP5CdFYIKeY4T9abElPwSACHK8C7DokKXFQlv8WcUyuKVh9AAFvAv9D4jUEyBKpOKadBMgyZb3y+Pnnf+h/hE96Z/jY6myh+18Cjh21QLuxpVvAIL3wZOtVIKtlE74ttQrUqrdWqd1/YakrhcNqe5KwTHrpMOKgXDsAnh2nKklOmviMa89PXQvOfdYmODVL4iRgKkt/j+43x41fMZ6pGlCZ+45yLIaCvRWcsEh8ZuQPeDEjgg3AAiQhA7WwdFL9pUijnLMDRWbPjfGwcmrZaJ25TEa+7b6QaH4+BNYtVXsRi1XgZfYK/+9/irg5scR31pmLpl8fxJIVjCsIWvqWLGGvnGTLLQT90RVq1+XZg260xs7FXRdZQB1KcYlpCYxuSqZwqMun4fSGPRZpJGSBVUgWe1QGW1XXQHmR6Bn0WtasEYbaYb5Ac3FRucK+Ou6jn5YqeD5xLjo2CQkbW0fs4vAVsZsy78TZaZrUd+/H4Zn8CaqpOxTs5cl1dq9ggbUOn7VvFUufOSfLxL0Axsyz9cV9ADYln5+6vNDWEY7mDynAwcW9DHERk4VrbMG4aeUJU+6mpomxu1Ozn X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(366004)(396003)(136003)(39850400004)(346002)(478600001)(66556008)(41300700001)(66476007)(52116002)(6506007)(6486002)(6512007)(26005)(8676002)(6666004)(54906003)(86362001)(66946007)(316002)(8936002)(4326008)(83380400001)(38350700002)(2616005)(1076003)(186003)(107886003)(36756003)(110136005)(38100700002)(2906002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0vrV6z6jDv6PEokF8H7FKNfz3OfVHJIHjtW8HSQAnmtByPAHeYsjd+PtpqaN2dfIZCW6hYZZ7m9w2MboliV8IeyATjH+/cYH/gWHM4Y/ukA5hp+qakumn2FVXeoYLDFgpGANaAeW0iQ3QIfuzgwNGD0OpFKPuDjKG/W9yCTBIGK2aQ7QXVenvqkjjTqHM/jQZsLuXa1BHS/SDDU/kdVAw+T79sA3pIrEYNkQFgTT1Bii4Vs8EgbWvF8WFbRd/F4VmJNuTp0p+AGLb1qpT08zG6BPPxaUN1G0oHa3ji0uxzBa0X+tVm50AvQ0n+TLtYAxPI7GJYkbtzimvYSSjm7PeG6bysy8wSldT/U/gVNBAEHON64kN4timx8Zfpz3tbL1qaeWQzkYO4NxQpWsFQOKqj65x2vaD9yszM8LYE4BI/70XxMKT70Zc/uVYsW/v1pDwJVpm/naCEnSuDCKqlq4CSR3bJRUeISfOO/yFLlQ2hDywYcWVYT742cSCLvI85KkJo2Gw+XZxQoi9hAIVY2jExWuuvRrZ/2sHnBIcAgV4rsOktJ6TckajjfRHi3/ygNy/CpG9abouxqMXXvD6VFEicjbZHmCId+cQJDHSX/RVntuw+62nwrGghJdyegI2O4509IgGATvxcTX3EaWJpmBGdAqAzC3VcxzLCkZmCa8p67S0ZEkyP321kfe3pumW3c675WgiY0+50M2gvhqnRLm0Kfbu6PVfDkGy3YMakQMU1hQtzafCD9+d0optAsK7qQfDugvXrY0D0V8SWsANpbj6WMf2f4VkADWbPs1dFRC1mUZxazY+B7rqIXqiODEs0ddjBY2U9LaQLzeeJv5vxVjXwnfMPz5x0CswUplUv361bNxldzbkAam6WfTHiSRSZrV9USfr9kWB6mYLXiI+UH4chtoOirKUmyvxuBSSHn8D4aE3Lk2TWTwsvCC5mqWqI8sX7KOSTgAM3tXm/P/VqwJ8tDGYC83XZpHDyR20anMIYPJy+sjNEdhYAJCFDdPTTlRJbWr62DDCK4GoMEWb7+G5D49QKUXbKhYInWs2Y+i33CSly7kcHHz8anZz3f/fPS5PUrWtzwFzYZjlRMjWRF+rje9YOO5Wr4cfvY+3btkfmnXERgeF5AeZriReeSSNUDpZeg1CEp8e42xUMxXUUhqmeoSaeLnlrKFx7HZCO1sKE4xusDLHLqVdj+Rt5oXrl6NXNHSfSk3sN8RjzHAIyXsPJ4jd3f54y07egGXsqeR9aDEH3l9KqDyy8wUZ75JWqUqpoHAwnK6bLlOOtyMePyuHKQnom+stK8aUMzu2f0W41mH+CI7qxsQ14aM4oj4xBx9wv2iaHbHJunyNtFH2PNQTqaYQHbROv0Vtiuq5FFxeNEsReHCgl6+7YBxuiLaD9i2pesIzWreYIAjJJziEZyA90HGUAk1pD5mrrHu1AVv4aDlEw6ZPnF2f42HG8Uubp3p9tkpPGefShXrvFUBcFjEtOBEOhAPjQeBaKDzPe0I3nNFsG3ukwVMLim85NXIyisnc3ync3ruhDDhRvlgYFQIoAkvVzil9zR/2CyCS95zYPrlDB7NPVrhrwU4/2db9K/I0b8HVRJNO00QFHRBvUfy2A== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a6873a7-c932-4ad1-04ab-08da66ad73ef X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:38.7547 (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: too/o8nF7Vob6VzAKGhd+UahszxSMjuBa3MDJtq0DYlfdcrpwHiITmP6Zf6OMM26xBdgr8xMVbpCv/k0+bS3Qw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB5302 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150045_741742_CBE060CA X-CRM114-Status: GOOD ( 15.07 ) 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 CRS-based rate adaptation, such as the type used for 10PASS-TS and 2BASE-TL. As these link modes are not supported by any in-tree phy, this patch is marked as RFC. It serves chiefly to illustrate the approach to adding support for another rate adaptation type. Signed-off-by: Sean Anderson --- Changes in v3: - New drivers/net/phy/phylink.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 7f65413aa778..d27f6d23861c 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -476,7 +476,15 @@ void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface, break; } case RATE_ADAPT_CRS: - /* TODO */ + /* We can only adapt if the MAC supports half-duplex at the + * interface speed + */ + if (caps & MAC_1000) { + if (mac_capabilities & MAC_1000HD) + caps |= MAC_100 | MAC_10; + } else if (caps & MAC_100 && mac_capabilities & MAC_100HD) { + caps |= MAC_10; + } break; case RATE_ADAPT_OPEN_LOOP: open_loop: @@ -1448,6 +1456,8 @@ static void phylink_phy_change(struct phy_device *phydev, bool up) if (phydev->rate_adaptation == RATE_ADAPT_PAUSE) { pl->phy_state.duplex = DUPLEX_FULL; rx_pause = true; + } else if (phydev->rate_adaptation == RATE_ADAPT_CRS) { + pl->phy_state.duplex = DUPLEX_HALF; } pl->phy_state.pause = MLO_PAUSE_NONE; if (tx_pause) From patchwork Fri Jul 15 21:59:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919833 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 B7111C433EF for ; Fri, 15 Jul 2022 22:09: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=/gmUyrVHuR0D5OJIg3aek1utwjZpATRnACyBORTHF9g=; b=Kwfhm9W5fdZ8Lr 33jYwtuBFRMUeDAoJ55v9eHfFHmx3wDm6ZhqNRVTvytKF9eZbb8YywcyYtDv7+04Io2dBlAV2YxHm 8OLigELMA4choiK02AVdtgTV+GhH2NnGFBquvFaNQC0rewK51vq15D/Tk04SrLbj7MSIwyJ0ZT+Os vNZ3EXouTZLtPFIuSGdPv5s0EMsL9d3YGrhyIfmOckyYbYDq+UFVdcL+7kxk9nij8msdHJypjVA12 HYoT+9gwSNSwMPdMBmTpjbM6BuN+jzY3CV32I+v9JEWc3D+QVb9+YE2BhARu55sXPEXJ903OLBs7i qOj3yPW5c1Ddop2iHlhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTTn-00AeMQ-0t; Fri, 15 Jul 2022 22:08:11 +0000 Received: from mail-eopbgr50063.outbound.protection.outlook.com ([40.107.5.63] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMb-00Ab8A-Lj for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:00:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h+whvttEnfaYbZaOyzuobw6cS0ScGbZkqRK+Qa4v0V2klq1pyxDmurpy0Bhh3CpegZS2rPSFD5tA6t5ZgfCF4l0iSnWAd6hVw7x0QEuRPboCrnso31fNyq6K+GJfMYfm+/oNDc5jmNCW4gQHoFb0MKFnpWrUKy27DnZo4jEf1mxFCgLN0jKVb2KJzHBEW0/hGH4iYGCTFxefbUiUayi1/A6So2h6trwWI9Ev9Kulky0yZtCpLlvrSsmHWSwfag9h0WNxcvDsjzYjNsXarVrEFSfai68o6pVUe6jxLM9WMBFFdA9gfvHR6ENLXp6vY2JqZoWq2vUBtFot+zOJo8lQ+Q== 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=ALy1Mp8Kayet9h3WO5ALQ+i8lgiqf6yX3kfdI7pNkVM=; b=mU1yJaFM0SI8Nrw/w2AJij79OYjrK4D2a2Z0+vj9sozwGr1cfENOvwcwR4btFKn6S91GVmbfWC7AjUdc5LJGDfAkoMUZZR3qRvscexvfUSVNcSxq3tLDS0aFgiDe44q7AucxvVV6uxCDUGQeRvILyVYzIR9V28okocKb47YshXoZGhkWD2bK2xecuVOwzVNU7hfmFI74D3pw70wN0tvmSvQRzMYr585VX0V04iXskuLE7PmuC257gMZYiLz3fWRMk0aGcv2fziyEqDOIzfaHyzC2iKYaw7T6nPDoKtjR4FpkxumcV+Cr9HWQGXzydID4CpJpQoRzjtMs1ZS41WJFvg== 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=ALy1Mp8Kayet9h3WO5ALQ+i8lgiqf6yX3kfdI7pNkVM=; b=zTVZAGxfgekrftN8Y4QkJXXOn4aid/Zfr9a1+D2rz99aRY84M3mVnqV0UDXkGPtbr33HSJnqclwzSUmdZhGJXVw1Gn6/yJkd/rFYCetTQYv7aAIlYV+FvxLCf6M+3VQ+z1OlIWbbezwK6PQfljfaoGBc7vEgR+Gdgwhn3tyXm1u2yz0KYyOd3dzYk8MmBrhywlIGyBm22RM6XcBESPbWn6e+XVofmzlN/+VM/ecZ5UmGsW0BsDJRToRnNPWVIJNWmd4fpEYQuTXjtI69B9EyKAUD0682L9UR+GDgBa4T6EPpoee+ZTjc5TtOnhqbsMwM8ycPVuEuAidUFzEDiFthUQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DU0PR03MB8598.eurprd03.prod.outlook.com (2603:10a6:10:3e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.15; Fri, 15 Jul 2022 22:00:41 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:41 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Alexandru Marginean , Andrew Lunn , Heiner Kallweit , Vladimir Oltean Subject: [PATCH net-next v3 12/47] net: phy: aquantia: Add support for AQR115 Date: Fri, 15 Jul 2022 17:59:19 -0400 Message-Id: <20220715215954.1449214-13-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 790f4b5e-80f6-4374-9feb-08da66ad7573 X-MS-TrafficTypeDiagnostic: DU0PR03MB8598:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2pLrehLdgPvopI7ozN3gHWmfycUZyjEExrlrNmP6FQtxZ3c36hrmy/Fh/Qg+t4w4DvolcpVRozENzaw54F6v2dRdZcyZEd2cq0q9G4U9F5gUaQ0QTpjcdbFhRBTp2FuS4hOcAJcKMtB0yIn2cMVXUd2KPVlySDUZXb9cQ2BnBAsBwlZ2QAcerb52ANSNbH8DqARHNA1M4aqfL8t1blatuNMgM8m9yN2t89uBIEfJapvhxzfggmITsLt2bx4OLQd70e2xh+yTKtdqkHitkrsbG0DwG8/r2nCNubdMllYow2JyAQ/xhN0rspLQNQBao+eJAbv0UExYk+tceagvMPb79b6wWLjiU6UJomdT+XaMZ7rK+o9hICVUQsNSuXC9/6hX/fyi4z5uCq8T+YlesFwOaIapHO6Rxt477EuL3l2wqx1hNBXOjuTRTggOchqo8Wb+oywmPKkZT9habXWTmK+8fM8EmDmqmGTPDr9H0tWjT3rG7iNHXIk+sNtBVgt+/d/DiPz4P3kmyao5hzrgVdKAHtVrrNR8haERgPKU9LfU+XWQQ4ExDnSw10IGvRzLV7HKc5Z3iDzc7MGGgczujqcwtgFWafdCveZ5rga/vZYFquI9tEZqAQM+ojB14n+f67QLDeW8+uLNskFTAzJLb7kSyIuu30DQa8qlO5x8IIMaPSjsbtkGLEUwI4xKgRQE3iPt8cMbXFcOSYPxDCG6oZi05E1y8x9vRk9K/Bgtc9v+2XO0/mxbl2z/4GziztzpCwnKsoJMQZgH02+u6MsH5l9mT9WL5S+NcNDjdAzehTgLxkPl7Ioo8V8rpVYgYDE/1EHF X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(366004)(39850400004)(376002)(346002)(396003)(5660300002)(8936002)(44832011)(7416002)(2906002)(54906003)(66556008)(4326008)(8676002)(66476007)(66946007)(110136005)(86362001)(316002)(186003)(2616005)(26005)(38350700002)(52116002)(36756003)(6666004)(41300700001)(478600001)(6486002)(1076003)(6506007)(83380400001)(6512007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ElS4Ew3G/40Tl9xpIwmUIZV5BEGAbk4jXzOD+ETn7ACm9XoaZRrDsrDyfpzGJa+htZWHyCbUEWoFfIsta62iINM7wS0djJlFusuQqxcgiWtvEKIMn08GXTX4OLzlB+i/yQdQYnDvwZkd5WI+8keMKfUErMg8xM74wMRjBkiUqzfgWf/FsCp0FMFC8IGAzIMcUQorwi2rSWtlBqSdDWHzu576/CYd104cZHG7XcM64Try63Gfm4Ays71FohrCO1zHnwvqKkM4jAflCmMjnFVNmA/0BeJmjK/S13cKV8otc5WfMiktYZ/uwAs6VsocD2RS0nyB5tb52JO4Xr4cMUmkSNTOnOK3za+Y8UVEDG231PnqGcraTmWC67+H4kHs4qA99/qEOPr3U3qIOTo+PlsMKgbovKugbaS9Vl2FrqWwGvm3p7EPe1Mzahi+Ey1NAkwrOMGrEyK4QyCwj4qgC7+cVLIDQxyWf5KTaaIEuRal2XYwgpqJOrED1CzscyndSrypUeRB5KDXh0ybsIrUZmkToSql/1gTe9cI/nxsJWkz5cs2ZVGkYKj6tRE5BE1nuj3y1flLMwAIB/L25/hgODx4BHryuWuc+9WdZ9ZNzauWr5VnbvHuwUKY59U2j49bKVYVW34kM5QW8PWF9WIQK7Uxe8ojtUB+9jKKCq9dmYBi8dkhnJ3/buibQIaQ50W83T2WLE4u1QVhOsjaUgi6ADaa3EIj99jREXsDvHXtPJicEFaT8sGVbuIfibAggvxnu1LRxlVAzTz7XUxlmrEMkEouA3tgxpNlKJfD6TQffBADFanAjFokCchgTFsbD4K80/Fh7EHNY7AcqjBdDjExKzqk0clLmDeVQs3ejfAT1UxklG0F71enxczswB8aqXs2Uu4r/+8SYNVrtknD5DW24PJdeHqzvcAKZOeXp+HDU6r6ueX0qDV3ge0tRzek3w1obPN0QbhZ4+9BlYuzUJSVglDYlKguGlgMIa0xdSIGijh/o50jMMkwKpH+LrZU/3v3aLntivoH70HXhg4cY7pCXfv55rm1bWvVkdU6+3lz4W217j2aiRenV47jpgieWNLmf+7bvxClUpdrcML25iDPgAA260WQ6d2/E1vnp3dp90HSGf4uR03wcAq25co7dizGNL1ll5okn36Gi3/+Q4JlyqzT7I6QFQe+5x4ThwNopKc5TLmi9tQM5xBC0WvX1XKNiH7MeQ8vnXptkVjB6W8cs220ZFl+8ga3CieTVq3DKaDiu7WweCL2t2zjjZX/WXMvJ3RyvKdCspmRhBOLCN7lIac/EsfprM++irgcurz7SNaC08ALO8IQlwXiORaYeXEvQrQIzhoFfsdTyF4tdMhgNk4B7SC1hCunGNjeknxeJP70Vg8R7ZaW8m5RYiqonGk3bW0yG9T6rbv/2+eMBXhXWheoV2KBsP4ucoSiSBjcOv8+uPfAg528IoGpkgIweUh5DRM+ikCcSkD3xlY1Tvb7EROYt4eSw2cL2pUYOLUrPLWEK4P31FDzZy/mLzr2WzP4TEc3Qqco+S8Tl/S1jkG44JcIkJUSih+K9e5hvF2stEZgNYWuT+UjoUlbpPiyNF3l+JkAR7EYVQALo1mQ5SwIPmktZg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 790f4b5e-80f6-4374-9feb-08da66ad7573 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:41.3171 (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: W9eGMRjd6PbrEeicipkCs5W16HANeRvKPNoAdgXJQjwyKMeis0bwOC+DYdpogCiVBKF7wluldZf/srCp2urvFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB8598 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150045_787542_571A0279 X-CRM114-Status: GOOD ( 18.65 ) 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 AQR115 (which I have on my LS1046A RDB). I had a quick look over the registers, and it seems to be compatible with the AQR107. I couldn't find this oui anywhere, but that's what I have on my board. It's possible that NXP used a substitute here; I can't confirm the part number since there is a heatsink on top of the phy. To avoid breaking <10G ethernet on the LS1046ARDB, we must add this vendor id as an exception to dpaa_phy_init. This will be removed once the DPAA driver is converted to phylink. Signed-off-by: Sean Anderson Reviewed-by: Andrew Lunn --- Changes in v3: - New .../net/ethernet/freescale/dpaa/dpaa_eth.c | 6 +++++- drivers/net/phy/aquantia_main.c | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 45634579adb6..a770bab4d1ed 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -2886,6 +2886,7 @@ static void dpaa_adjust_link(struct net_device *net_dev) /* The Aquantia PHYs are capable of performing rate adaptation */ #define PHY_VEND_AQUANTIA 0x03a1b400 +#define PHY_VEND_AQUANTIA2 0x31c31c00 static int dpaa_phy_init(struct net_device *net_dev) { @@ -2893,6 +2894,7 @@ static int dpaa_phy_init(struct net_device *net_dev) struct mac_device *mac_dev; struct phy_device *phy_dev; struct dpaa_priv *priv; + u32 phy_vendor; priv = netdev_priv(net_dev); mac_dev = priv->mac_dev; @@ -2905,9 +2907,11 @@ static int dpaa_phy_init(struct net_device *net_dev) return -ENODEV; } + phy_vendor = phy_dev->drv->phy_id & GENMASK(31, 10); /* 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)) { + (phy_vendor != PHY_VEND_AQUANTIA && + phy_vendor != PHY_VEND_AQUANTIA2)) { /* remove any features not supported by the controller */ ethtool_convert_legacy_u32_to_link_mode(mask, mac_dev->if_support); diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c index 8b7a46db30e0..f9e2d20d0ec5 100644 --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c @@ -21,6 +21,7 @@ #define PHY_ID_AQR106 0x03a1b4d0 #define PHY_ID_AQR107 0x03a1b4e0 #define PHY_ID_AQCS109 0x03a1b5c2 +#define PHY_ID_AQR115 0x31c31c12 #define PHY_ID_AQR405 0x03a1b4b0 #define PHY_ID_AQR113C 0x31c31c12 @@ -672,6 +673,24 @@ static struct phy_driver aqr_driver[] = { .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, }, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQR115), + .name = "Aquantia AQR115", + .probe = aqr107_probe, + .config_init = aqr107_config_init, + .config_aneg = aqr_config_aneg, + .config_intr = aqr_config_intr, + .handle_interrupt = aqr_handle_interrupt, + .read_status = aqr107_read_status, + .get_tunable = aqr107_get_tunable, + .set_tunable = aqr107_set_tunable, + .suspend = aqr107_suspend, + .resume = aqr107_resume, + .get_sset_count = aqr107_get_sset_count, + .get_strings = aqr107_get_strings, + .get_stats = aqr107_get_stats, + .link_change_notify = aqr107_link_change_notify, +}, { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109), .name = "Aquantia AQCS109", @@ -726,6 +745,7 @@ static struct mdio_device_id __maybe_unused aqr_tbl[] = { { PHY_ID_MATCH_MODEL(PHY_ID_AQR105) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR106) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR107) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR115) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR405) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, From patchwork Fri Jul 15 21:59:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919834 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 92D16C43334 for ; Fri, 15 Jul 2022 22:10: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=SjY7iuaTHTb9F+0oD1e/ibQAWSBTLDpgjYRQphvDjtk=; b=Y7OmTG/KZSGuzK UP34ojrKlrWpRoIIEIFPjLHiK3gs+ygySCLV/ZLswRrCKl5rEPbFtphEZB/hVF/rkTxMCHfoucF1K m00vPAPYzYIweu9E09XUFo6IvoLTfuoN2T7IaBdiujlgIydIzVM3ZtJmWPdlpLJFvRDub4S2HBCJr oL5P14MfpzEFSSSa9Z3X+XHl/X3yppiOPD/IQuk2r+5RM92cKafiqu+YJmV3XaPoo+Ww23BvpPpu8 GGoa3yOC8eYgIY0pIeKGI5WrcdsEWbOCzWSkzs9CyskP7z5rZpTa5DbkG+jsM+/uypzAqcKbgmyE1 Fo831xcF09H+awJP0bNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTUX-00Aeca-Ho; Fri, 15 Jul 2022 22:08:58 +0000 Received: from mail-eopbgr50063.outbound.protection.outlook.com ([40.107.5.63] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMe-00Ab8A-Ab for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:00:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j4Odz1u1mtSFDLuB5xAqFaR8ZlElzV8RWgZ43BB62NvKCKAHzxQ1klaQALG4CL3S1/h9NNISU4AuA1KUMtQD0xdcxbN1GWaHKTLAAIxhjEc/WwYUICrKLa8JV7kaBMjYH4g8Y1OgRrr0a6EVvovLM7wcItUaAX/W+9f2PK2gaJLT0BWIHqViJn9/roXsko95wbaHDdc895Ov7GETufn3rs0YxYzF99XVVzMBYFSNpBC61Aape8/GTQhOzKd4acqge0eXh9Ns9416u9esANlImUeJudR0oo45Yo55vnYwRwBAPQBvXkJXx3tNWqlEQQKu/yUnzcVpm9cKV/aJvY5JSA== 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=JC/rvL3KQAs0sjx38prnzjx+8Ar6/vqdJeLXGu9zEMo=; b=k7ux8tWNT6Upx6piIw3VqiHwZuxnHgDzswFyGZVhChpuY+gZWes1hPSCkmemf6+MQDCTmM/9ckuxXNWYSIEKHGG2wtTxakd4/nJhLMwPglsVb0ScZXKnP6HVqM5nHeDD7fTkQDV7N5oxbi1Sc95eIQr33/ZRLQm+/H08DKq/iS7TCKqof6ySQwYA/TeI4Lz8ht796ycMshZRd8voPvQtt2IrrllecZBkx9gX3tkyKzFDVKOWHAH9JsSTbVfhXkiXQLBwwmm5quVr0usQkx0TqE1DuMXgQaY37cxdD8dlpVxECwCll7waklGqvYAIZ0Ns/gOLpcebdWqgD7MJQ34Pxw== 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=JC/rvL3KQAs0sjx38prnzjx+8Ar6/vqdJeLXGu9zEMo=; b=xf9fIbLIwz5urWgx/0jnZVqTDrjboDWdxrE9JkN1zCPdbaunlN9qfK7nDL2ZAzl8i/yevYiCYaameG/47kgM0ewRvnmcLDy1LsGzKwbcp/MXzMnuvPyURjah12KGau2nfneEnPsFC5ywxFlAZ7NxDPiMbvBgt1575Cg7apuMv3kC84B58pBjIgUFJHnu6MPdTePk4g+Mvr7GyGO0++Qal2b0ZmLjN6Q1lRRa0mpWCKHwnETzr3hQkL+v1OrFjBbIPI3gxJDejcbcmvopcQE9OwWJbYdzHUcp3mD4n9zN16Twr0ZtmFBHMje9DcaCZtgmHXGlAQkFYuOGds0uEP6dMg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DU0PR03MB8598.eurprd03.prod.outlook.com (2603:10a6:10:3e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.15; Fri, 15 Jul 2022 22:00:44 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:43 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Alexandru Marginean , Andrew Lunn , Heiner Kallweit , Vladimir Oltean Subject: [PATCH net-next v3 13/47] net: phy: aquantia: Add some additional phy interfaces Date: Fri, 15 Jul 2022 17:59:20 -0400 Message-Id: <20220715215954.1449214-14-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 94ab4026-626c-40ce-9d7c-08da66ad76fa X-MS-TrafficTypeDiagnostic: DU0PR03MB8598:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Jasf0o+v50RGla61eSrMHmRi+3VQ4pGGoV3dUz4/DTXzH6YO1pO4nRGTT38cOAQtZ4NHEb6HtDEf+qb/lKNx7ez1Gkrri4mGYZ7AXzOuFzGXcRPZhy3gTJikc8w5Pc0NnCyCF1S/FwWjCrNeL5WGWLx9pI4FXKglull6WcD37WPTPCncQ23FWmN6TPGNoS+JVsLI+xdwapsb57TK+Z2kI7ZED5RmQfBffyMDtcTHDGrgYbd+xyPVq5J/SGjKfTT2hIE5g3fwHw1LDxw/thDZzOGJNTadV+JyDW2DU9tK9iTulGhiU1ibRMOgNPKokzncmbarlo6PZrsNEBJBv5/yVainxarpdcaQAQAK+yu6Rph6rkSP/zAxy/T20bDwLe8AxzGauhc76LqnMHgDLrExbOmAqHttSJrLTjqaA1akfVsHKlQgymRntT2CgSSxSUL7c5gmbYoKhLUZPW+zZiGSsrzey6N2suP98wzIqR1C8vbLtG/R25/9QHisfuyRU6vXtlB+A4HkAwK7wvMOF28Fj1+ZhYNMAremB3gripATfcBJEtUzBqHuA2Qc/+J+z4lj7b02uOO4rGrZuEEMLmu+zY04FqTSUZ15jO8mB0Cadjq0kYH9FJliiOcI2L4hfsGjkyHVk8QcCtGcszPb2mZqGxZ1ObpA5otBkhQPiNQwJeJKgA6sA2XBBD3dEfowLknl7QOkNz1U5lGKN5cdbZCxHp9w1rFsEqwP21PCbS4zmxNzWd0p6NFXJyEFmXt6s0pqtwtrEouHxYdNnnYHD+sK/uPddB2hwewayh81w2mb+TmFCHVOr36LJsbWo6eKr1ii X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(366004)(39850400004)(376002)(346002)(396003)(5660300002)(8936002)(44832011)(7416002)(2906002)(54906003)(66556008)(4326008)(8676002)(66476007)(66946007)(110136005)(86362001)(316002)(186003)(2616005)(26005)(38350700002)(52116002)(36756003)(6666004)(41300700001)(478600001)(6486002)(1076003)(6506007)(83380400001)(6512007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XBTtIbYbVAtpoegWlwYyWg1ciKAQDZRMIeMLMKHDZ7ozAzJT4gQp7hleRcnt53xjp3D8VITyCczmFE8mZGoikM0c68IV8kNxnvFs5uFp2OeUAXG4Ak883Mgj5knzv52PyU8dDTUYVnJYWxxhmZkbGD4OpgGvBkHroFlRY+lIpvaoV75WUh7wz0mIZ3qudcqEvcaefgzuneYm3XkRIKwZFlAszEQ2qzPics5Fb/JKJBJIAWV2xpymy57OVmvBzYd6OIMTftFjzam0yIuH5cZqhJGTfSBYYX8mCJTwmHXKpmbrWKGYkcLTqFyd2U2Ptd/pVlyFAGyyeuUVlx59VVvbVtox37gvG/zQRwGJ0akraWG0U8MoJb1+yw5vmBot7vb86N6rwQIWBgVC895v1LUI5YYnVffnlUiXhEsC9R08QZV4oEBB32DcIMr3+TqGrVlGIonkuzyN9pfrAQlrUyyaiEj/kBbncUpUI0skYMsDdqandpqBscjyHlqByVKkbfodtMG+PHHn6Q1pQi8b0WsexrfOWsJAMhWxmZLosz+x2PLXnhuCi2t3e+SKC0SqgRZEmmRW/2rktwJcRUd6+oLSSlZUSvsA6at0WY1wajDVQGLLww8yBjyYq5lZR2kkxnTiSpL3ns5qjWEFU+detBKmWdTP/wLYzNApVEWKK0fFszCG1hUONTbcvx8+DMgUWRUKpAIM3Qmokx9lTdZ1tatIrn3xZ+pFiPhSqgI6/rjvvbBn0LErdTpgQI2k90eZQmqkeLIAZaxh8N7UonpxmDwwDWkozhHRTRY/Mw+Xvs2ZOwxlthPp79DTpMKbmNHw6sjLo4c8559NMPUiZS7MwfpnzrE3Btk1J1DzLhj9rg34w2fOkI8Wm0EA9vsNBoQPYJL2KVkgFiSsEdqDbCNANdsVxLlPEUu3FXErSx8JDFAP7lUA0dLzedkNaxFLk+He4bP6Z1vmThzQf30yH5wrQXI5LXzPRR5Kx8FVKLzV8ES7Nv5P0hwtocsBmWgn/J7x06ZUUT+bGoZvPV3SVDzk+rm6RsRog4fO5xnu818z41i2uP++rPjRuMG3YsGBUbP5IKgdHKnzGrbbziClrTZtTHdosySZUMSnc1YAs02+xDsoyPSegxaffBdzA9xLhOR/r46/4YmKXpWhl1+00dg22njTGldU9LOD5c9ro6x/YCfHJoAdX7PSXaqtKiuAGZvLMiJaAA8SMtIFiPcH27Z0FIBj+vQNozWmFpq0QeCHXoHNB3eFet5OpfkSjDZ3Rxud3moCDZ7fqsT6fOs9LEOKMY28mgUon8l9vrP14cIX42BEi2eYxbNoxV6cESs+w2TSeFuDz/gg8KZoofBRIOmEjwzsQ6oJfLiGr7Kk34kwd/Lx8K3U521RP6V5q5FkofHD7trlfTBGTOjpMxLgIhRJ5bZHlS5ouPTtpsjx5Rc81dkRmp9D3T5wfQ2DJUBHPsANWcjivbmTn65/A+m5FHEq4QGHWgEV6S+DntyxrujN0oV86W9/6WuXrgPCH7nMIfuDk1UIEmvRQviTe3z4qDjtry/bd9FUyB5Z0OUXEzMddeYa/sSEXbeDX99ytR93gV2CBtXz0H1d+u1DEVU0zrWYqDEteQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94ab4026-626c-40ce-9d7c-08da66ad76fa X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:43.8951 (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: uBN9O5nA7JlBwRcCkBIYFrPSgFJTDhfz4nq0ovGnRvxHMjVhjdeIaGaHB22S1BC+0XSQSiD9dsSboLmo6RjtRg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB8598 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150048_403294_164843A5 X-CRM114-Status: GOOD ( 11.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 These are documented in the AQR115 register reference. I haven't tested them, but perhaps they'll be useful to someone. Signed-off-by: Sean Anderson Reviewed-by: Andrew Lunn --- Changes in v3: - New drivers/net/phy/aquantia_main.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c index f9e2d20d0ec5..0a2f8c4aa845 100644 --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c @@ -28,9 +28,12 @@ #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR 0 +#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_KX 1 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_XFI 2 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_USXGMII 3 +#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_XAUI 4 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII 6 +#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_RXAUI 7 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII 10 #define MDIO_AN_VEND_PROV 0xc400 @@ -393,15 +396,24 @@ static int aqr107_read_status(struct phy_device *phydev) case MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR: phydev->interface = PHY_INTERFACE_MODE_10GKR; break; + case MDIO_PHYXS_VEND_IF_STATUS_TYPE_KX: + phydev->interface = PHY_INTERFACE_MODE_1000BASEKX; + break; case MDIO_PHYXS_VEND_IF_STATUS_TYPE_XFI: phydev->interface = PHY_INTERFACE_MODE_10GBASER; break; case MDIO_PHYXS_VEND_IF_STATUS_TYPE_USXGMII: phydev->interface = PHY_INTERFACE_MODE_USXGMII; break; + case MDIO_PHYXS_VEND_IF_STATUS_TYPE_XAUI: + phydev->interface = PHY_INTERFACE_MODE_XAUI; + break; case MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII: phydev->interface = PHY_INTERFACE_MODE_SGMII; break; + case MDIO_PHYXS_VEND_IF_STATUS_TYPE_RXAUI: + phydev->interface = PHY_INTERFACE_MODE_RXAUI; + break; case MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII: phydev->interface = PHY_INTERFACE_MODE_2500BASEX; break; @@ -514,11 +526,14 @@ static int aqr107_config_init(struct phy_device *phydev) /* Check that the PHY interface type is compatible */ if (phydev->interface != PHY_INTERFACE_MODE_SGMII && + phydev->interface != PHY_INTERFACE_MODE_1000BASEKX && phydev->interface != PHY_INTERFACE_MODE_2500BASEX && phydev->interface != PHY_INTERFACE_MODE_XGMII && phydev->interface != PHY_INTERFACE_MODE_USXGMII && phydev->interface != PHY_INTERFACE_MODE_10GKR && - phydev->interface != PHY_INTERFACE_MODE_10GBASER) + phydev->interface != PHY_INTERFACE_MODE_10GBASER && + phydev->interface != PHY_INTERFACE_MODE_XAUI && + phydev->interface != PHY_INTERFACE_MODE_RXAUI) return -ENODEV; WARN(phydev->interface == PHY_INTERFACE_MODE_XGMII, From patchwork Fri Jul 15 21:59:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919835 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 62E36C43334 for ; Fri, 15 Jul 2022 22:11: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=G0X1DCmUMuBZOQOT+LdefhTEd7rJV2aAztW7atoTRxE=; b=hf6MXkf/k9lo4S ZqXJON9egZswZtHuqv8QHcBZANF0tQLJQeYqZZueQUAMSXZPch0pQPzLQYbiR3wLYTn3+UqMT2jaR jcrKGFeV9+kr2h5RAPjMuofQS3wJ3wYrWoPhdSBMlZFSaXTMzTIkE3/Zq6h4RR4Vui48AjFih0YUE wbwafZ/rBiKV5MR2JQKVCtXOkSnwmBEpW0jDmeIUKpl/RstBNepn+nv+Fk3f/5p2FLdIPOzKx66x7 2Rl484czSHAfE11EaQy6afNS8SdbF/qxOGUv3SPGwelHl5t0ehogQCbPmAI8R9QEU8S69VkDPVKi0 DjEH/C35OUi7ucWzOWyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTVW-00AfAd-Bz; Fri, 15 Jul 2022 22:09:58 +0000 Received: from mail-eopbgr50063.outbound.protection.outlook.com ([40.107.5.63] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMg-00Ab8A-4F for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:00:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TjphGwh45PlM83TTl1DP25zxzX1nLIZ2tbL5t8dCGd0muKlyCpAJuQw4yUll/CXw8u8Wq7Y9yjokZxa0L9ssKCS8ZwGxpO5AJ68ClDsTRKE4Dk8g+1lWsvGLTlC1D/sfBSNCytbA15SABrJKAjK9IA2b8ZE/ekQBgL4A7q/HkbHNhP1ZUV75ES+B1O5FAHRpJ6MXpBn36/y2Ppl2FDOHlDv+SSAKIc+PTxW2oErVFzhorr4ez0tTI4VEvai/8JuiqlKUjlbREtkEJTJ0IIFEcGqn26+FfLg8XNrZN1fiqQKmOlce2pzUG9iFSmM0qFVFq79iPLqm2AphbuVcB4h9Ag== 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=rPY1njZtILUEsQez2HiDy/q4A3Gla8dBhyfomEEgm84=; b=lusYGXx5BAdHlQyu6rIgHsXde280MHnNrwQ56C0B0qiKbYv7UTQnTeHkuh4sxliVUDZNSwK7P6cuIybyOPJ0nNhsXmzk+Bz0iFNdppyEGXfwUX4z9EA9m49Ik9ADV6565Tr3CZf4FRWWRmDBo4+27pev5v4s1kxjPnT/REanQNt3v6b/UI2aeJ+w7QDMGWfqsTtPV8oc+boDh+E3N7hEegmE38mKV83qfkQdjSsJ3M9c9GSyP4PMonH/whVc9q5+9E3hqBuymfVSC4g1g8eRNwWMOC93hWPwH3rXzCQzc1PKHrwQtIsq4at/TQH8qxUF5MeLJ73MGUcKBvc+lCQsZA== 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=rPY1njZtILUEsQez2HiDy/q4A3Gla8dBhyfomEEgm84=; b=sKxr0VtlG49Vn0K1Jz7AqVL1hlkAJz5/2HXhWPF4L9mD0BpyQm7LhSFkdUu4X2dLUBGDB5CS+mIqJaKW6jQFSK9bpSGEIq4A7A3vnMVKoM2xSuDcbGMtc2t7zNDmh671gk+fanRHI0drX/bJb2fMBh2wIh8fsGfMJWy4CPvDM/BXSZC+FcrK8NMDT88Qux1JT5jljue8FWxfMDSN33/n32IxxIWIw/C1alU7qsWD+nRoe1BUXEJF7+juhzsSWOSfngqeXJRlRfC5K5DUwHr8vYJabE/k98VKLtsU/QGlR/EVxYQhovkG7s/ywPcNXOB8WaLXavK9hmFpQ/WWC9dZYQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DU0PR03MB8598.eurprd03.prod.outlook.com (2603:10a6:10:3e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.15; Fri, 15 Jul 2022 22:00:46 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:46 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Alexandru Marginean , Andrew Lunn , Heiner Kallweit , Vladimir Oltean Subject: [PATCH net-next v3 14/47] net: phy: aquantia: Add support for rate adaptation Date: Fri, 15 Jul 2022 17:59:21 -0400 Message-Id: <20220715215954.1449214-15-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 631a5be3-786a-479a-5f9e-08da66ad7886 X-MS-TrafficTypeDiagnostic: DU0PR03MB8598:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l4Ky9M9kiKPona2NxSMDwNgjXuLuklieoEVnc7PsCgJlBdqnH5hjUittW7N6vztDWl3K9su5FGgdhLCqh3cmfZJibWknk98Yvwvt4l17JfgpK7S6ocqaQJ5uIf66LU+s8kYE4SMIYo2Evx5SiR3vaLfdMxxB7kgnuDxpOEtsrubPdyceKiEFlwNX4JgonfT+8DsjtiwplccUFYht7401Z1DSflauziXMDnTvU/jRqN3Ly/0Jf1+U2wcX0NkWHPeCZW9Z6pwtEP1VPexJN6WcaWSDsY8w+2W0rXZJh85wmjcvsvOfJGufb8Lvo5sec92zbJP6z8BQnIZ2jt1FIINhRw7ZYw+JhHfFyVmLLhfzihRGqGAGO/cW02OmciGC8GJxPjZQ+1COnjvWo0G3X8xdS4B+VIkJ3HUZNRUo1OSPDqYT1dcKgw6mrElPWNmc/MSJoLjrLm9UEDW2bPOh6BJJNGOE7+I7fj6CZwwLEQWKwvxivRTezDV5fExQkukuYIg9GoEZ375K90LUOtjZUrWg/5lhxR9k4HSyeW+Bn71M9XKLMTD/Bec1lfgsN9Mv7nUVfVfiBv5CGHpq/LWLDBNpWNgYUMOFBVT5UlM6PPPR23OhErzz5OJsYiW1b7FopvbH5juS4Q8j46RfHFQMmnLbzJwHBU6idbYAUUKNZVG2+H+yl02hrFUnaQGo9RKDeQhiRYMp2xryKrBveRPVAS41m4B4XLP8eJh/7SWUJZvNZyudKXjkkxxTJZainPlbTEnVwSByb6Sr5/YDRhpmWtMQge5jiWHUJ1Gj7M6/CvIYDu927d2kEmOmaKPRDGvR630S X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(366004)(39850400004)(376002)(346002)(396003)(5660300002)(8936002)(44832011)(7416002)(2906002)(54906003)(66556008)(4326008)(8676002)(66476007)(66946007)(110136005)(86362001)(316002)(186003)(2616005)(26005)(38350700002)(52116002)(36756003)(6666004)(41300700001)(478600001)(6486002)(1076003)(6506007)(83380400001)(6512007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1SzR9k4tEzLQymcaDuOIqtBGw2TcK/HG7R5Nu5+LM26JH7UJUXwMFg0fOyAVzoOrcH/96u/Ke4ockyBKuoTmlWpRHjrgwVRAKVJGjm3IGwrtD74mNjtxMLxcG4M2cXwa8grwkc/kpEdw4VT7gQfN1VCFjKoZQ4E902dkF6aRuv4ODiMmSbeLH4U62ljak/u40uVLdQY2xY2MDv5MV2BvHhFl/HiJCNDGQAZQSq9ARbE/i3iTHLeY1OIa02841TeImlpWyMSHiQq1wEKQz8j62wxbEa9Dec5fm+UMQ8bLp6jH7gqf65wBPz4fMUpK6q+c2U4E+wpd3ku1JwZDF8CzLua9WuAHpiLwrb7nfo6+BjKgOcjJbWX2m2duVrXhYGfWOwJe8oUbBauhX4UTnfnkRhRc1suQyD76d2OxleZ5pe5jrZe/aYOv2IPCsE2uUzARDsEEjXW+/ewf+kVQ6TheR7HS9Ln6867oSgn1eZdr2Sev2KwVQOtqgAFqX0o/NwExYA3ZXZ3vkrZb0c5dkBMF1w7R/ZdBEc7E7kj3/8PgUzx9NHUshfMyQlLpcajD9taWjwBTBKKTZVBFZxDXSNKCa6CYOwBjTpfmLkTd84oZn0QtL1PcgFCRut3cG/Bq6nbg+6UppZeYI+/eslMx9jUwNHNktluIiBxZx3qCw0+efyJJ5zqvD6iChsC7ZqMBNvywNPpbxuSCjgLWJxzZj4Jk5h3SZnJNdJamHAjGaCcx2PKcR0ASp51exPSJ9DjNaczk0MQPiFOILoJr9XaSFV7XopYErH1WvW1J2hxy8Pk2B07I5P3OqnxkfaOjFhBkyT2pkiOZgymEdWU6z3qjlyqeKIsBOwav9GLPg4Znw33yHkFfPROwDSDBjaEyBOz8bc18i9sdfmk3rnOYOqzy4sSKMPzGNxn8a18ePhTxsJyRnGIPFCSeq+OFJmDsNlciWJhS+iTGR1MkFM2d8YtGUCfVkAkktpvcCdBrs+63r1Mh5uCvRnPPuo7zYdI3IxouHzxIWbdx+MmH+izExXGnHxPvrQuhRfm6vQXxZUn88IDcK2MIInmk23z9khaKFv/2tYl2lTU4F+bZ7dDONhsfHQKyNIUGrqpnv/Y19Gd0CRfQYjBfU6YxeOZM/MKQcI3lTLsBx28fMP0eKQf/Ti0hOXslJHvvxbCSnQIcbk2EOGL29jVsyg8QfGzqXpOFJhXpznmLwb4+9M9aw7/MFwPTDMA593eYVNHNQZcQmfXdTNesL5/3j62cqcCORmRxEvKgT7n5Q43/grhQNMPK3WHDA42nSkWxipE03+xx0W8Bb30DTBhMdyixwrNvPQB7aqpRWFLwdVwFuapMk4eD29QJNu028tEjrDGaNEBal//PCe9ZNatshH/ochBDIkckh6mrM518u/dQKooaR/zDZOHiAy+3bxqDgLo8C7waw1+/q0BroppDzlBLKsoR2jhRqvH0sQ6OJrRMeqYieWeDt94bgIHrGywGeDTbs/ASCrq1Xz33Clerey+65p0dK8tjGZWIa94ax0S4pjlya7n3aL9udXrOxD0QbaU5fCcHqlku3TqWnT1klTj1RKmtFqXZ5njgt1hihKjEcdF2DfjvKlWFwxvZNQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 631a5be3-786a-479a-5f9e-08da66ad7886 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:46.4887 (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: SDindBxdFq0x4JMT7YkMAf5Pfxowg1nCl5pjbXdI5bxE4lqHeidrRM8yNoNtD4ZMctgiaSkENB9iqPcj7YFTLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB8598 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150050_245738_1C8487EF X-CRM114-Status: GOOD ( 18.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 adds support for rate adaptation for phys similar to the AQR107. We assume that all phys using aqr107_read_status support rate adaptation. However, it could be possible to determine support based on the firmware revision if there are phys discovered which do not support rate adaptation. However, as rate adaptation is advertised in the datasheets for these phys, I suspect it is supported most boards. Despite the name, the "config" registers are updated with the current rate adaptation method (if any). Because they appear to be updated automatically, I don't know if these registers can be used to disable rate adaptation. Signed-off-by: Sean Anderson --- Changes in v3: - New drivers/net/phy/aquantia_main.c | 49 ++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c index 0a2f8c4aa845..e2ddcf0a68fc 100644 --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c @@ -95,6 +95,17 @@ #define VEND1_GLOBAL_FW_ID_MAJOR GENMASK(15, 8) #define VEND1_GLOBAL_FW_ID_MINOR GENMASK(7, 0) +#define VEND1_GLOBAL_CFG_10M 0x0310 +#define VEND1_GLOBAL_CFG_100M 0x031b +#define VEND1_GLOBAL_CFG_1G 0x031c +#define VEND1_GLOBAL_CFG_2_5G 0x031d +#define VEND1_GLOBAL_CFG_5G 0x031e +#define VEND1_GLOBAL_CFG_10G 0x031f +#define VEND1_GLOBAL_CFG_RATE_ADAPT GENMASK(8, 7) +#define VEND1_GLOBAL_CFG_RATE_ADAPT_NONE 0 +#define VEND1_GLOBAL_CFG_RATE_ADAPT_USX 1 +#define VEND1_GLOBAL_CFG_RATE_ADAPT_PAUSE 2 + #define VEND1_GLOBAL_RSVD_STAT1 0xc885 #define VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID GENMASK(7, 4) #define VEND1_GLOBAL_RSVD_STAT1_PROV_ID GENMASK(3, 0) @@ -340,39 +351,56 @@ static int aqr_read_status(struct phy_device *phydev) static int aqr107_read_rate(struct phy_device *phydev) { int val; + u32 config_reg; val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_STATUS1); if (val < 0) return val; + if (val & MDIO_AN_TX_VEND_STATUS1_FULL_DUPLEX) + phydev->duplex = DUPLEX_FULL; + else + phydev->duplex = DUPLEX_HALF; + switch (FIELD_GET(MDIO_AN_TX_VEND_STATUS1_RATE_MASK, val)) { case MDIO_AN_TX_VEND_STATUS1_10BASET: phydev->speed = SPEED_10; + config_reg = VEND1_GLOBAL_CFG_10M; break; case MDIO_AN_TX_VEND_STATUS1_100BASETX: phydev->speed = SPEED_100; + config_reg = VEND1_GLOBAL_CFG_100M; break; case MDIO_AN_TX_VEND_STATUS1_1000BASET: phydev->speed = SPEED_1000; + config_reg = VEND1_GLOBAL_CFG_1G; break; case MDIO_AN_TX_VEND_STATUS1_2500BASET: phydev->speed = SPEED_2500; + config_reg = VEND1_GLOBAL_CFG_2_5G; break; case MDIO_AN_TX_VEND_STATUS1_5000BASET: phydev->speed = SPEED_5000; + config_reg = VEND1_GLOBAL_CFG_5G; break; case MDIO_AN_TX_VEND_STATUS1_10GBASET: phydev->speed = SPEED_10000; + config_reg = VEND1_GLOBAL_CFG_10G; break; default: phydev->speed = SPEED_UNKNOWN; - break; + return 0; } - if (val & MDIO_AN_TX_VEND_STATUS1_FULL_DUPLEX) - phydev->duplex = DUPLEX_FULL; + val = phy_read_mmd(phydev, MDIO_MMD_VEND1, config_reg); + if (val < 0) + return val; + + if (FIELD_GET(VEND1_GLOBAL_CFG_RATE_ADAPT, val) == + VEND1_GLOBAL_CFG_RATE_ADAPT_PAUSE) + phydev->rate_adaptation = RATE_ADAPT_PAUSE; else - phydev->duplex = DUPLEX_HALF; + phydev->rate_adaptation = RATE_ADAPT_NONE; return 0; } @@ -613,6 +641,16 @@ static void aqr107_link_change_notify(struct phy_device *phydev) phydev_info(phydev, "Aquantia 1000Base-T2 mode active\n"); } +static enum rate_adaptation +aqr107_get_rate_adaptation(struct phy_device *phydev, phy_interface_t iface) +{ + if (iface == PHY_INTERFACE_MODE_10GBASER || + iface == PHY_INTERFACE_MODE_2500BASEX || + iface == PHY_INTERFACE_MODE_NA) + return RATE_ADAPT_PAUSE; + return RATE_ADAPT_NONE; +} + static int aqr107_suspend(struct phy_device *phydev) { return phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, @@ -674,6 +712,7 @@ static struct phy_driver aqr_driver[] = { PHY_ID_MATCH_MODEL(PHY_ID_AQR107), .name = "Aquantia AQR107", .probe = aqr107_probe, + .get_rate_adaptation = aqr107_get_rate_adaptation, .config_init = aqr107_config_init, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, @@ -692,6 +731,7 @@ static struct phy_driver aqr_driver[] = { PHY_ID_MATCH_MODEL(PHY_ID_AQR115), .name = "Aquantia AQR115", .probe = aqr107_probe, + .get_rate_adaptation = aqr107_get_rate_adaptation, .config_init = aqr107_config_init, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, @@ -710,6 +750,7 @@ static struct phy_driver aqr_driver[] = { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109), .name = "Aquantia AQCS109", .probe = aqr107_probe, + .get_rate_adaptation = aqr107_get_rate_adaptation, .config_init = aqcs109_config_init, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, From patchwork Fri Jul 15 21:59:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919836 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 DD1C2C43334 for ; Fri, 15 Jul 2022 22:12:37 +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=GTqg0dTg2pTPQO mo0QUhvyfM2UMDsQexh2Q63GXZhKct5XClXHiTBkai15agQeN+K/DbYUoFJPRuTvSV7sj0A9s0Z3F GrdjP+BjJQYKkx6/oV7s+d0u3hHgYlWSzArGwTwVAH4xrDpkxXVnE91CWDtuMJxLtglh9/vdO9vIr 5HCJvWtTKM0xar4fxPhIkgFoeSYbcA513jH+eqVnWCWToiztjAhnIuTnayoSwwwgaRAZO3zThlK+l dFUIWCkfNgDLJ/QWG6mB1l9X3OF25EZVEtDZXDGXYdHuKQCtxDDtgNB+a4dB283qYI8zRiwUl6Kdq Ebx0eOpvC2axTKuDMhmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTWY-00AfhW-7w; Fri, 15 Jul 2022 22:11:02 +0000 Received: from mail-eopbgr50063.outbound.protection.outlook.com ([40.107.5.63] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMi-00Ab8A-6B for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:00:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bV9RvD90aerdhi3+qIJVVistzBGiJXa5uOJyDdErOqfIjen6zqywageZwmBnH3LbgaccG/Z6io1Qby9/f12xNP+gpkKnmOV0mACsvWjqKZfpUL7+9+XWb5uyFDj5Ggbm0J6NxixTn8kS0PgPiNwYYnUFHsdEVxk9ZA10YA7hpStwiN/G4BsHuUXVZCYk4EA8FnMd66UB6I+Zh0EeBR/dB7NaWJFw+YHrdYmcjx3ethZdN9nhuY+w+FhIxU+YEfcJSUPQjKl+Gfoxql4j44phVJpDN0iK34w/58F4Ic7jZSpyDprO4WlNRpf2/Vmtt3PH92n7Pjvl7E2uYs2NOTcQFQ== 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=BKQ2UeA9ZIFJRsT8zZtjKfN8w2GJ9K0nUvso7qWaIV9KJllH8joUm3oNgt7JMA0jQknr3hQtaUkLfceaoHGUFT8m5IVwZA/ddiZoDggv/Dx4QwOtDb2MXGybQOTN3Vo88F0/xKy17zoy8noeQ/Kyh+osEUXcC/8x9c6MAYWgMK6oKhnRJLPh9uKmTBEi0X++WT2KrPDMdivnF6vjvqveuaRFhuKxe3W9Tyes6lKi+uqNy86cjCbSWYxMwNQKxAuo2aiTMB6HEYF1kBH7pEWV2aV3JyDByLRkGCfX+5geLt6qnvKydfzdZj6hIUnzcoMjVbgpKACXSa5C0zNzyA7rVA== 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=xT1/Qct7F0WJLfG8IveYIOVOD1v+8167FzxrtrLXL45Sua8hJyViqsdvbxNhk/WMiPcm/xF+cd1e2QmyNtTY4EqzLUEEcrqk1p6QcK6JA5InUaOv2kvrMRYKvUdeDc/uPH6g/l/KSGyJxkvWvavL7qh6TaSOwB8oSquv37Q4tV15s02NzeroHtA7INOIebFzBUmZ7JhWARTWst8MvLsNL8v3Zm1lcryM6bBx9xe9hmOTIDRIQvjMgdgHTJXIU+jyxe8ZSJ9cufMvR2v/7qV++ohN6XdUt6V4U37RHVzK1MN09QqwNMK1jkPDrrhlRGeU687yDakp+XG/m5+gFzBOpw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DU0PR03MB8598.eurprd03.prod.outlook.com (2603:10a6:10:3e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.15; Fri, 15 Jul 2022 22:00:48 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:48 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Camelia Groza Subject: [PATCH net-next v3 15/47] net: fman: Convert to SPDX identifiers Date: Fri, 15 Jul 2022 17:59:22 -0400 Message-Id: <20220715215954.1449214-16-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4662858c-a47b-41b8-254f-08da66ad79d4 X-MS-TrafficTypeDiagnostic: DU0PR03MB8598:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n9jfhbxuDTmAioyJ5+Ik9afzs8r71nIPZryBx4CVmj7E4yhWsS/6bjsR1B+6tA6hBQYzeB8v8tIb6TtSyXYxQEw/sl4rLAaCYEv7cWL0YvRbxcDuoFtQvPUUcRHOYxp5VHeBiXqCMQHC/9Ce5h0GL0xHs36ZohYyN8k0v4haZv29A8F9c2wjxhjH4qY3RMKxuBAk9jU9NE4PNM16yFAitPABr3Hb/c6vuedJnxALGR+TA074xikj95GmXABL8/fSIY9xLoMuvLdmbLHPsp6IjDPAtLOeM2qBxI7V+U0qUUWbI0xCsJnK+FFdzSH6Fcnn/pJMvwZGH9EgldZbp5UuO58Bld5VIi/1szw+7Iwg4pCyzXr6mETlF8b6e5N5XRQUBoQQFSySeKb5Kygx6kmzACOTr2to5l/gPl1vBnt72p/DCMpR5rpqz/R1EQE5W6XTz8SdsiIGmJ6K0sV6iKlhfxk4S0EYffhtnoU+IlhQDJu1jylr5R20PL4CxDZAzFwPXf5KTIAl5FsR8/BDoVDVch54KO78DAY+bb3e+uJzDNYlyPjFNVHleDEWaV1OjdaREW9DrTgGheqvj37YZzbF4BFAPeuKhS7xXaT/+pnD/LzpdoR2hpkhotMbhfrHCVnYvZX1mk9JwJBOPWDu2grhvdB1mIARLpbyBcmjlwz1AQ+4KUoMpgdTYVRdPf0cu4gszWpveejzzJUK1TS9lSh/9pO5cm7siMH2WVl/Xml+V8res7xRLaraiNawLTAxMU5SdY/qA43ZZvGVmZ4tVrRO8OaTjXEgM8uR/wtdgXc8Eb5tkfzGB3c8xTR4CyFxIQ4ODKPuKd7bGTcFxzThZK0gMg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(366004)(39850400004)(376002)(346002)(396003)(5660300002)(8936002)(44832011)(7416002)(30864003)(2906002)(54906003)(66556008)(4326008)(8676002)(66476007)(66946007)(110136005)(86362001)(316002)(186003)(2616005)(26005)(38350700002)(52116002)(36756003)(6666004)(41300700001)(478600001)(6486002)(1076003)(6506007)(83380400001)(6512007)(38100700002)(2004002)(579004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ppSOZYURXqRLKv2bsqkVwzr288GnkOOZDTzJbhU0XkS8a3o2rFXtzxe/C7JiVvDtGPAyM3u5X4d0FcFOJioVisJmM6NwSC+3eGQxuNqK407GSI4BNy6ToAzWmXDeszG98DtxIircC+ptDZllEdKqidC4xkBQzxV7EtUMb90UksRqXE8lOXMUfgAg7v+QsgrMkXJiIKNbXf+G5oupkSoZkFb8vtXbQgTIn9YFeZdkTBXkv00Nm1TT72LXoAHXrq6EFMif05RVGS0iwS/F/56J5f367KOXIyR4RhY13CSnCP5NXzpjSb2W8+Yu6bgnHfO50aNiMY5emIpgDZBiPmcwKP76enMrnltBxW7iyMIde4GIKHGcS3XEHY4feYj5n3G6BLe02CKAJV7xw9/eH0etdwkvcC6ErFYX1sdOBrxk3iFy/xMxvZFi/m4kMcKB6HvFJxHGLxJjxA22ISZuKE9vuKkQ+DPFsrEdXes9ziRodrDnV2RQr/kpxWcinCpSRhUDSNa82PvU0QBN4VdWnNUlyDxcnde9vdJKhNGXL1wp3SD+wdWMP4DYcsB45B8zCTjE6jw8Lhct/wQ1z/IJBDonlwAR6CeIL5ybyvrjFwp1hAv9c2cy6uYowEgVIIP992tkhDkKfTcy8Q6T9lvXWIpdXlNb86AbncbcVmG1SDeaciN1et+r4FCs1nOcvuWtBy8SiJOUIjSBbcNrEUHh3dTemmWE5c9x5qAF377JZZVa2zurUwktG8Hw/vFfiFOZszsVq+lp7V7XzdPhUPrid9gEEGKbUJZ5MKPGM4XbGaAbhC4g0N/1Zq6JblT2eJuMqEEx7rpmWPmzbT92tGXr0JwJ68wWX9NqkckPYEbT4iz4PUxeQujPDd+8Q7fWspkRfgjMk2943WL1BHebG77gbtuosOLqPd3GZEmYJc7PEzQIoZ74R2tA7Bg6AL+jbL9JeF8gkahPEIK+M3G+I6mVPV/i4qC7T2fHL3o0zutRfKWoD8oWnCq3y9fBcaxfvxfO8drmVF9dyfc7ISCLsDjq7Oma3y9KD/mVmaG1Gtwf5TxdQv/RptJ6y1LyIFlpt/+yPaTjiABCzYqM6f+VNtz9av7ZC7zvH41xXgt//sFIKpHdlwbfX6YhLbSMdFNvxt4TDeRLjiloJmbcHALC+9YjyUxanxq6Xb0Y1LkUSePThGsTPB7M8VBAY/UFX0h+lkQW48RkRQcZKyBBUIELFsEpbsSPDmTL0Efs5yNUM333gtuwiS4YD8F0P2TIu38GFTJkBcPCfqOrlYpFZ49tp1h/6JLmJYiFGl/2jgJUvftvgWt5oJzT1kO3tbIZSHDuqgm3JDPROcFQiTi4TKYsNuB9n8n6tTOQAvUFAyXqPkM7ydlfGr5R5GFVqW0oUDjtggJCYBp/bvz08UQO9dwFkeYVqanv5/pnmDyhiazDNRE+h7iHBnlqXcwqY8/xCnJn6vd0Q2Zhas8Mt685a8MZThE2kg7ZwHo8vkEF0qIFFgYQ75XV/4BuTJN4Uu5IwWGQ99tGqnmMxZyjX/AZmeg7Br8k9GdNNcgHgKyGfRnijZdTGUYiYRFlrf4vXUr0non/IhZ0XC41n+4qYJwijbyuPr1yH9XJkQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4662858c-a47b-41b8-254f-08da66ad79d4 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:48.6918 (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: ILAwC8ewLvBXSokcoMFW1UEJCgeHknkFxq3XQBMZvog13QVvGDmNJd5ZE7XC5gVC6kqxuRM/O9U9hP/M0dqAgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB8598 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150052_328176_372B8DF1 X-CRM114-Status: GOOD ( 14.40 ) 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 Fri Jul 15 21:59:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919840 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 E5466C433EF for ; Fri, 15 Jul 2022 22:14: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=35M+dIYMMOYo7OKFVl4/FE4kOZzo5DKbvLpOcUtsAm4=; b=GBr2Z9xXXCZYYo btkjHS8oSypoRhkJ8DgwvNDrJJZaNsyJpSxoIqfzNzu5siBHMQQAjP8sqNHpRjzYkz/YDK7dwnDSn ZcDEr1Q63sYfO5QwGf4CoeQwysYRZbS7foJ//4ZXs4ILIbMdgJ0TMj9eebMsj4F8k8JFWGR7Oi37P bzp5OOTr5Yx6W5eZVcjOGbnUnjFWCHNq6jj6uAX7QIKtb3mYv3Ii05FT8C0dEhG7PCnthDTbL552/ Fo/RvSS5hMPjsEDAYMepNWj64x6oVp/8+od11NxnuVWRZXZ7e7iI+SUZgMNuRKUlQOjMyM9bC2Fd9 RlDyZuNThkOgTQteVyIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTYy-00AhF3-Qt; Fri, 15 Jul 2022 22:13:33 +0000 Received: from mail-eopbgr50063.outbound.protection.outlook.com ([40.107.5.63] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMn-00Ab8A-D2 for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QHq2D9SuH5XSWkw7e6qPQWkTJ78fm/SK00ka4sLd6S6Wlt78RXIPKBitbsOfSdd9l63u368WTCchVBkJjJ9iXtXPPREMZ50CzYDq2Djc7iWachVHlq5LgwysWN05YHgzK0ajkE4SaDjdYU1pfSIXR4S1+B9n7MJC46U4t5gNzBKgcAtUxl8FDFLeybdpFg28uKZvR60MEotER71gzZlcja1SXhCpOysbSHkMsnigpS3tcyDqt8l8/IXIX3xVSaS8tiqZEEzBUGc5RkTJrJSTSznDetZ5OO+55XE0xJRM0B9reUcwKB3KLigRpQrkUZJWdJe5bmYcMHQSlM4izXPh5Q== 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=eBhUdYOlr1j+mS/tTH64d/PplyFfVMjvCSEKxeEeDiEI5VVv1iwPG20CTAiWXwH90uPNEjLGwpXUfPYE2IbE8rE35H8hP83pZef2QRX4xb3MLmcqe6mqcRMBzo3w1Hgz1tfYCXKvwBjmwCrQ66jGa5RKcY+LPmC+Ex1o4QrYh8bKPwFQZ3j4ZjaSTeXd3sjqKD3QuppeatUSP32zn9vsOuOulprna2WvasRM00aHPLXw5w0QD34gYICIKvypSsxa6VwwOV9LMkt+/qqvSXbY69yMXBP7/HdVctd7WC8oEvB7ZCn7Vj8dAR7NRUFLk1uB0W8DcuSwDgPCyTWZH/6H2A== 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=zh9FFAoJWgEthXj/KRohdW9q9I658AXUy8BafVN85pAUvYP1Iw4fwGlLpRWzUohu16mr5IcimkcSvq0VOigNHFaLkv9VZBjyOqh3bm9tBee35hr4hVYLAjKozi1s1iItgzPWGPHVPxUc+Hg5waRkO+geptpDL04CzqSBnvvHIRDrtbq+ZHDqMIfHzZWiZjZgoUXoQVBt//ls+AvmZ6Uv5o2a3xltsxsWLwyQpebFYRHIHPscxnSRpkmpN1SuiOkxbftN6nFALyfh1ySZiV3VdepIlHxEj+TQhNarQ7X8ScLF+A/JhasIhCc/BbAgul85ISy+grEIyimADiiWbX1+MA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DU0PR03MB8598.eurprd03.prod.outlook.com (2603:10a6:10:3e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.15; Fri, 15 Jul 2022 22:00:51 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:51 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Camelia Groza Subject: [PATCH net-next v3 16/47] net: fman: Don't pass comm_mode to enable/disable Date: Fri, 15 Jul 2022 17:59:23 -0400 Message-Id: <20220715215954.1449214-17-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ef859db5-0efe-4823-af92-08da66ad7b26 X-MS-TrafficTypeDiagnostic: DU0PR03MB8598:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AnJnPC12UKimLLWVXOmqmjQlbfY/RSoiW7yy4qk0hVoGmKfKEcQ4B9B4c7sCOyshXHmlZLu0XTDEnmX0e9KTn5vBRsOq5Rcdqe7VALkCwZ8JU2sSpljB6wbyneqt6Mab6jU3lm4PtXNNQPh1B+7afU6Epe8scmSLsn58tjWlVJhNAyBlniYeGdILmh6Gc2jBUz5pG4nN87aYlRG7QofaCu1Hsoc7MuB/rUwYxcCwuMloAehNKobRP18JS8kP9H8mE9O+Knk9Am3jgoyqLHQnfPPiF4wUw93MRVkx8paOwfLq+QCHfIvDOtViDUxvS3veR8SvhqpIRVatOYXBanWjOWJoCYDCk1+yNlCbexF9TZwVc9yqMHGs3OoZraDUx6L5cPT/bb+Y121DCndJgeLNtzbSRPJA0AlMqSALAyBiX9jr+MFahPoBC0bRLnF8RmVbJW1IptfkK4hMoP/cU7B7WCzI4VEdk5HYnCg/vO8y+pQvHe7j/aT2Z1QQk/NN2jY01MjwzMmEoZgxG12pjBQsSHwWLLcuFlB1ksOFhC4gVdkczqGDyPaZbXLzcvCbSTOw9lyQlyC2o7n4YwOY73aQVuO+GZm2y8cKhb7T5EtylqbnImuZlR7v+pB6Dt8hHfsVO6kkO0nPg6crZqyA35y8IjTzW0u4nMDjBiEI32F9XVeei2etuVFMvDOwYfMqEKG3a6WKErXHxwWO0pgbEHXcZcb4Zm6IamFD3sd7Z8sS72yjRXfwCp7FfQw/ItSi+F6A6Qw/wexC8FeDiIrHZLCBxUDHQPKmISzsol07TdqIZIZXS+e5EkUylspxSHSaopfV X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(366004)(39850400004)(376002)(346002)(396003)(5660300002)(8936002)(44832011)(7416002)(2906002)(54906003)(66556008)(4326008)(8676002)(66476007)(66946007)(110136005)(86362001)(316002)(186003)(2616005)(26005)(38350700002)(52116002)(36756003)(6666004)(41300700001)(478600001)(6486002)(1076003)(6506007)(83380400001)(6512007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jwJEAE53QShLtU+e8XYxbt3BSoWmIRiBzkESyoZp5+xsF4dgIoS/RNpOcrzDkoBiOakqL/rG0Byfm2GAjrOwcGq5ejKXjdKNOqSzlcjPZoJqUp4vkRxPc8MpMrAENmOuNzKRJGXjko4Nq/b+8fT9g6f16FWjZA/pCURbe6IenQJoqccZPgz7nJ44rh5W+ncpy1y3USPvhpVptCNDQUB4BkuKUAdYW8edf9+wdr9tHnEKC3KONrK17GVotj+9hHfomPDls/R/K/WP2Ms+5FYMCygW01RQnA4f0pmNPnapAN6aJFrVMRCKjCCn0Y74Sg4TtavpOz7uyKsR1wjSg/NHjuUBIAwe9BA43eKXhDWAIRvGp91OA8VhqyMcyyVz2YlLWicI9q4uGj5If4YZcmGQDB+f9rpDi/nktf9NWwc9ArS3hXnNzS+1BSZWQsercp0Gg39uoP8LQpmuXrj2HHGt7vpg4KzCWwWuxH4A7UHAgRfczslQqPpoWEPZ/d2eRPGW92tj5cVrWMASd1+zAUWYP1HwUcyxmS5+5xMyGLWU8/7R2osv4tCr7K8EUNZGe7Sj0qZWIdpPgLPQBzEqx5VqYYqZ/xMEK9Z1kovw/PDqo017ekG2H/x/tx8pyXOFkYBiCEDCQcSUjnH6BOtLkcgYxFPhppuM2EZN6ln3zNDJ5dwU2JPR9a64zzSqJayStQPks/V5sENKqNoHoSxjaywc6wNyE+sXw0jhwkN4prP2c22xL1OZyIKyXIGVyJTpRIsPaQstfrHi/m3wGRzrBOQ+lxu0jxGUwsMnBrv/u82/oVW2dY3NcP+1AadbB+KCf9k/mSDMuzvu2QPByI/4trupWRfoO1gKViyILLMlaTOJAHO8cHl0W0KCHdaynCGFtey7wDxrE/hDWnXceSOkjezSW8uzndFuegnbF7Saaw8Z7jzJxy98AxQZBJhyb0Ad7QYGn9Ka+RY/6Lrt5RsYaO/m1YBUKCqbTJmwsMZC00pwYH44kRO54U0RT+kfgAefV1ffL2b6YwgOBH3i4bglohKuOb0SNY9739PgrXBfNrFqVtmsA7RA6HvYQ2YQIYaHA0mStThdevkP6xOxcdxlEc6vnyAGOYri+y2ycivA16ndAp45CplUaAqgxeDkTVlc0VK/81sX5srAf1XoKUk0eufT182X24czoY//y5hWbJA1UQaJkeKgq+RuG+V37rXDYY/8SKM3yY5F/c4gG8qkjlWH4PeIxH69rU5WDC3UMOJb3GPAYha/Hxv0XRj8E5LQYFVKuo9PTK4JGNEPoTq5g9km4bUXvslSZZK/wwYyHNwG3mASUSJ2AVlKVSo41NHVeBxw/2Fqfvk805VdH8XmSwX8Uj2dMDMUh3KQv9wZTa8ncBjsaErijDCI/kA/UPAGVZmqXl9KQMwHmCSrmFoI7XJhquncK4o+m7N1VrCLphge6105PwsxYtYUIbUHuRSkeDFdfeMniPJYMUv+MwqoTVrsdHLZ1Z+jLYM7Pk/G1s6iRiiM4MC375jqIxVz9YXyFCYl770cORNEJ1urkphwxwWeU3EbITkDu2fq8W85d6IKE1eslt9fxaOQx7xnK+JHphJA4eoB/r4FXVdv7dsyTKVgfg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef859db5-0efe-4823-af92-08da66ad7b26 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:50.9104 (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: PJUvhdJ+wzUw9neMBXWhItmPkp5Rfid03+R1z1UQZ08XaQyKtaLnAz/E2c1oB/56wnUr4favUN8IsMZz5gAH8Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB8598 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150057_679394_559BEE3C X-CRM114-Status: GOOD ( 11.02 ) 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 Fri Jul 15 21:59:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919839 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 9C117C433EF for ; Fri, 15 Jul 2022 22:13:39 +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=w+QzasSo5vz/1uoTwnJVWpaELSBKj7n7hWW8p4DQQoE=; b=PjHi63THEqMVNm 1CNZSiHeGsFBilmA8ibKTneqAdJx0NCQLLGxlKCRpRczOF4Yk4V7wuIkR0MBYZBqOZ7jmDq2fe8br SFVPSIzGRfT04pq2YWXJu8Zs6Ed9oAAWqrjxsCmfaPatVvQFwQvSVdf9y0SEF+s5vidyolealJNwJ /lU9Yn+ahbX+cVtt6Ji5kTRtMgcpITeaLNVQ8kQSIZTRWuOm+HIjp4JYQmUzy2wOGJcoUEmuGQO1Y BxB4WJqDE9GVwQjpZ+PIF7RhXQIDd6Fb9aiiipLO03MGvORgvcZiTrWjgV8b+S1swjjEDepUpRTtp pKb4gV8VKQNgIX914baw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTXY-00AgNp-OY; Fri, 15 Jul 2022 22:12:06 +0000 Received: from mail-am6eur05on2087.outbound.protection.outlook.com ([40.107.22.87] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMq-00AbF8-5f for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nywbYUduK3U+L1yn5DIm47v6xcG0BrVGx9bc2/6l4w4fFSfIeUI+Edgi0tmpIQOdQvJlxNcPkJdJS9lB1TSx6x00btUSccMRkvzG7Afj8ShXGGCATI99/Vs5Y4eZ1H5OreDgKzrkfI1SRbvr1amrLcJVtOuCPxvYtSXIVgB5i9+6Qba+NGGTh2jUWADU2PAdJNR7UWbh51eIRdpUAF9oqTZThnX/HkwNVJIm1uljqCuB9sheCT+MJYk1J+Y7aFCq31LYcHAu+jUoSZQaXbJ8mT/u545VixVABirYIINK5EG5IoQh695x85tZfSNI9SzqjwDduzBPyHmUZj6CRKnRhA== 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=nva+WLfIPZBM3+YV94s5u3YkscUhHaox6WtOeDvwk7s=; b=A3llT5FSplJtEilHmjYSw4Mx0DKc4QJ9gnd/LTaTwyO/3y/NSKdCSX0qHdot5oAVEEX3FandDy93IAhZxvUXYFqEz7zyf0U9ELMCyv23NTpMj1K/DcJyavFKbjcCY7kFCJ6KuUpENAIreKhf2Vl3z4jYaxIz9WwM9I01QtcV+YcLh15w3gT6ETZIlZTnSdXGndzzgDfBTVdVEwV97ExOXSiZ8ps9xpJyLx8ueRmaoAI99QbFKRYXMsOdQV6MK8Hp5GC0mNU/h5DY5RFBewseviaemNxdaOba/aGkbhUCIr6j3DLM3l2VlBW7lO0mPeu9WtUc3dFOuvbSiHCq+dSEgw== 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=nva+WLfIPZBM3+YV94s5u3YkscUhHaox6WtOeDvwk7s=; b=g+cItMTp9VU3jPCP0W2tLd/Jju1k6udwwQDij2FIe8onYdt04tMxjl56OxEyjdICiNkLJaBnEJob8wE8fFa61gMRkxxsodSP/96w72ivV2ZqQM2LeYIiRBYWL/oCNRO8RJWALP41Y1W09koB6lxJPbpXf46htpvVnn7ksVwMGCjItUptp3ZIJSSJZK37odjyiU3j1GtD59AgRiFJCXisrNEoXUmZDvOYaB6Vqboks10DAKeQP9d/CyavHeuBUgY1PT7nX3bec8mvC8KpCL3d+ECtRHvYt9asiael91jjet9T2DZUxyTE9FeE3jkGwPEeKeG35RroAAS3jUDX8e6mtA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by GV2PR03MB8607.eurprd03.prod.outlook.com (2603:10a6:150:77::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Fri, 15 Jul 2022 22:00:53 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:53 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Camelia Groza Subject: [PATCH net-next v3 17/47] net: fman: Store en/disable in mac_device instead of mac_priv_s Date: Fri, 15 Jul 2022 17:59:24 -0400 Message-Id: <20220715215954.1449214-18-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5c89be7c-5d16-42e6-d79e-08da66ad7c76 X-MS-TrafficTypeDiagnostic: GV2PR03MB8607:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KJnav6ia8UHVx2hoWeu8eWEVKZN49Zkz2ygZbtCoVzZYxKpnZCaHZERXUHaS24BbkU6aSWDyz47M+Y7TO5SdWrdtnWhjW22zAWEwYAHHNou47VBdcMxB/hvfJYks+uLa5BxCgKanZ5RpEJwQaoInIHA/8/QhOX2vKP1QRT7JWRmllisRRMaSvWkMK4gNbsXFnmgsHqlIsR/jLZAWMqopSoB+332eV+7aVtt7T8AtGz/9JBSNg/D8eo6nGApAp5+WG4tbRN1X+udjsDj6gTHj1BKgbEyY/yrbDzKRWArFWkdilpzOZKch1V0maq14uBLniqGLmf2YLSaQbAUaSptBmhjQm7sBHjJWkcf2S2R1fXBdYMn1x1/Eemft+VT/X62ycHP3mvphUXdYr79+gpakjJ4apNCYHtRUtfYWbRBpTDnsN1kEdYH3CxvHQnVyrXQj3AhcKKiPngJfE4br43VRfS8lGLDW2aab3Y4fob4sj7S8+nmXLgn1/5p/ohraPBb0UEKdH6JtNLCPM9Tp8f7EVf2MA2PMxV0eHXCz9D8Pl1iP+qGp5Q+SFNtYNXs3lNft+/m3h6RORYHa8TyrK7EbPAUwwfePmwhVmaxklvnPdpgHMYVYxljGTNoWJNjbp6HK8Qm2I8iaPxO/57a84fA6u0+RAmPKcccDXmQf1tQ4Z/z9v7sq6iTOMdWc23AQWEBASC8DZGtboH6TmItRfi6Y8UHxmYe2oNclt2rEVKc2YlkZceiPJjywtlaXa5PuVtO5Fuj3AIVcJCePyIrqk7UEiY21VNAA/L9vFrw+oXNZtOs= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(136003)(39850400004)(376002)(346002)(186003)(38350700002)(7416002)(66556008)(83380400001)(38100700002)(66946007)(110136005)(316002)(66476007)(36756003)(8676002)(4326008)(1076003)(2616005)(8936002)(86362001)(44832011)(6486002)(478600001)(6506007)(52116002)(6666004)(41300700001)(5660300002)(54906003)(6512007)(2906002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Kme2ev7h9mrCKr/m7rrOtQ5iEdIlzjUhGbRqB9obkHMCWMngufAFFssFHeD4QpefsmdhfHSPXeupT/yG3qQ3gzh44+sJLykIPy5I4ooqneNX0kDsYH8gnpK9bNeh8WZaJcCh9tKpTIWHN9rTyQ/aefhUCVuGd9Qf+DpE4QkZnW2I4BjGxLY4hkGMFMiKSAt3nqbT7x16vRsGY8hFC0XmCmYSogNh+X1GBm/UIgRhw3tFdySbNl0oGh0VZ2Y1AFEl4Gh0ev5gmOfJKCKteRu4GqdtOpPv8xnO93E8Y3vpO2sYs2pZlvqsu8U4uqI5V7+LenMKpm3DtDn2ilVfX9Fd+7ARgdaLHxfn6aXb/T4O2Y6chINBX9U7AAiXtkgkmKfb6rIHb59MxcYnaKOJXPCEqkVJRLKTtcuC3UtLXFBKuYYgcM9UAsE1K0X/knVwnuedIDSnJnZHY+X8uPM8oceqPomCwkEuPCtKMmomoMWzIUAURQ3dYSmDAZ6ZJ3+7A1pnQ016dzMRPWMprLNEDWiU1JoENZ/66nLlAjBe3NX0wv9efNVndhuhBnmDtcBKXgam8+fWgYCnSO5L48kf3z80acqT+RAc116m4beqvNX5UIKs2C5CnljtrNDca3/lltfUI5EQhikOtH0xSFsezgVKbknncBkvNzd76cOy/b/Sva9+6WaGFGkTsGelIWHM+s5vUwwP7l3gDeKwAs8XX4jeUS0biMP1pGsE1SHWJKIw1au8o1PgkLC+dg5opUduCNOArkh+706xziyptIH6Zdc0+zTrj5Lb94AYrfG3Ak+uNsxeccIczBz8kLrFIUJz4XUhUIwG+3V8eVLfNBE5aZB/vY1PFtoZDCiGgWrL3AIUicBMStQKkJr3/18V+Rs5MsId6nWrxUrnh+EqICFw2q7n6CGuJW2WCvs2tJnj0dTdhaxkqOBwWfJoL6etefUePAjsY+8aLPnMXTR5VNGYTnk6FI9ly7Jckp0XBRWcgwpqoYu+SqdiWp0tVBmUKd1Ut3e0Ku7dt9tNYvKpwUAdiEofz9hOgCj5vuis4QcTS+iK+Wwc6DxJmo57DAghU8ek+UxxZfj4HBxKfwVhXaZ9xdPHT1z3jktimBEcQOWZq4C++GeKPNXz4fiR+oNpF2Qve+AX5hgc+X//pr3JIPjCGPMK/rpgMXf0p8/GDqPjeUl9m00JDZOqM6Wd7KCKMvK0bcSlIWzqMcPatZJtA8pyGrHUnv4afVptG3ogdQtHS2f6ld5jyo/Y8RND+WpJ2GL8NToTGOnswEGcAbUaFoOd0X2bSkEcCTgMEsIDMls7naVk00YbKAcXS4WxuTQzKHz3J1jl59tIPhp1fqaIirbxCqaK8m9Wsj9Dac+bN1RR+60hz4gUBXBe5ktX1NoQWP2C2dqZ2wYyW+qEXApAg23+hBwNYRYAaPwU4B17r/LqjmtW0aIdcvYDhBb572myxAOUerSbuCVdCXFFrjehwVkDuwFQ/Zi4N+Zws+GexHnbYxZy58AkD63FDU8+DxVFw7/08yhn2sg29u3jv7Zxej8MjDIdujKigx4N7+z1QsZ7nxBwHsZXhWgUNUxUHDF/mVvQya6m1Z2fmAVfc5ntvXx7BWD7tA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c89be7c-5d16-42e6-d79e-08da66ad7c76 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:53.0978 (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: HkgXjaBWAqmq4dtDYgDxIMCWGQT2Mksm7tlNqUiU5sb1GJp0wRGzdCGAA21FQwqYR2sd2NAsZox4CAeC2Xs8Ng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR03MB8607 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150100_240171_37634014 X-CRM114-Status: GOOD ( 13.48 ) 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 a770bab4d1ed..e974d90f15e3 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++) { @@ -2946,11 +2948,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 Fri Jul 15 21:59:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919841 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 8C2EDCCA47F for ; Fri, 15 Jul 2022 22:16:38 +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=voNMA/lMsndx7u nv55J98+odBBqm5+KCD1hqgBZXS3x60KyGRXn19mEw7dkBgPHQjWCZDLO9r1IJZ8tlPjNJthZtnyg hKLyRMvttwEGPJ6eYoL2LHHhAFOrqTE/huJx6KDI0pGZZQ4AuQDoddzns4ihb9XzP6MRxNzdlDVDQ 852GYAaFKUkEs7AO8AmbcYGYvfLBFbeYRh29sigN/PI4aMzd9Paf+ic/IU5iOd2bGnkvrITIVJRjM guliMoLEqora81LWtUQq+gTHcnlzITK4RvmI9c3YSSM3ZEIHSmSsCUTVY0aWnoHvzalXHXLHrLmG8 Y2y/8zeU5LxGmuagoK9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTaM-00Ahuo-NQ; Fri, 15 Jul 2022 22:15:00 +0000 Received: from mail-am6eur05on2087.outbound.protection.outlook.com ([40.107.22.87] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMu-00AbF8-7C for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hi4ikhz2Ot8fc2TcbuwPbK6278945VSf+otN2WecWItekaNiTGUWNZBK9EHyaXlU81M8YAFqK68uNqdCmRBw2t67onhBuF4kzPHKD+kAcOc80a62v3Bj59c0hKdPRO8RIeD9asLz84jK+72vnTlxevXwkVS/pkI23MoPjYcBGT9GdDhffiBHVQjZZCExi34Sn55q/T6XDD3VsRsTGRmpz0Onp68+bNnRFvXodEvuoQnDoBOM6x/K8cjCXy/hbJ8sCQrW0Ik2aQ0P7MNuRiTvSO8LvLwdo8Nbdpnh/yF3dCkkSx0gjZ6JQ3Jwie3notulTv8aw8p2OBqfRTysQaHTCQ== 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=LeBm+LGE1bFsSraF4R4HSTr9GnMRO1bRWlSVTUfzmO2RfVd+P+4kdDrFhyeemysh6UI3IKaR3djb1E8gBXZsl+kW1gsbHq2D8t1EP+X2bH60Y9zfPA8Xd578oBFe0/Dj9F3vgbP4krHXjfue9BxNYCfgm/lc0Oe1igqNZCSrOR4GKpzXj8tjL2P1cOR79SfVAgnuTsfu8sEBMJujOiT/OV1KE6Yz8D7zMOVw6lA/B1H3CC13exhR9yCBmB01wztwCG5fJcsVUHYnuay3lhQSdHEuzkQyytgr2PKOlD2OLtIPYhmYO/oHnAooW7+VPwZiNrfaD7TcJZ4WOxOcUUj9qg== 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=XYd6ExJ3ChGAQcJukQcMNbDZklaUT1Ady2axEXgUfIwRmjCrRfvwKJpEwrIZh1BBrdjkG/YhYXL1n6nv2ZrVmJkUUGdQ2eEBrDTnAYpGbMXY309iM258w79/M9uAH67lrJHfuvkasxeaxdcbo7hloc6roCEoWGtFx8Wp3WKe83SbpEwM7XDgGvM35eaej3RfqLpRrtu/7Dn8eJORsbQrYeZZZMJ+WshWc6HJ+E5tiunN6sR5PB8XLt6TvhMchaoXhaa1duzancnzwpxA9N/iuCnz9fp/8eaf19atKI7s4T0oThYi6SB92GyJZ3+Qfnyy50SDOqdmRo3n989Chcvaag== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by GV2PR03MB8607.eurprd03.prod.outlook.com (2603:10a6:150:77::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Fri, 15 Jul 2022 22:00:55 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:55 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Camelia Groza Subject: [PATCH net-next v3 18/47] net: fman: dtsec: Always gracefully stop/start Date: Fri, 15 Jul 2022 17:59:25 -0400 Message-Id: <20220715215954.1449214-19-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7bd32d37-79d5-4e7b-61c9-08da66ad7dc9 X-MS-TrafficTypeDiagnostic: GV2PR03MB8607:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uXRKQnbTVb6UwW3YC3pUQiYTqvDMSXUoNk7RETCxUgWRQi6dSXahmuqYlyOWtDBPXvOEN6Qy7xJiUKJnfPEevSb6QekzmrEbdRCYJzBy+nmshyQmU/3SxjSy2sKkkpxnIy/7a7TEQWH7gfn6jRlD2V9qlIVBR54qpAJrdtPQa825uGyuONrvUWXSC2HVhSQb19OHNbSdaFYhklfqnEGis+OWRmAlFnT+vKmy2r3BLkdyZdVUe/7IK/piPybrFYhp4RVPIuLWCGdcJ9fvrswpx0elL+LpVG/w08sHDwcUoS6v2l7M1+BfYEBzXoffGW97yVhMi9aK47oqvZmMG58QW+mZsL5TP4JLsRVLPud6xz4SkSwHGGACr4Lfwd/px/degaAZd/pLPll52ECTxDUvdQFQjzPZPEMjsI0ISC9DWLEyVUvTXYs4JYujxtrpUoa6SRnsqeNYCSDLP4oHhgnuh535rdLVxnbxoqpT/2tvWe72zk2+NYMgWGddRIOI/l5rNqilM10iPOmNKSJUD8K9iW64/q+oyKTYcUIaH1wgK7iiTlokHtjkEcZpwpI1yThzLrP77yHV+YJLku9xG8nULFRoS6FXdk64ewFAdOF4QLrHNwowYZW6RgZB+RYXC73xg41V2+QlieykBye/IC2GctFJuOAaJxiW7Y47IM4AuxeaimP3/ovERL4+rzWF5tu3vQ0qhcg2bXDoO3XtAEfdFxrwEWHs0Ff1k/U6Q1MVnM+6bjuShn95+KG+UhNxTKlvzRaya4p5FygzXRFtKiFDycEUxiS8IIX2FuF+Wujw//0Sf4OIKMIVNR7lx0eOW6BM X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(136003)(39850400004)(376002)(346002)(186003)(38350700002)(7416002)(66556008)(83380400001)(38100700002)(66946007)(110136005)(316002)(66476007)(36756003)(8676002)(4326008)(1076003)(2616005)(8936002)(86362001)(44832011)(6486002)(478600001)(6506007)(52116002)(6666004)(41300700001)(5660300002)(54906003)(6512007)(2906002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pOlBmKYi6Hj4WHdLgfHWTa283obB5drntCYW18yKooP+JeAyh5Mz8RFA4kmg28pSId0TjH7PzAXxZzs8jiQCJiuJht0QlZ20AaFRNzsVGJprTS/wVBCjdKw9/h3C5EonL99/hjNX1iOh8sfHyFBDbvO308AHjS7DAVd28SbbbUM1BXi0Su+pKGQcitJ96cb+rTkqON8Z2OKmqu/J6CF5dv6fHo9ddmV8WxwIP+nbvPYqpf5JbpEX+kXdM9Dks8i6SzpKNzM1U4ky1Pg5RwClQN4jwGGQ+v5LzjcoY7EZxb6OnT59/crQ/R1C3wg6cM5dsqqaWdXjOU4GPQ3gZoxRxJyT6HWsgeqvnKZBVFxJHtXru8yDeS86hvsCtfvYkDAEn8/R2ZkiJb+kQcL/gvZ7x7kiWNfY8SvR60D6cA5TxnO6LYGjkHZVPuXTMO1gdQZVXJL0XQW4aCwI4mD/Qqw4uNGiMK7368cfPmVPCZQchzLPb6t+wK3YmOkOJN3nv+KG9tPSd1HcD+Hc77f/T4LtDMkHXb4EAesiXRKZAVeFvdHBSYmsb2sDO/CsfvOtJw9PGz7jNpKpdqgORJIyomsh7P0jQaHnySfA52f5j0WB0b4CgcpPOCE46wZC0VYH6SKVYAO26EEqRd3B71jII+XNsO08f1U6jT7Q+Ls/wHIOr1RsXwLVyH9ltTNO/ZvKb/xeqq/DmPjTGArIKUbv9K6vOneBr8VQBTaLnpzc6o2FLtB1rsWpHde3UpgZynQWuxzNQj5ibp+sXPuvH6YLmGmAdiUo1z9de25zfsc5SILgQGY/s7rAgTnMer18lpqh0RmpgckVxCP+4vTQOjBAi7CNTz+fPbCtH922vqi+hnhBwHhxfsnewNWtMj3nvd7flbyWvkQYpAnq32RfyXSDA5hJ3hJGEgHi5TTrMpwu5VsltHSFQr1McMHr+9Z+dAnNkVCUL/iddzmTGbmh1HQRIXA4m1pMxb1EmOYe2V5f46iTDKtVVwDZmvUlky98XDOlf6UIQarffL6qb9YiXKMIz492Qdo6kKu14aJmUWYKy37kr6hV6M0i1+75h0b3q+ReJV9i0mhc/nG/UFcFKKtLJoVAzXIXFX+4S2T4iER7EbwjmERmufaUc3+L7ZmpnMoJbym6W8DJ3ZRA7GPwPph+Jg08+JjkqihHTlGLSVAqrT+NxTKH3aSmB8ilC4TYz2sAxAA6xXJY2g1zlVIAFqBLR6fXp0kUZGchJQZr2ZMb0g55wk90dYGmbXPdE3Tg9WCAvbPJo4Unv9pw81DE1KATvt8DYCWJnogbAmWlcRdeBAyioJ2e5u/C4mXR7V65xsvDpU9YmTCqSYxD7LOfWel9vMts0AG2dbG2QusJegnd5liqoktoB3rm7WUWPSsejSdSa53SrHwHcEHBibYQbsS1nngR9IAHwCvDMsKgef++48v3Z9eQ1gMlvU0nV8JzuLkwbp6a+CJ2M3kgtrWzlKszMw+alt6sfJPWqUouk6BdMOzOlyCmqgtkDUiErzAkQghoU9qRId3wmEJjrA2NO9fvDfSdXPKgH2moIW/U1R1LkvZwrfJ51G6tnlr/qPIKtExQ0F+s9jua5iFtQQ9CwVBtMkwoJA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7bd32d37-79d5-4e7b-61c9-08da66ad7dc9 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:55.4727 (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: rK6Ygszv6GI29LF7qMiM4SuUL+9GRuDjmIVhcxIUjmzun8nnPpL3Wkjm9XRyHJwjNeJAuRnE6BUU3HY7XUKqOw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR03MB8607 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150104_490951_8DBCC951 X-CRM114-Status: GOOD ( 17.63 ) 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 Fri Jul 15 21:59:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919842 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 B5157C433EF for ; Fri, 15 Jul 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=tHFUFC90oc1+JS8ZFHUAmapq9deCzN4hG0SR8qj9IJk=; b=qsZmih7YEhAzbF qSvavgBCZ7Q41gD9DgqR2vAIlyBzrqyOOvWUDapS6FVKVLobEqrMPRWzntlcwx6/lgyigZXisUCen YtHSY1+sfoiMGcaVf44d+IX2qkWjXg+au7aca5bBKLIJs/kpPvtx+T4OTatKWxhwJeS0yNKKGvjTS yXdhS0vNwa0zk2NjcPAXHmb+NybEJxqJ2UcK0hxod0MgO7HvA5r893GfGLfuwEMoJt7JUo9P6dz/W xzqmZ5knZZYlnu1mOD2AcXZ4FkH7CfFdjmfsC/Y8TycHOorAXxQX4Pvt0ou3kNQYAuWVVCdf8PivF JZIDoViTDpxmDYWoiQzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTbU-00AiFy-Ou; Fri, 15 Jul 2022 22:16:10 +0000 Received: from mail-am6eur05on2087.outbound.protection.outlook.com ([40.107.22.87] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMx-00AbF8-Dk for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PnfihahGVKsLZLAeZtd384envdsE3JJxvEp8QHm4QMMu9fhSBEsmzPP2RDxAPRVXuHyGV1DcfY9LHIKQeeWlgk/EH7RmRYhK9OZkm1Fsqr81ReLd82q+GJ4oZG6LYF5FfNx9g8eI7EX3iiUVzpO/scYGhH8DXaS2963E4ppfrRWWYHILe1V6rOozPaA3X5BMONcX5HCUftHmcsGwm6JEAgJWbcWDzd69oIJguqntsyWH/XggTEYVn6PYpr8PyfEQpP+6AT+Aggcz2HfZ8Vi970D7ZTweYr0+oVOOR3DCLrwB+kIvJRKLXMnz1UfRKrZtZPXioZM5LARFimMxSB2cTg== 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=MFluLrzQYWbefG87uK65RTjFj32gVIAuSWDk2Z5WQ9j7+OedVf73HGO1xxqoGUiLrBnynnZCq80viIWk7uwCaxlF4wlDNt1HdICSfcghzNOxrbGM0mVLYs5Iyp7kCMEqlBxg6TcPn0A5tJ94FHnB7VL8pszruPNvszP+tSLykVvHNlIuLQB6f1gtlDMAtNfyeAPX1orii5FgvqmtF2101Jx9W1gwZRwE7i46m/CiezPrv+xDFetJEwT93b+LunNht1dYvCP3CfnpRCl5LaPcGTJ9Y8005wde8V8WPsNlv5bq5VNM1bLLoC3NIp3od2cD+mMPcB9YBWzC2/T5zI2QSQ== 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=kXY5ZjLbm7Nxvuzxgy97HnuPA0SRZ7qCBcM85DC08orPSgZBrckbcxgiPQhUJTQ4WFc6WEiPzlMAz6Gb/6VBgvqd66lomGDLNtddM0YjGFDrjphLCCfbBZqnsPO7OrhJ1FjHVnZVrOIKw/LpF66szgdgigpNpAcGWtHPThLk57GFTYo4XVtYkSi+iOTXvCq9pwUw7anGYAgV7KnRxL/xWE28rbBFWKmXQ3aSZ9EEuemf8RTQYz5C4P8ynYLry/RJDCjgp6zfTagN0QuQBZ1n8vtPldrcquWdH+PaqtCeNCVXX+snUNVrACcKSYEBNcOae/BpLx+nGtD8sIv1qoO0bg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by GV2PR03MB8607.eurprd03.prod.outlook.com (2603:10a6:150:77::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Fri, 15 Jul 2022 22:00:57 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:57 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 19/47] net: fman: Get PCS node in per-mac init Date: Fri, 15 Jul 2022 17:59:26 -0400 Message-Id: <20220715215954.1449214-20-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 01a67b91-6fca-485a-ec0e-08da66ad7f1b X-MS-TrafficTypeDiagnostic: GV2PR03MB8607:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jXc4W+h0Yn9UCZZJnnyOK8T4APth8WzFiqk3tMA+segV0/lI8RpsdlM9imVAElX7LS62oqujqjwDYla+2DNp9d2N4lSkgsAmGSfgyEBGoygSQ+gbCwchkJPP5HO6GyFGQclFKdpLdpUsqAlw22N5qZ7uFaYa750pJ80hekjLM7JG2CHwq8anlJsp4dK0ZKUfhdpd93i1VREqtz4aTWA8S3GstHANdfq79HOuJtjfrLEhbIz+RQvIXu5fPMoOM7sarBkSqDxxvx5yW1DLND692tycvVcaSgqOC2MVdXpVMssmBDIOCk0NTQSmSEunc9U4JRuLj3U0VYZsywhZgPliwYhsrucAOZRL1DtutaYEUdNZgKyu021mJ0V6bEY0VlAfCc3wmyrckpGfsQaUbn/0XaEZsYjXKLaJlzIjvRm9zwsnmQ4JQjRBkwJ5Mvildz34R3Nh3Oyzu4qyVArzTTh+tYvxdaLz/yxIdFQWRsQfbI3UR2Z57+uGHlr7SeEf2tRUPGl0u2a50qtuH1piA2lmGxHZtgA/wKv/pqx3+Z1KRwuwNG2qnndEmhRgH+ApXNyeBxGP9fmRBr54WiL2VJEttnNdJW8u7mH1FQyah+EtUJzYDWAjYNRAobd3GQ82VByLmzy8kWxYazTfPzia6d2f85GeUpyIWhw5BnMVADiYS2Np4DWcgt4Ufa2e0v/fymVhfjVLeKEJL2XMG/3c7i5LjXG0eRLFkOe8g2mEkZmi0Sp6dqmxIKbjmdgifjQyR72pogzlNJarhl+dk2RSKCPJsVt6WdWsRSS8Lpx6tqYyYce0GgKsw71bbdJSjhxeNYM+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(136003)(39850400004)(376002)(346002)(186003)(38350700002)(66556008)(83380400001)(38100700002)(66946007)(110136005)(316002)(66476007)(36756003)(8676002)(4326008)(1076003)(2616005)(8936002)(86362001)(44832011)(6486002)(478600001)(6506007)(52116002)(107886003)(6666004)(41300700001)(5660300002)(54906003)(6512007)(2906002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BHoGofft4MwwswWPia0OQzgIvAABhS2KJO3lFl1rZw68dSD7GlBbDhXrzzsb8xSfoo9suCs+4S/50XGMGMffsEc8Vhi1v+Xpx51ue9bH68lqvxCIrrtPEJ0JHV1/AhfPrTdVu7rkmGC9uBrNxXWnz5gaVHPBj5jdwDzStqMSN1hDxh7+VnabreRYB+GQNcW3Iv9/1B3LVYTrFTVO/4WtvmqQxL+/lQZX+uFOwrmoWHEH+IMIL2o0Hv7RrM6A++2724ZIgLdPzOOjjc4+ZrYHunm2cI9ViSzl4R91MECB7P3mPTWFeyqUy1W3WA5OK0HDdFObXMI7c9PP4ndbgt5/V+nexd2bkb9Y6MfE26Gh0Qd8bVrSg/SGZ7gvBaatipxobtdm+hWG/ADTNIYV/hzGaye1hnrQtD+t1UnkHvV5dDSXtSUimW5f1BiDBgHvfHvlR1UVBfhMkJ9eZ+vC3CxmA3BEEhJEv0aXn8Z/gBUoSWc04qNVKmiUvMVVtMq7bCmxJrSFqu3VfNH3g/d8wmqphu67+nAl6pkxVIh6olPbD4C1j4b4v++INiVKBrGAbdBrCYtkKzlFniSc06wk7o2DWi+j/38XEZeJOMp6g79AVVc0120U4ONzWN1kpw5BRTND+7+4AzcurYYjuRUR9QMsInktqAUtRGXr6sbsEwEeSQTApRa8VN1bzRIiWLlo8934x9prPJsE1MNx22zthDyG/RXqa4P1gKpftDVRtUM3f43iK/8hZHdT41utaO9FdPzuRuY8MJS6XxjtbxGM5kWbwpStWqncmmNI1+KenNz/zUzcpFKB167CkAa+R6ZVzf+GVwGrLUYhKp3F8/QaLPWfZ55FiMWfwPAUISkuNbXtbcloSLSVFrv18ZAECAlcujCWkXY5itXcQqbXiSfNO7fIFd9SwxeHYdMR7UojPQ9jiN4UZk7dQVzQr+iNJ3eqihMJrd4jFYIBVR9jOWw/nKHVTyax6XMB2D3b7EGFMKfTpYn57oRrMw424XYSrsUyamFBM1gKw/1+UqtyUqP99RD2nRxPwoV92TpIzemlsVoO0rhDgoahKoGqj97u7KfSaRKmTJPajHP7XOKZTFP994JSUFyI3bTUN81zoJkz7Cwv1pbB6IN4M+oJ6N7xqjILLXetQN3huLiRE2yt11G243lCJj1HU65EEQIk4kG27cRKsg5Do9gvZjiunnL8OIKc6wVXVVEVt2yD9GSVKGAnEMekC7cjOkIyOdL4RkJlNwhziAkIrQAsQnBNhnQtGug/tarTjW2tQg6WhXBj534XzAO+rZMQXmwkvWPC1Xe4PdB+m8NXd7pekvpzOwiItJLE8qzUfmBDoU8khuakuikc/osST8XffM81BpDY24yrOjgE6Ry43gnoZODl0TJlxzH1BU1tBQPyEtjh8+QlQN5oFSkhaiCqf+XNORcr9b4L7wPdzjIBYzZSotvg0HcXhcJ0I2LStDBZOavs8nBMhpMmQpGhDZRNAoYzLPXRmjmFtATDvmlkcewTK33zL5zvGHSzKK7My/Edi0OOShQzHYDZpJlDfgwQsQQ8fUUSaTJmeyFm7dBz/Zea/bbHAZudU7zFJXWxI7Y0GB32D4GUNbmFi6BZ1A== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01a67b91-6fca-485a-ec0e-08da66ad7f1b X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:57.5195 (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: mg2fpactM/yv81ac8BZwFpc9Wl9Gn7uHhAZ2XpmBnmV7eoAfkY5UAG/GbDg4MRQ+qmvOV0uymLeEKr1oLSN0EA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR03MB8607 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150107_529744_74B23707 X-CRM114-Status: GOOD ( 13.93 ) 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 Acked-by: Camelia Groza --- (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 Fri Jul 15 21:59:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919844 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 58746C433EF for ; Fri, 15 Jul 2022 22:20:39 +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=fxGx7a3qN3ltRJ nUw3A0TdxOze+Rz54MwNEoRgYrGJvDdNXguvzpXaZcjT1zZM+USYO/RPXOqT8jxdjFZQuZPgu18Xu CjYWXx0Z0b1WQ5Duu4nvDt82CMndWNbqasT+SDg+9Mj1zXWiKLTH13gyrXR0m7/GGzpnNEBhgON+x bGDE/r4Gg5atpfd2rPK96oheFb97pa/ZLU4WyWTwAsBhj0vNAnu+oUOUBQA69ThhSawNSpB71P9wy Cy5O6vQNCnQHdZ9grNZX5Jdazd17Kfx/gcQ87NrOcOkbWy+l1orMkHNHYIUtIxkxrRr3VP2wjWYe9 NFFh2kbunxIfO/M9p4UA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTeF-00Aj3s-1i; Fri, 15 Jul 2022 22:19:01 +0000 Received: from mail-am6eur05on2087.outbound.protection.outlook.com ([40.107.22.87] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTN0-00AbF8-5W for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oBHBdd6tr46aixzVrChqyVBgWkrhriv5aAaD/z+PXujjAlT+zW9Y1biCyoiyJw/sVhsf1UbiiUufuh4jMWEynQdbthq0HDurbCKg2nVutPj6rlzfqP1QXDtI2eDdJ1eh290TfgvZcwI/4rsohpod64yxPyHjgR/sWL5MmitlTqWRBvMfyAvMt5qfIYu2BU2MuBBJRXtOn74M1eavFZPTUDySP3zuOLugaOKLwqFzIQxZtOPN0u1crNz34e6nImzrtt0DQT6zJkuCIMUbvL5ioifBydmMsF5v5NUp8u+B88Z2+w5N5+u5RD1vXz/KKbLPfyB62+355ZRyOmONzU4r9Q== 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=S+7IdForRyO6Ll+fnFwDs1bAaJm+YcdIl6OxvRySOhoR7BCr5/VdOnx3lnwj62NxfVdF2U3/ScbG+KhYIGyf1Xez8JFnU4nvlFaoHvtIHcGUDgHf5jwqBWag2m8UwvcAru5a4p6Cnq7NHdjG0VLmJxa2Q6w1w31OFPJ+sVlaX/++uwXNJ7WNU0Aeo/6dQoNZic6wSOWlfzCk3EjG9DXvVtd8D5cUhsC++mI6bf76VjtCBp91ZIAUKifWf1UZZJ00PqaqH+AUxRF0ZuOytt8rQ7ZGUqVQRqGdPWfofJOYoK+gvbWWwswqTEcpdsgNMbkfVbKxMzFwPf2tsZ6NczEEZg== 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=jKNGd0od4M7ascnXJPZhhYyecoy+OJQykAdxBWb+lsQO1KqEcbHY4l6NdwJy6hJ6UDFnRby1xoRBaZZvmAcUl1/btcawMHFbkGZUL6g8uFdOHYYhXW4OE8hX/GcPV8CHLPuYta0SR1p+6C6PEL4IzTCEkg8yUyf6IDXUZZzbCT3QCSz5dbubMKRNpYn4V/ZBuw/BYAuZCvzygZZyTj9JKGDJyeJUzdiBgNBFM4sbDtMvrHp60s0/GcUXd84A49tcLeb0JkC3+Fzwzp3RdyaqTYW652uW+HTgbWpJ+wAVpwjjqIqqa/IXJ5CN34Jwj7utf6yb72coe1c6Qi6qSRjFJQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by GV2PR03MB8607.eurprd03.prod.outlook.com (2603:10a6:150:77::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Fri, 15 Jul 2022 22:00:59 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:00:59 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 20/47] net: fman: Store initialization function in match data Date: Fri, 15 Jul 2022 17:59:27 -0400 Message-Id: <20220715215954.1449214-21-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 10e8b726-8f95-45fc-3cc4-08da66ad8054 X-MS-TrafficTypeDiagnostic: GV2PR03MB8607:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KvF2YL2ghvM9s4n8BHJh4Cv2Fr8dAodWhhZs+NTS5b/z68g+lXaFCWx0/Gna3UJZa7zL/dlCbI5QzZXNbw62QUFUSxBUMHY84XLIuGYIQh/xpQQSVzVGcLKiuIYps/xeW+cIFu5s/sltFlGRhDUX0QD4wy/EFJstR7bzCSmxObQC5GeGq3fgkthzrwhigoPEovh9WDkLImb4in+guAV0Y0ycYNTw2QC7sYI4IEQ3E3I66qGmlJNIsGCitWxU5JHDpjkWtuG8Nic21nZCq6vEqi6/YgQxlwZ82Mt2zJBZS9+7yTbqqH6loYOU2Ygppe8YdqWszxZxHh/duri31kNcctkHuab0gtnlAYjI/x6KyB+W9p31pwVwCIzGQ1LvJCSMB8CgqCrG+5hbe/gNc0mElk8DKr+7B/pYMcu1HrjRIngHo+yU3geKomYEmgpTm4Clm5+ZHzwau2I81VOfZnZcNfICCz4i5JfYSTPcrt0UQeyUaNNdwdA77zUA7AzHwg/jHnIyPux3JXMQv8rUCmkoVLCGeN4dTwws8RiuhVooFs6FpekncRW+wSds3mr8BjZ0vQfQSMBX+WkK9GOQxvCOgBi3OXR+zwh+alKEkLCazBUS0tho9PsjsBKvCQjep7fd4GLFllxqIFXtUfHb7pdPLCgpKXpO2J8LJ/LYyP2iOTpRtKxGPeMJBEM06AQ+tv+ETLa9ge0Wtztkvy69S0JSOzhFFNdjU5cGu5pbH5pctERz8aTt9NgHYkVAZ6Ls0J4JYfQgJC3m57TMHzIvTN3t7OcmhTXFPa0qUTh72H27uVR3tcUU4QkS8SRHXIPl9uAm X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(136003)(39850400004)(376002)(346002)(186003)(38350700002)(66556008)(83380400001)(38100700002)(66946007)(110136005)(316002)(66476007)(36756003)(8676002)(4326008)(1076003)(2616005)(8936002)(30864003)(86362001)(44832011)(6486002)(478600001)(6506007)(52116002)(107886003)(6666004)(41300700001)(5660300002)(54906003)(6512007)(2906002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MEOnSXTQHZ4VGOsNmttLmeEdD29KcAOzZIPRlbynx2jCsHLpg5O2Sync5AdaW4xwW0vUgp13eWz1V5LLJnuvGc/9fARpftDoJnbE3Ww7cLPU3Z7wpu6ON+g90cke6BuOPjNzxbrsnfAPK50XDQgkkIfOsKyQtMu3WRgQ2G9DMdKD9qO1IChnR3A7JTDzEs6WWbcnrzfln9zDyyqF61ea97PV/uq7xF/oAwvq0MPJsDIdrh4zGTZbJUsLDE4Xgo4ukPpBwDVpEXnjvaLWIzJCvPq/x1ofwnoIV9NnddMefB9JKgZpE0I1Lmn/nj1elx5XA+830uK98xjyWvX35oq/HvCFvfBDczSaYoqehUC/1Xpvbd1R/UQt/5GgK7Rs3QSYm9vtshINm25poLO5aVB3xLHfb4mO9RLFDJoLqAla8ssRDkHJn+0EImWGwzzUzLRBxhlissPLJj7m87BqslzVjzFKhpU4VsQGgoaI1zcWxoL6mtNzXVb2GBvILKzPjvli1Ul2rPUWpj4YS1H0oSHZKCvkNaBAaCHZx2ROKP2i+JOWLCmejLMrWCpp2YF3aLCzRtK5RZysH5OZE3Xfp7HRQ2gNy+PEi/ZsZ6NpYMc0RQWqOTTY3NSWDzst2M7yny9LIZ1zhoH36GA9Opx/SSGrXhhyjzg4W9VnJJfbduy4U38dUSKEApabgHD0QzqNriHh/15QR1ZkqREKrD95w33GWRKVq+93VkQq7O/40KdFIv2sZl6cjgLr7UqvMz+NLctg/nSRmvyNy4PVaNwKGbjqMIzhMDjpCls2lFiiH11cZ/sH3lHHwQTmTTZ/zmBWCu6dfMIzDbcO5tWOsob3ty+FnWqtETMUev6EgiZCuXlASmSag1DVSIE2ejRPCJ7glCBSXVaTsFNB/RfaD6t6kxlu0XA6YOq64wLPA+sn5sOjBktCT7PxteCW3ZyX38Rc3xqxwJKtbVtS1LzUUJ+cPrkfsTdxneXzWk5WCXMQUrM/8+m7EoP5mRoKvVoQBfOgK2x0b/wjtjgARjWI+uiviQlR7SgxePdLXbEm9YlbaN7duZVzg/Zklm8pInFjvUNm4jMs5BBnqnh9g8Z5yaM6WkDXEKBRS55KqFFpCbKSICg04YcTu0khzYjoSq3tlNIY4AwZ9CV4FLbZWZSJFyNAKOnx53e1llx0K8icocKVTmA8ibG5TAz73ko4OJ4blaFoLbdHLjqj/wMl23LvIncksAO7tu/nGC44Zn1TuO5NCM00p2feFcV4LqTZSV/MT6SwQx5ULWcqkZzj1s/uMUlbaaAjhbf7odTyW17sHbDi2Dbfmg6yJ7y0KMaOuoukEEWbo0WhwMDIOnI8Ut5c0aaQBIxvFUixdE4n9GIt3zPwWD/volr839uCJAaywJt5tEff62Dfiqu1daq8GwEXq2uNvGXzhg8bbP6Mr20gu8d6RXqSXeN8Pf5bwAeY5wvRpxtKnQkZXp0H9aVYSJ6bUwL43X58rcN6ipk4MSB1Te3/0UYYG4jKa6i0FHIpXdjcTrrR24fl8OWkI8y5TtHRGteQToWuIqhsUvWDwfCFqscnB1Cj2AiBUX8L6Ww6SA0evRTC3ve+4FzvTV62MEzjWrRqDD4hdw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10e8b726-8f95-45fc-3cc4-08da66ad8054 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:00:59.6757 (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: ajiI4TNryIow/+31rs5IG8D4hmxJ1yf/P5Ewu41nsm0Y15yy6EXnqNfDZzbCIdnTzUc5Y7cXnM7sO2jHh4VXjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR03MB8607 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150110_283958_CE8EA9F1 X-CRM114-Status: GOOD ( 14.15 ) 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 Acked-by: Camelia Groza --- (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 Fri Jul 15 21:59:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919851 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 DA6C9C433EF for ; Fri, 15 Jul 2022 22:26:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sHMzg7SDva/VYRjiZkGaiu5yshQ7ReyUvHjXTE86QdM=; b=H1OIcE1vnqRpvc TwZ8AAeHQIEu79NGU6Kub+qxofswcfJ42+iPQBygFLoW/qYOthQtLfOXRnE+7hfsA2G1hCrjsxALq YSzSZYuJqdkfW4eukGY8nqEGPbGSH5vTnl6xCI0h96phq6Faj9rRa7cuXN8VclVZFhZ2qTjmKmjut Pzl8FhtZ8yleZiuQHEB1NiD6HxVPQ4IH/wCxrxVtxymLZg1MtwqSakc36BAuUf6Q7DMqOLv9Kaa3A 6IN6hiE3sFr4s1LECRTJxu8YS2JKdRc7X2hJNj2Mw97jLt736Tif7Ynoi4le5U1rDZ27Ubdb0Ih8o lkTdKRrubBnXqguf3N6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTjZ-00AlBK-H6; Fri, 15 Jul 2022 22:24:30 +0000 Received: from mail-am6eur05on2087.outbound.protection.outlook.com ([40.107.22.87] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTN3-00AbF8-LZ for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RiycRsGOMUmY2/a+wBhkOzcNvJ1j6N2IXvxRJrJKbqs4qkemWq8XjLe8s6yDOko5O3RdAe1xYGBVt+p03zCuFbe7Vc9UV3vzkdxmMdBMQtojHIMmjNLdiSYC3IkXCO05M+FuUQ+cqaw00iBVip63nL+KCd1TS4YJMCFRAPp+ogDp+DV8Wpuuw7WgOTgHJoZLoyfVDO5FE0q8ZScHzZFcF/Y14MXjTJSccPYBDgTnOGHDvg1cG3g6geTRtxhkRqnn/wjTkA7PXaWYRrr/6K4DYqjfcG9x7rvZnLpWb6N5BmcrNj3E6eVnajyY+R7SBQKn25iJ/cLNw4LNaFaAkfDIAw== 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=PZK/rW2K6NDVpiwI0/IflAWDjqbC89Vw9tIHDOvYBVw=; b=NMU/1V68YOc25N8EK2n487AgA0IX7JpyKywXA81GGLWnT5e4FnfvqUgji/57IRaXeeiWHeYzcK1cGqCG3yINI+XYcXnU3QT2Q0Omj22n94WVb81s0XHhjArWeVy318YVzrTbcWeY+GQMW+Tl+rBtzT6kcUCN3ggrAifTJSxk3PtTfwOTc6QY4pE55wKJWwGSMoHXV6pSKlXTf/PZg4Sz8Rjx01JGmjSKbU48TBcBSDEP9k8+tGZRUDFxIpA3b/CwEvlHKpIH49enHyhwY0wp60e5c0i19k6iott9aErE2tDhqLrlbo0+bExFOWUXYj8Kdw+q+Zl2GpECmJS7LW7OjA== 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=PZK/rW2K6NDVpiwI0/IflAWDjqbC89Vw9tIHDOvYBVw=; b=k1yk0pLeQ6V/zOCCW+TWnTTPtorwSjI3kbY+sXAP+VW6hIG8e1hsX+Qd4ngdhFNFYsbu2dpEt7VeGBFSAXgySvvABEZ7GB2bxBiLwxs9/p7BDcQvh5S5f4Nj/52wcfzKbNmeObitgHpnCtaDTQFPm7nOzK0lW0IavzrAuCDTxnHaNlJUkHPWrg/e5Dlyg5miluD+qgM0wAT9FRnC9kS/vZwydI0y/qbbbEvLXIlAVDRamqCtPCDvENYR+lb9/s1Nq/bM/bo+DD/2Td8oECPWY5cJxAPLCSq1sYqy81uviidjdtuHnWsc8ZUVVe5zzkRiTsjs0ZEPwo6T7LyNT0h1pw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by GV2PR03MB8607.eurprd03.prod.outlook.com (2603:10a6:150:77::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Fri, 15 Jul 2022 22:01:01 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:01 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 21/47] net: fman: Move struct dev to mac_device Date: Fri, 15 Jul 2022 17:59:28 -0400 Message-Id: <20220715215954.1449214-22-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5686453a-ad6c-4222-3dc4-08da66ad819d X-MS-TrafficTypeDiagnostic: GV2PR03MB8607:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7IEeSa8CkMJfwrjLpWq51F7eU1uiMbAYyCoRA6YZAxcecVyPiBpLMsPKEevQQ+e0YBNHNfDb5IN9V830MQ4tTX+quf2zLIFZOeSgtcOecZiejQtHpI2d2Jl2w7Rnzs5EnzwwcSeJ6gLmGRZ2PymKmrif1LKNU7pFHdUjhhvhxbM0urECWS9wsICAA3RaE95Ipb9qcd+5Dt+HJNgJa0mSBBZSQsuhc4dp4zz2U28R8SVP7/8qzXo73tU5LteDtdM3c/B1t04tH1ZHa/briMjpd2FrIQB+w32mgDIhvfBX1gTGrboqXo2CbsVcqaYF4fuSGSCNv5lQExpx6iWYnS1UGkttAg5mxq1nC7AM+wVAD23ryRX7+DlMACHaeqe+Y6bJvIAEGa7aZEp3xvhQWHIUXa+VvaKT6OuP1wzZzsuw+Wv6vcb0Jk2br3GopQlpz+PbEhnbyZ63d2s5jmJiCJm8xHIExfGVrQJG39Qv4VzajTfVK6Kyq4zq0yQSZmxChfHLxgfwb2MRbJVnxqJK8hB8C3p3vFUSAzDZ0qyu05TtwhnJgJk9VcUjqiclqu8tvvj/ygL7x/xlX9g/x89pnPJEvhBTy/oVBjYra/CvGMh4H/3CxuaovwgnHLMAof/Zyh/Aozm7lihaFj5/sRdD7KPSaA8dy6gCplQWwd8f+FWsKXvrwT3kCjW1WB4UaXXMkNaH7AyO5tde/VPJsXyFRKXoR+0xEpdtDqUkUxKiel1XdDx963afAOaxt5l6y8Poeh4Wt8elS2+/0nMglfpCpBLFOChqtZVqdUP3baXS8WF574UUSBAaByvz8kMvCjAsXkyK X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(136003)(39850400004)(376002)(346002)(186003)(38350700002)(66556008)(83380400001)(38100700002)(66946007)(110136005)(316002)(66476007)(36756003)(8676002)(4326008)(1076003)(2616005)(8936002)(86362001)(44832011)(6486002)(478600001)(6506007)(52116002)(107886003)(6666004)(41300700001)(5660300002)(54906003)(6512007)(2906002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YBtZYIfuDMm8njTf33RHh9zhfdA1TNMNd5j9MmQgG/fmW8j+UoZrns82AUyBa2jxZyP+IFrgfM9jc8NYeVeiqLcLw64/uIMtlwEWTTX4AXPHIBFhDiVXj4uBlyayGM1T4m7SuIRdi0cC7kUwLyCay5FTQkZT9dnQsXUoEx/bSe/O5mCzIuUxud80Jh4q9S7e4erqFkbMx1XCF9vlhumhZidMlUjf5mgOIrLzW0v8AkG3gmbJR7Ek9TgjHPCUR6oHRcO8pa4TbFlFCbp6ryHfIYb+bWQurXGoYy/XS27Sq9I5q5RHkxTmK/YlSQQEy2zW5epddM6YYFoOV8e8N7O9qxx8S+FRtH+7YMgYrOTm/jhktHpkLLLzcIIWsvGAZjcJv9a2uflG8rF/WDVMBoorHrWX/DkPY3LJdoitwBKF/d6k6aQeVxvEq5vsiV0mx4VcnDOzjcC7F4yrjDz8FLqKvnnL9ZoADl9t8jGHTytzckwRBNPKXtG2/gcmM2/h6rCVbMNvHqQRzjmaUdATul3caq8pZHEE+PKVI3n/Db3+OBG4KCfkstFbCIXsRBIU3P5thvWUVmxA/PKDqkmHhY2krMk8oCN5y5CbafPyk/FYIumfZleiYAjbvmr8qRpNhUkeZ0i1Mq0lv/RjrG1IZVdpuf+GIAh8Mn4AFHzPR9haogm74h8/q9fJm4dmOVl7qbGNdZcSY43Hv0pBmIXk9TsXO1KxjH25vw8lh6pjHefV+LfD8VCDcxpDETPHb+JPwSVQsP03jv+6WrAymRCC4TqX1N7MBCqQ+G+7tDmaCFIiHm2GsguhWDAm0LpBDzPHzVdOwUYOKHLFEW2IeV7TpIhbLkx9m3CmScA7p4Ju3pdi9p8N7NOoZ4ckBrtDDw6ZG79qpEhkTl298Uz/4vgiIAGoWi7DnTaPk7A5+YR6mTbgonFSrj/XnSeoH4w0MzWxVAW0kqAOoyW1xOIv4wkWixLXSLtu0xVQI3cwtowSyGLYHqqdjivyeBE1CT/KTlNjyocCOFWbaqXFwtxzxWxc+yQq3s+tu7/gAEjkGTxjkly69hckHVrq1p37L0YoUGO6fPcDNUSXVaU9zaHV68zwrPE+oe3Ri9ahILc07Bapdis3a9ugHpweIYYu5uTkOlih0Tq/mSV/yOITNO3ills5EMC4vw5NFdwn/2BtJo1Se6ZzCBWgdvlXVBnDu1/qs5PScn3ZYi0PcnqffXOyM8eJg/CAx9FRHKrgFp6y1NcWjDHHnptdNdzV0Co0C/KAYD6pY8kk1dC1B05qdWHH+E5Xaj+5Qsfm5Hr/KOUlVVEQNmE+tMpo+iwufFCZn9fOIN7V5V2si5ibBnGyxZd0PSBeC3KfoUUqOpUqWZBcnHhB72xSkhK2wMeXrkn9DNx8pm0U7UlmwXLivJnne5nKow49EiF3ZM+dUGSkn46qnMGSD2jAWR/lqVGQJ+WXhLiDSo4TJ4sxfUyNihsOOXMSPXQ6RIo8pv7HSkILFqK1kPq9hDklvDb3qwhU7K2mBi/3FBUuTAYaGg2UYWulNkA5CHSUm3pjtC7n10OPfZKE/S9yU6xrNlJae+VtApunfGMWGf8/+OBjylDxgaFAiJztfQ+ri/OOeQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5686453a-ad6c-4222-3dc4-08da66ad819d X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:01.7225 (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: CI7OBADJfdOakFawSbD46Xvqt6PlmrzDcI5ujnjmCGPi2N/O7lc9Fg6cJTzkC9KSBFSJkjQadD/73oJZ3Z2gsA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR03MB8607 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150113_773968_B12C2D79 X-CRM114-Status: GOOD ( 14.42 ) 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 Acked-by: Camelia Groza --- (no changes since v2) 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 Fri Jul 15 21:59:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919845 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 6C915C43334 for ; Fri, 15 Jul 2022 22:22:22 +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=EFROLbnH/GVqf/ K/NSLyesXQ7vzOlZuwW2aMFTYHhKnNJIwDhZN4Wc6SEZ6r/ShHVVhZC3mcYG4kEvBd17+enSnvEQP RBvs/mgn4KEzfzM2W1JH4gn10z420skcYWe4jo8tK020ooAhlaGFBmJpSiDBQV7WdJjz128Ee65Db j43lQFCGpTkNOBQtnn2QXC2m1hAgRlJbBeG449c1C1fnh/WCiGbHwCnUo6/FGE5LKXXzVuD2LvFhF RFwuLa8iGOrrqLq2XKcRCicpiskRFOYi5savU/FiDVvIDHI72IwDe/IhojlI2nBtZryqWwhC4nCil R3to/ZsqWHPyws6oeXvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTfu-00Ajhj-HL; Fri, 15 Jul 2022 22:20:45 +0000 Received: from mail-eopbgr60055.outbound.protection.outlook.com ([40.107.6.55] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTN1-00AbL9-Ew for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cpEU5ditqW16vw0os0evoDqpMWHpEbz0oMcnDdci1BZuI0FwELtMWUStpCRApuVIIhxiTibwx5YNoyH3XF8oXLC24RDk2KgKipZhKbqkGVww76AwcRXZjvz+3Ns8XGKnIaYqql6rzCD/t5lLsl5v3EpmzPcb+jqMJD7y6//tVb/8a7aFDFOACqikWEiSaMtmvU64J4hzuT/FA8IBYZIS6Wzrd+luWBXPLWkeaum8TuxdsVU3GndDUjXPL57JluUIPyTL7wqrh+y5FZmIse6BLtusWpMHn9fUTzVI1X4awd+gipuu21NkcNYns01rAW1U3KB4TIGgeNPrM5u1knob8g== 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=HkoMJDipmDekbVbpmxlYLk8o1ZiFgbQ0UeWUP91PhylNNDMomb3RgpS8esAaDImi1MsFklHcDtJodEvVJrWiDxAn//V1xyldxfVAzANmtyK4FKVNXYksjY2SaPoSDcmOh920rg+z9kqWuNBw//4/3HadWqasy4Z2Qf6/19a+Hcw36jLYMX48H1Aj6+EuntqqFPa96yIuuSvYLvZJT5lQQCrnWjr69c8v/syxWHTTZ+4EJK6OMEUUySfxiNGfgXxFUWP4W9pOjCFarVqXvCS4V8jZyN6eIze3qLwVbP0QP+oYOROdK0HVZfI+Qahpk/3srKA0RvLFYheFWu2XuTgijw== 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=ZUwdwwyLXPw7acwgSD9NcAI4N8VjjU+/eELOVh2mbB/vsQO8ZbZjQ8jkEHW9gyWNTtdALHxTgyRLevCo0VAOi0YO7KQrRB3NBkRFb4BYe/rl2dNMwz90NfxLucbpm+lcmScE71Aem0NR7Ao2HghTxrzzIEmIZ0VtZwZZOpEG+I2PmtlUvDEuI/OLX+dTz/DUrYkfTJp1JP9SAwV3LnK2lw7UK3mBFphSrRVGunL1TO0oCFUtrdRTDQT3G4UFGTLs2+Y/VvwGaVUawx7Hln9k2H7yUPOWTk9iLjyymSFeWBWqjm58FGWacepyDoWOHcOuUm3FSFswd7VOkUjao+btCw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB6PR03MB2902.eurprd03.prod.outlook.com (2603:10a6:6:34::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Fri, 15 Jul 2022 22:01:04 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:03 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 22/47] net: fman: Configure fixed link in memac_initialization Date: Fri, 15 Jul 2022 17:59:29 -0400 Message-Id: <20220715215954.1449214-23-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 961713a2-9520-4611-b565-08da66ad82dc X-MS-TrafficTypeDiagnostic: DB6PR03MB2902:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1WS+jk3F4FuCXlcw+sSqm2i7ID0CiVWrj59yVYowIZtaNX1+eO61MFdshwOiwxlHGEIMeSD/EKXvon3BaulAZZkHnjdbPaH7tOZxdDHhUSkLIYV3e4a0Uu2MWCwSqwHYBji9/YsrVUlutgxFnzrvZIe0/nbB+fxkHiNsA4nww52H9xo46h3urphLPtTU9KeIAehfVgYr4h59HkFRIA+V3SKtrVwAlWi4sMcN/SLGdZwvUpU3oQO5RSKz3aZyRwKDL7bcwk8huArdiB4tNDeKuM72yiRMWYC7JPA7DAyeFx06LKB+e3Sxd4hT9YjaPLJl8MbpAz62J+K2aDN6fa9C4Jy5OqsyLEhMDNdVTbKdjh12G0jK+YGJHALrglVHwfR3Ni9uf5925YetQZGI0Z8VKoFF+j8HnpSwGkDfFLmW0r3YuYu6swkP4nkAArORD5FUIioZQCywjxJLsLKvhrdVEeHo6bS7oBxKmqYhTuAp68mpDgrRvlS5JlyzxDdYTKU+el88cSWZb3RsYMs4AIOSPyfiSXLGMU+Qi+KiuK2tEQuNYL3JzQOwZ2GyCmhpESb7auZRJvWxac8x00CLc3u2SAElGsWQ9lGTzAM/8nZHVvex765TbO4kZWxzXqTgETlDhprDlEOvbkLe3co34imn2v8QnssMdqogg7LUZw6Yl4pib4QqasV7O0ti0c7/1ouhIRKKBLmzOar1BCs6FRj8R7H5c0vScBSoInAufUMtlwt4m1UvG0tIMcGwLo7PboPPEEBtlY3FnnffncD6zb6jP6k+79/eqtd7XceijX8uGG8VOTu6bCTBoTDHEiieSkCQ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(366004)(39840400004)(136003)(376002)(396003)(86362001)(5660300002)(83380400001)(6512007)(1076003)(107886003)(38350700002)(38100700002)(186003)(2616005)(36756003)(26005)(6486002)(52116002)(316002)(41300700001)(6666004)(478600001)(6506007)(110136005)(54906003)(2906002)(8676002)(66946007)(66476007)(66556008)(44832011)(4326008)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GVaHbyQbR/y/fjbpR+cABMM1tR5hoovCjuh3mcdN1guLjhnhKnue/WW4P25WvMgsL5w4Tbk0vlvUXxw3jjV5hV5cig/9Kj/IuspwnvpNqHODgiqyoSlK/tW/MfvcJBy0JQGu6Lz+sbw9E2uE6nFSy8kLMPFgZePo1lAigOhU2Kyl70A3DY+cu5VkevdkOQsYH/ICSQs+OP+XaIfF8IEHn9/U7bi6uMr+2KF+B1CYlXVZu36m/LQil9ssdfmTKvLs9CgagOkWF3V0rY3vmGMAUR0OeYU41dHnOA0UcrA4RVLCu8G84/GJDdyKkKI54vFNQxHmjAAnO5LVFJhHmfOpfaincj98XY8OwwfYA6MvDhid67Kt3gKUKIi05omsg9Py6iot7oi6YctaMZJrOv15Zf/NzPZkg1jViz6DtATddjmlrr+WZjBle4MdQvIRlpyJb+N8ND70+Q532VnXkvaURCviGdZckZEXTnZNSEJJ5UPG/EawF74NT/g1GqTMy7jFQpmTf4obB4LFdOISbxDwlayAFhKhfnllSrjA42nYf/bzubVWjVnvPcoSdDYy0cRUkoA6TLdQbTtXbnPXNHDxxrYd8IOQwGwvDDFRJu09bEWJ8HI3KKZcOw1vLEb4K5iKioC53cKttTHL3HdU94gDWIpK4NpaWmI/F6cnI+KPcnZZl1nbcaBv1+wzHMdc6x6jkjVcIxx+bP7+5ujsZ6PdE4n3+nqbGrOypo7PQkQc9EdD50H9S81IatjDgJ6IMGTXE92bVSo2hTEcShZrRFhcFk5ykB0/gPxmR23e+CHPLDrkrk5MP8nRGEm05R9hquyQT9wFaRTvHzO9gwr34BynLVbmr4izBuN3eX3VMxnbAiYNUD9Z75JeaXC4PwZmjTaEh10wFo43kOfNRlCX+GLVQYyL2ocneqKnzCRBHFdPzIlR6bmo547LzjpMkcXZzFOtWA3RC7XNm1w5PQ/gVsm51q8cpJ7cRilE5ZHtNesIqrj1SU9M/WUEBYe/aGH4JTAt4E4ATzX6MxU9rI/hmYpZ3FD7Oj22xG4JL2KZu4G6Y+i8uMUG5Py5pYMlYj2k0bmVCZQxVuoS96vk2/VybSU//EfYsw7A4jS4ZHymFcgMcJ1XUsPeu67C/jKaXEjhBK818i0vH1C44gz9HXTxSFYh6fCRnKA+z+fhMrapOfUVL3BQzBkrx5MdSgYgO+QJQ8GGGN74wTLtKt5aTXo+Mqu+aVdb3yXwZGcPf87p2x1gl78X5mE7oOHk6ZsmNL5TkkGjx9Pz+NSBg7Bv+jQE2/5c5q8GxRqZGt6tWJuDnq9EbWCmHb/Q15JuUo/zJUZH1D+C9D+1FX1BwntDe0pgFrxZ/0MRBLohGKXbSxTRSwmQLQUDyMEYWvTTsnJE1QeNS5iT7GaL2ywhFvg3nfGG6Iw71pD/RkGpXUaBhGbOMdqrGPryyJqEMwRZPkhkZ0/dZaXBPuTozzMMIut7bdTWS08rk2CnL++a3Vnn0BlyXKY0XE+ZRXhZwhMNNpyos/0FXi/SV8e0PlEgW49r8Qr8v+jRI20ehCwAwKq3RbAiMeOflBkcIMKalrxjRBnkSrbvvTYLaApcbOHuraX/nA4d8IMGoQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 961713a2-9520-4611-b565-08da66ad82dc X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:03.8786 (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: ZvuR3O/65Sy7EDPIRhjIjY0WfZGwCed5TktPP8I7KADHDEdoO6UActSeNsK3wdImVEYlWysULvS4DGTMeeStrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB2902 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150111_575007_CF98A8EF X-CRM114-Status: GOOD ( 15.19 ) 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 Acked-by: Camelia Groza --- (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 Fri Jul 15 21:59: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: 12919843 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 57126C43334 for ; Fri, 15 Jul 2022 22:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v+LQDbX16RY7oIXz7/nVbc4uGcD9DRMnLwzxHFjLeCU=; b=mNn4Zef/q2y0O1 WGsVlGgETB9/CifEI27ib13are+RFIIpN1W9HA9uvRO/1kccJsQxMVAsZ6AUvNKnjwTSh1JmMcPMl pT9vzoP4ggUOJnh9EJDeGBKrjomB9nPms8xpJC2W37N2cLVqRgPhhYM9ldZYOkYK05vXg8nRwtBie XGT2Lm63mDnIMPauVHtS1/Qr059+hp/utNR5S2O5v0jUw0Au8ODuqgGht3wq8FFnKQlPJxdhWUAqc Nt/LLlHiZ/M1eeXvTGZYf6k9LmNWrlXDKGIqR3XmLS/RWNnZopMEVGarwbdMIe7CAKj3cxkf25LeK Yks8kKG7EY5iXcjzOmWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTcu-00Aidk-M2; Fri, 15 Jul 2022 22:17:37 +0000 Received: from mail-eopbgr60055.outbound.protection.outlook.com ([40.107.6.55] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTMz-00AbL9-A1 for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UOauI4paQaBkrROT14tChkw98Iduf6nhWETHBu8Y0qV8S0MhG9NoY/Z3fcGswS3a2e1IvLeCknLa/OhuqTVqMUMh74ASSV4EqmehSJ7ZmyCR99s7Rj5N24u4o865C/seH9V9Akzx8Pb5Sx2xhqATsbKqm75/pPtaSJiRRyGTwstgJ0ybZHlDnj0FS7CT4Tu3GFK2vFRukl4B7UsBYeSlJB1lvAsg7UAssIzDUxolvMcIiSea57p/ceZwjx5l7iwnPlDBJgqf4t6nUSdfrRhgi/SzuHval08zbmr8aLOUgPdtZKCRfGJXX8QALrNN6B5FQwejhbKrtxtJNTS5gErYAw== 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=KEvsSjrvbeagRjMkKmAVCAz6zFJII2vrzxHpSxVjqh/B6YryePln9FSuzZQB1jMyrjDO2fv1aZxwapE3OL6Log5DhK6iSQYPj2aQLpzu44fjKd6MFAgLGLqQF8a4T2WgfD9nAauLfTs1eJ01wzM63fbAVpAeWhT7xLUytqu0ox4kM1wE8iXnIMC5c31uGEFRV/bAE+05bmTObkrNJt1b2OR9K70YB2OM5Xk8A1IvyMJb4S1vMcZMDluKXdCG2fMAoObdJMq3uwzy409KApz/sQ2c4oFDMnhjPuS9UmArFn2sMsd9eV63bX3uqiT5BaZv/U5Q1CiSbbs6SMYQM+nRxA== 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=Nh3m0MxYlLfy24YkPZE4uWQnOcpQTGPuqlqQ47bPbyzxX4GFc95ewzKgKfitC7GH2+qEYVwS2BDpKtexvkOCyVk6Qx2TwoGzq5rkzUO8DvBJc17yloN5HWlFMmUCE6ksMhQ11kaHzibFPiUb7D8AJ4/wPUamgi8IPiNmAT89d68OwZK6gUJROT7Zzxk9H8W++5QWG1L0vaT7YK52pJ3GrV/ZkF8orZ/2lrS4njixx7hsgqXJlop1GGfz6khYqk9UETdXrZr9Ph7Th46GdLxHtwZVhufvvNS/nFh/Phc2xUY+6YXBpxPfrFDd+BVIUPdHVrIVRAy50Bv76LynNp8llQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB6PR03MB2902.eurprd03.prod.outlook.com (2603:10a6:6:34::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Fri, 15 Jul 2022 22:01:06 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:06 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 23/47] net: fman: Export/rename some common functions Date: Fri, 15 Jul 2022 17:59:30 -0400 Message-Id: <20220715215954.1449214-24-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 352a50f9-4d28-4ade-8f78-08da66ad841e X-MS-TrafficTypeDiagnostic: DB6PR03MB2902:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OE9QntMVjzBlUOs0SqTRWGWva01hwkT0nLXYmr7jiBCgNxjg614QPtre1qMPA9eRW/KQxoqLktGKUkPGH6TS2piiNl5Lnb7zaQUFx3IP90kY1QLb69vnsxnXYowtEMW6TIgmhaC4jslBIZBrJpR3AnvgjyvDd6xVSRO7IOG6khVIh1mALodCJNqiz+VBi/kPQdw8SzAEUf3YgTXCAqFaBZngahD9BnzetlhJtw+qjTGfgxdXfIikMDsorRpEU1Qa9DxZVh2jt908UjJXNpJ7+vwVLqffGS7eH7h4JfqC6btSDWrYyJs6pkmej32qvX1770Ssr3ekAeiaZka1PySQzBAQlYn7+QCu2rq6+3BHkyRFCc2gWmuwWPKvlYphrFDrgInT7OOSj0Y3D0OLAGptkaA13SVvNkg2zi9rXnHusufmr6N61GBE2DfoLFfTvoJPZc6RDVuqsJhrRmx9zbTdvOMldFEGmdLx+HU5XzkTRBsKPt4uwkD4hCZ7zkQpsACXutJbAQ6k2h0gCSgqVjVDaaDKb9Xsm0NQ+5WVBlpqKHkuPNkfZWtf6TvgWisBCM7py6J4Q0yCgRiRdyfDOGsvqOR1YeqDnIkwb2nykA+GFwyWfGkmXdQqAX2Pov7+wWoVDgoYSgeTW4QKwwSTe2C/feUAPKrdl0J+EJotgGVh1qVuy3UZowuZ9FN2B+f3d/X/ejaLF2e3L968Gqg5dO4qNs0XXCa8uj7tyRkm6n1peM63jmC3SStDX9p1NleOJESWhpAorSbOjBxTP277lHC9bZw09ZuyxAlRSSBhXA/4f1YawPbp12i2DYr21oU9iQaC X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(366004)(39840400004)(136003)(376002)(396003)(86362001)(5660300002)(83380400001)(6512007)(1076003)(107886003)(38350700002)(38100700002)(186003)(2616005)(36756003)(26005)(6486002)(52116002)(316002)(41300700001)(6666004)(478600001)(6506007)(110136005)(54906003)(2906002)(8676002)(66946007)(66476007)(66556008)(44832011)(4326008)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: txmS0BLZp93OGIsaSrJbU2fdfqNaHNsT+vIbp9DTPPmw+uE0jrjWlpuIQg2oQYG5llvrUcMrAEuPaUvCKomTALa/u9mRZG4JCweVINBpbizORGhIFSQzNJ454JKKLIAo/D9QVqBbMfK/ibOzV2eilYcTT/QQU+7FAgq5pFRUrrbJrnxLYSWQSal3FNXOJ0YnDQ6pN/+qclY+vH0VDfNKvUy9aazqMLmJ7lOJt2hN49quvWrKHbR42eLuDF4uGjT6ZEFZc5hMpMEqXPcMDEZIwt4Pj9rtI3IS4oHvnzgpxPuVZPeN6Z+0//t2R3QI91hs/ZWIUbW7bWiYjp4DHV5VRjnVR/qh7PPoD40CIS6JNT5OtYDWOtnGWeONll59VtYr7zlaWvT9fjdUtQkUkFAXP4Do+sgNWxOEndsLv9uMM+TElVZV2Q54XmiNTIfV9yylXCwbHFjRdGSNos87PDdRy5mHpUHY3VD2+vlImY4ypmBss1CmEnZP1CjZ9fcLSnEjyJENZfR441ig97VQTJI3d8OZzxY5crvyS8JsfynGgQwXR9aLKFHn9tuLh4SK+49RC4IRT4TcyGNqS5Py8L97qnumdJqBwiL6kg6HJjM0DVuC57qRecRttTBpX0BbVa2vSz2nV19tZiTJVkCJWBnPLfaGolEdn4xtpSWEHyn1fQJE3GF9rRInj8heWPfUEQj6Cq3KAAAdG0+bXSCi/jD6AF1WXb/4q9dMNicEYyggiGVer//ZInGQlypmvEdvenXr7zPa6X0aOfsZXwFd/rYc8wkoN7Wmy7MaTTuNY4oNxu25z1mjy+zE6epOmF6wiuDk3+d7/+I2jLZda8r58EYar6K2eUaJ8w3zF7wcOPq7QlE/NS//bL/64CGgg1vLaSWhKEz57/RGQtX1klQewlDKlXQ8OGrpi5TvZej8A3npQZSrlWNswUSRRTta3sUTtyWH3GzWK9bR8kIzf5/66Y2gJr5p/UGX1uIx8/rDCw2YeDU50UgIRgCng599YbDDNr2oNvWenohhohYFMHFmateUJZQETpCLFApymI9IHdKwp01lMoYRuBGFMSFostxOc/G5LRaSdA3weedzYMRqO8GsiwAWwDXleYk1V0Xe9EzM3e2foILc9m7gbcGvzxpcy4kIAfNUAyXnTg0Qg4PijSFAQx42RpXAnqRK7s0+AtFxUItlejhqM/IrJdHRa7ka2M8Fodxt4YOmw+1C16nTkb4sGdNIjKd3Yb+cMI7Y3vHDifEpCVQVJOen3aWrqUyyaNpmvYHHiFR9YuK6KIkpGnB7gSs31uPrrfiTStgVelBT+FLwMHhFQ5PdSa+eyzElyQsOGOAUPcQNMs1ZXX9gizg2R1q6OoFnra5MioSDRoLPJLX8rZFPwJq6S8CLhZstZjFapsHGSeAz7cS7LDsfqB9qm8FA/d/T1Cuu+w6wZZGPJ1UzaPtyG/r4vowjuy1uJnkAQNMZwNvNyhk29tw6aPg7nXmMcT+lpz4zjMDw4auxCAyW8vusqneLo3JHIttgSne7BlzwNSM/TGlAPCrABHvtpIG2K9vXVC+WTkHoBDV9EQDzr+/+gjedQbmLNCLF4GNypm/sAvFh18ezsAEnQZOMHw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 352a50f9-4d28-4ade-8f78-08da66ad841e X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:05.9879 (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: SYfGCIbFgXRysPIR9hfio23fQnzitxPSixakRdFhrpqx5OuAAcVNlSZddtAoRQ8y66GTu9Q5qWabRCKhzJZ2kA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB2902 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150109_404981_013E7CF2 X-CRM114-Status: GOOD ( 11.99 ) 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 Acked-by: Camelia Groza --- (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 Fri Jul 15 21:59: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: 12919850 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 E545CC433EF for ; Fri, 15 Jul 2022 22:24:25 +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=w6Oboar/L3w1LM jPIdB3oD5MFrJ8BG9ji2CBGawELgyZEgNKSf5RnAZzfQW6wB66RYALfvwJBaU1x3j51DPvTbfw6fh AUFQJNP8iV4osxPCdNOa9iOvp1kMNnHo3Lo9Vb05PLB4vN4zNwbeQEG9QbPKmtR0Q44MoriOy0uWc a3MJWXtVGADjA+b+h8+1AFh6++syGXAYhnqxL5+9+8oqClPM7stXff9S9+r6SYrY+IEz0V3EKZkCt bASSSGKSU2fLvBlZIpEYwE1dDEh2ena1S+cF76QPZqOfHtR2enJuA7YKa42RmkQg2/ArBqK24SY16 v/tECpZGLRS67ImYR6DA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCThq-00AkZt-6y; Fri, 15 Jul 2022 22:22:44 +0000 Received: from mail-eopbgr60055.outbound.protection.outlook.com ([40.107.6.55] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTN3-00AbL9-Re for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZX5qQ9s4NTJCBFr295bjIGsJukRWc+nQaycgFoi6A9txQVh6wBf/wxK42KKM1k8ck8ChDJ2fBLUdAaWp6y8dTdj9YTzVTXalhSS3uqeWyDHDPp7qv5A18BwVxsun6LjGeNpnxrkko7/Dk+jU1Yftb0/nhaEVWWVhMz//ToyYRifo6tRc8JZ9vHbGSt/uCsPUh8NIsq3o+0/F08cmXcCIjn2PhsaD+Cp6YE05Ba18hhapwXXR01bt2aFDf8c+6zhQ44kHpjMNXQUeQGO69rQXvXtKIWOxCDmdwWxeo7hoAWxm15X1b4J3zBZ45fs1LTsBRJAF3zXEpRXoaCxmpRzolg== 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=K86MvOsIt/oelAudP4ipuwx5dHAeoYk/okmDw3CDRVNZGUGzr1R5nYkrcnu0iOI2mL5PHhlo7rcjHVPOvDNjJR7OrcJbwwC/2/VWI1LhofGG4OrqQAge0CJy6kYFXRSEDsxG1IQIgNB5/X5BPDo6U/pGO4MeK8HI6TKNy04V+A7k/ojFaQw3VdYFXy9+yeOEcXO4gOeG0SwABUFtrixpZkNFRWDxn23BdYT2qhzkGXMW+djIjeI8cPAzmcKQUAQvpTyYMQ6tAXAoebRxGkjTYIyXRPvS1knciklG76hTza9lgocxD5gVn00FrwhKGexCx0eBKZWVY3zHMaKIsDtvhQ== 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=ozr/M6mMBcKYtaBa/eEMRUrRWk1t2/pmrsZ+BYVKSL9J/slMawrcuwWOrfY/86oggbJX4qhRYSkw0KsfCc2X5FuLym4xBaJn4iSht14vIAKzXVe5k0czZC9BjJnmOm6rIAw6i1eXMCafExJ9Ftn+MjcXDMwPkga1N2J53YbsBZRW/siGOmD9LyjmgcXCQCsX5lxukL1IxeJWbyexzt2mmTAsEL1XChJFvnLaj5iY3uTt9B+usrjVQwYGsP4BpvLm1Y4eXHY+zeldGVso/Q0kWBbsgP5dcwd+6gXeyFJRdqxuABe8b+Y7bh9li8BxUOI4zHm61g0phmU33ZGSFTOmNw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB6PR03MB2902.eurprd03.prod.outlook.com (2603:10a6:6:34::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Fri, 15 Jul 2022 22:01:08 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:08 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 24/47] net: fman: memac: Use params instead of priv for max_speed Date: Fri, 15 Jul 2022 17:59:31 -0400 Message-Id: <20220715215954.1449214-25-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14d9ed15-2813-4189-9053-08da66ad8567 X-MS-TrafficTypeDiagnostic: DB6PR03MB2902:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gjr3X0PcLhYy0YZMKAjxL7/9uCGnUayvkOkoN4wRuAZC0p9lDbrhAycu0uHx/HTipcGoywcJ4nov28aCJvDO8q48j85H94WlECF431I9jfQzHy0dn+8ASuMMcCa2ud3dVT8n2IrCnuEKxXFt7glXHtfRGXchU214KaGabE9UVrNhlrJMiz7tMruU1wzUbCc/rmIjLF0HT9wDWgm67S57aNgT+JQjxca5tLD6/Pl9KZ33yJ4mXgch4JbOUp2+F2OO+DRZY0IKJovzjtsNGk5cA3As2Y1wzVAONR8iOiRU3elPHKhcgBNfUxUmS1TfwIC2e4ArljWAk9WGtR+U3shvqyc6VGaav838hdmddwDKmPgnToVUjgBrJIR+tQqxRzsZym/XTXFNu6M9zLkNXgQZTCUikL0LJoxOEy4/44GwV6yqA1gGS0Z2ryeYJdgn9CdqjlC//PV7HPMSCgePRPuk43lhk5qH8VnGX6l9O7tdJSa9qqxr2DqKcuMGUFxlxC71R7zz4ION2WxYW5ZCW8Yj/FqElgBL9h6JFuvabqucCdjRX9KQoCrodRxtlvfsVH6dv7SSBlWA0mMjsBuK4GRgZk7pIP0ccHsg7Jxd3Ns2mHbW6cXZ/jHD82iXAnmee2UH/sKG9pEdADNiiCluLk/PtwB0AK9lq7D82lyLZ+wj7xtqWfnaldUEOcivZzDY7tFJ9SjQegQ6Sioljf+R0kRBJjBXPwMj2Y5Sy6JtTPZq1cptse2cTik+Pu/C14MVApnAkfKFf6CFZ0odep+FFN3GO++zAFc3hlXTFSb6VxpKb3nbCUcwxkIvYWKl/HpEqYnH X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(366004)(39840400004)(136003)(376002)(396003)(86362001)(5660300002)(83380400001)(6512007)(1076003)(107886003)(38350700002)(38100700002)(186003)(2616005)(36756003)(26005)(6486002)(52116002)(316002)(41300700001)(6666004)(478600001)(6506007)(110136005)(54906003)(2906002)(8676002)(66946007)(66476007)(66556008)(44832011)(4326008)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jJQaDf1qm1kc8wHsYeFx1/cle7t9CPMOxCPpD/0hfwBp4svuLU/vJSZZOiS0WYL9nluvfEq+XWDOG4tbzBHOM1cMSZ/NjDeRVt/E11OCHkdH/uTXFhgSuoUiHOnAWYLwGS/Zn2VJhmjXuzHOSXr/4UUU0Vvwxst8uU9cZYodllerTKT63Ys3CYN+dKMSxA+xJemHIN/AebOIRUzAmjLFASN2rTaFrsNC1KqcCmJPNHU2VTwTm2VYPFRuJfk9z90y0A/xIY3bXVWiDuytJCRmtLdj2zpcSTQmdJ1uf0hDdxC5RpjUFCX5fK7G4S+iQspjKXnWZNwnba/XJc1ic9mOXGSPzzl5sw5IgvBBXT8BaRuqgj2xAC/xOhg7W6L/CKyyfl2z7JwLXQrRHXc2PYAJg2UzI+6UZRbC4E7OuusrQ1of8P6c1IW9UE+IYratAPi0MMnsB9YRl9QFQ1RgBxIRT7B//z2ijbt4fmCmkRCkwyxanM2wE1M5Irvv1WDjHMwXgfIGTuV5YuTEQVcfW2bPODWCDWUzK2M/xCKdVTV6lUmkRfnvDMhA3R3ucPNavhqtmZXRyJmuru8r9pFhYlytP+BPvzDhlcH14DwIWILzp8rLmRdBBcdfZh/9rwSD5ioZAqHxc2+wUmPW7HRgetsKhzy7zd4yjsX382STvbAV4idEVbZCHpHoVb96WPT2rfnuRQIP6MXmcl6+4f69nj/6Ob24oYaoPOVdkZknByzbncMBf8AYkULlowp3x8e3Vv2I9aoBkfId/N02j2Eq+LiL44XftDTAmKdbJS+OBbByk5HEUjf1axcrgec0nYOMwVQKil374K9bXOe5fjACogYDMVZlM0XmEh/24bWhEWNjszIDzT8pqRtxztfzuy2iO8NZRGWBvQZqD/I6aI1OzS6fOOypdaD1XHq3/BTVIk0l5XBr8pvCgI9+yDZaFmj35oQrlQzSk1cA8zWolPf2v3Q5huXqvy1QhYhaNrjDpxYl5F7lst9NYUI/Q4BhtK/k769IFVfKPCkqeLdCa4ZM4oSTNa96L2Cg4nvvmc5B204+3sA+FT8vsnLwgoxit3fnpArGS7r4hfbRNoidmT7shzyX9RC0P/8Q0fmqzutFfEDE2rdchAZouzm8hMO40E0YezD9VcoOevAlI2W3MGoGYhVEYaKQNH8JPyR+AKoENNEeqPUSwoYOGGg7y09u8JUVuNfTixdGDcLOr+HtoW+L0LUrPO2zAvEU4wut0ix2JU37C6BEivCF48lNrKAoUDMXjsvppfNLfYzT1jXq/NV0FeDj9fTOJ2VvizQLt+wxHMtt2FJ6jxIZgxEMnTWh9X6FU4uC5vzSLcfyrZH+OLvepz6lEDq6gR4O+OZrgnkgNQd2umjnKw7Oc0dBTUWF/+y3T4OkLM2ryqeHxf2oL2X6byA4I4oB6sHyq0lOWzAbGlyz2jMk4mrr2xogq8/KMf6tExRJC9Ap4YjgAR5SIZaiaQrlkiKHH/R5ivljhsdLhSD1OYOKC4kXVP6tHdYesPlfMBmWggZDVT86TAgt/boXDtACjdDbR+LgxevCIEcRSr0zpi6Stp8+/p+V03va4onzIXua8pHikMfSKUmTTmHXnRu2hA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14d9ed15-2813-4189-9053-08da66ad8567 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:08.2066 (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: XAF2TcUkX559nK/DhwigLZvo6yrn7/T7zmaF1Vc7grby1VWlXdexN4gSOiWtiDzkCkf4Ki6IkloWhbKcVk+4xw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB2902 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150113_997490_139FA3B9 X-CRM114-Status: UNSURE ( 9.46 ) 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 Acked-by: Camelia Groza --- (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 Fri Jul 15 21:59: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: 12919852 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 3BFE1CCA47F for ; Fri, 15 Jul 2022 22:27: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=aUoLCpOqr4zRslfcBoO/JEYq5Ed3SgLXz7VBKi1gMTQ=; b=YcQBbbtgC4bpZD SypYp/59BOmOQ7uU5+IFsQYDxSVrCQRfWKm7ED9dVDKlFuwiizO3/oMWqXHN1JAiq+BVRAM35AUu6 kysjAq5hpKNK+SKYIGCBBSwMVFrxwPV1A0xNKG6+5+BfbM0ozBOcLjri9oa3b+mnPfPQerYPGzvs/ zMkVfEnJ0mE+YMeuULHsSC00+eLQB57yC2xngNFXOZGzfLCxZ0d3raf/LbTPfD4h/SiwawRy5es0m EsV2WNWEbPUamZ1PtAF4c8KymYKmYnE8PBmmyzhiph9wSDEPi/+SKOYDvjwoySfLkj7hOv9vWdJfN LTrLwzhdbFa7EsPf6bnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTkj-00AlV7-Sz; Fri, 15 Jul 2022 22:25:44 +0000 Received: from mail-eopbgr60055.outbound.protection.outlook.com ([40.107.6.55] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTN6-00AbL9-1a for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ePqbCmwrNbiPTOF1ZzygIx3yc0cyESffd0h18VZRNdkLq7b5McRo2CE5Dxt0FuOIYK7xremFPWw9TUTsK2yRaEPwwmEXMNVkIi8EGqELH/1B9ixR2XzKDjfwT9LK83zZC5k/homhOhL7Yh05xg0GxNoPvRCRnH6Kz6QCkwfjnX/88obCuZakYMPUumpu5cHCxNm+m8iMuQcB0Ptz/Dxa/zRs/gDFNa9YQgQEGuBlx9ySqium9nH3NwUK3DC+KA4KZWl8C9WkntlVDugNKIfnoAG07bnOmg5XUOybxqkSnGyOomkiKzch4nupxGY4tPVl7y6dauyOx1YXKyV0TUoXqA== 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=NMzlR5vDKgC8kRYgBn01IKoRotCxFTRRFHe2Ty+tqnI=; b=ZsMocA10F1cLgOFOcNtrlzVX/X24lKv7PVtKrqvhnKTyEsrn7Qqq+QKIUCSI5mTmSQNRTVnqUKz1WxsWbreqO1xc5HcEx3mZloPGe7DxVeVgxUTfLUyaNvY2YY0GtRFr4Og/txcujJHOgGhsTglpK42Wpgs4ztE0owwFJZRm2MMMMXMZ37qzHfz+dyRhpSSYNCZdQzrrpu7cGFiikXOTrUrSkkBc+l4eGFV2batHTYUv0DQoSiX+3dToV0vD6Xi5ND/f7YlVcPM5NE6vUBqYxz2wcqhCCxHnkNZVHTJ6N97bgXj4undd2JL5ctAotLwwOcb13IuAluGxZkCf2Tp1TQ== 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=NMzlR5vDKgC8kRYgBn01IKoRotCxFTRRFHe2Ty+tqnI=; b=Ml7mIEkuEZUKR8w98bvg2214+fsOisqhpzu64ZLqcouQxGhdUMYU0xl8Wn5qkxC+qJH/FRUTBzvZ66LeE4KYglQymYdaRvjutdeHVQWfM8ActYu7ggLHw+P04evOuSlKcNMGK/S2Gj30+ZZ9ClvpGJnqA3oyXuwm2a0Q8AF88NzErrnQl27wOyex9zLQsiErh8XE9636fxP54X1uPPyxj4Pel74g7VTE59sMihdqJ++Wukg6m8qgIEH2azWm3IuzAu91k2023exF6/wLv6oGaCH74ohRzsgXKYzQkeXY3LihIGM02TAN7IEb2H2tShczjRB+0uN3POZW2XAYYDOIVQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB6PR03MB2902.eurprd03.prod.outlook.com (2603:10a6:6:34::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Fri, 15 Jul 2022 22:01:10 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:10 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 25/47] net: fman: Move initialization to mac-specific files Date: Fri, 15 Jul 2022 17:59:32 -0400 Message-Id: <20220715215954.1449214-26-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7f7518f8-29cb-4a48-ccc6-08da66ad86ab X-MS-TrafficTypeDiagnostic: DB6PR03MB2902:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ujIbEyf6T1CczKGKa/WAJnsRc/8CGH1xTdn0pa7Qu/R1DCA1aaT8HPHwAjZmZz0/iVSN+BEIW8Bq7jYY1SIl8OxpHxdxv4bisMG2XVGRn/74HAuxg8F55SbYVn5G/jaGvgM+r1qcp0uJZz5Rklcey5CynpG/WxyY0gw1N/iFucl0CGKJdkvN0hev8FWo5RKsDZrZEnFe6gGCco+i8lsFBP1bfYdyHPi10+DeIzPQ5VBRKmRrzpqZ9tevxrT//FSuBgaEsbM0VZ5wQ991FEQo6Ei4yAAbRVC+RjiKIfW80G+AXrOuROaImMRFIjM43q7PcBShf192LX5WoITwlPgEU2/b87QlaYrEB0Y/pDstPvA2zPbkZtx0Cukmc8aIrc0XPachQIskc5mbLVMlxBqdqLQqYq0+/+MMLkbQJ+nQbhLYftSYMn8ws+tsZ0y/Dgo/ZT8QLS1IrDsydVXzzRICHJSSnYK6RYwDPgsD/4cAnQO/OHJQson0GXmKddcrCAYxp+VX4FZYdFX7/GRnUsp6KNTFp3i7nhEHyIsU+m4zuU38AOctvD7UyqPP3C/v/1GDDmZjr7eic4wp43tiC1b59Qv3ROKLoScVw+CvBMeH3Lqy5d6H0BD7mCZRx436qqwFqK/52475fdavV7DObD1+jaK11UZloEMs5BBpVU2ijCCjmnseOXP0ruAnTo+eZjtWUP38PiYiCE2yFz/keD4G/e5wYmGY9z3Gv/8L/+ncwjwDkE1GB5NaEvHQ1Bn+zpFyyfoc/j87FKKmhJb4AKPlr6+4qQukM9n9s39uRojd1EFobg5odbGDsCbXILaCsPkO X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(366004)(39840400004)(136003)(376002)(396003)(86362001)(5660300002)(83380400001)(6512007)(1076003)(107886003)(38350700002)(38100700002)(186003)(2616005)(36756003)(26005)(6486002)(52116002)(316002)(41300700001)(6666004)(478600001)(6506007)(110136005)(54906003)(2906002)(8676002)(66946007)(66476007)(66556008)(44832011)(4326008)(8936002)(30864003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o+uPMJ7z57gYnANDRKdVfAZK2f6fbd5gkBvmnwqmB+xmfaZwKNRLfqSTBabxzPV8bbWa/epCFA/kEfnnT69wA2p+EvYnrMiMcA6hJVAvpNCwxl6trih86Dn66nlwKmjYQywdGPcysashol4QCwAg8yjkiVZtRpeB93yBH7EyUC0c+m/ubAqaq8MS0JZwDSRFKHHZQRACeLYBfTWiOJDH8DqRpAqGERFVqwiAdAK5FG+xsYM99iL5jD7e+cAZyMXCcOdHPyCVdBSC22HywOfSFGNcTs5IejuQrtU+tOKSWdGw1p95g3wfdAdBKP18/qd013SUbgl/EYDNgILNbAmShgFBF5qzlWLNVvmneRzg19AWfeKbiK7ZxHmV8xU5KG6UGimyPkxSz+VA8yvMI1pNefG8jVh+H1c9BLHuSLQqq1MiPO9z2CTY5aW2E21ekPjY+HZpmvGT3ELqsFNM1UViOoQgq9cUqQh3Iyic12GuZCPQi22oBqvWmLj1v2QKpkPUsTkWG4xe6zzIVCkHkgZrQSnARaNsMsHVwNraNlgdleD+IT3X+HEq+eqJh/rsLwxPgmEiVeKksbd2O+pQLuE9hCiz5qtj62dcqiFekA0mHJHB68IvMXgS+z4SJkpFYMu8QAjrP+VS0AeI7lPzdZur/10YC598H4tE6ht2TzN25EYegebreBVbQZpwgPcpD+mEUlru6tGQdzaQ65vlcKdFq3lpa2FEIvVy/u7fP0A3S+cwvebA0BFihiMYWbqKsOom/80oEBRRATBfrzi7q+BuQ2IYBJ4V3ac0aG30F+on+HCKTaPh51KGZf2VDSFNKB4HtQwAv2txb/syIRCVP4Xn67KrY4kIJCaSHATrWArUJLiVmPqoWC1vRQUblghT0nP0QfrFzAhUBirYPoiGGgXCz59UQIbiI/SXiqJlUx8ZldKv0Ky1BznurnIUIIr2N8WrXxGiMxs6oHb6qOQn8migcQ/VySh1ySGlDsB5N4oRCXYkSASp9FdoNLN08jOkAieBjcNwCuvEI+3ymPDf/3kxzTfs1murCjo2wYl4i5SKsL3e6dzuzWWquCqCx31wVFqOk2rNl7z6zq9Dj0mF3gq8JS6Bv4JnWW1uynOhgICrNjA5AD7PB+HeFq4p6QnphG2tCDjQs+7NsPT6T9Mwods1OYDjqc/sfqZEgn/k+LxuVaNUC3kgUc64eeSpQFhcOM7vLwANjdmefOWRBFfbPvImbaSMN89WK5LtWu7JCHantharbelMdr8MaXOHsmmYNv7Y8kbEv393Z0kyNNCW1rMgUDCh7ihk492t3b2G8Uuii9h1FbbzUvwXWIw7n57DvvFlpO2MbUzdbttfdVbUFHVyc5qcE1EzZIcvvvfdIOP9ZPWznsXvt2aJWGU3EKVg3pA5yNmm7aHaoTzgfA1AME1Wh/mNf8UZCtUes++X+brZyTc7cSroeZCxV1E8QwrQg3oYXVpyD0KIHR+v5S0kV8E0OXqK0tfaZ+jQK/7dd6aBLbquVpNOc6DPcBLzV1gE26Jq1dB0SPnLkc9lKbXsEWBZlxNOJB7I/clo8mTdG/dDcScGYaO0aR1mU1vjrvhCM++Y58lemuGiiYjrFo2qER6GCw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f7518f8-29cb-4a48-ccc6-08da66ad86ab X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:10.4408 (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: Y+pAvIXPhZdseNvifSeqs/t/d+NFC5ajf4Uzcn6PxasQO2NMj8l7TOwIYqFqXbQSaniRXJvgTMqlJ4j/EIoqqA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB2902 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150116_205746_330B6FF3 X-CRM114-Status: GOOD ( 14.95 ) 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 Acked-by: Camelia Groza --- (no changes since v2) 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 Fri Jul 15 21:59: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: 12919853 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 01BC8C43334 for ; Fri, 15 Jul 2022 22:29:54 +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=Jm4ynI9bYNKQlN OOGlpejuHwBeH47Tul3SQS8ZZS++CrD4KG0+7AMV1m5KGPM0k2Ygnlvxo230U3+S3OUK5WI7NNflk 0TnGUtATtKPJfaLPNSKsfW/OQ0gNFHLLRIai9sEZkq9M/AxwpjqNCeJoYLIsk+9tNOtKJuUMYzpl3 c1oK+HocteSlA66jBRMghWZcxoCJgNDQFUS9xPwgVt7DRannafThMrIP05t+neWfygdIvOzDymYZB gUkzIS9DEJsD03JR8es+0ziY8pYRc+IJz1zkbG2qaZxQr1wLid+GOsnZWViOmkqZy8KuiUeeafZYW eYvOfPrzoUvKoCtQ6N+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTme-00Am2z-Cu; Fri, 15 Jul 2022 22:27:46 +0000 Received: from mail-eopbgr60055.outbound.protection.outlook.com ([40.107.6.55] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNA-00AbL9-1J for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JdmqnN/MLfT2X779bwbZ8NZNx/PdbccqLRjz0ajquAEUOTLCeLmB7wD+QBSfM5Nsjk50s2XwprCzl721CF3H8wj0Z+9GwDNZyFnv8+zMc/QllZzPDWwfPknFwaQKNvD//8191eFl0BPJQJY3oxt/C1bMDHnUoaEUdG+nGqF13Z2yARD+3OG50Uy9sohgWq79+ayiz5FOhEhJXYXbv3QWcL0MKT4zILgBmC5YrZvBitp9/GzdTmIcp4YaJl2vgp6p2i36c2i2EZ8ZezpPDPBDTkJ47uXg4DHscFOD0qfYFgZlhZ9ml4MLRdaXKLlv/3J0ticamhqRhZaMbGKK+0a8Lw== 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=FHbSVK7NgNfqiJcIuWQcU0hAc/HZQ6WxGuMPiDQps3Zk88xnjSe9PG51YWVUDU29iPR5T6O+oev/YSf2p7Jt0SpshNW39s/768xuDDqRmjX23DTn/1sVVFcfPTEf1y8l7aB2yJjnsZS7qnsla2Ii5gLoc/QOeRYAxmtrc2MBiozgG9gsU4iChKKnmh6diOBVEsajAHF+AbVWeTjMUvRihJ4I0EtP3tN/8+CaHs3yalLxDuq3ZAPcdcX4jXPBU9rbmXNYF2X+eBsfXMWh/7HS2dXwbLzr4pa6FaCNcIqG1BeNLIcZgXDicSCdwkHOOVFy8MMX6keYnEUnpc/nMFc7/Q== 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=mLcQO8zwobECmCNbUGWqtmvT0XZKmvabs7vW7ck6lnVj5CYXVx475aTeyDaM2n6vmuyCBBpdzJiEzyaP36k7j2EzI88tLB574/oQHu19S0gu5RuYRr/eTtVB9WZvplpY0FhglyxCGMDJxs9PpIID5fCZphGdpUs4dC9wCzYQ25wpKgxgMXw6Wto0JzAGE/uA4LBcf1nPmQUjj/f7PFwEzvg2S420WX7HnKQIgia8KwJjmR244zuOyP/j0Ci3STFjlyRV6YaJFivH+HSlxNuB8WGldZEhB3RGX3OJfc2CSLofQnwffDMHDXksFkqlrNvw56S28gE3BSPvRhl19tPk4w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB6PR03MB2902.eurprd03.prod.outlook.com (2603:10a6:6:34::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Fri, 15 Jul 2022 22:01:12 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:12 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 26/47] net: fman: Mark mac methods static Date: Fri, 15 Jul 2022 17:59:33 -0400 Message-Id: <20220715215954.1449214-27-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7c2c91c1-56e1-4035-a4cc-08da66ad880c X-MS-TrafficTypeDiagnostic: DB6PR03MB2902:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CuSXjYXPyAsINzTOtwNsOItgPTLsbwNIeM+Eow4d8gj+gFxXaz46zpKnNEOS3PU7vJNyv8WpkExWEtURY+u3fQaSRykSe9DQpJuG+EDnqEX3NiT2dK+rbIGSu6Tx8As4yQ7JZxqeiE0WFKxE7Zn/p3BaAEtrTznJde7KM9VAHDi8am6Q8ljwFyTskpHMWZLrQNc+vPS8q2Oe5y4ez0tYzoCe6bL7zqYuy6XHQFbWrpxB1tSIW5FyYK6DHheTiwIoLveeFUfbvW+CfyXyrf4vaCY51h3Bx6Z9yLkXsFprCCtB92vn55vxREmFO997mj9KyFSSHSI2oFWAvhf1TtozJVv6tbMCkj3MXtkHipMR2qFbMn0UAKm8BERCzoFhpwCP5fzAyDiUr1EKUmYYN5DjVbdx0ZK/9Mgkxtchfc42xuu/Pa6pYGYRByKjbjpGAD+uUy6Xl0sH7Wa9SgPYxlvSCPpsvfnqY2yv2lh0EKH0RlKCkvQ5WOh50dNNalT1kdpW3NeKGheKa/Hqebk+yzLqPiwDiea4dfScsNFn8BgGNsN6dIlfPb4DgNW69TFZHZxHVdkumWdg2SjNj0znfoLeTVqNkxU44ioS3XUQYMN8SMPDoSdLcvo8GcgbgGAekJhFfiLLaSi4k0TTqk7R+27ARCQPsxAjQURBKekuKWG8iF74GpuKQccDC0aqlo+EaB6O6H3LBB/a2S2or2W1WWcaDg7M04BlL4xoDBciIv5hsgUWJKz8qpUptXlvDe02n2u+W1DtXQ01loZjA83IQp90Rjh7Nt98tEz2HM+QsESNePTxt6bTFAP3hrdd9NszxKRK X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(366004)(39840400004)(136003)(376002)(396003)(86362001)(5660300002)(83380400001)(6512007)(1076003)(107886003)(38350700002)(38100700002)(186003)(2616005)(36756003)(26005)(6486002)(52116002)(316002)(41300700001)(6666004)(478600001)(6506007)(110136005)(54906003)(2906002)(8676002)(66946007)(66476007)(66556008)(44832011)(4326008)(8936002)(30864003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zlKLsaD9p/uI2hlJ4dvuxftDPfk1p7L1mY4tk43fp4Dek/aI7RWLdiik3pYxBUw0UU2/Bg9NH9R4LMCyd5RzRPXXlAA1OdmUNgW27T39vCZ0t1QCJD9a8KxVn3LoQXF2KfgPWi3POcVY4fhpdRoaOJlzzw63roMVyX9d+OhhGNf/0azxxwhk16HOurAlWg40ADz0F/EJLHlmghLeup7S3wxUv3Ck2ulZo9zEtamlq+oyptipmhlgJf3rpbzT39wGFR9qQZuEAm9LURptdRRZAV3iaOE0IVEfRpcAcazuVyr93WOdU+EdSvvPr3k+a4bcsZE1RxhZJP14z6+Q4aEsPYavLsbDUOvAE41yca8A7+Vbg2pRwjx9sRJQjxxkd8FguSG1gdP9eSkR6LACwX5yxw/hx6betk6vU7mLlmMeHi2ZsFNZqSOnErzqa9Wj2qVkwJhrfEzoJFnwnVLeyXyk0tjprWzmoBPAqxem/WSU84BLSjiE04t69gkuvpmv/WOLyjaohCa2hFmhNo6Der6B2o/MH7eE8XBhvRAHmgOxINDCmf0fIkUo5soE9AE1B1y3E1dWMWN7dQ+iihEZbf6vLGvoZd/s7P79UkU/9tXeldmJeYaeDfzz6anZNxv5xkLVjS5QUEAlWjW00dmUs/zLkbF6hQOMEMfpuUbTUUPksvprzPVFfv8AhKCUNnv1VM3MQdu8K05yy0/5klK2/RtvIbaGfCzrXMlfmVdDiDt3Ax661RWhV9Slrt//VR9tNUVltKIDuKH/GiwnNYd5jp4mCSHjm9KJ10CjbPlrrWxONSXsi8p2ttyIDsyCgV/Fk8XFr1cQpL3ZgqlHIWS5NlT/jVm2jEYjQKL9MDIecL7eXboEoFeyEtH39rPs8UxGR1sQI4bGnZpO/9gExv3KP/8aIlgsfzH9VABivqwECSyq+c5Wsz+raa7mgOYlqMOkNJLE0leLubALEXLzRfJo5kxGpBUc3VNFOkM37BzXss5XFPt9Dt19sCjYmKRtYCqSTeNPB/DvyetP/fyfvyyfl86Uk2BMybfrwSRFsUFiMNNvlXZepfmoszSfpXYpMEDUyNcfa16KP6xL9YjIExFFv/GfosxZqNz9d8zXoR09yHDb5NPM7PkEpDvg9/M+DHYOR7iGjCrcaBAPC373HUyZkZE+hbLRtua2FQqnpdcKsJuCpLQhJerfsY6qNXpaKhTNI/+pPt/UILFq77AdAuLZgSSHKRO+eGg4fclR7hYf94tT8tckSCOg47Yj+BrKfBmXJwL2puwExjYdwiASVn7tocCHPDrKVLYDkxsECAWV6fJ5WJ+Ifglvh/au1jYX7CbdpgtkvgCa95pgLMaGkJTjOCvxIMjuns+cWgdaHLBvaUSqOmUA4yr4XhX9s1N1ezt8w2SbW6mwI2MakKAo4PeneUa5p+VFU2YjFwij2b9ToBXH5ynWGRATweaJQkPvYQnSteOkEgI+RJfDdKLdYKPxeEPBpwwUCZHWVqdbLCBpimTm+UQTckWXCfHNAqOyNcoujRoCOISyjAPn9wHsLEXlsKpVW+RudB03bdgpyw+7iaTTUrfOuY6iwodzVEyhwuaANUex0ocim95vrNp8uFT3fqlsHA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c2c91c1-56e1-4035-a4cc-08da66ad880c X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:12.6595 (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: 7qVDGWkMw1rrGFU97PfmGz5U0KnTggGnckmQ8sxUjjAmRUBVAnsnivCFPxJdUoLZqMstzcA3BJc7k0msWca5Eg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB2902 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150120_132218_55AB5272 X-CRM114-Status: UNSURE ( 9.39 ) 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 Acked-by: Camelia Groza --- (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 Fri Jul 15 21:59: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: 12919854 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 2E5DEC433EF for ; Fri, 15 Jul 2022 22:31: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=snSEgWLW2nxnduBPe1uqwcEAj6UZeBFuCqkIlRRlCq4=; b=rd+dzbGxUE4hg+ L7K3Gtq4xkttL7aXi+yXqYspUuzkDI3/PE825/kREDfCgHccO+SXgOzcftHhLdjpy3t7L+2wQgVEM szFfTYvmvjaXjFHUnIhnS6Ohtxz4vt+3T2PpcIZt2PAGcG64+jOxNybgjUAAoCJse6VGbmLtqv/jd KBQ0pPoE0bXx7BvQJAyBdZnLP5ARsj/LcYg/h2daDlCRhKnR21hQbkqtM4pOWdUG5wcbCkjUo8bCE H4n03S0SZQ/QwPm9pgmD9T7BB95rgVAhquua3rGOU+g++76oh1nM5cK4xipPLRLn6ez4QXY018zeB ud9qfghYsy+kvePkAfrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTow-00AmmZ-F4; Fri, 15 Jul 2022 22:30:03 +0000 Received: from mail-eopbgr60055.outbound.protection.outlook.com ([40.107.6.55] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTND-00AbL9-9U for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OruaT6+gWP3FnVEmZw+Nwyk7wwCdSqlJQHRXpS/RvQjUwWUAwEKn893k7f9zil7X7jFvtGNIQ/lV+DaYuip/iUvObZPU86CPghbBFpNGM9y0Rl0w1N88YXUUZIE0joFMB4OwfWVosPThEJkMjWaYhKTRgpQ85fAk+hmdF+JvjrNrkZgZJAfEgkM52aS/HZ0pdgMqy10DuB+3NfTWEmbQLF16V5VVJV5R7uNT3pSxgk8zqMQHtasEr5zjkKPoFvcF/53Dzlpk4LvJfVJ5C/hXLrcA7A5S4YrR3VnEQDbhmdHbnIcXBucb4OMMuI8AsEEy33DPk/Q2S/Nret/7ukvsvg== 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=eaiXxHmvsTOYjMKby9Eqa9a3rwk+P9twm7tG3rD3sScbjwpq5Iq/j1sMurZHI161XRbEjcOyNIbMVb8sK8ppPTaCn1DBXECovojKJXcgXzpom7b5ABU2JSWAQQwDIWXOSS8X9xDZuNnqA4ITnMdvEtDdHQ1P3BTwqyXM1HedvZ7DzgHQ4QtOsKh7yR6/jpEFD7cMduQCQVdNWIO9sdCksNdQSPHbPBAqHqJHZ5dtHjr8eMJrL8kd73e/0iwvQMl0LMIkxbvjeMtMTevDm6nvqoOy6suX0sJsBMHZtClOnnSGqtO+Gslk8uMfg5qbdA/Uvd8W0BSq8e5TEeEunOAF7g== 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=IZvrN9qZ0ZD7ATSa4UJmuCGgtK0Eho9Mua33/ZuRHmldveCCCOhoD30teyXqef46pHzpIkk5jhV+mI9NyYNFV6ylwFquZoKewomGpk7dw03xA5+Hwe3AdD1vZvdWPFxRnA8jgerv1L1FyktP1VU6XnsN+QA+2hbN4nLccJDLYqZb/tJMNTBx1m2iPCc6PlEh15qIl0l7waoltNWGaV4NXjZOJTrDr7Yp5yv2cSc/5JKM0r5NbNGN9xi96MRl4ogUIhZ3VfhoMuY+XBpgMGtIqQru4o1H2XlV2kPnjQzprQ/A0Ps3ca4X1DSCC2lPrTPsndC7ylc1sp9jTTiLNqP/3w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB6PR03MB2902.eurprd03.prod.outlook.com (2603:10a6:6:34::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Fri, 15 Jul 2022 22:01:14 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:14 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 27/47] net: fman: Inline several functions into initialization Date: Fri, 15 Jul 2022 17:59:34 -0400 Message-Id: <20220715215954.1449214-28-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2b2a055f-7a3d-40e3-0819-08da66ad8958 X-MS-TrafficTypeDiagnostic: DB6PR03MB2902:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C42+Y/N3L0pFJ1OhRJOwrNFjVievITWv4kbr7BYR1zRK+dkRZe/8DFpC5e16HGmCRCMKBSCOLsiTfocVZGMzTI0rYO8b6K+4R5CAG5DwWPDYPAfPk5SQW+lRXWalfB5OcXjhADPElRWgFJGwkGwiOfv0qPcamaoKyjVXaX613UAojOn6pzxi653NOY8yO4GPCECJruMn4x3sbl1XqE1ANPqxfzKneEX1S6R9LKSthxMZ7ZaHch/PshTBtZPkQ0/wPAnqYyWuM3RakX9PLRhw8w0As/TAUy4qb8e4tWsOJOqmV381Qmj8J8hCi6G+szByFcQxiPRVx/0vrgFazAGTPZjoNmiMrWqV53nc2d8ZKxiXOqXkVA6NzbMUh+yeBbzfC2Zb1AlJR4MDhpY8TrIC4cAX1quWNl7p2Xld0Lwu05LtwkjUQmiyfQcDK2FXrjWCEHNVRgzsP6pqJ9p+Pce1CykOdTcL8QMQacTUqs9fYLqE+KZ0L/HQ7oXLlo5cqQfeUwqdI1sEDmnUuvc0XBbDAl9YNMz5p2ad/xWzhCC3EMbrcLf9HKXzu0yAI1CifvclYvhhZ34r8/NPV9LL7+rdQaUxDZs7prkysE7opvkiT5xOxgSHgn2IoQcxMIeN9WCenglnhNZCCLB23/w39xFa4RiPhjyreFkM1N01CFV7Hzd7NtRYhYqUgAQCGqnuqy27eNoahud1bGmyQ9egOggkJX6uR39qEaS2ZqIyd0z0fxW97A3m/supIqLDvoF3iRsEW6NXwL0LbLdp6pLcBGqb0qDGS0BauTsD11ZstXLTvCEgXE6nDR27OrVMpLrC3xFv X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(366004)(39840400004)(136003)(376002)(396003)(86362001)(5660300002)(83380400001)(6512007)(1076003)(107886003)(38350700002)(38100700002)(186003)(2616005)(36756003)(26005)(6486002)(52116002)(316002)(41300700001)(6666004)(478600001)(6506007)(110136005)(54906003)(2906002)(8676002)(66946007)(66476007)(66556008)(44832011)(4326008)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VmX1B9V4lEvLkOZNA5cPqppNzbSoxG/Y+3qZhDsvVyQoCN0Ahmu2WNAGl8n5R1+LlMWKVZMWfompicY4gKrkcpfTc/CjbbPCx2eMp/2Eh/y2wSulEQs92hLYEkADfvmVtFmmDNBLdzycNF79/kUg3E++b8oDNZiYRFcBE2can1Ro58KSP63y/Kea4xXB9ZpEZwv8deYJ+HYiYGbV7SoCVUJAs1K3TEk9t8yjfY/IZ0DO7x1T8Ho1bGZOxHcYq++wgVi3D+5fs+Mjnh2pgzvhjd8bEw6DTgZYUIVsEqeJGZ+SqR5EyTLHpr5jSSmVWexT7B7szyY5hQ68sUIf44+jRx82JzWV2f1ZYzME+PJSNVpfD1E7+wUDAeB3Wd6RV0EttrV9cPAIioxz69qiNpp+AKprK9KLmpLau17v6SiPTEFJye68P+MlxIBcleQAKYylAuVNgIGNyaZFT/FvqWIwLEL5+DIApKykM698AclE6cF8cgNA+VbfecZDSjGwJuuVSJKoA4WApz+qZ4O0sFnm2/xJvfUdsMZVsqB0uR+Fb+EL+Zpi23xTmUx9okhWYxlDyq54zH4fll1DM+vJmgl6cb9T+lTtStRE0DsDLL+w4EfPqi433v+D6TrrqScq8EWNSsmamvqoXWHmGzZtzLNd5O4aUW1b4r5+V5LWSNuu2Ttef3H0+jJqJkHKa0eCCbg2Sqs4f04FUFWdEWPz3C+/AGEVf14KHypxROpXDSWT9WL06axTa82gmY/RTJF4xRV0iO925a7qb6kp4/PGjYncGwlBRRrTGO7wQDlOxlnAK/8kTD6IXtZTwP3pl4BpyjVGxfwmBSiOYYZJoZLbnOvPgZ71vZgSAZ7oUBrluH5Yc8icUrUc0lcnw9RTzOnp2twnV7oYuv2z9w9dXDBJif4rPyea/2+Ks7zft9xSAXw56Uidgze3gXvGH5TDdNzh/1hdyOiSD/nCYNfnRh4RwKopG7XJzmAQe4to7BuCEE2Rkc9ofqf+MU8NFQQ0sjKPaKS/wrnmd5DOLBajD29ltkfwbgL+OX4dmwS2mXBxDyFRJ+2uv4ryY6zhEfoMJb1xflHaB9Dw6FZhCB9W6cnJY4oHYzFiFjM52zZzz1FDtARcXR0TLEqNnNH7QZKVeufpGUg+zVxmy6xs/ZjqqIsHhibJmjIh3a9n/hsYb5RVuN8gpTFrH1b8H1DR9iIHVu8LnEI47ff7r73R+tsUQw/NDtTYbXEz0IMuDbS4L2K/Lq9LskNch/yADCsVPb4aWCkVOzAiPvtTR1RxNkOmKCLYMyWjudt64giEKVsmcTMc53G2LKvdH3BU5MlAONiCSMMZCmt9ix6+6VxjBemQ+ES8jy3gPtISeknA0KJtRwb5Ccq1/Lm3S2Afyl/RKOmuBV3Y1T/qRGzIG1JCEb0a06f4E/H0DwwDCDRrhMTZJWWy9xbFE59xpAGYWDe1WlDmJ3XkeRhbchpceB7GZ3SgsPu6Ivamu/R6MTFbnxi/D+o45zfAlXOu15nAlmE2xwry/+Bx1mtXKg1ufhyOl4m6dhds8yTddV6SQEhdel3Gok7lsGwSAXD/4lKa4/dtSWO8WT2uYwI9udLOHudjwarLwWsbR9mv9A== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b2a055f-7a3d-40e3-0819-08da66ad8958 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:14.8000 (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: Ur1uIDifC2w3D0NwMtwEJ0Qi2axkNJFONAsg1GEK9PehBeYk8gnJZvmOyvKZEsHuEMfwfh7EiMu82QxPJNkxRA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB2902 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150123_533177_1A8EFB6D X-CRM114-Status: GOOD ( 11.38 ) 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 Acked-by: Camelia Groza --- (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 Fri Jul 15 21:59:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12919856 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77950C433EF for ; Fri, 15 Jul 2022 22:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ziLJeXo1iiW6yayDGZrHQpY6sQY0hE0I8wWlfb4DKQM=; b=h0Vy6N/3uzNTpH gQz1J6ixnaV81kpulQQRo9vi9yWEdkL/6ioUbOYtzkxJgjFn+uE5+7Fhfv2n4lbZMkcidTnuK1gCH /C/OencEBRvwLEw47uJ4umq2BpdJQ4m8a+0o7gsdMbqSgJDcnjDvCVQZoC9E9m1j8cinfrK+ZJftW CqJ6V7UN6jVXHgI0Tzh+wpT6uI7c2Jp8LuSQLFAcOWkEnMAssU0JFRFKofuPSOifyl9cZ0yn8hLYb ydk7a4RzE2U1krme4WPMWQtXpvy6483ZKu7MY8eGQ3BEfezY4k2D7KyQOBjt7wVE+lg3Kvomb/L8/ uXzFmszfM/zhthaTtpHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTsZ-00AnpW-5c; Fri, 15 Jul 2022 22:33:50 +0000 Received: from mail-eopbgr60055.outbound.protection.outlook.com ([40.107.6.55] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNF-00AbL9-OH for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XLxXMLbb5Z687wf7m1V2y//PCuJI3IvIMPaaUBWkQWUF3wYC7sm2IZm+mvjSGqwoPOkdQgrEtM3Gz7mL7CFxBMCATalxrhks1baHFo2z9AuFRiska+m9wNMuTbEC5ciOEXslNNEN1fUbo4K0xp/or3Dc00g34QvqbaVH3Duhwi9fwQiO6AACY/Ntg9uOaJbA8e/gGthTvL0hmRDq8XCAJ0oVPBvjbUJ3HIwmV/GLsfpofCP340tq1FSh11IBk2I6TMxqASM47784Z8M/voL+8X3xP8/i7wEoaoFaqe1AA7esFWeAKtfP3mcR1UcR/52BwjbQ//RJxfA5wQXps1+Efw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6GDp9p2z19h9IzDM8RWXvgmOXQ38jj8WkWnhniK7X7A=; b=dRVoF6FmNM/u8irh09sroKxG7nswVC69Sm+tzm6MngWHSGdcVJu8tEok2igWM8/TiBY0RL8YmrdZop9yEiDMzisUzuH6b7r+87PDbqYGvsxr0F8JC4doxaVk5lX8F26e5tyz4Tkz0cU0L1QAekwuCTmOXH+wzlaGkK2jO2I44Tci03FS5ztNEZlSyAeIZmGm+7aBgAI2aoSdMuq4/P/9aLpKd6/a82gusQPcZM6dCQcbp2xAvvwwrQWpQWHzfCJJ0lXsqW5SZaa07iCnr7tS14aHuHiG0a8WXfyWQjm0p5/1rfuKWDJM+YzXRxl7MxIMQJLRngXe1qjlYE4VwqBM2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6GDp9p2z19h9IzDM8RWXvgmOXQ38jj8WkWnhniK7X7A=; b=C2Jcz+L/vKkb1HSYJrXNO7CIwsrDQExQMeJyvt7g2FiWQYaMKNvjdONtTaoohhBcgFIerz57BkaCPbrypnbl25Z+lt1sfUy95T7RDJaU80Z/CwP4KC4e6M/Lhn4nIKJvyn/mgwC46V7FM+W/U2ruofEdE17pydS47HhAC31+qOqbnnGp4T3rlyqtWaeUZFjHncOvgxc+EViOY1a2wVg9D4rkr7muOczIiTH6jDP4slqJiDslhIeJAmlM/YfFDVc++ExPqg7udrDyxPouFLYXutJfTqTDn5GGx/m3xuPxCiOBpTgiV1q0EeL0XgOFe/s2GVUxJKqnL/DFm8HtCv3viw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB6PR03MB2902.eurprd03.prod.outlook.com (2603:10a6:6:34::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Fri, 15 Jul 2022 22:01:17 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:16 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 28/47] net: fman: Remove internal_phy_node from params Date: Fri, 15 Jul 2022 17:59:35 -0400 Message-Id: <20220715215954.1449214-29-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77fce30f-9344-4b05-cdbe-08da66ad8aa5 X-MS-TrafficTypeDiagnostic: DB6PR03MB2902:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4nADs2FYDHIdoUseaLPS+FQkd0nJj3XXMziPUOlPmNuTaMvczB1w4fCDF4heQh8wIP6zUKEw2dB7HD1mqKeimYK7TK7H5zvMXXByPKUVwstIQHKxbgbiCl1/q+A2qaB7Iv/y8NBQFQgIYQfeph0tM15alcUF27KpN6fGRKG9oyCvaBlHTkp3nnQKNagUG/3vSGLr1YHe3sidljNGuaqUtt8wmP2L4hW7ivHLP0rxEQBziapTL1lYEZKbVd2Tlc6zioje1DbvW66QHhycmJJJn2fv2p/YVzTHFwVDhRtjBNmL8QDqDyKYtJFPa/0rO2vYTTD9D78fk2E1BFP9fttNMsvPsrJs2TnH5FTAjB+B9srTuWAejsvX0zG8FnoKEH9SQ0HMCfUqi0HEWXnhdoNaV0uA/AWC/xEvpCx3XeH4+1oW4xx2SWD2YP2XcNt6ZsVqDM93abc6beUkbPiJ4/Dj5WdyV9RGoPtHPMj+Q2oDmUBi3ppwn1762yHqNB/oNePH+mKu/7mlhiGLhPbHayWbq+nfFEayvrXiPSRzX2pbDF48UncdOSlbQGY0mc8vWZdGYw9nDzvnG9sxtXZLKNpRvCFsz4p59kf/vN1wgyNvuMzd++7Ki8CQbM/fcTTdLKZWolAz/Xz8WQGpmz5UiRL60rWoPG6eypaDJnjy9tp+myzYZZakBEVVQJW2oS2rykUe5HGCZsCrF659jHHiT/l6dEk1Y7ke3614E3I0ptcupxbnM9na/9Ep0Ex2nOJDrendBHzJ0no8lpR3V05MK5NUx9OxfCvRfPKYBIOZFfOtn0U/0N4gGsR+MgsqCS0TsRXk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(366004)(39840400004)(136003)(376002)(396003)(86362001)(5660300002)(83380400001)(6512007)(1076003)(107886003)(38350700002)(38100700002)(186003)(2616005)(36756003)(26005)(6486002)(52116002)(316002)(41300700001)(6666004)(478600001)(6506007)(110136005)(54906003)(2906002)(8676002)(66946007)(66476007)(66556008)(44832011)(4326008)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hsi82WSBPH+OL5/jrHbp61wSS3nRciGYg0SKRj9aGfVS1oMc0Z5/+J0U7T1h7o0zUioOXAyaPFEGznM3PIn6g+RrD5MidLNBUgGtn4SOw/hcmy66IACNXy0H7sABCQK2WnfgFS4aWZ0VwyLnqxL5uv5SRv4vrj8xPu8T2UdCm6lDeiT87oKAyC6nhgiLS0HXsTzkD4TOnF3fwdNFDOOm934Ni+/wAAkDvfg0fGmOsBkTBQybVn91K5D1CboudP65NOAVjk4llipUskcFhZ3YFptlcqSWQmxgPVcFhaFadqJQ9ZWr2g7zPJDu4eOZ5bi+EQeEFo9vv0l08V36V1lNxMq5pqD6lWesPQdd+q9G1KYm3fHsSrawaeKyfVgBVHhVf6WsuZnoeLMJN0dtJFFmPXXRfJBCg2Jb83dwLmqtJvZnaIqtKUvJCVq+x7wq2CGk7kPpizw/MehW8/e/BKMK9rFtpyelPg1getvSQnKEcHHLNeqsCdHg2Xfaxrq/pX1b1P/DrWIomSuwpmBApemd3Qsh+Ql7GD06wiQ9HpwFRBYzbdRVezKimo9f4MM/f8wO9Xwm/jojd6fvq/tgFUMXaxJ1poDMduKyI2YoDk9A3kqQBrOU6X/cAWQppc+qZ5VCUanCLnwm2eITOhP2ddxdvPo/ZtTexyYbA7mX7ugVTuVG14KrYgaulHvW+VOR0SseMPu2YXc2MbVsEh+ylUJYVmKJMoQ0gpSAH5+juo4bRL5bkqw7zYGk0zWAjIw2cuvRIUrcHDvWtsA8IB/BuHy7ImuWMQ6vDiQPLJi66BfDQDwUFlLFMJka53WaOkZYN6pSapg8To2HaivuArAdeJEY7Qv07tAGKf35jOMMfUgnpvOq2iW+ohdTLR9TqHyqS2W4LnfH3rC9lNqTLlmA9zq7W2utqX0j/ln35gMe/9TNZz2K9qLMB42Fh4GD5ZXi7n1OUh15jlYQPVkY/Mn/3yYTg6vHq7zqirx0rEPhofHCZ62ffZ/SDYklyeXneG+aVlyOYKIrOPgAaJjDqhA2F/mWRjPGoNiTaz4zPqOL8MTTZqhKQN1Uf0P5yZjPk3qFsho/p8tRHygIx4JRvuM9AnjTlvg9W+cRrNHaqJ/nuFaeyKXQs+a8w8nkCMjMXx1/cS9Ol7fBE1CSOBhKv5pxjaOY5QWmbzHIgHAMHE8kLjH8mImKjqrDWVT2fzK7Ma3BYX8Hx1JyvoInp7++7ralPsBlObeCE96sGHIis60xcs0QYHFQ8LkkiN+/7lO+fA+jvFVR9UzfOHa1Q5m4kSsDc53vPAK2c4nIkY/9pBDqCDwrgwmDg3eqLQGZJf2ophCx+VXbNpxt5+RZfWTHrDHpRH3AkDwCZnqw9Z1U8h1igZsFo73svfS3Cn9hsgIcdZAKl3LvuGbkHmoxtZ/kkDfsKIpmqOs7OaT9KMK8LE093b61ZlgMJjbwZ9S+tRvIiEU4sG0intXoVwUg2Ip0ZWiunMiwbcHjPm8kMzKGMB2l762lCygydXAxG/paVnqPZHAkag7E75Jv6n9cnlYXK2zGTPSfswFUxpVb+uBgsqpR9qzUg2mTa9I7Xm5y0miWhL0SJI3K1envYvpOdOnb69MtATmRlw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77fce30f-9344-4b05-cdbe-08da66ad8aa5 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:16.9093 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JIuI+O6adgfjLUkm2LtR8CcO8hhmNUCtP9Gevo3GIHblwF8J6rTxemrkO6QxfxnQayVKgRGX5I0kQpGwWPPQ4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB2902 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150125_901339_C60A6CB3 X-CRM114-Status: GOOD ( 14.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This member was used to pass the phy node between mac_probe and the mac-specific initialization function. But now that the phy node is gotten in the initialization function, this parameter does not serve a purpose. Remove it, and do the grabbing of the node/grabbing of the phy in the same place. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (no changes since v1) .../net/ethernet/freescale/fman/fman_dtsec.c | 33 +++++++++--------- .../net/ethernet/freescale/fman/fman_mac.h | 2 -- .../net/ethernet/freescale/fman/fman_memac.c | 34 +++++++++---------- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 84205be3a817..c2c4677451a9 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -1463,26 +1463,11 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params) dtsec->fm = params->fm; dtsec->basex_if = params->basex_if; - if (!params->internal_phy_node) { - pr_err("TBI PHY node is not available\n"); - goto err_dtsec_drv_param; - } - - dtsec->tbiphy = of_phy_find_device(params->internal_phy_node); - if (!dtsec->tbiphy) { - pr_err("of_phy_find_device (TBI PHY) failed\n"); - goto err_dtsec_drv_param; - } - - put_device(&dtsec->tbiphy->mdio.dev); - /* Save FMan revision */ fman_get_revision(dtsec->fm, &dtsec->fm_rev_info); return dtsec; -err_dtsec_drv_param: - kfree(dtsec_drv_param); err_dtsec: kfree(dtsec); return NULL; @@ -1494,6 +1479,7 @@ int dtsec_initialization(struct mac_device *mac_dev, int err; struct fman_mac_params params; struct fman_mac *dtsec; + struct device_node *phy_node; mac_dev->set_promisc = dtsec_set_promiscuous; mac_dev->change_addr = dtsec_modify_mac_address; @@ -1512,7 +1498,6 @@ int dtsec_initialization(struct mac_device *mac_dev, err = set_fman_mac_params(mac_dev, ¶ms); if (err) goto _return; - params.internal_phy_node = of_parse_phandle(mac_node, "tbi-handle", 0); mac_dev->fman_mac = dtsec_config(¶ms); if (!mac_dev->fman_mac) { @@ -1523,6 +1508,22 @@ int dtsec_initialization(struct mac_device *mac_dev, dtsec = mac_dev->fman_mac; dtsec->dtsec_drv_param->maximum_frame = fman_get_max_frm(); dtsec->dtsec_drv_param->tx_pad_crc = true; + + phy_node = of_parse_phandle(mac_node, "tbi-handle", 0); + if (!phy_node) { + pr_err("TBI PHY node is not available\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + + dtsec->tbiphy = of_phy_find_device(phy_node); + if (!dtsec->tbiphy) { + pr_err("of_phy_find_device (TBI PHY) failed\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + put_device(&dtsec->tbiphy->mdio.dev); + err = dtsec_init(dtsec); if (err < 0) goto _return_fm_mac_free; diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h index 418d1de85702..7774af6463e5 100644 --- a/drivers/net/ethernet/freescale/fman/fman_mac.h +++ b/drivers/net/ethernet/freescale/fman/fman_mac.h @@ -190,8 +190,6 @@ struct fman_mac_params { * synchronize with far-end phy at 10Mbps, 100Mbps or 1000Mbps */ bool basex_if; - /* Pointer to TBI/PCS PHY node, used for TBI/PCS PHY access */ - struct device_node *internal_phy_node; }; struct eth_hash_t { diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 039f71e31efc..5c0b837ebcbc 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -1150,22 +1150,6 @@ static struct fman_mac *memac_config(struct fman_mac_params *params) /* Save FMan revision */ fman_get_revision(memac->fm, &memac->fm_rev_info); - if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || - memac->phy_if == PHY_INTERFACE_MODE_QSGMII) { - if (!params->internal_phy_node) { - pr_err("PCS PHY node is not available\n"); - memac_free(memac); - return NULL; - } - - memac->pcsphy = of_phy_find_device(params->internal_phy_node); - if (!memac->pcsphy) { - pr_err("of_phy_find_device (PCS PHY) failed\n"); - memac_free(memac); - return NULL; - } - } - return memac; } @@ -1173,6 +1157,7 @@ int memac_initialization(struct mac_device *mac_dev, struct device_node *mac_node) { int err; + struct device_node *phy_node; struct fman_mac_params params; struct fixed_phy_status *fixed_link; struct fman_mac *memac; @@ -1194,7 +1179,6 @@ int memac_initialization(struct mac_device *mac_dev, err = set_fman_mac_params(mac_dev, ¶ms); if (err) goto _return; - params.internal_phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0); if (params.max_speed == SPEED_10000) params.phy_if = PHY_INTERFACE_MODE_XGMII; @@ -1208,6 +1192,22 @@ int memac_initialization(struct mac_device *mac_dev, memac = mac_dev->fman_mac; memac->memac_drv_param->max_frame_length = fman_get_max_frm(); memac->memac_drv_param->reset_on_init = true; + if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || + memac->phy_if == PHY_INTERFACE_MODE_QSGMII) { + phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0); + if (!phy_node) { + pr_err("PCS PHY node is not available\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + + memac->pcsphy = of_phy_find_device(phy_node); + if (!memac->pcsphy) { + pr_err("of_phy_find_device (PCS PHY) failed\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + } if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { struct phy_device *phy; From patchwork Fri Jul 15 21:59: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: 12919857 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 9254FC433EF for ; Fri, 15 Jul 2022 22:36: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=i5td6IzDeMZf0GPbptJogaFep511zk2Eyu9Qiz8GDAU=; b=L7Mtb5SmJO1Nlu /eLCM+Vu35iJQRYI6RoIOLdmw+mQB4XsJMLsDM49kVJPh6eRH6gXR6rW82LmxSOdk32Ql1EekplWc aQ2hZODAlZrKYIS9AugKBdTrr86TtCZ6AaLBz2Hsp8Wi/mxJii+Ta/x9fmOEoEmZCTemWEpg6VR+t IMytTVnl63ELGQCUbMx2jTBzkJC2L21/FLmw/CPKJBsZR931y9eBCotyw1vtwPhAqNtZ5kyg81w8l wxo2sTaykhJrgIt36Al6pGFUBXb6jCpv81XB32rwx05nyjfrfv/gTNqIoPnXT3m9Xmp1b+kMLMHmU VoB5brafsE8N85h8PCFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTti-00Ao8V-Fg; Fri, 15 Jul 2022 22:35:00 +0000 Received: from mail-eopbgr60055.outbound.protection.outlook.com ([40.107.6.55] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNI-00AbL9-Qc for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CHfpZG4WdR/eRqbiS2qDfy+Vk+MZDSQIiysT5g3VQIMeZZf0EX1rWmWNJuBlaQE1q8v2h7Xp3doHqG20DAeGdJVzJOjNOsEFTkTOgy94dG2lKyLXy0Bzq62eaatK0fXi2dKLo1SmPa7Gn3Xd+MiGkGQB0VsE3kp4jqjJEiwT8EjBJ8FKXfGUcckneH4tNw1YuJKJFN3XFyYmg+SqWIqINYNhKllCV3kUFs40ABZ3I4CtHvwP9AhMKV+2qZPDyBz3pnIKcCP8JNi+ZGfc3gdNgNX8MoL+1jaOj4YOiwg7Tmkc28o4D0zrh2mM/KZ+N77q7o3ZMI6SQPw7X1Q1y52vzA== 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=9T3uvyZKA2uUfGpR/2xNeKPauMOZIDY9wpntyy7jmVs=; b=b5x3Mq48DrtV1Rv3XRzknPyeaif8CLyWRS/v85eco351xXH2fioyi/mmYwb1cZEkWzubOGUq+pyglEFsU0S/bNYcuLC4Hjbp8LM4UQGBNGsJWQL3DcldDqG9IGvYaLncCbsZymyfinLYp8L8JdlOD1e9zCH7ML2Af4qdGcopANOrJpwjTw9AinIPDyKil9RmLeMk5C0sBRCHRj8iIY1YarL6Sz9FWQ2eCKHrCLUULzomdCZZbkniSX/1J8p8qR0KibD1qZjn9bBAOoHV2fFrDdf3kX9FPrMLK54ZU6l4ymLO3KBD8b10ay/Emj73lBqMWOROvBt7/0tRTMWdNH2kMg== 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=9T3uvyZKA2uUfGpR/2xNeKPauMOZIDY9wpntyy7jmVs=; b=Q2MS6GjnN33jNWR2NEwsdx/bqLfGta66IAnmcCmyGdY3cW7WFCsjpunzd6tdJOhJtGsLSDAYvCdQi5BKnfZwsVhqPacNwgMaobDQuFQYvPSIjisxo1DfDckXxOf10dK2XwUqX0WvRR8fLw1l1em5uf/UMhUtPlEwtSDeCxinyY3V/cy308uu56lVsuqkaS6ddYXvudsrFdfL/rAM7oeKed4Kd52T4IQh/pnX7tjSjcz4VXaeaAn1XWgMM/nxpHKUhajwunwLHGjh70M/RJnBD649hjW/37Fl/g9c8l2k/1PHEUAf4v4waApDXBfWbeMqknyCn7+yi831OQkG8bfK5g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB6PR03MB2902.eurprd03.prod.outlook.com (2603:10a6:6:34::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Fri, 15 Jul 2022 22:01:19 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:19 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 29/47] net: fman: Map the base address once Date: Fri, 15 Jul 2022 17:59:36 -0400 Message-Id: <20220715215954.1449214-30-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 804e43d6-3bb5-457c-a79e-08da66ad8be7 X-MS-TrafficTypeDiagnostic: DB6PR03MB2902:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WQO3mbi65zf9LNZr62I1eJb+wAOZ9lxIg0Gs7mdku/igKVsN5NEkUHhz7tpf4bmmoLLwKWf85NHFKz4918wASc7RFDm0CKdbt53MY4V0z9uhvM003sWfnQYU9apDH0CiHm9n2LKrY5X1rz9TmTVEWoOy9quvYp5d5Filyi+du6NYqVlazxkUFpbkPVlx4wyyFgFzl2dj5OX8LhdLi947GMSklsMR6VgxOLMQG7gri1xT18pBANfZTe2yF/Z1wbrkERUKanjozgmfVRyb0Us6+RWWufZ9kEX6qb1aHMIGkhjZGsyCdeutnMz7jkQMnxUHjubYj+S4kiXGUJ42FTGRx89x7vHmyG9kmR+HX77uO37jXXJe/x+2No2vJ6OciiyVSbSFJRyboEBLEOZ19/JhMBwtjFpQkO1Ayv1kayl5vnCSmJlA486205cGyIwWMWqTR9a//gQbcfvU7dQtKDaHx4804msUwF7dy1FGpAo3LXmFmLIl4PQgB/Rk13/MYncVzLJ0Ou+KszEb2a8vFuw0chY8x4ZPP9kO7oGuh/Oa0DgAfm2sA2oo/8F7KVzudn1O9D6rWPChAq796tmWc0NzRHxR8/crYuZFXvmbcsMw5KjgJeFOxAe16KKpfIwD6Kai6EJkED2PpB/FiH5v6fpyFi3JeDqJAPxVPD1mt3AKkZYvqFu7awPjWhK0jiIQjnIX65YuwATAraZHkYqUV7DeT/NNEWzj9dkP744MPl/DbaZEy7W/sx+5QTBnGQkKxJqAlE9NQ0IDo0moe+1v2oTMuDZrx4jpSJVuYEelENkzwMxgb8ncYwV2QdGdkajDw3kj X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(366004)(39840400004)(136003)(376002)(396003)(86362001)(5660300002)(83380400001)(6512007)(1076003)(107886003)(38350700002)(38100700002)(186003)(2616005)(36756003)(26005)(6486002)(52116002)(316002)(41300700001)(6666004)(478600001)(6506007)(110136005)(54906003)(2906002)(8676002)(66946007)(66476007)(66556008)(44832011)(4326008)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Qyh9wrWv8mDqFhXre5aNTgq3ENh6Gh7AZypoEjRlXwy1hgJkj8DUsxAiIX3jSdn7eUpZ8+cUOJGgDasFYHGvA7csSmUcm/UYw51+xIVxNl7qvKe4/kYkEUjPuO6BaJ7fHmw566Zx5xsMDlIVEhsJg1Nw6Qp+LoU8EqHh1eQ5jUg0HuUuDS94jMIYZy3Gp8aXQKAUxKvVWbu9UAcq/73hK6hLBZL5nZ4b+GDHX+UHXxVMTA0rC7gbsBIQw8fHJCKcPL9Ry4+PVh+NTaARuhbu/eCNB+vOIRpVrUCPXYt4SdlwDc+xx8ZkBrA/ve/HSwGQtllPc71xhDpNBlHECgA3E127IJfPVGhBQTAwv2UxZOq5kKkrohdlMpGjbN5CMC0UkzsHNzBWoPaKHtKLc3xYtL4MsaxyK5IONb948NNtJ98D65mvH21WO5SVTW35l0T7DZhaC8W11ui9g3cMnDZ6qo9s57viqcKnucbKBj0pvid/zinCNzsf1YPogE1Dz9TVC1pR+wqWwfPfr7Ph07qGe7q6abbc6RXIXh7GT47ArlWWe1eHLLCnQfBBTSnDlxeDjW+d49pHjBtKZiuQKuaQBogKLSBFzMCWaNKQQiMd/ttha2xsy5cKmdLR2AL/23O3J0iJrxT1mj27zZY8jnP8z1ghGA3eUkAUICEby3a9u1NnSGYdwbsolXgpiU491WmAbfKSXbVSXxqhf7q9JOZSpXV4BYFBvnaCQ5hamznFYtaE0Tro7w4atBGFdx6ArOAV4P3BJ47fBOPZnKaQ3sAScL5l0q7oizeaWiMI8kJH2IET76pEOwdVFmCasMB1VL+L1OI1EiqG3Me1smSROjB1pwduZz84AsbD2XCqqb5y8QEmkMtakQ/OPtIcxvEy7mIMC+QtYR7lulxysg2++sbPrD9myOmTNmSiNcC9sYZiRIVm4c6tVYXGvg+PfmMsZgexK9Mt89/DLh+Qu3tgcggd8fs/zJFGMCIHzjpGJI6NBd8S0nTtd+5onbPc5LaqWSH4qgX/h/KbHQVj1/jJwdFr+wL9k2fo2zMD0oOREjYF3RhkIcry/J7IlhdIHHzOIFUAMxuLeaUhxPBw0aSAy45CPwDYEaD9NRaFlCxY+14qrVhkFyvd9DdiVQt5bxjJStV4f4HICYsF2BvKdlhkDFLu+m2lqnrBCiqc4qCRGRoDdeKtNq8cUDfSFVh95sEr8irtpjYLzNKHWiVQbAGW0p8Q+L7z0qHfTpgzFB0mYIQ9uNmVx6nW0PHSqQcxwvO5lJPW+GKenu0kYxR/PDnIGZQ2Ag04cHzScAehxZC3fanlPawCgPQ7gROi6qpuybP4zM6qQuuBWR+kBnVUbiHcwFe970NqdUifCYJDIsqtTXGQli9Tv1TElAOVhaaIcBJP/++CnISbA2a1H3WudIrD3FAkSn+ogl9COGzVYvKorYW5oQ1NyLCpb6U6eRR1TPn/zkVYpOPX7/CsRg7jnEIHnU1NHZQwq/yw3YBH5tSOjGMa7e74dcAmXb0mhKrUGYAnjwzfY157O/ndJwQCQLy+AYztGP5Lu7jFzx0uXaQkuablna0DmAOyZf+FrF+zzbwQu32CNVicAuZDgkP2D/1RFFHjNQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 804e43d6-3bb5-457c-a79e-08da66ad8be7 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:18.9874 (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: QOUoEqEJBtqXMd8wvi96bG8h/78Vacob/gyr/MU4lB6Dkw1xueoO+vUpJpMUfFs/tEoG35ZXnq226EPqUYo3gg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB2902 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150128_949769_1B6F1BE9 X-CRM114-Status: GOOD ( 19.95 ) 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 Acked-by: Camelia Groza --- (no changes since v2) 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 e974d90f15e3..02b588c46fcf 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 Fri Jul 15 21:59: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: 12919855 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 1D8B9C43334 for ; Fri, 15 Jul 2022 22:33: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=Dg4de4dNqrybn0p61S/PQmlXrGHJpGAaAM/snchRCzA=; b=kGeqkxdS98jMd0 Lvot1ns7fh5YrooC5EQtbbMTPEgQQxwThZA8nmaTB60rfhqpkj2MN+GR6ln45nIcYIBdDVgtqu4di sMNr7l8Aa8yZ9s8EA0Kzjq2HHq8bwnInZmwrWTW9qstcsys5Q1cqJkOD10mZ2vvEDWet+/1fIHF6l nqRn3TTVdepFXJP6pTWeif4/fyuV0k5YMYakehNKDpPYVODMWxbFohQ6BGiv2U+OqIqY0WfU16LNw cDst8PjOhIeVlM64+/9ivhOliiraUO799xk2y2/yG89HENPZgsb4XV0e2BF/NbEfQXOxwZs/hS8EF gd/AISyaWhz6qgalHZqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTqU-00AnD5-FG; Fri, 15 Jul 2022 22:31:40 +0000 Received: from mail-eopbgr50069.outbound.protection.outlook.com ([40.107.5.69] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNE-00AbU7-R5 for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m2D95p9Np4/drnD5ug71bWyF8M8Au76MuuVwHQSJw0trYcO8/dxL/Z4RRneU7zBWBLJ3vXMKlBZUhj4jfI1m3jZoW38yPYYMI0b1TNt8RklT2a1YcD7oWbo9Sdh2QN9RR24Xu9wrIyktrdlfaInSATOkWgRpKWHOsU0YBJqoUEn3r+qo8AtXrTDK0PRzXcnGTf2g9wscLNKIDyQnPfW0lSvdRMmIV2EH1CMHUe+HQmic2sZ72k2eqOttEuoSjWilsI9HM8eeot/+NpzqSSMGy0Gj0DFKhyNKENtDLxkE3dzH1Bh5lQX0iXamYi7PN++tiMvNqnsWkFSar8J5igty3A== 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=GS30rEQ4zjs/2QQJB01NflzfgB/Wvugj+DigPlHjuEgOB0+S+0Gpp8qTikoadXQwHj6vR+uxmsiZwns9hizC3CfEXSNn/56F2jVUiYfNYwqm2GFM9JHVpWKe+PprNyn4d4gerpvVPak+bPJl/QXhabHVAQUkWaiPn2Gv214ATOc3eWD/h8ZRREc4d/YOMqPida2QxuYBhV8dAqKZeelKEdeCp4kE+ZSbyWnAHeeDGEAXMabyaRzgYdXwRKmyfqJE7GVgl5Qld2QivY0lhgXF4Ta6m/iyBWNMKk74jbPqqARfQv5ffypOCKoztxfwJoDn2jTi/6gCjudW0NosrY1COg== 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=weiSnguuxaCEFmTa4o6r1WVe1fqcYnWVoAbtGCEzoGIUeYemAMmb9N5dIgFys/BwGKdhAvX3jJgA2A8CfpZFVu70haAl1vYhkd2Wcer6P7n99bXe9ga+sC6CYOpxpO7JCxDsjHEfZmZuAGH6ba50Fe01G1B/9uEWLM3bZ+GBCvVGO1EI+8UJNhCq++xxZjHDgx9C7B6knUXkctgmEI/MWOVnP7jnbrgRCCNcfo5AA2jRPlhsvpg9/pUndtyNPfrmziIkfK7qslg8FzxSJXIc3G1OQ14eiBKR38dj2yPkd9Y5BoswJztnicj79/PNZTl4XScUNS9ZVKyTEKz0NPN1IQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by GV2PR03MB8607.eurprd03.prod.outlook.com (2603:10a6:150:77::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Fri, 15 Jul 2022 22:01:21 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:21 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 30/47] net: fman: Pass params directly to mac init Date: Fri, 15 Jul 2022 17:59:37 -0400 Message-Id: <20220715215954.1449214-31-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84564d52-75b3-469b-33b4-08da66ad8d1b X-MS-TrafficTypeDiagnostic: GV2PR03MB8607:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 80PXCHM8PK6oLN5u2jb4nMzdgXtPPb+DDAmKyoVlbT11Oxq6OatWx+0O7ixXhBXuCk+LNZu5pLol/wvti/1XnOoLNlLZFZQ646eWyTlApCpwlUti2eXcm+9fqhBTvgMiaqrZWTUEs+g0R3q4scTpYSypKezw2gYThEONyrdlf4bBOy74SWGQ+FaoDI0ELwBchhqTEflZj1ssgj2pFKJPSmkm0jd2lr2kA87RRjf/6exPz2JEo7kBSAQyZ82Uvuz1qXX4WfJ7fuO95V8J/7VPKD1pBZGwoS12heelSwDtN92UMZRizPBSnqVrQykGTJ1DDeh//HxzG5qnXguKMSKYNsM1V275MLPU4v9PrvqdHRJnnv7RlTjawW93Scz1LZkG1X4WHo0ECHX+Rw2g8TGqwn1xsnBczUjgL7re1bi8p5Gkf4RRcfS15rOuyB6DHExQyI3gQNmImgZ02TBF2on7L9BBmd9PwXSMMyk78Hq3KY5gJkozuZzv13NmLKs6SWsu9xQnGisDDnPMNMbJT8m/xUKJ795zPViS83W9MmOvJIfjvNc2Qf92jB9059S+dOv/GxZUh8zTKOg3WXoLC09kRPoNZelGqGtb7iKtmcaU/TAm/FuHsCuTgbqUzyZuEtNtx/oT6Nj3XtyvRL05J2wEMPIrmrni2rhd80ssW0/Hl2/at7+wo2bCMZgxylNGzKpL496Lr79tnpbHnkaTRtKOMnncS0wSdTf2vSu1rC2uOmixxf6CjZX6drgInmU2TfwxU3Qv9LKLJJyC2MQyuPefYStqYKzsfYtP9Jh7ZRcT9e2t4peOmfEBNNZwRj0kSDVF X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(136003)(39850400004)(376002)(346002)(186003)(38350700002)(66556008)(83380400001)(38100700002)(66946007)(110136005)(316002)(66476007)(36756003)(8676002)(4326008)(1076003)(2616005)(8936002)(86362001)(44832011)(6486002)(478600001)(6506007)(52116002)(107886003)(6666004)(41300700001)(5660300002)(54906003)(6512007)(2906002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cdkLld1vqL57O+R0jHTqFxNnIkmBFmlywxbuQ5YOTsEuEsvYYzSYRBIvW0Orv/6F84QNA0DpntNPyBvz4fux+lg3A/USlJtClUMA9mC4lN9dX/5rut5RlVXtSPrupqIsD66UWLF9f4Fa6z528VL1ccJJXaJQ3pkZ9aHXPvzoq6rr32kxaH6Oau08u7hxOVHbFx3QzO16e8SnGUpDtA9sq4vtc/1BrIiyGvxT/fBZla9k5wrhnYl8r3Fd1GHv8NBftKg8fpXU0IMlMAbGd7helUVpsy93WdPZg+MoNTDTjORZHHHnWxKk/ksG6M3QDLwVQ7qMpZbXsdSbE9Oh9M+tZ9+vYGZuIH1gbCFbbdeSBKpj2uUI81j2XD298BI4mX14W0sXoxr9+8D8Az7xWERvfjpOJReM20Yy5ywKwkyq/y1Otyd8ahCH1qjH2JTEmJWmxAAhh9zXXsKlr7uqUlKqsghL6qWO3ItoFY1r6dqUEE6w9KugoUyqEtuTUC51RpGf1epDENAedQvJFH5tt+JBTYSpuokJTduwQb070WEPh889G32/ZZkChWfRBG5urX+DUiefofGi+mdNoaj1mecmtXFQm4zIINHMQusc+eGKfEPGDcujEXtFVtad4ChG1N53gT/5IJ9o7QHk+DbzEWHrz/iN71ooneZkYxa7+Wm8cOAaAzd0fHNq2pRi6Cgaj+D+5MvMVjEMu7r4NSUKyyr2dwZVeQGy5LTJbPcgRga3UKdmcJF0s3ssC58QQP8+0rMNINA6ndJta5zHxZ/V2XHi/Ha+tVf8ReoHHbjM9zUl7HfAi9RYaWu/yfNDCI99HT5pLNomTXl6wIk7sBoTCSL/+W6k4Vns6phoBEFKw87btKU2dSbL8WznmT5nubOAoGxjVElqmd9UOewc6Spik5ey7MEVOy9cH7N0TLQNQH6oYUEgp6hlVLE/weYxQ4R1huHHPInEiQBYZELNkgGX+KwWScejxnBJhniltMNdPTxgJePmTz59v3cDcL9a3ORV4p/cge3UzV1UKrGCa/L3MXULp3eWdCBlQvOXGdhkwMayWVMZkgq6wPkNyJwrH4A1/YwNWNLGdLYW2u7+tUFk9pe036hvX1YZUA4ftsvg02ahV7XSSo39Wuv3+UW9JUrkD/rXyR1RV96ZNbfM273fxlKfqztF8oT87deOWW57gux5jM8B5Z11GAOtYKK2cdwYOois5sgKR40E69BOcdyAHSXLznMZJB7fD+Iv2PN3oDilB+06OATHECQyx7p50gpQaCAeNNnOiJJLJz3ND4PCqvgbhVz6vLoexiT5uufRPZ1ytSG5cy350YxEEYWfLOru5Mk+Ag/sS27SNE/X9SMmUwCOzOSow8PA7CuCafa2/zeWfuId981p/yovZMLrtZGLAPf5Pf/3ACXMlf5YT4KduYmpPbRuJeMfCOeG+aZRbGF/rlzlHwELQgOE8vFxvsxTG57pikqjdvA1m887hSJ29Qj3NDhQxEM6UeuZt62gKpDzPMs/Ao6rEf+ZlyT4zFdL3ZR7o/j7sylzDWZHi+GXAhg9Wh3lUEA+kqKTaoHZrijVF1FlLbvEt6I81KQGdcfYuKTBl+vJqUk4Myobk0uVkvnJoQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84564d52-75b3-469b-33b4-08da66ad8d1b X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:21.2060 (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: 3GGqvifvcD2g3PlYpGL2UUtY6a5aBYYgqCZS/XD2qCks9Q8Pe1GQdRACYPu+vcx9gGzwowqNKfK+Yr77NsKsqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR03MB8607 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150125_197130_3D83EE0A X-CRM114-Status: GOOD ( 14.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 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 Acked-by: Camelia Groza --- (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 Fri Jul 15 21:59: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: 12919858 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 69302C43334 for ; Fri, 15 Jul 2022 22:38: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=cPIunLmawwNipy5HQ4DRFUl91+6pk5N+WQVW7Wt/N4Q=; b=Gq/2xuSucy+oKq yJObxRVQaOETsh+Vs7J+zPxrq6A9yB29ahcgRl6qHQIEsRNQ5rLjuWp7qu58Gy41OX6OgwxR8dJAc r1lLRhvL6T/ci2FW4c35KbYsM9O+kA8xEM0G+UmdUYDjMrb7ZSgmFOaivWQ7VuEHIuGLIlKroRwpE OlB4zrSVHKoXIg3rLmRwSPWc84wHbkkm6wu6CLNVYROE5N7K5ZBLqfCG6Vt6zA7iH5777BX+BPaHf HhwUGn6956VzFeCPHwcMkgU3SRor9/Y+pfKDKsexZKFfVeSC5ZhZU7xO4viFMdOzqkX6ss5/p4U/t ep0Y2H5NdqiY3yTNWnpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTv6-00Aoe9-0i; Fri, 15 Jul 2022 22:36:27 +0000 Received: from mail-eopbgr130041.outbound.protection.outlook.com ([40.107.13.41] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNI-00AbWx-De for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WILG1q3JjRwHMNo86w2BqDWtP7iZMErFI/80lBKOYUCSEkTLeS2GCLqSN0H1fuWUk9G6v476FmaIgY2JycobCt3ksZwrP4FnJYXsvdeCxOgbl0GHgHbcyuicdvg/D2sbHxV6E7Xf/oowdq0SyciDfJaNqXfS4ApKVqxPrfFEj8w3fs4Bbf/jmv0HBSN7ndZUKZCa6UnSKxo268cOsTH2qPh9ffw0rVyBw+KbwUNhMMq76XoyjsKtCYQsxc21FWgJn9c3GyAnhWeSZOhS+2HlGZPqm8LecJGic2c83mPGaE9HRbmQVMBtp6l5sjD8/lDd5norF0tvatA9STuLT5ShGw== 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=UPyTB8apeZcCbqhHrwNnUcL9lLjYURAKrr6CJUmMDWH1VtHQdD+972iyfcFYAO9TJHsTVLSNiyujIH6JHq5x9uDwrTBDR8h3vHjWjQ8Q6s+ysZ2faNPdc0YrFVqFU1HFN72y1WHLVJJc1/pXNSfOZs7eJ0EvT7ThX34MGr/BgjfEGAkMRkajXw2JerPCXdZb1ymX70JmsQFTwqf0fiu8PEy+UKZW2s4LkXSIguIwAR9L0r0i8apDKT47+dCZ1G4Xv4RqNJO4x/9tE3eRnMs2LbIdeArAp7tZTLa4fE/c90QVHkUn8s23QMWvRqgowMZWzI+MLlLn8eDsU7Ed2yWsDg== 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=g8+AfIlmDjwdgjeiviiSQtV6HFMYveCdUtX3jxY1BCIcqSzImTjmQmuqOLcIWtkfwUDuVo5Nnetea+sq5Jrt29eKbCvz9jiERsIv6BtkfKPxQWDNMLJboBf2MgcSUBwbyypiJjC8+uow+yfA+1ktnsxiJA0j3m+QMaDa8WTgfMwpZRzqPuhY958LMnZalCP5EbSwIussbjoYxx5qWQl/kV6JZD/B0ati0ydFmyvQZ6EubPffOs/AXgQrB9KpRHP/ivkeHXN6lnCFBY1ce9H3bngeXqvB6XbnAYd7AUVes3CQCci+fxhN+Qg10TQCsNy9C27Ji18aBbmHiWhVji0vQA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by PR2PR03MB5243.eurprd03.prod.outlook.com (2603:10a6:101:1e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.15; Fri, 15 Jul 2022 22:01:23 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:23 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 31/47] net: fman: Use mac_dev for some params Date: Fri, 15 Jul 2022 17:59:38 -0400 Message-Id: <20220715215954.1449214-32-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8951a34c-65ec-46f9-2014-08da66ad8e70 X-MS-TrafficTypeDiagnostic: PR2PR03MB5243:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qWACkbcgOuuoDjOuFzdq0+1EopSt3at1gSv0J0VP6he3eLPKLOhM36So+MUYiz89Mdl/ZmkgTHR31IgKKcPuNq2QSmpcCDsVqFBbZ29rzi6IcM5pixBRaKF8wCEYbWpJDonxsCDSqfTu5TxyZ+6plNVn/Z/S6d0JvRoBP/hvo0cQZ5X52zCUNQu4TdAMKIOAKVF2PhByO7YWavN7w1Se5nDTZUHeYup5NY/FoTZYa/FRj0x4JJRkOHUoyfBd82WAImrfpBh6JWosYA7+hGESrOQIkIyPSAXrqwJmoHVSrqOeegMyMqcu9aWgMyTXKfnschK6pnO95RlqyoablC/qDqRk36pee66oKQJucnKO3qvPYjcHTf/jWh58u7ppvzAjDeXF3iO6M0nlWjfJscwGoWAz2Gg8tVSvB5zexAu7tYZifE06K4VJ8PnT/nnnrR5NuMISvSzrIH2pgGrkig1C3J2J6tPQp0ZUVhKmTeVxgZ4DeRZlPtaFypd7ECxnMwSn0ewFZYphqJONyLzSUMNxWN1VSqUwfQPjnm9LsifdAdNyO6I5OUzj+9oO+bRaoE3M89flEFU10FXmRZCfxHnPebm6NpvxDAq9+VG1Ek69M6lQGXU9CcI1zdAN9ppux3Yef6UQ7negCWHNePbAFOMEEFsDcHboe69SrjQrvRDVssssZNeZgMSY0I6spiqlgfx0aA29EuKpT01GwABG3dPOJOsn1W8wumMHU8GCErHVfE19am0QJc905PzLZojX3cbrk+Z2NNO5S6tR9gENpRsixTMJb2vnLIj8n1YhryCIvoQO7rPbNZdedH1IdHvRTHk1 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(39850400004)(366004)(376002)(396003)(136003)(6666004)(83380400001)(1076003)(36756003)(107886003)(2616005)(186003)(26005)(41300700001)(44832011)(2906002)(6486002)(5660300002)(54906003)(110136005)(316002)(86362001)(6512007)(66476007)(66946007)(66556008)(8936002)(6506007)(38350700002)(4326008)(38100700002)(52116002)(8676002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VlYtziPPqyVZMcCSAU8DgpjRJCKCQxd4zuj+GkKqu1tRfIofaBv+S4m+wO+l4OT4hRCtUY1c5booz4kR6QErNNf/ddCVN/QQXxc0jWrnB4hLMgCNB1OQwI01SmMCkrYzgv0KkP6NKhFmARCg2aQGf68nLZNpNF69dWEnjYFmoTi48dcVYwUr9sAo4tOv7/kZH97Zlh7+0bi17hLpvpvZz8qtV0EB68bTMHFmFUSHsApIbPTj4EV+/MlHuv4SXkcQFntwLc7ySfuLKk+ltOg6hfDtLyOnnqUYTTEJtICAQCfg+B+oo/9xSJY5UuK5dMgq74YOxw/h3YML3NxRX4PEeJlurNdExe2rpBAj3BIL2F+1G3q+u1Bj9XJdZWJu1LL5yaMEQnt+OfTi6F7MSAqklUmvo8Td5Leh9jmMa5oQmuQiwksK2MO803eOvC+7/lN+TMConCunN7Xqj92VGDrNwThRlraXwJI30o1dRFgDyYmZF0xQmSL+yCbSF4F0z6eVsD2myi5K/AjLxBmoCVg8lRIGx+x/L1M1rJdvo1r+nsOv+XmT981WpBezdw2dzfrjIXS6Eg5zOghbc9xlKHrEXiFS4E9/fDWeY3sb5Ebm6Z4vvdTkb1VStEQ1WaC92H4vxjCSfG8Gfj/EeRR9iHAwIQdiwUp1n/g60vpXBsR3nrQ9ZvYfYh6sOMB7gUZ52FDORSHrzf3GwV3DU9XrtApr6GEeLUQCyAJicbLNsXZ81tuLm97s0P5Cm1km7wcnn/yF0V+Ua4wiFe2Pj8IFXvntmQg6KTLuUHLukSJtnr4S9BmNn6+kcRzkMxZWhzTrz7//neJe04OiOkjqvUkC/d0cgTx157R03ldQj+xXufnuskmiLLo3XBkaWc5Y1VTkyFm1NMvL9iEJWTubcgb9KVgkIjvSbHi+3BuPNx0nlgo+xqsgwFnx3r89bPTKCog0iFIx93AA1r780a6iaEc9EgPU5SfsXcbFBwMVbgflDfhNutDT+LFkYl8xxsFLvz7wZQFiu+FHUpkCnbOVomxbYwuPmBDgx1Dqr3c3S1n3j7B1kVL4ukrSfUgzFoKI+CGfLBJ7is31icvcdXMsXPXtD3L9Tqk27ftCYM4xtM8czLx7xAXGNfhrNiriXURxiHCt/w5oY591LaLZTkuIzSSLWUERuw2k2m6qe5n0ZoWHUNojAhKzFWnjb8hxAMgQu3pvR7LvPxOI8tXVyoCWlpo2yKANbmgZUIochVcx4ADhVy2DGjzETB49Vcu3n3L+BDyUPKtx2NJ606oxqEnheUNI3VJRt+Qhrzc3KxELOkpOLQjVDGNmCVxhWINi/8K97AKxtRtR90vtturXQvMmqowsztk3UPUYWsdKnocBeY0PbHiF+jB+SCtWnsByvrhV2UmZ0uYdbKDY1+zJ49lM8J/OKL6vxS/Ge2mTiREhl/312CC1MRo0jqp2HeN6VnwmokBu87YS+sdiK2LLMBh0RToU9lthKTwUD4YqAU4Qx+pUMEmVh2a6kbP47HdjewTo9DQCs+vGU51O367NvG2T3sPi9/D6QOC3sPQbMyXn5PMKoFSHAcA3/L+B9aAX0jeqbwAo3t7Uk2avnadcEEaLOanP3fI+rQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8951a34c-65ec-46f9-2014-08da66ad8e70 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:23.3465 (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: DWHGAU7rh7Jb+YNlgra9CB6p+xWy/ShU+BXCeoQkfIVEIDXhYJXr3kSnYErZwIo2pJPy2DhgLfS8egpFDyhF2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR03MB5243 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150128_739189_94DB429B X-CRM114-Status: GOOD ( 14.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 Some params are already present in mac_dev. Use them directly instead of passing them through params. Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- (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 Fri Jul 15 21:59: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: 12919859 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 BF7E1C43334 for ; Fri, 15 Jul 2022 22:39:24 +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=5dIwz6sWaLMPQPtpHqrS9yPcNK/wz4/iL3kSZ/rTKM8=; b=bNSofAN05YOjEr OyNIfDyBD0j5et1+rvCrThUQzdBeFy+IAmhmVhLXEpHmzrAfUvClhFYN/hLY4CaWhexEcvVmX1JCJ I7Og4sy6vsqt7wLhVScQTfyACJAOTbno0bavhtf3d0qtc3VTumlDiHT47ZSoXiZriLkxPlbPgrj3O BajZMpkwS1d6NpZieVJCgPDICb4ANYEIqVncurx1sfqhrBvK/7jBlyXMFsTo2i1svlPTnl6Yo98wm D6/wwzkXwKYdfkJdk56FJErf0naEYu/52u/IuqZpxjiH6iHJMMcRXR+XvcGgmZlEm3EFZps9nTkhT gqRlfaHREoohj0w9EhTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTwW-00Ap4u-Qy; Fri, 15 Jul 2022 22:37:54 +0000 Received: from mail-eopbgr60055.outbound.protection.outlook.com ([40.107.6.55] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNM-00AbL9-Mh for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ARGKlOlKvSO0vggmPQEEfnC2oM5Q3c5yVHbthFJCOVeo3jc0okxJF14XU5iZVw6P759GTaOLUC0SRGxkaxv47giQvYqODGo3ghHpjARWCva10HfWB3WoOKagJuLPx6s/utp5yazyWVLfbU28i2gMjmwHA70MWjQP+bqko/Um8FLe5f0i4v1YiVjdokEY44F/NzPf3fV/CORP7BDR/Xj7dBgDVcIVy9oTH686MYTXPfm0LS7h/dCjTc8wG/13X5shMEEE/TUdWWr/S9q1Gj9hMgDJN6f5cYXYcjSYFSn8838Tq4eZOkhKUxNFJTY+90yrvo2nNs9Cj/yDyyNLCpSG8g== 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=GCnkFbU0TAj16icomPgcXktaEQeVtiaAjBFYiBXhIY4=; b=gy+G7aIOexnC8fByjTuEZcHOioxyvqsdYx3Obpl7yTmW9AzEpDXY/DlbKmjLMk4q3ILPi0x+QNYOjZZL/EV6K/ZqEL/xwj4kqlJ1E1c7ZMSR+UNGS3GKyzjgWzcGLCYYnXkzgM5VPsuhB3vLvsGo5msbRQvGVCZ8reRw3WqQW42yoEEXjALGg+UflMmIFFtuCl6rM+UDFXFnVNEdJry3MReuIUEiIfludvXYngIjSRPZr3Vox8+wIkYyPpJg3UgZ0OUEYgiemgm7j31Pr3rUt3Yo0Uey+te61bwqBeyszKM8++LmlgO0VRQSnR5/C/FbM5gMXKhJ3H13FTlCqGoUFQ== 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=GCnkFbU0TAj16icomPgcXktaEQeVtiaAjBFYiBXhIY4=; b=cY2ff8coSdCXGDYoeaJIRQTCWKAH+k9WeumqqfjISLTdVYalz21ZGXtVomtTwcj1l1BGFUT2bwHiFkTWlspykPm+bxGOchJPIgYfWEWDVYta0rMpdpLiwVC0ycf6aLdpilJ89LEf0zCi2ivLhOkltyN2XL3rspG7XQ4+JFm9/m0JYfVSVCmn1KdBjMtYvGuPlKaRn/5yxbvLyD1FGVjDRbdJbi4TG/q8/WbmT/9UeizYNPVoAf4KswjWVyYO21PinCBRNsWn7oVwYWsX1N2HaM1B8DVDZHEXcX2NCl4QkU7Q7kU2ChwR9jxKSdnAxKwS7wHhvAoR5v8m7U4oN63jpg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB6PR03MB2902.eurprd03.prod.outlook.com (2603:10a6:6:34::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Fri, 15 Jul 2022 22:01:25 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:25 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 32/47] net: fman: Specify type of mac_dev for exception_cb Date: Fri, 15 Jul 2022 17:59:39 -0400 Message-Id: <20220715215954.1449214-33-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 443fd466-fd3b-4e67-5c55-08da66ad8fb4 X-MS-TrafficTypeDiagnostic: DB6PR03MB2902:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zi0E5cBd8R8pmHB3ZZaoFdUmO1gPP8WxhYj64P2GukOw5if2lYUK2akcN9bCc6StgjUQUJriOMNMfwBPC6viql0GnCql1KIWoIiONE2ASBbEle0LIlOUhTDfc6lBMpyn+NgdMRvxnwE09AHMvLYxxacZyhIM/4MCy1pjgpcdp/swr4Arvw2wNdlSAqf7r0cZjuAwvn/iE+Ph7Ad0jDLzBO54SK//0j53NLgONI4azUyvZaP0yWsDkDBc1chPXRklm+pxTPUoB7z+uMGNdWjh4L3ZYevSTLl7QA1x2Bbf9q3aOmOYRBH2rwkMg8rbXxH4Te74vxVTl1Xmz/6DRgGrEYmSCreJyzE1cyf2KUflPS3SpAdJpnwIjS01iX3K+OPl6WIqHBpDcrl+fd/q1jjjequ5eFPbGdzzW7E7dY3AvoHS/IpeSl3q6N48RVYIXjJDAxf4Soo5Q4eeY3l1+aEHpvBL/coXQHii13SQ7C6NwhUqXLZ+ayqXnBin4xWHv5hZo774HjvIXOAFy/L4BUmOPWfky0uJG9MiJtONiWLKvYFZdPTsunZZwK3GJ/RqDNVFsCuQaOVhbgpub/wh0jcX9O8AjGabdSGlaec8s2G+GzXaudfuwL/b0IVzZ89JyKKwm9DeWfmaKWNg5DcfmKwrtV9/H9+306zDtDn5SJJwgOjjRtLVf44xkm3NCLfHi83VRCZm+ZnjRGmgFtO6GBCRvj8FUAeu+8Df6TIYJNaKBn0nCRpGjNSsVfDEO14PBxq5oXQU4RFoVNrnklB6IdmSG9x/PVZZeXTfFQSPY611cxyF7b0WO1hjTUUmsQh1T0A8 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(366004)(39840400004)(136003)(376002)(396003)(86362001)(5660300002)(83380400001)(6512007)(1076003)(107886003)(38350700002)(38100700002)(186003)(2616005)(36756003)(26005)(6486002)(52116002)(316002)(41300700001)(6666004)(478600001)(6506007)(110136005)(54906003)(2906002)(8676002)(66946007)(66476007)(66556008)(44832011)(4326008)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ah9B7cwfqwMre55+ElsGIWVYuNiQXUlocxc8Rem8M74/dcSa4Fek8L15l/xV/2Kaz+HPf/w3DP+IOO1M9PoFCd7efygBmaZOETdefsI4xDrsyw9UJY6Sc5hlpvAABOc6F9kleuRBbXN6y0kKwc+YC9cOWVStMdkxUJ18LlU8uH4EpLVpAeOFQiqjqZ4kyHVTZbkYRKdPKjUsMZlRVWx8EpE0MLRnXh4ou0FicKr3yTpnnp4Hw4ocBzB95mhcxO4D00D9s7gj0+LA74+FurqaWtz7xo+IxlO41UJN6aa4AHZpSj9sguf4Ni0sRb1hZyZyGSD96yeZ9XpjbDJWLHvAexTGcUsrLhtac++uC4fnc4yC4OriLgMZqYPF6GgIgt0vvHJQI7cpJaubpDM858ee32WXch5Sh8QYSpPJDGeP+l8QxXoeS3ZxW0Zt2l5exARTPOTbMkCd/FddT0NRZBn1n/Yph2/NM0ScnAV3jA+FyPZEHvcYE92hzVY/IBECSC3xFkPpM7iG7pftlGeXE+JNEEvgqOhswUQp+MXbCaG+zpoDv4dXosgxdSLRU/90pfrrorVQP+eaLqlwtffgVC15pm5YLClxepV8TzDaWPZ6A8wyqgJ+zMDMGKY1zCgm2GVeoNNavzsIrPSQYNH/fRNW1oEsU3A43mCB6g5r8w5r9pW2Sls3EXItzqtcvSaxomuTgdkEMI9Nrh7PmvDdA/FbITxW7IHbzyGgLFL5KcD/dIbQbzfgCiEWlw2PaEzmUmUIVCSoEUIvqZnOvaYOwnalz7dY2TUTfX4hy1mbLT/oWxuLonM1ppaKG1duENC3QrCsH3R83m8c7Dbh/++fcvgGLrDJMzcn0Y3sGBfJnNoSsMc5GBYxozcMocnH6J46+S7BHIcp7jJsv7Df/8gjhfTi8XYphbWIF1dSnhWZCGHnp0Pxzku4YaXLiKnhPqJb2ZIF0SO3TGOKTbH/Rn+enPNGaDbnHKAzMnEZTku3MSlVIOqHh86k2zdznfnHMWt3j7Bn7viEyp1Xd3Dc967kNzNe/8SpmBg2Jgf6bNcoyTlmh8uLAT3/TK2eINI+nWkopXZ7DkkSkTEtvf82TOCZ7jd6WEFVeeOMJ3WCn+1yH8O/LBzpOscaLnObpWT127os3H1FH2O73UyjQ8dmPCo535qcM+VCG8dMS7FQLlRq+vxcg9CoDMRAASZaPYdOiCINeXsfaGRIMJZN1kWCVDuKZRDzsiEHyzGscohlmb5rA5fcSclqo+xXCrvxxWYMwgdZgvRlf1lN3ZbFdNwEl6y4xfv89uMFOvoVvj9D4S1s9jD8cfa3SXKq9siM1OsW3sGSBSvvlxbiDvDntT7UUocYpsWLbwhvXfPGcnkvCw6tYRdpCWlIYMLnsq2UJvbY5wNmaQEIGn1rC9bRXxG9K4YHOxOgO3XgC/z1f3Ca+RZmG0TNq7KZsiBuekDwOC8mytHkXwcEVXb77yMSBWmXuVLUX8nmK/lOXaWVaj1DFPnODSaL/fG1AekNeJtByV8UVNLQBca7h1CBWHMjgPMMAl4zoxLdVxeU2pGBwLYeNAEdD/Hc1Y673l/6jmawuJqt0FM6VjYdQ42ziqWZR57mhfJZqQvfXw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 443fd466-fd3b-4e67-5c55-08da66ad8fb4 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:25.3933 (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: 2QnK95Cb5Af4zr1KLS6ELQPTGSkOYcHL8xtOTT4JH4s95Huc+ilQBvCdgJ/bpM7XCKLHekuwOY2TGd2W7E91BA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB2902 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150132_806531_78C124C1 X-CRM114-Status: GOOD ( 12.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 Acked-by: Camelia Groza --- (no changes since v2) 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 Fri Jul 15 21:59: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: 12919860 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 E6B7EC43334 for ; Fri, 15 Jul 2022 22:40:49 +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=yiwVzK0k7fVJmS RPPF9XIlBghTXgGkQPbveP99a/7e7+8DJteOGd1rxshI/wEyyrWpEbNgtYh1Eb5jdjDqBnjZNAJpP DM800X2yx62drwdHHW/49oLK1jhGmhGn1VqI3+1GxNHviG1aDn6seitepeWKiGB1R+sfMjNKsePN6 bLqbKVdZHP5q59Pgse1rOrwJSYZWpl8D1GcXkfubf+w5nsSQcPFAqD7lTyMFFfKVhAd37qvdfujog HhBjZ+sNzuTjNg338Z0mTfWkkTkPhOvn2Rk9oeS57GWVVLz7KypegYEidBdqtPWZVXR8xfCbl/0D6 ibKsK8wXd9LpvU0Aoq5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTxm-00ApUF-Ho; Fri, 15 Jul 2022 22:39:12 +0000 Received: from mail-eopbgr60055.outbound.protection.outlook.com ([40.107.6.55] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNQ-00AbL9-6P for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ge1LK00p4qsx1cJb/F/1xDhD7wmq/iEhYCJsS3T3n1HO/iOWl/tNm0IxGfqeOYq7Kyz7Da1NgdqW9upsClgV9Zg1VoQkIcMADQh3b78NhEVZtW1TjitE3iTDgS/Z9dFgWqtr/UiIJvXYnlPX8i55Z7jdI44N0OvyR73/Tf6q7aHIRUnjlwMV6+8djsiOjtiuB+jKUCCBYzhWyFeHQLvpkaP4rvInOlLmohHGrIaoXNoUEu9Tfg7ThSRSEEcdWMqV0mVVWYG4ugdkMJ72+HWZI2wzYNAA8FCGdB1QLAm90Q3cqZG09TzUUQwn8Sck6jVRNeIxPRLwNOHEAVjUwb30Fw== 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=BRSUA4cI3hkV898BfyzyRrkgCOWsPKCve4pxVDMlGDMsGdUo9wb0uJejD8XvFGMShgS8pKyGGDihck4E8UgrAVs87RKSRJfbNVwqm7L1F9iJrqWX2tHZO653l6yQvWnV0tEkzK/YeyIzQrd0l2Tudt9InGHAJUDWMOiADE7TlHxfREpnfuRg3vo2xY7kspWFD8dlCRL59WpvrA0SZ9P0lkSWdz+yh9OwqFKBbdgbzPpT5MkqCAZYU4MTIIf+s5UYTkjJCBgBkrLklitQqftdftGHRBLBkYpxTPOWoy3MuyEPEoE3DJN3tHYFlSXDnmCW5DxzqPsLl5SS53J5DnPg0A== 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=yQK7HUcfEbXBgPMS2BggpN36aym6b5OclmccN7UowuWab7wYp8NnKmI/HQ2R8Eqk8KRV0BVKx815P/SbAO/tR5htx6cHFrMvBnCV8MLlHISP3pYqtFZXjuaNO0SEvaW0wNsB+yiDUsMmWVWgfCsbU2p53iHMzC4LE41YpO4mjGlTn49RLE6UuE0VqZkAwpXgz+ogDV7kqkG1HA7WqL5lVjL6KknK0HlVqTyyIQv7nx5ckditeIURw072up+GSq3fBoDmRG6HhU8Ow0u70+irZnTeeaPsAIUWHjnR/dV+k0aSNn/sxLh1MR4YP4foDYZ+vA9hcSPUk0P0AeB7wt68Fg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB6PR03MB2902.eurprd03.prod.outlook.com (2603:10a6:6:34::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Fri, 15 Jul 2022 22:01:27 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:27 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 33/47] net: fman: Clean up error handling Date: Fri, 15 Jul 2022 17:59:40 -0400 Message-Id: <20220715215954.1449214-34-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 48241f1c-f73b-40b8-3653-08da66ad90f6 X-MS-TrafficTypeDiagnostic: DB6PR03MB2902:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P9xGR8Ksh1zAv34zXVtzWtHL3CtSDHO4ZY2gceuLvL0mvOR7mwD/DRcGc7D97yU1e0oWYNnNJqaH1SNXK4jYHoyS9Oj+b/1DthLD6Ek+NNYwDBF4FDAHALZNo5LDOZeMqCpoRRRjG7Wl1HuLyWcZYRZjZE7jNrHgw5klWH+rcbY4Ifojek4RUOyNlWLt5t/Li8eM7edxkrNrAZzAqBICc0yKcFvLQOWWCv6Y0/UYJ4p4quv6bwEGg62kOpvlbXT3Hsgyq5vE41WnmFYlxhvbluY8mqdTihn7MLyAewZ/sZKfqLuYmnJbSIliX2v15jY27zs8haNXFy5PZxSXS6Ji4iNXh5ehxBTou1bjgurYDpCp5aAHDQOwWK/N//JDnmSTqhgRWqdfxhVlJ4fajY2afYrRCMgThIo1P4BzahkQlzEH70oQh+qzG9zs5cRQgR/Gvp9gxahyp61XcpL8BWgUZrwKqbJKrH3JCbuPiQleL+qrO05YV1fk9TLryUBCXSDSNQpYHDsSLiwYHyf3GFAW6gIpmzU3pnenxHLhIhpKIt67wW5m7B9n60ocpLXi+EDk8TbqLee4urzNd1fjHGdhH1Bkw5mPV7de4kVI0EFpTT73vNLMxxLOLJgAnOaC7UThd+wEP2y6k28qo/RmeulHSJelDuh02hBJWSi8zHb4O0fDVEaTQH+xPc4N9KfFgp68fwpS5jgFitbt5Dm9M42w26OjxAl8A0zueyLeCgaONfy5/80YuiDQsM95AjOBe2uVtUdL84mC7yR3U63syb0oWMwNy8SVutanxcVxfPHfDZ0xutgd0EccTfswBAtS/kgx X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(366004)(39840400004)(136003)(376002)(396003)(86362001)(5660300002)(83380400001)(6512007)(1076003)(107886003)(38350700002)(38100700002)(186003)(2616005)(36756003)(26005)(6486002)(52116002)(316002)(41300700001)(6666004)(478600001)(6506007)(110136005)(54906003)(2906002)(8676002)(66946007)(66476007)(66556008)(44832011)(4326008)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X3ud3n1PUIDTo+ILvitoh2PYJLXxONCse6OFjfpnpgt49T3UtFwH9iceQWmnGlLwPgnwnVqCe+rNx9n5TqbWjpO0rXawBxevboRuFChb5S9lnENhIcdPmQP9NWR4oPwwImJIXsFY6ikBe/5fW39XXMUCD8lcMmpIl/YJ4IPSLie7/W9/sYeC/RgtbugFzJrUVRRMjhLZISrhdF02Bi9C575FnUYsxlPdzP8IzWHzrUfFQZ+hDiHn0oEFHqZei5EQrfV4LlFV0+v1TbYe67MabUBJfu3LcEdWCXhzh6E1CUn1/XSV2M+eWVneNPXfbQmgIP4N9lJCgUUFQDQy2RlMaHr6ebv2uqYoyUPY2+HzvKUT6+08Im0g2YhetW7HH6WA0srf70uDR3wBQ/h9iQElSvbvGEogEicksIZX9Px8mqFoNxoBrBl257LDfzDyZXhhBUiqoIV2GPHZDSSdV5JID7MnCZxKIE8oCIKJ15JVQQYunv9kPQqLUjul+QImHFManjlKelYvCCFH91J+bWrpxcOW5WIEEKDkOG+aCMXREzrZlZnO0EbV/twJY3np2U34FNUIaAsWqpZfgwnrgqAABYvMDcxst6rvQ2nfJe5anm5Hj6Wf3UbQmIRNwlYz3Dz7OlKhROTa/lUxMG799ugiSFnyHOrb74Zv3jnY50ofD/cIvpZQ8kaSfkR4f0g7UELMuJhfk+93AQUPgpNRv1vxvbRxk4fAo1xoxMqCNfAmMZmfgMFeHJ8uNENLonSlvlZvYnabtb4h0IGzITIUCUtAO4jcTKQ0xdxl0oXbUJPGWHUtd0eAeifYD9gVMZTPNZdJ9HQk94qNtJdKmVKVJ7tQyOhJkEkOJHhFxdXu/b/PGkYko2wrQmypIhH4DlDfwKfYheHoq1Y/81KZc/utBx9tc3Hac/p+b/JSN8Wp1kvzOg+UQym63YeQSAAqyk17saBMo0/1t2z3EOM160Mv0wVUYTtXCR1UNrQPYZEIT55ubY1Gs146Uaos5e3O2pfowEdmy6PzMSGo0aiBtU6i4xnyUcnVCHcdPHiDGkw7DKdtVrkAMIks+Y8raZo1BSMI7T14Wi56o61/99U3NmbVxUSGu55n14goS8TsmlvDBrvMuroIdRcUsyB2vTS+4iDe3MssYG+YVIuQpg8Sf9JyJIvScUF8kfHjM/pH1qrlmpDfFhxGFEqHNPFbdiWpm8bX41pX2e1uWcdHg1qWYEAx9+J+3KIwMKYl8Hrj9vKgvEMtBzMBVbEP6/gWQkbgY8y6oc0hl1U/2tzwJbajlNF3574yX2+iFf1OpTlUNxYnyDNtW2iOBdV9QBn2FN2AFHmZrU1o0cZ3BNJk4oIK9+8NAzag4zert+spd3CVnPNzrvrwXHrV2P6V6DqoK8Bp+JP4PQvTSixucU1v+gp/0V0rAYLuqe4GIVQOKVEiQRmaeQOsC77i/A1inQFydY0htOLWU5cqDVFQue47EVXWC5eyGO7out+I9oVuN5d1gHjPBmwh9oF4QabbtVbiLkv/bx555qMyvSX/ZWY9JxkYZv2mCA2+pKm3MsAkEXywy/g5N95+OkpWSA8MVZEvhoziB0kTgduy2/ZWzS93Y+giGLRlefi7nA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48241f1c-f73b-40b8-3653-08da66ad90f6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:27.5026 (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: IAnovIGUtPphlR1aTEmEkg2Qeygp+JUNWqun8WWyigdB18IMCmNzqbbLv7LuhNhUWo0u6+QNfQ0y3/XN4M0DGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR03MB2902 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150136_296705_0C23CCD8 X-CRM114-Status: GOOD ( 13.03 ) 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 Acked-by: Camelia Groza --- (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 Fri Jul 15 21:59: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: 12919861 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 DF45EC433EF for ; Fri, 15 Jul 2022 22:42: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=NVWuTUSXczCLS1Yadut9ZK4a7dfhcLPPFnL1sNfoQCs=; b=fOZZwSjVGCL3Pa yeF5wqgPBb4Oq7cB7XMiEaLZTR8hFPwLeYy9zgfKwfNPudX/406ZM0bDM6XGilvrss+HmQxnS+7tL KLwBk0lfAK/lb4q7cgkFuNDOabwaUv8v+O3CJXcoUxjkt8j8vvxHEeEvQVWApW3AtCcPNxt4MUrDi GsL7YsgLS58dlz4kin2jsQi2RP4yyZ6cikLk2EhnaViih5r2aHjwCn0QcjfCIQ28D9ONG7JEDHTRy zE0ATk5FCDEa/H/D05aWmgddvRpazAXkya2/cEkYtE/5XaQCP4mdd1U6HHHSGEax8prSDFNSdTy+O 0cK6QFUiqQIzuz6ovUTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTzJ-00ApxD-7M; Fri, 15 Jul 2022 22:40:46 +0000 Received: from mail-db8eur05on2073.outbound.protection.outlook.com ([40.107.20.73] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNP-00AbaP-9D for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JTqpAX31rGdkgn8yt1iedgSNTbF0tPX/dotEMTKTEIvWiz/7Pn/834Ur1gXspV+wKgdaH43S9+HVy7oqj29GdNtudCjFQCYgwLXSKJ0jufbrSW7xPb9tGZP14COdvvct4Wp+BkB0wZovYlZ1nzw3myp5CHzQwRCUuoj2HkbtBVjXN32Urgit0Pm5yll+1Tm/pmLNSk3MhSabWRuRn5VXVmWA2r0as0W8iXhPYfbF3ZmC4KFeM9nsGt68YiYaHhVo/JekiXZMU8TFRUl6i8pF5vlfrHlmLEsEoNlI1TtrJV72xfhbum6SZro726axaI83n9BmboavMMguAtb8oh0yVQ== 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=r8/eM0tio6WPHOydqQD2/9WPF01qGFSIswsP2saXMAg=; b=TNF7mXNX0ZaoyydizbpNcw0MuGw305B+lF4urEqI8uvpRxjMJRpOe4eBLzY39JfiRhVFV2ywyEUKswkcSHLN2E90WmSDhMhZUKKjxtPvK0/2sI99hscFH2qbjjvI5jFH3v4hq1NHatgPzTlmUqS+VOgHrbP02MYV65jnKkdojP5iqtmIHD8sBzTkA4FN6hJeNRu4v65Q1flCUccAE0cIPK5HmKUu7653MTZYxCyVSyDgI2L2bRrU8Wzc0iRu25GB7ICg5yR3ZP+e7hIFpZd1GE3tEuXPAsyqcNtPoqZrGQ+bgDFp32+9I/sKqiiCbrwGZPbJREYjaMe+uHgX+FYosQ== 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=r8/eM0tio6WPHOydqQD2/9WPF01qGFSIswsP2saXMAg=; b=1ofx51Cc81mpN7FW5o8N827ROyeVggGQXVl2AC6NTEgdvDpljcuyV5lu/wKshARwUG975oVp4a6+CemuYZdDsKJ7F6EOCjjWEPNlhJ9nE2OH/8gJLOilA9QGGB4dbLQCS+UTOup0AakH1SPINmdGY33VAfTATT4uRYl7qD4Jjg8huS7to6cEP2LSgejJWHVeiW9x+wlJfFBsonmiYp1GaSBfgEHeFnrhgqEad9bNyEF0lM+Kkx208hYdbImAiRsP7mPjpcBBNBCW5f8UqiOWsMqPIdG0LxI+x6lYeFRj3DCDQSJW5iCO8VmnIdqbpJ0CZ/o6TrPl+ENTRYO2DaUomg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by HE1PR03MB2857.eurprd03.prod.outlook.com (2603:10a6:7:5f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Fri, 15 Jul 2022 22:01:30 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:29 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 34/47] net: fman: Change return type of disable to void Date: Fri, 15 Jul 2022 17:59:41 -0400 Message-Id: <20220715215954.1449214-35-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 91f20521-056f-41c1-ade2-08da66ad9235 X-MS-TrafficTypeDiagnostic: HE1PR03MB2857:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GOglLQiJQGw+KT//zFjtN6Zmhr+ysE5Pq9kAzp5L74nQidZhJyqBG72OxNE6huuPm+tECfMnNkiGqllMrKmMCIUKHVDAJCt6HanLs2CC+mJpNepQ42PtbEcCpcto0fNEgidiiKMm7j3ulj/I+/i4N5Nh4GbGjjgwOwvPpka+qBJoHfEtVP/odqfDF6DhRgT99AOEeKPHv1g/DZorZxTbvsTFo65Qgilz12Q4uh8Dy9v2MiuhzDIq4Oygow5DRMbk+WL3r2xtWsfjylVHWCqTsM4kxcm+QO5zjfFLQUwGT8OYEWRwP/vJRbEKW/f7wzLDGh+dyfdot6Z24htSX3ymQQlWJsgEdVrVhIsObf2+iStRh05Q0z7FRk2ZGtVKg6k+BGWJl2hdrSTgHxi8iJ3A2jxoH2VuiPFJ5qLdQu+xl9X20QUfTuTamD0wM6JRhsbEaOASbZ6LnfFcofFA5ooTAAaqGNwNT64fVcWB0YX0BnbAaUnDlTpgCWmAaPsMn3rpZXKX1ZF72m162i7vJPK5e1kezn3eI0pPq1kvihyj40Qy+/0uQ/xYSA5E7CaC739PXaSJJDTeHqiMvKhyOkAbPpM6pwzoTzQL+H9pIn0gSIro3fliaQo4uYSy0/HsjQX+jxcPn4VJYGWtfLR8yzqh3cgDzUXUREN+GElyYUFKDGRFqGMAiucIvAlk2LlVfjrRik3a0fOT92tXeiWUzGeR/auX9M39D0SAoPVSMBE1BnFLGJyUvSjdXfyi99r1BcOGGdmKeDHIT/XjpbOFj4jTHzGbKjsk3blIncWmYE2RIr8y8U/dUXdh0ZHC9LK5y8jz X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(39850400004)(396003)(366004)(346002)(136003)(316002)(54906003)(38100700002)(2616005)(186003)(36756003)(2906002)(6506007)(38350700002)(26005)(1076003)(107886003)(86362001)(110136005)(5660300002)(6666004)(6512007)(66476007)(4326008)(8676002)(44832011)(66556008)(52116002)(83380400001)(8936002)(66946007)(478600001)(6486002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: roAsmrGulKBtbI/awM1l7T1jGd3hud/I5ZMw3tg4AoKnNwM93pZO7midG9SqQ2FVW0CQeMs5fMelEdLtt0kAFxpUC2pwCa2A0AJXfiXFo3qXSLyTrTpDwlF0/zMI40gOWnXEDM/hLVEPr5zTzs5YF9PNv2SFYragjP1BtuP5K0j25iL3HGuf2D8b8Y2Mc8j1l6v7KruP3kFph5GPy7Xkb/aHyt+SOoSIKWz7r3nSQbXJH1h6kMKFwidebiAfOaYAsiFMl818qoC/fwIFbkVIdcs3LvQq9mQWuCrWjfi//6yHQgTUqPF+OA9B52d3TalLDLq1c9Wg/uZUFrlpAPRxV/kbwXqmgtkOobrwxyp9DcKGRfz5cNSCF8Z+nEWMm5Oxv66JQaVKqiTjc7OeHfyo4V1JBpmNaIcrXkhKAYlbcWjAFbA/B/jgkeXzKw+aIxwaWyoeaJ72pxS4+3SOUbIjA1Hi3kAZ2ycECV5RUiVGXclj9GoxMgHuBhdDgKi3fSRl2VqBOv2JxsO6NruuGSnz33Qqcclu+kVoc3DY7IrUpVKJaXoQ37sFs0dxO6IHP7YZkuF/nUXxEV2nK7F5FRleoC14pb1IID9rHi9kwpWC4qvQsYC7MsG5K5Fbmm4P/xP5lag0m0m77KtxpAwPy44yNJWT//lj4JtvirHZTJq1Q55CgyUrHcCP2qzK+1I/CNqrWW2hHznohdgW5A507YrdIB7nzm1U4iJmX/5G3pZaXQw0Bii44KOS3LelyzKbg1RJVo5r0TBuypzMWLjvsSOV/irAg4uwMEOQOAd+dI2BFPOGseh77qYTyQJBUZZlxV0Zlca6ki/W5od0Vaa3Cg+nA2521Aevr9dFSwEV+gfx58TDJcm8mBTCfGtPI8sJMhWWZeO5Fn50Zr9g3ELpkpg6ctThriJN2DRmbG+CJ+V86jtfu8iATxAotfgeMo8MwsGmtSYlByYZOnwhP4SdGTgSVGtrcXkCug5cdBh0BHEOAv1wHnkl6dJ55l9m0uMC6RnwRKq88TG5wHH45RFHGZVJr/L8JmNCaB21LU8a4J1eGVTomas+j6D9uZ4hXGBI/S7mXXBudR4wkEhAj5ICU8t0PVYB254l2X6ZEp1cvmBXeIz4h5k+VUsAGE+3SvM7imG4b7iOHi6OZ8RynXccAYOAT1NZLbNknPxt9iPdIkB5xDp5/aE1JzDOSa24twQiLWWhqjSFs4vtgPNzMjxFkrzl6o3AqeEoS03SkFD6soaK4yVQJqkVHGKosTul/FPVq8j7y+r0d5eQVyk/djaJAXjmqFW49OTHbRWHkOU650wJfshpqBJa6ZCTGFGwTMzFziWVGJMku3FuGX1CueuRVjRYaBEkqJFPg1xoj7souPzGZo4L9qjh32BOGtJvwH+0feKhZeKbVoPGFKELTJM34JZUO6XzMMAtYvceMikgAX35bGQYrZk9MfJlbP327PJtWunnNpkM6ph2U/7T9vlo7im+uet3uhM1V9PwQFAhdU2DqOZZ0v2z5sufO0/VGFgSFvZxkYvUInkiRSQT64wPVnaqXd8ks0N0b+L/iLumJsd+vEsAWKDc//wbxIshfyyEe6rLbwBhC6A9tHXTMhz6JCJuwQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91f20521-056f-41c1-ade2-08da66ad9235 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:29.5650 (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: FionsTiKGwG8h72SlEriPZfvdBalz5otNHsr0InaQ2e8ae0cBDWBbhf5lXbmyPr3sXL0wYeKkDDlQpE5iqlBdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR03MB2857 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150135_387743_FB646FEE X-CRM114-Status: GOOD ( 12.85 ) 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 Acked-by: Camelia Groza --- (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 02b588c46fcf..d378247a6d0c 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 Fri Jul 15 21:59: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: 12919871 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 781B2C43334 for ; Fri, 15 Jul 2022 22:43:44 +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=THfrO08KOJFOkdNOJYcn8ufwAFQjIfiiGRShycOuBko=; b=Aa3Kl7lmziqb8S 0x85i981REGG9fkajsKNRomTB+rd2SHvMSpyc0/U8ir/NFh+ZboT063Ho1HNVq16Q4jGpE36qAy++ aH+Gw9CkFxlqWk0w1Vt8CAv7ULEfA14OEhrouxOZPRtNAGvjynQ/63VzE72FXNYXADNib89TNdkWS fvo7ROwYr80wwUP4xfk8NrvHUfL07ydwHPhISfYw61IRFm781BUWFQ0OMcWWegU3HdVQh5L2CHFnn R77VGg3nl6FX4IXZTbFYHu4z3r9Fw1rDaw6yDl+w+1891iS4c5qClprb3g2YA3ALJpy2POahue8i7 W9aFpMEcGSDvt6vshLOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCU0a-00AqOr-Ne; Fri, 15 Jul 2022 22:42:07 +0000 Received: from mail-eopbgr00076.outbound.protection.outlook.com ([40.107.0.76] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNQ-00AbbJ-CW for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mPn5fHtASWxEtWrDtGHmj/PilfMgNA0owgwmNVGPaBEw7MM802bf/6MAyLgFrBfzuF/IcVFrW0VN060VtF+Hlc2f36Hqo5zhA2eUxz7G0Vg9Yd8g3qPOzub9inUE8JEpJ9WVA1Gb5utMxN5g63j2OKEzg/vO98iF7cWAHBaZfX3/7cKKbQB089KGKGz753kk76GLenEfWloZnRBoSkl/dnuMzE5mNDO+cJiWI5sbiCR26WFtqUu4CCmlojZ9sHqU+y19vLuYPFV5Yaim4hE5MBEIdRVK392xfW6tdGAUZ19sSZa8iNzNz/HhXwQ0CMW910tP2Yk7RoHwIoAIm6jOOw== 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=P8XFDGC62zD2nXGJTNjkC/0uLCvaGCdRI3Vf97JodPQ=; b=bjhk13La4IO6T6s/R6+xpgZ5Q7r5t8ipQt+YWZL7MtnPRUlQMlxPZLi3BKrDLboMa6u/LhkAaBgH/Zr7J5UEygmsMVtGkzu4Q2JqM5r3WtihHGhOtdr2mDZfdXd6E4K5tMj7E4hS2Sv6Ze4MUAPpuCjE779oIspITftBzMMy3yLTxrUmI8lacvWI+vQ9YQVfq0jHQZtylgVorMjdDLrrg2SK/H/7OKprLydd6HpEQtHrMpKyv45yWaJWYb0LM3DhwSMhJ9RkGNI8NC/V0LFWz6B5mPKvDXHxcG6vdMMjkSsqO0UZavy9F095Xu64i7YJtUJjoDhfnz85pfEATBCPow== 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=P8XFDGC62zD2nXGJTNjkC/0uLCvaGCdRI3Vf97JodPQ=; b=Muwwt1/OFWx5GCo/P+SWJslLfUgR97yUbzLIoyyWiGGMt0GTfcgsCeR+l2twoT/Gm7FcCOn8GgmP71axUYaKHWgiCNrNsH9ykx+Rc3JSxC7iqvq8zwnT3Zs3RkJCbuwW4fHaFD9Q33TkE+VCvIx8s6QK/4gBrjVd6nvhP5H0zfOUhh9cyNnTrDTIZEhr1V3kzBRxNoANKmiqoaTc84EUJXUodoYcDsMH602+okHzGud05J+xYqRrq2Jhb7MhO2MCLIU6IQ4ZODQ52Vz0qgBsTXw5qhDcQGl4EwVm/4mgtGLR4+ChpvywLm/5m6CgPrtakrgREO9i2wIXYpTwQZymDw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS4PR03MB8433.eurprd03.prod.outlook.com (2603:10a6:20b:518::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.19; Fri, 15 Jul 2022 22:01:31 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:31 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 35/47] net: dpaa: Use mac_dev variable in dpaa_netdev_init Date: Fri, 15 Jul 2022 17:59:42 -0400 Message-Id: <20220715215954.1449214-36-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d0a106fc-0706-4ff2-9c40-08da66ad936b X-MS-TrafficTypeDiagnostic: AS4PR03MB8433:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bpL6FP0GgAYDDBydnmVxGVXs7pyjgqZbP70U+rZnosbF9WviZNvxoWo3ZFpW8ghD+0upyNaa0XVvgiSXX8vKHnJlaepegvbz+HnpJIpnTDxqSp2VQAkH8qtmrNP07OUMq46oH27AwmOgP7dLp5OV1eqnnVPm/xhgHAMf4JuiDiCdooWoRh1+nf+cA7GdHW5Ebx1rBTEyo39IRZvKz48LXlJQCkTOw+Rdi5X/PVYj0MA+ciVMFuIcblqT2cfUT7eS78lDRROc6S2cYA7TAoDrcYnM6/ciCAtMh51NCoPNPB/3lcFxM9ZGDfoydj2+ZTZ9a87X8x9Mjv1BS25yHubUUApy/74PSE6gm4rXV7f6miUh/thZyrlVXA22NDC15w0AlhocLcw8Mk/5nFhxVOhbybwFS/bimfTd+rtKoh3wPWsbYryMXNAOeuD6tHMlDr0eCA7pDgQREWXtoVBIJlGf8gIAoFmZT46ymVAEOm3R8WHS7CEyGu5sJGZozfqHp6/SOJXvYcDcqrK13b8PJPpfv2NeA28nAHxQhTKkRAEx1tHVOG8og1Rq69ryAs0DKlEZrh4Zzg0B9vy0Zt7ltvA/je0bN3OpX76FrBeIxTfN6Waf7cnxyAeOKJl8E5ylyow4Nn/vQPnmZqCk0B5lBChy/+bJdPbjvGImhxKXwMJGhB2mu5x5XU3+GjhTcvDZOz0Hxyjq7X0H7DoE9NiH4vllRCdfGv+qzf61nKYmls/s63vuK6enP69VkVJS2mVMiJEpQ8popZWmNNhIA+Ymyvo3fCH/QgQnQq8s1e0Y2ACG94WvpEnHwahSTMkqzi83LNfI X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(346002)(39850400004)(396003)(366004)(136003)(6486002)(478600001)(86362001)(6506007)(41300700001)(6666004)(52116002)(6512007)(26005)(83380400001)(2616005)(54906003)(1076003)(107886003)(316002)(186003)(110136005)(66946007)(2906002)(66476007)(4326008)(66556008)(44832011)(8676002)(5660300002)(8936002)(38350700002)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0KCMGrX+SSOx5LHpbO10T32joajN0tD+9oMjFGkuimUh3gK496C5Yj1UXjz4oXhgNbfx5mfskFobG+RtrNK4bMPx80B95XEpua1S4ZCU9G7oOzQDbCKKPXDKRH0gJA7tTM4Ygm0l0z6hUM6s98lr/2XiOP2padKZBw0XDAGuZWvkWQd6oInpBZJMX1dGnoz36X8HU4ZRTk9vEY0Flenc9eWKc1OXJMEhXhbYWNO+MJFDNvWrmFvywOYJR2VwEj0v4iHeOZjV1L5MR+ytPNelbGb3gCBuMh+WJOO+Ij4CZjdHWqyItM0R+x15b2VLJIwYRYoirXeieVBWggmMXMp7yQyPX9XPp3E2C+Pz38Rg8SBMO4KFQqs+nX19IOB7GRNnlsvgRCAZuxt0r12Qx5n86T2htyrZPr79mBBvXOiEjrudvSz73vpMVG5QLjXMrQTbnO95RkAcLLS0r22JZHmyjWVhzzUdkNV6KNKG22Zh5CpVgPwNcMAWAvkW60hrnnzBCA1wu7oOglGEPwgZ9vG99wY4xCRCcVLWpx18VPU50XSsDHcTByGS1nA8NloKGIfLH7gNZvrIwzcBbrLfZrW1upc8SsyWuXXfrGsRmzz78uZEgRyfWL7XnvcJIen3kAmAqbTbRQ8tvawi2iLXSTbLQs0bZ7JSpxnuS0zD2wOOhAkQ7lqn3IT7fDbAqmJnchAyzqG6R890s6DUTBEI9HUQMG3y1SvaizhGa16U3t6HdnIijy0peIw+FtOdjJ2nKN5eLbJXWgmk9BNGFw1pT2e0kTwYRrdFB8olpf/5zTY66sxYlVX+pVCnjZa3mk2hAfxwDnawOhctI2ZBALcfjRwVbbI/Ef1bQ5AhePS0fA52AUVMmaA3hLuh60WUWHdthq02fQQFD4RPQIWKnb4ldPOHYKJXX7YoA1JFKvSzsop4vlVyIFpQsoiKlTFAEd+gllpcG7UjhCw0Rl5obWwSajw3VUmWRG+MdBr4A+CVxUPFLJwVO2SOKfvnYzsMJk8VntREqrx0ibiXnTrNqiQtrJ3fcHL1lu8AcdR+MhLmPzgzrr5lSdagUm+V/NtRkuHSWj2FX2CuA/F4yCtt3XAQfhgKECJUI6JcW4L6gJSoeBjPEsH7D2o94zsVrzk1tuFl3gFW1+fEhYuWC4Sqi/bQKZAzX5UFXRR/1HtbGVSxiKGyLYOdpFairnezTk8hmH/IDwgiiD6zPJwNyekSrHKKPDMLfC1Jz9gv3J7K/SVLsQQ5Dr4X3fEdA4DZWpo46t0Q4ufvtiOgoCMYAPFn4rtx9AXDM6zLh4tXIQcNp783OxSZGfnpxOtPZPjHi5T+zO4OAfEUJX6XVyNAfLZlGvsLFuCa769xozjsGYcGWs4j7weFB8CSSqUsCQ8Z+2DRI1PKWSfTTWL8R8O+wBvqVdIAzHU3Ss/bk4YSIAkUO+GVqYS9LP00Lm5xzY96GrAaLylLpzttngIMKbEU1WqtLiurN8O6K0JGckOX0bIJE1pfyGhTYBDQ7Ir+aApm+LmZTeDA/xfj10ij9bXwmijIKca68dfeccIRP1Y/+v+P35Q0BOh65da61UKEmiESHLA3FtJp6Z/dI+Se6z6fiFU8x+JhkVSA/g== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0a106fc-0706-4ff2-9c40-08da66ad936b X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:31.6587 (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: oMGKh9qj/CBKugTo33eIo8JxAdgmwrFs13OeJLuDHvMA4zRk8bs9dsIkI9AmVxT3CMOFKaQLleLQoZFtk6DJxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR03MB8433 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150136_489863_4C3B85FC X-CRM114-Status: GOOD ( 10.97 ) 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 d378247a6d0c..377e5513a414 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 Fri Jul 15 21:59: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: 12919872 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 4952DC433EF for ; Fri, 15 Jul 2022 22:44:59 +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=jTlIz63a4l9+0dFavywjEFA5upPmxNghEC4rK0o1Tvo=; b=PtTWPj9R172XXQ n3bwJy4UkH9jqrKXnfXnieb4uEvN3U4f+JiwLE1sf4lxkBQcV40quL8ySa16NaH4Z2SfSqG5oilsK QacyWpnwSCejKLkIS/VHxWoENgplgSPy7PN7mqBxNlTYiTzpgSeLxBnrDmKX0fo8KP2/ftPkSoguW cSZ4s1lJs+zZm2t6IShVxzDaNF1vd2bY9NLuGl+1YkBteexQH2+zWDIYyJwc7q4uOAn8G8Bunx+Ll /KOUerVl+7AxFGmZIzMmdK3GQn7cgjMZ2i4WUW+9FR3iqSSkZ9fNcW96c/GuTTSaDVX/DNtzI45eZ ltOs08OantT4m5+70bEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCU21-00Aquv-0v; Fri, 15 Jul 2022 22:43:36 +0000 Received: from mail-eopbgr00076.outbound.protection.outlook.com ([40.107.0.76] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNb-00AbbJ-72 for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iAjdUvxFsMirX1shYx6W1B5wWZgDM/RTHfNraPVjRbK0D3cntIQyM4yjYY2TRjfD/X9qZucyWjzZkAMu+llGaFZzOXV/jfvoqnjpySOQIlQbuAexki88lc/KvCqmDXgG2Q0B/P4CifWB0+yOoMA4KpstmjpCu/vN94FeOEU6crSCeM9AEyTuzF4SXt+RDRlwuCIcE9FMCIAFuFTDXkiUx0mqfUTpzdXEq41cun0w5CPB9I+n2Zn+fzEI9iFFVsa3ig9UkSShgiGCM56CfbHOlWquORVQ1HT8dL7yy1bHgJIrYIPKpHodXDgryi8CjsabaLP2dM1o18njZnuh/65j6g== 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=hasT6hbSKpYPEJ2OuGoSIn5aDqRn8ixuLqCWErCLeDo=; b=g61V41b5o8j7N0u1e439VYWMOV5YroSwsu82cFCnA5+rhcX+csxJKK0/QEKjkG6rGiWsAOdGFSvSx9S6cCBAOAF8IqPuBoab0xutscY9GDpjsNnR8OQaf++IMDlb3SErFS9fpQC/9gfao1vakfmbCNB+ZLU6J6T5qKTQIFsYHiFbRlrsH58bCUW4NttTYRyVVCZk3rcnoa3pb9ft3tGykFSXJaJFUThL5k8LI4M8xon5oxFl19N8iiIG+w9+rRmKa4vzx/ksSTG+xLmdIdqZQi5myoAWFHcAt/slziB4vBHHqhxysxYW4SZW4hJLbKty/JxgKrMt3UfqLCXfRYZTow== 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=hasT6hbSKpYPEJ2OuGoSIn5aDqRn8ixuLqCWErCLeDo=; b=yRAZSwXrj+hu1fyu67UtunOwRhTPeiNSxRB2siz/DXKyp3mokQsMQma25pnbBApWCI7dbQpS1xKdeCftObvdBjoVJ14j6YYkI06JtYMRxMTs6S9kC4hingCIlUI82lYclSrwu8HNFWNQuEI2KFe0F3S8g5HwgVsV3QYijhmkB+pNFV6yWKWdEeAEtRvqsan0UxzHBhUj+/KYWplgkzRK/yUrkWpvQpEG3RgbFEuRTBFf8j9TuiY0XMssYWaCOYI8ujzZVt9EAB1XgiBpuc3ngEd+KCwr3tyhNVGvhkJJ1y63dTqFH9TeCKu6jbkWuhLuNhAbYNvrpG1I1OHQ8NEnmg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS4PR03MB8433.eurprd03.prod.outlook.com (2603:10a6:20b:518::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.19; Fri, 15 Jul 2022 22:01:34 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:34 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Li Yang , linuxppc-dev@lists.ozlabs.org Subject: [PATCH net-next v3 36/47] soc: fsl: qbman: Add helper for sanity checking cgr ops Date: Fri, 15 Jul 2022 17:59:43 -0400 Message-Id: <20220715215954.1449214-37-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: db3bb590-b0e3-45c1-5fe8-08da66ad94d8 X-MS-TrafficTypeDiagnostic: AS4PR03MB8433:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PkajheBA/FAfx1ROI5aT5JdX4ta1f518g8x/EBx0Bt/JTFE3A6Vymb43slhJkmKuHgEeXz8TiaXHYgwHVuuLv6PspWZF/bt9omMYOSSLGbFKp6K6/DakxjwYQ+5HOlHd2RJvczmEVAApqMzApISgPSj7Gjff1vz2m6uvr1/JxUAIJnNZ7HsVw5Tyz9oFZilgaP6Ip5ZZ60sskgOez+ruhhf+9kBPYP7/PPorLsWkl+YzdcecCy/Wbs3fOSavTzyzX0vDM9ZYuo16v5kC9QbbwIj1baeQe8kmlpMG8jWaCaa237Fr1wXI2YAITqY+b4qynuTb6nGiyrioxWlIc+DmWKdkT9K7wG3KMh8FL8NVzsQR7a6YAUWDahafRCu0iJLABy/hXBayTCWJWlofsw5L5L99R1F2MuxD+xIbOfr9djKcA7+UeUE2h2VVFH572lfE7EY7pfxQxf2Nw97vJz+pFWithLSiknXGRuttHOTSUOwiQrYBNMoHhlAN+kO3aamRXR7IpbgKMmt1qGa5r92KgRWn8ofl/oYj4pyrXIH4OqrcuO4v5P9RGQrcSh703yHMyMeDGQekEl28/2DQcvGY2DJPZuZa1oLXtkmuxXYuLpjcpHT/Shz5e4NlsoZKpFpgNN8jSD+j9sxFHuNPj1TMqlirTIZaDq0S6xUt1yLzbLWo6Qk0SElZbv0NhuvukilzN6Z1Z6i1OjKD0qev4sAFeLtvBom/AYMj4R3TphH8PKZUeorx6zjSYku4haHCIMLj3YlZ24/F3iTrMwLcJm6wlVSwcoMFuJcqDpTiMg7RrH1YJhTG1QwZKhtVR+q5c4Yr X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(346002)(39850400004)(396003)(366004)(136003)(6486002)(478600001)(86362001)(6506007)(41300700001)(6666004)(52116002)(6512007)(26005)(83380400001)(2616005)(54906003)(1076003)(316002)(186003)(110136005)(66946007)(2906002)(7416002)(66476007)(4326008)(66556008)(44832011)(8676002)(5660300002)(8936002)(38350700002)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ldXyVvx9BMmKoG3jpYddFHeF9uJEAw1Mrhnz0fdcEuLXFYJ0ALYczouA1WUqUSWiy+ixWYaBn47qud03UCUFmdEuM5yfQqpamSSLGT7qWcYn5hsHhMmtOIrra7h77gErB8xvszlGPtHze3mFiBS0ibwcqaS9i7leBvxLdtb8yfHv8NAdAEsJcVY8hXxCtfXPjXQchWcsA+ZQ8GhLrzV3y/XMf6Fzd0SwuMOiqLWQSkyHq7MFqYFd9stPMTQitB1vRbXB08K43zRyjeeMcBLfoBhAmjSUZ0NBInoQ/aPKMsCUO/sd1H/qfgOOjluRn9pFMALtIDPT6ljiP1z8RujqlFRplU3yJ2XvbY4iETYCpzMgOmoknsfPLfxiDr1qr/qE9PemHINvYrQlWC4f5Df6hul09HT4F0RGbvipugEtSpf69Dykl8ibyGfiJZ+HiULpfZ1hxTgFcONqwrmKf3jm+DiGmHafBBwu8dwZar9kI5O+ZEoRNpr73hYjgLVyLcNgcvt5SngSQftPpFt2Fw/0rzAfiyExEfBzdPkjhCY/S5env2Y9WTgeyyDt4G24p4YwQAdH64XiLIz0HJKNJU+9jCybKf88gVZCUgsmRiUOyyM3enpKER0oNLUvfiFLMvKY2eKALYR2kF2T1pLbwm9WQ3r4/myHfdrz4VAVUK4eiw272LRMxvpIDrR2rQgFe5NuLQb2kG8Q2NdTL2JIhbFeZrSUZJL85GRXE+f9sPvVVqDcra63+BtltV1ThR0c3g0cIRZkgJQm+4sPixNbcwLVMudCe30GGYKm4gHIz0hpQ/L/oQrtnnbKboywHPqDOki24YCLv5/78gG+FiezW/MMnB27yv9NjO8No3SVxVqIHbk5Wp7/2I95fYIc9Sj717Wnk2G4CL8mhRkvzVQjW8uQf59c+lXV5RgbeTnIIIrKpLMgZnie5XGr0b427GeZdvjRro0KbOI/pT010NGobtwMdzt+LhduwuGUSQbaPmqdx6vqsUd43K5tYNF9RF9kJv61IrOFXx8AuxbF5y9PrLAKZ76uyXMMfusY7Aif1b626AaZvkyOfqfAxHKRHVbWH9HekJim62qhxRjemTm28h23jSmX5mas+Otcm59mWT1OF9oSDKQFi4Nt0TAX8Z9LSzm5UNmyx8xEtO5cugxk3r2kKotaQTucWGUKos8h8t/yJrpEYk6KldCQOuO+ONO6XqqvWe96yFNAUykCOClAx5o2QIDKOXJ78A1k/a4n5AN3maNj4FrZyGQ4/BAqyvUm8z3fXdZCPKTK85GDGhyTys/ZQ8FF5pzBDOp6abA+1VhQvMUn137jKPekLg9hOQC1zo0qsD8ps9UnocLfPOWH+wfUQRbwsjbvfM3RXdE6PrvPGpcrpREedEUBqVPNkWPk/mYdObV+IP+KbW5tL0hVsOhRTEB2OSqoHc9yYy3jAPRnquzMgUGmYP76psavt2TlqHmwujnadsoPQig42ECVSIwdu8854tGVy5uV8Jm/FV7v96TFGCj/2iDA9RG6v/t/m8gLmhLF/5jEJhm+l3JBfEbmg1EQZZhM7Qpfc4gs/UjjUinsolJ/6qb7P8V+9uHRzfSycVkCIV+W2NNdYB5j2h26Sg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: db3bb590-b0e3-45c1-5fe8-08da66ad94d8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:34.0023 (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: 7mIyAnRXk7Zbtp4/R6+c63KJj99jXsoWc2ZXg23Ecn+KLvoOsW9tSwpcxKeu1YzPyZe00QUy+abzVhCAU1Wxjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR03MB8433 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150147_348254_C0F3C1E6 X-CRM114-Status: GOOD ( 11.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 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 Acked-by: Camelia Groza --- (no changes since v2) 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 Fri Jul 15 21:59: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: 12919874 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 33D89C433EF for ; Fri, 15 Jul 2022 22:48:04 +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=yXYLCZxc0/DCnHHrWr8+pkJxVY3sZKAj7DOkXph3j4E=; b=Qo21kCz28TbyY5 ZJAgaidVi5vS1P4QOtM7k1wTzeZZqwPc0dApb35T/K6mTSebYtSiWDjGLpXNeqGLcCv6DUHjksyFj MKK0AZrG+2x9awtVUemvz0H0RY+BJfnFkRdQ+UUuslrVlQr9FIJUt0C10OeCtOCsqhycsctrkME7C q9fOUi8qGrs6huF3WxJkrBHlvMplW5E/3yJivTJ6NINn3en7gmnp5xr9JcP1PPqCGmBOsu+tjNOM1 9nB1KGtn2JwPuZxAWc8N1T8ot4AALJkjWoS6MrsliJiu0eYluZaUdWUu721gAUo3GJib64JSotGq9 vpx5f6ZolvaCBXddtv4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCU4u-00ArtL-HG; Fri, 15 Jul 2022 22:46:35 +0000 Received: from mail-eopbgr00076.outbound.protection.outlook.com ([40.107.0.76] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNe-00AbbJ-1r for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fuk5QLLn7JFCl8+fEkpvBJZmKOsqW8Mfqj2BBlRessVsEFfq13wHUOzd37EULdd0HJm6UMAZHZnNDP/XSawAfD6mE9F+syhj66pO5KxeY/aOgNr27loeR08QLKY9PiFeeP5AK0/uqsishLwzyuxqtUyOngPx7dNcmA8F7lj6pxoI/ZCsYQjzj4SxzehwpO+sXE6C8pIsybz1z3vB4YzZt1hlZM964TWea8gXwzO8qoVbsdz4gJkxT2wDqSyAdjOSkk2MBOqVqdwYxFbski83f+atu1awQ+pSpe9gzA9xJaTcn/sqXDgYcNi0aWD3H3FYEv+Yy1PusiJrpRJb6gGmWg== 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=yPsbQKyAEFveniIQIGzCajxgm6x6C6iIBd0jdZ0YqxI=; b=gKWmh/zlghRzIB0MHABJl2Pfl8K60+avNYCi0udSI/ehRbXEZTs8gqHFtPU2sMYypwfaMqdQ4HeTtIBUyVEHZ6v/3SpZkopa/o+iBfcFmhfjdjDvNxwkMcADaF4mr3PLYMM2jwIUlmAe+/W3iRjunUwqmPsK4Rg2FlyrG59oPD6bIcVmCd0ISzT7qnPj9NGKtmYY2AvrlFOD/teaZXvtPGhTQyCsqjkAnOhGaURnsZUb9Xz9utamAvTwqBHslybqPnXZkXkxdH1AvLmgmb/EiEuWLlr1/09RikuvY7l2/C+3hKTQ4y9TO6etW1PwpoPABGLXemRj+JwcCnbZ6ZLTng== 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=yPsbQKyAEFveniIQIGzCajxgm6x6C6iIBd0jdZ0YqxI=; b=OU+anSSteZa//yr3QMOH7a+wIEKxa/B/7euTw43UdmABwvy2fRVI7XgWabChwRQ1U0OXRe12xbXM35KQ9TA3Bdct4fcn/fZf4VEZyvcKq3v/37ebL9ZMfHHPq4E/9tPkKQp9EufOJy23wdLSZxTq9t1QwrbUv95nmDe3lHnZOyMTtvINLMKsvvQK0Kk0IBxC7P2t2YZjwowQHAzrDhdkTStfg6GxaX/QSzmPB5pYsFYIVfFktJBAaW3MS9CBbK9yR4K+15/Ser5dHpoPNApcl9hAnitXZFHPlW/L2qb4smOWMtivkGgylHpfLk+Mft7miPf3Ej8fUhfOQ5WBw3Mmow== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS4PR03MB8433.eurprd03.prod.outlook.com (2603:10a6:20b:518::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.19; Fri, 15 Jul 2022 22:01:36 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:36 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Li Yang , linuxppc-dev@lists.ozlabs.org Subject: [PATCH net-next v3 37/47] soc: fsl: qbman: Add CGR update function Date: Fri, 15 Jul 2022 17:59:44 -0400 Message-Id: <20220715215954.1449214-38-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6822ba15-bcc2-4d1b-d5b7-08da66ad9636 X-MS-TrafficTypeDiagnostic: AS4PR03MB8433:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uCtOErf1Kl2GPkcKb26DcwHzw5CLjaFdLfQkZQ5K8kzWSX9V66FGMqvvaQs5k3NMtLiQIdmPojoTao4aftOZuv7IJ0XzF2PfGfqaDfUqcHyxHsoPpjB1jp2tcajG/WCQ1WUK53IBIKWSGiReQl0/GdC6LA3XVX/oFlDluS1+VkqzCBDII5mnwHLJi0AozQ2HqWI3o+ZAiy7YV9uvhVoqE31EI2YaWcnMcMbiEhmE3i+bUrmG5vo3C//wNEa/H1sgU6eJa+RDuJ5sOS0QTzaq9Z+QQkKPb46FKWPpKx2YVJ5q/PQpc/lrB8vVpyxu/UCR+fP7O3LnAWVxKPDZcAmVRMFYfJpMkZ/m2g3gp5k1JNXrBY2H/Cl/mUVgEcuE4fjccfypjam+H8fHTv2R8KgTyvdXoeTpbnlX0AlGEPeavKgFs53tuXftVACuecG9FZY6uZc0hlT6uuqRczomKNFwecgtUlLMkvZA0VEGmFI6V7wuFgAVxjSeryBkvCMjGBxl2iSesyZSxbA/5bWIYL4aLmrJtqPFlwNbt2SEszJqjY7fMnuIiONu0k+zv/gezlFlmgW0HPSgg96LUFRD9O7NFrjNeLI/wVhNKH6oyR1YOdsQoAGBlMVqZxIpfGboYgJihEmajZNTxdVjDs91V5LnXL6zj9BCYaRMvz3cCp+5aTHa4IUd+TqyYV9wUyFKHZEuxSIhYWL8U/H8up6Q1OiQDsEiYiqlTp8Mnwk2EYcr1wjBjdFjUYCQR1bQiIu6+bGq7Bwa8ojR+hAjjNrMUYGhZdrOqKA3C1VdWLuluD7KwJk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(346002)(39850400004)(396003)(366004)(136003)(6486002)(478600001)(86362001)(6506007)(41300700001)(6666004)(52116002)(6512007)(26005)(83380400001)(2616005)(54906003)(1076003)(316002)(186003)(110136005)(66946007)(15650500001)(2906002)(7416002)(66476007)(4326008)(66556008)(44832011)(8676002)(5660300002)(8936002)(38350700002)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9dqym1mDB2M6tFNK3Chgp/tTI2b924Byn0MkKv2VQ2xdENtU4zlAzn3dQWMNldY87uJVfmXkBwohPhFt/GSNK9Lw+ESnl1cp+ZOm9wTpyfnhnLF2LhgQg3pIRWV3/JhxNOjonyBy4sfshcphkTP5Lq2kEO25ceue2ITa04QtJQ+9TBdpJmDiNUN6yLHP6M8l/HMCk1AoPNiXLR9r7/1HHFcQcHBLExJ4IDDgd750I0xMNjG2cdpleTvbAnpxJJQttUrXNUVLvfW1VIei/WQ9T2R2stkQbhgxInj4jQF6ZaEHGV1c53ZaG3Go/cF+hQI/frlUu+n029qKWmsC1JSWf4y0AfwdjZ+0VzfdHmVJmLpTcaxpCK6wt5/BvdvdioYjZYMPrr9Yvyt2hlHGQPiMzmTi3vs0vvZ2gqh1enmlfsmZJcFs0Rgdbvsf+NTmNqkIiGXb6pEPu10pme6hcnvviIwp+NV+LOW+nc+z4yZNkkBP1I/+CF/LAa7UXkrAB0OZtX/h2gVX+GuWsnxOaCs+s5pzBh3zSbaCJU8LGF1aalC2fBg/o1nf9OY04C1NQvrG1YODcssQ3ujzk4J3dglKL91t7Qk7MxJ2xpYYi5QfFb4GrhwLiDlptWJkUEX+nbhNK+1t/YjFULuVxqJZCtQl5xSnYMjQtBKGDeFOwm+b2SZ8FRKYgpRhPL3dsGoCqmoIk5oRsFvNtvNgSzb69emeQWezBaA9DCJOC/bpQKjNjM4/2OfVam/sMkxOSDMuf3VdQ4tN8n6ae0JQnPgDdSyVv6cSl6H4hC1isYH+u+xAgyIpRoX8zts7xoELqheN/XTT+bgKKl9MTbT2Ww6UxYZLVrvDFpLSNKqUDHRtLM451b2gt1UymK3UfYviWpxD9p4B7NwN7DLAK6ffxdWc4JlcpJTLGC/b4hnwQkGBJvY0DUaF1TQm5bUSy93sK2Zv8iMgksADC8S4SaxOGaxuJrnQqQ52Wp49ri1uiNiWD6EuSpFODaKrTH5IMVL47iWQicqMlDkeSGZC5ojHRoVwnSRzsdvbL7yovcf3Ece6c29AyjF42rc2DDE69bsfTjjIQHGXvS7FBZ1llEpAtVir8cSVuW+5FeJiSgHjzhf/aFrdTBfblNd7JY4NnBgry0IuOCpc19f586khtHH4uYvrV4M14gVHvXXWCUw28ZXlgMCqR6t90JTok8T1Zm82Gp7m+EfiXCTPZX9Xayuhz/TZr+vCtdtlmdDV/7AiPM32G1X1Rnsn4Cp+WlmYmtRETXqW4M+XjebLvBDDqFc+jWenJUQpUs/anqKNMugRXQs6y5TZLLKscyyJZwxwPnunkZH9OEJ9fgD2YY7/0Ltk1iiPlgp3NjHc0FGkDBi0pBIP9SNIxdP1uo0+jD+9DesWl6UYRpA2scl4MgePCiufAEKz5dZhMrzWSaiLc3QcmWsaquQsbNzNf8NaTHX41MJunkmpRLVnwzGrnSNXh4OT/B2pTH90IkMBPhPofR5OxlIMyPs131DKYhEYjRciwciAcfmJCPimDoA7+ZwBo5yRRZ+/w1N95OT5vSUhkyXLYGFZUzBO6pLhQQeWJ51QoHi1NRRpgYD+dGF6gAo2e/qGajokZEtfjg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6822ba15-bcc2-4d1b-d5b7-08da66ad9636 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:36.4085 (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: wLOtwNEG8gYy2EOtDVGVn3PZXQCT2pYywdA0lhiIcEJZ+6pQ+xNT6+pq55EmyhvJAzXW9y2Q8blLsPQc+zDDiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR03MB8433 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150150_149270_280DAD69 X-CRM114-Status: GOOD ( 13.16 ) 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 Acked-by: Camelia Groza --- (no changes since v2) 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 Fri Jul 15 21:59: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: 12919873 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 CCDF5C433EF for ; Fri, 15 Jul 2022 22:46: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=nsz3OWCG6V3AAEosEkQp/o1JLyECOwtvfycpNFUAXRk=; b=VGIpdHwe6OQmde JRQ246AuwGbp0sKTr8hudtQl0RA3zB9T2qDH4cx7pUHUyj0mPxuklcXsiBT9eHT4hsWozSHM/rw13 3fnFre/f7X4CvRfDQEccQ9Krfjsr9HHPxw7d+isLD0mcR/r57ukPOu9+HUpl7/Rkbzgxooa5zjHTA z0kZboFIZCKmiKnQy9hfMsJo16BiH75v2yQ4rFGmpdQH4i6s84qKHlgO7KSaUMYiqHdprgRbox4dV SVr/BiUbXZwSAxFs75Bg3H47kg7QbPVL36AWBsmRKCA0EhmXSX9IMQ5p/QdcgPDDuZfyvu6LB4dM7 pSm2MFawQDec6JVpPZJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCU3R-00ArPp-7K; Fri, 15 Jul 2022 22:45:05 +0000 Received: from mail-db8eur05on2073.outbound.protection.outlook.com ([40.107.20.73] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNb-00AbaP-6O for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dgcHjjJQMe2TeXRxqrQ2nLkOnJ/H/99mNuWookim9vdnLiZD/XpCXSlrCudW7cxxjepiXdHbixzTF8Gv2CnOryrbpDKVOf+92yGDdzfmoxlLZHrgh+XH1mFj0i9j5S2fxfLTqDKws9LtiP+5dAayluokjsirgdRhy2GSPA+GNsvOvEcm08uVLchdibsVsWkdjpLkCtOVKkxLM+smMF9ZIaNraTJjrKy3YU27GWV7SAyQztQGW1kkqRd6/ooukcDUST/SBYGxKrw6sDH0xOVQVuHmCzwCYAx4jY4Y+v0v6EFQsWYF9XYgsX0v7U2Hqfklni90ONQjNEomXqL38OugeQ== 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=ClQv9/2FPO54g4q78T3PSaIdaYtS2SYF8xNzSGVDR5w=; b=m6fGtDEOikXOWm9Yf3f4FSbEHdNHZzusoAQmfx4tNLt165XPjGwHh95LZNEFu1fqM0XdIiqDzNs6eEVdqljBzuKPev0S737zT4mX38YyE4FB83Ofo5Fm1+Zt7Adda0paulhPwyFSfu86fsUOMJsgbu0jO3BqbvRurxNIq+ugpNeSeLyuVerIdnQC9hta9O2gTDckjzsAOxeWdFeoOVn5jwdMAWycX91EnKH26EL4r5LQfvEhpH/LYbKHavuPIRYyWH7cTf/0iBOM6q9tQ6GdRfBoaN20kHwETrVcMOZfDIBqQuY/b0REPeZs7MMeK5ZhJ1oF41ILiVS+UlNV+5GsSA== 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=ClQv9/2FPO54g4q78T3PSaIdaYtS2SYF8xNzSGVDR5w=; b=q4mJsLct73dCTdyhM7WhA8Se5mE/k9buuaVpUPwOA+4oWRfxTZvpqaMglx3/u339Y6ZJ3Q138hDpczNg5JON9UpBdwM+jJKK3/wpJLSNwA8+FzGZ0AC03rAufFMuv5u2Bcjz+kCSmRfInyfi5bCMZVuafhtTEPZ4CglM4/+nnXIWk7x1H8oDfO/wCmvswNj22D491YgmGHOc8BU/zLUrO5dn112AmL01LTuX7nPSNuGBOdmpERvsKO90vU4fC52NoBqPAmLYGlWIFe9Gq/FwKCKAeW1jSn3FTib/vW5P4Ol1fkxUEM9Ieuf8wbGzLSW63QCZOZ/GOCG8sAFo/w81YQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by HE1PR03MB2857.eurprd03.prod.outlook.com (2603:10a6:7:5f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Fri, 15 Jul 2022 22:01:39 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:38 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Li Yang , linuxppc-dev@lists.ozlabs.org Subject: [PATCH net-next v3 38/47] net: dpaa: Adjust queue depth on rate change Date: Fri, 15 Jul 2022 17:59:45 -0400 Message-Id: <20220715215954.1449214-39-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 52060cf8-b1f9-473a-fbd6-08da66ad97a5 X-MS-TrafficTypeDiagnostic: HE1PR03MB2857:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r6/2JsEs79TSkmhR5AFjtCYzoYmr9GGiHQMyksU7JOI6roP1r36mMS4kBWEIQ9i7WVpVpzFES+lxRhseGkSlVHEnZmyV8KcuXYipMzOJxkno9GPLipG7RMH0B9Vq7cSmSp5QzUh/WF/OU5xxKPYiKE27MAqjNMHTmAwsl4thC84KBr1244HYadMVUfTsE/JM+T6yHbLc1mXqrUPZcfY8SaFZNgjGxo4j9n+SvF93zx//LECEhE/wZMndUTJhSlQVfvYl6LDp8l0UIoQq51jUhkjFn8SKZChLIxwsfv/v2wvf5rJ/tqEamD2i0YOw3mLJHBPuA/E+E+uwmpNejOIEPnlznSb8Qu8WMTwNmyUPR3UioNayEv5s8F4X9to2ThCasqG1gx20jn5NgE+D1Bm+tyJeBMflzTqwp3xdb93ojfN5fwnDDUzu0CNOHW635WOul/ltgxCg9rhTBWMgl8xCmZHtqxVHVAxKmQSzXeLeXhTNs7wQwCGawlwN25l4ovkUt/y7RVfGIrvesjq1sux+3eTqMuiwUKdp19pHMYBh1KD9JYSJH7bBthlVMksHO56GU/FtUKteAT9FfcXzEi0+mv5Ia711OhfyAzhyvyVSG+NXeDhxA0R7TtB41szGwoeIfBFH+U4iD+5znsyfcz4Ys0D/vTQaewAHCbGWAxN9PrYqwdvdDV+E+PaAaKi1BS52PD0eMLVRRDaaVbW4vh9SK49JEJdAdnmbPhci7TgoyIDrHb1MS4crM6qL+GAMhmfdKLp+tyrIwMttmuZUCGglh4cWQnEAij4BdhvEnujwOSbBLCru2eoJqBq4SYDf5y/h X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(39850400004)(396003)(366004)(346002)(136003)(316002)(54906003)(38100700002)(2616005)(186003)(36756003)(2906002)(6506007)(38350700002)(26005)(1076003)(86362001)(110136005)(5660300002)(6666004)(6512007)(66476007)(4326008)(8676002)(7416002)(44832011)(66556008)(52116002)(83380400001)(8936002)(66946007)(478600001)(6486002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YN85NKAnsRn21EJGimE+HxXNLkeAiCDwgfzYBHgubAaKUn6Cv/rhpdRQxG71475/zVy05WySLMNYPOsFLVOgDZl56zs0nQC0Dj0/ROPrttfUaP6uc/NCBvWInA40lM59+k9ajJAiKfubjnH1/6haSsJClQcYPfMkUR1t+39rKJzSN3GPvuOnB4g3Uhz8GLHD8feMYcXZrIF5ARmPd51L8vUyjjtmTHFEHfuLK3iBwIRSYPzRI0t4yOkC8FCxHzjQd5VxRjJHb5fAo5kbnrmCM89sg7qcUFvBB21+usnHCKVWMfWkxfBMhFBB3hSUwLbsLgPUWhYJZTsXJFWmp312Jy6f9RFR/6loqWv+7Ijq4pgE8WvvkBOfxEgfNOQoP3vPNiXP6Dv6rKgAzVtOeUFxz3itb8Nd7LvB6ocnCCpmVVk26jaA3bWKLRygiC+5ddOqFIJNuByFH1YlXx0M6XHRWoH/RqukldNMYW05zdY55+PJQdJC3x/oAZQ/pGeS7g1oGaw/S2CXrqya5v4SLlLDrGjElYV6qxTgDdxUbzSxnfGLGGduhyPEX+7ejzerQw17nikUn8iktgQHqAdUomym1zsqAifUphcJjCiPP0qPLsmBFV3Vd3ODi5BccHpqJvsfCMqRNtX45r7f7PKZWnraR/jORwRi4oi/CoD8H+WTGCRVNoSP8VuDm7j0X2WL//AiZZFE9jusr9t78yFB6pEYqo6qBfz/gtJxLjfDhyvfGKJaWOPI/vY6NAEc99k9ql9H52sSXz2bJ0nKz51LsdAEzHe8ZF7CzSd1KQDV8rTWkSkI54HFoRmA6sTBFk0YOlsK3BjtRRF469T3yXsy9y4uArCuuUsYg9DUdJXmkjJMO9LssfNycrBTFSPwIdVWq5iNc0vo2B+HzJioKiFDPv7d4GLppcg2yToYu9AZ9oO7Ds7KQ8NS6huG4DxWGLPe7jJJilm6ziIsLspcgQcXYV2xPWoIcofDbyFInDldu5eLQeSYjOsiTGKTkB82RVnZxExabf70dUULiByWs9yRJM2EAyOjaE6ynm27KxI1KrRC+nFgWGIDRJIyj81CPprKbqC7rlDITK7sIojem1klrgHwWxlzwk0dND8ksu7uegVqrlX5FDDaiUYVB3FxtMMYkSNMhXLm0YVEoLvWwgiRhJgoGZLbietkAqJ1GGJaya31Z+WRLGzdsyKIigAtGcCmSX1yMAzwWfA+fnEEm9Zq6CgyaYwHXLkoXmYtiNPGz8F0IN726gCqqNRi2Fo+iV+Md9/7v644KGhBC6tWxg+1FpxKkLdU/fZ73dsOpNyAu6VoZDjv1ekEQW1XDOevBi7ZW5SwjQKlcupe+rJG7z0V9UifldSUwjxvJ+X2ThH+mIhGOWptTLL2rYPf2z6ROiAr4oAT3l6SmbOxpweYJkTO73zBhYHnDOnY1TPLLb/uBM3H2jJItTifi/YZIA5fIpQ5lFN/v7WWif2eRxC2BDknurnZCyp86UIBGslmHiktTVNGzOTLSSZCR34UgoCCEgT93/adKpY/9LtzLt/tR0lhxmMVL1D9LuVoHZnBDfDhaNKkfMBSEcKcu1sotDZ10vuyHHRvgIJ68AA7wkEKzSDsIxG+Qg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52060cf8-b1f9-473a-fbd6-08da66ad97a5 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:38.8615 (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: AhGeiAJC1Uza6hXIidjPm5LJY2mMRaqZngEmNs8170g62V+7CEVB2OBC4ORTP8XZgjxMJ3+WLsdWxNMcjq88gQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR03MB2857 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150147_372848_7A7E930D X-CRM114-Status: GOOD ( 22.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 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 Acked-by: Camelia Groza --- (no changes since v2) 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 377e5513a414..a2a89f547813 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 Fri Jul 15 21:59: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: 12919880 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 1C291C43334 for ; Fri, 15 Jul 2022 22:49:36 +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=oh2d5LFRLct0ko T3w6IRXmBTHm3pdAP09CU2C4VQV3EJ2LhVEvjMUVrmTLtSOEJT8JETifEL9l/D0Xx2ymW3/aul0H3 5SZHw4aOYZU+z3VBkSsoqGi+09KsQUjXePumoPNpvUGleq59NIjfM6KBg7Ym5cjUF/fc5qgb3NGkR Jdz4mn/AlaA7K2cH2XfFE6MoncF1Dqlm3YhqgzWGja8AHsO5JA9dE07LMGml9pX1phsd+ha7tLCFs 0eu2K5VJTbuVOCaSFu4jdj2mDN9VCJsWXzDQuyVpjWSqXTKtIM9J1x86J5u6aVr11Ox+e3lo2AJ+c GodjmH6bt3lv2fDelOkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCU6S-00AsMW-UI; Fri, 15 Jul 2022 22:48:10 +0000 Received: from mail-db8eur05on2073.outbound.protection.outlook.com ([40.107.20.73] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNh-00AbaP-Pq for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XC3TitUQ8zht/eKMa5kSjD2Wk9APjK4eOcMiXYbFX+5v7qsXxp5I3wL0NgOVUXzI17MnhspTWwjcIIIDMzNjBseVbli3tkUxrIineKlujL7Iz7u3VBf5utvFaqxT7uiqNkoyQtSLh929ISUKKUiy4zCoSH6GRzpbt2cZCEX7kleoO3cFL0lNQAMpWag819yJfkIVvz8AQcdpPQg3gY7NBN/XxUHeMyfjB86QuhRBUU65vFdKgYM8rcXebutzZE6tW4KNeDnY1ogWjprt+DafFb7kTESi50tNn8Pn2Hfs9RQ83QgX1nUL2zxedr4EOgWaPh1JrQhXS1UdPczfydPgMA== 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=OtYGkWTGQUZ52g0+QLr4Oor5PQ06jA1qb2iSAznHeirZN32H41Y+wwC+WKPhTiZf/J0qydy5EfBt03+hmrrxthw5zlNzgpEKxL5ByovH6abF2ULzkWZsDbCS+8oG+PDVdgThgz3dJCR0PEa/dNawneola/1Vp8osZEPrCOvZy6Qb1Hm6NG1vzXKccsZEv24HgZnF4p+/ehn/OYJ8onLgT+UJuGjvZNGfJxfST+uq5rGP0FFYgdqNtuHG3UFhqXX/VvFXeLF+o4rYByAbi+RGJ56Bv8uwwVPvXbEIHI58niRPU9pZc2RZM7IaSup01E8y40tD/K/UEdV0pH2CWDRSNg== 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=OL+CkyPcZJGrtt6trFcJHDe7Ujmkom//z6RPu4J/9ZuTZJJEfLRK3HZttdVlD+WYURrGLGw5BGgJRClTrj0SPEOAHuQnYuAG/aeDrIZ0HYziOykq/6usrR5FhBNIghammpjlRbaUG/RjFf23fn7K622yAxwC+L9g5TyWRw9ULcs7P5rhWkk2vnvmBn8mLNhAECXWHR9l7Std5nf+r+W6DJQgJ3/WL5x9yaJRIl6s/XIprZdMhDp4daFd6176+Pb6aaaq4vZJsvhLnYc460kaGJGb8bJw6m9EBlsaI0rZSbNKRgTsPuldWLpgm8DBOBq7XKBOXN+jF1dWX65T3K1QRQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by HE1PR03MB2857.eurprd03.prod.outlook.com (2603:10a6:7:5f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Fri, 15 Jul 2022 22:01:41 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:41 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 39/47] net: fman: memac: Add serdes support Date: Fri, 15 Jul 2022 17:59:46 -0400 Message-Id: <20220715215954.1449214-40-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b9caab0-92a8-4540-bf88-08da66ad9912 X-MS-TrafficTypeDiagnostic: HE1PR03MB2857:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MaZRFEVIEbr71eoJC0l/a8unx+azHlFCoOasWhBugxQMFcDtWzLpaafJ+EvY3a1W/y/ZI/uDuL4f8D4W25klhnEet4eU4fAUICkJw1doQhTel2mf4BaqrN3IJh5qyv1ccxZMeKYsnMi+KFcF53wTc3DvlA4YLnW1R7L4fujzyZkLbj61UW/w9KpqiQsKKyFZdVQuaTHl91krJdIhq1oeSxLuRj4WCk+7YjssnrTokxD0YjbF5sgb9unNOqvaxKc0Oa9V9Gk4Shat1BY72BLKNXIcynMPkrsOjYGDdAgMAQzKvx2Evb5/gU8wcLqq/F0HSKbAbx5UzOcR3eHh40rG7treqT3lLhjbttYoMKwKWo/cm/YqlvJ0KJX4eQf+T4Vrxdhqgbqv58UngXALBxI3w1St+a9zB39NJej2oH24Svm6xk0QWQOPOiEmaIQCgN08gDSVqSDHNCFGk+BB+u4ptge40wXCTA6TdIMRn6jw01snZpKTPknzgLNW7OgtWiiN89LcPV4wfJrmvlluVztc+ZBg7mBhZHA/2VOPiqeVKC2IuIGrt4wn2ZgdeHR7VfuR0s5la10N+pQdFgtyIS9VuCvzt7gay1YIp04M0oC1p9SCpVpc+1N14nmfMUmpihcVhsIXs7cMs2f5e9iy2KMgGDFBkxUWpWN13iEyKulBfGgGZubcrFLL2tIi+BUtlDvF+N8rMQBfCtPvlM80LTbY50NL5Pp26mqEM3B7PbdO29eRJsggh1Q3sDzoZI/yTqpuwwAdwlyEyvip2/azsO6C3fL0+VdPXsOHSsOJsd9nDHpkXQPlfYvExt9xw7syhtBb X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(39850400004)(396003)(366004)(346002)(136003)(316002)(54906003)(38100700002)(2616005)(186003)(36756003)(2906002)(6506007)(38350700002)(26005)(1076003)(107886003)(86362001)(110136005)(5660300002)(6512007)(66476007)(4326008)(8676002)(44832011)(66556008)(52116002)(83380400001)(8936002)(66946007)(478600001)(6486002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9vJd+Cifz5TWsOKggSQ1F+CWEPtT6xxwprsLitYH2BAd8U4CzHh1fF5VWPDtv50eFuziV7sAbnYCqo7+GMFRFgzZwOgwATCgw+GG8bZHz639RjFqoqPbrd9JiiTdZGCAgOOQ6KmM1GQnsvwKeedSQy2XqLglLfTn6x2RnopaBsgv7/jj0vKsBJX2f2Ny9n7FRJ5WK4OpJJX/Is9XkxKwOWuiZ19oF0k0cL8nwn7m31ktxscxG9R3QpQdyonlAugU/uOk8oq2bpNNqWs2fkqm30t5vy8UHh8xjdg5ElfqDWnUgx2jrJh6uXQvM+cE9u6JWKYOmdcS3BC1imiCUbj4E4AX4v6q11Q7xkd3SptozsQf1FmTJIydzlX3HM96OvXdo/1kdpT2a6bs2S4JABNx87cQW2tWyA7Ce1miBGOP5Jfg+c2gW5MPcpXuoDuYqtBJPNDPXvLNG9i01eNEQ47eNQFCwPCILBngpi9KpzPfJucC1wfYC9Qwf8iwxC6+/lev1lGKKXTD5VQbyI5At7SE0Dmv0LJF5Qds4oKEGNqjPnfINAWOAftk46Uh0roKBk6vr2fRegw5BfNgFTVutUxlguC2Oh9DhGV1dUbThVLzIJNMqZNR6boRcNOLQ+LDRMPo3iH2Pay+pEEFZ02J2jFR0jc86v0o+bNG7GR/Oz6U66LcyABQkdvzCUG5r4weeX6qvbotJTX/iLInr7KestSY7Z1WTNU4qUnHXDb2HHDNRRse36JbUIQFhOqck3oTPTyPBOWVbJ4g+V7i77kXD4Gahbbu2oymySSOz2dbbJN8cFaZ0I4z0Yxkvzm/50tgQmOVT8cEx72VE2FPzbrs6CCsKKttb0gzLhW+RTGND1d2m4jeOB/z6vtEUNBlB8a8XUIJZ63U/BmPrd0VDouJpMiwEN/bDmdHp/yMCf7IIUSuzHpmt/fwIKy3EAxHXi9dq1y0PhnDGucH04afmNeXG8B/av7NSC0JrX0mYRL29zsRZk4O4eIBiEtgxv2aic6XhyWRKWNZ2xMgdNBYb6E/fQN6mxV1VTxuO3FeXWdjFBeOJdJV0dwDHJ4/5Wb+UvDQCFxQJRzIJOyhT5u4hp9TJphrGwmZtExdrd8q2YKWxEScXjOpChWItwxQZR/sv3ec1JhvaeufHQo6yrFmVWlC+pwK4SkIz7Asvz3WKwEpdGpl3Xdn9vaOp2WQ/10LAjdtJG2J65l/3/VIRmkv3gllJ7KRN6InV9p+4sUjT0d87SCjtESNFf7peSLp/3d94uoFU6IX/GM54S4S8AznTruS+Xj3K4wjBWTXktR5kfBCEXKiTIkx31v0KijMEE6iAQaleFoQciizZMq6HX6Y17mE4u19V78rALlfwCXkmZMUbV+GRphy8sgpODMtl4oDZM+RBHhbxKCurn5AzT9lyl+E4wryCRcaT7avcmgqTqjQlVTBZkATaZDJ3Gc4TBv5/574kThH7T7nen9HS79A95x+Ldive1heiZsVo7if7hH6f8jggZ8+uCt0lYrkmPi2AsX/aCD/628A3kCTGkZPq8Tk9YY9vR7PfQDflQ2BhIUFcuKUzz1rZ4Bn9SARh6VPvy1CWnToIIBvwLSgL+eBI/VPG2o1ZQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b9caab0-92a8-4540-bf88-08da66ad9912 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:41.1583 (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: la6Km+ZNriU/8ch3qWVKrSdycvl36Nd25KBtB+WI/7vCMq03EWzjK7O9Mi18nV1i1G0xmWfOZGvbl5GIUH0GFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR03MB2857 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150153_906216_801D0BC4 X-CRM114-Status: GOOD ( 15.39 ) 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 Fri Jul 15 21:59: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: 12919881 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 A4766C433EF for ; Fri, 15 Jul 2022 22:51: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=CEnpy7C5kaJTBMsiFkNgxNjB8E6Hz43PDiIpcv1Y52Q=; b=E65YvIDFr0X79y nYfanvixo1RSiAPSP8eotCYIQkuKoYs94R/fXS8IPtq+7Q2Cpd+ehDP0M5U4qXRPQMKsBE2Bpe4cv G5PnLg8GEv+AYxobBzWZis7/aO20IakA35/xadtHTO9nTqC2apUfK26LnLTOX/WkPWjzFmPqwH0bx g1EAiE1Ej26RnC235OzH1ndd8lrVjheW0XlaQqIsv3RBXio+vUbAkVJ3GO0g/Fo/r/vbfJeyY+kIs hJ6OqTLieWVqfkevQa2KA9SQUkNPiDuef8+jk+Vl5Zu4q2dC3o0W2vPLeWxRZCOpz2GOR6/gvwuW8 5H1bm8r2s/Hco8Vz5doA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCU7p-00Asjg-5i; Fri, 15 Jul 2022 22:49:35 +0000 Received: from mail-db8eur05on2073.outbound.protection.outlook.com ([40.107.20.73] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNk-00AbaP-Ck for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:01:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=haOSSFpxomFFhgiqlxpmPQmj57WYbrtoP8Gw0Z80t4L9PPvgkZZKLUxYZXAfBFfoGJOwUvvi9TohDJAXdVeL5pMoSPaNmRrAWlTEv4HV0Vlx374zD4FbKqurCfYEfUj+emfEy1p543BdaRxbAv2RibeahVyP5jkgAOSPEms25PpNEARaCggSyhaA4dLxYPoo8JKxdKNHTt+/Ixkv5jlIjHe6BWB/8MQJClCzYWIfirrR7eqybGLNyumG+TkWMDFMZi/1D8kM2L2OKX2hNMFOaEb+SRO1Ek+C7SHD1Jg9A2hkNj578THZjZCwnZg/wvKnUXe1p+owNRZbaxBSrtc1bw== 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=q02l7lYyvtfwZ5VZDy17KMHCbgifR6Q/2Gb2O4CKthU=; b=MKlK01mBcOlIm5K/WX7t4RODX9eTH6O67HNToMrTbza6UEV5VD8jPzVQDfDYBJfVGAnD50p578Vh6q+C+UtNiX6SOK/PWENLJM3ubNj/OAGyLf9MxRhl+tUpdHVgJgHTS1G7usJw5yKF6zzVnXRyucqOGBnVQiG6la8TcoJ+gaeYE/hqQ09T+tRrMNaA9YaFsnNtqcqUTRFs4tAkPT9IACaT0xOyZCRIf1MAoAY9tEhgJknviREaP78o6xPxZqdjKXHAO59tP+IBvKP6yPNNwYRICTSE0CzUpMnTQKmGP1/ddrRJ8/kkCJWoe2B3zYUsUnk/MnHSyw9AXvL/PZalJg== 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=q02l7lYyvtfwZ5VZDy17KMHCbgifR6Q/2Gb2O4CKthU=; b=gnbW0n+YZzlp4f1ujqG//kqyfw8RYbqctaw2mur/hp2sCbzjPheExbbGD3+QNjhJlFOT7ScWTdrZfzpHCvnYf2b4061A/lwaHmjByBDnY60YoWKgj/krmV6ODYvhbdh8vof8lKkbhOFKIHyK++ggLnCzbX1lMg0GKt74ZvRGMSoJfTz9VzPwINXnZT1tm9bfEYnreGnmgWab3szjId5TD4T9/jBxIc20xlbtlV6OD8YWkzVlKUD3XxsfKgZGomxdaDdOhGbjyet+QXJBk0R802YS9CrrwLJBaDaPGbfOpqP1h2wi3rXZuLtxa8VSTiOqjFzhHxVLoiz4YMKKg51Jug== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by HE1PR03MB2857.eurprd03.prod.outlook.com (2603:10a6:7:5f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Fri, 15 Jul 2022 22:01:43 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:43 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 40/47] net: fman: memac: Use lynx pcs driver Date: Fri, 15 Jul 2022 17:59:47 -0400 Message-Id: <20220715215954.1449214-41-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: de38d71f-4a4e-450b-996a-08da66ad9a54 X-MS-TrafficTypeDiagnostic: HE1PR03MB2857:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iNuMFVDbBay5f7uAzF6iOe1/c2ECVrD45uoWZWV5Hl9bWMsz5U2+u7p4xgYIuDiZZC15IsFUy3+K2idEZ3Opv3wDPJ1JFbyw13//NgCLUG0JS+MDFf1zIoLV1kZIR8a/30Oy02QPoFNyjniXdGHoL/+B3zDPa0nwc+kLZH2vUgAG1afCf1Utyq3Lg6Aw/d/8w6fmckMQbqStbq4ITCwDNHJW793lODpmnDRFM+X0mXcpCMD/GhSXyZ23DyfKKmESzHAL0wIM825mIxj1MpAOxI0lpQbW4zFFaYEKuHRvyPxjxNIMMRWepJ0xniGIhNN72CzoO2dCVxqtesRwSZdFzt4YMtuwQ/9T90Utwvn5pr7Kdywm49zS0jEciTNlxth4tqfFQKkZlO85uE6CIBP6ZsiH5+1YaxvR+/M47JjGm4E0YLfG18A4xegJJGDM6ivZPfe4+knLkEhRORBm7QKPnPAV27n8QbANzdQj5fnGzV8nedkrObTlyBPxP7oAnIzMNJD9mwyaGohJrLGRabJThleUZ/lzWYbtFkgUExQwuyOF+IM3SGhxRhoNEABLtR0q8RZ6yngo+jnOeWWNq9pCwngJIgLnPV2bNj+WcT4xpSv8pKypAER6laPwmiepg8vHXWWvIgUxkzTqxhpjSqhqq7SebhzsDzta0voyjA5kZJzc9EUX6KvahY2unYniHbVG78aamxX4agf8vC00G+uwpbsU7oiW36S68ivs/Xi5V3JpOft2AlFeb5FYjMpTAASqL3mSmZcZeIvZSn6WzkljuDctsWp3Wnvwla92cBohDLaQuT1f30GwJR7PfssZ52R7 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(39850400004)(396003)(366004)(346002)(136003)(316002)(54906003)(38100700002)(2616005)(186003)(36756003)(30864003)(2906002)(6506007)(38350700002)(26005)(1076003)(107886003)(86362001)(110136005)(5660300002)(6512007)(66476007)(4326008)(8676002)(44832011)(66556008)(52116002)(83380400001)(8936002)(66946007)(478600001)(6486002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xtx5wFm02e4W7t0y57t1+9j59rtf59WsS4ffMsoC53mj2roB+VsWY2Npir/cMLbDO0SBdJLLGz77HXmCChJMtYZiASBPgXldBD1wqH5+ByOTAnj6GOnxy8+pA9qm+exZ13LzTbeFshzMBXcwQpDS4Kr23WpurvJF2ZPF1ubOyGTqsPMVdPKckQmjmm6hvJ7m66nEoI6Ms+tIwVftO5gQjLctRVYpV9AwGCDUWeRnuibg59lnCPs1Plsz8pfkRyV6ArMsW/fzH8SltjpDAWE6WdNvkhGRYNhiRZAQgrLdk2Y7CdtUKc5STxltKH7Sa79s2+3d7XzIa4/iS+yjmsL9SwAUz2EXz5P3DaLqyV6/qfEFYTBoQ1m2qdqr2OH5n+nx+xn0TpWgsE4eHkzqTO2CbWe+YqDkMKwpQSIXpCIYlN5LPGhwBaQYexDnrseAqsnvKCHxK7Rn+XUtrXdm/Nw++gb67V+JIAUfKfisLPodo94Lg0AIlQSFBBDyW+bqhuOaP07wQlGLfzc4W17LqKdkamXAd5d8B+Gd1/e1TRmGZU1Z75WurFZ/0CKIzAz4wgDyZzbs2cfBDP7IByX9toxr2HLAH2ywjPabM3NIqE739rAN0QvcR6ZukhRsqICyCkP+lCUuWTwZRS1dYANZehmpDicMEp+NdtW1EncUDpcxMJqtwouylukBR2QpSGYJ+jpxyuz7n0emgjfHJpgSv/zLeMSNF3mjuYj+aiYrBin/CkPC9xACJcc4TwD4c2fZhLh0209msFVCh3ZMvlk48Pm2gFmhDGTxfHbW2jTx7AbMgFv+3j5EjE1ZLca58on4XS5iTf6FEujPS24DYE6r49G02jjKC2I5uI0EbAQunPzcYgxtOTx8KX05o/GGmARnlQA9DC5t8HyI66ART3Iealy3MjVKvtXhafllzjSNuab0ynE53NlhesH14+wxj4j/RjNi+wIinQCvMkNhaAsRrQmFuz7q4jtISYzL2EBKfgOI8up3HqkeFgl+txHo22tzePRk2x2XfXuHwt3FFuW0R9ihownEBCIgd59Tg+XXQH9ZNWKzD7zC5ajShQjDapxnIYjDt6CrNk0S6SSiguGnq0xB39eHvSCbSjR0ZJ9se9eOj/gsAqOCO+n2u9cW1F6WIqsYmUMyYGiMbwcmhYNyA+bXCZsJPDf+7ESnC0g8TYeV9ns5IssObpfjibIAEVj4xgX1ERJjxuUB7u5G4SpFdICTgfJ7AEdGAtHWNW/Itgs0ZV4k+GZwWkZWZ9Lf/NjsMgGoV+YgQMX7AKnQnCTQrLM419qmIl1LXckBttqlKeCiOp0BUb7+T52hzbBMzMJKxhSFeY1X1TbZTA6AHeCQPzqigVeoY5zMH2lSkCoRn+dWrehCqD5s1sBpienGLavBcbCG264NJd1ssKQaC1Empi2vAhc+2prAW/LgnZl+CZc0SDXCgArLrk+3pEjTOcdueLRCaxVpiY6Kq/fBSadTCTF65Tz4VMHqDVzLnX+z4UNyzaOaUPR1duXw8YZ9apLDZ8it3x4946zvGj85doPIAvm2w35i2mLezd/gpSDVD5WElckhEzZc0t8rE1IGxRJ9OxJ6lteA0M+5KRZU9pRwHlG0Og== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: de38d71f-4a4e-450b-996a-08da66ad9a54 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:43.3144 (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: QNfUtbjCYSyuJdA4VM72Px7SSXsUlZ12bLEfBUzI4y2goQArbSmGNsxIKyuPePEdShRvAzKSz7tM0ZbcDTERdg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR03MB2857 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150156_577602_56E3C774 X-CRM114-Status: GOOD ( 21.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 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 v3: - Put the PCS mdiodev only after we are done with it (since the PCS does not perform a get itself). Changes in v2: - Move PCS_LYNX dependency to fman Kconfig drivers/net/ethernet/freescale/fman/Kconfig | 3 + .../net/ethernet/freescale/fman/fman_memac.c | 257 +++++++----------- 2 files changed, 104 insertions(+), 156 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index 48bf8088795d..8f5637db41dd 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -4,6 +4,9 @@ config FSL_FMAN depends on FSL_SOC || ARCH_LAYERSCAPE || COMPILE_TEST select GENERIC_ALLOCATOR select PHYLIB + select PHYLINK + select PCS + 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..20950d924c35 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, @@ -1097,12 +976,25 @@ static int memac_init(struct fman_mac *memac) return 0; } +static void pcs_put(struct phylink_pcs *pcs) +{ + struct mdio_device *mdiodev; + + if (!pcs) + return; + + mdiodev = lynx_get_mdio_device(pcs); + lynx_pcs_destroy(pcs); + mdio_device_free(mdiodev); +} + static int memac_free(struct fman_mac *memac) { free_init_resources(memac); - if (memac->pcsphy) - put_device(&memac->pcsphy->mdio.dev); + pcs_put(memac->sgmii_pcs); + pcs_put(memac->qsgmii_pcs); + pcs_put(memac->xfi_pcs); kfree(memac->memac_drv_param); kfree(memac); @@ -1153,12 +1045,31 @@ 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; + struct phylink_pcs *pcs; + + 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); + + pcs = lynx_pcs_create(mdiodev); + return pcs; +} + 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 +1099,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 Fri Jul 15 21:59: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: 12919888 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 21CDDC433EF for ; Fri, 15 Jul 2022 22:54: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=AO8vO7vXb/QZGMyDV5VIYmr6axHubDNoWATlFWsHN7g=; b=et8hcSlxqIs/cY MPmHy2p+2+nF33uDbV8aTa28QnLWQUF2diRfhdzrO5cEv7jeMIasFgZPSyQKFg4g9UehL3Mq2iSXE tjfoor4hB2siPGXC9hScK8pGjKyA/rvnIpgH9I9Vi/LVLX8dD/s3cGTl3MZOfQtVpiqyoHbQk2DZv T+/Y7I8DEnQYY1n0owFtrJawzWX0GSJEXPq9O8vouPsntvv3FqYLRbhHZFigjbZEcuQSMk2QSuZAx x9fE84k4sCdXZkg8GkSO3EvkmjaSq25KMFEiuiS2HSaVJmYcgC/W3xrIA/VyVM+KTNe1FtqCjQ8N3 SPScfM1Fnk/vEHWPhONA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCUAe-00AtfC-SK; Fri, 15 Jul 2022 22:52:30 +0000 Received: from mail-eopbgr00076.outbound.protection.outlook.com ([40.107.0.76] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNj-00AbbJ-Oq for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:02:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lcemaz37QFZ26BzDCIUxuViNiDMWXR+YtiU+wk9Rnd6we94HAs2EKtUcW79jm9hSO3LGZzHZjIwd6y0BghFdZ7YNvxuheZFNs41e8ErjMmVAZ7dJSGcRsNuREdXV4UvKDrm0IPnUKtcQnL7eMQhfzTvIxDmYyjyfvN/tJU/odYzUW1ew5JA4sXY46Kd0suIX6NnOD/9nbTJSfIssUYuCTGEvTg3+2D4h7BztW94gEBgdVNrGkjHs8yr3mAY6C7u3wHRnEo4i8o9LuWbYVg1P21m+09wAf9yjoX1ZN309QsRadAJ96e5j+G3kFjtSXnXiIjs5mIQcOPo1ErxPXk2zGg== 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=3VwgBmsdXO0yhjB8COLP9U0M7gfN7/TKN/3fnD19IDM=; b=Z1mjTrB9sZ+7P6lRZwc+KHnXjSZptvj4+moGyzeQtucGrf8E5mUeKqdmfwWAltu+IwlTuZNc0PUAl8Kl5WZiXjF1DSitDe9DxFqzMnjDlanWB8pITNEiRsDyNh2kTnAVEqWxZdpMezZWkGJEenueXsA5YokDO8CM1u8frtIVUZwqTJ/GK5+8EkNcb/VNZNcMGSuEdDrpyleBeVekndod1YbqaZJABrzHAV35Aak1KcILPh3kugru1Zp/AMM+GPno9otqT111tCsVq84oXQNHlK6AFMm00JA/Gh2nm8kwEl63EpM92ZrS1gZOEEgPNxnS3QzYbwOXSTZI9fsEKwHf/Q== 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=3VwgBmsdXO0yhjB8COLP9U0M7gfN7/TKN/3fnD19IDM=; b=IssHsfRI12ulxxlO3D//72LgLvymCiuzcy15jT7rZdDsMUC7B/5U/V8L7O8lY977mTXhUQTJmK1VWhsrZ8PdmiqgUUbzuFzvEHfbERO109R1QrS0av9A2koyNdZ4V6YdvLG9Rvweh7A0IF8cpvW9jLcpRU6eHOI8TGKjkdjaVbv8p0vaVQ+C6dbhz85d3RBdo9cIJEufGyATT/w6w9vzBXYfyunami0rixVgHpDMPrfL/oKBE5VktJUjbEI5n2AfVvEjMlWZi8Ebi2W/PQsFuH/o14NAX2hRdrPz5lBxvqnzbRq8drs9732fTKQ/m5Cd41PvK0SFg/wuD7oldxUOuw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS4PR03MB8433.eurprd03.prod.outlook.com (2603:10a6:20b:518::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.19; Fri, 15 Jul 2022 22:01:45 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:45 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH net-next v3 41/47] [RFT] net: dpaa: Convert to phylink Date: Fri, 15 Jul 2022 17:59:48 -0400 Message-Id: <20220715215954.1449214-42-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 787785a2-507e-4d61-5eec-08da66ad9ba2 X-MS-TrafficTypeDiagnostic: AS4PR03MB8433:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZV55SGbpOizoWcfiJmKl27L7m8Qoq2vgUDrm9CJtohvIxlbh2XG4W03btpxw2y2k4WDhFGDPW/iPHRQuiw32Kx0OzzUljgkjjkEn/RS1EB6mQGRinlhCBO1iNDoZjvxIPvvoVJ9nav6v72DSYKXjLJUgBGSENA7wNkMvBpnRjol8qCkzHxD0913zJXVwZdVOIqZQ7LDgCnQKrssiE/zw8qK7wfkwIVVUFtHV2+nKnYxFi108fCkvmnkKpFJ5cFwlX4x6Sq4cP/ea4SxU2BhncsJjh+CLxZJIiNSTb7UYXqz2Y0yzEZVKCF9N9FoLNvhFzhVoxgcdBbPvg68oaMbLjTI8S0dRxBjY7AWAPjRTdZFBgOixzY4SoBug3kk6Wh4xJEUwcxCP+MT0HSVZ8O+OeFyDkSiAUd90U9xfVoZH2f2/evTfJMHjEEBFZrhrFMi/lmiC5zyDHf07xMxtU6YiehKfaNu0JXVGZ5kKuMYMcaoICgi8vYnfN/U7rB9ZO6fEVLFvWx8DzFho4cf87bttYb7pNt+zQ6S9svoYS9+D9p2St5WU1a1fnzt5D2tmXyvyo60/tYmV01MxHsvK8zXF/LlF4hJCaC3KS/llrB42m4eQOZs88KX+vdr/29tj37/rPgigN7ussIYCBv5mApE/Q7I8RyUDS0uzXSRdHX0ZmqtI9vawthgpLJb7cA6eq5znyYTova42jQa0NbxS8ZMd1a/ycJggdqE288Rgv6RYCWZxdBWRgevoAIIvuPWmZWafX/FnfeX1Pk/7SU3QCfAaa1jc1J5VvFkKzrdc9kCaVV7hYgH5JHZXHReVz7AhacG0yAGOhACr/nxYfJtH7qWm6Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(346002)(39850400004)(396003)(366004)(136003)(6486002)(478600001)(86362001)(6506007)(41300700001)(52116002)(6512007)(26005)(83380400001)(2616005)(54906003)(1076003)(107886003)(316002)(186003)(110136005)(66946007)(2906002)(66476007)(30864003)(4326008)(66556008)(44832011)(8676002)(5660300002)(8936002)(38350700002)(36756003)(38100700002)(559001)(579004)(309714004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2cB4XG2xiH368uctFuQDec5OnvVa5KLdjqzwGk4EGb67X2FS1PdtrwQ3nsLEqskTHAm4usHrD4nEdM3kof/TvUlKEAkHdKAXJpcNbt5fisDXSKQCNgMUGdjbhNWlD3ajj8mO8NwbSjDBKSGOWt/eQnbLURtIcvTMLUa8647H41x9UCG1PIyJoi9K7uU1Caxf68AhPaaRl1e9ITYxVMRNluTNpbhldryqFefOUPpj/8c8TNwtmnQLFCDlJi2YktbWzKt47lRqwFTEw2HXsFi0Bn6VPymrZkRiFvYiucvQ2hyk8KyeysXo4te+XuCB1ZJsEmiMdSWDotjlagO13HKemYsCyg4DuFngK6FzUgKanpHal5dQ+VlQqVGn5PID2AqvPCdUh/EdKBykMRX0JAH0Z9VXeJRvvkLY6i9pdlfJvtpCjXzmvX1mNOYxm+82KJMMkdIkw9Pb/8nHeM9QCWaaOcL9Nt+zQBwlof/wzaTEkU8RRwPwloSTh1/TYdBpPW0cAYnwTg4WdtJjI23q65SZ/Tou1Yn8xwFoWHLk0MLdxOc+Sg2jmKmexAIPw5xxkjV8i5QLjrr/wDH2yNQ/uc9b15mPHjKEUfGI9p8ea+LUKVpcmrXzxxYcp8x4DDmyFrvu0gTDgO8AS0APeiqEcU8udG1R3F5N8Fk0nRc+ty6X+EVu1aIW/zbvN1ZAPufkSCR6JLwkdQ18468uXErA4oDOSgiGRNjqpiCR7vQjZTCUBJy0lH8g1EaR5x/cpz70STBVA6980vTIyizxgL7NbBPskeizhd2AgMaZVjDYIJ3sDcFfKaq1vwFG9FpZfLdzGhugCVqkDBnB08juILRT7rcQzNILif2Am6H3D/tIj9lUKY0rZ3Jn3zHa/9uE865p1xx8QUL8lX7XkukgnAze7aoZ7B0NaqOUZ3uPuYPBETmkWBlrB9dMgbrH77EoJPmK5Iafar9B/P7olGvgmbZEReRlMrQsJxiqDn5h6lLshgHBAqg8m6IRHRl8cCe6QztVcenIlOhl0WtuhYdky0ZZRYHvtWIETyga/0zRXqzBXS+re9NoRy8fv/obefBaI39+i/PkCqnLthEJMr52S9PkGfsqBc1WW2+SuNGB26vVPumTjfmvizTkebnyQHF73Jn6wschpzdWKbakXXYsWrqkGyxFIBMJKkFSz6ANBhV+uoCkOAWV9972OWR4Ls8qHK2+ALaTCm6vigzrsqwURUYimAr+OSQCAsPR50beGGHQIWAcClm5zTR6rPdVMHtRQ6ipmlXjKGVFVEls+o29TzFtX/oELgCyuUuW58GM03giarMiEd1Fz1XCXhQ+mItb7bcDPvHWxL2cVNaGvZEMmFOz1RdH+s7pVB4LWE2R55YOVg2aiKOGUJNe8zJZr2SeEleuRYQzkWw9WUBBHYxqOON3UEAvjCJLMVcHIq8S0q95sXUimvxbRgdVmZz4TI6ztiDJbU8QdOs2qYl9SRQ3UCROVPM+1/GEPY6DSdCvNCjLXTN8LGiqFpSlfsLsVrYgSL/TymS2unuVxR7OZUeUhnWCdvpCDKzJbm8dUzddl4A5jbfFo7cJiWjfNmIM6PT5UflUmaR4/qAiL3ucpDqTz2qTyaZAyg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 787785a2-507e-4d61-5eec-08da66ad9ba2 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:45.5018 (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: G08ucjPDnZECcV18XJv/UH3iiJtNg1oaSSq6/ZmpD9ToWyGT+s8A+nsLoP+v5FTk9UJn0NEDPC9eB7gUtPbKYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR03MB8433 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150156_109496_1A555830 X-CRM114-Status: GOOD ( 28.30 ) 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 Reported-by: kernel test robot --- This has been tested on an LS1046ARDB. With managed=phy, I was unable to get the interfaces to come up at all, hence the default to in-band. Changes in v3: - Remove _return label from memac_initialization in favor of returning directly - Fix grabbing the default PCS not checking for -ENODATA from of_property_match_string - Set DTSEC_ECNTRL_R100M in dtsec_link_up instead of dtsec_mac_config - Remove rmii/mii properties Changes in v2: - 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. - Configure the SerDes in enable/disable - Properly implement all ethtool ops and ioctls. These were mostly stubbed out just enough to compile last time. - Convert 10GEC and dTSEC as well drivers/net/ethernet/freescale/dpaa/Kconfig | 4 +- .../net/ethernet/freescale/dpaa/dpaa_eth.c | 89 +-- .../ethernet/freescale/dpaa/dpaa_ethtool.c | 90 +-- drivers/net/ethernet/freescale/fman/Kconfig | 1 - .../net/ethernet/freescale/fman/fman_dtsec.c | 457 +++++++------- .../net/ethernet/freescale/fman/fman_mac.h | 10 - .../net/ethernet/freescale/fman/fman_memac.c | 565 +++++++++--------- .../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, 622 insertions(+), 916 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 a2a89f547813..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,58 +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 -#define PHY_VEND_AQUANTIA2 0x31c31c00 - -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; - u32 phy_vendor; - - 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; - } - - phy_vendor = phy_dev->drv->phy_id & GENMASK(31, 10); - /* Unless the PHY is capable of rate adaptation */ - if (mac_dev->phy_if != PHY_INTERFACE_MODE_XGMII || - (phy_vendor != PHY_VEND_AQUANTIA && - phy_vendor != PHY_VEND_AQUANTIA2)) { - /* 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; @@ -2966,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; @@ -2981,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); @@ -2990,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); @@ -3145,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) @@ -3552,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 8f5637db41dd..e76a3d262b2b 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 select PCS_LYNX diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 6617932fd3fd..c170457b0308 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,124 @@ 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)); + } + + 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->ecntrl); + if (speed == SPEED_100) + tmp |= DTSEC_ECNTRL_R100M; + else + tmp &= ~DTSEC_ECNTRL_R100M; + iowrite32be(tmp, ®s->ecntrl); + + 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 +1018,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 +1077,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 +1093,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 +1121,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 +1184,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 +1205,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 +1260,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 +1277,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 +1334,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 +1364,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 +1386,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 +1404,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 +1430,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 20950d924c35..1cac6b85e537 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, RATE_ADAPT_NONE); + 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,9 +975,6 @@ 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; } @@ -995,7 +997,6 @@ static int memac_free(struct fman_mac *memac) pcs_put(memac->sgmii_pcs); pcs_put(memac->qsgmii_pcs); pcs_put(memac->xfi_pcs); - kfree(memac->memac_drv_param); kfree(memac); @@ -1028,8 +1029,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); @@ -1037,7 +1036,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); @@ -1064,37 +1062,44 @@ static struct phylink_pcs *memac_pcs_create(struct device_node *mac_node, return pcs; } +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; - goto _return; - } + if (!mac_dev->fman_mac) + return -EINVAL; memac = mac_dev->fman_mac; memac->memac_drv_param->max_frame_length = fman_get_max_frm(); @@ -1128,16 +1133,16 @@ int memac_initialization(struct mac_device *mac_dev, * the first one in pcsphy-handle */ err = of_property_match_string(mac_node, "pcs-names", "sgmii"); - if (err == -EINVAL) + if (err == -EINVAL || err == -ENODATA) 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; + if (IS_ERR(pcs)) { + err = PTR_ERR(pcs); + dev_err_probe(mac_dev->dev, err, "missing pcs\n"); goto _return_fm_mac_free; } @@ -1157,84 +1162,100 @@ 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"); - 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; - } - } + /* From what I can tell, no 10g macs support RGMII. */ + phy_interface_set_rgmii(supported); + __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 0; -_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: return err; } 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 Fri Jul 15 21:59: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: 12919882 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 E2B53C43334 for ; Fri, 15 Jul 2022 22:52: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=EOuyDuXPG6UpHYnJDiqSdv4efw6Ggs92T2DP2j2sB7o=; b=M4N+gw/d/d4gfV ePDnz1SCQ78qoXoUGbhfuKKoFcBxW7MYCJQAcqCWQuvsZUKaQdmYqGntl7TCoG02TRpgr3s/2BEpQ mo3Hy7m4caFxVtRkumM7iMcaQz+ioiTa/hxInXQxxbvGdwIWXVv1ESSyIQSD9Me+S84sRd2P1Dn6F m7ji+caX7EdDN297Jh5PkB+g8rZMF/U/ydTmuNgaPnCefp5rLAswyyRv/kZZiH/sOi3EydxhW+xIg ky29PRxRYD0EaNFy/heLJdMQraZx5dMFMhN/evql7gEPT4w4f7NKU7/uwC5AR5ycfS+B8v1mLipx/ aZmSZR8tkVyQPQZuUcrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCU97-00At5u-Oo; Fri, 15 Jul 2022 22:50:55 +0000 Received: from mail-db8eur05on2073.outbound.protection.outlook.com ([40.107.20.73] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNn-00AbaP-UU for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:02:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=da36a3ySCNB62DfBOEziOCQ6i4+AXiKG6I5knQNCokX7IjGZ2D8dlecJceT7+0PbmMoCQ7GQlgKhsxrVwA/5lnhO+WsJvJ4fX6NHArEq9kalFYCXr0tfBugrlzQSswhzLYx7kUFyYp+LdfUfASGoBN3K3KFkmQHJkA4joVn7MOXNF4GfSY//yAIxP9JiJRkqebRqljNPASATFvX6y2ksfOvWt7YxGvWqvs5W5E2xFlk8pQ/4s4x8+0/v9EL2JMlF9i24jUwTdOUgiiZ5len9yHUjeMF8IbCqpiUi6Jmxw9/0qvuWucc0P1zAxVbrZdAAU69oth/Y1skaLiXTWHkmDw== 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=8AtSHc+YTXvYBTpaB1x2mjz6YwHiaiESxiffu5dhh4o=; b=N/zuM+RQHqvbPSrNr47P4Pdet4zR3kaeLDwgC7aToc8Wm9J+D2d2/yvqtbTlVGSAT829IU8lBYX/dQ9SRRVHL26lqScnL7K2EeneRhM5Khz7z59g61U/E6OokxLPF93K5S820DcQZvz//m1b+ru+Rz+DWtQK+rPe9c7D36WgWbLJUlF+wyfcLBSjdZe/2ahFD8D9glvpAOTouEbBGuR9Deqiyy1p1O2H7YXqrHFO/Js4dNbL5h2qYbQjc5QcR2hvRit6RQsRbz9+/wh7xAfsmBFnmRMZ+54FzJe1/ZOBci9CQ+dDpnySVV2yuowRPVagQA/nIIPjvpRv8+A3mkfYzw== 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=8AtSHc+YTXvYBTpaB1x2mjz6YwHiaiESxiffu5dhh4o=; b=ev4jfKWqBeXJJXve3LBPInvmcOTLTJPUoxSwUVnorZTqAAOfKFJvRhDama8lZvsMn2IbBDJml0cBw3h2rJQU/M4ItaPSJAOvSPShpL4NdZFI/Pt6+Tk+5woBe1tN0ulXwq9tU9nZ6d4QG76LvhDn3fn/JBlYmn/ohXwU4Zcd4KjkGkFDK9g14gXaag0t2QE49Vj9w7WPzOgI/RWhMcNF9tL6PCkNCo8fsMxZzloz99bR1X+Cp1OfsQUnFDzudBmKpB8Og8X4zpBuTCKbfQDbBojIfFeDecdS8qIYIKZ26q8xuTJxW8RDity/i6bK0ZHtZD6f++RwW5lAtOwRNshABw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by HE1PR03MB2857.eurprd03.prod.outlook.com (2603:10a6:7:5f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Fri, 15 Jul 2022 22:01:48 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:48 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , 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 v3 42/47] powerpc: dts: qoriq: Add nodes for QSGMII PCSs Date: Fri, 15 Jul 2022 17:59:49 -0400 Message-Id: <20220715215954.1449214-43-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5e59f55-4478-4918-5501-08da66ad9da5 X-MS-TrafficTypeDiagnostic: HE1PR03MB2857:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GlRgD3gfjb6PcOadO2SeyzSMsREX2HfbzWaKb3XVWLhZfkQLIESZm2eUv2DqBcXyG6CYPGimCJ2UToG8ha3eT1m10Cv1gbMrjt+XKUdfQ2INLr6ZziwHZ1m2u2Nx78HxVIKh4IYpZFwHR3dE/liTNmyfwkG9GG9nrvCjdhzFh3SZUmmxjXyeWEhoAlxJ60WZTgPl5pnYz9ovnoS01yIYWwWGny9eOii2U52tO3BRRQGHJz7Q1cfjrpZYFcnSWcH5g6W53SJejh8p9uXT/gnaXScSS4pN2sF3F47E2mw4jV637WXDz3ACuGqb7AP8DncPwcE0NTVK0g+5ooRWQR2JA1YKqa0OmS3GovyGKv1J5JRzMc8x93aeoRHXRaJ+f2gIEhNYmc9hs5r/t9jb8QB7Zn82/GTJHtHV4aRBGZcFLmybXk2LSZl3KwUVWPtKNrvWnBFCl/hpnk1IgPrz/4zgodbfWhAXZsn2aCz96EhlLJTT8rCKIbHg3XQTXDfCv3UjEqZ9mqSckveY45U0SO13LwtVbShXLiJ2JqqYpFT4HPmwsuKqCoLuuWthjXyRWjpfFLHNWPA+udg4P651v02wBFaFX9jrk+skN5NYwgqP7XK86sjsmUpt8PBj7F6QRPNYZyO45F6+arLT3GIw3Tner7zpVGCXVppyZqruviIhyoS1sIgkUezU/tjsxLRk8bvY22RT0TZ5f2Nywv5jAcNF/cpVeOIz5Y5N2wLSjudSl1ns1SnkMFSvKvzSCPERsfov9AS9H8yWiAaYXmGaOHOvqlekdAFskY0W3kyL3itjUcOn52NjRd9FGO0uUgvx/+4+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(39850400004)(396003)(366004)(346002)(136003)(316002)(54906003)(38100700002)(2616005)(186003)(36756003)(30864003)(2906002)(6506007)(38350700002)(26005)(1076003)(86362001)(110136005)(5660300002)(6512007)(66476007)(4326008)(8676002)(7416002)(44832011)(66556008)(52116002)(83380400001)(8936002)(66946007)(478600001)(6486002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VDVgjrbG4kiVZ5amVfY9Hz6LIbM2gwcFE8NQGviLW2MhMDbsX6eJ1wn/VsJkpBgRA62Ijr+gAiu7YyyGUP+T0fKsTzHa7v8r9cGHgU1bPepsy722+7pNsSt+y2niaKol7cR24muRmLMz7zbVsaZGHspXrV3mIC25ZsckrHi2YK4rwMVYIJhUykQ221qEAMsEP1vfBSPH4vEtRXnu2cNofEP5GWjauh4ZnwiZUTqKmwKS3+PT3qNO05aF2VEC+FGCPWkZ/7NIM0u2gFbvhk0OlF2FR+/LDceIn1GD4R41j7QrntIMtV1lsjULIWOqfpDI0SZM7pFmRapegp19VIKvUUeltToKJUN8yApKaNfRuPvMxB6iDQ8yp7xgONNtpWy7k1AkPs42aXPLwyUfA1GEkzwBKrkrPBpxuepR/xXcXCSt8TyGddQ7gjniqPS1mktzLYs2vKSqtcardCAfur9XmE1k6e9dsSsUztzKqNXs5FLzMmhliP6Oh6fiDHaMvIhSYRNjjxr2OM9FglgFLKIdbBk6Rjuz8725+PVfrv10Q6xKkfZpgL1ShhomtTLw737pLtDJuoYfqUUKUUnlV45TjaEY06O8DIoCo/PyRgMXnrtleGlAW1Gs0FxdBT6Kw5i7EjQYMmTC+6KRk2TuwLbE28VOWBj9qgoei3fVTfqEQHFNPMBeSLDbBWB+ghLdz9kgZzKzIHJOg9gqq1T1mfISiDu9bGdp6VV5eDApZTxX6a4c002MUG19q8OZi4Y+W59jecA6LpdbftGBmPDfiGkxttmvPmHGQ7vINTSXAqbw4bz5F3VAyI6m0PvmFO+LsEK3XNdpLDgtY8u4tKs9UrtuMUf7dmAeHgVYukv7inQOPf1Zz1rGoudA41aMr3q0fGTUBJAeLr4SvjhyBxYY6ilpc2pmJxzDMxVyx13281W4ah53NoZ1uAhbKGB/jD55ncLYudiy51YbEXsXIL7LTZilNlIQ5qIMLjDmVTKVkIX8eR3uiUShBobiFZwbYuzcFRVs05vcHnOaYffCFomhW38fCgzz82vfRS6VDfZGFGim8saanELTs6SJaPh6VY/PEQukNQiUfVrERA2PQjhWHgMQS4K/FM2Lbfwj0WpKzVGFINPfFAwxY+10wV9SwwcwdW5FE2u4BWwzOva866lMLtNwt1y/5Z9QORh2IFuko2kbbyxlEnw7iJw0Dtg61uggM1nH/LJxs3BPyjb3iQvnldNVJ7uDhWFyhjGNXDOIY9zIszpWyxMFrPR5Lfw4pOPSavD+Dzto1loyEU+dHtlyl/ah53hy8buMZYQRhrwtkn65Y3ppB8ZioCtHBa8W3vKR47JgvoMu0DmUsie5ARMFtIVDA4LLFklmT9BebegptehJYz9rBgFQSV0Ts/S5/djDCJc8wfSasGlHO4hac6n7gduO6IsrAc9GLS9/itiiW9L7ogm5NMG05VLpyl6dQHg8eKfGKbcq0Tf6FcjV3mahE0m1Y89LLJ9rmnfZsq7lzgP1v0+JcEHgRDjMkMGlz00thhFKZtlYJdgSId0I0Tr5Wcu/jcy4MV2IKEQAVAmA9iw2NZyhjHTDfFMRhm97DeSV29CqIhwCGYgT764MhFsWYVQxTg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5e59f55-4478-4918-5501-08da66ad9da5 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:48.7517 (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: VyV/yuJy01Ay0+H4qFfN8TlRSyuwL+G2PbK0loomJ/Jje6nRJnPjNOFAl2CYVfpC6BkQwZgVLN8hG8foZBQm6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR03MB2857 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150200_078884_E1F67657 X-CRM114-Status: GOOD ( 10.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). This adds nodes for the QSGMII PCSs. They have the same addresses on all SoCs (e.g. if QSGMIIA is present it's used for MACs 1 through 4). 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 v3: - Add compatibles for QSGMII PCSs - Split arm and powerpcs dts updates Changes in v2: - New .../boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi | 3 ++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi | 10 +++++++++- .../boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi | 3 ++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi | 3 ++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi | 3 ++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi | 3 ++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi | 10 +++++++++- 18 files changed, 127 insertions(+), 18 deletions(-) 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..e80ad8675be8 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,15 @@ 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 { + compatible = "fsl,lynx-pcs"; + 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..6a6f51842ad5 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,15 @@ 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 { + compatible = "fsl,lynx-pcs"; + 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..543da5493e40 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,15 @@ 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 { + compatible = "fsl,lynx-pcs"; + 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..f3af67df4767 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,15 @@ 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 { + compatible = "fsl,lynx-pcs"; + 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..f6d74de84bfe 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,15 @@ 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 { + compatible = "fsl,lynx-pcs"; + 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..6e091d8ae9e2 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,15 @@ 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 { + compatible = "fsl,lynx-pcs"; + 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..9106815bd63e 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,15 @@ 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 { + compatible = "fsl,lynx-pcs"; + 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..a3c1538dfda1 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,15 @@ 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 { + compatible = "fsl,lynx-pcs"; + 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..c024517e70d6 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,15 @@ 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 { + compatible = "fsl,lynx-pcs"; + 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..75cecbef8469 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,15 @@ 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 { + compatible = "fsl,lynx-pcs"; + 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..98c1d27f17e7 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,15 @@ 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 { + compatible = "fsl,lynx-pcs"; + 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..203a00036f17 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,15 @@ 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 { + compatible = "fsl,lynx-pcs"; + 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..39f7c6133017 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,15 @@ 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 { + compatible = "fsl,lynx-pcs"; + reg = <1>; + }; }; mdio@eb000 { From patchwork Fri Jul 15 21:59: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: 12919889 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 AD7C7C43334 for ; Fri, 15 Jul 2022 22:55:17 +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=9Bet5aI0G0HrmnHKL7L1zzvfYoN2lLysRAibMKevAaA=; b=Wwemg4/oBJneKx 5fT8KytZYE14nC70b+AB+jdVI9uCZ+vNIb+w0D17PrF4U/cLR+h30DkhrZKsnrWrt8mJkKKrFyFXF PTYt+exNrHtWR3Qyl6IJ55kFoLvSc2hoYSolAK6iV5QB19Xth7ORoeaLkVEvZnhOqOuSj1KyckCPS n+4uhNUkeZOys71aEbFJNrx3q4M/EbWeqwuSGrQGdJAtRlZDo2o96juUfkYrG4lSgCASqfmYshyY6 99FBBlH27pDhnKkgbHKT+J3wTpSYjlbDUOkLP+f9VShbDmJeoUCXVz2MC8JWtYfrmsqX69a0VarhW rFFpzosvM3PjRlweBmUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCUBx-00AuJk-3t; Fri, 15 Jul 2022 22:53:50 +0000 Received: from mail-db8eur05on2073.outbound.protection.outlook.com ([40.107.20.73] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNr-00AbaP-PO for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:02:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TWVs5j9gG7SVXYmohK9FUwE/iqaIqQ9TuitxHIUPX0X9GMn3J/x6Bk7+DeScDPp91qi1loCLVvmIez8UAtH0BW2z+6qUtwNsg0sEfdreVmIR0RDzAOcE29D4R0oxNyPTaDYyQDSW6VkHqrJ40Uh9TrJvqNoKuqxKTO1i9dDAacOnGQGG3UfXw6yJ2Z0cwXtTaUWP7QotyfU/IkO578EvtMVFYa5/iXJNHTCf7Z+Go17fBrLjmx8FjUhpcW3A86tb4MgdJwTfDqcdAWEenAStrWdPyBR72gqFWKgkrYUreBGn481kjzUteFCxyycpPs00ZC+cYiYX3Qzh2lVRk7sAjg== 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=fkaQiPnuV3l+B9+GGmEaayl1/1M6ktVvaTFXKN5ZW1M=; b=Sp6LL5/WLF245w3ZW+us+IMAgxhULU+bex8o/j69Ck6+itKqQZpO0PeiI2Xaf7bqTxCttJQrMDz36WzxOZg+HdW5WYF+zU8547IicE9SYMAlZsk1Dd2LEW2z6Hdk/ojf6QKeAMaMULVQH6MluNdeVmzndVxs9iGoaeaVGr5PYI4kasrWeqTfplzCOfyVHqgCgeNgzvvZAEw8coxMnZxwoTGIOHVcJPGgMsZNN7GAbQcmAMH3iB40h28aaYbQA7SX7fLsJ2CFU5cSfoEaoLQAQ1E4pLoiPSS6rt0xqRYTThKllLoqX4hgp/SUcn0Ui+TiOb6X817XWqgm/ZiTb5f3EQ== 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=fkaQiPnuV3l+B9+GGmEaayl1/1M6ktVvaTFXKN5ZW1M=; b=JhfzuN9sYzuwPDWUO/4qD0mdIDwheBT7s7t991ncMsuo8SWM3H/qcf8iS6RWtbtVD6k94N0ztvfh2btH1mqQ5Aos6BkZrCaKRXJY9UNN/b7uumbwHbw9lkexkaFzCAj/LoN+k3CpZ7SWCL8g7Uy4AQvnjsUwICx56keQ5WQ4bjilE3dLBa3hKR5Y+A0Or8OAiXMhQPscITQNHVWRcCM7gm13vYtrbli52aqAdXFoVQjxEEH43Qw2trsBDHD/B/Kr/nV9bU+ycLpwGCQ5Ur/rywhNXP11llzvwfbKCLkXeMKm4xsdHBLvngnBBC0BqW7VJzLQMLCLBCNbKOOcEAH3Xg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by HE1PR03MB2857.eurprd03.prod.outlook.com (2603:10a6:7:5f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Fri, 15 Jul 2022 22:01:52 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:52 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , 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 v3 43/47] arm64: dts: layerscape: Add nodes for QSGMII PCSs Date: Fri, 15 Jul 2022 17:59:50 -0400 Message-Id: <20220715215954.1449214-44-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1778d27c-a995-4420-73f7-08da66ad9f90 X-MS-TrafficTypeDiagnostic: HE1PR03MB2857:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h++xAtxxzOZgwqF9XoqLSej7y2drnvcROB6arB/kRBxi1WlfN9AHYc08L2yh2icwBvFLIPRI/hcSE69K8q2L5oV5xPA9HHS+Kr7QtbSdi0ckIgWyb8GR6fE8Ds2hTyidn9m3hQz28ziVoEBZVDjkJ2aLs/2Hz3sh9+IjwdJ//WvgsKdu7YbWjkhdiaI4KsmiNn+CKPWd4Og1cYKGizg9UwCfUCyaD0RIVDtIg7ADukri6KzR1IaQkoHbEoHhT5T53IZqW7cVlKBJxnCGJFlwOcdIJ7Yt1CfQUk+Irl/nxLcmLutXb6QjHEoDgeAEYKyUiXgOenydu0vJY1Y7hXW5JpFeDEWCev0ThqXfa56hkEgRfKxNUuEP3Kpaxr725KaiGGN2Ti0xQePBgVWrWkBu/r7JeleR1swyDgYlYlmUHylsCQICuOzcZyYh4bDQfuAjTSvDcazpIOul+dFjGqCCutv9v8hAH4DT4CJX1sVrizxQlMv6ahrN9AEOgSVrnO1X9HRwyzokoflurslKj4AOaW0kg6vmKH7EZ/TiOWDt/IgWQdQpCVPKu3GVAOTRa9fsmwYUSWHWbsgAg4qoPAT9kIeuAaJueY8TBBRqES3p4qDIlmg7cfguLhT/vuvnqQthOeNTCLBOE16NXeUxM7S8FXyREm2NXqzxzBDPnlhFRoVb6mFfAkXUOsJ/H0OHbcpuk4sQdM+fgiLgk+nNGFRMUb0r2P8orKPXfmxMQgdGJUsFORaOwl+1ye3kTWMhGnGUbgdIzDQrUIUJQ72qBnf4qehnSQCDQWjBI2epY9U4iBJFxqdU4Yon5E4S5NXKJLGc X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(39850400004)(396003)(366004)(346002)(136003)(316002)(54906003)(38100700002)(2616005)(186003)(36756003)(2906002)(6506007)(38350700002)(26005)(1076003)(86362001)(110136005)(5660300002)(6512007)(66476007)(4326008)(8676002)(7416002)(44832011)(66556008)(52116002)(8936002)(66946007)(478600001)(6486002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uNXeWJcRGkx7yxLTDpzyOhQGBqVcgtg8tVyjXx55hq14w0Gas2sdc9xeWOLopBQAsNXpHgxdoWq+/inSY2Yb3YalRtqO2GKDDZC4LplucSMfh5A5mFaZyC39kidfhXrh1ssOu1tU7i8XfxmvRYDOq4mNhevV+xV4k0Jf6c/qZlyrR8SW9dR4miZ7YURridvbugonRIIqGcJCZuL0vqUqPRbD3v7guNqE+r5Ef+I5Lbl4vjcdSf5RM1hyfoi59G5A4yKLCp+leA7JKc+7IFdt6rQZ7DK6geX75YTOXaNfgaMwv/6qQJFRrRbn04S58y/PyMDPxWkAwuQy9ROYn75dbKRUBMXYnlKjeWfkO6Ulf4WpdGxOSTYVZDKyEvOlZ8E53Kay6fO2H1qwPz5zPz7x9uQ0Y1l284t/W46NI/v1pCMurqOhP3eczespujFSo+ISlAYqNDMl3Y+SxElRyo1S4Bmi8UhFqlEwWW4aqeu8UQ44fAiIVQqIvXAuQbiB1JuO2VdIcpLLfjthKeDAf7ikgK479rUAQlWij1FirsX8aIRkbCSaIVbawznAUXxvVgDgye3t1yYbcfFB4sCyD3/n/kUMpURJUk9RZSZ9m/cMlmmDuYsI9/gZxYxhwdg097H15wWj6eCxh6PfZgqFwDOFkA2voyjLMKG7WST24BanGizxxpKBW5M/qu0XHZp5FhOb2ga5aQVtZbhIlf8r4j1wf9Hj+T8onD7MSgFsEAShq/ArD4ZyadOH58mNPVucZSCCn7YEOWwUcosnGG6oCLa/I4UNrc5cVvuMuU9Sp5e1ZOLe+Vpd9G9Nga9/xaqYfZSk3fhJy98SdCXjiseW7H57B+kn4Pk+80NpDLDIvhHBXvaeJ+Ci84NbIiq6ZCmk8bDDY6rWTFw64+cPUmhocpCgsMrVdFSTqfA0m4or7abBCqxNA+qgWCYVe75aqB4gIdERfMMdoXJzeuZjG6tV4kHLU0y/HPmWhpn26/ZJK4F1qfyXhEt41ZMfTYA9ZCRY98/uyazVOIs6CO5xkk2V5gH+BYqTKDKVf2cQkwBZRrnz10KreJbUgyFoTS7FDsKHHhTVd89hcwrL8eFpamSYchFso08AY9mMlt2EGneWGa9cBETo+kIIspYlBTm8mj4arrT7Aggnp/+aRLTqKwt9MQaSEcir8WPNQ2s98qusg7kzGBGOHbZlFOQAq4ovPvoI5ftN3EHsCg9YB9z62zm1rKL8MHzA2h683aicufIcQ5Yf/X3NoXQEYfS2WQke+E56cP74c7gd7DIbIQZ3ucJ0rQVh+0MTv3l6fqt2SHZArWIozyG3UlvvcrynjKkKSa3r+UtiBlW7XW18emup6ZbjihyR2XQFxYRo8Z+7L0k1JOUb57IqcwQhgVXdvYGn5SDUhdt2rLJDATTP4z5sz6fSqD8mjpP7wy2grz+oE1F7PAxSuJwfeZlJzFRBawQvvUKXzC7KJL5HR08pBVzffuNtWEhs4s0e5vCqQG3oqJFcsRu34rx1Ae1e7ieFJk5/jn4D24H80xuraieFJfdY7yG8Lh8fM1mdcx1gA3PbxrMeAfdydFuS8wJnA4qPdptRP/ewGkKckgW6nyt4ARdNZZkN8m24ag== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1778d27c-a995-4420-73f7-08da66ad9f90 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:51.9703 (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: 2M1BbDNlG4ctFnpKKw/4tU8YKqhWsuXhQjv6Xnz9hKE5dD6cKGhcYSJZlW8gywCMSzYhuH62klJ9Hg/lEHsYhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR03MB2857 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150203_876110_A0DC49D5 X-CRM114-Status: GOOD ( 11.42 ) 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). This adds nodes for the QSGMII PCSs. 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 v3: - Split this patch off from the previous one Changes in v2: - New .../boot/dts/freescale/fsl-ls1043-post.dtsi | 24 ++++++++++++++++++ .../boot/dts/freescale/fsl-ls1046-post.dtsi | 25 +++++++++++++++++++ 2 files changed, 49 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..02c51690b9da 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi @@ -24,9 +24,12 @@ &fman0 { /* these aliases provide the FMan ports mapping */ enet0: ethernet@e0000 { + pcs-names = "qsgmii"; }; enet1: ethernet@e2000 { + pcsphy-handle = <&pcsphy1>, <&qsgmiib_pcs1>; + pcs-names = "sgmii", "qsgmii"; }; enet2: ethernet@e4000 { @@ -36,11 +39,32 @@ enet3: ethernet@e6000 { }; enet4: ethernet@e8000 { + pcsphy-handle = <&pcsphy4>, <&qsgmiib_pcs2>; + pcs-names = "sgmii", "qsgmii"; }; enet5: ethernet@ea000 { + pcsphy-handle = <&pcsphy5>, <&qsgmiib_pcs3>; + pcs-names = "sgmii", "qsgmii"; }; enet6: ethernet@f0000 { }; + + mdio@e1000 { + qsgmiib_pcs1: ethernet-pcs@1 { + compatible = "fsl,lynx-pcs"; + reg = <0x1>; + }; + + qsgmiib_pcs2: ethernet-pcs@2 { + compatible = "fsl,lynx-pcs"; + reg = <0x2>; + }; + + qsgmiib_pcs3: ethernet-pcs@3 { + compatible = "fsl,lynx-pcs"; + 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 d6caaea57d90..1ce40c35f344 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"; }; enet1: ethernet@e2000 { @@ -35,14 +37,37 @@ enet3: ethernet@e6000 { }; enet4: ethernet@e8000 { + pcsphy-handle = <&pcsphy4>, <&qsgmiib_pcs1>; + pcs-names = "sgmii", "qsgmii"; }; enet5: ethernet@ea000 { + pcsphy-handle = <&pcsphy5>, <&pcsphy5>; + pcs-names = "sgmii", "qsgmii"; }; enet6: ethernet@f0000 { }; enet7: ethernet@f2000 { + pcsphy-handle = <&pcsphy7>, <&qsgmiib_pcs2>, <&pcsphy7>; + pcs-names = "sgmii", "qsgmii", "xfi"; + }; + + mdio@eb000 { + qsgmiib_pcs1: ethernet-pcs@1 { + compatible = "fsl,lynx-pcs"; + reg = <0x1>; + }; + + qsgmiib_pcs2: ethernet-pcs@2 { + compatible = "fsl,lynx-pcs"; + reg = <0x2>; + }; + + qsgmiib_pcs3: ethernet-pcs@3 { + compatible = "fsl,lynx-pcs"; + reg = <0x3>; + }; }; }; From patchwork Fri Jul 15 21:59: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: 12919891 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 556E6C43334 for ; Fri, 15 Jul 2022 22:58: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=LijjZqMmY8D2JsT3Jpb+kJuXRXPRzkrb/1jZfeoYMAs=; b=sePROPY5WueS0r LQW6szySIxxNkocrhMe1ZovsU1iO25W9I34M/I2nKN+3fKqtHJOphQZDpjI2sQZgE54HPxN2OvK/z NsDkWhtGPuQpDCB946B0pBJ2nW4NQIUnGlQuQ95BXRfT5EmVHt0ICBgdvlZdak3iBUCBz5r9dnlvI J19JYvBe8d2J3g/STJZKuKAgJsMy4GDLdf7NwCYBmGLSAWNbRkKuI+MKjeg9RAHKf3NzMWRLhcQ4A LXTQ5KIDu2KJLGrC9NKHlGAWUeepZ67K+q3gyjWfO2cQ6SDDqj+kGBwob7KkwY/VIcueeUnfnu02S 1SaOowX/tHSXa1PhYcQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCUF3-00AvTP-02; Fri, 15 Jul 2022 22:57:02 +0000 Received: from mail-db8eur05on2073.outbound.protection.outlook.com ([40.107.20.73] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNt-00AbaP-Rl for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:02:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=euLGPJFhtX7x/Xz1NyFDuD+vaqKpI+x9bIK1DdnTdP63KbnVXqMyWHbqcQwzxEPGEO+0rGmN4dkQIxuBU78gp/ifQe6t2SvX+lz/dKmEC2aWvmtwSS3m9Q/HHj4bRmoUneqwtStEYAe2lxYbCgTY+280Rpw9STOxnyhd6RefHVHMF8d1HpGmWH92bMm5uDCZ/UxelIgbUWPe8gCz5MQ5fS70ZmAdt4rZ0pk+eb1ekOLhfkg5ndOPy2n9LbAL5YRZxFsPZwMTaN4FKrjS4bqO83YMRWTTQ9EjsE84Ddyzj7t5VmwiQBfisMWNT416bXli7iHf6+8/NZWaS5sfo4zckA== 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=dDBqgQMlNpG+Izo17B4XkBJl6cjZRtIKufy0jFsSqSw=; b=GCy39p8epUnH4b9Ax8ESnK0VrIG8i4UhNDzrrd7vjPktJZ5ehMraWDYxBp+OaeG9HA963mC7tOIApcl+9Zj2J8Kwq+oxamzWr/rxuyKi9dcaBYEayKv6MSiXttt2PGeN9gJGlBZroHBPr87PEKwDhS/5/diEFsIx7L7ud43nr3VC9KDTrrqa2sz0rfYWyyBjuQxBmCZmlcNAiAnLWCbnY5PMxH5Y1s+zmF8UEvFfDe6NAy5SWOmAZ7i/aqZl+qA20UkYV4/LiyYDzvc+Vvov5rITcFNSXWY6+8FLS/AQnhBM+Tv09ZXgWJQPPIkB7ZsH8db/hIouDARCDDcpzOhTog== 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=dDBqgQMlNpG+Izo17B4XkBJl6cjZRtIKufy0jFsSqSw=; b=ye4KAkXzyaavVD9XTvG6BwWdKmeETMDzVTbemwF/RlSfI/nHnq3ylUkYFSJ69Jynvm0nuG5g5N5V4hNTT0lNSeKmY91tRROay2qbCik6fRnXpueq502TFbWk+3GKsRlXdJn8HMLpngw+LkqDouAT8Qo2p1bmxUVT7DQE8OE9dMA5uc8SkQ1xnSGrZKI5OLei1V5J+fyFqBf1F0Ea8mIYoY6mP/WCzoQuxavBCHwrF2xQz7QdiVltZ3jJj3fA/1EHOP21KmLWV4lq/NmpxAxRlczFkJiSydXZt2hMZePNyEWO5NE1Twv1a2qiLEHC01huiSt8fQTwz3sbByKTYz/MqA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by HE1PR03MB2857.eurprd03.prod.outlook.com (2603:10a6:7:5f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Fri, 15 Jul 2022 22:01:54 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:54 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Krzysztof Kozlowski , Li Yang , Rob Herring , Shawn Guo , devicetree@vger.kernel.org Subject: [PATCH net-next v3 44/47] arm64: dts: ls1046a: Add serdes bindings Date: Fri, 15 Jul 2022 17:59:51 -0400 Message-Id: <20220715215954.1449214-45-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a80fd86-61d7-4ebd-e632-08da66ada12c X-MS-TrafficTypeDiagnostic: HE1PR03MB2857:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NgMZ1cO8szdcaopUGgrR/M7AjUQORhsmPvidRblEHDS0pu1YP18qH6J9HTKjQE8SgnbCItKOqec4MOAdV/7nkLBnwwx7XQfcFqlB9cfM4tfHwENPY7ESWe3YroTmLsUpyb9CkXgaG+GsgmM6CPqqKUdQMaS00ZltXXc2RKf4EGYl22RVEO9xUNEsDjCw1FD6AoKyM1CKqizYEGSbeBj6hwUm+sFTxNJ9A7c+QkUj4AX/OE5wv5ARbLDGrIGYkPQUq3OsElPZIaEo3smmYONjirC+TjF2LIKZ8UOdffY1vXd2KFJqMAB8rzFNA+dMdrkPjFDHL0H84el8JKmrcaFr1MT7qepqJadw3J6J+JRt3y8TetcvfJhkc3ZryMWuWR3FTney4oqdnD9A/Xu0Wil+TqbbQ+gQ0ZKNQZHhfkTr2PVrvmoFL0/UiqttyAhjx/3Rt5WBIM5HyWEE36g8ASl/glf8a4ajIhe6UHfnDbmcbC7g1AapWMA4JjF3m+xV1+oZrVIchjLjOmJGCgwUuHDvt7fwQ1hElkegMA7sGveNOwoYC9kZmPcX2PtRgnA04kCdEHGwXIYVkNAM4y+NBBOK5X4k/r81nul1K+pXEy7dz6aLSzSYUheWaiDofLb6cWNR6zTQ30O18QB9i5xBxbujEf8LJjjGXIrrOQpePmoPGfuytL5SfXLxVnBKsFOLKX6jUKLiiypsggkBeYkdRL5GB2LBJPmSH3TahHlcf341x2Wrc7PnLnyXM5Jqd6mT4Q0QHTkvDD27X2rcZXrRMyaCvX/aJOKpNwQdPwLdhOPHdgDB7inic9vBEhdIjCAsThuEtwhekjiM9zzjPPWa2bmIvw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(39850400004)(396003)(366004)(346002)(136003)(316002)(54906003)(38100700002)(2616005)(186003)(36756003)(2906002)(6506007)(38350700002)(26005)(1076003)(86362001)(110136005)(5660300002)(6666004)(6512007)(66476007)(4326008)(8676002)(7416002)(44832011)(66556008)(52116002)(83380400001)(8936002)(66946007)(478600001)(6486002)(41300700001)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AQXlbxxT8lcqsJ0HOUL5sPsOJLLl1wS/ppPEb89e9NWO4oJSsQrJ0YVHszGbvu+V8a+z8c0CWdKplV3/uLW8vPD7iMxfSFIfohBGMwMRsSUgszNRWtcwQP/0ecCfdtZWVy06n8aQqDiI/C+/Gh0RR1wFKR5ManUocuqYbMMETkM0YO+RFuzEso783gcb780mCoRYaCrL3EC+L0YLeXE85/9ps+LcFj0ZA4MNzBuec4PtNH72iTXv1PKWu7f5+ccp3a1/MkBF6y/5jH+WWiqyRdYDGz3+bZpEbq9GoS8eCov4r/lC4Zs6kSlMCdIrWYT/JVLnEIgLHEaegU6gEJhLa6Q+V9Bfrgqsf+jdpm8pXWJF5xR8Mh3EQ/RG3zFvJMF0yys6TsQ1nQoMg1oEsnAXayXL398j5DH3IwZ4KDWQjBmI5HgiNx372QqB8bVFGSQMYSJ8/dixUfQ4M6VnE6yVd6AnTWvxqBHnwc5DZ7v8QUm5WEUoIq0EqmDAi5ZJI09kSwIaqG0xRzcU54ixbcpanN23Q7WfamF0PUnnyJy6FGvCbYr1i7X8tZpdJbii2DSLKIv7Tlyl+uhNsKk9iVDioCXbYmE4JWt1bxfyifY1aKBnX0mZUbmWD4DPVNDzNa7rweyY9bOPRkJ134U4sCyV4fbzePh+nWEB8eD7h+nTuKXjMeOdFuGPgzOhd7PdeJuSWID824LtMeAtahwpS4lUylJIjC/5Rvvr+UC90Uws6/9rrd9qVYfyu0Pps/TbBdcHjXuUGQ6bsaEgWqtT6+ameigCuhnBaXbP63/78isLjMvLp9E0hngiu2nKCL1XJ3asrokXUGZBLCwdm8Ckr5cM22QcMBXUbCRCkUsBUJK7zdRkSY59Fp64Wjw1v1igfneavU82ID7na2f2+oruD0OwWagxx60qw/Ns+DP0kfyhCKCPhk01hnOZj/HjD25z7dXG4NCNRVorUCP4Lne1dogFYdObQ2WcbHlZ4OAFmGsZ512qwgcOjQ9PoMRvHZK8hf10kKtJUZ/jiJKkDwkYXwVDSlhzKmNyq5G1ol2DvK4T061+q8hqoqP9onlgx6Tde02L9XTIn5VceuDkb0QnxUFsw1wM+0We2W3gztES2zJckaS/GXsO4SMyQz/Hr71wW3w96ARLHlcWEx88aYVbKhadNTusAAzQtwy5xWjMDm0tXWUtQqaWkGNKoS3nBajmhWyLSN195zbqOOT8OkiREUNyiC+1S5mkdwCHwLS3pwrEQMPECaHmZ+udFeRgwyso5xlLO216otWW5TBM/kLuRReWhY1w87Y+FNmpxbsq0DxWTgxpQAGOgCoauRwoPTAKLLUDiwT/JkYEvgDiySAVWdmQmerlH9GXnf0zDrWJImmT9hOeifanJCTapzkF5wVii+VsrZOWdDQZe3OCyMMdOAUBOTt08QmYgJu7IfJqsaMM1Kucfs5UEciDlZZu+/G+KKiHa/fuI4VgVMH+q+s3Tr/8uvEsWioAJway7KnHllSZRui4mSsF2+QO3qVzeAJcfnihHesBcmew9LcD1Wl2r5Tqa+KwaoCBfwaC+tZCtgBXhoLXXO5e21L6ENWNGyFeYiyu3ICs+x4PlVAF4BFPureufw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a80fd86-61d7-4ebd-e632-08da66ada12c X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:54.6733 (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: 5aTP9iAET8B9ZrjqDfEVTcanUWa5c8neODiTL7aavuxFmdBHfdoU46s0sArlrESX2lG6LaN4WyGasW8qNrfiOg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR03MB2857 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150205_973195_8C0A9264 X-CRM114-Status: GOOD ( 10.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 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 v3: - Describe modes in device tree Changes in v2: - Use one phy cell for SerDes1, since no lanes can be grouped - Disable SerDes by default to prevent breaking boards inadvertently. .../arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 179 ++++++++++++++++++ 1 file changed, 179 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi index 0085e83adf65..0b3765cad383 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi @@ -413,6 +413,185 @@ bportals: bman-portals@508000000 { ranges = <0x0 0x5 0x08000000 0x8000000>; }; + /* + * 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! + */ + serdes1: phy@1ea0000 { + #clock-cells = <1>; + #phy-cells = <1>; + compatible = "fsl,ls1046a-serdes", "fsl,lynx-10g"; + reg = <0x0 0x1ea0000 0x0 0x2000>; + status = "disabled"; + + pccr-0 { + fsl,pccr = <0x0>; + + /* PCIe.1 x1 */ + pcie-0 { + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,first-lane = <1>; + fsl,proto = "pcie"; + }; + }; + + pccr-8 { + fsl,pccr = <0x8>; + + /* SGMII.6 */ + sgmii-0 { + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,first-lane = <0>; + fsl,proto = "sgmii"; + }; + + /* SGMII.5 */ + sgmii-1 { + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,first-lane = <1>; + fsl,proto = "sgmii25"; + }; + + /* SGMII.10 */ + sgmii-2 { + fsl,index = <2>; + fsl,cfg = <0x1>; + fsl,first-lane = <2>; + fsl,proto = "sgmii25"; + }; + + /* SGMII.9 */ + sgmii-3 { + fsl,index = <3>; + fsl,cfg = <0x1>; + fsl,first-lane = <3>; + fsl,proto = "sgmii25"; + }; + }; + + pccr-9 { + fsl,pccr = <0x9>; + + /* QSGMII.6,5,10,1 */ + qsgmii-1 { + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,first-lane = <1>; + fsl,proto = "qsgmii"; + }; + }; + + pccr-b { + fsl,pccr = <0xb>; + + /* XFI.10 */ + xfi-0 { + fsl,index = <0>; + fsl,cfg = <0x2>; + fsl,first-lane = <2>; + fsl,proto = "xfi"; + }; + + /* XFI.9 */ + xfi-1 { + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,first-lane = <3>; + fsl,proto = "xfi"; + }; + }; + }; + + serdes2: phy@1eb0000 { + #clock-cells = <1>; + #phy-cells = <2>; + compatible = "fsl,ls1046a-serdes", "fsl,lynx-10g"; + reg = <0x0 0x1eb0000 0x0 0x2000>; + status = "disabled"; + + pccr-0 { + fsl,pccr = <0>; + + pcie-0 { + fsl,index = <0>; + fsl,proto = "pcie"; + + /* PCIe.1 x1 */ + cfg-1 { + fsl,cfg = <0x1>; + fsl,first-lane = <1>; + }; + + /* PCIe.1 x4 */ + cfg-3 { + fsl,cfg = <0x3>; + fsl,first-lane = <0>; + fsl,last-lane = <3>; + }; + }; + + pcie-2 { + fsl,index = <2>; + fsl,proto = "pcie"; + + /* PCIe.2 x1 */ + cfg-1 { + fsl,cfg = <0x1>; + fsl,first-lane = <2>; + }; + + /* PCIe.3 x2 */ + cfg-2 { + fsl,cfg = <0x2>; + fsl,first-lane = <2>; + fsl,last-lane = <3>; + }; + + /* PCIe.3 x1 */ + cfg-3 { + fsl,cfg = <0x3>; + fsl,first-lane = <3>; + }; + }; + }; + + pccr-2 { + fsl,pccr = <0x2>; + + sata-0 { + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,first-lane = <3>; + fsl,proto = "sata"; + }; + }; + + pccr-8 { + fsl,pccr = <0x8>; + + /* SGMII.2 */ + sgmii-1 { + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,first-lane = <1>; + fsl,proto = "sgmii"; + }; + }; + }; + dcfg: dcfg@1ee0000 { compatible = "fsl,ls1046a-dcfg", "syscon"; reg = <0x0 0x1ee0000 0x0 0x1000>; From patchwork Fri Jul 15 21:59: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: 12919890 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 6678CC433EF for ; Fri, 15 Jul 2022 22:56: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=qHAD0nYoMiFjLx1soQWmWSPWPHO/vvvZjrc4V5/7UIg=; b=fqpPaa90gg3Sdm kMgJ74mZYW0qByNDVyPRHuxOrS3lEyT/TXJJJKbP5yAfln3EYJ/Pgbhbz22oPMTwep7lHcXszpfim R3k8nyuMVFueezIz9cOjylxW8TLiSBrSDuOAdf9CCN4EeWg369iZ3026T5/ptZnMZHEVi7iZtvc2X iedbELeOD2NS17YZvYZoJasWdGGEjBGxjn45W3f6b06XLA2Toi9vSsp+J5QWtgeoxft7KNt1GWhyv MhQblH2VEkOqW5Zz/F8y+TdgO1vog1jTMVe37XtmrCTJZy/7XqFshUMF+GV9EW3ZmuGteH6u+f/7J 6ZAueNR7IoWHqjDFw9Yw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCUDR-00AuwA-EG; Fri, 15 Jul 2022 22:55:22 +0000 Received: from mail-eopbgr10052.outbound.protection.outlook.com ([40.107.1.52] helo=EUR02-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNs-00Abpd-EN for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2022 22:02:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KIJROKjCUiS/c/3AorIBnQzaNSjFhH7cstKxPPSiPh7dYLj/qODqO5vmoum0o50pQDmcRk3cVSTrnOD5yq9mWUPuNKhH0lQWDwS4eHQ/kRoaNZKo8o6+daUXH/J/6kTW7BPy++QuCIJuFRmZN/AR6VS91ox+GovdhOC1Up/d5tdVCdrU7dvaCvdDGozYNBF/n9x0dqFlbn6u0dJU8n45ttgG2noYSLqXYGN6lC1kU7ZRqqD/aZOxRazJACkRSHt4nu5uEyNBS4UaQQ9BZDHNjbo9MRLUAA5DiK+b9vwdheIlpZrktUlXC4lFpVK31+pg4TvrE3DQGuwucFErR2XuKw== 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=FbLQV3q0/V8KQLr9WEwhbXr48x0fw4ztJcEoYQZ/QuA=; b=nttx73z3FGnW7tBwgekOvqcRPOsp+Mi4ACCw4SICr7f9+ZzmfIbBYdKrtW30RlwRYKCwzhJnUZBW+QWaKnrtnmcmznVPFE7A3maJfVFgz/MIBoZmPSMlT0DE8GEBV44Y13PDZMOHDVxLyihPy1UJnQ5mZzjR7w+iYXMvZI743nP3zptDhl+80qFf4da9wIG1Ck19U+L6k23eyYvz3zVOiBgxXP6B/Kwyu154toss5SuFS/7icBMmvkPfPboKfrc9uvtR3/CF+JvXp//soXR7CLZhvW+PSkXhdZqMQlYQDZ7EmAX7H8U8ZXECtHhFa8TAPBXN5GlD3kJ6sYYkuGdvIg== 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=FbLQV3q0/V8KQLr9WEwhbXr48x0fw4ztJcEoYQZ/QuA=; b=olKOY2NBx9CrD4GOSYfphZ2YVwDpj86mF5PtiObHEeO0Ihre4ODJyBvunx34Z8AbR3oX7QAGPza/qDkWcd0C3JMPcCHdpWOloHLepNqxhEm+2v8Nq0B+ytW1dLZj+j7gtla8wg1+mNz1VZ5JNvVOqmYcMzvWPtgxT+UGXlhJ5X44Wzdu/ZbobCUSScjaHkjAwP7EIN1VzndvUqK2OrCoNl6yfdrlwDKcUb6bbOcfbE2H8qEcYr5398ZfgtMya35b3kcOaDtbyKxRYj8X5MaWWax8MM3Gznu8EbYIbm4jRe7lLfhkaNsCXG7mJiJu+c3d5bP1yptsKGs5cBW0Tftttw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB8PR03MB6251.eurprd03.prod.outlook.com (2603:10a6:10:137::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Fri, 15 Jul 2022 22:01:58 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:01:57 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Krzysztof Kozlowski , Li Yang , Rob Herring , Shawn Guo , devicetree@vger.kernel.org Subject: [PATCH net-next v3 45/47] arm64: dts: ls1088a: Add serdes bindings Date: Fri, 15 Jul 2022 17:59:52 -0400 Message-Id: <20220715215954.1449214-46-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fc3c6b1c-f260-4a32-e1a7-08da66ada2d2 X-MS-TrafficTypeDiagnostic: DB8PR03MB6251:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L03waVZcrdTHVCBsIDWiMP80S3YD8Yv3TZcXNSb9+iO+nTZ55aBB69OcO/riOQ7VIxU4De1ftUf5aZ7gcLUfPQmSNiEwXboxS9VESJzL2XecEytALT1kKNZX2w2Nlp6jxBS+9IH/8zYXi0q0zjG9V6Xe45XYclRCvOdKTQQOYVkICZh4Q3kZmzOJ2tLXdt8BeKq8i4+mOWMeRhFM98h9YvAEtw9DKL2PDiRdG6IcaKPlrnG1kqAnVbVZz1vnvoZkFEGmjJdgFka7DugdNEVBqo5FYq/gsQIncsW8Sd0Eg66Ys7xBrfb7Cneo4QhP4JDxuX4ASK7D4qTnrr5pjxUrXTboa5XK4WLJuacDUIl9vaEhHgtUIelj8qNZn7oS/zbptHq5wpAlNcJQOlGrBu9qPUZO9lwjX9tjDNo/TQCyCkAFvz+LtkRBsmfCUtDn44LE2HgiAlEeK9zPZpXmfsUTV3HzFmKFZH1G1disQK+pgH2CYRS1LaqzO4thuP2Yza3dWH7MkhTVU7ggiXoZS06Nfe3LSXEci74L211wz0zRiA5budvC9wAeRoLZsfBhx0wGp+iQ/lNTrSdLlnrGUcG7m6exdcJvwMH2xo5dmQuTdVdjAWD1sPtXzBuR82TvZzxKgkxoI9kfW00RliGu8a9okkSn1gPFCvYDIEyOng1+AjTTcizoc+vBD/gAav/EmQuVaAesGBk6DDUfYPS8MfyzbPsQ3d/AnHG2BRkXqb62F7EPsCZdFF1HZWzojcWVeVn0Dis9R/7IGbxvU20XbRB/36dqUsYd5HQJHfRR/9QfhYi3jWx6vCkTevX2b+8KS1Z3 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(366004)(346002)(396003)(376002)(136003)(38100700002)(4326008)(38350700002)(2616005)(54906003)(66946007)(66556008)(83380400001)(5660300002)(7416002)(1076003)(8936002)(44832011)(8676002)(66476007)(186003)(2906002)(478600001)(6666004)(41300700001)(36756003)(6512007)(316002)(6506007)(52116002)(110136005)(6486002)(86362001)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5pjFQ58BYICRHOPb8Q3C0Idxg7FjEJ+6U1VYA029AioV/BV+JpBtJozex0FVLCwhZTlZ1AalQnqdW3HzWxIXrib5idaRRSquGxiJGb7QYJPdIE4cMvZlIyPN6yLZA6DYDa9LPavFGJ9d07b5azEotsVXKQmEGQCUcalG9t+XQ/BdNAN4bVPH/wvJOoXP7m4MtMnIHuTomubnIdgg6YFcFm7ojLbJS18Z3hiLYJOY5icZb5JliwVzcZNg4+c6iYlVhRCfEPCT2kzhrRMb0L1qsB5ZhD43td77O44x3CF9aRK3eLe2vccShznh1lhzj5fBqyYhASP/cS/SfhZCBaOodH1yG20LXfPteoE+yzwyThzozjjyN4WzVtsrS8+RvmL4H2TJA9aAe2RIVDcIFGqSTXA5Kj6ruEYHzGVnef+wOLVkdFVqn7Ux8EKNz5uBTIHT8ojGprvRCsCEu9PxiJeiY68cznzYmQzPhlViL35zREeXVwDY3r2O4p2kuIF5eYXwX+4+PREi9AH7n5r/YhFRGj3xx5s6HS76i+ufVHMGQ5elA3ycG17iYtcFzO7+W7vyuaFWyMTcy1x886ANOR1NyV21zybCMOt7zI00HPxmrXDR8BJMCe3nHgY6F+3NZku8aVrQRuwPxC/S8zLkReuSKucqWBcYX7QrSUoFuocLvcslG4xfql74DLVa+10/9d2hVhBg0DE5kivegC/YBwAFL5MU3OV0Dw9HvjFfRGh9uoho/Oz1eyLo62fQbg2CUjpSPxtMFEBp+0i/B8meCrA86HWXx9R1gdmHX3d8M6+WZIpDb+MhNNMLEhGbLrDgsWCwbqCoLE1TWy/PtpxLPbDURhvqRZQhTQcDrYsEGBHhynN5i3LkRYcbjg8qmSl0Y3RhCYhDjprmUxuNwhf5xsvzUXLTY1LuCZQTBOaJrUEiKmPTupBN39OP/OnZoNh0Nx1Me2FYNiwa/s5V+9u1iADxMB01hZlSDn1udfyh60Q4KWYMThhCHaklbalW56E8r8sTD9HSKpiNxuq1BvPUuNiat9cCK39IO25pNNw2X4iS0mbzzm6CC5q9CqDvPYhLVV6PwSGh5Quh8mzh5H2RLCXCePzhqLBLSBMLdJEQX2YlKUisTr0VQRPsH5SKVfWfyeUujPEHy4K1iB2j59+UWrZoLyAHpSlb0FxVcl1ZjrEHiQAXKFxcKyeViWkDhPvS8UbS8krMxEn0Bk5I+JfefelrboIUqerdZS7+gdq4t9kMTsCcC7wVA9jqXXDGPcv6oUxmWk00sokTC3oneyssdIS/ZURNtcdwWHIhGWOtczBL1YlTEmZyBPsjJ8tunt/+n/Tjp5HTobOZMzKJ6FHizVbVtbnKrZi6RR5N6zFO3Rqz8MpLyKmokolS5ZfDUEDmrMyk3Y567EbVq0UnmuXrUgxVChyGs6V7Jssvo6I+m6osWWcZTkwRP5j04rfvlwdtGW3ZLZlzyxZKX8HqMTY51BGf7m2eerJ+S2KtLwi85HHyKLTzKysBmdHrIkZHFsv7XGkwWHgqwLIT03B134GJHG/ZAfR3W1WTx2yOrE+TT7vADJNOv51JT8WPXwg4ecNBMCVwQ0nspVY3K7SE7/PfBm4Upg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc3c6b1c-f260-4a32-e1a7-08da66ada2d2 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:01:57.4232 (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: PzmJ+4/uKTz/QDGe9oCl+7ePiVxiJu3t2JAUCfIJtfK8cG9+ryDq+NgCFBA9WP5Ilae/RbrqwwTVhjlEnobBEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR03MB6251 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150204_520798_888394E7 X-CRM114-Status: GOOD ( 10.28 ) 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 v3: - New .../arm64/boot/dts/freescale/fsl-ls1088a.dtsi | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi index f476b7d8b056..987892bc69d7 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi @@ -238,6 +238,102 @@ reset: syscon@1e60000 { reg = <0x0 0x1e60000 0x0 0x10000>; }; + serdes1: phy@1ea0000 { + #clock-cells = <1>; + #phy-cells = <1>; + compatible = "fsl,ls1088a-serdes", "fsl,lynx-10g"; + reg = <0x0 0x1ea0000 0x0 0x2000>; + status = "disabled"; + + pccr-8 { + fsl,pccr = <0x8>; + + /* SG3 */ + sgmii-0 { + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,first-lane = <3>; + fsl,proto = "sgmii"; + }; + + /* SG7 */ + sgmii-1 { + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,first-lane = <2>; + fsl,proto = "sgmii"; + }; + + /* SG1 */ + sgmii-2 { + fsl,index = <2>; + fsl,cfg = <0x1>; + fsl,first-lane = <1>; + fsl,proto = "sgmii25"; + }; + + /* SG2 */ + sgmii-3 { + fsl,index = <3>; + fsl,cfg = <0x1>; + fsl,first-lane = <0>; + fsl,proto = "sgmii25"; + }; + }; + + pccr-9 { + fsl,pccr = <0x9>; + + /* QSGa */ + qsgmii-0 { + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,first-lane = <3>; + fsl,proto = "qsgmii"; + }; + + /* QSGb */ + qsgmii-1 { + fsl,index = <1>; + fsl,proto = "qsgmii"; + + cfg-1 { + fsl,cfg = <0x1>; + fsl,first-lane = <2>; + }; + + cfg-2 { + fsl,cfg = <0x2>; + fsl,first-lane = <0>; + }; + }; + }; + + pccr-b { + fsl,pccr = <0xb>; + + /* XFI1 */ + xfi-0 { + fsl,index = <0>; + fsl,cfg = <0x1>; + /* + * Table 23-1 and section 23.5.16.4 + * disagree; this reflects the table + */ + fsl,first-lane = <1>; + fsl,proto = "xfi"; + }; + + /* XFI2 */ + xfi-1 { + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,first-lane = <0>; + fsl,proto = "xfi"; + }; + }; + }; + isc: syscon@1f70000 { compatible = "fsl,ls1088a-isc", "syscon"; reg = <0x0 0x1f70000 0x0 0x10000>; From patchwork Fri Jul 15 21:59: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: 12919892 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 D1DC2C433EF for ; Fri, 15 Jul 2022 23:00: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=JgMD7GVuEvsRnhDXskjU1wLlFUgIBjQWKWRZQ+vGTJ8=; b=uuXNUrbytiGDZo 5mkKUyTZhVGD5aTrO1ORATj9slhv2zIHSgSHpFvGqayryhePrQj5jDh8Wjqv0nx4lyJPXzQsVpO14 U2U/A4k6C7nvZUSFemDgN752LT1rCDW4M8K4NJFofWNyP+zC6QKHBRahpot5jbeDEUdDoDJgW121g 9REdsASUpseTQfXgyoTGhktTBXDZGTN2nrH6X7neEVtV1CH7e12Ldlq2JPmRF9zULbapWrj+XU6FI MWg+yE3koLB3u/GfwYQrCcKS8sOjyTyP16FQTrBKflCvSEjiBnGNiU6JWjYM0R620A9ku0UEH/8Tu Cl6zUUdt7l6NXdbgsK5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCUGa-00Avt4-Bi; Fri, 15 Jul 2022 22:58:37 +0000 Received: from mail-eopbgr10052.outbound.protection.outlook.com ([40.107.1.52] helo=EUR02-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNu-00Abpd-DK; Fri, 15 Jul 2022 22:02:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FUvWCRxkQmUyZNP/uQDUbyPfGTnHGZvZyO0xiA/eVxl9BOXW2E5ih608La1QHgpWkPQDFGDf3Ku330+L9WZ3Az81Nx4KMlcmH7qw/S5z9iOJFqbckywNho3efWzUsGybPRbx4odjJm3/dmyi6Q+/sadALS3LhAVlQ8Ay5IF1km7OPPjSSxM6bslz0yjfENFuQH11jR41+nX9dk+ZX/DrnbCAuLOr6hWXo+Qi24rGXEBZl/5zCWhPF9XoXbNx+1MGQ+yx38MxYFmMAu2nAhyRozetwvrLvp+jk9dq5sZDOgLxj8HJiUVp2WommnEyqakJDMWbMA4KXbdF9vi1gn41Gw== 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=IaWn9lToG11vKDocpndmpQBoJM6QP80GAk3BfadQNLo=; b=a1/7EqNRqCde1RmgPASZugYOod8tdbVa0nkXrylZuRvQlMBqmvJtMKM5lkCnylZ3lvi720tchKINiKX+e6JrYktJFsSZUY+FMvvgHS7IP5EpXwC5njmgpjEOMq0taSIyj9ZnjuQqaw+St6L0pKLdEesZM4cQvjfh/DwsSY2Qz8eTTM6F6Pd7dWreHBIOXVX4hhRZ4PFm1VtAb1LAFcmcl4CYkFI3yPEOP8OHZsdym3TfDkHu99OueJuxVulZoltVzgxXJk6Rb3KNewls3Ox+BqKMLwo10A5C2WABPg2z9CUUOsC8gWg0LkzIXiIP/2264w1Wm20DFdYxe7bQYnj+5A== 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=IaWn9lToG11vKDocpndmpQBoJM6QP80GAk3BfadQNLo=; b=zsuY09TXFY9WWuVeZuIiFsq3a9NRTh7y17nBo0Q8FQGA/Weph/UOGbrthcVs9XxpyFEj94vSio8WlyFQZEz2gQcjO0DYEYMC326hn4pcRkT2shLkzDtGMveton1jeMZ2H0n+0cUTpPFQydmQbecbVW/C/qzelyysC9PZMmEVoya3JOBefLxXN0rqclXyZJ+Y25zFD8QCCYWNY4Pzaf35oqHJ5KxUldd9xH4BNW3o04XpZ7ynSzIBXZCG1kOgXIBH/QA0HWJqiUH252uBz1HOyIbayYM7BUggvyNggFcOeg1pOUshtErv85TDpMKaIU0dYw99Zb3D7pIH8KjBwKHmEA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB8PR03MB6251.eurprd03.prod.outlook.com (2603:10a6:10:137::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Fri, 15 Jul 2022 22:02:00 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:02:00 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , 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 v3 46/47] arm64: dts: ls1046ardb: Add serdes bindings Date: Fri, 15 Jul 2022 17:59:53 -0400 Message-Id: <20220715215954.1449214-47-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f0a7233-c57b-448a-5040-08da66ada4ad X-MS-TrafficTypeDiagnostic: DB8PR03MB6251:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0it0lu46mBQiJ+kilkG2oaaAaoCfa6PWeREIISRX8VGn/KcFJCemMQC5TO/jiNo+Ji9v2sA5W9xs/GkZ43lJCHrY/THR8bHZR6Is4TLCYpRGrVxwDjrjE145moV7aus/dtuzvF1Fv2ZXBNwI04d6GpRtVeB9Ai4SFzdinwoIjZvSGFlVkAnS76BkvVHMx0D1hnYKHzlbitU4HdhUI3TdvVfnCik8vXHXS0euo43ZegJ99ly21Pqtr3h2xgh+RRj6cRZMQJcUvvinhKVtzRzQgApeP2F56hrK1eVcvFYPCdpqs3ZW4LeurRp4RI+wgqbuTalvIId5sK9n2cGhDj1oCD1PSRJ82sYnx9VsRH8A2p3mqXTdp83v5P9cT5BHeDPzzMxAikTUwQN8ig3qoPktCCLUiMGgue3usL7lL4cyvT1mPQUB5c35ZOZ2WynnAa/z671xbATPs78JoSQthRe2bev5lbTEG5ikp+tKxlNnjKEQTZ70DypHAru+2i0qlsgjDSB4rz2bPzzobLDE7F4DCGCu3a5Ai96ADfjW4JnxQ1B/xIRpJe447u0UYwRhZ0+Ql/Cnss+lzRM3VV2GZbGCdOQWtPppawzUaj3lqHn5l2WBoFRgCE12JGsZj8BPIWwqRszvReOLNgSFlzIOSbZIziP8HBukm1svTUc9CpWeFEoNtt8fwoG1yPmTYcnPpXDMapyyfU0OJ9TSxiO9xDaLU8BRblPNzQxWE5OkVF6j4pKYGtLkT8Z2x25heZxtoRcaEZ2PK+3s6VBIltG1kRgYXUlQXoT3EITv/UP2myPVrifnoE3lX0Bx/a+urZ3QBcVQ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(366004)(346002)(396003)(376002)(136003)(38100700002)(4326008)(38350700002)(2616005)(54906003)(66946007)(66556008)(83380400001)(5660300002)(7416002)(1076003)(8936002)(44832011)(8676002)(66476007)(186003)(2906002)(478600001)(6666004)(41300700001)(36756003)(6512007)(316002)(6506007)(52116002)(110136005)(6486002)(86362001)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cmZOeLufuia9+gFlaFTjNEX0v77Ni5Jd5tMDyctrv1qhX3UBKR49MuZTrm+NpZTDSZp6VGjt6csCpG6Q8o7FAiCKbbeOjva7GwxF46sx0AM7BJAx+HIQfxqdzCijAM3J589YQUGAT1tS+vB0BseM8c5w6uWR2g1xeJC8bXWp7INK9WBPV2JdlUQnmloYk+qVfXQn2puQJW3P+l3cPrG4I8QSYtYlgiqhMm1r8gWJr4nHDGwZqnmHmjfTBIRTzYL93O8Za3I+Rb3WIyyICQGTQKgrzMRq2ywWopfJwU3MShHuBeGhVRcEfayMDEOZRIg2wc/ETzSsgB2cxUOfI+CId/FH0n3cqbWCoaDv5r1kjW0laNgLPzV9+KAqH5qgZhl+TFzYagA7WGeLA/V8Gt4zXiXynK1dzN+vkkrOW3kZrBZRuk+aSPXWlWnRtpOPJCpUPwLofv62d3KffYtcxHi1t1NZGTw8nPd2IIPo2Jl6oVx/tv5dOSxlpLHiZswdmby7didj6Ijx140PdZz/SqpqiwRdSeq81KD6WSubGirGKL5hSpZKqNDz3sLc87XG+LBmx8sj5RKcQiJb1LlpxW5Wa+UPrKJuyVoqzv0og7pfCuN5PFo1OVH1MbukeVcFJM53F++pdDZIzh6a/WBWiyQTzmK40jGR3ZyNcyngKid8KgVEHlWLqRfYhHGoNaFnEf0EGZTSC15xuXfWJjqYWRxaJTHGpOQBHY+q6sBzkZgC7D7WD6PTFYQAeM6mIf2lI91taihDmqsi0IM5xijtVa/5wWrG/u8qEvy+W3NIQYTVNOnMmsdGUeeWZo3Fn2ndT+yzSNyhJMqQ4O72HEvlTdxiq+mLKDu25xLZqHcIJRkkN12jCgSKk8KQ7hZaZ60Mjg0tcm4szytKLqocIp6fU0r9cNjoLiQrj6mu8FToRyxjC+31LmKdARWHo9fUCn8QO98BJLe+xMHfwxJXB38Ea95M4ilAinsZ8KNjgWB+RnoPtTI2d6rpe3qxfydoQ9IdQI4N901iRzzrVgeAdWAFghSnpS4CWbEAvbvWFIy9NhlhxZqO/6ArYWFbTOQ4X/bSKLNbwZSOG70TlQfqwMn5ugv8yyoMJdicDsQ8jYl7IoPMwAeysLAy1EbHjE0/cH8LweBQXxfAKY9KiC9lqiwrVpFknrjFkPWgMauMBVGeJUiYgCAJMieO4nlvZgXVcKsrh9w6OdTaEafBKshT5YvGt9U89spko4EOy1QiNQf/5YsgMhj5i1tUdW/DBT7Mb7ZbDnfugI8VcOQurDo8l0U4FNrqWiVsknEDYJSDR+zsdSnUcrjvFvVtRkqFcsb4Pzoyuc06pNrkNFdVllLOuQTikGtri+jln+VHBpMgTOF9Y7N2MYxW2jNwSZ6dWuK6LPzsFYg8XyxAW4el9FsECxNobYg+IC4pudAQfOMkvHmcOIRr0R2bEnGngDiSWpUQEKR0ei0X6BNtvrT5jqboj2U6sq8Z3OcGbik/8ijXwTAvfe1vcDFo/Moo09RA+NSSluvkaIjdT8MvcHVy8/waTB8hDoklURIahtKOUcQ6+tByx4o6v5lTNeQDQLl6DXP+xwzEfUAXLDfBKKC0R28LTosVqj1ymA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f0a7233-c57b-448a-5040-08da66ada4ad X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:02:00.5637 (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: PkMtSP10LVhPLxJtdelb1HQ86dB7zf7P3c4AjeHA0MlMHybELEC2YtpubcLTBgI03pwK8tr6PZGAkiXclrReZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR03MB6251 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150206_506776_5FEDE821 X-CRM114-Status: GOOD ( 15.00 ) 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 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 fe2a3efe0ba4..9595666213d0 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 From patchwork Fri Jul 15 21:59: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: 12919893 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 0FA8EC433EF for ; Fri, 15 Jul 2022 23:01:40 +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=aCt2GmVioBX96OhEmU3yjHUJD2vzmoE8UkX5QIbsVYg=; b=aO/sqrWlsjI9cJ xju+QZ0WOh84RXwhTzgmYEhIFiLFNCHGVEDiBLYRVzk3E61EgtSAZUcWofZvaN5cNkSpV77iKRnwd YGuP5wPba2ruwO9jBaA94783/Cv3//4cMdl4hPq5WuPDa6bS8yYrt5yStvJt8KODASjlr0XLnGsVg gi5y3p4Iekd4sSZxO//uZ6AxFnM+dSp0tUNn8h7bxnt01cNS9I61yZZImRkJoiNW9tuKPpdMESvoY CgUvElv/1gt7Eq9ikxvIDGlhX3ggS/KnsVmV+smYgLE9Fo49Rn/xe6f7FDQOBJLCQmcvR7zuZdO5O mO/d3NQ+eT+Xr3vgkAXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCUHp-00AwDS-4I; Fri, 15 Jul 2022 22:59:54 +0000 Received: from mail-eopbgr10052.outbound.protection.outlook.com ([40.107.1.52] helo=EUR02-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCTNw-00Abpd-CU; Fri, 15 Jul 2022 22:02:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SIi7gqC7F3KM0dRR8LsqKJUuzP8mhXv00czkvVHawCBpgDNbsj4k3sqE7fv1WzGYvaDKYIeSuPysovA0KdBFRCSg0PpxQfroOL4CYqRhwr7GemxoqULZfeBlNM4EkxWLYcddiA7xIv/4iuH9/hiIEI3J0BXfpaQXcACy7/0TYlHMYJx+p9vcOxny45fzH2SIS0uFgek/pbIGTH2u+eH5XrBmjKJhivKWD0F6mxi34NrqwvmMvtSMkekkhRS1k38mujbkchJm7g+1S9KGxI9xMBHNKF1vrdr+bj9gtbrmTLuNK2QaOLQV0wwOKeZ6eTrv3D0Tl/H40329VG3nRomiyA== 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=ggxjBqUodEZrSQgczGpk+1ARLDmIKnK96MUj+WVBXf4=; b=hHRPGFB1HSUlLxU9jwCewYk9EW6gT411GMc9bKHWVasi+19Dqg/k2Ux54WKklY3MKKAhSoP3SzF4LEmwDldR+6HxmXPh8xviTpzKFw1JoliPKDaYnCfbcQobxCoualyrZgdAK198ghoAZOmXjihqFoOoZ/yaMRg9Nvkp7Nt6SFKVIXhGgLELdUu+74eVLgQhPuHmtxWeVNtQJsEj45cUuoDQAkrz494gsk3jEE9qa0QrLTp7+JYp2ScAxdMKQJPYY7FPA2tXYu4e53wMfOgjvtYsRCStlR1tABfi+ZlkWeKHvv6XWnoSeV1q1RhrPI2dg4NK7u1fTTwYOqKIUCwdiw== 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=ggxjBqUodEZrSQgczGpk+1ARLDmIKnK96MUj+WVBXf4=; b=kXKJ7U1g2MFxGb3EPLbvBqTevpbaKbngjvDxRuQ5Qr7D8Y5SCrlW5jpD1bnfJHp7RWCKoHvfi2709JsnZDiToPq+2duwtAVafCV5P6h3NUaQiEV8WBY+mdZsDjNS+0qWpDe7Y/PVpsT/eEGZxerclRjiGjikwK5kwPngo56DCpItdJEBCzck178XFC5Pmdy56kcnRZfWD2bwMNkWmDlUxv1kCcvhKu/AlB7uiCW8GpiDf6C+XlEWAwH4wHF4ZmyECzOMgkSzxqQIa7Qb2+e4oF6UKkr0mzXUEO+vPAOxz2rt4V64ozM2sdVax0pnLX0kYI+k33R1H9qmAfe5j/gBEw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by DB8PR03MB6251.eurprd03.prod.outlook.com (2603:10a6:10:137::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Fri, 15 Jul 2022 22:02:03 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::5c3e:4e46:703b:8558%7]) with mapi id 15.20.5438.015; Fri, 15 Jul 2022 22:02:03 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , linux-arm-kernel@lists.infradead.org, Russell King , linux-kernel@vger.kernel.org, Sean Anderson , Ioana Ciornei , 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 v3 47/47] [WIP] arm64: dts: ls1088ardb: Add serdes bindings Date: Fri, 15 Jul 2022 17:59:54 -0400 Message-Id: <20220715215954.1449214-48-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220715215954.1449214-1-sean.anderson@seco.com> References: <20220715215954.1449214-1-sean.anderson@seco.com> X-ClientProxiedBy: CH2PR10CA0009.namprd10.prod.outlook.com (2603:10b6:610:4c::19) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e351ccaa-60d5-4e74-33cd-08da66ada69d X-MS-TrafficTypeDiagnostic: DB8PR03MB6251:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8+wQUpFfK8IQMiiJacDmmwyqWGt3FWI3bIuWGtAGAwrx9is23PJraQhCa71rQdagqQZKeXrCqtC93d1emlfeUgTRkThFwlaKJw7PydR8uLCnpB62jn0rr+0QfRiTvJvMgavffL1w4MI2mppdTLVTciIl572X9vIcNH1T3JrHDpkc3VHcu8Oiz8WkKeH23o3ggm8oM8BbxLQ/EoLza+9V2ai66AKNlhCDsylcun0SSeK2nLcHYAfy6kc3zzQrgKUG9JI1po2ciVw3q4FNBGiX9FaF64HoDz0+SnoHn8KeUAfjwuUSAij+r/L3av7jL2maHA7d12lQKuivXDe2X0MumdwGufzIbFE8ZZrpBxuQqzi0553soxfmjlCfexy5w62mfQQa2QC1aUkIqtdp5sGcts24KwR9X+3vZaBHyQLrlDaAWy9iuV5LLDADDaSdPPmZc2V5aOc8PLyk84EMARqi8X2ByKfIw2f2I6VMu9bY5eOGDToUZemWoC6d3vSNs5ANxxZGd1srIeP67jp9WWic8oyvCAGtNPCR0BS5nsxCFS7ekqPvqY+Pc7IdTcAgm3kZQFE1jfb6a/mwXcI6GpVLmeWeYpxDDukQRF9TOA20nUgrFiATyrDY2fzF8BzLWPkXmQ/sD/8bc6aPOMCon7/MkKzSVl7ZSStKo7bxQm0nc74Z0ROOXTWU6oWCSVi+TMOt3wbkZPpBjjofdaMJAGtmvOR1L1OVoXidl92t01pSVjwT0ws09/Hnl8HIam+U041JKTHjJuhRcc4zbQcSZgILTWW99sGarNc5eB9ujOOqCstBl1b6Rwm7157T7JNBf97P X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(366004)(346002)(396003)(376002)(136003)(38100700002)(4326008)(38350700002)(2616005)(54906003)(66946007)(66556008)(83380400001)(5660300002)(7416002)(1076003)(8936002)(44832011)(8676002)(66476007)(186003)(2906002)(478600001)(6666004)(41300700001)(36756003)(6512007)(316002)(6506007)(52116002)(110136005)(6486002)(86362001)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: f01Ruxp/x1j/tS+GCCIBOCE4CADy5a5jnx7ImntooAguqWODLmZWMTuIxEYVxaRM9ndnxBVOKjJEewozd+bXQGiQA2W4+XOIkdH5GvOrMXjwRSbL5D8wri0T2G+eeRzJ/PYPOz36VAq7SctP7K+Q0EocKo2+zQMflUb7zcTY6VNEYdTS/46fWrKuer9L5SkWYOU1mHrDHrYilQv/9jbpxIole0Tlb0/KSqFE44046TmzuvUfH9fH0fPY0tfT28wKKAxxdwNB+qZW7JoC2R5K8fPrlCMTPHqrDI9Cv/AqOU/Mf3jB233xQsJYewiyhg85SLzX3Ws2k2OD1Kz5ucKcu8JgUPnmyo+E9wMSvKNO5oVWDMBrzbuNM3VI+aH2euUgVjWbhIYWwElai4jrf/N07NsdhykpJU+mDhrxqfgSluJ8rQmpkxRVm9xkvBl5Rr1h3Re/C61sxATZgP5QXKBwo3fvzJJm9rQUTlXvXlqf3A0gDl5lqEIyFurMUqWMIlkuxoCVi+AePHu0x3k8bHmBusO1IxKRc19fV7Ldi6DtWCiD2jY/fBX4V7pVdE0pYQWyuxDhBUeDVuRXOoQjffN27bfAiZ425F10oqLWH7jSV1z2UFrN0IfHwvB9RWQy68eO5wBn4gWYWIa8cfhg7Tn/MjsEjJiQmDLP0yO1lZKLGrxfAavPvTze9MgIy5E+zboKEwWhLaQpC3Imc20CHNwkE610qcFxPSn0kqY9huN9A8Gj2KCdM8vEabhhRzixkJOoPgth4OQvLma0fFAUX3Vu03qYpx3UrRqQDVujzKTUkYwfN/oSwGLcuJcIHhoap8UOz3SERCN/CpK9whDBB6ECx634e7MFuiKrzTEpj6N6tmcemod2MIzjNdQQzSLwChhulzY877k/PxxebvuMyXbzuIEStxeqETWyIsR/FHCu6q2y/FvXZwmvGClRXw8Bnp8uqi4m12P65zcAODpTEqN68tN7bKqAesheSf+Mbm6dM5HszB6KS6enB1AMsFAve2uBvYF7n5sdPl5sL9AJsUVc6d1qoM5ZRqUQJHJyOQmSJ+rGeCDElbzgigp+iMDYNH6ACDrU/o9m5Qc8iBspazhq48+io2mod/WJzMCVgFR0zCCMAtZIsnyzc5YYfT1JzBADKwrh0FelL+3VfLgvou9Rq6nVFyaMi584o0HL7GXFQ/5rUbGTUHVA1K1aW6FofMZ89i/a7mhUwK0k4nT/drRaYWVZThakbOkGf+Ea9xbeUKjRNPsHOJBQOZ1KJKQNYf03VGoxpis25sdND9MbsE+g3xIASx/SNf5Wx5yf9cQFtw/tz9C1uekOdsbx12f58udmauOvzMo/GOv+wb/qX7lFCVZH2bcnOWgmizjUQMwDjdJlHXnegbxQO6CBwr2sUFLoXviXZtAK96HqAGPwshziVVd9ri8HJt9v13aOFcqJifEXOVXzO1zQwbQWohYeUH2zMcoeSPnM1mGzulmem3AZWAU9rah0k+s5rd0RD/kJxBzyccne1TKJ1JI5pTEpiFVc4UGxf9TFneyb6EEPjbSEIx8rmi/HWC3Sy5S8VYiRaxbG+XEIWatQjiADCFWnKfi+70XWbA5lXtIGTp+kJzYVQQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: e351ccaa-60d5-4e74-33cd-08da66ada69d X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2022 22:02:03.8135 (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: +cBPn4b4d37LTn3cq1D2iU79wFFBkGmaEf9Qz4rbdPCAcxk6jkUa7iqRYKc/hp49ksubcXmvzqdiBhLaOgdMEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR03MB6251 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220715_150208_458666_A4E60B47 X-CRM114-Status: UNSURE ( 9.87 ) 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 is a first stab at adding serdes support on the LS1088A. Linux hangs around when the serdes is initialized if the si5341 is enabled, so it's commented out. I also discovered that I have too old MC firmware to reconfigure the phy interface mode. Consider all the LS1088A parts of this series to be untested, but hopefully they can be a good starting point. Signed-off-by: Sean Anderson --- (no changes since v1) .../boot/dts/freescale/fsl-ls1088a-rdb.dts | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts index 1bfbce69cc8b..5875709f7f8b 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts @@ -15,12 +15,59 @@ / { model = "LS1088A RDB Board"; compatible = "fsl,ls1088a-rdb", "fsl,ls1088a"; + + clocks { + si5341_xtal: clock-48mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <48000000>; + }; + + 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>; + }; + }; + + ovdd: regulator-1v8 { + compatible = "regulator-fixed"; + regulator-name = "ovdd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + dvdd: regulator-3v3 { + compatible = "regulator-fixed"; + regulator-name = "dvdd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + +}; + +&serdes1 { + //clocks = <&si5341 0 8>, <&si5341 0 9>; + clocks = <&clk_100mhz>, <&clk_156mhz>; + clock-names = "ref0", "ref1"; + status = "okay"; +}; + +&dpmac1 { + phys = <&serdes1 1>; }; &dpmac2 { phy-handle = <&mdio2_aquantia_phy>; phy-connection-type = "10gbase-r"; pcs-handle = <&pcs2>; + phys = <&serdes1 0>; }; &dpmac3 { @@ -28,6 +75,7 @@ &dpmac3 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_0>; + phys = <&serdes1 3>; }; &dpmac4 { @@ -35,6 +83,7 @@ &dpmac4 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_1>; + phys = <&serdes1 3>; }; &dpmac5 { @@ -42,6 +91,7 @@ &dpmac5 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_2>; + phys = <&serdes1 3>; }; &dpmac6 { @@ -49,6 +99,7 @@ &dpmac6 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_3>; + phys = <&serdes1 3>; }; &dpmac7 { @@ -56,6 +107,7 @@ &dpmac7 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_0>; + phys = <&serdes1 2>; }; &dpmac8 { @@ -63,6 +115,7 @@ &dpmac8 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_1>; + phys = <&serdes1 2>; }; &dpmac9 { @@ -70,6 +123,7 @@ &dpmac9 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_2>; + phys = <&serdes1 2>; }; &dpmac10 { @@ -77,6 +131,7 @@ &dpmac10 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_3>; + phys = <&serdes1 2>; }; &emdio1 { @@ -142,6 +197,38 @@ i2c-switch@77 { #address-cells = <1>; #size-cells = <0>; + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x1>; + + si5341: clock-generator@74 { + #address-cells = <1>; + #clock-cells = <2>; + #size-cells = <0>; + compatible = "silabs,si5341"; + reg = <0x74>; + clocks = <&si5341_xtal>; + clock-names = "xtal"; + vdd-supply = <&ovdd>; + vdda-supply = <&dvdd>; + vddo8-supply = <&ovdd>; + vddo9-supply = <&ovdd>; + silabs,iovdd-33; + status = "disabled"; + + out@8 { + reg = <8>; + silabs,format = <1>; + }; + + out@9 { + reg = <9>; + silabs,format = <1>; + }; + }; + }; + i2c@2 { #address-cells = <1>; #size-cells = <0>;