Skip to content

Commit 95fb735

Browse files
authored
Merge pull request sonic-net#233 from keboliu/hw-mgmt-3134
[Mellanox] Backport kernel patches coming along with Mellanox hw-mgmt package release V.7.0010.3134 Backport kernel patches come along with Mellanox hw-mgmt package release V.7.0010.3134: V5.14-rc1 includes all following patches. | Patch name | Commit hash | | -----------------------------------------------------| ------------------------------------------------------------------------------------------ | |0033-i2c-mlxcpld-Update-module-license.patch | torvalds/linux@f069291 | |0034-i2c-mlxcpld-Add-support-for-I2C-bus-frequency-settin.patch | torvalds/linux@66b0c28 | |0035-i2c-mux-mlxcpld-Update-module-license.patch | torvalds/linux@337bc68 | |0036-i2c-mux-mlxcpld-Move-header-file-out-of-x86-realm.patch | torvalds/linux@98d29c4 | |0037-platform-x86-mlxcpld-Update-module-license.patch | torvalds/linux@9ff0c6d | |0038-i2c-mux-mlxcpld-Convert-driver-to-platform-driver.patch | torvalds/linux@84af1b1 | |0039-i2c-mux-mlxcpld-Prepare-mux-selection-infrastructure.patch | torvalds/linux@8156693 | |0040-i2c-mux-mlxcpld-Get-rid-of-adapter-numbers-enforceme.patch | torvalds/linux@cae5216 | |0041-i2c-mux-mlxcpld-Extend-driver-to-support-word-addres.patch | torvalds/linux@c52a1c5 | |0042-i2c-mux-mlxcpld-Extend-supported-mux-number.patch | torvalds/linux@699c050 | |0043-i2c-mux-mlxcpld-Add-callback-to-notify-mux-creation-.patch | torvalds/linux@a39bd92 | |0044-platform-x86-mlx-platform-remove-an-unused-variable.patch | torvalds/linux@eca6ba2 | |0045-platform-x86-mlx-platform-Fix-item-counter-assignmen.patch | torvalds/linux@ba4939f | |0046-platform-x86-mlx-platform-Fix-item-counter-assignmen.patch | torvalds/linux@cf79177 | |0047-mlxsw-core-Set-thermal-zone-polling-delay-argument-t.patch | torvalds/linux@2fd8d84 | |0048-mlxsw-reg-Extend-MTMP-register-with-new-threshold-fi.patch | torvalds/linux@314dbb1 | |0049-mlxsw-core_env-Read-module-temperature-thresholds-us.patch | torvalds/linux@befc204 | |0050-mlxsw-thermal-Add-function-for-reading-module-temper.patch | torvalds/linux@e57977b | |0051-mlxsw-thermal-Read-module-temperature-thresholds-usi.patch | torvalds/linux@72a64c2 | Full regression tests have been run on Mellanox platforms
2 parents a9d0dbd + 5c3357f commit 95fb735

20 files changed

