Re: [U-Boot] [PATCH 3/3 V5] EXYNOS5: GPIO: Enable GPIO Command for EXYNOS5

2013-05-21 Thread Minkyu Kang
Dear Rajeshwari Shinde,

On 03/04/13 20:54, Rajeshwari Shinde wrote:
 This patch enables GPIO Command for EXYNOS5.
 Function has been added to asm/gpio.h to decode the
 input gpio name to gpio number.
 example: gpio set gpa00
 
 Signed-off-by: Rajeshwari Shinde rajeshwar...@samsung.com
 ---
 Changes in V2:
 - New patch
 Changes in V3:
   - Created a table to know the base address of input bank.
 Changes in V4:
   - Moved the function name_to_gpio to s5p gpio driver and 
   renamed to s5p_name_to_gpio.
 Changes in V5:
   - Rebased on latest u-boot-samsung tree
  arch/arm/include/asm/arch-exynos/gpio.h |8 +
  drivers/gpio/s5p_gpio.c |   49 
 +++
  include/configs/exynos5250-dt.h |1 +
  3 files changed, 58 insertions(+), 0 deletions(-)
 
 diff --git a/arch/arm/include/asm/arch-exynos/gpio.h 
 b/arch/arm/include/asm/arch-exynos/gpio.h
 index d8000af..9b31dc2 100644
 --- a/arch/arm/include/asm/arch-exynos/gpio.h
 +++ b/arch/arm/include/asm/arch-exynos/gpio.h
 @@ -660,6 +660,14 @@ static inline unsigned int get_bank_num(void)
   return 0;
  }
  
 +struct gpio_name_num_table {
 + char bank;
 + unsigned int base;
 +};
 +
 +int s5p_name_to_gpio(const char *name);
 +#define name_to_gpio(n) s5p_name_to_gpio(n)
 +
  void gpio_cfg_pin(int gpio, int cfg);
  void gpio_set_pull(int gpio, int mode);
  void gpio_set_drv(int gpio, int mode);
 diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
 index d6650c3..824977b 100644
 --- a/drivers/gpio/s5p_gpio.c
 +++ b/drivers/gpio/s5p_gpio.c
 @@ -36,6 +36,21 @@
  #define RATE_MASK(x) (0x1  (x + 16))
  #define RATE_SET(x)  (0x1  (x + 16))
  
 +struct gpio_name_num_table exynos5_gpio_table[] = {
 + { 'a', EXYNOS5_GPIO_A00 },
 + { 'b', EXYNOS5_GPIO_B00 },
 + { 'c', EXYNOS5_GPIO_C00 },
 + { 'd', EXYNOS5_GPIO_D00 },
 + { 'y', EXYNOS5_GPIO_Y00 },
 + { 'x', EXYNOS5_GPIO_X00 },
 + { 'e', EXYNOS5_GPIO_E00 },
 + { 'f', EXYNOS5_GPIO_F00 },
 + { 'g', EXYNOS5_GPIO_G00 },
 + { 'h', EXYNOS5_GPIO_H00 },
 + { 'v', EXYNOS5_GPIO_V00 },
 + { 'z', EXYNOS5_GPIO_Z0 },
 +};
 +
  void s5p_gpio_cfg_pin(struct s5p_gpio_bank *bank, int gpio, int cfg)
  {
   unsigned int value;
 @@ -238,3 +253,37 @@ void gpio_cfg_pin(int gpio, int cfg)
   s5p_gpio_cfg_pin(s5p_gpio_get_bank(gpio),
s5p_gpio_get_pin(gpio), cfg);
  }
 +
 +int s5p_name_to_gpio(const char *name)
 +{
 + unsigned int num, i;
 +
 + name++;

Maybe you missing my comments on V3 patch.
Please check.
http://lists.denx.de/pipermail/u-boot/2013-February/146206.html

 +
 + if (*name == 'p')
 + ++name;
 +
 + for (i = 0; i  ARRAY_SIZE(exynos5_gpio_table); i++) {
 + if (*name == exynos5_gpio_table[i].bank) {
 + if (*name == 'c') {
 + name++;
 + num = simple_strtoul(name, NULL, 10);
 + if (num = 40) {
 + num = EXYNOS5_GPIO_C40 + (num - 40);
 + } else {
 + num = simple_strtoul(name, NULL, 8);
 + num = exynos5_gpio_table[i].base + num;
 + }
 + } else {
 + name++;
 + num = simple_strtoul(name, NULL, 8);
 + num = exynos5_gpio_table[i].base + num;
 + }
 + break;
 + }
 + }
 +
 + if (i == ARRAY_SIZE(exynos5_gpio_table))
 + return -1;
 + return num;
 +}
 diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
 index cbd1c4e..46a4e75 100644
 --- a/include/configs/exynos5250-dt.h
 +++ b/include/configs/exynos5250-dt.h
 @@ -122,6 +122,7 @@
  #define CONFIG_CMD_FAT
  #define CONFIG_CMD_NET
  #define CONFIG_CMD_HASH
 +#define CONFIG_CMD_GPIO
  
  #define CONFIG_BOOTDELAY 3
  #define CONFIG_ZERO_BOOTDELAY_CHECK
 

Thanks,
Minkyu Kang.

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3 V5] EXYNOS5: GPIO: Enable GPIO Command for EXYNOS5

