public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Minkyu Kang <mk7.kang@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/3 V5] EXYNOS5: GPIO: Enable GPIO Command for EXYNOS5
Date: Tue, 21 May 2013 16:44:19 +0900	[thread overview]
Message-ID: <519B25D3.8020808@samsung.com> (raw)
In-Reply-To: <1364990064-30688-4-git-send-email-rajeshwari.s@samsung.com>

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 <rajeshwari.s@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.

      parent reply	other threads:[~2013-05-21  7:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-03 11:54 [U-Boot] [PATCH 0/3 V5] EXYNOS5: Add GPIO numbering feature Rajeshwari Shinde
2013-04-03 11:54 ` [U-Boot] [PATCH 1/3 V5] EXYNOS5: Add gpio pin " Rajeshwari Shinde
2013-04-17  4:49   ` Rajeshwari Birje
2013-04-19  1:28     ` Minkyu Kang
2013-05-11 18:18   ` Simon Glass
2013-05-13  4:07     ` Rajeshwari Birje
2013-05-15 13:29       ` Simon Glass
2013-05-16  5:25         ` Minkyu Kang
2013-04-03 11:54 ` [U-Boot] [PATCH 2/3 V5] S5P: Rename GPIO definitions Rajeshwari Shinde
2013-05-11 18:40   ` Simon Glass
2013-04-03 11:54 ` [U-Boot] [PATCH 3/3 V5] EXYNOS5: GPIO: Enable GPIO Command for EXYNOS5 Rajeshwari Shinde
2013-05-11 18:41   ` Simon Glass
2013-05-21  7:44   ` Minkyu Kang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=519B25D3.8020808@samsung.com \
    --to=mk7.kang@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox