From nobody Mon Jun 29 07:49:25 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 02453C433EF for ; Mon, 14 Feb 2022 11:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352093AbiBNL4E (ORCPT ); Mon, 14 Feb 2022 06:56:04 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:56262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352161AbiBNLzy (ORCPT ); Mon, 14 Feb 2022 06:55:54 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 157D9C4E; Mon, 14 Feb 2022 03:55:46 -0800 (PST) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 0A7CF22236; Mon, 14 Feb 2022 12:55:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1644839744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/NjyFjKbCBQABoYhh6yk7oefa153RWchuWsomjveFjg=; b=cLlopmktfsW2Su2/BF5oD3dmXrJdVBp7e+nx9xDE9tR70srUoNWajIlm9mOnGAKjYPzBwF Zs3RvvTw1bW739lx+6MGdoHRR7IyIBTDaD5VDRBz3CCDZ1kMG/yn5Rh65PQHtAkfKY/R1f 9XgsetiXgdjiJUMgk3zN7e7vSXkwV8o= From: Michael Walle To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski , Shawn Guo , Li Yang Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Walle , Rob Herring Subject: [PATCH v2 1/3] dt-bindings: nvmem: add fsl,layerscape-sfp binding Date: Mon, 14 Feb 2022 12:55:27 +0100 Message-Id: <20220214115529.662948-2-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220214115529.662948-1-michael@walle.cc> References: <20220214115529.662948-1-michael@walle.cc> 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 Security Fuse Processor provides efuses and is responsible for reading it at SoC startup and configuring it accordingly. Signed-off-by: Michael Walle Reviewed-by: Rob Herring --- .../bindings/nvmem/fsl,layerscape-sfp.yaml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/fsl,layerscape-= sfp.yaml diff --git a/Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yam= l b/Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yaml new file mode 100644 index 000000000000..80914b93638e --- /dev/null +++ b/Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yaml @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvmem/fsl,layerscape-sfp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale Layerscape Security Fuse Processor + +maintainers: + - Michael Walle + +description: | + SFP is the security fuse processor which among other things provide a + unique identifier per part. + +allOf: + - $ref: "nvmem.yaml#" + +properties: + compatible: + enum: + - fsl,ls1028a-sfp + + reg: + maxItems: 1 + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + efuse@1e80000 { + compatible =3D "fsl,ls1028a-sfp"; + reg =3D <0x1e80000 0x8000>; + }; --=20 2.30.2 From nobody Mon Jun 29 07:49:25 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 2612FC433EF for ; Mon, 14 Feb 2022 11:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352081AbiBNL4C (ORCPT ); Mon, 14 Feb 2022 06:56:02 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:56264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352160AbiBNLzy (ORCPT ); Mon, 14 Feb 2022 06:55:54 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 075DBC4F; Mon, 14 Feb 2022 03:55:47 -0800 (PST) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 8FE99223ED; Mon, 14 Feb 2022 12:55:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1644839744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XdrWzXvwdyDha3PoHg7ahk1iBkB7OCPIMJ5xDq82tO8=; b=UTUYxxQAxs74jboS+0cvb37wr27P1aCq5qAUGy5NVq1pYi1b5T6dz3tXi3vAdz4gehuu2H c0XQe9k2v3e/uEV6LQXmX7UhZn9xu+wSfmweZm6XCUl5D/bicHi9fAE3eG2MDSo1eikWf9 YHPtRFzxCxoaARJBtBTEXJuJv05cyJY= From: Michael Walle To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski , Shawn Guo , Li Yang Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Walle Subject: [PATCH v2 2/3] nvmem: add driver for Layerscape SFP (Security Fuse Processor) Date: Mon, 14 Feb 2022 12:55:28 +0100 Message-Id: <20220214115529.662948-3-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220214115529.662948-1-michael@walle.cc> References: <20220214115529.662948-1-michael@walle.cc> 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" Add support for the Security Fuse Processor found on Layerscape SoCs. This driver implements basic read access. Signed-off-by: Michael Walle --- drivers/nvmem/Kconfig | 12 +++++ drivers/nvmem/Makefile | 2 + drivers/nvmem/layerscape-sfp.c | 89 ++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 drivers/nvmem/layerscape-sfp.c diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index 94dd60b2654e..63792082e476 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -307,4 +307,16 @@ config NVMEM_BRCM_NVRAM This driver provides support for Broadcom's NVRAM that can be accessed using I/O mapping. =20 +config NVMEM_LAYERSCAPE_SFP + tristate "Layerscape SFP (Security Fuse Processor) support" + depends on ARCH_LAYERSCAPE || COMPILE_TEST + depends on HAS_IOMEM + help + This driver provides support to read the eFuses on Freescale + Layerscape SoC's. For example, the vendor provides a per part + unique ID there. + + This driver can also be built as a module. If so, the module + will be called layerscape-sfp. + endif diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile index 4e6d877fdfaf..914358fcdb37 100644 --- a/drivers/nvmem/Makefile +++ b/drivers/nvmem/Makefile @@ -62,3 +62,5 @@ obj-$(CONFIG_NVMEM_RMEM) +=3D nvmem-rmem.o nvmem-rmem-y :=3D rmem.o obj-$(CONFIG_NVMEM_BRCM_NVRAM) +=3D nvmem_brcm_nvram.o nvmem_brcm_nvram-y :=3D brcm_nvram.o +obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) +=3D nvmem-layerscape-sfp.o +nvmem-layerscape-sfp-y :=3D layerscape-sfp.o diff --git a/drivers/nvmem/layerscape-sfp.c b/drivers/nvmem/layerscape-sfp.c new file mode 100644 index 000000000000..e591c1511e33 --- /dev/null +++ b/drivers/nvmem/layerscape-sfp.c @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Layerscape SFP driver + * + * Copyright (c) 2022 Michael Walle + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#define LAYERSCAPE_SFP_OTP_OFFSET 0x0200 + +struct layerscape_sfp_priv { + void __iomem *base; +}; + +struct layerscape_sfp_data { + int size; +}; + +static int layerscape_sfp_read(void *context, unsigned int offset, void *v= al, + size_t bytes) +{ + struct layerscape_sfp_priv *priv =3D context; + + memcpy_fromio(val, priv->base + LAYERSCAPE_SFP_OTP_OFFSET + offset, + bytes); + + return 0; +} + +static struct nvmem_config layerscape_sfp_nvmem_config =3D { + .name =3D "fsl-sfp", + .reg_read =3D layerscape_sfp_read, +}; + +static int layerscape_sfp_probe(struct platform_device *pdev) +{ + const struct layerscape_sfp_data *data; + struct layerscape_sfp_priv *priv; + struct nvmem_device *nvmem; + + priv =3D devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->base =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + + data =3D device_get_match_data(&pdev->dev); + + layerscape_sfp_nvmem_config.size =3D data->size; + layerscape_sfp_nvmem_config.dev =3D &pdev->dev; + layerscape_sfp_nvmem_config.priv =3D priv; + + nvmem =3D devm_nvmem_register(&pdev->dev, &layerscape_sfp_nvmem_config); + + return PTR_ERR_OR_ZERO(nvmem); +} + +static const struct layerscape_sfp_data ls1028a_data =3D { + .size =3D 0x88, +}; + +static const struct of_device_id layerscape_sfp_dt_ids[] =3D { + { .compatible =3D "fsl,ls1028a-sfp", .data =3D &ls1028a_data }, + {}, +}; +MODULE_DEVICE_TABLE(of, layerscape_sfp_dt_ids); + +static struct platform_driver layerscape_sfp_driver =3D { + .probe =3D layerscape_sfp_probe, + .driver =3D { + .name =3D "layerscape_sfp", + .of_match_table =3D layerscape_sfp_dt_ids, + }, +}; +module_platform_driver(layerscape_sfp_driver); + +MODULE_AUTHOR("Michael Walle "); +MODULE_DESCRIPTION("Layerscape Security Fuse Processor driver"); +MODULE_LICENSE("GPL"); --=20 2.30.2 From nobody Mon Jun 29 07:49:25 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 C482BC433EF for ; Mon, 14 Feb 2022 11:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351981AbiBNLz7 (ORCPT ); Mon, 14 Feb 2022 06:55:59 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:56266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352167AbiBNLzy (ORCPT ); Mon, 14 Feb 2022 06:55:54 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AAC0C51; Mon, 14 Feb 2022 03:55:47 -0800 (PST) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 8756C223EF; Mon, 14 Feb 2022 12:55:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1644839745; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Lgm3+ejR5iCeubB0LLMdHYvyTni/SmF/Frp1FWA+zQ=; b=Ih6TLdDvJPtLctBVsDxiJhcD2Eb5ETy4cU/e0NdRiw+vZxdYAv66Pml8YcN95UjUf4XryW /BXGj0pNOEaGqtBiz/Q6FQ10BvOqGBRsfN4Gjl/3HljIppgnckGvx+5JMPzOEsC2z2Yzrm YoHEYnb2PEr4ntfxo4xRfTsWNcQORKc= From: Michael Walle To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski , Shawn Guo , Li Yang Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Walle Subject: [PATCH v2 3/3] arm64: dts: ls1028a: add efuse node Date: Mon, 14 Feb 2022 12:55:29 +0100 Message-Id: <20220214115529.662948-4-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220214115529.662948-1-michael@walle.cc> References: <20220214115529.662948-1-michael@walle.cc> 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" Layerscape SoCs contain a Security Fuse Processor which is basically a efuse controller. Add the node, so userspace can read the efuses. Signed-off-by: Michael Walle --- arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/bo= ot/dts/freescale/fsl-ls1028a.dtsi index 7d44102d9c6c..4b248cee830a 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi @@ -224,6 +224,17 @@ rst: syscon@1e60000 { little-endian; }; =20 + efuse@1e80000 { + compatible =3D "fsl,ls1028a-sfp"; + reg =3D <0x0 0x1e80000 0x0 0x10000>; + #address-cells =3D <1>; + #size-cells =3D <1>; + + ls1028a_uid: unique-id@1c { + reg =3D <0x1c 0x8>; + }; + }; + scfg: syscon@1fc0000 { compatible =3D "fsl,ls1028a-scfg", "syscon"; reg =3D <0x0 0x1fc0000 0x0 0x10000>; --=20 2.30.2