summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorPiotr Wilczek <p.wilczek@samsung.com>2013-11-20 10:43:49 +0100
committerHeiko Schocher <hs@denx.de>2013-12-05 07:39:38 +0100
commit2d8f1e27695a8a9a3ed863a510be58284b6b411c (patch)
tree77002d27c29a3f1c93de096742b615d1aadb930d /board
parentf44483b57c49282299da0e5c10073b909cdad979 (diff)
downloadu-boot-imx-2d8f1e27695a8a9a3ed863a510be58284b6b411c.zip
u-boot-imx-2d8f1e27695a8a9a3ed863a510be58284b6b411c.tar.gz
u-boot-imx-2d8f1e27695a8a9a3ed863a510be58284b6b411c.tar.bz2
driver:i2c:s3c24x0: adapt driver to new i2c
This patch adapts the s3c24x0 driver to the new i2c framework. Config file is modified for all the boards that use the driver. Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> CC: Minkyu Kang <mk7.kang@samsung.com> CC: Heiko Schocher <hs@denx.de> CC: Inderpal Singh <inderpal.singh@linaro.org> CC: David Müller <d.mueller@elsoft.ch> CC: Chander Kashyap <k.chander@samsung.com> CC: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Reviewed-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Diffstat (limited to 'board')
-rw-r--r--board/samsung/smdk5250/exynos5-dt.c2
-rw-r--r--board/samsung/trats/trats.c21
-rw-r--r--board/samsung/trats2/trats2.c35
3 files changed, 41 insertions, 17 deletions
diff --git a/board/samsung/smdk5250/exynos5-dt.c b/board/samsung/smdk5250/exynos5-dt.c
index 6bcc883..6aa0509 100644
--- a/board/samsung/smdk5250/exynos5-dt.c
+++ b/board/samsung/smdk5250/exynos5-dt.c
@@ -150,8 +150,6 @@ int power_init_board(void)
set_ps_hold_ctrl();
- i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-
if (pmic_init(I2C_PMIC))
return -1;
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 7012c13..44be5fc 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -57,15 +57,18 @@ 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 -> Adapter 0 */
- s5p_gpio_direction_output(&gpio1->b, 7, 1);
- s5p_gpio_direction_output(&gpio1->b, 6, 1);
- /* I2C_9 -> FG -> Adapter 1 */
+ /* I2C_5 -> PMIC */
+ err = exynos_pinmux_config(PERIPH_ID_I2C5, PINMUX_FLAG_NONE);
+ if (err) {
+ debug("I2C%d not configured\n", (I2C_5));
+ return;
+ }
+
+ /* I2C_8 -> FG */
s5p_gpio_direction_output(&gpio2->y4, 0, 1);
s5p_gpio_direction_output(&gpio2->y4, 1, 1);
}
@@ -290,10 +293,10 @@ int power_init_board(void)
* The FUEL_GAUGE is marked as I2C9 on the schematic, but connected
* to logical I2C adapter 1
*/
- ret = pmic_init(I2C_0);
+ ret = pmic_init(I2C_5);
ret |= pmic_init_max8997();
- ret |= power_fg_init(I2C_1);
- ret |= power_muic_init(I2C_0);
+ ret |= power_fg_init(I2C_8);
+ ret |= power_muic_init(I2C_5);
ret |= power_bat_init(0);
if (ret)
return ret;
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index d44d825..8df85ee 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -115,12 +115,17 @@ static void board_external_gpio_init(void)
#ifdef CONFIG_SYS_I2C_INIT_BOARD
static void board_init_i2c(void)
{
+ int err;
+
gpio1 = (struct exynos4x12_gpio_part1 *)EXYNOS4X12_GPIO_PART1_BASE;
gpio2 = (struct exynos4x12_gpio_part2 *)EXYNOS4X12_GPIO_PART2_BASE;
/* I2C_7 */
- s5p_gpio_direction_output(&gpio1->d0, 2, 1);
- s5p_gpio_direction_output(&gpio1->d0, 3, 1);
+ err = exynos_pinmux_config(PERIPH_ID_I2C7, PINMUX_FLAG_NONE);
+ if (err) {
+ debug("I2C%d not configured\n", (I2C_7));
+ return;
+ }
/* I2C_8 */
s5p_gpio_direction_output(&gpio1->f1, 4, 1);
@@ -132,6 +137,24 @@ static void board_init_i2c(void)
}
#endif
+#ifdef CONFIG_SYS_I2C_SOFT
+int get_soft_i2c_scl_pin(void)
+{
+ if (I2C_ADAP_HWNR)
+ return exynos4x12_gpio_part2_get_nr(m2, 1); /* I2C9 */
+ else
+ return exynos4x12_gpio_part1_get_nr(f1, 4); /* I2C8 */
+}
+
+int get_soft_i2c_sda_pin(void)
+{
+ if (I2C_ADAP_HWNR)
+ return exynos4x12_gpio_part2_get_nr(m2, 0); /* I2C9 */
+ else
+ return exynos4x12_gpio_part1_get_nr(f1, 5); /* I2C8 */
+}
+#endif
+
int board_early_init_f(void)
{
check_hw_revision();
@@ -167,11 +190,11 @@ int power_init_board(void)
#ifdef CONFIG_SYS_I2C_INIT_BOARD
board_init_i2c();
#endif
- pmic_init(I2C_0); /* I2C adapter 0 - bus name I2C_5 */
+ pmic_init(I2C_7); /* I2C adapter 7 - bus name s3c24x0_7 */
pmic_init_max77686();
- pmic_init_max77693(I2C_2); /* I2C adapter 2 - bus name I2C_10 */
- power_muic_init(I2C_2); /* I2C adapter 2 - bus name I2C_10 */
- power_fg_init(I2C_1); /* I2C adapter 1 - bus name I2C_9 */
+ pmic_init_max77693(I2C_9); /* I2C adapter 9 - bus name soft1 */
+ power_muic_init(I2C_9); /* I2C adapter 9 - bus name soft1 */
+ power_fg_init(I2C_8); /* I2C adapter 8 - bus name soft0 */
power_bat_init(0);
p_chrg = pmic_get("MAX77693_PMIC");