From patchwork Fri Jun 10 17:56:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12877868 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C415CCCA481 for ; Fri, 10 Jun 2022 17:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350245AbiFJR5R (ORCPT ); Fri, 10 Jun 2022 13:57:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347362AbiFJR5M (ORCPT ); Fri, 10 Jun 2022 13:57:12 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2121.outbound.protection.outlook.com [40.107.223.121]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04C8D6D4E6; Fri, 10 Jun 2022 10:57:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mHdaGtKhS2F8DYwgoivCYKm9zJIA8PHB5itowYg/+/mWEYN3zn0LSW/NnGk9K0Afl7Oll2Ck6ApgtY3quvrXwuPQtPd5fBLjHAgwRWm+clOO3Syuz2yAVL0fPNo0VROO9EpifAXQFQu9sGykzp+pMA5cXpN5P+OGCgLlB3hw89HX6/OwnzfvyVcLJfPFv2l8FZL9gXcAXN7zmoxbRCaJLm6RfUdYcpqrx9omn9k+kMo5bUiosrVGPtH8+K30tTNGY6tTYkbHL+NiaS1RWsvrb0gw0CPbMOy0tKtGNEiUULmPDZRcxqgA1FPXmzQQjb7C6PgN+A5EzD3miiQVhTEYPg== 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=9x7kWRSNpD+mSE0GFZSzfzBcOugNaKgLSOz2TG7srtE=; b=hiHCjLa0tvlV0mD9iZViyI0dlWn3peqj/yZNsYumM+8XLtWZgk8iNpD/H4Aj1ZFsd0ORIqeq8HQ6Ee8oYOSJkvuQtvuKaEvX32g9XZJyygDkSpCp1T6nyrtQTKgyrBXqQ1p+VBPXP8ZLcjixmtYiHQsyWo5MK5P3mmpDX5StOExjqU6OXrG4Yfauw9NKObv7QLv0mEL4y7lOSIfrkdBCVOj1444JZOkj347vrD98LwvGiXjSaUdot6WD7cidTKHZYbbCq4Uyj0a34hqBOWSJfH4XWZJ6YUzFDQu/HDD8pNc4YOG0lMCRa57Rq7ZPXCg+jMvzdBnztLKNySso56JdwA== 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=9x7kWRSNpD+mSE0GFZSzfzBcOugNaKgLSOz2TG7srtE=; b=UVXz8bGfQf0/8G4ZlC4kuY6/4aGpyF3yIViE1v68LypOFlMFOjgAQj7bMYDaEgirQ/hfU073V90myKQ610FUR/V2QVby17P5sPDW6LsMsUyLQ9qky0f1i5UrNLYbGh4Jv078ooKpQsJc8mV6hmK+R3mxtQdZljAKIOBjAJcVecU= 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 DM6PR10MB3356.namprd10.prod.outlook.com (2603:10b6:5:1a9::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.15; Fri, 10 Jun 2022 17:57:06 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f%7]) with mapi id 15.20.5332.014; Fri, 10 Jun 2022 17:57:06 +0000 From: Colin Foster To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Vladimir Oltean , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , Steen Hegelund , UNGLinuxDriver@microchip.com, Linus Walleij , Wolfram Sang , Terry Bowman , Andy Shevchenko Subject: [PATCH v9 net-next 1/7] mfd: ocelot: add helper to get regmap from a resource Date: Fri, 10 Jun 2022 10:56:49 -0700 Message-Id: <20220610175655.776153-2-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610175655.776153-1-colin.foster@in-advantage.com> References: <20220610175655.776153-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0070.namprd19.prod.outlook.com (2603:10b6:300:94::32) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f3b09eeb-93ec-40b1-6b12-08da4b0aa182 X-MS-TrafficTypeDiagnostic: DM6PR10MB3356:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cvfdHP9s4SqwitoGJyhVi/S/u6LiT90tlmDx9lUTAReWWWrM/d12/Onh6MlRiiZQz1CQ56E3ew9WHFpXiZF3dHjPhfSydiCg7hsFZ2KzjDKF/B4erZSHe+zFFZNoRYwiS6+jFbGae/zGTC1ZNTQvGXXHQ4G0wzIaUpC1jY8I9YGL5yTR7qcfDnd6k4WFZVz3Vz5eOSKUiBokLm7FxJKB43s+L6RVReqRym8FR/qcVJMHYEVvbrXnFMBdKf7GHSnSb256IQhdyx9nH69zE4LetqGwXCr+9GIpxsKc8CR6BhVtyNVFXagy0SvqpALckSmTgzTwDOmqeWPn09yAo1lr67zGUAMrtNbGkUaRr5IjWmQb5zQPhOou4oXbb+N1tFlX3w/Ow3WhRq4L2h0pOSlmgQsWLWp3OlO8620s/aRCFoJIkcga9BUPqHAnAUdUlhby8mZU28ttl7q6P7TNysVjDcKPpdNufqSDA7MMf27At2hk4jHkVZLLx0Zp25F5nWhxGZfLwxgcdh2nWevF7o8Jm75a9NWggRLvQBmMWSHNC7+lLRdr+mGiDpDBqtPclExnUs6VEHpFkBGWmaVes0HAuqGG7Kz0oPya6JqXI8X1hpotG/Ym/8jsuLw1Sq/7Ultk+vHgoh6mfdrlW7HYJtLJyh6RbZEuBL2QiBWFCANJFZC4SKWt4AtZmRMO4eJyGz4X8nrbxTMzoR7rTF+vVsClNA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(346002)(366004)(396003)(136003)(39830400003)(1076003)(54906003)(316002)(4326008)(52116002)(8676002)(2616005)(86362001)(508600001)(6512007)(26005)(6506007)(6666004)(41300700001)(6486002)(186003)(83380400001)(2906002)(38350700002)(44832011)(8936002)(36756003)(38100700002)(66556008)(66946007)(66476007)(7416002)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WSCID2o9/FOzJ64AHTauRRdjPwPXpm8Ddiyyw0dZsGuRZbPtmIJtSYhIjkgHX40bTu/TVzRwaM6L6s0rIPv3jSvduevRIPX2Vj2DXmL387I7TsFezmKRZB5kKBTIwPWXnEb6KcM1YCQ3J3snLVwIwLzjbZQRIsK2ZGu/4Cr/9/Nd2gUAf3gTw4FI78x2z4IA6g3V1oqxCpxrGh+vZpoAxTqiJavPXCFcbYJ2yahjZnPsmAR0VpRlCZ3x7FjzS0Hm7YBqNDufLfnHHKo/8v1erTLGYhaDCApe3E+VmiVfIBv21VmnJ/Ed6T2fZ6lY5H6LZpqiEyeTXcemrDyPI2OKfJUQ+dMoq94f53H9jMm7fCS1PP7QAbeckHK6c4sClMbJYUEYZt30CFbOgtJV6p4XewrQcRzsU7jHu66SLfBFgg+/GUcy+O42MSDKm3gr6nwZ4AHxzDR/kK+5y/4sq/hh/g2/356maj7MdIYqUVklhPSYgURwq9N+KiL4jTHKOC3OEuOGu7g6cSTLrGiNtJdSawnNZqe1/LNE/BqpCJ6ehhWcnXP2RRntz/xfpecfuNsV2ZQNTi6lz7ZE01CbCVhZUvg41Wit76kenRVQlrkxWHz9MO2sQQUC/TG9ggWCoRFr2FnvMI2bCrpKOhyIqClWQm2nqZyQKPPs3lrfSUPU/F7aCLuY6PR7S8fsa3xxzPY0xXUZcB7D+u3rYCXoOpPUnWNYA+h7gbhJ4Vwh5Tyuykx1cbK7h0SCQFmJN2tWkg6wZGV0TZIUZdNrJKbcPMZshuaFzUuO5zZOAVKhFfyl9ZZMjHQvQprfjf9ldku7iTusgvxlUo6j7rOoqspbQtM9eM580wlVTb9npXutcv5cK8qJihZ1zzrC5xDYCjnopNgIOZjPlkA8FFGgo+QAB4kLFf6tTDIs02h0KJ3BHQIln9Vf6D/q4y7JJYZ0LS/o5u8Qo4ROgyrscB2ejLyzUCK8ixGyvtBegBNk9Hid6EifUNZbORBEnGw0Tw46fq8og12lb3/g7plkC3gchCX71ZrqlWbQV+3Ho3VPf9CE0PA5Eg2v0n/aalMYngb1BstYsk3+FalmEPkHDp2ASD28evjwhKeatHeVIYfprB9sm/cQEGLTjr4yV0mP7Io8jmohp8UpFRGaBZtZRaczMExczH/bFxFXoiKYvrm561Pq3rfLl6mjLwC/BGxYK0t+1iEN/I3dEdFnh7UiKEYUKPvHSKg1go8nQCCNW5hJIhaT//8CI5k/GY7azhOzOvLkvW3DdZfq5hE4Z/Dd6A2xg0VEHPdVQl10oXxMAbyDLaayfkJ+3MAeABjgbpittYd3cQPlJGZ6vHww9cxEi3Gn+fesGiSnhZPp/FT5SilPa6cLWZagHOWgxiwBPiUY1vBlMNxzq86q/EMpMC/ee3EhsUFzHIDfmP0A9UX1R+L+l9432sok7pfenG+5EY9vpU01S4FS0ppJ5sNfjUogkg8Hgj/teY+g+IHEXsH6lFXxeWsDQ8wfewqy5c4hnEMYnRnKNE10LP6BNq8Ywk+7TkwMP1mTfzwYW6EPsSp9XVlct7JrYZR/QSA+1hu6bhEgpuvbdyKvLcWtgE4wFKOSM7otCcSy1rHmgbVMchr1PiRtYBvBp+4ama9Tqhis0jcgPJppAKgFvbRCLj7Bv4u4sQh+eF1vOrZQBa+qLqw3BcVokk8w5bPmJUUgRCQKRdpsEV9Zw/8iok25knh7F418J2kzvzZyiOW6iyi1ylP46tA+XuO5lqBEthdjLStfHNQq1O5gVBjZU8xF X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3b09eeb-93ec-40b1-6b12-08da4b0aa182 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2022 17:57:06.0750 (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: Jcc6B59K0fECSVgDFA+hCr3ooNMxqj1IxNrBt5waAPRrzM6GG4Zq7CmNcozdRs+fXpC3eqvXkCBrDfK/Mwegnt1uAap9l12B049G07bK8oo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3356 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Several ocelot-related modules are designed for MMIO / regmaps. As such, they often use a combination of devm_platform_get_and_ioremap_resource and devm_regmap_init_mmio. Operating in an MFD might be different, in that it could be memory mapped, or it could be SPI, I2C... In these cases a fallback to use IORESOURCE_REG instead of IORESOURCE_MEM becomes necessary. When this happens, there's redundant logic that needs to be implemented in every driver. In order to avoid this redundancy, utilize a single function that, if the MFD scenario is enabled, will perform this fallback logic. Signed-off-by: Colin Foster --- MAINTAINERS | 5 +++++ include/linux/mfd/ocelot.h | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 include/linux/mfd/ocelot.h diff --git a/MAINTAINERS b/MAINTAINERS index 033a01b07f8f..91b4151c5ad1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14352,6 +14352,11 @@ F: net/dsa/tag_ocelot.c F: net/dsa/tag_ocelot_8021q.c F: tools/testing/selftests/drivers/net/ocelot/* +OCELOT EXTERNAL SWITCH CONTROL +M: Colin Foster +S: Supported +F: include/linux/mfd/ocelot.h + OCXL (Open Coherent Accelerator Processor Interface OpenCAPI) DRIVER M: Frederic Barrat M: Andrew Donnellan diff --git a/include/linux/mfd/ocelot.h b/include/linux/mfd/ocelot.h new file mode 100644 index 000000000000..40e775f1143f --- /dev/null +++ b/include/linux/mfd/ocelot.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* Copyright 2022 Innovative Advantage Inc. */ + +#include +#include +#include + +static inline void +ocelot_platform_init_regmap_from_resource(struct platform_device *pdev, + unsigned int index, + struct regmap **map, + struct resource **res, + const struct regmap_config *config); +{ + u32 __iomem *regs = + devm_platform_get_and_ioremap_resource(pdev, index, res); + + if (!IS_ERR(regs)) + *map = devm_regmap_init_mmio(&pdev->dev, regs, config); + else + *map = ERR_PTR(ENODEV); +} From patchwork Fri Jun 10 17:56:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12877870 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53E63CCA486 for ; Fri, 10 Jun 2022 17:57:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350254AbiFJR5S (ORCPT ); Fri, 10 Jun 2022 13:57:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349601AbiFJR5P (ORCPT ); Fri, 10 Jun 2022 13:57:15 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2121.outbound.protection.outlook.com [40.107.223.121]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0C8A7890F; Fri, 10 Jun 2022 10:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mvI3dZT8pGq9dzifhxpoKeTvZw3Jkl2NcqCHqaKksgs/MCc/dDD83/aMWRDNNK7iCL03iWHfNQ6tvXg4/yVCWWoaS9hAnGlox5wvyQmCkA+rNMYb2Hi5SP2r4YCt78+C0Zz2+ECkze1kGynTTZ4w5G2Xfnt7J+C5x5TrK6U5m029yD66DqZtenNFOGoUWf9dh/wtm6yYdGWmqH6cDuM3kTdccWrMt7kmE7M7iebOp8w51oNkLu2op9kUo0wmdyOMyQYKcKZKALxtD29JyUmThtpI7bTFVKWkFvBKTGJeCHOYyJUs07WuieaV83HRW1w54BQcpKRMlZyNHrA+6h88QQ== 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=e34s1zcWVZ7Jns/59LxiobrgeUjv+/YLeiuNdoxRi/o=; b=iXp5wy739kRbtmSo2WSGU+Oz7chLU+8H9ig7UJ9uBnMJR74UX/VV6G+2ochIY32NpsrG/UvSsTSUDv2rqZi945CaFlrvplhXQHz6kb27o0U0Bc1+wivlqkbVBQC5sRcDd4KUEFysVGC+fYj5+CGD5jihKHkAd8gN6FiYCrCk8qKeBFbn5BoetAm7QMt4L7JmceVG0QhAiZMv5bmcs8V6Ey6oYtf37+5Hka8EoTuxg2PHROjXd934hayxHyBSuboCZlb4DKMslc9Cz/tf0QcVgvBGFgTEqPXhUD1Ut4o/zvhoan+9xlxEHHgEs8Mg2kjHgfx0AGFL8UoDo9p7qc/AYA== 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=e34s1zcWVZ7Jns/59LxiobrgeUjv+/YLeiuNdoxRi/o=; b=kukaOP6BeZV/rIGOVcQHW25g/v4rGSONA+sZR3yCFtK5O0kbdoRNJX9zrZVhJK9Go0+oz6obKmsWdSHE4v97ghp6aXwms+ALx9Scp/tPrzaF20AF9lo+CkqzSzHVquGV4ruYBoPkmQk51gh2SWMpgZH6mSSDBYCGep5wuxktGZA= 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 DM6PR10MB3356.namprd10.prod.outlook.com (2603:10b6:5:1a9::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.15; Fri, 10 Jun 2022 17:57:07 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f%7]) with mapi id 15.20.5332.014; Fri, 10 Jun 2022 17:57:07 +0000 From: Colin Foster To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Vladimir Oltean , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , Steen Hegelund , UNGLinuxDriver@microchip.com, Linus Walleij , Wolfram Sang , Terry Bowman , Andy Shevchenko Subject: [PATCH v9 net-next 2/7] net: mdio: mscc-miim: add ability to be used in a non-mmio configuration Date: Fri, 10 Jun 2022 10:56:50 -0700 Message-Id: <20220610175655.776153-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610175655.776153-1-colin.foster@in-advantage.com> References: <20220610175655.776153-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0070.namprd19.prod.outlook.com (2603:10b6:300:94::32) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2470f541-d1a1-4cd9-25c4-08da4b0aa222 X-MS-TrafficTypeDiagnostic: DM6PR10MB3356:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IaoFepCuhMwSoX8AWIJAFzAlttPcByPHyraEbFxMr3uNt1D7WHxMBANN9qoGXcldc3/CoyA8oef+gGwuigdjLIa5bhTq6u3PbfmbsJTCBDd/NZJ8pR1bGq5BYaVhG7e6bWc8VwJhiNybekgp4TjKuXSCpaBJBnLElLl1ip/eP2NSGDPmpJ9GO/r09Ne0MEg20r4e+ZfWU+tlZnPlFx+fyqUgacjwQNTcoouHUdFi6T+FYUYB5gwU1LMky47fucLih0KyIuhbOmr1MPaCeQc17DSGklOM45ZKB/OZz3IeNcpUnnzFjKbcC+NyMXpB4KxgD3eaxJshbuWgQJcBc8LX4wgkoKv3zou+cqqLoRfyeF8qAsBCDgXjuxaqtx+TcoCTyKDozVS+UWnZEU0150V1wLt7a4dKn+lRMpYx8AmZzu8vUW4yImMwLqJXFEx2klyswA6vQx6mepWXcZhnpOevrNj7mtodxJZHPb5ZNxNjlftwHO7uNG0s3daKyCsE/uakHQO6ND7RXRP5lNe9MdyjDCMFjpiV9/DSfMMdBp0GpdsJO/AQUYM5S1VA3p6iV63YpZ4f3Ae859vVGz7CT0cJx6E0eZJTdqVuZZkkHtkqn/OftKsS9z1Vod1InuXALNwBWhYoTyPLxCxeKBvt4e6htIWogblqVNa1w5xn43VV3P5wz4+tkD0cRTaD5meYREq0PUItvsNXaEgiyVOsgGS15g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(346002)(366004)(396003)(136003)(39830400003)(1076003)(54906003)(316002)(4326008)(52116002)(8676002)(2616005)(86362001)(508600001)(6512007)(26005)(6506007)(6666004)(41300700001)(6486002)(186003)(83380400001)(2906002)(38350700002)(44832011)(8936002)(36756003)(38100700002)(66556008)(66946007)(66476007)(7416002)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Cv1p41x+uM//VTSOZEuM0Gwwa2qIYetBl9itSFzWXA2qfJNcauH/fOIjC+PZd/GFZqL4E/pK6IwhemR0NYsnAJNJQKcv22yGvu5T8uRwi7rr6+mJpz6DXz3o7eoGrbP2G7zmu97H2mExqXaegXU8R8DLBN7geWhP0K9BTgD9R6IhNfptTD92rA4tT0pCJJ8OspBVrmXqn7X5t70pdC1iY3pWMH8D4Hneb7N6bUt1I/aDnV2AHV+9CQUzTjOic4RbsGIK8//9zrvjA6UlxT8OG3BrF8EDIB/H7BFzPS3Z0SyruDVum8ttu3cu7F7FmRwoorPBv7ekeqrG+LS1iXzFyJM5aZ/iMJow15Bjth2hQOChPZ7NiA30LJ6o1kNklfOd2JAGueeJF/OPiO5p9UBy3aWoDgkQ852LjT/XK5aznbFfozklxZ7gd48MEfHADKfvbjfZaCACiFd5Rc89PYQvD5QfcyVYXLDTUbyZ5arPWAahvtclUNFzKCVA4mBz3IhzLyE9pxOhBSUfbFWCg969IeR3FAz6f/3V+zo4TXVzbKfkxyun7akIfJ2IXQzo8G6G2xVkCAyr3Ew9IEO4FMpSZs2ryT9psJCaZrccik5vcikgjJpKTBECHuJyWnqJU2FBYtR+bfslKm0nPmVg54qC/H7P5ARWVF8hmivQxQEZUX3UFtPv41iZ2Bh2d0JOfp/SZMGRjF2Onen5LF1fUPO4BHB3oIeXEpY8zdCWa7+KeezZAf719g4eZgMoxGsA04R1zlMI/TMFm3s4HvD8Z4PJ8sqQz03H6cvcLvrmzYfpl3m3E1q+E3nRZHWBAuMvmbenQZRe5OPIKkUPTNYeXoqKpcUF5tSIATuMssd3orTKFibJQoLs6pFJ9HOKzdb7SySqj1pwMdZoqgqMr16PKdPlpFtyRjBPsVpIdVJhA5bU72Af0jceNeB55LBv1obkXV3akZywryffAVEobUDSA0g4dt2jNAtW3GRzpWK+soASfnbw+D6tVzqB8tXURlf/gKcE6JZc4idw8jIFuWqky6LBlqj1tJrwOXMytwChbqnoeYwB56Ix40FrHOXKTkQ0y1oU/dvzBA8H0QaXzTZGkgqENkmKGmpvmNRTrvzN+shL1SeGeg0AbKMxq3sb7I6mfy6Kt5UZvPY8aFSTHr5m54k6UqrW+1vYajkxK86D+JdUBM08ktonLcSxTloDkVNyORViqsrXFYCC5H+WYVcjyWmwQ6dWz+Fh/E3h6czfQ/IxbstpDHq9qEZOH8GLl9WpYV29OLBZ8U8kwO+1Pw9LS+3EffgT0MM/kDdex9ZYS2qHNvzFLfsK2ZbQvN6ucNMntB1Sffu7avGI1begY2UlKCuHc2iP7ZUPVHLLeXg/yXmjBM1TZBhscQz6nNweCLK48CVjsVFqdjdq73dPNXNmnM71OBbm97PQsUxVlJWygAgIVMbhSEP1DYCpyr8+HgYENL4JMTioUeYngdL2q5pVMvBvGB+GpodnxqE1rWj7vROLLKSGu0l8a4ZpQuyI+rRNFWNsb2cOaFu37u29US2qXIilmK+WhdCk169YnwixuHheaTpJtlZKkkZFhsTcRWqym2chqLJU1yHcNqRZ1cdR/qQXPxM5bUmvZGKDUFiGs4Fnqw+8UnsVNi4Imn1ZtsIt8Rh9n/N0UlRQNA/OY1yTcQ3wgpuZ+RlKShggDtOZfRbb4GFm5/XBzlErN9++x8yXO7LovWu/uQ4pxWyZfWVZDbnDnsqh4lHtzNFCx6/F6F9ES8Y7A5vvn0Z3gXu8XvKF1oT2 X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2470f541-d1a1-4cd9-25c4-08da4b0aa222 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2022 17:57:07.1218 (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: W4927oz8y/doqkA1Qv9Ls85hhw/jWi0cBii387Fe6sp7o2tof1smNILAIXXTjOv8ps3+LMLSCr13K/he8iw5SNt9sGG2ePnrisksnpRAlfE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3356 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org There are a few Ocelot chips that contain the logic for this bus, but are controlled externally. Specifically the VSC7511, 7512, 7513, and 7514. In the externally controlled configurations these registers are not memory-mapped. Add support for these non-memory-mapped configurations. Signed-off-by: Colin Foster --- drivers/net/mdio/mdio-mscc-miim.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c index 08541007b18a..cd89a313cf82 100644 --- a/drivers/net/mdio/mdio-mscc-miim.c +++ b/drivers/net/mdio/mdio-mscc-miim.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -270,43 +271,31 @@ static int mscc_miim_clk_set(struct mii_bus *bus) static int mscc_miim_probe(struct platform_device *pdev) { - struct regmap *mii_regmap, *phy_regmap = NULL; struct device_node *np = pdev->dev.of_node; + struct regmap *mii_regmap, *phy_regmap; struct device *dev = &pdev->dev; - void __iomem *regs, *phy_regs; struct mscc_miim_dev *miim; struct resource *res; struct mii_bus *bus; int ret; - regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); - if (IS_ERR(regs)) { - dev_err(dev, "Unable to map MIIM registers\n"); - return PTR_ERR(regs); - } - - mii_regmap = devm_regmap_init_mmio(dev, regs, &mscc_miim_regmap_config); - + ocelot_platform_init_regmap_from_resource(pdev, 0, &mii_regmap, NULL, + &mscc_miim_regmap_config); if (IS_ERR(mii_regmap)) { dev_err(dev, "Unable to create MIIM regmap\n"); return PTR_ERR(mii_regmap); } /* This resource is optional */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + ocelot_platform_init_regmap_from_resource(pdev, 1, &phy_regmap, &res, + &mscc_miim_phy_regmap_config); if (res) { - phy_regs = devm_ioremap_resource(dev, res); - if (IS_ERR(phy_regs)) { - dev_err(dev, "Unable to map internal phy registers\n"); - return PTR_ERR(phy_regs); - } - - phy_regmap = devm_regmap_init_mmio(dev, phy_regs, - &mscc_miim_phy_regmap_config); if (IS_ERR(phy_regmap)) { dev_err(dev, "Unable to create phy register regmap\n"); return PTR_ERR(phy_regmap); } + } else { + phy_regmap = NULL; } ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0); From patchwork Fri Jun 10 17:56:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12877871 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69252CCA483 for ; Fri, 10 Jun 2022 17:57:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350273AbiFJR5V (ORCPT ); Fri, 10 Jun 2022 13:57:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347308AbiFJR5Q (ORCPT ); Fri, 10 Jun 2022 13:57:16 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2121.outbound.protection.outlook.com [40.107.223.121]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECB7C7CB36; Fri, 10 Jun 2022 10:57:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Si/vTeUvBNpeswT60AJCRgL354sCZZNzuVCLNt1fvdsTw6kNvObZAe31kgsVd4ewwHN8rYrIj9r1ZCuM8PqG0zYE40FoVFDUQt17o+LRS/RDbjN3KvdE62pgv3/W+sSkpcOZd8/Q9ZlgdVtXYet1qX8qAv6BYpsDm73mM7dPYC+3Vqk5+UeL/LiPp+xGP+OV9kflkRML8RarBbk16LyBH6AWYhltEsTOkx7hoHPcZDyAYcjbj34AOgKgRPbslveTk+4vpIiOy6O+bKXg93Ro3tZD+ACvMALUqDiGHOlz6mAc6NmSgSnTqcMEqntkWimOH1f0qkHtxPj6I6gB+/Guww== 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=iAdLj5PQta2TPxzuQkdcF5w3vYdR8cuUjFKNyQFjmPE=; b=b5CrrBLPrdjfJmZBH0dCESBTnFTghkzx9Em5KzjQGDXrnPbc6k2e0ZRqXhGCKhc3ojufxmQgPNaMqgbRD9bUxBYMt+GXphk0v9pyMlZ5vZPlMIWrUmbOuNneIrTzisDw2LnMmVbLPWFFdhlWy0SrCAJWjfX3DWtAZx8jVe3HYkE7zT0lpumHqG8H8mmZa0bJkySV18k9BcZNWn8NaYvssOVf3BT1el39Lq6wQU/qJZF7oeEABG/7jVTcbeLlrxcSuz0oLIyl2wu2ZpyB7JvP/XJoJ4VOiT+nLq6P5dHQ7ZAllxqAkQPWR3VyL+N4vwnWdxk67BUrUonfWpKLrvh75A== 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=iAdLj5PQta2TPxzuQkdcF5w3vYdR8cuUjFKNyQFjmPE=; b=BGC4UwrkSaORc2EdBW+xrZoB0zs+yfalrJnHajg7Z6IFw5KK9WdoLHks840BRSnKogStk309vc8CRP2H6EJQRrhBmf3/6Ur0aFgb/FbPS82juL+IHgdv24HHV/uOBp5PYR+xi+KvNwZC3ej8g6L3u00kU7LhbxKaHPUy31HZC6E= 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 DM6PR10MB3356.namprd10.prod.outlook.com (2603:10b6:5:1a9::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.15; Fri, 10 Jun 2022 17:57:08 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f%7]) with mapi id 15.20.5332.014; Fri, 10 Jun 2022 17:57:08 +0000 From: Colin Foster To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Vladimir Oltean , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , Steen Hegelund , UNGLinuxDriver@microchip.com, Linus Walleij , Wolfram Sang , Terry Bowman , Andy Shevchenko Subject: [PATCH v9 net-next 3/7] pinctrl: ocelot: add ability to be used in a non-mmio configuration Date: Fri, 10 Jun 2022 10:56:51 -0700 Message-Id: <20220610175655.776153-4-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610175655.776153-1-colin.foster@in-advantage.com> References: <20220610175655.776153-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0070.namprd19.prod.outlook.com (2603:10b6:300:94::32) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f595aa6d-b18b-4409-3252-08da4b0aa292 X-MS-TrafficTypeDiagnostic: DM6PR10MB3356:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WXmJfyzVfGPNp/DUELoEwyJJRz3IDlkAxbMkkFvZOnhALiJ1sfkAY/HxnwrX+6aCwsZRJQeUKNRw/Q7PzMrexn/sw3xLnW4hHLmV4kEVUjnrc5uQzI8VogitCVNvOWHR32Zg0YGSUdl8S5eriV/Wcp9FQNJHGy0SPeBbgUkRz4+IZIiRWa8nZ2+NNzC8MMVUR8YyweYE8WguoPciAfnnOg7xvQnQhvw0oIa4RQwF4QguOo2tskw0f4tiXAnXtkSe7L74DTp/7UxG6+RAJgUEhuwtT/38CLKs5RDyis7v1UrM9ohVE6iNGBA2M2Xw9iRfWHxkKTl6FG0c+0ldqNpl3p/WJ69eD2V+Vb7zflu41L1jg4T30eYcMMrWbCA1rcPBqAH4itTc22JVmadxC0ebZ6w+HxhAn3YY/OK6U0iuUYVlF9ZHK9rUi84DcSyrMvnKMc1wGIHDIbXZobC+Rse7yPYP3rdXMSzF76FbenUZ+cthPDzl57HFFCVoEFXuE9+D61g7UcWTnjN2OT75mbr1om4GZk/cbuLaFflf19bO1ZjBrA/yeR3WOL27iQ7HB6JNOuYZvS2ihbg0dooYo9Uj7mX6jh06REdDcCMk03xIy3wllIcW9IwRODyEYzkTeU+ZOGaLmxBwmVrHVtfMH2uKbJAypJFa+UXvDLp/HAGl2y1i2mwhdEFDiSpH2UUshu+XO0Bk7Lj1V6XHujEXEjgLzQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(346002)(366004)(396003)(136003)(39830400003)(1076003)(54906003)(316002)(4326008)(52116002)(8676002)(2616005)(86362001)(508600001)(6512007)(26005)(6506007)(6666004)(41300700001)(6486002)(186003)(83380400001)(2906002)(38350700002)(44832011)(8936002)(36756003)(38100700002)(66556008)(66946007)(66476007)(7416002)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SIMMwBvqdT9q+4RXMCAoemBNTqZwOKl21yKNqCZoZAgNVK0A83ihwaUy/RjblO03ERVZ38tvBL/5CjJEtIwwGcNCzSRJL9S0B/cC4gDQZVdURs6XqoqOS68ePL30gnP0Ao9HILB44Y1uLNRzBnaSWPA5Ld2FK3sR0PjD3EcDsM33dkimZfJYv3l/ZU4baiyq00+4anIJQcATjJf7y5s8D10wSHAjjRt0nUPjg8CvpCG2nxskG8KIPTJDLAe6F05NwwbuobX2XyadjB9tsXEuVH9pxH6i8rycpGuLBZZ2tEGSPskyuiHiyYkZZphoRaD77hzclpw6oreMvRJ4RG20FyR9GiAnPBXM6RKf7SFtoPAx94U0JojFO4ykdW3+t16E3WNbySMfeOoiYPWUn1nMltVwslF+3rE66brHSdF7c6dX7gZ0l93hXMKoP3WdR7iViMYDDfaop5zdz/ROx0jhZKxn3syT5xYNa75Zw5DOrLP3l0h2kkjdHgUNag9YnsT/HEccYvk67RREYht+H/anHp/gCeg+w0qRViyIxE4/p+/K86LQED3pIlo1S44XI7IEVhb/i/L39eEenISAgjXG0SaLQzhfre4GcoQv/bqzJvKJEERZOYtUvwuJptCGafOJEpP1ajqd4gVh1kXRCiMB6Ov40u1HahavA6GBwIFvPEUiqj5JB7UdNUsV0ja+DJ+kGfy7WgCFMQnEztZmQ4HB+evgVLfYOCW+OkrF1RFBgwIFjtlsfH89YFbDxfHqbPGWOjm4mTv8R7U4XFVkMntxaOQ2V7WVisWXtopd+Mxh9EzZFGlO9VXNgn2AiyLrAvL8KiORBtQ30vyNOzYdargdK5nQ61mZljBzq+308KU/L6xbwMOoLji/IqOIDhpT7KgFCrtAqBHbZsi7eRY/FRPy6F+bttviVsm8Mbhmmx0jBMIXMALxIG9whdenh7H4Gnwx4Bz8Pl3OEWx4qBC5UQKPjC6LODjIthztWxQE8zmS4v7dajesoVFJU3ceD4Q8cWIWcx/1VTOpf2ZMjoj/tzb9UnfO02ewLki/QMr+8qKnMsVOnRDeM2C3KWVb0I4M9qIdxS/zjucwrWAMESkMl4XZLwA3j8CIC8aEe2Lrhja+g2+HRNmKt9YGrk942GRrfhBW0/L4UFvAS9Y334aga9nb/LZyBdDuZGDT4FUX78Kdp3lAYTRbTREBLd1CUdlfKVreeR40CSd4eJDoJTEmY4wyHYpUDTVpJ5Ut+OCBAlfJgoELNpUxjRdM7NcOckX9lrGA4oVAZENeJCS+nj0OM2md0M58cwbBIp5K80fMwXkoqhx74tWh82UPEL5jsXgkXuy7Lygo3sdthsKVNjAIjbCapU64mtBQXGV8vkLjjnPPW8yO5kvBum6CYRNVflvHJpMyGYWk2udFrvilGBsVEW/yuwl05YZGhd1mPeFwbeERxvAEmo5QfkYOzUlKA2rBskv7QJw8GeRxL7RtB4Dq64Tsn6MPSAA+0CRAiRvLXLF4hXt9Q2YNYddDULty2n9lBhy78wme/Hw0ZxtVtmf6HJf7OQqslhdBflZYvaNipJW28v2DJMLEZ4Aq2Kuh4cORrJmK2NH4Xh8Cn6jCjKS7upVvVVK6L4fB6Io2pH0w9jGZzMqX0MRIUf0rEbRBNg6CxRcTSVLASHn2AzedwF0DqYp32HZx5FGnJ+S147hB7R+ioo0cnCvhrMb1fMyADRt1ZO0zEvVdBy5d5aonCkr8VBR6iA6+bKFaVYXb28nBTgytkPUPmp6qdb5fmkzFq8tn+zw6 X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: f595aa6d-b18b-4409-3252-08da4b0aa292 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2022 17:57:07.7623 (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: iVgGDqPGZVUEWxU91TUKSbHJOKp8LbdQ9j04AniN1tEVX+vrDEVfl3Q+u3OXlAh0NRzttzC0xOC3twHwVpwWCeZel2gNU6y0nrHMOKdsTJA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3356 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org There are a few Ocelot chips that contain pinctrl logic, but can be controlled externally. Specifically the VSC7511, 7512, 7513 and 7514. In the externally controlled configurations these registers are not memory-mapped. Add support for these non-memory-mapped configurations. Signed-off-by: Colin Foster --- drivers/pinctrl/pinctrl-ocelot.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index 5f4a8c5c6650..7ac12102120f 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -1917,7 +1918,6 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev) struct ocelot_pinctrl *info; struct reset_control *reset; struct regmap *pincfg; - void __iomem *base; int ret; struct regmap_config regmap_config = { .reg_bits = 32, @@ -1937,16 +1937,12 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev) "Failed to get reset\n"); reset_control_reset(reset); - 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; regmap_config.max_register = OCELOT_GPIO_SD_MAP * info->stride + 15 * 4; - info->map = devm_regmap_init_mmio(dev, base, ®map_config); + ocelot_platform_init_regmap_from_resource(pdev, 0, &info->map, NULL, + ®map_config); if (IS_ERR(info->map)) { dev_err(dev, "Failed to create regmap\n"); return PTR_ERR(info->map); From patchwork Fri Jun 10 17:56:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12877872 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 439FAC43334 for ; Fri, 10 Jun 2022 17:57:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347362AbiFJR5W (ORCPT ); Fri, 10 Jun 2022 13:57:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350243AbiFJR5R (ORCPT ); Fri, 10 Jun 2022 13:57:17 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2121.outbound.protection.outlook.com [40.107.223.121]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E999E9399C; Fri, 10 Jun 2022 10:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YoGWJqU8fcO3WbZbtVWc9Qdn8PLZNM6+NYJWoV+FnEGQTm2OFFrGcBKHPze4PEtEtz6hBRVSQttG/Aj9phq8W4fXIl3M8u/v7joEYbZF9/TUaorpjuBdBAoLYXXuc6IIxguNSIb1HMupPVajuFaWR54y6nDUFt7lTho0MdQT9i0XiPf3husVbEUgMscAPyMOb+fnoMFQMMvfiC0vu0dbMriwLvGPU85tHDHEOsb3VQWHyvS/Mjbm49KCZclwIWnDYwG9fePaiWayhXSH5F+wL6EDry0RaHcOku2WBMeZAUFL6vkK33Gc+uH+nep6fh8Q5N8KiHQCGZ/WM41z8Zj4BQ== 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=p6B4X2S6ByfrNayHTGMhOyw2kSy23jsOuPxVkk6Em5g=; b=aGA3PMZEH5Obnj1FUEnx/N6nkoIcPkZqg++2CuAjg8RtJDPUh96iVqbYtjOo7L6SQ8qGsBzfZrI+xaLW3fop8dPPtiqKsMKRhvO1rjqfh/e6nx380Zey4W4sBvKJ5TEEjKLLNbjUbLQpS+njn69VS4P5FZlQRXGuSmSbJx6MDZ/FWfjXsvO6oWql0F+NdHIh58CuTreKT/I67gzrRjtAkZH3wprT3hIAxYBxZ1IPcSxmnKGbVqT5v1G8xbp9tgGxuZd6ZYiS/wUVamTcRjWVWVnaAGgB5d6VNP2uSd5VWQX3MjVoMDskvuABuTVxNQ5JIcJ85q6Xz2bJZz7oyAZ7HA== 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=p6B4X2S6ByfrNayHTGMhOyw2kSy23jsOuPxVkk6Em5g=; b=UIuScHOstBdZ9PqoV0WdqXWLE0g3JapJqp89GJgAyXpXidRvCiW7oAagL6+NaDa7rmKGj7AX+VJPhWOL4k+IOMLqmx6BMoAONZe61/8WLS3IvBTiZ5+w0CZhXujgiDJAK0XqmAeVPwpmDbU1iJ47qOEs+XL/1TjJnNq5si1yxxc= 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 DM6PR10MB3356.namprd10.prod.outlook.com (2603:10b6:5:1a9::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.15; Fri, 10 Jun 2022 17:57:08 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f%7]) with mapi id 15.20.5332.014; Fri, 10 Jun 2022 17:57:08 +0000 From: Colin Foster To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Vladimir Oltean , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , Steen Hegelund , UNGLinuxDriver@microchip.com, Linus Walleij , Wolfram Sang , Terry Bowman , Andy Shevchenko Subject: [PATCH v9 net-next 4/7] pinctrl: microchip-sgpio: add ability to be used in a non-mmio configuration Date: Fri, 10 Jun 2022 10:56:52 -0700 Message-Id: <20220610175655.776153-5-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610175655.776153-1-colin.foster@in-advantage.com> References: <20220610175655.776153-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0070.namprd19.prod.outlook.com (2603:10b6:300:94::32) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 33cd7c9f-960e-471c-5336-08da4b0aa2f6 X-MS-TrafficTypeDiagnostic: DM6PR10MB3356:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MJw36KAeSgqSXE9yXxY9Wc/vT9jc1zKWpmfNVaJUghr17pFfNI1JTXWr4ZpqSNiDx7qzEpnVrrH5Y4h9mrNeutLmw6qNONSZwCxMBzESz6OLvOG45Ktno6JEoHwCXXuTYz92CMJZWsBDyShuLxFtuPn50fOQkhqPbf2YOVWgxVS2sYEKWpezUP8YVJnTESubPZTlRHjBspySsm8WrsuMn2qRb7EeM/xjuIK5ZHmcJ9YSCVaYi/oLVmiDbWr6I9wGDCOr7tfTklQ+wQtZBCbNKEXIWVx+KsAZ2yl8vbQz3EYrnkBPBJbrVY0yigBouqNHYOPWedyN0hjIKgvI4NlJ0sC5b0Z2Zkntbz1X1RfYIxyLusLGQpxN+eVEfPs+pz3p6w+n/Bns+woL6uJPq3j6a8eEvFyrOWXJ97ENE75gVEnpuE15ad8uFOLH5VHH+iFoCOP+o76jF6Nn6+oKVVgCkRcwkupG4QMsxP3T2mjL/Hqbtvknk9bysx7FwxZE/DKa8zkc2no1HpUSYLNsTQCCyZh2F5vATFj4QeFlmx4B89lnZIfFlVS/viUVkAJDPVJv6LP0zM3ecuKU/uKUbyhcN6vxpsDrKL0raHIZk5p0eAye2xugwcY7j8s0CZje1HXk6Va/9lNszvvwrQ0INuPUvA4FYdEBseK7BOIwonozzElybJxc5CTqPIsjvQFtiKn2YGR+fntErY9a0t4vYXyjQg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(346002)(366004)(396003)(136003)(39830400003)(1076003)(54906003)(316002)(4326008)(52116002)(8676002)(2616005)(86362001)(508600001)(6512007)(26005)(6506007)(6666004)(41300700001)(6486002)(186003)(83380400001)(2906002)(38350700002)(44832011)(8936002)(36756003)(38100700002)(66556008)(66946007)(66476007)(7416002)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NtKH7vyOR6OjMUT0bRzI9iRDUo7v7SFHSMF91ZapKL836Xn9ui/VHeuf1wQDE/XXcxgEGAu2lzQODVoKBFuE9AG9dfn35NsCf6++bRPMDrFsVz2xeZwjjlRc2a91UXAt7BTqj5zqUUY7vYN5bA7rYkUk5410188Z+d7dWltg1kgo7IKT3pWPlZi/VAkBfDfiSyxpFqa/fdhIsM4g0boiGnplF1YrKXYUjm3gVyG2UhKUgvbo+CL/wSU2SCVWzzRLR25VjJ4/0GsVIw6svKgDylfvQ5f9oWZHpBQiH2KN66Onl7CsMcK0yHMjM6qw/QI79K1JPQzTFo7XivBZo0tdtN3CXlNr3LP9iiMhkvTXxmu6Ki7Rf/YTT6srhx2Xqp9Jh3dfosNNYrGZbVTRnQ+xkpXUIu+Y4kSs1WIckvjrRqBnpst17fASOJmxPPgKirbZsxdsteya8tXcafxbQ8eF/tSJ9rgPi3IGEApbpjX4W703C09TTT8+ZSQjDMrBnN5wRvH0RJTtYYFdQWgIvLsxv8wPBD/UJnuyG3/prDE7wlNjKeN3jJBn74PP6aQwdyZRi6I2nEvYmCCWg37WhUsudVqoFzaxabV59WoeAvkSrxBHKoYHFVyNoKkCt3isLHazzwTA7E3d3jDOAAX2cwCJELlUdOXEeUa0QftJjWVJ8Ce7wLFYwX5o5rU9Q+OLs+3Xdv5xr8mYW+J9WpR3U+0TJnKU+bQutbj/SE/Xyy6cD5JUjxwqG3d/FGewjsDTTh/XeiWNtOIO9oHIvN1zuPnh4+09xR+0hhVZfbFaHoOckPN0jW9hFHorZqPxQKsFib1HeHETzf8lw8QtxGDvU5dseR4Krb0bdiq+nrWUYCbzNSUxF0Rbij/Y0YcUOrRdnExB9R4kDfaa07Nl9XFYex86JqoeRVPVhKdMUTOM1prMpTZVsh6sGfMf678mYpFZ3uRdqHJzYoPWikNdjqmn8t4IUabWLtJxHYJKiFdMAqxS0hhUfq/xSTTtsxhm9VmiF+9HLDOe1ZVDNX/mn1btQ4ufewNyDXG0rW5EUU81aexweh3D8rqGqcjMEo38VujhSYptz5iGAGF+WBfYoE/e65YrK3CD4oMASubKAjSlVtoyI+/1clLSgPqeiRaatVWczFJv+ccppTD1eiwo/EIaiHecIRCKDOkTQlQr6X6kEAzvgWr4zKix/Y49ysoOOHw7jbdxPF7Sen0q7uHC7tsmwZLHY3fheoHWt/eP7sCssaFYKhMwvZTNJJEI3o9UpVE++3l6XjdE7JJKhcQ+Lq08ukLFPvaoL6W0qO1bw+KVcJRBdwZIlQpEB9H2sq3Kyf/vI3HTDELKsC5awZ2di0yjBGtBe/zdY8SHsXOahYpQ4wejBOgQv4nKQwmzD3HIP5zIrR4YxFm/S9rGSvuLawRBP9o6WVukoYxZkQR5jR/cYJVG1KeKK1+Vr7UiHtOA7YXDglnAUmBpfmbBgOdU/+ciss8l65zrbm+Oan283oVtUiDiWCIF9wxPhqLn0ZF7VTfask7OT1NYlVdCAjzLYr9vdjfRhUeY+Cu6GaEpgGF/79bmkeVMGpxgp6ju/YF/jwhvelOZ/yKUBcGoLwolvTBODe0/+VvMJ9GyLRe8XYRzU2hRhVdHRsVaHkKhmgtmgB+kuo3somRgcncaJl8ue3dhwL8AkNWs8sMO42J5sHz3yB/6Gv+gUzX6DS0rgukLGf4yQ/uvAKFPpfywTowAX8LaJeFKOFWctoptW3hO6uiTDs9Krx0q0ggkWe9nz6eUw2rcy2VC X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33cd7c9f-960e-471c-5336-08da4b0aa2f6 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2022 17:57:08.4967 (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: 7yAc734C0BsIgdymLflxeJkCSHV2Q+mGNYpZYJ24fHIpIN/wwf9ukqqPaj8ODKbFK932l9YgG5jeIGft0OaHp63VwRYpt2WLSMcJErXItKk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3356 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org There are a few Ocelot chips that can contain SGPIO logic, but can be controlled externally. Specifically the VSC7511, 7512, 7513, and 7514. In the externally controlled configurations these registers are not memory-mapped. Add support for these non-memory-mapped configurations. Signed-off-by: Colin Foster --- drivers/pinctrl/pinctrl-microchip-sgpio.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index 6f55bf7d5e05..25fe57a0c26e 100644 --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -904,7 +905,6 @@ 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, @@ -937,11 +937,8 @@ 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); + ocelot_platform_init_regmap_from_resource(pdev, 0, &priv->regs, NULL, + ®map_config); if (IS_ERR(priv->regs)) return PTR_ERR(priv->regs); From patchwork Fri Jun 10 17:56:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12877873 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74A4EC433EF for ; Fri, 10 Jun 2022 17:57:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350257AbiFJR5X (ORCPT ); Fri, 10 Jun 2022 13:57:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350244AbiFJR5R (ORCPT ); Fri, 10 Jun 2022 13:57:17 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2121.outbound.protection.outlook.com [40.107.223.121]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBE946D94D; Fri, 10 Jun 2022 10:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TzVkVAc4IZujGrAsmY03znJQNHeo35z+V0o4/z/JmfBKnQpPtzj+X2jfJGdWV1A19uHJL6mWWM8+QxjkizU+2tTyiYzJzG/8YJlcY9rGgZea3iw3ykoknLloQPTVlZSxnJT8OzNx2jyIOitYlHKdYz9Pd8PMF1+CSf1nRtxAzkwuwFK/rBfC/YHwNPtoJnSQfXcoRrSnPdvlOEwFVTmZZjwTSk/s2HFlRxZ8FxuMuUt8CPdMlsKt6NHHchYpT8bFMyQAnWCA7aR+2T76ZOzRMffT2jzzA0egWYXddrKRTdv+s2/gOMiKGkJtDnn4MTAFDo6HLQHU757WaTG2FNUdEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dpcqD3YrPb8E3bZrxcGsy544jFxVoAUX4RKcmXtCjec=; b=Sy+pn5PcJV5WkOcryTmVmv1OmBPU3Nht9FAVExwrhgndgnmzxDxSUgfQPPLuR5rBlooA/DkE8A2WJrj8ZTrfyD1yGu2z484CXRIBaLNKmtcEBNJSNDBHkwrImmpQxXIWon44t9J140YKKra7ZMVFxXW7q2PLn4Kcz+mQMHmoiw6jGICDDI4TBAwI/dcUTNCroDBsZ60o6Ow0IaHWty4SnCTkBenG+TY1ZUhKC5wDLSCUSZ6fjmv4IpDE+YqmM/3tnmAg5ToTDFtgrxp56hJ4qukUju8JaJJfwGZc0iXtDhseZQK+pmRilcwShnX94LF2vpc6lHHA9xKnibgHrtieCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dpcqD3YrPb8E3bZrxcGsy544jFxVoAUX4RKcmXtCjec=; b=AIPPSuOaJVvFI9/Km0vYo6r65PD6uJ+dkk4BgNExqwXX6CWEii86Y0o/VvU5yE5Jvn8mfwZ7s0b6A2AdLkAxMjCu26/h01uY8Vn7i107GmNT6E+VYqxJiTkzggRFDZ3DGSJpRKqTBZ6krfdBi65orV48WHi/nPzgLgG1xs+Fbag= 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 DM6PR10MB3356.namprd10.prod.outlook.com (2603:10b6:5:1a9::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.15; Fri, 10 Jun 2022 17:57:09 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f%7]) with mapi id 15.20.5332.014; Fri, 10 Jun 2022 17:57:09 +0000 From: Colin Foster To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Vladimir Oltean , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , Steen Hegelund , UNGLinuxDriver@microchip.com, Linus Walleij , Wolfram Sang , Terry Bowman , Andy Shevchenko Subject: [PATCH v9 net-next 5/7] resource: add define macro for register address resources Date: Fri, 10 Jun 2022 10:56:53 -0700 Message-Id: <20220610175655.776153-6-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610175655.776153-1-colin.foster@in-advantage.com> References: <20220610175655.776153-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0070.namprd19.prod.outlook.com (2603:10b6:300:94::32) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b52fdbd1-8a34-437e-adab-08da4b0aa374 X-MS-TrafficTypeDiagnostic: DM6PR10MB3356:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZEfd8E+ZT7MKBxQHK1fSTtwRG7tmT6TJid+xPHw9JNXq1/IhAh5dzplNHYrlH+h5H6SbBR9PGP/Jnf4w5Dg0KCM4CMynTie38RLQJePESajcZs4Ij/zRQmo8G74HZqrEK2vpFxe4hrV7jbXzNBr8lHD1cfKjQbbucFdixpz93CO1L8Bh8G2t29pRxjlkWKB8TlJkqWpo3X8N0Pl99nbN660yT47d+SxQ6ECHVjMGvXEK2RyEazCgeAI1eYxeYPOpjqWxPvimGohpZAXzQsa8Z4OTK/Uo1DcsqNemxsyHb9/ZUFrHm5/TrZTH9h3pOQObLxUGD2MKaUz69tppMTTu2xNOHqVoJ31q0CMUA3XgetkecX7QwYuhesZHAxRbtfx5dKnIrajlSkYHwO2VCzXaDy5e5ty8SaynyZg5Q8gSzQvYPKe4DgaDT3aDNBzljagLzfQuZfLFSXARiS30jza+P/JyO9LWy8t2RiJv2P+4OVP9xz27qhCaDDUrQyE0i2fbHd/bqXKtnxgnvt1dtdD7MhOCtva5+eNQuQlkKfFk6I75SiVQtmU+mJGN866r0ZIjokcCwXhobVkX6Xa65eOnuVvNTMEftnMgpwNPuWU1VKxUGrgeOwk3MZHabDp1mjNGfjJ1cNId/MFwrH2Ltal4hMyjnbixsbFVuBk0s/HBoSAlwYD4KYmjCJTKZOkzRCU5BWCb6SWE1gOklnbDMLZ0NQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(346002)(366004)(396003)(136003)(39830400003)(1076003)(54906003)(316002)(4326008)(52116002)(8676002)(2616005)(86362001)(508600001)(6512007)(26005)(6506007)(6666004)(41300700001)(6486002)(186003)(2906002)(38350700002)(4744005)(44832011)(8936002)(36756003)(38100700002)(66556008)(66946007)(66476007)(7416002)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ewnyNBQWbjL7RXWZTS7jftgNSdbSqz5z7nakZt78aieWWwoRoLjFkMCuxKehVGiOz5CokbTQr0qIOB9fQ9arOE/kfMXE798L0jsywxUqoFvr6ayNs30yUPPVjT+ZcqNEvYTYJxfuhXtFwQvVgZmboh3PRVGQHq6vnIGOrO5c3OkiPAq3thrF4M9D2sVEq6s8+8WxGFF/C7XHIpKYYKEXhs7e0YrFX0HWWkPTc44eht45f5I59ZBBNaA/QBT3bt1R0xcUS8lfrh2KnrpDMQcdwR9ZsBspomYmLsyIKdyuSRTWfMa8y93fjqLk220HidKCpJP49AIqYd9IxI5o+9XvP7s1dD66veu1v2LDOFXIvIry9M6Uwepf6KSMk84/nOePW9ZsMjn7SE+JctzwTzVDKZwma7dmi18f92mMopw3F6zMhlM2Kfe/Uk1Ne1PYKCK4LgcUQBplz4Sj3uKJxKcdIutxKhOYECK77WravmHYJ9lKAv4g4QBzofZ7wTJoNJjxgP6MlM4cUYf+kAQf8ZaiJfUC5e1G85C5GxDxnad6xc5xJOly/9WwuOkXYijsZZeDsgz1qKqysjsRdGeFgWBDaGIFWLajg+2gSUAr/7i6k/4z9H5cc85NPL7OC7IY2zth6vAuV3CI5vrIM2yQbNsodeutaaHzXt66ZBseHOXa5Ws/rixnE8nKiU5+3z4vE7v5iWli8AlRDvvnISZ0nHF2ORVTfm6vDLgOWFLZr4hSUpfe2HvtL9rRYwJW0TrkVWPErXjNbrUvKpJGvbNeQBYUcD3UOqaqtOV6LLD3CMpbHDWUaF2jfIYjKOXWX+1+7WSDHNOXsNwarE4Je6meIVPWRe9tswGYXT9XZKnJFHK8ph0Qq6X/2VUowSCjXNSn70aNgcovGSeTcs1Jr3cL+wwm6dhBcUFhUEkjUwZYZMrLBr3me44P6iVX6NX9clj0xpkN+quv4seajH19XfrqelTrM2bN2jU4cGg/YDprTZUwa1jBgE8UpR+TpmuFv1L6QuPHL+aDrhzCkQJYbmgaDnSrtirdsSjLg/JFRmlwUM0FGnrfBa/x82yMvAz09FmCYRgWVeBbkJqE6xm6TPyHVEOui+XtIPa//bAoTexotQ1ClXZ7y9hb+anLay4UGc2tL9i4BUGRt1TJk8ghWHJXzF5nfjXKKhpQLLe7+fIAykerv2eeHI8J+6HeL18Z9vKHp8weZEl/RN99t6J/JAgO6vY2BKqlF/yABG9hKm1esj11ujGwpRFY+wyT5GwdWZHr/gVKy38SMfEdCECYQ2Fr8T3le9Lhs8kDnNkqQYxoyMRLN8mk61Tz/m4kykTStW6K6yP6v+nLSoMCEPKFS6H6h0tGueasb9QJSeidiiY4sEP8jwLRRTVQe1EtGou49TrU11L+ZwWfwEX5YYLPtI428t/ecrHf+cc/J5kzODT80y1sWQGHPS2yz1pqLVwiYD/AstkCrJcyMFT4F4/xUjdtmlKk/F540ESdNMu6F/xyYq2lR9/kMxaxgNqw7/4xJfzkIoyqRWfrznLBxFSZQ9AcIHDtiUjQI6H+Nra/BWDKaGzYDj/5EsuxReAx4jksW0gqKjnk4nRWZE2AAfHn3rA1zqz7xoWn3Dj9Tfn8Oqo0yRYggJy+D2x7za1jLKKwPl8WXfCUJ0V2Ulwl3krFECa3dcUDIXhQEDToxPPA9mpm+brhqCL3YakTA4Fw22whdcV7G9ZYBsROjQ7dJ6H/8yPLDySyHvjMwfW05pPCfGfRWOjLR/PAfnTTItp0vkUbyv/D5zmq X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: b52fdbd1-8a34-437e-adab-08da4b0aa374 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2022 17:57:09.2779 (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: UYl1sXsznaRiLJAG82XgJJKyJwYNAMNQXOzVGWso/Iie+PJXMHTSOv/r6Ya7ksoCJBocSILeJVfj6j+PHaGmtrbmJFY2OCqrx4Eg9LwZCNg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3356 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org DEFINE_RES_ macros have been created for the commonly used resource types, but not IORESOURCE_REG. Add the macro so it can be used in a similar manner to all other resource types. Signed-off-by: Colin Foster --- include/linux/ioport.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/ioport.h b/include/linux/ioport.h index ec5f71f7135b..f3b0e238c020 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -171,6 +171,11 @@ enum { #define DEFINE_RES_MEM(_start, _size) \ DEFINE_RES_MEM_NAMED((_start), (_size), NULL) +#define DEFINE_RES_REG_NAMED(_start, _size, _name) \ + DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_REG) +#define DEFINE_RES_REG(_start, _size) \ + DEFINE_RES_MEM_NAMED((_start), (_size), NULL) + #define DEFINE_RES_IRQ_NAMED(_irq, _name) \ DEFINE_RES_NAMED((_irq), 1, (_name), IORESOURCE_IRQ) #define DEFINE_RES_IRQ(_irq) \ From patchwork Fri Jun 10 17:56:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12877874 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 649E4CCA47D for ; Fri, 10 Jun 2022 17:57:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350294AbiFJR50 (ORCPT ); Fri, 10 Jun 2022 13:57:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350258AbiFJR5T (ORCPT ); Fri, 10 Jun 2022 13:57:19 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2121.outbound.protection.outlook.com [40.107.223.121]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6294044A0A; Fri, 10 Jun 2022 10:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=icYZK2alTjR6+MqOcfXf/hRB12JltMUJKg/8+rnYMdNEVZTgf/OCIoVSI91wWRUQGpudb2TKy2n3N6RxEmxNcOQTLB5GtuIYpj5eL6+KDGlCpKh5ZTNxtFHJUXsEyr28LWEnyidkhjV/MbVzASc9Hp/krmdGtem+mMqiv/OYtokBeLOBJLl0h8RFfMDdGf8Z9hn6ChALZGO72bBVXkV0KhUdAgznOK4gU9wKz8wSwoOncZgzxogk6ftZROnNXs7FvluPYw+utUVnfhHbhqNn4i6yfC05G+FfMBhmcGTkeDzGYLGwxv6vUb+6+ZJWGcZcjM2bSj+pMY0zWYtN1goGHQ== 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=0TxUElxae3D5rFWa+9Bc7GEjNNlZ/Nwh0pZeDVBhKjA=; b=ZTRqYMOhfo5JNHrGnQG0odJwGPar6XJCTb2HlgxniIh369uv4q8ziJBY5kOnmIZD4THT2Og4YoB47DjZuXuWpL3qiIx6Y6YagpefnPRSko7x4UaK7yceFQJdq4QdWfcuIiNsa9ezlSdNi93+XoFznKlPH+rJuGC9k+S3YcU+0MtjGaoAPUc/zcEzr9L+8cs86expX4YHvtNGrMMyJGQMMhMx903qluMdPylZ1h/6V1DbAv/bjQfMdF92z9fPQHlUrxrHTMuhMnjLiWNmbwf4zq6AFVQTOeSpT4aDQbl9HCYVWazhF1fFlPXM9XchEhTUuv3iw5tbxTxWSMyAtkdmeQ== 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=0TxUElxae3D5rFWa+9Bc7GEjNNlZ/Nwh0pZeDVBhKjA=; b=ZGoHZUItbCUHNrvjyl6mu0gq3sCdI2l7OlEFEAysK5CGj1ljrTcgyVUUEp/N6dEXPxESASShTOd58uC1uc8eH5MBWQtHN/2Pacpqunl7I1UlycBXy1KNMP7WLyezWq6V9i4j9tC1kdtfK9PYul5vKj62a5ZqB5z8Ik8iqPoEpPc= 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 DM6PR10MB3356.namprd10.prod.outlook.com (2603:10b6:5:1a9::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.15; Fri, 10 Jun 2022 17:57:10 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f%7]) with mapi id 15.20.5332.014; Fri, 10 Jun 2022 17:57:10 +0000 From: Colin Foster To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Vladimir Oltean , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , Steen Hegelund , UNGLinuxDriver@microchip.com, Linus Walleij , Wolfram Sang , Terry Bowman , Andy Shevchenko Subject: [PATCH v9 net-next 6/7] dt-bindings: mfd: ocelot: add bindings for VSC7512 Date: Fri, 10 Jun 2022 10:56:54 -0700 Message-Id: <20220610175655.776153-7-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610175655.776153-1-colin.foster@in-advantage.com> References: <20220610175655.776153-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0070.namprd19.prod.outlook.com (2603:10b6:300:94::32) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c15ccba7-07ad-45e8-07ef-08da4b0aa3f3 X-MS-TrafficTypeDiagnostic: DM6PR10MB3356:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cZkGWSdrytd0WUDHZDgtaVsZ8DXRlXQ4eBE+OZTNG1Vg7cxMB+jeaUV2hN4mZiQQUk/qd0GbHSn5JICm9McRAcs/o0Ct1Uzu4v0AyUbkY6hRbOwKJeP9JzPNHKB+JpBK1AG/ItVyN1WUo7E6Mb3wZZM0uyrWgZAbCbIHn/OVxFRCV1VXQTg65TOHFTuXcfb26gjuC3NLE1TK2W7eivr6c1Dc1vrQgOKhwWWd5blicbAxGdlSPloXd9AANa9La7cgUtnN8OlXcvVmb2aUIJhcxkzAC5sP8uhoemBtXNHPtCEAYbgtVGtH9HC03SO4vChrQHfJe59g1ZNaILRAjwXu3eMvedI0u7Uti3zp2b4CTsD4CK5GVZAykJhBpeg7QtRO0o8y/8epsiW0SssvbW7abdsjGml2+rsfOhAi5jzEH5q75vs0ho1lRIu1mWMCidxwtVUoDAJWHejtsIC9+h2JSdSVqcM4JsfuCQLM0+VPS81lfgY33WwnOzxCtjarjP5PGSDj+bmGjWsOy5TXQGe6cjf/mLUsCqWhWN2qKieuxjj76iXtJWyjO0vkT45va65LdMW/pNgy2An7/FK0AOJZ0ZVdf53chu4ITUqeIAWgHppvS2VJZnPnlTcTcNIcmJsCXPBgiTFbPOz7Gb4JCFGxdKAu7Rvx8HjIJE7gbZS0F6+gStIVdeldum3pyL10BiQKKtn1BlnG+ESW6Z5xp5TSXU2bCWgj+c6IV/oKeLGTuV3OXIzdOuYMDlVDhgrh0dS97EsVTTlY6HtYdqTFheYIB/NqO6hELezwwSJ4qTx1Juo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(346002)(366004)(396003)(136003)(39830400003)(1076003)(54906003)(316002)(4326008)(52116002)(8676002)(2616005)(86362001)(508600001)(966005)(6512007)(26005)(6506007)(6666004)(41300700001)(6486002)(186003)(83380400001)(2906002)(38350700002)(44832011)(8936002)(36756003)(38100700002)(66556008)(66946007)(66476007)(7416002)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GByXxcuJtZ4Om35pqpjErwcNAKck/Ca0Uu4Wf9QSbtll/Su2jqqpTX5tBVwaxZ+2/lXqgVKodCpYZ+GXX+t2SRZh+oD8UEPwX3kjdHDcCf972tjl7mvufsVt2/a+FYOvDFKrZ0WY9eH0cpO6lPg2m3+hOFPgik8HFwbYJB77OqfpWBVZZ8P0/Tig70BPXF78M1b6d3YYo5FMm1joZQbpcRta6YgOSEhk8myo9O3QjwxGL8aDwRRQbbsJKyB+AKkolxxI42se7VlxjhwD15/kk4zDfhk8O06CydDO5Hp4WUAAMAqt2UeirksaBrErR7xzhpJigvGoLNEwfrTyNxb2QvfeVo9VC7xF6W/iTGHKL0M/rWwELqsW5TkeE3wHuULjWcxqR+uh7FaQF8mZs0nPfBGf9reS0oY62wLNlxHNC0jVEQYL49ZmSuV6G2YcDHoid8xmxNzEtrP4t1fCGJnm7YMdbBGC80cZRO2YWF5UZLeunxfLqcBTjnGB5cJD1Thc/kK4L1z1M1FfgdgzZDK1ifzXv+m6bUnFr6GgRFJEId1mFWnXMfBdFE90fkUA1TEgmmyKa8ZNej8qy/ItHuwMLBD8zaqr+mmUuHA79+rgyqu6O32iEUFgbPioe0mw5iD2qRziGkIVzjgQqVZRS8VHv1RjtzR3vACw2wmh3ysWCFWAwdK8yYtpctFNPJpEgKAgBzGRa4RcHYGN2omj5bLPUQ5hgMRup+zsdRtO6c6zXEVhyY2PHfmqkidnnOlmdrkl38rpeFO94hWyF1lp77BMacbbdsXhWx1W6JqEZcjNLhe2i2YA1FsmHLuI4AYEBpcYArv24++8x1kFoMnExlPYpLC10sLyP+ZTxIq790g8YBhvq82VWyNjZOLKZNK1tZSjZSLZ2W58Ve0emeX4llxXtiUTm82QG1G88skinFyUKRTXVj96zBqS7JONK8EzXj0n79aoxwAh1U1g3MP8hRxCMKTuud783PkpBCMaMw1rcB8BmNfT/ec9BFxitJfTZME6cokNG4sPgCR0729O12A9rmBxPGdHG29wUMz2IeZCh/K/+IjHiGInAjNPEPfgxST4Jc4JVG3qShYfolQfzSxCjMTz2oCyWDSE/I8Mv/hbyuamfi9VrCs/JDHh6WcOmFO+eG3DWuyk73A22gA3RCpQYd0XSfaFUVn1ZPufPwkm0kZinf17ihsgoMQEB+bMhYqZ95bkFY0TUN9XKLF0qPRkjgT9VlvcTeUZbR2FANR7uVCgTPl+Yo2nmah/raCmrlJWbboE6Gj8MuIiejndER00pjcM4Bxg/zTRp7kb2uAjfiKGu5uHMz7HLs7H29/OD/iOaPEY7E9L4TkcOSrfv/1mEhWqfJnGwH5ISuQ3JJ0fhPep0HXKNbBfe//gB4ViwlJThZ61LLt/MDVnSy4CzU/BdQTsm2v8aCouNSHcN8e9OZygDPo7iTSX7MFl3wxUT8nOvP0qn6M0I4a7EZVD8H0ttgs4cIEz/tPqQEVlruSXaeX+uW/p7vRynRvZ4TNVWjQGw/zdeqizN4LetTxaqpsJ6YAGvSCuVzN+6+asgzJllEyhw81E4zjwbq/SXx7ifdFdSqEuOv/oGIHZLULIxy5Yf7iA51Mqk2Xeyt2PD1BbrPC6e1zu1QY9zXJSglbCIe8HxQwWO9SmiLPJALV10GnLq0e5OwwcVoKwGEptHmx3pxGXVGT6HNiGzWcW7ejX/mU6VwUI6fAVPmaVujjYQKAh+Kpmt7b9Se1Jl4WF9RnsoOXGGbY1M5aK8iyHDwk/WQsx X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: c15ccba7-07ad-45e8-07ef-08da4b0aa3f3 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2022 17:57:10.0747 (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: L/3Jf7s58mXRPB9qYRKPR4BIoUSQQLpzmFsY758CdoFIXRhGxvkigaZM4SAE+z96WwzoYmaIC+WOrXepFFor+CMB1srv7IpiF3SOTGMekD4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3356 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add devicetree bindings for SPI-controlled Ocelot chips, specifically the VSC7512. Signed-off-by: Colin Foster --- .../devicetree/bindings/mfd/mscc,ocelot.yaml | 160 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 161 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml diff --git a/Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml b/Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml new file mode 100644 index 000000000000..e298ca8d616d --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml @@ -0,0 +1,160 @@ +# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/mscc,ocelot.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Ocelot Externally-Controlled Ethernet Switch + +maintainers: + - Colin Foster + +description: | + The Ocelot ethernet switch family contains chips that have an internal CPU + (VSC7513, VSC7514) and chips that don't (VSC7511, VSC7512). All switches have + the option to be controlled externally, which is the purpose of this driver. + + The switch family is a multi-port networking switch that supports many + interfaces. Additionally, the device can perform pin control, MDIO buses, and + external GPIO expanders. + +properties: + compatible: + enum: + - mscc,vsc7512-spi + + reg: + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + spi-max-frequency: + maxItems: 1 + +patternProperties: + "^pinctrl@[0-9a-f]+$": + type: object + $ref: /schemas/pinctrl/mscc,ocelot-pinctrl.yaml + + "^gpio@[0-9a-f]+$": + type: object + $ref: /schemas/pinctrl/microchip,sparx5-sgpio.yaml + properties: + compatible: + enum: + - mscc,ocelot-sgpio + + "^mdio@[0-9a-f]+$": + type: object + $ref: /schemas/net/mscc,miim.yaml + properties: + compatible: + enum: + - mscc,ocelot-miim + +required: + - compatible + - reg + - '#address-cells' + - '#size-cells' + - spi-max-frequency + +additionalProperties: false + +examples: + - | + ocelot_clock: ocelot-clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <125000000>; + }; + + spi0 { + #address-cells = <1>; + #size-cells = <0>; + + ocelot-chip@0 { + compatible = "mscc,vsc7512-spi"; + spi-max-frequency = <2500000>; + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + mdio0: mdio@7107009c { + compatible = "mscc,ocelot-miim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x7107009c>; + + sw_phy0: ethernet-phy@0 { + reg = <0x0>; + }; + }; + + mdio1: mdio@710700c0 { + compatible = "mscc,ocelot-miim"; + pinctrl-names = "default"; + pinctrl-0 = <&miim1_pins>; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x710700c0>; + + sw_phy4: ethernet-phy@4 { + reg = <0x4>; + }; + }; + + gpio: pinctrl@71070034 { + compatible = "mscc,ocelot-pinctrl"; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&gpio 0 0 22>; + reg = <0x71070034>; + + sgpio_pins: sgpio-pins { + pins = "GPIO_0", "GPIO_1", "GPIO_2", "GPIO_3"; + function = "sg0"; + }; + + miim1_pins: miim1-pins { + pins = "GPIO_14", "GPIO_15"; + function = "miim"; + }; + }; + + sgpio: gpio@710700f8 { + compatible = "mscc,ocelot-sgpio"; + #address-cells = <1>; + #size-cells = <0>; + bus-frequency = <12500000>; + clocks = <&ocelot_clock>; + microchip,sgpio-port-ranges = <0 15>; + pinctrl-names = "default"; + pinctrl-0 = <&sgpio_pins>; + reg = <0x710700f8>; + + sgpio_in0: gpio@0 { + compatible = "microchip,sparx5-sgpio-bank"; + reg = <0>; + gpio-controller; + #gpio-cells = <3>; + ngpios = <64>; + }; + + sgpio_out1: gpio@1 { + compatible = "microchip,sparx5-sgpio-bank"; + reg = <1>; + gpio-controller; + #gpio-cells = <3>; + ngpios = <64>; + }; + }; + }; + }; + +... + diff --git a/MAINTAINERS b/MAINTAINERS index 91b4151c5ad1..119fb4207ba3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14355,6 +14355,7 @@ F: tools/testing/selftests/drivers/net/ocelot/* OCELOT EXTERNAL SWITCH CONTROL M: Colin Foster S: Supported +F: Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml F: include/linux/mfd/ocelot.h OCXL (Open Coherent Accelerator Processor Interface OpenCAPI) DRIVER From patchwork Fri Jun 10 17:56:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12877875 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94093C433EF for ; Fri, 10 Jun 2022 17:57:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350322AbiFJR5g (ORCPT ); Fri, 10 Jun 2022 13:57:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350284AbiFJR5W (ORCPT ); Fri, 10 Jun 2022 13:57:22 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2121.outbound.protection.outlook.com [40.107.223.121]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89FC59809A; Fri, 10 Jun 2022 10:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hl4hC4QYEvwVAqv/N/P4eDN7/iE0dasUdhXSZ3H4ptr+zizXmKAnUCzgTn/7DUJbims9X6O4Apq/1KcBogxL3jEGR67jEtsvbbwpZD7zhr0hODKFzmMx9iHL/xs8Tjy2NYybiZ3AuOr+JWYtQTsrhwKaMOond4bk/DlrQ2i8TYMO9wtqf9gNZ+PjGcxVmm7GoLzLqyX1fDWZprXaTaVsxEO7J9t2Cid1NDJ/J4EjiLxAclIbB4lP+97bA+uv3WvoOtroRGBmanXOKgIifNaBl3O7tQbXu1LPnWxzSgRKTa+l5URSwNA8Vk/4Mbe7hFwJyeQNKY9GFfcw3J26xqJasw== 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=ZgsmEn5X1X540pN5z6SjiYH4yk2icMj8bfBNOlVbn8o=; b=mb5+IDjdCJ6SQAb3hgfyaYuM1tb2ElmGJ8tEpr1pwOY7IRhqAf/aIeq6qvZyQbQipmjPknCqK5KQGxWx6iGsEsBLGDvAEGeT4b8J+0n+ywPwsZLnx2UC45JWi98KGBX7lnmv4t/GLmVtFtAAlFWe75g/mnPRBbl/TO5y1Rk2NY673RRgzBVYa0qYdZKDHE7dY20/hqKuZTK8+PW5J4woNkJYVk4d3I5DyzSBlLqaQw+Kvu4hzNSVn7CYSLX0e7EFPjRyT5GqZwKfxtCGYZUH1DifZhudsJIFc5TVW+UE7aeR4dmqxC5rXQDxedV683dPImQA19GhjRRqtWhbJjJr/Q== 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=ZgsmEn5X1X540pN5z6SjiYH4yk2icMj8bfBNOlVbn8o=; b=JAI6gKVT5TqwaEgOb81ZnAvAivDLiQFZsee6JSKQmeltzZ13mkQi0kyKhaLaMjrjzUtbSEj2b4yTEYJtQS+SQqcZLBc/nYLynH4Nq+Kz/Mn7neoACTPJ12Yh2GM0r7HfCE6ZY2ZQ/Jf5J3MgpYnrPWHzixIno4VmCwu0nK+oMTc= 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 DM6PR10MB3356.namprd10.prod.outlook.com (2603:10b6:5:1a9::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.15; Fri, 10 Jun 2022 17:57:11 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::b8c0:76a2:4c89:d10f%7]) with mapi id 15.20.5332.014; Fri, 10 Jun 2022 17:57:11 +0000 From: Colin Foster To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Vladimir Oltean , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , Steen Hegelund , UNGLinuxDriver@microchip.com, Linus Walleij , Wolfram Sang , Terry Bowman , Andy Shevchenko Subject: [PATCH v9 net-next 7/7] mfd: ocelot: add support for the vsc7512 chip via spi Date: Fri, 10 Jun 2022 10:56:55 -0700 Message-Id: <20220610175655.776153-8-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610175655.776153-1-colin.foster@in-advantage.com> References: <20220610175655.776153-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0070.namprd19.prod.outlook.com (2603:10b6:300:94::32) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b9ed76bf-9ed8-49a1-eb98-08da4b0aa47a X-MS-TrafficTypeDiagnostic: DM6PR10MB3356:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bp1OCMzTlK5OLfRPoh+eE0SpEDMwQQQC0/t6nQSXe1WbtE/DF5l5rC2ziFPV/wR/y/2n/XAavO8TYVhjNH9rPVz/Zmdd0/L9QYmlkgH3Kc36rMaWr6X4NWBrnMusXu4BVG+fMsurl2IWRc044Qhe5iGlrQGia7MQlxnJulcYToDfKcxU/OZsF92pAOw6GZQFwLLGC1CmhhOv3ZTiPDbuvnAQH+toyYcxI4TnEutUn/jr1ULW3knCLurGL8z9jTo0Rs3zYFjGw3kwVQOTUJmNB7ViTJ+VLpHVKyMzplWFfWxvx90exZtRXiKXW8bjq2x0pN0iNe4eowP6GPRs7Zrsgd8E//KWLde31GYjC+yqDt1928j2Q6PWDnQAlUJ863UC14aUf+TYGg7I7xIXkLFTzsPcmzyQzVbKcW2JU80fUWnicyKodhPxRIAXipyS0+9ImuBrSRbcUdZKCWNcI/tSSj6vfs1qog4iTAvMyOOCiuMA2rNqmfziY2/A5VH87BiFxTW2De5elcZzevbPvvUxs1XS/ZW4AuvA2iTMXG6CtkuTIElpCL6cvCo8b7wc9BF2bpH3YCUBXiCeU59LcMXgiQFuf0ZleHsHzYsSnL3su3f2OHq5RroYDQfoxJu6XjLynhUP8FziWoB7o4t6z3IKR7ESrT7drwp311e3QkT6tamVBkhKe8rJkHzeH4maeW30a1Wn3/cd9c/nNM3ZmE61Tw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(346002)(366004)(396003)(136003)(39830400003)(1076003)(54906003)(316002)(4326008)(52116002)(8676002)(2616005)(86362001)(508600001)(6512007)(26005)(6506007)(6666004)(41300700001)(6486002)(186003)(83380400001)(2906002)(38350700002)(44832011)(8936002)(36756003)(38100700002)(66556008)(66946007)(66476007)(7416002)(30864003)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jA/oM7TcdbPRmbgsPYfJcpQyBzf6/Rjj7JdmaVXeljwQhCgXot1XP9yGoQBvs+cKodFKTIAWB0KinNOeT/6b2F8stDikx0QEX5OiYg0oIFqCAt06rkqgQ0RPTMXX3ahy3r+kFyVKkMFuzVbS66KiR//8+nLyiDCWaRCD3RBSzW1qjR+yHba2Cqqcu+kIGAn20p+iPjnEXmFBPAokpov4RAv5K0msTrgkYoNPTRxqvuoMOmPeov3LI9TZvyORXqepCy55QXEB9UUFELFLf7i2qL7Nh+8pSUWgEPaA2775GOrwqU98Q0qa7amjePKwiOfr1zx/eIkFtYbLQbJQGmUZGSou6cQZpsWp8e9eAoIwNOpbCa878orpkocebYUleHrmj+CAyKekJYsAF5DKLFK2pFuhi2pFoItrRTHl9LmnMepXdii/wSkumLpsZoPnV01H2uETfpyMc9zGLwwymGSBTzpqRr4BeONCWZZ3yRikdS5cLvfplnK9d38LA1Nhq89K4V5NFyLqwZU/0DrzvBxy1G8/z7rwZa7y0fVpo5GtHTFy+aLWNqMSdPqzdTY9Pid0c0ML2GxkJxpxD/Y/UUiMXhWRmCah2RjE3CqjEJ1WuMyf0lomryEbRsUOjQYXN2mUarQp8E2vhIWOaaNCdNHpSM9sEEbwQcjssj84vfw3s2Tj7YYFaUS8nzFZ9lHseOz8uYn46Wu74ywDIl/DlivfEfHsN1PF+6PFSd7uv0KZQhVNPgLp4TUksVUlUdATOUc2ANGw6Jr6J4UNPbKdcXFSShUKVhnsPosR0ELQ4dL2y2otHWMJqeGr5O1efNFO8z4+Pv/B1GMfYA1oDRN8bizMP7hiCyrehUgKwRAbGSYJ+a1/pthsx0cefy6/bC5a++GX2aO0O7pOm/KK6V3e6SeJgU6COkHuRpX0crr5cOoTLBzo+mXxvRpg85GXjwr7NJ/WSTXCZuSqUd1SGpGijmLXJMomU63xx3A7aCUGAf3TsBWd+fzjTEtuTfVqEx5TmUxCZ3HCGnh1AZmS8vWfH5MwIt5TzxbJUtpf9R90lwZrsyeeCrzWuSqdS6X7GPFJgd/Dugeb8yvSg4E10gRW9wrTherjxDIn7QFelK0bjvf9zmdVLsPoszbYW2QkSkcHsyCheHeT5L36ZqUTlKsLoOVOKz/7wTRNQoGZsLcLTmoN+xJeb95SIVIsuA4kuC6oJXN71M2Yp1ZdaS4szney/1kmfwEMVff8LEZModUj1heIILhbdeY4K4+tsfDEkD4zWAWOF2/7mDVKexLFPCA0bdUzloA3wz4Chwq4D9P0J/0vushswBwFYvlaBRk8QaqIP6FIIuM1uDcvu2fznaLeIFXl4BdofvZ7CM+chQejzmNkelgqlRv4u2hpJ7OVNMxOueIXrZDPfbTw9XntuRPuJ65CuxeniSuHxFnYxVAQyzJUV/vVnbgnYUZuEj8QLDbRpgjIzvsrsHKLGrcRFTun4XQquUYfFYNnVQTQyJSItmGbQZo8EzMLKf3W/XHgJUSSgE3szpLVeRFWFzbSKZGx0fQZiksNTLMIb1Or9+W7cjxUcdcEjKReqMTa19hXwE3p2AgKt0cRTDCe3l8eo8dxQI6hWPzKFYXQsH+gC3bcRsCHUsAFLMt5An7nOUPvMje6edyVknFohL3HSGwEbJK/SrBeZByL0jDD3gQ/H/G3+3Vvy4i1CWSuN6md/xqKx812NwZ2cH4uq1CNhyNutk8wx1Be+u59Ec2Ov8K+w1GachkgqGjNwqxRA0Sfk4E31q3Jbc3n X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9ed76bf-9ed8-49a1-eb98-08da4b0aa47a X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2022 17:57:10.9652 (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: f9VZ29zLfVX3z7y2raJvyyvGHom50xsr8biHKx3v3bxxChNNnt4qTsxmPwCNBRx5Bpc74KGPtya2ZX5RBpKg+mHIWGoKiTiCpzwmF28w6qE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3356 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The VSC7512 is a networking chip that contains several peripherals. Many of these peripherals are currently supported by the VSC7513 and VSC7514 chips, but those run on an internal CPU. The VSC7512 lacks this CPU, and must be controlled externally. Utilize the existing drivers by referencing the chip as an MFD. Add support for the two MDIO buses, the internal phys, pinctrl, and serial GPIO. Signed-off-by: Colin Foster Reported-by: kernel test robot --- MAINTAINERS | 1 + drivers/mfd/Kconfig | 18 +++ drivers/mfd/Makefile | 2 + drivers/mfd/ocelot-core.c | 184 ++++++++++++++++++++++ drivers/mfd/ocelot-spi.c | 313 +++++++++++++++++++++++++++++++++++++ drivers/mfd/ocelot.h | 28 ++++ include/linux/mfd/ocelot.h | 10 ++ 7 files changed, 556 insertions(+) create mode 100644 drivers/mfd/ocelot-core.c create mode 100644 drivers/mfd/ocelot-spi.c create mode 100644 drivers/mfd/ocelot.h diff --git a/MAINTAINERS b/MAINTAINERS index 119fb4207ba3..d24ec7c591a6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14356,6 +14356,7 @@ OCELOT EXTERNAL SWITCH CONTROL M: Colin Foster S: Supported F: Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml +F: drivers/mfd/ocelot* F: include/linux/mfd/ocelot.h OCXL (Open Coherent Accelerator Processor Interface OpenCAPI) DRIVER diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 3b59456f5545..6887b513b3fb 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -962,6 +962,24 @@ config MFD_MENF21BMC This driver can also be built as a module. If so the module will be called menf21bmc. +config MFD_OCELOT + bool "Microsemi Ocelot External Control Support" + depends on SPI_MASTER + select MFD_CORE + select REGMAP_SPI + help + Ocelot is a family of networking chips that support multiple ethernet + and fibre interfaces. In addition to networking, they contain several + other functions, including pictrl, MDIO, and communication with + external chips. While some chips have an internal processor capable of + running an OS, others don't. All chips can be controlled externally + through different interfaces, including SPI, I2C, and PCIe. + + Say yes here to add support for Ocelot chips (VSC7511, VSC7512, + VSC7513, VSC7514) controlled externally. + + If unsure, say N. + config EZX_PCAP bool "Motorola EZXPCAP Support" depends on SPI_MASTER diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 858cacf659d6..bc517632ba5f 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -120,6 +120,8 @@ obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o obj-$(CONFIG_MFD_CORE) += mfd-core.o +obj-$(CONFIG_MFD_OCELOT) += ocelot-core.o ocelot-spi.o + obj-$(CONFIG_EZX_PCAP) += ezx-pcap.o obj-$(CONFIG_MFD_CPCAP) += motorola-cpcap.o diff --git a/drivers/mfd/ocelot-core.c b/drivers/mfd/ocelot-core.c new file mode 100644 index 000000000000..edc7698b6b1d --- /dev/null +++ b/drivers/mfd/ocelot-core.c @@ -0,0 +1,184 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Core driver for the Ocelot chip family. + * + * The VSC7511, 7512, 7513, and 7514 can be controlled internally via an + * on-chip MIPS processor, or externally via SPI, I2C, PCIe. This core driver is + * intended to be the bus-agnostic glue between, for example, the SPI bus and + * the child devices. + * + * Copyright 2021, 2022 Innovative Advantage Inc. + * + * Author: Colin Foster + */ + +#include +#include +#include +#include +#include + +#include "ocelot.h" + +#define GCB_SOFT_RST 0x0008 + +#define SOFT_CHIP_RST 0x1 + +#define VSC7512_MIIM0_RES_START 0x7107009c +#define VSC7512_MIIM0_RES_SIZE 0x24 + +#define VSC7512_MIIM1_RES_START 0x710700c0 +#define VSC7512_MIIM1_RES_SIZE 0x24 + +#define VSC7512_PHY_RES_START 0x710700f0 +#define VSC7512_PHY_RES_SIZE 0x4 + +#define VSC7512_GPIO_RES_START 0x71070034 +#define VSC7512_GPIO_RES_SIZE 0x6c + +#define VSC7512_SIO_CTRL_RES_START 0x710700f8 +#define VSC7512_SIO_CTRL_RES_SIZE 0x100 + +#define VSC7512_GCB_RST_SLEEP 100 +#define VSC7512_GCB_RST_TIMEOUT 100000 + +static int ocelot_gcb_chip_rst_status(struct ocelot_ddata *ddata) +{ + int val, err; + + err = regmap_read(ddata->gcb_regmap, GCB_SOFT_RST, &val); + if (err) + val = -1; + + return val; +} + +int ocelot_chip_reset(struct device *dev) +{ + struct ocelot_ddata *ddata = dev_get_drvdata(dev); + int ret, val; + + /* + * Reset the entire chip here to put it into a completely known state. + * Other drivers may want to reset their own subsystems. The register + * self-clears, so one write is all that is needed and wait for it to + * clear. + */ + ret = regmap_write(ddata->gcb_regmap, GCB_SOFT_RST, SOFT_CHIP_RST); + if (ret) + return ret; + + ret = readx_poll_timeout(ocelot_gcb_chip_rst_status, ddata, val, !val, + VSC7512_GCB_RST_SLEEP, + VSC7512_GCB_RST_TIMEOUT); + if (ret) + return dev_err_probe(ddata->dev, ret, "timeout: chip reset\n"); + + return 0; +} +EXPORT_SYMBOL_NS(ocelot_chip_reset, MFD_OCELOT); + +struct regmap *ocelot_init_regmap_from_resource(struct device *child, + const struct resource *res) +{ + struct device *dev = child->parent; + + return ocelot_spi_init_regmap(dev, child, res); +} +EXPORT_SYMBOL_NS(ocelot_init_regmap_from_resource, MFD_OCELOT); + +static const struct resource vsc7512_miim0_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_MIIM0_RES_START, VSC7512_MIIM0_RES_SIZE, + "gcb_miim0"), + DEFINE_RES_REG_NAMED(VSC7512_PHY_RES_START, VSC7512_PHY_RES_SIZE, + "gcb_phy"), +}; + +static const struct resource vsc7512_miim1_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_MIIM1_RES_START, VSC7512_MIIM1_RES_SIZE, + "gcb_miim1"), +}; + +static const struct resource vsc7512_pinctrl_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_GPIO_RES_START, VSC7512_GPIO_RES_SIZE, + "gcb_gpio"), +}; + +static const struct resource vsc7512_sgpio_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_SIO_CTRL_RES_START, + VSC7512_SIO_CTRL_RES_SIZE, + "gcb_sio"), +}; + +static const struct mfd_cell vsc7512_devs[] = { + { + .name = "ocelot-pinctrl", + .of_compatible = "mscc,ocelot-pinctrl", + .num_resources = ARRAY_SIZE(vsc7512_pinctrl_resources), + .resources = vsc7512_pinctrl_resources, + }, { + .name = "ocelot-sgpio", + .of_compatible = "mscc,ocelot-sgpio", + .num_resources = ARRAY_SIZE(vsc7512_sgpio_resources), + .resources = vsc7512_sgpio_resources, + }, { + .name = "ocelot-miim0", + .of_compatible = "mscc,ocelot-miim", + .of_reg = vsc7512_miim0_resources[0].start, + .use_of_reg = true, + .num_resources = ARRAY_SIZE(vsc7512_miim0_resources), + .resources = vsc7512_miim0_resources, + }, { + .name = "ocelot-miim1", + .of_compatible = "mscc,ocelot-miim", + .num_resources = ARRAY_SIZE(vsc7512_miim1_resources), + .of_reg = vsc7512_miim1_resources[0].start, + .use_of_reg = true, + .resources = vsc7512_miim1_resources, + }, +}; + +void +ocelot_platform_init_regmap_from_resource(struct platform_device *pdev, + unsigned int index, + struct regmap **map, + struct resource **res, + const struct regmap_config *config) +{ + struct device *dev = &pdev->dev; + struct resource *resource; + struct resource **pres; + u32 __iomem *regs; + + *map = ERR_PTR(ENODEV); + pres = res ? res : &resource; + + regs = devm_platform_get_and_ioremap_resource(pdev, index, res); + if (IS_ERR(regs)) { + /* + * Fall back to using IORESOURCE_REG, which is possible in an + * MFD configuration + */ + *pres = platform_get_resource(pdev, IORESOURCE_REG, index); + if (!*pres) { + dev_err_probe(dev, PTR_ERR(*pres), + "Failed to get resource\n"); + return; + } + + *map = ocelot_spi_init_regmap(dev->parent, dev, *pres); + } else { + *map = devm_regmap_init_mmio(dev, regs, config); + } +} + +int ocelot_core_init(struct device *dev) +{ + return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, vsc7512_devs, + ARRAY_SIZE(vsc7512_devs), NULL, 0, NULL); +} +EXPORT_SYMBOL_NS(ocelot_core_init, MFD_OCELOT); + +MODULE_DESCRIPTION("Externally Controlled Ocelot Chip Driver"); +MODULE_AUTHOR("Colin Foster "); +MODULE_LICENSE("GPL"); diff --git a/drivers/mfd/ocelot-spi.c b/drivers/mfd/ocelot-spi.c new file mode 100644 index 000000000000..e07dc1d040a8 --- /dev/null +++ b/drivers/mfd/ocelot-spi.c @@ -0,0 +1,313 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * SPI core driver for the Ocelot chip family. + * + * This driver will handle everything necessary to allow for communication over + * SPI to the VSC7511, VSC7512, VSC7513 and VSC7514 chips. The main functions + * are to prepare the chip's SPI interface for a specific bus speed, and a host + * processor's endianness. This will create and distribute regmaps for any + * children. + * + * Copyright 2021, 2022 Innovative Advantage Inc. + * + * Author: Colin Foster + */ + +#include +#include +#include +#include +#include + +#include + +#include "ocelot.h" + +#define DEV_CPUORG_IF_CTRL 0x0000 +#define DEV_CPUORG_IF_CFGSTAT 0x0004 + +#define CFGSTAT_IF_NUM_VCORE (0 << 24) +#define CFGSTAT_IF_NUM_VRAP (1 << 24) +#define CFGSTAT_IF_NUM_SI (2 << 24) +#define CFGSTAT_IF_NUM_MIIM (3 << 24) + +#define VSC7512_DEVCPU_ORG_RES_START 0x71000000 +#define VSC7512_DEVCPU_ORG_RES_SIZE 0x38 + +#define VSC7512_CHIP_REGS_RES_START 0x71070000 +#define VSC7512_CHIP_REGS_RES_SIZE 0x14 + +static const struct resource vsc7512_dev_cpuorg_resource = + DEFINE_RES_REG_NAMED(VSC7512_DEVCPU_ORG_RES_START, + VSC7512_DEVCPU_ORG_RES_SIZE, + "devcpu_org"); + +static const struct resource vsc7512_gcb_resource = + DEFINE_RES_REG_NAMED(VSC7512_CHIP_REGS_RES_START, + VSC7512_CHIP_REGS_RES_SIZE, + "devcpu_gcb_chip_regs"); + +static int ocelot_spi_initialize(struct device *dev) +{ + struct ocelot_ddata *ddata = dev_get_drvdata(dev); + u32 val, check; + int err; + + val = OCELOT_SPI_BYTE_ORDER; + + /* + * The SPI address must be big-endian, but we want the payload to match + * our CPU. These are two bits (0 and 1) but they're repeated such that + * the write from any configuration will be valid. The four + * configurations are: + * + * 0b00: little-endian, MSB first + * | 111111 | 22221111 | 33222222 | + * | 76543210 | 54321098 | 32109876 | 10987654 | + * + * 0b01: big-endian, MSB first + * | 33222222 | 22221111 | 111111 | | + * | 10987654 | 32109876 | 54321098 | 76543210 | + * + * 0b10: little-endian, LSB first + * | 111111 | 11112222 | 22222233 | + * | 01234567 | 89012345 | 67890123 | 45678901 | + * + * 0b11: big-endian, LSB first + * | 22222233 | 11112222 | 111111 | | + * | 45678901 | 67890123 | 89012345 | 01234567 | + */ + err = regmap_write(ddata->cpuorg_regmap, DEV_CPUORG_IF_CTRL, val); + if (err) + return err; + + /* + * Apply the number of padding bytes between a read request and the data + * payload. Some registers have access times of up to 1us, so if the + * first payload bit is shifted out too quickly, the read will fail. + */ + val = ddata->spi_padding_bytes; + err = regmap_write(ddata->cpuorg_regmap, DEV_CPUORG_IF_CFGSTAT, val); + if (err) + return err; + + /* + * After we write the interface configuration, read it back here. This + * will verify several different things. The first is that the number of + * padding bytes actually got written correctly. These are found in bits + * 0:3. + * + * The second is that bit 16 is cleared. Bit 16 is IF_CFGSTAT:IF_STAT, + * and will be set if the register access is too fast. This would be in + * the condition that the number of padding bytes is insufficient for + * the SPI bus frequency. + * + * The last check is for bits 31:24, which define the interface by which + * the registers are being accessed. Since we're accessing them via the + * serial interface, it must return IF_NUM_SI. + */ + check = val | CFGSTAT_IF_NUM_SI; + + err = regmap_read(ddata->cpuorg_regmap, DEV_CPUORG_IF_CFGSTAT, &val); + if (err) + return err; + + if (check != val) + return -ENODEV; + + return 0; +} + +static const struct regmap_config ocelot_spi_regmap_config = { + .reg_bits = 24, + .reg_stride = 4, + .reg_downshift = 2, + .val_bits = 32, + + .write_flag_mask = 0x80, + + .use_single_write = true, + .can_multi_write = false, + + .reg_format_endian = REGMAP_ENDIAN_BIG, + .val_format_endian = REGMAP_ENDIAN_NATIVE, +}; + +static int ocelot_spi_regmap_bus_read(void *context, + const void *reg, size_t reg_size, + void *val, size_t val_size) +{ + struct ocelot_ddata *ddata = context; + static const u8 dummy_buf[16] = {0}; + struct spi_transfer tx, padding, rx; + struct spi_device *spi = ddata->spi; + struct spi_message msg; + + spi = ddata->spi; + + spi_message_init(&msg); + + memset(&tx, 0, sizeof(tx)); + + tx.tx_buf = reg; + tx.len = reg_size; + + spi_message_add_tail(&tx, &msg); + + if (ddata->spi_padding_bytes) { + memset(&padding, 0, sizeof(padding)); + + padding.len = ddata->spi_padding_bytes; + padding.tx_buf = dummy_buf; + padding.dummy_data = 1; + + spi_message_add_tail(&padding, &msg); + } + + memset(&rx, 0, sizeof(rx)); + rx.rx_buf = val; + rx.len = val_size; + + spi_message_add_tail(&rx, &msg); + + return spi_sync(spi, &msg); +} + +static int ocelot_spi_regmap_bus_write(void *context, const void *data, + size_t count) +{ + struct ocelot_ddata *ddata = context; + struct spi_device *spi = ddata->spi; + + return spi_write(spi, data, count); +} + +static const struct regmap_bus ocelot_spi_regmap_bus = { + .write = ocelot_spi_regmap_bus_write, + .read = ocelot_spi_regmap_bus_read, +}; + +struct regmap * +ocelot_spi_init_regmap(struct device *dev, struct device *child, + const struct resource *res) +{ + struct ocelot_ddata *ddata = dev_get_drvdata(dev); + struct regmap_config regmap_config; + + memcpy(®map_config, &ocelot_spi_regmap_config, + sizeof(regmap_config)); + + regmap_config.name = res->name; + regmap_config.max_register = res->end - res->start; + regmap_config.reg_base = res->start; + + return devm_regmap_init(child, &ocelot_spi_regmap_bus, ddata, + ®map_config); +} + +static int ocelot_spi_probe(struct spi_device *spi) +{ + struct device *dev = &spi->dev; + struct ocelot_ddata *ddata; + struct regmap *r; + int err; + + ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + if (!ddata) + return -ENOMEM; + + ddata->dev = dev; + dev_set_drvdata(dev, ddata); + + if (spi->max_speed_hz <= 500000) { + ddata->spi_padding_bytes = 0; + } else { + /* + * Calculation taken from the manual for IF_CFGSTAT:IF_CFG. + * Register access time is 1us, so we need to configure and send + * out enough padding bytes between the read request and data + * transmission that lasts at least 1 microsecond. + */ + ddata->spi_padding_bytes = 1 + + (spi->max_speed_hz / 1000000 + 2) / 8; + } + + ddata->spi = spi; + + spi->bits_per_word = 8; + + err = spi_setup(spi); + if (err < 0) { + return dev_err_probe(&spi->dev, err, + "Error performing SPI setup\n"); + } + + r = ocelot_spi_init_regmap(dev, dev, &vsc7512_dev_cpuorg_resource); + if (IS_ERR(r)) + return PTR_ERR(r); + + ddata->cpuorg_regmap = r; + + r = ocelot_spi_init_regmap(dev, dev, &vsc7512_gcb_resource); + if (IS_ERR(r)) + return PTR_ERR(r); + + ddata->gcb_regmap = r; + + /* + * The chip must be set up for SPI before it gets initialized and reset. + * This must be done before calling init, and after a chip reset is + * performed. + */ + err = ocelot_spi_initialize(dev); + if (err) + return dev_err_probe(dev, err, "Error initializing SPI bus\n"); + + err = ocelot_chip_reset(dev); + if (err) + return dev_err_probe(dev, err, "Error resetting device\n"); + + /* + * A chip reset will clear the SPI configuration, so it needs to be done + * again before we can access any registers + */ + err = ocelot_spi_initialize(dev); + if (err) { + return dev_err_probe(dev, err, + "Error initializing SPI bus after reset\n"); + } + + err = ocelot_core_init(dev); + if (err < 0) { + return dev_err_probe(dev, err, + "Error initializing Ocelot core\n"); + return err; + } + + return 0; +} + +static const struct spi_device_id ocelot_spi_ids[] = { + { "vsc7512", 0 }, + { } +}; + +static const struct of_device_id ocelot_spi_of_match[] = { + { .compatible = "mscc,vsc7512-spi" }, + { } +}; +MODULE_DEVICE_TABLE(of, ocelot_spi_of_match); + +static struct spi_driver ocelot_spi_driver = { + .driver = { + .name = "ocelot_spi", + .of_match_table = ocelot_spi_of_match, + }, + .id_table = ocelot_spi_ids, + .probe = ocelot_spi_probe, +}; +module_spi_driver(ocelot_spi_driver); + +MODULE_DESCRIPTION("SPI Controlled Ocelot Chip Driver"); +MODULE_AUTHOR("Colin Foster "); +MODULE_LICENSE("Dual MIT/GPL"); diff --git a/drivers/mfd/ocelot.h b/drivers/mfd/ocelot.h new file mode 100644 index 000000000000..cf33c3ab89c2 --- /dev/null +++ b/drivers/mfd/ocelot.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* Copyright 2021, 2022 Innovative Advantage Inc. */ + +#include + +struct ocelot_ddata { + struct device *dev; + struct regmap *gcb_regmap; + struct regmap *cpuorg_regmap; + int spi_padding_bytes; + struct spi_device *spi; +}; + +int ocelot_chip_reset(struct device *dev); +int ocelot_core_init(struct device *dev); + +/* SPI-specific routines that won't be necessary for other interfaces */ +struct regmap *ocelot_spi_init_regmap(struct device *dev, struct device *child, + const struct resource *res); + +#define OCELOT_SPI_BYTE_ORDER_LE 0x00000000 +#define OCELOT_SPI_BYTE_ORDER_BE 0x81818181 + +#ifdef __LITTLE_ENDIAN +#define OCELOT_SPI_BYTE_ORDER OCELOT_SPI_BYTE_ORDER_LE +#else +#define OCELOT_SPI_BYTE_ORDER OCELOT_SPI_BYTE_ORDER_BE +#endif diff --git a/include/linux/mfd/ocelot.h b/include/linux/mfd/ocelot.h index 40e775f1143f..624879e89f5a 100644 --- a/include/linux/mfd/ocelot.h +++ b/include/linux/mfd/ocelot.h @@ -2,9 +2,18 @@ /* Copyright 2022 Innovative Advantage Inc. */ #include +#include #include #include +#if IS_ENABLED(CONFIG_MFD_OCELOT) +void +ocelot_platform_init_regmap_from_resource(struct platform_device *pdev, + unsigned int index, + struct regmap **map, + struct resource **res, + const struct regmap_config *config); +#else static inline void ocelot_platform_init_regmap_from_resource(struct platform_device *pdev, unsigned int index, @@ -20,3 +29,4 @@ ocelot_platform_init_regmap_from_resource(struct platform_device *pdev, else *map = ERR_PTR(ENODEV); } +#endif