Patchwork [U-Boot] gpio: s3c2440_gpio: Fix wrong writel arguments

login
register
mail settings
Submitter Axel Lin
Date June 15, 2013, 9:56 a.m.
Message ID <1371290219.4051.5.camel@phoenix>
Download mbox | patch
Permalink /patch/251618/
State Accepted
Delegated to: Minkyu Kang
Headers show

Comments

Axel Lin - June 15, 2013, 9:56 a.m.
Current code had writel arguments the wrong way around, fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
Hi,
I don't have this hardware to test, but current code looks obviously wrong.
I'd appreciate if someone can review and test this patch.

Axel
 drivers/gpio/s3c2440_gpio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Marek Vasut - June 15, 2013, 12:36 p.m.
Dear Axel Lin,

> Current code had writel arguments the wrong way around, fix it.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> Hi,
> I don't have this hardware to test, but current code looks obviously wrong.
> I'd appreciate if someone can review and test this patch.
> 
> Axel
>  drivers/gpio/s3c2440_gpio.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Reviewed-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut
Minkyu Kang - June 25, 2013, 1:58 a.m.
On 15/06/13 18:56, Axel Lin wrote:
> Current code had writel arguments the wrong way around, fix it.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> Hi,
> I don't have this hardware to test, but current code looks obviously wrong.
> I'd appreciate if someone can review and test this patch.
> 
> Axel
>  drivers/gpio/s3c2440_gpio.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpio/s3c2440_gpio.c b/drivers/gpio/s3c2440_gpio.c
> index 43bbf11..09b04eb 100644
> --- a/drivers/gpio/s3c2440_gpio.c
> +++ b/drivers/gpio/s3c2440_gpio.c
> @@ -61,7 +61,7 @@ int gpio_set_value(unsigned gpio, int value)
>  	else
>  		l &= ~bit;
>  
> -	return writel(port, l);
> +	return writel(l, port);
>  }
>  
>  int gpio_get_value(unsigned gpio)
> @@ -85,11 +85,11 @@ int gpio_free(unsigned gpio)
>  
>  int gpio_direction_input(unsigned gpio)
>  {
> -	return writel(GPIO_FULLPORT(gpio), GPIO_INPUT << GPIO_BIT(gpio));
> +	return writel(GPIO_INPUT << GPIO_BIT(gpio), GPIO_FULLPORT(gpio));
>  }
>  
>  int gpio_direction_output(unsigned gpio, int value)
>  {
> -	writel(GPIO_FULLPORT(gpio), GPIO_OUTPUT << GPIO_BIT(gpio));
> +	writel(GPIO_OUTPUT << GPIO_BIT(gpio), GPIO_FULLPORT(gpio));
>  	return gpio_set_value(gpio, value);
>  }
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

Patch

diff --git a/drivers/gpio/s3c2440_gpio.c b/drivers/gpio/s3c2440_gpio.c
index 43bbf11..09b04eb 100644
--- a/drivers/gpio/s3c2440_gpio.c
+++ b/drivers/gpio/s3c2440_gpio.c
@@ -61,7 +61,7 @@  int gpio_set_value(unsigned gpio, int value)
 	else
 		l &= ~bit;
 
-	return writel(port, l);
+	return writel(l, port);
 }
 
 int gpio_get_value(unsigned gpio)
@@ -85,11 +85,11 @@  int gpio_free(unsigned gpio)
 
 int gpio_direction_input(unsigned gpio)
 {
-	return writel(GPIO_FULLPORT(gpio), GPIO_INPUT << GPIO_BIT(gpio));
+	return writel(GPIO_INPUT << GPIO_BIT(gpio), GPIO_FULLPORT(gpio));
 }
 
 int gpio_direction_output(unsigned gpio, int value)
 {
-	writel(GPIO_FULLPORT(gpio), GPIO_OUTPUT << GPIO_BIT(gpio));
+	writel(GPIO_OUTPUT << GPIO_BIT(gpio), GPIO_FULLPORT(gpio));
 	return gpio_set_value(gpio, value);
 }