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 E1CA6C433FE for ; Tue, 11 Jan 2022 18:28:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344933AbiAKS2A (ORCPT ); Tue, 11 Jan 2022 13:28:00 -0500 Received: from mail-bn1nam07on2132.outbound.protection.outlook.com ([40.107.212.132]:43150 "EHLO NAM02-BN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241941AbiAKS16 (ORCPT ); Tue, 11 Jan 2022 13:27:58 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hVAZon1jQW6lTymZiJZrzhjbybsORM9uP1SspWKCjHBSAm7aRWtKPkmT76psyA0Fr3iSBMTiVPXW1ChH4MvUhDjbw+AcRetKpk3IyDhTOvwnTu7hHl7DEHY+OFOyro5PO37NjNPf85upPWi2tAEgqd69K5TqhkSU9bpbm6i6YbWgiyxrl2eyEpe+yn4pFLABIffPvbfIJqT55zMjbZn4oExJ31Y5uMQzBBuXx2auRwOUSNCNspkbi07ruwThZGTOleHr+hlYvSbyvEvQ/8ld4iOM24VbqYJ0yje+qo0u2YRO0DwDb97P6+dNo17oDFEc+yTgT+RYsxxz8L+OFTsfNQ== 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=xBIRg89hlRdCZKOyUOVyBsntRHY7Rgw3SffrC59pNWg=; b=LxapCBwWo3rpp0rmN58D+SF0uCUkkw15HM7DzXCprWKX2eZ/C4N0O/9w9Pob7vthkm7HHxm+O/w1W30H8t5yubtzYTKSCPPq/8D9FGbBCj8FA1kt2KRcvMuLPuWZ70+FKf3pbs1r0TFZ021R7G1UvZF0/btT8O+JtHcbljQVk2DeCOYeIHzbG6pD3OEg0cecLRlIB+CJSFV78QpHm4pUWhb2pVfubcvj04po4mqLJcOHNuEOSC1DzPTAx3JljdkMwB485gOs+VOozXyfNAvJPX+L+CY7jCSKXK+7sr6DRICU4paDkxXqhAqSgfufqC444Fjo6qZTVU+7TO37YYXbNA== 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=xBIRg89hlRdCZKOyUOVyBsntRHY7Rgw3SffrC59pNWg=; b=uGR3hCGe5bSm+fvQOJu6ZLnmNhFQ69zKgdAFdunzGKk18QRsnaQe+r22INceff+DM+IYNtV8Grqs8lUa9yminyHrdVffKW+ltPEy3+l0hQsPfvGYpHQRrN3UF9vn7yjRHMffRFjjprx2uKHI84Bw9eQEWzljRcg8R+0axiEF5B0= 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 MWHPR10MB2032.namprd10.prod.outlook.com (2603:10b6:300:10b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9; Tue, 11 Jan 2022 18:27:54 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::2d52:2a96:7e6c:460f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::2d52:2a96:7e6c:460f%4]) with mapi id 15.20.4867.012; Tue, 11 Jan 2022 18:27:54 +0000 Date: Tue, 11 Jan 2022 10:28:15 -0800 From: Colin Foster To: Lee Jones Cc: Mark Brown , linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij , Russell King , Heiner Kallweit , Jakub Kicinski , "David S. Miller" , Florian Fainelli , Vivien Didelot , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean Subject: Re: [RFC v5 net-next 01/13] mfd: ocelot: add support for external mfd control over SPI for the VSC7512 Message-ID: <20220111182815.GC28004@COLIN-DESKTOP1.localdomain> References: <20211218214954.109755-1-colin.foster@in-advantage.com> <20211218214954.109755-2-colin.foster@in-advantage.com> <20211230014300.GA1347882@euler> <20220111003306.GA27854@COLIN-DESKTOP1.localdomain> <20220111165330.GA28004@COLIN-DESKTOP1.localdomain> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: MWHPR10CA0012.namprd10.prod.outlook.com (2603:10b6:301::22) 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: ff4ac4bf-8fbd-417a-5f2e-08d9d5301525 X-MS-TrafficTypeDiagnostic: MWHPR10MB2032:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gqDC6I6+8DaAF6aeTkn2O6LWGzhlZZn3OFrGThpWBl5LApJRHHhlSphihHjflb86DRKZvjv6oYIOlQiX39cGihP24NlhZ/0Z6U4mv/ij9LwoOGET6nGJ5Vlxts/9iJms3XoHOwrGLxP3zsb/GAcXeIff2O835gZNH6kHQuIzt9H/oLN7kGj5g3jDqekxrYdJRCJ6PJZ8vZcp2IAx3MvSqw5kHbjL/2Vs5CSNIuIXnZPICl61CHpUEgip2jsD5e0BVV3/0P8grEYkPBLre0YO5ZJ9jG1J6SSIn3nqoyg/l5S1FjM95mjqUMH5Qo71pY1ZOUr2F9sjdqLekwVz/OPQPOHjNRRaJsJiZpkBQtoySGgoaFR76gc2OYb0oZCLkUKLwE7jM5bAEMKkg/dKPiCdMXKcgDWbBKC3GeJfOi+3EFNauN/YzYaLLBIhffnJ4MshvbKTXOzGzWJZPW+5mLJLNGRDGjLKe8fZYZNDYqvlb1XND73P42zIkrijuwWJeFbIkWLwowLN8yvqD0D7+BzQ2Tqd3OZlpfLTDD0WkTdTNc5BbxTJuPTCPrfoO6WXl9n+sumgXqBJfCNKxuGCuT8n3QCa1CToHwr0dLA2Rz80TRry+cwThcVyJTo7urQfsnydT0VVNgMHB8mS+HUcAZitjxbuFc7la0Gc2YLOVtT4bqI0xDaAPS1X5TWtc2Qk3my9RxbBbiR4fwRda3oC4hS5Pw== 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:(366004)(42606007)(396003)(39830400003)(346002)(376002)(136003)(6666004)(6506007)(8936002)(1076003)(2906002)(33656002)(44832011)(86362001)(26005)(186003)(52116002)(4326008)(54906003)(38350700002)(6916009)(508600001)(7416002)(316002)(83380400001)(8676002)(5660300002)(66946007)(66556008)(66476007)(9686003)(6486002)(38100700002)(6512007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WENHZ2JMVnREbXRVTFNVakEyc25YcUpqaGxONFhWdEVod2JyakJCT1ZQeENP?= =?utf-8?B?OW91cHpza2k0dmkzamNSTU9ITWFVcmFacUd1NFpOQm43SUM5eThPK0Y4WU02?= =?utf-8?B?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UHdETDBCN0xPRVRycVhwRW12?= =?utf-8?B?aGwzaG5MaTF4YkVYKzBlQjcvUUNrZTJhdWRMOHhBNFNvMGhoWjlRMEloSmg4?= =?utf-8?B?NUZyVldLSHVIK01PWTdoNENDSkxpODhCVXlWaDAxbURleDF1TnUyTis3OERQ?= =?utf-8?B?RE8xa3ViYk1aSXYveS95N3k1VVRWYjRnQ1VaRzcyT01PdmxIYjZNUkVxRjNH?= =?utf-8?B?azJvUFZXQjlLK0o5N1h6U21SelFXdWc3ajUrc3QwbXN1OFFKT3o2cWdObFJr?= =?utf-8?B?aHlmd3JkVUhxVVQ3Q3VPcG1Od1lIR2NFeFVwMTZVNmJJdHkzVkxrMlBXZ2Jq?= =?utf-8?B?eUFSanh2SVdkS2RMVXhGZlV2UTJRPT0=?= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff4ac4bf-8fbd-417a-5f2e-08d9d5301525 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2022 18:27:54.2052 (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: XBnSXNnzjSqAhfiP1OltBDLO36QhnzF1qPNyEJDl+DHXNk2Gl9S2dJDsT5szwyLmU4q1c6XPSofyfSDCJeKAD6iCpphuCRSPCfd40I4kCTs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB2032 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lee, On Tue, Jan 11, 2022 at 05:00:11PM +0000, Lee Jones wrote: > On Tue, 11 Jan 2022, Colin Foster wrote: > > > Hi Mark and Lee, > > > > > > > > > However, even if that is required, I still think we can come up with > > > > something cleaner than creating a whole API based around creating > > > > and fetching different regmap configurations depending on how the > > > > system was initialised. > > > > > > Yeah, I'd expect the usual pattern is to have wrapper drivers that > > > instantiate a regmap then have the bulk of the driver be a library that > > > they call into should work. > > > > Understood. And I think this can make sense and clean things up. The > > "ocelot_core" mfd will register every regmap range, regardless of > > whether any child actually uses them. Every child can then get regmaps > > by name, via dev_get_regmap. That'll get rid of the back-and-forth > > regmap hooks. > > I was under the impression that MFD would not always be used? > > Didn't you have a use-case where the child devices could be used > independently of anything else? > > If not, why don't you just register a single Regmap covering the whole > range? Then let the Regmap API deal with the concurrency handling. That's exactly the use-case I was considering. An example: "mscc,ocelot-miim" exists. It can currently be used in two different scenarios: directly with devicetree, or indirectly as in drivers/net/dsa/ocelot/seville_vsc9953.c mscc_miim_setup(dev, &bus, "VSC9953 internal MDIO bus", ocelot->targets[GCB], ocelot->map[GCB][GCB_MIIM_MII_STATUS & REG_MASK]); The "GCB_MIIM_MII_STATUS" parameter is the offset from the base for that regmap. See commit (b99658452355 "net: dsa: ocelot: felix: utilize shared mscc-miim driver for indirect…") (My apologies if the formatting of that commit refernece is incorrect) But in that case... the Seville driver makes a devcpu_gcb regmap located at 0x71070000. That regmap is created over the entire "GCB range". That gets passed into the mscc-miim driver, along with the base register location of the MIIM periperal. At the same time, mscc-miim can be probed independently, at which point it would create a smaller regmap at 0x7107009c (Documentation/devicetree/bindings/mscc-miim.txt) So the mscc-miim driver supports multiple use-cases. I expect the same type of "offset" idea can be reasonably added to the following drivers, all of which already exist but need to support the same type of use-case: mscc,ocelot-pinctrl, mscc,ocelot-sgpio, mscc,ocelot-miim, and mscc,vsc7514-serdes. As I'm bringing up different parts of the hardware, there might be more components that become necessary. With the exception of vsc7514-serdes, those all exist outside of MFD. The vsc7512-serdes driver currently relies on syscon / MFD, which adds a different complexity. One that I think probably merits a separate probe function. > > -- > Lee Jones [李琼斯] > Principal Technical Lead - Developer Services > Linaro.org │ Open source software for Arm SoCs > Follow Linaro: Facebook | Twitter | Blog