9
0
Fork 0
Commit Graph

2932 Commits

Author SHA1 Message Date
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
Sebastian Hesselbarth 2e2265bfd4 OF: base: convert and remove device_node_for_nach_child
Remove device_node_for_nach_child and convert users to corresponding
imported OF API functions.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 21:22:19 +02:00
Sebastian Hesselbarth 097133af15 OF: base: remove of_find_child_by_name
With of_get_child_by_name from Linux API, we can now convert and remove
of_find_child_by_name.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:22:15 +02:00
Sebastian Hesselbarth e520a8cc46 OF: base: remove of_tree_for_each_node from public API
This patch converts users of of_tree_for_each_node to recently added
for_eacg_compatible_node helper. Also of_tree_for_each_node is removed
from public OF API.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:20:55 +02:00
Sebastian Hesselbarth 2fe4a860eb OF: base: import property iterators from Linux OF API
This imports of_prop_next_u32, of_prop_next_string, and the corresponding
for_property_for_each_ helpers from Linux OF API.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:20:55 +02:00
Sebastian Hesselbarth a0b6c0d00a OF: base: introduce property write for bool, u8, u16, and u64
This adds functions to set an array of or a single value for bool,
u8, u16, and u64 properties.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:20:54 +02:00
Sebastian Hesselbarth 511ba46157 OF: base: import parse phandle functions from Linux OF API
This imports of_parse_phandle_with_args and of_count_phandle_with_args
from Linux OF API. The slightly different of_parse_phandles_with_args
is removed and all users are converted to reflect the API change.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:20:54 +02:00
Sebastian Hesselbarth 083995f815 OF: base: import of_parse_phandle from Linux OF API
This imports of_parse_phandle from Linux OF API.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:20:54 +02:00
Sebastian Hesselbarth 1d68e58532 OF: base: import of_property_read_* helpers from Linux OF API
This imports of_property_read_* helpers from Linux OF API to allow
to read all kinds of properties.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:20:54 +02:00
Sebastian Hesselbarth 234be066c1 OF: base: import parent/child functions from Linux OF API
This imports of_get_parent, of_get_next_available_child, and
of_get_child_by_name and corresponding helpers from Linux OF API.
of_get_next_child is not imported but implemented as list iterator
instead. Also, of_get_child_count and of_get_available_child_count
are introduced.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:20:54 +02:00
Sebastian Hesselbarth b45e2c0b47 OF: base: import of_find_node_with_property from Linux OF API
This imports of_find_node_with_property and corresponding helpers
from Linux OF API.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:20:54 +02:00
Sebastian Hesselbarth 8b362a690b OF: base: import of_find_matching_node_and_match from Linux OF API
This imports of_find_matching_node_and_match and corresponding helpers
from Linux OF API.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:20:54 +02:00
Sebastian Hesselbarth 464c393507 OF: base: import of_find_compatible_node from Linux OF API
This imports of_find_compatible_node and corresponding for_each_compatible_node
helper from Linux OF API.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:20:54 +02:00
Sebastian Hesselbarth f8a1e2a5fd OF: base: import of_find_node_by_name from Linux OF API
This imports of_find_node_by_name and corresponding for_each_node_by_name
helper from Linux OF API.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:20:54 +02:00
Sebastian Hesselbarth 80fc31dac3 OF: base: rename of_node_disabled to of_device_is_available
According to ePAPR 1.1 spec, device tree nodes status can be either
"okay", "disabled", "fail", or "fail-sss". Barebox already has a function
to check for "disabled" nodes, while Linux checks for "okay" or "ok".
To synchronize Barebox and Linux OF APIs, rename of_node_disabled to
of_device_is_available and check for "okay" instead of "disabled" as it
also makes "fail"ed devices unavailable.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 21:20:54 +02:00
Sebastian Hesselbarth 0b79c3bb64 OF: base: sync of_find_node_by_path with linux OF API
Barebox of_find_node_by_path requires a node to be passed as start node
to start searching. Linux OF API does not pass this node and no current
user of it in barebox is passing anything else than the root node.
Therefore, we rename current function to of_find_node_by_path_from and
introduce a Linux OF API compatible of_find_node_by_path that always
passes the current root_node. Also, all current users of that function
are updated to reflect the API change.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 21:20:50 +02:00
Sebastian Hesselbarth 905f3ee7fb OF: base: sync of_find_property with linux OF API
To start synchronizing OF API of barebox with linux OF API, this adds
a length pointer to of_find_property. Also all current users of that
function are updated to reflect the API change.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 17:18:01 +02:00
Sebastian Hesselbarth 03e0e78bf6 OF: base: convert strcmp to default string compare functions
Barebox compares compatible, node names, and property names with strcmp.
Linux by default compares compatible and node names with strcasecmp. To
avoid inconsitencies between Barebox and Linux dts files, we convert to
these default string compare functions.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 17:17:54 +02:00
Sebastian Hesselbarth e7c057974e OF: base: export of_alias_scan
To prepare clean-up of OF API, we need to export of_alias_scan.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 17:17:50 +02:00
Sebastian Hesselbarth 196be5c776 lib: string: import case-insensitive string compare
This imports strnicmp, strcasecmp, and strncasecmp from Linux to barebox.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2013-06-20 17:17:32 +02:00
Sascha Hauer dee6282fbf mci: Use tran_speed field to fix highspeed MMC card clock
The tran_speed field as decoded from csd is valid in most cases,
so use it to determine the maximum clock we can support. It is
not valid though for MMC highspeed cards, in this case the
csd contains invalid values and we have to set tran_speed explicitly
to the maximum speed. As the values passed into mci_set_clock are
now based on tran_speed we no longer have to limit the rate to
tran_speed in mci_set_clock.

