From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 042AC194A67; Tue, 27 May 2025 16:45:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748364316; cv=none; b=LfY7DcjPp4pIBE/gT0Zuwe5J39qNwjX5YKiK+ux4209HlFk+p6cDDHkaHKt7lCqIMj70r8WDlPp0tBoJWQOC1HAsowu0xi6p1XgvPkpEMbFqpVwNstVrJMOB9Pj/jD1yxEQWn9Qeta9f1aA2NrXuow31HaF82DeUXhpKc6xMPpw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748364316; c=relaxed/simple; bh=e2SVp75exz6N4aJJLF5NkWN86ngHIadFJdV26HhH84I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rvKms+g5vTrt/WJQU/vgqWJZxCBFV/rY4ip5ENN4XwKx/eCwI3T5DoW9+o+qOcwfb+ShJ865ViTJKXdHZ3RogLQaPNSXoaoWfBspSNdDwbau1RiFOCKNa2EiljFMW/ZnBoxC5PrumaCsaUVsZQEIEotL8yLIENNaa/pe31YyH38= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xRMzDYAv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xRMzDYAv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E948C4CEED; Tue, 27 May 2025 16:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748364315; bh=e2SVp75exz6N4aJJLF5NkWN86ngHIadFJdV26HhH84I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xRMzDYAvWFDQSQLOvCK70YYqdpHvd2LrD+d/cOf6SGYeeEPGVHtotpY4E3Z8b17ke KjA7EMIpxluHb3D3YwieTK0SohCFKCEA79FsMhi1k/Cz4MTd1qDxwtAOH6hMNzJSEC bAfC6fKvHyvyWaHWlAladOjo8xgTYNcC6q1+8MOE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Heiko Stuebner , Nicolas Frattaroli , Srinivas Kandagatla , Sasha Levin Subject: [PATCH 6.12 011/626] nvmem: rockchip-otp: Move read-offset into variant-data Date: Tue, 27 May 2025 18:18:24 +0200 Message-ID: <20250527162445.516438532@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527162445.028718347@linuxfoundation.org> References: <20250527162445.028718347@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Heiko Stuebner [ Upstream commit 6907e8093b3070d877ee607e5ceede60cfd08bde ] The RK3588 has an offset into the OTP area where the readable area begins and automatically adds this to the start address. Other variants are very much similar to rk3588, just with a different offset, so move that value into variant-data. To match the size in bytes, store this value also in bytes and not in number of blocks. Signed-off-by: Heiko Stuebner Tested-by: Nicolas Frattaroli Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20250411112251.68002-2-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/nvmem/rockchip-otp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/nvmem/rockchip-otp.c b/drivers/nvmem/rockchip-otp.c index ebc3f0b24166b..3edfbfc2d7220 100644 --- a/drivers/nvmem/rockchip-otp.c +++ b/drivers/nvmem/rockchip-otp.c @@ -59,7 +59,6 @@ #define RK3588_OTPC_AUTO_EN 0x08 #define RK3588_OTPC_INT_ST 0x84 #define RK3588_OTPC_DOUT0 0x20 -#define RK3588_NO_SECURE_OFFSET 0x300 #define RK3588_NBYTES 4 #define RK3588_BURST_NUM 1 #define RK3588_BURST_SHIFT 8 @@ -69,6 +68,7 @@ struct rockchip_data { int size; + int read_offset; const char * const *clks; int num_clks; nvmem_reg_read_t reg_read; @@ -196,7 +196,7 @@ static int rk3588_otp_read(void *context, unsigned int offset, addr_start = round_down(offset, RK3588_NBYTES) / RK3588_NBYTES; addr_end = round_up(offset + bytes, RK3588_NBYTES) / RK3588_NBYTES; addr_len = addr_end - addr_start; - addr_start += RK3588_NO_SECURE_OFFSET; + addr_start += otp->data->read_offset / RK3588_NBYTES; buf = kzalloc(array_size(addr_len, RK3588_NBYTES), GFP_KERNEL); if (!buf) @@ -280,6 +280,7 @@ static const char * const rk3588_otp_clocks[] = { static const struct rockchip_data rk3588_data = { .size = 0x400, + .read_offset = 0xc00, .clks = rk3588_otp_clocks, .num_clks = ARRAY_SIZE(rk3588_otp_clocks), .reg_read = rk3588_otp_read, -- 2.39.5