From patchwork Fri Jun 17 20:32: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: 12885989 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 2D1FBC43334 for ; Fri, 17 Jun 2022 20:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Mzt7QTr4sXncPfwp3WDQmJRYHOz/TN7DL9CEbwLzKy4=; b=dendCmoR9E3iy9 uIMKizB1NPJwXlQNrGYeNcQxJ3I0aOnQGlH64sTtBbRcDSRUvUUMHgnBabPbS8k1Ay5VXYXbQcRD8 R7HjEPif4clwiD/4gqEER2dg2P3o9UDY+EmICcnqnGuTZNo04On1HL0sfoBgJXFyoK3vmcmhOgWCC 50w1jsXmk09yt1ZfzK/rUWHWO8Ag9NhcT2AvIO3QAIYj9tr2QJhhwgll2mqvEviprCyw6dljz8v97 IGOclp3uTPQNGv/G66KJe3lFPw8m+LAvk6HFc+gZGpht+FXeauig4eKXXouzbN63yE3jxzmwh7xKV 90LHKNZnoOFx5llreV/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfF-008xLT-KV; Fri, 17 Jun 2022 20:33:57 +0000 Received: from mail-am6eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7e1b::610] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2If4-008xGJ-95; Fri, 17 Jun 2022 20:33:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aE6EUyUoIiz4ef7e47Wk6uKMQEDxLp+PwnyG8y7925grTx3MkAskygB9YloLxcIwk/6/OJ50KbPpT/aU6M1wQjXsIck6H3KGeAt/JtSDabUXx6MFCd3Vm+TEFARE2Z5Luin2EDl9ptu2YSvr0SPVgtchK/WgSI/y4XvC46eCBrQt3iAhF/SYAScS+AKKdy/X3sZyJOURYfq/AXP5/pEI+oPTlGultIV1bGXrdMjXxTK12VrNj+/QRwQiAdAxnXNtfE5wWnYbVgJm8E9j2YKrI0TsqqOAyFD0ggayIJmjlxD+9S1TPwYPl2eh10jmSzwanXAPoYa1WQHGSOZleJFyVg== 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=I9glw3505ujB7LUV7Xvsdgo9XaznzsVSm8YHPcXI1rA=; b=GJv/CMXYatwSob/4hGH+q5wZgKsRMt+Q4e4Nkt2WFHzzREkFOnUsv2rKbDYz3ZxbuzmOlqj1tF88WRhSD9nQf/x3+UHv3XV+MMlRDpPWnauajbTOcZJR9dkY77XOasrMFg1a3mLWY8ZkxFhl/WqCRPuXMXtRFng8XebqWn/osK1EkfMddRl418WkD6iLv6EkW/uAXBS/TECr81YPvuhFBoeE4q+BwHX36rz9CPgeAbKgk/JJZRsU4qlYMKTtk9cWc/MMIlTgvn5SW+VYk3gf/aA0++IhTCHjkkZ+LAjnfyRoJANacbG4x84gDGGRkA581dP6Wa6YDoMPKEFGfYSFfA== 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=I9glw3505ujB7LUV7Xvsdgo9XaznzsVSm8YHPcXI1rA=; b=ohAfKwWTYxKU0rxVrkV5eAA3g09sw+LFpY4MSwW7/8RaLDsVbnLwjkT/nt+fjE8ZNvcXZ99H1UXPk5xgNwcPm7FFtHtLCpf7XyxRdZ4g2KYreOBsXA739Ku6bflsc4BOMbx+gVCC0+teazhdTKql9eA1MfcKnN0PTl2f2waJzDFDohyozCpIAumJxmUjehvQbw8HAO89MTxxglHPEW2TGIJOQjRvCPwXKBboqgVb9z3jdkb7739xaQNNr6LPixYDX4CdDfUJl+z4vxzN0jtCGXm/NTayuZCMRFZN4tFNTYKS6yd8nzGfldSzOsM/cJ4l1aCOPsE3tr8CZ+j7KGBEog== 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 DBAPR03MB6438.eurprd03.prod.outlook.com (2603:10a6:10:19f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:33:36 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:33:36 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson , Kishon Vijay Abraham I , Krzysztof Kozlowski , Rob Herring , Vinod Koul , devicetree@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH net-next 01/28] dt-bindings: phy: Add QorIQ SerDes binding Date: Fri, 17 Jun 2022 16:32:45 -0400 Message-Id: <20220617203312.3799646-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4d3710a1-781e-4353-a8c8-08da50a0a761 X-MS-TrafficTypeDiagnostic: DBAPR03MB6438:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vIbNy8/kBJTo9a7giHXX0tvji/1Ysgr3qmHIBtohuAwASzKtXzf+0NZGagaJjC+YGn706FcEAN7rAo3nFtI49OZhzI+hsymNcAXpyPyadJ5AoC3ACTI1rGAy7ugsb+1Sw6Yj5GFOY9QV5YZNT1pwC/eF+2d9C/cVM713ZeH6IeHO99smWiIZ5mm1OXxsfMW/rHbF8h4oHCwsHof5JBV2bcw4yhElMmV64of9JZg9Gs3x7zRQ8BLSXL1gitN25YhDtHXsXgPlYcLdwXNMoc5mMeazXeyGW35YTxbOnRQgQ6sVziSexRy3hKtjntHM/A8AtgXe2hzu/WRrOn/DvPhu6nubxRtyrGG06yVXWyHPubZHhL+djbLiGTggBiZMFm/yDg95ayuMVDNBSn0aQ1PtcT7V5kB0GT8xahUDFyNsve8T5cZyPxYkboAAXn4sTP3wrR6qTRhAbOUreaer9Kmhug3uppHiLkLz9FCIlCoO4MJPXN0nxvA2A4MfACiW5aVjujjZGCRP3y//QcDauiZm2ZmQcdHQVYgri3ZSWH33bZeXjbsI2LgjsfoYFHvZhtpt6j76P7ZASqxLPgj7K8yTKSrqpu52HJeavEHJ2dHv4a8HasLyHv7xQ327DqYTWDKZeh8mP7uFDXMXpN1QcydISGWHbxJDQGJAMtWARLaXi0eWaGZUPaZToOC8RXk/4oI9ejkaUH79GmJfJhE0+sl9UXrk5YaBeC4Qh93nFCiTRsFyOyvhMhfQTAS9ZkZ71+anM8u+8bDBPzYtn9YpGmOnGVRPwM0FFCRYKw1gK58o4os= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(38350700002)(86362001)(7416002)(38100700002)(186003)(2616005)(5660300002)(6512007)(966005)(6486002)(52116002)(2906002)(6506007)(110136005)(8936002)(54906003)(498600001)(316002)(1076003)(66946007)(6666004)(36756003)(8676002)(26005)(83380400001)(4326008)(66556008)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: J57FmXDSS69Z5aLJd+TlMO6Rur22TeZdB2qXYnyIpt8kQLuu6PZMxXx6YJ4OKg2SvGHrt5NkTudWS2mYTACt8YOlUdVD5MdfbRoZmFDKHykxwHIpX5Fs+XvegKWywvo5lDrC6Z83ykpPQWU5b60yynmpBwCNw4jHBdzOC5sVH+JCxx/smSNdSvtwc5SD/kDfBfPQhO5iIwp8l3O1AfPgSxBBm8YeUg21vGWbzE2Tw4dAIsSB1pYsWqiVSpZ0mENVX7mNJ+065q147z67oUe2EgU9mZaPrealy62kf2J1L73ypOLClfLu9LbHisiX0eCkHcN2UPvH6Rdgy7cQBhREda2ceKYmBJBiIXJH3ikrMWcw9+esq4I5kEBfquaGn6vb3lKE3CuXfPdb0+bZ0UkPL6wu6wtemIw3uqmKl3Ztd21bkVy62gm53HQ/InrJQsv3pZb0tpJl61yrqWYd2Ra37+u52dVlD06ACoKBlEDBRhWUyd//Lte5dNRggE3QFlta4UP4z4N1dXtSu5mrL/3Svot2Wzg4YN2h4u454QGyi4bLojh6rVoE0GVhPCDs5syMZ9WeD3ZQ++8m4d+DWCH7NlWyki7n9CJ0LJEd56hAIrN+i2H5UjbNRKW32Os1dvDUxzBpmuiqHG+OWhvJdtl2nRYoMHHob5W1u9eLXia3XgXkuKV8LS2e9GBz5FVc6S0cAiFTqN5IfFCbdVVPUp0euKp2cbxre+QOvycPefY+M3JbCJ8feRd/eq3HtSY9yD/MEtsFac5aVnaRdjf4udKdH3QzW6k6ItL8Y1l4qz9ntrvzrHPcaJ10G66kYQA3avQkRex7+J09tDQYcrAXR6ok1RrvZ18cERR1N0Go1pYVpFhVZLUejZogl8NLUNtxPpOsaXC8xmUcfNVM15vbXzu6Z5Ap2qK/OQsoOlxhV7+XZyzDNSddS6c6PteUWtwqMavf+RUq0PQIGxPpMmho5GKPSmo5ehdkYbsEfiDdi0udu6NPGMbnhyFDygHnvpRJQjNKewR5Rf8eXMCbFyPTHlvpOFFKBw0OXSt7ecMw9ncu1aKrSzFsgYrYLakqm089OR50K8UOgRtEhN+/saBc2BHzAbMu1qQPJ8EAKJ5G1lZkvVzdNIAOHPrhLm/1YpgFZDpIgig7iiq9Uk3dj/ya6SiMm3J00lLVtQcDrx1mwp+jtDJHswkCKcmKzl2m0emPANR0Lmh5GMHYQhTFse5WdmdM0102bq2ZyZxZIaHZlw/1tdnAsdzudJqszcythuJaVsM71xxeGxrxeD2q5smJuhajAqj0U7OcaDmI4zm+xsaaRpMl4IZs31L/U6VcoG2N3sCD1c+dgu2PdHywFEVF4hkp4OwrAOsOqte/y48mRRsSKRRGnPVuqY8KiPw+xjLPKSo9MTZxe1Qq37Lb7C+Al8Qm5cEEGqWdBDsDLnZ/y/Om8GTcSfc3Dv7ptwZuLdvwMkEc30nXbzaFOwdmEzoVMXeDbfl/AVaKvDWNsDCPRqs9MBaEv7hW5QD4cDSZh+yTltCclZC4nK1dnFRRRzAvBATrt+Fj+v/xErF7WD/hunqgbGDJEtliMXgXIiWQTQ0q1G6ZHVGY4CONt6t+EbN0hbR28UQPRltIO/PzQPAQECkdxKpiryu6K2qSOHKoxyfwtAOLucsCLCuma26JJgWQdXOdQIcTWa+ygGHTrmTdmhEtlXxjWL1jkZNQNzeu6KVTDc6QJzYY79k82L+GN6y2PE8DLKgjwP5ZFblRESRtXFN8V2Y= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d3710a1-781e-4353-a8c8-08da50a0a761 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:33:36.1718 (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: N3zJE5wkTr16go0/puSO+QpRsOP+IUlq+uDpPAVqR07b0JV50TQ4ai+kSMzzwM5nMzqGF8Bu7RrEMICh/0PxDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6438 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133346_347228_B1965D88 X-CRM114-Status: GOOD ( 20.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This adds a binding for the SerDes module found on QorIQ processors. The phy reference has two cells, one for the first lane and one for the last. This should allow for good support of multi-lane protocols when (if) they are added. There is no protocol option, because the driver is designed to be able to completely reconfigure lanes at runtime. Generally, the phy consumer can select the appropriate protocol using set_mode. For the most part there is only one protocol controller (consumer) per lane/protocol combination. The exception to this is the B4860 processor, which has some lanes which can be connected to multiple MACs. For that processor, I anticipate the easiest way to resolve this will be to add an additional cell with a "protocol controller instance" property. Each serdes has a unique set of supported protocols (and lanes). The support matrix is stored in the driver and is selected based on the compatible string. It is anticipated that a new compatible string will need to be added for each serdes on each SoC that drivers support is added for. There 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 --- .../bindings/phy/fsl,qoriq-serdes.yaml | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/fsl,qoriq-serdes.yaml diff --git a/Documentation/devicetree/bindings/phy/fsl,qoriq-serdes.yaml b/Documentation/devicetree/bindings/phy/fsl,qoriq-serdes.yaml new file mode 100644 index 000000000000..4b9c1fcdab10 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/fsl,qoriq-serdes.yaml @@ -0,0 +1,78 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/fsl,qoriq-serdes.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP QorIQ SerDes Device Tree Bindings + +maintainers: + - Sean Anderson + +description: | + This binding describes the SerDes devices found in NXP's QorIQ line of + processors. The SerDes provides up to eight lanes. Each lane may be + configured individually, or may be combined with adjacent lanes for a + multi-lane protocol. The SerDes supports a variety of protocols, including up + to 10G Ethernet, PCIe, SATA, and others. The specific protocols supported for + each lane depend on the particular SoC. + +properties: + "#phy-cells": + const: 2 + description: | + The cells contain the following arguments. + + - description: | + 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. + minimum: 0 + maximum: 7 + - description: | + Last lane. For single-lane protocols, this should be the same as the + first lane. + minimum: 0 + maximum: 7 + + compatible: + enum: + - fsl,ls1046a-serdes-1 + - fsl,ls1046a-serdes-2 + + clocks: + minItems: 2 + maxItems: 2 + description: | + Clock for each PLL reference clock input. + + clock-names: + minItems: 2 + maxItems: 2 + items: + pattern: "^ref[0-1]$" + + reg: + maxItems: 1 + +required: + - "#phy-cells" + - compatible + - clocks + - clock-names + - reg + +additionalProperties: false + +examples: + - | + serdes1: phy@1ea0000 { + #phy-cells = <2>; + compatible = "fsl,ls1046a-serdes-1"; + reg = <0x0 0x1ea0000 0x0 0x2000>; + clocks = <&clk_100mhz>, <&clk_156mhz>; + clock-names = "ref0", "ref1"; + }; + +... From patchwork Fri Jun 17 20:32: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: 12885991 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 ADFBAC43334 for ; Fri, 17 Jun 2022 20:35:26 +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=0qI3A8WbPL5i/00o/3IgtQna0eZv86QDwIo72e0Pvok=; b=tPoox7fKZBG+j5 NRLpvB6OaZ/Ax6aCW5djF1s7W6zyR798/odUv4RunB2G5u3DCS4AZKOU/IlLOTu76HV40jD3sJXaD VaBB9SGtgjrrxAngYjYN2YxzZnU2ojknReAcIS6Q/pjnR5jPnL+3ZxYZepi/IiZOVBqINK2p//bqF lTzZY8oUrWBRsxL/ZXQd7A4k44OQ1pDjjf+EBxQzrPnaDRdpZ7IFDG7sqXlsSKmT4UY9ux4xDsz0Y c76gfk5SFQP45b8CQNije/6Zt0KWyirDuIGHw6oh+V0sZzc2m1FKCdc1WpQbLBZuv0mYZ3d9bGO8Q ZQ0kiu6vFuOgL+1KtrOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfT-008xRT-De; Fri, 17 Jun 2022 20:34:11 +0000 Received: from mail-am6eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7e1b::610] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2If6-008xGJ-Bx for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:33:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nvCX7sXoKjmsAsX1Q3urF8cZ6nmotqp2N1uHbUZuMIUR1LtWUpZ8tRbQOFhPz6plkRDbAxOo87+FOhG6oryKULC0evhInWpdL0f8WsH+T+MiqItdeIfM2Vsxq0ubdfIgSNy47a85sTb6kPW1BZWeG0bWoMsveiX53t3I6qKlqvf3/x2JCIDyJkN+q/N9BFf0Cgxr2/veU07vgx83KWsZ5bQLbtrECjn+obyF9Cbrnc13qTwyClPA9XB6+8YrjcMdKlZsfEzr7Y4w8mR3IOjgrn4QExmRqiAW0YFUPsfH2FeE+d+dfH0/QZwVH3A8+rDTn9aOFiMDmWdvuuJjl6vPkg== 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=Zyj/IJmSRlxLfh2wYMw1EwqZzLeNjYFdA+pV4NCu+/I=; b=JSZQNhNMKX+CXUsivSG238r+41YpEZNHr/o7RviY3aJY/iqyqvFlXNJH1ofCuVe0qGSASujO3am0fs0DoWguvlh2xZ2omCxyvLkH96S5fvpDn7JdxP+vGbhUs6l0scwiBQlx7hkGEQ1NDgOnwV9sJbTvVC3JLWnslHKpiQkXkHo70czsW7hs9x3pCEaQB+I07+TsGEFCZJhDB7dLDVIgF5QvRoTRFYRtwbEUJ/rkt8EkgWoxqrxh8YSiUORMX+XTbsrZrvkArBNTDRyxe52mxxEnQFjaokCsQgpUzSJ5U3RxIiN7B1hwvz6ohmemZGpEdTfgQ+ypGHtt52VcWYWbGA== 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=Zyj/IJmSRlxLfh2wYMw1EwqZzLeNjYFdA+pV4NCu+/I=; b=wkSSndBuQ72Dinsg7lkAw5pR2AffpZ6GpeJWATWf8fpxuhRlYbw0X4P4/N/h2Rzvlmx8aXRokwp6yd8Z8dox7lO2WvpFrLDVEQALYdNP2YYfj82AYulgXnig5kORqhxw7/uzZSbZwh06xaJzcbqbjF4lGMJyuyVl/yt2uWeaYlr/Z5dWqNDBkt8XTvI6YvZ6dFXpTQBdpf3NVccl8FsnD7bwiMpwNhkwxVo5urRuszb5oEkZlv3gEV4zqKLAqWiwcRJTLip8tlpusFSxAwBcIJTwvuQ7T8xPOHO0DX7lYMY0tuRUZBwxp4wLC4CGXh3lEsIwHKlJg0nwxaF+aYh9/A== 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 DBAPR03MB6438.eurprd03.prod.outlook.com (2603:10a6:10:19f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:33:38 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:33:38 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH net-next 02/28] dt-bindings: net: fman: Add additional interface properties Date: Fri, 17 Jun 2022 16:32:46 -0400 Message-Id: <20220617203312.3799646-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 460f1894-8877-4f75-597c-08da50a0a8bb X-MS-TrafficTypeDiagnostic: DBAPR03MB6438:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3QcPa+Wtgd5cFCo7mSMQGgEh0zaJl32pCAy83Vww4Xwvz6xc16pAw7ooCf0dLb6WnaYQEg+r0Z++zY6zbCrxQpYFm7eDSrr+6qCZVOtRRgdOrfdQW9fw7begVfqdu8V2/l6v9PexpcPK9p5CeXcyR6mMrqO1f6ZrVInx+ZSYM8Kr42tJIh3H2wJcq5pQte+a1zqbc57U5xDVKdCTfzVgGIwp/RTp+mjk8emApKmF6EsLiaKmuOjkjO9g16z+qaX8DkHXUb2n11amRvI0jzZ7YwzrWuMSRdzjdj/dNlyPXjUIeNRPzjVuUyiadsTlqSpdffzX5yih2m5TVysP6T2wI4gxyK6o9ihlSYs1vz6lQHSBr6r+4D47vYxDig+7ZK7jOrccQPKheZorbU/dMpsTv5PEY3EaqJfI5pxCKUka/QDW6pdpzJ59nw9tptqAbilbMaYUckTg5Zh7pgqF4nW0Au7BUqWfB52BzD91F0kg19sSuEuk6ItRQl9O02ykbqSPJ59Jz78qAV6Es25cBaqqeBE2nSd4se4mi+eXR/9IGE75j0jXONaSJfP/zontBitabwYXye+SiwImHZzzrmL48XRd6U3YACCXAa2OWgnOHDxPuqVX4Ytv/Ewp8M581ft/iUNQM54PZEsFBmq6ux+0wZZ5x9ePTn+cCQk5zpp0J9UmfPAXEtSVY5D5ODiYvFYmIWXGYx6/hLeP47D9xOnoXw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(38350700002)(86362001)(7416002)(38100700002)(186003)(2616005)(5660300002)(6512007)(6486002)(52116002)(2906002)(6506007)(110136005)(8936002)(54906003)(498600001)(316002)(1076003)(66946007)(6666004)(36756003)(8676002)(26005)(83380400001)(4326008)(66556008)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eA3YThmNpY6Xs2YWxLue1x4xsz/1PpcZbPzxmdX6PtJlPG33mqpbZG+pp0uJ+a6glojD4t6PGygQcnhDQar0YdUIB8op4EttCmnRN6Zy1l4mZ9G9V8ulYfKn89kDLKLc0xd+3rEb4vTegWUcSIjpQOckOvemJhMVbHSYIxC1zINGYtnpo3znzSnSsVRR3TQ59MIjwMDx0HYZSNVvIBj14aLgAuqQnwJeodSnh8XzlMX4sc6Dc5VV4rttWrJ6HfiI8Gl4PuL0XYStLFTBhfl+jGkXto6vCO5P2S3n6rpi9MBnNZvqC7UNa90Vq9fM3gLUEnE+uXYeIUuPeu21sdor7Kh+qgX016E8twq0KsYJpRAa4jOwmmm7GKJL5xPYV51HTOSFYnox3Dmcq7zmMsyG1Enqze4PHz+9HUfM8cIlG4vo8ZCwQA7ixAy8P4vEYmtqNuGsnwI43vpcBMkYln1KVFb3aPv7j9/G9Kbi6wJfLxp+3oIdyDLoLjSQDZZ0bxMF6ip/du3IuniXmTgc8rtYi9rPsf/nLbPMGzSp9x7CRC6Wqp1tY+ll+r1d6/Kg74m5kaU1nqkt0f/qiClQJQ5cMtjI+9mUFCbX69gYP4l33ZS7+NIyIItceZn8zLQIsWqM4D/z9HQvjx7O1kLg5kTxO0V835plupqTQpsD2YiW3FlnqLfjIpfLsOvQ28AKtd51H4DY9QqFUjT6ZAaF3+E/MZrJMHW+nb1+tTjHr0b2uDcZ7MvBWvpAgZ7kU/5AzblUHDdH5TCfxbDQpqHxgCOgNuVEONMpQVpRzYKaRgd+BA6RdBiObdh24wqYmlnYSu/lg+3HFW5eh7qT+/LTwvu94+aP01GFy30q4eEJxHF51ovVC29s7o32czYhrbN0qWSxsCh2eYOGupx6mgiJQFecT5rpf3D74YtznjXk6eUfcgdzNGuzKc59KhJxz9UnlMrYByl2qu/bAym/vDsM6dxF7ylLlSpSKiri3cy0srPKAMVTEKtx1zOTGP2bc86rQr7ccGARqVTOkdUFLUzn3JlhbHphdE/yL4MlsYTe7c2nc43SevbBVIujze+8Sd7Ggj407X04uCtE8D9Sta5xrYjs3UTIceXNK8zZWgW3rafVMnL1y7i6jQP45rO5axg4hSsKNd1+keK/T1ys/sZgzJjSfB6ROPE56KBvHMT1rQNt8MylM3yY+kw6iw6GLLew1Yn+PduVEzXCeLZUuCfyPz11Yn0J9iryS9x7bL0tnQa2ZI0k8rDKmnRxUiDEstsd/IISHIZlWV+yps6SR8sfSBchnwlTEhmgD7rzqKD39ZaIKXYnXAwAs3tUGoFfkcbteY+yNaxCPbqivc4R5HccNIfmGUhXWS6PvZRpJ0E3FdfC8ONLzkMns7y2BJtZ7T53jOmJM24P9168cmd3r3/Dia5HM3IuJIs/ZkhGqT7oHgUdJOA9vr8EGsoQVoWaRQjZnAye6x95YX4u4yWexEf6zEiFmJEWs79PYd8Zlcy3OpEPPSSp9vjB5cupxbzhg5zg0NSTWOwRxHmQ1ukuNtF5LK0eLwrbxxaBqdkZlu2va2xORSPFwnATIA1h+pAH9XCMmi9MLIohmKmePmChkCkF+tV7o2V8aguYz8LdOPHc+Q2/iFiBrpfJc0nNzwsImCJ4F5FmPM6CHrcIvZHKebsYuE3Iys3ngWJ44iBKjqjZRzy48c08j32NU/lF2AoMhrsRBpZGSWylqIFZP6Xxa4ijhoAsGGFZdrs5ky2hKaulgB8rM7U= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 460f1894-8877-4f75-597c-08da50a0a8bb X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:33:38.3280 (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: h0kanxtJ2z37DRnn9KblS5AoQhsztuoJw+VIWbQ/LhioLe1sRjKRpq5/oZ5OMcubhj+ovMxRrdN/S2PlImzrgA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6438 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133348_449003_8F0A2544 X-CRM114-Status: GOOD ( 26.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 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. The actual link state is never reported. To address these shortcomings, the driver will need additional information. First, it needs to know how to access the PCS/PMAs (in order to configure them and get the link status). The SGMII PCS/PMA is the only currently-described PCS/PMA. Add the XFI and QSGMII PCS/PMAs as well. The XFI (and 1GBase-KR) PCS/PMA is a c45 "phy" which sits on the same MDIO bus as SGMII PCS/PMA. By default they will have conflicting addresses, but they are also not enabled at the same time by default. Therefore, we can let the default address for the XFI PCS/PMA be the same as for SGMII. This will allow for backwards-compatibility. QSGMII, however, cannot work with the current binding. This is because the QSGMII PCS/PMAs are only present on one MAC's MDIO bus. At the moment this is worked around by having every MAC write to the PCS/PMA addresses (without checking if they are present). This only works if each MAC has the same configuration, and only if we don't need to know the status. Because the QSGMII PCS/PMA will typically be located on a different MDIO bus than the MAC's SGMII PCS/PMA, there is no fallback for the QSGMII PCS/PMA. MEMACs (across all SoCs) support the following protocols: - MII - RGMII - SGMII, 1000Base-X, and 1000Base-KX - 2500Base-X (aka 2.5G SGMII) - QSGMII - 10GBase-R (aka XFI) and 10GBase-KR - XAUI and HiGig Each line documents a set of orthogonal protocols (e.g. XAUI is supported if and only if HiGig is supported). Additionally, - XAUI implies support for 10GBase-R - 10GBase-R is supported if and only if RGMII is not supported - 2500Base-X implies support for 1000Base-X - MII implies support for RGMII To switch between different protocols, we must reconfigure the SerDes. This is done by using the standard phys property. We can also use it to validate whether different protocols are supported (e.g. using phy_validate). This will work for serial protocols, but not RGMII or MII. Additionally, we still need to be compatible when there is no SerDes. While we can detect 10G support by examining the port speed (as set by fsl,fman-10g-port), we cannot determine support for any of the other protocols based on the existing binding. In fact, the binding works against us in some respects, because pcsphy-handle is required even if there is no possible PCS/PMA for that MAC. To allow for backwards- compatibility, we use a boolean-style property for RGMII (instead of presence/absence-style). When the property for RGMII is missing, we will assume that it is supported. The exception is MII, since no existing device trees use it (as far as I could tell). Unfortunately, QSGMII support will be broken for old device trees. There is nothing we can do about this because of the PCS/PMA situation (as described above). Signed-off-by: Sean Anderson --- .../devicetree/bindings/net/fsl-fman.txt | 49 +++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/net/fsl-fman.txt b/Documentation/devicetree/bindings/net/fsl-fman.txt index 801efc7d6818..25c7288e1db2 100644 --- a/Documentation/devicetree/bindings/net/fsl-fman.txt +++ b/Documentation/devicetree/bindings/net/fsl-fman.txt @@ -322,10 +322,50 @@ PROPERTIES Value type: Definition: A phandle for 1EEE1588 timer. +- phys + Usage optional for "fsl,fman-memac" MACs + Value type: + Definition: A phandle for the SerDes lanes which should be + used. This property is required if a pcsphy-handle is + specified. + +- phy-names + Usage optional for "fsl,fman-memac" MACs + Value type: + Definition: Should be "serdes". Must be present if phys is. + - pcsphy-handle + Usage optional for "fsl,fman-memac" MACs + Value type: + Definition: An array of phandles for PCS/PMA devices. Without a + pcs-names property (see below) this should contain a phandle + referencing the SGMII PCS/PMA. This property may be absent if + no serial interfaces are supported. + +- pcs-names + Usage optional for "fsl,fman-memac" MACs + Value type: + Definition: The type of each PCS/PMA, corresponding to + pcsphy-handle. Each value may be one of + - "sgmii" + - "qsgmii" + - "xfi" + If "xfi" is absent, it will default to the value of "sgmii". If + this property is absent, the first phandle in pcsphy-handle + will be assumed to be "sgmii". + +- rgmii Usage required for "fsl,fman-memac" MACs - Value type: - Definition: A phandle for pcsphy. + Value type: + Definition: This property should be 1 if RGMII is supported and + 0 otherwise. + +- mii + Usage optional for "fsl,fman-memac" MACs + Value type: + Definition: This property should be present if MII is + supported. rgmii must be enabled for this property to be + effective. - tbi-handle Usage required for "fsl,fman-dtsec" MACs @@ -446,8 +486,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 Jun 17 20:32: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: 12885992 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 D74A6C433EF for ; Fri, 17 Jun 2022 20:35: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=bgjiEw5OGxa0L4mwaVLhnmKEZ+YiDwjDPLGfIRXbEpE=; b=e+cG2auYpRxaMu o6qdKEy2UR70R48F+RDzurT0JOI6Ow+exXD0D6XKVsYo6hq97hJdrH5mRo1nky/hPfPJCQkJywI0h 3en02iekV1HL4hXdZVd1s5R2Hpg2oTWX/BIdnmBUW+JOY7vI/D+Geo7rpWsq5tvx9cjVS+O33WVVB NAr8KZ5SSi237oxGeEN1f+SuyXXfo00MlLNJHf70EvTWM4tDvBWzxNMdM1iJ5g5LUtGYWz25z21QX nbYWBT9AT9+pR3n1hZjc4+fC10cfkVy29Y3tqKiv3/aHQYt6Xcp1+/eVXx+mSlZRSKUyfHRcctIIQ 1pZ0e4y9Q6DQoDJnEvew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ifh-008xWQ-0x; Fri, 17 Jun 2022 20:34:25 +0000 Received: from mail-am6eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7e1b::610] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2If8-008xGJ-Et; Fri, 17 Jun 2022 20:33:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H0LdQquNrdWAhrwb/TMx6bpQW/bWF4evuRternIAGg3iUrNMOHp99SKKmXtEdvzP0xn4eG+QLhl0C1OLrkUJRHwy1Lci2jmxK9/W6V/3YsiTpzPQ2gZU1+LdlczgitZpnbxKxMizRIqRqtJyWEi1dAFEigs6xerwp41ZohXsp5DkLugk2Sm4CzuwiKOK0epIgqTz2JFPmC6RMNnhYhHKl4qKagKpi1oi4vygGqc4jSIc5NjtP7dWaUjZRrT5v7hCisJ9SB9Zxl6qvT2n53LoULNMbYW0WOBuTRDA8GutmRpyLHWaR16vZGMQu/PC0ZQP38LJ2gcIx4SZ7dcVe66vZg== 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=JZQL8DuiiHr4b/Jw5JGC2VAjAoOOVoDymodmZjPki4A=; b=QmHu2f/SIU4uB2wkUOqFxT+47Be4uhQHpMrRawWG/jiPLmZUKP/mXCGXJzkCsz2LVGG5SUsRTMQxqlwdOyhp1WcCwBHh9MQRq62qR9vAIlwOUN/Csep50OZhXiWkySIuMhjHIqtp0MY915fP9B6IO4YUhltQrTN8MFWSXwg3X5e6N27aU+RNxa7IYi2zZbDLIQrB4p+x7XkvfBce/4pz3BglJVDgomV4BgMt3JEo1mAHgQiZMcErH1Zk4kbwnhh7iMvC2oqb4URsTdKmrq+9gS26W8WGYzB09vVj0qPt52KG/brkigm3Og+RnJPf9rWYuxhPq8oQezmxFnnGm/calw== 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=JZQL8DuiiHr4b/Jw5JGC2VAjAoOOVoDymodmZjPki4A=; b=kYNOTrG6YDzB3ch16+La7KaTU9hKQuIWLINJ3+hBkSbXT6j9EkcIwHYZ4QVwL50vasORYMtZTe7ZehFDan2E1oE4beWhqZEWDkawyK0wzmjpDMTxx32xtopiSGkZD0K8HAU4s3AM9Dst7L3dlm5toMEo+LFZyUNejAprOdyWYSKX+dRbBNyGsWY+Kma6vaFlZP3eceiZPgebckxTmGD5Fc0QHW8gL0uINPtHvSIn2B8/JqWdI90/xagymuXCM+g/3cCqI2oZu26Dt7r74LQwcsDn1FOy65spWodD9vruhoKM+CgiorhAQiMHwftP8Lr9GacSJB7m/qYlAex2E+e7ag== 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 DBAPR03MB6438.eurprd03.prod.outlook.com (2603:10a6:10:19f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:33:41 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:33:41 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson , Ioana Ciornei , Jonathan Corbet , Kishon Vijay Abraham I , Krzysztof Kozlowski , Rob Herring , Vinod Koul , devicetree@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH net-next 03/28] phy: fsl: Add QorIQ SerDes driver Date: Fri, 17 Jun 2022 16:32:47 -0400 Message-Id: <20220617203312.3799646-4-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b08c7b14-f277-411a-cb25-08da50a0aa57 X-MS-TrafficTypeDiagnostic: DBAPR03MB6438:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pMPHkVL50YAvlnBOXSIlKoXuicKJcpsipf0wOIOIhhuzoJtVyuxsn9G//22E7foZdz4X3W2SvPD0ynyclee9VSLhGH1ah7YfN3zAO2pewr6zFUG3sqsPXX8u27KwJXTVhjS2j1l/sx9b2VDVpkM1YyhO4FtFCZ7qOG9seywzmAOKw6sssQfL82FyncwOFnq5mwjZxdl4CoOlem0qDCkUMa4sJO0SHBmaj8Ae7X0Pllz9+qJ8ipUC0b2POpRaKL7JqCjJco83O+4TCCAgPFdU7Ttd6Y97q8dkJJj/k/bjfWJgFyen1Hp6IhfZ2uWN729yIZyAhfYENOI9TcjW7JJXxqZJz0LGuvtPtZ1VNgryacOVheEqvDPi/nvRDu2ScAf59HiPhZB3NXg5G9G6+6JC5CMq3oH9a09NNNPOpyhVYF3ZgFCmCXx5HFFJpz1bUwIEzoDsvtBwE8jSqACOOl6r0CRvWM2OoEYeIzLqKVVm3mDKphEAVDWF7mrBGNFOWPukxXdfWZUGeZqkj62OnBN3BSGkwGEyOuwGdLX5RfgRzdX0l0Cm3QRAXm8zWKB99Yb7U2pNH6eiWgUdnSZb5ZMwJJl7G6wj2l19fJpyXce6iitgugHsxhq+2DKlPpbVL1UdlS1VwqgpZ3sUJpkaQm64Hg5YdC7IXJGEIW/89z1oJ8Jvp7pNUuvUosPjzcu0RAM6tEpG/LUwaFPJNKZuolS87ksXj8LpAtvWi4Z2n6EmpW8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(38350700002)(86362001)(7416002)(38100700002)(186003)(2616005)(5660300002)(6512007)(6486002)(52116002)(2906002)(6506007)(110136005)(8936002)(54906003)(498600001)(316002)(1076003)(66946007)(36756003)(30864003)(8676002)(26005)(83380400001)(4326008)(66556008)(66476007)(21314003)(579004)(559001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rrAjCUBaXEWbhVyha7qA/VFgQhXiS+SUUCHXVfKyk8HXHOAYm+0Y98kQgcIIZ/tL6G8bTkv2gQJvhvxzsnPKmqric1A4lDtwmXJENYxD21BekkxH8tu89CFHcI9xXzhkqwzJwaYT9VatmaVrxf7F7se6FFGZCiKh/goZwTobQnHJMCBBEqH8kzisO00UOo8jOIwqtvZKM79GMLwkBMOB9FZnNTZ09KD8DRL4S6dgro2pDDrz6xg8GHPvXMuyVeQmWu8BYU8je5UWSLyjrPlidmREmrgrjjxjHQeSzAv3tr3us7Qhvs9Bja251IkZBH5P3vk6vL+OujeaJ8njrgWvQ/F8aYumVP7Q1zg/YLoSgpMSsCDo+ZD5a3RY66cUcJVakUMmRSfmhF3lOqY+PLbbpVIHkMnp+zo/pyVt13POaDApQ2PuH5EWNpILsrsxqPPm6VRhldFRMgE+sxOoo7FCzgfnQYNCSqIWUix9HAS7h/NImR7jD5EWwYm5k2/2eMpjf25IfRn4KR+P7I0Ko1a35CxNGRG98gTYiGQP/oP0/cDzIgVc2DyLl2XzzcCaPBF3wAinW86hb6AISNgIcuzWgUIUPyefaEssArGooIP1X6LaZ3071vgql7otzQ1lr+4XbIU0MwpHGJWBMVhTeIoe8x8fR3UPMWoZjRdiDU3WG4pZCAxPPY87xK7dT2Baw/sEihALpjzSbkP+XPA85CcaC0QThu7FYPw3Fr1ce9wsYOiTdNXzMlwwzl+lciEEIQ4Y0NEuvKx0wy8BECjMQ73dWZkcsUyjYGpUMLnusZpsJD0198wtwSScHU84SvOSmidZfO+90W9teOwjn4pM0Drh4M17nAO+pDkXcAlbPYvN6oTlXDBB4091vKb6efiDSboEEVSmm2zQV8f4vfvAqe6UJpkSzumiirTEK3Lf2NlRR7sSXIb1+va9iM61p7lsQtEznf4Jd3wfg3DNnpQdcn9F8yHEnnDaqkhX+FbBQHTFashqghuhAZETdbw0+L//2QgMLKct+Qf/pU8fhx/+aZoY6thT5fK8bNmUWjPuzDnNjJOhQvfp6dbcdv2yx+73kqJaoCwXfRY4+3xef0vs4P+L8rETvdIe1xjrOa12kR/lh8zC7p1oaepz+T1E/Y4Qn4ZEqMoq2SsdxPRRC73nZ4toyY2nhzwOzARsRLd3l9otRCN/pELKCr46zpOE3XwkRkAvYoDhRkcrFhgm7Kxw69lQH1jqul+Qr/oW2sVf3wlw/QVtqT32kYUdJnkgS2KzxA/qrOAs6ZKGkDV5O80lSrMj4A+r3MqCFnELwS1AV6HVuo2lq3dmUdd5Ro4j688AIK3J4HDv/mkV8HryUZlPhiN3Y1dNEanuMW1PbukjFPVbyTiqY5nKemxTa5naSyM0RoOv0/HmYOJU0M+jmmaXeRSXHre/9UUS3xOhq2mwDXefstnka7UG/wZgPwWQwKbQbQx0RBg/PjkQQqXnKtkqp4hIrRftxmRQ1yqE7Y91ekDNC4l7PBwe7TTHvAvQg5+Zt6HhxrqtIpFKLfXF7pZWOvlpzo1Pg9w/p3YWup/IXyGCjiENxMhRyJmoJEL0+1AKQBF32HureVWER5cdyJICj44QLUiyXDniWIDluX1+95E1e2kz3pooj2a6cgrwqFNf8a5m06V2OCi5k8olMWyoXrAIarQy5xErQzYqlIMljLR8sAcuR7Y+m7XOoEEhI8bYvmSK/IiM7tjzQQyBbDmj6WIqPciPUkgCFcYEEzf+YwqEy0Q= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: b08c7b14-f277-411a-cb25-08da50a0aa57 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:33:41.1716 (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: omsolLEP857N4olwHZe3CZ3ittePvT0UJEvDPqyDDWEAlKcYJwAulZo1fO9U1if8Yycv4DCKXyvUoGAWEL6KJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6438 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133350_716516_BD688CE3 X-CRM114-Status: GOOD ( 32.78 ) 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 "SerDes" devices found on various NXP QorIQ SoCs. There may be up to four SerDes devices on each SoC, each supporting up to eight lanes. Protocol support for each SerDes is highly heterogeneous, with each SoC typically having a totally different selection of supported protocols for each lane. Additionally, the SerDes devices on each SoC also have differing support. One SerDes will typically support Ethernet on most lanes, while the other will typically support PCIe on most lanes. There is wide hardware support for this SerDes. I have not done extensive digging, but it seems to be used on almost every QorIQ device, including the AMP and Layerscape series. Because each SoC typically has specific instructions and exceptions for its SerDes, I have limited the initial scope of this module to just the LS1046A. Additionally, I have only added support for Ethernet protocols. There is not a great need for dynamic reconfiguration for other protocols (SATA and PCIe handle rate changes in hardware), so support for them may never be added. Nevertheless, I have tried to provide an obvious path for adding support for other SoCs as well as other protocols. SATA just needs support for configuring LNmSSCR0. PCIe may need to configure the equalization registers. It also uses multiple lanes. I have tried to write the driver with multi-lane support in mind, so there should not need to be any large changes. Although there are 6 protocols supported, I have only tested SGMII and XFI. The rest have been implemented as described in the datasheet. The PLLs are modeled as clocks proper. This lets us take advantage of the existing clock infrastructure. I have not given the same treatment to the lane "clocks" (dividers) because they need to be programmed in-concert with the rest of the lane settings. One tricky thing is that the VCO (pll) rate exceeds 2^32 (maxing out at around 5GHz). This will be a problem on 32-bit platforms, since clock rates are stored as unsigned longs. To work around this, the pll clock rate is generally treated in units of kHz. The PLLs are configured rather interestingly. Instead of the usual direct programming of the appropriate divisors, the input and output clock rates are selected directly. Generally, the only restriction is that the input and output must be integer multiples of each other. This suggests some kind of internal look-up table. The datasheets generally list out the supported combinations explicitly, and not all input/output combinations are documented. I'm not sure if this is due to lack of support, or due to an oversight. If this becomes an issue, then some combinations can be blacklisted (or whitelisted). This may also be necessary for other SoCs which have more stringent clock requirements. The general API call list for this PHY is documented under the driver-api docs. I think this is rather standard, except that most driverts configure the mode (protocol) at xlate-time. Unlike some other phys where e.g. PCIe x4 will use 4 separate phys all configured for PCIe, this driver uses one phy configured to use 4 lanes. This is because while the individual lanes may be configured individually, the protocol selection acts on all lanes at once. Additionally, the order which lanes should be configured in is specified by the datasheet. To coordinate this, lanes are reserved in phy_init, and released in phy_exit. When getting a phy, if a phy already exists for those lanes, it is reused. This is to make things like QSGMII work. Four MACs will all want to ensure that the lane is configured properly, and we need to ensure they can all call phy_init, etc. There is refcounting for phy_init and phy_power_on, so the phy will only be powered on once. However, there is no refcounting for phy_set_mode. A "rogue" MAC could set the mode to something non-QSGMII and break the other MACs. Perhaps there is an opportunity for future enhancement here. This driver was written with reference to the LS1046A reference manual. However, it was informed by reference manuals for all processors with MEMACs, especially the T4240 (which appears to have a "maxed-out" configuration). Signed-off-by: Sean Anderson Reported-by: kernel test robot --- This appears to be the same underlying hardware as the Lynx 28G phy added in 8f73b37cf3fb ("phy: add support for the Layerscape SerDes 28G"). I was working off an older Linux when preparing this series, so I did not notice it. However, I believe this implementation is more comprehensive/versatile. I will look into resolving the differences in the future. Documentation/driver-api/phy/index.rst | 1 + Documentation/driver-api/phy/qoriq.rst | 91 ++ MAINTAINERS | 6 + drivers/phy/freescale/Kconfig | 19 + drivers/phy/freescale/Makefile | 1 + drivers/phy/freescale/phy-qoriq.c | 1441 ++++++++++++++++++++++++ 6 files changed, 1559 insertions(+) create mode 100644 Documentation/driver-api/phy/qoriq.rst create mode 100644 drivers/phy/freescale/phy-qoriq.c diff --git a/Documentation/driver-api/phy/index.rst b/Documentation/driver-api/phy/index.rst index 69ba1216de72..cc7ded8b969c 100644 --- a/Documentation/driver-api/phy/index.rst +++ b/Documentation/driver-api/phy/index.rst @@ -7,6 +7,7 @@ Generic PHY Framework .. toctree:: phy + qoriq samsung-usb2 .. only:: subproject and html diff --git a/Documentation/driver-api/phy/qoriq.rst b/Documentation/driver-api/phy/qoriq.rst new file mode 100644 index 000000000000..ea60fb75a295 --- /dev/null +++ b/Documentation/driver-api/phy/qoriq.rst @@ -0,0 +1,91 @@ +.. SPDX-License-Identifier: GPL-2.0 + +============ +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 qs_conf ` for each SerDes. The +most important member is `modes`, which is an array of :c:type:`struct qs_mode +`. Each "mode" represents a configuration which can be programmed into +a protocol control register. Modes can support multiple lanes (such for PCIe x2 +or x4), as well as multiple protocols (such as SGMII and 1000Base-KX). There +are several helper macros to make configuring each mode easier. It is important +that the list of modes is complete, even if not all protocols are supported. +This lets the driver know which lanes are available, and which have been +configured by the RCW. + +If a protocol is missing, add it to :c:type:`enum qs_protocol `, +and to ``UNSUPPORTED_PROTOS``. If the PCCR shifts/masks for your protocol are +missing, you will need to add them to :c:func:`qs_proto_mode_mask` and +:c:func:`qs_proto_mode_shift`. + +For example, the configuration for SerDes1 of the LS1046A is:: + + static const struct qs_mode ls1046a_modes1[] = { + CONF_SINGLE(1, PCIE, 0x0, 1, 0b001), + CONF_1000BASEKX(0, 0x8, 0, 0b001), + CONF_SGMII25KX(1, 0x8, 1, 0b001), + CONF_SGMII25KX(2, 0x8, 2, 0b001), + CONF_SGMII25KX(3, 0x8, 3, 0b001), + CONF_SINGLE(1, QSGMII, 0x9, 2, 0b001), + CONF_XFI(2, 0xB, 0, 0b010), + CONF_XFI(3, 0xB, 1, 0b001), + }; + + static const struct qs_conf ls1046a_conf1 = { + .modes = ls1046a_modes1, + .mode_count = ARRAY_SIZE(ls1046a_modes1), + .lanes = 4, + .endian = REGMAP_ENDIAN_BIG, + }; + +There is an additional set of configuration for SerDes2, which supports a +different set of modes. Both configurations should be added to the match table:: + + { .compatible = "fsl,ls1046-serdes-1", .data = &ls1046a_conf1 }, + { .compatible = "fsl,ls1046-serdes-2", .data = &ls1046a_conf2 }, + +Supporting Protocols +-------------------- + +Each protocol is a combination of values which must be programmed into the lane +registers. To add a new protocol, first add it to :c:type:`enum qs_protocol +`. If it is in ``UNSUPPORTED_PROTOS``, remove it. Add a new entry to +`qs_proto_params`, and populate the appropriate fields. You may need to add +some new members to support new fields. Modify `qs_lookup_proto` to map the +:c:type:`enum phy_mode ` to :c:type:`enum qs_protocol `. +Ensure that :c:func:`qs_proto_mode_mask` and :c:func:`qs_proto_mode_shift` have +been updated with support for your protocol. + +You may need to modify :c:func:`qs_set_mode` in order to support your procotol. +This can happen when you have added members to :c:type:`struct qs_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-qoriq.c diff --git a/MAINTAINERS b/MAINTAINERS index ca95b1833b97..ef65e2acdb48 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7977,6 +7977,12 @@ F: drivers/ptp/ptp_qoriq.c F: drivers/ptp/ptp_qoriq_debugfs.c F: include/linux/fsl/ptp_qoriq.h +FREESCALE QORIQ SERDES DRIVER +M: Sean Anderson +S: Maintained +F: Documentation/driver-api/phy/qoriq.rst +F: drivers/phy/freescale/phy-qoriq.c + FREESCALE QUAD SPI DRIVER M: Han Xu L: linux-spi@vger.kernel.org diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig index f9c54cd02036..c65dbcc58565 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_QORIQ + tristate "QorIQ SerDes support" + select GENERIC_PHY + select REGMAP_MMIO + help + This adds support for the "SerDes" devices found on various QorIQ + SoCs. There may be up to four SerDes devices on each SoC, and each + device supports up to eight lanes. The SerDes is configured by + default by the RCW, but this module is necessary in order to support + dynamic reconfiguration (such as to support 1G and 10G ethernet on + the same interface). The hardware supports a variety of protocols, + including Ethernet, SATA, PCIe, and more exotic links such as + Interlaken and Aurora. This driver only supports Ethernet, but it + will try not to touch lanes configured for other protocols. + + If you have a QorIQ processor and want to dynamically reconfigure + your SerDes, say Y. If this driver is compiled as a module, it will + be named phy-qoriq. diff --git a/drivers/phy/freescale/Makefile b/drivers/phy/freescale/Makefile index 3518d5dbe8a7..2aca938d9e75 100644 --- a/drivers/phy/freescale/Makefile +++ b/drivers/phy/freescale/Makefile @@ -3,3 +3,4 @@ obj-$(CONFIG_PHY_FSL_IMX8MQ_USB) += phy-fsl-imx8mq-usb.o obj-$(CONFIG_PHY_MIXEL_MIPI_DPHY) += phy-fsl-imx8-mipi-dphy.o obj-$(CONFIG_PHY_FSL_IMX8M_PCIE) += phy-fsl-imx8m-pcie.o obj-$(CONFIG_PHY_FSL_LYNX_28G) += phy-fsl-lynx-28g.o +obj-$(CONFIG_PHY_QORIQ) += phy-qoriq.o diff --git a/drivers/phy/freescale/phy-qoriq.c b/drivers/phy/freescale/phy-qoriq.c new file mode 100644 index 000000000000..6edd770a4c4f --- /dev/null +++ b/drivers/phy/freescale/phy-qoriq.c @@ -0,0 +1,1441 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2022 Sean Anderson + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define PLL_STRIDE 0x20 +#define PLLa(a, off) ((a) * PLL_STRIDE + (off)) +#define PLLaRSTCTL(a) PLLa(a, 0x00) +#define PLLaCR0(a) PLLa(a, 0x04) + +#define PLLaRSTCTL_RSTREQ BIT(31) +#define PLLaRSTCTL_RST_DONE BIT(30) +#define PLLaRSTCTL_RST_ERR BIT(29) +#define PLLaRSTCTL_PLLRST_B BIT(7) +#define PLLaRSTCTL_SDRST_B BIT(6) +#define PLLaRSTCTL_SDEN BIT(5) + +#define PLLaCR0_POFF BIT(31) +#define PLLaCR0_RFCLK_SEL GENMASK(30, 28) +#define PLLaCR0_PLL_LCK BIT(23) +#define PLLaCR0_FRATE_SEL GENMASK(19, 16) +#define PLLaCR0_DLYDIV_SEL GENMASK(1, 0) + +#define PCCR_BASE 0x200 +#define PCCR_STRIDE 0x4 +#define PCCRn(n) (PCCR_BASE + n * PCCR_STRIDE) + +#define PCCR0_PEXa_MASK GENMASK(2, 0) +#define PCCR0_PEXa_SHIFT(a) (28 - (a) * 4) + +#define PCCR2_SATAa_MASK GENMASK(2, 0) +#define PCCR2_SATAa_SHIFT(a) (28 - (a) * 4) + +#define PCCR8_SGMIIa_KX(a) BIT(31 - ((a) * 4)) +#define PCCR8_SGMIIa_MASK GENMASK(2, 0) +#define PCCR8_SGMIIa_SHIFT(a) (28 - (a) * 4) + +#define PCCR9_QSGMIIa_MASK GENMASK(2, 0) +#define PCCR9_QSGMIIa_SHIFT(a) (28 - (a) * 4) + +#define PCCRB_XFIa_MASK GENMASK(2, 0) +#define PCCRB_XFIa_SHIFT(a) (28 - (a) * 4) + +#define LANE_BASE 0x800 +#define LANE_STRIDE 0x40 +#define LNm(m, off) (LANE_BASE + (m) * LANE_STRIDE + (off)) +#define LNmGCR0(m) LNm(m, 0x00) +#define LNmGCR1(m) LNm(m, 0x04) +#define LNmSSCR0(m) LNm(m, 0x0C) +#define LNmRECR0(m) LNm(m, 0x10) +#define LNmRECR1(m) LNm(m, 0x14) +#define LNmTECR0(m) LNm(m, 0x18) +#define LNmSSCR1(m) LNm(m, 0x1C) +#define LNmTTLCR0(m) LNm(m, 0x20) + +#define LNmGCR0_RPLL_LES BIT(31) +#define LNmGCR0_RRAT_SEL GENMASK(29, 28) +#define LNmGCR0_TPLL_LES BIT(27) +#define LNmGCR0_TRAT_SEL GENMASK(25, 24) +#define LNmGCR0_RRST_B BIT(22) +#define LNmGCR0_TRST_B BIT(21) +#define LNmGCR0_RX_PD BIT(20) +#define LNmGCR0_TX_PD BIT(19) +#define LNmGCR0_IF20BIT_EN BIT(18) +#define LNmGCR0_FIRST_LANE BIT(16) +#define LNmGCR0_TTRM_VM_SEL GENMASK(13, 12) +#define LNmGCR0_PROTS GENMASK(11, 7) + +#define LNmGCR0_RAT_SEL_SAME 0b00 +#define LNmGCR0_RAT_SEL_HALF 0b01 +#define LNmGCR0_RAT_SEL_QUARTER 0b10 +#define LNmGCR0_RAT_SEL_DOUBLE 0b11 + +#define LNmGCR0_PROTS_PCIE 0b00000 +#define LNmGCR0_PROTS_SGMII 0b00001 +#define LNmGCR0_PROTS_SATA 0b00010 +#define LNmGCR0_PROTS_XFI 0b01010 + +#define LNmGCR1_RDAT_INV BIT(31) +#define LNmGCR1_TDAT_INV BIT(30) +#define LNmGCR1_OPAD_CTL BIT(26) +#define LNmGCR1_REIDL_TH GENMASK(22, 20) +#define LNmGCR1_REIDL_EX_SEL GENMASK(19, 18) +#define LNmGCR1_REIDL_ET_SEL GENMASK(17, 16) +#define LNmGCR1_REIDL_EX_MSB BIT(15) +#define LNmGCR1_REIDL_ET_MSB BIT(14) +#define LNmGCR1_REQ_CTL_SNP BIT(13) +#define LNmGCR1_REQ_CDR_SNP BIT(12) +#define LNmGCR1_TRSTDIR BIT(7) +#define LNmGCR1_REQ_BIN_SNP BIT(6) +#define LNmGCR1_ISLEW_RCTL GENMASK(5, 4) +#define LNmGCR1_OSLEW_RCTL GENMASK(1, 0) + +#define LNmRECR0_GK2OVD GENMASK(27, 24) +#define LNmRECR0_GK3OVD GENMASK(19, 16) +#define LNmRECR0_GK2OVD_EN BIT(15) +#define LNmRECR0_GK3OVD_EN BIT(16) +#define LNmRECR0_BASE_WAND GENMASK(11, 10) +#define LNmRECR0_OSETOVD GENMASK(5, 0) + +#define LNmRECR0_BASE_WAND_OFF 0b00 +#define LNmRECR0_BASE_WAND_DEFAULT 0b01 +#define LNmRECR0_BASE_WAND_ALTERNATE 0b10 +#define LNmRECR0_BASE_WAND_OSETOVD 0b11 + +#define LNmTECR0_TEQ_TYPE GENMASK(29, 28) +#define LNmTECR0_SGN_PREQ BIT(26) +#define LNmTECR0_RATIO_PREQ GENMASK(25, 22) +#define LNmTECR0_SGN_POST1Q BIT(21) +#define LNmTECR0_RATIO_PST1Q GENMASK(20, 16) +#define LNmTECR0_ADPT_EQ GENMASK(13, 8) +#define LNmTECR0_AMP_RED GENMASK(5, 0) + +#define LNmTECR0_TEQ_TYPE_NONE 0b00 +#define LNmTECR0_TEQ_TYPE_PRE 0b01 +#define LNmTECR0_TEQ_TYPE_BOTH 0b10 + +#define LNmTTLCR0_FLT_SEL GENMASK(29, 24) + +#define PCS_STRIDE 0x10 +#define CR_STRIDE 0x4 +#define PCSa(a, base, cr) (base + (a) * PCS_STRIDE + (cr) * CR_STRIDE) + +#define PCSaCR1_MDEV_PORT GENMASK(31, 27) + +#define SGMII_BASE 0x1800 +#define SGMIIaCR1(a) PCSa(a, SGMII_BASE, 1) + +#define SGMIIaCR1_SGPCS_EN BIT(11) + +#define QSGMII_OFFSET 0x1880 +#define QSGMIIaCR1(a) PCSa(a, QSGMII_BASE, 1) + +#define XFI_OFFSET 0x1980 +#define XFIaCR1(a) PCSa(a, XFI_BASE, 1) + +/* The maximum number of lanes in a single serdes */ +#define MAX_LANES 8 + +enum qs_protocol { + QS_PROTO_UNKNOWN = 0, + QS_PROTO_SGMII, + QS_PROTO_SGMII25, + QS_PROTO_1000BASEKX, + QS_PROTO_QSGMII, + QS_PROTO_XFI, + QS_PROTO_10GKR, + QS_PROTO_PCIE, /* Not implemented */ + QS_PROTO_SATA, /* Not implemented */ + QS_PROTO_LAST, +}; + +static const char qs_proto_str[][16] = { + [QS_PROTO_UNKNOWN] = "unknown", + [QS_PROTO_SGMII] = "SGMII", + [QS_PROTO_SGMII25] = "2.5G SGMII", + [QS_PROTO_1000BASEKX] = "1000Base-KX", + [QS_PROTO_QSGMII] = "QSGMII", + [QS_PROTO_XFI] = "XFI", + [QS_PROTO_10GKR] = "10GBase-KR", + [QS_PROTO_PCIE] = "PCIe", + [QS_PROTO_SATA] = "SATA", +}; + +#define PROTO_MASK(proto) BIT(QS_PROTO_##proto) +#define UNSUPPORTED_PROTOS (PROTO_MASK(SATA) | PROTO_MASK(PCIE)) + +/** + * struct qs_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 qs_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 qs_proto_params qs_proto_params[] = { + [QS_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, + }, + [QS_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, + }, + [QS_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, + }, + [QS_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, + }, + [QS_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, + }, + [QS_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 qs_mode - A single configuration of a protocol controller + * @protos: A bitmask of the &enum qs_protocol this mode supports + * @lanes: A bitbask of the lanes which will be used when this config is + * selected + * @pccr: The number of the PCCR which contains this mode + * @idx: The index of the protocol controller. For example, SGMIIB would have + * index 1. + * @cfg: The value to program into the controller to select this mode + * + * The serdes has multiple protocol controllers which can be each be selected + * independently. Depending on their configuration, they may use multiple lanes + * at once (e.g. AUI or PCIe x4). Additionally, multiple protocols may be + * supported by a single mode (XFI and 10GKR differ only in their protocol + * parameters). + */ +struct qs_mode { + u16 protos; + u8 lanes; + u8 pccr; + u8 idx; + u8 cfg; +}; + +static_assert(QS_PROTO_LAST - 1 <= + sizeof_field(struct qs_mode, protos) * BITS_PER_BYTE); +static_assert(MAX_LANES <= + sizeof_field(struct qs_mode, lanes) * BITS_PER_BYTE); + +#define CONF(_lanes, _protos, _pccr, _idx, _cfg) { \ + .lanes = _lanes, \ + .protos = _protos, \ + .pccr = _pccr, \ + .idx = _idx, \ + .cfg = _cfg, \ +} + +#define CONF_SINGLE(lane, proto, pccr, idx, cfg) \ + CONF(BIT(lane), PROTO_MASK(proto), pccr, idx, cfg) + +#define CONF_1000BASEKX(lane, pccr, idx, cfg) \ + CONF(BIT(lane), PROTO_MASK(SGMII) | PROTO_MASK(1000BASEKX), \ + pccr, idx, cfg) + +#define CONF_SGMII25(lane, pccr, idx, cfg) \ + CONF(BIT(lane), PROTO_MASK(SGMII) | PROTO_MASK(SGMII25), \ + pccr, idx, cfg) + +#define CONF_SGMII25KX(lane, pccr, idx, cfg) \ + CONF(BIT(lane), \ + PROTO_MASK(SGMII) | PROTO_MASK(1000BASEKX) | PROTO_MASK(SGMII25), \ + pccr, idx, cfg) + +#define CONF_XFI(lane, pccr, idx, cfg) \ + CONF(BIT(lane), PROTO_MASK(XFI) | PROTO_MASK(10GKR), pccr, idx, cfg) + +/** + * struct qs_conf - Configuration for a particular serdes + * @modes: Valid protocol controller configurations + * @mode_count: Number of modes in @modes + * @lanes: Number of lanes + * @endian: Endianness of the registers + */ +struct qs_conf { + const struct qs_mode *modes; + size_t mode_count; + unsigned int lanes; + enum regmap_endian endian; +}; + +struct qs_priv; + +/** + * struct qs_clk - Driver data for the PLLs + * @hw: The clock hardware + * @serdes: The parent serdes + * @idx: Which PLL this clock is for + */ +struct qs_clk { + struct clk_hw hw; + struct qs_priv *serdes; + unsigned int idx; +}; + +struct qs_clk *qs_clk_hw_to_priv(struct clk_hw *hw) +{ + return container_of(hw, struct qs_clk, hw); +} + +/** + * struct qs_priv - Driver data for the serdes + * @lock: A lock protecting "common" registers in @regmap, as well as the + * members of this struct. Lane-specific registers are protected by the + * phy's lock. PLL registers are protected by the clock's lock. + * @pll: The PLL clocks + * @ref: The reference clocks for the PLLs + * @dev: The serdes device + * @regmap: The backing regmap + * @conf: The configuration for this serdes + * @used_lanes: Bitmap of the lanes currently used by phys + * @groups: List of the created groups + */ +struct qs_priv { + struct mutex lock; + struct qs_clk pll[2]; + struct clk *ref[2]; + struct device *dev; + struct regmap *regmap; + const struct qs_conf *conf; + unsigned int used_lanes; + struct list_head groups; +}; + +/** + * struct qs_group - Driver data for a group of lanes + * @groups: List of other groups; protected by @serdes->lock. + * @phy: The associated phy + * @serdes: The parent serdes + * @pll: The currently-used pll + * @first_lane: The first lane in the group + * @last_lane: The last lane in the group + * @proto: The currently-configured protocol + * @users: Number of current users; protected by @serdes->lock. + */ +struct qs_group { + struct list_head groups; + struct phy *phy; + struct qs_priv *serdes; + struct clk *pll; + unsigned int first_lane; + unsigned int last_lane; + enum qs_protocol proto; + unsigned int users; +}; + +static u32 qs_read(struct qs_priv *serdes, u32 reg) +{ + unsigned int ret = 0; + + WARN_ON_ONCE(regmap_read(serdes->regmap, reg, &ret)); + return ret; +} + +static void qs_write(struct qs_priv *serdes, u32 val, u32 reg) +{ + WARN_ON_ONCE(regmap_write(serdes->regmap, reg, val)); +} + +/* XXX: The output rate is in kHz to avoid overflow on 32-bit arches */ + +static void qs_pll_disable(struct clk_hw *hw) +{ + struct qs_clk *clk = qs_clk_hw_to_priv(hw); + struct qs_priv *serdes = clk->serdes; + u32 rstctl = qs_read(serdes, PLLaRSTCTL(clk->idx)); + + dev_dbg(clk->serdes->dev, "%s(pll%d)\n", __func__, clk->idx); + + rstctl &= ~PLLaRSTCTL_SDRST_B; + qs_write(serdes, rstctl, PLLaRSTCTL(clk->idx)); + ndelay(50); + rstctl &= ~(PLLaRSTCTL_SDEN | PLLaRSTCTL_PLLRST_B); + qs_write(serdes, rstctl, PLLaRSTCTL(clk->idx)); + ndelay(100); +} + +static int qs_pll_enable(struct clk_hw *hw) +{ + struct qs_clk *clk = qs_clk_hw_to_priv(hw); + struct qs_priv *serdes = clk->serdes; + u32 rstctl = qs_read(serdes, PLLaRSTCTL(clk->idx)); + + dev_dbg(clk->serdes->dev, "%s(pll%d)\n", __func__, clk->idx); + + rstctl |= PLLaRSTCTL_RSTREQ; + qs_write(serdes, rstctl, PLLaRSTCTL(clk->idx)); + + rstctl &= ~PLLaRSTCTL_RSTREQ; + rstctl |= PLLaRSTCTL_SDEN | PLLaRSTCTL_PLLRST_B | PLLaRSTCTL_SDRST_B; + qs_write(serdes, rstctl, PLLaRSTCTL(clk->idx)); + + /* TODO: wait for the PLL to lock */ + + return 0; +} + +static int qs_pll_is_enabled(struct clk_hw *hw) +{ + struct qs_clk *clk = qs_clk_hw_to_priv(hw); + struct qs_priv *serdes = clk->serdes; + u32 rstctl = qs_read(serdes, PLLaRSTCTL(clk->idx)); + + dev_dbg(clk->serdes->dev, "%s(pll%d)\n", __func__, clk->idx); + + return rstctl & PLLaRSTCTL_RST_DONE && !(rstctl & PLLaRSTCTL_RST_ERR); +} + +static const u32 rfclk_sel_map[8] = { + [0b000] = 100000000, + [0b001] = 125000000, + [0b010] = 156250000, + [0b011] = 150000000, +}; + +/** + * qs_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 qs_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, +}; + +/** + * qs_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 qs_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 qs_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 qs_pll_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct qs_clk *clk = qs_clk_hw_to_priv(hw); + struct qs_priv *serdes = clk->serdes; + u32 cr0 = qs_read(serdes, PLLaCR0(clk->idx)); + u32 frate_sel = FIELD_GET(PLLaCR0_FRATE_SEL, cr0); + u32 rfclk_sel = FIELD_GET(PLLaCR0_RFCLK_SEL, cr0); + unsigned long ret; + + dev_dbg(clk->serdes->dev, "%s(pll%d, %lu)\n", __func__, + clk->idx, parent_rate); + + ret = mult_frac(parent_rate, qs_pll_ratio(frate_sel, rfclk_sel), + HZ_PER_KHZ); + return ret; +} + +static long qs_pll_round_rate(struct clk_hw *hw, unsigned long rate_khz, + unsigned long *parent_rate) +{ + int frate_sel, rfclk_sel; + struct qs_clk *clk = qs_clk_hw_to_priv(hw); + u32 ratio; + + dev_dbg(clk->serdes->dev, "%s(pll%d, %lu, %lu)\n", __func__, + clk->idx, rate_khz, *parent_rate); + + frate_sel = qs_frate_to_sel(rate_khz); + if (frate_sel < 0) + return frate_sel; + + rfclk_sel = qs_rfclk_to_sel(*parent_rate); + if (rfclk_sel >= 0) { + ratio = qs_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 = qs_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 qs_pll_set_rate(struct clk_hw *hw, unsigned long rate_khz, + unsigned long parent_rate) +{ + int frate_sel, rfclk_sel, ret; + struct qs_clk *clk = qs_clk_hw_to_priv(hw); + struct qs_priv *serdes = clk->serdes; + u32 ratio, cr0 = qs_read(serdes, PLLaCR0(clk->idx)); + + dev_dbg(clk->serdes->dev, "%s(pll%d, %lu, %lu)\n", __func__, + clk->idx, rate_khz, parent_rate); + + frate_sel = qs_frate_to_sel(rate_khz); + if (frate_sel < 0) + return frate_sel; + + /* First try the existing rate */ + rfclk_sel = qs_rfclk_to_sel(parent_rate); + if (rfclk_sel >= 0) { + ratio = qs_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 = qs_pll_ratio(frate_sel, rfclk_sel); + if (ratio) { + ret = clk_set_rate(serdes->ref[clk->idx], + rfclk_sel_map[rfclk_sel]); + if (!ret) + goto got_rfclk; + } + } + + return ret; + +got_rfclk: + cr0 &= ~(PLLaCR0_RFCLK_SEL | PLLaCR0_FRATE_SEL); + cr0 |= FIELD_PREP(PLLaCR0_RFCLK_SEL, rfclk_sel); + cr0 |= FIELD_PREP(PLLaCR0_FRATE_SEL, frate_sel); + qs_write(serdes, cr0, PLLaCR0(clk->idx)); + return 0; +} + +static const struct clk_ops qs_pll_clk_ops = { + .enable = qs_pll_enable, + .disable = qs_pll_disable, + .is_enabled = qs_pll_is_enabled, + .recalc_rate = qs_pll_recalc_rate, + .round_rate = qs_pll_round_rate, + .set_rate = qs_pll_set_rate, +}; + +/** + * qs_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 qs_lane_bitmap(struct qs_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 qs_init(struct phy *phy) +{ + int ret = 0; + struct qs_group *group = phy_get_drvdata(phy); + struct qs_priv *serdes = group->serdes; + unsigned int lane_mask = qs_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 qs_exit(struct phy *phy) +{ + struct qs_group *group = phy_get_drvdata(phy); + struct qs_priv *serdes = group->serdes; + + clk_disable_unprepare(group->pll); + clk_rate_exclusive_put(group->pll); + mutex_lock(&serdes->lock); + serdes->used_lanes &= ~qs_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 qs_power_on(struct phy *phy) +{ + int i; + struct qs_group *group = phy_get_drvdata(phy); + u32 gcr0; + + for_each_lane(i, group) { + gcr0 = qs_read(group->serdes, LNmGCR0(i)); + gcr0 &= ~(LNmGCR0_RX_PD | LNmGCR0_TX_PD); + qs_write(group->serdes, gcr0, LNmGCR0(i)); + + usleep_range(15, 30); + gcr0 |= LNmGCR0_RRST_B | LNmGCR0_TRST_B; + qs_write(group->serdes, gcr0, LNmGCR0(i)); + } + + return 0; +} + +static int qs_power_off(struct phy *phy) +{ + int i; + struct qs_group *group = phy_get_drvdata(phy); + u32 gcr0; + + for_each_lane_reverse(i, group) { + gcr0 = qs_read(group->serdes, LNmGCR0(i)); + gcr0 |= LNmGCR0_RX_PD | LNmGCR0_TX_PD; + gcr0 &= ~(LNmGCR0_RRST_B | LNmGCR0_TRST_B); + qs_write(group->serdes, gcr0, LNmGCR0(i)); + } + + return 0; +} + +/** + * qs_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 qs_protocol qs_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 QS_PROTO_SGMII; + case PHY_INTERFACE_MODE_2500BASEX: + return QS_PROTO_SGMII; + case PHY_INTERFACE_MODE_QSGMII: + return QS_PROTO_QSGMII; + case PHY_INTERFACE_MODE_XGMII: + case PHY_INTERFACE_MODE_10GBASER: + return QS_PROTO_XFI; + case PHY_INTERFACE_MODE_10GKR: + return QS_PROTO_10GKR; + default: + return QS_PROTO_UNKNOWN; + } + /* Not implemented (yet) */ + case PHY_MODE_PCIE: + case PHY_MODE_SATA: + default: + return QS_PROTO_UNKNOWN; + } +} + +/** + * qs_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 qs_mode *qs_lookup_mode(struct qs_group *group, + enum qs_protocol proto) +{ + int i; + const struct qs_conf *conf = group->serdes->conf; + + for (i = 0; i < conf->mode_count; i++) { + const struct qs_mode *mode = &conf->modes[i]; + + if (BIT(proto) & mode->protos && + qs_lane_bitmap(group) == mode->lanes) + return mode; + } + + return NULL; +} + +static int qs_validate(struct phy *phy, enum phy_mode phy_mode, int submode, + union phy_configure_opts *opts) +{ + enum qs_protocol proto; + struct qs_group *group = phy_get_drvdata(phy); + const struct qs_mode *mode; + + proto = qs_lookup_proto(phy_mode, submode); + if (proto == QS_PROTO_UNKNOWN) + return -EINVAL; + + /* Nothing to do */ + if (proto == group->proto) + return 0; + + mode = qs_lookup_mode(group, proto); + if (!mode) + return -EINVAL; + + return 0; +} + +/** + * qs_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 qs_proto_mode_mask(const struct qs_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_debug("unknown mode PCCR%X %s%c\n", mode->pccr, + qs_proto_str[mode->protos], 'A' + mode->idx); + return 0; +} + +/** + * qs_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 qs_proto_mode_shift(const struct qs_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_debug("unknown mode PCCR%X %s%c\n", mode->pccr, + qs_proto_str[mode->protos], 'A' + mode->idx); + return 0; +} + +/** + * qs_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 qs_proto_mode_get(const struct qs_mode *mode, u32 pccr) +{ + return (pccr >> qs_proto_mode_shift(mode)) & qs_proto_mode_mask(mode); +} + +/** + * qs_proto_mode_prep() - Configure a PCCR for a mode + * @mode: The mode to configure + * @pccr: The current value of the PCCR + * @cfg: The config to program + * + * Return: The new value for the PCCR + */ +static u32 qs_proto_mode_prep(const struct qs_mode *mode, u32 pccr, u32 cfg) +{ + u32 shift = qs_proto_mode_shift(mode); + + pccr &= ~(qs_proto_mode_mask(mode) << shift); + return pccr | cfg << shift; +} + +#define abs_diff(a, b) ({ \ + typeof(a) _a = (a); \ + typeof(b) _b = (b); \ + _a > _b ? _a - _b : _b - _a; \ +}) + +static int qs_set_mode(struct phy *phy, enum phy_mode phy_mode, int submode) +{ + enum qs_protocol proto; + const struct qs_proto_params *params; + const struct qs_mode *old_mode = NULL, *new_mode; + int i, pll, ret; + struct qs_group *group = phy_get_drvdata(phy); + struct qs_priv *serdes = group->serdes; + u32 mask, tmp; + u32 gcr0 = 0, gcr1 = 0, recr0 = 0, tecr0 = 0; + u32 gcr0_mask = 0, gcr1_mask = 0, recr0_mask = 0, tecr0_mask = 0; + + proto = qs_lookup_proto(phy_mode, submode); + if (proto == QS_PROTO_UNKNOWN) { + 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 = qs_lookup_mode(group, proto); + if (!new_mode) { + dev_dbg(&phy->dev, "could not find mode for %s on lanes %u to %u\n", + qs_proto_str[proto], group->first_lane, + group->last_lane); + return -EINVAL; + } + + if (group->proto != QS_PROTO_UNKNOWN) { + old_mode = qs_lookup_mode(group, group->proto); + if (!old_mode) { + dev_err(&phy->dev, "could not find mode for %s\n", + qs_proto_str[group->proto]); + return -EBUSY; + } + } + + clk_disable_unprepare(group->pll); + clk_rate_exclusive_put(group->pll); + group->pll = NULL; + + /* First, try to use a PLL which already has the correct rate */ + params = &qs_proto_params[proto]; + for (pll = 0; pll < ARRAY_SIZE(serdes->pll); pll++) { + struct clk *clk = serdes->pll[pll].hw.clk; + unsigned long rate = clk_get_rate(clk); + unsigned long error = abs_diff(rate, params->frate_khz); + + dev_dbg(&phy->dev, "pll%d has rate %lu\n", pll, rate); + /* Accept up to 100ppm deviation */ + if ((!error || params->frate_khz / error > 10000) && + !clk_set_rate_exclusive(clk, rate)) + goto got_pll; + /* Someone else got a different rate first */ + } + + /* If neither PLL has the right rate, try setting it */ + for (pll = 0; pll < 2; pll++) { + ret = clk_set_rate_exclusive(serdes->pll[pll].hw.clk, + params->frate_khz); + if (!ret) + goto got_pll; + } + + dev_dbg(&phy->dev, "could not get a pll at %ukHz\n", + params->frate_khz); + return ret; + +got_pll: + group->pll = serdes->pll[pll].hw.clk; + clk_prepare_enable(group->pll); + + gcr0_mask |= LNmGCR0_RRAT_SEL | LNmGCR0_TRAT_SEL; + gcr0_mask |= LNmGCR0_RPLL_LES | LNmGCR0_TPLL_LES; + gcr0_mask |= LNmGCR0_RRST_B | LNmGCR0_TRST_B; + gcr0_mask |= LNmGCR0_RX_PD | LNmGCR0_TX_PD; + gcr0_mask |= LNmGCR0_IF20BIT_EN | LNmGCR0_PROTS; + gcr0 |= FIELD_PREP(LNmGCR0_RPLL_LES, !pll); + gcr0 |= FIELD_PREP(LNmGCR0_TPLL_LES, !pll); + gcr0 |= FIELD_PREP(LNmGCR0_RRAT_SEL, params->rat_sel); + gcr0 |= FIELD_PREP(LNmGCR0_TRAT_SEL, params->rat_sel); + gcr0 |= FIELD_PREP(LNmGCR0_IF20BIT_EN, params->if20bit); + gcr0 |= FIELD_PREP(LNmGCR0_PROTS, params->prots); + + gcr1_mask |= LNmGCR1_RDAT_INV | LNmGCR1_TDAT_INV; + gcr1_mask |= LNmGCR1_OPAD_CTL | LNmGCR1_REIDL_TH; + gcr1_mask |= LNmGCR1_REIDL_EX_SEL | LNmGCR1_REIDL_ET_SEL; + gcr1_mask |= LNmGCR1_REIDL_EX_MSB | LNmGCR1_REIDL_ET_MSB; + gcr1_mask |= LNmGCR1_REQ_CTL_SNP | LNmGCR1_REQ_CDR_SNP; + gcr1_mask |= LNmGCR1_TRSTDIR | LNmGCR1_REQ_BIN_SNP; + gcr1_mask |= LNmGCR1_ISLEW_RCTL | LNmGCR1_OSLEW_RCTL; + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_TH, params->reidl_th); + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_EX_SEL, params->reidl_ex & 3); + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_ET_SEL, params->reidl_et & 3); + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_EX_MSB, params->reidl_ex >> 2); + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_ET_MSB, params->reidl_et >> 2); + gcr1 |= FIELD_PREP(LNmGCR1_TRSTDIR, + group->first_lane > group->last_lane); + gcr1 |= FIELD_PREP(LNmGCR1_ISLEW_RCTL, params->slew); + gcr1 |= FIELD_PREP(LNmGCR1_OSLEW_RCTL, params->slew); + + recr0_mask |= LNmRECR0_GK2OVD | LNmRECR0_GK3OVD; + recr0_mask |= LNmRECR0_GK2OVD_EN | LNmRECR0_GK3OVD_EN; + recr0_mask |= LNmRECR0_BASE_WAND | LNmRECR0_OSETOVD; + if (params->gain) { + recr0 |= FIELD_PREP(LNmRECR0_GK2OVD, params->gain); + recr0 |= FIELD_PREP(LNmRECR0_GK3OVD, params->gain); + recr0 |= LNmRECR0_GK2OVD_EN | LNmRECR0_GK3OVD_EN; + } + recr0 |= FIELD_PREP(LNmRECR0_BASE_WAND, params->baseline_wander); + recr0 |= FIELD_PREP(LNmRECR0_OSETOVD, params->offset_override); + + tecr0_mask |= LNmTECR0_TEQ_TYPE; + tecr0_mask |= LNmTECR0_SGN_PREQ | LNmTECR0_RATIO_PREQ; + tecr0_mask |= LNmTECR0_SGN_POST1Q | LNmTECR0_RATIO_PST1Q; + tecr0_mask |= LNmTECR0_ADPT_EQ | LNmTECR0_AMP_RED; + tecr0 |= FIELD_PREP(LNmTECR0_TEQ_TYPE, params->teq); + if (params->preq_ratio) { + tecr0 |= FIELD_PREP(LNmTECR0_SGN_PREQ, 1); + tecr0 |= FIELD_PREP(LNmTECR0_RATIO_PREQ, params->preq_ratio); + } + if (params->postq_ratio) { + tecr0 |= FIELD_PREP(LNmTECR0_SGN_POST1Q, 1); + tecr0 |= FIELD_PREP(LNmTECR0_RATIO_PST1Q, params->postq_ratio); + } + tecr0 |= FIELD_PREP(LNmTECR0_ADPT_EQ, params->adpt_eq); + tecr0 |= FIELD_PREP(LNmTECR0_AMP_RED, params->amp_red); + + mutex_lock(&serdes->lock); + + /* Disable the old controller */ + if (old_mode) { + tmp = qs_read(serdes, PCCRn(old_mode->pccr)); + tmp = qs_proto_mode_prep(old_mode, tmp, 0); + qs_write(serdes, tmp, PCCRn(old_mode->pccr)); + + if (old_mode->protos & PROTO_MASK(SGMII)) { + tmp = qs_read(serdes, SGMIIaCR1(old_mode->idx)); + tmp &= SGMIIaCR1_SGPCS_EN; + qs_write(serdes, tmp, SGMIIaCR1(old_mode->idx)); + } + } + + for_each_lane_reverse(i, group) { + tmp = qs_read(serdes, LNmGCR0(i)); + tmp &= ~(LNmGCR0_RRST_B | LNmGCR0_TRST_B); + qs_write(serdes, tmp, LNmGCR0(i)); + ndelay(50); + + tmp &= ~gcr0_mask; + tmp |= gcr0; + tmp |= FIELD_PREP(LNmGCR0_FIRST_LANE, i == group->first_lane); + qs_write(serdes, tmp, LNmGCR0(i)); + + tmp = qs_read(serdes, LNmGCR1(i)); + tmp &= ~gcr1_mask; + tmp |= gcr1; + qs_write(serdes, tmp, LNmGCR1(i)); + + tmp = qs_read(serdes, LNmRECR0(i)); + tmp &= ~recr0_mask; + tmp |= recr0; + qs_write(serdes, tmp, LNmRECR0(i)); + + tmp = qs_read(serdes, LNmTECR0(i)); + tmp &= ~tecr0_mask; + tmp |= tecr0; + qs_write(serdes, tmp, LNmTECR0(i)); + + tmp = qs_read(serdes, LNmTTLCR0(i)); + tmp &= ~LNmTTLCR0_FLT_SEL; + tmp |= FIELD_PREP(LNmTTLCR0_FLT_SEL, params->flt_sel); + qs_write(serdes, tmp, LNmTTLCR0(i)); + + ndelay(120); + tmp = qs_read(serdes, LNmGCR0(i)); + tmp |= LNmGCR0_RRST_B | LNmGCR0_TRST_B; + qs_write(serdes, tmp, LNmGCR0(i)); + } + + if (proto == QS_PROTO_1000BASEKX) { + /* FIXME: this races with clock updates */ + tmp = qs_read(serdes, PLLaCR0(pll)); + tmp &= ~PLLaCR0_DLYDIV_SEL; + tmp |= FIELD_PREP(PLLaCR0_DLYDIV_SEL, 1); + qs_write(serdes, tmp, PLLaCR0(pll)); + } + + /* Enable the new controller */ + tmp = qs_read(serdes, PCCRn(new_mode->pccr)); + tmp = qs_proto_mode_prep(new_mode, tmp, new_mode->cfg); + if (new_mode->protos & PROTO_MASK(1000BASEKX)) { + if (new_mode->pccr == 8) { + mask = PCCR8_SGMIIa_KX(new_mode->idx); + } else { + dev_err(&phy->dev, "PCCR%X doesn't have a KX bit\n", + new_mode->pccr); + mask = 0; + } + + if (proto == QS_PROTO_1000BASEKX) + tmp |= mask; + else + tmp &= ~mask; + } + qs_write(serdes, tmp, PCCRn(new_mode->pccr)); + + if (new_mode->protos & PROTO_MASK(SGMII)) { + tmp = qs_read(serdes, SGMIIaCR1(new_mode->idx)); + tmp |= SGMIIaCR1_SGPCS_EN; + qs_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", + qs_proto_str[proto], group->first_lane, group->last_lane); + return 0; +} + +static void qs_release(struct phy *phy) +{ + struct qs_group *group = phy_get_drvdata(phy); + struct qs_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 qs_phy_ops = { + .init = qs_init, + .exit = qs_exit, + .power_on = qs_power_on, + .power_off = qs_power_off, + .set_mode = qs_set_mode, + .validate = qs_validate, + .release = qs_release, + .owner = THIS_MODULE, +}; + +static struct phy *qs_xlate(struct device *dev, struct of_phandle_args *args) +{ + struct phy *phy; + struct list_head *head; + struct qs_group *group; + struct qs_priv *serdes = dev_get_drvdata(dev); + + if (args->args_count != 2) + return ERR_PTR(-EINVAL); + + mutex_lock(&serdes->lock); + + /* Look for an existing group */ + list_for_each(head, &serdes->groups) { + group = container_of(head, struct qs_group, groups); + if (group->first_lane == args->args[0] && + group->last_lane == args->args[1]) { + group->users++; + return group->phy; + } + } + + /* None found, create our own */ + group = kzalloc(sizeof(*group), GFP_KERNEL); + if (!group) { + mutex_unlock(&serdes->lock); + return ERR_PTR(-ENOMEM); + } + + group->serdes = serdes; + group->first_lane = args->args[0]; + group->last_lane = args->args[1]; + group->users = 1; + phy = phy_create(dev, NULL, &qs_phy_ops); + if (IS_ERR(phy)) { + kfree(group); + } else { + group->phy = phy; + phy_set_drvdata(phy, group); + list_add(&group->groups, &serdes->groups); + } + + mutex_unlock(&serdes->lock); + return phy; +} + +static int qs_probe(struct platform_device *pdev) +{ + bool grabbed_clocks = false; + int i, ret; + struct device *dev = &pdev->dev; + struct qs_priv *serdes; + struct regmap_config regmap_config = {}; + const struct qs_conf *conf; + struct resource *res; + void __iomem *base; + + serdes = devm_kzalloc(dev, sizeof(*serdes), GFP_KERNEL); + if (!serdes) + return -ENOMEM; + platform_set_drvdata(pdev, serdes); + mutex_init(&serdes->lock); + INIT_LIST_HEAD(&serdes->groups); + serdes->dev = dev; + + base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(base)) { + ret = PTR_ERR(base); + dev_err_probe(dev, ret, "could not get/map registers\n"); + return ret; + } + + conf = device_get_match_data(dev); + serdes->conf = conf; + regmap_config.reg_bits = 32; + regmap_config.reg_stride = 4; + regmap_config.val_bits = 32; + regmap_config.val_format_endian = conf->endian; + regmap_config.max_register = res->end - res->start; + regmap_config.disable_locking = true; + serdes->regmap = devm_regmap_init_mmio(dev, base, ®map_config); + if (IS_ERR(serdes->regmap)) { + ret = PTR_ERR(serdes->regmap); + dev_err_probe(dev, ret, "could not create regmap\n"); + return ret; + } + + for (i = 0; i < ARRAY_SIZE(serdes->ref); i++) { + static const char fmt[] = "ref%d"; + char name[sizeof(fmt)]; + + snprintf(name, sizeof(name), fmt, i); + serdes->ref[i] = devm_clk_get(dev, name); + if (IS_ERR(serdes->ref[i])) { + ret = PTR_ERR(serdes->ref[i]); + dev_err_probe(dev, ret, "could not get %s\n", name); + return ret; + } + } + + for (i = 0; i < ARRAY_SIZE(serdes->pll); i++) { + static const char fmt[] = "%s.pll%d"; + char *name; + const struct clk_hw *ref_hw[] = { + __clk_get_hw(serdes->ref[i]), + }; + size_t len; + struct clk_init_data init = {}; + + len = snprintf(NULL, 0, fmt, pdev->name, i); + name = devm_kzalloc(dev, len + 1, GFP_KERNEL); + if (!name) + return -ENOMEM; + + snprintf(name, len + 1, fmt, pdev->name, i); + init.name = name; + init.ops = &qs_pll_clk_ops; + init.parent_hws = ref_hw; + init.num_parents = 1; + init.flags = CLK_SET_RATE_GATE | CLK_GET_RATE_NOCACHE; + init.flags |= CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE; + + serdes->pll[i].hw.init = &init; + serdes->pll[i].serdes = serdes; + serdes->pll[i].idx = i; + ret = devm_clk_hw_register(dev, &serdes->pll[i].hw); + if (ret) { + dev_err_probe(dev, ret, "could not register %s\n", + name); + return ret; + } + } + + /* Deselect anything configured by the RCW/bootloader */ + for (i = 0; i < conf->mode_count; i++) { + const struct qs_mode *mode = &conf->modes[i]; + u32 pccr = qs_read(serdes, PCCRn(mode->pccr)); + + if (qs_proto_mode_get(mode, pccr) == mode->cfg) { + if (mode->protos & UNSUPPORTED_PROTOS) { + /* Don't mess with modes we don't support */ + serdes->used_lanes |= mode->lanes; + if (grabbed_clocks) + continue; + + grabbed_clocks = true; + clk_prepare_enable(serdes->pll[0].hw.clk); + clk_prepare_enable(serdes->pll[1].hw.clk); + clk_rate_exclusive_get(serdes->pll[0].hw.clk); + clk_rate_exclusive_get(serdes->pll[1].hw.clk); + } else { + /* Otherwise, clear out the existing config */ + pccr = qs_proto_mode_prep(mode, pccr, 0); + qs_write(serdes, pccr, PCCRn(mode->pccr)); + } + } + } + + /* TODO: clear SGMIIaCR1 */ + + /* TODO: power off unused lanes */ + + ret = PTR_ERR_OR_ZERO(devm_of_phy_provider_register(dev, qs_xlate)); + if (ret) + dev_err_probe(dev, ret, "could not register phy provider\n"); + else + dev_info(dev, "probed with %d lanes\n", conf->lanes); + return ret; +} + +/* + * XXX: For SerDes1, lane A uses pins SD1_RX3_P/N! That is, the lane numbers + * and pin numbers are _reversed_. In addition, the PCCR documentation is + * _inconsistent_ in its usage of these terms! + * + * PCCR "Lane 0" refers to... + * ==== ===================== + * 0 Lane A + * 2 Lane A + * 8 Lane A + * 9 Lane A + * B Lane D! + */ +static const struct qs_mode ls1046a_modes1[] = { + CONF_SINGLE(1, PCIE, 0x0, 1, 0b001), /* PCIe.1 */ + CONF_1000BASEKX(0, 0x8, 0, 0b001), /* SGMII.6 */ + CONF_SGMII25KX(1, 0x8, 1, 0b001), /* SGMII.5 */ + CONF_SGMII25KX(2, 0x8, 2, 0b001), /* SGMII.10 */ + CONF_SGMII25KX(3, 0x8, 3, 0b001), /* SGMII.9 */ + CONF_SINGLE(1, QSGMII, 0x9, 2, 0b001), /* QSGMII.6,5,10,1 */ + CONF_XFI(2, 0xB, 0, 0b010), /* XFI.10 */ + CONF_XFI(3, 0xB, 1, 0b001), /* XFI.9 */ +}; + +static const struct qs_conf ls1046a_conf1 = { + .modes = ls1046a_modes1, + .mode_count = ARRAY_SIZE(ls1046a_modes1), + .lanes = 4, + .endian = REGMAP_ENDIAN_BIG, +}; + +static const struct qs_mode ls1046a_modes2[] = { + CONF_SINGLE(0, PCIE, 0x0, 0, 0b001), /* PCIe.1 x1 */ + CONF(GENMASK(3, 0), PROTO_MASK(PCIE), 0x0, 0, 0b011), /* PCIe.1 x4 */ + CONF_SINGLE(2, PCIE, 0x0, 2, 0b001), /* PCIe.2 x1 */ + CONF(GENMASK(3, 2), PROTO_MASK(PCIE), 0x0, 2, 0b010), /* PCIe.3 x2 */ + CONF_SINGLE(3, PCIE, 0x0, 2, 0b011), /* PCIe.3 x1 */ + CONF_SINGLE(3, SATA, 0x2, 0, 0b001), /* SATA */ + CONF_1000BASEKX(1, 0x8, 1, 0b001), /* SGMII.2 */ +}; + +static const struct qs_conf ls1046a_conf2 = { + .modes = ls1046a_modes2, + .mode_count = ARRAY_SIZE(ls1046a_modes2), + .lanes = 4, + .endian = REGMAP_ENDIAN_BIG, +}; + +static const struct of_device_id qs_of_match[] = { + { .compatible = "fsl,ls1046a-serdes-1", .data = &ls1046a_conf1 }, + { .compatible = "fsl,ls1046a-serdes-2", .data = &ls1046a_conf2 }, +}; +MODULE_DEVICE_TABLE(of, qs_of_match); + +static struct platform_driver qs_driver = { + .probe = qs_probe, + .driver = { + .name = "qoriq_serdes", + .of_match_table = qs_of_match, + }, +}; +module_platform_driver(qs_driver); + +MODULE_AUTHOR("Sean Anderson "); +MODULE_DESCRIPTION("QorIQ SerDes driver"); +MODULE_LICENSE("GPL"); From patchwork Fri Jun 17 20:32: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: 12885996 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 407BCC433EF for ; Fri, 17 Jun 2022 20:38:31 +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=FLepWPLaYFPu/oBxc3KC3AmBQAprJ30HX8P5NBLxKsY=; b=ChGgPbXSTaZWL9 QYnOeUAzXtDbsa5Y+1nRs3h1sx4LOh2p0rbgeUnBdrLh9iQ63uM2dS0toquzuz8r6uZ4TAQZcrKMp Mf93y+KxlA5Flf1QKtBI9OjCcKkVp6k+2hjxYB0Q/qhfPPjtcgjwVIiZeP1zuhObfcOP3SDzdk3W5 Brw2c4Cd/CFs6cf+Bqzm7Q81fQGTVL8IQOOac3Xt1zQEIXS60UXhU5anTcAkhJH2ziz6dIGt3C1Jl R8tOp7yKg2PHHbJnAjrlpY2qBYRALnEDT0T8fl9ElDzA3VTRPCaQuDRELtgiu2G3KXoEgSnG6JHso FqesKTzqmjsmJltbTI3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IiD-008yao-B4; Fri, 17 Jun 2022 20:37:02 +0000 Received: from mail-am6eur05on2061c.outbound.protection.outlook.com ([2a01:111:f400:7e1b::61c] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfE-008xKA-IB for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S7jVChiCBO3i2xKj1XvjeDLK4rvc5LiLCw96kfESds4jGP04sK9jgvFLs9I84zrvvp3yew2rHfon0/R+XsEwXaGUUopXZMg4TPOBga700dE7rFe8zu97jRVMPniQxVMBiM5Z0RSJY66UydfIRjZeKqt4EF8WiXthEcetBm6kjhlxaLaCXQhymOzFIsGR2MiPcywQg86wzuqWC28Vl/DyqKvt4iatXD/k4tqdQcPIXPji8Cm3eIu9ntf8hDj9mBsff1lhPHA9ko8vA58zF0X1TWWBAjp62YS6OeoDDvRSOJVBmkVvFFeJBML8g6T61VsJdOdUUldd1gJpu2FvjDvfcg== 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=KHnBJsTfzHluZdsmsUYJ75hJxzGihRPE4o7cGqm6cHQ=; b=QvmEKqwooXYCcAGMCM+l/LUHsFy/6PMsmYA51hm2GL3rUOVa65Y4MFQlGOAhsE6HHX31Zg9Z6RYAmfmB8MI2dXcxZe1JK3yDiqrKLMpGMjoojyb2HVqvUkxaTHWQgC0Z9Dkl4lzV8XsXl0ZEy9uyS2VfWSbw+9bb6KWh3h/eAbUPI1/U+HzLCMCv9AR41t75HwzovK4dnPHrQgSlwKGnUCwIB66PQVBZsO+oQvXVom43jMhCdexWRbscLZoROsJXXqsyW9ruKuVC6d45qNjAErkvf1KW4SEnQqAeqyeiq2G3xOIklEM6IHT8pEND1AgufBzrGDHSb6D+vnzdSCsAPg== 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=KHnBJsTfzHluZdsmsUYJ75hJxzGihRPE4o7cGqm6cHQ=; b=0gjfMnC4PEy6nhxABv6r8NghYKyrXxopKpH0rl+RZe+sWE2yjRe1HwXbPOhBJPOcTtMKUuKtNo/TY5IR8GjhP6Cl95Zk74gQr7dw8EcLZDvP6giJjWl3Zwd6Uo3wqtaBxtBCZGkv2XayffhhvdGO1vu5kcxXpcD5IOyUN6sZS1xf/Bm3YYYvBHQJEcL26qTEMuBTMPabIHlei6aPn+7+0vLEc0bLDZjdi8tgRGr7suaJfUMI2oW/1D1uQQNn9Aum9DzPEczmtp9W9gt2x7KLvQEctgWLRGlUqK2OZd8JOGHzPBrLl26ioFQjPSnSh/jeNxOWARyYYCK4MFPXkJEwLA== 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 DBAPR03MB6438.eurprd03.prod.outlook.com (2603:10a6:10:19f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:33:43 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:33:43 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson , Camelia Groza Subject: [PATCH net-next 04/28] net: fman: Convert to SPDX identifiers Date: Fri, 17 Jun 2022 16:32:48 -0400 Message-Id: <20220617203312.3799646-5-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 47ce9bf8-7b77-4b4f-1b4b-08da50a0ab90 X-MS-TrafficTypeDiagnostic: DBAPR03MB6438:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3Ig9i6wIQwVXJGuTW3R5NodZfO+NQQhBdX4I/xcnag44yGDUhTdPxHYZmktwDLpvnod5PLSge80TfXtbUdwzAExAbWiY1UMEWQyTfJJxZJTeL35TlKsybeH1WB2BzcDJTzXx5oHY+k/07HradTlMOF9eB0GExoezZ4m25vJR5EkRPYGTwqQhL/Swxc67umF5K1CcxoG23ZD9xxiDp/iYB6GUEy7GHvkAAL2KCM6/aSYbVPP3mhi/cZEwQrn4aHJYt6xC1MCSrDfc05zRPLbaYj8TKAcRJ+JNOuHxCBfGrcuNgdYAzcb+qXuL85/PAWsqIj8fpleVoks6u9c+xqd5CwQLIZOfwRvWw/wCtSepZx9WwMBN+RDIPkZfKqKdXlsy3aVeL5vtHf5knUTS1xTXPmKu1Hlbaqz/YdWGIihxLhEU7GlbAuxaeFKa0/QCfAaftVFajMNfdfkyZUrVxDbjG3exxINya+fgoLQoSa2ezYJdvz5QA1MW8CiTzXA/fcAXf1OTRjwcVqmmSz+j7UUDMBV8TlX6QVU3ooyzQ2kyHgokOa20yNdgSQNgn2PV+ngA0mOJCeV7nJnkPZNrO/v9urJMsh7i7R35cmImiJJwydg+pvenJQaAq4F5yvIJuHqu6mnsQvy7WXftsuAk6OhDUqVvAQ7XwrAELoBjIE+QDahxTu7l2vJ557uCaD3fz5gaPqvMs5gRsgWPM8EgmwdlPbh+L5AOpwIPT2IFv8SBFUM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(38350700002)(86362001)(7416002)(38100700002)(186003)(2616005)(5660300002)(6512007)(6486002)(52116002)(2906002)(6506007)(110136005)(8936002)(54906003)(498600001)(316002)(1076003)(66946007)(36756003)(30864003)(8676002)(26005)(83380400001)(4326008)(66556008)(66476007)(2004002)(579004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Zo3j3UiSxKODggb6wHV7sOdlvAuKYURm2Z+VQjgHYzbOfvx8Tqua/41mS6twucFWQ2RtVedFzImMwoBtRxXUIeyO2QWazveRXNRYlV+06pUqrdALie4wN5uIsHqdh/kZq6G9KOSX3Da/18wgLsuBD+4WBX9hZ2198mlXiHcL/BM4Ze159Tg/5hEWA8zIlQ4LhZq1/YjVivhzErvr6b65Ch/3IquUhED+F7pRFGrNr/6K6R/sTGVlrz/rVHv+ON6k1AD2j7uMNbVpxMi4qyw88JDn2M/4tor5auzY382yLVH2rAhxSXDmJlH7ApZ2wRBPF6lNGi7wnAUlYBA/20Ev8zrBBGZaJSwHumbxj+/sycSYECk9CEy+9WwOYwCEEBCMKZ1iW/SQykT/ibHGV+Xz/KEcoCCTA1OlUmNyIf/vua0ZzRQg2hN6c8htmAT78LskEzVKgEOChvb0Po0l6rZ3/Oa2kQgDVX+LkkzmcUnT1Afw/pCgnrjv7x+hHvzbGVYgl+klNjewofkl12uDLwHsg+03+46xkgChO7JK+3l7W6eZfo8IXc3dVzWWycG5dJiHbIh1aCw/uaeF6kwD2Lg8FWXRL7Y2UWre/ntGVFbWEwOnsgmMY/XgFjGzWe4gnXJh8SQI5xePUHM6jO8/XKw2cVrZfWedk7tCZxbwmZykRAsJYX9ASLlCc+lj7OHvfoeqAeYIjII5cv2HthqaJBhtIP3mgnzTCea/a030LiCi948aoek1la/zjOFcHwbGjQAW8FVsYmqf7RV9dT9M+LIjRVzhDhO9tJA5x6TImKiU+SFJajhYXs76hpF8Gs66HA35OKspYey4UdTJin2h4MwX1A1odMvR5QlCohupBw9f7v0hi9IkeeoY0BNeIzQaO/o7yuttfC0Y8QaSC8D0zlpgpMPW4tJ2iU6adfORyQw/bv+oP+6s/qbdAQgIpwpDcsEqz2963oVOnjee/fHu3jH46VoUsJWHMX2AmeHrI/YyNm+uQiede2hu82zdspe1fhfkgryV3KU1WWqpjH9szTdcjna/ws+GbJiEWY5S1wlknltdhNbm6v+RsskLmJtWSejtMOmc7L6YTopYkg8xXM2PlR1sXFDDnCqi9voz+7zfy+a9GusDyVMCPZlJzjvWtEy6yXibrCA3HWon6A+1IuYOFWwTbKkxdxb6GlZDxY13Jystjtiv+HWZSnuNKhYKyfvmpsrVNAvNjQYv/Z1t0+lcVQuvLDP45HRyV0g5/0voigYN4c405Pg/0jsrgf8T6BXaW+UOpbwwpq/PxqAYNCFX7RApkQL9Ia+uZXN1MEeAFL38G2U/F0Q79MUJNOorOR+FXQ1Dtf/FHdWiGhOXiRbejlK/6opFgD/R3lKDBgFjVjGOygWI6/3M44cSG7xUIpKY/HVMHHCnwpgL9rvYos2HhE5dPXJDl9jSfi5/aTPwxBBUjgGfpZK0qLHzJT+rxz/0bvSA9lOVH3ISf7vCd2fPxdMDRXQ9+ZCOU4VPq9zzrDiZzZLQ1u80pYak4z+3GffUpyVh/SDo3+7u8Hyc67pjgRSNg5BbeAvrsYF/k9/+4tTCpTZPLmCHk43mvIhVkkR6BAMa2ZDT+PHsggqEChlU1xnmYiD24ah3FJ/h0CMbNvUHnqNahAxe1SWj8EPLYK5sOX2ha91zf1hCGbsxM0FaYZQHtuQ3+LPN5I6kBJ4BLS+2ivs9/oQXObN/C0CptXFgt2Aej0wib/ZPBcI1qEWLqOG2M7d82n08IjiD1O/M0Pg= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47ce9bf8-7b77-4b4f-1b4b-08da50a0ab90 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:33:43.2652 (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: V2M/plGdScruhw2qNvuJ3IChToJbZzWnSgm4JI/Ih0ni+MZ0dhsy9Y3+q9+nFNsjpxMeoop0pOh6yALtz99HVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6438 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133357_021964_6669A298 X-CRM114-Status: GOOD ( 13.56 ) 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 --- 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 Jun 17 20:32: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: 12885993 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 1FCBDC43334 for ; Fri, 17 Jun 2022 20:36: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=xrZNAbc8+IR2WNSQVfsj+aehgGsC+mdX6ASrgQFrkBc=; b=lnOtPn5kF6SINo ouWM6HUlnw5439OWuOwLzv/jR+GsLU1MUWBvGD9PDc5Xa7Qf2vql5XJOzLP83otUUBYYUKqJcNyaT GJp513pAYQl8QEtHsgD7L2btkikSfJPbHlVvwYySL57RClQ415xYBK87mh3OUUElYEZM0PMs+xPvs N7Kr7sk60qgnfuQ17PxCa8ELbM6DhXWT5azuro82b8pEmRPKon07WtJTyj+asnOgi/f8lP1/x/GOh fZ7p+0iDiw8/Ght54xRgtoujbDHxxQSHR0TT6+T6DlcXMRxpZ0CG84gNmxHcUAVKTlBinyeW7y9b7 LBYPta1Xi/W7jFcaM3Zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IgF-008xlg-6W; Fri, 17 Jun 2022 20:34:59 +0000 Received: from mail-am6eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7e1b::610] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfE-008xGJ-4N for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:33:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NWAuz/bbjlARNcSU2dGkkNo7PQIVsepr06Smn8fHTfrUno3lwu+kTuelEkVsJmkfqIF+1YPrubOHSwxkgtqe2jQmBHk2dYzD3GldVTTeTc0a89HphqE62nvXhT2hWWuT5X7iqDkgduMBEuaAlDOElfGelmL2hQqBvIJfanvspLH7DFHK3NRf9Rvu0aTLNONTd0I5nr3NxtC+CCf2X3F+g0NCVed4GGHuAjTIIF5VtBf5oC4yiXYNumlSLKa5+zIe8/vTqBir0z2JkczrVSS5OVv2IlDQp0rLW/hWlIG717Zqv6IuiaZd6SWPJS6OEKbO/Dybwqi3tX+HaT6ZTnTA8w== 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=iidGnLzSwApv0XUHFdSQpezBG/BqcsIZZhqiqq10upU=; b=K5iM5RZMvdzBengvk3KzBEqXfERHFj8zNFfedKKhBj/OHKuev6r0sCh5j+Smm+OssgLKHUBQ71z/eXN6bGHZkmYvAuxs9QPnbHw9l76fb1x3UL38YikQ+tYLle5y6dXdwKRVXV1WYNLrNuGYRW9V6bWbBH73Ust4MXtrCTKqTcEBrnKjO/bsnkGD7LIHnO5Q4kzziOdpCfansdlAiQOOa0YyI0sO112mdGYM0S5PGWmHdJ7jOoaJgz3dhXdahOkUciA3clg1FPOcdsBhpGx2Qga0foC8BGG7UqGZWQ7G2C/EenBOE6NyxgT09WV7+YPcesDzmT89BnTDNv/D2B0k7A== 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=iidGnLzSwApv0XUHFdSQpezBG/BqcsIZZhqiqq10upU=; b=EGCfhORR2X/W8WrIAY5sZPeXeFwGC7HQ9U8yM6+/mB5dqYfjEmoFddJnwTl2nzJpc337KL4ibeAGYW8MxtVxgFo5e1cVrpYJQOQjYebVeX3+2ohnmS/1nhJ+Bxn4TXFhoZTcIiV6yjx4byBNqSsdUYpq4duUBsODSX+SxYNmuGBdSZD3GDFHWh6I/K2phE7+wVTcjPRjdDb7ZLGKBPIV2nzvX48y0Q5dazcUU4viypegj+oRZolCV9IKB7UejJIUn/2LhD+nCOowywyZ2pfQ2VfNpc95rMsP90/C57aL2RAFucaTLZiNfyIM8SyMkIcgT7FVlD3R6n+YCwr69difKg== 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 DBAPR03MB6438.eurprd03.prod.outlook.com (2603:10a6:10:19f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:33:45 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:33:45 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson , Camelia Groza Subject: [PATCH net-next 05/28] net: fman: Don't pass comm_mode to enable/disable Date: Fri, 17 Jun 2022 16:32:49 -0400 Message-Id: <20220617203312.3799646-6-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bd9ff0f2-fc2a-4924-1bbe-08da50a0acd9 X-MS-TrafficTypeDiagnostic: DBAPR03MB6438:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TiCOFbSaNr7qYRGGyKDbTeczeZtodgVTuOv62THsffhA5PfI8nkY6hU5tSV+w8S6Gneiurh9RbcTk2VTMO2GeaZAdfljhHxcasGhA7WJbWk2cdLrJ350Gy2U7EIVVZf0UvYE5ythIr3TfMhofyxToK0IbojDSt/UaTURuiufVyiii7gMjIMWEbXLOcR/dsjJbWZPgYRLz6hKBAMypmQCpTvXBOF3nVDvSgAfVUM84b7Hut3FHYWmO1u6KoplOQDvzY03rp6nJprPphjRWqH3M1uyfHAQCAXMglkzMUvTtgsDeif7aQSRw7Rq6hOGMloFi5ENR6/VbaYn5k/lHdDFTdZtC+cJ31Lry34eJZJzROJuNJYeMH3zEFAFdyB3zamhT9eIEzmReSYwgZEjbVO9dceuPKGq7NeUzmuVr+Wanfzvs9aJ+PLew6IUjdf7KYvOnz399EuqN8lblt0DDwFnEb0y4mkLpvtKPivIVlxRkWxv3MVTFYEoA5uZLnheHGYMDBuSG204Z5ChTU33dhuVTimT8HfFk0JPOyerLc8adHwDvichzm7MIMdTb6IvZulysq6juClmWtochqCC+YwgAl8nvZE7g0kuNPJ438oXwKenlM6dPTQF0q3UKdlBezKoXtBmsBjFT2y1+1/TJvRNJdh++XX0pfqTxPsX8XdiVjHW+jSwnQiDU9k/dq6il9WUrbgvxYfuhP5GE2gAN8+nvg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(38350700002)(86362001)(7416002)(38100700002)(186003)(2616005)(5660300002)(6512007)(6486002)(52116002)(2906002)(6506007)(110136005)(8936002)(54906003)(498600001)(316002)(1076003)(66946007)(36756003)(8676002)(26005)(83380400001)(4326008)(66556008)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 29+VnHHRMbV4nzOKbZqtTfNrmUnt5qB02j5VoJwjuEGD5Ei8xSuysZ7ipwV3B6JVHXL6FUpCCBSP1UTw9IfR/uUc/mLaIrFDgUNEQ+8dKJHtl05lRNMF6jdxR2m6GCuamA/zXYa5WW2tC587KMYUJjlhnJAp8H8Lm8OaFjpg5oTcoJAbkIwnFH4buygZ3dCvBLPVmO4YPbR9ORUZn8WW5+v7FxOc7AzTtmcVKN9eNyh48BqD5qCfMsfCJ9lZIy69GLiBBd3LvQVhY/sC17AwT4ZV38dnmvKNbnqQg8vKm7nX++Qt11BsV5MDQN6gQt3D8d70wa+/1iDnqBta2hhYRQyCaqUorF8JojLMmnE+Igm2N2j2Iq5twRF/DLgL9X2ZGpUl/xXcZuiHlDvrzVn1TGgNxqo1zC3juJvSIvv7AJoOzHZTMJT6cPbpsAGVoCZFrdsUxJfRjcvpNNIBZD79byVSwDeXBBgtGQXuS0Lv+DeE+8FgOKhILPoGq2kFZdQNdq5bODcXS5+8dnOCXm4lhEcUmjkqyg1pNYOz5ysyJY67zndtAl5wszO7e3i6szJStP6wIPmPsdAyLLsT3rloRpZY6TPknp/h2PUiEMoqDkDhjFfXS+me2vbF38qdrGB1XmNFma5/jF2wXLcjUiaVRjUGalc3uYJD5PNq0wQkw/h23mUs0fEBDYWsRdzUHS/lYeiz+zz0FMVGuDlcfxdJjaR83gk2SnabozS5gnmmfViHLwDjPXxeWOcQxrzdNVYMG3Ia6ssbsEIbsUbCoM3cfxBPRS+pGaL1gu3FIpdxwbhBO7HbsgbMaDbIfFrnElMRFnY2LUymR5WGvAP2YKlA78hMZkKfLSfEX0FEECjNAE3lO9y7m5L1H8cJgsnyB2ZxBI7Zy1BC6TgFlNisfCE3qIqp0fq+zulXgHRs7tFKlljrfiqRf/uQsDxaWdaAlE9AEUCNvkPQN6uUhpPUBleKUDCHO7flbjxWl53fP5sIkV5hqGPan0+pqmOi2TXoubxTM6Q0uawjrzgDNXJcpQaocWxdqPmLGLHxAcXD8W9OnvVhj9phvRo9+6pvuib3mTmfDmckN8J/Zt1qA09MUsMa4bxGK/gV4OkpIZNBeWJvd1ASMpw7GQPx+kos+XTktISNoRl52J/vzgBd1cAtQofnEpTUFndu84jHQmL85GnZdhFgX0F+aW7P0D6a0c806uZ/EU58MF1RCcohivbnFwstASSoy9js0spgbiuBR6YPJUIm2wMNsQtHbRr36k14hT/ZSpBgpf7JtdmAqSpo7LRBbUVmOUs61noxKtERU1MduyO18fna27KdYtS7ze8FXnYUBs0jRTG5miuwkTRFZG6iYAfW2nrIGeFQPqYmhzIs60HX4DXWamPxR+lkgK0PWd6DAWXFJrHoqN2Lz+UatEc4cC5riLiXWmoA07Qv11L74iem/XnI8bDFsVpPGQu3km1J/GoLOSpqkyn3azQwGBE5I8ihNBEnWIbEwNqPzcCs+uSwa1LQ8QrMVNNP7fw/pOb16mChaDHKp9UTnTL8QOYuB74AxGiPEubi3PMNrzF0ACNavrEzp3YN19FJDmzxdwMvtBS5DjfyiSX/YTAPV9/03M0FiW7kdWrKiwPnMB1NpMxTd/SN4ptLYBob3DZAns5lMii1KSneWdgx6z381Lm90wRttzgBBD0UPom7acHiq8/MIixFu3bKMqaV3n+TDkB/KTFfu+04annBmNIo5D0dmrzXvBoI3dIng+srH1C8OZ8= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd9ff0f2-fc2a-4924-1bbe-08da50a0acd9 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:33:45.2495 (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: tKc7DWAVT4SomV7DCfowXvA2/8SNc+2KtSMYmqKLDsR3qR3h0BbJMJKqD5P+FXs0u0jzqVw62QcdMDgda3J2DA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6438 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133356_399121_8F342F57 X-CRM114-Status: GOOD ( 10.56 ) 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 --- .../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 Jun 17 20:32: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: 12885994 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 3533CC43334 for ; Fri, 17 Jun 2022 20:36: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=l8fHiWOf/wmEfnwfZ4+iQfycyL62zSXT+wuCBP8IiSg=; b=BQLAxBbPy9xQgO x7+sQIyTPfXfGXzH1kquvKeKqiNJ7DAP7e8NPs0hTnSYMZWPhXzQhvbWEH3W3BkrGOwZMdMaOh2zD ysqmYh3qkLiTwmktY/3NQITxYjsFr9EDXsPOhyPelSFbmQXh0o2na5uLnlhIU+TDwIYDIITc1mgyf NfKguFktqdBCfq4rnB128zyXHF+em0tRL9v5v0UjmpS4yG2MWBDloOzZ11DSdjyaLJ0hJzkswJREJ ucDhhte9WTOjYGvFBcKAe/bVkUJrhVbu/wKuBb2JGEfnKpZxG+8mTMmxxyrKA8/xYP3WneNSCI8l5 6B2o8f5fhWjQT/phK1TQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Igg-008xyh-Sx; Fri, 17 Jun 2022 20:35:27 +0000 Received: from mail-am6eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7e1b::610] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfG-008xGJ-PN for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J0YGyp72V0ATCQ1jWW/XdVwPdTuXgQ+DldbIGu3IpVoSA9VbrIpn1p84T2PEd7lQx+Cs/vIJ8CVej3l3/ehbkEoHfqKj5lqE0UYR5kexB7uw9U3zNJach/btlQOat3HOPnwuTWiCaECNBYfSWlHOfqJAhzuvbjrO/+E8ZlSex3hG22DGWgJcthv975q3Zr069oVhlCkIsaDwJowV46nY8yFA632xIBPqkHvKnnudOe0i6gnRXXVtK7c1Aw5UPhrAOQwnmTuNhuaHz82cwWEC8ONXUS3GZpPVJbC5WiOj2wb2YQQYRSli2OZRpu8Rq4G0C+Kh68YSbbuBbpr4o+E8OQ== 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=m68xkMFd/AoKjcLPvwuWpU3iQVhr5xuJq4ud4EtZaIU=; b=cOaSoZ+KkEH2qcZs3+fq70bVDqSRciijQRG1gPGnVS4q7lidal+GI/ZKmXP0sHcsWZC5x2fi+T3FLy6sDcupkKrOsAh0BXhCpCsDtsu/a2oCubmDv/Oulyopyh2zFCx47UpHoTYDN8LmDbcIpmM+aCgX8UjICAUPmrBcAxavSdg2zZmvWilv52qgGc8Z9QKvpOcnwMfOziLIoGrb1utyk8+2wgvXZJtX3CycKp5RTv75122lFIWwfFN7FZNa4cYN5mAJZf5gBZ0HPK+cMimFGKueFa5KXGok2EPYbDRsMjXmn+c8Qmth5ha619eGDvx1wfIo8kQt2QDmQM3iyXNq/A== 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=m68xkMFd/AoKjcLPvwuWpU3iQVhr5xuJq4ud4EtZaIU=; b=YzrNtWYIx/yh6FiyRjQv81buZFNWDLb8aURb6m9mDXtmvZtWHT3olU+75uiowueUoQ7A4LtYR6z5B1zxsBvKgkTsDvQ+j4n+Jx/Y1GS7bEyMpkk6KG7hLyjdJG6SNwBoVma8O1QHSbYUEyeSjIzLn+DlIX9dtj1jvhruNM0WYidmIc97J+5mNwYG6yCTQUKOZgGQEMqvua4+r4/OmNB/UFMfuUxXa2sjJ1ohVZJ9ZFTEBrg8Nky7G2hUkUvkZa9P6jck+AtPN1SAw2O/C4g7otRPznXWzwhrhrz99+ZFKvysl0z/6aqPdYziCq1FPnDXa6Ez28Hxi8hC+w/aWFVVbA== 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 DBAPR03MB6438.eurprd03.prod.outlook.com (2603:10a6:10:19f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:33:47 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:33:47 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson , Camelia Groza Subject: [PATCH net-next 06/28] net: fman: Store en/disable in mac_device instead of mac_priv_s Date: Fri, 17 Jun 2022 16:32:50 -0400 Message-Id: <20220617203312.3799646-7-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 30eacf82-b138-4235-5955-08da50a0adfe X-MS-TrafficTypeDiagnostic: DBAPR03MB6438:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EtTVloty4EVAQ2jIWW8Hv+/ExScCSMt+linDGUYtBtnQFb2SGQMwsxB4m12XQTEW81VHM65Q7fMzkmLMaMr1BqJ5DGPrmYk7lmU/+6P9HPUV/ydw9UeYluzU8xuo7fJt3GavGr7LLs/JbYAzakYz6xN4DXwDkDJV+fPGgm/og3o/bpPtw9Y0dZ9ojvN+SJQKvLc7ndHoV3nEdoJZNK9gCAVsx21UFNHNauVl/lK2uruRe0nU45DqWiZp+K6UHb9oGW+7ev9OcAp8zkgdBuJA48VSbcol1BstOqS+cVOYil9Ms1TlJO2oxkpYZcR6NycqqV89mZTOZ78siKQTze85QNXdRbsJhtyqK6Fvfow4U3dKWxF5Pv+5DpW9YjvtGqxeH71qP6NBtdgmieO4Q/KbLhKvEyk6Li7VUq34ZmzfTRMSO8+4NH4t6NRXQzyAQelV7JcACUdXwRB5e+T9M2rLPvU/vTugF1y2WrD892hWbwsbRipZ3SL9GkPlKyLN9zC4Ok6OGCYcTIJ50E+dMTHc3xqsYh4UYELK+UYPU4oqObd3d30L0rrMRkgLq/F6UEbna1IXB2cAkUCJu/KZp6y41h6AzaT0NVaswybBf60X9I0Yb4fqFESz5W/Dymm6Hp7ZxWSR4P+l6cWzQV8nzf+gVxxai83+ACdHxXgYoUhYmUgER8sY4eErSG0t2XOdyqy5ioLXFaBRUbbGieRVSgYZ5A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(38350700002)(86362001)(7416002)(38100700002)(186003)(2616005)(5660300002)(6512007)(6486002)(52116002)(2906002)(6506007)(110136005)(8936002)(54906003)(498600001)(316002)(1076003)(66946007)(6666004)(36756003)(8676002)(26005)(83380400001)(4326008)(66556008)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HI9z9PkIh0V6iq/a1hMdhaVBnaK9PmYgHhdEMnk3Ud6rITf9fmGjrMf58iec4Sk7ZOjwuI4LWsMYGQB5L9bJ/D3fI1gaDzOyF1YrNuUQP2S1vUl0h1ZB1S6EziAr1JkLl4EC5TCcNAE06gRI7gSEFZ30m99Vi6vAPSEYlwIhBbLIojhCn9Xb8S6ixNBrfXhEDYt89tO3WyHbsbiT86tnrN21KJ1KbnP1qZQv2ybUyGwSpbJUxuUTfTLX7T0XdCU4TLlEUWghkhgWzX7QbCxi5hDL7Dlc5UKDLBIZQfEp3ZWm7wLrr8fI1bM282GLNWDI5D/JvUW7FkbWu+J/xz9szVsAa6w3tO0Jt7Nbjl5A5bGd1PeHFQWEa6Prjphj5b6/HXpWt4Qs/MygkLlL73ajJcDzunEjzR5fph0To4bF/PYyV/xztnS82tmcIk53obrfGyh7dbGnJfgTIK3JqVKn1BkyEhkj1NiQvACSoxvHpwne3wP0b4qM3e6adfCMPz2YBQvLz/pms49ihCvj+maP2/Rjn3yYPOe4iSk63CmrOHXp0Oo/zJxWSTXej3yLq+ftFaAR8WCiwl6tEMgsBrpzdIKj9SpIGMuG1YnTaukG0eNiXZNpayu/k9iQj1GRHn6yoL5e+fjINaVQFXgZ8KXJfCpyQdQ2aqT5k4FbH9ZeBiKs+qs5l+5s5J2U5+Ohb3KVpTCBbJi9yZWFxnypsyO/gLSYB0T5peiw93MaD/9Zg4jNhZH5WUw/MXXOziZ3/KynTUEnCQ53vEdj8d3CL2clafvv8dVcOr6D3fOWhmiku4UoYXQQUbm70KtPOurPqjIbJxsyQ+674E7y/o7vBTiV1P3j5gZ/3tb2psi7+FTYYzovPmgoqD3FoUdya5QzRiQB6gVonjoknJ1Ud4YL9myXLsJHa4a25vUEqPDtBUi9COUBzc0FvIXli+uG+/n+3R81dK3CDyZjeNu6VyXcJUIqDdrKShdM8sTtjNQO+ViFx1TghEaa7JUCh4DXAptgHDbCSnbZSJPwE/a5dSi9+UHavX4DbnLbOnlKU+qwmdRqhJuNw/fr7IMT4sSz6rwZRKrmWwKtHBUAJuUitB1VSn/adavfNh806MBqVXn/voiL8hBXopJUxUbAt0Hmt0yvS9ZSlfRyPxUwLShPQdeFccN2d8AuD+Bv6KcqbtTPkhZbeD57MwyuXaAiA9bBDwmq6GO2QcEuGxKKpFQJtd21QcICJA/lyA2Q/7g4zfeo3F7R2LuH2bnkMVPanuYFAqB2gAPsBPpGJ2spFSxtbt4wDs2O5oAzM42139ead11eZuwWZ7Q2OtUg1vGnwL5xw1EabeJGfyKIFI8vXmcYeywpFu1vypD0/PVR1t7pDCJP83AAlycWfG8pCuwovyFFSU72dYWjeG+U65IxwI61GSJX78y1aNAVlfdnf2ohmTE8VcjEFApuLxAp0hZcu1MAHsiPIcV+FXLwoe5rSUq2Hq3I3nExwHGo4WVconigYQPFbYMIDtj6BRPF+qhfk8Ge4QJeFm6Tb7UfJJ37bQyqw5LjeizFr3Ub2xj5QO+oQ1gVV/kulAtecWrD8GrIKvwAXwW4MuAcJbK9pkmjLZfFGKH/nwwQfjnn0cpxotpMWYcjIloa5xvNq+/kpI/VWjw4An5fS8IXkvrDrtm9VBeG3yOMpyU+T4loPsVMI417EHRyiKeYGUSuf+da5KTtSgMmt7bExZV84XpN0B+e51U0ukckz+UvSFdSl6PyATB+HZBDiM0Qja8= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30eacf82-b138-4235-5955-08da50a0adfe X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:33:47.1557 (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: 66fMePz3JmxWsIEZlpfuzOK6ld8aHuDYxVmIzZANlvApXP9HPoDiRnVxH1g6fDZ9ja3M4weOtKw3g7GxKRb4pQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6438 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133358_892411_70B695CE X-CRM114-Status: GOOD ( 13.18 ) 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 --- .../net/ethernet/freescale/dpaa/dpaa_eth.c | 11 +++-- drivers/net/ethernet/freescale/fman/mac.c | 44 +++---------------- drivers/net/ethernet/freescale/fman/mac.h | 4 +- 3 files changed, 15 insertions(+), 44 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 45634579adb6..a548598b2e2d 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -288,9 +288,11 @@ static int dpaa_stop(struct net_device *net_dev) */ msleep(200); - err = mac_dev->stop(mac_dev); + if (mac_dev->phy_dev) + phy_stop(mac_dev->phy_dev); + err = mac_dev->disable(mac_dev->fman_mac); if (err < 0) - netif_err(priv, ifdown, net_dev, "mac_dev->stop() = %d\n", + netif_err(priv, ifdown, net_dev, "mac_dev->disable() = %d\n", err); for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { @@ -2942,11 +2944,12 @@ static int dpaa_open(struct net_device *net_dev) goto mac_start_failed; } - err = priv->mac_dev->start(mac_dev); + err = priv->mac_dev->enable(mac_dev->fman_mac); if (err < 0) { - netif_err(priv, ifup, net_dev, "mac_dev->start() = %d\n", err); + netif_err(priv, ifup, net_dev, "mac_dev->enable() = %d\n", err); goto mac_start_failed; } + phy_start(priv->mac_dev->phy_dev); netif_tx_start_all_queues(net_dev); diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index a8d521760ffc..6a4eaca83700 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -39,9 +39,6 @@ struct mac_priv_s { struct fixed_phy_status *fixed_link; u16 speed; u16 max_speed; - - int (*enable)(struct fman_mac *mac_dev); - int (*disable)(struct fman_mac *mac_dev); }; struct mac_address { @@ -241,29 +238,6 @@ static int memac_initialization(struct mac_device *mac_dev) return err; } -static int start(struct mac_device *mac_dev) -{ - int err; - struct phy_device *phy_dev = mac_dev->phy_dev; - struct mac_priv_s *priv = mac_dev->priv; - - err = priv->enable(mac_dev->fman_mac); - if (!err && phy_dev) - phy_start(phy_dev); - - return err; -} - -static int stop(struct mac_device *mac_dev) -{ - struct mac_priv_s *priv = mac_dev->priv; - - if (mac_dev->phy_dev) - phy_stop(mac_dev->phy_dev); - - return priv->disable(mac_dev->fman_mac); -} - static int set_multi(struct net_device *net_dev, struct mac_device *mac_dev) { struct mac_priv_s *priv; @@ -454,11 +428,9 @@ static void setup_dtsec(struct mac_device *mac_dev) mac_dev->set_allmulti = dtsec_set_allmulti; mac_dev->set_tstamp = dtsec_set_tstamp; mac_dev->set_multi = set_multi; - mac_dev->start = start; - mac_dev->stop = stop; mac_dev->adjust_link = adjust_link_dtsec; - mac_dev->priv->enable = dtsec_enable; - mac_dev->priv->disable = dtsec_disable; + mac_dev->enable = dtsec_enable; + mac_dev->disable = dtsec_disable; } static void setup_tgec(struct mac_device *mac_dev) @@ -474,11 +446,9 @@ static void setup_tgec(struct mac_device *mac_dev) mac_dev->set_allmulti = tgec_set_allmulti; mac_dev->set_tstamp = tgec_set_tstamp; mac_dev->set_multi = set_multi; - mac_dev->start = start; - mac_dev->stop = stop; mac_dev->adjust_link = adjust_link_void; - mac_dev->priv->enable = tgec_enable; - mac_dev->priv->disable = tgec_disable; + mac_dev->enable = tgec_enable; + mac_dev->disable = tgec_disable; } static void setup_memac(struct mac_device *mac_dev) @@ -494,11 +464,9 @@ static void setup_memac(struct mac_device *mac_dev) mac_dev->set_allmulti = memac_set_allmulti; mac_dev->set_tstamp = memac_set_tstamp; mac_dev->set_multi = set_multi; - mac_dev->start = start; - mac_dev->stop = stop; mac_dev->adjust_link = adjust_link_memac; - mac_dev->priv->enable = memac_enable; - mac_dev->priv->disable = memac_disable; + mac_dev->enable = memac_enable; + mac_dev->disable = memac_disable; } #define DTSEC_SUPPORTED \ diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index 909faf5fa2fe..95f67b4efb61 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -36,8 +36,8 @@ struct mac_device { bool allmulti; int (*init)(struct mac_device *mac_dev); - int (*start)(struct mac_device *mac_dev); - int (*stop)(struct mac_device *mac_dev); + int (*enable)(struct fman_mac *mac_dev); + int (*disable)(struct fman_mac *mac_dev); void (*adjust_link)(struct mac_device *mac_dev); int (*set_promisc)(struct fman_mac *mac_dev, bool enable); int (*change_addr)(struct fman_mac *mac_dev, const enet_addr_t *enet_addr); From patchwork Fri Jun 17 20:32: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: 12885995 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 854ADC43334 for ; Fri, 17 Jun 2022 20:37: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=o/RlIHpkZzWmHadY0JTHq+O8JQIx3tRZO3R8kmRqIBw=; b=zYLexOAkqAVYbc bFcv22AHgpP1ZBX/ejawSmsOW7XH2BxuDOOgJULOFBAJu3yWTdFgKdD67x9UnDj2kA63p51wGDtMc s9RPfDsXxmp9C5GsKAYqvLkvq+AL1KEbln5DPgSKrsAVRxI/1/+AABCjJqaZp9TguoNUgE+eDh8+R sqMLIAKb+ZHUj4BG2y+nWjawCNA+SrVS6WCVp2IlvJUC0p0Cct+8WkERhrEW7j6bX24XlpDqC8CYw IVIxMJFqDP8//iRQMQjKGoK435wlTL0xOTIvMU/uLZVl5xzJja6/l5evpyDSpTDtXNZsD8pKEowPq gYTkyUsB8Uoi4iEUzUQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IhO-008yG4-DV; Fri, 17 Jun 2022 20:36:11 +0000 Received: from mail-am6eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7e1b::610] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfJ-008xGJ-99 for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gys+u4X7JB507S/ObKAcz8pE+DMPgqVZkGRDMOoz/YJfGKZ7QbeGRftNd2cBJzdrEhtsSyuZtAlnsgTLG/6cmyibKHCgJ0XBuoBh6zCZSx4XnPHJmbgdKn5tSKLmPHQGKVsoYyKLWhF//uGcnzdqEVlAERF7Et4a6mtFD7hVGlOOTUFaUm4WHQjZSilennY8iJ+VlF7tpCthXMyUngZgXjq1zRheUJ48n+uDmQq2ZN2eEOJqYR1XGeYrt/oDWrZ14SqkSNBPHwieblulWn2NVBzzmWHTO+oPvMvmfB7mAmI8ROA0h1GSi4uNrqcKZPT98KxTjJ2xvbKRBOQNLvPc8A== 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=hpQJ4ZYc9LD38/iU7/XoCwrJL5wGfJ7+2R/WXjNobko=; b=W1y31/ZiOIG2FW9h/VuhMFAe3RnGFB0YQYg1d2wo3EClw9W2xecz8mUsbGvQeYhHembz/BqDrz/rWDSk+Uur11BbMyKgVwDd+Z8kjrAayrbqGSrS8hK9mewLOgi0wx6H12AUR+ZKd79EmQMnUljWI23fTMLPmNZhZ2Qxrzj1HXHu3LyzK39Cn/7DhvxMqeax9h5tkFainbsJCKdtDeuTpsvJbYAE3+fEJnt/yPGr55gCusiPrR5kuVRsohqZaaFuBcBt71Mu/KyaiXgi/NjFUv1LTmCmMGii0M3o9k/2J/VEwqxwyJmwhqK3MSoeF/QAIv41kDqHIwIpkx5nFqycZg== 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=hpQJ4ZYc9LD38/iU7/XoCwrJL5wGfJ7+2R/WXjNobko=; b=pFk69KEh/tVvWqew1vIp0NzZvHdVhYGu1hnmmIgKZ91nQJC6RROZHjrlt+9TBf5qQMAuazG8jykEWUCyMXFm6gZ+RuQbv+QT7FokQ98H0CKhEXsRwsZHzIltZPGY7ZIQ65Atf8kJqJVSTFuhTvQfAbf1ogtpf9IuQPHTqNXPu4z42oXLclnpnDjCzjmmptHTNPOPi3s0/rW4HolDT4mC6V5Vncg69yJkPuilyMPNt/skpJnONFKL+OPOrszOqu1DB1STZhO/4sQ1EhzKA8OsiezWJ1R/5q6SqpTvQxJF6e9R8NdsRCGWIO2nPpTNMyQFyCFNG3a75lfyZlFK451j3A== 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 DBAPR03MB6438.eurprd03.prod.outlook.com (2603:10a6:10:19f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:33:49 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:33:49 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson , Camelia Groza Subject: [PATCH net-next 07/28] net: fman: dtsec: Always gracefully stop/start Date: Fri, 17 Jun 2022 16:32:51 -0400 Message-Id: <20220617203312.3799646-8-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3f542c0f-e793-4435-5ba5-08da50a0af28 X-MS-TrafficTypeDiagnostic: DBAPR03MB6438:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bl3bxvlb2PwFie6uOQ2qy3dKMqA+lOUZhs60m0OPybOXvrML0hnMfaO92Czx7BVEB5ntHGbUoBce4xjlY6BARu/kKc7D9qHY7lf+qMVsLnOHnV+FuOmcn4YKdaLLwy+d+YkNHyIitfkwSz8g3wwkXrHx4eIv8W+UQtRmmY0MUVW7ilBvif67koiyCVIAoUM9SH38nav8xl8zVmUISdftenecjnT/n5sx9UyDRpsVYKhiaN60I4Rh+dpqsJlalpj/RiyCqYM64sjVd+OwL3HyNh+KwAkz6v+8qt2KpLF88HpEMVK7/vx3GYZUUoNcJP7jw4mJiFIHb/l8hA9bel0T9gZYbsZSmfo0FMFRChPXJbfUB1yCZZXwegbTrAyHEfT62iGL7pvRlSoKXsY1DHbbrm5xgBRaDahJjGnzbueBIvhi32WuJE2kDenxxPo62ottDBaB0F6F1syH6w5NSGAhF0o3LIUCqmdwjc+aFmvOIiadiugDzk4kHyiAIrZqXxiyTKAahiXKCvVSps5IDk5zoDOZHzgDGw4MlzQpyR3VG7Pq5R5zNLbifUEL9iqSISxq/EZ+MhsIysKughFqo1RGjKMtVwXJUumuAabiEmMF182DILcuozdVIVAv+SLbfykJw/Rq6prKpv5ksJN1dt19/DGviwiK0NzFDbaOxiKdQDWsBmo0yJCFvT8oK/atH1bR4koh27LMW31hahnvSMLjmA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(38350700002)(86362001)(7416002)(38100700002)(186003)(2616005)(5660300002)(6512007)(6486002)(52116002)(2906002)(6506007)(110136005)(8936002)(54906003)(498600001)(316002)(1076003)(66946007)(6666004)(36756003)(8676002)(26005)(83380400001)(4326008)(66556008)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Rdk2OISv+1TvMbnjRzM84xHnd6XDjAZXOBvR4QXRX8CpK1vuiLWvfEG2dsZqsNyOJjO55wDCpBJ7inMTIdvMI7VGD4truwt2Z0LUQ3pcIsBT9m98M9mV/21xgbPpnuylXroxy8XFm42bD9g3+7/OsWFD8LY614TXmJU59LyE/bDB1rXZssq+Omah2wO847OCH7Aj3yl8Z1ePzuvk8icg/ECSkqy2cTat0wXsHcERmmW226kM1OEOIW6nE7dUAVhztuEtSfHURFheNNCAPcsxCXWhVXz2WmPEDj5Q+qDfBqtsIa23KSSDOsDLfwowxfu1ONnDxZOI89kneYV0Icp3Ysl/CXumQnLRQEUDvOg1LHIo4etBMRvKb/oZTNc/zeXQxVnXYHCX42AC8M/bm1XlNjcxGJex6ZelE90gPF7yidS8rMHYnfHBhLG7mMSs+3JEjVcVFCUoK9ZUck+CzWPkN2/WMBAn+sip9bD0Q2Uktvfq/HLi4w5fsf0HNBx07lotWcKN4ftU1w4Q3qWGd5lT/zjGtJYw0CzYfk8Fc0lCjoNwToTFuuTjby6ZmXKRjumHlbOGglAvCCYXYJ/f47Ps1SigNmmbOQQFfBeaJ+bP7uGp2lhojkVy0RNxBDJx0b38xippr8TWtbGAKXpUMExDXBVZb/+0TfXUjytKh/mTMw/DnAoECta6YFd9oKBV9yCpxD4ybht1P2dXiFrfNOWxgiSpaw7cFganZ65kvqWKcnsNo4w6r48VYbLVhLLSX/v8OOrOcrORcxpoFkW7LL7RXKz7Ke+VNzXXCmNfB9/29qfOHr+h40E2VlnuWgAq3KnzpwN+sep53r9p6LutweSlu/ZyZf+RlQRhTH/NgAS+B+W/Zpc9iw26A/+RmwrBVRQRBXoQXdwR4aKPxeTsQEpnMO30NRcgIB3os9MjqAU7AkfbBm/2U2TH0y1n067NHi0dHX3D0+thdpJktrTZB7VGkfcjsLlpAz/18CEK9L6mPJH0uXokPYGw2CkUrHXwWKzF808pZBlPW6ZkK3A0EvGZzDc3dgVIosKX2vpa6f3kI1xISZwPLqA+PjAa854k2miAgd6MWa/uf1O09rsnZwFS9v9nc0BA30w1C1W7s6mUefWOEIaxZ9pfPWJx4hrlSA5IE8HxNgoHtS7/ut+QJSRrNzQwJNY1igD/4rGscDNXrcgyqeTIdGNnAEeUUcCJsBv8DXaubc0I0ZI6mXawP6y5h4HZKizlMZx4dKtSCt8uwQ7MSQQlUOvVIAEKkT7EypHC7inr6gIZPRtb4Ux0HQSXNUEUCQVjcxU1+FF8CW/Bu/a92rv+1bUzqQRy6nDbM9NfyoFVmqiGGVsf4B+UEnCLR6fA9T3PgoIaPBNdjBVSIc358BNh63OJlKJ4R2BrFdiFl1c92QYtBjczOOk/rnJXr9EznxlB9IRGuZIMvCCu1T4jJGVd4iwbE4gOUMzT8Ic+2lmGYK0sTLM5TSqByEOVHbnjQs7yw4ft31BMI05xowXybTPWlhccK7A93XnMWqfUOwFqYoM0ZhjLs/7keup85wDXb/D4XN23bKhe9gQiSLViEE1gIvTI/nx69lHIePhmLmUeOAmQniNXgE29sZZWarvlGnlhppw07daSQ5qLuZEypz9eIggbSqSM9tHKRzzt8RilGVXN7krXSRdMNYaRRFBrvRw4tjilq4RTXaQk9Nq9lQMdIxByX+gBtUDfOqRMtHGHxvMoHtk9GYWnu2cL7wYAXyXTVHWznJ/iejxhhqM= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f542c0f-e793-4435-5ba5-08da50a0af28 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:33:49.2337 (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: a7H0nlxBjJ+IEB9M7cnUc6CTG28E39EU3C8zqDSVvUbXNGXHI9TLtTGzxdGZAh+yIR5oIy7pnLFrcXEiUiAHVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6438 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133401_519753_31ECE060 X-CRM114-Status: GOOD ( 17.43 ) 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 .../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 Jun 17 20:32: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: 12886005 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 8B029C43334 for ; Fri, 17 Jun 2022 20:38: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=1Q2hOzuprQkEGJ63Cv/O65fZ9UM0UPlDfb6JZLEY8Jk=; b=lkg9XxuyYxo+SF LkCFyU17G0lz8gEKS2V83VFhs8BrsyVJZApi+s+O+z3RyO6L+C5g29CXhlBJPdhzBnZ5ymyojggQV /2Ru7yQ8N2CBaOpzRhLmRCgGNdWS+aiUJKm5cUtgmGdJAFHza1Ac5d844HgVm5o+Jib6B14mMinG7 gGIfnMLlGb3VjJ2OrwQDOBJtHU1w834V4WIeU2D/GppgJZp8s+wnGHpih72rDGyc3Hm1cuep0wRIn Fikn4YRIX/DvugJmDbk8EubzIfazLXoNVVz1hg++41bYtgTwriSieywj7rPrDjeEWQSaFSoHVioqL knpPuDzkpbajb91P1dmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Iie-008yn8-7c; Fri, 17 Jun 2022 20:37:28 +0000 Received: from mail-am6eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7e1b::610] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfM-008xGJ-3E for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n2KNiFBS9SQ7Jyf33GTWDOOwekmUM2rFt0nUPOMssDmIIliybH47dFbjw1LPN5LQ6psFFbZ7/rlp+Bobgno5Y1N9qFqG+xac45l4j4oXpSPwbdXUeM54B5f7vjGZ7JoVFV56ZHD0JUXxralVl7+mDBSejQoYwiATxMK9/wkAjcsYrW2nuMRitAQrTyxH8xuiMHKfjLCAsYb7kcyD0/XWRbBZR8ttP0eoORDojQCr6Q6IX3Y65IRBJx4X8F7r8lBuuz9kwfEfLNE6+Qt6MedjFu6g6+mLasW0BJGqsLtMYLoupycl7gVaYhSTCUU4Vs7xdQ1BiYl2A/9BTCGEux4ZKg== 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=rGPoE0ZuRIWNg0pvFE6/rEZ/y8FkBn8rniXNIJMzabI=; b=C9EhyqiKy9F88O4XwcBD5Ck9kzIHm1rL+JAMZ/we5dpF/XEOCXJv3GU7bOZFmOtzE79Dcd1YHPE8NBQkismXVs1x6cE+lfFexOGOiECp+Ghr7j56ohxlVvZvQZXqYkPISw5CK8by4epoGTq4ivS/09D685z618brBoRlnMV9o7TjX922ylpH+Ht8BupWpcZydf/gMpLCreudy5QyoLO/J05K3kQmL4gvQGsGKK2VuxnZY3jMnXOGBUyn9EfEfwvMgiQlZtOGw/q1QEIOPyLF4s+HamhwhHCqxiEautFBcjsSjpn5oB52ulcnLq++IsgXBnZ280wfKoNz6XmRKj3XlA== 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=rGPoE0ZuRIWNg0pvFE6/rEZ/y8FkBn8rniXNIJMzabI=; b=mL27pm4W0A/GAfdSHYVzUAcAp50q6tt2ntePC2KKe+Sok3epG0kPJsvT3rQwEC9r5Jh8FYhsiJsQwV8wFugHev07V4dvT5yBW/lrKbQc8FQSkFXqLkCvvH3d7+SIdFmZ4h/xF/TRv5PX3kqBpJ6fpSfencWT8OehbD9sXZ/r/YrDD+XO3W3rd0wxqpBGtNvJ/mE+a8CVkdmjQN+NiYOKW2CgU8mdjbF9KjSXZqpYXWwSP3jU6Sik7Yohs4AhSiuwA8pvYlMqd/DEdvJt544ZIzXMYpeG62B59MIjTdbLfJWkXDEvpzI7FLAoBhS/AFHD0mTZUkZYZ4rOpsewz8xa9w== 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 DBAPR03MB6438.eurprd03.prod.outlook.com (2603:10a6:10:19f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:33:51 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:33:51 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 08/28] net: fman: Get PCS node in per-mac init Date: Fri, 17 Jun 2022 16:32:52 -0400 Message-Id: <20220617203312.3799646-9-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: db14e03c-669b-477e-2278-08da50a0b057 X-MS-TrafficTypeDiagnostic: DBAPR03MB6438:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3dFYbxIm9uIvcnam1vIMkJfLs9T1tPbYSU3LQUuLe5yowO8WTt1g2zAldK4Z2AKe4GoWCJtwAXseU+HxPV61auh/VgccLuQ0I2fQ3QCAtGzLYL/QyJ6cYNfB5my/GMlB69XeO00WREHToIuremBXApzElI/SeYfZMHQzZjOxjNVs2fNc1yb+T2sn1hsKVNr+pqm9DnZyirfUNW93D0v8mLDWT1XGT1sjdm3bj52bjRlHNXeoq3Z4Hb1/btPnjkX0GOxnnfZ4JkreRmlEqghydELFb6xZWEpcM1GiA0TyC3NSMPIg79KBLpjJsqH/yKEebaPRsBY6YwQ9qBOnHwEIEwx/aZqFl092NlJgyjnPTgI+JOkwsMqIs21ofFNEoNTCMQc1xdfPU6jTJdZBcjfLoH9EH/38rXgYarW3lX7OoWZRduSqC9Q0x9hOe4GZlkjDPKA9uFOUT6gNpTz3cwaWO3IvkPriGhoC1AJnx39LzrDHKlzVLTS/qJHg6QQQ6RW6wt3ExGW/K8YLIJ+QE3yds3BbcoIThyUr+cFYJw01IomSE36G991wPL1o1BJZR1v5oiXs5ElShVPG3qUCUXYS3+H3ENpAT1j+xfe1KxNgJOhk5vB1mtX2KDVf/rJZvOe7pcIhz0kS9xnnx+iVcbgpxEU7wakbKYcgvUAoNv7DQwJczaju9MYiD30k1l9QfuZqhRo/haprtfaVXYvNN3wbSQ== 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)(54906003)(498600001)(8936002)(110136005)(6486002)(52116002)(2906002)(6506007)(4326008)(26005)(83380400001)(66476007)(66556008)(8676002)(316002)(1076003)(36756003)(66946007)(38100700002)(107886003)(38350700002)(44832011)(86362001)(2616005)(5660300002)(6512007)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rtjqX6JrV5dtBhEOYkrzR/15AIL8ByKOQ2WZ3cdu+JJrTA+wALd6lv1+Fp7a/eWAVF2l2FtVpWNwr2Ah92caA2xpgpdpL38ENHL46GXQ4XLCZt2pPvbh8aFZ7odDfAlQvyMR7DHZILHQyQaw7QjDvI+uZdRnsSR1Efa9oo/w17f/D+mDBn0r9raB8q1qcHOtd/mjrx30bZ92ni3ILSKKccYabPNNtOdSZo5NKVVrsda4JOPKVLFCOExpalWqrf2J59QoqCJFQq3hyGPXYzuhrsLvDwnJ/1VgSfdvU+0lw0sz8OklLpHWFIhocOi2p27WPo+ywRTQXREoVhMWMcnVTEeuMpgZmD82Wusl46xIGI3o/OYMICRJwHp8rOaQaHSC0shtVX6t2IKl0f8ipq9CCWEh7AwnvVf+hqgMgPzZhhkJcldrhpPttB+Ncbjyu8VB5wdj0wLeL1GawlImm3npgMKVBlY9J/cyz9lr2vSxyySd2bwj3kVWiLS0ZtV8U8HIJZ/KIL9V6pr62cROIhHCaUT8YDBKJgsa7qZA2MeEzCYeZA++mnfooM7PAE+mANIdDtpN8gkfuQvnKAO5xvfYCfwChqyr/UkQ1o5bPXl/qse7vbuR7Jl+jhux53v51j0Jc6eyh/N5xHhxUkXgIiF0VQCQsVs3lRSC+wt0hvJbB77kB+hsRd3zKUPLGrvoW4mMtuWNgQZvokmuiKEwEr7pJA3EW9Bf8Cr5ptEYTSgQ7jBw+MCbLks5jFEOMND4Ca/nFor9UXcBzDj0q+nAe/ywyG7epiOt2f36DaNayAcJfaQPSNbM1b8F2rTUDXQ9m/bb4mPOtr7mxxdC70UK/VPysJYO2WqO8fbV0bFcRKA1y3TqZ51TdIQMGOOhLcrZ1Oi1lFdYIAwOy79Xy+x2qJk0yxU1/NDB+pjnu6iOfUwOMa8prjdpt6usj5UTEEIQ94dlso24pCRENyeCWqeawOhg5dai5AjNCiA8+yuLbIw9oQEea+sPEtKKKLErk86cR1BYzI6hgXRyW3/6VCiiBfKFHBq7n8+L7ApaODs9WJeN40c+pzKAZOF8w/lW26/NaduHorXyW+cW6MVRD1DcJmtsL0wRZ9RzBjd6q8ONhZaCQ7Vds71M4BJuKT1DWgrfTK/W0OZSrh2EPRTzmeH7qacydbqcbQ50PpH7gQs9eiWc4lRnPy/ozgS6RSXk5FfHrCBfDAqa7ekncV0mjd0RNVHeMl271KZjJH/lOfbKRX9aEF+oRZV44pypT4Ouiw495/EW/DlYRD7CJhIzQCMqyH/h4JrSgVjnR1EoL5GQ0fDxMgIMqP5uN6meRJvJhOy1/0vVbh42VcPI2vj+ce1Zr/o7xTrTS//AbfLlclxF9sKNAL+P1ZBUwH6sCE+SUv/xborkf+2yKZcUkHWZo1ADpT/YwP0KM1sMO1qn+csLgQAWJAo+z2LMtLllucdBYIR/vKNQ9i7KjQ6phc7LlTHQfiuEt+8K/g+rn8hWMj64uRE6izhJTqpq7AgAWCdVf4WkgwCllElAuuHGYvo8HFefL9VD5Xf3GQ3uGwBIWqBvOmHdzoTIgnTnKyT4WqZWZDF7emtdek6vM/QCWvv//klBi5tgV8/iaJlVKJPZYL9GWASb1Ar2tvl1I3rGMJip49wsGqWCh8vV4g3VzGuL/2QB+xerA65QltmjLs8/uKJieihdqG+IcxUa/07nh0ileDel0+rTuO5h/ORXaNnIGlDqCrnszGkF//Mj5sEBvFOm95+BQqs= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: db14e03c-669b-477e-2278-08da50a0b057 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:33:51.1398 (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: OUUQMJOE9ZM9BhU00PLt7VnulgQnOMsX912rfOdlfHgFvtK9HruphK/a7rWE+v+v0oD4g6ohTCJVtMQlCvzAbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6438 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133404_259470_D8D1CFC7 X-CRM114-Status: GOOD ( 13.53 ) 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 --- 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 Jun 17 20:32: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: 12886008 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 1A8D1C433EF for ; Fri, 17 Jun 2022 20:40: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=4zx5tLYnq7nq+fy7BIPadGrw61W8YgNa5vo1lx9r3Vk=; b=qHz3L9mlB2cbif 6JMirjDf4Ok0yQ3o7RmekwRxoNxoGByfucGcKfua2x/vXH1y1Vro32oWKpPUskspV9P2o05qqywc2 FGXkKK/HtlG+AdDdsAVmEU9NM9FzoAzmq1mVJ9Bfwoycn7coLK9hFVdPtD0jvEM7GR6H0DbzbZkHW MRIV5llvlqWyh2HlHpXTmmcrocRPdBdlybL+Mpt5lB6ExE1hfhcoa7M2VvRUivBgYOxsDVLUrpIKI RfAnWaBlu71dogcYHCYgyfH2uyYO777hkBmghtwjJrHfYZDcRiYgNRWuNrJBtTCcqXKee5jLiEsRy DHm8U1Bp7OP++jLr8XaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IkL-008zSB-SZ; Fri, 17 Jun 2022 20:39:14 +0000 Received: from mail-am6eur05on2061c.outbound.protection.outlook.com ([2a01:111:f400:7e1b::61c] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfM-008xKA-KB for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tf3CT2LnzQXLFx+jJMmCP58GtrLUYGxYX3zATrYEX1sGHPDn0WFyjYQbUYobBEDDIbbGOxkeOowYAlrdVdDd4LCvm63ommpv2SUmqy7UCiDetH5lh+FVh8gT194evfR+qMVAKnzeSBIhn5n+N8H0bDHxwFYBwLZRIyoHWbARK4HjDOKwv8naS466bIlnznqfuhYTu6EfrUAwuoN/VBYblwUhAcDVhB9UPD7cxeuewlIjr0fs4q0CYoVwu3DaWTAUpBwbZul7i+0hbJb3B8+OqNdcPpBUvCwMqr99A7+GRu4ySFzbkpm4PCcjTDcmm8mFVIkzPPr/AVM3MWWr1PnV0w== 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=d+y16VQC1oW/rdss5dl3TAPZohiMfyoZswy9Xv/m09Q=; b=Cwb41M+tce6FoQ34OR+Ni588l1lKs+g16pVmmWV03M4HWbuVoyB+t5pOPQ6bRr0mipAbIm5iFTtXpeM/NMwIruyx/DPDgis4+64w9NB+iGD6F3i4dbbS7GiqGUf0Vmnc+S4c0qSc9q6w8zFMW97qEPIbkn9Q7JAOh1em1SIrfLp1kgsPEX64LChGll8BJI1egLdxPFaMVMA5omVqu6Jzim7MQZF7mGI4mJmhvkxZFmq/0S5lKxvlYbnbjRCS4+BxWJ629FVPBNRcxK6I/6XFzv7Vx2fDmYrRczSjgfbFhtU7ZmANVpWJ3h3UpNnj/Tsf5dKSW11DClTbXOFH4trnXg== 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=d+y16VQC1oW/rdss5dl3TAPZohiMfyoZswy9Xv/m09Q=; b=le+aPe0CG0/xF3atici8ab+hPFKTjTCqd+3sOwOxV8cMhtRWj9dcS+xMd3uV36Vrd91qthNM19mA0h8UN3jLVwI2WyIiEPavip6gGGT5uIqpS6n5YJbHAd8/hebyEqGxPPsxfiH0y1HH05EBC6+Q1pW/3tDxzvEUxxMwTSFF76jp9HOMnwx6fiNLJy68DMy8ckI2B35nRDcl03ankd1vHDxQ8YuxCUwDQRjYXKY7l2zBbUFQJs53EC/s7cLjESq9a9OcMwXoxGA/bMTL9AcQuYcL/1X8PTl1wmVGbf1h6DBGZy71io0mfTitv733gyasrX8HaR2Bumj7uFV9AdDPow== 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 DBAPR03MB6438.eurprd03.prod.outlook.com (2603:10a6:10:19f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:33:53 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:33:53 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 09/28] net: fman: Store initialization function in match data Date: Fri, 17 Jun 2022 16:32:53 -0400 Message-Id: <20220617203312.3799646-10-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b0906e91-5fcd-447b-1231-08da50a0b16e X-MS-TrafficTypeDiagnostic: DBAPR03MB6438:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZpuNVrQMROfBBfdlzypehIFXxx3lH1CVdStaxPCjtGvSWZAZ516rnj0Rtop9tYPf9aoEE1jGEqTtpglszOrUbUGsR6SYwDmC3yJ7JN04cr/I03w9VpeRCzdZaNem9t516Trq9ekyHsJr9xmUBNmcrPzjrW4/pBiPPUWXFmf65tzxpNyJC7Aq7ob3AdvG1RcRnN+0tY9Nc74bwKnih9ep9fR0Sw4+TMQsovj7tc4iGYK+BYjG2A5STCfJ/Jr5a0f+G7Tnj6U5wt/sFhP3j61U9zpUYLQmXeUHgH+kolsW2zoTg0TarqyR8S+YZ02+zsY2Rmbqbxlz2arFcMBGE71yA0VnBGWjxEdlu/F1qdjKCvzDk4L4irJQckIht3CfXVW/vil07sLCdPnTm7BpIM6RV5lcCqmoA20kyfh0wZhpoACxxpx4mnSWrRs9MRLPAwj6b0FLmqTYTl4MyMuwT3K7BbMSI6+Fry3PmdKnYPePAjde+nFK0irjjgg4u0RLg+/apL+46M3JCTY0lP3+ASwgrSVvQMOhvbIB5MDFIXPHfe4WSYVQkCqPhrKbwGkKgutguOsRtvlDVnb4VnI6/f17hg4uMx/aYIM+sLb8NV7P0PfF/C0ZI8kQh6JzwNjUX1YwpB7BjDjLPSjNSHJ7k5EjuubSPLKtY+os55/iR7ZYvXLLJYzQ42hpXBJ7MCpLDMp4kcbSTtxRpKhFQgFdjtZtlQ== 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)(54906003)(498600001)(8936002)(110136005)(6486002)(52116002)(2906002)(6506007)(4326008)(26005)(83380400001)(66476007)(66556008)(8676002)(316002)(1076003)(36756003)(30864003)(66946007)(38100700002)(107886003)(38350700002)(44832011)(86362001)(2616005)(5660300002)(6512007)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zxP/GWQSLPsNt/WIxXJ6KU0DZXKSkOj3Izyk1NeEb7Kq49dWEnM/CqT2XJLVP2236AMxnhIE3lRvna1fLyYwFW/bmnpbaJLQFV3Hdzr63UZV0CNA0+87FngPRId2bKeQhFsGVTni6TMkynrAoftVqhhUjMHGuggfeog2YeoYtwEtCZgujjpbQWfj9HKNIz2LzMCOaxH+VND/ORjMx/FB+Bl6WO+3e/PlWzVmhB8/Pw5pQegILxeEN7H0G2CVtXgmic2n29ANaGHUCOAiutJYHlJgk/qhJqDS/gFf1QCvfL2/c3e87gaTBYiW/9+WgUr6d9MZVLDZdz5I/frUIXsDTX1/1lh1R7CSniYe8VXQkYN71KtD/OGl0rx6btknbF74pFrNxQDZ+S7AVx7XiFi+mMS4riiO26iUkqB2YG+PvlvoTxWFdrv0XGYSxx1I04nDy7pY1qzko8gzNiQTDt7t/Jf+8D4dBexjJOlBi1XTJwSXwKVrJ+Q7ICrSAS1GPnu9gaL15YupdC3X2N1CHnyXEmmeXa0sKLfYoD0ypVUoJSxxnNSD3yjJbD0Pyhl7DVMW34PkFGjCho8Hb2BifCTV+tsWoHnSjrJZmVB1lxMNVGNNDUi1xhWTbVCAfqhOh3trnSaQ9ycPBKOoR8DtNiwrjZ7mYcCAgktvuWGp3qBJwyCfB5YQ5skYiXVHdfIV2V7aRpuiE4B2eSc8W9Vj3mWGpLgqr/TDWW4ONCh6VvurRXkDLHB1i+9o7Fxar5bWO77LX0J4n59Mmj4VM6Fc+KvG4Uf7cTq+qfxlEAgGi7qZVNhNcbnPnjgRug2jAcLDdP3OIhfAE16+rR5qDWh/lJ2IoF8ch+WmBFlqJqOsxtiNNkz9l7yxbCTNCdkDmelSc9zeS3QtfsCpnDtWXinc6PEFP6rvc/4aw3srta1BM2unG4i1r3qb4cVExUYw2PDuRdSf7+oId04SdiwyU75hoVlBPq5GRcLoxREkd+JAdapr+wIgcnYKjAHym/zPLpHPV+QSJT21P4NsxkinHNFAKAbRp1uM6HOJCo1zIZlfX2hOLX+46T6TIUvV6v45v1IQnhxNeJTFdEsGPhxiVyDWlFblJyFRHeQKpya3STdFABf/s+XZDA5oJAt8tj2NG+mR+frKeFWk+QEIBp5JuzbBQ82ldVqWFlyEJx0ytAknq3Im5PGIMzg969lTSFidOg72fkAIl+B4eQX129tPMPEnaPuqTrn44B9rxqqC1NiQK0ExHIkGCjxuCwvV4MXAst5aoIUnCWtLczmr0S8hYYuXOdOpPC/IXBH94h2hNEVZ17IoGeYXLkFQLFz1SHasRmzhKcQSNvggZ5+E9lCbYCRw9ACxiQp+s59JnUZnnm+aeTkuCNQz3ryGvwDgG78++Ys65wqcBHSss1iG6V4nlUGvMRAoRkFgljATNG5aK+Z4eKdIQtgqGmCinxWyAqJ2L8Zie67mK3gKK780/7H3drlcJ1ZMILDFvC/6QcYIEluLd5mBqEtM6lAXx4t9L8ceSo2aWip0mULYZD4PtzGOQx2fOU5vMZvJTBdjDUzwivbMSVO1/5zDQkVky6YlAASzVaMPzVajC4xzf4Vi4038MFSLqhDB4pydlSsVuofo6QOb63Nu9klzqxIez6+5vHpgXSTMHaxYcJlecPaV59CvDHqLgRJdqCr0le0fycuxCSySTtwWAmeD99DAAWhiLfGI/Z5aqfdNwWBG2+qdnDrMAPCHaCLqbQOfu85BO+W2onT2OgINgzg= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0906e91-5fcd-447b-1231-08da50a0b16e X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:33:53.0460 (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: ihEAMcUx5FeVfqdWP9TrIZHyCTegKGisKc17ZKCkEb41f7e7mRWSEjzNvsLXVhoLgIQqohSEVdZrx/B/rtim6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6438 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133404_735535_1C3599C6 X-CRM114-Status: GOOD ( 13.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 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 --- 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 Jun 17 20:32: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: 12886007 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 20CB8C433EF for ; Fri, 17 Jun 2022 20:39: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=zgbBHxMRnduPjBzeyHFwghLm5HJO72DX0I0dsmLOcDg=; b=1G3fdSPVK+34Ca f3GwfQDwnRPJFiMT/ONVowy1YRxvRleqBUVapGySN6lC+I7oeX35Vw5AsoI5uS1NLfUv58OV3XoJ6 p/InpNhXavitguYDq9MxPSel0tzbecbV/Y96tFWjJJmvgybmUo9/6RCFyNvRqwNhBgK7GYXn79WSf mAKYKvhaKyKhxkYqX38L8U2Kbbf+/k+Lyw9lOpuEB7DsFN7T4xUyynazem/+PcQqz85ZpO0VOySW2 kzsUEVxxosWOcHRLEMqxMChjx/aGJGJR+b8wqpMgq6iNgD+vY3G4FTJ03YNmK501EMwP5A7CEBxBE L17Y8i/EHd1GTUD9fU1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ijj-008zBa-SL; Fri, 17 Jun 2022 20:38:36 +0000 Received: from mail-am6eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7e1b::610] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfO-008xGJ-6T for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LN7zDv+9YKIYxbDmQz0cQOugMCLDYNixtUv18TA9GUFlWX2cRLcaWAYfm3NSvnEFQihWtje7Bb2Z9gbhsVu20lb2Hr0AO59nVRGVpNlSViYcDIYJjFqTkTxSRjQp7aRo2NaBngWGwkFeiSRGh1W58XVBWE7UZLivudXLGoJUkc4MNsa+vlDnW/RUBJEqIHkVzwxakAwze7dX8iuxHU6cO72Q/BJqvc4y53i7PeM3iI9xEYqUmVI3aK2glsWdjNrO7wHpiA+MlNPQc4KxgTaRSD+Agthy1I4cK3wbaE8Ee6+FPCLLmXrjNEMswgPx71gHPsLBgFNmubp/PWlWOZqIUg== 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=SmNK+rIDleChWzdQJwY9c2TwGYnNr7tRlJcgC6moeL4=; b=PDAbDJgG2pKP0g+OSZ3CoxWNp1daNq8gDi9Ya4vZ/aN0KeXYZCRsIy5YFdfCnaZxcDZf8Knxcy1ielEA4qt3wR5dD2tgV0Qu18PhZuUK6qplGl2QsTHjv09Jr2Icl0Owa5kVZ/vimE35hbBCctnpRUpbZFMR4Z37bPDbBk1eNxpvUzgUziEKc3MtXUCyS1yazFOIWsZ6Ml+ikSoid/WhxA216k6X9p67enoug6l2nMBu44Rv6s96Tf8WZ4ost/q/3cIkuqtp1iR07PEDLclGsyUynPX68vF7F4Vmv0W011u4XOi1MX+BquNu9e303oOuTh1VY/VMh3vYCdJbbNx5Zg== 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=SmNK+rIDleChWzdQJwY9c2TwGYnNr7tRlJcgC6moeL4=; b=uXc9rnE76/DuZsiXYMPj9eTkHi4P3+RhAarB0+tqyz7CYvkIp6vrjEOr37f8fR7aQGxh37X0ZbNHEQB55yA6W/sx2rVFqgIz4TuFOkjZXFKF5vKqyXuSGgQz2B3zhg5RFcumMJ72PDGjfpYr4EX8AmGe1WYDwqM/SddDFhJ7A91KnmE1pUggBCs0dXRxt7sVyVrX2y0X7eNiZnkloXiObetr+VoRC2kKwtU/IRcT8YLQLAvFTLtUG8nIL4PcQRQIIKfO93Px7HEO4i2ltsSbpJ5C0mDjAM4ytmgNOrOR2GUJOU0k6rUytJZN8G7J4fat+XNa4zooGmpw8wBpLakqEg== 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 DBAPR03MB6438.eurprd03.prod.outlook.com (2603:10a6:10:19f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:33:55 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:33:55 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 10/28] net: fman: Move struct dev to mac_device Date: Fri, 17 Jun 2022 16:32:54 -0400 Message-Id: <20220617203312.3799646-11-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 233221ad-ee1e-4391-b208-08da50a0b295 X-MS-TrafficTypeDiagnostic: DBAPR03MB6438:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6B3PqJQ4l3kZPipk0hQNE/KTatLpT5jrFso1yqOiAaskTX1yT/RRMWLGfqvzIeOvGDMhxAfl5TYqgFkQV/BeImJr5KWCo08HLRSd61gq2ZFqWA2s9wCLZExM5UwXl+MpKkUtuDCR0EmUMH83lgxAVf+JKBRNAs5Logzyy7qP6nmNQbZn0tIxZZcYV+GetwT7kURIyWEftAFWV6gjdst+E6avAgbrLp6KvOrEeukv9V4EO8yf08a7shHSQQWEzyi5Giw1Hl6T92tDYD9CYB8gr1/jPEflDjdI5IMBxmF8dOjnxpN7LT2mn7Eapqd7Az8HKD/rr7S0W6r4u3fYhM/ecBtt/8dVLCFI2ebCcU9V5JBzAuGwfzaFupjpF2fuIZrAsGVLz6gjRHwHH0fPewAUwXJft8FAEM1UqIKSIfUymETjWsJiyNc7nj+AqO4GcsXC61Cp9DlFAp9JH2aQ2jb0EFA0AdTwFvvtVi3/CNluzeMSFkJnrHEUpWIdT3LwW8QeHR9Od7zndLz/Br0+bHmXAXquxEb26qzfsjW+MZI+ddvL6ly4FjRy/99hnf4g4ifNV1NHdH0a46rhfzRm6U0Fy+4Ry8EFw5J2/iMxjD5kyn6KnYGrTNJSXG3nkP/NAmZ6HKrw+tJPEuDGkVOeGMBfmK9UBAxwblDDwh6fUEGjNh7YmWyedBtC4b0tc9H53Xbdf+rqDvbbkzsisr4ozcvhlQ== 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)(54906003)(498600001)(8936002)(110136005)(6486002)(52116002)(2906002)(6506007)(4326008)(26005)(83380400001)(66476007)(66556008)(8676002)(316002)(1076003)(36756003)(66946007)(38100700002)(107886003)(38350700002)(44832011)(86362001)(2616005)(5660300002)(6512007)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jVCPeyZHky994pYPtoxf+WC4+8kIZG0uLI0XvM5wkBRxZlXFnJxZnfn8rUFU/JUQP2CY4xAyLIMg02zv1BUlGDixrFcuCcpB9d1NmpPpYvUFmVSPEySOvuGcAfNmAmLpYKL/9N0nmbFySY/B7+TS1DdmahK5x4jop/M4gM2tlkWoYV7SB9ECYhlQZnEhj3kYUHExhe6wiymbYtiu9mBmzOWP8fxg6nCyKJhaTS1m5x2r27qPPk8RRZ7RXnxSEdyS7PbgqsEvaVFWYlvX8oUVcjlu1R9/jVvX8LrsFJV0Wo0DB87d/1slJDGyFh+qGZoPa+iPK3k8KmW8t9HeFpPnU+tQ/78l7bUMj+nbNyS0aWxL1MD/FTXxGwNQFk/BHQG71G+nvevA06gScd0AEla9OMcphqn3N2JKQL5oxFdoXcoD6G15KPFFmyMV9STn4kQzpyftaygCmVcghAqca1iub7l3E2OQj+ioQ3DK/9n5mmCITp5HcRpcOGHnMirrFZNKqFKtJWnJzX1kcSfjybpQthCevYZm636LdKEw95D+EBIyDwNbgXO07qVTQJxOD9/xcXlMyujqpYx9b6IDgP1Wk9EKKCelvoyJduvbq9zlVfQ/ENu0p38CFG9w1r0/+T7Bdn+PTMa44flm+M9WNUH1/f4Mm97RCPYr0PYvzhlRaNJ70PmrvUdk4it5oEOkA396IWxEaYH5CliCGNKDU+Qr8HDO3AMnyPht2Se5RXiWj/cAqMYaR7hlTH6LWHC2oVcvNl4M8ltwfFXAZitFTlRLNG2GPm/XeDo1G0cqpeLLn9uI+Z60mMvYj8U6Q3Zbk3dCZh7RlDd3589+EDwP+ZyihkYDLzRN1Xrs+5ekkLvaKRp66q0OCsGdNzQ7lFii2MxGyPDLPl4Yv+db91yrlU5XMsp8plyyav2pBwMy7IQykuOWJd61brB/tlWquv3IMpFAtguTqXgOf8Gp7RGXeTdIDA1yYNRAl9P4hMWGNj6jB6sSEDMdH9FTUYh7hsKWCBRwKlvmZUsZwHVjXzl6FqnzTWKxxhAGb5SGeSbcZN3qocYD2Thf34UeIH9I5kd+S3SqOwTJlJHuLcRQ2LXVTVq0vxJElPFsY8xz9awhOfA1GBXtx15dx09SXl7KW6ZXmga+ERyo8emfXh1qbkMRMjbbeUgi1GOJvkh9CMNzynX9QzDR68bxyh9PaQabIAlxsPqHdjLjWtTTYX/VnAO8kwrBhqokmJMMRl4WXasV4HzYD0JhhXQNAb2GT0kxYJ7k9T7AED9jxuvHufWOR0lb8ze9u+BvMNYF7FSnXsZgoU57+zeKXPWvM+zKqPrpHFP7xd6uUVOc5O8H4/k8yJbU0uAMSx3rbxtiJ5/q6Wp5L+oIlETazX/jM1dcHlqMNQcM50xov5FY6E3QJpKSccIw2aohe8+EcEnaQxqJyjS1CAX7cGj2LhpfD36VUOzNueSHpNeg172XszMFea4v8dWei8Sk0m7jtDxdEc6GwJINrTHPMvJNcRmlDNmk2fYyrVxDbOUgSXnld2T/+RLl0FS+unKsovfcXmBA3VrGsDp8iepPx7KtGOdDq5P73Y58HMTavAyQt2utJ4iJuthh5OwpIaHk3VM19tJziOWtsX2Mln7HcEdu83lKz8XAg9/5tq57QW40+xj7QE3tUwLFEDfrcEAxqWp3wB4uVDH59st/pCpUjNHql/wC+aK10bFQ1XtffyAyWh67ghiwfWPiq1AmzBVYaobBhyWHgq132PhCGVBw+AY= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 233221ad-ee1e-4391-b208-08da50a0b295 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:33:54.9209 (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: qIN8azaEu9gPtXhFt4UN/F6cJFwjthpilcvdjDG/ITU9i3FgRVK7nqZrTzIS1nxs2lRay5jTE1zXOaQ7MfjECQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6438 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133406_295345_BCD61D32 X-CRM114-Status: GOOD ( 13.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move the reference to our device to mac_device. This way, macs can use it in their log messages. Signed-off-by: Sean Anderson Reported-by: kernel test robot --- drivers/net/ethernet/freescale/fman/mac.c | 21 ++++++++++----------- drivers/net/ethernet/freescale/fman/mac.h | 1 + 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 8dd6a5b12922..5d6159c0e1f0 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; @@ -57,10 +56,10 @@ static void mac_exception(void *handle, enum fman_mac_exceptions ex) /* 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 +69,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 +243,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 +260,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); } @@ -316,7 +315,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; @@ -383,7 +382,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 +445,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 +506,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 +568,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 Jun 17 20:32:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886009 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 585F3C43334 for ; Fri, 17 Jun 2022 20:41: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=P//4VK3gpelGsmH7QGqk4ZE1/+j4fF90Mojz09MvIFw=; b=hh5/r5FN3HhvwF RyoJFRra24LozdPK2+Lh7xU1LbubjdFxcZq8ejrW4stqduScoYA4sDRY3cUxKlTED09VEDfu4UrZ1 HZ8uYtTaFuSFgOruRDTrav6UwfGBfEpPzMfCUPIydqhPUWVfWen6dbVgmvIBJ0+ZCkHH95wEviBKN pODI1GBnQdhrzSa+dh7RSeGjYc6BBElA0CdC6HspmRtAZZ7L9r32zNsSaFa5GQo+urFcVPnUvllER MifO+Lb++Y4EdWz7pXDjUuQZmFCb5bluGdj1AZCGI6EMpxECdTeNDIVT77cMPvuCKtUL8OrB6aUQS yD4ncVURfOEda5Ta/cKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ikv-008zfc-R6; Fri, 17 Jun 2022 20:39:50 +0000 Received: from mail-am6eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7e1b::610] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfQ-008xGJ-7X for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j1q4FjpB23LfDMbpiyKS0Hf5Xtw0Jto0PehxVY3e5+D744beR6n8WoEGBVwtrkXvwc54MtihQVfUiolivla1FP6mvYL12ZajuUcgWjC63I4nm87zCm7zi7dufje8wZs5pTht2ISrNV7G2QyLfqK7G+xdS5+kOron+5uDfpUh7xyRsNaZ2LKJpQyK6VpxBNL9FQoxpCYIk/zlm34SpIOjCPiQRehpmTVgL1dtKcGFicaNMzhhBLy3cqseshtjFSb8geq3J8MWOgrzWn9wGZCskJ58rZkbaeYS4qNNk/AjTeCukYBK6uGtLPnRgE2+yqtTMbL3fX5sqoYuZBausjvHug== 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=A+394x0fruddNELh0FR4mRd8DK2yOozb09PjPd55S3w=; b=hh/+ZU1b5a4eIfr6V0vJa7mEZOcpHB9EGx7BpxguhRXk9s1fWkbsPQUDoqluHctVP/JYfhg6Wyz5wIjtbRrZHhZJa4+gDCOsZVlXPm0aewFT92MzEwBea759Pzijz33YfyVGezbmdF+MWM2Zt6Bw3AbCrgSKzIAYf46hig1BBbU6WlY7qeWNZBzvlX/wxkwGBYJ3xFRwch0nC1+WcPA2EVulIMRA5RNnfueMA/4br6GFIbOOecoWLUQvCi46K+uWX+N/SchLEmgJOMR8NxJ8fiIODLz3Ff5iQ5+C3/89cieFMNYflMSrGK1pqROyGv020tfKUyVaTKW5uxZ5Eog1WA== 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=A+394x0fruddNELh0FR4mRd8DK2yOozb09PjPd55S3w=; b=fs8IyhNz2YP/rO/zzpE6jIPq46pnyyBWEQaDnBIgOlTXzOHUYVpnXntzsxAnQQLd2jz91yX2xvg4K4I0iK2qHKB9G+/Br9dYaPjbLV2Zc8BwRxqz74+EQ0TU4SWxSOHAHp6GZEkeIBJxshJoStAsUEXBRAXFf2i46lWvR3jlPo4SLF4Ssq+u7gybefRnMZADABXec5pKFC3rDzdik5S1Akj2JYQ1Jj4YZAeS2K9q8v6AfxXjlco9dhhDzGSl9rWdwV1JridguqhiHyv+OOf0ZWYf96kjQo2dBElL03t09l4cr3OUk5QTvlC9/EHt+Wb/EPkqzj/3Ho79WRWV8+IEgQ== 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 DBAPR03MB6438.eurprd03.prod.outlook.com (2603:10a6:10:19f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:33:56 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:33:56 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 11/28] net: fman: Configure fixed link in memac_initialization Date: Fri, 17 Jun 2022 16:32:55 -0400 Message-Id: <20220617203312.3799646-12-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e87488f0-d225-4cd4-8d4c-08da50a0b3b8 X-MS-TrafficTypeDiagnostic: DBAPR03MB6438:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WNWFmTTppgifNyBlDd+ioBJvXoZCMujtE2mgbcL/fV6H6e6t7SI9heao2T+L2glw+H+hAnjtORa+U9RjEp3XA2tndMGn3BYNf87YEsfJkxKgz2+cpF/q8g/CylLAf01qiPHJMwbEsdpxCHtX0qEd7Af4rK9EWNL6a5S+k6d+Wx4u57sIYNnH9cdOOVSll8+kD0gZx20xTaWi9ekF8CRqz51FbB45ln8fGL4KBmsywG/jN7FRrA1Bm5qg/SiBBlN9KyyfA//F7/JdjZQawNiiRQoM8QrS3JWLkVihf8U9ivf/gDDSv8N3lVzSrA/kuvhUGNB7rVWYZQrt15PmHHTelKUZA13IZfvARqpv+FfdO2RwmnvvAH1IlyocUEhaqNjIr093fmM7TpsQIR9/xIL6B+Sven3G+tj1KrH4HT52rjgOir+wH+Xsu1PRdUmOk7lvNNbME7oran1KhNqz7jY5slX+zjDd1pwgppFiW83FGnd64PWZrXsdzEntdteWRK8FimzmS3wa3md6e+oZejDq1cw2PWZ5kXjonlr99kGsE6d6n1fmtrqccb8D7U2J/kfadl3KLvbCsr5QjqK5WqPilH50ih4g1D9LJm4TL66vUK4SPm26pchE0NEWqiSLewOLyHMYtPWjM5C22//ub5GsKRWHUyRjjsp/zLVoCkhh6tmIJGz6hIyDKjA2YhI779/OlFHezIZFFJ0AYekqVzgFhQ== 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)(54906003)(498600001)(8936002)(110136005)(6486002)(52116002)(2906002)(6506007)(4326008)(26005)(83380400001)(66476007)(66556008)(8676002)(316002)(1076003)(36756003)(66946007)(38100700002)(107886003)(38350700002)(44832011)(86362001)(2616005)(5660300002)(6512007)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 99KzZMEZrl4sj//d7CUuXSSRMf96SkrvhtoAEBbhGFKF0lvOkVXcJW15+CBuykHgIacfI8F2U3S43e94P252afVTUfBaAXi1jJQ/pZmv5qs109Td7DiiOf+Pc0YQyGjvo/4hnHqxbTXXdsgI24h7xCV/GdLBmNJNYZ9cxdMYA3dSldW5y/w+T9dnBbBQ0FXE95xPWNuHaR6YuY7+crDm1GRIKTkP9K6yY8GwvnPTxML9H3m0ntB/9I3/9fE/WVbc/1HfOdQc0EgZ5PHR7Nxo+qIAH5VCP6FE2r91QTzaodHOPsh1JLEXUfALtUy13cX8NAFZ+r3AhzPFrgJWTACJQgwWL3qFffdbqR8wKy+bVsweBpEHpVPLkcOYjYv7rV6763EZl8LSlio5A3QDu7luxXqUdAHp5aIIVcMNpgb+dXykfJU5W48Qqlf8XbJrK+8q1d6oEkNPcB+FdL23QMtoSvGm86WP1srZTSR75ABg28PSLwdi43POcxieq9sPSOZkwSq0ta7Eeh5dTR0Tdg1c0eBNQCurBH+nvyPh7LPJnCBmfM2Sc31FZunHy0+sIij5CwcJAdMvL9YdRShULwuS8+1sy7Gh6jwoHyBpFzjkx8DBY/djNuFogIvPnjjvHsuOpP7hsOKQGleLyEMjTUdesn7fQXz3qq/fQk/VFwIOcQQl0CssiP0yF024zHSuibIiLO+GrPrBZTwlwcniI/LnucFMk1oR9G+g8qzRaVjt6qglIEjShhhfMeNg5Af0EoARc/PPvDsO8lMx+WWwm5wQD478jCyaqFCquiCuis2eG3uUAvkzDumzFGvcWHf1xEWzQIgOn2Hg5t47Igyp6hLKyE5SFgx1Neh8xKCgUvZfhi7AxjqLJ50oqNyygfJsk5SWIltviAsR+XNXUwaEAzQBz/pB2X/qFE/2g/yqBjMcj3skea5MXeTwdDxqSFACM2BWaU4P2ooRUElptio3An/LEExEag+o/3Gdek/5lEGHyfFjjJua1dMFruVV2OTbTyR0OhnAXt9HN5CPI83LOSpxB50K2CKXnGyxtCfkoG+LB0f17DZmV27KvcAwCsk5eZ7OAUoWnM4dUbLgZr1tVQL/OKNXSRxIiASVhBMVrfOdBV/KluKfcJ2DE+V4Wgm7H2kzhgQFozqdIFEDF1jq1Gg+aZQ3cbBltARUpOG1bHLh5XZBeM/yempINi3Aim/gNtpotsqswRaUtSD3gEju+h6s1qr2fXiD6z3CbT6s0E0lw53KpAt+ZdyNiH1aglitf+RV6EqK+T3+uu89XsMAOhwS3UKy7nIfzY9DJ3wLEqXUY7f517ZcmFh2LhwkZPbTawetkNHJIer2CGcB9r5hoOLboPf0HfDz8HRwDKUhFu4gaiBFE90tp8hewSe/bYJr+OhBn6ITKOz8x1X6YSxCmqSjW+8WOicrGL6X6LD3nPYNRGVw8/mFXLEgHQv8eHkIXo1N1nqdo1pyv5QczES3sNakvHqn6l8w4p2Mudm6AZttPKpnc0R+iAmXWLrSHJLjoi6Jip7UkGp62ck4k9uD79O8smyK9lJmUWhjh1rqOTz8yxII1Dzk0ZQubsv5Bp5Z3Hd3lTZvUS4VrrbHimar7Mq1qEtQx00FHniquEC3h/+BT0TvrUuK0cfnIdLVds7Nqa94F8j2sjo9ZsNgyenWIwJ2gRGWmBL5LIvojyQLIZ/8LaQx2QvjruJo7qdOcFngMxBwMSTtmLXUsWXgYzDMG/cqBXylLpwayhGu9aTdf4s1ttk= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: e87488f0-d225-4cd4-8d4c-08da50a0b3b8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:33:56.8114 (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: tDRzACstNMV4Js01I8qGn74gcn/rVidkl+isTF1cHUPKW35sCjVoQ4p9m1+VgZizQbItvn4Hf0T0kqmPSKrujQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6438 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133408_344034_CE7C0550 X-CRM114-Status: GOOD ( 14.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 memac is the only mac which parses fixed links. Move the parsing/configuring to its initialization function. Signed-off-by: Sean Anderson --- 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 5d6159c0e1f0..248108b15cb0 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; }; @@ -399,6 +398,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; @@ -437,21 +437,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; } @@ -578,7 +609,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); @@ -612,7 +643,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, @@ -622,7 +653,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, @@ -630,12 +661,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 */ @@ -643,7 +674,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; @@ -658,14 +689,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++) { @@ -724,42 +755,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 */ @@ -790,8 +791,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 Jun 17 20:32:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886010 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 8F3F6C43334 for ; Fri, 17 Jun 2022 20:41: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=SKV65Bq3sdIUO0Ewvm/fM8nyRRpmLfSK4lpT5niR2sg=; b=RrYJzVm3zeQXBl II1rjQroNiWZex2AjPFhRfhoc6l+/x1xa5aXZb5qQDQ8Qutg/DEDuiG+KmQ9eYu/gcCuedAJUx80P +gjGKpg/Bh2H2JSZFkQFR28aD28bzoARwlFhsuGyAIAqROZnplFuensIajvEmtzbZAVLp2BmnWNkn nmNC02qkz+avEV/PRmpxkZ9YHr2V93b2Wh2O42ipYoKAtajAokHM6ydepSzvfET6unMawcVm3QtMg LRNzepAe+86WoW3x8xhsRKUzSCSCIjBzKP/nzhWUL8wJHTGwx8INQrDRCtopZPGMWOyLYGb+FDsC4 598oVdGM9N9ilKPOQk/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ilk-00900y-1y; Fri, 17 Jun 2022 20:40:41 +0000 Received: from mail-am6eur05on2061c.outbound.protection.outlook.com ([2a01:111:f400:7e1b::61c] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfQ-008xKA-Nm for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RhlVCKRpE/jXRdFdYQllcjOiu7hP/Bsa+MWkaCMY5EsBsXbvGNex+qHR49r8PaPHxmq7R14nzE3seqUIcRxGXM8vWsL8TL3X2Zjbdu+gvSgpH9cUPnX+FZq7Enz/FPeWZqRnCiIWN6M0fU9G9+4xWG0i6veXgMvzoHKRZqNWPksjHv+QJZ6aO4bKGrhPzGRHGw+C/de/oJGzRN07ll+jBgNm6avwio6+zCiVzijR7bFgQggCGz1LUwttReosRDzCWfLmqALp3cvjDzK8X8UONzkit5dixOenD45enGFoKjZcELqGrOSJiywaMgLmeVgxnFfa5zR2/DWUxtpwGDswLA== 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=vRiLvnW8cA1S7WsJ/ivzaAIyrGttAsTtVTGeOUB3Woc=; b=XFGn+AJaDEE9jKJkjCarE4MHVUs/kXJeCQ2YH1TRvBol/3b6t/1aETTPokaL/E7A4FVQp6pGClY8UcTTk26WDEuYhHkZ25dD+SzJm139t3MaiP8Nx3qMckQS0TY0KT6Owx6EN3U0s6xYS1OW/6J/xr9Pt/UZ+y53q6VMdx3Zh6FLtrGaDXiuZguMMAv+1EBxmOZnNVNQkRGHt1C05tR60Fqo2kH6y+OTcToRSlEzYSV2uhhq4RCoJaNDu9aJ3tihMAVMLakt3XhQqtxbXj+PZDXD2Hg7WvmeKQ/RY7AIfVxmrhPKTebLHWIoSNc+20g80pdXAR5XaNYZXbiF3nMvBQ== 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=vRiLvnW8cA1S7WsJ/ivzaAIyrGttAsTtVTGeOUB3Woc=; b=Jpzbxzas5IlZo0wXdGaoIZZobQ56d2/iWVtqUHGgudy8NnlLd076zDjUr+qRmmxRyzDFtUPurku/8yqZuDKvQOWB6T51R8OObz2czoUmehCzVZDcm1zy19lDrQ9ZO92vcRncBqXu1UOzp9dW92b14kHvQOiZZ6tReJVFTBukyH4m85Ud+kDhyLpoUtCbOIz3eC83yvzRrwvV28jCX9jRy5UujwsDMsQSHGgbqHIvWNXeXDou35sgBAUb133LeC+uDweLp0BTq2r/ETDbcXP8otPkozu4aA1db5H/9pkAQtsWaOLSm5fqr7DvrT0jFz/cTQRpQXxiNfo11xUKkSqR7Q== 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 DBAPR03MB6438.eurprd03.prod.outlook.com (2603:10a6:10:19f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:33:58 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:33:58 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 12/28] net: fman: Export/rename some common functions Date: Fri, 17 Jun 2022 16:32:56 -0400 Message-Id: <20220617203312.3799646-13-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 10798c05-9ab0-467a-a3ed-08da50a0b4d6 X-MS-TrafficTypeDiagnostic: DBAPR03MB6438:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NSgm7muY6dqAWiOuoN6kwzZkt8s/Z+yOwM5Py+IYiVz/+LH9b6zx6e+pXo5EhIAphPsebRPR/TaxxoB5wZkxDVudFYAECuCvEErmdtRuj6IG5Vo52VteYqk4AT0K1ldxmzP5n7hDhk4F/Rk3sfWrwqCS/A0Lh+ENYKGbYLMh7RWRc/GJHrWf0500+hHwtwXRtNcguB58KSh1NYo0XeLQsZrod57gzNrMiAhxiTO+k7TJoPGuh6sm1DHUTXmGdUrmvg0r2S0g9aXn5Otzk5KnBZ/8dRhZFjW7mtKI1s11rFx9KNSMOkxrl9LSiFH4rZMLqlhuaHTTcbxr6xcnO6fKPq+2I+xUd8VEe0M5dH3Ri/gU4gliPBwa9iyjUHmcAEzFWH8gYtbTxeCUYMeLLSfrgTGrqvQzaQED1bl6YPqJpL/h2Zya9dMv8OBHvwXJ1zHcJFMqvxcPQsdlxiBbPcb6KwyvAcV1Gr0fyWSvQtlJ/X3TXERgiDj15pZGIecdseD1r0peWj5Q86lebViMCOspcj1BXmj7qihw/SMGdcwB8+KYL+8YmPyMmZTrbvYMa4ykdJSvk5PqErAoTa6ytNfovRwqV0fbZHgNsC+6lpadpRBVG6Cjl+KGQ0j6YrYfDMNNMAk+6GxOyBvcygAbqTQAaMkdAqv8WqKSF05wsugYyxh9k8AbL8D9J+sq7x2Dxr0o4QvzwtdFxQW6jFvaYjFCvg== 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)(54906003)(498600001)(8936002)(110136005)(6486002)(52116002)(2906002)(6506007)(4326008)(26005)(83380400001)(66476007)(66556008)(8676002)(316002)(1076003)(36756003)(66946007)(38100700002)(107886003)(38350700002)(44832011)(86362001)(2616005)(5660300002)(6512007)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sK2fPhYVM7lwSCua4bmq5KWhv8wZVMNdP+5FU0QAX3xre7q/jDtqYYF/xn/Xr8AUgNLHJcOQZ9O5CdMmvLnQAhO2TL0KdUPWwxCI8A52DiaRR/DYqBamxzZpoLI1OC1KrYjQhWIw+lLUUR37eO50imeDHqEAmceZNIdkIDtB27fQBxSE4elrV590HGIjLjeE+/q4Obu4U1juO+jVHVvdP+EHp7T3TtG/TkWq/gZ3DLpxxb4zcXQB+mzjWYS0nk0LES/H3GhL8C51VHZ5qIntwJHmz8VjG1v6Q7Y7Rw+YiLyf5DKIszAQX1bC3n1YW5Ia/ioCRMWwJQcIzkNiKwPJoNW19ucs/1w9jsoS847k/6X0Fhh4kF37P2ZkwHsT/bOLsnmxvf/z1oyETYQqG730AxuML5la2R2wsCcSC47MUkDQahSSlddgsHed6Ek+QW4JXypaURr5UImCcoz83mr90sqvluzpk00Za8WLrf6JJzHjbFT3L4Ki5BkDMZC+ieX371M1cgDnoOQEcFMNB3PJJ1MPcCtJIi8aZK8yy3mFiCUIfTN6WhFmGZ5TKe0jklMDrpqOM8a7KiW6/vgOVIMmHCpWr+Q+o/1O+1JWJ69iB91dc/H2yQ/V8k4KmrRJk1jP5IWikVEavi37qfCM1Gkmh+AJKhcM3cBuppQMWJhPqg9rnXYOUwwl/oEEx9v8Zl2S61bNhXgrwDXE6qTkGofI4AGUQXZhRkcJm3kB7NdfB31ZnHmQ5+YQzvVlidb+ExiteAkhoQ31ipuZsUi44ZryVhrQTA8RLcMdNMgJoQS8Wd7cuR4rC1nXkT7b+0rFKNWxocXmBoo62ev+TCaZKJsm9qoII5KOHIUPbTWukknrMglKTe7S2V2gjzgzV0cKIPiUOfl9xmzvp+U+sviVIcrftf+DFF8hH+vCAugqQSUii7YIb8v9Jw4HgEmI/22Qdzev7CvZJJQP3N2u4SVH/JDRIa8dJkY2Db3aT4fMSgo4IoAzHcQrJSEWX8CpGgBgmOdQI4J6mOwNncisV4iezgKBfp4M+o3+e9bwiHQ/a/YJGnP5Wy76GwKVpwxxp2BhMfJ4Zhhi0luwq11uGpCt2LRjHoATvMYbYKxMEPIy6KZQLKC25/ImiRJfQpwiKehTNgdIUUSsDftUnLiG2rayj0OoLGG+DS3gJZfNRudMRWA6+eolkfbA8lkL56jr9fSFhtQ8zuPdWPDOeGeSWt6Q5NUauNFkZJgGBaoDN4LObdZywyqJQXUNpgDzTGvvjA6mOFhK9sgGUkfDfKB89qM0U2nPte1EeBjkbkDf456vt2OJMVb4X3D9eL0rUhtt1tPUz4CchuzNRyIo7FX81oM6ncYib/11rzEB/1vWmVkyRXL4iYk/EH6SThrbbd5pkWImmSoy5wgwpg7ut3XW5CYqGaW1tAhcPnwMcpH0nJ11iatMTcu58+lgKhnJZhrxNHngWPxmucWVuFxnfts0+aGjh38HKn/G3mbG/OLKRHdRxO6gMOfZY/PcQhJ06B+wcrBDaSi/gPZRXjK4snp3LEZ4x+aTS6rl3zpaFrfX/5Qkd3U8fhAjXoN4jZhEYzypCHo8hxyhDy1HIamF96PiGZpcHMUqZio/lCwk2T3kZ6BuoV6CB6PUPwNZmbQYMRAnN6It1lzXzmQ+s2+pALxxqqhjEzJapCzSUfwtP2msI7R83npAchtUNl+KTYA7fvjzaRACozofCRV8snwQwC5xXhv3wxj1fXi2zfN7z+RQ4908XvS84c8= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10798c05-9ab0-467a-a3ed-08da50a0b4d6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:33:58.6551 (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: bhw+4yAu0fRRdQXN8E9bAE18z/gRjC4RHX5FhGsD0/V6mVT9ll7EVwlkmcPyTGDTzYvLtOBtcPqr5UyE2ljzKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6438 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133408_813046_C23E66FC X-CRM114-Status: GOOD ( 11.59 ) 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 --- 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 248108b15cb0..ac26861ea2e0 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -62,8 +62,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; @@ -86,7 +86,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; @@ -281,7 +281,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; @@ -343,7 +343,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; @@ -410,7 +410,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 Jun 17 20:32:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886006 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 459C9C43334 for ; Fri, 17 Jun 2022 20:39:10 +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=tcCBgiEVZFv08QYIJ1fFx9k4t31qLHq9zxosh7wfikY=; b=ssQV5U6tC2jGbJ 5xXrFbN3IXh1QkFawaiMeJ+P3MHpUiCcpYwRa0l+yJqAV7Z6n0H9oFJctbv2mfEx4OB1Y01gLj173 K9kDN025hqF/bJQ5WaD2X8zucZXDSQ4SV5M6u+FcvQZaiO9eRxBCKE+TLC+qpFUmqC5QjG27oDhwo dvcBbUkkPrx1dcDZsFf/gaTHyjOGWCqnam4VVOO4rFEOT0UFz1bWJZAopvS6M2v5HmAXWwdid1jfO qfCL8Oy357FezFB6lVODVKdHfVLqJdRMVAnzWwt8KZZqBntLq7DgadiFOEkVcInDp0dq3RCGWJSw8 cUBfEABemaxxVlPt5NaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ij5-008yxR-Dq; Fri, 17 Jun 2022 20:37:56 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfN-008xNk-4v for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nzDyYzEELwRv0EWYZiJrlyadKXEulsiRIDk33Vf03iI5P+kR7BiQ48SOPvbAn9Q4IRVWYjhvW7VhE12GDQXoKW98Ld8rGXUAEI1WtZIYB5YZEZeA6QafguFBQtRV8J2QtUNpXrfG5sDof68JAcYL2y1bn1K25y6pMs3XxuaGS0GxasijN+GtdpPhVkPej5J363511cX0F0Qe8KhdYeTs60JJQgaRtmplxyhlHmGTLWYEUWDUHFRw6fdsLP/s3i4IjgPIKZ/tTy27PnfR949MYRTHkpX6hWBVlTaFZ5Gh3GVx0bS3RprJtq0xca8dlSvRj17X0n4hxm6x1QOMS7WDag== 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=o4mcloslbW42z+e8XXI0Uo5WJtgDwnMYv1dVra17378=; b=kfB9CzLhUAMlpHJoak91yzkbiLgPWWmu9kT38ymewT3rGNibqhHtca5v0D72s+TMn1h2E6JLp50vS0hv8SRE8Q9BBxusFKVfZUarY/lELsF2aB4xI13TyEQPVTqxi1swtOprL7PB6m1BKil18OFGsy6592ImeJdvnhDBKdBlamMdSOVVHGYVxkLA1eRLl9+SuSHETNQWiiIDLwNW338QPXE5Vgha6sXqQVMAYhLizfjLn8QR+GirzfmMlwvTvzKGevoHDzxpoj7KQj0jQQ3UpLbXndt2hcInB7RiKWgRYIrI8XNUTHCIXO5KfJCTffotw/iYTav1Z8TZnPSPadcgEQ== 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=o4mcloslbW42z+e8XXI0Uo5WJtgDwnMYv1dVra17378=; b=GCdE6/g7rPqq/qoAOuLXnWw+N3Gzy+n0szr/Cy4GhYSliWzS3NM9yNZrDWL/Lw9oPRg9gz+pLFAuyysM2LMVNkKzPILwiOBFza+QDrcJK7aoEI39rlNfTKYWq9wqLGdv2N3hkSLOp2x6WIrRdzTLkQw9/VISFZHlVzzfsZ0TcSt+2Z/oD6NHeFTWlSqqwEjbmF6ka2scwaYYwwWSsp7ocoqygY+4MGlTF89eRdcT179ZejphH7CSEOTixzE90StZ7WdTlc6D2xgvYz6kPyrEmcwjvs29WKedJq3dGWXkVtO65CNecnkSOyIygLPz0CZiJD7G5GixhKhsI54bB1EJkg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:00 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:00 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 13/28] net: fman: memac: Use params instead of priv for max_speed Date: Fri, 17 Jun 2022 16:32:57 -0400 Message-Id: <20220617203312.3799646-14-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0a58dcb9-4d0c-4fc1-3143-08da50a0b5eb X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GCgKw+03vAaWjpEsm36Am7Ae1L7dPd5PdMtUoaGMdts54B4vdNKmb8xuhj0276EPtrdQ0nHlv9O0O3lUwgYzvd9Q/kqUjkQaZQNcGkSMk0JxS2w73Hwye+AkinTzJbfKzUyiGc8pOTh+VYyS1mP7nLgt6/YAYbLiY1tVbMVO5eJ93N2hP+HFHne4IMQtcZDKq0w4zRdhmNrRg++SZp4IyQoX6x36aLJfYZBsWb02PTRoTZm700SjyOvcJyu6xMJZN3aMGlVViia8O6Hd8J54G4NqcSkcGMxjEfly8Is998WMPMuawpO2XYGFR4RmCa7QHFz0Xgk/gMn/FjL14Dme1hN5YRPInA6dA5oWkBhvxZoQZvNVXFHkTHKIQNcWq+DyES2N2kGfSTH8y3a1DCC+bGpzSs6goR5wozTl4cD/iYjOdTNVRQP1tzKQDPuVtDUNcxAAyJAkwo0+6RPeW+eHQavMHwHgRGmLYusk/CGemn8X/1WmBaLc7KvYID0l+DSz4ET9mxiGU5lhvSdLTaZ1SSXPYyLrqA9ZlKSVNnKadFBu391pLBmDbambTuC4uSDfCpqp9ZhkLD0q4v3uMylfypRZJSKa5RFT9FXm7qg3/pGWTTt/38L74ZZeaNimn+ihLUS/EI//GctyP3IwQokz7V3fdlrnReHA4P0aIXE2EfZ9yKqh5kF+nZHxbvk92jAp2d9qAOEcahp3lcN/ZpwlrQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(4744005)(6512007)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0SjfS20Q5gL2RygVKaUDNzLymm/2j1rBbBDwiNaE7e/tsnx3pcKJHbaMMWRPKovc4gHSkjC9RRQ7HcW0ZZrZdZyiEbc4NBT82qoZOKQ8LW/tk5YvIQsJikEdG/j5wtt+x6IPi/U8H4mZdd6b8WJoqpMPMU+lkhjK1IHuwsxxbaEnTkvk89/Z/4GcbtNoAN3Zb6hkddLY31uXRT+p72xjySy8Mh9HzwpdpzAT0RXoN4KN8DCiupFtFR1tjoyzNsApcD/MXjG9qrJUxlHdNzeruS7iM3Im7ZFvTo4/LnLA2RHM4sSBMOnw7+hMVVVvLjYCOQICYTabZTrHoJsmooevFFg9RJTb2xPoABRJMlAsRHXrm8b7z5JxuiYedayvB414lDvUsUaXT2+agey+O3cCwU9UqhKgX0DwpGVyQqlUb1SUrwtNf/Jk3xl9V/XDV4Nm6f3pje+1kuo21BQi7HyXx/5F03soqvjFEQH5l8i56cN2LlJn5H2WrsS7iEPdysNyw9bzLMAEwSUw/HNOGFIq30yLvNVTwgwEvMlOL9Q//kU9HtaK4BwH5oXxiLdi7AJRQByNvr3AEykl4ZmGpYGNJgja1jGt+hysQJ6y7/kCT2flk0CSJSDKlEWJuI1iVOvYs7/FvtLTYI44v6VMC4YCecGCU3Gnp9Lrt3XvRErXTxiUdaMykBo93A/ajNuVpbQGjCS/ibZYrtf2Rh8pDnqCwodf9u3FFsrUGh+ZGqVQutpL2pHQFsrZo96UbYtATRaZbhoC2/vZ/ZBNfpt40fHuDgYCX4MDkhQaN6CP9OKa0+z55BGS13eL0qsaqtIYQWQ7PbaK/7w4Ga/rTTrTI8I8ix7bYR6n1P4wPV6hNErs+i0D4a4ZSaS24xLzoRWrp9epiSaGc5snsRTko0kWBxX4f3u2A1hml2bWB1xWFolvhNFBPmVzJ3GlwSf7nRe7h6ERkrZXzROW7YfL7IUt7y6+uHyeVkhZ2krB7wtQ0Kmw2ZWctXWyuEDp9gxGNKSJrmgIBM2mqEkp98OIrCh0oO955+LNACKJkd1ZpjLo3LhciGVzZjW52j7i5gpctvAk7geIls4rxA80KB5BFG4lspl6rUj+gVCSeav/X5hQibiHkfGeefiguhAAdI0pwYhLGf14Mlf+1ILJ1BUK0FpAcgA5dfgnRpmPmgGemBZymvFNxgNFd0N10WEsemi18baCh7pV1T5+pfShUZ8E3gbTlmnDOd6zxZgLjDErvThWbLGCuw3uOFkZGlTTvAtDCXmGjhRShfAsGeCH5mAqBBvn7dDt2PG/nVtt7dMDVGgHZPI74ZvLnISR/vfpql6vf3FJMaGIUaRo8bCNEhbaXxhaNB4pBwtC+rX3qLUM1NONZ9/YwnVsgxnQkTVRXK2zGmB8/3Jy5JNWDahSVKo7yZ4nrTtCwAFZ9cB7Kf7rzyWGEulXVR3V9OrbijhKDJBiDP6S9PR3WCCnoVnMbLIFiGgki0xO7YTpf4LD8AMbO+P8lZkz+ewlQ3356PcEKrdfF/TZf6RB680klzvPytNHfBtSRGDghi4d9zqvcRP1ZjLJyyLxce29a8Mfuw6IDmR9aXuWq5R+MhGqQ8dCUUjtVWaoAXgmDX+CzVD9rj8+zo8/Ec1/sGyAaIpSeWzffxXfpYy2iLTf0PKEs2uITMQzSjb4ItFbthfc/E8uVwrT4VUgBHtH0OHDrp0YoRkA0gGo6rCDFvlI0jwHLogfmYWbKlpJomt6w/f6DdePWVi8Qe2XpOlDP9Y= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a58dcb9-4d0c-4fc1-3143-08da50a0b5eb X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:00.5925 (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: KKosuC86nijy3eGdYRtzeyh3vaw9NohczBobiQ47157LOztmBiea3BfiHyrIWkYN+rGeQmJejg9N9uNGqqwbJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133405_339102_B3EA9F08 X-CRM114-Status: UNSURE ( 9.68 ) 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 --- drivers/net/ethernet/freescale/fman/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index ac26861ea2e0..b3f947f071ee 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -420,7 +420,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 Jun 17 20:32:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886011 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 442F0C433EF for ; Fri, 17 Jun 2022 20:43:12 +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=fqVm8jH4L/m1dMfyJkjQdGaVL69Z/zNxpn+kNyNG7oc=; b=oz2YguijA81fLT JZFcL5MbEF17GKrvt10XHWrxskeg7EqIQOpDr7IXbFHtCb+Qr9hGstitfIj6GlCouWSzQbGliHjT9 jzi0UQ19RODejpfmRJYn2LFAezgwPlaA85JYRULZZ6hJ2BvJevniNtJTyXC0YO7p5PZhEsyRSYRDH k7+yw39a//NtL6axEhoqjnwfnkgFumZPS5U/6onpcVp49T8vbiXWvRTs8F4fqwEPKmp3NA6BsAqhZ InnljTMvVf4qafncPqd2O7wJU3zRXsZqLamH+6GVgKWYefLcMX+dfSGNasY1LQkbEOb3ZHXuVYWjK 9pEKNSLXRIMMsNt5I2jg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Imf-0090Nh-30; Fri, 17 Jun 2022 20:41:38 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfP-008xNk-ON for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K4mClJUWCyzDjbBHQT+SqQKZzFvxIDTi71BAcHjuwRKLYg6/R+ey1Vi653zjd/7J9GwaT1Gm649iXYYagJONla9IxPIgzYfhhQR9UmRueO/iY5pvVMtXh8wZ5G+s5RjffuQbtLLwfbHnabr+7C9Mwr3sr9Pv7gqj7PEXVQDk7R6IsJ8qh7oxVMZ1bmQLxTK1cci3mrdpxwL1toBZvA10bxusL8D3oS8Z3NDq0Dc/uf2r5xS52q9XAHMx1dASQgCUlGwSnBYiD5MkqH0SKcMGzzBdGU9Wncuveo8INDSZgHvMEBe0p4vlkRJmSfaMWvlQHK+74H8IsdAoImuE2RJUgA== 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=C9wX+FbafqZijEu4bhEoxE1curWdf7u58dsQfSiOL7M=; b=GHYEtLEIQII8lgq3CvEpUewo+XiV5/Byzk6/zLjtxGgK1Vly+iT0SeyvpzT3VUhwYdUONv18djKiNm9zlA8GnRZt4ajPek9uMQWVMouI9F6y+ZZCsbPw4z+vnyq1VJUK0hVeAraR1045xHNQq4m4mSUwm8o7xANKEV8E3vntezxOECjMCwaE3A6T8SIexOcuYGWW1w8/H+9VIQ6c+o0kpfdGJIxkN/vq4vjOoS8hoHvVDvJTrBq7ddpcEHhp0Rl9l4x3Ai00BkbVgJsVENNg3NgnnTWnzdY81A/y54Q4rBpUWWPnbtSuqTjsBFIlkQhZqsBPxWC55HBr8LEzJZixbw== 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=C9wX+FbafqZijEu4bhEoxE1curWdf7u58dsQfSiOL7M=; b=Q1FGgDCkoGqySkzRE1dNebpgqh7PKb+mO56iNW2j5JFAogf5jm6nfgTXg2sh6OvQRaeuahLLujE1VPovhoZovrghORxMfgJ1lBEf/i4Zn0uGltsqTB6WdPvpceBQVGiqOo6N+URn5nLOgl64VQ3p2ZbLTZCZaHQ2BvFJoex/kSGe2r3r7Pcfx1MnIDJLxuk5DzyNlRuTdbDrnK9nr3HIg/5llZpqqhpXKlzpoBH852ycNgai779lYVEvPH/xsEQz8N547ZgO8gbbuPTqE3vwTHdu9yFWyUxA+8YbQHxlsh5AYvNoNmXvWaf/HDb2/+p1I8m3y/lXIhpttL3FRWIVrw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:02 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:02 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 14/28] net: fman: Move initialization to mac-specific files Date: Fri, 17 Jun 2022 16:32:58 -0400 Message-Id: <20220617203312.3799646-15-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c8fb4f27-d830-4505-6ee3-08da50a0b710 X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XlppvSzmjlONjU5WncQA4mxATQ92qvxbJPf54nSF3rlFnujKImFVG3t8SqhCkkVzz8oVtEtVW994HrjKUHoKLoDiDg8pTWE3ocmC+QnNeO7qUeIA9ZT0x5ie6DGBfXVRtsPSvdEt+oWE0FqSTY0sxitp8ORc4x+PvG7STMwNRV2J/6zOesM9PwwDOnoKoJT8t0mUaGRf5tsAnSWXlhXzGePONSeOidHak00YvFknNCg4cGSkxGV3ffN/qpUsqLF6l2cXvowgQwnLwEqkMItrIDTs2XGEGz+blFfHK7z0wNAItV78rmCyI5FL8/ngS2F7w0IYUvHWlZrrGevWAjUxFgg+X4ha2oziN6YCQRdnx8DZNJ9zJHtRIPPjl7KA0b7R0RkW/eM+8DchXDDTRWxZMuv87eQmzerNqBQ9PZx9SW4fitFrRTjW+mxbo4OcE/Np0mR0jfrNlqSD22B3YEB2sTfZG2L9pXWeRk0T4elt19vtAjl40vkFvffBXaaNk7qpmZV0pVGwgktP5mQJdj4bFmmPIO3FM5HP2bCBK8cGwqJurfvrFhaAF2UUZppy4mMAPZajefHrsAovWa8wpbbqj2WMkRF4eNraSfGrcjuC7rRbZyJfJBWnIt2S9vsczRKQlxDDehAprgpF/q349AFZ0IEqM/GclU9jtva5P/R/YR/FyASURuBrKVoAQvNDV7IUFSffKJXEe8iXh991nxhS0A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(6512007)(30864003)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2JKcQSatY5nGMrsI89Um2FUdatQJzP4LOzou/YDQx1VvcGFY05ec8H147FVXSurhizRfQ+mr14nE892YNlylVhsKcbmdA0pUd0TydLtBg7BZL3SLEQPSG3q3ICHbp1ZEOEWFtIzT85SUgrgMj1N7vWFtRyoUiq9VmTYFybsKt/XJ9DBFRI7xAZ8rvJjlpCVSTnG+jsisen+KbMlIQDmrcw5yaa6ZKyRAdBByaggGZUK7TgSdftHxyPQjA8t9sZ5DbfiptRHqLu2lQcm+pcpmk+pcqN5u9UN1qQyErx57LcHS4MMjVPdaKrG40vyRJ5ggj0vktoOgmahkdB2LNhcF31pAS2frdpvC0HRZwAZqQBNBH+NUDkN/nxvvUDaEAt81yQpVU/NpSQjPrhtHd7r4+Ku+Aav+as5HFbz05U3JFBvv9twaA4r9TVIYx/WBn5Q19wQ9wPB1n0yowW2YeW7dHFq5AR35BS63sPjGng9gI5MJLFdDcIwZ0imRlhJsoeKRGiiExkjPJJRvadFgLkau61pnOlBp8UWMDfNaRR0689Vn8VnG4Z+22iwF2ehpaPZ5P2VoalTvIu8nZeDWx6LMFfIe9tDJGIIe16Yl9TP7cv63C05CIIvheezPQQgDM+sxnOjI2SOAt5+2/2I5OxAJHnmdKWAkSwRryr8fpLXpX/HnRJRPfYe4XmmklvJAne12iK51SuEot7tumnkrpVSm4/EcKEzXEZa1e9RAqInjW+d2Z/diACGMTQmUhYiFr79Z9l3OWnKSR7TSaZswsUbd0qgUqhf1ibeOMg7eildmjYBdsuknLnAzHOLMinq+Ympj4w6f8fcvooKaItMwibTIgJQ+k6dwUwmrZiBJc05A3Rmr9s6XpIx+ucw2nT6jARj/PZu00XDK5ZP/kiQlUU2rswwQ4IDNGmF11OrHFFxH4qTrtLVuGsXkeJp8Bqc55eDi4Qac6s37WTC5yKPZPepL+tDFKD3D6DyPi7f8Jsk4ExSZ8GDk19I5qzBODFBBaTPTP1m8SwXLDBDV2XnZscYEKXtL0dfQryI1my3AcK5rEf8iA8TrQHH5wPVmozla6iKaWR60w32r84SiHPbjFdRhKFxAWv4v50QmfrLaEqiXU9aJcU5qRx8UWbMMfkoAsQYMgrM1Nl45Xi9iKSSWEA0/HGIWMlD00QwKpHTZAFRAujLup+UKq3pRPypdDc9uJrNqMUgqFNKsFHcjOHdTg8C7jc2f/CpA3rgvyurTqB4w7P9WXcO5VvGqoRZTOascdsSGLsQBuYFulh5AClLBI9upzuYFEzUy9LFm/2gEH1ffF3hhufQoTS7AKwlCpKg/lkxjrvZ9lD+nJ0zbbPIS7zq8SOcgEbuLTOPG0zZB+K70DAVimbOK6tERKAU/Cf9PcF6f5R5+X8sxNt7hb5GSxMqjge+l4j39qiXHMoQUWN3M6dYF7VD8hKGyxtSx+6R5mrv59hQASvXrvWRVLGt34612B43/UvMlPiZx8RWv1CDsQVAbd+vrmNXsuWp6uimVFsMez3xfub6Li/b3o1EYOmnKQkMpKvi7rS4GenQzYVCEGCoo7qxkIhmZF0c9PZEbzBNlHvStSHcHDWWTEWVaaXWXzaGN/Rj615zzddmCRU2duG4n0IMAiCWiz3j5GrS/rMx2cPmAM2T/1C0ZPjok9PdNaYrY7vBDLqh+suYCLOmppSy8U+Zg7u2oixFcj5LDfS3wkfTQI1Vk43ZcQFC7O7tcKj8Zhc7eKmyk7C6IsOaYIQ4= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8fb4f27-d830-4505-6ee3-08da50a0b710 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:02.5455 (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: yXPcqrhn8R3NShxOW+RDbROQYGLwEVSnkvURR/trLrR7ntl5vKZMD/RVmZyqzeLpIQaiaMBI0BPzg8xCzfjDtw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133407_981168_E558FCED X-CRM114-Status: GOOD ( 14.33 ) 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 --- .../net/ethernet/freescale/fman/fman_dtsec.c | 90 ++++++ .../net/ethernet/freescale/fman/fman_dtsec.h | 27 +- .../net/ethernet/freescale/fman/fman_memac.c | 113 ++++++++ .../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 | 267 ------------------ 7 files changed, 281 insertions(+), 328 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 7f4f3d797a8d..12ce079a356d 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,70 @@ 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 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 = 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..8c72d280c51a 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.h +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.h @@ -8,27 +8,10 @@ #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, + 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 c34da49aed31..4300a21a553b 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,98 @@ 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 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; + 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 b3f947f071ee..e33d8b87f70f 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -220,273 +220,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 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; - 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 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 = 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 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; - 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 Jun 17 20:32:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886013 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 A8DB4C433EF for ; Fri, 17 Jun 2022 20:44: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=GtkbwVQAfs//fBqtFznB1XPOKVFqs505mgFTwJTlYE4=; b=C7h7TdjCTdQaGJ 6pKs+vb7TMhfO8RFTr7B2VzlgMss5Pl/lBjRTCB3cpDTCw4wTcjHYbui9fhbITJaUq6aqT8junHXz yY2nnnwJmVJgx18xTMTbfW11PlTnCmhMaBChMsDyUtt7SzpAJMSplFO02vAZP+kcG49R5Y2XHwtFr K/xtp4/3MmFT9xTnbsgKG2sPIOzVzQrC3lVqS71XLYFDl8yuXliPm4cKNp2a05Io71zliwzLA89Hn W2R+PDKNcdc5UbFyIKm2+Gr1M5ij6Iu7DGUs12rRs28yHobK244QsIeGIpsQh/Fgm2ooTqyaxaAQ0 PYJBYQDpwZyJBuj9ef7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Inj-0090lp-0o; Fri, 17 Jun 2022 20:42:44 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfU-008xNk-G4 for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FzPwRWCXCCKQYnBTAFHn9y778cZwRN6NDU5bW9IbQ39/SkEBdjSjNYX1wODONGUdYarCYySyDpSygjpW5pA9dEzrShTMukCur9396rzby5eL9jc+sxLX4Ywij2VL90+sColXOjthblQOKO4ajwqttZ0MWdYMQLKBeG7R0oNogQj+TYR0RL8QENrFNf6jq+7s+phN7AvSgbfNAKr4i92su/6v6GoF5KpUigOl3PMt0FhySTXb1qDxnYEd3V/D4iDLfVP/4K4h3X8++P1Hq/xiZIhXgDE602sQeSVoQCxvppE1dTm4xO7KrpP1Ir8oJd5jSzwy0yKK0PbijxpO96V9Dw== 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=ipUC+c918Zso68HKWEYX+QniP/yvO2IgSxtYTfLrRBw=; b=nEG43+XfpKEClpuFdMgqw61ZeNS69QymRGDkCWcp9yRgLrkNs/d/kOYcJP0r9oMnEmlnB7HKYLjJx7Q+0HKPPJaLR/mZXL/tLJwYfIASoieVjAp/PKQAabyPAJEj+apKmQ6bR8I8iUp4hm9kwJ6ULrXChJmG/+aIeosS9UIGSZ7w5C8TMKP5FtyKL3/26YeFOfFZC8wDbv7KMwI0Q9ZMm8TKpSUP+WJs4ktQ0HvRTT/WnSoAU2UXdXhvlAtiGQMZt1Bxj3TKOGPKgsgMnYKQVqH8xeNYQlRdJjWOUPR9JMCv5953vgz46IKp9z/ci3/3NTQUM4qUhLTC6ZNLXYz5XQ== 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=ipUC+c918Zso68HKWEYX+QniP/yvO2IgSxtYTfLrRBw=; b=ZgHAlVby5pS2DvohHvPeQ9riPWSrzB2yC0+hlZ6dZitR8+wcFVp23R83biuaBWuVL3f0q8J+bUP8SecnXyhBj286jq0GJCmrB7q3mud55jD0StH0PpqzDkt9HvMudgwcwBCoXA3DJE4UE33URKOaHvVc1HYRzGrUoNEt7MeHLPVWgRtpQpR76hqXF9/rgIv2acIhDtdit4k8WyjJTef0T+ws4wqrrLifu7bWRl/5R3uwBLyb61pFzQuF2P2edw90Mi9fixYzbMzrob3xAna1edsp1vCpK5oTwIiqUi10azqVNbqj85qAUkJ/7ly2DbNUdHn/5a8sH15T4pJbFlkZmg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:04 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:04 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 15/28] net: fman: Mark mac methods static Date: Fri, 17 Jun 2022 16:32:59 -0400 Message-Id: <20220617203312.3799646-16-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4f0db102-3207-44e8-fa68-08da50a0b843 X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WjHlsOGk7VyODW2bd4M/rP/wGpssJ6hZmpKnZbGDV0wfzJZPPNkDFFqZkVAXlS/z/CSxviv5SN6E7mSd4TEclGdGdqpPcFSWvDqsx+kTd9Ip3MeTGjHtdlVMeeq/8BQxEBSVpXXxdatE2X+Gr7Yi6qKx4W9jcgmhRjt/z9ewRTlTipxcU8MwLJYoL9h+HcGG7Ug99wtcsQwoV/NcJnDecrruAbmg2pGy/3M3HtZOY+Cmi3Z1LhqFawuinuDadhIKG0VgmxjBkCm0iGbEO8mQAR7yxlufuOgkxMhRcMNo6kpRcGf3TkMdeld4GiGXG5CGrGGRTbZXxdnqDwyD5dErnOtagpysz2s8NGzWpqVtm2qwlSrKFdaLrET3bEgdzkZHnPZEpmW8rYOLXG3qd0N8KMmd04CYmJgYY6SU0spWk4gudXSi9ZO4ATwBW/JpqZlFiIJgx2rFM9rXy6Mo6CAPby27unGcFr7Km2VF4/Y9Y28Z0XJqoLuk2b777Wk0ESWc0nOkNJn+eU/O9f/5YacB7E+rAO6pkORIko0qOb1aBRBozl1zuoRPOjLAMKTJFffBbdmq2d0pVqrsLzYrsEaSRKdlQOt/omIUGnVbiEGEDsN0Vac2feDLjBd/EXDZNxnIW+K18viAKLXci++eXxD0tjn6NupCRX8Ar0GSd1fbF1BI9EZqsngn8xXrHeRAZ+ERtnc0rSUdS2/z1NmZ+iyOzQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(6512007)(30864003)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: G0hcHhi13iiIxX2v7zz6QzmBCyNoXLT8vFjR79l79/8AuorEE3gKxlnSmzGlFmu4VvOXeRf3qJzVOk2lLY9E+8jaOnZmcR1xR8Lyz3Z9FreLDgs6aQHd6Blu/A84u4q64sYbq65vl3QRfTjCeR+DDevJbLcSXXUtVM3TmufweggEHgo8vgPoDXAChoTvNlss1HT5Wf0q9izwLpKZr5mDJ/EhrRedL/l5mXOaqKqQz0Bf092ovbHSyrRBitRJoFGUsKcpye+OskRdOtW05AtX9LkaNTwHCLHMJb6QNoi8YknSF0+HPF++9sfOPVzzrXhUCxN+xy0cWDRZkT+9XCbfIibHFERPCIYxIZ/vL9hSzl4loEuEu9xeE2IX4swcUuil/CikKkjGXLPr2UPPD+bHqm2iHJh95tTgKdnQiz44i/N6uKfCTb+RGPfZVuvBS7oJMD7bbMuFFUrtUsOwSsdmjV8iqCsYRx+TCXhBU9svHh5OiZxV0WbZwQOAHdhxeLHzFIYPHXi98STFF0nMnT31VFCttQOeQwAT+qUMrmIpUz5Ve16YBXgIl0dlhmp0DoNydK9ChzVlgpODN9gVL4q64whC9kOCWY44NsU/xkjgI8oB8DivKHBtrPbZDNLC5m4fj9rblpbk0Mym6WsYE7nSyE+FkZUwLDwpJ1mvnn2zn+rRPFppyTOz8lCxZ0PjLlBXvy4Zb1jwA4aimy6JB8svbBvBPiOQk8nDQlbI4ABOAE11pGYppwJzKEuPBaEq0zWBNt3eI/RrFz3OfseE2lMB/o2DC9M01mF0aNkfO5CRle2Yat4UMzthd2saWSgnm5msNgDapperoyqthYueXDFPD0l169iy+IEXFDGgLLoatd8Dd8wjbsYw5wY/HoFpq/AOkJ3QS4f4EfAKXlceTfQMllbWy94h9EucIRhepelO6PXSTlaCOcCeaCgEs4eWz8W8gAiNPEiSHo2uBt1wvLyRMttZ1D8Xa8tb35QsgwXn5KsjnNFpT1VJAHplZDfYgzPwjc442rpouA5Wn4ejyBYy4mPOaXy29hAJrymO1QmmstspV95Xp6Fa7/0QZvWy4IEbKHCufJdyAOCGM+SA4rHOD4KTBLzZQaaxs6DRo9vaEP5CjZUglGLoa8DIDVVW8p2u1Rq5Ueovyxzi2k3xQsKF6++2bPnJcMoX5BRl4HzBRzdE7zYGkAKbjGKeYggbrELP/b/PSpT51y5k5ilJ8qpQZZfE+WpOnBDtsYbYSHjR8oXrDdcspqJTnTw29E1fLwkLjM4F0yJF9paOBjkU7/3cbCYTHQgNtgCMRIOpZM88lxDX3fqL0kXSbI60ZOw/BzH/kp0MWr/eCOZTcTR/tcPkYsilXUPAqGoDrX9heQ3EG2AIIJPzy7IFznKbIU/cLnDpMQsRtkh88fMscBKDaunD7SECgzRMF6yqdHb9rfzQycw28GHZA8GcHYct7bDFStXaygj/jTHZYO6f8QVPk1WqSxVI/uFDAgy9ZIV+Ty8T3wl8wzIvpZsvxx41khzm45p3ep5tZayVBMJ5yG1K3e0dXxoXJlWMoXSkxvQRswbLV4+m27d8AWpG5+c/hlWzaM9g2n2bFblF34ekC0peHfWC9yzf/LM7MYDDGCZbPSsBtJwMd0qQsUwI1amavO0PZmMbQpIG3UfmN77dQCDePDffC4C4TgigpHC2OYggL7V4LbCnJAJehFu15YP4zxbdDoiy1L8HSAHUJWymG3FYjX9oWqutSTStD8LfdnTR5QdSz3I= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f0db102-3207-44e8-fa68-08da50a0b843 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:04.4204 (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: mBHWE/YKUUtJmr5PA8lMemJwMzFuYX0g8TwhYBv6/urW5lOb4ZurqnbOaUy7AV0F9ccdoAQkuHoMtoPdObK1DQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133412_574573_2A5FF745 X-CRM114-Status: UNSURE ( 8.99 ) 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 --- .../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 12ce079a356d..8da50c56c440 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 4300a21a553b..2b4df8f3a27a 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 Jun 17 20:33:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886014 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 8D051C433EF for ; Fri, 17 Jun 2022 20:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vdLR6jPTkhwkdDXniPhACBLcTQgju5BS5rVQCf36AYw=; b=pBUlt65hzeatD6 TouTeNVU/xjKXGVdRr+22CZenzXjFAkqB9CDqLh8ViNG9XxLMTLecY+OhOAA0wG7ExSoFuVodo9y0 zDTA0MI5i6mELFOU75yKHDSkw/UzcBexJHLXNsXZwDffE727Qte42nc7h2qsYN1cwkYiR++w7xbVw TO63/KDMUm1PTbEfvWA/RbsV/BePHJz35TmDwjMuMr2KHjR3A/8Bz1kyUvO9y9ZrVVPD6WkUBMQ1R zEjgCxZmnk+DTv+Q0oYfP3z5HHdos8xpP78Q8TEbxEJotJ8xXhXnOrO9nWwpZEPqS0dPPBiaCTO6B I+vMKc2qU2qJCgzeULJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ip5-0091Hs-Bs; Fri, 17 Jun 2022 20:44:10 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfX-008xNk-NC for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V2XCZVK+gnOSA31zyXydj0CPHYYARcKvBS89W3Bn1mUwpz0rkaeo90YRn7y69DJe3jC/amFyH6yvesDOgUv9BJYjqmr4FZcWAOCbE6LP/Fv3hF2x6P9BHMjD7vSmkemCf1ESgSAykLNNpliBRGWJzbu5t3rGu3hpNjbXY++6CLR9WeGGMt4AV/0jr9wM9eVOJWMg+knESsHMcgN/3X3204ciTxBhiZdWfC9CA7qdOr9GXBmNlNAQ3+32s4oYRojKu3RGLjJ/C+vHsdV7CvNLAWV95P1tQcoHRwZB1PaynN/nOH8DGf+3ybxemT3wA5NrCqjMeSarB/Ec1jYtRHLnFA== 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=EwGmp4JothRZALGGoK3eVqxnN7ATYjCfhlKdCMgzcJA=; b=QgGJV2f1dJeJerqbje9Ypoxe2SRMoyCbB9kZgVu9IOn+gj7QJcqQauTUKamTWQCCz0t3s/S0U2IwIIUoAD7XmTQ7B3tOE25tH1MuAkI+YSphj5/QpkdjKa756O31vS3zuZqhZAtDI6LCZs0HPx+VJCYWvn8nM0MSuiMY8kWa+Khw21QECBV8SCrLthRHXgoWN9EMbQfcBRUoODj6G1USQ/aXyGX0Ba1COZtumqh3GpAGTsKrvGAkhxEJPiUlRNd1+/CRw6Pp3R6m858+gjxk26rCodJtqhvEyOjae6NHkQ0l656G/f+EHP2tZ/uOssJL5gP/gjNiuCIPVLa8H34d9A== 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=EwGmp4JothRZALGGoK3eVqxnN7ATYjCfhlKdCMgzcJA=; b=rOIS2mvMAfS/HeenrDecxPOEL2ROM0PN3af7Y26VajOqwNeWg81nw1QVi7H2tc/Bzh71H/UWvK117dCz5Iodlrdw7YVih37BHaQwpKRTx7VjBVfa8ZmuXZkOwgDHAiVrhw7qUU4gQmxNTqKkNNHzNQ24DQqUHITgCVG3TPxhM2drWoHUINnjmfj2eojSZehifvlCVzA0C5eE7kL3OogK2e5sDqdww9bc9BKdMRoHUl5YGCZwbyeYa13MC2KvmC24m7aKCHRovlzOpGW076yr+2M69IcSzyYo5JoJVMgaNis8zHoAXPB22uqUr7sQXQw0mO7SV7GVivSYjR2HVMVdkQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:06 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:06 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 16/28] net: fman: Inline several functions into initialization Date: Fri, 17 Jun 2022 16:33:00 -0400 Message-Id: <20220617203312.3799646-17-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 946e9218-6cc8-4e5d-d5b2-08da50a0b966 X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AzgPgX68A9UBCRqQCPyrFH6dlkhaFYjL2w6OmT1SKDdqbFKsXocrvMdHLum6dNNUdbBNPbV39h4k5uS9CTRio42IhjIH8tkr74dqn+fnZXny5bVeenWFDfCNlHZAiAPP12Pl1bYvGlOsQ2VN3VV1PIxMwNIXuYT1dSZDMjCrq3PyZoX7IoOZXL/D2Lj2hA+X3q0ZVu8P8/XjrNfPkP3ZXvaxoIrXHYawsQjlu5acNSjS4sTFrWBUPWuhjiOziyyfJyyo958fnOlpiEE0Fuufbe2L1Fl0iBBu+zY+sXYBNBPgIgkM54JGR7JSDV+d8BJQpMIr51KE+mGG0iz5j4ewT/2ZJNaaRUfpd01z1KTYMllW9BrCPk3q81QNZm9RkjQctLyW9tMfQVE2n3PrCZCA8HPi4EEYwt0mbN2Hz29w4NUrgH13is/ZrHQ/AWw/uWyAytXor4Kb9HJ5IIycXnruFxPrlbVJpE6ZgfOaNCUOPe/SwlR/CrYPYqSMA9CbktlTBakTSk2XSe9+cPWJEYbRb57pWkERqwBIfObwpeTM2STXC9bc7pFcLdfQ4IuSX/m3QUHnMd1SFwOys0IDW9OYnACJSNYDEiGecXpUkArdMaEc4NDMTYJ9BSGh9+ROG5SypbB3mWQfCRD2P3KYsWk+NuD5HXYFj9zYjGU08MtB3s83GEMdsxXQ/3RvMOBfRMilFb1wSdh1GOwyUkU0bNzj0g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(6512007)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UWVCDRrjtFHGjVw4J/xILBS0qdf/Dt2RAfI5FKFgssFEgRq7x1hQnRhcxIlyj6CPOXehQJ07MLiGWcB6mmh0iHk2VCVxueuT9dyraBami1BzNmv3uI9Y0zyMFlZpvMGWfvK8v9cMy2eV5fgH29D2pjjAg4UgUwRjR4TCLfYDMj5ZFlCQwOS2fsj037cLG32X4/hsDBDIohXC9c0/pT25d2s2b/Li2Rq/DmWJW16nPZA8eI9HP9kixRG6aO+iFWCpwAa6huyWopACgnpkc1QDNna8oTL8eE3kDwNIPtS8bem1wIzuSqLwWlvDH3em24EI+2SburVyWDu2yZRqRPc9th7HK1Gsmb435NmcyeIRL1mdxqUWf6Z4seOSS+SF3aqlqI5fVe/mPaPdli5Sq7US4qh19WmXrv9MiMQg0rb4/YS+if77IpO6HBtqVzwFqfZavc3Uxbe92NxulHmpOflnH38dPlNEkDmoN0SLq8W0muJmcG601jEvm3+H8JcsfnOX/OdQgSkkl5i/UX88EPkVzsEcvo007f3Fe9NIwEV4EZticbsnq0Z5aoNPLlX3wZ0CxRR5lSJGI/p1qBDY/OUfmDVNLre5Z2cvLSl855wlmRB1/tNQNRCK/KOQIr/EzNQQt+56mD2V9FFf9qUDL//tLgntpTtNhuoJCaupr2Sr+rNCBkBMJkH9kiQOWcKr7oBSA4PmWbODvAHiaM1Vkdf1/l9tmpA3xU49itJ1CSBE9Hu50m3yQBgBqGJCAYRy+fez+l/euwxFw7HV4rmT9m+eK1tbQoIz+RVnYQOtIBvsSrwbcrZ8CxVU9pCgBWA7uK02MV6vkfAws+q39zQHHwZ0VQsjqi5ryx1c8vDXIl1TM4QhRTPa94jslGrnJJJnqCWMozzv4DAnlH+pxSm3Wl3Ug6viL2KguX1zTw5ZfxMXj+wlUMmaFXGNHzaUfcXpP+wp1MZSI/CuEpPJfURQRVziO8xp64TJunm8KrxfnBHqrHdcjc0r6Uv0uC8aUTD7xH6jRYQL9/mDN9PjPkFAkbgf/N0OL+DC/ywBP/tqvNTcQ4dxWPxUMsTD3IwVrUoKIFN0t7YlLNMMVPZGKwV24Ns+jMb1SeKAEuX90nLhgWBURfV3Fu5RxFdvRM1Kk7jEB+eO3y0IrAWqs2lIQ5rRiOnUQ1pezTyrfgww8/fPIiySOplGOhMtoEvGixpIii/7CydnfukwYIDfOehk1LUTxr6C4Q1DAQVRa8EzLeevfaH6pDgfIeU32rw1j6fG0R7aYgVWS54uumfxkZjaq7FZVEkxJK6x8Qm3IYq1g930Hexl5uXd7j/HhOD4f9eDLL+1lddERBzcQ/EnFCOkJY6vzpWAWr2hKffB+NPTr/A3gBTzdSmD4NN4DPCG4zbdltelcSTbhtLSGcizPM2XmbGMpFoMqLK1kdpl4UcJWpG/UGIQd7Ab3DAG9syMyHefoajQ7wjXGzru+l/ETWmItxZ6zf2Go0eDE2ZeFZY/6EnzCQ9E74R+zp5aSppGdOIzZ8aLhTct+bmpvPjtbC4j/DcJaPn3S+A15RP+1pIcXcxAkqF1XNnqcJBlMRmNfRn2lxTE5zee3Olcd683iRrBF2h54rQvllUbMiU8fMnDqcXwQ+9Un3+7IzUs7J2j7O0y6ITWTDCrch9fdZE4aF8swOYxl0wATx2TToBZeMM8r5RxwK7oLPifZeUiwz6reKbcxQaKpglJMpV1DYt4Jyb5DhQL3PPaga4OzoToGN151RDBVuf90KY= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 946e9218-6cc8-4e5d-d5b2-08da50a0b966 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:06.5610 (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: McKSOYWuz5iLkUiep+m1YOF3V+1w6nskmactNmaCL3zkft9F3o7poAA1MVREBuKUkmw0Bx7oPAVU6HpY0kailA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133415_917821_1A9C0527 X-CRM114-Status: GOOD ( 11.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 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 --- .../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 8da50c56c440..44718c34c899 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) { @@ -1526,7 +1494,7 @@ int dtsec_initialization(struct mac_device *mac_dev, int err; struct mac_priv_s *priv; struct fman_mac_params params; - u32 version; + struct fman_mac *dtsec; priv = mac_dev->priv; mac_dev->set_promisc = dtsec_set_promiscuous; @@ -1554,34 +1522,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 2b4df8f3a27a..a97815287b31 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) { @@ -1207,6 +1176,7 @@ int memac_initialization(struct mac_device *mac_dev, struct mac_priv_s *priv; struct fman_mac_params params; struct fixed_phy_status *fixed_link; + struct fman_mac *memac; priv = mac_dev->priv; mac_dev->set_promisc = memac_set_promiscuous; @@ -1237,13 +1207,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; @@ -1273,10 +1239,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 Jun 17 20:33:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886015 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA9FAC433EF for ; Fri, 17 Jun 2022 20:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6ND/h7XEDkI41XAS9awUF1aIsLOx9TiROMW+myZ3VDo=; b=RtunTN1+JP/uuh 6PGvQRONm1vK9cvz4UuJktsS/hU4yj6N64RQrn9+TYXqjFufGEnZM4Aq87fe+oNW/H7XjZ1Wc9V1l PreosYtgd7rPJqf+0N9FZqp2/7sfkRYAPOo/OHlVBnNs/THK9lpk3udwju+eBS4YmrmLAd6cVqWAg drzc4ZKzKcYoC0RABExOe5ROR4RJw6CBEoWWnz7RfebrIHwQRuHsvVUqgXNL5XOIIeK0YAb9c/LoD ceubynnQO+ubH7A/kVbiK5W593gofvZm8Qf5W3Ndy9s/4i70vnRPKZdjs+2+xFucRqxBAvwnJzOzb cXLW/AInielh4SH8Au3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IqP-0091oQ-Iu; Fri, 17 Jun 2022 20:45:31 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IfZ-008xNk-Ug for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cL6xGsFdDpbPRv86UUQNsh4SEQNQVt0uOWXP3XDP2/g2tfJ0KdierM37MyIIUBpVc41FTsz3DmtS/dB3IrBK0Ouje518eYWc6pKH8fxeZmzGdHjMMDnZ7OoXbc62g4ijZN4VFPGqEquHrP5eVqiDtqpVW8H2jDPh4QZXFvKVB9LxFYLcoZc2IpUYW9jzzBggcHUUD8oeHGPaJBNz5Ry563LBOQZlS1Pc5tvIcY9OqLeo6JOWYcdDrOsnEzXuafMcqaCpHCQC+xwkQ84vsxscIM5XXiwpDFh4itpd3G0fVFVtVq04Zm5QuNOkFdQKYppBRD4nRqKAO9ug38iJn49XnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YilwA5Zrogv3QaWa3jbppLG2d8NIsOs1Kb7V6wRF9aE=; b=IiIHt+/WbaYowdAbCgu+Ts3aNEcesEs8MoKcymZ299w8DzFEEW9D/evC6hi6vtI4LuQlVq4abw9BrEK1RWutkf0l60/Oiybnck2EcU+dpBm3AuENaLXzkRa8KxEtrUAzRG3b+GsycF0LtqNw/Cw45yc3pxszBHGE43NfgZZ+bPxLlSrestvoyUeuYXWn0WmEklELqB++bk2gmmrMsanIB2Ur1Sn1jpF738wuxrjdzfpnkC8dLI0AuhRDzsf1XhZoGylykocPjsoBu4tR3vQbUi2yCE4RLLU0IJLk8ImFWjzvD94VN8960JPQ98FtZl4sLU6QJ30FYqRcmzRkwfYkhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YilwA5Zrogv3QaWa3jbppLG2d8NIsOs1Kb7V6wRF9aE=; b=vn0BKWGCkDX9IsjCpTNdIxBI0vgY6Qg5jQb1KOV05wXWZERW7qaRvDBjJ/RlWjr8dJLEvP4N//k0jwKioeTS7RxhleKiHQOu7XOdTp77gMZaXivoLoYuqKtB/iDAXkTmS3r0ToZlRdmsZSnkLrItpxySL29GUgFPRy5WCDpPU0Jwce/jdj42WL8BZLcspre8GFQT2hRv2fRGkUrLJfme8oj3ND82W0bgCkDF4GR+9NgtMyx+wphkhZbe7ByP8yG2nbicOs7JdteZllJ6hE9p13Zx8cFSd3T5wirMbks5+pnhOqCky2TqQ7crsRUhUtR00IhGKSKkoCDtoYXRJPbFsw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:08 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:08 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 17/28] net: fman: Remove internal_phy_node from params Date: Fri, 17 Jun 2022 16:33:01 -0400 Message-Id: <20220617203312.3799646-18-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 737a7221-0a90-4225-8827-08da50a0baa1 X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MKBzkpu/MeoQE13AEDqQsL0V2HYvyPTthPIwQgYLlX28LorSMI1pAf1Q6DKg2K8aFGWJ0IB3/Q/zSPn/fT5+UKT51lArEh9tLiJe7L/eKfMMZyn3kLfUheULv30u39bGwf6wrN5KCAQhwI0A84kbva6TtLLYfng1iNf0bVKfRxINpDeiqDM9kNDCKcKB96JWP5pfJancIksJ5oaKQ0IqUfoKgDZdM4tnugyw+89gTcXOfySMkb5akWrELEjqk2pWy49feLToSJg9lh5xJYS00mBwBKjb/9XtGFNgjsJln0dYTUdFyfld8NaXQJ8TGMN5xRX886mK6Ffw0k1ehtCCV9N4GuglV9K4aI2lbwnPzTCBSORTcd1v+VfqoH6xib2xA6heF4hlq1GgH1LE8/hbdAV1RQ5u+MKOhQCKn9FyZzx1D5FUFSKp3K463u4Zh6EX8eVbTbzUdoUAqID8jDb3huthKLV21wv1QXtc2lQgoOLVICJe+NH/45vS+vdg440SFEPTkZQaLw0D+avzwl326njlfYzlK19ptF8fK1QfbgEyZzMpII/1wgivXTR8DwWrVoasZlBNIdIjO1K5L7AUHGM9p+BNPLj7+9bxRj3rSRX7Cxm8Xe1/IPN5cV/qQn09JTa5j8R7d5CQ7gps53jQKK43vnFsQyvai0WixVJC0DDfBry/EMVobaYQ0OTVXmvB2RWbzByyF2NwiBujzqbIhg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(6512007)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pZYuFDIHPvWt0zcgtNgT3C6cNmR/LGbmT+etnS8T0QYyJONIubXLJH8AbwSTJzE5JF9LuebBw+oBoJvRC2aa4Sey5dODl3JrZQ/RN0I9p7zU82TLxrqK8yP9fisQtHXLSfbnbzrdqvQ0lWpl83wZAV/Rp5fcXRRynfvbyM/av81lbEntTE/kHbfVAzEcAh1b3vtPV8Xu7lgqJMpLjD2FMlsU96nqd6WEBqdqr6hNd1ev0IJxT2rw5sbqwwdt4niet5deOkAF3pzSiaMfAy+XmUDipCvx4LSgMB6bS2XJilzmvZlV6+6lAQAORItg81LXjeqy8+gRa6BGumFUFHjNioamO/2ncYV8Yu8BO7qyptcRqi8sbHBBJBMOxVNE3ixaJGNZYeATQuYGKLTMqUme42tCsVWqS25wnf4UtopbkgNE4Tgaz5SVKL5WWSw1BgXzltJMHMllFHCUFYa9yhMzA9GMsjK7DQJc+54ZbIS8+2OXWwDjpjS5flREssdz5HRKTdqpSBIfy+aV/CrweGVMPRJPps3usIxe5wYWDttWwnXuIWqvt4t8UeALZk+1O1MpKCmZ90fXJH3e6I2RVcXU4IQRYcd14GROYQ8fokyfHMKy+Qa4fwTcYiSZg1OY6XP+ZA5VrCIUwH5VnStIMpL6Jdz2XagXHRafq4Q6pfN9XMxhnyN9VCTS9GaVPz2CTZIhpfXiaVENCudkBYJm80AwtDyNJ3osyV7LIz8SC2jYDHBRcC5h6R86+W7L0fhBn1aJ0rMY9Rk9xl841flxnhSETPFxnMagKe6giEVG2KiG/sZgg6l6Z3gf2HM2xUy3CDpN9IuqrkOELinXfGEThO6v/9nBuSjMFQ5eD5QM1FZt2Q3KPPF0w33dyW4kYcaTR/bi015eOVOUqL+ZnedCz57a9skd7YaGq8LnXFm8YNySIbrjaP5RFzni6fphTYyLsooTVEqkNHVCyKmqhP6npBmQNGEr2YBGxDbRCkMDAfOY5JKz9BYZEpP5vOwUpaxQtdbMX2HlWxEcn+PtIjdnOLjLHbDptKPNyFu8e2YuAnAI30WRnx9zDLhGfLDcP/cruDAQLfIHuxjZn73qDn1wiuW9A+l/Kz9IRVqX0CXkmUU+vJG4XuiCrwonj1hgLmCORiKcKPK+Nmi56ftkBAF6q4DAvK7X53+GAKPnkRTsgD6HIsqAbwPuGhp2c/YRmycEWDq9c/3qhsNQBd95lhhGiwOnndeLIzGf0PtbkYU3ZOENCB3ptteAF9aA8bwWGvNDuFcHCZ11T7rdpcwRPwny/pjMAO29ryae1WPEkKWNp+SH7GPdq0s5OTLmA8jfOPmjRdRNSs4I5YlBatrMgyufClD+vgvOrD7FElTjqTdD1PCMBQr22qFzmFTFHJBt826luGN7y+oyXdKNFWY/Esa6VDLc5Y6y5F/c+tK9Acczpgac6Uc76T2MZllSYAGEnLNoQsS2jcv33roaK67HlvpkzSmwyoAnTBjNEuNbQF8gkAAr0IhDv9qpL7Gy3ukde3Sauw3fMjNos4iy/JWUDZORodiG0nuBS35MjYoe+vrIJRtPu3Fkb7HOKlhWWPNy4yF7yWpB1bCHHbVnR1huVVljzs3ysEW+8mx3b56CNdGFOpWgicAGqZhNAjZkbiqtnyj+heY+xmwgvwMxnGws1k/QY11NHlLD6dNlgAkNJF5YVl/7+FxE3uAFzWDGzn0pqmCzDrpeLWSrcZ/AzpE2np884/gG47VBDJm99yUaXzRPx6oZwn0= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 737a7221-0a90-4225-8827-08da50a0baa1 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:08.3890 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NoHTSbpJ2YdfdZ8zqTgx9w4ZiXuE6V8MSV/X4bLTNh4kTm4J7T+VqMd64JdNVIno0MxNH3R9Kwx+549EJtcKPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133418_040219_646E19EE X-CRM114-Status: GOOD ( 14.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This member was used to pass the phy node between mac_probe and the mac-specific initialization function. But now that the phy node is gotten in the initialization function, this parameter does not serve a purpose. Remove it, and do the grabbing of the node/grabbing of the phy in the same place. Signed-off-by: Sean Anderson --- .../net/ethernet/freescale/fman/fman_dtsec.c | 33 +++++++++--------- .../net/ethernet/freescale/fman/fman_mac.h | 2 -- .../net/ethernet/freescale/fman/fman_memac.c | 34 +++++++++---------- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 44718c34c899..b94fbc38cdd9 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -1463,26 +1463,11 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params) dtsec->fm = params->fm; dtsec->basex_if = params->basex_if; - if (!params->internal_phy_node) { - pr_err("TBI PHY node is not available\n"); - goto err_dtsec_drv_param; - } - - dtsec->tbiphy = of_phy_find_device(params->internal_phy_node); - if (!dtsec->tbiphy) { - pr_err("of_phy_find_device (TBI PHY) failed\n"); - goto err_dtsec_drv_param; - } - - put_device(&dtsec->tbiphy->mdio.dev); - /* Save FMan revision */ fman_get_revision(dtsec->fm, &dtsec->fm_rev_info); return dtsec; -err_dtsec_drv_param: - kfree(dtsec_drv_param); err_dtsec: kfree(dtsec); return NULL; @@ -1495,6 +1480,7 @@ int dtsec_initialization(struct mac_device *mac_dev, struct mac_priv_s *priv; struct fman_mac_params params; struct fman_mac *dtsec; + struct device_node *phy_node; priv = mac_dev->priv; mac_dev->set_promisc = dtsec_set_promiscuous; @@ -1514,7 +1500,6 @@ int dtsec_initialization(struct mac_device *mac_dev, err = set_fman_mac_params(mac_dev, ¶ms); if (err) goto _return; - params.internal_phy_node = of_parse_phandle(mac_node, "tbi-handle", 0); mac_dev->fman_mac = dtsec_config(¶ms); if (!mac_dev->fman_mac) { @@ -1525,6 +1510,22 @@ int dtsec_initialization(struct mac_device *mac_dev, dtsec = mac_dev->fman_mac; dtsec->dtsec_drv_param->maximum_frame = fman_get_max_frm(); dtsec->dtsec_drv_param->tx_pad_crc = true; + + phy_node = of_parse_phandle(mac_node, "tbi-handle", 0); + if (!phy_node) { + pr_err("TBI PHY node is not available\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + + dtsec->tbiphy = of_phy_find_device(phy_node); + if (!dtsec->tbiphy) { + pr_err("of_phy_find_device (TBI PHY) failed\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + put_device(&dtsec->tbiphy->mdio.dev); + err = dtsec_init(dtsec); if (err < 0) goto _return_fm_mac_free; diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h index 418d1de85702..7774af6463e5 100644 --- a/drivers/net/ethernet/freescale/fman/fman_mac.h +++ b/drivers/net/ethernet/freescale/fman/fman_mac.h @@ -190,8 +190,6 @@ struct fman_mac_params { * synchronize with far-end phy at 10Mbps, 100Mbps or 1000Mbps */ bool basex_if; - /* Pointer to TBI/PCS PHY node, used for TBI/PCS PHY access */ - struct device_node *internal_phy_node; }; struct eth_hash_t { diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index a97815287b31..cfa451c98d74 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -1150,22 +1150,6 @@ static struct fman_mac *memac_config(struct fman_mac_params *params) /* Save FMan revision */ fman_get_revision(memac->fm, &memac->fm_rev_info); - if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || - memac->phy_if == PHY_INTERFACE_MODE_QSGMII) { - if (!params->internal_phy_node) { - pr_err("PCS PHY node is not available\n"); - memac_free(memac); - return NULL; - } - - memac->pcsphy = of_phy_find_device(params->internal_phy_node); - if (!memac->pcsphy) { - pr_err("of_phy_find_device (PCS PHY) failed\n"); - memac_free(memac); - return NULL; - } - } - return memac; } @@ -1173,6 +1157,7 @@ int memac_initialization(struct mac_device *mac_dev, struct device_node *mac_node) { int err; + struct device_node *phy_node; struct mac_priv_s *priv; struct fman_mac_params params; struct fixed_phy_status *fixed_link; @@ -1196,7 +1181,6 @@ int memac_initialization(struct mac_device *mac_dev, err = set_fman_mac_params(mac_dev, ¶ms); if (err) goto _return; - params.internal_phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0); if (params.max_speed == SPEED_10000) params.phy_if = PHY_INTERFACE_MODE_XGMII; @@ -1210,6 +1194,22 @@ int memac_initialization(struct mac_device *mac_dev, memac = mac_dev->fman_mac; memac->memac_drv_param->max_frame_length = fman_get_max_frm(); memac->memac_drv_param->reset_on_init = true; + if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || + memac->phy_if == PHY_INTERFACE_MODE_QSGMII) { + phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0); + if (!phy_node) { + pr_err("PCS PHY node is not available\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + + memac->pcsphy = of_phy_find_device(phy_node); + if (!memac->pcsphy) { + pr_err("of_phy_find_device (PCS PHY) failed\n"); + err = -EINVAL; + goto _return_fm_mac_free; + } + } if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { struct phy_device *phy; From patchwork Fri Jun 17 20:33:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886016 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 5AC6AC43334 for ; Fri, 17 Jun 2022 20:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mWTtj3FrFmiMJWTRRCsgckDsdPdCTptzEOeRNNe2Mx8=; b=FMXIV3sOUS5EBz 9Co02RBJsQa3P8ioXIoQUjVb/0JgxF1fj72B7nn60+cLbIuJoaYwZEqNSIh3KtYjNiU0fYkLmDXTO nC2XMK6UawjGCWKSyvlrDR8nzWRVfEA0GcXRtvqqgqfDeNcFBDRuzGSVoTLxYGDGSSR6YOWUSf3D6 +su7J6Vbg3u2JpmXgphli9X37iePo9QT06i6F3xi4ACUr7Iwjaw7WjkxkgAutCKySxwTtsdO5l1Ml tYTWnNNNhRkAEUomorDqHcyErFFoW/5lqgBhA8liJDWadK2XfdvuMKcP+NXiReX4ANLjG3B+hqeKz 9yxlyxnexihsME3W66/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IrM-009250-FW; Fri, 17 Jun 2022 20:46:30 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ifc-008xNk-0G for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DcyEVJQA6DRyDV/1KXCMiXPY34+GyXOIj3cKZ/YWGJ27MP8QzNqpTsa4+5aZ7hn1tziqD0DBJOgTSB53Anai5J/Y+lFJm+nMlk8eW9UEF8gn95E+1ZTROw14jqG7Fh7ST0+97Nu+YbpUM3D9zPX/SC/2BYZJo3A939ZPF3u/S4DbOzkewf87ZqqBkN2NJ9SGKzdz7sOMRZV73AbTtx9A7qhmb8SlhdW/XnJhyM6C3l6MQp2NCuk4jrNM1ntoTkUUzgI5Cx3kT+YYs/hSdol2PeikQr1KxI02M6Te+amWv0FedmMgM8GOEIQKlZ6Sg61LTvpW3lK1sTodAGBB2Rp2JA== 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=qeAub3ZB+ZtRPDlOvQWsj4lyilhVkwXmayOKHMjCVbo=; b=grnJPGm/B41tnAVR3GwWHnFzPjewRtTP4ZhxBMVuM6XJhSDwwbfD4e7RT9Z2l3UtSQMWwbtYAIe2nYhfmxrAcQ3y0Lw1d0TTi58H+RidstITXZ7u8C0GsAlbJ90coQAIOWLHZPUAQTucn1arzh8kFjCpbtBbSQ1KtO8zJrij9tjQFVKUoua4VvJJmmUdRf4OJqt3uwS0/pq0K8bLiFMubWMBI2mtxMcbes8oLz3GxTSvucR+62uaQc1xc7EECrZsTtYXR7D4ScLS9wMyralKvGr7KjeaCFvbhy8luFetFkEgzfNMz+okMtGxD2kH6F0xgOwGA+Dm5RP1pIUYeByxSg== 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=qeAub3ZB+ZtRPDlOvQWsj4lyilhVkwXmayOKHMjCVbo=; b=2XxuRje8rXBCifaAuI7H6NOGQAfgzdb71KK5xx5gV8I9pEx/g4tBlOtBNaY+vyjTosGTFNifbpC0mA+7b6IhInrHkoxj1NSTM71rYkM2eBeMgQ37U/V67Nk1Lv4TNMV8OC7xS48UO4kiCsK5P9iRzStzydLdD/3jjg8pcMje9VpJzW9jhAR6MN7Mezbuk+FlTFZf+jLXTLJylhg/bVBJfN2WJ6AlH8wBcOKENT2LP+HgFCfKpYXGK26Sd2OVCgdrsawNvbM/rNpnUeGV+4wvqmPzfBwLQbhgcPvvqxyFJ5noEZHyeGnHbigj74RW7uenVf7pIZda3E0EHsc98PGrzw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:13 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:13 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 18/28] net: fman: Map the base address once Date: Fri, 17 Jun 2022 16:33:02 -0400 Message-Id: <20220617203312.3799646-19-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ca665a0b-18c2-447f-9ec3-08da50a0bbbf X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2laKi1AwFhP1F5HJHefZ8tdntWM2KIBB5zCknopDAVq9M8Xf/y8kUz6K5/SSh9ArJ9rbhUXU6JJlgC6ZPlD0Qc7ZbW9w5OE4Rhkhci0xZokMaQKOIi4BPR8BY3R02XmdgY4p7BuD70SZKKZVko9SAz8rmmblLc5eNuc6iM/QOEktAz6+Oq46tHsxeDVWEXQk3Gd6FaoKmJs//FjRxKNF2xmr95zlwtdbXhKd3V5uhHdKDxLHZ7dCsoNrJXheOdkY+CBXpWOD10qAzKfU72MYE1ByN5fWcD7LVxmu7Q7BajcHwheVZ5Zu1Q5P/3k/kAivb67KKShCnrymUacMtYD/IEtXeF5gn6OKaSAz0R57fcBFPGu777+vB9SG79Ag4yYMEGWgSu8W/MFVSYuKALOohKyPxJAT6VPkMLqlILFVYfX6XHLJXffIskrVfl7J56FP6XEh7HtUJtwvJTzp36T986dAfZOeTA5epDB3ZB+8HMMJKSgxbYeJhiTp7g0DGU8afzNb/2VWCUYPMG+OR/Ch52LCVkRnDhv0iufUJtp4BTQ4g37lnK+/fz/vx6dsBLiCVKiVAlzElFA6Pev7uHcE6vh/i1xHsOMtwJicHCnNe6MnH5pG+Gew09uMZHmz30enhadul+/1Uvi/Ln87tvMO0NJ8MpcZ/tZrn3FsjWhumKxN9frjCRw8SG1K5XBWGzMvwNC/NZDd0lMt1AteC3x72g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(6512007)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9H6V0bxDL5HhKmoX1kgOVgrckJd9bR6XMRQTFidc6hniytMHDTeeHqjFOrwnrmcokgkpBrQya8O1PJZTuGt6Hx1bEpBgSQODMNLSDrRERTljuw8ufZH+FBRTmNr6hqhTi9IVRKWQLz4PulwQ4jCDNLNphDs41KaEH2v9YYc6u0GXHLHxbl0S50XYLYR+TJYCw5p91p0Ss7WsGpne6vP/uCyqPVpsavAFlBcDQVN05mvsRUhX8lPF1Cn6axaDbqRJPdEDxmS7GJ5AsWwHRMvU/l4Pjfrj7qETZ40POM1BsN0k8D+dildx6+mI+ViPrmB+XrySn3wV1BIgtV5ECy8XBWc4YGlHlIP3UyiGbFp13WZGPAGev0YtnDeAwEbyYtAzDAtYuQBY0fNvgL4GJbOo3iyw43/2hbFHAfb17NP+8GgZgNA0jqSWfaSQ+kOd8nVclHuoL9pVh3xXBpXbvz8bvUKNvyxY7OUGhwU1tXCEu5BYQqgeJFUgUtLLbY6VxEZkmQnpOnFrjLfWyASa3I84EPXIP7lrpvbs9WPjXDkVqegwRLzKpeHi3Gkq71+tAbjUB2vu5pNTr8ZtH1dQ6zPrRLkJmbIVJ6NWNr30o1MQXs0r+e0bcwmAa/49hhz/r0QGZQlxfHiRwPPHsuph531fyL9hI5q1W04KtiAdytZP7fqYBHMQ4IuwncBhmNdwGHVmGjCmSv/ZQ3da3D7U2kDYT/iGj/gpPfCjIrMb97jA84YoO8CKZKKTiSdNJv9JXDHjDevV/ReUCx29imXhbwzwYfXwfCSodRNwDXeznyEtHECVBNRKLpYtb5+FCKUimkpXJsovHSIFfzRK4r2XbwZr7evMh5k60wtv/2XEIN6nxRnEHl/o+ZJ6RJSQJWDHNcisdVpDb7Q2FMurYSMw/A6bqgfuBvFFJUkebAz5oU/DN/G7zy5fU3ko5/x6iTLCRVjmhfAoevwdUh+HLFDWp89bHqeTNrEy5pRT94mivbd1RTVErqr40fFd0i0/AMAa34h747VJjIqyq4WCK2nyS7LcOCNh2OFU4LQIPr12rMbj4cdtvGlemNHiQdqBbgsuELeGjp6j3ko7Mi4V75HV0AfPdNGgNaTi3MdAf729HUDHlHpQUhptBhDvwKGDIXR3ONj8aPFwdScMfh2C9rkwEcWI4MKd5QBgtZs2FUlulN9jC7yHROEZ6Oa1iFI6Ky8dvw+vo9lJOkaK2D2iXz14uvb0Y3usaMRIuiOqtBh2UJH8uGw5hZ3yJmGOqFMJcHGOw80Ia5Vr7L6kkQLBMRpuRSpDOltCw35IGDf0ixXIWAk+FlruoCYSge2C1mkDT48skyLUa1zlZgSUInmKauA9qlnBYC6kM7Qn06f0sKsvzfEHR/hpeMQt+ycFpiKGZrxvBgvL+Yk2qmbn01AfMrmKDZjIqYXKetc8JvCEfITPrHks6CtLzrIsPP2/SBjzHZv5fb3JL4Oyn1TGDLcHE0/xXWqYxb5Wi8MK3a4eTd/bitU11dCENQ4HMGKLVSX6MatLiBUmtujzVW1pO4aoleHzl8ujjjKW6wspaxsn87fiii24ziKzT/B/KEUEgl274ghMKPXxLZxcAStNLW2V74CZva3Fi00Z7GujOiivcHOm6ZfavcRSTR4EqGFlXU9+9s5O8IOyptaRsHnd+CaARuCljLuyx29yAyR6ZS3UjlagdB6v9dYW49BR25CY88tk3u0mOfaQ/rp3CK2SNbTYbFQi4EENMnhHZUDZ//C7+Ydlwm1qJBo= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca665a0b-18c2-447f-9ec3-08da50a0bbbf X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:10.3733 (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: neTcmMYD9AFLTDVJBSJwa5+7c9x3iRUKh14tz+h7JFwbnddUCs2ZD1HiPse0BV/eEv0iJ0dVISct9ffFzzbhcA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133420_081606_4E142AD2 X-CRM114-Status: GOOD ( 19.17 ) 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 Reported-by: kernel test robot --- .../net/ethernet/freescale/dpaa/dpaa_eth.c | 4 +-- .../ethernet/freescale/dpaa/dpaa_eth_sysfs.c | 2 +- drivers/net/ethernet/freescale/fman/mac.c | 35 +++++++------------ drivers/net/ethernet/freescale/fman/mac.h | 3 +- 4 files changed, 17 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index a548598b2e2d..d443d53c4504 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -218,8 +218,8 @@ static int dpaa_netdev_init(struct net_device *net_dev, net_dev->netdev_ops = dpaa_ops; mac_addr = priv->mac_dev->addr; - net_dev->mem_start = priv->mac_dev->res->start; - net_dev->mem_end = priv->mac_dev->res->end; + net_dev->mem_start = (unsigned long)priv->mac_dev->vaddr; + net_dev->mem_end = (unsigned long)priv->mac_dev->vaddr_end; net_dev->min_mtu = ETH_MIN_MTU; net_dev->max_mtu = dpaa_get_max_mtu(); diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c index 4fee74c024bd..258eb6c8f4c0 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c @@ -18,7 +18,7 @@ static ssize_t dpaa_eth_show_addr(struct device *dev, if (mac_dev) return sprintf(buf, "%llx", - (unsigned long long)mac_dev->res->start); + (unsigned long long)mac_dev->vaddr); else return sprintf(buf, "none"); } diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index e33d8b87f70f..e8ef307bd1ca 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 */ @@ -67,12 +66,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; @@ -309,7 +303,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; @@ -372,30 +366,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 = (void *)res->end; 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 Jun 17 20:33:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886024 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 A225BC43334 for ; Fri, 17 Jun 2022 20:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JmN2NswdbiAbyo0hMRBjRxuyms3F/vNqvCTQstnVKB4=; b=FAyDNRn334H3wn FaRLUk6+kxv7bzJT6utaBkk6i3dfZovfH6X89s0uR1zkAbbvvLmB1zHQCWTUB1r1hXFYTClO+0wwx eGu9UymXfRfZiVEKaYE5P5dCin1A5/FlMpA6f6Kh3Zvq3Zt2GofrEvShDVxU/eupB8d8uHzv6wl3o 6DiRK5bhDcFXd7KWYlaeSRidwl13wFFGK7hw7HNWy2m/7pO3tIaTsb5OhbIxEgrE9Xb+RdsrqrAqJ JJjrMyE/BqyWGwHaQ6PzL4P/Lesr2Sw76URv8PzjGXp0wLf1aM03cKIPKKtHn9JzatMsWXJA/MO4u w/EXoIuNmBBxWiHehsqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IsE-0092KA-DO; Fri, 17 Jun 2022 20:47:24 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ifd-008xNk-VD for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EbTC+KLW0PA/8qE5wQH4JDOTfqScU74mAIiKv1mv5gsy2LWIf9NHJwKjam7pZrp/A1j9/RHiq5BrP3pVzqu8ynH27u3GAS070KJ+NkkVf+9S8H/WREUuK9pkkprolRAwMno3WBmIVejyGRklomeE6c9VWPI5gsE5XPaKp0dbPNfFUaSS7hmBBPG0LK7cEKIb5NfN1Irp1E+uoaJxhXQQYh7DPJUoEOKMSS46OWCh0KVutHmFcFeSGqdWcPxdFfnB3DuchITT6kgmsx8pcMBxC+0i/3DtqGVYlZg1rFMVTS5oJ9ud4Aj8x/Cb+ymMutpzRgBVLg+Z0nlR2rQflbycPw== 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=37/Rtds5AIbFCAahtmcRA4sIwlmQ6ktFIbKivVSu7pI=; b=A02JQ2dAWpObdf5f2uXpo80+omyy7EuOdKmalUYomaFGqrvYjeoCT4WMCQCb5i3uk4Gloyq0QEeuehvIuYNFK5h4lIm19UEQgLkFSdgP7r+kWAdBgt1EmWGYbuxdEK5bU9mEDQDBvO08Iy4/FU2bUTkuR7htcKk9/vyvrpEOH5OtGRjvGjtMSTI/UrxD7+BxUDaB7b310Bfdh0v/e/Q1UY7MumPYE9Nj+ax5L2sL3MJCj03lxyUpsyPfE5rFg5APUBNo8YVbzfqHx9Rv4lW6PJEq9542jUdG7gCTGRl9+/iqoeCh5tYofN+HtKYnDCm6NAx+KzVT3Qeuo1VU7yaVKQ== 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=37/Rtds5AIbFCAahtmcRA4sIwlmQ6ktFIbKivVSu7pI=; b=dt13Xexmfw6vCHgQO6QL99pqR5KvLa2UkN4uWD1LTZTbQ1MU7BjUAtOKHZ3Y+Yoqs/eEMJ62nL10Tu+yZRljZACZh1lnOhsNuMnM1CDIpbT9QnX1EqmjDQMRpwpR/ZOIdzRAS6zTFJvwBL5UtQS+pQwQb8t/pJFyNPRearhMkdYsmAZU/e777fW+mecojl9PSXM1uE+pwFGxoNlFD2rkeydm4G4HASstTEEXCh/vcQJwAnTbItxTHZQeIDCazmhEXIw3L/JzcADqHQ/seWPnE0oQgr8FdZQfm+pLDbQfv9CG7es7sKtJMeqxZgadiZ1Og+tXcW6NG6mUvKzSESd9Ww== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:14 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:13 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 19/28] net: fman: Pass params directly to mac init Date: Fri, 17 Jun 2022 16:33:03 -0400 Message-Id: <20220617203312.3799646-20-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f5ddd2a5-4469-413b-c7ff-08da50a0bcf0 X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ricjXUf6MZLm71rnWLX0oD+QdofJKdCfB+OnWNMMu7olyxS7dg4Sx+IFP9QZICDvKxAo9Wf1Ex+0qVlL+q40QSC9grhvyQLb/AKK0FVM8GMBImJ8FNfeON9PgRyy4WaMtzOzxYRKp98DT3h2/ovdtqUaXTwnsWhDsFrV+2CCqmnktfJdg1xrUck4r+Ri8v07A4cPvNPnTzVi5IiUhO2e+zvtItRsoExOhztI9bZ6H1DgWPEw84n64+pnw1EHsy6r0xovV3zdcGCN+i7hWa/j+fNf4H5ybxjRMpgadY3wjbn07OlQy0HJTR6rB3CnxXAEb3yJoyV/63nxRvhj6vVKlD8DBXRJx06fTfO63lLTOyLoFQdxwsveOhEvrZpAhi5QYU9pHIw0w1vmWL8p8HJfVKsMgkGAY5xDsXOFlwfsFFgqiiK+KGcZoAE2LqOCS0Rnoh1jxGm9JVbStpsQ2a9GvQoK3Wo5g1vUhviFd162aM7PXsoakMR3gHcPp/a/dZrHQL6gBeQqAVhGu2Fhr1aSS74QCf64RGYX3ebsYALrfLaVNH6Ca9rVCrk2D0UGLz+zHv8p3t/SwS0nw+0/ZCxk43sgsStFqBlLKHBSrs9OZE8TvRqYqTDIqP1eAtDy5R6VeJiy9miewU7Lb0ikh1V+cTfdfsjPz0sTb/N1bDZGE5nNUOTjFRE3xCU/N9vTOq2xwhvhFZRHYV0Emj25Wgzauw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(6512007)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mv/9pDe946aer0MkeJ+FM5SWrzCelxNfcZA7xnxaXJHuKJB5Ouqzh52lhazVYMAEQIXd5Lzp7MrVJoALV0ilo9025NSE5aDcP/ObTQYvLult7SLYfZXx9u8oQufcSHup9JKjKhMsJNotquaQQUAGyXSzcIFXcUiGjrFQRdAW+3fvsPp8swO8dEHQCVHzxKoKItvNwgwcejnnxRZGH/tQvObY7glP7UICHa7hk6NQgYAosSc/hk8nNugjAJTDuE+1OCv7+j5+aRq1dFoIi7e27k905I/0AVGK99V8jBDnvKwOnXzt/E9SvriY9GRNia45cLm6K0T3TN5Rbgt4NQqP4qDIvRgeIJTsQcCHqsfGrICpz4CVeTKvV/DVXskl8mzM0a0KKyYCsfQvWB7/b/8QNeXLeOFdL98pIEgJt5ieEmeNFAYFNmhrt1edgC9JtnY92WNWhu5YA8HyeGJjb6JOldbnfZcTFPo/bJJ5JkI8+sv2Ay+NO5eh2OPCbiImkt4DspKPR/p4zDz0e8sjfLatvMetx/nxt3D6jGhS6rqa3+wUSKMaZ1bqdgn/DjsaUS1i2pfzUoKuCGnLqb3T+u8IWYLvRbLuEmKKQWrXVs67Z9QImImNm516bZKpCy9P8H4AzzLGVUg06R7ehlWxkdLUCq+8SB/+hZNUoKkNs3QqF5uJ6u2nmRxu120ZfsHgM2UGCNb/NwXGtOdQyODQlFltDomE4Y/mrOjEAMynQrfz8pH6E5SLKjvYpfz54UdWsBtyKBONErzag5y2bMdqbwpaQdiDDY5p72udUy8cg7op+viN1rODReRxZkdL79VVR18E0rVpUGRBpcJ6KlQqov3yXDxq/YsYxE5yFS0n6+ydLB74v3Vhb90a2fneUAZinEfVpn9astm8vAH6VVabJa/jrROunxZ1kzu4yuK7XkyD+2xGVfZm3y9IG9S+AaaySYCRNljRzq9D/Mqsg39nt3n0yl/+7oqpxTN8TN18kiAG9QtBUt4jWWq+/Gs+9YpjC3m6nXTaitOm+ZVIFs3WrlMhe2h5vvZ+fCYzPu5cRUrlbbwYcAWXx4OnZ9dvr0/m9BFgnBLkVhRATFlmHqNtRdTri51/xzQMOc8cXuZhZhthAmJ0GKslEAWBvfXn7U+MWYAhgPYXGKYx0FW1Pxe3mrKBn58cdz9sBUEMLDeS34xxnzpsUl19UiEFSad+oWNGE9nPI5FGyNW0Z3kon83WUoYcEZh3jGiM1+ioB3NPRmOMDazAhoYa9JfDhELVcK5eGgONwpRwYV4DbkQexQ7m3cBAU/6as92Cp6HOhPsP1cpAYy7oNLnNstZ/niANoDaXClRN7tLpDtDi+/iODQICB3e0jtcs9UrZkQKZgLIpwQf9Mqphx7sxlhnPF9HTrjPCi87ix86E5kqlRqoV4S9pkF55CwVv+bLOBC1Sg+oxZN35PajvhdUnVraDFZEJaJp7kNl3TpEqe4NygmWc3q38AP09GpwZMCV3MfOm0q5i76xA50DvHXV+vA7W/POECdIrdLvd5iG+eSOqK+XNUKpqBqmccC6TtQ9/0/kq9WFK1GwGVtLLMGuEtEKXhYUQ0j3MZ2Is2aqSAzioauTFDEtYupiNTgoqSYzeh7yvOQOhJYG+wG3H4sSeahWtTd86Uj2F0P5HlkQVVbUZebMeVBP4q5CKFhXz0jG4QgwVS5vQbqgR5AhgLkaaICUNFzKw5QLO0MTrRYj6dUYTWptvl3fPdI/kskZCeXkpYpYo0AYzJdVc99s= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5ddd2a5-4469-413b-c7ff-08da50a0bcf0 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:12.2482 (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: i8h2jylw79GSRnGOm4sPgrgAMdI7gre/c/5pX9/mXR2MzZ4dNp3jgv0osHXERfKsPmuMpp7z5Y7jZ1UmPkUNjg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133422_035985_6043E24F X-CRM114-Status: GOOD ( 15.33 ) 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 --- .../net/ethernet/freescale/fman/fman_dtsec.c | 10 ++---- .../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 -- 7 files changed, 30 insertions(+), 48 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index b94fbc38cdd9..7acdaed67d9d 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -1474,11 +1474,11 @@ 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 mac_priv_s *priv; - struct fman_mac_params params; struct fman_mac *dtsec; struct device_node *phy_node; @@ -1497,11 +1497,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_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index cfa451c98d74..fa84467e10da 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -1154,12 +1154,12 @@ 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 mac_priv_s *priv; - struct fman_mac_params params; struct fixed_phy_status *fixed_link; struct fman_mac *memac; @@ -1178,14 +1178,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 e8ef307bd1ca..5d08c4696c21 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -61,25 +61,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; @@ -298,13 +279,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; @@ -478,7 +461,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 Jun 17 20:33:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886025 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 CB9B3C433EF for ; Fri, 17 Jun 2022 20:50: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=1EpyP4wElmLw5tkijl/Df8Pypc/0+cP+geMy2FFL+RA=; b=lhCSsmwzOWLo5e /Tcf7oyv42QmrZeGWbzwGDZg0WewqsDVRIvXQ903qU5roEjBeajKNPSa/CLnahSncV2+jR5OZ49W6 bKi1NvNVE+tYK1v9SJSgf/+rIvY68/FDvHagNmKs5U5OIAghvEuaI8obG2goGR7zAy1Qq06G+mmAK mGMh+Wh1o/bA0ZxHhwKb0hze+qR/P2eV8UdRZd9E2iO6woxdCkb5q8291mnn2q1L1/c4Xu5cUaonl qx2whQQe3eiXqIGRAPndWSAE433Ht4vDPPL8IF5y9y15FxCFegy3ZGeVgUKf8zbOEUA47t/9Pm74O lM5EQCYVYKfHpxh/YJ9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2ItX-0092vi-Ab; Fri, 17 Jun 2022 20:48:45 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ifg-008xNk-5v for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n8LbO9XGOyTih7rpI+B01AMmTOi53r0coZhlgFoCE8FirnBngZNHlnwxe2QEnItiobM6H4FUNMsOLMzksXdAAbY76pFu7FiWT9N4IhZ4yMCPmz0aJ4Fskz7MCPXglVdcxgeOoqHg9PUG32Sn34xveRTKJrNgWxa3gWMHaXl3R5AWF9VowylgWFc/Vuf89jSoykE+yN0QCaw9mcTT2ehpx8FX/sGJbi+l6p499sb/I0oTSgQ9XmyruDTxgjxOis6pJkU8xWqjrVLlLEnsKYzant/+MUZe5rgdR98G76EPSiFW3dyI00B8mvR8Td88jpFBsRh/x7e1lGTDwVaHCUUuFw== 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=knf8F4siXxtCncC3B93OaHHxgIiSqV8hDBSDjUjkcCU=; b=PbKq6wuRInpP6UtznZtRFr2LlsuQ2GfrqsdwBwSXrlVk0TjwlgNslJogd2LJK56ZJjR4yxsDsXT6W1i6OgQ/TMONoSLnj1ceWYNxxLYyzfat7uVNsCh6oV5xSOdC88S4NxOrwi/VUxGGk9rViNQMJSGmNSy5NwmdAmF158HYnk1ojCCYLeqEOgzj0pavjoUuNeTziD7isgbF+o0b298V84+QCrVmVeF617E1KOYgXgb34X/ofENC/HyIwXZz0y3peGusBXeSxbv4inhl9CQxfNRjI74uGmzWKOEYnTnzr9OPVIipeN4U4sPzE4aNQlVexpPc55j3m+AddUCrfLqKKA== 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=knf8F4siXxtCncC3B93OaHHxgIiSqV8hDBSDjUjkcCU=; b=TrLGeKjxhjZcLJ2t6IIo+Mv/J5nG26PFwgOC7eSxS/l+CpAcPCTpIzQV5bwZi4LgAtTrc1qun+pOFz5iEvkOURK4IcR6cVW0U8S+JW+O+zEWpKGtdVnoQJ9VjTjXaTomKqawrCVnHUtBoWHITtlBGASUxaZJlo2AKyVk6lypLhcB4PYRmacRdJx2w5W9sV/ZeEZL1+n8SxGXgSUHDuValo29cxm2+JiRvX/CEDPcQPvsZxQoAdO4bNGZOvYSPCQSuMi5W54Pj7ORs8VA7JXiXoFOS2yrv84Pe5OqDH6xL5BaKGQhXdiSVr/ovNqNaa/zz2yDBadElM+ld8/rqi/brQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:14 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:14 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 20/28] net: fman: Use mac_dev for some params Date: Fri, 17 Jun 2022 16:33:04 -0400 Message-Id: <20220617203312.3799646-21-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3f3b51a3-181d-4441-90b3-08da50a0be00 X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r8lqS4Z5VuvipCt+OQxGqSDdjka6BFGUgheUVlHK2/9t0ugh+rso1A77Z4Rg1NASteSFcpo8dXO3OwX9ap83IZQjaOyPApxQhhO2VIArO+S+SaQmeiOeZZpUrWSffR38fKiQaOMncGNTzSG/VNYhHmSMfJGn38AOz4udhHrIKT1Nlx/nERQhsVkJ5uWfYMppeGgM/JIw0t70peIu//VvfSblsbaA69pHm64Golc+uAHIjxpZQHU86/T4gsTFiso67EXNUutXrKZZpl2eUv7yXxlmORVTkRom1CBKBPOTkyjco4TUnri6UEhTyFU5FhYvj945g2yVZME8CNZFp05tKAIWxZYMSqrb/sChKfMJta/uh7MBwkxm3EYFPn2wr+LU6vPpIFL8K2wLO7na0/6HpvhYGxDUa14qQJ3qSSOdycImh+3kH2me0IMbVJDkDTVRCKaUW9x1IKu6P49sFH+1Z4LevaeNQvZKGHr2NHxdlbdFsAmQGnI4nmE8NoIxDOar8xWnmTEMen7hziuzE6TrCJoGJg0F1/JRUfK5e5R1wlHbcSs5YcEnpdda81rlzL1/JX+tj7Sjx6iUm+RObwvFVtMBTChHkMWpiWNJlASeITI63O/axoc7Xa4TKLpj7C4nkXv5LSKoPghQs7i1mOZ0HPI2+QdgNIZ4otBpdLxy6kN/vwJWv5fyMyFFFK+AphU6FzouRnD1wb/Soi/+/78NUQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(6512007)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0S0gYxQfHBIcE9AFk9X9iAHJfk91aG5DC3QLpsYuIq1VZjLEjfoNB3BJ13o/Q+3QiqKIwEr+YhMuhtoWnkdu1uCMraOxNpP/3tS4i905xrpAPq4er0iYuhhi8zR/ydqKl+dhmOjYIt6rdkEjnc5QA7f9tRKQ2rYJmeYZ2+YTMCvDYrrYKEDHRADXRQVJoMEiRw+FuswqGogCaa/rcioJSKTGjx1niQMnl2EtkL/ENhLjFqC1+bLOslEET2DFZZZDIKOPnJ8eTkLQOnY4dr3FFYsObEiA9GqomqzKyfkck31TyilRA0K4N6bdIq0xuzYbKCU4eaL1/vVd/BTofoSRX33rZoWPTBQM4I7HxqMP15qOxVegs8Kqrlh5sAmt/CkrmDoM7CLsMqUnFrg4DOy9yTKymaixMlf9X50W3SOO4Y24PkfA1TAnsz4+fScVdmMZYBagN/irAPwL2tqt4s2Wtg8Kp541umJHwxfun+TfsLKkIupaYOo4CtF8AzhXqxaagHWAs7DB24Ub5rNLV3qQvTSy+z63JrmQzNbSpn5Gn2TNKAT88BwNXrnTIPfxY9771k+rSQQAh83AKESyBYgSXQ1lS6nWMIwL9LpqN1/gGzoDjXDhag/kdifTeOa5OviwFB88y7ra8vGOO9yAiBLDcIVyc/kqi3gNDpIlf9QVTEFHJrrYU1FXxYYZYTHD4Og8Obpf+oMvuDR+919xWyXkVsj6h+RGvAI+89J4daT84H1SFb/nFbdhT2xiNek60eurXS+yWsCMzUR1z0YkDA9NLu5UReZa6PL/ZC2us4O9XAl8yu2wekBYtvsih1iptBUynMKCKlbfrbyF7/YJjmYJHekl/yB9XQZk/CXZirfaTs8d23lQmynBW84IJDmq/wZvILreYnnHJFsFOLyGg9x6zJ0hHFZWDoz68j1pnabP33uP6v/9rfXJWnYYlOib/PBqkP2ueYx8x2pWUM/FaT3Hzv0WjqzRs73kDdoU4zX7OZdiUlSDqK4Fb4sbFhQzt2t2c5v6YJs5TWm77Mws6ig4JS5YOD7euABV2NTU/qtYvQdRTnI42kcH6mBaE5XWJNqt+g5yldpSYwt9IdrW6bskB4+8cafvVv6roiKxhmvy/I1YuHh6AR3l1Qo8sNkzaNsgEg8gXrK6s4aMlaValf20bH/PaK22Nq852Gjwrk+VWbMRTWShNiUv41wojpFB+hdjZYCPRo3Ud7hwZm1nu9SN7dPLcBd2hpzFseAvo+zAbupVvS7eCDIUB1jhnhNifvcin6bTOtjReo9ha2P/NTg7p++SWdogQ7HIY8YN/sxiiusrg3fktWjd9QvwzjBCIGrpYpXM/odyRcKquVO7Gsg6XVxo4hvW2X8LbW2Zr2L9FK1l6jwYN82DbSBbYU2S6HI+rrQVNGPtYjJZtNfH7wVi5h7qkzrbF+pm5E/LCrg0exOZhilPLjbHVSO54tVyKxrXFgJCZiyrOJV0D261Q9YH3AMMHpAkFBo34CkvtybokUR9I66U+miMBBL94vaPUSSu1Q3KJ7b7CNTeNOTUEzwdNDP7T67WUJN3SnXXU17xmHubdknAZU4UUCZPnHWJMIU/5ZzGjMhE7zV3rl4OosD+kVCphjN04eFGpjKEifFRhpmLYRUBzYAtSyLnC+ls70KYP+nJ0mXMDLanjNH0jtXzgfB4VZT5oqlVuHHgThdSK4+8wb0cdi1R5PBwlEsdq0JSn1xKOJtShHVaoRMck7ymHZqq+I3VIbLlJGSH5XfUZ/Q= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f3b51a3-181d-4441-90b3-08da50a0be00 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:14.1543 (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: RInXRH7apvkIVlFoGFHVJqlQAz3O0/b5VFbvYRvGOR0j/n8ocr/sH5RsfSy/9cTUnbFbC5Wwhu2jkZ3dTAaRCQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133424_405786_12791707 X-CRM114-Status: GOOD ( 14.14 ) 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 --- .../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 7acdaed67d9d..c5cc20b9ebed 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; @@ -1497,7 +1495,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 fa84467e10da..4d4c235d5dbc 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; @@ -1179,9 +1178,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 5d08c4696c21..88b9174531a6 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 { @@ -443,7 +442,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) @@ -451,7 +450,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 */ @@ -461,16 +460,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 Jun 17 20:33:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886026 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 AB6B3C43334 for ; Fri, 17 Jun 2022 20:52: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=r+aYzS6jnnRXUK8FkMFqSumlhvUPgoCWlZh+uoSHXVo=; b=aJxQmWmu6hqmXL ru38V/PIUz3yPFZ7ZiZvokximpZ+C0he0aF6CwDRgZ5qTaUycg7c5NeZIt1CKeqt7rzUwj8awFqya OAabNBVr0HLewB5S+CezB91KJy9duLdkMk3p27NzBeu0Vila4aP9G2b8tqwOnw3AL7XtzgbIMK94D /jbYJlZHSgAWt2qI6OelW63MG1xAUWytozRSI2KtY10sI6VkXWuhYkLe43jxz+QQw0d2J4Xi3F/P4 jecaApF+Gk0OQHo8hMLFVoXsA4Q8dKSbA7i9MEQr/cWMqTFK/Ka9uN4r9Bl1rLZzOkdMOpYzDuPaD a5b+xlvDM/F+Qqf7Rc2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2IvW-0093jv-NW; Fri, 17 Jun 2022 20:50:48 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ifi-008xNk-Np for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wnoce2BoY/C0mvGtRCylImoD/xLLFQIaLed+O9pa/wFn3Q+y0GMTU54cZn+/t3+bi4cOVJ3u3+nms6vm9N3OezwuLMRhmfdu6DohRxSY8dKdC33jNnMXn5kMzxLSqazJucj75uLV5kD2xJ/RwruHVLrEsg6LsOgxmRG/gQiiHxLEBDv8vUbMWeHZoPzsZOP37+yZE60J//OlvGl5/Nb+6Ez2tnHznE1thVh+QZkfWO0o+EG8WRYKaaCB+W57B59qvusVQwUZAgFNFwJE7bWVwQWaqYczWQO8IK7/Y6olNSR8Bpsm4Zp+SdlqKeLqUycbthdpNFXdIB729K1V02D5AQ== 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=TRXdOzZCVi20cnxpkis9AW2G3rEewNquMykS9YgRyYk=; b=MZ7ogTCtVRDLwCfZP0Iz8xWul5YoceAosReRUv8oqsjZT3xh479a+vvJZ6XkAa1P8I2G7ZJY6ONlhPIIwn/pVbN/YkEZDnjq/hK2CcfBPV7CZnOlZRr9d37pEmVA4zAbrrpXuqcpc4QjqVSr7zX3CgWI6ILdZlpMB3M2ov7gS44caYgcNPctJarnWscQUXwI0XJRpuStZITVSLUcnA4KpM/lOoCdb//ttc/EsPxxbZresWcpuXvC4uRQDJoGqOrjQ0erOqnJd9t6LeKVlCPysKPovUkFZEfUqCJAlZiLnJOk8SXyZouz7f+sMvaZ4+Mp0yuZxGfrX1ZTyFRjngV/yQ== 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=TRXdOzZCVi20cnxpkis9AW2G3rEewNquMykS9YgRyYk=; b=KnFo6HHBXrV44zc0VSJe/qeDQLgbdzj7Nt4sJ6JSFepA319DtfzePjRibtZtucEY2omeKxRk/5puspzwNUgSrkxYbXvRgP/+B23vlxun4yc0fa7hQpLRg+ng/Kg3zgythCPQjfNvaYWVjlY4u9IPN+HNlV/ffEShxhBRflNS2Zhqjkjvo9/Rh5M7snjM+wuehICwHHJCPmVcLxx5/15bbs0nDAxnI4puAh9zF0VR5AvZLoKCeTJ2fBzMnW54oiJ6yPoFmI49o2G2tMAKSQvVxr1GNTASDgj175Mq7ipk832+c376mX8Rpgbws1qO/R57immg063nAo2YwJRU/4aCmg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:16 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:16 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 21/28] net: fman: Clean up error handling Date: Fri, 17 Jun 2022 16:33:05 -0400 Message-Id: <20220617203312.3799646-22-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f72d07c8-f5f6-4fc1-6bf3-08da50a0bf23 X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3N70+p3NObThny4OeH2VsT1NB0CxnOvmr2KIuuqAp//0Q0nUNAxwsnb3UW18WX3kZNE2HdSZRqm0XmYGLNSnFPI+TkBV7KFBPS1w/t+bifPQeqN4NzU2S3AgygGZ4jfzBQWHKzjbBBBpEGkB6DCwbJBxaisItW/j8jkxeczQrra6QQMTuYMYrqRQ02r+G8/IhkK2f/QdQMPYUmDde8bPXNyNOnQ56YRCn0wQfLKf/VLrRopaSsXr/HbdOJ2D+Zuxpcd1U4NwgXhgQQb7XfbqBmQ7JK4SfK5LDPwxSrGhR/zk9YzsmD2mWPj1ug3RlvC5AtC83IRaecV9mzpnDorAZ3RJInFNUFG9UopdJvhA483nglmdIyLe3hP2+hRQ7G4GkyJFFLN24gfmX3eCIc9NEvz4DGZxrX5JQSFMnynC7G+EITuHSR05/d+B8kGT/6VvwoO16b6/ebgwtgvBI78b79QyY3FYt7GjT3wNfrMcweoToB+5D14+XFxEsafIcoI0z1U8svRi6zGyFbup3g4USJD4KFm9A2CZw14TVI4Jv55Uu+E6Gj7vo/QE+5qWQUKbWfSNlj67g/hEUh+mXqOfm8x8earum5l9k8WAG/dwNK1K5UDD927avoDo8Psj7iAsHFurjBrxJbKmEonatiHeuLe3r2x6WAfbhgccXpNADaLsxJIDwCbpjdxztyobkfEx5c+ZC7CtPoJ/U84cSDiucw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(6512007)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TnsvjU0xPekrL+Q2VSC8HlHYhF9T3woZiGJg7ylBjlMQGLbLMMvSJN1ZyKAn5lUJsump2MxkYqb73aQ4EX0iAEFBVbdQPf24CZuadKkq9T+Y5xbrQJdwGGesjjPOcXDuUYIzvaD0ok+ktq9OY98yWtyknsmbJcATWQ5BhswykAuzUMfNVU5bfuhH8OxXEyGqcAX4bXiTr6m+zdPh0SMwOWeOEDE2uKRFFZMRvvUKJnizkQxAYY6yAUQeQ87EsIM00hsQs9NcHgQIpf2ark3hfwKEtGycxE1Inw1XOmWB+2+EDOhmCFn8/zEsCTxR87FNWwVWi91FAoweaXBiiEBty9qNOdM9vN0zQYu/QiqWJzGACH79TAXiPRBM+8CNmWdx2o7IIjuhzY1r7KIAjw7NTYzJFQuyyCEZsh/+woFpMKGWWnLgyPP4pLRhOTNtNXyYJJ+XCMILVKqoK6+rJRC8CsHlzmflusllzjolqRrUNV6vVr/q+e+ogzx1+PsobDt5sL8Tkl2gt7TTambCD0IZsUNSRgSGBgjvA3+PHV+FlDZ5j2mqCqEXIvsg4ziSCjhZJd5BIZRHJ0XnPEDAXMERfe1JiUJCJxTapu0jtH4qrZcOy7Lnl8D9uVWfFyZGv/U/uqTCgT2sRIYZFqKwkWkiQG4N16u78WfVopoq+7/v/ubQUnU3kAsojd6t4FyAsp6HER+nQ86aX48ipwgt7/t5XnnP4sWu10M7Bs7dHbqC55B0Ucp9POkmXo6WpoNTPA+U5iOV7ZySo7gkAJ+GXV3/DsqzGb2cs18li6gN87/DXqxRZiOoZ3UAKX/sXo86WtA/kQNPzcC5sl93So8fpjhb2NEWVwi3k5mFEoCnD5s48Owz/AIr9ACTnf1fYCbncvaaeIpwSqM7OzX+/L0AJ7DEAKquKwvaM0OfZ5G1ZretyO2ROYf+LF8j30mvQhoyE9MQVLUyAwgC8BZdAQ2u89qlvfO37zz3aIPoYiVVvjQlGlzEZdlsdFj8weL7DU+GawSEEB5iIgLL47Edp5sJoXK4unbitED0StQ5sICfQ3eCGGeBbeoyaFi4cMmMDqPNHaLanhpg5ZzCZGha1YULXWkhPzIykj7LM+fh1jTlNcQFWbUUWAUK/YZpB423zK/6raqk87mbsKpt98JHuzwGyzrXJ601sbQsPNUPJFuxBNh0caRT47O/N3Mu9zGTXHFmeTiO5lBoxmxca0uCCZwRNUcRnIc6ScTindt9sObyiCn5CZmVnHr7F3G/HP+cgL1g3J2mH0nogyKtYWLeM74l0zA1Iy2cv5uhC/JA0SdpdqvwOje1y4rl6DTKN0kzK7qhF8pZzcW9S35F8KODYY1XfnRKltLyALMz5/fTulvHEEi0mnC2fdiB2Ks9HSgxXLK6olLVr7EOtLyHrQELiGSOXy3pwfgfEt+t1puU/htCj8zdE6Gt5AewpXujXYGbtpyCU5imnvrK624xcwbXw/5H2u5WfhZfyW0qOzWOIUGL5gWDCg3zGS/THyDZQPnZ3n1iyt7aseiiyPH7uboPg3GCu0CN5rACkaZJuYwXwqNmSXgi6wP9RW2F7gASaojBP+rFgnRSx7ZQIUjwcOdkVwDV2Lx8mNBZqVYZ8qOutdHOHSBmVo3jySN8lSpatS+nDFQiMyNgXZUSf5Fw03nUrrvgrqLd4/uehg+WB9acSNUZ6KFWvJ3ngTibqtP+yYoVtpYjfdm6Agkq8ZiGKOTB93SgtmM59VCSdltZY4ojBgiUKlAb+/w= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: f72d07c8-f5f6-4fc1-6bf3-08da50a0bf23 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:15.9355 (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: 3fp5DLcABROY7He1UDJ9xTklarL7b4OAL3g2DVsBwYG3hZI3uREdDyh4JT915QSr7N/zaxfFyECMFTmTi6Usag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133426_876956_91521DCA X-CRM114-Status: GOOD ( 12.35 ) 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 --- 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 88b9174531a6..c02f38ab335e 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -296,15 +296,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; @@ -317,8 +313,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); @@ -357,28 +352,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 = (void *)res->end; - 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; @@ -392,15 +383,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++) { @@ -409,8 +398,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); @@ -470,7 +458,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 */ @@ -497,11 +485,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 Jun 17 20:33:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886027 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 0BB43C43334 for ; Fri, 17 Jun 2022 20:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=P3kvNyE8YZajm+CjSVT5Mk6jZATqJIePHHCnaZ3FyOQ=; b=4dQlatsJw5zf+N GIFT/zH4UcZKXVhFXKRehluKOeLjdgU0TK+NFq1vXV4RNIK6jUBS7eN/rmsKUE/J2ZmDhpuL5kDkm oP7vj/7fRYgx9RUfGPspVBE7Qg6rktI3oqQ9Bh31C/UFDqvY0tE+tiYsRfXH4e5arW9dpVwqnGBVJ q9Haw2R0grp5WdfbxHUyz8xMqlohOIJi3gd0lSbdvuZG0lD1ddrsHXFQBUGWpBiFmz0zgaN619Pnm +Sc7Qidw9bcY0Gaaj24cRxZpzy94pFuX/q0CnQ1V+a4oaOcJZJhtSd1bMaUt6RDG1JeaOiOX/ftRl O31Kod0iXRrzCK6jopwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ix4-009494-GA; Fri, 17 Jun 2022 20:52:24 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ifk-008xNk-Tn for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V1wGcaXNGKWZxByN3dQZ3tlnbVt4mCWYnlOgiG96zEZo38dXRAuEtAwHHV6ndVZsLeKMRBT0CJZsjQc/t4fe+gPmldg+EXDqxa7nxLFUrWKbKELGWOx4F/vBof/CtfzZn9/D8D+V3OmUpvqZ6Gj6p9D/jPwU58Vr55Hw9UacgBl47uKvbaTMJeGFQ/5zya7wXvH0YSBqlm/lnwzol+RyZY3HdCywB2u3ONKg6W320odpThodLrALTuPnaJndaSyjcbvaaTCCvJ1V7W0K74OPRw5D7R5W0BicLrPkKnhUlIvG32doFNUaSaL4gnkFtl6VvjbHvd9kEU1q7cUSlfWm5Q== 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=CADaDmRzmKOMdy31UT6TFsHjJE6WK1kWCCSE8NrVWmo=; b=lUY/937sbn4kiPn//Gt0JvMTQ7hjR6N2Et7Ma3uEQeciLS4uXcF2trFHG2DPmd6AAJqwvpM4oBrRVP1djpUo0eUmmpz1Ac29akINqQbb/wJVvAWG535vBxwmDQKeJAfdGMiTb1bPqLo7rJV0X8s1bTIKNjmio2Epep4xmgnzQ77krYsVfJMCCoBWv+wKvAnaV+OjLw4cuMcEFhSzJWbRpClk/1ceL+hIU1+5LxVMpUVC+UHQJFyzULg7LlPBcXKYXZtANw8KknS49//89dQ2CyfOwvB+ypcVI7PBWKy6WoRQ6bLY30VoplEsSwzamzHsn0ZVo2xfY0KV01XfpwLVhQ== 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=CADaDmRzmKOMdy31UT6TFsHjJE6WK1kWCCSE8NrVWmo=; b=dqqayYS+DAuUUIzfL0WSVc7nDzVZt6bwmYPS6/6iYF817GIp4X+mxEFI/wn2bdk6ZPn8WTdKWw0V3n4TWQnDsq/Y5efidZXIeRjDSfje138w+pZwjWIXvxGx2l937/dtJQDjXy2eQINfnF+8DlgD6broxKdyAbCq4qe8yPyRP1xdSfjrudtXvUvj5qt/BDUFI9CkHgn/2Bk4wCvOjwsdwh9TxKWRVzxJhit2IRLyMNfj0nlNN06aHiYe9fg9GgbfdIADeA517/APOe0wJyhuGHfv1Kel5Ky+cRGUshKmB5xePJglIJyU+N7pBuusqzwNNlVGKfBW5eq1iWxRCvk6lQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:17 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:17 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 22/28] net: fman: memac: Add serdes support Date: Fri, 17 Jun 2022 16:33:06 -0400 Message-Id: <20220617203312.3799646-23-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f2d721bb-1c6c-458b-8289-08da50a0c041 X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lFPUA0rzSgBchrganU6/BQWrFy9A9cxfDsvLrC6HqTpg7F2z3c0UoETlm7G5psEZxVGqx/NPtGdgu0i814W0WzTTtzlHkNiSgvfH4HXKSztUCie4zLUj3pEqORn7qZR0tgMHHLBk/hFKaHq8yUMucGk+2iIiI/XUOGB8uU7belhJjYJCgWVVZ0cqOkIoBQLVtezZlCcH0+vLVpYY1PbWC6/OT6o1jww8uwLEpb9p8Q+kxymRge2a21zFawIjFpJJEwI3efhvEOBswfAOZx8NfcuJt/9JhXo/eUz7s2Q17IWxfsgVcqTAGdAk8XVC1ZksP7umk5ORuf8coe9r3k0C00q+91m+5bthJQP0Cm7hiYcvN+cgMijX0Liyj7YoIL+6h6kIDVxO9Y68ZlZ5MRjoiD3YUwCrjGh3N1tARS2qcXgqyMflLQaGzdi8ZeiVBFM9CRpVMpfyZN1jd6Wtg5dWJcIrAaHnj8Xi4If5fcJXZyRY6vCQFh0rBtzZpbrDqXo6/AzmUuclKGtpdT+0qnHTGDplXr5iLus2LBcWlj27pQGrm0oiFlpOhuHDlK3Yubp9TQZD4F6ijr63FurPhBkQ1qo3md/5ItbftnDHPVSHwrOzFr1gOUbvEN/UtQhiOvrwJLm7zlKsga2jmingD8LxcskFS9tKo5GIyjxMha4lSdZokBypK7hFu0YfjhcFWCRcsbrvV+v5hk8EUAJUcdV4ww== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(6512007)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GiBal5al4nVzIYDG5jNIDZ/9vD0cprRqeDBRxklh3vwt+XIAIGaVchUTKDm3zx8LyJ5nkNSJp3XmOhvH7tCM5d2d/LjrZYmisg3NdOBURLhdH8oJO6qih1fb0jgaxbPttqgvTdsVjqTqHcYanZDlTDwIrD/2vY3wLz8mFDGLafdqbxWCCsraujSuvlEUhkvU9FPU7ggy22qhfO6YvvKWKPl9UkhvsxBARhaPFsXzDdhEjTehDUD/Ax8B6MzVZ6CF6tE2gUhRUC87NaaFkUbzYh44VevNvv96twYZbtulBZpgU9C/W5QSiFUKnVV2j2IDc0hhNEWPEmp4oM2+94wmLK0QPJyJHV4PA3bvOQyTtAIY1Uy7LS03yjiNXeZ1OBGBML9vkchEl596SpEtTZbt9WtACRVXn61SPj3CfV5M/4v8IblEqijg4QQEWwNqqyHEIA3gurkWUmitlWeqhq4ED06Tp6ErJjvNhcXC/yR2rKv/0kRaZIpPuKQgnMYBYkQlNSzL1jeiHktEh/yF2CISjdvOulMJ2nuRvVQiFOS2hfk4rgJZDLD1t7y075NdG8hyHRVOxp/tr8OZ1jeYqgagL+7pczyCjZzoQBLWfTu0P7NcsDAGV4MKaDjKKwY2tDNMaqcHzkIYlgjZ4S/GrJG2qcvSuVMiITXN2CVaswj5lblviSBPdd2Y85apLWFqfZKYRD6FiCzq2dBhg2q4FeOAJelAHEj0ZsuID355Dx7CxbXLre9AlSo9ntcr1+Xfvl0Pg6/biYoFM1hXJOOFA2GHo7IGtFvNZhVH0sAtjvmX6+JENPQ81x40fDWjf8vZm1+SPZ34yLb8ciJ/NQzTV6vVzYF1a6O0UzkNI9FSS7ZmLl52/DYrDgtlOsawIRXWcKWMedn30mvsRnjgiTKSdxAs+1BTJoP/eA+d9hefbUgscYo7iukU3cbYoTcC5oskP9CCDRNzAa95DgBs6TlONPl0H7CgPUhpnsIg33qRGnB1T84sHMcyUpG1P2bZHXl3Fyp+D9uGRiTIuPOiC4KsgtKPMqEvVpfn08M9jc3Bc4+diNm4dvP4MBnhFnoWHCGpTFTTgaeszu83JkMNAjcMgxnQfmYdgVSq5dkF3b9Vxdure3MCP2TRCwwA1tcAA7EI/E5fpanQY09pzAvDcSycpnryLB2qhYQColty9AzmsaHJq7K8iclpESvBZ3+pyVWV/H2OxECo6ww7G1w4h6zKEX3qUPNyATQac2a0QTEYZmUSoXm/hD5KqfR4Hq/88BILTC8geRKxrE9eAiSpxjwEKUDL4YYhEfb3IklLbn/DHYsG/XzPRGkFZU88y/LWWOOY81Vghwy7zhAnJfkrs2Y3ME4nQh+5cB/dTyDuS7QgdhKqNJHr6ZAiNi1BvH3A6M+Xr9qq8qDt7nvyrzluLHwpPeQyj0CatcEZQPsZzT1sf8OVXkwqNHAys7qIa53cQp4st6PzC10AA0LIG3yXARngiY79Y9e5N7/GAUIob3n7N/OTtnwTQURyrDa9VszZJsB+9PbXJUoyaZQVybVt+WpU0RfQvFL3cmLWjwj7uwYFU8rJM1VfqwkUXTaO6KNdij8oHJwGDx9ISr5sjvawo8AmKdTFCKIsYvpkLfmUuSX4WlhvvutKOYA06ntOl2gHagHcvLzug4Y3/lrE3AC0z6Owf6bJi5QYTDUx3BiueDC+YOApuHOA2q29YbdKvORplvt8fkKp63qVMVefEreS0D7xfCu+7Y+9ERIJN/O/snScmQNuUQM= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2d721bb-1c6c-458b-8289-08da50a0c041 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:17.8104 (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: Kadab4utTRs3nEB9e44iA2upMTMWKAgmT6xn/oQT2eYnnNC/UVA6S0PEy/wxQWmRLZ4hUlTxvQfwVBnQCXiiwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133429_014209_5C08E424 X-CRM114-Status: GOOD ( 14.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 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 --- .../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 4d4c235d5dbc..5598a74ec559 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; }; @@ -1206,17 +1208,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); @@ -1245,6 +1285,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 Jun 17 20:33:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12886029 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 CE3F6C433EF for ; Fri, 17 Jun 2022 20:58: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=NORynYrL+bwFa/Sc98fyXHwya3+0JGgdmlgGKZ14WiA=; b=V6q/Sv+TpfALdT TUKSch5rf3WOctuXTf165aFsA3xMtp5B7pQdw4XwqjAYNCrx3lSNvnaDpLP7hfBEVwr1P5D/xuK86 NoboFa53N5h5G9o6RCxUs9YJZx0yI7Nlpx3Wj4d+e/2pU2hW4xs76nFKUNS6Do2x2Hln/pXLBq/Xa KiB0bvIDlnFexg6RzWB7k7JjQnj1LnpxFyc279N5lHlOAc65cZrT1byhOxP0SRsdl0u3ETMTWa1DK P0MqD9lGF4JZs/W1j2gf1YNFbXipAQvGVHceNoXneuObxlAwUVNhPIOE/RHm3Qw06U9N1f7Tjm5yi UadtUYs3O46Uu7UHztgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2J10-0095GE-1g; Fri, 17 Jun 2022 20:56:28 +0000 Received: from mail-db5eur01on060a.outbound.protection.outlook.com ([2a01:111:f400:fe02::60a] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ifp-008xaH-HV for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ClZSvOIiFZt9aNwNX/CcQ6U2O50euFzJ4WI9Lk5PYqY69GW62a/DYoT1jOVcHVVZX36aGizc+pjl2Zln+dWetdJ312Du6vo/HlF3IFLxt5P9wDjgsAI2frPK9O88niPDb1uWjhVt5Wd8Tv33opZBxjBAPB+0/xPr2laYEMk8xeegVMMlLlVv2piWEZLFdWabdnk29QgUxjomeXN7Q2Tj+n5ObN6IpTnEhS1G395VpKhUpoxs/qO5PXQ5DBzLFDcwhtzQlwxgZzNA83u1Z+rUBhEwHLRmUUFzP/4to6RtwFfBpiRnavqQioSXkjcKK+TaLCtgyL5IV+qgbBv+UWQTlQ== 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=VOjdqXXJBkuSU4b0VnafBKBkGQmFEvoD7IBjvteqWJY=; b=hLVefkQbP6ecieN/BFo5JfSLkr++sj+YO6Y4kBaO+hydJbDsiLXG+4fX+BYd0rKOO4SWy+jL369Nrh8ZNGqLz6sXNOkfdd1pSoTUFP9QHXFakhJPUiEP/iToAF066LLhEYBR5wqSwB+GsBXfQ1qgko1pa4E1443zMi2HyOSeuTv5DNI8p9nZDT2uJB5TwE5M1YhFrHf7E6vaeR36buOEuJbo+kYnYr0O7+xRM0uehMhWza6ViNxvXyIq/L75vMCMY8BggHifuyNHsAHf9SmpvVdEV1BmsHB5cSP6ujiGM+eJV66YyITjQ2jhd66zdbRZGYdCYeKsUTsgqBFYSJ5oBg== 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=VOjdqXXJBkuSU4b0VnafBKBkGQmFEvoD7IBjvteqWJY=; b=RfAmhnKegxw5YtGEJfbp3xYpoJe6XC6QFIEqcas15HnG7BahvZ5cmLRhrHVgaXl47XwZZr6oxscdRPz8guuqIi3RpMFwonEvioRqAmodscxwGTcFrAAKYfOE6nLN2GRPYRC4v7b5Oi9xf8NmgN2XLsmiKK9v44NYm2SaNrXDBOwHs6arlxVvd3bED8QbDVO0PvQQmXU4lwYIzswARJ71f9UX426iyudiEGJpPaq9zVAFmnUpyIUmTyRexmDGA6WoYXOE8p0g/ZDXGz9/fbCxlWReAyx3nVc10rW5tYq1TPG8IoEd7xM4hw5SjX+ztBesukkGt8cD7Lmwq6P9ORGJ4w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:19 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:19 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 23/28] net: fman: memac: Use lynx pcs driver Date: Fri, 17 Jun 2022 16:33:07 -0400 Message-Id: <20220617203312.3799646-24-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fbe218f2-ddb2-476c-7233-08da50a0c158 X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0n9hVjZETi/PrEBhkWd7HiX1nvdCu0LYWB1faW5oUU4czp6DhcGpnhvVb2qp8XxBb10AFwlQfZfpKZCWAPi5LupG86QkXP9aHBlkRqpP/hfuFz2hSt9vHv+HQ9BwY3Pr4jA6hJ9bLDLCkVS111bIfxR3pxpsnRkyOokPrxCsoMsyMZGgzam2FSBQEjUyeLAaWINMEMfwIBV0iiI4cJ3BaSqMzzi5Cd2Zg2+5XeMUMTjYCCgxiM7SBYA8tb6nW/p2q8F5hOfmxZNa2v8gmXZaEUp7xZsFaNEe048k6hSquMtZO9ctm3P7fcESLMZTnNhJYewC29ZrZB+XVpNVz3Kwb6gLft7koIeMG8khFZgMv8u5uQZP4Iy4Yn470Lsumm/V8vXQmxQNwrPBWimsQss1AhV+7YBiULWAcMA49s4DhvOV8BoYJ+g5s+WVheMHm5rLYma9oO2eMIpxligz9popclLfYOfs4xWL7bRqA+p/gc6Q/PFonIV8527Lo5sqf6BjFC8BnM4YraddpvwNtcvjVWVYAI2H9oB5U+JVn9AhEv3ROAf6b6C21fK7GFPswnN4adXJ6xJB+LvR87AhGL9VCyR17aeykeRVbxxHa277rZJhsaRpZ6dosgTAnXLoyoTixBIB/Jxupn7PcicdpMoAfS4Htlt78Z5cGfE7fZq0Clg9WJT2wm7wW9tWecwoX140QkUFDD6ABgLSH343Bfz7Lg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(6512007)(30864003)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CE8DfcTKBJei4o//H2CgPK7T7bwhnA6lNy21wYy15E0FQws4M0Uvu9fY3+XqSbaxpgEwJG7XTvmFPitOTjk3K7GVslSheXGe+NSlIXv6ZRyAPTyFyL45DbJ6yQD1vaNS6ywIqq+X9jcIQeiTj48DQo0JBzcyw9hmTz+kmF5CZJ06hWg/YsnRwecOTkKzR4J5tEA5vPW8Xlcr8XoPregEskJo2idflMNpaiZ0vMWVibn6Y0f7IBJwhcfn75sJodbqfGFNwIDnMOyjlI6c9MS9SK/gypr6GoLwEKHbazfD6BSBYnk3XUMmHbXyI9upx3gkl1c+IrPX44Pyi205VrUL8sGSC1S5w50B6tvFeXuF937m850ySMoEGc4wZk9WuGzvSIVBbcNiKzyocd9C6upFU0r/E9n89RTnf5i4IwubuZMFbyZZ87RtguDH4cBRLdOm5UP9PqaEW9Fe7sW1645hSyYIWz6jVx6ODJyLci8NUAG8fKPWqk8RtRgxf4dHtpowvWTdN9mlR6RF7eUV6GchvYh3NY0gQ2xV+KlH0e0vLgOpSl5nhqy8PIwL9SqHijXAcTZnQRS1p694V/vDv1I04zDcoDSvW1J/LASkYdj6qe2cu9+MiEPju/sYh+UiAwxxHUiuVLGNhMQ0kiPNN22dCH8m3rUhNc6fmAO/QUz5xrAaGaUvitQE8A+e1faanTcq+VsryzFKRiCj8dnhiP3K13nYcEVV1kkrddMNiPq/qKTAE7EcQVWbcr6KOBQs9Ebdi8sVJXTsvnQl+8aAP3LwpUA6liZ/yuFCKrOf55/+NlQ4RdW5+KkuERi2uw859rsQ7N7n0zTxBax0IZ1gAj5zNRijGTs4Hvk6WnBsKakFto84wCrihAI2sA667rSAWcSFkMWbvZCOVflzF2XrNycvdZv/lNlAgtmO5jgyxgLjSpzLQ7D4LgEuHi+x7Oo686GhzNaxXviMkGUe4BUbbNhTk1yFQ7rXqEQj23blzw8KblgqEZlUA/aRktNearzq2rIcBvzaueI0K7sU+swMTet2eAbLh6UnaDMKASD3G4PpUh1HON/pZnkr4UIs8ZmsXpx/9YsAeMWYlKRvkSw4Tp2jZapNR6Pn1iU533ZJSLMu2CBlvtoL/ZMp/igVRRYIDz6Z0ZoVSCNZ/KznfRYWCXm4lmI6akL7spFCsAvkZMOG5A3vs72dtW8bMByQ3bF+A3xo24aoiLaUKR2LAvOH4bYKsWcEhpPUaJtVHvpGGtBRcOl+tewd3lBJ21/wub6zHBOZJOMszcGS/6mcQ0oJ0oseUP5b+mlVBQfOHI+JeSqJbpNVLsUBbAv1RYplt1L8c1vZbeMsbX4aAxq9BisUfGDQ1gD9VQHwEEpMDwtzl9u028eRoRPrVHdc73hBJey8v9xLaQ7129VymvI4yKIF6nWjcywecUQGSaRYsCLfRDLsSP66/Pxf4V7A5tWYLBWmz2WxH8VQFhwVYbFRqT5yl5Bt6VJ3k2hAmyoPR4aAbGYR0czH5oEzNbb3XQqEi1RCfwjZAyCbCFOzH7Dz16PSDQlgW0JrPc2lSjY5WfzOVCmEOF7h7ZicU85iDCx0B1znuPboMUWabs3zLeR2wfXOgSZbo+3ju47Ep+n9CyNVd0d0gu3SNgjbpKIfgp8tnLs57eHhTvIrIWA59LWF6jicfWyZPhoT3Fh2Jdwa3tuyMb3mDzhRY5fvTQ5HfDFIsWK6wg8WgrKYEwAtI+5JLqFQSGoqCKmzjVh5CBayOjNcLHCfXYc= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: fbe218f2-ddb2-476c-7233-08da50a0c158 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:19.6541 (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: jceuZWL6k6Yy/Gewa6z2fsIVnHbymeJ2cunSR46FcF+hakWhkTT9Mq7OnJwbpn4mHr9Awmf6wp3rVYoX9W5j8Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133433_795134_A9E7AB6A X-CRM114-Status: GOOD ( 21.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 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 --- drivers/net/ethernet/freescale/dpaa/Kconfig | 2 + .../net/ethernet/freescale/fman/fman_memac.c | 246 +++++++----------- 2 files changed, 92 insertions(+), 156 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig b/drivers/net/ethernet/freescale/dpaa/Kconfig index 0e1439fd00bd..0ddcb1355daf 100644 --- a/drivers/net/ethernet/freescale/dpaa/Kconfig +++ b/drivers/net/ethernet/freescale/dpaa/Kconfig @@ -4,6 +4,8 @@ menuconfig FSL_DPAA_ETH 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/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 5598a74ec559..3eea6710013a 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) @@ -984,7 +886,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; @@ -1037,32 +938,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, @@ -1102,8 +981,12 @@ static int memac_free(struct fman_mac *memac) { free_init_resources(memac); - if (memac->pcsphy) - put_device(&memac->pcsphy->mdio.dev); + if (memac->sgmii_pcs) + lynx_pcs_destroy(memac->sgmii_pcs); + if (memac->qsgmii_pcs) + lynx_pcs_destroy(memac->qsgmii_pcs); + if (memac->xfi_pcs) + lynx_pcs_destroy(memac->xfi_pcs); kfree(memac->memac_drv_param); kfree(memac); @@ -1154,13 +1037,30 @@ static struct fman_mac *memac_config(struct mac_device *mac_dev, return memac; } +static struct phylink_pcs *memac_pcs_create(struct device_node *mac_node, + int index) +{ + struct device_node *node; + struct mdio_device *mdiodev = NULL; + + node = of_parse_phandle(mac_node, "pcsphy-handle", index); + if (node && of_device_is_available(node)) + mdiodev = of_mdio_find_device(node); + of_node_put(node); + + if (!mdiodev) + return ERR_PTR(-EPROBE_DEFER); + + return lynx_pcs_create(mdiodev) ?: ERR_PTR(-ENOMEM); +} + int memac_initialization(struct mac_device *mac_dev, struct device_node *mac_node, struct fman_mac_params *params) { int err; - struct device_node *phy_node; struct mac_priv_s *priv; + struct phylink_pcs *pcs; struct fixed_phy_status *fixed_link; struct fman_mac *memac; @@ -1191,23 +1091,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 Jun 17 20:33: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: 12886028 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 2F700C43334 for ; Fri, 17 Jun 2022 20:56: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=jcdcn4XLP5vlbuagzpg3TBDxyH49HwrlDL5tEh0W2Vc=; b=q3qsLg5xPwO2wX Sz+4vmrcY8HD4u+1jVjBBS18kZxopc+swVI/eTSN63TxJMzv6p7miOsLUs2+U0gle8+QrvdkjgROo nnM2XlvAhU2uVUaX/dLVLl0CwX61nmvy0T9LY/EbaWI4iPj6snmvHf4tjHVVOcSUAz6beE0lRKShR o1VamIhAG+ww+L1adfx9RIFyRQn6pWkyoILWHLS08Dv09xj5E7H3Rubq3GFSDIYv+TXlCMfFLJoB0 ShOnjxixYjwp+PmAtFSdBxs0LP3JLzaZBSInJGh21QeArIA6NqFgAFc660bARN0CDavtzQqMRaID4 B2NzZBE1ZJ6xT6YPYbtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Iyy-0094kf-8a; Fri, 17 Jun 2022 20:54:20 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ifn-008xNk-F5 for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CuD2uTDDxAeMIkk7P8/TcTXqVjsQltgOObX/DeRKkGgRQFGJ9H4lK+ATYUKk+9zGjuOMvokG3Mz0dtixfzOIFxoej8SALnsJWcSZKTvuSJK3nfKBoZ68DvTr/3Vx+w00+zeMx7dSDFqTM4qFLGNi8PZDUgaOY8ym2IZ2XLfI1nKsi9jUnwiBy+SzIohM4sJRmxZ40RLi+BoRCSccdGcGnz27iiYBjWfXfukshuwIN0O787WS/swMa019GM4lrRAta5KqIRTxK1eSHqECcC/x5YUudD9wHIgeMSO8h5IZZJU+H3vaq1f6xG7ug3d9w2Rgrosipftemzs2LHX7ls+DCg== 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=wQXApiIb94gYMeEkQjb9lf3tpQFZ+5mR6l2VgM1pkI4=; b=oSsnntycE39OMY1m279KNDSzxYucbLHkOI9rABTm+vEz+C/C4scFeYgP3w+OlSgS3050GllGEUIHWGlUuvdEY+j8ySgLTuf4yi1AfaOr8lCt7wRDB2ovR1lM2jijWI7Mwtm6A+OFeQTCmgi9LYFBiDhG0CV2LbsIH8B+d4ZXCszj9bwa8s6uhl8KAmWejfpXh9zLrR1PF/lyY0dqn4lRrQQ0kweXTutKbpvLQT96KfgKe1LQuhoP3+2/xywszH2j0Isd1qc5EEfdFgvAX7Odz5z9Fx/2iytDbk5xTbi09ntR+l+izlPEJcbnrim4zkDjcDkLt3dYesOTvl+Ibjs7PQ== 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=wQXApiIb94gYMeEkQjb9lf3tpQFZ+5mR6l2VgM1pkI4=; b=zQYj5rhpTUimq8Z7DfkTIIqoV+Q1NOMFL6rBt60Wt9bpAXOpeKr1G6ujTOoe2btGg2zZcG05YOcvxXqP+0oVf2Pxp79uVNH4eRR9W8xCtHfKP+YB9HUNl6+q4Usd9sVco0Syce4nS5gBgbwPYlq2NSDNQRvoFB7WOlYADB4KrEncP4bp4VJMC4CLYN00N8unBRrJfsZJDYPdIj7x5jYT0S/UfnEQKJNDCXXJb4I9CGMzzG32Kh9SKGUNrAdRu/U7tc2xF0wXSCZy1UhrDT49UtxkjjHjVsW3vy2NMkGsHj0y9CEQH9pLCrsoufEFY9nawKcyCNEr9T3652w/P7co3g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:21 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:21 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 24/28] net: dpaa: Use mac_dev variable in dpaa_netdev_init Date: Fri, 17 Jun 2022 16:33:08 -0400 Message-Id: <20220617203312.3799646-25-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fb06326d-9a39-4680-61dc-08da50a0c26f X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0uaUhESixR9c8K3i1G9uiKrXox/bezV4ofg/2jnFkCIdHfwE2vX1LYcUjs2kiUCt+PxbjChDZz17DSRyU7agLlk3DEpRcyFSVlKnctz1jL1G/r6dDw8plcbFqPhApXL7QprMI0QI/V7UDLyFpD369x8B1/shPwQRB6fZNrKbmGEcDWoMKnJnkfjpiBzBnP1UAdpEQg1CRY+bKeBM+biNnIn4wljkyevkaaSd1Ibgx/uooTKhrfW1UQF2TPVgz5wekoDHqXQk7IpMzjVQnd2WQMnS/QD1cwV9TReckZyqa6yiOnNo3SVa1T7CZySWrc7vigyaalQd5bzYCSNW1RfY+dShNwuO/CWPg9nhyF/Lm1OhQWHbsb/9olyJX7fp9m3KkIEk/WdB4rCzYkUaIIeorgetYjgKCaCz6Y+J1H6dmq8xgI2Ma4S44atdEOGxKCPU5D/rW/J9GzvEppTnNsAzL2ssawjrDb7CLKukloq8NWn/POk4HXhm6HgpvLZzo9kd/nMzBlK0/FBboZ/8wawzQAa9dR0V0ZbKn6buX+3pw7kGNr8NyvsUEkJ+QIoWV/zF22Iga8GuL2ehP5BlI7XufKSalhxrIVtqQZ4MDjVWXH5UgF/Lqolz2bwjS/FHJYg+aJ0Xx4ns5UlNr3Nsr/hciepeAdjRsN5d37qodJ0oK8Ds1Ot6ohKOPRvEtByj3QFbFfIaelHCtbMUCxX/kBrs1w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(6512007)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R/magzXLFLSMruEULtZF/UbMkOfqDSPzIoYJw97ty5b+LI38t/zoHYHgsYCVWAVreEdkUodm0IHao6GBvrDv8q+08lZJ7X4Sx3IcdKnGfa2u6UDvef+Fh89w5VZJLDgR4uWQ9qLnor2SWHOfgsgq5JG3Fb/rkiPPTmDX6o3bDbqSst4pgoSVJ5JfwzbnSxa2gdgUI4T/379m8FiXAIqqRp4R0+6B0EunncVu9knq9Q9qGeq65JNw9wb0n8ZKR/fEGiDpvkYrY8xtdthGuv2tR8cOdfGzYMPzjIXt+mBRxEwZE6xLMZkr489iUFwxInjWBO8r6Qla4Qd2G+QcdcrS/GrX+PGC27n0FM4QK/XwVT1P2ZUkhU5eG97dvdcZRLFQgER/qhV1xzcUbReTDYvfffoTibXyzdlt+um4w7smCxcJbBPrVqzDDUzyqWDqCIZ/GWwtmsFZUCK1Q8pzNSIpMu9C0aqCr7vEdgbH5MndBAd3PkahuMve0ThtpMpAjDoN2r9uS0BQ8CzrbX/PGuHkdXDdtL+4JrkalbHERZWwYVtEXtIcPoiPaNFnUvtSPt6iqI9bEy2YN1Xo2CN8u9KkV5N8KWJfVh3AzUZzo41YQoaYYvjiD01e5IBHB7hunpZ6oweZFqwA1Yp+Hl3G38ZfiVYtc/LoC0qrTW4Pgre0XS75YuZeOxl0gIgdxVA7H/Yy1JVBskTIsrYUWeWkPpmUoB4ayzB99tAU9X3bx/PSr6sY0xtXMBepcBiSt4vcg0XBtOIIvMY9ZE+SlwlO5FOy/7zGh1pButbv89sOQyE/2IbFl1HRUa/WJJnvj1ozA777xg/kydhGc0EACUF4bMcU3CiYApehsf1MfiqLEhdz8JY7ZY5/zCCTGAqlekrizeGqR3MGyPrK0NhaA0cS1mJbjiPA8mxy2yP4loapzYWS6Y45vxJVXwv/QdMQwdD26mYUf4F+iHVvH+Io1qTR3KLHwebXKTpjHtX4gGfnWB+E6ukE30gYa0YOfPk1tQ5t+Ucs0UAYLDsN347QWqd0I3Fj6cy2O80KPIEit43p4mWAfGqWSbJCz3BRNIEBTwe7JDEJlRcTolLLjmlG57bqygGBHkEF0QI2UH7QiVhdSu6aFaA1NbS+BgxOxIa8sPloCK+KlyFhwwgQptzlIMOp99TIjEdINiu0mx1iNOiO0T7simbRoXb1cKZy9oTK7/fh1ka5BJhWau0VzAw90n/ERHFDXDOa/RhhLBsRwZhixf3gOWwhEySVUQX5FVNSAniGm92wB3Hz48CwC/CVPex+GxUwz4bxp0j73gPtn4TGDo2Pt63/ovHJN4YSnwI1UohbGfgo4Z+zWfU23iayfn0RQQ6qoVs8HHa91CSwgNlZGG4wBafkQuR1VCxmKUHVxnuW65OSbrobBKAX+/TKJkH2ah6zg8rmz/olTPgD/AgcwMZA6Huw+eC0NaNlevWpZWZOm90u36CdY5nuyIDrQ/ag1O74w/CvtCQKD6l3ra2fOgopYXTcloN1ChWZxFnNlZRm1KE8P8k7RXJh/W4iCYNBludpwIp/zt+euJ0PtCtCmtbBg64L20R52hIFvyOI7gsN/1XEHJek9dH+lc0VibvL98lHk2y/Q0z+xfxcLTgu98vDMfPsKB9vL50nFryEsveKjqzVu9BayRFcp87NSti+hgK49ncYShVPb4xMnSC5Zf+5DeTKc19JaewQ85IjtjExPrZgZ1fnND3nJET4OLdGBBwTAv2XAxKwrwsTMkWkNvt8tiA= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb06326d-9a39-4680-61dc-08da50a0c26f X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:21.5602 (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: CsO6pl1K7JSYzPJ12TccOzCV87Vvcf5w9Q9ZGXgtb9txsAZ7EnZvoMs3UFryxiiGVTbEoaGnopThkdhI1dla2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133431_637938_1CCA82F4 X-CRM114-Status: GOOD ( 10.31 ) 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 --- 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 d443d53c4504..9d31fd1d8ad0 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 Jun 17 20:33: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: 12886031 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 415DEC433EF for ; Fri, 17 Jun 2022 21:01: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=hwfD96Dr2gpAri30m8ub1WLr0ppk/rwN1Y946ZBy+6o=; b=V38SJBKU1Vb1gu K4p+H+s8b0oDuUhzF50pZsqyxeUfLaRr9YE212UiNu5a7sQrakg6YEaxEMdjXvhHnvN5EwOUJy8bM RFvykEnIRXAoJkSWQBN/kN83nrglCuRqmYUrCFkW3YTA8xv7T+o51G3TSk6x3/qmYhYiRJUOfVsau 7175TUF4HvN/zehyMTA5syVn0fGnDP8N/xFatouBKJ5sWMmfUPoupmfYx5V77g0FP145U5uMZGBSZ vHt6Lt6iS8dO36w9+f4OLoEVbSYy4m/K+hEh95bQPSwE0l7fcYKttW8PGiqE/AEbWLmJXTe0OWr0b oFyX7r7W6GMdSK0iF3Zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2J4B-00963v-1h; Fri, 17 Jun 2022 20:59:43 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ifp-008xNk-GY for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qppi5gUR7CNf256MV/TUzalyOyO9eRcAPaBc6rqLGKtnbM4nrnyPHzi0IwaQpZNSvWXsEBGRtUO20sxIBy5U1X39/NeaLzLhLqYBoKZ90IYIJHlRl16pT1453ZeHISSojL5rUOiOcpE7YR7cNQYhCtMSQ1FmcjELh1tVPUo28lNxADDB3cwyvX8Y6OXZ86kp9nOxpTF0hXMnZ148oakrDaVfvrAYfKxTdtKuYwqXjdglKMA/+63M21aNY39i6MCBrnxumI0zIwRrl1eMR+PNuDP7hoI0yTehBltr4nVj4h7MCHaV5J8ciiHjz1nUqjVWBzxAmU9LfwVHrlr1jj0ZCg== 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=dUrZHJaWS8DgoCWjyy3lyN2dOGJdnx8OE+m+BMIwfTM=; b=Zs/EbuzDcPpzxMKQS3bGcxQegySF1l3Ihc6S2bizEO9b566voth+pK8W1F/cUdyjYomJ9CZv7IwziHHtMXN+YnJMANkCA5hIJF3Ahd2Uu/QTjJF9fNJ6j2E+jZ3lNECbZnb/oBhnxm09VBbDOX1M6zVwGGCmOAyy8XZJd7ST7O6xpKBC2VEAMhO4H+lYrWjQ73a/n8AsHtYqW6Y4HPRqaHXNyr5IB1cbOadNQewPJwrOGTHvHMu3oQPolOSNZKlZHAV0kAhHdIMIFH+uv7Ap09NfN0cAS8yxl439zfcN298XySPGumaTl8lpRB4NAS8zsZN6Ea+LmkBfjwjg1nSNGw== 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=dUrZHJaWS8DgoCWjyy3lyN2dOGJdnx8OE+m+BMIwfTM=; b=ATe8vV8VEU/S7caP755uTXfNJr6elMxdlAN3ke7K3J9uC62ZtZc+2F4wCJEW2Z2tNmiJvBk86wmgHi04T2vQz9iWZpe+hWK7HjS7Tw8nFmjaPm+Is1f7LjxdOP2EMcc3uyr8KwbekBC6m47/ZChk9zSujkeOwaBt0GVUV3V9NELILL1rclVc+gofFIh52FZ4kWqov88rKiSjUwqRwYvlkHzjSEYyxFzhtLnMNS+zAHB+UhrLZGi3bPE1lVqsmB/G/pynRCgX2x9KCLm7OLosNNwzJF8MVEUs3lxDYSqpXYxsRzhCdLOVcncVBB56vjNS0oujktjDRFppMuxvowf+Zw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:23 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:23 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson Subject: [PATCH net-next 25/28] [RFC] net: dpaa: Convert to phylink Date: Fri, 17 Jun 2022 16:33:09 -0400 Message-Id: <20220617203312.3799646-26-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d7ac8cf9-7a65-485e-ed5c-08da50a0c3a2 X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yb1WmWx1Wcy46dxmqiDmSNG3tc0yQChTlKt7unB580Pjsl2ZWmHf/yPm71Ja2lCt2EVoqMLtONp92mrEt4C+0p14GnXRi5uFbNVuoF51iV7jCWeRrzXXrin4VIGX2zdTf2VaopNpdFR+9w4n+kz0t2BMv8tHDR5bTKNzBZsbPdUZArfUJH3SfiGE8d2tqgOmDI/3UooHNmd1PdaRS1+gm5ErgKPdqbV6ncPi43efF844AWa23eN50eHcg/LPG95Xrk2co3/yJd4xdKUwuV+PY67twxdfsrQJ0MU/SKHwK0MYCcicgq3Q2BIAmM7RBrLtf8FeQ3FKK/N+Z7KRw0D+4n+pWSIQQOMukYcUHD9ekGImCs6MogUzIOPW9u5aDSOvoRVN2TEnxPyEbtvdH2yVQwKpphmsG/xAFjLovi6BtrHT2k5KmAjGte4O5HFNJ0z3PQyJBe3It4ZNtQH/bdDf2LspiSh7fYp5o7FBtAHazYArSyjnbvy2mFJQZqFL6tSHq9CYOFrsOXLVBB0ZYJKpz6ktdzoKqGcK6qa6hf6/VqaUKb7VzJoajMLl7bJhBHllp3+SUf8zlnsiaJ5lqNQ9hoZDG7cJVz+qHgoTRJp55B9FQ7/cdVHKy4UAaYup/b0qOCmNODJ1zPcIJ2JY8+rZbAFcPWYLZvANfeJZ6eJnYyVe0uVvuMaRoDTBgjPIRDSVQcy7imfm1THSLa7LZ9EleHd1FwlqYiyZjbv8/Bdn9Vg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(6512007)(30864003)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(107886003)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001)(579004)(309714004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iFjZklngRfV+i7ZFI33k2hPofquJw5ZtRpNIHGHPGL33aCCvMrBp6OHQyUhvkTzINk20Ei+c04Wb+Pn4d++5KN4YDNvwKLxB+91EudGbMsxUC5Bb0/DmMRSk7rBmpifcd5rohD4WRi6Zoat1Si2uASMtp1VKHnSNsesfUCY6Ywcv2/Ay4C+Xu0o4aaLNNi3Uixaa37+LMSjxXUjOVqjW2srMGtb9g5byD3yIq9DQabtzitpThBMSmdPM4QyzN//enOHymFFvYyELjNAUe28Xuh5kCLDMMRM3eQLPw5j6eD34IJwQTsBLe1l9mIUh1k8Y5T8Q43DxjEU02Sqol+ezGmZ5VS8SrXz7N94LVwnCPoc9MLoQ0s78Oq6X+2wCTdboP5QB4NOpeBD/3u50MwZxkPNK6WxOrJgLZYbB1FrcCu6HFSPlQF0xksez4npFxH3Q74jEEQgQnKoHNXpI0gOiKnn3rNLRwKkd0dZr0wYIj0yXbmAcAY+KiuVAFwQlWWA8T5rrcL5jjKKD+mkGLYgsgkZ4iUim7H1Z5/qGv6ujHwQI0cuxv1R77IGzp8KqDo0m654A5B3rLwsnIlgFgugk1h9n4V8bfY83lDsIWoFWGIE8TGs7QXrw73GuG+jEe2PytBcFkUyl+rEZZsQo4nSmIi4LXdaOdfc+6w/4kyNkdGnCS2J9sd6Tlz7YGo7JVTob1h+eYZgu5ScbBbmKOPK2KUx2buDbKiDZXHAJtOrk1sGAIeE3yzYDX/q3yJlvBHoh/TVXOeL5QGfOhiVqRntJptCFtIQxxhOqAS18sEo4luuiUs14DEpleW73dfmZJcb8lJ2ydRhxW62fafab3g61bzpuWmLNWsBPJrflO+y73YTU7B5p11m0AoXK6UVyGSz0mVXhrI+OpHpzYfchHfEyMDatjuPz+fzs1u+MeLoHp/FbTN2MVMjsMLtYjYpdwOTAsA/YPVnndapBcoHyTfdL0KwTkFVLMQumjIErhYC7oal5xJ7XmHhS93B9SktRD6WZnwFIcMURKuRL7kIJRM5/g+7FLB+iVp4CyRUGDxeGK1XzXoKt3S9s497nlQuN462TA6g+grOg8ui7W2N4prxdjyadLt1ggGcsm5ly0xdTMV6F0GT8uTfKS7otKeSEtuUM8ozAWyXNsV2MOPxkyBRbPltSgYMPkE+KAFWSS+tC807UO8CBtouRmGQNfIVPkdvLjUl4KtYJNodirystLD3kFy4zbAfdyotnyS5lVw2kaH+G7c7CqhqyPNJuyd/lTfJIm8mroDwHkA0ZTjSAxa7+dcE6s3ibh5qcz2Bi71yas1O2cPYIKuKfoE0U4JqPvyiihgVWX+TTeOziRCX4VDLhPI3RPGXBpxixIATio3sddDK7NqOH1Cfzm/QrRfYdmVyZdCfu/FSrHRgB3H7y3Gq1307UyzOuQiFXHZHSJno+hB3dKEtQcuW2E6miiDZU771kfXzCj+t5sIyXcI93+hAvE+e+mfQ8Uybq7ftj48ScS4y56IvNl/FXAKq3EwWiBQtqbpp6bfZRX14kdPX50vpk4N0H4QVcp5RFsD1aUv55TBVdEKBxm93fuXgQX5wBoMvCdAVXMfY8VQNfBbTrhNmmfeqMYuxGdKrulEhjmOSZqRw9RDFrEB/7FBPMZQDCJkeu02SJIOvQS4eOB6T8qCYOwpnvojq7Y12rMx6s0rZGL/1YSgNM74O0/q6zTR6K8CtXuc/6ffpUw8x7TvIkdmPZGdjTmdGWRGvQG4KP4tCxBww= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7ac8cf9-7a65-485e-ed5c-08da50a0c3a2 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:23.5758 (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: 6XZyV8uvzoLPVH+pauTbneExZl9psfKAAjGKDyu8kyXWa7B0BoJ0b3nFaQ3JVb7aII5RCdPPmvKV3mFPpRJ2EQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133433_653920_49A424E2 X-CRM114-Status: GOOD ( 26.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 converts DPAA to phylink. For the moment, only MEMAC is converted. This should work with no device tree modifications (including those made in this series), except for QSGMII (as noted previously). One area where I wasn't sure how to do things was regarding when to call phy_init and phy_power_on. Should that happen when selecting the PCS? Similarly, I wasn't sure where to reconfigure the thresholds in dpaa_eth_cgr_init. Should happen in link_up? If so, I think we will need some kind of callback. The 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. This has been tested on an LS1046ARDB. Without the serdes enabled, everything works. With the serdes enabled, everything works but eth3 (aka MAC6). On that interface, SGMII never completes AN for whatever reason. I haven't tested the counterfactual (serdes enabled but no phylink). With managed=phy (e.g. unspecified), I was unable to get the interfaces to come up at all. Signed-off-by: Sean Anderson --- drivers/net/ethernet/freescale/dpaa/Kconfig | 2 - .../net/ethernet/freescale/dpaa/dpaa_eth.c | 94 +--- .../ethernet/freescale/dpaa/dpaa_ethtool.c | 82 +-- drivers/net/ethernet/freescale/fman/Makefile | 3 +- .../net/ethernet/freescale/fman/fman_mac.h | 10 - .../net/ethernet/freescale/fman/fman_memac.c | 521 +++++++++--------- drivers/net/ethernet/freescale/fman/mac.c | 169 +----- drivers/net/ethernet/freescale/fman/mac.h | 24 +- 8 files changed, 327 insertions(+), 578 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig b/drivers/net/ethernet/freescale/dpaa/Kconfig index 0ddcb1355daf..2b560661c82a 100644 --- a/drivers/net/ethernet/freescale/dpaa/Kconfig +++ b/drivers/net/ethernet/freescale/dpaa/Kconfig @@ -2,8 +2,6 @@ menuconfig FSL_DPAA_ETH tristate "DPAA Ethernet" depends on FSL_DPAA && FSL_FMAN - select PHYLIB - select FIXED_PHY select PHYLINK select PCS_LYNX help diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 9d31fd1d8ad0..2caf353dd64d 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -262,12 +262,26 @@ 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); + /* 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->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); err = register_netdev(net_dev); if (err < 0) { dev_err(dev, "register_netdev() = %d\n", err); + phylink_destroy(mac_dev->phylink); return err; } @@ -289,21 +303,14 @@ static int dpaa_stop(struct net_device *net_dev) */ msleep(200); - 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); - + phylink_stop(mac_dev->phylink); for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { error = fman_port_disable(mac_dev->port[i]); if (error) err = error; } - if (net_dev->phydev) - phy_disconnect(net_dev->phydev); + phylink_disconnect_phy(mac_dev->phylink); net_dev->phydev = NULL; msleep(200); @@ -834,7 +841,9 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv) * lower than its max, e.g. if a dTSEC later negotiates a 100Mbps link. * In such cases, we ought to reconfigure the threshold, too. */ - if (priv->mac_dev->if_support & SUPPORTED_10000baseT_Full) + // FIXME + if (true) + //if (priv->mac_dev->if_support & SUPPORTED_10000baseT_Full) cs_th = DPAA_CS_THRESHOLD_10G; else cs_th = DPAA_CS_THRESHOLD_1G; @@ -2877,54 +2886,6 @@ static void dpaa_eth_napi_disable(struct dpaa_priv *priv) } } -static void dpaa_adjust_link(struct net_device *net_dev) -{ - struct mac_device *mac_dev; - struct dpaa_priv *priv; - - priv = netdev_priv(net_dev); - mac_dev = priv->mac_dev; - mac_dev->adjust_link(mac_dev); -} - -/* The Aquantia PHYs are capable of performing rate adaptation */ -#define PHY_VEND_AQUANTIA 0x03a1b400 - -static int dpaa_phy_init(struct net_device *net_dev) -{ - __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; - struct mac_device *mac_dev; - struct phy_device *phy_dev; - struct dpaa_priv *priv; - - priv = netdev_priv(net_dev); - mac_dev = priv->mac_dev; - - phy_dev = of_phy_connect(net_dev, mac_dev->phy_node, - &dpaa_adjust_link, 0, - mac_dev->phy_if); - if (!phy_dev) { - netif_err(priv, ifup, net_dev, "init_phy() failed\n"); - return -ENODEV; - } - - /* Unless the PHY is capable of rate adaptation */ - if (mac_dev->phy_if != PHY_INTERFACE_MODE_XGMII || - ((phy_dev->drv->phy_id & GENMASK(31, 10)) != PHY_VEND_AQUANTIA)) { - /* remove any features not supported by the controller */ - ethtool_convert_legacy_u32_to_link_mode(mask, - mac_dev->if_support); - linkmode_and(phy_dev->supported, phy_dev->supported, mask); - } - - phy_support_asym_pause(phy_dev); - - mac_dev->phy_dev = phy_dev; - net_dev->phydev = phy_dev; - - return 0; -} - static int dpaa_open(struct net_device *net_dev) { struct mac_device *mac_dev; @@ -2935,7 +2896,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; @@ -2945,13 +2907,7 @@ static int dpaa_open(struct net_device *net_dev) goto mac_start_failed; } - err = priv->mac_dev->enable(mac_dev->fman_mac); - if (err < 0) { - 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); return 0; @@ -2959,6 +2915,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); @@ -3114,10 +3071,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) @@ -3521,6 +3480,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..bf0690d21e3d 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, @@ -115,66 +107,6 @@ static int dpaa_nway_reset(struct net_device *net_dev) return err; } -static void dpaa_get_pauseparam(struct net_device *net_dev, - struct ethtool_pauseparam *epause) -{ - struct mac_device *mac_dev; - struct dpaa_priv *priv; - - 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; -} - -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; - - 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; -} - static int dpaa_get_sset_count(struct net_device *net_dev, int type) { unsigned int total_stats, num_stats; @@ -566,8 +498,6 @@ const struct ethtool_ops dpaa_ethtool_ops = { .get_msglevel = dpaa_get_msglevel, .set_msglevel = dpaa_set_msglevel, .nway_reset = dpaa_nway_reset, - .get_pauseparam = dpaa_get_pauseparam, - .set_pauseparam = dpaa_set_pauseparam, .get_link = ethtool_op_get_link, .get_sset_count = dpaa_get_sset_count, .get_ethtool_stats = dpaa_get_ethtool_stats, diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index b618091db091..ee0b9178187c 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -7,4 +7,5 @@ obj-$(CONFIG_FSL_FMAN) += fsl_dpaa_mac.o fsl_dpaa_fman-objs := fman_muram.o fman.o fman_sp.o fman_keygen.o fsl_dpaa_fman_port-objs := fman_port.o -fsl_dpaa_mac-objs:= mac.o fman_dtsec.o fman_memac.o fman_tgec.o +#fsl_dpaa_mac-objs:= mac.o fman_dtsec.o fman_memac.o fman_tgec.o +fsl_dpaa_mac-objs := mac.o fman_memac.o diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h index 730aae7fed13..837ecf1c97c8 100644 --- a/drivers/net/ethernet/freescale/fman/fman_mac.h +++ b/drivers/net/ethernet/freescale/fman/fman_mac.h @@ -169,20 +169,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 3eea6710013a..d12dbb7f173a 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -66,6 +66,12 @@ do { \ #define IF_MODE_RGMII_FD 0x00001000 /* Full duplex RGMII */ #define IF_MODE_HD 0x00000040 /* Half duplex operation */ +#define IF_STATUS_RGLINK BIT(15) +#define IF_STATUS_RGSP GENMASK(14, 13) +#define IF_STATUS_RGSP_10 0 +#define IF_STATUS_RGSP_100 1 +#define IF_STATUS_RGSP_1000 2 + /* Hash table Control Register (HASHTABLE_CTRL) */ #define HASH_CTRL_MCAST_EN 0x00000100 /* 26-31 Hash table address code */ @@ -273,14 +279,16 @@ struct memac_cfg { u32 tx_ipg_length; }; +struct memac_pcs { + struct phylink_pcs pcs; + struct phy_device *phy; +}; + struct fman_mac { /* Pointer to MAC memory mapped registers */ struct memac_regs __iomem *regs; /* MAC address of device */ u64 addr; - /* Ethernet physical interface */ - phy_interface_t phy_if; - u16 max_speed; void *dev_id; /* device cookie used by the exception cbs */ fman_mac_exception_cb *exception_cb; fman_mac_exception_cb *event_cb; @@ -293,7 +301,6 @@ 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; @@ -356,7 +363,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 +390,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 +429,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,53 +534,11 @@ 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; - - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - - tmp = ioread32be(®s->command_config); - tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN; - iowrite32be(tmp, ®s->command_config); - - return 0; -} - -static int 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; - - 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) { 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; @@ -639,72 +550,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); - - 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); @@ -739,9 +590,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; @@ -753,12 +601,160 @@ static int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en) return 0; } +/** + * 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); + + if (phy) + phy_init_eee(phy, 0); + + 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); + + 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_phylink_mac_ops = { + .validate = phylink_generic_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; @@ -772,9 +768,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)) { @@ -803,9 +796,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, @@ -835,9 +825,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; @@ -865,9 +852,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) @@ -888,13 +872,9 @@ 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; @@ -919,10 +899,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. @@ -938,11 +915,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); @@ -971,9 +943,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; } @@ -1020,8 +989,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); @@ -1029,7 +996,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); @@ -1054,33 +1020,40 @@ static struct phylink_pcs *memac_pcs_create(struct device_node *mac_node, return lynx_pcs_create(mdiodev) ?: ERR_PTR(-ENOMEM); } +static bool memac_supports(struct mac_device *mac_dev, phy_interface_t iface) +{ + /* If there's no serdes device, assume that it's been configured for + * whatever the default interface mode is. + */ + if (!mac_dev->fman_mac->serdes) + return mac_dev->phy_if == iface; + /* Otherwise, ask the serdes */ + return !phy_validate(mac_dev->fman_mac->serdes, PHY_MODE_ETHERNET, + iface, NULL); +} + int memac_initialization(struct mac_device *mac_dev, struct device_node *mac_node, struct fman_mac_params *params) { int err; + struct device_node *fixed; struct mac_priv_s *priv; struct phylink_pcs *pcs; - struct fixed_phy_status *fixed_link; struct fman_mac *memac; + unsigned long capabilities; + unsigned long *supported; priv = mac_dev->priv; + mac_dev->phylink_ops = &memac_phylink_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) { @@ -1150,6 +1123,7 @@ int memac_initialization(struct mac_device *mac_dev, dev_err_probe(mac_dev->dev, err, "could not get serdes\n"); goto _return_fm_mac_free; } else { + /* FIXME: init/power on at an appropriate time... */ err = phy_init(memac->serdes); if (err) { dev_err_probe(mac_dev->dev, err, @@ -1163,57 +1137,114 @@ int memac_initialization(struct mac_device *mac_dev, "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; - } - } + /* 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; + capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE; + + /* 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))) { + capabilities |= MAC_10 | MAC_100 | MAC_1000FD; + __set_bit(PHY_INTERFACE_MODE_SGMII, supported); + __set_bit(PHY_INTERFACE_MODE_1000BASEX, supported); } - if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { - struct phy_device *phy; + if (memac->sgmii_pcs && + memac_supports(mac_dev, PHY_INTERFACE_MODE_2500BASEX)) { + capabilities |= MAC_2500FD; + __set_bit(PHY_INTERFACE_MODE_2500BASEX, supported); + } - err = of_phy_register_fixed_link(mac_node); - if (err) - goto _return_phy_power_off; + if (memac->qsgmii_pcs && + memac_supports(mac_dev, PHY_INTERFACE_MODE_QSGMII)) { + capabilities |= MAC_10 | MAC_100 | MAC_1000FD; + __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)) { + capabilities |= MAC_10000FD; + __set_bit(PHY_INTERFACE_MODE_10GBASER, supported); + } else { + /* From what I can tell, only 1G macs support RGMII. */ + /* For compatibility, default to enabled if the rgmii property + * is absent + */ + unsigned int rgmii = 1; - fixed_link = kzalloc(sizeof(*fixed_link), GFP_KERNEL); - if (!fixed_link) { - err = -ENOMEM; + err = of_property_read_u32(mac_node, "rgmii", &rgmii); + if (err == -EINVAL) + dev_warn(mac_dev->dev, + "missing 'rgmii' property; assuming supported\n"); + else if (err) goto _return_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; + if (rgmii) { + capabilities |= MAC_10FD | MAC_100FD | MAC_1000FD; + /* 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")) + capabilities |= MAC_10HD | MAC_100HD; + phy_interface_set_rgmii(supported); + + if (of_property_read_bool(mac_node, "mii")) + __set_bit(PHY_INTERFACE_MODE_MII, supported); } + } - 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; + /* 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); - put_device(&phy->mdio.dev); - memac->memac_drv_param->fixed_link = fixed_link; - } + mac_dev->phylink_config.mac_capabilities = capabilities; + + /* 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"); @@ -1223,8 +1254,6 @@ int memac_initialization(struct mac_device *mac_dev, phy_power_off(memac->serdes); _return_phy_exit: phy_exit(memac->serdes); -_return_fixed_link_free: - kfree(fixed_link); _return_fm_mac_free: memac_free(mac_dev->fman_mac); _return: diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index c02f38ab335e..f59e71c23569 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 @@ -98,130 +99,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) { @@ -268,8 +147,9 @@ 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 }, + // TODO + //{ .compatible = "fsl,fman-dtsec", .data = dtsec_initialization }, + //{ .compatible = "fsl,fman-xgec", .data = tgec_initialization }, { .compatible = "fsl,fman-memac", .data = memac_initialization }, {} }; @@ -301,6 +181,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; @@ -429,57 +310,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 c5fb4d46210f..199ea046580a 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,31 +25,20 @@ 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; - bool autoneg_pause; - bool rx_pause_req; - bool tx_pause_req; - bool rx_pause_active; - bool tx_pause_active; bool promisc; bool allmulti; - int (*enable)(struct fman_mac *mac_dev); - int (*disable)(struct fman_mac *mac_dev); - void (*adjust_link)(struct mac_device *mac_dev); + const struct phylink_mac_ops *phylink_ops; 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, @@ -60,6 +50,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 Jun 17 20:33: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: 12886030 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 A613BC43334 for ; Fri, 17 Jun 2022 21:00: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=t/cUNbJmdX+rvvPFK0Ajvd25olgVU3aUh3LcuUsjrEc=; b=mfo85J4hTBGsUI qcqeTNBy7v1nTQrBr8S0aLZpMnxNMjgh+Z5POeUXmcf3bgqpGJHwyPAFlqgA5cYXBMEGBEbkIPj4k FncImLEwfI+Ffx4bOjAGh8KMOHH9syTVD9yLDTEQMAHU9InvQyLnZ9ZL7zmPWB7us2wUIvurhdMRZ Aqo7xt0eV7fOJOYftKnxihkwoRkwMl5GDFIb61HlI8Wa7uKlehvR771zf414vLDtPzO+oo6cJLqVZ z2GdOYhVp78HAAm9lQHa4sHg3jciFiMy2NBTUp2ojRG/FRvIKLXre994k8jkW1aHhnHbRsBGD7XV8 sCWnoyy2BT0Hb49bNrGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2J3B-0095pJ-LY; Fri, 17 Jun 2022 20:58:43 +0000 Received: from mail-db5eur01on060a.outbound.protection.outlook.com ([2a01:111:f400:fe02::60a] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ift-008xaH-6p for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QOISVLc0FOQFCUSxCca5XTOVWFB1623N6jG1+h2nnrHwSdEepru02Yx/QIMZ0mMDeF/SdTlkKfMHcOS84IXEblJr8Is8l7zbPF72YcwNfslVIevU9VyfFOe4vPepVIaTs16C9QZKRpIPgxEGGjGleXrRmQ/h/+0RgeIZL0zTG1B+3SmsLnryQtSpgWomSvP79MaDr8HUnR17Fwaye0gI0pD3/+9FRm/mLwe9Cy88pRHgxDCF8B2sg+5EH4kEYSAuaurt/hBw9Pp2BQ2BUhulhiWpsdkJvbNbhhrkMppSpr6tikjjpGo76G8HRHgf1fU4WKKb8z4om+U4ns4eJ4gEYA== 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=XsPPXgKz/RlY5QS5MieFAOEm9miesXI+xxfIAF0y488=; b=bHA8GZoSVsxOkPhU9Cik8y0iIbdRWYYijPL7ex9uZcGrilbOzlF/kQWE4jehoGhzEToy61qfsxhm8jbXwtoDLF3Ry+sUYp5nfrCZaJd/0SmjkDtuWHwO04T1pRI9216c0jn1OnzcDIf0gb+k23QrQRFHm9GzTUrR9ro9IVHcI1L4osMrg0fRznfRnJdpJ613sPxJwvdC7kq+1qZlVKfCfyIc64knI/4OsY69Wv3g7YkKzAGcuEyOTPleAZ5zI19zcrqOQW1lolgR0opumCe9ioI2+L2gAj/IBwsCsm6gvTYcQwP6sFImjfCsef3we66+e3Y3ofwYKJUXqF9oFb3U1w== 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=XsPPXgKz/RlY5QS5MieFAOEm9miesXI+xxfIAF0y488=; b=uz7awzSGsqMcNz3GNgerznbdf3liRQa8zPayPPQoYoTO5Gw3Sd3atS4JDZh3H/LANBY44SufSZHcQpvBW0kyS316XzKyXYA++ZvC3uoq0s2SWnyYboUii7nogQoWrOzhVxADq/JyNUtCz+m1eCawQqX5KbIRP5I2OIQusT7Pas15RsLoOeGimAQFN21uuWeJYttD4VAJEK4y69hHVPjMS/vih6z5l09/kED1bKZuQHobFgW090Xu/JNPUnE6hRC36+9oVfpm/8V7K98ruse4Cuv0K2TQlJj6I3ZEp0ABMg9sC7ebhFx2ywVaQmUIMlHHvfT92ICASZVlSL56BMTCtw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:26 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:26 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson , Krzysztof Kozlowski , Li Yang , Rob Herring , Shawn Guo , devicetree@vger.kernel.org Subject: [PATCH net-next 26/28] arm64: dts: ls1046ardb: Add serdes bindings Date: Fri, 17 Jun 2022 16:33:10 -0400 Message-Id: <20220617203312.3799646-27-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d4e5ddf-79f5-461a-2581-08da50a0c525 X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mCC0LmC7OV8le8kGuy4kEa3L4L76EULh9fK6Ed1p5/8JWgWEif6tLMPokALbTqlSHRZpzyRf+/4Joj7hrSoEfnSkn3AUqo5T+X8+uD+8d6WMcVtTEavktFBoNxpu5mnZ3veb0uQ/TzFDxZLSSreOg8usv4LDM3ql6hwTclnCRk27+malF1fIIUlTySUXo4j3ODcH0cxunoBh88l9VqDW7gKwQ9XEEb0C3tRQre7YpLWrzulSbHJKsTeD1Z3gTTOLHiduFc60fm13r7lYMicgKKtQwpmLqZ9nGfW1sBWQ3GnbgBk8jAYP1Ol6Mqchb82+zCmyx1oSbcwZAZgnICKRup8PVm6KrM3vYO/nhbszJYLu73EVHuDj3RklEIMsigekY8HRrsnOa/yXwKwwDPcQQ1/a3kdVXVb1aITJ2CN4GaemVBpL1Dtd+Lu8usJIrKTe1fnKcYp47AElK+ikkuVhMdPJRjlbPqIHneF7P5ncFaqYFtOc8h/GqbkuM5K/coGfsObj19Lz1n4riXfLQFA+iy4/lUkasbH5jn34plr5uMwQB4QtzvIxWKpgjBU54CttyjpgGZWdd78oswmQmzNoGmrGxMDhQD3JSieY5Bl0QAgnzpbUS9A/R5oplQBoS51SH0KsSZm/sN/KO35coi8RzC71iHoM+r0glg9oGd7be5/ExZsIagW/ZS1MMQ0fnyJ+K1RGIUDDM/zgS73ERxrMyw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(7416002)(6512007)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Kc+/MCQ9aG2z7eeQLRu0BZlNvjTpKgsZWYTTg8Jf7hF0LnrVhkHFDc54zDHLbCRneZA/l6I+umXTsJiVUOmyUNg1TeT+78oRYYPdmc6nB0SYzDYaMsJXlObpfwMawmCmVuoTMoUU02KAZF3iLiPLd9kVx914EiLHjaVWWFnupSs69q8ywsY0alWph6xGTdLZxmZ2V3balL/fFIvpeM57v2esGsoqhaosI85POySW05IaFxd2NxueV6wCWp6e+nd7f+7yWUF9PZJh/j0MvoFRoxEgfmpJLWmZMhqApxzTw5YtfcTeP+2wiDE7qg2yak4A4HCvJF/92SkVupiuyzbbJzHB4kUH9QAVPQSId8wpq8jtykHfs5wVvVzON1EzrCCPbUPp6rNXv5efxJlYbfepZHT6CcXdrQWMJkp1jKdKCqACSBIZN4sM4Lke60d8Dup6qF6v9rKaX1jconmrG1vjvcw7D/PqoWHPV/T2AcPfb9KcNdfhb0j6MchyM38bTmRpiOXq28NPHX7D+2otL1QeoHxXC42NnyuUQ9nrDEiO+BjGYVVJzS1MlSUCI+D0b+I2SBQTOR/0jp1a6Wm0g2NeSasNjkeY0/Kftgk/jq129IS1C1BHxrdtYrUBD7PnXRdeCvjEGlHI4QDnsasc5HYDiZQFECdi3cieCe1FrEPbSqnBfRhzjHsP6EQave9I1fPzfL3YqYLzu5oM26CWAzHYHaP4E0PsaKcE2t9FV3VvfTCOx9pzFx2F9C/5p+2yf0Nq4dhsJJ4WTv+8v2ZCBNmygOev6hnQSqpK/bfLCAwdCz+TMZZnzfLQah5XLixMdBmqLoWDRg2JX8rKsxKnFS+TOxv8jZ+3EfhmHS+qhdWbAYJkNPiGuj1QnxGAcxSFxHKTVP3C/pzG5mJft79OWOZQBY+DI+OyQD5Emcoe5c05p0CUBZwRlrKzXuHMhpcdRRK8XQp5vtIiOMqGdr9oP3pFTcaVo2NU8NXciwdYwLeuTq6rzVKag+3d3vk976VZr7rZCqlw7lNouAF54507Gyo+yBWVh+OdUbNNQH/PfJ1OZBD06Nsks2P2OC8TdR3MTmLeFupl5jPZAx4t5KiKovl4MTzVVZQ3tcqqNG5oOmsMX6Zk4iJerb9zsvUsxhLdR6wXJA24UvtJlfkaKOTSA2iAQK12lximX6ZAfGnwwHvCAV/LLYMpZw5ZPvZIs2JRuDjekDO2Fzs3MnfMagx9J+lc3dHp+D0hAzpDQJSpujZ0rthJSwCpmpRpmsEMgw6lOmLi4n/ss1uy+cpESRan4pGYOJyQ7E0z3l1T/tPavCo+/XY7MR6WzLXGeFNVcV1Ei2+7GWf07b8W2Q8Y/T+t+HWeEXlmv1VwZzE01YSLufL1QMuQe5GwwSWrf7BfQv5QlYivrR+q2U4+JOoBV2oy57k/okBAU4i035QiQWPPirrDb49IvsBd/CYfIOpIUyFGxNwQJcQvOnpr4AJsmvvF/QUZKxB60fcFAhpbyL0Exmr5lGmpfJdapHWffw1Sh9XFjcFF16KeExXJ1RdR7oJS9OGWi4x1ky6gpyxYdT/zxAWbSSnGndSMCGORMZKKiEZmq/wYAIE7ZLjsWhpwD1OimtFVgfDDOaOLYgCvTtaktGe+XGuFa/UChw2XoW+En8QEURNIlAd2x6w+ffoAAumNLXXsdxso5VSybIWqG+YiD1jd9xUFKI94yxO71Se5Go860ViL6PH/ITaVMKtsnSbspT4nGytRIEoL3QpURtjvYyFoWYk= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d4e5ddf-79f5-461a-2581-08da50a0c525 X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:26.0131 (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: Whh4rhK0b8L+uE2PJKsQ8hwFvTTJROoKTQZZGMrp3BR5bV2Holl3kQf1qZ1iBlc5wz/W3jU/j2yWZ3NabqfbpA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133437_321919_29C16B59 X-CRM114-Status: GOOD ( 10.82 ) 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. Signed-off-by: Sean Anderson --- .../boot/dts/freescale/fsl-ls1046a-rdb.dts | 32 +++++++++++++++++++ 1 file changed, 32 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..21a153349359 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts @@ -26,6 +26,30 @@ 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"; +}; + +&serdes2 { + clocks = <&clk_100mhz>, <&clk_100mhz>; + clock-names = "ref0", "ref1"; }; &duart0 { @@ -140,21 +164,29 @@ ethernet@e6000 { ethernet@e8000 { phy-handle = <&sgmii_phy1>; phy-connection-type = "sgmii"; + phys = <&serdes1 1 1>; + phy-names = "serdes"; }; ethernet@ea000 { phy-handle = <&sgmii_phy2>; phy-connection-type = "sgmii"; + phys = <&serdes1 0 0>; + phy-names = "serdes"; }; ethernet@f0000 { /* 10GEC1 */ phy-handle = <&aqr106_phy>; phy-connection-type = "xgmii"; + phys = <&serdes1 3 3>; + phy-names = "serdes"; }; ethernet@f2000 { /* 10GEC2 */ fixed-link = <0 1 1000 0 0>; phy-connection-type = "xgmii"; + phys = <&serdes1 2 2>; + phy-names = "serdes"; }; mdio@fc000 { From patchwork Fri Jun 17 20:33: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: 12886032 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 67441C43334 for ; Fri, 17 Jun 2022 21:02:48 +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=9GmcBPu7tm6HBqFh/z/ExN4x9b8FmYZ1HKGHUlreJfY=; b=K31u/0IWjryIcP Ehcu9YldMbfiLx7/ar7IP5H6mLiweB8EkSmyoSKwri2hbbSgsVV5knWsU8p/K/vwRriyVr++7TjWt WrjvT7KkEk88aNC7BJ0nuBP0SWoXZEz/Tag7ZCHcQwfcCeeB/BJ4H7yhq1q872CxjfTiNaEaXSgXP Vfl0RdtbepsG3/t4b9ldNMJr9PKKu+4uhEYFprwCextqegamHrqbznthVTvwjucPmHb+M4BJ6le+3 Oo27sm/qhV/6ub4ugLF45Zc3ZUZ/mu1CRYKZfNYrUW2OvoWgdhws/nwZCjow6na2+Xvuf8DXmtmHA Lb30z1TWMSE+i5S6nI2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2J5c-0096Tv-0o; Fri, 17 Jun 2022 21:01:14 +0000 Received: from mail-db5eur01on060a.outbound.protection.outlook.com ([2a01:111:f400:fe02::60a] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ifv-008xaH-HI for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NCdCcIW6JZ8HUG6ixOxPJWBPK+JJ9ZAWJYxRfrpMJTm2OND0i3qma2p/wuWIrqgaLr3ESCZsmgwPqnzW7+F3FnKKNwNOKTiMDOANSYQgn1A/Ro0I0E/4lEMYqRIaonCpjQ5b6/mUKwRrGLnVJ4sC1q4KRjkLC8MJvYzJ8eW0jq5qIFlkZHOHzQBEnqD1UmYm0j5NVOnYeWvABe2zqzoRPuDLBEw5vGBn7vl0HSgNj7VkdBLgfKDAo4ZzJGI+3jPrlXEN2ltFuj1wRFQ9+k3jGi8/VYQh7kBLdGJWsHvv/G99MHHg20VivVjqIheuRM0UhM7AseyV3T2Eyoyoe+yQJw== 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=aAIx3HP7EOd0nayom5zq0pgy/rKnCh/QSt36ISQA7jI=; b=HmqFsqGYa5nLxb5tvWbx510Bw4mCZDBxfgYA8urIBhBgg+va2c7YxryfCRDbYJNmA5xFcK8494giS4CmosrNHemh9jgni+MI4WiyrpYvWe2ag/9m7PkE19TNi65L1HbNQpVHCAiDvwuFCx2o6FsY5vWTL9eRu/Q6e7ZfXKI48H6xOlN6hP39sd1A1rGwlO8uNxIT2EraqHXNQUG+Iu6VNvttpYkBRNB1yqzqeTwzeAnMHIqH5/DcpyHDHVA/czAc8HfA5X1+mvPbQ83367SiHmpCHsZ8qvk32FIuwQa19uIV/zJYRioNQN26bs46kP8kRgJVpyxFrTmQyM/0cPxXBg== 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=aAIx3HP7EOd0nayom5zq0pgy/rKnCh/QSt36ISQA7jI=; b=e3yyseMkex8QQPZpkB/qXRRcLaUfxW1dxvpVK9rKio3x5Kxa/AVmnaqxl8iF10RBFQzCzGcLioIJ3xbz8oDPzqPhg20EmNnNyspj/TJLQ9U2Azrvt07OTDD+g09/0HjXSe/NAswSUxmLxj8ujPkmqQREJ6G04UPkp+IozfrhEy3fpu5EAa76oE27VjjsLzUIjNUTiw5Z8VERVQuIXFVTQGm+x9Wv8t/UvACaWLlhodbW3KV/1JjRlTdQ0Jqu5GvIEJi7pNegH8XsULmkbOVEiyhgyrSWmMq1XPAx8GeNWmyYXT5/AqgBX97+MkmHAx+3lP8/wq9w5AdsR51uMJ9r0w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:28 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:28 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson , Krzysztof Kozlowski , Li Yang , Rob Herring , Shawn Guo , devicetree@vger.kernel.org Subject: [PATCH net-next 27/28] arm64: dts: ls1046a: Add SerDes bindings Date: Fri, 17 Jun 2022 16:33:11 -0400 Message-Id: <20220617203312.3799646-28-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a2379cc6-1afe-40e4-8664-08da50a0c68f X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Yn0CNCVNwgn6ZnNNvLKCG58e2BoGIipcSCHFG+r4NUjn/zaoS/XrO20uzQPhTew7NezUKuBJ9wU8jDpnspFTjN9aSkrqevYt43pDMz/UIL9+YG8xhYtQW+TBnqerzig1kLXUk3HYXDfb1iktgwg8kFc8GjTepagw1GVRP1NaAVHi8EwVKjmo+LdCQ9PIPtGPcQCpbEGM2zh9Aj5YiizhWyCL8mTD3WhljQ8oytY2dI6SGQbirQG1ZRlBl82tsdRu+DLsvBqlX7q7LtGFD7LWgmM5K9nZPMttguGkwJXd/j2Bui40Np8+Pa9okS13c2v/g5JoOkC/6hL08LdoeeKLBc+01lALZ86i1jV+fkUqLzlqjp92Bi/tI42DdvP7tUsT75F7Fde8LI7FpaG9kljWnkbwRGLdgO0Sdc+2Dv+N+suOQAZFBmzmeYCCDsHekD7T7Lgj8Iss4ID+zX5SlpVoe95Ip6dSh1rvXJpneg//muZ5/KD1OicQf3Pig9hTUH9ht9qa0skYZmMlDZOLu8RPX/IgOb4A6FVDonBCS0Ku9ZE/pchrvKh7VO04qtOeqFnLAjZ1JpFEtmtNJrpc4q+oggvkhKMBdZ9jiPE+EGzq4StSZ+SKrx6aU41EjkOndSKm1QriLM4RqyB5PX7cRZPnFYcW6/XHFgyniwRAR5OSOANT8Jw/yDCKwjRfA4+ltUUAB5iqP7/eGgE3R/5VCJZaQQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(7416002)(4744005)(6512007)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6lhX7MKoUnBLyn2pNjG8IAzCfo8Ow32JqqnRHF7Ujf9z6DCPvGi3BVbleKIiGwZtjzMGhM8fVuuKUCgZxXtaH5oNLvfh5Fy/NPKy81aUnapUP5HtUWM1x9JpG9ZZa3mnK0lTdumTGaNSE1f8wHJdCnnhgDg8DT2AYL/X14g4XLgoMr2nVadVJnCj6uXZRNrdYHv0u9lJfxiwtjYTvZ8YYFSPfe4Fp6JyTpPIA+Sc4VQkmEWYLLFRrigz72aDiZLUHMjr5KZzwvx1nzWv2IA9ZjdY6eZP/s3cF0odwQ7oNGF2g/U7h/VBBdA2wGQv0vG3Gb+kfLKz1Hr8JcXnxDUdbPT6lOl7hEpglL7cr7L+K3GeHTYGPeJVEUnGGebJVvRZxz1PgLWDmoUZgsOS0xdyu7xr3W3jqJGVPEBupy9hXlN0Zvm+ug5GuOy6Vd3/g6WS4H3EYFXwfgA+GLt8LJSwBbW/y6eRwz9zllwEC0nTuPAf0wPNsgWsRJ3n8XjY6N7ERUl93ZbtjaLDJGmC2Ep/l3sxLMeWmdH/Q/2pCcnhFppnA/GzInPMoFfCRIWLOZLr66sbI6undoW/nd1cvZ9shhF1LHjy8O45KMr9qlJ0uJAX0BVPKARFlcFStQmPMna65wluvDCA9F/EqULfQIkGCkvqRPzp7xQFhedhTaWW/SFZYnZiZ5eslsQPQtVObrEnmMS/WQnpWvi5lAQNyY0SuVxXLX9SycQ6lCAPfQbckTb5e6PVXQHzIgJnZ9fUgItvEpfNY1kLxAh8YZ0J5D9SMNM3ARPD92X+nKotIIdfWwE2GoJuMxt73Fc6dYVcy+YyZUT50eUOyKq5EmJJcMKi6lZl/agBgrT92t91UfokEuVCT7ih/b6rft1j5g+Q3VqksOCthemTKTsyLBFAD7Ru8kKviwJyKwZgX9+ihBfGfHDnjvRNZ339BmcTv1gUSCIV5W643xS1HqnFEKJ3dJjUT3r4FlbrKpMq9xE3d8Q7Iei9UWbJLW1YYqEeqFtJXY6lCkbvAgx4N1JIehE27wNIxdRLDFXaQe4xGseZZjSMu+lxLsltvnzA9rtL2CTh7e3+uzBeinX6Z9duEtuSmyFMzYoS8Fm0xa1g20w49FcxbBpBEh4a53K39IVfAE8GYep8qhsgv1X48Lpq0EBnSh2pC7GiqlaW5bfjFKEVPBbabjVYfd8l/r7LHuTuFNPfvhlSAuuY/4VfYUHqBn3wx7Y2JupQSkVa7g4TnCRf9zd/5D2OYHXrXr4/jrzzso528vEpnMS3jJftbuT4mCJK7NgMsODwLlLqDimk5F6PbEBfGdoJGS6SgHHEcBmMTOmXbNR/z0W8uLpCtiLW/TThvnz6g+uwO4AXest3gXKvH+J5/MPxmlsqH43aB6tZ5DwPNlHOR9EAGh9+LmK39WF8wCrqnJIsBp/a8JrFn/f+yu+zNVRQWvD8TjxNCw8EOGPSWF6zSAwugEYUe3piK2iUvSvGOhmsJEHjAHLZl3OY27yg8nrPk1yfARfz/SQmz3tfl9uaO9wWuufArUKdIbWw1uzGcMKHe30DTuETWDxjPN9jmMKO8iQv36Pw+z50a1E3uNKFs7NUTJ5ybyVugZZ5B4RG/HxA7K+PNs2ZoIrCHzUhHx02g1Af/MjymIzWY54TTkvCfV8IngHUb88Ep5WDwttozJAcohdX4IzHIGiL3dIJajS0ejJVbXsEWn/DFmhMiUbq9RBMyo2cNt0vAWOUeWmXknQM3aZV4t+CAtAuZTFYpDM= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2379cc6-1afe-40e4-8664-08da50a0c68f X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:28.5130 (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: 6+l4vyomyb/hKeBQZ6DCecGsAtMvCDMmu+YmTsk2eiJ9GEcNe2FOnHh9EhnwWhGLTUrD+G6mIXZ3Hz46y+oasg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133439_681780_3D21CF06 X-CRM114-Status: UNSURE ( 7.55 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This adds bindings for the SerDes devices. Signed-off-by: Sean Anderson --- arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi index 0085e83adf65..de2cf36824fb 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi @@ -413,6 +413,18 @@ bportals: bman-portals@508000000 { ranges = <0x0 0x5 0x08000000 0x8000000>; }; + serdes1: phy@1ea0000 { + #phy-cells = <2>; + compatible = "fsl,ls1046a-serdes-1"; + reg = <0x0 0x1ea0000 0x0 0x2000>; + }; + + serdes2: phy@1eb0000 { + #phy-cells = <2>; + compatible = "fsl,ls1046a-serdes-2"; + reg = <0x0 0x1eb0000 0x0 0x2000>; + }; + dcfg: dcfg@1ee0000 { compatible = "fsl,ls1046a-dcfg", "syscon"; reg = <0x0 0x1ee0000 0x0 0x1000>; From patchwork Fri Jun 17 20:33: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: 12886033 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 9C4FBC43334 for ; Fri, 17 Jun 2022 21:04:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nrYuAWpeJtac3zqtbcpuSF3hC4mt6/VTBEsaY/iNPZs=; b=CVS3oqkcrN0K7O DX433Y61WPYYxBTX6zH+pIQl2SLaVADQUO8rTjwgdPoaxb+NtMM8hOgBiWnX61R1cuAXrYtGlOIxc D+L0KU0lrxN6t2WZ2OjgRVcC5Rp7iWC85AFnMaApyuu0uLE6aZBzg9FCiRn+/6hnF8uBAJbRm5tH1 HChOZXXpte/CaFddjX1fQDykT5XqeDPUkcX8WXUR1L7kYfr/6cEtHKgErGLg5FCAQwltJwvXbeCnz R8eVt+9llp7DKdj90V9HqXuah3YnZF8pykM5vU+BtKHwSEQN2n/6j2n0NKvkfPFLQ69a4IfL61PRU GHBYvZtdvyJptaiDZACg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2J70-0096vu-PS; Fri, 17 Jun 2022 21:02:42 +0000 Received: from mail-db5eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe02::60f] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Ifw-008xNk-Uj for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 20:34:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HwxIJlWsc7+GPnLnk9NKePahwwjgcTFZ1umghXlznXMeg/iRw9XRk4SE5GpQ0AoDepip+GSzxDKBv3D1D0KkgjgMCfpOWjenbmYi8Cl1MxZSQx1nFLwbELvRlA1V5bhvEQuCpLUP3UqrA7nmNj87hW7grmgV1lYq7tLB6Q/LtbEdDso1mEY+sZlF8C1k5mznZZuQUXi7Y3H/6wH2exqadgg5rCUZaazpXtvuq+JM6wO0CsA598QqDXRAiqtZWYAp2EThPmQBKkD5FzCbwA3y5xXfKUoBUh8uSfQXL50JL5/I6CiBLq57e4juLlMp+bm4JF7GiHMrTH/M36Ya5MEu5Q== 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=U4NrkRaqMwBvFMWtFmoLov7ytXI3OWJKrvNDhIqR2to=; b=PFEVUWBjswBfZ6Gcu45qpMnuahW/zGLliBSc9/SeWyxwQwbxQ6HXLhXnktgSyVvyqvzSPoF/4aiEdBrVa0tyTuuoH/sT5QxYc/Skb92rGG1dDncaSYGaISzmlK8d3ansUowKUMIsw7Z/zhVeKP5WKoHBcQm6VUe23k+gbiSmusprO3Ld0k4I1X9qk1BCStlzVm6jBDWWWy7d67USP3dbyMB3XUHa884/b8qmI8aJsSpN5+GCC6ALfY1GCPLU2HPH23XI/ncGFNPqT7lyeeVPMLLiDsbARNZA3Lax5XWgTEw3R8nFXaiShw7xJ0uUEK9OPySbsVJO5kHJIWuzpkkODQ== 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=U4NrkRaqMwBvFMWtFmoLov7ytXI3OWJKrvNDhIqR2to=; b=qdKf5e2y8thiS5LPXw84BVvY1zoLz3yRmy8oXgZlSf27D2MqFim4+jArPW44oDyudH0+Q8AmRRGJTag6KzJYYZfjoN5v3hq2Y2b1MALMZUxoAzpKdq9xVOEYy/R91gGBv07R31B9ELnXKthXwCxfu+URtLZdpGTRnMqYth6683HS+wHu7/xVLHTXHH0Hdwxbv9KrgyVtyQh4FMjnj9rRuMXiURarqGRzo5l+ZOgJnr80KARGZ/sIFPAnywcEJm4VfWTJq7b4OTu1M6upI5T+igtR0fS1IzTxnThLYWG/ubqJDcOIO38VCg6rBFuBBXkmumLfiZ5xtYBA6awhmq06lQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) by AS8PR03MB6838.eurprd03.prod.outlook.com (2603:10a6:20b:29b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Fri, 17 Jun 2022 20:34:31 +0000 Received: from VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d]) by VI1PR03MB4973.eurprd03.prod.outlook.com ([fe80::d18f:e481:f1fa:3e8d%7]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 20:34:31 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Paolo Abeni , Russell King , Eric Dumazet , Sean Anderson , Krzysztof Kozlowski , Li Yang , Rob Herring , Shawn Guo , devicetree@vger.kernel.org Subject: [PATCH net-next 28/28] arm64: dts: ls1046a: Specify which MACs support RGMII Date: Fri, 17 Jun 2022 16:33:12 -0400 Message-Id: <20220617203312.3799646-29-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220617203312.3799646-1-sean.anderson@seco.com> References: <20220617203312.3799646-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0384.namprd13.prod.outlook.com (2603:10b6:208:2c0::29) To VI1PR03MB4973.eurprd03.prod.outlook.com (2603:10a6:803:c5::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5442f662-44c2-41fb-5c3d-08da50a0c80f X-MS-TrafficTypeDiagnostic: AS8PR03MB6838:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N2roVqVDVXe6OZz0JNX0zhZc1xXY0Iqu7ZlzwrusDkiQV7zQVvaCBoQUhIjb405UV43YE3QR7zoDC5MGeyws8g1M3b4bsUAuiCPbOYQkfoHelAIcfKNyKzpTLLvmzN27txrzzKt5vzG4E4NIiJrEEmq1prBBeHl5rPWvnNGb6iyQ9pfEoFJMwO0d41LOdY07kfiS3ixZ8l+iYqN8ky0OZepHvDWXGtRS0VIdPIpBVn4Jpm4PuoSH6GnaxxIpQU/lJZdlYq1qkjInsRD7mu9UtBDWGxt8ibqkuWSSc7LTvFA7wU78eTdDthuH0tDwv3GyZD9+BB8c75N6R5mabKH4HQXn/eIyIg7ZwMFB7yd0XxBVNkzX/MPKBhSuf4BH7DMGBz/EYxoKMzwslnxXk6LmmAutmpzHu8kX99LdGfyg2RX8U0JwiJ05RBGjmTZOzLU6z/7syNM0Rv1K+1OeBWaiIfYmeXAOfVZ9GnVYdBwVjSX3JVAsx+joxmwZUAQCaY4Ur2jEcHbL/hHVpRmxuNYI5DCn99Ve7x2n7WnCnAu3Tge1+PdrZTp6hwwUftHGTR44LgimQAOwQ+5wqJ//+SvQU5nVrYS/aFXfOBruhEEafpOKj+osLQMNuuoSJquxjaOFdeQ7nnhTW6F+uz9woV9lEM9Hct/PDXHyH8sDr1ztCTVEsnnTeP8MFKZmvJKfEB0+YpxbXMilrq/KEdGn2xQWuA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB4973.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(44832011)(2616005)(38100700002)(38350700002)(8936002)(52116002)(26005)(316002)(36756003)(7416002)(6512007)(2906002)(4326008)(66476007)(6486002)(66556008)(6506007)(5660300002)(83380400001)(8676002)(86362001)(186003)(66946007)(6666004)(1076003)(54906003)(110136005)(498600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FyxehabTRoWE2p5BWLFAaXebmFDfO4sMHiy0SmLJHrdcDXFgyCaJZ17k5O6qP0i0Ce+VKZ6uJrr5lrbTv9OTuAqNlqHS5tyXPN0iJOnj5dHfLHdIdFlHLfr3Vftf9uIGEUdNmuifWBow5I1oKumTbwkZgHDxm35l863xO3w4oFp7+xrLTpTbztsYcDfxH2fxGphUJBejaRSoiNeSgC3jFVwupy8WM5vnxBj7QhSC1Jk5GZEejrf9Pfzz0DEdPUCf5MkElsyxLF/PNnIIz8D4t1GMk6UUrurZO1aRgxMB7+ALdOKOqq7U9RiyQKo3tmRgqmJO7B3LlLyoZxw7nnp0QYWY0tffjwOC6DZ4nXCOA+YOI3+hcvRyLSPOJ+UHpIn+IX/XpdFWVSK0GkqztjHFVoo5YsCXJbQRJXfD8CJkBcMTrQJmELwffPPeAt2EfsN/hOg+y8vmsbBpUnTW6yqE1xBKrrHYbD7UZgqg5NOez88Ulr2gy9BNOmjpL9ljHuj/SvYRP9AOVoZd3NuiMy0HfPX5eyXoRlUBQV3EZ5cKL4AXf27MEuoHK7XVriFAWWER8Cydgzxa4yMwlp42BJs30yJwblVRlhVppc4OAqBmehVfPY4oVc/7qHCYfCRpeIp2N6MNt9JfxHTMH4mBRFQ5lO911d5aZuCeZZv5/aQyuqmi/N3krgcgHx/ZEL+eooZAqtZRPbEZn5SOIldI8mw76nHypwzf3yVEYOmAHkc19kHhsyfBm/ivncB4gwhFSrsSrq4cjSGWEzAibOojx3OzmY4ikVd1J2jmaXDVDol8HjWmYgd8l269kj23I6V11yxxMxsrIsE/i+NhCSEfBlZDWk+1DyTZehBP0o8IedyyMLXcHwOM8rgHK1nojk7tp7qrnuvfnYuoCiwsH9WB1O9H2qLljWB5kISFU+L14PcIIhFvcYoNt+SGld3BHYh85nLsjH1NcCh3Qx0eKlDUKPfBUevxhZVJkVFg2tFU4m0X3+A9wt9LItcdGoa7cpkXSRujeDR9/vSQDRbn+aV2e3xqYHi939aC71RIsFpStTNKSJZcl5WcBd8zLC+wT2j2vHv4eLREq9q+ftLsQYPBN0h5FA3JTi4yjveaWcstri+9zLjjPYukMDrvKCHS8hUFB3VkdTgUq1y9tkpeywafw6Vgz0qOt9gz6FyqLLBiwWJt9ffPIzDxE0+ZeEQp3tm1ZPzj4GXckfcOn86N2TaNNTTNGKnal4PWZ3FN4feMi/NSPGVAJXE8wlj1JdSuCB006e/qy9vF9G90XnfH8yRGU3nDf7oFHZvxZIhd+bs0xT7o+ksM5O3KO8nv4xGhVomZl9957hRzTwDcoG/MYb9X9U7uAWePxd5ZSbkPd79Lt4MzOKmcgjgWwUjWYXOgS8jpOsJ4aDq3UQUo/5dBCyQ0vZ0dRjqNzHeKsRv5kXY3jSSuSW8MpKTSXt3/t0BghB6xFkPCOajk95uW3VD7U4Dl0uxAxkmfHtsvhHPmfuwzLZ9cU0v1dkfD/pg6HFcloMBvnYfSU1Df0Cf/QGi34QYYgX8EV1hrRKOOGEBrbK02jlqPc+yTgFZIiAsjLGB34KK2IbxmykfmS8c6So5LRmrZWPXAwhFSNngy+gD4vDLZ2NmesiC/nacT8hcpB/tttFT9ZkuWxNCVC4MKktpueC70/ecYf2UcGLO9gtyZCMsneHOAHfA5lEZAJ0yPg4X0Sq9d3wbHIupVGh9HC+QNXvlevYJ0q23DufmwyD2G1w+PL4Yr8Qk= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5442f662-44c2-41fb-5c3d-08da50a0c80f X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB4973.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 20:34:31.0285 (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: 5Y27vk367/RGTN0oEZICEdrJgHRb5Rnbsl883zY1tvohVypKALtV91NiFg+ljKhFF6z9A/kxmaIiDgqPTFMWmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6838 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_133441_054711_8CD259DF X-CRM114-Status: UNSURE ( 8.41 ) 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 For more precise link mode support, we can add a property specifying which MACs support RGMII. This silences the warning missing 'rgmii' property; assuming supported Signed-off-by: Sean Anderson --- arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi index d6caaea57d90..4bb314388a72 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi @@ -23,26 +23,34 @@ &soc { &fman0 { /* these aliases provide the FMan ports mapping */ enet0: ethernet@e0000 { + rgmii = <0>; }; enet1: ethernet@e2000 { + rgmii = <0>; }; enet2: ethernet@e4000 { + rgmii = <1>; }; enet3: ethernet@e6000 { + rgmii = <1>; }; enet4: ethernet@e8000 { + rgmii = <0>; }; enet5: ethernet@ea000 { + rgmii = <0>; }; enet6: ethernet@f0000 { + rgmii = <0>; }; enet7: ethernet@f2000 { + rgmii = <0>; }; };