diff mbox

[U-Boot,1/3] sunxi: Fix clock_twi_onoff for sun6i

Message ID 1458158841-26812-1-git-send-email-hdegoede@redhat.com
State Accepted
Commit 730d2f3a41c5ccae71b5008fffdf697d143be68c
Delegated to: Hans de Goede
Headers show

Commit Message

Hans de Goede March 16, 2016, 8:07 p.m. UTC
The clock_sun6i.c implementation was not deasserting the reset for
the regular i2c controllers, this commit fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 arch/arm/cpu/armv7/sunxi/clock_sun6i.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Ian Campbell March 17, 2016, 9:50 a.m. UTC | #1
On Wed, 2016-03-16 at 21:07 +0100, Hans de Goede wrote:
> The clock_sun6i.c implementation was not deasserting the reset for
> the regular i2c controllers, this commit fixes this.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

All 3 patches: Acked-by: Ian Campbell <ijc@hellion.org.uk>

> ---
>  arch/arm/cpu/armv7/sunxi/clock_sun6i.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
> b/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
> index 700b605..4e1e1a4 100644
> --- a/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
> +++ b/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
> @@ -100,13 +100,18 @@ int clock_twi_onoff(int port, int state)
>  		return 0;
>  	}
>  
> -	/* set the apb clock gate for twi */
> -	if (state)
> +	/* set the apb clock gate and reset for twi */
> +	if (state) {
>  		setbits_le32(&ccm->apb2_gate,
>  			     CLK_GATE_OPEN <<
> (APB2_GATE_TWI_SHIFT+port));
> -	else
> +		setbits_le32(&ccm->apb2_reset_cfg,
> +			     1 << (APB2_RESET_TWI_SHIFT + port));
> +	} else {
> +		clrbits_le32(&ccm->apb2_reset_cfg,
> +			     1 << (APB2_RESET_TWI_SHIFT + port));
>  		clrbits_le32(&ccm->apb2_gate,
>  			     CLK_GATE_OPEN <<
> (APB2_GATE_TWI_SHIFT+port));
> +	}
>  
>  	return 0;
>  }
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/sunxi/clock_sun6i.c b/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
index 700b605..4e1e1a4 100644
--- a/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
+++ b/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
@@ -100,13 +100,18 @@  int clock_twi_onoff(int port, int state)
 		return 0;
 	}
 
-	/* set the apb clock gate for twi */
-	if (state)
+	/* set the apb clock gate and reset for twi */
+	if (state) {
 		setbits_le32(&ccm->apb2_gate,
 			     CLK_GATE_OPEN << (APB2_GATE_TWI_SHIFT+port));
-	else
+		setbits_le32(&ccm->apb2_reset_cfg,
+			     1 << (APB2_RESET_TWI_SHIFT + port));
+	} else {
+		clrbits_le32(&ccm->apb2_reset_cfg,
+			     1 << (APB2_RESET_TWI_SHIFT + port));
 		clrbits_le32(&ccm->apb2_gate,
 			     CLK_GATE_OPEN << (APB2_GATE_TWI_SHIFT+port));
+	}
 
 	return 0;
 }