Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1035172rdh; Fri, 27 Oct 2023 02:54:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFvsYuvzV1TQg94hmi4lPwazw+JkSMORwgxkG+GCnonVHrIUnulfUpdyeMXXwYFIoN1nGw8 X-Received: by 2002:a81:9ad2:0:b0:5a7:f002:4fe4 with SMTP id r201-20020a819ad2000000b005a7f0024fe4mr2104559ywg.23.1698400462040; Fri, 27 Oct 2023 02:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698400462; cv=none; d=google.com; s=arc-20160816; b=CN/hfFfU3tebkHhq5ecVDdSAsd1nm7WCp23QjLlOJ4aXasmFuceCgmiD2LNSQUUNub nA3c6xsQybK2ldTbcNZ7ZF76nr5B/vo8Xz+qPaHo3TUg/O3ncqiNtB+HAR29XdXBE+nH niqaQA6Q+ZtbvNsss+/gLgSn3prr0fBKYxqMyYi2QfkjBtboObQ3VSpv8roJ4RsYbhtk t0hDimV33ZQ6hs2oTxKHxsqyGTeHj6Z7h+3L67SgZ/n1L5Ryar7nc7FaBU9xzBR6VTT2 JA3xmsADpU7PF36LFTzRzlqm7qCsKnC98sekWEqbrGIOQ697QJEwR2MnRaOurlM0Gh0x uf/w== 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=OT690yrTB37R58Wx087fNpmf099NwY0U4lYROeFLtIU=; fh=LYySJ/dL2rg9KfQs4GaCZK4tqJ4ky1b8pCfiDSHXGMY=; b=0AxkmtenGzP5a7ooQ9pw1bl3NX71zAk09XOyZS1KuhSTitC+DFbvAQ6OIp9pAbI6iW +z/EslK39CnTD6i0rx2Lb2UvqtgP/I8ucTY7Wmu2rPdtnkjTRiAe2L+bFT6BESoM//0L Og09ODNcn79snjcs81mwtBiVCtSpWoXAKYLx81d0GH/IsDylxjui56Os+GjF5/LFPzPz Rl6oxpgHLhHPX8J6JLC5wyP9Aqk8/qLvEuk5j5dTKiXJWUTwcp5bvZ6Azlg+WTs1IVJm E1k+uo2O3tLPu/O+AcjS/nHRR0VXYBOzMkwtAJh2OsFIBtt59BKHsF6e/UR7kvAD2L2C GHRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v+aPxACk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id f124-20020a0dc382000000b005a7cc83c4c1si2021238ywd.425.2023.10.27.02.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 02:54:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v+aPxACk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id F20128239105; Fri, 27 Oct 2023 02:54:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345617AbjJ0JyH (ORCPT + 99 others); Fri, 27 Oct 2023 05:54:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235028AbjJ0JyF (ORCPT ); Fri, 27 Oct 2023 05:54:05 -0400 Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29508192 for ; Fri, 27 Oct 2023 02:54:03 -0700 (PDT) Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-5a7eef0b931so14346687b3.0 for ; Fri, 27 Oct 2023 02:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698400442; x=1699005242; 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=OT690yrTB37R58Wx087fNpmf099NwY0U4lYROeFLtIU=; b=v+aPxACk4PzpMG3hmUKjjrFSfyqnas7nRszoBX1nxv2yQpr0E1EWDH0UqLwIp7qRy8 QUHiqpSej61/q2OvZxPs+BMD0nnYTWQpFd5NbSR65EBLqXYjFiAagVxpPQadQYCAN39e kWHWaMosFqZvo4oi2E8NOnwaA0WeOfrBJdhRlXhZ1Lq0MrvAz20+I6hHTooQgJrkuTg8 CafvW7aNs45cNEJuvCIFVvrO2dl/CkexCf46Fue5e+JytEsMTHFCkQaTtsf6EHcWozGR At3puar2R3lFdSJey5PmTIs8n0PADNkW/bpkXXfAbSMEInpXWYZeKFanG4kctaSgnccC u7AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698400442; x=1699005242; 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=OT690yrTB37R58Wx087fNpmf099NwY0U4lYROeFLtIU=; b=uGo/a+LI+OjBq2QnJovY7Lj9zdhE7B0guI+5/b58rHHt/MChr/DwsOWjLIauP1V4y5 n1kI0Wy8n5Z6T+3gPheOJGMvWVgycxnCQdTJiytGbJc9EJy8KT0UuDcOSnHXEd0qS3As 4t0ARu8Ddz5Ev1G5n6QaCFcg1Uct4NOXjskYACknjrUSbijOf2CF6guDr0ndLRhvGkPU HzxsBx1wKbWvZ1f7CnMzuAbF0KYZ8fXTfcaJSoT7AqPTAmk2pRGiVQfJe8PHsIBnmXbk qpo4xTtbv73/s48RfIwGljZUZFdohVfHjEpt3jLo9eP/gMq4dhOM+wbGSjZ6iUOHkuvQ rpnQ== X-Gm-Message-State: AOJu0YyeMFl5lgGmzazvnfdRLtWaFvhujGRizLVddAhQcxhhq4sKLxUb xOYlhglYrmzSMLF61bAXtSI/yIkgXSZ0SPCiaMh5qA== X-Received: by 2002:a25:ab10:0:b0:d7b:9211:51a5 with SMTP id u16-20020a25ab10000000b00d7b921151a5mr1856013ybi.44.1698400442328; Fri, 27 Oct 2023 02:54:02 -0700 (PDT) MIME-Version: 1.0 References: <20231019054612.9192-1-quic_sartgarg@quicinc.com> <20231019054612.9192-2-quic_sartgarg@quicinc.com> <21208de0-79bc-42c7-b32f-355daf5b09f0@quicinc.com> In-Reply-To: <21208de0-79bc-42c7-b32f-355daf5b09f0@quicinc.com> From: Ulf Hansson Date: Fri, 27 Oct 2023 11:53:26 +0200 Message-ID: Subject: Re: [PATCH V3 1/3] mmc: core: Add partial initialization support To: Sarthak Garg Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Adrian Hunter , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, quic_cang@quicinc.com, quic_nguyenb@quicinc.com, quic_rampraka@quicinc.com, quic_pragalla@quicinc.com, quic_sayalil@quicinc.com, quic_nitirawa@quicinc.com, quic_sachgupt@quicinc.com, quic_bhaskarv@quicinc.com, quic_narepall@quicinc.com, kernel@quicinc.com, Veerabhadrarao Badiganti Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 27 Oct 2023 02:54:19 -0700 (PDT) [...] > >> +{ > >> + int err = 0; > >> + struct mmc_card *card = host->card; > >> + > >> + mmc_set_bus_width(host, host->cached_ios.bus_width); > >> + mmc_set_timing(host, host->cached_ios.timing); > >> + if (host->cached_ios.enhanced_strobe) { > >> + host->ios.enhanced_strobe = true; > >> + if (host->ops->hs400_enhanced_strobe) > >> + host->ops->hs400_enhanced_strobe(host, &host->ios); > >> + } > >> + mmc_set_clock(host, host->cached_ios.clock); > >> + mmc_set_bus_mode(host, host->cached_ios.bus_mode); > >> + > > > > Rather than re-using the above APIs and the ->set_ios() callback in > > the host, I believe it would be better to add a new host ops to manage > > all of the above at once instead. Something along the lines of the > > below, would then replace all of the above. > > > > host->ops->restore_ios(host, &host->cached_ios) > > memcpy(&host->ios, &host->cached_ios, sizeof(host->ios)); > > > > Would that make sense to you too? > > > > > I didn't get this completely. Do you mean that we should implement a new > restore_ios callback (e.g. sdhci_restore_ios) similar to sdhci_set_ios > and removing all the redundant code from sdhci_set_ios which should > achieve the behaviour same as calling all the above mmc_set_* API's ? Correct. Would it not simply the things in the driver too? > > > >> + if (!mmc_card_hs400es(card) && > >> + (mmc_card_hs200(card) || mmc_card_hs400(card))) { > >> + err = mmc_execute_tuning(card); > >> + if (err) { > >> + pr_err("%s: %s: Tuning failed (%d)\n", > >> + mmc_hostname(host), __func__, err); > > > > There is already a print being done in mmc_execute_tuning() at > > failure. So, let's drop the above print. > > > > Sure will take care in V4. > > >> + goto out; > >> + } > >> + } > >> + > >> + err = mmc_test_awake_ext_csd(host); > > > > Again, I don't get why this is needed, so let's discuss this more. > > > > This is just a safety check added because ext_csd has some W/E_P or > W/C_P registers which gets reset if any HW reset happens to the card. > So this will check for those cases if any other vendor is doing reset as > part of suspend and compare a subset of those W/E_P and W/C_P registers > and if they are changed then we will bail out of this partial init > feature and go for full initialization. > We are also fine with removing this function but just added for the > above mentioned case. In that case, I would rather remove it as I think it's superfluous. More precisely, I would expect that we fail to wake up the card with a CMD5 (get an error response for the CMD) if there has been a HW reset somewhere done before. Another reason to *not* read the ext_csd would be to further improve the resume time, as reading it takes time too. I would be curious to know how much though. :-) [...] Kind regards Uffe