Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3283599yba; Tue, 23 Apr 2019 00:39:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFUI2NtGTOe1Mz2FQJUOVWFgT+dw0k6yVO+z2xBPCWP5QC2m2M76XXL6EFe/BYW7bQvrQC X-Received: by 2002:a62:5ec2:: with SMTP id s185mr25963600pfb.16.1556005152111; Tue, 23 Apr 2019 00:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556005152; cv=none; d=google.com; s=arc-20160816; b=Vk6FQuqn68ullShKO6ZdLEEHOqNDj7tD6838yuwz4lYYEMcf58PU9EOkQZB8UL7kiE ipCsMyTN64jEo66kQETwO4QaTc0Z2Vv3aqGUWi9by/oyJySZExopIu9HdZFHFMUO2ZHq bCFVlLQHYfLsuC5OYfKFnW7ZmYwcCtLtf9+aMPpwdDb/wXZ80rtoL4o6ctCx7JI87cRO gYdTMMWB0bd7fitGIa59lxwoiW1lVvYRQ19LposkNSEzwpYkW/dHp2eQZ+cn7o7tas7X drhEQaNDeI6sHgmoQXG4CMB2HoRWCfZV61oJJdNWWyfqJrFt/+9czMVla8Tnfd7u2rEx M/IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=RxFYCJET9zHUcOpjZ9bK7uMOuTUHPRpqiuEPuAi6Gtw=; b=MhbdvM7W5heawH+Dc2gdc3mB+k73Fs/vTSS+M0hyef62s+k6Kxhc0rgRiIrtUhYl1C 5pEDnT9l40OcYo5uta+HYY+q9j/bL1vv2JVLiCdEWi1Jgxb8gw3D99N/v7oUdso+23kB 9QJup/2hcTvI4Aroelpb8pDiPf2yVDiffdQQ+XFnOJ1HTFIkGyzOHdrup+VC+uX+97O8 C/0i28oliiK19ztj4iCenEft3p5VwdjGn5PocO6WJvPeIwIt6/k/rfoEwKOdQw5xW3nk TmsUgd3uwm1Xqa5faR1KXJXqdlyZFGGb+naAm68jqD/fVRn3geTjCHpJ5rZ1uWqdm4wv FG4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z0jSuOww; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u8si14441221pgo.122.2019.04.23.00.38.56; Tue, 23 Apr 2019 00:39:12 -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=@gmail.com header.s=20161025 header.b=Z0jSuOww; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726364AbfDWHiG (ORCPT + 99 others); Tue, 23 Apr 2019 03:38:06 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35955 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbfDWHiG (ORCPT ); Tue, 23 Apr 2019 03:38:06 -0400 Received: by mail-pf1-f193.google.com with SMTP id z5so7034200pfn.3; Tue, 23 Apr 2019 00:38:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=RxFYCJET9zHUcOpjZ9bK7uMOuTUHPRpqiuEPuAi6Gtw=; b=Z0jSuOwwX6CFicJKldwZoTo3ZmYf1Xq5y9XX+JTNi1/r0ynpw2oqhP9K2VKQjxJz+p GbBOSoCne+u1WRAw2ID3l48V26UcB4jIJ1j6qBo4cqSwNExQfI4u3q7wBqay8lCxWm+4 Ui8fxxAMs+GW4OdS7YGM5exYAwczGQzOFo83iSURpe+bqWvtmRN1jhC9y9ZgrJoqQxJy RCm9EGGpSrkz0JVM5+5oCu/BqmrIC25WByjyCo/Vb9HBaE1RI6junCh4M2DpLvPUd/Km VKi6LDJBUfLFOpQhufhVJ843f1vMIHFcZVBZByRRE2cOSXIYr41V/s5DNeAjAJyHx8xl 5JZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=RxFYCJET9zHUcOpjZ9bK7uMOuTUHPRpqiuEPuAi6Gtw=; b=SRUNUTLHGcjVq6Cw7Sy0VEoIG6n59DuOD8ptKrkCylj/KcRbUhnxQw6Uqn2qdcYDRI NJUYeW349pia8B5vYHhARVb0+gvPgNs9IOH6CWBWJ5L7LuLl4WaPiNX8l/dv6rkhATSK R7/IyXmF7ypzYB3Viin7M1RVcR83V2mlacbxhLAcoJH/3r9AcFtRzD9n0ires4qT4h/V dQxRBukzMR2gskfEyIyqvRL1OrvQWkjWtplv1X1+mVIU98/wuJlf6vOupI17HtKv+Dxz 7o/qZgWsOIdKZx2XvrmmBqbeO2PbZIbA48jifaK6CBcqKTH8hS1eAcVO2IBKXdl90SSz qL1A== X-Gm-Message-State: APjAAAXsH5byiq9NiMk7V3NOWkdUGZvs6f6Hn/8DVeDU9/tYtpLmJsrt En7OAZTR7kBoyIPeRlBpFH949oGALUM= X-Received: by 2002:a62:4d43:: with SMTP id a64mr25026195pfb.174.1556005085025; Tue, 23 Apr 2019 00:38:05 -0700 (PDT) Received: from localhost.localdomain ([219.91.196.67]) by smtp.googlemail.com with ESMTPSA id o81sm26360447pfa.156.2019.04.23.00.38.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 00:38:04 -0700 (PDT) From: Raag Jadav To: linux-i2c@vger.kernel.org Cc: ludovic.desroches@microchip.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Raag Jadav Subject: [PATCH] i2c: at91: handle TXRDY interrupt spam Date: Tue, 23 Apr 2019 13:06:48 +0530 Message-Id: <1556005008-6318-1-git-send-email-raagjadav@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Performing i2c write operation while SDA or SCL line is held or grounded by slave device, we go into infinite at91_twi_write_next_byte loop with TXRDY interrupt spam. Signed-off-by: Raag Jadav --- drivers/i2c/busses/i2c-at91.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 3f3e8b3..b2f5fdb 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c @@ -72,6 +72,7 @@ #define AT91_TWI_TXCOMP BIT(0) /* Transmission Complete */ #define AT91_TWI_RXRDY BIT(1) /* Receive Holding Register Ready */ #define AT91_TWI_TXRDY BIT(2) /* Transmit Holding Register Ready */ +#define AT91_TWI_SVREAD BIT(3) /* Slave Read */ #define AT91_TWI_OVRE BIT(6) /* Overrun Error */ #define AT91_TWI_UNRE BIT(7) /* Underrun Error */ #define AT91_TWI_NACK BIT(8) /* Not Acknowledged */ @@ -571,7 +572,10 @@ static irqreturn_t atmel_twi_interrupt(int irq, void *dev_id) at91_disable_twi_interrupts(dev); complete(&dev->cmd_complete); } else if (irqstatus & AT91_TWI_TXRDY) { - at91_twi_write_next_byte(dev); + if ((status & AT91_TWI_SVREAD) && (dev->buf_len == 0)) + at91_twi_write(dev, AT91_TWI_IDR, AT91_TWI_TXRDY); + else + at91_twi_write_next_byte(dev); } /* catch error flags */ -- 2.7.4