[U-Boot] [PATCH v2 6/6] arm:trats: add support for new I2C framework
Piotr Wilczek
p.wilczek at samsung.com
Tue Nov 20 13:19:07 CET 2012
This enables new i2c framework on Trats board.
Hardware s3c24x0 i2c driver is used instead of software i2c.
Signed-off-by: Piotr Wilczek <p.wilczek at samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
CC: Minkyu Kang <mk7.kang at samsung.com>
---
Changes for v2:
- hardware i2c outputs configuration moved to i2c_init_board(void) function
- used define instead of fix number on i2c_set_bus_num();
- keep soft_i2c_adap[0]
- changed i2c related names to s3c24x0 driver specfic:
CONFIG_MAX_I2C_NUM -> CONFIG_SYS_I2C_S3C24X0_MAX_NUM
CONFIG_DRIVER_S3C24X0_I2C -> CONFIG_SYS_I2C_S3C24X0
CONFIG_SYS_I2C_SPEED/SLAVE -> CONFIG_SYS_I2C_S3C24X0_SPEED/SLAVE
- removed CONFIG_SYS_I2C_BUSSES
---
board/samsung/trats/trats.c | 17 +++++++++++++----
include/configs/trats.h | 35 +++++++++++++++++++----------------
2 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index e11a892..393a910 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -24,8 +24,10 @@
*/
#include <common.h>
+#include <i2c.h>
#include <lcd.h>
#include <asm/io.h>
+#include <asm/arch/pinmux.h>
#include <asm/arch/cpu.h>
#include <asm/arch/gpio.h>
#include <asm/arch/mmc.h>
@@ -77,14 +79,17 @@ int board_init(void)
void i2c_init_board(void)
{
- struct exynos4_gpio_part1 *gpio1 =
- (struct exynos4_gpio_part1 *)samsung_get_base_gpio_part1();
+ int err;
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);
+ err = exynos_pinmux_config(I2C_5, PINMUX_FLAG_NONE);
+ if (err) {
+ debug("I2C%d not configured\n", (I2C_5));
+ return;
+ }
+
/* I2C_9 -> FG */
s5p_gpio_direction_output(&gpio2->y4, 0, 1);
s5p_gpio_direction_output(&gpio2->y4, 1, 1);
@@ -415,6 +420,8 @@ static int lcd_power(void)
int ret = 0;
struct pmic *p = get_pmic();
+ i2c_set_bus_num(CONFIG_SYS_I2C_PMIC_BUS_NUM);
+
if (pmic_probe(p))
return 0;
@@ -475,6 +482,8 @@ static int mipi_power(void)
int ret = 0;
struct pmic *p = get_pmic();
+ i2c_set_bus_num(CONFIG_SYS_I2C_PMIC_BUS_NUM);
+
if (pmic_probe(p))
return 0;
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 106fd37..1083e9b 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -33,6 +33,7 @@
#define CONFIG_SAMSUNG /* in a SAMSUNG core */
#define CONFIG_S5P /* which is in a S5P Family */
#define CONFIG_EXYNOS4210 /* which is in a EXYNOS4210 */
+#define CONFIG_EXYNOS4
#define CONFIG_TRATS /* working with TRATS */
#define CONFIG_TIZEN /* TIZEN lib */
@@ -211,31 +212,33 @@
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR - GENERATED_GBL_DATA_SIZE)
#define CONFIG_SYS_CACHELINE_SIZE 32
-
#define CONFIG_SYS_I2C
#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */
#define CONFIG_SYS_I2C_SOFT_SPEED 50000
#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE
-#define CONFIG_SYS_I2C_ADAPTERS {&soft_i2c_adap[0]}
#define CONFIG_SOFT_I2C_READ_REPEATED_START
#define CONFIG_SYS_I2C_INIT_BOARD
-#define CONFIG_I2C_MULTI_BUS
-#define CONFIG_SOFT_I2C_MULTI_BUS
-#define CONFIG_SYS_MAX_I2C_BUS 15
-
-#include <asm/arch/gpio.h>
-/* I2C PMIC */
-#define CONFIG_SOFT_I2C_I2C5_SCL exynos4_gpio_part1_get_nr(b, 7)
-#define CONFIG_SOFT_I2C_I2C5_SDA exynos4_gpio_part1_get_nr(b, 6)
+#define CONFIG_SYS_I2C_S3C24X0
+#define CONFIG_SYS_I2C_S3C24X0_MAX_NUM 8
+#define CONFIG_SYS_I2C_S3C24X0_SPEED 100000
+#define CONFIG_SYS_I2C_S3C24X0_SLAVE 0x0
+#define CONFIG_CMD_I2C
+
+#define CONFIG_SYS_I2C_ADAPTERS {&soft_i2c_adap[0], \
+ &s3c24x0_i2c_adap[5], \
+ }
+#define CONFIG_SYS_NUM_I2C_ADAPTERS 2
+#define CONFIG_SYS_I2C_BUSSES {{0, {{{0, "SOFT"}, 0x00, 0} } }, \
+ {1, {{{0, "S3C24X0"}, 0x00, 5} } }, \
+ }
+#define CONFIG_SYS_NUM_I2C_BUSSES 2
+#define CONFIG_SYS_I2C_PMIC_BUS_NUM 1
-/* I2C FG */
-#define CONFIG_SOFT_I2C_I2C9_SCL exynos4_gpio_part2_get_nr(y4, 1)
-#define CONFIG_SOFT_I2C_I2C9_SDA exynos4_gpio_part2_get_nr(y4, 0)
+#include <asm/arch/gpio.h>
-#define CONFIG_SOFT_I2C_GPIO_SCL get_multi_scl_pin()
-#define CONFIG_SOFT_I2C_GPIO_SDA get_multi_sda_pin()
-#define I2C_INIT multi_i2c_init()
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part2_get_nr(y4, 1)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part2_get_nr(y4, 0)
#define CONFIG_PMIC
#define CONFIG_PMIC_I2C
--
1.7.5.4
More information about the U-Boot
mailing list