From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hans de Goede Date: Thu, 10 Dec 2015 12:32:18 +0100 Subject: [U-Boot] [PATCH 1/2] sunxi: twi: enable clocks on sun7i In-Reply-To: <1449161369-11771-2-git-send-email-oliver@schinagl.nl> References: <1449161369-11771-1-git-send-email-oliver@schinagl.nl> <1449161369-11771-2-git-send-email-oliver@schinagl.nl> Message-ID: <566962C2.10701@redhat.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi, On 12/03/2015 05:49 PM, Olliver Schinagl wrote: > From: Olliver Schinagl > > Commit 6c739c5d added code to enable i2c bus 4 and 5 on the sun7i SoC > but forgot to enable the clocks for these 2 i2c busses. > > This patch enables the clocks for i2c bus 4 and 5 on sun7i. > > Signed-off-by: Olliver Schinagl > --- > arch/arm/cpu/armv7/sunxi/clock_sun4i.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/arm/cpu/armv7/sunxi/clock_sun4i.c b/arch/arm/cpu/armv7/sunxi/clock_sun4i.c > index 7c8eff9..ed910b1 100644 > --- a/arch/arm/cpu/armv7/sunxi/clock_sun4i.c > +++ b/arch/arm/cpu/armv7/sunxi/clock_sun4i.c > @@ -67,7 +67,11 @@ int clock_twi_onoff(int port, int state) > struct sunxi_ccm_reg *const ccm = > (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; > > +#ifdef CONFIG_MACH_SUN7I > + if (port > 4) > +#else > if (port > 2) > +#endif > return -1; > > /* set the apb clock gate for twi */ The range-check is not needed at all, since clock_twi_onoff only gets called with such high indexes when CONFIG_I2C3_ENABLE / CONFIG_I2C4_ENABLE is set and Kconfig already only allows these on sun6i / sun7i. So I've applied a modified version of your patch which simply removes the range-check all-together. Regards, Hans