Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2279432rdb; Fri, 8 Dec 2023 03:53:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHrtpOlSrQ0/BQ7u5pjTIOLNM61rlZo6kHKXuW1xyHsxYQcSPtmXaW2OF7MHZ+mForpxp+ X-Received: by 2002:a17:902:8491:b0:1d0:6ffd:6e85 with SMTP id c17-20020a170902849100b001d06ffd6e85mr3244134plo.125.1702036394083; Fri, 08 Dec 2023 03:53:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702036394; cv=none; d=google.com; s=arc-20160816; b=c10CwEoYM5FYHrWMpnDHmPCVxUi8X5JvZGtD3cngjk6HDhr2okdsCHejXcWMGjeuMp 2xPdJc+JvvtfLwppdrtAGEn5nSxat0jIFHkRGBVNs5lfmSVEXq/bIK3CYp+qQLtFicfN +16iox50iUy4lEKHWpE1+vJLjXUzzuaeE7KRdYfphzhGdeNWSWnC9x3lHkaagspLT3zT aDRGwPGIJfs+7b0pS1h+mIfacdDB5LZ3PYZdXghELQ8+rOgAj6GPBTWnwYow6Xs2qmzz QRkSCZeLP31RTBKr8vJxmKPV5+NTnYTm0dha9oldDgcVBXQi2lxGTwECLKDYgz/WlUTX jHIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=LWwkDICaANTCLBkKNyjRtb2b7p1OpvE2Uyw4u3EGEOc=; fh=WCty2XGIotuk7UnGGgLICTL0mfylSD7NePhIgd3gZgQ=; b=W6N+7hutz21N4+D8SpGTJlI3PptH1+jPlPn4xXXdcbRLwnXYMUmOV+mqLcmOYBKJG2 ernxTmlfxLWhP7J7PSURZEc70FjqNl9lGHLzmAMIai/FZjqn3uvr16soIkSNxkitBgBj FJjW2sRU5T6fr8CPiS6CjzuBPStmLnIK9J+Ef1YE5/FrKULa2BH88kO//rBqQoKNWaow D+rw1K9rI880p5CGy/Bv9wK2muT6XYZP5m95gM0Dq5r7aCBg8IldsrWG9L4sbhihGGl/ KpFoMi6NI5nAlID0Gr1XGI+XFnq6yusQFFmeJmKogkyg4Odcglm+eBVve04PvJOa2aNG P9ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ibOSUrKE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id d11-20020a170902c18b00b001cf54c7adb7si1467936pld.20.2023.12.08.03.53.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 03:53:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ibOSUrKE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 238DE806290E; Fri, 8 Dec 2023 03:52:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233505AbjLHLwW (ORCPT + 99 others); Fri, 8 Dec 2023 06:52:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbjLHLwU (ORCPT ); Fri, 8 Dec 2023 06:52:20 -0500 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AEEC171F; Fri, 8 Dec 2023 03:52:24 -0800 (PST) Received: by mail-qt1-x829.google.com with SMTP id d75a77b69052e-425430fe8d1so12125771cf.1; Fri, 08 Dec 2023 03:52:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702036343; x=1702641143; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=LWwkDICaANTCLBkKNyjRtb2b7p1OpvE2Uyw4u3EGEOc=; b=ibOSUrKEPX0W3RLnoVT7TR4db3EOkFiiq8lg8K+55BQXjaicPZLxoAk+m1iGNc9mfQ l0RN5Tl5HaJ2k7Nd5yPS/JH52zOUEe358JaaWR0HHHPBuADB0y0QWkdjOK+Y+4IsdLGg GR50Gp/HMxfoP07OcrZvth4BePhg/ZNqGm814k0GijkLIJhxHNsuD+kP/X2VMUFOlzt6 oE1Omf1X5P6Y23AnX3MPzUMvo8pBRvf5sZfM40iI1Ib23H9Ixdk7cpCgVMrEo8H+js3k H3TXIvG5qGyGaofDPCotrz0L8aMgdXfG4HGWUDjvDkI0/mBhPIt1oRq/tinmVjsNSb3t 17eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702036343; x=1702641143; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LWwkDICaANTCLBkKNyjRtb2b7p1OpvE2Uyw4u3EGEOc=; b=WxeTuPSg5Kf9f0IpWtG51huz0eUu9uqaMHH2ndWfFogqwbxRN3Kcmn+qKOPw9OTyEg ABrV3GNuHjww60+yaDDGtBG1g3fHjUxf+GS18sWtbDhXf936nDdbwRx8SAxJkq/avy51 ZGK822PIRt/y6Axmd9eH7+T1HWaroZeCnUP1DMTQa8AB0ZS8TiwUaNCf+V1SHbFxmfAr mUhc2KDGBaBhIa6Q0Rety0zTCv5M4So0cHQ5+w46HScG5KDqo4PhhaaVSh6f8S8M6Duc bIQbcO/6dUki6qSI4n1G/jgxe0WnbZRhTltlqheO/rwpKGrLiRXlF/TJfx5ilQnO/0ij XoDw== X-Gm-Message-State: AOJu0YwQE7rTJwU8OZxO87YKhbENE8CE3ooiQwUAUJxO1TpNHARN/vLp A6I3nt9whA0oOScXwJqzKaFaq0czPnnQNS4SHV4= X-Received: by 2002:a05:6214:92:b0:67a:a721:782f with SMTP id n18-20020a056214009200b0067aa721782fmr3493346qvr.84.1702036343619; Fri, 08 Dec 2023 03:52:23 -0800 (PST) MIME-Version: 1.0 References: <20231204064934.21236-1-wenchao.chen@unisoc.com> In-Reply-To: From: Wenchao Chen Date: Fri, 8 Dec 2023 19:52:12 +0800 Message-ID: Subject: Re: [PATCH] mmc: sprd: Fix eMMC init failure after hw reset To: Ulf Hansson Cc: Wenchao Chen , zhang.lyra@gmail.com, orsonzhai@gmail.com, baolin.wang@linux.alibaba.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, zhenxiong.lai@unisoc.com, yuelin.tang@unisoc.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 08 Dec 2023 03:52:37 -0800 (PST) On Thu, 7 Dec 2023 at 21:59, Ulf Hansson wrote: > > On Mon, 4 Dec 2023 at 07:50, Wenchao Chen wrote: > > > > Some eMMC devices that do not close the auto clk gate > > after hw reset will cause eMMC initialization to fail. > > > > Signed-off-by: Wenchao Chen > > I assume we want this tagged for stable kernels too, but do we have a > corresponding fixes commit that we can point out? > > Kind regards > Uffe > Hi Uffe Sorry, I forgot to add fixes commit. Fixes: ff874dbc4f86 ("mmc: sdhci-sprd: Disable CLK_AUTO when the clock is less than 400K") Thanks > > --- > > drivers/mmc/host/sdhci-sprd.c | 10 +++++++--- > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c > > index 6b8a57e2d20f..bed57a1c64b5 100644 > > --- a/drivers/mmc/host/sdhci-sprd.c > > +++ b/drivers/mmc/host/sdhci-sprd.c > > @@ -239,15 +239,19 @@ static inline void _sdhci_sprd_set_clock(struct sdhci_host *host, > > div = ((div & 0x300) >> 2) | ((div & 0xFF) << 8); > > sdhci_enable_clk(host, div); > > > > + val = sdhci_readl(host, SDHCI_SPRD_REG_32_BUSY_POSI); > > + mask = SDHCI_SPRD_BIT_OUTR_CLK_AUTO_EN | SDHCI_SPRD_BIT_INNR_CLK_AUTO_EN; > > /* Enable CLK_AUTO when the clock is greater than 400K. */ > > if (clk > 400000) { > > - val = sdhci_readl(host, SDHCI_SPRD_REG_32_BUSY_POSI); > > - mask = SDHCI_SPRD_BIT_OUTR_CLK_AUTO_EN | > > - SDHCI_SPRD_BIT_INNR_CLK_AUTO_EN; > > if (mask != (val & mask)) { > > val |= mask; > > sdhci_writel(host, val, SDHCI_SPRD_REG_32_BUSY_POSI); > > } > > + } else { > > + if (val & mask) { > > + val &= ~mask; > > + sdhci_writel(host, val, SDHCI_SPRD_REG_32_BUSY_POSI); > > + } > > } > > } > > > > -- > > 2.17.1 > >