* [U-Boot] [PATCH] i2c:samsung: Adjust Trats, GONI and Universal_c210 boards to work with new I2C framework
@ 2013-08-16 13:33 Lukasz Majewski
2013-08-20 9:22 ` Heiko Schocher
0 siblings, 1 reply; 2+ messages in thread
From: Lukasz Majewski @ 2013-08-16 13:33 UTC (permalink / raw)
To: u-boot
New I2C framework, introduced after v2013.07 final release, imposed I2C
code adjustment for some Samsung boards - namely Trats, GONI and Universal_c210.
Those boards were using schematic based I2C enumeration (I2C_5, I2C_9).
However, new I2C framework imposes usage of logical I2C adapters numbering
(e.g. I2C_0, I2C_1, etc).
Additionally, I2C_GET_* macros were replaced with i2c_*_bus_num() functions.
Trats board gained definition of second soft I2C adapter.
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Heiko Schocher <hs@denx.de>
---
board/samsung/common/multi_i2c.c | 14 ++++++--------
board/samsung/goni/goni.c | 6 +++++-
board/samsung/trats/trats.c | 17 ++++++++++++-----
board/samsung/universal_c210/universal.c | 4 ++++
include/configs/trats.h | 3 +++
5 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/board/samsung/common/multi_i2c.c b/board/samsung/common/multi_i2c.c
index 4fce987..084858d 100644
--- a/board/samsung/common/multi_i2c.c
+++ b/board/samsung/common/multi_i2c.c
@@ -11,13 +11,12 @@
/* Handle multiple I2C buses instances */
int get_multi_scl_pin(void)
{
- unsigned int bus = I2C_GET_BUS();
+ unsigned int bus = i2c_get_bus_num();
switch (bus) {
- case I2C_0: /* I2C_0 definition - compatibility layer */
- case I2C_5:
+ case I2C_0:
return CONFIG_SOFT_I2C_I2C5_SCL;
- case I2C_9:
+ case I2C_1:
return CONFIG_SOFT_I2C_I2C9_SCL;
default:
printf("I2C_%d not supported!\n", bus);
@@ -28,13 +27,12 @@ int get_multi_scl_pin(void)
int get_multi_sda_pin(void)
{
- unsigned int bus = I2C_GET_BUS();
+ unsigned int bus = i2c_get_bus_num();
switch (bus) {
- case I2C_0: /* I2C_0 definition - compatibility layer */
- case I2C_5:
+ case I2C_0:
return CONFIG_SOFT_I2C_I2C5_SDA;
- case I2C_9:
+ case I2C_1:
return CONFIG_SOFT_I2C_I2C9_SDA;
default:
printf("I2C_%d not supported!\n", bus);
diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index c05801d..5b3d6ef 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -32,7 +32,11 @@ int power_init_board(void)
{
int ret;
- ret = pmic_init(I2C_5);
+ /*
+ * For PMIC the I2C bus is named as I2C5, but it is connected
+ * to logical I2C adapter 0
+ */
+ ret = pmic_init(I2C_0);
if (ret)
return ret;
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index c8698f3..7f61d17 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -61,10 +61,10 @@ void i2c_init_board(void)
struct exynos4_gpio_part2 *gpio2 =
(struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
- /* I2C_5 -> PMIC */
+ /* I2C_5 -> PMIC -> Adapter 0 */
s5p_gpio_direction_output(&gpio1->b, 7, 1);
s5p_gpio_direction_output(&gpio1->b, 6, 1);
- /* I2C_9 -> FG */
+ /* I2C_9 -> FG -> Adapter 1 */
s5p_gpio_direction_output(&gpio2->y4, 0, 1);
s5p_gpio_direction_output(&gpio2->y4, 1, 1);
}
@@ -282,10 +282,17 @@ int power_init_board(void)
struct power_battery *pb;
struct pmic *p_fg, *p_chrg, *p_muic, *p_bat;
- ret = pmic_init(I2C_5);
+ /*
+ * For PMIC/MUIC the I2C bus is named as I2C5, but it is connected
+ * to logical I2C adapter 0
+ *
+ * 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_max8997();
- ret |= power_fg_init(I2C_9);
- ret |= power_muic_init(I2C_5);
+ ret |= power_fg_init(I2C_1);
+ ret |= power_muic_init(I2C_0);
ret |= power_bat_init(0);
if (ret)
return ret;
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 2e1dba6..54d0e1e 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -45,6 +45,10 @@ int power_init_board(void)
{
int ret;
+ /*
+ * For PMIC the I2C bus is named as I2C5, but it is connected
+ * to logical I2C adapter 0
+ */
ret = pmic_init(I2C_5);
if (ret)
return ret;
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 9b6aac9..24ea06b 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -263,6 +263,9 @@
#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */
#define CONFIG_SYS_I2C_SOFT_SPEED 50000
#define CONFIG_SYS_I2C_SOFT_SLAVE 0xFE
+#define I2C_SOFT_DECLARATIONS2
+#define CONFIG_SYS_I2C_SOFT_SPEED_2 50000
+#define CONFIG_SYS_I2C_SOFT_SLAVE_2 0x7F
#define CONFIG_SOFT_I2C_READ_REPEATED_START
#define CONFIG_SYS_I2C_INIT_BOARD
#define CONFIG_I2C_MULTI_BUS
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] i2c:samsung: Adjust Trats, GONI and Universal_c210 boards to work with new I2C framework
2013-08-16 13:33 [U-Boot] [PATCH] i2c:samsung: Adjust Trats, GONI and Universal_c210 boards to work with new I2C framework Lukasz Majewski
@ 2013-08-20 9:22 ` Heiko Schocher
0 siblings, 0 replies; 2+ messages in thread
From: Heiko Schocher @ 2013-08-20 9:22 UTC (permalink / raw)
To: u-boot
Hello Lukasz,
Am 16.08.2013 15:33, schrieb Lukasz Majewski:
> New I2C framework, introduced after v2013.07 final release, imposed I2C
> code adjustment for some Samsung boards - namely Trats, GONI and Universal_c210.
>
> Those boards were using schematic based I2C enumeration (I2C_5, I2C_9).
> However, new I2C framework imposes usage of logical I2C adapters numbering
> (e.g. I2C_0, I2C_1, etc).
>
> Additionally, I2C_GET_* macros were replaced with i2c_*_bus_num() functions.
>
> Trats board gained definition of second soft I2C adapter.
>
> Signed-off-by: Lukasz Majewski<l.majewski@samsung.com>
> Cc: Minkyu Kang<mk7.kang@samsung.com>
> Cc: Heiko Schocher<hs@denx.de>
> ---
> board/samsung/common/multi_i2c.c | 14 ++++++--------
> board/samsung/goni/goni.c | 6 +++++-
> board/samsung/trats/trats.c | 17 ++++++++++++-----
> board/samsung/universal_c210/universal.c | 4 ++++
> include/configs/trats.h | 3 +++
> 5 files changed, 30 insertions(+), 14 deletions(-)
Applied to u-boot-i2c.git, thanks.
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-20 9:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-16 13:33 [U-Boot] [PATCH] i2c:samsung: Adjust Trats, GONI and Universal_c210 boards to work with new I2C framework Lukasz Majewski
2013-08-20 9:22 ` Heiko Schocher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox