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

Ajay Bhargav ajay.bhargav at einfochips.com
Wed Jul 20 09:29:14 CEST 2011


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?

> 
> Actually, we use the same gpio driver for several series till now.
> And configure pin as GPIO(AF0 or whatever) is the business of MFP.
> 
right.. 

Regards,
Ajay Bhargav


More information about the U-Boot mailing list