9
0
Fork 0
Commit Graph

2932 Commits

Author SHA1 Message Date
Sascha Hauer 4df69d0b6e Merge branch 'for-next/env' 2014-03-07 09:24:40 +01:00
Sascha Hauer a162dfe503 net: Add ifup support
The defaultenv-2 has ifup support as a shell script. This patch
replaces it with a command which is more robust, can be called
from C and now can also bring up all configured interfaces.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-07 07:41:36 +01:00
Sascha Hauer 72dfc499c8 net: constify eth_get_byname argument
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-07 07:41:31 +01:00
Sascha Hauer 93578fb233 run_command: remove unused flag parameter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-07 07:41:26 +01:00
Sascha Hauer 49d9b9bea7 mtd: nand: disable subpage reads
The default nand_read_subpage implementation returns -ENOSUPP, so we have
to make sure that barebox never uses this implementation. By setting the
NAND_SUBPAGE_READ flag to 0x0 we ensure NAND_HAS_SUBPAGE_READ() never returns
true and also give the compiler a chance to optimize away some unused code.

subpage reads are a rather exotic feature even in Linux. It is only used on
largepage NANDs with soft ecc. Even if we have this case it needs non page
aligned reads to actually profit from this feature.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Hattink, Tjalling [FINT] <T.Hattink@fugro.nl>
2014-03-03 08:45:32 +01:00
Sascha Hauer 767c6b4a81 led: Add default-on trigger
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-03 08:06:04 +01:00
Sascha Hauer e390a8e2b4 led: move led_of_parse_trigger to core
So that other LED drivers can use it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-03 08:05:15 +01:00
Sascha Hauer ea0ed15786 PWM: Implement devicetree support
This implements of_pwm_request() for PWM client drivers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 15:05:46 +01:00
Sascha Hauer 37acfdf97d PWM: Add functions for getting/setting period/duty cycle
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 15:05:41 +01:00
Sascha Hauer 81ba01fee6 param: dev_add_param_fixed: constify argument
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 11:22:57 +01:00
Uwe Kleine-König 2a644bed63 devfs: partitioning: add new helper devfs_create_partitions
Compared to devfs_add_partition which adds a single partition
devfs_create_partitions creates several partitions at once. One nice
benefit is that this simplifies appending partitions because the start
of the latter partition doesn't need to be specified explicitly.
Also dev_add_bb_dev() is called by the new helper if the bbname is
specified for a partition.

Note that adding partitions is also more flexible now (also via
devfs_add_partition) because negative values for offset and size now
have a proper meaning instead of creating broken partitions.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 11:19:07 +01:00
Uwe Kleine-König 14d0355d7c mtd/nand: constify filename parameter
The string pointed to isn't modified, so declare it as const.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 08:20:26 +01:00
Uwe Kleine-König a7f78e7273 devfs_add_partition: make flags parameter unsigned
The value is only used to assign to a (*struct cdev)->flags which is an
unsigned int and it is passed as fourth parameter of mtd_add_partition which
is an unsigned long.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 08:20:26 +01:00
Sascha Hauer 991a12da04 usb: dfu: Add create flag
With the create flag DFU can upload to regular, previously non existing
files.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 08:14:14 +01:00
Sascha Hauer 9b731118f9 usb: dfu: Fix spelling of flag name
DFU_FLAG_SAVE should really be named DFU_FLAG_SAFE.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 08:14:14 +01:00
Sascha Hauer 7fa10256c3 defaultenv: Allow multiple defaultenvironment overlays
We can compile barebox for multiple boards at once, but currently
they all share a single default environment. This patch adds a
defaultenv_append() which boards can call to customize the default
environment during runtime. Each board now generate default environment
snippets using bbenv-y and add them during runtime with defaultenv_append()

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 08:14:14 +01:00
Sascha Hauer 0a2a8f7059 environment: Add function to load envfs from buffer
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-20 14:45:48 +01:00
Sascha Hauer c2428b2287 environment: constify arguments
The directory arguments to envfs_load and envfs_save can
be const.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-20 14:43:49 +01:00
Sascha Hauer 0de5aae341 filetype: Add detection for barebox environment
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-20 14:43:43 +01:00
Sascha Hauer 2c194e5822 input: Add keycode to barebox key translation table
Devicetrees specify the keyboard codes for the gpio-keys
driver, so add a table to translate them into something
barebox can use.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-17 08:23:41 +01:00
Sascha Hauer 59d6a0b7f1 input: gpio-keys: separate internal data from platform_data
Do not abuse platform data for internal driver data, instead
use a separate struct for that.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-17 08:23:41 +01:00
Sascha Hauer 7e66707c76 input: Add BB_ prefix to KEY_ defines
Our KEY_ defines conflict with the standard Linux KEY_ defines, so
add a BB_ prefix to them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-17 08:23:37 +01:00
Sascha Hauer 9bdef9e7f2 mci: Fix version handling
Currently the version defines reflect the digits in the version
number. MMC_VERSION_4_41 is defined as 0x441 and MMC_VERSION_4_5
is defined as 0x405. This results in MMC_VERSION_4_5 < MMC_VERSION_4_41
becoming true which was surely not intended. Fix this by
redefining the versions as 0x<major><minor><micro>. This makes the
string generation more complicated but makes versions comparable
again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-14 16:30:13 +01:00
Sascha Hauer 29ea8bcd94 mtd: Simplify partitions
Embed the partition information in struct mtd_info. This makes the
mtd partition code simpler.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-13 19:39:08 +01:00
Eric Bénard b43dee1a43 ARM: mx53-qsrb: fix USB
- configure the MC34708 properly so that USB can work
(the sequence is taken from u-boot)
- add the required defines to the mc13xxx include file

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 09:13:31 +01:00
Sebastian Hesselbarth 695060fb1a bus: mvebu: add mbus driver
This imports the Marvell mbus driver from Linux. The mbus is the
main downstream bus found on all Marvell Orion SoCs. The driver
deals with re-configurable address windows which are currently
parsed from DT. Also enable the driver as default on all MVEBU
SoCs. While at it, also reorder drivers/bus/{Kconfig,Makefile}
alphabetically.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 09:08:51 +01:00
Sebastian Hesselbarth 29af281cb1 net: phy: add of_phy_device_connect
This implements a of_phy_device_connect to allow DT enabled drivers
to connect to a PHY device by using the PHY's DT node only. It
currently assumes that each PHY node is a child of the corresponding
mdio bus.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 09:08:51 +01:00
Uwe Kleine-König f97f4b6571 mount: support filesystem options passed via -o
Similar to mount(8) the barebox command mount now supports passing a string
to the file system driver via -o.

This is used in the next commit to let the user specify port numbers for
nfs mounts.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 09:02:21 +01:00
Uwe Kleine-König 8abaf1ad71 net: provide alternatives to {ntoh, hton}[sl] funtions with cleaner semantics
ntohl always converts 32 bits even on archs where sizeof(long) == 8.
"ntoh32" is a much more intuitive name here. Also the name of the 64 bit
variant that is also added isn't questionable.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 09:02:20 +01:00
Uwe Kleine-König b104688cbb net: new function net_read_uint64
This is needed for nfs3 support as some types became bigger compared to
nfs2.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 09:02:20 +01:00
Uwe Kleine-König 47eb6b50bb net: net_read_uint32: assert that only 32 bit are read
On some architectures (e.g. alpha, amd64, arm64, ia64, s390x, mips64)
sizeof(ulong) is 8 which made net_read_uint32 actually read too much and
even returned the wrong value on big endian machines.
(Note the second issue isn't that critical though, because the only
architecture from the list above that uses big endian byte order is s390x
...)

Also change the argument to void * because the pointer is not necessarily
properly aligned.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 09:02:20 +01:00
David Vincent 34ab8ddd04 Load PBL into SRAM
This allows to load all the lowlevel init code, including the
uncompressor, inside SRAM and not just the bare init part. This is
useful when pbl is used as a first-stage bootloader but is loaded by an
external firmware.

Signed-off-by: David Vincent <freesilicon@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-09 09:43:33 +01:00
Sascha Hauer 394edf6377 i2c/spi: match of_modaliases
i2c/spi devices in the devicetree often come with a "vendor,device"
comaptible string. These do not match in barebox, so add a
device_match_of_modalias function which does exactly that.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-07 09:28:02 +01:00
Sascha Hauer 46c034db92 Merge branch 'for-next/tegra' 2014-02-03 09:55:55 +01:00
Sascha Hauer adbf51abde Merge branch 'for-next/pxa' 2014-02-03 09:55:55 +01:00
Sascha Hauer 601bf0fcc6 Merge branch 'for-next/misc' 2014-02-03 09:55:54 +01:00
Sascha Hauer d3c96d6522 Merge branch 'for-next/mci'
Conflicts:
	arch/arm/boards/tqma53/board.c
2014-02-03 09:55:52 +01:00
Sascha Hauer c224cd3161 Merge branch 'for-next/imx'
Conflicts:
	arch/arm/boards/dmo-mx6-realq7/lowlevel.c
2014-02-03 09:55:13 +01:00
Sascha Hauer f4cece7db5 Merge branch 'for-next/clps711x' 2014-02-03 09:52:34 +01:00
Sascha Hauer 706cef7e5b reset_source: add reset_source_get
To get reset_source from C code, not only from shell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-29 12:12:23 +01:00
Sascha Hauer 0099a887c0 reset_source: rename set_reset_source to reset_source_set
To get all reset source related functions into the same function
namespace.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-29 12:12:17 +01:00
Lucas Stach fb7163f715 dt-bindings: add Tegra CAR
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-29 10:28:50 +01:00
Lucas Stach 24763f8ff7 dt-bindings: add Tegra GPIO
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-29 10:28:50 +01:00
Lucas Stach 7f58591b3a dt-bindings: add ARM GIC
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-29 10:28:50 +01:00
Sascha Hauer 5767987b34 env: make path arguments to envfs_load/save const
These functions have no business changing the path argument, so make the
argument const.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-27 11:08:44 +01:00
Sascha Hauer c1c2e56fb3 net: phy: Add static inline wrapper for phy_register_fixup_for_uid
Boards register a fixup for a phy without checking if phy support
is enabled. To fix compilation without phy support add a static
inline wrapper for phy_register_fixup_for_uid.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-27 09:27:04 +01:00
Sascha Hauer 25cee7ec17 environment: Use accessor functions for default environment path
default_environment_path only exists when CONFIG_ENV_HANDLING is enabled.
Boards would have to #ifdef this if they wanted to use
default_environment_path. Use accessor functions instead which can
be ifdeffed on a single place.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-27 09:27:02 +01:00
Alexander Shiyan c2c5f48b91 mfd: syscon: Introduce syscon_base_lookup_by_phandle() function
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-24 23:10:04 +01:00
Lucas Stach 019a363d2a dt-bindings: import input.h
Straight copy from the Linux kernel.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-23 08:15:41 +01:00
Sascha Hauer dac65f99e8 console: Set Linux console parameter automatically
Linux specifies the linux,stdout-path property in the /chosen node
in the devicetree. Unfortunately this is ignored in most cases.
For cases in which barebox uses this property for its own use we
translate this into a Linux boot arg with:

- the console name provided by the serial driver
- the the instance from the 'serial' alias
- the baudrate from the actual baudrate.

So with this it's for devicetee enabled boards no longer necessary
to manually assign a console= parameter. Should a user not want
to use the automatically assigned parameter it should do:

global.linux.bootargs.console=

in the environment.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-22 07:53:21 +01:00
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