Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp264260imi; Thu, 21 Jul 2022 21:21:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1txAue12VSNGBCrX+py8Yi46f07n4aRhtthZBDbjkwXLG6fXBzq742ucdbxo2ZVLdG0Lb5c X-Received: by 2002:a17:902:ef49:b0:16d:39f0:f09d with SMTP id e9-20020a170902ef4900b0016d39f0f09dmr1549534plx.51.1658463706047; Thu, 21 Jul 2022 21:21:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658463706; cv=pass; d=google.com; s=arc-20160816; b=PkabCcKJiTdOgUuClVs98pMRXlIteun/G2SHgFiQhvlSXRpTLnubmYoPjGSKwIWjli +w2Qf3V9r3SvQlGVY70C/syXB3bTxhk5IDtrEdDdvimTv9qbOPf+Pj7xsvmHJHhJn/fW ofN/pxj2qLMxXnNZTP41/60NOyxdM50XC4vovQs87P5PX01ytjIXuFHAyyZ8I7L1bUet 4txEGqrwEkgliEezrWzmQbKsDfh4GcMVrSHmU9inpO6pR49f1ipyqWjG/0y8+g1tU1ve o9wh/0x0ELFj9yIHNCM32S6S7h3SdXB1Re6r4xG8TCkDC6YTxs4I0qqSqBn3Mjtdvfp8 cxOQ== 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=92iUzUXhYgf9AmwME9MmKxPd1Gl/mMhjGkiY2HAVkqA=; b=nPk1xF//Y50v+ZR/0z+Lmx1uCmrIgzmFPNkY5QsjnTS+sjEd/pf4fWDgrzOVU+JleR noDw+N5hFBnTqKfxwm92j1woFLdiKO5pMnqID9ekdF3fpOSac1Z5haskzAfVwrKVRup6 DHvmfD0lix7peaKYo8eJ2O4cE/kw6qrMzN5FK8ovCfY/301+m6sydW0qfEk6/UaQ65np QFdNDjh0fINmj+kpYt7VIcY+KerPQxjTx32mmYbZXjJPbuQqi83cAwXDSFbyNA1NkK8Q 0NtWuhB/yZb6a+72MST96trtnthxMMU8LagwodPd0mETPCydupHtOBLuZ9DqxXCOO0kn jeyA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b="aDSxeX/A"; 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 j2-20020a056a00234200b005227ed4e0fdsi4896157pfj.134.2022.07.21.21.21.30; Thu, 21 Jul 2022 21:21:46 -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="aDSxeX/A"; 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 S234231AbiGVEHA (ORCPT + 99 others); Fri, 22 Jul 2022 00:07:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbiGVEGe (ORCPT ); Fri, 22 Jul 2022 00:06:34 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2097.outbound.protection.outlook.com [40.107.220.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83F6989AA1; Thu, 21 Jul 2022 21:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O5EfXFoKP9egAmzYB9f0Kt1u8CfnW6TgfMRHkQThBdcQgqZdDh8i1TOXiqEP7PFOmfIy91tlrtHDMHZomA+H8/X0gv/1nzs1IA1Ne5yOu4QZPm1fvsgX4X97d9E3QflCwo/AcgQd57KoCTnACV5LHlAcVlJiI6w+ZlPUHjCyu6w+VLkBppvjLgd1BltnjNkB0oyT61hsoOgPN0ElvS4Iv+kGSEKTFrV8ooBdIwJ6nmqYOYkGYfcwnEwg/VnEG8bPK21ZCLss5ZzFFfDflk8m8QiVNSwAzjOBx+6jGovVN7sfsiGslA8W92g1UP11ps5GBMDKg1ViGixI5yxKF3R/+w== 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=92iUzUXhYgf9AmwME9MmKxPd1Gl/mMhjGkiY2HAVkqA=; b=TrppVelV5+W0lXc5KCsvPnTXvQ7qP8rvOjviouqO/FGn0ZRkhij0xgR3tw3qXi8Gwk+zSuvuBaiA8ASoz43XkNOWbh8YCGlNRWYUQ9mPm2VWzPrndQCmx6kapV2h/9HTcUwBthqhbAkNe+OwldiQ/nOyepbzSCtRkJ3ytFpklce28GiYpDrXsww5P2/LiUXuf8+2iP7X4Ltp306k9Hnj6OHFrrgYZnCz+4YBV2AxcxdliHvl4Jtza+nQTesB21huptw5uiHtgdMxV7x3DcG0HjX9xRaEPYYro/8tBDwRU9LjIQX0WWxAMXmBRWYnUlcCl/AawY53m01EluenyM3YJg== 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=92iUzUXhYgf9AmwME9MmKxPd1Gl/mMhjGkiY2HAVkqA=; b=aDSxeX/AnnIR336ObIuWdDSuFd0luOmdZ57bHGdz98+p6AffJHd3cYHr7p1jWLGc312IDW7jY+XjHU/Wr677FJQUbysn/VWtnf+hkFKn06rcI9j88LE0fHEAMDMUFVnp02b2PdzDtZVHTK0lhEgOACjtKroibmhmOfBu3y013A0= 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 MN2PR10MB3919.namprd10.prod.outlook.com (2603:10b6:208:1be::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.20; Fri, 22 Jul 2022 04:06:27 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7451:2903:45de:3912]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7451:2903:45de:3912%7]) with mapi id 15.20.5438.023; Fri, 22 Jul 2022 04:06:27 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Terry Bowman , Vladimir Oltean , Wolfram Sang , Andy Shevchenko , UNGLinuxDriver@microchip.com, Steen Hegelund , Lars Povlsen , Linus Walleij , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Russell King , Heiner Kallweit , Andrew Lunn , Krzysztof Kozlowski , Rob Herring , Lee Jones , katie.morris@in-advantage.com Subject: [PATCH v14 mfd 2/9] net: mdio: mscc-miim: add ability to be used in a non-mmio configuration Date: Thu, 21 Jul 2022 21:06:02 -0700 Message-Id: <20220722040609.91703-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220722040609.91703-1-colin.foster@in-advantage.com> References: <20220722040609.91703-1-colin.foster@in-advantage.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4PR03CA0044.namprd03.prod.outlook.com (2603:10b6:303:8e::19) 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: eaf1dd82-b7d3-4eba-6981-08da6b978c2d X-MS-TrafficTypeDiagnostic: MN2PR10MB3919:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MtGiLm9sJA8NPyqSDg6K2XPqZLsUAkX5aGXGWBv/yfXzpVmuAqPs36RpjodVVd7PBBRJgpq1cgMo8xiVfKvPOlgC5zADpvAUoaanKwq1kWM7W2l+IIsN57b9wiyiRy4QRM9CLHpefDKWsgVI7HBLZ7ezDlc1+FWBFzPgbKPTpbNPlycDZsiqsKrVlvtO+VYEDEG+DSywu4Ao3OiL3wzwlMKnCuH+P22NFVwt4HgRXy6Ux9MQ0OG9bdUVWrH/vkSSBJYeG9/MhyVB6LY5U+ISuSniMZlwWsml4IEEkuG4LcSw0qw8vM0Q3GK36KiHszbWn0vO39MbJotmPTR6JgPxBfD/8jzg62+e+2TMph+lY4h+sjvB5vWrtxWerPyE3ls636/JtWe+/JPPif/mlg4mTsnsCzoo+GBaFt+01yeNn05KF7co8lXeqSGINsTUGcIVrz7qsSde/VP5GXC3lwI1cLVj3gRgnYMOLb0yZemkiSbv14ylo+OetRUKC19qk7shjYE0ZMlSqw8ODlOLPSpIpzGYZgxnqSUXnKxxAqEAXUG/h3H8DzKy1xemuQ2/QuNi7UmAxsjLxjTMzfwBKT55UXQPxEcNdf6IQXcA9tBRIrtHy01PRJgFhL7BqjoQ6723IceM9MHtPgOuDG23zZOdWplxLaoyaVsgI20ZssFPzuz55/dp1cM/9dEme8tI8hewUN3G4MlRzt/bPapthq2ktjVUdI4rhjvuUO12fOInxC+ToxHfM8lPExABQG9wY3k0BONRfuByFYvoIBXPp5lfNpshh6i+T+Hhoi5fwRe4hcM= 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)(366004)(346002)(376002)(136003)(396003)(39840400004)(36756003)(6506007)(2906002)(44832011)(41300700001)(52116002)(5660300002)(1076003)(66556008)(8676002)(8936002)(4326008)(66476007)(186003)(6486002)(478600001)(6666004)(6512007)(7416002)(83380400001)(26005)(316002)(86362001)(38100700002)(107886003)(2616005)(38350700002)(54906003)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?BfC6KzkBC78WCELIWwAPkLwaCcvl0gFjt8dlInf56/URtsuvuUMB0XX8jIUQ?= =?us-ascii?Q?8WoLGEOpR4aTwgqqsluvafha+wbkm61m3Mk4Pi2j8D45AKxLI/Ud+qkrc2tE?= =?us-ascii?Q?wTxaJ9Ch/VMRJt2LGJ0FvVKQaWIAmonaKmN4lXJKyacrcPpucOmqUfheIIHE?= =?us-ascii?Q?B2pvqE8H5XU/V4KdJ/GEUkvgA6s1XO5uDUP8OxWQ0V8jPigXjy+LNtezTie6?= =?us-ascii?Q?7lmeAJLKIISc1On7bsHxDP8m75LsEZddgh4J8+PHnggpG7WKu0AelA2V5xhh?= =?us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jsvZb397Lv2o1RcreV8Wj?= =?us-ascii?Q?78gG1z6THESRoUQQjWlYr4UZn+BTBGamZLA0CzM/xJSbA1pXyxRJ8EDlK0Qb?= =?us-ascii?Q?UUuBQS5bn3nTt1R9jXJ9Jkg+xrQ9i0TP5LTPWw7IuBkNxOGuY4d4x3DJvJU4?= =?us-ascii?Q?yJJV1Geq+DXwIoPxlofXJtGZMYb9afYSSZAASlWjoAIJrwjK2if7m2r2P8WP?= =?us-ascii?Q?LbH2INI4IJlwQN0IA6XCDUR9GOagiha+PwePdnnelJYJBUb3M04CDwjQJhd5?= =?us-ascii?Q?ddRISy8tZPjueOSwus2/TnoJADbq+3JZ4IoTosN0NPjkwep2RTURBtahQzYt?= =?us-ascii?Q?3MHddIMuSajBG3Q95Bwgtc0e4Jo0klo3GTgnfDzlDLZpnA/qv0AZrVp1iWaX?= =?us-ascii?Q?9hIliSWLRl5HsPxWed5ZlfCHTJuPtLDoco2SX6n1ffiejOKcY7o+GyLvn+Xf?= =?us-ascii?Q?eA=3D=3D?= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: eaf1dd82-b7d3-4eba-6981-08da6b978c2d X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2022 04:06:26.4085 (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: Fct9NIZs4KN1z6Fi/V2HXrKYc/3lYBTbkg0Myx5lVznUmY6w/caF+h+AImjAbssISHK34GCYPmgWn0tho4BDFG0whL8ii20kVvUiJ/nFF+g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB3919 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 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 Reviewed-by: Vladimir Oltean Acked-by: Jakub Kicinski --- v14 * Add Reviewed and Acked tags --- drivers/net/mdio/mdio-mscc-miim.c | 42 +++++++++---------------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c index 08541007b18a..51f68daac152 100644 --- a/drivers/net/mdio/mdio-mscc-miim.c +++ b/drivers/net/mdio/mdio-mscc-miim.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -270,44 +271,25 @@ static int mscc_miim_clk_set(struct mii_bus *bus) static int mscc_miim_probe(struct platform_device *pdev) { - struct regmap *mii_regmap, *phy_regmap = NULL; struct device_node *np = pdev->dev.of_node; + struct regmap *mii_regmap, *phy_regmap; struct device *dev = &pdev->dev; - void __iomem *regs, *phy_regs; struct mscc_miim_dev *miim; - struct resource *res; struct mii_bus *bus; int ret; - regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); - if (IS_ERR(regs)) { - dev_err(dev, "Unable to map MIIM registers\n"); - return PTR_ERR(regs); - } - - mii_regmap = devm_regmap_init_mmio(dev, regs, &mscc_miim_regmap_config); - - if (IS_ERR(mii_regmap)) { - dev_err(dev, "Unable to create MIIM regmap\n"); - return PTR_ERR(mii_regmap); - } + mii_regmap = ocelot_regmap_from_resource(pdev, 0, + &mscc_miim_regmap_config); + if (IS_ERR(mii_regmap)) + return dev_err_probe(dev, PTR_ERR(mii_regmap), + "Unable to create MIIM regmap\n"); /* This resource is optional */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (res) { - phy_regs = devm_ioremap_resource(dev, res); - if (IS_ERR(phy_regs)) { - dev_err(dev, "Unable to map internal phy registers\n"); - return PTR_ERR(phy_regs); - } - - phy_regmap = devm_regmap_init_mmio(dev, phy_regs, - &mscc_miim_phy_regmap_config); - if (IS_ERR(phy_regmap)) { - dev_err(dev, "Unable to create phy register regmap\n"); - return PTR_ERR(phy_regmap); - } - } + phy_regmap = ocelot_regmap_from_resource_optional(pdev, 1, + &mscc_miim_phy_regmap_config); + if (IS_ERR(phy_regmap)) + return dev_err_probe(dev, PTR_ERR(phy_regmap), + "Unable to create phy register regmap\n"); ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0); if (ret < 0) { -- 2.25.1