platform/x86: Mellanox new system classes and new features
Subsystems (2)
v2 cover platform/x86: Mellanox new system classes and new features
The patchset adds new features for the existing Mellanox systems and introduces two new system classes.
Patch #1 contains cosmetic changes.
Patch #2 fixes wrong attribute name in documentation.
Patch #3 adds missed attribute name in documentation.
Patch #4 adds more definitions for system attributes Patches #5 extends documentation.
Patches #6-#7 introduce new system class for the systems equipped with Spectrum 1 (32x100GbE Ethernet switch) device and Switch-IB/Switch-IB2 devices (36x100Gbe InfiniBand switch).
Patches #7-#8 add support for new group capability register Patches #10 introduces new system class for the systems equipped with new switch device Spectrum 3 (32x400GbE/64x200G/128x100G Ethernet switch).
Vadim Pasternak (10):
platform/x86: mlx-platform: Cosmetic changes Documentation/ABI: Fix documentation inconsistency for mlxreg-io sysfs
interfaces
Documentation/ABI: Add missed attribute for mlxreg-io sysfs interfaces platform/x86: mlx-platform: Add more definitions for system attributes Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces platform/x86: mlx-platform: Set system mux configuration based on
system type
platform/x86: mlx-platform: Add support for new system type platform/x86: mlx-platform: Add support for new capability register platform/mellanox: mlxreg-hotplug: Add support for new capability
register
platform/x86: mlx-platform: Add support for next generation systems
Documentation/ABI/stable/sysfs-driver-mlxreg-io | 83 +++- drivers/platform/mellanox/mlxreg-hotplug.c | 14 + drivers/platform/x86/mlx-platform.c | 564 +++++++++++++++++++++++- include/linux/platform_data/mlxreg.h | 2 + 4 files changed, 643 insertions(+), 20 deletions(-)
Signature · 1 line
2.11.0
PATCH v2 1/10 platform/x86: mlx-platform: Cosmetic changes
Remove redundant semicolons at the end of few functions.
---
v1-v2:
Comments pointed out by Andy:
- Move this patch to be the first in series.
--- drivers/platform/x86/mlx-platform.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/platform/x86/mlx-platform.c +5 -5
@@ -1834,7 +1834,7 @@ static int __init mlxplat_dmi_default_matched(const struct dmi_system_id *dmi) mlxplat_wd_data[0 ] = &mlxplat_mlxcpld_wd_set_type1[0 ];return 1 ; -}; +}static int __init mlxplat_dmi_msn21xx_matched (const struct dmi_system_id *dmi) {
@@ -1853,7 +1853,7 @@ static int __init mlxplat_dmi_msn21xx_matched(const struct dmi_system_id *dmi) mlxplat_wd_data[0 ] = &mlxplat_mlxcpld_wd_set_type1[0 ];return 1 ; -}; +}static int __init mlxplat_dmi_msn274x_matched (const struct dmi_system_id *dmi) {
@@ -1872,7 +1872,7 @@ static int __init mlxplat_dmi_msn274x_matched(const struct dmi_system_id *dmi) mlxplat_wd_data[0 ] = &mlxplat_mlxcpld_wd_set_type1[0 ];return 1 ; -}; +}static int __init mlxplat_dmi_msn201x_matched (const struct dmi_system_id *dmi) {
@@ -1891,7 +1891,7 @@ static int __init mlxplat_dmi_msn201x_matched(const struct dmi_system_id *dmi) mlxplat_wd_data[0 ] = &mlxplat_mlxcpld_wd_set_type1[0 ];return 1 ; -}; +}static int __init mlxplat_dmi_qmb7xx_matched (const struct dmi_system_id *dmi) {
@@ -1914,7 +1914,7 @@ static int __init mlxplat_dmi_qmb7xx_matched(const struct dmi_system_id *dmi) mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config_ng;return 1 ; -}; +}static const struct dmi_system_id mlxplat_dmi_table[]__initconst = { {
Signature · 1 line
2.11.0
PATCH v2 2/10 Documentation/ABI: Fix documentation inconsistency for mlxreg-io sysfs interfaces
In reply to Vadim PasternakFix attribute name from "jtag_enable", which described twice to "cpld3_version", which is expected to be instead of second appearance of "jtag_enable".
---
v1-v2:
Comments pointed out by Andy:
- Explain that patch fixes documentation inconsistency.
--- Documentation/ABI/stable/sysfs-driver-mlxreg-io | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/ABI/stable/sysfs-driver-mlxreg-io +2 -2
@@ -29,13 +29,13 @@ Description: This file shows the system fans direction: The files are read only. -What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/jtag_enable +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld3_version Date: November 2018 KernelVersion: 5.0 Contact: Vadim Pasternak <vadimpmellanox.com> Description: These files show with which CPLD versions have been burned - on LED board. + on LED or Gearbox board. The files are read only.
Signature · 1 line
2.11.0
PATCH v2 3/10 Documentation/ABI: Add missed attribute for mlxreg-io sysfs interfaces
In reply to Vadim PasternakAdd missed "cpld4_version" attribute.
--- Documentation/ABI/stable/sysfs-driver-mlxreg-io | 10 ++++++++++ 1 file changed, 10 insertions(+)
Documentation/ABI/stable/sysfs-driver-mlxreg-io +10 -0
@@ -121,6 +121,16 @@ Description: These files show the system reset cause, as following: ComEx The files are read only. +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld4_version + +Date: November 2018 +KernelVersion: 5.0 +Contact: Vadim Pasternak <vadimpmellanox.com> +Description: These files show with which CPLD versions have been burned + on LED board. + + The files are read only. + Date: June 2019 KernelVersion: 5.3 Contact: Vadim Pasternak <vadimpmellanox.com>
Signature · 1 line
2.11.0
Re: [PATCH platform-next v2 03/10] Documentation/ABI: Add missed attribute for mlxreg-io sysfs interfaces
Quoted 3 lines · Vadim Pasternak
Add missed "
cpld4_version" attribute.
Fixes tag?
Also see below.
...
Documentation/ABI/stable/sysfs-driver-mlxreg-io Description: These files show the system reset cause, as following: ComEx · line 125
Quoted 3 lines
Documentation/ABI/stable/sysfs-driver-mlxreg-io +2
-0+What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld4_version +
Can we get some consistency here, i.e. drop blank lines between What and Date everywhere?
(Separate patch)
Documentation/ABI/stable/sysfs-driver-mlxreg-io Description: These files show the system reset cause, as following: ComEx · line 133
Quoted 8 lines
Documentation/ABI/stable/sysfs-driver-mlxreg-io +8
-0+Date: November 2018 +KernelVersion: 5.0 +Contact: Vadim Pasternak <vadimpmellanox.com> +Description: These files show with which CPLD versions have been burned + on LED board. + + The files are read only. +
...following by the starting each section with What keyword.
(Separate patch)
Quoted 3 lines
Date: June 2019
KernelVersion: 5.3
Contact: Vadim Pasternak <vadimpmellanox.com>
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 4/10 platform/x86: mlx-platform: Add more definitions for system attributes
In reply to Vadim PasternakAdd new attributes for "next-generation" type systems:
- Reset cause indication, when system reset has been caused by the platform reset request through CPLD, by AC power failure, by software power off request through CPLD. by signal asserted by SOC through ACPI register. It introduces more reset causes, which can be monitored after the reboots.
- Setting and removing system VPD (EEPROM) hardware write protection. It allows to access VPD during production cycle and prevents VPD corruption on system in field.
- Voltage regulator devices configuration update status and version. It allows to monitor configuration update status and current active version for such sort of devices.
- PCIe ASIC reset disable - when set ASIC will go down upon PCIe root complex reset, otherwise ASIC will stay up during PCIe root complex reset.
- System configuration Ids to provide system static topology identification, like system's static I2C topology, number and type of FPGA devices within the system and so on.
Add the existing attribute for "iio" bank selection for system type "msn21xx".
All the above attributes are exposed through "sysfs" by "mlxreg-io" driver.
--- drivers/platform/x86/mlx-platform.c | 84 +++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+)
drivers/platform/x86/mlx-platform.c +84 -0
@@ -35,6 +35,8 @@#define MLXPLAT_CPLD_LPC_REG_LED4_OFFSET 0x23#define MLXPLAT_CPLD_LPC_REG_LED5_OFFSET 0x24#define MLXPLAT_CPLD_LPC_REG_FAN_DIRECTION 0x2a +#define MLXPLAT_CPLD_LPC_REG_GP0_RO_OFFSET 0x2b +#define MLXPLAT_CPLD_LPC_REG_GP0_OFFSET 0x2e#define MLXPLAT_CPLD_LPC_REG_GP1_OFFSET 0x30#define MLXPLAT_CPLD_LPC_REG_WP1_OFFSET 0x31#define MLXPLAT_CPLD_LPC_REG_GP2_OFFSET 0x32
@@ -68,6 +70,7 @@#define MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET 0xd1#define MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET 0xd2#define MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET 0xd3 +#define MLXPLAT_CPLD_LPC_REG_UFM_VERSION_OFFSET 0xe2#define MLXPLAT_CPLD_LPC_REG_PWM1_OFFSET 0xe3#define MLXPLAT_CPLD_LPC_REG_TACHO1_OFFSET 0xe4#define MLXPLAT_CPLD_LPC_REG_TACHO2_OFFSET 0xe5
@@ -85,6 +88,8 @@#define MLXPLAT_CPLD_LPC_REG_FAN_CAP2_OFFSET 0xf6#define MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET 0xf7#define MLXPLAT_CPLD_LPC_REG_TACHO_SPEED_OFFSET 0xf8 +#define MLXPLAT_CPLD_LPC_REG_CONFIG1_OFFSET 0xfb +#define MLXPLAT_CPLD_LPC_REG_CONFIG2_OFFSET 0xfc#define MLXPLAT_CPLD_LPC_IO_RANGE 0x100#define MLXPLAT_CPLD_LPC_I2C_CH1_OFF 0xdb#define MLXPLAT_CPLD_LPC_I2C_CH2_OFF 0xda
@@ -117,6 +122,7 @@#define MLXPLAT_CPLD_FAN_NG_MASK GENMASK(5, 0)#define MLXPLAT_CPLD_LED_LO_NIBBLE_MASK GENMASK(7, 4)#define MLXPLAT_CPLD_LED_HI_NIBBLE_MASK GENMASK(3, 0) +#define MLXPLAT_CPLD_VOLTREG_UPD_MASK GENMASK(5, 4)/* Default I2C parent bus number */ #define MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR 1
@@ -1157,6 +1163,12 @@ static struct mlxreg_core_data mlxplat_mlxcpld_msn21xx_regs_io_data[] = { .mode = 0200, }, { + .label = "select_iio", + .reg = MLXPLAT_CPLD_LPC_REG_GP2_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(6), + .mode = 0644, + }, + { .label = "asic_health", .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, .mask = MLXPLAT_CPLD_ASIC_MASK,
@@ -1245,6 +1257,18 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_regs_io_data[] = { .mode = 0444, }, { + .label = "reset_platform", + .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE1_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(4), + .mode = 0444, + }, + { + .label = "reset_soc", + .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE1_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(5), + .mode = 0444, + }, + { .label = "reset_comex_wd", .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE1_OFFSET, .mask = GENMASK(7, 0) & ~BIT(6),
@@ -1263,6 +1287,12 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_regs_io_data[] = { .mode = 0444, }, { + .label = "reset_sw_pwr_off", + .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(2), + .mode = 0444, + }, + { .label = "reset_comex_thermal", .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET, .mask = GENMASK(7, 0) & ~BIT(3),
@@ -1275,6 +1305,12 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_regs_io_data[] = { .mode = 0444, }, { + .label = "reset_ac_pwr_fail", + .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(6), + .mode = 0444, + }, + { .label = "psu1_on", .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, .mask = GENMASK(7, 0) & ~BIT(0),
@@ -1317,6 +1353,43 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_regs_io_data[] = { .bit = GENMASK(7, 0), .mode = 0444, }, + { + .label = "voltreg_update_status", + .reg = MLXPLAT_CPLD_LPC_REG_GP0_RO_OFFSET, + .mask = MLXPLAT_CPLD_VOLTREG_UPD_MASK, + .bit = 5, + .mode = 0444, + }, + { + .label = "vpd_wp", + .reg = MLXPLAT_CPLD_LPC_REG_GP0_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(3), + .mode = 0644, + }, + { + .label = "pcie_asic_reset_dis", + .reg = MLXPLAT_CPLD_LPC_REG_GP0_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(4), + .mode = 0644, + }, + { + .label = "config1", + .reg = MLXPLAT_CPLD_LPC_REG_CONFIG1_OFFSET, + .bit = GENMASK(7, 0), + .mode = 0444, + }, + { + .label = "config2", + .reg = MLXPLAT_CPLD_LPC_REG_CONFIG2_OFFSET, + .bit = GENMASK(7, 0), + .mode = 0444, + }, + { + .label = "ufm_version", + .reg = MLXPLAT_CPLD_LPC_REG_UFM_VERSION_OFFSET, + .bit = GENMASK(7, 0), + .mode = 0444, + }, }; static struct mlxreg_core_platform_data mlxplat_default_ng_regs_io_data = {
@@ -1575,6 +1648,7 @@ static bool mlxplat_mlxcpld_writeable_reg(struct device *dev, unsigned int reg)case MLXPLAT_CPLD_LPC_REG_LED3_OFFSET :case MLXPLAT_CPLD_LPC_REG_LED4_OFFSET :case MLXPLAT_CPLD_LPC_REG_LED5_OFFSET : +case MLXPLAT_CPLD_LPC_REG_GP0_OFFSET :case MLXPLAT_CPLD_LPC_REG_GP1_OFFSET :case MLXPLAT_CPLD_LPC_REG_WP1_OFFSET :case MLXPLAT_CPLD_LPC_REG_GP2_OFFSET :
@@ -1621,6 +1695,8 @@ static bool mlxplat_mlxcpld_readable_reg(struct device *dev, unsigned int reg)case MLXPLAT_CPLD_LPC_REG_LED4_OFFSET :case MLXPLAT_CPLD_LPC_REG_LED5_OFFSET :case MLXPLAT_CPLD_LPC_REG_FAN_DIRECTION : +case MLXPLAT_CPLD_LPC_REG_GP0_RO_OFFSET : +case MLXPLAT_CPLD_LPC_REG_GP0_OFFSET :case MLXPLAT_CPLD_LPC_REG_GP1_OFFSET :case MLXPLAT_CPLD_LPC_REG_WP1_OFFSET :case MLXPLAT_CPLD_LPC_REG_GP2_OFFSET :
@@ -1671,6 +1747,9 @@ static bool mlxplat_mlxcpld_readable_reg(struct device *dev, unsigned int reg)case MLXPLAT_CPLD_LPC_REG_FAN_CAP2_OFFSET :case MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET :case MLXPLAT_CPLD_LPC_REG_TACHO_SPEED_OFFSET : +case MLXPLAT_CPLD_LPC_REG_CONFIG1_OFFSET : +case MLXPLAT_CPLD_LPC_REG_CONFIG2_OFFSET : +case MLXPLAT_CPLD_LPC_REG_UFM_VERSION_OFFSET :return true; }return false;
@@ -1692,6 +1771,8 @@ static bool mlxplat_mlxcpld_volatile_reg(struct device *dev, unsigned int reg)case MLXPLAT_CPLD_LPC_REG_LED4_OFFSET :case MLXPLAT_CPLD_LPC_REG_LED5_OFFSET :case MLXPLAT_CPLD_LPC_REG_FAN_DIRECTION : +case MLXPLAT_CPLD_LPC_REG_GP0_RO_OFFSET : +case MLXPLAT_CPLD_LPC_REG_GP0_OFFSET :case MLXPLAT_CPLD_LPC_REG_GP1_OFFSET :case MLXPLAT_CPLD_LPC_REG_GP2_OFFSET :case MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET :
@@ -1734,6 +1815,9 @@ static bool mlxplat_mlxcpld_volatile_reg(struct device *dev, unsigned int reg)case MLXPLAT_CPLD_LPC_REG_FAN_CAP2_OFFSET :case MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET :case MLXPLAT_CPLD_LPC_REG_TACHO_SPEED_OFFSET : +case MLXPLAT_CPLD_LPC_REG_CONFIG1_OFFSET : +case MLXPLAT_CPLD_LPC_REG_CONFIG2_OFFSET : +case MLXPLAT_CPLD_LPC_REG_UFM_VERSION_OFFSET :return true; }return false;
Signature · 1 line
2.11.0
PATCH v2 5/10 Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces
In reply to Vadim PasternakAdd documentation for the new attributes for:
- Exposing reset causes types asserted by: platform reset, SoC reset, AC power failure, software power off request.
- Setting and removing system VPD (EEPROM) hardware write protection.
- Voltage regulator devices configuration update status and firmware version.
- Setting PCIe ASIC reset to disable or enable state during PCIe root complex reset.
- System static topology identification, like system's static I2C topology, number and type of FPGA devices within the system and so on.
---
v1-v2:
Changes added by Vadim:
- Change "Date" to "January 2020".
--- Documentation/ABI/stable/sysfs-driver-mlxreg-io | 69 +++++++++++++++++++++++++ 1 file changed, 69 insertions(+)
Documentation/ABI/stable/sysfs-driver-mlxreg-io +69 -0
@@ -150,3 +150,72 @@ What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_from_asic What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_reload_bios What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_sff_wd What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_swb_wd + +Date: January 2020 +KernelVersion: 5.6 +Contact: Vadim Pasternak <vadimpmellanox.com> +Description: These files show system static topology identification + like system's static I2C topology, number and type of FPGA + devices within the system and so on. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/config1 +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/config2 + + The files are read only. + +Date: January 2020 +KernelVersion: 5.6 +Contact: Vadim Pasternak <vadimpmellanox.com> +Description: These files show the system reset causes, as following: reset + due to AC power failure, reset invoked from software by + assertion reset signal through CPLD. reset caused by signal + asserted by SOC through ACPI register, reset invoked from + software by assertion power off signal through CPLD. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_ac_pwr_fail +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_platform +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_soc +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_sw_pwr_off + + The files are read only. + +Date: January 2020 +KernelVersion: 5.6 +Contact: Vadim Pasternak <vadimpmellanox.com> +Description: This file allows to retain ASIC up during PCIe root complex + reset, when attribute is set 1. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/pcie_asic_reset_dis + + The file is read/write. + +Date: January 2020 +KernelVersion: 5.6 +Contact: Vadim Pasternak <vadimpmellanox.com> +Description: This file allows to overwrite system VPD hardware wrtie + protection when attribute is set 1. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/vpd_wp + + The file is read/write. + +Date: January 2020 +KernelVersion: 5.6 +Contact: Vadim Pasternak <vadimpmellanox.com> +Description: This file exposes the configuration update status of burnable + voltage regulator devices. The status values are as following: + 0 - OK; 1 - CRC failure; 2 = I2C failure; 3 - in progress. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/voltreg_update_status + + The file is read only. + +Date: January 2020 +KernelVersion: 5.6 +Contact: Vadim Pasternak <vadimpmellanox.com> +Description: This file exposes the firmware version of burnable voltage + regulator devices. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ufm_version + + The file is read only.
Signature · 1 line
2.11.0
Re: [PATCH platform-next v2 05/10] Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces
Quoted 12 lines · Vadim Pasternak
Add documentation for the new attributes for:
- Exposing reset causes types asserted by: platform reset, SoC reset, AC power failure, software power off request.
- Setting and removing system VPD (EEPROM) hardware write protection.
- Voltage regulator devices configuration update status and firmware version.
- Setting PCIe ASIC reset to disable or enable state during PCIe root complex reset.
- System static topology identification, like system's static I2C topology, number and type of FPGA devices within the system and so on.
Same comments as per previous patch (style related)
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 6/10 platform/x86: mlx-platform: Set system mux configuration based on system type
In reply to Vadim PasternakSeparate assignment for systems mux configuration based on system type, instead of setting the same configuration for the all.
The motivation is to allow introduction of new systems types with the different mux topology.
---
v1-v2:
Comments pointed out by Andy:
Drop semicolon after mlxplat_dmi_qmb7xx_matched().
--- drivers/platform/x86/mlx-platform.c | 44 +++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 12 deletions(-)
drivers/platform/x86/mlx-platform.c +32 -12
@@ -219,7 +219,7 @@ static const int mlxplat_default_channels[][MLXPLAT_CPLD_GRP_CHNL_NUM] = {static const int mlxplat_msn21xx_channels[] = {1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 };/* Platform mux data */ -static struct i2c_mux_reg_platform_data mlxplat_mux_data[] = { +static struct i2c_mux_reg_platform_data mlxplat_default_mux_data[] = { { .parent =1 , .base_nr =MLXPLAT_CPLD_CH1 ,
@@ -239,6 +239,11 @@ static struct i2c_mux_reg_platform_data mlxplat_mux_data[] = { }; +/* Platform mux configuration variables */ +static int mlxplat_max_adap_num; +static int mlxplat_mux_num; +static struct i2c_mux_reg_platform_data *mlxplat_mux_data; +/* Platform hotplug devices */ static struct i2c_board_info mlxplat_mlxcpld_psu[] = { {
@@ -1905,7 +1910,10 @@ static int __init mlxplat_dmi_default_matched(const struct dmi_system_id *dmi) {int i; -for (i =0 ; i <ARRAY_SIZE (mlxplat_mux_data); i++) { + mlxplat_max_adap_num =MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM ; + mlxplat_mux_num =ARRAY_SIZE (mlxplat_default_mux_data); + mlxplat_mux_data = mlxplat_default_mux_data; +for (i =0 ; i < mlxplat_mux_num; i++) { mlxplat_mux_data[i].values = mlxplat_default_channels[i]; mlxplat_mux_data[i].n_values =ARRAY_SIZE (mlxplat_default_channels[i]);
@@ -1924,7 +1932,10 @@ static int __init mlxplat_dmi_msn21xx_matched(const struct dmi_system_id *dmi) {int i; -for (i =0 ; i <ARRAY_SIZE (mlxplat_mux_data); i++) { + mlxplat_max_adap_num =MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM ; + mlxplat_mux_num =ARRAY_SIZE (mlxplat_default_mux_data); + mlxplat_mux_data = mlxplat_default_mux_data; +for (i =0 ; i < mlxplat_mux_num; i++) { mlxplat_mux_data[i].values = mlxplat_msn21xx_channels; mlxplat_mux_data[i].n_values =ARRAY_SIZE (mlxplat_msn21xx_channels);
@@ -1943,7 +1954,10 @@ static int __init mlxplat_dmi_msn274x_matched(const struct dmi_system_id *dmi) {int i; -for (i =0 ; i <ARRAY_SIZE (mlxplat_mux_data); i++) { + mlxplat_max_adap_num =MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM ; + mlxplat_mux_num =ARRAY_SIZE (mlxplat_default_mux_data); + mlxplat_mux_data = mlxplat_default_mux_data; +for (i =0 ; i < mlxplat_mux_num; i++) { mlxplat_mux_data[i].values = mlxplat_msn21xx_channels; mlxplat_mux_data[i].n_values =ARRAY_SIZE (mlxplat_msn21xx_channels);
@@ -1962,7 +1976,10 @@ static int __init mlxplat_dmi_msn201x_matched(const struct dmi_system_id *dmi) {int i; -for (i =0 ; i <ARRAY_SIZE (mlxplat_mux_data); i++) { + mlxplat_max_adap_num =MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM ; + mlxplat_mux_num =ARRAY_SIZE (mlxplat_default_mux_data); + mlxplat_mux_data = mlxplat_default_mux_data; +for (i =0 ; i < mlxplat_mux_num; i++) { mlxplat_mux_data[i].values = mlxplat_msn21xx_channels; mlxplat_mux_data[i].n_values =ARRAY_SIZE (mlxplat_msn21xx_channels);
@@ -1981,7 +1998,10 @@ static int __init mlxplat_dmi_qmb7xx_matched(const struct dmi_system_id *dmi) {int i; -for (i =0 ; i <ARRAY_SIZE (mlxplat_mux_data); i++) { + mlxplat_max_adap_num =MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM ; + mlxplat_mux_num =ARRAY_SIZE (mlxplat_default_mux_data); + mlxplat_mux_data = mlxplat_default_mux_data; +for (i =0 ; i < mlxplat_mux_num; i++) { mlxplat_mux_data[i].values = mlxplat_msn21xx_channels; mlxplat_mux_data[i].n_values =ARRAY_SIZE (mlxplat_msn21xx_channels);
@@ -2127,7 +2147,7 @@ static int mlxplat_mlxcpld_verify_bus_topology(int *nr)/* Scan adapters from expected id to verify it is free. */ *nr =MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR ;for (i =MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR ; i < -MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM ; i++) { + mlxplat_max_adap_num; i++) { search_adap =i2c_get_adapter (i);if (search_adap) {i2c_put_adapter (search_adap);
@@ -2141,12 +2161,12 @@ static int mlxplat_mlxcpld_verify_bus_topology(int *nr) }/* Return with error if free id for adapter is not found. */ -if (i ==MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM ) +if (i == mlxplat_max_adap_num)return -ENODEV ;/* Shift adapter ids, since expected parent adapter is not free. */ *nr = i; -for (i =0 ; i <ARRAY_SIZE (mlxplat_mux_data); i++) { +for (i =0 ; i < mlxplat_mux_num; i++) { shift = *nr - mlxplat_mux_data[i].parent; mlxplat_mux_data[i].parent = *nr; mlxplat_mux_data[i].base_nr += shift;
@@ -2202,7 +2222,7 @@ static int __init mlxplat_init(void)if (nr <0 ) goto fail_alloc; - nr = (nr ==MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM ) ?-1 : nr; + nr = (nr == mlxplat_max_adap_num) ?-1 : nr;if (mlxplat_i2c) mlxplat_i2c->regmap = priv->regmap; priv->pdev_i2c = platform_device_register_resndata(
@@ -2215,7 +2235,7 @@ static int __init mlxplat_init(void) goto fail_alloc; } -for (i =0 ; i <ARRAY_SIZE (mlxplat_mux_data); i++) { +for (i =0 ; i < mlxplat_mux_num; i++) { priv->pdev_mux[i] = platform_device_register_resndata( &priv->pdev_i2c->dev, "i2c-mux-reg", i, NULL,
@@ -2349,7 +2369,7 @@ static void __exit mlxplat_exit(void)platform_device_unregister (priv->pdev_led);platform_device_unregister (priv->pdev_hotplug); -for (i =ARRAY_SIZE (mlxplat_mux_data) -1 ; i >=0 ; i--) +for (i = mlxplat_mux_num -1 ; i >=0 ; i--)platform_device_unregister (priv->pdev_mux[i]);platform_device_unregister (priv->pdev_i2c);
Signature · 1 line
2.11.0
PATCH v2 7/10 platform/x86: mlx-platform: Add support for new system type
In reply to Vadim PasternakAdd support for new Mellanox system types of basic class VMOD0009, containing Mellanox systems equipped with the switch devices Spectrum 1 (32x100GbE Ethernet switch) and Switch-IB/Switch-IB2 (36x100Gbe InfiniBand switch).
These are the Top of the Rack system, equipped with Mellanox Comex card.
--- drivers/platform/x86/mlx-platform.c | 239 +++++++++++++++++++++++++++++++++++- 1 file changed, 238 insertions(+), 1 deletion(-)
drivers/platform/x86/mlx-platform.c +238 -1
@@ -48,6 +48,8 @@#define MLXPLAT_CPLD_LPC_REG_AGGRLO_MASK_OFFSET 0x41#define MLXPLAT_CPLD_LPC_REG_AGGRCO_OFFSET 0x42#define MLXPLAT_CPLD_LPC_REG_AGGRCO_MASK_OFFSET 0x43 +#define MLXPLAT_CPLD_LPC_REG_AGGRCX_OFFSET 0x44 +#define MLXPLAT_CPLD_LPC_REG_AGGRCX_MASK_OFFSET 0x45#define MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET 0x50#define MLXPLAT_CPLD_LPC_REG_ASIC_EVENT_OFFSET 0x51#define MLXPLAT_CPLD_LPC_REG_ASIC_MASK_OFFSET 0x52
@@ -93,6 +95,7 @@#define MLXPLAT_CPLD_LPC_IO_RANGE 0x100#define MLXPLAT_CPLD_LPC_I2C_CH1_OFF 0xdb#define MLXPLAT_CPLD_LPC_I2C_CH2_OFF 0xda +#define MLXPLAT_CPLD_LPC_I2C_CH3_OFF 0xdc#define MLXPLAT_CPLD_LPC_PIO_OFFSET 0x10000UL#define MLXPLAT_CPLD_LPC_REG1 ((MLXPLAT_CPLD_LPC_REG_BASE_ADRR + \
@@ -101,6 +104,9 @@#define MLXPLAT_CPLD_LPC_REG2 ((MLXPLAT_CPLD_LPC_REG_BASE_ADRR + \ MLXPLAT_CPLD_LPC_I2C_CH2_OFF) | \ MLXPLAT_CPLD_LPC_PIO_OFFSET) +#define MLXPLAT_CPLD_LPC_REG3 ((MLXPLAT_CPLD_LPC_REG_BASE_ADRR + \ + MLXPLAT_CPLD_LPC_I2C_CH3_OFF) | \ + MLXPLAT_CPLD_LPC_PIO_OFFSET)/* Masks for aggregation, psu, pwr and fan event in CPLD related registers. */ #define MLXPLAT_CPLD_AGGR_ASIC_MASK_DEF 0x04
@@ -124,11 +130,18 @@#define MLXPLAT_CPLD_LED_HI_NIBBLE_MASK GENMASK(3, 0)#define MLXPLAT_CPLD_VOLTREG_UPD_MASK GENMASK(5, 4) +/* Masks for aggregation for comex carriers */ +#define MLXPLAT_CPLD_AGGR_MASK_CARRIER BIT(1) +#define MLXPLAT_CPLD_AGGR_MASK_CARR_DEF (MLXPLAT_CPLD_AGGR_ASIC_MASK_DEF | \ + MLXPLAT_CPLD_AGGR_MASK_CARRIER) +#define MLXPLAT_CPLD_LOW_AGGRCX_MASK 0xc1 +/* Default I2C parent bus number */ #define MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR 1/* Maximum number of possible physical buses equipped on system */ #define MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM 16 +#define MLXPLAT_CPLD_MAX_PHYS_EXT_ADAPTER_NUM 24/* Number of channels in group */ #define MLXPLAT_CPLD_GRP_CHNL_NUM 8
@@ -136,9 +149,10 @@/* Start channel numbers */ #define MLXPLAT_CPLD_CH1 2#define MLXPLAT_CPLD_CH2 10 +#define MLXPLAT_CPLD_CH3 18/* Number of LPC attached MUX platform devices */ -#define MLXPLAT_CPLD_LPC_MUX_DEVS 2 +#define MLXPLAT_CPLD_LPC_MUX_DEVS 3/* Hotplug devices adapter numbers */ #define MLXPLAT_CPLD_NR_NONE -1
@@ -244,6 +258,35 @@ static int mlxplat_max_adap_num;static int mlxplat_mux_num;static struct i2c_mux_reg_platform_data *mlxplat_mux_data; +/* Platform extended mux data */ +static struct i2c_mux_reg_platform_data mlxplat_extended_mux_data[] = { + { + .parent =1 , + .base_nr =MLXPLAT_CPLD_CH1 , + .write_only =1 , + .reg = (void __iomem *)MLXPLAT_CPLD_LPC_REG1 , + .reg_size =1 , + .idle_in_use =1 , + }, + { + .parent =1 , + .base_nr =MLXPLAT_CPLD_CH2 , + .write_only =1 , + .reg = (void __iomem *)MLXPLAT_CPLD_LPC_REG3 , + .reg_size =1 , + .idle_in_use =1 , + }, + { + .parent =1 , + .base_nr =MLXPLAT_CPLD_CH3 , + .write_only =1 , + .reg = (void __iomem *)MLXPLAT_CPLD_LPC_REG2 , + .reg_size =1 , + .idle_in_use =1 , + }, + +}; +/* Platform hotplug devices */ static struct i2c_board_info mlxplat_mlxcpld_psu[] = { {
@@ -287,6 +330,22 @@ static struct i2c_board_info mlxplat_mlxcpld_fan[] = { }, }; +/* Platform hotplug comex carrier system family data */ +static struct mlxreg_core_data mlxplat_mlxcpld_comex_psu_items_data[] = { + { + .label ="psu1" , + .reg =MLXPLAT_CPLD_LPC_REG_PSU_OFFSET , + .mask =BIT (0 ), + .hpdev.nr =MLXPLAT_CPLD_NR_NONE , + }, + { + .label ="psu2" , + .reg =MLXPLAT_CPLD_LPC_REG_PSU_OFFSET , + .mask =BIT (1 ), + .hpdev.nr =MLXPLAT_CPLD_NR_NONE , + }, +}; +/* Platform hotplug default data */ static struct mlxreg_core_data mlxplat_mlxcpld_default_psu_items_data[] = { {
@@ -401,6 +460,45 @@ static struct mlxreg_core_item mlxplat_mlxcpld_default_items[] = { }, }; +static struct mlxreg_core_item mlxplat_mlxcpld_comex_items[] = { + { + .data = mlxplat_mlxcpld_comex_psu_items_data, + .aggr_mask =MLXPLAT_CPLD_AGGR_MASK_CARRIER , + .reg =MLXPLAT_CPLD_LPC_REG_PSU_OFFSET , + .mask =MLXPLAT_CPLD_PSU_MASK , + .count =ARRAY_SIZE (mlxplat_mlxcpld_psu), + .inversed =1 , + .health = false, + }, + { + .data = mlxplat_mlxcpld_default_pwr_items_data, + .aggr_mask =MLXPLAT_CPLD_AGGR_MASK_CARRIER , + .reg =MLXPLAT_CPLD_LPC_REG_PWR_OFFSET , + .mask =MLXPLAT_CPLD_PWR_MASK , + .count =ARRAY_SIZE (mlxplat_mlxcpld_pwr), + .inversed =0 , + .health = false, + }, + { + .data = mlxplat_mlxcpld_default_fan_items_data, + .aggr_mask =MLXPLAT_CPLD_AGGR_MASK_CARRIER , + .reg =MLXPLAT_CPLD_LPC_REG_FAN_OFFSET , + .mask =MLXPLAT_CPLD_FAN_MASK , + .count =ARRAY_SIZE (mlxplat_mlxcpld_fan), + .inversed =1 , + .health = false, + }, + { + .data = mlxplat_mlxcpld_default_asic_items_data, + .aggr_mask =MLXPLAT_CPLD_AGGR_ASIC_MASK_DEF , + .reg =MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET , + .mask =MLXPLAT_CPLD_ASIC_MASK , + .count =ARRAY_SIZE (mlxplat_mlxcpld_default_asic_items_data), + .inversed =0 , + .health = true, + }, +}; +static struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_default_data = { .items = mlxplat_mlxcpld_default_items,
@@ -411,6 +509,16 @@ struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_default_data = { .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW, }; +static +struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_comex_data = { + .items = mlxplat_mlxcpld_comex_items, + .counter =ARRAY_SIZE (mlxplat_mlxcpld_comex_items), + .cell =MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET , + .mask =MLXPLAT_CPLD_AGGR_MASK_CARR_DEF , + .cell_low =MLXPLAT_CPLD_LPC_REG_AGGRCX_OFFSET , + .mask_low =MLXPLAT_CPLD_LOW_AGGRCX_MASK , +}; +static struct mlxreg_core_data mlxplat_mlxcpld_msn21xx_pwr_items_data[] = { { .label ="pwr1" ,
@@ -975,6 +1083,80 @@ static struct mlxreg_core_platform_data mlxplat_default_ng_led_data = { .counter = ARRAY_SIZE(mlxplat_mlxcpld_default_ng_led_data), }; +/* Platform led for Comex based 100GbE systems */ +static struct mlxreg_core_data mlxplat_mlxcpld_comex_100G_led_data[] = { + { + .label ="status:green" , + .reg =MLXPLAT_CPLD_LPC_REG_LED1_OFFSET , + .mask =MLXPLAT_CPLD_LED_LO_NIBBLE_MASK , + }, + { + .label ="status:red" , + .reg =MLXPLAT_CPLD_LPC_REG_LED1_OFFSET , + .mask =MLXPLAT_CPLD_LED_LO_NIBBLE_MASK + }, + { + .label ="psu:green" , + .reg =MLXPLAT_CPLD_LPC_REG_LED1_OFFSET , + .mask =MLXPLAT_CPLD_LED_HI_NIBBLE_MASK , + }, + { + .label ="psu:red" , + .reg =MLXPLAT_CPLD_LPC_REG_LED1_OFFSET , + .mask =MLXPLAT_CPLD_LED_HI_NIBBLE_MASK , + }, + { + .label ="fan1:green" , + .reg =MLXPLAT_CPLD_LPC_REG_LED2_OFFSET , + .mask =MLXPLAT_CPLD_LED_LO_NIBBLE_MASK , + }, + { + .label ="fan1:red" , + .reg =MLXPLAT_CPLD_LPC_REG_LED2_OFFSET , + .mask =MLXPLAT_CPLD_LED_LO_NIBBLE_MASK , + }, + { + .label ="fan2:green" , + .reg =MLXPLAT_CPLD_LPC_REG_LED2_OFFSET , + .mask =MLXPLAT_CPLD_LED_HI_NIBBLE_MASK , + }, + { + .label ="fan2:red" , + .reg =MLXPLAT_CPLD_LPC_REG_LED2_OFFSET , + .mask =MLXPLAT_CPLD_LED_HI_NIBBLE_MASK , + }, + { + .label ="fan3:green" , + .reg =MLXPLAT_CPLD_LPC_REG_LED3_OFFSET , + .mask =MLXPLAT_CPLD_LED_LO_NIBBLE_MASK , + }, + { + .label ="fan3:red" , + .reg =MLXPLAT_CPLD_LPC_REG_LED3_OFFSET , + .mask =MLXPLAT_CPLD_LED_LO_NIBBLE_MASK , + }, + { + .label ="fan4:green" , + .reg =MLXPLAT_CPLD_LPC_REG_LED3_OFFSET , + .mask =MLXPLAT_CPLD_LED_HI_NIBBLE_MASK , + }, + { + .label ="fan4:red" , + .reg =MLXPLAT_CPLD_LPC_REG_LED3_OFFSET , + .mask =MLXPLAT_CPLD_LED_HI_NIBBLE_MASK , + }, + { + .label ="uid:blue" , + .reg =MLXPLAT_CPLD_LPC_REG_LED5_OFFSET , + .mask =MLXPLAT_CPLD_LED_LO_NIBBLE_MASK , + }, +}; + +static struct mlxreg_core_platform_data mlxplat_comex_100G_led_data = { + .data = mlxplat_mlxcpld_comex_100G_led_data, + .counter =ARRAY_SIZE (mlxplat_mlxcpld_comex_100G_led_data), +}; +/* Platform register access default */ static struct mlxreg_core_data mlxplat_mlxcpld_default_regs_io_data[] = { {
@@ -1661,6 +1843,7 @@ static bool mlxplat_mlxcpld_writeable_reg(struct device *dev, unsigned int reg)case MLXPLAT_CPLD_LPC_REG_AGGR_MASK_OFFSET :case MLXPLAT_CPLD_LPC_REG_AGGRLO_MASK_OFFSET :case MLXPLAT_CPLD_LPC_REG_AGGRCO_MASK_OFFSET : +case MLXPLAT_CPLD_LPC_REG_AGGRCX_MASK_OFFSET :case MLXPLAT_CPLD_LPC_REG_ASIC_EVENT_OFFSET :case MLXPLAT_CPLD_LPC_REG_ASIC_MASK_OFFSET :case MLXPLAT_CPLD_LPC_REG_PSU_EVENT_OFFSET :
@@ -1712,6 +1895,8 @@ static bool mlxplat_mlxcpld_readable_reg(struct device *dev, unsigned int reg)case MLXPLAT_CPLD_LPC_REG_AGGRLO_MASK_OFFSET :case MLXPLAT_CPLD_LPC_REG_AGGRCO_OFFSET :case MLXPLAT_CPLD_LPC_REG_AGGRCO_MASK_OFFSET : +case MLXPLAT_CPLD_LPC_REG_AGGRCX_OFFSET : +case MLXPLAT_CPLD_LPC_REG_AGGRCX_MASK_OFFSET :case MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET :case MLXPLAT_CPLD_LPC_REG_ASIC_EVENT_OFFSET :case MLXPLAT_CPLD_LPC_REG_ASIC_MASK_OFFSET :
@@ -1786,6 +1971,8 @@ static bool mlxplat_mlxcpld_volatile_reg(struct device *dev, unsigned int reg)case MLXPLAT_CPLD_LPC_REG_AGGRLO_MASK_OFFSET :case MLXPLAT_CPLD_LPC_REG_AGGRCO_OFFSET :case MLXPLAT_CPLD_LPC_REG_AGGRCO_MASK_OFFSET : +case MLXPLAT_CPLD_LPC_REG_AGGRCX_OFFSET : +case MLXPLAT_CPLD_LPC_REG_AGGRCX_MASK_OFFSET :case MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET :case MLXPLAT_CPLD_LPC_REG_ASIC_EVENT_OFFSET :case MLXPLAT_CPLD_LPC_REG_ASIC_MASK_OFFSET :
@@ -1840,6 +2027,12 @@ static const struct reg_default mlxplat_mlxcpld_regmap_ng[] = { { MLXPLAT_CPLD_LPC_REG_WD_CLEAR_WP_OFFSET, 0x00 }, }; +static const struct reg_default mlxplat_mlxcpld_regmap_comex_default[] = { + {MLXPLAT_CPLD_LPC_REG_AGGRCX_MASK_OFFSET , +MLXPLAT_CPLD_LOW_AGGRCX_MASK }, + {MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET ,0x00 }, +}; +struct mlxplat_mlxcpld_regmap_context {void __iomem *base; };
@@ -1892,6 +2085,20 @@ static const struct regmap_config mlxplat_mlxcpld_regmap_config_ng = { .reg_write = mlxplat_mlxcpld_reg_write, }; +static const struct regmap_config mlxplat_mlxcpld_regmap_config_comex = { + .reg_bits =8 , + .val_bits =8 , + .max_register =255 , + .cache_type =REGCACHE_FLAT , + .writeable_reg = mlxplat_mlxcpld_writeable_reg, + .readable_reg = mlxplat_mlxcpld_readable_reg, + .volatile_reg = mlxplat_mlxcpld_volatile_reg, + .reg_defaults = mlxplat_mlxcpld_regmap_comex_default, + .num_reg_defaults =ARRAY_SIZE (mlxplat_mlxcpld_regmap_comex_default), + .reg_read = mlxplat_mlxcpld_reg_read, + .reg_write = mlxplat_mlxcpld_reg_write, +}; +static struct resource mlxplat_mlxcpld_resources[] = { [0 ] =DEFINE_RES_IRQ_NAMED (17 ,"mlxreg-hotplug" ), };
@@ -2020,6 +2227,30 @@ static int __init mlxplat_dmi_qmb7xx_matched(const struct dmi_system_id *dmi)return 1 ; } +static int __init mlxplat_dmi_comex_matched (const struct dmi_system_id *dmi) +{ +int i; + + mlxplat_max_adap_num =MLXPLAT_CPLD_MAX_PHYS_EXT_ADAPTER_NUM ; + mlxplat_mux_num =ARRAY_SIZE (mlxplat_extended_mux_data); + mlxplat_mux_data = mlxplat_extended_mux_data; +for (i =0 ; i < mlxplat_mux_num; i++) { + mlxplat_mux_data[i].values = mlxplat_msn21xx_channels; + mlxplat_mux_data[i].n_values = +ARRAY_SIZE (mlxplat_msn21xx_channels); + } + mlxplat_hotplug = &mlxplat_mlxcpld_comex_data; + mlxplat_hotplug->deferred_nr =MLXPLAT_CPLD_MAX_PHYS_EXT_ADAPTER_NUM ; + mlxplat_led = &mlxplat_comex_100G_led_data; + mlxplat_regs_io = &mlxplat_default_ng_regs_io_data; + mlxplat_fan = &mlxplat_default_fan_data; +for (i =0 ; i <ARRAY_SIZE (mlxplat_mlxcpld_wd_set_type2); i++) + mlxplat_wd_data[i] = &mlxplat_mlxcpld_wd_set_type2[i]; + mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config_comex; + +return 1 ; +} +static const struct dmi_system_id mlxplat_dmi_table[]__initconst = { { .callback = mlxplat_dmi_default_matched,
@@ -2058,6 +2289,12 @@ static const struct dmi_system_id mlxplat_dmi_table[] __initconst = { }, }, { + .callback = mlxplat_dmi_comex_matched, + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "VMOD0009"), + }, + }, + { .callback = mlxplat_dmi_msn274x_matched, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"),
Signature · 1 line
2.11.0
PATCH v2 8/10 platform/x86: mlx-platform: Add support for new capability register
In reply to Vadim PasternakAdd support for capability register, which contains information about the number of PS units equipped on the system and about minimum I2C frequency supported by the all system's I2C devices. Utilization of this register allows to avoid necessity of providing new system description, in case it differs in number of PS units or in minimal I2C frequency.
--- drivers/platform/x86/mlx-platform.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/mlx-platform.c +7 -0
@@ -90,6 +90,7 @@#define MLXPLAT_CPLD_LPC_REG_FAN_CAP2_OFFSET 0xf6#define MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET 0xf7#define MLXPLAT_CPLD_LPC_REG_TACHO_SPEED_OFFSET 0xf8 +#define MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET 0xf9#define MLXPLAT_CPLD_LPC_REG_CONFIG1_OFFSET 0xfb#define MLXPLAT_CPLD_LPC_REG_CONFIG2_OFFSET 0xfc#define MLXPLAT_CPLD_LPC_IO_RANGE 0x100
@@ -123,12 +124,16 @@#define MLXPLAT_CPLD_LOW_AGGR_MASK_I2C BIT(6)#define MLXPLAT_CPLD_PSU_MASK GENMASK(1, 0)#define MLXPLAT_CPLD_PWR_MASK GENMASK(1, 0) +#define MLXPLAT_CPLD_PSU_EXT_MASK GENMASK(3, 0) +#define MLXPLAT_CPLD_PWR_EXT_MASK GENMASK(3, 0)#define MLXPLAT_CPLD_FAN_MASK GENMASK(3, 0)#define MLXPLAT_CPLD_ASIC_MASK GENMASK(1, 0)#define MLXPLAT_CPLD_FAN_NG_MASK GENMASK(5, 0)#define MLXPLAT_CPLD_LED_LO_NIBBLE_MASK GENMASK(7, 4)#define MLXPLAT_CPLD_LED_HI_NIBBLE_MASK GENMASK(3, 0)#define MLXPLAT_CPLD_VOLTREG_UPD_MASK GENMASK(5, 4) +#define MLXPLAT_CPLD_I2C_CAP_BIT 0x04 +#define MLXPLAT_CPLD_I2C_CAP_MASK GENMASK(5, MLXPLAT_CPLD_I2C_CAP_BIT)/* Masks for aggregation for comex carriers */ #define MLXPLAT_CPLD_AGGR_MASK_CARRIER BIT(1)
@@ -1937,6 +1942,7 @@ static bool mlxplat_mlxcpld_readable_reg(struct device *dev, unsigned int reg)case MLXPLAT_CPLD_LPC_REG_FAN_CAP2_OFFSET :case MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET :case MLXPLAT_CPLD_LPC_REG_TACHO_SPEED_OFFSET : +case MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET :case MLXPLAT_CPLD_LPC_REG_CONFIG1_OFFSET :case MLXPLAT_CPLD_LPC_REG_CONFIG2_OFFSET :case MLXPLAT_CPLD_LPC_REG_UFM_VERSION_OFFSET :
@@ -2007,6 +2013,7 @@ static bool mlxplat_mlxcpld_volatile_reg(struct device *dev, unsigned int reg)case MLXPLAT_CPLD_LPC_REG_FAN_CAP2_OFFSET :case MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET :case MLXPLAT_CPLD_LPC_REG_TACHO_SPEED_OFFSET : +case MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET :case MLXPLAT_CPLD_LPC_REG_CONFIG1_OFFSET :case MLXPLAT_CPLD_LPC_REG_CONFIG2_OFFSET :case MLXPLAT_CPLD_LPC_REG_UFM_VERSION_OFFSET :
Signature · 1 line
2.11.0
PATCH v2 9/10 platform/mellanox: mlxreg-hotplug: Add support for new capability register
In reply to Vadim PasternakAdd support for capability register, which is used for detection of the actual number of interrupt capable components within the particular group, supported by the specific system.
Such components could be for example the number of power units and interrupts related to these units.
The motivation is to avoid adding a new code in the future in order to distinct between the systems type supported different number of the components like power supplies, FANs, ASICs, line cards.
--- drivers/platform/mellanox/mlxreg-hotplug.c | 14 ++++++++++++++ include/linux/platform_data/mlxreg.h | 2 ++ 2 files changed, 16 insertions(+)
drivers/platform/mellanox/mlxreg-hotplug.c +14 -0
@@ -504,6 +504,20 @@ static int mlxreg_hotplug_set_irq(struct mlxreg_hotplug_priv_data *priv) item = pdata->items;for (i =0 ; i < pdata->counter; i++, item++) { +if (item->capability) { +/* +* Read group capability register to get actual number +* of interrupt capable components and set group mask +* accordingly. +*/ + ret =regmap_read (priv->regmap, item->capability, + ®val); +if (ret) + goto out; + + item->mask =GENMASK ((regval & item->mask) -1 ,0 ); + } +/* Clear group presense event. */ ret =regmap_write (priv->regmap, item->reg +MLXREG_HOTPLUG_EVENT_OFF ,0 );
include/linux/platform_data/mlxreg.h +2 -0
@@ -101,6 +101,7 @@ struct mlxreg_core_data {* @aggr_mask: group aggregation mask; * @reg: group interrupt status register; * @mask: group interrupt mask; +* @capability: group capability register; * @cache: last status value for elements fro the same group; * @count: number of available elements in the group; * @ind: element's index inside the group;
@@ -112,6 +113,7 @@ struct mlxreg_core_item {u32 aggr_mask;u32 reg;u32 mask; +u32 capability;u32 cache;u8 count;u8 ind;
Signature · 1 line
2.11.0
PATCH v2 10/10 platform/x86: mlx-platform: Add support for next generation systems
In reply to Vadim PasternakAdd support for new Mellanox system types of basic class VMOD0010, containing new Mellanox systems equipped with new switch device Spectrum 3 (32x400GbE/64x200G/128x100G Ethernet switch). These are the Top of the Rack 1U/2U/4U systems, equipped with Mellanox Comex card and with the switch board with Mellanox Spectrum-3 device.
This class of devices can be equipped with two PS units for 1U/2U or with four PS units for 4U systems.
--- drivers/platform/x86/mlx-platform.c | 180 ++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+)
drivers/platform/x86/mlx-platform.c +180 -0
@@ -163,6 +163,7 @@#define MLXPLAT_CPLD_NR_NONE -1#define MLXPLAT_CPLD_PSU_DEFAULT_NR 10#define MLXPLAT_CPLD_PSU_MSNXXXX_NR 4 +#define MLXPLAT_CPLD_PSU_MSNXXXX_NR2 3#define MLXPLAT_CPLD_FAN1_DEFAULT_NR 11#define MLXPLAT_CPLD_FAN2_DEFAULT_NR 12#define MLXPLAT_CPLD_FAN3_DEFAULT_NR 13
@@ -212,8 +213,24 @@ static const struct resource mlxplat_lpc_resources[] = { IORESOURCE_IO), }; +/* Platform i2c next generation systems data */ +static struct mlxreg_core_data mlxplat_mlxcpld_i2c_ng_items_data[] = { + { + .reg =MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET , + .mask =MLXPLAT_CPLD_I2C_CAP_MASK , + .bit =MLXPLAT_CPLD_I2C_CAP_BIT , + }, +}; + +static struct mlxreg_core_item mlxplat_mlxcpld_i2c_ng_items[] = { + { + .data = mlxplat_mlxcpld_i2c_ng_items_data, + }, +}; +/* Platform next generation systems i2c data */ static struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_i2c_ng_data = { + .items = mlxplat_mlxcpld_i2c_ng_items, .cell =MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET , .mask =MLXPLAT_CPLD_AGGR_MASK_COMEX , .cell_low =MLXPLAT_CPLD_LPC_REG_AGGRCO_OFFSET ,
@@ -847,6 +864,116 @@ struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_default_ng_data = { .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW, }; +/* Platform hotplug extended system family data */ +static struct mlxreg_core_data mlxplat_mlxcpld_ext_psu_items_data[] = { + { + .label ="psu1" , + .reg =MLXPLAT_CPLD_LPC_REG_PSU_OFFSET , + .mask =BIT (0 ), + .hpdev.nr =MLXPLAT_CPLD_NR_NONE , + }, + { + .label ="psu2" , + .reg =MLXPLAT_CPLD_LPC_REG_PSU_OFFSET , + .mask =BIT (1 ), + .hpdev.nr =MLXPLAT_CPLD_NR_NONE , + }, + { + .label ="psu3" , + .reg =MLXPLAT_CPLD_LPC_REG_PSU_OFFSET , + .mask =BIT (2 ), + .hpdev.nr =MLXPLAT_CPLD_NR_NONE , + }, + { + .label ="psu4" , + .reg =MLXPLAT_CPLD_LPC_REG_PSU_OFFSET , + .mask =BIT (3 ), + .hpdev.nr =MLXPLAT_CPLD_NR_NONE , + }, +}; + +static struct mlxreg_core_data mlxplat_mlxcpld_ext_pwr_items_data[] = { + { + .label ="pwr1" , + .reg =MLXPLAT_CPLD_LPC_REG_PWR_OFFSET , + .mask =BIT (0 ), + .hpdev.brdinfo = &mlxplat_mlxcpld_pwr[0 ], + .hpdev.nr =MLXPLAT_CPLD_PSU_MSNXXXX_NR , + }, + { + .label ="pwr2" , + .reg =MLXPLAT_CPLD_LPC_REG_PWR_OFFSET , + .mask =BIT (1 ), + .hpdev.brdinfo = &mlxplat_mlxcpld_pwr[1 ], + .hpdev.nr =MLXPLAT_CPLD_PSU_MSNXXXX_NR , + }, + { + .label ="pwr3" , + .reg =MLXPLAT_CPLD_LPC_REG_PWR_OFFSET , + .mask =BIT (2 ), + .hpdev.brdinfo = &mlxplat_mlxcpld_pwr[0 ], + .hpdev.nr =MLXPLAT_CPLD_PSU_MSNXXXX_NR2 , + }, + { + .label ="pwr4" , + .reg =MLXPLAT_CPLD_LPC_REG_PWR_OFFSET , + .mask =BIT (3 ), + .hpdev.brdinfo = &mlxplat_mlxcpld_pwr[1 ], + .hpdev.nr =MLXPLAT_CPLD_PSU_MSNXXXX_NR2 , + }, +}; + +static struct mlxreg_core_item mlxplat_mlxcpld_ext_items[] = { + { + .data = mlxplat_mlxcpld_ext_psu_items_data, + .aggr_mask =MLXPLAT_CPLD_AGGR_MASK_NG_DEF , + .reg =MLXPLAT_CPLD_LPC_REG_PSU_OFFSET , + .mask =MLXPLAT_CPLD_PSU_EXT_MASK , + .capability =MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET , + .count =ARRAY_SIZE (mlxplat_mlxcpld_ext_psu_items_data), + .inversed =1 , + .health = false, + }, + { + .data = mlxplat_mlxcpld_ext_pwr_items_data, + .aggr_mask =MLXPLAT_CPLD_AGGR_MASK_NG_DEF , + .reg =MLXPLAT_CPLD_LPC_REG_PWR_OFFSET , + .mask =MLXPLAT_CPLD_PWR_EXT_MASK , + .capability =MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET , + .count =ARRAY_SIZE (mlxplat_mlxcpld_ext_pwr_items_data), + .inversed =0 , + .health = false, + }, + { + .data = mlxplat_mlxcpld_default_ng_fan_items_data, + .aggr_mask =MLXPLAT_CPLD_AGGR_MASK_NG_DEF , + .reg =MLXPLAT_CPLD_LPC_REG_FAN_OFFSET , + .mask =MLXPLAT_CPLD_FAN_NG_MASK , + .count =ARRAY_SIZE (mlxplat_mlxcpld_default_ng_fan_items_data), + .inversed =1 , + .health = false, + }, + { + .data = mlxplat_mlxcpld_default_asic_items_data, + .aggr_mask =MLXPLAT_CPLD_AGGR_MASK_NG_DEF , + .reg =MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET , + .mask =MLXPLAT_CPLD_ASIC_MASK , + .count =ARRAY_SIZE (mlxplat_mlxcpld_default_asic_items_data), + .inversed =0 , + .health = true, + }, +}; + +static +struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_ext_data = { + .items = mlxplat_mlxcpld_ext_items, + .counter =ARRAY_SIZE (mlxplat_mlxcpld_ext_items), + .cell =MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET , + .mask =MLXPLAT_CPLD_AGGR_MASK_NG_DEF |MLXPLAT_CPLD_AGGR_MASK_COMEX , + .cell_low =MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET , + .mask_low =MLXPLAT_CPLD_LOW_AGGR_MASK_LOW , +}; +/* Platform led default data */ static struct mlxreg_core_data mlxplat_mlxcpld_default_led_data[] = { {
@@ -2040,6 +2167,13 @@ static const struct reg_default mlxplat_mlxcpld_regmap_comex_default[] = { { MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET, 0x00 }, }; +static const struct reg_default mlxplat_mlxcpld_regmap_ng400[] = { + {MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET ,0x00 }, + {MLXPLAT_CPLD_LPC_REG_WD1_ACT_OFFSET ,0x00 }, + {MLXPLAT_CPLD_LPC_REG_WD2_ACT_OFFSET ,0x00 }, + {MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET ,0x00 }, +}; +struct mlxplat_mlxcpld_regmap_context {void __iomem *base; };
@@ -2106,6 +2240,20 @@ static const struct regmap_config mlxplat_mlxcpld_regmap_config_comex = { .reg_write = mlxplat_mlxcpld_reg_write, }; +static const struct regmap_config mlxplat_mlxcpld_regmap_config_ng400 = { + .reg_bits =8 , + .val_bits =8 , + .max_register =255 , + .cache_type =REGCACHE_FLAT , + .writeable_reg = mlxplat_mlxcpld_writeable_reg, + .readable_reg = mlxplat_mlxcpld_readable_reg, + .volatile_reg = mlxplat_mlxcpld_volatile_reg, + .reg_defaults = mlxplat_mlxcpld_regmap_ng400, + .num_reg_defaults =ARRAY_SIZE (mlxplat_mlxcpld_regmap_ng400), + .reg_read = mlxplat_mlxcpld_reg_read, + .reg_write = mlxplat_mlxcpld_reg_write, +}; +static struct resource mlxplat_mlxcpld_resources[] = { [0 ] =DEFINE_RES_IRQ_NAMED (17 ,"mlxreg-hotplug" ), };
@@ -2258,6 +2406,32 @@ static int __init mlxplat_dmi_comex_matched(const struct dmi_system_id *dmi)return 1 ; } +static int __init mlxplat_dmi_ng400_matched (const struct dmi_system_id *dmi) +{ +int i; + + mlxplat_max_adap_num =MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM ; + mlxplat_mux_num =ARRAY_SIZE (mlxplat_default_mux_data); + mlxplat_mux_data = mlxplat_default_mux_data; +for (i =0 ; i < mlxplat_mux_num; i++) { + mlxplat_mux_data[i].values = mlxplat_msn21xx_channels; + mlxplat_mux_data[i].n_values = +ARRAY_SIZE (mlxplat_msn21xx_channels); + } + mlxplat_hotplug = &mlxplat_mlxcpld_ext_data; + mlxplat_hotplug->deferred_nr = + mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM -1 ]; + mlxplat_led = &mlxplat_default_ng_led_data; + mlxplat_regs_io = &mlxplat_default_ng_regs_io_data; + mlxplat_fan = &mlxplat_default_fan_data; +for (i =0 ; i <ARRAY_SIZE (mlxplat_mlxcpld_wd_set_type2); i++) + mlxplat_wd_data[i] = &mlxplat_mlxcpld_wd_set_type2[i]; + mlxplat_i2c = &mlxplat_mlxcpld_i2c_ng_data; + mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config_ng400; + +return 1 ; +} +static const struct dmi_system_id mlxplat_dmi_table[]__initconst = { { .callback = mlxplat_dmi_default_matched,
@@ -2302,6 +2476,12 @@ static const struct dmi_system_id mlxplat_dmi_table[] __initconst = { }, }, { + .callback = mlxplat_dmi_ng400_matched, + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "VMOD0010"), + }, + }, + { .callback = mlxplat_dmi_msn274x_matched, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"),
Signature · 1 line
2.11.0