From patchwork Wed Mar 16 07:19:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Green X-Patchwork-Id: 625 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 y5cs1273ybj; Wed, 16 Mar 2011 00:19:21 -0700 (PDT) Received: by 10.227.63.130 with SMTP id b2mr425040wbi.96.1300259960709; Wed, 16 Mar 2011 00:19:20 -0700 (PDT) Received: from mail-wy0-f178.google.com (mail-wy0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id e7si1130422wer.165.2011.03.16.00.19.19 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 Mar 2011 00:19:20 -0700 (PDT) Received-SPF: pass (google.com: domain of andy.warmcat.com@googlemail.com designates 74.125.82.178 as permitted sender) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of andy.warmcat.com@googlemail.com designates 74.125.82.178 as permitted sender) smtp.mail=andy.warmcat.com@googlemail.com; dkim=pass (test mode) header.i=@googlemail.com Received: by mail-wy0-f178.google.com with SMTP id 26so1558835wyj.37 for ; Wed, 16 Mar 2011 00:19:19 -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=DsYXx/wI3bbOO9Z0z16HqKmv4/hEsoKtdEw3T8y7j9k=; b=oBYN+KchnbI2JfsB1Bpg8hQmvpXozy8IkqZkgmChr426IlS8UlN4AmX7T6SutIFB8G SYL8fNvNcLZgj+TZQDC4nQS9flmmYp9ukJLvCAEuHSkPlldQbnsJaeuQhW0fx1uOlC8F NHp8SfnfRwgm/jp/fCMmfzRK78rdJZ2j7aqT8= 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=PIuSxoazUlzaOrDpTNjezYiWzx84g0n+vKub++qOhSfnulGJZxxE+ZBF5+BHL5sNoh jrm38+fH9eRUIvHph+sOyN/47WDSdcAUvZpvrPnrJ6BDDx8Ew/RC34Ke59cnAZJcpwx3 4tdN5D10v8HZuloaLI+XzDhPI5Pe1dR4QHFKI= Received: by 10.216.220.147 with SMTP id o19mr367416wep.98.1300259959881; Wed, 16 Mar 2011 00:19:19 -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 t11sm364636wes.41.2011.03.16.00.19.19 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 Mar 2011 00:19:19 -0700 (PDT) Sender: Andy Green From: Andy Green Subject: [PATCH 3 08/18] I2C: OMAP2+: use platform_data ip revision to select register map To: linux-i2c@lists.infradead.org Cc: patches@linaro.org, Ben Dooks , Andy Green Date: Wed, 16 Mar 2011 07:19:18 +0000 Message-ID: <20110316071918.453.44496.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 Change the register map names to reflect the IP revision they are representing, and use the platform_data IP revision index to select between them at init time. Eliminates 1 of 17 cpu_...() calls in the driver. Cc: patches@linaro.org Cc: Ben Dooks Reported-by: Peter Maydell Signed-off-by: Andy Green --- drivers/i2c/busses/i2c-omap.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 2826c13..eee0bb8 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -205,7 +205,7 @@ struct omap_i2c_dev { u16 errata; }; -const static u8 reg_map[] = { +const static u8 reg_map_ip_v1[] = { [OMAP_I2C_REV_REG] = 0x00, [OMAP_I2C_IE_REG] = 0x01, [OMAP_I2C_STAT_REG] = 0x02, @@ -226,7 +226,7 @@ const static u8 reg_map[] = { [OMAP_I2C_BUFSTAT_REG] = 0x10, }; -const static u8 omap4_reg_map[] = { +const static u8 reg_map_ip_v2[] = { [OMAP_I2C_REV_REG] = 0x04, [OMAP_I2C_IE_REG] = 0x2c, [OMAP_I2C_STAT_REG] = 0x28, @@ -1037,10 +1037,10 @@ omap_i2c_probe(struct platform_device *pdev) else dev->reg_shift = 2; - if (cpu_is_omap44xx()) - dev->regs = (u8 *) omap4_reg_map; + if (pdata->rev == OMAP_I2C_IP_VERSION_2) + dev->regs = (u8 *)reg_map_ip_v2; else - dev->regs = (u8 *) reg_map; + dev->regs = (u8 *)reg_map_ip_v1; pm_runtime_enable(&pdev->dev); omap_i2c_unidle(dev);