S5P: Exynos: Add GPIO pin numbering and rename definitions
PATCH v8 1/2 S5P: Exynos: Add GPIO pin numbering and rename definitions
Thanks for testing.
Please read inline replies.
Quoted 40 lines
Hello Akshay,
Quoted 27 lines · Akshay Saraswat
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_... toS5P_GPIO_... These changes were done to enablecmd_gpiofor EXYNOS andcmd_gpiohasGPIO_INPUTsame ass5p_gpiodriver and hence getting a error during compilation.* Adds support for name to gpio conversion in
s5p_gpioto enable gpio command EXYNOS SoCs. Function has been added toasm/gpio.hto decode the input gpio name to gpio number.
Example: SMDK5420 # gpio set gpa00Signed-off-by Leela Krishna Amudala <[email protected]>Signed-off-by Rajeshwari Shinde <[email protected]>Signed-off-by Akshay Saraswat <[email protected]>--- 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 | 1778 +++++++++++++++++++++++++----- 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 +-Quoted 10 lines
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 | 194 +++- 15 files changed, 2779 insertions(+), 831 deletions(-)
Quoted 5 lines
You introduced new method for gpio numbering and I don't know why are you using macro like this:
"exynos_gpio_get(2, EXYNOS4X12_GPIO_X33)"
and also new style like only "EXYNOS4X12_GPIO_X33".
Even I was wondering why such a macro lies in config file. But i2c driver is looking for it, so had to modify and keep it.
Quoted 5 lines
Those are two different numbers and can't be given to
s5p_gpiodriver which interprets only new gpio numbering method.
This code can't work properly.
Since, sequential pin number to bank+pin generation is same everywhere, I thought it's ok to just replace it. Probably the enum mapping has faults. Need to recalculate.
Quoted 13 lines
Please remove old macros and use only proper gpio enum in boards config files.
We don't need any "get" macro if all gpio numbers are defined explicitly.You should also modify proper dts files in
arch/arm/dts/*.I tested your changes with enums only and after change proper dts file for trats2 there is still data abort.
So this means that probably enums are not mapped correctly to proper gpio bank addresses.
Quoted 7 lines
Do you have an documentation for Exynos4 socs?
I think that this should be checked again with documentation and compiled next to the current code which is simple and just works.
There are also some warnings when checking by checkpatch script.
Sure, will fix it. :-)
Quoted 8 lines
Thanks
Signature · 4 lines
Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com
Regards,
Akshay Saraswat
PATCH v8 1/2 S5P: Exynos: Add GPIO pin numbering and rename definitions
Dear Akshay,
Quoted 43 lines · Akshay Saraswat
Thanks for testing.
Please read inline replies.Quoted 40 lines
Hello Akshay,
Quoted 37 lines · Akshay Saraswat
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_... toS5P_GPIO_... These changes were done to enablecmd_gpiofor EXYNOS andcmd_gpiohasGPIO_INPUTsame ass5p_gpiodriver and hence getting a error during compilation.* Adds support for name to gpio conversion in
s5p_gpioto enable gpio command EXYNOS SoCs. Function has been added toasm/gpio.hto decode the input gpio name to gpio number.
Example: SMDK5420 # gpio set gpa00Signed-off-by Leela Krishna Amudala <[email protected]>Signed-off-by Rajeshwari Shinde <[email protected]>Signed-off-by Akshay Saraswat <[email protected]>--- 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 | 1778 +++++++++++++++++++++++++----- 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 | 194 +++- 15 files changed, 2779 insertions(+), 831 deletions(-)
Quoted 9 lines
Quoted 5 lines
You introduced new method for gpio numbering and I don't know why are you using macro like this:
"exynos_gpio_get(2, EXYNOS4X12_GPIO_X33)"
and also new style like only "EXYNOS4X12_GPIO_X33".Even I was wondering why such a macro lies in config file. But i2c driver is looking for it, so had to modify and keep it.
Current macros like exynos4x12_gpio_get(part, bank, pin) returns some masked number with masks:0x000000ff - pin number0x00ffff00 - bank offset0xff000000 - part number
so as you can see this is not an linear numbering and this can't be just replaced with your gpio numbering method.
The previous gpio numbering method was broken because it was returning bad addresses for some gpios. Current method is simple and is just working.
Your idea with gpio enum is good, but the returned banks addresses are probably bad for some reasons.
Quoted 10 lines
Quoted 5 lines
Those are two different numbers and can't be given to
s5p_gpiodriver which interprets only new gpio numbering method.
This code can't work properly.Since, sequential pin number to bank+pin generation is same everywhere, I thought it's ok to just replace it. Probably the enum mapping has faults. Need to recalculate.
At current macros "bank" is a direct address offset of proper gpio part base address - it's not a sequential number. Look at this macro:
Quoted 32 lines
Quoted 13 lines
Please remove old macros and use only proper gpio enum in boards config files.
We don't need any "get" macro if all gpio numbers are defined explicitly.You should also modify proper dts files in
arch/arm/dts/*.I tested your changes with enums only and after change proper dts file for trats2 there is still data abort.
So this means that probably enums are not mapped correctly to proper gpio bank addresses.Quoted 7 lines
Do you have an documentation for Exynos4 socs?
I think that this should be checked again with documentation and compiled next to the current code which is simple and just works.
There are also some warnings when checking by checkpatch script.
Sure, will fix it. :-)
Quoted 8 lines
Thanks
--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
Quoted 3 lines
Regards,
Akshay Saraswat
Thank you
Signature · 4 lines
Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com