summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
Commit message (Collapse)AuthorAgeFilesLines
* sunxi: gpio: Add support for gpio pins on the AXP209 pmicHans de Goede2015-01-141-0/+30
| | | | | | | | | | | | | | | | | | | | | | Some boards use GPIO-s on the pmic, one example of this is the A13-OLinuXino board, which uses gpio0 of the axp209 for the lcd-power signal. This commit adds support for gpio pins on the AXP209 pmic, the sunxi_gpio.c changes are universal, adding gpio support for the other AXP pmics (when necessary) should be a matter of adding the necessary axp_gpio_foo functions to their resp. drivers, and add "#define AXP_GPIO" to their header file. Note this commit only adds support for the non device-model version of the gpio code, patches for adding support to the device-model version are very welcome. The string representation for these gpio-s is AXP0-#, the 0 in the AXP0 prefix is there in case we need to support gpio-s on more then 1 pmic in the future. At least A80 boards have 2 pmics, and we may end up needing to support gpio-s on both. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Ian Campbell <ijc@hellion.org.uk>
* mmc: sunxi: Fix misuse of gpio_direction_input()Axel Lin2015-01-141-1/+1
| | | | | | | | | | | | It does not make sense to make gpio_direction_input() return the gpio input status. The return value of gpio_direction_input() is inconsistent if CONFIG_DM_GPIO is defined. And we don't need to call gpio_direction_input() int sunxi_mmc_getcd(). Just init the gpio once in mmc_resource_init() is enough. Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
* x86: ich6-gpio: Add Intel Tunnel Creek GPIO supportBin Meng2014-12-181-8/+12
| | | | | | | | | | | | Intel Tunnel Creek GPIO register block is compatible with current ich6-gpio driver, except the offset and content of GPIO block base address register in the LPC PCI configuration space are different. Use u16 instead of u32 to store the 16-bit I/O address of the GPIO registers so that it could support both Ivybridge and Tunnel Creek. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
* x86: ich6-gpio: Move setup_pch_gpios() to board support codesBin Meng2014-12-131-51/+2
| | | | | | | | | Movie setup_pch_gpios() in the ich6-gpio driver to the board support codes, so that the driver does not need to know any platform specific stuff (ie: include the platform specifc chipset header file). Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
* gpio: intel_ich6: Set correct gpio output value in ich6_gpio_direction_output()Axel Lin2014-12-131-0/+2
| | | | | | | | Current code does not set gpio output value in ich6_gpio_direction_output(), fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Simon Glass <sjg@chromium.org>
* Merge git://git.denx.de/u-boot-dmTom Rini2014-11-241-54/+187
|\ | | | | | | | | | | | | Conflicts: drivers/serial/serial-uclass.c Signed-off-by: Tom Rini <trini@ti.com>
| * dm: at91: Add driver model support for atmel GPIO driverSimon Glass2014-11-211-54/+187
| | | | | | | | | | | | | | Modify this driver to support driver model, with platform data required to determine the GPIOs that it controls. Signed-off-by: Simon Glass <sjg@chromium.org>
* | x86: ivybridge: Add support for early GPIO initSimon Glass2014-11-211-10/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When not relying on Coreboot for GPIO init the GPIOs must be set up correctly. This is currently done statically through a rather ugly method. As the GPIOs are figured out they can be moved to the device tree and set up as needed rather than all at the start. In this implementation, board files should call ich_gpio_set_gpio_map() before the GPIO driver is used in order to provide the GPIO information. We use the early PCI interface so that this driver can now be used before relocation. Signed-off-by: Simon Glass <sjg@chromium.org>
* | dm: gpio: Add a function to read an ID from a list of GPIOsSimon Glass2014-11-211-0/+19
|/ | | | | | | | | | | 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>
* dm: sunxi: Modify the GPIO driver to support driver modelSimon Glass2014-11-051-0/+170
| | | | | | | | | This adds driver model support to the sunxi GPIO driver, using the device tree to trigger binding of the driver. The driver will still operate without driver model too. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Merge git://git.denx.de/u-boot-dmTom Rini2014-10-269-690/+497
|\ | | | | | | | | | | | | | | | | Fix a trivial conflict over adding <dm.h> Conflicts: arch/arm/cpu/armv7/omap3/board.c Signed-off-by: Tom Rini <trini@ti.com>
| * dm: add entries to KconfigMasahiro Yamada2014-10-231-0/+6
| | | | | | | | | | | | | | | | Create entries of CONFIG_DM, CONFIG_DM_SERIAL, CONFIG_DM_GPIO and CONFIG_DM_SPI. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
| * dm: x86: Convert Intel ICH6 GPIO driver to use driver modelSimon Glass2014-10-231-130/+120
| | | | | | | | | | | | | | | | | | Convert over this driver, using device tree to pass in the required information. The peripheral is still probed, just the number of GPIO banks and their offsets is in the device tree (previously this was a table in the driver). Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: gpio: imx: Drop request()/free() in the driverSimon Glass2014-10-231-116/+0
| | | | | | | | | | | | | | Now that the uclass supports gpio_request/free() there is no need for the driver to implement it too. Drop this unnecessary code. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: gpio: exynos: Drop request()/free() in the driverSimon Glass2014-10-231-101/+0
| | | | | | | | | | | | | | Now that the uclass supports gpio_request/free() there is no need for the driver to implement it too. Drop this unnecessary code. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: gpio: rpi_b: Drop request()/free() in the driverSimon Glass2014-10-231-89/+0
| | | | | | | | | | | | | | Now that the uclass supports gpio_request/free() there is no need for the driver to implement it too. Drop this unnecessary code. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: gpio: omap3: Drop request()/free() in the driverSimon Glass2014-10-231-115/+1
| | | | | | | | | | | | | | Now that the uclass supports gpio_request/free() there is no need for the driver to implement it too. Drop this unnecessary code. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: gpio: tegra: Drop request()/free() in the driverSimon Glass2014-10-231-113/+0
| | | | | | | | | | | | | | Now that the uclass supports gpio_request/free() there is no need for the driver to implement it too. Drop this unnecessary code. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: gpio: Add gpio_requestf() helper for printf() stringsSimon Glass2014-10-231-0/+21
| | | | | | | | | | | | | | Add a helper which permits a printf()-style format string for the requester string. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: gpio: sandbox: Drop request()/free() in the driverSimon Glass2014-10-231-82/+0
| | | | | | | | | | | | | | Now that the uclass supports gpio_request/free() there is no need for the driver to implement it too. Drop this unnecessary code. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: gpio: sandbox: Implement the remove() methodSimon Glass2014-10-231-0/+8
| | | | | | | | | | | | This method frees memory so we must make sure to implement it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: gpio: sandbox: Implement the get_function() methodSimon Glass2014-10-231-1/+8
| | | | | | | | | | | | | | Implement this method so that the 'gpio' command can do its job correctly. For sandbox we only support input and output states for a gpio. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: Move the function for getting GPIO status into the uclassSimon Glass2014-10-231-0/+39
| | | | | | | | | | | | This function can be more easily tested if it is in the uclass. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: gpio: Add gpio_get_function() and friendsSimon Glass2014-10-231-0/+47
| | | | | | | | | | | | Add helpers to the uclass to allow finding out the pin function. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: gpio: Implement GPIO reservation in the uclassSimon Glass2014-10-231-14/+78
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * dm: omap: gpio: Support driver modelSimon Glass2014-10-231-0/+221
| | | | | | | | | | | | | | | | | | | | | | | | Add driver model support to this driver, while retaining support for the legacy system. Driver model GPIO support is enabled with CONFIG_DM_GPIO as usual. Since gpio_is_valid() no longer exists, we can use the -EINVAL error returned from gpio_request(). Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
| * dm: omap: gpio: Put _get_gpio_value() logic into its own functionSimon Glass2014-10-231-36/+42
| | | | | | | | | | | | | | | | | | | | | | | | Add a separate internal helper function to get a GPIO value, so that we will be able to call it with the driver model version and avoid code duplication. Also move gpio_get_bank() and check_gpio() down below the helper functions as these won't be needed with driver model. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
| * dm: gpio: Support numbered GPIOsSimon Glass2014-10-231-12/+25
| | | | | | | | | | | | | | | | | | | | | | | | At present banks must be named and it is not possible to refer to GPIOs by number in driver model. Some boards use numbering - e.g. OMAP. It is fairly easy to support by detecting the absense of a bank name (which starts with a letter). Add support for numbered GPIOs in addition to the existing bank support. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
* | gpio: make local functions staticJeroen Hofstee2014-10-251-2/+2
|/ | | | Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* Merge branch 'master' of git://git.denx.de/u-boot-tegraTom Rini2014-10-231-0/+3
|\
| * tegra: gpio: fix null label regressionMarcel Ziswiler2014-10-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix Tegra GPIO driver to not crash resp. misbehave upon requesting GPIOs with an empty aka NULL label. As the driver uses exclusively the label to check for reservation status actually supplying one is mandatory! This fixes a regression introduced by commit: 2fccd2d96badcdf6165658a99771a4c475586279 tegra: Convert tegra GPIO driver to use driver model Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* | arm: marvell: Move arch/kirkwood.h to arch/soc.hStefan Roese2014-10-231-1/+1
| | | | | | | | | | | | | | | | | | This move makes is possible to use this header not only from kirkwood platforms but from all Marvell mvebu platforms. Signed-off-by: Stefan Roese <sr@denx.de> Tested-by: Luka Perkov <luka@openwrt.org> Acked-by: Prafulla Wadaskar <prafulla@marvell.com>
* | dm: rpi: Convert GPIO driver to driver modelSimon Glass2014-10-221-23/+157
| | | | | | | | | | | | | | | | | | Convert the BCM2835 GPIO driver to use driver model, and switch over Raspberry Pi to use this, since it is the only board. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@wwwdotorg.org> Acked-by: Stephen Warren <swarren@wwwdotorg.org>
* | dm: imx: gpio: Support driver model in MXC gpio driverSimon Glass2014-10-221-1/+303
| | | | | | | | | | | | | | | | | | | | Add driver model support with this driver. In this case the platform data is in the driver. It would be better to put this into an SOC-specific file, but this is best attempted when more boards are moved over to use driver model. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
* | dm: exynos: gpio: Convert to driver modelSimon Glass2014-10-221-136/+288
| | | | | | | | | | | | | | Convert the exynos GPIO driver to driver model. This implements the generic GPIO interface but not the extra Exynos-specific functions. Signed-off-by: Simon Glass <sjg@chromium.org>
* | dm: exynos: Tidy up GPIO definesSimon Glass2014-10-221-10/+11
| | | | | | | | | | | | | | | | | | The defines at the top of the GPIO driver use single-character names for parameters which are not very descriptive. Improve these to use descriptive parameter names. Signed-off-by: Simon Glass <sjg@chromium.org>
* | dm: exynos: Tidy up GPIO headersSimon Glass2014-10-221-2/+1
|/ | | | | | | | | The wrong header is being included, thus requiring the code to re-declare the generic GPIO interface in each GPIO header. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
* kconfig: add blank Kconfig filesMasahiro Yamada2014-09-241-0/+0
| | | | | | | | This would be useful to start moving various config options. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* tegra: Convert tegra GPIO driver to use driver modelSimon Glass2014-09-101-55/+272
| | | | | | | | | | | | | | | | This is an implementation of GPIOs for Tegra that uses driver model. It has been tested on trimslice and also using the new iotrace feature. The implementation uses a top-level GPIO device (which has no actual GPIOS). Under this all the banks are created as separate GPIO devices. The GPIOs are named as per the Tegra datasheet/header files: A0..A7, B0..B7, ..., Z0..Z7, AA0..AA7, etc. Since driver model is not yet available before relocation, or in SPL, a special function is provided for seaboard's SPL code. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge branch 'u-boot-sunxi/master' into 'u-boot-arm/master'Albert ARIBAUD2014-07-282-0/+103
|\
| * sunxi: add gpio driverIan Campbell2014-07-182-0/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enables CONFIG_CMD_GPIO for the Allwinner (sunxi) platform as well as providing the common gpio API (gpio_request/free, direction in/out, get/set etc). Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Ma Haijun <mahaijuns@gmail.com> Signed-off-by: Oliver Schinagl <oliver@schinagl.nl> Signed-off-by: Ian Campbell <ijc@hellion.org.uk> Cc: Henrik Nordström <henrik@henriknordstrom.net> Cc: Tom Cubie <Mr.hipboi@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
* | dm: gpio: Don't use the driver model uclass for SPLSimon Glass2014-07-231-0/+2
|/ | | | | | | Driver model does not support SPL yet, so we should not use the GPIO uclass for SPL. Signed-off-by: Simon Glass <sjg@chromium.org>
* gpio: spear_gpio: Fix gpio_set_value() implementationAxel Lin2014-07-041-1/+4
| | | | | | | | | | | | | | | | In current gpio_set_value() implementation, it always sets the gpio control bit no matter the value argument is 0 or 1. Thus the GPIOs never set to low. This patch fixes this bug. The address bus is used as a mask on read/write operations, so that independent software drivers can set their GPIO bits without affecting any other pins in a single write operation. Thus we don't need a read-modify-write to update the register. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Stefan Roese <sr@denx.de> Reviewed-by: Vipin Kumar <vipin.kumar@st.com> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
* dm: Use case-insensitive comparison for GPIO banksSimon Glass2014-06-201-1/+1
| | | | | | | We want 'N0' and 'n0' to mean the same thing, so ensure that case is not considered when naming GPIO banks. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Rename struct device_id to udevice_idSimon Glass2014-06-201-1/+1
| | | | | | | It is best to avoid having any occurence of 'struct device' in driver model, so rename to achieve this. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge branch 'master' of git://git.denx.de/u-boot-armTom Rini2014-05-301-1/+2
|\
| * gpio: at91: add sanity check for the NULL pointerWu, Josh2014-05-271-1/+2
| | | | | | | | | | | | | | | | | | | | We need check the NULL pointer as at91_pio_get_port() may return NULL. Also print a error message when at91_pio_get_port() failed otherwise we cannot notice the failure. Signed-off-by: Josh Wu <josh.wu@atmel.com> Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
* | dm: rename device struct to udeviceHeiko Schocher2014-05-272-31/+31
|/ | | | | | | | | | | | 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>
* Merge branch 'u-boot-tegra/master' into 'u-boot-arm/master'Albert ARIBAUD2014-05-151-0/+20
|\
| * ARM: tegra: add GPIO initialization table functionStephen Warren2014-05-131-0/+20
| | | | | | | | | | | | | | | | | | | | | | The HW-defined procedure for booting Tegra requires that some pins be set up as GPIOs immediately at boot in order to avoid glitches on those pins, when the pinmux is programmed. Add a feature to the GPIO driver which executes a GPIO configuration table. Board files will use this to implement the correct HW initialization procedure. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
OpenPOWER on IntegriCloud