From patchwork Tue Mar 8 11:08:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Green X-Patchwork-Id: 428 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 o4cs23940qah; Tue, 8 Mar 2011 03:08:25 -0800 (PST) Received: by 10.227.166.15 with SMTP id k15mr4364108wby.204.1299582504546; Tue, 08 Mar 2011 03:08:24 -0800 (PST) Received: from mail-ww0-f42.google.com (mail-ww0-f42.google.com [74.125.82.42]) by mx.google.com with ESMTPS id g12si773654wer.198.2011.03.08.03.08.22 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Mar 2011 03:08:23 -0800 (PST) Received-SPF: pass (google.com: domain of andy.warmcat.com@googlemail.com designates 74.125.82.42 as permitted sender) client-ip=74.125.82.42; Authentication-Results: mx.google.com; spf=pass (google.com: domain of andy.warmcat.com@googlemail.com designates 74.125.82.42 as permitted sender) smtp.mail=andy.warmcat.com@googlemail.com; dkim=pass (test mode) header.i=@googlemail.com Received: by mail-ww0-f42.google.com with SMTP id 17so808658wwi.1 for ; Tue, 08 Mar 2011 03:08:22 -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=DsYXx/wI3bbOO9Z0z16HqKmv4/hEsoKtdEw3T8y7j9k=; b=SE7NKzPk+vONUBiWTNQD+OkbQi3dGMDVipE5QTHCbNI0tEDQ2GNnbYspMZyrNyA/1i 0w0/jJ0lr7R355fGwcw8nEDOWzNDrORXuh7BBsWPVg7Vi2LbY3LmfbjwNRe/t+avtlIP 9fpd+mykX75fCPWYAY5+owU3J8Drw3gKnXO00= 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=T3iZiAjhOgf4+BVesDdPS9SRv2L2PieS4kn6AxNxxSTr8DgNbCuteaOGQ5rNIsdPjN o+vO+5QXd8KFEDbpzlX4XTyMCgSs3fBJ6fTG7COY/ELldx20+xZ6f0gpS0d0ANQbT19e DY1cL3kxGC6Wa9J5L8MspVVEFDR7/OxQta1PI= Received: by 10.216.134.130 with SMTP id s2mr4338885wei.34.1299582502120; Tue, 08 Mar 2011 03:08:22 -0800 (PST) Received: from otae.warmcat.com (s15404224.onlinehome-server.info [87.106.134.80]) by mx.google.com with ESMTPS id n78sm251036weq.27.2011.03.08.03.08.21 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Mar 2011 03:08:21 -0800 (PST) Sender: Andy Green From: Andy Green Subject: [PATCH 2 08/18] I2C: OMAP2+: use platform_data ip revision to select register map 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:20 +0000 Message-ID: <20110308110819.23531.59280.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 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);