Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1148051imm; Mon, 21 May 2018 22:32:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqpPW3qMggdTujlYVS8dGQRdgkT0toi0HBziEfhUPuSQFbyKuRJnB7YS+wPSk86krx2kocm X-Received: by 2002:a17:902:a585:: with SMTP id az5-v6mr23122744plb.79.1526967172791; Mon, 21 May 2018 22:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526967172; cv=none; d=google.com; s=arc-20160816; b=Plp2ZaRTPXxl9prL5JdqFEsKxy+ZrWTRF2wak+btxRSlJjqU5YWTx5kV83/T5bsqqq DCNIzKoQVq8nsubgtNdXCZN8qMRu0pqIi9iKJ+d3lsuRGLvEmko+8jQKJR25ZRSEyJ8o DHmhRBiukWRRRY3SNin77NUlRm1u1s8LLKS933tL+7yCpSQUubza9y3+jkDK5CPlRJ1+ kgymACitPlfsE7ky68EbAzTsYQRC9tkcwPD4rpDv7hmQCRAzaj0wnJLLEV2aS0KyfSGE xVfEzLLeN0iI1XwlqpD7bw72UH+RHjI1FyG6+Y12rQCYqZHhn5xpNZ7wF/nvLnrt4Usd AWhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=uZgL9NSp23rojoNnO/jJxx44dTWZajG7eMiGFPw0XIA=; b=E5/XhCHCye3+zTePFHoRmYuCu7Bz9A2LiyZvlkOOXIV16gHVIVG8USChGPBJVJ5B88 IcidPuqZJd3DnrmEQZL8Iamdt2Et2L/LVFEc5JSXe3dEJEhq2L3unxCk4VVM/IELsVro j3nNm7nNzrvsjHMwEqDxf+qX+OvXiwVWKnemhSLfuzt83PVByFag8CPkSK8G4Km5DuFr NiotwKrT1Eo6e8zBWHuYY2DaNU+msHPrzOEwa26d+kR+av0myB4EtqPFH0Qs+gd4Csje SuJbB0Oz7iExE+X0AshRsHW83/KsT/RZZF7hJ8XDjtK5k/K4tVzQi25iUPu/fev9aNHP 7IsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fgXA2goS; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g27-v6si5077654pgn.529.2018.05.21.22.32.37; Mon, 21 May 2018 22:32:52 -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=@kernel.org header.s=default header.b=fgXA2goS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751474AbeEVFbH (ORCPT + 99 others); Tue, 22 May 2018 01:31:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:33930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751002AbeEVFbE (ORCPT ); Tue, 22 May 2018 01:31:04 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9801920870; Tue, 22 May 2018 05:31:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526967064; bh=mXFReinTYtjALreWgFZJmTI8rx3BcZr2CsgFm/CH8rg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fgXA2goSwKbfnTA2EAvo0IqKu7l6rQ7k1k7wKSpZpNPcfI+DN+BPYfCMD6k/xNkJM EOMpuZRUR0yu3klIGQgfrOSrRSeOtWL3xl7pPVj1xC5bvlwL1ZpJPyB+air3Y8R3LW j3WZrvg2fULjt5vzy8DOKyciNk0y2NdqeUCcNX00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Monakov , Ben Gardner , Jarkko Nikula , Wolfram Sang Subject: [PATCH 4.16 031/110] i2c: designware: fix poll-after-enable regression Date: Mon, 21 May 2018 23:11:28 +0200 Message-Id: <20180521210506.512907648@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521210503.823249477@linuxfoundation.org> References: <20180521210503.823249477@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexander Monakov commit 06cb616b1bca7080824acfedb3d4c898e7a64836 upstream. Not all revisions of DW I2C controller implement the enable status register. On platforms where that's the case (e.g. BG2CD and SPEAr ARM SoCs), waiting for enable will time out as reading the unimplemented register yields zero. It was observed that reading the IC_ENABLE_STATUS register once suffices to avoid getting it stuck on Bay Trail hardware, so replace polling with one dummy read of the register. Fixes: fba4adbbf670 ("i2c: designware: must wait for enable") Signed-off-by: Alexander Monakov Tested-by: Ben Gardner Acked-by: Jarkko Nikula Signed-off-by: Wolfram Sang Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-designware-master.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -209,7 +209,10 @@ static void i2c_dw_xfer_init(struct dw_i i2c_dw_disable_int(dev); /* Enable the adapter */ - __i2c_dw_enable_and_wait(dev, true); + __i2c_dw_enable(dev, true); + + /* Dummy read to avoid the register getting stuck on Bay Trail */ + dw_readl(dev, DW_IC_ENABLE_STATUS); /* Clear and enable interrupts */ dw_readl(dev, DW_IC_CLR_INTR);