From patchwork Tue Mar 15 19:56:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Green X-Patchwork-Id: 592 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:02 -0000 Delivered-To: patches@linaro.org Received: by 10.151.46.5 with SMTP id y5cs80504ybj; Tue, 15 Mar 2011 12:56:54 -0700 (PDT) Received: by 10.216.58.200 with SMTP id q50mr3523058wec.83.1300219013132; Tue, 15 Mar 2011 12:56:53 -0700 (PDT) Received: from mail-ww0-f42.google.com (mail-ww0-f42.google.com [74.125.82.42]) by mx.google.com with ESMTPS id m53si300507wej.87.2011.03.15.12.56.51 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 15 Mar 2011 12:56:52 -0700 (PDT) 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 4so3297987wwk.1 for ; Tue, 15 Mar 2011 12:56:51 -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=lSCC7U8uPRQ4FrGDNGwWQY4gJ01Ox3mIMw0gNhCXa+TQWjX2zIn1VBL1F6oXPvq8f1 BxjRzwPzHZtHPCXNdoTs348OiNEs3IHm2PtfpsASZMlR81LYN/WisiyYqi2qQlPhwV+k rnYsLbVEI8MSPKXgss5jfGjyW8AGW/uE2Fkho= 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=A1bFg1WaH9CvfMXjPM476tzwr/e8d2uUm0gYa71bUeB8BZQ+etcHciN+RJ0kPSPEQS 63q9Vh5TQWyeb0rZMc81Y9HsKaBkqzAYYE8pQsr9EJamRK2gh4/PASh4Am0faOBNSHJj pxjo5u9oEw1NEeuvq9Y96CcBABwTQu3bNzp/k= Received: by 10.216.188.201 with SMTP id a51mr4002837wen.60.1300219011303; Tue, 15 Mar 2011 12:56:51 -0700 (PDT) Received: from otae.warmcat.com (s15404224.onlinehome-server.info [87.106.134.80]) by mx.google.com with ESMTPS id j49sm110386wer.14.2011.03.15.12.56.50 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 15 Mar 2011 12:56:51 -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-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org Cc: patches@linaro.org, Ben Dooks , Andy Green Date: Tue, 15 Mar 2011 19:56:49 +0000 Message-ID: <20110315195648.30000.78684.stgit@otae.warmcat.com> In-Reply-To: <20110315195147.30000.86184.stgit@otae.warmcat.com> References: <20110315195147.30000.86184.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);