All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5
@ 2017-04-26 22:03 Jernej Skrabec
  2017-04-26 22:03 ` [U-Boot] [PATCH 1/4] sunxi: power: Compile sy8106a driver only during SPL build Jernej Skrabec
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Jernej Skrabec @ 2017-04-26 22:03 UTC (permalink / raw)
  To: u-boot

This series implements DM I2C support, but allows old I2C to be selected
when needed.

Patch 1 makes sure that sy8106a driver is compiled only during SPL build.

Patch 2 moves i2c_init_board() function to more convenient place for
follow up patch. It doens't do any functional change.

Patch 3 introduces DM I2C support for sun6i-a31 compatible I2C
controllers.

Patch 4 enables DM I2C only for A64/H3/H5. Other platforms would easily
support DM I2C too, but their PMIC drivers needs to be ported to DM in
order not to lose any existing functionality.

Best regards,
Jernej Skrabec


Jernej Skrabec (4):
  sunxi: power: Compile sy8106a driver only during SPL build
  sunxi: Move function for later convenience
  sunxi: i2c: Add support for DM I2C
  sunxi: Enable DM_I2C for A64/H3/H5

 arch/arm/mach-sunxi/board.c    |   2 +
 board/sunxi/Kconfig            |   2 +
 board/sunxi/board.c            | 196 +++++++++++++++++++++--------------------
 drivers/i2c/mvtwsi.c           |   9 ++
 drivers/power/sy8106a.c        |   2 +
 include/configs/sunxi-common.h |   4 +-
 6 files changed, 120 insertions(+), 95 deletions(-)

-- 
2.12.2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/4] sunxi: power: Compile sy8106a driver only during SPL build
  2017-04-26 22:03 [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5 Jernej Skrabec
@ 2017-04-26 22:03 ` Jernej Skrabec
  2017-04-28  3:42   ` Heiko Schocher
  2017-04-26 22:03 ` [U-Boot] [PATCH 2/4] sunxi: Move function for later convenience Jernej Skrabec
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Jernej Skrabec @ 2017-04-26 22:03 UTC (permalink / raw)
  To: u-boot

Driver for that regulator is used only in SPL and it uses old I2C
interface. If we want to use DM I2C in U-Boot proper, compilation of
this driver has to be limited only to SPL.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---

 drivers/power/sy8106a.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/power/sy8106a.c b/drivers/power/sy8106a.c
index bbf116f655..f9db3965f2 100644
--- a/drivers/power/sy8106a.c
+++ b/drivers/power/sy8106a.c
@@ -12,6 +12,7 @@
 #define SY8106A_VOUT1_SEL 1
 #define SY8106A_VOUT1_SEL_ENABLE (1 << 7)
 
+#ifdef CONFIG_SPL_BUILD
 static u8 sy8106a_mvolt_to_cfg(int mvolt, int min, int max, int div)
 {
 	if (mvolt < min)
@@ -27,3 +28,4 @@ int sy8106a_set_vout1(unsigned int mvolt)
 	u8 data = sy8106a_mvolt_to_cfg(mvolt, 680, 1950, 10) | SY8106A_VOUT1_SEL_ENABLE;
 	return i2c_write(SY8106A_I2C_ADDR, SY8106A_VOUT1_SEL, 1, &data, 1);
 }
