Skip to content

Commit c281fc9

Browse files
Integrate HW-MGMT 7.0040.2000 Changes (#446)
## Patch List * 0095-platform-mellanox-nvsw-sn2201-Add-support-for-new-sy.patch : Co-authored-by: Saikrishna Arcot <[email protected]>
1 parent fe78170 commit c281fc9

4 files changed

+229
-11
lines changed

patch/0048-hwmon-pmbus-Add-support-for-MPS-Multi-phase-mp2891-c.patch

+14-10
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Signed-off-by: Vadim Pasternak <[email protected]>
2424
Documentation/hwmon/mp2891.rst | 128 ++++++++++
2525
drivers/hwmon/pmbus/Kconfig | 9 +
2626
drivers/hwmon/pmbus/Makefile | 1 +
27-
drivers/hwmon/pmbus/mp2891.c | 427 +++++++++++++++++++++++++++++++++
28-
4 files changed, 565 insertions(+)
27+
drivers/hwmon/pmbus/mp2891.c | 431 +++++++++++++++++++++++++++++++++
28+
4 files changed, 569 insertions(+)
2929
create mode 100644 Documentation/hwmon/mp2891.rst
3030
create mode 100644 drivers/hwmon/pmbus/mp2891.c
3131

@@ -197,10 +197,10 @@ index 0002dbe22..8e767d7b8 100644
197197
obj-$(CONFIG_SENSORS_PLI1209BC) += pli1209bc.o
198198
diff --git a/drivers/hwmon/pmbus/mp2891.c b/drivers/hwmon/pmbus/mp2891.c
199199
new file mode 100644
200-
index 000000000..a4386e8e9
200+
index 000000000..522c0bb5f
201201
--- /dev/null
202202
+++ b/drivers/hwmon/pmbus/mp2891.c
203-
@@ -0,0 +1,427 @@
203+
@@ -0,0 +1,431 @@
204204
+// SPDX-License-Identifier: GPL-2.0-or-later
205205
+/*
206206
+ * Hardware monitoring driver for MPS Multi-phase Digital VR Controllers(MP2891)
@@ -221,6 +221,7 @@ index 000000000..a4386e8e9
221221
+ * Note: command PMBUS_READ_DUTY_CYCLE (0x94) is re-purposed for reading input power.
222222
+ * command PMBUS_READ_FREQUENCY (0x95) is re-purposed for reading input current.
223223
+ */
224+
+#define MP2891_PMBUS_VOUT_MIN 0x2b
224225
+#define MP2891_VOUT_OV_FAULT_LIMIT_R1 0x40
225226
+#define MP2891_VOUT_UV_FAULT_LIMIT_R1 0x44
226227
+#define MP2891_MFR_IIN_RPT_EST 0x53
@@ -312,7 +313,7 @@ index 000000000..a4386e8e9
312313
+{
313314
+ const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
314315
+ struct mp2891_data *data = to_mp2891_data(info);
315-
+ int off, ret;
316+
+ int ret;
316317
+
317318
+ switch (reg) {
318319
+ case PMBUS_READ_VOUT:
@@ -338,14 +339,17 @@ index 000000000..a4386e8e9
338339
+ return ret;
339340
+ return DIV_ROUND_CLOSEST(ret & GENMASK(7, 0), 8) * 1000;
340341
+ case PMBUS_VOUT_UV_FAULT_LIMIT:
342+
+ ret = pmbus_read_word_data(client, page, phase, MP2891_PMBUS_VOUT_MIN);
343+
+ if (ret <= 0)
344+
+ return ret;
345+
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page] * 105;
346+
+ return DIV_ROUND_CLOSEST(ret, 10000);
341347
+ case PMBUS_VOUT_OV_FAULT_LIMIT:
342-
+ ret = pmbus_read_word_data(client, page, phase, reg);
348+
+ ret = pmbus_read_word_data(client, page, phase, PMBUS_VOUT_MAX);
343349
+ if (ret <= 0)
344350
+ return ret;
345-
+ off = (reg == PMBUS_VOUT_UV_FAULT_LIMIT) ? MP2891_MFR_UVP_OFFSET_DEFAULT :
346-
+ MP2891_MFR_OVP_OFFSET_DEFAULT;
347-
+ off = MP2891_MFR_OVP_UVP_OFFSET_GET(ret, off);
348-
+ return DIV_ROUND_CLOSEST(data->vid_ref[page] + off, 100);
351+
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page] * 95;
352+
+ return DIV_ROUND_CLOSEST(ret, 10000);
349353
+ case PMBUS_IOUT_UC_FAULT_LIMIT:
350354
+ ret = pmbus_read_word_data(client, page, phase, reg);
351355
+ return ret <= 0 ? ret : DIV_ROUND_CLOSEST((ret & GENMASK(7, 0)) *
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
From 693ea1c72c6f1b83232c043fdb1b175a450bc172 Mon Sep 17 00:00:00 2001
2+
From: Vadim Pasternak <[email protected]>
3+
Date: Wed, 7 Aug 2024 00:09:11 +0000
4+
Subject: [PATCH backport 6.1 1/1] platform: mellanox: nvsw-sn2200: Add support
5+
for new system flavour
6+
7+
Add support for SN2201 system flavour, which is fitting OCP rack
8+
form-factor and feeded from external power source through the rack
9+
standard busbar interface.
10+
11+
Validate system type through DMI decode.
12+
For new system flavour:
13+
- Skip internal power supply configuration.
14+
- Attach power hotswap device.
15+
16+
Signed-off-by: Vadim Pasternak <[email protected]>
17+
---
18+
drivers/platform/mellanox/nvsw-sn2201.c | 111 +++++++++++++++++++++++-
19+
1 file changed, 108 insertions(+), 3 deletions(-)
20+
21+
diff --git a/drivers/platform/mellanox/nvsw-sn2201.c b/drivers/platform/mellanox/nvsw-sn2201.c
22+
index 2612bb5f82a3..d604069e3313 100644
23+
--- a/drivers/platform/mellanox/nvsw-sn2201.c
24+
+++ b/drivers/platform/mellanox/nvsw-sn2201.c
25+
@@ -6,6 +6,7 @@
26+
*/
27+
28+
#include <linux/device.h>
29+
+#include <linux/dmi.h>
30+
#include <linux/i2c.h>
31+
#include <linux/interrupt.h>
32+
#include <linux/irq.h>
33+
@@ -104,6 +105,9 @@
34+
| NVSW_SN2201_CPLD_AGGR_PSU_MASK_DEF \
35+
| NVSW_SN2201_CPLD_AGGR_PWR_MASK_DEF \
36+
| NVSW_SN2201_CPLD_AGGR_FAN_MASK_DEF)
37+
+#define NVSW_SN2201_CPLD_AGGR_BUSBAR_MASK_DEF \
38+
+ (NVSW_SN2201_CPLD_AGGR_ASIC_MASK_DEF \
39+
+ | NVSW_SN2201_CPLD_AGGR_FAN_MASK_DEF)
40+
41+
#define NVSW_SN2201_CPLD_ASIC_MASK GENMASK(3, 1)
42+
#define NVSW_SN2201_CPLD_PSU_MASK GENMASK(1, 0)
43+
@@ -132,6 +136,7 @@
44+
* @cpld_devs: I2C devices for cpld;
45+
* @cpld_devs_num: number of I2C devices for cpld;
46+
* @main_mux_deferred_nr: I2C adapter number must be exist prior creating devices execution;
47+
+ * @ext_pwr_source: 1 if system powered by external power supply; 0 - by internal;
48+
*/
49+
struct nvsw_sn2201 {
50+
struct device *dev;
51+
@@ -152,6 +157,7 @@ struct nvsw_sn2201 {
52+
struct mlxreg_hotplug_device *cpld_devs;
53+
int cpld_devs_num;
54+
int main_mux_deferred_nr;
55+
+ u8 ext_pwr_source;
56+
};
57+
58+
static bool nvsw_sn2201_writeable_reg(struct device *dev, unsigned int reg)
59+
@@ -523,6 +529,36 @@ struct mlxreg_core_hotplug_platform_data nvsw_sn2201_hotplug = {
60+
.deferred_nr = NVSW_SN2201_2ND_MUX_CH3_NR,
61+
};
62+
63+
+static struct mlxreg_core_item nvsw_sn2201_busbar_items[] = {
64+
+ {
65+
+ .data = nvsw_sn2201_fan_items_data,
66+
+ .aggr_mask = NVSW_SN2201_CPLD_AGGR_FAN_MASK_DEF,
67+
+ .reg = NVSW_SN2201_FAN_PRSNT_STATUS_OFFSET,
68+
+ .mask = NVSW_SN2201_CPLD_FAN_MASK,
69+
+ .count = ARRAY_SIZE(nvsw_sn2201_fan_items_data),
70+
+ .inversed = 1,
71+
+ .health = false,
72+
+ },
73+
+ {
74+
+ .data = nvsw_sn2201_sys_items_data,
75+
+ .aggr_mask = NVSW_SN2201_CPLD_AGGR_ASIC_MASK_DEF,
76+
+ .reg = NVSW_SN2201_ASIC_STATUS_OFFSET,
77+
+ .mask = NVSW_SN2201_CPLD_ASIC_MASK,
78+
+ .count = ARRAY_SIZE(nvsw_sn2201_sys_items_data),
79+
+ .inversed = 1,
80+
+ .health = false,
81+
+ },
82+
+};
83+
+
84+
+static
85+
+struct mlxreg_core_hotplug_platform_data nvsw_sn2201_busbar_hotplug = {
86+
+ .items = nvsw_sn2201_busbar_items,
87+
+ .counter = ARRAY_SIZE(nvsw_sn2201_busbar_items),
88+
+ .cell = NVSW_SN2201_SYS_INT_STATUS_OFFSET,
89+
+ .mask = NVSW_SN2201_CPLD_AGGR_BUSBAR_MASK_DEF,
90+
+ .deferred_nr = NVSW_SN2201_2ND_MUX_CH3_NR,
91+
+};
92+
+
93+
/* SN2201 static devices. */
94+
static struct i2c_board_info nvsw_sn2201_static_devices[] = {
95+
{
96+
@@ -558,6 +594,9 @@ static struct i2c_board_info nvsw_sn2201_static_devices[] = {
97+
{
98+
I2C_BOARD_INFO("pmbus", 0x40),
99+
},
100+
+ {
101+
+ I2C_BOARD_INFO("lm5066i", 0x15),
102+
+ },
103+
};
104+
105+
/* SN2201 default static board info. */
106+
@@ -608,6 +647,58 @@ static struct mlxreg_hotplug_device nvsw_sn2201_static_brdinfo[] = {
107+
},
108+
};
109+
110+
+/* SN2201 default busbar static board info. */
111+
+static struct mlxreg_hotplug_device nvsw_sn2201_busbar_static_brdinfo[] = {
112+
+ {
113+
+ .brdinfo = &nvsw_sn2201_static_devices[0],
114+
+ .nr = NVSW_SN2201_MAIN_NR,
115+
+ },
116+
+ {
117+
+ .brdinfo = &nvsw_sn2201_static_devices[1],
118+
+ .nr = NVSW_SN2201_MAIN_MUX_CH0_NR,
119+
+ },
120+
+ {
121+
+ .brdinfo = &nvsw_sn2201_static_devices[2],
122+
+ .nr = NVSW_SN2201_MAIN_MUX_CH0_NR,
123+
+ },
124+
+ {
125+
+ .brdinfo = &nvsw_sn2201_static_devices[3],
126+
+ .nr = NVSW_SN2201_MAIN_MUX_CH0_NR,
127+
+ },
128+
+ {
129+
+ .brdinfo = &nvsw_sn2201_static_devices[4],
130+
+ .nr = NVSW_SN2201_MAIN_MUX_CH3_NR,
131+
+ },
132+
+ {
133+
+ .brdinfo = &nvsw_sn2201_static_devices[5],
134+
+ .nr = NVSW_SN2201_MAIN_MUX_CH5_NR,
135+
+ },
136+
+ {
137+
+ .brdinfo = &nvsw_sn2201_static_devices[6],
138+
+ .nr = NVSW_SN2201_MAIN_MUX_CH5_NR,
139+
+ },
140+
+ {
141+
+ .brdinfo = &nvsw_sn2201_static_devices[7],
142+
+ .nr = NVSW_SN2201_MAIN_MUX_CH5_NR,
143+
+ },
144+
+ {
145+
+ .brdinfo = &nvsw_sn2201_static_devices[8],
146+
+ .nr = NVSW_SN2201_MAIN_MUX_CH6_NR,
147+
+ },
148+
+ {
149+
+ .brdinfo = &nvsw_sn2201_static_devices[9],
150+
+ .nr = NVSW_SN2201_MAIN_MUX_CH6_NR,
151+
+ },
152+
+ {
153+
+ .brdinfo = &nvsw_sn2201_static_devices[10],
154+
+ .nr = NVSW_SN2201_MAIN_MUX_CH7_NR,
155+
+ },
156+
+ {
157+
+ .brdinfo = &nvsw_sn2201_static_devices[11],
158+
+ .nr = NVSW_SN2201_MAIN_MUX_CH1_NR,
159+
+ },
160+
+};
161+
+
162+
/* LED default data. */
163+
static struct mlxreg_core_data nvsw_sn2201_led_data[] = {
164+
{
165+
@@ -982,7 +1073,10 @@ static int nvsw_sn2201_config_init(struct nvsw_sn2201 *nvsw_sn2201, void *regmap
166+
nvsw_sn2201->io_data = &nvsw_sn2201_regs_io;
167+
nvsw_sn2201->led_data = &nvsw_sn2201_led;
168+
nvsw_sn2201->wd_data = &nvsw_sn2201_wd;
169+
- nvsw_sn2201->hotplug_data = &nvsw_sn2201_hotplug;
170+
+ if (nvsw_sn2201->ext_pwr_source)
171+
+ nvsw_sn2201->hotplug_data = &nvsw_sn2201_busbar_hotplug;
172+
+ else
173+
+ nvsw_sn2201->hotplug_data = &nvsw_sn2201_hotplug;
174+
175+
/* Register IO access driver. */
176+
if (nvsw_sn2201->io_data) {
177+
@@ -1199,11 +1293,17 @@ static int nvsw_sn2201_config_pre_init(struct nvsw_sn2201 *nvsw_sn2201)
178+
static int nvsw_sn2201_probe(struct platform_device *pdev)
179+
{
180+
struct nvsw_sn2201 *nvsw_sn2201;
181+
+ const char *sku;
182+
183+
nvsw_sn2201 = devm_kzalloc(&pdev->dev, sizeof(*nvsw_sn2201), GFP_KERNEL);
184+
if (!nvsw_sn2201)
185+
return -ENOMEM;
186+
187+
+ /* Validate system powering type. */
188+
+ sku = dmi_get_system_info(DMI_PRODUCT_SKU);
189+
+ if (!strcmp(sku, "HI168"))
190+
+ nvsw_sn2201->ext_pwr_source = 1;
191+
+
192+
nvsw_sn2201->dev = &pdev->dev;
193+
platform_set_drvdata(pdev, nvsw_sn2201);
194+
platform_device_add_resources(pdev, nvsw_sn2201_lpc_io_resources,
195+
@@ -1212,8 +1312,13 @@ static int nvsw_sn2201_probe(struct platform_device *pdev)
196+
nvsw_sn2201->main_mux_deferred_nr = NVSW_SN2201_MAIN_MUX_DEFER_NR;
197+
nvsw_sn2201->main_mux_devs = nvsw_sn2201_main_mux_brdinfo;
198+
nvsw_sn2201->cpld_devs = nvsw_sn2201_cpld_brdinfo;
199+
- nvsw_sn2201->sn2201_devs = nvsw_sn2201_static_brdinfo;
200+
- nvsw_sn2201->sn2201_devs_num = ARRAY_SIZE(nvsw_sn2201_static_brdinfo);
201+
+ if (nvsw_sn2201->ext_pwr_source) {
202+
+ nvsw_sn2201->sn2201_devs = nvsw_sn2201_busbar_static_brdinfo;
203+
+ nvsw_sn2201->sn2201_devs_num = ARRAY_SIZE(nvsw_sn2201_busbar_static_brdinfo);
204+
+ } else {
205+
+ nvsw_sn2201->sn2201_devs = nvsw_sn2201_static_brdinfo;
206+
+ nvsw_sn2201->sn2201_devs_num = ARRAY_SIZE(nvsw_sn2201_static_brdinfo);
207+
+ }
208+
209+
return nvsw_sn2201_config_pre_init(nvsw_sn2201);
210+
}
211+
--
212+
2.44.0
213+

patch/kconfig-inclusions

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ CONFIG_SENSORS_CORETEMP=m
5959
CONFIG_SENSORS_JC42=m
6060
CONFIG_SENSORS_POWR1220=m
6161
CONFIG_SENSORS_LM75=m
62+
CONFIG_SENSORS_EMC1403=m
6263
CONFIG_SENSORS_EMC2305=m
6364
CONFIG_SENSORS_STTS751=m
6465
CONFIG_SENSORS_TMP102=m
@@ -150,7 +151,6 @@ CONFIG_PCIE_DW_EP=y
150151
CONFIG_PCIE_DW_PLAT=y
151152
CONFIG_PCIE_DW_PLAT_HOST=y
152153
CONFIG_PCIE_DW_PLAT_EP=y
153-
154154
# For Micas
155155
CONFIG_MDIO_BITBANG=m
156156
CONFIG_MDIO_GPIO=m

patch/series

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ Support-for-fullcone-nat.patch
140140
0092-platform-mellanox-Introduce-support-of-Nvidia-smart-.patch
141141
0093-hwmon-pmbus-Add-support-for-MPS-Multi-phase-mp2855-c.patch
142142
0094-i2c-asf-Introduce-MCTP-support-over-ASF-controller.patch
143+
0095-platform-mellanox-nvsw-sn2201-Add-support-for-new-sy.patch
143144
8000-mlxsw-Use-weak-reverse-dependencies-for-firmware-fla.patch
144145
8003-mlxsw-i2c-SONIC-ISSU-Prevent-transaction-execution-f.patch
145146
8004-mlxsw-minimal-Downstream-Ignore-error-reading-SPAD-r.patch

0 commit comments

Comments
 (0)