oweals/u-boot.git
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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

7 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

7 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

7 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

7 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

7 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

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

7 years agoPrepare v2017.11-rc1 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>
7 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>
7 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

7 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

7 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>
7 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>
7 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>
7 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>
7 years agousb: xhci: Program max burst size for endpoint
Bin Meng [Mon, 18 Sep 2017 13:40:48 +0000 (06:40 -0700)]
usb: xhci: Program max burst size for endpoint

The 'Max Burst Size' indicates to the xHC the maximum number of
consecutive USB transactions that should be executed per scheduling
opportunity. This is a “zero-based” value, where 0 to 15 represents
burst sizes of 1 to 16, but at present this is always set to zero.
Let's program the required value according to real needs.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: xhci: Honor endpoint's interval
Bin Meng [Mon, 18 Sep 2017 13:40:47 +0000 (06:40 -0700)]
usb: xhci: Honor endpoint's interval

USB endpoint reports the period between consecutive requests to send
or receive data as bInverval in its endpoint descriptor. So far this
is ignored by xHCI driver and the 'Interval' field in xHC's endpoint
context is always programmed to zero which means 1ms for low speed
or full speed , or 125us for high speed or super speed. We should
honor the interval by getting it from endpoint descriptor.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: hub: Clear BH reset status change for a 3.0 hub
Bin Meng [Mon, 18 Sep 2017 13:40:46 +0000 (06:40 -0700)]
usb: hub: Clear BH reset status change for a 3.0 hub

USB 3.0 hubs report bit[5] in the port status change response as BH
reset. The hub shall set the C_BH_PORT_RESET field for this port.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: hub: Clear port reset before usb_hub_port_connect_change()
Bin Meng [Mon, 18 Sep 2017 13:40:45 +0000 (06:40 -0700)]
usb: hub: Clear port reset before usb_hub_port_connect_change()

During usb_hub_port_connect_change(), a port reset set feature
request is issued to the port, and later a port reset clear feature
is done to the same port before the function returns. However at
the end of usb_scan_port(), we attempt to clear port reset again
on a cached port status change variable, which should not be done.

Adjust the call to clear port reset to right before the call to
usb_hub_port_connect_change().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: xhci: Fix max packet size for full speed device endpoint 0
Bin Meng [Mon, 18 Sep 2017 13:40:44 +0000 (06:40 -0700)]
usb: xhci: Fix max packet size for full speed device endpoint 0

In xhci_check_maxpacket(), the control endpoint 0 max packet size
is wrongly taken from the interface's endpoint descriptor. However
the default endpoint 0 does not come with an endpoint descriptor
hence is not included in the interface structure. Change to use
epmaxpacketin[0] instead.

The other bug in this routine is that when setting max packet size
to the xHC endpoint 0 context, it does not clear its previous value
at all before programming a new one.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: Read device descriptor after device is addressed for xHCI
Bin Meng [Mon, 18 Sep 2017 13:40:43 +0000 (06:40 -0700)]
usb: Read device descriptor after device is addressed for xHCI

For xHCI it is not possible to read a device descriptor before it
has been assigned an address. That's why usb_setup_descriptor()
was called with 'do_read' being false. But we really need try to
read the device descriptor before starting any real communication
with the default control endpoint.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: Only get 64 bytes device descriptor for full speed devices
Bin Meng [Mon, 18 Sep 2017 13:40:42 +0000 (06:40 -0700)]
usb: Only get 64 bytes device descriptor for full speed devices

Full speed device endpoint 0 can have 8/16/32/64 bMaxPacketSize0.
Other speed devices report fixed value per USB spec. So it only
makes sense if we send a get device descriptor with 64 bytes to
full speed devices.

While we are here, update the comment block to be within 80 cols.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: xhci: Add interrupt transfer support
Bin Meng [Mon, 18 Sep 2017 13:40:41 +0000 (06:40 -0700)]
usb: xhci: Add interrupt transfer support

xHCI uses normal TRBs for both bulk and interrupt. This adds the
missing interrupt transfer support to xHCI so that devices like
USB keyboard that uses interrupt transfer can work.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: Handle audio extension endpoint descriptor in usb_parse_config()
Bin Meng [Mon, 18 Sep 2017 13:40:40 +0000 (06:40 -0700)]
usb: Handle audio extension endpoint descriptor in usb_parse_config()

Normal endpoint descriptor size is 7, but for audio extension it is
9. Handle that correctly when parsing endpoint descriptor.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: xhci: Don't assume LS/FS devices are always behind a HS hub
Bin Meng [Mon, 18 Sep 2017 13:40:39 +0000 (06:40 -0700)]
usb: xhci: Don't assume LS/FS devices are always behind a HS hub

At present xHCI driver assumes LS/FS devices are attached directly
to a HS hub. If they are connected to a LS/FS hub, the driver will
fail to perform the USB enumeration process on such devices.

This is fixed by looking from the device itself all the way up to
the HS hub where the TT that serves the device is located.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agotest: dm: usb: Update test cases for USB
Bin Meng [Sun, 1 Oct 2017 13:19:45 +0000 (06:19 -0700)]
test: dm: usb: Update test cases for USB

Now that we have changed to remove all devices under the root hub in
usb_stop(), and corrected the USB emulator select logic, it makes no
sense to do various tests based on 'usb tree' output since the order
of devices is no longer fixed. Remove these USB test cases related
to 'usb tree'.

For the USB remove test, ideally we should remove an emulator device
node from the device tree, but this is so far not working. Change to
test the 'usb stop' only.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agodm: usb: emul: Drop usb_emul_reset()
Bin Meng [Sun, 1 Oct 2017 13:19:44 +0000 (06:19 -0700)]
dm: usb: emul: Drop usb_emul_reset()

With the root hub unbinding in usb_stop(), there is no need to do
a Sandbox-specific reset operation. usb_emul_reset() is no longer
used anywhere, drop it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agodm: usb: Remove no longer needed blk_unbind_all()
Bin Meng [Sun, 1 Oct 2017 13:19:43 +0000 (06:19 -0700)]
dm: usb: Remove no longer needed blk_unbind_all()

With the root hub unbinding in usb_stop(), there is no need to do
a blk uclass specific unbind operation.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agodm: usb: Fix broken usb_stop()
Bin Meng [Sun, 1 Oct 2017 13:19:42 +0000 (06:19 -0700)]
dm: usb: Fix broken usb_stop()

At present we only do device_remove() during usb stop. The DM API
device_remove() only marks the device state as inactivated, but
still keeps its USB topology (eg: parent, children, etc) in the DM
device structure. There is no issue if we only start USB subsystem
once and never stop it. But a big issue occurs when we do 'usb stop'
and 'usb start' multiple times.

Strange things may be observed with current implementation, like:
- the enumeration may report only 1 mass storage device is detected,
  but the total number of USB devices is correct.
- USB keyboard does not work anymore after a bunch of 'usb reset'
  even if 'usb tree' shows it is correctly identified.
- read/write flash drive via 'fatload usb' may complain "Bad device"

In fact, every time when USB host controller starts the enumeration
process, it takes random time for each USB port to show up online,
hence each USB device may appear in a different order from previous
enumeration, and gets assigned to a totally different USB address.
As a result, we end up using a stale USB topology in the DM device
structure which still reflects the previous enumeration result, and
it may create an exact same DM device name like generic_bus_0_dev_7
that is already in the DM device structure. And since the DM device
structure is there, there is no device_bind() call to bind driver to
the device during current enumeration process, eventually creating
an inconsistent software representation of the hardware topology, a
non-working USB subsystem.

The fix is to clear the unused USB topology in the usb_stop(), by
calling device_unbind() on each controller's root hub device, and
the unbinding will unbind all of its children automatically.

For Sandbox, we need scan the device tree each time when we start
the USB stack, in order to re-create the emulated USB devices and
bind drivers for them before we actually do the driver probe.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: emul: hub: Report the actual device speed of the emulation device
Bin Meng [Sun, 1 Oct 2017 13:19:41 +0000 (06:19 -0700)]
usb: emul: hub: Report the actual device speed of the emulation device

At present the usb hub emulator always reports its downstream port
speed as full speed. Actually it is high speed for sandbox-flash,
and low speed for sandbox-keyb. We can determine the device speed
by checking its device descriptor bcdUSB field, and do the proper
hub port status report based on that.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: emul: Expose find_descriptor() as a public API
Bin Meng [Sun, 1 Oct 2017 13:19:40 +0000 (06:19 -0700)]
usb: emul: Expose find_descriptor() as a public API

This can be useful outside of the sandbox usb emulation uclass
driver. Expose it as a public API with a proper prefix (usb_emul_).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: sandbox: Fix emulator device select logic in usb_emul_find_devnum()
Bin Meng [Sun, 1 Oct 2017 13:19:39 +0000 (06:19 -0700)]
usb: sandbox: Fix emulator device select logic in usb_emul_find_devnum()

Current emulator select logic in usb_emul_find_devnum() is to test
the USB address. The USB address of the device being enumerated is
initialized to zero at the beginning of the enumeration process in
usb_setup_device(). At this point, the saved USB address in the
platform data has not been assigned to any valid USB address either.
This means: the logic will select an emulator device according to
its sequence of declaring order in the device tree. Take test.dts
for example, flash-stick@0 will be selected before flash-stick@1.
But unfortunately such logic is wrong.

In fact USB devices show up in a random order during the enumeration
which means usb_emul_find_devnum() may be called on port 3 for keyb@3
before on port 0 for flash-stick@0.

To fix this, we introduce a new emulator uclass specific platdata
to store the USB device's port number on its parent hub, and update
the logic to test the port number instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: sandbox: Initialize root hub's device speed to high speed
Bin Meng [Sun, 1 Oct 2017 13:19:38 +0000 (06:19 -0700)]
usb: sandbox: Initialize root hub's device speed to high speed

At present 'usb tree' shows that the root hub on the Sandbox USB
controller is at full speed. But its device descriptor says it's
USB 2.0, so let's report it as a high speed device.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: Fix comments of usb_emul_find_for_dev()
Bin Meng [Sun, 1 Oct 2017 13:19:37 +0000 (06:19 -0700)]
usb: Fix comments of usb_emul_find_for_dev()

There is no such a parameter called 'bus'.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agousb: emul: Remove maxpacketsize in usb_emul_setup_device()
Bin Meng [Sun, 1 Oct 2017 13:19:36 +0000 (06:19 -0700)]
usb: emul: Remove maxpacketsize in usb_emul_setup_device()

This parameter is never used.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agoMerge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Tom Rini [Sun, 1 Oct 2017 12:48:38 +0000 (08:48 -0400)]
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2017-10-01

Lots of new things this time. High level highlights are:

  - Shim support (to boot Fedora)
  - Initial set of unit tests
  - Preparations to support UEFI Shell

7 years agorockchip: enable TPL_SYSRESET for all rockchip SoCs
Kever Yang [Wed, 13 Sep 2017 01:39:06 +0000 (09:39 +0800)]
rockchip: enable TPL_SYSRESET for all rockchip SoCs

With Makefiles testing for $(SPL_TPL_)SYSRESET, we need TPL_SYSRESET
for do_reset() in TPL for Rockchip SoCs.

References: 87c16d4 "drivers: spl: consistently use the $(SPL_TPL_)
macro"

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agork3288: spl: Add dram_init_banksize
Jagan Teki [Wed, 27 Sep 2017 17:33:14 +0000 (23:03 +0530)]
rk3288: spl: Add dram_init_banksize

Falcon mode, is updating DDR dt node configuration through
spl_fixup_fdt() so add appropriate DDR base and size through
dram_init_banksize.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: defconfig: puma-rk3399: update for DM_REGULATOR support in SPL
Philipp Tomsich [Fri, 29 Sep 2017 17:28:03 +0000 (19:28 +0200)]
rockchip: defconfig: puma-rk3399: update for DM_REGULATOR support in SPL

The RK3399-Q7 requires DM regulator support in SPL, so we can use the
regulator framework to reenable the eMMC and SPI, if these had been
turned of by the BIOS_DISABLE signal.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agopower: spl: add SPL_DM_REGULATOR_FIXED in Kconfig
Philipp Tomsich [Fri, 29 Sep 2017 17:28:02 +0000 (19:28 +0200)]
power: spl: add SPL_DM_REGULATOR_FIXED in Kconfig

The Makefile already tests for SPL_DM_REGULATOR_FIXED, but Kconfig
does not provide it.  This adds SPL_DM_REGULATOR_FIXED to Kconfig.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: rk3399-puma: add boot-on regulator to override BIOS_DISABLE
Philipp Tomsich [Fri, 29 Sep 2017 17:28:01 +0000 (19:28 +0200)]
rockchip: rk3399-puma: add boot-on regulator to override BIOS_DISABLE

The (Qseven) BIOS_DISABLE signal on the RK3399-Q7 (Puma) keeps the
eMMC and SPI in reset initially and we need to write a GPIO to turn
them on before continuing the boot-up.

This adds the DTS entries for the additional regulator and makes
pinctrl and gpio3 available during SPL.  It also adds a hook to the
spl_board_init() to ensure that the regulator gets probed and enabled.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: puma-rk3399: update board_init()
Philipp Tomsich [Fri, 29 Sep 2017 17:28:00 +0000 (19:28 +0200)]
rockchip: puma-rk3399: update board_init()

The original initialisation code for board_init() was largely lifted
from the code on the EVB.  However, the RK3399-Q7 can do with a much
more concise init sequence.

This cleans up the board_init() by updating it to the essentials for
the RK3399-Q7 and getting rid of the accumulated cruft.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: dts: rk3399-puma: add 'same-as-spl' to the front of the boot-order
Philipp Tomsich [Fri, 29 Sep 2017 17:27:59 +0000 (19:27 +0200)]
rockchip: dts: rk3399-puma: add 'same-as-spl' to the front of the boot-order

In the general case, we want to continue booting the full U-Boot
(contained in a discoverable FIT image) from the same device the SPL
stage was loaded from.  This prepends the 'same-as-spl' specifier to
our configurable boot-order to make this the default behaviour.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: spl: rk3399: implement chip-specific board_spl_was_booted_from()
Philipp Tomsich [Fri, 29 Sep 2017 17:27:58 +0000 (19:27 +0200)]
rockchip: spl: rk3399: implement chip-specific board_spl_was_booted_from()

To support the new "same-as-spl" specifier in the boot-order on the
RK3399, this implements the chip-specific mapping from the information
obtainable from the BROM to a OF path name.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: spl: support a 'same-as-spl'-specifier in the spl-boot-order
Philipp Tomsich [Fri, 29 Sep 2017 17:27:57 +0000 (19:27 +0200)]
rockchip: spl: support a 'same-as-spl'-specifier in the spl-boot-order

It is often desirable to configure the spl-boot-order (i.e. the order
that SPL probes devices to find the FIT image containing a full U-Boot)
such that it contains 'the same device the SPL stage was booted from'
early on.  To support this, we introduce the 'same-as-spl' specifier
for the spl-boot-order property.

This commit adds:
 - documentation for the new board_spl_was_booted_from() function that
   individual SoCs/boards should provide, if they can determine where
   the SPL was booted from
 - implements the new board_spl_was_booted_from() stub function
 - adds support for handling the 'same-as-spl' specifier and calling
   into the per-SoC/per-board support code.

This also updates the documentation for the 'u-boot,spl-boot-order'
property.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: spl: add documentation for spl_node_to_boot_device()
Philipp Tomsich [Fri, 29 Sep 2017 17:27:56 +0000 (19:27 +0200)]
rockchip: spl: add documentation for spl_node_to_boot_device()

In the expectation that the spl-boot-order code will eventually
gain use outside of mach-rockchip: let's add documentation on the
spl_node_to_boot_device() function, which is likely to become a
publicly exported function.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: bootrom: add definitions to retrieve BROM boot-source
Philipp Tomsich [Fri, 29 Sep 2017 17:27:55 +0000 (19:27 +0200)]
rockchip: bootrom: add definitions to retrieve BROM boot-source

The Rockchip BROM allows reading where it booted from from SRAM.
This adds the necessary definitions (as received from Kever) for
the location of this information in the RK3399's SRAM and naming
for the constants used.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: rk3399: make spl_board_init board-specific
Philipp Tomsich [Fri, 29 Sep 2017 17:27:54 +0000 (19:27 +0200)]
rockchip: rk3399: make spl_board_init board-specific

The later-stage spl_board_init (as opposed to board_init_f) should set
up board-specific details: these differ between the EVB-RK3399 and the
RK3399-Q7 (Puma).

This moves spl_board_init back into the individual boards and removes
the unneeded functionality from Puma.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agoevb-rk3399: avoid redefinition of CONFIG_ENV_OFFSET
Heinrich Schuchardt [Wed, 27 Sep 2017 18:23:09 +0000 (20:23 +0200)]
evb-rk3399: avoid redefinition of CONFIG_ENV_OFFSET

CONFIG_ENV_OFFSET is already defined in
include/configs/rockchip-common.h

For CONFIG_ROCKCHIP_BACK_TO_BROM=y we redefine CONFIG_ENV_OFFSET
to an unsuitable value. We were lucky to get a compiler warning.

Remove the incorrect redefinition.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk322x: update the sysreg number for boot mode
Kever Yang [Tue, 22 Aug 2017 07:34:58 +0000 (15:34 +0800)]
rockchip: rk322x: update the sysreg number for boot mode

The boot mode for rk322x is stored in sysreg 0, update it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: dts: rk3328-evb: add i2c1 and rk805 nodes
Elaine Zhang [Wed, 27 Sep 2017 07:23:38 +0000 (15:23 +0800)]
rockchip: dts: rk3328-evb: add i2c1 and rk805 nodes

add i2c1 and rk805 nodes to support rk805 init setting.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agoconfigs: rk3328: add support for pmic rk8xx and regulator and i2c driver
Elaine Zhang [Wed, 27 Sep 2017 07:23:37 +0000 (15:23 +0800)]
configs: rk3328: add support for pmic rk8xx and regulator and i2c driver

Add defconfig for rk8xx and regulator and i2c controller.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: i2c: rk3328: support i2c for rk3328 SoC
Elaine Zhang [Wed, 27 Sep 2017 07:23:34 +0000 (15:23 +0800)]
rockchip: i2c: rk3328: support i2c for rk3328 SoC

Add compatible to support rk3328 i2c

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Heiko Schocher<hs@denx.de>
7 years agorockchip: pinctrl: rk3368: add pinctrl for SDMMC0
Philipp Tomsich [Tue, 19 Sep 2017 13:49:14 +0000 (15:49 +0200)]
rockchip: pinctrl: rk3368: add pinctrl for SDMMC0

Apparently, our earlier assumption that the BROM will always set up
the iomux for SDcard communication does not always hold true: when
booting U-Boot from the on-module (on the RK3368-uQ7) eMMC, the SDcard
pins are not set up and need to be configured by the pinctrl driver to
allow SD card access.

