Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2162824imm; Thu, 27 Sep 2018 08:22:08 -0700 (PDT) X-Google-Smtp-Source: ACcGV63OvqRrjQjTX8xhNXLaGmc9QqFTjy17J+ihLqGdMIMf5KlosvFWGesemG3q5Sjb8H36YQ76 X-Received: by 2002:a63:7156:: with SMTP id b22-v6mr10644644pgn.342.1538061728417; Thu, 27 Sep 2018 08:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538061728; cv=none; d=google.com; s=arc-20160816; b=Pbc2NmUm08buSt988BFjzsasMHtEnkwtWbtgqCuaMSU8zqyyVkpRGywPkcx7b1r5L4 7dXtEVH61jCt6i0fmAro54C+x1rulSYuzDAW5KrOkQf9vZWDb4iFEbdh0LzwUss+yKes nC0i/LK3CezCvNWGprg5pK5VhdW929kAR9bWko8+n1iF9OGUWnnXdkLJ8jhcaOvqdvOL 3EtBWApZT4p5r1aA/e/mL28O8W0csixIvBvmkymaGRZUPCwynkTh7scND8MQefdOm5Wx xxnmraNQgpUYEmgWwoC+WvbBHg4N4jsOZhy8qnZ22fC9gOt/CaIkldTu043Ax9PVJb66 FuIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=si9pxhw5KruNhYwgMx5FX+vsyfkmm9WWF9lrLjFqAME=; b=q9o+YY80GXpG0ut/DZL8OsvJpO9bfItD9aTHGuetQy2tH8T5YGOoZqTHVtgf6kO6Ww +iFnNzaeP4Mmj9ZFR2EmgM8uE5LuMlDkQ6NUY1h/bN05ISTOlKd5tT0g7fotRjT9gYas 5bUkOPcblwRpvOQLj9yMV3JKOYW7hCJEHkTyDwoGV5qd79WAW8Q7tVuue7ZjoUGOe6Dq kkn1lqrjLHHAeptVd8oNQ5yzu5RGh/OzEo/6QnhB020uKk6+kcOiSTXjzomH8/ksKJAY xLlVaKivjvp4vYyH7OLXdg0d/UaW0obQgDz0V4ab42NwOUoWotOuljSuJhWF6X3XxqAz Kmyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Pvsv1txO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l14-v6si2214580pgi.34.2018.09.27.08.21.52; Thu, 27 Sep 2018 08:22:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Pvsv1txO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728020AbeI0VkD (ORCPT + 99 others); Thu, 27 Sep 2018 17:40:03 -0400 Received: from mail-vk1-f195.google.com ([209.85.221.195]:41772 "EHLO mail-vk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727262AbeI0VkD (ORCPT ); Thu, 27 Sep 2018 17:40:03 -0400 Received: by mail-vk1-f195.google.com with SMTP id j14-v6so674321vke.8 for ; Thu, 27 Sep 2018 08:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=si9pxhw5KruNhYwgMx5FX+vsyfkmm9WWF9lrLjFqAME=; b=Pvsv1txOPw9Djm+RGylWq2Qprpu9Tcz89T/GKGLrksGp/akt98fVx3WHYTxPetR0IM qHj1F46Z12boJPO4DIpXDVZWwAukb9Qmzmi4448ujZS/Emcai+6diBHFpWqMPAHpccMu b1kYUawQV1pDafzQW4zSeE5CZbzozaagyS4w+TxlD9X1enqWyR7bK9otU3rUrlMp0im2 Sgl4WDMOuR7tkYZgFHuj6X77CaXtyZXeMLBhGdy7+g35wiV3GetWZ1uBh8YXPNBELf1x kSIX28avUpBATwzSrWeF3h1cDKFwgYEdozGE5y8CxpCPBsGZTUhL7EWTVFwLmV7p2JXs js4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=si9pxhw5KruNhYwgMx5FX+vsyfkmm9WWF9lrLjFqAME=; b=CdkpIwJ+9AhAIEVU8CvUu3wkxeriFTtHlT75VSUKz+ydwpgIhVv3AWqv0cB3rJOTrZ RvWmjWSAXA9QHaC95h3qaRwmc+rUku2K278iE/wBU7+EM91QBDqSr2P/NXBXqyyp+8sZ +4BfzRC91KrqV+6Q0cu+fJP6EXf+BrsMuj1n2ty6H5PLuSdk4Ih2u5iZg6FtxA2fX3DK RQMx0UnYZac/C8Ak042rr04fvZDa/GHHP6g+WfzNJcLOwKU8rmSVC3RCBekXSM2txPB9 8UFByIUJKhGRPu8bG57Akfbvtx7OXAOYGrQ36aDUgK+t05/REnF8snUi94t95SGLkIi1 esTg== X-Gm-Message-State: ABuFfoiXXKfCKJszHmlqDweg566vBPeo22C3jE7Hj64WUxSXLj007DPN w7IeEJ/qmbeVjFOdU1gUh6B7D4sTFMzsmvxL/6s4WA== X-Received: by 2002:a1f:9b52:: with SMTP id d79-v6mr3604210vke.79.1538061676759; Thu, 27 Sep 2018 08:21:16 -0700 (PDT) MIME-Version: 1.0 References: <1537887875-29494-1-git-send-email-vbadigan@codeaurora.org> <1537887875-29494-3-git-send-email-vbadigan@codeaurora.org> In-Reply-To: From: Doug Anderson Date: Thu, 27 Sep 2018 08:21:03 -0700 Message-ID: Subject: Re: [PATCH 2/2] mmc: sdhci-msm: Re-initialize DLL if MCLK is gated dynamically To: vbadigan@codeaurora.org Cc: Adrian Hunter , Ulf Hansson , Rob Herring , Asutosh Das , riteshh@codeaurora.org, stummala@codeaurora.org, sayalil@codeaurora.org, Evan Green , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Thu, Sep 27, 2018 at 4:00 AM Veerabhadrarao Badiganti wrote: > > Hi Doug, > > > On 9/26/2018 3:58 AM, Doug Anderson wrote: > > Hi, > > > > On Tue, Sep 25, 2018 at 8:05 AM Veerabhadrarao Badiganti > > wrote: > >> + /* > >> + * Whenever core-clock is gated dynamically, it's needed to > >> + * re-initialize the DLL when the clock is ungated. > >> + */ > >> + if (msm_host->restore_dll_cfg_needed && msm_host->clk_rate) { > >> + msm_host->restore_dll_cfg = true; > >> + mmc_retune_needed(host->mmc); > > Using the boolean "restore_dll_cfg" to communicate like this seems > > really fragile. I have no basis in fact, but I worry that something > > will happen in the meantime that really ought to invalidate the > > "saved_tuning_phase" but the boolean will still be set. > > > > Is there a reason you can't just call msm_config_cm_dll_phase() > > directly from sdhci_msm_runtime_resume()? Perhaps after the > > clk_bulk_prepare_enable() call below? > > I can do that. > > But we don't need to restore the clock phase for all speed modes since > every mode > doesn't use DLL. Only few speed modes (only SDR104 mode for SD card) > would need to restore DLL setting. So I would need to do some extra checks > for performing this operation for only required speed modes. > And we should re-initialize the DLL first before programming the phase. > > I wanted to reuse the existing logic which does all these things. So did > this way. Personally I'd rather see the extra checks or even restore the DLL settings some cases when it wasn't truly needed. In theory, though, I'd expect that there's a hardware register somewhere that says whether the DLL settings matter or not. Can't you just key off of that? ...or if that register is also lost when the clock turns off then whenever you change that register to turn the DLL off then clear your saved phase? -Doug