Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3739976iog; Tue, 28 Jun 2022 01:31:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sXV5/5xRvK8UW5feET/RFKht1UMrSFHABNTagiBuDQWXyIDPMckCrUuB9akRfQf/N6F6Ws X-Received: by 2002:a05:6a00:14c7:b0:525:89c1:35fb with SMTP id w7-20020a056a0014c700b0052589c135fbmr3535124pfu.36.1656405099214; Tue, 28 Jun 2022 01:31:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1656405099; cv=pass; d=google.com; s=arc-20160816; b=LIlGWwmj2AhEswxPrHXwWdSveQD4JIQrYsfNJmKBP2TiPTtIqTkD78kcl5DaSXNXc5 xqvkZ9eC3zXK7eRIbs3evXp/5KqeyPCI8kWLVZ5Ogt4wFk6A/DVIm0gXE2Y0k/Nx+/iR MuZtmV9IeErYs1q5nMGjymglfgZdcoIgSLhOewz6k2xmVus24FVwk/mbeRhmHDf5Dkcj xyGsoEnubQJu5OQmxzcdFXXT70N87+vIIegtHFnu1+lAYdXn+Z7sTUCMpyFznaScnnH8 xqxB8CbL7tqYaadjwS+4pvc8AHLyRPbLj1H3hPRUGD9dUjtDcENzQQ0z1svsfEOvsmQO iLlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PHD7icKesZTmeejaNQRsR0ROYggUF+B8IFljBCWZSok=; b=ehDsJDAoijkHqnZxrE1oNPmnwOBN70aVAFS8WDGVfr40j8S5Nq+xPBzwFcnM3aSuG3 qD1uqMUTq5jfozr8hB1D1dBJSv2kjRrVLVOL29NPul9Jn3hrOtCgGi9LZJXYaYrxDMOI A8fki+sv2o9SiwkNyLyZ1huxEGQjvaGC5IE5TKMgy1A4jY4cG5bJ34zAWaepMOjibdJ9 vJOCkBCWU+xUMQ696OXgxfuxgGUbMsekDl/8WYs9cmijpmCoLlJfyq2CInen7gYtDuZg g6a9oMJW5gLkNbk7Z0+XZFh1PeKcfMwVnbtRZB8bIiEMcaa9FQixODe7KE0gKtV7wECB 5wuA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=JnunMKZJ; arc=pass (i=1 spf=pass spfdomain=in-advantage.com dkim=pass dkdomain=in-advantage.com dmarc=pass fromdomain=in-advantage.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=in-advantage.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l5-20020a17090af8c500b001e8990cf76dsi14944260pjd.176.2022.06.28.01.31.27; Tue, 28 Jun 2022 01:31:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=JnunMKZJ; arc=pass (i=1 spf=pass spfdomain=in-advantage.com dkim=pass dkdomain=in-advantage.com dmarc=pass fromdomain=in-advantage.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=in-advantage.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343790AbiF1IUz (ORCPT + 99 others); Tue, 28 Jun 2022 04:20:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243943AbiF1IS5 (ORCPT ); Tue, 28 Jun 2022 04:18:57 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2095.outbound.protection.outlook.com [40.107.96.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A384FB64; Tue, 28 Jun 2022 01:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZaD4LLei/0y/cpvKANnrTnF9rH+ACl3XgnCbDCxgC4HkCr9OxsbIldOc4Za10qUAOCcs5KtyML5Q15fWI2CVybNF1NGUi+fnHWBX1uMDo2w+KnNC+7LdyK3sbn2ZQC6otT23RVobybdAQAR9pHadIdm/a8FmRwHpAZkMjiKqRRbZWFOejC4MKs80wRn69crdlh3KvgLEB3eQhYQFQzAluff6QUZLjWIpgvqOAkR4iNYGhnc46O44eRA/zSdzXC4g4zaQTwM1wnf0K70l9O2xKeG4qX1Ms58udp/vQL6VkLNOcHHevf2Bvtd3tYBGMYHpvSKsQh7+tdOGRW8b0wI1Rg== 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=PHD7icKesZTmeejaNQRsR0ROYggUF+B8IFljBCWZSok=; b=Nw/6QEL2i15EzHYuZ871TwCKqXyXPuRg8Riokz4Y+GS+xsHpZR5a3ipsfw7NjhNQK6RFvGYbdMAOiTT0alzZIZ2GEfEOKcqRLAjFckMyF8C0Ub3kAscRqYMXe5+VW+ug2ZQfOBZeA51WD9VUr0B+XWg2GQU4yTFQA6tMmWsqTHsQXF0IyABLp0S++zuctzoaOxpRJuanrQ/YAQHjowkHRuL19g70tEXY9DZs6oEmc6FjQNNiH9tsOmk4oPloLo5huy96Qzd6g27blXR11NbGzqtTqri2ICmlwhBaw8rizO9sGDM3/RYQnt+mS+uKsy78+RfgGwvroow516S5PrvLvg== 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=PHD7icKesZTmeejaNQRsR0ROYggUF+B8IFljBCWZSok=; b=JnunMKZJpsX62fpaEpU+gr7zAYyYRc8VLPACyqlab/SSQbDG3c7uPR8jIoGdjQqD2LULqAiGhVvlf9knBT+gFhSjmzRhnnZH8+33Ae2q0dSTp4xhtGBUBh/u40d4l06lP9biMNViKDjktkeDZ30nSTqvI/bxOM06bdiIhGk3D20= 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 SJ0PR10MB5891.namprd10.prod.outlook.com (2603:10b6:a03:425::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.17; Tue, 28 Jun 2022 08:17:27 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::712f:6916:3431:e74e]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::712f:6916:3431:e74e%6]) with mapi id 15.20.5373.018; Tue, 28 Jun 2022 08:17:27 +0000 From: Colin Foster To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Vladimir Oltean , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , Steen Hegelund , UNGLinuxDriver@microchip.com, Linus Walleij , Wolfram Sang , Terry Bowman , Andy Shevchenko Subject: [PATCH v11 net-next 2/9] net: mdio: mscc-miim: add ability to be used in a non-mmio configuration Date: Tue, 28 Jun 2022 01:17:02 -0700 Message-Id: <20220628081709.829811-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220628081709.829811-1-colin.foster@in-advantage.com> References: <20220628081709.829811-1-colin.foster@in-advantage.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4PR04CA0259.namprd04.prod.outlook.com (2603:10b6:303:88::24) 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: e443d807-66c2-4454-d0e6-08da58dea2e2 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5891:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wklP25KU0GrKjXSiVwtmjnOWm148uVMY5gcbYZ+sd4i2EifjSc5L9zXuq8V/LRybCV9RZGiYZDfFqqsuIDQAS4dp54hFPcNYoPi+Etx9sjugFO17SlkbsEklqc8+nLm4NjLqnnkfWalx4xOmclqjOAIsu/2y0PWE7ENuuHWkOBj2ZRJw4uuxzGd8LbyY43pg4yMZVAP8cXW3CaQl4SDWryj47qocodYx0lZmjrWbr/Ik1n8Mua0F3ExRGCNyu2rkQF5y95pRidS1/b6FvQqcTK8F89r8PGTCi0uCuhTxvvrEPXl0TEEj/hh6D+PAkcsQmxPsiteE2z5BcUkAWQO1ZHvfvPezLynEsF7vu8m/Tmg6YENMdShB8YpEN14gVl+uWz9SGQ2SXSXlB+QyBgU/Xg/4aNIiKhrmy3pRCNXPWQDxOftClEVvfDxWY72/wuOVwJ2paalzeVtqIc+6EBcnUoVhb8ZAoamUNSDW3P7AVwjO5NXcVuFv4DIFiaInPa3o4Neph2v9rX970Mg5MC/+R5IANd4QBEYgewqr8grK7jQSQ/al54nR3BqpyLdXoLxh4qzzEVPbW9ZM9j4LS4UkAeWZWbBRFS17NBXfeYfJQmbBuGoH7zM+waiSSejFZyNn2vJC71fbBZ4nJCBlUim1XWfqFb+lezz9Vk8lEP3IoCbifJw2jlp8Yjb2CXmEi2mcdWFYAdzBtxy7NC4MqdDEVkg3Ih/beDWYNA/gCOv8K3XkaOOp4g+Gg+kKQDCU22GA1eNl9vfApbMHvNJNvy+wIRLQepvf0HizTRIf2qEUJnA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(366004)(396003)(39840400004)(376002)(136003)(36756003)(38100700002)(6512007)(6666004)(41300700001)(38350700002)(44832011)(478600001)(8676002)(4326008)(2616005)(66946007)(66556008)(66476007)(6506007)(2906002)(54906003)(86362001)(1076003)(6486002)(8936002)(186003)(5660300002)(7416002)(316002)(83380400001)(26005)(52116002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Dn9odIACSp/y4Eo+7ImUkSNopd6Tjg+88HMkd3BxUyD6iQQd8CMZP1nc7bpw?= =?us-ascii?Q?/s43Gwrd1mDCO6gRp33i+eTOmb2dVjWc6GOAwRtSkerbr1LAO58pJtn2UXJg?= =?us-ascii?Q?Tl54fOp/MVLCmvpl39f8vlC1F9lCMy8+5Yz1id/jrZDD7wVp2dik2zz5Qax3?= =?us-ascii?Q?seFbzbDHPY/7WapF/LZRByXqkiKzQx/2f/Dy9m60IMQPS9D9lLb1UrYaRgLv?= =?us-ascii?Q?vwKCTwQSrG0TQL3bAtlTux/6QPNbdOB1wwcBJdWwvVWJEQgFnaN0cO9Rdl1l?= =?us-ascii?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06Ig?= =?us-ascii?Q?wqoEMDrre1mioCR/zLIU5O9QOAnXJU368u6OYYt6hl1tohm4/+1TmI3C+sSE?= =?us-ascii?Q?uVUC1HbJqzhDa52rF1qVLxQFKPn61shdz7SiDuR13mUf/Veo3dThpwPcBoIP?= =?us-ascii?Q?4xGYmhi628h+kZ2thKgx9b814rpB163JJRDsvwg0eY0mLUYIdpEGg01hOvo8?= =?us-ascii?Q?Txy5XWKPist/nr55SkGpPlvDbRO9MNUsVJ2BSn2Z1BbLTwlW6iZ05qIrfIB/?= =?us-ascii?Q?PV+IK0yflAa8AvF9JQtpvJsDK4bItcp16ugb9qGhuBYkJLewVgW8fe9s43DZ?= =?us-ascii?Q?1TeQaJGdw7sbs4HMmCdjDuYYDAlrM2kw+zi1bB45sIhITVu6by1yN9fy3hh0?= =?us-ascii?Q?Fvr+rtxtd2IePE6awhJY0V+lEDTCgoh38qd32YqIQlqJYWv9sYgVsMvSNRwQ?= =?us-ascii?Q?Uw=3D=3D?= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: e443d807-66c2-4454-d0e6-08da58dea2e2 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2022 08:17:26.6978 (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: sRejwLOtKKaWgRl4Jc5L3cEr4d2WGbjPyOkIGL0LJFn4c6W9LhFk1SGlaHFIiuOkZAx4/5+Pz4BXf98Ievxz2t/+DuCF9dI1yPL1nVqt68k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5891 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 | 35 +++++++++++-------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c index 08541007b18a..157c0b196eab 100644 --- a/drivers/net/mdio/mdio-mscc-miim.c +++ b/drivers/net/mdio/mdio-mscc-miim.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -270,40 +271,27 @@ static int mscc_miim_clk_set(struct mii_bus *bus) static int mscc_miim_probe(struct platform_device *pdev) { - struct regmap *mii_regmap, *phy_regmap = NULL; struct device_node *np = pdev->dev.of_node; + struct regmap *mii_regmap, *phy_regmap; struct device *dev = &pdev->dev; - void __iomem *regs, *phy_regs; struct mscc_miim_dev *miim; - struct resource *res; struct mii_bus *bus; int ret; - regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); - if (IS_ERR(regs)) { - dev_err(dev, "Unable to map MIIM registers\n"); - return PTR_ERR(regs); - } - - mii_regmap = devm_regmap_init_mmio(dev, regs, &mscc_miim_regmap_config); - + mii_regmap = ocelot_platform_init_regmap_from_resource(pdev, 0, + &mscc_miim_regmap_config); if (IS_ERR(mii_regmap)) { dev_err(dev, "Unable to create MIIM regmap\n"); return PTR_ERR(mii_regmap); } - /* This resource is optional */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (res) { - phy_regs = devm_ioremap_resource(dev, res); - if (IS_ERR(phy_regs)) { - dev_err(dev, "Unable to map internal phy registers\n"); - return PTR_ERR(phy_regs); - } - - phy_regmap = devm_regmap_init_mmio(dev, phy_regs, - &mscc_miim_phy_regmap_config); - if (IS_ERR(phy_regmap)) { + /* This resource is optional, so ENOENT can be ignored */ + phy_regmap = ocelot_platform_init_regmap_from_resource(pdev, 1, + &mscc_miim_phy_regmap_config); + if (IS_ERR(phy_regmap)) { + if (phy_regmap == ERR_PTR(-ENOENT)) { + phy_regmap = NULL; + } else { dev_err(dev, "Unable to create phy register regmap\n"); return PTR_ERR(phy_regmap); } @@ -404,3 +392,4 @@ module_platform_driver(mscc_miim_driver); MODULE_DESCRIPTION("Microsemi MIIM driver"); MODULE_AUTHOR("Alexandre Belloni "); MODULE_LICENSE("Dual MIT/GPL"); +MODULE_IMPORT_NS(MFD_OCELOT); -- 2.25.1