Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp15155498ybl; Tue, 31 Dec 2019 02:31:52 -0800 (PST) X-Google-Smtp-Source: APXvYqyvmhj4DKHl5ZmSOPreiyTewHTHdE1AGw/7uYlhCVuRX4QtT6xTLfHFRDU3+FgvLaqSTNDt X-Received: by 2002:a9d:754a:: with SMTP id b10mr80678682otl.273.1577788312245; Tue, 31 Dec 2019 02:31:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577788312; cv=none; d=google.com; s=arc-20160816; b=da+nXgOiyNTsbCxa1VCOHdY/iSNBngJVz1WhKAROVrGu+2FNRLrQ7xoUlrEAlY2nMz 14IyQHlTebpp3Bmc/vGZmkTf6NCI66J64qLPdp7E/xkKf33PoZmNPBtgV5iV3d0UkPqk 9SDA9UnEO60igw4CC41SYI3DfQc5gu0tcQ+j2wwk7/RKjEOCopT8hqflIo3mGNQJSmvs rNQ+UtV4cx6Gbxd7/t2Tpgzc+zrsQFeGWPgepDVdP3w4HkZdZA70h24/3dvLwb69x/Xp PgRgTRzRVzhrv6zDPTO0POe2I77CAz3aUqkMkcGRl/zKBiPWg0cykJxD3gjWxnkXkSMk DtCQ== 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=Qh2ICC5h8xJSkaUUKWhQX0zcLy4iDLJagt7TlJqNUA2PQ6gUKbZO56Ehr1bM5VCwjE ZVjGNuEXiBtcPnBD1CV54LKQoX5vuhfHFO3XxlKBxrGY06dDia5qEyFuLYDfzENdvcXE 5OHk/SSrfBPPtTRd4ImHFnOYN4HoMdd01q81iqagiuxa9cdLmDxHIDufVQIlBFfkvSlf bOXMOMJsA7ctboOMvfh+Dd3qbRAOrEMwbfo7oyaUHEFw1J3UREDcz82bUN7qLoa7PoxD kxWZzrFoP6CYpX7o4SbH81dPCH5ApzqtXrLBqRxRAH+EBwCJdWNkujvx2ITvQ+Q6Qb5L dx9A== 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 u3si23545915oif.167.2019.12.31.02.31.40; Tue, 31 Dec 2019 02:31:52 -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 S1727213AbfLaK3s (ORCPT + 99 others); Tue, 31 Dec 2019 05:29:48 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:60245 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727134AbfLaK3b (ORCPT ); Tue, 31 Dec 2019 05:29:31 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from vadimp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 31 Dec 2019 12:29:28 +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 xBVATJ7f008518; Tue, 31 Dec 2019 12:29:28 +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 v1 8/9] platform/mellanox: mlxreg-hotplug: Add support for new capability register Date: Tue, 31 Dec 2019 10:29:16 +0000 Message-Id: <20191231102917.24181-9-vadimp@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191231102917.24181-1-vadimp@mellanox.com> References: <20191231102917.24181-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