Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3535682imj; Mon, 11 Feb 2019 23:50:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IaPCOdslauZsceEIFksiCsD/4NITICefBiUhDh952m1OdDSBdylyc37p/Dvkq14qn/txBOb X-Received: by 2002:a17:902:2ac3:: with SMTP id j61mr2676995plb.185.1549957842184; Mon, 11 Feb 2019 23:50:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549957842; cv=none; d=google.com; s=arc-20160816; b=sKsC64k+frjkR9SYusLZc5VZIltyZQqXKpm2MyZ3fwuSzhLw5K/eXObaJlip1AVWMn JG+UW+eJ2g6b7Iuzo1kxDOIlsX5EBgZkqAmMgmQeEuDH1pwLrQAAA2ySFRCtKdlt8BF6 iPTt4kd+PMWfJQxArsxNCchrTV5PMLnUC5V/ZcDmjoJz9RQHwORGjUtb5YI4+X5kwvdx YEo2uVM36rORW9KdSxxCtXyqlkC/RvUEEKSBJ/OGdawyhWp0D6P882WxnIbISLmxE8UT MNh2R4SpGvuLrUXRdrW0NRfY3R7wg7lqm4CWbV3hJkF8a0rCRptMa5lW0rxPZ3cWkFQT FoNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=NblLj6ZlZlZaQ9vCsm4vs/5cqfQoulS3dM4tsow0qtg=; b=PoMDh3nA0U4Tez6etlwwml8GEsZE0XXpS+Kjb5WlQii9F9gmiQR+PmIEkNvvNOTwR3 DW2X84D/r5MRd1YG5OKJIs53qM+6HGY/KBvDhWvBVmTeZ8FvF5ekwJNNbFEVMJ/MOFgl mXB1vvTl7mnxfpejJi/HnyVZCkJOC56z22SS1pbwyqQUKnc48kIhDMl6aaxQvNVlY7/x cMvZnmIjOFvFYw/OZmH2eTPNm8rMBOrwAXSoNZtfxSVvLA+vowAMEdCO6qPJD7iMVxqH RmZKuLPQvDT0pd/v9NzyKUYFxKe0PSMBoj2fvN+hI59WCKCZnM+sGhzCLIwWpKDitkNa i7SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=EHVV+ubU; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si11750091pgf.453.2019.02.11.23.50.26; Mon, 11 Feb 2019 23:50:42 -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=@ti.com header.s=ti-com-17Q1 header.b=EHVV+ubU; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728221AbfBLHuD (ORCPT + 99 others); Tue, 12 Feb 2019 02:50:03 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:38272 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfBLHuC (ORCPT ); Tue, 12 Feb 2019 02:50:02 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x1C7nvYS123938; Tue, 12 Feb 2019 01:49:57 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1549957797; bh=NblLj6ZlZlZaQ9vCsm4vs/5cqfQoulS3dM4tsow0qtg=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=EHVV+ubUbT4q5iiDVjlXv5QxIzTVWhDqNhQYOnQ0LiJFFg8ggH/CsaxGpFvR5INLW 7IYncxAEJBxNtm5C3KOE6jSmjvVzuhvE8T5K//HO4I9ep+soej0n1CFU/EmleA1AI0 D9Ho4xbokW+FHoqFvDG5Yh+kgk1cPjJqVO5HW2sY= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x1C7nvPj066401 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 12 Feb 2019 01:49:57 -0600 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 12 Feb 2019 01:49:54 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Tue, 12 Feb 2019 01:49:54 -0600 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x1C7nrbL009307; Tue, 12 Feb 2019 01:49:53 -0600 Subject: Re: [PATCH] mfd: twl6040: Fix device init errors for ACCCTL register To: Tony Lindgren , Lee Jones CC: , , Florian Vaussard References: <20190211225726.38355-1-tony@atomide.com> From: Peter Ujfalusi Message-ID: Date: Tue, 12 Feb 2019 09:50:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190211225726.38355-1-tony@atomide.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/02/2019 0.57, 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. Acked-by: Peter Ujfalusi > > 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); > + goto out; > + } > > /* Default PLL configuration after power up */ > twl6040->pll = TWL6040_SYSCLK_SEL_LPPLL; > - Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki