From ba54673280c29e20f1cf840a765e3d8d25ee7d72 Mon Sep 17 00:00:00 2001 From: nicwu-cel Date: Thu, 8 Jul 2021 06:09:00 +0000 Subject: [PATCH] enable the emc2305 fan controller and NCP power controller 30ms timeout mechanism --- .../debian/platform-modules-dx010.init | 13 ++++++++++++- .../dx010/modules/emc2305.c | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init index 8ee3d4465588..21587bfbd3fd 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init @@ -147,7 +147,18 @@ start) sleep 0.1 done - /bin/sh /usr/local/bin/platform_api_mgnt.sh init + bus_en=8 + sleep 1 + cfg_r=`i2cget -y -f 8 0x60 0xD1` + ((cfg_w=$cfg_r+$bus_en)) + i2cset -y -f 8 0x60 0xD1 $cfg_w + sleep 1 + cfg_r=`i2cget -y -f 9 0x20 0xD1` + ((cfg_w=$cfg_r+$bus_en)) + i2cset -y -f 9 0x20 0xD1 $cfg_w + sleep 1 + + /bin/sh /usr/local/bin/platform_api_mgnt.sh init echo "done." ;; diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c index b406a29fd9be..b7a85c17a332 100644 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c @@ -742,6 +742,7 @@ emc2305_probe(struct i2c_client *client, const struct i2c_device_id *id) int status; int i; int fan_idx; + unsigned char dis_to = 0; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; @@ -752,6 +753,11 @@ emc2305_probe(struct i2c_client *client, const struct i2c_device_id *id) i2c_set_clientdata(client, data); mutex_init(&data->update_lock); + + dis_to = i2c_smbus_read_byte_data(client, REG_CONFIGURATION); + dis_to &= 0xBF; + /* The SMBus timeout function is enabled */ + (void)i2c_smbus_write_byte_data(client, REG_CONFIGURATION, dis_to); status = i2c_smbus_read_byte_data(client, REG_PRODUCT_ID); switch (status) {