+#endif
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 2/4] sunxi: Move function for later convenience
  2017-04-26 22:03 [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5 Jernej Skrabec
  2017-04-26 22:03 ` [U-Boot] [PATCH 1/4] sunxi: power: Compile sy8106a driver only during SPL build Jernej Skrabec
@ 2017-04-26 22:03 ` Jernej Skrabec
  2017-04-28  3:43   ` Heiko Schocher
  2017-04-26 22:03 ` [U-Boot] [PATCH 3/4] sunxi: i2c: Add support for DM I2C Jernej Skrabec
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Jernej Skrabec @ 2017-04-26 22:03 UTC (permalink / raw)
  To: u-boot

This commit only moves i2c_init_board() function almost to the top and
doesn't have any functional changes.

This is needed for a temporary workaround in next commit when support
for DM I2C will be introduced.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---

 board/sunxi/board.c | 188 ++++++++++++++++++++++++++--------------------------
 1 file changed, 94 insertions(+), 94 deletions(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 04a629125e..f903a5d0a0 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -77,6 +77,100 @@ static int soft_i2c_board_init(void) { return 0; }
 
 DECLARE_GLOBAL_DATA_PTR;
 
+void i2c_init_board(void)
+{
+#ifdef CONFIG_I2C0_ENABLE
+#if defined(CONFIG_MACH_SUN4I) || \
+    defined(CONFIG_MACH_SUN5I) || \
+    defined(CONFIG_MACH_SUN7I) || \
+    defined(CONFIG_MACH_SUN8I_R40)
+	sunxi_gpio_set_cfgpin(SUNXI_GPB(0), SUN4I_GPB_TWI0);
+	sunxi_gpio_set_cfgpin(SUNXI_GPB(1), SUN4I_GPB_TWI0);
+	clock_twi_onoff(0, 1);
+#elif defined(CONFIG_MACH_SUN6I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(14), SUN6I_GPH_TWI0);
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(15), SUN6I_GPH_TWI0);
+	clock_twi_onoff(0, 1);
+#elif defined(CONFIG_MACH_SUN8I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(2), SUN8I_GPH_TWI0);
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(3), SUN8I_GPH_TWI0);
+	clock_twi_onoff(0, 1);
+#endif
+#endif
+
+#ifdef CONFIG_I2C1_ENABLE
+#if defined(CONFIG_MACH_SUN4I) || \
+    defined(CONFIG_MACH_SUN7I) || \
+    defined(CONFIG_MACH_SUN8I_R40)
+	sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN4I_GPB_TWI1);
+	sunxi_gpio_set_cfgpin(SUNXI_GPB(19), SUN4I_GPB_TWI1);
+	clock_twi_onoff(1, 1);
+#elif defined(CONFIG_MACH_SUN5I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPB(15), SUN5I_GPB_TWI1);
+	sunxi_gpio_set_cfgpin(SUNXI_GPB(16), SUN5I_GPB_TWI1);
+	clock_twi_onoff(1, 1);
+#elif defined(CONFIG_MACH_SUN6I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(16), SUN6I_GPH_TWI1);
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(17), SUN6I_GPH_TWI1);
+	clock_twi_onoff(1, 1);
+#elif defined(CONFIG_MACH_SUN8I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(4), SUN8I_GPH_TWI1);
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(5), SUN8I_GPH_TWI1);
+	clock_twi_onoff(1, 1);
+#endif
+#endif
+
+#ifdef CONFIG_I2C2_ENABLE
+#if defined(CONFIG_MACH_SUN4I) || \
+    defined(CONFIG_MACH_SUN7I) || \
+    defined(CONFIG_MACH_SUN8I_R40)
+	sunxi_gpio_set_cfgpin(SUNXI_GPB(20), SUN4I_GPB_TWI2);
+	sunxi_gpio_set_cfgpin(SUNXI_GPB(21), SUN4I_GPB_TWI2);
+	clock_twi_onoff(2, 1);
+#elif defined(CONFIG_MACH_SUN5I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPB(17), SUN5I_GPB_TWI2);
+	sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN5I_GPB_TWI2);
+	clock_twi_onoff(2, 1);
+#elif defined(CONFIG_MACH_SUN6I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(18), SUN6I_GPH_TWI2);
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(19), SUN6I_GPH_TWI2);
+	clock_twi_onoff(2, 1);
+#elif defined(CONFIG_MACH_SUN8I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPE(12), SUN8I_GPE_TWI2);
+	sunxi_gpio_set_cfgpin(SUNXI_GPE(13), SUN8I_GPE_TWI2);
+	clock_twi_onoff(2, 1);
+#endif
+#endif
+
+#ifdef CONFIG_I2C3_ENABLE
+#if defined(CONFIG_MACH_SUN6I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPG(10), SUN6I_GPG_TWI3);
+	sunxi_gpio_set_cfgpin(SUNXI_GPG(11), SUN6I_GPG_TWI3);
+	clock_twi_onoff(3, 1);
+#elif defined(CONFIG_MACH_SUN7I) || \
+      defined(CONFIG_MACH_SUN8I_R40)
+	sunxi_gpio_set_cfgpin(SUNXI_GPI(0), SUN7I_GPI_TWI3);
+	sunxi_gpio_set_cfgpin(SUNXI_GPI(1), SUN7I_GPI_TWI3);
+	clock_twi_onoff(3, 1);
+#endif
+#endif
+
+#ifdef CONFIG_I2C4_ENABLE
+#if defined(CONFIG_MACH_SUN7I) || \
+    defined(CONFIG_MACH_SUN8I_R40)
+	sunxi_gpio_set_cfgpin(SUNXI_GPI(2), SUN7I_GPI_TWI4);
+	sunxi_gpio_set_cfgpin(SUNXI_GPI(3), SUN7I_GPI_TWI4);
+	clock_twi_onoff(4, 1);
+#endif
+#endif
+
+#ifdef CONFIG_R_I2C_ENABLE
+	clock_twi_onoff(5, 1);
+	sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_H3_GPL_R_TWI);
+	sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_H3_GPL_R_TWI);
+#endif
+}
+
 /* add board specific code here */
 int board_init(void)
 {
@@ -406,100 +500,6 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
-void i2c_init_board(void)
-{
-#ifdef CONFIG_I2C0_ENABLE
-#if defined(CONFIG_MACH_SUN4I) || \
-    defined(CONFIG_MACH_SUN5I) || \
-    defined(CONFIG_MACH_SUN7I) || \
-    defined(CONFIG_MACH_SUN8I_R40)
-	sunxi_gpio_set_cfgpin(SUNXI_GPB(0), SUN4I_GPB_TWI0);
-	sunxi_gpio_set_cfgpin(SUNXI_GPB(1), SUN4I_GPB_TWI0);
-	clock_twi_onoff(0, 1);
-#elif defined(CONFIG_MACH_SUN6I)
-	sunxi_gpio_set_cfgpin(SUNXI_GPH(14), SUN6I_GPH_TWI0);
-	sunxi_gpio_set_cfgpin(SUNXI_GPH(15), SUN6I_GPH_TWI0);
-	clock_twi_onoff(0, 1);
-#elif defined(CONFIG_MACH_SUN8I)
-	sunxi_gpio_set_cfgpin(SUNXI_GPH(2), SUN8I_GPH_TWI0);
-	sunxi_gpio_set_cfgpin(SUNXI_GPH(3), SUN8I_GPH_TWI0);
-	clock_twi_onoff(0, 1);
-#endif
-#endif
-
-#ifdef CONFIG_I2C1_ENABLE
-#if defined(CONFIG_MACH_SUN4I) || \
-    defined(CONFIG_MACH_SUN7I) || \
-    defined(CONFIG_MACH_SUN8I_R40)
-	sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN4I_GPB_TWI1);
-	sunxi_gpio_set_cfgpin(SUNXI_GPB(19), SUN4I_GPB_TWI1);
-	clock_twi_onoff(1, 1);
-#elif defined(CONFIG_MACH_SUN5I)
-	sunxi_gpio_set_cfgpin(SUNXI_GPB(15), SUN5I_GPB_TWI1);
-	sunxi_gpio_set_cfgpin(SUNXI_GPB(16), SUN5I_GPB_TWI1);
-	clock_twi_onoff(1, 1);
-#elif defined(CONFIG_MACH_SUN6I)
-	sunxi_gpio_set_cfgpin(SUNXI_GPH(16), SUN6I_GPH_TWI1);
-	sunxi_gpio_set_cfgpin(SUNXI_GPH(17), SUN6I_GPH_TWI1);
-	clock_twi_onoff(1, 1);
-#elif defined(CONFIG_MACH_SUN8I)
-	sunxi_gpio_set_cfgpin(SUNXI_GPH(4), SUN8I_GPH_TWI1);
-	sunxi_gpio_set_cfgpin(SUNXI_GPH(5), SUN8I_GPH_TWI1);
-	clock_twi_onoff(1, 1);
-#endif
-#endif
-
-#ifdef CONFIG_I2C2_ENABLE
-#if defined(CONFIG_MACH_SUN4I) || \
-    defined(CONFIG_MACH_SUN7I) || \
-    defined(CONFIG_MACH_SUN8I_R40)
-	sunxi_gpio_set_cfgpin(SUNXI_GPB(20), SUN4I_GPB_TWI2);
-	sunxi_gpio_set_cfgpin(SUNXI_GPB(21), SUN4I_GPB_TWI2);
-	clock_twi_onoff(2, 1);
-#elif defined(CONFIG_MACH_SUN5I)
-	sunxi_gpio_set_cfgpin(SUNXI_GPB(17), SUN5I_GPB_TWI2);
-	sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN5I_GPB_TWI2);
-	clock_twi_onoff(2, 1);
-#elif defined(CONFIG_MACH_SUN6I)
-	sunxi_gpio_set_cfgpin(SUNXI_GPH(18), SUN6I_GPH_TWI2);
-	sunxi_gpio_set_cfgpin(SUNXI_GPH(19), SUN6I_GPH_TWI2);
-	clock_twi_onoff(2, 1);
-#elif defined(CONFIG_MACH_SUN8I)
-	sunxi_gpio_set_cfgpin(SUNXI_GPE(12), SUN8I_GPE_TWI2);
-	sunxi_gpio_set_cfgpin(SUNXI_GPE(13), SUN8I_GPE_TWI2);
-	clock_twi_onoff(2, 1);
-#endif
-#endif
-
-#ifdef CONFIG_I2C3_ENABLE
-#if defined(CONFIG_MACH_SUN6I)
-	sunxi_gpio_set_cfgpin(SUNXI_GPG(10), SUN6I_GPG_TWI3);
-	sunxi_gpio_set_cfgpin(SUNXI_GPG(11), SUN6I_GPG_TWI3);
-	clock_twi_onoff(3, 1);
-#elif defined(CONFIG_MACH_SUN7I) || \
-      defined(CONFIG_MACH_SUN8I_R40)
-	sunxi_gpio_set_cfgpin(SUNXI_GPI(0), SUN7I_GPI_TWI3);
-	sunxi_gpio_set_cfgpin(SUNXI_GPI(1), SUN7I_GPI_TWI3);
-	clock_twi_onoff(3, 1);
-#endif
-#endif
-
-#ifdef CONFIG_I2C4_ENABLE
-#if defined(CONFIG_MACH_SUN7I) || \
-    defined(CONFIG_MACH_SUN8I_R40)
-	sunxi_gpio_set_cfgpin(SUNXI_GPI(2), SUN7I_GPI_TWI4);
-	sunxi_gpio_set_cfgpin(SUNXI_GPI(3), SUN7I_GPI_TWI4);
-	clock_twi_onoff(4, 1);
-#endif
-#endif
-
-#ifdef CONFIG_R_I2C_ENABLE
-	clock_twi_onoff(5, 1);
-	sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_H3_GPL_R_TWI);
-	sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_H3_GPL_R_TWI);
-#endif
-}
-
 #ifdef CONFIG_SPL_BUILD
 void sunxi_board_init(void)
 {
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 3/4] sunxi: i2c: Add support for DM I2C
  2017-04-26 22:03 [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5 Jernej Skrabec
  2017-04-26 22:03 ` [U-Boot] [PATCH 1/4] sunxi: power: Compile sy8106a driver only during SPL build Jernej Skrabec
  2017-04-26 22:03 ` [U-Boot] [PATCH 2/4] sunxi: Move function for later convenience Jernej Skrabec
@ 2017-04-26 22:03 ` Jernej Skrabec
  2017-04-28  3:43   ` Heiko Schocher
  2017-04-29  0:28   ` Simon Glass
  2017-04-26 22:03 ` [U-Boot] [PATCH 4/4] sunxi: Enable DM_I2C for A64/H3/H5 Jernej Skrabec
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 16+ messages in thread
From: Jernej Skrabec @ 2017-04-26 22:03 UTC (permalink / raw)
  To: u-boot

This commit adds support for DM I2C on sunxi platform. It can coexist
with old style sunxi I2C driver, because it is still used in SPL and
by some SoCs.

Because sunxi platform doesn't yet support DM clk, reset and pinctrl
driver, workaround is needed to enable clocks and set resets and
pinctrls. This is done by calling i2c_init_board() in board_init().
This means that CONFIG_I2Cx_ENABLE options needs to be correctly set
in order to use needed I2C controller.

Commit is based on the previous patch made by Philipp Tomsich

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---

 arch/arm/mach-sunxi/board.c    | 2 ++
 board/sunxi/board.c            | 8 ++++++++
 drivers/i2c/mvtwsi.c           | 9 +++++++++
 include/configs/sunxi-common.h | 4 +++-
 4 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 4507279cc5..65b1ebd837 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -204,7 +204,9 @@ void s_init(void)
 	clock_init();
 	timer_init();
 	gpio_init();
+#ifndef CONFIG_DM_I2C
 	i2c_init_board();
+#endif
 	eth_init_board();
 }
 
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index f903a5d0a0..01de42d031 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -222,6 +222,14 @@ int board_init(void)
 	gpio_direction_output(macpwr_pin, 1);
 #endif
 
