From nobody Thu Sep 24 20:03:14 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63D8D4A2617; Mon, 21 Sep 2026 14:36:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790001371; cv=none; b=ITzUgttRyNYKNIzExWiq2f3zQ04eVrAcL1qQw3yRA6Jb7n+8bDbNUH0XYlRCxckZ3oIEvuQ+Cg5ch69mdcDysRs8BjWY3Ar74ix21vIv4O+Ts/+yMjSjwqO87UJvoxJYJVJ8WdKesfXvXgTywz/lux4yyJoWb1+bjUprZuiwoKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790001371; c=relaxed/simple; bh=ZIK0xCkexQBqyQJA96xFqjCpNT9qXiTKF+FxrGI34Pk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YvX0Xp0cJWMhuQG481zUT1bUMd/gY2z/7SrisJfsuIWpToFOo066AUvklps/j4FRD0iRsXncHXwU4MN1LitnZd3ms+OQZMZ3e4QLoeg6VZDB5kseCHVFoizfmDLzERLiTWHMB7WzYH3hgGr20lWgCsK9+mi5cairOA7GJa+Tpek= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r05i/Pej; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r05i/Pej" Received: by smtp.kernel.org (Postfix) with ESMTPS id D9E04C2BCB8; Mon, 21 Sep 2026 14:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1790001370; bh=ZIK0xCkexQBqyQJA96xFqjCpNT9qXiTKF+FxrGI34Pk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=r05i/PejEXJfMAmTiMpbQ7/UfVCxSSEuKOGtiDxwd0JxdoDdbECGC3fpYHhVXOws0 J5CKtVmfMwXXe7EuvQjVsYm4MZj3kmTuGDHy0RrqmTspNWJu8Nn7LIHA+hH2tMnXRi OxQY0RxbaUxXsGiRYPotTUtgHQhW7nnO271bchKy31D1tykTS9/OGYzijRoLSvDRiH TqLEdl5CNDOqqMy+sSoZHFCT6IzDI9ibqTSvO0w2I9+jVJavHM3wWP1fMHOt6veFQD wJU2rTRNQIhw+OvIhnEU7w4gMxQPbsI38/62ZhAQgfA7V0MwyMlM2/X86inCjfJCSU Rg0CCJmgdkzWA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7C93C982EE; Mon, 21 Sep 2026 14:36:10 +0000 (UTC) From: Roman Vivchar via B4 Relay Date: Mon, 21 Sep 2026 17:35:47 +0300 Subject: [PATCH v4 1/3] dt-bindings: nvmem: mediatek: efuse: add mt6572 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260921-6572-nvmem-v4-1-e9c14156559a@protonmail.com> References: <20260921-6572-nvmem-v4-0-e9c14156559a@protonmail.com> In-Reply-To: <20260921-6572-nvmem-v4-0-e9c14156559a@protonmail.com> To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Andrew-CT Chen , Lala Lin Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Roman Vivchar X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790001369; l=1140; i=rva333@protonmail.com; s=20260510; h=from:subject:message-id; bh=5K32Q1swD4S3cSggeXC/0toQquH0mxZvBxfpkIPi+IU=; b=vN0LQ6RrUvamCnJ3YNAb1NmCBNxWbR1qb6O4xG+Yo+hFue9REj1sTD2uAKhHpARSpX17c7SlD 0GPpYNQY6z6DrrpgVXrJH+q+uTxZ8jnCorvR57pliwVopbBLWNkC9Yp X-Developer-Key: i=rva333@protonmail.com; a=ed25519; pk=zww/nWjBGoQ4POXCG0BV6fx2iuXK6jx77rsKPA5YK5Y= X-Endpoint-Received: by B4 Relay for rva333@protonmail.com/20260510 with auth_id=777 X-Original-From: Roman Vivchar Reply-To: rva333@protonmail.com From: Roman Vivchar Add a compatible string for the mt6572 SoC efuse controller. Reviewed-by: Rob Herring (Arm) Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Roman Vivchar --- Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml b/= Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml index f9323b3ecfc8..e10947164941 100644 --- a/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml +++ b/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml @@ -24,13 +24,16 @@ properties: =20 compatible: oneOf: + - enum: + - mediatek,mt6572-efuse + - mediatek,mt8186-efuse + - items: - enum: - mediatek,mt8188-efuse - mediatek,mt8189-efuse - mediatek,mt8196-efuse - const: mediatek,mt8186-efuse - - const: mediatek,mt8186-efuse =20 - items: - enum: --=20 2.55.0 From nobody Thu Sep 24 20:03:14 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63CF04A1DF5; Mon, 21 Sep 2026 14:36:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790001371; cv=none; b=EXa20pAX9U1gS0Ht2iq/6KrR/HZ+K1gTCUlfl4hv7dz4TboJPY53LVbrtqZSxQ0KCmK/J0g11BNxS7EOjsSntmlTiCzuo+zWz7zTLLXbfMhKn4vz+k+H/CTbgoHfLVz9iYYdi1Xhv83T0ydBktBcYuCGCguV+LFq+39XM8SWGLs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790001371; c=relaxed/simple; bh=dVWdIA6jcIe0iWHDTwaO7naqquNUBOM3dPKEaK1Eh+U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jABdLSR1tblu2V8WouIiKNevQLtjb+OsRkXjnBqeDWzu4qxV9/Z2KWBqoN/TRELf7NeC8M+31cWE9fHz73LDBDWY/VkrqZjE0FZju57M0eTLIoRLiye/GBq4K8LmnSG21Fxt1mOsXFLn5dYMx5jlesbDdKY1sG6iv40kHLR7wpw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YMmg3fZ1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YMmg3fZ1" Received: by smtp.kernel.org (Postfix) with ESMTPS id E8769C2BCF7; Mon, 21 Sep 2026 14:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1790001371; bh=dVWdIA6jcIe0iWHDTwaO7naqquNUBOM3dPKEaK1Eh+U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=YMmg3fZ1903PF9HgBUicrLFLMtXM6N16h6/lvcpSDxXbGmlSzqwawT6KIeeBhIdYE F0rVpmFUp7v519M3a2KDysh2wrjy4b5HeWQ6lEwlSe9lp3aobh8VxLltvxWkTStTQD /L92ybg++iSJ/dtExWnPqivRxPAktksULPYhaXGPdugiHkzC+xWGKPn+g3gq4ldRLj p5qhM+qXsb18onuL+zpzhFXj1VZIXeN86NK7Lb0KteD3KT0o3gE+4j4c4YKgzHIsp+ lzSjHk/xx0y2/JXImt8qOfHjoLftdEa1vvQG9MQZ87WCxFrmi3z/ewAodALKj6yFI9 R/vv+ySr/XiWQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6769C982E6; Mon, 21 Sep 2026 14:36:10 +0000 (UTC) From: Roman Vivchar via B4 Relay Date: Mon, 21 Sep 2026 17:35:48 +0300 Subject: [PATCH v4 2/3] nvmem: mtk-efuse: add support for 32-bit aligned reads Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260921-6572-nvmem-v4-2-e9c14156559a@protonmail.com> References: <20260921-6572-nvmem-v4-0-e9c14156559a@protonmail.com> In-Reply-To: <20260921-6572-nvmem-v4-0-e9c14156559a@protonmail.com> To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Andrew-CT Chen , Lala Lin Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Roman Vivchar X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790001369; l=2576; i=rva333@protonmail.com; s=20260510; h=from:subject:message-id; bh=PlUtOStRK66yTGiZ19W5bDjNAyxn6+b3O2rJne7Jc/o=; b=paCcPUNM7D8m/r78mYsodol2oWP6+5d0pxEOjysIBr6yNg5qAECkrDINSFhtEcZOVWpkfGmzS w9Cou12BZIZDz3nSCOD/s74M67rmCbGbi+IQEM8ucVDGCkWzapEs4X6 X-Developer-Key: i=rva333@protonmail.com; a=ed25519; pk=zww/nWjBGoQ4POXCG0BV6fx2iuXK6jx77rsKPA5YK5Y= X-Endpoint-Received: by B4 Relay for rva333@protonmail.com/20260510 with auth_id=777 X-Original-From: Roman Vivchar Reply-To: rva333@protonmail.com From: Roman Vivchar Some MediaTek SoCs, such as mt6572, don't support 8-bit reads, leading to zeroes or garbage data. 32-bit aligned reads must be used instead. Introduce a 'mtk_reg_read_aligned' helper to enforce 32-bit aligned register access. All reads will be performed by reading 4-byte words and masking them. Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Roman Vivchar --- drivers/nvmem/mtk-efuse.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/mtk-efuse.c b/drivers/nvmem/mtk-efuse.c index 00a84ea963a8..980c29d01337 100644 --- a/drivers/nvmem/mtk-efuse.c +++ b/drivers/nvmem/mtk-efuse.c @@ -4,6 +4,7 @@ * Author: Andrew-CT Chen */ =20 +#include #include #include #include @@ -13,12 +14,37 @@ =20 struct mtk_efuse_pdata { bool uses_post_processing; + bool needs_aligned_read; }; =20 struct mtk_efuse_priv { void __iomem *base; }; =20 +static int mtk_reg_read_aligned(void *context, + unsigned int reg, void *_val, size_t bytes) +{ + struct mtk_efuse_priv *priv =3D context; + u8 *val =3D _val; + u32 i, pos, shift, val32; + + for (i =3D 0; i < bytes; i++, val++) { + pos =3D reg + i; + + /* + * Read on 32-bit word boundary or if it's the first + * iteration + */ + if (i =3D=3D 0 || IS_ALIGNED(pos, 4)) + val32 =3D readl(priv->base + (pos & ~3)); + + shift =3D (pos & 3) * 8; + *val =3D (val32 >> shift) & 0xff; + } + + return 0; +} + static int mtk_reg_read(void *context, unsigned int reg, void *_val, size_t bytes) { @@ -81,7 +107,12 @@ static int mtk_efuse_probe(struct platform_device *pdev) econfig.add_legacy_fixed_of_cells =3D true; econfig.stride =3D 1; econfig.word_size =3D 1; - econfig.reg_read =3D mtk_reg_read; + + if (pdata->needs_aligned_read) + econfig.reg_read =3D mtk_reg_read_aligned; + else + econfig.reg_read =3D mtk_reg_read; + econfig.size =3D resource_size(res); econfig.priv =3D priv; econfig.dev =3D dev; @@ -102,10 +133,12 @@ static int mtk_efuse_probe(struct platform_device *pd= ev) =20 static const struct mtk_efuse_pdata mtk_mt8186_efuse_pdata =3D { .uses_post_processing =3D true, + .needs_aligned_read =3D false, }; =20 static const struct mtk_efuse_pdata mtk_efuse_pdata =3D { .uses_post_processing =3D false, + .needs_aligned_read =3D false, }; =20 static const struct of_device_id mtk_efuse_of_match[] =3D { --=20 2.55.0 From nobody Thu Sep 24 20:03:14 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63C154A0142; Mon, 21 Sep 2026 14:36:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790001371; cv=none; b=MEyZaEH6p1JnF+1Ek5Y3jR64Cps34oO+Uimnq0aQ5l4JDlrVKa7D76mgZ4pPXMmPb6TZ702paecyWzf0JznR1TRtILm+cVMoPPdEMyIsJSBazn0mfA90xSPM63IEQ1eAd7ARyNVXyLaPuoWWj6uDXCYRcCW4RjjE2zqRJal86nQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790001371; c=relaxed/simple; bh=/RydMHtFmmBYus0MrR48LToVwrPUhgabAvoP9PIGA6Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Zsj1g56pqLNAIldfSRaGd22JzQpFXHIaQp9X7wdTueOl9KvAM7j5k0jQUN+wt+wUuZOSQMsWE7hLzPPQ+qHZX0S+4H2lTvHbISQPVFOiIGbvBZnZAKGnvdk5ui7FLNPVG2ScEsNxMh16jPi9aLxl0GIPzJtcnaCXlaPDrzG76dM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rsp5+wxT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rsp5+wxT" Received: by smtp.kernel.org (Postfix) with ESMTPS id 00DC3C2BCFC; Mon, 21 Sep 2026 14:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1790001371; bh=/RydMHtFmmBYus0MrR48LToVwrPUhgabAvoP9PIGA6Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=rsp5+wxTyNHclGpTFt0NGQXMf0ahNzrz9KJlhtygJ+zTAl6OrHNmFUungT8q1DS09 FjMlpqvKtvIH2n8r8+EMrjeWON2kxSAycKXgvPpTdNNVzu/sPbWnyS6xfqmLobx6NP G5RY6y8GKtgDrPUMFaOCQEatl1bIorYnpnQi3lulFEIJK3cADZQFug0wAp52kth/qb PVxLu89bbHA/TwmTaguSIGS2nitfh+W+GLInbOCBvBRmpq27PdyERX7hR4RKfWCXd0 OiRfY6I2Db8+jIQyLQzNrTKwv27jW6WbJe92rtN62ZG8Kn56SnZD8WzU6PDRVYAnDV tjSdyw13MQWiQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5E2EC982F8; Mon, 21 Sep 2026 14:36:10 +0000 (UTC) From: Roman Vivchar via B4 Relay Date: Mon, 21 Sep 2026 17:35:49 +0300 Subject: [PATCH v4 3/3] nvmem: mtk-efuse: add mt6572 support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260921-6572-nvmem-v4-3-e9c14156559a@protonmail.com> References: <20260921-6572-nvmem-v4-0-e9c14156559a@protonmail.com> In-Reply-To: <20260921-6572-nvmem-v4-0-e9c14156559a@protonmail.com> To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Andrew-CT Chen , Lala Lin Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Roman Vivchar X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790001369; l=1270; i=rva333@protonmail.com; s=20260510; h=from:subject:message-id; bh=xNpih/0wX5BB+DZCyvEE4EZcS9hf5v5IbyspXQH1sz4=; b=lQfi3rcoqxM26rYqiq3bdUfpJqvAXdKZsW6kWv2PX/ps2k/moNydRJooy2jRo67aZWa92Xxwz dgNzuOabuoEA0ujfG0LmGrMa2s8dybc+OU7Pzaky9T4g1uYPRgBsOAU X-Developer-Key: i=rva333@protonmail.com; a=ed25519; pk=zww/nWjBGoQ4POXCG0BV6fx2iuXK6jx77rsKPA5YK5Y= X-Endpoint-Received: by B4 Relay for rva333@protonmail.com/20260510 with auth_id=777 X-Original-From: Roman Vivchar Reply-To: rva333@protonmail.com From: Roman Vivchar Add a platform data struct for the efuse controller. Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Roman Vivchar --- drivers/nvmem/mtk-efuse.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/nvmem/mtk-efuse.c b/drivers/nvmem/mtk-efuse.c index 980c29d01337..43cc2da2cc1d 100644 --- a/drivers/nvmem/mtk-efuse.c +++ b/drivers/nvmem/mtk-efuse.c @@ -131,6 +131,11 @@ static int mtk_efuse_probe(struct platform_device *pde= v) return 0; } =20 +static const struct mtk_efuse_pdata mtk_mt6572_efuse_pdata =3D { + .uses_post_processing =3D false, + .needs_aligned_read =3D true, +}; + static const struct mtk_efuse_pdata mtk_mt8186_efuse_pdata =3D { .uses_post_processing =3D true, .needs_aligned_read =3D false, @@ -142,6 +147,7 @@ static const struct mtk_efuse_pdata mtk_efuse_pdata =3D= { }; =20 static const struct of_device_id mtk_efuse_of_match[] =3D { + { .compatible =3D "mediatek,mt6572-efuse", .data =3D &mtk_mt6572_efuse_pd= ata }, { .compatible =3D "mediatek,mt8173-efuse", .data =3D &mtk_efuse_pdata }, { .compatible =3D "mediatek,mt8186-efuse", .data =3D &mtk_mt8186_efuse_pd= ata }, { .compatible =3D "mediatek,efuse", .data =3D &mtk_efuse_pdata }, --=20 2.55.0