9
0
Fork 0
Commit Graph

3196 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther ca1b8e0ef2 Copy and paste header for gcc6 as well..
Same reasoning as with the gcc5 approach in this older commit
34a48171a6
2017-03-29 23:45:24 +02:00
Holger Hans Peter Freyther 34a48171a6 misc: Include compiler-gcc5.h from u-boot/linux
Upstream barebox has removed the compiler-gcc3/4 header files for
a unified header but I do not want to risk breaking gcc4 support
for the unknown gcc5 work right now.
2015-11-25 16:34:41 +01:00
Jan Luebbe 21203581e7 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>
2015-07-30 16:46:27 +02:00
Sascha Hauer db0d4ccd56 mtd: ubi: Let ubidetach take mtd as argument
The ubi number is a dynamically assigned number, so once multiple
ubis are attached, scripts cannot know the ubi number they want
to detach anymore. Convert the ubidetach command to take the mtd
device file instead which is the same argument that was previously
passed to ubiattach.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:42:33 +02:00
Marc Kleine-Budde 6a11cd1539 bootstate: add framework for redundant boot scenarios
There are several use cases where a redundant Linux system is needed. The
barebox,bootstate framework provides the building blocks to model different
use cases without the need to start from the scratch over and over again.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-06-10 13:42:33 +02:00
Sascha Hauer e4cabc3d89 blspec: automatically append bootargs
When bootloader spec is used to boot devices it is often desirable
to boot the same image from different media. Since the fs images
need to contain the root= parameters to tell Linux where to boot
from the images can't be identical on different media.

This patch changes this by introducing a 'appendroot' option for
bootloader spec. If set to true, barebox will construct a Linux
commandline option for the device the bootloader spec entry is found
on.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:42:33 +02:00
Marc Kleine-Budde 61eebbcf8e watchdog: add static inline no-ops if WD is disabled
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Applied-Upstream: next, commit:91936ddc4485
2015-06-10 13:42:33 +02:00
Marc Kleine-Budde 680fa68f10 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-06-10 13:35:26 +02:00
Uwe Kleine-König e30ee4fa55 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-06-10 13:35:26 +02:00
Marc Kleine-Budde 827421e7d5 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-06-10 13:35:26 +02:00
Marc Kleine-Budde b858e28942 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-06-10 13:35:25 +02:00
Marc Kleine-Budde 2216338453 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-06-10 13:35:25 +02:00
Sascha Hauer f13f1c269e Merge branch 'pu/am335x' 2015-05-28 08:27:02 +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