Merge branch 'master' of github.com:opencomputeproject/OpenNetworkLinux

This commit is contained in:
Jeffrey Townsend
2019-08-19 19:03:00 +00:00
8 changed files with 1419 additions and 3 deletions

View File

@@ -0,0 +1,86 @@
From 3d4e440640d63c5bc599a4ad6802ad84dcd0c329 Mon Sep 17 00:00:00 2001
From: Vadim Pasternak <vadimp@mellanox.com>
Date: Wed, 10 Jul 2019 17:47:56 +0000
Subject: [PATCH v1 backport] mlxsw: core: Skip port split entries in hwmon
subsystem
Skip split entries in hwmon.
Run loop for port creation over maximum port counter, otherwise
in some split configuration with holes, some last modules can be
missed.
Signed-of-by: Vadim Pasternak <vadimp@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | 7 ++++++-
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 2 +-
drivers/net/ethernet/mellanox/mlxsw/minimal.c | 5 +++--
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c b/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
index a414a09efb5d..95b890298952 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
@@ -512,9 +512,9 @@ static int mlxsw_hwmon_fans_init(struct mlxsw_hwmon *mlxsw_hwmon)
static int mlxsw_hwmon_module_init(struct mlxsw_hwmon *mlxsw_hwmon)
{
unsigned int module_count = mlxsw_core_max_ports(mlxsw_hwmon->core);
+ u8 width, module, last_module = module_count;
char pmlp_pl[MLXSW_REG_PMLP_LEN] = {0};
int i, index;
- u8 width;
int err;
if (!mlxsw_core_res_query_enabled(mlxsw_hwmon->core))
@@ -538,6 +538,11 @@ static int mlxsw_hwmon_module_init(struct mlxsw_hwmon *mlxsw_hwmon)
width = mlxsw_reg_pmlp_width_get(pmlp_pl);
if (!width)
continue;
+ module = mlxsw_reg_pmlp_module_get(pmlp_pl, 0);
+ /* Skip, if port belongs to the cluster */
+ if (module == last_module)
+ continue;
+ last_module = module;
mlxsw_hwmon_attr_add(mlxsw_hwmon,
MLXSW_HWMON_ATTR_TYPE_TEMP_MODULE, index,
index);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
index 499c82cea1cb..e9451e447bf0 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
@@ -906,7 +906,7 @@ mlxsw_thermal_gearboxes_fini(struct mlxsw_thermal *thermal)
int i;
for (i = thermal->tz_gearbox_num - 1; i >= 0; i--)
- mlxsw_thermal_gearbox_tz_fini(&thermal->tz_gearbox_arr[i]); /*Remove*/
+ mlxsw_thermal_gearbox_tz_fini(&thermal->tz_gearbox_arr[i]);
kfree(thermal->tz_gearbox_arr);
}
diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
index 5290993ff93f..0aa3abc974ff 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
@@ -264,7 +264,7 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
}
/* Create port objects for each valid entry */
- for (i = 0; i < mlxsw_m->max_ports; i++) {
+ for (i = 0; i < max_ports; i++) {
if (mlxsw_m->module_to_port[i] > 0) {
err = mlxsw_m_port_create(mlxsw_m,
mlxsw_m->module_to_port[i],
@@ -294,9 +294,10 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
static void mlxsw_m_ports_remove(struct mlxsw_m *mlxsw_m)
{
+ unsigned int max_ports = mlxsw_core_max_ports(mlxsw_m->core);
int i;
- for (i = 0; i < mlxsw_m->max_ports; i++) {
+ for (i = 0; i < max_ports; i++) {
if (mlxsw_m->module_to_port[i] > 0) {
mlxsw_m_port_remove(mlxsw_m,
mlxsw_m->module_to_port[i]);
--
2.11.0

View File

@@ -31,3 +31,5 @@ driver-add-the-support-max6620.patch
0029-mlxsw-core-Prevent-reading-unsupported-slave-address.patch
0029-mlxsw-core-add-support-for-Gear-Box-temperatures-in-.patch
0030-mlxsw-minimal-Provide-optimization-for-I2C-bus-acces.patch
0031-mlxsw-core-Skip-port-split-entries-in-hwmon-subsyste.patch
0032-mellanox-platform-Backporting-Melanox-drivers-from-v.patch

View File

@@ -1,6 +1,41 @@
from onl.platform.base import *
from onl.platform.accton import *
import commands
#IR3570A chip casue problem when read eeprom by i2c-block mode.
#It happen when read 16th-byte offset that value is 0x8. So disable chip
def disable_i2c_ir3570a(addr):
check_i2c="i2cget -y 0 0x4 0x1"
status, output = commands.getstatusoutput(check_i2c)
if status!=0:
return -1
cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
status, output = commands.getstatusoutput(cmd)
cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
status, output = commands.getstatusoutput(cmd)
return status
def ir3570_check():
check_i2c="i2cget -y 0 0x42 0x1"
status, output = commands.getstatusoutput(check_i2c)
if status!=0:
return -1
cmd = "i2cdump -y 0 0x42 s 0x9a"
try:
status, output = commands.getstatusoutput(cmd)
lines = output.split('\n')
hn = re.findall(r'\w+', lines[-1])
version = int(hn[1], 16)
if version == 0x24: #Find IR3570A
ret = disable_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3570_check() e:" + str(e)
return -1
return ret
class OnlPlatform_x86_64_accton_as5916_54x_r1(OnlPlatformAccton,
OnlPlatformPortConfig_48x10_6x40):
PLATFORM='x86-64-accton-as5916-54x-r1'
@@ -70,5 +105,7 @@ class OnlPlatform_x86_64_accton_as5916_54x_r1(OnlPlatformAccton,
for port in range(1, 55):
subprocess.call('echo port%d > /sys/bus/i2c/devices/%d-0050/port_name' % (port, port+32), shell=True)
ir3570_check()
return True

View File

@@ -1,6 +1,41 @@
from onl.platform.base import *
from onl.platform.accton import *
import commands
#IR3570A chip casue problem when read eeprom by i2c-block mode.
#It happen when read 16th-byte offset that value is 0x8. So disable chip
def disable_i2c_ir3570a(addr):
check_i2c="i2cget -y 0 0x4 0x1"
status, output = commands.getstatusoutput(check_i2c)
if status!=0:
return -1
cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
status, output = commands.getstatusoutput(cmd)
cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
status, output = commands.getstatusoutput(cmd)
return status
def ir3570_check():
check_i2c="i2cget -y 0 0x42 0x1"
status, output = commands.getstatusoutput(check_i2c)
if status!=0:
return -1
cmd = "i2cdump -y 0 0x42 s 0x9a"
try:
status, output = commands.getstatusoutput(cmd)
lines = output.split('\n')
hn = re.findall(r'\w+', lines[-1])
version = int(hn[1], 16)
if version == 0x24: #Find IR3570A
ret = disable_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3570_check() e:" + str(e)
return -1
return ret
class OnlPlatform_x86_64_accton_as5916_54xm_r0(OnlPlatformAccton,
OnlPlatformPortConfig_48x10_6x40):
PLATFORM='x86-64-accton-as5916-54xm-r0'
@@ -86,5 +121,7 @@ class OnlPlatform_x86_64_accton_as5916_54xm_r0(OnlPlatformAccton,
self.new_i2c_device('optoe2', 0x50, port+40)
subprocess.call('echo port%d > /sys/bus/i2c/devices/%d-0050/port_name' % (port, port+40), shell=True)
ir3570_check()
return True

View File

@@ -1,6 +1,41 @@
from onl.platform.base import *
from onl.platform.accton import *
import commands
#IR3570A chip casue problem when read eeprom by i2c-block mode.
#It happen when read 16th-byte offset that value is 0x8. So disable chip
def disable_i2c_ir3570a(addr):
check_i2c="i2cget -y 0 0x4 0x1"
status, output = commands.getstatusoutput(check_i2c)
if status!=0:
return -1
cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
status, output = commands.getstatusoutput(cmd)
cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
status, output = commands.getstatusoutput(cmd)
return status
def ir3570_check():
check_i2c="i2cget -y 0 0x42 0x1"
status, output = commands.getstatusoutput(check_i2c)
if status!=0:
return -1
cmd = "i2cdump -y 0 0x42 s 0x9a"
try:
status, output = commands.getstatusoutput(cmd)
lines = output.split('\n')
hn = re.findall(r'\w+', lines[-1])
version = int(hn[1], 16)
if version == 0x24: #Find IR3570A
ret = disable_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3570_check() e:" + str(e)
return -1
return ret
class OnlPlatform_x86_64_accton_as7326_56x_r0(OnlPlatformAccton,
OnlPlatformPortConfig_48x25_8x100):
@@ -92,4 +127,5 @@ class OnlPlatform_x86_64_accton_as7326_56x_r0(OnlPlatformAccton,
subprocess.call('echo port%d > /sys/bus/i2c/devices/%d-0050/port_name' % (port, bus), shell=True)
self.new_i2c_device('24c04', 0x56, 0)
ir3570_check()
return True

View File

@@ -1,6 +1,42 @@
from onl.platform.base import *
from onl.platform.accton import *
import commands
#IR3570A chip casue problem when read eeprom by i2c-block mode.
#It happen when read 16th-byte offset that value is 0x8. So disable chip
def disable_i2c_ir3570a(addr):
check_i2c="i2cget -y 0 0x4 0x1"
status, output = commands.getstatusoutput(check_i2c)
if status!=0:
return -1
cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
status, output = commands.getstatusoutput(cmd)
cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
status, output = commands.getstatusoutput(cmd)
return status
def ir3570_check():
check_i2c="i2cget -y 0 0x42 0x1"
status, output = commands.getstatusoutput(check_i2c)
if status!=0:
return -1
cmd = "i2cdump -y 0 0x42 s 0x9a"
try:
status, output = commands.getstatusoutput(cmd)
lines = output.split('\n')
hn = re.findall(r'\w+', lines[-1])
version = int(hn[1], 16)
if version == 0x24: #Find IR3570A
ret = disable_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3570_check() e:" + str(e)
return -1
return ret
class OnlPlatform_x86_64_accton_as7726_32x_r0(OnlPlatformAccton,
OnlPlatformPortConfig_48x25_6x100):
@@ -98,7 +134,8 @@ class OnlPlatform_x86_64_accton_as7726_32x_r0(OnlPlatformAccton,
self.new_i2c_device('optoe1', 0x50, port-18)
subprocess.call('echo port%d > /sys/bus/i2c/devices/%d-0050/port_name' % (port, port-18), shell=True)
self.new_i2c_device('24c02', 0x56, 0)
ir3570_check()
return True

View File

@@ -33,7 +33,7 @@
#define CHASSIS_FAN_COUNT (CHASSIS_TOTAL_FAN_COUNT - CHASSIS_PSU_COUNT)
#define CHASSIS_THERMAL_COUNT (CHASSIS_TOTAL_THERMAL_COUNT - CHASSIS_PSU_COUNT)
#define CPLD_COUNT 4
#define SFP_PORT_COUNT 32
#define SFP_PORT_COUNT 64
#define CHASSIS_LED_COUNT 5
#endif /* __PLATFORM_LIB_H__ */