All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] sunxi: board: Add i2c initialization for sun50i
@ 2019-01-08 10:04 Stefan Mavrodiev
  2019-01-08 10:17 ` Maxime Ripard
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Mavrodiev @ 2019-01-08 10:04 UTC (permalink / raw)
  To: u-boot

To use TWI0/1/2 the user can select CONFIG_I2C#_ENABLE.
However even the controller is enabled, the mux for the pins
are not set.

This patch follows the existing mux method. Since the pads are
different, separate check is added for each i2c.

Tested with A64-SOM204 board.

Signed-off-by: Stefan Mavrodiev <stefan@olimex.com>
---
 arch/arm/include/asm/arch-sunxi/gpio.h |  3 +++
 board/sunxi/board.c                    | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h
index 2daf23f6f5..40a3f845d0 100644
--- a/arch/arm/include/asm/arch-sunxi/gpio.h
+++ b/arch/arm/include/asm/arch-sunxi/gpio.h
@@ -176,6 +176,7 @@ enum sunxi_gpio_number {
 
 #define SUN5I_GPE_SDC2		3
 #define SUN8I_GPE_TWI2		3
+#define SUN50I_GPE_TWI2		3
 
 #define SUNXI_GPF_SDC0		2
 #define SUNXI_GPF_UART0		4
@@ -193,8 +194,10 @@ enum sunxi_gpio_number {
 #define SUN4I_GPH_SDC1		5
 #define SUN6I_GPH_TWI0		2
 #define SUN8I_GPH_TWI0		2
+#define SUN50I_GPH_TWI0		2
 #define SUN6I_GPH_TWI1		2
 #define SUN8I_GPH_TWI1		2
+#define SUN50I_GPH_TWI1		2
 #define SUN6I_GPH_TWI2		2
 #define SUN6I_GPH_UART0		2
 #define SUN9I_GPH_UART0		2
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index f022f365e9..ad14837291 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -98,6 +98,10 @@ void i2c_init_board(void)
 	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);
+#elif defined(CONFIG_MACH_SUN50I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(0), SUN50I_GPH_TWI0);
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(1), SUN50I_GPH_TWI0);
+	clock_twi_onoff(0, 1);
 #endif
 #endif
 
@@ -120,6 +124,10 @@ void i2c_init_board(void)
 	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);
+#elif defined(CONFIG_MACH_SUN50I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(2), SUN50I_GPH_TWI1);
+	sunxi_gpio_set_cfgpin(SUNXI_GPH(3), SUN50I_GPH_TWI1);
+	clock_twi_onoff(1, 1);
 #endif
 #endif
 
@@ -142,6 +150,10 @@ void i2c_init_board(void)
 	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);
+#elif defined(CONFIG_MACH_SUN50I)
+	sunxi_gpio_set_cfgpin(SUNXI_GPE(14), SUN50I_GPE_TWI2);
+	sunxi_gpio_set_cfgpin(SUNXI_GPE(15), SUN50I_GPE_TWI2);
+	clock_twi_onoff(2, 1);
 #endif
 #endif
 
-- 
2.17.1

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

* [U-Boot] [PATCH 1/1] sunxi: board: Add i2c initialization for sun50i
  2019-01-08 10:04 [U-Boot] [PATCH 1/1] sunxi: board: Add i2c initialization for sun50i Stefan Mavrodiev
@ 2019-01-08 10:17 ` Maxime Ripard
  2019-01-11  6:55   ` Jagan Teki
  0 siblings, 1 reply; 3+ messages in thread
From: Maxime Ripard @ 2019-01-08 10:17 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 08, 2019 at 12:04:30PM +0200, Stefan Mavrodiev wrote:
> To use TWI0/1/2 the user can select CONFIG_I2C#_ENABLE.
> However even the controller is enabled, the mux for the pins
> are not set.
> 
> This patch follows the existing mux method. Since the pads are
> different, separate check is added for each i2c.
> 
> Tested with A64-SOM204 board.
> 
> Signed-off-by: Stefan Mavrodiev <stefan@olimex.com>


Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Thanks!
Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190108/e07f5119/attachment.sig>

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

* [U-Boot] [PATCH 1/1] sunxi: board: Add i2c initialization for sun50i
  2019-01-08 10:17 ` Maxime Ripard
@ 2019-01-11  6:55   ` Jagan Teki
  0 siblings, 0 replies; 3+ messages in thread
From: Jagan Teki @ 2019-01-11  6:55 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 8, 2019 at 3:47 PM Maxime Ripard <maxime.ripard@bootlin.com> wrote:
>
> On Tue, Jan 08, 2019 at 12:04:30PM +0200, Stefan Mavrodiev wrote:
> > To use TWI0/1/2 the user can select CONFIG_I2C#_ENABLE.
> > However even the controller is enabled, the mux for the pins
> > are not set.
> >
> > This patch follows the existing mux method. Since the pads are
> > different, separate check is added for each i2c.
> >
> > Tested with A64-SOM204 board.
> >
> > Signed-off-by: Stefan Mavrodiev <stefan@olimex.com>
>
>
> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Applied to u-boot-sunxi/master

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

end of thread, other threads:[~2019-01-11  6:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08 10:04 [U-Boot] [PATCH 1/1] sunxi: board: Add i2c initialization for sun50i Stefan Mavrodiev
2019-01-08 10:17 ` Maxime Ripard
2019-01-11  6:55   ` Jagan Teki

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.