From nobody Fri Jun 19 13:40:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 933CEC433F5 for ; Mon, 4 Apr 2022 08:48:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243621AbiDDIt6 (ORCPT ); Mon, 4 Apr 2022 04:49:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239621AbiDDItf (ORCPT ); Mon, 4 Apr 2022 04:49:35 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA8DB3B56B; Mon, 4 Apr 2022 01:47:39 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 5E7761F4594A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1649062058; bh=D6HHjVxkjaNSQYpDgvwEk+llZiTyrRHbdq/ZOoDG6rg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QSIxsE45CjDX7/iYnmGN/pFbmRhviD905KjuKlVkffYcv5c58eojlKlvQIikbufDZ 4Qq6xdGxg8yea3Tdv2pU1aQk2lB3P6XkXVSFkl/TDN4igCSP2qft3qx/ZMpO9KuXzB lQO9pH2wpl1my+sgvwuJ8O4fZyXPftI+QuLjQuFtU46bINczce3NXz2KdP9ATDYa5H i87nXRTjXMSMhpGQiPGn1ut9485i77Av5QOLn4miB8VYv/qPBR7dr1FBZGx4vtTdRV LGK2N4pPm6MnmLVV6wJtUL7voEUaIHnRZy+l/B71m7rG5fv37rJGziWDKLEzfHgfkY 9UBspO3VLRh8g== From: AngeloGioacchino Del Regno To: lee.jones@linaro.org Cc: robh+dt@kernel.org, krzk+dt@kernel.org, arnd@arndb.de, matthias.bgg@gmail.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, nfraprado@collabora.com, kernel@collabora.com, krzysztof.kozlowski@linaro.org, AngeloGioacchino Del Regno Subject: [PATCH v2 1/2] mfd: syscon: Allow using spinlocks with regmap fast_io Date: Mon, 4 Apr 2022 10:47:31 +0200 Message-Id: <20220404084732.14096-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220404084732.14096-1-angelogioacchino.delregno@collabora.com> References: <20220404084732.14096-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On at least some SoCs accessing MMIO regions is very fast and in some cases acquiring a mutex for every IO operation brings a significant overhead: this is also the rationale of regmap's fast_io configuration parameter, which makes it switch to using a spinlock instead. Since the typical use-case for syscon is to give access to misc system registers (not representing any specific type of device) to one or more other drivers, and since this is done via regmap anyway, allow such devices to let syscon configure regmap with fast_io enabled and to let this happen, add a Devicetree property "fast-io": when this is found, syscon will set '.fast_io =3D true' in the regmap config. Of course, it makes little sense to do that if a syscon node declares a phandle to a hardware spinlock provider node, so we check for this property only if no hwlock is present. Signed-off-by: AngeloGioacchino Del Regno --- drivers/mfd/syscon.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index 191fdb87c424..3fcd9afdb9ef 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -101,6 +101,10 @@ static struct syscon *of_syscon_register(struct device= _node *np, bool check_clk) } } =20 + /* Checking for fast-io makes sense only if not using hwspinlock */ + if (!syscon_config.use_hwlock && of_property_read_bool(np, "fast-io")) + syscon_config.fast_io =3D true; + syscon_config.name =3D kasprintf(GFP_KERNEL, "%pOFn@%llx", np, (u64)res.start); syscon_config.reg_stride =3D reg_io_width; --=20 2.35.1 From nobody Fri Jun 19 13:40:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDD5AC433EF for ; Mon, 4 Apr 2022 08:47:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242441AbiDDItx (ORCPT ); Mon, 4 Apr 2022 04:49:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240506AbiDDItf (ORCPT ); Mon, 4 Apr 2022 04:49:35 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0033A3B577; Mon, 4 Apr 2022 01:47:39 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 2C2291F4594C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1649062058; bh=S50/Hcr9j9pF7DFx0XZaG5Lg/9YZaQvfERAo6Uzrf2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IAQJFLlLFt/+CSfNqJpqiK03y6QdsUYR9Fxn8RkhlNObY+OToJsp3bsYB4j7nQ/41 OqwGzxAEmHg1cR+Ef+LLuW8jkftYMJydxdr2+OpP8jBXhSNBBfhBoLbDKzyv5zWLrT 3hlxfXRAAvbG7ATR7ek4gk8LoZe991Ngj9Efb6094hBOysIB603gnW4pzHrT7GXfrN xAbAlNALN17GX3DRcXbFhISisYC9vxGiz83b4IoTBMtMhPDxlBDhznJYRpJjT+yBdI y8TDF3km8BIKppP7rdE+DLvzKrEgDzOjldCoLCwFVL89iQel/igBwbD6n41zvx/XKe rLhWftGdZ/RLQ== From: AngeloGioacchino Del Regno To: lee.jones@linaro.org Cc: robh+dt@kernel.org, krzk+dt@kernel.org, arnd@arndb.de, matthias.bgg@gmail.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, nfraprado@collabora.com, kernel@collabora.com, krzysztof.kozlowski@linaro.org, AngeloGioacchino Del Regno Subject: [PATCH v2 2/2] dt-bindings: mfd: syscon: Add support for regmap fast-io Date: Mon, 4 Apr 2022 10:47:32 +0200 Message-Id: <20220404084732.14096-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220404084732.14096-1-angelogioacchino.delregno@collabora.com> References: <20220404084732.14096-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The syscon driver now enables the .fast_io regmap configuration when the 'fast-io' property is found in a syscon node. Keeping in mind that, in regmap, fast_io is checked only if we are not using hardware spinlocks, allow the fast-io property only if there is no hwlocks reference (and vice-versa). Signed-off-by: AngeloGioacchino Del Regno --- Documentation/devicetree/bindings/mfd/syscon.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/syscon.yaml b/Documentat= ion/devicetree/bindings/mfd/syscon.yaml index 13baa452cc9d..621b0983b115 100644 --- a/Documentation/devicetree/bindings/mfd/syscon.yaml +++ b/Documentation/devicetree/bindings/mfd/syscon.yaml @@ -83,11 +83,26 @@ properties: $ref: /schemas/types.yaml#/definitions/uint32 enum: [1, 2, 4, 8] =20 + fast-io: + description: + Indicates that this bus has a very fast IO, for which + different locking methods should be used to reduce + overhead (e.g. spinlock instead of mutex). + type: boolean + hwlocks: maxItems: 1 description: Reference to a phandle of a hardware spinlock provider node. =20 +if: + required: + - hwlocks +then: + not: + required: + - fast-io + required: - compatible - reg --=20 2.35.1