Received: by 2002:a05:6a10:5594:0:0:0:0 with SMTP id ee20csp377963pxb; Mon, 25 Apr 2022 11:47:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx28qyQG4wymBCdzzOHhT7XlIamdmMUJfQKX+AisDB/LC2PWvaBY6/iSkI8NOHoyV4uLVIV X-Received: by 2002:a17:90a:4813:b0:1c9:e5c3:5abf with SMTP id a19-20020a17090a481300b001c9e5c35abfmr33292217pjh.139.1650912442630; Mon, 25 Apr 2022 11:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650912442; cv=none; d=google.com; s=arc-20160816; b=WT13ZGEXUsebVDoLVQFUl42+QOEcQ8z9I5NdzjJEpbVcl+SdDKUFKcvWjk2aA9JaNP lK46+ofcmoWjkkgccmWgFit3ysb8NLNO3B/fJYJ1dWWEToeOVLoF28S0QB05L0h76qSb zv85NCyRV2F21W7W70F7jANoS73SxTjM7JGskxlw/uuEE9Kh2MgWj9N8aYcZEzZDMxw3 4XSCXYyVMcX44Kj38FEV+hTw38BbWu26LYNESL5fahQLL6swgfLbS71Yjxdr/AiNl7u0 NYUo51kPVXZKz4h6n0vpD96RPOudsV1NgSMxCtU4+lSHAfwwPSXU+aTI+xhFwuqv0SVT h9yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=hwdEvu1QeW6CN8XD9JWW4BQQtJcBisHi9+un6ZV5BI0=; b=0288QWuuRIhlE2sK+2CtpvF1fG5nbnoCk5LobZqzcYXVhVnGZQVh/nv5kkhiKpq+Fm 2HxeZZaR65DkIPMbAg62Go/WOxJefm03VNrplzbb86hkIt649P1tWD2Uqy5OmP0+8Lne 5Hrp77lN10Sx7zt8QHThrrXhKJV1/rQF96vaaSw/g9e7k7Sl3FDaefbaUO9wARzImf05 McWsNuk9XGMn1YM1Dr3Xi0OY0MGdvrvhpSBIZ/QbpMQOigTPUECt+IPODHSlvnBHFd1X pVZzkf/v0yACzTo+A0zbztahi6guekZnK9+6QEvcOQYWlvgmFSzi4IKsI+M3biD84+z6 6OIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=P1bPH9Q7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x8-20020a170902ec8800b0015cf4f42e6fsi6270142plg.177.2022.04.25.11.47.05; Mon, 25 Apr 2022 11:47:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=P1bPH9Q7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243158AbiDYQEW (ORCPT + 99 others); Mon, 25 Apr 2022 12:04:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243149AbiDYQEU (ORCPT ); Mon, 25 Apr 2022 12:04:20 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4B01E012; Mon, 25 Apr 2022 09:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1650902476; x=1682438476; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=hwdEvu1QeW6CN8XD9JWW4BQQtJcBisHi9+un6ZV5BI0=; b=P1bPH9Q7wn7EKlVdBDuf7zQjrSOPddQw84XVtbFwlctSVAVuOnHfE9M5 uSgXTHibesRWr9wELP627x5V9b617ipqZOJv/gFrlmcVSiQZmY7h7o2FT NF3naBCKL4AYkhIDFderb1UjerQREruKBQ2vMwgw/wEIyA79w04TDulv8 A=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 25 Apr 2022 09:01:14 -0700 X-QCInternal: smtphost Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 25 Apr 2022 09:01:12 -0700 X-QCInternal: smtphost Received: from c-sbhanu-linux.qualcomm.com ([10.242.50.201]) by ironmsg02-blr.qualcomm.com with ESMTP; 25 Apr 2022 21:30:52 +0530 Received: by c-sbhanu-linux.qualcomm.com (Postfix, from userid 2344807) id 05F6BB8E; Mon, 25 Apr 2022 21:30:50 +0530 (IST) From: Shaik Sajida Bhanu To: adrian.hunter@intel.com, ulf.hansson@linaro.org, wsa+renesas@sang-engineering.com, yoshihiro.shimoda.uh@renesas.com, linus.walleij@linaro.org, digetx@gmail.com, briannorris@chromium.org, quic_riteshh@quicinc.com Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, quic_asutoshd@quicinc.com, quic_rampraka@quicinc.com, quic_pragalla@quicinc.com, quic_sartgarg@quicinc.com, quic_nitirawa@quicinc.com, quic_sayalil@quicinc.com, Shaik Sajida Bhanu , Liangliang Lu , "Bao D . Nguyen" Subject: [PATCH V5 4/5] mmc: debugfs: Add debug fs error state entry for mmc driver Date: Mon, 25 Apr 2022 21:30:42 +0530 Message-Id: <1650902443-26357-5-git-send-email-quic_c_sbhanu@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1650902443-26357-1-git-send-email-quic_c_sbhanu@quicinc.com> References: <1650902443-26357-1-git-send-email-quic_c_sbhanu@quicinc.com> X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add debug fs entry error state to query eMMC and SD card errors statistics. If any errors occurred in eMMC and SD card driver level then err_state value will be set to 1. Signed-off-by: Liangliang Lu Signed-off-by: Sayali Lokhande Signed-off-by: Bao D. Nguyen Signed-off-by: Shaik Sajida Bhanu --- drivers/mmc/core/debugfs.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 6aa5a60..2f5b63f 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -222,6 +222,29 @@ static int mmc_clock_opt_set(void *data, u64 val) DEFINE_DEBUGFS_ATTRIBUTE(mmc_clock_fops, mmc_clock_opt_get, mmc_clock_opt_set, "%llu\n"); +static int mmc_err_state_get(void *data, u64 *val) +{ + struct mmc_host *host = data; + + if (!host) + return -EINVAL; + + *val = host->err_stats[MMC_ERR_REQ_TIMEOUT] || + host->err_stats[MMC_ERR_ADMA] || + host->err_stats[MMC_ERR_CTRL_TIMEOUT] || + host->err_stats[MMC_ERR_UNEXPECTED_IRQ] || + host->err_stats[MMC_ERR_CMDQ_RED] || + host->err_stats[MMC_ERR_CMDQ_GCE] || + host->err_stats[MMC_ERR_CMDQ_ICCE] || + host->err_stats[MMC_ERR_DAT_TIMEOUT] || + host->err_stats[MMC_ERR_DAT_CRC] || + host->err_stats[MMC_ERR_CMD_CRC] || + host->err_stats[MMC_ERR_CMD_TIMEOUT]; + + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(mmc_err_state, mmc_err_state_get, NULL, "%llu\n"); static int mmc_err_stats_show(struct seq_file *file, void *data) { @@ -289,6 +312,8 @@ void mmc_add_host_debugfs(struct mmc_host *host) debugfs_create_file_unsafe("clock", S_IRUSR | S_IWUSR, root, host, &mmc_clock_fops); + debugfs_create_file("err_state", 0600, root, host, + &mmc_err_state); debugfs_create_file("err_stats", 0600, root, host, &mmc_err_stats_fops); -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation