From: Jernej =?utf-8?B?xaBrcmFiZWM=?= Date: Fri, 19 Jan 2018 21:35:58 +0100 Subject: [U-Boot] [PATCH 1/2] sunxi: fix i2c support for sunxi H3/H5 In-Reply-To: References: <20180119183559.14430-1-nunojpg@gmail.com> Message-ID: <10458718.5SAZOlns8d@jernej-laptop> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de Hi, Dne petek, 19. januar 2018 ob 19:38:52 CET je Nuno Gon=C3=A7alves napisal(a= ): > Sorry, there is only 1 patch in this series. >=20 > I would like comments regarding removing DM_I2C for MACH_SUNXI_H3_H5, > as I didn't found a reason for it to be defined. there is good reason to be there. When H3/H5 board has DE2/HDMI enabled,=20 warning is shown when configuring, if DM_I2C is not selected. Since there=20 should be no warning, DM_I2C has to stay. This means that whatever you want to have attached to I2C, you have to have= an=20 entry in DT for it. Since there is no DM pinctrl driver, you have to put co= de=20 somewhere, like you already done. Besides, U-Boot wants to migrate towards DM drivers, no other way around. L= ast=20 time I checked, DM I2C driver for H3/H5 should work, although it wasn't=20 thoroughly tested from my side. So if there are issues with DM I2C driver, = you=20 have to fix it. Best regards, Jernej >=20 > Thanks, > Nuno >=20 > On Fri, Jan 19, 2018 at 7:35 PM, Nuno Goncalves wrote: > > Tested to work in a Orange Pi Zero (H2+/H3), and checked against H5 > > datasheet. > >=20 > > Signed-off-by: Nuno Goncalves > > --- > >=20 > > arch/arm/include/asm/arch-sunxi/gpio.h | 2 ++ > > arch/arm/mach-sunxi/Kconfig | 1 - > > board/sunxi/board.c | 10 +++++++++- > > 3 files changed, 11 insertions(+), 2 deletions(-) > >=20 > > diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h > > b/arch/arm/include/asm/arch-sunxi/gpio.h index 24f85206c8..52884886d7 > > 100644 > > --- a/arch/arm/include/asm/arch-sunxi/gpio.h > > +++ b/arch/arm/include/asm/arch-sunxi/gpio.h > > @@ -149,6 +149,8 @@ enum sunxi_gpio_number { > >=20 > > #define SUN6I_GPA_SDC2 5 > > #define SUN6I_GPA_SDC3 4 > > #define SUN8I_H3_GPA_UART0 2 > >=20 > > +#define SUN8I_H3_H5_GPA_TWI0 2 > > +#define SUN8I_H3_H5_GPA_TWI1 3 > >=20 > > #define SUN4I_GPB_PWM 2 > > #define SUN4I_GPB_TWI0 2 > >=20 > > diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig > > index 1fededd0a3..a2a8599165 100644 > > --- a/arch/arm/mach-sunxi/Kconfig > > +++ b/arch/arm/mach-sunxi/Kconfig > > @@ -56,7 +56,6 @@ endif > >=20 > > config MACH_SUNXI_H3_H5 > > =20 > > bool > >=20 > > - select DM_I2C > >=20 > > select SUNXI_DE2 > > select SUNXI_DRAM_DW > > select SUNXI_DRAM_DW_32BIT > >=20 > > diff --git a/board/sunxi/board.c b/board/sunxi/board.c > > index dcacdf3e62..6b55aef202 100644 > > --- a/board/sunxi/board.c > > +++ b/board/sunxi/board.c > > @@ -93,6 +93,10 @@ void i2c_init_board(void) > >=20 > > 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); > >=20 > > +#elif defined(CONFIG_MACH_SUNXI_H3_H5) > > + sunxi_gpio_set_cfgpin(SUNXI_GPA(11), SUN8I_H3_H5_GPA_TWI0); > > + sunxi_gpio_set_cfgpin(SUNXI_GPA(12), SUN8I_H3_H5_GPA_TWI0); > > + clock_twi_onoff(0, 1); > >=20 > > #elif defined(CONFIG_MACH_SUN8I) > > =20 > > sunxi_gpio_set_cfgpin(SUNXI_GPH(2), SUN8I_GPH_TWI0); > > sunxi_gpio_set_cfgpin(SUNXI_GPH(3), SUN8I_GPH_TWI0); > >=20 > > @@ -115,6 +119,10 @@ void i2c_init_board(void) > >=20 > > 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); > >=20 > > +#elif defined(CONFIG_MACH_SUNXI_H3_H5) > > + sunxi_gpio_set_cfgpin(SUNXI_GPA(18), SUN8I_H3_H5_GPA_TWI1); > > + sunxi_gpio_set_cfgpin(SUNXI_GPA(19), SUN8I_H3_H5_GPA_TWI1); > > + clock_twi_onoff(1, 1); > >=20 > > #elif defined(CONFIG_MACH_SUN8I) > > =20 > > sunxi_gpio_set_cfgpin(SUNXI_GPH(4), SUN8I_GPH_TWI1); > > sunxi_gpio_set_cfgpin(SUNXI_GPH(5), SUN8I_GPH_TWI1); > >=20 > > @@ -137,7 +145,7 @@ void i2c_init_board(void) > >=20 > > 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); > >=20 > > -#elif defined(CONFIG_MACH_SUN8I) > > +#elif defined(CONFIG_MACH_SUN8I) /* same for CONFIG_MACH_SUNXI_H3_H5 */ > >=20 > > 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); > >=20 > > -- > > 2.11.0