Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3317516rwb; Mon, 5 Sep 2022 09:33:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR4HGrXnnbwL96pECbpK7wMTPYc1Aed+j+tiVnTME89KKVioN9ryJhMH+vvh9cJJTKE9GKVe X-Received: by 2002:a17:90b:1bc6:b0:1f5:313a:de4b with SMTP id oa6-20020a17090b1bc600b001f5313ade4bmr20576317pjb.4.1662395589768; Mon, 05 Sep 2022 09:33:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1662395589; cv=pass; d=google.com; s=arc-20160816; b=UfK4oGz8qGToEopjyzVkrfrXGGNvWeoMNekMG1OxWbmHfCGSAiMNUuRB5TUkq7f23J wxMDdFuqSVB1hK36lLRV5/tOli4GL1rmF8/PB+KV7QK0JfhNiex3wBVfOowZtm4vq5w+ HWJkPC5RFU9HScZQE3brG6n85fHZquVCN5HodICpC0tmPnTmu1of6vI1+RYt/kGLZTGb HHEQc0iQ5yvQHEdaHrbm5ACaMzu+vhGGn1UtHF/SX1vsAR+/JdS6a3ja3XOCmsYh9ivc tUecyqBixAoMfCHyasCrM3Cbnx11AFFwCRx10gWWUjNPOPYmmbUWYffNwxP6Osc/pvwa tXrQ== 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=Z39i6OC/sPmsXF/Eki5x4NJ6S/zHYKHFcrA55K5fD8s=; b=cV5T77lm0A9VM6EuZ7ZrpAJ4HnK9jbL88ULGBUFdhnJUui7YWY4q4nPxo/UwM0OrVy 6XC7Ceedt8Sp1BiuTd681N8I9Mv2T4+AlHrbuqX6l3eDc6sKqr/znVnRi9sYb+L9BeIF UtQfcDHwjnBk3Owi8VWB4hsvRoNLJMocf0s+XJnSqc0VfE6XWg4tEkDAglkoYyDj6uUM xR3uKTF8WmcEohdAZHItRy4j8YKRaFrcHDV1otN7PJuU4+5MdT1bBE9/A+aNQL1O1jDG x4Fz1/TCpg0oOKfCnWPasOSGwgBT7LJCP5w0d5ZxcP/rjjhLIy8PGORsHDdQVUwvlkoN ysSw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=rZHfCnX2; 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 c11-20020a17090ab28b00b001f27babb6fbsi10178088pjr.56.2022.09.05.09.32.57; Mon, 05 Sep 2022 09:33:09 -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=rZHfCnX2; 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 S237655AbiIEQWU (ORCPT + 99 others); Mon, 5 Sep 2022 12:22:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232053AbiIEQV6 (ORCPT ); Mon, 5 Sep 2022 12:21:58 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2116.outbound.protection.outlook.com [40.107.102.116]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C5E65B071; Mon, 5 Sep 2022 09:21:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YW+kREuEJLnEUzq6x1bRd26Q0/LB8O25LLKtgnlDq8S3QcpqmMihAg9/mrfSM/90naNMWxFdBiDOfx3RlDEv3RhGizV4F/IU4uAjxyNuatGMY6HEWOQQCnvCf47YyNMgks5hw8Ot9PBuP+j9VLTimAhHbo9IMC9S2uWWirlv7X05ymuUq4Qow1BP24b3eThQuLZd04qVBHOdLfPo2pt274+R19DwF7jVjQsOxILxVgKudEzQz3c4kVHLg9Ght4oXCFJ/XxiCNxeqbYvXwhvKOAfjKeaJ5Ym2cPNayzJttKsQyy5QwQ58Ux2aVFSNAd9iOn3UoG4eQDUfJhZl4oz59w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Z39i6OC/sPmsXF/Eki5x4NJ6S/zHYKHFcrA55K5fD8s=; b=g/mat44GDu2g+PbMYlEJQPA6aGhk9kHcPBrvW+WBKxc+8RzRwfSjz5o27ERpy8F8CogYqoQs1+VnYd3N79lZo2WsldGao7YogjpnV7NNGKgGt+hKpsHVFmQW6dt3yWySy6vsWY1xV9A7hm85kWz3iH/Ib6tqPP5rKeZbrov9sUPL1ziygaR9nsOyze1iPbs7gZWmsqgvK+9MNU15wFzjOEoZjQckhnAMOaI7y25s3LdsDttwDA4ujs5BYdHkPdF2c/FkC+NPhmxZM5wBbQV1QIEhKrcsJf9I8/8PjXUChi+5Adq/hAyZKkObwV+RBXQ92hqxhYKPF9W5W9V/xhtRIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z39i6OC/sPmsXF/Eki5x4NJ6S/zHYKHFcrA55K5fD8s=; b=rZHfCnX27tnAFg63jHEHeEZps0qYYnnvLF0K98vGv+yqeRiLeELQ6+ci+YGO9YFZP5aJ9TakFLAQx9MxcNOaSC380XymQvD7MOxV0x44mmR5652RnznhZx2xhVJviBD2Z7fFByqWwQmNn7KuQqb9dPW+gJEV+Afji1okR4xYy/Q= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by PH0PR10MB5848.namprd10.prod.outlook.com (2603:10b6:510:149::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Mon, 5 Sep 2022 16:21:51 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::38ee:4bfb:c7b8:72e1%7]) with mapi id 15.20.5588.012; Mon, 5 Sep 2022 16:21:51 +0000 From: Colin Foster To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Terry Bowman , Vladimir Oltean , Greg Kroah-Hartman , Andy Shevchenko , Dan Williams , Jonathan Cameron , UNGLinuxDriver@microchip.com, Steen Hegelund , Lars Povlsen , Linus Walleij , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Russell King , Heiner Kallweit , Andrew Lunn , Krzysztof Kozlowski , Rob Herring , Lee Jones , katie.morris@in-advantage.com Subject: [RESEND PATCH v16 mfd 2/8] net: mdio: mscc-miim: add ability to be used in a non-mmio configuration Date: Mon, 5 Sep 2022 09:21:26 -0700 Message-Id: <20220905162132.2943088-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905162132.2943088-1-colin.foster@in-advantage.com> References: <20220905162132.2943088-1-colin.foster@in-advantage.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4PR04CA0263.namprd04.prod.outlook.com (2603:10b6:303:88::28) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c8cdc550-1c4a-47f5-1803-08da8f5abd7a X-MS-TrafficTypeDiagnostic: PH0PR10MB5848:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7B40ZIY7Xiv6RfSaL6JID76/pAtXhre3XQZBzDHq0yfXZXT5OM9Pyl6JO63G/ccElTuJDR/oJiZj+Q4pRRzJgsdjuEujlhdDCnN/gczE1WZ7EJYnAo0EU9eoGDvwkwavKvr0hrXfe3Q6CXM4HTWEaTGjTRFZjsyPs/oBO2GMeJwbWYVggXsRVHtDZwHqKJjSAuNLww7wk3fNY0mCbuHcCMLJiswWOnZ7sXHR3wj8RGhvnMAvqA65lyOaiyzqJV0Ufqbc6UtTcPd9RS3DE/MXXojIkJNy/XNWVXKkPIeXHalOjmtgFW7ACGfAMnM1oucYbSH7dzm23D9TdJFJ56ufJ9e7LK33avUx6njoVqase+2yfjThTyHtZj3oCUBd2KlXcOpCKPwabofoNNBbaEfJOW5ByPtuVq6AoOzrwOj+DG8tic3gGsGp3JLS79Hxj9HmcKGz/BoaL/35Ppadt7q2IpmCjI2F2nr6ONOFyOXk0O9k/OR8/lHEs/FIlcqltCVFlErifbqmWvMNsqXCqnlIrz27Qh8Uig5PqEy29uwVrzKvCmhi7hbaJ2byY/ClX0/QGT/FH8slvlRIrWtvv8piCOiZM822kcYY8qtCWktCfGI1/wp3/Sayd/5bGRP44yBc3AygbPI5c1KkKuilEciVT9d63Hw0ssUbzwpYqUCcrVw6HbDnk0FYfc7EzeiEFi19Ly9Ow8fdPRmPmFe68t84b6kmrZScyiUvTnLXCPxMo7GgNuXlnuThUVIBGE6l8GwO3yV3eVV1tIayT7ATGvxcEg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(396003)(346002)(376002)(39830400003)(136003)(366004)(66946007)(5660300002)(8936002)(66556008)(54906003)(6486002)(41300700001)(6666004)(107886003)(52116002)(186003)(2906002)(1076003)(7416002)(2616005)(44832011)(6512007)(36756003)(6506007)(316002)(83380400001)(26005)(38350700002)(38100700002)(4326008)(86362001)(66476007)(8676002)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?vleuX1umPgXxqDxyE9g2OImdwCnwY0eqscMbo/q/mOLnpLACFhDH1OeWlCfe?= =?us-ascii?Q?1KD1dWTKw50kXvGJnzG3PL0NRMOUE8aqKpvKL4KhRElcfSvQWSiXgSc7CB8h?= =?us-ascii?Q?x9fY3+Pu7W0nGmRmnjCs7MSuT85qet2AIG7JuGxkB6eDcCZiXtg0Gpyn+xAL?= =?us-ascii?Q?iyNcwnClubryV3MosxdAncgDoN1cJLX4wgnhWpTJIcKX1KbeKe/DIgjVlmtj?= =?us-ascii?Q?EGSz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YRCuh9?= =?us-ascii?Q?UCm9zXfYuhw1Dgj6H3Bf48rGj72sRLaDheLcwdFro2HjuWXITtK5bi1GoJJ+?= =?us-ascii?Q?I9pAjm7GwAAGhyr4X15uLJhR7JAuUhgJy50D2KQCm9Ga69Uc+vPdnVhLkcBG?= =?us-ascii?Q?Wd95BD10o/xM8D8pIC2OvYxGamwr/zzPQwYJ8/BRGW1OmtlTLOxezu8Bnpph?= =?us-ascii?Q?cl2Qfa9SkcQc/Y39eIwtZd3gQ7xaptCsl883Q17UQNVg5lbcpl7urYo6E2ZG?= =?us-ascii?Q?4Hl+Ygwi4EgnOTtgIpFGlozuZN9gUTTc3wfJobCgHnuKhMlcFpSdSZIkjYyR?= =?us-ascii?Q?tL4ikbcTeeo7vz1FX0J/0VB0bV5dDMcFCYKCfN+bYtOIh7xrcfBs0h2Z77xl?= =?us-ascii?Q?7zqz6FWEsNHAH4ia979eXu+9rrxeMa1jnxqjGZShKiz/9FRATew/FuB5MjVQ?= =?us-ascii?Q?+pu26nFQwEESQfDd2X7goHWlB4eTWWTH6+iACp5cdPwtlONE0uExHEJ+mw9V?= =?us-ascii?Q?rg=3D=3D?= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8cdc550-1c4a-47f5-1803-08da8f5abd7a X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2022 16:21:51.6632 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7ui0KkZmApi1i4wZwohk0i0POxt0WUU1wKIk+kEVZceukn/whu2Vt4oN0byfvn2TXdz3M8Yu4Bz3uCRr+IcqWKq5EWW6iU1K+OfDPl0VQI0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5848 X-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 Reviewed-by: Vladimir Oltean Reviewed-by: Andy Shevchenko Acked-by: Jakub Kicinski --- v16 * Add Andy Reviewed-by tag v15 * No changes v14 * Add Reviewed and Acked tags --- drivers/net/mdio/mdio-mscc-miim.c | 42 +++++++++---------------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c index 08541007b18a..51f68daac152 100644 --- a/drivers/net/mdio/mdio-mscc-miim.c +++ b/drivers/net/mdio/mdio-mscc-miim.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -270,44 +271,25 @@ static int mscc_miim_clk_set(struct mii_bus *bus) static int mscc_miim_probe(struct platform_device *pdev) { - struct regmap *mii_regmap, *phy_regmap = NULL; struct device_node *np = pdev->dev.of_node; + struct regmap *mii_regmap, *phy_regmap; struct device *dev = &pdev->dev; - void __iomem *regs, *phy_regs; struct mscc_miim_dev *miim; - struct resource *res; struct mii_bus *bus; int ret; - regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); - if (IS_ERR(regs)) { - dev_err(dev, "Unable to map MIIM registers\n"); - return PTR_ERR(regs); - } - - mii_regmap = devm_regmap_init_mmio(dev, regs, &mscc_miim_regmap_config); - - if (IS_ERR(mii_regmap)) { - dev_err(dev, "Unable to create MIIM regmap\n"); - return PTR_ERR(mii_regmap); - } + mii_regmap = ocelot_regmap_from_resource(pdev, 0, + &mscc_miim_regmap_config); + if (IS_ERR(mii_regmap)) + return dev_err_probe(dev, PTR_ERR(mii_regmap), + "Unable to create MIIM regmap\n"); /* This resource is optional */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (res) { - phy_regs = devm_ioremap_resource(dev, res); - if (IS_ERR(phy_regs)) { - dev_err(dev, "Unable to map internal phy registers\n"); - return PTR_ERR(phy_regs); - } - - phy_regmap = devm_regmap_init_mmio(dev, phy_regs, - &mscc_miim_phy_regmap_config); - if (IS_ERR(phy_regmap)) { - dev_err(dev, "Unable to create phy register regmap\n"); - return PTR_ERR(phy_regmap); - } - } + phy_regmap = ocelot_regmap_from_resource_optional(pdev, 1, + &mscc_miim_phy_regmap_config); + if (IS_ERR(phy_regmap)) + return dev_err_probe(dev, PTR_ERR(phy_regmap), + "Unable to create phy register regmap\n"); ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0); if (ret < 0) { -- 2.25.1