From patchwork Fri Dec 9 09:31:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Glauber X-Patchwork-Id: 704372 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3tZn800mmqz9vDZ for ; Fri, 9 Dec 2016 20:32:32 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932360AbcLIJc3 (ORCPT ); Fri, 9 Dec 2016 04:32:29 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35820 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933210AbcLIJc2 (ORCPT ); Fri, 9 Dec 2016 04:32:28 -0500 Received: by mail-wm0-f68.google.com with SMTP id a20so2757119wme.2 for ; Fri, 09 Dec 2016 01:32:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o3WWAfiajefE3QLLXiFIZy21yZCWa+WGBTWpFuDni3E=; b=eZVkCsdlx20gqOBp1kbsbpOHJhKBPGE1D0LzinyCRL1ka0KW+qguorXLFxN63ayyge d1MLngIVJf18BZe2xbKjY92hvsvbwNKyzm7pF6bqZiooZBg3XgWdLc4uSXRCy6YrPV/f e7oqDa5t7upduDkVR21p0gmcUZP+3ufsxjmCc8IbkPEv/mU73xwV96TAX3guc5hcgnpD ps0jlziixeRXUzbWUGIjQHpiWDgu7JQEkPK03+Y0B2XV4WpuULhErqui7AfbfDIAFozC CN2ks3T+46WrTuLEO2idi8SMb1IncIvXUbbsv+kmPBZVq6hOy2yOMrMWzAGNAn8LTDKB bDZw== X-Gm-Message-State: AKaTC010KYcQ5g0mA0HYZBFZ7uJaigbVrQ+XFcQb/WUG82DlRXD5LZFOUjqIctOm2KCR2A== X-Received: by 10.28.94.76 with SMTP id s73mr2356125wmb.107.1481275947323; Fri, 09 Dec 2016 01:32:27 -0800 (PST) Received: from localhost.localdomain (HSI-KBW-046-005-206-247.hsi8.kabel-badenwuerttemberg.de. [46.5.206.247]) by smtp.gmail.com with ESMTPSA id k11sm19529619wmf.24.2016.12.09.01.32.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Dec 2016 01:32:26 -0800 (PST) From: Jan Glauber To: Wolfram Sang Cc: Paul Burton , "Steven J . Hill" , linux-i2c@vger.kernel.org, linux-mips@linux-mips.org, David Daney , Jan Glauber Subject: [PATCH 1/4] i2c: octeon: thunderx: TWSI software reset in recovery Date: Fri, 9 Dec 2016 10:31:55 +0100 Message-Id: <20161209093158.3161-2-jglauber@cavium.com> X-Mailer: git-send-email 2.9.0.rc0.21.g7777322 In-Reply-To: <20161209093158.3161-1-jglauber@cavium.com> References: <20161209093158.3161-1-jglauber@cavium.com> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org I've seen i2c recovery reporting long loops of: [ 1035.887818] i2c i2c-4: SCL is stuck low, exit recovery [ 1037.999748] i2c i2c-4: SCL is stuck low, exit recovery [ 1040.111694] i2c i2c-4: SCL is stuck low, exit recovery ... Add a TWSI software reset which clears the status and STA,STP,IFLG in SW_TWSI_EOP_TWSI_CTL. With this the recovery works fine and above message is not seen. Signed-off-by: Jan Glauber --- drivers/i2c/busses/i2c-octeon-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/i2c/busses/i2c-octeon-core.c b/drivers/i2c/busses/i2c-octeon-core.c index 5e63b17..2b8a7bf 100644 --- a/drivers/i2c/busses/i2c-octeon-core.c +++ b/drivers/i2c/busses/i2c-octeon-core.c @@ -789,6 +789,9 @@ static void octeon_i2c_prepare_recovery(struct i2c_adapter *adap) struct octeon_i2c *i2c = i2c_get_adapdata(adap); octeon_i2c_hlc_disable(i2c); + octeon_i2c_reg_write(i2c, SW_TWSI_EOP_TWSI_RST, 0); + /* wait for software reset to settle */ + udelay(5); /* * Bring control register to a good state regardless