The (intended) effect of this patch is that highspeed MMC cards are
no longer limited to non highspeed rates.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 16:18:16 +02:00
Sascha Hauer 2ab4c0869e mci: provide static inline function for mmc_host_is_spi
To prevent compiler warnings like:

warning: unused variable 'host'

When CONFIG_MCI_SPI is disabled.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 16:18:16 +02:00
Sascha Hauer 680df77174 clk: add prototype for clk_is_enabled
On MXS we need to poll the busy bit when changing a clock rate, but only
when the parent clocks are enabled. This exposes the already present
function clk_is_enabled which is suitable for this job.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 08:49:55 +02:00
Sascha Hauer 707fb7ada5 clk: gate: Add inverted gate support
This adds support for gates which need 0 to enable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 08:44:22 +02:00
Sascha Hauer c7e41dac4f clk: divider: Add onebased divider support
In some dividers the register value matches the divider value. This
patch adds support for them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 08:44:22 +02:00
Sascha Hauer 2d2ec6619b read_file: Make it work on tftp servers which do not pass size
Some tftp servers (for example netkit-tftp) do not pass the filesize.
Add a workaround for read_file which reads the file into a temporary
file which then is copied to a buffer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 08:42:46 +02:00
Sascha Hauer 7d58f3f346 bootm: factor out code to make it usable from C
Much of the bootm code is implemented in the command itself. Move
it to a common place to be able to call it from C aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-19 22:57:39 +02:00
Sascha Hauer f890ea69be Fix gotoXY argument order
gotoXY has the argument order (y, x). Change this so that usage of this
function feels more natural.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-19 22:45:14 +02:00
Sascha Hauer 2093884040 ata: ide: Allow to set the devicename
To get persistent devicenames under /dev/ allow to set the
devicename from the driver instead of using "ata" unconditionally.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-19 18:48:36 +02:00
Sascha Hauer 6883fc4378 ata: implement detect
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-06 09:42:16 +02:00
Sascha Hauer 7ffc9df31d ata: move ATA_ID_ fields and functions to include/
We need ata_id_has_lba48() in another C file, so move
the ATA_ID_* stuff to include/ata_drive.h like in the Linux
Kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-06 09:42:16 +02:00
Alexander Aring 3275c7ea43 common: add memtest.c with mem_test routine
Add mem_test routine. Useful to detect timing problems if someone
porting a new device to barebox. This test includes a data bus test,
address bus test and integrity check of memory.

This mem_test routine has as parameter start and end address of testing
space. The last parameter can skip the integrity check.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-05 22:54:35 +02:00
Alexander Aring 49686838a9 common: add ALIGN_DOWN macro
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-05 22:54:34 +02:00
Alexander Aring 71218359af common: fix codestyle in ALIGN macros
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-05 22:54:34 +02:00
Sascha Hauer f696692b87 net: Set mac-address property
Linux normally has no idea how to retrieve MAC Addresses, but instead
expects the MAC address in the devicetree. This patch adds the MAC
address to the devicetree for Linux if we find a valid one in barebox.
This mechanism is limited of course to devices barebox has a driver for
and which are probed themselves from the devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-05 08:53:43 +02:00
Sascha Hauer 2302fc6076 mci: rename capabilities flags
Use MMC_CAP_ names instead of MMC_MODE_. This makes it more
clear that these are capabilities of host/card and do not refer
to the current mode. These are in line with the Linux Kernel
except for MMC_CAP_MMC_HIGHSPEED_52MHZ which could be fixed
later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-03 10:59:53 +02:00
Masaki Muranaka fbb12b3b9e Fix typo.
This fix is harmless and obvious.

Signed-off-by: Masaki Muranaka <monaka@monami-ya.jp>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-03 10:07:47 +02:00
Masaki Muranaka af5c5c8fb2 Remove ftstc(). It is declared but not implemented.
Signed-off-by: Masaki Muranaka <monaka@monami-ya.jp>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-03 09:16:11 +02:00
Sascha Hauer eedf216ac7 Merge branch 'for-next/usb-chipidea' 2013-06-02 16:28:34 +02:00
Sascha Hauer 1f23a43924 Merge branch 'for-next/of-i2c' 2013-06-02 16:28:34 +02:00
Sascha Hauer 5f56c35060 Merge branch 'for-next/of' 2013-06-02 16:28:34 +02:00
Sascha Hauer 08f2dda59f Merge branch 'for-next/mips'
Conflicts:
	include/of.h
2013-06-02 16:28:31 +02:00
Sascha Hauer 8f9044927d Merge branch 'for-next/mci'
Conflicts:
	include/driver.h
2013-06-02 16:28:21 +02:00
Sascha Hauer 064fdcec9f Merge branch 'for-next/imx-oftree'
Conflicts:
	arch/arm/boards/freescale-mx51-pdk/board.c
