From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 643B1C52D6F for ; Wed, 21 Aug 2024 11:06:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+hE4Oaa/+RDBODWq0UJM3XXnYgcGWlBIKzul9txp90I=; b=TrNkuKPAlyxN38GomnaPYmRArd 1nuZQnXfIv4R4LVCkq2MC1Y/kwFimJEHH1OKtRz3y8pubqnvbquifqglmIXFEAMAYEMJb9Ldpczap tN78+OWAgazAaeumSyPEPTfCkymuzeaOrtBpaZk6J+pJ6MMEWmUG4gVFyNs9FYxD6RDyxu+ZWwdFy vTPFp9Sjt/l5LVXzH1hFJwo4VT6SdCQD3IMhtwf9+1v+VrS2BtH8KVgOtGEGQBnz6erkpbRLILJVF 29bTBQ8xDMyvoou04OpkYXvZ2e0nK5Ta0OE6fBrB45fn3WCIDmx8iUpKuELZLvC3G9wNYotsiSt2P L3/Nv54A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgjAC-00000008Zsb-3Xdq; Wed, 21 Aug 2024 11:06:04 +0000 Received: from mail.thorsis.com ([2003:a:e28:26e4::10]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgj4I-00000008XV9-0Gm4 for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2024 11:00:07 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id DDC611483DF8; Wed, 21 Aug 2024 12:59:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thorsis.com; s=dkim; t=1724237996; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=+hE4Oaa/+RDBODWq0UJM3XXnYgcGWlBIKzul9txp90I=; b=H4An3j4CsF/zMsyyX616M0lmcq0coy9KfP0i1tuxNvh/Z3qtjzQZj4E8+44XU3I4+U8a+R JXtT0A/0TVrbPuMyC0RcSC+pYUXX9tNsx1CGkCKslwBH/fkXRl1LGucosKHd/u5aG0cA7j grkIE4uQFVAWFkdKAmP5POGgyzMuUFZU1RywA98xK33WEmzh8FP/D5yBA20WureSPre/V4 pmdaRkH31phg35fxpBCZl5CEu34UV5Y0SZUJK282z2JkVD43gC485p6KzyBhvYYwCxEpJR Mf76kaXaYmIq6ZA8Ix2biACBKaMub9I6Ajx6A9S7jlyNNJsQ+wcobMb6/5mV3w== From: Alexander Dahl To: Claudiu Beznea Cc: Christian Melki , Srinivas Kandagatla , linux-arm-kernel@lists.infradead.org (moderated list:MICROCHIP OTPC DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 08/12] nvmem: microchip-otpc: Add warnings for bad OTPC conditions on probe Date: Wed, 21 Aug 2024 12:59:39 +0200 Message-Id: <20240821105943.230281-9-ada@thorsis.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240821105943.230281-1-ada@thorsis.com> References: <20240821105943.230281-1-ada@thorsis.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_035958_364592_41DBCB1A X-CRM114-Status: GOOD ( 10.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org These conditions could affect correct function of the driver. Signed-off-by: Alexander Dahl --- drivers/nvmem/microchip-otpc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/nvmem/microchip-otpc.c b/drivers/nvmem/microchip-otpc.c index 4630e96243ac..a80535c3d162 100644 --- a/drivers/nvmem/microchip-otpc.c +++ b/drivers/nvmem/microchip-otpc.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -260,6 +261,7 @@ static int mchp_otpc_probe(struct platform_device *pdev) struct nvmem_device *nvmem; struct mchp_otpc *otpc; u32 size; + u32 reg; int ret; otpc = devm_kzalloc(&pdev->dev, sizeof(*otpc), GFP_KERNEL); @@ -270,6 +272,16 @@ static int mchp_otpc_probe(struct platform_device *pdev) if (IS_ERR(otpc->base)) return PTR_ERR(otpc->base); + reg = readl_relaxed(otpc->base + MCHP_OTPC_WPSR); + if (reg) + dev_warn(&pdev->dev, + "Write Protection Status Register Bit set: 0x%08x\n", reg); + + reg = readl_relaxed(otpc->base + MCHP_OTPC_ISR); + if (reg & MCHP_OTPC_ISR_COERR) + dev_warn(&pdev->dev, + "A corruption occurred since the last read of OTPC_ISR.\n"); + otpc->dev = &pdev->dev; ret = mchp_otpc_init_packets_list(otpc, &size); if (ret) -- 2.39.2