public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v9 1/2] S5P: Exynos: Add GPIO pin numbering and rename definitions
@ 2014-04-25 15:32 Akshay Saraswat
  2014-04-28  9:50 ` Przemyslaw Marczak
  0 siblings, 1 reply; 4+ messages in thread
From: Akshay Saraswat @ 2014-04-25 15:32 UTC (permalink / raw)
  To: u-boot

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 <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>
>

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.

>>   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

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [U-Boot] [PATCH v9 0/2] S5P: Exynos: Add GPIO numbering feature
@ 2014-04-21 14:25 Akshay Saraswat
  2014-04-21 14:25 ` [U-Boot] [PATCH v9 1/2] S5P: Exynos: Add GPIO pin numbering and rename definitions Akshay Saraswat
  0 siblings, 1 reply; 4+ messages in thread
From: Akshay Saraswat @ 2014-04-21 14:25 UTC (permalink / raw)
  To: u-boot

Used a script to recheck/verify pin mapping and existing mapping
appears to be fine, returning correct bank and pin values.
Did ./MAKEALL -a arm and found all Exynos/S5P related boards
compiled successfully.
Couldn't test booting over all of them.
Tested U-Boot bootup over SMDK5420, SMDK5250, Snow.
Requesting maintaners to please test over affected SoCs/boards.

Changes in V2:
	- Enabled CMD_GPIO as suggested by Simon Glass
	  and supported same for EXYNOS5.
Changes in V3:
	- New patch added to rename S5P GPIO definitions
	  to S5P_GPIO.
	- GPIO Table added to calculate the base address
	  of input gpio bank.
Changes in V4:
	- To have consistent 0..n-1 GPIO numbering the banks
	  are divided into different parts where ever they
	  have holes in them.
	- Function and table to support gpio command moved
	  to s5p-gpio driver.
	- Rebased on latest u-boot-samsung tree.
Changes in V5:
	- Rebased on latest u-boot-samsung tree.
	- Removed Exynos5 specific code in gpio driver api to
	  get bank.
	- Added #define HAVE_GENERIC_GPIO in config file
	  to remove conditinal CPU check in gpio driver.
Changes in V6:
	- Isolated config changes in a new patch.
	- Updated patches with corresponding changes for Exynos 5420.
Changes in V7:
	- Added changes for other SoCs like Exynos 4412, 4210 etc.
Changes in V8:
	- Changed Subject of patch 2/2 to reflect affected SoCs/boards.
	- Fixed arndale board compile time errors introduced due to
	  patch-set v7.
Changes in V9:
	- Fixed checkpatch errors.
	- Fixed naming error in exynosxxxx_gpio_data arrays which could
	  be the possible reason behind data abort witnessed over
	  Exynos4 boards.

Akshay Saraswat (2):
  EXYNOS: Add GPIO pin numbering and rename definitions
  S5P: Exynos: Config: Enable Generic GPIO and CMD configs

 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 +++-
 include/configs/arndale.h                |    1 +
 include/configs/exynos5-dt.h             |    3 +
 include/configs/origen.h                 |    1 +
 include/configs/s5p_goni.h               |    5 +-
 include/configs/s5pc210_universal.h      |   17 +-
 include/configs/smdkc100.h               |    1 +
 include/configs/smdkv310.h               |    2 +
 include/configs/trats.h                  |    9 +-
 include/configs/trats2.h                 |    5 +-
 24 files changed, 2806 insertions(+), 857 deletions(-)

-- 
1.7.9.5

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

end of thread, other threads:[~2014-04-28  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox