Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1793996ybb; Thu, 26 Mar 2020 07:28:40 -0700 (PDT) X-Google-Smtp-Source: ADFU+vskK7fhPIxu8vJAyy7yVHI0Qe+uR7CLQ9AAyIQhgcYjR1xCJyaE5gflsAUpax4c8+ygHQpR X-Received: by 2002:aca:482:: with SMTP id 124mr198536oie.35.1585232920661; Thu, 26 Mar 2020 07:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585232920; cv=none; d=google.com; s=arc-20160816; b=DaQvTheE3NxZNiOkKAZkkWjq0yhct55gPbI3KV7AwWJtSYux9zqC6DCnkctY56RBrt DJrW0f3IIf25xUqzdgDdaC41rFl5qkftT/aS8aYP31UlfHSe8d9H+LVneToflXG1Nsv0 kH6zESXNCZjnLpAw/V+6mVTYNm3mpW9d2o1RElIgw0AQmbnipdf3OHNEXEvNEqZ4r7ia FYrZbDxc9KKG49MurvuzgkoxiT9+P+ZH7mB1rp2VGIoBHXIVxUjLZfXePMvXBvCohOP/ +gwo4oCQO/AwE8ZC+Z9vUI699BtQplzbqMeLeip83JhTyYtI9exh9FPk/s+Klua78hqm /IOw== 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=Nwrqr8fUwcczi1tkKbhoCAaTj0Lz9vANHD/lv6450Ik=; b=IwZK+iLt4ab+sn1lQJd2KlsUHbOzrQp9g+oTpd9zdd2oRv0Lxp0/6Of/Xxdj/+rivB PqPdkIsTE5nuSXEQgC3YPb2HTzYl1jrBdcMp4uRYLBd361WWflJkh3CGfihiMi1O2QIC jGRcRFE8jH7yYJrrHfrTQmwlBys80z3jEazrPgmvzr4nIqUQyy7XAZ+1U01OzoQqjFq0 G67tcsbwAk7Yx70WWW1ZA0pyWwWqz7pOmZlKidaProp4yH5TLSarWJM1ETIOZoDvy25G W+aYd58Y0x98kRuEjrrf3JCW3OmuJQTjC9buo7/fiL06daIQ934wSjjQRguQ5IxNcsLF C80g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s0AYeRSm; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si1100544oig.212.2020.03.26.07.28.28; Thu, 26 Mar 2020 07:28:40 -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=@linaro.org header.s=google header.b=s0AYeRSm; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727973AbgCZO2E (ORCPT + 99 others); Thu, 26 Mar 2020 10:28:04 -0400 Received: from mail-vs1-f68.google.com ([209.85.217.68]:34883 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727695AbgCZO2E (ORCPT ); Thu, 26 Mar 2020 10:28:04 -0400 Received: by mail-vs1-f68.google.com with SMTP id u11so3973671vsg.2 for ; Thu, 26 Mar 2020 07:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Nwrqr8fUwcczi1tkKbhoCAaTj0Lz9vANHD/lv6450Ik=; b=s0AYeRSme5ZYMG5Hj00MtSphy+ZF1hJEIT/x2laNKAPH6uwyawibNxjdwbP2n3VcAz csHlsS0gxGoa5DicQVyRyza5fvlnbU7gXob7YwmrF1iP6Arowk1BTPlr0kz4O3XeecgF 1zk9ZTQ+jv4zeHagRLkhqZrvKEFdH+oNeK135nUnNRS91hY2ue714O+FEjcV14/4YNSF LfEKcr0FypAkSBknWreQBXQ7JbSB7qSlCdDz+6IHoDYmn4ebQwicF5K71DOR0GD0cCFh bCHWHd0BIGOXrsyTGs9lNM+SLJBnuSpHOhufi/2mLRvJCbJQ5z5/y/CztJiv8Q92tTQi xs6A== 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=Nwrqr8fUwcczi1tkKbhoCAaTj0Lz9vANHD/lv6450Ik=; b=hMkTP9tsi5ME5sn0iIPAZ0vjwqmATtDJWJjuE4es9etdQ8a73YfXX11U/W8ij7epM+ cyXQ4T6ja5p2V7bfbInjpx9fetgqIPFiYbNYQObQz4f4uMH+Cr/zLYYaD5k1piy+8URd XPqDusfAHk/mHxiJwiWTh//AfLJhLhI4NuX1gLkxFTDt9z1UsVdE7ebxlqZqVJr9iZ2H XiUWTfUXQfk/amoHHpaeUMqPhSiR26K9UhY1h2kjRptK3ayLVCeMW4/PEwD2zLEGXvK8 WvcNWDOKPXyb3SkXwC5fVLnT7kjW2oGIXi2m+EM9Ik1ICJQTW/H8esz3Q7C9dxcrVLTL YP/w== X-Gm-Message-State: ANhLgQ2bOQkHYZaWn7vgvWA54yVLgD3ImXLLb60Gd0MfTmncUPVjFT4L tSofVJwPcR05OrwjTPYRS8NLn0Ag5iP4+Outt/5nug== X-Received: by 2002:a67:2ec6:: with SMTP id u189mr7072856vsu.200.1585232883289; Thu, 26 Mar 2020 07:28:03 -0700 (PDT) MIME-Version: 1.0 References: <20200325143409.13005-1-ludovic.barre@st.com> <20200325143409.13005-3-ludovic.barre@st.com> In-Reply-To: <20200325143409.13005-3-ludovic.barre@st.com> From: Ulf Hansson Date: Thu, 26 Mar 2020 15:27:27 +0100 Message-ID: Subject: Re: [PATCH V2 2/2] mmc: mmci: initialize pwr|clk|datactrl_reg with their hardware values To: Ludovic Barre Cc: Rob Herring , Srini Kandagatla , Maxime Coquelin , Alexandre Torgue , Linux ARM , Linux Kernel Mailing List , DTML , "linux-mmc@vger.kernel.org" , linux-stm32@st-md-mailman.stormreply.com 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 On Wed, 25 Mar 2020 at 15:34, Ludovic Barre wrote: > > In mmci_write_pwr|clk|datactrlreg functions, if the desired value > is equal to corresponding variable (pwr_reg|clk_reg|datactrl_reg), > the value is not written in the register. > > At probe pwr|clk|datactrl_reg of mmci_host structure are initialized > to 0 (kzalloc of mmc_alloc_host). But they does not necessarily reflect > hardware value of these registers, if they are used while boot level. > This is problematic, if we want to write 0 in these registers. It could be, but I don't see that we ever needs to do that - at least not before we have written some other non-zero values to them (through the helper functions). > > This patch initializes pwr|clk|datactrl_reg variables with their > hardware values while probing. Hmm, so in principle this change seems quite okay, but I am hesitant to pick it up - unless it really addresses a problem that you have observed. The reason is, this change may lead to avoiding to re-write the register with the same value it got during boot - and who knows what is best here. Kind regards Uffe > > Signed-off-by: Ludovic Barre > --- > drivers/mmc/host/mmci.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c > index 647567def612..f378ae18d5dc 100644 > --- a/drivers/mmc/host/mmci.c > +++ b/drivers/mmc/host/mmci.c > @@ -2085,6 +2085,10 @@ static int mmci_probe(struct amba_device *dev, > else if (plat->ocr_mask) > dev_warn(mmc_dev(mmc), "Platform OCR mask is ignored\n"); > > + host->pwr_reg = readl_relaxed(host->base + MMCIPOWER); > + host->clk_reg = readl_relaxed(host->base + MMCICLOCK); > + host->datactrl_reg = readl_relaxed(host->base + MMCIDATACTRL); > + > /* We support these capabilities. */ > mmc->caps |= MMC_CAP_CMD23; > > -- > 2.17.1 >