
Hi
On Tuesday 21 August 2012 18:00:51 Marek Vasut wrote: ...snip...
+/**
- gpio_request() - [COMPAT] Request GPIO
- gpio: GPIO number
- label: Name for the requested GPIO
- This function implements the API that's compatible with current
- GPIO API used in U-Boot. The request is forwarded to particular
- GPIO driver. Returns 0 on success, negative value on error.
- */
+int gpio_request(unsigned gpio, const char *label) +{
- struct gpio_core_entry *e = gpio_to_entry(gpio);
- if (!e)
return -EINVAL;
- return e->ops->gpio_request(gpio, label);
+}
...snip...
Your core should have a driver API (as described in the core document), which should be in form of gpio_$fname for each $fname in the gpio_ops. on top of those you can have the command API, which accesses the gpio pins in a linear fashion (like what you have now)
the reason for this is if you have a device on gpio (say some LEDs), which knows (from platform data) that pins 3-6 of the parent device are connected to this device. in your API, this has no way of working - even if you put global pin numbering in the platform data, this would stop working if you had a PnP GPIO controllers (say USB).
regards Pavel Herrmann