Skip to content
Commit 9e571d0b authored by Heiko Schocher's avatar Heiko Schocher
Browse files

mtd, ubi, ubifs: u-boot adaptions



- adapt the Linux code to compile and work with U-Boot.

- 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 correct place for it.

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

- 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

- 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 squash 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:

Signed-off-by: default avatarHeiko Schocher <hs@denx.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Sergey Lapin <slapin@ossfans.org>
Cc: Scott Wood <scottwood@freescale.com>

***

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!

- changes for v2:
  - add lib/linux_compat.c as Joerg Krause detected
parent 2df3d726
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment