Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5974590iob; Tue, 10 May 2022 07:46:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxx/Y03P74j/22StWPnIpYqW25RG0k4G6ctaeWymYCu7ZG8sa1h0QSGTBfnyVrWcbPwUN9G X-Received: by 2002:a17:906:414f:b0:6f3:e324:4aae with SMTP id l15-20020a170906414f00b006f3e3244aaemr20943872ejk.727.1652193966797; Tue, 10 May 2022 07:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652193966; cv=none; d=google.com; s=arc-20160816; b=rPjNticd2ZDCmObaz9O5axqksw1yFRFPanNsy4CtYOAaZZijgI+GoozmignTC2HMy3 qu0aISEZX1ZGc2tkHQke4BWmMyGKqNRYMPQjSGtgYPRCvt2uM7MwLorcfsFjt3BRM27g cXr8VMLrz984l7Rvi92Srbscio3KuBUdSum11TH2Xnif9EnMO3UVoNBGh7F4Zu7+HmxH jagNQ4e20AHcyJdRmBq/56fpBv8klAegIJM9cg+sJS3SpVDoXQIwNPmxeqamVpExTW3b ntTsUVd7L6CjGLOUL+sk0yIBUgxdPwtx3TGJX0wgeGFTb1IHj2oC50771xqHxDbIWOnc DmxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=COFX/ItCMSdzNc3PdyS+osqiPStJ6Hwq5zSEO8O5gjY=; b=KNHxv1An9cMKI4RlqCOQwiC5KWc0BAevqeJPhFMk0pFXJOWFciNJL5i9Ym0rQFXsrO PIQD9SjZlKHsHgsVToTkxTgdxg8TuLushGtEtkTMsFP9nx+1g2qDgAy+Adhlkz5qszJy 67krIYxV4q6CARPwAoWYtTUpD/7p0pX1q0lXAOfnZ9zidUx3d6xsJ7n8c+RIrvTzaCxT w7drqtuPUIDIDXtkJGt8p9UzWlCSq5BUyeTE2j3GeJrPYW1lRCW8eAYt3tH1i8wdEZpO O69y5XWOHZlzsq1yuB1YFeoi2v64JTZSlZNvRXGkB3DwR8vp5orW1Lhf2LcsJNTpRNYM kXNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oxSKRxCs; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o4-20020a170906860400b006ef57f5e94esi14201398ejx.1006.2022.05.10.07.45.41; Tue, 10 May 2022 07:46:06 -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=@linuxfoundation.org header.s=korg header.b=oxSKRxCs; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343777AbiEJN7n (ORCPT + 99 others); Tue, 10 May 2022 09:59:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244483AbiEJNhp (ORCPT ); Tue, 10 May 2022 09:37:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A2D23F33C; Tue, 10 May 2022 06:25:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BEC2F60B12; Tue, 10 May 2022 13:25:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B226FC385D8; Tue, 10 May 2022 13:25:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652189141; bh=g+CxDpsJrUR4Wrwj2lmQW1ntkowQuLzhfCR3upGflZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oxSKRxCsu7ZA7cVsctQhexzxTULMcVIUwCflsEOPY9P/+5oLNQzea7Ui2ghKwh7HC 8pg8qL9Si8fEu/lKE3ZExNv1DdrSczRTxvOXzW2dQhQZqC14FrlkqzfoYU2uV12XSg q4GYHVzVXtxE5HCbtmJ9Q6adKzq1W1+HLA0qpltk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shaik Sajida Bhanu , Adrian Hunter , Philipp Zabel , Konrad Dybcio , Ulf Hansson Subject: [PATCH 5.10 05/70] mmc: sdhci-msm: Reset GCC_SDCC_BCR register for SDHC Date: Tue, 10 May 2022 15:07:24 +0200 Message-Id: <20220510130733.021043995@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130732.861729621@linuxfoundation.org> References: <20220510130732.861729621@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 From: Shaik Sajida Bhanu commit 3e5a8e8494a8122fe4eb3f167662f406cab753b9 upstream. Reset GCC_SDCC_BCR register before every fresh initilazation. This will reset whole SDHC-msm controller, clears the previous power control states and avoids, software reset timeout issues as below. [ 5.458061][ T262] mmc1: Reset 0x1 never completed. [ 5.462454][ T262] mmc1: sdhci: ============ SDHCI REGISTER DUMP =========== [ 5.469065][ T262] mmc1: sdhci: Sys addr: 0x00000000 | Version: 0x00007202 [ 5.475688][ T262] mmc1: sdhci: Blk size: 0x00000000 | Blk cnt: 0x00000000 [ 5.482315][ T262] mmc1: sdhci: Argument: 0x00000000 | Trn mode: 0x00000000 [ 5.488927][ T262] mmc1: sdhci: Present: 0x01f800f0 | Host ctl: 0x00000000 [ 5.495539][ T262] mmc1: sdhci: Power: 0x00000000 | Blk gap: 0x00000000 [ 5.502162][ T262] mmc1: sdhci: Wake-up: 0x00000000 | Clock: 0x00000003 [ 5.508768][ T262] mmc1: sdhci: Timeout: 0x00000000 | Int stat: 0x00000000 [ 5.515381][ T262] mmc1: sdhci: Int enab: 0x00000000 | Sig enab: 0x00000000 [ 5.521996][ T262] mmc1: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000 [ 5.528607][ T262] mmc1: sdhci: Caps: 0x362dc8b2 | Caps_1: 0x0000808f [ 5.535227][ T262] mmc1: sdhci: Cmd: 0x00000000 | Max curr: 0x00000000 [ 5.541841][ T262] mmc1: sdhci: Resp[0]: 0x00000000 | Resp[1]: 0x00000000 [ 5.548454][ T262] mmc1: sdhci: Resp[2]: 0x00000000 | Resp[3]: 0x00000000 [ 5.555079][ T262] mmc1: sdhci: Host ctl2: 0x00000000 [ 5.559651][ T262] mmc1: sdhci_msm: ----------- VENDOR REGISTER DUMP----------- [ 5.566621][ T262] mmc1: sdhci_msm: DLL sts: 0x00000000 | DLL cfg: 0x6000642c | DLL cfg2: 0x0020a000 [ 5.575465][ T262] mmc1: sdhci_msm: DLL cfg3: 0x00000000 | DLL usr ctl: 0x00010800 | DDR cfg: 0x80040873 [ 5.584658][ T262] mmc1: sdhci_msm: Vndr func: 0x00018a9c | Vndr func2 : 0xf88218a8 Vndr func3: 0x02626040 Fixes: 0eb0d9f4de34 ("mmc: sdhci-msm: Initial support for Qualcomm chipsets") Signed-off-by: Shaik Sajida Bhanu Acked-by: Adrian Hunter Reviewed-by: Philipp Zabel Tested-by: Konrad Dybcio Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/1650816153-23797-1-git-send-email-quic_c_sbhanu@quicinc.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sdhci-msm.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "sdhci-pltfm.h" #include "cqhci.h" @@ -2228,6 +2229,43 @@ static inline void sdhci_msm_get_of_prop of_property_read_u32(node, "qcom,dll-config", &msm_host->dll_config); } +static int sdhci_msm_gcc_reset(struct device *dev, struct sdhci_host *host) +{ + struct reset_control *reset; + int ret = 0; + + reset = reset_control_get_optional_exclusive(dev, NULL); + if (IS_ERR(reset)) + return dev_err_probe(dev, PTR_ERR(reset), + "unable to acquire core_reset\n"); + + if (!reset) + return ret; + + ret = reset_control_assert(reset); + if (ret) { + reset_control_put(reset); + return dev_err_probe(dev, ret, "core_reset assert failed\n"); + } + + /* + * The hardware requirement for delay between assert/deassert + * is at least 3-4 sleep clock (32.7KHz) cycles, which comes to + * ~125us (4/32768). To be on the safe side add 200us delay. + */ + usleep_range(200, 210); + + ret = reset_control_deassert(reset); + if (ret) { + reset_control_put(reset); + return dev_err_probe(dev, ret, "core_reset deassert failed\n"); + } + + usleep_range(200, 210); + reset_control_put(reset); + + return ret; +} static int sdhci_msm_probe(struct platform_device *pdev) { @@ -2276,6 +2314,10 @@ static int sdhci_msm_probe(struct platfo msm_host->saved_tuning_phase = INVALID_TUNING_PHASE; + ret = sdhci_msm_gcc_reset(&pdev->dev, host); + if (ret) + goto pltfm_free; + /* Setup SDCC bus voter clock. */ msm_host->bus_clk = devm_clk_get(&pdev->dev, "bus"); if (!IS_ERR(msm_host->bus_clk)) {