History

platform/mellanox: mlxreg-hotplug: Add support for new capability register

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.

Vadim Pasternak committed 6 years ago

Commit 0e41bf01 parent 48454602 files · +16 −0Browse files

Unified · Split

2 files
  1. drivers/platform/mellanox/mlxreg-hotplug.c +14 −0
  2. include/linux/platform_data/mlxreg.h +2 −0
drivers/platform/mellanox/mlxreg-hotplug.c+14−0
@@ -504,6 +504,20 @@ static int mlxreg_hotplug_set_irq(struct mlxreg_hotplug_priv_data *priv) · 503 unmodified lines
504504 item = pdata->items;
505505
506506 for (i = 0; i < pdata->counter; i++, item++) {
507+ if (item->capability) {
508+ /*
509+ * Read group capability register to get actual number
510+ * of interrupt capable components and set group mask
511+ * accordingly.
512+ */
513+ ret = regmap_read(priv->regmap, item->capability,
514+ &regval);
515+ if (ret)
516+ goto out;
517+
518+ item->mask = GENMASK((regval & item->mask) - 1, 0);
519+ }
520+
507521 /* Clear group presense event. */
508522 ret = regmap_write(priv->regmap, item->reg +
509523 MLXREG_HOTPLUG_EVENT_OFF, 0);
include/linux/platform_data/mlxreg.h+2−0
@@ -101,6 +101,7 @@ struct mlxreg_core_data { · 100 unmodified lines
101101 * @aggr_mask: group aggregation mask;
102102 * @reg: group interrupt status register;
103103 * @mask: group interrupt mask;
104+ * @capability: group capability register;
104105 * @cache: last status value for elements fro the same group;
105106 * @count: number of available elements in the group;
106107 * @ind: element's index inside the group;
@@ -112,6 +113,7 @@ struct mlxreg_core_item { · 5 unmodified lines
112113 u32 aggr_mask;
113114 u32 reg;
114115 u32 mask;
116+ u32 capability;
115117 u32 cache;
116118 u8 count;
117119 u8 ind;