Skip to content

Commit 4bfc223

Browse files
committed
fix driver optoe twoaddr a2h read write bug
1 parent 694b338 commit 4bfc223

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
From 3e289806e5d3c45c6afc2a6caeb935828a5032eb Mon Sep 17 00:00:00 2001
2+
From: "Song,Qinghua" <[email protected]>
3+
Date: Fri, 20 Sep 2024 19:32:52 +0800
4+
Subject: [PATCH] fix driver optoe twoaddr a2h read/write bug
5+
6+
---
7+
drivers/misc/eeprom/optoe.c | 26 ++++++++++++++++++++++++--
8+
1 file changed, 24 insertions(+), 2 deletions(-)
9+
10+
diff --git a/drivers/misc/eeprom/optoe.c b/drivers/misc/eeprom/optoe.c
11+
index 16287fdc5..a277cc28c 100644
12+
--- a/drivers/misc/eeprom/optoe.c
13+
+++ b/drivers/misc/eeprom/optoe.c
14+
@@ -284,7 +284,6 @@ static uint8_t optoe_translate_offset(struct optoe_data *optoe,
15+
if (optoe->dev_class == TWO_ADDR) {
16+
if (*offset > 255) {
17+
/* like QSFP, but shifted to client[1] */
18+
- *client = optoe->client[1];
19+
*offset -= 256;
20+
}
21+
}
22+
@@ -304,6 +303,26 @@ static uint8_t optoe_translate_offset(struct optoe_data *optoe,
23+
24+
return page; /* note also returning client and offset */
25+
}
26+
+static void optoe_update_client(struct optoe_data *optoe, loff_t *offset, struct i2c_client **client)
27+
+{
28+
+ /* if SFP style, offset > 255, shift to i2c addr 0x51 */
29+
+ if (optoe->dev_class == TWO_ADDR) {
30+
+ if (*offset > 255) {
31+
+ *client = optoe->client[1];
32+
+ } else {
33+
+ *client = optoe->client[0];
34+
+ }
35+
+ }
36+
+ return;
37+
+}
38+
+
39+
+static void optoe_reset_client(struct optoe_data *optoe, loff_t *offset, struct i2c_client **client)
40+
+{
41+
+ *client = optoe->client[0];
42+
+
43+
+ return;
44+
+}
45+
+
46+
47+
static ssize_t optoe_eeprom_read(struct optoe_data *optoe,
48+
struct i2c_client *client,
49+
@@ -529,6 +548,8 @@ static ssize_t optoe_eeprom_update_client(struct optoe_data *optoe,
50+
return ret;
51+
}
52+
}
53+
+
54+
+ optoe_update_client(optoe, &off, &client);
55+
56+
while (count) {
57+
ssize_t status;
58+
@@ -551,7 +572,8 @@ static ssize_t optoe_eeprom_update_client(struct optoe_data *optoe,
59+
retval += status;
60+
}
61+
62+
-
63+
+ optoe_reset_client(optoe, &off, &client);
64+
+
65+
if (page > 0) {
66+
/* return the page register to page 0 (why?) */
67+
page = 0;
68+
--
69+
2.25.1
70+

patch/series

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ cisco-npu-disable-other-bars.patch
107107
#
108108
# Marvell platform patches for 4.19
109109
armhf_secondary_boot_online.patch
110+
111+
# optoe patches
112+
0001-fix-driver-optoe-twoaddr-a2h-read-write-bug.patch
110113
############################################################
111114
#
112115
# Internal patches will be added below (placeholder)

0 commit comments

Comments
 (0)