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
504 item = pdata->items;504 item = pdata->items;
505 505
506 for (i = 0; i < pdata->counter; i++, item++) {506 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
507 /* Clear group presense event. */521 /* Clear group presense event. */
508 ret = regmap_write(priv->regmap, item->reg +522 ret = regmap_write(priv->regmap, item->reg +
509 MLXREG_HOTPLUG_EVENT_OFF, 0);523 MLXREG_HOTPLUG_EVENT_OFF, 0);
include/linux/platform_data/mlxreg.h+2−0
@@ -101,6 +101,7 @@ struct mlxreg_core_data { · 100 unmodified lines
101 * @aggr_mask: group aggregation mask;101 * @aggr_mask: group aggregation mask;
102 * @reg: group interrupt status register;102 * @reg: group interrupt status register;
103 * @mask: group interrupt mask;103 * @mask: group interrupt mask;
104 * @capability: group capability register;
104 * @cache: last status value for elements fro the same group;105 * @cache: last status value for elements fro the same group;
105 * @count: number of available elements in the group;106 * @count: number of available elements in the group;
106 * @ind: element's index inside the group;107 * @ind: element's index inside the group;
@@ -112,6 +113,7 @@ struct mlxreg_core_item { · 5 unmodified lines
112 u32 aggr_mask;113 u32 aggr_mask;
113 u32 reg;114 u32 reg;
114 u32 mask;115 u32 mask;
116 u32 capability;
115 u32 cache;117 u32 cache;
116 u8 count;118 u8 count;
117 u8 ind;119 u8 ind;