]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sunxi: board: Add i2c initialization for sun50i
authorStefan Mavrodiev <stefan@olimex.com>
Tue, 8 Jan 2019 10:04:30 +0000 (12:04 +0200)
committerJagan Teki <jagan@amarulasolutions.com>
Fri, 18 Jan 2019 16:49:08 +0000 (22:19 +0530)
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>
Reviewed-by: Jagan Teki <jagan@openedev.com>
arch/arm/include/asm/arch-sunxi/gpio.h
board/sunxi/board.c

index 2daf23f6f5dac0bc5e2044846aaebab45393e31d..40a3f845d047d33fa680ea26ce3c9b1957f6b2b5 100644 (file)
@@ -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
index f022f365e950d29123bed42a7a607b49c8609c6a..ad1483729192285ee1b57a0a4f426be6417f7694 100644 (file)
@@ -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