+#ifdef CONFIG_DM_I2C
+	/*
+	 * Temporary workaround for enabling I2C clocks until proper sunxi DM
+	 * clk, reset and pinctrl drivers land.
+	 */
+	i2c_init_board();
+#endif
+
 	/* Uses dm gpio code so do this here and not in i2c_init_board() */
 	return soft_i2c_board_init();
 }
diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
index 648a96eeb4..3703519aa5 100644
--- a/drivers/i2c/mvtwsi.c
+++ b/drivers/i2c/mvtwsi.c
@@ -37,6 +37,14 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif /* CONFIG_DM_I2C */
 
 /*
+ * On SUNXI, we get CONFIG_SYS_TCLK from this include, so we want to
+ * always have it.
+ */
+#if defined(CONFIG_DM_I2C) && defined(CONFIG_ARCH_SUNXI)
+#include <asm/arch/i2c.h>
+#endif
+
+/*
  * TWSI register structure
  */
 
@@ -831,6 +839,7 @@ static const struct dm_i2c_ops mvtwsi_i2c_ops = {
 static const struct udevice_id mvtwsi_i2c_ids[] = {
 	{ .compatible = "marvell,mv64xxx-i2c", },
 	{ .compatible = "marvell,mv78230-i2c", },
+	{ .compatible = "allwinner,sun6i-a31-i2c", },
 	{ /* sentinel */ }
 };
 
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index a56b45fa2f..997a92c8be 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -211,11 +211,13 @@
 #if defined CONFIG_I2C0_ENABLE || defined CONFIG_I2C1_ENABLE || \
     defined CONFIG_I2C2_ENABLE || defined CONFIG_I2C3_ENABLE || \
     defined CONFIG_I2C4_ENABLE || defined CONFIG_R_I2C_ENABLE
-#define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_MVTWSI
+#ifndef CONFIG_DM_I2C
+#define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SPEED		400000
 #define CONFIG_SYS_I2C_SLAVE		0x7f
 #endif
+#endif
 
 #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
 #define CONFIG_SYS_I2C_SOFT
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 4/4] sunxi: Enable DM_I2C for A64/H3/H5
  2017-04-26 22:03 [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5 Jernej Skrabec
                   ` (2 preceding siblings ...)
  2017-04-26 22:03 ` [U-Boot] [PATCH 3/4] sunxi: i2c: Add support for DM I2C Jernej Skrabec
@ 2017-04-26 22:03 ` Jernej Skrabec
  2017-04-28  3:44   ` Heiko Schocher
  2017-04-27  7:44 ` [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support " Maxime Ripard
  2017-04-28  3:46 ` Heiko Schocher
  5 siblings, 1 reply; 16+ messages in thread
From: Jernej Skrabec @ 2017-04-26 22:03 UTC (permalink / raw)
  To: u-boot

This commits enable DM I2C support for A64/H3/H5 SoCs.

It is not enabled globaly for all sunxi SoCs, because some boards use
PMICs which are connected through I2C. In order to keep same
functionality, PMIC drivers needs to be ported to DM too.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---

 board/sunxi/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 196d8fce08..707e656ea6 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -58,6 +58,7 @@ config SUNXI_GEN_SUN6I
 
 config MACH_SUNXI_H3_H5
 	bool
+	select DM_I2C
 	select SUNXI_DE2
 	select SUNXI_GEN_SUN6I
 	select SUPPORT_SPL
@@ -163,6 +164,7 @@ config MACH_SUN9I
 config MACH_SUN50I
 	bool "sun50i (Allwinner A64)"
 	select ARM64
+	select DM_I2C
 	select SUNXI_DE2
 	select SUNXI_GEN_SUN6I
 	select SUNXI_HIGH_SRAM
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5
  2017-04-26 22:03 [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5 Jernej Skrabec
                   ` (3 preceding siblings ...)
  2017-04-26 22:03 ` [U-Boot] [PATCH 4/4] sunxi: Enable DM_I2C for A64/H3/H5 Jernej Skrabec
@ 2017-04-27  7:44 ` Maxime Ripard
  2017-04-28  3:46 ` Heiko Schocher
  5 siblings, 0 replies; 16+ messages in thread
From: Maxime Ripard @ 2017-04-27  7:44 UTC (permalink / raw)
  To: u-boot

Hi,

On Thu, Apr 27, 2017 at 12:03:33AM +0200, Jernej Skrabec wrote:
> This series implements DM I2C support, but allows old I2C to be selected
> when needed.
> 
> Patch 1 makes sure that sy8106a driver is compiled only during SPL build.
> 
> Patch 2 moves i2c_init_board() function to more convenient place for
> follow up patch. It doens't do any functional change.
> 
> Patch 3 introduces DM I2C support for sun6i-a31 compatible I2C
> controllers.
> 
> Patch 4 enables DM I2C only for A64/H3/H5. Other platforms would easily
> support DM I2C too, but their PMIC drivers needs to be ported to DM in
> order not to lose any existing functionality.

All your patches look good to me, you can add my
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170427/625590a7/attachment.sig>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 1/4] sunxi: power: Compile sy8106a driver only during SPL build
  2017-04-26 22:03 ` [U-Boot] [PATCH 1/4] sunxi: power: Compile sy8106a driver only during SPL build Jernej Skrabec
@ 2017-04-28  3:42   ` Heiko Schocher
  0 siblings, 0 replies; 16+ messages in thread
From: Heiko Schocher @ 2017-04-28  3:42 UTC (permalink / raw)
  To: u-boot

Hello Jernej,

Am 27.04.2017 um 00:03 schrieb Jernej Skrabec:
> Driver for that regulator is used only in SPL and it uses old I2C
> interface. If we want to use DM I2C in U-Boot proper, compilation of
> this driver has to be limited only to SPL.
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> ---
>
>   drivers/power/sy8106a.c | 2 ++
>   1 file changed, 2 insertions(+)

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

bye,
Heiko
>
> diff --git a/drivers/power/sy8106a.c b/drivers/power/sy8106a.c
> index bbf116f655..f9db3965f2 100644
> --- a/drivers/power/sy8106a.c
> +++ b/drivers/power/sy8106a.c
> @@ -12,6 +12,7 @@
>   #define SY8106A_VOUT1_SEL 1
>   #define SY8106A_VOUT1_SEL_ENABLE (1 << 7)
>
> +#ifdef CONFIG_SPL_BUILD
>   static u8 sy8106a_mvolt_to_cfg(int mvolt, int min, int max, int div)
>   {
>   	if (mvolt < min)
> @@ -27,3 +28,4 @@ int sy8106a_set_vout1(unsigned int mvolt)
>   	u8 data = sy8106a_mvolt_to_cfg(mvolt, 680, 1950, 10) | SY8106A_VOUT1_SEL_ENABLE;
>   	return i2c_write(SY8106A_I2C_ADDR, SY8106A_VOUT1_SEL, 1, &data, 1);
>   }
> +#endif
>

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 2/4] sunxi: Move function for later convenience
  2017-04-26 22:03 ` [U-Boot] [PATCH 2/4] sunxi: Move function for later convenience Jernej Skrabec
@ 2017-04-28  3:43   ` Heiko Schocher
  0 siblings, 0 replies; 16+ messages in thread
From: Heiko Schocher @ 2017-04-28  3:43 UTC (permalink / raw)
  To: u-boot

Hello Jernej,

Am 27.04.2017 um 00:03 schrieb Jernej Skrabec:
> This commit only moves i2c_init_board() function almost to the top and
> doesn't have any functional changes.
>
> This is needed for a temporary workaround in next commit when support
> for DM I2C will be introduced.
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> ---
>
>   board/sunxi/board.c | 188 ++++++++++++++++++++++++++--------------------------
>   1 file changed, 94 insertions(+), 94 deletions(-)

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

bye,
Heiko
>
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 04a629125e..f903a5d0a0 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -77,6 +77,100 @@ static int soft_i2c_board_init(void) { return 0; }
>
>   DECLARE_GLOBAL_DATA_PTR;
>
> +void i2c_init_board(void)
> +{
> +#ifdef CONFIG_I2C0_ENABLE
> +#if defined(CONFIG_MACH_SUN4I) || \
> +    defined(CONFIG_MACH_SUN5I) || \
> +    defined(CONFIG_MACH_SUN7I) || \
> +    defined(CONFIG_MACH_SUN8I_R40)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPB(0), SUN4I_GPB_TWI0);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPB(1), SUN4I_GPB_TWI0);
> +	clock_twi_onoff(0, 1);
> +#elif defined(CONFIG_MACH_SUN6I)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPH(14), SUN6I_GPH_TWI0);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPH(15), SUN6I_GPH_TWI0);
> +	clock_twi_onoff(0, 1);
> +#elif defined(CONFIG_MACH_SUN8I)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPH(2), SUN8I_GPH_TWI0);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPH(3), SUN8I_GPH_TWI0);
> +	clock_twi_onoff(0, 1);
> +#endif
> +#endif
> +
> +#ifdef CONFIG_I2C1_ENABLE
> +#if defined(CONFIG_MACH_SUN4I) || \
> +    defined(CONFIG_MACH_SUN7I) || \
> +    defined(CONFIG_MACH_SUN8I_R40)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN4I_GPB_TWI1);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPB(19), SUN4I_GPB_TWI1);
> +	clock_twi_onoff(1, 1);
> +#elif defined(CONFIG_MACH_SUN5I)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPB(15), SUN5I_GPB_TWI1);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPB(16), SUN5I_GPB_TWI1);
> +	clock_twi_onoff(1, 1);
> +#elif defined(CONFIG_MACH_SUN6I)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPH(16), SUN6I_GPH_TWI1);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPH(17), SUN6I_GPH_TWI1);
> +	clock_twi_onoff(1, 1);
> +#elif defined(CONFIG_MACH_SUN8I)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPH(4), SUN8I_GPH_TWI1);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPH(5), SUN8I_GPH_TWI1);
> +	clock_twi_onoff(1, 1);
> +#endif
> +#endif
> +
> +#ifdef CONFIG_I2C2_ENABLE
> +#if defined(CONFIG_MACH_SUN4I) || \
> +    defined(CONFIG_MACH_SUN7I) || \
> +    defined(CONFIG_MACH_SUN8I_R40)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPB(20), SUN4I_GPB_TWI2);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPB(21), SUN4I_GPB_TWI2);
> +	clock_twi_onoff(2, 1);
> +#elif defined(CONFIG_MACH_SUN5I)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPB(17), SUN5I_GPB_TWI2);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN5I_GPB_TWI2);
> +	clock_twi_onoff(2, 1);
> +#elif defined(CONFIG_MACH_SUN6I)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPH(18), SUN6I_GPH_TWI2);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPH(19), SUN6I_GPH_TWI2);
> +	clock_twi_onoff(2, 1);
> +#elif defined(CONFIG_MACH_SUN8I)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPE(12), SUN8I_GPE_TWI2);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPE(13), SUN8I_GPE_TWI2);
> +	clock_twi_onoff(2, 1);
> +#endif
> +#endif
> +
> +#ifdef CONFIG_I2C3_ENABLE
> +#if defined(CONFIG_MACH_SUN6I)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPG(10), SUN6I_GPG_TWI3);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPG(11), SUN6I_GPG_TWI3);
> +	clock_twi_onoff(3, 1);
> +#elif defined(CONFIG_MACH_SUN7I) || \
> +      defined(CONFIG_MACH_SUN8I_R40)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPI(0), SUN7I_GPI_TWI3);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPI(1), SUN7I_GPI_TWI3);
> +	clock_twi_onoff(3, 1);
> +#endif
> +#endif
> +
> +#ifdef CONFIG_I2C4_ENABLE
> +#if defined(CONFIG_MACH_SUN7I) || \
> +    defined(CONFIG_MACH_SUN8I_R40)
> +	sunxi_gpio_set_cfgpin(SUNXI_GPI(2), SUN7I_GPI_TWI4);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPI(3), SUN7I_GPI_TWI4);
> +	clock_twi_onoff(4, 1);
> +#endif
> +#endif
> +
> +#ifdef CONFIG_R_I2C_ENABLE
> +	clock_twi_onoff(5, 1);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_H3_GPL_R_TWI);
> +	sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_H3_GPL_R_TWI);
> +#endif
> +}
> +
>   /* add board specific code here */
>   int board_init(void)
>   {
> @@ -406,100 +500,6 @@ int board_mmc_init(bd_t *bis)
>   }
>   #endif
>
> -void i2c_init_board(void)
> -{
> -#ifdef CONFIG_I2C0_ENABLE
> -#if defined(CONFIG_MACH_SUN4I) || \
> -    defined(CONFIG_MACH_SUN5I) || \
> -    defined(CONFIG_MACH_SUN7I) || \
> -    defined(CONFIG_MACH_SUN8I_R40)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPB(0), SUN4I_GPB_TWI0);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPB(1), SUN4I_GPB_TWI0);
> -	clock_twi_onoff(0, 1);
> -#elif defined(CONFIG_MACH_SUN6I)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPH(14), SUN6I_GPH_TWI0);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPH(15), SUN6I_GPH_TWI0);
> -	clock_twi_onoff(0, 1);
> -#elif defined(CONFIG_MACH_SUN8I)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPH(2), SUN8I_GPH_TWI0);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPH(3), SUN8I_GPH_TWI0);
> -	clock_twi_onoff(0, 1);
> -#endif
> -#endif
> -
> -#ifdef CONFIG_I2C1_ENABLE
> -#if defined(CONFIG_MACH_SUN4I) || \
> -    defined(CONFIG_MACH_SUN7I) || \
> -    defined(CONFIG_MACH_SUN8I_R40)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN4I_GPB_TWI1);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPB(19), SUN4I_GPB_TWI1);
> -	clock_twi_onoff(1, 1);
> -#elif defined(CONFIG_MACH_SUN5I)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPB(15), SUN5I_GPB_TWI1);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPB(16), SUN5I_GPB_TWI1);
> -	clock_twi_onoff(1, 1);
> -#elif defined(CONFIG_MACH_SUN6I)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPH(16), SUN6I_GPH_TWI1);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPH(17), SUN6I_GPH_TWI1);
> -	clock_twi_onoff(1, 1);
> -#elif defined(CONFIG_MACH_SUN8I)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPH(4), SUN8I_GPH_TWI1);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPH(5), SUN8I_GPH_TWI1);
> -	clock_twi_onoff(1, 1);
> -#endif
> -#endif
> -
> -#ifdef CONFIG_I2C2_ENABLE
> -#if defined(CONFIG_MACH_SUN4I) || \
> -    defined(CONFIG_MACH_SUN7I) || \
> -    defined(CONFIG_MACH_SUN8I_R40)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPB(20), SUN4I_GPB_TWI2);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPB(21), SUN4I_GPB_TWI2);
> -	clock_twi_onoff(2, 1);
> -#elif defined(CONFIG_MACH_SUN5I)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPB(17), SUN5I_GPB_TWI2);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN5I_GPB_TWI2);
> -	clock_twi_onoff(2, 1);
> -#elif defined(CONFIG_MACH_SUN6I)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPH(18), SUN6I_GPH_TWI2);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPH(19), SUN6I_GPH_TWI2);
> -	clock_twi_onoff(2, 1);
> -#elif defined(CONFIG_MACH_SUN8I)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPE(12), SUN8I_GPE_TWI2);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPE(13), SUN8I_GPE_TWI2);
> -	clock_twi_onoff(2, 1);
> -#endif
> -#endif
> -
> -#ifdef CONFIG_I2C3_ENABLE
> -#if defined(CONFIG_MACH_SUN6I)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPG(10), SUN6I_GPG_TWI3);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPG(11), SUN6I_GPG_TWI3);
> -	clock_twi_onoff(3, 1);
> -#elif defined(CONFIG_MACH_SUN7I) || \
> -      defined(CONFIG_MACH_SUN8I_R40)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPI(0), SUN7I_GPI_TWI3);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPI(1), SUN7I_GPI_TWI3);
> -	clock_twi_onoff(3, 1);
> -#endif
> -#endif
> -
> -#ifdef CONFIG_I2C4_ENABLE
> -#if defined(CONFIG_MACH_SUN7I) || \
> -    defined(CONFIG_MACH_SUN8I_R40)
> -	sunxi_gpio_set_cfgpin(SUNXI_GPI(2), SUN7I_GPI_TWI4);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPI(3), SUN7I_GPI_TWI4);
> -	clock_twi_onoff(4, 1);
> -#endif
> -#endif
> -
> -#ifdef CONFIG_R_I2C_ENABLE
> -	clock_twi_onoff(5, 1);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_H3_GPL_R_TWI);
> -	sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_H3_GPL_R_TWI);
> -#endif
> -}
> -
>   #ifdef CONFIG_SPL_BUILD
>   void sunxi_board_init(void)
>   {
>

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 3/4] sunxi: i2c: Add support for DM I2C
  2017-04-26 22:03 ` [U-Boot] [PATCH 3/4] sunxi: i2c: Add support for DM I2C Jernej Skrabec
@ 2017-04-28  3:43   ` Heiko Schocher
  2017-04-29  0:28   ` Simon Glass
  1 sibling, 0 replies; 16+ messages in thread
From: Heiko Schocher @ 2017-04-28  3:43 UTC (permalink / raw)
  To: u-boot

Hello Jernej,

Am 27.04.2017 um 00:03 schrieb Jernej Skrabec:
> This commit adds support for DM I2C on sunxi platform. It can coexist
> with old style sunxi I2C driver, because it is still used in SPL and
> by some SoCs.
>
> Because sunxi platform doesn't yet support DM clk, reset and pinctrl
> driver, workaround is needed to enable clocks and set resets and
> pinctrls. This is done by calling i2c_init_board() in board_init().
> This means that CONFIG_I2Cx_ENABLE options needs to be correctly set
> in order to use needed I2C controller.
>
> Commit is based on the previous patch made by Philipp Tomsich
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> ---
>
>   arch/arm/mach-sunxi/board.c    | 2 ++
>   board/sunxi/board.c            | 8 ++++++++
>   drivers/i2c/mvtwsi.c           | 9 +++++++++
>   include/configs/sunxi-common.h | 4 +++-
>   4 files changed, 22 insertions(+), 1 deletion(-)

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

bye,
Heiko
>
> diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
> index 4507279cc5..65b1ebd837 100644
> --- a/arch/arm/mach-sunxi/board.c
> +++ b/arch/arm/mach-sunxi/board.c
> @@ -204,7 +204,9 @@ void s_init(void)
>   	clock_init();
>   	timer_init();
>   	gpio_init();
> +#ifndef CONFIG_DM_I2C
>   	i2c_init_board();
> +#endif
>   	eth_init_board();
>   }
>
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index f903a5d0a0..01de42d031 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -222,6 +222,14 @@ int board_init(void)
>   	gpio_direction_output(macpwr_pin, 1);
>   #endif
>
> +#ifdef CONFIG_DM_I2C
> +	/*
> +	 * Temporary workaround for enabling I2C clocks until proper sunxi DM
> +	 * clk, reset and pinctrl drivers land.
> +	 */
> +	i2c_init_board();
> +#endif
> +
>   	/* Uses dm gpio code so do this here and not in i2c_init_board() */
>   	return soft_i2c_board_init();
>   }
> diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
> index 648a96eeb4..3703519aa5 100644
> --- a/drivers/i2c/mvtwsi.c
> +++ b/drivers/i2c/mvtwsi.c
> @@ -37,6 +37,14 @@ DECLARE_GLOBAL_DATA_PTR;
>   #endif /* CONFIG_DM_I2C */
>
>   /*
> + * On SUNXI, we get CONFIG_SYS_TCLK from this include, so we want to
> + * always have it.
> + */
> +#if defined(CONFIG_DM_I2C) && defined(CONFIG_ARCH_SUNXI)
> +#include <asm/arch/i2c.h>
> +#endif
> +
> +/*
>    * TWSI register structure
>    */
>
> @@ -831,6 +839,7 @@ static const struct dm_i2c_ops mvtwsi_i2c_ops = {
>   static const struct udevice_id mvtwsi_i2c_ids[] = {
>   	{ .compatible = "marvell,mv64xxx-i2c", },
>   	{ .compatible = "marvell,mv78230-i2c", },
> +	{ .compatible = "allwinner,sun6i-a31-i2c", },
>   	{ /* sentinel */ }
>   };
>
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index a56b45fa2f..997a92c8be 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -211,11 +211,13 @@
>   #if defined CONFIG_I2C0_ENABLE || defined CONFIG_I2C1_ENABLE || \
>       defined CONFIG_I2C2_ENABLE || defined CONFIG_I2C3_ENABLE || \
>       defined CONFIG_I2C4_ENABLE || defined CONFIG_R_I2C_ENABLE
> -#define CONFIG_SYS_I2C
>   #define CONFIG_SYS_I2C_MVTWSI
> +#ifndef CONFIG_DM_I2C
> +#define CONFIG_SYS_I2C
>   #define CONFIG_SYS_I2C_SPEED		400000
>   #define CONFIG_SYS_I2C_SLAVE		0x7f
>   #endif
> +#endif
>
>   #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
>   #define CONFIG_SYS_I2C_SOFT
>

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 4/4] sunxi: Enable DM_I2C for A64/H3/H5
  2017-04-26 22:03 ` [U-Boot] [PATCH 4/4] sunxi: Enable DM_I2C for A64/H3/H5 Jernej Skrabec
@ 2017-04-28  3:44   ` Heiko Schocher
  0 siblings, 0 replies; 16+ messages in thread
From: Heiko Schocher @ 2017-04-28  3:44 UTC (permalink / raw)
  To: u-boot

Hello Jernej,

Am 27.04.2017 um 00:03 schrieb Jernej Skrabec:
> This commits enable DM I2C support for A64/H3/H5 SoCs.
>
> It is not enabled globaly for all sunxi SoCs, because some boards use
> PMICs which are connected through I2C. In order to keep same
> functionality, PMIC drivers needs to be ported to DM too.
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> ---
>
>   board/sunxi/Kconfig | 2 ++
>   1 file changed, 2 insertions(+)

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

bye,
Heiko
>
> diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
> index 196d8fce08..707e656ea6 100644
> --- a/board/sunxi/Kconfig
> +++ b/board/sunxi/Kconfig
> @@ -58,6 +58,7 @@ config SUNXI_GEN_SUN6I
>
>   config MACH_SUNXI_H3_H5
>   	bool
> +	select DM_I2C
>   	select SUNXI_DE2
>   	select SUNXI_GEN_SUN6I
>   	select SUPPORT_SPL
> @@ -163,6 +164,7 @@ config MACH_SUN9I
>   config MACH_SUN50I
>   	bool "sun50i (Allwinner A64)"
>   	select ARM64
> +	select DM_I2C
>   	select SUNXI_DE2
>   	select SUNXI_GEN_SUN6I
>   	select SUNXI_HIGH_SRAM
>

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5
  2017-04-26 22:03 [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5 Jernej Skrabec
                   ` (4 preceding siblings ...)
  2017-04-27  7:44 ` [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support " Maxime Ripard
@ 2017-04-28  3:46 ` Heiko Schocher
  2017-04-28  6:44   ` Maxime Ripard
  5 siblings, 1 reply; 16+ messages in thread
From: Heiko Schocher @ 2017-04-28  3:46 UTC (permalink / raw)
  To: u-boot

Hello Jagan,

Am 27.04.2017 um 00:03 schrieb Jernej Skrabec:
> This series implements DM I2C support, but allows old I2C to be selected
> when needed.
>
> Patch 1 makes sure that sy8106a driver is compiled only during SPL build.
>
> Patch 2 moves i2c_init_board() function to more convenient place for
> follow up patch. It doens't do any functional change.
>
> Patch 3 introduces DM I2C support for sun6i-a31 compatible I2C
> controllers.
>
> Patch 4 enables DM I2C only for A64/H3/H5. Other platforms would easily
> support DM I2C too, but their PMIC drivers needs to be ported to DM in
> order not to lose any existing functionality.
>
> Best regards,
> Jernej Skrabec
>
>
> Jernej Skrabec (4):
>    sunxi: power: Compile sy8106a driver only during SPL build
>    sunxi: Move function for later convenience
>    sunxi: i2c: Add support for DM I2C
>    sunxi: Enable DM_I2C for A64/H3/H5
>
>   arch/arm/mach-sunxi/board.c    |   2 +
>   board/sunxi/Kconfig            |   2 +
>   board/sunxi/board.c            | 196 +++++++++++++++++++++--------------------
>   drivers/i2c/mvtwsi.c           |   9 ++
>   drivers/power/sy8106a.c        |   2 +
>   include/configs/sunxi-common.h |   4 +-
>   6 files changed, 120 insertions(+), 95 deletions(-)
>

Do you want to pick up this patchset?

Or should I push it through u-boot-i2c?
If so, please add your Ack or Review tag, thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5
  2017-04-28  3:46 ` Heiko Schocher
@ 2017-04-28  6:44   ` Maxime Ripard
  2017-04-28  6:53     ` Heiko Schocher invitel
  0 siblings, 1 reply; 16+ messages in thread
From: Maxime Ripard @ 2017-04-28  6:44 UTC (permalink / raw)
  To: u-boot

Hello Heiko,

On Fri, Apr 28, 2017 at 05:46:05AM +0200, Heiko Schocher wrote:
> Hello Jagan,
> 
> Am 27.04.2017 um 00:03 schrieb Jernej Skrabec:
> > This series implements DM I2C support, but allows old I2C to be selected
> > when needed.
> > 
> > Patch 1 makes sure that sy8106a driver is compiled only during SPL build.
> > 
> > Patch 2 moves i2c_init_board() function to more convenient place for
> > follow up patch. It doens't do any functional change.
> > 
> > Patch 3 introduces DM I2C support for sun6i-a31 compatible I2C
> > controllers.
> > 
> > Patch 4 enables DM I2C only for A64/H3/H5. Other platforms would easily
> > support DM I2C too, but their PMIC drivers needs to be ported to DM in
> > order not to lose any existing functionality.
> > 
> > Best regards,
> > Jernej Skrabec
> > 
> > 
> > Jernej Skrabec (4):
> >    sunxi: power: Compile sy8106a driver only during SPL build
> >    sunxi: Move function for later convenience
> >    sunxi: i2c: Add support for DM I2C
> >    sunxi: Enable DM_I2C for A64/H3/H5
> > 
> >   arch/arm/mach-sunxi/board.c    |   2 +
> >   board/sunxi/Kconfig            |   2 +
> >   board/sunxi/board.c            | 196 +++++++++++++++++++++--------------------
> >   drivers/i2c/mvtwsi.c           |   9 ++
> >   drivers/power/sy8106a.c        |   2 +
> >   include/configs/sunxi-common.h |   4 +-
> >   6 files changed, 120 insertions(+), 95 deletions(-)
> > 
> 
> Do you want to pick up this patchset?
> 
> Or should I push it through u-boot-i2c?
> If so, please add your Ack or Review tag, thanks!

There's a (build) dependency of this work with the current effort to
bring up HDMI, so I guess it would be easier if we merged it through
the sunxi tree if it works for you.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170428/6015e88d/attachment.sig>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5
  2017-04-28  6:44   ` Maxime Ripard
@ 2017-04-28  6:53     ` Heiko Schocher invitel
  2017-04-28  7:27       ` Maxime Ripard
  0 siblings, 1 reply; 16+ messages in thread
From: Heiko Schocher invitel @ 2017-04-28  6:53 UTC (permalink / raw)
  To: u-boot

Hello Maxime,

Am 28.04.2017 um 08:44 schrieb Maxime Ripard:
> Hello Heiko,
>
> On Fri, Apr 28, 2017 at 05:46:05AM +0200, Heiko Schocher wrote:
>> Hello Jagan,
>>
>> Am 27.04.2017 um 00:03 schrieb Jernej Skrabec:
>>> This series implements DM I2C support, but allows old I2C to be selected
>>> when needed.
>>>
>>> Patch 1 makes sure that sy8106a driver is compiled only during SPL build.
>>>
>>> Patch 2 moves i2c_init_board() function to more convenient place for
>>> follow up patch. It doens't do any functional change.
>>>
>>> Patch 3 introduces DM I2C support for sun6i-a31 compatible I2C
>>> controllers.
>>>
>>> Patch 4 enables DM I2C only for A64/H3/H5. Other platforms would easily
>>> support DM I2C too, but their PMIC drivers needs to be ported to DM in
>>> order not to lose any existing functionality.
>>>
>>> Best regards,
>>> Jernej Skrabec
>>>
>>>
>>> Jernej Skrabec (4):
>>>     sunxi: power: Compile sy8106a driver only during SPL build
>>>     sunxi: Move function for later convenience
>>>     sunxi: i2c: Add support for DM I2C
>>>     sunxi: Enable DM_I2C for A64/H3/H5
>>>
>>>    arch/arm/mach-sunxi/board.c    |   2 +
>>>    board/sunxi/Kconfig            |   2 +
>>>    board/sunxi/board.c            | 196 +++++++++++++++++++++--------------------
>>>    drivers/i2c/mvtwsi.c           |   9 ++
>>>    drivers/power/sy8106a.c        |   2 +
>>>    include/configs/sunxi-common.h |   4 +-
>>>    6 files changed, 120 insertions(+), 95 deletions(-)
>>>
>>
>> Do you want to pick up this patchset?
>>
>> Or should I push it through u-boot-i2c?
>> If so, please add your Ack or Review tag, thanks!
>
> There's a (build) dependency of this work with the current effort to
> bring up HDMI, so I guess it would be easier if we merged it through
> the sunxi tree if it works for you.

Of course. I see this patches in my Patchwork ToDo list. Is it OK
to assign them to jagan?

bye,
Heiko
-- 
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5
  2017-04-28  6:53     ` Heiko Schocher invitel
@ 2017-04-28  7:27       ` Maxime Ripard
  2017-04-28 10:04         ` Heiko Schocher
  0 siblings, 1 reply; 16+ messages in thread
From: Maxime Ripard @ 2017-04-28  7:27 UTC (permalink / raw)
  To: u-boot

On Fri, Apr 28, 2017 at 08:53:50AM +0200, Heiko Schocher invitel wrote:
> Hello Maxime,
> 
> Am 28.04.2017 um 08:44 schrieb Maxime Ripard:
> > Hello Heiko,
> > 
> > On Fri, Apr 28, 2017 at 05:46:05AM +0200, Heiko Schocher wrote:
> > > Hello Jagan,
> > > 
> > > Am 27.04.2017 um 00:03 schrieb Jernej Skrabec:
> > > > This series implements DM I2C support, but allows old I2C to be selected
> > > > when needed.
> > > > 
> > > > Patch 1 makes sure that sy8106a driver is compiled only during SPL build.
> > > > 
> > > > Patch 2 moves i2c_init_board() function to more convenient place for
> > > > follow up patch. It doens't do any functional change.
> > > > 
> > > > Patch 3 introduces DM I2C support for sun6i-a31 compatible I2C
> > > > controllers.
> > > > 
> > > > Patch 4 enables DM I2C only for A64/H3/H5. Other platforms would easily
> > > > support DM I2C too, but their PMIC drivers needs to be ported to DM in
> > > > order not to lose any existing functionality.
> > > > 
> > > > Best regards,
> > > > Jernej Skrabec
> > > > 
> > > > 
> > > > Jernej Skrabec (4):
> > > >     sunxi: power: Compile sy8106a driver only during SPL build
> > > >     sunxi: Move function for later convenience
> > > >     sunxi: i2c: Add support for DM I2C
> > > >     sunxi: Enable DM_I2C for A64/H3/H5
> > > > 
> > > >    arch/arm/mach-sunxi/board.c    |   2 +
> > > >    board/sunxi/Kconfig            |   2 +
> > > >    board/sunxi/board.c            | 196 +++++++++++++++++++++--------------------
> > > >    drivers/i2c/mvtwsi.c           |   9 ++
> > > >    drivers/power/sy8106a.c        |   2 +
> > > >    include/configs/sunxi-common.h |   4 +-
> > > >    6 files changed, 120 insertions(+), 95 deletions(-)
> > > > 
> > > 
> > > Do you want to pick up this patchset?
> > > 
> > > Or should I push it through u-boot-i2c?
> > > If so, please add your Ack or Review tag, thanks!
> > 
> > There's a (build) dependency of this work with the current effort to
> > bring up HDMI, so I guess it would be easier if we merged it through
> > the sunxi tree if it works for you.
> 
> Of course. I see this patches in my Patchwork ToDo list. Is it OK
> to assign them to jagan?

