From: Keyur Chudgar <kchudgar@apm.com>
To: Iyappan Subramanian <isubramanian@apm.com>, Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
netdev <netdev@vger.kernel.org>, patches <patches@apm.com>,
David Laight <David.Laight@aculab.com>,
David Miller <davem@davemloft.net>,
linux-arm-kernel@lists.infradead.org
Subject: RE: [PATCH net-next 1/4] drivers: net: xgene-v2: Add MDIO support
Date: Tue, 21 Mar 2017 17:08:49 -0700 [thread overview]
Message-ID: <e9bb420df0c62d49c0fce1bf45f8c686@mail.gmail.com> (raw)
In-Reply-To: <CAKh23Fn_re2CmT_XDD7YgqAGEa61rfaL5XHHqaPujzhMx9XVeg@mail.gmail.com>
Hi Iyappan,
I agree with Andrew.
Let's re-post the patch after addressing Andrew's comment.
Thanks,
Keyur
> -----Original Message-----
> From: Iyappan Subramanian [mailto:isubramanian@apm.com]
> Sent: Tuesday, March 21, 2017 4:19 PM
> To: Andrew Lunn
> Cc: David Miller; netdev; Florian Fainelli; David Laight; linux-arm-
> kernel@lists.infradead.org; patches; Keyur Chudgar
> Subject: Re: [PATCH net-next 1/4] drivers: net: xgene-v2: Add MDIO
> support
>
> On Tue, Mar 21, 2017 at 1:35 PM, Andrew Lunn <andrew@lunn.ch> wrote:
> >> @@ -511,9 +512,9 @@ static int xge_close(struct net_device *ndev) {
> >> struct xge_pdata *pdata = netdev_priv(ndev);
> >>
> >> - netif_carrier_off(ndev);
> >> netif_stop_queue(ndev);
> >> xge_mac_disable(pdata);
> >> + phy_stop(ndev->phydev);
> >>
> >> xge_intr_disable(pdata);
> >> xge_free_irq(ndev);
> >> @@ -683,9 +684,14 @@ static int xge_probe(struct platform_device
> *pdev)
> >> if (ret)
> >> goto err;
> >>
> >> + spin_lock_init(&pdata->mdio_lock);
> >> +
> >
> > ...
> >
> >> +static int xge_mdio_write(struct mii_bus *bus, int phy_id, int reg,
> >> +u16 data) {
> >> + struct xge_pdata *pdata = bus->priv;
> >> + u32 done, val = 0;
> >> + u8 wait = 10;
> >> + int ret = 0;
> >> +
> >> + spin_lock(&pdata->mdio_lock);
> >> +
> >> + SET_REG_BITS(&val, PHY_ADDR, phy_id);
> >> + SET_REG_BITS(&val, REG_ADDR, reg);
> >> + xge_wr_csr(pdata, MII_MGMT_ADDRESS, val);
> >> +
> >> + xge_wr_csr(pdata, MII_MGMT_CONTROL, data);
> >> + do {
> >> + usleep_range(5, 10);
> >> + done = xge_rd_csr(pdata, MII_MGMT_INDICATORS);
> >> + } while ((done & MII_MGMT_BUSY) && wait--);
> >> +
> >> + if (done & MII_MGMT_BUSY) {
> >> + dev_err(&bus->dev, "MII_MGMT write failed\n");
> >> + ret = -ETIMEDOUT;
> >> + }
> >> +
> >> + spin_unlock(&pdata->mdio_lock);
> >> +
> >> + return ret;
> >> +}
> >> +
> >> +static int xge_mdio_read(struct mii_bus *bus, int phy_id, int reg)
> {
> >> + struct xge_pdata *pdata = bus->priv;
> >> + u32 data, done, val = 0;
> >> + u8 wait = 10;
> >> +
> >> + spin_lock(&pdata->mdio_lock);
> >> +
> >
> > Hi Iyappan
> >
> > Please could you explain what this lock is protecting which the
> > mii_bus mdio_lock in mdio_bus.c is not protecting?
>
> Hi Keyur,
>
> Please could you explain what this lock is protecting which the mii_bus
> mdio_lock in mdio_bus.c is not protecting?
>
> I agree with him. Actually there is a mutex on mdio_bus. So the mdio
> bus read and write are locked. we don't need the lock.
>
> Do you agree ?
>
>
> >
> > Thanks
> > Andrew
next prev parent reply other threads:[~2017-03-22 0:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-21 19:24 [PATCH net-next 0/4] drivers: net: xgene-v2: Add MDIO and ethtool support Iyappan Subramanian
2017-03-21 19:24 ` [PATCH net-next 1/4] drivers: net: xgene-v2: Add MDIO support Iyappan Subramanian
2017-03-21 20:35 ` Andrew Lunn
2017-03-21 23:18 ` Iyappan Subramanian
2017-03-22 0:08 ` Keyur Chudgar [this message]
2017-03-21 19:24 ` [PATCH net-next 2/4] drivers: net: xgene-v2: Add ethtool support Iyappan Subramanian
2017-03-21 19:24 ` [PATCH net-next 3/4] drivers: net: xgene-v2: Fix port reset Iyappan Subramanian
2017-03-21 19:24 ` [PATCH net-next 4/4] drivers: net: xgene-v2: misc fixes Iyappan Subramanian
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=e9bb420df0c62d49c0fce1bf45f8c686@mail.gmail.com \
--to=kchudgar@apm.com \
--cc=David.Laight@aculab.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=isubramanian@apm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=patches@apm.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).