Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754246AbbLKImf (ORCPT ); Fri, 11 Dec 2015 03:42:35 -0500 Received: from mga03.intel.com ([134.134.136.65]:40799 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753053AbbLKIme (ORCPT ); Fri, 11 Dec 2015 03:42:34 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,412,1444719600"; d="scan'208";a="869423104" Subject: Re: [PATCH v2] I2C: designware: fix IO timeout issue for AMD controller To: Xiangliang Yu , andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, wsa@the-dreams.de, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org References: <1449835373-4669-1-git-send-email-Xiangliang.Yu@amd.com> Cc: SPG_Linux_Kernel@amd.com From: Jarkko Nikula Message-ID: <566A8C76.9080104@linux.intel.com> Date: Fri, 11 Dec 2015 10:42:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.4.0 MIME-Version: 1.0 In-Reply-To: <1449835373-4669-1-git-send-email-Xiangliang.Yu@amd.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1920 Lines: 47 On 12/11/2015 02:02 PM, Xiangliang Yu wrote: > Because of some hardware limitation, AMD I2C controller can't > trigger pending interrupt if interrupt status has been changed > after clearing interrupt status bits. Then, I2C will lost > interrupt and IO timeout. > > According to hardware design, this patch implements a workaround > to disable i2c controller interrupt and re-enable i2c interrupt > before exiting ISR. > > To reduce the performance impacts on other vendors, use unlikely > function to check flag in ISR. > --- > Changes in v2: > - pass flags with ->driver_data > - unmask interrupt right after masking > > Signed-off-by: Xiangliang Yu > --- > drivers/i2c/busses/i2c-designware-core.c | 6 ++++++ > drivers/i2c/busses/i2c-designware-core.h | 1 + > drivers/i2c/busses/i2c-designware-platdrv.c | 7 ++++++- > 3 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c > index 8c48b27..de7fbbb 100644 > --- a/drivers/i2c/busses/i2c-designware-core.c > +++ b/drivers/i2c/busses/i2c-designware-core.c > @@ -813,6 +813,12 @@ static irqreturn_t i2c_dw_isr(int this_irq, void *dev_id) > tx_aborted: > if ((stat & (DW_IC_INTR_TX_ABRT | DW_IC_INTR_STOP_DET)) || dev->msg_err) > complete(&dev->cmd_complete); > + else if (unlikely(dev->accessor_flags & ACCESS_INTR_MASK)) { > + /* workaround to trigger pending interrupt */ > + stat = dw_readl(dev, DW_IC_INTR_MASK); > + i2c_dw_disable_int(dev); > + dw_writel(dev, stat, DW_IC_INTR_MASK); > + } > Looks ok to me. Acked-by: Jarkko Nikula -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/