From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751943AbdKANEX (ORCPT ); Wed, 1 Nov 2017 09:04:23 -0400 Received: from srv1.host37.de ([176.28.54.59]:60584 "EHLO srv1.host37.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750848AbdKANEW (ORCPT ); Wed, 1 Nov 2017 09:04:22 -0400 Date: Wed, 1 Nov 2017 14:04:18 +0100 From: Juergen Fitschen To: Ludovic Desroches Cc: Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC 3/4] i2c: at91: added slave mode support Message-ID: <20171101130417.GA17787@jfi-dev> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Helle Ludovic, while going through this patch a question related to the Atmel / Microchip HW came into mind: On Fri, Oct 27, 2017 at 05:12:00PM +0200, Juergen Fitschen wrote: > diff --git a/drivers/i2c/busses/i2c-at91.h b/drivers/i2c/busses/i2c-at91.h > (...) > #define AT91_TWI_INT_MASK \ > - (AT91_TWI_TXCOMP | AT91_TWI_RXRDY | AT91_TWI_TXRDY | AT91_TWI_NACK) > + (AT91_TWI_TXCOMP | AT91_TWI_RXRDY | AT91_TWI_TXRDY | AT91_TWI_NACK \ > + | AT91_TWI_SVACC | AT91_TWI_EOSACC) The AT91_TWI_INT_MASK is used to disable all interrputs in the at91_disable_twi_interrupts function by writing the mask to the interrupt disable register (IDR). I wonder what happens on MPUs that don't have AT91_TWI_SVACC and AT91_TWI_EOSACC implemented, like the AT91RM9200? Do you think we should revise this and write specific masks depending on the current moude the I2C HW is in? Something like this: void at91_disable_twi_interrupts(struct at91_twi_dev *dev) { if (dev->slave_detected) at91_twi_write(dev, AT91_TWI_IDR, AT91_TWI_INT_MASK_SLAVE); else at91_twi_write(dev, AT91_TWI_IDR, AT91_TWI_INT_MASK_MASTER); } Best regards Juergen