+1623
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
From 9df799e9857cf0cdd04f7709793078cbd1a4d9bb Mon Sep 17 00:00:00 2001
2+
From: Vadim Pasternak <[email protected]>
3+
Date: Thu, 10 Dec 2020 18:51:11 +0200
4+
Subject: [PATCH backport 4.19 01/11] i2c: mlxcpld: Update module license
5+
6+
commit f069291bd5fcb85c6eb53f9b1ab23bcfcaad93f2 upstream
7+
8+
Update license to SPDX-License.
9+
10+
Signed-off-by: Vadim Pasternak <[email protected]>
11+
Signed-off-by: Wolfram Sang <[email protected]>
12+
---
13+
drivers/i2c/busses/i2c-mlxcpld.c | 32 +++-----------------------------
14+
1 file changed, 3 insertions(+), 29 deletions(-)
15+
16+
diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c
17+
index 6da4b58eee4f..ae0d17513422 100644
18+
--- a/drivers/i2c/busses/i2c-mlxcpld.c
19+
+++ b/drivers/i2c/busses/i2c-mlxcpld.c
20+
@@ -1,34 +1,8 @@
21+
+// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
22+
/*
23+
- * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
24+
- * Copyright (c) 2016 Michael Shych <[email protected]>
25+
+ * Mellanox i2c driver
26+
*
27+
- * Redistribution and use in source and binary forms, with or without
28+
- * modification, are permitted provided that the following conditions are met:
29+
- *
30+
- * 1. Redistributions of source code must retain the above copyright
31+
- * notice, this list of conditions and the following disclaimer.
32+
- * 2. Redistributions in binary form must reproduce the above copyright
33+
- * notice, this list of conditions and the following disclaimer in the
34+
- * documentation and/or other materials provided with the distribution.
35+
- * 3. Neither the names of the copyright holders nor the names of its
36+
- * contributors may be used to endorse or promote products derived from
37+
- * this software without specific prior written permission.
38+
- *
39+
- * Alternatively, this software may be distributed under the terms of the
40+
- * GNU General Public License ("GPL") version 2 as published by the Free
41+
- * Software Foundation.
42+
- *
43+
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
44+
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45+
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46+
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
47+
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48+
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
49+
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
50+
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
51+
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52+
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
53+
- * POSSIBILITY OF SUCH DAMAGE.
54+
+ * Copyright (C) 2016-2020 Mellanox Technologies
55+
*/
56+
57+
#include <linux/delay.h>
58+
--
59+
2.11.0
60+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
From cb4de56f5b1551eb925329beb4277048a8ba821f Mon Sep 17 00:00:00 2001
2+
From: Vadim Pasternak <[email protected]>
3+
Date: Wed, 6 Jan 2021 01:33:47 +0200
4+
5+
commit 66b0c2846ba8de569026a067bb5a34ea5768408c upstream
6+
7+
Subject: [PATCH backport 4.19 02/11] i2c: mlxcpld: Add support for I2C bus
8+
frequency setting
9+
10+
Add support for I2C bus frequency setting according to the specific
11+
system capability. This capability is obtained from CPLD frequency
12+
setting register, which could be provided through the platform data.
13+
If such register is provided, it specifies minimal I2C bus frequency
14+
to be used for the devices attached to the I2C bus. Supported
15+
freqeuncies are 100KHz, 400KHz, 1MHz, while 100KHz is the default.
16+
17+
Signed-off-by: Vadim Pasternak <[email protected]>
18+
Signed-off-by: Wolfram Sang <[email protected]>
19+
---
20+
drivers/i2c/busses/i2c-mlxcpld.c | 63 +++++++++++++++++++++++++++++++++++++++-
21+
1 file changed, 62 insertions(+), 1 deletion(-)
22+
23+
diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c
24+
index ae0d17513422..fa8cc0b71531 100644
25+
--- a/drivers/i2c/busses/i2c-mlxcpld.c
26+
+++ b/drivers/i2c/busses/i2c-mlxcpld.c
27+
@@ -11,7 +11,9 @@
28+
#include <linux/io.h>
29+
#include <linux/kernel.h>
30+
#include <linux/module.h>
31+
+#include <linux/platform_data/mlxreg.h>
32+
#include <linux/platform_device.h>
33+
+#include <linux/regmap.h>
34+
35+
/* General defines */
36+
#define MLXPLAT_CPLD_LPC_I2C_BASE_ADDR 0x2000
37+
@@ -46,6 +48,16 @@
38+
#define MLXCPLD_LPCI2C_ACK_IND 1
39+
#define MLXCPLD_LPCI2C_NACK_IND 2
40+
41+
+#define MLXCPLD_I2C_FREQ_1000KHZ_SET 0x04
42+
+#define MLXCPLD_I2C_FREQ_400KHZ_SET 0x0f
43+
+#define MLXCPLD_I2C_FREQ_100KHZ_SET 0x42
44+
+
45+
+enum mlxcpld_i2c_frequency {
46+
+ MLXCPLD_I2C_FREQ_1000KHZ = 1,
47+
+ MLXCPLD_I2C_FREQ_400KHZ = 2,
48+
+ MLXCPLD_I2C_FREQ_100KHZ = 3,
49+
+};
50+
+
51+
struct mlxcpld_i2c_curr_xfer {
52+
u8 cmd;
53+
u8 addr_width;
54+
@@ -463,8 +475,45 @@ static struct i2c_adapter mlxcpld_i2c_adapter = {
55+
.nr = MLXCPLD_I2C_BUS_NUM,
56+
};
57+
58+
+static int
59+
+mlxcpld_i2c_set_frequency(struct mlxcpld_i2c_priv *priv,
60+
+ struct mlxreg_core_hotplug_platform_data *pdata)
61+
+{
62+
+ struct mlxreg_core_item *item = pdata->items;
63+
+ struct mlxreg_core_data *data;
64+
+ u32 regval;
65+
+ u8 freq;
66+
+ int err;
67+
+
68+
+ if (!item)
69+
+ return 0;
70+
+
71+
+ /* Read frequency setting. */
72+
+ data = item->data;
73+
+ err = regmap_read(pdata->regmap, data->reg, &regval);
74+
+ if (err)
75+
+ return err;
76+
+
77+
+ /* Set frequency only if it is not 100KHz, which is default. */
78+
+ switch ((data->reg & data->mask) >> data->bit) {
79+
+ case MLXCPLD_I2C_FREQ_1000KHZ:
80+
+ freq = MLXCPLD_I2C_FREQ_1000KHZ_SET;
81+
+ break;
82+
+ case MLXCPLD_I2C_FREQ_400KHZ:
83+
+ freq = MLXCPLD_I2C_FREQ_400KHZ_SET;
84+
+ break;
85+
+ default:
86+
+ return 0;
87+
+ }
88+
+
89+
+ mlxcpld_i2c_write_comm(priv, MLXCPLD_LPCI2C_HALF_CYC_REG, &freq, 1);
90+
+
91+
+ return 0;
92+
+}
93+
+
94+
static int mlxcpld_i2c_probe(struct platform_device *pdev)
95+
{
96+
+ struct mlxreg_core_hotplug_platform_data *pdata;
97+
struct mlxcpld_i2c_priv *priv;
98+
int err;
99+
u8 val;
100+
@@ -479,6 +528,14 @@ static int mlxcpld_i2c_probe(struct platform_device *pdev)
101+
priv->dev = &pdev->dev;
102+
priv->base_addr = MLXPLAT_CPLD_LPC_I2C_BASE_ADDR;
103+
104+
+ /* Set I2C bus frequency if platform data provides this info. */
105+
+ pdata = dev_get_platdata(&pdev->dev);
106+
+ if (pdata) {
107+
+ err = mlxcpld_i2c_set_frequency(priv, pdata);
108+
+ if (err)
109+
+ goto mlxcpld_i2_probe_failed;
110+
+ }
111+
+
112+
/* Register with i2c layer */
113+
mlxcpld_i2c_adapter.timeout = usecs_to_jiffies(MLXCPLD_I2C_XFER_TO);
114+
/* Read capability register */
115+
@@ -497,8 +554,12 @@ static int mlxcpld_i2c_probe(struct platform_device *pdev)
116+
117+
err = i2c_add_numbered_adapter(&priv->adap);
118+
if (err)
119+
- mutex_destroy(&priv->lock);
120+
+ goto mlxcpld_i2_probe_failed;
121+
122+
+ return 0;
123+
+
124+
+mlxcpld_i2_probe_failed:
125+
+ mutex_destroy(&priv->lock);
126+
return err;
127+
}
128+
129+
--
130+
2.11.0
131+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
From 49611e8c60944021657bbf056aa746363079c9d4 Mon Sep 17 00:00:00 2001
2+
From: Vadim Pasternak <[email protected]>
3+
Date: Fri, 22 Jan 2021 21:24:56 +0200
4+
5+
commit 337bc68c294dd42538409f2a37b3daad2c851f98 upstream
6+
7+
Subject: [PATCH backport 4.19 03/11] i2c: mux: mlxcpld: Update module license
8+
9+
Update license to SPDX-License.
10+
11+
Signed-off-by: Vadim Pasternak <[email protected]>
12+
Acked-by: Peter Rosin <[email protected]>
13+
Signed-off-by: Wolfram Sang <[email protected]>
14+
---
15+
drivers/i2c/muxes/i2c-mux-mlxcpld.c | 33 +++------------------------------
16+
1 file changed, 3 insertions(+), 30 deletions(-)
17+
18+
diff --git a/drivers/i2c/muxes/i2c-mux-mlxcpld.c b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
19+
index f2bf3e57ed67..c9a94abcb6be 100644
20+
--- a/drivers/i2c/muxes/i2c-mux-mlxcpld.c
21+
+++ b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
22+
@@ -1,35 +1,8 @@
23+
+// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
24+
/*
25+
- * drivers/i2c/muxes/i2c-mux-mlxcpld.c
26+
- * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
27+
- * Copyright (c) 2016 Michael Shych <[email protected]>
28+
+ * Mellanox i2c mux driver
29+
*
30+
- * Redistribution and use in source and binary forms, with or without
31+
- * modification, are permitted provided that the following conditions are met:
32+
- *
33+
- * 1. Redistributions of source code must retain the above copyright
34+
- * notice, this list of conditions and the following disclaimer.
35+
- * 2. Redistributions in binary form must reproduce the above copyright
36+
- * notice, this list of conditions and the following disclaimer in the
37+
- * documentation and/or other materials provided with the distribution.
38+
- * 3. Neither the names of the copyright holders nor the names of its
39+
- * contributors may be used to endorse or promote products derived from
40+
- * this software without specific prior written permission.
41+
- *
42+
- * Alternatively, this software may be distributed under the terms of the
43+
- * GNU General Public License ("GPL") version 2 as published by the Free
44+
- * Software Foundation.
45+
- *
46+
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
47+
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48+
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49+
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
50+
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
51+
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
52+
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
53+
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
54+
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
55+
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
56+
- * POSSIBILITY OF SUCH DAMAGE.
57+
+ * Copyright (C) 2016-2020 Mellanox Technologies
58+
*/
59+
60+
#include <linux/device.h>
61+
--
62+
2.11.0
63+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 62165c690ee56554693ac14fc7bd0e260389a2f5 Mon Sep 17 00:00:00 2001
2+
From: Vadim Pasternak <[email protected]>
3+
Date: Fri, 22 Jan 2021 21:24:58 +0200
4+
5+
commit 98d29c410475f30b627502d845794352e9be4046 upstream
6+
7+
Subject: [PATCH backport 4.19 04/11] i2c: mux: mlxcpld: Move header file out
8+
of x86 realm
9+
10+
Move out header file from include/linux/platform_data/x86/ to
11+
include/linux/platform_data/, since it does not depend on x86
12+
architecture.
13+
14+
Signed-off-by: Vadim Pasternak <[email protected]>
15+
Reviewed-by: Michael Shych <[email protected]>
16+
Acked-by: Peter Rosin <[email protected]>
17+
Signed-off-by: Wolfram Sang <[email protected]>
18+
---
19+
drivers/i2c/muxes/i2c-mux-mlxcpld.c | 2 +-
20+
include/linux/platform_data/{x86 => }/mlxcpld.h | 0
21+
2 files changed, 1 insertion(+), 1 deletion(-)
22+
rename include/linux/platform_data/{x86 => }/mlxcpld.h (100%)
23+
24+
diff --git a/drivers/i2c/muxes/i2c-mux-mlxcpld.c b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
25+
index c9a94abcb6be..be2d0fa24096 100644
26+
--- a/drivers/i2c/muxes/i2c-mux-mlxcpld.c
27+
+++ b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
28+
@@ -11,7 +11,7 @@
29+
#include <linux/io.h>
30+
#include <linux/init.h>
31+
#include <linux/module.h>
32+
-#include <linux/platform_data/x86/mlxcpld.h>
33+
+#include <linux/platform_data/mlxcpld.h>
34+
#include <linux/platform_device.h>
35+
#include <linux/slab.h>
36+
37+
diff --git a/include/linux/platform_data/x86/mlxcpld.h b/include/linux/platform_data/mlxcpld.h
38+
similarity index 100%
39+
rename from include/linux/platform_data/x86/mlxcpld.h
40+
rename to include/linux/platform_data/mlxcpld.h
41+
--
42+
2.11.0
43+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
From 1b3ca3f6dac2f45e727f946ab8063c1f65ad51ec Mon Sep 17 00:00:00 2001
2+
From: Vadim Pasternak <[email protected]>
3+
Date: Sun, 7 Feb 2021 20:51:32 +0200
4+
5+
commit 9ff0c6db0605e9b88360048c8d0a6a9ff647eb71 upstream
6+
7+
Subject: [PATCH backport 4.19 05/11] platform/x86: mlxcpld: Update module
8+
license
9+
10+
Update license to SPDX-License.
11+
12+
Signed-off-by: Vadim Pasternak <[email protected]>
13+
---
14+
include/linux/platform_data/mlxcpld.h | 34 +++-------------------------------
15+
1 file changed, 3 insertions(+), 31 deletions(-)
16+
17+
diff --git a/include/linux/platform_data/mlxcpld.h b/include/linux/platform_data/mlxcpld.h
18+
index b08dcb183fca..e6c18bf017dd 100644
19+
--- a/include/linux/platform_data/mlxcpld.h
20+
+++ b/include/linux/platform_data/mlxcpld.h
21+
@@ -1,36 +1,8 @@
22+
+/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
23+
/*
24+
- * mlxcpld.h - Mellanox I2C multiplexer support in CPLD
25+
+ * Mellanox I2C multiplexer support in CPLD
26+
*
27+
- * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
28+
- * Copyright (c) 2016 Michael Shych <[email protected]>
29+
- *
30+
- * Redistribution and use in source and binary forms, with or without
31+
- * modification, are permitted provided that the following conditions are met:
32+
- *
33+
- * 1. Redistributions of source code must retain the above copyright
34+
- * notice, this list of conditions and the following disclaimer.
35+
- * 2. Redistributions in binary form must reproduce the above copyright
36+
- * notice, this list of conditions and the following disclaimer in the
37+
- * documentation and/or other materials provided with the distribution.
38+
- * 3. Neither the names of the copyright holders nor the names of its
39+
- * contributors may be used to endorse or promote products derived from
40+
- * this software without specific prior written permission.
41+
- *
42+
- * Alternatively, this software may be distributed under the terms of the
43+
- * GNU General Public License ("GPL") version 2 as published by the Free
44+
- * Software Foundation.
45+
- *
46+
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
47+
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48+
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49+
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
50+
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
51+
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
52+
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
53+
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
54+
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
55+
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
56+
- * POSSIBILITY OF SUCH DAMAGE.
57+
+ * Copyright (C) 2016-2020 Mellanox Technologies
58+
*/
59+
60+
#ifndef _LINUX_I2C_MLXCPLD_H
61+
--
62+
2.11.0
63+

0 commit comments

Comments
 (0)