From mboxrd@z Thu Jan 1 00:00:00 1970 From: Piotr Wilczek Date: Mon, 22 Oct 2012 09:21:23 +0200 Subject: [U-Boot] [PATCH v2 9/9] arm:trats: Use Multi-I2C on Trarts board In-Reply-To: <1350890483-26579-1-git-send-email-p.wilczek@samsung.com> References: <1350890483-26579-1-git-send-email-p.wilczek@samsung.com> Message-ID: <1350890483-26579-10-git-send-email-p.wilczek@samsung.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This patch use bot hardware and software I2C on Samsung Trats board Signed-off-by: Piotr Wilczek Signed-off-by: Kyungmin Park CC: Minkyu Kang --- Changes in v2: - new patch board/samsung/trats/trats.c | 35 +++++++++++++++++++++++++++++++++-- include/configs/trats.h | 9 ++++++++- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c index afbe4b3..b51d214 100644 --- a/board/samsung/trats/trats.c +++ b/board/samsung/trats/trats.c @@ -24,6 +24,7 @@ */ #include +#include #include #include #include @@ -65,6 +66,24 @@ static int hwrevision(int rev) struct s3c_plat_otg_data s5pc210_otg_data; +#ifdef CONFIG_SYS_I2C_INIT_BOARD +static int board_i2c_init(void) +{ + int i, err; + + for (i = 0; i < CONFIG_MAX_I2C_NUM; i++) { + err = exynos_pinmux_config((PERIPH_ID_I2C0 + i), + PINMUX_FLAG_NONE); + if (err) { + debug("I2C%d not configured\n", (PERIPH_ID_I2C0 + i)); + return err; + } + } + i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + return 0; +} +#endif + int board_init(void) { gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; @@ -72,19 +91,27 @@ int board_init(void) check_hw_revision(); printf("HW Revision:\t0x%x\n", board_rev); +#ifdef CONFIG_SYS_I2C_INIT_BOARD + board_i2c_init(); +#endif + return 0; } void i2c_init_board(void) { +#ifndef CONFIG_MULTI_I2C struct exynos4_gpio_part1 *gpio1 = (struct exynos4_gpio_part1 *)samsung_get_base_gpio_part1(); - struct exynos4_gpio_part2 *gpio2 = - (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2(); /* I2C_5 -> PMIC */ s5p_gpio_direction_output(&gpio1->b, 7, 1); s5p_gpio_direction_output(&gpio1->b, 6, 1); +#endif + + struct exynos4_gpio_part2 *gpio2 = + (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2(); + /* I2C_9 -> FG */ s5p_gpio_direction_output(&gpio2->y4, 0, 1); s5p_gpio_direction_output(&gpio2->y4, 1, 1); @@ -588,6 +615,10 @@ int board_early_init_f(void) board_uart_init(); board_power_init(); +#ifdef CONFIG_SYS_I2C_INIT_BOARD + board_i2c_init(); +#endif + return 0; } diff --git a/include/configs/trats.h b/include/configs/trats.h index 268a97b..b56fc0d 100644 --- a/include/configs/trats.h +++ b/include/configs/trats.h @@ -32,6 +32,7 @@ */ #define CONFIG_SAMSUNG /* in a SAMSUNG core */ #define CONFIG_S5P /* which is in a S5P Family */ +#define CONFIG_EXYNOS4 /* which is in a EXYNOS4XXX */ #define CONFIG_EXYNOS4210 /* which is in a EXYNOS4210 */ #define CONFIG_TRATS /* working with TRATS */ #define CONFIG_TIZEN /* TIZEN lib */ @@ -216,7 +217,6 @@ #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR - GENERATED_GBL_DATA_SIZE) #define CONFIG_SYS_CACHELINE_SIZE 32 - #define CONFIG_SOFT_I2C #define CONFIG_SOFT_I2C_READ_REPEATED_START #define CONFIG_SYS_I2C_INIT_BOARD @@ -225,6 +225,13 @@ #define CONFIG_SOFT_I2C_MULTI_BUS #define CONFIG_SYS_MAX_I2C_BUS 15 +#define CONFIG_MULTI_I2C +#define CONFIG_HARD_I2C +#define CONFIG_DRIVER_S3C24X0_I2C +#define CONFIG_MAX_I2C_NUM 7 +#define CONFIG_SYS_I2C_SLAVE 0x0 +#define CONFIG_CMD_I2C + #include /* I2C PMIC */ -- 1.7.5.4