ENV_HANDLING is usable even without explicit loadenv/saveenv command
support. Instead of selecting this option from loadenv/saveenv, make
this option visible. loadenv/saveenv can then depend on ENV_HANDLING
rather than selecting it. This reduces Kconfig dependencies hassles.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Currently global environment variables are only enabled when the
"global" command is enabled. In fact, they could be used even with
the "global" command disabled, so make the GLOBALVAR option visible.
While at it, add a help text for this option.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Implement simple adapter function to serve as a hook for 'devinfo'
command.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
of_tree_for_each_node_from() is supposed to iterate over all DT nodes
after the one pointed by the from parameter, but with the current
of_next_node() implementation we cannot access the root node.
Patch of_next_node() to point to root_node when from is NULL.
Doing that also simplifies users of of_tree_for_each_node_from() which
were duplicating the logic to point to the root_node when from is NULL.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
State support does not need OF_BAREBOX_DRIVERS and never did, so drop
the dependency there. It's the state driver which needs of_find_path(),
since this symbol now is always enabled when OF is enabled, we don't
have to add the dependency to the state driver, but instead can depend
on OFDEVICE. We could depend on OF instead, but compiling the state
driver without OFDEVICE makes no sense.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
of_find_path() is a OF specific library function, so always
compile it when OF support is enabled.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
It looks like comma operator was accidentaly used instead of regular
semicolon. Fix this to avoid confusing future readers of the code.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
In a number of places print_field_ge_v7() and print_field() function
would call sprintf() without providing is with appropriate output
buffer (str is initialized to NULL). Replace the sprintf() with
basprintf() to fix that.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Remove information about DATA from help text.
Signed-off-by: Andreas Geisenhainer <Andreas.Geisenhainer@atsonline.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Now that we can use set_bits/clear_bits in the DCD tables, add support
for this in the imx-usb-loader aswell.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
- print write_memory message only in verbose mode, but in all
cases when memory is written
- print more information about the DCD section just executed
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The i.MX SoCs support setting bits and clearing bits in their DCD table.
This adds commands for these in the imx-image tool.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Move imx6_pcie_reset_phy() near the other PHY related functions in the
file. This is a cosmetic change, but also allows to do the following
changes without introducing needless forward declarations.
[Andrey Smirnov: port to Barebox codebase]
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Simplify a trivial if-return sequence by combining it with a preceding
function call.
The semantic patch that makes this change is available in
scripts/coccinelle/misc/simple_return.cocci.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Rename imx6_pcie_start_link() to imx6_pcie_establish_link() to follow the
convention of other DesignWare-based host drivers. No functional change.
[Andrey Smirnov: port to BB codebase]
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Pratyush Anand <pratyush.anand@gmail.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
I.MX6+ version of the silicon exposed PCIe core's reset signal as a bit
in one of the control registers. As a result using old, pre-i.MX6+,
reset sequence on i.MX6+ leads to Barebox hanging during startup. Using
exposed reset bit instead solves the problem.
This commit is based on portions of commit
c34068d48273e24d392d9a49a38be807954420ed
in http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Port of_match_device() and of_device_get_match_data() from Linux kernel
code.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Instead of manualy flipping the bits call imx6_pcie_assert_core_reset()
to give the code, executing after BB, a clean slate. This also makes the
function match similar code in Linux kernel driver.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This allows to instantiate devices from an oftree and so allows
to select the console using /chosen/stdout-path.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
After doing a 'saveenv' command, it is no longer possible to boot.
The reason for this behaviour is that the 'barebox' partition has
currently
a size of 0x80000 (512 kB), which is not sufficient to store the barebox
binary. This causes the 'barebox' and 'barebox-environment' partitions
to overlap.
Fix this problem by increasing the size of the 'barebox' partition and
by placing the 'barebox-environment' right after it.
This patch increases the barebox partition for all i.MX boards to
0xe0000
Reported-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The LT variant has a different compatible, yet we want to run the
code on this variant aswell. Add the corresponding test.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Partition names shouldn't be continuously numbered, instead the part
behind the '@' should match the reg property. Fix this for all ARM
device trees.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
This makes it possible to compile the fastboot gadget without
command support. While at it bail out when ubiformat is not
compiled in.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This is the final step to separate the ubiformat code from the
command. With this the ubiformat code gains a C API.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
FLEXIBLE_BOOTARGS also works without command support being enabled.
Move this option from commands/Kconfig to common/Kconfig so that
it doesn't depend on COMMAND_SUPPORT.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
CONFIG_FITIMAGE is the variable to depend on, not
CONFIG_CMD_BOOTM_FITIMAGE which is only a wrapper option to
let CONFIG_FITIMAGE select from the bootm Kconfig menu.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Factor out the code out of the main function to a ubiformat function
to separate the command code from the ubiformat functionality.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Instead of using a static global context data struct, pass the
data around. This is a first step to create a C API for ubiformat.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Some dts files for the Kernel specify a reserved memory area using the
/memreserve/ dtc directive. These entries get lost during
unflattening/flattening the device tree and are never passed to the
Kernel.
This patch fixes this behaviour. This is done by copying the entries
into a /memreserve node in the unflattened tree and moving them back
during flattening the tree. The entries added by barebox dynamically
are appended to the static entries from the original dtb.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch fixes memory detection on the Digi ccxmx53 board.
Also updates dts to support nand.
Cleaned up whitespace?
Signed-off-by: Jason Cobham <cobham.jason@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The callers of get_kernel_addresses() are not interested in the
spacing after the kernel image, they are interested in the
place where they can put device tree and initrd, so pass
a pointer to mem_free to get_kernel_addresses().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Move the call to sdram_start_and_size() into get_kernel_addresses() and
remove the now unnecessary parameter mem_start.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When an ARM kernel is built with CONFIG_EFI enabled, then the
kernel image also looks like a EXE file. Move ARM zImage detection
before EXE detection so that the kernel is still detected as zImage.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
fixes: 81737c1 mtd: Fix erasing of devices >4GiB
Several places erased a complete flash partition passing ~0 as count to
erase(). With the above commit count to erase was changed from an unsigned
type to a signed type, so the (count > f->size - offset) check in
erase() no longer triggers and the ~0 count is no longer adjusted to the whole
device size. Among other things this results in saveenv failures on NOR
flashes.
This patch fixes this by introducing an explicit macro for erasing the
whole device which is tested for in erase(). All other negative values
are rejected.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Giorgio <giorgio.nicole@arcor.de>
add vi like key support:
j: down
k: up
<Space>: select
Signed-off-by: Du Huanpeng <u74147@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We have defined stdin, stdout and stderr as integer file descriptors,
but normally they should be FILE *. Also fprintf, fputc and fputs take
file descriptors instead of FILE *. As FILE * are inconvenient in the
barebox environment replace the f* functions with the corresponding d*
functions. dprintf is POSIX conform whereas dputc and dputs are barebox
specific, but do not conflict with any stdc function. fgetc is unused
and can be removed without replacing it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We have a shortcut for fprintf(stderr, so use it. This is done to
be able to remove fprintf in the next step.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The function we have implemented as getc has the semantics of the
standard function getchar, so rename it accorgingly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This moves the function prototypes in include/fs.h which also exist
in the libc to the locations they would have in libc.
With this it becomes easier to share code between barebox and userspace
since the usual libc include files will exist. Also users of the libc
functions no longer have to include the barebox internal fs.h header.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
As a utility function for file handling make_directory() is well
suited for libfile. Move it there.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Our asprintf and vasprintf have different prototypes than the glibc
functions. This causes trouble when we want to share barebox code
with userspace code. Change the prototypes for (v)asprintf to match
the glibc prototypes. Since the current (v)asprintf are convenient
to use change the existing functions to b(v)asprintf.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>