I'm not sure but I guess we don't need defined(__I386__) check.
I kept it for now.
Signed-off-by: Masaki Muranaka <monaka@monami-ya.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We often encounter the situation where slow devices should not be
probed during startup since probing is slow and maybe unnecessary
for unused devices. With MMC we have the 'probe' device parameter,
for ata we have the same, for USB we have the 'usb' command. Overall
this is not very consistent.
With MMC there is the additional problem that the probe parameter
is attached to the logical device when we often have the information
which physical device we want to probe.
This patch adds a 'detect' callback for devices and adds a command
to detect devices and to list the devices which are actually detecable.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Some drivers use blk->ops->read/write. This bypasses the caching block
layer and was never intended like this. The upper API to the block layer
is the cdev layer. This patch adds block_read and block_write functions
and uses them where appropriate.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This adds several missing includes to files under include/ which
we relied on being included implicitly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Without devicetree support we print the Kernel commandline in
verbose mode. Do the same with devicetree boot aswell.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Since the info is device specific and not driver specific, attach
the callback to the device. This makes it possible to have a info
callback for a device which does not have a driver attached.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Some MMC cards support boot partitions. These are special regions
on the MMC card intended to put a bootloader on.
This patch adds support for these partitions, they are accessible
as /dev/diskx.boot[0|1].
Additionally the partitions can be configured bootable using a
device parameter. This can be used to mark the user area or one
of the boot partitions as bootable.
Since this feature is mostly seen on eMMC cards it is made optional
to lower the size impact for boards which do not have eMMC.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We recently gained helper functions for different types of
device parameters. One thing missing was a helper for an
enum type parameter. This patch adds this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Some parameters may wish to provide some information about their
meaning or possible values. Provide an info callback for parameters.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We already have a possibility to register a MAC address provider
based on a ethernet device id. This adds a similar functionality
for devices probed from devicetree. Code can register itself to
be a MAC address provider for a certain devicetree node.
This helps on i.MX to let the IIM unit provide a MAC address for
the FEC.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
this fix the problems introduced when detecting non ONFI flashes in
commit 4c2bdc8728
"nand_base: detect more ONFI flash"
Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch separates out the "generic" memory
segment registration function (of_add_memory_bank())
from of_add_memory().
The MIPS architecture has different view on memory
resources than the ARM and PPC architectures
so the "generic" of_add_memory_bank() is
unusable for the MIPS architecture.
We can add MIPS-specific of_add_memory_bank()
into arch/mips code.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This is a massively stripped down pinctrl support. The upper API
consists of only of:
int pinctrl_select_state(struct device_d *dev, const char *state);
This is used to setup the pinmux for a device to a certain state.
This function normally does not need to be called manually. The
device core will setup the default state before probing a device.
The pinctrl core has the job of handling the devicetree. It parses
the pinctrl phandles for a device from devicetree, finds the correct
pinctrl device and calls its set_state callback with the pinctrl
setup device node.
The simplicity of this pinctrl framework comes from the fact that
we:
- Limit usage to devicetree only for now. For non devicetree use the
old legacy SoC specific APIs still can be used.
- Do not parse the devicetree into internal data structures which
are used by the drivers later. This adds the overhead that we
may parse the devicetree multiple times for more dynamic setups,
but on the other hand we do not need to parse devices from the
devicetree we don't use in barebox
- Do not detect resource conflicts. Since the framework mainly is
a devicetree parser this would be hard to implement. It should
be easy for board maintainers to avoid resource conflicts though.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
pass a struct cdev instead of the cdev name to of_parse_partitions.
This is available to the caller anyway and makes it easier to use
additional stuff from the cdev (like knowing whether it's a mtd
device).
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We do not have usb_driver_unregister function, so remove this declaration.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
memory_display is a function which should generally be available.
Currently it depends on memory command support being compiled in,
so move the function to a separate file.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The memory commands all use open_and_lseek and mem_parse_options. Export
them to be able to split the memory commands into separate files.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Rather than storing the parameters globally and trying to keep them
in sync with the device parameters, store the parameters in the ethernet
device directly. Also, update to dev_add_param_ip().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This adds convenience functions for directly registering integers
and bools as device parameter. This way driver no longer have to
fiddle with string handling. The format used to print the parameter
is passed to the functions to be able to print parameters in a
flexible way.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
of_get_phy_mode to parse the phy mode from the devicetree and
of_get_mac_address to parse a MAC address from the devicetree.
Directly taken from the Kernel.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add a C interface to set and get the bootsource instance:
int bootsource_get_instance(void);
void bootsource_set_instance(int instance);
Also export the shell variable "bootsource_instance".
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch seperates the imx independent from the arch independent code. The
following functions and enums are renamed:
- imx_bootsource() -> bootsource_get()
- imx_set_bootsource() -> bootsource_set()
- enum imx_bootsource -> enum bootsource
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The macb/gem core is used by the Zynq SoC. In preparation of sharing
the macb driver between at91 and Zynq, rename the platform data to
'struct macb_platform_data', and move the definition to a common
location.
Signed-off-by: Josh Cartwright <joshc@eso.teric.us>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Commit 51f2ded17c ("param: make return
value of param getter function const") made the parameter getter const,
but neglected to change the dev_add_param() function prototype in the
!CONFIG_PARAMETER case.
Fixes the following warning with CONFIG_NAND and !CONFIG_PARAMETER:
drivers/mtd/nand/nand_base.c: In function 'add_mtd_nand_device':
drivers/mtd/nand/nand_base.c:1720:2: warning: passing argument 4 of 'dev_add_param' from incompatible pointer type [enabled by default]
include/param.h:59:19: note: expected 'char * (*)(struct device_d *, struct param_d *)' but argument is of type 'const char * (*)(struct device_d *, struct param_d *)'
Signed-off-by: Josh Cartwright <joshc@eso.teric.us>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add basic support for the Xilinx Zynq-7000 EPP architecture.
The Zynq-7000 is an embedded processing platform that combines a Cortex A9
dualcore MPSoC with an Artix-7 FPGA.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This allows us to better detect whether a clk is enabled or not.
- If we can ask a clk, ask it. If it's enabled, go on and ask parents
- If we can't ask it, but it can be enabled, depend on the enable_count.
if it's positive, go on and ask parents
- If we can't ask it and it cannot be enabled, assume it is enabled
and ask parents.
This makes the CLK_ALWAYS_ENABLED unnecessary, since the fixed clk now
always returns 1 in its is_enabled callback.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
struct bus_type contains an embedded struct device_d which is quite
a big structure. Dynamically allocate this instead to save the space
in the binary.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch extends device_platform_driver macro, so now we allow
use it with various init levels and subsystems.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add rules to generate dtb files from dts/dtsi files,
optionally run the source files through the preprocessor.
Also add a rule to generate object files to include in
the barbox binary.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch adds support for system controller register driver (SYSCON).
Code taken from Linux Kernel and adapted for using in barebox.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch adds helpers to define resources, such as
DEFINE_RES_NAMED, DEFINE_RES_MEM and DEFINE_RES_MEM_NAMED.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch adds generic memory-mapped GPIO controller support.
Code taken from Linux Kernel and adopted for barebox.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
ata device usually take a long time to spin up, so it makes sense
to only spend this time when the device is actually used.
This adds a logical ata device and attaches a 'probe' parameter
to it, similar to what MMC does.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
__pr_printk is a define which uses a local variable 'ret'. This
means that whenever someone does a pr_*("ret: %d\n", ret);
ret will be 0.
Fix this by writing this without a local variable.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This makes it possible to modify the tree in the handlers.
This is necessary because the initrd addresses are only
known inside the handlers, but not to the generic bootm
code.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
With this every devicetree is first converted to the barebox internal
format before it's converted back to dtb again.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
OFDEVICE decides whether or not we compile in support for probing
devices from the devicetree. Let the user decide this explicitly.
This makes the oftree, of_node and of_property commands independent
of devicetree device support since being able to manipulate
devicetrees has nothing to do with probing devices from the devicetree.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
In order to be able to handle multiple devicetrees, do not assume
the tree to be unflattened is the barebox internal one. Instead,
just return a pointer to it and assign the barebox internal root_node
external to the unflatten function.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The allnodes list makes it hard to handle multiple devicetrees. Having
a list to iterate over all nodes of a tree is still good to have though.
This patch uses the list_head of the root node as the head of the list.
This way the root node is no longer part of the list, but when iterating
over a tree the root node is not interesting anyway.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This file is present in current kernels. In order to get closer
to current mtd support introduce it for barebox aswell.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
While erasing bad blocks is a potentially dangerous operation
it is sometimes needed during development or when some foreign
code has touched the flash.
This patch adds a device parameter 'erasebad' to allow erasing
bad blocks. Since this is not wanted during production this is
behind a Kconfig option.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This allows us to have some NAND specific stuff during registration,
like for example adding NAND specific device parameters.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The problem was introduced in
commit 51885a7d73
Author: Sascha Hauer <s.hauer@pengutronix.de>
Date: Thu Jun 28 09:56:23 2012 +0200
Change byte order detection mechanism to kernel style
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The roundup_pow_of_two function is making use of __roundup_pow_of_two
when the call to __builtin_constant_p fails, which is not implemented in
barebox.
Copied the code from Linux log2.h header.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
do not try to read the status in force mode
the link is up
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
- heavily copied from register_persistant_environment which was
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Do not write pages which only contain 0xff. UBI expects pages which
seem empty to be writable. This got lost with:
| commit 3139c3e9a6
| Author: Sascha Hauer <s.hauer@pengutronix.de>
| Date: Thu Nov 29 11:16:40 2012 +0100
|
| mtd core: call driver write function with complete buffer
|
| mtd->write is supposed to loop around pages internally, no need
| to do this in mtd_write. This fixes a huge write performance drop
| with the m25p80 driver when it was converted to a mtd driver recently.
| Since mtd->writesize is 1 for this driver mtd_write ended up doing
| single byte writes on the flash.
Introduce mtd_all_ff as a global function since UBI currently has its own
implementation.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add pread and pwrite functions.
Split read and write functions to save some space.
The functions pread and pwrite saves and sets the file
position to a given offset and restore them afterwards.
This also makes the nandtest command use these function
which is necessary to not break compilation for the nandtest
command.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch provides rename MFD-related symbols for using MFD-prefix.
Additionally, sorting mfd/Kconfig and mfd/Makefile records.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
form linux 3.8
so you can have part by num or name
not by GUID as this is a non human reading name
`---- ffe08000.sata
`---- 0x00000000-0x3fffffff: /dev/ata0
`---- 0x00100000-0x063fffff: /dev/ata0.0
`---- 0x00100000-0x063fffff: /dev/ata0.boot
`---- 0x06400000-0x3fefffff: /dev/ata0.1
`---- 0x06400000-0x3fefffff: /dev/ata0.linux
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
GPT need to be check before MBR
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
need it by upcoming EFI GPT support
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
__dev_printf is a define which uses a local variable 'ret'. This
means that whenever someone does a dev_*(dev, "ret: %d\n", ret);
ret will be 0.
Fix this by writing this without a local variable.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This adds USB gadget support to the i.MX chipidea driver. Basically
we have to add a register function to the fsl udc driver and call
this from the chipidea driver if device mode is selected.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The Kernel has mtd_read, mtd_write, mtd_erase and mtd_block_markbad.
Add these functions to barebox aswell to make future mtd synchronizations
with the kernel easier.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The kernel nowadays has mtd_read/write and other functions. In
barebox we also have these functions, but with a different prototype,
namely they correspond to the libmtd userspace functions. Rename
these functions to libmtd_* to avoid name clashes with future mtd
updates.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Some controllers need an init hook after the USB controller is
started, so implement the post init hook for i.MX.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
so when the first stage booloader of firmware provide the dtb
we can use it to probe the memory
also allow to print what we probe
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
device_platform_driver() - Helper macro for drivers that don't do
anything special in module registration. This eliminates a lot of
boilerplate. Driver registration will called on device_initcall.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
so we can use it on vexpress to detect the hardware mapping
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add the initrd start and end address to the DT, code comes from u-boot.
Signed-off-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
detect the cpu model to dynamise the periphs mapping
currently only tested on qemu but should work on real hardware
Cortex-A9
if you use 1GiB of ram you can run the same barebox on Cortex-A15 or Cortex-A9
otherwise use vexpress_ca9_defconfig where the TEXT_BASE is at 0x63f00000
when we will add the relocation support this defconfig will be drop
qemu/arm-softmmu/qemu-system-arm -M vexpress-a9 -m 1024 -smp 1 -kernel build/vexpress/barebox -pflash build/vexpress/flash0 -nographic
Cortex-A15
qemu/arm-softmmu/qemu-system-arm -M vexpress-a15 -m 1024 -smp 1 -kernel build/vexpress/barebox -pflash build/vexpress/flash0 -nographic
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Change getopt optstring parameter type to const char *.
Also change type to const char * of tmp variable which
pointed to optstring. This will only handle readonly.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Defining STACK_BASE and MALLOC_BASE only makes sense when
either CONFIG_MEMORY_LAYOUT_DEFAULT or CONFIG_MEMORY_LAYOUT_FIXED
is set, so use separate #ifdefs instead ot #if/#else
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This IP is present on the at91sam9 until the sam9g45, on the sam9x5 we use a
new IP.
This driver is based on the linux one.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
With this the files can give more context to their pr_* messages by
specifying a
at the beginning of the files. Basically the same mechanism as in the
Kernel.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Currently there is no common way for the mci host driver to tell
that thee car is write protected. This adds a card_write_protected callback
which is used by the framework to tell whether it's protected or not.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
this will allow to have no console support
Use full for bootstrap as we can save 6.5 KiB (barebox.bin) and
3.8 KiB (zbarebox.bin lzo) on at91sam9263 as example vs console simple
As on bootstrap we have often very limited size.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This will allow to have a generic code to create different bootstrap
As example
Barebox as TI Xloader
Barebox as AT91 Bootstrap
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
to detect if it's a barebox for the current running arch
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
include/environment.h is no longer necessary to build scripts/bareboxenv,
so remove its inclusion.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
environment.h is for environment variables, not for the environment
storage (envfs), so move the prototypes to envfs.h
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Currently Kconfig dependencies are used to allow non-interactive builds.
This leads to problems in Kconfig getting the dependencies right.
This patch adds a barebox_main function pointer which is called at the
end of the startup process. This defaults to run_shell when a shell is
enabled.
With this the HAVE_NOSHELL Kconfig variable can be removed. Non interactive
builds can now be enabled for every board allowing to compile a binary
without further Kconfig dependencies. This also allows for more flexibility,
for example boards may decide to try non-interactive startup first and
call run_shell if that fails.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Currently there is no common way for the mci host driver to tell
that there is no card present. This adds a card_present callback
which is used by the framework to tell whether it's present or not.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
of_new_node now takes the parent node and the name as argument and
creates a new node. This simplifies the caller and also makes the
function useful for others, so export it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This adds a function to delete a property from the currently loaded
devicetree. Also export new_property as of_new_property.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
barebox_fdt should once become the pointer to the barebox internal
devicetree. Since barebox has its own internal devicetree format
this was never used. remove it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We already have support for unflattening the devicetree. This patch
adds support for converting it back to a dtb.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add barebox-data section in arm branch to get complete
barebox regions in sdram regions tree.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add PAGE_ALIGN_DOWN macro, which is like PAGE_ALIGN macro but
returns the lower page boundary of address.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
PAGE_ALIGN macro is needed to align addresses to page boundaries.
Move this macro to another PAGE_* defines.
Commands which uses remap_range function needs this macro.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The process of unflatten the device tree is known from the kernel,
so rename the function, because that's what it does.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
- Add missing prototype for of_free()
- When root node is freed set root_node to NULL
- (re)scan aliases after freeing a node. This is necessary because
the freed node may be an alias or point to an alias
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Currently the bootm code uses of_fix_tree to apply the fixups
to the devicetree given on the command line. This function assumes
that there is enough space for the fixups available. Also on ARM
we have to make sure the tree does not cross 1Mib boundaries.
This patch moves the space allocation and alignment ensurance
to of_get_fixed_tree and uses it in bootm. This is the first
step for making of_get_fixed_tree the single point of devicetree
handling in barebox.
of_get_fixed_tree now takes an argument of the input fdt. If it is
given, this one is used, otherwise an internal oftree is used which
will be created in subsequent patches.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This command works like the corresponding Unix shell command and
is used for adding, multiplying and much more.
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Both include/string.h and include/stringlist.h define the c preprocessor macro
__STRING_H. This leads to a compile time error, in case both files are
(indirectly) included.
Rename the macro to __STRINGLIST_H in stringlist.h.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
as today if no request or free provided do not complain
if the gpio is not request auto requested at first use
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Based on mtd-utils and stripped down to needed functionality and
reworked to barebox interfaces.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Imported from mtd-utils and stripped down to needed functionality.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Imported from mtd-utils and stripped down to needed functionality.
Add prefix to functions so we have a clean namespace.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
mtd-utils have a few macros for printouts. Provide the wrappers to make
it easier to import them.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Needed for ubiformat, we are interested in image_seq especially.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We have two versions in the tree. Use the newer one, and put it into the
mtd directory while we are at it.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Copy over the latest version from u-boot which handles bigger sizes now
and does arithmetic with shifts instead of divisions.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When multiple MMC/SD cards are present in the system we often
have to have persistent names to identify them during runtime.
This patch allows to overwrite the devicename which is used.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Make the register defines for ULPI more complete. Also, Add a proper
ULPI_* Namespace to the existing defines.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
For proper USB function the usbmisc registers have to be initialized.
This patch adds a driver which matches for the usbmisc registers. This
driver is called from a new driver which binds to the USB ports to
configure the misc registers. After that the driver registers the EHCI
driver and an ULPI transceiver if necessary. Currently only host mode
is supported, but device support can be added later.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The EHCI core often is part of a otg core. Allow it to be registered
separately from another driver.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When starting a network device wait until the link is up. Otherwise
autobooting does not work with little timeout and several attempts
have to be made until the network is finally up.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
dev_add_child is a very unsafe function. If called multiple times
it allows setting the same device to different parents thus corrupting
the siblings list. This happens regularly since:
| commit c2e568d19c
| Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| Date: Sat Nov 3 16:11:05 2012 +0100
|
| bus: add bus device
|
| automatically add it as parent of any bus device if none already specified
|
| we have now a nice output per bus
If for example a FATfs is mounted this nice output per bus often ends with:
> `---- fat0
> `---- 0
> `---- 0x86f0000087020031-0x86f000410df27124: /dev/<NULL>
> `---- sram00
> `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
> `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
> unable to handle NULL pointer dereference at address 0x0000000c
> pc : [<87f08a20>] lr : [<87f08a04>]
> sp : 86eff8c0 ip : 87f3fbde fp : ffffffff
> r10: ffffffff r9 : 00000000 r8 : 00000003
> r7 : 86f075b8 r6 : 00000002 r5 : ffffffec r4 : 86f07544
> r3 : 00000000 r2 : 43f900b4 r1 : 00000020 r0 : 00000005
> Flags: Nzcv IRQs off FIQs off Mode SVC_32
> [<87f08a20>] (do_devinfo_subtree+0x90/0x130) from [<87f08a90>] (do_devinfo_subtree+0x100/0x130)
>
> [<87f3e070>] (unwind_backtrace+0x0/0x90) from [<87f28514>] (panic+0x28/0x3c)
> [<87f28514>] (panic+0x28/0x3c) from [<87f3e4b8>] (do_exception+0x10/0x14)
> [<87f3e4b8>] (do_exception+0x10/0x14) from [<87f3e544>] (do_data_abort+0x2c/0x38)
> [<87f3e544>] (do_data_abort+0x2c/0x38) from [<87f3e268>] (data_abort+0x48/0x60)
This patch fixes this by adding a device to its parents children list in
register_device so that dev_add_child is no longer needed. This function
is removed from the tree. Now callers of register_device have to clearly
set the parent *before* registering a device.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Jan Lübbe <jlu@pengutronix.de>
Currently we only support oldschool IDE SFF devices. This is done
by registering a register layout struct and everything else is done
by the generic IDE SFF driver. Since modern ATA devices still use
ATA, but not the SFF interface anymore, split out the IDE SFF support
to a separate file to allow for other types of ata interfaces.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
putc already is a regular barebox function. To avoid conflicts and
confusions just let architectures define PUTC_LL directly instead
of going through this addiotional redirection.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Pass the buffer size to the file detection code. This makes sure we do not
read past the buffer. This is especially useful for ext filesystem detection
as the magic is at byte offset 1080. Also introduce a FILE_TYPE_SAFE_BUFSIZE
define which is set to the minimum bufsize the detection code needs to detect
all known filetypes.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Current barebox clk framework allow disable any clock
and there is no means to prevent that.
But there are the clocks that can't be disabled
by software at all.
This patch allow registration of a clock immune to clk_disable().
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This implements two new options for the loadenv command:
-s: removes (scrubs) old directory contents to be able to
create a fresh environment from for example /dev/defaultenv
-n: no overwrite. Do not overwrite existing files. This allows
to keep parts of the old environment.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
so we now create the cdev via mtd
This will also simplify sync with linux
to avoid the m25p8000 or m25p00 the cdev is still named name m25p and the
drivers m25p80
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
if board need specific phy fixup they can register it and then the code will
executed only if needed
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This will expect a driver to be specified
This is needed by the phylib the probe the generic phy if not driver found
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
those led can have 2 colors but one at a time otherwise they are black
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>