[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <27860709-db8f-49be-fec7-a76496bfb948@ti.com>
Date: Tue, 9 Aug 2022 17:00:20 +0530
From: Ravi Gunasekaran <r-gunasekaran@...com>
To: Andrew Lunn <andrew@...n.ch>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>, <linux-omap@...r.kernel.org>,
<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <kishon@...com>,
<vigneshr@...com>
Subject: Re: [EXTERNAL] Re: [RESEND PATCH] net: ethernet: ti: davinci_mdio:
Add workaround for errata i2329
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
Powered by blists - more mailing lists