9
0
Fork 0
Commit Graph

3664 Commits

Author SHA1 Message Date
Marc Kleine-Budde 21aea1d9ff of_path: add of_find_path_by_node()
This patch adds the function of_find_path_by_node(), which is similar to
of_find_path(), but it translates a device tree node into a barebox device path
directly.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-27 08:26:40 +01:00
Trent Piepho f9c9550b8d eeprom: Add support for 24c1025 EEPROM
This is the Microchip version of the Atmel 24c1024, which is already
supported.  The key difference between them is that the I2C address
bit used to select between the two banks is bit 2 for the 1025 and not
bit 0 as in the 1024.

Add a flag to describe this difference.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-26 09:05:59 +01:00
Sascha Hauer d9ba9c92b7 reset: Add gpio reset support
If a device has the reset-gpios property we can support this through
the reset controller API, so drivers do not have to open code the
support for this property each time themselves as done a few dozen times
in the kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-23 10:23:38 +01:00
Sascha Hauer 97a92f0d86 reset: Remove unused *_optional functions
Since we now have dummy reset controllers we no longer need the
*_optional functions. These have been unused anyway, so just remove
them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-23 09:57:50 +01:00
Du Huanpeng ea682776db font: fbconsole: add custom font supports
Signed-off-by: Du Huanpeng <u74147@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-23 08:21:08 +01:00
Sebastian Hesselbarth 7cde58cc9d of: mtd: Import of_get_nand_ecc_{step_size, strength} from Linux
This imports DT helpers for MTD ECC step size and strength from
Linux kernel.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-23 08:00:09 +01:00
Jan Remmet b9170a1bde net: eth: Remove ethaddr_param
commit d00db554 introduce ethaddr_param. But it is not initialized, so
devinfo fails to show the mac. Remove it and use edev->ethaddr.

Signed-off-by: Jan Remmet <j.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-20 08:23:07 +01:00
Antony Pavlov 4aa3a0347c i2c: add pca954x bus multiplexer driver
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-19 08:58:26 +01:00
Antony Pavlov c3859ce93c i2c: import multiplexed I2C bus core support from linux kernel
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-19 08:58:26 +01:00
Sascha Hauer 901b13e243 i2c: Create for_each_i2c_adapter()
This can be used by the i2c_probe command to iterate over i2c adapters.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-19 08:58:25 +01:00
Trent Piepho 9e45df8ebb mci: dw_mmc: Delete devname in platform_data
Nothing used it.

Also delete the local mci alias pointer to host->mci in
dw_mmc_probe().  It only saved a few characters and all the references
but one are using host->mci.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-19 08:52:10 +01:00
Trent Piepho 5537d653d2 mci: dw_mmc: socfpga: Supply bus-width in platform_data
Since there is no OF support in the xloader on socfpga it uses the
platform_data system.  There needs to be a way to supply the
equivalent of the DT property bus-width this way to support devices
that need to use a smaller bus.

So that we don't need to put every flag that might get added to the
MMC_CAP list into platform_data, just put the bus width ones into
platform_data.

The socfpga dts sources specify a bus-width of 4 so use that in the
platform_data for socfpga.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-19 08:52:10 +01:00
Trent Piepho e11f5908d7 mci: core: bus-width property should override driver default
The OF code for parsing bus-width would only add the specified width
to those the driver might have already set capability flags for.

Because of this, if the driver had set 8 or 4 bit width, it wasn't
possible for the DT to specify that fewer pins were used on the board
and a smaller width was necessary.

Change this so the width in the DT overrides whatever widths the
driver says it supports.  There is no reason to have an incorrect
device tree and it makes far more sense for the DT to override the
driver default than for the driver default to override the DT.

The widths the driver puts in host_caps before calling mci_of_parse()
are considered the default if the DT doesn't specify bus-width.  This
should cause the least amount of change to existing boards, as despite
a comment that no bus-width meant to use 1 bit, using the driver
default is what was really happening.

Unfortunately, half of existing drivers default to the largest width
they support while the other half default to the smallest.  Boards
should just stick the width in the device tree.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-19 08:52:10 +01:00
Sascha Hauer 314b5402d9 fbconsole: register fonts dynamically
Instead of having a fixed array of fonts register the fonts dynamically.
This allows easier adding of fonts to the tree since only one file per
font has to be added and no other files modified.

Currently we have to register the fonts very early before the first
framebuffer is registered. This is because of our limited
dev_add_param_enum() which wants to know the number of elements when
called, so we can't add elements once after we've called
dev_add_param_enum(). Maybe a dev_add_param_array() has to be created
whithout this limitation, but that's left for a future exercise.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-13 09:14:48 +01:00
Sascha Hauer b97ac6bd41 Merge branch 'for-next/usb' 2015-11-06 16:10:44 +01:00
Sascha Hauer 1d9295b344 Merge branch 'for-next/misc' 2015-11-06 16:10:42 +01:00
Sascha Hauer 3cdd30342b Merge branch 'for-next/memtest' 2015-11-06 16:10:37 +01:00
Sascha Hauer ed395e4df1 fcntl: Fix O_CREAT clashing with O_RWSIZE_8
O_CREAT and O_RWSIZE_8 are both defined as 0100. Fix this by moving the
O_RWSIZE_* flags to unused bits.

This bug leads to incomplete writes when the destination file is created
and mem_write is involved, for example with the memcpy command:

memcpy -s /some/file -d /dev/ram0 0 0 10

In this case only 8 bytes will be copied and it will be done using 8
byte accesses which may not work properly if the destination is not
sufficiently aligned, i.e.:

memcpy -s /some/file -d /dev/ram0 0 1 8

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2015-11-04 09:31:02 +01:00
Sascha Hauer 8f2549abb7 memtest: By default only test biggest region
Often enough the biggest free region spans most free RAM, so
it doesn't add much value to test the remaining free regions. This
patch changes the default behaviour to only test the biggest free
region and adds the -t option to test all regions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-04 08:03:43 +01:00
Sascha Hauer e96b1713ea memtest: split tests in separate functions
The memtest does a bus integrity check and a moving inversions test.
Split the tests into two separate functions so that the can be called
separately.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-03 07:27:47 +01:00
Sascha Hauer b792124a7d rework remap_range
remap_range is for remapping regions with different cache attributes.
It is implemented for ARM and PowerPC only, the other architectures only
provide stubs.
Currently the new cache attributes are passed in an architecture specific
way and the attributes have to be retrieved by calls to
mmu_get_pte_cached_flags() and mmu_get_pte_uncached_flags().
Make this simpler by providing architecture independent flags which can
be directly passed to remap_range()
Also provide a MAP_ARCH_DEFAULT flag and a arch_can_remap() function.
The MAP_ARCH_DEFAULT defaults to whatever caching type the architecture
has as default. the arch_can_remap() function returns true if the
architecture can change the cache attributes, false otherwise. This
allows the memtest code to better find out what it has to do.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-03 07:27:44 +01:00
Sascha Hauer 6b127d4f18 memtest: move request/release regions to common/
Normally code providing a feature should be implemented in common/ which
is then called from the command code. Follow this rule and move some more
of the memtest code to common/.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-27 08:22:45 +01:00
Antony Pavlov d70cb35e44 clock.h: include <types.h> under guard macro
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-22 09:33:58 +02:00
Peter Mamonov e1d67aa40f usb: core: return -EAGAIN on usb_* functions reentrance
Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-14 15:35:30 +02:00
Sascha Hauer 54bf386650 Merge branch 'for-next/usb' 2015-10-07 08:23:51 +02:00
Sascha Hauer dd4da6d328 Merge branch 'for-next/omap' 2015-10-07 08:23:45 +02:00
Sascha Hauer 181bb315d0 Merge branch 'for-next/mtd' 2015-10-07 08:23:45 +02:00
Sascha Hauer c8fa7eed66 Merge branch 'for-next/misc' 2015-10-07 08:23:45 +02:00
Sascha Hauer 8a83eca779 Merge branch 'for-next/mci' 2015-10-07 01:01:06 +02:00
Sascha Hauer 160bd3b360 Merge branch 'for-next/imx' 2015-10-07 01:01:06 +02:00
Sascha Hauer 694c5b8794 Revert "spi: i.MX: optimize transfers for ECSPI v2.3"
This does not work on the Efika MX Smartbook which uses SPI
to connect the MC13892. Needs some rework.

This reverts commit 746a5530be.
2015-10-05 09:47:37 +02:00
Vicente Bergas e89f1a1f18 detect_fs: use device instead of file
detect_fs would usually mount a device on a directory,
so, use a device-specific type detection.

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-02 09:10:16 +02:00
Peter Mamonov 8165f3131c common: clock: introduce mdelay_non_interruptible()
Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-02 07:50:51 +02:00
Eric Bénard 39b0eb3b84 chipidea-imx: allow phymode configuration in pdata
it's currently only handled through DT and for i.MX25 OTG port (at least),
we need to configure portsc to get host mode working but it actually fails
as ci->phymode is 0 which is USBPHY_INTERFACE_MODE_UNKNOWN

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-29 08:47:25 +02:00
Sascha Hauer 7e44c8495a introduce strerrorp
putting an error pointer into strerror can be a bit confusing since
strerror takes a positive error code but PTR_ERR returns a negative
number, so we have to do strerror(-PTR_ERR(errp)). Some places got
this wrong already, so introduce a strerrorp function which directly
takes an error pointer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-23 17:12:44 +02:00
Sascha Hauer 9d54b6f6b6 clock: remove duplicate xdelay declarations
ndelay is declared in include/clock.h, udelay in include/common.h and
mdelay in include/common.h and include/clock.h. Move them all to
include/clock.h and remove duplicates.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-23 15:13:11 +02:00
Enrico Jorns 61720f7bd4 mtd nand: added 'bits_per_cell' property
This one is available in the kernel and used by the denali driver

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-23 10:33:23 +02:00
Markus Pargmann d27cddcc3a usb: chipidea: Add udc unregister for device removal
The host may assume that the usb device is still up and running after
booting if we do not deregister the udc here. I observed issues when the
linux kernel was using a usb gadget directly where the complete USB Hub
got disconnected through this.

This patch adds a proper USB disconnect for gadget devices.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-23 10:31:33 +02:00
Antony Pavlov d3b39aeffd endian: sync {big,little}_endian.h with linux-4.2
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-10 09:13:24 +02:00
Daniel Schultz 572e8cdfa3 drivers: mci: Add mci_get_device_by_name function
Get a 'struct mci' by search after the device name.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-04 08:59:42 +02:00
Daniel Schultz 1f76dfce39 include: mci: Add new ext. CSD field defines
Added missing defines for the extended CSD register until standard 5.1.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-04 08:21:44 +02:00
Daniel Schultz 4c100aae04 drivers: mci: Make two functions public
There is no possibility to read/write to the extended CSD register of
MMC devices from a command. To avoid duplicated driver code, two driver
functions have to be public.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-04 08:21:44 +02:00
Lucas Stach 200ba6cdee reset-source: add stub for of_get_reset_source_priority
Allow drivers to build even if reset source support isn't built in.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-04 08:02:18 +02:00
Lucas Stach e38c778b9a wd: add stub for of_get_watchdog_priority
Allow drivers to build even if WD core isn't enabled.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-04 08:02:18 +02:00
David S. Miller d192ebe8bb endian: Always evaluate arguments
This patch is based on

    commit 3d6f4a20cc287a8980c6186624834cf10a70752b
    Author: David Miller <davem@davemloft.net>
    Date:   Thu Jul 24 23:38:31 2008 -0700

        endian: Always evaluate arguments.

In barebox.git/drivers/usb/core/usb.c,
function usb_parse_config() we have had

    le16_to_cpus(&(dev->config.wTotalLength));

which evaluates to "do { } while (0)" on little endian,
so struct usb_configuration field misuse will never
be discovered on little endian.

Therefore, always evaluate the arguments to nop endian
transformation operations.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-02 07:53:02 +02:00
Sascha Hauer 67e0a30e77 Merge branch 'for-next/restart' 2015-09-01 09:43:55 +02:00
Sascha Hauer b7ab2081b1 Merge branch 'for-next/param' 2015-09-01 09:43:55 +02:00
Sascha Hauer e582374ce3 Merge branch 'for-next/of_path' 2015-09-01 09:43:54 +02:00
Sascha Hauer 60fc3e99b5 Merge branch 'for-next/mtd' 2015-09-01 09:43:54 +02:00
Sascha Hauer 69dccb494a Merge branch 'for-next/misc' 2015-09-01 09:43:54 +02:00
Sascha Hauer 049fb66d21 Merge branch 'for-next/login' 2015-09-01 09:43:54 +02:00
Sascha Hauer fae6eea0e6 Merge branch 'for-next/gpio' 2015-09-01 09:43:53 +02:00
Sascha Hauer f387bc96bb Merge branch 'for-next/fb-imx-ipu-v3' 2015-09-01 09:43:53 +02:00
Sascha Hauer 3f68a7698d cdev: Add function to find cdev by device_node
This adds a device_node member to struct cdev and a function
to find a cdev by device_node.
This also removes the setting of cdev->dev->device_node in
the of partition parser. We must not set the device since it
may not refer to a partition but to a whole device with partitions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-01 07:43:16 +02:00
Sascha Hauer 746a5530be spi: i.MX: optimize transfers for ECSPI v2.3
Instead of writing one word to the txfifo and then wait until
one is received in the rxfifo we can write until the txfifos
are not full and read as long the rxfifos contain data. This
makes transfers for the m25p80 driver around 7 times faster
here.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-31 17:12:38 +02:00
Sascha Hauer cd4df8f82b spi: i.MX: use start mode control bit
The i.MX SPI controller in version 2.3 can immediately start a transfer
when the txfifo is written to. In this mode we no longer have to trigger
the transfer with the xch bit which makes the code a bit simpler.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-31 17:12:28 +02:00
Sascha Hauer aba382e7af watchdog: Fix static inline ops
...by actually making them static inline.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 12:04:40 +02:00
Sascha Hauer 40596b856f login: cleanup password code
- make some locally used functions static
- remove read_passwd which is unused
- some refactoring to make code pathes clearer

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 08:00:30 +02:00
Sascha Hauer 90e766a78f login: rework login mechanism
We used to have the login functionality in the /env/bin/init script.
This is hard to review and it's too easy to break the login functionality
with changes to this script. Move the places to ask for a password to
C code where we have only a few places where we have to ask for a password.
Mainly these are run_shell() and the menutree command.

This patch introduces a login() function which will only return if the correct
password has been entered. Following calls will return immediately without
asking for a password again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 08:00:27 +02:00
Sascha Hauer 4a7534bf07 reset-source: Allow different priorities
Different devices may report the reset source with different levels
of certainty. For example a SoC may see a power-on reset, but this
may only be because an external PMIC has power cycled the SoC. This
means the PMIC knows the real reason better and thus the reset reason
from the PMIC should be preferred.

This patch introduces priorities for the reset_source to handle the
above scenario. Also add a of_get_reset_source_priority() function
to retrieve the desired priority from the device tree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 07:18:14 +02:00
Sascha Hauer 62fe28cf0b watchdog: Give watchdogs a name
This adds a dev and name member to struct watchdog which helps distinguishing
between different watchdogs. Also add some debugging aids.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-27 21:37:07 +02:00
Sascha Hauer 8f4cf30903 watchdog: Allow multiple watchdogs
Put watchdogs on a list to allow multiple watchdogs. Add a priority
field to be able to pick the highest priority watchdog.
This patch also provides a of_get_watchdog_priority() function to
allow configuring the watchdog priority from the device tree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-27 21:37:06 +02:00
Sascha Hauer 83b0a5ae05 restart: replace reset_cpu with registered restart handlers
This replaces the reset_cpu() function which every SoC or board must
provide with registered handlers. This makes it possible to have multiple
reset functions for boards which have multiple ways to reset the machine.
Also boards which have no way at all to reset the machine no longer
have to provide a dummy reset_cpu() function.

The problem this solves is that some machines have external PMICs or
similar to reset the system which have to be preferred over the
internal SoC reset, because the PMIC can reset not only the SoC but also
the external devices.

To pick the right way to reset a machine each handler has a priority. The
default priority is 100 and all currently existing restart handlers are
registered with this priority. of_get_restart_priority() allows to retrieve
the priority from the device tree which makes it possible for boards to
give certain restart handlers a higher priority in order to use this one
instead of the default one.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-27 21:37:03 +02:00
Sascha Hauer 3e1adbf832 mtd: m25p80: make it possible to use large blocks if desired
Some SPI NOR flashes support 4K erase blocks. 4K erase blocks do not
work with UBIFS which needs a minimum erase block size of 15360 bytes.
Also bigger sectors are faster to erase. This patch adds a device tree
option to use the bigger blocks instead of the default 4K blocks.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2015-08-26 15:14:00 +02:00
Sascha Hauer 546c5a9c78 param_enum: Make name strings const
Not only the array containing the pointers should be const but
also the strings themselves, so instead of using const char **
use const char * const *.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-26 12:52:12 +02:00
Sascha Hauer cabfe34ca7 gui: implement blitting screen areas
So far we only supported blitting the whole screen from the shadow
fb to the framebuffer. Add a function to blit areas.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-20 12:57:08 +02:00
Sascha Hauer 7c5937d245 gui: Use fb provided shadowfb for offscreen rendering
The fb core now has builtin support for offscreen rendering, use
this and drop offscreen handling in the gui code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-20 12:57:08 +02:00
Sascha Hauer 6f96499064 fb: Add shadowfb support
For speeding up rendering we need shadow framebuffers. This is currently
implemented in the gui functions. This does not work properly when two
users (splash and fbconsole) use the same framebuffer since in this case
two different shadow framebuffers will be used. This patch implements
shadowfb handling in the fb core directly. With this the fb device gets
a parameter 'shadowfb'. When this is true the fb core will allocate a
shadow fb and provide it to the users.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-20 12:57:07 +02:00
Jan Luebbe e1944fb6b2 i2c: add bus recovery infrastructure
This is based on the code introduced to the kernel in
5f9296ba21b3c395e53dd84e7ff9578f97f24295.

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-20 07:47:14 +02:00
Sascha Hauer 0d14bc0ec4 gpio: Drop asm-generic/gpio.h
Since we no longer have custom gpio function prototypes we can
drop the prototypes from asm-generic/gpio.h can add them to
include/gpio.h instead. While at it add static inline dummy wrappers
for !CONFIG_GENERIC_GPIO so that code using gpios can compile without
gpio support.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-20 07:47:11 +02:00
Lucas Stach 4cf3e91aca video: backlight: add fallbacks for client functions
Add empty static inline function fallbacks if backlight support
is not enabled, so that drivers using the backlight don't fail to
build.

Fixes:
In function `simple_panel_ioctl':
undefined reference to `of_backlight_find'
undefined reference to `backlight_set_brightness_default'
undefined reference to `backlight_set_brightness'

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-19 16:12:51 +02:00
Sascha Hauer 3c76d02aeb implement dma_alloc_writecombine
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-07 15:42:55 +02:00
Sascha Hauer 98b5672c4d Merge branch 'for-next/vpl' 2015-08-07 07:55:00 +02:00
Sascha Hauer 0c5c47b511 Merge branch 'for-next/vincell' 2015-08-07 07:54:46 +02:00
Sascha Hauer 19afbd285e Merge branch 'for-next/video' 2015-08-06 12:33:26 +02:00
Sascha Hauer fd58dc84cb Merge branch 'for-next/spd' 2015-08-06 12:33:24 +02:00
Sascha Hauer e188d2ec26 Merge branch 'for-next/net' 2015-08-06 12:33:15 +02:00
Sascha Hauer 4ee01d2b46 Merge branch 'for-next/misc' 2015-08-06 12:33:15 +02:00
Sascha Hauer a8525f691d Merge branch 'for-next/imx' 2015-08-06 12:33:06 +02:00
Sascha Hauer 3c92473a9e Merge branch 'for-next/fbcon' 2015-08-06 12:33:06 +02:00
Sascha Hauer ebd6f26412 Merge branch 'for-next/exitcall' 2015-08-06 12:33:06 +02:00
Sascha Hauer 8d48e07c4d ARM: i.MX: make early UART functions independent of DEBUG_LL
We have functions to setup the i.MX uart for early use, but these all
depend on DEBUG_LL. Move them to imx-uart.h to make them usable for
the regular PBL console.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-31 08:49:43 +02:00
Sascha Hauer ca8a4b0ff5 PBL: console: Make independent of DEBUG_LL
With more stuff being done in PBL regular console support gets more and more
useful. This makes the PBL console independent of DEBUG_LL which is only
meant for early debugging but not regular output.
To use the regular PBL console a board must call pbl_set_putc() which stores
a pointer to the putc function to be used.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-31 08:49:42 +02:00
Sascha Hauer ab8e23f239 net: phy: at803x: Use genphy_config_init
Based on the Linux commit:

6ff01db net: phy: at803x: use genphy_config_init()

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-29 17:17:01 +02:00
Sascha Hauer b20f5632aa Limit data_abort_mask to !PBL
To make memory_display usable in PBL

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-29 10:22:05 +02:00
Michael Olbrich c95b1c2bf2 efi: use an EFI variable to save the environment
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-27 07:23:20 +02:00
Michael Olbrich 21a83053ab efi: write volatile EFI variables used by systemd
LoaderTimeInitUSec and LoaderTimeExecUSec are used e.g. in systemd-analyze
to calculate the time spent in the firmare and barebox.

LoaderDevicePartUUID is used to mount the EFI partition to /boot.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-27 07:23:18 +02:00
Michael Olbrich 4faf797ec8 efi: export device_path_from_handle()
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-27 07:23:17 +02:00
Michael Olbrich be2edd99c0 efi: add helper to get the GPT partition UUID for a device
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-27 07:23:17 +02:00
Michael Olbrich 55da0cf13e efi: add support for initrd loading
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-23 20:31:44 +02:00
Michael Olbrich 17e6044074 xfuncs: add wrapper for wchar strdup functions
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-23 16:46:14 +02:00
Michael Olbrich 773be2a168 xfuncs: add xasprintf() and xvasprintf()
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-23 16:46:14 +02:00
Sascha Hauer efeeea3501 drop <stddef.h> includes
The compilers stddef.h should not be included. We declare all types
ourselves.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-23 16:46:04 +02:00
Antony Pavlov 64fabf9fca net_udp_bind(): use uint16_t type for source port
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-20 07:46:54 +02:00
Antony Pavlov 27f79c05ab video: implement framebuffer console
This patch realizes framebuffer console support for barebox. It
supports colors and enough escape sequences to show the barebox
console and editor properly.

fbconsole mini-HOWTO
====================

1. compile sandbox barebox with

    CONFIG_VIDEO=y
    CONFIG_FRAMEBUFFER_CONSOLE=y
    CONFIG_DRIVER_VIDEO_SDL=y

2. run barebox

3. test fbconsole

    fbconsole0.active=oe

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-20 07:11:21 +02:00
Sascha Hauer cfec57d898 graphics_utils: Let fb_open allocate the screen
Allocate the screen dynamically in fb_open. This opens the way to create
a fb_create_screen function which takes a struct fb_info * instead of a
filename. This is suitable for the framebuffer console which already has
a struct fb_info *.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-20 07:11:21 +02:00
Sascha Hauer 8a4be80936 fb: Add fb_enable/disable functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-20 07:11:21 +02:00
Sascha Hauer dd09054276 fonts: Add 7x14 font
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-20 07:11:21 +02:00
Sascha Hauer 4d6665c33a spi: i.MX: move register defines to include/
The register defines will be used by the SPI xload code, so move
them to a place where the xload code can include them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-16 09:46:02 +02:00
Antony Pavlov b6b96ee6fd lib/fonts: add "MINI4x6" font
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-16 09:17:17 +02:00
Antony Pavlov e5138e2d3e import lib/fonts framework from linux kernel
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-16 09:17:17 +02:00
Sascha Hauer 322d8a509e graphics_utils: add function to create pixel from rgb triplet
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-16 09:17:17 +02:00
Sascha Hauer 3ea4dee7fd graphics_utils: Export get_pixel
get_pixel converts a 32bit trgb color into framebuffer format. This
is useful for other code aswell, so export it.
Other functions in the graphics utils code use the name get/set_pixel
aswell, but instead of converting data they get a pixel from the framebuffer
or set a pixel on the framebuffer. To separate from these rename the
function to gu_hex_to_pixel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-16 09:13:04 +02:00
Sascha Hauer 976ad2aea2 graphics_utils: Add function to invert an area
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-16 09:03:05 +02:00
Sascha Hauer 4dfa261dcf regulator: Add support for regulator-boot-on device tree property
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-15 07:52:25 +02:00
Sascha Hauer ea532ddb86 gui: Fix typo in function name
It's a render buffer, not a redering buffer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-15 07:25:01 +02:00
Sascha Hauer 592ae690f5 graphic_utils: Add a common namespace to functions
This adds a common namespace to the graphic functions. We use
gu_ for graphic_utils.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-15 07:25:00 +02:00
Alexander Smirnov f75fe31095 ddr_spd: add routine for printing DDR2 SPD contents in human-readable format
---=== SPD EEPROM Information ===---
EEPROM Checksum of bytes 0-62                    OK (0xDF)
Total number of bytes in EEPROM                  256
Fundamental Memory type                          DDR2 SDRAM
SPD Revision                                     1.2

---=== Memory Characteristics ===---
Maximum module speed                             800 MHz (PC2-6400)
Size                                             2048 MB
Banks x Rows x Columns x Bits                    8 x 14 x 10 x 64
Ranks                                            2
SDRAM Device Width                               8 bits
Module Height                                    30.0 mm
Module Type                                      SO-DIMM (67.6 mm)
DRAM Package                                     Planar
Voltage Interface Level                          SSTL 1.8V
Module Configuration Type                        No Parity
Refresh Rate                                     Reduced (7.8 us) - Self Refresh
Supported Burst Lengths                          4, 8
Supported CAS Latencies (tCL)                    6T
tCL-tRCD-tRP-tRAS                                6-6-6-18 as DDR2-800
Minimum Cycle Time                               2.5 ns at CAS 6
Maximum Access Time                              0.40 ns at CAS 6
Maximum Cycle Time (tCK max)                     8 ns

---=== Timing Parameters ===---
Address/Command Setup Time Before Clock (tIS)    0.17 ns
Address/Command Hold Time After Clock (tIH)      0.25 ns
Data Input Setup Time Before Strobe (tDS)        0.05 ns
Data Input Hold Time After Strobe (tDH)          0.12 ns
Minimum Row Precharge Delay (tRP)                15.00 ns
Minimum Row Active to Row Active Delay (tRRD)    7.50 ns
Minimum RAS# to CAS# Delay (tRCD)                15.00 ns
Minimum RAS# Pulse Width (tRAS)                  45.00 ns
Write Recovery Time (tWR)                        15.00 ns
Minimum Write to Read CMD Delay (tWTR)           7.50 ns
Minimum Read to Pre-charge CMD Delay (tRTP)      7.50 ns
Minimum Active to Auto-refresh Delay (tRC)       60.00 ns
Minimum Recovery Delay (tRFC)                    127 ns
Maximum DQS to DQ Skew (tDQSQ)                   0.20 ns
Maximum Read Data Hold Skew (tQHS)               0.30 ns

---=== Manufacturing Information ===---
Manufacturer JEDEC ID                            7f 98 00 00 00 00 00 00
Manufacturing Location Code                      0x05
Part Number
Manufacturing Date                               2014-W47
Assembly Serial Number                           0x43266892

Signed-off-by: Alexander Smirnov <alllecs@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-14 07:09:19 +02:00
Sascha Hauer 75782f365c video: Add missing prototype for display_timings_release
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-13 08:38:19 +02:00
Sascha Hauer 70007036a5 video: Add Video Pipeline (VPL) support
Complex video pipelines are modelled with the of_graph bindings in
the devicetree. This patch adds a ioctl infrastructure to issue
commands to the remote endpoint of a of_graph. Currently defined
ioctls are prepare/unprepare, enable/disable and get_modes. This
is enough to control LVDS or HDMI encoder or simple panels.

A device node which contains of_graph endpoints can be registered
as a VPL entity. An entity can receive ioctls via the .ioctl callback
and also issue ioctls by calling vpl_ioctl. The core itself will never
iterate over the entire pipeline. Instead, the different VPL entities
should forward an ioctl to the next instance in the pipeline whenever
necessary.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-13 08:38:19 +02:00
Sascha Hauer 6913850321 of_graph: add of_graph_port_is_available
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-13 08:38:18 +02:00
Sascha Hauer cc44a37924 of: import of_graph functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-13 08:38:18 +02:00
Sascha Hauer d96f74f26f of: base: implement of_get_next_child
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-13 08:38:18 +02:00
Herve Codina 0fd5944d52 exitcall: move board_shutdown to exitcall infrastructure
Signed-off-by: Herve Codina <Herve.CODINA@celad.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-13 08:28:19 +02:00
Herve Codina 74438aa4dc exitcall: move arch_shutdown to exitcall infrastructure
Signed-off-by: Herve Codina <Herve.CODINA@celad.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-13 08:28:19 +02:00
Herve Codina a59a48b684 exitcall: move device_shutdown to exitcall infrastructure
Signed-off-by: Herve Codina <Herve.CODINA@celad.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-13 08:28:19 +02:00
Herve Codina a2136e6cbd exitcall: Add exitcall infrastructure
exitcall infrastructure is based on initcall infrastructure.
It allows to have and use exit call hooks on barebox shutdown.

Signed-off-by: Herve Codina <Herve.CODINA@celad.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-13 08:28:19 +02:00
Alexey Galakhov d370efef5b build: update compiler*.h to newest versions
This adds the support for gcc 5.x and clang.

Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-06 13:42:24 +02:00
Sascha Hauer d297851b1a Merge branch 'for-next/blspec' 2015-07-06 12:43:29 +02:00
Sascha Hauer 2f5f0d6aa1 video: Add generic fixup handler to reserve fb memory
When a framebuffer is kept enabled when Linux starts its framebuffer
memory should be reserved. Otherwise Linux may overwrite its contents.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-06 12:34:23 +02:00
Sascha Hauer 735c570e5a Merge branch 'for-next/state' 2015-07-03 08:38:20 +02:00
Sascha Hauer f037355761 Merge branch 'for-next/pwm' 2015-07-03 08:38:20 +02:00
Sascha Hauer 18ea2863bf Merge branch 'for-next/omap'
Conflicts:
	arch/arm/boards/beagle/board.c
2015-07-03 08:38:17 +02:00
Sascha Hauer f2a2894c27 Merge branch 'for-next/misc' 2015-07-03 08:37:40 +02:00
Sascha Hauer c5438404db Merge branch 'for-next/imx-bbu-nand-fcb'
Conflicts:
	common/Kconfig
2015-07-03 08:37:36 +02:00
Sascha Hauer 021dda6744 Merge branch 'for-next/cfi-flash' 2015-07-03 08:37:29 +02:00
Sascha Hauer 907418af60 Merge branch 'for-next/blspec' 2015-07-03 08:37:29 +02:00
Sascha Hauer 7f1195c63d treewide: replace __inline__ with inline
inline is preferred over __inline__

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-02 09:39:58 +02:00
Sascha Hauer 08120e2166 of: export of_platform_device_create
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-02 08:23:29 +02:00
Sascha Hauer 74ac4489cf bbu: Add a standard file-to-device-copy handler
The most standard update handler will simply copy a file to a device.
This can be shared across several users, so add a standard handler for
this operation.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-01 09:04:22 +02:00
Sascha Hauer 5f11e80670 mtd: Make devname argument to add_mtd_device const
add_mtd_device duplicates the string where necessary, so make it
const.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-29 07:04:55 +02:00
Sascha Hauer d00db5548a net: eth: Do not rely on CONFIG_PARAMETER to be enabled
register_preset_mac_address only works when CONFIG_PARAMETER
is enabled because otherwise dev_set_param is a no-op. Add a
function to set the MAC address explicitly without the need
of CONFIG_PARAMETER and use it where appropriate.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-26 11:56:22 +02:00
Sascha Hauer 1dd5262eb9 net: Make set_ethaddr argument const
The set_ethaddr callback should not modify the MAC address passed to it, so
make it const.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-26 11:56:22 +02:00
Sascha Hauer ce72d46f42 mtd: Add mtd concat support
The mtd concat layer supports concatenating several MTD devices
into a single one. This is nearly as-is from the corresponding
Kernel code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-23 16:59:54 +02:00
Marc Kleine-Budde daeb9d8d76 xfuncs: import xstrndup() from busybox
This function is needed for the fixed length string feature in the state
framework.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-18 10:58:58 +02:00
Sascha Hauer 745594d51a fs: ubifs: Implement Linux rootarg
Add the parameter to boot from ubifs fileystems. This assumes that
there will be only one UBI device registered in the kernel, otherwise
there is no way to predict the ubi number.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-18 09:01:01 +02:00
Sascha Hauer e9db2079a5 fs: Add device parameter for Linux root= option
When registering a filesystem device add a device parameter suitable
for the Linux root= option to boot from exactly this filesystem. Currently
the fs layer sets this parameter to the root=PARTUUID= mechanism if a
partuuid is available. Other filesystems like NFS and UBIFS which do
not have a PARTUUID can overwrite this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-18 09:01:01 +02:00
Sascha Hauer bc31d85c6e cdev: Add partuuid string to struct cdev
This adds the partuuid string to struct cdev in order to have this
available for constructing a suitable Linux root=PARTUUID= option
for booting Linux.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-18 09:01:01 +02:00
Sascha Hauer acc930f1e9 Add globalvar_add_simple_string function
This adds a globalvar string function to pass a pointer to a string.
With this we can directly access the string to get the variable and
don't have to getenv() the string first.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-18 09:01:01 +02:00
Sascha Hauer cc3927d20a blspec: Add missing prototype for blspec_scan_device
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-17 11:39:46 +02:00
Marc Kleine-Budde 690ee0ee2b crypto: digest: provide static inline no-ops if digest is disabled
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-17 07:58:10 +02:00
Sascha Hauer 605621a3c8 PWM: Allow multiple PWMs per device node
Matching a device node is enough since a device node may have
multiple PWMs. Check for a id aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 12:00:41 +02:00
Sascha Hauer e3ea90860e video: Add backlight support
This adds a small backlight layer. It provides a backlight device
on which the brightness parameter can be used to adjust the brightness.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 11:52:58 +02:00
Sascha Hauer 22f8077c39 imx-bbu-nand-fcb: make available for i.MX28 aswell
The code can be used with slight modifications on i.MX28 aswell.
Add a i.MX28 registration function and move the differences to
function callbacks.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 08:28:26 +02:00
Sascha Hauer a10366acd8 ARM: i.MX6: bbu nand: Move to common place
The code can be used on i.MX28 aswell, so move it to a common place.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 08:28:04 +02:00
Sascha Hauer e7b23c6a9d filetype: Add filetype for MXS bootstream
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 08:28:04 +02:00
Sascha Hauer dae7498d2c clk: of: fix clk_of_table generation
We used to collect all sections beginning with __clk_of_table_ in a single
section in the linker using KEEP(*(.__clk_of_table_*)). That the sentinel
entry ended up as the last entry was pure luck, but not always the case.

Instead of putting all entries in different sections we now put all entries
in the same section. Only the sentinel entry gets its own section and is
collected by the linker separately.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Andreas Willig <andreas.willig@rafi.de>
Tested-by:  Andreas Willig <andreas.willig@rafi.de>
2015-06-11 07:46:36 +02:00
Sascha Hauer e349701487 Merge branch 'for-next/state' 2015-06-09 09:26:44 +02:00
Sascha Hauer 3a32e7acd4 Merge branch 'for-next/spi-nor' 2015-06-09 09:26:44 +02:00
Sascha Hauer 03510ac4fa Merge branch 'for-next/posix_types' 2015-06-09 09:26:44 +02:00
Sascha Hauer 7a429bfb3b Merge branch 'for-next/misc' 2015-06-09 09:26:44 +02:00
Sascha Hauer 0c3bb48db9 Merge branch 'for-next/mem64' 2015-06-09 09:26:43 +02:00
Sascha Hauer 780c5c84e9 Merge branch 'for-next/imx' 2015-06-09 09:26:43 +02:00
Sascha Hauer d036dd5a66 Merge branch 'for-next/console' 2015-06-09 09:26:43 +02:00
Sascha Hauer ee2ac17df0 Merge branch 'for-next/am33xx' 2015-06-09 09:26:43 +02:00
Sascha Hauer e53e7218ad console: Add console_get_by_name
Commands like loadx/loady wish to find a console device by its name. Add
a function for this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-09 09:22:13 +02:00
Sascha Hauer 56b2fe72e8 console: Add functions to get/set baudrate
So C code can call a function rather than fiddling with device parameters.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-09 09:22:13 +02:00
Sascha Hauer 4cfc09da38 console: Add functions to get/set active state of console
Currently code needs to fiddle with the active parameter of a console
device directly to enable/disable consoles. Add console_set_active()
to set the status and console_get_active() to get the current status.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-09 08:12:33 +02:00
Sascha Hauer 79eba3029f crc16: Make buffer argument const
The buffer is not modified by crc16, so make the argument const.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-08 13:47:54 +02:00
Wadim Egorov e9bd26c7a7 net: dhcp: Split dhcp funcionality & add dhcp command
dhcp/bootp was bound to the command functionality.
This patch splits the dhcp command.
We are now able to use bootp without a shell.

This patch adds also a check for environment variables and globalvar.
So only when ENVIRONMENT_VARIABLES and GLOBALVAR is set, all received
dhcp data will be stored.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-05 13:32:39 +02:00
Sascha Hauer e76faaab92 remove unused nlink_t
The nlink_t type is unused in barebox, so drop it. This prevents
compile failures when architectures use the generic posix_types.h
which no longer has __kernel_nlink_t defined.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-03 09:53:57 +02:00
Sascha Hauer 21d1e6226c introduce generic posix_types.h
Most types defined in posix_types.h are architecture independent,
so instead of repeating this for each architecture add a generic
file that can be used by architecture code. To use it an architecture
must define BITS_PER_LONG properly in asm/bitsperlong.h.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-03 09:53:56 +02:00
Steffen Trumtrar 51de1b3c40 mtd: spi-nor: add cadence quadspi driver
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-29 09:08:49 +02:00
Steffen Trumtrar 160a10252e mtd: spi-nor: add SPI-NOR framework
Import the SPI-NOR framework from linux kernel v3.19.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-29 09:08:49 +02:00
Sascha Hauer 0228ccccdd fs: Add O_RWSIZE_8
To support native 64bit accesses in memcpy_sz.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-28 12:29:49 +02:00
Sascha Hauer f13f1c269e Merge branch 'pu/am335x' 2015-05-28 08:27:02 +02:00
Wadim Egorov f6c5578eaf bootsource: Add NET bootsource
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-27 08:56:07 +02:00
Marc Kleine-Budde 2a2c08f017 habv4: habv4_get_status(): fix warning with no-op static inline function
This patch fixes the following warning:

  CC      arch/arm/boards/foo/board.o
  In file included from arch/arm/boards/foo/board.c:22:0:
  include/habv4.h:24:19: warning: function declaration isn't a prototype [-Wstrict-prototypes]
   static inline int habv4_get_status()
                      ^

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 14:21:48 +02:00
Marc Kleine-Budde 099dcf6673 crypto: digest: mark signature argument as const
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 09:27:35 +02:00
Sascha Hauer 28a9133470 drop __BITS_PER_LONG
The kernel has __BITS_PER_LONG and BITS_PER_LONG. The formaer
is needed for architectures which support 32bit userspace on a
64bit kernel. This is not relevant for barebox, so drop
__BITS_PER_LONG and use BITS_PER_LONG only.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-22 08:00:48 +02:00
Sascha Hauer 9e7d9a5f2a dma: Use generic place for dma_addr_t typedef
Instead of letting all architectures define their own dma_addr_t use
a common place in include/linux/types.h and use a Kconfig symbol that
architectures can select to define the width of dma_addr_t. The same
is done in the Kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-22 08:00:48 +02:00
Masahiro Yamada 5731d3ebcc Abolish cpu_read* and cpu_write* accessors
Commit 2e6a88f210 (add cpu native ordered io accessors) introduced
these macros and then commit be57f20cdd (Fix big endian MMIO
primitives) figured out they are equivalent to __raw_{read,write}*.

They turned out unnecessary after all.  Anyway, most source files
use __raw_read* and __raw_write*.

