From patchwork Mon Mar 14 10:16:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Wen X-Patchwork-Id: 86712 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 36F99B6F7B for ; Mon, 14 Mar 2011 21:16:37 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F41F2813E; Mon, 14 Mar 2011 11:16:32 +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 I2Dh94LIIMbu; Mon, 14 Mar 2011 11:16:31 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6E6572812C; Mon, 14 Mar 2011 11:16:25 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 14C462812C for ; Mon, 14 Mar 2011 11:16: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 eB1Demmzrgv1 for ; Mon, 14 Mar 2011 11:16:21 +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 dakia2.marvell.com (dakia2.marvell.com [65.219.4.35]) by theia.denx.de (Postfix) with ESMTPS id 4581F28129 for ; Mon, 14 Mar 2011 11:16:21 +0100 (CET) X-ASG-Debug-ID: 1300097779-082e97a60001-4l7tJC Received: from maili.marvell.com (maili.marvell.com [10.68.76.51]) by dakia2.marvell.com with ESMTP id pi6jbYxrwO5SYe1d; Mon, 14 Mar 2011 03:16:19 -0700 (PDT) X-Barracuda-Envelope-From: leiwen@marvell.com Received: from localhost (unknown [10.38.164.123]) by maili.marvell.com (Postfix) with ESMTP id 65ACD8A07D; Mon, 14 Mar 2011 03:16:19 -0700 (PDT) From: Lei Wen To: "u-boot@lists.denx.de" , Marek Vasut , Prafulla Wadaskar , Lei Wen X-ASG-Orig-Subj: [PATCH 3/8] I2C: add i2c support for Pantheon platform Date: Mon, 14 Mar 2011 03:16:13 -0700 X-ASG-Orig-Subj: [PATCH 3/8] I2C: add i2c support for Pantheon platform Message-Id: <1300097775-15602-3-git-send-email-leiwen@marvell.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1300097775-15602-1-git-send-email-leiwen@marvell.com> References: <1300097775-15602-1-git-send-email-leiwen@marvell.com> X-Barracuda-Connect: maili.marvell.com[10.68.76.51] X-Barracuda-Start-Time: 1300097779 X-Barracuda-URL: http://10.68.76.222:80/cgi-mod/mark.cgi X-Barracuda-Spam-Score: -1002.00 X-Barracuda-Spam-Status: No, SCORE=-1002.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=1000.0 Subject: [U-Boot] [PATCH 3/8] I2C: add i2c support for Pantheon platform 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Add i2c support to dkb board with pantheon soc. Signed-off-by: Lei Wen --- arch/arm/cpu/arm926ejs/pantheon/cpu.c | 10 ++++++++++ arch/arm/include/asm/arch-pantheon/cpu.h | 4 +++- arch/arm/include/asm/arch-pantheon/mfp.h | 2 ++ board/Marvell/dkb/dkb.c | 4 ++++ include/configs/dkb.h | 11 +++++++++++ 5 files changed, 30 insertions(+), 1 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/pantheon/cpu.c b/arch/arm/cpu/arm926ejs/pantheon/cpu.c index 9ddc77c..88ecfae 100644 --- a/arch/arm/cpu/arm926ejs/pantheon/cpu.c +++ b/arch/arm/cpu/arm926ejs/pantheon/cpu.c @@ -59,6 +59,10 @@ int arch_cpu_init(void) /* Enable GPIO clock */ writel(APBC_APBCLK, &apbclkres->gpio); + /* Enable I2C clock */ + writel(APBC_RST | APBC_FNCLK | APBC_APBCLK, &apbclkres->twsi); + writel(APBC_FNCLK | APBC_APBCLK, &apbclkres->twsi); + icache_enable(); return 0; @@ -76,3 +80,9 @@ int print_cpuinfo(void) return 0; } #endif + +#ifdef CONFIG_PXA_I2C +void i2c_clk_enable (void) +{ +} +#endif diff --git a/arch/arm/include/asm/arch-pantheon/cpu.h b/arch/arm/include/asm/arch-pantheon/cpu.h index 30f4393..60955c5 100644 --- a/arch/arm/include/asm/arch-pantheon/cpu.h +++ b/arch/arm/include/asm/arch-pantheon/cpu.h @@ -50,7 +50,9 @@ struct panthapb_registers { u32 uart0; /*0x000*/ u32 uart1; /*0x004*/ u32 gpio; /*0x008*/ - u8 pad0[0x034 - 0x08 - 4]; + u8 pad0[0x02c - 0x08 - 4]; + u32 twsi; /*0x02c*/ + u8 pad1[0x034 - 0x2c - 4]; u32 timers; /*0x034*/ }; diff --git a/arch/arm/include/asm/arch-pantheon/mfp.h b/arch/arm/include/asm/arch-pantheon/mfp.h index fb291cf..041e64c 100644 --- a/arch/arm/include/asm/arch-pantheon/mfp.h +++ b/arch/arm/include/asm/arch-pantheon/mfp.h @@ -34,6 +34,8 @@ /* UART2 */ #define MFP47_UART2_RXD MFP_REG(0x198) | MFP_AF6 | MFP_DRIVE_MEDIUM #define MFP48_UART2_TXD MFP_REG(0x19c) | MFP_AF6 | MFP_DRIVE_MEDIUM +#define MFP53_CI2C_SCL MFP_REG(0x1b0) | MFP_AF2 | MFP_DRIVE_MEDIUM +#define MFP54_CI2C_SDA MFP_REG(0x1b4) | MFP_AF2 | MFP_DRIVE_MEDIUM /* More macros can be defined here... */ diff --git a/board/Marvell/dkb/dkb.c b/board/Marvell/dkb/dkb.c index 72a2d2a..00f73e7 100644 --- a/board/Marvell/dkb/dkb.c +++ b/board/Marvell/dkb/dkb.c @@ -36,6 +36,10 @@ int board_early_init_f(void) MFP47_UART2_RXD, MFP48_UART2_TXD, + /* I2C */ + MFP53_CI2C_SCL, + MFP54_CI2C_SDA, + MFP_EOC /*End of configureation*/ }; /* configure MFP's */ diff --git a/include/configs/dkb.h b/include/configs/dkb.h index 638af5e..75c4b99 100644 --- a/include/configs/dkb.h +++ b/include/configs/dkb.h @@ -56,6 +56,17 @@ #include "mv-common.h" #undef CONFIG_ARCH_MISC_INIT + +/* + * I2C definition + */ +#define CONFIG_CMD_I2C +#define CONFIG_PXA_I2C 1 +#define CONFIG_PXA_I2C_REG 0xd4011000 +#define CONFIG_HARD_I2C 1 +#define CONFIG_SYS_I2C_SPEED 0 +#define CONFIG_SYS_I2C_SLAVE 0xfe + /* * Environment variables configurations */