Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp509381rdh; Wed, 14 Feb 2024 03:47:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXSQ14TFSpqvZnzSzXR4wObRjiJQ1AT5FFOGJ+quWopU72sTfc8mtX0b5gKU4juarZZymxLGbSzZhzCySw0ygr/kl3VsmxEjSASHad1yg== X-Google-Smtp-Source: AGHT+IHmnRvJUtCuAEYIdAgoTjrieSDeWkH+oRhsHylQPzwhKyeVF3UxY2F2jSq2YQLVUytkRFp8 X-Received: by 2002:a17:90a:d990:b0:298:b9f7:83f7 with SMTP id d16-20020a17090ad99000b00298b9f783f7mr2042891pjv.24.1707911272474; Wed, 14 Feb 2024 03:47:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707911272; cv=pass; d=google.com; s=arc-20160816; b=oosKpHs7NOjUoK3QQ5bZnO+lmtP1Il3sIn+OiObpvXBgDDB0jGhTKLGGIm+o2WaPRo byuLxzZ8d9i8vu5YhlvKH4Yx+ilQX0q+n6Z5Df1Cw4Ysr0t1xVk/wQT+QAzA+LB7zA08 R83JoULDvAlzEgMi9BOYtw9zgsRXhsDCtQsf8oWs3xFgY73C+vAoM5zQ849WgeK5utWH w03f1Nd3gev9yv0l3nMdGMCXIpwlObWkmHXbrTFKDgKb4W5reI7hTlwNknzpWvl1WQM1 c46FmuguuHXF7ACTJzRm33z3oM4U5qTSe8sGlTDVKt7ogJtNNjfzIPSoCe7MJZuRA2Go xInA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=J7vxhx2/+AlV4ML2Sm5aRUStZ5melg4wfKc+++QxWBI=; fh=ooLklndEL6PYj83+GVMU1PetzkvQOhSaNViUAnfwDkQ=; b=gLJmoK3Zy6jbkAkXjdDEh560qr1m/Fo+oDvX6PRxxTfslHteQw/UsFhdjEm5ZnwRjA 6KB2brBVqhQGldytXaDxVA+RTraxH6Xxpu+C7Ylg3DkBbQ/lZnMvRrXd/ng0+64binmJ yXlrxHyVSlJoDdUYPZ2PqBkhoXYmsDsGNMxZlgWGtZUSuLWGCDxDyKfA4azON/hzkqmK WCp5Zut8kYf4hhhDDsqAm0R1PsWFHDu1R2S3MIUryHcZmDVJbJtk7WrgzcJZhXpdRvAQ 5JSbGYtiaKrVNchIAE0Q+kn0MsLffIbsC4DDldhZ95GuZ9RGjPV4SAdsZ2W4e1YMLPgN Y4kw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G5+zG4XV; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-65123-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65123-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCWCLFaDAeWRINx6Xsw2KqPsuTcIlURsgovO1au56clJute6d4eVx65duljl4X/Dh3h+Fd1RGAND5J6QMKM5LYioiDWp/fDixO59RuTPAw== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id qa11-20020a17090b4fcb00b0029899f365ffsi1093045pjb.65.2024.02.14.03.47.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 03:47:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65123-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G5+zG4XV; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-65123-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65123-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8FB92B263F9 for ; Wed, 14 Feb 2024 11:27:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CEAEC199C2; Wed, 14 Feb 2024 11:27:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="G5+zG4XV" Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4173C18E1F for ; Wed, 14 Feb 2024 11:27:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707910050; cv=none; b=ODnvNvITYq5b42VqK1CH4LEpYdzUBTsBzFp30m2c5ljnbw++6BTb9PEWThtfW6IP6iaLOYHlP3hwhpV67j74/AdFxSiWgWhEMB0RXtnOXGcV1+pzjR666pb9w0h8OrxYFvhMNOJIicRuRb51pDCSrZRM1CJi0iFHMTfkMFtSl/U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707910050; c=relaxed/simple; bh=jQMkdXCT94+t/fNhRyP4HURQcFoXYNiOsIjLxQJ+Fuk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=m79ucKJFDfjYQvC2T+PFgEUegmBZfxkzhYu967AabHo4UJhJYXi+ROskXMp2gEhQTPyieE4sBgMW4pP1d65/cQaTarpvqstorhtvKFq7OfchaIc3tifg1NWIeOQd0HDwYIh9t1XGG2+NEnD8Ruiv/7C/z2rtaY9pv1GbFSbDybg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=G5+zG4XV; arc=none smtp.client-ip=209.85.219.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-dcd9e34430cso754061276.1 for ; Wed, 14 Feb 2024 03:27:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707910048; x=1708514848; 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=J7vxhx2/+AlV4ML2Sm5aRUStZ5melg4wfKc+++QxWBI=; b=G5+zG4XVJEBMDDm2fylTaBJjdZy3BiQpBfcjPCHzOz8BNHFfx+m6K8rGXYdAnLA9LZ Jddp7yhYRRbn+JCmjT/igPP6Nc2oARnEJVtzuLhactfzp0dB3eu+sRklyfr7rQWGsQDA WKpgQF1S9Lp40hZEpFkfQkE6wh35yXIuxmH4KK/sCRE7WEzz7eGsUX1qtywQF9dATxIz /ZAcecXmlBdNUUXZDslXbt5nYuhFVw4mCq5naTd4JLaNhunruONA0pCl0O/D5HghnwwZ hBVKDj3WEXcaxJgFFSSwEXMT36UFccU61rNmfNIy8uOCFS4lFK958+sbEZt40v1JnGz6 r7xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707910048; x=1708514848; 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=J7vxhx2/+AlV4ML2Sm5aRUStZ5melg4wfKc+++QxWBI=; b=r/0frKPptRcr5I7IVN6xEGfUJcWnxZBxhzAlSCi5FpM7/BkOdNkKnVjxVKXrfTjuIn tFzFxaRBkb2EbuBgiJaUtKJov3xKeSEF+MiPQTMktiCND77DCdDhVSYRPr2wY3U5v2I7 YXpSdAB/E7zak0Z1+Yomg5Z86I1W3wTiEj9rbmFVSx2clQbNE+rx4iMz84ukbkWoch+K 5/dGy0miV+xroDFzsPmp5VxeNutRL8BNnZ1aTXlmYbKe3Eds9/3IxRF4D0Whl+9JQNPW hYtzQUwnP2TFXlUJOE6Nub7WWhW8b65ZpbEHzAcMZdnjwHhT0X7ESQbpN1/LX9ScLvOw sVYA== X-Forwarded-Encrypted: i=1; AJvYcCXG50MxZsRtf4sy1l5FDDAbrw4/tiUB2PIPLDia7C7iaOBIypWv4mFs1enbcm3AMLIumcbcImlHV0RIwzFNJpAFykLOX1dsCloY5AuL X-Gm-Message-State: AOJu0YzLHMmnprmbxdgTMVU+jasNDoI2WmHm4xoTC1W2lQf3n90AqpUW ajznDua9QV5999+Ifnq60+LbbMdkQIhHlFv+QKfvILidx9Jb70Tns+lBF8HwdRKdQGdj2qXMsLW nz3ksR+jtrCqz608S41GBk2uGAmdj1LTNJ9BtLQ== X-Received: by 2002:a5b:1cb:0:b0:dc2:547f:27a2 with SMTP id f11-20020a5b01cb000000b00dc2547f27a2mr1919705ybp.50.1707910048182; Wed, 14 Feb 2024 03:27:28 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240213051716.6596-1-sh043.lee@samsung.com> In-Reply-To: <20240213051716.6596-1-sh043.lee@samsung.com> From: Ulf Hansson Date: Wed, 14 Feb 2024 12:26:51 +0100 Message-ID: Subject: Re: [PATCH] mmc: sd: Add a variable to check a faulty device To: Seunghui Lee Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, avri.altman@wdc.com, grant.jung@samsung.com, jt77.jang@samsung.com, dh0421.hwang@samsung.com, junwoo80.lee@samsung.com, jangsub.yi@samsung.com, cw9316.lee@samsung.com, sh8267.baek@samsung.com, wkon.kim@samsung.com Content-Type: text/plain; charset="UTF-8" On Tue, 13 Feb 2024 at 06:13, Seunghui Lee wrote: > > In mobile devices, suspend/resume situations are frequent. > In the case of a defective SD card in which initialization fails, > unnecessary initialization time is consumed for each resume. > A field is needed to check that SD card initialization has failed > on the host. It could be used to remove unnecessary initialization. It's not clear to me, under what circumstance you want to optimize for. Is the SD card ever getting properly initialized during boot? Kind regards Uffe > > Signed-off-by: Seunghui Lee > --- > drivers/mmc/core/sd.c | 12 +++++++++++- > drivers/mmc/core/slot-gpio.c | 1 + > include/linux/mmc/host.h | 1 + > 3 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c > index c3e554344c99..f0eb3864dc24 100644 > --- a/drivers/mmc/core/sd.c > +++ b/drivers/mmc/core/sd.c > @@ -1410,6 +1410,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, > bool v18_fixup_failed = false; > > WARN_ON(!host->claimed); > + host->init_failed = false; > retry: > err = mmc_sd_get_cid(host, ocr, cid, &rocr); > if (err) > @@ -1752,6 +1753,8 @@ static int _mmc_sd_resume(struct mmc_host *host) > > mmc_power_up(host, host->card->ocr); > err = mmc_sd_init_card(host, host->card->ocr, host->card); > + if (err) > + host->init_failed = true; > mmc_card_clr_suspended(host->card); > > out: > @@ -1803,8 +1806,12 @@ static int mmc_sd_runtime_resume(struct mmc_host *host) > > static int mmc_sd_hw_reset(struct mmc_host *host) > { > + int err; > mmc_power_cycle(host, host->card->ocr); > - return mmc_sd_init_card(host, host->card->ocr, host->card); > + err = mmc_sd_init_card(host, host->card->ocr, host->card); > + if (err) > + host->init_failed = true; > + return err; > } > > static const struct mmc_bus_ops mmc_sd_ops = { > @@ -1891,5 +1898,8 @@ int mmc_attach_sd(struct mmc_host *host) > pr_err("%s: error %d whilst initialising SD card\n", > mmc_hostname(host), err); > > + if (err) > + host->init_failed = true; > + > return err; > } > diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c > index 2a2d949a9344..93d081c7dd53 100644 > --- a/drivers/mmc/core/slot-gpio.c > +++ b/drivers/mmc/core/slot-gpio.c > @@ -33,6 +33,7 @@ static irqreturn_t mmc_gpio_cd_irqt(int irq, void *dev_id) > struct mmc_gpio *ctx = host->slot.handler_priv; > > host->trigger_card_event = true; > + host->init_failed = false; > mmc_detect_change(host, msecs_to_jiffies(ctx->cd_debounce_delay_ms)); > > return IRQ_HANDLED; > diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h > index 2f445c651742..1d75cfdbf981 100644 > --- a/include/linux/mmc/host.h > +++ b/include/linux/mmc/host.h > @@ -467,6 +467,7 @@ struct mmc_host { > struct timer_list retune_timer; /* for periodic re-tuning */ > > bool trigger_card_event; /* card_event necessary */ > + bool init_failed; /* check if failed to initialize */ > > struct mmc_card *card; /* device attached to this host */ > > -- > 2.29.0 >