summaryrefslogtreecommitdiffstats
path: root/configs
diff options
context:
space:
mode:
Diffstat (limited to 'configs')
-rw-r--r--configs/platform-v7a/patches/barebox-2016.05.0/0001-bootstate-add-framework-for-redundant-boot-scenarios.patch1467
-rw-r--r--configs/platform-v7a/patches/barebox-2016.05.0/0002-bootstate-Add-kernel-option-containing-the-system-th.patch43
-rw-r--r--configs/platform-v7a/patches/barebox-2016.05.0/0003-bootstate-separate-names-from-boot-targets.patch64
-rw-r--r--configs/platform-v7a/patches/barebox-2016.05.0/0004-bootstate-set-kernel-option-to-name-of-boot-target.patch119
-rw-r--r--configs/platform-v7a/patches/barebox-2016.05.0/0201-rpi2-add-basic-boot-spec-devicetree-support.patch462
-rw-r--r--configs/platform-v7a/patches/barebox-2016.05.0/0301-Release-2016.05.0-customers-pengutronix-multi_v7-201.patch22
-rw-r--r--configs/platform-v7a/patches/barebox-2016.05.0/series22
-rw-r--r--configs/platform-v7a/patches/barebox-2017.06.0/0001-vexpress-use-device-tree-provided-by-QEMU-if-availab.patch43
-rw-r--r--configs/platform-v7a/patches/barebox-2017.06.0/0002-vexpress-device-tree-support.patch78
-rw-r--r--configs/platform-v7a/patches/barebox-2017.06.0/0003-of-base-add-funtion-to-copy-a-device-tree-node.patch50
-rw-r--r--configs/platform-v7a/patches/barebox-2017.06.0/0004-commands-of_dump-don-t-use-flatten-unflatten-to-copy.patch34
-rw-r--r--configs/platform-v7a/patches/barebox-2017.06.0/0005-common-oftree-add-fixup-handler-for-virtio-mmio-devi.patch62
-rw-r--r--configs/platform-v7a/patches/barebox-2017.06.0/0101-beaglebone-add-state-entrie-for-mmc0-and-mmc1.patch (renamed from configs/platform-v7a/patches/barebox-2016.05.0/0101-beaglebone-add-state-entrie-for-mmc0-and-mmc1.patch)0
-rw-r--r--configs/platform-v7a/patches/barebox-2017.06.0/0201-of_device_is_stdout_path-simplify.patch45
-rw-r--r--configs/platform-v7a/patches/barebox-2017.06.0/0202-of_device_is_stdout_path-split-off-options-and-suppo.patch53
-rw-r--r--configs/platform-v7a/patches/barebox-2017.06.0/0203-ARM-imx-add-support-for-Udoo-Neo-full.patch320
-rw-r--r--configs/platform-v7a/patches/barebox-2017.06.0/0301-Release-2017.06.0-pengutronix-multi_v7-20170614-1.patch25
-rw-r--r--configs/platform-v7a/patches/barebox-2017.06.0/series25
18 files changed, 735 insertions, 2199 deletions
diff --git a/configs/platform-v7a/patches/barebox-2016.05.0/0001-bootstate-add-framework-for-redundant-boot-scenarios.patch b/configs/platform-v7a/patches/barebox-2016.05.0/0001-bootstate-add-framework-for-redundant-boot-scenarios.patch
deleted file mode 100644
index d665772..0000000
--- a/configs/platform-v7a/patches/barebox-2016.05.0/0001-bootstate-add-framework-for-redundant-boot-scenarios.patch
+++ /dev/null
@@ -1,1467 +0,0 @@
-From: Marc Kleine-Budde <mkl@pengutronix.de>
-Date: Fri, 20 Feb 2015 09:19:14 +0100
-Subject: [PATCH] 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>
----
- .../bindings/barebox/barebox,bootstate.rst | 236 +++++++
- arch/sandbox/dts/sandbox.dts | 83 +++
- commands/Kconfig | 5 +
- commands/Makefile | 1 +
- commands/bootchooser.c | 101 +++
- common/Kconfig | 8 +
- common/Makefile | 1 +
- common/bootstate.c | 781 +++++++++++++++++++++
- drivers/misc/Kconfig | 5 +
- drivers/misc/Makefile | 1 +
- drivers/misc/bootstate.c | 79 +++
- include/bootstate.h | 39 +
- 12 files changed, 1340 insertions(+)
- create mode 100644 Documentation/devicetree/bindings/barebox/barebox,bootstate.rst
- create mode 100644 commands/bootchooser.c
- create mode 100644 common/bootstate.c
- create mode 100644 drivers/misc/bootstate.c
- create mode 100644 include/bootstate.h
-
-diff --git a/Documentation/devicetree/bindings/barebox/barebox,bootstate.rst b/Documentation/devicetree/bindings/barebox/barebox,bootstate.rst
-new file mode 100644
-index 000000000000..0f7131536798
---- /dev/null
-+++ b/Documentation/devicetree/bindings/barebox/barebox,bootstate.rst
-@@ -0,0 +1,236 @@
-+barebox bootstate
-+=================
-+
-+Overview
-+--------
-+
-+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.
-+
-+The ``barebox,bootstate`` works on abstract boot targets, each with a
-+set of properties and implements an algorithm which selects the
-+highest priority target to boot.
-+
-+A set of boot targets can be described in a devicetree node. This
-+node could be part of the regular devicetree blob or it could be an
-+extra devicetree for the bootstate.
-+
-+A bootstate node contains a description of a set of boot targets along
-+with a place where to store the mutable state. Currently implemented
-+backends are :ref:`barebox,state` and ``nv`` (:ref:`command_nv`)
-+variables.
-+
-+Required properties:
-+
-+* ``compatible``: should be ``barebox,bootstate``;
-+* ``backend-type``: should be ``state`` or ``nv``.
-+
-+Optional properties:
-+
-+* ``backend``: phandle to the :ref:`barebox,state` backend
-+
-+
-+boot target nodes - immutable description
-+-----------------------------------------
-+
-+These are subnodes of a bootstate node, each describing a boot
-+target. The node name may end with ``@<ADDRESS>``, but the suffix is
-+stripped from the target name.
-+
-+Optional properties:
-+
-+* ``default_attempts``: If the boot attempts counter is reset, this
-+ value is used.
-+
-+Example::
-+
-+ bootstate: bootstate {
-+ compatible = "barebox,bootstate";
-+ backend-type = "state";
-+ backend = <&state>;
-+
-+ system0 {
-+ default_attempts = <3>;
-+ };
-+
-+ system1 {
-+ default_attempts = <3>;
-+ };
-+ };
-+
-+In this example a bootstate, using a :ref:`barebox,state` backend with
-+two boot target nodes ``system0`` and ``system1`` is defined. When the
-+boot attempts counter is reset, the default value of ``3`` is used for
-+both targets.
-+
-+
-+boot target nodes - mutable state
-+---------------------------------
-+
-+The above example uses a :ref:`barebox,state` backend, which requires
-+some additional configuration to hold the mutable
-+state. :ref:`barebox,state` has to be explicidly configured, while
-+``nv`` (:ref:`command_nv`) variables are created on the fly.
-+
-+The state of each boot target consists of the following ``uint32``
-+varibles:
-+
-+* ``remaining_attempts``: holds the number of remaining boot attempts.
-+ This variable is changed by the bootstate algorithm during boot.
-+* ``priority``: defines the priority of the boot target. Higher number
-+ indicate a higher priority, If two boot targets have the same
-+ priority the one defined first in the device tree has precedence.
-+ The ``priority`` can optionally be changed by the algorithm to 0, if
-+ the boot target is decremented to ``0`` remaining boot attempts. A
-+ ``priority`` of ``0`` means the boot target is **deactivated** and
-+ will not be considered a valid target during further boots. If the
-+ remaining attempts counter is reset, a target with priority 0 is
-+ **not** changed.
-+* ``ok``: this is an opaque value, it's not accessed by the bootstate
-+ algorithm. It can be used be the Linux system to track the first
-+ boot after an update.
-+
-+The bootstate can also hold a default watchdog timeout (in seconds),
-+which can be activated by the bootstate algorithm.
-+
-+Example::
-+
-+ state: state {
-+ magic = <0x4d433230>;
-+ compatible = "barebox,state";
-+ backend-type = "raw";
-+ backend = <&backend_state>;
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+
-+ bootstate {
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+
-+ system0 {
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+
-+ remaining_attempts {
-+ reg = <0x0 0x4>;
-+ type = "uint32";
-+ };
-+ priority {
-+ reg = <0x4 0x4>;
-+ type = "uint32";
-+ };
-+ ok {
-+ reg = <0x8 0x4>;
-+ type = "uint32";
-+ };
-+ };
-+
-+ system1 {
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+
-+ remaining_attempts {
-+ reg = <0x10 0x4>;
-+ type = "uint32";
-+ };
-+ priority {
-+ reg = <0x14 0x4>;
-+ type = "uint32";
-+ };
-+ ok {
-+ reg = <0x18 0x4>;
-+ type = "uint32";
-+ };
-+ };
-+
-+ watchdog_timeout {
-+ reg = <0x20 0x4>;
-+ type = "uint32";
-+ default = <60>;
-+ };
-+ };
-+ };
-+
-+This example defines two boot targets (``system0`` and ``system1``) and
-+a watchdog timeout of ``60`` seconds.
-+
-+
-+Backends
-+--------
-+
-+Currently two backends exist. The :ref:`barebox,state` backend is a
-+bit more complicated to setup, as all boot target have to be described
-+in the referenced :ref:`barebox,state` in the device tree. On the
-+upside, the advantages of the (possible redundant storage, etc...) of
-+the :ref:`barebox,state` is gained for free.
-+
-+The :ref:`command_nv` backend is a lot simpler, no special setup is
-+needed, it should run on every board, which already implements a
-+read/writeable barebox environment.
-+
-+
-+Algorithm
-+---------
-+
-+The low level algorithm is implemented by the
-+``bootstate_get_target()`` function. Its job is to iterate over all
-+boot sources and return the name (as a string) of the choosen boot
-+target.
-+
-+The algorithm iterates over all boot targets defined under the
-+associated device tree node and picks the one with the highest
-+``priority`` (higher number have a higher priority) where the
-+``remaining_attempts`` is greater than zero. A pointer to the name of
-+the boot target is returned, the string should be freed via ``free()``.
-+
-+The behaviour can be modified with the flags paramter. The following
-+flags are currently supported:
-+
-+* ``BOOTCHOOSER_FLAG_ATTEMPTS_KEEP``: the ``remaining_attempts``
-+ counter of the choosen boot target is not changed.
-+* ``BOOTCHOOSER_FLAG_ATTEMPTS_DEC``: the ``remaining_attempts``
-+ counter of the choosen boot target is decremented by one.
-+* ``BOOTCHOOSER_FLAG_ATTEMPTS_RESET``: the ``remaining_attempts``
-+ counter of all *active* boot targets (those with ``priority > 0``)
-+ are reset to their default values as defined in the immutable
-+ description by ``default_attempts``.
-+* ``BOOTCHOOSER_FLAG_DEACTIVATE_ON_ZERO_ATTEMPTS``: if used together
-+ with ``BOOTCHOOSER_FLAG_ATTEMPTS_DEC`` and the
-+ ``remaining_attempts`` counter of the choosen boot target is
-+ decremented to ``0``, the boot target is deactivated for further
-+ boot attempts (although *this* boot is attemped as usual). This is
-+ done by setting the ``priority`` to ``0``.
-+* ``BOOTCHOOSER_FLAG_VERBOSE``: increases the verbosity of the output
-+
-+
-+Frontend
-+--------
-+
-+The shell command ``bootchooser`` (:ref:`command_bootchooser`) can be
-+used to choose and start a boot target by a shell one-liner. The
-+command picks the boot target with the highest priority and calls the
-+``boot`` (:ref:`command_boot`) command with the selected boot target
-+as its first and only parameter.
-+
-+The ``bootchooser`` command implements command line paramter versions
-+of the above described flags:
-+
-+* ``-k``: keep boot attempts
-+* ``-d``: decrement boot attempts
-+* ``-r``: reset boot attempts
-+* ``-z``: deactivate on zero remaining attempts
-+* ``-v``: verbose output
-+
-+Next to the standard parameters, these additional options are
-+implemented:
-+
-+* ``-D``: dryrun - do not boot (all other functionality is active) - a
-+ specified watchdog timeout will be activated.
-+* ``-R``: retry - if booting fails, then chose next target, but
-+ decrement its attempts. Note: if the current target has still the
-+ highest priority and remaining attemts, it will be selected again.
-+* ``-w <TIMEOUT_IN_SEC>``: activate watchdog - if no parameter is
-+ given, the timeout from the device tree is used. A given parameter
-+ overwrites the device tree default.
-diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
-index 2595aa13fa62..e2bc8f76c2e3 100644
---- a/arch/sandbox/dts/sandbox.dts
-+++ b/arch/sandbox/dts/sandbox.dts
-@@ -3,5 +3,88 @@
- #include "skeleton.dtsi"
-
- / {
-+ aliases {
-+ state = &state;
-+ };
-
-+ state: state {
-+ magic = <0x4d433230>;
-+ compatible = "barebox,state";
-+ backend-type = "dtb";
-+ backend = "/fd0";
-+
-+ bootstate {
-+ system0 {
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+
-+ remaining_attempts {
-+ reg = <0x0 0x4>;
-+ type = "uint32";
-+ };
-+ priority {
-+ reg = <0x4 0x4>;
-+ type = "uint32";
-+ };
-+ ok {
-+ reg = <0x8 0x4>;
-+ type = "uint32";
-+ };
-+ };
-+
-+ system1 {
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+
-+ remaining_attempts {
-+ reg = <0x10 0x4>;
-+ type = "uint32";
-+ };
-+ priority {
-+ reg = <0x14 0x4>;
-+ type = "uint32";
-+ };
-+ ok {
-+ reg = <0x18 0x4>;
-+ type = "uint32";
-+ };
-+ };
-+
-+ factory {
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+
-+ remaining_attempts {
-+ reg = <0x20 0x4>;
-+ type = "uint32";
-+ };
-+ priority {
-+ reg = <0x24 0x4>;
-+ type = "uint32";
-+ };
-+ ok {
-+ reg = <0x28 0x4>;
-+ type = "uint32";
-+ };
-+ };
-+ };
-+ };
-+
-+ bootstate: bootstate {
-+ compatible = "barebox,bootstate";
-+ backend-type = "state"; // or "nv", or "efivar"
-+ backend = <&state>;
-+
-+ system0 {
-+ default_attempts = <3>;
-+ };
-+
-+ system1 {
-+ default_attempts = <3>;
-+ };
-+
-+ factory {
-+ default_attempts = <3>;
-+ };
-+ };
- };
-diff --git a/commands/Kconfig b/commands/Kconfig
-index 875c5f4f01ed..603e887b15ec 100644
---- a/commands/Kconfig
-+++ b/commands/Kconfig
-@@ -2189,6 +2189,11 @@ config CMD_SPD_DECODE
- help
- decode spd eeprom
-
-+config CMD_BOOTCHOOSER
-+ tristate
-+ depends on BOOTSTATE
-+ prompt "bootchooser"
-+
- # end Miscellaneous commands
- endmenu
-
-diff --git a/commands/Makefile b/commands/Makefile
-index f1b482f04934..bb3b40809af5 100644
---- a/commands/Makefile
-+++ b/commands/Makefile
-@@ -117,3 +117,4 @@ obj-$(CONFIG_CMD_DHRYSTONE) += dhrystone.o
- obj-$(CONFIG_CMD_SPD_DECODE) += spd_decode.o
- obj-$(CONFIG_CMD_MMC_EXTCSD) += mmc_extcsd.o
- obj-$(CONFIG_CMD_NAND_BITFLIP) += nand-bitflip.o
-+obj-$(CONFIG_CMD_BOOTCHOOSER) += bootchooser.o
-diff --git a/commands/bootchooser.c b/commands/bootchooser.c
-new file mode 100644
-index 000000000000..06ca5e41d527
---- /dev/null
-+++ b/commands/bootchooser.c
-@@ -0,0 +1,101 @@
-+/*
-+ * Copyright (C) 2012 Jan Luebbe <j.luebbe@pengutronix.de>
-+ * Copyright (C) 2015 Marc Kleine-Budde <mkl@pengutronix.de>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ */
-+
-+#include <bootstate.h>
-+#include <command.h>
-+#include <common.h>
-+#include <getopt.h>
-+#include <malloc.h>
-+#include <stdio.h>
-+
-+static int do_bootchooser(int argc, char *argv[])
-+{
-+ unsigned flags = 0, timeout = 0;
-+ char *name = NULL;
-+ int opt, ret;
-+
-+ while ((opt = getopt(argc, argv, "kdrzvDRw::")) > 0) {
-+ switch (opt) {
-+ case 'k':
-+ flags |= BOOTCHOOSER_FLAG_ATTEMPTS_KEEP;
-+ break;
-+ case 'd':
-+ flags |= BOOTCHOOSER_FLAG_ATTEMPTS_DEC;
-+ break;
-+ case 'r':
-+ flags |= BOOTCHOOSER_FLAG_ATTEMPTS_RESET;
-+ break;
-+ case 'z':
-+ flags |= BOOTCHOOSER_FLAG_DEACTIVATE_ON_ZERO_ATTEMPTS;
-+ break;
-+ case 'v':
-+ flags |= BOOTCHOOSER_FLAG_VERBOSE;
-+ break;
-+ case 'D':
-+ flags |= BOOTCHOOSER_FLAG_DRYRUN;
-+ break;
-+ case 'R':
-+ flags |= BOOTCHOOSER_FLAG_RETRY_WITH_DEC;
-+ break;
-+ case 'w':
-+ if (optarg)
-+ timeout = simple_strtoul(optarg, NULL, 0);
-+ else
-+ flags |= BOOTCHOOSER_FLAG_WATCHDOG_TIMEOUT_FROM_STATE;
-+ flags |= BOOTCHOOSER_FLAG_WATCHDOG_ENABLE;
-+ break;
-+ default:
-+ return COMMAND_ERROR_USAGE;
-+ }
-+ }
-+
-+ if (optind < argc)
-+ name = argv[optind];
-+
-+ if (!(flags & (BOOTCHOOSER_FLAG_ATTEMPTS_KEEP |
-+ BOOTCHOOSER_FLAG_ATTEMPTS_DEC |
-+ BOOTCHOOSER_FLAG_ATTEMPTS_RESET))) {
-+ bootstate_info();
-+ return 0;
-+ }
-+
-+ if ((flags & BOOTCHOOSER_FLAG_ATTEMPTS_KEEP) &&
-+ (flags & (BOOTCHOOSER_FLAG_ATTEMPTS_DEC | BOOTCHOOSER_FLAG_ATTEMPTS_RESET)))
-+ return COMMAND_ERROR_USAGE;
-+
-+ ret = bootstate_bootchooser(name, flags, timeout);
-+
-+ return ret ? COMMAND_ERROR : COMMAND_SUCCESS;
-+}
-+
-+BAREBOX_CMD_HELP_START(bootchooser)
-+BAREBOX_CMD_HELP_TEXT("Options:")
-+BAREBOX_CMD_HELP_OPT ("-k","keep - boot, don't modify attempts counter")
-+BAREBOX_CMD_HELP_OPT ("-d","decrement - boot, but decrement attempts counter by one")
-+BAREBOX_CMD_HELP_OPT ("-r","reset - boot, but reset _all_ attempts counters to default")
-+BAREBOX_CMD_HELP_OPT ("-z","deactivate chosen target on zero remaining boot attempts")
-+BAREBOX_CMD_HELP_OPT ("-v","verbose output")
-+BAREBOX_CMD_HELP_OPT ("-D","dryrun - do not boot, but handle watchdog and reset")
-+BAREBOX_CMD_HELP_OPT ("-R","retry - boot, retry next boot target and decrement attempts")
-+BAREBOX_CMD_HELP_OPT ("-w","activate watchdog, use timeout specified in <BOOTSTATE>.watchdog_timeout")
-+BAREBOX_CMD_HELP_END
-+
-+BAREBOX_CMD_START(bootchooser)
-+ .cmd = do_bootchooser,
-+ BAREBOX_CMD_DESC("automatically select a boot target and boot")
-+ BAREBOX_CMD_OPTS("[-kdrzvDR] -w <TIMEOUT> [BOOTSTATE]")
-+ BAREBOX_CMD_GROUP(CMD_GRP_MISC)
-+ BAREBOX_CMD_HELP(cmd_bootchooser_help)
-+BAREBOX_CMD_END
-diff --git a/common/Kconfig b/common/Kconfig
-index 7c09e8c117f1..f17769661ee6 100644
---- a/common/Kconfig
-+++ b/common/Kconfig
-@@ -792,6 +792,14 @@ config STATE_CRYPTO
- See Documentation/devicetree/bindings/barebox/barebox,state.rst
- for more information.
-
-+config BOOTSTATE
-+ bool "bootstate infrastructure"
-+ depends on OF_BAREBOX_DRIVERS
-+ select ENVIRONMENT_VARIABLES
-+ select OFTREE
-+ select PARAMETER
-+ select BOOTSTATE_DRV
-+
- config RESET_SOURCE
- bool "detect Reset cause"
- depends on GLOBALVAR
-diff --git a/common/Makefile b/common/Makefile
-index d99ca7b7ac74..5505449874ad 100644
---- a/common/Makefile
-+++ b/common/Makefile
-@@ -46,6 +46,7 @@ obj-$(CONFIG_SHELL_HUSH) += hush.o
- obj-$(CONFIG_SHELL_SIMPLE) += parser.o
- obj-$(CONFIG_STATE) += state.o
- obj-$(CONFIG_RATP) += ratp.o
-+obj-$(CONFIG_BOOTSTATE) += bootstate.o
- obj-$(CONFIG_UIMAGE) += image.o uimage.o
- obj-$(CONFIG_FITIMAGE) += image-fit.o
- obj-$(CONFIG_MENUTREE) += menutree.o
-diff --git a/common/bootstate.c b/common/bootstate.c
-new file mode 100644
-index 000000000000..3dc18813064d
---- /dev/null
-+++ b/common/bootstate.c
-@@ -0,0 +1,781 @@
-+/*
-+ * Copyright (C) 2012 Jan Luebbe <j.luebbe@pengutronix.de>
-+ * Copyright (C) 2015 Marc Kleine-Budde <mkl@pengutronix.de>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ */
-+
-+#include <bootstate.h>
-+#include <common.h>
-+#include <envfs.h>
-+#include <environment.h>
-+#include <errno.h>
-+#include <fcntl.h>
-+#include <fs.h>
-+#include <globalvar.h>
-+#include <init.h>
-+#include <ioctl.h>
-+#include <libbb.h>
-+#include <libfile.h>
-+#include <malloc.h>
-+#include <net.h>
-+#include <printk.h>
-+#include <state.h>
-+#include <stdio.h>
-+#include <watchdog.h>
-+#include <xfuncs.h>
-+
-+#include <linux/err.h>
-+#include <linux/kernel.h>
-+#include <linux/list.h>
-+#include <linux/mtd/mtd-abi.h>
-+#include <linux/mtd/mtd.h>
-+
-+#include <asm/unaligned.h>
-+
-+/* list of all registered bootstate instances */
-+static LIST_HEAD(bootstate_list);
-+
-+struct state_backend;
-+
-+struct bootstate {
-+ struct device_d dev;
-+ const char *name;
-+ struct list_head list;
-+ struct list_head targets;
-+ struct list_head targets_unsorted;
-+ struct bootstate_backend *backend;
-+ bool dirty;
-+};
-+
-+struct bootstate_backend {
-+ int (*load)(struct bootstate_backend *backend, struct bootstate *bootstate);
-+ int (*save)(struct bootstate_backend *backend, struct bootstate *bootstate);
-+ const char *name;
-+ const char *path;
-+};
-+
-+struct bootstate_target {
-+ struct list_head list;
-+ struct list_head list_unsorted;
-+
-+ /* state */
-+ unsigned int priority;
-+ unsigned int remaining_attempts;
-+ bool ok;
-+
-+ /* spec */
-+ const char *name;
-+ unsigned int default_attempts;
-+};
-+
-+static void pr_target(struct bootstate *bootstate, struct bootstate_target *target)
-+{
-+ printf("%s: target: name=%s prio=%u, ok=%d, rem=%u, def=%u\n",
-+ bootstate->name, target->name, target->priority, target->ok,
-+ target->remaining_attempts, target->default_attempts);
-+}
-+
-+static struct bootstate *bootstate_new(const char *name)
-+{
-+ struct bootstate *bootstate;
-+ int ret;
-+
-+ bootstate = xzalloc(sizeof(*bootstate));
-+ safe_strncpy(bootstate->dev.name, name, MAX_DRIVER_NAME);
-+ bootstate->name = bootstate->dev.name;
-+ bootstate->dev.id = DEVICE_ID_DYNAMIC;
-+ INIT_LIST_HEAD(&bootstate->targets);
-+ INIT_LIST_HEAD(&bootstate->targets_unsorted);
-+
-+ ret = register_device(&bootstate->dev);
-+ if (ret) {
-+ free(bootstate);
-+ return ERR_PTR(ret);
-+ }
-+
-+ list_add_tail(&bootstate->list, &bootstate_list);
-+
-+ return bootstate;
-+}
-+
-+void bootstate_release(struct bootstate *bootstate)
-+{
-+ list_del(&bootstate->list);
-+ unregister_device(&bootstate->dev);
-+ free(bootstate);
-+}
-+
-+static int bootstate_target_compare(struct list_head *a, struct list_head *b)
-+{
-+ struct bootstate_target *bootstate_a = list_entry(a, struct bootstate_target, list);
-+ struct bootstate_target *bootstate_b = list_entry(b, struct bootstate_target, list);
-+
-+ /* order descending */
-+ return bootstate_a->priority >= bootstate_b->priority ? -1 : 1;
-+}
-+
-+static void bootstate_target_add(struct bootstate *bootstate, struct bootstate_target *target)
-+{
-+ list_del(&target->list);
-+ list_add_sort(&target->list, &bootstate->targets, bootstate_target_compare);
-+}
-+
-+static int bootstate_variable_read_u32(const struct bootstate *bootstate,
-+ const char *name, uint32_t *out_val)
-+{
-+ char *var;
-+ int ret;
-+
-+ var = asprintf("%s.%s.%s", bootstate->backend->path, bootstate->name, name);
-+ ret = getenv_uint(var, out_val);
-+ free(var);
-+
-+ return ret;
-+}
-+
-+static int bootstate_backend_variable_read_target_u32(const struct bootstate_backend *backend,
-+ const struct bootstate *bootstate,
-+ const struct bootstate_target *target,
-+ const char *name, uint32_t *out_val)
-+{
-+ char *var;
-+ int ret;
-+
-+ var = asprintf("%s.%s.%s.%s", backend->path, bootstate->name,
-+ target->name, name);
-+ ret = getenv_uint(var, out_val);
-+ free(var);
-+
-+ return ret;
-+}
-+
-+static int bootstate_backend_variable_write_target_u32(const struct bootstate_backend *backend,
-+ const struct bootstate *bootstate,
-+ const struct bootstate_target *target,
-+ const char *name, uint32_t in_val)
-+{
-+ char *var;
-+ char *val;
-+ int ret;
-+
-+ var = asprintf("%s.%s.%s.%s", backend->path, bootstate->name,
-+ target->name, name);
-+ val = asprintf("%d", in_val);
-+ ret = setenv(var, val);
-+ free(val);
-+ free(var);
-+
-+ return ret;
-+}
-+
-+static int bootstate_variable_nv_init_u32(const struct bootstate_backend *backend,
-+ const struct bootstate *bootstate,
-+ const struct bootstate_target *target,
-+ const char *name)
-+{
-+ char *var;
-+ int ret;
-+
-+ var = asprintf("%s.%s.%s", bootstate->name, target->name, name);
-+ ret = nvvar_add(var, "0");
-+ free(var);
-+
-+ return ret;
-+}
-+
-+static struct bootstate_target *bootstate_target_find(const struct bootstate *bootstate,
-+ const char *name)
-+{
-+ struct bootstate_target *target;
-+
-+ list_for_each_entry(target, &bootstate->targets, list) {
-+ if (!strcmp(target->name, name))
-+ return target;
-+ }
-+
-+ return ERR_PTR(-ENOENT);
-+}
-+
-+static int bootstate_target_from_node(struct bootstate *bootstate, const struct device_node *node, bool create)
-+{
-+ struct bootstate_target *target;
-+ char *name, *indexs;
-+ int ret;
-+
-+ name = xstrdup(node->name);
-+ indexs = strchr(name, '@');
-+ if (indexs)
-+ *indexs++ = 0;
-+
-+ if (create) {
-+ /* create*/
-+ target = xzalloc(sizeof(*target));
-+
-+ target->name = xstrdup(name);
-+ list_add_tail(&target->list, &bootstate->targets);
-+ list_add_tail(&target->list_unsorted,
-+ &bootstate->targets_unsorted);
-+ } else {
-+ target = bootstate_target_find(bootstate, name);
-+ if (IS_ERR(target)) {
-+ int ret = PTR_ERR(target);
-+ pr_err("no such boot target: %s: %s\n",
-+ name, strerror(-ret));
-+ return ret;
-+ }
-+ }
-+
-+ /* init */
-+ ret = of_property_read_u32(node, "default_attempts",
-+ &target->default_attempts);
-+ if (ret)
-+ return ret;
-+
-+ free(name);
-+
-+ return 0;
-+}
-+
-+static int bootstate_from_node(struct bootstate *bootstate,
-+ const struct device_node *node, bool create)
-+{
-+ struct device_node *child;
-+ int ret;
-+
-+ for_each_child_of_node(node, child) {
-+ ret = bootstate_target_from_node(bootstate, child, create);
-+ if (ret)
-+ return ret;
-+ }
-+
-+ return 0;
-+}
-+
-+static int bootstate_backend_load_one(const struct bootstate_backend *backend,
-+ const struct bootstate *bootstate,
-+ struct bootstate_target *target)
-+{
-+ uint32_t tmp;
-+ int ret;
-+
-+ ret = bootstate_backend_variable_read_target_u32(backend, bootstate, target,
-+ "remaining_attempts",
-+ &target->remaining_attempts);
-+ if (ret)
-+ return ret;
-+
-+ ret = bootstate_backend_variable_read_target_u32(backend, bootstate, target,
-+ "priority", &target->priority);
-+ if (ret)
-+ return ret;
-+
-+ ret = bootstate_backend_variable_read_target_u32(backend, bootstate, target,
-+ "ok", &tmp);
-+ if (ret)
-+ return ret;
-+
-+ target->ok = !!tmp;
-+
-+ return ret;
-+}
-+
-+static int bootstate_backend_load(struct bootstate_backend *backend,
-+ struct bootstate *bootstate)
-+{
-+ struct bootstate_target *target;
-+ int ret;
-+
-+ list_for_each_entry(target, &bootstate->targets_unsorted, list_unsorted) {
-+ ret = bootstate_backend_load_one(backend, bootstate, target);
-+ if (ret)
-+ return ret;
-+ bootstate_target_add(bootstate, target);
-+ }
-+
-+ return 0;
-+}
-+
-+static int bootstate_backend_save_one(const struct bootstate_backend *backend,
-+ const struct bootstate *bootstate,
-+ struct bootstate_target *target)
-+{
-+ int ret;
-+
-+ ret = bootstate_backend_variable_write_target_u32(backend, bootstate, target,
-+ "remaining_attempts",
-+ target->remaining_attempts);
-+ if (ret)
-+ return ret;
-+
-+ ret = bootstate_backend_variable_write_target_u32(backend, bootstate, target,
-+ "priority", target->priority);
-+ if (ret)
-+ return ret;
-+
-+ ret = bootstate_backend_variable_write_target_u32(backend, bootstate, target,
-+ "ok", target->ok);
-+ if (ret)
-+ return ret;
-+
-+ return 0;
-+}
-+
-+static int bootstate_backend_save(const struct bootstate_backend *backend,
-+ const struct bootstate *bootstate)
-+{
-+ struct bootstate_target *target;
-+ int ret;
-+
-+ list_for_each_entry(target, &bootstate->targets, list) {
-+ ret = bootstate_backend_save_one(backend, bootstate, target);
-+ if (ret)
-+ return ret;
-+ }
-+
-+ return 0;
-+}
-+
-+static int bootstate_backend_nv_init_one(const struct bootstate_backend *backend,
-+ const struct bootstate *bootstate,
-+ struct bootstate_target *target)
-+{
-+ int ret;
-+
-+ ret = bootstate_variable_nv_init_u32(backend, bootstate, target,
-+ "remaining_attempts");
-+ if (ret)
-+ return ret;
-+
-+ ret = bootstate_variable_nv_init_u32(backend, bootstate, target,
-+ "priority");
-+ if (ret)
-+ return ret;
-+
-+ ret = bootstate_variable_nv_init_u32(backend, bootstate, target,
-+ "ok");
-+ if (ret)
-+ return ret;
-+
-+ return 0;
-+}
-+
-+static int bootstate_backend_nv_init(struct bootstate_backend *backend,
-+ struct bootstate *bootstate)
-+{
-+ struct bootstate_target *target;
-+ int ret;
-+
-+ list_for_each_entry(target, &bootstate->targets_unsorted, list_unsorted) {
-+ ret = bootstate_backend_nv_init_one(backend, bootstate, target);
-+ if (ret)
-+ return ret;
-+ }
-+
-+ return 0;
-+}
-+
-+static int bootstate_backend_nv_save(struct bootstate_backend *backend,
-+ struct bootstate *bootstate)
-+{
-+ int ret;
-+
-+ ret = bootstate_backend_save(backend, bootstate);
-+ if (ret)
-+ return ret;
-+
-+ return envfs_save(NULL, NULL, 0);
-+}
-+
-+static int bootstate_backend_nv_load(struct bootstate_backend *backend,
-+ struct bootstate *bootstate)
-+{
-+ return bootstate_backend_load(backend, bootstate);
-+}
-+
-+struct bootstate_backend_nv {
-+ struct bootstate_backend backend;
-+};
-+
-+int bootstate_backend_nv(struct bootstate *bootstate)
-+{
-+ struct bootstate_backend_nv *backend_nv;
-+ struct bootstate_backend *backend;
-+
-+ if (bootstate->backend)
-+ return -EBUSY;
-+
-+ backend_nv = xzalloc(sizeof(*backend_nv));
-+ backend = &backend_nv->backend;
-+
-+ backend->load = bootstate_backend_nv_load;
-+ backend->save = bootstate_backend_nv_save;
-+ backend->name = "nv";
-+ backend->path = "nv";
-+
-+ bootstate->backend = backend;
-+
-+ return bootstate_backend_nv_init(backend, bootstate);
-+}
-+
-+struct bootstate_backend_state {
-+ struct bootstate_backend backend;
-+ struct state *state;
-+};
-+
-+static int bootstate_backend_state_save(struct bootstate_backend *backend,
-+ struct bootstate *bootstate)
-+{
-+ struct bootstate_backend_state *backend_state =
-+ container_of(backend, struct bootstate_backend_state, backend);
-+ int ret;
-+
-+ ret = bootstate_backend_save(backend, bootstate);
-+ if (ret)
-+ return ret;
-+
-+ return state_save(backend_state->state);
-+}
-+
-+static int bootstate_backend_state_load(struct bootstate_backend *backend,
-+ struct bootstate *bootstate)
-+{
-+ return bootstate_backend_load(backend, bootstate);
-+}
-+
-+int bootstate_backend_state(struct bootstate *bootstate, const struct device_node *node)
-+{
-+ struct bootstate_backend_state *backend_state;
-+ struct bootstate_backend *backend;
-+ const struct device_node *state_node;
-+ struct state *state;
-+
-+ if (bootstate->backend)
-+ return -EBUSY;
-+
-+ state_node = of_parse_phandle(node, "backend", 0);
-+ if (!state_node)
-+ return -EINVAL;
-+
-+ state = state_by_node(state_node);
-+ if (!state)
-+ return -EPROBE_DEFER;
-+
-+ backend_state = xzalloc(sizeof(*backend_state));
-+ backend_state->state = state;
-+
-+ backend = &backend_state->backend;
-+ backend->load = bootstate_backend_state_load;
-+ backend->save = bootstate_backend_state_save;
-+ backend->name = "state";
-+
-+ bootstate->backend = backend;
-+
-+ return state_get_name(backend_state->state, &backend->path);
-+}
-+
-+/*
-+ * bootstate_new_from_node - create a new bootstate instance from a device_node
-+ *
-+ * @name The name of the new bootstate instance
-+ * @node The device_node describing the new bootstate instance
-+ */
-+struct bootstate *bootstate_new_from_node(const char *name, const struct device_node *node)
-+{
-+ struct bootstate *bootstate;
-+ int ret;
-+
-+ pr_debug("%s: node=%s, name=%s\n", __func__, node->full_name, name);
-+
-+ bootstate = bootstate_new(name);
-+ if (!bootstate)
-+ return ERR_PTR(-EINVAL);
-+
-+ ret = bootstate_from_node(bootstate, node, true);
-+ if (ret) {
-+ bootstate_release(bootstate);
-+ return ERR_PTR(ret);
-+ }
-+
-+ return bootstate;
-+}
-+
-+/*
-+ * bootstate_by_name - find a bootstate instance by name
-+ *
-+ * @name The name of the state instance
-+ */
-+struct bootstate *bootstate_by_name(const char *name)
-+{
-+ struct bootstate *bs;
-+
-+ list_for_each_entry(bs, &bootstate_list, list) {
-+ if (!strcmp(name, bs->name))
-+ return bs;
-+ }
-+
-+ return NULL;
-+}
-+
-+/*
-+ * bootstate_load - load a bootstate from the backing store
-+ *
-+ * @bootstate The state instance to load
-+ */
-+static int bootstate_load(struct bootstate *bootstate)
-+{
-+ int ret;
-+
-+ if (!bootstate->backend)
-+ return -ENOSYS;
-+
-+ ret = bootstate->backend->load(bootstate->backend, bootstate);
-+ if (ret)
-+ bootstate->dirty = 1;
-+ else
-+ bootstate->dirty = 0;
-+
-+ return ret;
-+}
-+
-+/*
-+ * bootstate_save - save a bootstate to the backing store
-+ *
-+ * @bootstate The bootstate instance to save
-+ */
-+static int bootstate_save(struct bootstate *bootstate)
-+{
-+ int ret;
-+
-+ if (!bootstate->dirty)
-+ return 0;
-+
-+ if (!bootstate->backend)
-+ return -ENOSYS;
-+
-+ ret = bootstate->backend->save(bootstate->backend, bootstate);
-+ if (ret)
-+ return ret;
-+
-+ bootstate->dirty = 0;
-+
-+ return 0;
-+}
-+
-+void bootstate_info(void)
-+{
-+ struct bootstate *bootstate;
-+
-+ printf("registered bootstate instances:\n");
-+
-+ list_for_each_entry(bootstate, &bootstate_list, list) {
-+ printf("%-20s ", bootstate->name);
-+ printf("(backend: %s, path: %s)\n",
-+ bootstate->backend->name, bootstate->backend->path);
-+ }
-+}
-+
-+#define __BF(arg) [__BOOTCHOOSER_FLAG_##arg##_SHIFT] = __stringify(arg)
-+
-+static const char * const bootstate_flags_str[] = {
-+ __BF(ATTEMPTS_KEEP),
-+ __BF(ATTEMPTS_DEC),
-+ __BF(ATTEMPTS_RESET),
-+ __BF(DEACTIVATE_ON_ZERO_ATTEMPTS),
-+ __BF(VERBOSE),
-+ __BF(DRYRUN),
-+ __BF(RETRY_WITH_DEC),
-+ __BF(WATCHDOG_ENABLE),
-+ __BF(WATCHDOG_TIMEOUT_FROM_STATE),
-+};
-+
-+#undef __BF
-+
-+#define pr(verbose, format, args...) \
-+ ({ \
-+ (verbose) ? pr_info((format), ##args) : 0; \
-+ })
-+
-+void _pr_flags(struct bootstate *bootstate, unsigned flags)
-+{
-+ int i;
-+
-+ pr_info("%s: flags=0x%08x\n", bootstate->name, flags);
-+
-+ for (i = 0; i < ARRAY_SIZE(bootstate_flags_str); i++) {
-+ if (flags & (1 << i))
-+ pr_info("%s: -> %s\n", bootstate->name,
-+ bootstate_flags_str[i]);
-+ }
-+}
-+
-+#define pr_flags(verbose, bootstate, flags) \
-+ ({ \
-+ (verbose) ? _pr_flags(bootstate, flags) : 0; \
-+ })
-+
-+/*
-+ * bootstate_get_target - create a new state instance from a device_node
-+ *
-+ * @bootstate the bootstate instance to work in
-+ * @flags supported flags:
-+ * BOOTCHOOSER_FLAG_VERBOSE
-+ * BOOTCHOOSER_FLAG_ATTEMPTS_KEEP
-+ * BOOTCHOOSER_FLAG_ATTEMPTS_DEC
-+ * BOOTCHOOSER_FLAG_ATTEMPTS_RESET
-+ * BOOTCHOOSER_FLAG_DEACTIVATE_ON_ZERO_ATTEMPTS
-+ * @target_out a string to the choosen boot target is returned via
-+ * this paramater
-+ */
-+int bootstate_get_target(struct bootstate *bootstate, unsigned flags, char **target_out)
-+{
-+ struct bootstate_target *target;
-+ int ret;
-+ bool found = false;
-+ bool v = flags & BOOTCHOOSER_FLAG_VERBOSE;
-+
-+ pr_flags(v, bootstate, flags);
-+
-+ ret = bootstate_load(bootstate);
-+ if (ret)
-+ return ret;
-+
-+ if (flags & BOOTCHOOSER_FLAG_ATTEMPTS_RESET) {
-+ list_for_each_entry(target, &bootstate->targets, list) {
-+ if (target->priority == 0)
-+ continue;
-+
-+ target->remaining_attempts = target->default_attempts;
-+ bootstate->dirty = true;
-+
-+ pr(v, "%s: target: name=%s setting rem to %d due to %s\n",
-+ bootstate->name, target->name, target->default_attempts,
-+ bootstate_flags_str[__BOOTCHOOSER_FLAG_ATTEMPTS_RESET_SHIFT]);
-+ }
-+ pr(v, "%s: --------\n", bootstate->name);
-+ }
-+
-+ list_for_each_entry(target, &bootstate->targets, list) {
-+ pr_target(bootstate, target);
-+
-+ if (found)
-+ continue;
-+
-+ if (target->priority == 0) {
-+ pr(v, "%s: name=%s prio=%d - trying next\n",
-+ bootstate->name, target->name, target->priority);
-+ continue;
-+ }
-+
-+ if (target->remaining_attempts == 0) {
-+ pr(v, "%s: name=%s remaining attempts == 0 - trying next\n",
-+ bootstate->name, target->name);
-+ continue;
-+ }
-+
-+ if (flags & BOOTCHOOSER_FLAG_ATTEMPTS_DEC) {
-+ bootstate->dirty = true;
-+ target->remaining_attempts--;
-+
-+ pr(v, "%s: name=%s decrementing remaining_attempts to %d due to %s\n",
-+ bootstate->name, target->name,
-+ target->remaining_attempts,
-+ bootstate_flags_str[__BOOTCHOOSER_FLAG_ATTEMPTS_DEC_SHIFT]);
-+
-+ if ((target->remaining_attempts == 0) &&
-+ (flags & BOOTCHOOSER_FLAG_DEACTIVATE_ON_ZERO_ATTEMPTS)) {
-+ target->priority = 0;
-+
-+ pr(v, "%s: name=%s deactivating target (setting priority = 0) due to %s\n",
-+ bootstate->name, target->name,
-+ bootstate_flags_str[__BOOTCHOOSER_FLAG_DEACTIVATE_ON_ZERO_ATTEMPTS_SHIFT]);
-+ }
-+ }
-+
-+ found = true;
-+ *target_out = strdup(target->name);
-+ pr_debug("%s: selected target '%s'\n", __func__, target->name);
-+ if (!v)
-+ goto out;
-+
-+ pr(v, "%s: --- other bootsources ---\n", bootstate->name);
-+ }
-+
-+ out:
-+ bootstate_save(bootstate);
-+
-+ if (!found)
-+ return -ENOENT;
-+
-+ return 0;
-+}
-+
-+int bootstate_bootchooser(char *name, unsigned flags, unsigned timeout)
-+{
-+ struct bootstate *bootstate;
-+ bool v = flags & BOOTCHOOSER_FLAG_VERBOSE;
-+ char *target;
-+ int ret;
-+
-+ if (!name)
-+ name = "bootstate";
-+
-+ bootstate = bootstate_by_name(name);
-+ if (!bootstate) {
-+ pr_err("Bootstate '%s' not found.\n", name);
-+ return -ENODEV;
-+ }
-+
-+ if (flags & BOOTCHOOSER_FLAG_WATCHDOG_ENABLE) {
-+ if (flags & BOOTCHOOSER_FLAG_WATCHDOG_TIMEOUT_FROM_STATE) {
-+ ret = bootstate_variable_read_u32(bootstate, "watchdog_timeout",
-+ &timeout);
-+ if (ret)
-+ return ret;
-+ }
-+
-+ if (timeout != 0) {
-+ pr(v, "%s: starting watchdog with timeout=%ds\n",
-+ __func__, timeout);
-+
-+ ret = watchdog_set_timeout(timeout);
-+ if (ret)
-+ return ret;
-+ }
-+ }
-+
-+ while (true) {
-+ char *cmd;
-+
-+ ret = bootstate_get_target(bootstate, flags, &target);
-+ if (ret)
-+ return ret;
-+
-+ cmd = asprintf("boot %s", target);
-+ free(target);
-+ pr_info("%srunning: %s...\n",
-+ flags & BOOTCHOOSER_FLAG_DRYRUN ? "not " : "", cmd);
-+ if (!(flags & BOOTCHOOSER_FLAG_DRYRUN))
-+ ret = run_command(cmd);
-+ free(cmd);
-+
-+ if (flags & BOOTCHOOSER_FLAG_RETRY_WITH_DEC) {
-+ flags |= BOOTCHOOSER_FLAG_ATTEMPTS_DEC;
-+ flags &= ~(BOOTCHOOSER_FLAG_ATTEMPTS_RESET |
-+ BOOTCHOOSER_FLAG_ATTEMPTS_KEEP);
-+ continue;
-+ }
-+
-+ return ret;
-+ }
-+
-+ return -ENOENT;
-+}
-diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
-index 7a5b14697efd..2459051e1db1 100644
---- a/drivers/misc/Kconfig
-+++ b/drivers/misc/Kconfig
-@@ -19,4 +19,9 @@ config STATE_DRV
- tristate "state driver"
- depends on STATE
-
-+config BOOTSTATE_DRV
-+ tristate "bootstate driver"
-+ depends on BOOTSTATE
-+ depends on STATE
-+
- endmenu
-diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
-index 487e4b8ba2e5..603e14ebb5de 100644
---- a/drivers/misc/Makefile
-+++ b/drivers/misc/Makefile
-@@ -5,3 +5,4 @@
- obj-$(CONFIG_JTAG) += jtag.o
- obj-$(CONFIG_SRAM) += sram.o
- obj-$(CONFIG_STATE_DRV) += state.o
-+obj-$(CONFIG_BOOTSTATE_DRV) += bootstate.o
-diff --git a/drivers/misc/bootstate.c b/drivers/misc/bootstate.c
-new file mode 100644
-index 000000000000..3ec9b8fda86b
---- /dev/null
-+++ b/drivers/misc/bootstate.c
-@@ -0,0 +1,79 @@
-+/*
-+ * Copyright (C) 2013 Sascha Hauer <s.hauer@pengutronix.de>
-+ * Copyright (C) 2015 Marc Kleine-Budde <mkl@pengutronix.de>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ */
-+
-+#include <bootstate.h>
-+#include <driver.h>
-+#include <init.h>
-+#include <malloc.h>
-+#include <of.h>
-+#include <printk.h>
-+#include <string.h>
-+
-+#include <linux/err.h>
-+
-+static int bootstate_probe(struct device_d *dev)
-+{
-+ struct device_node *np = dev->device_node;
-+ struct bootstate *bootstate;
-+ const char *alias;
-+ const char *backend_type = NULL;
-+ int ret;
-+
-+ if (!np)
-+ return -EINVAL;
-+
-+ alias = of_alias_get(np);
-+ if (!alias)
-+ alias = "bootstate";
-+
-+ bootstate = bootstate_new_from_node(alias, np);
-+ if (IS_ERR(bootstate))
-+ return PTR_ERR(bootstate);
-+
-+ of_property_read_string(np, "backend-type", &backend_type);
-+ if (!strcmp(backend_type, "state")) {
-+ ret = bootstate_backend_state(bootstate, np);
-+ } else if (!strcmp(backend_type, "nv")) {
-+ ret = bootstate_backend_nv(bootstate);
-+ } else {
-+ dev_warn(dev, "invalid backend type: %s\n", backend_type);
-+ ret = -ENODEV;
-+ goto out_release;
-+ }
-+
-+ if (ret)
-+ goto out_release;
-+
-+ return 0;
-+
-+ out_release:
-+ bootstate_release(bootstate);
-+ return ret;
-+}
-+
-+static __maybe_unused struct of_device_id bootstate_ids[] = {
-+ {
-+ .compatible = "barebox,bootstate",
-+ }, {
-+ /* sentinel */
-+ }
-+};
-+
-+static struct driver_d bootstate_driver = {
-+ .name = "bootstate",
-+ .probe = bootstate_probe,
-+ .of_compatible = DRV_OF_COMPAT(bootstate_ids),
-+};
-+device_platform_driver(bootstate_driver);
-diff --git a/include/bootstate.h b/include/bootstate.h
-new file mode 100644
-index 000000000000..22631c902f60
---- /dev/null
-+++ b/include/bootstate.h
-@@ -0,0 +1,39 @@
-+#ifndef __BOOTSTATE_H
-+#define __BOOTSTATE_H
-+
-+#include <of.h>
-+
-+struct bootstate *bootstate_new_from_node(const char *name, const struct device_node *node);
-+struct bootstate *bootstate_find_by_name(const char *name);
-+struct bootstate *bootstate_by_name(const char *name);
-+void bootstate_release(struct bootstate *bootstate);
-+void bootstate_info(void);
-+int bootstate_backend_nv(struct bootstate *bootstate);
-+int bootstate_backend_state(struct bootstate *bootstate, const struct device_node *node);
-+
-+enum {
-+ __BOOTCHOOSER_FLAG_ATTEMPTS_KEEP_SHIFT,
-+ __BOOTCHOOSER_FLAG_ATTEMPTS_DEC_SHIFT,
-+ __BOOTCHOOSER_FLAG_ATTEMPTS_RESET_SHIFT,
-+ __BOOTCHOOSER_FLAG_DEACTIVATE_ON_ZERO_ATTEMPTS_SHIFT,
-+ __BOOTCHOOSER_FLAG_VERBOSE_SHIFT,
-+ __BOOTCHOOSER_FLAG_DRYRUN_SHIFT,
-+ __BOOTCHOOSER_FLAG_RETRY_WITH_DEC_SHIFT,
-+ __BOOTCHOOSER_FLAG_WATCHDOG_ENABLE_SHIFT,
-+ __BOOTCHOOSER_FLAG_WATCHDOG_TIMEOUT_FROM_STATE_SHIFT,
-+};
-+
-+#define BOOTCHOOSER_FLAG_ATTEMPTS_KEEP (1 << __BOOTCHOOSER_FLAG_ATTEMPTS_KEEP_SHIFT)
-+#define BOOTCHOOSER_FLAG_ATTEMPTS_DEC (1 << __BOOTCHOOSER_FLAG_ATTEMPTS_DEC_SHIFT)
-+#define BOOTCHOOSER_FLAG_ATTEMPTS_RESET (1 << __BOOTCHOOSER_FLAG_ATTEMPTS_RESET_SHIFT)
-+#define BOOTCHOOSER_FLAG_DEACTIVATE_ON_ZERO_ATTEMPTS (1 << __BOOTCHOOSER_FLAG_DEACTIVATE_ON_ZERO_ATTEMPTS_SHIFT)
-+#define BOOTCHOOSER_FLAG_VERBOSE (1 << __BOOTCHOOSER_FLAG_VERBOSE_SHIFT)
-+#define BOOTCHOOSER_FLAG_DRYRUN (1 << __BOOTCHOOSER_FLAG_DRYRUN_SHIFT)
-+#define BOOTCHOOSER_FLAG_RETRY_WITH_DEC (1 << __BOOTCHOOSER_FLAG_RETRY_WITH_DEC_SHIFT)
-+#define BOOTCHOOSER_FLAG_WATCHDOG_ENABLE (1 << __BOOTCHOOSER_FLAG_WATCHDOG_ENABLE_SHIFT)
-+#define BOOTCHOOSER_FLAG_WATCHDOG_TIMEOUT_FROM_STATE (1 << __BOOTCHOOSER_FLAG_WATCHDOG_TIMEOUT_FROM_STATE_SHIFT)
-+
-+int bootstate_get_target(struct bootstate *bootstate, unsigned flags, char **target_out);
-+int bootstate_bootchooser(char *name, unsigned flags, unsigned watchdog_timeout_s);
-+
-+#endif /* __BOOTSTATE_H */
diff --git a/configs/platform-v7a/patches/barebox-2016.05.0/0002-bootstate-Add-kernel-option-containing-the-system-th.patch b/configs/platform-v7a/patches/barebox-2016.05.0/0002-bootstate-Add-kernel-option-containing-the-system-th.patch
deleted file mode 100644
index 97d8336..0000000
--- a/configs/platform-v7a/patches/barebox-2016.05.0/0002-bootstate-Add-kernel-option-containing-the-system-th.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From: Sascha Hauer <s.hauer@pengutronix.de>
-Date: Mon, 20 Jul 2015 20:44:00 +0200
-Subject: [PATCH] bootstate: Add kernel option containing the system that is
- started
-
-This is useful to allow the userspace to determine which system
-is actually started without dissecting the root= option.
-
-Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
----
- common/bootstate.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/common/bootstate.c b/common/bootstate.c
-index 3dc18813064d..b0cb0183068a 100644
---- a/common/bootstate.c
-+++ b/common/bootstate.c
-@@ -753,12 +753,16 @@ int bootstate_bootchooser(char *name, unsigned flags, unsigned timeout)
- }
-
- while (true) {
-- char *cmd;
-+ char *cmd, *system;
-
- ret = bootstate_get_target(bootstate, flags, &target);
- if (ret)
- return ret;
-
-+ system = asprintf("bootstate.active=%s", target);
-+ globalvar_add_simple("linux.bootargs.bootchooser", system);
-+ free(system);
-+
- cmd = asprintf("boot %s", target);
- free(target);
- pr_info("%srunning: %s...\n",
-@@ -766,6 +770,7 @@ int bootstate_bootchooser(char *name, unsigned flags, unsigned timeout)
- if (!(flags & BOOTCHOOSER_FLAG_DRYRUN))
- ret = run_command(cmd);
- free(cmd);
-+ globalvar_set_match("linux.bootargs.bootchooser", NULL);
-
- if (flags & BOOTCHOOSER_FLAG_RETRY_WITH_DEC) {
- flags |= BOOTCHOOSER_FLAG_ATTEMPTS_DEC;
diff --git a/configs/platform-v7a/patches/barebox-2016.05.0/0003-bootstate-separate-names-from-boot-targets.patch b/configs/platform-v7a/patches/barebox-2016.05.0/0003-bootstate-separate-names-from-boot-targets.patch
deleted file mode 100644
index 50ea064..0000000
--- a/configs/platform-v7a/patches/barebox-2016.05.0/0003-bootstate-separate-names-from-boot-targets.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From: Sascha Hauer <s.hauer@pengutronix.de>
-Date: Thu, 23 Jul 2015 16:42:18 +0200
-Subject: [PATCH] bootstate: separate names from boot targets
-
-The name of a boot target and the device or script to boot may be two
-different things. Allow a 'boot' property in the boot targets.
-
-Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
----
- common/bootstate.c | 16 +++++++++++++---
- 1 file changed, 13 insertions(+), 3 deletions(-)
-
-diff --git a/common/bootstate.c b/common/bootstate.c
-index b0cb0183068a..fde278262fa3 100644
---- a/common/bootstate.c
-+++ b/common/bootstate.c
-@@ -75,6 +75,7 @@ struct bootstate_target {
- /* spec */
- const char *name;
- unsigned int default_attempts;
-+ const char *boot;
- };
-
- static void pr_target(struct bootstate *bootstate, struct bootstate_target *target)
-@@ -205,7 +206,7 @@ static struct bootstate_target *bootstate_target_find(const struct bootstate *bo
- return ERR_PTR(-ENOENT);
- }
-
--static int bootstate_target_from_node(struct bootstate *bootstate, const struct device_node *node, bool create)
-+static int bootstate_target_from_node(struct bootstate *bootstate, struct device_node *node, bool create)
- {
- struct bootstate_target *target;
- char *name, *indexs;
-@@ -217,10 +218,18 @@ static int bootstate_target_from_node(struct bootstate *bootstate, const struct
- *indexs++ = 0;
-
- if (create) {
-+ const char *boot;
-+
- /* create*/
- target = xzalloc(sizeof(*target));
-
- target->name = xstrdup(name);
-+
-+ if (!of_property_read_string(node, "boot", &boot))
-+ target->boot = xstrdup(boot);
-+ else
-+ target->boot = xstrdup(name);
-+
- list_add_tail(&target->list, &bootstate->targets);
- list_add_tail(&target->list_unsorted,
- &bootstate->targets_unsorted);
-@@ -701,8 +710,9 @@ int bootstate_get_target(struct bootstate *bootstate, unsigned flags, char **tar
- }
-
- found = true;
-- *target_out = strdup(target->name);
-- pr_debug("%s: selected target '%s'\n", __func__, target->name);
-+ *target_out = strdup(target->boot);
-+ pr_debug("%s: selected target '%s', boot '%s'\n",
-+ __func__, target->name, target->boot);
- if (!v)
- goto out;
-
diff --git a/configs/platform-v7a/patches/barebox-2016.05.0/0004-bootstate-set-kernel-option-to-name-of-boot-target.patch b/configs/platform-v7a/patches/barebox-2016.05.0/0004-bootstate-set-kernel-option-to-name-of-boot-target.patch
deleted file mode 100644
index 4bce5b4..0000000
--- a/configs/platform-v7a/patches/barebox-2016.05.0/0004-bootstate-set-kernel-option-to-name-of-boot-target.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-From: Sascha Hauer <s.hauer@pengutronix.de>
-Date: Mon, 27 Jul 2015 13:39:45 +0200
-Subject: [PATCH] bootstate: set kernel option to name of boot target
-
-Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
----
- common/bootstate.c | 60 ++++++++++++++++++++++++++++++++----------------------
- 1 file changed, 36 insertions(+), 24 deletions(-)
-
-diff --git a/common/bootstate.c b/common/bootstate.c
-index fde278262fa3..2dcc47cfa257 100644
---- a/common/bootstate.c
-+++ b/common/bootstate.c
-@@ -631,20 +631,8 @@ void _pr_flags(struct bootstate *bootstate, unsigned flags)
- (verbose) ? _pr_flags(bootstate, flags) : 0; \
- })
-
--/*
-- * bootstate_get_target - create a new state instance from a device_node
-- *
-- * @bootstate the bootstate instance to work in
-- * @flags supported flags:
-- * BOOTCHOOSER_FLAG_VERBOSE
-- * BOOTCHOOSER_FLAG_ATTEMPTS_KEEP
-- * BOOTCHOOSER_FLAG_ATTEMPTS_DEC
-- * BOOTCHOOSER_FLAG_ATTEMPTS_RESET
-- * BOOTCHOOSER_FLAG_DEACTIVATE_ON_ZERO_ATTEMPTS
-- * @target_out a string to the choosen boot target is returned via
-- * this paramater
-- */
--int bootstate_get_target(struct bootstate *bootstate, unsigned flags, char **target_out)
-+static struct bootstate_target *bootstate_target_get(struct bootstate *bootstate,
-+ unsigned flags)
- {
- struct bootstate_target *target;
- int ret;
-@@ -655,7 +643,7 @@ int bootstate_get_target(struct bootstate *bootstate, unsigned flags, char **tar
-
- ret = bootstate_load(bootstate);
- if (ret)
-- return ret;
-+ return ERR_PTR(ret);
-
- if (flags & BOOTCHOOSER_FLAG_ATTEMPTS_RESET) {
- list_for_each_entry(target, &bootstate->targets, list) {
-@@ -710,7 +698,6 @@ int bootstate_get_target(struct bootstate *bootstate, unsigned flags, char **tar
- }
-
- found = true;
-- *target_out = strdup(target->boot);
- pr_debug("%s: selected target '%s', boot '%s'\n",
- __func__, target->name, target->boot);
- if (!v)
-@@ -723,7 +710,33 @@ int bootstate_get_target(struct bootstate *bootstate, unsigned flags, char **tar
- bootstate_save(bootstate);
-
- if (!found)
-- return -ENOENT;
-+ return ERR_PTR(-ENOENT);
-+
-+ return target;
-+}
-+
-+/*
-+ * bootstate_get_target - create a new state instance from a device_node
-+ *
-+ * @bootstate the bootstate instance to work in
-+ * @flags supported flags:
-+ * BOOTCHOOSER_FLAG_VERBOSE
-+ * BOOTCHOOSER_FLAG_ATTEMPTS_KEEP
-+ * BOOTCHOOSER_FLAG_ATTEMPTS_DEC
-+ * BOOTCHOOSER_FLAG_ATTEMPTS_RESET
-+ * BOOTCHOOSER_FLAG_DEACTIVATE_ON_ZERO_ATTEMPTS
-+ * @target_out a string to the choosen boot target is returned via
-+ * this paramater
-+ */
-+int bootstate_get_target(struct bootstate *bootstate, unsigned flags, char **target_out)
-+{
-+ struct bootstate_target *target;
-+
-+ target = bootstate_target_get(bootstate, flags);
-+ if (IS_ERR(target))
-+ return PTR_ERR(target);
-+
-+ *target_out = strdup(target->boot);
-
- return 0;
- }
-@@ -732,7 +745,7 @@ int bootstate_bootchooser(char *name, unsigned flags, unsigned timeout)
- {
- struct bootstate *bootstate;
- bool v = flags & BOOTCHOOSER_FLAG_VERBOSE;
-- char *target;
-+ struct bootstate_target *target;
- int ret;
-
- if (!name)
-@@ -765,16 +778,15 @@ int bootstate_bootchooser(char *name, unsigned flags, unsigned timeout)
- while (true) {
- char *cmd, *system;
-
-- ret = bootstate_get_target(bootstate, flags, &target);
-- if (ret)
-- return ret;
-+ target = bootstate_target_get(bootstate, flags);
-+ if (IS_ERR(target))
-+ return PTR_ERR(target);
-
-- system = asprintf("bootstate.active=%s", target);
-+ system = asprintf("bootstate.active=%s", target->name);
- globalvar_add_simple("linux.bootargs.bootchooser", system);
- free(system);
-
-- cmd = asprintf("boot %s", target);
-- free(target);
-+ cmd = asprintf("boot %s", target->boot);
- pr_info("%srunning: %s...\n",
- flags & BOOTCHOOSER_FLAG_DRYRUN ? "not " : "", cmd);
- if (!(flags & BOOTCHOOSER_FLAG_DRYRUN))
diff --git a/configs/platform-v7a/patches/barebox-2016.05.0/0201-rpi2-add-basic-boot-spec-devicetree-support.patch b/configs/platform-v7a/patches/barebox-2016.05.0/0201-rpi2-add-basic-boot-spec-devicetree-support.patch
deleted file mode 100644
index 80a3e7e..0000000
--- a/configs/platform-v7a/patches/barebox-2016.05.0/0201-rpi2-add-basic-boot-spec-devicetree-support.patch
+++ /dev/null
@@ -1,462 +0,0 @@
-From: Alexander Aring <aar@pengutronix.de>
-Date: Thu, 9 Jun 2016 11:26:03 +0200
-Subject: [PATCH] rpi2: add basic boot-spec devicetree support
-
-Signed-off-by: Alexander Aring <aar@pengutronix.de>
----
- arch/arm/dts/Makefile | 1 +
- arch/arm/dts/bcm2835-rpi.dtsi | 60 +++++++++++
- arch/arm/dts/bcm2836-rpi-2-b.dts | 35 +++++++
- arch/arm/dts/bcm2836.dtsi | 78 ++++++++++++++
- arch/arm/dts/bcm283x.dtsi | 212 +++++++++++++++++++++++++++++++++++++++
- arch/arm/mach-bcm283x/core.c | 4 +-
- 6 files changed, 389 insertions(+), 1 deletion(-)
- create mode 100644 arch/arm/dts/bcm2835-rpi.dtsi
- create mode 100644 arch/arm/dts/bcm2836-rpi-2-b.dts
- create mode 100644 arch/arm/dts/bcm2836.dtsi
- create mode 100644 arch/arm/dts/bcm283x.dtsi
-
-diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
-index b83c1109ef39..960d8aac3933 100644
---- a/arch/arm/dts/Makefile
-+++ b/arch/arm/dts/Makefile
-@@ -9,6 +9,7 @@ obj- += dummy.o
-
- pbl-dtb-$(CONFIG_MACH_AFI_GF) += am335x-afi-gf.dtb.o
- pbl-dtb-$(CONFIG_MACH_BEAGLEBONE) += am335x-bone.dtb.o am335x-boneblack.dtb.o am335x-bone-common.dtb.o
-+pbl-dtb-$(CONFIG_MACH_RPI2) += bcm2836-rpi-2-b.dtb.o
- pbl-dtb-$(CONFIG_MACH_CM_FX6) += imx6dl-cm-fx6.dtb.o imx6q-cm-fx6.dtb.o imx6q-utilite.dtb.o
- pbl-dtb-$(CONFIG_MACH_DFI_FS700_M60) += imx6q-dfi-fs700-m60-6q.dtb.o imx6dl-dfi-fs700-m60-6s.dtb.o
- pbl-dtb-$(CONFIG_MACH_DUCKBILL) += imx28-duckbill.dtb.o
-diff --git a/arch/arm/dts/bcm2835-rpi.dtsi b/arch/arm/dts/bcm2835-rpi.dtsi
-new file mode 100644
-index 000000000000..3afb9fefe2d1
---- /dev/null
-+++ b/arch/arm/dts/bcm2835-rpi.dtsi
-@@ -0,0 +1,60 @@
-+/ {
-+ memory {
-+ reg = <0 0x10000000>;
-+ };
-+
-+ leds {
-+ compatible = "gpio-leds";
-+
-+ act {
-+ label = "ACT";
-+ default-state = "keep";
-+ linux,default-trigger = "heartbeat";
-+ };
-+ };
-+
-+ soc {
-+ firmware: firmware {
-+ compatible = "raspberrypi,bcm2835-firmware";
-+ mboxes = <&mailbox>;
-+ };
-+ };
-+};
-+
-+&gpio {
-+ pinctrl-names = "default";
-+
-+ gpioout: gpioout {
-+ brcm,pins = <6>;
-+ brcm,function = <BCM2835_FSEL_GPIO_OUT>;
-+ };
-+
-+ alt0: alt0 {
-+ brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 14 15 40 45>;
-+ brcm,function = <BCM2835_FSEL_ALT0>;
-+ };
-+
-+ alt3: alt3 {
-+ brcm,pins = <48 49 50 51 52 53>;
-+ brcm,function = <BCM2835_FSEL_ALT3>;
-+ };
-+};
-+
-+&i2c0 {
-+ status = "okay";
-+ clock-frequency = <100000>;
-+};
-+
-+&i2c1 {
-+ status = "okay";
-+ clock-frequency = <100000>;
-+};
-+
-+&i2c2 {
-+ status = "okay";
-+};
-+
-+&sdhci {
-+ status = "okay";
-+ bus-width = <4>;
-+};
-diff --git a/arch/arm/dts/bcm2836-rpi-2-b.dts b/arch/arm/dts/bcm2836-rpi-2-b.dts
-new file mode 100644
-index 000000000000..ff946661bd13
---- /dev/null
-+++ b/arch/arm/dts/bcm2836-rpi-2-b.dts
-@@ -0,0 +1,35 @@
-+/dts-v1/;
-+#include "bcm2836.dtsi"
-+#include "bcm2835-rpi.dtsi"
-+
-+/ {
-+ compatible = "raspberrypi,2-model-b", "brcm,bcm2836";
-+ model = "Raspberry Pi 2 Model B";
-+
-+ memory {
-+ reg = <0 0x40000000>;
-+ };
-+
-+ leds {
-+ act {
-+ gpios = <&gpio 47 0>;
-+ };
-+
-+ pwr {
-+ label = "PWR";
-+ gpios = <&gpio 35 0>;
-+ default-state = "keep";
-+ linux,default-trigger = "default-on";
-+ };
-+ };
-+};
-+
-+&gpio {
-+ pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>;
-+
-+ /* I2S interface */
-+ i2s_alt0: i2s_alt0 {
-+ brcm,pins = <18 19 20 21>;
-+ brcm,function = <BCM2835_FSEL_ALT0>;
-+ };
-+};
-diff --git a/arch/arm/dts/bcm2836.dtsi b/arch/arm/dts/bcm2836.dtsi
-new file mode 100644
-index 000000000000..9d0651d8f373
---- /dev/null
-+++ b/arch/arm/dts/bcm2836.dtsi
-@@ -0,0 +1,78 @@
-+#include "bcm283x.dtsi"
-+
-+/ {
-+ compatible = "brcm,bcm2836";
-+
-+ soc {
-+ ranges = <0x7e000000 0x3f000000 0x1000000>,
-+ <0x40000000 0x40000000 0x00001000>;
-+ dma-ranges = <0xc0000000 0x00000000 0x3f000000>;
-+
-+ local_intc: local_intc {
-+ compatible = "brcm,bcm2836-l1-intc";
-+ reg = <0x40000000 0x100>;
-+ interrupt-controller;
-+ #interrupt-cells = <1>;
-+ interrupt-parent = <&local_intc>;
-+ };
-+
-+ arm-pmu {
-+ compatible = "arm,cortex-a7-pmu";
-+ interrupt-parent = <&local_intc>;
-+ interrupts = <9>;
-+ };
-+ };
-+
-+ timer {
-+ compatible = "arm,armv7-timer";
-+ interrupt-parent = <&local_intc>;
-+ interrupts = <0>, // PHYS_SECURE_PPI
-+ <1>, // PHYS_NONSECURE_PPI
-+ <3>, // VIRT_PPI
-+ <2>; // HYP_PPI
-+ always-on;
-+ };
-+
-+ cpus: cpus {
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+
-+ v7_cpu0: cpu@0 {
-+ device_type = "cpu";
-+ compatible = "arm,cortex-a7";
-+ reg = <0xf00>;
-+ clock-frequency = <800000000>;
-+ };
-+
-+ v7_cpu1: cpu@1 {
-+ device_type = "cpu";
-+ compatible = "arm,cortex-a7";
-+ reg = <0xf01>;
-+ clock-frequency = <800000000>;
-+ };
-+
-+ v7_cpu2: cpu@2 {
-+ device_type = "cpu";
-+ compatible = "arm,cortex-a7";
-+ reg = <0xf02>;
-+ clock-frequency = <800000000>;
-+ };
-+
-+ v7_cpu3: cpu@3 {
-+ device_type = "cpu";
-+ compatible = "arm,cortex-a7";
-+ reg = <0xf03>;
-+ clock-frequency = <800000000>;
-+ };
-+ };
-+};
-+
-+/* Make the BCM2835-style global interrupt controller be a child of the
-+ * CPU-local interrupt controller.
-+ */
-+&intc {
-+ compatible = "brcm,bcm2836-armctrl-ic";
-+ reg = <0x7e00b200 0x200>;
-+ interrupt-parent = <&local_intc>;
-+ interrupts = <8>;
-+};
-diff --git a/arch/arm/dts/bcm283x.dtsi b/arch/arm/dts/bcm283x.dtsi
-new file mode 100644
-index 000000000000..971e741e5467
---- /dev/null
-+++ b/arch/arm/dts/bcm283x.dtsi
-@@ -0,0 +1,212 @@
-+#include <dt-bindings/pinctrl/bcm2835.h>
-+#include <dt-bindings/clock/bcm2835.h>
-+#include "skeleton.dtsi"
-+
-+/* This include file covers the common peripherals and configuration between
-+ * bcm2835 and bcm2836 implementations, leaving the CPU configuration to
-+ * bcm2835.dtsi and bcm2836.dtsi.
-+ */
-+
-+/ {
-+ compatible = "brcm,bcm2835";
-+ model = "BCM2835";
-+ interrupt-parent = <&intc>;
-+
-+ chosen {
-+ bootargs = "earlyprintk console=ttyAMA0";
-+ };
-+
-+ soc {
-+ compatible = "simple-bus";
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+
-+ timer@7e003000 {
-+ compatible = "brcm,bcm2835-system-timer";
-+ reg = <0x7e003000 0x1000>;
-+ interrupts = <1 0>, <1 1>, <1 2>, <1 3>;
-+ /* This could be a reference to BCM2835_CLOCK_TIMER,
-+ * but we don't have the driver using the common clock
-+ * support yet.
-+ */
-+ clock-frequency = <1000000>;
-+ };
-+
-+ dma: dma@7e007000 {
-+ compatible = "brcm,bcm2835-dma";
-+ reg = <0x7e007000 0xf00>;
-+ interrupts = <1 16>,
-+ <1 17>,
-+ <1 18>,
-+ <1 19>,
-+ <1 20>,
-+ <1 21>,
-+ <1 22>,
-+ <1 23>,
-+ <1 24>,
-+ <1 25>,
-+ <1 26>,
-+ <1 27>,
-+ <1 28>;
-+
-+ #dma-cells = <1>;
-+ brcm,dma-channel-mask = <0x7f35>;
-+ };
-+
-+ intc: interrupt-controller@7e00b200 {
-+ compatible = "brcm,bcm2835-armctrl-ic";
-+ reg = <0x7e00b200 0x200>;
-+ interrupt-controller;
-+ #interrupt-cells = <2>;
-+ };
-+
-+ watchdog@7e100000 {
-+ compatible = "brcm,bcm2835-pm-wdt";
-+ reg = <0x7e100000 0x28>;
-+ };
-+
-+ clocks: cprman@7e101000 {
-+ compatible = "brcm,bcm2835-cprman";
-+ #clock-cells = <1>;
-+ reg = <0x7e101000 0x2000>;
-+
-+ /* CPRMAN derives everything from the platform's
-+ * oscillator.
-+ */
-+ clocks = <&clk_osc>;
-+ };
-+
-+ rng@7e104000 {
-+ compatible = "brcm,bcm2835-rng";
-+ reg = <0x7e104000 0x10>;
-+ };
-+
-+ mailbox: mailbox@7e00b800 {
-+ compatible = "brcm,bcm2835-mbox";
-+ reg = <0x7e00b880 0x40>;
-+ interrupts = <0 1>;
-+ #mbox-cells = <0>;
-+ };
-+
-+ gpio: gpio@7e200000 {
-+ compatible = "brcm,bcm2835-gpio";
-+ reg = <0x7e200000 0xb4>;
-+ /*
-+ * The GPIO IP block is designed for 3 banks of GPIOs.
-+ * Each bank has a GPIO interrupt for itself.
-+ * There is an overall "any bank" interrupt.
-+ * In order, these are GIC interrupts 17, 18, 19, 20.
-+ * Since the BCM2835 only has 2 banks, the 2nd bank
-+ * interrupt output appears to be mirrored onto the
-+ * 3rd bank's interrupt signal.
-+ * So, a bank0 interrupt shows up on 17, 20, and
-+ * a bank1 interrupt shows up on 18, 19, 20!
-+ */
-+ interrupts = <2 17>, <2 18>, <2 19>, <2 20>;
-+
-+ gpio-controller;
-+ #gpio-cells = <2>;
-+
-+ interrupt-controller;
-+ #interrupt-cells = <2>;
-+ };
-+
-+ uart0: uart@7e201000 {
-+ compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell";
-+ reg = <0x7e201000 0x1000>;
-+ interrupts = <2 25>;
-+ clocks = <&clocks BCM2835_CLOCK_UART>,
-+ <&clocks BCM2835_CLOCK_VPU>;
-+ clock-names = "uartclk", "apb_pclk";
-+ arm,primecell-periphid = <0x00241011>;
-+ };
-+
-+ i2s: i2s@7e203000 {
-+ compatible = "brcm,bcm2835-i2s";
-+ reg = <0x7e203000 0x20>,
-+ <0x7e101098 0x02>;
-+
-+ dmas = <&dma 2>,
-+ <&dma 3>;
-+ dma-names = "tx", "rx";
-+ status = "disabled";
-+ };
-+
-+ spi: spi@7e204000 {
-+ compatible = "brcm,bcm2835-spi";
-+ reg = <0x7e204000 0x1000>;
-+ interrupts = <2 22>;
-+ clocks = <&clocks BCM2835_CLOCK_VPU>;
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ status = "disabled";
-+ };
-+
-+ i2c0: i2c@7e205000 {
-+ compatible = "brcm,bcm2835-i2c";
-+ reg = <0x7e205000 0x1000>;
-+ interrupts = <2 21>;
-+ clocks = <&clocks BCM2835_CLOCK_VPU>;
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ status = "disabled";
-+ };
-+
-+ aux: aux@0x7e215000 {
-+ compatible = "brcm,bcm2835-aux";
-+ #clock-cells = <1>;
-+ reg = <0x7e215000 0x8>;
-+ clocks = <&clocks BCM2835_CLOCK_VPU>;
-+ };
-+
-+ sdhci: sdhci@7e300000 {
-+ compatible = "brcm,bcm2835-sdhci";
-+ reg = <0x7e300000 0x100>;
-+ interrupts = <2 30>;
-+ clocks = <&clocks BCM2835_CLOCK_EMMC>;
-+ status = "disabled";
-+ };
-+
-+ i2c1: i2c@7e804000 {
-+ compatible = "brcm,bcm2835-i2c";
-+ reg = <0x7e804000 0x1000>;
-+ interrupts = <2 21>;
-+ clocks = <&clocks BCM2835_CLOCK_VPU>;
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ status = "disabled";
-+ };
-+
-+ i2c2: i2c@7e805000 {
-+ compatible = "brcm,bcm2835-i2c";
-+ reg = <0x7e805000 0x1000>;
-+ interrupts = <2 21>;
-+ clocks = <&clocks BCM2835_CLOCK_VPU>;
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ status = "disabled";
-+ };
-+
-+ usb@7e980000 {
-+ compatible = "brcm,bcm2835-usb";
-+ reg = <0x7e980000 0x10000>;
-+ interrupts = <1 9>;
-+ };
-+ };
-+
-+ clocks {
-+ compatible = "simple-bus";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+
-+ /* The oscillator is the root of the clock tree. */
-+ clk_osc: clock@3 {
-+ compatible = "fixed-clock";
-+ reg = <3>;
-+ #clock-cells = <0>;
-+ clock-output-names = "osc";
-+ clock-frequency = <19200000>;
-+ };
-+
-+ };
-+};
-diff --git a/arch/arm/mach-bcm283x/core.c b/arch/arm/mach-bcm283x/core.c
-index 64f37813883a..f11221dd6685 100644
---- a/arch/arm/mach-bcm283x/core.c
-+++ b/arch/arm/mach-bcm283x/core.c
-@@ -42,15 +42,17 @@ static int bcm2835_clk_init(void)
-
- clk = clk_fixed("uart0-pl0110", 3 * 1000 * 1000);
- clk_register_clkdev(clk, NULL, "uart0-pl0110");
-+ clk_register_clkdev(clk, NULL, "3f201000.uart");
-
- clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
- clk_register_clkdev(clk, NULL, "bcm2835-cs");
-+ clk_register_clkdev(clk, NULL, "3f003000.timer");
-
- add_generic_device("bcm2835-cs", DEVICE_ID_SINGLE, NULL, BCM2835_ST_BASE, 0x1C, IORESOURCE_MEM, NULL);
-
- return 0;
- }
--postcore_initcall(bcm2835_clk_init);
-+pure_initcall(bcm2835_clk_init);
-
- void bcm2835_register_uart(void)
- {
diff --git a/configs/platform-v7a/patches/barebox-2016.05.0/0301-Release-2016.05.0-customers-pengutronix-multi_v7-201.patch b/configs/platform-v7a/patches/barebox-2016.05.0/0301-Release-2016.05.0-customers-pengutronix-multi_v7-201.patch
deleted file mode 100644
index 6526de9..0000000
--- a/configs/platform-v7a/patches/barebox-2016.05.0/0301-Release-2016.05.0-customers-pengutronix-multi_v7-201.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From: Michael Grzeschik <m.grzeschik@pengutronix.de>
-Date: Fri, 10 Jun 2016 14:10:58 +0200
-Subject: [PATCH] Release 2016.05.0/customers/pengutronix/multi_v7/20160610-1
-
-Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
----
- Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Makefile b/Makefile
-index 93f1d17d99d2..b844aa674da5 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1,7 +1,7 @@
- VERSION = 2016
- PATCHLEVEL = 05
- SUBLEVEL = 0
--EXTRAVERSION =
-+EXTRAVERSION =-20160610-1
- NAME = None
-
- # *DOCUMENTATION*
diff --git a/configs/platform-v7a/patches/barebox-2016.05.0/series b/configs/platform-v7a/patches/barebox-2016.05.0/series
deleted file mode 100644
index a93c9d2..0000000
--- a/configs/platform-v7a/patches/barebox-2016.05.0/series
+++ /dev/null
@@ -1,22 +0,0 @@
-# umpf-base: v2016.05.0
-# umpf-name: 2016.05.0/customers/pengutronix/multi_v7
-# umpf-version: 2016.05.0/customers/pengutronix/multi_v7/20160610-1
-# umpf-topic: v2016.05.0/topic/bootstate
-# umpf-hashinfo: bfaa55682a5f53a0f679ab08e6b55350594ed047
-# umpf-topic-range: f5142b8564005d95324e4c326dbc390ce85e8bef..bfaa55682a5f53a0f679ab08e6b55350594ed047
-0001-bootstate-add-framework-for-redundant-boot-scenarios.patch
-0002-bootstate-Add-kernel-option-containing-the-system-th.patch
-0003-bootstate-separate-names-from-boot-targets.patch
-0004-bootstate-set-kernel-option-to-name-of-boot-target.patch
-# umpf-topic: v2016.05.0/customers/pengutronix/beaglebone
-# umpf-hashinfo: 9cbaeb8cfaa8b5e7837725df242aacccbbc5fa53
-# umpf-topic-range: bfaa55682a5f53a0f679ab08e6b55350594ed047..c95ad802cdf09922b56027338b85cd58de732c2a
-0101-beaglebone-add-state-entrie-for-mmc0-and-mmc1.patch
-# umpf-topic: v2016.05.0/customers/pengutronix/rpi2
-# umpf-hashinfo: 2df94ba7d6c5680032d7da8c1554cf01c7ca845b
-# umpf-topic-range: c95ad802cdf09922b56027338b85cd58de732c2a..64afca484be01d3a0329b289fe4667608495e14b
-0201-rpi2-add-basic-boot-spec-devicetree-support.patch
-# umpf-release: 2016.05.0/customers/pengutronix/multi_v7/20160610-1
-# umpf-topic-range: 64afca484be01d3a0329b289fe4667608495e14b..92019e24a71b3a5484927b84863d0f2bf34aae51
-0301-Release-2016.05.0-customers-pengutronix-multi_v7-201.patch
-# umpf-end
diff --git a/configs/platform-v7a/patches/barebox-2017.06.0/0001-vexpress-use-device-tree-provided-by-QEMU-if-availab.patch b/configs/platform-v7a/patches/barebox-2017.06.0/0001-vexpress-use-device-tree-provided-by-QEMU-if-availab.patch
new file mode 100644
index 0000000..a5fdc9c
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2017.06.0/0001-vexpress-use-device-tree-provided-by-QEMU-if-availab.patch
@@ -0,0 +1,43 @@
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Sat, 10 Sep 2016 17:40:56 +0200
+Subject: [PATCH] vexpress: use device tree provided by QEMU if available
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+---
+ arch/arm/boards/vexpress/lowlevel.c | 17 +++++++++++++++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/boards/vexpress/lowlevel.c b/arch/arm/boards/vexpress/lowlevel.c
+index 204d29d8f098..7ed07a1e4134 100644
+--- a/arch/arm/boards/vexpress/lowlevel.c
++++ b/arch/arm/boards/vexpress/lowlevel.c
+@@ -9,14 +9,27 @@
+ #include <asm/barebox-arm-head.h>
+ #include <asm/barebox-arm.h>
+ #include <asm/system_info.h>
++#include <asm/unaligned.h>
+ #include <linux/amba/sp804.h>
+
+ void __naked barebox_arm_reset_vector(void)
+ {
++ unsigned long membase;
++ void *boarddata;
++
+ arm_cpu_lowlevel_init();
+
+ if (amba_is_arm_sp804(IOMEM(0x10011000)))
+- barebox_arm_entry(0x60000000, SZ_512M, NULL);
++ membase = 0x60000000;
++ else
++ membase = 0x80000000;
++
++ /* QEMU may put a dtb at the bare address */
++ if (IS_ENABLED(CONFIG_OFDEVICE) &&
++ get_unaligned_be32((void*)membase) == FDT_MAGIC)
++ boarddata = (void*)membase;
+ else
+- barebox_arm_entry(0x80000000, SZ_512M, NULL);
++ boarddata = NULL;
++
++ barebox_arm_entry(membase, SZ_512M, boarddata);
+ }
diff --git a/configs/platform-v7a/patches/barebox-2017.06.0/0002-vexpress-device-tree-support.patch b/configs/platform-v7a/patches/barebox-2017.06.0/0002-vexpress-device-tree-support.patch
new file mode 100644
index 0000000..7f709fc
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2017.06.0/0002-vexpress-device-tree-support.patch
@@ -0,0 +1,78 @@
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Sat, 10 Sep 2016 17:51:36 +0200
+Subject: [PATCH] vexpress: device tree support
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+---
+ arch/arm/boards/vexpress/init.c | 16 ++++++++++------
+ arch/arm/dts/vexpress-v2p-ca9.dts | 27 +++++++++++++++++++++++++++
+ 2 files changed, 37 insertions(+), 6 deletions(-)
+ create mode 100644 arch/arm/dts/vexpress-v2p-ca9.dts
+
+diff --git a/arch/arm/boards/vexpress/init.c b/arch/arm/boards/vexpress/init.c
+index f89dff939231..68ebbfab2633 100644
+--- a/arch/arm/boards/vexpress/init.c
++++ b/arch/arm/boards/vexpress/init.c
+@@ -71,10 +71,12 @@ static void vexpress_a9_legacy_mem_init(void)
+
+ static void vexpress_a9_legacy_devices_init(void)
+ {
+- add_cfi_flash_device(0, 0x40000000, SZ_64M, 0);
+- add_cfi_flash_device(1, 0x44000000, SZ_64M, 0);
+- add_generic_device("smc911x", DEVICE_ID_DYNAMIC, NULL, 0x4e000000,
+- 64 * 1024, IORESOURCE_MEM, NULL);
++ if (!IS_ENABLED(CONFIG_OFDEVICE)) {
++ add_cfi_flash_device(0, 0x40000000, SZ_64M, 0);
++ add_cfi_flash_device(1, 0x44000000, SZ_64M, 0);
++ add_generic_device("smc911x", DEVICE_ID_DYNAMIC, NULL, 0x4e000000,
++ 64 * 1024, IORESOURCE_MEM, NULL);
++ }
+ vexpress_a9_legacy_register_mmc(&mmci_plat);
+ armlinux_set_architecture(MACH_TYPE_VEXPRESS);
+ }
+@@ -107,8 +109,10 @@ static int vexpress_devices_init(void)
+ writel(1, v2m_sysreg_base + V2M_SYS_FLASH);
+ v2m_init->devices_init();
+
+- devfs_add_partition("nor0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self");
+- devfs_add_partition("nor0", 0x40000, 0x20000, DEVFS_PARTITION_FIXED, "env0");
++ if (!IS_ENABLED(CONFIG_OFDEVICE)) {
++ devfs_add_partition("nor0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self");
++ devfs_add_partition("nor0", 0x40000, 0x20000, DEVFS_PARTITION_FIXED, "env0");
++ }
+
+ if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT_GENERIC))
+ defaultenv_append_directory(defaultenv_vexpress);
+diff --git a/arch/arm/dts/vexpress-v2p-ca9.dts b/arch/arm/dts/vexpress-v2p-ca9.dts
+new file mode 100644
+index 000000000000..aadcb3a70377
+--- /dev/null
++++ b/arch/arm/dts/vexpress-v2p-ca9.dts
+@@ -0,0 +1,27 @@
++#include <arm/vexpress-v2p-ca9.dts>
++
++/ {
++ barebox_environment {
++ compatible = "barebox,environment";
++ device-path = &barebox_env;
++ };
++
++ smb@04000000 {
++ motherboard {
++ flash@0,00000000 {
++ #address-cells = <1>;
++ #size-cells = <1>;
++
++ partition@0 {
++ label = "barebox";
++ reg = <0x0 0x80000>;
++ };
++
++ barebox_env: partition@80000 {
++ label = "barebox-environment";
++ reg = <0x80000 0x80000>;
++ };
++ };
++ };
++ };
++};
diff --git a/configs/platform-v7a/patches/barebox-2017.06.0/0003-of-base-add-funtion-to-copy-a-device-tree-node.patch b/configs/platform-v7a/patches/barebox-2017.06.0/0003-of-base-add-funtion-to-copy-a-device-tree-node.patch
new file mode 100644
index 0000000..31b90c3
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2017.06.0/0003-of-base-add-funtion-to-copy-a-device-tree-node.patch
@@ -0,0 +1,50 @@
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Tue, 13 Sep 2016 21:17:12 +0200
+Subject: [PATCH] of: base: add funtion to copy a device tree node
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+---
+ drivers/of/base.c | 16 ++++++++++++++++
+ include/of.h | 2 ++
+ 2 files changed, 18 insertions(+)
+
+diff --git a/drivers/of/base.c b/drivers/of/base.c
+index c9bdd91810f2..e93ba687fafc 100644
+--- a/drivers/of/base.c
++++ b/drivers/of/base.c
+@@ -1963,6 +1963,22 @@ out:
+ return dn;
+ }
+
++struct device_node *of_copy_node(struct device_node *parent, const struct device_node *other)
++{
++ struct device_node *np, *child;
++ struct property *pp;
++
++ np = of_new_node(parent, other->name);
++
++ list_for_each_entry(pp, &other->properties, list)
++ of_new_property(np, pp->name, pp->value, pp->length);
++
++ for_each_child_of_node(other, child)
++ of_copy_node(np, child);
++
++ return np;
++}
++
+ void of_delete_node(struct device_node *node)
+ {
+ struct device_node *n, *nt;
+diff --git a/include/of.h b/include/of.h
+index 0ba73f197f28..c1136708ce6c 100644
+--- a/include/of.h
++++ b/include/of.h
+@@ -144,6 +144,8 @@ extern struct device_node *of_new_node(struct device_node *parent,
+ const char *name);
+ extern struct device_node *of_create_node(struct device_node *root,
+ const char *path);
++extern struct device_node *of_copy_node(struct device_node *parent,
++ const struct device_node *other);
+ extern void of_delete_node(struct device_node *node);
+
+ extern int of_machine_is_compatible(const char *compat);
diff --git a/configs/platform-v7a/patches/barebox-2017.06.0/0004-commands-of_dump-don-t-use-flatten-unflatten-to-copy.patch b/configs/platform-v7a/patches/barebox-2017.06.0/0004-commands-of_dump-don-t-use-flatten-unflatten-to-copy.patch
new file mode 100644
index 0000000..8dc2da3
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2017.06.0/0004-commands-of_dump-don-t-use-flatten-unflatten-to-copy.patch
@@ -0,0 +1,34 @@
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Tue, 13 Sep 2016 21:18:15 +0200
+Subject: [PATCH] commands: of_dump: don't use flatten/unflatten to copy the
+ device tree
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+---
+ commands/of_dump.c | 13 +------------
+ 1 file changed, 1 insertion(+), 12 deletions(-)
+
+diff --git a/commands/of_dump.c b/commands/of_dump.c
+index 7bec0b925eee..ac5014e1fff8 100644
+--- a/commands/of_dump.c
++++ b/commands/of_dump.c
+@@ -97,18 +97,7 @@ static int do_of_dump(int argc, char *argv[])
+
+ if (fix) {
+ /* create a copy of internal devicetree */
+- void *fdt;
+- fdt = of_flatten_dtb(root);
+- root = of_unflatten_dtb(fdt);
+-
+- free(fdt);
+-
+- if (IS_ERR(root)) {
+- ret = PTR_ERR(root);
+- goto out;
+- }
+-
+- of_free = root;
++ of_free = root = of_copy_node(NULL, root);
+ }
+ }
+
diff --git a/configs/platform-v7a/patches/barebox-2017.06.0/0005-common-oftree-add-fixup-handler-for-virtio-mmio-devi.patch b/configs/platform-v7a/patches/barebox-2017.06.0/0005-common-oftree-add-fixup-handler-for-virtio-mmio-devi.patch
new file mode 100644
index 0000000..8b64d2f
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2017.06.0/0005-common-oftree-add-fixup-handler-for-virtio-mmio-devi.patch
@@ -0,0 +1,62 @@
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Tue, 13 Sep 2016 21:20:10 +0200
+Subject: [PATCH] common: oftree: add fixup handler for 'virtio,mmio' devices
+
+Qemu adds 'virtio,mmio' nodes to the device tree. Before passing it to the
+bootloader or the Linux kernel. This fixup handler copies these nodes to
+the new device tree.
+
+v2:
+- move from general to platform specific init
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
+---
+ arch/arm/boards/vexpress/init.c | 30 ++++++++++++++++++++++++++++++
+ 1 file changed, 30 insertions(+)
+
+diff --git a/arch/arm/boards/vexpress/init.c b/arch/arm/boards/vexpress/init.c
+index 68ebbfab2633..8655b7e17c97 100644
+--- a/arch/arm/boards/vexpress/init.c
++++ b/arch/arm/boards/vexpress/init.c
+@@ -18,6 +18,7 @@
+ #include <globalvar.h>
+ #include <linux/amba/sp804.h>
+ #include <mci.h>
++#include <of.h>
+
+ struct vexpress_init {
+ void (*core_init)(void);
+@@ -156,3 +157,32 @@ static int vexpress_core_init(void)
+ return 0;
+ }
+ postcore_initcall(vexpress_core_init);
++
++static int of_fixup_virtio_mmio(struct device_node *root, void *unused)
++{
++ struct device_node *barebox_root, *np, *parent;
++
++ barebox_root = of_get_root_node();
++ if (root == barebox_root)
++ return 0;
++
++ for_each_compatible_node_from(np, barebox_root, NULL, "virtio,mmio") {
++ if (of_get_parent(np) == barebox_root)
++ parent = root;
++ else
++ parent = of_find_node_by_path_from(root,
++ of_get_parent(np)->full_name);
++ if (!parent)
++ return -EINVAL;
++
++ of_copy_node(parent, np);
++ }
++
++ return 0;
++}
++
++static int of_register_virtio_mmio_fixup(void)
++{
++ return of_register_fixup(of_fixup_virtio_mmio, NULL);
++}
++late_initcall(of_register_virtio_mmio_fixup);
diff --git a/configs/platform-v7a/patches/barebox-2016.05.0/0101-beaglebone-add-state-entrie-for-mmc0-and-mmc1.patch b/configs/platform-v7a/patches/barebox-2017.06.0/0101-beaglebone-add-state-entrie-for-mmc0-and-mmc1.patch
index a26a282..a26a282 100644
--- a/configs/platform-v7a/patches/barebox-2016.05.0/0101-beaglebone-add-state-entrie-for-mmc0-and-mmc1.patch
+++ b/configs/platform-v7a/patches/barebox-2017.06.0/0101-beaglebone-add-state-entrie-for-mmc0-and-mmc1.patch
diff --git a/configs/platform-v7a/patches/barebox-2017.06.0/0201-of_device_is_stdout_path-simplify.patch b/configs/platform-v7a/patches/barebox-2017.06.0/0201-of_device_is_stdout_path-simplify.patch
new file mode 100644
index 0000000..47feb45
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2017.06.0/0201-of_device_is_stdout_path-simplify.patch
@@ -0,0 +1,45 @@
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+Date: Wed, 14 Jun 2017 13:26:30 +0200
+Subject: [PATCH] of_device_is_stdout_path: simplify
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Test for dev->device_node being NULL earlier which at the end of the
+function allows to simplify the calculation of the return value
+
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Forwarded: id:20170614113110.21604-1-u.kleine-koenig@pengutronix.de
+---
+ drivers/of/base.c | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/of/base.c b/drivers/of/base.c
+index e93ba687fafc..94e4c6b7b4f8 100644
+--- a/drivers/of/base.c
++++ b/drivers/of/base.c
+@@ -2016,6 +2016,9 @@ int of_device_is_stdout_path(struct device_d *dev)
+ struct device_node *dn;
+ const char *name;
+
++ if (!dev->device_node)
++ return 0;
++
+ name = of_get_property(of_chosen, "stdout-path", NULL);
+ if (!name)
+ name = of_get_property(of_chosen, "linux,stdout-path", NULL);
+@@ -2024,13 +2027,8 @@ int of_device_is_stdout_path(struct device_d *dev)
+ return 0;
+
+ dn = of_find_node_by_path(name);
+- if (!dn)
+- return 0;
+
+- if (dn == dev->device_node)
+- return 1;
+-
+- return 0;
++ return dn == dev->device_node;
+ }
+
+ /**
diff --git a/configs/platform-v7a/patches/barebox-2017.06.0/0202-of_device_is_stdout_path-split-off-options-and-suppo.patch b/configs/platform-v7a/patches/barebox-2017.06.0/0202-of_device_is_stdout_path-split-off-options-and-suppo.patch
new file mode 100644
index 0000000..674294d
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2017.06.0/0202-of_device_is_stdout_path-split-off-options-and-suppo.patch
@@ -0,0 +1,53 @@
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+Date: Wed, 14 Jun 2017 13:30:54 +0200
+Subject: [PATCH] of_device_is_stdout_path: split off options and support
+ aliases
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Several device trees use something like:
+
+ stdout-path = "serial0:115200n8";
+
+Currently of_device_is_stdout_path fails to do the right thing here
+because it expects an absolute node path and no options. So split off
+options (everything after the colon) and resolve aliases.
+
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Forwarded: id:20170614180249.12644-1-u.kleine-koenig@pengutronix.de (v2)
+---
+ drivers/of/base.c | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/of/base.c b/drivers/of/base.c
+index 94e4c6b7b4f8..a1ae8073931d 100644
+--- a/drivers/of/base.c
++++ b/drivers/of/base.c
+@@ -2015,6 +2015,8 @@ int of_device_is_stdout_path(struct device_d *dev)
+ {
+ struct device_node *dn;
+ const char *name;
++ const char *p;
++ char *q;
+
+ if (!dev->device_node)
+ return 0;
+@@ -2026,7 +2028,16 @@ int of_device_is_stdout_path(struct device_d *dev)
+ if (!name)
+ return 0;
+
+- dn = of_find_node_by_path(name);
++ /* This could make use of strchrnul if it were available */
++ p = strchr(name, ':');
++ if (!p)
++ p = name + strlen(name);
++
++ q = xstrndup(name, p - name);
++
++ dn = of_find_node_by_path_or_alias(NULL, q);
++
++ free(q);
+
+ return dn == dev->device_node;
+ }
diff --git a/configs/platform-v7a/patches/barebox-2017.06.0/0203-ARM-imx-add-support-for-Udoo-Neo-full.patch b/configs/platform-v7a/patches/barebox-2017.06.0/0203-ARM-imx-add-support-for-Udoo-Neo-full.patch
new file mode 100644
index 0000000..c9854a7
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2017.06.0/0203-ARM-imx-add-support-for-Udoo-Neo-full.patch
@@ -0,0 +1,320 @@
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+Date: Wed, 14 Jun 2017 18:32:15 +0200
+Subject: [PATCH] ARM: imx: add support for Udoo Neo full
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+---
+ arch/arm/boards/Makefile | 1 +
+ arch/arm/boards/udoo-neo/Makefile | 2 +
+ arch/arm/boards/udoo-neo/board.c | 27 +++++
+ .../flash-header-mx6sx-udoo-neo_full.imxcfg | 125 +++++++++++++++++++++
+ arch/arm/boards/udoo-neo/lowlevel.c | 39 +++++++
+ arch/arm/dts/Makefile | 1 +
+ arch/arm/dts/imx6sx-udoo-neo-full.dts | 4 +
+ arch/arm/mach-imx/Kconfig | 4 +
+ arch/arm/mach-imx/include/mach/esdctl.h | 1 +
+ images/Makefile.imx | 5 +
+ 10 files changed, 209 insertions(+)
+ create mode 100644 arch/arm/boards/udoo-neo/Makefile
+ create mode 100644 arch/arm/boards/udoo-neo/board.c
+ create mode 100644 arch/arm/boards/udoo-neo/flash-header-mx6sx-udoo-neo_full.imxcfg
+ create mode 100644 arch/arm/boards/udoo-neo/lowlevel.c
+ create mode 100644 arch/arm/dts/imx6sx-udoo-neo-full.dts
+
+diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
+index 0ecfb3e4b398..98f923a134a0 100644
+--- a/arch/arm/boards/Makefile
++++ b/arch/arm/boards/Makefile
+@@ -130,6 +130,7 @@ obj-$(CONFIG_MACH_TX51) += karo-tx51/
+ obj-$(CONFIG_MACH_TX53) += karo-tx53/
+ obj-$(CONFIG_MACH_TX6X) += karo-tx6x/
+ obj-$(CONFIG_MACH_UDOO) += udoo/
++obj-$(CONFIG_MACH_UDOO_NEO) += udoo-neo/
+ obj-$(CONFIG_MACH_USB_A9260) += usb-a926x/
+ obj-$(CONFIG_MACH_USB_A9263) += usb-a926x/
+ obj-$(CONFIG_MACH_USB_A9G20) += usb-a926x/
+diff --git a/arch/arm/boards/udoo-neo/Makefile b/arch/arm/boards/udoo-neo/Makefile
+new file mode 100644
+index 000000000000..01c7a259e9a5
+--- /dev/null
++++ b/arch/arm/boards/udoo-neo/Makefile
+@@ -0,0 +1,2 @@
++obj-y += board.o
++lwl-y += lowlevel.o
+diff --git a/arch/arm/boards/udoo-neo/board.c b/arch/arm/boards/udoo-neo/board.c
+new file mode 100644
+index 000000000000..9bf480305d70
+--- /dev/null
++++ b/arch/arm/boards/udoo-neo/board.c
+@@ -0,0 +1,27 @@
++/*
++ * Copyright (C) 2014 Pengutronix, Sascha Hauer
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * version 2, as published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ */
++
++#include <common.h>
++#include <init.h>
++#include <linux/clk.h>
++
++static int imx6sx_udoneo_coredevices_init(void)
++{
++ if (!of_machine_is_compatible("fsl,imx6sx-udoo-neo"))
++ return 0;
++
++ barebox_set_hostname("mx6sx-udooneo");
++
++ return 0;
++}
++coredevice_initcall(imx6sx_udoneo_coredevices_init);
+diff --git a/arch/arm/boards/udoo-neo/flash-header-mx6sx-udoo-neo_full.imxcfg b/arch/arm/boards/udoo-neo/flash-header-mx6sx-udoo-neo_full.imxcfg
+new file mode 100644
+index 000000000000..d91de992fa6a
+--- /dev/null
++++ b/arch/arm/boards/udoo-neo/flash-header-mx6sx-udoo-neo_full.imxcfg
+@@ -0,0 +1,125 @@
++loadaddr 0x80000000
++soc imx6
++dcdofs 0x400
++
++/* Enable all clocks */
++wm 32 0x020c4068 0xffffffff
++wm 32 0x020c406c 0xffffffff
++wm 32 0x020c4070 0xffffffff
++wm 32 0x020c4074 0xffffffff
++wm 32 0x020c4078 0xffffffff
++wm 32 0x020c407c 0xffffffff
++wm 32 0x020c4080 0xffffffff
++wm 32 0x020c4084 0xffffffff
++/********************************************/
++
++/* IOMUX */
++/* DDR IO TYPE */
++wm 32 0x020e0618 0x000c0000
++wm 32 0x020e05fc 0x00000000
++/********************************************/
++
++/* CLOCK */
++wm 32 0x020e032c 0x00000030
++/********************************************/
++
++/* ADDRESS */
++wm 32 0x020e0300 0x00000020
++wm 32 0x020e02fc 0x00000020
++wm 32 0x020e05f4 0x00000020
++/********************************************/
++
++/* CONTROL */
++wm 32 0x020e0340 0x00000020
++
++wm 32 0x020e0320 0x00000000
++wm 32 0x020e0310 0x00000020
++wm 32 0x020e0314 0x00000020
++wm 32 0x020e0614 0x00000020
++/********************************************/
++
++/* DATA STROBE */
++wm 32 0x020e05f8 0x00020000
++wm 32 0x020e0330 0x00000028
++wm 32 0x020e0334 0x00000028
++wm 32 0x020e0338 0x00000028
++wm 32 0x020e033c 0x00000028
++/********************************************/
++
++/* DATA */
++wm 32 0x020e0608 0x00020000
++wm 32 0x020e060c 0x00000028
++wm 32 0x020e0610 0x00000028
++wm 32 0x020e061c 0x00000028
++wm 32 0x020e0620 0x00000028
++wm 32 0x020e02ec 0x00000028
++wm 32 0x020e02f0 0x00000028
++wm 32 0x020e02f4 0x00000028
++wm 32 0x020e02f8 0x00000028
++/********************************************/
++
++/* Calibrations */
++/* ZQ */
++wm 32 0x021b0800 0xa1390003
++/********************************************/
++
++/* write leveling */
++wm 32 0x021b080c 0x001E0022
++wm 32 0x021b0810 0x001C0019
++/********************************************/
++
++/* DQS Read Gate */
++wm 32 0x021b083c 0x41540150
++wm 32 0x021b0840 0x01440138
++/********************************************/
++
++/* Read/Write Delay */
++wm 32 0x021b0848 0x403E4644
++wm 32 0x021b0850 0x3C3A4038
++/********************************************/
++
++/* read data bit delay */
++wm 32 0x021b081c 0x33333333
++wm 32 0x021b0820 0x33333333
++wm 32 0x021b0824 0x33333333
++wm 32 0x021b0828 0x33333333
++/********************************************/
++
++/* Complete calibration by forced measurment */
++wm 32 0x021b08b8 0x00000800
++/********************************************/
++
++/* MMDC init */
++/* in DDR3, 64-bit mode, only MMDC0 is initiated */
++wm 32 0x021b0004 0x0002002d
++wm 32 0x021b0008 0x00333030
++wm 32 0x021b000c 0x676b52f3
++wm 32 0x021b0010 0xb66d8b63
++wm 32 0x021b0014 0x01ff00db
++wm 32 0x021b0018 0x00011740
++wm 32 0x021b001c 0x00008000
++wm 32 0x021b002c 0x000026d2
++wm 32 0x021b0030 0x006b1023
++wm 32 0x021b0040 0x0000005f
++wm 32 0x021b0000 0x83190000
++/********************************************/
++
++/* Initialize MT41K256M16HA-125 */
++/* MR2 */
++wm 32 0x021b001c 0x04008032
++/* MR3 */
++wm 32 0x021b001c 0x00008033
++/* MR1 */
++wm 32 0x021b001c 0x00048031
++/* MR0 */
++wm 32 0x021b001c 0x05208030
++/* DDR device ZQ calibration */
++wm 32 0x021b001c 0x04008040
++/********************************************/
++
++/* final DDR setup, before operation start */
++wm 32 0x021b0020 0x00000800
++wm 32 0x021b0818 0x00011117
++wm 32 0x021b001c 0x00000000
++/********************************************/
++
+diff --git a/arch/arm/boards/udoo-neo/lowlevel.c b/arch/arm/boards/udoo-neo/lowlevel.c
+new file mode 100644
+index 000000000000..e78c2685fd78
+--- /dev/null
++++ b/arch/arm/boards/udoo-neo/lowlevel.c
+@@ -0,0 +1,39 @@
++#include <debug_ll.h>
++#include <common.h>
++#include <linux/sizes.h>
++#include <mach/generic.h>
++#include <asm/barebox-arm-head.h>
++#include <asm/barebox-arm.h>
++#include <mach/esdctl.h>
++
++static inline void setup_uart(void)
++{
++ void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR;
++
++ imx6_ungate_all_peripherals();
++
++ writel(0x0, iomuxbase + 0x24);
++ writel(0x1b0b1, iomuxbase + 0x036C);
++ writel(0x0, iomuxbase + 0x28);
++ writel(0x1b0b1, iomuxbase + 0x0370);
++
++ imx6_uart_setup_ll();
++
++ putc_ll('>');
++}
++
++extern char __dtb_imx6sx_udoo_neo_full_start[];
++
++ENTRY_FUNCTION(start_imx6sx_udoo_neo, r0, r1, r2)
++{
++ void *fdt;
++
++ imx6_cpu_lowlevel_init();
++
++ if (IS_ENABLED(CONFIG_DEBUG_LL))
++ setup_uart();
++
++ fdt = __dtb_imx6sx_udoo_neo_full_start - get_runtime_offset();
++
++ imx6sx_barebox_entry(fdt);
++}
+diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
+index 2342d35a4bd1..3129a7dfbce1 100644
+--- a/arch/arm/dts/Makefile
++++ b/arch/arm/dts/Makefile
+@@ -82,6 +82,7 @@ pbl-dtb-$(CONFIG_MACH_TX25) += imx25-karo-tx25.dtb.o
+ pbl-dtb-$(CONFIG_MACH_TX6X) += imx6dl-tx6u.dtb.o
+ pbl-dtb-$(CONFIG_MACH_TX6X) += imx6q-tx6q.dtb.o
+ pbl-dtb-$(CONFIG_MACH_UDOO) += imx6q-udoo.dtb.o
++pbl-dtb-$(CONFIG_MACH_UDOO_NEO) += imx6sx-udoo-neo-full.dtb.o
+ pbl-dtb-$(CONFIG_MACH_USI_TOPKICK) += kirkwood-topkick-bb.dtb.o
+ pbl-dtb-$(CONFIG_MACH_VARISCITE_MX6) += imx6q-var-custom.dtb.o
+ pbl-dtb-$(CONFIG_MACH_VSCOM_BALTOS) += am335x-baltos-minimal.dtb.o
+diff --git a/arch/arm/dts/imx6sx-udoo-neo-full.dts b/arch/arm/dts/imx6sx-udoo-neo-full.dts
+new file mode 100644
+index 000000000000..9203d40207c5
+--- /dev/null
++++ b/arch/arm/dts/imx6sx-udoo-neo-full.dts
+@@ -0,0 +1,4 @@
++#include <arm/imx6sx-udoo-neo-full.dts>
++
++/{
++};
+diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
+index 80f53ce124c1..a682030faf2e 100644
+--- a/arch/arm/mach-imx/Kconfig
++++ b/arch/arm/mach-imx/Kconfig
+@@ -356,6 +356,10 @@ config MACH_UDOO
+ bool "Freescale i.MX6 UDOO Board"
+ select ARCH_IMX6
+
++config MACH_UDOO_NEO
++ bool "Freescale i.MX6 UDOO Board"
++ select ARCH_IMX6SX
++
+ config MACH_VARISCITE_MX6
+ bool "Variscite i.MX6 Quad SOM"
+ select ARCH_IMX6
+diff --git a/arch/arm/mach-imx/include/mach/esdctl.h b/arch/arm/mach-imx/include/mach/esdctl.h
+index 66dcc8974cfb..bd6092febca4 100644
+--- a/arch/arm/mach-imx/include/mach/esdctl.h
++++ b/arch/arm/mach-imx/include/mach/esdctl.h
+@@ -137,6 +137,7 @@ void __noreturn imx51_barebox_entry(void *boarddata);
+ void __noreturn imx53_barebox_entry(void *boarddata);
+ void __noreturn imx6q_barebox_entry(void *boarddata);
+ void __noreturn imx6ul_barebox_entry(void *boarddata);
++#define imx6sx_barebox_entry(boarddata) imx6ul_barebox_entry(boarddata)
+ void imx_esdctl_disable(void);
+ #endif
+
+diff --git a/images/Makefile.imx b/images/Makefile.imx
+index cdad2e0b8826..867ff5f6a564 100644
+--- a/images/Makefile.imx
++++ b/images/Makefile.imx
+@@ -260,6 +260,11 @@ CFG_start_imx6q_sabresd.pblx.imximg = $(board)/freescale-mx6-sabresd/flash-heade
+ FILE_barebox-freescale-imx6q-sabresd.img = start_imx6q_sabresd.pblx.imximg
+ image-$(CONFIG_MACH_SABRESD) += barebox-freescale-imx6q-sabresd.img
+
++pblx-$(CONFIG_MACH_UDOO_NEO) += start_imx6sx_udoo_neo
++CFG_start_imx6sx_udoo_neo.pblx.imximg = $(board)/udoo-neo/flash-header-mx6sx-udoo-neo_full.imxcfg
++FILE_barebox-udoo-neo.img = start_imx6sx_udoo_neo.pblx.imximg
++image-$(CONFIG_MACH_UDOO_NEO) += barebox-udoo-neo.img
++
+ pblx-$(CONFIG_MACH_FREESCALE_IMX6SX_SABRESDB) += start_imx6sx_sabresdb
+ CFG_start_imx6sx_sabresdb.pblx.imximg = $(board)/freescale-mx6sx-sabresdb/flash-header-mx6sx-sabresdb.imxcfg
+ FILE_barebox-freescale-imx6sx-sabresdb.img = start_imx6sx_sabresdb.pblx.imximg
diff --git a/configs/platform-v7a/patches/barebox-2017.06.0/0301-Release-2017.06.0-pengutronix-multi_v7-20170614-1.patch b/configs/platform-v7a/patches/barebox-2017.06.0/0301-Release-2017.06.0-pengutronix-multi_v7-20170614-1.patch
new file mode 100644
index 0000000..e6f74d5
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2017.06.0/0301-Release-2017.06.0-pengutronix-multi_v7-20170614-1.patch
@@ -0,0 +1,25 @@
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+Date: Wed, 14 Jun 2017 22:22:27 +0200
+Subject: [PATCH] Release 2017.06.0/pengutronix/multi_v7/20170614-1
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 42948fafa33f..284a039e61db 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+ VERSION = 2017
+ PATCHLEVEL = 06
+ SUBLEVEL = 0
+-EXTRAVERSION =
++EXTRAVERSION =-20170614-1
+ NAME = None
+
+ # *DOCUMENTATION*
diff --git a/configs/platform-v7a/patches/barebox-2017.06.0/series b/configs/platform-v7a/patches/barebox-2017.06.0/series
new file mode 100644
index 0000000..9843d20
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2017.06.0/series
@@ -0,0 +1,25 @@
+# umpf-base: v2017.06.0
+# umpf-name: 2017.06.0/pengutronix/multi_v7
+# umpf-version: 2017.06.0/pengutronix/multi_v7/20170614-1
+# umpf-topic: v2017.06.0/topic/vexpress
+# umpf-hashinfo: abc9e46ec6ffeae46efe678469a086dc89c83e1f
+# umpf-topic-range: 2974d53a3b3a2f56d96c56acf26501735a4e41cd..abc9e46ec6ffeae46efe678469a086dc89c83e1f
+0001-vexpress-use-device-tree-provided-by-QEMU-if-availab.patch
+0002-vexpress-device-tree-support.patch
+0003-of-base-add-funtion-to-copy-a-device-tree-node.patch
+0004-commands-of_dump-don-t-use-flatten-unflatten-to-copy.patch
+0005-common-oftree-add-fixup-handler-for-virtio-mmio-devi.patch
+# umpf-topic: v2016.05.0/customers/pengutronix/beaglebone
+# umpf-hashinfo: 9cbaeb8cfaa8b5e7837725df242aacccbbc5fa53
+# umpf-topic-range: abc9e46ec6ffeae46efe678469a086dc89c83e1f..4cb671a6a6dacc8f15dc4ecd830dddca7d20bc27
+0101-beaglebone-add-state-entrie-for-mmc0-and-mmc1.patch
+# umpf-topic: v2017.06.0/customers/pengutronix/udoo-neo
+# umpf-hashinfo: 1f1ee410d983400c88b875f234709d9b280e2278
+# umpf-topic-range: 4cb671a6a6dacc8f15dc4ecd830dddca7d20bc27..d2e52d64a4ec16ce261bcebbf10503aa37fbf856
+0201-of_device_is_stdout_path-simplify.patch
+0202-of_device_is_stdout_path-split-off-options-and-suppo.patch
+0203-ARM-imx-add-support-for-Udoo-Neo-full.patch
+# umpf-release: 2017.06.0/pengutronix/multi_v7/20170614-1
+# umpf-topic-range: d2e52d64a4ec16ce261bcebbf10503aa37fbf856..715b60b1436d4e880847311415c9a31a7ba7f5b8
+0301-Release-2017.06.0-pengutronix-multi_v7-20170614-1.patch
+# umpf-end