Commit Graph

4575 Commits

Author SHA1 Message Date
Kever Yang 89c73a9cca spl: use different BOARD_INIT MACRO for spl and tpl
SPL and TPL may not always need spl_board_init() at the same time.

Change-Id: I5f26956414f1d2ff3fd2fce11a4d7759de7804fe
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-01-22 18:01:38 +08:00
Joseph Chen 534066e47b bootm: resever memory before any lmb_alloc()
It's better to be done anyway and as early as possible.

Change-Id: I681c93b97a8c3da681886b23ef350ecab8156f8e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-01-20 22:26:41 +08:00
Joseph Chen df3eab8124 image-fdt: support "reserved-memory" for lmb
Change-Id: Id628c47e2521226777d2391db1fee325592cf3f2
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-01-20 22:26:33 +08:00
Jason Zhu 830c86d992 image-android: get real fdt addr in android_image_get_fdt
Change-Id: Ie9c632c767962f8580bd9adf7727738f28479e4c
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-01-18 10:19:23 +08:00
Jason Zhu b7570de26c android: modify the fdt_addr
The env fdt_addr must be set as hex.

Change-Id: I75ffeb832a4b44dcadafdcfecfc6bb282e495b83
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-01-18 10:00:58 +08:00
Joseph Chen 5c9c1f991f common: boot_rkimg: fix compile warnings
Change-Id: Id7c49a187e789daa8af78c2f38982568f2f48e44
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-01-17 16:28:54 +08:00
Kever Yang 7f732f5f7a rockchip: remove no use BITS_PER_LONG
Change-Id: I838bdab8fba05d784dce06cde11e492e225b23d7
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-01-17 15:49:28 +08:00
Kever Yang 099855e292 spl: add support to booting with OP-TEE
OP-TEE is an open source trusted OS, in armv7, its loading and
running are like this:
loading:
- SPL load both OP-TEE and U-Boot
running:
- SPL run into OP-TEE in secure mode;
- OP-TEE run into U-Boot in non-secure mode;

More detail:
https://github.com/OP-TEE/optee_os
and search for 'boot arguments' for detail entry parameter in:
core/arch/arm/kernel/generic_entry_a32.S

Change-Id: I1344a35dd11bd69ca00e9b99909e1eb610648d86
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 32470d8ebee6a9c31a7a6b82704c486ef06cf549)
2018-01-17 15:28:11 +08:00
Kever Yang 820a0a1278 UPSTREAM: image: add os type for OP-TEE
OP-TEE is an open source trust OS maintained here:
https://github.com/OP-TEE/optee_os

Series-changes: 2
- Add new image type like ATF

Change-Id: Idaae12027be1f8a3252d2f9ad2ee689b6dfcb3ad
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>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 8f7658998ba3ba4338344cee1d235bf090a1dd94)
2018-01-17 15:28:11 +08:00
Philipp Tomsich 4bba5ee7dc spl: atf: add SPL_ATF_NO_PLATFORM_PARAM option
While we expect to call a pointer to a valid FDT (or NULL) as the
platform parameter to an ATF, some ATF versions are not U-Boot aware
and have an insufficiently robust (or an overzealour) parameter
validation: either way, this may cause a hard-stop with uncooperative
ATF versions.

This change adds the option to suppress passing a platform parameter
and will always pass NULL.

Debug output from ATF w/ this option disabled (i.e. default):
      INFO:    plat_param_from_bl2: 0x291450
Debug output from ATF w/ this option enabled:
      INFO:    plat_param_from_bl2: 0

Change-Id: Ic13bf77aa509407563d10ad3ce790087f2d1dc07
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit d21fb63d772d32373600abeb7afcb53033e087a7)
2018-01-17 15:27:28 +08:00
Prabhakar Kushwaha 1ae99f2494 UPSTREAM: common: Fix-up MAC addr in dts by fetching env variable serially
The MAC addresses get fixed in the device tree for "ethernet" nodes
is by using trailing number behind "ethernet" found in "/aliases".
It may not be necessary for the "ethernet" nodes to be sequential.
There can be gaps in between or any node disabled

So provide a support to fetch MAC addr sequentially from env
and apply them to "ethernet" nodes in the order they appear in
device tree only if "ethernet" is not "disabled"

Change-Id: I1bd6544a2bfe5cd5d6708e249c1e07d44d6944d2
Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 24acb83d8f04e9a49f161c07d38da50c70e9f16d)
2018-01-17 15:27:28 +08:00
Simon Glass a239d69a77 UPSTREAM: log: Plumb logging into the init sequence
Set up logging both before and after relocation.

Change-Id: I225a1077880b14a6f3eabc19b2a5b9fe4c6a530d
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit af1bc0cf46c49c5ddb13b8c75bad31a05a137eba)
2018-01-17 15:27:28 +08:00
Simon Glass b974325dd8 UPSTREAM: board_f: Drop the timer after relocation
Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Change-Id: I041cc547659b540735dcaf52444d97834ea10059
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 5ee94b4f4032502c26cd3c9ede6a910d7e2c9b46)
2018-01-17 15:27:28 +08:00
Simon Glass 73991b074b log: Add a test command
Add a command which exercises the logging system.

Change-Id: I4eb139b69937c752d7f6fc42dde3f757260b832b
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit ef11ed8239bf02b347e7fb9fc6d980aec0c7810a)
2018-01-17 15:27:28 +08:00
Simon Glass 5cafef2de2 UPSTREAM: log: Add a console driver
It is useful to display log messages on the console. Add a simple driver
to handle this.

Note that this driver outputs to the console, which may be serial or
video. It does not specifically select serial output.

Change-Id: I3626673a306557400584e673f9725e74ecbaaf98
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit c6d47535dfb6636ae5244958a2a9e043bb7646ae)
2018-01-17 15:27:28 +08:00
Simon Glass 9530301c66 log: Add an implementation of logging
Add the logging header file and implementation with some configuration
options to control it.

Change-Id: Ic711fa39ba3183b288170ebdd4bfdf0a9e472bad
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit e9c8d49d54cbbc7b219a1637d2994de7448b767d)
2018-01-17 15:27:28 +08:00
Simon Glass 785b4fbf6c Drop the log buffer
This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Change-Id: I798cd4aff50b7136ae9f84362185f9f73b04f710
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit c5404b64fb5a35d41f7eff6d12b8ffdb0c851040)
2018-01-17 15:27:28 +08:00
Simon Glass 143f37beff UPSTREAM: usb: Correct use of debug()
With clang this gives a warning because hubsts appears to be used before
it is set, even if ultimately it is not used. Simplify the code to avoid
this problem.

Change-Id: If765f7b0c909de125e163875856e43ddf9b6c5d5
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 0ad0458c76107b29325b8c38804e0407bed42a79)
2018-01-17 15:27:28 +08:00
Philipp Tomsich 3f6e9bd9ff UPSTREAM: usb: hub: identify the hub-device to usb_hub_reset_devices
When usb_hub_reset_devices is called, it should be passed both an
indicator which hub it should operate on and what port number (local
to that hub) should be reset.

Previously, the usb_hub.c code did not include such context and
always started resets from port number 1, performing multiple
reset-requests for the same devices:

       /*
        * Reset any devices that may be in a bad state when applying
        * the power.  This is a __weak function.  Resetting of the devices
        * should occur in the board file of the device.
        */
       for (i = 0; i < dev->maxchild; i++)
              usb_hub_reset_devices(i + 1);

This adds an additional 'hub' parameter to usb_hub_reset_devices
that provides the context to fully qualify the port-number in.

Existing implementations are changed to accept and ignore the new
parameter.

Change-Id: I2f201cb9c52522f6e553cbf54aae9bbb2e549a21
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Jakob Unterwurzacher <jakob.unterwurzacher@theobroma-systems.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 883946e8e7c5dacb5e12f18703e20d49a4886f0e)
2018-01-17 15:27:28 +08:00
Philipp Tomsich 8118cce3e0 UPSTREAM: spl: fit: add SPL_FIT_IMAGE_TINY config to reduce code-size
A minor code-size increase from the changes for tracking the os-type
of FIT images and from infrastructure for recording the loadables into
the the loaded FDT, broke the builds for sun50i and some OMAP2+ devices.

This change adds a new config option (enabled by default for
MACH_SUN50I, MACH_SUN50I_H5 and ARCH_OMAP2PLUS) that does skips these
processing steps (bringing code size down to below the limit
again). The os-type is not evaluated, but assumed to be IH_OS_UBOOT
(i.e. taking the code-paths intended for backward-compatibility).

Note that enabling this config option precludes any useful downstream
processing, such as utilising a special calling convention for ATF or
OPTEE, based on the os-type of the loadables.

Change-Id: I32036975208be6e9d9d2ad3b5376444efd693f25
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 337bbb6297775e8e9d664e96e96004f00d1d8c02)
2018-01-17 15:27:28 +08:00
Philipp Tomsich 9f8888bc5c spl: rename config item SPL_ATF_SUPPORT to SPL_ATF
Having CONFIG_SPL_ATF seems more natural.
Rename it, while it it is easy and there's few boards that use it
(only RK3399 and RK3368 boards).

Change-Id: Ie13ba6eeb687bf6f8c8d326c197f453fb752e9bd
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit aa122f6b3d24bd133392c7dd2a882a8cc2cbd622)
2018-01-17 15:27:28 +08:00
Philipp Tomsich 2e15a11c91 spl: atf: introduce spl_invoke_atf and make bl31_entry private
This adds a new interface spl_invoke_atf() that takes a spl_image_info
argument and then derives the necessary parameters for the ATF entry.
Based on the additional information recorded (into /fit-images) from
the FIT loadables, we can now easily locate the next boot stage.

We now pass a pointer to a FDT as the platform-specific parameter
pointer to ATF (so we don't run into the future headache of every
board/platform defining their own proprietary tag-structure), as
FDT access is already available in ATF.

With the necessary infrastructure in place, we can now update the
support for the ARM Trusted Firmware to dispatch into the
spl_invoke_atf function only if a IH_OS_ARM_TRUSTED_FIRMWARE image is
loaded.

Change-Id: Ia00abe207a0a0fed044fcda2b6e1054225b42901
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 1d3790905d9c089b434c376f2dcc585b6a92bc99)
2018-01-17 15:27:28 +08:00
Philipp Tomsich 1f1cf67b1d UPSTREAM: spl: fit: implement recording of loadables into /fit-images
If a FDT was loaded (e.g. to append it to U-Boot image), we store it's
address and record information for all loadables into this FDT.  This
allows us to easily keep track of images for multiple privilege levels
(e.g. with ATF) or of firmware images preloaded into temporary
locations (e.g. PMU firmware that may overlap the SPL stage).

Change-Id: Ifeee692ad0604e2e60e92f76a11f5693c52fe769
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit a616c783f22a045e580f101141a9d62775f97365)
2018-01-17 15:27:28 +08:00
Philipp Tomsich e265ab898a UPSTREAM: spl: fit: implement fdt_record_loadable
During the loading of more complex FIT images (e.g. when the invoked
next stage needs to find additional firmware for a power-management
core... or if there are multiple images for different privilege levels
started in parallel), it is helpful to create a record of what images
are loaded where: if a FDT is loaded for one of the next stages, it
can be used to convey the status and location of loadables.

This adds a fdt_record_loadable() function that can be invoked to
record the status of each loadable below the /fit-images path.

Change-Id: I9d6dcd3cb7863a558ebde7c68bcfe45eaadcc76f
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 9f45aeb937275960405de0f2abca8c665dbb03d4)
2018-01-17 15:27:28 +08:00
Philipp Tomsich 9719e14f31 UPSTREAM: spl: fit: simplify logic for FDT loading for non-OS boots
To better support bootin through an ATF or OPTEE, we need to
streamline some of the logic for when the FDT is appended to an image:
depending on the image type, we'd like to append the FDT not at all
(the case for the OS boot), to the 'firmware' image (if it is a
U-Boot) or to one of the loadables (if the 'firmware' is an ATF, an
OPTEE, or some other image-type and U-Boot is listed in the
loadabled).

