]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
I2C: add i2c support for Pantheon platform
authorLei Wen <[leiwen@marvell.com]>
Wed, 13 Apr 2011 18:18:34 +0000 (23:48 +0530)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Wed, 27 Apr 2011 17:38:08 +0000 (19:38 +0200)
Add i2c support to dkb board with pantheon soc.

Acked-by: Heiko Schocher <hs@denx.de>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>
Signed-off-by: Lei Wen <leiwen@marvell.com>
arch/arm/cpu/arm926ejs/pantheon/cpu.c
arch/arm/include/asm/arch-pantheon/config.h
arch/arm/include/asm/arch-pantheon/cpu.h
arch/arm/include/asm/arch-pantheon/mfp.h
board/Marvell/dkb/dkb.c
include/configs/dkb.h

index 9ddc77c0718c4ffb489f87e82a13ed0894a94ffb..8b2eafa40b466dc5f058643ce4a9cd1a09644911 100644 (file)
@@ -59,6 +59,12 @@ int arch_cpu_init(void)
        /* Enable GPIO clock */
        writel(APBC_APBCLK, &apbclkres->gpio);
 
+#ifdef CONFIG_I2C_MV
+       /* Enable I2C clock */
+       writel(APBC_RST | APBC_FNCLK | APBC_APBCLK, &apbclkres->twsi);
+       writel(APBC_FNCLK | APBC_APBCLK, &apbclkres->twsi);
+#endif
+
        icache_enable();
 
        return 0;
@@ -76,3 +82,9 @@ int print_cpuinfo(void)
        return 0;
 }
 #endif
+
+#ifdef CONFIG_I2C_MV
+void i2c_clk_enable(void)
+{
+}
+#endif
index 710b3862ca3cb434a07a79ca301c31d5a72cb4af..5658592f838f5cf3421dc24edabe7e4bfa947f7a 100644 (file)
 #define MV_UART_CONSOLE_BASE   PANTHEON_UART1_BASE
 #define CONFIG_SYS_NS16550_IER (1 << 6)        /* Bit 6 in UART_IER register
                                                represents UART Unit Enable */
+/*
+ * I2C definition
+ */
+#ifdef CONFIG_CMD_I2C
+#define CONFIG_I2C_MV                  1
+#define CONFIG_MV_I2C_REG              0xd4011000
+#define CONFIG_HARD_I2C                        1
+#define CONFIG_SYS_I2C_SPEED           0
+#define CONFIG_SYS_I2C_SLAVE           0xfe
+#endif
 
 #endif /* _PANTHEON_CONFIG_H */
index 30f4393050caad893bf341056751843f900e06be..60955c5a55eae50e70b7e885a2c61fd65f90d1e7 100644 (file)
@@ -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*/
 };
 
index fb291cf5543951d0b197e89ea49cab34690234e9..e9391961b17cb64a3a10becf9b8fcad50a8e9212 100644 (file)
  * offset, pull,pF, drv,dF, edge,eF ,afn,aF
  */
 /* 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 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... */
 
index 72a2d2a985039d0fb34dd9fdd30870272c9a0eaf..00f73e79f79e3b17f7e6ed356bbde6ae43abc86c 100644 (file)
@@ -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 */
index 638af5e33e1ab51c800f27860f0596b9c278b4a1..b400d0acf9cb5b26f36a8c8fd67694e30340da52 100644 (file)
@@ -47,6 +47,7 @@
 #define CONFIG_SYS_NO_FLASH            /* Declare no flash (NOR/SPI) */
 #include <config_cmd_default.h>
 #define CONFIG_CMD_AUTOSCRIPT
+#define CONFIG_CMD_I2C
 #undef CONFIG_CMD_NET
 #undef CONFIG_CMD_NFS
 /*
@@ -56,6 +57,7 @@
 #include "mv-common.h"
 
 #undef CONFIG_ARCH_MISC_INIT
+
 /*
  * Environment variables configurations
  */