Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1621631imj; Thu, 14 Feb 2019 09:17:12 -0800 (PST) X-Google-Smtp-Source: AHgI3IZr4eRWIwZjQuIzqZb4/dVvBwRWEV0UfWFUeLLUtWH5uOvOgb3bSWfR0/6O5np2iB0FEZdy X-Received: by 2002:a17:902:4225:: with SMTP id g34mr5425899pld.152.1550164631941; Thu, 14 Feb 2019 09:17:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550164631; cv=none; d=google.com; s=arc-20160816; b=bJbkveVBQKIV5o6E8Qlm/ECLNjF7Z6nJRrlipz894SAmxDHINPQnyoCCHiZ23XWf9W LxpsrLua3kBGvZoE76Cg89nwonv+cHykUjkekqEfAk29t6KiexV8sj50Gc22OA9VWdAM C7cYa1EWj0F2btvGkmCq9mrsAS4a2EuJfSKjxebrRTBIV8+Zfm2RT39+WYfNhkDFlGAJ Q057O7MjBZGIUp6K1iT8wX9ZHvQxEcyAab5phE6p+8q4A8F0uPfu2rmfIkhhG7/SuhP1 FVMsUoYjUXlXTE/QDyx1nB12gpELno94b9EErMKnMp70mX53TW9RYrSxUvfvJkGbUD9o CaxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nMz1ymCsOf65DabRL8W9oE+jLUTE0mcGttneun/Pans=; b=gbS8U6FsrhZfZEnzVxWGN1dzHMbz7j8H1JV4ttxat+3GpngGYRfC9PkBFS94wbVBft tAwpfvwls8zgyngPw6zVlEOudMDQ+sfx/4Fp3w9n484hgR43qUR0VnUkv/zqazNlORIv x5PxwshVv/JtG3I5CAK0PrFUFRb/L0t4YxT+NUy/kgBoz2qrsM2AuAYL5Eg3DbPMcujH y5V6sa/QZQfhItA+8vYEjOO4I3A2TxNp93msbpt/hsBAH7vnyRcEV2oqzjJuEJWSyJAa 6/9bcxFWNX8CNhM1YD+livhM5N62Q0xJq5tCmifvV4UguzuIoNYaK9yxFy/TqRn85JIj a95g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kP60hn1C; 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 w9si2985746pgj.69.2019.02.14.09.16.56; Thu, 14 Feb 2019 09:17:11 -0800 (PST) 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=kP60hn1C; 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 S2436983AbfBNJUu (ORCPT + 99 others); Thu, 14 Feb 2019 04:20:50 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:55078 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726411AbfBNJUt (ORCPT ); Thu, 14 Feb 2019 04:20:49 -0500 Received: by mail-wm1-f68.google.com with SMTP id a62so5465216wmh.4 for ; Thu, 14 Feb 2019 01:20:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=nMz1ymCsOf65DabRL8W9oE+jLUTE0mcGttneun/Pans=; b=kP60hn1CevWUmK2N/c9hFJ2i5MN2eDG1ZPAehe4MbQ5LKCAr1Tg2auA8SMbe1Iglm0 OvHbsbLxrOB8SAZwc8JDqFSk9WIqSu9x3Sz6M+8D5p0FtMwZM1j/1xKXHwYB+51g/oh+ VivSSDZJbVgQNrQWOOCtnRQcoCAAVbsyN83eVeABmYA0DP0MXwMppQz9efeCjIlyTxeN csnyNUY4fEvhMPZ+/OTT+8nzxKF+nQP6OuE1LnVdCv0H+g/4kTjO3syf014ADJF+90QE yA0514zPzgQ7MndoJgBIEThrObpJlJpgkpwl0A/GxK6P3hpEUD3FQMNrUhhZJmEZZXoa eyFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=nMz1ymCsOf65DabRL8W9oE+jLUTE0mcGttneun/Pans=; b=mdF7jRXCkTvbatPpMo3BXIiDoC9JqtnKAZSJm/dRK4aO1RBQCNg9BmanID1vbPZpTl 1RK8cYpYfGBYmX+a9MXXOU4vAHl5ySEyLgKCg0I0Q3TFj0Y5VBOL3N2rAQxDYGsgvu+6 +DDV3R0F2sOeH4eUAJNqa9kwDq0e1Xu3VCSxLemHkfVrV7DN0/mZ4AFg55zpLfenAOQ8 UdQnfc5FC+1/TZIVcbX7hBf61m4Z/pzDxo07eQn1DxUs59ziXbtRAWkQfwK++b34ODy7 sCCM7QJ9KYsjKC1yzzIZnr1XKs4WftcsRoX1RRolmGjZkGrh4UK49Psrf9pJSE7LqNJE jdHA== X-Gm-Message-State: AHQUAub3Emj5VCwkbKwMs6svoZkbbnaIHCGW7MFQACQ625rXYT/cC8ii lnISxlecCYsxZIfvO6IWOKxWJg== X-Received: by 2002:a1c:a8d7:: with SMTP id r206mr1885612wme.115.1550136047705; Thu, 14 Feb 2019 01:20:47 -0800 (PST) Received: from dell ([2a01:4c8:c:28c9:4c60:37da:d7a:230]) by smtp.gmail.com with ESMTPSA id s5sm1815649wmh.37.2019.02.14.01.20.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Feb 2019 01:20:47 -0800 (PST) Date: Thu, 14 Feb 2019 09:20:45 +0000 From: Lee Jones To: Tony Lindgren Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, Florian Vaussard , Peter Ujfalusi Subject: Re: [PATCH] mfd: twl6040: Fix device init errors for ACCCTL register Message-ID: <20190214092045.GD13737@dell> References: <20190211225726.38355-1-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190211225726.38355-1-tony@atomide.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 11 Feb 2019, Tony Lindgren wrote: > I noticed that we can get a -EREMOTEIO errors on at least omap4 duovero: > > twl6040 0-004b: Failed to write 2d = 19: -121 > > And then any following register access will produce errors. > > There 2d offset above is register ACCCTL that gets written on twl6040 > powerup. With error checking added to the related regcache_sync() call, > the -EREMOTEIO error is reproducable on twl6040 powerup at least > duovero. > > To fix the error, we need to wait until twl6040 is accessible after the > powerup. Based on tests on omap4 duovero, we need to wait over 8ms after > powerup before register write will complete without failures. Let's also > make sure we warn about possible errors too. > > Note that we have twl6040_patch[] reg_sequence with the ACCCTL register > configuration and regcache_sync() will write the new value to ACCCTL. > > Cc: Florian Vaussard > Cc: Peter Ujfalusi > Signed-off-by: Tony Lindgren > --- > drivers/mfd/twl6040.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c > --- a/drivers/mfd/twl6040.c > +++ b/drivers/mfd/twl6040.c > @@ -322,8 +322,19 @@ int twl6040_power(struct twl6040 *twl6040, int on) > } > } > > + /* > + * Register access can produce errors after power-up unless we > + * wait at least 8ms based on measurements on duovero. > + */ > + usleep_range(10000, 12000); > + > /* Sync with the HW */ > - regcache_sync(twl6040->regmap); > + ret = regcache_sync(twl6040->regmap); > + if (ret) { > + dev_err(twl6040->dev, "%s register write failed: %i\n", > + __func__, ret); Please drop the __func__ and just use the standard format. Wouldn't something a little more forthcoming be better? "Failed to sync with the HW" ? > + goto out; > + } > > /* Default PLL configuration after power up */ > twl6040->pll = TWL6040_SYSCLK_SEL_LPPLL; -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog