All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] nios2: add gpio_request
@ 2010-06-09  1:51 Thomas Chou
  2010-06-09  1:51 ` [U-Boot] [PATCH 2/2] gpio_led: add gpio_request to __led_init Thomas Chou
  2010-06-16  1:29 ` [U-Boot] [PATCH 1/2] nios2: add gpio_request Scott McNutt
  0 siblings, 2 replies; 8+ messages in thread
From: Thomas Chou @ 2010-06-09  1:51 UTC (permalink / raw)
  To: u-boot

This will be used by nand_plat.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
 arch/nios2/include/asm/gpio.h     |    6 ++++++
 board/altera/nios2-generic/gpio.c |    5 +++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/nios2/include/asm/gpio.h b/arch/nios2/include/asm/gpio.h
index 76c425e..cff1dd9 100644
--- a/arch/nios2/include/asm/gpio.h
+++ b/arch/nios2/include/asm/gpio.h
@@ -21,6 +21,11 @@
 #ifdef CONFIG_SYS_GPIO_BASE
 #include <asm/io.h>
 
+static inline int gpio_request(unsigned gpio, const char *label)
+{
+	return 0;
+}
+
 static inline int gpio_direction_input(unsigned gpio)
 {
 	writel(1, CONFIG_SYS_GPIO_BASE + (gpio << 2));
@@ -43,6 +48,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
 	writel(value ? 3 : 2, CONFIG_SYS_GPIO_BASE + (gpio << 2));
 }
 #else
+extern int gpio_request(unsigned gpio, const char *label);
 extern int gpio_direction_input(unsigned gpio);
 extern int gpio_direction_output(unsigned gpio, int value);
 extern int gpio_get_value(unsigned gpio);
diff --git a/board/altera/nios2-generic/gpio.c b/board/altera/nios2-generic/gpio.c
index 6c9c6c2..d449684 100644
--- a/board/altera/nios2-generic/gpio.c
+++ b/board/altera/nios2-generic/gpio.c
@@ -15,6 +15,11 @@
 static u32 pio_data_reg;
 static u32 pio_dir_reg;
 
+int gpio_request(unsigned gpio, const char *label)
+{
+	return 0;
+}
+
 int gpio_direction_input(unsigned gpio)
 {
 	u32 mask = 1 << gpio;
-- 
1.7.1.86.g0e460

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] gpio_led: add gpio_request to __led_init
  2010-06-09  1:51 [U-Boot] [PATCH 1/2] nios2: add gpio_request Thomas Chou
@ 2010-06-09  1:51 ` Thomas Chou
  2010-06-09  4:25   ` Mike Frysinger
  2010-06-16  1:29 ` [U-Boot] [PATCH 1/2] nios2: add gpio_request Scott McNutt
  1 sibling, 1 reply; 8+ messages in thread
From: Thomas Chou @ 2010-06-09  1:51 UTC (permalink / raw)
  To: u-boot

This patcha adds the gpio usage request.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
 drivers/misc/gpio_led.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c
index acd6a90..e00b9fa 100644
--- a/drivers/misc/gpio_led.c
+++ b/drivers/misc/gpio_led.c
@@ -2,10 +2,7 @@
  * Status LED driver based on GPIO access conventions of Linux
  *
  * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * Licensed under the GPL-2 or later.
  */
 
 #include <common.h>
@@ -16,6 +13,7 @@
 
 void __led_init(led_id_t mask, int state)
 {
+	gpio_request(mask, "gpio_led");
 	gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1);
 }
 
-- 
1.7.1.86.g0e460

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] gpio_led: add gpio_request to __led_init
  2010-06-09  1:51 ` [U-Boot] [PATCH 2/2] gpio_led: add gpio_request to __led_init Thomas Chou
@ 2010-06-09  4:25   ` Mike Frysinger
  2010-06-09  5:32     ` [U-Boot] [PATCH 2/2 v2] " Thomas Chou
  2010-06-09  5:41     ` [U-Boot] [PATCH 2/2] " Thomas Chou
  0 siblings, 2 replies; 8+ messages in thread
From: Mike Frysinger @ 2010-06-09  4:25 UTC (permalink / raw)
  To: u-boot

On Tuesday, June 08, 2010 21:51:10 Thomas Chou wrote:
> This patcha adds the gpio usage request.

"patch".  otherwise, i wish i knew about this driver earlier as i ended up 
writing a similar thing for Blackfin systems with the GPIO framework :/.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100609/63b4e4b0/attachment.pgp 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2 v2] gpio_led: add gpio_request to __led_init
  2010-06-09  4:25   ` Mike Frysinger
@ 2010-06-09  5:32     ` Thomas Chou
  2010-06-16  1:29       ` Scott McNutt
  2010-06-09  5:41     ` [U-Boot] [PATCH 2/2] " Thomas Chou
  1 sibling, 1 reply; 8+ messages in thread
From: Thomas Chou @ 2010-06-09  5:32 UTC (permalink / raw)
  To: u-boot

This patch adds the gpio usage request. The polarity is changed to
positive as suggested by Mike Frysinger.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v2: fix typo, change led polarity

 drivers/misc/gpio_led.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c
index acd6a90..3fedddc 100644
--- a/drivers/misc/gpio_led.c
+++ b/drivers/misc/gpio_led.c
@@ -2,26 +2,22 @@
  * Status LED driver based on GPIO access conventions of Linux
  *
  * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * Licensed under the GPL-2 or later.
  */
 
 #include <common.h>
 #include <status_led.h>
 #include <asm/gpio.h>
 
-/* assume led is active low */
-
 void __led_init(led_id_t mask, int state)
 {
-	gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1);
+	gpio_request(mask, "gpio_led");
+	gpio_direction_output(mask, state == STATUS_LED_ON);
 }
 
 void __led_set(led_id_t mask, int state)
 {
-	gpio_set_value(mask, (state == STATUS_LED_ON) ? 0 : 1);
+	gpio_set_value(mask, state == STATUS_LED_ON);
 }
 
 void __led_toggle(led_id_t mask)
-- 
1.7.1.86.g0e460

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] gpio_led: add gpio_request to __led_init
  2010-06-09  4:25   ` Mike Frysinger
  2010-06-09  5:32     ` [U-Boot] [PATCH 2/2 v2] " Thomas Chou
@ 2010-06-09  5:41     ` Thomas Chou
  1 sibling, 0 replies; 8+ messages in thread
From: Thomas Chou @ 2010-06-09  5:41 UTC (permalink / raw)
  To: u-boot

Mike Frysinger wrote:
> On Tuesday, June 08, 2010 21:51:10 Thomas Chou wrote:
>> This patcha adds the gpio usage request.
> 
> "patch".  otherwise, i wish i knew about this driver earlier as i ended up 
> writing a similar thing for Blackfin systems with the GPIO framework :/.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> -mike

Hi Mike,

Thanks. I sent an updated patch.

Will you use gpio for the bit-banging i2c driver, soft_i2c.c? Is there a 
good way to include asm/gpio.h to it?

Best regards,
Thomas

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] nios2: add gpio_request
  2010-06-09  1:51 [U-Boot] [PATCH 1/2] nios2: add gpio_request Thomas Chou
  2010-06-09  1:51 ` [U-Boot] [PATCH 2/2] gpio_led: add gpio_request to __led_init Thomas Chou
@ 2010-06-16  1:29 ` Scott McNutt
  1 sibling, 0 replies; 8+ messages in thread
From: Scott McNutt @ 2010-06-16  1:29 UTC (permalink / raw)
  To: u-boot

Applied to: git://git.denx.de/u-boot-nios.git next
Thanks,
--Scott

