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

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

On Wed, Jul 20, 2011 at 3:29 PM, Ajay Bhargav ajay.bhargav@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

----- "Lei Wen" adrian.wenl@gmail.com wrote:
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
If you're enabling GPIO command support (CONFIG_CMD_GPIO), Its necessary. and yes its a part of framework.
Regards, Ajay Bhargav
participants (2)
-
Ajay Bhargav
-
Lei Wen