| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now that errors from of_probe are propagated to the respective initcalls
registering the device tree, propagate of_add_memory_bank errors as
well. This ensures that clashes of device-tree added regions with
previous ones don't go unnoticed. This can e.g. be the case if a device
tree happens to have both /memory@X { }; and /memory { }; nodes.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210531071239.30653-5-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Errors during device tree registration, while uncommon, are really
annoying, because the system may limp along and it's not clear where
the misbehavior originates from.
Failing the initcall of the device tree would improve user experience in
that error case. There is intentionally no early exit on error cases
to give barebox a chance to probe the serial driver to actually report
errors when DEBUG_LL is disabled.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210531071239.30653-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Make the propery pointers in a few OF functions that read data const.
They don't modify the property.
Signed-off-by: Trent Piepho <tpiepho@gmail.com>
Link: https://lore.barebox.org/20210529062541.1123023-1-tpiepho@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some boards rewrite root node properties like compatible and
serial-number. Checking them can be annoying, because the properties
have usually long scrolled by, by the time the device tree was
completely dumped. Add a -p option to print only properties.
-p -n (print only node names AND only properties) is interpreted
to cancel each other out, so the whole device tree is dumped normally.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210527124406.22121-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Unlike the Raspberry Pi 1 and Raspberry Pi Zero, the Raspberry Pi Zero W
has its console pins on the header connected to the mini-uart, not the
PL011. The secondary PL011 UART is connected to the bluetooth module.
Set the mini-uart as default console and disable the PL011. That way we
can use the Raspberry Pi 1 image for the Zero W as well.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
of_partitions_register_fixup() tries to automatically determine the
node to fixup. Sometimes this doesn't work, so add of_fixup_partitions()
that can called at fixup time with a device node determined by subsystem
or driver code.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |/
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On device-tree enabled platforms, the Linux kernel will first attempt
to use watchdog%d as watchdog name, where %d is the alias id.
Add a function that given a barebox struct watchdog and the device tree
root node of the kernel device tree, computes the corresponding kernel
alias id.
This may then later be used to pass an appropriate argument on the
kernel command line.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For reading reg with #address-cells and #size-cells of 2,
an of_property_read_u64_array can be quite convenient.
Add one.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
The different architectures duplicate some code around unflattening and
registering the device tree. Add common functions to reduce this
duplication.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Reboot modes provide a well-defined way to exchange information between
different stage of the boot process. When configured, users can type
`reboot bootloader` in the OS and barebox can read it out a device
parameter. Likewise barebox can write a reboot mode for the BootROM to
evaluate and then reset to fall into a serial recovery mode for example.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current way to set a property with multiple values (e.g. compatible
strings) is to have
char properties[] = "st,stm32mp157c-dk2\0st,stm32mp157";
of_set_property(np, "compatible", properties, sizeof(properties), 1);
Add a new helper to make this easier at the cost of one runtime
reallocation:
of_property_write_strings(np, "compatible,
"st,stm32mp157c-dk2", "st,stm32mp157", NULL);
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Codebase is meant to be gnu89, but this was only enforced starting
with bc4840e98b94 ("kbuild: add -Wmissing-prototypes and -std=gnu89
to KBUILD_HOSTCFLAGS"). Since then, use of this macro would yield a
compile error, because of the initialization inside the for-loop,
which is a C99 feature. There hasn't been any users for the macro
since it was added in 2016, thus drop it.
This reverts commit d5f9415b04846661522141ea428f74e3c618fa9e.
Cc: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While the code is correct, less sophisticated static analyzers (and
users operating them..) trip over it, because they don't see that
the be32_to_cpu argument is evaluated multiple times only if it's
constant. Moving the side effect out:
- Lets us avoid the false positive
- Aligns us with what Linux does
- Makes the code IMO a bit clearer
Do so.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
Import the Linux helper, so code using it may be more easily ported.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
| |
Incoming Linux code port makes use of the helper. Add it now instead of
having to open-code it later.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
information
According to our /README, GPL-2.0-only applies for the whole project
except noted otherwise.
Signed-off-by: Roland Hieber <rohieb@rohieb.name>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
| |
Added straight from the Kernel.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
of_property_read_string_array() is used to read a multistring device
tree property into an array of strings. This is taken from the kernel.
It is implemented around of_property_read_string_helper() which can be
used to implement of_property_count_strings() and
of_property_read_string_index() as well.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
fpga-region device tree nodes have the firmware-name property that
contains the file name of firmware in the firmware search path (but not
the path) that shall be loaded before the overlay is applied.
Add the of_firmware_load_overlay() function that accepts an overlay and a
firmware search path, finds the responsible firmware_mgr and loads the
firmware.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Device tree overlays (the dto files) may contain multiple fragments for
different target nodes. Each fragment contains a __overlay__ node that
is applied to target node specified in the fragment.
Add a helper to call a function for each fragment in a device tree
overlay to avoid having device tree overlay internal information in
other modules.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The devicetree overlay support is based on the Linux driver for device
tree overlays, but many features that are not required in Barebox are
left out.
Unlike Linux, which applies the overlay to the live devicetree, Barebox
registers a fixup for the overlay which is applied with other fixups to
whatever tree is fixed. This is necessary to apply the overlay to
devicetrees that are passed to Linux, which might differ from the
devicetree that is currently live in Barebox.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
| |
of_diff compares two device trees against each other and prints a
diff-like result.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
In some cases node names are not unique and passing the full path is really long.
So make add a new device by passing the alias string possible.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of just creating a simple PHY device for every child of MDIO
bus node, add code to check if any of them have "compatible" property
set, as well as code to create a proper platform device for such
cases.
This change is useful for when MDIO bus and some of Ethernet ports are
connected to a switch or some other MDIO device that doesn't behave
like a generic PHY and can't be probed via its PHY ID.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
Make of_property_get_value() public, so it can be used in other part
of the system.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
This adds a variant of of_unflatten_dtb() which uses the property data
directly from the input tree rather than copying it. This is mainly
useful for a single user: FIT images.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This adds support for const properties. We add a const void *value_const
to struct property which will not be modified. The value of a property
should no longer be used directly, but with the of_property_get_value()
accessor which picks the right value.
With this we can unflatten dtbs and use the property values directly
from the dtb instead of copying them. This is useful for device trees
which (ab)use properties to store huge data files, aka FIT images.
To create a property whose value is not copied but used from the
original input data we introduce of_new_property_const().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
| |
For our device tree fixups we have to find a node corresponding to
another node in another device tree. We used to use the full name
to match the nodes, but this falls apart when nodes get renamed
or for example a new bus hierarchy is introduced. To make this
more robust we create reproducible names from device nodes which
mostly depend on the address in MMIO space, the reg property and
as a last resort the name of the device node.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
on some SoCs we can use generic PLL and RAM initialization. In this
cases we create board file only to provide a host name.
With this patch host name will be created from device tree compatible.
For example:
compatible = "board_vendor,board", "chip_vendor,soc"
the host name will be:
"board"
This function will not overwrite a host name which is already set by
board or machine code.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
This patch adds an API to automatically enable either hardware components
with existing device drivers or i2c clients. All functions take a device
tree path to find the hardware and will fix up the node status in the
kernel device tree, if it's accessible.
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
| |
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
|commit 37786c7fee40771d13901de129af7e084ed48b55
|Author: Kevin Cernekee <cernekee@gmail.com>
|Date: Thu Apr 9 13:05:14 2015 -0700
|
| of: Add helper function to check MMIO register endianness
|
| SoC peripherals can come in several different flavors:
|
| - little-endian: registers always need to be accessed in LE mode (so the
| kernel should perform a swap if the CPU is running BE)
|
| - big-endian: registers always need to be accessed in BE mode (so the
| kernel should perform a swap if the CPU is running LE)
|
| - native-endian: the bus will automatically swap accesses, so the kernel
| should never swap
|
| Introduce a function that checks an OF device node to see whether it
| contains a "big-endian" or "native-endian" property. For the former case,
| always return true. For the latter case, return true iff the kernel was
| built for BE (implying that the BE MMIO accessors do not perform a swap).
| Otherwise return false, assuming LE registers.
|
| LE registers are assumed by default because most existing drivers (libahci,
| serial8250, usb) always use readl/writel in the absence of instructions
| to the contrary, so that will be our fallback.
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We already have of_find_path_by_node() which finds a device path
for a given device node. This is used by the state framework to
find its backend path. This path has to be translated back to
a device node when Linux is started. The current approach turned
out to be too simple: We assumed that the node path is the same
in the tree Linux is started with. This is not true in several
cases:
- partition nodes should have the name "partition@<offset>", but
in several trees they have "partition@<num>"
- There are two different partition bindings: The legacy binding
and the new one with an additional partitions subnode which has
a compatible = "fixed-partitions" property.
The node path only stays the same when the internal tree uses the
same bindings and node names as the tree Linux is started with.
To overcome this limitation we create of_find_node_by_devpath()
which converts the device path back to a device node. It does
so by finding the device node of the hardware device rather than
the partition node. It then parses over the partitions in this
device node with the known bindings looking for a partition which
matches in offset and size to the barebox partition.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
Move the fixup code where the parser code is already.
Since the code will not only be used for mtd in the future
drivers/of/ is a better place than drivers/mtd/.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
Setting a property to a string is used many times. Create a convenience
function for it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
This is for_each_matching_node for a given root similar to the other
..._from functions.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
| |
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
Added a function to register a fixup to enable or disable
device tree nodes.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
This is like of_property_for_each_{string,u32} but loops over a list
of phandles instead of strings or ints.
Returns the node the handle points to as that's generally more useful
than the handle value itself.
Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The existing iterator for_each_compatible_node() searches for each
compatible node starting from the root of the loaded device tree.
This means it only works on the barebox device tree and not the tree
to be passed to the Linux kernel, which is what an of_fixup would
probably want to use.
This adds for_each_compatible_node_from(), which takes an additional
parameter of a root to search from. This could be the device tree to
be used for the kernel. It could also be used to search just a
subtree.
Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
This patch adds the function of_find_path_by_node(), which is similar to
of_find_path(), but it translates a device tree node into a barebox device path
directly.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|