From nobody Fri Oct 3 10:10:30 2025 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.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 4CF0C27AC2E for ; Tue, 2 Sep 2025 09:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756806472; cv=none; b=bv8tNzSbdtKiK8SFi3qEtDu+MV4Gk9c4oKSo7+VrrSxfWj/g14HZBI7cdAHdxwfKgd5e3hzU95g4EtuDC8CQI3wEUEf9tWdpxQSEYBq5vBHWVGc6QLjpxpa+qQJ948UL8woYgTBPDPYo9H4WG671mHuFsZgnKjpiIK9yDepNIys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756806472; c=relaxed/simple; bh=yzipH7+YLSVA5XwvVOPX7KSuVlBdg734ixf29Kxdakw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VAHZbcZfyUPO/hh7JKAojtgJsP6s3kZAr1PQ45vHddD2xN3+QmRDPdwkzqjdydz7oZXAovdK72HTCRIR/K/QSOSMxT+AwZfWcHpMXDR0K7QdygzxUrMMdzQYit3jCd11FSeAL6pJD5nEKWgpCRSRK1K4BBhr2g/tZhClBXRVp5o= 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=f/9q9kV4; arc=none smtp.client-ip=209.85.221.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="f/9q9kV4" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3cef6debedcso2279794f8f.3 for ; Tue, 02 Sep 2025 02:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1756806470; x=1757411270; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=zDNEVdF1aav7akHGWHi6iBedrI525SqQlKbGzww85uM=; b=f/9q9kV4wDr2uusl+FJ51jDnJSwz0NuZoeNEI23hGRnu4YhcFyZLF2EWeEjvmS9cHT xLO7nCt0XMwSZzhsG5SeGbXF7HEF4TtbMGBu+9+QW+JZ3BSamzg+xz3lzmzCmMCrTCQ+ 2i9gNLU/YjoFyJ0XWtH5JaatkAmYA/CQ51VVvsGTq0rkcnkG3RKhwEVvQDPsOH4FQJHv bV3kgN2DI8bmgFRfPq44HaJLWIw4k85UBz6Qi28kqOfxBq2tm7Hh+7UBZMjsKOTPxKtQ oy/8NeZiMqHXX3nGgJjMerZO4OLVqp+NLSnFrtct15Myz/XZikNGZzDwGZMU2PjXAxwt FJ8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756806470; x=1757411270; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zDNEVdF1aav7akHGWHi6iBedrI525SqQlKbGzww85uM=; b=cy6k10jFHgelKaJ3lXBzIMg3JRiROPmaaE/jwCfzQ0g5v44Wd5gVi+kfYUyVTVpaMa +LUH3/S9PTIH5xL8XHHaShN4BkI2n0ox3ysgAoJk/Ai129wgxs4xKOkZ2pZARPQbjaRj 8MleNUs3cw0ZVKYjO5K3qqudgkTGuKDZhD+a77Z407fta6lt+7ZZ5ZDt2gyzxQ+eML+v y0kH5e98PncbkrOFAzNBZPLdui8IMT3obJvfn/4JrzpXTfWN7ZtNjBX4CfOVIRfF7Lah bXEJKz+DkcWxk3FH5mJ7EnVTU6ARUS9XXdupc0BpMBl0iiMBUQCazTR+MIkcVx+h8tYz 5ZrA== X-Forwarded-Encrypted: i=1; AJvYcCWYdc44IF8FO6PKukyTS0sUOQMgIJ0Aaz3xYZLGzVkCeJVgbJXSCnPRLvw1Tsy47UE5zVN2p3h7+TjZAsE=@vger.kernel.org X-Gm-Message-State: AOJu0YwxA/P1A91/lbFBAB7jYzicIBMDxktqrIpQNB06uKdn+C0+d9F3 6BSdl1BEefQoJ32OLWtSc8XaZPiTi3ELgMVURS51U9gsfyxenHQ6QNPfCjxcd3iki8w= X-Gm-Gg: ASbGncsoiWvZX4QcLS+v9hHFLA99EogEC+Jzudb/cXVvxitfnyLun75BWu65TD7Fd6v gOO3jaJR+LkVncCMw74Plkv9nuZPl5ldZ3w+/3IlOYCKyrjFg0WSjj0JT8/55nWh3ASQQ9qBDgw mZepA5v0XpnuaL1L3t0e7tD2x+fpyjrjd6Z93cT5KWK6cbqEXfURS084U7+wZwvXcGGYZdzVUH/ BbjeZsQtts+qrQsWSbJlTIk3T94E00K4/CANHrd9UO/6LwB0mW7MHQGjVQ8w6kwKLP3On3sMdXh ADbogarBCr8tWLrQCOWLdlWzMoN98gN6gOWC9iX5GFfsfnGD8BPMG+wqzZDItzKhyiZcgHlGW3/ 0zOcOyYNpJJxAryttlu6K0bJhSHlj9jh91FN/6Q== X-Google-Smtp-Source: AGHT+IGhzDRfSoIBdZIYTbvS+YKQHcUloucdIOzwbNIUuQlEjgK00y3sqTBhlk96hnKLHY9Y8H1RGQ== X-Received: by 2002:a5d:64c6:0:b0:3ce:f0a5:d586 with SMTP id ffacd0b85a97d-3d1dc5a2fe0mr6784224f8f.1.1756806469665; Tue, 02 Sep 2025 02:47:49 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3cf274dde69sm18902229f8f.14.2025.09.02.02.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Sep 2025 02:47:49 -0700 (PDT) Date: Tue, 2 Sep 2025 12:47:45 +0300 From: Dan Carpenter To: Srinivas Kandagatla Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ciprian Costea , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, NXP S32 Linux Team , linaro-s32@linaro.org Subject: [PATCH v3 1/3] dt-bindings: nvmem: Add the nxp,s32g-ocotp yaml file Message-ID: <6a9562fc4b5a70a34eac66359bcab64be96ab873.1756800543.git.dan.carpenter@linaro.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ciprian Costea Add bindings to expose the On Chip One-Time Programmable Controller (OCOTP) for the NXP s32g chipset. There are three versions of this chip but they're compatible so we can fall back to the nxp,s32g2-ocotp compatible. Signed-off-by: Ciprian Costea Signed-off-by: Dan Carpenter Reviewed-by: Rob Herring (Arm) --- v3: Remove unnecessary | Move $ref to end Alphabetize the compatibles Delete the unused ocotp: label v2: dt_binding_check DT_SCHEMA_FILES=3Dnxp,s32g-ocotp-nvmem.yaml is clean make CHECK_DTBS=3Dy freescale/*.dtb is clean. Particularly the freescale/s32g274a-evb.dtb file which Rob mentioned. remove bogus include file remove redundant "reg" description remove #address-cells and #size-cells since they are already in nvmem.yaml Fix email From header --- .../bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-= nvmem.yaml diff --git a/Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.y= aml b/Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml new file mode 100644 index 000000000000..8d46e7d28da6 --- /dev/null +++ b/Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml @@ -0,0 +1,45 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvmem/nxp,s32g-ocotp-nvmem.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP S32G OCOTP NVMEM driver + +maintainers: + - Ciprian Costea + +description: + The drivers provides an interface to access One Time + Programmable memory pages, such as TMU fuse values. + +properties: + compatible: + oneOf: + - enum: + - nxp,s32g2-ocotp + - items: + - enum: + - nxp,s32g3-ocotp + - nxp,s32r45-ocotp + - const: nxp,s32g2-ocotp + reg: + maxItems: 1 + +required: + - compatible + - reg + +unevaluatedProperties: false + +allOf: + - $ref: nvmem.yaml# + +examples: + - | + nvmem@400a4000 { + compatible =3D "nxp,s32g2-ocotp"; + reg =3D <0x400a4000 0x400>; + #address-cells =3D <1>; + #size-cells =3D <1>; + }; --=20 2.47.2 From nobody Fri Oct 3 10:10:30 2025 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 2EFF327AC2E for ; Tue, 2 Sep 2025 09:47:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756806479; cv=none; b=CPGOFCcLmwm1K474y55eSzwO81j1GfEBGvriD22mvVEY0sjDrXL8Xoe+45JLGohL5F8aIy+JvI8tOaQadGWXncaS4fN159LtMGW4xoURb+EhzeNLCWTdJw87ZAcIIF5/HAOirqg8FcOnkv06n90Eho2XWOIyFony0hV47eva6ro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756806479; c=relaxed/simple; bh=LpF0I0/Jc9hvOyVmaGfM0tcGifeduVMOBdmu+MwLQUM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XZU3ZCurSI9TjHhGsM+6t6cTvuYiHkxkghEknrPkH+bTJoT1PK5cyGTor9VM/5lGkn/1+/dKTUGvRqYxosH4ONV1MkOmMUEqc9KJt8kseYSCK4iK8cSSBAiAiGqJCZRRmMYC6PzBmWdAmmWottiKRczzSgjYXadYnc/otYXDAAk= 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=w1XFddZR; arc=none smtp.client-ip=209.85.221.53 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="w1XFddZR" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3da9ad0c1f4so275310f8f.3 for ; Tue, 02 Sep 2025 02:47:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1756806475; x=1757411275; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=V/8knJNiSWo06IzZroNvpu9/OUleLJhwofC/xL/YFq8=; b=w1XFddZRm20NRzKHfhCCa1CEiJpatIVt6cvkcE+sY3B0rJxLRT0HeeTroPAe86s4kg BZaCFcZGNlxVgrg27izs92rrNKSyApFI0ddyxM4h+8yvUh8rDPqiiGwGNiY+/q9KlXOv 9cIt4PP9JCL0TfzHHFdS5SylXUVE7GKCK46WG30+ZV+TTU0yMtys81w4XycPun1UDs4h AMhMtzh92Q+d1phPum7jR61ub/t3bjbD0r7RqsXcAL1JU1K41ZS9TSrieHyyoLGe0lsj X7Nxz0jCJMjKpL1riJsz4KFdoOXwkyH11/AP9vX2fYHn8gOxZsASMDmPqiIbyWc9sZER aOgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756806475; x=1757411275; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=V/8knJNiSWo06IzZroNvpu9/OUleLJhwofC/xL/YFq8=; b=TSOnmToNpVnINtgEyUK77oQiul9b64i2+wnqAJ3TBjB4LVW5SiRf5SpOPvIAkPb199 pSIiYfQGbwCEwACsMagmZO86Uoo6KXR32NzqJ/S5gzVGtw9yaRtwVMeTgRGJxMrJR5wg Xpzo8sZ3sBufwlI/toHTBPSWCv94kgT2hsfGFx3ON4m2wrXa5otAghouEMLlF+kFnHPa 5vDYdosNdOWwET+/rkbgJugPaiOv1kF5dTA20pdIoChj2sACC53H3fBULl3EysOuh7B0 cIB47YhG/yUucCz/E2m6sp+bp2VHxEa2W3ZL6l3ahJxsREBfI+5/c8OyMe9Li1x7dvME 1c+g== X-Gm-Message-State: AOJu0YzY4CISZiM0I1ew9CSYqOL1g0IexbbV+BvyIlETghYpHSctYOy3 dYlDPVK9a8OPkYCgXbOM/lZbaJ1J8ipk9b9xpVVVZkk8ozRuKX+F48EbTir1Jza+aMA= X-Gm-Gg: ASbGncu65Wk8RWwHouG40qf+e+UeSqnR49J9+mlywc6vnOgbWTVFze8vDG81yM0lRrd zM1XcZqgNt8Hz7Ujgw0xhB/ENVDVLbkxYRullSx+dp7fq4iHwhcTCRxTRWe3ltP387XqZ9XA0zh hLufdsiornNoFscYBcmGsNq6/On0+WiNAuSMRr8E+Y/w/SB1/9GyQf43m8IGszAe2Jyoa4DwzQU i7YhOBtvJEtj8zUME0goQXZTNLYc7eygXURZTCAdT3nEF6HhWopZWRdrnPYnMqxNEjI3ni6TZ8Q JXMsvWrWJGA+30ZHNPF06S8iqKVFcOKHeyJeE66meF2HMq9VNMoCHLBRfCzsomVpMc5ucZgCFEQ +qbSx1weFjspbrVqYv2AbcFS3azs= X-Google-Smtp-Source: AGHT+IGcwg9+LX0vjWMkro3ubGDf4kfBgR3qsQ7Aqwk8vKUj6Rs/FvX0FhHMG1Q+i222d7yJ6eCBwQ== X-Received: by 2002:a05:6000:18ab:b0:3d6:a2d1:8ea4 with SMTP id ffacd0b85a97d-3d6a2d192c0mr4237375f8f.18.1756806475393; Tue, 02 Sep 2025 02:47:55 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3d3a7492001sm13589602f8f.42.2025.09.02.02.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Sep 2025 02:47:54 -0700 (PDT) Date: Tue, 2 Sep 2025 12:47:51 +0300 From: Dan Carpenter To: Srinivas Kandagatla Cc: linux-kernel@vger.kernel.org, NXP S32 Linux Team , linaro-s32@linaro.org Subject: [PATCH v3 2/3] nvmem: s32g-ocotp: Add driver for S32G OCOTP Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ciprian Costea Provide access to the On Chip One-Time Programmable Controller (OCOTP) pages on the NXP S32G platform. Signed-off-by: Ciprian Costea Co-developed-by: Ghennadi Procopciuc Signed-off-by: Ghennadi Procopciuc Co-developed-by: Larisa Grigore Signed-off-by: Larisa Grigore Signed-off-by: Dan Carpenter --- v3: Use dev_err_probe() v2: Add S-o-b tags for Ghennadi and Larisa. Use keepouts instead of the s32g_map[] table. This allows a bunch of code to be deleted. Version 1 only let one word (S32G_OCOTP_WORD_SIZE or 4) to be read at a time, but now the driver allows larger reads. Set the .word_size in s32g_ocotp_nvmem_config to be 4 instead. Krzysztof asked for some changes in the probe() function but that code was deleted instead. --- drivers/nvmem/Kconfig | 10 ++++ drivers/nvmem/Makefile | 2 + drivers/nvmem/s32g-ocotp-nvmem.c | 100 +++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 drivers/nvmem/s32g-ocotp-nvmem.c diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index 0bdd86d74f62..55016f803492 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -240,6 +240,16 @@ config NVMEM_NINTENDO_OTP This driver can also be built as a module. If so, the module will be called nvmem-nintendo-otp. =20 +config NVMEM_S32G_OCOTP + tristate "S32G SoC OCOTP support" + depends on ARCH_S32 + help + This is a driver for the 'OCOTP' peripheral available on S32G + platforms. + + If you say Y here, you will get support for the One Time + Programmable memory pages. + config NVMEM_QCOM_QFPROM tristate "QCOM QFPROM Support" depends on ARCH_QCOM || COMPILE_TEST diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile index 84fef48b7ff6..e01bb4ad612a 100644 --- a/drivers/nvmem/Makefile +++ b/drivers/nvmem/Makefile @@ -79,6 +79,8 @@ obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) +=3D nvmem_sunplus_ocot= p.o nvmem_sunplus_ocotp-y :=3D sunplus-ocotp.o obj-$(CONFIG_NVMEM_SUNXI_SID) +=3D nvmem_sunxi_sid.o nvmem_sunxi_sid-y :=3D sunxi_sid.o +obj-$(CONFIG_NVMEM_S32G_OCOTP) +=3D nvmem-s32g-ocotp-nvmem.o +nvmem-s32g-ocotp-nvmem-y :=3D s32g-ocotp-nvmem.o obj-$(CONFIG_NVMEM_U_BOOT_ENV) +=3D nvmem_u-boot-env.o nvmem_u-boot-env-y :=3D u-boot-env.o obj-$(CONFIG_NVMEM_UNIPHIER_EFUSE) +=3D nvmem-uniphier-efuse.o diff --git a/drivers/nvmem/s32g-ocotp-nvmem.c b/drivers/nvmem/s32g-ocotp-nv= mem.c new file mode 100644 index 000000000000..119871ab3a94 --- /dev/null +++ b/drivers/nvmem/s32g-ocotp-nvmem.c @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2023-2025 NXP + */ + +#include +#include +#include +#include +#include +#include +#include + +struct s32g_ocotp_priv { + struct device *dev; + void __iomem *base; +}; + +static int s32g_ocotp_read(void *context, unsigned int offset, + void *val, size_t bytes) +{ + struct s32g_ocotp_priv *s32g_data =3D context; + u32 *dst =3D val; + + while (bytes >=3D sizeof(u32)) { + *dst++ =3D ioread32(s32g_data->base + offset); + + bytes -=3D sizeof(u32); + offset +=3D sizeof(u32); + } + + return 0; +} + +static struct nvmem_keepout s32g_keepouts[] =3D { + { .start =3D 0, .end =3D 520 }, + { .start =3D 540, .end =3D 564 }, + { .start =3D 596, .end =3D 664 }, + { .start =3D 668, .end =3D 676 }, + { .start =3D 684, .end =3D 732 }, + { .start =3D 744, .end =3D 864 }, + { .start =3D 908, .end =3D 924 }, + { .start =3D 928, .end =3D 936 }, + { .start =3D 948, .end =3D 964 }, + { .start =3D 968, .end =3D 976 }, + { .start =3D 984, .end =3D 1012 }, +}; + +static struct nvmem_config s32g_ocotp_nvmem_config =3D { + .name =3D "s32g-ocotp", + .add_legacy_fixed_of_cells =3D true, + .read_only =3D true, + .word_size =3D 4, + .reg_read =3D s32g_ocotp_read, + .keepout =3D s32g_keepouts, + .nkeepout =3D ARRAY_SIZE(s32g_keepouts), +}; + +static const struct of_device_id ocotp_of_match[] =3D { + { .compatible =3D "nxp,s32g2-ocotp" }, + { /* sentinel */ } +}; + +static int s32g_ocotp_probe(struct platform_device *pdev) +{ + struct s32g_ocotp_priv *s32g_data; + struct device *dev =3D &pdev->dev; + struct nvmem_device *nvmem; + struct resource *res; + + s32g_data =3D devm_kzalloc(dev, sizeof(*s32g_data), GFP_KERNEL); + if (!s32g_data) + return -ENOMEM; + + s32g_data->base =3D devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(s32g_data->base)) + return dev_err_probe(dev, PTR_ERR(s32g_data->base), + "Cannot map OCOTP device.\n"); + + s32g_data->dev =3D dev; + s32g_ocotp_nvmem_config.dev =3D dev; + s32g_ocotp_nvmem_config.priv =3D s32g_data; + s32g_ocotp_nvmem_config.size =3D resource_size(res); + + nvmem =3D devm_nvmem_register(dev, &s32g_ocotp_nvmem_config); + + return PTR_ERR_OR_ZERO(nvmem); +} + +static struct platform_driver s32g_ocotp_driver =3D { + .probe =3D s32g_ocotp_probe, + .driver =3D { + .name =3D "s32g-ocotp", + .of_match_table =3D ocotp_of_match, + }, +}; +module_platform_driver(s32g_ocotp_driver); +MODULE_AUTHOR("NXP"); +MODULE_DESCRIPTION("S32G OCOTP driver"); +MODULE_LICENSE("GPL"); --=20 2.47.2 From nobody Fri Oct 3 10:10:30 2025 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 9B54F2EDD48 for ; Tue, 2 Sep 2025 09:48:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756806484; cv=none; b=rIj65Ukn9K4ifcqE5VFIgigbH19xemYBySCnr7DFNc6xS2oturCRPn2ybt/UlBfFSkMYfYsxd8Nz6Lru/G7uGf+4WwBSYIrj6/uq5gwaKcmc7XbHjXtjeijEKWq1Q2+oyVW46yd8i9XTmIHGi4KfMtZlJtWzu+arXgWjVxonQuY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756806484; c=relaxed/simple; bh=yuhYbpTjEHtc2K9Yfd0cA0AiG7uR95InZUdVYtUB94A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZHrklZkgrO2APrpRifjtkJ0AFwbcIVGi0nWiyNRkeh7WM+fDScCsXrosMGIlHuqBt3CDATn/4icF8N4bBd24n+hU+NN7JnLzmcFfhZwZQR+n5BADgR4kRbGUAqwiUhpT9DHLMRfRp218fqBULWqWVGH0dnaBusgD+nhbLoJzh64= 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=eBEbusgE; arc=none smtp.client-ip=209.85.128.54 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="eBEbusgE" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-45b8b02dd14so12653475e9.1 for ; Tue, 02 Sep 2025 02:48:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1756806481; x=1757411281; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=+AE+C1WgV7UwNd3pLh9lQDj1/1l/Oj2ofxSGM6ePL1Q=; b=eBEbusgEODYp40Ykfx/W0Hga8NEE5Kc2ZHhnF6cWmjwjwD7XImHBZfz8pxF5jStp04 oElJYGWD84+a2bNjtDbLE9s80C+M5N57Dq6dlOl0/IxCAyjgIEi+ELBuvuR2yI73NeH2 JkYxc1Jar4W6qKgUxuN8CiKQEXgWadRnmH7BX/36MWGVT0JZtNwo+l+S/f1zY3TiPcNd gE+U3uAl2OHxLYxym7EX0fBSjhj3AXDZwF/QKsdAN4ivH/zqGqoofZPAbNfsaGOwaNUp tgc+QY0PcMvDkpmzv9/sl3iJo4YE3nisOvNmX5lXPRYYxAvZrotr9D9tRWyTe5XZX7xZ 8MoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756806481; x=1757411281; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+AE+C1WgV7UwNd3pLh9lQDj1/1l/Oj2ofxSGM6ePL1Q=; b=FDJzmBjz/8K083km1vLDEFm6eKfva7SV4IsqTUnbS3nL8EKU+m2oRdV+6BxWerhWsG /KIXgMFQIVSFxCP5ySzsW50P359JZIJ6/E5+EHYTfd7Tpnib28EbJe56d++61df5rjna umHVP0l/+xbZsCclr1hX83zTkqBBoC26Jpvj9EuF/jqKtNGCIf4KS+0r/4fjFAUOfJjy aaJreKfBbwOSYmgsOyQXmdTBZr7uye50xYQ8QFCG7DFowGxewRx7Kbd2oArRasm3Frg5 G1cnBgiNpuxgD38sDE7yvYZHsIOKOko1E87RxyiRrhhDsYo91J4dN6luk2QXvSJTGhcO LByQ== X-Forwarded-Encrypted: i=1; AJvYcCV5VqtfPfsG6s4QvPmDnMmzB/QwsU4r7nIjMt8abYoX3VmioE3iye3rfyRWwK3YMn9XCZJdRCZOUQNYuCw=@vger.kernel.org X-Gm-Message-State: AOJu0Ywlyi/LSAgBYTMiGeY+fHsCupckBUMWCFaEzu3tuG6BFLoZPkyC ND/Oq5qOKqri4bJ1FJRKZWaR7NllmwjAdd5YqH61cYuYpIoLjK4ctpNaUzIydxKOMuA= X-Gm-Gg: ASbGncuHW1fOfQDkwEA1/n2w7D939nlWdcvxPekjXFhLjkxIi+bl0b98d3esQVl3ID/ 6+G68WDlWDny6Bc7qaT16ljHQOWLFoiVtZCPqmFbGZ8M5osZmzYkVFqKBvvrBSpCDAQBwZW2vaE F3IBDpB4kqz0UhUMbz8+FZXNck1Ma+b3cHh5ch7d8lvHfBoI6rZGh90JIYoRs5qwWDGhVqCjAqq nKhznsxJ25D8QiaAG2Se6mI9f8JPx6Dx4s9hnXpwfyRBLKjwSapJszg0UBKVRxrl10YlTERvXN3 Rk7ngPBKV++SwE/zF1AqZj1Zueu29dPDcy/iOXgdqa+MchEJBTeCEbwTZEYmKMd7esfgs9mhEQw ULSjU+zuxeXn7ttkZEAtcMI7yKsw= X-Google-Smtp-Source: AGHT+IHkum6MUnPnlTSyYdYK5PmduwrE+Bc7PlnDr2fgc28ulaODsmsfkztByA9uDZd9M5QRVY6Ofw== X-Received: by 2002:a05:600c:3153:b0:458:a559:a693 with SMTP id 5b1f17b1804b1-45b8557047amr89974305e9.18.1756806480844; Tue, 02 Sep 2025 02:48:00 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-45b6f0d32a2sm294964805e9.9.2025.09.02.02.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Sep 2025 02:48:00 -0700 (PDT) Date: Tue, 2 Sep 2025 12:47:57 +0300 From: Dan Carpenter To: Chester Lin Cc: Matthias Brugger , Ghennadi Procopciuc , NXP S32 Linux Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-s32@linaro.org Subject: [PATCH v3 3/3] arm64: dts: s32g: Add device tree information for the OCOTP driver Message-ID: <7877e1958fa92df92b2b5229365c86493c620c8c.1756800543.git.dan.carpenter@linaro.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add the device tree information for the S32G On Chip One-Time Programmable Controller (OCOTP) chip. Signed-off-by: Dan Carpenter --- v3: Add the device tree entry in the correct location based on the 0x400a4000 address. v2: change "ocotp: ocotp@400a4000 {" to "ocotp: nvmem@400a4000 {" --- arch/arm64/boot/dts/freescale/s32g2.dtsi | 7 +++++++ arch/arm64/boot/dts/freescale/s32g3.dtsi | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/s32g2.dtsi b/arch/arm64/boot/dts= /freescale/s32g2.dtsi index 6a7cc7b33754..d6a9f61394d3 100644 --- a/arch/arm64/boot/dts/freescale/s32g2.dtsi +++ b/arch/arm64/boot/dts/freescale/s32g2.dtsi @@ -355,6 +355,13 @@ serdes_presence: serdes-presence@100 { }; }; =20 + ocotp: nvmem@400a4000 { + compatible =3D "nxp,s32g2-ocotp"; + reg =3D <0x400a4000 0x400>; + #address-cells =3D <1>; + #size-cells =3D <1>; + }; + edma0: dma-controller@40144000 { compatible =3D "nxp,s32g2-edma"; reg =3D <0x40144000 0x24000>, diff --git a/arch/arm64/boot/dts/freescale/s32g3.dtsi b/arch/arm64/boot/dts= /freescale/s32g3.dtsi index 61ee08f0cfdc..f0e2a2907431 100644 --- a/arch/arm64/boot/dts/freescale/s32g3.dtsi +++ b/arch/arm64/boot/dts/freescale/s32g3.dtsi @@ -408,6 +408,13 @@ serdes_presence: serdes-presence@100 { }; }; =20 + ocotp: nvmem@400a4000 { + compatible =3D "nxp,s32g3-ocotp", "nxp,s32g2-ocotp"; + reg =3D <0x400a4000 0x400>; + #address-cells =3D <1>; + #size-cells =3D <1>; + }; + edma0: dma-controller@40144000 { compatible =3D "nxp,s32g3-edma", "nxp,s32g2-edma"; reg =3D <0x40144000 0x24000>, --=20 2.47.2