Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752871AbcLLTqh (ORCPT ); Mon, 12 Dec 2016 14:46:37 -0500 Received: from mga02.intel.com ([134.134.136.20]:50270 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752435AbcLLTqe (ORCPT ); Mon, 12 Dec 2016 14:46:34 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,338,1477983600"; d="scan'208";a="1080892346" Message-ID: <1481571989.7188.53.camel@linux.intel.com> Subject: Re: [PATCH V3] i2c: designware: fix wrong tx/rx fifo for ACPI From: Andy Shevchenko To: Mika Westerberg Cc: Tin Huynh , Jarkko Nikula , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Loc Ho , Thang Nguyen , Phong Vo , patches@apm.com Date: Mon, 12 Dec 2016 21:46:29 +0200 In-Reply-To: <20161212192113.GA1460@lahna.fi.intel.com> References: <1481531810-31695-1-git-send-email-tnhuynh@apm.com> <1481569373.7188.48.camel@linux.intel.com> <20161212192113.GA1460@lahna.fi.intel.com> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.2-1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1098 Lines: 32 On Mon, 2016-12-12 at 21:21 +0200, Mika Westerberg wrote: > On Mon, Dec 12, 2016 at 09:02:53PM +0200, Andy Shevchenko wrote: > > > + tx_fifo_depth = ((param1 >> 16) & 0xff) + 1; > > > + rx_fifo_depth = ((param1 >> 8)  & 0xff) + 1; > > > + if (!dev->tx_fifo_depth) { > > > + dev->tx_fifo_depth = tx_fifo_depth; > > > + dev->rx_fifo_depth = rx_fifo_depth; > > > + } else if (tx_fifo_depth) { > > > + dev->tx_fifo_depth = min_t(u32, dev- > > > >tx_fifo_depth, > > > + tx_fifo_depth); > > > + dev->rx_fifo_depth = min_t(u32, dev- > > > >rx_fifo_depth, > > > + rx_fifo_depth); > > > + } > > > > So, let's clarify here: > > Is it possible to have an IP without parameter block enabled? I mean > > to > > read something arbitrary (or zeroes, or all-ones) from param1. > > Yes and it is Intel IP. Haswell IIRC and it returned zeroes. Wow! Missed that. In case of zeroes returned the above code might break that (if we are using FIFO size >1byte). tx_fifo_depth will be 1 AFAIU and second condition will be the case. -- Andy Shevchenko Intel Finland Oy