| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
Current mistaken use of con_id instead of _con_id, can lead to labels
being called regulator.of-<NULL>. Fix this, so the label becomes
regulator.of instead.
Fixes: 9fb2fa240d58 ("gpiolib: implement dev_gpiod_get_index")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230411071436.1630752-6-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Traditionally, pca953x have a Power-On Reset mechanism that activates
once supply voltage rises over threshold. Newer chips additionally
feature a reset input. Add support for both. To not break existing
boards, we will ignore failure to claim GPIO or regulator, even
if it's just probe deferral. Boards wanting to make use of the newly
parsed DT properties should enable deep probe.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230307102320.2084684-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There are a lot of pca953x compatible chips. Import the current list of
compatibles from Linux.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230307102320.2084684-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Otherwise, we don't correctly number devices with dynamic ID.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230307102320.2084684-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently arch specific headers can be included with
longer possible as there won't be a single mach anymore.
Move all bcm283x specific header files to include/mach/bcm283x/ to
prepare for multi-arch support.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
| |
The PCAL6408 chip similar enough to the PCA95xx chip series such that
it can be handled by the pca953x driver as well.
This solution is copied from the linux kernel's pca953x driver.
Signed-off-by: Michael Kopfensteiner <michael.kopfensteiner@vahle.com>
Link: https://lore.barebox.org/20230223153601.59357-1-michael.kopfensteiner@vahle.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
gpio_suffixes is only used inside #ifdef CONFIG_OFDEVICE, so put
it into this ifdef as well.
Fixes: 9fb2fa240d58 ("gpiolib: implement dev_gpiod_get_index")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
Linux devm_gpiod_get_index is a superset of devm_gpiod_get.
We already support gpiod_get to simplify kernel code porting, so
reimplement it in terms of a new dev_gpiod_get_index to simplify
porting kernel code using that as well.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230109155836.2220277-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
The '_d' suffix was originally meant to distinguish barebox struct
names from Linux struct names. struct driver doesn't exist in Linux,
so we can rename it and remove the meaningless suffix.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20221214123512.189688-4-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The '_d' suffix was originally introduced in case we want to import
Linux struct device as a separate struct into barebox. Over time it
became clear that this won't happen, instead barebox struct device_d
is basically the same as Linux struct device. Rename the struct name
accordingly to make porting Linux code easier.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Linux struct device has the member of_node for the device_node pointer.
Rename this in barebox accordingly to minimize the necessary changes
when porting Linux code. This was done with the semantic patch:
@@ struct device_d E; @@
- E.device_node
+ E.of_node
@@ struct device_d *E; @@
- E->device_node
+ E->of_node
Plus some manual adjustments.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This driver implements a GPIO multiplexer based on latches connected to
other GPIOs. A set of data GPIOs is connected to the data input of
multiple latches. The clock input of each latch is driven by another
set of GPIOs. With two 8-bit latches 10 GPIOs can be multiplexed into
16 GPIOs. GPOs might be a better term as in fact the multiplexed pins
are output only.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.barebox.org/20221107144524.489471-5-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
Since a30ae2921a the gpioinfo command crashes when called without
arguments. Fix it by using argv[1] when it actually exists, not when
it doesn't exist.
Fixes: a30ae2921a ("gpiolib: gpioinfo: add optional CONTROLLER command line argument")
Reported-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
Like done with gpio setter/getter functions in the previous commit,
extend the gpioinfo command to accept an optional argument that
restricts output to the supplied gpio controller instead of printing
all GPIOs at once.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220905103546.1476277-6-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
gpio_of_xlate() already needs the ability to find a struct gpio_chip *
via a struct device_d. Exporting this functionality to elsewhere in the
code will allow restricting commands to manipulate only a single GPIO
bank.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220905103546.1476277-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The of_xlate callback is used to tanslate a device-tree GPIO specifier
into a chip relative GPIO number and flags. This callback needs to be
implemented by GPIO controller driver which doesn't uses the "classic"
device-tree description, which is:
gpio = <&gpio-phandle gpio_num gpio_flags>;
But uses something else, like this (but not limited to):
gpio = <&gpio-phandle gpio_bank gpio_num gpio_flags>;
Currently no GPIO driver require this of_xlate callback, but this will
be used for sunxi's GPIO support.
Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
Link: https://lore.barebox.org/20220805135928.32725-1-jmaselbas@kalray.eu
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
| |
Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
Link: https://lore.barebox.org/20220629063024.3945-5-eagle.alexander923@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
This is a complex patch that switches the ARM CLPS711X architecture
to work with the device tree. Includes changes to board initialization
and any architecture drivers used.
Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
Link: https://lore.barebox.org/20220524060411.7754-1-eagle.alexander923@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
Since f349b66267 the loop in gpiochip_find_base() counts downwards,
hence we must decrease i by the number of GPIOs in the current chip,
not increase them.
Fixes: f349b66267 ("gpio: allocate dynamic gpio numbers top down")
Reported-by: Alexander Shiyan <eagle.alexander923@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
Since commit f349b662674e ("gpio: allocate dynamic gpio numbers
top down"), the variable is now unused and warned about, so remove it.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Link: https://lore.barebox.org/20220426064619.422478-1-ahmad@a3f.at
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
| |
Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
Link: https://lore.barebox.org/20220419093606.59318-1-eagle.alexander923@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For GPIO controllers with dynamic GPIO number bases a free base
is searched for bottom up. This means that GPIO controllers with
fixed GPIO numbers must be registered before any controller with
dynamic GPIO number base is registered, because otherwise the
GPIO controllers with fixed GPIO numbers find their range occupied
and can't be registered anymore.
The probe order normally makes sure the SoC internal GPIO controllers
with fixed numbers are registered first. With deep probe enabled
we can't rely on the probe order anymore, so we need another solution.
With this patch a free GPIO number range is searched for top down
intead of bottom up, so as long as we have enough space in the
ARCH_NR_GPIOS range the SoC internal GPIO controllers find their
base unoccupied. GPIO controllers with dynamic GPIO numbers will
change their numbers with this patch, but code shouldn't rely on
these numbers anyway.
Reported-by: Andrej Picej <andrej.picej@norik.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Andrej Picej <andrej.picej@norik.com>
|
|
|
|
|
|
|
|
|
| |
"GPL-2.0-or-later" was introduced in SPDX 2.0, and the old identifier
"GPL-2.0+" is now deprecated; see <https://spdx.org/licenses>.
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Link: https://lore.barebox.org/20211117113851.2022669-3-rhi@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
"GPL-2.0-only" was introduced in SPDX 2.0, and the old identifier
"GPL-2.0" is now considered deprecated; see <https://spdx.org/licenses>.
Fixes: 28f4a6a4df76f0f1581d (2021-10-30, "drivers: add missing SPDX-License-Identifier")
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Link: https://lore.barebox.org/20211117113851.2022669-2-rhi@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This adds the suitable SPDX-License-Identifier to all files in drivers/
that previously lacked one.
To aid manual inspection, following heuristics can be used:
* No changes outside of comments/whitespace:
git show -U0 HEAD | rg -v '^(@@|diff|index)|[-+]([-+]|//|#|[\s/]\*)'
* -or-later come in pairs:
git show --inter-hunk-context=19 HEAD | \
perl -0777 -F'/^@/gm' -ne 'for (@F) { @m = /later/g; print if @m & 1 }'
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211030175632.2276077-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Including <stdio.h> for printf is a bit problematic, because it pulls in
other headers for <console.h>, which includes quite a few more headers
as well. To make it easier to share code between barebox and host tools
make <printk.h> the new minimal header for printf and move the extra
logging stuff into <linux/printk.h>.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211030141739.2207431-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
| |
Port the driver for the Xilinx Zynq/Zynq UltraScale+ MPSoC architecture
to barebox (based on the Linux driver).
Signed-off-by: Thomas Haemmerle <thomas.haemmerle@wolfvision.net>
[apply format fixes, revise probe function, revise Kconfig]
Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
Link: https://lore.barebox.org/20211013112247.3065-2-michael.riesch@wolfvision.net
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds driver to support GPIO functionality
for 74xx-compatible ICs with MMIO access.
Compatible models include:
1 bit: 741G125 (Input), 741G74 (Output)
2 bits: 742G125 (Input), 7474 (Output)
4 bits: 74125 (Input), 74175 (Output)
6 bits: 74365 (Input), 74174 (Output)
8 bits: 74244 (Input), 74273 (Output)
16 bits: 741624 (Input), 7416374 (Output)
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Cc: Alexander Shiyan <shc_work@mail.ru>
Acked-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210817101104.114945-5-antonynpavlov@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
This imports support for the StarFive GPIO controller from the vendor's
kernel tree.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210619045055.779-28-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
GPIO properties in the device tree can have a -gpios suffix or a -gpio
suffix. The latter was not handled, this patch changes that.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.barebox.org/20210608093635.5749-2-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
For Linux, It's always correct to substitute any of the read or
write _relaxed functions with their non relaxed counterpart.
Define functions that do this.
Unlike with Linux, they doesn't per se affect performance: barebox
writel doesn't imply memory barriers, instead it depends on
the architecture support to map IO memory regions as non-bufferable.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Link: https://lore.barebox.org/20210611080155.3555976-1-ahmad@a3f.at
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit inadvertently brcm,bcm6345-gpio, wd,mbl-gpio, and ni,169445-nand-gpio,
because "dat" was now requested twice. Fix this up.
Tested on Erizo.
Fixes: 8f9ef2d9ab ("gpio: generic: sync with upstream Linux gpio-mmio driver")
Reported-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210531065924.18966-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The SiFive GPIO controller is a straight forward generic gpio-mmio
controller. Only difference is that the number of GPIOs is described by
the number of interrupts in the device tree. Import the Linux v5.12
driver to support it.
Tested with gpio-restart on qemu-system-riscv64 -M sifive_u.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210427202309.32077-10-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The gpio-mmio driver in Linux v5.12 has evolved quite a bit since the
last sync. It now supports big endian byte order, 64-bit registers as
well as controllers that have both a dirin and dirout register.
The latter is particularly interesting, because it's required for the
SiFive GPIO controller ported in a later patch.
This commit also touches gpio-mpc8xxx used on the LS1046A.
Because bit and byte endianness can now be configured separately,
the driver needs adjustment. We don't seem to support any boards
that have the peripheral as little-endian, but this is fixed by this
commit. Comparing other bgpio_init users with Linux shows no need for
further fixups.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210427202309.32077-9-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
We have nothing in-tree matching against either "basic-mmio-gpio"
or "basic-mmio-gpio-be" and none should be added, because new platforms
should probe from device tree. Remove the unused the non-DT support.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210427202309.32077-8-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
This makes gpioinfo on board that incorporate it more useful.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Link: https://lore.pengutronix.de/20210410105110.2080785-1-ahmad@a3f.at
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Many Linux drivers use [devm_]gpiod_get to get appropriately configured
GPIO descriptors out with little code. Make porting such Linux code
easier by providing a semi-compatible gpiod_get function. Main
differences:
- It returns a gpio index, so it can be passed to any gpio_ function
- It's device-tree only, so it should only be used from drivers
that themselves probe from device tree.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Link: https://lore.pengutronix.de/20210410103511.2073504-1-ahmad@a3f.at
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Converts the files that licensecheck can determine to be licensed under
GPL-2.0-only or GPL-2.0-or-later and also convert the copyright statements
to SPDX.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
| |
77e74ddca1 changes drivers to use coredevice_platform_driver() instead
of open coded initcall/driver registration. This is wrong for the pl061
driver as this is an amba driver. Revert 77e74ddca1 for this file.
Fixes: 77e74ddca1 ("treewide: Use driver macro")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
The driver has no busyness manipulating the id field in the given device
struct. Leave it untouched.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
We have several macros for a oneline driver registration. Add some
missing and use them consistently where possible througout the tree.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some boards provide a board version and/or ID coded by pull-up/down
resistors connected to the gpio pins (or pins which can be multiplexed
at some point as gpio). In this case every one implements own gpio id
reader function.
To avoid it, provide the common helper function to extract a value out
of provided gpio array.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
We call it struct device_d, any instances of struct device are likely
left-over code after porting from Linux.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
| |
Unlike Linux the generic driver get function returns the masked register
content and not the 0 or 1 value. The consequence is that gpio_get_value
returns for instance 0x10 for bit 4 instead of 1.
Use the Linux normalized form instead.
Signed-off-by: Renaud Barbier <renaud.barbier@abaco.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|