This change implements support for setting up the SDMMC pins in
pinctrl for the RK3368.

Reported-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: board: lion-rk3368: avoid ATF overwriting active SPL stage
Philipp Tomsich [Fri, 15 Sep 2017 13:57:15 +0000 (15:57 +0200)]
rockchip: board: lion-rk3368: avoid ATF overwriting active SPL stage

The RK3368-uQ7 ATF has been moved back to 0x100000 (1MB from the start
of DRAM) to avoid it overwriting the active SPL stage during FIT image
loading.  This change adapts the .its to match up (again) with our ATF
repository for the RK3368-uQ7.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agork3288: vyasa: Add falcon mode support
Jagan Teki [Wed, 27 Sep 2017 17:33:13 +0000 (23:03 +0530)]
rk3288: vyasa: Add falcon mode support

Add Falcon mode support in vyasa rk3288 board.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agork3288: vyasa: Add TPL support
Jagan Teki [Wed, 27 Sep 2017 17:33:12 +0000 (23:03 +0530)]
rk3288: vyasa: Add TPL support

Since the size of SPL can't be exceeded 0x8000 bytes in RK3288,
it is not possible add new SPL features like Falcon mode or etc.

So add TPL stage so-that adding new features to SPL is possible.
- TPL: DRAM init, clocks
- SPL: MMC, falcon, etc

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agoarmv7: rk3288: Move configure_l2ctlr to common
Jagan Teki [Wed, 27 Sep 2017 17:33:11 +0000 (23:03 +0530)]
armv7: rk3288: Move configure_l2ctlr to common

configure_l2ctlr will be shared between SPL and TPL so
move them into asm/arch/sys_proto.h

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agoarmv7: Move L2CTLR read/write to common
Jagan Teki [Wed, 27 Sep 2017 17:33:10 +0000 (23:03 +0530)]
armv7: Move L2CTLR read/write to common

L2CTLR read/write functions are common to armv7 so, move
them in to include/asm/armv7.h and use them where ever it need.