Let's replace a few remaining references and abolish them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-20 08:05:44 +02:00
Uwe Kleine-König 145e65ab12 of: add a function to remove an of_fixup
This function is needed when a device that already registered a fixup in
the probe routine fails later to probe completely. Without unregistering
the fixup the function might later be called with invalid data.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-18 08:06:35 +02:00
Marc Kleine-Budde 65a8f2f8f1 state: backend: support phandle and of_path references
This patch improves the backend property, it can be either a phandle or a
of_path. During probe() of the state driver the backend property is
dereferenced and the resulting of_path is saved in the state context. In a
later patch it will be used to generate a phandle reference to the backend
during DT fixup.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:03:49 +02:00
Marc Kleine-Budde 0f56f0c5a1 state: make state_release() non static
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:49 +02:00
Sascha Hauer 041b2bd31f startup: introduce postenvironment_initcall
To allow init code that depends on the environment being loaded.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:42 +02:00
Marc Kleine-Budde 55c8ed306f watchdog: add static inline no-ops if WD is disabled
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:42 +02:00
Marc Kleine-Budde 880fe656f8 state: state_new_from_fdt(): remove unused function
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:25 +02:00
Andrey Smirnov 7aca256fac i.MX: serial: Add baud rate calculation convenience functions
Add two functions to calculate values for UBMR and UBIR
registers. This way both early serial initalization code and
serial_imx.c can use them and not duplicate the code.

Singed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-07 09:49:38 +02:00
Andrey Smirnov 18a5a9b969 i.MX: serial: Add constants for UART clock divisor
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-07 09:49:38 +02:00
Andrey Smirnov 089a70dc9c i.MX: Move UART definitions into a separate file
Move UART definitions into a separate file to avoid redefinition in
<mach/debug_ll.h> and magical constants in low level UART
initialization code.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-07 09:49:37 +02:00
Sascha Hauer 4de5f732c0 Merge branch 'for-next/of-device-id' 2015-05-06 21:36:13 +02:00
Sascha Hauer 67e4e8c056 Merge branch 'for-next/mvebu' 2015-05-06 21:36:13 +02:00
Sascha Hauer 3975737a7d Merge branch 'for-next/misc' 2015-05-06 21:36:13 +02:00
Sascha Hauer 4a854c9f49 Merge branch 'for-next/imx' 2015-05-06 21:36:12 +02:00
Steffen Trumtrar 10bb13e7fd usb: increase USB_CNTL_TIMEOUT to match linux
USB requests should be processed within a timeframe of 5s.
The linux kernel also uses this timeout value for the control packets.

For the musb the increase in timeout helps successfully probing USB devices
(at least on one test hardware), but on the other hand doesn't slow down the
system, if there are no devices, i.e. the timeout never hits. That means,
that the USB core correctly aborts instead of timing out.
Why and how the 100ms was chosen in the first place, can not be deduced from
the git history, just that it seems to work fine for most boards.

Change USB_CNTL_TIMEOUT to 5000ms and replace all occurences of
	`USB_CNTL_TIMEOUT * x`
with just
	`USB_CNTL_TIMEOUT`,
as the timeout is now large enough without it.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-04 09:23:08 +02:00
Antony Pavlov 377d261708 of: use 'const void *' for struct of_device_id.data
Since 2011 barebox' of_device_id struct uses unsigned long type for data field:

    struct of_device_id {
            char *compatible;
            unsigned long data;
    };

Almost always struct of_device_id.data field are used as pointer
and need 'unsigned long' casting.

