Skip to content

Commit

Permalink
Update stretch for mellanox platform (sonic-net#10)
Browse files Browse the repository at this point in the history
* build 4.9.0-3 debian kernel

* Mellanox system drivers backport to kernel 4.9

This series of patches introduces support for Mellanox systems.
Most of the patches is a backporting from the kernels 4.10 � 4.14
for Mellanox system drivers that have been applied upstream and
a few patches contain current Mellanox upstream work � patches
which are in review process for acceptances for kernels 4.16 � 4.17.
This series introduces Mellanox i2c controller, mux, platform,
hotplug, led, asic drivers, TI voltage controller driver and the
extension of Mellanox kernel config.

In series file all the patches are listed and all old patches, relevant
for old 3.16 kernel are commented out.

Signed-off-by: Vadim Pasternak <[email protected]>

* Mellanox system drivers backport to kernel 4.9

This series of patches introduces support for Mellanox systems.
Most of the patches is a backporting from the kernels 4.10 - 4.14
for Mellanox system drivers that have been applied upstream and
a few patches contain current Mellanox upstream work patches
which are in review process for acceptances for kernels 4.16 - 4.17.
This series introduces Mellanox i2c controller, mux, platform,
hotplug, led, asic drivers, TI voltage controller driver and the
extension of Mellanox kernel config.

The patchset includes the bellow commits. And additional we have a code
from two work in progress patchsets, which are supposed to be available in
4.17, in review in:
http://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git
http://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git
This is to make Mellanox drivers architecture independent and also extend
the supported system types, since we have a number of new systems).

commit ae3923a284cc696311294022e9b1a49058f07387
Author: Bhumika Goyal <[email protected]>
Date:   Mon Aug 21 17:42:04 2017 +0530
    i2c: busses: make i2c_adapter_quirks const

commit 26b1083b4545ec08a7dcfe759323a2e142d60d75
Author: Wolfram Sang <[email protected]>
Date:   Mon Aug 14 10:23:26 2017 +0200
    i2c: mux: mlxcpld: move header file out of I2C realm

commit 1da87267006246137a96682404bc0716a10c85a7
Author: Wei Yongjun <[email protected]>
Date:   Thu Jan 12 14:29:04 2017 +0000
    i2c: mux: mlxcpld: remove unused including <linux/version.h>

commit 649ac63a9ae5e08b7123f2fa98c2bf42f033bdb9
Author: Peter Rosin <[email protected]>
Date:   Sat Dec 17 21:29:11 2016 +0100
    i2c: mux: mlxcpld: fix i2c mux selection caching

commit c02b7bf532f7e46f1f9a0e9c3c27ca3f6f134e8d
Author: Vadim Pasternak <[email protected]>
Date:   Thu Nov 10 21:26:23 2016 +0000
    i2c: mux: mellanox: add driver

commit dca897e28f364724e42f65cf0262fa367512498d
Author: Vadim Pasternak <[email protected]>
Date:   Thu Nov 3 19:17:19 2016 +0000
    leds: verify vendor and change license in mlxcpld driver

commit be4fdf99fa4dc95aa01144b207caf2cc9fa074d8
Author: Vadim Pasternak <[email protected]>
Date:   Thu Sep 8 07:25:53 2016 +0000
    leds: add driver for Mellanox systems LEDs

commit d70eaa386bf9ecc1e5b3002f64eb59172fcec4fd
Author: Vadim Pasternak <[email protected]>
Date:   Wed, Nov 1 13:10:42 2017 +0200
    mlxsw: i2c: Fix buffer increment counter for write transaction

commit 7ca36994a3479e6d9d81baba34a426c47691ea08
Author: Arkadi Sharshevsky <[email protected]>
Date:   Wed Jun 14 09:27:39 2017 +0200
    mlxsw: reg: Add MCIA register for cable info access

commit 36ca68bf9919299c95ff80e7cf3c217f4c250cbe
Author: Elad Raz <[email protected]>
Date:   Mon Jan 9 11:25:44 2017 +0100
    mlxsw: Fix mlxsw_i2c_write return value

commit d556e929164fdc6c94848374fc98c40852f97adb
Author: Vadim Pasternak <[email protected]>
Date:   Wed Nov 16 15:20:46 2016 +0100
    mlxsw: minimal: Add I2C support for Mellanox ASICs

commit 6882b0aee180f2797b8803bdf699aa45c2e5f2d6
Author: Vadim Pasternak <[email protected]>
Date:   Wed Nov 16 15:20:44 2016 +0100
    mlxsw: Introduce support for I2C bus

commit ba20de060094c64a981a4fec8fecc587d076383d
Author: Vadim Pasternak <[email protected]>
Date:   Wed Oct 18 07:26:55 2017 +0000
    platform/x86: move Mellanox hardware platform hotplug driver to platform/mellanox

commit 6faadbbb7f9da70ce484f98f72223c20125a1009
Author: Christoph Hellwig <[email protected]>
Date:   Thu Sep 14 11:59:30 2017 +0200
    dmi: Mark all struct dmi_system_id instances const

commit 9a38b67c9877a7371a250454bbbbf521d02fded5
Author: Vadim Pasternak <[email protected]>
Date:   Wed Dec 14 12:05:15 2016 +0000
    platform/x86: mlx-platform: mlxcpld-hotplug driver style fixes

commit 63d762b88cb5510f2bfdb5112ced18cde867ae61
Author: Dan Carpenter <[email protected]>
Date:   Sat Jan 7 09:33:34 2017 +0300
    platform/x86: mlx-platform: free first dev on error

commit afc4715901f0dce3206837a7051af05abf5a1e06
Author: Vadim Pasternak <[email protected]>
Date:   Thu Oct 27 19:55:54 2016 +0000
    platform/x86: mlx-platform: Add mlxcpld-hotplug driver registration

commit c3886c9d6076555697551da9b921cf6a6e9cc2b5
Author: kbuild test robot <[email protected]>
Date:   Fri Oct 28 01:26:50 2016 +0800
    platform/x86: mlx-platform: Fix semicolon.cocci warnings

commit 6613d18e90385db5cdbe32fe47567a3c11575b2d
Author: Vadim Pasternak <[email protected]>
Date:   Mon Oct 31 07:22:33 2016 +0000
    platform/x86: mlx-platform: Move module from arch/x86

commit 304887041d953b6692c0d4a9f8fafb252d32e9a0
Author: Vadim Pasternak <[email protected]>
Date:   Thu Oct 20 16:28:01 2016 +0000
    platform/x86: Introduce support for Mellanox hotplug driver

commit d4977c083aeb28cf72c1b019e3f9df13608126dd
Author: Vadim Pasternak <[email protected]>
Date:   Tue Aug 29 20:06:21 2017 +0000
    hwmon: (pmbus) Add support for Intel VID protocol VR13

commit 610526527a13e4c91e64ec3dfb4626c5043291c9
Author: Vadim Pasternak <[email protected]>
Date:   Wed Aug 30 22:02:14 2017 +0000
    hwmon: (pmbus) Add support for Texas Instruments tps53679 device

In series file all the patches are listed and all old patches, relevant
for old 3.16 kernel are commented out.

Signed-off-by: Vadim Pasternak <[email protected]>

* Makefile: uncomment line for applying kernel patches and config

This patch uncomments lines in Makefile related to applying patches and
configuration changes

Signed-off-by: Vadim Pasternak <[email protected]>

* exit immediately when shell commands fail

* config: mellanox kernel configuration

It adds explicit records for new configuration attributes which are not
set in kernel config.

Signed-off-by: Vadim Pasternak <[email protected]>

* Mellanox system drivers backport to kernel 4.9 (sonic-net#1)

* Mellanox system drivers backport to kernel 4.9

This series of patches introduces support for Mellanox systems.
Most of the patches is a backporting from the kernels 4.10 � 4.14
for Mellanox system drivers that have been applied upstream and
a few patches contain current Mellanox upstream work � patches
which are in review process for acceptances for kernels 4.16 � 4.17.
This series introduces Mellanox i2c controller, mux, platform,
hotplug, led, asic drivers, TI voltage controller driver and the
extension of Mellanox kernel config.

In series file all the patches are listed and all old patches, relevant
for old 3.16 kernel are commented out.

Signed-off-by: Vadim Pasternak <[email protected]>

* Mellanox system drivers backport to kernel 4.9

This series of patches introduces support for Mellanox systems.
Most of the patches is a backporting from the kernels 4.10 - 4.14
for Mellanox system drivers that have been applied upstream and
a few patches contain current Mellanox upstream work patches
which are in review process for acceptances for kernels 4.16 - 4.17.
This series introduces Mellanox i2c controller, mux, platform,
hotplug, led, asic drivers, TI voltage controller driver and the
extension of Mellanox kernel config.

The patchset includes the bellow commits. And additional we have a code
from two work in progress patchsets, which are supposed to be available in
4.17, in review in:
http://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git
http://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git
This is to make Mellanox drivers architecture independent and also extend
the supported system types, since we have a number of new systems).

commit ae3923a284cc696311294022e9b1a49058f07387
Author: Bhumika Goyal <[email protected]>
Date:   Mon Aug 21 17:42:04 2017 +0530
    i2c: busses: make i2c_adapter_quirks const

commit 26b1083b4545ec08a7dcfe759323a2e142d60d75
Author: Wolfram Sang <[email protected]>
Date:   Mon Aug 14 10:23:26 2017 +0200
    i2c: mux: mlxcpld: move header file out of I2C realm

commit 1da87267006246137a96682404bc0716a10c85a7
Author: Wei Yongjun <[email protected]>
Date:   Thu Jan 12 14:29:04 2017 +0000
    i2c: mux: mlxcpld: remove unused including <linux/version.h>

commit 649ac63a9ae5e08b7123f2fa98c2bf42f033bdb9
Author: Peter Rosin <[email protected]>
Date:   Sat Dec 17 21:29:11 2016 +0100
    i2c: mux: mlxcpld: fix i2c mux selection caching

commit c02b7bf532f7e46f1f9a0e9c3c27ca3f6f134e8d
Author: Vadim Pasternak <[email protected]>
Date:   Thu Nov 10 21:26:23 2016 +0000
    i2c: mux: mellanox: add driver

commit dca897e28f364724e42f65cf0262fa367512498d
Author: Vadim Pasternak <[email protected]>
Date:   Thu Nov 3 19:17:19 2016 +0000
    leds: verify vendor and change license in mlxcpld driver

commit be4fdf99fa4dc95aa01144b207caf2cc9fa074d8
Author: Vadim Pasternak <[email protected]>
Date:   Thu Sep 8 07:25:53 2016 +0000
    leds: add driver for Mellanox systems LEDs

commit d70eaa386bf9ecc1e5b3002f64eb59172fcec4fd
Author: Vadim Pasternak <[email protected]>
Date:   Wed, Nov 1 13:10:42 2017 +0200
    mlxsw: i2c: Fix buffer increment counter for write transaction

commit 7ca36994a3479e6d9d81baba34a426c47691ea08
Author: Arkadi Sharshevsky <[email protected]>
Date:   Wed Jun 14 09:27:39 2017 +0200
    mlxsw: reg: Add MCIA register for cable info access

commit 36ca68bf9919299c95ff80e7cf3c217f4c250cbe
Author: Elad Raz <[email protected]>
Date:   Mon Jan 9 11:25:44 2017 +0100
    mlxsw: Fix mlxsw_i2c_write return value

commit d556e929164fdc6c94848374fc98c40852f97adb
Author: Vadim Pasternak <[email protected]>
Date:   Wed Nov 16 15:20:46 2016 +0100
    mlxsw: minimal: Add I2C support for Mellanox ASICs

commit 6882b0aee180f2797b8803bdf699aa45c2e5f2d6
Author: Vadim Pasternak <[email protected]>
Date:   Wed Nov 16 15:20:44 2016 +0100
    mlxsw: Introduce support for I2C bus

commit ba20de060094c64a981a4fec8fecc587d076383d
Author: Vadim Pasternak <[email protected]>
Date:   Wed Oct 18 07:26:55 2017 +0000
    platform/x86: move Mellanox hardware platform hotplug driver to platform/mellanox

commit 6faadbbb7f9da70ce484f98f72223c20125a1009
Author: Christoph Hellwig <[email protected]>
Date:   Thu Sep 14 11:59:30 2017 +0200
    dmi: Mark all struct dmi_system_id instances const

commit 9a38b67c9877a7371a250454bbbbf521d02fded5
Author: Vadim Pasternak <[email protected]>
Date:   Wed Dec 14 12:05:15 2016 +0000
    platform/x86: mlx-platform: mlxcpld-hotplug driver style fixes

commit 63d762b88cb5510f2bfdb5112ced18cde867ae61
Author: Dan Carpenter <[email protected]>
Date:   Sat Jan 7 09:33:34 2017 +0300
    platform/x86: mlx-platform: free first dev on error

commit afc4715901f0dce3206837a7051af05abf5a1e06
Author: Vadim Pasternak <[email protected]>
Date:   Thu Oct 27 19:55:54 2016 +0000
    platform/x86: mlx-platform: Add mlxcpld-hotplug driver registration

commit c3886c9d6076555697551da9b921cf6a6e9cc2b5
Author: kbuild test robot <[email protected]>
Date:   Fri Oct 28 01:26:50 2016 +0800
    platform/x86: mlx-platform: Fix semicolon.cocci warnings

commit 6613d18e90385db5cdbe32fe47567a3c11575b2d
Author: Vadim Pasternak <[email protected]>
Date:   Mon Oct 31 07:22:33 2016 +0000
    platform/x86: mlx-platform: Move module from arch/x86

commit 304887041d953b6692c0d4a9f8fafb252d32e9a0
Author: Vadim Pasternak <[email protected]>
Date:   Thu Oct 20 16:28:01 2016 +0000
    platform/x86: Introduce support for Mellanox hotplug driver

commit d4977c083aeb28cf72c1b019e3f9df13608126dd
Author: Vadim Pasternak <[email protected]>
Date:   Tue Aug 29 20:06:21 2017 +0000
    hwmon: (pmbus) Add support for Intel VID protocol VR13

commit 610526527a13e4c91e64ec3dfb4626c5043291c9
Author: Vadim Pasternak <[email protected]>
Date:   Wed Aug 30 22:02:14 2017 +0000
    hwmon: (pmbus) Add support for Texas Instruments tps53679 device

In series file all the patches are listed and all old patches, relevant
for old 3.16 kernel are commented out.

Signed-off-by: Vadim Pasternak <[email protected]>

* Makefile: uncomment line for applying kernel patches and config

This patch uncomments lines in Makefile related to applying patches and
configuration changes

Signed-off-by: Vadim Pasternak <[email protected]>

* config: mellanox kernel configuration

It adds explicit records for new configuration attributes which are not
set in kernel config.

Signed-off-by: Vadim Pasternak <[email protected]>

* [igb]: support broadcom 54616 phy for Intel igb driver (sonic-net#3)

* platform/mellanox: mlxreg-hotplug driver add check for low aggregation register mask

It adds verification for low aggregation register mask offset. Only
non-zero offset is considered as valid.

Signed-off-by: Vadim Pasternak <[email protected]>

* path: rename: platform-mellanox-mlxreg-hotplug-driver-add-check-fo.patch

It renames platform-mellanox-mlxreg-hotplug-driver-add-check-fo.patch
from 0011 to 0012, since 0011 is already exist.

Signed-off-by: Vadim Pasternak <[email protected]>

* Update kernel with the latest upstream pacthes.

Signed-off-by: Vadim Pasternak <[email protected]>
  • Loading branch information
MellanoxBSP authored and lguohan committed Mar 19, 2018
1 parent a82619e commit 060e06f
Show file tree
Hide file tree
Showing 8 changed files with 861 additions and 0 deletions.
123 changes: 123 additions & 0 deletions patch/0014-mlxsw-qsfp_sysfs-Support-CPLD-version-reading-based-.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
From 7b3d375e329256d70df1552c210f81867ea285bd Mon Sep 17 00:00:00 2001
From: Vadim Pasternak <[email protected]>
Date: Sun, 18 Feb 2018 11:08:22 +0000
Subject: [backport 4.9 14/20] mlxsw: qsfp_sysfs: Support CPLD version reading
based on DMI system type

Add system type detection through DMI table in order to distinct between
the systems supporting reading only one CPLD version and capable of reading
the versions of three CPLDs.

Signed-off-by: Vadim Pasternak <[email protected]>
---
drivers/net/ethernet/mellanox/mlxsw/qsfp_sysfs.c | 42 +++++++++++++++++++++---
1 file changed, 37 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/qsfp_sysfs.c b/drivers/net/ethernet/mellanox/mlxsw/qsfp_sysfs.c
index 3bc6cf8..07cc7ea 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/qsfp_sysfs.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/qsfp_sysfs.c
@@ -33,6 +33,7 @@
*/

#include <linux/device.h>
+#include <linux/dmi.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/sysfs.h>
@@ -49,7 +50,8 @@
#define MLXSW_QSFP_MAX_NUM 64
#define MLXSW_QSFP_MIN_REQ_LEN 4
#define MLXSW_QSFP_STATUS_VALID_TIME (120 * HZ)
-#define MLXSW_QSFP_MAX_CPLD_NUM 1
+#define MLXSW_QSFP_MAX_CPLD_NUM 3
+#define MLXSW_QSFP_MIN_CPLD_NUM 1

static const u8 mlxsw_qsfp_page_number[] = { 0xa0, 0x00, 0x01, 0x02, 0x03 };
static const u16 mlxsw_qsfp_page_shift[] = { 0x00, 0x80, 0x80, 0x80, 0x80 };
@@ -85,6 +87,8 @@ struct mlxsw_qsfp {
struct device_attribute *cpld_dev_attrs;
};

+static int mlxsw_qsfp_cpld_num = MLXSW_QSFP_MIN_CPLD_NUM;
+
static int
mlxsw_qsfp_query_module_eeprom(struct mlxsw_qsfp *mlxsw_qsfp, u8 index,
loff_t off, size_t count, int page, char *buf)
@@ -210,11 +214,11 @@ mlxsw_qsfp_cpld_show(struct device *dev, struct device_attribute *attr,
u32 version, i;
int err;

- for (i = 0; i < MLXSW_QSFP_MAX_CPLD_NUM; i++) {
+ for (i = 0; i < mlxsw_qsfp_cpld_num; i++) {
if ((mlxsw_qsfp->cpld_dev_attrs + i) == attr)
break;
}
- if (i == MLXSW_QSFP_MAX_CPLD_NUM)
+ if (i == mlxsw_qsfp_cpld_num)
return -EINVAL;

mlxsw_reg_msci_pack(msci_pl, i);
@@ -227,6 +231,32 @@ mlxsw_qsfp_cpld_show(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "%u\n", version);
}

+static int __init mlxsw_qsfp_dmi_set_cpld_num(const struct dmi_system_id *dmi)
+{
+ mlxsw_qsfp_cpld_num = MLXSW_QSFP_MAX_CPLD_NUM;
+
+ return 1;
+};
+
+static struct dmi_system_id mlxsw_qsfp_dmi_table[] __initdata = {
+ {
+ .callback = mlxsw_qsfp_dmi_set_cpld_num,
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "MSN24"),
+ },
+ },
+ {
+ .callback = mlxsw_qsfp_dmi_set_cpld_num,
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "MSN27"),
+ },
+ },
+ { }
+};
+MODULE_DEVICE_TABLE(dmi, mlxsw_qsfp_dmi_table);
+
int mlxsw_qsfp_init(struct mlxsw_core *mlxsw_core,
const struct mlxsw_bus_info *mlxsw_bus_info,
struct mlxsw_qsfp **p_qsfp)
@@ -242,6 +272,8 @@ int mlxsw_qsfp_init(struct mlxsw_core *mlxsw_core,
if (!strcmp(mlxsw_bus_info->device_kind, "i2c"))
return 0;

+ dmi_check_system(mlxsw_qsfp_dmi_table);
+
mlxsw_qsfp = devm_kzalloc(mlxsw_bus_info->dev, sizeof(*mlxsw_qsfp),
GFP_KERNEL);
if (!mlxsw_qsfp)
@@ -285,7 +317,7 @@ int mlxsw_qsfp_init(struct mlxsw_core *mlxsw_core,
return -ENOMEM;

mlxsw_qsfp->cpld_dev_attrs = devm_kzalloc(mlxsw_bus_info->dev,
- MLXSW_QSFP_MAX_CPLD_NUM *
+ mlxsw_qsfp_cpld_num *
sizeof(*mlxsw_qsfp->cpld_dev_attrs),
GFP_KERNEL);
if (!mlxsw_qsfp->cpld_dev_attrs)
@@ -323,7 +355,7 @@ int mlxsw_qsfp_init(struct mlxsw_core *mlxsw_core,
}

cpld_dev_attr = mlxsw_qsfp->cpld_dev_attrs;
- for (i = 0; i < MLXSW_QSFP_MAX_CPLD_NUM; i++, cpld_dev_attr++) {
+ for (i = 0; i < mlxsw_qsfp_cpld_num; i++, cpld_dev_attr++) {
cpld_dev_attr->show = mlxsw_qsfp_cpld_show;
cpld_dev_attr->attr.mode = 0444;
cpld_dev_attr->attr.name = devm_kasprintf(mlxsw_bus_info->dev,
--
2.1.4

Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
From 1dff5178538466037b40edfb074ec2233b69b7d6 Mon Sep 17 00:00:00 2001
From: Vadim Pasternak <[email protected]>
Date: Sun, 18 Feb 2018 11:44:19 +0000
Subject: [backport 4.9 15/20] platform/x86: mlx-platform: Add support for new
msn201x system type

Patch contains:
- Additional reset causes fields for mlxreg-io.
- Fix for devm_ioport_map return value:
devm_ioport_map() returns NULL on error but we accidentally check for
error pointers instead.
- Fix for fan5 and fan6 mask bits.

Signed-off-by: Vadim Pasternak <[email protected]>
---
drivers/platform/x86/mlx-platform.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c
index 61cbe35..33fece8 100644
--- a/drivers/platform/x86/mlx-platform.c
+++ b/drivers/platform/x86/mlx-platform.c
@@ -472,14 +472,14 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_fan_items_data[] = {
{
.label = "fan5",
.reg = MLXPLAT_CPLD_LPC_REG_FAN_OFF,
- .mask = BIT(3),
+ .mask = BIT(4),
.hpdev.brdinfo = &mlxplat_mlxcpld_ng_fan,
.hpdev.nr = 15,
},
{
.label = "fan6",
.reg = MLXPLAT_CPLD_LPC_REG_FAN_OFF,
- .mask = BIT(3),
+ .mask = BIT(5),
.hpdev.brdinfo = &mlxplat_mlxcpld_ng_fan,
.hpdev.nr = 16,
},
@@ -943,10 +943,18 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_regs_io_data[] = {
GENMASK(7, 0) & ~BIT(0), 0x00, 0444 },
{ "cause_short_pb", MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFF,
GENMASK(7, 0) & ~BIT(1), 0x00, 0444 },
- { "cause_pwr_aux", MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFF,
+ { "cause_aux_pwr_or_refresh", MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFF,
GENMASK(7, 0) & ~BIT(2), 0x00, 0444 },
- { "cause_pwr_fail", MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFF,
+ { "cause_main_pwr_fail", MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFF,
GENMASK(7, 0) & ~BIT(3), 0x00, 0444 },
+ { "cause_sw_reset", MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFF,
+ GENMASK(7, 0) & ~BIT(4), 0x00, 0444 },
+ { "cause_fw_reset", MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFF,
+ GENMASK(7, 0) & ~BIT(5), 0x00, 0444 },
+ { "cause_hotswap_or_wd", MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFF,
+ GENMASK(7, 0) & ~BIT(6), 0x00, 0444 },
+ { "cause_asic_thermal", MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFF,
+ GENMASK(7, 0) & ~BIT(7), 0x00, 0444 },
{ "psu1_on", MLXPLAT_CPLD_LPC_REG_GP1_OFF, GENMASK(7, 0) & ~BIT(0),
0x00, 0200 },
{ "psu2_on", MLXPLAT_CPLD_LPC_REG_GP1_OFF, GENMASK(7, 0) & ~BIT(1),
@@ -1166,13 +1174,17 @@ static int __init mlxplat_init(void)

base = devm_ioport_map(&mlxplat_dev->dev,
mlxplat_lpc_resources[1].start, 1);
- if (IS_ERR(base))
+ if (!base) {
+ err = -ENOMEM;
goto fail_platform_mux_register;
+ }

mlxplat_hotplug->regmap = devm_regmap_init(&mlxplat_dev->dev, NULL,
base, &mlxplat_mlxcpld_regmap_config);
- if (IS_ERR(mlxplat_hotplug->regmap))
+ if (IS_ERR(mlxplat_hotplug->regmap)) {
+ err = PTR_ERR(mlxplat_hotplug->regmap);
goto fail_platform_mux_register;
+ }

/* Set default registers. */
for (j = 0; j < mlxplat_mlxcpld_regmap_config.num_reg_defaults; j++) {
--
2.1.4

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
From 487a2e6ffeb26d3ed36d68a472d15dc7894d9df9 Mon Sep 17 00:00:00 2001
From: Vadim Pasternak <[email protected]>
Date: Thu, 15 Mar 2018 14:01:03 +0000
Subject: [backport 4.9 16/20] platform/mellanox: mlxreg-hotplug: add extra run
cycle for hotplug work queue

It adds missed logic for signal acknowledge, by adding an extra run for
work queue in case no signal assertion is detected. This extra run will
allow to acknowlede the missed signal, which can happen for example in
case several units are remover or inserted at the same time.

Fixes: 1f976f6978bf ("platform/x86: Move Mellanox platform hotplug driver to platform/mellanox")
Signed-off-by: Vadim Pasternak <[email protected]>
---
drivers/platform/mellanox/mlxreg-hotplug.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c
index ba9241e..57fe24d 100644
--- a/drivers/platform/mellanox/mlxreg-hotplug.c
+++ b/drivers/platform/mellanox/mlxreg-hotplug.c
@@ -58,6 +58,7 @@
#define MLXREG_HOTPLUG_PROP_STATUS "status"

#define MLXREG_HOTPLUG_ATTRS_MAX 24
+#define MLXREG_HOTPLUG_NOT_ASSERT 3

/**
* struct mlxreg_hotplug_priv_data - platform private data:
@@ -74,6 +75,7 @@
* @cell: location of top aggregation interrupt register;
* @mask: top aggregation interrupt common mask;
* @aggr_cache: last value of aggregation register status;
+ * @not_asserted: number of entries in workqueue with no signal assertion;
*/
struct mlxreg_hotplug_priv_data {
int irq;
@@ -94,6 +96,7 @@ struct mlxreg_hotplug_priv_data {
u32 mask;
u32 aggr_cache;
bool after_probe;
+ u8 not_asserted;
};

#if defined(CONFIG_OF_DYNAMIC)
@@ -472,6 +475,13 @@ static void mlxreg_hotplug_work_handler(struct work_struct *work)
aggr_asserted = priv->aggr_cache ^ regval;
priv->aggr_cache = regval;

+ if (priv->not_asserted == MLXREG_HOTPLUG_NOT_ASSERT) {
+ priv->not_asserted = 0;
+ aggr_asserted = pdata->mask;
+ }
+ if (!aggr_asserted)
+ goto unmask_event;
+
/* Handle topology and health configuration changes. */
for (i = 0; i < pdata->counter; i++, item++) {
if (aggr_asserted & item->aggr_mask) {
@@ -503,6 +513,8 @@ static void mlxreg_hotplug_work_handler(struct work_struct *work)
return;
}

+unmask_event:
+ priv->not_asserted++;
/* Unmask aggregation event (no need acknowledge). */
ret = regmap_write(priv->regmap, pdata->cell +
MLXREG_HOTPLUG_AGGR_MASK_OFF, pdata->mask);
--
2.1.4

Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
From cfb83680ddb2c14dcb2dd5d855ec0c4d73bd89a3 Mon Sep 17 00:00:00 2001
From: Vadim Pasternak <[email protected]>
Date: Thu, 15 Mar 2018 17:46:38 +0000
Subject: [backport 4.9 17/20] platform: mellanox: add new OEM system types to
mlx-platform

Patch adds new OEM systems, matched according to DMI_BOARD_NAME.
The supported OEM Ids are: VMOD0001, VMOD0002, VMOD0003, VMOD0004,
VMOD0005.

Signed-off-by: Vadim Pasternak <[email protected]>
---
drivers/platform/x86/mlx-platform.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c
index 33fece8..2a2d00c 100644
--- a/drivers/platform/x86/mlx-platform.c
+++ b/drivers/platform/x86/mlx-platform.c
@@ -1055,7 +1055,7 @@ static int __init mlxplat_dmi_msn201x_matched(const struct dmi_system_id *dmi)
return 1;
};

-static struct dmi_system_id mlxplat_dmi_table[] __initdata = {
+static const struct dmi_system_id mlxplat_dmi_table[] __initconst = {
{
.callback = mlxplat_dmi_msn274x_matched,
.matches = {
@@ -1126,9 +1126,41 @@ static struct dmi_system_id mlxplat_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "SN34"),
},
},
+ {
+ .callback = mlxplat_dmi_default_matched,
+ .matches = {
+ DMI_MATCH(DMI_BOARD_NAME, "VMOD0001"),
+ },
+ },
+ {
+ .callback = mlxplat_dmi_msn21xx_matched,
+ .matches = {
+ DMI_MATCH(DMI_BOARD_NAME, "VMOD0002"),
+ },
+ },
+ {
+ .callback = mlxplat_dmi_msn274x_matched,
+ .matches = {
+ DMI_MATCH(DMI_BOARD_NAME, "VMOD0003"),
+ },
+ },
+ {
+ .callback = mlxplat_dmi_msn201x_matched,
+ .matches = {
+ DMI_MATCH(DMI_BOARD_NAME, "VMOD0004"),
+ },
+ },
+ {
+ .callback = mlxplat_dmi_qmb7xx_matched,
+ .matches = {
+ DMI_MATCH(DMI_BOARD_NAME, "VMOD0005"),
+ },
+ },
{ }
};

+MODULE_DEVICE_TABLE(dmi, mlxplat_dmi_table);
+
static int __init mlxplat_init(void)
{
struct mlxplat_priv *priv;
--
2.1.4

39 changes: 39 additions & 0 deletions patch/0018-platform-x86-mlx-platform-fix-module-aliases.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 1958bec50c3c98a2e964ada753de6020c1b461f6 Mon Sep 17 00:00:00 2001
From: Vadim Pasternak <[email protected]>
Date: Thu, 15 Mar 2018 18:02:40 +0000
Subject: [backport 4.9 18/20] platform/x86: mlx-platform: fix module aliases

Missing prefix 'pn' in MODULE_ALIAS lines causes the module to
not load automatically. The driver should use MODULE_DEVICE_TABLE
together with existing mlxplat_dmi_table instead.

commit 580d834fe166c695f37c942e9cd92d1743bdc5d4
Author: Ivan Vecera <[email protected]>
Fixes: 6613d18e9038 ("platform/x86: mlx-platform: Move module from arch/x86")

Signed-off-by: Vadim Pasternak <[email protected]>
---
drivers/platform/x86/mlx-platform.c | 10 ----------
1 file changed, 10 deletions(-)

diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c
index 2a2d00c..9ad1fc9 100644
--- a/drivers/platform/x86/mlx-platform.c
+++ b/drivers/platform/x86/mlx-platform.c
@@ -1301,13 +1301,3 @@ module_exit(mlxplat_exit);
MODULE_AUTHOR("Vadim Pasternak ([email protected])");
MODULE_DESCRIPTION("Mellanox platform driver");
MODULE_LICENSE("Dual BSD/GPL");
-MODULE_ALIAS("dmi:*:*Mellanox*:MSN24*:");
-MODULE_ALIAS("dmi:*:*Mellanox*:MSN27*:");
-MODULE_ALIAS("dmi:*:*Mellanox*:MSB*:");
-MODULE_ALIAS("dmi:*:*Mellanox*:MSX*:");
-MODULE_ALIAS("dmi:*:*Mellanox*:MSN21*:");
-MODULE_ALIAS("dmi:*:*Mellanox*MSN274*:");
-MODULE_ALIAS("dmi:*:*Mellanox*MSN201*:");
-MODULE_ALIAS("dmi:*:*Mellanox*QMB7*:");
-MODULE_ALIAS("dmi:*:*Mellanox*SN37*:");
-MODULE_ALIAS("dmi:*:*Mellanox*QM34*:");
--
2.1.4

Loading

0 comments on commit 060e06f

Please sign in to comment.