9
0
Fork 0
Commit Graph

2932 Commits

Author SHA1 Message Date
Markus Niebel 78b9e4e041 mci: add DSR support
The eMMC and the SD-Card specifications describe the optional SET_DSR command.
During measurements at our lab we found that some cards implementing this feature
having really strong driver strengts per default. This can lead to voltage peaks
above the specification of the host on signal edges for data sent from a card to
the host.

Since availability of a given card type may be shorter than the time a certain
hardware will be produced it is useful to have support for this command (Alternative
would be changing termination resistors and adapting the driver strength of the
host to the used card.)

Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-15 15:22:43 +01:00
Sascha Hauer a1aca01d62 bootm: introduce bootm_load_devicetree helper
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-14 12:36:06 +01:00
Sascha Hauer 76ccd96f4a bootm: introduce bootm_load_initrd helper
Make the bootm handlers simpler by factoring out an initrd load
function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-14 12:36:03 +01:00
Markus Niebel 98d5fd3915 mci: Support the correct version for eMMC
eMMC is available up to version 4.5 but the
correct version is not decoded. Change version
definitions to support more minor verions, add
missing versions and parse the minor versions from
ext_csd.

After this, card detection code and devinfo reports
correct versions.

Handling is inspired by u-boot code.

Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-10 14:56:58 +01:00
Sascha Hauer 9bd67f5e61 bootm: introduce bootm_load_os helper
The common bootm code used to load uImage contents to SDRAM
before calling into the handlers if possible. This makes the
handlers complicated since they have to handle many cases. Instead,
introduce a helper to load the os after the handlers have figured
out a good load address.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-10 11:53:18 +01:00
Sascha Hauer f1025bbf32 list: add list_first_entry_or_null()
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-10 11:52:04 +01:00
Alexander Shiyan 0039821dca ARM: i.MX51: Sync DT files with kernel
This patch includes update i.MX51 template and porting some barebox
DTS files to use new template.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-10 08:21:51 +01:00
Sascha Hauer 29b6d429f6 Merge branch 'for-next/video' 2014-01-07 11:57:52 +01:00
Sascha Hauer dd28a45d9d Merge branch 'for-next/usb-chipidea' 2014-01-07 11:57:52 +01:00
Sascha Hauer f1f5346975 Merge branch 'for-next/poller' 2014-01-07 11:57:51 +01:00
Sascha Hauer 32f9b1079a Merge branch 'for-next/misc' 2014-01-07 11:57:51 +01:00
Sascha Hauer c56fdbbc37 Merge branch 'for-next/miiphy' 2014-01-07 11:57:51 +01:00
Sascha Hauer 873b6b6892 usb: chipidea i.MX: remove unused pdata->init hook
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-07 11:13:58 +01:00
Antony Pavlov 8ffd4f8c74 miitool: change behaviour closer to linux' mii-tool
miitool without arguments will try to show status for all phys.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-06 09:42:29 +01:00
Antony Pavlov c2ffad8855 lib: fix whitespace, drop blank lines at EOF
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-06 09:24:22 +01:00
Sascha Hauer d7fe5e2263 mtd: Add subpagesize to mtd_info_user
ubiformat needs the subpagesize to work correctly. The kernel uses
sysfs to pass the subpagesize, but in barebox we have the possibility
to extend struct mtd_info_user. Add a corresponding field and use it
in ubiformat.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-20 15:04:30 +01:00
Sascha Hauer 8bec1f2f16 video: Add screen_size field
barebox does not need the screen size directly, but we pass the
framebuffer to Linux via simnplefb it is desirable to pass the
full size of the framebuffer. Default to calculated values from
the screen resolution.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-20 09:35:38 +01:00
Sascha Hauer 3c46c02c54 poller: Allow to call functions asynchronously
Sometimes execution of a function has to be delayed, for example
when a backlight can only be turned on when the picture has stabilized.
To help in such situations add a convenience function around the poller
stuff to call a function after a delay.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-18 16:47:48 +01:00
Sascha Hauer 6cb2b2f29f net: phy: implement detect callback for miibus devices
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-11 12:33:05 +01:00
Sascha Hauer bfc9a6985c net: phy: Track mii buses on a list
To be able to iterate over registered mii buses

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-11 12:32:20 +01:00
Sascha Hauer 33790253da net: phy: track registered state of a phy device
With this phy_device_connect only registers a phy device if it wasn't
registered already. This allows us to register phy devices outside
of ethernet drivers. phy_device_connect will now pick up an already
registered phy given that it's not attached to another ethernet device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-11 10:58:02 +01:00
Sascha Hauer 58f9167a04 net: phy: bail out early in phy_device_connect
If an ethernet device already has a phy in phy_device_connect all we
have to do is to start autonegotiation. Do this early and bail out
so that for the rest of the code it's clear that we have to search for
a phy device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-11 10:46:50 +01:00
Sascha Hauer ed039cd72b Merge branch 'for-next/omap-drivers' 2013-12-06 08:23:27 +01:00
Sascha Hauer 6d7fae1e97 Merge branch 'for-next/omap-devicetree-prepare' 2013-12-06 08:23:27 +01:00
Sascha Hauer e9ea6eeaab Merge branch 'for-next/misc'
Conflicts:
	scripts/Makefile
2013-12-06 08:23:24 +01:00
Sascha Hauer 18aa86831e Merge branch 'for-next/mips' 2013-12-06 08:22:48 +01:00
Sascha Hauer 0cb6f2c19e Merge branch 'for-next/imx' 2013-12-06 08:22:48 +01:00
Sascha Hauer 2789ccd18f Merge branch 'for-next/gpio' 2013-12-06 08:22:48 +01:00
Michael Grzeschik 1e7f2bd25c scripts: bareboxcrc32 as host and target userspacetool
This patch adds the crc32 command to be build
as host and optionally as target tool.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-04 17:17:06 +01:00
Antony Pavlov ddac4f3ea2 MIPS: add asm-offsets.h generation
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-04 17:01:11 +01:00
Sascha Hauer f92f309c54 device: Add functions to add resources
We currently have functions to add a device based on function parameters.
This adds the corresponding functions to add resources to a device without
registering the device itself. This is useful to manipulate devices before
registering them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-27 10:42:54 +01:00
Sascha Hauer 54f55d79d9 string: Add (x)memdup
It's a common task to duplicate some memory. Add (x)memdup functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-27 10:42:54 +01:00
Sascha Hauer 6d2f0d57be pinctrl: Add functions to select pinctrl from device_node
Instead of requiring a device pointer, add a functions to select
the pinctrl state based on a device node.
The AM33xx cpsw devicetree description has several subdevices with
pinctrl information attached to them. In barebox we do not handle
the subdevices as distinct devices, so the pinctrl is never configured
correctly and the mdio bus subdevice stops working. This patch makes
it possible to configure the pinctrl without having a device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-27 10:42:53 +01:00
Sascha Hauer bb7929aaaa of: gpio: Add Kconfig variable to depend on
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-25 09:01:33 +01:00
Sascha Hauer 1541c45500 dt-bindings: Add omap/am33xx pinctrl header file
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-22 14:24:02 +01:00
Sascha Hauer 7e548ef48f dt-bindings: Add gpio header file
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-22 14:24:01 +01:00
Antony Pavlov bcf0877266 gpiolib: import gpio_request_array() from linux 3.7
Also import related functions gpio_request_one() and
gpio_free_array().

This commit imports code from linux 3.7 as
the more recent linux kernel versions use gpiolib descriptors,
see this commit for details:

  commit 372e722ea4dd4ca11c3d04845e11cbc15f32144c
  Author: Alexandre Courbot <acourbot@nvidia.com>
  Date:   Sun Feb 3 01:29:29 2013 +0900

      gpiolib: use descriptors internally

      Make sure gpiolib works internally with descriptors and (chip, offset)
      pairs instead of using the global integer namespace. This prepares the
      ground for the removal of the global gpio_desc[] array and the
      introduction of the descriptor-based GPIO API.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-22 10:59:04 +01:00
Antony Pavlov 6339a419e9 gpio: unify gpio direction macros names with Linux kernel
See linux.git/include/linux/gpio.h and
linux.git/Documentation/gpio.txt for details.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-22 10:59:00 +01:00
Uwe Kleine-König 3bd7f80d8f mci: mxs: support overwriting the device name via platform data
The current implementation of the bootloader specification depends on the
hardware name and the name of the device in /dev to match. As the default
hardware name is mciX and the device name is diskY the bootloader spec
cannot be used as is.

This patch implements a way to overwrite the device name similar to what is
possible for the imx-esdhc driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-11 11:16:22 +01:00
Sebastian Hesselbarth feb1e38b43 clk: add of_clk_init and CLK_OF_DECLARE macro
This add barebox versions of of_clk_init for parsing and registering
clock providers from DT. Also, a macro CLK_OF_DECLARE is added, that
allows to put init callbacks into its own section that can be linked
in the binary.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-11 09:26:59 +01:00
Sebastian Hesselbarth cdab803eb5 asm-generic: add macro for BAREBOX_CLK_TABLE
This adds a macro for linker scripts to place DT clock provider table.
While at it, also add ALIGN(8) to DTB macro and fix a whitespace issue.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-11 09:26:59 +01:00
Sebastian Hesselbarth ed4348e8b2 gpiolib: add get_direction callback
At least for debugging purposes it is helpful to determine the current
direction for a given GPIO. Add a callback to gpiochip, to allow to
get it.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-11 09:02:07 +01:00
Sascha Hauer b67b2671c2 treewide: Add missing includes
A lot of files rely on include/driver.h including include/of.h (and
this including include/errno.h. include the files explicitly so we can
eventually get rid of including of.h from driver.h

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-08 15:42:04 +01:00
Sascha Hauer c803c74cb8 Merge branch 'for-next/spi' 2013-11-07 08:31:47 +01:00
Sascha Hauer ded25480d8 Merge branch 'for-next/rpi' 2013-11-07 08:31:47 +01:00
Sascha Hauer b8d20bf3fa Merge branch 'for-next/of' 2013-11-07 08:31:47 +01:00
Sascha Hauer 8be53ce2ab Merge branch 'for-next/net' 2013-11-07 08:31:47 +01:00
Sascha Hauer 398cdf212d Merge branch 'for-next/mtd' 2013-11-07 08:31:47 +01:00
Sascha Hauer 4c8221be2c Merge branch 'for-next/mci' 2013-11-07 08:31:47 +01:00
Andre Heider 97607e85cd video: set up the kernel's simple framebuffer driver
Add support to configure the active framebuffer for the kernel through
device tree.

Signed-off-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-06 10:37:24 +01:00
Sascha Hauer d7c1612d65 of: Add a context pointer to fixup functions
If drivers want to fixup their specific instance they need some context
to know which instance they have to fixup.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-06 10:24:46 +01:00
Andre Heider 485544f0fb fb: add a line_length value to struct fb_info
Add support for framebuffers with noncontiguous horizontal lines.

Video drivers can set this value if the hardware requires it.
In case a driver does not set it, the current value of
xres * (bpp / 8) is used instead.

Signed-off-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-06 09:59:04 +01:00
Sascha Hauer 21af7e0005 blspec: make cdev optional
the cdev for a given directory can be determined by get_cdev_by_mountpath().
Use this function and remove the cdev argument from blspec_scan_directory().
Also, export the function to make code possible which boots the bootloader
spec entries found in directories.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-05 08:37:55 +01:00
Sascha Hauer b7a66554dc fs: Add function to get cdev by mountpath
This is useful to know for the bootloader spec implementation.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-05 08:37:55 +01:00
Sascha Hauer d85c580eeb blspec: Let scan functions return the number of entries found
So that callers can detect whether entries are found or not.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-05 08:37:54 +01:00
Sascha Hauer a58d8ba424 blspec: rename _hwdevice functions to _devicename
Since it's not necessarily the hardware device this seems to
be a more appropriate name.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-05 08:37:54 +01:00
Sascha Hauer fd5b82e640 spi: Call spi_of_register_slaves from core
Makes individual handling of OF spi slaves unnecessary in the bus drivers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-31 12:53:05 +01:00
Sascha Hauer 0b58452e13 blspec: Fix crash with menu disabled
blspec->menu is only valid when menu support is enabled. Check for it
before dereferencing the pointer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-30 11:37:06 +01:00
Sascha Hauer d317b1bf85 mtd: Pass device_id to add_mtd_device
Right now we do not support persistent names for mtd devices. The
base name can be passed to add_mtd_device, but this is always appended
with a dynamic number. With this patch add_mtd_device takes a device_id
argument which can be used to create a mtd device with an exact name.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-29 09:10:21 +01:00
Markus Pargmann 5d3cb01271 net: phy: Add micrel KSZ8031
KSZ8031 is similar to KSZ8021. It can use the same functions.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-26 10:12:05 +02:00
Jean-Christophe PLAGNIOL-VILLARD 4d2d66fe52 add: mmci drivers
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-22 16:49:48 +02:00
Jean-Christophe PLAGNIOL-VILLARD ed78b8dbbc mci: add max_req_size support
Some controller such as the ARM AMBA pl181 can not handle more than 16bits
data length request.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-22 16:49:48 +02:00
Andre Heider 55f6869c33 common: add a macro to align an array on the stack
The macro can be used for temporary stack buffers which need to meet
a minimum alignment requirement.

This will be used by bcm2835 mailbox users, where all buffers need to
be aligned.

Signed-off-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-22 15:28:58 +02:00
Sascha Hauer 9101c2d02f of: simplify phandle lookup
Instead of populating an extra list containing all phandles just iterate
over the whole tree. This is done as preparation for more dynamic devicetrees
where parts are loaded at runtime. Here we don't want to keep the list of
phandles in sync.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-22 08:55:08 +02:00
Jean-Christophe PLAGNIOL-VILLARD 0d09ccdf75 fs: bpkfs: add missing include
was not include when applying bpkfs patch

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-21 09:13:51 +02:00
Sascha Hauer ef5dac9c2b Implement bootloader spec support for barebox
The Bootloader Specification describes a way how kernels can
be installed on devices and how they can be started by the bootloader.

The bootloader spec is currently supported by (x86) gummiboot and
by systemd which provides a kernel-install script. With the bootloader
spec it's possible for the Operating system to install a new kernel
without knowing about the bootloader and for the bootloader it's possible
to discover and start Operating Systems on a media without being
configured.

For more details about the spec see:

http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/

This patch adds barebox support for the spec. It enhances the 'boot'
command so that not only boot script names can be given, but also
devices containing bootloader spec entries. With this it's possible
to call the 'boot' command like: 'boot sd emmc net'. It would then
first look for bootloader spec entries on the (removable) sd card,
then, is nothing is found, on the internal emmc and if still
unsuccessful would call the 'net' bootscript.

The bootloader Spec currently doesn't specify which entry should be
default if multiple entries are found on a single device. Therefore
barebox currently has two extensions of the spec. The $BOOT diretory
can contain a file named 'default'. If present, the content of the
file is treated as a filename under $BOOT/loader/entries/ which is
used as default. Similarly if a file named 'once' is present, the
entry is started once and the file is removed afterwards. This is
useful for testing if a newly installed kernel works before making
it the default.

As on ARM and other Architectures a devicetree has to be specified
for the kernel, the 'devicetree' property is used to specify a
devicetree. Like 'kernel' and 'initrd' this also contains a pth
relative to $BOOT.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-14 14:04:20 +02:00
Sascha Hauer 1369bfd44f cdev: store dos partition type in struct cdev
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-14 14:04:20 +02:00
Sascha Hauer 51dce5facb add function to read single line files
Often small files are used to store the value od a variable. This
adds a function to easily read such a variable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-14 14:04:20 +02:00
Sascha Hauer 904298deb0 Merge branch 'for-next/socfpga'
Conflicts:
	scripts/Makefile
2013-10-07 08:02:24 +02:00
Sascha Hauer ebf9022f2e Merge branch 'for-next/rs485'
Conflicts:
	common/console_common.c
2013-10-07 08:02:14 +02:00
Sascha Hauer a293dc2753 Merge branch 'for-next/omap' 2013-10-07 08:00:39 +02:00
Sascha Hauer 01f37a992f Merge branch 'for-next/net'
Conflicts:
	arch/arm/boards/animeo_ip/init.c
2013-10-07 08:00:36 +02:00
Sascha Hauer d9870d782a Merge branch 'for-next/mount' 2013-10-07 08:00:28 +02:00
Sascha Hauer 33c56e21eb Merge branch 'for-next/misc'
Conflicts:
	commands/Makefile
2013-10-07 08:00:25 +02:00
Sascha Hauer 409885aaf3 Merge branch 'for-next/mci' 2013-10-07 08:00:16 +02:00
Sascha Hauer c26a46f0db Merge branch 'for-next/lzo' 2013-10-07 08:00:16 +02:00
Sascha Hauer 9aa6dd0270 Merge branch 'for-next/login'
Conflicts:
	include/console.h
2013-10-07 08:00:13 +02:00
Sascha Hauer bf8988d820 Merge branch 'for-next/fs'
Conflicts:
	fs/Kconfig
	fs/Makefile
2013-10-07 07:59:42 +02:00
Sascha Hauer 574947ef76 Merge branch 'for-next/console' 2013-10-07 07:59:18 +02:00
Sascha Hauer fb0c2ee1ae Merge branch 'for-next/bpkfs' 2013-10-07 07:59:18 +02:00
Sascha Hauer 0546e669a2 bootm: Replace getenv_loadaddr with getenv_ul
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-07 07:57:42 +02:00
Jean-Christophe PLAGNIOL-VILLARD 32d88d9a86 filetype: add Binary PacKage BPK type
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-06 13:26:51 +02:00
Jean-Christophe PLAGNIOL-VILLARD 6a5121f748 console: factorise function to get the first enabled console
rename it to console_get_first_active

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-06 13:19:46 +02:00
Sascha Hauer cd16227383 fs: add cdev mount helpers
Introduce helpers to iterate over cdevs and mount them to a known
path.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-30 16:03:02 +02:00
Sascha Hauer 5ee4ad2229 environment variables: introduce new helpers
This introduces some new environment variable helpers and updates
the existing ones. Newly introduced are:

getenv_bool: read a bool variable
getenv_ul: read an unsigned long variable
getenev_uint: read an unsigned int variable
getenv_nonempty: like normal getenv, but does return NULL instead of an
                 empty string

All new helpers take a pointer to the value. This value is only modified
when the variable exists. This allows the following programming scheme:

	unsigned int myvalue = sanedefault;

	getenv_uint("myvalue", &myvalue);

So without checking the return value myvalue contains the best possible
value.

getenv_ull is updated to this scheme.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-30 10:28:52 +02:00
Sascha Hauer 4dda27ce49 block: Collect block devices on list
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-30 10:18:39 +02:00
Sascha Hauer 666f12e0c1 introduce runtime loglevel
With this the verbosity of barebox can be controlled during runtime
using the 'loglevel' globalvar.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-29 12:15:40 +02:00
Sascha Hauer 7a1c5027f9 mount: implement -v option to print available filesystems
It's useful to know which filesystems a barebox binary supports.
Add a -v option to the mount command to find it out.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-29 12:11:14 +02:00
Sascha Hauer d915fcbc6d fs: remove unused field 'name' from struct fs_driver_d
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-29 12:11:14 +02:00
Sascha Hauer ecb3aaa23b fs: cleanup backingstore handling
All filesystem drivers which need a backingstore device do the same
ignoring of '/dev/' in the backingstore followed by a cdev_open. Add a
helper function for it and let the core handle the cdev. As a side
effect this makes sure that fsdev->cdev is also set when a device is
mounted without the leading '/dev/' which was previously ignored
by the mount code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-29 12:11:14 +02:00
Jan Weitzel c988b8bf7f i2c-omap: Update driver
The driver didn't work well with at24 driver. NACKS are lost.
Errors are lost in isr due to the local variable err. Also we didn't wait for
bus free in omap_i2c_xfer_msg.

Fix issues and get other improvements from linux kernel

Tested on OMAP4 and AM335x

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-27 16:24:37 +02:00
Jean-Christophe PLAGNIOL-VILLARD 12158a28d4 fs: add uimagefs
this will provide the image data and information via file

 # ls -l /tmp/
-rwxrwxrwx          3 arch
-rwxrwxrwx         12 compression
-rwxrwxrwx         16 name
-rwxrwxrwx          5 os
-rwxrwxrwx         24 time
-rwxrwxrwx         12 type
-rwxrwxrwx         10 load_addr
-rwxrwxrwx         10 entry_point
-rwxrwxrwx    2199875 data0
-rwxrwxrwx    2199875 data
-rwxrwxrwx         10 data.crc

if it's multi image

 # ls -l /tmp-multi/
-rwxrwxrwx          3 arch
-rwxrwxrwx         12 compression
-rwxrwxrwx         16 name
-rwxrwxrwx          5 os
-rwxrwxrwx         24 time
-rwxrwxrwx         16 type
-rwxrwxrwx         10 load_addr
-rwxrwxrwx         10 entry_point
-rwxrwxrwx       1292 data0
-rwxrwxrwx        983 data1
-rwxrwxrwx       2287 data
-rwxrwxrwx         10 data.crc

you can get the image header via an ioctl on any file
UIMAGEFS_METADATA

if you want to check the crc do

 # crc32 -f /tmp-multi/data -V /tmp-multi/data.crc
CRC32 for /tmp-multi/data 0x00000000 ... 0x000008ee ==> 0x88d5a0db

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-27 10:39:56 +02:00
Sascha Hauer 361f2db766 bootstrap: Add missing include
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-26 12:29:53 +02:00
Sascha Hauer eacd5e7cc3 usb: make usb devices children of the corresponding host
To be able to find usb devices in the hardware tree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 18:38:22 +02:00
Jean-Christophe PLAGNIOL-VILLARD 9adf567789 console: introduce new callback set_mode
so we can set the port in rs485 mode

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:21:40 +02:00
Jean-Christophe PLAGNIOL-VILLARD 050f0d5978 console: introduce console_get_by_dev
so we can get console by it's device

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:21:40 +02:00
Jean-Christophe PLAGNIOL-VILLARD 14e8e0a421 shutdown: add board call back
so if we need to do something switch in the board we can fill this function
pointer (as example on Animeo IP shutdown some rs232 & rs485)

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:21:40 +02:00
Sascha Hauer 68e6eceae9 bootm: Add dryrun support
This adds support for checking the bootm command without actually booting.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:03:18 +02:00
Sascha Hauer b15c5eeecf bootm: separate bootm input data and internal data
We used to use struct image_data as the central data structure for bootm and
also as the input data structure. This makes it unclear which of the fields
are actually input data. This patch creates a struct bootm_data which is
exclusively used for input data to make usage clearer.

Also it moves the dispatching of multifile uImage pathnames to the core bootm
code so that the core code gets more flexible and the command code simpler.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:03:18 +02:00
Sascha Hauer fc5923d975 bootm: move getenv_loadaddr from command to common
getenv_loadaddr may be used by other code, so move it
from command/ to common/

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:03:18 +02:00
Sascha Hauer 19ea38a004 clk: of: introduce of_clk_src_simple_get
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-23 08:40:31 +02:00
Sascha Hauer 47974cac82 bootstrap: Add missing include
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-23 08:39:55 +02:00
Jean-Christophe PLAGNIOL-VILLARD 3293c860ab introduce helper to generate mac address with OUI
use random mac address with fixed OUI provided

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-22 20:27:12 +02:00
Jean-Christophe PLAGNIOL-VILLARD e7aab5c844 lzo: update to lzo-2013
take from linux next-20130227
same version as v3.11

before

-rwxr-xr-x 1 root root 123001 Feb 28 01:04 build/highbank/arch/arm/pbl/zbarebox.bin

after

-rwxr-xr-x 1 root root 122226 Feb 28 01:02 build/highbank/arch/arm/pbl/zbarebox.bin

smaller and faster

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-22 16:48:46 +02:00
Jean-Christophe PLAGNIOL-VILLARD 7e6b99fd09 smc91111: add fixup for qemu phy support
as today qemu does not support phy, it will return always 0x0 to any read
on the mii bus. So the phy_id is 0 and the link is donw.

To have the norwork running on versatilpb & other qenu board for the link up
at 100Mbps.

Only enable if qemu_fixup is set.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-22 16:48:03 +02:00
Jean-Christophe PLAGNIOL-VILLARD e62d425517 console: drop f_caps and check the function pointer getc/putc instead
None of the driver make the difference between STDOUT and STDERR.
So we just need to check if putc or getc are filled in the console_device

save 32 bytes on versatilepb

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-21 09:59:16 +02:00
Jean-Christophe PLAGNIOL-VILLARD 892c005849 login/passwd: add default password support
even if the env is broken you will have a password

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-19 08:49:51 +02:00
Jean-Christophe PLAGNIOL-VILLARD bb89ea62a0 login: disable input console if password wrong
so we guarantee that barebox is secured again user interaction

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-19 08:49:47 +02:00
Jean-Christophe PLAGNIOL-VILLARD 50355554dc globalvar: add globalvar_add_simple_int/bool/enum/ip support
so we can types var

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-18 09:24:38 +02:00
Jean-Christophe PLAGNIOL-VILLARD 56ee5d3aac process_escape_sequence: add support to \$?
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-18 09:17:13 +02:00
Sascha Hauer c6c3afb3eb mci: add designware mmc controller support
Based on the U-Boot driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-11 12:20:02 +02:00
Sascha Hauer c7278cc625 net: designware: Add decvicetree support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-09 14:15:01 +02:00
Sascha Hauer 7f6b6d25d8 Merge branch 'for-next/omap'
Conflicts:
	arch/arm/boards/pcm051/env/config
2013-09-05 10:40:04 +02:00
Sascha Hauer 1729b1798e Merge branch 'for-next/boardinfo'
Conflicts:
	arch/mips/boards/qemu-malta/init.c
	commands/bootm.c
	drivers/of/base.c
2013-09-05 10:39:22 +02:00
Sascha Hauer e147a7e2bb Merge branch 'for-next/misc' 2013-09-05 10:38:31 +02:00
Sascha Hauer 10169a04ca Merge branch 'for-next/of' 2013-09-05 10:37:54 +02:00
Renaud Barbier da19582070 of: base: import of_find_node_by_type
Import of_find_node_by_type from Linux drivers/of/base.c -
commit id d8dfad3.
This function retrieves a node pointer based on the "device_type"
property of the node.

This is used by device tree update functions in PPC support.

Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-05 10:27:51 +02:00
Sascha Hauer 4960dc9db0 rework debug_ll
Convert to static inline functions and use lower case letters for function
names. Also, include mach/debug_ll.h when an architecture provides support
for debug_ll, not only when it's actually enabled. This allows architecures
to put some UART initialization code into mach/debug_ll.h which is compiled
out when debug_ll is disabled.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-05 10:15:48 +02:00
Sascha Hauer 88e132b2a8 Merge branch 'for-next/ubifs' 2013-09-05 10:11:54 +02:00
Jan Weitzel f958ffb3cd net/phy: support of mmd register read and write
Add function for indirect access of the mmd registers, based on linux.
phy_read_mmd_indirect
phy_write_mmd_indirect

Also clean some private mmd functions

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-31 12:01:32 +02:00
Sascha Hauer 774580c2bd Make hostname available to C Code
The boards often have a sane default for the hostname. Provide a C
function for setting/getting it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-16 08:40:37 +02:00
Sascha Hauer 775ba3c093 introduce barebox_set_model
Instead of calling of_get_model() in barebox_get_model() add a
barebox_set_model() and use it to set the boardinfo once it's
available from the devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-16 08:40:37 +02:00
Sascha Hauer b986f4f1ee remove remaining references of CONFIG_BOARDINFO
With this all code uses barebox_get_model() and no longer
a compile time generated string.

Also this renames barebox_boardinfo() to barebox_get_model()
since we are going to add the corresponding _set_ function
and 'model' corresponds to the devicetree notion.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-16 08:40:37 +02:00
Sascha Hauer 016082f85e globalvar: Allow to set initial value
Calling globalvar_add_simple() and setting a value is more than common.
Add a parameter for the initial value.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-16 08:40:33 +02:00
Sascha Hauer 938c76198f globalvar: add missing include
include/globalvar.h needs struct param_d, so include <param.h>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-14 12:29:48 +02:00
Sascha Hauer 6c9e799a00 of: introduce some new helpers
of_get_tree_max_phandle - get the maximum phandle of a tree. Needed for
                          creating new phandles without conflicts.
of_node_create_phandle - create a phandle for a node which doesn't have one.
of_find_node_by_alias - find a node by alias name
of_find_node_by_path_or_alias - find a node by full path or alias name
of_find_root_node - find the root node for a given device node

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-14 10:03:28 +02:00
Sascha Hauer 50e8902c0e Add deflate_decompress function
Needed to implement decompressors for gzip without headers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-07 08:44:48 +02:00
Sascha Hauer bbaa8f1bb6 extend barebox wrapper header
Add empty definitions for mutexes, spinlocks and other stuff from
the kernel to make it easier to reuse code from the kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-07 08:44:48 +02:00
Sascha Hauer be442d717e move print_hex_dump function to include/common.h
print_hex_dump is a standard kernel function, so move it outside
the ubi header files to make it usable for other code derived from
the kernel aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-07 08:44:48 +02:00
Sascha Hauer 8fb48927da mtd: ubi: Add support for opening a volume by cdev
Needed by ubifs support.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-07 08:44:48 +02:00
Sascha Hauer d9abbe8d01 filetype: Add ubifs detection
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-07 08:44:48 +02:00
Sascha Hauer df6494123f Merge branch 'for-next/serial' 2013-08-05 12:50:09 +02:00
Sascha Hauer fbf082b565 Merge branch 'for-next/of'
Conflicts:
	arch/arm/boards/freescale-mx53-loco/board.c
	drivers/of/Makefile
2013-08-05 12:50:06 +02:00
Sascha Hauer feefc3ef3b Merge branch 'for-next/mtd' 2013-08-05 12:49:58 +02:00
Sascha Hauer 9ebb0554cd Merge branch 'for-next/misc' 2013-08-05 12:49:58 +02:00
Sascha Hauer f1355b4f57 Merge branch 'for-next/mfd' 2013-08-05 12:49:58 +02:00
Sascha Hauer 07afe7d0e0 Merge branch 'for-next/marvell'
Conflicts:
	arch/arm/boards/Makefile
	arch/arm/dts/Makefile
2013-08-05 12:49:55 +02:00
Sascha Hauer b1aae799f9 Merge branch 'for-next/lz4' 2013-08-05 12:49:46 +02:00
Sascha Hauer eb5565f003 Merge branch 'for-next/driver' 2013-08-05 12:49:31 +02:00
Sascha Hauer 50f75a1a0e UBI: reimport UBI from Linux v3.10
This is a fresh UBI import from Linux v3.10

This is done mainly to get fastmap support.

This was tested with the i.MX nand driver, the MXS nand driver and
on CFI NOR flash.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-25 10:24:16 +02:00
Sascha Hauer 10f7528afb UBI: remove old ubi support
To update to the latest UBI support from the Kernel first remove
the old UBI support. Without it the update will be even less reviewable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-24 07:17:01 +02:00
Sascha Hauer f483f66e6d memory_display: Change address pointer to type const void *
No need to force a width of the pointer, so use void *. Also it's
not modified in memory_display, so also add a const.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:32:06 +02:00
Sascha Hauer 5cd4fd8fba dma: apbh: Turn into a driver
This converts the apbh driver into a real driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:14 +02:00
Sascha Hauer 322d96e29d dma: apbh: remove CONFIG_ARCH_DMA_PIO_WORDS
This define allows to overwrite DMA_PIO_WORDS with an architecture
specific value. Since this is unused and not clean anyway remove
it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:13 +02:00
Sascha Hauer 3d75e777af dma: apbh-dma: move header file to common location
As the apbh dma engine is also found on i.MX6 move the header file
out of MXS specific directories.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:13 +02:00
Sascha Hauer ca13a84ac2 ARM: MXS: introduce stmp device support
MXS specific devices have some common infrastructure in the kernel
known as STMP devices. We have the same in barebox, but with a
mxs_ prefix instead of a stmp_ prefix. As some STMP devices are
also found on i.MX6 move the common infrastructure out of MXS
specific files and use the stmp_ prefix.

This is done in preparation for i.MX6 NAND support.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:13 +02:00
Sascha Hauer 66891566cc mtd: nand: update to v3.11-rc1
This updates the NAND stuff to Linux-3.11-rc1. It is synchronized
as best as we can get:

- locks removed
- The splitting in different files we had to better support different
  features has been dropped. Instead this is now done mostly with the
  use of __maybe_unused

Some barebox adjustments are forward ported, like:

- Allow partial page writes
- Optionally allow to erase bad blocks
- check for all_ff before writing a page

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:13 +02:00
Sascha Hauer 38438d4a0f serial: ns16550: remove f_caps from platform_data
So far no user had the need to set the flags, so just remove them
from platform data.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 08:28:31 +02:00
Sascha Hauer cdd1de46ff clk: provide static inline wrappers
So that drivers can use clk_* functions without having to ifdef
them away.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 08:28:02 +02:00
Sascha Hauer 69f3d6c93b mtd: introduce mtd_read_oob and mtd_write_oob
Directly copied from the Kernel as of 3.11-rc1

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-22 16:14:16 +02:00
Sascha Hauer d155610821 mtd: introduce ecc strength
This introduces the ecc stength fields in the structures and fills
them in, but leaves them unused right now.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-22 16:14:08 +02:00
Sascha Hauer b445152396 string: introduce memchr_inv
Directly taken from Linux Kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-22 16:13:58 +02:00
Sascha Hauer bdfd6a629c mtd: sync bbm.h with Linux Kernel
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-22 16:13:53 +02:00
Sascha Hauer 8dbf2821e9 mtd: rename MTD_OOB_* to MTD_OPS_*
To sync with the Linux kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-22 16:13:49 +02:00
Sascha Hauer e49d260ba7 memory_display: Change address pointer to type const void *
No need to force a width of the pointer, so use void *. Also it's
not modified in memory_display, so also add a const.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-22 12:16:26 +02:00
Hubert Feurstein ed8e6f17a5 include/printk: fix level of pr_err and pr_warning
The level of pr_err and pr_warning were interchanged.

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-22 09:33:22 +02:00
Sascha Hauer 874f318037 Add configurability via devicetree
This adds the possibility to configure the place for the environment
from the devicetree and to partition devices from the devicetree.

Configuration has the general form of devices with a regular compatible
property. This allows to later add additional drivers or drivers with
different behaviour (for example to add support for redundant environment).

The configuration is all in the /chosen/barebox/ hierarchy of the
devicetree. This separates the configuration from the hardware
description. Also it makes it possible to store the configuration
in a completely separate devicetree (or devicetree overlay). For
the same reason all configuration is done using nodepathes rather
than phandles.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-18 13:54:38 +02:00
Sascha Hauer 3ae902ed7f of: Add convenience functions to en/disable devicenodes
These functions allow to manipulate the "status" property of
devicenodes effectively enabling/disabling devices.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-18 13:54:23 +02:00
Sascha Hauer aa9e85c555 of: add mtd of helpers
Directly taken from the kernel

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-16 08:46:30 +02:00
Kyungsik Lee cdc837f4d9 lib: Add support for LZ4-compressed kernel
This patch adds support for extracting LZ4-compressed kernel images,
as well as LZ4-compressed ramdisk images in the kernel boot process.

This depends on the patch below
decompressor: Add LZ4 decompressor module

Signed-off-by: Kyungsik Lee <kyungsik.lee@lge.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-16 08:24:30 +02:00
Kyungsik Lee e944e7f810 decompressor: Add LZ4 decompressor module
This patch adds support for LZ4 decompression in the Linux Kernel.
LZ4 Decompression APIs for kernel are based on LZ4 implementation
by Yann Collet.

LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
LZ4 source repository : http://code.google.com/p/lz4/

Signed-off-by: Kyungsik Lee <kyungsik.lee@lge.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-16 08:24:30 +02:00
Sascha Hauer 0ee203186d cdev: add device_find_partition
device_find_partition allows to find a partition of a device with
a particular name.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 11:16:14 +02:00
Sascha Hauer 2672c906a4 cdev: allow to open a struct cdev
cdev_open() opens a cdev by name. This introduces cdev_do_open which
allows to open a cdev when the cdev is already found by other means.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 11:16:09 +02:00
Sascha Hauer bec70b3aaa cdev: introduce partition names
currently most partition cdevs have the name <devname>.<partname>
This makes it hard to find a partition by <partname>. This introduces
a partname field in struct cdev so that.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 11:16:04 +02:00
Sascha Hauer abf95154f5 of: partitions: factor out function to parse a single partition
To make it usable for other code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 11:15:59 +02:00
Sascha Hauer f57a85985b of: export of_default_bus_match_table
For code which wants to call of_platform_populate.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 11:15:52 +02:00
Sascha Hauer 121c3d6e9c devfs: let devfs_add_partition return the new partition
Useful for unregistering later or for adding addional flags.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 11:15:47 +02:00
Alexander Shiyan d93a43c8fc mfd: mc13xxx: Add support for MC34708
This patch moves support for MC34708 PMIC into mc13xxx driver.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 10:19:36 +02:00
Alexander Shiyan 7bc400d14c base: Transform "platform_match" into "device_match" and make this function public
This change will allow reuse this function for other buses.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 10:08:10 +02:00
Sebastian Hesselbarth cf31688b6a OF: base: rename of_free to of_delete_node
of_free is misleading about the actual purpose of the function. There is
already a of_create_node counterpart, so rename of_free to of_create_node
and update all users accordingly.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-05 08:26:57 +02:00
Sebastian Hesselbarth 3c84ded0f5 OF: remove device and resource pointer from struct device_node
struct device_node has its own resources and a pointer to associated
device_d. With recent platform related OF code, we can convert the
only user of it and remove those pointers from struct device_node.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-05 08:26:57 +02:00
Sebastian Hesselbarth 61bb8bfc7c OF: gpio: convert DT based gpio handling to new OF API
This creates a Linux OF API compatible counterpart of of_get_named_gpio_flags.
Existing of_get_named_gpio is converted to a static inline function, which is
in the corresponding of_gpio.h include. While at it, drivers/of/gpio.c is
also renamed to drivers/of/of_gpio.c to follow the of_ prefix naming scheme.
The new include is also added to existing users of of_get_named_gpio.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-05 08:26:57 +02:00
Sebastian Hesselbarth 483424e027 OF: import bus/device related functions from Linux OF API
This imports some bus and device related functions from Linux OF API
with some modifcations for Barebox.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-05 08:26:57 +02:00
Sebastian Hesselbarth 6fbaab1085 OF: base: move OF_ROOT_NODE_ defines to local OF code
OF_ROOT_NODE_* defines should not be used outside of base.c. Move them
to drivers/of/base.c to ensure they will not be used elsewhere.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-05 08:26:57 +02:00
Sebastian Hesselbarth bfc5605e2f OF: convert of_translate_address to new API
This converts existing of_translate_address to recently added API. In
contrast to existing behavior, the new function honors ranges properties
properly. It now allows reg properties to be set as offset with respect
to the correspoding parent node.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-05 08:26:57 +02:00
Sebastian Hesselbarth d0a6aaea6a OF: import address related functions from Linux OF API
This imports drivers/of/address.c from Linux with some minor modifications.
of_translate_address is not yet enabled and PCI and ISA related bus translations
have not been imported. Also, a corresponding include header is created with
prototypes and non-OF function stubs.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-05 08:26:57 +02:00
Lucas Stach 10a06ed554 clk: allow to instanciate clk mux without registering it
Allows to reuse clk mux code within other clocks.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-02 08:36:09 +02:00
Lucas Stach 98a2fe8f95 clk: allow to instanciate clk gate without registering it
Allows to reuse the clk gate code within other clocks.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-02 08:36:09 +02:00
Lucas Stach b0d851d951 clk: add clock lookup from devicetree
Taken from the Linuxkernel with some small adjustments for barebox.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-02 08:36:09 +02:00
Sascha Hauer 8afe2cb4d4 Merge branch 'for-next-manual/oftree-linux-sync' 2013-07-02 07:08:46 +02:00
Sascha Hauer 12657cb99e Merge branch 'for-next/usb' 2013-07-01 10:14:40 +02:00
Sascha Hauer 55e87e07c1 Merge branch 'for-next/ppc' 2013-07-01 10:14:40 +02:00
Sascha Hauer 1ca699d081 Merge branch 'for-next/of' 2013-07-01 10:14:40 +02:00
Sascha Hauer b83536bdb9 Merge branch 'for-next/mxs' 2013-07-01 10:14:40 +02:00
Sascha Hauer 939c2173a3 Merge branch 'for-next/multi-image' 2013-07-01 10:14:40 +02:00
Sascha Hauer 85b427ffed Merge branch 'for-next/misc' 2013-07-01 09:37:37 +02:00
Sascha Hauer 87ed8c0456 Merge branch 'for-next/menu' 2013-07-01 09:37:37 +02:00
Sascha Hauer 44ebe21a33 Merge branch 'for-next/memtest' 2013-07-01 09:37:37 +02:00
Sascha Hauer be1ebac429 Merge branch 'for-next/mci'
Conflicts:
	arch/arm/boards/ccxmx51/ccxmx51js.c
	arch/arm/boards/dmo-mx6-realq7/board.c
2013-07-01 09:37:35 +02:00
Sascha Hauer 33a6e99a38 Merge branch 'for-next/imx'
Conflicts:
	drivers/usb/imx/chipidea-imx.c
2013-07-01 09:37:04 +02:00
Sascha Hauer d2fcbe0690 Merge branch 'for-next/bootm' 2013-07-01 09:32:04 +02:00
Renaud Barbier e06aa06965 common: DDR2 SPD checksum.
The code calculates the DDR2 SPD checksum as per JEDEC standard
No 21-C Appendix X (revision 1.2)

The code is based on the equivalent files from U-Boot version
git-a71d45d.

Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-27 08:38:04 +02:00
Sascha Hauer e1bbf6be90 ARM: Add image end section
In the upcoming multi image build process we will cat images together.
To find the concatenated image we need to reliably find the end of the
current binary. This adds a dummy section at the end of a pbl binary.
Its only purpose is to mark the end of the image. The multi image
patches will add something to this section so that it doesn't get
discarded by the linker.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-26 23:43:19 +02:00
Sascha Hauer 8d2762ff56 driver: implement device_detect_by_name function
It becomes a common pattern for boards to find a device and
call device_detect on it. Add a convenience wrapper for it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-26 18:17:12 +02:00
Sascha Hauer 2177c1c20c mfd: mc34708: provide static inline wrapper
If the driver is disabled provide a static inline wrapper for
mc34708_get() to prevent linker errors.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-26 10:35:46 +02:00
Sascha Hauer 0686fe0edf add function to get boardinfo string
When using devicetrees the boardinfo (or model) can be obtained
from the devicetree. Add a function to get the boardinfo so that
we have a chance to add information from the devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-24 21:39:07 +02:00
Sascha Hauer 8f5889eb0a usb: implement a usb_host_detect to scan individual USB hosts
Currently we can only (re)scan all USB hosts. Add a function to
scan individual hosts. This is useful for implementing the detect
callback in the next patch.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-21 07:41:38 +02:00
Sascha Hauer 31879ed96f usb: move scanned status into core
A command should not be interested in the internal USB core state, so
move the state handling into the core.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-21 07:41:32 +02:00
Sascha Hauer a6d4345e1b ata: ide: embed ata_ioports into struct ide_port and export it
Embedding struct ata_ioports into struct ide_port saves us an allocation.
Making it available to client drivers is necessary to give them access
to struct ata_port which is needed in the next patch.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-21 07:40:36 +02:00
Sebastian Hesselbarth 1e2a238145 OF: base: cleanup base function include
This cleans up include/of.h by moving some function prototypes below
CONFIG_OFTREE and provide bogus stubs for !CONFIG_OFTREE.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:22:19 +02:00