From: Ravi Gunasekaran <r-gunasekaran@ti.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <linux-omap@vger.kernel.org>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <kishon@ti.com>,
<vigneshr@ti.com>
Subject: Re: [EXTERNAL] Re: [RESEND PATCH] net: ethernet: ti: davinci_mdio: Add workaround for errata i2329
Date: Tue, 9 Aug 2022 17:00:20 +0530 [thread overview]
Message-ID: <27860709-db8f-49be-fec7-a76496bfb948@ti.com> (raw)
In-Reply-To: <YvFubdCiU7J8Ufi4@lunn.ch>
Hello Andrew,
On 09/08/22 1:43 am, Andrew Lunn wrote:
>> +static int davinci_mdio_sw_read(struct mii_bus *bus, int phy_id, int phy_reg)
>> +{
>> + struct davinci_mdio_data *data = bus->priv;
>> + u32 reg, i;
>> + int ret;
>> + u8 ack;
>> +
>> + if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
>> + return -EINVAL;
>> +
>> + ret = pm_runtime_get_sync(data->dev);
>> + if (ret < 0) {
>> + pm_runtime_put_noidle(data->dev);
>> + return ret;
>> + }
>> +
>> + davinci_mdio_disable(data);
>> + davinci_mdio_enable_manual_mode(data);
>> + davinci_mdio_sw_preamble(data);
>> +
>> + davinci_mdio_sw_clr_bit(data, MDIO_MDCLK);
>> + davinci_mdio_sw_set_bit(data, MDIO_OE);
>> +
>> + /* Issue clause 22 MII read function {0,1,1,0} */
>> + davinci_mdio_man_send_pattern(data, C22_BITRANGE, C22_READ_PATTERN);
>> +
>> + /* Send the device number MSB first */
>> + davinci_mdio_man_send_pattern(data, PHY_BITRANGE, phy_id);
>> +
>> + /* Send the register number MSB first */
>> + davinci_mdio_man_send_pattern(data, PHY_BITRANGE, phy_reg);
>> +
>> + /* Send turn around cycles */
>> + davinci_mdio_sw_clr_bit(data, MDIO_OE);
>> +
>> + davinci_mdio_toggle_man_bit(data, MDIO_MDCLK);
>> +
>> + ack = davinci_mdio_test_man_bit(data, MDIO_PIN);
>> + davinci_mdio_toggle_man_bit(data, MDIO_MDCLK);
>> +
>> + reg = 0;
>> + if (ack == 0) {
>> + for (i = MDIO_BITRANGE; i; i = i >> 1) {
>> + if (davinci_mdio_test_man_bit(data, MDIO_PIN))
>> + reg |= i;
>> +
>> + davinci_mdio_toggle_man_bit(data, MDIO_MDCLK);
>> + }
>> + } else {
>> + for (i = MDIO_BITRANGE; i; i = i >> 1)
>> + davinci_mdio_toggle_man_bit(data, MDIO_MDCLK);
>> +
>> + reg = 0xFFFF;
>> + }
>> +
>> + davinci_mdio_sw_clr_bit(data, MDIO_MDCLK);
>> + davinci_mdio_sw_set_bit(data, MDIO_MDCLK);
>> + davinci_mdio_sw_set_bit(data, MDIO_MDCLK);
>> + davinci_mdio_toggle_man_bit(data, MDIO_MDCLK);
>
> You appear to of re-invented drivers/net/mdio/mdio-bitbang.c
>
> If there is a reason this cannot be used, please at least state it in
> the commit message.
>
Thanks for reviewing the patch. Since mdiobb_{read,write}() are exported, I can
invoke these in my mdio read/write implementation. I will rework and send the v2 patch
> Andrew
--
Regards,
Ravi
next prev parent reply other threads:[~2022-08-09 11:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-08 11:12 Ravi Gunasekaran
2022-08-08 20:13 ` Andrew Lunn
2022-08-09 11:30 ` Ravi Gunasekaran [this message]
2022-08-09 17:10 ` [EXTERNAL] " Andrew Lunn
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=27860709-db8f-49be-fec7-a76496bfb948@ti.com \
--to=r-gunasekaran@ti.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kishon@ti.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vigneshr@ti.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
all inboxes | Powered by JetHome®