]> git.ipfire.org Git - people/ms/u-boot.git/log
people/ms/u-boot.git
6 years agotest/overlay: Fix various malloc/free leaks
Tom Rini [Tue, 26 Sep 2017 16:43:12 +0000 (12:43 -0400)] 
test/overlay: Fix various malloc/free leaks

With the overlay tests now being built in sandbox Coverity has found a
number of issues in the tests.  In short, if malloc ever failed we would
leak the previous mallocs, so we need to do the usual goto pattern to
free each in turn.  Finally, we always looked at the free()d location to
see how many tests had failed for the return code.

Reported-by: Coverity (CID: 167224, 167227, 167230, 167236)
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoGPT: fix memory leaks identified by Coverity
Alison Chaiken [Tue, 26 Sep 2017 14:42:28 +0000 (07:42 -0700)] 
GPT: fix memory leaks identified by Coverity

Create a common exit for most of the error handling code in
do_rename_gpt_parts.   Delete the list elements in disk_partitions
before calling INIT_LIST_HEAD from get_gpt_info() a second time.

The SIZEOF_MISMATCH error is not addressed, since that problem was
already fixed by "GPT: incomplete initialization in
allocate_disk_part".

Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
Reported-by: Coverity (CID: 167222, 167235, 167237)
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agofs-test: Add test for a filename using '..' to go back to the root
Tuomas Tynkkynen [Mon, 25 Sep 2017 19:06:34 +0000 (22:06 +0300)] 
fs-test: Add test for a filename using '..' to go back to the root

The previous commit fixed a problem in FAT code where going back to the
root directory using '..' wouldn't work correctly on FAT12 or FAT16.
Add a test to exercise this case (which was once fixed in commit
18a10d46f26 "fat: handle paths that include ../" but reintroduced due to
the directory iterator refactoring).

This test only very barely catches the problem - without the fix the
size command still gives valid output but the additional spurious
"Invalid FAT entry" error message makes it not get caught in the
'egrep -A3 ' output. I tried to make a proper test that grows the root
directory to two clusters lots of with dummy files but that causes the
write tests to crash the sandbox totally...

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agofs/fat: Fix pathnames using '..' that lead to the root directory
Tuomas Tynkkynen [Mon, 25 Sep 2017 19:06:33 +0000 (22:06 +0300)] 
fs/fat: Fix pathnames using '..' that lead to the root directory

If we end up back in the root directory via a '..' directory entry, set
itr->is_root accordingly. Failing to do that gives spews like
"Invalid FAT entry" and being unable to access directory entries located
past the first cluster of the root directory.

Fixes: 8eafae209c35 ("fat/fs: convert to directory iterators")
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
6 years agofs-test: Add FAT16 support
Tuomas Tynkkynen [Mon, 25 Sep 2017 19:06:32 +0000 (22:06 +0300)] 
fs-test: Add FAT16 support

Currently we can only test FAT32 which is the default FAT version that
mkfs.vfat creates by default. Instead make it explicitly create either a
FAT16 or a FAT32 volume. This allows us to exercise more code, for
instance the root directory handling is done differently in FAT32 than
the older FATs.

Adding FAT12 support is a much bigger job since the test creates a 2.5GB
file and the FAT12 maximum partition size is way smaller than that.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agofs/ext4: Fix group descriptor checksum calculation
Tuomas Tynkkynen [Mon, 25 Sep 2017 19:06:31 +0000 (22:06 +0300)] 
fs/ext4: Fix group descriptor checksum calculation

The current code doesn't compute the group descriptor checksum correctly
for the filesystems that e2fsprogs 1.43.4 creates (they have
'Group descriptor size: 64' as reported by tune2fs). Extend the checksum
calculation to be done as ext4_group_desc_csum() does in Linux.

This fixes these errors in dmesg from running fs-test.sh and makes it
succeed again:

[1671902.620699] EXT4-fs (loop1): ext4_check_descriptors: Checksum for group 0 failed (35782!=10965)
[1671902.620706] EXT4-fs (loop1): group descriptors corrupted!

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
6 years agodoc: Fix statements on case sensitivity for regulator prefix
Felix Brack [Fri, 22 Sep 2017 12:27:28 +0000 (14:27 +0200)] 
doc: Fix statements on case sensitivity for regulator prefix

The regulator bindings state that regulator prefixes are allowd to be
in upper or lower case. However pmic_bind_children from pmic_uclass uses
strncmp to compare DT node name against prefix. This comparison is case
sensitive hence the regulator driver prefix case matters.

Signed-off-by: Felix Brack <fb@ltec.ch>
6 years agoomap: Fix warning when looking for userdata part
Sam Protsenko [Thu, 21 Sep 2017 22:51:59 +0000 (01:51 +0300)] 
omap: Fix warning when looking for userdata part

When eMMC was formattaed for Linux partition table, "userdata" partition
is missing. In this case, part_get_info_by_name() iterates over all
registered drivers (which are PART_TYPE_EFI, PART_TYPE_DOS and
PART_TYPE_ISO). And when it comes to PART_TYPE_ISO (which has empty
partition table), we can see next warning in U-Boot output:

    ** First descriptor is NOT a primary desc on 1:1 **

This patch switches to part_get_info_by_name_type() API in order to
check only EFI partitions for "userdata" partitions. This eliminates
mentioned warning.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodisk: Provide API to get partition by name for specific type
Sam Protsenko [Thu, 21 Sep 2017 22:51:58 +0000 (01:51 +0300)] 
disk: Provide API to get partition by name for specific type

There is already existing function part_get_info_by_name().
But sometimes user is particularly interested in looking for only
specific partition type. This patch implements such an API that
provides partition searching by name for specified partition type.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoomap: Omit fastboot.userdata_size related errors
Sam Protsenko [Thu, 21 Sep 2017 20:01:00 +0000 (23:01 +0300)] 
omap: Omit fastboot.userdata_size related errors

When using regular $partitions variable (for Linux boot), we can see
some unwanted messages:

> ERROR: cannot find partition: 'userdata'

