From nobody Fri Jun 19 15:55:02 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 6C65DC433FE for ; Fri, 1 Apr 2022 13:51:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346504AbiDANxB (ORCPT ); Fri, 1 Apr 2022 09:53:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346490AbiDANw6 (ORCPT ); Fri, 1 Apr 2022 09:52:58 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88C0E1C6483; Fri, 1 Apr 2022 06:51:05 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id CB0561F41AD5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1648821064; bh=D6HHjVxkjaNSQYpDgvwEk+llZiTyrRHbdq/ZOoDG6rg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LUZHUjcmCUE2VmJHiAhRDw4Ka4RbZfwKueOMM7/s3ULtLQcQX/xJYyVHGxvbjZxoc GjfgSb/VcGGFvAYqU0xE8qPjtETk3gd+t6urWg1MNR0IDZV7zpeSm05fjApS/Ljr1S NbDsWnGils9jKI2w5d0APf5IfNqo3g7Iz7RQyqFSL/GCaWXbmQvkjDBSjFuWvkqt3V BPdIYGCYaAT2sXPneYgQAjxQjG0mFCt1+cwbo+NGxIsSvuoSsxkw0vKX6CgPjxnUCK betaRPBNtOkhJOEh1U3j9lA1tuk1SJVbDIK2eWfP5oGl+YD+mLCfWKjrSOV4ImtPZ8 YCywSboYVwICg== 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, AngeloGioacchino Del Regno Subject: [PATCH 1/2] mfd: syscon: Allow using spinlocks with regmap fast_io Date: Fri, 1 Apr 2022 15:50:47 +0200 Message-Id: <20220401135048.23245-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220401135048.23245-1-angelogioacchino.delregno@collabora.com> References: <20220401135048.23245-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 15:55:02 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 F40F3C433EF for ; Fri, 1 Apr 2022 13:51:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346516AbiDANxD (ORCPT ); Fri, 1 Apr 2022 09:53:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346492AbiDANw6 (ORCPT ); Fri, 1 Apr 2022 09:52:58 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 426E81C6490; Fri, 1 Apr 2022 06:51:06 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 821301F41C6C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1648821065; bh=4ga0haARvqzGPiyyyt4tWRKPqw/63CPmbmTUs4qGJ3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dhpkztki5+AjyK5hQG+xNcDGcijGvtqA5JVjwtmg8LtTtw6i/WnWsUdqDwRbhHJgF upxSgAY0ngHLzGa9FTnU6VWZnRjnKIZ7MoOQ5/+dJp7evVlvRwVuTYfm4JLMAuEBAp el7LarJicw6tjsmzr0vOp25tAR8VwSbLxh/a+615yI+ZBV+FWr12onZF41/lyT4RCk 4FiWczSy5/IuhuMWxg3KIQ2iRc22OglqkDFkxXRkzKOknq4wD83JiA1FOxKDh1O2fS 72F4BUfNj/2WqhNBPDoINQeJ7NAwJUET8HcuAMCvyDxw6y4MGznBFHRYMVIIsvjELv TMwNBeZNYRuPQ== 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, AngeloGioacchino Del Regno Subject: [PATCH 2/2] dt-bindings: mfd: syscon: Add support for regmap fast-io Date: Fri, 1 Apr 2022 15:50:48 +0200 Message-Id: <20220401135048.23245-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220401135048.23245-1-angelogioacchino.delregno@collabora.com> References: <20220401135048.23245-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..85a2e83b5861 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 + acquiring a mutex would be significant overhead. + When present, regmap will use a spinlock instead. + 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