From patchwork Thu Jun 2 00:19:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 842242 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p520KW1V020785 for ; Thu, 2 Jun 2011 00:20:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759224Ab1FBAUF (ORCPT ); Wed, 1 Jun 2011 20:20:05 -0400 Received: from na3sys009aog105.obsmtp.com ([74.125.149.75]:39505 "EHLO na3sys009aog105.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759073Ab1FBAUC (ORCPT ); Wed, 1 Jun 2011 20:20:02 -0400 Received: from mail-px0-f169.google.com ([209.85.212.169]) (using TLSv1) by na3sys009aob105.postini.com ([74.125.148.12]) with SMTP ID DSNKTebXMfdkKl9LYpYw4POrviyoTo/FGEcQ@postini.com; Wed, 01 Jun 2011 17:20:02 PDT Received: by mail-px0-f169.google.com with SMTP id 9so195021pxi.28 for ; Wed, 01 Jun 2011 17:20:01 -0700 (PDT) Received: by 10.68.32.137 with SMTP id j9mr44301pbi.2.1306974001704; Wed, 01 Jun 2011 17:20:01 -0700 (PDT) Received: from localhost (c-24-19-7-36.hsd1.wa.comcast.net [24.19.7.36]) by mx.google.com with ESMTPS id c5sm69131pbj.57.2011.06.01.17.20.00 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Jun 2011 17:20:01 -0700 (PDT) From: Kevin Hilman To: Ben Dooks , linux-i2c@vger.kernel.org Cc: Andy Green , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 09/18] I2C: OMAP2+: Solve array bounds overflow error on i2c idle Date: Wed, 1 Jun 2011 17:19:35 -0700 Message-Id: <1306973984-15165-10-git-send-email-khilman@ti.com> X-Mailer: git-send-email 1.7.4 In-Reply-To: <1306973984-15165-1-git-send-email-khilman@ti.com> References: <1306973984-15165-1-git-send-email-khilman@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 02 Jun 2011 00:20:38 +0000 (UTC) From: Andy Green This solves the main problem the patch series is about. Prior to this patch on OMAP3530 the driver wrongly interprets the I2C peripheral unit's own reported revision as meaning it is running on an IP V2 device and must use the extended registers. In fact OMAP3530 is IP V1 with the smaller register set, the reason for the confusion is that the hardware does in fact report having the same IP revision index as is found on an OMAP4430, which really is IP V2 and has the extended registers. This corrects the test for which registers to use so that it decides using hwmod knowledge found in the platform_data. Cc: patches@linaro.org Cc: Ben Dooks Reported-by: Peter Maydell Signed-off-by: Andy Green Signed-off-by: Tony Lindgren Signed-off-by: Kevin Hilman --- drivers/i2c/busses/i2c-omap.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index fbd4ec4..f7196f3 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -309,7 +309,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev) pdata = pdev->dev.platform_data; dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); - if (dev->rev >= OMAP_I2C_REV_ON_4430) + if (pdata->rev == OMAP_I2C_IP_VERSION_2) omap_i2c_write_reg(dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1); else omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);