2013-06-02 12:36:38 +02:00
Sascha Hauer 5e7f855847 Merge branch 'for-next/block' 2013-06-02 12:35:47 +02:00
Sascha Hauer df1dcc057e Merge branch 'for-next/misc' 2013-06-02 12:24:56 +02:00
Masaki Muranaka 9bdc30075f Enables to build bootm command on generic_x86.
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>
2013-06-02 11:21:10 +02:00
Sascha Hauer ea9c911b8f mci: Add devicetree helper function
This adds helper code to parse the bus-width and max-frequency
property from devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 18:19:11 +02:00
Sascha Hauer 76e4198d89 usb: i.MX chipidea: Add overcurrent disable flag for i.MX6
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 15:55:58 +02:00
Sascha Hauer b1a4a659c6 i2c: Add devicetree support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 15:53:11 +02:00
Sascha Hauer 75ea5f1c0f of: Add of_modalias_node function
Directly from the Kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 15:53:11 +02:00
Sascha Hauer dffbe91e8b mci: implement detect driver callback
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 12:32:10 +02:00
Sascha Hauer 95e7982f99 devices: add detect mechanism
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>
2013-05-31 12:32:05 +02:00
Sascha Hauer e82e40523f block: implement block_read/block_write functions
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>
2013-05-31 09:34:48 +02:00
Sascha Hauer f79343dec4 block: remove unused read_start and read_done ops
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 09:23:48 +02:00
Sascha Hauer b381e781bf treewide include/: Add missing includes
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>
2013-05-31 08:32:59 +02:00
Sascha Hauer b5167ee51c bootm: print Kernel commandline in verbose mode
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>
2013-05-31 08:32:37 +02:00
Sascha Hauer bec599e5a0 usb: Add devicetree helpers
Add helpers to get the dr_mode and the phy_mode.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:48:01 +02:00
Sascha Hauer 1f0a3175ec of: Add of_alias_get function
This is used to retrieve the name of the alias for a given
devicenode.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:28 +02:00
Sascha Hauer 895c0bee6e mci: embed mci device into struct mci
To safe a separate allocation and to make the code simpler.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:28 +02:00
Sascha Hauer 73b0d228e5 driver: Attach info callback to device, not to driver
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>
2013-05-30 12:18:27 +02:00
Sascha Hauer 4a4f2f20b8 mci: Add support for MMC boot partitions
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>
2013-05-30 12:18:27 +02:00
Alexander Shiyan 425bf8b5c9 ARM: OMAP MCI: Move TWL6030 power initialization into OMAP directory
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:27 +02:00
Sascha Hauer a6afae76f1 param: Add helpers to provide an enum parameter
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>
2013-05-23 15:40:26 +02:00
Sascha Hauer c5fa299862 param: Add info function
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>
2013-05-23 15:40:22 +02:00
Sascha Hauer 04fdd75d8a of: provide NULL of_get_root_node for \!CONFIG_OFTREE
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-23 15:10:07 +02:00
Sascha Hauer ab02b5a68d Merge branch 'for-next/of-misc' into for-next/imx-oftree 2013-05-23 09:19:13 +02:00
Sascha Hauer fe85ff4761 treewide: Fix typo seperate -> separate
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-21 21:38:21 +02:00
Sascha Hauer 2995752d75 net: Add of_register_ethaddr
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>
2013-05-21 09:36:27 +02:00
Sascha Hauer 0cb87c4d1e of: Add of_match_node function
To match a of_device_id arrays against a device_node. Same functionality
as in the kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-20 15:53:06 +02:00
Eric Bénard ae6f751117 nand_base: sync flash detection functions with linux 3.9's code
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>
2013-05-17 07:42:54 +02:00
Antony Pavlov 74c4acea0d of: separate out "generic" memory bank adding
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>
2013-05-13 21:17:10 +02:00
Antony Pavlov 2924294da1 gpio: fix typos
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-12 12:30:34 +02:00
Sascha Hauer c19efab886 Merge branch 'for-next/param'
Conflicts:
	drivers/mci/mci-core.c
2013-05-06 09:30:50 +02:00
Sascha Hauer 579b794b5d Merge branch 'for-next/of'
Conflicts:
	arch/arm/mach-imx/Makefile
