Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93DAFC636CC for ; Wed, 15 Feb 2023 23:49:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D184285A68; Thu, 16 Feb 2023 00:49:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="Ip3/t0qJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C1A1685763; Thu, 16 Feb 2023 00:49:10 +0100 (CET) Received: from xvfrpbcd.outbound-mail.sendgrid.net (xvfrpbcd.outbound-mail.sendgrid.net [168.245.59.205]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1CE6D85A78 for ; Thu, 16 Feb 2023 00:48:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=G8fW8O+Im2aC19dEjW5UQ0NuwCHftobt+WjAfcwz6b8=; b=Ip3/t0qJrgxQ2iN5xj/lj+smgHtAKRP4pCf+EuuQL5f9XwGDWc2Q5b8O79xWD4Qapv8Q tnSZ5dxRd2ruRQ+s02yaRAxDYqyq15ZKwbOYLFjfCPXrkxqGgip43yI8CMuOGnWxqtAo5E vKWwbQdCuciQUntF+90tmpMkeYgwqfKfW0Kxgj6zHbSWVxRkioTzceOwgPqFQe8A69Y4j4 hAiEK1n/Ixs4Lx7UKkW2INBaisDCOD88QQmuWvkx69Sogm8w+SMdmbisQ4X9ZWAgC8lm+4 BBumPP3fyVQu84VLSfLmpg6OgZM/9y9r7XSs1yA3Ma4gwy++ig3CjeOv8rVpZPwQ== Received: by filterdrecv-8dd65bbd4-sfhdn with SMTP id filterdrecv-8dd65bbd4-sfhdn-1-63ED6F6A-A 2023-02-15 23:48:58.321059649 +0000 UTC m=+449459.316784707 Received: from bionic.localdomain (unknown) by geopod-ismtpd-6-2 (SG) with ESMTP id f3IVLzbpSZW4rEpGDRa5Yw Wed, 15 Feb 2023 23:48:58.038 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 04/11] rockchip: otp: Add dump_otp debug command Date: Wed, 15 Feb 2023 23:48:58 +0000 (UTC) Message-Id: <20230215234853.2624074-5-jonas@kwiboo.se> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230215234853.2624074-1-jonas@kwiboo.se> References: <20230215234853.2624074-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0h1K9jiT6sG=2F+pwAVv?= =?us-ascii?Q?NUVCopY=2F8nl1Q15o1wxaz=2FNp3X2P4JKb60ymnbj?= =?us-ascii?Q?3pE6QXJb1PbMcV2NzSbwhdZTxbNyx3MkrhzzoAm?= =?us-ascii?Q?t6Lf9OV0UrFWUI9=2Fm+Pxh1WU4AaGSqX2cutMJwf?= =?us-ascii?Q?2Zv+RnWU2Ga3QhUxID4bqqNRtOZbI2nCFE2uUi?= To: Simon Glass , Philipp Tomsich , Kever Yang Cc: Alex Bee , u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Add a simple debug command to dump the content of the otp. Signed-off-by: Jonas Karlman --- drivers/misc/rockchip-otp.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/misc/rockchip-otp.c b/drivers/misc/rockchip-otp.c index babb6ce2f241..c41f0a606258 100644 --- a/drivers/misc/rockchip-otp.c +++ b/drivers/misc/rockchip-otp.c @@ -5,6 +5,8 @@ #include #include +#include +#include #include #include #include @@ -70,6 +72,39 @@ struct rockchip_otp_data { int block_size; }; +#if defined(DEBUG) +static int dump_otp(struct cmd_tbl *cmdtp, int flag, + int argc, char *const argv[]) +{ + struct udevice *dev; + u8 data[4]; + int ret, i; + + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(rockchip_otp), &dev); + if (ret) { + printf("%s: no misc-device found\n", __func__); + return 0; + } + + for (i = 0; true; i += sizeof(data)) { + ret = misc_read(dev, i, &data, sizeof(data)); + if (ret < 0) + return 0; + + print_buffer(i, data, sizeof(data), 1, 1); + } + + return 0; +} + +U_BOOT_CMD( + dump_otp, 1, 1, dump_otp, + "Dump the content of the otp", + "" +); +#endif + static int rockchip_otp_poll_timeout(struct rockchip_otp_plat *otp, u32 flag, u32 reg) { -- 2.39.1