Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp638709pxv; Thu, 15 Jul 2021 12:10:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzQ01fpOm6up0eznse0tQzHrgLLnely11VgeV+XGr2FEZsfQ+Fmi8/sBUmUylOIy1mMT1/ X-Received: by 2002:a05:6402:16:: with SMTP id d22mr9077326edu.101.1626376207706; Thu, 15 Jul 2021 12:10:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626376207; cv=none; d=google.com; s=arc-20160816; b=cXgsRSG+QkJjX02o3NYzQ2409YNfaEnUCfsaWmXaQvjTmOF0PWiNqrlczLO7zoi5Lk pWCh/qFJUjkzRQwqQmU34XAGvYEcCuDyn0a6c5rSqLCOJ3BSg56FtcGZR32chPTqPWAV rCZnZ1LPQleYaoVVwmtx+m+P+1iTwaYaOs8YiZ0FEOKoGhabXl9yif9v1W177VnuXCdS FBU/2lU9K6v6h4Ly9fsqXXgGG6beleOZlO77ppxk+Fy6k1vg78gNuD+kXt19B9BvXLO5 kmt7uIJ+Zurma23AnjSdEd2pA2bTq/Yl3MZiQvKmf/Py7tXrwBiKnfCRR+j1JTXr7LLv BWgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=I27i2A9AzIeGQWdtD7kpl7RpRmQ/mxyhh5EVqsUa0uQ=; b=Z97+49MIBp39lW727JzayUHXEim/PhS2ze/d200VjAjz+41uYrB8ii+3sQFumlaahh oJbHh7Va+6A2t3/dQ3JSOlJr0UFfmCw0yC5zauSrvIFcAd/i8cPZwWbFtLaZDPNT/vpo WavKWAVCOOkep3kE01VknCGzXctC5DNgFY3kIdW/AUI9bT6A5UyQyPBYk6ji+kzdq9EM NgemZ/4+ByREsiNi9GjFTllkDe6gkrQ/KhHER7oeGfV1z10Q8/df97eNvMyigzFrbYRn If8X1CjuZ0ke/jR4po7Qd9mWOZzb3EpeNRhThKcHZXiqi+EhOzvr/gBi1INYWsn6HS2h 0Ojg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D87a8Ihy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qa18si8068650ejc.491.2021.07.15.12.09.43; Thu, 15 Jul 2021 12:10:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D87a8Ihy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237409AbhGOTHm (ORCPT + 99 others); Thu, 15 Jul 2021 15:07:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:34572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241755AbhGOS51 (ORCPT ); Thu, 15 Jul 2021 14:57:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6BA4C61158; Thu, 15 Jul 2021 18:54:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375272; bh=dT8hcCxhperB/T+8aYy1wP8AerwINrRNIYBFnfhjs7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D87a8IhyhoRByih5sDluCxjAwZ2/wu0fVhwhSzn9BcCzHE86kEFk6nDqFcOMW4zGD osIZ+0JacHXlXas7T14kaak318KxJNikCyaQJ/Zb+Kvv8dlCJg2y3nhNUPdnasJRNf Y6yU44gPsb3DIqXlfTZ9eEZUlV74BhYWBoetLCdQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ansuel Smith , Florian Fainelli , "David S. Miller" , Sasha Levin Subject: [PATCH 5.12 018/242] net: mdio: ipq8064: add regmap config to disable REGCACHE Date: Thu, 15 Jul 2021 20:36:20 +0200 Message-Id: <20210715182554.939231878@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ansuel Smith [ Upstream commit b097bea10215315e8ee17f88b4c1bbb521b1878c ] mdio drivers should not use REGCHACHE. Also disable locking since it's handled by the mdio users and regmap is always accessed atomically. Signed-off-by: Ansuel Smith Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/mdio/mdio-ipq8064.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/drivers/net/mdio/mdio-ipq8064.c b/drivers/net/mdio/mdio-ipq8064.c index 1bd18857e1c5..f0a6bfa61645 100644 --- a/drivers/net/mdio/mdio-ipq8064.c +++ b/drivers/net/mdio/mdio-ipq8064.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include @@ -96,14 +96,34 @@ ipq8064_mdio_write(struct mii_bus *bus, int phy_addr, int reg_offset, u16 data) return ipq8064_mdio_wait_busy(priv); } +static const struct regmap_config ipq8064_mdio_regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .can_multi_write = false, + /* the mdio lock is used by any user of this mdio driver */ + .disable_locking = true, + + .cache_type = REGCACHE_NONE, +}; + static int ipq8064_mdio_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct ipq8064_mdio *priv; + struct resource res; struct mii_bus *bus; + void __iomem *base; int ret; + if (of_address_to_resource(np, 0, &res)) + return -ENOMEM; + + base = ioremap(res.start, resource_size(&res)); + if (!base) + return -ENOMEM; + bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*priv)); if (!bus) return -ENOMEM; @@ -115,15 +135,10 @@ ipq8064_mdio_probe(struct platform_device *pdev) bus->parent = &pdev->dev; priv = bus->priv; - priv->base = device_node_to_regmap(np); - if (IS_ERR(priv->base)) { - if (priv->base == ERR_PTR(-EPROBE_DEFER)) - return -EPROBE_DEFER; - - dev_err(&pdev->dev, "error getting device regmap, error=%pe\n", - priv->base); + priv->base = devm_regmap_init_mmio(&pdev->dev, base, + &ipq8064_mdio_regmap_config); + if (IS_ERR(priv->base)) return PTR_ERR(priv->base); - } ret = of_mdiobus_register(bus, np); if (ret) -- 2.30.2