2013-05-06 09:30:37 +02:00
Sascha Hauer 18ffa4da98 Merge branch 'for-next/mtd' 2013-05-06 09:30:28 +02:00
Sascha Hauer c8af035b41 Merge branch 'for-next/misc' 2013-05-06 09:30:28 +02:00
Sascha Hauer 3cdd18632e Merge branch 'for-next/memory-commands' 2013-05-06 09:30:28 +02:00
Hubert Feurstein c06956e15f common/filetype: move partition-table detection into own function
Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-29 09:32:54 +02:00
Sascha Hauer 7f63c0a246 Add initial pinctrl support
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>
2013-04-23 09:36:13 +02:00
Sascha Hauer 66cd90abe7 of: partitions: pass struct cdev as argument
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>
2013-04-22 09:25:33 +02:00
Sascha Hauer 6d1788ab34 of: Allow multiple resources in 'reg' property
Some devices need multiple resources in the reg property. This patch
adds support for it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-22 09:23:50 +02:00
Sascha Hauer 266dea34a5 of: Add of_property_read_string_index()
Directly imported from the Kernel

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-22 09:23:35 +02:00
Alexander Shiyan 7691202bdd Remove unimplemented usb_driver_unregister declaration
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>
2013-04-18 08:00:07 +02:00
Sascha Hauer 4e3ce28973 Use a common define for RW_BUF_SIZE
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-17 13:36:31 +02:00
Sascha Hauer 255e5b4c42 memory commands: move memory_display to separate file
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>
2013-04-17 13:35:17 +02:00
Sascha Hauer d91b7772c4 memory commands: export common functions
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>
2013-04-17 12:56:44 +02:00
Sascha Hauer d8ee54fbbf mtd: Nand: Use dev_add_param_bool for erasebad parameter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:36 +02:00
Sascha Hauer ab855df99f console: Use dev_add_param_int for baudrate parameter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:35 +02:00
Sascha Hauer c57fa97ee7 param: pass param to dev_remove_param
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:35 +02:00
Sascha Hauer fb3fcaf2cc fb: Use dev_add_param_bool for enable parameter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:35 +02:00
Sascha Hauer f3b911c820 ata: Use dev_add_param_bool for probe parameter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:35 +02:00
Sascha Hauer fff0e0f741 mci: Use dev_add_param_int for probe parameter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:35 +02:00
Sascha Hauer a280858594 param: remove now unused dev_[gs]et_param_ip
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:35 +02:00
Sascha Hauer 6d0161d02a net: store ethernet device parameters in device
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>
2013-04-11 11:48:34 +02:00
Sascha Hauer f80e7c4920 param: Add ip address convenience function
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:31 +02:00
Jan Luebbe 973176d20b mtd: update NAND manufacturer names from the kernel
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 10:44:09 +02:00
Sascha Hauer 2df33a69bd param: Add integer and boolean parameter helpers
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>
2013-04-11 10:20:56 +02:00
Sascha Hauer f1253fdf8e param: Add dev member to struct param_d
This will make it unnecessary to pass the dev pointer around later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-06 08:23:45 +02:00
Sascha Hauer f72a4fd370 of/net: Add net related of helpers
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>
2013-04-04 23:23:41 +02:00
Sascha Hauer 0a637bcc3c Merge branch 'for-next/zynq'
Conflicts:
	arch/arm/Makefile
2013-04-04 23:23:19 +02:00
Sascha Hauer eebe92e3ad Merge branch 'for-next/omap' 2013-04-04 14:20:33 +02:00
Sascha Hauer c4da77611c Merge branch 'for-next/oftree' 2013-04-04 14:20:32 +02:00
Sascha Hauer 70867916a7 Merge branch 'for-next/mtd' 2013-04-04 14:20:32 +02:00
Sascha Hauer 8f2c6a3d2b Merge branch 'for-next/misc' 2013-04-04 14:20:32 +02:00
Sascha Hauer 4856aee6a8 Merge branch 'for-next/malloc-all-initcalls' 2013-04-04 14:20:32 +02:00
Sascha Hauer ab5f6c463c Merge branch 'for-next/imx-realq7'
Fix realq7 compilation
2013-04-04 14:20:05 +02:00
Sascha Hauer 602a8a6e96 Merge branch 'for-next/fec' 2013-04-04 12:03:20 +02:00
Sascha Hauer 0e291a853a Merge branch 'for-next/device-driver-macros' 2013-04-04 12:03:20 +02:00
Sascha Hauer 7845fd7af6 Merge branch 'for-next/clps711x' 2013-04-04 12:03:20 +02:00
Sascha Hauer 7efe415caa Merge branch 'for-next/clk' 2013-04-04 12:03:19 +02:00
Sascha Hauer 7a552a41a4 Merge branch 'for-next/bootsource' 2013-04-04 12:03:19 +02:00
Sascha Hauer 0f38ea38bd Merge branch 'for-next/ata' 2013-04-04 12:03:19 +02:00
Marc Kleine-Budde d366ae8382 bootsource: add definition for i2c-eeprom, spi-nor, spi-eeprom and usb
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-04 10:54:27 +02:00
Marc Kleine-Budde 5d8240619c bootsource: add support for bootsource instance information
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>
2013-04-04 10:54:27 +02:00
Marc Kleine-Budde 7b66d9cddd bootsource: create arch independent bootsource framework
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>
2013-04-04 10:54:22 +02:00
Sascha Hauer eb84709192 clk: remove unused __clk_[get|put]
This is some unused code resulting from copying stuff from the
kernel. Remove it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-03 17:22:11 +02:00
Josh Cartwright 28acd8331d macb: rename platform data
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>
2013-04-03 17:21:51 +02:00
Josh Cartwright 74406ae9ad parameter: fix build warning when !CONFIG_PARAMETER
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>
2013-04-02 08:29:02 +02:00
Steffen Trumtrar 1bb8460fc1 ARM: zynq: Add new architecture zynq
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>
2013-03-27 09:23:48 +01:00
Vicente Bergas 4b6cd0ee4b twl6030: add power button as an input key
Signed-off-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-25 10:21:20 +01:00
Sascha Hauer 87eebfe966 clk: Add is_enabled callback
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>
2013-03-15 09:53:30 +01:00
Sascha Hauer 1a66a77567 bus: Make struct device a pointer
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>
2013-03-14 08:42:24 +01:00
Alexander Shiyan e4588cf311 Introduce device_spi_driver() macro and use it for SPI drivers
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-14 07:15:45 +01:00
Alexander Shiyan 4f255f7318 I2C: Rename i2c_register_driver() for using with register_driver_macro()
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-14 07:15:44 +01:00
Alexander Shiyan 2f65379c98 SPI: Rename spi_register_driver() for using with register_driver_macro()
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-14 07:15:44 +01:00
Alexander Shiyan 54cbf39fca Introduce console_platform_driver() macro and use it for serial drivers
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-14 07:15:44 +01:00
Alexander Shiyan 943e586fe6 Extend device_platform_driver macro
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>
2013-03-14 07:15:44 +01:00
Sascha Hauer e6ec5937e3 Makefile.lib: Add dtc support
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>
2013-03-12 18:43:31 +01:00
Alexander Shiyan e857ff509b Add system controller register driver (SYSCON)
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>
2013-03-11 22:17:43 +01:00
Alexander Shiyan 6824c0d1fb Add helpers to define resources
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>
2013-03-11 22:17:42 +01:00
Alexander Shiyan 100c016f35 Add Generic GPIO driver
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>
2013-03-11 22:17:42 +01:00
Sascha Hauer 28c416e060 net: phy: micrel: Update id table from kernel
To get more phy ids.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-11 09:16:07 +01:00
Sascha Hauer e9e5919dd3 net: fec: use standard phy type defines
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-09 20:09:23 +01:00
Sascha Hauer 31865e8a7f net: fec: drop sevenwire support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-09 20:09:23 +01:00
Sascha Hauer 1cb110fb03 ata: Add init callback to ata_port_operations
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-08 11:33:27 +01:00
Sascha Hauer a2063d1015 ata: add ata logical device to defer probe
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>
2013-03-08 11:33:26 +01:00
Sascha Hauer 092bfd5eb5 fix another brown paper bag bug introduced with compile time loglevel
__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>
2013-03-06 23:53:04 +01:00
Sascha Hauer 14c290dabe of: make locally used functions static
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer a51d06d679 of: remove unused libfdt
Now that we are completely independent of libfdt remove the unused
code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer 6d6edfcf53 bootm: Pass unflattened devicetree to handlers
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>
2013-03-06 11:41:29 +01:00
Sascha Hauer 0ba9a2347a of: Add reservemap handling
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer 9d8e08353c of: fixup unflattened devicetree
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer cf95711e52 of: Add missing prototype for size/address counting functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer c2189e9f7e of: Add of property write functions for u32
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 64c199dd29 of: Pass barebox internal format devicetree to of_get_fixed_tree
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>
2013-03-06 11:41:28 +01:00
Sascha Hauer b6a2800537 of: make OFDEVICE a user selectable option
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>
2013-03-06 11:41:28 +01:00
Sascha Hauer 32bbb9455d of/fdt: use optimized endianess conversion
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 004cce1347 of: make flatten independent of libfdt
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 1d9859d5e7 of: make unflatten independent of libfdt
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 3b181a8109 of: Add initrd helper
Add a helper to set the initrd properties in the unflattened tree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 43327fe374 of: Add of_write_number helper
The counterpart to of_read_number: Write a 32bit or 64bit
number to a devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer b26b7ef0f0 of: Add root node argument to of_find_node_by_path
This makes of_find_node_by_path usable with multiple trees.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 8a185a4ff2 of: let of_unflatten_dtb return the unflattened tree
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>
2013-03-06 11:41:27 +01:00
Sascha Hauer 3afab2a83e of: Add missing prototype for of_device_is_compatible
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:27 +01:00
Sascha Hauer 6be4759579 of: Add of_set_property and of_create_node
Add functions to create a new device node and to create/set
a new property based on the nodepath.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:27 +01:00
Sascha Hauer b50c00a61d of: remove allnodes list
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>
2013-03-06 11:41:27 +01:00
Sascha Hauer a75b5c5d8e of: export of_find_child
of_find_child is a useful function. Export it and rename it to
of_find_child_by_name.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:27 +01:00
Sascha Hauer 3cbe9b9ae9 mtd: nand: replace NAND_USE_FLASH_BBT with NAND_BBT_USE_FLASH
To sync with the kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-04 11:00:33 +01:00
Sascha Hauer 611092251b mtd nand: introduce bbm.h
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>
2013-03-04 11:00:33 +01:00
Sascha Hauer c26ef8231f mtd: Add parameter to allow erasing bad blocks
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>
2013-03-04 11:00:33 +01:00
Sascha Hauer 5b85daacc6 mtd: nand: register nand flashes with nand specific function
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>
2013-03-04 11:00:00 +01:00
Sascha Hauer 13b4e37c1c Merge branch 'for-next/vexpress' 2013-03-04 09:21:54 +01:00
Sascha Hauer 678832e17a Merge branch 'for-next/usb' 2013-03-04 09:21:54 +01:00
Sascha Hauer ea0f831cd0 Merge branch 'for-next/mxs' 2013-03-04 09:21:54 +01:00
Sascha Hauer 62ee96bd3b Merge branch 'for-next/mtd'
Conflicts:
	arch/arm/configs/eukrea_cpuimx27_defconfig
	drivers/mtd/core.c
