[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220317104956.4fhf3xjgrznm5tcv@microsemi.com>
Date: Thu, 17 Mar 2022 16:19:56 +0530
From: Raju Lakkaraju <Raju.Lakkaraju@...rochip.com>
To: Andrew Lunn <andrew@...n.ch>
CC: <netdev@...r.kernel.org>, <davem@...emloft.net>, <kuba@...nel.org>,
<UNGLinuxDriver@...rochip.com>, <Ian.Saturley@...rochip.com>
Subject: Re: [PATCH net-next 2/5] net: lan743x: Add support for EEPROM
Hi Andrew,
Thank you for review comments
The 03/15/2022 21:42, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> > +static int lan743x_hs_syslock_acquire(struct lan743x_adapter *adapter,
> > + u16 timeout)
> > +{
> > + u16 timeout_cnt = 0;
> > + u32 val;
> > +
> > + do {
> > + spin_lock(&adapter->eth_syslock_spinlock);
> > + if (adapter->eth_syslock_acquire_cnt == 0) {
> > + lan743x_csr_write(adapter, ETH_SYSTEM_SYS_LOCK_REG,
> > + SYS_LOCK_REG_ENET_SS_LOCK_);
> > + val = lan743x_csr_read(adapter, ETH_SYSTEM_SYS_LOCK_REG);
> > + if (val & SYS_LOCK_REG_ENET_SS_LOCK_) {
> > + adapter->eth_syslock_acquire_cnt++;
> > + WARN_ON(adapter->eth_syslock_acquire_cnt == 0);
> > + spin_unlock(&adapter->eth_syslock_spinlock);
> > + break;
> > + }
> > + } else {
> > + adapter->eth_syslock_acquire_cnt++;
> > + WARN_ON(adapter->eth_syslock_acquire_cnt == 0);
> > + spin_unlock(&adapter->eth_syslock_spinlock);
> > + break;
> > + }
> > +
> > + spin_unlock(&adapter->eth_syslock_spinlock);
> > +
> > + if (timeout_cnt++ < timeout)
> > + usleep_range(10000, 11000);
> > + else
> > + return -EINVAL;
>
> ETIMEDOUT should be used for a timeout.
>
Accpeted. Fix in V1 patches
> > +static int lan743x_hs_eeprom_cmd_cmplt_chk(struct lan743x_adapter *adapter)
> > +{
> > + unsigned long start_time = jiffies;
> > + u32 val;
> > +
> > + do {
> > + val = lan743x_csr_read(adapter, HS_E2P_CMD);
> > + if (!(val & HS_E2P_CMD_EPC_BUSY_) ||
> > + (val & HS_E2P_CMD_EPC_TIMEOUT_))
> > + break;
> > +
> > + usleep_range(50, 60);
> > + } while (!time_after(jiffies, start_time + HZ));
> > +
> > + if (val & (HS_E2P_CMD_EPC_TIMEOUT_ | HS_E2P_CMD_EPC_BUSY_)) {
> > + netif_warn(adapter, drv, adapter->netdev,
> > + "HS EEPROM operation timeout/busy\n");
> > + return -ETIMEDOUT;
> > + }
>
> It looks like iopoll.h should be used here.
>
Accepted. Fix in V1 patches
> > +static int lan743x_hs_eeprom_write(struct lan743x_adapter *adapter,
> > + u32 offset, u32 length, u8 *data)
> > +{
> > + int retval;
> > + u32 val;
> > + int i;
> > +
> > + if (offset + length > MAX_EEPROM_SIZE)
> > + return -EINVAL;
>
> The core should of already checked this. Look at net/ethtool/ioctl.c
>
> Andrew
Accepted. Fix in V1 patches
--
Thanks,
Raju
Powered by blists - more mailing lists