Thread (14 messages) flat view 14 messages, 3 authors, 2022-03-17

Re: [PATCH net-next 3/5] net: lan743x: Add support for OTP

From: Andrew Lunn <andrew@lunn.ch>
Date: 2022-03-15 20:44:20

+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help