From nobody Fri Dec 19 10:41:13 2025 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A17D820FA9C for ; Mon, 2 Sep 2024 14:30:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287404; cv=none; b=A133rtKPW2fYBWldUkzvWR/QrgqFVysD4ipYb3dUwO/jRmZTpYcoVUHdh6+jd8Xo8aAtLwCP0jQWLsOG7yBSs8a4sBKeJXDJN8+iMw7WChHK4zSUPiMPWbivt3vPozwEjJdFALFPRm0jGkjTnI3/PC8uthlea6pwt4kfBqnqlTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287404; c=relaxed/simple; bh=Zxcd9LkyYaOSN8fvwJ1xNiYaqqcaXioGlDiVsAE7nXg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bWaAd78RPe9n62n2BDDXI7UWuHikjgK1gqKURDzSQUeENT7dkqRExZkrpiEEI6ryet8XMdcOezBt/W/5Y8UMVd4aqvMwTlFFfxc/cxBTs8IZ++KjBvzk5PnZp6ZNXze82eczG5JItv+5YktC4jzEVTW6Ir1wASilW8yWn6AQ3zk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=dOZN8l2K; arc=none smtp.client-ip=209.85.218.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dOZN8l2K" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a869f6ce2b9so468695566b.2 for ; Mon, 02 Sep 2024 07:30:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725287401; x=1725892201; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f9WpMPcffP4bVIHfwlm0A0QBWfa2okRCbCAWMVHxhp8=; b=dOZN8l2KCr2Y+vGtCzd3Q+SiA8sFntkZAdmxRZXTHWxXh/y6X7TiT0Hd5b5ltE3Dcv 6U2ICQcIgy3xIVNnStc6UIznGjGypt+mV74UALn8qpWr2GipE+iv2gqG2fLx5NfClKFK uW7+Zo4f4WgeaTEQ1qd1HISQbraFMiD1OqXcnIZtV14YBvvApy7ySVEIXYNe9I7Tu7Ec gv8O9DLlWtwyypsxDcDXOFd91gLiRSAm0vIqg6qlxC3HFP/cLmgPYzP0lTv+8mMspVvK bd89+7vZye0mCw60j6b1GqL6ZsccHlMLoMAItoE35ELrUvcS3tO3jIL3TX242sBlkz/F XUGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725287401; x=1725892201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f9WpMPcffP4bVIHfwlm0A0QBWfa2okRCbCAWMVHxhp8=; b=DK9glJhWKFX5FzaktBRn7p960pyfWfd/OJNiIrKkLMewOKKwHw+xHuhZIpu2xganep cQMZZVpYLqoHK/DMTDm/Svyo52GHHTkgRggt2yWRLOJc+WkmUIKxYGo48R9aFGGfTicQ 7zg7xUPHE0HfgqHp46sHbt8YtMhZd6Ljk4cut3u+5AyTI/J5SxIua59azxW7O6p5kq9/ TRl/wRSwRNtnhvIzZK0MmUTC7O22/MNJxPb9RzazgNBJqKLUFqS8tUTturZ+F3LuJfgn fn6fcvDieWRSJCRh1/EzrnhsYnni3Lir7w8IcmNGNHvhQcQI2oOhau3oRjoQR46V+xJy Z9zQ== X-Gm-Message-State: AOJu0Yxb6obnDXKign6N9QmZzRDHf3QPnArLgyy6Z3x8IH7F/ebTWCHR kwbS28YHY+v/6rLD0Sd5EiLpsuDRfRs7sIp3961c5NZAxBHjY1bZV4nsSCTS74E= X-Google-Smtp-Source: AGHT+IHh4os20I7TL5kdbM9kzi/iA3oh1B8pPaRa8MBFGxXYwl/jTfa24TfHXNsPjAh7hUGEhbliFw== X-Received: by 2002:a17:907:d8c:b0:a7a:aa35:409e with SMTP id a640c23a62f3a-a897f875407mr1216860666b.25.1725287400995; Mon, 02 Sep 2024 07:30:00 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a89891d80fcsm566011666b.181.2024.09.02.07.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 07:30:00 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Peng Fan , Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 1/9] dt-bindings: nvmem: imx-ocotp: support i.MX95 Date: Mon, 2 Sep 2024 15:29:44 +0100 Message-Id: <20240902142952.71639-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> References: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Peng Fan Add i.MX95 ocotp compatible string Signed-off-by: Peng Fan Acked-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml b/Docum= entation/devicetree/bindings/nvmem/imx-ocotp.yaml index e21c06e9a741..b2cb76cf9053 100644 --- a/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml +++ b/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml @@ -14,7 +14,7 @@ maintainers: description: | This binding represents the on-chip eFuse OTP controller found on i.MX6Q/D, i.MX6DL/S, i.MX6SL, i.MX6SX, i.MX6UL, i.MX6ULL/ULZ, i.MX6SLL, - i.MX7D/S, i.MX7ULP, i.MX8MQ, i.MX8MM, i.MX8MN i.MX8MP and i.MX93 SoCs. + i.MX7D/S, i.MX7ULP, i.MX8MQ, i.MX8MM, i.MX8MN i.MX8MP and i.MX93/5 SoCs. =20 allOf: - $ref: nvmem.yaml# @@ -36,6 +36,7 @@ properties: - fsl,imx8mq-ocotp - fsl,imx8mm-ocotp - fsl,imx93-ocotp + - fsl,imx95-ocotp - const: syscon - items: - enum: --=20 2.25.1 From nobody Fri Dec 19 10:41:13 2025 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7887C2101A6 for ; Mon, 2 Sep 2024 14:30:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287406; cv=none; b=Tu1r5sdF1x6vIBvhkj8zg8i/x2LxVdb2Tr/wnTIoh/pGny7bOHC+QOFJAgq/njeT1bFbOvUEsRsRbDcVN/YbFpO8//0zUn7Waxy0jQaiQwg2bZUMJGHdwLQF2pniVfbYC5hNRxa8N+2bgs0zrOvtPn/Y/QxISJrzxqDiKds3dsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287406; c=relaxed/simple; bh=6S/BL58l6DGslYCysih6MHL7TQa+dxFbkVKivoprPbg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=U0mulsXR80RIgNINNW42viKlxvikDWGe97l3w0huYCrLU9z8c+1+DsEVG0chnvYlLXCLg37lJXAmNLJ7IuXBnDHmUkQcDMfyLNYTOiDN5T0X4dJgXCC/wicSaqr8Op3jejGReW1BJ0B4UgiII+ZGUAbb+hQCsaqD1WEB+zt18a8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wf/joCvH; arc=none smtp.client-ip=209.85.208.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wf/joCvH" Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2f3f163e379so69491221fa.3 for ; Mon, 02 Sep 2024 07:30:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725287403; x=1725892203; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FQxhPfaSfEzPkFbIFbbXZUYpGA0UFHQtGXmB6Sa6n/8=; b=wf/joCvHBCikFDYVotv0hB3RJo1hRrBPj7Qhf3BUpS0tsYghKJkwgZt1t+HHUVLxF8 baIjF8Wx62QV4X3R2ux12NykffTJY09a5ht6x3U/gGTj89LDkZniU1/JtkcZyXmffm3K AWU16NEcY5WV3H9amAn2WzAKpwwAiV5GFi1Mk8+Sq41utmPmhu/XRLB5FaRtOVVoeJ8H uYwr056p0kHCbIPjxbxcre1JZaiHMYegfGOuy2PKMnv3tyIqNl2CUzBolM1TPlhG5gCU D+W/MgurQpPmtA2ajUCU8qanzyUn9hsLOtJPfyU6yL5QWJE/bqWFlxt9BElIfvkN4Peo RIDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725287403; x=1725892203; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FQxhPfaSfEzPkFbIFbbXZUYpGA0UFHQtGXmB6Sa6n/8=; b=wR+K1Oaqhcm7cGPsV62Gx9Ly/jLUQmTVMqYUVqbEIZhJRCKULHdARyVy9LIC+HVOJM +gKAKe4//E5HyeQM40gXKLHNrh5FnVUzj1I3lrtFUHilhzPXk9VvTaf4assZvln/54ib Fj+AOYsC9gINaXA78PrpwJCYg9GFjvAOGngLhfXuE8LqNFp0LYZGqJV10a3T3w3Zc8rs nO/uGbXok7QnRlkXOlibRoYftC15huz21RghRHmlOMcjtUebnBKZnpL1koNuIJBHfZXn rM82atH6/O+iwrU+WGQjkWpR/8gPhmuhMNkVB9zdVtaNmBLuQNAFfWBRJK6DfS28EyrU KmxA== X-Gm-Message-State: AOJu0Yx30juv/jA08O8ikIpXgLzH2v8XPzOt2u+//gSystGDEIY4tqUv vfWBOlSe6nwcHnXhWLY2OxiSiYmBqy/Vgh+CRlxafGNQeKscgnBB1oQ63RAI2QE= X-Google-Smtp-Source: AGHT+IHUBOhCeHWiu2UPzso0/FqzEudFCnhMC1OGTyF1ZmMpGjeRgQlzF4CynvEu565yi7iUuWD83Q== X-Received: by 2002:a05:6512:1294:b0:533:c9d:a01f with SMTP id 2adb3069b0e04-53546b1e1c2mr8611155e87.4.1725287402416; Mon, 02 Sep 2024 07:30:02 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a89891d80fcsm566011666b.181.2024.09.02.07.30.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 07:30:01 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Peng Fan , Srinivas Kandagatla Subject: [PATCH 2/9] nvmem: imx-ocotp-ele: support i.MX95 Date: Mon, 2 Sep 2024 15:29:45 +0100 Message-Id: <20240902142952.71639-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> References: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Peng Fan i.MX95 OCOTP has same accessing method, so add an entry for i.MX95, but some fuse has ECC feature, so only read out the lower 16bits for ECC fuses. Signed-off-by: Peng Fan Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/imx-ocotp-ele.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/nvmem/imx-ocotp-ele.c b/drivers/nvmem/imx-ocotp-ele.c index cf920542f939..1ba494497698 100644 --- a/drivers/nvmem/imx-ocotp-ele.c +++ b/drivers/nvmem/imx-ocotp-ele.c @@ -14,8 +14,9 @@ #include =20 enum fuse_type { - FUSE_FSB =3D 1, - FUSE_ELE =3D 2, + FUSE_FSB =3D BIT(0), + FUSE_ELE =3D BIT(1), + FUSE_ECC =3D BIT(2), FUSE_INVALID =3D -1 }; =20 @@ -93,7 +94,10 @@ static int imx_ocotp_reg_read(void *context, unsigned in= t offset, void *val, siz continue; } =20 - *buf++ =3D readl_relaxed(reg + (i << 2)); + if (type & FUSE_ECC) + *buf++ =3D readl_relaxed(reg + (i << 2)) & GENMASK(15, 0); + else + *buf++ =3D readl_relaxed(reg + (i << 2)); } =20 memcpy(val, (u8 *)p, bytes); @@ -155,8 +159,30 @@ static const struct ocotp_devtype_data imx93_ocotp_dat= a =3D { }, }; =20 +static const struct ocotp_devtype_data imx95_ocotp_data =3D { + .reg_off =3D 0x8000, + .reg_read =3D imx_ocotp_reg_read, + .size =3D 2048, + .num_entry =3D 12, + .entry =3D { + { 0, 1, FUSE_FSB | FUSE_ECC }, + { 7, 1, FUSE_FSB | FUSE_ECC }, + { 9, 3, FUSE_FSB | FUSE_ECC }, + { 12, 24, FUSE_FSB }, + { 36, 2, FUSE_FSB | FUSE_ECC }, + { 38, 14, FUSE_FSB }, + { 63, 1, FUSE_ELE }, + { 128, 16, FUSE_ELE }, + { 188, 1, FUSE_ELE }, + { 317, 2, FUSE_FSB | FUSE_ECC }, + { 320, 7, FUSE_FSB }, + { 328, 184, FUSE_FSB } + }, +}; + static const struct of_device_id imx_ele_ocotp_dt_ids[] =3D { { .compatible =3D "fsl,imx93-ocotp", .data =3D &imx93_ocotp_data, }, + { .compatible =3D "fsl,imx95-ocotp", .data =3D &imx95_ocotp_data, }, {}, }; MODULE_DEVICE_TABLE(of, imx_ele_ocotp_dt_ids); --=20 2.25.1 From nobody Fri Dec 19 10:41:13 2025 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22A742101A4 for ; Mon, 2 Sep 2024 14:30:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287408; cv=none; b=G82iPu5uOe3DZTgaeOPdJXRPcgudYRMwnZ4ZtiWbxo9klmg+A6ToGGAJ6hpe6ZMn/FKrBxrl0p0udMMKncYAFc/QmNSjAymUdcHIeAOIQpE7Zj7C5oBWeT/gK7V4cNQUk+pvznzxVG3Die1c78CdPRkyPNa80z+yT5Ll59Ddfbo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287408; c=relaxed/simple; bh=h5zRnSqV6ZjYe7APYo72vG+udW0w8mr58ffVRWIhG/k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Zd9zhXiHSb0RD69iH7BQAjciXmAMj/7qNSaS5lU2brk2GOlj98ayIV2pNpQxY+tCDTQ6NmKOGKDYIL6TfM+a3EE/31xh5Vdseve5Wp0H3HTQ1vtutNxXcqbgG0kUwGz23KOZaXa50U9XssAHOCreqvxqB8ztr7JSaMjVFgGgefY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=C30CjmmP; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="C30CjmmP" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-533463f6b16so5451919e87.1 for ; Mon, 02 Sep 2024 07:30:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725287404; x=1725892204; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Uw/A+psE7NhGXyP2Q8ULoJ+2L7aFu1+StWQ11Vu7C+U=; b=C30CjmmPYEs7u/GNN5OTWkQNsKM0mwzmtMTWBvZac3Q7d6L0BlnRBnMRfl29tSjIua ho1ryXDoj46p3Kb4LOntJC2XS/0yjOhhEiGPxRY3PnmqdNZmX1IzecThFmq5LKtgyU3d 6YJLCHWKzqMRbveneJ8qt//GbJXXt8qFX2MRf4Pmx2thi2FME5SL2RFVhlzxm4rbEDgX OyGUGD9IJIys+RGVENOqzD7HaAEync+skA9Sb25HqxXHhy2RpA9adXki7Xem+iI2p+dD EW59sUd6pNzpfLkmros8qFDen4pD0EDvqVLqOGidBmg36lIjgAsm8YB/Jfr9Iamz1B5L V7Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725287404; x=1725892204; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uw/A+psE7NhGXyP2Q8ULoJ+2L7aFu1+StWQ11Vu7C+U=; b=LmjFcYyIyJznFBZXFOBavJA743oZYmXWeAizBviX7QfL8D3aLnUR9h2p6F6iS3seRv 8XEOsfl49++oM4dT8Y423g4AapGeK5jcJy/GO1ELoElek1QuuT+9ZwHecti3QNKE8T+p Qq6VTIkWyehKOH+RFFDACIScVcBjRudMt6rRemdV9uAsulXpsXnxzq8BtYZk4e3EEZ59 ntlTeZwIbmX4v3+mEcuqNsX5KMqMJc8iiqNijSEAdI9IIfOD9uDmgFCg0cJNxwzBFHCE FkwkfxbyFzh0SyOOjnbR27kJkP/9AGXFMV3LoEM2B/yTLb//Yb5uXzJ4B0IlTSHprF+x vf1w== X-Gm-Message-State: AOJu0YxEdeIi+jM6R9ntam7iWu7JiumiHdhTjChM8JHnVinenCmNAbVp Z69rYwnm7Pvq6CaHpL29Ie88qwK23U7zlMM070KGX3ml/jTCtewZQMzNJpA1i+ysygNa9WcnSRJ 4 X-Google-Smtp-Source: AGHT+IHtMYM9NUyJ6BH+L3sxKU/gxl5azI4XsHviIEiPjFmV6nStxz5798arhccnqTkWTHloZKAoBQ== X-Received: by 2002:a05:6512:3085:b0:52c:d56f:b2cc with SMTP id 2adb3069b0e04-53546bb8a31mr7297929e87.58.1725287403971; Mon, 02 Sep 2024 07:30:03 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a89891d80fcsm566011666b.181.2024.09.02.07.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 07:30:03 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Rob Herring , Srinivas Kandagatla Subject: [PATCH 3/9] dt-bindings: nvmem: convert U-Boot env to a layout Date: Mon, 2 Sep 2024 15:29:46 +0100 Message-Id: <20240902142952.71639-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> References: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> 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 From: Rafa=C5=82 Mi=C5=82ecki U-Boot environment variables can be stored in various data sources. MTD is just one of available options. Refactor DT binding into a layout so it can be used with UBI volumes and other NVMEM devices. Link: https://lore.kernel.org/all/20231221173421.13737-1-zajec5@gmail.com/ Signed-off-by: Rafa=C5=82 Mi=C5=82ecki Reviewed-by: Rob Herring (Arm) Signed-off-by: Srinivas Kandagatla --- .../bindings/nvmem/layouts/nvmem-layout.yaml | 1 + .../nvmem/{ =3D> layouts}/u-boot,env.yaml | 39 ++++++++++++++++--- 2 files changed, 35 insertions(+), 5 deletions(-) rename Documentation/devicetree/bindings/nvmem/{ =3D> layouts}/u-boot,env.= yaml (75%) diff --git a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.y= aml b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml index 3b40f7880774..382507060651 100644 --- a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml +++ b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml @@ -21,6 +21,7 @@ oneOf: - $ref: fixed-layout.yaml - $ref: kontron,sl28-vpd.yaml - $ref: onie,tlv-layout.yaml + - $ref: u-boot,env.yaml =20 properties: compatible: true diff --git a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml b/Docu= mentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml similarity index 75% rename from Documentation/devicetree/bindings/nvmem/u-boot,env.yaml rename to Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml index 9c36afc7084b..56a8f55d4a09 100644 --- a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml +++ b/Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml @@ -1,10 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause %YAML 1.2 --- -$id: http://devicetree.org/schemas/nvmem/u-boot,env.yaml# +$id: http://devicetree.org/schemas/nvmem/layouts/u-boot,env.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# =20 -title: U-Boot environment variables +title: U-Boot environment variables layout =20 description: | U-Boot uses environment variables to store device parameters and @@ -21,9 +21,6 @@ description: | This binding allows marking storage device (as containing env data) and specifying used format. =20 - Right now only flash partition case is covered but it may be extended to= e.g. - UBI volumes in the future. - Variables can be defined as NVMEM device subnodes. =20 maintainers: @@ -42,6 +39,7 @@ properties: const: brcm,env =20 reg: + description: Partition offset and size for env on top of MTD maxItems: 1 =20 bootcmd: @@ -58,6 +56,17 @@ properties: description: The first argument is a MAC address offset. const: 1 =20 +allOf: + - if: + properties: + $nodename: + not: + contains: + pattern: "^partition@[0-9a-f]+$" + then: + properties: + reg: false + additionalProperties: false =20 examples: @@ -101,3 +110,23 @@ examples: }; }; }; + - | + partition@0 { + reg =3D <0x0 0x100000>; + label =3D "ubi"; + compatible =3D "linux,ubi"; + + volumes { + ubi-volume-u-boot-env { + volname =3D "env"; + + nvmem-layout { + compatible =3D "u-boot,env"; + + ethaddr { + #nvmem-cell-cells =3D <1>; + }; + }; + }; + }; + }; --=20 2.25.1 From nobody Fri Dec 19 10:41:13 2025 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 428352139D4 for ; Mon, 2 Sep 2024 14:30:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287409; cv=none; b=jV8yVZXT2AJ6SA89CazqaTN63nHquRIL3cvvY4etbVIG8JwtXf7PyroLd9MFwhhovrystT7N3iMSAPpnpQTS2TbCUHLa0xQEV3bn8aZSjNr78tG0Hkz0zRlnCiTQeMuH5lEHb323hGznj4CaNmjBI1lyRAdAt5niawHwW9FL1zo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287409; c=relaxed/simple; bh=OZXuY3cQ9xSUMe1OTeToyetEbeQvBV3CFuNh/O3taII=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Be6EhCwpN0BKqUIOlIBK2ACG8CvjiCXNdt5oK7cSnOypeAGWdeWKzOnjRfyd7HRZ1gAOE6k7HdS2VNBz5ArREL63Auja/r6quUqHDzdjiv4+0BTtbtKc4FfACCF0RMIpOOwNOd/wnPq4LdK80stVVGqITKSFAdllceUm/+LJ9m4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=AaOK6Lnh; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AaOK6Lnh" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a866cea40c4so493032166b.0 for ; Mon, 02 Sep 2024 07:30:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725287406; x=1725892206; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CiHzQdGJx/N4Z82L7sOxh+UNWEAgunkMyshPM8qewns=; b=AaOK6LnhdQ8NtaLIHLbVcsjHbN/KEUa6HdsumZ7ty0eLLq7XCBIAjYmyyQSaVG1aM0 4ooSEn/irDTosdh2eo5Z6PeplA3LIl+D5jTXXnPYyu5eTQ8kdA985KHuLyUDWATqGDFP Y+FDJYMwNm2UoQp7UlmmWuTvhWJ+sPcJMf1+OFmzlMBLJFEpPi6o5MKfS9SDvVgRulTK forYDxXtLFzhcTCgDFFTmwqGnbmgdFjMkKh/02l2CAuXFPnLDNuU53yMnpCcOBWHUKCB yCv7TCcvaNaRjkHIjygybxHSZOJ1xZsjWke7Y1WgVgHrLMCgXlnejX4QRNM1JX4qPMyD zgdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725287406; x=1725892206; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CiHzQdGJx/N4Z82L7sOxh+UNWEAgunkMyshPM8qewns=; b=aeHNb6idd+FaU6iP6aY4hFbnU5IlPjZ32T6l9PKe2nA5JpAR870TFJbWQ/RvZVmHPa rUwIbTbcCN7kvO9emDVUAcV6vqcuoYlr13TvkRFzucIRlERIxrBBUClMeSQ476d5nZ21 MnDqlSL4IETclNyWksLc/vZtHBx6me/Rm5j3SMngWhfnavqXWpsbCisRtaP6sZ8r5Wrg gyGnrIuslqQQa4lTjqECQcnB86/LA4u0RsrUEkScSd8wWfmqyAx4QvvPRg5BI43xe9Ea BYa7EGSD4VeXdI6sQmuKBdNkbzL8Oy+Rr/2cL+4N6xP3h7KH+pbXk4aei1iO12aVg5gp +AXw== X-Gm-Message-State: AOJu0Yxy+Xku7k0ayiks+Hw7EVEal/kbGl50YQpRUKP9+ow161Xd2du+ YMW75z8JYpVrKUD6aYL78Yab9SJuc3dxHionYNYmh+3NiYTAR1MK+4RGMCG/bww= X-Google-Smtp-Source: AGHT+IEEym1ZQmYhL+1fI3zsAui2SzYjv+tSBWlmxMkUuLRDp1KAdojbUk3ExsDl1cnPUuSApwTr+A== X-Received: by 2002:a17:907:944c:b0:a7a:bcbc:f7e1 with SMTP id a640c23a62f3a-a8a1d2c28afmr37786666b.15.1725287405538; Mon, 02 Sep 2024 07:30:05 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a89891d80fcsm566011666b.181.2024.09.02.07.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 07:30:04 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 4/9] nvmem: layouts: add U-Boot env layout Date: Mon, 2 Sep 2024 15:29:47 +0100 Message-Id: <20240902142952.71639-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> References: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> 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 From: Rafa=C5=82 Mi=C5=82ecki U-Boot environment variables are stored in a specific format. Actual data can be placed in various storage sources (MTD, UBI volume, EEPROM, NVRAM, etc.). Move all generic (NVMEM device independent) code from NVMEM device driver to an NVMEM layout driver. Then add a simple NVMEM layout code on top of it. This allows using NVMEM layout for parsing U-Boot env data stored in any kind of NVMEM device. The old NVMEM glue driver stays in place for handling bindings in the MTD context. To avoid code duplication it uses exported layout parsing function. Please note that handling MTD & NVMEM layout bindings may be refactored in the future. Signed-off-by: Rafa=C5=82 Mi=C5=82ecki Reviewed-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- MAINTAINERS | 1 + drivers/nvmem/Kconfig | 3 +- drivers/nvmem/layouts/Kconfig | 11 ++ drivers/nvmem/layouts/Makefile | 1 + drivers/nvmem/layouts/u-boot-env.c | 211 +++++++++++++++++++++++++++++ drivers/nvmem/layouts/u-boot-env.h | 15 ++ drivers/nvmem/u-boot-env.c | 165 +--------------------- 7 files changed, 242 insertions(+), 165 deletions(-) create mode 100644 drivers/nvmem/layouts/u-boot-env.c create mode 100644 drivers/nvmem/layouts/u-boot-env.h diff --git a/MAINTAINERS b/MAINTAINERS index 42decde38320..25fe91a49314 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23342,6 +23342,7 @@ U-BOOT ENVIRONMENT VARIABLES M: Rafa=C5=82 Mi=C5=82ecki S: Maintained F: Documentation/devicetree/bindings/nvmem/u-boot,env.yaml +F: drivers/nvmem/layouts/u-boot-env.c F: drivers/nvmem/u-boot-env.c =20 UACCE ACCELERATOR FRAMEWORK diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index 283134498fbc..d2c384f58028 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -363,8 +363,7 @@ config NVMEM_SUNXI_SID config NVMEM_U_BOOT_ENV tristate "U-Boot environment variables support" depends on OF && MTD - select CRC32 - select GENERIC_NET_UTILS + select NVMEM_LAYOUT_U_BOOT_ENV help U-Boot stores its setup as environment variables. This driver adds support for verifying & exporting such data. It also exposes variables diff --git a/drivers/nvmem/layouts/Kconfig b/drivers/nvmem/layouts/Kconfig index 9c6e672fc350..5e586dfebe47 100644 --- a/drivers/nvmem/layouts/Kconfig +++ b/drivers/nvmem/layouts/Kconfig @@ -26,6 +26,17 @@ config NVMEM_LAYOUT_ONIE_TLV =20 If unsure, say N. =20 +config NVMEM_LAYOUT_U_BOOT_ENV + tristate "U-Boot environment variables layout" + select CRC32 + select GENERIC_NET_UTILS + help + U-Boot stores its setup as environment variables. This driver adds + support for verifying & exporting such data. It also exposes variables + as NVMEM cells so they can be referenced by other drivers. + + If unsure, say N. + endmenu =20 endif diff --git a/drivers/nvmem/layouts/Makefile b/drivers/nvmem/layouts/Makefile index 2974bd7d33ed..4940c9db0665 100644 --- a/drivers/nvmem/layouts/Makefile +++ b/drivers/nvmem/layouts/Makefile @@ -5,3 +5,4 @@ =20 obj-$(CONFIG_NVMEM_LAYOUT_SL28_VPD) +=3D sl28vpd.o obj-$(CONFIG_NVMEM_LAYOUT_ONIE_TLV) +=3D onie-tlv.o +obj-$(CONFIG_NVMEM_LAYOUT_U_BOOT_ENV) +=3D u-boot-env.o diff --git a/drivers/nvmem/layouts/u-boot-env.c b/drivers/nvmem/layouts/u-b= oot-env.c new file mode 100644 index 000000000000..731e6f4f12b2 --- /dev/null +++ b/drivers/nvmem/layouts/u-boot-env.c @@ -0,0 +1,211 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2022 - 2023 Rafa=C5=82 Mi=C5=82ecki + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "u-boot-env.h" + +struct u_boot_env_image_single { + __le32 crc32; + uint8_t data[]; +} __packed; + +struct u_boot_env_image_redundant { + __le32 crc32; + u8 mark; + uint8_t data[]; +} __packed; + +struct u_boot_env_image_broadcom { + __le32 magic; + __le32 len; + __le32 crc32; + DECLARE_FLEX_ARRAY(uint8_t, data); +} __packed; + +static int u_boot_env_read_post_process_ethaddr(void *context, const char = *id, int index, + unsigned int offset, void *buf, size_t bytes) +{ + u8 mac[ETH_ALEN]; + + if (bytes !=3D 3 * ETH_ALEN - 1) + return -EINVAL; + + if (!mac_pton(buf, mac)) + return -EINVAL; + + if (index) + eth_addr_add(mac, index); + + ether_addr_copy(buf, mac); + + return 0; +} + +static int u_boot_env_parse_cells(struct device *dev, struct nvmem_device = *nvmem, uint8_t *buf, + size_t data_offset, size_t data_len) +{ + char *data =3D buf + data_offset; + char *var, *value, *eq; + + for (var =3D data; + var < data + data_len && *var; + var =3D value + strlen(value) + 1) { + struct nvmem_cell_info info =3D {}; + + eq =3D strchr(var, '=3D'); + if (!eq) + break; + *eq =3D '\0'; + value =3D eq + 1; + + info.name =3D devm_kstrdup(dev, var, GFP_KERNEL); + if (!info.name) + return -ENOMEM; + info.offset =3D data_offset + value - data; + info.bytes =3D strlen(value); + info.np =3D of_get_child_by_name(dev->of_node, info.name); + if (!strcmp(var, "ethaddr")) { + info.raw_len =3D strlen(value); + info.bytes =3D ETH_ALEN; + info.read_post_process =3D u_boot_env_read_post_process_ethaddr; + } + + nvmem_add_one_cell(nvmem, &info); + } + + return 0; +} + +int u_boot_env_parse(struct device *dev, struct nvmem_device *nvmem, + enum u_boot_env_format format) +{ + size_t crc32_data_offset; + size_t crc32_data_len; + size_t crc32_offset; + __le32 *crc32_addr; + size_t data_offset; + size_t data_len; + size_t dev_size; + uint32_t crc32; + uint32_t calc; + uint8_t *buf; + int bytes; + int err; + + dev_size =3D nvmem_dev_size(nvmem); + + buf =3D kzalloc(dev_size, GFP_KERNEL); + if (!buf) { + err =3D -ENOMEM; + goto err_out; + } + + bytes =3D nvmem_device_read(nvmem, 0, dev_size, buf); + if (bytes < 0) { + err =3D bytes; + goto err_kfree; + } else if (bytes !=3D dev_size) { + err =3D -EIO; + goto err_kfree; + } + + switch (format) { + case U_BOOT_FORMAT_SINGLE: + crc32_offset =3D offsetof(struct u_boot_env_image_single, crc32); + crc32_data_offset =3D offsetof(struct u_boot_env_image_single, data); + data_offset =3D offsetof(struct u_boot_env_image_single, data); + break; + case U_BOOT_FORMAT_REDUNDANT: + crc32_offset =3D offsetof(struct u_boot_env_image_redundant, crc32); + crc32_data_offset =3D offsetof(struct u_boot_env_image_redundant, data); + data_offset =3D offsetof(struct u_boot_env_image_redundant, data); + break; + case U_BOOT_FORMAT_BROADCOM: + crc32_offset =3D offsetof(struct u_boot_env_image_broadcom, crc32); + crc32_data_offset =3D offsetof(struct u_boot_env_image_broadcom, data); + data_offset =3D offsetof(struct u_boot_env_image_broadcom, data); + break; + } + + if (dev_size < data_offset) { + dev_err(dev, "Device too small for u-boot-env\n"); + err =3D -EIO; + goto err_kfree; + } + + crc32_addr =3D (__le32 *)(buf + crc32_offset); + crc32 =3D le32_to_cpu(*crc32_addr); + crc32_data_len =3D dev_size - crc32_data_offset; + data_len =3D dev_size - data_offset; + + calc =3D crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L; + if (calc !=3D crc32) { + dev_err(dev, "Invalid calculated CRC32: 0x%08x (expected: 0x%08x)\n", ca= lc, crc32); + err =3D -EINVAL; + goto err_kfree; + } + + buf[dev_size - 1] =3D '\0'; + err =3D u_boot_env_parse_cells(dev, nvmem, buf, data_offset, data_len); + +err_kfree: + kfree(buf); +err_out: + return err; +} +EXPORT_SYMBOL_GPL(u_boot_env_parse); + +static int u_boot_env_add_cells(struct nvmem_layout *layout) +{ + struct device *dev =3D &layout->dev; + enum u_boot_env_format format; + + format =3D (uintptr_t)device_get_match_data(dev); + + return u_boot_env_parse(dev, layout->nvmem, format); +} + +static int u_boot_env_probe(struct nvmem_layout *layout) +{ + layout->add_cells =3D u_boot_env_add_cells; + + return nvmem_layout_register(layout); +} + +static void u_boot_env_remove(struct nvmem_layout *layout) +{ + nvmem_layout_unregister(layout); +} + +static const struct of_device_id u_boot_env_of_match_table[] =3D { + { .compatible =3D "u-boot,env", .data =3D (void *)U_BOOT_FORMAT_SINGLE, }, + { .compatible =3D "u-boot,env-redundant-bool", .data =3D (void *)U_BOOT_F= ORMAT_REDUNDANT, }, + { .compatible =3D "u-boot,env-redundant-count", .data =3D (void *)U_BOOT_= FORMAT_REDUNDANT, }, + { .compatible =3D "brcm,env", .data =3D (void *)U_BOOT_FORMAT_BROADCOM, }, + {}, +}; + +static struct nvmem_layout_driver u_boot_env_layout =3D { + .driver =3D { + .name =3D "u-boot-env-layout", + .of_match_table =3D u_boot_env_of_match_table, + }, + .probe =3D u_boot_env_probe, + .remove =3D u_boot_env_remove, +}; +module_nvmem_layout_driver(u_boot_env_layout); + +MODULE_AUTHOR("Rafa=C5=82 Mi=C5=82ecki"); +MODULE_LICENSE("GPL"); +MODULE_DEVICE_TABLE(of, u_boot_env_of_match_table); +MODULE_DESCRIPTION("NVMEM layout driver for U-Boot environment variables"); diff --git a/drivers/nvmem/layouts/u-boot-env.h b/drivers/nvmem/layouts/u-b= oot-env.h new file mode 100644 index 000000000000..dd5f280ac047 --- /dev/null +++ b/drivers/nvmem/layouts/u-boot-env.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _LINUX_NVMEM_LAYOUTS_U_BOOT_ENV_H +#define _LINUX_NVMEM_LAYOUTS_U_BOOT_ENV_H + +enum u_boot_env_format { + U_BOOT_FORMAT_SINGLE, + U_BOOT_FORMAT_REDUNDANT, + U_BOOT_FORMAT_BROADCOM, +}; + +int u_boot_env_parse(struct device *dev, struct nvmem_device *nvmem, + enum u_boot_env_format format); + +#endif /* ifndef _LINUX_NVMEM_LAYOUTS_U_BOOT_ENV_H */ diff --git a/drivers/nvmem/u-boot-env.c b/drivers/nvmem/u-boot-env.c index 593f0bf4a395..ced414fc9e60 100644 --- a/drivers/nvmem/u-boot-env.c +++ b/drivers/nvmem/u-boot-env.c @@ -3,23 +3,15 @@ * Copyright (C) 2022 Rafa=C5=82 Mi=C5=82ecki */ =20 -#include -#include -#include #include #include #include -#include #include #include #include #include =20 -enum u_boot_env_format { - U_BOOT_FORMAT_SINGLE, - U_BOOT_FORMAT_REDUNDANT, - U_BOOT_FORMAT_BROADCOM, -}; +#include "layouts/u-boot-env.h" =20 struct u_boot_env { struct device *dev; @@ -29,24 +21,6 @@ struct u_boot_env { struct mtd_info *mtd; }; =20 -struct u_boot_env_image_single { - __le32 crc32; - uint8_t data[]; -} __packed; - -struct u_boot_env_image_redundant { - __le32 crc32; - u8 mark; - uint8_t data[]; -} __packed; - -struct u_boot_env_image_broadcom { - __le32 magic; - __le32 len; - __le32 crc32; - DECLARE_FLEX_ARRAY(uint8_t, data); -} __packed; - static int u_boot_env_read(void *context, unsigned int offset, void *val, size_t bytes) { @@ -69,141 +43,6 @@ static int u_boot_env_read(void *context, unsigned int = offset, void *val, return 0; } =20 -static int u_boot_env_read_post_process_ethaddr(void *context, const char = *id, int index, - unsigned int offset, void *buf, size_t bytes) -{ - u8 mac[ETH_ALEN]; - - if (bytes !=3D 3 * ETH_ALEN - 1) - return -EINVAL; - - if (!mac_pton(buf, mac)) - return -EINVAL; - - if (index) - eth_addr_add(mac, index); - - ether_addr_copy(buf, mac); - - return 0; -} - -static int u_boot_env_add_cells(struct u_boot_env *priv, uint8_t *buf, - size_t data_offset, size_t data_len) -{ - struct nvmem_device *nvmem =3D priv->nvmem; - struct device *dev =3D priv->dev; - char *data =3D buf + data_offset; - char *var, *value, *eq; - - for (var =3D data; - var < data + data_len && *var; - var =3D value + strlen(value) + 1) { - struct nvmem_cell_info info =3D {}; - - eq =3D strchr(var, '=3D'); - if (!eq) - break; - *eq =3D '\0'; - value =3D eq + 1; - - info.name =3D devm_kstrdup(dev, var, GFP_KERNEL); - if (!info.name) - return -ENOMEM; - info.offset =3D data_offset + value - data; - info.bytes =3D strlen(value); - info.np =3D of_get_child_by_name(dev->of_node, info.name); - if (!strcmp(var, "ethaddr")) { - info.raw_len =3D strlen(value); - info.bytes =3D ETH_ALEN; - info.read_post_process =3D u_boot_env_read_post_process_ethaddr; - } - - nvmem_add_one_cell(nvmem, &info); - } - - return 0; -} - -static int u_boot_env_parse(struct u_boot_env *priv) -{ - struct nvmem_device *nvmem =3D priv->nvmem; - struct device *dev =3D priv->dev; - size_t crc32_data_offset; - size_t crc32_data_len; - size_t crc32_offset; - __le32 *crc32_addr; - size_t data_offset; - size_t data_len; - size_t dev_size; - uint32_t crc32; - uint32_t calc; - uint8_t *buf; - int bytes; - int err; - - dev_size =3D nvmem_dev_size(nvmem); - - buf =3D kzalloc(dev_size, GFP_KERNEL); - if (!buf) { - err =3D -ENOMEM; - goto err_out; - } - - bytes =3D nvmem_device_read(nvmem, 0, dev_size, buf); - if (bytes < 0) { - err =3D bytes; - goto err_kfree; - } else if (bytes !=3D dev_size) { - err =3D -EIO; - goto err_kfree; - } - - switch (priv->format) { - case U_BOOT_FORMAT_SINGLE: - crc32_offset =3D offsetof(struct u_boot_env_image_single, crc32); - crc32_data_offset =3D offsetof(struct u_boot_env_image_single, data); - data_offset =3D offsetof(struct u_boot_env_image_single, data); - break; - case U_BOOT_FORMAT_REDUNDANT: - crc32_offset =3D offsetof(struct u_boot_env_image_redundant, crc32); - crc32_data_offset =3D offsetof(struct u_boot_env_image_redundant, data); - data_offset =3D offsetof(struct u_boot_env_image_redundant, data); - break; - case U_BOOT_FORMAT_BROADCOM: - crc32_offset =3D offsetof(struct u_boot_env_image_broadcom, crc32); - crc32_data_offset =3D offsetof(struct u_boot_env_image_broadcom, data); - data_offset =3D offsetof(struct u_boot_env_image_broadcom, data); - break; - } - - if (dev_size < data_offset) { - dev_err(dev, "Device too small for u-boot-env\n"); - err =3D -EIO; - goto err_kfree; - } - - crc32_addr =3D (__le32 *)(buf + crc32_offset); - crc32 =3D le32_to_cpu(*crc32_addr); - crc32_data_len =3D dev_size - crc32_data_offset; - data_len =3D dev_size - data_offset; - - calc =3D crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L; - if (calc !=3D crc32) { - dev_err(dev, "Invalid calculated CRC32: 0x%08x (expected: 0x%08x)\n", ca= lc, crc32); - err =3D -EINVAL; - goto err_kfree; - } - - buf[dev_size - 1] =3D '\0'; - err =3D u_boot_env_add_cells(priv, buf, data_offset, data_len); - -err_kfree: - kfree(buf); -err_out: - return err; -} - static int u_boot_env_probe(struct platform_device *pdev) { struct nvmem_config config =3D { @@ -235,7 +74,7 @@ static int u_boot_env_probe(struct platform_device *pdev) if (IS_ERR(priv->nvmem)) return PTR_ERR(priv->nvmem); =20 - return u_boot_env_parse(priv); + return u_boot_env_parse(dev, priv->nvmem, priv->format); } =20 static const struct of_device_id u_boot_env_of_match_table[] =3D { --=20 2.25.1 From nobody Fri Dec 19 10:41:13 2025 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A13B82139CF for ; Mon, 2 Sep 2024 14:30:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287410; cv=none; b=ptCphaqAWRgWK4CzK9MAxKQIBSUrPAa2qL0SWNsxfMOSxe8e1cLKmPmfZP4TfgevhzkGxT0hCIk31bxGFh/RWoeXUrk9eS7qSpBuAIpiuUDoeh9/VeRWqwRZiiMkqvljI620n0WEOsFYGvKa8D1HlhwdMsOIJdrELTJ2ksnhUyA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287410; c=relaxed/simple; bh=DrbltgSq/rTLLH5kyWpJoPU/fmW8V9hVLeqYU0dOEo4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=ZgiCz3ILVx4zkyesA+IsWVA6Z2+Du2VywfqsMiDYw0k8mhrBN6h5Lgh/d94dQ9QtI0SXdgqGlsnR3EdIMdFgNXdIcMz4W+qe/nxZDMrG69sgqWFzu1SX3OFpF6f5DLn1hihrKN86UzpglaHh7w/KVuYZRbnX/s1Kma1ptT/xRD8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=zdN2w5zx; arc=none smtp.client-ip=209.85.218.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zdN2w5zx" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a83597ce5beso691364966b.1 for ; Mon, 02 Sep 2024 07:30:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725287407; x=1725892207; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iRIDB5vApTt95UCZmlOxg+E68fkDjw1Y/7g1DeaN39Y=; b=zdN2w5zxnTGMB1pJluqPSomE1WG6Ldx2AxrXA18Ga+hYqvfzlEFwWQvGPQDZLnSOpj /YA7X2RX25e/HTx5xQBeOKp2+BNhF1JIsxulCNdMh6ZL6AyTdWcpZ8HD1KrJX1xuMdrZ kEEraOhME+KQP8vYerO7SToXRwLxiYBxaPOay1+bvxeIvqvUR8ZnvPW90p8WKqTJff7W OflUWdlIqDOTjK8hW40HOh2HAL7oVxbeGP6laruB3LIFYeHMai7EqUv+npiys1JbrgKO 9i65oF6p4mtA8TacnDu1uRFbJuLvkA4NZbE7tW27lgEKSr5KhFKg8ZgMDRqnXrGOxGSp XS1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725287407; x=1725892207; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iRIDB5vApTt95UCZmlOxg+E68fkDjw1Y/7g1DeaN39Y=; b=pJmuPbpYxn3F60CP9+Enpe1iEUp9nAZqoOqbO88WuizzsWYdP76BF+PVwOPRAOKrIQ //fK1FNzXYI/9aSQt9n7b85C4LbWX8/mX7wHYRqc+qw/hcHM0mOoNxP6GRbj8wlIeqoS ZSckivfoGZhBtsCiK1gigtXNYzNhrtkEpey1wuyCkpGRZ8EBoqhicAXWS4YutSZbujST TRvyqaiTtDgKavgKv+6n4Rk9YuQWajI6HVK4cKxIXj3SjH2JzG+3J2K283EI3IwGoi0n tzK7xZlF2eWNz1WS5NGZksXx/AMPjrjg23lb+ZntY3xFbkF3rKZc2IPmndgFDhyH3zvg ZLCg== X-Gm-Message-State: AOJu0YyG03H8HWTHK5gbW8+flA+AHwqe9xZZB21VYDKDiFZEATy8qaoP 9Lq/O4SHcY6S4NAJMtjHptAYOggQsAfTNnxeiCUKMqZTZ33yAob8zlZKB1o5tB8b+OBcQEW+nXp X X-Google-Smtp-Source: AGHT+IGK5tu2NdNCddZ2ZpAvt/t+RuJFf8MekXeRmKmCbJnSLni+rTHwH9kY5hZbSebkBnSvdTPYRw== X-Received: by 2002:a17:907:e209:b0:a7d:2772:6d5f with SMTP id a640c23a62f3a-a89a2924aa8mr1000777366b.23.1725287406967; Mon, 02 Sep 2024 07:30:06 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a89891d80fcsm566011666b.181.2024.09.02.07.30.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 07:30:06 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Srinivas Kandagatla Subject: [PATCH 5/9] MAINTAINERS: Update path for U-Boot environment variables YAML Date: Mon, 2 Sep 2024 15:29:48 +0100 Message-Id: <20240902142952.71639-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> References: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> 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 From: Rafa=C5=82 Mi=C5=82ecki This file was moved to the layouts/ subdirectory. Signed-off-by: Rafa=C5=82 Mi=C5=82ecki Signed-off-by: Srinivas Kandagatla --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 25fe91a49314..fb25e47adda4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23341,7 +23341,7 @@ F: drivers/media/pci/tw686x/ U-BOOT ENVIRONMENT VARIABLES M: Rafa=C5=82 Mi=C5=82ecki S: Maintained -F: Documentation/devicetree/bindings/nvmem/u-boot,env.yaml +F: Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml F: drivers/nvmem/layouts/u-boot-env.c F: drivers/nvmem/u-boot-env.c =20 --=20 2.25.1 From nobody Fri Dec 19 10:41:13 2025 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E33621C169 for ; Mon, 2 Sep 2024 14:30:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287412; cv=none; b=Lwuo0zc6v+hiiTfDp4pWTmReHFU7E9Z/cp41PczmXonGEkkBnI5OHllJH6F02IllmhQ0PuNBKrJXjipsIk1X3hDqqOjhNqd6VO0GyEkjUYUd2HEFj6F8XgAzsSv6vkdObJxqecMVgfKYfcBEP1+z1oqYP/EcFY5QPsnlv/pUcCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287412; c=relaxed/simple; bh=bI+WqXBj8mdD34T8H6SBusG/4OZyISmGynfKyGUb94w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=e59vn6lAabDejRcjNM5gx8Ss54vbdlTelcRkr1LkBAwmJ5J1Wjv04SRt7c3UnLkwbZmdzPeNW1YSlhdeAeYO1cU2eGzhIr5fHvZoBI3oN8nicCX0O1PN5cxXr+tbhzL2/450bHUuSCCxPV6eEzjedpzEuQV8GNf1/Ax47eFtoQo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=nensxHRT; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nensxHRT" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-53343bf5eddso5668589e87.1 for ; Mon, 02 Sep 2024 07:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725287408; x=1725892208; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j5IdT/cwgTs/gFfwZd0Ne8SwBMrtn3NphjoJjOx+PJQ=; b=nensxHRTBiSuCnXeDm4Smk4HdbPy14m/jJBTZjAdIr0NfASWGlDUrcPI/tw/FkjAq4 5yBvCG4TCzEfmp7TYdAnGvexH/1QFuZoimWBMZ6T6ePcaWUDE/3EoDb29IBmLv60pjHm cigNXmjzcEzd/hzaXQYSaqe4D2/cu08NnRyIWTxH8aEeUPgf1ybGntpx4+FfA5YZqEDq wKsq5+Qc6H+clWCC0lu4WWJ259VQg49Pot3edfQbUk5XL5bNWNr2o7my+2+7IwZv8qYF /jUjxKaD46im2n34vnj7lJPubtK/1lZcsfTBbjTay5vdVhcVJIpuSSHnZfMp6TgqqhBy aBjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725287408; x=1725892208; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j5IdT/cwgTs/gFfwZd0Ne8SwBMrtn3NphjoJjOx+PJQ=; b=p1AtEt6DlY1tCwuFcqNylRP3LUr06X6oTA0SytaHBwOwduad+w+9VojmdnyQAxfw0j KiEY/TGMrMHd4VHt8qoOXE5i66VGGFJ6EKbCDErqeaF48C+plVavC4hndMUkGc5K3gGz V9PgR52Duv7qJthhPdjquo4IsenZ1BkJvoCtEj01Vh5KdvfPDm1vANC12FzgOAZocbrJ C8u1gstU1rzzDdNL2NpgNlBc3yBPnKuWIcSsrcTTO7Mmx/yHoQPWmnj0C6DImlOWKSx5 P6CvW/J97yhzrab//CBMblkWHnh+Fa9zV3roc8r181TEi0ixrICvmnqdA0z7ImlGN0Rt Z0ug== X-Gm-Message-State: AOJu0YyQ448SYKCvXWV77BoEOo6MgV+ShxJ4AzKJEPd6NM2iJewPKIUO 9xaalw49XuDKmZHiRtzw7WgDOFq7pGYsWG1wnmGrXhIVbh3I3Edotz/K2pZ7hIw= X-Google-Smtp-Source: AGHT+IFK+qDjRZcra7g9gZD7vtf3xQyREu7W8TUUKvn21lu9+aXHWmO6jXkyB89oK3lLxPuDiesHAw== X-Received: by 2002:a05:6512:ea7:b0:533:44d7:c055 with SMTP id 2adb3069b0e04-53546b19184mr6727359e87.5.1725287408218; Mon, 02 Sep 2024 07:30:08 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a89891d80fcsm566011666b.181.2024.09.02.07.30.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 07:30:07 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Conor Dooley , Srinivas Kandagatla Subject: [PATCH 6/9] dt-bindings: nvmem: st,stm32-romem: add missing "unevaluatedProperties" on child nodes Date: Mon, 2 Sep 2024 15:29:49 +0100 Message-Id: <20240902142952.71639-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> References: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski All nodes need an explicit additionalProperties or unevaluatedProperties unless a $ref has one that's false. Fixing this for STM32 Factory-programmed data binding needs referencing fixed layout schema for children. Add reference to the NVMEM deprecated cells for the schema to be complete. This fixes dt_binding_check warning: st,stm32-romem.yaml: ^.*@[0-9a-f]+$: Missing additionalProperties/unevalu= atedProperties constraint Signed-off-by: Krzysztof Kozlowski Acked-by: Conor Dooley Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml b/= Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml index 92bfe25f0571..3b2aa605a551 100644 --- a/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml +++ b/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml @@ -17,6 +17,7 @@ maintainers: =20 allOf: - $ref: nvmem.yaml# + - $ref: nvmem-deprecated-cells.yaml# =20 properties: compatible: @@ -32,6 +33,8 @@ properties: patternProperties: "^.*@[0-9a-f]+$": type: object + $ref: layouts/fixed-cell.yaml + unevaluatedProperties: false =20 properties: st,non-secure-otp: --=20 2.25.1 From nobody Fri Dec 19 10:41:13 2025 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6664021C17D for ; Mon, 2 Sep 2024 14:30:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287413; cv=none; b=eT7f4Cgb7MzaRS8PM2Rw81lnsyQ5dAg9g7nAdYtSEU/b+AGKlSxuNuwfG71ZGTD9Ib7sSPgECuCMda34bLcRThoYIxh3m5OgYVQbG/wldnGFHKp8ejbtDtphno1zbkmkog74JQTnU1x2WWHxEFoeazzyX1nKVDvyMYoymY4RQ54= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287413; c=relaxed/simple; bh=XHf1PxvMaYpt9H9YkJQcuwUwUJRg2m4RddjadU32f/Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LxewGHgyg1qqiTp+jn+Hm2feQ106cW2FcYCmoUT+VJQ5PGt2eZaHBTRG7S90As+9OpxukoxtoB2YGVzgbQW60XieKmjQV6rsr6Bfg37AMerrRmSEuh4c7TwFCyKN+5tNEl3bF/7/VWHjDdt/e130hjJhKNvopTKn/bswt0GESMA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=X/YSLaCG; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="X/YSLaCG" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5c260b19f71so921031a12.1 for ; Mon, 02 Sep 2024 07:30:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725287410; x=1725892210; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=np21NntzYSGuYS09nKGt/s8sAnf5QNjafiADebOVCz4=; b=X/YSLaCGc4kN2Ss3Uu9tLdddpv3Eqy4F6zuXY6zhi/ANj2GWYETC34UwZfvK0FO+3p vZj8vPslWud7uatYXBEriJuAmmrDiWtoZMZZ7fswuitQAujA01BEJ1KF7uXx+PbBXLdw /QhD9Np6Ony6QgUBJ+7RHSyNFjKL8gJQsiOxOhHe/PFVcUC4WF3F8xjk3ft+FEdMLecK HhXFH5aucPFQvKEzLRAnL/WLV7MomCJoZPoE0ZStaT/HlO2WnNV2RhOyMsp6U30sfIGr QYTBP+aH5H2H3/wffhwDF8puBMP7BblnNrGgzjaoxBeS1AnmjckBPHeStJemwxfqygfV mRUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725287410; x=1725892210; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=np21NntzYSGuYS09nKGt/s8sAnf5QNjafiADebOVCz4=; b=q5epa721zLqONq8pvsPjNHTzNrwuo425oJfCscewICPRVhTNGhyaW5txn+UiGA0Hm+ j38WvMRRAUWeZSPVPBzHLHXB+eZyc2n0ocYyx9SAUVWA8lfHBLDDh4YnX/IJTAvKHdz/ 6uLR6UqqXpdg2z7bDEoxeDa7EvoTahnFWodbJR3rHrfJHKmCavUY9ENdAOvmHI50XI1v 65FVJIj++ho60JfvUu8pevqQbzB0IyduWGyQ7lfmjKlamYHsb7Vwny/NqE1Jb57FH9TB 4oE2D9IhshYC+AXtxeXyCaUPJl8IxliW2b3V7MZS44nsVMCYLC/B7QUNCEG7EQWrkuZq jtyQ== X-Gm-Message-State: AOJu0YzDMYDlgnvlzYyFME6cAHtS6cyDZgGqf5pbVQSK46IcToAsZapy TcXJ1QuCmQCaW93DXc1JH9nwGSyi7jtLMjBbN72P2zezI9OW37E+nl0//fwNvb0= X-Google-Smtp-Source: AGHT+IFNetQ1ayTq0+0UbEF9VKAgYXpTLAsierdeBXRAFRgvCcDWNQ3iu5slAt68fWdL/xme2ycSJw== X-Received: by 2002:a17:907:7d89:b0:a6f:4fc8:266b with SMTP id a640c23a62f3a-a89a34f9fedmr797517566b.3.1725287409734; Mon, 02 Sep 2024 07:30:09 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a89891d80fcsm566011666b.181.2024.09.02.07.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 07:30:08 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Zhang Zekun , Srinivas Kandagatla Subject: [PATCH 7/9] nvmem: sunplus-ocotp: Use devm_platform_ioremap_resource_byname() helper function Date: Mon, 2 Sep 2024 15:29:50 +0100 Message-Id: <20240902142952.71639-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> References: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhang Zekun platform_get_resource_byname() and devm_ioremap_resource() can be replaced by devm_platform_ioremap_resource_byname(), which can simplify the code logic a bit, No functional change here. Signed-off-by: Zhang Zekun Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/sunplus-ocotp.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/nvmem/sunplus-ocotp.c b/drivers/nvmem/sunplus-ocotp.c index 38f5d9df39cd..30d55b111a64 100644 --- a/drivers/nvmem/sunplus-ocotp.c +++ b/drivers/nvmem/sunplus-ocotp.c @@ -159,7 +159,6 @@ static int sp_ocotp_probe(struct platform_device *pdev) struct device *dev =3D &pdev->dev; struct nvmem_device *nvmem; struct sp_ocotp_priv *otp; - struct resource *res; int ret; =20 otp =3D devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL); @@ -168,13 +167,11 @@ static int sp_ocotp_probe(struct platform_device *pde= v) =20 otp->dev =3D dev; =20 - res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "hb_gpio"); - otp->base[HB_GPIO] =3D devm_ioremap_resource(dev, res); + otp->base[HB_GPIO] =3D devm_platform_ioremap_resource_byname(pdev, "hb_gp= io"); if (IS_ERR(otp->base[HB_GPIO])) return PTR_ERR(otp->base[HB_GPIO]); =20 - res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "otprx"); - otp->base[OTPRX] =3D devm_ioremap_resource(dev, res); + otp->base[OTPRX] =3D devm_platform_ioremap_resource_byname(pdev, "otprx"); if (IS_ERR(otp->base[OTPRX])) return PTR_ERR(otp->base[OTPRX]); =20 --=20 2.25.1 From nobody Fri Dec 19 10:41:13 2025 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E54C72101A4 for ; Mon, 2 Sep 2024 14:30:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287414; cv=none; b=u8n1mxAzVKHJ8Q1JXAWMhGy7TYg1B9WbleKwuTfjQbH33bKLWcHeNe6d35VpO9tPumJ9il1Da36mokLF5bWalx6rtTox2iW5LFJ/U3dXLCbJzVjXnpMrTzEjNtrnHM7/y56lhzsBiJB2/aJrJ52f8Fcd7uVoeQBmpqGjbUIhK+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287414; c=relaxed/simple; bh=cAWGZ//sG6FfvQrU9FuP5gcKwJBjNVFImbAO0zgT8MI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZF/FHtDGHH/TsgzBU8P8fMq2MDCPEGxlzydV7Kk3DOST+jn3IZvAZKcjs/x+3P3G89H6BrMj8vM7zNOHczNqAL2OasDIcW78P7SJKmceR5YSjO2wln36wazUatCk++m7+GeklYYK8utzxsfEbfG86rrQtED6kcAFW+k79+T4pe8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Huqd/a6j; arc=none smtp.client-ip=209.85.218.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Huqd/a6j" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a8a1d78e7b0so15284866b.3 for ; Mon, 02 Sep 2024 07:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725287411; x=1725892211; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=35hy4fLRqiaIxXHyqs55ENfHcWcbMlUJr9u5FrPl6mw=; b=Huqd/a6jMuV0cv1MfXOODLdyujfwmuaXjjd+xJEtkGgFf6BkahyMw/9/sbsEv9/bVm JiyNyZltFvKID/X4mAA5YS/Avz0K0PYyloH6BP3+/xS9Uo+c/c8y7swVtqhF/RmlyUhk nmd4dJAWbaxGOOKcFXkoOgXgJqs9mcLMqEYDAKtvmVN6geLbeNy3aT6nRBkozi+rbsCX c7QHTAu/wzl2HFgcvik3x46xO4TeWfhf8SECdu6BABIC18dTAHaX221gdGD+SRiOW74/ nBTdHyDAwt7/ZRYtAdWZMmYvmF26+6FIs4HdMzBxyDZRuX2xwXdTS/+SwAswPFnYVj6h EIvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725287411; x=1725892211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=35hy4fLRqiaIxXHyqs55ENfHcWcbMlUJr9u5FrPl6mw=; b=PRfsdWZHPpEB9wltfdQoMR0cEIr+jzk7ZLS4l0HHRkzfyhOkpDwMsHbswYepLza+7O 34P+W83fuPeITHziJCmDqE87LTb1UMI8j7R4ubZ3oyzvSVvlom8VZkNMbieqaviQVH28 dRCmTUAALNUvyNt88Hr5L7VfPAoXS43RogGO5LkPXPZ1sq0HLVWoyhrwFTVnTDLrGggZ bAHhe7pci7j0BGBzOO4VswF/b7Yv9BsajP13M5m7uW/q1gkiwPV1HIDy6p0gPs2GKWhw Tw9kpKva85gGmNdwcYisApREL61BG/Yx0wBoSQR7tz6mGDejA5m54Qz63lpEJWNRLAyk A8aw== X-Gm-Message-State: AOJu0YyGtcxB2bIDLwg12SWkDa1GVVUPlwc9A0+pv3xXup+OSW+7Nb2/ 0+P3htTUB1FYJpP4C/K4JAyA29QqUo+SeYNVm9BTWueDpXmFYqYaFVXAoCXAv1U= X-Google-Smtp-Source: AGHT+IHxXo2Ts6mGIg5sXlbQZgoVwIjRVVVsHyvyU1v7sPkWub+0tMhbk87+ZARLsJYSXjcjyrgZ4A== X-Received: by 2002:a17:907:36c7:b0:a7a:a06b:eecd with SMTP id a640c23a62f3a-a89fad7c539mr313330066b.5.1725287411023; Mon, 02 Sep 2024 07:30:11 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a89891d80fcsm566011666b.181.2024.09.02.07.30.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 07:30:10 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Matthew Wilcox , Marek Vasut , Srinivas Kandagatla Subject: [PATCH 8/9] nvmem: Fix misspelling Date: Mon, 2 Sep 2024 15:29:51 +0100 Message-Id: <20240902142952.71639-9-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> References: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Matthew Wilcox There is no function called kstrbool(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Marek Vasut Signed-off-by: Srinivas Kandagatla --- Documentation/ABI/stable/sysfs-bus-nvmem | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/ABI/stable/sysfs-bus-nvmem b/Documentation/ABI/s= table/sysfs-bus-nvmem index aa89adf18bc5..0ae8cb074acf 100644 --- a/Documentation/ABI/stable/sysfs-bus-nvmem +++ b/Documentation/ABI/stable/sysfs-bus-nvmem @@ -11,7 +11,7 @@ Description: Read returns '0' or '1' for read-write or read-only modes respectively. Write parses one of 'YyTt1NnFf0', or [oO][NnFf] for "on" - and "off", i.e. what kstrbool() supports. + and "off", i.e. what kstrtobool() supports. Note: This file is only present if CONFIG_NVMEM_SYSFS is enabled. =20 --=20 2.25.1 From nobody Fri Dec 19 10:41:13 2025 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B4613DABF3 for ; Mon, 2 Sep 2024 14:30:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287415; cv=none; b=pmNFE+Ej2LZYPqew3sfN2em3a4uH5WC78v9bqF4Bigyzb2aGlXK8iznySdiIp55UFVhrURfQ1cc58ocMXCNnL8XgjjE5C6KWf+2f+belggUgFyZt0q2+slicBl5qF7MyFC8YHh6qcSFMdwtBXY0tNi8Gc8Y4MGHkdC0qsSg0JGw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725287415; c=relaxed/simple; bh=emb8q+6gXOjS5iw1fauZynFmoiaNEeiD27qwYCDSSw0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=guwVA5YqpucvGYJ1QkgjA7XvYzxZ0gF5rJBt6WjOZ0aC3Y1N/FnLpixDT7ywguJZYUXA5VTFoJeJB+gtKsVxMxSpaMLJIN5QHN/MW0J/AjlNLEyjdCbi4a290PzgK4NQmkZxFsl8wPYbDis66hmm+WEuv3rMfaDMemR6wmWP5yc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=yWBPzsZQ; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yWBPzsZQ" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5a10835487fso5701612a12.1 for ; Mon, 02 Sep 2024 07:30:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725287412; x=1725892212; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HyyqGwMkWW7u8Lss1KA1H5146wVoNDESuuT5hwniUaA=; b=yWBPzsZQfVlxM3SJJe4lle5xYPo960zezBBv/TaIGbCwY9ahNbFvhsdHYCJXBqt9gW +mGVC8pXoMDMtlNUrJ6Py7QfbOwT6se/8EdJyRIc1Uj/HwxWrIp7ZdtLCMdRWmzN2wyU bCNnJVhEs0LMaKjN+YADkz4hBs1ABYb3sKrptSuHVT5CfkAbvjrfAt91E3qj3og7rFln L8PDAIbiuCLDnVvN4jFXPOh9OjPCtvftc0AUEAmjwmVrYB35HWsH1eeaLGZGn0o4zAz2 XxG37rmC0+dYnFWjygEjrwX8ofZ6gb4M69EUXKjNV1019flVHg/nxE2YJu+ga+KPsaG2 H+rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725287412; x=1725892212; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HyyqGwMkWW7u8Lss1KA1H5146wVoNDESuuT5hwniUaA=; b=ND4ndnEDoUqeHwY6iL+VqmuWop4J6KL0QoGqghwjs7mB8cGM4q0AsJzGaOw0KUno+J 4W31wyU5nT5SD78OHYKo7u4mbAf/kSRTkn2xhchn3Cez4iDHi60bW0GvsPI1qaX0ZDCM NzIbC/VCK27FP0yxdHaRn0mI+3TsBIfDA37C2hDlsf0hOi1GATYxWDNrjsYHyDKyrZsn GPMsADWtwGtE9FJpWd4r0oY55semIT9bokAAaKLc+cjz7OOC6ThS8PdF1sewIYYikF9Y CPk03owJCv1k/PP1ktcTW/g0LgvqHQYoqILoBOHMcJduZLUYwGIQUDEQu+Ktfv4tWwYh 49qg== X-Gm-Message-State: AOJu0YzDOcNI07JoTca0qLZS6pdugDhigH6OqhboJ+Ux77IyqUasRSy3 JEwhKfhHT3OoSlGtlNUQxxyxFgYTyQUQiJ1w6x5dazAsfGs3zWo2H7QHyDgOZ38l7K0hwIlG4Su g X-Google-Smtp-Source: AGHT+IEkO45kYfW9M3CJguwqWlICZW/1nRjI2MvjpTaeKTuEJqU9eEWgG7DgCb41YlRBWOV1s6oAEw== X-Received: by 2002:a17:907:9490:b0:a72:40b4:c845 with SMTP id a640c23a62f3a-a8a1d4c36b9mr25861866b.51.1725287412389; Mon, 02 Sep 2024 07:30:12 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a89891d80fcsm566011666b.181.2024.09.02.07.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 07:30:11 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Frank Li , Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 9/9] dt-bindings: nvmem: sfp: add ref to nvmem-deprecated-cells.yaml Date: Mon, 2 Sep 2024 15:29:52 +0100 Message-Id: <20240902142952.71639-10-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> References: <20240902142952.71639-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Frank Li Add ref nvmem-deprecated-cells.yaml to support old style binding. Fix below CHECK_DTBS warning. efuse@1e80000: Unevaluated properties are not allowed ('unique-id@1c' was u= nexpected) Signed-off-by: Frank Li Reviewed-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yam= l b/Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yaml index 70fb2ad25103..1b20b49eee79 100644 --- a/Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yaml +++ b/Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yaml @@ -15,6 +15,7 @@ description: | =20 allOf: - $ref: nvmem.yaml# + - $ref: nvmem-deprecated-cells.yaml =20 properties: compatible: --=20 2.25.1