2013-05-11 Thread Simon Glass
On Wed, Apr 3, 2013 at 5:54 AM, Rajeshwari Shinde
rajeshwar...@samsung.com wrote:
 This patch enables GPIO Command for EXYNOS5.
 Function has been added to asm/gpio.h to decode the
 input gpio name to gpio number.
 example: gpio set gpa00

 Signed-off-by: Rajeshwari Shinde rajeshwar...@samsung.com

Acked-by: Simon Glass s...@chromium.org

 ---
 Changes in V2:
 - New patch
 Changes in V3:
 - Created a table to know the base address of input bank.
 Changes in V4:
 - Moved the function name_to_gpio to s5p gpio driver and
 renamed to s5p_name_to_gpio.
 Changes in V5:
 - Rebased on latest u-boot-samsung tree
  arch/arm/include/asm/arch-exynos/gpio.h |8 +
  drivers/gpio/s5p_gpio.c |   49 
 +++
  include/configs/exynos5250-dt.h |1 +
  3 files changed, 58 insertions(+), 0 deletions(-)

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/3 V5] EXYNOS5: GPIO: Enable GPIO Command for EXYNOS5

2013-04-03 Thread Rajeshwari Shinde
This patch enables GPIO Command for EXYNOS5.
Function has been added to asm/gpio.h to decode the
input gpio name to gpio number.
example: gpio set gpa00

Signed-off-by: Rajeshwari Shinde rajeshwar...@samsung.com
---
Changes in V2:
- New patch
Changes in V3:
- Created a table to know the base address of input bank.
Changes in V4:
- Moved the function name_to_gpio to s5p gpio driver and 
renamed to s5p_name_to_gpio.
Changes in V5:
- Rebased on latest u-boot-samsung tree
 arch/arm/include/asm/arch-exynos/gpio.h |8 +
 drivers/gpio/s5p_gpio.c |   49 +++
 include/configs/exynos5250-dt.h |1 +
 3 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/arch-exynos/gpio.h 
b/arch/arm/include/asm/arch-exynos/gpio.h
index d8000af..9b31dc2 100644
--- a/arch/arm/include/asm/arch-exynos/gpio.h
+++ b/arch/arm/include/asm/arch-exynos/gpio.h
@@ -660,6 +660,14 @@ static inline unsigned int get_bank_num(void)
return 0;
 }
 
+struct gpio_name_num_table {
+   char bank;
+   unsigned int base;
+};
+
+int s5p_name_to_gpio(const char *name);
+#define name_to_gpio(n) s5p_name_to_gpio(n)
+
 void gpio_cfg_pin(int gpio, int cfg);
 void gpio_set_pull(int gpio, int mode);
 void gpio_set_drv(int gpio, int mode);
diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
index d6650c3..824977b 100644
--- a/drivers/gpio/s5p_gpio.c
+++ b/drivers/gpio/s5p_gpio.c
@@ -36,6 +36,21 @@
 #define RATE_MASK(x)   (0x1  (x + 16))
 #define RATE_SET(x)(0x1  (x + 16))
 
+struct gpio_name_num_table exynos5_gpio_table[] = {
+   { 'a', EXYNOS5_GPIO_A00 },
+   { 'b', EXYNOS5_GPIO_B00 },
+   { 'c', EXYNOS5_GPIO_C00 },
+   { 'd', EXYNOS5_GPIO_D00 },
+   { 'y', EXYNOS5_GPIO_Y00 },
+   { 'x', EXYNOS5_GPIO_X00 },
+   { 'e', EXYNOS5_GPIO_E00 },
+   { 'f', EXYNOS5_GPIO_F00 },
+   { 'g', EXYNOS5_GPIO_G00 },
+   { 'h', EXYNOS5_GPIO_H00 },
+   { 'v', EXYNOS5_GPIO_V00 },
+   { 'z', EXYNOS5_GPIO_Z0 },
+};
+
 void s5p_gpio_cfg_pin(struct s5p_gpio_bank *bank, int gpio, int cfg)
 {
unsigned int value;
@@ -238,3 +253,37 @@ void gpio_cfg_pin(int gpio, int cfg)
s5p_gpio_cfg_pin(s5p_gpio_get_bank(gpio),
 s5p_gpio_get_pin(gpio), cfg);
 }
+
+int s5p_name_to_gpio(const char *name)
+{
+   unsigned int num, i;
+
+   name++;
+
+   if (*name == 'p')
+   ++name;
+
+   for (i = 0; i  ARRAY_SIZE(exynos5_gpio_table); i++) {
+   if (*name == exynos5_gpio_table[i].bank) {
+   if (*name == 'c') {
+   name++;
+   num = simple_strtoul(name, NULL, 10);
+   if (num = 40) {
+   num = EXYNOS5_GPIO_C40 + (num - 40);
+   } else {
+   num = simple_strtoul(name, NULL, 8);
+   num = exynos5_gpio_table[i].base + num;
+   }
+   } else {
+   name++;
+   num = simple_strtoul(name, NULL, 8);
+   num = exynos5_gpio_table[i].base + num;
+   }
+   break;
+   }
+   }
+
+   if (i == ARRAY_SIZE(exynos5_gpio_table))
+   return -1;
+   return num;
+}
diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index cbd1c4e..46a4e75 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -122,6 +122,7 @@
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_NET
 #define CONFIG_CMD_HASH
+#define CONFIG_CMD_GPIO
 
 #define CONFIG_BOOTDELAY   3
 #define CONFIG_ZERO_BOOTDELAY_CHECK
-- 
1.7.4.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot