Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp644959pxm; Wed, 2 Mar 2022 05:52:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwoS8tDmRch/pPYXQWRrkDUlmVLFnn5ixmqkuPztyuLuhtIQVVc67nOrAAU4hCsxmYMQKbB X-Received: by 2002:a05:6402:50cb:b0:412:ab6d:c807 with SMTP id h11-20020a05640250cb00b00412ab6dc807mr29007825edb.382.1646229136652; Wed, 02 Mar 2022 05:52:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646229136; cv=none; d=google.com; s=arc-20160816; b=aKX1FkSQsGjngdr20fwp92zFIbFriJ9348yPg9rXcKb3bwy9fbSj4YoBW5t157Qb3z SlecHOAAzqTEgLpqbBap4mT68P7Vx9w7eovlEQTgPppbz7CY4YScAO6cNaZZvYBUQk2G gl80mDcMbHU9tz9tbiDZsgYSct/TaLY4xeSoaPpnHM4ZggDzTDSM952YQgbyOfJiTcQl DaZMLBNzHbVfYVcU6XOK4IyYnTfM36m8VaR2VNKNQL+EVzS79bjh9oWNMekSqXGpyteR CI8oLtepXcdGs+tWkWqTYhg2mfF7ELpF8fubHkf6O/co14uVQbH9u7Q/uGp1CBGYAqUj CIhg== 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=0Pp6zzFaPm+z/5Swraj/qnkxiWNsONk0eUFF4PCYf9I=; b=Lbn10M2aMPiQRjJ5VlFyE7Ut18nO7yOSxrjH9S0DZ62or3xoUX0xu5UPAjtB6lTjpN oC3UMGvHLLRaCEw1TPELUql3FGyVXLOHztUN8NAZkpmp8TQSjEMiAiusSv6rIUd5zIaP rAv0e/fXoUuJm28U1vJamCifc9UN0dkVRE32M9v+rm/2wIb8Qg3K56yxA7XLgAdS81DL Hj/z3OzI+Ii85id5LdIWPUixZ8PtWRh8qPo7Vt2C50JYFIuoE8YbaOoZUO1FJbgB6+Rd KPG4ENkcWR+NO0yKsd67sL1y0rZZd92zRzId3NMMCzhe2xkKNHz0ZNcllTXuZ6k0L4Bo tpnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b="DeaJQ/ZS"; 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 l12-20020a170906794c00b006d7db627954si2028245ejo.313.2022.03.02.05.51.52; Wed, 02 Mar 2022 05:52:16 -0800 (PST) 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="DeaJQ/ZS"; 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 S242081AbiCBNFH (ORCPT + 99 others); Wed, 2 Mar 2022 08:05:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242029AbiCBNE4 (ORCPT ); Wed, 2 Mar 2022 08:04:56 -0500 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16B6BC2E40; Wed, 2 Mar 2022 05:04:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1646226253; x=1677762253; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=0Pp6zzFaPm+z/5Swraj/qnkxiWNsONk0eUFF4PCYf9I=; b=DeaJQ/ZSf3MGwdCnVZPxwQop/Ce6oxziIrIxtmJrPyk32S9uDflwcuqA 5TYEOC3w8uXhO9yG9V481zhRgWXW2N/k5gZjFKtBdQZNO2jGdxUQN1BYu SMhasaAauui877Ll6OA+zGlm8zoayKGGpdKjTc4t5FYsF+bDB0ZCkd3P0 o=; Received: from ironmsg07-lv.qualcomm.com ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 02 Mar 2022 05:04:13 -0800 X-QCInternal: smtphost Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by ironmsg07-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 02 Mar 2022 05:04:11 -0800 X-QCInternal: smtphost Received: from c-sbhanu-linux.qualcomm.com ([10.242.50.201]) by ironmsg02-blr.qualcomm.com with ESMTP; 02 Mar 2022 18:33:59 +0530 Received: by c-sbhanu-linux.qualcomm.com (Postfix, from userid 2344807) id 424D8587E; Wed, 2 Mar 2022 18:33:58 +0530 (IST) From: Shaik Sajida Bhanu To: adrian.hunter@intel.com, quic_riteshh@quicinc.com, asutoshd@quicinc.com, ulf.hansson@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, linux-mmc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: quic_vbadigan@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 , Sayali Lokhande , "Bao D . Nguyen" Subject: [PATCH V4 6/7] mmc: sdhci: Set error state for mmc driver Date: Wed, 2 Mar 2022 18:33:46 +0530 Message-Id: <1646226227-32429-7-git-send-email-quic_c_sbhanu@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1646226227-32429-1-git-send-email-quic_c_sbhanu@quicinc.com> References: <1646226227-32429-1-git-send-email-quic_c_sbhanu@quicinc.com> X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Set error state if any errors observed in eMMC and SD card driver level. Signed-off-by: Liangliang Lu Signed-off-by: Sayali Lokhande Signed-off-by: Bao D. Nguyen Signed-off-by: Ram Prakash Gupta Signed-off-by: Shaik Sajida Bhanu --- drivers/mmc/host/sdhci.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 741fb06..4ba3797 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -224,6 +224,8 @@ void sdhci_reset(struct sdhci_host *host, u8 mask) if (timedout) { pr_err("%s: Reset 0x%x never completed.\n", mmc_hostname(host->mmc), (int)mask); + if (host->mmc && !host->mmc->err_state) + mmc_debugfs_err_stats_enable(host->mmc); sdhci_dumpregs(host); return; } @@ -1716,6 +1718,8 @@ static bool sdhci_send_command_retry(struct sdhci_host *host, if (!timeout--) { pr_err("%s: Controller never released inhibit bit(s).\n", mmc_hostname(host->mmc)); + if (host->mmc && !host->mmc->err_state) + mmc_debugfs_err_stats_enable(host->mmc); sdhci_dumpregs(host); cmd->error = -EIO; return false; @@ -1965,6 +1969,8 @@ void sdhci_enable_clk(struct sdhci_host *host, u16 clk) if (timedout) { pr_err("%s: Internal clock never stabilised.\n", mmc_hostname(host->mmc)); + if (host->mmc && !host->mmc->err_state) + mmc_debugfs_err_stats_enable(host->mmc); sdhci_dumpregs(host); return; } @@ -1987,6 +1993,8 @@ void sdhci_enable_clk(struct sdhci_host *host, u16 clk) if (timedout) { pr_err("%s: PLL clock never stabilised.\n", mmc_hostname(host->mmc)); + if (host->mmc && !host->mmc->err_state) + mmc_debugfs_err_stats_enable(host->mmc); sdhci_dumpregs(host); return; } @@ -3162,6 +3170,8 @@ static void sdhci_timeout_timer(struct timer_list *t) mmc_debugfs_err_stats_inc(host->mmc, MMC_ERR_REQ_TIMEOUT); pr_err("%s: Timeout waiting for hardware cmd interrupt.\n", mmc_hostname(host->mmc)); + if (host->mmc && !host->mmc->err_state) + mmc_debugfs_err_stats_enable(host->mmc); sdhci_dumpregs(host); host->cmd->error = -ETIMEDOUT; @@ -3185,6 +3195,8 @@ static void sdhci_timeout_data_timer(struct timer_list *t) mmc_debugfs_err_stats_inc(host->mmc, MMC_ERR_REQ_TIMEOUT); pr_err("%s: Timeout waiting for hardware interrupt.\n", mmc_hostname(host->mmc)); + if (host->mmc && !host->mmc->err_state) + mmc_debugfs_err_stats_enable(host->mmc); sdhci_dumpregs(host); if (host->data) { @@ -3236,6 +3248,8 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask, u32 *intmask_p) return; pr_err("%s: Got command interrupt 0x%08x even though no command operation was in progress.\n", mmc_hostname(host->mmc), (unsigned)intmask); + if (host->mmc && !host->mmc->err_state) + mmc_debugfs_err_stats_enable(host->mmc); sdhci_dumpregs(host); return; } @@ -3289,6 +3303,8 @@ static void sdhci_adma_show_error(struct sdhci_host *host) void *desc = host->adma_table; dma_addr_t dma = host->adma_addr; + if (host->mmc && !host->mmc->err_state) + mmc_debugfs_err_stats_enable(host->mmc); sdhci_dumpregs(host); while (true) { @@ -3378,6 +3394,8 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) pr_err("%s: Got data interrupt 0x%08x even though no data operation was in progress.\n", mmc_hostname(host->mmc), (unsigned)intmask); + if (host->mmc && !host->mmc->err_state) + mmc_debugfs_err_stats_enable(host->mmc); sdhci_dumpregs(host); return; @@ -3599,6 +3617,8 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) if (unexpected) { pr_err("%s: Unexpected interrupt 0x%08x.\n", mmc_hostname(host->mmc), unexpected); + if (host->mmc && !host->mmc->err_state) + mmc_debugfs_err_stats_enable(host->mmc); sdhci_dumpregs(host); } @@ -3962,6 +3982,8 @@ bool sdhci_cqe_irq(struct sdhci_host *host, u32 intmask, int *cmd_error, sdhci_writel(host, intmask, SDHCI_INT_STATUS); pr_err("%s: CQE: Unexpected interrupt 0x%08x.\n", mmc_hostname(host->mmc), intmask); + if (host->mmc && !host->mmc->err_state) + mmc_debugfs_err_stats_enable(host->mmc); sdhci_dumpregs(host); } -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation