From patchwork Mon Sep 5 16:21:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12966409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B8E90ECAAD5 for ; Mon, 5 Sep 2022 18:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=E9GyjQwZzMv8svE+ZBLy/oA2jctolS2k8o8m6vnQGv4=; b=wy299ke2YVVfV0 pdpD5TUJFZfsbU8nqS9stQcfYgUsomfPpEciv1+13p1j5RSAyYVCITPlUlLTnC+YDCkF3C5RUqnLM +2gOPxaTbIpVfaUL5kDhAc+2npJWiDbIgwWgscwkpIGL7IKdlt16z0mD608CmEhjvP+t5sAOzGHTU U5ICxeljMa1eacOu1bBNltKBvvjkm9HMREWqDZiLeD3FAJconmu7rWfBYgJu2TTycR1OGJJXayrHx UAqo3Ynl3KTmkbBYkfir3SwV5QctgDhfwqnYYB3PT+g4O0ZmiK14AKi7tK5PCI3KAryniF0FcYXtC /VZHkqs9TSfgM8bPb54g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVGrT-008QxC-Mk; Mon, 05 Sep 2022 18:30:21 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVF1K-006tPd-8m for linux-arm-kernel@bombadil.infradead.org; Mon, 05 Sep 2022 16:32:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=Gb+PD0ps/NW6gcSs2B7caK5rMMUizct8apoO41vF6h0=; b=M8n/uqYSC2VkOyxwaavJKHi7W7 u/3ZgV1oNWCfr5bY/C1+V9AovKjS46bAHWnTzYm71OXcCtC2hzYbtv36pA0N7xMhNsEqFbelbl1PK OS7RjcYEEM84AN27xcO1P+YOalu3RJmkOWkrmIgWKK37ilhgz3HCBduKg5mrB+x2NvjS4EIqkb8e0 SaOT022zEPqsO1Ls7UCxID0wMBG3sKKZK3Dk1TZMl/JtsVfwQrzJLVA1YxJFovciqNYYlMdqm4Drg aSQ7k3sZS/hTzOKWWOILf/Bp022RAGbZlHKnu92Bty20Da6F70/rJU9i66JEd/ipiAzmBKjaWRmTA 3TbiTq3Q==; Received: from mail-dm6nam04on2106.outbound.protection.outlook.com ([40.107.102.106] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVErE-009oh0-B6 for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2022 16:21:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c26rogmFsezdLDJxOcVMfYmddq6cFOi+8wBD/omyCrEo1ccyf39ol3g5omYgw3G1NuPwbGz6ZvV1rmj7yYKWerRTDIygD1QaPBPVw/H/lEq4FWeA20L34xXAN1q2/aoltIHNlGSP1VB9fKji9Td+fL2UXDxIAhHzBK+dyVwBtpFaZZHW+orVaJaIs3iOKJ14bZ7n67RTO6QdQXUDTWt1kb9rwaeWuJ4yBOKqFeOkLH7MWrZPyYkGWJL8JDuinB12zv6oBwNhAlaGGZfL728zPgDBuZdSoLsBxNcACcbCagvTQXNDgENi+hdbZEzVDubEZpCga1GfmAS7T6B2KYzEyw== 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=Gb+PD0ps/NW6gcSs2B7caK5rMMUizct8apoO41vF6h0=; b=fYnaaqQn9GR3vha1RrO1fmCjn+LyETul32JZ/gb43x5hkBBGJr6dAHHafUPxATajET7IBqK6imWwkmEU15KjjZRjTC7IHHYKo8p+i6Kiul+7s12P6O60VZkb3/Gks4qnTirV8oSUr9CgvebJngQin16h4DgkW5tbSQr0YZR8LavRN/Yc8ud8NqfFso4kPZQN9MIFLCHrlEU4CiND+uYcQ5yBdc3OnWYfmZwxd2o3duMc9E2vTtZZsDVGjYwsVBWIcifajTwyUQNtgbUhEvu0reOKKSUFOdc3D9OzMuNxW8zJEhGRcF7APBbvneebtDcCkf0p/SRoicZXw2PCsibdaw== 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=Gb+PD0ps/NW6gcSs2B7caK5rMMUizct8apoO41vF6h0=; b=dtuPBu9ifqEk4tidmwJtIa3nikei/XjHuelOECtwZySSQwibhgfUIUzcKKIfk4QzJFc/1H3C0HPvtSH39NAGCz1Iazpu8m8PBebR9cgPLaQeIucb2wnV0CoyKi8fL5KloL+x8zJIDhvqm3Cz2uhhm2YBRDi2BBZJM17sLOaw6lw= 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 PH0PR10MB5848.namprd10.prod.outlook.com (2603:10b6:510:149::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Mon, 5 Sep 2022 16:21:51 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1%7]) with mapi id 15.20.5588.012; Mon, 5 Sep 2022 16:21:51 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Terry Bowman , Vladimir Oltean , Greg Kroah-Hartman , Andy Shevchenko , Dan Williams , Jonathan Cameron , UNGLinuxDriver@microchip.com, Steen Hegelund , Lars Povlsen , Linus Walleij , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Russell King , Heiner Kallweit , Andrew Lunn , Krzysztof Kozlowski , Rob Herring , Lee Jones , katie.morris@in-advantage.com Subject: [RESEND PATCH v16 mfd 1/8] mfd: ocelot: add helper to get regmap from a resource Date: Mon, 5 Sep 2022 09:21:25 -0700 Message-Id: <20220905162132.2943088-2-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905162132.2943088-1-colin.foster@in-advantage.com> References: <20220905162132.2943088-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0263.namprd04.prod.outlook.com (2603:10b6:303:88::28) 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: 17508503-d35e-4aad-94b2-08da8f5abd13 X-MS-TrafficTypeDiagnostic: PH0PR10MB5848:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D+ZvjOlXzyrYsrHbdOjX3FCTGT3AKrfTiXnkl85A3qaDe/9NGR+eMj4NWqEi5t0WOK/KProfZ5LchAQbecu3nXG1bx5Fdi7xowLwV3EdCiGoWs8I70YZVUG2YohI72tVDw0hV90IolrQ6VF9co86yv5e3tIdqFmjeDbm49cFCVZP6MqaSZvqHR167Y8I6eQkMIY9KZSItjNJHzs9nYsd6CJcACibFzoaynuOCix2KYeY7k2prVGpqp6orSLXmvAi19bHnUnYN4XxTvBgv9YlIJryu5iL/02856WTJJJg7lFHtoI2/zpdC3mw5gqeYRW6w4TQ+jJH+qHH9yoL0PQx2DQCryeUnnuV7TwJIgNlqzVRoczMDzlZ/y66QcWk+4boFElIazELH86YqYc72DCR7o1KknS0ydW3ccHpJbzWlPljAC1Gw2aHSED2XKvyL4T7vvdg1PdEgNnVsF1tSC4A+86rIFgZ3Wpqnubs+rz6E64oG+/JXKDzDpaXP8p6k1VpBicdXvU4MKdiQyHj9oJIYz0H64fjHjzYkfdBTlaWdYN45Hd5KkTNU2C+0ERQTfRPEghVWJHFJKfT+EvvWFIWryTffoSakb8YYqPXWsIgqbNNWTevAAcpgmKFOW3f5o1kXAfc3C66SmuvfiIw5NGVeA8NL7Zj+DY6USf7DUz49wa3LlT2EPJcg/SiTsLZh+25yzjM4V2TF0Lrw3hDKJLq65FdvvLNoYOtx2+jODdQomEs59pqBoi1iRf+iJIuhzU3dG3l45g/BHEczO1yIpy/sQ== 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:(13230016)(396003)(346002)(376002)(39830400003)(136003)(366004)(66946007)(5660300002)(8936002)(66556008)(54906003)(6486002)(41300700001)(6666004)(107886003)(52116002)(186003)(2906002)(1076003)(7416002)(2616005)(44832011)(6512007)(36756003)(6506007)(316002)(83380400001)(26005)(38350700002)(38100700002)(4326008)(86362001)(66476007)(8676002)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iRWo1mt8S3mQX/n4phuit9rm68ESZwi7QM1eoI9Oct5e9Xx8lvETK4/UpEXY/7AbuBZVcqtVqv5uvHxVaJyF80E4EXD3DZnkPsb6GEFV0IfvsuT8yj2zByoLG//jGogUrPfCaPIMC/cqWKGPo0mOVdw4HxJE+TgLayPTzMfsWfLTtxjPmYxlbmRK+ceikTU2VBivj8ydEk0eolH/GUJx+CDOeRyFOYbXTdYyXtSd0Fg87Oxzj/uF1cRr24P4yHJk4voe4h8iYxxRYltm+c7U4eGD7ym5F8xbo07lZM9sY5rfoTYCGW0a5+Y85RdvEBu7ux6VELMPXsiJIAcw4rw1VkAlPp/xEniGHxRJO5TvE3ZbCvNitfs6bLJK0bmgWH8MBqK6IboBsE+rWNtrQCHQKJbaK4u9+hTXED+oOd1W+qAOD3yJpvcvBzcjUyaiisK8kKpqWn8jMMqhmGYlaCoCsolIrXK0MqmtKwM9Pa5QEbkCbqAQrj+EUMdkQziOPfaDM/tk8ncS5nUAjxGkSLmsKlbTFILCeJ4nsFWtsj/VEhHcveB/K5Xx9Rm964aMlBnc/4BHj/+o19XVe/6/l7GPDwGvVrk8jBx3Q1Uw52iExi5fkIZlMsMgFNwGYKduZV+KNTUty/J2CPi+zlxcT7gznnEhlnF9g4aLT6mSOiMy7nfQ9YoYYFA2v6nn94+EhoWjhZazOMQCPoV5P5W48Rlp4tGb6i9Q11N6cYPJqtBvGVZJJvuZ7vGTVaTws4AxqL3fYlg4t0xYbQnbSVe8GPc4mFkihGEtrfFNNL+hzGr7+oX/9iNxz3EnjhgmtqvZIGlkMlxfuNPWTem8yn100DLZ4kVk1n7jt0V6IHtLyk7By2GwP3UP1gPLmgTjPM5amWZz66y0nEAgaM3WygKhqqi5B2W8/IkTFktCVCRYN3s41CO8vMUEiSlefJZ8hxrsdQGk68IbNrC9bJ6iCGLPACNJY5f9N51gg24dtem1dbRBtxsiSh4zxZPhg9exoBfu4yByr5y+bqbLYVsadC8jpb07kZTFZ9qZU2NTzxUsu/ACTwXZoSAh93KU4fQq2y3twZm16BsiUxfEaMOHZwvkwsJPKXhq8ZD9/jCaoSEMxXS0CA8PV+ALQH8gr2yBKMgWv4Zt72WQc3gAZ1kyo6yH/0W3swBgbFu0m2InUXoA2y9xPhUhw2+I+YbFehRJZkQ3xqkPUc3rj99ZKsQgTy30dOS87sz4wHA+v/qeyjfHeUwkNFJKysGtS8vbqLw9QrmjupuShMk9WeV0Mji13E3iyGKckCl+rXWHFkE8psthzFKinNtyqCyX7MfVgju3HVldRR0zw9RO3BavhHZj3P4KPowhMWTLzoyk1gS7LcgYbAQFIEJgYGP1ZKzXnreIofmQjIvHzPC6WENg52xedhasKG7D5XrvIAjggu7+i70NTphTq41Omh73+6hOagvOZdjnC08MW53xHvUPLb3xtEnky5TuEbt+Vu/ZgI9vwDdGYBwtCG+BgnJLL/Oyc1cCIg6sRHH47ANiTn7dLuC6wEFpgwMwZVYhH8YxwAvlyXq1N2k4HxBJlxPjTBj5TTj/Ptw6W+GLSLPjeX5TlaX/OeurQBqnTA== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17508503-d35e-4aad-94b2-08da8f5abd13 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2022 16:21:50.9914 (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: 9K1ao+pKdEVFG3ToghZeyJ5jvIDrbg4o/zQlsnPpfPQvcXyQ/tag5144BVysp6HVO+wMKvibLvop15HbK767H4EF16ntVOq8uN0cj1H96Oc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5848 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_172156_738260_6FF64FC5 X-CRM114-Status: GOOD ( 21.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Vladimir Oltean Reviewed-by: Andy Shevchenko --- v16 * Add Andy Reviewed-by tag v15 * Add missed errno.h and ioport.h includes * Add () to function references in both the commit log and comments v14 * Add header guard * Change regs type from u32* to void* * Add Reviewed-by tag --- MAINTAINERS | 5 +++ include/linux/mfd/ocelot.h | 62 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 include/linux/mfd/ocelot.h diff --git a/MAINTAINERS b/MAINTAINERS index 8a5012ba6ff9..e0732e9f9090 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14741,6 +14741,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..dd72073d2d4f --- /dev/null +++ b/include/linux/mfd/ocelot.h @@ -0,0 +1,62 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* Copyright 2022 Innovative Advantage Inc. */ + +#ifndef _LINUX_MFD_OCELOT_H +#define _LINUX_MFD_OCELOT_H + +#include +#include +#include +#include +#include +#include + +struct resource; + +static inline struct regmap * +ocelot_regmap_from_resource_optional(struct platform_device *pdev, + unsigned int index, + const struct regmap_config *config) +{ + struct device *dev = &pdev->dev; + struct resource *res; + void __iomem *regs; + + /* + * Don't use _get_and_ioremap_resource() here, since that will invoke + * prints of "invalid resource" which will simply add confusion. + */ + res = platform_get_resource(pdev, IORESOURCE_MEM, index); + if (res) { + regs = devm_ioremap_resource(dev, res); + if (IS_ERR(regs)) + return ERR_CAST(regs); + return devm_regmap_init_mmio(dev, regs, config); + } + + /* + * Fall back to using REG and getting the resource from the parent + * device, which is possible in an MFD configuration + */ + if (dev->parent) { + res = platform_get_resource(pdev, IORESOURCE_REG, index); + if (!res) + return NULL; + + return dev_get_regmap(dev->parent, res->name); + } + + return NULL; +} + +static inline struct regmap * +ocelot_regmap_from_resource(struct platform_device *pdev, unsigned int index, + const struct regmap_config *config) +{ + struct regmap *map; + + map = ocelot_regmap_from_resource_optional(pdev, index, config); + return map ?: ERR_PTR(-ENOENT); +} + +#endif From patchwork Mon Sep 5 16:21:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12966497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E8C8AECAAD5 for ; Mon, 5 Sep 2022 20:04:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=B4OQHgRXTKTrGq7f/u8DlXSRtQTwLmPL/V8fFbanr98=; b=XXSXoBiU3hBP4e rVPCTxgDiFs8KlP7WVarGgC5iJNeP4Ak5AcXtQe4aSVCO+264fJ9haFXUEOpkuDVvn85mnZ3g8YFH d21KJ4KVavUzfXHVYENa3CHwo+zs14l/tG9PVbD6Bz/+kmSAM3JNW9SM77YMHvhSy6JZSXz0Bu4Q9 DWbT33Cp0GEoKonz9b8dLb1ew/3sXtEd2fHYfyH/2Py87D4WUPAR6vbafza494SSw4UVhSw+XuCbw xPONK33BtnjTGMmFMKHZU0gZH9qS39XFwdna2uchzR2fFhSIDaW2rWy9nuLPjh+KCqyQdVHhmatlb /RGn2aqdieeHHTaLIyuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVIJC-009sQi-Ka; Mon, 05 Sep 2022 20:03:05 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVF1J-006tEb-HI for linux-arm-kernel@bombadil.infradead.org; Mon, 05 Sep 2022 16:32:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=Z39i6OC/sPmsXF/Eki5x4NJ6S/zHYKHFcrA55K5fD8s=; b=MlgetYvlwmrw113Jo76jEGnjA1 guAuGpLQiMEC5K+Mld0i1gexe0tqBTtllVLJ2XdlyqVTD1LcnmFVoucG8HdBrfbcirH5KnSoqxrn9 rvwIczIqOtBYpueYQMcqJD/gNVXpXYKt0CyJ6eMf25ML1FKEEqnO3WY1Bhwwp0uQgbjDT7dOr7IGP A3naX3ZQ4e/D5ROG2Q2x0zkWe4NtB9qCjUwiun9NlaQXr6mIOKBa5jiY9hPDsjNVRXWUJPgTkV7A4 V20RFR3EkxLIw9DWxZ4SS0rkXa/PcPIPN3scAHzpACXxA1d3RY/eO+rwQCck/LpYuepzaEVAJbPt3 gTDpH6Fw==; Received: from mail-dm6nam04on2106.outbound.protection.outlook.com ([40.107.102.106] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVErH-009oh0-A0 for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2022 16:22:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YW+kREuEJLnEUzq6x1bRd26Q0/LB8O25LLKtgnlDq8S3QcpqmMihAg9/mrfSM/90naNMWxFdBiDOfx3RlDEv3RhGizV4F/IU4uAjxyNuatGMY6HEWOQQCnvCf47YyNMgks5hw8Ot9PBuP+j9VLTimAhHbo9IMC9S2uWWirlv7X05ymuUq4Qow1BP24b3eThQuLZd04qVBHOdLfPo2pt274+R19DwF7jVjQsOxILxVgKudEzQz3c4kVHLg9Ght4oXCFJ/XxiCNxeqbYvXwhvKOAfjKeaJ5Ym2cPNayzJttKsQyy5QwQ58Ux2aVFSNAd9iOn3UoG4eQDUfJhZl4oz59w== 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=Z39i6OC/sPmsXF/Eki5x4NJ6S/zHYKHFcrA55K5fD8s=; b=g/mat44GDu2g+PbMYlEJQPA6aGhk9kHcPBrvW+WBKxc+8RzRwfSjz5o27ERpy8F8CogYqoQs1+VnYd3N79lZo2WsldGao7YogjpnV7NNGKgGt+hKpsHVFmQW6dt3yWySy6vsWY1xV9A7hm85kWz3iH/Ib6tqPP5rKeZbrov9sUPL1ziygaR9nsOyze1iPbs7gZWmsqgvK+9MNU15wFzjOEoZjQckhnAMOaI7y25s3LdsDttwDA4ujs5BYdHkPdF2c/FkC+NPhmxZM5wBbQV1QIEhKrcsJf9I8/8PjXUChi+5Adq/hAyZKkObwV+RBXQ92hqxhYKPF9W5W9V/xhtRIw== 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=Z39i6OC/sPmsXF/Eki5x4NJ6S/zHYKHFcrA55K5fD8s=; b=rZHfCnX27tnAFg63jHEHeEZps0qYYnnvLF0K98vGv+yqeRiLeELQ6+ci+YGO9YFZP5aJ9TakFLAQx9MxcNOaSC380XymQvD7MOxV0x44mmR5652RnznhZx2xhVJviBD2Z7fFByqWwQmNn7KuQqb9dPW+gJEV+Afji1okR4xYy/Q= 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 PH0PR10MB5848.namprd10.prod.outlook.com (2603:10b6:510:149::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Mon, 5 Sep 2022 16:21:51 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1%7]) with mapi id 15.20.5588.012; Mon, 5 Sep 2022 16:21:51 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Terry Bowman , Vladimir Oltean , Greg Kroah-Hartman , Andy Shevchenko , Dan Williams , Jonathan Cameron , UNGLinuxDriver@microchip.com, Steen Hegelund , Lars Povlsen , Linus Walleij , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Russell King , Heiner Kallweit , Andrew Lunn , Krzysztof Kozlowski , Rob Herring , Lee Jones , katie.morris@in-advantage.com Subject: [RESEND PATCH v16 mfd 2/8] net: mdio: mscc-miim: add ability to be used in a non-mmio configuration Date: Mon, 5 Sep 2022 09:21:26 -0700 Message-Id: <20220905162132.2943088-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905162132.2943088-1-colin.foster@in-advantage.com> References: <20220905162132.2943088-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0263.namprd04.prod.outlook.com (2603:10b6:303:88::28) 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: c8cdc550-1c4a-47f5-1803-08da8f5abd7a X-MS-TrafficTypeDiagnostic: PH0PR10MB5848:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7B40ZIY7Xiv6RfSaL6JID76/pAtXhre3XQZBzDHq0yfXZXT5OM9Pyl6JO63G/ccElTuJDR/oJiZj+Q4pRRzJgsdjuEujlhdDCnN/gczE1WZ7EJYnAo0EU9eoGDvwkwavKvr0hrXfe3Q6CXM4HTWEaTGjTRFZjsyPs/oBO2GMeJwbWYVggXsRVHtDZwHqKJjSAuNLww7wk3fNY0mCbuHcCMLJiswWOnZ7sXHR3wj8RGhvnMAvqA65lyOaiyzqJV0Ufqbc6UtTcPd9RS3DE/MXXojIkJNy/XNWVXKkPIeXHalOjmtgFW7ACGfAMnM1oucYbSH7dzm23D9TdJFJ56ufJ9e7LK33avUx6njoVqase+2yfjThTyHtZj3oCUBd2KlXcOpCKPwabofoNNBbaEfJOW5ByPtuVq6AoOzrwOj+DG8tic3gGsGp3JLS79Hxj9HmcKGz/BoaL/35Ppadt7q2IpmCjI2F2nr6ONOFyOXk0O9k/OR8/lHEs/FIlcqltCVFlErifbqmWvMNsqXCqnlIrz27Qh8Uig5PqEy29uwVrzKvCmhi7hbaJ2byY/ClX0/QGT/FH8slvlRIrWtvv8piCOiZM822kcYY8qtCWktCfGI1/wp3/Sayd/5bGRP44yBc3AygbPI5c1KkKuilEciVT9d63Hw0ssUbzwpYqUCcrVw6HbDnk0FYfc7EzeiEFi19Ly9Ow8fdPRmPmFe68t84b6kmrZScyiUvTnLXCPxMo7GgNuXlnuThUVIBGE6l8GwO3yV3eVV1tIayT7ATGvxcEg== 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:(13230016)(396003)(346002)(376002)(39830400003)(136003)(366004)(66946007)(5660300002)(8936002)(66556008)(54906003)(6486002)(41300700001)(6666004)(107886003)(52116002)(186003)(2906002)(1076003)(7416002)(2616005)(44832011)(6512007)(36756003)(6506007)(316002)(83380400001)(26005)(38350700002)(38100700002)(4326008)(86362001)(66476007)(8676002)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vleuX1umPgXxqDxyE9g2OImdwCnwY0eqscMbo/q/mOLnpLACFhDH1OeWlCfe1KD1dWTKw50kXvGJnzG3PL0NRMOUE8aqKpvKL4KhRElcfSvQWSiXgSc7CB8hx9fY3+Pu7W0nGmRmnjCs7MSuT85qet2AIG7JuGxkB6eDcCZiXtg0Gpyn+xALiyNcwnClubryV3MosxdAncgDoN1cJLX4wgnhWpTJIcKX1KbeKe/DIgjVlmtjEGSzjfPLwUPij/SIHanlgNx3KUacwNUxNPcQ4yoOvzYgbTPCyFMj/xd4SSNew/heKTTi5ucQwZdheDrvasolpVD8Op8LOdqTzvHRLLHumIWBMBK8A85NV4/HxyKIMrm5k1ZlX1omal3O/CAJ2kPqfU2F2wW4OjczXoFTOZ0O8xSSpqDUPKyO6gverC5zCFRKj7dzbusqpamxd0jZmP9UfI2o8ukRG1gp1T3wULO/pghcC8tfcuMoVPAmxGog788JAdcN15NfXA/dlUiW5xSYglDwNKN8OtG4p6l/pndlUMeeW8tlaHih9svFROj137v+LZMKHJdqq5f4+vMZR1L5qkmdghxrVrJ1SNX5c6hSP11VYPL8IRljH1c6+IvT2nTCppuwg7oUzDssaG9GDS6+bggFsWAaY+mEw9mSiENfkHzKh9SUz4xx4u4qmsNIb6uLQ/cqqfv2pLGW9mD+wFMan3RdXcPGsMZJBDXqrxTYjAbUFsiiPjJPNt84emxhh1HpVBGqsdgIE1rXDGQ0YJuA5i+lxAXDPHLs0RnjFSZJ+eS6yi84BrbT+aLiOhGObTqZmaOEi607+AtPGPzzOn4aNLw6maAfEB66I/eSdKXgAZwrSmjcT5tlsPN1//imDLabY0xDvDkPQrh+XF0bNeyAfS9o9e2qw8zf8Ug3W4h6mg4vz1FQdrkdvNsKwFqO0EboZMxHe30ta3SkNzA9I7AyFWzxTfKIdVYTCqZ1C4fbLyAbjDPML42zrjv0Cs3QSaNSL4+25aAWmeoakH75L2/9u7APOwf+MkO6p2QrJTkjOttRUJmIcxWB0cmmT+1fhiOM90MIknFAqycMOPhTth6DWsuXNSxNN+ajEbC5jPPcHYoGzj/SBqm8g6XW/0kQ6mYRCuh9UCm9zXfYuhw1Dgj6H3Bf48rGj72sRLaDheLcwdFro2HjuWXITtK5bi1GoJJ+I9pAjm7GwAAGhyr4X15uLJhR7JAuUhgJy50D2KQCm9Ga69Uc+vPdnVhLkcBGWd95BD10o/xM8D8pIC2OvYxGamwr/zzPQwYJ8/BRGW1OmtlTLOxezu8Bnpphcl2Qfa9SkcQc/Y39eIwtZd3gQ7xaptCsl883Q17UQNVg5lbcpl7urYo6E2ZG4Hl+Ygwi4EgnOTtgIpFGlozuZN9gUTTc3wfJobCgHnuKhMlcFpSdSZIkjYyRtL4ikbcTeeo7vz1FX0J/0VB0bV5dDMcFCYKCfN+bYtOIh7xrcfBs0h2Z77xl7zqz6FWEsNHAH4ia979eXu+9rrxeMa1jnxqjGZShKiz/9FRATew/FuB5MjVQ+pu26nFQwEESQfDd2X7goHWlB4eTWWTH6+iACp5cdPwtlONE0uExHEJ+mw9Vrg== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8cdc550-1c4a-47f5-1803-08da8f5abd7a X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2022 16:21:51.6632 (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: 7ui0KkZmApi1i4wZwohk0i0POxt0WUU1wKIk+kEVZceukn/whu2Vt4oN0byfvn2TXdz3M8Yu4Bz3uCRr+IcqWKq5EWW6iU1K+OfDPl0VQI0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5848 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_172159_412160_A88832B5 X-CRM114-Status: GOOD ( 16.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are 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 Reviewed-by: Vladimir Oltean Reviewed-by: Andy Shevchenko Acked-by: Jakub Kicinski --- v16 * Add Andy Reviewed-by tag v15 * No changes v14 * Add Reviewed and Acked tags --- drivers/net/mdio/mdio-mscc-miim.c | 42 +++++++++---------------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c index 08541007b18a..51f68daac152 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,44 +271,25 @@ 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); - - if (IS_ERR(mii_regmap)) { - dev_err(dev, "Unable to create MIIM regmap\n"); - return PTR_ERR(mii_regmap); - } + mii_regmap = ocelot_regmap_from_resource(pdev, 0, + &mscc_miim_regmap_config); + if (IS_ERR(mii_regmap)) + return dev_err_probe(dev, PTR_ERR(mii_regmap), + "Unable to create MIIM regmap\n"); /* This resource is optional */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - 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); - } - } + phy_regmap = ocelot_regmap_from_resource_optional(pdev, 1, + &mscc_miim_phy_regmap_config); + if (IS_ERR(phy_regmap)) + return dev_err_probe(dev, PTR_ERR(phy_regmap), + "Unable to create phy register regmap\n"); ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0); if (ret < 0) { From patchwork Mon Sep 5 16:21:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12966496 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E757BECAAD5 for ; Mon, 5 Sep 2022 20:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Do7Sm4ixgEy0jncQVpnIu2Bg0lGS/nSs8PkONxWW53Y=; b=0gEV0I1GQRw926 GuPRIiFhQGOE3PNd33hc/C6/dvvQuBZGuljERUdTq5OiL5Tls9i7MJ+AxDwigYx7IfpTDP69G3qua LlNGznC5gXyNgdfuojikhJhTCsVE0wfZAkHy03Fnmyoz9NcwrVeJUBDZ0HQK7eegGFwkpNukFcfOg 7+zZ0BFbn8tWB0goiILpQEpwXEulCiiyYtiKSEX0LEkxlS+BuS34TrAzd0tYEb/tG+Tqt+qmxkkz+ 1HQZaH10ECiH15M+hx0EbGlXO6LQIiU2HhDq4BIVNgGKpU4tQYPvhC4WHLkKYzt6Ffuu+67KwtOK3 QyDuPWzLCLvmWihNrKlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVIIO-009rlF-Fw; Mon, 05 Sep 2022 20:02:13 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVF1J-006tHt-B6 for linux-arm-kernel@bombadil.infradead.org; Mon, 05 Sep 2022 16:32:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=X5YiTOizMEq699Jb164Rl8ZUbsPRl90dx3bmh4H/GhM=; b=UYrWcmkqLk1FQM+gmKeW0Q1am7 EC0XQV9h+hZ3Whf/mKYoMwyB0o9AkQPLpb1SCelPZjHg89As48JZ2UzpuOdS68LSLpDcGXas7YXzb YXU26ZZ014/JnMNYDcrwoaF8J1F+xojMkzad+XEwCO5Rh7G77tcnFAxBjJO4dhXOSE/Ql97k2+Oq0 HDSFVhMWUx577fuopc7E6LfnwEBpzlywuZGsoZ5I+4W/T1KoHQgVncOSiauae0PbnfqFEp/e54VgI WbrCxodD8xiwRj0bEth9GBpV1D8OCnaxLi+xLmQLjYVlcu6x2ja18cUYXIWnHYVYB2idqhqE0VicT 8N8xQbtg==; Received: from mail-dm6nam04on2108.outbound.protection.outlook.com ([40.107.102.108] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVErJ-009oho-AX for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2022 16:22:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bpo4hU+xoBoowd9DM2RGlUJXYdq60ThTt9icTX5ADeX442qphOPwyCk4vDe/jtga4yzs4ujuGQ/HP9M/qFgIs+A7SC9El3wY+51Jf+MtUWqiEOHP5/FABWPS4N8WhNtyQWmdp63IM/FosSElcsrW28JVzmacmIWTqygjj31bzv0bAGubM3k+opDDbMcqJdTPH1lZIYrGwdzdqjUCULrT9FEwCTWISO6VTWnVE6UVRzBrjwvG03x0Im7GCKr9lH68G3/1JRwWMQ4/rW+cPWrdgAVeumSrveJlJV5OhMF+44ktrthkMa4B7yK31rKuFKxgDbQObcdncozDvG6frXTfUQ== 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=X5YiTOizMEq699Jb164Rl8ZUbsPRl90dx3bmh4H/GhM=; b=aU1H/jXMI8RF4hyndcW6wQQPm8BPhAC2+9tADJpyiGBlDXRLqwhvoxd6yWXrNfS+yfqhEVpspGkTH0i0hwixfLxzSbQ9ZkREI+GqsNYXffvpon4XYDNz1kCCsb6H3cz2UB8HpUzTy4svGm3CfxkuwgrJfmaSMtSLP1L/LMcalJQuaENxV4CY9mctYp1QBWFTk6AcqyZ+Na+1DtxQ8mbL3us+9ZMo5+OXrX0fDgsLYYP0zKCypbElmoans55AeImvCMV5WF/HR3yy4zZIqlImAtC+ADnfhwHIY9wAl3Sc50UBGHKCcKUGGGDWPzuK/cZ1ZgIN2bIRetFp0EeR4ECv2Q== 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=X5YiTOizMEq699Jb164Rl8ZUbsPRl90dx3bmh4H/GhM=; b=NeX7qWBOx4fA5RzmeF3Ei7R2I1+YsQ5myX+XtMCjchK/qq3YdliK+f/3CqfrU9J8zsvyQOx22xhOuGM3AbD7iYPjUa+DJvExPkwj+9oP9RFfn7XcH9XQvYF7983aiHJjka+Xv7WxxofJWSgpCJ0+kuBbhDaE87700TW4c6ATMdQ= 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 PH0PR10MB5848.namprd10.prod.outlook.com (2603:10b6:510:149::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Mon, 5 Sep 2022 16:21:52 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1%7]) with mapi id 15.20.5588.012; Mon, 5 Sep 2022 16:21:52 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Terry Bowman , Vladimir Oltean , Greg Kroah-Hartman , Andy Shevchenko , Dan Williams , Jonathan Cameron , UNGLinuxDriver@microchip.com, Steen Hegelund , Lars Povlsen , Linus Walleij , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Russell King , Heiner Kallweit , Andrew Lunn , Krzysztof Kozlowski , Rob Herring , Lee Jones , katie.morris@in-advantage.com Subject: [RESEND PATCH v16 mfd 3/8] pinctrl: ocelot: add ability to be used in a non-mmio configuration Date: Mon, 5 Sep 2022 09:21:27 -0700 Message-Id: <20220905162132.2943088-4-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905162132.2943088-1-colin.foster@in-advantage.com> References: <20220905162132.2943088-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0263.namprd04.prod.outlook.com (2603:10b6:303:88::28) 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: 4bd45423-6b15-4f37-38fe-08da8f5abdde X-MS-TrafficTypeDiagnostic: PH0PR10MB5848:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CvrouJWHnYvyV3iHkBO73x/KE7oi7UfoZWS8wx/9HazRWSVZ7XBrNA+OyeVsjhUc9TQ75nQNW7M8yCz705MXGQoLtpRFWGGX5gcnFm8NpooSlqv61ht1sCfbLF8b0qwekyy7pSz5iDeMG7dF1DXA1GdKubG2FwxbBhFV+huLAZNF0d6BXhcgZjGhSlTv4ky43DKFcWASy0ghao2kxvSpbW2h4CNGbKFKtF5zK+jx6joHqUh6Urv4013dVIpmLU/yWGPFZUCdBpZVzCO8NMw0LkJHvGLw+VCMNBcNG28SOu1CMLIWKxa9VUw/VKvsOuO6wcHBamu4uNQJfJ/qTapm7NRPq9vdXAhelE+TvGcnjdIaAf0xtrUw1wcSGxmwRo3L5WOMiOKz46TSaVdlCD0ERRdNakdRgma8xokhZqWIpVbRABgrPMopuAtIScLyr7hW4M37tntYuBAegGycH87qv2/sNPuvp0+C6xfJv6Gs1J2JhEw679dHFKVwmrDndBjAoruZRAQNJcmO8KgWMDMMheCk24tHbwavjwQ4g42dUtstXasYYWD10Pjs9mM3pultwXkzWcONXcrG788ThODvbzcTjQutwHa2uQWVnr3h4m/mWk6xCI9kvrCWebF9mbFFT5IdJfqM0lXVXhFHx3fYHhwq9CMDHtYhW04RZn0CXpn3sbMZjKB8VJCAmX/LkKf1NvItjW9zY3ctByMtMV3+rBOLVKIi9pT+AtvhJe2hhss45oKrZiQhlfKbXtUGFe/HgEGDt/feMPclTRcWllkhug== 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:(13230016)(396003)(346002)(376002)(39830400003)(136003)(366004)(66946007)(5660300002)(8936002)(66556008)(54906003)(6486002)(41300700001)(6666004)(107886003)(52116002)(186003)(2906002)(1076003)(7416002)(2616005)(44832011)(6512007)(36756003)(6506007)(316002)(83380400001)(26005)(38350700002)(38100700002)(4326008)(86362001)(66476007)(8676002)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jufrvM/znJd2HAgHAkscTXPYwObU2D5cTBhwzWF3t/UjXsQ+S0DYnQHNLV6N4pO47wY1P+UeL++vHGhCeXCvs7brRyO/swtVDJ57/sLK241KpBPryzBmwfSEQmmaljjy2oR6i8UJvXrWxnkDgeCJylkPrj9rn0CEvTqv+HDvwHDljyXTGg3XEvKdF5G5IUMI11/xdLEPvu/vPX13CJu1CwfAPW6nO8J8D+yDAUZo/eIFy3PlmQDmbq2o2SOG5+ySz77fJbzzLafXPOWRAP/K7sHbRCyoa+R3ji1+xpxx60S3KWdvTpPB1k0kg7hMFR071x6H3M5MvGnE6n2GVjcdJkKqT+anSotnAuRNfLzo89gFXhl9y7J/foY5zK/pmgSfxqP4FIh4XghawvojpR5TCdFZsFm0xi/YYXl3uYrMxN3fcJKfFjUs0jLCZAVMjzKBPgiuSWJztXb9BaKt3N/pTrMhALD9R/SiXmscHiFZkIyaArNOWCycwQz54ljFGgVP3QM31Ds8ihNrNLrF26dqsi0+hELekEHXC3NInRhrDX+2NC9bwJElvKt++ICnkmFXpsjrMGaKl7ur2rfpAElvzTUwK7egSplO3r/+01Ak5Gu5NFqR983H2Yr3j3xJPdVhETL7fyD0kaJFgzNomuNWdCK1A9AciiZW+k9ILCh1ZBr8T5dwzpyp8MQGMeZ9nIhzJOL73rTyt+HxARu9gpT0LjfkgbHVQFz8DSVBwMZbL29zhz/wo08TWoR1/m9V6/69i0vPLPDx3/ycyHL3Frc60ZbJ/zJFgzdc2HBCOuqNL/N+xPJ57RIL91Dkswl08HuIpimHm9x3lpyNsgMYI4PAE9uFRU3ETnkax3A/mcz0uBdt5LvhEZdCVu+Bp4QgZ2IyV+1Bau8Tq5LvO9fa34vF7lq7TFCo9bfMph45jRbW0DsulroUPyIAsAPgN2tHGD1qTJXjywAzp9kJY4EHhpK98hT34px0RRtc0/1jAr7YwArcK9DGS+vVvW++UhdYd/jSotyBHYUOZRbzjhFEEqLL+JlHkJV7vmp1MW3gClaMQyjuU0Hydsa4YMD8SpkvQ3Pw9clK6hODA/hjQezN1d2HN1oVBdWlbBcWcaVKa524MjOsBSm0lkR35LxvMcFYZuK3goy/7PBc0NobvRJpsDg56FcbtExaGJAZ5BO4rVGUerYTEsld3jnZruA85Rwbq5ZgD0ZHrbNcthTYTJbZk2Z7LauV4P+xXZALkixdWgSbaQT1Q652Le1GavbSze5zf1Hkw3Y22IkTVVIqBlrT9/NEAFrT4KVzVnW3weHPDbwv0kdAlvDXTSXxyZ6xyaRiinTaIoBp+9M+b2ITev9DTf9p8sN4GCMDef1iMOcPy0HmwDEeCjDuT/D2HiWyMha0rMJktoWqcH5QLeoOZHGQvBQEOdgq6lOkzcHC94GQPeREWDUNM2LDEhFT/XrTvlhKOdu0lErq17CBMHCYHyXQHgutS5juM3uCEp4+5qLIjnCDzIrfX9tpIqNTYd6CVDs91s7pRikEZGxA4Yu1DEs4Wlt3pjo0DedT78RyKR+FrQnM7VSxVAD6lbFtLTRSDFUWzM1OHwveUGEjSpJ388EnCAdqdQ== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4bd45423-6b15-4f37-38fe-08da8f5abdde X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2022 16:21:52.3351 (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: quvUqnbFyqp2TU1/IKQSO6cFR6Me+bJ88LR/VVhql1fi9CXTlPG47BTTRcrTbCeC0NTE1wOCMehrDs6MTE1Nh0VIE2+me8vgYZJOHUSItcg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5848 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_172201_443964_F5B1AA64 X-CRM114-Status: GOOD ( 14.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Vladimir Oltean Reviewed-by: Andy Shevchenko Acked-by: Linus Walleij --- v16 * Add Andy Reviewed-by tag v15 * No changes v14 * Add Reviewed and Acked tags --- drivers/pinctrl/pinctrl-ocelot.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index c5fd154990c8..340ca2373429 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -1975,7 +1976,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, @@ -2004,20 +2004,14 @@ 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); - if (IS_ERR(info->map)) { - dev_err(dev, "Failed to create regmap\n"); - return PTR_ERR(info->map); - } + info->map = ocelot_regmap_from_resource(pdev, 0, ®map_config); + if (IS_ERR(info->map)) + return dev_err_probe(dev, PTR_ERR(info->map), + "Failed to create regmap\n"); dev_set_drvdata(dev, info->map); info->dev = dev; From patchwork Mon Sep 5 16:21:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12966494 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CCD3AECAAD3 for ; Mon, 5 Sep 2022 20:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uDXC4xFxBx252mFlL/ycKvEiTYJm5T7oUoop/XQwbtU=; b=3yJhlozvQLSI/u edygKmxz1KCp0o8F1Jd0torND2TDBaiQJsC+JT3QtRgKmY+nPloM1rE76nP2Sx9vtG5Rbq5x6/rH/ IcBudVoDkjv9XjpkxEk80XPbZJDJcrz2l7+2LC1TulGdelcc+e9vgpCoU5Ywd1w8s8ZUXC/ZwqG81 j5G6NMB6XD5cvVXMNQax60p5MsjvxlyG9obOqA2j6AO2VQt4/fXltHBXbaMLeA60MDlFJW8JPofLe scLtRE9K5+wxxoe6sFeGOtY7uXXHdTxbziRSZ76JVjqVHvS6FXRMgykXmVG6B3fGvdK8aXyoJ/DKS teT1qLVcQwZ9hSPdiP9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVIG8-009pg4-5r; Mon, 05 Sep 2022 19:59:54 +0000 Received: from desiato.infradead.org ([90.155.92.199]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVF1H-006tVy-8r for linux-arm-kernel@bombadil.infradead.org; Mon, 05 Sep 2022 16:32:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=T5opAq0Wal163efo4bIJB29QMAdu4+IcusfP/GfBH4w=; b=kQr0xehVDCtT/Nx0xIKG4miJzL egxeychSShiOAKnuSLrCdOvCMmhN4CIwwoLFEALeJ0r/ifS6upv1J8NHq9upfs8MxiZhCAnuGh5pk nEFoVkYrDeSPb/Su8SjPZQXTeWnUKbxzryhhyiOO8wW2GTAKZH+9TJAoYa+7DRJpE70/n6mz7CIQx JttMYaqMHagwV7AKQMNf8J4/CZ1a5/qzpiNrKjYaH4fyZI0iZbG5bscA2zUqpHDXNPA01aytuIqiH Y9Vf9hfGQRfW5cUmvSSaUKdHNug2FYDTxqvxGbm6yG93B2DbxW0sVRuGtt48HyfdIVRRK+Tcde2ev 1l32HWsw==; Received: from mail-dm6nam04on2106.outbound.protection.outlook.com ([40.107.102.106] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVErJ-009oh0-Ee for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2022 16:22:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RBqDV5xJlgiAjeWxk1CRnu82KFzGoB53iqhWxqHhur4mn++d/VxA0+v9erI7XNOUbepjlc52VM6fp05Cnfb3UeGG8A27wwWDt0sjBhMSm1SuoxeI5ungqjhxC6cPN2yUfI1F0oTnzXwp6vVwxer8FAaljejKg3C2S1oZv6bx2PIgvQOCv4nZ2dgVzf9KuaLbGbhwxKIRFCkO4wRO6hl1cw9g5kJg6MxWHxcKRpoJDt0vw6jSY3f6ebZsPBAytTNrApymrJr93+VFSQgi2/iTtykgl+4UB2vGmsxb6rqhOUZ8+fyMBzwBOZroBhciHqPeoXgw2cl+09CRabFXfit54Q== 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=T5opAq0Wal163efo4bIJB29QMAdu4+IcusfP/GfBH4w=; b=na6ehR6xLGVQkzWDraTeSncw4RdsxA5KhtLdsvAQMRHEiWmiCT4GESNcSLInS4MO585L1cNffyWzsZ3IoQNWVKdm8VOjjr/RSuZ2v9dM6ajWUOMEoDcp2bcwWlKv6erGoj1FoBtMoJwm1kOTAkFAbx5nb16TO+l8vzuPi5lIevCPkEN7tyzo8J2nb6/l/XTRm2mNiENqD49wxdGsyOQBlCr6TwnCJ447351eFaCn5OM7UdddfccLber0maRdHdBlVCoZNIF7mW6ZILQ4LgMU1lLGy/xq2LqKvBJrbqqWwqBvtAkphvst8nSSr/biIODyb7PkAgW4nlinMVyuAndbZw== 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=T5opAq0Wal163efo4bIJB29QMAdu4+IcusfP/GfBH4w=; b=eRI0AypvgWBLufg9EBhe10/OAJpu8dzPTsDbUbAYhOmj2sK74kEUZmMiGBY3VG8U4Fmft+L8xOXMQAJpN6ixyNwbftHGKFmG7V1Aa4BHayS3h7VsfgCFnUtJt8L/DWLBgei6MY9jHSyU3F2kav96JdPleU61Rr270enntuYS1VU= 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 PH0PR10MB5848.namprd10.prod.outlook.com (2603:10b6:510:149::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Mon, 5 Sep 2022 16:21:53 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1%7]) with mapi id 15.20.5588.012; Mon, 5 Sep 2022 16:21:53 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Terry Bowman , Vladimir Oltean , Greg Kroah-Hartman , Andy Shevchenko , Dan Williams , Jonathan Cameron , UNGLinuxDriver@microchip.com, Steen Hegelund , Lars Povlsen , Linus Walleij , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Russell King , Heiner Kallweit , Andrew Lunn , Krzysztof Kozlowski , Rob Herring , Lee Jones , katie.morris@in-advantage.com, Florian Fainelli Subject: [RESEND PATCH v16 mfd 4/8] pinctrl: microchip-sgpio: allow sgpio driver to be used as a module Date: Mon, 5 Sep 2022 09:21:28 -0700 Message-Id: <20220905162132.2943088-5-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905162132.2943088-1-colin.foster@in-advantage.com> References: <20220905162132.2943088-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0263.namprd04.prod.outlook.com (2603:10b6:303:88::28) 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: 7e0f9bbb-de08-44af-1e9f-08da8f5abe47 X-MS-TrafficTypeDiagnostic: PH0PR10MB5848:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nIfGt3v2+ylqeZ9izDQHzHaiIrCOXtk5rdur6claQXHVJ8yW3hCRA3qx8WGsZ5TKzTy8UklnvGjFKZkq11ZSNr/85E7FVZKar4Ndx99IetYKb0Jlz68qxBFDo3CXzA7ltBsyqpMbj/Y+H3mnKxdMcX6aD4I9hoa4pPZaVfj7MBkseElTMNwC6rM8jAdbIsAFKYNLa1WXv07Ok99K3NLn4AU3khQYRfb4KBMXvOYva6+/8Q3rfk8pZkvDB29qKXZZNwdGYUJhfEsNa/lkJKUFNJsDboHlc/s+zm+JylKGmseaeBrBhOsLL41vU+qaWhtC4tl4fxgYUyoFGC5pHH9eGaoQXG9BOvyPzLyzPaE6L5J4QQ4eCdg2/DxR2Ss2Gv58PqrlcJzUBW/VFaLBcAAhFpSlbh/zfqdZBQk2+le4OhyORyUjXU7+BqIcND2OPGkyZFfZYltEWHnMXPuG48db3bXKinSl1LD/taEoQpyOCBdWk9eP27AzZ+DsvnkjFpXQ2rjNr003X/q3C/o2RlK/i3qZ6btGWKK/AZwaxtCVfYetEh6VLfrIs30RtVsXyffawAGxyv2v2B2dh9pRfTtt9M+QUP2YkrEalecG94tW+oYgpCQlLacvtljJJIWnzsZ98zT2nlG0Y+ElLEKz+zGDUxXIJ+R1FMBXLjKZ8g3hggZipSuGjKjjFcjOaZt27LwX91NJixP3/gWE24CTfIzCyF00ODkUDBZS2I4Mv4GQGI54xNpQWDvRkiykYh7s/9OR 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:(13230016)(396003)(346002)(376002)(39830400003)(136003)(366004)(66946007)(5660300002)(8936002)(66556008)(54906003)(6486002)(41300700001)(6666004)(52116002)(186003)(2906002)(1076003)(7416002)(2616005)(44832011)(6512007)(36756003)(6506007)(316002)(83380400001)(26005)(38350700002)(38100700002)(4326008)(86362001)(66476007)(8676002)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KXWebID8Zsm0EBU7U5EhUPnQ1SPvle7Ei78vas6nsubC18fINTkjL8EaZtm5+4jsBLz7ZSvg/GFoyYMZufFkGnb1LE1jB7WPnv2/Fefl29+/Mx0VYdhE6UmwtoDAZsYxxd7BYkZ/E7a8UI9MnVQWq0YB8h4xL4IL6lKC+nM8JWdDqavUydDbAB8pOnuRuS6ATydXYQD93IyHqjIjf5nYN1TqKHvzBvBdPp9MjjSiM13yEsio679GwI2KWN4GvClchAjF71zOxf5ydtImNOyyM31ADGZmwajXKqFrgZejRMA+dai+HqTELUQRYX8u9ccWQ/SdsmZpP5WIzK78Xq+iARN75Zc/U/zYQc7W8vc9EjPJR2TRKZD755cshOfdhHtqD2+jKQS8GZj7260OM0VtIGs7UN0mrJ3ikFZ2FEyz0DoFx4hb+kLWj1ZETHtTNNKC+LEoL6D7YKtZx1+6WFlJJv5Xr03BXC1pujWzxvbf64qsNgr1aSHKdGHCwqTdH29XordqAiGR7pKjT5ANNpaiBs/a99/fV9PVTmh8FWmP07zbmgBm1uTv1Y9K2RklDr67b7f/RRYrpIWinFFe04m7O+dnuz2a4nyH39iiTcyFZMlYy7tpDLaHq3UQvntOuhD0qnL2WHS+hj8A3dgpIetEXTNWWCMq9fUrDICzpVGzu9q9JlKZNL+GM+q00bUFNG7mRe9PaTxUaSqsVhdA3swq7/p3oxRHZKwyrELHalKBjFUZNtfuKiA/hdaYDXKFjbdxrwhUmOJJg11qCTqjarHhtP6Q84pBmpkjehX3aOGWV2qlwBrYVAq8Hfpmb06+EwfiB5pSflx5tLw0xdHoGVOz/87tAWWDLSKWPytkGBn1KrA5zrcp1Pfn6jT8xue/K62+YWZWMznPR/M3v871klawRr/F720v3BWgj7M0lQqF3GbyGYfklWlAS9t8kmH4PNOS3Gon965ckpkT3STIsr/IeBTirrGk0o1Ts2vZ7D0NEHXFQLWvtr11OcBjxJW4xDeYeqAajHUmhy0MSAjQTv4s2QdfRuIAEvc40xkZtH8GILJxqaGUzCsbUsRmV1IYW9Va6K9dVZULfiMcMKUW7vExyT9uRIuCK50IZwDVlBRQY073h5FIURzxYdbIaKbjqKgC60P9ef1/NOdaqTUFbbzrYydALgutLA3FyH4AAHC5SayX/BAhoA5jFdcNEmNmS9SLWIomBDIqffLu3ZfrcKolzBzpZKZmehT/yaXFRMtJlNPa12secBG8vNqGErfNSx61bvMgceATMArnqS6XRMOYRpZ/HPdmeRA9AGUOMq7VVxqOxX7BDKUi1PQCHoAtScjK7mK79DCh156W2h/Fuuoj3gnNpzQBs8KjN5QWunCx3TMI6fnPKOqXMEiNWHLl3M+DdPuoK7bhK26CUe78XG4CXtOYn2+dbZiStohCwi4fslQSg4IboG2Y1ISUs+nniG/p6ZyQv4aslK7dx2azL3k00xZao1ASvFhxTe5Agajm0sgwUTxfzoBoA9C5esspyA9Zwxo4aYHOta/qnBZOF7fMrPx/m8YjT05r1xvj77fgFk/UtLKla2UP9uB5gBzFmliUBbVnOZwz8qPx/twZ1/i0Yg== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e0f9bbb-de08-44af-1e9f-08da8f5abe47 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2022 16:21:52.9913 (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: DxMwj5GgKsquFZmDZk8vPAnxkuIsDXFzgbmEQNYtqEDNUfJLjFqDw4tVGrgTX/rv4Cx/bDwa75bPjv0uGYspkg2pfuWjsdxzK8JyeJxOmIw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5848 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_172201_565846_9300C1B8 X-CRM114-Status: GOOD ( 14.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org As the commit message suggests, this simply adds the ability to select SGPIO pinctrl as a module. This becomes more practical when the SGPIO hardware exists on an external chip, controlled indirectly by I2C or SPI. This commit enables that level of control. Signed-off-by: Colin Foster Reviewed-by: Linus Walleij Reviewed-by: Florian Fainelli Reviewed-by: Vladimir Oltean Reviewed-by: Andy Shevchenko --- v16 * Add Andy Reviewed-by tag v14,15 * No changes --- drivers/pinctrl/Kconfig | 5 ++++- drivers/pinctrl/pinctrl-microchip-sgpio.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index 1cf74b0c42e5..d768dcf75cf1 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -292,7 +292,7 @@ config PINCTRL_MCP23S08 corresponding interrupt-controller. config PINCTRL_MICROCHIP_SGPIO - bool "Pinctrl driver for Microsemi/Microchip Serial GPIO" + tristate "Pinctrl driver for Microsemi/Microchip Serial GPIO" depends on OF depends on HAS_IOMEM select GPIOLIB @@ -310,6 +310,9 @@ config PINCTRL_MICROCHIP_SGPIO connect control signals from SFP modules and to act as an LED controller. + If compiled as a module, the module name will be + pinctrl-microchip-sgpio. + config PINCTRL_OCELOT tristate "Pinctrl driver for the Microsemi Ocelot and Jaguar2 SoCs" depends on OF diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index 6f55bf7d5e05..e56074b7e659 100644 --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c @@ -999,6 +999,7 @@ static const struct of_device_id microchip_sgpio_gpio_of_match[] = { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, microchip_sgpio_gpio_of_match); static struct platform_driver microchip_sgpio_pinctrl_driver = { .driver = { @@ -1008,4 +1009,7 @@ static struct platform_driver microchip_sgpio_pinctrl_driver = { }, .probe = microchip_sgpio_probe, }; -builtin_platform_driver(microchip_sgpio_pinctrl_driver); +module_platform_driver(microchip_sgpio_pinctrl_driver); + +MODULE_DESCRIPTION("Microchip SGPIO Pinctrl Driver"); +MODULE_LICENSE("GPL"); From patchwork Mon Sep 5 16:21:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12966407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CFED2ECAAD5 for ; Mon, 5 Sep 2022 18:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5oRg+gJPzZ/LD+aayUcN32D51vBnGqQarn+Y7LV4XV8=; b=qh8TkqOZnr0/iF E3oTSLS1AvXpUt46tJwm+1JXgLDBHnQhZ1QN6wtK4STAwGIKEeAnMxTYrY1obEteWjMxVolrZD9au n/PdPAJI+PqVkWCI1YIksG+Rm2y/Z0PyHPRCMdNaMw9DRKgKG+xLWMgz/g8KgoV6o+YrSKjOsOWLA x4zA/iWlvo24Dt0JE23uewN6hN2Lo7BfCK1FddBlBcug9I7n8tPbx7gw/xnzzwIFDyqPxdKphlOeu 4WUfOFu5DpMdp+g1sz36+7dVcoWPSfj1bbgTFEnyEQZkv+XJ0CNoKsmnLgoqV7DpEZV8tOrKullhy k1erccddTanoSVZmu5IA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVGpJ-008P2l-MU; Mon, 05 Sep 2022 18:28:08 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVF1H-006tEb-74 for linux-arm-kernel@bombadil.infradead.org; Mon, 05 Sep 2022 16:32:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=VeRckxEZO54EkM75hMOVmLtgg5AW5O+vUBQluRmm+bU=; b=VxaKJYXwYTHsSkEp7IBZPVnSqY 2Y1PQvQWYHxnOuwOV72uWkEGkcuJzpN47gO/8XheKH1AzCjHx886cQFarPjjhG2JRmWp3HeCPQv36 4qmdhxjj9xPHqUq7orx6kX8viiF9yALP0bCSwfIUNHaytbD2fZKy6LxrhSmz34PuGcnMB+s+smfce +kDAJAv9d8JFccMzy1Gqrf07WgwqsAAIfXSSf/aoESabhLw/riZYmy+Rnq4h4jsvkrtCELwAJ783t yIyuykzcqSGP4HlaiEhnCIttSwxTO1wi4m5jTyvkQ8ndseojAvtO7/4+vf/XMON3TREqZ/IMqApM9 YrDSpdug==; Received: from mail-dm6nam04on2108.outbound.protection.outlook.com ([40.107.102.108] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVErM-009oho-KN for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2022 16:22:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HoerRC1G/kRSYbntfQimrt/Fy7DhzMRRKDY5qZA84GLhpXJo1jIgPkC2d5t7PpAhGzo4m5f4Ba4VXNSN3u2lD8PPnJvxWLfgGAp4lGWntULusH2+OI6i6Zbgj2lCQIfCQOwIZPBjTsrRT7fuOdcoSPaEwUjXN6VUtM0R2tnqF4uWzfE9gJspsc4gUY8HZVa3l1IekUemLzJ0Yd6lPc0TeeykCqY4flp5h0V9Za2YCu5l/XNTCOq6kjOLMYfkpKsYpi9Q83kZ6pbm1VkQmwaaYy6CZLxxmiXjUtca4sfmCqyuNXgnETQsaU0eDqLox6ZjjiRqYjKsKiFzMZpahX8b+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VeRckxEZO54EkM75hMOVmLtgg5AW5O+vUBQluRmm+bU=; b=L0NDtdWqSvavwDciXMqD1BaCStM+cMTs7gOEswM0yvP0r+L5ouGcK8J/p1hdLR7QgXurctGPsG+8WPSB4cYOKTZyXo3IsfmBgAA2NL/ZRqYFYiUASMWvpQGo6AmF6X4tZgDyu58taCh4HimJZqD1GhQi1aFVYfsoDIA3vKYPWienOLgA6IdhuXtfawZIozmY1UDgn+UrdVEyzdrUpy0SMyHNd6+/efjb6lGsksY6EeUecnqelCsYL0RfH7ITw+w2+mnvs0bwfpGnyLdvFBtfrYzvXvcGknUG0h5MZXUszJ0W5CTRcvXrwNHQ/2wceO7bTm4Bq5B6DaO+sfzEDRQ19g== 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=VeRckxEZO54EkM75hMOVmLtgg5AW5O+vUBQluRmm+bU=; b=dE1tEgwk0dQLfEhLyOFSdjPlXOwQpZ0gjztQ7xrpjPEZXWHOGyoAH03aMZKBrbdDAAMMSCaltBT57WzMpIISa5VKV4awMSwEUm+3KTavZnZaqOXdyM0Sa6yit/ujn7SRHZNvd48KeMq8tWvvrCrk1NrSbvl9H0J6O+o2S7D76x4= 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 PH0PR10MB5848.namprd10.prod.outlook.com (2603:10b6:510:149::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Mon, 5 Sep 2022 16:21:54 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1%7]) with mapi id 15.20.5588.012; Mon, 5 Sep 2022 16:21:53 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Terry Bowman , Vladimir Oltean , Greg Kroah-Hartman , Andy Shevchenko , Dan Williams , Jonathan Cameron , UNGLinuxDriver@microchip.com, Steen Hegelund , Lars Povlsen , Linus Walleij , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Russell King , Heiner Kallweit , Andrew Lunn , Krzysztof Kozlowski , Rob Herring , Lee Jones , katie.morris@in-advantage.com Subject: [RESEND PATCH v16 mfd 5/8] pinctrl: microchip-sgpio: add ability to be used in a non-mmio configuration Date: Mon, 5 Sep 2022 09:21:29 -0700 Message-Id: <20220905162132.2943088-6-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905162132.2943088-1-colin.foster@in-advantage.com> References: <20220905162132.2943088-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0263.namprd04.prod.outlook.com (2603:10b6:303:88::28) 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: e4fccb98-e301-425b-9fee-08da8f5abecc X-MS-TrafficTypeDiagnostic: PH0PR10MB5848:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tLwqw3QX5/ON/Hk2Hvw+buRuKpEtz8JitKr9dAJV7h3+RevJ7k/UahOOoYaAag0cQFUrvz2GRvw6vXfmka4g0U8MbMLNjdi/nPnD/IdL211zhTR2huEmaJR0i2hruzmRFxvdUOsuP25wVX2b3v4Mg12VSSATVvsczzMErKtT1lWxjgK48xHUE186RHfVlyzCLqtuGGtE/na7gpFo+LW07p2PFcTZfMr7F3NCIn0R7gF9d4GfGiyqljFrn/kdPdJ2GtXmmhZQNt7hNlAweSJM/ENrm+etLjTAiELbwM5ouVZ2YCTn7XYhXQk22/PbbEGwjDMH6cmIuHVmK0BEotrx/DbLreVXF2flWoV71yVhQr+bhB6SBYXKsTWGOkAJ5c272TUN1buo+3xAYBfG4BZ+S0CrTNhjkBGQhKw7Ty3hoTZEfJ9yh3sYrhGJPzVoFBMiswUygLZOxZiIPhq0u8JKP4DqHNhnPG8jR3atrVEZzUtaXzVPK0fB5u3AhHYXy+7Ya+tNda2MQraFm/PVTaedRbd7uU0e3qNLMCo5SeivBhl9g2Z456oXdfeCU4sLoGqAhSwDebnGXR7N115FuiNNnWIRM10vCICCo6NqRZa7Yl7eKB6l3d0MF2REcDOUq+diotdzg2JM+gRi1HMlAH8S9mO5nlAmYMgP+bGA1t7Wl8x2TfmwspzqtPGjO9PKWh9YrqrKhJQARcp07eFN04yKvZo0Gu4oToxCk55FiRi6uS7Bd5Q3tYaojk5gSbYwelEi 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:(13230016)(396003)(346002)(376002)(39830400003)(136003)(366004)(66946007)(5660300002)(8936002)(66556008)(54906003)(6486002)(41300700001)(6666004)(107886003)(52116002)(186003)(2906002)(1076003)(7416002)(2616005)(44832011)(6512007)(36756003)(6506007)(316002)(83380400001)(26005)(38350700002)(38100700002)(4326008)(86362001)(66476007)(8676002)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: i0kiCfMX6e3R/myWK/D6+nxYjtbifKiXWq5Pv6oBPZRuqUC00iIJInolA1aVVR/quxfqTme/sRhLLR44LgRtG046Rbb5iNhs5wrIh82nNvZwq+MvHlLoIrgc9GZ8KoNjXYz/piaqUiZJsfm0wVk/XS41S7AH7hOAisVNOMH94R1DpklUeYNRLUYt9ntF7J4poZnHp9gMJS9apZcxOWa6m3jrJZM+UnFcFdZIy3WPJfftPZoid8UwfPAPAT4IljMFeYLrYD/xl00By/59xNK9+A0WVBjqdBBWyAwQYcBzaV12tSWvjP9Xzu7Adq4YPmF4AIglbJ/bSZdDJ+ZNsWEvP4HQfbTFKTV9nwMK4bzQh2LdcXByZGkMEu8ppss/plpO+QhqzbjOYCHrve/U3EaXtAc3voJrRmMLkzjJDCKkWKW6my7vUb7CeofITK6UJo6x9ND60FlqULqe0YRapk54Bs6jt+LvEkn63nEHUuGj9dqbDRFC/4NaXmNDGzhBiyBX85ypBCk68ZRVXgo2xjWzfgwq/ogqK+ZJbi95ctmKqOmDsx50cY/WVGYIqhnzpqpCc2wnuQoq+JYXWhE+GNUGec3Hf4jwL7vX7WimtUVPWWEU4cfdCQFQaiBURTfTWfO3s9Ban9tiTcl09kV79EvlgK+SAbGR0KJmoRte7vf6GNeiHpw8ko99QuwZXag/k+MTbu3G2R/sorft+n/j+3iymxQX6OhKqQXtcRKd8akjIngu4Yx4vw3VUKIvMnsBDgLeC1E0Zl2LVRFWDAQRPsiJ/hSzEPtDEGlO7Rqw6Uae8Ix6+HjkBDXwo0D0G05c1oy8vsghOUS8Fmk40dSs8u74QDhQPktu3Cx0WlY7490VoImRNFuaLf2otdhFd5J/uAOiWM531NODl5WPqgfjgVuZzhGvhWfh7+dAogLXcJJ1Cprae+UZVwtSttml15v9OSgm/LWFl2KoSkL9Jb87Ow8ehEujR73WigeJ/NufUHTTOz8a/xdW89yMdOE+ZScPL2OR8LmY8JQ0NGjtEPZNkWPcUF51z9YyzW+A01p4pHi4K3TO33zPp3lu6YNd/vB/hYRsfP6o2T3PxxXV8VQw/jJ09g7F4YYkeS0jq5spCIwzcX69zX4ohEktxk/AQJB+K7TcpuzcwW9JvRl3JwxH1iv4j0G2+Nqq6RCoTmx0m0Z0mzvgLuryAhxryxUTc+PwAzd2BAILigIBMGTc50PaVXkq7uosmviIJ2J0b2XRrdDvfFIcleOrDiduYINVReS/WLXmkF7I7eSSazKlzlwbhBdVptm+Lq7BZczHg5KJ4PjI6Zszpp4zokWQWlKCaJrOfIRq0vRo+05GpRRSsoiXXnFCN29g0F2xrVsxZdp0AS/aeOftx6cImGBNyRAC4gtT5fxvDSLYZIkuQF2ue+YWw1VaqQwTiHUP+IbIrSjHdWTO5uvAhuG9prgOk7T5LyKz/cihSbs8SjPyvZ+jLelXZM6NkK1pQGDemdHTKqF0JGJbtah+daQOhiikzrnxKBqpBjGVW8/B1AcctUYRPd11dTHNFlLtq0CJ27GF5/lo59uX31gcgswxZLnMIPR+GZQdoKbdHwz+OI8dr45rMO9vtkBFbw== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: e4fccb98-e301-425b-9fee-08da8f5abecc X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2022 16:21:53.8662 (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: o/vxkNHRafvmxTcrhql6SMRlWMTbVuNXDd28pbzsLkXJrQLZLHPpUv4BVIpJpeZcRtstuCS5ewkrKbukKVjkav4IoCWrMrAEXaUMxN61Rv8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5848 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_172204_731886_891CA95E X-CRM114-Status: GOOD ( 14.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are 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 Reviewed-by: Vladimir Oltean Acked-by: Linus Walleij Reviewed-by: Andy Shevchenko --- v16 * Add Andy Reviewed-by tag v15 * No changes v14 * Add Reviewed and Acked tags --- drivers/pinctrl/pinctrl-microchip-sgpio.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index e56074b7e659..2b4167a09b3b 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,7 @@ 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); + priv->regs = ocelot_regmap_from_resource(pdev, 0, ®map_config); if (IS_ERR(priv->regs)) return PTR_ERR(priv->regs); From patchwork Mon Sep 5 16:21:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12966406 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0B3C7ECAAD3 for ; Mon, 5 Sep 2022 18:28:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eapui8tzapJ4QaLHKCFqzhfjN67+xmsr6zmOyrHwFgM=; b=fRy9DM+NSxyMcQ TOK6tq5nj0DPB4g+/YTk2Ep+ChXnfkpk8UD2gx0KW7tgnQSJZ9GamOCPE+5r61Wu70Q3iunUBxuWP Lp0vo+KS82cl2rRa2+PAel4gcgdcVmi7vI87Z6n4j536jEcZT8f7f9mJSLJXon9n60mI03+zjfrPT pwYijvc3NHjECKIpDfc2eaGEZ+NCrrilvA304SFTfHEIIHIaF5UAnYSFLr+Xfg6egxleBmaLp1qgt Xwh0128IznRDETUy9z0bG9Cg92Y73Ox4GGWaBFYxfAiKI20AxfkUmWRh9SMhuRcVkrtqgFzZo5ZMr 1KyhheF52o4Key/4Ta9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVGoS-008OHl-5M; Mon, 05 Sep 2022 18:27:13 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVF1F-006tHt-Bc for linux-arm-kernel@bombadil.infradead.org; Mon, 05 Sep 2022 16:32:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=hkWt1g9y1Rj2yx6TLx+yEiwfaAPfZe2xipge1N5vais=; b=S01O+TdhdBiNB5ZaH4RtOpyQaP awCy3IENelh85atwrpyv/uBdDULYwYvuTivT1s9hMQSO/hicmDUUuUDaGMiLADxm7wQd1Ivb62QoI WvsdFTGIAABv3I90khygSqzY8YPrrlH8Ok1pZo4Hh4B5MVwTC4FliVyn3F0EGFmbo+DApAkxf7vCB Mv8T4YqY1BFygo/sWnnva6jXmyDgGYi/fckVyAJYwGyVCm5+1ttQeT83w1aEuHz1NMbKJn1DtbaNx 6JZZHRPXV4Dqr8pkqc19DCaHCbfIRSU1/CHq8H8QTsC9fuqsWQUvrMECriNg40m6rnF/P5RZEVarv c/DTHV7Q==; Received: from mail-dm6nam04on2106.outbound.protection.outlook.com ([40.107.102.106] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVErM-009oh0-Ln for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2022 16:22:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yw5u/L5SwW5vjp6Yvg3S5s+p27HeyZq5LqkkeLZoWW9A5fyab5/Hgm/yMx7cD8O4Z1X9cD8DXNzR/CwUR1Tv16ocnM1BL4vesEX36+JRNgkERq5qwmQZkYUVcxL3aHnRacoaH/XjeS6HfWC/nsrT/sMThqM4JyEzYJvUbE0VuhLeYMlOQxhmuq7Qsfio9q3/nvWv6CeFJ88MeLPsgaJDE0lef6Ami1cqUZ/5Eu28aeRdomxhPf1r9nQLuzA0oZpWZahZArE9dKb7i9uFwQhL0dr7XVrlCczfVaH1O7QyiGwGg7C73rNF3OsG+rM/o+iAlTMNM7Stu0nwVwbsWZJv+A== 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=hkWt1g9y1Rj2yx6TLx+yEiwfaAPfZe2xipge1N5vais=; b=BjxRxJ3gDvKBGdOTEigmXrCJ8jBPSt8tTjvL30wxFLp3oPEjq3JN1ISQICJVoJSG9jdm/dOwD7kWgMcpMlOPxkFQeUlvkMCITYTVu1MlkkKDD7376HdH3BzN60w+ywi/t0Y1LPCSW5C92GyPRVIZUrjIf/w68L1++QOFtlkAb+jPprRaFVLZHcOsxCC7tztk8F9oI3TiQs9sEBH7b0/fSmRICzSsEeSCNDc1QRNXVwFvYDEp3oadsoxFi8hJgKdsPiW8yGuLeMfwqIua/EtMknnJkYtrq+NAJQCCSCV1K/250DV9FZBwyBJPrMZrBuHGtThJeJXdTeXPCqYoMnSCdQ== 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=hkWt1g9y1Rj2yx6TLx+yEiwfaAPfZe2xipge1N5vais=; b=UUSZWdv7Wmb4/r3EJaKZTcm1BNcwkSZ9y8bA4zL/uQIkqomqG3U8A9fTycwaDnyIblMMCft79p1RNKKSVuQw3x7fsqB76Y/T2Ko8teAOesftXBAczs+L5lGP3Gyr1JLyp3Z5y7nSvONp9UkDUR4Mh3ONkLJnOCj0MWqJ/nU1hnw= 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 PH0PR10MB5848.namprd10.prod.outlook.com (2603:10b6:510:149::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Mon, 5 Sep 2022 16:21:54 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1%7]) with mapi id 15.20.5588.012; Mon, 5 Sep 2022 16:21:54 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Terry Bowman , Vladimir Oltean , Greg Kroah-Hartman , Andy Shevchenko , Dan Williams , Jonathan Cameron , UNGLinuxDriver@microchip.com, Steen Hegelund , Lars Povlsen , Linus Walleij , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Russell King , Heiner Kallweit , Andrew Lunn , Krzysztof Kozlowski , Rob Herring , Lee Jones , katie.morris@in-advantage.com Subject: [RESEND PATCH v16 mfd 6/8] resource: add define macro for register address resources Date: Mon, 5 Sep 2022 09:21:30 -0700 Message-Id: <20220905162132.2943088-7-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905162132.2943088-1-colin.foster@in-advantage.com> References: <20220905162132.2943088-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0263.namprd04.prod.outlook.com (2603:10b6:303:88::28) 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: 2a45f46c-2fe5-497f-fc51-08da8f5abf2b X-MS-TrafficTypeDiagnostic: PH0PR10MB5848:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ha2g2ZfrQQCAvlY0C3dRr4F5T+4Lm38VvqFboG1tI1DpRdRBdDI4yeyjSF4Kc4wEiNxyQIU8AqK5IACUVlRkxkFUEO5ahlLIWxgO+6YGaMYCwlUTqLXe8UbUfZX9Sulwb/E4YQpBomygUqDloKJuRd8wR9XW3wlY3v0d3Fw/KjB1tVYEBgGdajR/ftNFPjLbOqwI8Tte7vvMPsgpC9jWUnyYa7d6kj5oaecHUORZdRDzDUIMDpj4MDl36nyrJCYNTddgL3DceCSI9b+fJkWi4Bu/oH01GXZUbPPQ+N7LMa6+gb7GwuSTovhWQCTnrTgx2vCepmmjh7PidvTIPWxjGceaSEbxGYgDu1+JvDPOprJ5bUSXi7bJpWKU6PIZq9fg3RMzetFXkaddhogQeLhwuzeGVVMnJfD1vjle5gDmAre70wV3/bS/PtyJ0bgu0/APgHK81MIyX5BTGroyyNaZovLdepkIl7GKKwnmBW1orfcxIz6Lsse1nMdnb5yGQ7nnjR0HjjgtakuTmJOLL8zJcnHEAqEd14mVyjgbDYaFjfIHaa/WmVn0vDhYv4RAucQjKsoxYjnLK6qRanehRnQEla+cM5E+uV3Kc6jLDb5pqlJKj+WTN3q0W1HpZB97lxfYKnwDsCVwSJjRbBjC9yOaG6QrkV2Z5KQAnkqbxm2Vwv8sE6WvR+qIn0dW9dL9YZj+vAROpaiFtEH/Glqe0IPu2nZ+nlLOQl9ijVG1vZXUFFuo6tKoi5VCzF08+QpSSc2U 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:(13230016)(396003)(346002)(376002)(39830400003)(136003)(366004)(66946007)(5660300002)(8936002)(66556008)(54906003)(6486002)(41300700001)(6666004)(107886003)(52116002)(186003)(2906002)(1076003)(7416002)(2616005)(44832011)(6512007)(36756003)(6506007)(316002)(26005)(38350700002)(38100700002)(4326008)(86362001)(66476007)(8676002)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HmSExKJ+bmLyJe1Bgk38byAUHIBYZIEfhsNVe/kvkw4k6p+BhTakztWfXR6XOEW7EVOCbZxgSEV4+xd6DpPLgpF3Yet0NZSv/LQPZnxloDRiyJhDy8dARoQYGThvscv4ytACVbCUugNR1Q3KJwr8540hmR9FMUTIKfX6iBbRz4zcjx9zp24revH+tJyD/2giliUHYH2RahFj57svcH50gsjjO3V+Pe1i05crv6Nu9U/UYo7eFbfm3Zd1J/CUH3XYzF57ArSWVTpitjPuFbuJ84ZbMWW6+H0r3W0NGimP/v03Tci7OkBmD+GqbqBDB3PpfF+DNJvX2lhNOM6V+DsFWyZZzWdElgD/DqCz8Y2zBqFWVyGulIX70avqNtKRbwiV+f16pDNJxSHyLI4RLbgvZy2YPqlCgSmaXSd7VZccMyR2pCijyAyn9Rt4ZnS+aEJO7/eC2wpwZFUALOl/cum93/8M1PfImoNdiOgpGX9IqzaI+LF+Be3l+tsK7BSgGqLr2CHyZA4Ssl1psc/R2mEhm/uNAdBhlDjpqacFfxz16Lfq3GFq970H0/rHLyG7ASwIZQ+qqhcRh4OvGRR843fFUsxVU6lsGoP/Sl4/o95/VTMf5zY8gzleYu3Qq39r3LicHZBmAjNFAsf5dp7WtizyBqAqP75a9C1l1EvjttLvUMoP8DetYD6OmDy4S0rZNnaxHXNK2/v7leJoeFLPKXNnC+ivrFh1hVPrQN31nmKI9voyA2IgOTaM/tgl5riqqrlXNQ3fUjsFkagJvB4Ng+CiAR4mDja43Sts8yyI4AigENXCdZfajR5QSbDgTCEeKTMe1hAUDeAGXyRAaUO+x++dalYN6CYcKesQg4ws0Op9zaZKA9MbCy1/oGv6rzFVfVbmlBHOoZhyJ2fRKZJKwzlDxRYmB9aRVfyrXCqXP6dvsTpnndwB2JZcEg1a3xg/X6Hav8B5DU6Tn5xMgCWjBz5D5J+KplpneTgkSx2/ckAko0PQ4DXVM1PsZ50s9fWUqHUa4iT7aa8diyPpug8WsPfScrODU9MSU9LxHKkCH41ihKNurT3v1PAEsWvnr1Fb47RC5ykLAk484ouZ0Pva0WwRI55bgEOP/MAaO6bPxpA45WnzZ4wQ70YlKRZlSstmj4lUdm+Dy1lvwqAgBH9fV3f5YGpmcgZRRl2MRwtfnVPND/h5trlmk5jjMNxTWiN9GmaoIC4mZT8cozXqzTvofmjrBpoGTBGEOYEkyJ8cxfISEshiFTAuoIXcDSWm2Fxpxj2ayjRNftV2PmQmzS1nqbNnzceW93vbW2q8MI7wkeUJ5coRX4130+FFS8nek+lpvbN8XbuncGhk9aRu00w0d9okrH+0igj9DEAz4b6Io4lSL14+U1veB/xspZ0aRCNU6RDEtpMpC6RTWk+229NQ21XbW1YaJjouw4VHyHJX+TMkQ5DsBo+4zqaUS4uNaII7Ert/EXOUZHVXUZ9bkb5nxY4x/4xvZQ173wCUKh9ywki8hQvbsINuzWRcd6T26wxtoajadXYzlEDajDf4rXBbTHO2r/ZqCSjOmEV1eF5X6O2kF6j9qcU+dpBgQhX9qQ5u+/S0gL9iIKulZR+GH42vU+hUhA== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a45f46c-2fe5-497f-fc51-08da8f5abf2b X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2022 16:21:54.6005 (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: /AhlrFdyXxY0UqgJiy2KWeKGzgLemNMc9PwA38G5bLc4DcwEp6z4ohFu5Rz5JPWAM09FwgtJehgFakwQAkCJgK2w/P2TNTqG3IaYbBDySNg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5848 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_172204_751034_CAE7A1AB X-CRM114-Status: GOOD ( 10.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Vladimir Oltean Reviewed-by: Andy Shevchenko --- v16 * Add Andy Reviewed-by tag v15 * No changes v14 * Add Reviewed tag --- include/linux/ioport.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 616b683563a9..8a76dca9deee 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -172,6 +172,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_REG_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 Mon Sep 5 16:21:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12966408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F803ECAAD5 for ; Mon, 5 Sep 2022 18:30:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wsZ4C3J/J0gzdSbm/zzKpMqH18mFCZUdVeF2zgW7Syg=; b=vm5mNMnv0iOZ1z hClOr3HM1W+lLu/O4TcywhjoXS9fR9sBDiGvmySA8QnRN9LJJRUAfcXM0VHzLrhrJC622EoMro5MN 0Wu4V8H/pLCiuTrsGwpvXcE0O8Vfe3Dgwm4xWeEaOnap5RoSlouOMxjy/2X/G8wa99eDLYO4aV4eZ iP7PwVSzrV176S/Zg9fBmEUfwef2XjyK4x0eIPynElX4dCc9wWIqP3EMX5oeP+UG5hz3SMPT1SEtH i0xPlh3YLmEtFPz8H74nSO1DYw5f/rmR99L+jbhAjnJ7gno8vaE/tchHije6yrsq6KoqS0DHkekFg aYwRbHYaeMF06QckDCrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVGqM-008PwH-Ne; Mon, 05 Sep 2022 18:29:12 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVF1F-006tEb-7g for linux-arm-kernel@bombadil.infradead.org; Mon, 05 Sep 2022 16:32:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=7ugWM/t7mNaTvEKz3aMsWhD90NlTeDCnSdjabF2ck04=; b=bMazcSazFPKKB4IvNIZDxV5Ae6 19l5V3tGP4gUbQk30797IokoEsi1+oEtv4SvB15cXd5Ai3eUyi9TWo0WsVVmxHk/d7hJocVP2DgFf PDgvBQzCt9DUkmUvBRqnVauacbqJuQccvEDq2wCTnXrnaV15CJHaOtuOKHxPyI9HlgjX3TXWnhCMt r1S4C6OuQAuFzyBl9WEeVGWjqVxFVxro26Nb2mktDBmxBcVh7Svx0sCZeS1voNHR30/050k12GH6N MhHFqs2fSk3KOuJV1RIKjdjDDUDEDfWkDOv7mJ57z0g5qLMPFhXAjN6FVxBzbbWcIEq5fgzkWMmDh 43qpOK7w==; Received: from mail-dm6nam04on2108.outbound.protection.outlook.com ([40.107.102.108] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVErO-009oho-Ur for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2022 16:22:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b1FVmPjJ/sAro5JylIQUXKkN8eTdbnk+evz+ebbANord2MBlA2vb7sxaB2eAx8/LNZqpaQstz7h85Ggei3V7DefyhHN8ojbCl8F05qbVy440KJ8oOnQJ34qsoOrCJdOyVZQhTE2HKxqJ0WwC+D042KIyvkYCYDf817wZ96vYiXAeVhO0drTsZU+1SWo8jQoOXXWGg/Jpb9NcGNbzX3fAO/pak2ETdCs9f+NyKbP/Le2PdSqxV4hOr/nlKdUWZ2s6a6vZ2XZxQijdcmfVSX/K7Fx3k7sq6o3AJnA5Z/SsRPvKLPvMJRz+hMB0sWuPzHndMQvFd6oPa7M9NUUI4wPB5Q== 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=7ugWM/t7mNaTvEKz3aMsWhD90NlTeDCnSdjabF2ck04=; b=UdiYEV2yfsEGavP1Nxr93yEexyTD7eOtzJLSUBNcFZnv9sPnsmx9xSfu1zCdgBe9IPqmN4IDYjv2xHwEf2tOmoUP3NnWQpRQ+iKBRfu8d/4TeIpybpK2Ny27v49D9fOWpARIHaVeREKfRe4HQnAMcm84UGxBzRNGxORStw+Sbz6Sn4iNasbsUFgqGWdzvS7y37mW+tPtUV6NkOLeljcepRBcEA5X+M79rKH+Xq6Zutt8QJNQymuO6WOddeN/eg7FsE0Q2DNKlAhRFDI9jewIu4PXbkFxDmjEJWuVYE83fiWu2FighRdxTUEj0hKx2get8R+8F1UyhZVDK3R5L94jBA== 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=7ugWM/t7mNaTvEKz3aMsWhD90NlTeDCnSdjabF2ck04=; b=V5rYyjNaEMi4sTpTccdHKYceO1aH4ucf1X7NeQGDH1ZO344diDylLwmF3GWUWC5Ff6n9xKF2InjqEXvxhRBN+aABB3BH5IOUVr3/xHfnvrb9JThJPge3akCov5nY1b+k00CNZ0Ole2999oixc6UiB3k6YQjSUk0KJOOG20OxTQw= 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 PH0PR10MB5848.namprd10.prod.outlook.com (2603:10b6:510:149::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Mon, 5 Sep 2022 16:21:55 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1%7]) with mapi id 15.20.5588.012; Mon, 5 Sep 2022 16:21:55 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Terry Bowman , Vladimir Oltean , Greg Kroah-Hartman , Andy Shevchenko , Dan Williams , Jonathan Cameron , UNGLinuxDriver@microchip.com, Steen Hegelund , Lars Povlsen , Linus Walleij , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Russell King , Heiner Kallweit , Andrew Lunn , Krzysztof Kozlowski , Rob Herring , Lee Jones , katie.morris@in-advantage.com, Rob Herring Subject: [RESEND PATCH v16 mfd 7/8] dt-bindings: mfd: ocelot: add bindings for VSC7512 Date: Mon, 5 Sep 2022 09:21:31 -0700 Message-Id: <20220905162132.2943088-8-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905162132.2943088-1-colin.foster@in-advantage.com> References: <20220905162132.2943088-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0263.namprd04.prod.outlook.com (2603:10b6:303:88::28) 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: c342be6f-6947-4521-cd6e-08da8f5abfa0 X-MS-TrafficTypeDiagnostic: PH0PR10MB5848:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KwFzavfRLdZFKsALKivFhOQC8Vdj3xamA5a+gd5XdFXmIhZm/shPQxveTtJsGsPV5FKu72FcwDqC2e3EwaW7jGSFg6o3Q2Fiak+cBZzYtbnxIjDvNc3/T7ESujuavX/wNkLFS0Pzmd6uu4dlSAYMoXRfJAm+nS3+oQO9fmKegnp2/KYHjuBwo9IX0WWW76Ao/cJ6bWiq2uNHJbs7gAkcaGHJ4HBOBySPU9gbUlvlVItavza81BdhpAz0rDNNn9kuEV2/zYo5afO7vttAPKeBhQTvR7ThdYAxuazBIogmkZC+m6zFa3jN7lMKRXfJVQZN9oiU1+ZgQNB8ToH40BU7dTunD0bPMfA3deko/A0l0Riz9U8bMn9pdH1L8XvFhv7kUY4MLEZkHvAqGZK/OwnCD/CZFSUPKEWdqjKHTh//OlrHJJPSwNX9Q+GNUVcDnK5fv8avNw42Mn0umAlvahRpY1Vo879o+kqcSFZKNMvtCemC6ZejsbKVGmd97m6+UhVzpEVpqVkkWeAE48hT1x8qmgz41LPENtPjd9zqgXZ0vBpGjMXhxLNah5xxqaNLrJA7UWeVnz+AXJ6F/uitj2xvY+9sGVzjyejRiiWRtm7wPb1EncqHv1jCsuqA2CzRx/6bXhqNHb/y93F8dVdCfVQTE1B1wyXthY62D5K/8XGxaqEzQuXBmEYmz0MyJm4cGplpw8PNIiqTg6mWoLLI7Bvy8PBy+JUC5O0dGKKJMXf4R1Uhk+ncLm0w/2IBlwM63VnK8tNcEV0BEGoExLBA+JUh798/SBKInRiJM7Ale8RE36Y= 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:(13230016)(396003)(346002)(376002)(39830400003)(136003)(366004)(66946007)(5660300002)(8936002)(66556008)(54906003)(6486002)(966005)(41300700001)(6666004)(52116002)(186003)(2906002)(1076003)(7416002)(2616005)(44832011)(6512007)(36756003)(6506007)(316002)(83380400001)(26005)(38350700002)(38100700002)(4326008)(86362001)(66476007)(8676002)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nYwG7/gf6BgKDtvQ/lg6HI/Om4JocBOJo6isRL8y1sYDgK8XZSOhxKdiN4fl0iAtHxLmLBMFh0+Qat2RHd3Sgp3BUgJqs77NEO2aEwZtxZzOGZ93h6sZh+0/h/KBlAEPowV7jA/w870EZqgiDaldhDs4cVtKLl4UwdxqIO5GYvba687lze1y/eXXVs1P301iNIrW2eMjlMXp029SLcEXiEOtnuguxhp3VIU8YwQnFGb/0UF8vwpPOrrTmdaPKcs2RF7pStGXs7fQEadUDjXYNpqE+vxedih9HiFvQ6vM8QHUIAbiUOYnM4roW9+PY0koKvVh2Zutp21FFxeMtHDTBejqXnJk74okDvZU47w6x8bboBbGhvldsf38VDHuw1pCoXv2zrM0GQGVOMyeFecKE7oGcuZoVlIG/ZVolxSakFfNLjxlOdKwcm8QS+nFY3Q6JKn8azOp2Qx+4D2Rc0NqU5rtDHXyo9wKzK4VwU9d8ByOD+vQjz64E/hPfkLCrOESEb2imD0ZRCmGf1xHdcLmfUZXI8gvoktzP0RsPe6jQsOf4Vl1x1O77fpdmu80VEo8tku4IhxRr+skwmkqD6d96/0BvP/5Bbr4fXp9zQFXPD4Je8L9djmUx9aWlrFfIfHFLTo/fZi9TzwYo5jQ4VETLWBs0aNJo+6iJ1I/XCDE8d3r5y2MZm/0KvniY/wKkZpkzU2gMlIGjPxk5qFwCq0PelDXt4s7bvSrYDYMPnk9wiWCYZDArkfTayXMVYOlnbwuPvynLWPrXXCj+WGjsC6iYJOLRTuG1SolEhQ9B0msva/T9k7F21+vjHKioh29sOUyuSHXtQzCO3RH4ZrutnKig8gdGhIiVYCDXvUPsrVL+WiW3ABJRyycannrkG+gPP2nIRj8BT9AQ7Avg6CQq4Eewli1A0q5HdXAj9rfBXU1bcDrlglzWd1uQX8FZnhAV8bKAciCKGi3LwJe8Nn8uFtIY4wptlqDecsKh/gS7N6jJohmBFYlNwNglnxDIPy7MnzLFgDwmHMgYT4utVPrdn3d6GaHPO74oH018uYMin2BcJGsb0O7sJN+jcTFk54FaUUzefTetdD50GsmoXjqtmEIVyu1SfK3wU1lYf0lLl+LFSYmsPv17n46hK6+1YFmMF9sxV/G6/PVCy9EO7WnxckmyufQZuMdnvwOGx9t3s8ccB7ir+rGAJsabwTBI9EPjm7GGdefqO0EqhH8vvYBbWJM2AA2S58/0HsgdJdDNAH+nO2/zXJw0a8AGwu2UmjHRDZaft19Fmc3pF/7TT6bODZCvUreMfoR0gAtcjzJxvqnRAsRgHi2P4VPgW6KcLOX0nY5KulTWx3OtzUSjbHOIfVsYpDj5znZD1657r2oTB8sjaI8UguV/jL2gm9K+bHLIcBgaTNAtKoY2ez1o2Ykrq0BQwgof2e95Y6UBkE5qdab123LJaFHnor7OYQON1/s10/Nqd6zNjT7mJXNK+R/EW6ny8HcmqidVZMDu3K0McipXWF1I2CzsPH2JGu0Ndq/9racYYQfpRDNDZVtXygt+n+/beWQ32zS6tRgKvuB9SViX+5cnrJ4jA9osqxU6EIic64wh2cl8yTJpJ2AJvLvw8kHBg== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: c342be6f-6947-4521-cd6e-08da8f5abfa0 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2022 16:21:55.2724 (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: 0w3oh/xXNNBEecXHvVaPmreE/l4iQ9T0KDH6hG3V2UA30BXwKZVGi97Wu0TiJnP5JKcAnCijXB0f/kj6Mur+UwZlO5bdGR4ajE2dTcGkF2c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5848 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_172207_063578_38F5F32F X-CRM114-Status: GOOD ( 15.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add devicetree bindings for SPI-controlled Ocelot chips, specifically the VSC7512. Signed-off-by: Colin Foster Reviewed-by: Rob Herring Reviewed-by: Vladimir Oltean --- (No changes since v14) v14 * Add Vladimir Reviewed tag --- .../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..8bf45a5673a4 --- /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 + + reg: + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + + 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>; + }; + + spi { + #address-cells = <1>; + #size-cells = <0>; + + soc@0 { + compatible = "mscc,vsc7512"; + spi-max-frequency = <2500000>; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mdio@7107009c { + compatible = "mscc,ocelot-miim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x7107009c 0x24>; + + sw_phy0: ethernet-phy@0 { + reg = <0x0>; + }; + }; + + mdio@710700c0 { + compatible = "mscc,ocelot-miim"; + pinctrl-names = "default"; + pinctrl-0 = <&miim1_pins>; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x710700c0 0x24>; + + 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 0x6c>; + + 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"; + }; + }; + + 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 0x100>; + + 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 e0732e9f9090..a5df3b0b9601 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14744,6 +14744,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 Mon Sep 5 16:21:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12966493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2B7A3ECAAD3 for ; Mon, 5 Sep 2022 20:00:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wp9FCecHGClgUtQE2OSNpqAOznmMgUHB2j1wqoksT7w=; b=IqpBdGm2w428kJ rLavJXoq4I7lWfPUT+IkmXtFLalowekn/NX1lK0OOu7nDW7jDKEcWjtM+wFFsrPuYIL5dR8Ai5Dp9 4uENabEqa54qgrDHVlfFX130Z6VZArMFq4PuHIROfGmiI16shRiJ10mWiqOJK5lCFAuNLQjoTAmgV fX0ZLYz1u7AhDuuYMJdlJbdMIst59+YZi7ARVQaWh1AwXmE+IFGv5Arx1lE2Tzf/CBz2OkiXD2beJ mb8dmSB8DYWuBAyEEbhO/5h377hWLfdXrAZiMyeUyDf+mtUlVs0iCrWgNLorbAC+gC0d58o8+FNY9 urtOLPL2Phbu2WFHVZow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVIFJ-009ooj-J8; Mon, 05 Sep 2022 19:59:03 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVF1E-006tEb-EK for linux-arm-kernel@bombadil.infradead.org; Mon, 05 Sep 2022 16:32:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=CkSt1DE0vzKc6FUZaF6mG5wilqZzfirnN8MpyLbR5hc=; b=j9oLzPPAxdu2566qcn78j751Ep zZ7K2UkvyBk6qZyOhaWafzowt7Wp6aTGmuWLA95tDjkw+hGVngQaqWq1V91r3mrRox1+94gij79Ws eWDLd465SK59ZMeybc+4Mt5RWi/ApxB6kErauNGB35z7rd/7ZEfsopCwDL0UqaayZ3XuvGCYsDH0V 5w2AZ6PMuo7unEkAcvZcDvCjh3NCVf1njsikEDjnoC2MNhzf6rilPQD/3C3G18uHK1Qfxtt/0XUqK /AL4ljkMrG6ZgaDU9mNMVFY0Ix3h1xZdMlJHG2cdXtyJ0VcN60b3f1lpeWXQgoKJWVomXS5yVFR3o d6hoeB2A==; Received: from mail-dm6nam04on2106.outbound.protection.outlook.com ([40.107.102.106] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVErO-009oh0-WB for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2022 16:22:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k6vFV/F9M1z7ZzkcItSz4HXXM0CPvIZFNSRzcqc3m6QwWYB5MmymJQZ08RXbPiqgh8SI/Mn2s2p8/q8Cg1P6L5mA3y18hG/xrVqmULTotz4wwfrds5DfKpmcTdAXfioqm5VjPoQCa5n6M0ADrN/tMukVxAZmTu8IZnMdtWdQJrwWM4dknSPoEyJRroYj21XSmGFVjyi5ZosNwJlp9kpKSL0k6w9OAGfmQ6dNKbcpC8UXmKQVJC8h7m4vxIy9cTU0gyWclvMaT301PLYRlaIhTw8pBYD6k0522FTW2NuidD/k8MxaEKJors4MJqAOOwbYpIBaj65T5InNmSwvWVAYKA== 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=CkSt1DE0vzKc6FUZaF6mG5wilqZzfirnN8MpyLbR5hc=; b=Gv94njxz4ejox/rJ47Ijgjj4i5NBIh44sxAgyicTnAcy/GKUBhCJyFZzk4+lHzYPAhUc6iq3hyqWoRGjSztX//c36LQktEeCi7nnScfZjHedqyPQnq7h2Wqzgu6ZhMiEvdjj47Fe8QxmEVZLF8f9u83Ggj9sh5+3Kbx3SC1+dBGiusnMEeEyGpKYCMNRgHMW+t4fIlt8Hse1vNRJSyCoqd5ptqWv72dTqAl2go1RnoniH5ZbgSejwEFSOJDqD/gq1JMmSt1UciYiYvA7LLTrVENvoZcIvZms0tpflGoC9RpqIkCXJXXCi/mfBtGkVajqLAstZKO+pyWEvKxhVgmLeQ== 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=CkSt1DE0vzKc6FUZaF6mG5wilqZzfirnN8MpyLbR5hc=; b=jr9w4IJtxp8+I0y6Dqw6kEZdSDWuceOtFDfBxBrcEKMaS4nd9Kxfmn6fG/E3AcQXCENbA0JwwKeStaRjQspAYo9J/g0WOU1PlI6Iqq7ckL/Hp6YKN5h5yQv001EXcT7er4JYwJpByQssfOX5igNegGzRTh5nO/1TVudLsa3bZak= 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 PH0PR10MB5848.namprd10.prod.outlook.com (2603:10b6:510:149::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Mon, 5 Sep 2022 16:21:56 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1%7]) with mapi id 15.20.5588.012; Mon, 5 Sep 2022 16:21:56 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Terry Bowman , Vladimir Oltean , Greg Kroah-Hartman , Andy Shevchenko , Dan Williams , Jonathan Cameron , UNGLinuxDriver@microchip.com, Steen Hegelund , Lars Povlsen , Linus Walleij , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Russell King , Heiner Kallweit , Andrew Lunn , Krzysztof Kozlowski , Rob Herring , Lee Jones , katie.morris@in-advantage.com Subject: [RESEND PATCH v16 mfd 8/8] mfd: ocelot: add support for the vsc7512 chip via spi Date: Mon, 5 Sep 2022 09:21:32 -0700 Message-Id: <20220905162132.2943088-9-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905162132.2943088-1-colin.foster@in-advantage.com> References: <20220905162132.2943088-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0263.namprd04.prod.outlook.com (2603:10b6:303:88::28) 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: f84f4755-003a-41a0-8c1e-08da8f5ac002 X-MS-TrafficTypeDiagnostic: PH0PR10MB5848:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: miNQOexZu5k9HVXK3s/SKUD3vQf56nzoGOayFdu0TeqyxUnuhTqF/4cOlJU+FIAXvFpnVHcxLRJudvxtzGAc10y/3SpLMSlvDg/xO/72JFfXFytTSbqhdXErVG0YcEDjLGDtUebQgo4ASPI3nR86PE/7ucgdUNK40Js9nDFaZ8Tg7bP3sJVWbYe/3kZl8tU72F7o/2ctm6G1+uCYNzi1HpRyHtl+drSHWFack4VAWgKmTNiXZI7v8w2R5F1y2sYzdgWNaeYp8nbLeN3tmVY5llFp43mWo4HmAOnxpSfbIavguwxaScuR0WMHl3pdDIv2UR3PncS2JWcSN/wKmeVoUlKnsP9IqqQbxewpWOz938sx8I+DIoXEuNx6wi3DeiO4xRJO8KpAH9NnYgLu0VPPH7/hFwwYPeTbBkAuLcff9w5+OkmoR5MD4fQRCethAq4BUUsTs0WmkSLb4mFKY1ZxP7ZnnCvCPeUdhey8aml7qob8sfXZpDRGTiItlK8n9wWKAJy9t/2R8Rz9tmiYDbq+oQTqaxTDprtNdvw9NmeosB5VO/83ihp4WTPKz/Px07z1KSC22criv7QtVVJ3U0/RdXxmHDt+PuUa5T1tfMuJqvmU9Z1ssnBOEAiMC9uPLRK9MhyDQL1gYMPIm3LpJIUQ1aleG0meFS5F7oAHKmGOD9VHVaByMtQYInnWgSe2B/a6QI7uC9uoFBRRwNuLJ8+L5/kg34Xv/IxP7ExTc1CNkmDt73vSYzpX5tYpLDNfEX4B 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:(13230016)(396003)(346002)(376002)(39830400003)(136003)(366004)(66946007)(5660300002)(8936002)(66556008)(54906003)(6486002)(41300700001)(6666004)(107886003)(52116002)(30864003)(186003)(2906002)(1076003)(7416002)(2616005)(44832011)(6512007)(36756003)(6506007)(316002)(83380400001)(26005)(38350700002)(38100700002)(4326008)(86362001)(66476007)(8676002)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hYzcvizrOvQrewjkZrmo8nLBc0ZM3EHGWmaN80fuyEoYi4iec5RNpNGLrQjuENpZYNI9nQiLoI63yVTohUZVIaLeszrtrQDIo1eH7YW35bmNjAK0LpOYQ3dJHBOOuyJbRZYlmGzwCjxKyCeauGgGewhDE+2aRRIeKp0mK2ChFru/FYkL7ZIZY332S6jO4/FNuRCLLsVPK/yxm1eEA0EIv6Z3OftAcDJx1N7za+OnEro1ERW6shD0ueMbIahC1tpJrXjSs2N9jmOeHh1lAwASgftzijIRjC9Gnqa06iTfLc0zFTxc9JJHlCO1kC6Z/iUpRw8mHD2KX7RgbNAvpgyrTKoF1bljJzk16geJzL6/Zwc+aEfttxMgvsntrfT8RdR87DToEfFQoDCsxJEfCci5QFy2kGgHCa6BpIXVK93nHdDjfMSoHspTyfwY9qMLXFD9JliSRS7bfJqMimLBpT4H0OVYcOKv+FMSmdBobi3M9rESdJj2iwXxvi1mXDafbz9K2CjZWCibxRWJeaFkPlsMRt+zm2/GHV/i3+LRFw44WmSIgK0uMCSdAxUHApvQiPmaHl1EckSaPFSUeD+C6WgJzvqyl66nTt66AO+H2j9M8KgkCWNH6wm24JLAEgeUO2PS8+2qjVoa7/orYghOT5Jzq5wOf3Disb+7LUzM5ModiK8IlfXGpm434SlvwFR1JPVHWUO3Pn9qPAlI3N812VXai2acmOVRKJr5r/HbdOp9hF/Fxz8xgcBlx0Th6UzbVQEidIoXc6mpRHC8RSWohzEIl++FIILi3dUSTMuTIltu054q5njaG6v7XgTYJnDQ4NkVlw318k+lLrqzFWSFBXX4lIg4f79CJ7+MSriygUFKbslEjqfcrexp1bqo5mlB8FaDlkVfv3vSgG/leAjExWMbNP8pZbpLNc5M49JRplLTg3nfNvn0ztvnM2I5YA+dabk9DqcBBih4AORjmaDWD2ytuagTIM6ry6ll57sHIG4QS2HuR7iHPeURWsy7o/DK0CG03btD7o9n2+C5uqFyvQSmgbPASusB21pwuMvLhe4h+QXTjoifYyrjN+EG10atpxKGDVVB+Pu0oGlDs0NAG5vhLIHU4w+7ArSjyXN3lTDZZSJ+6FqakLwTZxv3CK17j/DtnQNKX9rQSJvPKSLm0hfZzTcKMD9ELc0F9WTAhXc+DaSFPE83kDOFDT+WBgqEQ9A7anh5bxAZqHyTXnxEpBUrOMFOuHZM9xzN17VF/bVijykCkqSa9uAPQUiDZfNvbX0FnWPW3EtKQchrjBJQYCdnUbt+9OzlE1CNVIyVG6K7IHgFBcOKE9VIMcs+xPVlS9Kczwi/BuEs5zlLnJrKd/xvLNmhf0dPUdabLKDEezRX1c6xKalePsZzkKjhNYwRC+wIRFoSA3JlvENQlQkqzpCwS1EfnR/0dETdnxW4PVowLQXDFe2xYebLGfTrAOP8z+xFHuYoHXSFsbC2LtXm5ZPX5xoKl/5JjYOzmhJSEweI47tS41W7un6xhygPK65d29cmFxsN8L8wrdFt1chf50XyYjOxRNB7DHvimq8jpxhaI9XcFKJIcuokdflCfdGbkmtwbQcDuLYtQwqi4ucxkgnWzQ== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: f84f4755-003a-41a0-8c1e-08da8f5ac002 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2022 16:21:55.9754 (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: 65XStQiSuhHoAfX0r8r79pmuSe3GQ97Q7Z/d3drcBHwWMEAW914Ol1z8Dwli4lP63BrMcOA6zn0bN57FCDxFqvxo2uwGn5wZ1w9tKNa2yh4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5848 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_172207_174014_06E9A516 X-CRM114-Status: GOOD ( 23.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Vladimir Oltean --- v16 * Includes fixups: * ocelot-core.c add includes device.h, export.h, iopoll.h, ioport,h * ocelot-spi.c add includes device.h, err.h, errno.h, export.h, mod_devicetable.h, types.h * Move kconfig.h from ocelot-spi.c to ocelot.h * Remove unnecessary byteorder.h * Utilize resource_size() function v15 * Add missed include bits.h * Clean _SIZE macros to make them all the same width (e.g. 0x004) * Remove unnecessary ret = ...; return ret; calls * Utilize spi_message_init_with_transfers() instead of spi_message_add_tail() calls in the bus_read routine * Utilize HZ_PER_MHZ from units.h instead of a magic number * Remove unnecessary err < 0 checks * Fix typos in comments v14 * Add Reviewed tag * Copyright ranges are now "2021-2022" * 100-char width applied instead of 80 * Remove invalid dev_err_probe return * Remove "spi" and "dev" elements from ocelot_ddata struct. Since "dev" is available throughout, determine "ddata" and "spi" from there instead of keeping separate references. * Add header guard in drivers/mfd/ocelot.h * Document ocelot_ddata struct --- MAINTAINERS | 1 + drivers/mfd/Kconfig | 21 +++ drivers/mfd/Makefile | 3 + drivers/mfd/ocelot-core.c | 161 ++++++++++++++++++++ drivers/mfd/ocelot-spi.c | 299 ++++++++++++++++++++++++++++++++++++++ drivers/mfd/ocelot.h | 49 +++++++ 6 files changed, 534 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 a5df3b0b9601..90a873dd04b0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14745,6 +14745,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 abb58ab1a1a4..c3dd1fe8d8c9 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -963,6 +963,27 @@ config MFD_MENF21BMC This driver can also be built as a module. If so the module will be called menf21bmc. +config MFD_OCELOT + tristate "Microsemi Ocelot External Control Support" + depends on SPI_MASTER + select MFD_CORE + select REGMAP_SPI + help + Ocelot is a family of networking chips that support multiple ethernet + and fibre interfaces. In addition to networking, they contain several + other functions, including pinctrl, 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. + + To compile this driver as a module, choose M here: the module will be + called ocelot-soc. + + 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..0004b7e86220 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -120,6 +120,9 @@ obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o obj-$(CONFIG_MFD_CORE) += mfd-core.o +ocelot-soc-objs := ocelot-core.o ocelot-spi.o +obj-$(CONFIG_MFD_OCELOT) += ocelot-soc.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..1816d52c65c5 --- /dev/null +++ b/drivers/mfd/ocelot-core.c @@ -0,0 +1,161 @@ +// 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 +#include +#include +#include +#include +#include + +#include + +#include "ocelot.h" + +#define REG_GCB_SOFT_RST 0x0008 + +#define BIT_SOFT_CHIP_RST BIT(0) + +#define VSC7512_MIIM0_RES_START 0x7107009c +#define VSC7512_MIIM1_RES_START 0x710700c0 +#define VSC7512_MIIM_RES_SIZE 0x024 + +#define VSC7512_PHY_RES_START 0x710700f0 +#define VSC7512_PHY_RES_SIZE 0x004 + +#define VSC7512_GPIO_RES_START 0x71070034 +#define VSC7512_GPIO_RES_SIZE 0x06c + +#define VSC7512_SIO_CTRL_RES_START 0x710700f8 +#define VSC7512_SIO_CTRL_RES_SIZE 0x100 + +#define VSC7512_GCB_RST_SLEEP_US 100 +#define VSC7512_GCB_RST_TIMEOUT_US 100000 + +static int ocelot_gcb_chip_rst_status(struct ocelot_ddata *ddata) +{ + int val, err; + + err = regmap_read(ddata->gcb_regmap, REG_GCB_SOFT_RST, &val); + if (err) + return err; + + 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, REG_GCB_SOFT_RST, BIT_SOFT_CHIP_RST); + if (ret) + return ret; + + return readx_poll_timeout(ocelot_gcb_chip_rst_status, ddata, val, !val, + VSC7512_GCB_RST_SLEEP_US, VSC7512_GCB_RST_TIMEOUT_US); +} +EXPORT_SYMBOL_NS(ocelot_chip_reset, MFD_OCELOT); + +static const struct resource vsc7512_miim0_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_MIIM0_RES_START, VSC7512_MIIM_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_MIIM_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_RES_START, + .use_of_reg = true, + .num_resources = ARRAY_SIZE(vsc7512_miim0_resources), + .resources = vsc7512_miim0_resources, + }, { + .name = "ocelot-miim1", + .of_compatible = "mscc,ocelot-miim", + .of_reg = VSC7512_MIIM1_RES_START, + .use_of_reg = true, + .num_resources = ARRAY_SIZE(vsc7512_miim1_resources), + .resources = vsc7512_miim1_resources, + }, +}; + +static void ocelot_core_try_add_regmap(struct device *dev, + const struct resource *res) +{ + if (dev_get_regmap(dev, res->name)) + return; + + ocelot_spi_init_regmap(dev, res); +} + +static void ocelot_core_try_add_regmaps(struct device *dev, + const struct mfd_cell *cell) +{ + int i; + + for (i = 0; i < cell->num_resources; i++) + ocelot_core_try_add_regmap(dev, &cell->resources[i]); +} + +int ocelot_core_init(struct device *dev) +{ + int i, ndevs; + + ndevs = ARRAY_SIZE(vsc7512_devs); + + for (i = 0; i < ndevs; i++) + ocelot_core_try_add_regmaps(dev, &vsc7512_devs[i]); + + return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, vsc7512_devs, ndevs, 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"); +MODULE_IMPORT_NS(MFD_OCELOT_SPI); diff --git a/drivers/mfd/ocelot-spi.c b/drivers/mfd/ocelot-spi.c new file mode 100644 index 000000000000..0f097f4829d1 --- /dev/null +++ b/drivers/mfd/ocelot-spi.c @@ -0,0 +1,299 @@ +// 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 +#include +#include +#include +#include + +#include "ocelot.h" + +#define REG_DEV_CPUORG_IF_CTRL 0x0000 +#define REG_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, REG_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, REG_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, REG_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 spi_transfer xfers[3] = {0}; + struct device *dev = context; + struct ocelot_ddata *ddata; + struct spi_device *spi; + struct spi_message msg; + unsigned int index = 0; + + ddata = dev_get_drvdata(dev); + spi = to_spi_device(dev); + + xfers[index].tx_buf = reg; + xfers[index].len = reg_size; + index++; + + if (ddata->spi_padding_bytes) { + xfers[index].len = ddata->spi_padding_bytes; + xfers[index].tx_buf = ddata->dummy_buf; + xfers[index].dummy_data = 1; + index++; + } + + xfers[index].rx_buf = val; + xfers[index].len = val_size; + index++; + + spi_message_init_with_transfers(&msg, xfers, index); + + return spi_sync(spi, &msg); +} + +static int ocelot_spi_regmap_bus_write(void *context, const void *data, size_t count) +{ + struct device *dev = context; + struct spi_device *spi = to_spi_device(dev); + + 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, const struct resource *res) +{ + struct regmap_config regmap_config; + + memcpy(®map_config, &ocelot_spi_regmap_config, sizeof(regmap_config)); + + regmap_config.name = res->name; + regmap_config.max_register = resource_size(res) - 1; + regmap_config.reg_base = res->start; + + return devm_regmap_init(dev, &ocelot_spi_regmap_bus, dev, ®map_config); +} +EXPORT_SYMBOL_NS(ocelot_spi_init_regmap, MFD_OCELOT_SPI); + +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; + + spi_set_drvdata(spi, 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 / HZ_PER_MHZ + 2) / 8; + + ddata->dummy_buf = devm_kzalloc(dev, ddata->spi_padding_bytes, GFP_KERNEL); + if (!ddata->dummy_buf) + return -ENOMEM; + } + + spi->bits_per_word = 8; + + err = spi_setup(spi); + if (err) + return dev_err_probe(&spi->dev, err, "Error performing SPI setup\n"); + + r = ocelot_spi_init_regmap(dev, &vsc7512_dev_cpuorg_resource); + if (IS_ERR(r)) + return PTR_ERR(r); + + ddata->cpuorg_regmap = r; + + r = ocelot_spi_init_regmap(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) + return dev_err_probe(dev, err, "Error initializing Ocelot core\n"); + + 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" }, + { } +}; +MODULE_DEVICE_TABLE(of, ocelot_spi_of_match); + +static struct spi_driver ocelot_spi_driver = { + .driver = { + .name = "ocelot-soc", + .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"); +MODULE_IMPORT_NS(MFD_OCELOT); diff --git a/drivers/mfd/ocelot.h b/drivers/mfd/ocelot.h new file mode 100644 index 000000000000..b8bc2f1486e2 --- /dev/null +++ b/drivers/mfd/ocelot.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* Copyright 2021, 2022 Innovative Advantage Inc. */ + +#ifndef _MFD_OCELOT_H +#define _MFD_OCELOT_H + +#include + +struct device; +struct regmap; +struct resource; + +/** + * struct ocelot_ddata - Private data for an external Ocelot chip + * @gcb_regmap: General Configuration Block regmap. Used for + * operations like chip reset. + * @cpuorg_regmap: CPU Device Origin Block regmap. Used for operations + * like SPI bus configuration. + * @spi_padding_bytes: Number of padding bytes that must be thrown out before + * read data gets returned. This is calculated during + * initialization based on bus speed. + * @dummy_buf: Zero-filled buffer of spi_padding_bytes size. The dummy + * bytes that will be sent out between the address and + * data of a SPI read operation. + */ +struct ocelot_ddata { + struct regmap *gcb_regmap; + struct regmap *cpuorg_regmap; + int spi_padding_bytes; + void *dummy_buf; +}; + +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, + 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 + +#endif