From patchwork Sun May 8 18:52:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842511 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8473C43217 for ; Sun, 8 May 2022 19:02:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238304AbiEHTF5 (ORCPT ); Sun, 8 May 2022 15:05:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382408AbiEHS5W (ORCPT ); Sun, 8 May 2022 14:57:22 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2115.outbound.protection.outlook.com [40.107.223.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34A90BC08; Sun, 8 May 2022 11:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qy1xoORiUD6qIHaofOxNTSEsMe1/ehikrgroS6cN6Q4zo3JRmb4CJzEF87m4bYZ1+JEg9Yt6mM7pL+d7ocOKPz34dbLSWsgS8EBw2+60jlN4CP885vsxg07FYhl0BNYQ0819fHaqqx61crYQ3sz0c//1yCKIW5DAkAve02urKRt/oWx3W7YMeAUFthtDmZRuN6fzFSiPvdCAREcPYYpZ+FwavKkF/aem550sK8Nyq2Kh4+JUlFLO2NNjvPaZn9G8RSnluyrBciEiUSkYi2cGGHUpygV4V/XHwtX1a26pOJfHokjaqzfqjw4WmBh7kLcRv9jPkpcPBU0/Ct6D9yn+/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IcVskv6WnzwPW3s4W2EBmoqO9NyB9w6el8NLcOf2dZw=; b=f7a/KIdbwWrDGi1rrbmROq+ah/iBwNsbScL4zbyGUu5uIL2bn7fiYm3IkSjZSqCv9hv2Q6PdJJibfjm30dZo7iq2/j6yDHvBApRxSg3sZaQ/9popU+dwhhy4sATgz4hy3UqCAPfm8yOCgCrgDrShHu5ISNC+emFrHsrDj4lYTIvYxbQQEqOU/5ZGltfs1NpEvnVXp8/0huvNT/L06+I5FNTGfzX6D9WDVJ300nDtm17viQN5M2IBASky/c/rToa9lgTY4mJz9/AbyGy51wI6oH5k/LtQUu5jrnHGXnYb1vHHeL5etM6kYDdaM8cIicneX6WoINxYMRtkDbUJVY/DXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IcVskv6WnzwPW3s4W2EBmoqO9NyB9w6el8NLcOf2dZw=; b=Vg1OhgMGsAqY9P7GzyOxmns9ycXbh8y1fOjLkKKo/7YoPytaxOS9kIf7mTCFxljvBvj8zAM5KMiDCqaBjBxF7tRjt6ZDyFXpBdFtkM5ca9NGWpL/qKlZjeACGLA1ywKAy1Euy/kOt3Spb19MuTK0VxHs1yYu44Z8k/UiRGJsxJA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5533.namprd10.prod.outlook.com (2603:10b6:a03:3f7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Sun, 8 May 2022 18:53:27 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:53:27 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 01/16] pinctrl: ocelot: allow pinctrl-ocelot to be loaded as a module Date: Sun, 8 May 2022 11:52:58 -0700 Message-Id: <20220508185313.2222956-2-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 98eebe9b-5b88-4f1e-1973-08da3124095a X-MS-TrafficTypeDiagnostic: SJ0PR10MB5533: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: 9tShuiKR3VVzb7JvyNRzD3PzQQ/Sa0dN64ltAXEZZblnFgvUVdsn5KiDsqlAbh/Y7wRfGrSxArAAEn8OymhjKTmUHTRlNRAeXN8qn06m4BIXSG5Fsuo3PQN9Me+Mfy62MK4s0wnJG6br6SAUprXBFY1F+rpl4twT4+NoTQtedyhikEIpyXzZCdg7ULeIQkbcVY48u3ArEglRVwmw/5j3h4kyPRXTPsRLjjreGsDQPfqRUv8iBsxqum5JKAyAbbyMXA17DAaIAh1cs7PDHIMjtr6UgPNWo7HqX9vUysvbzXYMLCiXgaMAB7PhQoCIg4ENPKOTXHgxjzdDNLtOc0Bb6GU0WIZ/t/QU4vLtDeKbMFocqMptHWq2/JsgEN5smecMV6TIW1XytaQVuWfWOeo2FsPj8Uzl7GjcYkk5+l4AFcNTlMo1ZIPFlCzda+hjh0b3gLFwMWjNsnJoJOKnvvO4dEAm4YfwPur69gMFwZiO4RiJqOE9MkvMV+rI0QNLKPFsDVSs+RFOYM1TBju2PLcTmdX98TgpTvyNezVGVOCSUr+xejG9plZViVmlsk7ex+5GxdPrCR0XDNrzEW5+yOUX0gj2Xn1PrxHBGD3IcJhQNej8LhN6okc/8Ir2lFp48aoRDew3N7tNyU2Bo5L8AakI0d42GWvYzyjHUXCy5oK5/ZsRBNYW1acssv2vK5lBroS0jMwYLH0wC/RUX6E5EZ6U7A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39830400003)(136003)(376002)(366004)(396003)(346002)(316002)(66946007)(6666004)(26005)(66556008)(508600001)(44832011)(6512007)(6486002)(66476007)(52116002)(186003)(86362001)(2906002)(4326008)(54906003)(8676002)(38100700002)(2616005)(38350700002)(6506007)(83380400001)(8936002)(7416002)(1076003)(36756003)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exch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NCgVWpMMahG3VQYmvhpIwLfWudb++Ruj2cq5Z15z98qZfBhxu8s7WlhckHwl42SlFV7s+aC9XBkyYAYrzH5owbzT5AQRQU1RBcPwy9u8X6IZuGf8/tXuJ0/g4pLrBFv8vKh20m8AvB6vZa6OCqvZDNU5cSz9CG7kR3M+O05Bepj2FOAj3pjqS7+ZjWSPFbeUlh3vYpScUuyVRnnAKbmm7YhDgmvX8VK6j0jnRyKQ1faF60SrN0LH+lK+t9pN74qFql09tk2EYl58Ks7I/9vM76AL0OWvc0JlRJAhLPufGdoNoxyL882/RtthYEWOm6dt6RsdmdOai/5XtdKWfYLQ5vFi5Q/87YubYJJlNFOU1YGpuW3YdSIGRy9UykNG1doPtBYuF2nfKni3OtDOyPrS4IAF1gVgAaU10tS6Ae2Ptp/jgx/6J8MANm1tQe/vzhuemQLpniIaz6y8OCXPODfj0X8mVQxtFCBVM0gjktX0skr22ns1JnJagQL2MoUQCPaml6fHMWo9U1yddGuNbTAGVWibDajFtF2fXNCF8dek89sLccDlE0dIJRs2J8l9SUTqKSvQL8/v02UhyLrN3uyIYi90tgaorUlKvRBjyUOug5Hz7ILldq5ac5A8dMLDAY4KOYymG03WKVGMdz/Bnh0UfgX/SEX4vIk+xOgwt+vqjvds0uo5AEZzeV+ggpaB8vDVsyFPhJaZnPlxq65HmqkO+cJoiM/+ilqN56 X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98eebe9b-5b88-4f1e-1973-08da3124095a X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:53:27.4173 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SmNwmcLD1V3epKHnE72bri2GlJsVyyHtwadkWr1BbZtr19WGAX2GA6n1mM3bxFqAIwICpDFjEcDAK+7FRVG9j7a7zh9aNt42mLxvYIBniAg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5533 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Work is being done to allow external control of Ocelot chips. When pinctrl drivers are used internally, it wouldn't make much sense to allow them to be loaded as modules. In the case where the Ocelot chip is controlled externally, this scenario becomes practical. Signed-off-by: Colin Foster Reviewed-by: Linus Walleij Reviewed-by: Florian Fainelli Reviewed-by: Vladimir Oltean --- drivers/pinctrl/Kconfig | 2 +- drivers/pinctrl/pinctrl-ocelot.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index f52960d2dfbe..257b06752747 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -311,7 +311,7 @@ config PINCTRL_MICROCHIP_SGPIO LED controller. config PINCTRL_OCELOT - bool "Pinctrl driver for the Microsemi Ocelot and Jaguar2 SoCs" + tristate "Pinctrl driver for the Microsemi Ocelot and Jaguar2 SoCs" depends on OF depends on HAS_IOMEM select GPIOLIB diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index 003fb0e34153..30577fedb7fc 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -1880,6 +1880,7 @@ static const struct of_device_id ocelot_pinctrl_of_match[] = { { .compatible = "microchip,lan966x-pinctrl", .data = &lan966x_desc }, {}, }; +MODULE_DEVICE_TABLE(of, ocelot_pinctrl_of_match); static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev) { @@ -1969,3 +1970,6 @@ static struct platform_driver ocelot_pinctrl_driver = { .probe = ocelot_pinctrl_probe, }; builtin_platform_driver(ocelot_pinctrl_driver); + +MODULE_DESCRIPTION("Ocelot Chip Pinctrl Driver"); +MODULE_LICENSE("Dual MIT/GPL"); From patchwork Sun May 8 18:52:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842521 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A685BC433F5 for ; Sun, 8 May 2022 19:02:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236125AbiEHTGR (ORCPT ); Sun, 8 May 2022 15:06:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382416AbiEHS5W (ORCPT ); Sun, 8 May 2022 14:57:22 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2115.outbound.protection.outlook.com [40.107.223.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21166BC2A; Sun, 8 May 2022 11:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pp81Js4oveiF982QmC2XDgMRWXUC60Jo3ljBJJoa+gpx7yBgE8LCfdKeUzju3PtAveuMbcH3DYfIbQzNlB3SIpVxk143lDAgE8SXXdY4cNGFzwPoPd29H7mmu0uxGXoB2Wl9f8vM1ecOqWAUBvgjGnWy5etjvmKiskwTNDGNbar1vz/4HJA43NP9jGssGPsSQPXehcc56V1QHSZ6l7wCnpTZVKh3uPLjGKJ5z0jbB80p5V9xVtSEDAL6gNoClngFFmSyIMXHDb7XByNbqUbVTG5cju0KNOva2Cm8+SpZKcdWKfyNj9u/gXDLDHyxcQ8HBDbi3Go4P6i+/q44nt3Vvg== 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=iXQwP9b20MbV9INks6JY8ByAOW473YppEkbxqaEpYQ8=; b=ClP2HOQRb8klDGJsKsF9bUnHIWiFIKFNko+HJlsQLodXIZcwIYKPQdL+6M2V/jm98sTOWrH6PhIvGizNGWzzg9gurbG+/T0swAqJ6lvIfyYEf26SmzXbV/wtCIGz2t6PqnyMLzLwMDmw5nyIeCh95inXWgG23SgIsPAW6RPfzj5wat8W9c4/O5ueKNSPA3x9HQWTBwK7ZS4m6D0QnD7j4tRLHyIOmXWdCc5M77xS60FhP9qSK4ehcycLSuMVtZMac1sj0QFl47I7BYhQhKnASc0YC/LUYH3YEUKISezQyXwQ+uFfTqGUls2jdzpVkksnxeOK3bfTU6rXjMwHq54Cew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iXQwP9b20MbV9INks6JY8ByAOW473YppEkbxqaEpYQ8=; b=zv3F682WnixpIp53ybxMdovXgFEouAaCQLJTsjFsQGHRBfuq6BFt/gtWQm9dLaS5K/hvCXwx0QZRupx9WYx0TSLxKemXCEE1p3QnXDyXOYVqC8teFmVkb+2InlZF3sIGfqnJJin46WnkU1kww7iTCYSFQz/YeLBAT3NorHIPYLU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5533.namprd10.prod.outlook.com (2603:10b6:a03:3f7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Sun, 8 May 2022 18:53:30 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:53:30 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 02/16] pinctrl: microchip-sgpio: allow sgpio driver to be used as a module Date: Sun, 8 May 2022 11:52:59 -0700 Message-Id: <20220508185313.2222956-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 652e6004-73af-4e3b-6211-08da31240aef X-MS-TrafficTypeDiagnostic: SJ0PR10MB5533: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: mqDiAsf7jqYTw2x0hJLek69w7Sz/nqkDqYJnvjMSoSKawy5L+Geb4HuY7sp4jE8XIDaxzcZDaIFOIw0JUmbl/y76momEb7XXcRNIfdnFmSq/CpTd9VbNFh2fZDXHOtnWFoD/4JAr/uYPF1GoUaDNO37OZThupmEstOV9Eyz1pir9hJOexZKN6CzDlZ0Pthii2uvZODe91c5fvfDleJ6MZ5OVGNA1fCiBp6gTQ11OwHVvxl4Rlqa58QClNyJIHde8zfGXlNwBulD7Obb0lIcYdxyQB8lN/TfEmKj0mixSrAs4BvbOBAOrSYREWRN2xQoXc9SmuvapxWeeTkDJ3gpvrUiVMWIW4ngUqKLa9XfdOuKJ60P/mLEDdKctdcK5gM/9l4CRBhU7+r9bM837NyoAVVTKsKWzuj71IlUK9EOfxSqoRcvtsK+X5jgVNSGRqJM9iWLYNTUocY7na+5FySQEQ6kaFPLaWylb4U06AWnIdKVaIPnPeYbj1pCyB8eIZMjHjkA7KQW83/jB2wkNhdSE/y+9++4zb5XJE+dD467LYgaWClOI3lhzPfYj+8ehfytkoOK1XK/vx5plfvnJFyL6moEcIExsoqt0obZ/xwA5XhTZJEyTqNS8tKr1j4Pl7tuyLQJeip1Z0p/PX97aiv57vc3Hq2gioHnITTWo/F18Gem+hWWfpRd/CPu40o6MSpsf X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39830400003)(136003)(376002)(366004)(396003)(346002)(316002)(66946007)(6666004)(26005)(66556008)(508600001)(44832011)(6512007)(6486002)(66476007)(52116002)(186003)(86362001)(2906002)(4326008)(54906003)(8676002)(38100700002)(2616005)(38350700002)(6506007)(83380400001)(8936002)(7416002)(1076003)(36756003)(5660300002);DIR:OUT;SFP:1102; X-MS-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jbss4vjruHA+7ym3Xqk1xYMzpW0llu0ZsyUhMKAlj0wQHFhDqKitMBIaBWaBMFUOlLqr53SCY8gcL5mS/gpttcXXh/2qod89KPrmDDlyrNkqTietee19/2Zf10CYFWed4Etu1pJnZNDrGS37Zt4lIbHIN9wrw0661YLycUwv5Z78UJZIdWRwpdgKWbS0WTa/Oa0ll6Zl7/n3+0/MpWDsoTMBWhkVfHVpqKOdQNCNOSMHWoIhTX9ghKDptMe8yofhLgQCsbS3/92NDcnYSpKHqF5/DoQJwdzUnCJ4dFof8ElcL/xhoMk8b3Dlqd/maGPMHm6+zoWD6Vj3FKRgVbFQOhVKk1jaPTELCHQw0w+chHMDaVbsFFyzqNHIIvB31f5/EwDFe2f5WG3tYk2Uf0q4sBJgEnx/h3nwaE12+NcHJORRYIyXey5fy1B7m4rlGK4hu6W8nbrNeaxZAvUtLq+dfg14P0KW3cBjVTxPVOzxeQySUC9HT9MMGTxaXciyxydMPGS0i8QHQdsJVd68Jz113BHvVjQbH813nXVXGjLXlApQMsPffoBIplbmyw40HDtKk4PDjU70NIZ9Z8P1pHmE3gLqoOuiBkG84Cxssf8Uh9rD9RM2otUUdrvCtCpmlmUQLF82iqe0ZEUoEIZ9EDXYmCTlQk8JExeUJvJJwezukrxbj3TOTzXu/SP0pJ0Lssd+OpORgY2OgsDhhjIXAD9t1fj+wi/W7iS54nYYVwf6t8FT859q8LAFot8zkWDtO X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 652e6004-73af-4e3b-6211-08da31240aef X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:53:30.0734 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: W6IK4VVDY6oQl8jEKOezzb/N4Tilr1nsT9xaFwqDbMrzu87M+yGxsdsaheuzbxKmORdaquqnM/eoYwzkFqbdifmvr6AO1G+XBTfBE6CBHR8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5533 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC As the commit message suggests, this simply adds the ability to select SGPIO pinctrl as a module. This becomes more practical when the SGPIO hardware exists on an external chip, controlled indirectly by I2C or SPI. This commit enables that level of control. Signed-off-by: Colin Foster Reviewed-by: Linus Walleij Reviewed-by: Florian Fainelli Reviewed-by: Vladimir Oltean --- drivers/pinctrl/Kconfig | 2 +- drivers/pinctrl/pinctrl-microchip-sgpio.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index 257b06752747..40d243bc91f8 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -292,7 +292,7 @@ config PINCTRL_MCP23S08 corresponding interrupt-controller. config PINCTRL_MICROCHIP_SGPIO - bool "Pinctrl driver for Microsemi/Microchip Serial GPIO" + tristate "Pinctrl driver for Microsemi/Microchip Serial GPIO" depends on OF depends on HAS_IOMEM select GPIOLIB diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index 80a8939ad0c0..8953175c7e3e 100644 --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c @@ -995,6 +995,7 @@ static const struct of_device_id microchip_sgpio_gpio_of_match[] = { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, microchip_sgpio_gpio_of_match); static struct platform_driver microchip_sgpio_pinctrl_driver = { .driver = { @@ -1005,3 +1006,6 @@ static struct platform_driver microchip_sgpio_pinctrl_driver = { .probe = microchip_sgpio_probe, }; builtin_platform_driver(microchip_sgpio_pinctrl_driver); + +MODULE_DESCRIPTION("Microchip SGPIO Pinctrl Driver"); +MODULE_LICENSE("GPL"); From patchwork Sun May 8 18:53:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842522 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7699C4332F for ; Sun, 8 May 2022 19:02:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238923AbiEHTGX (ORCPT ); Sun, 8 May 2022 15:06:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382458AbiEHS52 (ORCPT ); Sun, 8 May 2022 14:57:28 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2101.outbound.protection.outlook.com [40.107.223.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E8F2A1B1; Sun, 8 May 2022 11:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k50dYPqU2chcdkHAIkaBmsYDLdC2w79aYv/9Dc0YVPpHr399HMH8bGlUHwVzfQek5Tj1Yf2sj9rw5ON/zc5EG6ufzHCExQ9AJifD/Kx49ONrbPdPel64HJlm8hf6nHp11MKi8V4ht+qPS414XUbziG3pgu/B0Cyt5dM6CjW25kvhPgcKonJgDWET8jGVfVyuYGXWKcNZ7qP8dt/VHumBT+BVNiXga/W2U47J5cGpXGKQ/ViOsZ07J61BgsnQDIWpuP7RqTeeGz57axHlate0ontYRqNZDx4yUk1vtHSWnvgG+dicYJlfYytjh46HHgu5K1jjCz2gFnS7XENDVtBZvg== 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=lHA0gxBULloT1d9GVK35WIKgH38LA6IF0kvowOr1iIE=; b=QryKOpNswDR26kjAAUxSf9zCSOWrV/FSSSXl+i4/IboDjMKPB9ziNoELUVHvrxhp6Ge+5o1cFupRxoVEBCbzMwKksjIBulWK9gwKV0CDopRhKpRidQhgMFvc5mJDwh5+ucyx3GlE7f5oURAjzQMfMqwVZlettQ7rkNlt1yATUQUkGtE6jBYEDDijCfTqEQntzFEIe2dhUhWwxzneJOlBjAd3rJxbB5O7J6UGtQoOK9qH3I0YY9147N3N+TyIQdNVd83d7vFIfarUTyNGc9cakIgBZfPnJ9oxJFVRDLwjTJPbEXkkupp1gnaHXwSEb0J3UXbftVGsl48kcFpWuVr+Vg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lHA0gxBULloT1d9GVK35WIKgH38LA6IF0kvowOr1iIE=; b=tI/VQwgjVWhxIz8QpaY2ChHmCL+PH42B1yrDdMmqJeO8EwPSkQ0XvVFScogIHXRrd5vZdqe3zriJa38eeF6MHtx8o+bOyl3SbIOldqnFWp+PjOLd/c2m9CDN9bIKVf5cn2wNXHQlYNqGHbPISen3oC5gauWHMtpvB915dxKt4QA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5533.namprd10.prod.outlook.com (2603:10b6:a03:3f7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Sun, 8 May 2022 18:53:32 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:53:32 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 03/16] net: ocelot: add interface to get regmaps when exernally controlled Date: Sun, 8 May 2022 11:53:00 -0700 Message-Id: <20220508185313.2222956-4-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b45d7e9-7a4f-41d0-483a-08da31240c82 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5533: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: ISV4DolRQ+uu9ZXgkMjEyIfjVkFZ8na9wojPMILL+tKMqA6+9bUUNd22e3jYlwNVIHrTaBqX7B0fd926JrYQHUHMdpuNKWNDEZFo/mPVr77eGV80MPpy3rbnpQrr76KaVkP+Wf+cgKpwJYdW+qqHhkj7yORlvpWu4B7jsYZhHXvKpK6ZoweDBtck+xEoIqGfz4aR2WIl6ECzy9HvCN8ThcFVKWsuv7LlGVpcytFwxRfstjCWHbBIM7dGb07M2ILHTwYahpBKoMUQ6M5ymXrHStjFmzJHsYVLbM35ecWAhKAbWUPWUGRxxp7zpop16+oBMSlb4Socef3qzIrcMWt8bZSq3++0EFiV5ihgGVgAcPNASV/nfVLAszkv+N1jmpWTvp4Jhn1UleDm+lQHe3ZqGw3tgOChO5Fgzflyz860RGDyCS87vroC+g6mgXV4pIgkrmUY/7NQ3d2QttWuLZlUYGNqD6rSPPPDPUrdP2BktUVITO3i9+PK5hcNSlF9wJXmdAf7WyYEsyf1UpiswY1Tl1DwBecWH+izHPiZ4Icu4uMJ+BqFm5pQtzDsWaXpaczGCEIY1xE5DYRRhtsBhL+FBYqHLrLNSZ/v8KlR8BNWfJD/KVS7yOZsa7KnpgGARlaAIAGbTW6oGXHRKiPPVFS4ui7j4QwHcqLtkEnfEGf1lJMQDOvQzTf6GQTZKBH3E99kLfFYLX7++Qm5/xVh+aW9eg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39830400003)(136003)(376002)(366004)(396003)(346002)(316002)(66946007)(6666004)(4744005)(26005)(66556008)(508600001)(44832011)(6512007)(6486002)(66476007)(52116002)(186003)(86362001)(2906002)(4326008)(54906003)(8676002)(38100700002)(2616005)(38350700002)(6506007)(83380400001)(8936002)(7416002)(1076003)(36756003)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B/Kof9IgHaKzpPKxG1VQI8y4SDvKdQy/fpEAugbC8+J5U1agShucTOXnzbhSgc1zMwZ8nMVDf6yDSPjf/reswCAt0xuKsgn7+TDVwz34bO1sx7VdUQfBKmHBznGs7MvDCnmFF4E+Efxpfw3tM4zSu/9yjJr0Eg5x/17TIEtdAwmIwlvZHnvC1j37le7wT9BkhIHj940zz4/gveVFCR8l2JN0coNWF5Vwp7gZivnPPeBecobr03f2xe2MKrZ26O85S71MA3T00CXWHkWJB/npCTBlzLovJpjXXjiKpsDPkjaJyCblNB2ulbJaIPtgomscwVNbKkbAz1+RF0KnlIpuG8RaHDXMlv5tw7VZVEKDPQZ7MOVKDW1yXOhM4lBqH4Ih+Es4wjgDEVfSYpBvsBxCmxn1FVMUjBriJ84vrvBUSJreMZcn3xRma+J1JEehE3kIkvXSgRwjwvROghY3ShDUditT4tK7S4tCk6MNTMWuhppz8yXCCUUbkdzstLSB5/nS1hIMU/Asg1lV8KUiUD9nDeL5fuIV7EvKZsuT8xF/ushJa1dBAfDUwt4nIXngBYlcrcTrmuxEZ8ihWh5+UUl2usds2IyUqOUhjrMD5dH8JW8lDUOSPBANnisZrM6ajqm/OuR+uP6SPwF97qD/jnBoZU8m7xx68e/SGrOHamsI/hnSVMCRq0k1RF+EdAKBPJa771SKNyhGA7JN+iyQcl9DiID0qqWI88pjALZmiYrH8nUhrpa9iP8H+lGYxuqQw+Fkt15nvQQRy9RWo0vO4HpCHsZogSi6mZUl7yOP1F95onLHPx6YmZ/JTkVb15y9EPfe3ePgRSR+3C2gqFtH3or8PWKPacjif8psKuolIC/NgOF08uunDbIqywOJxLzFPrbQc2zDke3gQMDh3K2n0wD4x5AT0HYKn3+uw12O8+VTKanFVc94nFiFPJGbEZ6Sfby7msbzrx7azKy8C+o3VVeWKyuHcOcykwLsTM0Y/p8gjXlqWyw9Y2JjkkFWY7UVMjfW7hJWBLyTLIBh9dEkFH7kNLof4CfHH5GwN9fIbRp3QEhucjyuKGCqeakILgauzSGvQQzfnt7DcDGAUbSBy70ukQqLMK1azxNdIkebk2HGLl9D8lr7knOUFKFvb+I8Y2MGSsRqWlQMp1xlrrzV78Jdqnn9hl4dHdHgXcI3YlftKHiPYpZuvzpQKj5oI/So2OpSlecCWnKZtS7wkhfX5QCwX9ALDrgp5rxUl2j1Vz6vnyaYsotWmtzNKe5oQpDE5A83GaIKnsOIRJKJsXlIn0swCv45gEqJ5+LPoqYXLU7SIuQs75eLssEFLZct+7RStNTWopsmcha/4HnZrYw2zd7fDkWDV1Pbd0cw7MFw0DRzxwh5QAa5NBTusThWGrwB60Lj48YRjisL/eMGYJs8AqQOjBJyNpCkaLP9AR77dMk9MeTmVzyPpOHBvsNtHwOFpXOqlB6MzYyvNmcfE1f4StWq71bLbfA6VtGT/iiXAeAGtXl7NOlTvXgn0+X/XQibgi52HYG3w+hfheJByLnScUm4R35Z0E4GacNiTCSvHkUN4PZEHIkdcxZ42bGY/kcDP/GeS7fpPmnqh5c6XAXyATV9RDZ3U2dq4Zqu1Lda1g137wepAOU8NbcIz7iX8PszmekGJ0Bs/VKA6uGch0QqEyuXnFKoxHxMmvRFQ2ERk7zEcLid610y6cCcXtTHKpdHzxmHYdQmfnwQwfrDn+VClDyId52RLhr+HEypN0kkxo6b7eTDeFiOrpwq3kHtp3eMp8cX X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b45d7e9-7a4f-41d0-483a-08da31240c82 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:53:32.7294 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rwDij+SiEiLEgYjwI0utF6CXpLLDjYQSOA1HqD9Se+MudbsENAn9fFX8EzgbWhqvgal2189QpvS6r8qsFFl6yfXYhfKjO2PWPZW6VJyFIGA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5533 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Ocelot chips have several peripherals: pinctrl, sgpio, miim... If the chip is in a configuration where it is being externally controlled via SPI, the child device will need to request a resource from the parent. Add the function call that will be used in those scenarios so that drivers can be updated before the full functionality is added. Signed-off-by: Colin Foster --- include/soc/mscc/ocelot.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 8d8d46778f7e..1897119ebb9a 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -1039,4 +1039,11 @@ ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port, } #endif +static inline struct regmap * +ocelot_init_regmap_from_resource(struct device *child, + const struct resource *res) +{ + return ERR_PTR(-EOPNOTSUPP); +} + #endif From patchwork Sun May 8 18:53:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842510 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6AA3C4332F for ; Sun, 8 May 2022 19:02:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238180AbiEHTF4 (ORCPT ); Sun, 8 May 2022 15:05:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346948AbiEHS53 (ORCPT ); Sun, 8 May 2022 14:57:29 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2101.outbound.protection.outlook.com [40.107.223.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB840BC08; Sun, 8 May 2022 11:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fsCrc7atXfXe3UZollBWUE9ZUsbNivGESZlrOYrtYke6jeEub8xR/Zum2HhjN6kLnh1z3/5+FIpDuaWsFjsQtldfVCVvGpLpnQmFgXKLhjr11G0PNOzmXp0kwH6zupxJeWQ2/o3xjQKX9brVVheu4KzZcm0v6TfYcuaAH2OK1TifxWMcsl0bL/tFHPoIpunAFQnORWnPXXBY+hCLRyFhISzWzcBAwZKw+igFbrCk9NW3cPKrcJnaf1kocO0fJmLuRFzbX/ten+bmrFdulcayBZ5AcZ11I+hByz4hU1NJBTufdMhnM6UAnFNCbKveggUwBET9KjyCwdPnbp6H2f+Jeg== 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=iCB4Vx2TDjKwAlu4m1e0KeGA5ZfMHTw0YwLUoW/ut2U=; b=WBrd46BW89+A5nK+af3Mi3o8nMVW8g4XmIzgYKfcF+t3oUm/S58vq3eiPRA84OXA6YNH7L2oDM3rX/69PwJf5JJrCjxiO3jC6PkIH29G37JrGcIvjbkqOVHL1GdPVBkJsNZO2Uo8iq7aQS2WnF1iXBRhCw7+1eLcPdoBN/Y1MjA+rSPSMbWHA2qdr2FDdtpq9kY8I78faOL4+zCjtgRQEOrPjo4P0S5TOMCJPXSQKecd+Z65i8/TmtTvmGTfwnoyCSEd2C4nFb1VyUyKg7sv3DIacLcr4c/qLexTPL21X0JUQcm3/BH/XSaQmbSARKbSpI+6B4p4iXXaaqBfEM4zgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iCB4Vx2TDjKwAlu4m1e0KeGA5ZfMHTw0YwLUoW/ut2U=; b=r7mAguzE/t4eNj/9BGFPy0qvIgSd8f+/9ApIWv/zTm+k+W2oadwFHEAhSQzn8ZarcPBrxx0JEQEWw6WsQo/o8ZKebxp8Dd2CdIdEX/ILtMecnQt5kKgjCKBULTEVal3ptZ0AnVMVkghxzQVvAC9xj6VIvgRZ/+KzunELiuo4kAw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5533.namprd10.prod.outlook.com (2603:10b6:a03:3f7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Sun, 8 May 2022 18:53:35 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:53:35 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 04/16] net: mdio: mscc-miim: add ability to be used in a non-mmio configuration Date: Sun, 8 May 2022 11:53:01 -0700 Message-Id: <20220508185313.2222956-5-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 75cd4e50-4190-4921-a52e-08da31240e0b X-MS-TrafficTypeDiagnostic: SJ0PR10MB5533: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: rWHQI43jWJ7ErQ8JymDd45aBlMLGf6xwCwS4/HpvHw59+1iTVSxBrSfO9V1f82s3jO9VuSANr29OBQvOVZK3FpIEJMn7q2eQyBCKCnksSmKtK4Ha+293XSosFvev+PeOTTrrzeH6gA6dWCfAS9uJPJURkxg/i/oFHlvlD0ENnj1Owbj807vDadDJc2FJ46aPj/BrMOwUVnkyMxQhlPBYJmOFpZpYMduW0lVR/10VEEmzwUsim2SRMC0KY+1bE4G3H2xqheC5VdXBHEPNXj080Ts/4T8Wv9fwp2Qins0mD2KnM3P8TNmpc5VSRMfJzrmSZIH8hZD/zo3q4NxYmPDV/61mvYQwl1dS3Hkdxer+2WRfT+JJcWFhrf//if5r28OEivYmuu69jfnnkSr09E+hplUnhAFtnxbEZAaZkRKp9mShg6xsq0IBY0iXJAMX/0/NMpFNNPFmxftDiG6X1hDsYJji+oIXigqm8RqpQRLM3b4/Y6xtoruVRgEZUu78KxPD80lfHL5WzxvWbCQWnFdpcNfbe4o7RU1sfYCL0gwlEsaaUgj6g5XpWbCTaB+tGQzbxowq6WXF+zPNF7KYts4GO/QV7rjLzEpFNy14URophMEn0vx7otwV+rNvPDu11Js2+KS1K+YF4CVcExATEpWzzztDEoV81CWqTCa9nd1c9Cl9Ev4lEIIvWAUzXNFUxfqr0NSKdQwgXw2XniQpHtf3Sg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39840400004)(136003)(376002)(366004)(396003)(346002)(316002)(66946007)(6666004)(26005)(66556008)(508600001)(44832011)(6512007)(6486002)(66476007)(52116002)(186003)(86362001)(2906002)(4326008)(54906003)(8676002)(38100700002)(2616005)(38350700002)(6506007)(83380400001)(8936002)(7416002)(1076003)(36756003)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Yo4JxViMSgo5EQQMFI6tymmdV8iRKxOXNjRMO6K5r6dskhEQLtAOT5ckuKxu6oOZ+A/qvzVVYLprU5HBiAGvqr+KsPv5E2zlIrIp3cbQOCU87FFWnnQQr4PFP2QsaO/dLHAzdGtPOii1/dhc4/Lq1qaNyzoFraLVF5eaJpn+ODzl7xq43y3W0eDrhudHvsRupMz+UKOFnbDnpy19FRyRkZhJOpe6ejAw+p2DKDqfKX+fv89+fsq9pNH0tALx+aLTBxp5C1KIGxft1hLhGVHUFc8OBMpq62ydSpErBhlDCTcU96t7VGAoB3LzUk8rEp3Qp+f9/AbhC4XacprmFLoLjPsqcOBGiUIdCCc6qmXqs9N0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8bJlZsNOcbb9eNmnIJ0U0q+EcoxVfzC81GhOG0bDUb4leBhMt9H/PnHh6o0oA7hPEFtVoyCjIdVur+XE6zTq/JWkP9eKCYUIDxiIv9mck/HrqDO+Ll3iA1HKff6qutNH5lflLgP9tP+C7h3xyxRj8/90ruayOF2qzotbKDgo8OksDOYXczLqa7Mw+smfQr4jzOP6Bwl+Kh5+z9feMrfPbUG6j9D7nktcX51XP95hCFAKEvJ90Ut126VXu0IWc64aAw5HaNwUXn3GBLWn+lTeVlt6gGBYplnonf926zHrN85WhRFQZMIb7+6uxkEwekcTtcv1KPI5KjI+Z6ws+LaDJeBf1Y3mT X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75cd4e50-4190-4921-a52e-08da31240e0b X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:53:35.3074 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9P5RyhQC6ACxXwG6SDpFH48fJc+clrYkopjITy1arYx8i95lPeDU+ojEVu/0rPVwBDac2LushWu4uAVz9R71einb2YvGk+THtmvd5cHR1AA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5533 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC There are a few Ocelot chips that contain the logic for this bus, but are controlled externally. Specifically the VSC7511, 7512, 7513, and 7514. In the externally controlled configurations these registers are not memory-mapped. Add support for these non-memory-mapped configurations. Signed-off-by: Colin Foster --- drivers/net/mdio/mdio-mscc-miim.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c index 08541007b18a..728883f95edf 100644 --- a/drivers/net/mdio/mdio-mscc-miim.c +++ b/drivers/net/mdio/mdio-mscc-miim.c @@ -18,6 +18,7 @@ #include #include #include +#include #define MSCC_MIIM_REG_STATUS 0x0 #define MSCC_MIIM_STATUS_STAT_PENDING BIT(2) @@ -281,11 +282,20 @@ static int mscc_miim_probe(struct platform_device *pdev) regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(regs)) { - dev_err(dev, "Unable to map MIIM registers\n"); - return PTR_ERR(regs); - } + /* Fall back to using IORESOURCE_REG, which is possible in an + * MFD configuration + */ + res = platform_get_resource(pdev, IORESOURCE_REG, 0); + if (!res) { + dev_err(dev, "Unable to get MIIM resource\n"); + return -ENODEV; + } - mii_regmap = devm_regmap_init_mmio(dev, regs, &mscc_miim_regmap_config); + mii_regmap = ocelot_init_regmap_from_resource(dev, res); + } else { + mii_regmap = devm_regmap_init_mmio(dev, regs, + &mscc_miim_regmap_config); + } if (IS_ERR(mii_regmap)) { dev_err(dev, "Unable to create MIIM regmap\n"); @@ -303,10 +313,15 @@ static int mscc_miim_probe(struct platform_device *pdev) phy_regmap = devm_regmap_init_mmio(dev, phy_regs, &mscc_miim_phy_regmap_config); - if (IS_ERR(phy_regmap)) { - dev_err(dev, "Unable to create phy register regmap\n"); - return PTR_ERR(phy_regmap); - } + } else { + res = platform_get_resource(pdev, IORESOURCE_REG, 1); + if (res) + phy_regmap = ocelot_init_regmap_from_resource(dev, res); + } + + if (IS_ERR(phy_regmap)) { + dev_err(dev, "Unable to create phy register regmap\n"); + return PTR_ERR(phy_regmap); } ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0); From patchwork Sun May 8 18:53:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842518 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0809DC4167B for ; Sun, 8 May 2022 19:02:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231796AbiEHTGI (ORCPT ); Sun, 8 May 2022 15:06:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382483AbiEHS5a (ORCPT ); Sun, 8 May 2022 14:57:30 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2101.outbound.protection.outlook.com [40.107.223.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06C09A1B1; Sun, 8 May 2022 11:53:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jDO6auMHmZC5hWKHVnrgWvXg2NOcnV2hFSXeDJG5DujNRx+PMspGye/hsymfltjraREkzgm1f+YOuYHIfc7iI0xlJKJMis4GWo6Fr7SM+HZ3XSF364p0gKtmKHDiCikNGciZjNl492a7ezOCqJl+/4dM3OrF4+SvEj8x1K7LT9zYu0sg9VKjo8a5bR+j2Hedoqis/RZGmYn1qFq3YYosvp7lTpIKBjmk/l3Vz6i77XcYfS1pecOylbnLOfJOjDDJ3/cWlLZM+FlerAL74M+GByawkwIvmf5xiSZMBZ7CLVB6Goz0Cn4z44s2XFJV0Wk1TQaoF4kRrR1hGjrlYuKdFA== 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=/FmacZDFUQIVji0E8MajyeMKm4ENAYkDUSpt5UbVjAQ=; b=cOGL3axXO/NulGAXUcX1OEsYGprzdKoE4FpxGkw5IWGV3Sy1vLTzwSn2ZDQGS8Kcde02WzN/pPLgNYV03n1qsyC6SsPHnKFREAGgtpkAAyS+5lw1ZqpmQQ1WjGATzwPUqPRKykR4yroCV78qA4nU6OvjMuO8vU92eRba4s+XAy/xLXdwjhM7m0MipgxLow3m2QywwpgoBppadESjTWfBnxhucGsolveL/3Jj4DGtZwP54Icz3R23yEFULZqtw2hn+gUhZhFu1wQhgaNhxZ9LNS1MzCo0elWIfiIFmxJbBxY5OhYZ3XOR42cRF1DYjiBm89aOltlDpFJCbyIwnB2B2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/FmacZDFUQIVji0E8MajyeMKm4ENAYkDUSpt5UbVjAQ=; b=RDu/MznGgbMsbtm1vC1Svd+fTBmlTHzks+HJ/Ky5RXmkHtvy3XfBOSN+9/sySBAAr+cekkLLoAxkhkoSFaws2b2efdF0NGaZNuGitOVyYNZQPyfRGeCPOfb7cLWLpoU1SiNLsznYTrG9sZ2keuOaWthWbduPrANS1hJrjqWDODE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5533.namprd10.prod.outlook.com (2603:10b6:a03:3f7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Sun, 8 May 2022 18:53:38 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:53:38 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 05/16] pinctrl: ocelot: add ability to be used in a non-mmio configuration Date: Sun, 8 May 2022 11:53:02 -0700 Message-Id: <20220508185313.2222956-6-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7c869601-28dd-4be5-8b61-08da31240f9e X-MS-TrafficTypeDiagnostic: SJ0PR10MB5533: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: QHsWOUZt8In5ERMyAr8PxZ/8ERRcZ9CdXHk3sXRnettrtvK7wZp/sLHiVgxylro2FjcdYX2wEcjo3fmFzK5AKq7l3V0Lx+eg4RUvFOtNxuViUNthSzcNBiTMvnEjHcnlEOmdX1aOsxIN+xm0MPNqby9wQHGJDJDmgZmeqS75yFMXx2a3FQUIpw1a8Rv4bKUHtS0FX6jjgu1B7waIu5A1vLdoA+CHotQWcWi2hNUidDJwiPjXZNvcUFvi6q9KYhF6E+LyiaTN8vl+0k6sEASR3Akb/YP/ku+4ohh97Qi+FlBycqQAAykwBwu3mS4Nkz72k5e5HQE+oboU0iwjHOCmcRDuq+bYTUOjfoUsOYaByw4X4IDAWNejcn5mZFq8/+z2uyEiuOmAIMJoHX3FGyjhOcitJIgOfm4rbgWoSkDAjY5MDqg42vODeSIg6LxEQqCGx9AHoP+4nDsZeqIAaCS/7moOvkNxf+ZHu+tqizRcwopbkgKPsd95pKSeg45Vx4c7EOFRxoMoFIoxULaRtyYjjwEFGjGtCzO6Cmzj40PoYvQfnYYd6xWUt5jl3nhTFvJ2IKXRgm2nCUUf45tU4qdYaRgIerdY8ptGcMLrseyO5zaBOMOEPjRims1rz7FYM8aWwSBolhosriYlhWb9e8XfRWem0s1gcTuSAPDQDm7QCtzLB5h/Z8cQNvGSbCMSBJ+/olqbyJ9uXTEsT9LKCdgPVw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39840400004)(136003)(376002)(366004)(396003)(346002)(316002)(66946007)(6666004)(26005)(66556008)(508600001)(44832011)(6512007)(6486002)(66476007)(52116002)(186003)(86362001)(2906002)(4326008)(54906003)(8676002)(38100700002)(2616005)(38350700002)(6506007)(83380400001)(8936002)(7416002)(1076003)(36756003)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qu7S5vKj7kmxYol5/y8Ct5idX2fmmHQ4EMYMhxnJRr99hFpe1IMnUA0bH6DqKqMjcT6cNvLgLqqO/tz+AU4flqL+SQCRc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LG42Ffj56mpg/ZKMTt9qIGF34wCEjgfvn8ddemZg6ZyKdcf/l0uwirXvErIwyIhmKtEIwjftvFMjnCi0C0NT+kvd7pOotpZqj3wg7FSL5p0AeAD+xK4SW0tSnrrD/RaBVjHwvbep1rIzL6Ku5JlDugCtdSZ0PWDv32V81HX8k9W3NEsJOqQ1t7JbOgMHTTPYjhVXxvBdIYVY6/7QQfCfBkpILaAkk7FdTTSiRG1dD8lZYcewQbbKGdxW4+aRYKGc49rd+23tCLxAvYmdZwCA3koqFp0aGB6zDFbLK4RryNb0F1fLjGMVj0cNb5QNGOHD5dTMj15GCoWxuYyCsiRpEz+rOqWCT2XH/xPlEEL6cBVItCuUbBdDEixU06PQe0vgbrms2FIIgzkS+Oi9F6ZFx0IQRmgrR+vtaFR5beguBaf8y1QzaHn1VWdttYkSE+OZEny4sf+0ATwbH5P4R5eIazximMZjaA2xWgD8TWMYqLJb0KFOS3XMM12QbeyHSGamnOx2B4iTXoP58HjCa8Jp8dOIYSh+/5WJmtUscBXwDhiYEs8ScdLVt+bOAZk17bh2VsoLbfdAZIWPZ/Fvt24lBqsIOmIjKchb62oRMZYt3pR84hWUrf2ku2ll X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c869601-28dd-4be5-8b61-08da31240f9e X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:53:37.9166 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jJiJAvtQfAji+qfDePq94hLMSKHBPfl0an3Lq1lAoHIvoIW9edIEj60e6s2E5Oy61QTFCetCsXYa9cN4y54425usd2H1D5Rs9RqduKZ49w8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5533 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC There are a few Ocelot chips that contain pinctrl logic, but can be controlled externally. Specifically the VSC7511, 7512, 7513 and 7514. In the externally controlled configurations these registers are not memory-mapped. Add support for these non-memory-mapped configurations. Signed-off-by: Colin Foster --- drivers/pinctrl/pinctrl-ocelot.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index 30577fedb7fc..4995c90019c5 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "core.h" #include "pinconf.h" @@ -1215,6 +1216,9 @@ static int lan966x_pinmux_set_mux(struct pinctrl_dev *pctldev, return 0; } +#if defined(REG) +#undef REG +#endif #define REG(r, info, p) ((r) * (info)->stride + (4 * ((p) / 32))) static int ocelot_gpio_set_direction(struct pinctrl_dev *pctldev, @@ -1908,6 +1912,7 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct ocelot_pinctrl *info; struct regmap *pincfg; + struct resource *res; void __iomem *base; int ret; struct regmap_config regmap_config = { @@ -1922,16 +1927,28 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev) info->desc = (struct pinctrl_desc *)device_get_match_data(dev); - base = devm_ioremap_resource(dev, - platform_get_resource(pdev, IORESOURCE_MEM, 0)); - if (IS_ERR(base)) - return PTR_ERR(base); + base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); + if (IS_ERR(base)) { + /* + * Fall back to using IORESOURCE_REG, which is possible in an + * MFD configuration + */ + res = platform_get_resource(pdev, IORESOURCE_REG, 0); + if (!res) { + dev_err(dev, "Failed to get resource\n"); + return -ENODEV; + } - info->stride = 1 + (info->desc->npins - 1) / 32; + info->map = ocelot_init_regmap_from_resource(dev, res); + } else { + regmap_config.max_register = + OCELOT_GPIO_SD_MAP * info->stride + 15 * 4; - regmap_config.max_register = OCELOT_GPIO_SD_MAP * info->stride + 15 * 4; + info->map = devm_regmap_init_mmio(dev, base, ®map_config); + } + + info->stride = 1 + (info->desc->npins - 1) / 32; - info->map = devm_regmap_init_mmio(dev, base, ®map_config); if (IS_ERR(info->map)) { dev_err(dev, "Failed to create regmap\n"); return PTR_ERR(info->map); From patchwork Sun May 8 18:53:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842527 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 139BCC433EF for ; Sun, 8 May 2022 19:04:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233277AbiEHTGo (ORCPT ); Sun, 8 May 2022 15:06:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382489AbiEHS5f (ORCPT ); Sun, 8 May 2022 14:57:35 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2110.outbound.protection.outlook.com [40.107.223.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A6A3A1B1; Sun, 8 May 2022 11:53:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=epFBlAWC0q3uYzWWb8a66+4Ymot1xqQy5CGF/Psu/ESykmr09yBWO59VgVy8NazaQZZcjpnsMIsbepGmBECHPY1pzDmf2wSru86scHpkUkRNGLlDcMgmvwQn/ZuR2PHcTsfAHakiwD57/TrOWL2QIGxT72sE4fsNNwr5DslhArJUzmHYgnBNcKXeaqmXbppv+O4Ntq/bIOpErputlweZ/amyTu6HtMtDYXlyef/Zj3cuaFWtG6btDq1ZmOhU1Rh93tjt/sWMlzXTRoKZsjYefdV2ziaG8M/BJwEAreyoG9nGjrzVSpz8V3ZTifoxdAnDIFV7jcd2SaCEvpjosnST2g== 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=Gr3RrEyb/DUf/WdSeJx7VBv1lpuyEPZzjfYuaGTuTz4=; b=HfQ0BHm8Sr//68qVPzrOO0jvb+dF0aI/P3mJJ4T1deBK3JnglXFvZnLS6Ahg+cFeZC5i2ltK0SMnMexdY9xIY/2wIdfDeQEb1AkyYJXu6e4e8blOD3BR/WvHFFYUxAjf3up6zR1e0nGg2eZG7LEPCTA6Dkr6C5kOcBfrxHYmcdoSIKv5Miq3JDUeT+2APwR7Ewrm728+NNTvwwNVMIB9FfCvOicWCshrk5rfn91F83V6NZ1hxS1C6/jgOWjz1pw1ZoIQI61XaEFFJZwbpF6/V5yZnWEAkTTt1dVQ0TtLoDhaHTDMPK0TpCv1kCAhvfr1qGOD7ltBl0x8J7SRGKI+pQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Gr3RrEyb/DUf/WdSeJx7VBv1lpuyEPZzjfYuaGTuTz4=; b=nExIePods8S6XRxxPkKIvAD2ZTrQCvaUjCGYQeSVb+7/G7M9xcnrP8Pd6upqmfZhjy9s3SxELMcp/5HHxsApPaD7jtMnzY6G3LgkErV6VD+0homoJBzed3z7x3uqy4JIz3JndbeywOG88Jzn6dX/ucgaXE8iHZHRDuC/340FOt0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5533.namprd10.prod.outlook.com (2603:10b6:a03:3f7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Sun, 8 May 2022 18:53:40 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:53:40 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 06/16] pinctrl: microchip-sgpio: add ability to be used in a non-mmio configuration Date: Sun, 8 May 2022 11:53:03 -0700 Message-Id: <20220508185313.2222956-7-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bd86c6ff-6fbe-43e3-719c-08da31241131 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5533: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: uGHGFKiKcF7m5e5Gp+Y8FIsVv4iVu6JBYZv2XgNaRbIR/wg5MmDrZEcIeZfqmr+cxMtgWxxrvk9Yn9IF5vHqtEC/m90DZlc14ye36o3Z29SuY+VCzm5xcHo+OhOiM6Mm8AavI845Bhfuo0jcsHF3QJcqlOfSwBXF3VIYanCxCrNwSUD1U3n80VhUdUfB+nnsX2cJRuDokSIWxSezDCmc0Rm+qGHe9maPT49SOSl4niJo4CCQkouQyaVg1c/2ov8b/i8JNTp45VkVIRd4lExYxt4Fc5U72gnGWkG3AU0l7kvIEimUn9FLuvJskcZ1fMTvqkgn2dI2BeTl3EO70CyJfiqhL8T0t1dPHbgm/crXGNB6WWzpvS/kNF7QIHKnoZBU/53i8hIy2Q17UgKuQ+7AGeoU7z1TVyaCM/Bse1HOt3aZuUtoquTkG/DoFrFaQ/MC3ehNt6jnt9u4IvUyWPUjODj8GEMk3x9wiZLZnsDA6Q7upbt2oANsEKVwyrmWOyt8TUIBBuCTogaKG/uXnUJulM0V5CA1Eml+0rUZHb3BquFUHHX2umPk46Wg9vYdxKe9SRdRm+sNYbYXDiK6REgXPZVOmN1TjffpvmFvgawRiTyUons0JHONMbJPHk+LEFTiwG66hvic/mCTKy1qpFWDS7/4/cLCAhGkZENjMNmj6PQateFhwafZlykdvkgOCKZWuzcfBmatFBzEGEYa/J+0Ug== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39840400004)(136003)(376002)(366004)(396003)(346002)(316002)(66946007)(6666004)(26005)(66556008)(508600001)(44832011)(6512007)(6486002)(66476007)(52116002)(186003)(86362001)(2906002)(4326008)(54906003)(8676002)(38100700002)(2616005)(38350700002)(6506007)(83380400001)(8936002)(7416002)(1076003)(36756003)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zNCtRUddtzAw5l+w0NmOiHE/kkXIxbU4TXpRtbceV2z+Ca76Q+bMIVzOvdxaHdHy2gB1guhq2oyEbDEa32zZgud6GWFLrvz6EcoLevmop77xRNXJjTM7NUJO8jp3n6Cd5aFKOHiQUS/UQAKNfYL6Ak8jUPEVevt71bOy+/i0QtmfSgIP2W2lAbvu5+XR3DR9m56lnft9Eh+FZXjEyTo9T5v/7kc/fNPHGVkckTjx5uethdWI2ee9d0go+TN0fVob9Ud9zbgZO7SWItGBZfkzb/12wjzCTobe7pYeQaGm4vPkUPWicW2Bo7KTZl84DKLMExeF1N2dHrL3VZKZrCGaqXU/1N3K4bz6YgzpBy8aEIo3tz/z2UL6scedZPrv9yQ+UaBSl17+Za/ZXNk7qL3Mr/llKOQCxArsyYaQrHA615ukV5Sy1/U3Baql9Tx/8i6ZfSAScJ7Bmz6o9xdfMpx6/UucNIP/AyiGeDoHxYNAYcmyVqOYGHZgOmNiGZbSD3nyAQRgpCvDs99qK+ZcAzTcfIv3vNPRt7pYngkWpw/Jq1gPj+baxLTEYOJxFDN2Zm56fWlR7FlLBi7C8xOPbbNhRLDMcFucPxv+WefWX2oNfFCrCNqfgI6bU+0wQkVPQ6IxR03tMW7mwtP/wNdNxz6ydaCYLUZGhPPU7ZIkx5nZrnywkp2zvMUxLFYP/L2UsGOWBIXWAEt3ZKApppPWcqbSf1MIfd/Xht7iP/UoIIf3II/AiqdAeeoo8Fc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ossTenant-Network-Message-Id: bd86c6ff-6fbe-43e3-719c-08da31241131 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:53:40.5570 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uiDZHoHF+CQsxnSU073MauWii8uWFuDBV/BP5mGUF9oc1SRfj2iP8r2ShoD3orI5MLmUXOBxfnUI/K5ZeHL67jRK1tdcCewFd8mVWL3RSC0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5533 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC There are a few Ocelot chips that can contain SGPIO logic, but can be controlled externally. Specifically the VSC7511, 7512, 7513, and 7514. In the externally controlled configurations these registers are not memory-mapped. Add support for these non-memory-mapped configurations. Signed-off-by: Colin Foster --- drivers/pinctrl/pinctrl-microchip-sgpio.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index 8953175c7e3e..88ab961cc5b9 100644 --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "core.h" #include "pinconf.h" @@ -899,6 +900,7 @@ static int microchip_sgpio_probe(struct platform_device *pdev) struct fwnode_handle *fwnode; struct reset_control *reset; struct sgpio_priv *priv; + struct resource *res; struct clk *clk; u32 __iomem *regs; u32 val; @@ -933,11 +935,23 @@ static int microchip_sgpio_probe(struct platform_device *pdev) return -EINVAL; } - regs = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(regs)) - return PTR_ERR(regs); + regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); + if (IS_ERR(regs)) { + /* + * Fall back to using IORESOURCE_REG, which is possible in an + * MFD configuration + */ + res = platform_get_resource(pdev, IORESOURCE_REG, 0); + if (!res) { + dev_err(dev, "Failed to get resource\n"); + return -ENODEV; + } + + priv->regs = ocelot_init_regmap_from_resource(dev, res); + } else { + priv->regs = devm_regmap_init_mmio(dev, regs, ®map_config); + } - priv->regs = devm_regmap_init_mmio(dev, regs, ®map_config); if (IS_ERR(priv->regs)) return PTR_ERR(priv->regs); From patchwork Sun May 8 18:53:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842517 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAF71C43217 for ; Sun, 8 May 2022 19:02:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238888AbiEHTGH (ORCPT ); Sun, 8 May 2022 15:06:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243933AbiEHS5f (ORCPT ); Sun, 8 May 2022 14:57:35 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2110.outbound.protection.outlook.com [40.107.223.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CBF3BC08; Sun, 8 May 2022 11:53:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DxNGBrE+MaeY+lPamUzvIZx04qVyUD3q/8UmOsxIxDkJJM5JQZS+DDKeLfB3m08/xk3Hg/tkNKIs78Gt9dyG4MTS7TQXbhtB0GIgEgqiJaDYSp71V/+/mow8nj67+DZkP7G/GPBW+y4iv9ezwVTenkGYVFH+Y3oT4X2eA1w8cQwPVzewffG162t/WYDO9ELHF1OznHj7NEH2IKbnKNxST9AkpM3HqqIiM872l0L6ZGjgfoaDkTbybWnNOMN4w/uZnpXwldf6/camcdbN9whnwHBJqKOXmK9DXD75P8TqSn0neIEj/iiau/rG6NlaSBXs0hK5Hh6OO/b+HvVuOpg0Tw== 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=dpcqD3YrPb8E3bZrxcGsy544jFxVoAUX4RKcmXtCjec=; b=Wea5LnyDfwEl7BiIUtSW/SAwXLkWTuiX9eBK/w2iPddUEu2yVp9Dyr1LtRo1ZbtvWQq68mZUxIJDeKuSlNJYNjBcMhIkuV3pabAK9UnFOlgLn2n2aWtccSdRNkR6l+uhSkvlNYATHBd/+Qs0es4xQxykEFdhTfqLab3bRlt/kbvhmzulPf2ou+lfR9/gEFics8mVsTpEUZnSt27T51rdggrVSVWxHwpyGrzCxBmK+ypoVs8FRckush3RFCwFLSMkGSiLjcX54L8LBIKQuJSPEFXBrt6ppH0eaq1aSONkOw1xjJ1/qSCmGnwq3DxmvefY3W5lnfOPTh23Ub+RRNoXEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dpcqD3YrPb8E3bZrxcGsy544jFxVoAUX4RKcmXtCjec=; b=sTHVyeYJB8I2g7WB/56JbT55tjvU7YnHtEgJo1VrHgAvS+8eqmUyk05JRbnDQ+K0EGvVg1RrBKoE3RD8qQ32HCchA82Ib0nVtaW8R8Q7V1KSMXQ1Yrwmk6mhpbBpgn8GTCqVMBbdbxX4JZeMfjsGpW7QNaq36z8P34S29aL/kKc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5533.namprd10.prod.outlook.com (2603:10b6:a03:3f7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Sun, 8 May 2022 18:53:43 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:53:43 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 07/16] resource: add define macro for register address resources Date: Sun, 8 May 2022 11:53:04 -0700 Message-Id: <20220508185313.2222956-8-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6dbb1fa3-8aa5-46ff-57cf-08da312412c4 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5533: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: 3H/Ntezqy4Bk0ebxYcJNvu3o9fvP7xoAKfc2stWksl4VYjWW6TcVfyGEjRvxyg1UPUMdCWbr5VV4n/Wex60tB4xMjjqu0Lro25J6E/PZdoQq7LFrKYWel4jMF/e9pYn3M6BO93ZdmHiu15TAfQ9mAHhdLNA0W4/7IHbq1rsXa0SWI22crOyT5Of5NYpvK+MNW6GOZDJlIUQ5N9+0rFmKsWWEgOxeOaVghKfP3T/Mru/OBPs0mH/ERGxAnu+uIFUvdfeAV8H1w2YPOFfbbhpMTDS13fzBvAPgjaq6R7gvPjVCf8f9kTTfSv2ZkvxQcHEeIx/af2KcmXJY6wnRJ4tCsTnlUgJwBGiFsjiMYg9TPB26J131/YL7mUMms75jFLA6qAZG5++uzzhqb5vd4QWGVxZfKakxEEnEnGQ4WIq//WbYjUCWwMjiZ7mnPMb7Mq6hVkbXJaRUuqqRDixBAitjFvSOdTCTniqLwEZWNt4bTlDrJ06t3XxFCfI3RorG9nNkz2QY1O/ZanG5C7wSz0b/HWvrCJSGhHxd6H4JutgUMqfjnX/a6WMYw9a9/IjB4mKtRZfho+gWkSkhRX3kY4r7dGMnpAy/EiV+M0HKTjisphkpiJyf7mFWsYzG3ndnr7lkzL1qVo8ooIF3UEREAK/xPG7D/x54h6kubhrLref+6oocd5FvACYOgSVn3kAm8VquJxZiI2utC/6AxJrVoKjYuQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39840400004)(136003)(376002)(366004)(396003)(346002)(316002)(66946007)(6666004)(4744005)(26005)(66556008)(508600001)(44832011)(6512007)(6486002)(66476007)(52116002)(186003)(86362001)(2906002)(4326008)(54906003)(8676002)(38100700002)(2616005)(38350700002)(6506007)(8936002)(7416002)(1076003)(36756003)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SKNidOQiSbKIg2237WiIdQSCmWPqka7VeVMCxqQS1Vta6U4vB6Gg6Co0PiYXalo83CDWSk08/9V/Myu3v+B/T+UaLWKETqlInhGv4bHf0LiWaIgRulrkdbMzE/GZatK7+4viCUu8srPk7u8nND7pu5XuR+qikGJlvaMPl2ocotlEWS94zE1z4tepYmX4hi/B3V5S+4RISksyy+r/JZ2tyZ2XKyUOnqoJBHOP6t8MAhtHKfiGQDa6Q2fCCIxzmWTBC2y3Ro4hyFA0vwnEjhtL+6mYzXOtZjz1SHvg2OfsGG7gxbVvo/A6A4R0vTEnhvoQ8FzoXzcVNivkK22yDqN7zMEob46iS4y/ekWi/DWMYzns9orIovJBjMyGfqyR9I+i1ZJDhswuUifDoXl8bF5shYMSbFv4HRI4NSkuiI/IJcESyfvM7DPmpbAO7FJsDhKcgaH6oNxbMbU/Z9VW1VJPy/J1mnj4T49CJU9OiJkmltR/VaS62DSkQW/O6956KwfTPrHTuWqq3xWE8j3wBi82qkiF270jf6eIfvTXLVfuiCiSvHuqlqn+GmBi/FLVgYSbY9s4RLP0B1aOrXabNBDajYkybROHWqs2W5wFp9KeZqF0x72BZ3nG96La/nhOlc4tEcL6eTa0yorbsYX3tHyDTJN6B0mXGuqWdZtvKMJUARKP/Fo1ymX/rA/CTK+UwAdeZBhEK1Ob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ange-CrossTenant-Network-Message-Id: 6dbb1fa3-8aa5-46ff-57cf-08da312412c4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:53:43.1974 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UWF62PmgXdw2E9x49HpuNmj/r6r59JEafMlMjhKHXUpusO/4m/Rl8hZSMETYQEJPT7sEaDq0njmECQ8mgp60Zz3lETNg9W8avKRJV3Dp5cI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5533 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC DEFINE_RES_ macros have been created for the commonly used resource types, but not IORESOURCE_REG. Add the macro so it can be used in a similar manner to all other resource types. Signed-off-by: Colin Foster --- include/linux/ioport.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/ioport.h b/include/linux/ioport.h index ec5f71f7135b..f3b0e238c020 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -171,6 +171,11 @@ enum { #define DEFINE_RES_MEM(_start, _size) \ DEFINE_RES_MEM_NAMED((_start), (_size), NULL) +#define DEFINE_RES_REG_NAMED(_start, _size, _name) \ + DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_REG) +#define DEFINE_RES_REG(_start, _size) \ + DEFINE_RES_MEM_NAMED((_start), (_size), NULL) + #define DEFINE_RES_IRQ_NAMED(_irq, _name) \ DEFINE_RES_NAMED((_irq), 1, (_name), IORESOURCE_IRQ) #define DEFINE_RES_IRQ(_irq) \ From patchwork Sun May 8 18:53:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842528 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFF5CC433FE for ; Sun, 8 May 2022 19:04:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232068AbiEHTGk (ORCPT ); Sun, 8 May 2022 15:06:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347839AbiEHS5j (ORCPT ); Sun, 8 May 2022 14:57:39 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2134.outbound.protection.outlook.com [40.107.223.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92EB2A1B1; Sun, 8 May 2022 11:53:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fDU7rGEoTHszG5l5R+5NItEBkI3pUsq4N96yMr4KQGCGuLZR/+7ikx9tGCjxeb/7VPFWIx1cHRh4eiek7yR/7MHF8T8VquFGrdVO7m+sCWGO3ZnyZiLyM4Zp0ZEskzAghuVFQk7jWIKrpl6K1nrdhxlxQ/lhbEQeczBm1hDXO8KY3+9rhDD4n/AuHNRdMUizXhw5OX03NmPz90rvX2lP31bFVhaBW2AIizgc17tdrR/ZB8D4xiqj24whQVMEvhFxBI/HlNwvJLtSSK1e8nAny5eSnMivmc4SmZIhIv+kaZC6Klbq60+Jc/hEdfGKptUI9Bg7W8OJgr95+HVUcpdwUw== 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=n/1/wtc2gbnSEslFA+vW4p017aD5PD/WLOblDeiguoc=; b=TikdZGvjqX9KeO/YD3qSNQWxXj9lDgpuFKoRtJR+0qRM2K7yKscPVcsFAflZnafBVfOtmbs8+UJuw4T9TV5svp3EmEOK8Dl5p48h5fdIp+9RHUqMwtEVOsZvSRkMBREAIldFlRb0RGp91xsGBR3yFzJk0duBPZTUmJ87140QThAPgv6VItDXNrz3D8Q1xYnsGM1JueYz3Rq2PPo82WMkU8TmT4w4c3LhOBC+99vA9YGlFDPGuFfxVSeMAV/C1tOFGHRsxNld8RLGg1VWIkJd3OzbHKiSD5X8YBdhLBlUvHwa6lunH+gZvxJgn9dnFj+mUY+omj1CSMKE0mDvpX8pjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n/1/wtc2gbnSEslFA+vW4p017aD5PD/WLOblDeiguoc=; b=EvbtkyUYWqgvUvWvz9yZs/N1q7lsfHnmOlGsIr4gvB0ZvzVDvpzz1Csp6RDCLJhK+mLBSPteicZh/YHvPiaN8DoQb1JfA5mXKVAtsIqFpM4d/Hqk/tj3ERATGdMSG34TRRmeK+3H3KrtbY1vNxAzAET4MvxJcxdFVTfxosAAd0I= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5533.namprd10.prod.outlook.com (2603:10b6:a03:3f7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Sun, 8 May 2022 18:53:46 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:53:45 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 08/16] mfd: ocelot: add support for the vsc7512 chip via spi Date: Sun, 8 May 2022 11:53:05 -0700 Message-Id: <20220508185313.2222956-9-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 722a6198-9bdc-4c4e-796e-08da31241452 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5533: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: ISDGbZjos40osL6Fw7l6CWcIM6ongc5sSc15UWvCkdClPNaHMd4c7TKFa5HfqVyoKiEOe2vtmQyKcL8ow+HFZWHtLHG1HO5bSflqdmt7mccQQyr/c8go1g7/9tmgOo06GOwDJxJG2ggTEPtM9qjAAiZwvkExgvPUMCSJQOnpbcLMr+o0gQM36FCI5exLzhZoBK4e5o9GwpGJH67li5mKewXQoVHqvzqAid5IU++Wa4nzAa/6Q+B5ssnDs16MNCEa+jJ65RZwA60onZNSQKNQESWc31wVg14Iu4ZUQimHX9faLnL4GtA9bjZ9bslt2BMgdD4b4tsae7FfCL7SUQ0v8a7PYAUCEpOsdGtDQ+1Uyxrrjh/ZQLhzKZAr1DfMPZuG4G5iOylEX2w+CqDWydsAsklT0uJOUoQqie75A5fJ+zXMqRZeGVSjWUVvd1eu6AO/UZRcM8vGM7t0upr/5sIT1FOQ2TZoXKTkyz0ZCMXLOtkeg9APBTrCtqBWpN08U2a4w8sQ+qP2bHvfGKkk538NtN80dflLUGiFfnelC5R4ZaOz57ciOz/5qaaR7L+RZGqNtmOZ+v9YvmP+JaJEvpaq4FIZc6eA3W8w6Hqk+bwatCf8DMblGV+HqqhH97dFE4Ee4Ecq3m6PPym7XbA3aJivQBo+kfEyVBkC7u/+419W24E7WSJZOQTuPa5KOoAisYPzWT3e4z3JNE5zwyMV0ho79w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39840400004)(136003)(376002)(366004)(396003)(346002)(316002)(66946007)(6666004)(30864003)(26005)(66556008)(508600001)(44832011)(6512007)(6486002)(66476007)(52116002)(186003)(86362001)(2906002)(4326008)(54906003)(8676002)(38100700002)(2616005)(38350700002)(6506007)(83380400001)(8936002)(7416002)(1076003)(36756003)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Xh7qjJjAsoPzK75XBt0YWGFX2S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33NhhejyxLpS+IEobzBKPWQh4PvtFFDuWVBZLsqjqLk5SIrhmJvkCCihHnzVkTra224JVt9ObAbD9NE62J9VKzU1UZtlNFzKZFfLjxPeUBCieyIQOJiSty2XsBob0VaB0/ODeOoXE6Qxj8ktB+XEUDJ0Fe+oNP/zcaoZcLmm0J89T0dfAmHw/gD7WGkaXDu1dgWc1/3E2fS7vkzwyG/G9qAciUljtHU/e7Z6X9MtuceqgUz2Z9W/bnmY+7OvQoXgWBwTq2Nzxuw6neRVDwzOs1n8dNKjwd3QcM2F8Px5i1yK3sTOOS+hOPh/lbMmpMGMb5Oo2GvBLzrdZyYVJl/pss6u5b5oqk51bK7UJvsHgUWB4O2mwEELXyz/J3wiq5Ep9FPzDmhYnfkh5gTs7JRW6uA9n83ifdhWCY4lyt/Dj6NeQqeqArKGfO7X+SQXaXLf/145jUr63wPC8yCYFb1sDJjuxz6R3McaCzV4Tu/7S1pzAozEu5Qc2hPBB1FnxlwnPEre7mfC51MWPU8QOay2xQ0Ki+oMJy1Y+Ng/FAOluQ+3uztcLvsjHEcGwY4x6rbkiwon4vXHcmlpc+b2R3t3ZMaOGITipT33fjFC72gck4+FCMHqO/xk01snnLth0n0NBYrJbrISAKgBzukxWsnwHfqiPkLTQ4oNDsOJr0KwsDCTswzgt6OSh776EAUd9Vmvocn3l82eu X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 722a6198-9bdc-4c4e-796e-08da31241452 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:53:45.8379 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: t7rKWrHGoRFhf/kvYVw64fKglbHZVc1wSwGT5KyB2dhYVInRn5UFoUIB9ZT40QAL/4JBOii/VyFhtO7NIO4+yQ0gQErxUrr+G7TNuhEDK/Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5533 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC The VSC7512 is a networking chip that contains several peripherals. Many of these peripherals are currently supported by the VSC7513 and VSC7514 chips, but those run on an internal CPU. The VSC7512 lacks this CPU, and must be controlled externally. Utilize the existing drivers by referencing the chip as an MFD. Add support for the two MDIO buses, the internal phys, pinctrl, and serial GPIO. Signed-off-by: Colin Foster --- drivers/mfd/Kconfig | 18 +++ drivers/mfd/Makefile | 2 + drivers/mfd/ocelot-core.c | 135 +++++++++++++++++ drivers/mfd/ocelot-spi.c | 311 ++++++++++++++++++++++++++++++++++++++ drivers/mfd/ocelot.h | 34 +++++ include/soc/mscc/ocelot.h | 5 + 6 files changed, 505 insertions(+) create mode 100644 drivers/mfd/ocelot-core.c create mode 100644 drivers/mfd/ocelot-spi.c create mode 100644 drivers/mfd/ocelot.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 3b59456f5545..ff177173ca11 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -962,6 +962,24 @@ config MFD_MENF21BMC This driver can also be built as a module. If so the module will be called menf21bmc. +config MFD_OCELOT + tristate "Microsemi Ocelot External Control Support" + depends on SPI_MASTER + select MFD_CORE + select REGMAP_SPI + help + Ocelot is a family of networking chips that support multiple ethernet + and fibre interfaces. In addition to networking, they contain several + other functions, including pictrl, MDIO, and communication with + external chips. While some chips have an internal processor capable of + running an OS, others don't. All chips can be controlled externally + through different interfaces, including SPI, I2C, and PCIe. + + Say yes here to add support for Ocelot chips (VSC7511, VSC7512, + VSC7513, VSC7514) controlled externally. + + If unsure, say N + config EZX_PCAP bool "Motorola EZXPCAP Support" depends on SPI_MASTER diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 858cacf659d6..bc517632ba5f 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -120,6 +120,8 @@ obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o obj-$(CONFIG_MFD_CORE) += mfd-core.o +obj-$(CONFIG_MFD_OCELOT) += ocelot-core.o ocelot-spi.o + obj-$(CONFIG_EZX_PCAP) += ezx-pcap.o obj-$(CONFIG_MFD_CPCAP) += motorola-cpcap.o diff --git a/drivers/mfd/ocelot-core.c b/drivers/mfd/ocelot-core.c new file mode 100644 index 000000000000..117028f7d845 --- /dev/null +++ b/drivers/mfd/ocelot-core.c @@ -0,0 +1,135 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Core driver for the Ocelot chip family. + * + * The VSC7511, 7512, 7513, and 7514 can be controlled internally via an + * on-chip MIPS processor, or externally via SPI, I2C, PCIe. This core driver is + * intended to be the bus-agnostic glue between, for example, the SPI bus and + * the child devices. + * + * Copyright 2021, 2022 Innovative Advantage Inc. + * + * Author: Colin Foster + */ + +#include +#include +#include +#include + +#include + +#include "ocelot.h" + +#define GCB_SOFT_RST 0x0008 + +#define SOFT_CHIP_RST 0x1 + +#define VSC7512_MIIM0_RES_START 0x7107009c +#define VSC7512_MIIM0_RES_SIZE 0x24 + +#define VSC7512_MIIM1_RES_START 0x710700c0 +#define VSC7512_MIIM1_RES_SIZE 0x24 + +#define VSC7512_PHY_RES_START 0x710700f0 +#define VSC7512_PHY_RES_SIZE 0x4 + +#define VSC7512_GPIO_RES_START 0x71070034 +#define VSC7512_GPIO_RES_SIZE 0x6c + +#define VSC7512_SIO_RES_START 0x710700f8 +#define VSC7512_SIO_RES_SIZE 0x100 + +int ocelot_chip_reset(struct device *dev) +{ + struct ocelot_ddata *ddata = dev_get_drvdata(dev); + int ret; + + /* + * Reset the entire chip here to put it into a completely known state. + * Other drivers may want to reset their own subsystems. The register + * self-clears, so one write is all that is needed + */ + ret = regmap_write(ddata->gcb_regmap, GCB_SOFT_RST, SOFT_CHIP_RST); + if (ret) + return ret; + + msleep(100); + + return ret; +} +EXPORT_SYMBOL(ocelot_chip_reset); + +struct regmap *ocelot_init_regmap_from_resource(struct device *child, + const struct resource *res) +{ + struct device *dev = child->parent; + + return ocelot_spi_devm_init_regmap(dev, child, res); +} +EXPORT_SYMBOL(ocelot_init_regmap_from_resource); + +static const struct resource vsc7512_miim0_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_MIIM0_RES_START, VSC7512_MIIM0_RES_SIZE, + "gcb_miim0"), + DEFINE_RES_REG_NAMED(VSC7512_PHY_RES_START, VSC7512_PHY_RES_SIZE, + "gcb_phy"), +}; + +static const struct resource vsc7512_miim1_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_MIIM1_RES_START, VSC7512_MIIM1_RES_SIZE, + "gcb_miim1"), +}; + +static const struct resource vsc7512_pinctrl_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_GPIO_RES_START, VSC7512_GPIO_RES_SIZE, + "gcb_gpio"), +}; + +static const struct resource vsc7512_sgpio_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_SIO_RES_START, VSC7512_SIO_RES_SIZE, + "gcb_sio"), +}; + +static const struct mfd_cell vsc7512_devs[] = { + { + .name = "ocelot-pinctrl", + .of_compatible = "mscc,ocelot-pinctrl", + .num_resources = ARRAY_SIZE(vsc7512_pinctrl_resources), + .resources = vsc7512_pinctrl_resources, + }, { + .name = "ocelot-sgpio", + .of_compatible = "mscc,ocelot-sgpio", + .num_resources = ARRAY_SIZE(vsc7512_sgpio_resources), + .resources = vsc7512_sgpio_resources, + }, { + .name = "ocelot-miim0", + .of_compatible = "mscc,ocelot-miim", + .num_resources = ARRAY_SIZE(vsc7512_miim0_resources), + .resources = vsc7512_miim0_resources, + }, { + .name = "ocelot-miim1", + .of_compatible = "mscc,ocelot-miim", + .num_resources = ARRAY_SIZE(vsc7512_miim1_resources), + .resources = vsc7512_miim1_resources, + }, +}; + +int ocelot_core_init(struct device *dev) +{ + int ret; + + ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, vsc7512_devs, + ARRAY_SIZE(vsc7512_devs), NULL, 0, NULL); + if (ret) { + dev_err(dev, "Failed to add sub-devices: %d\n", ret); + return ret; + } + + return 0; +} +EXPORT_SYMBOL(ocelot_core_init); + +MODULE_DESCRIPTION("Externally Controlled Ocelot Chip Driver"); +MODULE_AUTHOR("Colin Foster "); +MODULE_LICENSE("GPL"); diff --git a/drivers/mfd/ocelot-spi.c b/drivers/mfd/ocelot-spi.c new file mode 100644 index 000000000000..95754deb0b57 --- /dev/null +++ b/drivers/mfd/ocelot-spi.c @@ -0,0 +1,311 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * SPI core driver for the Ocelot chip family. + * + * This driver will handle everything necessary to allow for communication over + * SPI to the VSC7511, VSC7512, VSC7513 and VSC7514 chips. The main functions + * are to prepare the chip's SPI interface for a specific bus speed, and a host + * processor's endianness. This will create and distribute regmaps for any + * children. + * + * Copyright 2021 Innovative Advantage Inc. + * + * Author: Colin Foster + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include "ocelot.h" + +#define DEV_CPUORG_IF_CTRL 0x0000 +#define DEV_CPUORG_IF_CFGSTAT 0x0004 + +#define CFGSTAT_IF_NUM_VCORE (0 << 24) +#define CFGSTAT_IF_NUM_VRAP (1 << 24) +#define CFGSTAT_IF_NUM_SI (2 << 24) +#define CFGSTAT_IF_NUM_MIIM (3 << 24) + +#define VSC7512_CPUORG_RES_START 0x71000000 +#define VSC7512_CPUORG_RES_SIZE 0x2ff + +#define VSC7512_GCB_RES_START 0x71070000 +#define VSC7512_GCB_RES_SIZE 0x14 + +static const struct resource vsc7512_dev_cpuorg_resource = + DEFINE_RES_REG_NAMED(VSC7512_CPUORG_RES_START, VSC7512_CPUORG_RES_SIZE, + "devcpu_org"); + +static const struct resource vsc7512_gcb_resource = + DEFINE_RES_REG_NAMED(VSC7512_GCB_RES_START, VSC7512_GCB_RES_SIZE, + "devcpu_gcb_chip_regs"); + +int ocelot_spi_initialize(struct device *dev) +{ + struct ocelot_ddata *ddata = dev_get_drvdata(dev); + u32 val, check; + int err; + + val = OCELOT_SPI_BYTE_ORDER; + + /* + * The SPI address must be big-endian, but we want the payload to match + * our CPU. These are two bits (0 and 1) but they're repeated such that + * the write from any configuration will be valid. The four + * configurations are: + * + * 0b00: little-endian, MSB first + * | 111111 | 22221111 | 33222222 | + * | 76543210 | 54321098 | 32109876 | 10987654 | + * + * 0b01: big-endian, MSB first + * | 33222222 | 22221111 | 111111 | | + * | 10987654 | 32109876 | 54321098 | 76543210 | + * + * 0b10: little-endian, LSB first + * | 111111 | 11112222 | 22222233 | + * | 01234567 | 89012345 | 67890123 | 45678901 | + * + * 0b11: big-endian, LSB first + * | 22222233 | 11112222 | 111111 | | + * | 45678901 | 67890123 | 89012345 | 01234567 | + */ + err = regmap_write(ddata->cpuorg_regmap, DEV_CPUORG_IF_CTRL, val); + if (err) + return err; + + /* + * Apply the number of padding bytes between a read request and the data + * payload. Some registers have access times of up to 1us, so if the + * first payload bit is shifted out too quickly, the read will fail. + */ + val = ddata->spi_padding_bytes; + err = regmap_write(ddata->cpuorg_regmap, DEV_CPUORG_IF_CFGSTAT, val); + if (err) + return err; + + /* + * After we write the interface configuration, read it back here. This + * will verify several different things. The first is that the number of + * padding bytes actually got written correctly. These are found in bits + * 0:3. + * + * The second is that bit 16 is cleared. Bit 16 is IF_CFGSTAT:IF_STAT, + * and will be set if the register access is too fast. This would be in + * the condition that the number of padding bytes is insufficient for + * the SPI bus frequency. + * + * The last check is for bits 31:24, which define the interface by which + * the registers are being accessed. Since we're accessing them via the + * serial interface, it must return IF_NUM_SI. + */ + check = val | CFGSTAT_IF_NUM_SI; + + err = regmap_read(ddata->cpuorg_regmap, DEV_CPUORG_IF_CFGSTAT, &val); + if (err) + return err; + + if (check != val) + return -ENODEV; + + return 0; +} +EXPORT_SYMBOL(ocelot_spi_initialize); + +static const struct regmap_config ocelot_spi_regmap_config = { + .reg_bits = 24, + .reg_stride = 4, + .reg_downshift = 2, + .val_bits = 32, + + .write_flag_mask = 0x80, + + .max_register = 0xffffffff, + .use_single_write = true, + .can_multi_write = false, + + .reg_format_endian = REGMAP_ENDIAN_BIG, + .val_format_endian = REGMAP_ENDIAN_NATIVE, +}; + +static int ocelot_spi_regmap_bus_read(void *context, + const void *reg, size_t reg_size, + void *val, size_t val_size) +{ + static const u8 dummy_buf[16] = {0}; + struct spi_transfer tx, padding, rx; + struct ocelot_ddata *ddata = context; + struct spi_device *spi = ddata->spi; + struct spi_message msg; + + spi = ddata->spi; + + spi_message_init(&msg); + + memset(&tx, 0, sizeof(tx)); + + tx.tx_buf = reg; + tx.len = reg_size; + + spi_message_add_tail(&tx, &msg); + + if (ddata->spi_padding_bytes > 0) { + memset(&padding, 0, sizeof(padding)); + + padding.len = ddata->spi_padding_bytes; + padding.tx_buf = dummy_buf; + padding.dummy_data = 1; + + spi_message_add_tail(&padding, &msg); + } + + memset(&rx, 0, sizeof(rx)); + rx.rx_buf = val; + rx.len = val_size; + + spi_message_add_tail(&rx, &msg); + + return spi_sync(spi, &msg); +} + +static int ocelot_spi_regmap_bus_write(void *context, const void *data, + size_t count) +{ + struct ocelot_ddata *ddata = context; + struct spi_device *spi = ddata->spi; + + return spi_write(spi, data, count); +} + +static const struct regmap_bus ocelot_spi_regmap_bus = { + .write = ocelot_spi_regmap_bus_write, + .read = ocelot_spi_regmap_bus_read, +}; + +struct regmap * +ocelot_spi_devm_init_regmap(struct device *dev, struct device *child, + const struct resource *res) +{ + struct ocelot_ddata *ddata = dev_get_drvdata(dev); + struct regmap_config regmap_config; + + memcpy(®map_config, &ocelot_spi_regmap_config, + sizeof(ocelot_spi_regmap_config)); + + regmap_config.name = res->name; + regmap_config.max_register = res->end - res->start; + regmap_config.reg_base = res->start; + + return devm_regmap_init(child, &ocelot_spi_regmap_bus, ddata, + ®map_config); +} + +static int ocelot_spi_probe(struct spi_device *spi) +{ + struct device *dev = &spi->dev; + struct ocelot_ddata *ddata; + int err; + + ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + if (!ddata) + return -ENOMEM; + + ddata->dev = dev; + dev_set_drvdata(dev, ddata); + + if (spi->max_speed_hz <= 500000) { + ddata->spi_padding_bytes = 0; + } else { + /* + * Calculation taken from the manual for IF_CFGSTAT:IF_CFG. + * Register access time is 1us, so we need to configure and send + * out enough padding bytes between the read request and data + * transmission that lasts at least 1 microsecond. + */ + ddata->spi_padding_bytes = 1 + + (spi->max_speed_hz / 1000000 + 2) / 8; + } + + ddata->spi = spi; + + spi->bits_per_word = 8; + + err = spi_setup(spi); + if (err < 0) { + dev_err(&spi->dev, "Error %d initializing SPI\n", err); + return err; + } + + ddata->cpuorg_regmap = + ocelot_spi_devm_init_regmap(dev, dev, + &vsc7512_dev_cpuorg_resource); + if (IS_ERR(ddata->cpuorg_regmap)) + return -ENOMEM; + + ddata->gcb_regmap = ocelot_spi_devm_init_regmap(dev, dev, + &vsc7512_gcb_resource); + if (IS_ERR(ddata->gcb_regmap)) + return -ENOMEM; + + /* + * The chip must be set up for SPI before it gets initialized and reset. + * This must be done before calling init, and after a chip reset is + * performed. + */ + err = ocelot_spi_initialize(dev); + if (err) { + dev_err(dev, "Error %d initializing Ocelot SPI bus\n", err); + return err; + } + + err = ocelot_chip_reset(dev); + if (err) { + dev_err(dev, "Failed to reset device: %d\n", err); + return err; + } + + /* + * A chip reset will clear the SPI configuration, so it needs to be done + * again before we can access any registers + */ + err = ocelot_spi_initialize(dev); + if (err) { + dev_err(dev, + "Failed to initialize Ocelot SPI bus after reset: %d\n", + err); + return err; + } + + err = ocelot_core_init(dev); + if (err < 0) { + dev_err(dev, "Error %d initializing Ocelot core\n", err); + return err; + } + + return 0; +} + +const struct of_device_id ocelot_spi_of_match[] = { + { .compatible = "mscc,vsc7512_mfd_spi" }, + { }, +}; +MODULE_DEVICE_TABLE(of, ocelot_spi_of_match); + +static struct spi_driver ocelot_spi_driver = { + .driver = { + .name = "ocelot_mfd_spi", + .of_match_table = of_match_ptr(ocelot_spi_of_match), + }, + .probe = ocelot_spi_probe, +}; +module_spi_driver(ocelot_spi_driver); + +MODULE_DESCRIPTION("SPI Controlled Ocelot Chip Driver"); +MODULE_AUTHOR("Colin Foster "); +MODULE_LICENSE("Dual MIT/GPL"); diff --git a/drivers/mfd/ocelot.h b/drivers/mfd/ocelot.h new file mode 100644 index 000000000000..b68e6343caca --- /dev/null +++ b/drivers/mfd/ocelot.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* + * Copyright 2021 Innovative Advantage Inc. + */ + +#include + +#include + +struct ocelot_ddata { + struct device *dev; + struct regmap *gcb_regmap; + struct regmap *cpuorg_regmap; + int spi_padding_bytes; + struct spi_device *spi; +}; + +int ocelot_chip_reset(struct device *dev); +int ocelot_core_init(struct device *dev); + +/* SPI-specific routines that won't be necessary for other interfaces */ +struct regmap *ocelot_spi_devm_init_regmap(struct device *dev, + struct device *child, + const struct resource *res); +int ocelot_spi_initialize(struct device *dev); + +#define OCELOT_SPI_BYTE_ORDER_LE 0x00000000 +#define OCELOT_SPI_BYTE_ORDER_BE 0x81818181 + +#ifdef __LITTLE_ENDIAN +#define OCELOT_SPI_BYTE_ORDER OCELOT_SPI_BYTE_ORDER_LE +#else +#define OCELOT_SPI_BYTE_ORDER OCELOT_SPI_BYTE_ORDER_BE +#endif diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 1897119ebb9a..f9124a66e386 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -1039,11 +1039,16 @@ ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port, } #endif +#if IS_ENABLED(CONFIG_MFD_OCELOT) +struct regmap *ocelot_init_regmap_from_resource(struct device *child, + const struct resource *res); +#else static inline struct regmap * ocelot_init_regmap_from_resource(struct device *child, const struct resource *res) { return ERR_PTR(-EOPNOTSUPP); } +#endif #endif From patchwork Sun May 8 18:53:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842516 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FB30C43219 for ; Sun, 8 May 2022 19:02:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238772AbiEHTGD (ORCPT ); Sun, 8 May 2022 15:06:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241817AbiEHS5m (ORCPT ); Sun, 8 May 2022 14:57:42 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2124.outbound.protection.outlook.com [40.107.220.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F6AFA1B1; Sun, 8 May 2022 11:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bRJxtVS+2JK5VIlrTsZP6K4tMhxpi4jTugP84yfyuqDhtys14l6YN7HF/fzRckabiQx1h7BsZXwUOpeoKjCsaHcoAa1Ru1tjRror4rH0rzKE0J/O54r17Z8wHEDMSRxNnHrDMJfIDDSywiT/Ks6TNT+S/O1Hh4xyUDvjhdBa+xvQEjMT2PxE/0F897n5drzZThB4tyRSZkrqCnEJWjT454PK6LpT1WS1CJaX7X3YCIUyRvZh+xY5LIRMMJP4eA9bZscBKrHNAFP8+PQpY8GI2CelWdDQ5qrAVaYcn6QA0RMq+KDEuAj9L1WbyCs3vh5NwM5w5bmihA71Ne2wNOdjHA== 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=SYnUe1IeJdpSC4yXti3PENMjZ6Mv2WHCNFpsCo+hzqE=; b=ZtuU32Bd5jAC5FwiT/aVu2yqD2wfXB4oI6vFWt8ijYVQdtaRrXFY1xaPRm0PtPsoU6vhxJk9zStwCAe3Jxna8jDpReEtT+baUwNNanifYRfk8O0cjC+/XOk5YEgilM9cohP/4zkszNauqjxSnseq6va27oZMRtZS4F5nqedKvUxcgvS2RFuVr/3IdkOdkmNiwH5NzTx5zw/ZjSXnVnYc2AZWPT1NWniPRbWvGno1xZMI8yjXtXoQCVFO4JJENa6gVvSwsaxtzltBF6l23xk2sDbYwavQeL0OizWVoa/+MiwLJ8+1usrVnrjcpw6vSIlBqREf6ZHOR5bh9HPxpJPp2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SYnUe1IeJdpSC4yXti3PENMjZ6Mv2WHCNFpsCo+hzqE=; b=wdp0zgXvCU5vslSswFEkkQ57yosmbH76Axfpwmefc6o15MTCaJJLU8IDliBN89Btlr+/oF5ydiufG5bBopd7CXDOJxzugdw0LaGHKGd0xuLyOiZdaoIjiwrlJHZDHkQhq7NpqO7c2wjlLySG8WP1rkNKmkTBmxOGndiFTtwR5vk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5672.namprd10.prod.outlook.com (2603:10b6:a03:3ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Sun, 8 May 2022 18:53:48 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:53:48 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 09/16] net: mscc: ocelot: expose ocelot wm functions Date: Sun, 8 May 2022 11:53:06 -0700 Message-Id: <20220508185313.2222956-10-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0e0d43d1-05a0-42e2-61a4-08da312415c6 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5672: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: aGH9gPOkAEjoh7KgyEl7KpDcqaoOlF5EEV1KWKtOW39ipcXA79du7EwERiYOaIzWRX3MVArQAc6KFDXxPRhaYXMxBMbTRF5nxbE/yMxfjCL9cJFgF8qlMiG5uNZHQIeRKCl72kVwOw9Zk6aMA8r4b5StQKYDH2RHfWBp+j+FspgP1ugZtlclGMb8qSwuADwXR0KeoW7yErVaMcyHnGJN78yfeC9G2pN9HgI4Kvd4+SSWCpJairM/QTftbXUpFQDn6iabvbMJy7bKiiasBwsh76roUIFs2Kl1sc1jfqQyGugMYYrXq+9w9E+8X9P0BRFBqqwZERNKh3WcO1p5xFT4Z1G1suE33vlfLagDdGh4v/c4wyeZ7FPIfoLcHbARf5NoySExa2unqVLAJa2VjaDThRneGH2heqjxAYZ3bQyf/rhE5Leo4N0bea6pD4Oy8M5zD44VmSch2sxU2MZoJ2Nh0C1xn3cVCmJ5ipKBj9nKXxVn+bSca/8bkV52BQ4lH2yFiuIP42LeVk0RPXzWkXC0W3qpgTJnluGKTbYkix8NriUyUX7cML2OponBCirGInYkqne5twBfue6Azj3cVc64d00ONOHcgPx1/upRO0Ax3+/PSZS5g4jggxhYDNKqEBGpx3aTh9TkNevBAlM4kiD3FHTTNiHAkOOHcPnuANfy86PI3Hxneq31XmR+9Z/7O3JToSKHeIsfUwRFODJqT0FdVg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39830400003)(396003)(366004)(346002)(376002)(136003)(6506007)(6666004)(6512007)(2906002)(8676002)(7416002)(52116002)(8936002)(4326008)(36756003)(5660300002)(86362001)(44832011)(66556008)(66476007)(26005)(2616005)(66946007)(6486002)(508600001)(38350700002)(1076003)(38100700002)(54906003)(186003)(316002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 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WweFQa6RbgEwBXwThpdK5W2ljG+gwZ8qkVrR+NST3M+4rRjvdYWyLmLtlzNw+f5eW4MXCvf89ZIRE3uNs9pFGGvs6Wfdve6Qz8TlSzJ64IODQwRkm60urS1uSb6r0kuu/KAkQ3YNikbHwNmGhlhFBhFEblRbJvhpaJ9H+dwdUfL0wWeWuHTCTU3S5E7x+1Ff8DVsiDlNjqtPEYlb/mXdwc7snEfYGkW94SUV7QSzr7KgcqdBBqRimP8PE1tMKGz0eHW5Byj0dIRl/gEzxMvnBJC1PY288FBAv/Hnt8MTR/AjmFS2yDsOCs4KpM1HAcckoATQ1Y7mtqI5dPgA1LOmv1OIdbRxq87wQL0OWaBE92WylFehRdbnoEhHIXvuWGXlZe28l0p1lM67BmM5PCQuB0nmJYI9nefbOEt5z8jUO0tEVvSA14EikFBPIfcwRfxs5e+LAgLTR8h9nS7Cs43N5YLIFuiLIe596csuWGkAVUTy7VrwaSLc/fwJq9v2i7P5cdxHYyQsyXzlqdpl5Bc4VgFFNO9pGKlEdJmHLoyrz00dOD4iTuZCwfDrsxrd+gVtknT44PvQTnNcOglxvK8yLnHRIJhSNfTlLyVbpfVANPmD53pB8LuLw2W9ZY2hdKcJ3y9DaxezGaQm7X8gkTirguW/DBsdC2URlk3IrhfKuiuwtMGdgXh+CiKc3t9rR7OA7dZ2Iyk46WXyA2ujXWIQzbRyoQFO X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e0d43d1-05a0-42e2-61a4-08da312415c6 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:53:48.2283 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ib8uPaa+B8ti5/pwO5DlXoyG+Pg19xjh0eJg5d1mKKyoXP2Pkt86bymwBT8Of/W+R49NkVa43ti4mPzx7hhzh3WgR+IsFRJAoCws+Mr36fs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5672 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Expose ocelot_wm functions so they can be shared with other drivers. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/mscc/ocelot_devlink.c | 31 ++++++++++++++++++++++ drivers/net/ethernet/mscc/ocelot_vsc7514.c | 28 ------------------- include/soc/mscc/ocelot.h | 5 ++++ 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_devlink.c b/drivers/net/ethernet/mscc/ocelot_devlink.c index b8737efd2a85..d9ea75a14f2f 100644 --- a/drivers/net/ethernet/mscc/ocelot_devlink.c +++ b/drivers/net/ethernet/mscc/ocelot_devlink.c @@ -487,6 +487,37 @@ static void ocelot_watermark_init(struct ocelot *ocelot) ocelot_setup_sharing_watermarks(ocelot); } +/* Watermark encode + * Bit 8: Unit; 0:1, 1:16 + * Bit 7-0: Value to be multiplied with unit + */ +u16 ocelot_wm_enc(u16 value) +{ + WARN_ON(value >= 16 * BIT(8)); + + if (value >= BIT(8)) + return BIT(8) | (value / 16); + + return value; +} +EXPORT_SYMBOL(ocelot_wm_enc); + +u16 ocelot_wm_dec(u16 wm) +{ + if (wm & BIT(8)) + return (wm & GENMASK(7, 0)) * 16; + + return wm; +} +EXPORT_SYMBOL(ocelot_wm_dec); + +void ocelot_wm_stat(u32 val, u32 *inuse, u32 *maxuse) +{ + *inuse = (val & GENMASK(23, 12)) >> 12; + *maxuse = val & GENMASK(11, 0); +} +EXPORT_SYMBOL(ocelot_wm_stat); + /* Pool size and type are fixed up at runtime. Keeping this structure to * look up the cell size multipliers. */ diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 961f803aca19..68d205088665 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -307,34 +307,6 @@ static int ocelot_reset(struct ocelot *ocelot) return 0; } -/* Watermark encode - * Bit 8: Unit; 0:1, 1:16 - * Bit 7-0: Value to be multiplied with unit - */ -static u16 ocelot_wm_enc(u16 value) -{ - WARN_ON(value >= 16 * BIT(8)); - - if (value >= BIT(8)) - return BIT(8) | (value / 16); - - return value; -} - -static u16 ocelot_wm_dec(u16 wm) -{ - if (wm & BIT(8)) - return (wm & GENMASK(7, 0)) * 16; - - return wm; -} - -static void ocelot_wm_stat(u32 val, u32 *inuse, u32 *maxuse) -{ - *inuse = (val & GENMASK(23, 12)) >> 12; - *maxuse = val & GENMASK(11, 0); -} - static const struct ocelot_ops ocelot_ops = { .reset = ocelot_reset, .wm_enc = ocelot_wm_enc, diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index f9124a66e386..61888453f913 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -865,6 +865,11 @@ void ocelot_deinit_port(struct ocelot *ocelot, int port); void ocelot_port_set_dsa_8021q_cpu(struct ocelot *ocelot, int port); void ocelot_port_unset_dsa_8021q_cpu(struct ocelot *ocelot, int port); +/* Watermark interface */ +u16 ocelot_wm_enc(u16 value); +u16 ocelot_wm_dec(u16 wm); +void ocelot_wm_stat(u32 val, u32 *inuse, u32 *maxuse); + /* DSA callbacks */ void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data); void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data); From patchwork Sun May 8 18:53:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842523 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE18BC433FE for ; Sun, 8 May 2022 19:02:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239033AbiEHTGc (ORCPT ); Sun, 8 May 2022 15:06:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382524AbiEHS5m (ORCPT ); Sun, 8 May 2022 14:57:42 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2124.outbound.protection.outlook.com [40.107.220.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 510EDBC08; Sun, 8 May 2022 11:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VzJsNqBDbwgfO9fjHlte6OAvYIdnbElhBmVIE+8Rh427IhcbIO9ogie2R9whGQrM730KY9L068jTbwDyc02cwhslgnqKtLFjmH+6xd/Y+3VzPylkOVDeQFkMKF8qRu7RiWKE/9mgeMJIKVYCRoRcTWWWkB61Tjy8BUzgcovBZXXTw8RSHN9Lxz93IfrUpxauNVShDP0MWLBoHUF/u86e64Pe4lua7a95o4NiVqbEfFZmHmUCvcKSxbrbn/gMxq8K5P34WfwXHyHAFWeJEbXfzGgmiti491TriNg7j7TwA6RV2nNjiAFr+Isx5i1IC23+VJ3ZZ4L6sbK1W8v1Kw6P9w== 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=gx6AZJnfc614Ow3stmxcAnCSyXe6NZrFhq+L/kh8pzI=; b=coMIbYo2Ptr3jXfxc1hqvhlRV0k+f6On7xSbOExSjRXI+ctF5+fzKVDKBnUnPvFaez0gv8xFBF+5x5fRJ10yEmW92irzHHsA1c3oQ0TiWYMyACZsY8gjTW/U2JzMgaEDsoRNYqqMZimdeRbIHewOslFRTDU+bYlxso36H48Vqlfg9XUuCyZ49orG459sGuIR1MnWbny9jKyw+Fjcv03EhNDY5PpzXO17JQcm+e9oo+ZwrxgSOXwxwIbuL9tgtnfv3cw+7ta7KTZIoLdVVkH1mgttEo74c/BG6wQ1uEf6+Hzmtl9jM128gsCiDQpEqsJ5LEI84H5/kOes2FvONe4p9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gx6AZJnfc614Ow3stmxcAnCSyXe6NZrFhq+L/kh8pzI=; b=nIUNiq5CiFfHrYjjDxnJQAFK7HOIoJDa2XoWsSJPLk4I9ANAHQh2b2F30ef3OpDnV9YwoG+2PoEnnVfhs0iCollUZ9/GepmPrBAYpzYZZoVdcRNizDUpn5EL1qGfg2GrTdLCrJdiQGkRccb1vWz5ANCyDNFRhY4grTvPBF+91Zs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5672.namprd10.prod.outlook.com (2603:10b6:a03:3ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Sun, 8 May 2022 18:53:50 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:53:50 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 10/16] net: dsa: felix: add configurable device quirks Date: Sun, 8 May 2022 11:53:07 -0700 Message-Id: <20220508185313.2222956-11-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7357b10d-a843-488c-99ac-08da31241729 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5672: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: jxqaJjfguqqM5JkPY9WZFFgMhQ38eUe4iaIaPcvC58C7CSemwOTUrCmeD046aJmgqO9aabFlP6QJFu2QM5ngHTCj/Nhg+zOay30apu+oPR6vz3G8DO2MYqHYmxMbyaJUvZWBYbb71PpwXgKx6cFHZiv2xoSgST5iZW85banaXy/CLI5KbUXvofv/a+fd2Pz+XVtldvEL91p9ku5uVvEwSSLDeO4nKP2VReEKAz4Q7RC6EoYCkAizwiiuE3IA+Bd/iueFOq4KnloE6ZiZRch0pHUmgqs0oUnELOBLd7GqRlfw8bAe77cZ8OCmcDQSMTXtQrpUd07UBfFiloNzP+phT5CndfMji31Idx9xiQcpljBFO3ouEz0G3GIRwr4HAh2k3b2O1VSokCEQxn5i8vnNBiWCve5ixbZZWeiLjHQoT2oKd6bN+97mFQDABs1bNErOUqDNcfVxAXhCXgx4b4JoDvPAm641TGDJrgq4R1DP+LIzQAiVWKSmsvcMqtgLyhcaE2Wf+4NlMdUQa7OWjMYMbrmSgoZJ7W/OBinSdwjLIaU5zi24Y3Lz6htCUNRrf+2EsZmJB4dMzEs+Xqd3pTXqKwp/J0b5fIb6P+Y85ukf8+xCvKPHU4Ll05ID6M8ZH2ZFKhKEkGbKikgBwLeoMx4+tYBWOI0d2croEFpLZmjz9Tm6Yw+XWUSTGNMf9e8fxQBN X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39830400003)(396003)(366004)(346002)(376002)(136003)(6506007)(6666004)(6512007)(2906002)(8676002)(7416002)(52116002)(8936002)(4326008)(36756003)(5660300002)(86362001)(44832011)(66556008)(66476007)(26005)(2616005)(66946007)(6486002)(508600001)(38350700002)(1076003)(38100700002)(54906003)(186003)(316002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: h3LbwlwUNskfxDVmV6mGLnZ8vx1I3nqXT8XZ1P9927aROYpWO9iNvkeb6Lw/M5gloTQ/7aEiUOdVXzLCXPavaatc5Zo+gtLALbJk5o7h4ZdYMTy+3IuuU048+ndAkJClCHlir0Z/GP3WDrRDp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REghZR9sPJzZ9K9hN+k5NSgR1k7ttjxSnyEpnuidgG0bsheS3S8znGDhWHLXG4hok9z3K60WqSViFeVV+K+1yBf9eXEGK01LVTLc9wipIByKZsy3V47RUCFu3/sB1b36oWxKA/BAgS/LxpfIwR8fQ1FZjuUIzQzGwBDwuBq+E7+r2G0X3nokfPe2C7uI7qZYZfedoJUVGpxUY/iZc6UFugwOs4VOLaO0Sa3+1BOQ3ROB5e/iPikogjVrshQgC3o39JwhCheZTjk8eQXBnj7HNhHhaqhQOhwIC8ZwWZhzu1HJcaTmFS4obJklKCNvuujMnSv+aft8d6pcSH3MHvMfpUoTJKaIqcL+10EeJB21tuCDEz9V8MCxusIlAxr+tzpjf+6hvN0Q7RqoSQ42xQkmjJ65fWF35Rk1MOehdIMTqvxIc18agdx1vTmnl/X+/NrrP9xRWOleJwANRnbLT91r0dIJhDCuVAdmA1JOtNIAHWEs8RwqH91KhoODDVMm8HYAAbVizYAT0QxzjzCc6LE8CNzR0kfTOVDNaDADnbBlAq4VOsFfXL5gsH0R8gyLW3jNlv0qC+i3OurHVw1IHLh X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7357b10d-a843-488c-99ac-08da31241729 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:53:50.5719 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mLU0/D6O6+sk4aHoBEhZsL2T1jNmOxB3+urWh/4/5qd73RY+PMts3PryLF+1mSjz1FyEoGm/48o45Wap6SviBwfuUXCRp4+TxndtCEswh7w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5672 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC The define FELIX_MAC_QUIRKS was used directly in the felix.c shared driver. Other devices (VSC7512 for example) don't require the same quirks, so they need to be configured on a per-device basis. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean --- drivers/net/dsa/ocelot/felix.c | 7 +++++-- drivers/net/dsa/ocelot/felix.h | 1 + drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + drivers/net/dsa/ocelot/seville_vsc9953.c | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 33cb124ca912..d09408baaab7 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1023,9 +1023,12 @@ static void felix_phylink_mac_link_down(struct dsa_switch *ds, int port, phy_interface_t interface) { struct ocelot *ocelot = ds->priv; + struct felix *felix; + + felix = ocelot_to_felix(ocelot); ocelot_phylink_mac_link_down(ocelot, port, link_an_mode, interface, - FELIX_MAC_QUIRKS); + felix->info->quirks); } static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, @@ -1040,7 +1043,7 @@ static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, ocelot_phylink_mac_link_up(ocelot, port, phydev, link_an_mode, interface, speed, duplex, tx_pause, rx_pause, - FELIX_MAC_QUIRKS); + felix->info->quirks); if (felix->info->port_sched_speed_set) felix->info->port_sched_speed_set(ocelot, port, speed); diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index 39faf1027965..3ecac79bbf09 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -32,6 +32,7 @@ struct felix_info { u16 vcap_pol_base2; u16 vcap_pol_max2; const struct ptp_clock_info *ptp_caps; + unsigned long quirks; /* Some Ocelot switches are integrated into the SoC without the * extraction IRQ line connected to the ARM GIC. By enabling this diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 081871824eaf..95e165a12382 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -2225,6 +2225,7 @@ static const struct felix_info felix_info_vsc9959 = { .num_mact_rows = 2048, .num_ports = VSC9959_NUM_PORTS, .num_tx_queues = OCELOT_NUM_TC, + .quirks = FELIX_MAC_QUIRKS, .quirk_no_xtr_irq = true, .ptp_caps = &vsc9959_ptp_caps, .mdio_bus_alloc = vsc9959_mdio_bus_alloc, diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 48fd43a93364..e1400fadf064 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1092,6 +1092,7 @@ static const struct felix_info seville_info_vsc9953 = { .vcap_pol_max = VSC9953_VCAP_POLICER_MAX, .vcap_pol_base2 = VSC9953_VCAP_POLICER_BASE2, .vcap_pol_max2 = VSC9953_VCAP_POLICER_MAX2, + .quirks = FELIX_MAC_QUIRKS, .num_mact_rows = 2048, .num_ports = VSC9953_NUM_PORTS, .num_tx_queues = OCELOT_NUM_TC, From patchwork Sun May 8 18:53:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842512 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8BA4C43219 for ; Sun, 8 May 2022 19:02:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238362AbiEHTF6 (ORCPT ); Sun, 8 May 2022 15:05:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236071AbiEHS5p (ORCPT ); Sun, 8 May 2022 14:57:45 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2102.outbound.protection.outlook.com [40.107.220.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BA29A1B1; Sun, 8 May 2022 11:53:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aZsxDBy7pTYHpj2s1V7NqmgypGF0DYQ1drXGf1gnp6djfYXNFCQPhCZG3se27cFh5Zp76EOiW8hVt/Vp/oDLbc/jqNWVWj5yEdAuPYber3K3fetawIO8RWic1FNpQH15/S8MwEc7tHTHdhogJMR2O/8KlN18bFpk6/E/N76V9HgXhg86aQLhMYYwu/LrcHab1BnHzG6sdcHInaU53joxhL1RDU9dybWUfRylpzCubVKFTfSLkkQsAEfD8iOfo4702nE7t/unxNSzwRA3i/B/cP8lmZUIY00DJRurko/ilXboNRW2M6dUaR6Lqdp8+MEbNtKa2/OjW71Jdo9G9RlpKA== 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=jht0BpWcJRTHFvJRgbv6zaCcBdyebYpgiTuhrzO+5mA=; b=nGYwRAvdR2J5ZHt4LrsqgqhtekAXABk4tjyXUjBfP+oHa0UIvSDDb/stYteNjtfKJgIdjj82HNfanSQ28By/EPbhFLQjT/Z8Olzrq+zsrBU0Iwz35t+XDFcmaQHppV9GFZy/12o6UweZQq/AK7oXy4ToVqo0CuMWCcvpo19/1Jf6UiBMmfcQ2KeTIwEfCEQrC/ij8LxirmwS3LK9GJ5hgGvd9TYZAlSgINTaKerfewwdtFhP3PTeRC5HsKlPwcki/JCT3gjU0RBP5PCMWfmwjWWqmn06EYx+xiKel06FEin7DeNcCo7yAaWwGRAA9stD1gjYep8sBSMDzhTMASPMsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jht0BpWcJRTHFvJRgbv6zaCcBdyebYpgiTuhrzO+5mA=; b=trY32lhpQt686ztp39oTxVB8u67f+RMdFAWN8i8bjFqYYfWJA+kGWHUP3qQNqUqUV0SG3tbqK7Z2BJLzQUVwogj7YNe+jisyPxOMSDjcmu9RaAr2JUh5mVHPuiYoxwsUCQujJqgXd4+yNb5uSBDXDsKBdYXLa+xxdtRw3mx+RxY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5672.namprd10.prod.outlook.com (2603:10b6:a03:3ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Sun, 8 May 2022 18:53:53 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:53:53 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 11/16] net: mscc: ocelot: expose regfield definition to be used by other drivers Date: Sun, 8 May 2022 11:53:08 -0700 Message-Id: <20220508185313.2222956-12-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2358fb44-91e6-47a5-f69e-08da312418b2 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5672: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: ZYB70u66F2DILRYBHq22yeLm/KjL0Yt+L0ZGSseriRjcPutEp+U8WCgxLpWEmSdUeG6cTkgHnK++kt3iWUnL/GtPnTcLgoL0aPWn6puQioucEK5JWtz2LjRHzDxEnNatotrMSfA4Z964hUyCkWbDoITVuaEaCOvv7+9b/88vwgt+fnZyZRQ+lYVytlYvz4XCcK9HpoMbsV1yaDPFVSFgereHj4ZCApns6CXGEEbi2oTlzLtLIcefE/m+7uc+JijA1caAqzAgzyeqBUzhGM1u8Cms9tj4RnImBrqi+7NVAAjxy5tUoteZGgVBbRTN1cFy2HiGwAa5Xhwe/8Qh9nJIqONlTRz7U+ihadwuTnP5oG5VFusVnnoX1S5up2M5mcWqPWc02l0BoLuQcrWBKSnjM5zNvwX0YUlaz9GRqCFSHW6K475JOE/W+UzB8HzomRbY08nHB9VTFqvuQNCeWFTSLMl3fMbvcMm2hLWHeJW42XdjjKpbO6IUbUrQs7LAwouDDTQ7R/JrK7CbQzHTuNE9br55soDcj7aIy5rfrJUJou47589gXsM5bN06UKj5dLj9M2OGS99MkjS6XIZJBFqpBtNlllvgPOjw+XqGS2CKusKlAsxgmU1ZT550dc2e7kgDMQtPhuF3w9zoHYxJcK/LX5xShHREKIUDE0dldS7lGlxRWWKXjJ6GBphV+40/QhhkMeh8Uu3dZcOoSNLcyc5n/A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39830400003)(396003)(366004)(346002)(376002)(136003)(6506007)(6666004)(6512007)(2906002)(8676002)(7416002)(52116002)(8936002)(4326008)(36756003)(5660300002)(86362001)(44832011)(66556008)(66476007)(26005)(30864003)(2616005)(66946007)(6486002)(508600001)(38350700002)(1076003)(38100700002)(54906003)(186003)(316002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +vBcpq2rWPMStgqdxRhZx7EigdUPuhdXVLsU7GHqjSQBvAIS6a7D+PGTPWVVVnlcwzIlNChgCTy8SkkChL6zLbbWYPFhAITIyI7MByal/dcoPJlo9idkxITFKxWTF2fKWPPPDX0CtW6uys5VlUFzlSh7uxn2ZkaOTWB1vhkzMk7L3CCfkA/DiEZi6odGEFsEvfOh7vK17qjTP4pULhQgYg9f0VP+3QXMoB6X6Lnd2sjuCPqGO6XgGECnVaEK1VYKkF9R5OyN4kCqAj4sL0JWv3nJ9ECdy+DI/5VlY+AuNYMxxSOsQLq290Z78CXPk34CMrzlKfj3MSGhyMB2F5QP38+7xzS1usLLqJRrKtjV8CGILky//k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KvGGCwCofHV+J6P8qlvWoXYcxkVPbUjzyeG6pZygYMucGXR/RUK6Oy1fRQn63khDpve3GcOEr3YKTlvz65CUFM60owZoce7D1OWJCAt2M+I7Q0ReOM3+iLpGow+CM1csKQRDC2wOA7SwhO6Eaf7qDk5yr9F8CCscVa0+9kylIWgzvrjYjl2q6jTDgP9/otCBwAWf9KOZwDknT7jYgH2xT1TA3egFDtwHm3jk3LGigWNA66kPrxzuMT65t/JFZfgpMKvRvNipFKBarQ6lJkixTSfq0Gg9Mlodp5+b9xFRSBsmqMTnqH6+sCSLpIccdBdjofaqIrEeocL9G X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2358fb44-91e6-47a5-f69e-08da312418b2 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:53:53.1811 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oFpvI+rXI4fAVQqVz5rR/9z8dbuAJO4jKhIOyd+IyVMECAnQArxUGfipmlCCGREn0aBv9p3jpKa/4Wt3GkhqJndIKJTb7PlVNWpiv7HIYfY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5672 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC The ocelot_regfields struct is common between several different chips, some of which can only be controlled externally. Export this structure so it doesn't have to be duplicated in these other drivers. Rename the structure as well, to follow the conventions of other shared resources. Signed-off-by: Colin Foster --- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 60 +--------------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 59 +++++++++++++++++++++ include/soc/mscc/vsc7514_regs.h | 2 + 3 files changed, 62 insertions(+), 59 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 68d205088665..a13fec7247d6 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -38,64 +38,6 @@ static const u32 *ocelot_regmap[TARGET_MAX] = { [DEV_GMII] = vsc7514_dev_gmii_regmap, }; -static const struct reg_field ocelot_regfields[REGFIELD_MAX] = { - [ANA_ADVLEARN_VLAN_CHK] = REG_FIELD(ANA_ADVLEARN, 11, 11), - [ANA_ADVLEARN_LEARN_MIRROR] = REG_FIELD(ANA_ADVLEARN, 0, 10), - [ANA_ANEVENTS_MSTI_DROP] = REG_FIELD(ANA_ANEVENTS, 27, 27), - [ANA_ANEVENTS_ACLKILL] = REG_FIELD(ANA_ANEVENTS, 26, 26), - [ANA_ANEVENTS_ACLUSED] = REG_FIELD(ANA_ANEVENTS, 25, 25), - [ANA_ANEVENTS_AUTOAGE] = REG_FIELD(ANA_ANEVENTS, 24, 24), - [ANA_ANEVENTS_VS2TTL1] = REG_FIELD(ANA_ANEVENTS, 23, 23), - [ANA_ANEVENTS_STORM_DROP] = REG_FIELD(ANA_ANEVENTS, 22, 22), - [ANA_ANEVENTS_LEARN_DROP] = REG_FIELD(ANA_ANEVENTS, 21, 21), - [ANA_ANEVENTS_AGED_ENTRY] = REG_FIELD(ANA_ANEVENTS, 20, 20), - [ANA_ANEVENTS_CPU_LEARN_FAILED] = REG_FIELD(ANA_ANEVENTS, 19, 19), - [ANA_ANEVENTS_AUTO_LEARN_FAILED] = REG_FIELD(ANA_ANEVENTS, 18, 18), - [ANA_ANEVENTS_LEARN_REMOVE] = REG_FIELD(ANA_ANEVENTS, 17, 17), - [ANA_ANEVENTS_AUTO_LEARNED] = REG_FIELD(ANA_ANEVENTS, 16, 16), - [ANA_ANEVENTS_AUTO_MOVED] = REG_FIELD(ANA_ANEVENTS, 15, 15), - [ANA_ANEVENTS_DROPPED] = REG_FIELD(ANA_ANEVENTS, 14, 14), - [ANA_ANEVENTS_CLASSIFIED_DROP] = REG_FIELD(ANA_ANEVENTS, 13, 13), - [ANA_ANEVENTS_CLASSIFIED_COPY] = REG_FIELD(ANA_ANEVENTS, 12, 12), - [ANA_ANEVENTS_VLAN_DISCARD] = REG_FIELD(ANA_ANEVENTS, 11, 11), - [ANA_ANEVENTS_FWD_DISCARD] = REG_FIELD(ANA_ANEVENTS, 10, 10), - [ANA_ANEVENTS_MULTICAST_FLOOD] = REG_FIELD(ANA_ANEVENTS, 9, 9), - [ANA_ANEVENTS_UNICAST_FLOOD] = REG_FIELD(ANA_ANEVENTS, 8, 8), - [ANA_ANEVENTS_DEST_KNOWN] = REG_FIELD(ANA_ANEVENTS, 7, 7), - [ANA_ANEVENTS_BUCKET3_MATCH] = REG_FIELD(ANA_ANEVENTS, 6, 6), - [ANA_ANEVENTS_BUCKET2_MATCH] = REG_FIELD(ANA_ANEVENTS, 5, 5), - [ANA_ANEVENTS_BUCKET1_MATCH] = REG_FIELD(ANA_ANEVENTS, 4, 4), - [ANA_ANEVENTS_BUCKET0_MATCH] = REG_FIELD(ANA_ANEVENTS, 3, 3), - [ANA_ANEVENTS_CPU_OPERATION] = REG_FIELD(ANA_ANEVENTS, 2, 2), - [ANA_ANEVENTS_DMAC_LOOKUP] = REG_FIELD(ANA_ANEVENTS, 1, 1), - [ANA_ANEVENTS_SMAC_LOOKUP] = REG_FIELD(ANA_ANEVENTS, 0, 0), - [ANA_TABLES_MACACCESS_B_DOM] = REG_FIELD(ANA_TABLES_MACACCESS, 18, 18), - [ANA_TABLES_MACTINDX_BUCKET] = REG_FIELD(ANA_TABLES_MACTINDX, 10, 11), - [ANA_TABLES_MACTINDX_M_INDEX] = REG_FIELD(ANA_TABLES_MACTINDX, 0, 9), - [QSYS_TIMED_FRAME_ENTRY_TFRM_VLD] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 20, 20), - [QSYS_TIMED_FRAME_ENTRY_TFRM_FP] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 8, 19), - [QSYS_TIMED_FRAME_ENTRY_TFRM_PORTNO] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 4, 7), - [QSYS_TIMED_FRAME_ENTRY_TFRM_TM_SEL] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 1, 3), - [QSYS_TIMED_FRAME_ENTRY_TFRM_TM_T] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 0, 0), - [SYS_RESET_CFG_CORE_ENA] = REG_FIELD(SYS_RESET_CFG, 2, 2), - [SYS_RESET_CFG_MEM_ENA] = REG_FIELD(SYS_RESET_CFG, 1, 1), - [SYS_RESET_CFG_MEM_INIT] = REG_FIELD(SYS_RESET_CFG, 0, 0), - /* Replicated per number of ports (12), register size 4 per port */ - [QSYS_SWITCH_PORT_MODE_PORT_ENA] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 14, 14, 12, 4), - [QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 11, 13, 12, 4), - [QSYS_SWITCH_PORT_MODE_YEL_RSRVD] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 10, 10, 12, 4), - [QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 9, 9, 12, 4), - [QSYS_SWITCH_PORT_MODE_TX_PFC_ENA] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 1, 8, 12, 4), - [QSYS_SWITCH_PORT_MODE_TX_PFC_MODE] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 0, 0, 12, 4), - [SYS_PORT_MODE_DATA_WO_TS] = REG_FIELD_ID(SYS_PORT_MODE, 5, 6, 12, 4), - [SYS_PORT_MODE_INCL_INJ_HDR] = REG_FIELD_ID(SYS_PORT_MODE, 3, 4, 12, 4), - [SYS_PORT_MODE_INCL_XTR_HDR] = REG_FIELD_ID(SYS_PORT_MODE, 1, 2, 12, 4), - [SYS_PORT_MODE_INCL_HDR_ERR] = REG_FIELD_ID(SYS_PORT_MODE, 0, 0, 12, 4), - [SYS_PAUSE_CFG_PAUSE_START] = REG_FIELD_ID(SYS_PAUSE_CFG, 10, 18, 12, 4), - [SYS_PAUSE_CFG_PAUSE_STOP] = REG_FIELD_ID(SYS_PAUSE_CFG, 1, 9, 12, 4), - [SYS_PAUSE_CFG_PAUSE_ENA] = REG_FIELD_ID(SYS_PAUSE_CFG, 0, 1, 12, 4), -}; - static const struct ocelot_stat_layout ocelot_stats_layout[] = { { .name = "rx_octets", .offset = 0x00, }, { .name = "rx_unicast", .offset = 0x01, }, @@ -231,7 +173,7 @@ static int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops) ocelot->num_mact_rows = 1024; ocelot->ops = ops; - ret = ocelot_regfields_init(ocelot, ocelot_regfields); + ret = ocelot_regfields_init(ocelot, vsc7514_regfields); if (ret) return ret; diff --git a/drivers/net/ethernet/mscc/vsc7514_regs.c b/drivers/net/ethernet/mscc/vsc7514_regs.c index c2af4eb8ca5d..847e64d11075 100644 --- a/drivers/net/ethernet/mscc/vsc7514_regs.c +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c @@ -9,6 +9,65 @@ #include #include "ocelot.h" +const struct reg_field vsc7514_regfields[REGFIELD_MAX] = { + [ANA_ADVLEARN_VLAN_CHK] = REG_FIELD(ANA_ADVLEARN, 11, 11), + [ANA_ADVLEARN_LEARN_MIRROR] = REG_FIELD(ANA_ADVLEARN, 0, 10), + [ANA_ANEVENTS_MSTI_DROP] = REG_FIELD(ANA_ANEVENTS, 27, 27), + [ANA_ANEVENTS_ACLKILL] = REG_FIELD(ANA_ANEVENTS, 26, 26), + [ANA_ANEVENTS_ACLUSED] = REG_FIELD(ANA_ANEVENTS, 25, 25), + [ANA_ANEVENTS_AUTOAGE] = REG_FIELD(ANA_ANEVENTS, 24, 24), + [ANA_ANEVENTS_VS2TTL1] = REG_FIELD(ANA_ANEVENTS, 23, 23), + [ANA_ANEVENTS_STORM_DROP] = REG_FIELD(ANA_ANEVENTS, 22, 22), + [ANA_ANEVENTS_LEARN_DROP] = REG_FIELD(ANA_ANEVENTS, 21, 21), + [ANA_ANEVENTS_AGED_ENTRY] = REG_FIELD(ANA_ANEVENTS, 20, 20), + [ANA_ANEVENTS_CPU_LEARN_FAILED] = REG_FIELD(ANA_ANEVENTS, 19, 19), + [ANA_ANEVENTS_AUTO_LEARN_FAILED] = REG_FIELD(ANA_ANEVENTS, 18, 18), + [ANA_ANEVENTS_LEARN_REMOVE] = REG_FIELD(ANA_ANEVENTS, 17, 17), + [ANA_ANEVENTS_AUTO_LEARNED] = REG_FIELD(ANA_ANEVENTS, 16, 16), + [ANA_ANEVENTS_AUTO_MOVED] = REG_FIELD(ANA_ANEVENTS, 15, 15), + [ANA_ANEVENTS_DROPPED] = REG_FIELD(ANA_ANEVENTS, 14, 14), + [ANA_ANEVENTS_CLASSIFIED_DROP] = REG_FIELD(ANA_ANEVENTS, 13, 13), + [ANA_ANEVENTS_CLASSIFIED_COPY] = REG_FIELD(ANA_ANEVENTS, 12, 12), + [ANA_ANEVENTS_VLAN_DISCARD] = REG_FIELD(ANA_ANEVENTS, 11, 11), + [ANA_ANEVENTS_FWD_DISCARD] = REG_FIELD(ANA_ANEVENTS, 10, 10), + [ANA_ANEVENTS_MULTICAST_FLOOD] = REG_FIELD(ANA_ANEVENTS, 9, 9), + [ANA_ANEVENTS_UNICAST_FLOOD] = REG_FIELD(ANA_ANEVENTS, 8, 8), + [ANA_ANEVENTS_DEST_KNOWN] = REG_FIELD(ANA_ANEVENTS, 7, 7), + [ANA_ANEVENTS_BUCKET3_MATCH] = REG_FIELD(ANA_ANEVENTS, 6, 6), + [ANA_ANEVENTS_BUCKET2_MATCH] = REG_FIELD(ANA_ANEVENTS, 5, 5), + [ANA_ANEVENTS_BUCKET1_MATCH] = REG_FIELD(ANA_ANEVENTS, 4, 4), + [ANA_ANEVENTS_BUCKET0_MATCH] = REG_FIELD(ANA_ANEVENTS, 3, 3), + [ANA_ANEVENTS_CPU_OPERATION] = REG_FIELD(ANA_ANEVENTS, 2, 2), + [ANA_ANEVENTS_DMAC_LOOKUP] = REG_FIELD(ANA_ANEVENTS, 1, 1), + [ANA_ANEVENTS_SMAC_LOOKUP] = REG_FIELD(ANA_ANEVENTS, 0, 0), + [ANA_TABLES_MACACCESS_B_DOM] = REG_FIELD(ANA_TABLES_MACACCESS, 18, 18), + [ANA_TABLES_MACTINDX_BUCKET] = REG_FIELD(ANA_TABLES_MACTINDX, 10, 11), + [ANA_TABLES_MACTINDX_M_INDEX] = REG_FIELD(ANA_TABLES_MACTINDX, 0, 9), + [GCB_SOFT_RST_SWC_RST] = REG_FIELD(GCB_SOFT_RST, 1, 1), + [QSYS_TIMED_FRAME_ENTRY_TFRM_VLD] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 20, 20), + [QSYS_TIMED_FRAME_ENTRY_TFRM_FP] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 8, 19), + [QSYS_TIMED_FRAME_ENTRY_TFRM_PORTNO] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 4, 7), + [QSYS_TIMED_FRAME_ENTRY_TFRM_TM_SEL] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 1, 3), + [QSYS_TIMED_FRAME_ENTRY_TFRM_TM_T] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 0, 0), + [SYS_RESET_CFG_CORE_ENA] = REG_FIELD(SYS_RESET_CFG, 2, 2), + [SYS_RESET_CFG_MEM_ENA] = REG_FIELD(SYS_RESET_CFG, 1, 1), + [SYS_RESET_CFG_MEM_INIT] = REG_FIELD(SYS_RESET_CFG, 0, 0), + /* Replicated per number of ports (12), register size 4 per port */ + [QSYS_SWITCH_PORT_MODE_PORT_ENA] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 14, 14, 12, 4), + [QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 11, 13, 12, 4), + [QSYS_SWITCH_PORT_MODE_YEL_RSRVD] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 10, 10, 12, 4), + [QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 9, 9, 12, 4), + [QSYS_SWITCH_PORT_MODE_TX_PFC_ENA] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 1, 8, 12, 4), + [QSYS_SWITCH_PORT_MODE_TX_PFC_MODE] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 0, 0, 12, 4), + [SYS_PORT_MODE_DATA_WO_TS] = REG_FIELD_ID(SYS_PORT_MODE, 5, 6, 12, 4), + [SYS_PORT_MODE_INCL_INJ_HDR] = REG_FIELD_ID(SYS_PORT_MODE, 3, 4, 12, 4), + [SYS_PORT_MODE_INCL_XTR_HDR] = REG_FIELD_ID(SYS_PORT_MODE, 1, 2, 12, 4), + [SYS_PORT_MODE_INCL_HDR_ERR] = REG_FIELD_ID(SYS_PORT_MODE, 0, 0, 12, 4), + [SYS_PAUSE_CFG_PAUSE_START] = REG_FIELD_ID(SYS_PAUSE_CFG, 10, 18, 12, 4), + [SYS_PAUSE_CFG_PAUSE_STOP] = REG_FIELD_ID(SYS_PAUSE_CFG, 1, 9, 12, 4), + [SYS_PAUSE_CFG_PAUSE_ENA] = REG_FIELD_ID(SYS_PAUSE_CFG, 0, 1, 12, 4), +}; + const u32 vsc7514_ana_regmap[] = { REG(ANA_ADVLEARN, 0x009000), REG(ANA_VLANMASK, 0x009004), diff --git a/include/soc/mscc/vsc7514_regs.h b/include/soc/mscc/vsc7514_regs.h index ceee26c96959..9b40e7d00ec5 100644 --- a/include/soc/mscc/vsc7514_regs.h +++ b/include/soc/mscc/vsc7514_regs.h @@ -10,6 +10,8 @@ #include +extern const struct reg_field vsc7514_regfields[REGFIELD_MAX]; + extern const u32 vsc7514_ana_regmap[]; extern const u32 vsc7514_qs_regmap[]; extern const u32 vsc7514_qsys_regmap[]; From patchwork Sun May 8 18:53:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842526 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B8B2C4332F for ; Sun, 8 May 2022 19:03:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239109AbiEHTGg (ORCPT ); Sun, 8 May 2022 15:06:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377188AbiEHS5s (ORCPT ); Sun, 8 May 2022 14:57:48 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2111.outbound.protection.outlook.com [40.107.220.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12048A1B1; Sun, 8 May 2022 11:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OTxbK/ZMYUJQknanyiufCI+unS+S0pzG+qj6NZoJLh6YfCrXZh2tq7fcQW1qeJq7I6hYxkmdUiw+7tDD9Tt0pQolB/nkPt4DkY2Fb4WGh7cqpRG8g5bny+YslrHkZExSoXz2eFHUI4APVK4EHn8iVAU9fH0ZO2DWs+/XEGVvJBjkNby31SWUS/lzEf0/i2m937/PvAVIKmiGWJxA6aGsmCfDIisdepZhDWUWI6E/QiGi6F5wEOZIgOJ3hj1+X2FNWtA5irvA5q4VeKA30w+xx/1WWnRUckym8id+VlVWqTOvAJ/samWli/upLbTsKqJ4z3hFXaV9R2u5xKZxUCtJJw== 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=zFkQ0OKEFLYVgq8FFL3lOp7a1XD65RKQBAXNAqoZEYk=; b=LmBjtxC1HGNbs5vBgeKaFwv6GUitxChDVK3HaWcV0+D3Hghdp3bmr7gg00C1lWZcENnQB+rPJP5OZ2xr4ADOhOUAi30d9J4X/JfU62ZGxucQ47Q1dC9fz59/IM3mN8Xrse8i2n0i52p/EPAlbztA9km+sRegLcBf3hBTK/Vz8FbgKBr+qKjGnm93HiBim2LvCs5s1FEapmkxtq7JtS8Gmhywy/v7QUI/CUNRuQcvbRp7dDx2Uk1Z7Bw6SE8zz5vV+PczCm+XoX2ZbKPhqTkMXLYLj78jAoBYY/9+hq4cyeDo+/BABV8CrTvVwRLoBmTxg1WVCopcl0W+BjF/2fcyGg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zFkQ0OKEFLYVgq8FFL3lOp7a1XD65RKQBAXNAqoZEYk=; b=PqbNA4bVcM5M+wqPPRQIkdXXEsc8aCRhh9/q9AZxoza6q1E8/7BkkguaNgIffOU2yJgLfSPUl0PJGAZdFGbFYvdDBOER0yK6gvegFbz/GElyJCvYJDxh75PexZMrdylkUkfq4yyhp/7BsDr6IcY+QdZ1AzrVih+Iyi3Msgao6sw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5672.namprd10.prod.outlook.com (2603:10b6:a03:3ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Sun, 8 May 2022 18:53:55 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:53:55 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 12/16] net: mscc: ocelot: expose stats layout definition to be used by other drivers Date: Sun, 8 May 2022 11:53:09 -0700 Message-Id: <20220508185313.2222956-13-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 16a2075b-a1c1-452f-b5f1-08da31241a3e X-MS-TrafficTypeDiagnostic: SJ0PR10MB5672: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: hj4BlolD3AYhYRGh9T5KDWOfB9tcta9zL3gBXOfFAzKTM+rqabduD8nOWGuiER4X7YYUjqSn67wx5/3HEYhr3cvd7AaUQj3xz9Ch2wCr1ergkC9sRNUUrLptcDfUCXaqpcl/bRtevNiW2rx0357aqebeZ67UeG3O/XQAfg5kxIEw1tGe29xwexlMkFpNAhVcvEGnZPriRfTT9CcHcIxLjzz07DAUPCs3AC+RLC4E4H2uIvNvG8339QE6qSXg1RhaZDLQ2rdF/bQUtOM9C8xR/AZB1kufbTiItsd8+agcyH/tAcpSMR/F5I2eGMEGyABx9+CmzZaVVW16wwtd5Y8KO6pYaq3a2iosLiscTUdh2FUEth8y3nzq/EhASayZMoHx2Pu46XGax8p/46lAml9nH8/p2Ko7peGMcezU9a4aILjJbJRBHnSFqJpjYksJYpTmHJeeySi49SVDZ8B+ZIpwTRiWTuGzXnn9V/4HQr2ktbUyYpuADrnqXzdmHU06IFIXI0seQfbmbzJkmv9PLzxbgaP3SnqeSbjt2r3lxZMR8HRH7BtghxNKJ6XRjg/Rrtqfu75RQOQQkK6rzL5q2qpWy7C/A/40qjKd+bf/FGmXvL53iVaKgb+y6U9xTNcpPLTyeSyNW+IfGG1fDOjoazgXTTEdV9ZA9MVs0s9kzRfsKbUxm5it1PTd3XNuNor9g+CB61mtm9bhpLRsgKBij+XEgA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39830400003)(396003)(366004)(346002)(376002)(136003)(6506007)(6666004)(6512007)(2906002)(8676002)(7416002)(52116002)(8936002)(4326008)(36756003)(5660300002)(86362001)(44832011)(66556008)(66476007)(26005)(30864003)(2616005)(66946007)(6486002)(508600001)(38350700002)(1076003)(38100700002)(54906003)(186003)(316002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ijvRkMjzOb2c9zX3t5qw9sybjBMIJJYe00VdI84jJD1+FAIJ9ElQa8LEayDqbpIOvvargzuhLuLlv9s+rbVRIl/0xJ+JMUfGzTlYtL8BYDuiaPh5N7BUDSb/n5JwV/AXnNnrgG9+zZq462nghwGr/syqxdRyW1ah0DTCc1668sDyQDfP8Fbu4lb2Z4P28Pnv24e32tBE6qlORUU1JLimthjZsIyworn1Oi2BsEbYyNJVBJPt3e3FfXmuvF4iet3uD5IyuUJRIdj8XKgB84xwICVSetHlQXEokndSBhdIrymRV5luUW9Plhkb3yrpuS5MljKo015IZELM2jvg8dTdEjaAdktj8zDR+zQ8PIb7RkeGL5rzrThlPmpdnL8RiYs2c2FoivW6jsPT4yPSECBRAlDXOcbjhgO5ktKqrwHoGi/EQO1QG8CqWcwqDv8HaVftaQrkOr+8AyBEAiV0DmVu49o46iN3ucruy4hoUkXH93nJwyFxZFlZ6GduK7XgnXhEMVOON5uLYM7qxRFzn3cXYJmDiwr110ClGyHtijPnr+/rjhC2snnxmOuOezSx8Ss6+8/3YJEVmZozCyZosmT360k4foJCYQsJ2YtGVogN9NTBJr4UOBw7+G+arEpUKAcOMEugV3Da/Q71eZxm9GX6eKQ3o98Jz7C0p/E7E1/ZHrkHHnSdPMnicqdw9Q+G/yS3uV3nwmzhn+ijrT6ZT3m1iGn5jYqCvuk9zIj/yeAROsUSHqD33qC0mjyEeyP1iFslgq5uqtK74C89hmJNJokkWX/UV8fH6X1gx3X4zG90rlbcXEonM3OXp2ki8krFcWNkymY7OCOCouTjippLWkBdl4U0XNF1oXkAgEd1dBsDuD2CxC8U5apmMP6fRDLSh7sh2R8trJLk+wOGF21vo0BDRVfJLfAC7H4x082yH+9CN40IhnTyTDCmIgptAKyngw1KhZs7jMR1d8uH9JZm4a0QjjnpuffGRqDUmECEkZrZ2FLi7UNHAIwIuUsptzrjl45DyxmEEuJah9tuPotxXVFWyegFP4m0CYCuMZLZw5NGaipmzccQ5w7GerVRc5NXehF5ymkeZZIPpSQyng7UNbLDwDMMs3eDH3AU3Cpd+33ARrDJGMycBoZD+66+vpS5kodZ6LWml116hI5hhCz3RzvuzOfLxvnyW2YLV8v9w6O04fW2cvC0xtab5gjmC6RmcMegUbf9DvcFbUm+Dg9jqGm52Gxvf3cF8uYl/lJgjNkJSFqlf209os4PYt9DcCdmyxNGEZoTlUicSSQ7ghpJOpunmurCnfdd77sh0zfKPIvCSHjcyHcxaoi105OSwzqygbP+eBdSg++0drJWar9Cel66wxU0QxG4+3NgGvIbgs2q6tYQ1BNHmYBOY3NT25t4CrN9ShokZFYP8x1fvhN7z+MSDSauxnfDy9fgCUHZKBAYfoQIPh1NYA0rsNChon4jSz206np3JlMia0zRGQuX7uYZh3Rn0pUlI5ytTUuOt0tqA5Ze73L/IrCwFFp+LSQdL66qSVDLAQQzUv7ZlI/JF+35Swa+CTiUiW5xztbdPadUuNrAWBSietCsF1mxR3WQrcWzubRGLmgv6IzPrmoF/czFXco9tfCCGcsOJ2+LJtauiHM48qcj14XBe6l1hacSWb/pgaH7q7pzgGt9N55auWSJZZpbfxWyxehr2knyhFokVNmzk3xsQprqoLrrwoUQ11dv87lXQ1LP7lp32GyC/VtKu2EFusZryaO42bhRUzMAo25qXnucHKQ1IltUKflIlT8O X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16a2075b-a1c1-452f-b5f1-08da31241a3e X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:53:55.7903 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bjqq1lZI6Kahj3+mkPpZ8lZh2RncqMus9NW2sXyNduJyZ+DwjNV6S2o7PfHdSAlNl8wQ5qjfvG26rEL70QFjsSYtHlfyEawTihP1EhHuPH0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5672 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC The ocelot_stats_layout array is common between several different chips, some of which can only be controlled externally. Export this structure so it doesn't have to be duplicated in these other drivers. Rename the structure as well, to follow the conventions of other shared resources. Signed-off-by: Colin Foster --- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 99 +--------------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 97 +++++++++++++++++++++ include/soc/mscc/vsc7514_regs.h | 3 + 3 files changed, 101 insertions(+), 98 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index a13fec7247d6..7673ed76358b 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -38,103 +38,6 @@ static const u32 *ocelot_regmap[TARGET_MAX] = { [DEV_GMII] = vsc7514_dev_gmii_regmap, }; -static const struct ocelot_stat_layout ocelot_stats_layout[] = { - { .name = "rx_octets", .offset = 0x00, }, - { .name = "rx_unicast", .offset = 0x01, }, - { .name = "rx_multicast", .offset = 0x02, }, - { .name = "rx_broadcast", .offset = 0x03, }, - { .name = "rx_shorts", .offset = 0x04, }, - { .name = "rx_fragments", .offset = 0x05, }, - { .name = "rx_jabbers", .offset = 0x06, }, - { .name = "rx_crc_align_errs", .offset = 0x07, }, - { .name = "rx_sym_errs", .offset = 0x08, }, - { .name = "rx_frames_below_65_octets", .offset = 0x09, }, - { .name = "rx_frames_65_to_127_octets", .offset = 0x0A, }, - { .name = "rx_frames_128_to_255_octets", .offset = 0x0B, }, - { .name = "rx_frames_256_to_511_octets", .offset = 0x0C, }, - { .name = "rx_frames_512_to_1023_octets", .offset = 0x0D, }, - { .name = "rx_frames_1024_to_1526_octets", .offset = 0x0E, }, - { .name = "rx_frames_over_1526_octets", .offset = 0x0F, }, - { .name = "rx_pause", .offset = 0x10, }, - { .name = "rx_control", .offset = 0x11, }, - { .name = "rx_longs", .offset = 0x12, }, - { .name = "rx_classified_drops", .offset = 0x13, }, - { .name = "rx_red_prio_0", .offset = 0x14, }, - { .name = "rx_red_prio_1", .offset = 0x15, }, - { .name = "rx_red_prio_2", .offset = 0x16, }, - { .name = "rx_red_prio_3", .offset = 0x17, }, - { .name = "rx_red_prio_4", .offset = 0x18, }, - { .name = "rx_red_prio_5", .offset = 0x19, }, - { .name = "rx_red_prio_6", .offset = 0x1A, }, - { .name = "rx_red_prio_7", .offset = 0x1B, }, - { .name = "rx_yellow_prio_0", .offset = 0x1C, }, - { .name = "rx_yellow_prio_1", .offset = 0x1D, }, - { .name = "rx_yellow_prio_2", .offset = 0x1E, }, - { .name = "rx_yellow_prio_3", .offset = 0x1F, }, - { .name = "rx_yellow_prio_4", .offset = 0x20, }, - { .name = "rx_yellow_prio_5", .offset = 0x21, }, - { .name = "rx_yellow_prio_6", .offset = 0x22, }, - { .name = "rx_yellow_prio_7", .offset = 0x23, }, - { .name = "rx_green_prio_0", .offset = 0x24, }, - { .name = "rx_green_prio_1", .offset = 0x25, }, - { .name = "rx_green_prio_2", .offset = 0x26, }, - { .name = "rx_green_prio_3", .offset = 0x27, }, - { .name = "rx_green_prio_4", .offset = 0x28, }, - { .name = "rx_green_prio_5", .offset = 0x29, }, - { .name = "rx_green_prio_6", .offset = 0x2A, }, - { .name = "rx_green_prio_7", .offset = 0x2B, }, - { .name = "tx_octets", .offset = 0x40, }, - { .name = "tx_unicast", .offset = 0x41, }, - { .name = "tx_multicast", .offset = 0x42, }, - { .name = "tx_broadcast", .offset = 0x43, }, - { .name = "tx_collision", .offset = 0x44, }, - { .name = "tx_drops", .offset = 0x45, }, - { .name = "tx_pause", .offset = 0x46, }, - { .name = "tx_frames_below_65_octets", .offset = 0x47, }, - { .name = "tx_frames_65_to_127_octets", .offset = 0x48, }, - { .name = "tx_frames_128_255_octets", .offset = 0x49, }, - { .name = "tx_frames_256_511_octets", .offset = 0x4A, }, - { .name = "tx_frames_512_1023_octets", .offset = 0x4B, }, - { .name = "tx_frames_1024_1526_octets", .offset = 0x4C, }, - { .name = "tx_frames_over_1526_octets", .offset = 0x4D, }, - { .name = "tx_yellow_prio_0", .offset = 0x4E, }, - { .name = "tx_yellow_prio_1", .offset = 0x4F, }, - { .name = "tx_yellow_prio_2", .offset = 0x50, }, - { .name = "tx_yellow_prio_3", .offset = 0x51, }, - { .name = "tx_yellow_prio_4", .offset = 0x52, }, - { .name = "tx_yellow_prio_5", .offset = 0x53, }, - { .name = "tx_yellow_prio_6", .offset = 0x54, }, - { .name = "tx_yellow_prio_7", .offset = 0x55, }, - { .name = "tx_green_prio_0", .offset = 0x56, }, - { .name = "tx_green_prio_1", .offset = 0x57, }, - { .name = "tx_green_prio_2", .offset = 0x58, }, - { .name = "tx_green_prio_3", .offset = 0x59, }, - { .name = "tx_green_prio_4", .offset = 0x5A, }, - { .name = "tx_green_prio_5", .offset = 0x5B, }, - { .name = "tx_green_prio_6", .offset = 0x5C, }, - { .name = "tx_green_prio_7", .offset = 0x5D, }, - { .name = "tx_aged", .offset = 0x5E, }, - { .name = "drop_local", .offset = 0x80, }, - { .name = "drop_tail", .offset = 0x81, }, - { .name = "drop_yellow_prio_0", .offset = 0x82, }, - { .name = "drop_yellow_prio_1", .offset = 0x83, }, - { .name = "drop_yellow_prio_2", .offset = 0x84, }, - { .name = "drop_yellow_prio_3", .offset = 0x85, }, - { .name = "drop_yellow_prio_4", .offset = 0x86, }, - { .name = "drop_yellow_prio_5", .offset = 0x87, }, - { .name = "drop_yellow_prio_6", .offset = 0x88, }, - { .name = "drop_yellow_prio_7", .offset = 0x89, }, - { .name = "drop_green_prio_0", .offset = 0x8A, }, - { .name = "drop_green_prio_1", .offset = 0x8B, }, - { .name = "drop_green_prio_2", .offset = 0x8C, }, - { .name = "drop_green_prio_3", .offset = 0x8D, }, - { .name = "drop_green_prio_4", .offset = 0x8E, }, - { .name = "drop_green_prio_5", .offset = 0x8F, }, - { .name = "drop_green_prio_6", .offset = 0x90, }, - { .name = "drop_green_prio_7", .offset = 0x91, }, - OCELOT_STAT_END -}; - static void ocelot_pll5_init(struct ocelot *ocelot) { /* Configure PLL5. This will need a proper CCF driver @@ -169,7 +72,7 @@ static int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops) int ret; ocelot->map = ocelot_regmap; - ocelot->stats_layout = ocelot_stats_layout; + ocelot->stats_layout = vsc7514_stats_layout; ocelot->num_mact_rows = 1024; ocelot->ops = ops; diff --git a/drivers/net/ethernet/mscc/vsc7514_regs.c b/drivers/net/ethernet/mscc/vsc7514_regs.c index 847e64d11075..2b75753da4e2 100644 --- a/drivers/net/ethernet/mscc/vsc7514_regs.c +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c @@ -9,6 +9,103 @@ #include #include "ocelot.h" +const struct ocelot_stat_layout vsc7514_stats_layout[] = { + { .name = "rx_octets", .offset = 0x00, }, + { .name = "rx_unicast", .offset = 0x01, }, + { .name = "rx_multicast", .offset = 0x02, }, + { .name = "rx_broadcast", .offset = 0x03, }, + { .name = "rx_shorts", .offset = 0x04, }, + { .name = "rx_fragments", .offset = 0x05, }, + { .name = "rx_jabbers", .offset = 0x06, }, + { .name = "rx_crc_align_errs", .offset = 0x07, }, + { .name = "rx_sym_errs", .offset = 0x08, }, + { .name = "rx_frames_below_65_octets", .offset = 0x09, }, + { .name = "rx_frames_65_to_127_octets", .offset = 0x0A, }, + { .name = "rx_frames_128_to_255_octets", .offset = 0x0B, }, + { .name = "rx_frames_256_to_511_octets", .offset = 0x0C, }, + { .name = "rx_frames_512_to_1023_octets", .offset = 0x0D, }, + { .name = "rx_frames_1024_to_1526_octets", .offset = 0x0E, }, + { .name = "rx_frames_over_1526_octets", .offset = 0x0F, }, + { .name = "rx_pause", .offset = 0x10, }, + { .name = "rx_control", .offset = 0x11, }, + { .name = "rx_longs", .offset = 0x12, }, + { .name = "rx_classified_drops", .offset = 0x13, }, + { .name = "rx_red_prio_0", .offset = 0x14, }, + { .name = "rx_red_prio_1", .offset = 0x15, }, + { .name = "rx_red_prio_2", .offset = 0x16, }, + { .name = "rx_red_prio_3", .offset = 0x17, }, + { .name = "rx_red_prio_4", .offset = 0x18, }, + { .name = "rx_red_prio_5", .offset = 0x19, }, + { .name = "rx_red_prio_6", .offset = 0x1A, }, + { .name = "rx_red_prio_7", .offset = 0x1B, }, + { .name = "rx_yellow_prio_0", .offset = 0x1C, }, + { .name = "rx_yellow_prio_1", .offset = 0x1D, }, + { .name = "rx_yellow_prio_2", .offset = 0x1E, }, + { .name = "rx_yellow_prio_3", .offset = 0x1F, }, + { .name = "rx_yellow_prio_4", .offset = 0x20, }, + { .name = "rx_yellow_prio_5", .offset = 0x21, }, + { .name = "rx_yellow_prio_6", .offset = 0x22, }, + { .name = "rx_yellow_prio_7", .offset = 0x23, }, + { .name = "rx_green_prio_0", .offset = 0x24, }, + { .name = "rx_green_prio_1", .offset = 0x25, }, + { .name = "rx_green_prio_2", .offset = 0x26, }, + { .name = "rx_green_prio_3", .offset = 0x27, }, + { .name = "rx_green_prio_4", .offset = 0x28, }, + { .name = "rx_green_prio_5", .offset = 0x29, }, + { .name = "rx_green_prio_6", .offset = 0x2A, }, + { .name = "rx_green_prio_7", .offset = 0x2B, }, + { .name = "tx_octets", .offset = 0x40, }, + { .name = "tx_unicast", .offset = 0x41, }, + { .name = "tx_multicast", .offset = 0x42, }, + { .name = "tx_broadcast", .offset = 0x43, }, + { .name = "tx_collision", .offset = 0x44, }, + { .name = "tx_drops", .offset = 0x45, }, + { .name = "tx_pause", .offset = 0x46, }, + { .name = "tx_frames_below_65_octets", .offset = 0x47, }, + { .name = "tx_frames_65_to_127_octets", .offset = 0x48, }, + { .name = "tx_frames_128_255_octets", .offset = 0x49, }, + { .name = "tx_frames_256_511_octets", .offset = 0x4A, }, + { .name = "tx_frames_512_1023_octets", .offset = 0x4B, }, + { .name = "tx_frames_1024_1526_octets", .offset = 0x4C, }, + { .name = "tx_frames_over_1526_octets", .offset = 0x4D, }, + { .name = "tx_yellow_prio_0", .offset = 0x4E, }, + { .name = "tx_yellow_prio_1", .offset = 0x4F, }, + { .name = "tx_yellow_prio_2", .offset = 0x50, }, + { .name = "tx_yellow_prio_3", .offset = 0x51, }, + { .name = "tx_yellow_prio_4", .offset = 0x52, }, + { .name = "tx_yellow_prio_5", .offset = 0x53, }, + { .name = "tx_yellow_prio_6", .offset = 0x54, }, + { .name = "tx_yellow_prio_7", .offset = 0x55, }, + { .name = "tx_green_prio_0", .offset = 0x56, }, + { .name = "tx_green_prio_1", .offset = 0x57, }, + { .name = "tx_green_prio_2", .offset = 0x58, }, + { .name = "tx_green_prio_3", .offset = 0x59, }, + { .name = "tx_green_prio_4", .offset = 0x5A, }, + { .name = "tx_green_prio_5", .offset = 0x5B, }, + { .name = "tx_green_prio_6", .offset = 0x5C, }, + { .name = "tx_green_prio_7", .offset = 0x5D, }, + { .name = "tx_aged", .offset = 0x5E, }, + { .name = "drop_local", .offset = 0x80, }, + { .name = "drop_tail", .offset = 0x81, }, + { .name = "drop_yellow_prio_0", .offset = 0x82, }, + { .name = "drop_yellow_prio_1", .offset = 0x83, }, + { .name = "drop_yellow_prio_2", .offset = 0x84, }, + { .name = "drop_yellow_prio_3", .offset = 0x85, }, + { .name = "drop_yellow_prio_4", .offset = 0x86, }, + { .name = "drop_yellow_prio_5", .offset = 0x87, }, + { .name = "drop_yellow_prio_6", .offset = 0x88, }, + { .name = "drop_yellow_prio_7", .offset = 0x89, }, + { .name = "drop_green_prio_0", .offset = 0x8A, }, + { .name = "drop_green_prio_1", .offset = 0x8B, }, + { .name = "drop_green_prio_2", .offset = 0x8C, }, + { .name = "drop_green_prio_3", .offset = 0x8D, }, + { .name = "drop_green_prio_4", .offset = 0x8E, }, + { .name = "drop_green_prio_5", .offset = 0x8F, }, + { .name = "drop_green_prio_6", .offset = 0x90, }, + { .name = "drop_green_prio_7", .offset = 0x91, }, + OCELOT_STAT_END +}; + const struct reg_field vsc7514_regfields[REGFIELD_MAX] = { [ANA_ADVLEARN_VLAN_CHK] = REG_FIELD(ANA_ADVLEARN, 11, 11), [ANA_ADVLEARN_LEARN_MIRROR] = REG_FIELD(ANA_ADVLEARN, 0, 10), diff --git a/include/soc/mscc/vsc7514_regs.h b/include/soc/mscc/vsc7514_regs.h index 9b40e7d00ec5..d2b5b6b86aff 100644 --- a/include/soc/mscc/vsc7514_regs.h +++ b/include/soc/mscc/vsc7514_regs.h @@ -8,8 +8,11 @@ #ifndef VSC7514_REGS_H #define VSC7514_REGS_H +#include #include +extern const struct ocelot_stat_layout vsc7514_stats_layout[]; + extern const struct reg_field vsc7514_regfields[REGFIELD_MAX]; extern const u32 vsc7514_ana_regmap[]; From patchwork Sun May 8 18:53:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842520 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7579C433EF for ; Sun, 8 May 2022 19:02:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236723AbiEHTGV (ORCPT ); Sun, 8 May 2022 15:06:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235086AbiEHS5v (ORCPT ); Sun, 8 May 2022 14:57:51 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2099.outbound.protection.outlook.com [40.107.220.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D198A1B1; Sun, 8 May 2022 11:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mPqoa3BMP0M3SLz6+9dWcaF4UnxxkgAFRPvB81UH52yQktf8HzJhyXhZLZ2f3sMGHX+uE6+9xJfTRtPyyz8WMdBIlbJ+nS8DRxn31RKMFLqD/+DsPQTST6bON51wN/HJ1rmnnBqdO3G9YKDHHmSNwFFUmRYT78gMrH5N0CQUKEPH9cxMXXDXmuy7B0CcMxGqKZayogql1RjMvIIros9hx7Ui021D30HeaZCx9Bcke2Q0NrsnilmqKQJ1Rl6ibP/h65ThMlAPH+9JReXpPzn5U7kr8mbrvATLL94UXfH4sTkaseSWcSK12muZPz4Nmz5Ug9Rcqn/aaETtD+Tit5pakA== 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=hR6KyRqP3UGkGySX6vQxXEvYmEmEmfBf9oJhx5+YSio=; b=K46ywgbVLax84IzxdeavBPcNV0ZBrPlwXgFissd5hWwrshnBaP8rYhZ4yC/lnX2fQ2iWTzQ5NLbLpO0Hwc+EH0rcxJf8+iLC/QLqujKMwgJ223ff691PUeg61d2BhRUNnWol+oU1Cc1Kuvb0vMz+VujxceTCmZKC5an0fxkQJ4JLobwqwj8fqG4LjA+xJi2TKx1QiTUiJa3A/K8jtRVGjYZJ4nIxLJjoiL9n9dcPq1Que9MAyppvNTDUog+SRikmM9rLCX5PtxW0VpQCyvpVohXzJMG9pyWV8Y1RemldTxuG8/MiUvgPIXJcprEhwYfrupIK7qj8CRqTcUygcSAzRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hR6KyRqP3UGkGySX6vQxXEvYmEmEmfBf9oJhx5+YSio=; b=BrjDEO2iKmOndQ0ORDkWFlfXQxdWYNkCTH4+/Ain0iHWbogbTf0rAIZQYCJhzSVQJyV59Fqb/wa3ccd6EnU6hQYjhh3vIBMT4l5NQQ6t6XbVvt8Dkop6OGMUBCfcxwEUx3w/qfXD0m/TXcwpHBTrNVteYo7k55Et+dqHEPrzgfg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5672.namprd10.prod.outlook.com (2603:10b6:a03:3ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Sun, 8 May 2022 18:53:58 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:53:58 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 13/16] net: mscc: ocelot: expose vcap_props structure Date: Sun, 8 May 2022 11:53:10 -0700 Message-Id: <20220508185313.2222956-14-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6d8095d0-13df-4621-c320-08da31241bd8 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5672: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: pCb4LD+HUyGunOFYiQC9vzi0cM5RIIPdSvFmXWGfjDbvMnEk4jXdzREMfG35QYAzDGbcUmqukeC4qFAHWnxt9WJlV2wC3XCAsvkbswmvCS3Ddspid8hFgQAXuCIEEcMcfXVMoGKWEgMUYndaGL+X+KnuuOmbCr8AC28Yi/Ddlbu+gO3fG36dwTFTrCZlL14H7maot3xGnr0Rp3sFbWvg8dz7ZOqVqOUT10DCe/r9y5ITFYcu/LJUmhKwSqP7dyVhzWBidJ0V4vUM9MJf4wq46CdmlJAr5FqrShAnI3IlwLp48Y4ZTwNXTOr3u/BrxN6EG0WFD8+nLNi4a8ko8YzjWnLIt+/+PcbIEEQOKX8qGblfSa43h7DHEVYwG67zWlkgViNLN7Wt2doTami9XgZJR1iuKusehz2BCBlY2Lh+u4FBe4pLbTe2kiLRgxF5nHB/OUM0cBj7xmmNUbz2NrwS5NvPy8XXL23rGvoSAInqYrZOCSQ0vLpByYsYo7nIbBK+OuPiT1CkIBWMVvDgYQOHTHyzqMlJogXOJQX58X0E0UW9JZTfJMQf/4obXLEt1E6lrOjSknU994G45e0GTBAwb9xslRXeOfBTbhwzqNZ8iF6YqpzEfWXkXpX5zTY7Yg7GfPaa4hA8521vi+WVcmwP/Ci8DSSWh7kfxQiKI7W3gGmTkYfsw4C0kTK6TFMl5hjKi58iJpu+UEm7ootQso+psQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(396003)(39840400004)(366004)(346002)(376002)(136003)(6506007)(6666004)(6512007)(2906002)(8676002)(7416002)(52116002)(8936002)(4326008)(36756003)(5660300002)(86362001)(44832011)(66556008)(66476007)(26005)(2616005)(66946007)(6486002)(508600001)(38350700002)(1076003)(38100700002)(54906003)(186003)(316002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9IXnJVxctbh6lFNGUX3Jwb8uB6nsBGXA5Vh+y/r/d7QGuBrt+SdciGthyCpQEJysiIhhm+EwG3ktl+1TPfhMvYU3l/ykx5e4ygHcrKod8sJDpp7De9pJ9yulwncNBgkT5M3fJulGQwVjUqqqJr1l5Kkf4tzDZZ/HJK6PFMRYISImvWtm8Dxicj1MvpdsSCcxs0I+PlCQdatoX7fj0ZcTpEZsFofbFbZy8WBhCsU5SuaTO+F7O8ybWj7MBpOskmbIAcNHcHX6cqvw9HYTADTLKuFEq9BMoh+zsGQJWqUaSI77dvbKv74rkvFM59CfVHdI7GjKcTeWt2zkAQoFyNtu28TTjP6thBitHwvsUMttY5N0c1hTWBB25kJhupVAyItvjU3V+4EKVeMF+T36atoXJEE/brHjIhbSmxCOQrPNzZhZQqKWC/2dJrHpKnf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bHzqE5Ti/5FB4w6g38tb28278DUqFG4pw9TGQZ/9+lEf3oMrSWRsgsAnCLALKkYB9PRU/TtBud0kom267s2shBVgIWrBktyxE7MMSrSc7WgwvYstMIXRF3YnlRtSftwQCWjeWDz14WZQLGwj6VgWmLvGXzlp1F5icZzeyU1nukCVTqKQFpsg/Uz1zuZwJCia6/y1FR0uchnoDd2ZXF1R9Ej1CWWRdpAgiMycDlarAnxRLp6bOA X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d8095d0-13df-4621-c320-08da31241bd8 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:53:58.4308 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dDmOmLV09ee6BpGc0XbcGCDekx0Zq/jmbuIxneAMU6MnzIl2PRQHbLXh8DGjbU/KqHmDGNaLBAlUveiR9mPq3R/qCgmVi2FsQLLWjNWpGcM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5672 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC The vcap_props structure is common to other devices, specifically the VSC7512 chip that can only be controlled externally. Export this structure so it doesn't need to be recreated. Signed-off-by: Colin Foster --- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 43 --------------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 44 ++++++++++++++++++++++ include/soc/mscc/vsc7514_regs.h | 1 + 3 files changed, 45 insertions(+), 43 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 7673ed76358b..6191bca7a9c4 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -161,49 +161,6 @@ static const struct ocelot_ops ocelot_ops = { .netdev_to_port = ocelot_netdev_to_port, }; -static struct vcap_props vsc7514_vcap_props[] = { - [VCAP_ES0] = { - .action_type_width = 0, - .action_table = { - [ES0_ACTION_TYPE_NORMAL] = { - .width = 73, /* HIT_STICKY not included */ - .count = 1, - }, - }, - .target = S0, - .keys = vsc7514_vcap_es0_keys, - .actions = vsc7514_vcap_es0_actions, - }, - [VCAP_IS1] = { - .action_type_width = 0, - .action_table = { - [IS1_ACTION_TYPE_NORMAL] = { - .width = 78, /* HIT_STICKY not included */ - .count = 4, - }, - }, - .target = S1, - .keys = vsc7514_vcap_is1_keys, - .actions = vsc7514_vcap_is1_actions, - }, - [VCAP_IS2] = { - .action_type_width = 1, - .action_table = { - [IS2_ACTION_TYPE_NORMAL] = { - .width = 49, - .count = 2 - }, - [IS2_ACTION_TYPE_SMAC_SIP] = { - .width = 6, - .count = 4 - }, - }, - .target = S2, - .keys = vsc7514_vcap_is2_keys, - .actions = vsc7514_vcap_is2_actions, - }, -}; - static struct ptp_clock_info ocelot_ptp_clock_info = { .owner = THIS_MODULE, .name = "ocelot ptp", diff --git a/drivers/net/ethernet/mscc/vsc7514_regs.c b/drivers/net/ethernet/mscc/vsc7514_regs.c index 2b75753da4e2..d538b05306f8 100644 --- a/drivers/net/ethernet/mscc/vsc7514_regs.c +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c @@ -677,3 +677,47 @@ const struct vcap_field vsc7514_vcap_is2_actions[] = { [VCAP_IS2_ACT_HIT_CNT] = { 49, 32 }, }; EXPORT_SYMBOL(vsc7514_vcap_is2_actions); + +struct vcap_props vsc7514_vcap_props[] = { + [VCAP_ES0] = { + .action_type_width = 0, + .action_table = { + [ES0_ACTION_TYPE_NORMAL] = { + .width = 73, /* HIT_STICKY not included */ + .count = 1, + }, + }, + .target = S0, + .keys = vsc7514_vcap_es0_keys, + .actions = vsc7514_vcap_es0_actions, + }, + [VCAP_IS1] = { + .action_type_width = 0, + .action_table = { + [IS1_ACTION_TYPE_NORMAL] = { + .width = 78, /* HIT_STICKY not included */ + .count = 4, + }, + }, + .target = S1, + .keys = vsc7514_vcap_is1_keys, + .actions = vsc7514_vcap_is1_actions, + }, + [VCAP_IS2] = { + .action_type_width = 1, + .action_table = { + [IS2_ACTION_TYPE_NORMAL] = { + .width = 49, + .count = 2 + }, + [IS2_ACTION_TYPE_SMAC_SIP] = { + .width = 6, + .count = 4 + }, + }, + .target = S2, + .keys = vsc7514_vcap_is2_keys, + .actions = vsc7514_vcap_is2_actions, + }, +}; +EXPORT_SYMBOL(vsc7514_vcap_props); diff --git a/include/soc/mscc/vsc7514_regs.h b/include/soc/mscc/vsc7514_regs.h index d2b5b6b86aff..a939849efd91 100644 --- a/include/soc/mscc/vsc7514_regs.h +++ b/include/soc/mscc/vsc7514_regs.h @@ -12,6 +12,7 @@ #include extern const struct ocelot_stat_layout vsc7514_stats_layout[]; +extern struct vcap_props vsc7514_vcap_props[]; extern const struct reg_field vsc7514_regfields[REGFIELD_MAX]; From patchwork Sun May 8 18:53:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842524 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8D19C433F5 for ; Sun, 8 May 2022 19:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231963AbiEHTGZ (ORCPT ); Sun, 8 May 2022 15:06:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382571AbiEHS5y (ORCPT ); Sun, 8 May 2022 14:57:54 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2132.outbound.protection.outlook.com [40.107.220.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 941F3A1B1; Sun, 8 May 2022 11:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S1YQLJ6pZN35n7v2dgvWd65H51qqoncXvtoqO0umVf9d2vmwFfW9CJQt0n4rbgQn34/wob8fGYFNitJ/xZY02CEZ1FOyakf8x3/wQuQIzSL795VN9KJprMvqH61JqHp3cx8sUK8qAKzYGXL5ylIDwXqW4vd+joI9cnFGPQG2xPVUPSJepSzpAFctcDmzeQdLWZ0iu52azamzvbPUALtPh+agXWvWe8QE7JMWWKCoxgz2nmvjhA/gRmAC1VMChDxZzngX8lHhgeWpgJnVf479wMlaO3amuY5uLspYBqndq0mC0Y/yPAZ/4x0wyMzRRUo7dPVMafFqahS0I95zp9Agkw== 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=3QHQXE590QbF1LQgAOB974GEW0mJwFR11naEZuEi/Ig=; b=XONguAdF4DNj10vHjlfA2ATuZkwHs1Jm0DNq9bTxwkaQj3WVtQ54Cch6I8jmZG6PgrKuDpyMB0sRtjtjjN1iWMf3NtCO/UIRxoIxMKRki4j29O6B/YVZuiJxzyvMMi6cxL6uKIlgpQR60BD8aXxDeN3US7qQl/v8+VthSXSH5ZrwDMwWIZkyl10wUlfQxkOUHopz0c/J1aRs2rxGOR/CcKor9ljdDghfEYKaaLVC5pqDZTjV+KAkWXo1Au7ND7OoGsZZIVSoBZlb3YRQN6O8r2msYTBkqBqy4oqYJSUAzJY1MDtH1Lv/lhSwjFci1OxKwg5yFITpfgPUjFCXo1/v1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3QHQXE590QbF1LQgAOB974GEW0mJwFR11naEZuEi/Ig=; b=uVtP3nLtvtQeIi5CK1DXmj+I7wPXEkatEVM9Pme1/uCmkrgGtsHMfV/lWZa1DKx8gf49KiwlJAowwZL/A+4eTC5nIPRiUR8hbjqH9Gx4m61la9UOY/4eKOUkJmKhfi8yW0UKrZx0BF1fRN1AgAyYygXg28R75JadnoU4LzAhr1U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5672.namprd10.prod.outlook.com (2603:10b6:a03:3ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Sun, 8 May 2022 18:54:01 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:54:01 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 14/16] net: dsa: ocelot: add external ocelot switch control Date: Sun, 8 May 2022 11:53:11 -0700 Message-Id: <20220508185313.2222956-15-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 83ab2cb7-cbef-4f9c-0b9c-08da31241d6e X-MS-TrafficTypeDiagnostic: SJ0PR10MB5672: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: 9hl1TvUioJCz9cZrEKb8joM/B2xNYEWf4pqH8pk77mk5jm9GAS2D/VYc631/J7nzqkXo1wFoSX/pvuvF0LU63GX+GprsAp1K/i0H5FmyY1JKa6ZqZZSolQJGfng4HqXr3aPwIgZJO2RAKFkFKJbpRLzcgUnELEn9NpGG0EKjB9FK4SNHLDHytvOHC28pVPi7h6yjm2SuZcH2e6Lsq+RvaQE2t1fCXUGI22TLeJwv3T9ub+xse2VPZYQrSZW8S3AYjJ4GEz5mIC2P/NwZIETSt5rZ/541duIS8PN668nMfkBOzPqIPkG28oeCPsP2vYNxnXGNm0DRfYiLz881zzAmP97SZkn+EMxljDxLZ5L5LxPS4v65/2AKOlIWnoQIrdr+FMusn4p4G18JTvpeorzHxYDm8aRdXw5mr3f6qD6FfFy3L/5BXMEbCzcnLoptTs6OkiiIfVOOjZo8p22jcULhmmre4vx7yGX94eZqr/ZwvR9OOH4Eb6OCYzXJZ9H72uG5Ew8nQALJmXGlKKzBFq4j2bSFjCBBdXmErttLUQE3wDvZiSgoufZseOw2p3IvGsE1hSwBsjtuDYw3KlaP/7wka98Y9GhhIxcqKM+k21QfwPEvq5SnNLwIEMl/nzJZ2iMfGC4y9LEZD3RJeka7hW9Pjrwr5uVjCLScpJH2DZEfIHuab7BxmQeJ47tz+IcdrQdOvC3HxD8cEwP4aL2907A7kA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(396003)(39840400004)(366004)(346002)(376002)(136003)(6506007)(6666004)(6512007)(2906002)(8676002)(7416002)(52116002)(8936002)(4326008)(36756003)(5660300002)(86362001)(44832011)(66556008)(66476007)(26005)(30864003)(2616005)(66946007)(6486002)(508600001)(38350700002)(1076003)(38100700002)(54906003)(186003)(316002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0D0Z79gvdlYPLu++e8Z2E3kfFLjbf0vajN5qz/zcIrjrWUWCFIvS8qKuvALJloHSTWuv2Hf6MPchH8/9BsivU7QhbouDTCw53RAbfqxyH3RppJrHHog6h7JQI6vMMeQevx1zxu7r+PBwwah9+joCp33s3EB0sEoxpGVcjO0RVDiIijwBRbi7YHTDhXEkZ0L3AlswjdeQIFj/VfZLQcCFALqFuMkIOaIfEPRpI3N8SpjzQ5fgJTHW5UOAn8504+aNvoFbs8WN34XMIwkQLxXYF2shBhYTf/y57tC3H77FWNiGwOAmPnAyNM6uPu4wvVTT6/LP7z16ekZRFVJ25DiM3TdsP1V/JETBnao17KDqZBH+e7hHAlxcoIaC/lI1EWVXuTwO2P80Vdszeb5nXgEg6SXN/WkqIKWWjw+K1O5uRz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MW7R+aYnOQ3I0M5wVppD9qJA6QZiTTiyLmaZ/25lNRArHwsOIaCu62PQAyX0v/rcBOiNkWvCQk1SalXg+M391aOXOecNDyFEzsk02sG7g2DCUkBgrk4RW3tY+GCi9rvKH0BTTtZanuWDa2sRJ17qLTZvILPYAqHZaggY+f8AQHP2x4HiU9EWqIkhRqzFeKGAk6tALK1lcsvZMDcK7Abjn0CC3MM0mBj3uD634MBGb6JXtRO2RwlXqb6DQ0O+1JwpfEx9mCvj9+T8M92rWw2Ko1vFFarbCXjT+X X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83ab2cb7-cbef-4f9c-0b9c-08da31241d6e X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:54:01.1181 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7zCUPp3zce6s/FYHwduet0RIBlJTDGCmeh3xlSyIdPFztmlYPd42r3U7PNaFbPoi3jErlEX582aBDMjpDgkItRpbTk4Q5jZw37AAiWy5Wvk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5672 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Add control of an external VSC7512 chip by way of the ocelot-mfd interface. Currently the four copper phy ports are fully functional. Communication to external phys is also functional, but the SGMII / QSGMII interfaces are currently non-functional. Signed-off-by: Colin Foster --- drivers/mfd/ocelot-core.c | 3 + drivers/net/dsa/ocelot/Kconfig | 14 ++ drivers/net/dsa/ocelot/Makefile | 5 + drivers/net/dsa/ocelot/ocelot_ext.c | 368 ++++++++++++++++++++++++++++ include/soc/mscc/ocelot.h | 2 + 5 files changed, 392 insertions(+) create mode 100644 drivers/net/dsa/ocelot/ocelot_ext.c diff --git a/drivers/mfd/ocelot-core.c b/drivers/mfd/ocelot-core.c index 117028f7d845..c582b409a9f3 100644 --- a/drivers/mfd/ocelot-core.c +++ b/drivers/mfd/ocelot-core.c @@ -112,6 +112,9 @@ static const struct mfd_cell vsc7512_devs[] = { .of_compatible = "mscc,ocelot-miim", .num_resources = ARRAY_SIZE(vsc7512_miim1_resources), .resources = vsc7512_miim1_resources, + }, { + .name = "ocelot-ext-switch", + .of_compatible = "mscc,vsc7512-ext-switch", }, }; diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfig index 220b0b027b55..f40b2c7171ad 100644 --- a/drivers/net/dsa/ocelot/Kconfig +++ b/drivers/net/dsa/ocelot/Kconfig @@ -1,4 +1,18 @@ # SPDX-License-Identifier: GPL-2.0-only +config NET_DSA_MSCC_OCELOT_EXT + tristate "Ocelot External Ethernet switch support" + depends on NET_DSA && SPI + depends on NET_VENDOR_MICROSEMI + select MDIO_MSCC_MIIM + select MFD_OCELOT_CORE + select MSCC_OCELOT_SWITCH_LIB + select NET_DSA_TAG_OCELOT_8021Q + select NET_DSA_TAG_OCELOT + help + This driver supports the VSC7511, VSC7512, VSC7513 and VSC7514 chips + when controlled through SPI. It can be used with the Microsemi dev + boards and an external CPU or custom hardware. + config NET_DSA_MSCC_FELIX tristate "Ocelot / Felix Ethernet switch support" depends on NET_DSA && PCI diff --git a/drivers/net/dsa/ocelot/Makefile b/drivers/net/dsa/ocelot/Makefile index f6dd131e7491..d7f3f5a4461c 100644 --- a/drivers/net/dsa/ocelot/Makefile +++ b/drivers/net/dsa/ocelot/Makefile @@ -1,11 +1,16 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_NET_DSA_MSCC_FELIX) += mscc_felix.o +obj-$(CONFIG_NET_DSA_MSCC_OCELOT_EXT) += mscc_ocelot_ext.o obj-$(CONFIG_NET_DSA_MSCC_SEVILLE) += mscc_seville.o mscc_felix-objs := \ felix.o \ felix_vsc9959.o +mscc_ocelot_ext-objs := \ + felix.o \ + ocelot_ext.o + mscc_seville-objs := \ felix.o \ seville_vsc9953.o diff --git a/drivers/net/dsa/ocelot/ocelot_ext.c b/drivers/net/dsa/ocelot/ocelot_ext.c new file mode 100644 index 000000000000..ba924f6b8d12 --- /dev/null +++ b/drivers/net/dsa/ocelot/ocelot_ext.c @@ -0,0 +1,368 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright 2021-2022 Innovative Advantage Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "felix.h" + +#define VSC7512_NUM_PORTS 11 + +static const u32 vsc7512_port_modes[VSC7512_NUM_PORTS] = { + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_SGMII | OCELOT_PORT_MODE_QSGMII, + OCELOT_PORT_MODE_SGMII | OCELOT_PORT_MODE_QSGMII, + OCELOT_PORT_MODE_SGMII | OCELOT_PORT_MODE_QSGMII, + OCELOT_PORT_MODE_SGMII | OCELOT_PORT_MODE_QSGMII, + OCELOT_PORT_MODE_SGMII | OCELOT_PORT_MODE_QSGMII, + OCELOT_PORT_MODE_SGMII, + OCELOT_PORT_MODE_SGMII | OCELOT_PORT_MODE_QSGMII, +}; + +static const u32 vsc7512_gcb_regmap[] = { + REG(GCB_SOFT_RST, 0x0008), + REG(GCB_MIIM_MII_STATUS, 0x009c), + REG(GCB_PHY_PHY_CFG, 0x00f0), + REG(GCB_PHY_PHY_STAT, 0x00f4), +}; + +static const u32 *vsc7512_regmap[TARGET_MAX] = { + [ANA] = vsc7514_ana_regmap, + [QS] = vsc7514_qs_regmap, + [QSYS] = vsc7514_qsys_regmap, + [REW] = vsc7514_rew_regmap, + [SYS] = vsc7514_sys_regmap, + [S0] = vsc7514_vcap_regmap, + [S1] = vsc7514_vcap_regmap, + [S2] = vsc7514_vcap_regmap, + [PTP] = vsc7514_ptp_regmap, + [GCB] = vsc7512_gcb_regmap, + [DEV_GMII] = vsc7514_dev_gmii_regmap, +}; + +static void ocelot_ext_reset_phys(struct ocelot *ocelot) +{ + ocelot_write(ocelot, 0, GCB_PHY_PHY_CFG); + ocelot_write(ocelot, 0x1ff, GCB_PHY_PHY_CFG); + mdelay(500); +} + +static int ocelot_ext_reset(struct ocelot *ocelot) +{ + int retries = 100; + int err, val; + + ocelot_ext_reset_phys(ocelot); + + /* Initialize chip memories */ + err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1); + if (err) + return err; + + err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], 1); + if (err) + return err; + + /* MEM_INIT is a self-clearing bit. Wait for it to be clear (should be + * 100us) before enabling the switch core + */ + do { + msleep(1); + err = regmap_field_read(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], + &val); + if (err) + return err; + } while (val && --retries); + + if (!retries) + return -ETIMEDOUT; + + return regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1); +} + +static const struct ocelot_ops ocelot_ext_ops = { + .reset = ocelot_ext_reset, + .wm_enc = ocelot_wm_enc, + .wm_dec = ocelot_wm_dec, + .wm_stat = ocelot_wm_stat, + .port_to_netdev = felix_port_to_netdev, + .netdev_to_port = felix_netdev_to_port, +}; + +static const struct resource vsc7512_target_io_res[TARGET_MAX] = { + [ANA] = { + .start = 0x71880000, + .end = 0x7188ffff, + .name = "ana", + }, + [QS] = { + .start = 0x71080000, + .end = 0x710800ff, + .name = "qs", + }, + [QSYS] = { + .start = 0x71800000, + .end = 0x719fffff, + .name = "qsys", + }, + [REW] = { + .start = 0x71030000, + .end = 0x7103ffff, + .name = "rew", + }, + [SYS] = { + .start = 0x71010000, + .end = 0x7101ffff, + .name = "sys", + }, + [S0] = { + .start = 0x71040000, + .end = 0x710403ff, + .name = "s0", + }, + [S1] = { + .start = 0x71050000, + .end = 0x710503ff, + .name = "s1", + }, + [S2] = { + .start = 0x71060000, + .end = 0x710603ff, + .name = "s2", + }, + [GCB] = { + .start = 0x71070000, + .end = 0x7107022b, + .name = "devcpu_gcb", + }, +}; + +static const struct resource vsc7512_port_io_res[] = { + { + .start = 0x711e0000, + .end = 0x711effff, + .name = "port0", + }, + { + .start = 0x711f0000, + .end = 0x711fffff, + .name = "port1", + }, + { + .start = 0x71200000, + .end = 0x7120ffff, + .name = "port2", + }, + { + .start = 0x71210000, + .end = 0x7121ffff, + .name = "port3", + }, + { + .start = 0x71220000, + .end = 0x7122ffff, + .name = "port4", + }, + { + .start = 0x71230000, + .end = 0x7123ffff, + .name = "port5", + }, + { + .start = 0x71240000, + .end = 0x7124ffff, + .name = "port6", + }, + { + .start = 0x71250000, + .end = 0x7125ffff, + .name = "port7", + }, + { + .start = 0x71260000, + .end = 0x7126ffff, + .name = "port8", + }, + { + .start = 0x71270000, + .end = 0x7127ffff, + .name = "port9", + }, + { + .start = 0x71280000, + .end = 0x7128ffff, + .name = "port10", + }, +}; + +static void ocelot_ext_phylink_validate(struct ocelot *ocelot, int port, + unsigned long *supported, + struct phylink_link_state *state) +{ + struct ocelot_port *ocelot_port = ocelot->ports[port]; + + __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; + + if (state->interface != PHY_INTERFACE_MODE_NA && + state->interface != ocelot_port->phy_mode) { + bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); + return; + } + + phylink_set_port_modes(mask); + + phylink_set(mask, Pause); + phylink_set(mask, Autoneg); + phylink_set(mask, Asym_Pause); + phylink_set(mask, 10baseT_Half); + phylink_set(mask, 10baseT_Full); + phylink_set(mask, 100baseT_Half); + phylink_set(mask, 100baseT_Full); + phylink_set(mask, 1000baseT_Half); + phylink_set(mask, 1000baseT_Full); + + bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS); + bitmap_and(state->advertising, state->advertising, mask, + __ETHTOOL_LINK_MODE_MASK_NBITS); +} + +static struct regmap *ocelot_ext_regmap_init(struct ocelot *ocelot, + struct resource *res) +{ + return ocelot_init_regmap_from_resource(ocelot->dev, res); +} + +static const struct felix_info vsc7512_info = { + .target_io_res = vsc7512_target_io_res, + .port_io_res = vsc7512_port_io_res, + .regfields = vsc7514_regfields, + .map = vsc7512_regmap, + .ops = &ocelot_ext_ops, + .stats_layout = vsc7514_stats_layout, + .vcap = vsc7514_vcap_props, + .num_mact_rows = 1024, + .num_ports = VSC7512_NUM_PORTS, + .num_tx_queues = OCELOT_NUM_TC, + .phylink_validate = ocelot_ext_phylink_validate, + .port_modes = vsc7512_port_modes, + .init_regmap = ocelot_ext_regmap_init, +}; + +static int ocelot_ext_probe(struct platform_device *pdev) +{ + struct dsa_switch *ds; + struct ocelot *ocelot; + struct felix *felix; + struct device *dev; + int err; + + dev = &pdev->dev; + + felix = kzalloc(sizeof(*felix), GFP_KERNEL); + if (!felix) + return -ENOMEM; + + dev_set_drvdata(dev, felix); + + ocelot = &felix->ocelot; + ocelot->dev = dev; + + ocelot->num_flooding_pgids = 1; + + felix->info = &vsc7512_info; + + ds = kzalloc(sizeof(*ds), GFP_KERNEL); + if (!ds) { + err = -ENOMEM; + dev_err(dev, "Failed to allocate DSA switch\n"); + goto err_free_felix; + } + + ds->dev = dev; + ds->num_ports = felix->info->num_ports; + ds->num_tx_queues = felix->info->num_tx_queues; + + ds->ops = &felix_switch_ops; + ds->priv = ocelot; + felix->ds = ds; + felix->tag_proto = DSA_TAG_PROTO_OCELOT; + + err = dsa_register_switch(ds); + if (err) { + dev_err(dev, "Failed to register DSA switch: %d\n", err); + goto err_free_ds; + } + + return 0; + +err_free_ds: + kfree(ds); +err_free_felix: + kfree(felix); + return err; +} + +static int ocelot_ext_remove(struct platform_device *pdev) +{ + struct felix *felix = dev_get_drvdata(&pdev->dev); + + if (!felix) + return 0; + + dsa_unregister_switch(felix->ds); + + kfree(felix->ds); + kfree(felix); + + dev_set_drvdata(&pdev->dev, NULL); + + return 0; +} + +static void ocelot_ext_shutdown(struct platform_device *pdev) +{ + struct felix *felix = dev_get_drvdata(&pdev->dev); + + if (!felix) + return; + + dsa_switch_shutdown(felix->ds); + + dev_set_drvdata(&pdev->dev, NULL); +} + +const struct of_device_id ocelot_ext_switch_of_match[] = { + { .compatible = "mscc,vsc7512-ext-switch" }, + { }, +}; +MODULE_DEVICE_TABLE(of, ocelot_ext_switch_of_match); + +static struct platform_driver ocelot_ext_switch_driver = { + .driver = { + .name = "ocelot-ext-switch", + .of_match_table = of_match_ptr(ocelot_ext_switch_of_match), + }, + .probe = ocelot_ext_probe, + .remove = ocelot_ext_remove, + .shutdown = ocelot_ext_shutdown, +}; +module_platform_driver(ocelot_ext_switch_driver); + +MODULE_DESCRIPTION("External Ocelot Switch driver"); +MODULE_LICENSE("GPL"); diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 61888453f913..ade84e86741e 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -402,6 +402,8 @@ enum ocelot_reg { GCB_MIIM_MII_STATUS, GCB_MIIM_MII_CMD, GCB_MIIM_MII_DATA, + GCB_PHY_PHY_CFG, + GCB_PHY_PHY_STAT, DEV_CLOCK_CFG = DEV_GMII << TARGET_OFFSET, DEV_PORT_MISC, DEV_EVENTS, From patchwork Sun May 8 18:53:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842519 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B190C41535 for ; Sun, 8 May 2022 19:02:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234370AbiEHTGK (ORCPT ); Sun, 8 May 2022 15:06:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382586AbiEHS5z (ORCPT ); Sun, 8 May 2022 14:57:55 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2120.outbound.protection.outlook.com [40.107.220.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E427DBC08; Sun, 8 May 2022 11:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bpZKIv0NOMsR84cAethfKsjqu4r/8ioYJRCcodY1FygW9G5B41XudC5z9o0EGZ8xu5RTTEiZ36ZUwY606D5Y+XiJGPMa9lqIHHPNETZUPcNh33f4Lcxr8gLM6jMGu+IdWQEx4c0IQMlOGUA5pYEA4qy0fWrsDRE5AReJgnvtGfULQFew/aE/6QMEL63d34JJiPLnWAAeFvsO0a8orvLYBfD6TGrzX2Z3hOUO9stXMd2cU2tGhxuQJORY3vhVdK4p3+k7MVvMlyjUmLnP3j8/6spw+Wi+TaDYFvxIIyW9mJYFoIUWafCjbY1OCNEB04K9a4djbBHLMYzjnPmKg0guvg== 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=klkHYxiwmtQKjgQCKVSJBS52EVCMHgIGfrapPeWTcT0=; b=AqLLcQxfXG9gsuRp2ix4D7auGTf0b8OVjJA9WvxrJx+EM6OtpzoRQeCzBYcg4vFvS8xsdhpXsmYTpotNMF06ri05kNLoUmdyru1wtlRPo/EfKXkctvsu+LdKeg1XUSrbJU04au7wS4AqYpQSBoqOiB1IsngxsfbTVpWk/zS9Yk6I9tylIpXHMeyNy6QExEDIIMMkO+DRtxwmg5H7ybjyYPooktV8wYx3x3Il/kI4XiNx6LdvjnoX6XBu0yFKgCBYLL/HsXT1P4EpfYUV1dCazsHiXKBRl4ZmLAcz0MZyEzain+VlqgiCqwJBTgsjljJHcQMXV17V/CxJzmUgKY6fIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=klkHYxiwmtQKjgQCKVSJBS52EVCMHgIGfrapPeWTcT0=; b=SUDBOOoD36HmacAoYrEskyHhyPw0HmDvg/3gOlJhgfXBMm+DbPESHrZyNrQMa+DvsNswzeUyrSbrnF8s0mkHP4MKmy0xIHXM8ZiIAisvia1udCDeqOmDe7Ddtv0gdyHCgN1sNWPbsYyNXkMY+2ugTgKim3xDtFXkPrH0MeD3LGQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5672.namprd10.prod.outlook.com (2603:10b6:a03:3ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Sun, 8 May 2022 18:54:03 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:54:03 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 15/16] net: dsa: felix: add phylink_get_caps capability Date: Sun, 8 May 2022 11:53:12 -0700 Message-Id: <20220508185313.2222956-16-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c3f01866-f363-43fa-18c1-08da31241f08 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5672: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: Eto3a/SxddKm3CrpI3G1WHQlo4hieVpMWQ6yG6Im1MXbvKoThSyPFek5b8vo06B76rvtya+qUSj/OKsLZ6vX3WzdJnq32z+CtFGorRT8rgmr5bDchN8mRRkReswK75KISFHIpusuXCsrOyqhTurx0oMCEQFObYzR6LYA8xP76npejWxuFvBupVgx8UFZEH2egap+mMTfED49W/zX1hfRQOSpHW6CAu4e/O5a1BK/GUY8awmoE3dcmvp5xcAb3CzaAUp/qs2dmKCXr5uQiZASQtMQ8QGVJMI0GqiG1LQtCCsv+/OoeDw6MyKJXLKaD8kntdG19q0rLvLyDWQGZNw/IioXAeL5KTAZARe3VruUq5HMqDKoPvCJj4kN4Hb3YGyGuCLCVUynYkJMnZffKifpIeJ+94og9xU6/T4QjcS4xFenZN7Oc051vmaTR1yd4RHNkykZ2Hr6J3MPGQJFW8KE+njciQ+h8niWDF/drGqVifg7ew8L96HeoFWxWTRpJcXDweoCyK+mF4pD0un/1BR7c3bzkt5o3c6XD4XZ+zB5/KdGOFRdLMHsMo/Ugf/RJXO+g/dzHTtduob6oPuZ2E944SwhO097AUjEcLyYgAVQfYBKaPLqWr62xEm/aCAurC4/CmcCO3Phltb6HdukMHacRyfpbNxQ+k4+7ehNWZBmIIfos1ZoVEoXYwoNqrw7j3Lu X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(396003)(39840400004)(366004)(346002)(376002)(136003)(6506007)(6666004)(6512007)(2906002)(8676002)(7416002)(52116002)(8936002)(4326008)(36756003)(5660300002)(86362001)(44832011)(66556008)(66476007)(26005)(2616005)(66946007)(6486002)(508600001)(38350700002)(1076003)(38100700002)(54906003)(186003)(316002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r/l9BDHdkzOYCiaBY7c9tcmZUXIrZplRxgdjzXCYUL2ixCtHPaWcGiqed8PPpwki4HKJQffrFJkRpVlJeRVAK88812QEX8RsU+J63TCklzjCfRMX3ikNOfmf5FwpuBCGOZpfbbVMXoxm2dup9FxE+Qf3kbpv+cl3NSJJQ4P4v3Ll87tXG3oGPoan4cGHxsaQ9/Ewer39frzTRYkUP4DQ4ckkDShqTG4VglJsIVmel24T+Zq9FyP5y2kSobo9sMErxipvHrRn0hFDq8RQ+S77Z+IZt09YZGtUZ5luHL3AF2wvWBAOXwale8R5UccivshDd1QiCHJTo5YGSp9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ScuDIROExjpQUwvcrcL/n7PLIRZyjIlEsWAOt4wJ7IQPpEM14wfsew1tHb6jcJFFkRLy9NzjJ53o658IV3hQATyHNB3hk9tz9uHdUYB/iOTrmLxofZXGNtyprlcrGevBLz4s276UH+wM8ei0IgWNJdY/g2vtJFms2d8zEBlWiQDjE8fokMfHwIxVLNbZZA6hCtxWqELGqQ4Fu8swWcDVF00qoXaFguMTgSV2bomD67J+n5SJpx5L1FVsNNudfqfyTapNBbcUbftNoj1zvrDcseg5Uff6YsqOo/QZHT2OkF0yvEt7Dhfqgl93V3Aa+u8jwCkVRcqyPvPa2Ebb0IV5DRulpogb5q9RhHLYJ/XYY4Uw6v6sT1SeqE0Sf X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3f01866-f363-43fa-18c1-08da31241f08 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:54:03.7898 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Fmjs4E/dRn8eInOx55FW9timfPqiTSYwkZIQUGbEZ5wA6bmq2nZxmqKDYM1X2ALgG+vNrDJPlYC7/Gi3kaRSTzjwa2OBq7zT1JLP7SJMajk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5672 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Add the ability for felix users to announce their capabilities to DSA switches by way of phylink_get_caps. This will allow those users the ability to use phylink_generic_validate, which otherwise wouldn't be possible. Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/felix.c | 22 +++++++++++++++------- drivers/net/dsa/ocelot/felix.h | 2 ++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index d09408baaab7..32ed093f47c6 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -982,15 +982,23 @@ static void felix_phylink_get_caps(struct dsa_switch *ds, int port, struct phylink_config *config) { struct ocelot *ocelot = ds->priv; + struct felix *felix; - /* This driver does not make use of the speed, duplex, pause or the - * advertisement in its mac_config, so it is safe to mark this driver - * as non-legacy. - */ - config->legacy_pre_march2020 = false; + felix = ocelot_to_felix(ocelot); + + if (felix->info->phylink_get_caps) { + felix->info->phylink_get_caps(ocelot, port, config); + } else { - __set_bit(ocelot->ports[port]->phy_mode, - config->supported_interfaces); + /* This driver does not make use of the speed, duplex, pause or + * the advertisement in its mac_config, so it is safe to mark + * this driver as non-legacy. + */ + config->legacy_pre_march2020 = false; + + __set_bit(ocelot->ports[port]->phy_mode, + config->supported_interfaces); + } } static void felix_phylink_validate(struct dsa_switch *ds, int port, diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index 3ecac79bbf09..33281370f415 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -57,6 +57,8 @@ struct felix_info { u32 speed); struct regmap *(*init_regmap)(struct ocelot *ocelot, struct resource *res); + void (*phylink_get_caps)(struct ocelot *ocelot, int port, + struct phylink_config *pl_config); }; extern const struct dsa_switch_ops felix_switch_ops; From patchwork Sun May 8 18:53:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12842525 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AF91C433EF for ; Sun, 8 May 2022 19:03:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238547AbiEHTG2 (ORCPT ); Sun, 8 May 2022 15:06:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382591AbiEHS57 (ORCPT ); Sun, 8 May 2022 14:57:59 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2121.outbound.protection.outlook.com [40.107.220.121]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 407DBA1B1; Sun, 8 May 2022 11:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CmSCxyH6SAKFowbNHvTzujO3kOpPdQ97h1LQBMubWaLJu6zSYJOXMF1ZBm0mouSbA6huUJZ9iBGKlHdBacUcqMBhtDrRKADACbt0uLj82ETz6gYGzMkNE+2W9i0sXCtiVyvNvcfkqUuG0xSfB8n2AhabL8niuK8VpmN0+ckPyXmcjEmfMtjhXp1D2+3+DnIuvCV+1h/PdXoz3dg8GNYzjG32U72ojxTZczBQQvq/RrEGtHypbi0ciCy4CZhI2HSWNJ1BxQvO2FdPgWwc7XDyxCzJLMVfST3daX5h8fOOzMNcc9DtuKdQ5vF1yN2aG9/6RIJexOcMj0uGF3psW5Y07w== 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=tCWAhC6QRoHQ/yJ+qJzgN3nd8Njt4/Dh5tMExpj7Ch0=; b=G+iHqWmc5DuYFloPeIfFJVCw/jutPj0eTdY8Rv+9q3McsbJLmWBLBgaT/rQkv1l8zSM7Fsfi3Y33SdccaYUKVSG54gK8dvzlQ+i62fib+0EwLpHXeIYHWPkCdsWX7ImazLvkXQDrqhmXDrMS1LpUzOK5ShojNx7zLclXhus18Pk/InPDbBmBf50OKxJG5XQKHSE3O2I3eLzQbxqvl7qO8ZGBQKYuzSS1FUVMYe2G7QQkfH4n2eb9gbPEkROJytzn/aR01rg2zHzIIs2jgxqLQfxuw7GJNshU0q+bKfb1s/2jHLb9RN0Cq6usczqv+Csed1A3RyGQxLe1g6YpBRjrHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tCWAhC6QRoHQ/yJ+qJzgN3nd8Njt4/Dh5tMExpj7Ch0=; b=VFsgmw+mObROryC2WCfhLBxXTz1SFJeHNQ6tqHnDgJXkHGL0QOyNpvC2hYxA8EfrPBPNG93p00L07FvboHCSG6qHBeBVVIOhh8lkAdi7oPaVxCi3y7srcWtJS/x0jk3cqHzm/DCI3vTHGSgXm1ltpRuktWB88QuKE6zayDHblV8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by SJ0PR10MB5672.namprd10.prod.outlook.com (2603:10b6:a03:3ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Sun, 8 May 2022 18:54:06 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::4581:787c:1a7a:873e%3]) with mapi id 15.20.5227.020; Sun, 8 May 2022 18:54:06 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org Cc: Terry Bowman , Wolfram Sang , Andy Shevchenko , Steen Hegelund , Lars Povlsen , Linus Walleij , Russell King , Heiner Kallweit , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones Subject: [RFC v8 net-next 16/16] net: dsa: ocelot: utilize phylink_generic_validate Date: Sun, 8 May 2022 11:53:13 -0700 Message-Id: <20220508185313.2222956-17-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508185313.2222956-1-colin.foster@in-advantage.com> References: <20220508185313.2222956-1-colin.foster@in-advantage.com> X-ClientProxiedBy: SJ0PR03CA0045.namprd03.prod.outlook.com (2603:10b6:a03:33e::20) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fa5037e0-1617-4e36-3660-08da312420d4 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5672: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: Ma2jcAIxKTs+pGDH12EmsuFa0XWhrlEuSKsTyNCFRh1zSyBacMIQozDXGUdTv4sYJ0Ujw1rHakX1m9zmT9TzEL/sD3dx0TSYTmNRnYg0zX7l242z4/tLMTt/g/ph2zdosUfDIes8nr9ks6N09JJbSUkOKDQM46iMCLTopHeMhLjdeVt+WQ3/p4cYe1V46TD2VLf8pz2OHTsyKkgz0uzY6QmfKlwGKZplGFgRxbRJMrvaZM2XKoYC9tSNJb50983YWDkbpNy1f5CaACDgNQ8eWhfi23oMwlcYsne38XL/kH5jI43UMvr6NuP2a48LhhCDMlD9WM0oeQQmIcIcwH7gQlbZORgonMKMQDK29QwO8hiPakC2XpdGC/lbocCprqTHJkA86DGNMe8PWDyb+A6rWp7nrjJMUjCVN265Tuz/bh2Id3IfI/gxKHBDCyhpp7PCCJDfPvC0Hzt69Wc++NQ/+qD4OH1oPnNmElSzDrvCnK5HK2fvuf4bx/krm4bkR/YyfNzEwidvkgQ6ZJ7pBax+hIidhQ8Js4WlLQiKDNhIl9gyHbzvE1gxZKOyZW2djWpyzLDl/yHECuK3QvgdJmZMImHW40G051kCCUvLH10hqoRSRgFnyGDEMPxfVUG6G56Anxa/HGKQsgu6yO+2y9CdFOwdJCUueAySsaiDdxLJh/iKbTJmMazqUo3hmB11GeySS6M6BHexFjqm+QIep+C2vMv8GIwZC8mQj8ZN9lnPnMo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(396003)(39840400004)(366004)(346002)(376002)(136003)(6506007)(6666004)(6512007)(2906002)(8676002)(7416002)(52116002)(8936002)(4326008)(36756003)(5660300002)(86362001)(44832011)(66556008)(66476007)(26005)(2616005)(66946007)(6486002)(508600001)(38350700002)(1076003)(38100700002)(54906003)(186003)(316002)(83380400001)(41533002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IJnnNJ8n1EVk0hU37BRH0t8EpYvtCtkWkFe7I0RsCtCxB7NqqerZgqhIEPKVGr87zkZvWaLX13+7w5XWlTO7RJoZhFnm6kgkI9c4VJfEe5AiJuBFO1qZ3sk9NuM8bm5N+oPtTuEKwevWdAnBEIotyU17m9c1JNM+vLglLQHOHS9kJUc8yES4D63sUst7s0HozkM2z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1CmRQ+sz9tUWF8AoiRQXNvhX5EGSUrY+5OKm3K3+BECb2AXJGQEmoy0PpVedHx8KKLQODpSCVA74oqDfHDmUABBg3xW6i92ABptzjpoHh5HA0blSiNPu5TIs+EE+uuvkj5gKJpuBNMmnlKf2SmuuM8uMmohRKzoUwJBdD5iinq7IQhHUOCQBRf0Oo90jm+JABwqnm/NF66/0zpUcg04nE5Pr4GMdPpBMcaK6+Oh7y9kSxBYR5+WhhQL3YtxyRn+w3SRLd2LSf5ivb/I1/G2o6hQdBSyJOaaJ9+369xXd5HGgymYAAqWsqa8RqcR9aMp7NH29na8my1J662e2Xjs9R56+HKEQIg0rKELhyvuFbUjPHW2M3ER1ASyOkD0HIQoZS85U0AaKUgIji/z7tCMyqV+U+MpNYxaGEXsc+j8l0yDtT+34ZfrG/h2XOAOaK2H9N2oDIWcnplJoZd7yFnmd4cH00t88tWqyhhqpqJawzBcLwPhjV8yvfS141KMCEWhX7xTJd66oHZ X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa5037e0-1617-4e36-3660-08da312420d4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2022 18:54:06.7895 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jS3wv6iAeli+5bj+77iTvoc6MpckfMVri4IsKjYRtj7GArX7LqVmlbh9gTv8mcMOUpyjkBBv3L7V5Ah1R/LQYfObEXJS3KTrlvOKRLefuQ4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5672 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Utilize the phylink_generic_validate function to validate port interfaces and speeds. Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/ocelot_ext.c | 42 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/drivers/net/dsa/ocelot/ocelot_ext.c b/drivers/net/dsa/ocelot/ocelot_ext.c index ba924f6b8d12..21a85e95c217 100644 --- a/drivers/net/dsa/ocelot/ocelot_ext.c +++ b/drivers/net/dsa/ocelot/ocelot_ext.c @@ -215,31 +215,28 @@ static void ocelot_ext_phylink_validate(struct ocelot *ocelot, int port, unsigned long *supported, struct phylink_link_state *state) { - struct ocelot_port *ocelot_port = ocelot->ports[port]; + struct felix *felix = ocelot_to_felix(ocelot); + struct dsa_switch *ds = felix->ds; + struct phylink_config *pl_config; + struct dsa_port *dp; - __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; + dp = dsa_to_port(ds, port); + pl_config = &dp->pl_config; - if (state->interface != PHY_INTERFACE_MODE_NA && - state->interface != ocelot_port->phy_mode) { - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); - return; - } + phylink_generic_validate(pl_config, supported, state); +} + +static void ocelot_ext_phylink_get_caps(struct ocelot *ocelot, int port, + struct phylink_config *pl_config) +{ + struct felix *felix = ocelot_to_felix(ocelot); + + if (felix->info->port_modes[port] & OCELOT_PORT_MODE_INTERNAL) + __set_bit(PHY_INTERFACE_MODE_INTERNAL, + pl_config->supported_interfaces); - phylink_set_port_modes(mask); - - phylink_set(mask, Pause); - phylink_set(mask, Autoneg); - phylink_set(mask, Asym_Pause); - phylink_set(mask, 10baseT_Half); - phylink_set(mask, 10baseT_Full); - phylink_set(mask, 100baseT_Half); - phylink_set(mask, 100baseT_Full); - phylink_set(mask, 1000baseT_Half); - phylink_set(mask, 1000baseT_Full); - - bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS); - bitmap_and(state->advertising, state->advertising, mask, - __ETHTOOL_LINK_MODE_MASK_NBITS); + pl_config->mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE | MAC_10 | + MAC_100 | MAC_1000FD; } static struct regmap *ocelot_ext_regmap_init(struct ocelot *ocelot, @@ -262,6 +259,7 @@ static const struct felix_info vsc7512_info = { .phylink_validate = ocelot_ext_phylink_validate, .port_modes = vsc7512_port_modes, .init_regmap = ocelot_ext_regmap_init, + .phylink_get_caps = ocelot_ext_phylink_get_caps, }; static int ocelot_ext_probe(struct platform_device *pdev)