[U-Boot] [PATCH 05/21] dm: gpio: Add a native driver model API

Simon Glass sjg at chromium.org
Thu Jan 15 05:39:43 CET 2015


On 5 January 2015 at 20:05, Simon Glass <sjg at chromium.org> wrote:
> So far driver model's GPIO uclass just implements the existing GPIO API.
> This has some limitations:
>
> - it requires manual device tree munging to support GPIOs in device tree
>     (fdtdec_get_gpio() and friends)
> - it does not understand polarity
> - it is somewhat slower since we must scan for the GPIO device each time
> - Global GPIO numbering can change if other GPIO drivers are probed
> - it requires extra steps to set the GPIO direction and value
>
> The new functions have a dm_ prefix where necessary to avoid name conflicts
> but we can remove that when it is no-longer needed. The new struct gpio_desc
> holds all required information about the GPIO. For now this is intended to
> be stored by the client requesting the GPIO, but in future it might be
> brought into the uclass in some way.
>
> With these changes the old GPIO API still works, and uses the driver model
> API underneath.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
>  drivers/gpio/gpio-uclass.c | 218 ++++++++++++++++++++++++++++++---------------
>  include/asm-generic/gpio.h |  16 ++++
>  2 files changed, 163 insertions(+), 71 deletions(-)

Applied to u-boot-dm.


More information about the U-Boot mailing list