lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210502230710.30676-2-ansuelsmth@gmail.com>
Date:   Mon,  3 May 2021 01:06:54 +0200
From:   Ansuel Smith <ansuelsmth@...il.com>
To:     Florian Fainelli <f.fainelli@...il.com>
Cc:     Ansuel Smith <ansuelsmth@...il.com>, Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [RFC PATCH net-next v2 02/17] net: mdio: ipq8064: switch to write/readl function

Use readl/writel function instead of regmap function to make sure no
value is cached and align to other similar mdio driver.

Signed-off-by: Ansuel Smith <ansuelsmth@...il.com>
---
 drivers/net/mdio/mdio-ipq8064.c | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/drivers/net/mdio/mdio-ipq8064.c b/drivers/net/mdio/mdio-ipq8064.c
index fb1614242e13..8ae5379eda9d 100644
--- a/drivers/net/mdio/mdio-ipq8064.c
+++ b/drivers/net/mdio/mdio-ipq8064.c
@@ -37,7 +37,7 @@
 #define MII_MDIO_RETRY_MSEC			(10)
 
 struct ipq8064_mdio {
-	struct regmap *base; /* NSS_GMAC0_BASE */
+	void __iomem *base; /* NSS_GMAC0_BASE */
 };
 
 static int
@@ -45,9 +45,9 @@ ipq8064_mdio_wait_busy(struct ipq8064_mdio *priv)
 {
 	u32 busy;
 
-	return regmap_read_poll_timeout(priv->base, MII_ADDR_REG_ADDR, busy,
-					!(busy & MII_BUSY), MII_MDIO_DELAY_USEC,
-					MII_MDIO_RETRY_MSEC * USEC_PER_MSEC);
+	return readl_poll_timeout(priv->base + MII_ADDR_REG_ADDR, busy,
+				  !(busy & MII_BUSY), MII_MDIO_DELAY_USEC,
+				  MII_MDIO_RETRY_MSEC * USEC_PER_MSEC);
 }
 
 static int
@@ -55,7 +55,6 @@ ipq8064_mdio_read(struct mii_bus *bus, int phy_addr, int reg_offset)
 {
 	u32 miiaddr = MII_BUSY | MII_CLKRANGE_250_300M;
 	struct ipq8064_mdio *priv = bus->priv;
-	u32 ret_val;
 	int err;
 
 	/* Reject clause 45 */
@@ -65,15 +64,14 @@ ipq8064_mdio_read(struct mii_bus *bus, int phy_addr, int reg_offset)
 	miiaddr |= ((phy_addr << MII_ADDR_SHIFT) & MII_ADDR_MASK) |
 		   ((reg_offset << MII_REG_SHIFT) & MII_REG_MASK);
 
-	regmap_write(priv->base, MII_ADDR_REG_ADDR, miiaddr);
+	writel(miiaddr, priv->base + MII_ADDR_REG_ADDR);
 	usleep_range(8, 10);
 
 	err = ipq8064_mdio_wait_busy(priv);
 	if (err)
 		return err;
 
-	regmap_read(priv->base, MII_DATA_REG_ADDR, &ret_val);
-	return (int)ret_val;
+	return (int)readl(priv->base + MII_DATA_REG_ADDR);
 }
 
 static int
@@ -86,12 +84,12 @@ ipq8064_mdio_write(struct mii_bus *bus, int phy_addr, int reg_offset, u16 data)
 	if (reg_offset & MII_ADDR_C45)
 		return -EOPNOTSUPP;
 
-	regmap_write(priv->base, MII_DATA_REG_ADDR, data);
+	writel(data, priv->base + MII_DATA_REG_ADDR);
 
 	miiaddr |= ((phy_addr << MII_ADDR_SHIFT) & MII_ADDR_MASK) |
 		   ((reg_offset << MII_REG_SHIFT) & MII_REG_MASK);
 
-	regmap_write(priv->base, MII_ADDR_REG_ADDR, miiaddr);
+	writel(miiaddr, priv->base + MII_ADDR_REG_ADDR);
 	usleep_range(8, 10);
 
 	return ipq8064_mdio_wait_busy(priv);
@@ -116,15 +114,9 @@ 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_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(priv->base))
 		return PTR_ERR(priv->base);
-	}
 
 	ret = of_mdiobus_register(bus, np);
 	if (ret)
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