From patchwork Wed Mar 16 07:19:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Green X-Patchwork-Id: 624 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:44:11 -0000 Delivered-To: patches@linaro.org Received: by 10.151.46.5 with SMTP id y5cs1275ybj; Wed, 16 Mar 2011 00:19:28 -0700 (PDT) Received: by 10.227.169.2 with SMTP id w2mr427036wby.77.1300259967604; Wed, 16 Mar 2011 00:19:27 -0700 (PDT) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id r15si1151338wec.102.2011.03.16.00.19.26 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 Mar 2011 00:19:27 -0700 (PDT) Received-SPF: pass (google.com: domain of andy.warmcat.com@googlemail.com designates 74.125.82.50 as permitted sender) client-ip=74.125.82.50; Authentication-Results: mx.google.com; spf=pass (google.com: domain of andy.warmcat.com@googlemail.com designates 74.125.82.50 as permitted sender) smtp.mail=andy.warmcat.com@googlemail.com; dkim=pass (test mode) header.i=@googlemail.com Received: by mail-ww0-f50.google.com with SMTP id 33so1741876wwc.31 for ; Wed, 16 Mar 2011 00:19:26 -0700 (PDT) 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=v0rctFafCSdwWhEEpw99AFGp5+v6CeC3zHosTASbDpoDFPMhONfWuSdwUi+9AZuwmD ipBC4PFwlWjI+nAhSx23fngKLw9DbLzl/uMZyxc8UErVLFkkqCnX4/c3b1pV5VyDhAFQ vheGGv84fCxPQq7qpl0/AjsXkJkNx+YDqdjmE= 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=TPvRhi4qu+LbDfrsweN9jj2ekiomXOg5AIfedASO7X+qf8XN1mgGwGbi+/7mcQ8ZOv 94mghNJGooTPRhc0WVPsI1atG9PjDxd7UzSB5dwUW+TH0BNIRas5VuIuTuzUzymtuGNO ilyIWOZTSVOb+B1wFXId0AM1gsnSiQb4vh0X4= Received: by 10.216.241.10 with SMTP id f10mr480151wer.18.1300259966809; Wed, 16 Mar 2011 00:19:26 -0700 (PDT) Received: from otae.warmcat.com (cpc1-nrte21-2-0-cust677.8-4.cable.virginmedia.com [81.111.78.166]) by mx.google.com with ESMTPS id k76sm363681wej.43.2011.03.16.00.19.25 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 Mar 2011 00:19:26 -0700 (PDT) Sender: Andy Green From: Andy Green Subject: [PATCH 3 09/18] I2C: OMAP2+: Solve array bounds overflow error on i2c idle To: linux-i2c@lists.infradead.org Cc: patches@linaro.org, Ben Dooks , Andy Green Date: Wed, 16 Mar 2011 07:19:25 +0000 Message-ID: <20110316071924.453.13789.stgit@otae.warmcat.com> In-Reply-To: <20110316071633.453.22228.stgit@otae.warmcat.com> References: <20110316071633.453.22228.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);