aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio/sandbox.c
AgeCommit message (Collapse)AuthorFilesLines
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini1-1/+1
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-04-27Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTRTom Rini1-2/+0
We have a large number of places where while we historically referenced gd in the code we no longer do, as well as cases where the code added that line "just in case" during development and never dropped it. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-02-18sandbox: Rename 'num-gpios' property to avoid dtc warningSimon Glass1-1/+2
At present dtc produces these warnings when compiling sandbox: arch/sandbox/dts/test.dtb: Warning (gpios_property): Could not get phandle node for /base-gpios:num-gpios(cell 0) arch/sandbox/dts/test.dtb: Warning (gpios_property): Missing property '#gpio-cells' in node /reset-ctl or bad phandle (referred from /extra-gpios:num-gpios[0]) Both are due to it assuming that the 'num-gpios' property holds a phandle pointing to a GPIO node. To avoid these warnings, rename the sandbox property so that it does not include the string 'gpios'. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: gpio: sandbox: Use dev_read...() functions to access DTSimon Glass1-6/+3
Use the new dev_read...() functions to access the device tree, so that a live tree can be used. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: gpio: Refactor to prepare for live tree supportSimon Glass1-1/+2
Move the main part of the GPIO request function into a separate function so that it can be used by the live tree function when added. Update the xlate method to use a node reference. Update all GPIO drivers to handle the modified xlate() method. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-02-08dm: core: Replace of_offset with accessorSimon Glass1-3/+3
At present devices use a simple integer offset to record the device tree node associated with the device. In preparation for supporting a live device tree, which uses a node pointer instead, refactor existing code to access this field through an inline function. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-06-03dm: test: Add GPIO open drain testsmario.six@gdsys.cc1-0/+35
Add some tests for the new open drain setting feature of the GPIO uclass, and extend the capabilities of the sandbox GPIO driver accordingly. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: York Sun <york.sun@nxp.com>
2015-04-16dm: core: Add dev_get_uclass_priv() to access uclass private dataSimon Glass1-3/+3
Add a convenience function to access the private data that a uclass stores for each of its devices. Convert over most existing uses for consistency and to provide an example for others. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-01-29dm: gpio: Add better functions to request GPIOsSimon Glass1-0/+20
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>
2014-10-23dm: gpio: sandbox: Drop request()/free() in the driverSimon Glass1-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>
2014-10-23dm: gpio: sandbox: Implement the remove() methodSimon Glass1-0/+8
This method frees memory so we must make sure to implement it. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-23dm: gpio: sandbox: Implement the get_function() methodSimon Glass1-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>
2014-06-20dm: Rename struct device_id to udevice_idSimon Glass1-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>
2014-05-27dm: rename device struct to udeviceHeiko Schocher1-17/+17
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-04sandbox: Convert GPIOs to use driver modelSimon Glass1-78/+139
Convert sandbox over to use driver model GPIOs. Signed-off-by: Simon Glass <sjg@chromium.org>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk1-17/+1
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2012-03-12sandbox: gpio: add basic driver for simulating GPIOsSimon Glass1-0/+209
This provides a way of simulating GPIOs by setting values which are seen by the normal gpio_get/set_value() calls. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>