Thomas Chou wrote:
> This will be used by nand_plat.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
>  arch/nios2/include/asm/gpio.h     |    6 ++++++
>  board/altera/nios2-generic/gpio.c |    5 +++++
>  2 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/nios2/include/asm/gpio.h b/arch/nios2/include/asm/gpio.h
> index 76c425e..cff1dd9 100644
> --- a/arch/nios2/include/asm/gpio.h
> +++ b/arch/nios2/include/asm/gpio.h
> @@ -21,6 +21,11 @@
>  #ifdef CONFIG_SYS_GPIO_BASE
>  #include <asm/io.h>
>  
> +static inline int gpio_request(unsigned gpio, const char *label)
> +{
> +	return 0;
> +}
> +
>  static inline int gpio_direction_input(unsigned gpio)
>  {
>  	writel(1, CONFIG_SYS_GPIO_BASE + (gpio << 2));
> @@ -43,6 +48,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
>  	writel(value ? 3 : 2, CONFIG_SYS_GPIO_BASE + (gpio << 2));
>  }
>  #else
> +extern int gpio_request(unsigned gpio, const char *label);
>  extern int gpio_direction_input(unsigned gpio);
>  extern int gpio_direction_output(unsigned gpio, int value);
>  extern int gpio_get_value(unsigned gpio);
> diff --git a/board/altera/nios2-generic/gpio.c b/board/altera/nios2-generic/gpio.c
> index 6c9c6c2..d449684 100644
> --- a/board/altera/nios2-generic/gpio.c
> +++ b/board/altera/nios2-generic/gpio.c
> @@ -15,6 +15,11 @@
>  static u32 pio_data_reg;
>  static u32 pio_dir_reg;
>  
> +int gpio_request(unsigned gpio, const char *label)
> +{
> +	return 0;
> +}
> +
>  int gpio_direction_input(unsigned gpio)
>  {
>  	u32 mask = 1 << gpio;

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2 v2] gpio_led: add gpio_request to __led_init
  2010-06-09  5:32     ` [U-Boot] [PATCH 2/2 v2] " Thomas Chou
@ 2010-06-16  1:29       ` Scott McNutt
  2010-07-05 14:31         ` Thomas Chou
  0 siblings, 1 reply; 8+ messages in thread
From: Scott McNutt @ 2010-06-16  1:29 UTC (permalink / raw)
  To: u-boot

Applied to: git://git.denx.de/u-boot-nios.git next
Thanks,
--Scott

Thomas Chou wrote:
> This patch adds the gpio usage request. The polarity is changed to
> positive as suggested by Mike Frysinger.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
> v2: fix typo, change led polarity
> 
>  drivers/misc/gpio_led.c |   12 ++++--------
>  1 files changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c
> index acd6a90..3fedddc 100644
> --- a/drivers/misc/gpio_led.c
> +++ b/drivers/misc/gpio_led.c
> @@ -2,26 +2,22 @@
>   * Status LED driver based on GPIO access conventions of Linux
>   *
>   * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> + * Licensed under the GPL-2 or later.
>   */
>  
>  #include <common.h>
>  #include <status_led.h>
>  #include <asm/gpio.h>
>  
> -/* assume led is active low */
> -
>  void __led_init(led_id_t mask, int state)
>  {
> -	gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1);
> +	gpio_request(mask, "gpio_led");
> +	gpio_direction_output(mask, state == STATUS_LED_ON);
>  }
>  
>  void __led_set(led_id_t mask, int state)
>  {
> -	gpio_set_value(mask, (state == STATUS_LED_ON) ? 0 : 1);
> +	gpio_set_value(mask, state == STATUS_LED_ON);
>  }
>  
>  void __led_toggle(led_id_t mask)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2 v2] gpio_led: add gpio_request to __led_init
  2010-06-16  1:29       ` Scott McNutt
@ 2010-07-05 14:31         ` Thomas Chou
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Chou @ 2010-07-05 14:31 UTC (permalink / raw)
  To: u-boot

On 06/16/2010 09:29 AM, Scott McNutt wrote:
> Applied to: git://git.denx.de/u-boot-nios.git next
> Thanks,
> --Scott

Dear Scott,

Would you please send a pull request to Wolfgang?

Best regards,
Thomas

>
> Thomas Chou wrote:
>> This patch adds the gpio usage request. The polarity is changed to
>> positive as suggested by Mike Frysinger.
>>
>> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
>> ---
>> v2: fix typo, change led polarity
>>
>> drivers/misc/gpio_led.c | 12 ++++--------
>> 1 files changed, 4 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c
>> index acd6a90..3fedddc 100644
>> --- a/drivers/misc/gpio_led.c
>> +++ b/drivers/misc/gpio_led.c
>> @@ -2,26 +2,22 @@
>> * Status LED driver based on GPIO access conventions of Linux
>> *
>> * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
>> - *
>> - * This program is free software; you can redistribute it and/or modify
>> - * it under the terms of the GNU General Public License version 2 as
>> - * published by the Free Software Foundation.
>> + * Licensed under the GPL-2 or later.
>> */
>>
>> #include <common.h>
>> #include <status_led.h>
>> #include <asm/gpio.h>
>>
>> -/* assume led is active low */
>> -
>> void __led_init(led_id_t mask, int state)
>> {
>> - gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1);
>> + gpio_request(mask, "gpio_led");
>> + gpio_direction_output(mask, state == STATUS_LED_ON);
>> }
>>
>> void __led_set(led_id_t mask, int state)
>> {
>> - gpio_set_value(mask, (state == STATUS_LED_ON) ? 0 : 1);
>> + gpio_set_value(mask, state == STATUS_LED_ON);
>> }
>>
>> void __led_toggle(led_id_t mask)
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-07-05 14:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-09  1:51 [U-Boot] [PATCH 1/2] nios2: add gpio_request Thomas Chou
2010-06-09  1:51 ` [U-Boot] [PATCH 2/2] gpio_led: add gpio_request to __led_init Thomas Chou
2010-06-09  4:25   ` Mike Frysinger
2010-06-09  5:32     ` [U-Boot] [PATCH 2/2 v2] " Thomas Chou
2010-06-16  1:29       ` Scott McNutt
2010-07-05 14:31         ` Thomas Chou
2010-06-09  5:41     ` [U-Boot] [PATCH 2/2] " Thomas Chou
2010-06-16  1:29 ` [U-Boot] [PATCH 1/2] nios2: add gpio_request Scott McNutt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.