I just applied them and am going through a test build. You can either
assign them to me, or mark them as done.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170428/4604ed3a/attachment.sig>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5
  2017-04-28  7:27       ` Maxime Ripard
@ 2017-04-28 10:04         ` Heiko Schocher
  0 siblings, 0 replies; 16+ messages in thread
From: Heiko Schocher @ 2017-04-28 10:04 UTC (permalink / raw)
  To: u-boot

Hello Maxim,

Am 28.04.2017 um 09:27 schrieb Maxime Ripard:
> On Fri, Apr 28, 2017 at 08:53:50AM +0200, Heiko Schocher invitel wrote:
>> Hello Maxime,
>>
>> Am 28.04.2017 um 08:44 schrieb Maxime Ripard:
>>> Hello Heiko,
>>>
>>> On Fri, Apr 28, 2017 at 05:46:05AM +0200, Heiko Schocher wrote:
>>>> Hello Jagan,
>>>>
>>>> Am 27.04.2017 um 00:03 schrieb Jernej Skrabec:
>>>>> This series implements DM I2C support, but allows old I2C to be selected
>>>>> when needed.
>>>>>
>>>>> Patch 1 makes sure that sy8106a driver is compiled only during SPL build.
>>>>>
>>>>> Patch 2 moves i2c_init_board() function to more convenient place for
>>>>> follow up patch. It doens't do any functional change.
>>>>>
>>>>> Patch 3 introduces DM I2C support for sun6i-a31 compatible I2C
>>>>> controllers.
>>>>>
>>>>> Patch 4 enables DM I2C only for A64/H3/H5. Other platforms would easily
>>>>> support DM I2C too, but their PMIC drivers needs to be ported to DM in
>>>>> order not to lose any existing functionality.
>>>>>
>>>>> Best regards,
>>>>> Jernej Skrabec
>>>>>
>>>>>
>>>>> Jernej Skrabec (4):
>>>>>      sunxi: power: Compile sy8106a driver only during SPL build
>>>>>      sunxi: Move function for later convenience
>>>>>      sunxi: i2c: Add support for DM I2C
>>>>>      sunxi: Enable DM_I2C for A64/H3/H5
>>>>>
>>>>>     arch/arm/mach-sunxi/board.c    |   2 +
>>>>>     board/sunxi/Kconfig            |   2 +
>>>>>     board/sunxi/board.c            | 196 +++++++++++++++++++++--------------------
>>>>>     drivers/i2c/mvtwsi.c           |   9 ++
>>>>>     drivers/power/sy8106a.c        |   2 +
>>>>>     include/configs/sunxi-common.h |   4 +-
>>>>>     6 files changed, 120 insertions(+), 95 deletions(-)
>>>>>
>>>>
>>>> Do you want to pick up this patchset?
>>>>
>>>> Or should I push it through u-boot-i2c?
>>>> If so, please add your Ack or Review tag, thanks!
>>>
>>> There's a (build) dependency of this work with the current effort to
>>> bring up HDMI, so I guess it would be easier if we merged it through
>>> the sunxi tree if it works for you.
>>
>> Of course. I see this patches in my Patchwork ToDo list. Is it OK
>> to assign them to jagan?
>
> I just applied them and am going through a test build. You can either
> assign them to me, or mark them as done.

marked them as accepted.

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH 3/4] sunxi: i2c: Add support for DM I2C
  2017-04-26 22:03 ` [U-Boot] [PATCH 3/4] sunxi: i2c: Add support for DM I2C Jernej Skrabec
  2017-04-28  3:43   ` Heiko Schocher
@ 2017-04-29  0:28   ` Simon Glass
  1 sibling, 0 replies; 16+ messages in thread
From: Simon Glass @ 2017-04-29  0:28 UTC (permalink / raw)
  To: u-boot

On 26 April 2017 at 16:03, Jernej Skrabec <jernej.skrabec@siol.net> wrote:
> This commit adds support for DM I2C on sunxi platform. It can coexist
> with old style sunxi I2C driver, because it is still used in SPL and
> by some SoCs.
>
> Because sunxi platform doesn't yet support DM clk, reset and pinctrl
> driver, workaround is needed to enable clocks and set resets and
> pinctrls. This is done by calling i2c_init_board() in board_init().
> This means that CONFIG_I2Cx_ENABLE options needs to be correctly set
> in order to use needed I2C controller.
>
> Commit is based on the previous patch made by Philipp Tomsich
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> ---
>
>  arch/arm/mach-sunxi/board.c    | 2 ++
>  board/sunxi/board.c            | 8 ++++++++
>  drivers/i2c/mvtwsi.c           | 9 +++++++++
>  include/configs/sunxi-common.h | 4 +++-
>  4 files changed, 22 insertions(+), 1 deletion(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-04-29  0:28 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-26 22:03 [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support for A64/H3/H5 Jernej Skrabec
2017-04-26 22:03 ` [U-Boot] [PATCH 1/4] sunxi: power: Compile sy8106a driver only during SPL build Jernej Skrabec
2017-04-28  3:42   ` Heiko Schocher
2017-04-26 22:03 ` [U-Boot] [PATCH 2/4] sunxi: Move function for later convenience Jernej Skrabec
2017-04-28  3:43   ` Heiko Schocher
2017-04-26 22:03 ` [U-Boot] [PATCH 3/4] sunxi: i2c: Add support for DM I2C Jernej Skrabec
2017-04-28  3:43   ` Heiko Schocher
2017-04-29  0:28   ` Simon Glass
2017-04-26 22:03 ` [U-Boot] [PATCH 4/4] sunxi: Enable DM_I2C for A64/H3/H5 Jernej Skrabec
2017-04-28  3:44   ` Heiko Schocher
2017-04-27  7:44 ` [U-Boot] [PATCH 0/4] sunxi: i2c: Add DM I2C support " Maxime Ripard
2017-04-28  3:46 ` Heiko Schocher
2017-04-28  6:44   ` Maxime Ripard
2017-04-28  6:53     ` Heiko Schocher invitel
2017-04-28  7:27       ` Maxime Ripard
2017-04-28 10:04         ` Heiko Schocher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.