To achieve this goal, we drop the os_boot flag and track the type of
image loaded.  If it is of type IH_OS_U_BOOT, we append the FDT.

Change-Id: Ic7c4b927b4ad7d33e372e63002072fe27a88292f
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: York Sun <york.sun@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit d879616e9e64cf5a9c43dedc30677aa2fa463d64)
2018-01-17 15:27:28 +08:00
Philipp Tomsich 4233e0b15e UPSTREAM: image: add IH_OS_ARM_TRUSTED_FIRMWARE for ARM Trusted Firmware
To boot on ARMv8 systems with ARM Trusted Firmware, we need to
assemble an ATF-specific parameter structure and also provide the
address of the images started by ATF (e.g. BL3-3, which may be the
full U-Boot).

To allow us to identify an ARM Trusted Firmware contained in a FIT
image, this adds the necessary definitions.

Change-Id: If9f54a8391bba18c5aa220aea09db53271ff4517
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 4914af1286c4a48cd0ae98cf6adea3569111413b)
2018-01-17 15:27:28 +08:00
Heinrich Schuchardt 25e0b4f36e UPSTREAM: malloc: don't compare pointers to 0
0 is not a pointer. So do not compare pointers to 0.

Do not return 0 from functions with a pointer return
type.

Problem identified with Coccinelle.

Change-Id: Ib8447e3ff21d7fc256a9c4a4ed3c4396ce12e00a
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit a874cac3b45cbb6dd8bad05a5b42912acae6b7e4)
2018-01-17 15:27:28 +08:00
André Draszik 75ee777bcd UPSTREAM: SPL: fix printing of image name
The maximum length of the name of the image is
obviously not sizeof(), which is just the
length of a pointer, but IH_NMLEN.

fixes: 62cf11c092
("SPL: Limit image name print length")

Change-Id: I948dee1b9a4e1ddfbb122475e2d209cc26dec9d0
Signed-off-by: André Draszik <adraszik@tycoint.com>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 3fe3839acc4a5d9b1af9b2ab3884b0d3f2e23370)
2018-01-17 15:27:28 +08:00
Masahiro Yamada 58ddd5e1b2 UPSTREAM: image-sig: use designated initializers for algorithm
Designated initializers are more readable because we do not
have to check the order in the struct definitions.

Change-Id: Ib4af13de7b0d87b2d395847b0d1b5c198206a96b
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 8ec87df3762f27bbd77fb28474d1e46ad23c9e28)
2018-01-17 15:27:28 +08:00
Tuomas Tynkkynen f1817ab2ce UPSTREAM: common: Remove genimg_get_image()
Removal of the legacy DataFlash code turned genimg_get_image() into a
no-op. Drop all calls to it and the function itself.

Change-Id: I79fc0cd75fb4ea7bdfd0be8486d8be4b72cd773f
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 137aefba0319eaa69de0707dce01d62339158d4d)
2018-01-17 15:27:28 +08:00
Tuomas Tynkkynen b0ec94428e UPSTREAM: Drop CONFIG_HAS_DATAFLASH
Last user of this option went away in commit:

fdc7718999 ("board: usb_a9263: Update to support DT and DM")

Change-Id: Id05869deccb88c1102700dd5af58a8c249e3e9e2
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit c68c03f52badc90951dbf8a054c0e500e04bf365)
2018-01-17 15:27:28 +08:00
York Sun 4f443bd290 UPSTREAM: spl: fix assignment of board info to global data
Commit 15eb1d43bf ("spl: reorder the assignment of board info to
global data") intended to move assignment of board info earlier,
into board_init_r(). However, function preload_console_init() is
called either from spl_board_init() or from board_init_f(). For the
latter case, the board info assignment is much earlier than proposed
board_init_r(). Create a new function to fill gd->bd and call this
function when needed.

Change-Id: I3e8da19121f5b82f116b9d051b75acdd777c2475
Signed-off-by: York Sun <york.sun@nxp.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Ravi Babu <ravibabu@ti.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit d1fc0a31b5f307c92b7a047d4f90d5ad2e54cdcc)
2018-01-17 15:27:28 +08:00
Jean-Jacques Hiblot 0079efa1b4 UPSTREAM: fit: If no matching config is found in fit_find_config_node(), use the default one
If board_fit_config_name_match() doesn't match any configuration node,
then use the default one (if provided).

Change-Id: Ieb93f146a54cb6d75d8f6b395078c315a4fac134
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 02035d0086b3f9114463a9b9df38a5618ffe8a04)
2018-01-17 15:27:28 +08:00
Jean-Jacques Hiblot 1481d9f176 UPSTREAM: fit: fixed bug in locate_dtb_in_fit()
If the dtb is the first data of the FIT, the its offset is 0x0. Change the
test to '<' instead of '<='

Change-Id: Ie6dd1734049f642511db0fc1b19f2af0bec8de04
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit d56b86eec32a700cdc16170ad8365ee7c6522f0e)
2018-01-17 15:27:28 +08:00
Jean-Jacques Hiblot ea5b64c6e7 UPSTREAM: fit: use 'const' for the input of fdt_offset() and locate_dtb_in_fit()
Those 2 functions don't modify their input, we can mark it const.
This prevents compilation warnings when they are provided const input.

Change-Id: I9583751451cfc26a99ee94f87447dd6337d0cc67
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 906a9dbbcba85e8b02414c960c75103cc4755102)
2018-01-17 15:27:28 +08:00
Jean-Jacques Hiblot 2bbcffb1d3 UPSTREAM: dts: renamed FIT_EMBED to MULTI_DTB_FIT and moved it to the dts Kconfig
CONFIG_FIT_EMBED might be confused with CONFIG_OF_EMBED, rename it
MULTI_DTB_FIT as it is able to get a DTB from a FIT image containing
multiple DTBs. Also move the option to the Kconfig dedicated to the DTS
options and create a README for this feature.

Change-Id: Ide55c474339db3ccd5e20499c54c8bb41fe3a2c9
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 11955590a284ecb75892aad5f1174ca1b94a709b)
2018-01-17 15:27:28 +08:00
Tom Rini bcf5156aaa UPSTREAM: common: Drop LOGLEVEL to 4
While this came in with a default value of 6 I am lowering this to 4.
The MTD/UBI code has a large number of error messages that we include
now.  In addition, "normally" warning messages are not included so this
feels like a more natural level to have.

Change-Id: I20bc4b32caf1876d5f6052851580383f00a67dc9
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 6a3e65dea3e525b5337ca8014aa4be9f5fafeb92)
2018-01-17 15:27:28 +08:00
Masahiro Yamada 90aa625c9a 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>

Change-Id: I921807c1770d36a91e692c48ab477558bb2ed0b8
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>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 9b643e312d528f291966c1f30b0d90bf3b1d43dc)
2018-01-17 15:27:28 +08:00
Masahiro Yamada a9a4552a1c UPSTREAM: 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.

Change-Id: I997d8bbeedd48777be87472df8ed126181fc4b8e
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>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit b44b30260ffa3dc82f4bb98b022483bb09e95353)
2018-01-17 15:27:28 +08:00
Bin Meng d4ecf6514b UPSTREAM: 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.

Change-Id: I078963e74b22450d0d876e846e44d93118cff96a
Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 72ac8f3fc29016a31ee309b4d025b487e78906ab)
2018-01-17 15:27:28 +08:00
Bin Meng 2a13791069 UPSTREAM: 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.

Change-Id: I54d72aba3b1901c505aec754f2183e4d8d2e82dd
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 061895fbe57d29f50bb3c6c8609d56a668d1387d)
2018-01-17 15:27:28 +08:00
Bin Meng b717f6f66c UPSTREAM: 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().

Change-Id: Ib3df40451289134cc7e60a37293a33fc9fd35547
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit b90203526f2c5bcc05b4a65241ea226b7b9f52d0)
2018-01-17 15:27:28 +08:00
Bin Meng 32cec33c6f UPSTREAM: 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.

Change-Id: I14a3f6698ba805f5ef35242ab9b374a91158552c
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 932bb668bb2464115f2d08abbed44e58cfce9536)
2018-01-17 15:27:28 +08:00
Bin Meng a9cf383983 UPSTREAM: 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.

Change-Id: I035b83fb71ce4aa37f23fccba430d65814600a55
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit c008faa77358bb5b313696dd1d5bb8afa03a6ca2)
2018-01-17 15:27:28 +08:00
Seung-Woo Kim f8cd15a159 UPSTREAM: spl: spl_mmc: add __maybe_unused to mmc_load_image_raw_sector()
If there are no CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION,
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR and CONFIG_SPL_OS_BOOT,
there is unused-function build warning. Add __maybe_unused macro
to remove the warning.

Change-Id: Ibd880ebc42fdb4610106a8f53645bfd61825dc9e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit b016b585425b66ea53eef6b8600aff78a4205b9e)
2018-01-16 18:17:07 +08:00
Bin Meng 344f8eb9b9 UPSTREAM: dm: usb: storage: Fix broken read/write when both EHCD and xHCD are enabled
When EHCD and xHCD are enabled at the same time, USB storage device
driver will fail to read/write from/to the storage device attached
to the xHCI interface, due to its transfer blocks exceeds the xHCD
driver limitation.

With driver model, we have an API to get the controller's maximum
transfer size and we can use that to determine the storage driver's
capability of read/write.

Note: the non-DM version driver is still broken with xHCD and the
intent here is not to fix the non-DM one, since the xHCD itself is
already broken in places like 3.0 hub support, etc.

Change-Id: Id95b187ad7c34d80b236f425cd1cf3da7b954589
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit ea7fad91019654fb21e6cd04f963e0482869dba5)
2018-01-16 18:17:07 +08:00
Bin Meng 86b376c416 UPSTREAM: usb: storage: Refactor to use max_xfer_blk from struct us_data
This adds a new memeber max_xfer_blk in struct us_data to record
the maximum number of transfer blocks for the storage device.

It is set per HCD setting, and so far is to 65535 for EHCD and 20
for everything else.

Change-Id: I53b942501431471c981b3f82ae1028ecd7b45069
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 6158d0b42411165d34635a2ddfea17e12dce3329)
2018-01-16 18:17:07 +08:00
York Sun d18ad2e6e5 UPSTREAM: spl: Fix compiling warning on gunzip argument
common/spl/spl_fit.c:201:12: warning: passing argument 4 of ‘gunzip’
from incompatible pointer type [-Wincompatible-pointer-types]
       src, &length))

Change-Id: I58ddaf516e012064afaea3710abb4e4d9710487b
Signed-off-by: York Sun <york.sun@nxp.com>
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
CC: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 933f67aa56ea742f014b21bfe50a16a00e97b9bd)
2018-01-16 18:16:48 +08:00
Philipp Tomsich 286803a6b4 UPSTREAM: bootstage: adjust Makefile to allow including bootstage in SPL, but not in TPL
For timing our bootstages on the RK3368, which has a minimal TPL
(and where we consequently don't want to time the bootstages) and a
full-featured SPL (where we can bootstage recording), we need to
adjust the Makefile.

Use the $(SPL_TPL_) macro in the Makefile for bootstage.o

Change-Id: Ib3cd45000bfbfb37377c96c9f41a467a760650aa
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 148a139d65b7fdb93326d7870b40c618d4601a8a)
2018-01-16 18:16:48 +08:00
Pantelis Antoniou 988a4042e6 UPSTREAM: fit: Introduce methods for applying overlays on fit-load
Introduce an overlay based method for constructing a base DT blob
to pass to the kernel.

It is based on a specific method now to get the FDT from a FIT image
named boot_get_fdt_fit().

Change-Id: I98e0526edd594e63b1c29bdd916e4c66774f4337
Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 169043d826e6b0db3c67a60acbedfc72c43aae5d)
2018-01-16 18:16:48 +08:00