+static int lan743x_hs_otp_cmd_cmplt_chk(struct lan743x_adapter *adapter)
+{
+ unsigned long start_time = jiffies;
+ u32 val;
+
+ do {
+ val = lan743x_csr_read(adapter, HS_OTP_STATUS);
+ if (!(val & OTP_STATUS_BUSY_))
+ break;
+
+ usleep_range(80, 100);
+ } while (!time_after(jiffies, start_time + HZ));
+
+ if (val & OTP_STATUS_BUSY_) {
+ netif_warn(adapter, drv, adapter->netdev,
+ "Timeout on HS_OTP_STATUS completion\n");
+ return -ETIMEDOUT;
+ }
iopoll.h
+static int lan743x_hs_otp_read(struct lan743x_adapter *adapter, u32 offset,
+ u32 length, u8 *data)
+{
+ int ret;
+ int i;
+
+ if (offset + length > MAX_OTP_SIZE)
+ return -EINVAL;
The core does this.
+static int lan743x_hs_otp_write(struct lan743x_adapter *adapter, u32 offset,
+ u32 length, u8 *data)
+{
+ int ret;
+ int i;
+
+ if (offset + length > MAX_OTP_SIZE)
+ return -EINVAL;
The core does this.
Andrew