Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4139772ybl; Mon, 13 Jan 2020 08:30:13 -0800 (PST) X-Google-Smtp-Source: APXvYqxhsf9tIzJxurRn2+w57d4sjlBsdaJz/Q0wnGcH7GOhypGr0CimDruIGawzE1pWSAKwjCrX X-Received: by 2002:aca:4fc2:: with SMTP id d185mr13384186oib.33.1578933013394; Mon, 13 Jan 2020 08:30:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578933013; cv=none; d=google.com; s=arc-20160816; b=XxC5uaNs22EGLvQcFtBSKiE26UAd4eCaDRpX7sUu6LyAwQqEC2gvpQYkVMNRIGytzo PpKzRmMC1TFMQKaBUDxsZGkkCV601Tw7eK/LnDFw7vjzUdOnCJdWs8LGPFssq6OtLk5w p0eVSzD8jMejN5Qp3yyCKGth2TJ4Dt0tG07jMbr4zmDpZTjOAOlpR8PEjcm90HaCL5iu scuhhpdC4ormk3JKzxPwDbOPUBZo5DWGD9K79Mo908AbqVJWfSpV1awI+Pd8qbEhnkia altpVOzQYlYsfaFin85HLfZ7v34II9lMURyuTJsc3YymlEDw+TFlKFpl6u99WB2Do3pf zCDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=RZSMj54fCpPEt1IVcNlzj6gz8I3TtnK3x0gvCfFA/tc=; b=eG3bYNa0kUV3PLYCAPELz9SvJ0J9sJjG3bzWoRlNjvl1uoqU1q7904kGbbOjczxGK3 BvjMPAxCM1tOY5Mf5pHaI9DbX6qxS1G20CsiI80NFWkGoBMtu0SOpIkrQGRE6su+bwf2 r4AsecKcbMtB17Phise5lAg0NK0CDxqLgntLcoLccwJYJa6MhLxgQvwG+CSTlvkBUnPF YfKZaIwqvm+6Pv2ehI/InztpLlEhnhEiX3PEa16fNVAcmUAg+ss5huOnonUd8dBGdBN0 8L4USLyrmhXVD5An7ICsmzLxosU5D8gZrc8ElLeJa/7o8tqyelRVurAdPQy/k74yJo1y yKRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e24si6394222otl.62.2020.01.13.08.30.00; Mon, 13 Jan 2020 08:30:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729146AbgAMQ2y (ORCPT + 99 others); Mon, 13 Jan 2020 11:28:54 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:38006 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729125AbgAMQ2x (ORCPT ); Mon, 13 Jan 2020 11:28:53 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from vadimp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 13 Jan 2020 18:28:49 +0200 Received: from r-build-lowlevel.mtr.labs.mlnx. (r-build-lowlevel.mtr.labs.mlnx [10.209.0.190]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 00DGSeff032667; Mon, 13 Jan 2020 18:28:49 +0200 From: Vadim Pasternak To: andy@infradead.org, dvhart@infradead.org Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Vadim Pasternak Subject: [PATCH platform-next v3 10/11] platform/mellanox: mlxreg-hotplug: Add support for new capability register Date: Mon, 13 Jan 2020 16:28:38 +0000 Message-Id: <20200113162839.18103-11-vadimp@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200113162839.18103-1-vadimp@mellanox.com> References: <20200113162839.18103-1-vadimp@mellanox.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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, + ®val); + 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