From patchwork Thu Dec 16 10:17:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Hui-R64343 X-Patchwork-Id: 75733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 720D81007D3 for ; Thu, 16 Dec 2010 21:23:39 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 80791280CA; Thu, 16 Dec 2010 11:23:30 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hx5uHz0VW6YA; Thu, 16 Dec 2010 11:23:30 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C1673280B4; Thu, 16 Dec 2010 11:23:25 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2851C2809C for ; Thu, 16 Dec 2010 11:23:23 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xXzmqblwq7PP for ; Thu, 16 Dec 2010 11:23:22 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from TX2EHSOBE008.bigfish.com (tx2ehsobe004.messaging.microsoft.com [65.55.88.14]) by theia.denx.de (Postfix) with ESMTPS id 5AA9A2809F for ; Thu, 16 Dec 2010 11:23:16 +0100 (CET) Received: from mail69-tx2-R.bigfish.com (10.9.14.248) by TX2EHSOBE008.bigfish.com (10.9.40.28) with Microsoft SMTP Server id 14.1.225.8; Thu, 16 Dec 2010 10:23:15 +0000 Received: from mail69-tx2 (localhost.localdomain [127.0.0.1]) by mail69-tx2-R.bigfish.com (Postfix) with ESMTP id E72084B80D2; Thu, 16 Dec 2010 10:23:14 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h) X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:de01egw02.freescale.net; RD:de01egw02.freescale.net; EFVD:NLI Received: from mail69-tx2 (localhost.localdomain [127.0.0.1]) by mail69-tx2 (MessageSwitch) id 1292494994803107_19947; Thu, 16 Dec 2010 10:23:14 +0000 (UTC) Received: from TX2EHSMHS017.bigfish.com (unknown [10.9.14.250]) by mail69-tx2.bigfish.com (Postfix) with ESMTP id B7A0B179004F; Thu, 16 Dec 2010 10:23:14 +0000 (UTC) Received: from de01egw02.freescale.net (192.88.165.103) by TX2EHSMHS017.bigfish.com (10.9.99.117) with Microsoft SMTP Server (TLS) id 14.1.225.8; Thu, 16 Dec 2010 10:23:14 +0000 Received: from az33smr02.freescale.net (az33smr02.freescale.net [10.64.34.200]) by de01egw02.freescale.net (8.14.3/8.14.3) with ESMTP id oBGANDIk000598; Thu, 16 Dec 2010 03:23:13 -0700 (MST) Received: from localhost.localdomain (r64343-desktop.ap.freescale.net [10.192.242.36]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id oBGAN4cb015989; Thu, 16 Dec 2010 04:23:11 -0600 (CST) From: Jason Liu To: Date: Thu, 16 Dec 2010 18:17:44 +0800 Message-ID: <1292494665-25674-5-git-send-email-r64343@freescale.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1292494665-25674-1-git-send-email-r64343@freescale.com> References: <1292494665-25674-1-git-send-email-r64343@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com Subject: [U-Boot] [PATCH 4/5] mxc_i2c: add support for MX53 processor X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This patch add I2C support for Freescale MX53 processor Signed-off-by: Jason Liu --- drivers/i2c/mxc_i2c.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) mode change 100644 => 100755 drivers/i2c/mxc_i2c.c diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c old mode 100644 new mode 100755 index 8e10fbb..f9f32cc --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -24,10 +24,11 @@ #include -#if defined(CONFIG_HARD_I2C) +#if defined(CONFIG_MX53) +#include +#endif -#include -#include +#if defined(CONFIG_HARD_I2C) #define IADR 0x00 #define IFDR 0x04 @@ -56,8 +57,10 @@ #elif defined (CONFIG_SYS_I2C_MX31_PORT3) #define I2C_BASE 0x43f84000 #define I2C_CLK_OFFSET 30 +#elif defined(CONFIG_SYS_I2C_PORT) +#define I2C_BASE CONFIG_SYS_I2C_PORT #else -#error "define CONFIG_SYS_I2C_MX31_PORTx to use the mx31 I2C driver" +#error "define CONFIG_SYS_I2C_PORT to use the I2C driver" #endif #ifdef DEBUG @@ -72,11 +75,16 @@ static u16 div[] = { 30, 32, 36, 42, 48, 52, 60, 72, 80, 88, 104, 128, 144, void i2c_init(int speed, int unused) { - int freq = mx31_get_ipg_clk(); + int freq; int i; +#ifdef CONFIG_MX31 + freq = mx31_get_ipg_clk(); /* start the required I2C clock */ __REG(CCM_CGR0) = __REG(CCM_CGR0) | (3 << I2C_CLK_OFFSET); +#else + freq = mxc_get_clock(MXC_IPG_PERCLK); +#endif for (i = 0; i < 0x1f; i++) if (freq / div[i] <= speed)