From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933642AbcI1WWi (ORCPT ); Wed, 28 Sep 2016 18:22:38 -0400 Received: from smtp.domeneshop.no ([194.63.252.55]:42598 "EHLO smtp.domeneshop.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933541AbcI1WW3 (ORCPT ); Wed, 28 Sep 2016 18:22:29 -0400 Subject: Re: [PATCH v3 2/7] i2c: bcm2835: Protect against unexpected TXW/RXR interrupts To: Eric Anholt , wsa@the-dreams.de, swarren@wwwdotorg.org References: <1475085056-5205-1-git-send-email-noralf@tronnes.org> <1475085056-5205-3-git-send-email-noralf@tronnes.org> <87oa37fzx6.fsf@eliezer.anholt.net> Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org From: =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= Message-ID: Date: Thu, 29 Sep 2016 00:22:25 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <87oa37fzx6.fsf@eliezer.anholt.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Den 29.09.2016 00:00, skrev Eric Anholt: > Noralf Trønnes writes: > >> If an unexpected TXW or RXR interrupt occurs (msg_buf_remaining == 0), >> the driver has no way to fill/drain the FIFO to stop the interrupts. >> In this case the controller has to be disabled and the transfer >> completed to avoid hang. >> >> (CLKT | ERR) and DONE interrupts are completed in their own paths, and >> the controller is disabled in the transfer function after completion. >> Unite the code paths and do disabling inside the interrupt routine. >> >> Clear interrupt status bits in the united completion path instead of >> trying to do it on every interrupt which isn't necessary. >> Only CLKT, ERR and DONE can be cleared that way. >> >> Add the status value to the error value in case of TXW/RXR errors to >> distinguish them from the other S_LEN error. > I was surprised that not writing the TXW/RXR bits on handling their > interrupts was OK, given that we were doing so before, but it's a level > interrupt and those bits are basically ignored on write. > > This patch and 3, 4, and 6 are: > > Reviewed-by: Eric Anholt > > Patch 5 is: > > Acked-by: Eric Anholt > > Note for future debug: The I2C_C_CLEAR on errors will take some time to > resolve -- if you were in non-idle state and I2C_C_READ, it sets an > abort_rx flag and runs through the state machine to send a NACK and a > STOP, I think. Since we're setting CLEAR without I2CEN, that NACK will > be hanging around queued up for next time we start the engine. Maybe you're able to explain the issues I had with reset: https://github.com/raspberrypi/linux/issues/1653 Should we put your note into the commit message? It will most likely be lost if it just stays in this email. Noralf.