Skip to contentSkip to conversation

mtd, ubi, ubifs: resync with Linux-3.14

RFC PATCH New Heiko Schocher 2 participants 7 messages May 21, 2014 – May 22, 2014

Subsystems (12)
lore
Share & tools
lore
#0 lore raw

cover mtd, ubi, ubifs: resync with Linux-3.14

resync mtd, ubi and ubifs subsystem with linux:

commit 455c6fdbd219161bd09b1165f11699d6d73de11c

Author: Linus Torvalds <[email protected]>
Date:   Sun Mar 30 20:40:15 2014 -0700
    Linux 3.14

Main reason for this sync is, we now have UBI fastmap support in U-Boot.

Tested it on am33xx, imx6 and mpc83xx boards. MAKEALL for arm and powerpc compiles clean.

Tested UBI fastmap on a board with 512 MiB nand flash. Attach time from old U-Boot was 2 seconds, reduced with UBI fastmap to 0.2 seconds.

Please test this patchserie!

The patches

lib, rbtree: resync with Linux-3.14
lib, list_sort: add list_sort from linux 3.14
mtd, ubi, ubifs: resync with Linux-3.14

are not checkpatch clean, as they use code from Linux and I do not want to change this.

Remarks:
- UBI Fastmap is now availiable in U-Boot
activate it with CONFIG_MTD_UBI_FASTMAP

- replace UBI_LINUX in current UBI code from U-Boot with __UBOOT__ as this define is used in other places in U-Boot where code from other projects is used.

- move a lot of defines from include/ubi_uboot.h to include/linux/compat.h, as this is the correcter place for it.

- add usb device to linux device, so usb uses "struct device" from "linux/compat.h"

- onenand changes only compile tested.

- Following Code in drivers/mtd/nand/nand_base.c nand_do_write_ops() adapted for U-Boot:

+#ifndef __UBOOT__

        /* Reject writes, which are not page aligned */
        if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {

+else
+ /* Reject writes, which are not page aligned */
+ if (NOTALIGNED(to)) {
+endif

as the original linux code leads in not working use of the env var "filesize". For example a "nand write 80000000 80000 ${filesize}" would not work with it ...

- add CONFIG_MTD_NAND_VERIFY_WRITE from U-Boot code (only compile tested)

- Documented the config defines in README

- kmalloc now uses memalign for allocating memory. This prevented crashes when tested ubi/ubifs on imx6 board.

- To produce this patch I did three steps:
- copied the linux source files to U-Boot tree -> commit this
- adapt license text in each file -> commit this
- make the code again compile clean and working -> commit this

Then squashed this three patches to this patch, to not break bisectability. To make further sync with linux easier, the above three patches can be found in:

http://git.denx.de/?p=u-boot/u-boot-testing.git;a=shortlog;h=refs/heads/update-mtd%2Bubi-linux-v3.14

- Hope I get all U-Boot specific changes ... so please, test, test, test ...

Heiko Schocher (4):
dm: rename device struct to udevice
lib, rbtree: resync with Linux-3.14
lib, list_sort: add list_sort from linux 3.14
mtd, ubi, ubifs: resync with Linux-3.14

 README                              |   61 +
 arch/sandbox/include/asm/gpio.h     |    8 +-
 board/prodrive/alpr/nand.c          |    4 +
 board/socrates/nand.c               |    6 +
 board/tqc/tqm8272/nand.c            |    4 +
 common/cmd_demo.c                   |    4 +-
 common/cmd_gpio.c                   |    4 +-
 common/cmd_ubi.c                    |   31 +-
 common/cmd_ubifs.c                  |    2 +-
 doc/driver-model/README.txt         |    8 +-
 drivers/core/device.c               |   32 +-
 drivers/core/lists.c                |    8 +-
 drivers/core/root.c                 |    2 +-
 drivers/core/uclass.c               |   31 +-
 drivers/demo/demo-shape.c           |    6 +-
 drivers/demo/demo-simple.c          |    4 +-
 drivers/demo/demo-uclass.c          |    6 +-
 drivers/gpio/gpio-uclass.c          |   28 +-
 drivers/gpio/sandbox.c              |   34 +-
 drivers/mtd/mtdconcat.c             |  230 ++-
 drivers/mtd/mtdcore.c               | 1112 ++++++++++++-
 drivers/mtd/mtdcore.h               |   23 +
 drivers/mtd/mtdpart.c               |  521 +++++-
 drivers/mtd/nand/fsl_elbc_nand.c    |    4 +
 drivers/mtd/nand/fsl_ifc_nand.c     |    4 +
 drivers/mtd/nand/fsl_upm.c          |    4 +
 drivers/mtd/nand/mpc5121_nfc.c      |    4 +
 drivers/mtd/nand/mxc_nand.c         |    8 +
 drivers/mtd/nand/nand_base.c        | 1897 +++++++++++++++------
 drivers/mtd/nand/nand_bbt.c         |  296 ++--
 drivers/mtd/nand/nand_ids.c         |  256 +--
 drivers/mtd/nand/nand_util.c        |    3 +
 drivers/mtd/nand/ndfc.c             |    4 +
 drivers/mtd/onenand/onenand_base.c  |    1 +
 drivers/mtd/onenand/onenand_bbt.c   |    1 -
 drivers/mtd/onenand/samsung.c       |   10 +-
 drivers/mtd/ubi/Makefile            |    3 +-
 drivers/mtd/ubi/attach.c            | 1754 ++++++++++++++++++++
 drivers/mtd/ubi/build.c             |  812 ++++++---
 drivers/mtd/ubi/crc32.c             |   13 +-
 drivers/mtd/ubi/crc32table.h        |    2 +-
 drivers/mtd/ubi/debug.c             |  482 ++++--
 drivers/mtd/ubi/debug.h             |  178 +-
 drivers/mtd/ubi/eba.c               |  474 ++++--
 drivers/mtd/ubi/fastmap.c           | 1584 ++++++++++++++++++
 drivers/mtd/ubi/io.c                |  788 +++++----
 drivers/mtd/ubi/kapi.c              |  276 ++-
 drivers/mtd/ubi/misc.c              |   58 +-
 drivers/mtd/ubi/scan.c              | 1348 ---------------
 drivers/mtd/ubi/scan.h              |  153 --
 drivers/mtd/ubi/ubi-media.h         |  205 ++-
 drivers/mtd/ubi/ubi.h               |  626 +++++--
 drivers/mtd/ubi/upd.c               |  104 +-
 drivers/mtd/ubi/vmt.c               |  283 ++--
 drivers/mtd/ubi/vtbl.c              |  359 ++--
 drivers/mtd/ubi/wl.c                | 1590 +++++++++++-------
 drivers/usb/gadget/ether.c          |    5 -
 drivers/usb/gadget/storage_common.c |    5 -
 drivers/usb/musb-new/linux-compat.h |   58 -
 drivers/video/exynos_dp.c           |    1 +
 drivers/video/exynos_mipi_dsi.c     |    1 +
 fs/ubifs/budget.c                   |  662 +++++++-
 fs/ubifs/debug.c                    | 3132 ++++++++++++++++++++++++++++++++++-
 fs/ubifs/debug.h                    |  578 ++++---
 fs/ubifs/io.c                       |  897 +++++++++-
 fs/ubifs/key.h                      |   68 +-
 fs/ubifs/log.c                      |  663 +++++++-
 fs/ubifs/lprops.c                   |  538 +++++-
 fs/ubifs/lpt.c                      | 1242 +++++++++++++-
 fs/ubifs/lpt_commit.c               | 1903 ++++++++++++++++++++-
 fs/ubifs/master.c                   |  102 +-
 fs/ubifs/misc.h                     |  159 +-
 fs/ubifs/orphan.c                   |  671 +++++++-
 fs/ubifs/recovery.c                 |  738 ++++++---
 fs/ubifs/replay.c                   |  573 ++++---
 fs/ubifs/sb.c                       |  547 +++++-
 fs/ubifs/scan.c                     |  102 +-
 fs/ubifs/super.c                    | 2173 ++++++++++++++++++++----
 fs/ubifs/tnc.c                      |  742 ++++++++-
 fs/ubifs/tnc_misc.c                 |  124 +-
 fs/ubifs/ubifs-media.h              |   62 +-
 fs/ubifs/ubifs.c                    |  115 +-
 fs/ubifs/ubifs.h                    |  708 +++++---
 fs/yaffs2/ydirectenv.h              |    2 -
 include/asm-generic/global_data.h   |    2 +-
 include/asm-generic/gpio.h          |   22 +-
 include/dm-demo.h                   |   10 +-
 include/dm/device-internal.h        |   16 +-
 include/dm/device.h                 |   20 +-
 include/dm/lists.h                  |    4 +-
 include/dm/root.h                   |    4 +-
 include/dm/test.h                   |   12 +-
 include/dm/uclass-internal.h        |   10 +-
 include/dm/uclass.h                 |   18 +-
 include/linux/compat.h              |  327 +++-
 include/linux/err.h                 |   15 +-
 include/linux/list_sort.h           |   11 +
 include/linux/mtd/bbm.h             |   73 +-
 include/linux/mtd/concat.h          |    4 +
 include/linux/mtd/flashchip.h       |  105 ++
 include/linux/mtd/mtd.h             |  272 ++-
 include/linux/mtd/nand.h            |  350 +++-
 include/linux/mtd/partitions.h      |   60 +-
 include/linux/mtd/ubi.h             |  120 +-
 include/linux/rbtree.h              |  147 +-
 include/linux/rbtree_augmented.h    |  220 +++
 include/linux/usb/gadget.h          |    6 +-
 include/mtd/mtd-abi.h               |  195 ++-
 include/mtd/ubi-user.h              |  305 +++-
 include/ubi_uboot.h                 |  164 +-
 include/usb/lin_gadget_compat.h     |   16 -
 lib/Makefile                        |    2 +
 lib/list_sort.c                     |  298 ++++
 lib/rbtree.c                        |  684 +++++---
 test/dm/cmd_dm.c                    |   10 +-
 test/dm/core.c                      |   32 +-
 test/dm/gpio.c                      |    2 +-
 test/dm/test-driver.c               |   20 +-
 test/dm/test-fdt.c                  |   10 +-
 test/dm/test-main.c                 |    2 +-
 test/dm/test-uclass.c               |   15 +-
 121 files changed, 28221 insertions(+), 7686 deletions(-)
 create mode 100644 drivers/mtd/mtdcore.h
 create mode 100644 drivers/mtd/ubi/attach.c
 create mode 100644 drivers/mtd/ubi/fastmap.c
 delete mode 100644 drivers/mtd/ubi/scan.c
 delete mode 100644 drivers/mtd/ubi/scan.h
 create mode 100644 include/linux/list_sort.h
 create mode 100644 include/linux/mtd/flashchip.h
 create mode 100644 include/linux/rbtree_augmented.h
 create mode 100644 lib/list_sort.c
Cc Marek Vasut <[email protected]>
Cc Sergey Lapin <[email protected]>
Cc Scott Wood <[email protected]>
Cc Wolfgang Denk <[email protected]>
Signature · 1 line
1.8.3.1
#1 lore raw

RFC PATCH 1/4 dm: rename device struct to udevice

using UBI and DM together leads in compiler error, as both define a "struct device", so rename "struct device" in include/dm/device.h to "struct udevice", as we use linux code (MTD/UBI/UBIFS some USB code,...) and cannot change the linux "struct device"

Cc Simon Glass <[email protected]>
Cc Marek Vasut <[email protected]>
---
 arch/sandbox/include/asm/gpio.h   |  8 ++++----
 common/cmd_demo.c                 |  4 ++--
 common/cmd_gpio.c                 |  4 ++--
 doc/driver-model/README.txt       |  8 ++++----
 drivers/core/device.c             | 32 ++++++++++++++++----------------
 drivers/core/lists.c              |  8 ++++----
 drivers/core/root.c               |  2 +-
 drivers/core/uclass.c             | 31 ++++++++++++++++---------------
 drivers/demo/demo-shape.c         |  6 +++---
 drivers/demo/demo-simple.c        |  4 ++--
 drivers/demo/demo-uclass.c        |  6 +++---
 drivers/gpio/gpio-uclass.c        | 28 ++++++++++++++--------------
 drivers/gpio/sandbox.c            | 34 +++++++++++++++++-----------------
 include/asm-generic/global_data.h |  2 +-
 include/asm-generic/gpio.h        | 22 +++++++++++-----------
 include/dm-demo.h                 | 10 +++++-----
 include/dm/device-internal.h      | 16 ++++++++--------
 include/dm/device.h               | 20 ++++++++++----------
 include/dm/lists.h                |  4 ++--
 include/dm/root.h                 |  4 ++--
 include/dm/test.h                 | 12 ++++++------
 include/dm/uclass-internal.h      | 10 +++++-----
 include/dm/uclass.h               | 18 +++++++++---------
 test/dm/cmd_dm.c                  | 10 +++++-----
 test/dm/core.c                    | 32 ++++++++++++++++----------------
 test/dm/gpio.c                    |  2 +-
 test/dm/test-driver.c             | 20 ++++++++++----------
 test/dm/test-fdt.c                | 10 +++++-----
 test/dm/test-main.c               |  2 +-
 test/dm/test-uclass.c             | 15 ++++++++-------
 30 files changed, 193 insertions(+), 191 deletions(-)
arch/sandbox/include/asm/gpio.h +4 -4
index 95b59da..8317db1 100644
@@ -29,7 +29,7 @@
  * @param gp	GPIO number
  * @return -1 on error, 0 if GPIO is low, >0 if high
  */
-int sandbox_gpio_get_value(struct device *dev, unsigned int offset);
+int sandbox_gpio_get_value(struct udevice *dev, unsigned int offset);
 
 /**
  * Set the simulated value of a GPIO (used only in sandbox test code)
@@ -38,7 +38,7 @@ int sandbox_gpio_get_value(struct device *dev, unsigned int offset);
  * @param value	value to set (0 for low, non-zero for high)
  * @return -1 on error, 0 if ok
  */
-int sandbox_gpio_set_value(struct device *dev, unsigned int offset, int value);
+int sandbox_gpio_set_value(struct udevice *dev, unsigned int offset, int value);
 
 /**
  * Return the simulated direction of a GPIO (used only in sandbox test code)
@@ -46,7 +46,7 @@ int sandbox_gpio_set_value(struct device *dev, unsigned int offset, int value);
  * @param gp	GPIO number
  * @return -1 on error, 0 if GPIO is input, >0 if output
  */
-int sandbox_gpio_get_direction(struct device *dev, unsigned int offset);
+int sandbox_gpio_get_direction(struct udevice *dev, unsigned int offset);
 
 /**
  * Set the simulated direction of a GPIO (used only in sandbox test code)
@@ -55,7 +55,7 @@ int sandbox_gpio_get_direction(struct device *dev, unsigned int offset);
  * @param output 0 to set as input, 1 to set as output
  * @return -1 on error, 0 if ok
  */
-int sandbox_gpio_set_direction(struct device *dev, unsigned int offset,
+int sandbox_gpio_set_direction(struct udevice *dev, unsigned int offset,
 			       int output);
 
 #endif
common/cmd_demo.c +2 -2
index a3bba7f..652c61c 100644
@@ -11,7 +11,7 @@
 #include <dm-demo.h>
 #include <asm/io.h>
 
-struct device *demo_dev;
+struct udevice *demo_dev;
 
 static int do_demo_hello(cmd_tbl_t *cmdtp, int flag, int argc,
 			 char * const argv[])
@@ -41,7 +41,7 @@ static int do_demo_status(cmd_tbl_t *cmdtp, int flag, int argc,
 
 int do_demo_list(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	struct device *dev;
+	struct udevice *dev;
 	int i, ret;
 
 	puts("Demo uclass entries:\n");
common/cmd_gpio.c +2 -2
index aff0445..4634f91 100644
@@ -30,7 +30,7 @@ static const char * const gpio_function[] = {
 	"unknown",
 };
 
-static void show_gpio(struct device *dev, const char *bank_name, int offset)
+static void show_gpio(struct udevice *dev, const char *bank_name, int offset)
 {
 	struct dm_gpio_ops *ops = gpio_get_ops(dev);
 	char buf[80];
@@ -62,7 +62,7 @@ static void show_gpio(struct device *dev, const char *bank_name, int offset)
 
 static int do_gpio_status(const char *gpio_name)
 {
-	struct device *dev;
+	struct udevice *dev;
 	int newline = 0;
 	int ret;
 
doc/driver-model/README.txt +4 -4
index e0b395a..dcecb9a 100644
@@ -122,7 +122,7 @@ What is going on?
 Let's start at the top. The demo command is in common/cmd_demo.c. It does
 the usual command procesing and then:
 
-	struct device *demo_dev;
+	struct udevice *demo_dev;
 
 	ret = uclass_get_device(UCLASS_DEMO, devnum, &demo_dev);
 
@@ -147,7 +147,7 @@ this particular device may use one or other of them.
 
 The code for demo_hello() is in drivers/demo/demo-uclass.c:
 
-int demo_hello(struct device *dev, int ch)
+int demo_hello(struct udevice *dev, int ch)
 {
 	const struct demo_ops *ops = device_get_ops(dev);
 
@@ -160,7 +160,7 @@ int demo_hello(struct device *dev, int ch)
 As you can see it just calls the relevant driver method. One of these is
 in drivers/demo/demo-simple.c:
 
-static int simple_hello(struct device *dev, int ch)
+static int simple_hello(struct udevice *dev, int ch)
 {
 	const struct dm_demo_pdata *pdata = dev_get_platdata(dev);
 
@@ -321,7 +321,7 @@ instead of struct instance, struct platdata, etc.)
 this concept relates to a class of drivers (or a subsystem). We shouldn't
 use 'class' since it is a C++ reserved word, so U-Boot class (uclass) seems
 better than 'core'.
-- Remove 'struct driver_instance' and just use a single 'struct device'.
+- Remove 'struct driver_instance' and just use a single 'struct udevice'.
 This removes a level of indirection that doesn't seem necessary.
 - Built in device tree support, to avoid the need for platdata
 - Removed the concept of driver relocation, and just make it possible for
drivers/core/device.c +16 -16
index 55ba281..c73c339 100644
@@ -30,9 +30,9 @@
  * @dev:	The device that is to be stripped of its children
  * @return 0 on success, -ve on error
  */
-static int device_chld_unbind(struct device *dev)
+static int device_chld_unbind(struct udevice *dev)
 {
-	struct device *pos, *n;
+	struct udevice *pos, *n;
 	int ret, saved_ret = 0;
 
 	assert(dev);
@@ -51,9 +51,9 @@ static int device_chld_unbind(struct device *dev)
  * @dev:	The device whose children are to be removed
  * @return 0 on success, -ve on error
  */
-static int device_chld_remove(struct device *dev)
+static int device_chld_remove(struct udevice *dev)
 {
-	struct device *pos, *n;
+	struct udevice *pos, *n;
 	int ret;
 
 	assert(dev);
@@ -67,10 +67,10 @@ static int device_chld_remove(struct device *dev)
 	return 0;
 }
 
-int device_bind(struct device *parent, struct driver *drv, const char *name,
-		void *platdata, int of_offset, struct device **devp)
+int device_bind(struct udevice *parent, struct driver *drv, const char *name,
+		void *platdata, int of_offset, struct udevice **devp)
 {
-	struct device *dev;
+	struct udevice *dev;
 	struct uclass *uc;
 	int ret = 0;
 
@@ -82,7 +82,7 @@ int device_bind(struct device *parent, struct driver *drv, const char *name,
 	if (ret)
 		return ret;
 
-	dev = calloc(1, sizeof(struct device));
+	dev = calloc(1, sizeof(struct udevice));
 	if (!dev)
 		return -ENOMEM;
 
@@ -129,8 +129,8 @@ fail_bind:
 	return ret;
 }
 
-int device_bind_by_name(struct device *parent, const struct driver_info *info,
-			struct device **devp)
+int device_bind_by_name(struct udevice *parent, const struct driver_info *info,
+			struct udevice **devp)
 {
 	struct driver *drv;
 
@@ -142,7 +142,7 @@ int device_bind_by_name(struct device *parent, const struct driver_info *info,
 			   -1, devp);
 }
 
-int device_unbind(struct device *dev)
+int device_unbind(struct udevice *dev)
 {
 	struct driver *drv;
 	int ret;
@@ -181,7 +181,7 @@ int device_unbind(struct device *dev)
  * device_free() - Free memory buffers allocated by a device
  * @dev:	Device that is to be started
  */
-static void device_free(struct device *dev)
+static void device_free(struct udevice *dev)
 {
 	int size;
 
@@ -200,7 +200,7 @@ static void device_free(struct device *dev)
 	}
 }
 
-int device_probe(struct device *dev)
+int device_probe(struct udevice *dev)
 {
 	struct driver *drv;
 	int size = 0;
@@ -279,7 +279,7 @@ fail:
 	return ret;
 }
 
-int device_remove(struct device *dev)
+int device_remove(struct udevice *dev)
 {
 	struct driver *drv;
 	int ret;
@@ -327,7 +327,7 @@ err:
 	return ret;
 }
 
-void *dev_get_platdata(struct device *dev)
+void *dev_get_platdata(struct udevice *dev)
 {
 	if (!dev) {
 		dm_warn("%s: null device", __func__);
@@ -337,7 +337,7 @@ void *dev_get_platdata(struct device *dev)
 	return dev->platdata;
 }
 
-void *dev_get_priv(struct device *dev)
+void *dev_get_priv(struct udevice *dev)
 {
 	if (!dev) {
 		dm_warn("%s: null device", __func__);
drivers/core/lists.c +4 -4
index 4f2c126..205b140 100644
@@ -60,13 +60,13 @@ struct uclass_driver *lists_uclass_lookup(enum uclass_id id)
 	return NULL;
 }
 
-int lists_bind_drivers(struct device *parent)
+int lists_bind_drivers(struct udevice *parent)
 {
 	struct driver_info *info =
 		ll_entry_start(struct driver_info, driver_info);
 	const int n_ents = ll_entry_count(struct driver_info, driver_info);
 	struct driver_info *entry;
-	struct device *dev;
+	struct udevice *dev;
 	int result = 0;
 	int ret;
 
@@ -116,12 +116,12 @@ static int driver_check_compatible(const void *blob, int offset,
 	return -ENOENT;
 }
 
-int lists_bind_fdt(struct device *parent, const void *blob, int offset)
+int lists_bind_fdt(struct udevice *parent, const void *blob, int offset)
 {
 	struct driver *driver = ll_entry_start(struct driver, driver);
 	const int n_ents = ll_entry_count(struct driver, driver);
 	struct driver *entry;
-	struct device *dev;
+	struct udevice *dev;
 	const char *name;
 	int result = 0;
 	int ret;
drivers/core/root.c +1 -1
index 407bc0d..4977875 100644
@@ -24,7 +24,7 @@ static const struct driver_info root_info = {
 	.name		= "root_driver",
 };
 
-struct device *dm_root(void)
+struct udevice *dm_root(void)
 {
 	if (!gd->dm_root) {
 		dm_warn("Virtual root driver does not exist!\n");
drivers/core/uclass.c +16 -15
index 4df5a8b..f6867e4 100644
@@ -101,7 +101,7 @@ fail_mem:
 int uclass_destroy(struct uclass *uc)
 {
 	struct uclass_driver *uc_drv;
-	struct device *dev, *tmp;
+	struct udevice *dev, *tmp;
 	int ret;
 
 	list_for_each_entry_safe(dev, tmp, &uc->dev_head, uclass_node) {
@@ -137,10 +137,10 @@ int uclass_get(enum uclass_id id, struct uclass **ucp)
 	return 0;
 }
 
-int uclass_find_device(enum uclass_id id, int index, struct device **devp)
+int uclass_find_device(enum uclass_id id, int index, struct udevice **devp)
 {
 	struct uclass *uc;
-	struct device *dev;
+	struct udevice *dev;
 	int ret;
 
 	*devp = NULL;
@@ -158,9 +158,9 @@ int uclass_find_device(enum uclass_id id, int index, struct device **devp)
 	return -ENODEV;
 }
 
-int uclass_get_device(enum uclass_id id, int index, struct device **devp)
+int uclass_get_device(enum uclass_id id, int index, struct udevice **devp)
 {
-	struct device *dev;
+	struct udevice *dev;
 	int ret;
 
 	*devp = NULL;
@@ -177,10 +177,10 @@ int uclass_get_device(enum uclass_id id, int index, struct device **devp)
 	return 0;
 }
 
-int uclass_first_device(enum uclass_id id, struct device **devp)
+int uclass_first_device(enum uclass_id id, struct udevice **devp)
 {
 	struct uclass *uc;
-	struct device *dev;
+	struct udevice *dev;
 	int ret;
 
 	*devp = NULL;
@@ -190,7 +190,7 @@ int uclass_first_device(enum uclass_id id, struct device **devp)
 	if (list_empty(&uc->dev_head))
 		return 0;
 
-	dev = list_first_entry(&uc->dev_head, struct device, uclass_node);
+	dev = list_first_entry(&uc->dev_head, struct udevice, uclass_node);
 	ret = device_probe(dev);
 	if (ret)
 		return ret;
@@ -199,16 +199,17 @@ int uclass_first_device(enum uclass_id id, struct device **devp)
 	return 0;
 }
 
-int uclass_next_device(struct device **devp)
+int uclass_next_device(struct udevice **devp)
 {
-	struct device *dev = *devp;
+	struct udevice *dev = *devp;
 	int ret;
 
 	*devp = NULL;
 	if (list_is_last(&dev->uclass_node, &dev->uclass->dev_head))
 		return 0;
 
-	dev = list_entry(dev->uclass_node.next, struct device, uclass_node);
+	dev = list_entry(dev->uclass_node.next, struct udevice,
+			 uclass_node);
 	ret = device_probe(dev);
 	if (ret)
 		return ret;
@@ -217,7 +218,7 @@ int uclass_next_device(struct device **devp)
 	return 0;
 }
 
-int uclass_bind_device(struct device *dev)
+int uclass_bind_device(struct udevice *dev)
 {
 	struct uclass *uc;
 	int ret;
@@ -237,7 +238,7 @@ int uclass_bind_device(struct device *dev)
 	return 0;
 }
 
-int uclass_unbind_device(struct device *dev)
+int uclass_unbind_device(struct udevice *dev)
 {
 	struct uclass *uc;
 	int ret;
@@ -253,7 +254,7 @@ int uclass_unbind_device(struct device *dev)
 	return 0;
 }
 
-int uclass_post_probe_device(struct device *dev)
+int uclass_post_probe_device(struct udevice *dev)
 {
 	struct uclass_driver *uc_drv = dev->uclass->uc_drv;
 
@@ -263,7 +264,7 @@ int uclass_post_probe_device(struct device *dev)
 	return 0;
 }
 
-int uclass_pre_remove_device(struct device *dev)
+int uclass_pre_remove_device(struct udevice *dev)
 {
 	struct uclass_driver *uc_drv;
 	struct uclass *uc;
drivers/demo/demo-shape.c +3 -3
index 2f0eb96..a68cc10 100644
@@ -23,7 +23,7 @@ struct shape_data {
 };
 
 /* Crazy little function to draw shapes on the console */
-static int shape_hello(struct device *dev, int ch)
+static int shape_hello(struct udevice *dev, int ch)
 {
 	const struct dm_demo_pdata *pdata = dev_get_platdata(dev);
 	struct shape_data *data = dev_get_priv(dev);
@@ -81,7 +81,7 @@ static int shape_hello(struct device *dev, int ch)
 	return 0;
 }
 
-static int shape_status(struct device *dev, int *status)
+static int shape_status(struct udevice *dev, int *status)
 {
 	struct shape_data *data = dev_get_priv(dev);
 
@@ -94,7 +94,7 @@ static const struct demo_ops shape_ops = {
 	.status = shape_status,
 };
 
-static int shape_ofdata_to_platdata(struct device *dev)
+static int shape_ofdata_to_platdata(struct udevice *dev)
 {
 	struct dm_demo_pdata *pdata = dev_get_platdata(dev);
 	int ret;
drivers/demo/demo-simple.c +2 -2
index 6ba8131..11def86 100644
@@ -12,7 +12,7 @@
 #include <dm-demo.h>
 #include <asm/io.h>
 
-static int simple_hello(struct device *dev, int ch)
+static int simple_hello(struct udevice *dev, int ch)
 {
 	const struct dm_demo_pdata *pdata = dev_get_platdata(dev);
 
@@ -26,7 +26,7 @@ static const struct demo_ops simple_ops = {
 	.hello = simple_hello,
 };
 
-static int demo_shape_ofdata_to_platdata(struct device *dev)
+static int demo_shape_ofdata_to_platdata(struct udevice *dev)
 {
 	/* Parse the data that is common with all demo devices */
 	return demo_parse_dt(dev);
drivers/demo/demo-uclass.c +3 -3
index 48588be..636fd88 100644
@@ -22,7 +22,7 @@ UCLASS_DRIVER(demo) = {
 	.id		= UCLASS_DEMO,
 };
 
-int demo_hello(struct device *dev, int ch)
+int demo_hello(struct udevice *dev, int ch)
 {
 	const struct demo_ops *ops = device_get_ops(dev);
 
@@ -32,7 +32,7 @@ int demo_hello(struct device *dev, int ch)
 	return ops->hello(dev, ch);
 }
 
-int demo_status(struct device *dev, int *status)
+int demo_status(struct udevice *dev, int *status)
 {
 	const struct demo_ops *ops = device_get_ops(dev);
 
@@ -42,7 +42,7 @@ int demo_status(struct device *dev, int *status)
 	return ops->status(dev, status);
 }
 
-int demo_parse_dt(struct device *dev)
+int demo_parse_dt(struct udevice *dev)
 {
 	struct dm_demo_pdata *pdata = dev_get_platdata(dev);
 	int dn = dev->of_offset;
drivers/gpio/gpio-uclass.c +14 -14
index 56bfd11..fa2c2fb 100644
@@ -17,11 +17,11 @@
  * or GPIO blocks registered with the GPIO controller. Returns
  * entry on success, NULL on error.
  */
-static int gpio_to_device(unsigned int gpio, struct device **devp,
+static int gpio_to_device(unsigned int gpio, struct udevice **devp,
 			  unsigned int *offset)
 {
 	struct gpio_dev_priv *uc_priv;
-	struct device *dev;
+	struct udevice *dev;
 	int ret;
 
 	for (ret = uclass_first_device(UCLASS_GPIO, &dev);
@@ -40,11 +40,11 @@ static int gpio_to_device(unsigned int gpio, struct device **devp,
 	return ret ? ret : -EINVAL;
 }
 
-int gpio_lookup_name(const char *name, struct device **devp,
+int gpio_lookup_name(const char *name, struct udevice **devp,
 		     unsigned int *offsetp, unsigned int *gpiop)
 {
 	struct gpio_dev_priv *uc_priv;
-	struct device *dev;
+	struct udevice *dev;
 	int ret;
 
 	if (devp)
@@ -86,7 +86,7 @@ int gpio_lookup_name(const char *name, struct device **devp,
 int gpio_request(unsigned gpio, const char *label)
 {
 	unsigned int offset;
-	struct device *dev;
+	struct udevice *dev;
 	int ret;
 
 	ret = gpio_to_device(gpio, &dev, &offset);
@@ -110,7 +110,7 @@ int gpio_request(unsigned gpio, const char *label)
 int gpio_free(unsigned gpio)
 {
 	unsigned int offset;
-	struct device *dev;
+	struct udevice *dev;
 	int ret;
 
 	ret = gpio_to_device(gpio, &dev, &offset);
@@ -133,7 +133,7 @@ int gpio_free(unsigned gpio)
 int gpio_direction_input(unsigned gpio)
 {
 	unsigned int offset;
-	struct device *dev;
+	struct udevice *dev;
 	int ret;
 
 	ret = gpio_to_device(gpio, &dev, &offset);
@@ -155,7 +155,7 @@ int gpio_direction_input(unsigned gpio)
 int gpio_direction_output(unsigned gpio, int value)
 {
 	unsigned int offset;
-	struct device *dev;
+	struct udevice *dev;
 	int ret;
 
 	ret = gpio_to_device(gpio, &dev, &offset);
@@ -177,7 +177,7 @@ int gpio_direction_output(unsigned gpio, int value)
 int gpio_get_value(unsigned gpio)
 {
 	unsigned int offset;
-	struct device *dev;
+	struct udevice *dev;
 	int ret;
 
 	ret = gpio_to_device(gpio, &dev, &offset);
@@ -199,7 +199,7 @@ int gpio_get_value(unsigned gpio)
 int gpio_set_value(unsigned gpio, int value)
 {
 	unsigned int offset;
-	struct device *dev;
+	struct udevice *dev;
 	int ret;
 
 	ret = gpio_to_device(gpio, &dev, &offset);
@@ -209,7 +209,7 @@ int gpio_set_value(unsigned gpio, int value)
 	return gpio_get_ops(dev)->set_value(dev, offset, value);
 }
 
-const char *gpio_get_bank_info(struct device *dev, int *bit_count)
+const char *gpio_get_bank_info(struct udevice *dev, int *bit_count)
 {
 	struct gpio_dev_priv *priv;
 
@@ -225,7 +225,7 @@ const char *gpio_get_bank_info(struct device *dev, int *bit_count)
 static int gpio_renumber(void)
 {
 	struct gpio_dev_priv *uc_priv;
-	struct device *dev;
+	struct udevice *dev;
 	struct uclass *uc;
 	unsigned base;
 	int ret;
@@ -247,12 +247,12 @@ static int gpio_renumber(void)
 	return 0;
 }
 
-static int gpio_post_probe(struct device *dev)
+static int gpio_post_probe(struct udevice *dev)
 {
 	return gpio_renumber();
 }
 
-static int gpio_pre_remove(struct device *dev)
+static int gpio_pre_remove(struct udevice *dev)
 {
 	return gpio_renumber();
 }
drivers/gpio/sandbox.c +17 -17
index 22b6a5f..09cebe2 100644
@@ -22,7 +22,7 @@ struct gpio_state {
 };
 
 /* Access routines for GPIO state */
-static u8 *get_gpio_flags(struct device *dev, unsigned offset)
+static u8 *get_gpio_flags(struct udevice *dev, unsigned offset)
 {
 	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
 	struct gpio_state *state = dev_get_priv(dev);
@@ -36,12 +36,12 @@ static u8 *get_gpio_flags(struct device *dev, unsigned offset)
 	return &state[offset].flags;
 }
 
-static int get_gpio_flag(struct device *dev, unsigned offset, int flag)
+static int get_gpio_flag(struct udevice *dev, unsigned offset, int flag)
 {
 	return (*get_gpio_flags(dev, offset) & flag) != 0;
 }
 
-static int set_gpio_flag(struct device *dev, unsigned offset, int flag,
+static int set_gpio_flag(struct udevice *dev, unsigned offset, int flag,
 			 int value)
 {
 	u8 *gpio = get_gpio_flags(dev, offset);
@@ -54,7 +54,7 @@ static int set_gpio_flag(struct device *dev, unsigned offset, int flag,
 	return 0;
 }
 
-static int check_reserved(struct device *dev, unsigned offset,
+static int check_reserved(struct udevice *dev, unsigned offset,
 			  const char *func)
 {
 	if (!get_gpio_flag(dev, offset, GPIOF_RESERVED)) {
@@ -70,24 +70,24 @@ static int check_reserved(struct device *dev, unsigned offset,
  * Back-channel sandbox-internal-only access to GPIO state
  */
 
-int sandbox_gpio_get_value(struct device *dev, unsigned offset)
+int sandbox_gpio_get_value(struct udevice *dev, unsigned offset)
 {
 	if (get_gpio_flag(dev, offset, GPIOF_OUTPUT))
 		debug("sandbox_gpio: get_value on output gpio %u\n", offset);
 	return get_gpio_flag(dev, offset, GPIOF_HIGH);
 }
 
-int sandbox_gpio_set_value(struct device *dev, unsigned offset, int value)
+int sandbox_gpio_set_value(struct udevice *dev, unsigned offset, int value)
 {
 	return set_gpio_flag(dev, offset, GPIOF_HIGH, value);
 }
 
-int sandbox_gpio_get_direction(struct device *dev, unsigned offset)
+int sandbox_gpio_get_direction(struct udevice *dev, unsigned offset)
 {
 	return get_gpio_flag(dev, offset, GPIOF_OUTPUT);
 }
 
-int sandbox_gpio_set_direction(struct device *dev, unsigned offset, int output)
+int sandbox_gpio_set_direction(struct udevice *dev, unsigned offset, int output)
 {
 	return set_gpio_flag(dev, offset, GPIOF_OUTPUT, output);
 }
@@ -97,7 +97,7 @@ int sandbox_gpio_set_direction(struct device *dev, unsigned offset, int output)
  */
 
 /* set GPIO port 'offset' as an input */
-static int sb_gpio_direction_input(struct device *dev, unsigned offset)
+static int sb_gpio_direction_input(struct udevice *dev, unsigned offset)
 {
 	debug("%s: offset:%u\n", __func__, offset);
 
@@ -108,7 +108,7 @@ static int sb_gpio_direction_input(struct device *dev, unsigned offset)
 }
 
 /* set GPIO port 'offset' as an output, with polarity 'value' */
-static int sb_gpio_direction_output(struct device *dev, unsigned offset,
+static int sb_gpio_direction_output(struct udevice *dev, unsigned offset,
 				    int value)
 {
 	debug("%s: offset:%u, value = %d\n", __func__, offset, value);
@@ -121,7 +121,7 @@ static int sb_gpio_direction_output(struct device *dev, unsigned offset,
 }
 
 /* read GPIO IN value of port 'offset' */
-static int sb_gpio_get_value(struct device *dev, unsigned offset)
+static int sb_gpio_get_value(struct udevice *dev, unsigned offset)
 {
 	debug("%s: offset:%u\n", __func__, offset);
 
@@ -132,7 +132,7 @@ static int sb_gpio_get_value(struct device *dev, unsigned offset)
 }
 
 /* write GPIO OUT value to port 'offset' */
-static int sb_gpio_set_value(struct device *dev, unsigned offset, int value)
+static int sb_gpio_set_value(struct udevice *dev, unsigned offset, int value)
 {
 	debug("%s: offset:%u, value = %d\n", __func__, offset, value);
 
@@ -148,7 +148,7 @@ static int sb_gpio_set_value(struct device *dev, unsigned offset, int value)
 	return sandbox_gpio_set_value(dev, offset, value);
 }
 
-static int sb_gpio_request(struct device *dev, unsigned offset,
+static int sb_gpio_request(struct udevice *dev, unsigned offset,
 			   const char *label)
 {
 	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
@@ -171,7 +171,7 @@ static int sb_gpio_request(struct device *dev, unsigned offset,
 	return set_gpio_flag(dev, offset, GPIOF_RESERVED, 1);
 }
 
-static int sb_gpio_free(struct device *dev, unsigned offset)
+static int sb_gpio_free(struct udevice *dev, unsigned offset)
 {
 	struct gpio_state *state = dev_get_priv(dev);
 
@@ -184,7 +184,7 @@ static int sb_gpio_free(struct device *dev, unsigned offset)
 	return set_gpio_flag(dev, offset, GPIOF_RESERVED, 0);
 }
 
-static int sb_gpio_get_state(struct device *dev, unsigned int offset,
+static int sb_gpio_get_state(struct udevice *dev, unsigned int offset,
 			     char *buf, int bufsize)
 {
 	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
@@ -213,7 +213,7 @@ static const struct dm_gpio_ops gpio_sandbox_ops = {
 	.get_state		= sb_gpio_get_state,
 };
 
-static int sandbox_gpio_ofdata_to_platdata(struct device *dev)
+static int sandbox_gpio_ofdata_to_platdata(struct udevice *dev)
 {
 	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
 
@@ -225,7 +225,7 @@ static int sandbox_gpio_ofdata_to_platdata(struct device *dev)
 	return 0;
 }
 
-static int gpio_sandbox_probe(struct device *dev)
+static int gpio_sandbox_probe(struct udevice *dev)
 {
 	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
 
include/asm-generic/global_data.h +1 -1
index e98b661..2850ed8 100644
@@ -65,7 +65,7 @@ typedef struct global_data {
 	struct global_data *new_gd;	/* relocated global data */
 
 #ifdef CONFIG_DM
-	struct device	*dm_root;	/* Root instance for Driver Model */
+	struct udevice	*dm_root;/* Root instance for Driver Model */
 	struct list_head uclass_root;	/* Head of core tree */
 #endif
 
include/asm-generic/gpio.h +11 -11
index e325df4..a6e52a0 100644
@@ -86,7 +86,7 @@ enum {
 	GPIOF_UNKNOWN,
 };
 
-struct device;
+struct udevice;
 
 /**
  * struct struct dm_gpio_ops - Driver model GPIO operations
@@ -116,15 +116,15 @@ struct device;
  * all devices. Be careful not to confuse offset with gpio in the parameters.
  */
 struct dm_gpio_ops {
-	int (*request)(struct device *dev, unsigned offset, const char *label);
-	int (*free)(struct device *dev, unsigned offset);
-	int (*direction_input)(struct device *dev, unsigned offset);
-	int (*direction_output)(struct device *dev, unsigned offset,
+	int (*request)(struct udevice *dev, unsigned offset, const char *label);
+	int (*free)(struct udevice *dev, unsigned offset);
+	int (*direction_input)(struct udevice *dev, unsigned offset);
+	int (*direction_output)(struct udevice *dev, unsigned offset,
 				int value);
-	int (*get_value)(struct device *dev, unsigned offset);
-	int (*set_value)(struct device *dev, unsigned offset, int value);
-	int (*get_function)(struct device *dev, unsigned offset);
-	int (*get_state)(struct device *dev, unsigned offset, char *state,
+	int (*get_value)(struct udevice *dev, unsigned offset);
+	int (*set_value)(struct udevice *dev, unsigned offset, int value);
+	int (*get_function)(struct udevice *dev, unsigned offset);
+	int (*get_state)(struct udevice *dev, unsigned offset, char *state,
 			 int maxlen);
 };
 
@@ -166,7 +166,7 @@ struct gpio_dev_priv {
  * @offset_count: Returns number of GPIOs within this bank
  * @return bank name of this device
  */
-const char *gpio_get_bank_info(struct device *dev, int *offset_count);
+const char *gpio_get_bank_info(struct udevice *dev, int *offset_count);
 
 /**
  * gpio_lookup_name - Look up a GPIO name and return its details
@@ -179,7 +179,7 @@ const char *gpio_get_bank_info(struct device *dev, int *offset_count);
  * @offsetp: Returns the offset number within this device
  * @gpiop: Returns the absolute GPIO number, numbered from 0
  */
-int gpio_lookup_name(const char *name, struct device **devp,
+int gpio_lookup_name(const char *name, struct udevice **devp,
 		     unsigned int *offsetp, unsigned int *gpiop);
 
 #endif	/* _ASM_GENERIC_GPIO_H_ */
include/dm-demo.h +5 -5
index 6e38d3c..a24fec6 100644
@@ -23,14 +23,14 @@ struct dm_demo_pdata {
 };
 
 struct demo_ops {
-	int (*hello)(struct device *dev, int ch);
-	int (*status)(struct device *dev, int *status);
+	int (*hello)(struct udevice *dev, int ch);
+	int (*status)(struct udevice *dev, int *status);
 };
 
-int demo_hello(struct device *dev, int ch);
-int demo_status(struct device *dev, int *status);
+int demo_hello(struct udevice *dev, int ch);
+int demo_status(struct udevice *dev, int *status);
 int demo_list(void);
 
-int demo_parse_dt(struct device *dev);
+int demo_parse_dt(struct udevice *dev);
 
 #endif
include/dm/device-internal.h +8 -8
index c026e8e..ea3df36 100644
@@ -11,7 +11,7 @@
 #ifndef _DM_DEVICE_INTERNAL_H
 #define _DM_DEVICE_INTERNAL_H
 
-struct device;
+struct udevice;
 
 /**
  * device_bind() - Create a device and bind it to a driver
@@ -34,9 +34,9 @@ struct device;
  * @devp: Returns a pointer to the bound device
  * @return 0 if OK, -ve on error
  */
-int device_bind(struct device *parent, struct driver *drv,
+int device_bind(struct udevice *parent, struct driver *drv,
 		const char *name, void *platdata, int of_offset,
-		struct device **devp);
+		struct udevice **devp);
 
 /**
  * device_bind_by_name: Create a device and bind it to a driver
@@ -49,8 +49,8 @@ int device_bind(struct device *parent, struct driver *drv,
  * @devp: Returns a pointer to the bound device
  * @return 0 if OK, -ve on error
  */
-int device_bind_by_name(struct device *parent, const struct driver_info *info,
-			struct device **devp);
+int device_bind_by_name(struct udevice *parent, const struct driver_info *info,
+			struct udevice **devp);
 
 /**
  * device_probe() - Probe a device, activating it
@@ -61,7 +61,7 @@ int device_bind_by_name(struct device *parent, const struct driver_info *info,
  * @dev: Pointer to device to probe
  * @return 0 if OK, -ve on error
  */
-int device_probe(struct device *dev);
+int device_probe(struct udevice *dev);
 
 /**
  * device_remove() - Remove a device, de-activating it
@@ -72,7 +72,7 @@ int device_probe(struct device *dev);
  * @dev: Pointer to device to remove
  * @return 0 if OK, -ve on error (an error here is normally a very bad thing)
  */
-int device_remove(struct device *dev);
+int device_remove(struct udevice *dev);
 
 /**
  * device_unbind() - Unbind a device, destroying it
@@ -82,6 +82,6 @@ int device_remove(struct device *dev);
  * @dev: Pointer to device to unbind
  * @return 0 if OK, -ve on error
  */
-int device_unbind(struct device *dev);
+int device_unbind(struct udevice *dev);
 
 #endif
include/dm/device.h +10 -10
index 4cd38ed..ec04982 100644
@@ -24,7 +24,7 @@ struct driver_info;
 #define DM_FLAG_ALLOC_PDATA	(2 << 0)
 
 /**
- * struct device - An instance of a driver
+ * struct udevice - An instance of a driver
  *
  * This holds information about a device, which is a driver bound to a
  * particular port or peripheral (essentially a driver instance).
@@ -53,12 +53,12 @@ struct driver_info;
  * @sibling_node: Next device in list of all devices
  * @flags: Flags for this device DM_FLAG_...
  */
-struct device {
+struct udevice {
 	struct driver *driver;
 	const char *name;
 	void *platdata;
 	int of_offset;
-	struct device *parent;
+	struct udevice *parent;
 	void *priv;
 	struct uclass *uclass;
 	void *uclass_priv;
@@ -122,11 +122,11 @@ struct driver {
 	char *name;
 	enum uclass_id id;
 	const struct device_id *of_match;
-	int (*bind)(struct device *dev);
-	int (*probe)(struct device *dev);
-	int (*remove)(struct device *dev);
-	int (*unbind)(struct device *dev);
-	int (*ofdata_to_platdata)(struct device *dev);
+	int (*bind)(struct udevice *dev);
+	int (*probe)(struct udevice *dev);
+	int (*remove)(struct udevice *dev);
+	int (*unbind)(struct udevice *dev);
+	int (*ofdata_to_platdata)(struct udevice *dev);
 	int priv_auto_alloc_size;
 	int platdata_auto_alloc_size;
 	const void *ops;	/* driver-specific operations */
@@ -144,7 +144,7 @@ struct driver {
  * @dev		Device to check
  * @return platform data, or NULL if none
  */
-void *dev_get_platdata(struct device *dev);
+void *dev_get_platdata(struct udevice *dev);
 
 /**
  * dev_get_priv() - Get the private data for a device
@@ -154,6 +154,6 @@ void *dev_get_platdata(struct device *dev);
  * @dev		Device to check
  * @return private data, or NULL if none
  */
-void *dev_get_priv(struct device *dev);
+void *dev_get_priv(struct udevice *dev);
 
 #endif
include/dm/lists.h +2 -2
index 0d09f9a..7feba4b 100644
@@ -32,8 +32,8 @@ struct driver *lists_driver_lookup_name(const char *name);
  */
 struct uclass_driver *lists_uclass_lookup(enum uclass_id id);
 
-int lists_bind_drivers(struct device *parent);
+int lists_bind_drivers(struct udevice *parent);
 
-int lists_bind_fdt(struct device *parent, const void *blob, int offset);
+int lists_bind_fdt(struct udevice *parent, const void *blob, int offset);
 
 #endif
include/dm/root.h +2 -2
index 0ebccda..3018bc8 100644
@@ -10,7 +10,7 @@
 #ifndef _DM_ROOT_H_
 #define _DM_ROOT_H_
 
-struct device;
+struct udevice;
 
 /**
  * dm_root() - Return pointer to the top of the driver tree
@@ -19,7 +19,7 @@ struct device;
  *
  * @return pointer to root device, or NULL if not inited yet
  */
-struct device *dm_root(void);
+struct udevice *dm_root(void);
 
 /**
  * dm_scan_platdata() - Scan all platform data and bind drivers
include/dm/test.h +6 -6
index eeaa2eb..409f1a3 100644
@@ -30,7 +30,7 @@ struct dm_test_pdata {
  *	@return 0 if OK, -ve on error
  */
 struct test_ops {
-	int (*ping)(struct device *dev, int pingval, int *pingret);
+	int (*ping)(struct udevice *dev, int pingval, int *pingret);
 };
 
 /* Operations that our test driver supports */
@@ -102,8 +102,8 @@ extern struct dm_test_state global_test_state;
  * @skip_post_probe: Skip uclass post-probe processing
  */
 struct dm_test_state {
-	struct device *root;
-	struct device *testdev;
+	struct udevice *root;
+	struct udevice *testdev;
 	int fail_count;
 	int force_fail_alloc;
 	int skip_post_probe;
@@ -138,8 +138,8 @@ struct dm_test {
 	}
 
 /* Declare ping methods for the drivers */
-int test_ping(struct device *dev, int pingval, int *pingret);
-int testfdt_ping(struct device *dev, int pingval, int *pingret);
+int test_ping(struct udevice *dev, int pingval, int *pingret);
+int testfdt_ping(struct udevice *dev, int pingval, int *pingret);
 
 /**
  * dm_check_operations() - Check that we can perform ping operations
@@ -152,7 +152,7 @@ int testfdt_ping(struct device *dev, int pingval, int *pingret);
  * @priv: Pointer to private test information
  * @return 0 if OK, -ve on error
  */
-int dm_check_operations(struct dm_test_state *dms, struct device *dev,
+int dm_check_operations(struct dm_test_state *dms, struct udevice *dev,
 			uint32_t base, struct dm_test_priv *priv);
 
 /**
include/dm/uclass-internal.h +5 -5
index cc65d52..1434db3 100644
@@ -21,7 +21,7 @@
  * @return the uclass pointer of a child@the given index or
  * return NULL on error.
  */
-int uclass_find_device(enum uclass_id id, int index, struct device **devp);
+int uclass_find_device(enum uclass_id id, int index, struct udevice **devp);
 
 /**
  * uclass_bind_device() - Associate device with a uclass
@@ -31,7 +31,7 @@ int uclass_find_device(enum uclass_id id, int index, struct device **devp);
  * @dev:	Pointer to the device
  * #return 0 on success, -ve on error
  */
-int uclass_bind_device(struct device *dev);
+int uclass_bind_device(struct udevice *dev);
 
 /**
  * uclass_unbind_device() - Deassociate device with a uclass
@@ -41,7 +41,7 @@ int uclass_bind_device(struct device *dev);
  * @dev:	Pointer to the device
  * #return 0 on success, -ve on error
  */
-int uclass_unbind_device(struct device *dev);
+int uclass_unbind_device(struct udevice *dev);
 
 /**
  * uclass_post_probe_device() - Deal with a device that has just been probed
@@ -52,7 +52,7 @@ int uclass_unbind_device(struct device *dev);
  * @dev:	Pointer to the device
  * #return 0 on success, -ve on error
  */
-int uclass_post_probe_device(struct device *dev);
+int uclass_post_probe_device(struct udevice *dev);
 
 /**
  * uclass_pre_remove_device() - Handle a device which is about to be removed
@@ -62,7 +62,7 @@ int uclass_post_probe_device(struct device *dev);
  * @dev:	Pointer to the device
  * #return 0 on success, -ve on error
  */
-int uclass_pre_remove_device(struct device *dev);
+int uclass_pre_remove_device(struct udevice *dev);
 
 /**
  * uclass_find() - Find uclass by its id
include/dm/uclass.h +9 -9
index cd23cfe..931d9c0 100644
@@ -37,7 +37,7 @@ struct uclass {
 	struct list_head sibling_node;
 };
 
-struct device;
+struct udevice;
 
 /**
  * struct uclass_driver - Driver for the uclass
@@ -65,10 +65,10 @@ struct device;
 struct uclass_driver {
 	const char *name;
 	enum uclass_id id;
-	int (*post_bind)(struct device *dev);
-	int (*pre_unbind)(struct device *dev);
-	int (*post_probe)(struct device *dev);
-	int (*pre_remove)(struct device *dev);
+	int (*post_bind)(struct udevice *dev);
+	int (*pre_unbind)(struct udevice *dev);
+	int (*post_probe)(struct udevice *dev);
+	int (*pre_remove)(struct udevice *dev);
 	int (*init)(struct uclass *class);
 	int (*destroy)(struct uclass *class);
 	int priv_auto_alloc_size;
@@ -101,7 +101,7 @@ int uclass_get(enum uclass_id key, struct uclass **ucp);
  * @ucp: Returns pointer to uclass (there is only one per for each ID)
  * @return 0 if OK, -ve on error
  */
-int uclass_get_device(enum uclass_id id, int index, struct device **ucp);
+int uclass_get_device(enum uclass_id id, int index, struct udevice **ucp);
 
 /**
  * uclass_first_device() - Get the first device in a uclass
@@ -110,7 +110,7 @@ int uclass_get_device(enum uclass_id id, int index, struct device **ucp);
  * @devp: Returns pointer to the first device in that uclass, or NULL if none
  * @return 0 if OK (found or not found), -1 on error
  */
-int uclass_first_device(enum uclass_id id, struct device **devp);
+int uclass_first_device(enum uclass_id id, struct udevice **devp);
 
 /**
  * uclass_next_device() - Get the next device in a uclass
@@ -119,7 +119,7 @@ int uclass_first_device(enum uclass_id id, struct device **devp);
  * to the next device in the same uclass, or NULL if none
  * @return 0 if OK (found or not found), -1 on error
  */
-int uclass_next_device(struct device **devp);
+int uclass_next_device(struct udevice **devp);
 
 /**
  * uclass_foreach_dev() - Helper function to iteration through devices
@@ -127,7 +127,7 @@ int uclass_next_device(struct device **devp);
  * This creates a for() loop which works through the available devices in
  * a uclass in order from start to end.
  *
- * @pos: struct device * to hold the current device. Set to NULL when there
+ * @pos: struct udevice * to hold the current device. Set to NULL when there
  * are no more devices.
  * uc: uclass to scan
  */
test/dm/cmd_dm.c +5 -5
index a03fe20..083f15c 100644
@@ -16,12 +16,12 @@
 #include <dm/test.h>
 #include <dm/uclass-internal.h>
 
-static int display_succ(struct device *in, char *buf)
+static int display_succ(struct udevice *in, char *buf)
 {
 	int len;
 	int ip = 0;
 	char local[16];
-	struct device *pos, *n, *prev = NULL;
+	struct udevice *pos, *n, *prev = NULL;
 
 	printf("%s- %s @ %08x", buf, in->name, map_to_sysmem(in));
 	if (in->flags & DM_FLAG_ACTIVATED)
@@ -49,7 +49,7 @@ static int display_succ(struct device *in, char *buf)
 	return 0;
 }
 
-static int dm_dump(struct device *dev)
+static int dm_dump(struct udevice *dev)
 {
 	if (!dev)
 		return -EINVAL;
@@ -59,7 +59,7 @@ static int dm_dump(struct device *dev)
 static int do_dm_dump_all(cmd_tbl_t *cmdtp, int flag, int argc,
 			  char * const argv[])
 {
-	struct device *root;
+	struct udevice *root;
 
 	root = dm_root();
 	printf("ROOT %08x\n", map_to_sysmem(root));
@@ -74,7 +74,7 @@ static int do_dm_dump_uclass(cmd_tbl_t *cmdtp, int flag, int argc,
 	int id;
 
 	for (id = 0; id < UCLASS_COUNT; id++) {
-		struct device *dev;
+		struct udevice *dev;
 
 		ret = uclass_get(id, &uc);
 		if (ret)
test/dm/core.c +16 -16
index 14a57c3..be3646b 100644
@@ -60,7 +60,7 @@ static struct driver_info driver_info_manual = {
 /* Test that binding with platdata occurs correctly */
 static int dm_test_autobind(struct dm_test_state *dms)
 {
-	struct device *dev;
+	struct udevice *dev;
 
 	/*
 	 * We should have a single class (UCLASS_ROOT) and a single root
@@ -95,7 +95,7 @@ DM_TEST(dm_test_autobind, 0);
 static int dm_test_autoprobe(struct dm_test_state *dms)
 {
 	int expected_base_add;
-	struct device *dev;
+	struct udevice *dev;
 	struct uclass *uc;
 	int i;
 
@@ -157,7 +157,7 @@ DM_TEST(dm_test_autoprobe, DM_TESTF_SCAN_PDATA);
 static int dm_test_platdata(struct dm_test_state *dms)
 {
 	const struct dm_test_pdata *pdata;
-	struct device *dev;
+	struct udevice *dev;
 	int i;
 
 	for (i = 0; i < 3; i++) {
@@ -175,7 +175,7 @@ DM_TEST(dm_test_platdata, DM_TESTF_SCAN_PDATA);
 static int dm_test_lifecycle(struct dm_test_state *dms)
 {
 	int op_count[DM_TEST_OP_COUNT];
-	struct device *dev, *test_dev;
+	struct udevice *dev, *test_dev;
 	int pingret;
 	int ret;
 
@@ -229,7 +229,7 @@ DM_TEST(dm_test_lifecycle, DM_TESTF_SCAN_PDATA | DM_TESTF_PROBE_TEST);
 /* Test that we can bind/unbind and the lists update correctly */
 static int dm_test_ordering(struct dm_test_state *dms)
 {
-	struct device *dev, *dev_penultimate, *dev_last, *test_dev;
+	struct udevice *dev, *dev_penultimate, *dev_last, *test_dev;
 	int pingret;
 
 	ut_assertok(device_bind_by_name(dms->root, &driver_info_manual,
@@ -281,7 +281,7 @@ static int dm_test_ordering(struct dm_test_state *dms)
 DM_TEST(dm_test_ordering, DM_TESTF_SCAN_PDATA);
 
 /* Check that we can perform operations on a device (do a ping) */
-int dm_check_operations(struct dm_test_state *dms, struct device *dev,
+int dm_check_operations(struct dm_test_state *dms, struct udevice *dev,
 			uint32_t base, struct dm_test_priv *priv)
 {
 	int expected;
@@ -311,7 +311,7 @@ int dm_check_operations(struct dm_test_state *dms, struct device *dev,
 /* Check that we can perform operations on devices */
 static int dm_test_operations(struct dm_test_state *dms)
 {
-	struct device *dev;
+	struct udevice *dev;
 	int i;
 
 	/*
@@ -341,7 +341,7 @@ DM_TEST(dm_test_operations, DM_TESTF_SCAN_PDATA);
 /* Remove all drivers and check that things work */
 static int dm_test_remove(struct dm_test_state *dms)
 {
-	struct device *dev;
+	struct udevice *dev;
 	int i;
 
 	for (i = 0; i < 3; i++) {
@@ -367,7 +367,7 @@ static int dm_test_leak(struct dm_test_state *dms)
 
 	for (i = 0; i < 2; i++) {
 		struct mallinfo start, end;
-		struct device *dev;
+		struct udevice *dev;
 		int ret;
 		int id;
 
@@ -435,10 +435,10 @@ DM_TEST(dm_test_uclass, 0);
  *		this array.
  * @return 0 if OK, -ve on error
  */
-static int create_children(struct dm_test_state *dms, struct device *parent,
-			   int count, int key, struct device *child[])
+static int create_children(struct dm_test_state *dms, struct udevice *parent,
+			   int count, int key, struct udevice *child[])
 {
-	struct device *dev;
+	struct udevice *dev;
 	int i;
 
 	for (i = 0; i < count; i++) {
@@ -460,10 +460,10 @@ static int create_children(struct dm_test_state *dms, struct device *parent,
 
 static int dm_test_children(struct dm_test_state *dms)
 {
-	struct device *top[NODE_COUNT];
-	struct device *child[NODE_COUNT];
-	struct device *grandchild[NODE_COUNT];
-	struct device *dev;
+	struct udevice *top[NODE_COUNT];
+	struct udevice *child[NODE_COUNT];
+	struct udevice *grandchild[NODE_COUNT];
+	struct udevice *dev;
 	int total;
 	int ret;
 	int i;
test/dm/gpio.c +1 -1
index bf632bc..2b2b0b5 100644
@@ -17,7 +17,7 @@ static int dm_test_gpio(struct dm_test_state *dms)
 {
 	unsigned int offset, gpio;
 	struct dm_gpio_ops *ops;
-	struct device *dev;
+	struct udevice *dev;
 	const char *name;
 	int offset_count;
 	char buf[80];
test/dm/test-driver.c +10 -10
index c4be8a1..0f1a37b 100644
@@ -18,7 +18,7 @@
 int dm_testdrv_op_count[DM_TEST_OP_COUNT];
 static struct dm_test_state *dms = &global_test_state;
 
-static int testdrv_ping(struct device *dev, int pingval, int *pingret)
+static int testdrv_ping(struct udevice *dev, int pingval, int *pingret)
 {
 	const struct dm_test_pdata *pdata = dev_get_platdata(dev);
 	struct dm_test_priv *priv = dev_get_priv(dev);
@@ -33,7 +33,7 @@ static const struct test_ops test_ops = {
 	.ping = testdrv_ping,
 };
 
-static int test_bind(struct device *dev)
+static int test_bind(struct udevice *dev)
 {
 	/* Private data should not be allocated */
 	ut_assert(!dev_get_priv(dev));
@@ -42,7 +42,7 @@ static int test_bind(struct device *dev)
 	return 0;
 }
 
-static int test_probe(struct device *dev)
+static int test_probe(struct udevice *dev)
 {
 	struct dm_test_priv *priv = dev_get_priv(dev);
 
@@ -54,7 +54,7 @@ static int test_probe(struct device *dev)
 	return 0;
 }
 
-static int test_remove(struct device *dev)
+static int test_remove(struct udevice *dev)
 {
 	/* Private data should still be allocated */
 	ut_assert(dev_get_priv(dev));
@@ -63,7 +63,7 @@ static int test_remove(struct device *dev)
 	return 0;
 }
 
-static int test_unbind(struct device *dev)
+static int test_unbind(struct udevice *dev)
 {
 	/* Private data should not be allocated */
 	ut_assert(!dev->priv);
@@ -94,7 +94,7 @@ U_BOOT_DRIVER(test2_drv) = {
 	.priv_auto_alloc_size = sizeof(struct dm_test_priv),
 };
 
-static int test_manual_drv_ping(struct device *dev, int pingval, int *pingret)
+static int test_manual_drv_ping(struct udevice *dev, int pingval, int *pingret)
 {
 	*pingret = pingval + 2;
 
@@ -105,14 +105,14 @@ static const struct test_ops test_manual_ops = {
 	.ping = test_manual_drv_ping,
 };
 
-static int test_manual_bind(struct device *dev)
+static int test_manual_bind(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_BIND]++;
 
 	return 0;
 }
 
-static int test_manual_probe(struct device *dev)
+static int test_manual_probe(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_PROBE]++;
 	if (!dms->force_fail_alloc)
@@ -123,13 +123,13 @@ static int test_manual_probe(struct device *dev)
 	return 0;
 }
 
-static int test_manual_remove(struct device *dev)
+static int test_manual_remove(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_REMOVE]++;
 	return 0;
 }
 
-static int test_manual_unbind(struct device *dev)
+static int test_manual_unbind(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_UNBIND]++;
 	return 0;
test/dm/test-fdt.c +5 -5
index e1d982f..6eccf11 100644
@@ -18,7 +18,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static int testfdt_drv_ping(struct device *dev, int pingval, int *pingret)
+static int testfdt_drv_ping(struct udevice *dev, int pingval, int *pingret)
 {
 	const struct dm_test_pdata *pdata = dev->platdata;
 	struct dm_test_priv *priv = dev_get_priv(dev);
@@ -33,7 +33,7 @@ static const struct test_ops test_ops = {
 	.ping = testfdt_drv_ping,
 };
 
-static int testfdt_ofdata_to_platdata(struct device *dev)
+static int testfdt_ofdata_to_platdata(struct udevice *dev)
 {
 	struct dm_test_pdata *pdata = dev_get_platdata(dev);
 
@@ -44,7 +44,7 @@ static int testfdt_ofdata_to_platdata(struct device *dev)
 	return 0;
 }
 
-static int testfdt_drv_probe(struct device *dev)
+static int testfdt_drv_probe(struct udevice *dev)
 {
 	struct dm_test_priv *priv = dev_get_priv(dev);
 
@@ -75,7 +75,7 @@ U_BOOT_DRIVER(testfdt_drv) = {
 };
 
 /* From here is the testfdt uclass code */
-int testfdt_ping(struct device *dev, int pingval, int *pingret)
+int testfdt_ping(struct udevice *dev, int pingval, int *pingret)
 {
 	const struct test_ops *ops = device_get_ops(dev);
 
@@ -94,7 +94,7 @@ UCLASS_DRIVER(testfdt) = {
 static int dm_test_fdt(struct dm_test_state *dms)
 {
 	const int num_drivers = 3;
-	struct device *dev;
+	struct udevice *dev;
 	struct uclass *uc;
 	int ret;
 	int i;
test/dm/test-main.c +1 -1
index 828ed46..fbdae68 100644
@@ -32,7 +32,7 @@ static int dm_test_init(struct dm_test_state *dms)
 /* Ensure all the test devices are probed */
 static int do_autoprobe(struct dm_test_state *dms)
 {
-	struct device *dev;
+	struct udevice *dev;
 	int ret;
 
 	/* Scanning the uclass is enough to probe all the devices */
test/dm/test-uclass.c +8 -7
index 8b564b8..017e097 100644
@@ -18,7 +18,7 @@
 
 static struct dm_test_state *dms = &global_test_state;
 
-int test_ping(struct device *dev, int pingval, int *pingret)
+int test_ping(struct udevice *dev, int pingval, int *pingret)
 {
 	const struct test_ops *ops = device_get_ops(dev);
 
@@ -28,24 +28,25 @@ int test_ping(struct device *dev, int pingval, int *pingret)
 	return ops->ping(dev, pingval, pingret);
 }
 
-static int test_post_bind(struct device *dev)
+static int test_post_bind(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_POST_BIND]++;
 
 	return 0;
 }
 
-static int test_pre_unbind(struct device *dev)
+static int test_pre_unbind(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_PRE_UNBIND]++;
 
 	return 0;
 }
 
-static int test_post_probe(struct device *dev)
+static int test_post_probe(struct udevice *dev)
 {
-	struct device *prev = list_entry(dev->uclass_node.prev, struct device,
-					 uclass_node);
+	struct udevice *prev = list_entry(dev->uclass_node.prev,
+					    struct udevice, uclass_node);
+
 	struct dm_test_uclass_perdev_priv *priv = dev->uclass_priv;
 	struct uclass *uc = dev->uclass;
 
@@ -68,7 +69,7 @@ static int test_post_probe(struct device *dev)
 	return 0;
 }
 
-static int test_pre_remove(struct device *dev)
+static int test_pre_remove(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_PRE_REMOVE]++;
 
Signature · 1 line
1.8.3.1
#2 lore raw

RFC PATCH 2/4 lib, rbtree: resync with Linux-3.14

In reply to Heiko Schocher

resync with linux:

commit 455c6fdbd219161bd09b1165f11699d6d73de11c

Author: Linus Torvalds <[email protected]>
Date:   Sun Mar 30 20:40:15 2014 -0700
    Linux 3.14

Needed for the MTD/UBI/UBIFS resync

Cc Marek Vasut <[email protected]>
Cc Sergey Lapin <[email protected]>
Cc Scott Wood <[email protected]>
---
 include/linux/rbtree.h           | 147 +++------
 include/linux/rbtree_augmented.h | 220 +++++++++++++
 lib/rbtree.c                     | 684 ++++++++++++++++++++++++---------------
 3 files changed, 698 insertions(+), 353 deletions(-)
 create mode 100644 include/linux/rbtree_augmented.h
include/linux/rbtree.h +49 -98
index ad892d1..b5994e3 100644
@@ -1,7 +1,7 @@
 /*
   Red Black Trees
   (C) 1999  Andrea Arcangeli <[email protected]>
-
+  
  * SPDX-License-Identifier:	GPL-2.0+
 
   linux/include/linux/rbtree.h
@@ -11,138 +11,89 @@
   I know it's not the cleaner way,  but in C (not in C++) to get
   performances and genericity...
 
-  Some example of insert and search follows here. The search is a plain
-  normal search over an ordered tree. The insert instead must be implemented
-  int two steps: as first thing the code must insert the element in
-  order as a red leaf in the tree, then the support library function
-  rb_insert_color() must be called. Such function will do the
-  not trivial work to rebalance the rbtree if necessary.
-
------------------------------------------------------------------------
-static inline struct page * rb_search_page_cache(struct inode * inode,
-						 unsigned long offset)
-{
-	struct rb_node * n = inode->i_rb_page_cache.rb_node;
-	struct page * page;
-
-	while (n)
-	{
-		page = rb_entry(n, struct page, rb_page_cache);
-
-		if (offset < page->offset)
-			n = n->rb_left;
-		else if (offset > page->offset)
-			n = n->rb_right;
-		else
-			return page;
-	}
-	return NULL;
-}
-
-static inline struct page * __rb_insert_page_cache(struct inode * inode,
-						   unsigned long offset,
-						   struct rb_node * node)
-{
-	struct rb_node ** p = &inode->i_rb_page_cache.rb_node;
-	struct rb_node * parent = NULL;
-	struct page * page;
-
-	while (*p)
-	{
-		parent = *p;
-		page = rb_entry(parent, struct page, rb_page_cache);
-
-		if (offset < page->offset)
-			p = &(*p)->rb_left;
-		else if (offset > page->offset)
-			p = &(*p)->rb_right;
-		else
-			return page;
-	}
-
-	rb_link_node(node, parent, p);
-
-	return NULL;
-}
-
-static inline struct page * rb_insert_page_cache(struct inode * inode,
-						 unsigned long offset,
-						 struct rb_node * node)
-{
-	struct page * ret;
-	if ((ret = __rb_insert_page_cache(inode, offset, node)))
-		goto out;
-	rb_insert_color(node, &inode->i_rb_page_cache);
- out:
-	return ret;
-}
------------------------------------------------------------------------
+  See Documentation/rbtree.txt for documentation and samples.
 */
 
 #ifndef	_LINUX_RBTREE_H
 #define	_LINUX_RBTREE_H
 
+#define __UBOOT__
+#ifndef __UBOOT__
+#include <linux/kernel.h>
+#endif
 #include <linux/stddef.h>
 
-struct rb_node
-{
-	unsigned long  rb_parent_color;
-#define	RB_RED		0
-#define	RB_BLACK	1
+struct rb_node {
+	unsigned long  __rb_parent_color;
 	struct rb_node *rb_right;
 	struct rb_node *rb_left;
 } __attribute__((aligned(sizeof(long))));
     /* The alignment might seem pointless, but allegedly CRIS needs it */
 
-struct rb_root
-{
+struct rb_root {
 	struct rb_node *rb_node;
 };
 
 
-#define rb_parent(r)   ((struct rb_node *)((r)->rb_parent_color & ~3))
-#define rb_color(r)   ((r)->rb_parent_color & 1)
-#define rb_is_red(r)   (!rb_color(r))
-#define rb_is_black(r) rb_color(r)
-#define rb_set_red(r)  do { (r)->rb_parent_color &= ~1; } while (0)
-#define rb_set_black(r)  do { (r)->rb_parent_color |= 1; } while (0)
-
-static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
-{
-	rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p;
-}
-static inline void rb_set_color(struct rb_node *rb, int color)
-{
-	rb->rb_parent_color = (rb->rb_parent_color & ~1) | color;
-}
+#define rb_parent(r)   ((struct rb_node *)((r)->__rb_parent_color & ~3))
 
 #define RB_ROOT	(struct rb_root) { NULL, }
 #define	rb_entry(ptr, type, member) container_of(ptr, type, member)
 
-#define RB_EMPTY_ROOT(root)	((root)->rb_node == NULL)
-#define RB_EMPTY_NODE(node)	(rb_parent(node) == node)
-#define RB_CLEAR_NODE(node)	(rb_set_parent(node, node))
+#define RB_EMPTY_ROOT(root)  ((root)->rb_node == NULL)
+
+/* 'empty' nodes are nodes that are known not to be inserted in an rbree */
+#define RB_EMPTY_NODE(node)  \
+	((node)->__rb_parent_color == (unsigned long)(node))
+#define RB_CLEAR_NODE(node)  \
+	((node)->__rb_parent_color = (unsigned long)(node))
+
 
 extern void rb_insert_color(struct rb_node *, struct rb_root *);
 extern void rb_erase(struct rb_node *, struct rb_root *);
 
+
 /* Find logical next and previous nodes in a tree */
-extern struct rb_node *rb_next(struct rb_node *);
-extern struct rb_node *rb_prev(struct rb_node *);
-extern struct rb_node *rb_first(struct rb_root *);
-extern struct rb_node *rb_last(struct rb_root *);
+extern struct rb_node *rb_next(const struct rb_node *);
+extern struct rb_node *rb_prev(const struct rb_node *);
+extern struct rb_node *rb_first(const struct rb_root *);
+extern struct rb_node *rb_last(const struct rb_root *);
+
+/* Postorder iteration - always visit the parent after its children */
+extern struct rb_node *rb_first_postorder(const struct rb_root *);
+extern struct rb_node *rb_next_postorder(const struct rb_node *);
 
 /* Fast replacement of a single node without remove/rebalance/add/rebalance */
-extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
+extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, 
 			    struct rb_root *root);
 
 static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
 				struct rb_node ** rb_link)
 {
-	node->rb_parent_color = (unsigned long )parent;
+	node->__rb_parent_color = (unsigned long)parent;
 	node->rb_left = node->rb_right = NULL;
 
 	*rb_link = node;
 }
 
+#define rb_entry_safe(ptr, type, member) \
+	({ typeof(ptr) ____ptr = (ptr); \
+	   ____ptr ? rb_entry(____ptr, type, member) : NULL; \
+	})
+
+/**
+ * rbtree_postorder_for_each_entry_safe - iterate over rb_root in post order of
+ * given type safe against removal of rb_node entry
+ *
+ * @pos:	the 'type *' to use as a loop cursor.
+ * @n:		another 'type *' to use as temporary storage
+ * @root:	'rb_root *' of the rbtree.
+ * @field:	the name of the rb_node field within 'type'.
+ */
+#define rbtree_postorder_for_each_entry_safe(pos, n, root, field) \
+	for (pos = rb_entry_safe(rb_first_postorder(root), typeof(*pos), field); \
+	     pos && ({ n = rb_entry_safe(rb_next_postorder(&pos->field), \
+			typeof(*pos), field); 1; }); \
+	     pos = n)
+
 #endif	/* _LINUX_RBTREE_H */
include/linux/rbtree_augmented.h new file +220 -0

220 lines not on this page · raw message

lib/rbtree.c +429 -255

795 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#3 lore raw

RFC PATCH 3/4 lib, list_sort: add list_sort from linux 3.14

In reply to Heiko Schocher

from linux 3.14:

commit 455c6fdbd219161bd09b1165f11699d6d73de11c

Author: Linus Torvalds <[email protected]>
Date:   Sun Mar 30 20:40:15 2014 -0700
    Linux 3.14

Needed for the MTD/UBI/UBIFS resync

Cc Marek Vasut <[email protected]>
Cc Sergey Lapin <[email protected]>
Cc Scott Wood <[email protected]>
---
 include/linux/list_sort.h |  11 ++
 lib/Makefile              |   1 +
 lib/list_sort.c           | 298 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 310 insertions(+)
 create mode 100644 include/linux/list_sort.h
 create mode 100644 lib/list_sort.c
include/linux/list_sort.h new file +11 -0
new file mode 100644
index 0000000..1a2df2e
@@ -0,0 +1,11 @@
+#ifndef _LINUX_LIST_SORT_H
+#define _LINUX_LIST_SORT_H
+
+#include <linux/types.h>
+
+struct list_head;
+
+void list_sort(void *priv, struct list_head *head,
+	       int (*cmp)(void *priv, struct list_head *a,
+			  struct list_head *b));
+#endif
lib/Makefile +1 -0
index 27e4f78..71b7fb8 100644
@@ -40,6 +40,7 @@ obj-y	+= strmhz.o
 obj-$(CONFIG_TPM) += tpm.o
 obj-$(CONFIG_RBTREE)	+= rbtree.o
 obj-$(CONFIG_BITREVERSE) += bitrev.o
+obj-y += list_sort.o
 endif
 
 ifdef CONFIG_SPL_BUILD
lib/list_sort.c new file +298 -0

298 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#4 lore raw

RFC PATCH 4/4 mtd, ubi, ubifs: resync with Linux-3.14

In reply to Heiko Schocher

resync ubi subsystem with linux:

commit 455c6fdbd219161bd09b1165f11699d6d73de11c

Author: Linus Torvalds <[email protected]>
Date:   Sun Mar 30 20:40:15 2014 -0700
    Linux 3.14

- UBI Fastmap is now availiable in U-Boot
activate it with CONFIG_MTD_UBI_FASTMAP

- replace UBI_LINUX in current UBI code from U-Boot with __UBOOT__ as this define is used in other places in U-Boot where code from other projects is used.

- move a lot of defines from include/ubi_uboot.h to include/linux/compat.h, as this is the correcter place for it.

- add usb device to linux device, so usb uses "struct device" from "linux/compat.h"

- onenand changes only compile tested.

- Following Code in drivers/mtd/nand/nand_base.c nand_do_write_ops() adapted for U-Boot:

+#ifndef __UBOOT__

        /* Reject writes, which are not page aligned */
        if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {

+else
+ /* Reject writes, which are not page aligned */
+ if (NOTALIGNED(to)) {
+endif

as the original linux code leads in not working use of the env var "filesize". For example a "nand write 80000000 80000 ${filesize}" would not work with it ...

- add CONFIG_MTD_NAND_VERIFY_WRITE from U-Boot code

- Documented the config defines in README

- kmalloc now uses memalign for allocating memory. This prevented crashes when tested ubi/ubifs on imx6 board.

- To produce this patch I did three steps:
- copied the linux source files to U-Boot tree -> commit this
- adapt license text in each file -> commit this
- make the code again compile clean and working -> commit this

Then squashed this three patches to this patch, to not break bisectability. To make further sync with linux easier, the above three patches can be found in:

http://git.denx.de/?p=u-boot/u-boot-testing.git;a=shortlog;h=refs/heads/update-mtd%2Bubi-linux-v3.14

Cc Marek Vasut <[email protected]>
Cc Sergey Lapin <[email protected]>
Cc Scott Wood <[email protected]>
Cc Wolfgang Denk <[email protected]>

---

Tested it on am33xx, imx6 and mpc83xx boards. MAKEALL for arm and powerpc compiles clean.

Tested UBI fastmap on a board with 512 MiB nand flash. Attach time from old U-Boot was 2 seconds, reduced with UBI fastmap to 0.2 seconds.

Please test this patch!

---
 README                              |   61 +
 board/prodrive/alpr/nand.c          |    4 +
 board/socrates/nand.c               |    6 +
 board/tqc/tqm8272/nand.c            |    4 +
 common/cmd_ubi.c                    |   31 +-
 common/cmd_ubifs.c                  |    2 +-
 drivers/mtd/mtdconcat.c             |  230 ++-
 drivers/mtd/mtdcore.c               | 1112 ++++++++++++-
 drivers/mtd/mtdcore.h               |   23 +
 drivers/mtd/mtdpart.c               |  521 +++++-
 drivers/mtd/nand/fsl_elbc_nand.c    |    4 +
 drivers/mtd/nand/fsl_ifc_nand.c     |    4 +
 drivers/mtd/nand/fsl_upm.c          |    4 +
 drivers/mtd/nand/mpc5121_nfc.c      |    4 +
 drivers/mtd/nand/mxc_nand.c         |    8 +
 drivers/mtd/nand/nand_base.c        | 1897 +++++++++++++++------
 drivers/mtd/nand/nand_bbt.c         |  296 ++--
 drivers/mtd/nand/nand_ids.c         |  256 +--
 drivers/mtd/nand/nand_util.c        |    3 +
 drivers/mtd/nand/ndfc.c             |    4 +
 drivers/mtd/onenand/onenand_base.c  |    1 +
 drivers/mtd/onenand/onenand_bbt.c   |    1 -
 drivers/mtd/onenand/samsung.c       |   10 +-
 drivers/mtd/ubi/Makefile            |    3 +-
 drivers/mtd/ubi/attach.c            | 1754 ++++++++++++++++++++
 drivers/mtd/ubi/build.c             |  812 ++++++---
 drivers/mtd/ubi/crc32.c             |   13 +-
 drivers/mtd/ubi/crc32table.h        |    2 +-
 drivers/mtd/ubi/debug.c             |  482 ++++--
 drivers/mtd/ubi/debug.h             |  178 +-
 drivers/mtd/ubi/eba.c               |  474 ++++--
 drivers/mtd/ubi/fastmap.c           | 1584 ++++++++++++++++++
 drivers/mtd/ubi/io.c                |  788 +++++----
 drivers/mtd/ubi/kapi.c              |  276 ++-
 drivers/mtd/ubi/misc.c              |   58 +-
 drivers/mtd/ubi/scan.c              | 1348 ---------------
 drivers/mtd/ubi/scan.h              |  153 --
 drivers/mtd/ubi/ubi-media.h         |  205 ++-
 drivers/mtd/ubi/ubi.h               |  626 +++++--
 drivers/mtd/ubi/upd.c               |  104 +-
 drivers/mtd/ubi/vmt.c               |  283 ++--
 drivers/mtd/ubi/vtbl.c              |  359 ++--
 drivers/mtd/ubi/wl.c                | 1590 +++++++++++-------
 drivers/usb/gadget/ether.c          |    5 -
 drivers/usb/gadget/storage_common.c |    5 -
 drivers/usb/musb-new/linux-compat.h |   58 -
 drivers/video/exynos_dp.c           |    1 +
 drivers/video/exynos_mipi_dsi.c     |    1 +
 fs/ubifs/budget.c                   |  662 +++++++-
 fs/ubifs/debug.c                    | 3132 ++++++++++++++++++++++++++++++++++-
 fs/ubifs/debug.h                    |  578 ++++---
 fs/ubifs/io.c                       |  897 +++++++++-
 fs/ubifs/key.h                      |   68 +-
 fs/ubifs/log.c                      |  663 +++++++-
 fs/ubifs/lprops.c                   |  538 +++++-
 fs/ubifs/lpt.c                      | 1242 +++++++++++++-
 fs/ubifs/lpt_commit.c               | 1903 ++++++++++++++++++++-
 fs/ubifs/master.c                   |  102 +-
 fs/ubifs/misc.h                     |  159 +-
 fs/ubifs/orphan.c                   |  671 +++++++-
 fs/ubifs/recovery.c                 |  738 ++++++---
 fs/ubifs/replay.c                   |  573 ++++---
 fs/ubifs/sb.c                       |  547 +++++-
 fs/ubifs/scan.c                     |  102 +-
 fs/ubifs/super.c                    | 2173 ++++++++++++++++++++----
 fs/ubifs/tnc.c                      |  742 ++++++++-
 fs/ubifs/tnc_misc.c                 |  124 +-
 fs/ubifs/ubifs-media.h              |   62 +-
 fs/ubifs/ubifs.c                    |  115 +-
 fs/ubifs/ubifs.h                    |  708 +++++---
 fs/yaffs2/ydirectenv.h              |    2 -
 include/linux/compat.h              |  327 +++-
 include/linux/err.h                 |   15 +-
 include/linux/mtd/bbm.h             |   73 +-
 include/linux/mtd/concat.h          |    4 +
 include/linux/mtd/flashchip.h       |  105 ++
 include/linux/mtd/mtd.h             |  272 ++-
 include/linux/mtd/nand.h            |  350 +++-
 include/linux/mtd/partitions.h      |   60 +-
 include/linux/mtd/ubi.h             |  120 +-
 include/linux/usb/gadget.h          |    6 +-
 include/mtd/mtd-abi.h               |  195 ++-
 include/mtd/ubi-user.h              |  305 +++-
 include/ubi_uboot.h                 |  164 +-
 include/usb/lin_gadget_compat.h     |   16 -
 lib/Makefile                        |    1 +
 86 files changed, 27020 insertions(+), 7142 deletions(-)
 create mode 100644 drivers/mtd/mtdcore.h
 create mode 100644 drivers/mtd/ubi/attach.c
 create mode 100644 drivers/mtd/ubi/fastmap.c
 delete mode 100644 drivers/mtd/ubi/scan.c
 delete mode 100644 drivers/mtd/ubi/scan.h
 create mode 100644 include/linux/mtd/flashchip.h
README +61 -0
index 5f89552..ace7091 100644
@@ -3214,6 +3214,9 @@ FIT uImage format:
 		Adds the MTD partitioning infrastructure from the Linux
 		kernel. Needed for UBI support.
 
+		CONFIG_MTD_NAND_VERIFY_WRITE
+		verify if the written data is correct reread.
+
 - UBI support
 		CONFIG_CMD_UBI
 
@@ -3227,6 +3230,64 @@ FIT uImage format:
 		Make the verbose messages from UBI stop printing.  This leaves
 		warnings and errors enabled.
 
+
+		CONFIG_MTD_UBI_WL_THRESHOLD
+		This parameter defines the maximum difference between the highest
+		erase counter value and the lowest erase counter value of eraseblocks
+		of UBI devices. When this threshold is exceeded, UBI starts performing
+		wear leveling by means of moving data from eraseblock with low erase
+		counter to eraseblocks with high erase counter.
+
+		The default value should be OK for SLC NAND flashes, NOR flashes and
+		other flashes which have eraseblock life-cycle 100000 or more.
+		However, in case of MLC NAND flashes which typically have eraseblock
+		life-cycle less than 10000, the threshold should be lessened (e.g.,
+		to 128 or 256, although it does not have to be power of 2).
+
+		default: 4096
+		
+		CONFIG_MTD_UBI_BEB_LIMIT
+		This option specifies the maximum bad physical eraseblocks UBI
+		expects on the MTD device (per 1024 eraseblocks). If the
+		underlying flash does not admit of bad eraseblocks (e.g. NOR
+		flash), this value is ignored.
+
+		NAND datasheets often specify the minimum and maximum NVM
+		(Number of Valid Blocks) for the flashes' endurance lifetime.
+		The maximum expected bad eraseblocks per 1024 eraseblocks
+		then can be calculated as "1024 * (1 - MinNVB / MaxNVB)",
+		which gives 20 for most NANDs (MaxNVB is basically the total
+		count of eraseblocks on the chip).
+
+		To put it differently, if this value is 20, UBI will try to
+		reserve about 1.9% of physical eraseblocks for bad blocks
+		handling. And that will be 1.9% of eraseblocks on the entire
+		NAND chip, not just the MTD partition UBI attaches. This means
+		that if you have, say, a NAND flash chip admits maximum 40 bad
+		eraseblocks, and it is split on two MTD partitions of the same
+		size, UBI will reserve 40 eraseblocks when attaching a
+		partition.
+
+		default: 20
+
+		CONFIG_MTD_UBI_FASTMAP
+		Fastmap is a mechanism which allows attaching an UBI device
+		in nearly constant time. Instead of scanning the whole MTD device it
+		only has to locate a checkpoint (called fastmap) on the device.
+		The on-flash fastmap contains all information needed to attach
+		the device. Using fastmap makes only sense on large devices where
+		attaching by scanning takes long. UBI will not automatically install
+		a fastmap on old images, but you can set the UBI parameter
+		CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT to 1 if you want so. Please note
+		that fastmap-enabled images are still usable with UBI implementations
+		without	fastmap support. On typical flash devices the whole fastmap
+		fits into one PEB. UBI will reserve PEBs to hold two fastmaps.
+
+		CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT
+		Set this parameter to enable fastmap automatically on images
+		without a fastmap.
+		default: 0
+
 - UBIFS support
 		CONFIG_CMD_UBIFS
 
board/prodrive/alpr/nand.c +4 -0
index 50e8d82..5427de5 100644
@@ -93,6 +93,7 @@ static void alpr_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 	}
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 static int alpr_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
 {
 	int i;
@@ -103,6 +104,7 @@ static int alpr_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len
 
 	return 0;
 }
+#endif
 
 static int alpr_nand_dev_ready(struct mtd_info *mtd)
 {
@@ -128,7 +130,9 @@ int board_nand_init(struct nand_chip *nand)
 	nand->read_byte  = alpr_nand_read_byte;
 	nand->write_buf  = alpr_nand_write_buf;
 	nand->read_buf   = alpr_nand_read_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	nand->verify_buf = alpr_nand_verify_buf;
+#endif
 	nand->dev_ready  = alpr_nand_dev_ready;
 
 	return 0;
board/socrates/nand.c +6 -0
index 3802c7e..7394478 100644
@@ -18,7 +18,9 @@ static void sc_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len);
 static u_char sc_nand_read_byte(struct mtd_info *mtd);
 static u16 sc_nand_read_word(struct mtd_info *mtd);
 static void sc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len);
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 static int sc_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len);
+#endif
 static int sc_nand_device_ready(struct mtd_info *mtdinfo);
 
 #define FPGA_NAND_CMD_MASK		(0x7 << 28)
@@ -100,6 +102,7 @@ static void sc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 	}
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 /**
  * sc_nand_verify_buf -  Verify chip data against buffer
  * @mtd:	MTD device structure
@@ -116,6 +119,7 @@ static int sc_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
 	}
 	return 0;
 }
+#endif
 
 /**
  * sc_nand_device_ready - Check the NAND device is ready for next command.
@@ -174,7 +178,9 @@ int board_nand_init(struct nand_chip *nand)
 	nand->read_word = sc_nand_read_word;
 	nand->write_buf = sc_nand_write_buf;
 	nand->read_buf = sc_nand_read_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	nand->verify_buf = sc_nand_verify_buf;
+#endif
 
 	return 0;
 }
board/tqc/tqm8272/nand.c +4 -0
index 4925b8d..7fb2dfa 100644
@@ -188,6 +188,7 @@ static void tqm8272_write_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int
 		*base = buf[i];
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 static int tqm8272_verify_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len)
 {
 	struct nand_chip *this = mtdinfo->priv;
@@ -199,6 +200,7 @@ static int tqm8272_verify_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int
 			return -1;
 	return 0;
 }
+#endif
 #endif /* #ifndef CONFIG_NAND_SPL */
 
 void board_nand_select_device(struct nand_chip *nand, int chip)
@@ -247,8 +249,10 @@ int board_nand_init(struct nand_chip *nand)
 #ifndef CONFIG_NAND_SPL
 	nand->write_buf	 = tqm8272_write_buf;
 	nand->read_buf	 = tqm8272_read_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	nand->verify_buf = tqm8272_verify_buf;
 #endif
+#endif
 
 	/*
 	 * Select required NAND chip
common/cmd_ubi.c +1 -27
index 7c4d950..e0c8327 100644
@@ -19,6 +19,7 @@
 #include <onenand_uboot.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/err.h>
 #include <ubi_uboot.h>
 #include <asm/errno.h>
 #include <jffs2/load_kernel.h>
@@ -50,33 +51,6 @@ int ubifs_is_mounted(void);
 void cmd_ubifs_umount(void);
 #endif
 
-static void ubi_dump_vol_info(const struct ubi_volume *vol)
-{
-	ubi_msg("volume information dump:");
-	ubi_msg("vol_id          %d", vol->vol_id);
-	ubi_msg("reserved_pebs   %d", vol->reserved_pebs);
-	ubi_msg("alignment       %d", vol->alignment);
-	ubi_msg("data_pad        %d", vol->data_pad);
-	ubi_msg("vol_type        %d", vol->vol_type);
-	ubi_msg("name_len        %d", vol->name_len);
-	ubi_msg("usable_leb_size %d", vol->usable_leb_size);
-	ubi_msg("used_ebs        %d", vol->used_ebs);
-	ubi_msg("used_bytes      %lld", vol->used_bytes);
-	ubi_msg("last_eb_bytes   %d", vol->last_eb_bytes);
-	ubi_msg("corrupted       %d", vol->corrupted);
-	ubi_msg("upd_marker      %d", vol->upd_marker);
-
-	if (vol->name_len <= UBI_VOL_NAME_MAX &&
-		strnlen(vol->name, vol->name_len + 1) == vol->name_len) {
-		ubi_msg("name            %s", vol->name);
-	} else {
-		ubi_msg("the 1st 5 characters of the name: %c%c%c%c%c",
-				vol->name[0], vol->name[1], vol->name[2],
-				vol->name[3], vol->name[4]);
-	}
-	printf("\n");
-}
-
 static void display_volume_info(struct ubi_device *ubi)
 {
 	int i;
common/cmd_ubifs.c +1 -1
index fdc8bfe..0baa827 100644
@@ -37,7 +37,7 @@ int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		ubifs_initialized = 1;
 	}
 
-	ret = ubifs_mount(vol_name);
+	ret = uboot_ubifs_mount(vol_name);
 	if (ret)
 		return -1;
 
drivers/mtd/mtdconcat.c +215 -15

375 lines not on this page · raw message

drivers/mtd/mtdcore.c +1040 -72

1,291 lines not on this page · raw message

drivers/mtd/mtdcore.h new file +23 -0
new file mode 100644
index 0000000..7b03533
@@ -0,0 +1,23 @@
+/*
+ * These are exported solely for the purpose of mtd_blkdevs.c and mtdchar.c.
+ * You should not use them for _anything_ else.
+ */
+
+extern struct mutex mtd_table_mutex;
+
+struct mtd_info *__mtd_next_device(int i);
+int add_mtd_device(struct mtd_info *mtd);
+int del_mtd_device(struct mtd_info *mtd);
+int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
+int del_mtd_partitions(struct mtd_info *);
+int parse_mtd_partitions(struct mtd_info *master, const char * const *types,
+			 struct mtd_partition **pparts,
+			 struct mtd_part_parser_data *data);
+
+int __init init_mtdchar(void);
+void __exit cleanup_mtdchar(void);
+
+#define mtd_for_each_device(mtd)			\
+	for ((mtd) = __mtd_next_device(0);		\
+	     (mtd) != NULL;				\
+	     (mtd) = __mtd_next_device(mtd->index + 1))
drivers/mtd/mtdpart.c +453 -68

759 lines not on this page · raw message

drivers/mtd/nand/fsl_elbc_nand.c +4 -0
index 2f31fc9..7e1e6ec 100644
@@ -561,6 +561,7 @@ static void fsl_elbc_read_buf(struct mtd_info *mtd, u8 *buf, int len)
 		       len, avail);
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 /*
  * Verify buffer against the FCM Controller Data Buffer
  */
@@ -593,6 +594,7 @@ static int fsl_elbc_verify_buf(struct mtd_info *mtd,
 	ctrl->index += len;
 	return i == len && ctrl->status == LTESR_CC ? 0 : -EIO;
 }
+#endif
 
 /* This function is called after Program and Erase Operations to
  * check for success or failure.
@@ -725,7 +727,9 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr)
 	nand->read_byte = fsl_elbc_read_byte;
 	nand->write_buf = fsl_elbc_write_buf;
 	nand->read_buf = fsl_elbc_read_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	nand->verify_buf = fsl_elbc_verify_buf;
+#endif
 	nand->select_chip = fsl_elbc_select_chip;
 	nand->cmdfunc = fsl_elbc_cmdfunc;
 	nand->waitfunc = fsl_elbc_wait;
drivers/mtd/nand/fsl_ifc_nand.c +4 -0
index be5a16a..a8d0b20 100644
@@ -681,6 +681,7 @@ static void fsl_ifc_read_buf(struct mtd_info *mtd, u8 *buf, int len)
 		       __func__, len, avail);
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 /*
  * Verify buffer against the IFC Controller Data Buffer
  */
@@ -713,6 +714,7 @@ static int fsl_ifc_verify_buf(struct mtd_info *mtd,
 	ctrl->index += len;
 	return i == len && ctrl->status == IFC_NAND_EVTER_STAT_OPC ? 0 : -EIO;
 }
+#endif
 
 /* This function is called after Program and Erase Operations to
  * check for success or failure.
@@ -911,7 +913,9 @@ static int fsl_ifc_chip_init(int devnum, u8 *addr)
 
 	nand->write_buf = fsl_ifc_write_buf;
 	nand->read_buf = fsl_ifc_read_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	nand->verify_buf = fsl_ifc_verify_buf;
+#endif
 	nand->select_chip = fsl_ifc_select_chip;
 	nand->cmdfunc = fsl_ifc_cmdfunc;
 	nand->waitfunc = fsl_ifc_wait;
drivers/mtd/nand/fsl_upm.c +4 -0
index 3ae0044..65ce98a 100644
@@ -153,6 +153,7 @@ static void upm_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 		buf[i] = in_8(chip->IO_ADDR_R);
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 static int upm_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
 {
 	int i;
@@ -165,6 +166,7 @@ static int upm_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
 
 	return 0;
 }
+#endif
 
 static int nand_dev_ready(struct mtd_info *mtd)
 {
@@ -191,7 +193,9 @@ int fsl_upm_nand_init(struct nand_chip *chip, struct fsl_upm_nand *fun)
 	chip->read_byte = upm_nand_read_byte;
 	chip->read_buf = upm_nand_read_buf;
 	chip->write_buf = upm_nand_write_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	chip->verify_buf = upm_nand_verify_buf;
+#endif
 	if (fun->dev_ready)
 		chip->dev_ready = nand_dev_ready;
 
drivers/mtd/nand/mpc5121_nfc.c +4 -0
index d0f3a35..7233bfc 100644
@@ -459,6 +459,7 @@ static void mpc5121_nfc_write_buf(struct mtd_info *mtd,
 	mpc5121_nfc_buf_copy(mtd, (u_char *) buf, len, 1);
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 /* Compare buffer with NAND flash */
 static int mpc5121_nfc_verify_buf(struct mtd_info *mtd,
 				  const u_char * buf, int len)
@@ -479,6 +480,7 @@ static int mpc5121_nfc_verify_buf(struct mtd_info *mtd,
 
 	return 0;
 }
+#endif
 
 /* Read byte from NFC buffers */
 static u8 mpc5121_nfc_read_byte(struct mtd_info *mtd)
@@ -607,7 +609,9 @@ int board_nand_init(struct nand_chip *chip)
 	chip->read_word = mpc5121_nfc_read_word;
 	chip->read_buf = mpc5121_nfc_read_buf;
 	chip->write_buf = mpc5121_nfc_write_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	chip->verify_buf = mpc5121_nfc_verify_buf;
+#endif
 	chip->select_chip = mpc5121_nfc_select_chip;
 	chip->bbt_options = NAND_BBT_USE_FLASH;
 	chip->ecc.mode = NAND_ECC_SOFT;
drivers/mtd/nand/mxc_nand.c +8 -0
index ed0ca3a..2e5b5b9 100644
@@ -949,6 +949,8 @@ static void mxc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 	host->col_addr = col;
 }
 
+#ifdef __UBOOT__
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 /*
  * Used by the upper layer to verify the data in NAND Flash
  * with the data in the buf.
@@ -972,6 +974,8 @@ static int mxc_nand_verify_buf(struct mtd_info *mtd,
 
 	return 0;
 }
+#endif
+#endif
 
 /*
  * This function is used by upper layer for select and
@@ -1203,7 +1207,11 @@ int board_nand_init(struct nand_chip *this)
 	this->read_word = mxc_nand_read_word;
 	this->write_buf = mxc_nand_write_buf;
 	this->read_buf = mxc_nand_read_buf;
+#ifdef __UBOOT__
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	this->verify_buf = mxc_nand_verify_buf;
+#endif
+#endif
 
 	host->regs = (struct mxc_nand_regs __iomem *)CONFIG_MXC_NAND_REGS_BASE;
 #ifdef MXC_NFC_V3_2
drivers/mtd/nand/nand_base.c +1376 -521

233 lines not on this page · raw message

drivers/mtd/nand/nand_bbt.c +141 -155

296 lines not on this page · raw message

drivers/mtd/nand/nand_ids.c +131 -125

256 lines not on this page · raw message

drivers/mtd/nand/nand_util.c +3 -0
index b292826..024f6fb 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/nand/ndfc.c +4 -0
index 5510b13..2659595 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/onenand/onenand_base.c +1 -0
index e33e8d3..03deabc 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/onenand/onenand_bbt.c +0 -1
index 0267c2c..52509f1 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/onenand/samsung.c +1 -9
index df04c2b..5e56a29 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/ubi/Makefile +2 -1
index 56c2823..e965566 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/ubi/attach.c new file +1754 -0

1,754 lines not on this page · raw message

drivers/mtd/ubi/build.c +586 -226

812 lines not on this page · raw message

drivers/mtd/ubi/crc32.c +7 -6
index f1bebf5..0d65bf4 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/ubi/crc32table.h +1 -1
index 0438af4..02ce6fd 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/ubi/debug.c +381 -101

482 lines not on this page · raw message

drivers/mtd/ubi/debug.h +83 -95

178 lines not on this page · raw message

drivers/mtd/ubi/eba.c +315 -159

474 lines not on this page · raw message

drivers/mtd/ubi/fastmap.c new file +1584 -0

1,584 lines not on this page · raw message

drivers/mtd/ubi/io.c +473 -315

788 lines not on this page · raw message

drivers/mtd/ubi/kapi.c +219 -57

276 lines not on this page · raw message

drivers/mtd/ubi/misc.c +53 -5

58 lines not on this page · raw message

drivers/mtd/ubi/scan.c deleted +0 -1348

1,348 lines not on this page · raw message

drivers/mtd/ubi/scan.h deleted +0 -153

153 lines not on this page · raw message

drivers/mtd/ubi/ubi-media.h +176 -29

205 lines not on this page · raw message

drivers/mtd/ubi/ubi.h +496 -130

626 lines not on this page · raw message

drivers/mtd/ubi/upd.c +53 -51

104 lines not on this page · raw message

drivers/mtd/ubi/vmt.c +147 -136

283 lines not on this page · raw message

drivers/mtd/ubi/vtbl.c +200 -159

359 lines not on this page · raw message

drivers/mtd/ubi/wl.c +1033 -557

1,590 lines not on this page · raw message

drivers/usb/gadget/ether.c +0 -5
index cc6cc1f..d0dd29f 100644

Lines of this file are not shown. View the raw message.

drivers/usb/gadget/storage_common.c +0 -5
index 7430074..d3e8a85 100644

Lines of this file are not shown. View the raw message.

drivers/usb/musb-new/linux-compat.h +0 -58

58 lines not on this page · raw message

drivers/video/exynos_dp.c +1 -0
index 682483f..f60b060 100644

Lines of this file are not shown. View the raw message.

drivers/video/exynos_mipi_dsi.c +1 -0
index 7dd4652..c68ebd6 100644

Lines of this file are not shown. View the raw message.

fs/ubifs/budget.c +640 -22

662 lines not on this page · raw message

fs/ubifs/debug.c +3063 -69

3,132 lines not on this page · raw message

fs/ubifs/debug.h +282 -296

578 lines not on this page · raw message

fs/ubifs/io.c +866 -31

897 lines not on this page · raw message

fs/ubifs/key.h +24 -44

68 lines not on this page · raw message

fs/ubifs/log.c +648 -15

663 lines not on this page · raw message

fs/ubifs/lprops.c +505 -33

538 lines not on this page · raw message

fs/ubifs/lpt.c +1211 -31

1,242 lines not on this page · raw message

fs/ubifs/lpt_commit.c +1886 -17

1,903 lines not on this page · raw message

fs/ubifs/master.c +78 -24

102 lines not on this page · raw message

fs/ubifs/misc.h +75 -84

159 lines not on this page · raw message

fs/ubifs/orphan.c +651 -20

671 lines not on this page · raw message

fs/ubifs/recovery.c +538 -200

738 lines not on this page · raw message

fs/ubifs/replay.c +285 -288

573 lines not on this page · raw message

fs/ubifs/sb.c +510 -37

547 lines not on this page · raw message

fs/ubifs/scan.c +56 -46

102 lines not on this page · raw message

fs/ubifs/super.c +1833 -340

2,173 lines not on this page · raw message

fs/ubifs/tnc.c +652 -90

742 lines not on this page · raw message

fs/ubifs/tnc_misc.c +88 -36

124 lines not on this page · raw message

fs/ubifs/ubifs-media.h +36 -26

62 lines not on this page · raw message

fs/ubifs/ubifs.c +109 -6

115 lines not on this page · raw message

fs/ubifs/ubifs.h +478 -230

708 lines not on this page · raw message

fs/yaffs2/ydirectenv.h +0 -2
index c6614f1..2b3e84f 100644

Lines of this file are not shown. View the raw message.

include/linux/compat.h +324 -3

327 lines not on this page · raw message

include/linux/err.h +14 -1
index 96c0c72..e490301 100644

Lines of this file are not shown. View the raw message.

include/linux/mtd/bbm.h +37 -36

73 lines not on this page · raw message

include/linux/mtd/concat.h +4 -0
index c92b4dd..195a4a5 100644

Lines of this file are not shown. View the raw message.

include/linux/mtd/flashchip.h new file +105 -0

105 lines not on this page · raw message

include/linux/mtd/mtd.h +185 -87

272 lines not on this page · raw message

include/linux/mtd/nand.h +272 -78

350 lines not on this page · raw message

include/linux/mtd/partitions.h +33 -27

60 lines not on this page · raw message

include/linux/mtd/ubi.h +92 -28

120 lines not on this page · raw message

include/linux/usb/gadget.h +1 -5
index a8a5763..9bccd45 100644

Lines of this file are not shown. View the raw message.

include/mtd/mtd-abi.h +143 -52

195 lines not on this page · raw message

include/mtd/ubi-user.h +230 -75

305 lines not on this page · raw message

include/ubi_uboot.h +9 -155

164 lines not on this page · raw message

include/usb/lin_gadget_compat.h +0 -16
index a25e9d9..29fb166 100644

Lines of this file are not shown. View the raw message.

lib/Makefile +1 -0
index 71b7fb8..a4999e2 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.8.3.1

Part of the diff is not shown here. View the raw message.

#5 lore raw

cover mtd, ubi, ubifs: resync with Linux-3.14

In reply to Heiko Schocher

Building for a custom Freescale i.MX28 board failed for me. Here is the output:

[joerg at timelineX u-boot-testing]$ export ARCH=arm [joerg at timelineX u-boot-testing]$ export CROSS_COMPILE=arm-linux-gnueabi-
[joerg at timelineX u-boot-testing]$ make mrproper
CLEAN scripts/basic
CLEAN include/config include/generated
CLEAN include/config.h include/config.mk
[joerg at timelineX u-boot-testing]$ make airlino_config Configuring for airlino board...
[joerg at timelineX u-boot-testing]$ make -j4 u-boot.sb
GEN include/autoconf.mk.dep
GEN include/autoconf.mk
CHK include/config/uboot.release
CHK include/generated/timestamp_autogenerated.h
UPD include/generated/timestamp_autogenerated.h
HOSTCC scripts/basic/fixdep
UPD include/config/uboot.release
CHK include/generated/version_autogenerated.h
UPD include/generated/version_autogenerated.h
CC arch/arm/lib/asm-offsets.s
CC lib/asm-offsets.s
GEN include/generated/asm-offsets.h
GEN include/generated/generic-asm-offsets.h
HOSTCC tools/aisimage.o
HOSTCC tools/default_image.o
HOSTCC tools/dumpimage.o
HOSTCC tools/crc32.o
HOSTCC tools/env_embedded.o
HOSTCC tools/envcrc.o
HOSTCC tools/fdt.o
HOSTCC tools/fdt_ro.o
HOSTCC tools/fdt_rw.o
HOSTCC tools/fdt_strerror.o
HOSTCC tools/fdt_wip.o
HOSTCC tools/fdtdec.o
HOSTCC tools/fit_common.o
HOSTCC tools/fit_image.o
HOSTCC tools/gpimage-common.o
HOSTCC tools/gpimage.o
HOSTCC tools/image-fit.o
HOSTCC tools/image-host.o
HOSTCC tools/image.o
HOSTCC tools/imagetool.o
HOSTCC tools/imximage.o
HOSTCC tools/kwbimage.o
LDS u-boot.lds
HOSTCC tools/md5.o
HOSTCC tools/mkenvimage.o
HOSTCC tools/mkimage.o
HOSTCC tools/mxsimage.o
HOSTCC tools/omapimage.o
HOSTCC tools/os_support.o
HOSTCC tools/pblimage.o
HOSTCC tools/sha1.o
HOSTCC tools/sha256.o
HOSTCC tools/ublimage.o
HOSTCC tools/gen_eth_addr
tools/mxsimage.c: In function 'mxsimage_generate':
tools/mxsimage.c:1500:28: warning: 'rptr' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (!tok || (strlen(tok) == 0) || (lptr && strlen(lptr) != 1)) {
^
tools/mxsimage.c:1439:8: note: 'rptr' was declared here
char *rptr;
^
HOSTCC tools/img2srec
HOSTCC tools/mxsboot
HOSTCC tools/proftool
HOSTLD tools/mkenvimage
HOSTLD tools/envcrc
HOSTLD tools/dumpimage
HOSTLD tools/mkimage
LD arch/arm/cpu/built-in.o
CC arch/arm/cpu/arm926ejs/cpu.o
CC arch/arm/imx-common/misc.o
CC arch/arm/cpu/arm926ejs/mxs/clock.o
CC arch/arm/cpu/arm926ejs/cache.o
AS arch/arm/lib/crt0.o
AS arch/arm/lib/relocate.o
LD arch/arm/imx-common/built-in.o
CC arch/arm/lib/board.o
AS arch/arm/cpu/arm926ejs/start.o
LD arch/arm/cpu/arm926ejs/built-in.o
CC board/lintech/airlino/airlino.o
CC arch/arm/cpu/arm926ejs/mxs/mxs.o
CC arch/arm/lib/bootm-fdt.o
CC arch/arm/lib/bootm.o
LD board/lintech/airlino/built-in.o
CC arch/arm/cpu/arm926ejs/mxs/iomux.o
CC arch/arm/cpu/arm926ejs/mxs/timer.o
CC arch/arm/lib/sections.o
CC arch/arm/lib/interrupts.o
CC disk/part.o
CC arch/arm/lib/reset.o
LD arch/arm/cpu/arm926ejs/mxs/built-in.o
CC common/main.o
CC arch/arm/lib/cache.o
LD disk/built-in.o
CC drivers/dma/apbh_dma.o
CC arch/arm/lib/cache-cp15.o
LD drivers/block/built-in.o
LD drivers/crypto/built-in.o
LD drivers/dfu/built-in.o
LD drivers/hwmon/built-in.o
AR arch/arm/lib/lib.a
CC common/command.o
LD drivers/misc/built-in.o
CC arch/arm/lib/eabi_compat.o
LD drivers/dma/built-in.o
CC drivers/pcmcia/rpx_pcmcia.o
CC drivers/gpio/mxs_gpio.o
LD arch/arm/lib/built-in.o
CC drivers/pcmcia/tqm8xx_pcmcia.o
LD drivers/i2c/built-in.o
LD drivers/gpio/built-in.o
LD drivers/pcmcia/built-in.o
CC drivers/input/input.o
LD drivers/mmc/built-in.o
CC drivers/rtc/date.o
CC common/exports.o
CC drivers/mtd/mtdcore.o
LD drivers/input/built-in.o
CC common/hash.o
CC drivers/rtc/mxsrtc.o
CC drivers/mtd/nand/nand.o
CC common/hush.o
CC drivers/mtd/nand/nand_bbt.o
LD drivers/rtc/built-in.o
LD drivers/sound/built-in.o
LD drivers/tpm/built-in.o
CC drivers/mtd/mtdpart.o
LD drivers/twserial/built-in.o
LD drivers/video/built-in.o
LD drivers/watchdog/built-in.o
LD drivers/built-in.o
LD drivers/mtd/onenand/built-in.o
LD drivers/mtd/spi/built-in.o
LD drivers/mtd/built-in.o
CC drivers/mtd/nand/nand_ids.o
CC drivers/mtd/ubi/attach.o
LD drivers/net/built-in.o
CC common/s_record.o
CC drivers/mtd/nand/nand_util.o
CC common/xyzModem.o
CC common/cmd_disk.o
CC common/cmd_boot.o
CC common/cmd_bootm.o
CC drivers/mtd/nand/nand_ecc.o
CC common/cmd_help.o
CC common/cmd_version.o
CC drivers/mtd/nand/nand_base.o
CC drivers/mtd/ubi/build.o
CC common/env_attr.o
CC common/env_callback.o
CC common/env_flags.o
CC common/env_nand.o
CC drivers/mtd/ubi/vtbl.o
CC common/cmd_source.o
CC common/cmd_bdinfo.o
CC common/cmd_cache.o
CC common/cmd_console.o
CC common/cmd_date.o
CC drivers/mtd/ubi/vmt.o
CC common/cmd_echo.o
CC common/cmd_exit.o
CC common/cmd_fdt.o
CC common/fdt_support.o
CC drivers/mtd/ubi/upd.o
CC drivers/mtd/ubi/kapi.o
CC drivers/mtd/nand/mxs_nand.o
CC common/cmd_gpio.o
CC drivers/mtd/ubi/eba.o
CC common/cmd_itest.o
CC common/cmd_load.o
LD drivers/net/phy/built-in.o
LD drivers/pci/built-in.o
LD drivers/mtd/nand/built-in.o
LD drivers/power/built-in.o
LD drivers/power/battery/built-in.o
CC common/cmd_mem.o
LD drivers/power/fuel_gauge/built-in.o
CC common/cmd_misc.o
LD drivers/power/mfd/built-in.o
LD drivers/power/pmic/built-in.o
CC common/cmd_mtdparts.o
CC common/cmd_nand.o
CC drivers/serial/serial.o
CC drivers/mtd/ubi/io.o
CC drivers/serial/serial_pl01x.o
LD drivers/serial/built-in.o
CC common/cmd_net.o
CC drivers/spi/spi.o
CC drivers/mtd/ubi/wl.o
LD drivers/spi/built-in.o
CC common/cmd_pcmcia.o
CC drivers/usb/eth/asix.o
CC common/cmd_setexpr.o
CC common/cmd_test.o
CC common/cmd_ubi.o
CC common/cmd_ubifs.o
CC drivers/usb/eth/smsc95xx.o
CC drivers/mtd/ubi/crc32.o
CC common/cmd_usb.o
CC common/usb.o
CC drivers/mtd/ubi/fastmap.o
LD drivers/usb/eth/built-in.o
CC drivers/usb/gadget/epautoconf.o
CC drivers/usb/gadget/config.o
CC common/usb_hub.o
CC common/cmd_ximg.o
CC drivers/usb/gadget/usbstring.o
CC common/flash.o
CC common/splash.o
CC common/cmd_nvedit.o
CC drivers/usb/gadget/ether.o
CC common/env_common.o
CC common/console.o
CC common/dlmalloc.o
CC drivers/usb/gadget/ci_udc.o
CC common/image.o
CC drivers/mtd/ubi/misc.o
CC common/image-fdt.o
CC drivers/mtd/ubi/debug.o
CC common/memsize.o
LD drivers/usb/gadget/built-in.o
CC common/stdio.o
CC drivers/usb/host/ehci-hcd.o
LD drivers/mtd/ubi/built-in.o
LD common/built-in.o
LD drivers/usb/musb/built-in.o
CC drivers/usb/host/ehci-mxs.o
LD drivers/usb/phy/built-in.o
LD drivers/usb/musb-new/built-in.o
LD drivers/usb/ulpi/built-in.o
CC fs/fs.o
LD fs/fat/built-in.o
CC fs/ubifs/ubifs.o
CC fs/ubifs/io.o
CC lib/lzo/lzo1x_decompress.o
LD drivers/usb/host/built-in.o
CC lib/libfdt/fdt.o
LD lib/lzo/built-in.o
CC fs/ubifs/super.o
CC lib/zlib/zlib.o
CC lib/libfdt/fdt_ro.o
CC fs/ubifs/sb.o
CC lib/libfdt/fdt_rw.o
CC fs/ubifs/master.o
CC lib/libfdt/fdt_strerror.o
CC lib/libfdt/fdt_sw.o
CC fs/ubifs/lpt.o
CC lib/libfdt/fdt_wip.o
CC lib/libfdt/fdt_empty_tree.o
LD lib/zlib/built-in.o
CC lib/crc7.o
CC lib/crc8.o
LD lib/libfdt/built-in.o
CC lib/crc16.o
CC lib/gunzip.o
CC lib/initcall.o
CC net/arp.o
CC lib/lmb.o
CC lib/ldiv.o
CC net/bootp.o
CC lib/net_utils.o
CC lib/qsort.o
CC net/eth.o
CC fs/ubifs/lpt_commit.o
CC fs/ubifs/scan.o
CC lib/strmhz.o
CC net/net.o
CC lib/rbtree.o
CC lib/list_sort.o
CC lib/hashtable.o
CC fs/ubifs/lprops.o
CC lib/errno.o
CC net/nfs.o
LD test/built-in.o
LD test/dm/built-in.o
CC lib/display_options.o
CC lib/crc32.o
CC fs/ubifs/tnc.o
CC net/tftp.o
CC lib/ctype.o
GEN include/spl-autoconf.mk
CC lib/div64.o
make[1]: *** No rule to make target 'lib/linux_compat.o', needed by 'lib/built-in.o'. Stop.
make[1]: *** Waiting for unfinished jobs....
CC lib/hang.o
LD net/built-in.o
CC fs/ubifs/tnc_misc.o
Makefile:1013: recipe for target 'lib' failed
make: *** [lib] Error 2
make: *** Waiting for unfinished jobs....
CC fs/ubifs/debug.o
AS spl/arch/arm/lib/crt0.o
CC fs/ubifs/crc16.o
CC spl/arch/arm/lib/sections.o
CC fs/ubifs/budget.o
CC spl/arch/arm/lib/interrupts.o
CC fs/ubifs/log.o
CC fs/ubifs/orphan.o
CC spl/arch/arm/lib/reset.o
CC fs/ubifs/recovery.o
CC spl/arch/arm/lib/cache.o
CC fs/ubifs/replay.o
CC spl/arch/arm/cpu/arm926ejs/cpu.o
CC spl/arch/arm/lib/cache-cp15.o
CC spl/arch/arm/cpu/arm926ejs/cache.o
AR spl/arch/arm/lib/lib.a
CC spl/arch/arm/lib/eabi_compat.o
LD spl/arch/arm/lib/built-in.o
CC spl/arch/arm/cpu/arm926ejs/mxs/clock.o
LD spl/arch/arm/cpu/arm926ejs/built-in.o
CC spl/board/lintech/airlino/iomux.o
CC spl/common/env_nand.o
LD fs/ubifs/built-in.o
LD fs/built-in.o
LD spl/board/lintech/airlino/built-in.o
CC spl/common/cmd_nvedit.o
CC spl/arch/arm/cpu/arm926ejs/mxs/mxs.o
CC spl/drivers/gpio/mxs_gpio.o
CC spl/common/env_common.o
CC spl/drivers/serial/serial.o
CC spl/arch/arm/cpu/arm926ejs/mxs/iomux.o
LD spl/drivers/gpio/built-in.o
LD spl/fs/built-in.o
CC spl/drivers/serial/serial_pl01x.o
CC spl/common/console.o
CC spl/arch/arm/cpu/arm926ejs/mxs/timer.o
CC spl/lib/hashtable.o
LD spl/drivers/serial/built-in.o
LD spl/arch/arm/cpu/built-in.o
CC spl/common/dlmalloc.o
CC spl/arch/arm/cpu/arm926ejs/mxs/spl_boot.o
CC spl/arch/arm/cpu/arm926ejs/mxs/spl_lradc_init.o
CC spl/lib/errno.o
LDS spl/u-boot-spl.lds
CC spl/lib/display_options.o
CC spl/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.o
CC spl/arch/arm/cpu/arm926ejs/mxs/spl_power_init.o
CC spl/lib/crc32.o
CC spl/common/image.o
AS spl/arch/arm/cpu/arm926ejs/mxs/start.o
CC spl/lib/ctype.o
CC spl/lib/div64.o
make[2]: *** No rule to make target 'spl/lib/linux_compat.o', needed by 'spl/lib/built-in.o'. Stop.
make[2]: *** Waiting for unfinished jobs....
CC spl/lib/hang.o
LD spl/arch/arm/cpu/arm926ejs/mxs/built-in.o
CC spl/common/image-fdt.o
CC spl/common/memsize.o
/home/joerg/Freescale/u-boot-testing/spl/Makefile:232: recipe for target 'spl/lib' failed
make[1]: *** [spl/lib] Error 2
make[1]: *** Waiting for unfinished jobs....
CC spl/common/stdio.o
LD spl/common/built-in.o
Makefile:1155: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

I cannot find any linux_compat.c files in u-boot-testing.

Quoted 225 lines · Heiko Schocher

resync mtd, ubi and ubifs subsystem with linux:

commit 455c6fdbd219161bd09b1165f11699d6d73de11c

Author: Linus Torvalds <[email protected]>
Date:   Sun Mar 30 20:40:15 2014 -0700
     Linux 3.14

Main reason for this sync is, we now have UBI fastmap support in U-Boot.

Tested it on am33xx, imx6 and mpc83xx boards. MAKEALL for arm and powerpc compiles clean.

Tested UBI fastmap on a board with 512 MiB nand flash. Attach time from old U-Boot was 2 seconds, reduced with UBI fastmap to 0.2 seconds.

Please test this patchserie!

The patches

lib, rbtree: resync with Linux-3.14
lib, list_sort: add list_sort from linux 3.14
mtd, ubi, ubifs: resync with Linux-3.14

are not checkpatch clean, as they use code from Linux and I do not want to change this.

Remarks:
- UBI Fastmap is now availiable in U-Boot
activate it with CONFIG_MTD_UBI_FASTMAP

- replace UBI_LINUX in current UBI code from U-Boot with __UBOOT__ as this define is used in other places in U-Boot where code from other projects is used.

- move a lot of defines from include/ubi_uboot.h to include/linux/compat.h, as this is the correcter place for it.

- add usb device to linux device, so usb uses "struct device" from "linux/compat.h"

- onenand changes only compile tested.

- Following Code in drivers/mtd/nand/nand_base.c nand_do_write_ops() adapted for U-Boot:

+#ifndef __UBOOT__

         /* Reject writes, which are not page aligned */
         if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {

+else
+ /* Reject writes, which are not page aligned */
+ if (NOTALIGNED(to)) {
+endif

as the original linux code leads in not working use of the env var "filesize". For example a "nand write 80000000 80000 ${filesize}" would not work with it ...

- add CONFIG_MTD_NAND_VERIFY_WRITE from U-Boot code (only compile tested)

- Documented the config defines in README

- kmalloc now uses memalign for allocating memory. This prevented crashes when tested ubi/ubifs on imx6 board.

- To produce this patch I did three steps:
- copied the linux source files to U-Boot tree -> commit this
- adapt license text in each file -> commit this
- make the code again compile clean and working -> commit this

Then squashed this three patches to this patch, to not break bisectability. To make further sync with linux easier, the above three patches can be found in:

   http://git.denx.de/?p=u-boot/u-boot-testing.git;a=shortlog;h=refs/heads/update-mtd%2Bubi-linux-v3.14

- Hope I get all U-Boot specific changes ... so please, test, test, test ...

Heiko Schocher (4):
dm: rename device struct to udevice
lib, rbtree: resync with Linux-3.14
lib, list_sort: add list_sort from linux 3.14
mtd, ubi, ubifs: resync with Linux-3.14

  README                              |   61 +
  arch/sandbox/include/asm/gpio.h     |    8 +-
  board/prodrive/alpr/nand.c          |    4 +
  board/socrates/nand.c               |    6 +
  board/tqc/tqm8272/nand.c            |    4 +
  common/cmd_demo.c                   |    4 +-
  common/cmd_gpio.c                   |    4 +-
  common/cmd_ubi.c                    |   31 +-
  common/cmd_ubifs.c                  |    2 +-
  doc/driver-model/README.txt         |    8 +-
  drivers/core/device.c               |   32 +-
  drivers/core/lists.c                |    8 +-
  drivers/core/root.c                 |    2 +-
  drivers/core/uclass.c               |   31 +-
  drivers/demo/demo-shape.c           |    6 +-
  drivers/demo/demo-simple.c          |    4 +-
  drivers/demo/demo-uclass.c          |    6 +-
  drivers/gpio/gpio-uclass.c          |   28 +-
  drivers/gpio/sandbox.c              |   34 +-
  drivers/mtd/mtdconcat.c             |  230 ++-
  drivers/mtd/mtdcore.c               | 1112 ++++++++++++-
  drivers/mtd/mtdcore.h               |   23 +
  drivers/mtd/mtdpart.c               |  521 +++++-
  drivers/mtd/nand/fsl_elbc_nand.c    |    4 +
  drivers/mtd/nand/fsl_ifc_nand.c     |    4 +
  drivers/mtd/nand/fsl_upm.c          |    4 +
  drivers/mtd/nand/mpc5121_nfc.c      |    4 +
  drivers/mtd/nand/mxc_nand.c         |    8 +
  drivers/mtd/nand/nand_base.c        | 1897 +++++++++++++++------
  drivers/mtd/nand/nand_bbt.c         |  296 ++--
  drivers/mtd/nand/nand_ids.c         |  256 +--
  drivers/mtd/nand/nand_util.c        |    3 +
  drivers/mtd/nand/ndfc.c             |    4 +
  drivers/mtd/onenand/onenand_base.c  |    1 +
  drivers/mtd/onenand/onenand_bbt.c   |    1 -
  drivers/mtd/onenand/samsung.c       |   10 +-
  drivers/mtd/ubi/Makefile            |    3 +-
  drivers/mtd/ubi/attach.c            | 1754 ++++++++++++++++++++
  drivers/mtd/ubi/build.c             |  812 ++++++---
  drivers/mtd/ubi/crc32.c             |   13 +-
  drivers/mtd/ubi/crc32table.h        |    2 +-
  drivers/mtd/ubi/debug.c             |  482 ++++--
  drivers/mtd/ubi/debug.h             |  178 +-
  drivers/mtd/ubi/eba.c               |  474 ++++--
  drivers/mtd/ubi/fastmap.c           | 1584 ++++++++++++++++++
  drivers/mtd/ubi/io.c                |  788 +++++----
  drivers/mtd/ubi/kapi.c              |  276 ++-
  drivers/mtd/ubi/misc.c              |   58 +-
  drivers/mtd/ubi/scan.c              | 1348 ---------------
  drivers/mtd/ubi/scan.h              |  153 --
  drivers/mtd/ubi/ubi-media.h         |  205 ++-
  drivers/mtd/ubi/ubi.h               |  626 +++++--
  drivers/mtd/ubi/upd.c               |  104 +-
  drivers/mtd/ubi/vmt.c               |  283 ++--
  drivers/mtd/ubi/vtbl.c              |  359 ++--
  drivers/mtd/ubi/wl.c                | 1590 +++++++++++-------
  drivers/usb/gadget/ether.c          |    5 -
  drivers/usb/gadget/storage_common.c |    5 -
  drivers/usb/musb-new/linux-compat.h |   58 -
  drivers/video/exynos_dp.c           |    1 +
  drivers/video/exynos_mipi_dsi.c     |    1 +
  fs/ubifs/budget.c                   |  662 +++++++-
  fs/ubifs/debug.c                    | 3132 ++++++++++++++++++++++++++++++++++-
  fs/ubifs/debug.h                    |  578 ++++---
  fs/ubifs/io.c                       |  897 +++++++++-
  fs/ubifs/key.h                      |   68 +-
  fs/ubifs/log.c                      |  663 +++++++-
  fs/ubifs/lprops.c                   |  538 +++++-
  fs/ubifs/lpt.c                      | 1242 +++++++++++++-
  fs/ubifs/lpt_commit.c               | 1903 ++++++++++++++++++++-
  fs/ubifs/master.c                   |  102 +-
  fs/ubifs/misc.h                     |  159 +-
  fs/ubifs/orphan.c                   |  671 +++++++-
  fs/ubifs/recovery.c                 |  738 ++++++---
  fs/ubifs/replay.c                   |  573 ++++---
  fs/ubifs/sb.c                       |  547 +++++-
  fs/ubifs/scan.c                     |  102 +-
  fs/ubifs/super.c                    | 2173 ++++++++++++++++++++----
  fs/ubifs/tnc.c                      |  742 ++++++++-
  fs/ubifs/tnc_misc.c                 |  124 +-
  fs/ubifs/ubifs-media.h              |   62 +-
  fs/ubifs/ubifs.c                    |  115 +-
  fs/ubifs/ubifs.h                    |  708 +++++---
  fs/yaffs2/ydirectenv.h              |    2 -
  include/asm-generic/global_data.h   |    2 +-
  include/asm-generic/gpio.h          |   22 +-
  include/dm-demo.h                   |   10 +-
  include/dm/device-internal.h        |   16 +-
  include/dm/device.h                 |   20 +-
  include/dm/lists.h                  |    4 +-
  include/dm/root.h                   |    4 +-
  include/dm/test.h                   |   12 +-
  include/dm/uclass-internal.h        |   10 +-
  include/dm/uclass.h                 |   18 +-
  include/linux/compat.h              |  327 +++-
  include/linux/err.h                 |   15 +-
  include/linux/list_sort.h           |   11 +
  include/linux/mtd/bbm.h             |   73 +-
  include/linux/mtd/concat.h          |    4 +
  include/linux/mtd/flashchip.h       |  105 ++
  include/linux/mtd/mtd.h             |  272 ++-
  include/linux/mtd/nand.h            |  350 +++-
  include/linux/mtd/partitions.h      |   60 +-
  include/linux/mtd/ubi.h             |  120 +-
  include/linux/rbtree.h              |  147 +-
  include/linux/rbtree_augmented.h    |  220 +++
  include/linux/usb/gadget.h          |    6 +-
  include/mtd/mtd-abi.h               |  195 ++-
  include/mtd/ubi-user.h              |  305 +++-
  include/ubi_uboot.h                 |  164 +-
  include/usb/lin_gadget_compat.h     |   16 -
  lib/Makefile                        |    2 +
  lib/list_sort.c                     |  298 ++++
  lib/rbtree.c                        |  684 +++++---
  test/dm/cmd_dm.c                    |   10 +-
  test/dm/core.c                      |   32 +-
  test/dm/gpio.c                      |    2 +-
  test/dm/test-driver.c               |   20 +-
  test/dm/test-fdt.c                  |   10 +-
  test/dm/test-main.c                 |    2 +-
  test/dm/test-uclass.c               |   15 +-
  121 files changed, 28221 insertions(+), 7686 deletions(-)

create mode 100644 drivers/mtd/mtdcore.h create mode 100644 drivers/mtd/ubi/attach.c create mode 100644 drivers/mtd/ubi/fastmap.c delete mode 100644 drivers/mtd/ubi/scan.c delete mode 100644 drivers/mtd/ubi/scan.h create mode 100644 include/linux/list_sort.h create mode 100644 include/linux/mtd/flashchip.h create mode 100644 include/linux/rbtree_augmented.h create mode 100644 lib/list_sort.c

Cc Marek Vasut <[email protected]>
Cc Sergey Lapin <[email protected]>
Cc Scott Wood <[email protected]>
Cc Wolfgang Denk <[email protected]>
#6 lore raw

cover mtd, ubi, ubifs: resync with Linux-3.14

Hello J?rg,

Am 21.05.2014 22:44, schrieb J?rg Krause:

Quoted 7 lines

Building for a custom Freescale i.MX28 board failed for me. Here is the output:

[joerg at timelineX u-boot-testing]$ export ARCH=arm [joerg at timelineX u-boot-testing]$ export CROSS_COMPILE=arm-linux-gnueabi-
[joerg at timelineX u-boot-testing]$ make mrproper CLEAN scripts/basic

[...]

Quoted 3 lines

CC spl/lib/ctype.o
CC spl/lib/div64.o
make[2]: *** No rule to make target 'spl/lib/linux_compat.o', needed

Argh, did forget a "git add lib/linux_compat.c" ... Sorry.

Quoted 16 lines

by 'spl/lib/built-in.o'. Stop.
make[2]: *** Waiting for unfinished jobs....
CC spl/lib/hang.o
LD spl/arch/arm/cpu/arm926ejs/mxs/built-in.o
CC spl/common/image-fdt.o
CC spl/common/memsize.o /home/joerg/Freescale/u-boot-testing/spl/Makefile:232: recipe for target 'spl/lib' failed
make[1]: *** [spl/lib] Error 2
make[1]: *** Waiting for unfinished jobs....
CC spl/common/stdio.o
LD spl/common/built-in.o
Makefile:1155: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

Quoted 1 line

I cannot find any linux_compat.c files in u-boot-testing.

I fixed this, patch and update in u-boot-testing follows ASAP, thanks for testing!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany