mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vadim Pasternak <vadimp@mellanox.com>
To: andy@infradead.org, dvhart@infradead.org
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Vadim Pasternak <vadimp@mellanox.com>
Subject: [PATCH platform-next v2 09/10] platform/mellanox: mlxreg-hotplug: Add support for new capability register
Date: Sun, 12 Jan 2020 12:18:48 +0000	[thread overview]
Message-ID: <20200112121849.7056-10-vadimp@mellanox.com> (raw)
In-Reply-To: <20200112121849.7056-1-vadimp@mellanox.com>

Add 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.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
---
 drivers/platform/mellanox/mlxreg-hotplug.c | 14 ++++++++++++++
 include/linux/platform_data/mlxreg.h       |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c
index 706207d192ae..77be37a1fbcf 100644
--- a/drivers/platform/mellanox/mlxreg-hotplug.c
+++ b/drivers/platform/mellanox/mlxreg-hotplug.c
@@ -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,
+					  &regval);
+			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);
diff --git a/include/linux/platform_data/mlxreg.h b/include/linux/platform_data/mlxreg.h
index 6d54fe3bcac9..b8da8aef2446 100644
--- a/include/linux/platform_data/mlxreg.h
+++ b/include/linux/platform_data/mlxreg.h
@@ -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;
-- 
2.11.0


  parent reply	other threads:[~2020-01-12 12:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-12 12:18 [PATCH platform-next v2 00/10] platform/x86: Mellanox new system classes and new features Vadim Pasternak
2020-01-12 12:18 ` [PATCH platform-next v2 01/10] platform/x86: mlx-platform: Cosmetic changes Vadim Pasternak
2020-01-12 12:18 ` [PATCH platform-next v2 02/10] Documentation/ABI: Fix documentation inconsistency for mlxreg-io sysfs interfaces Vadim Pasternak
2020-01-12 12:18 ` [PATCH platform-next v2 03/10] Documentation/ABI: Add missed attribute " Vadim Pasternak
2020-01-13 14:12   ` Andy Shevchenko
2020-01-12 12:18 ` [PATCH platform-next v2 04/10] platform/x86: mlx-platform: Add more definitions for system attributes Vadim Pasternak
2020-01-12 12:18 ` [PATCH platform-next v2 05/10] Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces Vadim Pasternak
2020-01-13 14:13   ` Andy Shevchenko
2020-01-12 12:18 ` [PATCH platform-next v2 06/10] platform/x86: mlx-platform: Set system mux configuration based on system type Vadim Pasternak
2020-01-12 12:18 ` [PATCH platform-next v2 07/10] platform/x86: mlx-platform: Add support for new " Vadim Pasternak
2020-01-12 12:18 ` [PATCH platform-next v2 08/10] platform/x86: mlx-platform: Add support for new capability register Vadim Pasternak
2020-01-12 12:18 ` Vadim Pasternak [this message]
2020-01-12 12:18 ` [PATCH platform-next v2 10/10] platform/x86: mlx-platform: Add support for next generation systems Vadim Pasternak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200112121849.7056-10-vadimp@mellanox.com \
    --to=vadimp@mellanox.com \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®