[U-Boot,RESEND,v3,07/19] am335x: Register the I2C controllers if DM_I2C is used.

Message ID 1544190655-4405-8-git-send-email-jjhiblot@ti.com
State Awaiting Upstream
Delegated to: Heiko Schocher
Headers show
Series
  • DM_I2C_COMPAT removal for all ti platforms
Related show

Commit Message

Jean-Jacques Hiblot Dec. 7, 2018, 1:50 p.m.
If DM_I2C is used , the I2C controllers must be registered as U_BOOT_DEVICE
because OF_CONTROL is not used in the SPL.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
---

Changes in v3: None
Changes in v2: None

 arch/arm/mach-omap2/am33xx/board.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Tom Rini Dec. 7, 2018, 2:19 p.m. | #1
On Fri, Dec 07, 2018 at 02:50:43PM +0100, Jean-Jacques Hiblot wrote:

> If DM_I2C is used , the I2C controllers must be registered as U_BOOT_DEVICE
> because OF_CONTROL is not used in the SPL.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
Heiko Schocher Dec. 10, 2018, 5:11 a.m. | #2
Hello Jean-Jacques,

Am 07.12.2018 um 14:50 schrieb Jean-Jacques Hiblot:
> If DM_I2C is used , the I2C controllers must be registered as U_BOOT_DEVICE
> because OF_CONTROL is not used in the SPL.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>   arch/arm/mach-omap2/am33xx/board.c | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)

Thanks for resending!

Reviewed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko Schocher

Patch

diff --git a/arch/arm/mach-omap2/am33xx/board.c b/arch/arm/mach-omap2/am33xx/board.c
index f5f2bd5..c121f27 100644
--- a/arch/arm/mach-omap2/am33xx/board.c
+++ b/arch/arm/mach-omap2/am33xx/board.c
@@ -19,6 +19,7 @@ 
 #include <asm/arch/ddr_defs.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/gpio.h>
+#include <asm/arch/i2c.h>
 #include <asm/arch/mem.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/sys_proto.h>
@@ -93,6 +94,20 @@  U_BOOT_DEVICES(am33xx_uarts) = {
 #  endif
 };
 
+#ifdef CONFIG_DM_I2C
+static const struct omap_i2c_platdata am33xx_i2c[] = {
+	{ I2C_BASE1, 100000, OMAP_I2C_REV_V2},
+	{ I2C_BASE2, 100000, OMAP_I2C_REV_V2},
+	{ I2C_BASE3, 100000, OMAP_I2C_REV_V2},
+};
+
+U_BOOT_DEVICES(am33xx_i2c) = {
+	{ "i2c_omap", &am33xx_i2c[0] },
+	{ "i2c_omap", &am33xx_i2c[1] },
+	{ "i2c_omap", &am33xx_i2c[2] },
+};
+#endif
+
 #ifdef CONFIG_DM_GPIO
 static const struct omap_gpio_platdata am33xx_gpio[] = {
 	{ 0, AM33XX_GPIO0_BASE },