arm: sunxi: twi: enable clock for sun7i
Subsystems (2)
cover arm: sunxi: twi: enable clock for sun7i
From: Olliver Schinagl <[email protected]>
Paul enabled all I2C ports for sunxi but forgot the clock on twi 4 and 5 for sun7i.
And a small non code changing whitespace fix
Tested on Olimex Lime2
Olliver Schinagl (2):
sunxi: twi: enable clocks on sun7i
sun4i: clock: cleanup some whitespace errors
arch/arm/cpu/armv7/sunxi/clock_sun4i.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
Signature · 1 line
2.6.2
PATCH 1/2 sunxi: twi: enable clocks on sun7i
From: Olliver Schinagl <[email protected]>
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.
--- arch/arm/cpu/armv7/sunxi/clock_sun4i.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/cpu/armv7/sunxi/clock_sun4i.c +4 -0
@@ -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 */
Signature · 1 line
2.6.2
PATCH 1/2 sunxi: twi: enable clocks on sun7i
Hi Oliver,
Quoted 17 lines · Olliver Schinagl
From: Olliver Schinagl <[email protected]>
Commit
6c739c5dadded 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 <[email protected]>--- arch/arm/cpu/armv7/sunxi/clock_sun4i.c | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/cpu/armv7/sunxi/clock_sun4i.c +0
-0
arch/arm/cpu/armv7/sunxi/clock_sun4i.c int clock_twi_onoff(int port, int state) · line 74
Quoted 8 lines
arch/arm/cpu/armv7/sunxi/clock_sun4i.c +4
-0@@ -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
Should the number here be a #define somewhere, or even a parameter for each version of this clock?
Thanks,
Signature · 4 lines
Julian Calaby Email: julian.calaby at gmail.com Profile: http://www.google.com/profiles/julian.calaby/
PATCH 1/2 sunxi: twi: enable clocks on sun7i
Hi Oliver,
Quoted 23 lines · Julian Calaby
Hi Oliver,
Quoted 20 lines · Olliver Schinagl
From: Olliver Schinagl <[email protected]>
Commit
6c739c5dadded 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 <[email protected]>--- arch/arm/cpu/armv7/sunxi/clock_sun4i.c | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/cpu/armv7/sunxi/clock_sun4i.c +0
-0@@ -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 ;
Quoted 8 lines
arch/arm/cpu/armv7/sunxi/clock_sun4i.c int clock_twi_onoff(int port, int state) · line 74
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/clock_sun4i.c +4
-0+#ifdef CONFIG_MACH_SUN7I +if (port >4 ) +#else if (port > 2) +#endif Should the number here be a #define somewhere, or even a parameter for each version of this clock?
Wait, this is a u-boot patch, right? If so, ignore this and sorry for the noise.
Thanks,
Signature · 4 lines
Julian Calaby Email: julian.calaby at gmail.com Profile: http://www.google.com/profiles/julian.calaby/
PATCH 1/2 sunxi: twi: enable clocks on sun7i
Hey Julian
Quoted 37 lines · Julian Calaby
Hi Oliver,
Quoted 3 lines · Julian Calaby
Hi Oliver,
On Fri, Dec 4, 2015 at 3:49 AM, Olliver Schinagl <[email protected]>
Quoted 3 lines · wrote:
Quoted 3 lines
From: Olliver Schinagl <[email protected]>
Commit
6c739c5dadded code to enable i2c bus 4 and 5 on the sun7iSoC
Quoted 10 lines
Review
Quoted 10 lines
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 <[email protected]>--- arch/arm/cpu/armv7/sunxi/clock_sun4i.c | 4 ++++ 1 file changed, 4 insertions(+)(quoted diff) +0
-0
b/arch/arm/cpu/armv7/sunxi/clock_sun4i.cQuoted 7 lines
Quoted 7 lines
index 7c8eff9..ed910b1 100644
arch/arm/cpu/armv7/sunxi/clock_sun4i.c +0
-0@@ -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 ;Quoted 7 lines
arch/arm/cpu/armv7/sunxi/clock_sun4i.c int clock_twi_onoff(int port, int state) · line 74
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/clock_sun4i.c +4
-0+#ifdef CONFIG_MACH_SUN7I +if (port >4 ) +#else if (port > 2) +#endif Should the number here be a #define somewhere, or even a parameter
Quoted 5 lines
for
Quoted 1 line
each version of this clock?
Wait, this is a u-boot patch, right? If so, ignore this and sorry for the noise.
It is ;) and whille you are not un-right i dont think u-boot does this via defined variables generally. But I personally do like it better with defines. If there is a v2 I will actually change it :)
Quoted 2 lines
Thanks,
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
PATCH 1/2 sunxi: twi: enable clocks on sun7i
In reply to Olliver SchinaglHi,
Quoted 18 lines · Olliver Schinagl
From: Olliver Schinagl <[email protected]>
Commit
6c739c5dadded 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 <[email protected]>--- arch/arm/cpu/armv7/sunxi/clock_sun4i.c | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/cpu/armv7/sunxi/clock_sun4i.c +0
-0@@ -67,7 +67,11 @@ int clock_twi_onoff(int port, int state) struct sunxi_ccm_reg *const ccm =
arch/arm/cpu/armv7/sunxi/clock_sun4i.c int clock_twi_onoff(int port, int state) · line 77
Quoted 10 lines
arch/arm/cpu/armv7/sunxi/clock_sun4i.c +4
-0(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
PATCH 2/2 sun4i: clock: cleanup some whitespace errors
In reply to Olliver SchinaglFrom: Olliver Schinagl <[email protected]>
Add some spaces around operators.
--- arch/arm/cpu/armv7/sunxi/clock_sun4i.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/sunxi/clock_sun4i.c +3 -3
@@ -59,7 +59,7 @@ void clock_init_uart(void)/* open the clock for uart */ setbits_le32 (&ccm->apb1_gate, -CLK_GATE_OPEN << (APB1_GATE_UART_SHIFT +CONFIG_CONS_INDEX -1 )); +CLK_GATE_OPEN << (APB1_GATE_UART_SHIFT +CONFIG_CONS_INDEX -1 )); }int clock_twi_onoff (int port,int state)
@@ -77,10 +77,10 @@ int clock_twi_onoff(int port, int state)/* set the apb clock gate for twi */ if (state)setbits_le32 (&ccm->apb1_gate, -CLK_GATE_OPEN << (APB1_GATE_TWI_SHIFT +port)); +CLK_GATE_OPEN << (APB1_GATE_TWI_SHIFT + port));else clrbits_le32 (&ccm->apb1_gate, -CLK_GATE_OPEN << (APB1_GATE_TWI_SHIFT +port)); +CLK_GATE_OPEN << (APB1_GATE_TWI_SHIFT + port));return 0 ; }
Signature · 1 line
2.6.2
Hans de Goede
AppliedPATCH 2/2 sun4i: clock: cleanup some whitespace errors
Hi,
Quoted 5 lines · Olliver Schinagl
From: Olliver Schinagl <[email protected]>
Add some spaces around operators.
Signed-off-by Olliver Schinagl <[email protected]>
Thanks, applied.
Regards,
Hans
Quoted 31 lines
--- arch/arm/cpu/armv7/sunxi/clock_sun4i.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)arch/arm/cpu/armv7/sunxi/clock_sun4i.c +3
-3@@ -59,7 +59,7 @@ void clock_init_uart(void)/* open the clock for uart */ setbits_le32 (&ccm->apb1_gate, -CLK_GATE_OPEN << (APB1_GATE_UART_SHIFT +CONFIG_CONS_INDEX -1 )); +CLK_GATE_OPEN << (APB1_GATE_UART_SHIFT +CONFIG_CONS_INDEX -1 )); }int clock_twi_onoff (int port,int state)@@ -77,10 +77,10 @@ int clock_twi_onoff(int port, int state)/* set the apb clock gate for twi */ if (state)setbits_le32 (&ccm->apb1_gate, -CLK_GATE_OPEN << (APB1_GATE_TWI_SHIFT +port)); +CLK_GATE_OPEN << (APB1_GATE_TWI_SHIFT + port));else clrbits_le32 (&ccm->apb1_gate, -CLK_GATE_OPEN << (APB1_GATE_TWI_SHIFT +port)); +CLK_GATE_OPEN << (APB1_GATE_TWI_SHIFT + port));return 0 ; }