[U-Boot] [PATCH 2/3] tx25: Use generic gpio_* calls

Fabio Estevam festevam at gmail.com
Mon Jun 11 17:01:40 CEST 2012


On Mon, Jun 11, 2012 at 11:58 AM, Vikram Narayanan <vikram186 at gmail.com> wrote:
> Hi Fabio,
>
>
> On 6/10/2012 8:08 PM, Fabio Estevam wrote:
>>
>> On Sun, Jun 10, 2012 at 10:03 AM, Vikram Narayanan<vikram186 at gmail.com>
>>  wrote:
>>
>>>        /* drop PHY power and assert reset (low) */
>>> -       val = readl(&gpio4->gpio_dr)&  ~((1<<  7) | (1<<  9));
>>> -       writel(val,&gpio4->gpio_dr);
>>>
>>> -       val = readl(&gpio4->gpio_dir) | (1<<  7) | (1<<  9);
>>> -       writel(val,&gpio4->gpio_dir);
>>>
>>> +       gpio_direction_output(GPIO_FEC_RESET_B, 0);
>>> +       gpio_direction_output(GPIO_FEC_ENABLE_B, 0);
>>> +
>>> +       gpio_direction_output(GPIO_FEC_RESET_B, 1);
>>> +       gpio_direction_output(GPIO_FEC_ENABLE_B, 1);
>>
>>
>> gpio_direction_output should be set only once for each GPIO.
>>
>> After you set the direction (input or output) you should use
>> 'gpio_set_value' for setting the GPIO to 0 or 1.
>
>
> That was my understanding too. But some board file used it in the above way.
> Hope I got a wrong example. I'll fix this.
>
>
>> Also, please remove the:
>>
>>> +       gpio_direction_output(GPIO_FEC_RESET_B, 1);
>>> +       gpio_direction_output(GPIO_FEC_ENABLE_B, 1);
>>
>>
>> lines, as the setting to 1 should be after the delay (via gpio_set_value).
>
>
> Any idea about the delay value?

You should not change the delay value, just use the same as in current code.

My comment was only for you to remove the

gpio_direction_output(GPIO_FEC_RESET_B, 1);
gpio_direction_output(GPIO_FEC_ENABLE_B, 1);

,immediately after setting to 0.

Regards,

Fabio Estevam


More information about the U-Boot mailing list