> at arch/arm/mach-omap2/utils.c:96/omap_mmc_get_part_size()
> Warning: fastboot.userdata_size: unable to calc

Let's remove those, as missing 'userdata' partition is correct behavior
for Linux partition, and we don't want to see some Android-related
messages in this case.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
6 years agotravis.yml: Add job for running test.py in qemu_arm
Tuomas Tynkkynen [Tue, 19 Sep 2017 20:18:08 +0000 (23:18 +0300)] 
travis.yml: Add job for running test.py in qemu_arm

Note that this commit requires
https://github.com/swarren/uboot-test-hooks/pull/14 to go in first.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
6 years agoARM: Add a new arch + board for QEMU's 'virt' machine
Tuomas Tynkkynen [Tue, 19 Sep 2017 20:18:07 +0000 (23:18 +0300)] 
ARM: Add a new arch + board for QEMU's 'virt' machine

This board builds an U-Boot binary that is bootable with QEMU's 'virt'
machine on ARM. The minimal QEMU command line is:

    qemu-system-arm -machine virt,highmem=off -bios u-boot.bin

(Note that the 'highmem=off' parameter to the 'virt' machine is required for
PCI to work in U-Boot.) This command line enables the following:
    - u-boot.bin loaded and executing in the emulated flash at address 0x0
    - A generated device tree blob placed at the start of RAM
    - A freely configurable amount of RAM, described by the DTB
    - A PL011 serial port, discoverable via the DTB
    - An ARMv7 architected timer
    - PSCI for rebooting the system
    - A generic ECAM-based PCI host controller, discoverable via the DTB

Additionally, QEMU allows plugging a bunch of useful peripherals to the PCI bus.
The following ones are supported by both U-Boot and Linux:

- To add a Serial ATA disk via an Intel ICH9 AHCI controller, pass e.g.:
    -drive if=none,file=disk.img,id=mydisk -device ich9-ahci,id=ahci -device ide-drive,drive=mydisk,bus=ahci.0
- To add an Intel E1000 network adapter, pass e.g.:
    -net nic,model=e1000 -net user
- To add an EHCI-compliant USB host controller, pass e.g.:
    -device usb-ehci,id=ehci
- To add a NVMe disk, pass e.g.:
    -drive if=none,file=disk.img,id=mydisk -device nvme,drive=mydisk,serial=foo

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
6 years agoPCI: Add driver for a 'pci-host-ecam-generic' host controller
Tuomas Tynkkynen [Tue, 19 Sep 2017 20:18:06 +0000 (23:18 +0300)] 
PCI: Add driver for a 'pci-host-ecam-generic' host controller

QEMU emulates such a device with '-machine virt,highmem=off' on ARM.
The 'highmem=off' part is required for things to work as the PCI code
in U-Boot doesn't seem to support 64-bit BARs.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agopci: layerscape: Use pci_generic_mmap_{read, write}_config
Tuomas Tynkkynen [Tue, 19 Sep 2017 20:18:05 +0000 (23:18 +0300)] 
pci: layerscape: Use pci_generic_mmap_{read, write}_config

Use the new helpers to avoid boilerplate in the driver.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agopci: xilinx: Use pci_generic_mmap_{read, write}_config()
Tuomas Tynkkynen [Tue, 19 Sep 2017 20:18:04 +0000 (23:18 +0300)] 
pci: xilinx: Use pci_generic_mmap_{read, write}_config()

Use the new helper function to avoid boilerplate in the driver.

Note that this changes __raw_writel et al. to writel. AFAICT this is
no problem because:

- The Linux driver for the same hardware uses the non-__raw variants as
  well (via pci_generic_config_write()).
- This driver seems to be used only on MIPS so far, where the __raw and
  non-__raw accessors are the same.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agopci: Add helper for implementing memory-mapped config space accesses
Tuomas Tynkkynen [Tue, 19 Sep 2017 20:18:03 +0000 (23:18 +0300)] 
pci: Add helper for implementing memory-mapped config space accesses

This sort of pattern for implementing memory-mapped PCI config space
accesses appears in U-Boot twice already, and a third user is coming up.
So add helper functions to avoid code duplication, similar to how Linux
has pci_generic_config_write and pci_generic_config_read.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agoomap: detect board before spl_early_init()
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:33 +0000 (12:57 +0200)] 
omap: detect board before spl_early_init()

In order to be able to select the right DTB, we need to have identified the
board before spl_early_init() is called.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agospl: dm: Make it possible for the SPL to pick its own DTB from a FIT
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:32 +0000 (12:57 +0200)] 
spl: dm: Make it possible for the SPL to pick its own DTB from a FIT

u-boot can be embedded within a FIT image with multiple DTBs. It then
selects at run-time  which one is best suited for the platform.
Use the same principle here for the SPL: put the DTBs in a FIT image,
compress it (LZO, GZIP, or no compression) and append it at the end of the
SPL.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
[trini: Move default y of SPL_MULTI_DTB_FIT_DYN_ALLOC to it being the
default choice if SYS_MALLOC_F, drop spl.h include from lib/fdtdec.c
it's unused.]
Signed-off-by Tom Rini <trini@konsulko.com>

6 years agofdtdec: sort include files
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:31 +0000 (12:57 +0200)] 
fdtdec: sort include files

Sort include files in accordance to U-Boot coding style.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
6 years agolib: allow building lzo for the SPL
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:30 +0000 (12:57 +0200)] 
lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agogzip: add a function to parse the header
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:29 +0000 (12:57 +0200)] 
gzip: add a function to parse the header

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agolzo: add a function to check the validity of the header
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:28 +0000 (12:57 +0200)] 
lzo: add a function to check the validity of the header

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agofit: If no matching config is found in fit_find_config_node(), use the default one
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:27 +0000 (12:57 +0200)] 
fit: If no matching config is found in fit_find_config_node(), use the default one

If board_fit_config_name_match() doesn't match any configuration node,
then use the default one (if provided).

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agofit: fixed bug in locate_dtb_in_fit()
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:26 +0000 (12:57 +0200)] 
fit: fixed bug in locate_dtb_in_fit()

If the dtb is the first data of the FIT, the its offset is 0x0. Change the
test to '<' instead of '<='

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agofit: use 'const' for the input of fdt_offset() and locate_dtb_in_fit()
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:25 +0000 (12:57 +0200)] 
fit: use 'const' for the input of fdt_offset() and locate_dtb_in_fit()

Those 2 functions don't modify their input, we can mark it const.
This prevents compilation warnings when they are provided const input.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodts: renamed FIT_EMBED to MULTI_DTB_FIT and moved it to the dts Kconfig
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:24 +0000 (12:57 +0200)] 
dts: renamed FIT_EMBED to MULTI_DTB_FIT and moved it to the dts Kconfig

CONFIG_FIT_EMBED might be confused with CONFIG_OF_EMBED, rename it
MULTI_DTB_FIT as it is able to get a DTB from a FIT image containing
multiple DTBs. Also move the option to the Kconfig dedicated to the DTS
options and create a README for this feature.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agolinux/kernel.h: import DIV_ROUND_{DOWN, UP}_ULL from Linux
Masahiro Yamada [Wed, 13 Sep 2017 10:16:44 +0000 (19:16 +0900)] 
linux/kernel.h: import DIV_ROUND_{DOWN, UP}_ULL from Linux

These macros are useful to avoid link error on 32-bit systems.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agodisk: part_dos: Use the original allocation scheme for the SPL case
Fabio Estevam [Wed, 4 Oct 2017 16:29:57 +0000 (13:29 -0300)] 
disk: part_dos: Use the original allocation scheme for the SPL case

Since commit ff98cb90514d ("part: extract MBR signature from partitions")
SPL boot on i.MX6 starts to fail:

U-Boot SPL 2017.09-00221-g0d6ab32 (Oct 02 2017 - 15:13:19)
Trying to boot from MMC1
(keep in loop)

Use the original allocation scheme for the SPL case, so that MX6 boards
can boot again.

This is a temporary solution to avoid the boot regression.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
6 years agoMerge git://git.denx.de/u-boot-sunxi
Tom Rini [Thu, 5 Oct 2017 12:26:36 +0000 (08:26 -0400)] 
Merge git://git.denx.de/u-boot-sunxi

6 years agocommon: Drop LOGLEVEL to 4
Tom Rini [Wed, 4 Oct 2017 20:44:30 +0000 (16:44 -0400)] 
common: Drop LOGLEVEL to 4

While this came in with a default value of 6 I am lowering this to 4.
The MTD/UBI code has a large number of error messages that we include
now.  In addition, "normally" warning messages are not included so this
feels like a more natural level to have.

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agodm: replace dm_dbg() with pr_debug()
Masahiro Yamada [Fri, 29 Sep 2017 03:31:20 +0000 (12:31 +0900)] 
dm: replace dm_dbg() with pr_debug()

As we discussed before in ML, dm_dbg() causes undefined reference
error if #define DEBUG is added to users, but not drivers/core/util.c

We do not need this macro because we can use pr_debug() instead, and
it is pretty easy to enable it for the DM core by using ccflags-y.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agolinux/bitfield.h: import <linux/bitfield.h> from Linux 4.13
Masahiro Yamada [Fri, 29 Sep 2017 01:35:17 +0000 (10:35 +0900)] 
linux/bitfield.h: import <linux/bitfield.h> from Linux 4.13

Copied from Linux 4.13.

Commit log of 3e9b3112ec74 of Linux explains well why this header
is useful.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agodm: define dev_*() log functions in DM header
Masahiro Yamada [Tue, 26 Sep 2017 02:58:29 +0000 (11:58 +0900)] 
dm: define dev_*() log functions in DM header

Many drivers had started to use dev_err, dev_info, etc. for log
functions.  Currently, we are relying on <linux/compat.h>, but I
guess the best home is <dm/device.h>, taking into account that
Linux defines them in <linux/device.h>.

For now, I am leaving the ones in <linux/compat.h> because lots of
Linux-originated code uses dev_*(), but the first argument is not
struct udevice, so we need to ignore the bogus argument.  More
efforts are needed to iron out the issues.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agobug.h: move runtime BUG/WARN macros into <linux/bug.h>
Masahiro Yamada [Sat, 16 Sep 2017 05:10:45 +0000 (14:10 +0900)] 
bug.h: move runtime BUG/WARN macros into <linux/bug.h>

Collect runtime BUG/WARN into a self-contained header <linux/bug.h>
to make these macros easier to use.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agobug.h: sync BUILD_BUG stuff with Linux 4.13
Masahiro Yamada [Sat, 16 Sep 2017 05:10:44 +0000 (14:10 +0900)] 
bug.h: sync BUILD_BUG stuff with Linux 4.13

As commit 84b8bf6d5d2a ("bug.h: move BUILD_BUG_* defines to
include/linux/bug.h") noted, include/linux/bug.h was locally
modified for U-Boot because the name conflict of error() caused
build errors at that time.

Now error() is gone, so we can fully sync BUILD_BUG* with Linux.
These macros are just compile-time utilities.  Nothing depends on
platform code, so it should make sense to simply copy Linux's ones.

Please note Linux split BUILD_BUG stuff out into <linux/build_bug.h>
by commit bc6245e5efd7.  Let's follow it.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agovsprintf.h: include <linux/types.h>
Masahiro Yamada [Sat, 16 Sep 2017 05:10:43 +0000 (14:10 +0900)] 
vsprintf.h: include <linux/types.h>

This header uses ulong, size_t, loff_t.
Include <linux/types.h> to make this header self-contained.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agocommon.h: remove error()
Masahiro Yamada [Sat, 16 Sep 2017 05:10:42 +0000 (14:10 +0900)] 
common.h: remove error()

This macro prevents us from using compiletime_error/assert defined
in <linux/compiler.h>.

Now we can remove it, then we will be able to import more BUILD_BUG
macros from Linux.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agotreewide: replace with error() with pr_err()
Masahiro Yamada [Sat, 16 Sep 2017 05:10:41 +0000 (14:10 +0900)] 
treewide: replace with error() with pr_err()

U-Boot widely uses error() as a bit noisier variant of printf().

This macro causes name conflict with the following line in
include/linux/compiler-gcc.h:

  # define __compiletime_error(message) __attribute__((error(message)))

This prevents us from using __compiletime_error(), and makes it
difficult to fully sync BUILD_BUG macros with Linux.  (Notice
Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().)

Let's convert error() into now treewide-available pr_err().

Done with the help of Coccinelle, excluing tools/ directory.

The semantic patch I used is as follows:

// <smpl>
@@@@
-error
+pr_err
 (...)
// </smpl>

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Re-run Coccinelle]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoprintk: collect printk stuff into <linux/printk.h> with loglevel support
Masahiro Yamada [Sat, 16 Sep 2017 05:10:40 +0000 (14:10 +0900)] 
printk: collect printk stuff into <linux/printk.h> with loglevel support

When we import code from Linux, with regular re-sync planned, we want
to use printk() and pr_*().  U-Boot does not support them in a clean
way.  So, people end up with local macros, or compat headers here and
there, then we occasionally see build errors of definition conflicts.

We have include/linux/compat.h, but putting all sorts of unrelated
things into a single header is just a temporal workaround.  Hence this
patch, to find the best home for all printk variants.  If you want to
use printk() and friends, please include <linux/printk.h>.  This header
is self-contained, and pulls in only a few headers.

When I was testing this clean-up, I noticed the image size exceeded
its platform limit on some boards.  This is because all pr_*() that
were previously defined as no-op in include/linux/mtd/mtd.h (unless
CONFIG_MTD_DEBUG is set), are now enabled.

To make such boards happy, this commit also implements CONFIG_LOGLEVEL.
The concept is similar to the kernel parameter "loglevel".  (Actually,
the Kconfig help message was taken from kernel-paremeter.txt of Linux)
Messages with a loglevel smaller than console loglevel will be printed.

The difference is the loglevel is build-time determined.  To save the
image size, lower priority pr_*() are compiled out.  I set the default
of CONFIG_LOGLEVEL to 6, i.e. pr_notice and higher priority messages
are compiled in.

I adjusted CONFIG_LOGLEVEL to avoid build error for some boards.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Add in SPL_LOGLEVEL that is the same as LOGLEVEL]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agostdio.h: move printf() stuff from <common.h> to <stdio.h>
Masahiro Yamada [Sat, 16 Sep 2017 05:10:39 +0000 (14:10 +0900)] 
stdio.h: move printf() stuff from <common.h> to <stdio.h>

<common.h> pulls in a lot of headers.  Including it from every .c
file is a bad idea.  We need to remove contents until it contains
nothing.

Move printf() and friends to <stdio.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agosunxi: only init USB Ethernet gadget when it's enabled
Icenowy Zheng [Thu, 28 Sep 2017 14:16:38 +0000 (22:16 +0800)] 
sunxi: only init USB Ethernet gadget when it's enabled

If the USB Ethernet gadget is not yet enabled, the call of
usb_ether_init in board/sunxi/board.c will lead to undefined reference
error when building.

Fix this problem.

Fixes: 50ddbf1199a0 ("sunxi: Register usb_ether")
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosunxi: usb_phy: invert the USB phy_ctl condition
Maxime Ripard [Wed, 23 Aug 2017 11:31:08 +0000 (13:31 +0200)] 
sunxi: usb_phy: invert the USB phy_ctl condition

All the new SoCs from Allwinner since the A33 have had the phy_ctl offset
at 0x410 instead of 0x404 that was used on the previous SoCs.

Instead of adding more and more special cases as the number of SoCs grow,
let's invert the test to have 0x410 by default, and the (hopefully) fixed
number of old SoCs being the exception.

Suggested-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Suggested-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agosun7i: a20: Add Bananapi M1 Plus support
Jagan Teki [Sun, 20 Aug 2017 05:40:05 +0000 (11:10 +0530)] 
sun7i: a20: Add Bananapi M1 Plus support

Banana Pi M1 Plus is an open-source single-board computer
that adds more connectivity to the classic board using
Allwinner A20 SOC.

Bananapi M1-Plus features:
- A20 Dual-core 1.0GHz
- 1 GB DDR3 SDRAM
- MicroSD
- 10/100/1000 Ethernet RJ45
- WiFi b/g/n
- 5V DC Micro USB power-supply

For dts file,
Sync with Linux commit f92ca09("Merge branch 'akpm/master'").

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agosunxi: defaultly enable SPL for Lichee Pi Zero
Icenowy Zheng [Mon, 14 Aug 2017 15:00:11 +0000 (23:00 +0800)] 
sunxi: defaultly enable SPL for Lichee Pi Zero

As we have already DRAM initialization code for V3s SoC, we can
defaultly enable SPL now on Lichee Pi Zero.

Add CONFIG_SPL in Lichee Pi Zero defconfig.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agosunxi: Enable eMMC on Cubietruck Plus
Chen-Yu Tsai [Fri, 22 Sep 2017 07:26:28 +0000 (15:26 +0800)] 
sunxi: Enable eMMC on Cubietruck Plus

Set CONFIG_MMC_SUNXI_SLOT_EXTRA=2 to enable the eMMC controller to
access eMMC on the board.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosunxi: rename Bananapi M3 dts file name
Chen-Yu Tsai [Fri, 22 Sep 2017 07:26:27 +0000 (15:26 +0800)] 
sunxi: rename Bananapi M3 dts file name

The upstream (Linux) device tree file for the Bananapi M3 follows the
convention of using the well known brand name, instead of the vendor
name, for naming. The file was recently added to upstream in commit
359b5a1e1c2d ("ARM: sun8i: a83t: Add device tree for Sinovoip Bananapi
BPI-M3")

Rename the device tree file in U-boot to match.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosunxi: Fix USB_GADGET implication
Maxime Ripard [Fri, 22 Sep 2017 07:51:37 +0000 (09:51 +0200)] 
sunxi: Fix USB_GADGET implication

USB_GADGET will fail to compile if USB_MUSB_GADGET is not defined. Make
sure we have that condition right.

Fixes: e0ea88042d51 ("sunxi: Imply USB_ETHER")
Suggested-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosunxi: Remove the MMC index hack
Maxime Ripard [Wed, 23 Aug 2017 08:12:22 +0000 (10:12 +0200)] 
sunxi: Remove the MMC index hack

The current code, if there's both an eMMC and an MMC slot available on the
board, will swap the MMC indices based on whether we booted from the eMMC
or the MMC. This way, the MMC we're supposed to boot on will always have
the index 0.

However, this causes various issues, for example when using other
components that base their behaviour on the MMC index, such as fastboot.

Let's remove that hack, and take the opposite approach. The MMC will always
have the same index, but the bootcmd will pick the same device than the one
we booted from. This is done through the introduction of the mmc_bootdev
environment variable that will be filled by the board code based on the
boot device informations we can get from the SoC.

In order to not introduce regressions, we also need to adjust the fastboot
MMC device and the environment device in order to set it to the eMMC, over
the MMC, like it used to be the case.

Tested-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosunxi: Use sunxi_get_boot_device
Maxime Ripard [Wed, 23 Aug 2017 08:08:29 +0000 (10:08 +0200)] 
sunxi: Use sunxi_get_boot_device

Our current board code duplicates a bit the sunxi_get_boot_device logic.
Now that we can use that function in the full-flavoured U-Boot, remove that
duplication and call the function instead.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agoarm: sunxi: Move spl_boot_device in a separate function
Maxime Ripard [Wed, 23 Aug 2017 08:06:30 +0000 (10:06 +0200)] 
arm: sunxi: Move spl_boot_device in a separate function

U-Boot itself might need to identify the boot device, for example to be
able to tell where to load the kernel from when several options are
possible.

Move the logic of spl_boot_device to a function that is compiled both for
the SPL and the main binary.

Tested-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosunxi: Add support for A20-OLinuXino-MICRO-eMMC
Stefan Mavrodiev [Thu, 21 Sep 2017 13:00:16 +0000 (16:00 +0300)] 
sunxi: Add support for A20-OLinuXino-MICRO-eMMC

From rev.J A20-OLinuXino-MICRO has eMMC option. For now this is
only 4GB, but in the future size may increase.

The dts file is the same from mainline kernel.

Signed-off-by: Stefan Mavrodiev <stefan@olimex.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosunxi: Enable CMD_GPT by default
Maxime Ripard [Thu, 24 Aug 2017 09:54:03 +0000 (11:54 +0200)] 
sunxi: Enable CMD_GPT by default

GPT is pretty common these days and can be useful for things like fastboot.
Add a platform imply, so that users can still opt out if they wish so.

Reviewed-by: Jagan Teki <jagan@openedev.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agocmd: Move CONFIG_RANDOM_UUID to Kconfig
Maxime Ripard [Thu, 24 Aug 2017 09:52:32 +0000 (11:52 +0200)] 
cmd: Move CONFIG_RANDOM_UUID to Kconfig

CONFIG_RANDOM_UUID is used by the GPT command to generate random UUID when
none are provided.

Move that option to Kconfig.

Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosunxi: sina33: Sync the device tree with the kernel
Maxime Ripard [Tue, 5 Sep 2017 18:59:04 +0000 (20:59 +0200)] 
sunxi: sina33: Sync the device tree with the kernel

The kernel DT of the SinA33 has evolved quite a bit. Make sure we sync it
and its upstream DTSI to be able to use the OTG. The DTs were taken from
the 4.13 kernel release.

Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosunxi: Imply USB_ETHER
Maxime Ripard [Thu, 7 Sep 2017 18:40:42 +0000 (20:40 +0200)] 
sunxi: Imply USB_ETHER

Now that we can enable the usb_ether gadget, do it. This will be especially
useful for boards that don't have any ethernet controller, such as the ones
based on the A13 or A33.

Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosunxi: Register usb_ether
Maxime Ripard [Wed, 6 Sep 2017 20:25:03 +0000 (22:25 +0200)] 
sunxi: Register usb_ether

Call the function to register the usb_ether gadget in the board.

Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agomusb: sunxi: switch to the device model
Maxime Ripard [Tue, 5 Sep 2017 20:10:35 +0000 (22:10 +0200)] 
musb: sunxi: switch to the device model

The device model was implemented so far using a hook that needed to be
called from the board support, without DT support and only for the host.

Switch to probing both in peripheral and host mode through the DT.

Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agocmd: fastboot: Rework fastboot dependency
Maxime Ripard [Thu, 7 Sep 2017 08:29:51 +0000 (10:29 +0200)] 
cmd: fastboot: Rework fastboot dependency

Fastboot need a bunch of options to be operating properly, such as the
g_dnl gadget, the fastboot command, and some options that make sense. Since
fastboot is now part of Kconfig, make sure we have them right.

That will also reduce the boilerplate in the defconfigs.

Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosunxi: imply USB_GADGET
Maxime Ripard [Thu, 7 Sep 2017 08:46:24 +0000 (10:46 +0200)] 
sunxi: imply USB_GADGET

A good number of our boards have USB_GADGET enabled. Imply it so that all
the boards can benefit from it, and remove some boilerplate from our
defconfigs.

Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosunxi: provide default USB gadget setup
Maxime Ripard [Tue, 12 Sep 2017 17:41:15 +0000 (19:41 +0200)] 
sunxi: provide default USB gadget setup

All the Allwinner boards use the same manufacturer, VID and PID for the
gadgets. Make them the defaults to remove some boilerplate from our
defconfigs.

Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agousb: gadget: usb_ether: Move settings to common
Maxime Ripard [Thu, 7 Sep 2017 07:15:08 +0000 (09:15 +0200)] 
usb: gadget: usb_ether: Move settings to common

The usb_ether gadget duplicates the USB settings for the manufacturer,
product ID and vendor ID.

Make sure we use the common option so that we can expect a single VID/PID
couple for a single device.

Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agousb: gadget: Make g_dnl USB settings common
Maxime Ripard [Thu, 7 Sep 2017 06:58:08 +0000 (08:58 +0200)] 
usb: gadget: Make g_dnl USB settings common

The g_dnl USB settings for the vendor ID, product ID and manufacturer are
actually common settings that can and should be shared by all the gadgets.

Make them common by renaming them, and convert all the users.

Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agousb: gadget: usb_ether: Move the interfaces to Kconfig
Maxime Ripard [Thu, 7 Sep 2017 06:46:14 +0000 (08:46 +0200)] 
usb: gadget: usb_ether: Move the interfaces to Kconfig

We need to select an interface for the usb_ether gadget, and they haven't
been converted to Kconfig yet. Add a choice to make sure we have an option
selected, and convert all the users.

Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agousb: gadget: Convert USB_ETHER to Kconfig
Maxime Ripard [Wed, 6 Sep 2017 21:23:21 +0000 (23:23 +0200)] 
usb: gadget: Convert USB_ETHER to Kconfig

The USB Ethernet gadget option has not yet been moved to Kconfig, let's
deal with that.

Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agousb: gadget: Move USBNET_HOST_ADDR to Kconfig
Maxime Ripard [Wed, 6 Sep 2017 20:53:43 +0000 (22:53 +0200)] 
usb: gadget: Move USBNET_HOST_ADDR to Kconfig

While the USB Ethernet device address is already defined in Kconfig, the
host address isn't. Convert it.

Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agousb: gadget: Document USBNET_DEVADDR
Maxime Ripard [Tue, 12 Sep 2017 16:32:45 +0000 (18:32 +0200)] 
usb: gadget: Document USBNET_DEVADDR

Add an help about the USBNET_DEVADDR Kconfig option to make it clearer what
it's about.

Acked-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agousb: gadget: Move USBNET_DEVADDR option out of g_dnl
Maxime Ripard [Wed, 6 Sep 2017 20:54:52 +0000 (22:54 +0200)] 
usb: gadget: Move USBNET_DEVADDR option out of g_dnl

The USBNET_DEVADDR has nothing to do with the USB download gadget, but
rather with the USB Ethernet gadget. Move it out of the if statement.

Acked-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosandbox: Expand list of IO accessors
Maxime Ripard [Mon, 2 Oct 2017 13:25:56 +0000 (15:25 +0200)] 
sandbox: Expand list of IO accessors

The setbits/clrbits/clrsetbits macros are used widely across the tree,
let's provide implementation for them in the sandbox.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agosandbox: Enable btrfs support
Tom Rini [Tue, 3 Oct 2017 12:44:55 +0000 (08:44 -0400)] 
sandbox: Enable btrfs support

For better test coverage, enable btrfs.

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agofs/btrfs: Fix warning in btrfs_check_super()
Tom Rini [Tue, 3 Oct 2017 12:44:13 +0000 (08:44 -0400)] 
fs/btrfs: Fix warning in btrfs_check_super()

We specifically say that the last arg is u32, so use %lu.

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agosandbox: Use asm-generic/io.h
Paul Burton [Thu, 14 Sep 2017 22:05:13 +0000 (15:05 -0700)] 
sandbox: Use asm-generic/io.h

Convert the sandbox architecture to make use of the new asm-generic/io.h
to provide address mapping functions. As sandbox actually performs
non-identity mapping between physical & virtual addresses we can't
simply make use of the generic mapping functions, but are able to
implement phys_to_virt() & make use of it from map_physmem().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
6 years agopowerpc: Use asm-generic/io.h
Paul Burton [Thu, 14 Sep 2017 22:05:12 +0000 (15:05 -0700)] 
powerpc: Use asm-generic/io.h

Convert the powerpc architecture to make use of the new asm-generic/io.h
to provide address mapping functions. As powerpc can actually perform
non-identity mapping between physical & virtual addresses we can't
simply make use of the generic phys_to_virt() & virt_to_phys()
functions. However since map_physmem() already effectively implemented
the same thing as virt_to_phys() we can simply implement virt_to_phys()
instead of map_physmem() & use the generic map_physmem(). We also drop
the no-op unmap_physmem().

This has only been build-tested, feedback from architecture maintainers
is welcome.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Wolfgang Denk <wd@denx.de>
6 years agonios2: Use asm-generic/io.h
Paul Burton [Thu, 14 Sep 2017 22:05:11 +0000 (15:05 -0700)] 
nios2: Use asm-generic/io.h

Convert the nios2 architecture to make use of the new asm-generic/io.h to
provide address mapping functions. As nios2 actually performs
non-identity mapping between physical & virtual addresses we can't
simply make use of the generic functions, with the exception of being
able to drop our no-op unmap_physmem() and definitions of unused map
flags.

Feedback from architecture maintainers is welcome.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
6 years agomips: Use asm-generic/io.h
Paul Burton [Thu, 14 Sep 2017 22:05:10 +0000 (15:05 -0700)] 
mips: Use asm-generic/io.h

Convert the mips architecture to make use of the new asm-generic/io.h to
provide address mapping functions. As mips actually performs
non-identity mapping between physical & virtual addresses we can't
simply make use of the generic functions, with the exception of being
able to drop our no-op unmap_physmem() and definitions of unused map
flags.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agoxtensa: Use asm-generic/io.h
Paul Burton [Thu, 14 Sep 2017 22:05:09 +0000 (15:05 -0700)] 
xtensa: Use asm-generic/io.h

Convert the xtensa architecture to make use of the new asm-generic/io.h
to provide address mapping functions. As the generic implementations are
suitable for xtensa this is primarily a matter of moving code.

This has only been build-tested, feedback from architecture maintainers
is welcome.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
6 years agox86: Use asm-generic/io.h
Paul Burton [Thu, 14 Sep 2017 22:05:08 +0000 (15:05 -0700)] 
x86: Use asm-generic/io.h

Convert the x86 architecture to make use of the new asm-generic/io.h to
provide address mapping functions. As the generic implementations are
suitable for x86 this is primarily a matter of moving code.

This has only been build-tested, feedback from architecture maintainers
is welcome.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agosh: Use asm-generic/io.h
Paul Burton [Thu, 14 Sep 2017 22:05:07 +0000 (15:05 -0700)] 
sh: Use asm-generic/io.h

Convert the sh architecture to make use of the new asm-generic/io.h to
provide address mapping functions. As the generic implementations are
suitable for sh this is primarily a matter of moving code.

Feedback from architecture maintainers is welcome.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agonds32: Use asm-generic/io.h
Paul Burton [Thu, 14 Sep 2017 22:05:06 +0000 (15:05 -0700)] 
nds32: Use asm-generic/io.h

Convert the nds32 architecture to make use of the new asm-generic/io.h
to provide address mapping functions. As the generic implementations are
suitable for nds32 this is primarily a matter of removing code.

Feedback from architecture maintainers is welcome.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Macpaul Lin <macpaul@andestech.com>
6 years agomicroblaze: Use asm-generic/io.h
Paul Burton [Thu, 14 Sep 2017 22:05:05 +0000 (15:05 -0700)] 
microblaze: Use asm-generic/io.h

Convert the microblaze architecture to make use of the new
asm-generic/io.h to provide address mapping functions. As the generic
implementations are suitable for microblaze this is primarily a matter
of removing code.

Feedback from architecture maintainers is welcome.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Michal Simek <monstr@monstr.eu>
6 years agom68k: Use asm-generic/io.h
Paul Burton [Thu, 14 Sep 2017 22:05:04 +0000 (15:05 -0700)] 
m68k: Use asm-generic/io.h

Convert the m68k architecture to make use of the new asm-generic/io.h to
provide address mapping functions. As the generic implementations are
suitable for m68k this is primarily a matter of emoving code.

Feedback from architecture maintainers is welcome.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Huan Wang <alison.wang@freescale.com>
Cc: Angelo Dureghello <angelo@sysam.it>
Acked-by: Angelo Dureghello <angelo@sysam.it>
Tested-by: Angelo Dureghello <angelo@sysam.it>
6 years agoarm: Use asm-generic/io.h
Paul Burton [Thu, 14 Sep 2017 22:05:03 +0000 (15:05 -0700)] 
arm: Use asm-generic/io.h

Convert the arm architecture to make use of the new asm-generic/io.h to
provide address mapping functions. As the generic implementations are
suitable for arm this is primarily a matter of removing code.

This has only been build-tested, feedback from architecture maintainers
is welcome.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoarc: Use asm-generic/io.h
Paul Burton [Thu, 14 Sep 2017 22:05:02 +0000 (15:05 -0700)] 
arc: Use asm-generic/io.h

Convert the arc architecture to make use of the new asm-generic/io.h to
provide address mapping functions. As the generic implementations are
suitable for arc this is primarily a matter of removing code.

Feedback from architecture maintainers is welcome.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoProvide a generic io.h & address mapping functions
Paul Burton [Thu, 14 Sep 2017 22:05:01 +0000 (15:05 -0700)] 
Provide a generic io.h & address mapping functions

Most architectures currently supported by U-Boot use trivial
implementations of map_to_physmem & virt_to_phys which simply cast a
physical address to a pointer for use a virtual address & vice-versa.
This results in a lot of duplicate implementations of these mapping
functions.

The set of functions provided by different architectures also differs,
with some having implementations of phys_to_virt & others not. A later
patch will make use of phys_to_virt in architecture-neutral code, and so
requires that it be provided for all architectures.

This patch introduces an asm-generic/io.h which provides generic
implementations of address mapping functions, allowing the duplication
of them between architectures to be removed. Once architectures are
converted to make use of this generic header it will also ensure that
all of phys_to_virt, virt_to_phys, map_physmem & unmap_physmem are
provided. The 2 families of functions differ in that map_physmem may
create dynamic mappings whilst phys_to_virt may not & therefore is more
limited in scope but doesn't require information such as a length &
flags.

This patch doesn't convert any architectures to make use of this generic
header - later patches in the series will do so.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
Cc: Angelo Dureghello <angelo@sysam.it>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Macpaul Lin <macpaul@andestech.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Thomas Chou <thomas@wytron.com.tw>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Angelo Dureghello <angelo@sysam.it>
Tested-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agomvebu: turris_omnia: Add CONFIG_CMD_BTRFS to defconfig
Marek Behún [Sun, 3 Sep 2017 15:00:31 +0000 (17:00 +0200)] 
mvebu: turris_omnia: Add CONFIG_CMD_BTRFS to defconfig

Signed-off-by: Marek Behun <marek.behun@nic.cz>
6 years agocmd: Add the 'btrsubvol' command to list BTRFS subvolumes
Marek Behún [Sun, 3 Sep 2017 15:00:30 +0000 (17:00 +0200)] 
cmd: Add the 'btrsubvol' command to list BTRFS subvolumes

Signed-off-by: Marek Behun <marek.behun@nic.cz>
 create mode 100644 cmd/btrfs.c

6 years agofs: btrfs: Add U-Boot fs handlers.
Marek Behún [Sun, 3 Sep 2017 15:00:29 +0000 (17:00 +0200)] 
fs: btrfs: Add U-Boot fs handlers.

Signed-off-by: Marek Behun <marek.behun@nic.cz>
 create mode 100644 fs/btrfs/Kconfig
 create mode 100644 fs/btrfs/Makefile
 create mode 100644 fs/btrfs/btrfs.c
 create mode 100644 include/btrfs.h

6 years agofs: btrfs: Add single-device read-only BTRFS implementation
Marek Behún [Sun, 3 Sep 2017 15:00:28 +0000 (17:00 +0200)] 
fs: btrfs: Add single-device read-only BTRFS implementation

This adds the proper implementation for the BTRFS filesystem.
The implementation currently supports only read-only mode and
the filesystem can be only on a single device.

Checksums of data chunks is unimplemented.

Compression is implemented (ZLIB + LZO).

Signed-off-by: Marek Behun <marek.behun@nic.cz>
 create mode 100644 fs/btrfs/btrfs.h
 create mode 100644 fs/btrfs/chunk-map.c
 create mode 100644 fs/btrfs/compression.c
 create mode 100644 fs/btrfs/ctree.c
 create mode 100644 fs/btrfs/dev.c
 create mode 100644 fs/btrfs/dir-item.c
 create mode 100644 fs/btrfs/extent-io.c
 create mode 100644 fs/btrfs/hash.c
 create mode 100644 fs/btrfs/inode.c
 create mode 100644 fs/btrfs/root.c
 create mode 100644 fs/btrfs/subvolume.c
 create mode 100644 fs/btrfs/super.c

6 years agofs: btrfs: Add disk-to-cpu and cpu-to-disk conversion functions
Marek Behún [Sun, 3 Sep 2017 15:00:27 +0000 (17:00 +0200)] 
fs: btrfs: Add disk-to-cpu and cpu-to-disk conversion functions

BTRFS on disk structures are stored in Little Endian. Add functions
to convert this structures to cpu and to disk format.

On Little Endian hosts, these functions do nothing.

On Big Endian the CALL_MACRO_FROM_EACH from variadic-macro.h is used
to define all the members for each structure on which cpu_to_le* or
le*_to_cpu is to be called.

Signed-off-by: Marek Behun <marek.behun@nic.cz>
 create mode 100644 fs/btrfs/conv-funcs.h

6 years agofs: btrfs: Add btrfs_tree.h and ctree.h from Linux (and modified)
Marek Behún [Sun, 3 Sep 2017 15:00:26 +0000 (17:00 +0200)] 
fs: btrfs: Add btrfs_tree.h and ctree.h from Linux (and modified)

Add btrfs_tree.h and ctree.h from Linux which contains constants
and structures for the BTRFS filesystem.

Signed-off-by: Marek Behun <marek.behun@nic.cz>
 create mode 100644 fs/btrfs/btrfs_tree.h
 create mode 100644 fs/btrfs/ctree.h

6 years agoinclude: Add a variadic macro to call a callback for all arguments
Marek Behún [Sun, 3 Sep 2017 15:00:25 +0000 (17:00 +0200)] 
include: Add a variadic macro to call a callback for all arguments

Add a header variadic-macro.h which defines the CALL_MACRO_FOR_EACH marco.

This macro can be used as follows:
  #define TEST(x)
  CALL_MACRO_FOR_EACH(TEST, a, b, c, d)

This will expand to
  TEST(a) TEST(b) TEST(c) TEST(d)

The nice thing is that CALL_MACRO_FOR_EACH is a variadic macro, thus the
number of arguments can vary (although it has an upper limit - in this
implementation 32 arguments).

Signed-off-by: Marek Behun <marek.behun@nic.cz>
 create mode 100644 include/u-boot/variadic-macro.h

6 years agofs: Create a common fs_devread for ext4/reiserfs/zfs
Marek Behún [Sun, 3 Sep 2017 15:00:24 +0000 (17:00 +0200)] 
fs: Create a common fs_devread for ext4/reiserfs/zfs

The ext4, reiserfs and zfs filesystems all have their own implementation
of the same function, *_devread. Generalize this function into fs_devread
and put the code into fs/fs_internal.c.

Signed-off-by: Marek Behun <marek.behun@nic.cz>
[trini: Move fs/fs_internal.o hunk to the end of fs/Makefile as all
cases need it]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agolib: Add CRC32-C
Marek Behún [Sun, 3 Sep 2017 15:00:23 +0000 (17:00 +0200)] 
lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>
 create mode 100644 lib/crc32c.c

6 years agoPrepare v2017.11-rc1
Tom Rini [Tue, 3 Oct 2017 00:11:24 +0000 (20:11 -0400)] 
Prepare v2017.11-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoscripts: dtc: Add .gitignore
Bin Meng [Sun, 1 Oct 2017 05:56:22 +0000 (22:56 -0700)] 
scripts: dtc: Add .gitignore

Ignore these generated files during the build of dtc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
6 years agoMerge git://git.denx.de/u-boot-usb
Tom Rini [Sun, 1 Oct 2017 22:06:53 +0000 (18:06 -0400)] 
Merge git://git.denx.de/u-boot-usb

6 years agoMerge git://git.denx.de/u-boot-rockchip
Tom Rini [Sun, 1 Oct 2017 17:05:53 +0000 (13:05 -0400)] 
Merge git://git.denx.de/u-boot-rockchip

6 years agousb: dwc3: add UniPhier specific glue layer
Masahiro Yamada [Thu, 28 Sep 2017 13:01:00 +0000 (22:01 +0900)] 
usb: dwc3: add UniPhier specific glue layer

Add UniPhier platform specific glue layer to support USB3 Host mode
on Synopsys DWC3 IP.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
6 years agousb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()
Bin Meng [Thu, 28 Sep 2017 04:50:07 +0000 (21:50 -0700)] 
usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()

The stored 'blk' value is overwritten to 'size / 512' before it can
be used in usb_stor_set_max_xfer_blk(). This is not what we want.
In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
should simply assign 'size' to the upper limit.

Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
6 years agousb: xhci: Set 'Average TRB Length' to 8 for control endpoints
Bin Meng [Mon, 18 Sep 2017 13:40:50 +0000 (06:40 -0700)] 
usb: xhci: Set 'Average TRB Length' to 8 for control endpoints

Update the codes to conform with xHCI spec chapter 6.2.3.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
6 years agousb: xhci: Set 'Error Count' to 0 for isoch endpoints
Bin Meng [Mon, 18 Sep 2017 13:40:49 +0000 (06:40 -0700)] 
usb: xhci: Set 'Error Count' to 0 for isoch endpoints

Per xHCI spec, 'Error Count' should be set to 0 for isoch endpoints.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>