]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
7 years agoefi_selftest: allow printing MAC addresses
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:06 +0000 (16:36 +0200)]
efi_selftest: allow printing MAC addresses

Add %pm as format string to print a MAC address.
This is helpful when analyzing network problems.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: correct definition of efi_st_error
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:05 +0000 (16:36 +0200)]
efi_selftest: correct definition of efi_st_error

Enclose definition in parantheses to allow using efi_st_error
like a void function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: fill return values in SimpleNetworkProtocol
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:04 +0000 (16:36 +0200)]
efi_loader: fill return values in SimpleNetworkProtocol

In the receive function all return values should be filled.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: size fields in SimpleNetworkProtocol
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:03 +0000 (16:36 +0200)]
efi_loader: size fields in SimpleNetworkProtocol

The size fields in the Simple Network Protocol are all
UINTN in the UEFI spec. So use size_t.

Provide a function description of the receive function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: fix efi_net_get_status
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:02 +0000 (16:36 +0200)]
efi_loader: fix efi_net_get_status

The returned interrupt status was wrong.

As out transmit buffer is empty we need to always set
EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT.

When we have received a packet we need to set
EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT.

Furthermore we should call efi_timer_check() to handle events.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: implement WaitForPacket event
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:01 +0000 (16:36 +0200)]
efi_loader: implement WaitForPacket event

The WaitForPacket event informs that a network package has been
received by the SimpleNetworkProtocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[agraf: Move is_signaled = true line into efi_net_push()]
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: use events for efi_net_receive
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:00 +0000 (16:36 +0200)]
efi_loader: use events for efi_net_receive

A timer event is defined. The timer handler cares for receiving new
packets.

efi_timer_check is called both in efi_net_transmit and efi_net_receive
to enable events during network communication.

Calling efi_timer_check in efi_net_get_status is implemented in a
separate patch.

[agraf] This patch is needed to make efi_net_get_status() actually
        report incoming packets.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[agraf: fix spelling in comment]
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_net: return EFI_UNSUPPORTED where appropriate
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:59 +0000 (16:35 +0200)]
efi_net: return EFI_UNSUPPORTED where appropriate

U-Boot does not implement all functions of the simple network
protocol. The unimplemented functions return either of
EFI_SUCCESS and EFI_INVALID_PARAMETER.

The UEFI spec foresees to return EFI_UNSUPPORTED in these cases.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi_net: hwaddr_size = 6
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:58 +0000 (16:35 +0200)]
efi_loader: efi_net: hwaddr_size = 6

The length of a MAC address is 6.
We have to set this length in the EFI_SIMPLE_NETWORK_MODE
structure of the EFI_SIMPLE_NETWORK_PROTOCOL.

Without this patch iPXE fails to initialize the network with
error message
SNP MAC(001e0633bcbf,0x0) has invalid hardware address length 0

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: fill simple network protocol revision
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:57 +0000 (16:35 +0200)]
efi_loader: fill simple network protocol revision

Provide the simple network protocol revision.
This revision number could be used to identify backwards compatible
enhancements of the protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: correct bits of receive_filters bit mask
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:56 +0000 (16:35 +0200)]
efi_loader: correct bits of receive_filters bit mask

Remove extraneous commas.
Add comment.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: incorrect definition of EFI_SIMPLE_NETWORK_PROTOCOL
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:55 +0000 (16:35 +0200)]
efi_loader: incorrect definition of EFI_SIMPLE_NETWORK_PROTOCOL

WaitForPacket is an event and not a function pointer.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: wrong type in wait_for_event
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:54 +0000 (16:35 +0200)]
efi_loader: wrong type in wait_for_event

The UEFI spec defines parameter index of WaitForEvent as UINTN*.
So we should use size_t here.

I deliberately do not use UINTN because I hold a following patch
that will eliminate UINTN because uppercase types to not match
the U-Boot coding style.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: pass GUIDs as const efi_guid_t *
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:53 +0000 (16:35 +0200)]
efi_loader: pass GUIDs as const efi_guid_t *

We need to call some boottime services internally.
Our GUIDs are stored as const efi_guid_t *.

The boottime services never change GUIDs.
So we can define the parameters as const efi_guid_t *.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: parameters of CopyMem and SetMem
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:52 +0000 (16:35 +0200)]
efi_loader: parameters of CopyMem and SetMem

The UEFI spec defines the length parameters of CopyMem and SetMem
as UINTN. We should size_t here.

The source buffer of CopyMem should be marked as const.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: call EFI_EXIT in efi_copy_mem, efi_set_mem
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:51 +0000 (16:35 +0200)]
efi_loader: call EFI_EXIT in efi_copy_mem, efi_set_mem

EFI_ENTRY and EFI_EXIT calls must match.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: replace efi_div10 by do_div
Heinrich Schuchardt [Thu, 5 Oct 2017 14:14:14 +0000 (16:14 +0200)]
efi_loader: replace efi_div10 by do_div

We should use the existing 64bit division instead of
reinventing the wheel.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: provide function comments for boot services
Heinrich Schuchardt [Thu, 21 Sep 2017 16:30:11 +0000 (18:30 +0200)]
efi_loader: provide function comments for boot services

Provide comments describing the boot service functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: make tests easier to read
Heinrich Schuchardt [Wed, 4 Oct 2017 13:31:26 +0000 (15:31 +0200)]
efi_selftest: make tests easier to read

Rename counter to more illustrative names.
Update notification function description.
Simplify notification function.
Add comment for arbitrary non-zero value.
Document @return.
Use constants for return values of setup, execute, teardown.

Reported-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: use type bool for event states
Heinrich Schuchardt [Wed, 4 Oct 2017 13:03:24 +0000 (15:03 +0200)]
efi_loader: use type bool for event states

Queued and signaled describe boolean states of events.
So let's use type bool and rename the structure members to is_queued
and is_signaled.

Update the comments for is_queued and is_signaled.

Reported-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: use efi_st_error for all error messages
Heinrich Schuchardt [Wed, 4 Oct 2017 10:37:02 +0000 (12:37 +0200)]
efi_selftest: use efi_st_error for all error messages

All error messages in the selftests should use efi_st_error.
efi_st_error will print the file name and line number of the error.

Splitting message texts due to lines being over 80
characters is avoided. This resolves the issue reported
by Simon Glass in
https://lists.denx.de/pipermail/u-boot/2017-September/307387.html

Reported-by: Simon Glass <sjg@chromium.org>
Fixes: 623b3a579765 efi_selftest: provide an EFI selftest application
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: enable CONFIG_CMD_BOOTEFI_SELFTEST
Heinrich Schuchardt [Wed, 20 Sep 2017 19:14:37 +0000 (21:14 +0200)]
efi_selftest: enable CONFIG_CMD_BOOTEFI_SELFTEST

The EFI selftest has been broken by a patch on efi-next.
We should enable CONFIG_CMD_BOOTEFI_SELFTEST on
qemu-x86_defconfig and qemu-x86_64_defconfig by default
to catch this type of problem in the Travis CI tests.

These systems typically have abundant memory so that
enabling this option should not pose a problem.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: allow creating new handles
Heinrich Schuchardt [Sat, 26 Aug 2017 22:51:09 +0000 (00:51 +0200)]
efi_loader: allow creating new handles

In efi_install_protocol_interface support creating
a new handle.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: support 16 protocols per efi_object
Heinrich Schuchardt [Sat, 26 Aug 2017 22:51:04 +0000 (00:51 +0200)]
efi_loader: support 16 protocols per efi_object

8 protocols per efi_object is insufficient for iPXE.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
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
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>