LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Colin Foster <colin.foster@in-advantage.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
UNGLinuxDriver@microchip.com,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>
Subject: Re: [PATCH v1 net-next 1/3] net: mdio: mscc-miim: convert to a regmap implementation
Date: Sat, 20 Nov 2021 16:09:18 +0100 [thread overview]
Message-ID: <YZkPnida0Kd0sG8x@lunn.ch> (raw)
In-Reply-To: <20211119213918.2707530-2-colin.foster@in-advantage.com>
> @@ -73,22 +84,30 @@ static int mscc_miim_wait_pending(struct mii_bus *bus)
> static int mscc_miim_read(struct mii_bus *bus, int mii_id, int regnum)
> {
> struct mscc_miim_dev *miim = bus->priv;
> + int ret, err;
> u32 val;
> - int ret;
>
> ret = mscc_miim_wait_pending(bus);
> if (ret)
> goto out;
>
> - writel(MSCC_MIIM_CMD_VLD | (mii_id << MSCC_MIIM_CMD_PHYAD_SHIFT) |
> - (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) | MSCC_MIIM_CMD_OPR_READ,
> - miim->regs + MSCC_MIIM_REG_CMD);
> + err = regmap_write(miim->regs, MSCC_MIIM_REG_CMD, MSCC_MIIM_CMD_VLD |
> + (mii_id << MSCC_MIIM_CMD_PHYAD_SHIFT) |
> + (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) |
> + MSCC_MIIM_CMD_OPR_READ);
> +
> + if (err < 0)
> + WARN_ONCE(1, "mscc miim write cmd reg error %d\n", err);
You should probably return ret here. If the setup fails, i doubt you
will get anything useful from the hardware.
>
> ret = mscc_miim_wait_ready(bus);
> if (ret)
> goto out;
>
> - val = readl(miim->regs + MSCC_MIIM_REG_DATA);
> + err = regmap_read(miim->regs, MSCC_MIIM_REG_DATA, &val);
> +
> + if (err < 0)
> + WARN_ONCE(1, "mscc miim read data reg error %d\n", err);
Same here.
> +
> if (val & MSCC_MIIM_DATA_ERROR) {
> ret = -EIO;
> goto out;
> @@ -103,18 +122,20 @@ static int mscc_miim_write(struct mii_bus *bus, int mii_id,
> int regnum, u16 value)
> {
> struct mscc_miim_dev *miim = bus->priv;
> - int ret;
> + int err, ret;
>
> ret = mscc_miim_wait_pending(bus);
> if (ret < 0)
> goto out;
>
> - writel(MSCC_MIIM_CMD_VLD | (mii_id << MSCC_MIIM_CMD_PHYAD_SHIFT) |
> - (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) |
> - (value << MSCC_MIIM_CMD_WRDATA_SHIFT) |
> - MSCC_MIIM_CMD_OPR_WRITE,
> - miim->regs + MSCC_MIIM_REG_CMD);
> + err = regmap_write(miim->regs, MSCC_MIIM_REG_CMD, MSCC_MIIM_CMD_VLD |
> + (mii_id << MSCC_MIIM_CMD_PHYAD_SHIFT) |
> + (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) |
> + (value << MSCC_MIIM_CMD_WRDATA_SHIFT) |
> + MSCC_MIIM_CMD_OPR_WRITE);
>
> + if (err < 0)
> + WARN_ONCE(1, "mscc miim write error %d\n", err);
And here, etc.
Andrew
next prev parent reply other threads:[~2021-11-20 15:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-19 21:39 [PATCH v1 net-next 0/3] update seville to use shared mdio driver Colin Foster
2021-11-19 21:39 ` [PATCH v1 net-next 1/3] net: mdio: mscc-miim: convert to a regmap implementation Colin Foster
2021-11-20 3:56 ` Jakub Kicinski
2021-11-20 21:23 ` Colin Foster
2021-11-20 15:09 ` Andrew Lunn [this message]
2021-11-20 21:25 ` Colin Foster
2021-11-21 17:32 ` Vladimir Oltean
2021-11-19 21:39 ` [PATCH v1 net-next 2/3] net: dsa: ocelot: seville: utilize of_mdiobus_register Colin Foster
2021-11-19 21:39 ` [PATCH v1 net-next 3/3] net: dsa: ocelot: felix: switch to mdio-mscc-miim driver for indirect mdio access Colin Foster
2021-11-21 17:44 ` Vladimir Oltean
2021-11-22 17:21 ` Colin Foster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YZkPnida0Kd0sG8x@lunn.ch \
--to=andrew@lunn.ch \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.manoil@nxp.com \
--cc=colin.foster@in-advantage.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.com \
--subject='Re: [PATCH v1 net-next 1/3] net: mdio: mscc-miim: convert to a regmap implementation' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).