From patchwork Fri Oct 30 07:37:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 538194 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 0DFD6140D9D for ; Fri, 30 Oct 2015 18:42:28 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751505AbbJ3Hlo (ORCPT ); Fri, 30 Oct 2015 03:41:44 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:58614 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751485AbbJ3Hln (ORCPT ); Fri, 30 Oct 2015 03:41:43 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id t9U7eYxn018799; Fri, 30 Oct 2015 00:41:15 -0700 Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 1xv4c9r01a-14 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 30 Oct 2015 00:41:15 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Fri, 30 Oct 2015 00:41:01 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1044.25 via Frontend Transport; Fri, 30 Oct 2015 00:41:01 -0700 Received: from xhacker.marvell.com (unknown [10.37.135.134]) by maili.marvell.com (Postfix) with ESMTP id 6CCC43F7041; Fri, 30 Oct 2015 00:41:00 -0700 (PDT) From: Jisheng Zhang To: , , , CC: , , , Jisheng Zhang Subject: [PATCH] i2c: designware: Don't mask TX_EMPTY if write is in progress Date: Fri, 30 Oct 2015 15:37:29 +0800 Message-ID: <1446190649-1318-1-git-send-email-jszhang@marvell.com> X-Mailer: git-send-email 2.6.2 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2015-10-30_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=inbound_notspam policy=inbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1507310000 definitions=main-1510300145 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Currently when i2c_msg index search is completed, TX_EMPTY interrupt will be masked. But if the size of i2c_msg data is longer than the size of the tx buffer, we still need TX_EMPTY interrupt, otherwise we will get "controller timed out" error. This patch fixes this issue by only masking TX_EMPTY if i2c_msg index search is completed and write is not in progress. Signed-off-by: Jisheng Zhang --- drivers/i2c/busses/i2c-designware-core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c index 7441cdc..a2eb212 100644 --- a/drivers/i2c/busses/i2c-designware-core.c +++ b/drivers/i2c/busses/i2c-designware-core.c @@ -542,10 +542,11 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) } /* - * If i2c_msg index search is completed, we don't need TX_EMPTY - * interrupt any more. + * If i2c_msg index search is completed and writing is not in progress, + * we don't need TX_EMPTY interrupt any more. */ - if (dev->msg_write_idx == dev->msgs_num) + if (dev->msg_write_idx == dev->msgs_num && + !(dev->status & STATUS_WRITE_IN_PROGRESS)) intr_mask &= ~DW_IC_INTR_TX_EMPTY; if (dev->msg_err)