From patchwork Tue Nov 16 06:23:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621441 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55466C433EF for ; Tue, 16 Nov 2021 06:24:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 432B561251 for ; Tue, 16 Nov 2021 06:24:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230488AbhKPG1V (ORCPT ); Tue, 16 Nov 2021 01:27:21 -0500 Received: from mail-bn8nam12on2106.outbound.protection.outlook.com ([40.107.237.106]:43904 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230135AbhKPG0o (ORCPT ); Tue, 16 Nov 2021 01:26:44 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YA37jrLFLA8eybtMeilwJ6QjEXrnZJ+w8E94ZaFVg+M/7OAjmam9Y8nAvWn2FxkF2tC5ak6JMXQq8uXNqFcYEBjiajPS7VbZhaEcxpSopt0vWWgM2XVK0uGUzGB1/rm/gRt7361tpJr7NArO+Jh+KPiIO4gYq7/1te2QieoOoOwxlvHLcIcuuosJhCo6RS7IdECVLwx5sj+lfkuB84cD2S4I9LG154Q7lyxS+LhEPlNGSEGJ0bQwBt3RtdAJJv4BhOj48gAeD4SP8HyMcDKgYge+CJ7hsUSuls/7i10Tv6z/PL5RbBTNl3JPXp0gu9v0HV53nuCJhSzUIr/6rk7Uqg== 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=UOnO6hezclrIYdoOtco2dhlOh86vjDnOu9BuYW7qkIY=; b=TQd/Pguv+6ThK4jTedJxqtBoaUjGkDutnfdeNOJsttHZmoZcWoVbZkVnvSGGqmriGLHpGeh8w4zNbONd05/uNWubAljeuOujeix7+A042FbP+uhxjNS1gqhDi1CEQl6SZk5RC8E+84sPpiwh66D6H4V+duhrU67i3nFxqEChgqL7QXSJ0YUenHDNLtOTmu3cMq8oVNEKyCH/vFRJyyUVyQRAOUAmKwpgJyBx6ySWpfrsPr65poPq3GJ0Lq509NvYzTrMAMIakuZXBw5xdMJx8yfxI8gDJuZrCOMVjlUdruvNcDYq4axc6uEaolPJw5YYtrRiiV8QbHRoLv+IlafFxA== 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=UOnO6hezclrIYdoOtco2dhlOh86vjDnOu9BuYW7qkIY=; b=W/0n8VXZMkE7ZvhLeX+5fh9DTARiZG+eZDU4qKc2pVSDzLBxmXIoaXlCNA+rZm5LpNM7l+k3Hb4y5Eo0tGdA0h4B2QuWRms6acaG2oVtvZqDHtsYRHXBQcDGm2H6UWZWo/6wapDH5kTr3gVfpVi4lVZMYng8RXVwbF2Nyu1WaOo= 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 MWHPR1001MB2383.namprd10.prod.outlook.com (2603:10b6:301:31::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Tue, 16 Nov 2021 06:23:43 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:43 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 01/23] net: dsa: ocelot: remove unnecessary pci_bar variables Date: Mon, 15 Nov 2021 22:23:06 -0800 Message-Id: <20211116062328.1949151-2-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a8c00fa1-5892-431e-adcb-08d9a8c9a31d X-MS-TrafficTypeDiagnostic: MWHPR1001MB2383: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O6hZbWTvHHQ4504uhtVN5qIjmCQtsEl+BpYjf2wWX4Ykt/CKMFDcVI8JMZ4HomyXSJY5XVjnHUd29T+PtiSfrH1R+HPYWCAyVj7uCf5Mm+rL2lpI+2Z0lVy3VOhOoXZSHFKOx7SFvnGfdDQguMAaQqQG124Xa9b3J8UzvOAIgvPuOiOZnVEA5Ja9eAdq3Fe5T6GeJnPtkv/WE8mSnsESYcaELczr5K9ah+4jyUWGjCMnFlyMZtgwk6ybX7T7/lRfFku5gOm/xKkIgGzVlyvZ2CPQuFnGMyVtT2yHyXcJVal5mJl+cS2FUYYyBKT8syE3eLPECZTp/xUa52Da4SlSw9G7134x7ynQjlDSAB0bO389xO4F/LcZE1Mgwcac+eDhawMQQ9keOQXCxQj8EetUZxpcTkkls5Lfd6RNaOFOIftWoEJbsIXlHjWj3Yvd6A/XcoUV/IpbxVoHeW1lp6GXN+q46xbYqkn/sNkN6sy4RdvXbRcEcGxFb3ljUvigiD/9GFAmF9Muh0QJCfLYauFCVizukobzmRI1e0QWCDBkHZWYDKgjSy4roni3z+rFjvYg7rT4c3SdzCxB5pWVasP6kgDvl6nsTN61JNMBL+rShzMQcQBchOil3QNQNOmpC4zBMyEr2mMf8Ir1OdwT0C7wUvfJIykKowC9cd+lbili3JBwkQegBQtRO8ceH8cM0Fi3kmcSS/vpvdCVAlfLBh64Uw== 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:(376002)(39830400003)(136003)(366004)(346002)(396003)(6512007)(54906003)(316002)(4326008)(83380400001)(8676002)(86362001)(44832011)(1076003)(2906002)(66946007)(38100700002)(38350700002)(508600001)(956004)(26005)(66476007)(66556008)(6666004)(6486002)(6506007)(52116002)(5660300002)(36756003)(7416002)(8936002)(186003)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L+evD8vh1JGvX2DYFeyVZAZDXc2YBO05u9aRvAj1FAkwGTA/kAy7AU+72r4x7gCVK/DpjO+2tg0o1dMp5F3Z1XcZ0xRtRLhGXHYMDIEJJqGJRCeUhppaqnMB8hLJm6aTql9bT92nGD5MqpA7IUcegF5MxmUmcD+NKPdRtTalwdsX9hah79D9ldUhpNMS5lvVRNmecbN8xfTy4P3cJVh8zJxbj8kpYylaTfGVEY8ljvFX6Dw0ff3oF+qLHL/e7wEsRyetVI/LA7QwqW7GMtvvtizphbRMoDsYEqAdOyBDg/yunoYF/YQnf/OFjeXppAcKRVIyXqXkuA2/oe1aX4BM+fH56xxqR9av/GXwahVqqt5OHAUIIeZ/cAoTa9AcMQNrBGCB+FToOYR8oXAWCZ+ODpTuUZUe/mw9XESJ8iL88dSEORsIqO2azKHsC02vlxcO6E6M9s4T5ZjoBiiAZDbmDmgr4fSBC2EIpZT6My+Q8EHcmLmVa1xNp7mGJul6qEBRoGsHf5Hz5XJD1iW+Yv54EcAF4n8UbS5zlGZpWdrqPBKHs7gvPCpe7HJG8vgxUtaufu8hBM1qsO6D02znbiDOqiwiMUPmVKlZKNMzvAXnOVIx8V9UA+19G8qHsQ3InJBvOrYH/8pXIHrbW6wieQpjEBrlOpq08xLdiHgNyL324q0HJ9joT4QDjURHimmI4pwODPyDvW3itsU9ho+rowv4T2l/SkqJcUjhugF56/jATz6VYiW3dLNVi3u0JpRYybqKtTNQYmiuueHJ95HFXmKMTAjQv3qdSHcVyJCC4LqGx2MY5PPoB1rHELa2gexX8s+zyPeBiUanhTVFL7ULo4b5fyz58EMCqOYfgvAYopmVQMYZDnzeIT+OFVzhMZRmq0Emjytj6l/CXHiHlPO1T6ptcJTxpD+zjCIpxrVY1rOtvSSrI7LYT5lDc68lTYvpaKMTcnhUocnhdpY//7vmAL/H12hEbIaxKhCc5F5rYKARlSf9hnIc0j+bqHk2g2enpYCHeIIlxr5/TwiB+Y6W+yx/DfqeTjRtnQVUieIDSvqd7B1E+LIcdh1raMgGY+hiTouDY1tKaTywlSC1zDFDhrMtPSWRhDiJxpmZpLkvHD5o3zWPgWGWj9ZdfRCDFZBvfUdTNocTxAVWJ4SQfZqU85eQCTdzuutc+kXHw0u6/P1VWh2oDOHQkVEKxNNDdO0m2FwIHDj+EjVc0oNtVAGM7siwWMmo2cCNPfIMNHCX2vqoznw2xxCZMT4i66qI97DpNZb3k/oPeXdTP8iRjHdF2P0Vqxjm6hRIVLYn629+P5qqXRI2ZyBqa9AuT0D+ejjckOnZnsixU7ZSVKM/AW82bmdGxuCnOE4iNOgZnHEkPDYgxChRZjWOl7RgNPXP40VowSm53r4fagnn4Ef8/AKTtUd9x1glqU7H60uB3DNlRI2/u9NYX/dtOTz5246KFcvp5nzgskYib4kfUd9ulNDbByhwF9NlaZ3s8LSbAeNFDoJn8xbovYh54KiHGNAfJ+q0bba6T68B/i9UQf+JlJon7/DyySlv9PIj2UII7NSL3j6gfI2FE07T4CreHmqQbDF83PyCz7Z9y7gHU+FyyF6xY7VJtI2yEEP7Z3zAMJ+LGaMr2D6O5vRfmeHe6YVwgNeAgegQmzj5N26B0IIJoJvY9GojkFQe/FVyC6YfSqNzwIvRFc8= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8c00fa1-5892-431e-adcb-08d9a8c9a31d X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:43.0018 (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: 4piEpF/bV2Rowv3hbRjrwDj9z07GkF7esUds4RlXbIifn4bU2U3K2nx1vZbrx+9pPOMrDGQRFT4hDxZovfDrGnfDgZAOjqndZIaAl1/BFec= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2383 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC The pci_bar variables for the switch and imdio don't make sense for the generic felix driver. Moving them to felix_vsc9959 to limit scope and simplify the felix_info struct. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- drivers/net/dsa/ocelot/felix.h | 2 -- drivers/net/dsa/ocelot/felix_vsc9959.c | 11 +++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index be3e42e135c0..d7da307fc071 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -21,8 +21,6 @@ struct felix_info { int num_ports; int num_tx_queues; struct vcap_props *vcap; - int switch_pci_bar; - int imdio_pci_bar; const struct ptp_clock_info *ptp_caps; /* Some Ocelot switches are integrated into the SoC without the diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 45c5ec7a83ea..0b3ccfd54603 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1357,8 +1357,6 @@ static const struct felix_info felix_info_vsc9959 = { .num_mact_rows = 2048, .num_ports = 6, .num_tx_queues = OCELOT_NUM_TC, - .switch_pci_bar = 4, - .imdio_pci_bar = 0, .quirk_no_xtr_irq = true, .ptp_caps = &vsc9959_ptp_caps, .mdio_bus_alloc = vsc9959_mdio_bus_alloc, @@ -1386,6 +1384,9 @@ static irqreturn_t felix_irq_handler(int irq, void *data) return IRQ_HANDLED; } +#define VSC9959_SWITCH_PCI_BAR 4 +#define VSC9959_IMDIO_PCI_BAR 0 + static int felix_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { @@ -1417,10 +1418,8 @@ static int felix_pci_probe(struct pci_dev *pdev, ocelot->dev = &pdev->dev; ocelot->num_flooding_pgids = OCELOT_NUM_TC; felix->info = &felix_info_vsc9959; - felix->switch_base = pci_resource_start(pdev, - felix->info->switch_pci_bar); - felix->imdio_base = pci_resource_start(pdev, - felix->info->imdio_pci_bar); + felix->switch_base = pci_resource_start(pdev, VSC9959_SWITCH_PCI_BAR); + felix->imdio_base = pci_resource_start(pdev, VSC9959_IMDIO_PCI_BAR); pci_set_master(pdev); From patchwork Tue Nov 16 06:23:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621451 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C41DC433F5 for ; Tue, 16 Nov 2021 06:26:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16A2861C14 for ; Tue, 16 Nov 2021 06:26:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231764AbhKPG3J (ORCPT ); Tue, 16 Nov 2021 01:29:09 -0500 Received: from mail-bn8nam12on2108.outbound.protection.outlook.com ([40.107.237.108]:61728 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229945AbhKPG1R (ORCPT ); Tue, 16 Nov 2021 01:27:17 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UrWgF+wyaW/tK7LM1TE9u9X+pgRCo7xhGXrxfBrCQEqIjT1oI1GpdD3zoxZZktqfTLVWAOdru4EofYzOUWWl4tPZfHo3NpgL3wlh60hF03L0YNxDM1cPOpe2kI9CHUh4xrsny60v3XXf00QMeGWy5yttkJpC2/8s79Wdb0EOcIeGcs5AWbWusW9dlvdSSsKqwSHPO3CmPLjY8ug38vM6oNk8gg7S84hzMn9Blc5z8oIy+mGHrBtuP69ihbWdx6f4lXbNRhNFWIfXV0GITxlMMPvBzMy9i/cKRWjlc8s5673fhJIJYDrsJ7NQo3tQlcFO7yZm6tYvop2Kre0KCyNSEA== 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=VLZm14PaoFv/fWWguHry8auKUDqPRVRARNbV1Owv7hA=; b=CzSMn3zCGlhVJlcThsiSUMRUarPmkkfI6kdz4x3gkdxIbpOuc12arVcek5/kwEXhwl4Xs83tfAZrntp/+pYHY6zApO8HiBBl+p99UBjIlAGVupRaPiJce82OnTjwVAoAXk/GzIwYjBim2XCyV0i/voKR2ndBVVMMwLAmAC6OWYWwQfg4g+k/qBOUXwcEVN1xk0LUlQUK1jVhzE9izrfxbf6gY0k7bJ4jNb1uvhV153fUqfuHcDxLnd90+hyKwqU0Ng4z7wKyTEyNxbonxvB5mCs+LrRK/UB/JwOVolhsL76nxT8KcXxM2ubTMJB8PhMIh0QASNvsFTIcUaQfppoXPQ== 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=VLZm14PaoFv/fWWguHry8auKUDqPRVRARNbV1Owv7hA=; b=s2RW6pWIIpaHpp/3u1oLFB1xw60akPLZKEB8gJmhseSPymWCYNmy55BmRxC4yo0fYe/5FHPrOP7WQB7+CYCpG4RbqWG/5ZrnEr7+rwlSvOPE3Qa4CTr8By2GOkfYh6VaWIwEbUlIhA9TlE+ZynILRomVrNIU9n5IoIoe5HUxde8= 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 MWHPR1001MB2383.namprd10.prod.outlook.com (2603:10b6:301:31::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Tue, 16 Nov 2021 06:23:44 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:44 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 02/23] net: mdio: mscc-miim: convert to a regmap implementation Date: Mon, 15 Nov 2021 22:23:07 -0800 Message-Id: <20211116062328.1949151-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8c9536c5-fb5c-4f91-23af-08d9a8c9a38f X-MS-TrafficTypeDiagnostic: MWHPR1001MB2383: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:655; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 29nSh9+IdhNi598BX5yn4bPiFzmniyrsrLV4DT65N0z1Z03uKnPbvWLJPMx7SgyRpG67WaC6HCiv9/jgW9keVRaltHGjO511ajbSsm9OI6t6tYkDXUoGKyWj+EcEmWbBKM+uuuXpN1friS+0Ign8R2muj93RuKcqMKgYVGCnuHjqzEVElmxf5wca5c7k8AKdZkHSaDWnHZ1IC20sMRVgZcD+rZwoLznZhoPhBxT67RWi5m600z4xIZ2ALhaXjg4ukP0tRgA4b5Vu1lLAeZSkeIX3hzF7sXYlJr8ZQ9xsNr5rssTfmVMeo1+g7xbE4TyGhhDJP9cFL+43hWBw5Lqr+rmSc1HehzmO7AA1aTSHpcw/UZeYX7cGZqmLNejZf9xI6LTg3OZ8sAkGNK5yFeUl5lNQWrDSF/MqrdnZ2ZYtlmXETr8Yxkme+GzBk6adOixWcpGrNGenSs0dGwkmxurbbWJT6qlMzCpL8/ssDDmECit4/qzwwgxJEY6Bzr3O3faYaSz6DIbfOeXy8YPuZVLfa60SRMAzaAvM4B7Qr1+EWsSAIWhtdHnVjh/aAODb6pkzMayb7Bbonaqgo6U5Fsy37wR4in3v7o17XRfrbH4RhXGk4YRJlEuzdr8hy0IVgc10X43ckYm2v0AQ7TONPVXiYBORbvO7zdIebszT56NvNm4kgWn7v9U15h+Lnlet4ftBr4t433ZOBTVJ1prHzXEXIA== 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:(376002)(39840400004)(136003)(366004)(346002)(396003)(6512007)(54906003)(316002)(4326008)(83380400001)(8676002)(86362001)(44832011)(1076003)(2906002)(66946007)(38100700002)(38350700002)(508600001)(956004)(26005)(66476007)(66556008)(6666004)(6486002)(6506007)(52116002)(5660300002)(36756003)(7416002)(8936002)(186003)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wOYyiHBg4OpsD+5Tc04k/cQnCf8x3X7oc8yLQeOPFy8lyoQz2vd7/XBsqjUCQZ2rJq0wIJhIEB1GIS8s2931gkvrdwVU9hJqOCBJvpAGcSeL8m2hF+ytcpnlFxk7bDN2rTI5wMnQqW+I5EP6ivA17j5cc5W0FwKyWNZ50y+mBh2QhxEKDMFEJ3bO0r5ACP/J2NlvHXaILE8mr974X/weYmxyQUUeF1cNMgaADKW34u2SMwrPn54xS8Xnfixzu6ML/TCmpsjW/ZHqlfLZqDiPzK7Wz6r2ErSglR0uCXtW+/SKUWOEJ/qEKrdhIdv532jNt6QVuFm777nN21eBPdlTD1AUDhrelNvuQYd/ae0HISv1GtOIMNEC71QXBT2+zT6xmOACPb7f5jzRN9vHI9oW/kutAfssIwgRZVGpf+H5es6CYlm18Ky21g36b3xwtyrAFHZqPWr/HMRzKeJDPM8wrqq70tDfeGFx7i6CfvPYLzA06En74mhV4t+ljSA/XcOx3FxfjJFKOFPKUD/RhHwAjWCbZJOjukT12xeLtx/GS6nVOUgLim5FsgIDUwLMwsa25Qjvs6N9E0G+cFbXOR3SiZcKq38ubjJZq3twztRlIZD0XFS2vm+qjPVFowZVDGfyxRYZFaZI3DnqB//lievxb+gTlJoW5TabDWl3Wa7CxpS+RQRRUNP/wze+vqipK/ovxqYcv9NQ2HzjYP0q2xtmuFQ04JaXoFaHcEFYNHINMtAiv0YJY10mk9GJY3HXfIwSSvninCHE0kpN60JsNXhItpunQP3QSKhWUBzkpkQj++lhhGjPrx92hdK+rnmshFbsXTrRg0ZT6ljkOadQcDCu9K0fIhIA4KQlA8Qy1SGiWXnykJD84FVuPrKsPJ5BRq87gMqKojhlUxRpMkiSK8f6wsSL9eoDIfobPNx0aa+yrGbhN5t4RDxXcr6DlBn92n1tm6TGzplQ0Ty2BB3s3mwZY+vb8vsXcTPBJk0nYqqPSgSIBwEJ9B1sedETzHwwLYirUOlou99ONwnA9hsPvbcQdpJIkpQ6PBsLOo/c0/jTUKH9wuihWlAREJdyL+CSG098HpD8NOkHkrQAz2ax9XIbyc/XW2nf02OT6H8BZqkYHJpARQJCfUMZCZwg3HOLFtX7PLAP60Za/MfrTgaWcDzdKAgJtm3cNXltmt8jKySx7M+qgXofNZ9J6CyFdSt9QDc0co2uOaBbFwUglfQEcEBPLjRpNIdWCyrgzm304YWs9qw3oo5yfzCBVYU4/CqvbWVLs0iTlwFlB6fw/Y8QvPMqtUta6Iyr0HxHi/rk2oVGZ29jTolqybr0JTFccMK7a970K1MNSv2rX2hEKQu1J9jB7QPkAiS0k5lerKO93PjJ7Ss19za23lT6VT6dMGt30avo51bAjuceJQpKhb7mZg2fsl9HhjflJkDhBhCp6S5jwwasWl3dAxmbugQPI8BFErPntzZSeOg4/UTbB+tdOfSYjtpw5pqbdAamCWL06F+fLW4RsVE2h3va6UmrTPtEK2QkFwTtZdWu5tbbVU4C3hBm/UkxFbsmH9qYXMKDjXPfIeiUyJKnLgEIbKkGRE/BvQKjnI5diHb4fxLUfja+BBVw6Og8Zb/G088xWkFIfWy9e4dxlw8tVaC3mrplIyC6Tu4AbNoIsavZaK0KrOCOxwiUyY1FDuPwbabQydRMhTCkMcw= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c9536c5-fb5c-4f91-23af-08d9a8c9a38f X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:43.7474 (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: IAI4vqOp7L33bZD3jCoXNJKdM5CAcoK8PARKnoMX1hfb45/itZH+75lYrHO6jLhkVz6fdTQxGb8XLmhFrAWKISnqyUKzaMhjDm1WHzAexGw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2383 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Utilize regmap instead of __iomem to perform indirect mdio access. This will allow for custom regmaps to be used by way of the mscc_miim_setup function. Signed-off-by: Colin Foster --- drivers/net/mdio/mdio-mscc-miim.c | 148 +++++++++++++++++++++--------- 1 file changed, 105 insertions(+), 43 deletions(-) diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c index 17f98f609ec8..ea599b980bbf 100644 --- a/drivers/net/mdio/mdio-mscc-miim.c +++ b/drivers/net/mdio/mdio-mscc-miim.c @@ -14,6 +14,7 @@ #include #include #include +#include #define MSCC_MIIM_REG_STATUS 0x0 #define MSCC_MIIM_STATUS_STAT_PENDING BIT(2) @@ -35,37 +36,47 @@ #define MSCC_PHY_REG_PHY_STATUS 0x4 struct mscc_miim_dev { - void __iomem *regs; - void __iomem *phy_regs; + struct regmap *regs; + struct regmap *phy_regs; }; /* When high resolution timers aren't built-in: we can't use usleep_range() as * we would sleep way too long. Use udelay() instead. */ -#define mscc_readl_poll_timeout(addr, val, cond, delay_us, timeout_us) \ -({ \ - if (!IS_ENABLED(CONFIG_HIGH_RES_TIMERS)) \ - readl_poll_timeout_atomic(addr, val, cond, delay_us, \ - timeout_us); \ - readl_poll_timeout(addr, val, cond, delay_us, timeout_us); \ +#define mscc_readx_poll_timeout(op, addr, val, cond, delay_us, timeout_us)\ +({ \ + if (!IS_ENABLED(CONFIG_HIGH_RES_TIMERS)) \ + readx_poll_timeout_atomic(op, addr, val, cond, delay_us, \ + timeout_us); \ + readx_poll_timeout(op, addr, val, cond, delay_us, timeout_us); \ }) -static int mscc_miim_wait_ready(struct mii_bus *bus) +static int mscc_miim_status(struct mii_bus *bus) { struct mscc_miim_dev *miim = bus->priv; + int val, err; + + err = regmap_read(miim->regs, MSCC_MIIM_REG_STATUS, &val); + if (err < 0) + WARN_ONCE(1, "mscc miim status read error %d\n", err); + + return val; +} + +static int mscc_miim_wait_ready(struct mii_bus *bus) +{ u32 val; - return mscc_readl_poll_timeout(miim->regs + MSCC_MIIM_REG_STATUS, val, + return mscc_readx_poll_timeout(mscc_miim_status, bus, val, !(val & MSCC_MIIM_STATUS_STAT_BUSY), 50, 10000); } static int mscc_miim_wait_pending(struct mii_bus *bus) { - struct mscc_miim_dev *miim = bus->priv; u32 val; - return mscc_readl_poll_timeout(miim->regs + MSCC_MIIM_REG_STATUS, val, + return mscc_readx_poll_timeout(mscc_miim_status, bus, val, !(val & MSCC_MIIM_STATUS_STAT_PENDING), 50, 10000); } @@ -73,22 +84,30 @@ static int mscc_miim_wait_pending(struct mii_bus *bus) static int mscc_miim_read(struct mii_bus *bus, int mii_id, int regnum) { struct mscc_miim_dev *miim = bus->priv; + int ret, err; u32 val; - int ret; ret = mscc_miim_wait_pending(bus); if (ret) goto out; - writel(MSCC_MIIM_CMD_VLD | (mii_id << MSCC_MIIM_CMD_PHYAD_SHIFT) | - (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) | MSCC_MIIM_CMD_OPR_READ, - miim->regs + MSCC_MIIM_REG_CMD); + err = regmap_write(miim->regs, MSCC_MIIM_REG_CMD, MSCC_MIIM_CMD_VLD | + (mii_id << MSCC_MIIM_CMD_PHYAD_SHIFT) | + (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) | + MSCC_MIIM_CMD_OPR_READ); + + if (err < 0) + WARN_ONCE(1, "mscc miim write cmd reg error %d\n", err); ret = mscc_miim_wait_ready(bus); if (ret) goto out; - val = readl(miim->regs + MSCC_MIIM_REG_DATA); + err = regmap_read(miim->regs, MSCC_MIIM_REG_DATA, &val); + + if (err < 0) + WARN_ONCE(1, "mscc miim read data reg error %d\n", err); + if (val & MSCC_MIIM_DATA_ERROR) { ret = -EIO; goto out; @@ -103,18 +122,20 @@ static int mscc_miim_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) { struct mscc_miim_dev *miim = bus->priv; - int ret; + int err, ret; ret = mscc_miim_wait_pending(bus); if (ret < 0) goto out; - writel(MSCC_MIIM_CMD_VLD | (mii_id << MSCC_MIIM_CMD_PHYAD_SHIFT) | - (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) | - (value << MSCC_MIIM_CMD_WRDATA_SHIFT) | - MSCC_MIIM_CMD_OPR_WRITE, - miim->regs + MSCC_MIIM_REG_CMD); + err = regmap_write(miim->regs, MSCC_MIIM_REG_CMD, MSCC_MIIM_CMD_VLD | + (mii_id << MSCC_MIIM_CMD_PHYAD_SHIFT) | + (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) | + (value << MSCC_MIIM_CMD_WRDATA_SHIFT) | + MSCC_MIIM_CMD_OPR_WRITE); + if (err < 0) + WARN_ONCE(1, "mscc miim write error %d\n", err); out: return ret; } @@ -122,24 +143,37 @@ static int mscc_miim_write(struct mii_bus *bus, int mii_id, static int mscc_miim_reset(struct mii_bus *bus) { struct mscc_miim_dev *miim = bus->priv; + int err; if (miim->phy_regs) { - writel(0, miim->phy_regs + MSCC_PHY_REG_PHY_CFG); - writel(0x1ff, miim->phy_regs + MSCC_PHY_REG_PHY_CFG); + err = regmap_write(miim->phy_regs, MSCC_PHY_REG_PHY_CFG, 0); + if (err < 0) + WARN_ONCE(1, "mscc reset set error %d\n", err); + + err = regmap_write(miim->phy_regs, MSCC_PHY_REG_PHY_CFG, 0x1ff); + if (err < 0) + WARN_ONCE(1, "mscc reset clear error %d\n", err); + mdelay(500); } return 0; } -static int mscc_miim_probe(struct platform_device *pdev) +static const struct regmap_config mscc_miim_regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + +static int mscc_miim_setup(struct device *dev, struct mii_bus *bus, + struct regmap *mii_regmap, struct regmap *phy_regmap) { - struct mscc_miim_dev *dev; - struct resource *res; + struct mscc_miim_dev *miim; struct mii_bus *bus; int ret; - bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*dev)); + bus = devm_mdiobus_alloc_size(dev, sizeof(*miim)); if (!bus) return -ENOMEM; @@ -147,26 +181,54 @@ static int mscc_miim_probe(struct platform_device *pdev) bus->read = mscc_miim_read; bus->write = mscc_miim_write; bus->reset = mscc_miim_reset; - snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(&pdev->dev)); - bus->parent = &pdev->dev; + snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(dev)); + bus->parent = dev; + + miim = bus->priv; + + miim->regs = mii_regmap; + miim->phy_regs = phy_regmap; + + return 0; +} + +static int mscc_miim_probe(struct platform_device *pdev) +{ + struct regmap *mii_regmap, *phy_regmap; + void __iomem *regs, *phy_regs; + struct mscc_miim_dev *dev; + struct mii_bus *bus; + int ret; - dev = bus->priv; - dev->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); - if (IS_ERR(dev->regs)) { + regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); + if (IS_ERR(regs)) { dev_err(&pdev->dev, "Unable to map MIIM registers\n"); - return PTR_ERR(dev->regs); + return PTR_ERR(regs); } - /* This resource is optional */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (res) { - dev->phy_regs = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(dev->phy_regs)) { - dev_err(&pdev->dev, "Unable to map internal phy registers\n"); - return PTR_ERR(dev->phy_regs); - } + mii_regmap = devm_regmap_init_mmio(&pdev->dev, regs, + &mscc_miim_regmap_config); + + if (IS_ERR(mii_regmap)) { + dev_err(&pdev->dev, "Unable to create MIIM regmap\n"); + return PTR_ERR(mii_regmap); } + phy_regs = devm_platform_ioremap_resource(pdev, 1); + if (IS_ERR(dev->phy_regs)) { + dev_err(&pdev->dev, "Unable to map internal phy registers\n"); + return PTR_ERR(dev->phy_regs); + } + + phy_regmap = devm_regmap_init_mmio(&pdev->dev, phy_regs, + &mscc_miim_regmap_config); + if (IS_ERR(phy_regmap)) { + dev_err(&pdev->dev, "Unable to create phy register regmap\n"); + return PTR_ERR(dev->phy_regs); + } + + mscc_miim_setup(&pdev->dev, bus, mii_regmap, phy_regmap); + ret = of_mdiobus_register(bus, pdev->dev.of_node); if (ret < 0) { dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret); From patchwork Tue Nov 16 06:23:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621459 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04139C43217 for ; Tue, 16 Nov 2021 06:26:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E253D6115B for ; Tue, 16 Nov 2021 06:26:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231993AbhKPG3k (ORCPT ); Tue, 16 Nov 2021 01:29:40 -0500 Received: from mail-bn8nam12on2106.outbound.protection.outlook.com ([40.107.237.106]:43904 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230448AbhKPG1U (ORCPT ); Tue, 16 Nov 2021 01:27:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y23ZrD9hs65Mukg6TXkwpw2I1kjjjF5DZtLg9/Dg9RMB3wk9uTQKU/wk4GODQ9vzPcUnQdN7JHdo0W2jeiHgTrRZcIuh5bBG9UXdc7iPwiTAO1kUdshbIBhDwIelcDJuCjOFY0aHV0YxlvKuZobk4EFGYwtH/5wPfSaIiBvjWnZ26X2WkIyXolKW1Uw7u9LeorXRKvU/23FUYfUSEbf0TWZh8VJ6F4RfTI5LdOQ4kC0tS/gvfjiH0AJ6ZTztiBMlU4f32z6GEaqpiQfkVaWBPws+G3jmNybWkQvaTHNotTJmnoWzp4qdGQwg91gs6W7jZc1GWUwaDm7HgKgB+7xtuw== 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=ugxxeNhoCd+QUZYaL+ZQni1pVGcyQnP46C2Xz/dU7Qc=; b=eEwLv3E1utaoUV+SsghgrWWydFDg6/lq0btVXYAjbjoevVw62i+AhY7xBnbLfDHZS4+yNbnN/umnnCwM3GguGa5DR4825YYP8vpp+a3SifREB0Xbki8q8dkCV4BZiPIIeGGNghNwJxZ+4DdkPehWeGvCV8eMjjlQTnX2v1XmXP3ifJ1XF1IEn0iFfWMA7g4jGN069V1t3xssNRxE1tC3sGevYuBmdVguQA9YYUiU9/2sohLn4d2SbtfLdrikVueEk599FmsO2zwZXS7183jULpCi9ovQgpBrtIyy+PNdBV+SnCt+oCS0e3U3CTN/lAA+e4tK5j2LVHmqPbMbNsj0/w== 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=ugxxeNhoCd+QUZYaL+ZQni1pVGcyQnP46C2Xz/dU7Qc=; b=0aRBOEUEljkV18D5LvBBe6zmbk35ashwsYAg5Wn6RVD/3rbZCSxjeVYCq/4pEwOvznQ1AUPmXYo1yO09PK/iYJzE+hYO9vTupleRuaScCoATKW5yW5A3M3s+CHfkCmuqGhmj0ldD2mc+q96hTGev2aRA142dyiXAmP+wTzhg8gs= 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 MWHPR1001MB2383.namprd10.prod.outlook.com (2603:10b6:301:31::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Tue, 16 Nov 2021 06:23:44 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:44 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 03/23] net: dsa: ocelot: seville: utilize of_mdiobus_register Date: Mon, 15 Nov 2021 22:23:08 -0800 Message-Id: <20211116062328.1949151-4-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a649a4a5-e780-4c6a-4f53-08d9a8c9a407 X-MS-TrafficTypeDiagnostic: MWHPR1001MB2383: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b0GlSwoXlp7i+BIfXxIgq6pvs5zRc4EO1fzVHTa9mcuBRXZwDWw9Sm8JnvkEvtGC5YfJgcLSZQc7BJ6KW15Wsebhdv9b0nELuECC60/Ff8jQwhAjDxqtuppaqiUdonpvpOLvdjwgZhfbYiQtgCYS/OaupuMrV32DdPWbF0raVbgMPogC+0+Uofeuz6SF1t+B3g+poOK8vwGlslNE/z8Saj9gXaURGiAExRLo1hYnjWo6jkle3aFPOnAGwNhAJPFurVejt7BGp6llRJ55SibgTVKwPtl6mwZG4ELsmQ+YR+zz0482o1SAfiCwZ3dxeWrjKotK8EqWunmd8Ur0MM8v2NHrpnVZeiQnxHBloxJQ03pX2scb87VVxtojVZbYw1z9rfIOXCXOXRuBsvHXqpu4REySeadQ7tfb178t/Xb8VFouFTfEAO0x2awbDLjmyq2NHJRZzvcu8hDqAwsg7oCoQ1VklQIPVtWy1m3IAB1fGzCg0mAd2cH+XwhBqeXRN1pWJYZI5m/EG29Xq2tCH7iBwCocEvnBbls5xhtXDU4cAeVz3QlKAdbLh5GWx0FUb4mlTfbeVDuVKw5CwhxVAmut/cllV0pUkxEqZxwYuRMkheSpm1MmSCoHoh9PWw2FjxlOONgmd2bSwUM5L04mUStIupfmJxOnDB0ENZpb3HdjxeRy3xVJ5oBtAdyUFU5TfLO0uNCfHgFT+U15tTS3g9vigQ== 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:(376002)(39840400004)(136003)(366004)(346002)(396003)(6512007)(54906003)(316002)(4326008)(83380400001)(8676002)(86362001)(44832011)(1076003)(2906002)(66946007)(38100700002)(38350700002)(508600001)(956004)(26005)(66476007)(66556008)(6666004)(4744005)(6486002)(6506007)(52116002)(5660300002)(36756003)(7416002)(8936002)(186003)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2wrIoONKNu/wsTJYkqneW4X9lPOLx5TzJVBZiRz6S3AsVAM6aqAPSzFcASg83RqDMw3oidDNRJDTnXsSB3PRQ6RqAuHJ4RZxkyrxxXAXgsmx9rkDLrBLY8YXbc9cdF1oj8d1VLoIbfhTinAxvRe/K8tCbJMq6QyKXNLNk5VM2DLMVwr3IyWJIMXBFXhBZMxN0RgVkvp99oIp1RuZlhtBDKECzC/ylNXgTCkWo3jPK2B9QIqQdvU5kvz+xX11LLGLXW4bE4hEKh7ewROXhwqQiSxpjmQO/lK1MOk1ignyNspT2ZX197PeYDpjqPFodsmQPngxAsUHEVXp6BZVJD4t9nEgWVRPwJq6m1q0PVHTJ27h8VwDXhNWufvjo6N3eRV+ysgBtW0kpojPwUUBlrxzUsjLp+hyq5ZFfrAhnRln8A7cVeEur6MAXzn0ZoiH26di6NGN/68I/LSnpaHoTIk5vcCAtvSNeUlVOmr/D8s6giuUVuwY3bpbvgDIZ0iY3gaBcid/Ewn+9fgdfBkUh6LoEpnwJyEgfEPQB2Ajt0MwbyLBpD7WaAiVFsXIyt0CKsl0hmEdjPOysYtyqZvhdoNTqHCwhLtO3jZ3nmo8anXhjPLDo5tPXUGtY98r9ADxr6hAoCmbbmf2mbJOdoqbHbppfzvXi/S+e8vfsgx+fQVRbi2xOvBaLvduSPYTBoC2O22vvwRRhG4A15Fx9QDGF/oc5DmPI8bC4arCiFQ+iqx0YudRE/fGopBluW1wmMwrgTsekRI5PBSBqg8hF5cNNScqBqeGPIZsXktvqcrsgJ19B8OQPWptwzqyDaZANX7hQDSGjn7hseOlBWj5T2UFiI7u0/aXekBsLbogPYL3e/wY3rY5a1HGWbgJ4gwB3gmmQVtGH8zLqDyEEYTFlmnCrMEqtqQO6/Yo9B7irALNxW/jdO5EcgcNQXoDZYgDg0TLf5xBGQxyr/Q7WWXCYlooHyW1CWCzi67lCg319JvGw6kkAhJ6oNhZVfSNVaaFdIJmq7clWnzQYtFlO6OJNyp/1z5//+mWapnJd8RPSLxRsVBjDsCgUlNOvVLPZqolHbl+CHpRlxSQ/SOiWRnWb8b2N1XwCQ2dk5R800ONrV5ACxYqHUqJQdXXfNjBgXcLZDPYY5707Nm+KHdDHsODXjoNOAJll0DdQRfDvEhvKwMy3yDwVu7HFFXlgpg8ntbvfhEqTChgLBLb4wNkQRa9R4+XEyWA+W0btUSG/JymYPgSahg9VePzaYViyU0cEYaPCc/75LePENcsxSUXVsxCkaiY7BFgxTK/r5/e0+FBJx5fmK6fUpobS68ZJxao68b+IydG1GD3jOa2UpPMXOIOX6XKMspE3e51wuirzafZSsgrQbRDp9Bt/manherk5FvXk2jjo9rLhtX8T9urNOqE3nuS+xhDlb7kFvCWuyBIuATcdU0zIUOMz248L/ov4xUABAv/+dCTxJzt51Sike8drB2nm6KcSRFtV8Oe1rEkCWgdIKNyEkHHpLrm/Tuz2Dxm8xLH8uNN5chwZ+XYFhRinsFgUZi9y9tBG5k6xtf6ncgMVqkgGgo/Jtu7X9BPQVF2j/7NMsyylUOF5tHgB8ltmckHUSg9CiPiFXrQlwFGi2UlWgts2mNLJwzG6Z23wtvtOKrUIq1ERRJGMkkNJLPPWLuTCwatqvtweWBTeYzB0zCTWRbEdug= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: a649a4a5-e780-4c6a-4f53-08d9a8c9a407 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:44.5300 (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: LzVNENqOEH+iJQH7AnbpwWZQaODwG8DqGgtRAVqNQLh/71pxUTez9VEkxEh1+tWbM+NU8mioBGI2gdyNSK8G/BtJHSvmtEEyh88TJNJmnrg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2383 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Switch seville to use of_mdiobus_register(bus, NULL) instead of just mdiobus_register. This code is about to be pulled into a separate module that can optionally define ports by the device_node. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- drivers/net/dsa/ocelot/seville_vsc9953.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 92eae63150ea..84681642d237 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1108,7 +1108,7 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot) snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev)); /* Needed in order to initialize the bus mutex lock */ - rc = mdiobus_register(bus); + rc = of_mdiobus_register(bus, NULL); if (rc < 0) { dev_err(dev, "failed to register MDIO bus\n"); return rc; From patchwork Tue Nov 16 06:23:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621455 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9997C433F5 for ; Tue, 16 Nov 2021 06:26:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2D1561A0D for ; Tue, 16 Nov 2021 06:26:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230026AbhKPG3a (ORCPT ); Tue, 16 Nov 2021 01:29:30 -0500 Received: from mail-bn8nam12on2139.outbound.protection.outlook.com ([40.107.237.139]:56205 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230494AbhKPG1X (ORCPT ); Tue, 16 Nov 2021 01:27:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nYT6WS4YEjVq96tuPGaopmojoS/57L1zWFz580BhayDnBRl07ur1vw+09ySv1PXJMB0wmECs0whQAkDHGu7MLs76kNFEKpykQ3wWupZ8yWFEBTXXMVIfdqWAkES8Epv1TIGejfUOAQS8K429fu6w2QJbl6HIETKfn2NNIcKfPEq73g+5Cf5KSc9yyc+Sfz9aKx/33PG3yYkzwlr4yvD/elKVDlSukYj6HajFCeofvCAP7/qT221FSiUUPgOqVV6JJWJTpL0co++rl7WZZ382b5/5dGnlhJ6p7A8S6qbU7LVN0U+VnBOAxyKXCgDDblhp6xZHrKnRFql/r6poc2W3xA== 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=c7kVV2LG/xneCByGCObMQud37SonZcka1fqbBAvx1zA=; b=OXv8gz7el/umvEAdXeezDpJd/4e/bNMY9C2Z4y5ak8Fq3RSdTJg3nGXdyBJ2uGzpgRgicHYIBoDQnJXV0OkWy7VFniyzgq7I6L5exmapSoglI+Ccc4lCwgxqh2gfe2ADeX1c/Wfwgam5LG5aUSFMtsTPVUpkL417KjmypPeRRc7gch+NpQHDxn9unCgUQ2WFurhrEvty/1Ik6A3mwFBe6Z2pKX6E11NZ9cYixpuVE01jUCktOVUxvUFfuaC8odbVJ0nBajRwCe/uiC3uM7srJDjR6nr5pitnW22fTeJTAnHlGFmLHsyh9bWR/qT6Dx9ijL9LET1diYlAI6PitSUAZw== 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=c7kVV2LG/xneCByGCObMQud37SonZcka1fqbBAvx1zA=; b=AxOe7ghplT3n3syZFecafcwCqyUaDnF6+/F5XF60iAAL438G0UK9MabveNxGgnvFN/ucu0pcFig1I6ySNucy6uUqpeKYq6EdtO9Nf4J/2H8MyBfAw5JMWUcNAX3hodLM0zjLxDQom6ZIVoufqZlleLM7GTYsAifKSly18m6MSc4= 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 MWHPR1001MB2383.namprd10.prod.outlook.com (2603:10b6:301:31::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Tue, 16 Nov 2021 06:23:45 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:45 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 04/23] net: dsa: ocelot: felix: switch to mdio-mscc-miim driver for indirect mdio access Date: Mon, 15 Nov 2021 22:23:09 -0800 Message-Id: <20211116062328.1949151-5-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76ed7102-07af-4390-f90f-08d9a8c9a47b X-MS-TrafficTypeDiagnostic: MWHPR1001MB2383: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BoyrbIRaEFF7RDIsaqWGdcyOpp0y+E9jxuF7ZLJMrD9GW3qGMc+Ib6gICnvr9a9Tr7FdihnAI1hv8ZbWv+8WZ2Gg9JNC8Ku3+kuJqXJabZWEkhhV0Knnn9rASPb1V+F+ncU/ksw2JneCiKmJj+lxD2l/h0d05YBJGs8e8BVg3eA5gYzqzVYBFOzhYsPh1MBF8SqjoQN7X+xuGu9juvDc/hUJAhgazAVZ6h2PFtP8t2nuZgKDYSmdJxpQ1R0IvBIHtWGsVwMfWv8zMqxMpEeT9U02ub+s4wjWhtEMzZU5L0ek66AsMXBHdBeyKsYbJ0xzrj/9ZR+1Kkjqx/tRFed+P9QbZTqiuBI6yaRYbwFUbjtYpAIPigqag1/izlvF1jCtaNzpPNoOaALIJAlZExM5rC54SIczU5v6wqiNoN2tJPQzAX5UmitvNpr1/aAQm+2V7TlFnHAPyTjNOq0VgtWaJO9jjYlmYbkGs0cW1c4WNiK73IUcGPTBqDPxXsWTcKQfmOLpS0LOlDZg7yltcCRWy+mx1Pqetne89wy4BRunfPXJd2u5DQGfoDPs29KV3pSb/JqZf2SPRI2GTAi5rb/quUT0JkLceCuB9Q428l0E5bpX9NpAuuB8yoE93QwRxvy27c2IlRDriqdmGKF6mh/w1vXV+zcYWASPAQiZ8bnK2qnAtHj3JqpRqlsBKyuoEjHDydrQdQwFlNUJW5Do1wzfcw== 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:(376002)(39840400004)(136003)(366004)(346002)(396003)(6512007)(54906003)(316002)(4326008)(83380400001)(8676002)(86362001)(44832011)(1076003)(2906002)(66946007)(38100700002)(38350700002)(508600001)(956004)(26005)(66476007)(66556008)(6666004)(30864003)(6486002)(6506007)(52116002)(5660300002)(36756003)(7416002)(8936002)(186003)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3W1DliZ6TOpeIWxCvMd+RX3n8BqoGjYuTxK1oT0qRf+xjec6xIfuwp+lTMQaNmIf7QcgPBi42Xw47PJxCslbZiV9/oP9vGhlgSYMfSX3NTQkd9VKZPq9XsNp7/qaGZfUjUhPhqHREUTLPIhc8C37yASo2O1nFQpGS52ZvCo5G5KLmEknzvTV0hx+PTrXP2jijxGNXVp+4PcfXm4g1Cn/17sL2Olk7BxGRNAMMH5Xu4w67J3A3Nw3SPI2gqrUU4byKF65XjJ8kmzer2KfAFEIcIdnfNZVnqLlkKtwgaEE/SDmhgIgBPmV2zpnjWIpilW1dRnydw7CZ57CnGCjaoqnxBs+ZG15KnmaHmwodQRI/PYYPdK0YcX72tHfNY9hYWbTVWQaZ9Ve+orqtvApAm1MQwTPWlcvfSFMCrB2lBZgYk0EKYmeeBisJxyK6DtMZxBwO23v8VOd7TlCGUL0jvx2tqm0LKUkRulXzk4tBPttxzlzAlpotuQ0fpczFxwJdShRr5ncSrfM07CP152552jB+t3DC4opDh55YAz6XRR5yKttAA3R7I7Qj0DX/v6OcilMuYE3Kmp2VkUYA4os5FF8F3dHjkacXDNHJrP5qtAlRVNnllH+Xu9yU75EkzjwgWO2voPpaCBImW+SOQQErj5xeGRm74XwbGkWWABRgZT4/Xm7OXVCnkOv6euFtSHC2sFdtESNVKh5lMCYm3BeS3TKnGtjdYmD0Kyh2vicTk2CR+hr/XChDZ+WemDrFik1rOYzLVefLaZCDwSJgv1Okrr3Lt5MZWONXcvNnwVnb9lJcim0euC76miMKkVzzCEFUmKbtgmGH9bd0LzWrq83kakEzxyEFPtODUGuawhBg9bh2BCRyFpTevqP2NO1eHqjw9AZ+tMBo3oSjSC7WmXNE/9/fUdw02IvccztEkRH2Yonkk4D7+NKWE3cxGF36e+OecwpsB7sEpMMAwmvBztwhmXyKkzPLbbSzJl5nyKR43DyeUSrJiFbgcbrStdomMvGZvwzYeUw86d0y6gwyyu5o2Cj/IzvxujStVmlQBTHXEPQbImQUt7Yzp1dLEVsHQXt1YnBc7MatQEUTNZf2s6Ne1+XiMEApSwe4FXmXEEsXf6cUWkTUviIAyVgdzqWIrDTQFPhZxfGNrL0ondO10kww/PE2mU1OlPkjYjOmD/fqiQM/bJmDjlLf5hQm2ZCYwPLAekF8O2GceoZupAxepoQssnk/Opc1wpfNYAo4ymBpMMiujNts/x9WzCN9vVs+4e/HCQ46ebE6AM9LHbwYD32YFrp0Ecb8+yNFMzvHcQLW7HBUyHKU4QebioviqTO595hcS7XlSi2TF4SRbw2AFuNuhpvB8ynMSVy3GNMKIvl1n3AZiFtGjH3LZFnUPz3gx4YSlPJJwWew4nQWt1HNGyWfo78sTJP2LGrb6d2yxggx4TC7QplpJdU1UBLsmVT9funP2iZ6qrLYiS4vcB++FgXi0p0XPp0d+YPMrqVhUr1OZxX+ndJXnbi+veaJ1XKlrhp3UYcRj2OEX9Hv0+tZbxV6/ay2lm/0J4u27+ghTGj974lWn+wdcu73YQdoZ19YGCo3VIlgJGR5qyLk6LmdM7GaHzaXBG50NH/whQfWp5ERgiHzhpuUHJ7YgcxhcbPTLnru8vpUjixcj/mAx5V09kE+g5h+xyR+RPteb50qeZg23pFsB8= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76ed7102-07af-4390-f90f-08d9a8c9a47b X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:45.3215 (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: PcgQXgMjf36UofqQT6qtSNNl9K03cu1LqBKUNEfGZ0PeoFyEedqDcUXAA2kKdr7qlP18g5nazsNHa49Lja8hVoO5Tn93ZZavuyA9T9BD+tw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2383 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Switch to a shared MDIO access implementation now provided by drivers/net/mdio/mdio-mscc-miim.c Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/Kconfig | 1 + drivers/net/dsa/ocelot/Makefile | 1 + drivers/net/dsa/ocelot/felix_mdio.c | 54 ++++++++++++ drivers/net/dsa/ocelot/felix_mdio.h | 13 +++ drivers/net/dsa/ocelot/seville_vsc9953.c | 108 ++--------------------- drivers/net/mdio/mdio-mscc-miim.c | 37 +++++--- include/linux/mdio/mdio-mscc-miim.h | 19 ++++ 7 files changed, 123 insertions(+), 110 deletions(-) create mode 100644 drivers/net/dsa/ocelot/felix_mdio.c create mode 100644 drivers/net/dsa/ocelot/felix_mdio.h create mode 100644 include/linux/mdio/mdio-mscc-miim.h diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfig index 9948544ba1c4..220b0b027b55 100644 --- a/drivers/net/dsa/ocelot/Kconfig +++ b/drivers/net/dsa/ocelot/Kconfig @@ -21,6 +21,7 @@ config NET_DSA_MSCC_SEVILLE depends on NET_VENDOR_MICROSEMI depends on HAS_IOMEM depends on PTP_1588_CLOCK_OPTIONAL + select MDIO_MSCC_MIIM select MSCC_OCELOT_SWITCH_LIB select NET_DSA_TAG_OCELOT_8021Q select NET_DSA_TAG_OCELOT diff --git a/drivers/net/dsa/ocelot/Makefile b/drivers/net/dsa/ocelot/Makefile index f6dd131e7491..34b9b128efb8 100644 --- a/drivers/net/dsa/ocelot/Makefile +++ b/drivers/net/dsa/ocelot/Makefile @@ -8,4 +8,5 @@ mscc_felix-objs := \ mscc_seville-objs := \ felix.o \ + felix_mdio.o \ seville_vsc9953.o diff --git a/drivers/net/dsa/ocelot/felix_mdio.c b/drivers/net/dsa/ocelot/felix_mdio.c new file mode 100644 index 000000000000..34375285756b --- /dev/null +++ b/drivers/net/dsa/ocelot/felix_mdio.c @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* Distributed Switch Architecture VSC9953 driver + * Copyright (C) 2020, Maxim Kochetkov + * Copyright (C) 2021 Innovative Advantage + */ +#include +#include +#include +#include +#include +#include "felix.h" +#include "felix_mdio.h" + +int felix_of_mdio_register(struct ocelot *ocelot, struct device_node *np) +{ + struct felix *felix = ocelot_to_felix(ocelot); + struct device *dev = ocelot->dev; + int rc; + + /* Needed in order to initialize the bus mutex lock */ + rc = of_mdiobus_register(felix->imdio, np); + if (rc < 0) { + dev_err(dev, "failed to register MDIO bus\n"); + felix->imdio = NULL; + } + + return rc; +} + +int felix_mdio_bus_alloc(struct ocelot *ocelot) +{ + struct felix *felix = ocelot_to_felix(ocelot); + struct device *dev = ocelot->dev; + struct mii_bus *bus; + int err; + + err = mscc_miim_setup(dev, &bus, ocelot->targets[GCB], + ocelot->map[GCB][GCB_MIIM_MII_STATUS & REG_MASK], + ocelot->targets[GCB], + ocelot->map[GCB][GCB_PHY_PHY_CFG & REG_MASK]); + + if (!err) + felix->imdio = bus; + + return err; +} + +void felix_mdio_bus_free(struct ocelot *ocelot) +{ + struct felix *felix = ocelot_to_felix(ocelot); + + if (felix->imdio) + mdiobus_unregister(felix->imdio); +} diff --git a/drivers/net/dsa/ocelot/felix_mdio.h b/drivers/net/dsa/ocelot/felix_mdio.h new file mode 100644 index 000000000000..93286f598c3b --- /dev/null +++ b/drivers/net/dsa/ocelot/felix_mdio.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* Shared code for indirect MDIO access for Felix drivers + * + * Author: Colin Foster + * Copyright (C) 2021 Innovative Advantage + */ +#include +#include +#include + +int felix_mdio_bus_alloc(struct ocelot *ocelot); +int felix_of_mdio_register(struct ocelot *ocelot, struct device_node *np); +void felix_mdio_bus_free(struct ocelot *ocelot); diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 84681642d237..610bdfd31903 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -11,13 +11,7 @@ #include #include #include "felix.h" - -#define MSCC_MIIM_CMD_OPR_WRITE BIT(1) -#define MSCC_MIIM_CMD_OPR_READ BIT(2) -#define MSCC_MIIM_CMD_WRDATA_SHIFT 4 -#define MSCC_MIIM_CMD_REGAD_SHIFT 20 -#define MSCC_MIIM_CMD_PHYAD_SHIFT 25 -#define MSCC_MIIM_CMD_VLD BIT(31) +#include "felix_mdio.h" static const u32 vsc9953_ana_regmap[] = { REG(ANA_ADVLEARN, 0x00b500), @@ -857,7 +851,6 @@ static struct vcap_props vsc9953_vcap_props[] = { #define VSC9953_INIT_TIMEOUT 50000 #define VSC9953_GCB_RST_SLEEP 100 #define VSC9953_SYS_RAMINIT_SLEEP 80 -#define VCS9953_MII_TIMEOUT 10000 static int vsc9953_gcb_soft_rst_status(struct ocelot *ocelot) { @@ -877,82 +870,6 @@ static int vsc9953_sys_ram_init_status(struct ocelot *ocelot) return val; } -static int vsc9953_gcb_miim_pending_status(struct ocelot *ocelot) -{ - int val; - - ocelot_field_read(ocelot, GCB_MIIM_MII_STATUS_PENDING, &val); - - return val; -} - -static int vsc9953_gcb_miim_busy_status(struct ocelot *ocelot) -{ - int val; - - ocelot_field_read(ocelot, GCB_MIIM_MII_STATUS_BUSY, &val); - - return val; -} - -static int vsc9953_mdio_write(struct mii_bus *bus, int phy_id, int regnum, - u16 value) -{ - struct ocelot *ocelot = bus->priv; - int err, cmd, val; - - /* Wait while MIIM controller becomes idle */ - err = readx_poll_timeout(vsc9953_gcb_miim_pending_status, ocelot, - val, !val, 10, VCS9953_MII_TIMEOUT); - if (err) { - dev_err(ocelot->dev, "MDIO write: pending timeout\n"); - goto out; - } - - cmd = MSCC_MIIM_CMD_VLD | (phy_id << MSCC_MIIM_CMD_PHYAD_SHIFT) | - (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) | - (value << MSCC_MIIM_CMD_WRDATA_SHIFT) | - MSCC_MIIM_CMD_OPR_WRITE; - - ocelot_write(ocelot, cmd, GCB_MIIM_MII_CMD); - -out: - return err; -} - -static int vsc9953_mdio_read(struct mii_bus *bus, int phy_id, int regnum) -{ - struct ocelot *ocelot = bus->priv; - int err, cmd, val; - - /* Wait until MIIM controller becomes idle */ - err = readx_poll_timeout(vsc9953_gcb_miim_pending_status, ocelot, - val, !val, 10, VCS9953_MII_TIMEOUT); - if (err) { - dev_err(ocelot->dev, "MDIO read: pending timeout\n"); - goto out; - } - - /* Write the MIIM COMMAND register */ - cmd = MSCC_MIIM_CMD_VLD | (phy_id << MSCC_MIIM_CMD_PHYAD_SHIFT) | - (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) | MSCC_MIIM_CMD_OPR_READ; - - ocelot_write(ocelot, cmd, GCB_MIIM_MII_CMD); - - /* Wait while read operation via the MIIM controller is in progress */ - err = readx_poll_timeout(vsc9953_gcb_miim_busy_status, ocelot, - val, !val, 10, VCS9953_MII_TIMEOUT); - if (err) { - dev_err(ocelot->dev, "MDIO read: busy timeout\n"); - goto out; - } - - val = ocelot_read(ocelot, GCB_MIIM_MII_DATA); - - err = val & 0xFFFF; -out: - return err; -} /* CORE_ENA is in SYS:SYSTEM:RESET_CFG * MEM_INIT is in SYS:SYSTEM:RESET_CFG @@ -1084,7 +1001,6 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot) { struct felix *felix = ocelot_to_felix(ocelot); struct device *dev = ocelot->dev; - struct mii_bus *bus; int port; int rc; @@ -1096,26 +1012,18 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot) return -ENOMEM; } - bus = devm_mdiobus_alloc(dev); - if (!bus) - return -ENOMEM; - - bus->name = "VSC9953 internal MDIO bus"; - bus->read = vsc9953_mdio_read; - bus->write = vsc9953_mdio_write; - bus->parent = dev; - bus->priv = ocelot; - snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev)); + rc = felix_mdio_bus_alloc(ocelot); + if (rc < 0) { + dev_err(dev, "failed to allocate MDIO bus\n"); + return rc; + } - /* Needed in order to initialize the bus mutex lock */ - rc = of_mdiobus_register(bus, NULL); + rc = felix_of_mdio_register(ocelot, NULL); if (rc < 0) { dev_err(dev, "failed to register MDIO bus\n"); return rc; } - felix->imdio = bus; - for (port = 0; port < felix->info->num_ports; port++) { struct ocelot_port *ocelot_port = ocelot->ports[port]; int addr = port + 4; @@ -1160,7 +1068,7 @@ static void vsc9953_mdio_bus_free(struct ocelot *ocelot) mdio_device_free(pcs->mdio); lynx_pcs_destroy(pcs); } - mdiobus_unregister(felix->imdio); + felix_mdio_bus_free(ocelot); } static const struct felix_info seville_info_vsc9953 = { diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c index ea599b980bbf..cf3fa7a4459c 100644 --- a/drivers/net/mdio/mdio-mscc-miim.c +++ b/drivers/net/mdio/mdio-mscc-miim.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -37,7 +38,9 @@ struct mscc_miim_dev { struct regmap *regs; + int mii_status_offset; struct regmap *phy_regs; + int phy_reset_offset; }; /* When high resolution timers aren't built-in: we can't use usleep_range() as @@ -56,7 +59,8 @@ static int mscc_miim_status(struct mii_bus *bus) struct mscc_miim_dev *miim = bus->priv; int val, err; - err = regmap_read(miim->regs, MSCC_MIIM_REG_STATUS, &val); + err = regmap_read(miim->regs, + MSCC_MIIM_REG_STATUS + miim->mii_status_offset, &val); if (err < 0) WARN_ONCE(1, "mscc miim status read error %d\n", err); @@ -91,7 +95,9 @@ static int mscc_miim_read(struct mii_bus *bus, int mii_id, int regnum) if (ret) goto out; - err = regmap_write(miim->regs, MSCC_MIIM_REG_CMD, MSCC_MIIM_CMD_VLD | + err = regmap_write(miim->regs, + MSCC_MIIM_REG_CMD + miim->mii_status_offset, + MSCC_MIIM_CMD_VLD | (mii_id << MSCC_MIIM_CMD_PHYAD_SHIFT) | (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) | MSCC_MIIM_CMD_OPR_READ); @@ -103,7 +109,8 @@ static int mscc_miim_read(struct mii_bus *bus, int mii_id, int regnum) if (ret) goto out; - err = regmap_read(miim->regs, MSCC_MIIM_REG_DATA, &val); + err = regmap_read(miim->regs, + MSCC_MIIM_REG_DATA + miim->mii_status_offset, &val); if (err < 0) WARN_ONCE(1, "mscc miim read data reg error %d\n", err); @@ -128,7 +135,9 @@ static int mscc_miim_write(struct mii_bus *bus, int mii_id, if (ret < 0) goto out; - err = regmap_write(miim->regs, MSCC_MIIM_REG_CMD, MSCC_MIIM_CMD_VLD | + err = regmap_write(miim->regs, + MSCC_MIIM_REG_CMD + miim->mii_status_offset, + MSCC_MIIM_CMD_VLD | (mii_id << MSCC_MIIM_CMD_PHYAD_SHIFT) | (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) | (value << MSCC_MIIM_CMD_WRDATA_SHIFT) | @@ -143,14 +152,17 @@ static int mscc_miim_write(struct mii_bus *bus, int mii_id, static int mscc_miim_reset(struct mii_bus *bus) { struct mscc_miim_dev *miim = bus->priv; + int offset = miim->phy_reset_offset; int err; if (miim->phy_regs) { - err = regmap_write(miim->phy_regs, MSCC_PHY_REG_PHY_CFG, 0); + err = regmap_write(miim->phy_regs, + MSCC_PHY_REG_PHY_CFG + offset, 0); if (err < 0) WARN_ONCE(1, "mscc reset set error %d\n", err); - err = regmap_write(miim->phy_regs, MSCC_PHY_REG_PHY_CFG, 0x1ff); + err = regmap_write(miim->phy_regs, + MSCC_PHY_REG_PHY_CFG + offset, 0x1ff); if (err < 0) WARN_ONCE(1, "mscc reset clear error %d\n", err); @@ -166,12 +178,12 @@ static const struct regmap_config mscc_miim_regmap_config = { .reg_stride = 4, }; -static int mscc_miim_setup(struct device *dev, struct mii_bus *bus, - struct regmap *mii_regmap, struct regmap *phy_regmap) +int mscc_miim_setup(struct device *dev, struct mii_bus **pbus, + struct regmap *mii_regmap, int status_offset, + struct regmap *phy_regmap, int reset_offset) { struct mscc_miim_dev *miim; struct mii_bus *bus; - int ret; bus = devm_mdiobus_alloc_size(dev, sizeof(*miim)); if (!bus) @@ -187,10 +199,15 @@ static int mscc_miim_setup(struct device *dev, struct mii_bus *bus, miim = bus->priv; miim->regs = mii_regmap; + miim->mii_status_offset = status_offset; miim->phy_regs = phy_regmap; + miim->phy_reset_offset = reset_offset; + + *pbus = bus; return 0; } +EXPORT_SYMBOL(mscc_miim_setup); static int mscc_miim_probe(struct platform_device *pdev) { @@ -227,7 +244,7 @@ static int mscc_miim_probe(struct platform_device *pdev) return PTR_ERR(dev->phy_regs); } - mscc_miim_setup(&pdev->dev, bus, mii_regmap, phy_regmap); + mscc_miim_setup(&pdev->dev, &bus, mii_regmap, 0, phy_regmap, 0); ret = of_mdiobus_register(bus, pdev->dev.of_node); if (ret < 0) { diff --git a/include/linux/mdio/mdio-mscc-miim.h b/include/linux/mdio/mdio-mscc-miim.h new file mode 100644 index 000000000000..3ceab7b6ffc1 --- /dev/null +++ b/include/linux/mdio/mdio-mscc-miim.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ +/* + * Driver for the MDIO interface of Microsemi network switches. + * + * Author: Colin Foster + * Copyright (C) 2021 Innovative Advantage + */ +#ifndef MDIO_MSCC_MIIM_H +#define MDIO_MSCC_MIIM_H + +#include +#include +#include + +int mscc_miim_setup(struct device *device, struct mii_bus **bus, + struct regmap *mii_regmap, int status_offset, + struct regmap *phy_regmap, int reset_offset); + +#endif From patchwork Tue Nov 16 06:23:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621465 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E49E9C433F5 for ; Tue, 16 Nov 2021 06:27:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B65D461A0D for ; Tue, 16 Nov 2021 06:27:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232237AbhKPGaC (ORCPT ); Tue, 16 Nov 2021 01:30:02 -0500 Received: from mail-bn8nam12on2129.outbound.protection.outlook.com ([40.107.237.129]:48640 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231274AbhKPG17 (ORCPT ); Tue, 16 Nov 2021 01:27:59 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MLoPhFABwMDVezcn+dd286h53Ktidyl71uPVGu+QolOiAnt9gh1CQ4QOUxvWcOaq2QLYPvjGM8MAeshGOHPg34GXEKhf+gBMFQX7TgNeQ/QKRb8KDfjfZWWs2JeJsV7eVL928TBPv42lZIhu4yKOTt/Ha//aSafo+G0vXLszyJ3kAbWMX5OpzjmCCT+HqYEF52CjvfYWTTusNEG7KHF6TcvTmRktIUjxIURRgtBCUe7GVN1LvG4yZWKXXqPcCe6lxWnlhyAxSZAEINx3jziQtNAi0bCWLPV6KcFAfwOGo1wlhsrXmGoApE7tk4xqut+TjAgZr+oFJ6sPyKv/2JCkug== 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=1l73FUOfTXGsUNS5WNZu7qMSfIq/CYlA9/HtYXWFjUE=; b=nND+KV6i7r3IuC3QP6CE1wVBgFLAFsvA51ENmEaSZ+ytkTL+Lp/SKxCgXsIgPJQBT4Plxaq50skNVn2SgRBYXiIYRzFldzFJOqLzv1qz1NZvQqoq8L0H4f6jgZEvlea7cHervK1B0ct6b+fK2CTnUseZfrvsA1ZsgpX6GztkkkNOgRThgxgfIB/pBWd5iixC3Nb6mFAgT5kJPuZrz159qQ4/0ZAOm2jSTCrZtWZxEMd/526m7Chw8rgX3WRBqYlfs8QtIZ6Y4jGL7+GKjZ+EPgMYDJNKAK388RkUm0RR4iZTdoSyW+hY8sXNlH+S4Zt5dWc9tWYU1HZJ1nj9mYMy3w== 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=1l73FUOfTXGsUNS5WNZu7qMSfIq/CYlA9/HtYXWFjUE=; b=e35FYV6Yvy9MDTlo/C5DiEjJ0Klib3YAEUekP1iREWoacq6iUuzq6LsDxNAcXyMCg1R2KUpyjLAfEVlweMShBuinvAb3EdiqMI7cG/7msixQH3IoQTRFZSD+uF+KY621N2lL6uXzwIFL6vBqAin28FvdZINGSDWxaB60xcmmz34= 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 MWHPR1001MB2383.namprd10.prod.outlook.com (2603:10b6:301:31::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Tue, 16 Nov 2021 06:23:46 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:46 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 05/23] net: dsa: ocelot: felix: Remove requirement for PCS in felix devices Date: Mon, 15 Nov 2021 22:23:10 -0800 Message-Id: <20211116062328.1949151-6-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b8b16ef4-2d3e-40c8-aef9-08d9a8c9a4fc X-MS-TrafficTypeDiagnostic: MWHPR1001MB2383: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o+TXQZuuVQsISk1/K8kYdq3If2tq3Ygx5wue3nIFJHsXDJOPfPUTMlzO6ZqRUQKKrsSCQU/5UNTugJcdOTOB/c6VkioWG1VQvfUvbLIm9TbIjgdpcWQNoue6JBEe4WYPF0KgkiRvp6Vt2lzD8XL7IDMPcLLMMM9eqAaDRoSyJRAsGUFmx9CU1gu9qFxgew+dWDyqg/pRapsIEvN2BB+yt7pEoS9+THMPZV4oMvfSL/vo3jDXdiCvISSU9nHbz+/IpgFGve9z2OOjnX1+duAjEE11spETcBCX5xzzn8UuABhrmbR9Dwp1JSNxdGadd3JLLe2nIcksGHANf4Jn9nqcZF7Thiff6ch/z7ggj4Q39geTPYGeEOLn235J4Ikm5m6lZj0rP2fd6NxR4s25q0QDQz4QYQQsRzRMN9w7QsSGDuIvZSzQm0Yt0ljDrwdLewg5ZNjea+NwUMJbt018rlCYwOSZ6NqKHY+VVylB/Vi+4rZr8r57a8ohDD68Kk/ewXQD7MIGyp+eary5g10JCBZZQR93BxOafQZ1psjHpwIBhZXAlUh+Y7eprqQY5RcAnia7nWOn9ouQV2O+8n4WT67qg0L7qsIdUDSZlNkRt3OYU8OYJtFrnPaeDCOrc46KN3op9EuinXmjFdryY1oD4VEE6KyVdBh63CZ9cJgwCIzV2visyrul4j+zczbfqssfKu6kvgPUrHuuAwa0UXAhXGv9sw== 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:(376002)(39840400004)(136003)(366004)(346002)(396003)(6512007)(54906003)(316002)(4326008)(83380400001)(8676002)(86362001)(44832011)(1076003)(2906002)(66946007)(38100700002)(38350700002)(508600001)(956004)(26005)(66476007)(66556008)(6666004)(4744005)(6486002)(6506007)(52116002)(5660300002)(36756003)(7416002)(8936002)(186003)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q4HE21y+flLrmutA2vHKeSWMBqCAHu/BQVxWMBpWq+FfwDKQmfJW3VdwTVYnQuA8HsNSlO42s/gNDdP+3AK52/qIOnuoUAcx80NzYrfXdiX3ZnewN1jiX31PzQHqSBx14ZTaV56CbvjJS168V++g9Jva45jmoPRyoPJJbNkoBXYsyGZg9ubwVUQo8E4JblJkzwoOKAHzH4hSupWufieQe1FqIX+Ltj3n+o5DyL5nh68Ul6yRUegX5hUHFRsON4SZ9OXbvCITytQ3KPnMPrk2VyN0KSGcjbZjsoh4gYLNF6vRmt9UogsrtKbtPWPSQOnBexmt1m25p8vKLgx3ZwG9SHDjDiwLKX7xCYU3B5zowKdQxmRmLefu5XmHQlAj+Xje+kzcgtfBeHpZwSeIcT7IJxnpyHD7lcxoL4DUL2c27yHppAaeXfE23DFobfKjtzHHT/KUESbPsM5O6gpNQdiE2m1XyP3xH6Bms1BLQuiow8TXLYTFmplZkNVFV5RsRNmtXHkXUasAYWew9v6PqNl3n4jGQ4gjvqLbcaAir7d8Al31VCnufG86tVfBjRwyBuXJdE1C8Jbxd2yoGFVmcWtIHk38bhIHEeyW/tXOfAfcrQXBeDAH2ZMmSt0P8qro5iQUloVpArv/gsn6aUVo+IZk/rQll9RMisuhNpHh0R1craW2GU9CSQiucL3axfbUibVGsDT6paTJSgdOIuGM9/x4r7ZZug4Zug2YguUI2RVA3N9mdpmGbAlRGjAeFI8rJsNFdhyQ9dDdQ4tmJgGdHSCLI8zAskl4VjYob5N/IGexDT/gsj3v2PPHwCYQCLMn0lW3ilAmLKIFbGbhEnoSl/d291UvdvKYC2iMFwEVBA5LWPnr7nxonRxjfKBAfh8/ylFgRy/4FTmBbBlUFVOduHlJTUyBr47ifdM0m0muv1LlHeHnnkltmRC/5zD5F8MLOF0HIFGW51p3GBYIiCuvG1NZPE0e8o77MC5rCVgBHdD/9Nipc/n2ZFfoIWZlVmJ6tXX/hFqHqNL4CVpSJNcx0MU05gGb4Z9VT4kvLA9vihFHhqARctBlwqoeV4ndank+fCZVl71b1mXlYbotFCH5A18pYNBPbJZ/Q0XJIv6L+da6LJ3JKl4SV3ijEsRZ2aj+OTuFYr5ZrOEAV7aEYaEnSiBIpPa5l6Ue/9MQQ69vBNvv93mUClk2QM+NEx0/EQHlMj9kJ/n+xUlJ83iLJ7ajjdUVLfxk6bsF9Xh11C1bOuk2kzGKoD7z4bPKVQX/I23rqaJZBLsBdUeNW2w6lXE+ml9mkUovNp1pBGMmzC0JnYpIAOaUduFFXM1L7CuG75eYl1Ym1p4tih1FQrrBrUHB7mV9bCXZCsuWUFcYKkVBoAHbGjqhgE9yIsgKz/loRuQuFVFZK6MBCLS+eeNqxyUTJ3EZLIoaNFWEppOC5qGeXTJYJ6taqW/vzTjGiBtRtZvzso8BZuFsfwglDa6MgpwF5btNkKNscH4vTb3GH85hiXl4ONJnIarSj6ej9iYDXjn74uB1pgKu+/PH3ZE7PTFVBE4caTp8LGjBS0u7g+pTAbTNFlrG/d0cJpSXoMvFnJ2wFRsyc9RFS0J70QG2yK7U0BFHHBpHJTOTEqqtOInIsl4jSs/2XsDMMxxScZ2NjUUR67if8qKQauZklq5qrXiYzOLZUkOpBm0TavwTh5tKymywgIo= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8b16ef4-2d3e-40c8-aef9-08d9a8c9a4fc X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:46.1300 (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: jIMUoFIvcDTew9fHwKdmaYZiof0uAolbpj3EyaBmnhDSWFvmMsuIqDep2SBoddOI7NkB9lMtOvzQ40FifKB1ecv96Gbgz+hCP+xght3NLUQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2383 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Existing felix devices all have an initialized pcs array. Future devices might not, so running a NULL check on the array before dereferencing it will allow those future drivers to not crash at this point Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/felix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 327cc4654806..94702042246c 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -820,7 +820,7 @@ static void felix_phylink_mac_config(struct dsa_switch *ds, int port, struct felix *felix = ocelot_to_felix(ocelot); struct dsa_port *dp = dsa_to_port(ds, port); - if (felix->pcs[port]) + if (felix->pcs && felix->pcs[port]) phylink_set_pcs(dp->pl, &felix->pcs[port]->pcs); } From patchwork Tue Nov 16 06:23:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621473 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB3D8C433FE for ; Tue, 16 Nov 2021 06:27:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D786D6115B for ; Tue, 16 Nov 2021 06:27:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232408AbhKPGa0 (ORCPT ); Tue, 16 Nov 2021 01:30:26 -0500 Received: from mail-bn8nam12on2121.outbound.protection.outlook.com ([40.107.237.121]:4257 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231383AbhKPG22 (ORCPT ); Tue, 16 Nov 2021 01:28:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MNbyu2gLoBdk8r9HBjfUZcKXnZMHAeboRypF7feZiJE+IH8O+cg1WYTgMw5C2BU/ckk/lHAEXppatF3/Pj4MVo87AC1sbRuInMInVh9M5yjvbUeQm2hhw4k0a+cEPtmxsZnuuTf/tZHL7+jKO/pKgUfHGa+rRab2NGrRvoNkg6LRZZ58Y21uZTDiuF/i3cBuK/e37F5T1FjgoXGqTZzwW1PxjPxlbs1CWR8A/vERtAtFpERJ192OuMWCTyyXHDHZwi17UizW+atwkixKPRfxwfSckafSKgHYPD2dUM3Ja556kjzozIdPgL8k9UTvrTuAkHS0qbemAiOcTPL1CzwvWg== 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=nJsIVdGdQxc4duae8jEw39R/NAVBSIQKEwRd0yqzlss=; b=W0MYX6wkkX+iWgieaJq4VoQECBFd6E6j4m1f3cLiXazFN5JCIUH8oQOa1gx86maan6KpU4b02UN//znERfTh31mXjMqaj4T9ARSi/4/BDNkcljT60Bm+KngY3NUpyb2NicpitlLONVg3FT72232GZVUTd04U9Mu47R1VPqwjhR2FGBk+x0rYws9O13mu+WuHWlzKx/faB+BOnHFUPJ3Lw4luMO1DFeie9rI/Gj/GcjHTaX/Ag/TJDdX8fhBWGbWwvjshngOhUMz/ESDba9tm4MVW/WX5anYTQXudDJJfIyU+sd66h8BxB5RHpyeFnzwRNe40SEE0KBTOS/E4PBZ3QQ== 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=nJsIVdGdQxc4duae8jEw39R/NAVBSIQKEwRd0yqzlss=; b=grZs6ezRTvsSmBtvfnUqQhI0w/0THhNcbQ37HJp2rrrSQcaBLwDxi2h8piySqo9rYStG97kUFwY0qrh9aQM+u1Nh2arn4EVz+ltQgceeL0E60LJ9FPi993mQ6AvlmJN5B0yy2qtczHHeE2nk1ojVPKOyccMg50CGbo2XnOCb9hE= 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 MWHPR1001MB2383.namprd10.prod.outlook.com (2603:10b6:301:31::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Tue, 16 Nov 2021 06:23:47 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:47 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 06/23] net: dsa: ocelot: felix: add interface for custom regmaps Date: Mon, 15 Nov 2021 22:23:11 -0800 Message-Id: <20211116062328.1949151-7-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d0a075d7-b781-4e90-bc8a-08d9a8c9a570 X-MS-TrafficTypeDiagnostic: MWHPR1001MB2383: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8RM+8eksEDxDTu39a07Uu1Uoo1vr/NU/5qm51b9aR6tDnsr73l2P3gYIZlj2JJiElVhrcExtNlFj3TdIZQzYwq03r004EbJnoF4hWDf0OM4oaLz///NYkK9DXRi4EFZyzSpi8NkTTzL3IRVlLhw0srUL4urfrP3ARUErnLZxY4ok8bENaTMLBGW0XOcu042GZA2Hnd9idTt8M9fGELPVux7DGHLlaLlQP0hqM8zv8HPYCCEf9/CtSIYrNv9T0rC/L2WSxM+s1u0FqWlyknLtMwcwXUqwZ1/8SuTwF6/oSEqz2GzHuGUxHZTes6xWtysXBiFUZBorkfdoiNjCy+x0Ctbo6ZCgR1+am0AriZvIQK7rC11N7SpDlfh92LtQpvL4fL3pgZGgqwbCUjQ4Lj+VnV+ja3ACLV5Tl4YECnApNSgT5fvbbFSsfg0rIEXBJRgG/00Tldc3K2ta21bgtUZo0NDSHWzr+R6AxyQFvF6Wm7usULJODhakZX9UC31Ri7OdMkCtJJW2+KH0nKW7a5IB5p9hx3jcQ3gyItq11FrLq1e5OaBm771le3OGi9jUIhHvHzukCZwccxz9+FuE5lAKg74bxNtQpJslJUCdhoys1tyun3kClYZe23Z/wHgEG0tTkPHSGxQNn0wsdAGdYg3BwlCguhltEVxVMFycrixXEkIALq7suKAtX7tq3kM3bIZudhiXhIhPyyKBzNhhLaik5Q== 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:(376002)(39840400004)(136003)(366004)(346002)(396003)(6512007)(54906003)(316002)(4326008)(83380400001)(8676002)(86362001)(44832011)(1076003)(2906002)(66946007)(38100700002)(38350700002)(508600001)(956004)(26005)(66476007)(66556008)(6666004)(6486002)(6506007)(52116002)(5660300002)(36756003)(7416002)(8936002)(186003)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WNJ1bl2BAbdI6izA02Umi1wlk+C78/0uM11hcANopgfCQjlcBLpLKCvZzfyicvIfy8yJNpskI6m88lma4HvbmVo6ld8qUxlF6ESRS/bhB8ooV3AtIeEDiPoSCIDyF9OMN3Lpa1fwAsU4jCoTE1C+QetbNj71Yx3DT9AJ6VzA7Fz56JTeVM/IQ1P0qXEQepb/0AvMbJBVZn9CYJ3vIiHyrV9Rg7IcJGHGCnRT8bTNKszpxkx6g4z2jkNqcIu9NZ+7ippJJjo+KMHPvVaRq1DduO8w7MPAs3WcKrLSH1FB4Mg78w5lz3TM/vBpFFBcSh7GkCKmGlTXpgDRh8vY39uOUq1aZ03b+FSZuU4iIAeU8RYQaIsN6+sArfI5mTx84cgLoXGO7ud12+Sr254L+hkUY1Gj60Gryyr0ijQ/ffP0YTysCLm2YU8fzXQCGNASFDYmYfN3TSwW9fmlmWWlID+OXrAlUailX+QoHniCJv08tA+KbfuKcR+eci5yj3Gmny9o2eARt6Jedlb9T7raB6bFID+dgBqeOPgoMdTiMyVUFvKOZcPTlZmYMIgBQ/wpyvT9FPoRjpizPQ1gGfj4ZoYkP90EtgwPOvuAl3Oi1Xf2+yshRcTFKhj6e7eHi3Hbg+Q70j2E20aZYPRjfm+ubGnHKxObx/tbA1x+HBUtlRDLaeurvp95VMr7l3ZqF9vVu+5Usg6rRM02qx9f/Zi/dr4+iwT9wrwDsMTCgeO68x7YR45b+vg37RBprDmfcPzrI3Wd4l1o7RodWjPQ0lcvsYRAv9DtGXo7qythcbUmM6iMDrYGHaPbjeZjd9YV1Mx0nLfO908/4TYTl0+ph2GT3hvLhdYUYRssqLnqL+LBZEJlSJaatdHVTg79hnsqbqoZxi1RzuT1Yo9nYjQ2CY0IZal/5mxJFaL51m4DFoQ/Jh0xTvFaMkKWJvvO9SGzYLwDm/EjPK0Zut6Yk7qxMpoTlj49iFAon9xKk516Zk5ICC6ksrNJmBld3xEyEJXVjV5WhQrGZF4CiWQTkAAwvUbbbfoWkyEu3pc/YGwRfg3RR4lLQ5SV3dBeHes068FXY9+1ZjwXWlcEqlXq2iqiUKwdiG1lLWoxJr4hO8g9bY10ZzJU8rGNKkXSlr5FBqLaQ/GMdQgqYk4rTsAAIIErtF37DUO9IN3+bTUqPAb1kxWtOCrDfv+23U0mfn4+0RM15qOPs2XQN1R+dogAmM+H1Lf9aAHOBflO2Xjkyrd+nw9KNI7ljJb6Tl6iGRj1PeRNM6dbzOWQADmPG4xSxJw4R82y5j7V81qHmaZqeNp5MDNn/SWKQrlROLHImw692rpOHpWQhcyseeC3fF4dCtthqD8415evIPEn6gft1QNCvmfk5BrHuYhsubZX8fNCKT83ujb5BOPDDZ4q8P69cT/5uMfNPz67oeSRTQM150Tw3hVSqrzfyxf/jOtonQxEm84M27yUipYwjkpj22APS/wpVGZMyVVKlOpIwMsEU/Orr+yj0zvjWm+UpqSHq4Odz8jG16yNDDPt7RJpn0uHtPprPRUo3RmVS+FlhfK4GkUOQVLmQdWMs1zBJt4PhkcI2RfPbqtYWdmu76yNjR4W/s7spNeqXC0vTdXupolFwEsYNTJknFXbbSP5oGB0nIfWLsrb+TeEdLHVgWTT+A8D19SJXyrkMATE1qc0u85yzXlahlz4JGo81PI= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0a075d7-b781-4e90-bc8a-08d9a8c9a570 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:46.8786 (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: RD/QYTNp+CgMq+ia3kXluQbTmp/5vHX4KQGj2i+KOyumQ6On81X2ot9eyKVNCnbUGGaCJLBcJhaE12/MWStZRJy9XCNdnEyRUEOdBMVcIHs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2383 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Add an interface so that non-mmio regmaps can be used Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/felix.c | 4 ++-- drivers/net/dsa/ocelot/felix.h | 2 ++ drivers/net/dsa/ocelot/felix_vsc9959.c | 6 +++--- drivers/net/dsa/ocelot/seville_vsc9953.c | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 94702042246c..615f6b84c688 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1016,7 +1016,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) res.start += felix->switch_base; res.end += felix->switch_base; - target = ocelot_regmap_init(ocelot, &res); + target = felix->info->init_regmap(ocelot, &res); if (IS_ERR(target)) { dev_err(ocelot->dev, "Failed to map device memory space\n"); @@ -1053,7 +1053,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) res.start += felix->switch_base; res.end += felix->switch_base; - target = ocelot_regmap_init(ocelot, &res); + target = felix->info->init_regmap(ocelot, &res); if (IS_ERR(target)) { dev_err(ocelot->dev, "Failed to map memory space for port %d\n", diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index d7da307fc071..81a86bd60f03 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -46,6 +46,8 @@ struct felix_info { enum tc_setup_type type, void *type_data); void (*port_sched_speed_set)(struct ocelot *ocelot, int port, u32 speed); + struct regmap *(*init_regmap)(struct ocelot *ocelot, + struct resource *res); }; extern const struct dsa_switch_ops felix_switch_ops; diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 0b3ccfd54603..789e1ff0d13b 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -17,6 +17,8 @@ #include "felix.h" #define VSC9959_TAS_GCL_ENTRY_MAX 63 +#define VSC9959_SWITCH_PCI_BAR 4 +#define VSC9959_IMDIO_PCI_BAR 0 static const u32 vsc9959_ana_regmap[] = { REG(ANA_ADVLEARN, 0x0089a0), @@ -1365,6 +1367,7 @@ static const struct felix_info felix_info_vsc9959 = { .prevalidate_phy_mode = vsc9959_prevalidate_phy_mode, .port_setup_tc = vsc9959_port_setup_tc, .port_sched_speed_set = vsc9959_sched_speed_set, + .init_regmap = ocelot_regmap_init, }; static irqreturn_t felix_irq_handler(int irq, void *data) @@ -1384,9 +1387,6 @@ static irqreturn_t felix_irq_handler(int irq, void *data) return IRQ_HANDLED; } -#define VSC9959_SWITCH_PCI_BAR 4 -#define VSC9959_IMDIO_PCI_BAR 0 - static int felix_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 610bdfd31903..47da279a8ff7 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1087,6 +1087,7 @@ static const struct felix_info seville_info_vsc9953 = { .mdio_bus_free = vsc9953_mdio_bus_free, .phylink_validate = vsc9953_phylink_validate, .prevalidate_phy_mode = vsc9953_prevalidate_phy_mode, + .init_regmap = ocelot_regmap_init, }; static int seville_probe(struct platform_device *pdev) From patchwork Tue Nov 16 06:23:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621443 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 793B0C433EF for ; Tue, 16 Nov 2021 06:24:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 620FA61BE6 for ; Tue, 16 Nov 2021 06:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231157AbhKPG1Z (ORCPT ); Tue, 16 Nov 2021 01:27:25 -0500 Received: from mail-dm6nam10on2119.outbound.protection.outlook.com ([40.107.93.119]:14080 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230243AbhKPG0u (ORCPT ); Tue, 16 Nov 2021 01:26:50 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aFRP4cu4rB7i6bxfeF+mK+x8GXs7mvjhzpIbWJbF+FXMr5FoLbmIh8uf+fuUvISiOP9vinlGOeIQJrHQ+YoJcZ0tlJue7JQgvFTXVhOZ+VchmOrSP0XLcCvSticiRqgBVIf5iRv5a47SckRxPZNgX7T8MWz0hci6/K7lK75ht0CYtc3hEvrN+8Txrr0RzB6Ob3dvhWVOjKzQXh+r8/u0H0R/s01hySHk36EkF8SCZgY79BaehaAGwtXdYs7Nwbz/2WkPgKeMO51DNiNDejLNY5Iu/+C7aDjdKn1Ksb/16oNPPq9kVP5/9wl6XzwItnyN2PF4ExrbPS4EYebE3E4hWA== 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=q3Fc3IRCTa7wuJ4BPfx1/ga3Gse8KsZ+tjKMWhSG/qU=; b=AEB0fqQePdRkv9A8uaUmpJF+lDhjRSi42nlfEenBS3bhBlbLhzqcgc5e7bwg1gupooYtcPqwEn2bC9ZW/0E1vcza1KSj7/v1EkGB9DLkCDbo/a5oyr+PfQzzbaJ/kNAdw28p8hMsVj0sNr2ZNzgKtF1FYhj7W626Nu0WyB7QAlaibgYkX76nPu3+7DTII3Ozff9+EMHWKuC60s+8+EJyiqN687bHIsFI6TONEIuFaEnksn1hOqcQo2g5GyG4GGnHQmn2UrKT5+n/nWtwFVh73f4NwIsKIZlNjlRxPCIO4HH7aXz22ofaAQkPVfHTvbjtRlwqme0y1VSWXMxGGJiTAQ== 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=q3Fc3IRCTa7wuJ4BPfx1/ga3Gse8KsZ+tjKMWhSG/qU=; b=IJtNxUTuIwEysddiuIK48pRm6/vVI7mVQd2I2MmP0dPydmnysEIiATdVYezqAbzSNVuoGV/Pe2zN76q+Ou+JPS6KeORmD85TyTcjAmsMNaiqib8bIMMcsjS0tRzmbYMW/6Gwa3O/7Bw3pxXZuKdjUlq/WldHceaKNoP7GtTKjpw= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:48 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:47 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 07/23] net: dsa: ocelot: felix: add per-device-per-port quirks Date: Mon, 15 Nov 2021 22:23:12 -0800 Message-Id: <20211116062328.1949151-8-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1aad6e7-c7ee-4452-5080-08d9a8c9a5e6 X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3F5e969X3sbnOvpsHIB3STZlQcwQidZKBQoPFaOzv01ek9bUzECRcB0hNEGSVhmq7VJpGxEpw2h5POW2qHfVgt2VNP2qVm5GVcWCIigm2vbB0b0AtAq5JB65FzfvNRf/l+D8CQ98rPaVsB9e9IQSLmCMNd9U4Wx6troMhdUEbnHMksjbTgN/mQu8Dt+i8U85sGIJ2v1+oCqOhCtnQP//L1rOcRbAn/gEVrXV2YVNMhOz6Wxb0e7ZE72pxUTQxYVOLNdLFz7bP9VFsNn6rwCv2rbO2h3f84mZVzd3Z4A6qt95Nzmm+oBBd4AlqzPYoBWkBk3b/l1Oj65VUH4NJIU2hhyE+vyCzePD/SfQdWCTKOsPhe69/KIJLD+XkTWk4BC2S7JhVLT1SibHlIfp4eMMj2R8MhdLpYWZvop+yHqmEpmJFoXWz2NliNXkYS4GBG7KGjfpOjMtpMo36IcOnzakQj78616SlEeylLHDhB7ZgTEQXzNkJGh/6T0C+lm5EW6QfWuw0iFOjHdnUPwmdZe0YV6H/GVx84pt000rdI8lF75h4dIFc5x44jbcklo2ysmudUA5fSlEvAlOSjKOaPaFTE+3rOEVJP5+ST7BFcdhrSau4BMa+Y5ppim+uhrrkKoP/gjG4R4VOZsnnSu+xLCwZf9pKXT09/SBtKYYLHh7G8eT7LQlQZd/wix4uVunEgwRoYKptVG4q2Xxf6V1HALrYw== 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:(376002)(136003)(366004)(396003)(39830400003)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(26005)(6506007)(36756003)(66556008)(66476007)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GtHgoFDtgPjEYlQMe8TQpWiCS4L/izk1b3VEqnmLsiB3fbMOlN20udYmFkmKD4VsSGRMxDGzveg+I2X+gHOsQ40cVyly7SyPKB2rGhNuhwhJIRTwsYVQaWJAp6cLtrMauBoNnRzrF5iQmPzRkMa6H35E3o0Hj4SxljkuXFMxTPISGwm1KozGpfp0cIaGQ3GZWtySAlv52izUWvugd6W102nwVFWfnkVKoUoJUOOEDqvMdDNpQumxSlRXWYUPS1j873xw9scOY23BMhC/qVJ8MypHpMdR76EJCGc7t3cLt7x2Rb8ij+c2FE+4F15s9aTUZ6LI7GCz/6YaWr+oWjo/4Iavp9KTOa4JTX/PS+ODuUaVifnGZnaFDc9dcwXYMasEgJQGx9t+/FgW9aRHLJkWiUOqIyh3+gOLYG+4CIsPqjaGL67QT/NreC2s8QSX4nBXCEB9A9nXQqrhijn+V3+Icocl7GvLqoMM9lbV7UBxuCNygSaWsdrHz7qKdb3kfdYxFbykM40gDsXaRrZePu3F3u8y9CMxFzzIT6RoJIGeIUOPEdjNMGiTh2fSvqUqONdFemfIcdF5zxBQuLwhJ6UKzgY77AfgDdv5gLbF9ybJ3GJo6rN9yXUqpwgrllaZeooKl0U9h+tO++8NZrXDFsLajyslNYBbDkJoWA/xGdhtrdb2M9D2hGG+Cn81hjid5GQSagBPDXnwSjJkOOD4lhjVvFmvt8naLR7y5prFTDBS/h1tixszt56a9FwZzb48LHBI0BAUka1mZoKwkij6gCMuokXnvijgbkYOCMGrtbigoPmTTShgugPHsNBztQLqd0MK2h60uM7gYq7tME4nP9Jt6yc2WGkDqJhgIgf+wlojPFcTzmjq6+p5NNSAti+eDv72xO3NhJjh9cCJDkEFVfDiMj2EZmqAoExxumGWOhePYTW7XC1n0J9xRmL0TV+Ck1yMX+IPTkDVeFwHdRc7xfCc/LpPpJZqRmSHZM53t4ottvuTL++EO6aTIQ9aKRaFPjOzNUfZNiJfrGoTRI+njzF0ob3CzLiiwvZyMhO3N1/d7hSV1DkSGVKyyUFbMozPA8FZbwyiZ6nOhPy+Nyf3f/t5fy205JDxOIJ/pWagEOhNFhrtFoy+zqo5gboWpAzM7ynbGmFNyLd6Zf/JLAntB/f0aHNvRDIUTQvocThZU3AMm9hYqltjH2FaN1LBRhnPclPVSgKyohhqAkshWgOyDdeLrAVC2i4HHpB0fyuOTlcbYlHyXQSNdrk4y2UMNeKdNn1QIXNCqsCwisCM4Tt5Ik39rhGmJVGpU/jfEv/W91FZGpiu9mKTHHOJfFwQLkPiwpiz6+Y7GrDR3E0A/ICeiCMGdRtEnDoMaUcdcu6apyEhCwy1Nmyuv8zj0OQ3GgIpg7G+J8agpzwrlz+cTghCyUz5vuwr4VWJWDq0xUiqu2P28VwESN1GFulVctRWrHTeG9nX06e3RPvEfwyKJiZOYqGBUF/hVdNkC7LggwrK8MI7qZkq6Xp5S/XMJNF9xCSuqpFa8IgEjZ9adza3sSzncOd/4yhOWtA7AZe0FW9Pd6NYL0PSFqrXH2xTG5mMNBwXIcmXc0SNLRom8z7E3MwEo3dt2WL/3bzC+8LdsOU6pNoqqtay9cBD21MocBKttYS4dXfZS4SMUAVdj69XelwiRRb4tVdakU+n6V/y1j+vATnhd5A= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1aad6e7-c7ee-4452-5080-08d9a8c9a5e6 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:47.6522 (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: /7JNxto0BcrqIKMeCRZFTtZ1rPlHnkTa2ISRKtBiTNtGJCXnYL3KTztwISDLXE84PZ0s67yf+aIU5k0fqzK2xPz1agJKv4Gbbh5iPZgZXIc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Initial Felix-driver products (VSC9959 and VSC9953) both had quirks where the PCS was in charge of rate adaptation. In the case of the VSC7512 there is a differnce in that some ports (ports 0-3) don't have a PCS and others might have different quirks based on how they are configured. This adds a generic method by which any port can have any quirks that are handled by each device's driver. Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/felix.c | 20 +++++++++++++++++--- drivers/net/dsa/ocelot/felix.h | 4 ++++ drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + drivers/net/dsa/ocelot/seville_vsc9953.c | 1 + 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 615f6b84c688..f53db233148d 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -824,14 +824,25 @@ static void felix_phylink_mac_config(struct dsa_switch *ds, int port, phylink_set_pcs(dp->pl, &felix->pcs[port]->pcs); } +unsigned long felix_quirks_have_rate_adaptation(struct ocelot *ocelot, + int port) +{ + return FELIX_MAC_QUIRKS; +} +EXPORT_SYMBOL(felix_quirks_have_rate_adaptation); + static void felix_phylink_mac_link_down(struct dsa_switch *ds, int port, unsigned int link_an_mode, phy_interface_t interface) { struct ocelot *ocelot = ds->priv; + unsigned long quirks; + struct felix *felix; + felix = ocelot_to_felix(ocelot); + quirks = felix->info->get_quirk_for_port(ocelot, port); ocelot_phylink_mac_link_down(ocelot, port, link_an_mode, interface, - FELIX_MAC_QUIRKS); + quirks); } static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, @@ -842,11 +853,14 @@ static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, bool tx_pause, bool rx_pause) { struct ocelot *ocelot = ds->priv; - struct felix *felix = ocelot_to_felix(ocelot); + unsigned long quirks; + struct felix *felix; + felix = ocelot_to_felix(ocelot); + quirks = felix->info->get_quirk_for_port(ocelot, port); ocelot_phylink_mac_link_up(ocelot, port, phydev, link_an_mode, interface, speed, duplex, tx_pause, rx_pause, - FELIX_MAC_QUIRKS); + 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 81a86bd60f03..b5fa5b7325b1 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -48,6 +48,7 @@ struct felix_info { u32 speed); struct regmap *(*init_regmap)(struct ocelot *ocelot, struct resource *res); + unsigned long (*get_quirk_for_port)(struct ocelot *ocelot, int port); }; extern const struct dsa_switch_ops felix_switch_ops; @@ -68,4 +69,7 @@ struct felix { struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port); int felix_netdev_to_port(struct net_device *dev); +unsigned long felix_quirks_have_rate_adaptation(struct ocelot *ocelot, + int port); + #endif diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 789e1ff0d13b..5056f39dc47e 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1368,6 +1368,7 @@ static const struct felix_info felix_info_vsc9959 = { .port_setup_tc = vsc9959_port_setup_tc, .port_sched_speed_set = vsc9959_sched_speed_set, .init_regmap = ocelot_regmap_init, + .get_quirk_for_port = felix_quirks_have_rate_adaptation, }; static irqreturn_t felix_irq_handler(int irq, void *data) diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 47da279a8ff7..362ba66401d8 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1088,6 +1088,7 @@ static const struct felix_info seville_info_vsc9953 = { .phylink_validate = vsc9953_phylink_validate, .prevalidate_phy_mode = vsc9953_prevalidate_phy_mode, .init_regmap = ocelot_regmap_init, + .get_quirk_for_port = felix_quirks_have_rate_adaptation, }; static int seville_probe(struct platform_device *pdev) From patchwork Tue Nov 16 06:23:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621457 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD979C433FE for ; Tue, 16 Nov 2021 06:26:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A118261A0D for ; Tue, 16 Nov 2021 06:26:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231952AbhKPG3d (ORCPT ); Tue, 16 Nov 2021 01:29:33 -0500 Received: from mail-dm6nam10on2119.outbound.protection.outlook.com ([40.107.93.119]:14080 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230492AbhKPG1X (ORCPT ); Tue, 16 Nov 2021 01:27:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eAPVW9gnbdWO9Zwb5pVumWGumdkgW/EUYyXbd0ZTRzszZkbNAWlNcb2XrQhYRbCxzBDoA/hTLgTyoV9C6193XZcNqt0+8YmfWZVKJlmY4Pj6GzuQIdKewjXw8XtpAzYE7qfVH1YFkv1uZpqAcY+t7bqOrANnyEL7r/XeMYSCwyfbk/weDbV7MkEKe22aMeZmgQUZC7GRwjZXPnG7e/Jwl4QUXXKfthBGzpyLWUeWBqxVdfrcGHCFj+rTTEGEsJbCU0k0w6EYKddkJYTAnf+8y5QPHg+2HiyTfykIkzGNEPXPBqNS6NOc6VTW6VtP0hmEiLFTnV/X9icoHSAkLfw/Xg== 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=oSklLjY3Tp+elM85p/+yCmRWfE0/HQcfWqmJXArIgeA=; b=inP3ttC1t7pv8xAhyBukVwokqOzjTQLYFUSUl+TGz4vbcNVvYuXgSzxD5vRoZ6ubbh6QxTjap81THh0u5l/xxUuNatFMaTIPehJHUHZvIemrrrLoTOkB4oCSbCvgtCBnua6Z8QgMxhJdlxEf0wDUOXouuqwynOCB3KLT2dEDJuH2GR0BNBBxJuFCUDgd/VDTChlUn9XWVsUXW3jiFQE4+0O2rA5uhpgSJDDHucvaw9NOsC6nGkwnZm6Vmw5xTBwChrmDAZ7BVU0eguJxuEMG9VVIBL9BZ2s0G4MHykZTPG7crGlMTFvZG2SEQACLddwxBQNQ60iwLBN3MMxxNkJn9Q== 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=oSklLjY3Tp+elM85p/+yCmRWfE0/HQcfWqmJXArIgeA=; b=L24ZrDM4LDaTLgInvQD5FwTdqdS9DT4Ri2WEMTnK9rBNONzmFNRzKyKSCrh+vm6UJPpCcDwF1YSc23EKelhSVV0PWwUMiBd2TZdHnN97sACNjFttGpNTnC1TgHGVBqJsoVJf7oEkejmuhy7T+YLjf8PL/ISTgN+9wAAJ7L8eoqI= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:48 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:48 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 08/23] net: mscc: ocelot: split register definitions to a separate file Date: Mon, 15 Nov 2021 22:23:13 -0800 Message-Id: <20211116062328.1949151-9-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 48121323-839b-4136-0ffd-08d9a8c9a65a X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:556; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tyn6LtmFJ8lB7ZIOlOduKIH4XMgjQzCNgBEROzzrRbtCnUu4ZQ1YDL/nCsDxWvgaWKf73U4FMn1/OyIwB1Oes/Qtpn2wV0/iI7NJHqvusyo5zog8G6iLCNZBKQXtpcdGgZsMyg61m3e4NeUtIrEIoT64Ih7/i+a7QALsfdN8UeHEiV73imXs779NkvnGQrsmiRz4VUmhiISbUoPZU9vrO8edFIWjMeKOULUiUeeVZSDQcxIawofuOpRTmnZTTCN0tvx/42B6Q5OJpLU0cxtlfD+L9UbDjg2IuXbEH4C44K3yG2pofG9PxNkLwLEdt09Rp2CKrN6MJpKeFIYYD6dCiseJtx2Hd6XmZGOqCV0HnZk+GDt13ySEcspsJC4sZj6DQAWSeYmpiZwe3Fo1JX72YL2UtHfB8cOCblzakUg5gJL/OodlOxseItveW4MEpYV239xdCL2prYijgFEUfW9idiqcPp7c9vZ1Fc6Vmoqy0rw01OCF1jf/fyDuOWYAyADD4rEx6v/qpNDC7auic8q6Z3rK7uDpO0WbRQSZBK5CQZiqP7MMrhLuXqxcfkakV3PFPDbYwh5iUy7v1tag37nWmVAAj+h3hwaDqH8FNTWgOUk80NP4C1NhT27/yAgL5+N7WzOexjiG/4goSIT+UhgByab/4bLrGrwoE6rbKJTOwV0rxViJsYaXDjIv9VOUg85/OEKSwGYimRha1X0H8tOHGg== 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:(376002)(136003)(366004)(396003)(39830400003)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(26005)(6506007)(36756003)(30864003)(66556008)(66476007)(66946007)(579004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fEfMl4/Lv31hLxyjdTX3p9rXVZlzdLAObIbBRIFgA94p1iw3Ji2wFuCfFyaSqw7eoykmhf+r04QDFsvzfBnBJTnPIrKotwHp1ss80wMrav7VaufOKnvQfsEJV/+7MpD4/EkBe9UwWSgYYApgzOzyU/Ib/NXZNjWSqysL+DYARnIWVOLeQswqtv22BPb8zqhxNxVVUw5eO+8uRST8KV9NdIaS91poxVwJEVLoGvKJHAnjccl0juZdEV2NFpj+mBDdnJDoqBWX+fqI9FBSO6Ex4nmRQM2q2rgH1CLOa8vkuurVTdy8wwPPG8qLZC73/K3gpAFFjOSXSfNvwoQi5iIy9n6FjCkLXr+j3PAsEC4sw+uomzNA20RIMXdMyP10BS+lhDhdQefjZXDkYDoNoJ1nYRpQ0MlrRboGpJVAOMLbzSGpwd7ecXcw2BHOoHCup5ZmXP7DkzVzOSImWkhgd820raS60ybuMpVBt75hY6u0Yejcf6NPiuB6GGPuIevZ43NlKOetCbrzeI3JfBIZ0kUnSsCEVd4wMB7lFbV//AZGwymiAZ+8sGD0hSSV/b7+uGZCJRFK8XDRJSAzGS+WX8wescefthwikYGV5KsAw76LBtumgKU4reibgBOiw1SR0sWzSDCs8g+lrgR5obvSdEdeh72NOZwijwtyPDhBxnDOvsQDFShZdbJ8nFz3IxYeII5lEvYbXMzcnoU9WteJW+n/VDxNvZrHungdoAtjj+fwMI5i6uWwVV7kdcOqRuBCpkuWj7gVHRz7Lp2l78J+i8Hg9DFLr6qORmmQMkdCNVENpY/RbvbSonwBgeJ+CSGeKLoEmOGbbq9gm61Xv6+Ks+rgu3LIGefsUkQhEiHSODV3rmaWGvz6g6LUhx6pZhpLWDS1EQGKOIzHE34RZdas1UwL1nioczA0mUNTCtjfL0sJtW1+TzygdDyGmQkMcWKPyaefT++9mr1wg9tErxZjLNNk5aTBtnpK70uvKuALqsWdoAjUdEKDM+vmPJHXMQp1TkWF31xqVMwMZeDujovT3BGyMB3mD3RGoW7xRkkSQh9fLilGxOv41UO7l1TAslAWUSAh25YJNbtvwowAtZp80H1RfQPnr6aB5nVjFeJcgZz3sB5GFR6LZ2jL7cw1bAKu6Lx4R4Gi+OaKhfwxLlvXSyQYk8xD1o4Pgvqoriz4E7GNafmjMKQ/VM124zAG/kDm4bEz0e9JMJ/ZxXK3SPcOwhyWuaY4yu/yrzWoboFJYME92LEzebGbgdgU/gHpy8F7pBKzHFxfjQXlqEXqIQ89qb3Itr9Zxo760Ob0FT0FpWbdWQ8etH22QtPUZzfwaDRU1DJE95pFEItkp8sGMirTHeB/6OGyKfC+fMSQrhxwwMfg691uQMZyrbN6cVIJNiIGAX7SfkfDWATmHOUEOHDuXfhNPxe56uk3LfmswwGQrrXnh374vaVB5VAG5K15DlQ6q4PANgQMCYjtUHi8OPlfEZ+oYUYo4VjoC75kHaWRoP1mfZANJWBNdBqs9yj95etmWp1ld/u53Vfz97VVrfWyZ1z5X2sMQnLb0Dn2AQj0nW5/YNuyh01YyhSbPSOVP7+tEB2LY5WvyKmgVT7iatjc2YdwketntURkxRsbucFpIIkXuinDeRCbRdK5Af2nGXwyMO13Do4zPDyuw4drHEhqjgglLvWB/OnshjurpTVDdeixoFc= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48121323-839b-4136-0ffd-08d9a8c9a65a X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:48.4927 (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: BJ4VWSFfaGWQEPfyCtoDOfUwc4szB+TmRf6r/Y6bVzegV2se0RFkkC4a9cP2QYdyJ2fKbJ+NHQQPnEcd6DPNxofcwSs9L8vtNsfUmrPiiQw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Move these to a separate file will allow them to be shared to other drivers. Signed-off-by: Colin Foster --- drivers/net/ethernet/mscc/Makefile | 3 +- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 520 +------------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 522 +++++++++++++++++++++ include/soc/mscc/vsc7514_regs.h | 27 ++ 4 files changed, 562 insertions(+), 510 deletions(-) create mode 100644 drivers/net/ethernet/mscc/vsc7514_regs.c create mode 100644 include/soc/mscc/vsc7514_regs.h diff --git a/drivers/net/ethernet/mscc/Makefile b/drivers/net/ethernet/mscc/Makefile index 722c27694b21..dfa939376d6c 100644 --- a/drivers/net/ethernet/mscc/Makefile +++ b/drivers/net/ethernet/mscc/Makefile @@ -7,7 +7,8 @@ mscc_ocelot_switch_lib-y := \ ocelot_vcap.o \ ocelot_flower.o \ ocelot_ptp.o \ - ocelot_devlink.o + ocelot_devlink.o \ + vsc7514_regs.o mscc_ocelot_switch_lib-$(CONFIG_BRIDGE_MRP) += ocelot_mrp.o obj-$(CONFIG_MSCC_OCELOT_SWITCH) += mscc_ocelot.o mscc_ocelot-y := \ diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 38103b0255b0..2c763784f69b 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -18,313 +18,20 @@ #include #include +#include #include "ocelot.h" -static const u32 ocelot_ana_regmap[] = { - REG(ANA_ADVLEARN, 0x009000), - REG(ANA_VLANMASK, 0x009004), - REG(ANA_PORT_B_DOMAIN, 0x009008), - REG(ANA_ANAGEFIL, 0x00900c), - REG(ANA_ANEVENTS, 0x009010), - REG(ANA_STORMLIMIT_BURST, 0x009014), - REG(ANA_STORMLIMIT_CFG, 0x009018), - REG(ANA_ISOLATED_PORTS, 0x009028), - REG(ANA_COMMUNITY_PORTS, 0x00902c), - REG(ANA_AUTOAGE, 0x009030), - REG(ANA_MACTOPTIONS, 0x009034), - REG(ANA_LEARNDISC, 0x009038), - REG(ANA_AGENCTRL, 0x00903c), - REG(ANA_MIRRORPORTS, 0x009040), - REG(ANA_EMIRRORPORTS, 0x009044), - REG(ANA_FLOODING, 0x009048), - REG(ANA_FLOODING_IPMC, 0x00904c), - REG(ANA_SFLOW_CFG, 0x009050), - REG(ANA_PORT_MODE, 0x009080), - REG(ANA_PGID_PGID, 0x008c00), - REG(ANA_TABLES_ANMOVED, 0x008b30), - REG(ANA_TABLES_MACHDATA, 0x008b34), - REG(ANA_TABLES_MACLDATA, 0x008b38), - REG(ANA_TABLES_MACACCESS, 0x008b3c), - REG(ANA_TABLES_MACTINDX, 0x008b40), - REG(ANA_TABLES_VLANACCESS, 0x008b44), - REG(ANA_TABLES_VLANTIDX, 0x008b48), - REG(ANA_TABLES_ISDXACCESS, 0x008b4c), - REG(ANA_TABLES_ISDXTIDX, 0x008b50), - REG(ANA_TABLES_ENTRYLIM, 0x008b00), - REG(ANA_TABLES_PTP_ID_HIGH, 0x008b54), - REG(ANA_TABLES_PTP_ID_LOW, 0x008b58), - REG(ANA_MSTI_STATE, 0x008e00), - REG(ANA_PORT_VLAN_CFG, 0x007000), - REG(ANA_PORT_DROP_CFG, 0x007004), - REG(ANA_PORT_QOS_CFG, 0x007008), - REG(ANA_PORT_VCAP_CFG, 0x00700c), - REG(ANA_PORT_VCAP_S1_KEY_CFG, 0x007010), - REG(ANA_PORT_VCAP_S2_CFG, 0x00701c), - REG(ANA_PORT_PCP_DEI_MAP, 0x007020), - REG(ANA_PORT_CPU_FWD_CFG, 0x007060), - REG(ANA_PORT_CPU_FWD_BPDU_CFG, 0x007064), - REG(ANA_PORT_CPU_FWD_GARP_CFG, 0x007068), - REG(ANA_PORT_CPU_FWD_CCM_CFG, 0x00706c), - REG(ANA_PORT_PORT_CFG, 0x007070), - REG(ANA_PORT_POL_CFG, 0x007074), - REG(ANA_PORT_PTP_CFG, 0x007078), - REG(ANA_PORT_PTP_DLY1_CFG, 0x00707c), - REG(ANA_OAM_UPM_LM_CNT, 0x007c00), - REG(ANA_PORT_PTP_DLY2_CFG, 0x007080), - REG(ANA_PFC_PFC_CFG, 0x008800), - REG(ANA_PFC_PFC_TIMER, 0x008804), - REG(ANA_IPT_OAM_MEP_CFG, 0x008000), - REG(ANA_IPT_IPT, 0x008004), - REG(ANA_PPT_PPT, 0x008ac0), - REG(ANA_FID_MAP_FID_MAP, 0x000000), - REG(ANA_AGGR_CFG, 0x0090b4), - REG(ANA_CPUQ_CFG, 0x0090b8), - REG(ANA_CPUQ_CFG2, 0x0090bc), - REG(ANA_CPUQ_8021_CFG, 0x0090c0), - REG(ANA_DSCP_CFG, 0x009100), - REG(ANA_DSCP_REWR_CFG, 0x009200), - REG(ANA_VCAP_RNG_TYPE_CFG, 0x009240), - REG(ANA_VCAP_RNG_VAL_CFG, 0x009260), - REG(ANA_VRAP_CFG, 0x009280), - REG(ANA_VRAP_HDR_DATA, 0x009284), - REG(ANA_VRAP_HDR_MASK, 0x009288), - REG(ANA_DISCARD_CFG, 0x00928c), - REG(ANA_FID_CFG, 0x009290), - REG(ANA_POL_PIR_CFG, 0x004000), - REG(ANA_POL_CIR_CFG, 0x004004), - REG(ANA_POL_MODE_CFG, 0x004008), - REG(ANA_POL_PIR_STATE, 0x00400c), - REG(ANA_POL_CIR_STATE, 0x004010), - REG(ANA_POL_STATE, 0x004014), - REG(ANA_POL_FLOWC, 0x008b80), - REG(ANA_POL_HYST, 0x008bec), - REG(ANA_POL_MISC_CFG, 0x008bf0), -}; - -static const u32 ocelot_qs_regmap[] = { - REG(QS_XTR_GRP_CFG, 0x000000), - REG(QS_XTR_RD, 0x000008), - REG(QS_XTR_FRM_PRUNING, 0x000010), - REG(QS_XTR_FLUSH, 0x000018), - REG(QS_XTR_DATA_PRESENT, 0x00001c), - REG(QS_XTR_CFG, 0x000020), - REG(QS_INJ_GRP_CFG, 0x000024), - REG(QS_INJ_WR, 0x00002c), - REG(QS_INJ_CTRL, 0x000034), - REG(QS_INJ_STATUS, 0x00003c), - REG(QS_INJ_ERR, 0x000040), - REG(QS_INH_DBG, 0x000048), -}; - -static const u32 ocelot_qsys_regmap[] = { - REG(QSYS_PORT_MODE, 0x011200), - REG(QSYS_SWITCH_PORT_MODE, 0x011234), - REG(QSYS_STAT_CNT_CFG, 0x011264), - REG(QSYS_EEE_CFG, 0x011268), - REG(QSYS_EEE_THRES, 0x011294), - REG(QSYS_IGR_NO_SHARING, 0x011298), - REG(QSYS_EGR_NO_SHARING, 0x01129c), - REG(QSYS_SW_STATUS, 0x0112a0), - REG(QSYS_EXT_CPU_CFG, 0x0112d0), - REG(QSYS_PAD_CFG, 0x0112d4), - REG(QSYS_CPU_GROUP_MAP, 0x0112d8), - REG(QSYS_QMAP, 0x0112dc), - REG(QSYS_ISDX_SGRP, 0x011400), - REG(QSYS_TIMED_FRAME_ENTRY, 0x014000), - REG(QSYS_TFRM_MISC, 0x011310), - REG(QSYS_TFRM_PORT_DLY, 0x011314), - REG(QSYS_TFRM_TIMER_CFG_1, 0x011318), - REG(QSYS_TFRM_TIMER_CFG_2, 0x01131c), - REG(QSYS_TFRM_TIMER_CFG_3, 0x011320), - REG(QSYS_TFRM_TIMER_CFG_4, 0x011324), - REG(QSYS_TFRM_TIMER_CFG_5, 0x011328), - REG(QSYS_TFRM_TIMER_CFG_6, 0x01132c), - REG(QSYS_TFRM_TIMER_CFG_7, 0x011330), - REG(QSYS_TFRM_TIMER_CFG_8, 0x011334), - REG(QSYS_RED_PROFILE, 0x011338), - REG(QSYS_RES_QOS_MODE, 0x011378), - REG(QSYS_RES_CFG, 0x012000), - REG(QSYS_RES_STAT, 0x012004), - REG(QSYS_EGR_DROP_MODE, 0x01137c), - REG(QSYS_EQ_CTRL, 0x011380), - REG(QSYS_EVENTS_CORE, 0x011384), - REG(QSYS_CIR_CFG, 0x000000), - REG(QSYS_EIR_CFG, 0x000004), - REG(QSYS_SE_CFG, 0x000008), - REG(QSYS_SE_DWRR_CFG, 0x00000c), - REG(QSYS_SE_CONNECT, 0x00003c), - REG(QSYS_SE_DLB_SENSE, 0x000040), - REG(QSYS_CIR_STATE, 0x000044), - REG(QSYS_EIR_STATE, 0x000048), - REG(QSYS_SE_STATE, 0x00004c), - REG(QSYS_HSCH_MISC_CFG, 0x011388), -}; - -static const u32 ocelot_rew_regmap[] = { - REG(REW_PORT_VLAN_CFG, 0x000000), - REG(REW_TAG_CFG, 0x000004), - REG(REW_PORT_CFG, 0x000008), - REG(REW_DSCP_CFG, 0x00000c), - REG(REW_PCP_DEI_QOS_MAP_CFG, 0x000010), - REG(REW_PTP_CFG, 0x000050), - REG(REW_PTP_DLY1_CFG, 0x000054), - REG(REW_DSCP_REMAP_DP1_CFG, 0x000690), - REG(REW_DSCP_REMAP_CFG, 0x000790), - REG(REW_STAT_CFG, 0x000890), - REG(REW_PPT, 0x000680), -}; - -static const u32 ocelot_sys_regmap[] = { - REG(SYS_COUNT_RX_OCTETS, 0x000000), - REG(SYS_COUNT_RX_UNICAST, 0x000004), - REG(SYS_COUNT_RX_MULTICAST, 0x000008), - REG(SYS_COUNT_RX_BROADCAST, 0x00000c), - REG(SYS_COUNT_RX_SHORTS, 0x000010), - REG(SYS_COUNT_RX_FRAGMENTS, 0x000014), - REG(SYS_COUNT_RX_JABBERS, 0x000018), - REG(SYS_COUNT_RX_CRC_ALIGN_ERRS, 0x00001c), - REG(SYS_COUNT_RX_SYM_ERRS, 0x000020), - REG(SYS_COUNT_RX_64, 0x000024), - REG(SYS_COUNT_RX_65_127, 0x000028), - REG(SYS_COUNT_RX_128_255, 0x00002c), - REG(SYS_COUNT_RX_256_1023, 0x000030), - REG(SYS_COUNT_RX_1024_1526, 0x000034), - REG(SYS_COUNT_RX_1527_MAX, 0x000038), - REG(SYS_COUNT_RX_PAUSE, 0x00003c), - REG(SYS_COUNT_RX_CONTROL, 0x000040), - REG(SYS_COUNT_RX_LONGS, 0x000044), - REG(SYS_COUNT_RX_CLASSIFIED_DROPS, 0x000048), - REG(SYS_COUNT_TX_OCTETS, 0x000100), - REG(SYS_COUNT_TX_UNICAST, 0x000104), - REG(SYS_COUNT_TX_MULTICAST, 0x000108), - REG(SYS_COUNT_TX_BROADCAST, 0x00010c), - REG(SYS_COUNT_TX_COLLISION, 0x000110), - REG(SYS_COUNT_TX_DROPS, 0x000114), - REG(SYS_COUNT_TX_PAUSE, 0x000118), - REG(SYS_COUNT_TX_64, 0x00011c), - REG(SYS_COUNT_TX_65_127, 0x000120), - REG(SYS_COUNT_TX_128_511, 0x000124), - REG(SYS_COUNT_TX_512_1023, 0x000128), - REG(SYS_COUNT_TX_1024_1526, 0x00012c), - REG(SYS_COUNT_TX_1527_MAX, 0x000130), - REG(SYS_COUNT_TX_AGING, 0x000170), - REG(SYS_RESET_CFG, 0x000508), - REG(SYS_CMID, 0x00050c), - REG(SYS_VLAN_ETYPE_CFG, 0x000510), - REG(SYS_PORT_MODE, 0x000514), - REG(SYS_FRONT_PORT_MODE, 0x000548), - REG(SYS_FRM_AGING, 0x000574), - REG(SYS_STAT_CFG, 0x000578), - REG(SYS_SW_STATUS, 0x00057c), - REG(SYS_MISC_CFG, 0x0005ac), - REG(SYS_REW_MAC_HIGH_CFG, 0x0005b0), - REG(SYS_REW_MAC_LOW_CFG, 0x0005dc), - REG(SYS_CM_ADDR, 0x000500), - REG(SYS_CM_DATA, 0x000504), - REG(SYS_PAUSE_CFG, 0x000608), - REG(SYS_PAUSE_TOT_CFG, 0x000638), - REG(SYS_ATOP, 0x00063c), - REG(SYS_ATOP_TOT_CFG, 0x00066c), - REG(SYS_MAC_FC_CFG, 0x000670), - REG(SYS_MMGT, 0x00069c), - REG(SYS_MMGT_FAST, 0x0006a0), - REG(SYS_EVENTS_DIF, 0x0006a4), - REG(SYS_EVENTS_CORE, 0x0006b4), - REG(SYS_CNT, 0x000000), - REG(SYS_PTP_STATUS, 0x0006b8), - REG(SYS_PTP_TXSTAMP, 0x0006bc), - REG(SYS_PTP_NXT, 0x0006c0), - REG(SYS_PTP_CFG, 0x0006c4), -}; - -static const u32 ocelot_vcap_regmap[] = { - /* VCAP_CORE_CFG */ - REG(VCAP_CORE_UPDATE_CTRL, 0x000000), - REG(VCAP_CORE_MV_CFG, 0x000004), - /* VCAP_CORE_CACHE */ - REG(VCAP_CACHE_ENTRY_DAT, 0x000008), - REG(VCAP_CACHE_MASK_DAT, 0x000108), - REG(VCAP_CACHE_ACTION_DAT, 0x000208), - REG(VCAP_CACHE_CNT_DAT, 0x000308), - REG(VCAP_CACHE_TG_DAT, 0x000388), - /* VCAP_CONST */ - REG(VCAP_CONST_VCAP_VER, 0x000398), - REG(VCAP_CONST_ENTRY_WIDTH, 0x00039c), - REG(VCAP_CONST_ENTRY_CNT, 0x0003a0), - REG(VCAP_CONST_ENTRY_SWCNT, 0x0003a4), - REG(VCAP_CONST_ENTRY_TG_WIDTH, 0x0003a8), - REG(VCAP_CONST_ACTION_DEF_CNT, 0x0003ac), - REG(VCAP_CONST_ACTION_WIDTH, 0x0003b0), - REG(VCAP_CONST_CNT_WIDTH, 0x0003b4), - REG(VCAP_CONST_CORE_CNT, 0x0003b8), - REG(VCAP_CONST_IF_CNT, 0x0003bc), -}; - -static const u32 ocelot_ptp_regmap[] = { - REG(PTP_PIN_CFG, 0x000000), - REG(PTP_PIN_TOD_SEC_MSB, 0x000004), - REG(PTP_PIN_TOD_SEC_LSB, 0x000008), - REG(PTP_PIN_TOD_NSEC, 0x00000c), - REG(PTP_PIN_WF_HIGH_PERIOD, 0x000014), - REG(PTP_PIN_WF_LOW_PERIOD, 0x000018), - REG(PTP_CFG_MISC, 0x0000a0), - REG(PTP_CLK_CFG_ADJ_CFG, 0x0000a4), - REG(PTP_CLK_CFG_ADJ_FREQ, 0x0000a8), -}; - -static const u32 ocelot_dev_gmii_regmap[] = { - REG(DEV_CLOCK_CFG, 0x0), - REG(DEV_PORT_MISC, 0x4), - REG(DEV_EVENTS, 0x8), - REG(DEV_EEE_CFG, 0xc), - REG(DEV_RX_PATH_DELAY, 0x10), - REG(DEV_TX_PATH_DELAY, 0x14), - REG(DEV_PTP_PREDICT_CFG, 0x18), - REG(DEV_MAC_ENA_CFG, 0x1c), - REG(DEV_MAC_MODE_CFG, 0x20), - REG(DEV_MAC_MAXLEN_CFG, 0x24), - REG(DEV_MAC_TAGS_CFG, 0x28), - REG(DEV_MAC_ADV_CHK_CFG, 0x2c), - REG(DEV_MAC_IFG_CFG, 0x30), - REG(DEV_MAC_HDX_CFG, 0x34), - REG(DEV_MAC_DBG_CFG, 0x38), - REG(DEV_MAC_FC_MAC_LOW_CFG, 0x3c), - REG(DEV_MAC_FC_MAC_HIGH_CFG, 0x40), - REG(DEV_MAC_STICKY, 0x44), - REG(PCS1G_CFG, 0x48), - REG(PCS1G_MODE_CFG, 0x4c), - REG(PCS1G_SD_CFG, 0x50), - REG(PCS1G_ANEG_CFG, 0x54), - REG(PCS1G_ANEG_NP_CFG, 0x58), - REG(PCS1G_LB_CFG, 0x5c), - REG(PCS1G_DBG_CFG, 0x60), - REG(PCS1G_CDET_CFG, 0x64), - REG(PCS1G_ANEG_STATUS, 0x68), - REG(PCS1G_ANEG_NP_STATUS, 0x6c), - REG(PCS1G_LINK_STATUS, 0x70), - REG(PCS1G_LINK_DOWN_CNT, 0x74), - REG(PCS1G_STICKY, 0x78), - REG(PCS1G_DEBUG_STATUS, 0x7c), - REG(PCS1G_LPI_CFG, 0x80), - REG(PCS1G_LPI_WAKE_ERROR_CNT, 0x84), - REG(PCS1G_LPI_STATUS, 0x88), - REG(PCS1G_TSTPAT_MODE_CFG, 0x8c), - REG(PCS1G_TSTPAT_STATUS, 0x90), - REG(DEV_PCS_FX100_CFG, 0x94), - REG(DEV_PCS_FX100_STATUS, 0x98), -}; - static const u32 *ocelot_regmap[TARGET_MAX] = { - [ANA] = ocelot_ana_regmap, - [QS] = ocelot_qs_regmap, - [QSYS] = ocelot_qsys_regmap, - [REW] = ocelot_rew_regmap, - [SYS] = ocelot_sys_regmap, - [S0] = ocelot_vcap_regmap, - [S1] = ocelot_vcap_regmap, - [S2] = ocelot_vcap_regmap, - [PTP] = ocelot_ptp_regmap, - [DEV_GMII] = ocelot_dev_gmii_regmap, + [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, + [DEV_GMII] = vsc7514_dev_gmii_regmap, }; static const struct reg_field ocelot_regfields[REGFIELD_MAX] = { @@ -633,211 +340,6 @@ static const struct ocelot_ops ocelot_ops = { .netdev_to_port = ocelot_netdev_to_port, }; -static const struct vcap_field vsc7514_vcap_es0_keys[] = { - [VCAP_ES0_EGR_PORT] = { 0, 4}, - [VCAP_ES0_IGR_PORT] = { 4, 4}, - [VCAP_ES0_RSV] = { 8, 2}, - [VCAP_ES0_L2_MC] = { 10, 1}, - [VCAP_ES0_L2_BC] = { 11, 1}, - [VCAP_ES0_VID] = { 12, 12}, - [VCAP_ES0_DP] = { 24, 1}, - [VCAP_ES0_PCP] = { 25, 3}, -}; - -static const struct vcap_field vsc7514_vcap_es0_actions[] = { - [VCAP_ES0_ACT_PUSH_OUTER_TAG] = { 0, 2}, - [VCAP_ES0_ACT_PUSH_INNER_TAG] = { 2, 1}, - [VCAP_ES0_ACT_TAG_A_TPID_SEL] = { 3, 2}, - [VCAP_ES0_ACT_TAG_A_VID_SEL] = { 5, 1}, - [VCAP_ES0_ACT_TAG_A_PCP_SEL] = { 6, 2}, - [VCAP_ES0_ACT_TAG_A_DEI_SEL] = { 8, 2}, - [VCAP_ES0_ACT_TAG_B_TPID_SEL] = { 10, 2}, - [VCAP_ES0_ACT_TAG_B_VID_SEL] = { 12, 1}, - [VCAP_ES0_ACT_TAG_B_PCP_SEL] = { 13, 2}, - [VCAP_ES0_ACT_TAG_B_DEI_SEL] = { 15, 2}, - [VCAP_ES0_ACT_VID_A_VAL] = { 17, 12}, - [VCAP_ES0_ACT_PCP_A_VAL] = { 29, 3}, - [VCAP_ES0_ACT_DEI_A_VAL] = { 32, 1}, - [VCAP_ES0_ACT_VID_B_VAL] = { 33, 12}, - [VCAP_ES0_ACT_PCP_B_VAL] = { 45, 3}, - [VCAP_ES0_ACT_DEI_B_VAL] = { 48, 1}, - [VCAP_ES0_ACT_RSV] = { 49, 24}, - [VCAP_ES0_ACT_HIT_STICKY] = { 73, 1}, -}; - -static const struct vcap_field vsc7514_vcap_is1_keys[] = { - [VCAP_IS1_HK_TYPE] = { 0, 1}, - [VCAP_IS1_HK_LOOKUP] = { 1, 2}, - [VCAP_IS1_HK_IGR_PORT_MASK] = { 3, 12}, - [VCAP_IS1_HK_RSV] = { 15, 9}, - [VCAP_IS1_HK_OAM_Y1731] = { 24, 1}, - [VCAP_IS1_HK_L2_MC] = { 25, 1}, - [VCAP_IS1_HK_L2_BC] = { 26, 1}, - [VCAP_IS1_HK_IP_MC] = { 27, 1}, - [VCAP_IS1_HK_VLAN_TAGGED] = { 28, 1}, - [VCAP_IS1_HK_VLAN_DBL_TAGGED] = { 29, 1}, - [VCAP_IS1_HK_TPID] = { 30, 1}, - [VCAP_IS1_HK_VID] = { 31, 12}, - [VCAP_IS1_HK_DEI] = { 43, 1}, - [VCAP_IS1_HK_PCP] = { 44, 3}, - /* Specific Fields for IS1 Half Key S1_NORMAL */ - [VCAP_IS1_HK_L2_SMAC] = { 47, 48}, - [VCAP_IS1_HK_ETYPE_LEN] = { 95, 1}, - [VCAP_IS1_HK_ETYPE] = { 96, 16}, - [VCAP_IS1_HK_IP_SNAP] = {112, 1}, - [VCAP_IS1_HK_IP4] = {113, 1}, - /* Layer-3 Information */ - [VCAP_IS1_HK_L3_FRAGMENT] = {114, 1}, - [VCAP_IS1_HK_L3_FRAG_OFS_GT0] = {115, 1}, - [VCAP_IS1_HK_L3_OPTIONS] = {116, 1}, - [VCAP_IS1_HK_L3_DSCP] = {117, 6}, - [VCAP_IS1_HK_L3_IP4_SIP] = {123, 32}, - /* Layer-4 Information */ - [VCAP_IS1_HK_TCP_UDP] = {155, 1}, - [VCAP_IS1_HK_TCP] = {156, 1}, - [VCAP_IS1_HK_L4_SPORT] = {157, 16}, - [VCAP_IS1_HK_L4_RNG] = {173, 8}, - /* Specific Fields for IS1 Half Key S1_5TUPLE_IP4 */ - [VCAP_IS1_HK_IP4_INNER_TPID] = { 47, 1}, - [VCAP_IS1_HK_IP4_INNER_VID] = { 48, 12}, - [VCAP_IS1_HK_IP4_INNER_DEI] = { 60, 1}, - [VCAP_IS1_HK_IP4_INNER_PCP] = { 61, 3}, - [VCAP_IS1_HK_IP4_IP4] = { 64, 1}, - [VCAP_IS1_HK_IP4_L3_FRAGMENT] = { 65, 1}, - [VCAP_IS1_HK_IP4_L3_FRAG_OFS_GT0] = { 66, 1}, - [VCAP_IS1_HK_IP4_L3_OPTIONS] = { 67, 1}, - [VCAP_IS1_HK_IP4_L3_DSCP] = { 68, 6}, - [VCAP_IS1_HK_IP4_L3_IP4_DIP] = { 74, 32}, - [VCAP_IS1_HK_IP4_L3_IP4_SIP] = {106, 32}, - [VCAP_IS1_HK_IP4_L3_PROTO] = {138, 8}, - [VCAP_IS1_HK_IP4_TCP_UDP] = {146, 1}, - [VCAP_IS1_HK_IP4_TCP] = {147, 1}, - [VCAP_IS1_HK_IP4_L4_RNG] = {148, 8}, - [VCAP_IS1_HK_IP4_IP_PAYLOAD_S1_5TUPLE] = {156, 32}, -}; - -static const struct vcap_field vsc7514_vcap_is1_actions[] = { - [VCAP_IS1_ACT_DSCP_ENA] = { 0, 1}, - [VCAP_IS1_ACT_DSCP_VAL] = { 1, 6}, - [VCAP_IS1_ACT_QOS_ENA] = { 7, 1}, - [VCAP_IS1_ACT_QOS_VAL] = { 8, 3}, - [VCAP_IS1_ACT_DP_ENA] = { 11, 1}, - [VCAP_IS1_ACT_DP_VAL] = { 12, 1}, - [VCAP_IS1_ACT_PAG_OVERRIDE_MASK] = { 13, 8}, - [VCAP_IS1_ACT_PAG_VAL] = { 21, 8}, - [VCAP_IS1_ACT_RSV] = { 29, 9}, - /* The fields below are incorrectly shifted by 2 in the manual */ - [VCAP_IS1_ACT_VID_REPLACE_ENA] = { 38, 1}, - [VCAP_IS1_ACT_VID_ADD_VAL] = { 39, 12}, - [VCAP_IS1_ACT_FID_SEL] = { 51, 2}, - [VCAP_IS1_ACT_FID_VAL] = { 53, 13}, - [VCAP_IS1_ACT_PCP_DEI_ENA] = { 66, 1}, - [VCAP_IS1_ACT_PCP_VAL] = { 67, 3}, - [VCAP_IS1_ACT_DEI_VAL] = { 70, 1}, - [VCAP_IS1_ACT_VLAN_POP_CNT_ENA] = { 71, 1}, - [VCAP_IS1_ACT_VLAN_POP_CNT] = { 72, 2}, - [VCAP_IS1_ACT_CUSTOM_ACE_TYPE_ENA] = { 74, 4}, - [VCAP_IS1_ACT_HIT_STICKY] = { 78, 1}, -}; - -static const struct vcap_field vsc7514_vcap_is2_keys[] = { - /* Common: 46 bits */ - [VCAP_IS2_TYPE] = { 0, 4}, - [VCAP_IS2_HK_FIRST] = { 4, 1}, - [VCAP_IS2_HK_PAG] = { 5, 8}, - [VCAP_IS2_HK_IGR_PORT_MASK] = { 13, 12}, - [VCAP_IS2_HK_RSV2] = { 25, 1}, - [VCAP_IS2_HK_HOST_MATCH] = { 26, 1}, - [VCAP_IS2_HK_L2_MC] = { 27, 1}, - [VCAP_IS2_HK_L2_BC] = { 28, 1}, - [VCAP_IS2_HK_VLAN_TAGGED] = { 29, 1}, - [VCAP_IS2_HK_VID] = { 30, 12}, - [VCAP_IS2_HK_DEI] = { 42, 1}, - [VCAP_IS2_HK_PCP] = { 43, 3}, - /* MAC_ETYPE / MAC_LLC / MAC_SNAP / OAM common */ - [VCAP_IS2_HK_L2_DMAC] = { 46, 48}, - [VCAP_IS2_HK_L2_SMAC] = { 94, 48}, - /* MAC_ETYPE (TYPE=000) */ - [VCAP_IS2_HK_MAC_ETYPE_ETYPE] = {142, 16}, - [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD0] = {158, 16}, - [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD1] = {174, 8}, - [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD2] = {182, 3}, - /* MAC_LLC (TYPE=001) */ - [VCAP_IS2_HK_MAC_LLC_L2_LLC] = {142, 40}, - /* MAC_SNAP (TYPE=010) */ - [VCAP_IS2_HK_MAC_SNAP_L2_SNAP] = {142, 40}, - /* MAC_ARP (TYPE=011) */ - [VCAP_IS2_HK_MAC_ARP_SMAC] = { 46, 48}, - [VCAP_IS2_HK_MAC_ARP_ADDR_SPACE_OK] = { 94, 1}, - [VCAP_IS2_HK_MAC_ARP_PROTO_SPACE_OK] = { 95, 1}, - [VCAP_IS2_HK_MAC_ARP_LEN_OK] = { 96, 1}, - [VCAP_IS2_HK_MAC_ARP_TARGET_MATCH] = { 97, 1}, - [VCAP_IS2_HK_MAC_ARP_SENDER_MATCH] = { 98, 1}, - [VCAP_IS2_HK_MAC_ARP_OPCODE_UNKNOWN] = { 99, 1}, - [VCAP_IS2_HK_MAC_ARP_OPCODE] = {100, 2}, - [VCAP_IS2_HK_MAC_ARP_L3_IP4_DIP] = {102, 32}, - [VCAP_IS2_HK_MAC_ARP_L3_IP4_SIP] = {134, 32}, - [VCAP_IS2_HK_MAC_ARP_DIP_EQ_SIP] = {166, 1}, - /* IP4_TCP_UDP / IP4_OTHER common */ - [VCAP_IS2_HK_IP4] = { 46, 1}, - [VCAP_IS2_HK_L3_FRAGMENT] = { 47, 1}, - [VCAP_IS2_HK_L3_FRAG_OFS_GT0] = { 48, 1}, - [VCAP_IS2_HK_L3_OPTIONS] = { 49, 1}, - [VCAP_IS2_HK_IP4_L3_TTL_GT0] = { 50, 1}, - [VCAP_IS2_HK_L3_TOS] = { 51, 8}, - [VCAP_IS2_HK_L3_IP4_DIP] = { 59, 32}, - [VCAP_IS2_HK_L3_IP4_SIP] = { 91, 32}, - [VCAP_IS2_HK_DIP_EQ_SIP] = {123, 1}, - /* IP4_TCP_UDP (TYPE=100) */ - [VCAP_IS2_HK_TCP] = {124, 1}, - [VCAP_IS2_HK_L4_DPORT] = {125, 16}, - [VCAP_IS2_HK_L4_SPORT] = {141, 16}, - [VCAP_IS2_HK_L4_RNG] = {157, 8}, - [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {165, 1}, - [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {166, 1}, - [VCAP_IS2_HK_L4_FIN] = {167, 1}, - [VCAP_IS2_HK_L4_SYN] = {168, 1}, - [VCAP_IS2_HK_L4_RST] = {169, 1}, - [VCAP_IS2_HK_L4_PSH] = {170, 1}, - [VCAP_IS2_HK_L4_ACK] = {171, 1}, - [VCAP_IS2_HK_L4_URG] = {172, 1}, - [VCAP_IS2_HK_L4_1588_DOM] = {173, 8}, - [VCAP_IS2_HK_L4_1588_VER] = {181, 4}, - /* IP4_OTHER (TYPE=101) */ - [VCAP_IS2_HK_IP4_L3_PROTO] = {124, 8}, - [VCAP_IS2_HK_L3_PAYLOAD] = {132, 56}, - /* IP6_STD (TYPE=110) */ - [VCAP_IS2_HK_IP6_L3_TTL_GT0] = { 46, 1}, - [VCAP_IS2_HK_L3_IP6_SIP] = { 47, 128}, - [VCAP_IS2_HK_IP6_L3_PROTO] = {175, 8}, - /* OAM (TYPE=111) */ - [VCAP_IS2_HK_OAM_MEL_FLAGS] = {142, 7}, - [VCAP_IS2_HK_OAM_VER] = {149, 5}, - [VCAP_IS2_HK_OAM_OPCODE] = {154, 8}, - [VCAP_IS2_HK_OAM_FLAGS] = {162, 8}, - [VCAP_IS2_HK_OAM_MEPID] = {170, 16}, - [VCAP_IS2_HK_OAM_CCM_CNTS_EQ0] = {186, 1}, - [VCAP_IS2_HK_OAM_IS_Y1731] = {187, 1}, -}; - -static const struct vcap_field vsc7514_vcap_is2_actions[] = { - [VCAP_IS2_ACT_HIT_ME_ONCE] = { 0, 1}, - [VCAP_IS2_ACT_CPU_COPY_ENA] = { 1, 1}, - [VCAP_IS2_ACT_CPU_QU_NUM] = { 2, 3}, - [VCAP_IS2_ACT_MASK_MODE] = { 5, 2}, - [VCAP_IS2_ACT_MIRROR_ENA] = { 7, 1}, - [VCAP_IS2_ACT_LRN_DIS] = { 8, 1}, - [VCAP_IS2_ACT_POLICE_ENA] = { 9, 1}, - [VCAP_IS2_ACT_POLICE_IDX] = { 10, 9}, - [VCAP_IS2_ACT_POLICE_VCAP_ONLY] = { 19, 1}, - [VCAP_IS2_ACT_PORT_MASK] = { 20, 11}, - [VCAP_IS2_ACT_REW_OP] = { 31, 9}, - [VCAP_IS2_ACT_SMAC_REPLACE_ENA] = { 40, 1}, - [VCAP_IS2_ACT_RSV] = { 41, 2}, - [VCAP_IS2_ACT_ACL_ID] = { 43, 6}, - [VCAP_IS2_ACT_HIT_CNT] = { 49, 32}, -}; - static struct vcap_props vsc7514_vcap_props[] = { [VCAP_ES0] = { .action_type_width = 0, diff --git a/drivers/net/ethernet/mscc/vsc7514_regs.c b/drivers/net/ethernet/mscc/vsc7514_regs.c new file mode 100644 index 000000000000..b041756d1b78 --- /dev/null +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c @@ -0,0 +1,522 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Microsemi Ocelot Switch driver + * + * Copyright (c) 2017 Microsemi Corporation + * Copyright (c) 2021 Innovative Advantage + */ +#include +#include "ocelot.h" + +const u32 vsc7514_ana_regmap[] = { + REG(ANA_ADVLEARN, 0x009000), + REG(ANA_VLANMASK, 0x009004), + REG(ANA_PORT_B_DOMAIN, 0x009008), + REG(ANA_ANAGEFIL, 0x00900c), + REG(ANA_ANEVENTS, 0x009010), + REG(ANA_STORMLIMIT_BURST, 0x009014), + REG(ANA_STORMLIMIT_CFG, 0x009018), + REG(ANA_ISOLATED_PORTS, 0x009028), + REG(ANA_COMMUNITY_PORTS, 0x00902c), + REG(ANA_AUTOAGE, 0x009030), + REG(ANA_MACTOPTIONS, 0x009034), + REG(ANA_LEARNDISC, 0x009038), + REG(ANA_AGENCTRL, 0x00903c), + REG(ANA_MIRRORPORTS, 0x009040), + REG(ANA_EMIRRORPORTS, 0x009044), + REG(ANA_FLOODING, 0x009048), + REG(ANA_FLOODING_IPMC, 0x00904c), + REG(ANA_SFLOW_CFG, 0x009050), + REG(ANA_PORT_MODE, 0x009080), + REG(ANA_PGID_PGID, 0x008c00), + REG(ANA_TABLES_ANMOVED, 0x008b30), + REG(ANA_TABLES_MACHDATA, 0x008b34), + REG(ANA_TABLES_MACLDATA, 0x008b38), + REG(ANA_TABLES_MACACCESS, 0x008b3c), + REG(ANA_TABLES_MACTINDX, 0x008b40), + REG(ANA_TABLES_VLANACCESS, 0x008b44), + REG(ANA_TABLES_VLANTIDX, 0x008b48), + REG(ANA_TABLES_ISDXACCESS, 0x008b4c), + REG(ANA_TABLES_ISDXTIDX, 0x008b50), + REG(ANA_TABLES_ENTRYLIM, 0x008b00), + REG(ANA_TABLES_PTP_ID_HIGH, 0x008b54), + REG(ANA_TABLES_PTP_ID_LOW, 0x008b58), + REG(ANA_MSTI_STATE, 0x008e00), + REG(ANA_PORT_VLAN_CFG, 0x007000), + REG(ANA_PORT_DROP_CFG, 0x007004), + REG(ANA_PORT_QOS_CFG, 0x007008), + REG(ANA_PORT_VCAP_CFG, 0x00700c), + REG(ANA_PORT_VCAP_S1_KEY_CFG, 0x007010), + REG(ANA_PORT_VCAP_S2_CFG, 0x00701c), + REG(ANA_PORT_PCP_DEI_MAP, 0x007020), + REG(ANA_PORT_CPU_FWD_CFG, 0x007060), + REG(ANA_PORT_CPU_FWD_BPDU_CFG, 0x007064), + REG(ANA_PORT_CPU_FWD_GARP_CFG, 0x007068), + REG(ANA_PORT_CPU_FWD_CCM_CFG, 0x00706c), + REG(ANA_PORT_PORT_CFG, 0x007070), + REG(ANA_PORT_POL_CFG, 0x007074), + REG(ANA_PORT_PTP_CFG, 0x007078), + REG(ANA_PORT_PTP_DLY1_CFG, 0x00707c), + REG(ANA_OAM_UPM_LM_CNT, 0x007c00), + REG(ANA_PORT_PTP_DLY2_CFG, 0x007080), + REG(ANA_PFC_PFC_CFG, 0x008800), + REG(ANA_PFC_PFC_TIMER, 0x008804), + REG(ANA_IPT_OAM_MEP_CFG, 0x008000), + REG(ANA_IPT_IPT, 0x008004), + REG(ANA_PPT_PPT, 0x008ac0), + REG(ANA_FID_MAP_FID_MAP, 0x000000), + REG(ANA_AGGR_CFG, 0x0090b4), + REG(ANA_CPUQ_CFG, 0x0090b8), + REG(ANA_CPUQ_CFG2, 0x0090bc), + REG(ANA_CPUQ_8021_CFG, 0x0090c0), + REG(ANA_DSCP_CFG, 0x009100), + REG(ANA_DSCP_REWR_CFG, 0x009200), + REG(ANA_VCAP_RNG_TYPE_CFG, 0x009240), + REG(ANA_VCAP_RNG_VAL_CFG, 0x009260), + REG(ANA_VRAP_CFG, 0x009280), + REG(ANA_VRAP_HDR_DATA, 0x009284), + REG(ANA_VRAP_HDR_MASK, 0x009288), + REG(ANA_DISCARD_CFG, 0x00928c), + REG(ANA_FID_CFG, 0x009290), + REG(ANA_POL_PIR_CFG, 0x004000), + REG(ANA_POL_CIR_CFG, 0x004004), + REG(ANA_POL_MODE_CFG, 0x004008), + REG(ANA_POL_PIR_STATE, 0x00400c), + REG(ANA_POL_CIR_STATE, 0x004010), + REG(ANA_POL_STATE, 0x004014), + REG(ANA_POL_FLOWC, 0x008b80), + REG(ANA_POL_HYST, 0x008bec), + REG(ANA_POL_MISC_CFG, 0x008bf0), +}; +EXPORT_SYMBOL(vsc7514_ana_regmap); + +const u32 vsc7514_qs_regmap[] = { + REG(QS_XTR_GRP_CFG, 0x000000), + REG(QS_XTR_RD, 0x000008), + REG(QS_XTR_FRM_PRUNING, 0x000010), + REG(QS_XTR_FLUSH, 0x000018), + REG(QS_XTR_DATA_PRESENT, 0x00001c), + REG(QS_XTR_CFG, 0x000020), + REG(QS_INJ_GRP_CFG, 0x000024), + REG(QS_INJ_WR, 0x00002c), + REG(QS_INJ_CTRL, 0x000034), + REG(QS_INJ_STATUS, 0x00003c), + REG(QS_INJ_ERR, 0x000040), + REG(QS_INH_DBG, 0x000048), +}; +EXPORT_SYMBOL(vsc7514_qs_regmap); + +const u32 vsc7514_qsys_regmap[] = { + REG(QSYS_PORT_MODE, 0x011200), + REG(QSYS_SWITCH_PORT_MODE, 0x011234), + REG(QSYS_STAT_CNT_CFG, 0x011264), + REG(QSYS_EEE_CFG, 0x011268), + REG(QSYS_EEE_THRES, 0x011294), + REG(QSYS_IGR_NO_SHARING, 0x011298), + REG(QSYS_EGR_NO_SHARING, 0x01129c), + REG(QSYS_SW_STATUS, 0x0112a0), + REG(QSYS_EXT_CPU_CFG, 0x0112d0), + REG(QSYS_PAD_CFG, 0x0112d4), + REG(QSYS_CPU_GROUP_MAP, 0x0112d8), + REG(QSYS_QMAP, 0x0112dc), + REG(QSYS_ISDX_SGRP, 0x011400), + REG(QSYS_TIMED_FRAME_ENTRY, 0x014000), + REG(QSYS_TFRM_MISC, 0x011310), + REG(QSYS_TFRM_PORT_DLY, 0x011314), + REG(QSYS_TFRM_TIMER_CFG_1, 0x011318), + REG(QSYS_TFRM_TIMER_CFG_2, 0x01131c), + REG(QSYS_TFRM_TIMER_CFG_3, 0x011320), + REG(QSYS_TFRM_TIMER_CFG_4, 0x011324), + REG(QSYS_TFRM_TIMER_CFG_5, 0x011328), + REG(QSYS_TFRM_TIMER_CFG_6, 0x01132c), + REG(QSYS_TFRM_TIMER_CFG_7, 0x011330), + REG(QSYS_TFRM_TIMER_CFG_8, 0x011334), + REG(QSYS_RED_PROFILE, 0x011338), + REG(QSYS_RES_QOS_MODE, 0x011378), + REG(QSYS_RES_CFG, 0x012000), + REG(QSYS_RES_STAT, 0x012004), + REG(QSYS_EGR_DROP_MODE, 0x01137c), + REG(QSYS_EQ_CTRL, 0x011380), + REG(QSYS_EVENTS_CORE, 0x011384), + REG(QSYS_CIR_CFG, 0x000000), + REG(QSYS_EIR_CFG, 0x000004), + REG(QSYS_SE_CFG, 0x000008), + REG(QSYS_SE_DWRR_CFG, 0x00000c), + REG(QSYS_SE_CONNECT, 0x00003c), + REG(QSYS_SE_DLB_SENSE, 0x000040), + REG(QSYS_CIR_STATE, 0x000044), + REG(QSYS_EIR_STATE, 0x000048), + REG(QSYS_SE_STATE, 0x00004c), + REG(QSYS_HSCH_MISC_CFG, 0x011388), +}; +EXPORT_SYMBOL(vsc7514_qsys_regmap); + +const u32 vsc7514_rew_regmap[] = { + REG(REW_PORT_VLAN_CFG, 0x000000), + REG(REW_TAG_CFG, 0x000004), + REG(REW_PORT_CFG, 0x000008), + REG(REW_DSCP_CFG, 0x00000c), + REG(REW_PCP_DEI_QOS_MAP_CFG, 0x000010), + REG(REW_PTP_CFG, 0x000050), + REG(REW_PTP_DLY1_CFG, 0x000054), + REG(REW_DSCP_REMAP_DP1_CFG, 0x000690), + REG(REW_DSCP_REMAP_CFG, 0x000790), + REG(REW_STAT_CFG, 0x000890), + REG(REW_PPT, 0x000680), +}; +EXPORT_SYMBOL(vsc7514_rew_regmap); + +const u32 vsc7514_sys_regmap[] = { + REG(SYS_COUNT_RX_OCTETS, 0x000000), + REG(SYS_COUNT_RX_UNICAST, 0x000004), + REG(SYS_COUNT_RX_MULTICAST, 0x000008), + REG(SYS_COUNT_RX_BROADCAST, 0x00000c), + REG(SYS_COUNT_RX_SHORTS, 0x000010), + REG(SYS_COUNT_RX_FRAGMENTS, 0x000014), + REG(SYS_COUNT_RX_JABBERS, 0x000018), + REG(SYS_COUNT_RX_CRC_ALIGN_ERRS, 0x00001c), + REG(SYS_COUNT_RX_SYM_ERRS, 0x000020), + REG(SYS_COUNT_RX_64, 0x000024), + REG(SYS_COUNT_RX_65_127, 0x000028), + REG(SYS_COUNT_RX_128_255, 0x00002c), + REG(SYS_COUNT_RX_256_1023, 0x000030), + REG(SYS_COUNT_RX_1024_1526, 0x000034), + REG(SYS_COUNT_RX_1527_MAX, 0x000038), + REG(SYS_COUNT_RX_PAUSE, 0x00003c), + REG(SYS_COUNT_RX_CONTROL, 0x000040), + REG(SYS_COUNT_RX_LONGS, 0x000044), + REG(SYS_COUNT_RX_CLASSIFIED_DROPS, 0x000048), + REG(SYS_COUNT_TX_OCTETS, 0x000100), + REG(SYS_COUNT_TX_UNICAST, 0x000104), + REG(SYS_COUNT_TX_MULTICAST, 0x000108), + REG(SYS_COUNT_TX_BROADCAST, 0x00010c), + REG(SYS_COUNT_TX_COLLISION, 0x000110), + REG(SYS_COUNT_TX_DROPS, 0x000114), + REG(SYS_COUNT_TX_PAUSE, 0x000118), + REG(SYS_COUNT_TX_64, 0x00011c), + REG(SYS_COUNT_TX_65_127, 0x000120), + REG(SYS_COUNT_TX_128_511, 0x000124), + REG(SYS_COUNT_TX_512_1023, 0x000128), + REG(SYS_COUNT_TX_1024_1526, 0x00012c), + REG(SYS_COUNT_TX_1527_MAX, 0x000130), + REG(SYS_COUNT_TX_AGING, 0x000170), + REG(SYS_RESET_CFG, 0x000508), + REG(SYS_CMID, 0x00050c), + REG(SYS_VLAN_ETYPE_CFG, 0x000510), + REG(SYS_PORT_MODE, 0x000514), + REG(SYS_FRONT_PORT_MODE, 0x000548), + REG(SYS_FRM_AGING, 0x000574), + REG(SYS_STAT_CFG, 0x000578), + REG(SYS_SW_STATUS, 0x00057c), + REG(SYS_MISC_CFG, 0x0005ac), + REG(SYS_REW_MAC_HIGH_CFG, 0x0005b0), + REG(SYS_REW_MAC_LOW_CFG, 0x0005dc), + REG(SYS_CM_ADDR, 0x000500), + REG(SYS_CM_DATA, 0x000504), + REG(SYS_PAUSE_CFG, 0x000608), + REG(SYS_PAUSE_TOT_CFG, 0x000638), + REG(SYS_ATOP, 0x00063c), + REG(SYS_ATOP_TOT_CFG, 0x00066c), + REG(SYS_MAC_FC_CFG, 0x000670), + REG(SYS_MMGT, 0x00069c), + REG(SYS_MMGT_FAST, 0x0006a0), + REG(SYS_EVENTS_DIF, 0x0006a4), + REG(SYS_EVENTS_CORE, 0x0006b4), + REG(SYS_CNT, 0x000000), + REG(SYS_PTP_STATUS, 0x0006b8), + REG(SYS_PTP_TXSTAMP, 0x0006bc), + REG(SYS_PTP_NXT, 0x0006c0), + REG(SYS_PTP_CFG, 0x0006c4), +}; +EXPORT_SYMBOL(vsc7514_sys_regmap); + +const u32 vsc7514_vcap_regmap[] = { + /* VCAP_CORE_CFG */ + REG(VCAP_CORE_UPDATE_CTRL, 0x000000), + REG(VCAP_CORE_MV_CFG, 0x000004), + /* VCAP_CORE_CACHE */ + REG(VCAP_CACHE_ENTRY_DAT, 0x000008), + REG(VCAP_CACHE_MASK_DAT, 0x000108), + REG(VCAP_CACHE_ACTION_DAT, 0x000208), + REG(VCAP_CACHE_CNT_DAT, 0x000308), + REG(VCAP_CACHE_TG_DAT, 0x000388), + /* VCAP_CONST */ + REG(VCAP_CONST_VCAP_VER, 0x000398), + REG(VCAP_CONST_ENTRY_WIDTH, 0x00039c), + REG(VCAP_CONST_ENTRY_CNT, 0x0003a0), + REG(VCAP_CONST_ENTRY_SWCNT, 0x0003a4), + REG(VCAP_CONST_ENTRY_TG_WIDTH, 0x0003a8), + REG(VCAP_CONST_ACTION_DEF_CNT, 0x0003ac), + REG(VCAP_CONST_ACTION_WIDTH, 0x0003b0), + REG(VCAP_CONST_CNT_WIDTH, 0x0003b4), + REG(VCAP_CONST_CORE_CNT, 0x0003b8), + REG(VCAP_CONST_IF_CNT, 0x0003bc), +}; +EXPORT_SYMBOL(vsc7514_vcap_regmap); + +const u32 vsc7514_ptp_regmap[] = { + REG(PTP_PIN_CFG, 0x000000), + REG(PTP_PIN_TOD_SEC_MSB, 0x000004), + REG(PTP_PIN_TOD_SEC_LSB, 0x000008), + REG(PTP_PIN_TOD_NSEC, 0x00000c), + REG(PTP_PIN_WF_HIGH_PERIOD, 0x000014), + REG(PTP_PIN_WF_LOW_PERIOD, 0x000018), + REG(PTP_CFG_MISC, 0x0000a0), + REG(PTP_CLK_CFG_ADJ_CFG, 0x0000a4), + REG(PTP_CLK_CFG_ADJ_FREQ, 0x0000a8), +}; +EXPORT_SYMBOL(vsc7514_ptp_regmap); + +const u32 vsc7514_dev_gmii_regmap[] = { + REG(DEV_CLOCK_CFG, 0x0), + REG(DEV_PORT_MISC, 0x4), + REG(DEV_EVENTS, 0x8), + REG(DEV_EEE_CFG, 0xc), + REG(DEV_RX_PATH_DELAY, 0x10), + REG(DEV_TX_PATH_DELAY, 0x14), + REG(DEV_PTP_PREDICT_CFG, 0x18), + REG(DEV_MAC_ENA_CFG, 0x1c), + REG(DEV_MAC_MODE_CFG, 0x20), + REG(DEV_MAC_MAXLEN_CFG, 0x24), + REG(DEV_MAC_TAGS_CFG, 0x28), + REG(DEV_MAC_ADV_CHK_CFG, 0x2c), + REG(DEV_MAC_IFG_CFG, 0x30), + REG(DEV_MAC_HDX_CFG, 0x34), + REG(DEV_MAC_DBG_CFG, 0x38), + REG(DEV_MAC_FC_MAC_LOW_CFG, 0x3c), + REG(DEV_MAC_FC_MAC_HIGH_CFG, 0x40), + REG(DEV_MAC_STICKY, 0x44), + REG(PCS1G_CFG, 0x48), + REG(PCS1G_MODE_CFG, 0x4c), + REG(PCS1G_SD_CFG, 0x50), + REG(PCS1G_ANEG_CFG, 0x54), + REG(PCS1G_ANEG_NP_CFG, 0x58), + REG(PCS1G_LB_CFG, 0x5c), + REG(PCS1G_DBG_CFG, 0x60), + REG(PCS1G_CDET_CFG, 0x64), + REG(PCS1G_ANEG_STATUS, 0x68), + REG(PCS1G_ANEG_NP_STATUS, 0x6c), + REG(PCS1G_LINK_STATUS, 0x70), + REG(PCS1G_LINK_DOWN_CNT, 0x74), + REG(PCS1G_STICKY, 0x78), + REG(PCS1G_DEBUG_STATUS, 0x7c), + REG(PCS1G_LPI_CFG, 0x80), + REG(PCS1G_LPI_WAKE_ERROR_CNT, 0x84), + REG(PCS1G_LPI_STATUS, 0x88), + REG(PCS1G_TSTPAT_MODE_CFG, 0x8c), + REG(PCS1G_TSTPAT_STATUS, 0x90), + REG(DEV_PCS_FX100_CFG, 0x94), + REG(DEV_PCS_FX100_STATUS, 0x98), +}; +EXPORT_SYMBOL(vsc7514_dev_gmii_regmap); + +const struct vcap_field vsc7514_vcap_es0_keys[] = { + [VCAP_ES0_EGR_PORT] = { 0, 4 }, + [VCAP_ES0_IGR_PORT] = { 4, 4 }, + [VCAP_ES0_RSV] = { 8, 2 }, + [VCAP_ES0_L2_MC] = { 10, 1 }, + [VCAP_ES0_L2_BC] = { 11, 1 }, + [VCAP_ES0_VID] = { 12, 12 }, + [VCAP_ES0_DP] = { 24, 1 }, + [VCAP_ES0_PCP] = { 25, 3 }, +}; +EXPORT_SYMBOL(vsc7514_vcap_es0_keys); + +const struct vcap_field vsc7514_vcap_es0_actions[] = { + [VCAP_ES0_ACT_PUSH_OUTER_TAG] = { 0, 2 }, + [VCAP_ES0_ACT_PUSH_INNER_TAG] = { 2, 1 }, + [VCAP_ES0_ACT_TAG_A_TPID_SEL] = { 3, 2 }, + [VCAP_ES0_ACT_TAG_A_VID_SEL] = { 5, 1 }, + [VCAP_ES0_ACT_TAG_A_PCP_SEL] = { 6, 2 }, + [VCAP_ES0_ACT_TAG_A_DEI_SEL] = { 8, 2 }, + [VCAP_ES0_ACT_TAG_B_TPID_SEL] = { 10, 2 }, + [VCAP_ES0_ACT_TAG_B_VID_SEL] = { 12, 1 }, + [VCAP_ES0_ACT_TAG_B_PCP_SEL] = { 13, 2 }, + [VCAP_ES0_ACT_TAG_B_DEI_SEL] = { 15, 2 }, + [VCAP_ES0_ACT_VID_A_VAL] = { 17, 12 }, + [VCAP_ES0_ACT_PCP_A_VAL] = { 29, 3 }, + [VCAP_ES0_ACT_DEI_A_VAL] = { 32, 1 }, + [VCAP_ES0_ACT_VID_B_VAL] = { 33, 12 }, + [VCAP_ES0_ACT_PCP_B_VAL] = { 45, 3 }, + [VCAP_ES0_ACT_DEI_B_VAL] = { 48, 1 }, + [VCAP_ES0_ACT_RSV] = { 49, 24 }, + [VCAP_ES0_ACT_HIT_STICKY] = { 73, 1 }, +}; +EXPORT_SYMBOL(vsc7514_vcap_es0_actions); + +const struct vcap_field vsc7514_vcap_is1_keys[] = { + [VCAP_IS1_HK_TYPE] = { 0, 1 }, + [VCAP_IS1_HK_LOOKUP] = { 1, 2 }, + [VCAP_IS1_HK_IGR_PORT_MASK] = { 3, 12 }, + [VCAP_IS1_HK_RSV] = { 15, 9 }, + [VCAP_IS1_HK_OAM_Y1731] = { 24, 1 }, + [VCAP_IS1_HK_L2_MC] = { 25, 1 }, + [VCAP_IS1_HK_L2_BC] = { 26, 1 }, + [VCAP_IS1_HK_IP_MC] = { 27, 1 }, + [VCAP_IS1_HK_VLAN_TAGGED] = { 28, 1 }, + [VCAP_IS1_HK_VLAN_DBL_TAGGED] = { 29, 1 }, + [VCAP_IS1_HK_TPID] = { 30, 1 }, + [VCAP_IS1_HK_VID] = { 31, 12 }, + [VCAP_IS1_HK_DEI] = { 43, 1 }, + [VCAP_IS1_HK_PCP] = { 44, 3 }, + /* Specific Fields for IS1 Half Key S1_NORMAL */ + [VCAP_IS1_HK_L2_SMAC] = { 47, 48 }, + [VCAP_IS1_HK_ETYPE_LEN] = { 95, 1 }, + [VCAP_IS1_HK_ETYPE] = { 96, 16 }, + [VCAP_IS1_HK_IP_SNAP] = { 112, 1 }, + [VCAP_IS1_HK_IP4] = { 113, 1 }, + /* Layer-3 Information */ + [VCAP_IS1_HK_L3_FRAGMENT] = { 114, 1 }, + [VCAP_IS1_HK_L3_FRAG_OFS_GT0] = { 115, 1 }, + [VCAP_IS1_HK_L3_OPTIONS] = { 116, 1 }, + [VCAP_IS1_HK_L3_DSCP] = { 117, 6 }, + [VCAP_IS1_HK_L3_IP4_SIP] = { 123, 32 }, + /* Layer-4 Information */ + [VCAP_IS1_HK_TCP_UDP] = { 155, 1 }, + [VCAP_IS1_HK_TCP] = { 156, 1 }, + [VCAP_IS1_HK_L4_SPORT] = { 157, 16 }, + [VCAP_IS1_HK_L4_RNG] = { 173, 8 }, + /* Specific Fields for IS1 Half Key S1_5TUPLE_IP4 */ + [VCAP_IS1_HK_IP4_INNER_TPID] = { 47, 1 }, + [VCAP_IS1_HK_IP4_INNER_VID] = { 48, 12 }, + [VCAP_IS1_HK_IP4_INNER_DEI] = { 60, 1 }, + [VCAP_IS1_HK_IP4_INNER_PCP] = { 61, 3 }, + [VCAP_IS1_HK_IP4_IP4] = { 64, 1 }, + [VCAP_IS1_HK_IP4_L3_FRAGMENT] = { 65, 1 }, + [VCAP_IS1_HK_IP4_L3_FRAG_OFS_GT0] = { 66, 1 }, + [VCAP_IS1_HK_IP4_L3_OPTIONS] = { 67, 1 }, + [VCAP_IS1_HK_IP4_L3_DSCP] = { 68, 6 }, + [VCAP_IS1_HK_IP4_L3_IP4_DIP] = { 74, 32 }, + [VCAP_IS1_HK_IP4_L3_IP4_SIP] = { 106, 32 }, + [VCAP_IS1_HK_IP4_L3_PROTO] = { 138, 8 }, + [VCAP_IS1_HK_IP4_TCP_UDP] = { 146, 1 }, + [VCAP_IS1_HK_IP4_TCP] = { 147, 1 }, + [VCAP_IS1_HK_IP4_L4_RNG] = { 148, 8 }, + [VCAP_IS1_HK_IP4_IP_PAYLOAD_S1_5TUPLE] = { 156, 32 }, +}; +EXPORT_SYMBOL(vsc7514_vcap_is1_keys); + +const struct vcap_field vsc7514_vcap_is1_actions[] = { + [VCAP_IS1_ACT_DSCP_ENA] = { 0, 1 }, + [VCAP_IS1_ACT_DSCP_VAL] = { 1, 6 }, + [VCAP_IS1_ACT_QOS_ENA] = { 7, 1 }, + [VCAP_IS1_ACT_QOS_VAL] = { 8, 3 }, + [VCAP_IS1_ACT_DP_ENA] = { 11, 1 }, + [VCAP_IS1_ACT_DP_VAL] = { 12, 1 }, + [VCAP_IS1_ACT_PAG_OVERRIDE_MASK] = { 13, 8 }, + [VCAP_IS1_ACT_PAG_VAL] = { 21, 8 }, + [VCAP_IS1_ACT_RSV] = { 29, 9 }, + /* The fields below are incorrectly shifted by 2 in the manual */ + [VCAP_IS1_ACT_VID_REPLACE_ENA] = { 38, 1 }, + [VCAP_IS1_ACT_VID_ADD_VAL] = { 39, 12 }, + [VCAP_IS1_ACT_FID_SEL] = { 51, 2 }, + [VCAP_IS1_ACT_FID_VAL] = { 53, 13 }, + [VCAP_IS1_ACT_PCP_DEI_ENA] = { 66, 1 }, + [VCAP_IS1_ACT_PCP_VAL] = { 67, 3 }, + [VCAP_IS1_ACT_DEI_VAL] = { 70, 1 }, + [VCAP_IS1_ACT_VLAN_POP_CNT_ENA] = { 71, 1 }, + [VCAP_IS1_ACT_VLAN_POP_CNT] = { 72, 2 }, + [VCAP_IS1_ACT_CUSTOM_ACE_TYPE_ENA] = { 74, 4 }, + [VCAP_IS1_ACT_HIT_STICKY] = { 78, 1 }, +}; +EXPORT_SYMBOL(vsc7514_vcap_is1_actions); + +const struct vcap_field vsc7514_vcap_is2_keys[] = { + /* Common: 46 bits */ + [VCAP_IS2_TYPE] = { 0, 4 }, + [VCAP_IS2_HK_FIRST] = { 4, 1 }, + [VCAP_IS2_HK_PAG] = { 5, 8 }, + [VCAP_IS2_HK_IGR_PORT_MASK] = { 13, 12 }, + [VCAP_IS2_HK_RSV2] = { 25, 1 }, + [VCAP_IS2_HK_HOST_MATCH] = { 26, 1 }, + [VCAP_IS2_HK_L2_MC] = { 27, 1 }, + [VCAP_IS2_HK_L2_BC] = { 28, 1 }, + [VCAP_IS2_HK_VLAN_TAGGED] = { 29, 1 }, + [VCAP_IS2_HK_VID] = { 30, 12 }, + [VCAP_IS2_HK_DEI] = { 42, 1 }, + [VCAP_IS2_HK_PCP] = { 43, 3 }, + /* MAC_ETYPE / MAC_LLC / MAC_SNAP / OAM common */ + [VCAP_IS2_HK_L2_DMAC] = { 46, 48 }, + [VCAP_IS2_HK_L2_SMAC] = { 94, 48 }, + /* MAC_ETYPE (TYPE=000) */ + [VCAP_IS2_HK_MAC_ETYPE_ETYPE] = { 142, 16 }, + [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD0] = { 158, 16 }, + [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD1] = { 174, 8 }, + [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD2] = { 182, 3 }, + /* MAC_LLC (TYPE=001) */ + [VCAP_IS2_HK_MAC_LLC_L2_LLC] = { 142, 40 }, + /* MAC_SNAP (TYPE=010) */ + [VCAP_IS2_HK_MAC_SNAP_L2_SNAP] = { 142, 40 }, + /* MAC_ARP (TYPE=011) */ + [VCAP_IS2_HK_MAC_ARP_SMAC] = { 46, 48 }, + [VCAP_IS2_HK_MAC_ARP_ADDR_SPACE_OK] = { 94, 1 }, + [VCAP_IS2_HK_MAC_ARP_PROTO_SPACE_OK] = { 95, 1 }, + [VCAP_IS2_HK_MAC_ARP_LEN_OK] = { 96, 1 }, + [VCAP_IS2_HK_MAC_ARP_TARGET_MATCH] = { 97, 1 }, + [VCAP_IS2_HK_MAC_ARP_SENDER_MATCH] = { 98, 1 }, + [VCAP_IS2_HK_MAC_ARP_OPCODE_UNKNOWN] = { 99, 1 }, + [VCAP_IS2_HK_MAC_ARP_OPCODE] = { 100, 2 }, + [VCAP_IS2_HK_MAC_ARP_L3_IP4_DIP] = { 102, 32 }, + [VCAP_IS2_HK_MAC_ARP_L3_IP4_SIP] = { 134, 32 }, + [VCAP_IS2_HK_MAC_ARP_DIP_EQ_SIP] = { 166, 1 }, + /* IP4_TCP_UDP / IP4_OTHER common */ + [VCAP_IS2_HK_IP4] = { 46, 1 }, + [VCAP_IS2_HK_L3_FRAGMENT] = { 47, 1 }, + [VCAP_IS2_HK_L3_FRAG_OFS_GT0] = { 48, 1 }, + [VCAP_IS2_HK_L3_OPTIONS] = { 49, 1 }, + [VCAP_IS2_HK_IP4_L3_TTL_GT0] = { 50, 1 }, + [VCAP_IS2_HK_L3_TOS] = { 51, 8 }, + [VCAP_IS2_HK_L3_IP4_DIP] = { 59, 32 }, + [VCAP_IS2_HK_L3_IP4_SIP] = { 91, 32 }, + [VCAP_IS2_HK_DIP_EQ_SIP] = { 123, 1 }, + /* IP4_TCP_UDP (TYPE=100) */ + [VCAP_IS2_HK_TCP] = { 124, 1 }, + [VCAP_IS2_HK_L4_DPORT] = { 125, 16 }, + [VCAP_IS2_HK_L4_SPORT] = { 141, 16 }, + [VCAP_IS2_HK_L4_RNG] = { 157, 8 }, + [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = { 165, 1 }, + [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = { 166, 1 }, + [VCAP_IS2_HK_L4_FIN] = { 167, 1 }, + [VCAP_IS2_HK_L4_SYN] = { 168, 1 }, + [VCAP_IS2_HK_L4_RST] = { 169, 1 }, + [VCAP_IS2_HK_L4_PSH] = { 170, 1 }, + [VCAP_IS2_HK_L4_ACK] = { 171, 1 }, + [VCAP_IS2_HK_L4_URG] = { 172, 1 }, + [VCAP_IS2_HK_L4_1588_DOM] = { 173, 8 }, + [VCAP_IS2_HK_L4_1588_VER] = { 181, 4 }, + /* IP4_OTHER (TYPE=101) */ + [VCAP_IS2_HK_IP4_L3_PROTO] = { 124, 8 }, + [VCAP_IS2_HK_L3_PAYLOAD] = { 132, 56 }, + /* IP6_STD (TYPE=110) */ + [VCAP_IS2_HK_IP6_L3_TTL_GT0] = { 46, 1 }, + [VCAP_IS2_HK_L3_IP6_SIP] = { 47, 128 }, + [VCAP_IS2_HK_IP6_L3_PROTO] = { 175, 8 }, + /* OAM (TYPE=111) */ + [VCAP_IS2_HK_OAM_MEL_FLAGS] = { 142, 7 }, + [VCAP_IS2_HK_OAM_VER] = { 149, 5 }, + [VCAP_IS2_HK_OAM_OPCODE] = { 154, 8 }, + [VCAP_IS2_HK_OAM_FLAGS] = { 162, 8 }, + [VCAP_IS2_HK_OAM_MEPID] = { 170, 16 }, + [VCAP_IS2_HK_OAM_CCM_CNTS_EQ0] = { 186, 1 }, + [VCAP_IS2_HK_OAM_IS_Y1731] = { 187, 1 }, +}; +EXPORT_SYMBOL(vsc7514_vcap_is2_keys); + +const struct vcap_field vsc7514_vcap_is2_actions[] = { + [VCAP_IS2_ACT_HIT_ME_ONCE] = { 0, 1 }, + [VCAP_IS2_ACT_CPU_COPY_ENA] = { 1, 1 }, + [VCAP_IS2_ACT_CPU_QU_NUM] = { 2, 3 }, + [VCAP_IS2_ACT_MASK_MODE] = { 5, 2 }, + [VCAP_IS2_ACT_MIRROR_ENA] = { 7, 1 }, + [VCAP_IS2_ACT_LRN_DIS] = { 8, 1 }, + [VCAP_IS2_ACT_POLICE_ENA] = { 9, 1 }, + [VCAP_IS2_ACT_POLICE_IDX] = { 10, 9 }, + [VCAP_IS2_ACT_POLICE_VCAP_ONLY] = { 19, 1 }, + [VCAP_IS2_ACT_PORT_MASK] = { 20, 11 }, + [VCAP_IS2_ACT_REW_OP] = { 31, 9 }, + [VCAP_IS2_ACT_SMAC_REPLACE_ENA] = { 40, 1 }, + [VCAP_IS2_ACT_RSV] = { 41, 2 }, + [VCAP_IS2_ACT_ACL_ID] = { 43, 6 }, + [VCAP_IS2_ACT_HIT_CNT] = { 49, 32 }, +}; +EXPORT_SYMBOL(vsc7514_vcap_is2_actions); diff --git a/include/soc/mscc/vsc7514_regs.h b/include/soc/mscc/vsc7514_regs.h new file mode 100644 index 000000000000..c39f64079a0f --- /dev/null +++ b/include/soc/mscc/vsc7514_regs.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ +/* + * Microsemi Ocelot Switch driver + * + * Copyright (c) 2021 Innovative Advantage Inc. + */ + +#ifndef VSC7514_REGS_H +#define VSC7514_REGS_H + +extern const u32 ocelot_ana_regmap[]; +extern const u32 ocelot_qs_regmap[]; +extern const u32 ocelot_qsys_regmap[]; +extern const u32 ocelot_rew_regmap[]; +extern const u32 ocelot_sys_regmap[]; +extern const u32 ocelot_vcap_regmap[]; +extern const u32 ocelot_ptp_regmap[]; +extern const u32 ocelot_dev_gmii_regmap[]; + +extern const struct vcap_field vsc7514_vcap_es0_keys[]; +extern const struct vcap_field vsc7514_vcap_es0_actions[]; +extern const struct vcap_field vsc7514_vcap_is1_keys[]; +extern const struct vcap_field vsc7514_vcap_is1_actions[]; +extern const struct vcap_field vsc7514_vcap_is2_keys[]; +extern const struct vcap_field vsc7514_vcap_is2_actions[]; + +#endif From patchwork Tue Nov 16 06:23:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621447 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2262BC433F5 for ; Tue, 16 Nov 2021 06:25:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A62961BE6 for ; Tue, 16 Nov 2021 06:25:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231251AbhKPG1w (ORCPT ); Tue, 16 Nov 2021 01:27:52 -0500 Received: from mail-bn8nam12on2126.outbound.protection.outlook.com ([40.107.237.126]:60901 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230268AbhKPG0w (ORCPT ); Tue, 16 Nov 2021 01:26:52 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aUN2pxdQ3wJIDY78esgCV6/3wsUly+aFIYRLJGcNJ+fCSJSyl7tnLuqL2uFN6UoahdEqUL/A6Dm04YAjYVDu6qQdno6cAl1d6EVlR1OqNcx7GdBxo65+HqY/7Cz4jLymJA/n1yVbI7qZdjOoqHLvs//ZhaTQgelt/ECdzEfuXL84fDImU/0AbiIEZyO1wXT0xLcPmPmFXthr7kr0Y4/Z2QtZ7/VtArLcFaczgzCXMtBzhy4ViPGifPy43VLSHZ7UhpBcG8Hxq2cxPLjAlJLG6MZjROZUSzbzh6A7h5+b+QxlwTPvmMEctp7Evda+gSrAQ+3NRSCUFyuBkrOA1PSsBA== 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=HRiTZQApgLwGpbYsKquz8UoXqJIsGDEjysbhkVGmnt0=; b=VEmaSXJN8GrHakcWWXd8BMGfs2V0cIAKupGF6r1agC690Ofo87/PTVGe9qkFgvKJi88PlGcPZ4MdSZdo9wuRt2B+u0M9MRNzxSEuO8qhzwe7o+YCrhji4aoEbo68cLCnltrftvZuWPyvhOheI5cA7moOyqbRSKGPQx4X2TJghDz7DmVKcEKJZ0CQay8zzceOKWUxXHc3B8WUyFnDPwubmVN6ZiTu12rJjgM5WJLjhJzz9N6fTBtbz0XVSA6QOepuNtLGsPzBvpX+l3md2sfWegN9uE6bVFl9DxHeylB7588eC6h8AE0CulAU+6BXs81nSN9efr1I8M5PAIYe0kMxng== 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=HRiTZQApgLwGpbYsKquz8UoXqJIsGDEjysbhkVGmnt0=; b=FbFRA1ILG/vciVRwxupEcO+9riXELPbZAjwqQDOwjjIYsPXAAtFa05/VOpX89l+QgPVbYnP/wceny1pNLkecTziteN83TA4f4CLyNCfxnD99LDEMxejjSuVsGt5dX9ChzZ274QAEGJspLqtYKB5G1vM4VXZuDLakVnRxWNZ+uDg= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:49 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:49 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 09/23] net: mscc: ocelot: expose ocelot wm functions Date: Mon, 15 Nov 2021 22:23:14 -0800 Message-Id: <20211116062328.1949151-10-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 991fe34a-7c62-401a-9a62-08d9a8c9a6dc X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vdDL7xhlHH3i0Q4eEcjSSjunVdQgmEBfpSWymb6gMtedqJV5yN6pUKp/T7gLXGyyB/c53nC4mDv1fJTeZEwsXwTLKv1kwJYHP91PanJ1g6njtAieVrITycaGWOjXzTQMGIsc2TPrnTLMkOzPCfGrSifNWfBALtlo+Rp4a2Gohc0unafLFbUhXI2eT9lNREcAcFhgRwlyI5ajV3yBqhQCLDV1I1xyLY876GRO9829iykSH+qdt48fln+hUE4PG8xoGpIhCe7Ox8j73/VZFa0MR0EFnkBspCzW5tl8z1GjwkjeI9HsAFDfiUsaYaSW3QygKt+uDB8f7etozemWWifsfdMDjdIhJY3k3UKA0T8wwwNzNtCCjahu1n03pBRAArDuQ+55oqpj7LOBoU9exKhux9YS0EEHnn3LXGp4an/vLt6a2fCjBi+xApkdGnjAIzxZX6/RtaHNaPtm2mCn00DmUmcW4x6CVnSd5SzVpoS/bctu8KK3Y7X0IjfKUZTLMOpONlvyxHH3a3xCnyhs0iAfZDHC1E2dSCCtRUou7CFbGrGb/QqGPyatUcanod23Gx+n3Z9hsjjT4ZBP1BQWDo/sKBNN9xTckXVNvmzND8dpyqWP3jPjaMzw4PouZjKVAJd1LHMQLgk2ANwikjxVRLA9X8iq3B8v5mr+PZEssubIaboc5GJT/vyzy2Z7AY6QVy/6dwFzbOPCFLQcw/JBcvqB+Q== 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:(376002)(136003)(366004)(396003)(39830400003)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(26005)(6506007)(36756003)(66556008)(66476007)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uVHaa7bPmyQW/M9Yg4JkkuYKRLyDM1CGWwoBzBi9CDlVgBXcYQH5ELJU/PNuMbopF99D3TDgJF2SkffnAcQkfNgOmnOywk2mdaGuTvqtdgW5RpCFhMp0OXozP0B16YGZ07l+I3zvMaJGf0rCuO/9RvYpEt2UpjYel2p6bVtrM1SeuwqKGfr50ByYwchqMAXr8zYFpYQWjCu2An/DghCZ2LUDN3dXpH7E+h/bcSBebaBYPjtGTUs878NSfYRfEhd2/8+Ij6MSmthGYkxZZ9sRYqlMwjfvrHfEK2WLsKzVhOB6XPxVxhtnDimhVWexV65u9glRXgzdja7u8juzbZPTFw7PCIyZSZoUS9aHs8/dyW+aGdthp+XYZRvcUvM2sPtzl9KEcxkz9qEPLLHwfp2gezgVWXmNfAF2LIKmO7Y0BxsF1qMBoQOcWx4uz7xWrA0lwBneOwCW1sATMQusb2tFO8KSpR91l/SRIEvt2F4enoPn1hrCxbaBpeuDaEbPbJCnyzIq/UyUpuGInu75FNPJ7fQQL43Bk961KN+O35C9o4nKwsoQsOUSACT4GrowospcUoxuSUJO2qk/O0M9aAyRj0UNSiYO0geye4XVScUxnSUOACcj+AcyDNWaLivcML3EXP2uTIeJL6bfvsS5tk5W8H1ubGqC1G55buTYkkANtxLRorwJx4B528j7rJlE+d8TIB7hYGc4fecDeRBG+f3xjN9YWz1MczgtfexO6qwEq91OaK69FfgtTjzHL2b2VJJjEArkmGwbhHqjnd5RWiUPmCTs7JFMIypsGYX9fpAr+JzUmAz2Cu4hqZkonhXUs3k0KABMFzUMDJq64oBGxGUjM2MajgvD5mTwrVIRSK23p8OKSq7XfzWhnoP+rhRWykq7562mOKWVZkXG5z1plABBqKgHQ4aLNj64q8NXLKW2soZM3dELvgcX503UeZJaAytCEq6tCMK8p6Rr0qFIqag428oxGYRJI64ESx9oPL4BbGrn0U997AyxUkNiO740fKUgpMRdC1BYKkcg57/vN3By0qYZguEEa2L26hwoyWBpQ2u1R6qivA2l1cB0gSqDh+i924CDoQCDC0pU2JK9zgMrQlAwgrN1spOjAXSbwxkGNrWlxZeuKotlbKd9bpzvOwX00yCs79ixREdeSJ7RzlIOSKQRX394ehqLSnZ0j0AiWtDhXFTTim9qxKwtlLoruC+92IIPVEiGCmjBkgnmh08RAdfQdIhTHT6EBzd+c8WFOkbm3Mey0izLuxfyaYDosAOtcvYXrAaoRHtqmUi3uSNE/s1ZvCg4g+4nYdsOG4j1GB1cY3C8stQ24iE9jn0ZM9eIdOmhNKW8Hh7+FUEKemf1d1sBf1mdBteOD5eKHZ34aJi1bslWl3x8tbwZWoLUnSTZudkgsR2W3YychvdZZT6oz3wyzROdKpJ0bLVatRVb8mRPtwDiKex6jKxqp7OkfgoqUNVReESgR5v8+zHwSfI6WLbq21wWtDJRyWL3KPKtfpayuENTmGSRFT78HjLDpaebkrV7zoLQMlndT0ft376UijNnfYGNTvfuDnWWwtZCmZQQCoheSfxDeDdbtp44mXY4GqgOZ12p3VXHGGLwfht3RpQkOCjoHBQ5nTnGNceH9+/50hSUG/SvDDtjacXgxvPdBgNu4BGV1WsOZp7XkWQWo++btv/llyJ5U41zmZ8wohk= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 991fe34a-7c62-401a-9a62-08d9a8c9a6dc X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:49.2892 (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: p09jW98yixqpSsCI2+NrFyHn9MXOQ9g+6wGLqJq3xtOanF/USPk+exFjV+qljUrAnQq5cfK7lWPjeOIkMed+e9veSoMH8w1YP2o/C8BvK0Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 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 --- 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 2c763784f69b..3715d89f5d4c 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -303,34 +303,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 fef3a36b0210..9a4ded4bff04 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -766,6 +766,11 @@ void ocelot_deinit(struct ocelot *ocelot); void ocelot_init_port(struct ocelot *ocelot, int port); void ocelot_deinit_port(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 Tue Nov 16 06:23:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621453 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7801C433F5 for ; Tue, 16 Nov 2021 06:26:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C122B61BE6 for ; Tue, 16 Nov 2021 06:26:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231846AbhKPG3V (ORCPT ); Tue, 16 Nov 2021 01:29:21 -0500 Received: from mail-dm6nam10on2120.outbound.protection.outlook.com ([40.107.93.120]:37728 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230330AbhKPG06 (ORCPT ); Tue, 16 Nov 2021 01:26:58 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YX9niCzC1JQ8pAqbs1X+rZm7onPcTUojQJyRNG0hoqF95rzv1E6QgCpY12f+LUVhkF3ZeKEh+C8czE5aPOhz16TBHYHHn3MqqGb0igM0dqBdW95b+hXy1pTqnHVGkogU3Ncg0RQOTHJbRhCKglmKy2Z/dPOqhnUir0HJTEyImtxKpCNe4d4OJQH2w2vWSQU/SKeWqHGBKQuzKqu46UGJagwOPwFX71fX0OZv4a2srgg66WQXqwh1qhN2eL4g5PZmubxOjexeeCkWND/agPZ+wMd1BmM00k0BPmaj6xTYUEa2M1VGO/AqouqXoh4MnxHIJSYL1DhMokd5Z35CAzha4Q== 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=x6up6gsz+c72GQk2W1hkBjqvedIEfYO5cUKW7oUzrF0=; b=UB0IyQocQ+wRAwq1zwJ9qZdBU6XQx/xYbMF/xWK3mZsBBi0umTor0v94tQog+XAKug810sgn7JdllDU+7GD6MLBynFH+YmFicrcaeE5tH1Ic1S0YdVnlE7ebYmh4teUWnwr2PnMPWKMf9NJh1pDmRcHN5v3y1lhhLxX+oOfTPP7egCScOBlQcXAN0ynr7f5YM4nYEvEAJyiCvvxYMCT7rUlVrgSAFx9FSvOG6Lw0FcdKLTVrHWyNOvVy28LGfXpU2H7kO39YnwXokOONCaL7HCV+8iGNUlIZ2QqE665io6D5gihyXYbYAFFPVYR1f3qs4gXnv2py4dwSjmi8KOdozA== 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=x6up6gsz+c72GQk2W1hkBjqvedIEfYO5cUKW7oUzrF0=; b=zKmLcrhd3G58MJTfJmVQBdo9TZb4X9qFDRsE9McIuhutCejNd7gXbRKvHDNgo9So+lMbY6sau19V+IfUQY+B0c8w3d9P/rnS7zwBQwIMzQw7zZr5FtXOXr8rZHduareaPvHp4A8wqCMmYScTE6D1t43e0+YRerCTFueLSGmYI18= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:50 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:50 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 10/23] pinctrl: ocelot: combine get resource and ioremap into single call Date: Mon, 15 Nov 2021 22:23:15 -0800 Message-Id: <20211116062328.1949151-11-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b5be51a-1999-4e19-5564-08d9a8c9a752 X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:935; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: saDpDmpTVahbLKNHh9uJUcL9u8t0rpKSEkVZQ1T/gAcbb6ih58xnslt/tE6AD01R3Nj318+UTBNWiV1lx6w9lPQZect57M+H6jyJv879Hk8rwIlu7+une7ZraQp6RiaqUWz3yfVVqpsPPGV2rqNo2mes1vM9hLHce07FacTCJ2p8cHAeBE10X95/1vxfkgs5GqhVyr8hqFSgTwZ/nDqG4S4lDEObBJWbcaxhbzJt/y4HcmCtbqH8+d+sPZ9osoJbNouYhwaVk6Fklvg0TB7x8BOlMyTlK8iiio44D0MqwyYlyx+cvFDTnoliNzE2zVcV/85/050J37M5vL52g8jiDxIqe/lFyq/vDHRZFAZx+qPab51TSYej3nAGD4jVl3rmptny7pohd9ChH1a3v2ul6nQfFbcHoxagR/erqdwG7hWK9iOmmLZFevsZ1QYBoiHjyb2tPw4WicFYls+AdBgKBdQhcGTzbKAdV7q5A0qfH6UGObhle/Ds6AFDlni+T5MLhWhgzXBZhuxpsCj7dQ9mbN3nFU3prKN1XC74wbVr9Yz2JeuWfeb8Gx5bgDT1ABShHQfLP0QhQWlAcgvQmJzo/e1Mm5OxnCaRI8yxTCrURLU3ZT/3i/x7DmyYdvR1wmkiGoFD7QD0WB1k0lLf2gJX42Pd1WjPyISMTbOZKfUCKcDhGnnR1d0xxVNpPrkErKtv9byv7pCQ91udotaFq65fAA== 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:(376002)(136003)(366004)(396003)(39830400003)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(4744005)(26005)(6506007)(36756003)(66556008)(66476007)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tXFEqgle1CoNMSYB4f825jQGWE4gQeTdOw24SivTFNvyWz6N7HEIaE3dAZBMIbZnVMINFH7jX+q8Eqy9K2Xt7swXcO7r3qIBQ5W4c+Q2IQLROtZ9XTsdrIwhHag6FD3Vv+eVh4u3Nsz+xcfKOKbx5rZsFSeNwdBApic1tst9cYxluw6RakABK5ScQ1kHH0cifeGNkmKtQTUvdd3XS+tQIh3CR3Q1lip2CO68n5yu/znCrRvTkpQ+rJ2YudFzIuFCeKPZpd9XmhzNcmAzZRdf5VpQyqJG5jN+ldjabATfw9ZYgrHB3Bs09q3aU/BzARcgu1xhq+yve/Jxbxi2EVd1SM7KEi8Gr2qht9luCQ2n1Y/esowf8pRdtNrKEXwMIp08riT+O6P2hKdNDriEk81/VEoIKVSErDPZz04HUEK//UlX6ro7D6klRhieTXUrLOlIZzL/RnPeysZnAHEQUlXSaXHuzDkUi+8/F39WXHlzsRer/YQjiKsvpd9R8nf9jCiXrMPQWFLFEhuQ3pfsPuFYGXtTUsyQE9bHX1JxEweyhG8lC7w8H9nGI3/qdwCm5I4bZxjJnJpXkDx/ZdrAarewFrkEk2Aaey8c9Cmff1hp2sczuXH3Ox8+yx5otcw6H887K52TwCR3Mc2gs7IUe4JGkitiTSEbeVQ6dlY09A0h9NbEac2LjYPsYdFXo5oUQzXbhkp8nSGxHvh94mnC6l6Nz7eaIC0JacZnR2BdR5WH16MhDwpgVO8quSoI0YV/ZNiGK0+LFq8QQIQlW63XN7exm1LGHcU0ZZE8QOc9teswlK2gG6g4HP9sO9fJPQ/RU6V98BKgDfP9bWQSYsi/70NcDnMamWoz0mMVrtyv5B0BLppKhVO66Dt8M1PoaUskqjOXQzZxbm+drK0Hl7836ZhjAcucXO60tygLjLaIpPl58N/h5GPUJQ4Fdi+/e3kFCo9c6xUQJqQ5hIr2TUTSaOSmzEiNbiojCIag7fKUqcGDboYJnHtmyGCKbH9PJFThTI9W8HWjTtIyhiSz9KIQXuq8SKN/MhsctQaubN8OoGz1HIJC+5Rk6raxjWi1ikScSZVfeQo0TD5EBgp2XzKLpGLXt0CqMaPlaHKcjD4kqeg0NKtdkuq8y8PW8vnyboTOq0Ns+3bIUdBlEhkGXUfShEVpBOnf2ojH3rjIWPc5xv313tMvnXA5NX05xMT26DobZow4BBhrR6gRcBkEA0+U+5z+ze4VMBHZ3AJbFlbqspkJCYw2x+FDGVJMPSsXLq34zS/Lxn9C3UYK4zSGj+XZXhirq1toIiQZ5H7+pRg0CAPpb3fa5XUKpB/MAAgDbw60O6Djc4UIyPhYEnf5/a/asTDmj5JLAD+HMIoE3fdZdYNS6QxN5EiYzvtounTxvjL0JDiZrv6MhJYZxnRbOL1zT+I/hIwXJPBu3OfQYmzssWTtMIow+PTF3zu5Oszm55Rbh63ZmFAiO+5KBpioqj+5UHhsor6YphXDktEKBR7Le+61fJo2UuufsiMeXpHpUResCKALN3wKFz5QcB4iyneGbjHzfjb7CtGtZ3UrXGtEYgN6cQ8TmLzjA7Bqz6v8JDsBrRvaBbOcrOLbH8WhFtpdokLImCganmk8YRL7lGHdtbchCt6bMxj2EIJy3QfvqoNdf79Kl1FK7Rx7Gn/Fc0ZACNCA/wAGvU8Oq40bn4La8x0wIWQ= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b5be51a-1999-4e19-5564-08d9a8c9a752 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:50.0338 (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: wLz2iV+2Aj5oDOebUjtsNb6nVD8Ks+ygbDkuq0RzWHsis2HIyME9rzWgFAI4nHI1b41h+U//WWfKG/R9hu4pcu6FWqQoGn/oLRfVHEscb10= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Simple cleanup to make two function calls only one. Signed-off-by: Colin Foster --- drivers/pinctrl/pinctrl-ocelot.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index 0a36ec8775a3..cc7fb0556169 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -1378,8 +1378,7 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev) /* Pinconf registers */ if (info->desc->confops) { - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - base = devm_ioremap_resource(dev, res); + base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(base)) dev_dbg(dev, "Failed to ioremap config registers (no extended pinconf)\n"); else From patchwork Tue Nov 16 06:23:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621463 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1385C433EF for ; Tue, 16 Nov 2021 06:26:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98C4261101 for ; Tue, 16 Nov 2021 06:26:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232076AbhKPG3o (ORCPT ); Tue, 16 Nov 2021 01:29:44 -0500 Received: from mail-bn8nam12on2126.outbound.protection.outlook.com ([40.107.237.126]:60901 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231229AbhKPG1r (ORCPT ); Tue, 16 Nov 2021 01:27:47 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lbAzco3mRleQu7pfRcaWjeMFIPM0US3QN5Q11H67qvzJLKouxOStTNdx/BpT9wmiWHAaKJvGaOhtHqjMihnhXEinVIakNv0xmSeOuDq0KiTiufpkrzy39DTmZibN3GTzjBpE4QhrzeRO4hn53GSTywHLSxo2ooMaP8xnzW7yGZSOjLQQx5elh1T3m5oWJbtCvrIwPfznFRIKI91m7w9s9SzIjKijw4PrN0hHCIoLPj9/f6yxKYL6GxSnaqRd1zgj0i1SfWcqBswEZR1/7466SS9QCSdHS/IFuxzbLvR4ouJD9253+xLxadPESR7ALHO0qLMD+2QL36aom8C8HKV22g== 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=Fo4JH5MrJnAMOFnMpVlALeycztsDiiJYyJjTK4uA7Yw=; b=b0hZednMHfaEygYuJ2e5TMkJbJhMFaHeypa/eOZjjhkm9MrX/iDvrJvpB9BH3p2IVYqOxCXZo9jMhCpxGngnrjbqbQa4DROZ0v1gQKpX8OtCoaYGf2hZcV9FbHqIxV1jZKQKT1W62PNGJUFcp2a63/ABAYB1oUTtYeRf7M4j5zi6cSO7z3Td5oPTDZvVN8GIZ7g4yV0Eo0mbnAt+1INpnsRdjspx+r2E+arb3p75FmcoUUEUFhT0RmLc+xNCY0UQJJ/0bGrr7RmhoQ6mUxV+d+d5JpoEwa+TAJr0R1m4qVCMR5I6/p+OG91bGeaZza4IFuRC2Affk7K/6GR6L8OcOw== 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=Fo4JH5MrJnAMOFnMpVlALeycztsDiiJYyJjTK4uA7Yw=; b=hkQk4KSZ2Jlc/vWVyYcDnin9FkAsfyHOjiZPKn/rpmGmeIRp0Ndd5RFe0Yund/S2JJz3MEpVnUxZdaISizzXW/nbpQFB/2Bkn+cLRFR2i0VWXDzC23+HYta5k2e3UX/ZdenGAJdNPzPfz7S3F993rbUc0F+cvKY0V4AmZpeLId8= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:51 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:51 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 11/23] pinctrl: ocelot: update pinctrl to automatic base address Date: Mon, 15 Nov 2021 22:23:16 -0800 Message-Id: <20211116062328.1949151-12-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c3e5f454-49f5-4a96-1d36-08d9a8c9a7cb X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LKofzdcTeUFapm5SZqavoeGtQgZJF2ZjEpDjts9ub2NAeFJGXDtER3AxuyEXmdOKfdwGVAZn1oXwY0yYbPdzVPqoNiUMWwSehP8rp3C60KR5fUmgePcR1BGZjAJPvuwlYG7AGStokaAKgAiPrlyyepKLhQBxB/yIoGv1GVkCrZBKDONqLu8wtvOIN3RNm+KB0woPJoxJ6yTFVcpM6VUT6aRlaYW/sXzmrV5JQcGg5wlpXKKxjnqMwA5hliAQ1gYfxIBdwNBLvk3lPJs+x/121d0vcz3RDs/3OyC9H1jwLZKnUXHypkaxgOPg8J6JLr5uOTIHEOp+kN7SvanWrF5xCoFbjVdtCMbPept3z20YXXtsVMcJk05ZrGU17msrCRnPaaMIDJ5M8pejQ5Y7RL/dnWcDz8BFyx4YwVDuqBmVG87MMPoGq2dSaKBopDiqTjcvyyLa0Q9nYcU+sVPVGFl7DAWfM58WpzyXYUHJAfWmXr1zy59fO0EsiKDJF39fwvA9iTcYPn62j98eEAWqEyLk1X2W/IP8g/K6MmQl0JQodjDBH2g+AmdEtWaqA5Brt+kgHOrFb8E5kAHWOZu4bCwaQ804ABX/T8D9eh0/H6VQ/I2b7TYjNyh8Y5U9iZKUtAf4ytlDIhKmenS8tHdd7Ehp1swzfO1u97lMktOKkQT5lr+ipaNqpX6Ypf3FUkAely9bU6hvMCBjZoBhwVnYOjP4cQ== 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:(376002)(136003)(366004)(396003)(39840400004)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(4744005)(26005)(6506007)(36756003)(66556008)(66476007)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VcuV2p0nLpBR6lqtedm37nCvdcfOthvJhyTpXhz+fyrpAKu7tK3YSpdr6F2Kg2WZDo3S4K5yhYBfkuJe+hUSURT5E6X2NtLI1CcHdxeb/6ZczGxVArlY0uEh/tSeRA8LHaICz9RWfwr5cMJ+5+elDbMgiqW+hToZWUsSSBdpSf+s7bsv2f2tTuEXBoa4Gz+Urj/AThjVjK7uSNdjZREpbBGdmMW3kmbGbcT7PX/CQ8BW9n0kAXHIuiwWnjZPfN8zZvD7/PfIqt9tlLawcEpH+z7ZT/5VC2++0PAhXtegB8CYJ6nyrijrk8DDKwvpZxy67AUzZ7Yjgy2ZJvPIC1mlUqQBE5o+v7X+PgURZAeKX3bE/bUox2nmu1uyku04ekbtk8ibDd3Jd8dkJz3Pghomr5/NDKWKIZjnCi+KUVy5t2FAJS71xdmbTdXZf7sujMXQ4zHyoE+kt0KcpliZHj7WIWb/m3ILuYnQPRgWkdoXDVgSklKx+ZsBbnpd2/qTqV7sF9l6WdQVQceLHZUPmH4L7ERy2jl7sRBrLA3vPlQxlzmZ1JyIvKyfvoInj06lkV5kkLYjLADeVn2BtV4pu+GxbfJ5qs+2q2iIjEYX3ttsgSg7PDBMWcEe13c9/QhvFnJ1YDaGji/AeE72JtTNV32lH6ocF7lFySQVUCp/VYruKV1YFpiZ+Rs7qNKlr24NznHIL8LfEbmkjMi9oLkkNX4fgiBVB6C3Dmf0hWnjmerq8REb7WEcxTrZfUDNs8pB9TNUfpuOCPCVG74N8hDieaIueAh9/Y6zsHZJDgLCFt3FWVw8wYSWdiWk4fha7OVUG4lP9VGkfL4/+McobXqpQArDfYFx/cevwMDlcal970i5PUGSudglrt1LhttM17qBY1ussnRNknDvo1xbNkr8rj2mSRWW619lVh3ScksMbEhMgkvJzIfkWrYeS3pbkF+s5RFYcCzkgHNI4iwbBe2xlg9+TIUDxBeg/HFof4ftKon1uxEgHPAblZQnV99fxFhzoo+AdNtQRg5e4D+B1cuDX3EKxdj37AYRB93zzYHc5R6UoXTmN1hPutZJnCCNljeXfu2hyh+vSu1WaaVJMzICxnsM4+rWQbGmysMsd1qqbnxXzhP25jsRltnD4XzVdeSQc/iKulLlVUAT3pcH0bqEudA9Xc8LUCbsnKECSFgB+K040jBRaJa0HtjWGmob5/HOxh9aJmLTbnXCf5vV75+zRTYbDOwYA0b79OEudc4TmBsD04MzBqHlgO4bpK+obEWLj/UCl3F1oQVvc+rU6ccbbuz0t2eryogjQMszIcSVYMuu4BhgbYOxVvwcqZ6cLMFAna8d8UwFvA1DGBW4nHsjNTvi9vpTqwztDeYiZcwVgCv+SnV3oBNuZUG3NgsYjl9+wQl4cCkax1Nb9RMYk4SUjhCgNNSHNOVoTdPJVd2Dbp2ZUTXYUvXebTpXc88Awp9TMCQnmK9DZi2OH5Ni9voI59bNwSBR9Gc+VqG6clzJaYvmj9ka+yHz5by0AZmDUV20AVaUIkwknnSO4gOsrbAdAJRW2LXIT58rGyzqFE3mhkrnYvlltWcibhe0ycgvYnIML6NW2hAXuJG85JdIfWDu6Jn03U/n4weMBKNT/+T7Qlu1jknSXGDH6tPGRIVnRrBoQZnJFS0wJJgpAfjLo4OygGZ9w93PuavMhAbF5y4u+fuVb1s= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3e5f454-49f5-4a96-1d36-08d9a8c9a7cb X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:50.8623 (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: Qp6A7X5aa2IbawjFKZlD+lLMu2OrnEQfAPzgdnH6OeSg0+TarYZZGOYfmVH0dJ/HUOiIV64cw0GFhSzHygrmkpD5PQJUjp8y7Qolm32Zmcg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC struct gpio_chip recommends passing -1 as base to gpiolib. Doing so avoids conflicts when the chip is external and gpiochip0 already exists. Signed-off-by: Colin Foster Tested-by: Clément Léger --- drivers/pinctrl/pinctrl-ocelot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index cc7fb0556169..f015404c425c 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -1308,7 +1308,7 @@ static int ocelot_gpiochip_register(struct platform_device *pdev, gc = &info->gpio_chip; gc->ngpio = info->desc->npins; gc->parent = &pdev->dev; - gc->base = 0; + gc->base = -1; gc->of_node = info->dev->of_node; gc->label = "ocelot-gpio"; From patchwork Tue Nov 16 06:23:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621469 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEE3CC4321E for ; Tue, 16 Nov 2021 06:27:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB4F561101 for ; Tue, 16 Nov 2021 06:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232331AbhKPGaX (ORCPT ); Tue, 16 Nov 2021 01:30:23 -0500 Received: from mail-bn8nam12on2139.outbound.protection.outlook.com ([40.107.237.139]:7392 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231338AbhKPG2U (ORCPT ); Tue, 16 Nov 2021 01:28:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IN6KZTnkuDELe/hBsOIcquaX9j1EjslB8fF9sNV5Lcar1ko8dJ8j/s0l5GNGb4GT3PE5Qrha9I4QQZyO+gOYR7FwemJlQ0M7EGjbzK4WoST0vvl2sU6iSTlH/7G2P0csafSzK5Lh5+atDCUj4sWuo6r522ECt7mAnl4yZ4F1NHDqBcAWc9vW3uwY9hm6unIZqTiuuqWr07WPxdmrKqiACjHkRWS87rxuzMdKlgEdDfYUwfoQrO+7Kz3HVfqvtedRyU6OUCvcCQRsO3wfvfqRGr7P5ipQncF0llth0J3hksCCSGgrmrt+/3GHJKZFwp+Ntsfk6Ku/TwOlOgngPr8Zzg== 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=aP5vNOHNYh24nisY8908T8PhKr/LVtnFiajRB5l6S98=; b=cQw1+3ZMDAvSTLZEyieLT23weZEAKs/OCg0PDyqfBD8r0J+cml1eRkvxQDL1c2om09NPhp9T1Yi4KUHlsimg7NHr1zAuRO3p9OFa+mpTIcXOnzGgdgM7Nl6X+Y02WL8VAWKTN6aPJk7OeXc2f9fVv/xH3TXhC4CZoLeqUTEVud4kt3p1JDVWzYNqrmZVIHNgZdpca3HXoMj/cN/ch96nFkvbTehm69IHhUr0W1m++9eaE22qUBFIsid/j1stpf+MPFQmYZVADaSPTNRrMq7zhgjNoWTbQOnv+kEUlDazf+VfzIkMls9uOSoaljArjDvN398/lnBi1KCmEN20K34rwA== 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=aP5vNOHNYh24nisY8908T8PhKr/LVtnFiajRB5l6S98=; b=rGhQ2/gzwtwPc+ebFF/YCe5Q5D3uMQPCiQRCHHyxTXshcHhukAjUcDnnXkSyaZW2Kpb1Vv5DcHJ5M2VaLuINsb93ZIDJhw5xX1/md1P0ETTMXGAoz3gNsksmc9aImqA7E6oLasFACtU0h4tmfNNRLgTrrljKgYz90VAVuslZx70= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:51 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:51 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 12/23] pinctrl: ocelot: convert pinctrl to regmap Date: Mon, 15 Nov 2021 22:23:17 -0800 Message-Id: <20211116062328.1949151-13-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b08fe540-fca8-41e9-a83a-08d9a8c9a844 X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T1x9bgRJBDc+JC5XsjypFNoGQYGmgIfUUIDpdp2lsZSdjRdNxLc0hfesS0f5g4cEVQw12pBl5LClNiXLzOWO3p351u0CeEFp6sEJIl4LTx0SaSL0N4yANmU4hjK78M7RxPEIZyS2laESGmZC1byojL4+j9lwBgr06bTHr8QrEwVdiXigEpAMV0dkrfL+uZiqvaxcs46LFTZC3FP/nyiOySACGARwW4B4fMTlxR6PI7xhTa/DPJAxkC652N7R5Hz9C+d+nBZyPIr0M4pG6zn9yreCDLVpcCWQJAmxc8sfokEvygDXXLPLVOYBxdE+krYaGcILijdgoAHFTFslDvcIvVTKZolYcMwiOMiiyY/l8kQqJQYibw9OGY0dT9fre+GJtEsxQIa5dra77Lux5IVIE7M4iq6XfEgyAhdloGRLV+rAXE2h74/AaNWKES3bSG5Ksl8uHxUQQ2tHmL2z0sraKWB5SbutPS26Io1VIWsTS3ERKfS2Fj7gDHwhbBjgl1XajT1edJvHHLcgYdkUvUcsb/Hg871zrgbv84+LTQF/EBhfFz78OaCv7QwoDTlypFhPIbQm+7TreUYmzKhdcXuZpNrCr/O3uX+4AYC8MlfPS4/OYHyUSlo8dqmS93LT4bHSv2IiTE0ziGPD0Ia83EquvNjt8Jthr99ZI2+DCZ/kNVMCRkNXyEYkadU06GFn0Svp7ze6hYFf893bTWgzNpvo1Q== 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:(376002)(136003)(366004)(396003)(39840400004)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(26005)(6506007)(36756003)(66556008)(66476007)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: k08rcOBxSFnNwexR+FZQiUGscMI5czvQ+myMSvTRcdaQ+C62uej/ONsaSP3nuXGaG5H+8Ps9YZ7PKAI5PBLvRcWBfKojn0zgk2gYA83EoPTD1GY1inTRuDNTrgTe9UNHkHZCKZULku3x1UvH17BB3NcDo4r2B16xt5NNGXBFW6k21sehTsjjfomys4ygP+RBgrs8vUpI5gHl6c/k/WMcZFZsJ3jCfUlnRv1DFROalGuqjgp9rfZVLxrk8hmJQhvGOu20T9ka5PI/bTMv20I1/tmiaCSl7Xy+W4jUq7VwKZ3gkViwiAn3xBUbrpC0XYK4tmekAFdxXAS9Gg3P0fO50SwN1FXj/sM4MBf8+I2gYoALRNro5y3wpTF/8jyyuTaPg66db6SoGbmvP7qvg9NfM0gxr9Hcv4pXo7is1nLndd2f19FiH6J+iKmBaJG9NNdRj47tiMKymCZqpZAqr9E2qF4jFbFKfafQ02VQlvZfJa7+xzpuTJw5/wD9p2dnsq7i4nriA6dBMhzXAEbJmniVlFxdAFLHc+rZXjKpuNSmio2TnXx1wFDnBHqoYboaoM5IzE+ROJvAIGMCLI3wn1MW7tQ+XWViDeg3ESEj+CXSPOopcDLoqxNfpmWazwTnMeinh2IWbU12ZnbEnyB1IqKOfXwG2OHHaroUAPEjjch/Le16lHCKsm784/G4jPAFTRU716eGfV7KADHwnJiXmNsKokLu354LdKvzrGrKU5Wnk5MyCdRvZxQqRKRVgX1JzIhXyvvcHSQXNZ7E/nIETkafcXoYzQWZZ3CnNpeqXuIRgz7FEij43FNKs8etydGYTrKA7Xr7l5OWIwQNojmHSa67AJuRWbAo5sp/B6MuYqz0B2aeDl30I2taTPGl1182ArFTDvt6797VZ9bOYCXuZuukHEnd8a6ni8qaUdizPKZ2nNm+Aefp6H5J9Z+j4XEPXL11d3Ng/pEpo7ZzukiW76yP0fnjq5cIaCbaKrqIIE5xX61BQVQlRxuCp/dB+0eBXfRVpKAt+apabYAA+mcEiLidDVt6ztTynlSGy7wn2qU9glcFlh7CckUcLXs/DlL6juOckq8CvXQ/Kb4oQwroRluvx4i84WYiG2IYdrRFZyka10rQxTAteMpe+k7qmV0DVSrC7aK7NW8miWKfPDfgEPdrSWJp3/sw5+PC5gZ6p4IPg/OT8nf0SEdwpo7ov7RTu1pogRo6FpdrbLI1S29+D+un4SNBJdk4j7o64nCwsHZV/LXJWYJdJsNVVSQduTeJYLwv40tAbOpbG020njGoKr5uz1ZoGF3eLfMzoyo3TAnYPyYlTKbeNIc+WzaudtePXdlS3VFwzp6t/O4CQsGKO1M0alGp1MKiQyPbMfx6lxrUfZ4EQ8o+w8fQjwp8YuSO01LgdlUIevqr3Loy3ajSnog0UHp+SKFJcbb38LY2pHzD0vADZsvqxgWGcnUp71xc3wxjY5H3xLP/nhw0AHLQxxMnvgkhgmNdzMLtPy2NQghobrtvzAyxx8q54OpiXZyP0HmMqJ3U2NiePMB7n44rYeKY7yciYZre4j6oC5Q5RjsJKrzKtSsjE4w0obDsbLACVDkSxQL8LMGN0zSlBnZa36AZEoKjLmKrH55Fl7SHLRHrKSSGOGzB2whrqVVMwFcUg9UZfv5WMIpeW/ZWSFDHSXlzGbCpyR04OJD814JPqXU3nUw= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: b08fe540-fca8-41e9-a83a-08d9a8c9a844 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:51.6959 (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: /CTEv2u1d8HF7b9g7hK6/S4jUH6w0DfT28zWBpy+lpmuLe6y35I8luHHda0WPCZWvLVqJyQ2YoucVfwMrSyBQAs++F4cXDWrLVmu9LVhyW8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC In order to allow external control via SPI, memory-mapped areas must be changed to use the generic regmap interface. This is step 1, and is followed by an implementation that allows a custom regmap. Signed-off-by: Colin Foster --- drivers/pinctrl/pinctrl-ocelot.c | 66 ++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 11 deletions(-) diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index f015404c425c..b9acb80d6b3f 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -152,7 +152,7 @@ struct ocelot_pinctrl { struct pinctrl_dev *pctl; struct gpio_chip gpio_chip; struct regmap *map; - void __iomem *pincfg; + struct regmap *pincfg; struct pinctrl_desc *desc; struct ocelot_pmx_func func[FUNC_MAX]; u8 stride; @@ -819,7 +819,11 @@ static int ocelot_hw_get_value(struct ocelot_pinctrl *info, int ret = -EOPNOTSUPP; if (info->pincfg) { - u32 regcfg = readl(info->pincfg + (pin * sizeof(u32))); + u32 regcfg; + + ret = regmap_read(info->pincfg, pin, ®cfg); + if (ret) + return ret; ret = 0; switch (reg) { @@ -843,6 +847,24 @@ static int ocelot_hw_get_value(struct ocelot_pinctrl *info, return ret; } +static int ocelot_pincfg_clrsetbits(struct ocelot_pinctrl *info, u32 regaddr, + u32 clrbits, u32 setbits) +{ + u32 val; + int ret; + + ret = regmap_read(info->pincfg, regaddr, &val); + if (ret) + return ret; + + val &= ~clrbits; + val |= setbits; + + ret = regmap_write(info->pincfg, regaddr, val); + + return ret; +} + static int ocelot_hw_set_value(struct ocelot_pinctrl *info, unsigned int pin, unsigned int reg, @@ -851,21 +873,23 @@ static int ocelot_hw_set_value(struct ocelot_pinctrl *info, int ret = -EOPNOTSUPP; if (info->pincfg) { - void __iomem *regaddr = info->pincfg + (pin * sizeof(u32)); ret = 0; switch (reg) { case PINCONF_BIAS: - ocelot_clrsetbits(regaddr, BIAS_BITS, val); + ret = ocelot_pincfg_clrsetbits(info, pin, BIAS_BITS, + val); break; case PINCONF_SCHMITT: - ocelot_clrsetbits(regaddr, SCHMITT_BIT, val); + ret = ocelot_pincfg_clrsetbits(info, pin, SCHMITT_BIT, + val); break; case PINCONF_DRIVE_STRENGTH: if (val <= 3) - ocelot_clrsetbits(regaddr, DRIVE_BITS, val); + ret = ocelot_pincfg_clrsetbits(info, pin, + DRIVE_BITS, val); else ret = -EINVAL; break; @@ -1340,12 +1364,32 @@ static const struct of_device_id ocelot_pinctrl_of_match[] = { {}, }; +static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev) +{ + void __iomem *base; + + const struct regmap_config regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + .max_register = 32, + }; + + base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) { + dev_dbg(&pdev->dev, "Failed to ioremap config registers (no extended pinconf)\n"); + return NULL; + } + + return devm_regmap_init_mmio(&pdev->dev, base, ®map_config); +} + static int ocelot_pinctrl_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct ocelot_pinctrl *info; + struct regmap *pincfg; void __iomem *base; - struct resource *res; int ret; struct regmap_config regmap_config = { .reg_bits = 32, @@ -1378,11 +1422,11 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev) /* Pinconf registers */ if (info->desc->confops) { - base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(base)) - dev_dbg(dev, "Failed to ioremap config registers (no extended pinconf)\n"); + pincfg = ocelot_pinctrl_create_pincfg(pdev); + if (IS_ERR(pincfg)) + dev_dbg(dev, "Failed to create pincfg regmap\n"); else - info->pincfg = base; + info->pincfg = pincfg; } ret = ocelot_pinctrl_register(pdev, info); From patchwork Tue Nov 16 06:23:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621471 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBE42C43219 for ; Tue, 16 Nov 2021 06:27:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C13FD61BE6 for ; Tue, 16 Nov 2021 06:27:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232372AbhKPGaY (ORCPT ); Tue, 16 Nov 2021 01:30:24 -0500 Received: from mail-dm6nam10on2120.outbound.protection.outlook.com ([40.107.93.120]:37728 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231403AbhKPG22 (ORCPT ); Tue, 16 Nov 2021 01:28:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oWbK3iaDuhz6YnmtQtg2tXy4h3V02lhdNTU8Rpa/CEw+NsFUypyItCB2LvcrF/6ZnUVU8N4pT5rTqGSL1uTspomSm/q/JouxLXzQVHG8pZCl41W1FNqkm/5IfgQV7xeuS6DEXWdfEfrM5VlvCWZh6rp/NOoFO6Zh1NPt0zrAVkfjUOZV0XEQPRICa5xY8eZyXx0czM9HFEBj2RCOP2JH0qNewqAV4VcvyzFH+9wXU72wTXv/0sRduRTo6JLfH4430ALDwNVK3NayR7j36EVUFekBqPJJH/TmDzouueAEKSIaiP+sXPmwKxn0QU7vCIovFboohodqsPxdYZsGM98uJw== 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=Mv49pXxI9NYSX9UZOP4SbUoZ3wox9TZ+Ko6Yzl+0c/g=; b=fnARpsXtxWTlv575MWl9HcmDvj/AaCUtjh/frwFpBdMhGQfyIWoqSw2wZJ3vrRbXZC0SBD6Y1jk76TTHbmSobchv97uCjZTOwPkhJOELHeZ+ISpUBzdARKePqdavbcDe5pJnwYcrAGEgS911Myf3zT52vRrnuObh+A53KJvfCGBydc7VZGbaAjk4iYedEt77d8Li+zOCYwHtXINtSikQ29W7L7BWC3uuSH6l2xnbtQsGuHOCJgVDn7SJEGyakfs1LipwEIV5lRP+oNpv0l4nx0spCgQpiFxtLfCzfQ8bnSvRTnnoTsojhNQpeBF618bMijmG00bsnH224M/XNsH1gQ== 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=Mv49pXxI9NYSX9UZOP4SbUoZ3wox9TZ+Ko6Yzl+0c/g=; b=QBsjw54bvqkwh2a5p+U3xXmyAQe/2MFTh8GwGpcjCjykePok+voTIv0Q6M6i/2aIIzD88ELdL1wTzQ8DdWBv7k9OE4TCfSJYQVyYx8hmE/6JJFZ5rMQhXcScRvtvyZ3PWjEQIbiqY8k/Wso8lYhmtWtLu+yMWf/rwjIwzofm8WA= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:52 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:52 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 13/23] pinctrl: ocelot: expose ocelot_pinctrl_core_probe interface Date: Mon, 15 Nov 2021 22:23:18 -0800 Message-Id: <20211116062328.1949151-14-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3cd11db6-2f3f-4747-ece2-08d9a8c9a8cb X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tmXTa3wLgruJE+TTwwcjKvj9/LjVS+Abla1Jg7WCycJgXb2h9SJIOjxRZA3jIHDzlQFa//Rc47JLGEwXo8M3hSIzcvxuQu0zGDMHPf+jwZidoJMPbyImcV0R6xbzZ7T64/ReL1V+VUyHx4fu6ZvJNBfO3RGaBiikkw55krDwHgg7sHfkgIsm9oiAA4pojV+lvc9fxY9cn4UXs4vTdOttlRCWDz1bRREKrDqIMgl1Q4kOULJAQhAMlgpccAOwkhnX6S5N3IvEhaaLq5DmsvxMbf2PF7g3INcpmGoDYovx/tAbsglBtZpXRbl3fzrLhsyhO2z+nxmTIc65FF60pDjOyP9euozMDnuDty9WWyjGcu5uHIb56pdDO1hjs4lvyBEaxVuw0WSp8X87f37FI07VZSo3anjeK2qevnpC6uMCBkcLAGqg9kqpcPKKG1ud7+VtVGVqHOhjlBxixoBjQgm3ZoQs48N8XrtzIbZQosIU8Yv7dDbSsvn4+kIH4uA+iPihUvJR1MzjD8w1fcxeyXXMkvmfsmEByF/WCAsbKlqrIEVKJBLT2fv1oAVUxRyAaw+MNf8lTrVAv3L6lM8+ehVWoxqHTBcQEjI167K5FN12Pmv35gsPPkfAm1I8icU5/wOkhOwk/jUAN/HZJwoVPTz6ApGJfwaTIfr5uuWLqsV01Y2eevNMI53bUCXHIRfKBeRMEPS+mQ9wCC2EIqRXVrWnxw== 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:(376002)(136003)(366004)(396003)(39840400004)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(26005)(6506007)(36756003)(30864003)(66556008)(66476007)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hsPpEXCj59Q/CZpnB3J7DtiSbHnLlVYE+pKNR4TSdfr+f4gzYar9IeRjfQULHtQc5Rh31iJsrNetRtOZRK7TR/iZWwnn+RE3IWkeSStAlP+37XZcaEH4hCpuTixCMCk6iI3H6AXoT1OorNll2g1fd1AU5V2b/mL7cZcqVqrvnVmpP7SJ6UTxkEjSFWYtNKZFxQqPv941kmY9mfjAIkEiyQ2SveIxfWpohF7tK1ehSCQCpe2KeTNwyyXN65b1OGVjAcAldvnYAvMCI68rW9S4/x3hVEmqf8HBEyduicDM6Sg/IVgaYb+D94INqmYeeiLO+1hyqPzMjxckKB9UR0XbEwtTgd5regjKxStbyaDvmJUpYhc0tkyNvAf79aEhvVEGH/Ym1o0XSFVasbbl0mSef7RD1FKG+VINXCEWSyl7Gk1+38VnPF1UhTNL5xsiZybzKDGq8pPzRDxvqQTQh80szJ0gHDrMqkOHC1Mkmvz24dsCzkQGbFwsBIRJvcMwxiJJqr8aC7xuFYhPRgdhk8HWWbdY/dioRIqpEgrQczJ73+8RrtG/nsEdPECw9UT3y2ovEDM7Con12Xxg4fEHfb9JxHiR9dAklB8L47sWKUG1muO+ssWuH3CHWemh8EsDTTcPix4eP4FLDmvH0VnraiGHV6NBpvxdVc/inavbp4nvB2CsYcS5ubvVdeRwZiEN1ylqxLlE//iBzxXqgbjQBB7+drOg7ednlPC7zoVXIHALgwMzE7+194mlpeOn+CPYCYvTnX3skj6pOIjgcmpw8FnC1eA3rCovAS5ZXSg6cHoCOeh323yNsYGw6yv68zKOlHHEaT+l6/haRp+Q5DcWRe2muRuD8k2N9EWuKuM2UzSnxdm3yIhplR8Vnmn/7PjkLo51+1Ef7OVJBd/d97Sox3KQqySoqp8N1g3uLjk/Sc2ly0hIIxpEKTtJ0gXJPJ+o/ZB00J/bts62DiZsz2fz2Yc1aqaksYFkjWDAEz2wa6BarxhClDQ+FB7VTnSzcvoX54MMtTJWEa0Uu3H5wDBbk3oftRp9U2oKzSodhEF1ehUfMiTr1D8nCqas24IONi1vVAXXl/Ggbf4vnFYmfIp66NX5susAIpDyEot6gvnRf5kbyJNmPO4zaPlqSLeNOvU7RfyFMnQK/TCloOL22cgpk7wJOm3Of5PCfKpEjOi1nWNIVGQT/qomMDSX4JOSWwsdNf5sqiBJjdLQdemTqM05mGZbQTg7Gi2e3Q7amtALVnSFIz6biLdW9DotX2/QrfuUpcqaxqqRuFjvMmQHNxwFC0DTRy1XN/WAt652gbh+GQaaPe+583ayX5fCpdg9HarqzyVLDdESvWkjDCasoNilvS0agKiYNi26y7D/ThCiYF4KvxSX4U4uiBm3/wjTTLhA3393XlZXWfU0w5AWFfHnMyn8V2TUdHhmiyico3SO+PpAVkuv3SQWP/LslsVSf8gkiok5DCqKuji9Vj+vz4wUDvyqraTgoAw77v/gmWYtVbsZUGkzklAE6wvJfsv2FZz2I29XqIWIfen2E9e+hrjzhsLFsREdu7tu34gjMxOqtFZV32VRttN6cuQYq7Yzrw5ZToTBlMXzFjSRG92VNDSp+nH+JWsd046T6Wu7ywEQdv+YEb+M0yOoBiZiISJDGz0Qm9jmjLPwelX3q6uO5BxGrKXdCRTLbNjp1aM+91vGIFLRN1A= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3cd11db6-2f3f-4747-ece2-08d9a8c9a8cb X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:52.5654 (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: mhoJzDpCV46rj5nqpIC/mTpzvThj/1iA9YTu0n9QJSut6HdrBk0WTvw88ghqZfLlQFkYWjaZacVqjsCibwENkdB4MnkoI4Oat3u+vjFBdb8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC This is step 2 to allow a custom regmap interface into the driver. This will allow regmaps that use other interfaces to fully utilize the pinctrl features. Signed-off-by: Colin Foster --- drivers/pinctrl/pinctrl-ocelot.c | 150 ++++++++++++++++++++----------- include/soc/mscc/ocelot.h | 18 ++++ 2 files changed, 118 insertions(+), 50 deletions(-) diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index b9acb80d6b3f..f8d2494b335c 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -25,9 +25,6 @@ #include "pinconf.h" #include "pinmux.h" -#define ocelot_clrsetbits(addr, clear, set) \ - writel((readl(addr) & ~(clear)) | (set), (addr)) - /* PINCONFIG bits (sparx5 only) */ enum { PINCONF_BIAS, @@ -35,6 +32,9 @@ enum { PINCONF_DRIVE_STRENGTH, }; +#define ocelot_pinctrl_determine_stride(desc) \ + (1 + (desc->npins - 1) / 32) + #define BIAS_PD_BIT BIT(4) #define BIAS_PU_BIT BIT(3) #define BIAS_BITS (BIAS_PD_BIT|BIAS_PU_BIT) @@ -149,10 +149,13 @@ struct ocelot_pin_caps { struct ocelot_pinctrl { struct device *dev; + struct device_node *node; struct pinctrl_dev *pctl; struct gpio_chip gpio_chip; struct regmap *map; + u32 regmap_offset; struct regmap *pincfg; + u32 pincfg_offset; struct pinctrl_desc *desc; struct ocelot_pmx_func func[FUNC_MAX]; u8 stride; @@ -714,7 +717,8 @@ static int ocelot_pin_function_idx(struct ocelot_pinctrl *info, return -1; } -#define REG_ALT(msb, info, p) (OCELOT_GPIO_ALT0 * (info)->stride + 4 * ((msb) + ((info)->stride * ((p) / 32)))) +#define REG_ALT(msb, info, p) (OCELOT_GPIO_ALT0 * (info)->stride + 4 * ((msb) + \ + ((info)->stride * ((p) / 32))) + (info)->regmap_offset) static int ocelot_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int selector, unsigned int group) @@ -744,7 +748,8 @@ static int ocelot_pinmux_set_mux(struct pinctrl_dev *pctldev, return 0; } -#define REG(r, info, p) ((r) * (info)->stride + (4 * ((p) / 32))) +#define REG(r, info, p) (((r) * (info)->stride + (4 * ((p) / 32))) + \ + (info)->regmap_offset) static int ocelot_gpio_set_direction(struct pinctrl_dev *pctldev, struct pinctrl_gpio_range *range, @@ -766,10 +771,8 @@ static int ocelot_gpio_request_enable(struct pinctrl_dev *pctldev, struct ocelot_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); unsigned int p = offset % 32; - regmap_update_bits(info->map, REG_ALT(0, info, offset), - BIT(p), 0); - regmap_update_bits(info->map, REG_ALT(1, info, offset), - BIT(p), 0); + regmap_update_bits(info->map, REG_ALT(0, info, offset), BIT(p), 0); + regmap_update_bits(info->map, REG_ALT(1, info, offset), BIT(p), 0); return 0; } @@ -821,11 +824,11 @@ static int ocelot_hw_get_value(struct ocelot_pinctrl *info, if (info->pincfg) { u32 regcfg; - ret = regmap_read(info->pincfg, pin, ®cfg); + ret = regmap_read(info->pincfg, pin + info->pincfg_offset, + ®cfg); if (ret) return ret; - ret = 0; switch (reg) { case PINCONF_BIAS: *val = regcfg & BIAS_BITS; @@ -853,14 +856,14 @@ static int ocelot_pincfg_clrsetbits(struct ocelot_pinctrl *info, u32 regaddr, u32 val; int ret; - ret = regmap_read(info->pincfg, regaddr, &val); + ret = regmap_read(info->pincfg, regaddr + info->pincfg_offset, &val); if (ret) return ret; val &= ~clrbits; val |= setbits; - ret = regmap_write(info->pincfg, regaddr, val); + ret = regmap_write(info->pincfg, regaddr + info->pincfg_offset, val); return ret; } @@ -873,7 +876,6 @@ static int ocelot_hw_set_value(struct ocelot_pinctrl *info, int ret = -EOPNOTSUPP; if (info->pincfg) { - ret = 0; switch (reg) { case PINCONF_BIAS: @@ -1019,15 +1021,16 @@ static int ocelot_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, if (arg) regmap_write(info->map, REG(OCELOT_GPIO_OUT_SET, info, - pin), + pin) + info->regmap_offset, BIT(p)); else regmap_write(info->map, REG(OCELOT_GPIO_OUT_CLR, info, - pin), + pin) + info->regmap_offset, BIT(p)); regmap_update_bits(info->map, - REG(OCELOT_GPIO_OE, info, pin), + REG(OCELOT_GPIO_OE, info, pin) + + info->regmap_offset, BIT(p), param == PIN_CONFIG_INPUT_ENABLE ? 0 : BIT(p)); @@ -1138,20 +1141,20 @@ static int ocelot_create_group_func_map(struct device *dev, return 0; } -static int ocelot_pinctrl_register(struct platform_device *pdev, +static int ocelot_pinctrl_register(struct device *dev, struct ocelot_pinctrl *info) { int ret; - ret = ocelot_create_group_func_map(&pdev->dev, info); + ret = ocelot_create_group_func_map(dev, info); if (ret) { - dev_err(&pdev->dev, "Unable to create group func map.\n"); + dev_err(dev, "Unable to create group func map.\n"); return ret; } - info->pctl = devm_pinctrl_register(&pdev->dev, info->desc, info); + info->pctl = devm_pinctrl_register(dev, info->desc, info); if (IS_ERR(info->pctl)) { - dev_err(&pdev->dev, "Failed to register pinctrl\n"); + dev_err(dev, "Failed to register pinctrl\n"); return PTR_ERR(info->pctl); } @@ -1320,7 +1323,7 @@ static void ocelot_irq_handler(struct irq_desc *desc) } } -static int ocelot_gpiochip_register(struct platform_device *pdev, +static int ocelot_gpiochip_register(struct device *dev, struct ocelot_pinctrl *info) { struct gpio_chip *gc; @@ -1331,7 +1334,7 @@ static int ocelot_gpiochip_register(struct platform_device *pdev, gc = &info->gpio_chip; gc->ngpio = info->desc->npins; - gc->parent = &pdev->dev; + gc->parent = dev; gc->base = -1; gc->of_node = info->dev->of_node; gc->label = "ocelot-gpio"; @@ -1342,8 +1345,7 @@ static int ocelot_gpiochip_register(struct platform_device *pdev, girq->chip = &ocelot_irqchip; girq->parent_handler = ocelot_irq_handler; girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, - sizeof(*girq->parents), + girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents), GFP_KERNEL); if (!girq->parents) return -ENOMEM; @@ -1352,7 +1354,7 @@ static int ocelot_gpiochip_register(struct platform_device *pdev, girq->handler = handle_edge_irq; } - return devm_gpiochip_add_data(&pdev->dev, gc, info); + return devm_gpiochip_add_data(dev, gc, info); } static const struct of_device_id ocelot_pinctrl_of_match[] = { @@ -1384,56 +1386,104 @@ static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev) return devm_regmap_init_mmio(&pdev->dev, base, ®map_config); } +static struct pinctrl_desc +*ocelot_pinctrl_match_from_node(struct device_node *device_node) +{ + const struct of_device_id *match; + + match = of_match_node(of_match_ptr(ocelot_pinctrl_of_match), + device_node); + + if (match) + return (struct pinctrl_desc *)match->data; + + return NULL; +} + +int ocelot_pinctrl_core_probe(struct device *dev, + struct pinctrl_desc *pinctrl_desc, + struct regmap *regmap_base, u32 regmap_offset, + struct regmap *pincfg_base, u32 pincfg_offset, + struct device_node *device_node) +{ + struct ocelot_pinctrl *info; + int ret; + + info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); + if (!info) + return -ENOMEM; + + if (!pinctrl_desc) + pinctrl_desc = ocelot_pinctrl_match_from_node(device_node); + if (!pinctrl_desc) { + dev_err(dev, "Failed to find device match\n"); + return -ENODEV; + } + + info->desc = pinctrl_desc; + info->stride = ocelot_pinctrl_determine_stride(info->desc); + info->dev = dev; + info->node = device_node; + info->map = regmap_base; + info->pincfg = pincfg_base; + info->regmap_offset = regmap_offset; + info->pincfg_offset = pincfg_offset; + + ret = ocelot_pinctrl_register(dev, info); + if (ret) + return ret; + + ret = ocelot_gpiochip_register(dev, info); + if (ret) + return ret; + + return 0; +} +EXPORT_SYMBOL(ocelot_pinctrl_core_probe); + static int ocelot_pinctrl_probe(struct platform_device *pdev) { + struct pinctrl_desc *pinctrl_desc; struct device *dev = &pdev->dev; - struct ocelot_pinctrl *info; + struct regmap *regmap; struct regmap *pincfg; void __iomem *base; - int ret; + int ret, stride; struct regmap_config regmap_config = { .reg_bits = 32, .val_bits = 32, .reg_stride = 4, }; - info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); - if (!info) - return -ENOMEM; - - info->desc = (struct pinctrl_desc *)device_get_match_data(dev); + pinctrl_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); - info->stride = 1 + (info->desc->npins - 1) / 32; + stride = ocelot_pinctrl_determine_stride(pinctrl_desc); - regmap_config.max_register = OCELOT_GPIO_SD_MAP * info->stride + 15 * 4; + regmap_config.max_register = OCELOT_GPIO_SD_MAP * stride + 15 * 4; - info->map = devm_regmap_init_mmio(dev, base, ®map_config); - if (IS_ERR(info->map)) { + regmap = devm_regmap_init_mmio(dev, base, ®map_config); + if (IS_ERR(regmap)) { dev_err(dev, "Failed to create regmap\n"); - return PTR_ERR(info->map); + return PTR_ERR(regmap); } - dev_set_drvdata(dev, info->map); - info->dev = dev; + dev_set_drvdata(dev, regmap); /* Pinconf registers */ - if (info->desc->confops) { + if (pinctrl_desc->confops) { pincfg = ocelot_pinctrl_create_pincfg(pdev); - if (IS_ERR(pincfg)) + if (IS_ERR(pincfg)) { dev_dbg(dev, "Failed to create pincfg regmap\n"); - else - info->pincfg = pincfg; + pincfg = NULL; + } } - ret = ocelot_pinctrl_register(pdev, info); - if (ret) - return ret; - - ret = ocelot_gpiochip_register(pdev, info); + ret = ocelot_pinctrl_core_probe(dev, pinctrl_desc, regmap, 0, pincfg, 0, + dev->of_node); if (ret) return ret; diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 9a4ded4bff04..14acfe82d0a4 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -6,6 +6,7 @@ #define _SOC_MSCC_OCELOT_H #include +#include #include #include #include @@ -912,4 +913,21 @@ ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port, } #endif +#if IS_ENABLED(CONFIG_PINCTRL_OCELOT) +int ocelot_pinctrl_core_probe(struct device *dev, + struct pinctrl_desc *pinctrl_desc, + struct regmap *regmap_base, u32 regmap_offset, + struct regmap *pincfg_base, u32 pincfg_offset, + struct device_node *device_node); +#else +int ocelot_pinctrl_core_probe(struct device *dev, + struct pinctrl_desc *pinctrl_desc, + struct regmap *regmap_base, u32 regmap_offset, + struct regmap *pincfg_base, u32 pincfg_offset, + struct device_node *device_node) +{ + return -EOPNOTSUPP; +} +#endif + #endif From patchwork Tue Nov 16 06:23:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621531 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53331C433EF for ; Tue, 16 Nov 2021 06:28:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 36D4E61101 for ; Tue, 16 Nov 2021 06:28:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230416AbhKPGbJ (ORCPT ); Tue, 16 Nov 2021 01:31:09 -0500 Received: from mail-bn8nam12on2126.outbound.protection.outlook.com ([40.107.237.126]:16577 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231693AbhKPG3G (ORCPT ); Tue, 16 Nov 2021 01:29:06 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JUecT4rKb8j4CnKM9b0Fqe+rGECSo73NyhVTvlpQFcBz1/UUdMdEJfNJqOR9Ynlv8t+rXf2UzczGs6O26j81MrPeKcxfTCVbs0ohrvM1cq5kHBJqr5c7auj0HlP3VP61Jm5NBG9lUGcjiuSMluaGOf3Ijxt2Dq+Rl3wUSYLkVDmEatTLUyBtw68Ruj/A2yxthZAhYQtwTV9APlN4qHSxZF96BWuT3ZLLa/o6mFqwGvGPi06384ZFvBJumZGxcFOH9vnW76Pf7wL/F8t0w8PXNz76Cmpr09JK6gfRIAMmoGGSV5hn1GMAaX1/QneNf4XNNWajPno5LRtIgRjLCan9nA== 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=KG6HdwFp/L6MLCNn8O0qkjIsstEXdp5Lz8uEeWCsBSM=; b=cnRgr3yDWtP2TXjtXDA+lt/uUNtr+JqyVOKbOGqrxtnNSzIBepx09JqciffJ+tDzDm7cVAiusEcNBdqMDXJ4+9vCRMDdEEtJpLLwaXgkJpfDekuXpMjUPFHHIXKpSpsnDf5LT+8dqD3gA3ad2V1Wf/ZIr0cDMRZAqTul+ZHtRfGOgBBtLwAaurXog01owjtcRni9g8M5eXtfGLrVY6796MFB/e6hj96RMKD9wYZOhORSNrd0cvU6NQmfqpmfXSze5QdpY4ZQ95DYhzRxBGmg12A+m0jha1mmwe27RzZHsTQ1i3XdnNW1fT9By6EnzjvQmF0sn2oQ741GKJL83mamvg== 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=KG6HdwFp/L6MLCNn8O0qkjIsstEXdp5Lz8uEeWCsBSM=; b=EXLBQADKZmbJY8K3EgVgUasV9RadoGRabR3d8BpROmKFHALV+wYw9CVjBiXs6SAc41Vr5gpdbQzKGeCBCkljQBSd8XolPlAIMjrL/PaKpvA5HZPT1aYQQDi+UO4dmjCN8iTtB5Xd8UtLdzoTEs+5zS57ipSqqFkH46Wgc4lnlE0= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:53 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:53 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 14/23] pinctrl: microchip-sgpio: update to support regmap Date: Mon, 15 Nov 2021 22:23:19 -0800 Message-Id: <20211116062328.1949151-15-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 25c95e5f-8e39-4057-47e1-08d9a8c9a949 X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1824; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ysz77RgxhCcXrr5gFIO76s/4tqkdvcsIcb+Ew/PMu04IBkTJ8h1RxNAjVJ9Ct5bYmYke0InmZp4vsyFr//6o3Umm5MytisKSZ9kgcWGyiO07cErESN/vViTJ1oN7LXuaxjsot42gVMaZVaUKl5S3/QqinTIgCP15S6TnNrDj+6u9fdogxCX5JYXeUbTZ4xyUkdjK1BOU1ddzB3rBlhJlMR2ci6NTxFHxcgxPMYD6WqnZ/CblgwgkN8NP0dd5ivxL28E3XdWEPxUMWVobZEI11uElLZL1ZA3yc0NhqBB25r6aP1xzLxneqzmaP8LJ9VtRzh0EHeRhsk+4Ve2YCnZMmhh88wIzRJyDBsW8chHlikO5sD70d+F8XwzP+o69uqzZ3lp5cFooivFCQQPd8wUx5FxyiQuUgpA/oZR6O+BQnpp1UR8cZvcOkkuFT4KBs4fFP4YGBhZFmPBJm1+2rwtYX3fJIAxgLvPK/0b/bEn+fFkAbJYQCxYPVx2zld4Sd3BxdGCVgMpvIt+9YmVUC27UUGlfzHk94sSJhZrnJMt6hhTnKT1wkK/Y6OJXbCG/3rkrNcQVD9eIZ/jpESazpbFbaLE7ra1pRBKpVeHa+H/d6GVikEVog745hVWnh9iAZD7idRvAfCTXqS7TWLSLK/50L1NEVCpVh8UQhKL5ZAckJ0QkcfQ3tDBl5Cj+j68qkk8/GQBraMDOX9VRv+LE0ER7Vw== 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:(376002)(136003)(366004)(396003)(39840400004)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(26005)(6506007)(36756003)(66556008)(66476007)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D7kw/LUUg6OCvPv/NVS0yVluf8onIpRVX6xJC5dIh4yu3yEI0GiPZ4o9w6FoEKqlcbJHiWwsQtsn/3BX0JA16iTnoc6eXMKh46NeMCNt8sOW1u3e16/eaP/4YbUEfDW7VtbsdcTZW0C49RD+ZXzzJOwytbD6mys0Jv+T5WAmSw+ts6+KAuTHcuF2V1C8Vr/GCmaIWQ9qy3NOHMhJVy/I2+qL+M/X6lK48GVHSzWyVGbRKuKk+1B5Uc29VNyFoWIYsXufqtbvD7QcdfzMYeHhKNFgTQwuWCce9pklFZm0pnAWqVj4150dp+ZiwoNsCBvxx3rjcBZqv2ciEJTtMmDystcnu/Ar1tqSQBXlQ5Xpvlaa9vRE7yz7N5cmYM4wDfFYZHUnERdQfHo+/fjY24SIQfMm0B4j9wY7G64H2xXHGJJxqyMOhntjv3/+Fdg2evaZakgzJuX9xRbs2NmdCb2GgpyQr+mq6KkMSLk4RHAjVbmXz55C87q/CqfiJmmnstvwuG5Q41Q+E7VQ9EJ/ouNpWiRxhHwWUUGlECQZrFGRz1TC2bWVnkZQcEFcbyBA5sU+xsy0rEc7TwhSEHoZhlcuRWPct+va1TXHIRqR64GU6OnKsTlI2nkysuglD5FwVLCroiM2Vkw7HBVqSRYi2qP3YWAoQqsNtaHHPKxILfpMjukYz6a/gXJQLK30KpJX8XINKL6kW1SUKByG0oxY4bTtz7n2kMpSRyB067GvKxWGdrhGa9U8z3QZIZodKjHTnNrw7bDjADGZbPsN3Bfe9m+OP468DstgYze5oLq6VffNOKxxfajvUCNQQuWfFtnm6E/Y7BmxSSjDh4UHRsnyOitYm0iarO6oo93iJyGM1xgeZOx2gGKFlpqW093/Ma9AKgwe4dYwT0E9XSEU/QDV6ej4p8R1D75OWlFZeBY3Ifk7aON1haK1prsE8l/hFzb1IjKGqBPcbktUNX5UUQbofrixGSlPnGGDwAk0g3QHfW4KBOgBepsag1Z+MAjAgrMjyD6/AzLuK/q6VOgP9nQa9qgO5uR7ysd0Hsh6TNDN8/BwUVa+mGoAowxOix3QmUuKT4cgWWBCafFpAzqwyuRWeZqhliJMJ7v5OWJWToBpCmU8DcAaOWvcRcZSM0QZBdWRJ19AER03TfUpvU787bsBJ5pbTcM7DN92EchkVosmfjewZkZPTv6sJk5stcLIP1Iof9RlgJNt2/VhDqlgwU9HE+7aTysght5IVtpLd8Mf55ow79G6XW0sY2PjC8tDxJ7qV2fN8qxmDxpTqoPB3xv1wXakSK/wOxkIuBx4/u09L85Ka1LCgvUFo8IJtvId5U8pralgTetwRZh+U2S/bva0X+vSUqOiUa8/DTvVFap4gJHOA9PQpbVgCg2T4IGh86MQipY0W7Ln6YX2ndcZCswqGIKaAW9tVjj8XfXSlZLpyM1cDn6ckpKBfxx3LjzZNwtmAHBuhTf8+JC0WUe3d1vs+bN/rt59pSWMRiNJpJKHejnTX6oQM0hsAx/+AnFPkbrCtZOD1gc9pFdgMD+iyd74avBRJ2DlSgzsqhbTUfq1Fja/Xg+Wi2KleUzP+7JAdq6j/48Ycc5kzc2pRANLmx6Hb6Y6oyk8Htr8mj1dI+gd3AcCY5qu45wl9gd8Wd+hdCDNrMxazqnU6go86Jwu97YTJO8eeHu9Nm7Cfs2FIE8HQPBWBG0= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25c95e5f-8e39-4057-47e1-08d9a8c9a949 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:53.3849 (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: SzC1pPiseQGl6CNFNmglpWJQWxYXufPUTOhm5ZXPSb7Q7KjBmYzcjPUyVBHvJQGZmoz5yL2gbPkw39BTOAeVZi8388G4hHQYLLTNyUMPx/o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Adopt regmap instead of a direct memory map so that custom regmaps and other interfaces can be supported Signed-off-by: Colin Foster --- drivers/pinctrl/pinctrl-microchip-sgpio.c | 37 +++++++++++++++++------ 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index 78765faa245a..762611f76438 100644 --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "core.h" @@ -113,7 +114,8 @@ struct sgpio_priv { u32 bitcount; u32 ports; u32 clock; - u32 __iomem *regs; + struct regmap *regs; + u32 regs_offset; const struct sgpio_properties *properties; }; @@ -136,29 +138,32 @@ static inline int sgpio_addr_to_pin(struct sgpio_priv *priv, int port, int bit) static inline u32 sgpio_readl(struct sgpio_priv *priv, u32 rno, u32 off) { - u32 __iomem *reg = &priv->regs[priv->properties->regoff[rno] + off]; + u32 val = 0; + + regmap_read(priv->regs, + priv->properties->regoff[rno] + off + priv->regs_offset, + &val); - return readl(reg); + return val; } static inline void sgpio_writel(struct sgpio_priv *priv, u32 val, u32 rno, u32 off) { - u32 __iomem *reg = &priv->regs[priv->properties->regoff[rno] + off]; - - writel(val, reg); + regmap_write(priv->regs, + priv->properties->regoff[rno] + off + priv->regs_offset, + val); } static inline void sgpio_clrsetbits(struct sgpio_priv *priv, u32 rno, u32 off, u32 clear, u32 set) { - u32 __iomem *reg = &priv->regs[priv->properties->regoff[rno] + off]; - u32 val = readl(reg); + u32 val = sgpio_readl(priv, rno, off); val &= ~clear; val |= set; - writel(val, reg); + sgpio_writel(priv, val, rno, off); } static inline void sgpio_configure_bitstream(struct sgpio_priv *priv) @@ -807,7 +812,13 @@ static int microchip_sgpio_probe(struct platform_device *pdev) struct reset_control *reset; struct sgpio_priv *priv; struct clk *clk; + u32 __iomem *regs; u32 val; + struct regmap_config regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + }; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -832,9 +843,15 @@ static int microchip_sgpio_probe(struct platform_device *pdev) return -EINVAL; } - priv->regs = devm_platform_ioremap_resource(pdev, 0); + regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(regs)) + return PTR_ERR(regs); + + priv->regs = devm_regmap_init_mmio(dev, regs, ®map_config); if (IS_ERR(priv->regs)) return PTR_ERR(priv->regs); + + priv->regs_offset = 0; priv->properties = device_get_match_data(dev); priv->in.is_input = true; From patchwork Tue Nov 16 06:23:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621533 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED774C4332F for ; Tue, 16 Nov 2021 06:28:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CFFB961101 for ; Tue, 16 Nov 2021 06:28:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232870AbhKPGbe (ORCPT ); Tue, 16 Nov 2021 01:31:34 -0500 Received: from mail-dm6nam10on2119.outbound.protection.outlook.com ([40.107.93.119]:14080 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231910AbhKPG3Y (ORCPT ); Tue, 16 Nov 2021 01:29:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FGRxlJu0mxigTl2L1oYii/73zsaTSr8J1+/bn22tK2y9xMssQv3MjaCh7F3rBE5xGTnm3a7zqr1NCj5bFoUNNZedo0NjlUzub1dnmksJbe0RwLHPS1RC77f8hiOGnGDzaeR0hi6Ivjsff1k+TL6OO4P9tHNU+thNbyXmIj/VEO2hSdmKGw25LCUD1KexEC2aOEM9P9B97A91BEsFvhyNWZuLLO3BUOVq3Pbhc6SYCCdXvXhctR5uOCHPviuPOrU+A/+6nMKiptyl25rlMi2vSwgiNBbyY+KzcNvkhvl6FSuY+PI8yVESUeGvvyN4dNhXaw5A34vU7gIhIXEPwyHVNg== 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=kLCR3kk57HMWQWKJr/cxoP2rkhaqsgktRFvEAjqD2dw=; b=UUq+zabbGuIt5yQ2ejVvAsONrcK+mbaM3lrduqujXKVRNhC7OYNukYJp4zeWqFQxyLFe0xTwFluHoVFwLIlvqtxr+FUGqPn/JltQ7MGupqo5quZZV7FStWbTrCIdw+rtMixom4FchlYW/XdNDox4D9+ap7bJ9EoU/ue19zEv4QKKjF+KQVTY4Ew99ySs0CjFyfLXail31jaJSHVVCN2YSbd3Sjp1uCf9iJR7H/nQamtb5/KRUllRIVu1eZW8Uzo28dKX32whFy9b5KoCTk1A4OHEl8KZuhLE/6J8YNxuT68OKATZQF0sYgUQ8xJpyrq33okS12W4x6W6GmQCAftlVA== 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=kLCR3kk57HMWQWKJr/cxoP2rkhaqsgktRFvEAjqD2dw=; b=hsVKjZU2GTiPwOaxfHxWFo5S4B/RRUn0u5njfJcrUDSleuqyANUk6P91LLmXGmPkMMG40Q5HB3Bj2YeNvei6nM2LlLEbzyhxb/td1JJByT6UiKBK70GrrwcR+ZHXTi5NS3pxAZeU2SoRgkl/Y1JdFwUgLtJV7QsTtsc1YBgSJRM= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:54 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:54 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 15/23] device property: add helper function fwnode_get_child_node_count Date: Mon, 15 Nov 2021 22:23:20 -0800 Message-Id: <20211116062328.1949151-16-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9659ca47-02da-4602-919f-08d9a8c9a9c5 X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9OqdySCrX8o3GnfoLJSmRjIBnOqXZtwgNLQjnbpt7G9WUJbnsOY2p/z/W3l7iM3LwEFjunF7l5BjtQsDvscBWpVy0jjuzNE9tyX8oyVsFt9s8t9eeKC+OvM72X4f5HSh+Q8Z2FO/nENK0R7nw3GJI25csDP4naGoBOMX9nWHZMyD33s7TqGypPeCiDx0zmz/ocWlZM/Oacme0YvSNs5SiEkuM92a7EO7qRqvbxIzlAUThP5Gat+FEZgUG84/BnvukwQ6fXW6hjI3xOGzNhJBGA2fnUej0j+m6rGbjVjQ85wpOBDVGTONW1OcWlFYEi04kHwxcQeKfpGECMuF3L+VXiKu8svmLqbhAyUVLjs6ylpBSOJgVB6r4Fv0Q/YJD7pC3nn+miVJY+Tyo1bWvHoUswy0ro6wiAElcoq/MiOzD8dyBBvcciVSFIMGbVi0rypxC+abhkmE5mGkJ+HAl+Q05/MbQFNFfxoXavkjnyP6xk0Tos/iLYOa3RjbWyWXbTeAQgQqKqIX2hvuvVRgi+N50FLAsPzuZ7PuSUSotHxD2Xg2Jpgweo3HXY0PfCbVe2+XxJ9ZLW3s8RT4w3kTu9/hjb8yrT/FrE1JpUl0BO4rpIcKVhkSvZajVDG2iSYhvcraqWAlj3IZUSwTXx3S1nYa3mWY/L1KwJVr6t7/+brawIU9xD/DTPB3aYtUpyjpW7R/eu65S35MRswBP+gmY5CSsQ== 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:(376002)(136003)(366004)(396003)(39840400004)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(26005)(6506007)(36756003)(66556008)(66476007)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3rYNN1fCdw1EIm+4ttC+ThzvWLJdRlX8NZgEFnKux0sqkqRNokvRPJUc9KhLpDXuclpHLWz6jT+NNWItbsgSz+iEMqhY7/3F0j5ZCBX4m46vx04JIFOh0J+rc2QIE8sjSmtTcztG7lJm5CWE9TY/cGtoR2AtWduGdWZDq9MyZB+nMS/Rdst4Sm+d1/XnvBVTXP+Y3k9/RiPtTSHah6f7tMT8MmjlOcP8gw+jHBLgX8QZQ7zLhgWVz9rfscPojQUeRlEIfAEy4rvBwaf5H6j/4wVIhLix0KFDldZw7FxlnwD2UxpOMnEjXfe/EMhz4aa6zmC8bkzScEnST6ZTejoLMkxMTkonObGJoezKzUWL8pt5gC870upI8bN8FEvZ16b1VYwMhETFnOH2dg/nE4ss+GKNfG9kY3eiLBSkuoaeHYIAF476+ECy6Mnlc3HVgsWLeWfIxsqXndHX7ztOKAdenoDxx2tWVxfOUUKGY7pqCdtsvO16j5Z6jc01LsAgQ95D1XXe9oMRIKvwtKHCQY59IOv7HGP/YW/uNmCSkdThH5TX8Jxuov2dffxKGfSalW5yhy6pGZhlGtB3hG1kR1rmngX6t8Ps5O35IPUbIi2krIuXpa5w1r3ITvZzu4y2cdrgdDQ7dXicNodPxSVNyO95z1h9ycIqldVNQ+hYQSCQiq6YJ/F2hrrTlW2wI9EEnh9QCXWjEQ48BH219faE3uvaxnZEqHYQYyTdJ9uR6d5Se0hVckUD65DK8pF1/eQtVZapx1mCkd5bIKWMacOiiBeF3LoS+evah9QcSfWODb6hvADyPOXfcqW5u4G9KVAVK96OfN/se3se9E2N7fdhcZiMB8Z553xfPC0DOcQV+h06+OH/mrgYp18TI8eJzg9mClkaCoCTQfbzz2LhLjZ8UVrq09LCr5PfP2I8apfblEtHG5eeOvd9pKAHUtr2h5I/PnykjQyhVz17JQdabXGbVLbyhTUvLebM1Xr1frZCs/sx3N1Q3k/JWmjZpjox0r2GRsHkBKq479WU6k+uBJiM+7EfeTUVY8qZlfCatbsWf+ZAibwDrdzO9IRotSOhzI0YjxpgtBuBUdPyKeW9vGu2iqrk1muMoeMEy/Q+p4RNqPOWs7XG5HU3It8bGCqatrqrc9WdN8ratm+j1+Dv4yzie17DXPXhg2KrMGWLDwa9ODdKvlPMm9tifqHYp5KwlJL8SNimo3MyV0BS5aLiravBlYidndDFqsRQ3q0msO+yLJj2dCSC6ZL6T6a+J9dWxstBR5KttG1H64jG/uxkK4bDLczmNA2hDJwj4DKCMWY7ZwXMqZt6xxVUjs+bj3048zYC4k6/RURVrHv4ezPHlA0f0PUpkLVcRSOl2Kh1M0xbEyEybPdj8zHW8NY9HpCEBd3mrx55ME+w2Di6lyP6qLRW6lpMX2o81c2c1FQF9WBK2OVIDrvlF/U7C8y2ZQB74upeUhYqWLVYHElvGxTkhQYTT3phklaOVjm9MH8fRqJ9qdV9bIoLBCUnmpxkvMK8BteFEGHN/rvXENDF2WQ017TsWwbAU9tI9gW7FNKTTovN4ZZkOzsS2f3m92YnHf09XDjlbX2yRjiKeU3v8uz6PAWA+2mZ7JgJu3+OyuXY4wNWrUK0/tWMS8gC53PIekuOQKTYaV3nYpWc2vvXvc/8xO5gltIjMoiwRbGXjGnWKRQ+kaPt6jc= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9659ca47-02da-4602-919f-08d9a8c9a9c5 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:54.1605 (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: z3vh5eA5mUXQw5NhTuyR/JpDbff2V2nK/tNWFm5xW7++Dh2EZgODz0tKOej2awYeyEWUI01Vc3y1m+ZwHNff2JNFHMJNj8RYe8CCQhjMv7c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Functions existed for determining the node count by device, but not by fwnode_handle. In the case where a driver could either be defined as a standalone device or a node of a different device, parsing from the root of the device might not make sense. As such, it becomes necessary to parse from a child node instead of the device root node. Signed-off-by: Colin Foster --- drivers/base/property.c | 20 ++++++++++++++++---- include/linux/property.h | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index f1f35b48ab8b..2ee675e1529d 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -845,19 +845,31 @@ bool fwnode_device_is_available(const struct fwnode_handle *fwnode) EXPORT_SYMBOL_GPL(fwnode_device_is_available); /** - * device_get_child_node_count - return the number of child nodes for device - * @dev: Device to cound the child nodes for + * fwnode_get_child_node_count - return the number of child nodes for the fwnode + * @fwnode: Node to count the childe nodes for */ -unsigned int device_get_child_node_count(struct device *dev) +unsigned int fwnode_get_child_node_count(struct fwnode_handle *fwnode) { struct fwnode_handle *child; unsigned int count = 0; - device_for_each_child_node(dev, child) + fwnode_for_each_child_node(fwnode, child) count++; return count; } +EXPORT_SYMBOL_GPL(fwnode_get_child_node_count); + +/** + * device_get_child_node_count - return the number of child nodes for device + * @dev: Device to count the child nodes for + */ +unsigned int device_get_child_node_count(struct device *dev) +{ + struct fwnode_handle *fwnode = dev_fwnode(dev); + + return fwnode_get_child_node_count(fwnode); +} EXPORT_SYMBOL_GPL(device_get_child_node_count); bool device_dma_supported(struct device *dev) diff --git a/include/linux/property.h b/include/linux/property.h index 88fa726a76df..6dc71029cfc5 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -122,6 +122,7 @@ void fwnode_handle_put(struct fwnode_handle *fwnode); int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index); +unsigned int fwnode_get_child_node_count(struct fwnode_handle *fwnode); unsigned int device_get_child_node_count(struct device *dev); static inline bool device_property_read_bool(struct device *dev, From patchwork Tue Nov 16 06:23:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621535 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC34EC433F5 for ; Tue, 16 Nov 2021 06:29:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE4746115B for ; Tue, 16 Nov 2021 06:28:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232920AbhKPGbo (ORCPT ); Tue, 16 Nov 2021 01:31:44 -0500 Received: from mail-bn8nam12on2126.outbound.protection.outlook.com ([40.107.237.126]:60901 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232002AbhKPG3m (ORCPT ); Tue, 16 Nov 2021 01:29:42 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lEDPE5DAz5dgjysi+kPvXjqcQILu4PTDKQWZ3ovEmpppv+Tl2K+JlutbMU2rzZXx3oywB50NG0E66wjFc+65z4x0o2sfYfH7z4xQO3z9cZMhdiZnogqgsMVEztAKokDKKmfYD4RU9IbwGKwGGdgCYJCQA7aBag/h8bCF965JBSnJqIKjyc6YFQfdX8wovsnBgvkQqMz6OsOGB+uoT8x86QHUmIr5wUJSool1AxQ8NUUp7XyhHlX4xpJRWm0MIJfdKYeOhbkLnyFD+PB4PPg2gaLaxaN0V/eSZ7iydDaPgQSEpWdYY1+AquoZE/UPLeB27YoKqCkBxIjnsWQ7dM7xIg== 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=P9JsKGSxS8228sE3prsCueXlIcq72l2sV5T89kpzo+w=; b=kEWI+CMbkiMDRoyPTRsRI/+wzP2AbxEFCdcgI5aqI10uze4vdAj0Uetr1arop5P/IGapzCKJtqa6Hc+SxzJSAP0l2w5GNCvGlVwYS4dsUnn9uhoLWPyR7fMbKxJonG65OBVG9LZ/2ZmscM9mNojaGEolkZZO5a84sTBEZUDmqfKT5QazSGz4LL19rulmJcqkHyxnLngHfuSzIj7qaTWgKAcG4q3Djc91wAuK7cdKP5jeRv3O/0N3miG29NHJvdnZmww5jUvcku/8rCFX7UK1gyhyCadibScr11owCuesa6GjPt2NnDeewr6h70k4CT53abmUQMULXwR415TfqA0ODA== 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=P9JsKGSxS8228sE3prsCueXlIcq72l2sV5T89kpzo+w=; b=e8a1pkmpXenm9UcerxYfZaEXrl4Lsb9j7n44p54hUCic9cwYVV+GyDnF141YchVNk6wYjbBzfPuL8Bj4Ia7McqIihjD11bnGUrVExRlp8/EVNe5q1s0JEdIf6GLOARa5D6LYGPW24Eh8GsyIudx5m9IgCOsgof0DAXi0GqHawxk= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:55 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:55 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 16/23] pinctrl: microchip-sgpio: change device tree matches to use nodes instead of device Date: Mon, 15 Nov 2021 22:23:21 -0800 Message-Id: <20211116062328.1949151-17-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 31ebb60a-afb1-4c9c-dc01-08d9a8c9aa38 X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:60; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7JxSQuGsUDBv9BfrPg0uFYGQfsmmA+Y5GFmT9iJLvjAj0I5vGKVA+yVn3ssSi1xnpUf/P7XfedX/filvg9ykXMZwsnqSrGpA4QeUa73v8gtW7KwxhL2BOiu8Oj1ixOZ/epaAsMj/ghIzjxeHqju9jaWFCGMMFtK+wOIR065NZMMpDanwvIik7u9/KOMFKaAchq1Tou4E3LI23w7daL4QkN2ZohPLFCIu22jX7mP3TAqdIAFH8w0B1mA5GGGNkv9wQGIYqvxFRLNRoJlyRqq4CLAy/p1jvXoBki4Uj0F2ab2BcRktEQr/w5npGrgLvXS7Zil//jgf/+RVBVqVavZAeqZ4IxS+H1/3GzJ2aUo0tsuSfYLnbQ+P6eyapyoog8fA2QaU4vvgZk7hzgJ9ft8JaENB65k74xCY4xxGfXtA2eF7Rzi6vzi/DawKdSLtlcNdJO5jlgBqAPFIgcriJkSGPl7vJowwb0HADeR7R08kqmYBQ+Gwc58RnaXo1DNGGDyO27rZwNJPWpe9vSM9XAeqhC7vaPwO7pqpaNsxsZU74nDmgnSkLHS5dLBB4frnJqsshZ57q3pnKyIIKLyEwlQGzB4uf/plaNmCE0SGhKyWEwzqNFr887LOTry2pQoYv547IkPrjAgKIasXuPURcMRgnCe14hybMMixGs+HefyvTW0wGgAQ8IosLmO1keIxSnRo450TJqz4MALhDnPnGFerwg== 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:(376002)(136003)(366004)(396003)(39840400004)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(26005)(6506007)(36756003)(66556008)(66476007)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ovQZyD5yHb206BAUWWEvD8IPChkVlbS0bqQrlGgCw9yux7zH15mc1cI3Yc6Vz4aq2OW0b6li5uHU4BmZn6XT64Xnsfgg6gvocuXRgqTwkEDxIsYEyAGEeTkxS8vKLzhNyaUR07he4kbDCmXxN3Rn3kIZDDQPbmZjKeVoryVGw95uDTYdiKRTX6QhCb0JcR7/x2abzcs8MzikmTHM6zKVtiq44idpL4BLAJn3bXnHYDfLCkDnH0jDdXjDIp5VFG5GHziMTS2icnw6aRs0owe2LYnp8b8iUe8ZCILxQyD6irwPv24pzbGGM29yyl3+jEYBVD5P0V3dHQGe0+MGomyM1iIEC+F5Ae+4KGenCm/AKmWHG1NJ08R3Tv7nz2AseCMTBdeZNOxsgh4O5TxbjrXMTcCOuLvph6jmcIPeba/YYwZ1SOgRjrajp6CLyllvR7KXNWYTnkqhP8nvew/aZAj7mYStlHa2eNAf+nope7afYKLpYjoTUdHHNOxKwP+2L1ZPt9ajjkyTb8UPTneeQTArwfNRa0DRroALuS7Q/cHZojNwxDeTSCJELs1WW/F9sofe7udIhy1Qs4fIaWoRFk11GldnmXE12jDz2/zqSTk7xiCZadlmTBfSqVgFt75agoTUxl2WmUE7HYX0PIExO/8jb5vmHKgl2yMd33bkur3KG+Sk/hhbcj8ZcJ5XPPlyDIizAh1znLCkRjAGcjyULc43WLKPKuFAS5PY9ZW0DUo8y7Yh96CkFDocoZ/fCX83UjINVXG63PPld/2K6msTdeddvX1vkG2wR9ObiPPifa6ps986/MyirtiJAvMe2lLepi4hPGgcRqVPO5gA4lIhH/FGRsyg87s0lJIpz+eOSB4NKkxkEPEQnDcpVS2PKDhn4R8i0sUxQpWrp7MeycfLW0+Z/NvAOy8ML/MKYwhm+adWE0Rv6up/+ow+cyH6Cz5aVC1JKsD/UYgnlwLHaMp21cYSprCYTLzke1XWIIPWFhFuUmrGI83K5Lgc4yxyfBZjKslFzvTQPOLKYA/zoPmlNSAkT7l6OkDZk4wVvs3HDi2fz0QHJaVHsweJvG+GyhSy5Oaj6zUwbZJiMlb0bHl64inMobCDlyP2ycSmeXz8wQb9YlG/2xUbgPRbF0C9GCJoHdm8afbpz8tIoAcQLU4IKbft5DThvf5zH0y4Ft52npRqlfG5oyKSuVNe2ZDKdAMf5yPPrLNiFmsR9dDnlQE9c+RNYU29AC2ofkZNXPs1mbXb+VXL2YOrkWkzzKm8KTDHObuHf0FyNJJW1BcELIvY+S4lfiG/Dk9UAn256YKnJlARaY85OtaW2agFL2A9HRMIxaYgUG2tLaw46SPmzNEFEZUhuhOD2vvMOC1o7ZjPxrZRcm3H19GflwNTxZZ5BKL+M/KaJuY4g171RnmNshsXureFVTBCSdAZAQmaWECykoKiJJE/h1XFaSip06Q4UAA522C+xBZiWQrHX8co8l5LzKUnbvYErXN9lKihp2wh/omQjtFhL9UGekBgnQSwfyAH0gGdO6DZ384kIVDb9io75xFMs7arGC1/IPEcAn1iDtCQ/LFvqpE7dqC/J7h3uHp4oqFGQec3Esodc1HCeWZpKNGLh1tlk5Rk+JjJHp7TFEtZsv3gLWwATL1KJbMC44WYyMNuypiTPAuQTEzuRTM8Iu8q9K0+E56BaR6j8HRGLG9CZ38= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31ebb60a-afb1-4c9c-dc01-08d9a8c9aa38 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:55.0060 (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: Hkld14XiAxcTxehD+SDIA7KAN25w3nKSduh+wazbFn0lW/+TUb+xeAWPUxD2tqzePUUcmJmshxkCZQef1t3JNxJjWcj1qzjiozjIAeEHVyk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC microchip-sgpio is being updated to support being a device of a device. As such, standard devicetree parsing functions (device_property_count_u32) are being changed to a lower level functions like fwnode_property_count_u32. Signed-off-by: Colin Foster --- drivers/pinctrl/pinctrl-microchip-sgpio.c | 72 +++++++++++++++-------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index 762611f76438..10736ef5c6ca 100644 --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c @@ -109,6 +109,7 @@ struct sgpio_bank { struct sgpio_priv { struct device *dev; + struct device_node *dev_node; struct sgpio_bank in; struct sgpio_bank out; u32 bitcount; @@ -524,12 +525,16 @@ static int microchip_sgpio_of_xlate(struct gpio_chip *gc, static int microchip_sgpio_get_ports(struct sgpio_priv *priv) { const char *range_property_name = "microchip,sgpio-port-ranges"; + struct device_node *dev_node = priv->dev_node; + const struct fwnode_handle *fwnode_handle; struct device *dev = priv->dev; u32 range_params[64]; int i, nranges, ret; + fwnode_handle = of_fwnode_handle(dev_node); + /* Calculate port mask */ - nranges = device_property_count_u32(dev, range_property_name); + nranges = fwnode_property_count_u32(fwnode_handle, range_property_name); if (nranges < 2 || nranges % 2 || nranges > ARRAY_SIZE(range_params)) { dev_err(dev, "%s port range: '%s' property\n", nranges == -EINVAL ? "Missing" : "Invalid", @@ -537,7 +542,7 @@ static int microchip_sgpio_get_ports(struct sgpio_priv *priv) return -EINVAL; } - ret = device_property_read_u32_array(dev, range_property_name, + ret = fwnode_property_read_u32_array(fwnode_handle, range_property_name, range_params, nranges); if (ret) { dev_err(dev, "failed to parse '%s' property: %d\n", @@ -804,11 +809,38 @@ static int microchip_sgpio_register_bank(struct device *dev, return ret; } +static const struct of_device_id microchip_sgpio_gpio_of_match[] = { + { + .compatible = "microchip,sparx5-sgpio", + .data = &properties_sparx5, + }, { + .compatible = "mscc,luton-sgpio", + .data = &properties_luton, + }, { + .compatible = "mscc,ocelot-sgpio", + .data = &properties_ocelot, + }, { + /* sentinel */ + } +}; + +static struct sgpio_properties +*microchip_sgpio_match_from_node(struct device_node *node) +{ + const struct of_device_id *match; + + match = of_match_node(of_match_ptr(microchip_sgpio_gpio_of_match), node); + if (match) + return (struct sgpio_properties *)match->data; + return NULL; +} + static int microchip_sgpio_probe(struct platform_device *pdev) { int div_clock = 0, ret, port, i, nbanks; struct device *dev = &pdev->dev; - struct fwnode_handle *fwnode; + struct device_node *node = dev_of_node(dev); + struct fwnode_handle *child, *fwnode; struct reset_control *reset; struct sgpio_priv *priv; struct clk *clk; @@ -825,18 +857,21 @@ static int microchip_sgpio_probe(struct platform_device *pdev) return -ENOMEM; priv->dev = dev; + priv->dev_node = node; + + fwnode = of_fwnode_handle(node); - reset = devm_reset_control_get_optional_shared(&pdev->dev, "switch"); + reset = devm_reset_control_get_optional_shared(dev, "switch"); if (IS_ERR(reset)) return dev_err_probe(dev, PTR_ERR(reset), "Failed to get reset\n"); reset_control_reset(reset); - clk = devm_clk_get(dev, NULL); + clk = devm_get_clk_from_child(dev, node, NULL); if (IS_ERR(clk)) return dev_err_probe(dev, PTR_ERR(clk), "Failed to get clock\n"); div_clock = clk_get_rate(clk); - if (device_property_read_u32(dev, "bus-frequency", &priv->clock)) + if (fwnode_property_read_u32(fwnode, "bus-frequency", &priv->clock)) priv->clock = 12500000; if (priv->clock == 0 || priv->clock > (div_clock / 2)) { dev_err(dev, "Invalid frequency %d\n", priv->clock); @@ -852,7 +887,7 @@ static int microchip_sgpio_probe(struct platform_device *pdev) return PTR_ERR(priv->regs); priv->regs_offset = 0; - priv->properties = device_get_match_data(dev); + priv->properties = microchip_sgpio_match_from_node(node); priv->in.is_input = true; /* Get rest of device properties */ @@ -860,17 +895,17 @@ static int microchip_sgpio_probe(struct platform_device *pdev) if (ret) return ret; - nbanks = device_get_child_node_count(dev); + nbanks = fwnode_get_child_node_count(fwnode); if (nbanks != 2) { dev_err(dev, "Must have 2 banks (have %d)\n", nbanks); return -EINVAL; } i = 0; - device_for_each_child_node(dev, fwnode) { - ret = microchip_sgpio_register_bank(dev, priv, fwnode, i++); + fwnode_for_each_child_node(fwnode, child) { + ret = microchip_sgpio_register_bank(dev, priv, child, i++); if (ret) { - fwnode_handle_put(fwnode); + fwnode_handle_put(child); return ret; } } @@ -892,21 +927,6 @@ static int microchip_sgpio_probe(struct platform_device *pdev) return 0; } -static const struct of_device_id microchip_sgpio_gpio_of_match[] = { - { - .compatible = "microchip,sparx5-sgpio", - .data = &properties_sparx5, - }, { - .compatible = "mscc,luton-sgpio", - .data = &properties_luton, - }, { - .compatible = "mscc,ocelot-sgpio", - .data = &properties_ocelot, - }, { - /* sentinel */ - } -}; - static struct platform_driver microchip_sgpio_pinctrl_driver = { .driver = { .name = "pinctrl-microchip-sgpio", From patchwork Tue Nov 16 06:23:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621537 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D434CC433EF for ; Tue, 16 Nov 2021 06:29:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0FF6619E3 for ; Tue, 16 Nov 2021 06:29:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232586AbhKPGch (ORCPT ); Tue, 16 Nov 2021 01:32:37 -0500 Received: from mail-bn8nam12on2094.outbound.protection.outlook.com ([40.107.237.94]:48724 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232289AbhKPGaS (ORCPT ); Tue, 16 Nov 2021 01:30:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DtZwll/dLcSz+95bR61kzFvhjgKr8ySxM7kOn5e3ub1cKbJEuijKl+tHk2yiHCR4iM2SjgQ/A1YJnaczA1HiNSge/OWytSD6AfMsf0W9neOKpNWKsFRN3SdMEIgl5L1pBewH3pgkPtmgiUVHMo8zTOipcz4OjEWGStLLP8GnWXHgGLUsTxoL+P/7Cf46e7dh8CLckbBwLU9Ze0ukUhBid3iN6sgBmw/SSCmm6biz5QYy1Zhwt2ITWRvfKY8sCF2+Dn60+R2QLOPEDVt2ksPiGeV4+oKGduZWIRXPVYxAjNj0l2bcDYESpyc9IBcY+8BJqEpyPuwAQ+1bJf0dkFc52g== 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=zWV4Upnmxwx/szBkLrr9MPQtQbkM2sq/JfT0exYhS/I=; b=n2W7o4j8M+SibLlXlB/BO/O1Eei5Swbrkq1d1X49ICH0k+IDQbhRvPzWHSuhHwEoPcOMC7ASbImzyFzFArnSPpN6yMHzpIuLO57ORowTD51wMvz7SIFd05tjKTzNsiMs6p9kfCsfsDoRyXr8g1rGvPiFwjRqQisX3SC1LL3p4aIrJOSfKpyB4fegG7zpLxWnvt3yiEDDc2GgmAb4ZOuQv+fnhCIAUZ0gOL/MGE6vXqA0pHxrbM89a42nv0GX9QzQWbxbOn3yw6MfSJNUyL0I4hJLep7W1diAHHeGcIq4Cia8Zv/USDbCDYCYBmQEplYbYzdr9u1j5x+6wUEb4K2Gbw== 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=zWV4Upnmxwx/szBkLrr9MPQtQbkM2sq/JfT0exYhS/I=; b=x8Ak4PN7NRKlmCadBLeVsjIOGPYeHTHHirUMOUlY1B/EfM0Saf4/cNH6qIECeaPkbsDp58JZ0DeNvA2xPQeIVJi4jHxf147++yXeENgbIbNZFmZdi7l9KrXIL1DVJ5MBG7gN5YZef6RPXj2gWYn+chHZD6jq0vSyxwni8Wt4MYA= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:55 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:55 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 17/23] pinctrl: microchip-sgpio: expose microchip_sgpio_core_probe interface Date: Mon, 15 Nov 2021 22:23:22 -0800 Message-Id: <20211116062328.1949151-18-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ad762ad-df57-4e9e-b8f0-08d9a8c9aab9 X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:849; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kS45hXHanBSlrfzYedCDAM6T4juGP2HJc2eopBxckGMye7Kka86o/iSW7kicCtTDgvD4gvWZkt3+ZMdVIUPQV441jgReRZxRIn6SQdNGj+F5oSvZu4wS0L1c1+HzfrBkXFwkCyfTzwSldcPpG3uk6Vs6bvNj3I/Ni1ilsA+hY65GUWAUwnZrNEruJtLl78RCVyptUzBTOdFTPJvNQEdZ6gVr7kGJV/LLk5Rt/M9CCNNyLVhk1anzUapuA0BJHmJGI7e6BLMCUxOxkn+9PW8UT+5GdONqsnCYPzoMwWxHgU7KMgTaVTmTAKY+1HOqUT9bhDxtlsWjg1LRKK2lfNZOcgMSul7GIYA6YcAlAMLFzQM8Lg6DmrSKioJ+sm0sXr1iFGJhM8xhOcLp66hat3VDhbh3rUPlgg+jFVi/R9ODhy3ymrgMhlO36PBeU4q2dGm9+N1M+2GGmKwtTwjqRI5k82P4O64FlZnqxdTkphCoO2FWHDqUbEpKjloMRSIKlIemo3PGYn7KP2cd4EYmGD68/PqdAIObZEpOVmNMt3YvkAmTS7ms0PE55gpSRYStTxcDih5p6YhZ/gtH8riMuYG4VOq3SUw4zF/kTQATr/fZyWxnm4HYjjWNGg/4mvTOOcKiAfEK40z+Zdq6vthRMhZodnAEOiMotPs43pUPSWfQgYNcfnrSRl/bXsPTeZAjSwqMLTKsDLA0HQxmcIZimFs9Rg== 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:(376002)(136003)(366004)(396003)(39840400004)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(26005)(6506007)(36756003)(66556008)(66476007)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eeUgueAHwrs+OgmQjdHZN2UiHb9Hn2fR/Y6MTEkC/bvnNHUUXcPDeuO8FXZF7lIhcYgVjHX3JutrS7hhSCFlSoxEH5aGR8Awwa6VxBE5ORuJUTZR4k7YOJIv1+ja91Mpq0oiTxrAcCMqRraBhXhi1lt/panZ1uz8ZIz/wEVPbfx2j2i4Q5KksK+GGtClTyVgHoP/mZuUm2LX5fIDeI4dvSFGooYTbq3HgxOXOZzI/u2YY415O0BZEHvQFR3+IbUiRg3IeosN71c5NXLqFKbE4X4M0c/M47U6jqPWcS3n+7plICccugvlqp8nc0/4htYdwn+V1s6ICAS3/66m1ItyKZQ9rUoB75OO3she4PDM2SvqvgMkyZAme0+ECXHPO8QN/oC5uvpYweC4+Xyo4SXa6ciMuFoAHEEnDrsXOjiZJabAMJB9I4EQau6SAvlBK6Jv5hIixrVq7zyhWJUkBdispnDNDj1YaH75qjgzjQte1sljSxu0BBb4d6Cv+/D+rifd9jVxUqGZrdnuc8xb7JiNxeTUP8rs1ppw2mvqog0UAE7fG3Gn5giIi1ZuqulJTdd1B4TZDBfZSLFKE8bxVluVL27igjKxJhUGpILRVnlv+RolccGehTkXd3pYxUHff23YVPePpUPBRflIrQUvjQSYwyMA+QrXS1nQNBvz0wS50pHJ6OHIZ2bmIHh9E+3CQi6/Sfd11mB9G2RcFX0cp1yEbw0/45VToZ0RIh8T7unaRv20tNE51kN807VA7f4cRoJ823i3TD5IvIIVKN2qNgCtOXDnUvGBeq12HSYf2ns5YBY087I7sUVt3Ln2pHjSNCRL3gnYHZ686vDI0RsHVRMJbv6ZeOZsH09fyyOAM9NfMFtdWwKXxQCjAa+MLilO1Vq3gydUIn0li2OpiMi7O6Leu0QC3lh0yPqiHepx2Ia3YoejaWtIwROsMI3W61e761KZFv7wLX1604NpaWKd99flM+RRElc6NNBQChcNtSlEqRcF1hlkaiuahwV/iCCss+9Otc80ZoWz219PC0o2kAkRp51gGQoQr9VajPYtQviMwkQcONtPXc/lM75Rw05DSoqgpwP9CLA807Oq5mQTW5d7qUehXYrWZq+KeGWTBhSoIr0WRxcmbYC2rJDayU/oVqoWx5iI7PLEATW/dzlFtCYgCRHsDUFcowxRg7EvCJT5dvTr2GZigZOKfYNYSxaGWCOgRqMyqvqAj04buJc/XCdqSWqyV/E3jSbD5LdOmm+Jfd1hVpKiaA3Hb3v/OJqUhUhRFJY7hZUwQn82nMt6J2vxMrowqGXnscbFJIz9uXsI7O+W5P/JdAYsGHcH3bkUDRJDb53OnlNx1xUIXsmkhetrhPonFTZ5nWLoD0qG2LUvja5iStIXKFTxVjSobxy5WwwN6fPEKUgvLezWHibEKxM/ybvXhw73Z7sZ5UcVSmG5t0SBIBEj0lHIfxzWujibD3qEyl/ZgkB/9gjJ8iKEeiTWUqoRbSXDwFpNQBa24QqQ+aAJWQv71R6osPAgbr0bEn5+jUURU4SfRad8CttyHXWP2le4zcSpHFsonNqc1vUb7/c7AF4vt+cRD7or2zGfrI1fUHgXQfx64Kt8KKvDgyrNUlmzqWTKAlAgwUANmTFabsTP13l+waPYUfvA6GkLhxIn4gmKkmW1+0NifKWoBV7kQEwjmf6t+L2Vf575wwzff3w= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ad762ad-df57-4e9e-b8f0-08d9a8c9aab9 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:55.7515 (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: MxeY9zuyQ1XCkUDoXbK+zm5lWwLpvZxR7jB/BYE0c6m3cZeapaVdbc9SvJJw1lwaKSWeBniOGzu2mjoC/p40hWg6KUilgA0kaMxmVF2aeSs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Allow external drivers to hook into microchip_sgpio with custom regmaps. In the case where the sgpio is part of an external chip like a VSC7512 controlled over SPI, a pre-existing SPI regmap can be used. Signed-off-by: Colin Foster --- drivers/pinctrl/pinctrl-microchip-sgpio.c | 46 ++++++++++++++--------- include/soc/mscc/ocelot.h | 11 ++++++ 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index 10736ef5c6ca..2ddee50707d0 100644 --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c @@ -835,22 +835,15 @@ static struct sgpio_properties return NULL; } -static int microchip_sgpio_probe(struct platform_device *pdev) +int microchip_sgpio_core_probe(struct device *dev, struct device_node *node, + struct regmap *regmap, u32 offset) { int div_clock = 0, ret, port, i, nbanks; - struct device *dev = &pdev->dev; - struct device_node *node = dev_of_node(dev); struct fwnode_handle *child, *fwnode; struct reset_control *reset; struct sgpio_priv *priv; struct clk *clk; - u32 __iomem *regs; u32 val; - struct regmap_config regmap_config = { - .reg_bits = 32, - .val_bits = 32, - .reg_stride = 4, - }; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -878,18 +871,14 @@ 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); - - priv->regs = devm_regmap_init_mmio(dev, regs, ®map_config); - if (IS_ERR(priv->regs)) - return PTR_ERR(priv->regs); - + priv->regs = regmap; priv->regs_offset = 0; priv->properties = microchip_sgpio_match_from_node(node); priv->in.is_input = true; + if (!priv->properties) + return dev_err_probe(dev, -EINVAL, "No property match found\n"); + /* Get rest of device properties */ ret = microchip_sgpio_get_ports(priv); if (ret) @@ -926,6 +915,29 @@ static int microchip_sgpio_probe(struct platform_device *pdev) return 0; } +EXPORT_SYMBOL(microchip_sgpio_core_probe); + +static int microchip_sgpio_probe(struct platform_device *pdev) +{ + struct regmap_config regmap_config = {0}; + struct device *dev = &pdev->dev; + struct regmap *regmap; + u32 __iomem *regs; + + regmap_config.reg_bits = 32; + regmap_config.val_bits = 32; + regmap_config.reg_stride = 4; + + regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(regs)) + return PTR_ERR(regs); + + regmap = devm_regmap_init_mmio(dev, regs, ®map_config); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + return microchip_sgpio_core_probe(dev, dev->of_node, regmap, 0); +} static struct platform_driver microchip_sgpio_pinctrl_driver = { .driver = { diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 14acfe82d0a4..8c27f8f79fff 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -930,4 +930,15 @@ int ocelot_pinctrl_core_probe(struct device *dev, } #endif +#if IS_ENABLED(CONFIG_PINCTRL_MICROCHIP_SGPIO) +int microchip_sgpio_core_probe(struct device *dev, struct device_node *node, + struct regmap *regmap, u32 offset); +#else +int microchip_sgpio_core_probe(struct device *dev, struct device_node *node, + struct regmap *regmap, u32 offset) +{ + return -EOPNOTSUPP; +} +#endif + #endif From patchwork Tue Nov 16 06:23:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621539 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52B2AC433F5 for ; Tue, 16 Nov 2021 06:29:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2BF53619E3 for ; Tue, 16 Nov 2021 06:29:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233200AbhKPGcj (ORCPT ); Tue, 16 Nov 2021 01:32:39 -0500 Received: from mail-bn8nam12on2139.outbound.protection.outlook.com ([40.107.237.139]:7392 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231418AbhKPGaW (ORCPT ); Tue, 16 Nov 2021 01:30:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PzrnZOaU5hNqpD2rtlXM59+6Kx3HJscCsJ5gEZ9CGiMpEGh+Vm+2NmJsBsmid6SGVHF5yWGljvFE9I8Odigh3O9LzR0/SmxpYKXJajkWK3Yh8TYDApjnSGMfwXxg2moGmHyxjK78/oUIDt9+j4FUhBWD76kaPtvi6fkkIfvXQ52XNq9CTZd8y4tol/LlIKVHNSGfMotIOR5xYqSaIoqjSCvTFj9WRsUcotqiAYRjm6BL464WgO9h5yl96xT6PvTMvwnGyRnUQjwziU2H2XQevCqGrE7+vNUswsMJlf33FG+Hgjd4/kenKZzdpun4Zcfr83OJb2LmELyDv3JnKwLLuQ== 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=cszZkPnV4BadsDimOTuz9pvDojt7sQB7K03sDa1qf9c=; b=kZ/StDtCL1oFZ0fL1Hi0g1ezfJ0iJ07WEf0TnWDPO7qcRtdQCsIYgVD6b1k7taQswiGgqbe//Tj8bVYL7hteskkOUhIjKvMJH8tHK4z6coOw8e03WSDwJbc5eSUJhy/O+psyd4UjS3sOgzRUDAHzniiczd4ts91JQMpchcK0+iVOWxRPKQWfOLtkEzyg/8tKrx79aYMqjalskoJXMkLnMfIz76jjX/VkZk1kz8H1cjiPexOqc9S9yWQTU7V5Fuohcu3tV7jS7Eq6VdOdNLWBoPZvCXKapi+uZE6Dhr4Wi1FgtZ6kKWyoe9hL/Cx7KITPDGHDjy+aT18KSs1j+bnI+g== 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=cszZkPnV4BadsDimOTuz9pvDojt7sQB7K03sDa1qf9c=; b=r8yP0B5xVQEcZ2XqfB5OcbQ43WwDUKNcNUpg2A1mhZ+ZwppzIRtUgZkKedptn6OQ2lSGyuaJCDmRUBUMeseAud0/KZ+MeyMDxRcEBpGL2zQwLs3FutoEKyoA+6Y/xGHFXaBuEpEev4aJeg4zHHT0Ls+tUvaoHtUCXWqIhGta4Wg= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:56 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:56 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 18/23] net: phy: lynx: refactor Lynx PCS module to use generic phylink_pcs Date: Mon, 15 Nov 2021 22:23:23 -0800 Message-Id: <20211116062328.1949151-19-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ea90379c-4735-4bf9-c686-08d9a8c9ab2d X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:172; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XgVnsjYQm2qvciJ8Ll9UgkPH+hoSe71Ub+fAbIs89dIVC7xk6N3v+IMwiOrLNcfuXt9W7YNQdOoVUXHZD0o4/zVLrPVIfJ0U01Spi535/TVyrUsJllFhqjw9cXAa33xJWDPHejJPtc6rKExePKsa0vtvUHU+IPhW24fjn6zesFjADWpXu5izVVOLZrIvfstaXC5rS0Kui5ukIFFJklD1xcHMttNexRsOCp46JRFXiP8zk51pVT5/y9FaUom6TkgO/D4uh943KrdMqAe3u+ZZYUDDTa9bwO1EvQcsgRgMSlmOxER2dd9hLVpt0aFZoGX/OHFrQu2XzGHX+bay/sI3vlhQyskO5hpmmTnmYwKX/kfhlKIMb+irXIDMuNjvfMcJI7dv2+0oyqAMqOoGtzaachK44cS7PW+6zWS3fAHAwcZEi61XheKpZJVBAdQXnyUed7pqA5T6KAR4fkfUyArHyrnK3oxIrM6ev6+ClFf/ggM7j3b91HeVK/mFThhhoAtvzhNzL9AE7ELZdQ6J0mM6YUdndfYkNZP8dqg+VZpBBDdnG6aacn7TeSe2n12G4rBHZHcNDJaWjIW8Ci8eOJhASVT44ETo7yoiZWfcxYs2/KKOcF3t+OnsSaSQsY+1G4jgpxMw5DXi5ximVd5QoZ+YO5XQc3Y5hvBzxGOtLlWcIQJPlOkI+6lV5VhY6gF99pK7A5hdGhphsf8XNO0uobzFGyNBaLDL//DQNINXyltJuqw= 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:(376002)(136003)(366004)(396003)(39840400004)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(26005)(6506007)(36756003)(30864003)(66556008)(66476007)(66946007)(41533002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 97UCiMozJxe3oZ7/bxeHBPtmW9gFIhWGyfNC/8SQUDXTCFkDoqer+d66NTgYFF5no2MU7i0rfgndj8Wektchh340lYDPf872lxFXGldQtt6CPPXQMwLgaV0ClfqqQSCLUkYRNTnAjUey7nVdoYKIU0zUk+m0fMGIIMbnKI96gSqn6PlV83FY0mpvlvPRZm2Xt6CusgThxD+g0b0OiVgDzPGUZPaoCZXpqW335rW6FDoDNU6akCznKHnwdHXv75ZkuwmV6vZ+kwzruZhTBfno3mxMACVv7n7GKft9YloJowZAP+eD91x3Ub7+zUQvvgmGIQS1Drq8xUWK5rNoWL9SZNKE0oOcsngeuSVgGs0rbnDQll8Yz9tFhGoJkSOzW4eO5EkjUmapdGDusek/oLl3AfPNu7uuhwHesC22cFCTx3BAvI6XErk9qK6hLXBTiaMoTjs2FXDC4cEwOWTFwi19rDIYvtjVW4YyXq/vmOtr4LbMUVxre1GrICVDxrxu3OYCUVGxKdXYzHvWE9UgUlWZF9a8y9kjavsP9/jSfpjpSElepB6IUZVgmbMjM6H5CM9wzKXc1TZ3TLdZXJ8aGrNodO43LoplG0WEDeF3MMMzLcAtcoi+O9Kih1z7ihDiEGHKdPljbc9TkZ6DBWltgeMpEG+gUgdB8X9LQ4Q1m539MTXwip/OlDZsaXk1b/UirRQJjcp4cwIHaswiIJyp+ts/g7zXAZW5EeUzrhkUXNYdGLSbQFjfmii4VTBZNleaUFckzthWug47pLpi73/OyJtEUMw8b7HfX0L2qyHt2KFbbCuEPSDUcfLtmR7Y8DeG/6b/+PFwXgMk3T/FvjsuMzuOgJ7s6CsFPXz2AjOgG76BA3IHfy80NX+X1B278LNNpnryHaup+ZtCs0XVH98AW+/Na2Wg8bryaQ5xdDoJwbSZPaVotUNmcg7ax4RJLrOE00xfkDMgjPRLIcezpcMA5mZpagP1lVITEiQpAezg+56PlVtVQTuH0EYiN80kcd44NLrEsTB50pPW3d05k43BxQpzgNdSSjtVCxY0QC1sohNqK4kNb4RYCCdagYRLXCATibO+V2CX0p+j7kVGhMz0onLBXnncrSGHjD5SjJTyiypdTrSwAygXbs06Hqh6AtUZJd38f6keXhrGP0AvGfHQQnPpXcpv0eTmoyjQGdcFQgOGKzJya7nUiiDQSe/tUIQQDzZ/Pah8JM0UcxbbkPZP/C6cGkYyoLb4AyPB35ZN2bA94ZG8A76alSHlifhkvFU9c58w6AbLCdmJscQgy99CKgFtrxqjLrVQ+NUW6kg+4SVKPX3VzFYt8itZqH19jD5Gw6quUOD9itkMEeeQ3ur/twXm4K1bK0tiP+HnJG6L63DVwyQ5nzEZkZs0EWMbBpCJ1HHbFjlPJc8Zmw7YptCsuN1pOq44wbNfo/wHbTgX3Ga9xv94M27l+wyMjs2Vyu8yvhYokrcZO+7GXTNhT20BIfmQzQs4mfZ2/3Jbfd+upCJoR9Pr/kjqb0pW3ohIBjV+R7K6O+gBYoRcdKyqba1AMoB8tNO+N4ratt5k6WFJR8MJBI1sSNSAVCkEIQua7Z0DYDpkkYDJdJIWsjDiq9s9gX43ODHcdL9EqSx8ufboRpzBbEsH7w4jrh5wueyDNwrmilk3tUTCm8o41uBWYNwIVjq0huz8Yydu++I28XV/JSdhJSY= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea90379c-4735-4bf9-c686-08d9a8c9ab2d X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:56.5891 (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: QAQJSB8+ltJAFUItlgtCJtaaVLX8hr+a+t83zbLQyQoTqg4EU+NuKmbC3FVTY1oY/F45kcsJN/hFXbF8Oij/gkMUgjzVM1/s253rYuRZaas= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Remove references to lynx_pcs structures so drivers like the Felix DSA can reference alternate PCS drivers. Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/felix.c | 3 +-- drivers/net/dsa/ocelot/felix.h | 2 +- drivers/net/dsa/ocelot/felix_vsc9959.c | 18 +++++++------- drivers/net/dsa/ocelot/seville_vsc9953.c | 22 +++++++++-------- .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 12 ++++++---- .../net/ethernet/freescale/dpaa2/dpaa2-mac.h | 3 +-- .../net/ethernet/freescale/enetc/enetc_pf.c | 15 +++++++----- .../net/ethernet/freescale/enetc/enetc_pf.h | 4 ++-- drivers/net/pcs/pcs-lynx.c | 24 +++++++++++++++---- include/linux/pcs-lynx.h | 9 +++---- 10 files changed, 65 insertions(+), 47 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index f53db233148d..6d27c29a9c7b 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include "felix.h" @@ -821,7 +820,7 @@ static void felix_phylink_mac_config(struct dsa_switch *ds, int port, struct dsa_port *dp = dsa_to_port(ds, port); if (felix->pcs && felix->pcs[port]) - phylink_set_pcs(dp->pl, &felix->pcs[port]->pcs); + phylink_set_pcs(dp->pl, felix->pcs[port]); } unsigned long felix_quirks_have_rate_adaptation(struct ocelot *ocelot, diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index b5fa5b7325b1..f3f606fbd88d 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -59,7 +59,7 @@ struct felix { const struct felix_info *info; struct ocelot ocelot; struct mii_bus *imdio; - struct lynx_pcs **pcs; + struct phylink_pcs **pcs; resource_size_t switch_base; resource_size_t imdio_base; enum dsa_tag_protocol tag_proto; diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 5056f39dc47e..636bfb096c66 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1044,7 +1044,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) int rc; felix->pcs = devm_kcalloc(dev, felix->info->num_ports, - sizeof(struct lynx_pcs *), + sizeof(struct phylink_pcs *), GFP_KERNEL); if (!felix->pcs) { dev_err(dev, "failed to allocate array for PCS PHYs\n"); @@ -1093,8 +1093,8 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) for (port = 0; port < felix->info->num_ports; port++) { struct ocelot_port *ocelot_port = ocelot->ports[port]; + struct phylink_pcs *phylink_pcs; struct mdio_device *pcs; - struct lynx_pcs *lynx; if (dsa_is_unused_port(felix->ds, port)) continue; @@ -1106,13 +1106,13 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) if (IS_ERR(pcs)) continue; - lynx = lynx_pcs_create(pcs); - if (!lynx) { + phylink_pcs = lynx_pcs_create(pcs); + if (!phylink_pcs) { mdio_device_free(pcs); continue; } - felix->pcs[port] = lynx; + felix->pcs[port] = phylink_pcs; dev_info(dev, "Found PCS at internal MDIO address %d\n", port); } @@ -1126,13 +1126,13 @@ static void vsc9959_mdio_bus_free(struct ocelot *ocelot) int port; for (port = 0; port < ocelot->num_phys_ports; port++) { - struct lynx_pcs *pcs = felix->pcs[port]; + struct phylink_pcs *phylink_pcs = felix->pcs[port]; - if (!pcs) + if (!phylink_pcs) continue; - mdio_device_free(pcs->mdio); - lynx_pcs_destroy(pcs); + mdio_device_free(phylink_pcs->mdio); + lynx_pcs_destroy(phylink_pcs); } mdiobus_unregister(felix->imdio); } diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 362ba66401d8..49fc8220d636 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1005,7 +1005,7 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot) int rc; felix->pcs = devm_kcalloc(dev, felix->info->num_ports, - sizeof(struct phy_device *), + sizeof(struct phylink_pcs *), GFP_KERNEL); if (!felix->pcs) { dev_err(dev, "failed to allocate array for PCS PHYs\n"); @@ -1026,9 +1026,9 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot) for (port = 0; port < felix->info->num_ports; port++) { struct ocelot_port *ocelot_port = ocelot->ports[port]; - int addr = port + 4; + struct phylink_pcs *phylink_pcs; struct mdio_device *pcs; - struct lynx_pcs *lynx; + int addr = port + 4; if (dsa_is_unused_port(felix->ds, port)) continue; @@ -1040,13 +1040,13 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot) if (IS_ERR(pcs)) continue; - lynx = lynx_pcs_create(pcs); - if (!lynx) { + phylink_pcs = lynx_pcs_create(pcs); + if (!phylink_pcs) { mdio_device_free(pcs); continue; } - felix->pcs[port] = lynx; + felix->pcs[port] = phylink_pcs; dev_info(dev, "Found PCS at internal MDIO address %d\n", addr); } @@ -1060,13 +1060,15 @@ static void vsc9953_mdio_bus_free(struct ocelot *ocelot) int port; for (port = 0; port < ocelot->num_phys_ports; port++) { - struct lynx_pcs *pcs = felix->pcs[port]; + struct phylink_pcs *phylink_pcs = felix->pcs[port]; + struct mdio_device *mdio_device; - if (!pcs) + if (!phylink_pcs) continue; - mdio_device_free(pcs->mdio); - lynx_pcs_destroy(pcs); + mdio_device = lynx_pcs_get_mdio(phylink_pcs); + mdio_device_free(mdio_device); + lynx_pcs_destroy(phylink_pcs); } felix_mdio_bus_free(ocelot); } diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c index ef8f0a055024..e5fa181fbe2e 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c @@ -286,11 +286,13 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac, static void dpaa2_pcs_destroy(struct dpaa2_mac *mac) { - struct lynx_pcs *pcs = mac->pcs; + struct phylink_pcs *phylink_pcs = mac->pcs; - if (pcs) { - struct device *dev = &pcs->mdio->dev; - lynx_pcs_destroy(pcs); + if (phylink_pcs) { + struct mdio_device *mdio = lynx_get_mdio_device(phylink_pcs); + struct device *dev = &mdio->dev; + + lynx_pcs_destroy(phylink_pcs); put_device(dev); mac->pcs = NULL; } @@ -349,7 +351,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) mac->phylink = phylink; if (mac->pcs) - phylink_set_pcs(mac->phylink, &mac->pcs->pcs); + phylink_set_pcs(mac->phylink, mac->pcs); err = phylink_fwnode_phy_connect(mac->phylink, dpmac_node, 0); if (err) { diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h index 7842cbb2207a..1331a8477fe4 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h @@ -7,7 +7,6 @@ #include #include #include -#include #include "dpmac.h" #include "dpmac-cmd.h" @@ -23,7 +22,7 @@ struct dpaa2_mac { struct phylink *phylink; phy_interface_t if_mode; enum dpmac_link_type if_link_type; - struct lynx_pcs *pcs; + struct phylink_pcs *pcs; struct fwnode_handle *fw_node; }; diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index 0e87c7043b77..125a539b0654 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -828,7 +828,7 @@ static int enetc_imdio_create(struct enetc_pf *pf) { struct device *dev = &pf->si->pdev->dev; struct enetc_mdio_priv *mdio_priv; - struct lynx_pcs *pcs_lynx; + struct phylink_pcs *phylink_pcs; struct mdio_device *pcs; struct mii_bus *bus; int err; @@ -860,8 +860,8 @@ static int enetc_imdio_create(struct enetc_pf *pf) goto unregister_mdiobus; } - pcs_lynx = lynx_pcs_create(pcs); - if (!pcs_lynx) { + phylink_pcs = lynx_pcs_create(pcs); + if (!phylink_pcs) { mdio_device_free(pcs); err = -ENOMEM; dev_err(dev, "cannot create lynx pcs (%d)\n", err); @@ -869,7 +869,7 @@ static int enetc_imdio_create(struct enetc_pf *pf) } pf->imdio = bus; - pf->pcs = pcs_lynx; + pf->pcs = phylink_pcs; return 0; @@ -882,8 +882,11 @@ static int enetc_imdio_create(struct enetc_pf *pf) static void enetc_imdio_remove(struct enetc_pf *pf) { + struct mdio_device *mdio_device; + if (pf->pcs) { - mdio_device_free(pf->pcs->mdio); + mdio_device = lynx_get_mdio_device(pf->pcs); + mdio_device_free(mdio_device); lynx_pcs_destroy(pf->pcs); } if (pf->imdio) { @@ -980,7 +983,7 @@ static void enetc_pl_mac_config(struct phylink_config *config, priv = netdev_priv(pf->si->ndev); if (pf->pcs) - phylink_set_pcs(priv->phylink, &pf->pcs->pcs); + phylink_set_pcs(priv->phylink, &pf->pcs); } static void enetc_force_rgmii_mac(struct enetc_hw *hw, int speed, int duplex) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.h b/drivers/net/ethernet/freescale/enetc/enetc_pf.h index 263946c51e37..c26bd66e4597 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.h @@ -2,7 +2,7 @@ /* Copyright 2017-2019 NXP */ #include "enetc.h" -#include +#include #define ENETC_PF_NUM_RINGS 8 @@ -46,7 +46,7 @@ struct enetc_pf { struct mii_bus *mdio; /* saved for cleanup */ struct mii_bus *imdio; - struct lynx_pcs *pcs; + struct phylink_pcs *pcs; phy_interface_t if_mode; struct phylink_config phylink_config; diff --git a/drivers/net/pcs/pcs-lynx.c b/drivers/net/pcs/pcs-lynx.c index af36cd647bf5..7ff7f86ad430 100644 --- a/drivers/net/pcs/pcs-lynx.c +++ b/drivers/net/pcs/pcs-lynx.c @@ -22,6 +22,11 @@ #define IF_MODE_SPEED_MSK GENMASK(3, 2) #define IF_MODE_HALF_DUPLEX BIT(4) +struct lynx_pcs { + struct phylink_pcs pcs; + struct mdio_device *mdio; +}; + enum sgmii_speed { SGMII_SPEED_10 = 0, SGMII_SPEED_100 = 1, @@ -30,6 +35,15 @@ enum sgmii_speed { }; #define phylink_pcs_to_lynx(pl_pcs) container_of((pl_pcs), struct lynx_pcs, pcs) +#define lynx_to_phylink_pcs(lynx) (&(lynx)->pcs) + +struct mdio_device *lynx_get_mdio_device(struct phylink_pcs *pcs) +{ + struct lynx_pcs *lynx = phylink_pcs_to_lynx(pcs); + + return lynx->mdio; +} +EXPORT_SYMBOL(lynx_get_mdio_device); static void lynx_pcs_get_state_usxgmii(struct mdio_device *pcs, struct phylink_link_state *state) @@ -329,7 +343,7 @@ static const struct phylink_pcs_ops lynx_pcs_phylink_ops = { .pcs_link_up = lynx_pcs_link_up, }; -struct lynx_pcs *lynx_pcs_create(struct mdio_device *mdio) +struct phylink_pcs *lynx_pcs_create(struct mdio_device *mdio) { struct lynx_pcs *lynx_pcs; @@ -341,13 +355,15 @@ struct lynx_pcs *lynx_pcs_create(struct mdio_device *mdio) lynx_pcs->pcs.ops = &lynx_pcs_phylink_ops; lynx_pcs->pcs.poll = true; - return lynx_pcs; + return lynx_to_phylink_pcs(lynx_pcs); } EXPORT_SYMBOL(lynx_pcs_create); -void lynx_pcs_destroy(struct lynx_pcs *pcs) +void lynx_pcs_destroy(struct phylink_pcs *pcs) { - kfree(pcs); + struct lynx_pcs *lynx = phylink_pcs_to_lynx(pcs); + + kfree(lynx); } EXPORT_SYMBOL(lynx_pcs_destroy); diff --git a/include/linux/pcs-lynx.h b/include/linux/pcs-lynx.h index a6440d6ebe95..5712cc2ce775 100644 --- a/include/linux/pcs-lynx.h +++ b/include/linux/pcs-lynx.h @@ -9,13 +9,10 @@ #include #include -struct lynx_pcs { - struct phylink_pcs pcs; - struct mdio_device *mdio; -}; +struct mdio_device *lynx_get_mdio_device(struct phylink_pcs *pcs); -struct lynx_pcs *lynx_pcs_create(struct mdio_device *mdio); +struct phylink_pcs *lynx_pcs_create(struct mdio_device *mdio); -void lynx_pcs_destroy(struct lynx_pcs *pcs); +void lynx_pcs_destroy(struct phylink_pcs *pcs); #endif /* __LINUX_PCS_LYNX_H */ From patchwork Tue Nov 16 06:23:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621541 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B1BAC433F5 for ; Tue, 16 Nov 2021 06:30:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 528C9619E3 for ; Tue, 16 Nov 2021 06:30:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233272AbhKPGcv (ORCPT ); Tue, 16 Nov 2021 01:32:51 -0500 Received: from mail-dm6nam10on2120.outbound.protection.outlook.com ([40.107.93.120]:37728 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232330AbhKPGaY (ORCPT ); Tue, 16 Nov 2021 01:30:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=axSjIDJ3DaGjg8oMOBsZaJIh0jLdswTcC/yk4nhOQ5FZV5KgIkk61G+B6bx9rUq3vuZGuwRI0SaA5vsy3chgXtymHjEIMV7aDJTyP8pzNgouJbMlWWOy9F8wmzFC07xFKDmhWl58FcbANPMar/yoYe6d8esI81REACPXt34z3cdoV9xXTgZYoTgum0eoyksJawNicOjxSkMWiq2HcgjPhCXKE1+LGqPGOxvB6JHgYhCKuQL1rKQ7rbKEfJYcll3NpVMJXLMN+g6mCPSzqki8XpCMZiJqHQdqUn6BFSqqWf+iicPDXkX9N/9cl5ybDHD67DBoVCJCA9KWNugKR170OQ== 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=MASfe7TvjUIYSFDLzZzkW6bpOz75kuBqfzOsutzkVLs=; b=TopXzmeHAuMfsAveEoS/M0Dfhz8ScJKYcp6HaCT+Sh2PIsh0DQvZZujbyaPCmhpkOPZFy/Pd/HXCI16Pc6CkVb6yE//JC5sfjA64MhOVaIM/H8R9t9qZFG/cD4UnNJ5IxtiXwqyTRdG37rtUgSwvAIiSOSiDfRhzmCtvixSyF3U0CdHXwwL2fyoqTqj/rwuwgMRsje9jJ83hPcyVc7Lylm+DBHRZwLqeJW6iFQWyOj7KVitgzToH+eAXV7sGOsFv/Dyq1v5CUbsL/JXf6UBWo9ooneoVFsUecwFO2MGk54tgRjlSbNAHiXjx1UkeFbIn6OSt/U9RriNIMw7SmKSnKQ== 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=MASfe7TvjUIYSFDLzZzkW6bpOz75kuBqfzOsutzkVLs=; b=nu9jiJnDKQbb4KoIKPelxx/gJ1At9/MHemCKdTIOU1MieY4/oyxMCO+A5uvCkNUBVxqJbl04dBOOPZCYfuC6JdqVosGWS9xnE3CoYju91WTVu6ZXION7FjgIxgvwpKdSrEh5JXEFdpWreLWWgEa3XnAAuAOoNcxBo5oCtH1gqXw= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:57 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:57 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 19/23] net: dsa: felix: name change for clarity from pcs to mdio_device Date: Mon, 15 Nov 2021 22:23:24 -0800 Message-Id: <20211116062328.1949151-20-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9f03fa9a-b466-4f14-2e59-08d9a8c9abae X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1091; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gFqtyBgF45fDDtE66jlrqbCbTosKQg0M6aJcHIBPVj2o3tfu4A6e8mzDUGUcaRpSJx4laeGNFz4tJ9d95BAwZ7/MXPXljHi9RVHc4WQZ4qXylO4XMHhUQzTsfBx7V5mF9nY3VM7RMrCcEgLUF8BsggV+o/C7YvbyAUCbdbZz8firkhIFwIb/A7rOzo/XSUDdZutahH9mHYFsyvkt3gqKKSPp9eyv2p9CjoyZjH54lHil98PTJbnauuJPkeBQ8DV72Hk23oSI5YYhSgxyPGz0eXLX4C9zuLoAl3uQ0qsyg/mRbNm44LDk1RXJbCC+QMwv3zMQ7UC9sDgAVugH9vaNFGs4Nv4KvfI1OPmXKYR6odQrdxK88IIDv/jELzcAU7QOUifBJkqtMEv5eEzTjVvQjMGXXGIWnjYEUBzRt9EVYQXFlpWIuJ10Ho4GYYDDnsC/UlmXZ8JaAfipOisMQL2I5cl400hbkPonLjNZfvP4bFJF/pQnMS10NvDvGT3pro8kmGq75nICAvywjPD6XxuSUNnlkl1N8Fo+3Id+cES9ItjeR9aLl3CrgZx7janDIlhyQbTO7d16d7cVthY5ltczB1wc5PYpIBHadGBo+ygkkhr/IKJTbWmPCYrhMAf6TMhR1rrrq4TECgnY4aSZlUoMXZdGgrjiogaDFdtw8a2Aea5JsdUDLM0vbx37jX5FpTUtZPt/MJNFnSDj3IVP83MhRA== 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:(376002)(136003)(366004)(396003)(39840400004)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(26005)(6506007)(36756003)(66556008)(66476007)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ppF2CY2SNMWjGx0kmi1mhpStuCbvIYDLgOgxV0XjHlBjf5wD4E7bFHMffLdY1ulo7rkbm5EcI71FqCVAGJRLWDiY4m4GfrJ5vWjR4woWY7vJg75nUu0DjX34GC2FckxPhld74aj4vfviVOc01GHLev8ploUEPmDOcUwxapZaVmHkCUZKozES0ysaJX8JdYvGdvpfsVMAvr8fYQZ09ACuHQf7Ns+qE2PGv5fClnteZxCoBD/0NxmCiCSy4gN3uPsjdYrzhmHabVTOKV3tYeT+S9YObVMIr+BJyrbypqV+//PDKP0+m8gTNdpL8IP+k8nwJT5jFC1SZWupr2M1Ynq6hPmiP415ZHr0UVmIQXFZFVFPBMnSIrvN0hfKJKHfZOV9rnt6pVx/66Hf6TWIoVXKFUADTRF80TmkK6zqiqrZJ3xwhfS2kYUF45yHfD+9sZrwICxDUNE/rj4fuM6BGG94fC3oRN2KCj6We0PLvHkACA7jn2CC/Si5Ubs2eSxfVDIEQE+S3NtSLthutxp9EFEHhrVZ7KKlRk8Bmj7di/9H3/2egicdEHdSYfVWkCv+hKoFWiDFV47S0u5jpBwzDY0Oy0AV74iA2Gyx2+QDvjMk4IR7tbVq7PuPOKfEJUWTPj2qwkJY0+4xeS1pKeVconOMP+emoYxDOnKPXA65nsWb283RQ1UXKEZ82MtlxfUyBRUJnz5IWEN8hwgdQPuNWGZMY5PgcUOjKfl+2LWrp5EAvydAg2jvwgpO8Ra47gg/lsZVm0zqoxHeBLTeXnQ52HBhPcELHyqLLFsGDFq0TAsHy/XYGb1VJ+ftG/JY+tHd3guyldJIN7RjSK8x3ODScRIXhBTmxCnY5MhEH7meaXwc+fcG0eALsWQxLVymtOYeB+52IaGaAlCXFHv9L79/7nd8r1z9oWoVfNkv//IitwVVB+LNDkInBmb45iNpYv+6o1EdJsHRJLeqj6M4lEVF3SZc3BwUCyndEzuE6AfosErOg39ot9jaG78Hkji19xUtS2Jej6S6YbCtfVJU8cuAM/C/6n17f5EJOhRAzxU0MDl2Rkpskr44kcq6A881O0uHQoQqBNFyUqH4Vo5Y7Emj8+ptBMqH3y11PD0+r6ObHDP4L1UYoonN6SLbLRneqpcvLdAM8hsWvV4ZP13F/2g3uxtnRD2HMfdfO9VwBJ4sBP01gSpECLA2wQECrAg9cLK2LJyfbeMGAFWR/ok+34lzG+t/qPm4jnhaumnctVHoaDGkSNZg5VqoRjJ/vk/F6+uNZw+kLGvAE1BJbSR/5JfFwCmejHnflTdOrs5b0qwgtALJ6oqvR4kuJarr7jczrEi3iPlIgfQPdcm7lS1vS6uGWrjnnuqs3+hb/RI3zU0KKnqQNnQWPOWjcJ5Lhbe6iP6q2WBGiFDC6in5gnfdurRmv5stahpsfZLMnTy+qu723CVnsWDeEMM8v/xNmp6txHjTkonnfPxlccGXVLXrOFhD6Weh3FrsxuC8dTVqKlJrvUVz+cv6nW3hlGCXL2kNFVlvgrrOQ+YAt7vQsypiS9Xns2LY0EmJ3DMBrrwtvgvqEeiP5FWwd5NWxul0DsV8/Xlz8BTEUy98H7R6PfFfKw+V8ih0eF6nHlzXEEOK1U0gLGnvzBgMdtJhNkG9iaC84R7lbltuU2KnMAFD2Z9kziiD25MHeZnFzBEdqsHv08sXT5FlezA= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f03fa9a-b466-4f14-2e59-08d9a8c9abae X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:57.3716 (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: s2LUvERDuLwKGYj9OrrNoAOnNa8OmiOIzJ9Z8BmLIs/KsjbG+Gze+A6semPv9vbaIZlSOhGt8mND0pJ2AJt7a+7E32temg2MCRGPDV8/XMA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Simple rename of a variable to make things more logical. Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/felix_vsc9959.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 636bfb096c66..b1032b7abaea 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1094,7 +1094,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) for (port = 0; port < felix->info->num_ports; port++) { struct ocelot_port *ocelot_port = ocelot->ports[port]; struct phylink_pcs *phylink_pcs; - struct mdio_device *pcs; + struct mdio_device *mdio_device; if (dsa_is_unused_port(felix->ds, port)) continue; @@ -1102,13 +1102,13 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) if (ocelot_port->phy_mode == PHY_INTERFACE_MODE_INTERNAL) continue; - pcs = mdio_device_create(felix->imdio, port); - if (IS_ERR(pcs)) + mdio_device = mdio_device_create(felix->imdio, port); + if (IS_ERR(mdio_device)) continue; - phylink_pcs = lynx_pcs_create(pcs); + phylink_pcs = lynx_pcs_create(mdio_device); if (!phylink_pcs) { - mdio_device_free(pcs); + mdio_device_free(mdio_device); continue; } From patchwork Tue Nov 16 06:23:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621543 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33C0CC433F5 for ; Tue, 16 Nov 2021 06:31:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 08462614C8 for ; Tue, 16 Nov 2021 06:31:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231570AbhKPGeY (ORCPT ); Tue, 16 Nov 2021 01:34:24 -0500 Received: from mail-bn8nam12on2126.outbound.protection.outlook.com ([40.107.237.126]:16577 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231403AbhKPGay (ORCPT ); Tue, 16 Nov 2021 01:30:54 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I2JMltiGIfKvYn/Lax7jq8NkG082wYWWv2lpYPNY+0bRiJqBtkBrAQp6pfYtOmBYAfrH7AgDqTdeSoCUffmMVga0N+0Ws++o9dOKhElCtXngv2dnwZv79IlZ7Ynb6xaZ9OpqEBfs863rY65yPvQvwCyBrP0FJO+RfL5N9rHcUBDZpYxHuquVFYdaJSzpu6X+Kwwnk9KtD0S+/v7f+x5awZ4+F+STOjji1Ov0i8WzhrAxFt2gnMT0Onn6CZTVs+MIrrHdNW04+68MhlePsysviaNjpoNM0D4XEhYFhI9dQW7YlrL9OWuA223qGgGtUPEwCt6dTB6OeU3h9whMAYW1UA== 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=Hk/1te5bwIfVZGRAaBZDCvRJcfC9N2Fnv2yUaDDDN2o=; b=HbrE2YcYjxV40B1NLh1Y8WkCxVT3RiborNdFg/Uk9btcKITL/Uqt7BO4lYSvgtL1nOzZ3GLUGEj0rf7/g/w+6OdWcjK7R9CBRvDAOXUb4AFPQHAwSeyG3jBvs4u5SLXK3MCMZ3HCI8pvPCP4QcOr+q14Xpc9wyQmcC46XXsC6GNWFXCu0lcmVjWNmAx75Z1FON+eH23Q6qii+EQPUS7KHulJnaq46w4T3L36ikOvjTzN0h2SzHHCeh4hWn0wKuWRAZe+aG0OxIOV0JbaqbJ8fMNlR/HO5vvbhlcOetb/eNcLwqK7ZLt9g0qv+mTgdYPhliinrjgCS8yEBZHE/qtMeA== 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=Hk/1te5bwIfVZGRAaBZDCvRJcfC9N2Fnv2yUaDDDN2o=; b=iZqcoF4rgwxb37c10DgeGJeLizSujOnimbPOwNKL6QvSxf0qcfEuN8h5eSIuYl2wNPa3jp3Y7LR0slu/7GJtmIb6d4fmvui1ygCZtcU6aCr9h/Fhdbxw/bcaQL3HlKkVk4hCOSqsl42ck5eftuaRTTu83tuazzd86bNNjtCyjj4= 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 CO1PR10MB4722.namprd10.prod.outlook.com (2603:10b6:303:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:58 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:58 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 20/23] net: dsa: seville: name change for clarity from pcs to mdio_device Date: Mon, 15 Nov 2021 22:23:25 -0800 Message-Id: <20211116062328.1949151-21-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7aab933a-0d40-48bf-32f4-08d9a8c9ac26 X-MS-TrafficTypeDiagnostic: CO1PR10MB4722: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cZcSiyk8xt//c/Q25zDl9gQCtslJbPqYfkyogF8XQvZ82SUjO/kn/G2wZ3JgAhW1bkNQBNOgkKcRy0gTFDUpFHoHYpP+lVOSoU0FOk/JT+Z6045B6gN1HlSQIFtkJ/VhDPKtJ0LvIcq9W4hA2Eoa3kqn5KzerA7csvDBSCPKJ6VkXKYovnDSYzthVr13cUc7Y58PX36nFuopzOchogzseDUpBpte3/hsyo01MPYILAwSmiYTN/dLIK3ZUWS1eX46o4lef861fSlEmO5QA2JydQ5tniHHn9MMGSmAa+Ns4XTZUWTaDKyrJzCrVZbzD+YM/ZUU3yCI5mieEg3sz19wRPVUf4G5N4sqWyjeCF32pzDSfpwpQqlH4SMdKz7txBFuNBO6L2MM+BoxwYk+3fNSupc8u6lvahn7HgHkwx8/EihiG8M8hqL4EwbXLl7Mbg1ceMT/UyRL+Xy4JnIvG5c3RYPtEpxZfqGvEBmjUWv3fUUeL/PBRRT7SZNwRAb5AL9ueCcg0q5J9PLsv2K52qZ/xQuYwD91701m2dNquWcKoWitLJC8mym0ByqJ6mcFa8DbZtQM/7t8IqR7iFwRY9injkZRAItXKcQ/Hj9ITmubQCqO3EXsZWRbKJwkQ9bbidQoQUho9cXdGHUrPWSipGNYf0v4HWGnC8sIf8rIEh/pFws4GmFT8Evqv2P17rq4xKxcL8GybpkJ/DsxcUTlvxKfVw== 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:(376002)(136003)(366004)(396003)(39840400004)(346002)(83380400001)(6666004)(54906003)(5660300002)(2906002)(7416002)(6486002)(44832011)(956004)(86362001)(2616005)(4326008)(316002)(508600001)(8676002)(186003)(6512007)(38100700002)(38350700002)(1076003)(8936002)(52116002)(26005)(6506007)(36756003)(66556008)(66476007)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 81e9cmtjHtAuNGAXpLBa6XC0HiB0j8udeODJ23X2dyWcn6sGBP4/drh0UphWWNWOMLz8ct8wYz8N0cUXdNGwF5dDKfVzy9ta08+8dHjx368iSJ9VmXzr/v4zS4DhuLXgGMZfjEh2W45FCgnSWVX2BREAcAZ5kosE8uZi6rdqchEt2GdYbhMGFVJZYnFbJ4xv/FBYDXPDDAnhgp1LR0wqSh+cNEOIunhcOjOOYLjzPN1psk5lRcfsGd519X7qR5WnwqPJfMhHOnofwZ7mt5wNo34Y8fWYJOYjpmDO0q88WqLNVmtGh4byP8TQ1X1dFVc2dV+65CFWKwQtxS4MCryAmM5o+mHcUDdVaCNPwIPWx5l7zve3/1jfi3iqCr8NomzkB4USxoopcnZRRBi5LX+BdGUc+fa9EIt05LNUl4SnyC9QzEviO0qFZbFZQot+NPJC1DcowzbOY9BhxFPchQy7JFduygLZ7JQzOkUeVV3fCAdYgtN/ed6WxlKrHG9Zk3Rh6Sfe09umQZXFxBvFnDo4oyHpS3M6WoNe5wTrYYvD7hAXyPB2g5Zwg6j2htRt+aJVxju3W1tnOLyp76lTq2SVzCAtj02Ts4xo1w3KEpW8DsNha6y5JnoR++NwYlHoa2iBTPbRDB0gd/xUcP4Ahw9ht1mV0/iPOfaZ8M1ueN8B0DT7HW6zF1daJP+M3WFaMLJsTbj44FwGP/UqYNwpvxthM1vzMNTKVfSye4YNVvy9aQIhVTSLeLcRpZsbFrg+GYQ7clBr22Ql0gTjxWR14NTiF/tWrcZVWSzZnbhMj61O728B9BvKYxi6aoABVf4PatSn6ifzZgqvpdZIMysbnObuXjO5Jpyklyna38mNpJEGO4q8y/nKZXEQiX7YAQj3oIZtuu0pmuU/k+PoPP2wbVqdRzGCbiUYwu4jotA0IRzGTtukCcVeUduj1noxH6SXyY7O/hzJdyCENeZrBpMg7KUqoGpq1l4i+VVHmpvdtn/FMe/GeMtGcWNc6Mt7xU4aUB2+sbnfP7Ok07rR9qIYWEKHZDI0FUDHi6iMf+jfBNbpTG5lprvzLoA5Z2kJYphBJyM/RoDEmngafLvTmc439EujkUgTXbV+k2rz7qjXAvwthYB33a7dG/cHwzkeRIVA7DKbwdRWHGUlYeDyK1ZFlJwEUrlViP9BoazwwgDDYQEgkY1Kgg36RygD2zgF7vRBAAK+ULAk/XHetJacMjlosmE/yUCPdf9l5F5A9B7M8OPYCft0+APuEmrUOR/pKX/3FJtT6uZ2WTsxV0PYVNsdoXPY+LHg7ESw2Dwbq5J4bf0fp7dHKdPHhRGpXQ2R0bLzYf59FgiMdgeRHkeJrZnGf7mqVMchG6GSTP8UBZk4Hh1M/qnzILzuIAqW2xAm2qy6ogS+LV6rAgrA3gSKmRwjd2KP6bv+lVnAjXTiJ3HIwGMsxnYTuEH8KmIe8ySe8uArnvYPgcRCgit13YEzg+SIsW4wegSh/rVeQukftFIV0njTtz9ua6cYff6oLqULrePMSYFCBOHWyBck+zYUo6aW6O1Uuh9by9a/sTqrlJbTreNo6JdlTut7G6Xh1rERHIlVzM4Tpsm3xelnApRk9s4N8xOEIfcPCa7/vbp+/utXZuyizyvZXOU4caWCnyVCAvXufJMtXBybbFLlNerfrs9WpsQbidVS45U4+k6rC9XlNDZwG+U= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7aab933a-0d40-48bf-32f4-08d9a8c9ac26 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:58.1342 (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: fk78c0TOqDFzSKNc58uea4JUxxDx82ESl4Mt+PHJTPPUFAPlXRztXK08P90LekX+SENh5yFYSj1cCAgvp0PyJKwTUS7vmt9iU4Si8eN5Pq0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4722 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC A simple variable update from "pcs" to "mdio_device" for the mdio device will make things a little cleaner. Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/seville_vsc9953.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 49fc8220d636..268c09042824 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1027,7 +1027,7 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot) for (port = 0; port < felix->info->num_ports; port++) { struct ocelot_port *ocelot_port = ocelot->ports[port]; struct phylink_pcs *phylink_pcs; - struct mdio_device *pcs; + struct mdio_device *mdio_device; int addr = port + 4; if (dsa_is_unused_port(felix->ds, port)) @@ -1036,13 +1036,13 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot) if (ocelot_port->phy_mode == PHY_INTERFACE_MODE_INTERNAL) continue; - pcs = mdio_device_create(felix->imdio, addr); + mdio_device = mdio_device_create(felix->imdio, addr); if (IS_ERR(pcs)) continue; - phylink_pcs = lynx_pcs_create(pcs); + phylink_pcs = lynx_pcs_create(mdio_device); if (!phylink_pcs) { - mdio_device_free(pcs); + mdio_device_free(mdio_device); continue; } From patchwork Tue Nov 16 06:23:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621449 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A36EAC433EF for ; Tue, 16 Nov 2021 06:25:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A9956113D for ; Tue, 16 Nov 2021 06:25:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231510AbhKPG2l (ORCPT ); Tue, 16 Nov 2021 01:28:41 -0500 Received: from mail-bn8nam12on2092.outbound.protection.outlook.com ([40.107.237.92]:48451 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230347AbhKPG1A (ORCPT ); Tue, 16 Nov 2021 01:27:00 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ada02No2Bl14pUcezpmePNI7FVrCriF82l+iFi7ahMFq0+qVccH2/fo187drZutaZ3/L/xWiowZSCEzTKL6qb65/HlLfRZ2NhnB1OuZCrsakHxRzT52DFJ6WOCCVR0eis1RmcxjZ0ho1e2eBSy1wc09yTlo7M+oGWRrr5DnxSItJhbIbyuY8etLgEcMR6VH0S18AoNRqGKgfq10I5YFbF0CXjSofwWLPeOlN32CZOscnKQfB+algAEh+wKX7ejgj9yYEfnX/PCjjWBU3t6LVSfFg9hgwgLU2sxvcAYC8nI3YVQKu+KZ7yKhoCsOpljQpo2HyIY3EtKB7l00P864JIw== 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=xsQvCcoN1ya9H9lyAdQq4tD5YpOPIRUXipAnY7zRVYA=; b=B7QO0NeWMYy7+x+M24omIE0wr5jUZ/yMv0HcDqAc/Z7hA6JXp40R/ieT8p25NxYueG2s2MNjZ99obQJlow60aXBJE2zIIJoqxzVFD27tslnkn8uNpIMkqPIrrKF5840wxocs6+rZu3X/A1dPg5D7ySO1S6O75y87AEjIbtvmb7mXjEqaQRKqMhGfTucFsOYPhafC0pr+Rr5+/34b3yAHhDdKEmUC8NiNIA+QmFh/P7g/7vF8WeFiVbqH3z93rv85oeEtpOIGZMs3frzuqhsxkPWhlTFd6vn8QNMcpGhrXpvFTRaCha0uAcdId/6kaEVryQFWRyrHxB/uCob84WQ3GQ== 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=xsQvCcoN1ya9H9lyAdQq4tD5YpOPIRUXipAnY7zRVYA=; b=GH4dSUwE3MHWsZE9vzoo3J6N0zL6743pLAhfInt182KEjc8Fc3upyr80LvQh8acGqclvEUcZ0JQcv7Cv2tdfyASL1AKCpuYAJFhnYfRp+V9fj+BFEXfE9ReGdDNSSZ/MzNZUqQoHz89Me0fCuNycgcYyoTNtavNEmzDU2CgunWw= 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 MWHPR10MB1501.namprd10.prod.outlook.com (2603:10b6:300:24::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:59 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:59 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 21/23] net: ethernet: enetc: name change for clarity from pcs to mdio_device Date: Mon, 15 Nov 2021 22:23:26 -0800 Message-Id: <20211116062328.1949151-22-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e916da9a-195c-41fb-264e-08d9a8c9ac9d X-MS-TrafficTypeDiagnostic: MWHPR10MB1501: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QWLnwdr2GCIiayFpDcW6MqHJRfFg/Non6mNJqklBwUX+plxfjoepDyZ3NnMqvcnORy+sJHz7Wm6EYV8t0f2u17Vt8ArpBCWCr3+ey2NwPRTM7Ftel9JZ/0KBumkeaW4GauSMHJ9n9mQK9fy24MrmrYbBQOMapRD3hRA0JIzhfjB7jc1B5BSQQ59jWVa2rA8huPSdPHCPczR4/nBzyZ626uRfYW+ebl6NmLHJaxUweUgWkRPMEDpwxGMuN0/F/o+YFdPpvtE/9figMrUgpHpfUl1GoHHyzEbV+uhwFL45174LgTbuzow1rNXxzkDTCFyj0Np6NVitkS+G6Wv5u+BJUwiv/IUDb8K/kMg8Q3zq3WwGdRVgYstoLr82yFmpBkV9e/61dKXQ1QkbEaePgNXmgFxRD8VlOtNg6lw/eYkWPRfZ8rMuv3mEwloNyQZoplnA7sjlkU4XTyjObw8dGHUSaeJEfgzg6KVkUIsM1W8GPFtTsmLu48LR3E/+6Tu3rC27BikwNbO1tLYWSfXiVSo/M/NtdhOeuX+wvslvDLTRZzdAor+94K4w4LfK86a33g1lHTvrDZfYDsHBXfWIgykUtPJmp+Z3SelwjCgtee+By66rIkEUVpV+1ZyJBXeAnp+vFSct/5s0nwwvYPeUIlgO9wUbOZfcJvRy1jj96nd20vI9JNd9/bwygLDeRtkoQ1qG93aqqn8FfVQnLPIoGNXJhA== 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:(376002)(136003)(396003)(366004)(39840400004)(346002)(4326008)(2616005)(956004)(186003)(44832011)(7416002)(6506007)(1076003)(26005)(86362001)(6486002)(38350700002)(66946007)(54906003)(36756003)(38100700002)(316002)(6512007)(5660300002)(2906002)(508600001)(66556008)(8676002)(66476007)(6666004)(8936002)(83380400001)(52116002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 68OxWCR6wt3ZjsRnutmBZheoW2+qvrobTZraqTNII4M1tKP+F6dXU59MaABaJEQWSVEDYLSvLfzblj8/qg0x9nTsGomye/iXGYRqqFvvtztEwotMsCmFJKDc9UcG4myfnhUSVzCiIrhgHFk2URDy841C6g6pLjuCVBa+H9EWWtcs1HlgymoP2X0TtEENBX5oWXXMcROXhgEf+Uea/Yul4luriQhB26b0GAjZJRlgjgIGs0BcHLn/s6MqaXmv6k/p7csyLvqLFBnRJvpD4sIgxlYoJwrnXmAOk9nyl0ZCLKr6MuFDeaKQ+VgVCnfk7h8TGYJpUR6xGmZd2FvPhFP77E92EyJM5ORHSmlDqPEImG2jMOvXXY1EBayReUj+NpAkx6aqggcMKZOgnE/6+R+wxL9/x7/lf1bVtrjGQ9asAcCmx9vJGhxC2EfpHtYiyHSDc5jQE9B/0/Uw7RgQo7F1EPfoueukAOS+sAGum1KT2E33iM6zpprTypZjv8KjRcY3CnFxUPqfh5A0pTd7YzqsqiuUocxrrDwDrHEUMPM4RxZdeORlW3h5jwt6N4s1WNo+9w/cjoTkfq0VB+8JhfeqDmCt6/VJRYe6ParhA0+Zt2WcvNkJJzvUOICUZ9YBPnTwk8HPZhnDDnF44GsvJoxD8P3u9GU0xebJOVgSZf3Qd+VR7wsIBvKAC39EKdQ4wCPqCljd5DHAfnIER/ezANob6MrcwtaJYoGvuG/+yGf0i4fTKxb4/xp3obvPj0RDHxeQhi6zI5lV4QySazEZEVHfCzfnwQB+17M+ps8aiiqUEwcQFQmW6aPMceMAZMPM0tXAabJOTWBMEu2oni09xTjD+PY/2bMTKZ2OtgD7EWZ6eswiQ7T0NDwtGizX/Xt3RRKSP6tnWrWV7aRE2LWtvoUTAwTtTM383lnKsz98mvJDa9341LbZzBGmLcX05fx0xfMZjMQADtYxiRUDAqyeAClmvK0hzz6JDXGDn7oELp5Vil+b9wEr/SZ2vo4iOUxXMvI2P9ITxwCeTI1BGmF+zqa1spYC45S3+XU+Y9WmE2db36kiyicWUEM+w9o7wvNuT7fW6UPSplMVfE+6fDJ4l+6Wzcbqfd9Ok/N7EuC0GyBKjcVOyPGNSDyrBzL0ap5/NWIBjrslgh8pQakouEt7N5qfXAA57Rb4ZihN91qhjRfHO49o9JH5u0MJQFDXifKYIA6qBBqLmvRLFw1/u3gAI62Yp2Scx//DS88lTdqx3mTYbCyxb7qFZaq8KuuUFFd5EXOZCDMiU77F9ZHKemKiXN3puftAldzX/VzXrNvj18J+YwEHakENVTX6LXM/V3dkM8jki7VQw8Ua6a3a4DcCs3RmwBJquBaNa+O7hKbZaeegREV+TT06Yu7Tm41V98ctzm8y6yEHXDzTuZVxanhm/ualeRSJP4UE4ttYrbTk26iG7jzIsRhpkZLEt092U+B2DVQQq5dBtU3IWkqwv8NgpPKMSFMC3TTbpQ0bweq3+qcCoeIqUFd2Q8CwVj3W2Y8cjUEzXIo9UZi19ZQqBkWRzN1BQIQXzYU9OFpPn5rsMF4wO+hV4yIqhz/DCm/CQj5AlxxXT4NxLOCD+6T0JHtRev/qPaoaNCW9dGcMXTVd7AL4O1Mt7hr2PDMk8LfLUeIKeCmzUeYIw4ke9j8oiRHR38vGmxVDwdyOF2A4OHLp+NpQg/Q= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: e916da9a-195c-41fb-264e-08d9a8c9ac9d X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:58.9267 (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: q7GkHt8hVjG44/FuFgaBSKkL0T4sM9gjlkeepuukjQUPJeHN+A3DsB+2Vmout5K8rVg9IBzKDKvSUd/+UcVGV3Vn/uofZ8XLKQ7yoI37EuQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1501 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC A simple variable update from "pcs" to "mdio_device" for the mdio device will make things a little cleaner. Signed-off-by: Colin Foster --- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index 125a539b0654..3d93ac1376c6 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -829,7 +829,7 @@ static int enetc_imdio_create(struct enetc_pf *pf) struct device *dev = &pf->si->pdev->dev; struct enetc_mdio_priv *mdio_priv; struct phylink_pcs *phylink_pcs; - struct mdio_device *pcs; + struct mdio_device *mdio_device; struct mii_bus *bus; int err; @@ -853,16 +853,16 @@ static int enetc_imdio_create(struct enetc_pf *pf) goto free_mdio_bus; } - pcs = mdio_device_create(bus, 0); - if (IS_ERR(pcs)) { - err = PTR_ERR(pcs); - dev_err(dev, "cannot create pcs (%d)\n", err); + mdio_device = mdio_device_create(bus, 0); + if (IS_ERR(mdio_device)) { + err = PTR_ERR(mdio_device); + dev_err(dev, "cannot create mdio device (%d)\n", err); goto unregister_mdiobus; } - phylink_pcs = lynx_pcs_create(pcs); + phylink_pcs = lynx_pcs_create(mdio_device); if (!phylink_pcs) { - mdio_device_free(pcs); + mdio_device_free(mdio_device); err = -ENOMEM; dev_err(dev, "cannot create lynx pcs (%d)\n", err); goto unregister_mdiobus; From patchwork Tue Nov 16 06:23:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621461 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46903C433EF for ; Tue, 16 Nov 2021 06:26:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2ABBF6115B for ; Tue, 16 Nov 2021 06:26:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232011AbhKPG3l (ORCPT ); Tue, 16 Nov 2021 01:29:41 -0500 Received: from mail-bn8nam12on2099.outbound.protection.outlook.com ([40.107.237.99]:36352 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231181AbhKPG1d (ORCPT ); Tue, 16 Nov 2021 01:27:33 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nhm/fxRLMv7+GnHn5OHZ5XR25rMyImX/Llm/Lj+Xrjrvsh5rPu9Iw15MYveB8NtauoXEqF8ybMempOimfBWcXnx9dQODFaOy+VuASRkUrhCJsG8NbCu4EkGgGgJZTSqb3c7/17bnNDlSr1WVLxGwGn0fwuAVT7GXRka5sISJlP1xA6NOWLk4CVBLalSnYoVXgXjpwxsod/NmWi5mXty3z+WvwM9YIFo4Szp/ZVOQQgkI76fBH3yCgxh8UikcdYg3rIDgRR/6u1LBOyJmQJ72K0vYaKdjduLVi2FUYFNnVN3SqLuI+y9xvPs27pEu2nBAQecnuRWHj26wwh+oWI+kFw== 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=toz/kREwsP45vdGNTdO8e4m3bTuuZYfc/3+TCfHILJk=; b=bKqTjm/jxZv4oAOHIhID15uFXQb26am2EBox2tKytl4lcSqbcyp1bAiu3deMaB21354g3I8t+M+scpsNE50QkqPAj6eTNWZFcCRdp7NHFzSOYTOi10TqNVB84r90u8GgS7HluQgTTR9VuWofUTMRBHHmpb+zBaiU2kKSxWhaasVJlnqYGoaKyI+fhpbquE8ysJJEPFtuEDzVTN7w+fUUCvUuWBJwB0zGC94c4BHc04eolcF2st4VU4eyX0+lPKVxPP923R4Tr6IL65qizPMpwvOLdXPA/Xrh86nYW9AsRM3DiwdyPzPTbkLRxeCuUGFinxzMyOwdIs+q0i5bFPCDuQ== 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=toz/kREwsP45vdGNTdO8e4m3bTuuZYfc/3+TCfHILJk=; b=fAJ8MT1NruGCMg2wGgvZWt/ZdT1c6xvg+N5q7wL/6luvIASFQQuf97dm6jW+Bhg9Wgn+3x6LTMfA9jqUYlsSu7jVJrLzhw17js8epx6UdKVKFfk0/ptTO/fDUuTqRnPhNC0E974SmnVqfnQxFeDddqtg/bngivr7KTXKvVg873g= 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 MWHPR10MB1501.namprd10.prod.outlook.com (2603:10b6:300:24::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:23:59 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:23:59 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 22/23] net: pcs: lynx: use a common naming scheme for all lynx_pcs variables Date: Mon, 15 Nov 2021 22:23:27 -0800 Message-Id: <20211116062328.1949151-23-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9a505f9a-d6a9-4f5a-81eb-08d9a8c9ad11 X-MS-TrafficTypeDiagnostic: MWHPR10MB1501: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0rcLOJrc0wDmKl/6UGsDY395uEWNPgzjYJsKb8XmcxHTQqY32l7N7FWtQ7Lc79x/ZXlpz2yBMzrK4372bAxHyXrKAH0Njx7l2RmQjGjWboVJZITubWxkU4IDuVpNW1kKFqjWwiP3XrBiWfqm7xlaemZ+ulU7Fi5sJ0qS4SEkrWq5iuNU7zY5HKtL6hX7ScYFpo6wpYz+FTcNNcardcViDy1Q7uHA5h4sUWiGKhmN5t/8kEFCXDCWKZfwXM9mU48xLxXZxb+RN5IKaUI8XV6o/vUHF7Xj0avwMn0c4Lf1IzWQMH2rVY4PV7ci+zkrKCRyRDbrQgXdweQVbIErmkNfKQhDfTOPGfvJlXoBecoOJfQcaZiUV62Ljlo7hQvuz+xSRAv/lKcQ4KXjwKq+V3DSacrEub0eeNwnCF9b+67QO0esNu/MuojgllTDqqh15elkpI5z3a9xgequIGGgFDClnHCoKpmp6pVkAhtOcr+/KTgs4EGzYKT2jqQhFc5I1GXKY28Rqy3sPkYNa7jVCEWG3c0MBlxgyBQfxVmAWs5k639DNf9k7ZdylIJf5VuvA92ii3lOTNop6dILbV5vb38GCabiybGPSBtOaV1Cu0ive4Xl3If2z33VYDXZ7LcsGJh7ABBcBy8Efglgx5u+7BDC/F7cg+fraGCyybURGvt2zlmq6BiDYs0XZuPN3mKd8aw5gC5T9qLtrgaXPqqqV8qVTg== 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:(376002)(136003)(396003)(366004)(39840400004)(346002)(4326008)(2616005)(956004)(186003)(44832011)(7416002)(6506007)(1076003)(26005)(86362001)(6486002)(38350700002)(66946007)(54906003)(36756003)(38100700002)(316002)(6512007)(5660300002)(2906002)(508600001)(66556008)(8676002)(66476007)(6666004)(8936002)(83380400001)(52116002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WeSiCUSvtvjxoDPN8SpS22Dif9mZcENxURzKD41iPjV4sCVQhz9Z4KS3xY99ejwjqI1/RrKkVaIPcZpA+dKx/P5DMzr9yLDOyLwS/b4xyTnEYSA11DWI90TItQrZqwTfZyVELJfG1oQWac+/EpBvL+RvJT1bYffrmTcnDggL++TIZ4At0vKFl+QqaWrDppT4slRR0Pauek6couWsoEIriXEmxvBebQvIMMXTifWcBQAIaMFsmmqWAU/DEwxST/gfOAKfKi5EkET67S/5P+h+BJD5a7n2isIyESTBaN2grH5/xoziw651pO/KDFywjpTjTsebYVYTSZxBjgOrPqnJ5Jf0G1NXALigj4DMrrg0stmrgir5BcETffRaU3d2E3+1OSQJNRxYrBCHPH5cDAkMpZi7Q5TowxYaF7c7uLrpwf7jNtyeuL/3hrB84G6/RlCJB2yYTswwPPnw4RQ1HMKQb0TfOfoSwdDS5fKmnJoXn7MBrGEvrE3z9ZnG5bH54Dyh7Yc8Vy9Hm573TtZEAmwAC0EwIhyN5ClbYmoEzmTBMYo+ocW8YnA1gwiXTfff2C1CR5unnIGpnmJj5WGBrlgLkj4mZh4C1cPPsxZ1Ep486O8/rp3ixXhZuHM8S8zIZq79kV9DCMz3mFF0Fbhkj8PY/uzZ1uheuMPCRpuiciyLSzmCWJ5mY5nw210USkTWJDsgTtnfN/pMgE9eRX75ObGrarhTf2DXNtuvx2rVdZhLC2k6Tknc73KRzR643K2+ujldzT+CjcMukCmMpXaUFVReD6Np2uGbcVRSZFnj0e3R5U3ayf6R3aLl6mLSapl3/+leC3FxtqVseyylq0V+B3VQZfWIPPGCfU1OKlFMTGsAdG0JZ4Pzp3pksbNqbl7P4dbswddGevjROAH0UBOVdfqiC0T2p+f53wM/GwqjavAvyyQKtH8iO5gvhp3RtmNWp4Adl6JGRgQ7y2Sma78PSw8cQemGyiFeLh6BSO2L7xfYcQUvvqZjRIXZfAkn/8QRcI9oIbWZVRa1uu20k0tXD0yF33laTK74s8kwCcQX4SOTt7eSkfv/ACf4GR33JCDRsL6rMhyQ99UlCJGdayMPQrt+9YE69n2l9S+j09TpjTul/uIpoL3x1mTm9xGoIp/iWJt3BY3RmDUTfCcdOVTgGBKCPNhKflE8BoB+t/GI+7OnwFMW22t8FAnEVNKkd9dE/aaxqks2OVW+ebt/DROZLMRk5ZN48SUXNLFDmJIwKGyGElcNswCL+PrfaW9KnqgRMPedPJihcLeScDTzQkYxBWxUCJc42ZOHB2GWocY97uS8Edkjs2H1v5szOGGHVaiiHT2XG96u3we+XKUd0sZzGUoZKQdzesqtwyB8uBoVx9AW5PQp662SKnlYtBnB8Yt78e/8yRW/L+qMYPW2IdETuLFev41tAGFReCKy/8eeN+fPVgEFzzU/Wo2Tq7zYN0gx4TQqW9GPXqc7W8cDd8ney4EfEq/UVzsB1K38p3x66DdTLW0WI8nPOQGdackPFu5DK6UXE5tSSNUnGWQz9+FEU7YKLv1eC0r8urlrQnq3yx+fnJxIbe/MKuUGdetlUlN5cUgTtZXnY/MD/ba4VNYAw8DQwtFW8iI2NlaYQQ0cs5wIJ8BA+XArrlU7AoGRST5YnE4MMYCFKXgiM2S2+yQEV5P7u0mXjCnpcsBSRyh3o60cdMs= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a505f9a-d6a9-4f5a-81eb-08d9a8c9ad11 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:23:59.6873 (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: 1Q03CBOEP3dr8CgSiLPORCP2zDNFh54qVL1Xf7kToPhutU6xJ46swX7fLzOo56QKNQjvQ4zv8IFiMZiibZk09xGIDPxXMppU9yAORhPayiw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1501 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC pcs-lynx.c used lynx_pcs and lynx as a variable name within the same file. This standardizes all internal variables to just "lynx" Signed-off-by: Colin Foster --- drivers/net/pcs/pcs-lynx.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/pcs/pcs-lynx.c b/drivers/net/pcs/pcs-lynx.c index 7ff7f86ad430..fd3445374955 100644 --- a/drivers/net/pcs/pcs-lynx.c +++ b/drivers/net/pcs/pcs-lynx.c @@ -345,17 +345,17 @@ static const struct phylink_pcs_ops lynx_pcs_phylink_ops = { struct phylink_pcs *lynx_pcs_create(struct mdio_device *mdio) { - struct lynx_pcs *lynx_pcs; + struct lynx_pcs *lynx; - lynx_pcs = kzalloc(sizeof(*lynx_pcs), GFP_KERNEL); - if (!lynx_pcs) + lynx = kzalloc(sizeof(*lynx), GFP_KERNEL); + if (!lynx) return NULL; - lynx_pcs->mdio = mdio; - lynx_pcs->pcs.ops = &lynx_pcs_phylink_ops; - lynx_pcs->pcs.poll = true; + lynx->mdio = mdio; + lynx->pcs.ops = &lynx_pcs_phylink_ops; + lynx->pcs.poll = true; - return lynx_to_phylink_pcs(lynx_pcs); + return lynx_to_phylink_pcs(lynx); } EXPORT_SYMBOL(lynx_pcs_create); From patchwork Tue Nov 16 06:23:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12621467 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B880C433FE for ; Tue, 16 Nov 2021 06:27:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 779C261BE6 for ; Tue, 16 Nov 2021 06:27:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232296AbhKPGaS (ORCPT ); Tue, 16 Nov 2021 01:30:18 -0500 Received: from mail-bn8nam12on2128.outbound.protection.outlook.com ([40.107.237.128]:38113 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231279AbhKPG2H (ORCPT ); Tue, 16 Nov 2021 01:28:07 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LWryAJhnSye9EqiFLZ3qurNAqJs8mz1XD8oylOxjjJsklNvLAX+ReMlqUSfDsXKwF3vxS/M265+qjTgRkZCHojC4s2TUgrGkHIiGZeRhOVxe3irWGGdh27sgCJgplf7Da5OVmzauBXfvC+QaPACE8U2I5VAPiaS5IkEO19a9IwfypM6QHZOXDqADb/u7gTYhZsodTaJuCYXF8fpcOZfN/ELP/grkjlPXRHqCCerC4m9bbjASXPd99nAf36UFhYrTdiu1pXYegHeLTxIgd+F0eKcMFJQr9UNASeWafqr1UrErdA924JZ7zc/M9CukvzLL+LStg+RH3D0BZl227Xr/9Q== 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=UVEFQ48pRASMnkcjHYeli18jdIiZoJZmOjvh8qu7mus=; b=Wcsg3eKEy16CEhEF+PWkQZqvy2oNv1OW8izw/+A2XQTiGJVNWdlTPwYUZE9gIgJCTjjTi4dAnQabjd4SII1w0ly7eNDafHdYuMD+Tdi+KddoF0HDuwolWyUN+223S02A+0y1FxG8fh9gZjBc1q8WC4AE60aLIhFAXoS7a80t/mwljG7kM/lSI5Jl95wjT97RIe5aXnqzbuvM8Nj7dk5E59ITcs3sLqI/w2kc+Uqs/vV7Ko0sEJL/fWt13HnFPNhkoHuy72eTyNOvl41ydb0Gq/EC+GQ5UzGGjeoJryjXdz6HwO2YiVr8LwPtNN8o1Ces6AcHM1Yhg4V7kFGIEgRDtA== 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=UVEFQ48pRASMnkcjHYeli18jdIiZoJZmOjvh8qu7mus=; b=cg/+DdtRNoK/d0ySvcfme16FrxARE/WQwq/u4zGiBQhD4xGhryFW3luMIfVIAZ+i+zoYVgtameUwMlQAWgK9HVEdBv1AQvhdw9tPaWPfwdKB14a/hQv4YmuLUSORX4qgfFLGwS1F9bbGacWMgn2fDrLTNunGOR95ZT4PehBvXVU= 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 MWHPR10MB1501.namprd10.prod.outlook.com (2603:10b6:300:24::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Tue, 16 Nov 2021 06:24:00 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4690.026; Tue, 16 Nov 2021 06:24:00 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Heiner Kallweit , Russell King , Lars Povlsen , Steen Hegelund , Linus Walleij , Philipp Zabel , Heikki Krogerus , Andy Shevchenko Subject: [RFC PATCH v4 net-next 23/23] net: dsa: ocelot: felix: add support for VSC75XX control over SPI Date: Mon, 15 Nov 2021 22:23:28 -0800 Message-Id: <20211116062328.1949151-24-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116062328.1949151-1-colin.foster@in-advantage.com> References: <20211116062328.1949151-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR11CA0028.namprd11.prod.outlook.com (2603:10b6:300:115::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 06:23:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 42861876-bf13-4b17-3026-08d9a8c9ad84 X-MS-TrafficTypeDiagnostic: MWHPR10MB1501: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:741; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j8Ae3beibUGrLz4cZZZDY4UEpm7x8CxAIBBe/I7jzWrk3IT93RtgVZa5vtzZTEeltUZEsz7eO7MF7NKXpmU6aVhCuB+CNatbt2WS7vmdAwOhGLaZ4QkWZAGgGLqoLWAMXuhdfXD+nQJcCBjyUww1vjMDIbUcXzGQJoB8jp8OCKQfTejIN7eEujSGrkouE+B/fOcDfi3yowPnrsHXFJUDDWGwkkvCdGxxUEzhk/uWwp3j5uhQf+EjJ4A8fMkzzxqHomBHdL56U2rHnQS/2RY3U+VlDOqQVBycBZFwUUDv7+n6G45wPSOD7OnD736jzqOvlJYfOuYrUBpoIvcgGiSj2glWStIzH07txy1zwO5UQhppr+t3JLh/1jxs8KiPy9yL6rS2ldSsBl5AcOZ8jHkGC/NIwy1wluES+ysHvzDWzpbsiXcJ+VpCwQjlJDmy5eE/xArkjhmbmVtYJY/0dwOQ4HSJbMn/3wwXy1Kb9iaodzEih2q9n/U8ggvqpjTm3Qb7F6fOHTd5D9FYWX8wTGeefWpCeSPKwz8Ep/f3op27vEXaY/1Vkl+qMQDfZIZTyHg+nxN4Pvhdlm08AZgWObCq/RwygDwZuKTVRr3q6r84ROCQmF7sLHbWPl6epGP4JYfsgTpDDT2SMZBlNUN1VgvQYAc8kOIWxW0/pzH4Ir+Fuzy3jwgSOZHitCesrYGYg3P00vLD29XmUkE72MplCtOrBg== 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:(376002)(136003)(396003)(366004)(39840400004)(346002)(4326008)(2616005)(30864003)(956004)(186003)(44832011)(7416002)(6506007)(1076003)(26005)(86362001)(6486002)(38350700002)(66946007)(54906003)(36756003)(38100700002)(316002)(6512007)(5660300002)(2906002)(508600001)(66556008)(8676002)(66476007)(6666004)(8936002)(83380400001)(52116002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QM62OrCRy99Mp7d4JWmtspokSS0qiHDuurrOX+Emp34MxduOoXHgA1nUZC3469Y20G3HsFjG/DLAAffTJrTF5M/ET6UIYw+0ATupZ66qOI79XFnD8GW5vcl4GfxUfXXuJ2Syu8s1iIb0DojV+jE5uQP54MzHzRePH+Tg1D+70PNpE2YRdR3YHAZSWFZHIr1qNw/Uu54a+ZvaZc+r5WXrqMRJvuYKL8yTLG+jrTai6BR+8V0nc1ziBA3sznqACz3JolRcKmtZEZcj0PIDW/IKHycByKBhaDAnJQiZCojMOV1HL26qy3DtD1c6fVykqqxeR5tdEyinGqQw4Eoe3vi1QDI9KgWhbpdIJSUxHejXTL94b8zuYi8ELvws65g6DqAxpVtGEoxwyJCqXcdMb2O8JwJwYJfpGXehzQArNfZQ+hLUizaj7PSIKAsCFCZSsUCSU4oM2g4ITkH5Fdy73Isix1ZtaUzJiWVLLFocaW+rmSZeJyKpDz4yJ2qMUgHcQubL1qBRvEk1GV+HjWkVrDdkjIt4z92RyKaXKLp/ha6K9gNLkoUx/u6i76Q/HvEYJB4LBvwDSnm95fS3CcBnv7QU3I5d+SoX7L2mjmIfuPV2Y7Cv/2pu68d0fV4vnWBGbfXKLtFzWAKts+FW9S1MC7eX7Ow+YxALf1a2wPy88O2EhT8MO0+CpUWkex5skGeQbFCDM7J00v1GRoduulC0pOgkPOj79+FAI5Om4VEoqLK9Jsf1GXppaed+ki7FzSxAKiiGtNjmp2vSzyn6U/LRgZ1tbt/nCAZ/HWiQ5YKn2X0zMFvbgvQqewFRPBalGqCkLyBSrKIknm85jKyCogOFsQjfqGAbHrBH6q9CUI1ig2qJLgJLdO7MUB8ER/RbGw+Z1YeK65HpMAWDqIYT5m985PAfA3kfKLu2TPl3/8qkYz1Bv/6y0H44qPVVaiTBYaY9HR6mGudHFf9aTDJDwFjMGCgxppE4MRCaFHh3XQjdG2EfoUbIz44HZJVONnsj9e94YMawfXzw3tvj2NdYJHkDZtL6l+rtflrx26jI7Tyctg7J89tZ7ZUYSzHhQS7IW3gHELocLuE2uctVMP3WlYB5v2auSyqFUZG7WNEp/UvJCcPJ6qjVSuJP0SAqsh7CIlcWVgR8NxqNgF0IkfMHSZqtzrFLa18tVH6zBy4AGoXGHkptAZ4SXcWMfsCrHUAe5J8iqgN/6SVhcED/99YY07mtJyMppykpxLdO/Q9ngWPrxzILQgg9nl6QOIgfhqtopu4TAqtXvcWvkt2NuYIDEHIBUXLJnzkHT1lTBs7N4s6l4HPfjnQmdesxyToquwQ4OBB7nl4IHCFLif/EwRpHIP9gchYaoQ0nvTcMuowM+/z85qcqPVqhY9NYf9wpZkpA6uoRThYmpG5IB92EKAc4z568oqdsKiBIhGhNN/0xxkStPetAljr19C6mIMM33Cv4uyUVSwL/5JWmvbR8MtB3T+Gna3owBzl00HKZxpFtrSznjZtmVO6Q9PZr6oWrzsUCvSMomojrmK7cfTijftqIIc4t/khfntTHpOROCQfAUQeRL8FRMNcphfy0R/ogclLr1cgZgPSdpkbcc2q8R+wTzIOhyUtIwQ00ePMl7zBg2ipkXSNEbWNo+q5ARHlULP+C5GQWZsxq4HbLZW8Axin5IGFyVFp3sabOJCJkDKbjqywiV4NjS/M= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42861876-bf13-4b17-3026-08d9a8c9ad84 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 06:24:00.4718 (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: YzEngnG685c0UQ0ELgWvmr26ynO5DfXqX0ZAHRQc+RoEnO/9seVHj5WtpPKqtAPU4Y2vVAkvxcJiG+Iet1SEYpJS/a+YtNuMpyoYDU/+DNo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1501 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Utilize the Felix and Ocelot drivers to allow control of the VSC7511, VSC7512, VSC7513 and VSC7514 chips from an external CPU over SPI. Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/Kconfig | 15 + drivers/net/dsa/ocelot/Makefile | 6 + drivers/net/dsa/ocelot/ocelot_vsc7512_spi.c | 946 ++++++++++++++++++++ drivers/net/ethernet/mscc/ocelot.c | 8 + include/soc/mscc/ocelot.h | 26 + include/soc/mscc/vsc7514_regs.h | 16 +- 6 files changed, 1009 insertions(+), 8 deletions(-) create mode 100644 drivers/net/dsa/ocelot/ocelot_vsc7512_spi.c diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfig index 220b0b027b55..43982909b6bf 100644 --- a/drivers/net/dsa/ocelot/Kconfig +++ b/drivers/net/dsa/ocelot/Kconfig @@ -15,6 +15,21 @@ config NET_DSA_MSCC_FELIX This driver supports the VSC9959 (Felix) switch, which is embedded as a PCIe function of the NXP LS1028A ENETC RCiEP. +config NET_DSA_MSCC_OCELOT_SPI + tristate "Ocelot Ethernet SPI switch support" + depends on NET_DSA && SPI + depends on NET_VENDOR_MICROSEMI + select MDIO_MSCC_MIIM + select PINCTRL_MICROCHIP_SGPIO + select PINCTRL_OCELOT + 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_SEVILLE tristate "Ocelot / Seville Ethernet switch support" depends on NET_DSA diff --git a/drivers/net/dsa/ocelot/Makefile b/drivers/net/dsa/ocelot/Makefile index 34b9b128efb8..6ccd5482de7b 100644 --- a/drivers/net/dsa/ocelot/Makefile +++ b/drivers/net/dsa/ocelot/Makefile @@ -1,11 +1,17 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_NET_DSA_MSCC_FELIX) += mscc_felix.o +obj-$(CONFIG_NET_DSA_MSCC_OCELOT_SPI) += mscc_ocelot_spi.o obj-$(CONFIG_NET_DSA_MSCC_SEVILLE) += mscc_seville.o mscc_felix-objs := \ felix.o \ felix_vsc9959.o +mscc_ocelot_spi-objs := \ + felix.o \ + felix_mdio.o \ + ocelot_vsc7512_spi.o + mscc_seville-objs := \ felix.o \ felix_mdio.o \ diff --git a/drivers/net/dsa/ocelot/ocelot_vsc7512_spi.c b/drivers/net/dsa/ocelot/ocelot_vsc7512_spi.c new file mode 100644 index 000000000000..c4a6f4b7a717 --- /dev/null +++ b/drivers/net/dsa/ocelot/ocelot_vsc7512_spi.c @@ -0,0 +1,946 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* Copyright 2017 Microsemi Corporation + * Copyright 2018-2019 NXP Semiconductors + * Copyright 2021 Innovative Advantage Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "felix.h" +#include "felix_mdio.h" + +struct ocelot_spi_data { + int spi_padding_bytes; + struct felix felix; + struct spi_device *spi; +}; + +static const u32 vsc7512_dev_cpuorg_regmap[] = { + REG(DEV_CPUORG_IF_CTRL, 0x0000), + REG(DEV_CPUORG_IF_CFGSTAT, 0x0004), + REG(DEV_CPUORG_ORG_CFG, 0x0008), + REG(DEV_CPUORG_ERR_CNTS, 0x000c), + REG(DEV_CPUORG_TIMEOUT_CFG, 0x0010), + REG(DEV_CPUORG_GPR, 0x0014), + REG(DEV_CPUORG_MAILBOX_SET, 0x0018), + REG(DEV_CPUORG_MAILBOX_CLR, 0x001c), + REG(DEV_CPUORG_MAILBOX, 0x0020), + REG(DEV_CPUORG_SEMA_CFG, 0x0024), + REG(DEV_CPUORG_SEMA0, 0x0028), + REG(DEV_CPUORG_SEMA0_OWNER, 0x002c), + REG(DEV_CPUORG_SEMA1, 0x0030), + REG(DEV_CPUORG_SEMA1_OWNER, 0x0034), +}; + +static const u32 vsc7512_gcb_regmap[] = { + REG(GCB_SOFT_RST, 0x0008), + REG(GCB_GPIO_GPIO_OUT_SET, 0x0034), + REG(GCB_GPIO_GPIO_OUT_CLR, 0x0038), + REG(GCB_GPIO_GPIO_OUT, 0x003c), + REG(GCB_GPIO_GPIO_IN, 0x0040), + REG(GCB_GPIO_GPIO_OE, 0x0044), + REG(GCB_GPIO_GPIO_ALT, 0x0054), + REG(GCB_MIIM_MII_STATUS, 0x009c), + REG(GCB_MIIM_MII_CMD, 0x00a4), + REG(GCB_MIIM_MII_DATA, 0x00a8), + REG(GCB_PHY_PHY_CFG, 0x00f0), + REG(GCB_PHY_PHY_STAT, 0x00f4), + REG(GCB_SIO_CTRL_SIO_INPUT_DATA, 0x00f8), +}; + +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, + [DEV_CPUORG] = vsc7512_dev_cpuorg_regmap, +}; + +#define VSC7512_BYTE_ORDER_LE 0x00000000 +#define VSC7512_BYTE_ORDER_BE 0x81818181 +#define VSC7512_BIT_ORDER_MSB 0x00000000 +#define VSC7512_BIT_ORDER_LSB 0x42424242 + +static void ocelot_spi_reset_phys(struct ocelot *ocelot) +{ + ocelot_write(ocelot, 0, GCB_PHY_PHY_CFG); + ocelot_write(ocelot, 0x1ff, GCB_PHY_PHY_CFG); + mdelay(500); +} + +static struct ocelot_spi_data *felix_to_ocelot_spi(struct felix *felix) +{ + return container_of(felix, struct ocelot_spi_data, felix); +} + +static struct ocelot_spi_data *ocelot_to_ocelot_spi(struct ocelot *ocelot) +{ + struct felix *felix = ocelot_to_felix(ocelot); + + return felix_to_ocelot_spi(felix); +} + +static int ocelot_spi_init_bus(struct ocelot *ocelot) +{ + struct ocelot_spi_data *ocelot_spi; + struct spi_device *spi; + u32 val, check; + + ocelot_spi = ocelot_to_ocelot_spi(ocelot); + spi = ocelot_spi->spi; + + val = 0; + +#ifdef __LITTLE_ENDIAN + val |= VSC7512_BYTE_ORDER_LE; +#else + val |= VSC7512_BYTE_ORDER_BE; +#endif + + ocelot_write(ocelot, val, DEV_CPUORG_IF_CTRL); + + val = ocelot_spi->spi_padding_bytes; + ocelot_write(ocelot, val, DEV_CPUORG_IF_CFGSTAT); + + check = val | 0x02000000; + + val = ocelot_read(ocelot, DEV_CPUORG_IF_CFGSTAT); + if (check != val) { + dev_err(&spi->dev, + "Error configuring SPI bus. V: 0x%08x != 0x%08x\n", val, + check); + return -ENODEV; + } + + /* The internal copper phys need to be enabled before the mdio bus is + * scanned. + */ + ocelot_spi_reset_phys(ocelot); + + return 0; +} + +static int vsc7512_reset(struct ocelot *ocelot) +{ + int retries = 100; + int ret, val; + + ocelot_field_write(ocelot, GCB_SOFT_RST_CHIP_RST, 1); + + /* Note: This is adapted from the PCIe reset strategy. The manual doesn't + * suggest how to do a reset over SPI, and the register strategy isn't + * possible. + */ + msleep(100); + + ret = ocelot_spi_init_bus(ocelot); + if (ret) + return ret; + + regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], 1); + regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1); + + do { + msleep(1); + regmap_field_read(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], + &val); + } while (val && --retries); + + if (!retries) + return -ETIMEDOUT; + + regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1); + + return 0; +} + +static u32 ocelot_offset_from_reg_base(struct ocelot *ocelot, u32 target, + u32 reg) +{ + return ocelot->map[target][reg & REG_MASK]; +} + +static void ocelot_spi_register_pinctrl(struct ocelot *ocelot) +{ + struct device_node *pinctrl_node; + struct device *dev = ocelot->dev; + struct regmap *regmap; + u32 pinctrl_offset; + int err; + + pinctrl_node = of_get_child_by_name(dev->of_node, "pinctrl"); + if (!pinctrl_node) + return; + + regmap = ocelot->targets[GCB]; + pinctrl_offset = ocelot_offset_from_reg_base(ocelot, GCB, + GCB_GPIO_GPIO_OUT_SET); + + err = ocelot_pinctrl_core_probe(dev, NULL, regmap, pinctrl_offset, NULL, + 0, pinctrl_node); + if (err) { + dev_info(dev, "error setting up pinctrl device\n"); + return; + } +} + +static int vsc7512_spi_bus_init(struct ocelot *ocelot) +{ + struct felix *felix = ocelot_to_felix(ocelot); + struct device *dev = ocelot->dev; + struct device_node *mdio_node; + int rval; + + rval = ocelot_spi_init_bus(ocelot); + if (rval) { + dev_err(ocelot->dev, "error initializing SPI bus\n"); + goto clear_mdio; + } + + /* Set up the pins before probing the MDIO bus */ + ocelot_spi_register_pinctrl(ocelot); + + mdio_node = of_get_child_by_name(dev->of_node, "mdio"); + if (!mdio_node) + dev_info(ocelot->dev, + "mdio children not found in device tree\n"); + + rval = felix_of_mdio_register(ocelot, mdio_node); + if (rval) + dev_err(ocelot->dev, "error registering MDIO bus\n"); + + felix->ds->slave_mii_bus = felix->imdio; + + return rval; + +clear_mdio: + felix->imdio = NULL; + return rval; +} + +static const struct ocelot_ops vsc7512_ops = { + .bus_init = vsc7512_spi_bus_init, + .reset = vsc7512_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, +}; + +/* Addresses are relative to the SPI device's base address, downshifted by 2*/ +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", + }, + [DEV_CPUORG] = { + .start = 0x71000000, + .end = 0x710003ff, + .name = "devcpu_org", + }, +}; + +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 const struct reg_field vsc7512_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), + [GCB_SOFT_RST_CHIP_RST] = REG_FIELD(GCB_SOFT_RST, 0, 0), + [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), + [GCB_MIIM_MII_STATUS_PENDING] = REG_FIELD(GCB_MIIM_MII_STATUS, 2, 2), + [GCB_MIIM_MII_STATUS_BUSY] = REG_FIELD(GCB_MIIM_MII_STATUS, 3, 3), +}; + +static const struct ocelot_stat_layout vsc7512_stats_layout[] = { + { .offset = 0x00, .name = "rx_octets", }, + { .offset = 0x01, .name = "rx_unicast", }, + { .offset = 0x02, .name = "rx_multicast", }, + { .offset = 0x03, .name = "rx_broadcast", }, + { .offset = 0x04, .name = "rx_shorts", }, + { .offset = 0x05, .name = "rx_fragments", }, + { .offset = 0x06, .name = "rx_jabbers", }, + { .offset = 0x07, .name = "rx_crc_align_errs", }, + { .offset = 0x08, .name = "rx_sym_errs", }, + { .offset = 0x09, .name = "rx_frames_below_65_octets", }, + { .offset = 0x0A, .name = "rx_frames_65_to_127_octets", }, + { .offset = 0x0B, .name = "rx_frames_128_to_255_octets", }, + { .offset = 0x0C, .name = "rx_frames_256_to_511_octets", }, + { .offset = 0x0D, .name = "rx_frames_512_to_1023_octets", }, + { .offset = 0x0E, .name = "rx_frames_1024_to_1526_octets", }, + { .offset = 0x0F, .name = "rx_frames_over_1526_octets", }, + { .offset = 0x10, .name = "rx_pause", }, + { .offset = 0x11, .name = "rx_control", }, + { .offset = 0x12, .name = "rx_longs", }, + { .offset = 0x13, .name = "rx_classified_drops", }, + { .offset = 0x14, .name = "rx_red_prio_0", }, + { .offset = 0x15, .name = "rx_red_prio_1", }, + { .offset = 0x16, .name = "rx_red_prio_2", }, + { .offset = 0x17, .name = "rx_red_prio_3", }, + { .offset = 0x18, .name = "rx_red_prio_4", }, + { .offset = 0x19, .name = "rx_red_prio_5", }, + { .offset = 0x1A, .name = "rx_red_prio_6", }, + { .offset = 0x1B, .name = "rx_red_prio_7", }, + { .offset = 0x1C, .name = "rx_yellow_prio_0", }, + { .offset = 0x1D, .name = "rx_yellow_prio_1", }, + { .offset = 0x1E, .name = "rx_yellow_prio_2", }, + { .offset = 0x1F, .name = "rx_yellow_prio_3", }, + { .offset = 0x20, .name = "rx_yellow_prio_4", }, + { .offset = 0x21, .name = "rx_yellow_prio_5", }, + { .offset = 0x22, .name = "rx_yellow_prio_6", }, + { .offset = 0x23, .name = "rx_yellow_prio_7", }, + { .offset = 0x24, .name = "rx_green_prio_0", }, + { .offset = 0x25, .name = "rx_green_prio_1", }, + { .offset = 0x26, .name = "rx_green_prio_2", }, + { .offset = 0x27, .name = "rx_green_prio_3", }, + { .offset = 0x28, .name = "rx_green_prio_4", }, + { .offset = 0x29, .name = "rx_green_prio_5", }, + { .offset = 0x2A, .name = "rx_green_prio_6", }, + { .offset = 0x2B, .name = "rx_green_prio_7", }, + { .offset = 0x40, .name = "tx_octets", }, + { .offset = 0x41, .name = "tx_unicast", }, + { .offset = 0x42, .name = "tx_multicast", }, + { .offset = 0x43, .name = "tx_broadcast", }, + { .offset = 0x44, .name = "tx_collision", }, + { .offset = 0x45, .name = "tx_drops", }, + { .offset = 0x46, .name = "tx_pause", }, + { .offset = 0x47, .name = "tx_frames_below_65_octets", }, + { .offset = 0x48, .name = "tx_frames_65_to_127_octets", }, + { .offset = 0x49, .name = "tx_frames_128_255_octets", }, + { .offset = 0x4A, .name = "tx_frames_256_511_octets", }, + { .offset = 0x4B, .name = "tx_frames_512_1023_octets", }, + { .offset = 0x4C, .name = "tx_frames_1024_1526_octets", }, + { .offset = 0x4D, .name = "tx_frames_over_1526_octets", }, + { .offset = 0x4E, .name = "tx_yellow_prio_0", }, + { .offset = 0x4F, .name = "tx_yellow_prio_1", }, + { .offset = 0x50, .name = "tx_yellow_prio_2", }, + { .offset = 0x51, .name = "tx_yellow_prio_3", }, + { .offset = 0x52, .name = "tx_yellow_prio_4", }, + { .offset = 0x53, .name = "tx_yellow_prio_5", }, + { .offset = 0x54, .name = "tx_yellow_prio_6", }, + { .offset = 0x55, .name = "tx_yellow_prio_7", }, + { .offset = 0x56, .name = "tx_green_prio_0", }, + { .offset = 0x57, .name = "tx_green_prio_1", }, + { .offset = 0x58, .name = "tx_green_prio_2", }, + { .offset = 0x59, .name = "tx_green_prio_3", }, + { .offset = 0x5A, .name = "tx_green_prio_4", }, + { .offset = 0x5B, .name = "tx_green_prio_5", }, + { .offset = 0x5C, .name = "tx_green_prio_6", }, + { .offset = 0x5D, .name = "tx_green_prio_7", }, + { .offset = 0x5E, .name = "tx_aged", }, + { .offset = 0x80, .name = "drop_local", }, + { .offset = 0x81, .name = "drop_tail", }, + { .offset = 0x82, .name = "drop_yellow_prio_0", }, + { .offset = 0x83, .name = "drop_yellow_prio_1", }, + { .offset = 0x84, .name = "drop_yellow_prio_2", }, + { .offset = 0x85, .name = "drop_yellow_prio_3", }, + { .offset = 0x86, .name = "drop_yellow_prio_4", }, + { .offset = 0x87, .name = "drop_yellow_prio_5", }, + { .offset = 0x88, .name = "drop_yellow_prio_6", }, + { .offset = 0x89, .name = "drop_yellow_prio_7", }, + { .offset = 0x8A, .name = "drop_green_prio_0", }, + { .offset = 0x8B, .name = "drop_green_prio_1", }, + { .offset = 0x8C, .name = "drop_green_prio_2", }, + { .offset = 0x8D, .name = "drop_green_prio_3", }, + { .offset = 0x8E, .name = "drop_green_prio_4", }, + { .offset = 0x8F, .name = "drop_green_prio_5", }, + { .offset = 0x90, .name = "drop_green_prio_6", }, + { .offset = 0x91, .name = "drop_green_prio_7", }, +}; + +static unsigned int ocelot_spi_translate_address(unsigned int reg) +{ + return cpu_to_be32((reg & 0xffffff) >> 2); +} + +struct ocelot_spi_regmap_context { + struct spi_device *spi; + u32 base; +}; + +static int ocelot_spi_reg_read(void *context, unsigned int reg, + unsigned int *val) +{ + struct ocelot_spi_regmap_context *regmap_context = context; + struct spi_transfer tx, padding, rx; + struct ocelot_spi_data *ocelot_spi; + struct spi_message msg; + struct spi_device *spi; + unsigned int addr; + u8 *tx_buf; + + WARN_ON(!val); + + spi = regmap_context->spi; + + ocelot_spi = spi_get_drvdata(spi); + + addr = ocelot_spi_translate_address(reg + regmap_context->base); + tx_buf = (u8 *)&addr; + + spi_message_init(&msg); + + memset(&tx, 0, sizeof(struct spi_transfer)); + + /* Ignore the first byte for the 24-bit address */ + tx.tx_buf = &tx_buf[1]; + tx.len = 3; + + spi_message_add_tail(&tx, &msg); + + if (ocelot_spi->spi_padding_bytes > 0) { + u8 dummy_buf[16] = {0}; + + memset(&padding, 0, sizeof(struct spi_transfer)); + + /* Just toggle the clock for padding bytes */ + padding.len = ocelot_spi->spi_padding_bytes; + padding.tx_buf = dummy_buf; + padding.dummy_data = 1; + + spi_message_add_tail(&padding, &msg); + } + + memset(&rx, 0, sizeof(struct spi_transfer)); + rx.rx_buf = val; + rx.len = 4; + + spi_message_add_tail(&rx, &msg); + + return spi_sync(spi, &msg); +} + +static int ocelot_spi_reg_write(void *context, unsigned int reg, + unsigned int val) +{ + struct ocelot_spi_regmap_context *regmap_context = context; + struct spi_transfer tx[2] = {0}; + struct spi_message msg; + struct spi_device *spi; + unsigned int addr; + u8 *tx_buf; + + spi = regmap_context->spi; + + addr = ocelot_spi_translate_address(reg + regmap_context->base); + tx_buf = (u8 *)&addr; + + spi_message_init(&msg); + + /* Ignore the first byte for the 24-bit address and set the write bit */ + tx_buf[1] |= BIT(7); + tx[0].tx_buf = &tx_buf[1]; + tx[0].len = 3; + + spi_message_add_tail(&tx[0], &msg); + + memset(&tx[1], 0, sizeof(struct spi_transfer)); + tx[1].tx_buf = &val; + tx[1].len = 4; + + spi_message_add_tail(&tx[1], &msg); + + return spi_sync(spi, &msg); +} + +static const struct regmap_config ocelot_spi_regmap_config = { + .reg_bits = 24, + .reg_stride = 4, + .val_bits = 32, + + .reg_read = ocelot_spi_reg_read, + .reg_write = ocelot_spi_reg_write, + + .max_register = 0xffffffff, + .use_single_write = true, + .use_single_read = true, + .can_multi_write = false, + + .reg_format_endian = REGMAP_ENDIAN_BIG, + .val_format_endian = REGMAP_ENDIAN_NATIVE, +}; + +static void vsc7512_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 int vsc7512_prevalidate_phy_mode(struct ocelot *ocelot, int port, + phy_interface_t phy_mode) +{ + switch (phy_mode) { + case PHY_INTERFACE_MODE_INTERNAL: + if (port < 4) + return 0; + return -EOPNOTSUPP; + case PHY_INTERFACE_MODE_SGMII: + if (port < 8) + return 0; + return -EOPNOTSUPP; + case PHY_INTERFACE_MODE_QSGMII: + if (port == 7 || port == 8 || port == 10) + return 0; + return -EOPNOTSUPP; + default: + return -EOPNOTSUPP; + } +} + +static int vsc7512_port_setup_tc(struct dsa_switch *ds, int port, + enum tc_setup_type type, void *type_data) +{ + return -EOPNOTSUPP; +} + +static struct vcap_props vsc7512_vcap_props[] = { + [VCAP_ES0] = { + .action_type_width = 0, + .action_table = { + [ES0_ACTION_TYPE_NORMAL] = { + .width = 73, + .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, + .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 regmap *vsc7512_regmap_init(struct ocelot *ocelot, + struct resource *res) +{ + struct ocelot_spi_regmap_context *context; + struct regmap_config regmap_config; + struct ocelot_spi_data *ocelot_spi; + struct regmap *regmap; + struct device *dev; + char name[32]; + + ocelot_spi = ocelot_to_ocelot_spi(ocelot); + dev = &ocelot_spi->spi->dev; + + context = devm_kzalloc(dev, sizeof(struct ocelot_spi_regmap_context), + GFP_KERNEL); + + if (IS_ERR(context)) + return ERR_CAST(context); + + context->base = res->start; + context->spi = ocelot_spi->spi; + + memcpy(®map_config, &ocelot_spi_regmap_config, + sizeof(ocelot_spi_regmap_config)); + + /* A unique bus name is required for each regmap */ + if (res->name) + snprintf(name, sizeof(name) - 1, "ocelot_spi-%s", res->name); + else + snprintf(name, sizeof(name) - 1, "ocelot_spi@0x%08x", + res->start); + + regmap_config.name = name; + regmap_config.max_register = res->end - res->start; + + regmap = devm_regmap_init(dev, NULL, context, ®map_config); + + if (IS_ERR(regmap)) + return ERR_CAST(regmap); + + return regmap; +} + +static unsigned long vsc7512_get_quirk_for_port(struct ocelot *ocelot, + int port) +{ + /* Currently Ocelot PCS is not functioning. When that happens, different + * ports will have different quirks, which will need to be addressed + * here. + */ + return 0; +} + +static const struct felix_info ocelot_spi_info = { + .target_io_res = vsc7512_target_io_res, + .port_io_res = vsc7512_port_io_res, + .regfields = vsc7512_regfields, + .map = vsc7512_regmap, + .ops = &vsc7512_ops, + .stats_layout = vsc7512_stats_layout, + .num_stats = ARRAY_SIZE(vsc7512_stats_layout), + .vcap = vsc7512_vcap_props, + .num_mact_rows = 1024, + .num_ports = 11, + .num_tx_queues = OCELOT_NUM_TC, + .mdio_bus_alloc = felix_mdio_bus_alloc, + .mdio_bus_free = felix_mdio_bus_free, + .phylink_validate = vsc7512_phylink_validate, + .prevalidate_phy_mode = vsc7512_prevalidate_phy_mode, + .port_setup_tc = vsc7512_port_setup_tc, + .init_regmap = vsc7512_regmap_init, + .get_quirk_for_port = vsc7512_get_quirk_for_port, +}; + +static void ocelot_spi_register_sgpio(struct ocelot *ocelot) +{ + struct device *dev = ocelot->dev; + struct device_node *sgpio_node; + u32 offset; + int err; + + sgpio_node = of_get_child_by_name(dev->of_node, "sgpio"); + if (!sgpio_node) + return; + + offset = ocelot_offset_from_reg_base(ocelot, GCB, + GCB_SIO_CTRL_SIO_INPUT_DATA); + err = microchip_sgpio_core_probe(dev, sgpio_node, ocelot->targets[GCB], + offset); + + if (err) + dev_info(dev, "error setting up sgpio device\n"); +} + +static int ocelot_spi_probe(struct spi_device *spi) +{ + struct ocelot_spi_data *ocelot_spi; + struct dsa_switch *ds; + struct ocelot *ocelot; + struct felix *felix; + struct device *dev; + int err; + + dev = &spi->dev; + + ocelot_spi = devm_kzalloc(dev, sizeof(struct ocelot_spi_data), + GFP_KERNEL); + + if (!ocelot_spi) + return -ENOMEM; + + if (spi->max_speed_hz <= 500000) { + ocelot_spi->spi_padding_bytes = 0; + } else { + /* Calculation taken from the manual for IF_CFGSTAT:IF_CFG. Err + * on the side of more padding bytes, as having too few can be + * difficult to detect at runtime. + */ + ocelot_spi->spi_padding_bytes = 1 + + (spi->max_speed_hz / 1000000 + 2) / 8; + } + + dev_set_drvdata(dev, ocelot_spi); + ocelot_spi->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; + } + + felix = &ocelot_spi->felix; + + ocelot = &felix->ocelot; + ocelot->dev = dev; + + ocelot->num_flooding_pgids = 1; + + felix->info = &ocelot_spi_info; + + ds = kzalloc(sizeof(*ds), GFP_KERNEL); + if (!ds) { + err = -ENOMEM; + dev_err(dev, "Failed to allocate DSA switch\n"); + return err; + } + + ds->dev = &spi->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_register_ds; + } + + ocelot_spi_register_sgpio(ocelot); + + return 0; + +err_register_ds: + kfree(ds); + return err; +} + +static int ocelot_spi_remove(struct spi_device *spi) +{ + struct ocelot_spi_data *ocelot_spi; + struct felix *felix; + + ocelot_spi = spi_get_drvdata(spi); + felix = &ocelot_spi->felix; + + dsa_unregister_switch(felix->ds); + + kfree(felix->ds); + + devm_kfree(&spi->dev, ocelot_spi); + + return 0; +} + +const struct of_device_id vsc7512_of_match[] = { + { .compatible = "mscc,vsc7514" }, + { .compatible = "mscc,vsc7513" }, + { .compatible = "mscc,vsc7512" }, + { .compatible = "mscc,vsc7511" }, + { }, +}; +MODULE_DEVICE_TABLE(of, vsc7512_of_match); + +static struct spi_driver ocelot_vsc7512_spi_driver = { + .driver = { + .name = "vsc7512", + .of_match_table = of_match_ptr(vsc7512_of_match), + }, + .probe = ocelot_spi_probe, + .remove = ocelot_spi_remove, +}; +module_spi_driver(ocelot_vsc7512_spi_driver); + +MODULE_DESCRIPTION("Ocelot Switch SPI driver"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index e6c18b598d5c..5a4c046b5e20 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -2243,6 +2243,14 @@ int ocelot_init(struct ocelot *ocelot) int i, ret; u32 port; + if (ocelot->ops->bus_init) { + ret = ocelot->ops->bus_init(ocelot); + if (ret) { + dev_err(ocelot->dev, "Bus init failed\n"); + return ret; + } + } + if (ocelot->ops->reset) { ret = ocelot->ops->reset(ocelot); if (ret) { diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 8c27f8f79fff..6aeb7eac73f5 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -121,6 +121,7 @@ enum ocelot_target { PTP, GCB, DEV_GMII, + DEV_CPUORG, TARGET_MAX, }; @@ -396,9 +397,18 @@ enum ocelot_reg { PTP_CLK_CFG_ADJ_CFG, PTP_CLK_CFG_ADJ_FREQ, GCB_SOFT_RST = GCB << TARGET_OFFSET, + GCB_GPIO_GPIO_OUT_SET, + GCB_GPIO_GPIO_OUT_CLR, + GCB_GPIO_GPIO_OUT, + GCB_GPIO_GPIO_IN, + GCB_GPIO_GPIO_OE, + GCB_GPIO_GPIO_ALT, GCB_MIIM_MII_STATUS, GCB_MIIM_MII_CMD, GCB_MIIM_MII_DATA, + GCB_PHY_PHY_CFG, + GCB_PHY_PHY_STAT, + GCB_SIO_CTRL_SIO_INPUT_DATA, DEV_CLOCK_CFG = DEV_GMII << TARGET_OFFSET, DEV_PORT_MISC, DEV_EVENTS, @@ -438,6 +448,20 @@ enum ocelot_reg { PCS1G_TSTPAT_STATUS, DEV_PCS_FX100_CFG, DEV_PCS_FX100_STATUS, + DEV_CPUORG_IF_CTRL = DEV_CPUORG << TARGET_OFFSET, + DEV_CPUORG_IF_CFGSTAT, + DEV_CPUORG_ORG_CFG, + DEV_CPUORG_ERR_CNTS, + DEV_CPUORG_TIMEOUT_CFG, + DEV_CPUORG_GPR, + DEV_CPUORG_MAILBOX_SET, + DEV_CPUORG_MAILBOX_CLR, + DEV_CPUORG_MAILBOX, + DEV_CPUORG_SEMA_CFG, + DEV_CPUORG_SEMA0, + DEV_CPUORG_SEMA0_OWNER, + DEV_CPUORG_SEMA1, + DEV_CPUORG_SEMA1_OWNER, }; enum ocelot_regfield { @@ -496,6 +520,7 @@ enum ocelot_regfield { SYS_RESET_CFG_MEM_ENA, SYS_RESET_CFG_MEM_INIT, GCB_SOFT_RST_SWC_RST, + GCB_SOFT_RST_CHIP_RST, GCB_MIIM_MII_STATUS_PENDING, GCB_MIIM_MII_STATUS_BUSY, SYS_PAUSE_CFG_PAUSE_START, @@ -552,6 +577,7 @@ struct ocelot; struct ocelot_ops { struct net_device *(*port_to_netdev)(struct ocelot *ocelot, int port); int (*netdev_to_port)(struct net_device *dev); + int (*bus_init)(struct ocelot *ocelot); int (*reset)(struct ocelot *ocelot); u16 (*wm_enc)(u16 value); u16 (*wm_dec)(u16 value); diff --git a/include/soc/mscc/vsc7514_regs.h b/include/soc/mscc/vsc7514_regs.h index c39f64079a0f..98743e252012 100644 --- a/include/soc/mscc/vsc7514_regs.h +++ b/include/soc/mscc/vsc7514_regs.h @@ -8,14 +8,14 @@ #ifndef VSC7514_REGS_H #define VSC7514_REGS_H -extern const u32 ocelot_ana_regmap[]; -extern const u32 ocelot_qs_regmap[]; -extern const u32 ocelot_qsys_regmap[]; -extern const u32 ocelot_rew_regmap[]; -extern const u32 ocelot_sys_regmap[]; -extern const u32 ocelot_vcap_regmap[]; -extern const u32 ocelot_ptp_regmap[]; -extern const u32 ocelot_dev_gmii_regmap[]; +extern const u32 vsc7514_ana_regmap[]; +extern const u32 vsc7514_qs_regmap[]; +extern const u32 vsc7514_qsys_regmap[]; +extern const u32 vsc7514_rew_regmap[]; +extern const u32 vsc7514_sys_regmap[]; +extern const u32 vsc7514_vcap_regmap[]; +extern const u32 vsc7514_ptp_regmap[]; +extern const u32 vsc7514_dev_gmii_regmap[]; extern const struct vcap_field vsc7514_vcap_es0_keys[]; extern const struct vcap_field vsc7514_vcap_es0_actions[];