Cc: Tom Warren <twarren@nvidia.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[Backed out the change to arch/arm/mach-tegra/cache.c:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk322x: fix pd_bus hclk/pclk
Kever Yang [Thu, 28 Sep 2017 10:24:03 +0000 (18:24 +0800)]
rockchip: rk322x: fix pd_bus hclk/pclk

The pd_bus hclk/pclk source is pd_bus aclk, not the PLL.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: mkimage: add support for rk3128 soc
Kever Yang [Wed, 27 Sep 2017 09:57:28 +0000 (17:57 +0800)]
rockchip: mkimage: add support for rk3128 soc

Add support for rk3128 package header in mkimage tool.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk3036: fix grf macro define
Kever Yang [Wed, 27 Sep 2017 09:02:58 +0000 (17:02 +0800)]
rockchip: rk3036: fix grf macro define

Some of macros definition are not correct, fix them according to TRM.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: clk: fix typo in rk322x clock driver
Kever Yang [Wed, 27 Sep 2017 08:59:56 +0000 (16:59 +0800)]
rockchip: clk: fix typo in rk322x clock driver

Fix typo RK322X/RK3036 in rk322x clock driver.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk3399: spl: convert to using BOOT_DEVICE_BOOTROM
Philipp Tomsich [Mon, 11 Sep 2017 10:48:12 +0000 (12:48 +0200)]
rockchip: rk3399: spl: convert to using BOOT_DEVICE_BOOTROM

Instead of directly calling into the back-to-bootrom code, the RK3399
common SPL implementation now uses BOOT_DEVICE_BOOTROM to trigger a
transfer back into the bootrom.

With this factored out, the spl_board_init function can not be
customised for each RK3399 board.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: lion-rk3368: defconfig: remove duplicate CONFIG_ENV_IS_IN_MMC
Philipp Tomsich [Wed, 27 Sep 2017 11:27:38 +0000 (13:27 +0200)]
rockchip: lion-rk3368: defconfig: remove duplicate CONFIG_ENV_IS_IN_MMC

Remove a duplicate CONFIG_ENV_IS_IN_MMC assignment for the lion-rk3368
defconfig.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk3188: ram: add support for 16bit row address
Kever Yang [Mon, 25 Sep 2017 08:33:22 +0000 (16:33 +0800)]
rockchip: rk3188: ram: add support for 16bit row address

RK3188 using the same ddr_conf for both 15 bit and 16 bit row address.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[Fixed compile-error by declaring 'row':]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: dts: rk3229: remove dram channel info
Kever Yang [Wed, 27 Sep 2017 08:38:23 +0000 (16:38 +0800)]
rockchip: dts: rk3229: remove dram channel info

The dram channel info will be auto detect by the driver,
we do not need it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
7 years agorockchip: rk322x: add sdram driver
Kever Yang [Wed, 27 Sep 2017 08:38:22 +0000 (16:38 +0800)]
rockchip: rk322x: add sdram driver

Add driver for rk322x to support sdram initialize in SPL.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk3328: move sdram driver to driver/ram
Kever Yang [Wed, 27 Sep 2017 08:11:33 +0000 (16:11 +0800)]
rockchip: rk3328: move sdram driver to driver/ram

Since we have CONFIG_RAM framwork and its driver folder, move the driver
into it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk3288: move sdram driver to driver/ram
Kever Yang [Wed, 27 Sep 2017 08:11:32 +0000 (16:11 +0800)]
rockchip: rk3288: move sdram driver to driver/ram

Since we have CONFIG_RAM framwork and its driver folder, move the driver
into it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk3188: move sdram driver to driver/ram
Kever Yang [Wed, 27 Sep 2017 08:11:31 +0000 (16:11 +0800)]
rockchip: rk3188: move sdram driver to driver/ram

Since we have CONFIG_RAM framwork and its driver folder, move the driver
into it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk3399: move sdram driver to driver/ram
Kever Yang [Wed, 27 Sep 2017 08:11:30 +0000 (16:11 +0800)]
rockchip: rk3399: move sdram driver to driver/ram

Since we have CONFIG_RAM framwork and its driver folder, move the driver
into it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: imply ADC and SARADC_ROCKCHIP for Rockchip SOCs
Philipp Tomsich [Wed, 20 Sep 2017 11:50:13 +0000 (13:50 +0200)]
rockchip: imply ADC and SARADC_ROCKCHIP for Rockchip SOCs

Enable the Rockchip SARADC driver for all Rockchip SoCs.

Note that the SARADC peripheral is available on all SoCs except the
RK3036 and RK3228.  However, as this is a DM-driver, enabling by
default will not cause any function problems (and can always be
changed from defconfig, if size is a concern).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: David Wu <david.wu@rock-chips.com>
7 years agorockchip: dts: Enable SARADC for rk3399-evb
David Wu [Wed, 20 Sep 2017 06:47:19 +0000 (14:47 +0800)]
rockchip: dts: Enable SARADC for rk3399-evb

Enable the SARADC for download key pressed detect.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: dts: Enable SARADC for rk3368-sheep
David Wu [Wed, 20 Sep 2017 06:46:19 +0000 (14:46 +0800)]
rockchip: dts: Enable SARADC for rk3368-sheep

Enable the SARADC for download key pressed detect.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: dts: Enable SARADC for rk3368-px5-evb
David Wu [Wed, 20 Sep 2017 06:45:21 +0000 (14:45 +0800)]
rockchip: dts: Enable SARADC for rk3368-px5-evb

Enable the SARADC for download key pressed detect.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: dts: Enable SARADC for rk3328-evb
David Wu [Wed, 20 Sep 2017 06:44:23 +0000 (14:44 +0800)]
rockchip: dts: Enable SARADC for rk3328-evb

Enable the SARADC for download key pressed detect.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>