From: Przemyslaw Marczak <p.marczak@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v9 1/2] S5P: Exynos: Add GPIO pin numbering and rename definitions
Date: Fri, 25 Apr 2014 15:44:15 +0200 [thread overview]
Message-ID: <535A66AF.4080102@samsung.com> (raw)
In-Reply-To: <1398090320-8093-2-git-send-email-akshay.s@samsung.com>
Hi,
On 04/21/2014 04:25 PM, Akshay Saraswat wrote:
> This patch includes following changes :
> * Adds gpio pin numbering support for EXYNOS SOCs.
> To have consistent 0..n-1 GPIO numbering the banks are divided
> into different parts where ever they have holes in them.
>
> * Rename GPIO definitions from GPIO_... to S5P_GPIO_...
> These changes were done to enable cmd_gpio for EXYNOS and
> cmd_gpio has GPIO_INPUT same as s5p_gpio driver and hence
> getting a error during compilation.
>
> * Adds support for name to gpio conversion in s5p_gpio to enable
> gpio command EXYNOS SoCs. Function has been added to asm/gpio.h
> to decode the input gpio name to gpio number.
> Example: SMDK5420 # gpio set gpa00
>
> Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
> Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
> ---
> arch/arm/cpu/armv7/exynos/pinmux.c | 403 +++----
> arch/arm/include/asm/arch-exynos/cpu.h | 17 +-
> arch/arm/include/asm/arch-exynos/gpio.h | 1786 +++++++++++++++++++++++++-----
> arch/arm/include/asm/arch-s5pc1xx/gpio.h | 941 +++++++++++++---
> board/samsung/arndale/arndale.c | 11 +-
> board/samsung/goni/goni.c | 26 +-
> board/samsung/smdk5250/exynos5-dt.c | 20 +-
> board/samsung/smdk5250/smdk5250.c | 19 +-
> board/samsung/smdk5420/smdk5420.c | 15 +-
> board/samsung/smdkc100/smdkc100.c | 5 +-
> board/samsung/smdkv310/smdkv310.c | 17 +-
> board/samsung/trats/trats.c | 39 +-
> board/samsung/trats2/trats2.c | 74 +-
> board/samsung/universal_c210/universal.c | 51 +-
> drivers/gpio/s5p_gpio.c | 195 +++-
> 15 files changed, 2778 insertions(+), 841 deletions(-)
>
> diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
> index 11a0472..a93928a 100644
> --- a/drivers/gpio/s5p_gpio.c
> +++ b/drivers/gpio/s5p_gpio.c
> @@ -8,11 +8,12 @@
> #include <common.h>
> #include <asm/io.h>
> #include <asm/gpio.h>
> +#include <asm/arch-exynos/gpio.h>
This is common driver, so it should be:
#include <asm/arch/gpio.h>
> #define S5P_GPIO_GET_BANK(x) ((x >> S5P_GPIO_BANK_SHIFT) \
> & S5P_GPIO_BANK_MASK)
>
> -#define S5P_GPIO_GET_PIN(x) (x & S5P_GPIO_PIN_MASK)
> +#define S5P_GPIO_GET_PIN(x) ((x & S5P_GPIO_PIN_MASK) % GPIO_PER_BANK)
And again...we don't need above macros, we can use now linear numbering.
> +#ifdef HAVE_GENERIC_GPIO
> +struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned int gpio)
> +{
> + const struct gpio_info *data;
> + unsigned int upto;
> + int i, count;
> +
> + data = get_gpio_data();
> + count = get_bank_num();
> + for (i = upto = 0; i < count;
> + i++, upto = data->max_gpio, data++) {
> + debug("i=%d, upto=%d\n", i, upto);
> + if (gpio < data->max_gpio) {
> + struct s5p_gpio_bank *bank;
> + bank = (struct s5p_gpio_bank *)data->reg_addr;
> + bank += (gpio - upto) / GPIO_PER_BANK;
> + debug("gpio=%d, bank=%p\n", gpio, bank);
> + return bank;
> + }
> + }
> + return NULL;
> +}
> +#else
You are using exynos_gpio_get() in code but this function is not
compiled. Again please remove it.
> struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned gpio)
> {
> unsigned bank = S5P_GPIO_GET_BANK(gpio);
> @@ -134,6 +252,7 @@ struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned gpio)
>
> return (struct s5p_gpio_bank *)(base + bank);
> }
> +#endif
Thanks
--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
next prev parent reply other threads:[~2014-04-25 13:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-21 14:25 [U-Boot] [PATCH v9 0/2] S5P: Exynos: Add GPIO numbering feature Akshay Saraswat
2014-04-21 14:25 ` [U-Boot] [PATCH v9 1/2] S5P: Exynos: Add GPIO pin numbering and rename definitions Akshay Saraswat
2014-04-25 13:44 ` Przemyslaw Marczak [this message]
2014-04-21 14:25 ` [U-Boot] [PATCH v9 2/2] S5P: Exynos: Config: Enable Generic GPIO and CMD configs Akshay Saraswat
2014-04-25 13:44 ` [U-Boot] [PATCH v9 0/2] S5P: Exynos: Add GPIO numbering feature Przemyslaw Marczak
-- strict thread matches above, loose matches on Subject: below --
2014-04-25 15:32 [U-Boot] [PATCH v9 1/2] S5P: Exynos: Add GPIO pin numbering and rename definitions Akshay Saraswat
2014-04-28 9:50 ` Przemyslaw Marczak
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=535A66AF.4080102@samsung.com \
--to=p.marczak@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