From patchwork Tue Mar 8 11:08:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Green X-Patchwork-Id: 431 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:42:37 -0000 Delivered-To: patches@linaro.org Received: by 10.224.60.68 with SMTP id o4cs23943qah; Tue, 8 Mar 2011 03:08:32 -0800 (PST) Received: by 10.213.26.212 with SMTP id f20mr3460023ebc.89.1299582511658; Tue, 08 Mar 2011 03:08:31 -0800 (PST) Received: from mail-ey0-f178.google.com (mail-ey0-f178.google.com [209.85.215.178]) by mx.google.com with ESMTPS id p57si1357682eeh.34.2011.03.08.03.08.29 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Mar 2011 03:08:30 -0800 (PST) Received-SPF: pass (google.com: domain of andy.warmcat.com@googlemail.com designates 209.85.215.178 as permitted sender) client-ip=209.85.215.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of andy.warmcat.com@googlemail.com designates 209.85.215.178 as permitted sender) smtp.mail=andy.warmcat.com@googlemail.com; dkim=pass (test mode) header.i=@googlemail.com Received: by eya25 with SMTP id 25so2180378eya.37 for ; Tue, 08 Mar 2011 03:08:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:sender:from:subject:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version:content-type :content-transfer-encoding; bh=AoFCbVShV1oRm6TNVlYU1/qM5LV3GSQzFtqGw3RzcXY=; b=qOkUn5YxL+jGzdhNnIRQl2u5wTfFFUuswrglR/U3Guwdypt9mZU9xkAo6w9oKLhRYR Y65PahNmeep+1gXAB1PmL1cA/GFb7/o/ZX2xPjXY2vuPuU6JIqAfhFbNeLzuiYLA4WN9 kGyVHYx/klWaYyb+bJzXiHOrZFVDvWQMU+Pcs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=sender:from:subject:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; b=jEInYF2Abh3HqxcjoW0iGDQtiEHOe1WN4lB6/z5xuyL/+y8Vz6JwbcYlYLdSabCYn4 Kq/PjzJl5AR+tdkyWEnBPOAktuZwHNYQ3X+d1Pusug2ZzdD8rBTxADBRbU16lRfGHmy3 VxkUgYpTinhOj++oyl3rBRvdUXt16gK362yj8= Received: by 10.216.221.16 with SMTP id q16mr4213679wep.71.1299582509596; Tue, 08 Mar 2011 03:08:29 -0800 (PST) Received: from otae.warmcat.com (s15404224.onlinehome-server.info [87.106.134.80]) by mx.google.com with ESMTPS id j49sm252501wer.14.2011.03.08.03.08.28 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Mar 2011 03:08:29 -0800 (PST) Sender: Andy Green From: Andy Green Subject: [PATCH 2 09/18] I2C: OMAP2+: Solve array bounds overflow error on i2c idle To: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org Cc: patches@linaro.org, Ben Dooks , Andy Green Date: Tue, 08 Mar 2011 11:08:27 +0000 Message-ID: <20110308110827.23531.55834.stgit@otae.warmcat.com> In-Reply-To: <20110308105934.23531.83540.stgit@otae.warmcat.com> References: <20110308105934.23531.83540.stgit@otae.warmcat.com> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 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 --- 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 eee0bb8..14f5b50 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);