[U-Boot] [PATCH v10 1/2] EXYNOS: Add GPIO pin numbering and rename definitions

Przemyslaw Marczak p.marczak at samsung.com
Wed Apr 30 16:25:13 CEST 2014


Hello,

On 04/29/2014 06:36 PM, Przemyslaw Marczak wrote:
> Hello,
> On 04/28/2014 03:59 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 at samsung.com>
>> Signed-off-by: Rajeshwari Shinde <rajeshwari.s at samsung.com>
>> Signed-off-by: Akshay Saraswat <akshay.s at samsung.com>
>> ---
>
>
> In this function and probably in the whole code you need to check cpu id
> for Exynos4 and Exynos4x12.
>
>>   static int exynos4_mmc_config(int peripheral, int flags)
>>   {
>> -    struct exynos4_gpio_part2 *gpio2 =
>> -        (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
>> -    struct s5p_gpio_bank *bank, *bank_ext;
>> -    int i;
>> +    int i, start = 0, start_ext = 0;
>>
>>       switch (peripheral) {
>>       case PERIPH_ID_SDMMC0:
>> -        bank = &gpio2->k0;
>> -        bank_ext = &gpio2->k1;
> Here is a bug on trats2. After your changes in arch/gpio.h
> bank = &gpio2->k0 is the same as EXYNOS4_GPIO_K00 only for Exyynos4 not
> 4x12.
>
> So here please do this:
> if (proid_is_exynos4412()) {
>      start = EXYNOS4X12_GPIO_K00;
>      start_ext = EXYNOS4X12_GPIO_K13;
> } else {
>      start = EXYNOS4_GPIO_K00;
>      start_ext = EXYNOS4_GPIO_K13;
> }
>
> I am not sure what about the rest code because it works,
> so it looks like we can use Exynos4 definitions also for Exynos4x12.
>
>
>> +        start = EXYNOS4_GPIO_K00;
>> +        start_ext = EXYNOS4_GPIO_K13;
>>           break;
>>       case PERIPH_ID_SDMMC2:
>> -        bank = &gpio2->k2;
>> -        bank_ext = &gpio2->k3;
>> +        start = EXYNOS4_GPIO_K20;
>> +        start_ext = EXYNOS4_GPIO_K33;
>>           break;
>>       default:
>>           return -1;
>>       }
>> -    for (i = 0; i < 7; i++) {
>> +    for (i = start; i < (start + 7); i++) {
>
> And here is the main reason why MMC doesn't work.
>          if (i == start + 2)
>
>>           if (i == 2)
>>               continue;
>> -        s5p_gpio_cfg_pin(bank, i,  GPIO_FUNC(0x2));
>> -        s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE);
>> -        s5p_gpio_set_drv(bank, i, GPIO_DRV_4X);
>> +        gpio_cfg_pin(i,  S5P_GPIO_FUNC(0x2));
>> +        gpio_set_pull(i, S5P_GPIO_PULL_NONE);
>> +        gpio_set_drv(i, S5P_GPIO_DRV_4X);
>>       }
>>       if (flags & PINMUX_FLAG_8BIT_MODE) {
>> -        for (i = 3; i < 7; i++) {
>> -            s5p_gpio_cfg_pin(bank_ext, i,  GPIO_FUNC(0x3));
>> -            s5p_gpio_set_pull(bank_ext, i, GPIO_PULL_NONE);
>> -            s5p_gpio_set_drv(bank_ext, i, GPIO_DRV_4X);
>> +        for (i = start_ext; i < (start_ext + 4); i++) {
>> +            gpio_cfg_pin(i,  S5P_GPIO_FUNC(0x3));
>> +            gpio_set_pull(i, S5P_GPIO_PULL_NONE);
>> +            gpio_set_drv(i, S5P_GPIO_DRV_4X);
>>           }
>>       }
>
> After those two fixes I didn't saw any other issues on trats and trats2.
>
> This still needs test for goni.
>
> And please check for the dead code...
>
> Thanks

Patch set v10 - Tested on goni - works fine.

Thanks!
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com


More information about the U-Boot mailing list