From patchwork Mon Mar 7 02:11:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 549071 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C3CAC433EF for ; Mon, 7 Mar 2022 02:12:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234696AbiCGCNY (ORCPT ); Sun, 6 Mar 2022 21:13:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234689AbiCGCNW (ORCPT ); Sun, 6 Mar 2022 21:13:22 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2099.outbound.protection.outlook.com [40.107.93.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7160E5FD5; Sun, 6 Mar 2022 18:12:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sp5in53jzu3wnn/BdskwppXLK5zC1hLjwSi+XzYnXJttrVA/to2DcNE93nJuOzh+KdihQg1aY3KhNoKbc3mCanwpRte+rPcUPSgNUeJBpY/cW8JZNS/0PTbjbExzcm1CHaWyczCo3L2EUc/4oDpRO5iqxVDpDafMKK+QfBeJjLFQEPcpPJiquKomB4osWrCepz6ZgE1zSmZtiDyyWKr//2+gCUfE4Agw7xOmi/576twnOZ4m7Ngp6JKWtETM1ESXw2JKa1V5ukSYMpzLn9KhMQ9eMBwTV8j9G1Ma1Vwxz+Sbyv/dNeIhBtdHcFtFZjNuoSDT0ewLoNUeoQLcWJUcmA== 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=7hJjodq4GG2vfBpX7f0GbXAm1LzTx1uG4qV88Nu7HeQ=; b=SUr4K5r8pOKnOTR60BJagQwDsnRWR5Lgjomris4x4Ob+EXvMcVV1niExf3r2DjUHK1aYqtFHn3P8ao1s2T3ai9p70R4BIgtszy2uwnQFZ1D/1sweuJpfDTOJwXjWTpxSimH0QJfg0JXlcP0YFQi5LCAluYeDyEvzdbjNA2Nmfiw9ZpYxywJUkCkky2KUDr30ExDwxeGTD8ZdFUOCpNilcFxRi8lmamE1COuWZisZzpqQzVENRez3eHwmMYAETHZJBzbI7NRMRrhJVMy/mnloC4FggNc3fC1t4ocnk/Ld1lNZN2TD9QHo2WwBcElYKWX+RW6N3ccbUAnGvoQot1JKyA== 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=7hJjodq4GG2vfBpX7f0GbXAm1LzTx1uG4qV88Nu7HeQ=; b=gqsP51+Zjnbe3bv5+1Ub96PkqRTXZzM75QTroBJeZ06PnobUEuh8poNK/JcxcLtS6bwIvjmaDTXQfEGFq53F5owCENA4nYwKR944L7degzv35rD+JCX36jigfDN8phZ+m/7p+XD/X2WwY6IuJVoULyxLBUWL/VKq1hzR4bz48wI= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:24 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:24 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v7 net-next 01/13] pinctrl: ocelot: allow pinctrl-ocelot to be loaded as a module Date: Sun, 6 Mar 2022 18:11:56 -0800 Message-Id: <20220307021208.2406741-2-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: 368ea0e2-ea74-4207-f379-08d9ffdfeb6b X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UUbaUn/JSdyNFaOwC0O8EbloTeF5ay9WEMpLR/pXyAZLtjiSSJQ/KgEKS4Fwkrg8Qm9ziRY8oANLflgZrkR54mkUyCW1k8mSpR6SgoD0X4ymQ1kePu6mkyv4tVbeQl6k+j7urV/DT7OXfMUngPi7U7dARFmLwfDmWGvLwkAUir+3YT9+9jU79Y5cCX4NMNv10dvlL4dr3hLWJixM0WDwcuY4m+ULM1eFn7R3ZLMQew6ZfR2LCWv7znJFDMd8m1St6QelsiiadalbzPaW0IpEWZnekW+i0TnDjMw40YBOL7QIGj+T5ZK7GXzCIZHkpafZfESL/ACHkYY36Qr9yFjJq+swJa3q4SRChUdw88ByyPGE06i+oMQYrlLjeDjtr34OyOGNYzwlHHzI/xwMvigcfvEALJFlLFX+2+VIDDxCPiDQVqC0ohetpDNKjNerldpDTizOi+yXJNAUTk687V5O64dvwcaoPBbfNsHA6+XMhJaMw103gXH3R7yY3cuNWejJvQNr8TVAV2Q0EinSVyiDFT3yLNMY2EotedJz1rbuZo9G/CYVS/pWOSV3DK0IbT4m72uM2CwRWdxIRI1/Ip08cXKx84wDLCYirKkUSHkcpcJz6oJelr2vxOqPbEzM5UZXjPLg8AIGnMMLaCUlEWsmpABp80+7KXTenWi+4QqyF6a6ae8qx1APiAeEhZIVRozNwxg5EL27xllpt0AHqWFmbQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(376002)(42606007)(396003)(39830400003)(136003)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(83380400001)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3qzHTuRyKd1Gm2tnhmtNWP3uve3W0JA1up2TqRyWG+n4XIEceUu362Nn2aUVFLAMU8x/AFC//eOvodPPBwEGxIt8YCmFG97W2e7fm9Pw+X+F3XItLfsYa3Av0HEJSO+jixoUoU4Hp2QSHa5s5ql7ROrvb1QFaqCxLfXazBvPCRLNwSNcYk7PafZMS9hxtFow9Uso1waViy6zlxeRn9BbXbHRYlBJsiv0j0Od+ddoN2SDb5WbIpbNGaK8nX1EmnwR4TW4K2nfbpnA03E0WGpWsebHFmNNy7Hu8PG9/SnYMbN6UFV5mQLGAWD/FdJbqe5WWvEIwg0JRcpyqAzbd2UK9hdIIfg/Bec/OiO+fnV8pGGwjizDv1iGFvgPgMeKFw/b6e5XqFnRcy0DEARGD/HgCD+DzvRfz+uNsUHt3pyliewWW2ZWfmjph448Pss1lE9WHGXCzHH/3KKN0XpLZBqRc+Z76/utfaD4eCc7mZLAgHI+oahAlHBbNZSHWpHj+nl4nFhBy4aKHSm9gAni4nyU+0JGi0y/YnnPwR3K34UMMYjFDqiIT5PRps+Yvd5sNrespOrtQEFaMH7s5ISX/0eYUqBVmz7rwCgcamLew3PEzprLQy1xk1DzGtNktWkfOAqBGa1JEjrNkC6ot7wFe43CJjhdBrzL29AGLVDRUyQepyjUUdcrr0EBnPPzVRt9LbTzKLxUDeHW0pBsYtG/LYEndrzkA70cNurmbB1/OrnIOAxbXukMmKsH85UsS6GwNBhJWE6iiFBimGDlIv1VIL2o9h9jRxdrBZBzk2QZPnT7gXglEUbdmQ0C0MVyOns86afHUwqZDY66cO9ngu4Jn5sgPsSH1RP/z3mJ5z+hXf6GbriMr1pz9zB2y+xHpZtFzFmn1yoQJlQgopNEhAOXR1CoNpxzHUklFVBIb1VNEsjDXD4ezAXLA8hTSjSuY5uTiAPXx80u9HHK/vVEedk5CM21GaViQIsiyT168g38KebXTGNLqOOAe220lvA9KVchDrSpId4gQvq922n1KPE6jAD5pVDTHIMpXmffYAaw+2/RwLPXB5BzLuwC0UcCQd1lunTE8dQxBdTNs92JiemjFXyrOAslU76mnxvmGc2dTQ5fKkoHAcBJUR+c2MZIqUM6g0i8AFQsUwRXDqWfR04enbh7/IBGHV3YwxkbprgIDho3I3PwScCj6gAF3n/PL6dbOaxmmSafm9Hufo9ttxKoCOH7QHqUPVIuE9NepUvmlD/geCC8Gyr+aw7fNfZQ9YAcDA+ceq3kOrZg6wAjryvZm15+DcE3dXwKskYuZCTz4/cx8u5+MrMXkKku0J6k7hXl3IUQobtz/YrglG/Vpf7nVkQVl+a0CZrhkUCGuzq6qvd47N1ciUttdVCVjhbGAxpB+6GhUypN02eG/oZrC4DSUlG6w5Q7pchRivr2X0gZTBPZgxg+SJGtQCZntkbqO8qipR9XVzq8znOJ+TQOWGUCYtPs097NPJOiRstx1I4x8aYhOtSR2EkG4WUlGPPk3UVOL/nDP//E5HqZcmiVcyM6JqOdXpq5CxjBuzjqBCTl1axiaGqeCnHCVi5OmQYaOIsMSku/jcDJjcfkdanxS9E1XMDhBPuVV8uyl15Le2WqVAkiTgGbHkjqgsYNXYLVAiupX3P/aXbOKNDWhPwSWRs+vPx76g== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 368ea0e2-ea74-4207-f379-08d9ffdfeb6b X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:24.6833 (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: M0QwxKWa/0jf93JCN0Q+CuiEt6GXQA4TNzwF9q76J+ScUYMNdu3yHwbLDefdbBT+gu+Osux7/322sAbXOiMPSxQbaRokVuHyu3j2duDdc+c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Work is being done to allow external control of Ocelot chips. When pinctrl drivers are used internally, it wouldn't make much sense to allow them to be loaded as modules. In the case where the Ocelot chip is controlled externally, this scenario becomes practical. Signed-off-by: Colin Foster Reviewed-by: Linus Walleij Reviewed-by: Florian Fainelli --- drivers/pinctrl/Kconfig | 2 +- drivers/pinctrl/pinctrl-ocelot.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index 6fc56d6598e2..1b367f423ceb 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -311,7 +311,7 @@ config PINCTRL_MICROCHIP_SGPIO LED controller. config PINCTRL_OCELOT - bool "Pinctrl driver for the Microsemi Ocelot and Jaguar2 SoCs" + tristate "Pinctrl driver for the Microsemi Ocelot and Jaguar2 SoCs" depends on OF depends on HAS_IOMEM select GPIOLIB diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index fc969208d904..b6ad3ffb4596 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -1778,6 +1778,7 @@ static const struct of_device_id ocelot_pinctrl_of_match[] = { { .compatible = "microchip,lan966x-pinctrl", .data = &lan966x_desc }, {}, }; +MODULE_DEVICE_TABLE(of, ocelot_pinctrl_of_match); static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev) { @@ -1866,3 +1867,6 @@ static struct platform_driver ocelot_pinctrl_driver = { .probe = ocelot_pinctrl_probe, }; builtin_platform_driver(ocelot_pinctrl_driver); + +MODULE_DESCRIPTION("Ocelot Chip Pinctrl Driver"); +MODULE_LICENSE("Dual MIT/GPL"); From patchwork Mon Mar 7 02:11:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 549905 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC19CC43217 for ; Mon, 7 Mar 2022 02:12:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234736AbiCGCNq (ORCPT ); Sun, 6 Mar 2022 21:13:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234693AbiCGCNY (ORCPT ); Sun, 6 Mar 2022 21:13:24 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2104.outbound.protection.outlook.com [40.107.93.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECDE313CD1; Sun, 6 Mar 2022 18:12:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hPnVwdvcnByp319qsuWGSlyWxXWIMt9jhIpeacuSnR5dZHLeRV298Fg3J1F9iXA+9eoRC9VxiUdEAvQo2rLP3jxijOZ2tJWIay0BkSail2E16DHfZTUTSRz8gn+j/QbOcX5lAx6DF9ewUxubLwr0LL8hay0eba+NCiXZ9M+LjL2gPaHfGT/IBo7/TrcCWqXToHOGkf2493bV6LOBvpPn0WtZNa4TDG8p5c27QxtR7D+Bnyi0cu8jqpkpOGCG1XevXXhN0N6C/smVSFVBxOj37EsteDt41cLPNtVH4CFWU2PfXNhL7H9vf5iG5Sfj3fwiMvTpf9B97D7ZiSgu10sN5g== 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=dZDWo92VHFVhBfNmNY04LIkL62bcm1O6DKC1gANq4Oc=; b=EGU1+/F1/pM+d+rQ+x4d0iudpak0VXX/AocmH+shLiy0GxZF+hWTnJq4R4yD400Lx+KnboZIfmo5UgNof/ZJUoLdcdZCLodcaakEM5E7MQwmIYeYCu8dU19wH2MH7XL0aLEj0y8gEqW79ctWvFkMnmKKmEE84KV/U7OPKAg4vmhB4PDPtz3Vy0OWag6cZlNby14SpwI9ny1CdiFVY8h5rKCxRJUfNzrdRfMRPWeEuRUamIaXcsnEAW3I/eP7zw7HuXvOgJ52FvplNzFyBuTqSndGlO9lN/X9G43zidXq426iU1qCtZ3Zo4jt+Az3C9DCN37MYiZ4O52t1w+HfOM+hg== 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=dZDWo92VHFVhBfNmNY04LIkL62bcm1O6DKC1gANq4Oc=; b=wM7RLsuDQwIKJmiIvcxpR/oi8ClqHXoVkeuptA+dDJvPOpXKKvUxTGX4Wr77d0IiV3uWZGylZUKrZq8IoDoLgOcq4vgJlGRz9/hRLktOR75meC0AjxhGz1Ixh23YBrprn/qZfYt46dyUDlahvuWQ/P7HbzEMUZipbUQWbp3FkVg= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:25 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:25 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v7 net-next 02/13] pinctrl: microchip-sgpio: allow sgpio driver to be used as a module Date: Sun, 6 Mar 2022 18:11:57 -0800 Message-Id: <20220307021208.2406741-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: 629a8cde-c2a0-407b-99b5-08d9ffdfec17 X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MiEZizXy0Pl4UbElPYpeO5wNyvdRxB0XTNyAJjoYDb7YhVhGjzEdw/QHxkHlZYFVXFZn/td9aH2zwsQKd8jaRTz0p9oPZZ0TbIoE6BVAAlZgr5O4vUFicedanrEa+okNPjUIk18wuXDxTnXBLszgLtdwPTg902Z8hl9VJjkzCaFQD6/Xxkmk6jH/hSoKl7xGLqMZS/huDVxLDUasRh6EShyI3dmeRmNzrsp8Bh3hk0kKW6ZULc6zGDxW5BEoA6+jHF8knDwXW57j+HM8EQAbCJfYS1zWkERc/+8BZu/oAwo7Oodq86fqlSgetneWmitFgef+ADHmsJv+2hI32NN+aMZO9htKqRcJVrEElss+g9nq3mkMSDkvUYdLrFaNd1QFW7eh8Q9zsCsnwJ6H4lGtFb0o1h7O589B0WHBKEJqaE6sN69quWK84BoWTQbTGRcxIJkv+q8//2Jtwy8UZ66uFrzwh3wdZhMj2hbIiVXhXaejvzg4iJXHrZRwSa9lFuDfoxZrVPl3HK8WDV7t3N+1lyvhNKxvOyMMdfGeutkckcSZO9/tbLm847Bxq72LfwzfCastwZjIj8sMeu+Nu0V1XE+Z6gmn7UHWaGxAqb4sN+6dgpIf12x87Wtc3Yy/mbJcv0vU2facU2ttWY5U5KOfl+xnViu14cXMtV3bB7ioVVs+tv68twEg8Ykpf/8PhpWT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(376002)(42606007)(396003)(39830400003)(136003)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(83380400001)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OxEe+1Wo6XCOO4OXpW+zHbTBtcIKvOcndgmD1nH1YRLkGKhdSSCf4g8sOpT3TXIimBXcnUTs/cV4Mzs0CbePP7S/2MKireLKOWsUWGVpQVaNOQv8wOQEzmts1zyZpCQtYAAYpHuLNjYrRKntShfjGdemx2flLIJoVml99JL12AQPTVpRckwoEx0Bt7Z4mvuc14dmZ52LxkT/hJLu5sFCw4SNkKsIFQcv1yGoQ7fsVUg2MMRmUhQcP2wQoVjiHyzVY/ZmxygEh6kvmrvNxJu3K2ldDKjxm8jn0LUNmJpE6iFg7bd5nIVcE9F/6LadoH7ZpX6GPGgaM1HsDf7O2/IpZ42EyWSC00k9Fn33nieIuJCbrhFgWa/AE+FcG4fnLwNZt5Sx2PYTdLfPQgnSPiyBRxJ/yVoXOzbfYl40mQ8nWVbBSYv/VIw0AUgKgoBQ+y3qYI7mXOS9yPnd17tgw2VnA9IsykYA5h/6wJDuonushLa/3FAcsZIYbNNFe6y28w+xXE7WuxpFjsXlJYBVL4t/xmWGu/eI+I4/dXbQfYZvj0FxiYSjB3MMjqkWQtffHQq1S3WlQQHl8OacMe1Au5bDussJlK2UkSLF+aFWkhm7StCZAPHjbciN4ezL6On7Fifge2kwJZ2UHfO+SbKjfGMl49rrHMJ0oPgz4uqOHcNAA2LNt+/ldQhuM/D+hYbA36gYPJ6DOMRSdrXX4G6LNasjfIwH2jfRw2R1sX+s77XXA9UZtGsuTDvTLWxaRbLo9+9/MR3OkDTlrbCf1Yqkt8wisfr3VP0846vTF1Pqe3lAQmZ58rBMwCRgN071TAdPmavSYOVfDnXLshesDn1kDdPqHL8BZ3KztsQK7kQxTbaI5bkIIFtJwsHYhYJbwjAHhOMh1ESmshJ6nLlnz3J1Huistja88hJ1JKJXBvooFOXB7p/uyj7y9reYcfEXvP2Jhpv9zXMN5VQK8M77KkETOMRbmZWqKh8WOcRS61pTvoP8XcmSeBwDVYaH1jyT0xECIPgTq+Uojhvfpr2gPiDc9T4tTxPSG/ARhd0PsfEUrnLI73KdvajUBa1bUs0oljMhPobSNdeXPcc0HfF89CVK4OLtwe9D2STHLBLjPBzShbH2GtNF+vnmAtj2VFbKw8DsfdzfTcF1jYVUWX7FNyLDpWADoLa1BF5OHqx80uZUDxWRpZ5szZrY1f3ZCmS5+oEQNo4oOq2zy8ACevP0OHcH8yq6561iXY9Yo2gCv3CP/CEp8VYrWrCwYQBsDYqSELAbGQGVUpMuD4NuK9kgUt+XnfhNQu9Qur9XamUttJ2GvH9azV/fGqjXfQbx09HAt+bOX+hwGsfV25GHap/drm5lMoR87X/AnrG93xmujp3O0tFf3cvX4ck+MjhFwCyqLO6PJWWg0H797LVqJ+pZ8G/Ux3RfdsWveyEItTjoULNIMzgmaX+LFAqK38pY1d0dDaAgXsCTYlqJ9JiHgwdSosDNOJqU9JVN8YSO17iWsNQuo+ZoJBN5o66RmefEJZZCuT/+PJl8lRTInAzBdxjNuzSk1gE0xoOwZlCL8336nkMdiu0gWvt1jsJwTUvYaHlb7mNLzIKh4g7udvdM4D83ki7icVD1LQQkNxFdcdg/6A3c3be8WJr0eAiesOPdpuI+7HnvmVHtMHGfIDwKCnL6hPluPj3zVw== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 629a8cde-c2a0-407b-99b5-08d9ffdfec17 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:25.6207 (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: qwjwzsB9iuxwmoYwOL51QJ4l4wo8pvNNrPBWWCgUkM5UqMRpeSnvMZ0FFdDFe1dHm9fds8ega7Phux+cBZtp+WawlrjzOMGmwYnWjn7h6w0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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 --- drivers/pinctrl/Kconfig | 2 +- drivers/pinctrl/pinctrl-microchip-sgpio.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index 1b367f423ceb..7ff00c560775 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -292,7 +292,7 @@ config PINCTRL_MCP23S08 corresponding interrupt-controller. config PINCTRL_MICROCHIP_SGPIO - bool "Pinctrl driver for Microsemi/Microchip Serial GPIO" + tristate "Pinctrl driver for Microsemi/Microchip Serial GPIO" depends on OF depends on HAS_IOMEM select GPIOLIB diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index 639f1130e989..e8e47a6808e6 100644 --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c @@ -913,6 +913,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 = { @@ -923,3 +924,6 @@ static struct platform_driver microchip_sgpio_pinctrl_driver = { .probe = microchip_sgpio_probe, }; builtin_platform_driver(microchip_sgpio_pinctrl_driver); + +MODULE_DESCRIPTION("Microchip SGPIO Pinctrl Driver"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Mar 7 02:11:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 549906 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62DD5C433F5 for ; Mon, 7 Mar 2022 02:12:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234719AbiCGCNn (ORCPT ); Sun, 6 Mar 2022 21:13:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234692AbiCGCNY (ORCPT ); Sun, 6 Mar 2022 21:13:24 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2099.outbound.protection.outlook.com [40.107.93.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91AAD12ACA; Sun, 6 Mar 2022 18:12:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FnzHehcmdC8U/zZTstQSuynN4gzvj62tk6BdHGryYVSmG8krXkC3Bx48GsBxQSTytrwMZE9Zm9x4hTUNZlgJ6iuhY7Wuui5bq1xWjYvSBNOIMDPxxps8RVR0qKVLNDtcnJHvfc2ePKckuHfuspq8U2PX8M0rLrc/VGMQDNHZMi2FCe64bM6OsdBOBVjC0dNJWLTlrnzKnsHDnv6AkomRi4IPGXNnXxh1dodCTUv0P2hwAAO+KWXtCHjVOEBBAy71pUGwLZ6RHGF1kg96DpRrKbEtVLMRWDEK6wda1AzO3rrX0KsyN5eN4/ktkPSXo+ocSzVmX6gUc1VoyLA5ijw8Sg== 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=/K1s/Dm04W43wHJPNqg5IK7S3EBNyWBB4vfeO/rfC3A=; b=ETLURKINM5dROF7bVAITylzYAHrBFrXUc0xfYI1ta3E1go+XbsOmYAoqJouU9sC4cHirnAvOyXFolR6hj+/bENZv/0wyuUBMi8y/HJ3Rt+g8BU7C/hmQ/UlUhBEKSa45FgNtZLoJvhAtAW4lS+dmpf3cXSRurrbsE6I3biG7Pnph2jLZ7ZcBgaoiCrZYgAqN6rvr8PU3wqFCdUBRgY92jZ+oA358KRkgy9+6eCGBof+PgMBtbJ+jRqMh9k66qFItioPTpczR+LbxNeGA7znWEAOe1rHoTFdtxjjZNaNFZk4LOeOZYNoa5TybP/hBqQd3wT39y47+iyPXYyoOkj0dYg== 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=/K1s/Dm04W43wHJPNqg5IK7S3EBNyWBB4vfeO/rfC3A=; b=dnn3DxnaGrfwi9Q9M7uowsf3Bl18cnFcq81cbRoJmFIfSwSOMV8+9+qZ63Qnb2gvmbT76U878nL5JLlkMN72Npk9zznFY27FrVCiMFsCL9Gv1BlOWA9w1/oYKIEBQvgaK5uIl1ObfrsBtppuhy+WkKDxECzxv7YvyFkX0PvjfQ4= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:26 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:26 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v7 net-next 03/13] net: mdio: mscc-miim: add local dev variable to cleanup probe function Date: Sun, 6 Mar 2022 18:11:58 -0800 Message-Id: <20220307021208.2406741-4-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: 765ae18e-23db-4662-41f4-08d9ffdfeca4 X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xxjI0uwCQwbH+6loqTAmTRcp5v7H058x2yRw2I83iQJtae3mha9cOmXFlW96Dj9hQ7eZn880LC2FUZ6AvHmwpVVfQOYU6DrPzn+8qhfPEJrDTsg2r/I568Eyi/CYcf3un8rfStebgPPv2d+X0mmU3cs6yH3U6s0v1MSjd0dH56Ini1Z6Zm0zs+Lty28M4kg/t29fJtAi1lA1y4sCunK/vTaCLjL8wt3oPMJ6tFn3wGMOYGVk3QPGklywr5Ad5Tqqk5a3dCbODndTzxWVQJnZ1duyKLK0ZlNPRHl/+ycnpbNTl8x+kAEJk1frGBbn+NQqmf66bZpnBpfytaq0tyfJD0nQGxx2+sOYli6wvZUsE4nDaX5woesnmCy1xHv3aE27Krgvx8WFungohEru7fsxlyH2k6mDoMxs/N1lL+LD3QelQDAdHoanBuCGFDCAmZAtikiR/EO28EpGIRMBk2Y8RpHlu0ko47lZhEd/ZqB9BStNbEm8UbvmG4CAmOvVr50jf/z5VkXSoAO9wgzZtR8/NkZtJr+06DJKsAVqY/OnXXisfda6J1Za1vdQ7Z/gj6O/mSIyugUjxmhrpYtlFNvprXtG0K3Fl4AqcvBN5ctyPWSxvhFpHIj9oTlkyYpMyicA0cT+ODF8vUCx/MZsKWSqSNUSI+XobiwUOo9HgJU/WsQXabhQsBY9ZgPYyT+3HSCkzupogFncF1Xmx66EwHXtLw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(376002)(42606007)(396003)(39830400003)(136003)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(83380400001)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 68KpFdEOqHu6O3pEFNj+6pyzW/eHykfVOyhwdQSk/lVgtPOQWj+x5+5nufaAjlF+3AgBaSEz/JiwW5LN+XduFzXh8JKZaajwiaQNQeUep7wRxul0v70nMQ8r/sJmU0w0nQH8bJ+/fmr0l19mX3aegBU4tIL5mX8AO7kbV9srCYH0uRONQQUU2OQ1EIHv3FhgnUdnow1MmRtbqjYC0h+wqm495AGYXkh37MdeRBMHV30Ke1uKEb9Cka6vz9T06M7o9S1MsQeok6gL0WIIPI1f8VjkKeF818cEkbatVn1z/boBtoND0WiNWelwGJzo38Wm6ejdruPEbVnQQYhXoWVtrshQSbIdmD31j2YaCqOofJJEE0b+JCWo8F9jY/Sci2okeVj8jfNRmGY+eJTjm6WALlZEBdAeEihcCdIlhv0H6ZJe2r22vqTUdCsn8SarfTEFi3aS2ADrxnB82GshdcefEsui3lLaR8xarNuOuISKtkiOxic4e8+zHzfdslo9EttGPIciQMke/P29+Pkzolk9i1n385bo1lHaUjDQ6OK4YK3Tl9kkJaWuWZbw9Kc9PjxuzBU4cHx/YnFG3At6NYLYpsUcPlh6toYl0/03lFI3f+ZCH6v2xLicq2ilxehL4mMVbFG+q+1e5naDavdJdVoL5Zn2JjnpNZnSLUdu/eo/3Qd60ovPg4iasIE/NkV+NIqQb8vBVKqv39guKM+8KDgbvSSCyzA89j54clVrx5w21iVJlQCXvX6m+q6A7T+Lg71hkfV2R6toBKvf0ZxeibAx7m396hfI4eYQVxYkdGlkhu7FvXeFVwZZqWk5uonI3yEpMPQD03la+60e+Jf/fZFmhL3uSjSP5vHXhYmOw7gw/KF3YAdCSM+kNB87cCqk0Zjnk0XWAq4IyJBCWaB3uXOpL8zBBNsmtfWWAD0RLAlUypd+f081qDXsOaP5dbmRcux3vjWW6N/X45JaHMyF5D3s4vZh7NDH4An6/a78Ez08FuFKV4KPETCCTTciEeardUCBYra425vUpDtkd5NILRNh0BqEecposDTa/bPwYziE068m9gtmhj/SHuPyGxtHkvUL6MbLMl4kvJvQYYOkfQp3yuAADmaQpIGgF/uCvl9YPZ1aZu0vJlileE4R21aYBpA+FgyQeSH0aSEM8u8sz6zIFOzu+xkJCENABEQ5tflfAQ+6vDycrOPT+uCXJyCmstx7md2hfg0raS33WRJAJmssk3/04ubc7A4NMBQYw65KBs2yiyyYQNYh/yOWb3kfAlMewySe3BDvy1GyL41QMXf1ULwG57CWXo/fUMoyZ4eG2hlDz8Thm4Xm+am+DNXiqmLoEgQTtumYxS1MPRWYK7+zmxMCXIRg1DBSPfhkw2JKluoBDnrz4s8eealllw88Oeol746yqSk9u2xrPxeYRx9YoE/yJrPxJWS1McvF2d5LR6+bG30pw0M1HsWhK83P/TcvkTvs+MHc4UG5mKbMTb5NBHnQJ8WFsXbjhz+gLD3ynYm1p0pSecwb4LemVuYp/y+11MbgTHFE7h/628KFepFRC82yXtiaWFk3lYFOZdQDX98jkeNM2ceSiP3YTGIGfhfOCGBREmlZ7ZDscya3EvsMROtutKlDUaRgVrIIXLXY0CMUOCIjWCUViVl29oy5u+ntYfTMQvM2pQTUGSQY5dnHQQ== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 765ae18e-23db-4662-41f4-08d9ffdfeca4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:26.5269 (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: io9JRYeymQD3I9vkON7qql8QtV58FJGCAfN6qOsDz2IAT/ganyRwEI8mrcz8rcboPWXFkWRrQa3bALe/3cahOaCb7+JjY7WwqoCgXtLJbO0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Create a local device *dev in order to not dereference the platform_device several times throughout the probe function. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- drivers/net/mdio/mdio-mscc-miim.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c index 7d2abaf2b2c9..6b14f3cf3891 100644 --- a/drivers/net/mdio/mdio-mscc-miim.c +++ b/drivers/net/mdio/mdio-mscc-miim.c @@ -220,6 +220,7 @@ EXPORT_SYMBOL(mscc_miim_setup); static int mscc_miim_probe(struct platform_device *pdev) { struct regmap *mii_regmap, *phy_regmap = NULL; + struct device *dev = &pdev->dev; void __iomem *regs, *phy_regs; struct mscc_miim_dev *miim; struct resource *res; @@ -228,38 +229,37 @@ static int mscc_miim_probe(struct platform_device *pdev) regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(regs)) { - dev_err(&pdev->dev, "Unable to map MIIM registers\n"); + dev_err(dev, "Unable to map MIIM registers\n"); return PTR_ERR(regs); } - mii_regmap = devm_regmap_init_mmio(&pdev->dev, regs, - &mscc_miim_regmap_config); + mii_regmap = devm_regmap_init_mmio(dev, regs, &mscc_miim_regmap_config); if (IS_ERR(mii_regmap)) { - dev_err(&pdev->dev, "Unable to create MIIM regmap\n"); + dev_err(dev, "Unable to create MIIM regmap\n"); return PTR_ERR(mii_regmap); } /* This resource is optional */ res = platform_get_resource(pdev, IORESOURCE_MEM, 1); if (res) { - phy_regs = devm_ioremap_resource(&pdev->dev, res); + phy_regs = devm_ioremap_resource(dev, res); if (IS_ERR(phy_regs)) { - dev_err(&pdev->dev, "Unable to map internal phy registers\n"); + dev_err(dev, "Unable to map internal phy registers\n"); return PTR_ERR(phy_regs); } - phy_regmap = devm_regmap_init_mmio(&pdev->dev, phy_regs, + phy_regmap = devm_regmap_init_mmio(dev, phy_regs, &mscc_miim_regmap_config); if (IS_ERR(phy_regmap)) { - dev_err(&pdev->dev, "Unable to create phy register regmap\n"); + dev_err(dev, "Unable to create phy register regmap\n"); return PTR_ERR(phy_regmap); } } - ret = mscc_miim_setup(&pdev->dev, &bus, "mscc_miim", mii_regmap, 0); + ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0); if (ret < 0) { - dev_err(&pdev->dev, "Unable to setup the MDIO bus\n"); + dev_err(dev, "Unable to setup the MDIO bus\n"); return ret; } @@ -267,9 +267,9 @@ static int mscc_miim_probe(struct platform_device *pdev) miim->phy_regs = phy_regmap; miim->phy_reset_offset = 0; - ret = of_mdiobus_register(bus, pdev->dev.of_node); + ret = of_mdiobus_register(bus, dev->of_node); if (ret < 0) { - dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret); + dev_err(dev, "Cannot register MDIO bus (%d)\n", ret); return ret; } From patchwork Mon Mar 7 02:11:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 549070 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FB4CC433EF for ; Mon, 7 Mar 2022 02:12:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234771AbiCGCNp (ORCPT ); Sun, 6 Mar 2022 21:13:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234699AbiCGCNZ (ORCPT ); Sun, 6 Mar 2022 21:13:25 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2099.outbound.protection.outlook.com [40.107.93.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 086BF13F37; Sun, 6 Mar 2022 18:12:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cUP9f9pR6ap0C51j2Eld40ooy9TCoqm9taqJM6VscSW+F6mLaXlNHrqOj9xlj4Gcaf5sTQzi9VRESvEDhCcGHpXNrZQhG+h0gAfynTdKrCa33tLfNBPNAQn21Zd6Q9EpLnmWA1sW8DwiKSvcE2Bqzxu5SVgfML8m9ID5mu3f+LESJYFXyZUCtQkkUuKaPhOp3WZgg2zueRjbYmYgrRjXGrafe92PUdalSgI+3SRDvpKGa4YF2oKBZPFOmgrN/Xv5T7GFvCEhNVRc1qxULgNzEdNtnS7rrKLIGGuXJsJ9mRBkORHQdy1nEBmxIOi/R6d+zlpZbgMitt8dAPw78NIW9Q== 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=Gtp5giZsJLLEurrbwgIkMmIU7GBUFZ4MDvd0NQv6cC4=; b=hjWZmz4gp6qpLgMxMJ+pwkezHDGnRYt80vld8sLQIR5LUMZvKkNcWtIFpehT+yR8Wfb/47FOLNjJF3cN6uRTd6UQxDY19jOedVgpndrrAkkKNXEOLmLRkfyJkLLtBUtIl5gGGcGPMqjiZNkIRO5gU+hrpI0UwaM0B5J0ox2mrLYO0oFfXxUklQ3g53pVKIm9zJfCEc1pI0kVszDijuEI8fer+lLArBqbMw7BTtTYKOZiN06ScD/v3PpWinc5WjAvB6K15e5lCen5ijazjmXR5bLbANIEUWD6H5BS9nlz3h/ejfadxvZox3PNHX07oGixMshSMmyI4ZFkbyAHb3RX9A== 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=Gtp5giZsJLLEurrbwgIkMmIU7GBUFZ4MDvd0NQv6cC4=; b=jVeJhyJNt04ot1bHodjEbws2AId7a+Uvz7+dy/U3b9CyDmdjC1Qx/umJA1TLVAcSdij6OjHy5SWeGU3uz44L+kNhHPB91czJkqPJoLHywNKK7aTJtxc89mYhZceb4ETBxFp6WyrJQLfJ99plFOZZbKtR1kSzLiYj1NielIfefhs= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:27 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:27 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v7 net-next 04/13] net: ocelot: add interface to get regmaps when exernally controlled Date: Sun, 6 Mar 2022 18:11:59 -0800 Message-Id: <20220307021208.2406741-5-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: 13a2956e-7c6e-475e-4c7b-08d9ffdfed33 X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RwRbLZFmRrlzuGYI2Z2sV8wLRiOKRe9KevN++41XMIEQlzy9XKclb5xVO/iy70l6qb2W8nWfWciEPAhyew66s3m4Q8NVNPo/zktqkNNL0Y2YIKOAHP3Mq9LaIED5/p5zb6sF3iYsaP0DW5inNZJ5cBblXO1NGnwR5hM5tNqt6ayjQhd85zSTLyZ+ISeZks6N5VgXXLT2gH69EPFS9WGNCxCyp0W4ullT+C7ZBJEB65Q1ekh+jptz8v6yoAjfKhtJmq7wMrBFix+Bp3HlRonw5zH4Bhb2N87V2aRG4HtDfjP1HM96Mj9cCRt9INojNmUGHNeXJgVP5sHNlBwyOPGWszVTXiSkxl1SxW859Wqu84OSr14w074Q3WOFelzGxPT9nFiOEbHz266okJW2UsMpDaDOtmHWsqAHy2XBZNeT7oXA8P/lLAl3RjJRhalgadDNl6L0I9QMww0BZsixknr5/E2yleH4fFKOFzLstEw1eCcBcpJB3ljprNzcqM8TVBYQ401U6ImpNz+ymDAJQu5enn7RjdwVXq3Uag71OE6sjjeb9/YEaO05gQ50vnqtkBpraDM2E/ht40OmhD9kPINO95eFHC75Zi+CkxnhG+2JWdpYPYBCdOTVNUbfGqabkKZKJBKjoZBGdBQvTl2y+pCIv2dWMUGseEJJAXb/j4HZjDf9uzpU9gsOQeqvczJoSyhLwYsJ66MLmPS2s1Sua5IXxg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(376002)(42606007)(396003)(39830400003)(136003)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(4744005)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(83380400001)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x/0+5kv9r/B2TVNJEQy4tm6aKuVrEJWC7uKs5U7aWn4BrjFaQXaAwzzl1KXgK9YIaEA2/DYuNDwe2naer9AsO8GY37wCAqEGgQyMrrE6efkcFApASvQcjmPk5UJ1INqDpR9EQbYqqzR2ugIxK8CvrQzTzu8wwK250Ph+3OhduQPZRFxXcmO5yT7GTE+JY95o/xQO1MJlsqyiLYD+qh2sKP8Hrpl9jpzwORrFFDOJBLMwoQiU8CxKfdQjTdZ5hY7yhuWQ5tZduRs2A0HmC8qdF66PGGbbXQebQjAt2u5HEnqy4sPxY8OppfPvsHKtMqkGQVBR/e95Y5TmbTrwNnetcCB93ozmViVnbibjvWqClWlKs5it/F6429tGSOZTU7CU19zRveim6w9wXkRiUqjr4mDN8Pomca6EWukWSLTTrFGaJ1EcQEo6WW3mkNNEcV9NW7mWPIXtgmld+aXqwrTZddXEu8h+FqjVwyhnwF+sWDnSWSYg7gFabMiVHYECRWi9IdSVi1/dMIGGBHwoHNoPO/w77l4ZQaELzDZkMjIvEeiZZskgt6n+nFyAOL/Zgb/gQ11IAr+hL+5k8mFeAjgIuR7OvyOJ7q+ZI8Z0+LK8P7RBfo8lf0PVZqPnrlyT8dinRgzl3/RJKee3sZl6cyBVF97TD9CEC3UzTcAnQf49vt4W2wpIwg0nC3N9R6bcn/gErIXxpEJWkS+JoEBc3gI055VNaFuo4TLqSA3JFBcGyG1L9h6s8yxEGmQeN8zydEi7kt+wceGg5V+yfljkM/I9i7wn/wX62Ec/GyRO4pXL2YfuEzs8FzL2YpZL8FmC5IUrFpDGJ8kFbxRNQ97YoBeB1kBLJpD6lsOpKa7TsEKFJAjRVIgadgbsAbFR0LhrNigcmJpmhulBwWJOCXG6DD1BhWwply0S2AOtzOKsAURmBwNsI0Z8DDZqFgm8WyYF29L2hIskfg6gfUgFXG4ow3kWCdCIjOtIUHBJUnprZXl2gEStFlLSyjHlKPQA/M/g/xKhUQi6JF8XbCXHNYIHjshby4zXDYWE6TWEiR/5YoZDnfNaOcBnd0GOX2gx7Q9yndThipQDRrVfo8t4NiIXPfpGhh5NYVkZ/WPC9HWAP7V/d7q2QkMeAhUCpGcH//t+RmkwHW6BkCZGj1wxum+EnKSvnZ9i1OE3PEwCQozDahpc6LxJeOnIikVHw6Csb82erv2FNxSocLQJqwO4f8Q6u7MsGgPR+XkcalmocIi8nUlorUvn5ytNsY9s8QHZnqwR2fsloEn1Vwx7Ue8e4+TnPXV4fzbGOUN2dmHm30hVkTBJh9tNY/+0n9l7VBR4TRS8/33fYav19Wu/RR0rdGRQvrurTiv59suo82Imv+NjWzAXutwhiQPknZLwRT2Aojjcc+1ltXFgFEhnADHw1Ef116/ftW1paA1nJsf8m6mEwfGGf1kUoiFCBuJIpTtNBlp2WvEbZD/k7Y+6ldbkNAEDCxkB3nAkSGYSkH09VIWrsxO7G3d6x9Kqi+I7WPNxdq1ffTxubTi190aJ9udA9OTsL2BFTTFtUqEKgW7IJvWbBsIIo9eOl+6GfHtcLJwjb+ELtxoa3g/YM+uKdk1bDTwtxtoEvVWsMmMtGzLOutNdViCslXKir8QDVzSy3d49jdrAAiwYIpEHfrn1xmWBU34xJzTi6g== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 13a2956e-7c6e-475e-4c7b-08d9ffdfed33 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:27.5112 (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: aN/cSipD36UW0+AiocEI3cuSQdxpIrZTwL0MeklRme4qVp0BOekMki5uLSXJvksIlxbWvrVy7Y1GxCKf00SdFaiw8Hb1dvAKsEBlbxgHuDI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Ocelot chips have several peripherals: pinctrl, sgpio, miim... If the chip is in a configuration where it is being externally controlled via SPI, the child device will need to request a resource from the parent. Add the function call that will be used in those scenarios so that drivers can be updated before the full functionality is added. Signed-off-by: Colin Foster --- include/soc/mscc/ocelot.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index ee3c59639d70..998616511ffb 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -1018,4 +1018,11 @@ ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port, } #endif +static inline struct regmap * +ocelot_get_regmap_from_resource(struct device *child, + const struct resource *res) +{ + return ERR_PTR(-EOPNOTSUPP); +} + #endif From patchwork Mon Mar 7 02:12:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 549067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA903C433F5 for ; Mon, 7 Mar 2022 02:13:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234733AbiCGCNp (ORCPT ); Sun, 6 Mar 2022 21:13:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234707AbiCGCNm (ORCPT ); Sun, 6 Mar 2022 21:13:42 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2104.outbound.protection.outlook.com [40.107.93.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48DD213FA3; Sun, 6 Mar 2022 18:12:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C1HgIWM5h0U7YmxosaJ1G3PUXBpUW6+ywSHAhBE1NYxiFQ8PtQW2QxtJzl7T+ch7kf+yLdfrIcWjQ8OKNXCQ7UH0BCxE6fWW+YB9XO6tEmfXp+kD1j5ODucjXK7HVlXb2Y1DK/dQXAajxUJNFHW9PQ3Bc/0oyT1+vh/Xvf3UMdTlsc96K/p1J+fatJSG6+IqOVHslNhyy1YCi1tJ8YIGosSRvMdE8jQNxu9TMTjhqICantak18xRnp6gjE/R0atFtshtRhKKphOGIhHArttVZdnxmxUb3JUp9RX/6wUtB10bObIIufWv9Y5ONanyCoYskHPO3RVlTtNgCtl4l+jc3w== 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=Jx+bEg3/V86ll2U6awGJJji855slUvKisl7sgZqnl90=; b=hjkrG+Cr3ib3rI3Wlf0Fd8VqFTb54dLuNFKu2LnHnKeCvyA80XJHkt0VYDgxQjiZfyL8efcwHLUdbIkzCzRfkv36tseRccHicxj0/qigHBhvhsH3dWUgrhpW/2N9PLhMSe9YYUt7AmEWJNNG6e22nbj/T5pv0XrOLVWD0Yfowa+CbYUdyRITgHEkMilNhVVgh60vPLqRnubRkf85PvgpvcxNCalTJTDPx/zMzJqOdTkqbP/bC6pAU5vkkWEffQc7qYZ2SRTtlgx7ThpRxMvxqA1Za0KonT5L8FxzKXIsKpis46fmo0nDxoan6mt/kbmPqEC/fajZimsvAu0zFG7vaQ== 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=Jx+bEg3/V86ll2U6awGJJji855slUvKisl7sgZqnl90=; b=OwFyJY11psDVvkv7vrV7gKpBuxjct9xbT0Up5vG4skjm4Nm8/df4Wupo14rZ27/63R8jgozE4JNY9DThcWqfo2OSqokUWaW859DNzCvHmaTkLvKd2uxFj5zn8hFkhi3qLBxbwRnui98ILsV08nW0i3votF8J9dYbOBOOzvGcyAg= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:28 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:28 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v7 net-next 05/13] net: mdio: mscc-miim: add ability to be used in a non-mmio configuration Date: Sun, 6 Mar 2022 18:12:00 -0800 Message-Id: <20220307021208.2406741-6-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: 5551d089-c2a7-4682-b961-08d9ffdfedc4 X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uL9lvdTHmBUEmfmZhytsN7DBNNdPmpu0kDMoLSUgNesz/iDz5SoyQpXLfMdHvm1wR1EadoLbarCmiBOLiez5Ezvul7H4dMsjzXviHHVZ1z55Bljxbh2M3Pb+uT8WakidODsdXesHj5NXBQLTGZIUarzxLewW3gQYZfDvyRI95EUtUIK7gcta/RsQvj9Jx56ooEb05Kl8hRtX/b5ltKIHAMmHl4owJaZTigwRYOEjcrmIYXiFS3DWSK1jcH5eSzoSrSoT09aefMbdMgEm9lVQKK80C3T6A6HM1ljf2vSZ8GsyOegcVsflsonSTWirFdON76g0t4PaQ6EVlcimsd89NoLMq3tcwJyUjPaldxAtpmZZRjW+ml8dJpYoKE3PSeaAV8AgSfVg/hHsYwq83Ez5iin4fP+tHM4RDY0gLwUffjiaaUcUY422vHnhOPoofcibsQ58RKLax9XP0CHhazAWkSnlnEO7GjvWqEhHNEgxg8GY4SrwichaHJ0HoZ8c4zQaqm9plcPOkD1xW8htO/U079jXHXZ2sUL4ZToqu4Jk7YAalT7TadED5814RHT6evzB8/E0vnbuZDrUicRwe/+dK0u3xIv+bvi8yQ4Kq7peI/1ywLgHa/u9YRfJ0nqPJ5E2GrXtOx54Dx34n/YIZHp1fe1s0V0OUo9WU3+XDLdgn/r/9QPw50V0mtgqh8xFYsF93roiKnbVnR5MzR9oR6HhTA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(376002)(42606007)(396003)(136003)(39840400004)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(83380400001)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: J0vFyTHF2ESUj+wSwdPf3+gBKpNmjY2SyZHVE3u5wx8NVbqKEkkaHJtiaKJCVGjnWQC0LgbglJFdOB33CVJ4T7UrIB1nDRnXVFb8qtSZizP8tOK7VFshvm7qaLn+s6XRDuHDZ8TUodIUyQQoKTRUBceNha3aVup7gAnyQVKhsLQL+FXtRB47jEnR7sKT9AzZfR36kmOjXjoF0kTv9ZOz+Jmqjk+6nUX/DZ/7zKnhAPWcOIv+4PCrqJPusXmYRCi622qV8XL7ExD4ZUCOTZGMNrggyzUAumDg50vPghEqBZ40QTIa+HpFr488qTpE87SGxYIXtZcfMjuNdIi2KsXHPkHbvWBZ/SH/gz8vk2E87Flg/y67YWp5XAsdI9G2NsQ06YrDlH4ROD4UxqPD5yOqH1GCc9kdp5GVJkVnTud0kL5/AY0rgZheTDpsgXEsZAUXiP9MYu09ak2hTTWM/6G8/gH86DjxWvbLJrRNVDgDLWZFNnXU5XaiRxqWTJW/yJmVLIsA5n3eDmW3yP7ITzO5H4+fyyyqyd6Hw6hRMVj10lFesD9kl0sdtW6MKN71yoPSPpKF/8rb9lq92kqZgfIUlxKHddoVt2mWhlLfadw5iX8bfFm0b6/gowLKla2y6YO6i2Amj9L3xYNBeEeLHdnrktOkxVbvddeehjIlbPr7roAiS+P2ARr9cHfq5ECSS8B+J/9el9p5N2vKXTIaIzWKHap5wcOQLHoCOyCfh7/i388fmkKoUUwAuNgLjisQ4XQfllMi5sZZts+z+lqVWaVWZ7MrLzlmYhMPfnT9dk9Tjv07eVRnDNdnburFh72YpA1LxckiVoiAKvZVstUZHvmS/hiIz1uQ79Qm2QUUrvR/SwZhtMBPfddYkqWnGjwMCfag40Na/uemdF0x1zHJUKqItXBA+Ns/WkZQqNM5obE0hMsScFr0CKYjyywjjB4wpZUvgv7urwNMG/8hMkYGATzBfWsdnFMDKoi9w+V8BpJ7MZd2LNeyWM8WvHhN1oWR9NFdvzgucTvsBsH5BrlBzB7pxSTsucTsubqEbyEJlSq221O5vAVxmwU02YYNVfgesa5FZfpqkqGJuiw6Tujhet29Mq84lCgu0GKVPOIwtY2x6Zk5OHpn2ynVvVloB2p+J85akuDwg4oCJWZ05zqo+CLTZ1SiwbiNxiGkzqVz6oxEVBx6tlEQDw33MBVTtBXxm8udEXYwlOUlsPdTpVGcVgrnHjkCk6fwSYZ/3iu2ksGwamlZx7AOtUkQucTr8cqthxtbyn509sMRqaHNCiL+rnVtjM0yNF3tuJCuZ6SDiTYaaQLX1glx0DGdd7uZRymeQhp8bLxTkcAdHn1TqKt/CY1zvsozmv9FcvXnJsNrJStD0Ur6mzzW6jOX6C6F2mZRAXQpJKoG5Xk5Hg46tDYW8mdNUUf80BFjTuI6Zif7JGzaV9Rg61twMjqreJKaRhiAOAw1xmvr0FahaenHsPFNYk854DKn+X8cs4IEDb/ZiItqbtNj7cAzJ/NrTX3Hy0eiHJcIAVRB8gTnlZa7e1Z8oWxVvQbjDUrldKrHD0vJnjlRP8nxJmZOmevQn9bNrZ4SDK0bWKLKH7QMgfGX2W0m8rWB8Yz7T/FupePfKnUl9rZ/VMJQWDcnkksH3esBB+d05k6fQAgYIBsLn+iVLIv94qTftA== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5551d089-c2a7-4682-b961-08d9ffdfedc4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:28.4330 (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: o9tJVCLGsROdW/dic4OjF+Cz2S3UJ+FlxIG4KeHzf1xgcNJF3yuAYoXa9D20d1keHvkHbKK5G0ScSTRkNhK4SX6SJDX64sTJ93i1rMeqGy0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org There are a few Ocelot chips that contain the logic for this bus, but are controlled externally. Specifically the VSC7511, 7512, 7513, and 7514. In the externally controlled configurations these registers are not memory-mapped. Add support for these non-memory-mapped configurations. Signed-off-by: Colin Foster --- drivers/net/mdio/mdio-mscc-miim.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c index 6b14f3cf3891..3153bac874fd 100644 --- a/drivers/net/mdio/mdio-mscc-miim.c +++ b/drivers/net/mdio/mdio-mscc-miim.c @@ -16,6 +16,7 @@ #include #include #include +#include #define MSCC_MIIM_REG_STATUS 0x0 #define MSCC_MIIM_STATUS_STAT_PENDING BIT(2) @@ -229,11 +230,20 @@ static int mscc_miim_probe(struct platform_device *pdev) regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(regs)) { - dev_err(dev, "Unable to map MIIM registers\n"); - return PTR_ERR(regs); - } + /* Fall back to using IORESOURCE_REG, which is possible in an + * MFD configuration + */ + res = platform_get_resource(pdev, IORESOURCE_REG, 0); + if (!res) { + dev_err(dev, "Unable to get MIIM resource\n"); + return -ENODEV; + } - mii_regmap = devm_regmap_init_mmio(dev, regs, &mscc_miim_regmap_config); + mii_regmap = ocelot_get_regmap_from_resource(dev, res); + } else { + mii_regmap = devm_regmap_init_mmio(dev, regs, + &mscc_miim_regmap_config); + } if (IS_ERR(mii_regmap)) { dev_err(dev, "Unable to create MIIM regmap\n"); @@ -251,10 +261,15 @@ static int mscc_miim_probe(struct platform_device *pdev) phy_regmap = devm_regmap_init_mmio(dev, phy_regs, &mscc_miim_regmap_config); - if (IS_ERR(phy_regmap)) { - dev_err(dev, "Unable to create phy register regmap\n"); - return PTR_ERR(phy_regmap); - } + } else { + res = platform_get_resource(pdev, IORESOURCE_REG, 1); + if (res) + phy_regmap = ocelot_get_regmap_from_resource(dev, res); + } + + if (IS_ERR(phy_regmap)) { + dev_err(dev, "Unable to create phy register regmap\n"); + return PTR_ERR(phy_regmap); } ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0); From patchwork Mon Mar 7 02:12:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 549904 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8E74C433F5 for ; Mon, 7 Mar 2022 02:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234762AbiCGCNs (ORCPT ); Sun, 6 Mar 2022 21:13:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234708AbiCGCNm (ORCPT ); Sun, 6 Mar 2022 21:13:42 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2099.outbound.protection.outlook.com [40.107.93.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E570A17A98; Sun, 6 Mar 2022 18:12:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gd0ylsI0ZUViY/RwXU0YnGr5rNKuaNJF0avVTrIc+f8V3G1vbUtW8TmoYOBJCee7AzbVuY6QQR94CHsAXLieyvSm1bXeyUzoKL1U+Vc6ISn1en7aF2BnIw1aN09OCddy1kl5Np2US3UKmJ44WImOu+cP+58Sss1sX414DoitGdr7w/Spl2VWbn5JViz8MBBleYQzQSEhcMHMStcaRN8dH7gmMAyRYJfOzF5diqpJbA9G/DnyW8TGc1Jnu732U0Mls8v+/OqL2Wsrll/C4bMoCFnImAxLmilMd0lrYKT9SRyK2aIr5I1IBdDDFCbS3CVJMto2BAhP5SKobXb5n8VZoA== 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=CbYwLr3ra++y9HNg8+DqdZvEcgqKSlEQD2pe4QGxE90=; b=dy3ut8ZKNU91Lx/JhLAC4+KDkcvw//U0ymwAYjCuxMPx5ZgkWY2/EUqeDT0Thd4ILmfWgDDhplJQ5DuY9KZWfjsEMpT6Bv8B8qBxUy/N27wm1Eqar0sFcZoOc7LmzzJSgaCdDXorVL9tLaFrn2aawCypjk+WEszT4th6/gs1xUAeozomaAwWFx9bDpVfoyvsbt3JIs4WBRbxBmCNdvXo40/QB25GxmO10DizZ+VbkSKcVNKEbIx+qDZmT19TvPqwff2BxB+7KBmzrf87LvrpzyVbQ0d6ISNr49+FCgxKrf5jmC3qTdnP7clIEBfHcNWdTWUd9uS88vSQ/adzmwJthA== 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=CbYwLr3ra++y9HNg8+DqdZvEcgqKSlEQD2pe4QGxE90=; b=E0UXyzVgBECHk694JR3N4V8X2HT99tY1oUazKoJRI/Z4v1C8MjRcA0nEo30NYPGLns0zuYcyyWZ2zkmSavye91Qj6Dib88iFcuJCGcs3vIzf7ihXDV7WiZQzpVFeo9gvvcWmjiJz3/E1HB1N+ZRyCGfEZHfrj1Zu2mqJByklRvo= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:29 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:29 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v7 net-next 06/13] pinctrl: ocelot: add ability to be used in a non-mmio configuration Date: Sun, 6 Mar 2022 18:12:01 -0800 Message-Id: <20220307021208.2406741-7-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: b2d09bf8-db27-4810-6190-08d9ffdfee51 X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KW4kEHuO3BnhBv5Fma6HdaiTqg0e3FudE3chwqPCAoZ/0k3slVYIa4jJtctxmJb71VK992oQeZfnsyRRthHuiDNpBpLqRbWXy+Th9twyb8sezJ06Vk/pFBfEt+ZcNqHoGMtMwB3PaLAGNA01/mvhJ54QKdCEPgxuKuvp1N5cEHDTYzbFYWyTW42J3a5SMojCgwNxKAWQb1HtGbycshU8Mly4TnrZiZrKqdIFpnAuzO7MoKz51O2ssBaSRswMDQ9qmWOFUM6FHzLq7cKSvr89B/w8VY7pxN+elJ9bNJNwVgOtqthxvMiesg/yd0dALvs9/+kWAaWXD5IfGbt7yt8NOX/Ld1UXQLeBNppegYDDGHThJSUGs66UDMttPTRSpMErwdlVjF9/mGu7P55y/1WAyKsZZ+xJuVEXJdhr2YWumQgZPTHjQy6gVkiP+5nmsSLqEVsdH607zOqHJkYvwfeYVh0b44E/VXL4/fGF5RfJggj8+q5E6/mFotwW5j2p7EsSCW7pCZ1LtFQxJHEZq9OTqr2637i4KlNE5IfYpax4Mq7VSTIv11HTs6/MeQGTktKgB0w8a4kzXulgfUieiYGmssIewE8fVo8K6Qxur6Mn/sFSRx02iRrt05Ev8XHLz/ofoRWOKqon5jmAQFHBflRU0Trgq0Qbdpu3kR8j3GlxMu7lswg1O6ygWlmFb5MpTxZeH91CTkYRdWCpR6iDxatT1w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(376002)(42606007)(396003)(136003)(39840400004)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(83380400001)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ec7z8MfiweuD5EFbcNLahUuJ6ZWm/JOem76VqAm/BJ9IVyJ7C2K7wgY9kOgNDfktYnMyN/sVnCDl9z/JKuDz34JgEYJ4qtQbdIhowwQyJA/Kyeee2uIg7OJ38QOo8VoZjC2BLbL3xnnAi2oxbvp1mG7TG6OUY6sogHhN0vb7fSoIHKrjAaw2bUZhBslzgJfihBWRu3aMHTVsUCS7Jl5ZP3aVwqO3vJgULBQQvOEu2fococxKQ1C7xfsQ0bdbXOih/2/hfCyJ1F6k/asT6M/kgmi3ik22gjPLnusLGrTTuej40pLbg+YUB2MOEMUyu8wde4nXg1NpDhjNRvHBx3RQ+VOnRCJvs/Oqqd0YzoLBuxIyg2yTcp0S8F1Oa90iXhAcp3cNrVNVnUlnQJAXOwToxObiSKT3Qm6yWu3XVmcQfpAdyeJzan+EVkul+LOOr1sfOsGZdhkyBpOPX8k+S8+7tRPIHRDQLuXT7ky880AeIYp01XDeeASaiq15PKH6cDb2FSN4LvKPn/ZEDxpGMqSJsU5vQgLSD8+4Mk2WwRiZ6c33TSiJEGO4RKsurVUjQBwQpXtU7I0NykyMnlHL3N6QlvXM+u3lKT6YSEJILSjfAy7YkLcp8goI5l+GyAVnzQ5vvUAZRa0Cq2wDmRPt3BeBp2h21GyU8rEyg/QDWRd6Ig55tqF6HmSgGDztrkyA9E75rbCB0r96sBbJ0N+8gyZGHvK1cZAL6XTqRqKeB8ehiMARx5SWd+geJSmylj+VJltyLEXcyM5yWAusn93BAaIxTgzQRws6AlP6vnFHNBnr3VrQFd40w8Mt5MoqFSQFXra1PBeJ9Ug+fMdpMiTeD4MpqLf6nD4iWO023j9n/giwJdQ/mpDL5l+X6x1bqwbwsR8FYF1mDeJSJF7Z9Fm/o1qYcGj+Vd3gEdBq0UT1dGzngW9iVjKRUL6fpFshlbN5jVEXjK902qlzCor23mc0Y37WGTT/Wn/bREhHZq/8sI+7VNljfW/PX686iTMdV3u08XBJpkS0xwH3BXnfO52Q5xPJNmc7JwGEUF0PhzkhoydBIzg/qwqI+wsW42qUu+LoZY1xzXsH/fL6cEY8Se/Y/zkvdAa7DkHxnsn1xWjxO2QtBepWRcIYfhw7YcuNIp32P4bFUci2w+pwpoy/+RTwYjv5zI9MsLuh+TKJAI3cHjhRAcFP4/4u/BRLphk0mFDmfvFB8/KbmzTiXC7H57oha/Zb9AU7bB+FRxw/xXmD634SmKQqpgSnRPW6MdQzr5nzmelIi5SzE0/cWhnw3ld5c77JB9r6AdPaSzMsj/hKnEA7zUCKbRah7ksOdw9cTYXOvwFK2h7/9AJQCXEk8bUTotT9guHzyhW019fAYnAa52RF5ks8t4AyZdNX/ilPFS5sNWCAuEm/N/86CgK/BLo+Gxq8+Spxuu4fHOk6UAsCDhWrgKMId7XcrCIbqwQdHaDHTbVqnRfV9PDf3qK/Q5LxshKrpoupXsFkXTuWuM8JztC/mX1JwMahMtr5MhKpg8ACSuFYgrVajk55oJq/VCBmE2GIVxyPeYGQrN0/lHAksINvyvj4gWJVNgRsuDE8hGFKd8hD8/MVnm7CJtbvCA/OwUJsIkMrnuFjMh5qq21QC9Gb+7QxyERU99qYS/2ZNK/ciEwQuXQBk1LSWK9AnIUezEfgvA== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2d09bf8-db27-4810-6190-08d9ffdfee51 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:29.3392 (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: OWcSdwh/0HMA7QfQlweKSHCKqgGXegqmdddMZ5COU2Q8UzuS9v5TgfsdtVVDwdtd0oAJo3g6SmMDnEa7ai87FUZouK/ES+nRsmDlj4911X0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org There are a few Ocelot chips that contain pinctrl logic, but can be controlled externally. Specifically the VSC7511, 7512, 7513 and 7514. In the externally controlled configurations these registers are not memory-mapped. Add support for these non-memory-mapped configurations. Signed-off-by: Colin Foster --- drivers/pinctrl/pinctrl-ocelot.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index b6ad3ffb4596..e327bf00d447 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "core.h" #include "pinconf.h" @@ -1123,6 +1124,9 @@ static int lan966x_pinmux_set_mux(struct pinctrl_dev *pctldev, return 0; } +#if defined(REG) +#undef REG +#endif #define REG(r, info, p) ((r) * (info)->stride + (4 * ((p) / 32))) static int ocelot_gpio_set_direction(struct pinctrl_dev *pctldev, @@ -1805,6 +1809,7 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct ocelot_pinctrl *info; struct regmap *pincfg; + struct resource *res; void __iomem *base; int ret; struct regmap_config regmap_config = { @@ -1819,16 +1824,28 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev) info->desc = (struct pinctrl_desc *)device_get_match_data(dev); - base = devm_ioremap_resource(dev, - platform_get_resource(pdev, IORESOURCE_MEM, 0)); - if (IS_ERR(base)) - return PTR_ERR(base); + base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); + if (IS_ERR(base)) { + /* + * Fall back to using IORESOURCE_REG, which is possible in an + * MFD configuration + */ + res = platform_get_resource(pdev, IORESOURCE_REG, 0); + if (!res) { + dev_err(dev, "Failed to get resource\n"); + return -ENODEV; + } - info->stride = 1 + (info->desc->npins - 1) / 32; + info->map = ocelot_get_regmap_from_resource(dev, res); + } else { + regmap_config.max_register = + OCELOT_GPIO_SD_MAP * info->stride + 15 * 4; - regmap_config.max_register = OCELOT_GPIO_SD_MAP * info->stride + 15 * 4; + info->map = devm_regmap_init_mmio(dev, base, ®map_config); + } + + info->stride = 1 + (info->desc->npins - 1) / 32; - info->map = devm_regmap_init_mmio(dev, base, ®map_config); if (IS_ERR(info->map)) { dev_err(dev, "Failed to create regmap\n"); return PTR_ERR(info->map); From patchwork Mon Mar 7 02:12:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 549901 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B641BC433EF for ; Mon, 7 Mar 2022 02:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234699AbiCGCN7 (ORCPT ); Sun, 6 Mar 2022 21:13:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234713AbiCGCNm (ORCPT ); Sun, 6 Mar 2022 21:13:42 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2104.outbound.protection.outlook.com [40.107.93.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 507C017E0C; Sun, 6 Mar 2022 18:12:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LFtDWmeQR/sHTmLOv9U2QF0F+qJct4tgdTxugy2qB4gVsqbRpTI1ba0Tj299lXF2G/1Ok+ttvOoJrVBsL8rUjH2SdGiqTu4XbZ0fUD6uYWQGexQ1idA2ljoXUrGCf2wLgxJZooaGhDCroQU6JHgl2i4aBQNPtIw7Gqx3UBMRAZQTFpxjivBqlKOW1DHMBetTMK1JZ8Kvc4AtYWTOGKPCCJP1c/cDClW5+0IwKyKt8k7jUfE020Uu0y13ZIV3ZedY4gy6TpDAEseCtCAPn+KxXtDfk+Vp8ZlhOmncVXYxK7U3U6vOlVQiK90LJpzom7QPYh2dgVeCXp7ItJvlCUQFyg== 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=m3nqSzYmpIY27bENt2yAEAnV8f/TVDEC8NiooUaOlEI=; b=Os3IUEWaGyuLRz/2qUXgakr1ItTx7apyy7x9xXd/u5bNPA/D6sL1Dkp5EEjbJG9SsDghNMsjYcC0ByPc0KBfgoxBgitUeCvR5qBLctj4Ft6OltFywOahh23OKaaHhvHVExtH1RiIIsaPsqi94u9XCyQfYGtpD1d3mXgS5U+dEmtDExxY3yHKPuPaTTPdchYNhbDNXwN45WHhHzfA6ibttqWkH0gw8jU1hVVCZMaliqoMXJ1mu3Sr/DX7cIr+QuJ4PivNi6aIbAO8Nc/zLdcnWXAEQri4/aZEN8gJBABjLAcKtSrsWTI4yUyBbk2L6eBbzElvmsUz51rm+5d43MbP7Q== 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=m3nqSzYmpIY27bENt2yAEAnV8f/TVDEC8NiooUaOlEI=; b=HohgSOU5Py0r93p96XxYaXarycFrhCCqdjjhYSZxBsFYlC+xP7PpqB6EtQobFLTykPlTsHqCICLS+zPKi7tTQ2Moik/ZR5hNFeEmWak54wYCAzuKSddEmfspAV4ISYhKQB7FIXZ6aIXczWS1MJI6MiOTh+6hrYb20+f0yPgGuQ8= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:30 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:30 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v7 net-next 07/13] pinctrl: microchip-sgpio: add ability to be used in a non-mmio configuration Date: Sun, 6 Mar 2022 18:12:02 -0800 Message-Id: <20220307021208.2406741-8-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: 93b568c6-ee85-4036-6c1d-08d9ffdfeee0 X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8qgFddhEOoXo3kfHyX9okcDbGNJWZoiiN9vdbrr864KJuZqFUJEhtsu/mkqJj4kgznNYk2wLiErf8UPZ1M30/RuYFXdhZkae+vb+aCoWfsf4Fxv+/4HnIJ/yPbC/0JOepCQkUNyPzpu2wPhbrxpFIRnUcGLenzZRqyk+3+2yMxBcgqD4Hh3x41pfMaD+hvwGaPkuu+qmTckHuxBEYgv4kDPAv57xtlnreofmz6fOWXsgu738rq27ZS7X2NPcmPbpXeg8NftEivi/EolfA3JMS9DcZKcM4epTZLVbmT5Nf3uNkQpuW9aVrDXZHloA83Kv5VbUiG8YmD0WlAaj40q1FgI9rYudJ7eXbnvrVH2cdB3R6KRu/WE0c0fcYbrXPjlcpuxoPZcEJIDCQ3eu3jVnTc8HRGzBSDkL48p6zySFL0urKH9549tj8bfWiE8PQT2lynkeOu/5KWHYhmsNU/j09Dtnk6aTgx6FgtONQY8Gelngz7NUj+82DazgeNVCTKvX9wK1nwpUsSShKZUjI3rrHiYYyIGR+lKZt3PoZ1cuuhTwau815+dsQKhMfBx2yZG64JPiSeQVuBkG2wyWRtzSCkzVIZ4JZdefUf4SAHMlKRRTjBS5DUnginhS6dbPK/jW/OUhWJUArF4pptwrpEZhCV+sifD+oNZfb0RgfJMTjGF6TuWKx1sZ2MGVN4oMIftFbC0IMCs2r7wInkoCwt+mCA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(376002)(42606007)(396003)(136003)(39840400004)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(83380400001)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z+Bii9yW/zsqc7m3g7xbTLU6iXHeH9APOQvuhO/wJ8kQY0PTNFwLA3SZJ1h+15rEUuLEJOeiMl5+rIO0tHf8/SkQFmuIbpKP02mt8c2RHpdCUryVEwd8GmJzUpSofxD3TY8uSYjSCR2eZ6Hm/MIAY1X5KMtVsfRwgV4ke/cWaqDU9daIXfGDCBjykb6f0EQ8CifZpJ84kuj1ZNchIvcQ9DY+gvNFdjbyjej7/B4Ermn53cCU7l6L+X6lGSi+LIlSlS61bU8Fiwsd4Id1yAYdjm/4wVsLYMZHD4gJqK10ABLROR6APkLoqQQLiL3L7HlQO7b7PFd738l4chVzz2k+hptGZayFuwVVd5ANbdZQLbJLG5Zki4lb1CzaVEAbD0rR7V/OOR0s+OnjlSXS5xi0QU9wPy4af+uS4dI7RfzHlE8XFvNB+waQh2908D8aiZIoD8z+w4CWgEASfi+iZ2zc3eU05G5846eXLTrGolmHFKdnBv1DAoOv/YelvY58RvJTMHdP77a+zulKuLgxJ9q8b2Djc83WACgVKpPu9esg7144+YKqtpGqBxexos/kMuoDY9Vg0ifqcEWbpdz9R8AzDnb03x09nre3/uP8AXQXRjHrAQvEqdtxPWd8zqx2cX96B/vr8tQRcuMW+X9razQOP9mipG9J6OxaBm/e/Ok7kW+pH2BKA4Q4s0vGVlEmd/XB8UeZGMX5goSv2aOcDUUpq+PQpKaYdRoiDn48EfqPShvI6rJOywG2GjePmCfnHSlyA/UueW/Apc42a2BLQr52cxZV7p9pQ5ZjFmWbYS5Oalhl5AjQxLgPhBthJtzO1q2yGhS1dZsf326lYVbvjbI4wr6ZClKknegKBLkxB0Ksd0vMjJnqKzFN6pXj4TFiOazzo1le5PVVt3lxVlBMgo64rtCaHoJ/qDGvZROPi9VbDqjxaowSg+0MamHJvXgzqzJhj+GyFtiwNUxu5UtPEbddj6DcnpcVLA5iBo34yjLZsJr8cT2T0EX8awSqyx1FirRwWuNUv/muXtpZ+CdnOPzeFTPiRvr7Huk8uMLjMhLYsBoPwE6vPC/hQJYtFrpcfXveLMCrFyNpcDSaU1ju6VxxYPDr3cPn+cdzxgxcteN6XezijJGbfvwMne2jPk71IR2NhYQ+6trnqwLvPgsp6fgOKM2G+acklTs5/LbwaDu1BLHYYLj7KB44aCc3ojJ5I1eoeO60AWh8Lb7sGzFUBAUWO88qmGiDlc3s0YeGm6cfVsQ23n8iMCuu3Gu9bRS9W0o7QfGabD/ialXe9/A4fze9G+Q6P3xW1B4ZpXB88dma1Md6lkWVeTSuk7n37c4sGh3VLcHRyBoYDfJFffXuFyYn2NuDPtjTMVgYvSB0oM34WnPIiwkyeVYUAhLBqc9Wx/f6yjluvAbfFK69BGjp2grS6ZLC4YXHLMSzLF/Y4P/WNLJ3wa/tX+/+Tswj7dSrNgvaQB6Ex99SdnSB2s30XFzU+jBsF1KpUZRac9pLBEC/TMPbu4NKFrknRw4SY7lmInQ8JqwpNioPa22li62xQexK/bTXcqDNK9gYgMxsODa5ksZVDUbk4gVCjT0Q0NaE0a78BkEGS88rr8Qqxp2Z+1rr3c/Y/KQ8IpuhPfSL9bqA8INzfl7IxiXxV9iYlxtKNxPZgHjdo5Pz0/GIZluJAppwGQ== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93b568c6-ee85-4036-6c1d-08d9ffdfeee0 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:30.2923 (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: QS8n2noJZUc5OMwcUcrNlVkcP5Gyb4mbGTd0xjp6ti/bGpmhiGahr1/MTekwX1pGwS5AnjUWX2MIVvMa2OCVlYfrIKRzeKJiK8hSkajuudE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org There are a few Ocelot chips that can contain SGPIO logic, but can be controlled externally. Specifically the VSC7511, 7512, 7513, and 7514. In the externally controlled configurations these registers are not memory-mapped. Add support for these non-memory-mapped configurations. Signed-off-by: Colin Foster --- drivers/pinctrl/pinctrl-microchip-sgpio.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index e8e47a6808e6..a91272936c8f 100644 --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "core.h" #include "pinconf.h" @@ -819,6 +820,7 @@ static int microchip_sgpio_probe(struct platform_device *pdev) struct fwnode_handle *fwnode; struct reset_control *reset; struct sgpio_priv *priv; + struct resource *res; struct clk *clk; u32 __iomem *regs; u32 val; @@ -851,11 +853,23 @@ static int microchip_sgpio_probe(struct platform_device *pdev) return -EINVAL; } - regs = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(regs)) - return PTR_ERR(regs); + regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); + if (IS_ERR(regs)) { + /* + * Fall back to using IORESOURCE_REG, which is possible in an + * MFD configuration + */ + res = platform_get_resource(pdev, IORESOURCE_REG, 0); + if (!res) { + dev_err(dev, "Failed to get resource\n"); + return -ENODEV; + } + + priv->regs = ocelot_get_regmap_from_resource(dev, res); + } else { + priv->regs = devm_regmap_init_mmio(dev, regs, ®map_config); + } - priv->regs = devm_regmap_init_mmio(dev, regs, ®map_config); if (IS_ERR(priv->regs)) return PTR_ERR(priv->regs); From patchwork Mon Mar 7 02:12:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 549065 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87F69C4332F for ; Mon, 7 Mar 2022 02:13:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234800AbiCGCOA (ORCPT ); Sun, 6 Mar 2022 21:14:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234714AbiCGCNm (ORCPT ); Sun, 6 Mar 2022 21:13:42 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2099.outbound.protection.outlook.com [40.107.93.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 015B4193D1; Sun, 6 Mar 2022 18:12:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g8I8AeNF6AS92DXMLvT9G56z5zrgz6RS6Cpk1Pivaa5DY1QTYCosA3z5dqs7/axKsS8pATt8bJAHJ1XEuSzMJexXdfOB4pc+TKSYq4WyPCIz0WsCGkZqa3T8+fwOlw5rHPn4fFpudBQaGkUworQMVPjNyInwFEvyQ8cHOnqHXIks6JlOaBvbabnzEDPORoEkXdvK+3m206Ak+R4KhFXBAQykVy/UwfcK+4tSezBbjocERXpo5AhplpqM4eSuP++dK+1bfjA4ILPVxaHyfQd8IgCqFUEVhEXGk0iqs2oHuHBrl5ogl4Q++191pXmhKGikiRKFSlb0cy/KDBWdQaoYFw== 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=XVQn+Rw6D1mIjHJMVvzs7nbOpOfnbt6zrqS/OU2FBPM=; b=Gr2ZBd26XUskL13Mi6ofA5QF3S5A4a1o0LSvLg1APSk2GqoaAKZgBC8oB2QUr8NRNHRyniYPHF6jmjnroZE9fpteulI4Ulrt1WzQIVA/Nh5+e42HqXVxSycOc9OJ71PVGx2++R0Ui4bByLWNxSVpvfK+2PlKkpmfvgqQrbopToTPOhzfmsDmnAi6hf1xXL3Qp34CKXA50C/NqEdbT5aWljwsWEnogwG9u8t4G8lI1pPMgz7vhswajpgEImzES1/mhOhHT20+1M+b7jfngCc0lRvjfqnweFc/xdTkC3d7YEULNi1LiHpN6GQw8T7wQfHBKSfWPSqfoNkxKt+iuIlLbA== 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=XVQn+Rw6D1mIjHJMVvzs7nbOpOfnbt6zrqS/OU2FBPM=; b=zZJpCGmVjw072GKjQ+HV7RxoCj/9hF6TJ6Av+NEs05rrXh/8DcD2IDFcPFhKeMEcyeRpaifSdaU4FDrueD0uY+qmU7pP4n7I3TEtyccoArsIpV/lBVfGv8XyrTvGaMAEslBrpnG87Zlf8fMqpwjDiezHY9qUitFavBLmkfOloJ0= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:31 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:31 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v7 net-next 08/13] phy: ocelot-serdes: add ability to be used in mfd configuration Date: Sun, 6 Mar 2022 18:12:03 -0800 Message-Id: <20220307021208.2406741-9-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: a33735d7-3fb4-4091-1462-08d9ffdfef6d X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gnX+tkiKXRP6mh6WIY15dqjvA8pXVp1t9cwDzJHRAYyzWGXWziDvxnvvs/Q2dmPYAI5P14zURW+ICMhkWABXH4r/xbdOJt+qun6cPEUy7xBcfy5tZgrAKErQu9dl9XZKTj0BKkTHmEvkPc/yewJBXwD/dS1Vf3enPUlB3J8u2yjTMpvMCtVNXR5NNnBK88c088WGFIXeitvEGfJ+hR6WiX4Zha1+20I1FlDk9SFI8+6DR6KhKBFB4sfzVMh0/RT8DvPirUqHVsUo+g4gh2mbngHyy2d54hq0kBGbypl0AMO1LpbeBx+7RQnOiZGk6MHhvNAcpXlwj8qMwUwNP4pP3popwlYZlkGOjQt8q+7T3NYBnuZ2yLxmp3AYA/Z8w0Z0IREPxsb+Nefjur7mZLmG0FShRyt6rmwUtIMlqMn/74KNJ+DO/akoF6GATnCns0A7DuusI4xdUkcI232r5HlfBpNZztIUgUAqmITd67EkUKTfkN6oflR4hV9vRJXa9wr+hSizFoPsRJPrL9DRUnrmqcIvLfa4quaQIk0IHhAuNWn/P5ClgKlOnHcRjHaYY+6qRgeJRzKmg8LX+XO1kGol3Mz8LlwTP2wNH5ogG+UVuBoWc6wbuoWwahrOcAvI6jFETQftDJG2t9aR8XUrporYOSV9fV/8bxX940YfKUHW5hbcEuBOp5OHcFXoh9TP9xPw X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(376002)(42606007)(396003)(136003)(39840400004)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w3cX7L/KFh8QqTQ+6V6JR4ehmVI+u+Pvhjb5PISYye+BE11NrjyejurOnj60JEV8/yyu4Gik4BeTNjpEYRaQjpGeWfTNfJ5ZRufPKxm/eIIk2Rs7n6thtJSJeOF/S2tRBTHo790g7kd6G/JSfpgKftGePjlsX+g8ygFI0IDz8OPjuANtH9mjIXWEmqkVAL03/ySameNQbEC9HGFUQzBMZ4z96mHMWKK+C4Y5ltSsjjYeC2+xaWDhWKqkXMsdOW+vJCxPLpriypFssdqxmVnzmr48LyGC2G63ouPGmzUsqG1MFkaCG/+caH3VTJuV/R22L6yCyplGDXoyslz4nRsn7Lmbdwy+E3MAu12Ez+nOG7cxRV601xWW903F/ZLX4mBoDnfBeYF5/LbnCGb2nDmjUVFA3aIl5SZ/ZaE/TMrRJNf0xnVg965CaBRhdlKJOWJ2kANUJehR8mqAePWys0Bf7i/9hEI1idH83DxW1VIarmhOo7zOjQCH5Clvat2gEnQ7ra7x6l8MyChgTDtniENcsKbVc0EucwHL0f/teCHkFh+0U3glocfTSkHC4N1QdbTkIAzxTEVpiuOjbmUcm5ryAvde+mSila6gOljooV0eXySy7b/SNA/rSO87oOzDmnfB704MZSrl7FbFz04SxPi3pj0g21z/JOMHU0ZFjgfGybhrLHlLPus68rdsa//5fUYb2o6zDuCLMYz2R5IVSArZT7cFW2K1HOgBOartFmJNYQFlNHwxRmWPhvHzPoaVYLaoCqEOY2s/h9p6pxo6DQGUVHxPNRhZtjWnXWzCE6xh+FIsX+eFUlWn1uGOCsMQOHAx/xykL1HTmF52JX7jdsKDXSF0pieGbtowO1tGWT/CkoHo355HCg8oZXnLydY/JdsS4kvsWHrDmtgr+zZevQz/ZmONngYpfp/72SW0aWesyPRYM6++Cf2MbeVM1GeNsXbS40Fs9xNOHt0LXv57PLSWqYZPS2cPXB9kttNdP9DsgMfckuXZUoJu8bBLMMdLZULZS9ijjiSNNNNzl+GfZxBDM0dN2FJEKFytCQGFrdrxmks76f0XVjKc4Zp3g24ks9Ie/1lXul43Qs6mhL1sv5z5vl4sc6jbLVKOChYflqoX9UA12csb5BtZOrMOzVgkgpo9c131/MCcAZ3YBEz2GkmDgMAduYlXcftbbFv7+HcVlCPLpyILT2qxZNQF8rxkRMya9dBBwJD82xMKaAaCzB/Uk/JzRBHK7XGZfOMsZ2nJavgQ7942DEZ9DDIw/7svBFh0ZBIpSeBrR01Qp3B3ygwoVnT3feHFT8oD1SZ9UnfQMof5E3Ai5nEy1/60JAPtA5qmNPxSLlVoHjDuQN1muOQpkMw6oQdLjisep+VLKnVUnOaK7Wqb26gMFbs0QjWzJStIfIla5dyqEZDu9LH/Uogs1jwceASYf6iOpU7HxdOIQdklBeIgsTL6EFHjiSfBBoqXkW5Y57WTNlFp6oH+jGXaQYFLroV5k2JNDTKgi6P3WZ3OHl+HbbV4jH4QezEHFA3rMQu3kIZmz8DqgwaUe8PsH9iGPrJfMOEfC/N0OJsoTMN/cJEgcdJq0DGJc4ZpdcNnp9OY+j5I1P5h3Bafn+nb2QK328ReV5RgD4Bc5HjToNGqonJj0wQKAGfYiqpXfk2Tv/wvcKMkZDfi1ZUBjknxWg== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: a33735d7-3fb4-4091-1462-08d9ffdfef6d X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:31.2141 (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: 3tUgfQZmXF/07pqy9cC7888Hnmo5fODBOn3cCB0v4xCW5odIlHtpvfBSgfPxu8oxFsebabUsM1VvmAmu2PYDwRfTMxWaCZx/EVRPZrekFLU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org When ocelot-serdes is used in an MFD configuration, it might need to get regmaps from an mfd instead of syscon. Add this ability to be used in either configuration. Signed-off-by: Colin Foster --- drivers/phy/mscc/phy-ocelot-serdes.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/phy/mscc/phy-ocelot-serdes.c b/drivers/phy/mscc/phy-ocelot-serdes.c index 76f596365176..ae1284e356e7 100644 --- a/drivers/phy/mscc/phy-ocelot-serdes.c +++ b/drivers/phy/mscc/phy-ocelot-serdes.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -492,8 +493,10 @@ static int serdes_phy_create(struct serdes_ctrl *ctrl, u8 idx, struct phy **phy) static int serdes_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct phy_provider *provider; struct serdes_ctrl *ctrl; + struct resource *res; unsigned int i; int ret; @@ -502,7 +505,15 @@ static int serdes_probe(struct platform_device *pdev) return -ENOMEM; ctrl->dev = &pdev->dev; + ctrl->regs = syscon_node_to_regmap(pdev->dev.parent->of_node); + if (IS_ERR(ctrl->regs)) { + /* Fall back to using IORESOURCE_REG, if possible */ + res = platform_get_resource(pdev, IORESOURCE_REG, 0); + if (!res) + ctrl->regs = ocelot_get_regmap_from_resource(dev, res); + } + if (IS_ERR(ctrl->regs)) return PTR_ERR(ctrl->regs); From patchwork Mon Mar 7 02:12:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 549069 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C439C433EF for ; Mon, 7 Mar 2022 02:12:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234741AbiCGCNr (ORCPT ); Sun, 6 Mar 2022 21:13:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234711AbiCGCNm (ORCPT ); Sun, 6 Mar 2022 21:13:42 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2104.outbound.protection.outlook.com [40.107.93.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0715A193DB; Sun, 6 Mar 2022 18:12:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M8V2Czw8RQOnQm16ywoBCT0lEC8Qll/Q08zDJT4YiKTw9LL7pFJmatyuFrZSd4QRZ6910Ut1vvVbIqW/ZoAlpwFEqHRQPRnWHhI9J0jF3Gxu8xG5IZf6tZoDVJGldLxdhEP/vM7nFZKQlvlvXbslSpYjFSAgZQPvRZCg0F4a2N6K54GwLWyJNwbWroG4dQne6fWpdMjYGpebjz1m5mdXsUIK7Da37yQXTlh8kGSAJuD8zaybI2iMCb4iBwKTjmkpjfsaL3LLXABdFWIVl+ws536yqgOVSGs30Zmjj6HNLN7Tv4XkLrvGARXnCukO20PEWLQJDkz2pgV8z4F6RoZX0g== 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=QA3vg0KZEEPZNKLO6wJTCwJI9BE0Ud3wrgMZRfUwvWQ=; b=XyHHnb3lvFo3zDb5gSZmD/v2GqM71K2iSMat7d9rQjp2hYECK2FZqSj+MYBA3Qk0IGw2F921dpzvgLhIAwQvAzdOg3O678fjozIXqo8EKTbhuVP9oxIxPdVhCjH/QkCBb7w6yhkNVbRgB/Bqq/aQ34pnlomkhYwBPLrWdl7eTjpNzv/muI4bOJe6vgInbV2wrYte4x52AcgZgWJi9zh/QmnQTMc4HOkfC7cpX0f6Z6u22h7lf73n2TYrqtZaTAtvvxCdVuJ6REll2t1GTuQaL2ZElpeKniQVSy1+umAxDhx39NJiNkIzYaRL5uVpGoKT5/PHEbfBiUkg0GR+EoBfTw== 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=QA3vg0KZEEPZNKLO6wJTCwJI9BE0Ud3wrgMZRfUwvWQ=; b=Y5bV9hGdt8wu/kkz8OX1oLIClpMne3L03gIW/79/b9sATnMAqeM3u/beBQVUuI3PXFiBrV8O0R1byu0pvEBe5+IhYar+RUtuHvHI6eyHQh3iYTk6URaGedrlWdW7EICtgW/54wHiUXoyvByZaImAe9Q+fg9mQzZAZC0n7ka5WP8= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:32 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:32 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v7 net-next 09/13] resource: add define macro for register address resources Date: Sun, 6 Mar 2022 18:12:04 -0800 Message-Id: <20220307021208.2406741-10-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: abd032f3-e279-4035-8135-08d9ffdfeffe X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2dLUytDYnNeZxt5RLyXz6+9d16CpICo66S9X79plwDG0+gge7ft3JCV5kleKkLPwzdR+ATjJkkHqj2MqcIIKzampDwJA5aABbTT7qCJWKwZysGGgA3aRzB1nABHlX/FyHO8qdfRJSeiXB/WxvELnHBdASrseX77B36Qdm7i90cBBSR9BK2RKVSDuviRbTwjl7jT4Z64huqHB5pRapPZRzFzB4JbxLKyguui0IpRadgQREXlYUJ+kRQre01gVAr3jHzQzbDK3+1ZhmtHS++X8pDkkJMmfDYLnOsMQGP2RbEuZMX4P9tBFjJ5QIuOHXE/bcMWFUN0+Q1cJ2B9CrDl8CT8VvXgh2o5W9y6msFRa6MzZ0JZUu12txuoLXgTOaY206cIEcxL6JVkvsS1aMlzxZX+97dEIPIwVJXIjGEckSXV9AJBIuDo8sQvCsR4/bUJyEb7hxUc5D84/9X7pV8IsFiaXcT9JVc3IKKWTVwUyy+/8P1LBEvojqnM24v9qrqSGDnT7VKS8OO0QJT5eph3IpEsr2MKbuAcrnvOfnsOr/JbP6kjFFiF/P14tSkqy+a4XxPB8b5IyI9MjKRcLB+gW+jlKtKlw/b09F6xR23v1196jMJdk5DQ+C8IRjhLjb7jeumEVrwFGomSF+oLvG2sEU9rEOMQk0Ff/fq9s2IlLyy5XSuQ2AMJDb1pMjvhjtgHR2ADfBT/7tA5lkw3stuP75A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(376002)(42606007)(396003)(136003)(39840400004)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(4744005)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1VCqKIN5Qe38vXeJHZsFd0kTuCRuM1MqnhJWzxlYQ3CBqT4ZeyHwISDd4UuIeB3MqXlCHr0Sq+Hr66eOVHO4zP4rBhbDe2Bl8ngWOpt44ERpuiadtZ2WLXWOPbIDQeSWpKd9SxUKgoELtkya+VcgAnDlpgyJRbHBJOeOvBhpK02dP1XuIYx/v/yvd4i3DMQ8z/ISyUGXe5wQK+dz7MsPZiPG9FYL8nXTR6bb9rrCqEQxOVwduTnFmH1dcy3o2OhaNf6L1QmbQsSTg6Ydh36lXbqfw1Ajrgor8Y7G+99Lj2LaudzNrBB+HbIDllCIVqcDVKnkNwBVERB2WU3r5gt2hcN0vNAwtNpuqMqdmKQuumEBiFl32Fk9LyljHb4U/neGLPtPt8AoCGmbLPFU/IU0j7wOhnMFhA8HpVls30XOAm5c2uHnDYnMcbZQ+dnP3RWeyoywofyCkqEaCeKJL1/u6E4Z8aIe6eFbIaPSA6EynrDoFA/xprRDh9vuunaPmEyjZFb5lyopYokPMdltYcFXhLqDmTfQSclmKL2EBqwMtsfPg0bHqtonegKfGDv9EOiEGJMSfO3VCgRbcNiKyQJ4R+Y0RSp93sJf+B/7WJ/Z4qVqOqwvrve8C+2JmevZp2kGpptgVhKJWdTPq2jKXGeWKa1PoUjN4TI+kD/H+vdaCKN98uhAbEDzQwJhis1PW4AFCY3DxR9JFS3LNwnPyBwtfcKhlzyqNPKIksNMACgFUCIEBCVzaAz6oOyVbPkW7XXnzZLPQfDy56xqO9EBjH3KEqIcxVNZRULC3Ez5VBCDCX8ZZB0bAgiQ/Q1u6USF4l/HijbCocgZ1bEhDSbvyFFN8YLDiSMseu8itppHm4hwp/bAv1ba27+z70GPBLAfe2Bdla0RgSGYFOwirR6K2HXND+bsDy2hwhRoLK8+jZWpqdBZtwVQXwUiDkuOED4LULJa6ErjKNS57QqRH6+KrVC6CoA25ECSsYxkahT2mKHkqIpcJBDLQEE99wi1O1/yUzYxzr5Mq//jkadpAbvKAcFcpCfQFYyknMQJIMFRMPso1CBZXhlPASlvrmRQeXaVWPqmIHZq31w/1OcJSo757jowXnm95lyiuc1bQ9+dI9ehtOhVQwEWuw7GedfXRljwdySIJfQNeo0p9VC2V5KhVTJSOk/WgsZ9OSDGglMDeSnCjb992edmcbvc9nbnEXrPAJs1WaEFjBUP8peT9of533eoYR/Nq8474reZjgPjIIA+6JVyy+Aj/3TzZKt1SGgtvbXX9SlwtJAW+CXmp++jQOxtQOl8NT6ncsEtcVsR6w0qw/MS5C6/2O8k1QfIhN9vJfQwaer7VQs04QlgDqTqaRpzf0w7R8D0Z2bhTtE5r1tugm2FU+8HEuDXUF7/nOSk26lLpzF1Twc4jVCA5+X9UTygUvwToojwVwTdPYuzaQITV81DRVbfVwcUHU4Y7wEtrXcAPxSou6eqTEu2xVugz1bqFsM7jagTBetQiQVCM7t/BkwLc4unvo4WQfG8jK9KTheFFP0vxX+budwGoRQnHQf+14SBH3MHyzK7P+bSCce2YtFqIBawnRjCjZUYP3Z3ReOXH7ZJZSbFNw4O0wVumG7mEXjCsmzI7XoeGlt4UHrtPXaVw8qNps4VhtSihArZ7FigSs8XuOm/q70IKAsQvA3iHg== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: abd032f3-e279-4035-8135-08d9ffdfeffe X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:32.1671 (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: Ei++bfjtVQNJ/ETAQ+jjfdJ7LMxLxv4JgMbyySDTZ9aDyWgdzIb2+PXDEqMZpUwMsk4MJFCKsa6tW2Iss8ay9jUlJsehhMwJUlcBaxK1Mvk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org DEFINE_RES_ macros have been created for the commonly used resource types, but not IORESOURCE_REG. Add the macro so it can be used in a similar manner to all other resource types. Signed-off-by: Colin Foster --- include/linux/ioport.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 8359c50f9988..69ecf5cfc277 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -171,6 +171,11 @@ enum { #define DEFINE_RES_MEM(_start, _size) \ DEFINE_RES_MEM_NAMED((_start), (_size), NULL) +#define DEFINE_RES_REG_NAMED(_start, _size, _name) \ + DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_REG) +#define DEFINE_RES_REG(_start, _size) \ + DEFINE_RES_MEM_NAMED((_start), (_size), NULL) + #define DEFINE_RES_IRQ_NAMED(_irq, _name) \ DEFINE_RES_NAMED((_irq), 1, (_name), IORESOURCE_IRQ) #define DEFINE_RES_IRQ(_irq) \ From patchwork Mon Mar 7 02:12:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 549903 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09A40C43217 for ; Mon, 7 Mar 2022 02:13:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234786AbiCGCNu (ORCPT ); Sun, 6 Mar 2022 21:13:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234715AbiCGCNn (ORCPT ); Sun, 6 Mar 2022 21:13:43 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2099.outbound.protection.outlook.com [40.107.93.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C73FC19C34; Sun, 6 Mar 2022 18:12:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lw3FkyWDzd6ROL2FeXgVWgF6zq7hWLXWFgb0SbjNSikCmEBvIFtSHLBD7DTEi1FV7cDrDQu+FjTle3K8yAiVhvff/vjWzETfC/Oat3hOmB425/mKM38IQ1u2BdZM/gb4hojLqhRIGIu7/O0gGr2Xu1LVB1jllWoCjPelPPejd3/4XseemG5GPbLWdr+8neMTrrxlgGSkSh5qwowj6AodKyKlb92wkElxvV3ni9RaGndKhBB8eZ7wVj6IitRKeVWFp0Z41ATOvJ3RL8sRmYk0PF8UZm70rmNqtko5dow9CGxtp9/W7qryadkItoyD62txjZmdiLOfKvCOD/0VlYFq0A== 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=BXcJndMTJt8qPNbDIco/zIUAX664IBv5oTo02bPwI0s=; b=lQjOrQJa2DXExdoXTSfHenkvhIyOO1vnA3mf3vPzW+tLm4Wd1zelqM5QDQaaUKTQsn7DW8+FaYqnlVN8aLHBhKdj9cLf9anOWe3jYdunY+sPj/XlmKlMyY+zMKuIAi7MXP09JttGUMualA2W0R0SD8DOOCgqCYlNoA3DuoQF6Ty9l0dwxiB3ceKF0i8XEhb4JpIkv63lELOmHEhaZIsLHDX51j4XQ1Hs/y0dRTzqep6ALzML40LXxo6k94BDPZZP1fNXc6lftAYTP7V9kcZfjJZZ80ggtyyvkbK9b4TClpbBY85JcVRUkn1hlx9rFwk9dcmQ9O+X2JLrujm9y8ar8w== 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=BXcJndMTJt8qPNbDIco/zIUAX664IBv5oTo02bPwI0s=; b=mZRl09bDgdnbcmE6/97GI7FrJTpwYzazb5bUJ8dCGQYBzuvk1A0B1dk3nC5wDcF3mNcly1Z8/9b+mdtG64bL2PuVoVhaIdP5NVyEsGIH2W4wRsjpIGU0HqN3P5mcl3Pw+9Wx9VAiZbzN2EWzReW2jbuqAmdNpDVzq8KJohzX32w= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:33 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:33 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v7 net-next 10/13] mfd: ocelot: add support for the vsc7512 chip via spi Date: Sun, 6 Mar 2022 18:12:05 -0800 Message-Id: <20220307021208.2406741-11-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: e348bf52-7608-47fc-8bcd-08d9ffdff08d X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3OSo42UhImwuh4WG4+r4HEYjHxs0ihG7GBIQe+9pSbSZye3RsDs9xm22k2Ey0ifJ0ozRdGhplzGGkN8nJQHz1VpvAYySEZOxqf1t4lkk+u2NNi4ZcWj21xAsrrUV7Mjf2+s+2OnxJNG+jpyo3O5iHZ2uwLlzXzaOJlGUvDoPl/uIC6g/+WcvBaP3LBd/ek1XxBSRavxi/Vyzh2YV0i41mF5W5TsTskuFp9rGJ8dk2JFKjx/Y4hBPj9P4iRWrONtQHTxPCjIXbC6mq9IKIzHiS6hyZe/X8cegCqQipoS2IcC3zeUz1n2x6shi253MiUFGxNVK8p/2EpeF1rLAnRE8/mqO6qBZE+aRxZA3P3yOJgy8m0srzw0LFGVKLde7Jg7UY3tbX7zqqEyndDU+HRD+AathCVXEyYrm4nSYOcHs7HMHrWwD/6SwB9/rqhg/dHFekcb+EUcHLr/6pCV85vWr3lWqor48qcR65/Lgg3g4VURfRLKF480AQjr/1VRIHcG6z+ywf4MniepNd5w4XrW+DfjeyWvMWCmzzalQaDnH8c3cdd/ZTPBPAkRQhagsySyntubjuTB1tBrM1VA4R4Dmmukj3OIuTPjMHOKeqSlTqBN4U2A6Xtz8Ym3JH2Uh4QbudrAwUja+nL3tp5eUXCY4T6UykqRl2LLc6x98XGbZPOXabXpt+O2/mfBixABBWHcX4FLYewIc2GJl0EHqrN3sGg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(376002)(42606007)(396003)(136003)(39840400004)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(30864003)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(83380400001)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hWv5OMvpzdGzGk+CQbQ32tC1DPR6NF85X+vHcVrD2Ix85TRdbMmFkhOhAqeXo401h22B3Go0H73cr2ZbbLkKevnUBpZs8c0DuqQjlliPyywIb4duWAIX8diP9Sr1HEeJ7PTqxIvUKEkqb4X1K9KVXY2bYJDo4alG3E2blVPD0Sjn7Y1tfqJ/PFLwWhg+tdzwkBX4G9AO1lDk6iMt3Wg9B+0q6NKW6l1p1s9Fl9H+FuShCET2fTuEZMEg0p+UICT3lc8WTwhTWSqVRBbNhJ0cvkaYoJwTFEEVt/0vW8PdLjsXlIsSFa5kyeuYLqt7EvaKoSPn+soH+LJh/XV6wJdc5ymaXeSXmHO88/WGM+4vmmQKKEtLAYyvPb+bp20XUV3SHAompqMvSTLTB9g9elQaEUZJPmq7jg/WBU37C+EUbdFc5GOcBXTSyxpmcPXYQXqQG+02FUghklyvDTbDbGDso16A5WMCX4ZM9zWUpqRes+Fo5ck8Nx8Ee0fvKuFyVDty9+hzUpphbWZj+/o940beIBWkW53n2ZPhhci3UgTzc2WcIyoGFICgMYzXCrV1dmDwU5KpA8bEneco60Ra9uo1xVF6jCQ83cJYwSB+2aFyFSLEFRbvlQXHJt2oTkG6kOCPpyFGv605ERsWSI/VCvkGJmC20E8PzQ3MFCOQ87hCOMzKAnurA1QBmgImk46br5Na4D7Y3seGM5KU0IsSM07gA+UniytHCZk9HLkvtU0yiOVu+9j9LbeY4y8mo7tO9R181/AJDu1hhl4yQEzqx1j9qEjlZeN1JSG4dbw2T/Kaii8KpoHvCnKeI0o/dvYM4mkZRSJUGM2Ek6SfG1IZ5pbMEAX4ZT7eRr5d5BKhuJ+ncF0P3ZferAjC+ZG6MTjqR+fsw5Gx+cE7q+y9ATNI8Am3EiLDfnPPEwwudrc74WqqoivxFBekXErK0EXl12gtiQg8A1+oBCKit42AFbWjdTalqv1dDFQ6uFHF06bpNShTGDP0Rvh0TqDsfBQ66MIgv3lpnWET9sUbTE52LevxC6kfYnHFA2AZF2V8F2FA9SxW5e/cUg0lYHt5aLiEPQP/sh/WaMKvz7rdOQzmKy/SapyxZ5NwxFuAO3JVwRMjbdEianXaBglx2cEn6eQoaofVaJ0bBxniXNFebE31kKO0VT0xTAPExT7O07p/553gnj+7kcf9b3zBvE3JVAknGll4A8R50xRgV0dAZ/ycw5JW3HhWzgE5iiVFCjwe8bXohyWbfq7Hx+KwGzNX1DRqXxYyAZbluOt6IC6932hKjq6CvNnkDP0twwbjl7YXQadrbR8lYPWkfDBJQfENWbxVy1UvpbZiRpkR5fWGd2GFIQhTqKARALqGLpiMPz6WEaPXYz3V6RTKACJ4doTxFb7lTeldtu7il1tQ1XNWwUQ9yI0H1uxka34hGBUbUIw1fjfFBfm0ctpn9MVDbgnJqdQtmvz9//0Wq3YAKXn9EEIE1Rge142QvSXwPzYB9Kin7PHJ47o+WICWC0/T5INZ3Y/BmXESgD1WZkuw4qfSb4f2lgZv6shYAyV9B7hsldhQOoKftsLbNxSJ5kxFAjzB7KCSb+/WhCDEG4ZznbXIU+M95diVug57dGvZgOT6p/R4Ft3FxA61nkKy6vnA9GtmWOsPA7prjqcHanGCWQxA/Ljx6lWTINUYvYBvvf0MihAwTGhiCwYnALY= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: e348bf52-7608-47fc-8bcd-08d9ffdff08d X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:33.1202 (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: 0ZkceWNDF6YnIHEdAM0JjgNOmeBAw2n4BoRC40uLCEtmMmA6OLbXuj0sOEHM745iv+zXzHiL/v1DP03WAmYUiwB9mlHJu4yeBBdVM5YFCUQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The VSC7512 is a networking chip that contains several peripherals. Many of these peripherals are currently supported by the VSC7513 and VSC7514 chips, but those run on an internal CPU. The VSC7512 lacks this CPU, and must be controlled externally. Utilize the existing drivers by referencing the chip as an MFD. Add support for the two MDIO buses, the internal phys, pinctrl, serial GPIO, and HSIO. Signed-off-by: Colin Foster --- drivers/mfd/Kconfig | 24 +++ drivers/mfd/Makefile | 3 + drivers/mfd/ocelot-core.c | 189 +++++++++++++++++++++++ drivers/mfd/ocelot-spi.c | 313 ++++++++++++++++++++++++++++++++++++++ drivers/mfd/ocelot.h | 42 +++++ include/soc/mscc/ocelot.h | 5 + 6 files changed, 576 insertions(+) create mode 100644 drivers/mfd/ocelot-core.c create mode 100644 drivers/mfd/ocelot-spi.c create mode 100644 drivers/mfd/ocelot.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index ba0b3eb131f1..d4312a5252d0 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -948,6 +948,30 @@ 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" + select MFD_CORE + help + Ocelot is a family of networking chips that support multiple ethernet + and fibre interfaces. In addition to networking, they contain several + other functions, including pictrl, MDIO, and communication with + external chips. While some chips have an internal processor capable of + running an OS, others don't. All chips can be controlled externally + through different interfaces, including SPI, I2C, and PCIe. + + Say yes here to add support for Ocelot chips (VSC7511, VSC7512, + VSC7513, VSC7514) controlled externally. + + If unsure, say N + +config MFD_OCELOT_SPI + tristate "Microsemi Ocelot SPI interface" + depends on MFD_OCELOT + depends on SPI_MASTER + select REGMAP_SPI + help + Say yes here to add control to the MFD_OCELOT chips via SPI. + config EZX_PCAP bool "Motorola EZXPCAP Support" depends on SPI_MASTER diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index df1ecc4a4c95..12513843067a 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 +obj-$(CONFIG_MFD_OCELOT) += ocelot-core.o +obj-$(CONFIG_MFD_OCELOT_SPI) += ocelot-spi.o + obj-$(CONFIG_EZX_PCAP) += ezx-pcap.o obj-$(CONFIG_MFD_CPCAP) += motorola-cpcap.o diff --git a/drivers/mfd/ocelot-core.c b/drivers/mfd/ocelot-core.c new file mode 100644 index 000000000000..36e4326a853a --- /dev/null +++ b/drivers/mfd/ocelot-core.c @@ -0,0 +1,189 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * MFD 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 MFD children. + * + * Copyright 2021 Innovative Advantage Inc. + * + * Author: Colin Foster + */ + +#include +#include +#include +#include + +#include + +#include "ocelot.h" + +#define GCB_SOFT_RST 0x0008 + +#define SOFT_CHIP_RST 0x1 + +#define VSC7512_GCB_RES_START 0x71070000 +#define VSC7512_GCB_RES_SIZE 0x14 + +#define VSC7512_MIIM0_RES_START 0x7107009c +#define VSC7512_MIIM0_RES_SIZE 0x24 + +#define VSC7512_MIIM1_RES_START 0x710700c0 +#define VSC7512_MIIM1_RES_SIZE 0x24 + +#define VSC7512_PHY_RES_START 0x710700f0 +#define VSC7512_PHY_RES_SIZE 0x4 + +#define VSC7512_HSIO_RES_START 0x710d0000 +#define VSC7512_HSIO_RES_SIZE 0x10000 + +#define VSC7512_GPIO_RES_START 0x71070034 +#define VSC7512_GPIO_RES_SIZE 0x6c + +#define VSC7512_SIO_RES_START 0x710700f8 +#define VSC7512_SIO_RES_SIZE 0x100 + +static const struct resource vsc7512_gcb_resource = + DEFINE_RES_REG_NAMED(VSC7512_GCB_RES_START, VSC7512_GCB_RES_SIZE, + "devcpu_gcb_chip_regs"); + +static int ocelot_reset(struct ocelot_core *core) +{ + int ret; + + /* + * Reset the entire chip here to put it into a completely known state. + * Other drivers may want to reset their own subsystems. The register + * self-clears, so one write is all that is needed + */ + ret = regmap_write(core->gcb_regmap, GCB_SOFT_RST, SOFT_CHIP_RST); + if (ret) + return ret; + + msleep(100); + + return ret; +} + +static struct regmap *ocelot_devm_regmap_init(struct ocelot_core *core, + struct device *child, + const struct resource *res) +{ + /* + * Call directly into ocelot_spi to get a new regmap. This will need to + * be expanded if additional bus types are to be supported in the + * future. + */ + return ocelot_spi_devm_get_regmap(core, child, res); +} + +struct regmap *ocelot_get_regmap_from_resource(struct device *child, + const struct resource *res) +{ + struct ocelot_core *core = dev_get_drvdata(child->parent); + + return ocelot_devm_regmap_init(core, child, res); +} +EXPORT_SYMBOL(ocelot_get_regmap_from_resource); + +static const struct resource vsc7512_miim0_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_MIIM0_RES_START, VSC7512_MIIM0_RES_SIZE, + "gcb_miim0"), + DEFINE_RES_REG_NAMED(VSC7512_PHY_RES_START, VSC7512_PHY_RES_SIZE, + "gcb_phy"), +}; + +static const struct resource vsc7512_miim1_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_MIIM1_RES_START, VSC7512_MIIM1_RES_SIZE, + "gcb_miim1"), +}; + +static const struct resource vsc7512_hsio_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_HSIO_RES_START, VSC7512_HSIO_RES_SIZE, + "hsio"), +}; + +static const struct resource vsc7512_pinctrl_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_GPIO_RES_START, VSC7512_GPIO_RES_SIZE, + "gcb_gpio"), +}; + +static const struct resource vsc7512_sgpio_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_SIO_RES_START, VSC7512_SIO_RES_SIZE, + "gcb_sio"), +}; + +static const struct mfd_cell vsc7512_devs[] = { + { + .name = "ocelot-pinctrl", + .of_compatible = "mscc,ocelot-pinctrl", + .num_resources = ARRAY_SIZE(vsc7512_pinctrl_resources), + .resources = vsc7512_pinctrl_resources, + }, { + .name = "ocelot-sgpio", + .of_compatible = "mscc,ocelot-sgpio", + .num_resources = ARRAY_SIZE(vsc7512_sgpio_resources), + .resources = vsc7512_sgpio_resources, + }, { + .name = "ocelot-miim0", + .of_compatible = "mscc,ocelot-miim", + .num_resources = ARRAY_SIZE(vsc7512_miim0_resources), + .resources = vsc7512_miim0_resources, + }, { + .name = "ocelot-miim1", + .of_compatible = "mscc,ocelot-miim", + .num_resources = ARRAY_SIZE(vsc7512_miim1_resources), + .resources = vsc7512_miim1_resources, + }, { + .name = "ocelot-serdes", + .of_compatible = "mscc,vsc7514-serdes", + .num_resources = ARRAY_SIZE(vsc7512_hsio_resources), + .resources = vsc7512_hsio_resources, + }, +}; + +int ocelot_core_init(struct ocelot_core *core) +{ + struct device *dev = core->dev; + int ret; + + dev_set_drvdata(dev, core); + + core->gcb_regmap = ocelot_devm_regmap_init(core, dev, + &vsc7512_gcb_resource); + if (IS_ERR(core->gcb_regmap)) + return -ENOMEM; + + ret = ocelot_reset(core); + if (ret) { + dev_err(dev, "Failed to reset device: %d\n", ret); + return ret; + } + + /* + * A chip reset will clear the SPI configuration, so it needs to be done + * again before we can access any registers + */ + ret = ocelot_spi_initialize(core); + if (ret) { + dev_err(dev, "Failed to initialize SPI interface: %d\n", ret); + return ret; + } + + ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, vsc7512_devs, + ARRAY_SIZE(vsc7512_devs), NULL, 0, NULL); + if (ret) { + dev_err(dev, "Failed to add sub-devices: %d\n", ret); + return ret; + } + + return 0; +} +EXPORT_SYMBOL(ocelot_core_init); + +MODULE_DESCRIPTION("Externally Controlled Ocelot Chip Driver"); +MODULE_AUTHOR("Colin Foster "); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/mfd/ocelot-spi.c b/drivers/mfd/ocelot-spi.c new file mode 100644 index 000000000000..c788e239c9a7 --- /dev/null +++ b/drivers/mfd/ocelot-spi.c @@ -0,0 +1,313 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * SPI core driver for the Ocelot chip family. + * + * This driver will handle everything necessary to allow for communication over + * SPI to the VSC7511, VSC7512, VSC7513 and VSC7514 chips. The main functions + * are to prepare the chip's SPI interface for a specific bus speed, and a host + * processor's endianness. This will create and distribute regmaps for any MFD + * children. + * + * Copyright 2021 Innovative Advantage Inc. + * + * Author: Colin Foster + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include "ocelot.h" + +#define DEV_CPUORG_IF_CTRL 0x0000 +#define DEV_CPUORG_IF_CFGSTAT 0x0004 + +#define CFGSTAT_IF_NUM_VCORE (0 << 24) +#define CFGSTAT_IF_NUM_VRAP (1 << 24) +#define CFGSTAT_IF_NUM_SI (2 << 24) +#define CFGSTAT_IF_NUM_MIIM (3 << 24) + + +static const struct resource vsc7512_dev_cpuorg_resource = { + .start = 0x71000000, + .end = 0x710002ff, + .name = "devcpu_org", +}; + +#define VSC7512_BYTE_ORDER_LE 0x00000000 +#define VSC7512_BYTE_ORDER_BE 0x81818181 +#define VSC7512_BIT_ORDER_MSB 0x00000000 +#define VSC7512_BIT_ORDER_LSB 0x42424242 + +int ocelot_spi_initialize(struct ocelot_core *core) +{ + u32 val, check; + int err; + +#ifdef __LITTLE_ENDIAN + val = VSC7512_BYTE_ORDER_LE; +#else + val = VSC7512_BYTE_ORDER_BE; +#endif + + err = regmap_write(core->cpuorg_regmap, DEV_CPUORG_IF_CTRL, val); + if (err) + return err; + + val = core->spi_padding_bytes; + err = regmap_write(core->cpuorg_regmap, DEV_CPUORG_IF_CFGSTAT, val); + if (err) + return err; + + /* + * After we write the interface configuration, read it back here. This + * will verify several different things. The first is that the number of + * padding bytes actually got written correctly. These are found in bits + * 0:3. + * + * The second is that bit 16 is cleared. Bit 16 is IF_CFGSTAT:IF_STAT, + * and will be set if the register access is too fast. This would be in + * the condition that the number of padding bytes is insufficient for + * the SPI bus frequency. + * + * The last check is for bits 31:24, which define the interface by which + * the registers are being accessed. Since we're accessing them via the + * serial interface, it must return IF_NUM_SI. + */ + check = val | CFGSTAT_IF_NUM_SI; + + err = regmap_read(core->cpuorg_regmap, DEV_CPUORG_IF_CFGSTAT, &val); + if (err) + return err; + + if (check != val) + return -ENODEV; + + return 0; +} +EXPORT_SYMBOL(ocelot_spi_initialize); + +/* + * The SPI protocol for interfacing with the ocelot chips uses 24 bits, while + * the register locations are defined as 32-bit. The least significant two bits + * get shifted out, as register accesses must always be word-aligned, leaving + * bits 21:0 as the 22-bit address. It must always be big-endian, whereas the + * payload can be optimized for bit / byte order to match whatever architecture + * the controlling CPU has. + */ +static unsigned int ocelot_spi_translate_address(unsigned int reg) +{ + return cpu_to_be32((reg & 0xffffff) >> 2); +} + +struct ocelot_spi_regmap_context { + u32 base; + struct ocelot_core *core; +}; + +static int ocelot_spi_reg_read(void *context, unsigned int reg, + unsigned int *val) +{ + struct ocelot_spi_regmap_context *regmap_context = context; + struct ocelot_core *core = regmap_context->core; + struct spi_transfer tx, padding, rx; + struct spi_message msg; + struct spi_device *spi; + unsigned int addr; + u8 *tx_buf; + + spi = core->spi; + + addr = ocelot_spi_translate_address(reg + regmap_context->base); + tx_buf = (u8 *)&addr; + + spi_message_init(&msg); + + memset(&tx, 0, sizeof(tx)); + + /* Ignore the first byte for the 24-bit address */ + tx.tx_buf = &tx_buf[1]; + tx.len = 3; + + spi_message_add_tail(&tx, &msg); + + if (core->spi_padding_bytes > 0) { + u8 dummy_buf[16] = {0}; + + memset(&padding, 0, sizeof(padding)); + + /* Just toggle the clock for padding bytes */ + padding.len = core->spi_padding_bytes; + padding.tx_buf = dummy_buf; + padding.dummy_data = 1; + + spi_message_add_tail(&padding, &msg); + } + + memset(&rx, 0, sizeof(rx)); + rx.rx_buf = val; + rx.len = 4; + + spi_message_add_tail(&rx, &msg); + + return spi_sync(spi, &msg); +} + +static int ocelot_spi_reg_write(void *context, unsigned int reg, + unsigned int val) +{ + struct ocelot_spi_regmap_context *regmap_context = context; + struct ocelot_core *core = regmap_context->core; + struct spi_transfer tx[2] = {0}; + struct spi_message msg; + struct spi_device *spi; + unsigned int addr; + u8 *tx_buf; + + spi = core->spi; + + addr = ocelot_spi_translate_address(reg + regmap_context->base); + tx_buf = (u8 *)&addr; + + spi_message_init(&msg); + + /* Ignore the first byte for the 24-bit address and set the write bit */ + tx_buf[1] |= BIT(7); + tx[0].tx_buf = &tx_buf[1]; + tx[0].len = 3; + + spi_message_add_tail(&tx[0], &msg); + + memset(&tx[1], 0, sizeof(struct spi_transfer)); + tx[1].tx_buf = &val; + tx[1].len = 4; + + spi_message_add_tail(&tx[1], &msg); + + return spi_sync(spi, &msg); +} + +static const struct regmap_config ocelot_spi_regmap_config = { + .reg_bits = 24, + .reg_stride = 4, + .val_bits = 32, + + .reg_read = ocelot_spi_reg_read, + .reg_write = ocelot_spi_reg_write, + + .max_register = 0xffffffff, + .use_single_write = true, + .use_single_read = true, + .can_multi_write = false, + + .reg_format_endian = REGMAP_ENDIAN_BIG, + .val_format_endian = REGMAP_ENDIAN_NATIVE, +}; + +struct regmap * +ocelot_spi_devm_get_regmap(struct ocelot_core *core, struct device *child, + const struct resource *res) +{ + struct ocelot_spi_regmap_context *context; + struct regmap_config regmap_config; + + context = devm_kzalloc(child, sizeof(*context), GFP_KERNEL); + if (IS_ERR(context)) + return ERR_CAST(context); + + context->base = res->start; + context->core = core; + + memcpy(®map_config, &ocelot_spi_regmap_config, + sizeof(ocelot_spi_regmap_config)); + + regmap_config.name = res->name; + regmap_config.max_register = res->end - res->start; + + return devm_regmap_init(child, NULL, context, ®map_config); +} + +static int ocelot_spi_probe(struct spi_device *spi) +{ + struct device *dev = &spi->dev; + struct ocelot_core *core; + int err; + + core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); + if (!core) + return -ENOMEM; + + if (spi->max_speed_hz <= 500000) { + core->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. + */ + core->spi_padding_bytes = 1 + + (spi->max_speed_hz / 1000000 + 2) / 8; + } + + core->spi = spi; + + spi->bits_per_word = 8; + + err = spi_setup(spi); + if (err < 0) { + dev_err(&spi->dev, "Error %d initializing SPI\n", err); + return err; + } + + core->cpuorg_regmap = + ocelot_spi_devm_get_regmap(core, dev, + &vsc7512_dev_cpuorg_resource); + if (IS_ERR(core->cpuorg_regmap)) + return -ENOMEM; + + core->dev = dev; + + /* + * 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(core); + if (err) { + dev_err(dev, "Error %d initializing Ocelot SPI bus\n", err); + return err; + } + + err = ocelot_core_init(core); + if (err < 0) { + dev_err(dev, "Error %d initializing Ocelot MFD\n", err); + return err; + } + + return 0; +} + +const struct of_device_id ocelot_spi_of_match[] = { + { .compatible = "mscc,vsc7512_mfd_spi" }, + { }, +}; +MODULE_DEVICE_TABLE(of, ocelot_spi_of_match); + +static struct spi_driver ocelot_spi_driver = { + .driver = { + .name = "ocelot_mfd_spi", + .of_match_table = of_match_ptr(ocelot_spi_of_match), + }, + .probe = ocelot_spi_probe, +}; +module_spi_driver(ocelot_spi_driver); + +MODULE_DESCRIPTION("SPI Controlled Ocelot Chip Driver"); +MODULE_AUTHOR("Colin Foster "); +MODULE_LICENSE("Dual MIT/GPL"); diff --git a/drivers/mfd/ocelot.h b/drivers/mfd/ocelot.h new file mode 100644 index 000000000000..20d3853dd6d2 --- /dev/null +++ b/drivers/mfd/ocelot.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* + * Copyright 2021 Innovative Advantage Inc. + */ + +#include +#include + +struct ocelot_core { + struct device *dev; + struct regmap *gcb_regmap; + struct regmap *cpuorg_regmap; + +#if IS_ENABLED(CONFIG_MFD_OCELOT_SPI) + int spi_padding_bytes; + struct spi_device *spi; +#endif +}; + +void ocelot_get_resource_name(char *name, const struct resource *res, + int size); +int ocelot_core_init(struct ocelot_core *core); +int ocelot_remove(struct ocelot_core *core); + +#if IS_ENABLED(CONFIG_MFD_OCELOT_SPI) +struct regmap *ocelot_spi_devm_get_regmap(struct ocelot_core *core, + struct device *child, + const struct resource *res); +int ocelot_spi_initialize(struct ocelot_core *core); +#else +static inline struct regmap *ocelot_spi_devm_get_regmap( + struct ocelot_core *core, struct device *child, + const struct resource *res) +{ + return ERR_PTR(-EOPNOTSUPP); +} + +static inline int ocelot_spi_initialize(struct ocelot_core *core) +{ + return -EOPNOTSUPP; +} +#endif diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 998616511ffb..d9e2710d5646 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -1018,11 +1018,16 @@ ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port, } #endif +#if IS_ENABLED(CONFIG_MFD_OCELOT) +struct regmap *ocelot_get_regmap_from_resource(struct device *child, + const struct resource *res); +#else static inline struct regmap * ocelot_get_regmap_from_resource(struct device *child, const struct resource *res) { return ERR_PTR(-EOPNOTSUPP); } +#endif #endif From patchwork Mon Mar 7 02:12:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 549902 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE636C4332F for ; Mon, 7 Mar 2022 02:13:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233976AbiCGCN5 (ORCPT ); Sun, 6 Mar 2022 21:13:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234723AbiCGCNn (ORCPT ); Sun, 6 Mar 2022 21:13:43 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2104.outbound.protection.outlook.com [40.107.93.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E077C1B782; Sun, 6 Mar 2022 18:12:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NcqwAtXX2hb4JSH7UJjsMDBJABvkl/8g7tLuiVLuGW84XAVvdHgYutkAPkQvIwnL8MsO9IQ2o9ICrYCrrkc5M92Tp2xUG47P5I4wP5vFo7kumLJFM6EDLKWWhnqkWwVeUpo+lshlt9UIadz/uR82F2L5TXzTHMzYTYrCFstM77ppm30V6fJZYi76AL7/LnOMR2mOqrjhZpr2KK0L/MlKg8gEG9D0Ge0+tnMidXBSZdKCdi+9y+T+mASO/vA+0xWfQPW15eqIrnlLMWRjGefTn65nFbNxMUiYYgQz86CVm+SwBnTxA3f9N5myUThlaA6cStRu6IAkCy8wRr+aGlzpOw== 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=QV657+McWv/jnkwNJ2N6k6LOi6WxEwlFpgFimBh2Edc=; b=G7GMtZw+xFQxx41Otf+oiEeklCOOCIS3+OnrjjTMtm/xA8TkL9Sr9w5Io7norInwBdeqHN6A9d5an2ps4OCFOk6n+e82Pl6ny2gup932FGaqdhbDajUKlcmaJ33gTgKwa0v2slhDBxLfJQvGi6K1Nu4LlEg/bmltwhWlBfaL44+Rf0L2kTwtbae0+I+fjYXRREi6+QybetbQgVHZhWLujXwJz7xIhRwv33jRv2wFW4bbyJL7DXWEfD1uPTqAxBdpL/LE2obP4HME5gIklHQU7ypS/93jrBTtRJsEHZTFR0HRajacUWE/2vPu1fFxGzPLEY1uiowWDTjfmnXo1XW8fQ== 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=QV657+McWv/jnkwNJ2N6k6LOi6WxEwlFpgFimBh2Edc=; b=cag7A99YJnEqO+NeR9sA7Ep1mBJ1LKh1AoKDD6e8Pc8Ob7iHgBfg7+J9kk5tcK6ksOXqamA2JknvmGFdrtfWPdZTAo6WE6zbLAq7wbAPUoToEBCAgnKv4w/gI+x3wZ48+TdWzHnS0gI2rW9vN8zGT2U8cws85EsGRQLRL6ToZas= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:34 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:34 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v7 net-next 11/13] net: mscc: ocelot: expose ocelot wm functions Date: Sun, 6 Mar 2022 18:12:06 -0800 Message-Id: <20220307021208.2406741-12-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: bcb58d44-21cf-4ddd-3413-08d9ffdff11a X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fB2L3UsvvrqnvMtJRDSDRNzD7sFecpUEaHxKi3XaZ/tNLG2ZmITYuCCECTsxp+W10ZzbepEe1lkMVrx6jZUFe3TlRmULDd0Sh4YKY/3HonJ0ZlTYMjUrA539F+PByAzufAmy0gFMTXMRBX1//npg00AATI2DlmfbjpbG8NcXq316TAudPJBBRKUfpEXqrO5xMmoIAsPbA0KVCiO5eSFHQo03D445xqltAi57y8HLXUhNLmkjzfeWlx0JxCiVP+sOUJNxyAEOMPROoE5y8IhUCRVYFEXNEldFtCEiJu/D4mHmcn+E8nQ+iYQ4SJyhf2L0PZ6rsVv+RwRLl7hsQztcImsQgFYTwkOWsFX7ox2tNeu08hXGKAVAlZliq79vrtOLWn+oWGS7BpDWEsr+G8nUItsTMglUe4KGzoTs6VhPKg/83mLgre8rXTCwG/t2Vw890BRAgmRORdJFjHNZ2FQCsPOyHrvTbQWjxs/yFB7ZI9W45cD/gOkUN3aYuSQnWuyc/5ZfzULqwDZpq9A8baJ88wQtGgC3zK+US2CKiA/P84sduhuTWxmBb5+ED5N5vrt/Vzz5Xs/4orUSR6wLuU6bBbDt10lVVdG3pUyQL6XEBf1crUaFHjQxS8lKdjL7RCLfrB3I3sCT3KYGhtQtxDRzsFl95EBEJ5yf8tdrAYpp+tZgVzbs9LEBV7AAOcUorIPfNOMm40wN+NhI8TRhfRfnDA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(376002)(42606007)(396003)(136003)(39840400004)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(83380400001)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: upyFk9vehWOVYLjzr75yjMUu4GV0TVcy+tD0FXHJTSzfSCdZrALoALztV0ZllMP9SFBrOSHOgDipSLTXu+nSBWp15niWwnxHYYKBmyYBJXGHDs97zv/c7UYsWcl+4Esu6Ne3tMipYyGFhs6ofDpo7OLqHi+wdcn4vgkTHOUa0jHm+amB0hsWylOLo5nZ60+qZLztkkOXbxZHidy7e75/3qbq+GxCe9cF4UToFSdcl/fX7cdLnVniYpucAse5mMJ47Q0Y7hx/Y28NQN6UJrt755khmKNhSRlfGwnHNQwEUqUDTWljCdxYZH77+bOJFSBNdBKjVb8agSlb+XK66IntjdfKDg8yS4ApcbG127oy0FaXFIMXYRGrLQT4HgmdRtGAkqdItGHb9SGoLXm5CnlIk/gv3r+cBJvdPRXQySO6Z7E1JX3EA9TeSDFq1PhkbdOSPV/4TgWVWnSklVhYLnDcpWK+aCGdb+d904SRcAuJCXfVnd88aA6/Ne+RMkr0deHsUzKm2hWlhAq/IIDVpuuM7sG/EplJxM1ci9rtJsDUpCQ9KJfwiSeNvqWszWjXCzrW/twDcABwSD2FFU9Z0iVVBsIPj+F2/rbRn4wk9+jtUGGxys1ake1wTjh8duFV70pXBcqa4DxbcHcRkZf/6nat9O2BYwAT1KC2ah/8f7q5OaQodWfKaZkSN/8qJd3XbgYQ2fCdNfPvZHQVC+mJDRooKUAJXnpQqwI0hTq7SGa6vEvsGT1W01UtbKOY7UXCLuNuJ+KPqTB71UnYdcxl7FJLKMYqk8gZI0W3fAaeUGXoT1uH2mETtiY1X0avvyzgrz7z2yYVejFxCwanG/J0hNXzAzWv+G9Hez98S5Eo35XOoo91YMMdPssNlNOueBqOZjtu3amWFuxLVO2tZfcP6JJjls+4z1GjiVMYQ9/WAS6TW4L+KkTctA0t2MW3fgoBNFAzjRQdmWYFENg+4nxqpbTI9YazDrzl4r8vfWNP67eZVoNiZ+cPZIPORqLLf6m8jcHSnTeW5VSJ7KzbT0rjGW5BQHY9MNKWt3WRm1PNarb7o4L9DRiTJ2ZXT5JKtzWEC7SMBF/mxUYhAPcFjfEv2N/8Ckt8aM0phquGK4kILsJdVVVZia219Cta/ai3chxR9Cp54NHdZ3a/AS9QS54kZcIdiu9Qqgsy2p1noRR/mSfS0g/yqwxdp8cHib+lCuMlHemDW6X5oB6/O7/hNkkVGry9vbXnXsCx3ZmrDH0PaPPUU0Qors8Vx/OlNFYKrz1djjacVU7LWzMdOtHjt5qMP93xH0GuLobFqXia/6lfHMxM7vquopFAeBUtSLQa4xC9nZEJ3KRZuSJNTlg3jrE0mlYKhyAUnxq9//mzlshXtfYG810TVKng0lKwooKQCVD4se1xACLAVYTcFAFthELAHqMzENmNYD47UVYPmKr1z53zkg+eXuNq6FQeo/H5CLTl5tOEa9AYIoa6DAoDwNmihFk33FiozwyTCnlj82a3ZRr2XuF6+r8NXfi3TZ+xV0Ct3TsUobhTjKGnsKb4xxHLri19QbplIP6J3u3YYjVmnedldd9mMY4Wb/RpogO80QzmtXJ1y9h4tXEdQI0dhDjYHyOpckmoH89JmxciSJz45LETVHhPFJ8gvfzM9lYjqbrEWC9v3C1j16Th4nYP/BdW2hPVEuz+puAsXpAjphormGE236o= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: bcb58d44-21cf-4ddd-3413-08d9ffdff11a X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:34.0108 (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: Ph5baFsXgvpnijCRV9N4Zk0RCZTjdHJVhuyItKoz8bnWHlUU9er4qBhFad02DpUSc5AGnxyYL0224BHn+id+UpCV6KjnQfbwxY5QyVqfzsY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Expose ocelot_wm functions so they can be shared with other drivers. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/mscc/ocelot_devlink.c | 31 ++++++++++++++++++++++ drivers/net/ethernet/mscc/ocelot_vsc7514.c | 28 ------------------- include/soc/mscc/ocelot.h | 5 ++++ 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_devlink.c b/drivers/net/ethernet/mscc/ocelot_devlink.c index b8737efd2a85..d9ea75a14f2f 100644 --- a/drivers/net/ethernet/mscc/ocelot_devlink.c +++ b/drivers/net/ethernet/mscc/ocelot_devlink.c @@ -487,6 +487,37 @@ static void ocelot_watermark_init(struct ocelot *ocelot) ocelot_setup_sharing_watermarks(ocelot); } +/* Watermark encode + * Bit 8: Unit; 0:1, 1:16 + * Bit 7-0: Value to be multiplied with unit + */ +u16 ocelot_wm_enc(u16 value) +{ + WARN_ON(value >= 16 * BIT(8)); + + if (value >= BIT(8)) + return BIT(8) | (value / 16); + + return value; +} +EXPORT_SYMBOL(ocelot_wm_enc); + +u16 ocelot_wm_dec(u16 wm) +{ + if (wm & BIT(8)) + return (wm & GENMASK(7, 0)) * 16; + + return wm; +} +EXPORT_SYMBOL(ocelot_wm_dec); + +void ocelot_wm_stat(u32 val, u32 *inuse, u32 *maxuse) +{ + *inuse = (val & GENMASK(23, 12)) >> 12; + *maxuse = val & GENMASK(11, 0); +} +EXPORT_SYMBOL(ocelot_wm_stat); + /* Pool size and type are fixed up at runtime. Keeping this structure to * look up the cell size multipliers. */ diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 4f4a495a60ad..5e526545ef67 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -307,34 +307,6 @@ static int ocelot_reset(struct ocelot *ocelot) return 0; } -/* Watermark encode - * Bit 8: Unit; 0:1, 1:16 - * Bit 7-0: Value to be multiplied with unit - */ -static u16 ocelot_wm_enc(u16 value) -{ - WARN_ON(value >= 16 * BIT(8)); - - if (value >= BIT(8)) - return BIT(8) | (value / 16); - - return value; -} - -static u16 ocelot_wm_dec(u16 wm) -{ - if (wm & BIT(8)) - return (wm & GENMASK(7, 0)) * 16; - - return wm; -} - -static void ocelot_wm_stat(u32 val, u32 *inuse, u32 *maxuse) -{ - *inuse = (val & GENMASK(23, 12)) >> 12; - *maxuse = val & GENMASK(11, 0); -} - static const struct ocelot_ops ocelot_ops = { .reset = ocelot_reset, .wm_enc = ocelot_wm_enc, diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index d9e2710d5646..480bf21da404 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -852,6 +852,11 @@ void ocelot_deinit_port(struct ocelot *ocelot, int port); void ocelot_port_set_dsa_8021q_cpu(struct ocelot *ocelot, int port); void ocelot_port_unset_dsa_8021q_cpu(struct ocelot *ocelot, int port); +/* Watermark interface */ +u16 ocelot_wm_enc(u16 value); +u16 ocelot_wm_dec(u16 wm); +void ocelot_wm_stat(u32 val, u32 *inuse, u32 *maxuse); + /* DSA callbacks */ void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data); void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data); From patchwork Mon Mar 7 02:12:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 549068 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95274C43219 for ; Mon, 7 Mar 2022 02:13:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234758AbiCGCNw (ORCPT ); Sun, 6 Mar 2022 21:13:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234725AbiCGCNo (ORCPT ); Sun, 6 Mar 2022 21:13:44 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2099.outbound.protection.outlook.com [40.107.93.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1F901C90F; Sun, 6 Mar 2022 18:12:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wl2UYcsNXM7OV+boPuL8DTqmbzTAChc2B0ErpvAzR83joRhnzfeHgb7PFhJV2XdOXpfIVJoHc0kOeU7uCrHAxOQAhbNN4vxDwOQhiMTpGKJ7cd5bH62/sSBoeLAxxEGmLFFU4xHVsywfFhU+oVgcp8WLwjrUVslIs2+b5+iuosEFOJYJr/u58H6gxK5C/x4JcBMHKuPeWaLmaLWMjoK3WnNw+bgXlU5eXTaAPGCebNkt6lcgXXb4F/k1Pk7epA1RCLe+cvrZ6yK6JQD/HhHU9uucGckeeLpAXq+QkLNGA0C3nbUo8/YMrMud0zOBW7Plxpg7WmYFNf7Q4iIgixdyJw== 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=1yHcS8+H0EQSbT6XNcAd9KChHXtk1wzd33u2GdJWRGM=; b=VnGScs7aKayAzdgtnX03h4kjxaiRCFHRWuOtZHEr8PO6KKOu7xvgG5VA+IRL47xbU5R0gd8wxIITG5trhs5fpm689k/KdnDBzBXww99Z9pgdn/bk3YS+HVcoaKwSwR6yjzpO4S8CbwcmOs+Rzkb+QbxXnVzTbRXyRrx0FqdshXYOrvClIlTTLxXu1aE/H2mhsTDO++a6w21YygoG68j83KgxcKvOF7LrAy0NmHjKIsPbEUp2y7rO39/EvOuZjunSSoolFSC7E3MQhl4qtlHiUu8/UDs9zwKtQ10R5R53+0Z53Dco1oT+Qw1k1O1SlCfqLiC3W6dsx0IaTQo3dqVMCQ== 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=1yHcS8+H0EQSbT6XNcAd9KChHXtk1wzd33u2GdJWRGM=; b=gnlQwPXlLQkXxKMJFk3A0PqX6cgTvvEsJkJCcnKwvj/SfUqCA7S81QRUUPzR0RCLBSX9DtMscHtpJrfmz2vPGUuymu5W1Toz2UGERJ5na+odR6pL4bAudvaAqXkUdOUUOuzJEEq1Bkvv8HYVaZfZP0SqNFz6PlF6Xo+QSqkVkR8= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:35 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:35 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v7 net-next 12/13] net: dsa: felix: add configurable device quirks Date: Sun, 6 Mar 2022 18:12:07 -0800 Message-Id: <20220307021208.2406741-13-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: 474f6295-5df3-417f-79eb-08d9ffdff1a4 X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7fbYS2lxAdmieirmWiGZLQyTZSd2T8wTP288tmKCbIAKHXxCXIKZIA+oNj7j5/285t4h0anx0VeHB2ugZQLw9Ua5kvXYIuToVlqVS2RQdPC75wpgzDIZT54ih4pN1ramP99oEJSuSca0g2EC9IfjRUDUiWtnoCx6shZY9N8O3ww6vX9iBnwQvnsJud4i4g1ZuSp3qZ8jJ5queoJE1zyymXolSbOwwKtQNbQXOyIbCteIEKownK5E9wlO2h0kuw8RH+6AU3MT7XHg9oaUWBOo++nD15Zfx7f2I4phWqL3DMC2kBJnoOhpHr9LsW0Et2a1nuNgRZzaU8CmqGsb7n2bs4KPERuuP8uZEJWnPg/KYhL5e5/uJet3QXkUvqHp/LJ2av3tfibQM5slU4+SfF71DKYUpdcUZqq9ivzhxbHnS94mgvhMPRnrkm6v0JXxaJ3ES5eCn36aqtwOi7/DNZRfbi9n67GhyxL7QTojx3LLE/9CcGQnI6cLF6wTvLD8j1ffFezT5v7zSStcqlFUnoqpVKQ93K2S4Q21UiwBj24MWgF/Q+25+Ud03JLCPSkvZeGxOUwHiUYLIzG43EMI0AQVi30Zq/ASQ4Qt/D32VK3K6ifkaUvPHr/RQg7k62UpUPVT+KDiE4W++20mf9u8ajEYOWbZymps/KQOeMuKbtiZ/t5k8lNAOZykgixDwXaNeyqiGPtNbaFwS8tabQY4pGzGig== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(376002)(42606007)(396003)(136003)(39840400004)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(83380400001)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: P/LIXIXIelF9Z9+beZ9uAIKWcsUTs7Vr7jzuii8eVSO4o436HTtc6dR3mBEp4JOlPywk1WS9fhJk0M0NVhIZOqRRb4OQFcVvMgKz7jjpwpn7EnK8hXyXcn9NllkM2EzWaGCS3Tjxc6JhMDdHwtHiPTEId9Qz0CWLsl2iDi9I90yXoDmuIPPR1Ihhm/tq6YIkO5dRdTAx890U0rwMAMs0zFVI06Ve0kY28BHHGgtgYjgCh66Yza1ud2K/W4OXw4Y6tPLIJT2g3ZnT0cwUmy9PRjomxN53IXEXZDmU3bkKbCO1pCHKCO67GhEd3/rFB9nevO/xIElc8HPXYUb6IiQN1JeMAhh06aPAjHbgTfWQsMR0YCBRLA+6QRyeaMTkm+in3mdSSmmOTPoiZGgbFp8Amc4mWm3qBH3mDds4nTLw35LEK4V2xYHDyFB85pRGBBVbs73ui6eRKEHk7A5/Z5PtEy+rGG1RUAISlkhd6d8lYLY3XDPyssRhDU++STSAq+HAyuOXePGgpWSI9Tyouabx1UWOZ5Vzb3NRm5A8OPyjM1T0Zy8ftpFMN9dgW3vmzXTsWDROO2RlyXLBiQm9+aejfycx7HSuSLLZjxWRgZnHo31hdiCJ2tICUPqbICyiaJRsBwcUlhsLLfIrmVQIzqYuBKQgKG0bPapJMN3O9K0jMENzDOr4P2Ba37slb/dyOLitsbxjKNFV0G0l9CMcXZ8cWqkTFN0AZPwz6J8naWEecsOdJcddSm9FA7NNdtx+QSGjUYAUP1agGgbuuFBKQr2FVhRRjbr0/CeDcDuM17hxKz/nfWBv1pPni0L1XsXRPJ+WLDv9CPZpWd+Mc4jC5FCJ4pEg235YvX9IEmH265uAMVyfLIYyy70viwPO8uleGyldDES8WhKLCySdMi1sf34+kqP6P+wRlL7kNkScbDqFSO7A9Qj1zMszLg/q0LjHwEmGyxGSmjuHN61eqLyWyCbdXplEittVed/+/tfrajNQ90MxBFYdZ6g8LmRNPJaZlhFrZQs++l7pW6ghxmEk6BRyDpU0QZB4Z63gOQTww/aHS2kv96U5krXiiLxin1ckCF1jW4o5mPvLgdj8VCik89PxtxqKIQVED68wxbp9UtUwBY9in4FjTt1qVQWGg7gRtEcyLemhKSi/d6MDKhuvzz490moJy9Jm/Mg1vb8sFMdgx2ainZ6YIKMEDkIQvhvZbQAZxvItboXd0LMLfbf+zgDWmAUr67dA5e0tUaNJ4EHbTCLPy7wQWBh7MSicD66WGfwRHTANGyUEixPSVrYFgz2GUNZqUrmpaco7/PWQ5qQFfP1oBA76Q3kL3cZ1aLaZfGtwvBfLSHYXc5Lq5LTkSZyhEtWk6184p7jn/fPJaw+ZQx276Oxnphv0Za++zexgZJyeHJDtHxOKGTssSukgrTC30qsxrg1aDZFITOFAk2jTCqBHNilBsf41ED4UE8pYHA099ycKXIiPnfxt29rwMsNRgnwpg/Cvah6QYJ14eqxRlNgNBLkzK6oSD3nlksRG5HMcB6n4PKeAEjEqMMswnHwjItzxDHnqORtA14RMtriLKixSwGuHaZkIkgaq0V0SuTLavkAVgzTVO7A7XeICUTzbo+XX9BcUUQMrhtG6xFI7aU/hlUAPJ6v1wDvAwPBkK3bRtNk2YH1LxJmEnkxrnifnnzv8MdVGxDknu6Cu/Wol1Vc= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 474f6295-5df3-417f-79eb-08d9ffdff1a4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:34.9169 (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: qz86541FWkEwzkMw9zmidnm3/RKputRPtYqRatm8EXo4yURmIWoukcDh+f8/LupFDlnXkHneLkQnXGblzR+7WqwpQRnM4L5DPWUDlHD30ZE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The define FELIX_MAC_QUIRKS was used directly in the felix.c shared driver. Other devices (VSC7512 for example) don't require the same quirks, so they need to be configured on a per-device basis. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean --- drivers/net/dsa/ocelot/felix.c | 7 +++++-- drivers/net/dsa/ocelot/felix.h | 1 + drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + drivers/net/dsa/ocelot/seville_vsc9953.c | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 7cc67097948b..7cf4afc6ed9a 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -997,9 +997,12 @@ static void felix_phylink_mac_link_down(struct dsa_switch *ds, int port, phy_interface_t interface) { struct ocelot *ocelot = ds->priv; + struct felix *felix; + + felix = ocelot_to_felix(ocelot); ocelot_phylink_mac_link_down(ocelot, port, link_an_mode, interface, - FELIX_MAC_QUIRKS); + felix->info->quirks); } static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, @@ -1014,7 +1017,7 @@ static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, ocelot_phylink_mac_link_up(ocelot, port, phydev, link_an_mode, interface, speed, duplex, tx_pause, rx_pause, - FELIX_MAC_QUIRKS); + felix->info->quirks); if (felix->info->port_sched_speed_set) felix->info->port_sched_speed_set(ocelot, port, speed); diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index f083b06fdfe9..0323383dee1e 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -33,6 +33,7 @@ struct felix_info { u16 vcap_pol_base2; u16 vcap_pol_max2; const struct ptp_clock_info *ptp_caps; + unsigned long quirks; /* Some Ocelot switches are integrated into the SoC without the * extraction IRQ line connected to the ARM GIC. By enabling this diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index ead3316742f6..1f79ed4ccef4 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -2220,6 +2220,7 @@ static const struct felix_info felix_info_vsc9959 = { .num_mact_rows = 2048, .num_ports = VSC9959_NUM_PORTS, .num_tx_queues = OCELOT_NUM_TC, + .quirks = FELIX_MAC_QUIRKS, .quirk_no_xtr_irq = true, .ptp_caps = &vsc9959_ptp_caps, .mdio_bus_alloc = vsc9959_mdio_bus_alloc, diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 68ef8f111bbe..58665abf9d02 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1092,6 +1092,7 @@ static const struct felix_info seville_info_vsc9953 = { .vcap_pol_max = VSC9953_VCAP_POLICER_MAX, .vcap_pol_base2 = VSC9953_VCAP_POLICER_BASE2, .vcap_pol_max2 = VSC9953_VCAP_POLICER_MAX2, + .quirks = FELIX_MAC_QUIRKS, .num_mact_rows = 2048, .num_ports = VSC9953_NUM_PORTS, .num_tx_queues = OCELOT_NUM_TC, From patchwork Mon Mar 7 02:12:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 549066 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49AC7C433F5 for ; Mon, 7 Mar 2022 02:13:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234729AbiCGCNz (ORCPT ); Sun, 6 Mar 2022 21:13:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234726AbiCGCNo (ORCPT ); Sun, 6 Mar 2022 21:13:44 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2104.outbound.protection.outlook.com [40.107.93.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9AE21CFD8; Sun, 6 Mar 2022 18:12:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hoWrC8Xkve2otf/PvYdrZ0Qevx1ueMBrtesrxJpwZ15H0q0rd/eq3ES99seXWISUwgWbJPLc10nldq5ZCCLJ1/+Rp1G65aHP23eEEVLFryiXyet4CnfS7JN+FHjGAJHpad6wZ3DfQI2pP7MgDOmBfyOUJyU7kh06fchUDeALtXqsow4pURs/53tHQBVUeA0soLCL1zCDyjFDrcKNiiOUgZeqdblRkgcSROSGO1s3YIny3ngBpX9wivSEmITZgYuJQf7BS5Rz09j6kQPsJ3+lIw+wQ0A7V6bjpv2MONhHOuQXvreMcJgoYM6/Oi7OkdRbrBiYIMrF43os9nzxWm6c8Q== 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=Qi/FmM0G0Nd7ekIq0XaLfOfTIkmAheq5hxfI40rby/E=; b=AWZ98A8KzIkippzp06IP1iBnzyv5foAmpmA+3dNEB3QUkauTzMwMjhqE1yV4eYpC9hZyecJqyPr8aHpYsqtKxyl6oVSCYGzf2DMESstVO4TTrBbSjuLUTByuEsjOFRng9qpW+naoZC0rhHJLLjGJk2TEeLkQLDRypmdOI3jX/px7WqxgWnv7gKZGytqMTftlu3QMbb1x7Lsdyvt3/Ovq2fCvG/6uSmAKMA/8A+d7aQnXVwNac8pDm20kNMrg86w4jBeTgmwyyecsvIBOKbX27usjytLgxXCg1M4XxOBnog5r3ua0ckVdXA0H13wGeyHOC2Bfn9vw64wYA3swr9OZQQ== 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=Qi/FmM0G0Nd7ekIq0XaLfOfTIkmAheq5hxfI40rby/E=; b=lIF++gG2KDM1gPPM3VxeK45cd+Z3v6ypElG1vKXXkYjZBwS5eEDostCXtgRyuQnUu5lJMc8g/fyx75YUax8GPBg1+Z5N1mp2+EgoWuVNHuMx1eyfL401W+ogOkawm3zMA1NWOcYjb1rSOMCXSrZeeDHHfb1XVoeP06bp2RICsEI= 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 SA2PR10MB4553.namprd10.prod.outlook.com (2603:10b6:806:11a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 02:12:36 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 02:12:36 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-phy@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Marc Zyngier , Hector Martin , Angela Czubak , Steen Hegelund , Lars Povlsen , Linus Walleij , Vinod Koul , Kishon Vijay Abraham I , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Lee Jones , katie.morris@in-advantage.com Subject: [RFC v7 net-next 13/13] net: dsa: ocelot: add external ocelot switch control Date: Sun, 6 Mar 2022 18:12:08 -0800 Message-Id: <20220307021208.2406741-14-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307021208.2406741-1-colin.foster@in-advantage.com> References: <20220307021208.2406741-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0174.namprd04.prod.outlook.com (2603:10b6:303:85::29) 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: 9febf3dc-fa5a-4811-e6d1-08d9ffdff235 X-MS-TrafficTypeDiagnostic: SA2PR10MB4553:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c3XiLuddeFrp7J4yfXqo+tocCudxwA4HFInCihYR07nhUAW4iib7bXgYlFYl9ihXm5U5UygaprP1OImh+rb5Lms6jMnKjlyGvqHQYtElR8FfGb2RcfKcBjJ/13/ECFVwaI1hS6SHuTA0TIzNPxurP4brxCG5hsy5fMDogQ5PoI+Lq72DIsllb0cpAJmI1eIL9+o2VcrGedbWittwhA7SKJMhZjcLIvmKamAnEhX28CzBRZcH152vv5gDN3xW7uzv8pagJHhbwa2vbcwpOoaTK/ZTm22Ggc16uxCsQdYRJ2cwLLSDHnVqKyTk0mHrkSkPzGeAtKVCAjhGicQaRlUBiDWSqQzoKlQO/7dmol6lB8b7pk6xh5MfWnVSrYnw0xvfYCN5YlwCqPNYbaEENV5cpBaxHtEnDRLIvNDGKvz8oLa0g6gOGhvDyKq52FF54+ifRnYoULZojvGBQL0mOBPtGoQxflWjqpUFf2nY9mQ9qA1drRU9QlD00513JE+92YIzkbOOM8XZjLa1IoQPd+hw1lpmYEElE01NOVj9s0628PYHwa0RtZtcko7mprzy9orZPmr8HllcKdt7M0ZTxfxgusMxHdE0eVKomUkNyb4XjmhuKWGwAxSVdZsRjQQjD72eIY+5RrMvSaCTVryUHdiF2+32x0ZbRBu+4PJFVA8Mx6Rw1TMRqLnHlpw/M4ApwSSXzw9EfbxtJghUDv+sGcXk4w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(376002)(42606007)(396003)(136003)(39840400004)(346002)(38350700002)(86362001)(508600001)(107886003)(38100700002)(6486002)(54906003)(36756003)(44832011)(30864003)(6666004)(6506007)(66556008)(66946007)(4326008)(316002)(66476007)(8676002)(6512007)(26005)(186003)(8936002)(83380400001)(52116002)(1076003)(5660300002)(7416002)(2616005)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rZu4Qi9elkAFMEfL2WsaxF/TmBGWNdsoJuzt/16SS7vK3soLRHWbeH/4c4bu/ax6NWS6yveE7bHQRyFevEDD7yUaHSBeJ38mvC3ygIlcRlTDGRXXLqgI9zVY1kptAWIQvxsftuDLqPStaB+4PODgHZz7YvkhDKn4IcrTJm1naWjvMhbTIYD9BHT4X1PhM9rbYW7eULFQfI63R+SEdcuTdiU70h7URGHKvLiBUXez1BZ6THJoUN9Vz+niRDlURguOmCeBxjspbpOXj8jVDQ9IEY2sPdCIYQTb4MG3gdJaVBU0GggIm1ac9QUszegX62G742tSBCc57cJVKh2/ER/JmS+R/Cc+6xcTHHHVV+IXsW2R8dhhNBzDqmxv0JK3Kg7vVPTPRZ9kQDmeltbCjlNxSocySpdk82GhkQhIMqTqmjxhVXbZ32U9xrrjlOZUI2fg2/W5TIkwzIEGzpAFNoqwUSU8yIaxHeUmG5lB/FPavlBOm7g4E2GBXEVaQPVO3FwQ/vlwa5D4rzFeNVNFdjOWS5alrbfWadhgyuNaowk80R5f/kSJSDP88oRmB44hGCRDOFNirqxCMisYFtgfhzs8s9Dc0y1hUhqa8cmVdvUIjyJUkJ0EOBpQPwR5rxZ/WTluO/5lTFa9O8vvq/DsOU0p3DU4OG5mtr9NV/OgwvfAqZr/FreS5zkySb1WQ6lqhdrsc4D2U8W6VZgcxecn+c3g05DjZGe3oDfoHUq4JJNICt6eJfmPSZNDnBjzgvoDEMY0H4QHEuNgpCIGv1Oa9DZphrYMNhs0HduOFUpOEtBub/NomAbpd5CQdOXLJ9Xvk41PvSuDHkzKMdd9F231M+7njNuBinAj1ut4yRqG+kBVvlKpcAx51b4HzeHXusdzwQ51jWJk0Xu6kVTcQ8qX6Pr6OnYkErGY4IvB09jtniNTpQk2nCS41Lbzabm3zDk69l9URm4DvZrbvxbtslO66LshOlm738kBFU+uNUJENqSil2bWdQgStd/yokDZEoG3wi7WYtMIs8/AHW+YEou3ZT4kXYDnMHPICw1u1JHq4dfhykz+RowmcN38inoEumjFecBJswbEluIaStK1rPu2zVxvSuH4LQ9XTzgeS3se8IMXlqYdgQWs56Kuk4SKcP6AP3zwdjlChYujWCTu4EoFxwEq9kuYyztB52clWXZ4S1VsswW23eXy3PYguOqpv+ItQH8lBKAdkLi6Dr1lvpYCFC2ITfR9dnMc+3dI2yse6/SFqoqXe6ltimS9z5Z6tzz/uh3mSuSkb7a9Rx7R1xjopOcZlseYb/nze2nsydr0g1NJFabKKcDkfvCad5oD75/svoH6HWikCmPoYy6foRwLg18/DYMRl9nquDLiw971nP8fGiH+i6Z5P8abZHpJx4dmmfjht37/z295w+NKoPg7cYuoj47SC8Au+c7xuefh9bVooPWBi11mDoThqf0zw7b1dNJg3wNp58wg81JW41lt3g3Rr2XU07P1jgNx8kn1VXOF+XNOCbqGmwz+/wgIkNF220OLEQ+wG9lh39pOMbS1LSGRd/Bl9vKi9Cv84iyfH4v7TcwxecZjolA3dXMtVktRU84Q+X7G1WiKRicBIGnMz8gwQh7Z5wkeHXygWhY1K3vczJTAUZ/93KR28ZyJq9SOrCekgpxluUOpqJc7yE7rBjkG0XT6Yb8Zv31YnLTL3CgFI9g= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9febf3dc-fa5a-4811-e6d1-08d9ffdff235 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 02:12:35.8856 (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: yTqOVTEpyGBYrm1pIooWL0ZCGhQDX7Ta3+0O5Ovm5qK94sAotpX7gBKsqRVMjESI8ztjK4JnMa9KYLESmXym9C+pta694CPbwAujyS6MTfs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4553 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Add control of an external VSC7512 chip by way of the ocelot-mfd interface. Currently the four copper phy ports are fully functional. Communication to external phys is also functional, but the SGMII / QSGMII interfaces are currently non-functional. Signed-off-by: Colin Foster --- drivers/mfd/ocelot-core.c | 3 + drivers/net/dsa/ocelot/Kconfig | 14 + drivers/net/dsa/ocelot/Makefile | 5 + drivers/net/dsa/ocelot/ocelot_ext.c | 567 ++++++++++++++++++++++++++++ include/soc/mscc/ocelot.h | 2 + 5 files changed, 591 insertions(+) create mode 100644 drivers/net/dsa/ocelot/ocelot_ext.c diff --git a/drivers/mfd/ocelot-core.c b/drivers/mfd/ocelot-core.c index 36e4326a853a..c6afe1791ecc 100644 --- a/drivers/mfd/ocelot-core.c +++ b/drivers/mfd/ocelot-core.c @@ -142,6 +142,9 @@ static const struct mfd_cell vsc7512_devs[] = { .of_compatible = "mscc,vsc7514-serdes", .num_resources = ARRAY_SIZE(vsc7512_hsio_resources), .resources = vsc7512_hsio_resources, + }, { + .name = "ocelot-ext-switch", + .of_compatible = "mscc,vsc7512-ext-switch", }, }; diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfig index 220b0b027b55..f40b2c7171ad 100644 --- a/drivers/net/dsa/ocelot/Kconfig +++ b/drivers/net/dsa/ocelot/Kconfig @@ -1,4 +1,18 @@ # SPDX-License-Identifier: GPL-2.0-only +config NET_DSA_MSCC_OCELOT_EXT + tristate "Ocelot External Ethernet switch support" + depends on NET_DSA && SPI + depends on NET_VENDOR_MICROSEMI + select MDIO_MSCC_MIIM + select MFD_OCELOT_CORE + select MSCC_OCELOT_SWITCH_LIB + select NET_DSA_TAG_OCELOT_8021Q + select NET_DSA_TAG_OCELOT + help + This driver supports the VSC7511, VSC7512, VSC7513 and VSC7514 chips + when controlled through SPI. It can be used with the Microsemi dev + boards and an external CPU or custom hardware. + config NET_DSA_MSCC_FELIX tristate "Ocelot / Felix Ethernet switch support" depends on NET_DSA && PCI diff --git a/drivers/net/dsa/ocelot/Makefile b/drivers/net/dsa/ocelot/Makefile index f6dd131e7491..d7f3f5a4461c 100644 --- a/drivers/net/dsa/ocelot/Makefile +++ b/drivers/net/dsa/ocelot/Makefile @@ -1,11 +1,16 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_NET_DSA_MSCC_FELIX) += mscc_felix.o +obj-$(CONFIG_NET_DSA_MSCC_OCELOT_EXT) += mscc_ocelot_ext.o obj-$(CONFIG_NET_DSA_MSCC_SEVILLE) += mscc_seville.o mscc_felix-objs := \ felix.o \ felix_vsc9959.o +mscc_ocelot_ext-objs := \ + felix.o \ + ocelot_ext.o + mscc_seville-objs := \ felix.o \ seville_vsc9953.o diff --git a/drivers/net/dsa/ocelot/ocelot_ext.c b/drivers/net/dsa/ocelot/ocelot_ext.c new file mode 100644 index 000000000000..9755b13573c9 --- /dev/null +++ b/drivers/net/dsa/ocelot/ocelot_ext.c @@ -0,0 +1,567 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright 2021 Innovative Advantage Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "felix.h" + +#define VSC7512_NUM_PORTS 11 + +static const u32 vsc7512_port_modes[VSC7512_NUM_PORTS] = { + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_SGMII | OCELOT_PORT_MODE_QSGMII, + OCELOT_PORT_MODE_SGMII | OCELOT_PORT_MODE_QSGMII, + OCELOT_PORT_MODE_SGMII | OCELOT_PORT_MODE_QSGMII, + OCELOT_PORT_MODE_SGMII | OCELOT_PORT_MODE_QSGMII, + OCELOT_PORT_MODE_SGMII | OCELOT_PORT_MODE_QSGMII, + OCELOT_PORT_MODE_SGMII, + OCELOT_PORT_MODE_SGMII | OCELOT_PORT_MODE_QSGMII, +}; + +static const u32 vsc7512_gcb_regmap[] = { + REG(GCB_SOFT_RST, 0x0008), + REG(GCB_MIIM_MII_STATUS, 0x009c), + REG(GCB_PHY_PHY_CFG, 0x00f0), + REG(GCB_PHY_PHY_STAT, 0x00f4), +}; + +static const u32 *vsc7512_regmap[TARGET_MAX] = { + [ANA] = vsc7514_ana_regmap, + [QS] = vsc7514_qs_regmap, + [QSYS] = vsc7514_qsys_regmap, + [REW] = vsc7514_rew_regmap, + [SYS] = vsc7514_sys_regmap, + [S0] = vsc7514_vcap_regmap, + [S1] = vsc7514_vcap_regmap, + [S2] = vsc7514_vcap_regmap, + [PTP] = vsc7514_ptp_regmap, + [GCB] = vsc7512_gcb_regmap, + [DEV_GMII] = vsc7514_dev_gmii_regmap, +}; + +static void ocelot_ext_reset_phys(struct ocelot *ocelot) +{ + ocelot_write(ocelot, 0, GCB_PHY_PHY_CFG); + ocelot_write(ocelot, 0x1ff, GCB_PHY_PHY_CFG); + mdelay(500); +} + +static int ocelot_ext_reset(struct ocelot *ocelot) +{ + int retries = 100; + int err, val; + + ocelot_ext_reset_phys(ocelot); + + /* Initialize chip memories */ + err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1); + if (err) + return err; + + err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], 1); + if (err) + return err; + + /* MEM_INIT is a self-clearing bit. Wait for it to be clear (should be + * 100us) before enabling the switch core + */ + do { + msleep(1); + err = regmap_field_read(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], + &val); + if (err) + return err; + } while (val && --retries); + + if (!retries) + return -ETIMEDOUT; + + return regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1); +} + +static const struct ocelot_ops ocelot_ext_ops = { + .reset = ocelot_ext_reset, + .wm_enc = ocelot_wm_enc, + .wm_dec = ocelot_wm_dec, + .wm_stat = ocelot_wm_stat, + .port_to_netdev = felix_port_to_netdev, + .netdev_to_port = felix_netdev_to_port, +}; + +static const struct resource vsc7512_target_io_res[TARGET_MAX] = { + [ANA] = { + .start = 0x71880000, + .end = 0x7188ffff, + .name = "ana", + }, + [QS] = { + .start = 0x71080000, + .end = 0x710800ff, + .name = "qs", + }, + [QSYS] = { + .start = 0x71800000, + .end = 0x719fffff, + .name = "qsys", + }, + [REW] = { + .start = 0x71030000, + .end = 0x7103ffff, + .name = "rew", + }, + [SYS] = { + .start = 0x71010000, + .end = 0x7101ffff, + .name = "sys", + }, + [S0] = { + .start = 0x71040000, + .end = 0x710403ff, + .name = "s0", + }, + [S1] = { + .start = 0x71050000, + .end = 0x710503ff, + .name = "s1", + }, + [S2] = { + .start = 0x71060000, + .end = 0x710603ff, + .name = "s2", + }, + [GCB] = { + .start = 0x71070000, + .end = 0x7107022b, + .name = "devcpu_gcb", + }, +}; + +static const struct resource vsc7512_port_io_res[] = { + { + .start = 0x711e0000, + .end = 0x711effff, + .name = "port0", + }, + { + .start = 0x711f0000, + .end = 0x711fffff, + .name = "port1", + }, + { + .start = 0x71200000, + .end = 0x7120ffff, + .name = "port2", + }, + { + .start = 0x71210000, + .end = 0x7121ffff, + .name = "port3", + }, + { + .start = 0x71220000, + .end = 0x7122ffff, + .name = "port4", + }, + { + .start = 0x71230000, + .end = 0x7123ffff, + .name = "port5", + }, + { + .start = 0x71240000, + .end = 0x7124ffff, + .name = "port6", + }, + { + .start = 0x71250000, + .end = 0x7125ffff, + .name = "port7", + }, + { + .start = 0x71260000, + .end = 0x7126ffff, + .name = "port8", + }, + { + .start = 0x71270000, + .end = 0x7127ffff, + .name = "port9", + }, + { + .start = 0x71280000, + .end = 0x7128ffff, + .name = "port10", + }, +}; + +static const struct reg_field vsc7512_regfields[REGFIELD_MAX] = { + [ANA_ADVLEARN_VLAN_CHK] = REG_FIELD(ANA_ADVLEARN, 11, 11), + [ANA_ADVLEARN_LEARN_MIRROR] = REG_FIELD(ANA_ADVLEARN, 0, 10), + [ANA_ANEVENTS_MSTI_DROP] = REG_FIELD(ANA_ANEVENTS, 27, 27), + [ANA_ANEVENTS_ACLKILL] = REG_FIELD(ANA_ANEVENTS, 26, 26), + [ANA_ANEVENTS_ACLUSED] = REG_FIELD(ANA_ANEVENTS, 25, 25), + [ANA_ANEVENTS_AUTOAGE] = REG_FIELD(ANA_ANEVENTS, 24, 24), + [ANA_ANEVENTS_VS2TTL1] = REG_FIELD(ANA_ANEVENTS, 23, 23), + [ANA_ANEVENTS_STORM_DROP] = REG_FIELD(ANA_ANEVENTS, 22, 22), + [ANA_ANEVENTS_LEARN_DROP] = REG_FIELD(ANA_ANEVENTS, 21, 21), + [ANA_ANEVENTS_AGED_ENTRY] = REG_FIELD(ANA_ANEVENTS, 20, 20), + [ANA_ANEVENTS_CPU_LEARN_FAILED] = REG_FIELD(ANA_ANEVENTS, 19, 19), + [ANA_ANEVENTS_AUTO_LEARN_FAILED] = REG_FIELD(ANA_ANEVENTS, 18, 18), + [ANA_ANEVENTS_LEARN_REMOVE] = REG_FIELD(ANA_ANEVENTS, 17, 17), + [ANA_ANEVENTS_AUTO_LEARNED] = REG_FIELD(ANA_ANEVENTS, 16, 16), + [ANA_ANEVENTS_AUTO_MOVED] = REG_FIELD(ANA_ANEVENTS, 15, 15), + [ANA_ANEVENTS_DROPPED] = REG_FIELD(ANA_ANEVENTS, 14, 14), + [ANA_ANEVENTS_CLASSIFIED_DROP] = REG_FIELD(ANA_ANEVENTS, 13, 13), + [ANA_ANEVENTS_CLASSIFIED_COPY] = REG_FIELD(ANA_ANEVENTS, 12, 12), + [ANA_ANEVENTS_VLAN_DISCARD] = REG_FIELD(ANA_ANEVENTS, 11, 11), + [ANA_ANEVENTS_FWD_DISCARD] = REG_FIELD(ANA_ANEVENTS, 10, 10), + [ANA_ANEVENTS_MULTICAST_FLOOD] = REG_FIELD(ANA_ANEVENTS, 9, 9), + [ANA_ANEVENTS_UNICAST_FLOOD] = REG_FIELD(ANA_ANEVENTS, 8, 8), + [ANA_ANEVENTS_DEST_KNOWN] = REG_FIELD(ANA_ANEVENTS, 7, 7), + [ANA_ANEVENTS_BUCKET3_MATCH] = REG_FIELD(ANA_ANEVENTS, 6, 6), + [ANA_ANEVENTS_BUCKET2_MATCH] = REG_FIELD(ANA_ANEVENTS, 5, 5), + [ANA_ANEVENTS_BUCKET1_MATCH] = REG_FIELD(ANA_ANEVENTS, 4, 4), + [ANA_ANEVENTS_BUCKET0_MATCH] = REG_FIELD(ANA_ANEVENTS, 3, 3), + [ANA_ANEVENTS_CPU_OPERATION] = REG_FIELD(ANA_ANEVENTS, 2, 2), + [ANA_ANEVENTS_DMAC_LOOKUP] = REG_FIELD(ANA_ANEVENTS, 1, 1), + [ANA_ANEVENTS_SMAC_LOOKUP] = REG_FIELD(ANA_ANEVENTS, 0, 0), + [ANA_TABLES_MACACCESS_B_DOM] = REG_FIELD(ANA_TABLES_MACACCESS, 18, 18), + [ANA_TABLES_MACTINDX_BUCKET] = REG_FIELD(ANA_TABLES_MACTINDX, 10, 11), + [ANA_TABLES_MACTINDX_M_INDEX] = REG_FIELD(ANA_TABLES_MACTINDX, 0, 9), + [GCB_SOFT_RST_SWC_RST] = REG_FIELD(GCB_SOFT_RST, 1, 1), + [QSYS_TIMED_FRAME_ENTRY_TFRM_VLD] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 20, 20), + [QSYS_TIMED_FRAME_ENTRY_TFRM_FP] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 8, 19), + [QSYS_TIMED_FRAME_ENTRY_TFRM_PORTNO] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 4, 7), + [QSYS_TIMED_FRAME_ENTRY_TFRM_TM_SEL] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 1, 3), + [QSYS_TIMED_FRAME_ENTRY_TFRM_TM_T] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 0, 0), + [SYS_RESET_CFG_CORE_ENA] = REG_FIELD(SYS_RESET_CFG, 2, 2), + [SYS_RESET_CFG_MEM_ENA] = REG_FIELD(SYS_RESET_CFG, 1, 1), + [SYS_RESET_CFG_MEM_INIT] = REG_FIELD(SYS_RESET_CFG, 0, 0), + /* Replicated per number of ports (12), register size 4 per port */ + [QSYS_SWITCH_PORT_MODE_PORT_ENA] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 14, 14, 12, 4), + [QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 11, 13, 12, 4), + [QSYS_SWITCH_PORT_MODE_YEL_RSRVD] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 10, 10, 12, 4), + [QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 9, 9, 12, 4), + [QSYS_SWITCH_PORT_MODE_TX_PFC_ENA] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 1, 8, 12, 4), + [QSYS_SWITCH_PORT_MODE_TX_PFC_MODE] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 0, 0, 12, 4), + [SYS_PORT_MODE_DATA_WO_TS] = REG_FIELD_ID(SYS_PORT_MODE, 5, 6, 12, 4), + [SYS_PORT_MODE_INCL_INJ_HDR] = REG_FIELD_ID(SYS_PORT_MODE, 3, 4, 12, 4), + [SYS_PORT_MODE_INCL_XTR_HDR] = REG_FIELD_ID(SYS_PORT_MODE, 1, 2, 12, 4), + [SYS_PORT_MODE_INCL_HDR_ERR] = REG_FIELD_ID(SYS_PORT_MODE, 0, 0, 12, 4), + [SYS_PAUSE_CFG_PAUSE_START] = REG_FIELD_ID(SYS_PAUSE_CFG, 10, 18, 12, 4), + [SYS_PAUSE_CFG_PAUSE_STOP] = REG_FIELD_ID(SYS_PAUSE_CFG, 1, 9, 12, 4), + [SYS_PAUSE_CFG_PAUSE_ENA] = REG_FIELD_ID(SYS_PAUSE_CFG, 0, 1, 12, 4), +}; + +static const struct ocelot_stat_layout vsc7512_stats_layout[] = { + { .offset = 0x00, .name = "rx_octets", }, + { .offset = 0x01, .name = "rx_unicast", }, + { .offset = 0x02, .name = "rx_multicast", }, + { .offset = 0x03, .name = "rx_broadcast", }, + { .offset = 0x04, .name = "rx_shorts", }, + { .offset = 0x05, .name = "rx_fragments", }, + { .offset = 0x06, .name = "rx_jabbers", }, + { .offset = 0x07, .name = "rx_crc_align_errs", }, + { .offset = 0x08, .name = "rx_sym_errs", }, + { .offset = 0x09, .name = "rx_frames_below_65_octets", }, + { .offset = 0x0A, .name = "rx_frames_65_to_127_octets", }, + { .offset = 0x0B, .name = "rx_frames_128_to_255_octets", }, + { .offset = 0x0C, .name = "rx_frames_256_to_511_octets", }, + { .offset = 0x0D, .name = "rx_frames_512_to_1023_octets", }, + { .offset = 0x0E, .name = "rx_frames_1024_to_1526_octets", }, + { .offset = 0x0F, .name = "rx_frames_over_1526_octets", }, + { .offset = 0x10, .name = "rx_pause", }, + { .offset = 0x11, .name = "rx_control", }, + { .offset = 0x12, .name = "rx_longs", }, + { .offset = 0x13, .name = "rx_classified_drops", }, + { .offset = 0x14, .name = "rx_red_prio_0", }, + { .offset = 0x15, .name = "rx_red_prio_1", }, + { .offset = 0x16, .name = "rx_red_prio_2", }, + { .offset = 0x17, .name = "rx_red_prio_3", }, + { .offset = 0x18, .name = "rx_red_prio_4", }, + { .offset = 0x19, .name = "rx_red_prio_5", }, + { .offset = 0x1A, .name = "rx_red_prio_6", }, + { .offset = 0x1B, .name = "rx_red_prio_7", }, + { .offset = 0x1C, .name = "rx_yellow_prio_0", }, + { .offset = 0x1D, .name = "rx_yellow_prio_1", }, + { .offset = 0x1E, .name = "rx_yellow_prio_2", }, + { .offset = 0x1F, .name = "rx_yellow_prio_3", }, + { .offset = 0x20, .name = "rx_yellow_prio_4", }, + { .offset = 0x21, .name = "rx_yellow_prio_5", }, + { .offset = 0x22, .name = "rx_yellow_prio_6", }, + { .offset = 0x23, .name = "rx_yellow_prio_7", }, + { .offset = 0x24, .name = "rx_green_prio_0", }, + { .offset = 0x25, .name = "rx_green_prio_1", }, + { .offset = 0x26, .name = "rx_green_prio_2", }, + { .offset = 0x27, .name = "rx_green_prio_3", }, + { .offset = 0x28, .name = "rx_green_prio_4", }, + { .offset = 0x29, .name = "rx_green_prio_5", }, + { .offset = 0x2A, .name = "rx_green_prio_6", }, + { .offset = 0x2B, .name = "rx_green_prio_7", }, + { .offset = 0x40, .name = "tx_octets", }, + { .offset = 0x41, .name = "tx_unicast", }, + { .offset = 0x42, .name = "tx_multicast", }, + { .offset = 0x43, .name = "tx_broadcast", }, + { .offset = 0x44, .name = "tx_collision", }, + { .offset = 0x45, .name = "tx_drops", }, + { .offset = 0x46, .name = "tx_pause", }, + { .offset = 0x47, .name = "tx_frames_below_65_octets", }, + { .offset = 0x48, .name = "tx_frames_65_to_127_octets", }, + { .offset = 0x49, .name = "tx_frames_128_255_octets", }, + { .offset = 0x4A, .name = "tx_frames_256_511_octets", }, + { .offset = 0x4B, .name = "tx_frames_512_1023_octets", }, + { .offset = 0x4C, .name = "tx_frames_1024_1526_octets", }, + { .offset = 0x4D, .name = "tx_frames_over_1526_octets", }, + { .offset = 0x4E, .name = "tx_yellow_prio_0", }, + { .offset = 0x4F, .name = "tx_yellow_prio_1", }, + { .offset = 0x50, .name = "tx_yellow_prio_2", }, + { .offset = 0x51, .name = "tx_yellow_prio_3", }, + { .offset = 0x52, .name = "tx_yellow_prio_4", }, + { .offset = 0x53, .name = "tx_yellow_prio_5", }, + { .offset = 0x54, .name = "tx_yellow_prio_6", }, + { .offset = 0x55, .name = "tx_yellow_prio_7", }, + { .offset = 0x56, .name = "tx_green_prio_0", }, + { .offset = 0x57, .name = "tx_green_prio_1", }, + { .offset = 0x58, .name = "tx_green_prio_2", }, + { .offset = 0x59, .name = "tx_green_prio_3", }, + { .offset = 0x5A, .name = "tx_green_prio_4", }, + { .offset = 0x5B, .name = "tx_green_prio_5", }, + { .offset = 0x5C, .name = "tx_green_prio_6", }, + { .offset = 0x5D, .name = "tx_green_prio_7", }, + { .offset = 0x5E, .name = "tx_aged", }, + { .offset = 0x80, .name = "drop_local", }, + { .offset = 0x81, .name = "drop_tail", }, + { .offset = 0x82, .name = "drop_yellow_prio_0", }, + { .offset = 0x83, .name = "drop_yellow_prio_1", }, + { .offset = 0x84, .name = "drop_yellow_prio_2", }, + { .offset = 0x85, .name = "drop_yellow_prio_3", }, + { .offset = 0x86, .name = "drop_yellow_prio_4", }, + { .offset = 0x87, .name = "drop_yellow_prio_5", }, + { .offset = 0x88, .name = "drop_yellow_prio_6", }, + { .offset = 0x89, .name = "drop_yellow_prio_7", }, + { .offset = 0x8A, .name = "drop_green_prio_0", }, + { .offset = 0x8B, .name = "drop_green_prio_1", }, + { .offset = 0x8C, .name = "drop_green_prio_2", }, + { .offset = 0x8D, .name = "drop_green_prio_3", }, + { .offset = 0x8E, .name = "drop_green_prio_4", }, + { .offset = 0x8F, .name = "drop_green_prio_5", }, + { .offset = 0x90, .name = "drop_green_prio_6", }, + { .offset = 0x91, .name = "drop_green_prio_7", }, +}; + +static void ocelot_ext_phylink_validate(struct ocelot *ocelot, int port, + unsigned long *supported, + struct phylink_link_state *state) +{ + struct ocelot_port *ocelot_port = ocelot->ports[port]; + + __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; + + if (state->interface != PHY_INTERFACE_MODE_NA && + state->interface != ocelot_port->phy_mode) { + bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); + return; + } + + phylink_set_port_modes(mask); + + phylink_set(mask, Pause); + phylink_set(mask, Autoneg); + phylink_set(mask, Asym_Pause); + phylink_set(mask, 10baseT_Half); + phylink_set(mask, 10baseT_Full); + phylink_set(mask, 100baseT_Half); + phylink_set(mask, 100baseT_Full); + phylink_set(mask, 1000baseT_Half); + phylink_set(mask, 1000baseT_Full); + + bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS); + bitmap_and(state->advertising, state->advertising, mask, + __ETHTOOL_LINK_MODE_MASK_NBITS); +} + +static struct vcap_props vsc7512_vcap_props[] = { + [VCAP_ES0] = { + .action_type_width = 0, + .action_table = { + [ES0_ACTION_TYPE_NORMAL] = { + .width = 73, + .count = 1, + }, + }, + .target = S0, + .keys = vsc7514_vcap_es0_keys, + .actions = vsc7514_vcap_es0_actions, + }, + [VCAP_IS1] = { + .action_type_width = 0, + .action_table = { + [IS1_ACTION_TYPE_NORMAL] = { + .width = 78, + .count = 4, + }, + }, + .target = S1, + .keys = vsc7514_vcap_is1_keys, + .actions = vsc7514_vcap_is1_actions, + }, + [VCAP_IS2] = { + .action_type_width = 1, + .action_table = { + [IS2_ACTION_TYPE_NORMAL] = { + .width = 49, + .count = 2, + }, + [IS2_ACTION_TYPE_SMAC_SIP] = { + .width = 6, + .count = 4, + }, + }, + .target = S2, + .keys = vsc7514_vcap_is2_keys, + .actions = vsc7514_vcap_is2_actions, + }, +}; + +static struct regmap *ocelot_ext_regmap_init(struct ocelot *ocelot, + struct resource *res) +{ + return ocelot_get_regmap_from_resource(ocelot->dev, res); +} + +static const struct felix_info vsc7512_info = { + .target_io_res = vsc7512_target_io_res, + .port_io_res = vsc7512_port_io_res, + .regfields = vsc7512_regfields, + .map = vsc7512_regmap, + .ops = &ocelot_ext_ops, + .stats_layout = vsc7512_stats_layout, + .num_stats = ARRAY_SIZE(vsc7512_stats_layout), + .vcap = vsc7512_vcap_props, + .num_mact_rows = 1024, + .num_ports = VSC7512_NUM_PORTS, + .num_tx_queues = OCELOT_NUM_TC, + .phylink_validate = ocelot_ext_phylink_validate, + .port_modes = vsc7512_port_modes, + .init_regmap = ocelot_ext_regmap_init, +}; + +static int ocelot_ext_probe(struct platform_device *pdev) +{ + struct dsa_switch *ds; + struct ocelot *ocelot; + struct felix *felix; + struct device *dev; + int err; + + dev = &pdev->dev; + + felix = kzalloc(sizeof(*felix), GFP_KERNEL); + if (!felix) + return -ENOMEM; + + dev_set_drvdata(dev, felix); + + ocelot = &felix->ocelot; + ocelot->dev = dev; + + ocelot->num_flooding_pgids = 1; + + felix->info = &vsc7512_info; + + ds = kzalloc(sizeof(*ds), GFP_KERNEL); + if (!ds) { + err = -ENOMEM; + dev_err(dev, "Failed to allocate DSA switch\n"); + goto err_free_felix; + } + + ds->dev = dev; + ds->num_ports = felix->info->num_ports; + ds->num_tx_queues = felix->info->num_tx_queues; + + ds->ops = &felix_switch_ops; + ds->priv = ocelot; + felix->ds = ds; + felix->tag_proto = DSA_TAG_PROTO_OCELOT; + + err = dsa_register_switch(ds); + if (err) { + dev_err(dev, "Failed to register DSA switch: %d\n", err); + goto err_free_ds; + } + + return 0; + +err_free_ds: + kfree(ds); +err_free_felix: + kfree(felix); + return err; +} + +static int ocelot_ext_remove(struct platform_device *pdev) +{ + struct felix *felix = dev_get_drvdata(&pdev->dev); + + if (!felix) + return 0; + + dsa_unregister_switch(felix->ds); + + kfree(felix->ds); + kfree(felix); + + dev_set_drvdata(&pdev->dev, NULL); + + return 0; +} + +static void ocelot_ext_shutdown(struct platform_device *pdev) +{ + struct felix *felix = dev_get_drvdata(&pdev->dev); + + if (!felix) + return; + + dsa_switch_shutdown(felix->ds); + + dev_set_drvdata(&pdev->dev, NULL); +} + +const struct of_device_id ocelot_ext_switch_of_match[] = { + { .compatible = "mscc,vsc7512-ext-switch" }, + { }, +}; +MODULE_DEVICE_TABLE(of, ocelot_ext_switch_of_match); + +static struct platform_driver ocelot_ext_switch_driver = { + .driver = { + .name = "ocelot-ext-switch", + .of_match_table = of_match_ptr(ocelot_ext_switch_of_match), + }, + .probe = ocelot_ext_probe, + .remove = ocelot_ext_remove, + .shutdown = ocelot_ext_shutdown, +}; +module_platform_driver(ocelot_ext_switch_driver); + +MODULE_DESCRIPTION("External Ocelot Switch driver"); +MODULE_LICENSE("GPL v2"); diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 480bf21da404..da028c28a103 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -397,6 +397,8 @@ enum ocelot_reg { GCB_MIIM_MII_STATUS, GCB_MIIM_MII_CMD, GCB_MIIM_MII_DATA, + GCB_PHY_PHY_CFG, + GCB_PHY_PHY_STAT, DEV_CLOCK_CFG = DEV_GMII << TARGET_OFFSET, DEV_PORT_MISC, DEV_EVENTS,