From mboxrd@z Thu Jan 1 00:00:00 1970 From: Przemyslaw Marczak Date: Mon, 28 Apr 2014 11:50:56 +0200 Subject: [U-Boot] [PATCH v9 1/2] S5P: Exynos: Add GPIO pin numbering and rename definitions In-Reply-To: <1398439967-7621-1-git-send-email-akshay.s@samsung.com> References: <1398439967-7621-1-git-send-email-akshay.s@samsung.com> Message-ID: <535E2480.6060801@samsung.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi again, On 04/25/2014 05:32 PM, Akshay Saraswat wrote: > Hi Przemyslaw Marczak, > >> 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 >>> Signed-off-by: Rajeshwari Shinde >>> Signed-off-by: Akshay Saraswat >>> --- >>> 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 >>> #include >>> #include >>> +#include >> This is common driver, so it should be: >> >> #include >> > > Will fix it in the next patch-set. > >>> #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. >> > > Yes, you are right we don't need S5P_GPIO_GET_BANK but we are still using S5P_GPIO_GET_PIN. > Will fix it. > >> >>> +#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. >> > > Yes, #else part is not being used, I can get rid of this. > But I can't see exynos_gpio_get() call here. > I mean calls in whole code. >>> 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 >> > > Regards, > Akshay Saraswat > I hope that everything is clear now. Thanks -- Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com