E.g. see 'git grep -A 4 of_device_id drivers/' output:

    drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = {
    drivers/ata/sata-imx.c- {
    drivers/ata/sata-imx.c-         .compatible = "fsl,imx6q-ahci",
    drivers/ata/sata-imx.c-         .data = (unsigned long)&data_imx6,
    drivers/ata/sata-imx.c- }, {

Here is of_device_id struct in linux kernel v4.0:

    struct of_device_id {
            char name[32];
            char type[32];
            char compatible[128];
            const void *data;
    };

Changing of_device_id.data type to 'const void *data' will increase
barebox' linux kernel compatibility and decrease number of 'unsigned
long' casts.

Part of the patch was done using the 'coccinelle' tool with the
following semantic patch:

    @rule1@
    identifier dev;
    identifier type;
    identifier func;
    @@
    func(...) {
    <...
    - dev_get_drvdata(dev, (unsigned long *)&type)
    + dev_get_drvdata(dev, (const void **)&type)
    ...>
    }
    @rule2@
    identifier dev;
    identifier type;
    identifier func;
    identifier data;
    @@
    func(...) {
    <...
    - dev_get_drvdata(dev, (unsigned long *)&type->data)
    + dev_get_drvdata(dev, (const void **)&type->data)
    ...>
    }

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-30 08:12:57 +02:00
Sascha Hauer efe0fa9e92 net: phy: Add missing phy_unregister_device
The counterpart of phy_register_device is missing. Add it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-28 12:40:49 +02:00
Antony Pavlov 36c8344e0d linux/amba/bus.h: drop unusable amba_{g,s}et_drvdata macros
amba_{g,s}et_drvdata macros from linux kernel use
dev_{g,s}et_drvdata functions.

But in linux dev_get_drvdata() takes only one argument
while in barebox dev_get_drvdata() takes two arguments.
There is no dev_set_drvdata() in barebox at all.

So amba_{g,s}et_drvdata macros from linux are
unusable for barebox.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-28 08:55:19 +02:00
Sebastian Hesselbarth 60f947b494 bus: mvebu-mbus: Convert mbus platform driver to direct driver
Registering mbus driver as platform driver is a little late for
some register accesses to work. We have to make sure boot-up
mbus windows are disabled early, so call mbus driver directly
from SoC init.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-27 08:09:35 +02:00
Sebastian Hesselbarth 301765846b spi: Add SPI GPIO bitbang driver
This adds a driver for SPI master by GPIO pins.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-27 08:09:34 +02:00
Marc Kleine-Budde 885a1cf27e of_path: of_find_path(): add possibility to return .bb device
This patch adds a flags argument to the of_find_path() function. The only flag
defined for now is OF_FIND_PATH_FLAGS_BB. When used on NAND devices, the
function returns the bad block aware device (the ".bb" device).

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-23 08:12:28 +02:00
Marc Kleine-Budde 1aa3dbfc1a timeout: factor out wait-for-key-press loop into separate file
This patch factors out the wait-for-key-press loop from the shell command
"timeout" into a sparate file, so that it can be used from C, too.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-23 08:12:28 +02:00
Sascha Hauer 9d309e5a19 led: Fix led_gpio_rgb_unregister prototype
Analog to the other led_unregister prototypes this must take
the LED type specific struct.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-20 07:00:21 +02:00
Marc Kleine-Budde 9e69a04222 include: add includes includes to make fdt.h, of.h and state.h self contained
Otherwise compilation may fail with:

include/fdt.h:11:15: error: unknown type name 'uint64_t'
 static inline uint64_t fdt64_to_cpu(uint64_t x)

include/of.h:22:19: error: field 'list' has incomplete type
  struct list_head list;

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-17 07:31:35 +02:00
Uwe Kleine-König fd678c4973 drivers/base: Mark (of|platform)_device_id data as constant
There should be no reason to ever change the data pointed to by id_table
or of_compatible. So make this offical by adding some 'const's.

In Linux the corresponding pointers are marked as const, too.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-17 07:31:35 +02:00
Sascha Hauer f49f067bdd pci: Do not abuse dev->priv for storing data
dev->priv is for private use of the device driver, so do not
use it in the pci core. Instead, introduce a id field in struct
pci_device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2015-04-17 07:31:21 +02:00
Sebastian Hesselbarth ab3da15bc1 base: Introduce deferred probing
As expected, we would need deferred probing sooner or later. This is
a first approach to allow devices to return -EPROBE_DEFER and get
sorted into a list of deferred devices that will be re-probed later.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-17 07:23:46 +02:00
Marc Kleine-Budde 29abc10d44 habv4: add High Assurance Boot v4
This patch adds the code to check the HAB ROM for failures during development.
Add a cal to "habv4_get_status();" to your board file, to get the current
system state from the ROM.

_NOTE_: On i.MX6 this has to happen before barebox starts the MMU, because the
        HAB ROM vector table is placed at 0x94, which is not accessible after the
	MMU has setup the zero page.

This patch contains code ported from u-boot patches [1][2] by Shaojun Wang [3]
which were found in the "Mx28 Secure Boot" and "Mx6 HAB (High Assurance Boot)"
thread on the freescale community forum [4][5].

[1] https://community.freescale.com/servlet/JiveServlet/download/370047-269174/0001-enable-mx28-u-boot-hab.patch.txt.zip
[1] https://community.freescale.com/servlet/JiveServlet/download/96451-11-266175/0001-u-boot-enable-mx6-hab.patch.zip
[2] https://community.freescale.com/people/ShaojunWang
[3] https://community.freescale.com/thread/317254
[3] https://community.freescale.com/docs/DOC-96451

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-15 07:12:17 +02:00
Sascha Hauer ee0035e5cc Merge branch 'for-next/state' 2015-04-13 12:57:14 +02:00
Sascha Hauer a76a6bc8fd Merge branch 'for-next/pxa' 2015-04-13 12:57:13 +02:00
Sascha Hauer 9c4cf7d3b6 Merge branch 'for-next/pci' 2015-04-13 12:57:13 +02:00
Sascha Hauer 909dbe5334 Merge branch 'for-next/crypto' 2015-04-13 12:57:12 +02:00
Robert Jarzmik 1e72d3c622 net: smc1111: add a quirk for pxa pxa27x platforms
As hinted in the linux kernel driver, pxa platforms such as mainstone,
stargate and idp have a broken design, where half-word writes not
aligned to a word address are not working.

This patch is a taking back the half-word write accessor for this
specific case from the linux kernel.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-13 09:24:00 +02:00
Lucas Stach da440ab859 pci: make sure to activate devices on the root bus
Commit b8a1bb1dd2 (pci: defer device registration until after bridge setup)
changed the activation order of devices, so that bridges above the devices could
be configured properly before activating the devices below. This commit failed
to acknowledge that there may be devices located directly on the root bus without
any bridge in between and so those devices would never get enabled.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
2015-04-13 08:34:28 +02:00
Jean-Christophe PLAGNIOL-VILLARD 144e104a1e crypto: sha1: switch to linux implementation
current implementation

$ ls -al build/versatilpb/arch/arm/pbl/zbarebox.bin
-rw-r--r-- 1 root root 211095 Mar 24 13:21 build/versatilpb/arch/arm/pbl/zbarebox.bin

linux generic implementation

$ ls -al build/versatilpb/arch/arm/pbl/zbarebox.bin
-rw-r--r-- 1 root root 210829 Mar 24 13:21 build/versatilpb/arch/arm/pbl/zbarebox.bin

on a compressed lzo barebox we will 266 bytes

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-27 07:49:45 +01:00
Jean-Christophe PLAGNIOL-VILLARD c3fe3d7059 crypto: hmac: move register to hmac
As we will use the best sha algo at runtime

Add a new init level crypto_initcall to ensure that all the sha present
before hmac

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-27 07:49:45 +01:00
Jean-Christophe PLAGNIOL-VILLARD ab5b2c35e1 crypto: prepare to allow multiple digest driver
This will allow to have hw driver or asm optimised driver.

Use a priority level to determine which one to use at runtime.
The generic one will be 0.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-27 07:49:45 +01:00
Jean-Christophe PLAGNIOL-VILLARD e10cc0b333 digest: allow algo to specify their length at runtime
such as RSA as we load a DER key we will detect the key size
at runtime and so the algo length.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-27 07:49:45 +01:00
Jean-Christophe PLAGNIOL-VILLARD ca95c2531f crypto: digest: speficied when a digest need a key to be used
such as for hmac(xxx) you must provide a key

This will allow to enforce the correct parameter at digest command

<digest>sum is not impacted

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-20 11:45:55 +01:00
Jean-Christophe PLAGNIOL-VILLARD b0be99fc10 command: add generic digest command
That can be used for digest calculation and verify

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-20 11:45:55 +01:00
Sascha Hauer df4b6f133b lib: Add hex2bin and bin2hex implementations
Taken from the Kernel, put into the same place as in the kernel,
although the hexdump.c does not actually contain hexdum functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-19 07:50:21 +01:00
Jean-Christophe PLAGNIOL-VILLARD 9f15b42105 command: allow runtime usage
This will allow as example to list the currently supported digest.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-19 07:46:22 +01:00
Jean-Christophe PLAGNIOL-VILLARD 5f5d5331bb crypto: add pbkdf2 hmac key generator
this will allow to generate a KEY + IV based on a password and salt for AES
encryption/decryption as example

or simply the key for hmac or rsa from text password

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-19 07:46:22 +01:00
Jean-Christophe PLAGNIOL-VILLARD 7aeb9650b6 digest: add digest callback
Combination of @init and @update and @final. This function
effectively behaves as the entire chain of operations, @init,
@update and @final issued in sequence. This is added for hardware
which cannot do even the @finup, but can only do the whole
transformation in one run.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-19 07:46:22 +01:00
Jean-Christophe PLAGNIOL-VILLARD ec4f969971 digest: add verify callback
this will allow to compare a md with the original one

When calling this do not call final

For RSA_SIGN verification final does not exist only verify
as final will be for signing

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-19 07:46:22 +01:00
Jean-Christophe PLAGNIOL-VILLARD 92138a7754 crypto: digest: digest_file_window/digest_file/digest_file_by_name drop key params
expect the key to be set before calling

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-19 07:46:15 +01:00
Sascha Hauer f929fab29c pci: Add i.MX6 pcie support
Based on the corresponding kernel driver with changes to make it
work on barebox.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-17 07:36:00 +01:00
Sascha Hauer 025362e2cc pci: pci_regs.h: Sync with Linux
Sync the pci register definitions with Linux 4.0-rc1. Some are needed
for the upcoming designware pcie driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-17 07:29:55 +01:00
Sascha Hauer ac2407db7a crypto: digest: Make string arguments const
Most string arguments for keys and filenames can be const. Change
that.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-13 08:32:28 +01:00
Jean-Christophe PLAGNIOL-VILLARD 102d59f91f command: add hmac sum supportfor md5, sha1, sha224, sha256, sha384, sha512
pass the key via -h param

barebox@barebox sandbox:/ sha256sum -h test /dev/fd0
c297473e9bb221c5dc51d47ad75c76095f1bdc4ca9dff1d5931c2e22bf11a0de  /dev/fd0 0x00000000 ... 0xffffffffffffffff

use the same idea as openssl command

$ openssl dgst -sha256 -hmac "test" TODO
HMAC-SHA256(TODO)= c297473e9bb221c5dc51d47ad75c76095f1bdc4ca9dff1d5931c2e22bf11a0de

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-13 08:32:28 +01:00
Jean-Christophe PLAGNIOL-VILLARD 2f3c3f512b digest: add HMAC support for md5, sha1, sha224, sha256, sha384, sha512
the hmac algo will be registered as hmac(%s) such as hmac(sha256)

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-13 08:32:28 +01:00
Sascha Hauer 5dd5884801 lib: Add hex2bin and bin2hex implementations
Taken from the Kernel, put into the same place as in the kernel,
although the hexdump.c does not actually contain hexdum functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-13 08:22:27 +01:00
Sascha Hauer 1487e6b9ad state: add framework for persistent state handling
This patch adds a framework to describe, access, store and restore a set of
variables. A state variable set can be fully described in a devicetree node.
This node could be part of the regular devicetree blob or it could be an extra
devicetree solely for the state. The state variable set contains variables of
different types and a place to store the variable set.

For more information see:
    Documentation/devicetree/bindings/barebox/barebox,state.rst

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 08:28:31 +01:00
Jean-Christophe PLAGNIOL-VILLARD dcc4a70a3c gitignore: only ignore include/config.h
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 08:18:26 +01:00
Jean-Christophe PLAGNIOL-VILLARD 27b2336029 digest: make it multi-instance
Now you need to call digest_alloc and when you finish to use it digest_free.

We need this for upcomming aes encryption support and secure boot
as we will need multiple instance of the same digest.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 07:58:24 +01:00
Jean-Christophe PLAGNIOL-VILLARD 804fae5d16 digest: introduce digest_{init/update/final/length}
This will allow to move from a one at a time digest to a multi-instance
with too much impact on the code using it

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 07:58:24 +01:00
Lucas Stach 3c5e8206c2 parameter: include header for ERR_PTR and errno
Commit 03b59bdb64 (paramter: The dev_add_param_*() return ERR_PTR(),
change no-ops to return ERR_PTR(-ENOSYS) instead of NULL) started using
ERR_PTR and errnos without including the relevant header.

This fixes the build for a lot of configurations.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-11 09:36:38 +01:00
Marc Kleine-Budde 03b59bdb64 paramter: The dev_add_param_*() return ERR_PTR(), change no-ops to return ERR_PTR(-ENOSYS) instead of NULL
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-10 11:08:23 +01:00
Sascha Hauer fa20ea45e0 Merge branch 'for-next/tegra' 2015-03-09 08:32:26 +01:00
Sascha Hauer 4680b375b9 Merge branch 'for-next/streaming-dma'
Conflicts:
	drivers/mci/dw_mmc.c
2015-03-09 08:32:21 +01:00
Sascha Hauer 55ab01c7ff Merge branch 'for-next/rockchip'
Conflicts:
	arch/arm/Kconfig
2015-03-09 08:30:35 +01:00
Sascha Hauer ac81a0d876 Merge branch 'for-next/misc' 2015-03-09 08:30:24 +01:00
Sascha Hauer ac1bffb220 Merge branch 'for-next/fs' 2015-03-09 08:30:24 +01:00
Sascha Hauer 6977292a34 fs: rename inode member of struct filep to priv
Because that's what it is. 'inode' will become confusing
once we support real inodes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-09 08:06:41 +01:00
Sascha Hauer 6bcfcece08 Merge branch 'for-next/sandbox-of' 2015-03-06 08:33:50 +01:00
Sascha Hauer 0e055c254c Merge branch 'for-next/mtd-partitions' 2015-03-06 08:33:43 +01:00
Lucas Stach 381f034ed6 ARM: move DMA alloc functions to dma.h
This better separates the DMA from the MMU functionality.

Also move all drivers that only depends on asm/mmu.h for the alloc
functions over to the common header.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:52:02 +01:00
Lucas Stach a0c4e2203f dma: add streaming DMA ops
This will allow us to implement cache maintenance in a platform
agnostic way.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:51:51 +01:00
Lucas Stach f61fa09a42 usb: gadget: include common.h in header
It is needed for container_of() and this header falls
over if we change the include order.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:51:47 +01:00
Andrey Panov 0cc6949870 ARM: Rockchip: Update clk driver from Linux kernel for use with newer DTS
Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-05 15:19:28 +01:00
Andrey Panov 919d4651ce CLK: Add helper defines to barebox-wrapper.h for easier porting of drivers from Linux kernel
Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-05 09:11:34 +01:00
Andrey Panov e3459c10ab CLK: clk-divider: Respect CLK_DIVIDER_POWER_OF_TWO flag
Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-05 09:11:34 +01:00
Andrey Panov 5a3a479dae CLK: clk-divider: Introduce clk_divider_alloc() and *_free() routines
Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-05 09:11:34 +01:00
Andrey Panov 9e3ce4eee6 CLK: clk-divider: Respect CLK_DIVIDER_HIWORD_MASK flag
It is required for Rockchip SoCs where clock settings registers have
write-enable mask in high word.

Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-05 09:11:34 +01:00
Andrey Panov 7baf7df9fd CLK: clk-mux: Respect CLK_MUX_HIWORD_MASK flag
It is required for Rockchip SoCs where clock settings registers have
write-enable mask in high word.

Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-05 09:11:34 +01:00
Andrey Panov 22a0c31c92 CLK: Add fractional divider clock support from Linux kernel
Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-05 09:11:33 +01:00
Andrey Panov 9eb9f00043 CLK: Add support for composite clock from Linux kernel
Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-05 09:11:33 +01:00
Andrey Panov 78d030226d lib: Add gcd() function
It calculates greatest common divisor.

Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-05 09:11:33 +01:00
Lucas Stach 6b73603f16 bbu: include necessary headers
Fixes compile errors due to undefined symbols.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-04 11:34:08 +01:00
Marc Kleine-Budde f3ca81f0e0 of: add no-op functions for of_find_node_by_alias() and of_find_node_by_path_or_alias()
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-03 08:25:59 +01:00
Marc Kleine-Budde 58e0e42d8e of: add no-op function for of_register_fixup()
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-03 08:25:59 +01:00
Marc Kleine-Budde 89fc8c31ff fs: make "offset" parameter of erase() and protect() 64 bit safe
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-03 08:23:46 +01:00
Marc Kleine-Budde c961485abf drivers: remove unused function dev_protect()
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-03 08:23:46 +01:00
Wadim Egorov c918022532 reset_source: Add external reset
Some SoCs have special device pins for external reset signals.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-02 07:54:13 +01:00
Sascha Hauer b42a3e2f68 ARM: Allow to mask data aborts
Sometimes it's useful to test if a memory operation works or
aborts. This adds data_abort_mask() to ignore data aborts and
data_abort_unmask() to enable them again. This is used in the
next step for the 'md' command so that illegal addresses just
show 'xxxxxxxx' instead of crashing the system.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-27 13:17:31 +01:00
Sascha Hauer ed440360e6 mtd: fixup device tree partitions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:44 +01:00
Sascha Hauer c1156d841f cmdlinepart: add function to parse a cmdline partition string
This adds a function to parse a full cmdline partition string. The
addpart command is switched to use this function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:43 +01:00
Sascha Hauer 10a0aaabfe cmdlinepart: make argument types safer
The return size should be loff_t to support partitions bigger
than 4G. Also use const for the devname and endp.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:43 +01:00
Sascha Hauer 39f6392d93 move cmdline partition parsing code to separate file
So it's no longer local to the addpart/delpart code and can be used
from other code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:43 +01:00
Sascha Hauer 7649473f40 mtd: nand: remove automatically created bb devices
the bb devices which are created in add_mtd_device() must be removed
in del_mtd_device(). Also remove deletion of the bb devices in the
mtdparts-add environment file.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:43 +01:00
Sascha Hauer 99bed34278 mtd: Add partitions to list
So that we can iterate over the existing partitions from the master
mtd device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:43 +01:00
Sascha Hauer 977be3d715 of: Add for_each_child_of_node_safe
Needed for iterating over child nodes and deleting the children.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:42 +01:00
Sascha Hauer 2afe398a62 Merge branch 'for-next/raspberry-pi' 2015-02-04 19:09:15 +01:00
Sascha Hauer 1b95290433 Merge branch 'for-next/pxa' 2015-02-04 19:09:15 +01:00
Sascha Hauer ce961e3412 Merge branch 'for-next/misc' 2015-02-04 19:09:15 +01:00
Sascha Hauer 91d4a4264b Merge branch 'for-next/minmax' 2015-02-04 19:09:15 +01:00
Jean-Christophe PLAGNIOL-VILLARD 515fefa8a5 regulator: allow to use it with non DT device
this will use the device name as regulator name

with the same Algo as clkdev for lookup

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-04 15:49:59 +01:00
Jean-Christophe PLAGNIOL-VILLARD 22f4e94010 driver: add postcore_platform_driver
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-04 15:49:59 +01:00
Robert Jarzmik a8d19f1f2f net: smc1111: extend the driver for 91c94 and 91c96 support
All the smcs family chips 91c94, 91c96, 91c100, 91c111 share almost the
same behavior and register sets. The noticeable exceptions are coped
with in this patch, ie :
 - 91c94 and 91c96 only have an internal 10 Mbps phy
   The registers used for phy discovery on later chips will corrupt the
   91c96 state.
 - 91c94 and 91c96 have a control and config register quite different
   from their 91c1xx conterparts
   A platform data user defined couple of registers is introduced. If
   these values are 0, 91c1xx legacy behavior is assumed.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-04 12:52:43 +01:00
Robert Jarzmik d6f8016ce7 net: smc1111: add 16 bits accessors, allow address shift
Smc network IPs can be wired up in different funny ways. For example the
lubbock pxa25x development platform wires all address lines shifted by
2, ie. bus A2 is smc91c96 A0, bus A3 is smc91c96 A1 etc ...

In order to cope with the different possible combination, add a shift
parameter for addresses.

By default, the old behaviour using the 32 bit accesses is kept.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-04 12:52:43 +01:00
Masahiro Yamada 262eef7c6a usb: abolish wait_ms() function
This function is only used in drivers/usb/*.
It is equivalent to mdelay().

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-02 11:46:30 +01:00
Masahiro Yamada 41be004e8d linux/kernel.h: move some macros and prototypes
The include/common.h is still cluttered (although much better than
U-Boot).  It contains various utility macros that originates
in Linux.  Move them to the original place, include/linux/kernel.h,
to slim down include/common.h.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-29 08:48:30 +01:00
Masahiro Yamada 8960b0ff81 asm-generic/bug.h: move BUG(), BUG_ON(), WARN(), WARN_ON() macros
In Linux, these macros are defined in include/asm-generic/bug.h.
To tidy up common.h, move BUG(), BUG_ON(), WARN(), WARN_ON() there.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-29 08:48:30 +01:00
Masahiro Yamada a07a472cac linux/bug.h: move BUILD_BUG_ON*() macros
In Linux, the macros BUILD_BUG_ON* are defined in include/linux/bug.h.
To tidy up common.h, move BUILD_BUG_* there.

MAYBE_BUILD_BUG_ON is not used in barebox and it was removed from Linux
long time ago.  Drop it from barebox, too.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-29 08:48:30 +01:00
Stefan Christ a114e9b00c ARM: i.MX6: use generic calculation in nand bbu handler
The parameters ECC Strength, BadBlockMarkerByte and BadBlockMarkerStartBit in
the FCB structure depends on the nand chip's pagesize and oobsize. Instead of
hardcoding these values into the imx6 bbu handler calculate these values on the
fly. Therefore we export the necessary functions from the nand_mxs driver to
use them in the bbu handler.

Signed-off-by: Stefan Christ <s.christ@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-29 07:58:00 +01:00
Masahiro Yamada bfa1b12fed linux/kernel.h: add more *_MAX, *_MIN macros
Imported from Linux 3.19-rc5.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-21 14:58:07 +01:00
Masahiro Yamada d27077bd76 linux/kernel.h: rename USHORT_MAX, SHORT_MAX, SHORT_MIN
Linux uses SHRT_* instead of SHORT_*.  The <limits.h> of C does
the same.  Let's follow this standard.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-21 14:58:07 +01:00
Masahiro Yamada 2ce9068d85 linux/kernel.h: move *_MAX, *_MIN macros
Linux defines *_MAX, *_MIN macros in include/linux/kernel.h.
Let's follow this way to slim down the common.h.

This change should have no impact because include/common.h already
includes <linux/kernel.h>.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-21 14:58:07 +01:00
Masahiro Yamada ec258b8bd0 debug_ll: change the argument type of putc_ll()
Most of the implementations of PUTC_LL() takes "char"
(some take "int"), not "unsigned char".
Moreover, puts_ll() takes an argument with "const char *" type.

Let's drop "unsigned" from the prototype of putc_ll().

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-21 14:57:05 +01:00
Robert Jarzmik 0ebe45422a mtd: nand: add mrvl-nand driver
The driver is taken from the Linux kernel, with the following changes :
 - all DMA removed
 - all asynchronous handling removed, including the interrupt handler,
   and the asynchronous state handling
 - pxa armada support removed

Most the kernel structure was kept, to ease up future fixes integration
from the kernel driver.

The driver is tested on a pxa3xx system development
board (aka. zylonite), and reading, writing, erasing, and bad block
management were tested.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-19 09:02:23 +01:00
Jean-Christophe PLAGNIOL-VILLARD a1a582f4e0 console: allow to specify the device id
so we can use dynamic number id with specific devname

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-13 08:48:59 +01:00
Sascha Hauer b396f38596 Merge branch 'for-next/netconsole' 2015-01-09 17:38:27 +01:00
Sascha Hauer 39c6c3480a Merge branch 'for-next/mxs' 2015-01-09 17:38:26 +01:00
Sascha Hauer ff6383c8e4 Merge branch 'for-next/misc' 2015-01-09 17:38:26 +01:00
Sascha Hauer cc843dadfd Merge branch 'for-next/efi' 2015-01-09 17:38:26 +01:00
Masahiro Yamada 11f588be31 sizes.h: sync with Linux 3.19-rc3
Looks like I am also highly addicted to Linux...

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-08 14:00:34 +01:00
Masahiro Yamada d8753571b2 sizes.h: move include/sizes.h to include/linux/sizes.h
This file originates in Linux.  Linux has it under include/linux/
directory since commit dccd2304cc90.
Let's move it to the same place as well in barebox.

This commit was generated by the following commands:

  find -name '*.[chS]' | xargs sed -i -e 's:<sizes.h>:<linux/sizes.h>:'
  git mv include/sizes.h include/linux/

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-08 14:00:26 +01:00
Jean-Christophe PLAGNIOL-VILLARD 40662bbb59 driver: workaroud resource request that conflicts with errno PTR
broken since

commit ed6e965824
Author:     Sascha Hauer <s.hauer@pengutronix.de>
resource: Let dev_request_mem_region return an error pointer

Introduce dev_request_mem_region_err_null

only used on platform like at91 where the resource address conflicts
with errno PTR.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-08 08:07:58 +01:00
Sascha Hauer 663b895e49 malloc: Add a function to detect if malloc pool is already initialized
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-05 11:30:59 +01:00
Sascha Hauer a9d7b3d00e Add PBL console support
This adds simple console support to the PBL which makes it
possible to print more complex messages in the PBL than just
strings or hex numbers. For now puts_ll is used to print the
messages, so it depends on CONFIG_DEBUG_LL which makes it
more a debugging option. However, this could be extended later
to get regular output from the PBL if desired.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-05 11:30:59 +01:00
Sascha Hauer 2e1a6c9bce console: Add set_active callback
The netconsole needs to be able to deny activation when the network
has not been enabled. Add an optional callback to the console for
this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-17 15:08:04 +01:00
Lucas Stach 46b5a6d652 fs: efivars: implement write support
Implement the standard FS ops for writing/manipulating
efivars.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-09 09:59:10 +01:00
Lucas Stach 42c8b4589a lib: add wchar strdup
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-09 09:59:10 +01:00
Lucas Stach 0f377d6d40 efi: add Barebox GUID
A proper GUID is needed to namespace all sorts of
things, most prominently persistent variables.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-09 09:59:09 +01:00
Lucas Stach e4f3215be2 efi: add proper reset hook
This allows to actually reset the system from barebox
instead of dropping back into the EFI firmware.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-09 09:59:09 +01:00
Lucas Stach da94ff1e37 efi: add function to determine type of device path
Thanks to the wonders of UEFI we have to walk down the
device path all the way until we arrive at the device
we got this path from...

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-09 09:59:09 +01:00
Sascha Hauer b01bc4c810 Merge branch 'for-next/randconfig-1' 2014-12-08 14:54:11 +01:00
Sascha Hauer 3eade89c75 Merge branch 'for-next/persistent-vars'
Conflicts:
	arch/arm/boards/efika-mx-smartbook/defaultenv-efikasb/config
2014-12-08 14:54:09 +01:00
Sascha Hauer c2b5a7015b Merge branch 'for-next/misc' 2014-12-08 14:53:59 +01:00
Sascha Hauer d3933bd350 Merge branch 'for-next/marvell' 2014-12-08 14:53:59 +01:00
Jan Luebbe 48ba0a1afd fdt: of_unflatten_dtb can work on const data
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-04 08:24:05 +01:00
Jan Luebbe 0d752cb78c stringlist: the string argument should be const
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-04 08:24:05 +01:00
Sascha Hauer 604aff3178 gpio: move gpio_is_valid to include/gpio.h
No architectue implements its own gpio_is_valid() function, so move
the only existing implementation to include/gpio.h where it's available
for all users.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-28 15:21:27 +01:00
Sascha Hauer 0d5c1b9e97 param: make string arguments to dev_add_param_fixed const
dev_add_param_fixed does not modify the strings, so make them
const.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-28 15:21:26 +01:00
Lucas Stach 85383d2115 envfs: include errno.h
Fixes: include/envfs.h:124:10: error: 'ENOSYS' undeclared

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-26 19:21:09 +01:00
Lucas Stach 93b7459e1c lib: decompress_xz: fix function header to match prototype
Fixes:
lib/uncompress.c:124:10: warning: assignment from incompatible pointer type

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-24 14:04:11 +01:00
Jan Luebbe 7dc430e612 stringlist: string_list_contains can use a const string
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-20 14:36:19 +01:00
Ezequiel Garcia 2caa4bbdcc net: phy: Support Marvell 88EE1543 PHY
This commit adds support for Marvell's 88E1543 PHY chip. This chip is
almost identical to the 88EE1545, except the 88E1545 supports QSGMII
and the 88EE1543 supports SGMII.

Therefore, the same configuration function is used for both PHYs. For now,
the only initialization provided for the 88EE1543 is the LED setup.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-11 14:59:43 +01:00
Ezequiel Garcia 9a026a2efa net: phy: Support Marvell 88EE1545 PHY
This commit adds support for Marvell's 88E1545 PHY chip. In particular, this
allows to support QSGMII interfaces.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-11 14:59:43 +01:00
Sascha Hauer 32e879f0a3 globalvar: Add support for printing all global variables
This could previously only be done with 'devinfo global'. While
this is still possible this adds a more direct access via the
globalvar command. This variant also adds a '*' in front of
the variable if the corresponding non volatile variable exists.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 12:23:12 +01:00
Sascha Hauer 9f11887009 libfile: Add copy_recursive
To recursively copy a directory tree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 10:58:55 +01:00
Sascha Hauer 3249006a2f Add support for non volatile variables
This adds (back) support for non volatile variables. Non volatile
variables are variables which are stored in the environment over
reboot. They are used in the same way as the global variables, but
with a 'nv' command and device. The variables are stored under
/env/nv/, one variable per file. Adding a nv variable automatically
adds a global variable with the same name. Changing a nv variable
also changes the same global variable, but not the other way round.
This allows for example to configure the username as:

nv user=sha; saveenv

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 10:58:54 +01:00
Sascha Hauer 592d35a47c Merge branch 'for-next/xz' 2014-11-05 15:47:39 +01:00
Sascha Hauer 7b4cc54579 Merge branch 'for-next/tegra' 2014-11-05 15:47:39 +01:00
Sascha Hauer e3c49aac69 Merge branch 'for-next/misc' 2014-11-05 15:47:39 +01:00
Sascha Hauer da1a9005c2 Merge branch 'for-next/fs' 2014-11-05 15:47:38 +01:00
Sascha Hauer 18ded420f7 Merge branch 'for-next/am335x' 2014-11-05 15:47:37 +01:00
Zahari Doychev f95ce0fff0 common: fix mbr filetype detection
Sometimes mbr is erroneously recocognised as FAT partion. Due to this the mbr
partition parser is not being called and the partitions on the media are not
detected. This patch should  fix the problem. The checking is done as in the
linux kernel.

I have seen the problem using usb sticks. Although partitioning and formatting
them under linux. The file system type field in the mbr remains there which
causes the wrong detections as FAT32 type and not as mbr.

Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-05 14:53:28 +01:00
Sascha Hauer ccb2816477 Add xz decompression support
This adds xz decompression support from the kernel. Both compressing
the barebox binary with xz and decompressing xz files on the commandline
is supported.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-04 12:18:55 +01:00
Lucas Stach f63a42a999 reset_source: add thermal reset
Some SoCs are able to detect if they got reset
in response to an overtemperature event.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-04 12:16:20 +01:00
Lucas Stach 9d1fbc5d12 add generic PHY framework
This brings in the generix PHY framework from Linux.
I tried to strip it down as much as possible while
keeping it useful.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-04 09:50:44 +01:00
Teresa Gámez 3249a71b26 of: Add of_device_enable_and_register functions
Function to enable and register a disabled device.
The devices can be registered using the
device node with of_device_enable_and_register() or
with the device node name/path by using the
of_device_enable_and_register_by_name() function.

Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-03 15:44:18 +01:00
Alexander Shiyan c0d6aa097d serial: ns16550: Remove unused fields from NS16550_plat structure
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-03 13:26:11 +01:00
Sascha Hauer 2f81d316d2 filetype: Add XZ filetype support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-24 07:51:14 +02:00
Sascha Hauer 7014e83f09 include/environment.h: Add missing include
include/environment.h uses error codes, so it needs errno.h.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-22 15:57:08 +02:00
Sascha Hauer 6cf5b986d9 libfile: add compare_file function
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-09 08:47:18 +02:00
Sascha Hauer ade0583602 param: let dev_add_param return the newly created param
dev_add_param creates a new parameter so it makes more sense to
return it than to return an error code. Since the return value
is hardly ever checked this is only a small patch.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 16:33:34 +02:00
Sascha Hauer a3993a38da fs: implement fstat
fstat is useful to get information about an already opened file. Add
it to barebox.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 16:11:06 +02:00
Sascha Hauer 4f7a18cdb5 fs: Store the path in struct filep
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 16:09:17 +02:00
Sascha Hauer bfef6cd5f2 fs: store pointer to fsdev instead of dev in struct filep
The struct device_d * in struct filep is never of interest, instead
it is always converted to a struct fs_device_d *, so simplify the code
by storing the struct fs_device_d * directly.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 16:06:21 +02:00
Lucas Stach 2840294a51 of: import pci range parser from linux
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 08:39:01 +02:00
Lucas Stach 490d4fe417 pci: track parent<->child relationship
So that PCI devices hang down from bridges and root
bridges down from the PCI host controller when
calling devinfo.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 08:39:01 +02:00
Lucas Stach 687ceb7716 pci: setup bridges and traverse buses behind them
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 08:39:01 +02:00
Lucas Stach beb6469992 pci: properly populate prefetchable BARs
Some host controllers provide a prefetchable
memory area and devices will prefer this for
some of their BARs.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 08:39:01 +02:00
Lucas Stach 06ac5b551e pci: add resource enum
Makes things way clearer than juggling numbers.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 08:39:00 +02:00
Sascha Hauer fbb191fd41 console: Fix CONSOLE_NONE support
Without console support we need a static inline version of
pr_print and dev_printf, otherwise we get link errors.

Reported-by: Kevin Du Huanpeng <u74147@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 08:05:49 +02:00
Sascha Hauer 9d7cd03e2a Merge branch 'for-next/of' 2014-10-02 08:54:42 +02:00
Sascha Hauer 815288c598 Merge branch 'for-next/net-phy' 2014-10-02 08:54:42 +02:00
Sascha Hauer a65334019b Merge branch 'for-next/musb' 2014-10-02 08:54:42 +02:00
Sascha Hauer 08d86870b2 Merge branch 'for-next/mips' 2014-10-02 08:54:41 +02:00
Sascha Hauer 0846940668 Merge branch 'for-next/marvell' 2014-10-02 08:54:41 +02:00
Sascha Hauer 2a2a8b9052 Merge branch 'for-next/imx' 2014-10-02 08:54:41 +02:00
Sascha Hauer d0064495d3 Merge branch 'for-next/firmware' 2014-10-02 08:54:41 +02:00
Teresa Gámez e5707ec702 of: Added of_set_property_to_child_phandle
Set a property to a phandle of a child node. This may be used
for selections like display-timings.

Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-01 08:13:02 +02:00
Teresa Gámez d1d7876499 of: base: Add of_parse_phandle_from
Added of_parse_phandle_from() to be able to use external root nodes.

Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-01 08:13:02 +02:00
Teresa Gámez 55475204cd of: base: Add of_find_node_by_phandle_from
Added of_find_node_by_phandle_from() to find nodes by
phandle with a given root node.

Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-01 08:13:02 +02:00
Teresa Gámez 1e19346e97 of: base: Add for_each_node_by_name_from
Added for_each_node_by_name_from() to be able to
pass external root node.

Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-01 08:13:02 +02:00
Sascha Hauer 930ce6e142 Introduce message logging support
This adds a buffer for log messages and a 'dmesg' command to
print the messages. The log buffer is implemented as log objects
rather than a string buffer. This makes it easy to implement
limiting the messages, cleaning the buffer and timestamping
the messages.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-30 15:33:22 +02:00
Sascha Hauer 96cae61eba clock: Add a variable with the first timestamp after startup
For measuring the startup time it's useful to save the first
timestamp after the clocksource has been registered.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-30 10:44:15 +02:00