[U-Boot] [PATCH 1/4] gpio: Adds GPIO driver support for Armada100

Lei Wen adrian.wenl at gmail.com
Wed Jul 20 09:48:29 CEST 2011


On Wed, Jul 20, 2011 at 3:29 PM, Ajay Bhargav
<ajay.bhargav at einfochips.com> wrote:
> Hi Lei,
>
>> I am not mixing those two concept together, and in our pratice, we
>> also do as you said,
>> use mfp to set that pin to GPIO state, and use gpio function to
>> manupulate the gpio.
>> So there is no need checking MFP setting for gpio requreset. Directly
>> set would be ok.
>
> exactly... so here is code snip from my patch and Prafulla's reply.
> ---
>> > +int gpio_request(int gp, const char *label)
>> > +{
>> > +        /*
>> > +         * Assumes corresponding MFP is configured peoperly
>> > +         * for use as GPIO
>> > +         */
>>
>> NAK, you should check here, respective MFP is being configured as GPIO, if not you should return error
>>
>> > +        return 0;
>> > +}
>> > +
> ---
>
>> BTW, why there is need the gpio_request function?
>>
> You can request a pin as GPIO for using within your code. In Linux Kernel
> source this function checks for valid number and if requested pin is in use
> or not. To check this they have used a very simple logic.
> ..pseudo code..
> if(pin_label == NULL)
>    pin is free
> else
>    pin in use
>
> I think I should do the same thing in my request function rather than going for
> complicated stuff, what you say?
>

I mean why there has to be one request() function call is need?
Is this mandatory for the gpio general framwork as you said?

Best regards,
Lei


More information about the U-Boot mailing list