Skip to contentSkip to conversation

gpio: Adds GPIO driver support for Armada100

PATCH New Ajay Bhargav 2 participants 3 messages Jul 20, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/4 gpio: Adds GPIO driver support for Armada100

Hi Lei,

Quoted 6 lines

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.
---

Quoted 9 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+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

Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+        return 0;
+}
+

---

Quoted 2 lines

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?

Quoted 4 lines

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

#2 lore raw

PATCH 1/4 gpio: Adds GPIO driver support for Armada100

Quoted 36 lines · Ajay Bhargav

Hi Lei,

Quoted 6 lines

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.
---

Quoted 9 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+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

Quoted 3 lines

Review

Quoted 3 lines

+ ? ? ? ?return 0;

(quoted diff) +2 -0
+}
+

---

Quoted 2 lines

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

Quoted 3 lines

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

#3 lore raw

PATCH 1/4 gpio: Adds GPIO driver support for Armada100

Quoted 6 lines · ----- "Lei Wen

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