From c5593f6636602ae79391e138c2506c77371ce525 Mon Sep 17 00:00:00 2001 From: jostar-yang Date: Thu, 8 Sep 2022 17:10:39 +0800 Subject: [PATCH 1/2] [Edge-Core][AS9716]Provide psu_fan_dir sysfs Signed-off-by: jostar-yang --- .../Accton-AS9716-32D/port_config.ini | 66 ++++---- .../plugins/sfputil.py | 88 +++++----- .../modules/accton_as9716_32d_psu.c | 155 ++++++++++++++---- .../as9716-32d/modules/accton_i2c_psu.c | 54 +++--- 4 files changed, 232 insertions(+), 131 deletions(-) diff --git a/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D/port_config.ini b/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D/port_config.ini index ab5ba53d280..199fa22b527 100644 --- a/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D/port_config.ini +++ b/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D/port_config.ini @@ -1,33 +1,35 @@ # name lanes alias index speed -Ethernet0 73,74,75,76,77,78,79,80 fourHundredGigE1 0 400000 -Ethernet8 65,66,67,68,69,70,71,72 fourHundredGigE2 1 400000 -Ethernet16 81,82,83,84,85,86,87,88 fourHundredGigE3 2 400000 -Ethernet24 89,90,91,92,93,94,95,96 fourHundredGigE4 3 400000 -Ethernet32 97,98,99,100,101,102,103,104 fourHundredGigE5 4 400000 -Ethernet40 105,106,107,108,109,110,111,112 fourHundredGigE6 5 400000 -Ethernet48 113,114,115,116,117,118,119,120 fourHundredGigE7 6 400000 -Ethernet56 121,122,123,124,125,126,127,128 fourHundredGigE8 7 400000 -Ethernet64 41,42,43,44,45,46,47,48 fourHundredGigE9 8 400000 -Ethernet72 33,34,35,36,37,38,39,40 fourHundredGigE10 9 400000 -Ethernet80 49,50,51,52,53,54,55,56 fourHundredGigE11 10 400000 -Ethernet88 57,58,59,60,61,62,63,64 fourHundredGigE12 11 400000 -Ethernet96 129,130,131,132,133,134,135,136 fourHundredGigE13 12 400000 -Ethernet104 137,138,139,140,141,142,143,144 fourHundredGigE14 13 400000 -Ethernet112 145,146,147,148,149,150,151,152 fourHundredGigE15 14 400000 -Ethernet120 153,154,155,156,157,158,159,160 fourHundredGigE16 15 400000 -Ethernet128 169,170,171,172,173,174,175,176 fourHundredGigE17 16 400000 -Ethernet136 161,162,163,164,165,166,167,168 fourHundredGigE18 17 400000 -Ethernet144 177,178,179,180,181,182,183,184 fourHundredGigE19 18 400000 -Ethernet152 185,186,187,188,189,190,191,192 fourHundredGigE20 19 400000 -Ethernet160 1,2,3,4,5,6,7,8 fourHundredGigE21 20 400000 -Ethernet168 9,10,11,12,13,14,15,16 fourHundredGigE22 21 400000 -Ethernet176 17,18,19,20,21,22,23,24 fourHundredGigE23 22 400000 -Ethernet184 25,26,27,28,29,30,31,32 fourHundredGigE24 23 400000 -Ethernet192 201,202,203,204,205,206,207,208 fourHundredGigE25 24 400000 -Ethernet200 193,194,195,196,197,198,199,200 fourHundredGigE26 25 400000 -Ethernet208 217,218,219,220,221,222,223,224 fourHundredGigE27 26 400000 -Ethernet216 209,210,211,212,213,214,215,216 fourHundredGigE28 27 400000 -Ethernet224 233,234,235,236,237,238,239,240 fourHundredGigE29 28 400000 -Ethernet232 225,226,227,228,229,230,231,232 fourHundredGigE30 29 400000 -Ethernet240 249,250,251,252,253,254,255,256 fourHundredGigE31 30 400000 -Ethernet248 241,242,243,244,245,246,247,248 fourHundredGigE32 31 400000 +Ethernet0 73,74,75,76,77,78,79,80 fourHundredGigE1 1 400000 +Ethernet8 65,66,67,68,69,70,71,72 fourHundredGigE2 2 400000 +Ethernet16 81,82,83,84,85,86,87,88 fourHundredGigE3 3 400000 +Ethernet24 89,90,91,92,93,94,95,96 fourHundredGigE4 4 400000 +Ethernet32 97,98,99,100,101,102,103,104 fourHundredGigE5 5 400000 +Ethernet40 105,106,107,108,109,110,111,112 fourHundredGigE6 6 400000 +Ethernet48 113,114,115,116,117,118,119,120 fourHundredGigE7 7 400000 +Ethernet56 121,122,123,124,125,126,127,128 fourHundredGigE8 8 400000 +Ethernet64 41,42,43,44,45,46,47,48 fourHundredGigE9 9 400000 +Ethernet72 33,34,35,36,37,38,39,40 fourHundredGigE10 10 400000 +Ethernet80 49,50,51,52,53,54,55,56 fourHundredGigE11 11 400000 +Ethernet88 57,58,59,60,61,62,63,64 fourHundredGigE12 12 400000 +Ethernet96 129,130,131,132,133,134,135,136 fourHundredGigE13 13 400000 +Ethernet104 137,138,139,140,141,142,143,144 fourHundredGigE14 14 400000 +Ethernet112 145,146,147,148,149,150,151,152 fourHundredGigE15 15 400000 +Ethernet120 153,154,155,156,157,158,159,160 fourHundredGigE16 16 400000 +Ethernet128 169,170,171,172,173,174,175,176 fourHundredGigE17 17 400000 +Ethernet136 161,162,163,164,165,166,167,168 fourHundredGigE18 18 400000 +Ethernet144 177,178,179,180,181,182,183,184 fourHundredGigE19 19 400000 +Ethernet152 185,186,187,188,189,190,191,192 fourHundredGigE20 20 400000 +Ethernet160 1,2,3,4,5,6,7,8 fourHundredGigE21 21 400000 +Ethernet168 9,10,11,12,13,14,15,16 fourHundredGigE22 22 400000 +Ethernet176 17,18,19,20,21,22,23,24 fourHundredGigE23 23 400000 +Ethernet184 25,26,27,28,29,30,31,32 fourHundredGigE24 24 400000 +Ethernet192 201,202,203,204,205,206,207,208 fourHundredGigE25 25 400000 +Ethernet200 193,194,195,196,197,198,199,200 fourHundredGigE26 26 400000 +Ethernet208 217,218,219,220,221,222,223,224 fourHundredGigE27 27 400000 +Ethernet216 209,210,211,212,213,214,215,216 fourHundredGigE28 28 400000 +Ethernet224 233,234,235,236,237,238,239,240 fourHundredGigE29 29 400000 +Ethernet232 225,226,227,228,229,230,231,232 fourHundredGigE30 30 400000 +Ethernet240 249,250,251,252,253,254,255,256 fourHundredGigE31 31 400000 +Ethernet248 241,242,243,244,245,246,247,248 fourHundredGigE32 32 400000 +Ethernet256 257 tenGigE33 33 10000 +Ethernet257 258 tenGigE34 34 10000 diff --git a/device/accton/x86_64-accton_as9716_32d-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as9716_32d-r0/plugins/sfputil.py index 7b3ca53d4ed..dd92442e577 100755 --- a/device/accton/x86_64-accton_as9716_32d-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as9716_32d-r0/plugins/sfputil.py @@ -16,8 +16,8 @@ class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" - PORT_START = 0 - PORT_END = 33 + PORT_START = 1 + PORT_END = 34 PORTS_IN_BLOCK = 34 BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/" @@ -29,40 +29,40 @@ class SfpUtil(SfpUtilBase): _port_to_eeprom_mapping = {} _port_to_i2c_mapping = { - 0: [1, 25], - 1: [2, 26], - 2: [3, 27], - 3: [4, 28], - 4: [5, 29], - 5: [6, 30], - 6: [7, 31], - 7: [8, 32], - 8: [9, 33], - 9: [10, 34], - 10: [11, 35], - 11: [12, 36], - 12: [13, 37], - 13: [14, 38], - 14: [15, 39], - 15: [16, 40], - 16: [17, 41], - 17: [18, 42], - 18: [19, 43], - 19: [20, 44], - 20: [21, 45], - 21: [22, 46], - 22: [23, 47], - 23: [24, 48], - 24: [25, 49], - 25: [26, 50], - 26: [27, 51], - 27: [28, 52], - 28: [29, 53], - 29: [30, 54], - 30: [31, 55], - 31: [32, 56], - 32: [33, 57], - 33: [34, 58], + 1: 25, + 2: 26, + 3: 27, + 4: 28, + 5: 29, + 6: 30, + 7: 31, + 8: 32, + 9: 33, + 10: 34, + 11: 35, + 12: 36, + 13: 37, + 14: 38, + 15: 39, + 16: 40, + 17: 41, + 18: 42, + 19: 43, + 20: 44, + 21: 45, + 22: 46, + 23: 47, + 24: 48, + 25: 49, + 26: 50, + 27: 51, + 28: 52, + 29: 53, + 30: 54, + 31: 55, + 32: 56, + 33: 57, + 34: 58, } @property @@ -84,9 +84,9 @@ def port_to_eeprom_mapping(self): def __init__(self): eeprom_path = self.BASE_OOM_PATH + "eeprom" - for x in range(0, self.port_end+1): + for x in range(self.port_start, self.port_end+1): self.port_to_eeprom_mapping[x] = eeprom_path.format( - self._port_to_i2c_mapping[x][1] + self._port_to_i2c_mapping[x] ) SfpUtilBase.__init__(self) @@ -95,10 +95,10 @@ def get_presence(self, port_num): # Check for invalid port_num if port_num < self.port_start or port_num > self.port_end: return False - if port_num < 16: - present_path = self.BASE_CPLD1_PATH + "module_present_" + str(port_num+1) + if port_num <= 16: + present_path = self.BASE_CPLD1_PATH + "module_present_" + str(port_num) else: - present_path = self.BASE_CPLD2_PATH + "module_present_" + str(port_num+1) + present_path = self.BASE_CPLD2_PATH + "module_present_" + str(port_num) self.__port_to_is_present = present_path content = "0" @@ -181,7 +181,7 @@ def reset(self, port_num): if port_num < self.port_start or port_num > self.port_end: return False - if port_num < 16: + if port_num <= 16: mod_rst_path = self.BASE_CPLD1_PATH + "module_reset_" + str(port_num+1) else: mod_rst_path = self.BASE_CPLD2_PATH + "module_reset_" + str(port_num+1) @@ -208,8 +208,8 @@ def get_cpld_interrupt(self): else: cpld_i2c_path = self.BASE_CPLD2_PATH + "cpld_intr_" + str(i+1) - start_i = (i*8) - end_i = (i*8+8) + start_i = (i*8)+1 + end_i = (i*8+8)+1 try: val_file = open(cpld_i2c_path) except IOError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_psu.c b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_psu.c index 06e8e23c3c5..3584e2aeaa7 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_psu.c @@ -34,8 +34,13 @@ #include #include -#define MAX_MODEL_NAME 16 +#define MAX_MODEL_NAME 19 #define MAX_SERIAL_NUMBER 19 +#define FAN_DIR_LEN 3 + +const char FAN_DIR_F2B[] = "F2B"; +const char FAN_DIR_B2F[] = "B2F"; +const char FAN_DIR_UNKNOWN[] = ""; static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); static ssize_t show_string(struct device *dev, struct device_attribute *da, char *buf); @@ -55,8 +60,9 @@ struct as9716_32d_psu_data { unsigned long last_updated; /* In jiffies */ u8 index; /* PSU index */ u8 status; /* Status(present/power_good) register read from CPLD */ - char model_name[MAX_MODEL_NAME]; /* Model name, read from eeprom */ - char serial_number[MAX_SERIAL_NUMBER]; + char model_name[MAX_MODEL_NAME+1]; /* Model name, read from eeprom */ + char serial_number[MAX_SERIAL_NUMBER+1]; + const char* fan_dir; }; static struct as9716_32d_psu_data *as9716_32d_psu_update_device(struct device *dev); @@ -65,7 +71,8 @@ enum as9716_32d_psu_sysfs_attributes { PSU_PRESENT, PSU_MODEL_NAME, PSU_POWER_GOOD, - PSU_SERIAL_NUMBER + PSU_SERIAL_NUMBER, + PSU_FAN_DIR }; /* sysfs attributes for hwmon @@ -74,13 +81,14 @@ static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRE static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_string, NULL, PSU_MODEL_NAME); static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); static SENSOR_DEVICE_ATTR(psu_serial_number, S_IRUGO, show_string, NULL, PSU_SERIAL_NUMBER); - +static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IRUGO, show_string, NULL, PSU_FAN_DIR); static struct attribute *as9716_32d_psu_attributes[] = { &sensor_dev_attr_psu_present.dev_attr.attr, &sensor_dev_attr_psu_model_name.dev_attr.attr, &sensor_dev_attr_psu_power_good.dev_attr.attr, &sensor_dev_attr_psu_serial_number.dev_attr.attr, + &sensor_dev_attr_psu_fan_dir.dev_attr.attr, NULL }; @@ -106,7 +114,7 @@ static ssize_t show_string(struct device *dev, struct device_attribute *da, { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct as9716_32d_psu_data *data = as9716_32d_psu_update_device(dev); - char *ptr = NULL; + const char *ptr = NULL; if (!data->valid) { return -EIO; @@ -119,6 +127,9 @@ static ssize_t show_string(struct device *dev, struct device_attribute *da, case PSU_SERIAL_NUMBER: ptr = data->serial_number; break; + case PSU_FAN_DIR: + ptr = data->fan_dir; + break; default: return -EINVAL; } @@ -244,6 +255,44 @@ static int as9716_32d_psu_read_block(struct i2c_client *client, u8 command, u8 * return result; } +enum psu_type { + PSU_TYPE_AC_ACBEL_FSF019_F2B, // FSF019 + PSU_TYPE_AC_ACBEL_FSH082_F2B, // FSH082-610G + PSU_TYPE_AC_ACBEL_FSH095_B2F, // FSH095-610G + PSU_TYPE_3Y_YESM1300AM // YESM1300AM-2A01P10(F2B) or YESM1300AM-2R01P10(B2F) +}; + +struct model_name_info { + enum psu_type type; + u8 offset; + u8 length; + u8 chk_length; + char* model_name; + const char* fan_dir; +}; + +struct serial_number_info { + enum psu_type type; + u8 offset; + u8 length; + u8 chk_length; + char* serial_number; +}; + +struct model_name_info models[] = { + { PSU_TYPE_AC_ACBEL_FSF019_F2B, 0x20, 13, 6, "FSF019", FAN_DIR_F2B }, + { PSU_TYPE_AC_ACBEL_FSH082_F2B, 0x20, 13, 6, "FSH082", FAN_DIR_F2B }, + { PSU_TYPE_AC_ACBEL_FSH095_B2F, 0x20, 13, 6, "FSH095", FAN_DIR_B2F }, + { PSU_TYPE_3Y_YESM1300AM, 0x20, 19, 8, "YESM1300", NULL } +}; + +struct serial_number_info serials[] = { + { PSU_TYPE_AC_ACBEL_FSF019_F2B, 0x2e, 16, 16, "FSF019" }, + { PSU_TYPE_AC_ACBEL_FSH082_F2B, 0x35, 18, 18, "FSH082" }, + { PSU_TYPE_AC_ACBEL_FSH095_B2F, 0x35, 18, 18, "FSH095" }, + { PSU_TYPE_3Y_YESM1300AM, 0x35, 19, 19, "YESM1300" } +}; + static struct as9716_32d_psu_data *as9716_32d_psu_update_device(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -253,53 +302,102 @@ static struct as9716_32d_psu_data *as9716_32d_psu_update_device(struct device *d if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || !data->valid) { - int status; + int i, status; int power_good = 0; dev_dbg(&client->dev, "Starting as9716_32d update\n"); + data->valid = 0; /* Read psu status */ status = as9716_32d_cpld_read(0x60, 0x3); if (status < 0) { dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); + goto exit; } else { data->status = status; } /* Read model name */ - memset(data->model_name, 0, sizeof(data->model_name)); - memset(data->serial_number, 0, sizeof(data->serial_number)); + data->model_name[0] = '\0'; + data->serial_number[0] = '\0'; + data->fan_dir = FAN_DIR_UNKNOWN; power_good = (data->status >> (3-data->index) & 0x1); - + if (power_good) { - status = as9716_32d_psu_read_block(client, 0x20, data->model_name, - ARRAY_SIZE(data->model_name)-1); - if (status < 0) { - data->model_name[0] = '\0'; - dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); - } - else { - data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; - + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data->model_name, 0, sizeof(data->model_name)); + memset(data->serial_number, 0, sizeof(data->serial_number)); + + status = as9716_32d_psu_read_block(client, models[i].offset, + data->model_name, models[i].length); + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + goto exit; + } + else { + data->model_name[models[i].length] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data->model_name, models[i].model_name, models[i].chk_length) == 0) { + status = as9716_32d_psu_read_block(client, serials[i].offset, + data->serial_number, serials[i].length); + if (models[i].type == PSU_TYPE_3Y_YESM1300AM) { + // Adjust model name for PSU_TYPE_3Y_YESM1300AM + char buf[10] = {0}; + memcpy(buf, &data->model_name[9], 10); + memcpy(&data->model_name[8], buf, 10); + data->model_name[models[i].length-1] = '\0'; + + if (data->model_name[12] == 'A') + data->fan_dir = FAN_DIR_F2B; // YESM1300AM-2A01P10 + else + data->fan_dir = FAN_DIR_B2F; // YESM1300AM-2R01P10 + } + else if ((models[i].type == PSU_TYPE_AC_ACBEL_FSH082_F2B) || + (models[i].type == PSU_TYPE_AC_ACBEL_FSH095_B2F) || + (models[i].type == PSU_TYPE_AC_ACBEL_FSF019_F2B)) { + // Adjust model name for FSH082 / FSH095 / FSF019 + char buf[4] = {0}; + memcpy(buf, &data->model_name[9], 4); + memcpy(&data->model_name[7], buf, 4); + data->model_name[6] = '-'; + data->model_name[11] = '\0'; + data->fan_dir = models[i].fan_dir; + } + else { + data->fan_dir = models[i].fan_dir; + } + + // Read serial number + if (status < 0) { + data->serial_number[0] = '\0'; + dev_dbg(&client->dev, "unable to read serial num from (0x%x) offset(0x%x)\n", + client->addr, serials[i].offset); + goto exit; + } + else { + data->serial_number[serials[i].length] = '\0'; + break; + } + } + else { + data->serial_number[0] = '\0'; // model does not match, read next model + } } - /* Read from offset 0x2e ~ 0x3d (16 bytes) */ - status = as9716_32d_psu_read_block(client, 0x2e,data->serial_number, MAX_SERIAL_NUMBER); - if (status < 0) - { - data->serial_number[0] = '\0'; - dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x2e)\n", client->addr); - } - data->serial_number[MAX_SERIAL_NUMBER-1]='\0'; } data->last_updated = jiffies; data->valid = 1; } +exit: mutex_unlock(&data->update_lock); - return data; } @@ -308,4 +406,3 @@ module_i2c_driver(as9716_32d_psu_driver); MODULE_AUTHOR("Jostar Yang "); MODULE_DESCRIPTION("as9716_32d_psu driver"); MODULE_LICENSE("GPL"); - diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_i2c_psu.c b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_i2c_psu.c index df7324de560..3ddda2eef0a 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_i2c_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_i2c_psu.c @@ -526,6 +526,7 @@ static struct accton_i2c_psu_data *accton_i2c_psu_update_device(struct device *d if (status < 0) { dev_dbg(&client->dev, "reg %d, err %d\n", regs_byte[i].reg, status); + *(regs_byte[i].value) = 0; } else { *(regs_byte[i].value) = status; @@ -539,6 +540,7 @@ static struct accton_i2c_psu_data *accton_i2c_psu_update_device(struct device *d if (status < 0) { dev_dbg(&client->dev, "reg %d, err %d\n", regs_word[i].reg, status); + *(regs_word[i].value) = 0; } else { *(regs_word[i].value) = status; @@ -546,33 +548,33 @@ static struct accton_i2c_psu_data *accton_i2c_psu_update_device(struct device *d } /* Read mfr_id */ - status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_ID, data->mfr_id, - ARRAY_SIZE(data->mfr_id)); - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_ID, status); - goto exit; - } - /* Read mfr_model */ - status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_MODEL, data->mfr_model, - ARRAY_SIZE(data->mfr_model)); - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_MODEL, status); - goto exit; - } + status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_ID, data->mfr_id, + ARRAY_SIZE(data->mfr_id)); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_ID, status); + goto exit; + } + /* Read mfr_model */ + status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_MODEL, data->mfr_model, + ARRAY_SIZE(data->mfr_model)); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_MODEL, status); + goto exit; + } /* Read mfr_revsion */ - status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_REVISION, data->mfr_revsion, - ARRAY_SIZE(data->mfr_revsion)); - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_REVISION, status); - goto exit; - } - /* Read mfr_serial */ - status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_SERIAL, data->mfr_serial, - ARRAY_SIZE(data->mfr_serial)); - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_SERIAL, status); - goto exit; - } + status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_REVISION, data->mfr_revsion, + ARRAY_SIZE(data->mfr_revsion)); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_REVISION, status); + goto exit; + } + /* Read mfr_serial */ + status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_SERIAL, data->mfr_serial, + ARRAY_SIZE(data->mfr_serial)); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_SERIAL, status); + goto exit; + } data->last_updated = jiffies; data->valid = 1; From 86702f7a0386496b56210abf43ca4d35d22ea42e Mon Sep 17 00:00:00 2001 From: jostar-yang Date: Thu, 16 Mar 2023 10:05:02 +0800 Subject: [PATCH 2/2] Remove port_config.ini --- .../Accton-AS9716-32D/port_config.ini | 35 ------------------- 1 file changed, 35 deletions(-) delete mode 100644 device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D/port_config.ini diff --git a/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D/port_config.ini b/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D/port_config.ini deleted file mode 100644 index 199fa22b527..00000000000 --- a/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D/port_config.ini +++ /dev/null @@ -1,35 +0,0 @@ -# name lanes alias index speed -Ethernet0 73,74,75,76,77,78,79,80 fourHundredGigE1 1 400000 -Ethernet8 65,66,67,68,69,70,71,72 fourHundredGigE2 2 400000 -Ethernet16 81,82,83,84,85,86,87,88 fourHundredGigE3 3 400000 -Ethernet24 89,90,91,92,93,94,95,96 fourHundredGigE4 4 400000 -Ethernet32 97,98,99,100,101,102,103,104 fourHundredGigE5 5 400000 -Ethernet40 105,106,107,108,109,110,111,112 fourHundredGigE6 6 400000 -Ethernet48 113,114,115,116,117,118,119,120 fourHundredGigE7 7 400000 -Ethernet56 121,122,123,124,125,126,127,128 fourHundredGigE8 8 400000 -Ethernet64 41,42,43,44,45,46,47,48 fourHundredGigE9 9 400000 -Ethernet72 33,34,35,36,37,38,39,40 fourHundredGigE10 10 400000 -Ethernet80 49,50,51,52,53,54,55,56 fourHundredGigE11 11 400000 -Ethernet88 57,58,59,60,61,62,63,64 fourHundredGigE12 12 400000 -Ethernet96 129,130,131,132,133,134,135,136 fourHundredGigE13 13 400000 -Ethernet104 137,138,139,140,141,142,143,144 fourHundredGigE14 14 400000 -Ethernet112 145,146,147,148,149,150,151,152 fourHundredGigE15 15 400000 -Ethernet120 153,154,155,156,157,158,159,160 fourHundredGigE16 16 400000 -Ethernet128 169,170,171,172,173,174,175,176 fourHundredGigE17 17 400000 -Ethernet136 161,162,163,164,165,166,167,168 fourHundredGigE18 18 400000 -Ethernet144 177,178,179,180,181,182,183,184 fourHundredGigE19 19 400000 -Ethernet152 185,186,187,188,189,190,191,192 fourHundredGigE20 20 400000 -Ethernet160 1,2,3,4,5,6,7,8 fourHundredGigE21 21 400000 -Ethernet168 9,10,11,12,13,14,15,16 fourHundredGigE22 22 400000 -Ethernet176 17,18,19,20,21,22,23,24 fourHundredGigE23 23 400000 -Ethernet184 25,26,27,28,29,30,31,32 fourHundredGigE24 24 400000 -Ethernet192 201,202,203,204,205,206,207,208 fourHundredGigE25 25 400000 -Ethernet200 193,194,195,196,197,198,199,200 fourHundredGigE26 26 400000 -Ethernet208 217,218,219,220,221,222,223,224 fourHundredGigE27 27 400000 -Ethernet216 209,210,211,212,213,214,215,216 fourHundredGigE28 28 400000 -Ethernet224 233,234,235,236,237,238,239,240 fourHundredGigE29 29 400000 -Ethernet232 225,226,227,228,229,230,231,232 fourHundredGigE30 30 400000 -Ethernet240 249,250,251,252,253,254,255,256 fourHundredGigE31 31 400000 -Ethernet248 241,242,243,244,245,246,247,248 fourHundredGigE32 32 400000 -Ethernet256 257 tenGigE33 33 10000 -Ethernet257 258 tenGigE34 34 10000