summaryrefslogtreecommitdiff
path: root/include/asm-generic/gpio.h
AgeCommit message (Collapse)Author
2015-07-21dm: gpio: Add dm_gpio_request() to manually request a GPIOSimon Glass
This function can be used for testing to manually request a GPIO for use, without resorting to the legacy GPIO API. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-07-21dm: gpio: Add dm_gpio_lookup_name() to look up a GPIO nameSimon Glass
Provide a driver-model function to look up a GPIO name. Make the standard function use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-06-04gpio: fix typos in GPIO headerMasahiro Yamada
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2015-05-15dm: gpio: Fix comment typo in GPIOD_IS_INSimon Glass
This should say 'in', not 'out'. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-13dm: gpio: Add error handling and a function to claim vector GPIOsSimon Glass
gpio_get_values_as_int() should return an error if something goes wrong. Also provide gpio_claim_vector(), a function to request the GPIOs and set them to input mode. Otherwise callers have to do this themselves. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
2015-01-30dm: gpio: Mark the old GPIO API deprecatedSimon Glass
Add a deprecation notice to each function so that it is more obvious that we are moving GPIOs to driver model. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-01-30dm: gpio: Add better functions to request GPIOsSimon Glass
At present U-Boot sort-of supports the standard way of reading GPIOs from device tree nodes, but the support is incomplete, a bit clunky and only works for GPIO bindings where #gpio-cells is 2. Add new functions to request GPIOs, taking full account of the device tree binding. These permit requesting a GPIO with a simple call like: gpio_request_by_name(dev, "cd-gpios", 0, &desc, GPIOD_IS_IN); This will request the GPIO, looking at the device's node which might be this, for example: cd-gpios = <&gpio TEGRA_GPIO(B, 3) GPIO_ACTIVE_LOW>; The GPIO will be set to input mode in this case and polarity will be honoured by the GPIO calls. It is also possible to request and free a list of GPIOs. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-01-30dm: gpio: Add a driver GPIO translation methodSimon Glass
Only the GPIO driver knows about the full GPIO device tree binding used by a device. Add a method to allow the driver to provide this information to the uclass, including the GPIO offset within the device and flags such as the polarity. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-01-30dm: gpio: Add a native driver model APISimon Glass
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@chromium.org>
2014-11-21dm: gpio: Add a function to read an ID from a list of GPIOsSimon Glass
For board IDs a common approach is to set aside several GPIOs for use in determining the board ID. This can provide information about board features and the revision. Add a function that turns a list of GPIOs into an integer by assigning each GPIO to a single bit. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-26Merge git://git.denx.de/u-boot-dmTom Rini
Fix a trivial conflict over adding <dm.h> Conflicts: arch/arm/cpu/armv7/omap3/board.c Signed-off-by: Tom Rini <trini@ti.com>
2014-10-25gpio: add protype for name_to_gpioJeroen Hofstee
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
2014-10-24dm: gpio: Remove unused get_state() uclass methodSimon Glass
This is no longer used so drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-24dm: gpio: Add gpio_requestf() helper for printf() stringsSimon Glass
Add a helper which permits a printf()-style format string for the requester string. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-24dm: Move the function for getting GPIO status into the uclassSimon Glass
This function can be more easily tested if it is in the uclass. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-24dm: gpio: Add gpio_get_function() and friendsSimon Glass
Add helpers to the uclass to allow finding out the pin function. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-24dm: gpio: Implement GPIO reservation in the uclassSimon Glass
We have several GPIO drivers now and all are doing similar things to record which GPIOs are reserved. Move this logic into the uclass to make the drivers similar. We retain the request()/free() methods since currently one driver does use these for setting up the pin. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-22gpio: header file comment spelling fixesMarcel Ziswiler
Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
2014-09-01dm: gpio: Enhance gpio command to show only active GPIOsSimon Glass
The GPIO list is very long in many cases and most of them are not used. By default, show only the GPIOs that are in use, and provide a flag to show all of them. This makes the 'gpio status' command much more pleasant. In order to do this, driver model now exposes a method for obtaining the 'function' of a GPIO, which describes whether it is an input or output, for example. Implementation of this method is optional. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-05-27dm: rename device struct to udeviceHeiko Schocher
using UBI and DM together leads in compiler error, as both define a "struct device", so rename "struct device" in include/dm/device.h to "struct udevice", as we use linux code (MTD/UBI/UBIFS some USB code,...) and cannot change the linux "struct device" Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Marek Vasut <marex@denx.de>
2014-03-04dm: Add GPIO support and testsSimon Glass
Add driver model support for GPIOs. Since existing GPIO drivers do not use driver model, this feature must be enabled by CONFIG_DM_GPIO. After all GPO drivers are converted over we can perhaps remove this config. Tests are provided for the sandbox implementation, and are a sufficient sanity check for basic operation. The GPIO uclass understands the concept of named banks of GPIOs, with each GPIO device providing a single bank. Within each bank the GPIOs are numbered using an offset from 0 to n-1. For example a bank named 'b' with 20 offsets will provide GPIOs named b0 to b19. Anonymous GPIO banks are also supported, and are just numbered without any prefix. Each time a GPIO driver is added to the uclass, the GPIOs are renumbered accordinging, so there is always a global GPIO numbering order. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com> Signed-off-by: Viktor Křivák <viktor.krivak@gmail.com> Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2012-12-11gpio: remove duplicate function signatureNikita Kiryanov
gpio_request() appears twice in asm-generic/gpio.h Remove one of the definitions. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
2012-09-21Add gpio_request() to asm-generic headerSimon Glass
This function should also be part of the GPIO API, so add it. Signed-off-by: Simon Glass <sjg@chromium.org>
2012-01-10gpio: Modify common gpio.h to more closely match LinuxJoe Hershberger
Change "int gp" to "unsigned gpio" Add request and free entry-points Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Cc: Joe Hershberger <joe.hershberger@gmail.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
2011-10-17Add generic gpio.h in asm-genericSimon Glass
Since we want want to have a standard GPIO interface, this adds a definition for this into include/asm-generic/gpio.h. Signed-off-by: Simon Glass <sjg@chromium.org>