2013-03-04 09:21:49 +01:00
Sascha Hauer 13408877f4 Merge branch 'for-next/misc' 2013-03-04 09:21:37 +01:00
Sascha Hauer 831d83e922 Merge branch 'for-next/highbank' 2013-03-04 09:21:37 +01:00
Sascha Hauer c6813a5fb1 Merge branch 'for-next/gpt' 2013-03-04 09:21:37 +01:00
Sascha Hauer 1eb77960b8 Merge branch 'for-next/dt' 2013-03-04 09:21:37 +01:00
Antony Pavlov 14743045fb usb: fix build for big-endian platform
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>
2013-03-03 16:27:53 +01:00
Jean-Christophe PLAGNIOL-VILLARD 6ae2455e80 of: add do_fixup_by_compatible with u32 and string version
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-03 14:08:44 +01:00
Maxime Ripard 4f105dd774 log2: Fix declaration of __roundup_pow_of_two
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>
2013-02-27 08:59:34 +01:00
Jean-Christophe PLAGNIOL-VILLARD 62acc70dc1 phy: fix force mode
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>
2013-02-25 08:54:40 +01:00
Eric Bénard eec960e3b3 env: add register_persistent_environment
- 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>
2013-02-21 14:45:43 +01:00
Sascha Hauer 22d747e264 mtd: nand: do not write empty pages
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>
2013-02-21 08:58:45 +01:00
Alexander Aring 9d8a20592f fs: add pread and pwrite functions
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>
2013-02-20 08:22:42 +01:00
Alexander Aring e48b144071 fs: fix return type of read
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-18 11:09:46 +01:00
Alexander Shiyan 927eb75795 Make "dev_get_resource" publicly available
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-18 09:22:17 +01:00
Alexander Shiyan bbc0b6bc15 mfd: Using MFD_xx prefix for symbols
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>
2013-02-18 09:21:08 +01:00
Jean-Christophe PLAGNIOL-VILLARD 760689e5cc disk: partitions: add EFI GUID Partition Table
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>
2013-02-18 09:11:37 +01:00
Jean-Christophe PLAGNIOL-VILLARD a7d9ec0498 filetype: add GPT support
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>
2013-02-16 23:39:08 +01:00
Jean-Christophe PLAGNIOL-VILLARD ee2599db24 linux/types: import __aligned_x64 from the kernel
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>
2013-02-16 23:39:08 +01:00
Sascha Hauer 941aa21f26 fix brown paper bag bug introduced with compile time loglevel
__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>
2013-02-15 16:37:46 +01:00
Sascha Hauer 0a643b3d42 USB i.MX: Add chipidea gadget support
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>
2013-02-15 16:19:56 +01:00
Alexander Shiyan f3feb8d4ad Add missing SZ_xx defines
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-15 09:38:54 +01:00
Sascha Hauer 1bd90ff5a1 mtd: implement mtd_lock and mtd_unlock
Needed for NOR flashes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-14 10:44:41 +01:00
Sascha Hauer 7b7cf936cb mtd: Add mtd_* functions
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>
2013-02-14 10:31:39 +01:00
Sascha Hauer 3930f38028 libmtd: rename functions from mtd_* to libmtd_*
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>
2013-02-14 10:16:17 +01:00
Sascha Hauer 298f7fc3b6 USB i.MX chipidea: implement post init support
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>
2013-02-14 09:56:50 +01:00
Sascha Hauer 80a4c202dd USB ehci: Add platform specific init calls
Some USB cores need a platform specific init hook, add it to
the ehci driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-14 09:56:35 +01:00
Sascha Hauer cefcb0c281 USB chipidea i.MX: Fix PTS mask for HSIC
bit25 is part of the PTS bits, so mask it out before rewriting it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-14 09:56:30 +01:00
Jean-Christophe PLAGNIOL-VILLARD 9acb6113f0 of: make of_add_memory available for other board
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>
2013-02-14 09:27:26 +01:00
Alexander Shiyan 12ff763535 Introduce device_platform_driver() macro
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>
2013-02-13 09:23:28 +01:00
Jean-Christophe PLAGNIOL-VILLARD ed4da3f2de sp804: introduce amba_is_arm_sp804 to detect if the sp804 is present at the address
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-12 20:35:52 +01:00
Jean-Christophe PLAGNIOL-VILLARD a59a5acf68 amba: introduce amba_device_get_pid/cid
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>
2013-02-12 20:35:52 +01:00
Vicente Bergas afab6ac783 DeviceTree: add support for initrd in the DT
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>
2013-02-12 09:04:27 +01:00
Jean-Christophe PLAGNIOL-VILLARD 2738f72352 arm: add vexpress board support
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>
2013-02-12 08:49:27 +01:00
Alexander Aring 9d90e219c1 getopt: change optstring to const char*
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>
2013-02-11 20:57:34 +01:00
Sascha Hauer 46fa902064 generic memory layout: fix deps for [MALLOC|STACK]_BASE
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>
2013-02-04 15:52:41 +01:00
Sascha Hauer 56325edd79 Merge branch 'for-next/pbl' 2013-02-04 15:49:07 +01:00