forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable A2h access for optoe2 even when DDM is unsupported (sonic-net#246
) Enable 0x51 (A2h) access for optoe2 even when DDM is unsupported, for accessing vendor specific fields. Some SFP optics that do not support DDM can have vendor specific implementation via 0x51 in A2h register space (eg. Mailbox Registers). Removed the DDM support check for optoe2 (TWO_ADDR) and now its EEPROM size is 512 bytes minimum. Return error when accessing beyond 256 bytes for optics that do not support I2C address 0x51.
- Loading branch information
Jemston Fernando
authored
Dec 3, 2021
1 parent
6aa8d00
commit 292b353
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
From 23a58d78c8c12b0092e1dfded96e6d648bffe1de Mon Sep 17 00:00:00 2001 | ||
From: Jemston Fernando <[email protected]> | ||
Date: Thu, 25 Nov 2021 04:30:04 -0800 | ||
Subject: [PATCH] A2h access for optoe2 even when DDM is unsupported | ||
|
||
Enable 0x51 (A2h) access for optoe2 even when DDM is unsupported, for | ||
accessing vendor specific fields. Some SFP optics that do not support DDM | ||
can have vendor specific implementation via 0x51 in A2h register space | ||
(eg. Mailbox Registers). | ||
|
||
Removed the DDM support check for optoe2 (TWO_ADDR) and now its EEPROM | ||
size is 512 bytes minimum. Return error when accessing beyond 256 bytes | ||
for optics that do not support I2C address 0x51. | ||
|
||
Signed-off-by: Jemston Fernando <[email protected]> | ||
--- | ||
drivers/misc/eeprom/optoe.c | 23 +++-------------------- | ||
1 file changed, 3 insertions(+), 20 deletions(-) | ||
|
||
diff --git a/drivers/misc/eeprom/optoe.c b/drivers/misc/eeprom/optoe.c | ||
index a7554e9..6229439 100644 | ||
--- a/drivers/misc/eeprom/optoe.c | ||
+++ b/drivers/misc/eeprom/optoe.c | ||
@@ -174,8 +174,6 @@ struct optoe_platform_data { | ||
#define CMIS_NOT_PAGEABLE (1<<7) | ||
#define TWO_ADDR_PAGEABLE_REG 0x40 | ||
#define TWO_ADDR_PAGEABLE (1<<4) | ||
-#define TWO_ADDR_0X51_REG 92 | ||
-#define TWO_ADDR_0X51_SUPP (1<<6) | ||
#define OPTOE_ID_REG 0 | ||
#define OPTOE_READ_OP 0 | ||
#define OPTOE_WRITE_OP 1 | ||
@@ -593,8 +591,8 @@ static ssize_t optoe_page_legal(struct optoe_data *optoe, | ||
return -EINVAL; | ||
if (optoe->dev_class == TWO_ADDR) { | ||
/* SFP case */ | ||
- /* if only using addr 0x50 (first 256 bytes) we're good */ | ||
- if ((off + len) <= TWO_ADDR_NO_0X51_SIZE) | ||
+ /* if access is within addr 0x50 or first page of 0x51 (first 512 bytes) we're good */ | ||
+ if ((off + len) <= TWO_ADDR_EEPROM_UNPAGED_SIZE) | ||
return len; | ||
/* if offset exceeds possible pages, we're not good */ | ||
if (off >= TWO_ADDR_EEPROM_SIZE) | ||
@@ -611,22 +609,7 @@ static ssize_t optoe_page_legal(struct optoe_data *optoe, | ||
/* pages not supported, trim len to unpaged size */ | ||
if (off >= TWO_ADDR_EEPROM_UNPAGED_SIZE) | ||
return OPTOE_EOF; | ||
- | ||
- /* will be accessing addr 0x51, is that supported? */ | ||
- /* byte 92, bit 6 implies DDM support, 0x51 support */ | ||
- status = optoe_eeprom_read(optoe, client, ®val, | ||
- TWO_ADDR_0X51_REG, 1); | ||
- if (status < 0) | ||
- return status; | ||
- if (regval & TWO_ADDR_0X51_SUPP) { | ||
- /* addr 0x51 is OK */ | ||
- maxlen = TWO_ADDR_EEPROM_UNPAGED_SIZE - off; | ||
- } else { | ||
- /* addr 0x51 NOT supported, trim to 256 max */ | ||
- if (off >= TWO_ADDR_NO_0X51_SIZE) | ||
- return OPTOE_EOF; | ||
- maxlen = TWO_ADDR_NO_0X51_SIZE - off; | ||
- } | ||
+ maxlen = TWO_ADDR_EEPROM_UNPAGED_SIZE - off; | ||
} | ||
len = (len > maxlen) ? maxlen : len; | ||
dev_dbg(&client->dev, | ||
-- | ||
2.7.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters