oweals/u-boot.git
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Mon, 4 Nov 2019 00:28:54 +0000 (19:28 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86

- Add support for Intel FSP-S and FSP-T in binman
- Correct priority selection for image loaders for SPL
- Add a size check for TPL
- Various small SPL/TPL bug fixes and changes
- SPI: Add support for memory-mapped flash

4 years agotbs2910: Disable Plan9/RTEMS bootm support
Tom Rini [Sat, 2 Nov 2019 18:43:06 +0000 (14:43 -0400)]
tbs2910: Disable Plan9/RTEMS bootm support

We have once again reached a point where this board does not build in
some cases with supported toolchains due to reaching a size constraint.
To regain some space, disable support for Plan 9 / RTEMS images with the
bootm command.

Acked-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agox86: Quieten TPL's jump_to_image_no_args()
Simon Glass [Mon, 21 Oct 2019 03:37:57 +0000 (21:37 -0600)]
x86: Quieten TPL's jump_to_image_no_args()

We already a message indicating that U-Boot is about to jump to SPL, so
make this one a debug() to reduce code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: Don't print CPU info in TPL
Simon Glass [Mon, 21 Oct 2019 03:37:56 +0000 (21:37 -0600)]
x86: Don't print CPU info in TPL

We don't need to do this and it is done (in more detail) in U-Boot proper.
Drop this to save code space.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: Move CPU init to before spl_init()
Simon Glass [Mon, 21 Oct 2019 03:37:55 +0000 (21:37 -0600)]
x86: Move CPU init to before spl_init()

At present we call spl_init() before identifying the CPU. This is not a
good idea - e.g. if bootstage is enabled then it will try to set up the
timer which works better if the CPU is identified.

Put explicit code at each entry pointer to identify the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: Add a CPU init function for TPL
Simon Glass [Mon, 21 Oct 2019 03:37:54 +0000 (21:37 -0600)]
x86: Add a CPU init function for TPL

For TPL we only need to set up the features and identify the CPU to a
basic level. Add a function to handle that.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: tpl: Add a fake PCI bus
Simon Glass [Mon, 21 Oct 2019 03:37:50 +0000 (21:37 -0600)]
x86: tpl: Add a fake PCI bus

In TPL we try to minimise code size so do not include the PCI subsystem.
We can use fixed BARs and drivers can directly program the devices that
they need.

However we do need to bind the devices on the PCI bus and without PCI this
does not ordinarily happen. As a work-around, define a fake PCI bus which
does this binding, but no other PCI operations. This is a convenient way
to ensure that we can use the same device tree for TPL, SPL and U-Boot
proper:

   TPL    - CONFIG_TPL_PCI is not set (no auto-config, fake PCI bus)
   SPL    - CONFIG_SPL_PCI is set (no auto-config but with real PCI bus)
   U-Boot - CONFIG_PCI is set (full auto-config after relocation)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: spl: Support init of a PUNIT
Simon Glass [Mon, 21 Oct 2019 03:37:49 +0000 (21:37 -0600)]
x86: spl: Support init of a PUNIT

The x86 power unit handles power management. Support initing this device
which is modelled as a new type of system controller since there are no
operations needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: timer: Use a separate flag for whether timer is inited
Simon Glass [Mon, 21 Oct 2019 03:37:47 +0000 (21:37 -0600)]
x86: timer: Use a separate flag for whether timer is inited

At present the value of the timer base is used to determine whether the
timer has been set up or not. It is true that the timer is essentially
never exactly 0 when it is read. However 'time 0' may indicate the time
that the machine was reset so it is useful to be able to denote that.

Update the code to use a separate flag instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Aiden Park <aiden.park@intel.com>
Reviewed-by: Aiden Park <aiden.park@intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: timer: Set up the timer in timer_early_get_count()
Simon Glass [Mon, 21 Oct 2019 03:31:54 +0000 (21:31 -0600)]
x86: timer: Set up the timer in timer_early_get_count()

This function can be called before the timer is set up. Make sure that the
init function is called so that it works correctly.

This is needed so that bootstage can work correctly in TPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agospl: Add a size check for TPL
Simon Glass [Mon, 21 Oct 2019 03:31:52 +0000 (21:31 -0600)]
spl: Add a size check for TPL

We have the ability to enforce a maximum size for SPL but not yet for TPL.
Add a new option for this.

Document the size check macro while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agodm: doc: Correct of-platdata driver name
Simon Glass [Mon, 21 Oct 2019 03:31:48 +0000 (21:31 -0600)]
dm: doc: Correct of-platdata driver name

Add a note about the driver name in the of-platdata documentation since
the naming must follow the compatible string.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agospi: Add support for memory-mapped flash
Simon Glass [Mon, 21 Oct 2019 03:31:47 +0000 (21:31 -0600)]
spi: Add support for memory-mapped flash

On x86 platforms the SPI flash can be mapped into memory so that the
contents can be read with normal memory accesses.

Add a new SPI method to find the location of the SPI flash in memory. This
differs from the existing device-tree "memory-map" mechanism in that the
location can be discovered at run-time.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agospl: Correct priority selection for image loaders
Simon Glass [Mon, 21 Oct 2019 03:31:45 +0000 (21:31 -0600)]
spl: Correct priority selection for image loaders

At present the name of the image comes first in the linker-list symbol
used. This means that the name of the function sets the sort order, which
is not the intention.

Update it to put the boot-device type first, then the priority. This
produces the expected behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agobinman: Fix up comment in intel-fsp-m
Simon Glass [Mon, 21 Oct 2019 03:31:37 +0000 (21:31 -0600)]
binman: Fix up comment in intel-fsp-m

This comment references the wrong FSP component. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agobinman: Add support for Intel FSP-T
Simon Glass [Mon, 21 Oct 2019 03:31:36 +0000 (21:31 -0600)]
binman: Add support for Intel FSP-T

This entry is used to hold an Intel FSP-T (Firmware Support Package
Temp-RAM init) binary. Add support for this in binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agobinman: Add support for Intel FSP-S
Simon Glass [Mon, 21 Oct 2019 03:31:35 +0000 (21:31 -0600)]
binman: Add support for Intel FSP-S

This entry is used to hold an Intel FSP-S (Firmware Support Package
Silicon init) binary. Add support for this in binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agobinman: Correct symbol calculation with non-zero image base
Simon Glass [Mon, 21 Oct 2019 03:31:34 +0000 (21:31 -0600)]
binman: Correct symbol calculation with non-zero image base

At present binman adds the image base address to the symbol value before
it writes it to the binary. This is not correct since the symbol value
itself (e.g. image position) has no relationship to the image base.

Fix this and update the tests to cover this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agocbfs: do not pack struct cbfs_cachenode
Heinrich Schuchardt [Sun, 6 Oct 2019 22:37:45 +0000 (00:37 +0200)]
cbfs: do not pack struct cbfs_cachenode

With the __packed attribute sandbox_defconfig cannot be compiled with GCC
9.2.1:

fs/cbfs/cbfs.c: In function ‘file_cbfs_fill_cache’:
fs/cbfs/cbfs.c:164:16: error: taking address of packed member of
‘struct cbfs_cachenode’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  164 |   cache_tail = &new_node->next;
      |                ^~~~~~~~~~~~~~~

struct cbfs_cachenode is only an internal structure. So let's rearrange the
fields such that the structure is naturally packed and remove the __packed
attribute.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMerge tag 'arc-fixes-for-2020.01-rc2' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Fri, 1 Nov 2019 21:49:40 +0000 (17:49 -0400)]
Merge tag 'arc-fixes-for-2020.01-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-arc

ARC fixes for v2020.01-rc2

The main change is move to DM_MMC of yet 2 another ARC boards:
AXS101 & IoTDK.

Among that we improve handling of stock-formatted SD-cards of high volume
on EM SDP as well as introduction of reset driver for HSDK which is required
for prepser reinitialization of some peripherals like USB etc.

4 years agoazure: Update the script to prepend PATH not override PATH
Tom Rini [Fri, 1 Nov 2019 17:59:14 +0000 (13:59 -0400)]
azure: Update the script to prepend PATH not override PATH

Similar to 90d3d78a1c68 ("gitlab-ci: Prepend to PATH rather than replace
it") we need to prepend the PATH with our additional binaries and not
replace the value fully as doing so breaks virtualenv.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoarc: emsdp: docs: Prefer Degilent over Opella-XD
Alexey Brodkin [Wed, 9 Oct 2019 07:18:18 +0000 (10:18 +0300)]
arc: emsdp: docs: Prefer Degilent over Opella-XD

Back in the day on early board samples built-in Digilent JTAG probe
was not functional so we used externally attached Ashling Opella-XD
probe. But now with production units everything works as expected and
so we anybody may enjoy readily avaialble built-in JTAG probe so
we specify Digilent oprion on MDB's command line example.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: [plat-axs101]: migrate to DM_MMC
Eugeniy Paltsev [Tue, 8 Oct 2019 16:45:01 +0000 (19:45 +0300)]
ARC: [plat-axs101]: migrate to DM_MMC

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoMAINTAINERS: add info about ARC HSDK reset driver
Eugeniy Paltsev [Tue, 8 Oct 2019 16:29:31 +0000 (19:29 +0300)]
MAINTAINERS: add info about ARC HSDK reset driver

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK: introduce reset driver
Eugeniy Paltsev [Tue, 8 Oct 2019 16:29:30 +0000 (19:29 +0300)]
ARC: HSDK: introduce reset driver

Introduce reset driver for Synopsys ARC HSDK SoC

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoarc: emsdp/iotdk: Switch to DM_MMC
Alexey Brodkin [Tue, 8 Oct 2019 10:24:29 +0000 (13:24 +0300)]
arc: emsdp/iotdk: Switch to DM_MMC

Somehow EMSDP & IoT DK boards were skipped on ARC boads conversion
to DM MMC. So doing it now.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoarc: emsdp: Increase max FAT cluster size
Alexey Brodkin [Tue, 8 Oct 2019 10:25:30 +0000 (13:25 +0300)]
arc: emsdp: Increase max FAT cluster size

Some especially large SD-cards come from stock formatted with
larger FAT cluster size so to accommodate those we just increase
what we expect to have here in U-Boot given we have a plenty of
space on EM SDP (16 MiB).

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoMerge tag 'efi-2020-01-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 1 Nov 2019 13:37:02 +0000 (09:37 -0400)]
Merge tag 'efi-2020-01-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-01-rc2

Provide a better user interface for setting UEFI variables.

Bug fixes:
- ext4 file system not discovered on UEFI block device
- 'make tests' build error on 32bit systems

4 years agoMerge tag 'video-for-2020.01-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot...
Tom Rini [Fri, 1 Nov 2019 13:35:37 +0000 (09:35 -0400)]
Merge tag 'video-for-2020.01-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-video

 - fix splash build breakage with newer llvm-7

4 years agoMerge tag 'dm-pull-29oct19' of git://git.denx.de/u-boot-dm
Tom Rini [Fri, 1 Nov 2019 13:34:35 +0000 (09:34 -0400)]
Merge tag 'dm-pull-29oct19' of git://git.denx.de/u-boot-dm

- Fix for patman with email addresses containing commas
- Bootstage improvements for TPL, SPL
- Various sandbox and dm improvements and fixes

4 years agoMerge branch '2019-10-30-master-imports'
Tom Rini [Fri, 1 Nov 2019 13:23:21 +0000 (09:23 -0400)]
Merge branch '2019-10-30-master-imports'

- Migrate test.py to use python3 and current pytest.
- NVMe bugfixes
- Assorted other fixes
- Android AVB updates.

4 years agoazure: Update for python3 and current pytest
Tom Rini [Thu, 31 Oct 2019 14:45:03 +0000 (10:45 -0400)]
azure: Update for python3 and current pytest

Similar to the rework for GitLab-CI and Travis-CI, rework the Azure
Pipeline to use python3 and requirements.txt to install the necessary
modules.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agocmd: avb: Support A/B slots
Sam Protsenko [Mon, 21 Oct 2019 10:55:16 +0000 (13:55 +0300)]
cmd: avb: Support A/B slots

Add optional parameter to 'avb verify' sub-command, so that user is able
to specify which slot to use, in case when user's partitions are
slotted. If that parameter is omitted, the behavior of 'avb verify' will
be the same as before, so user API is content.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Acked-by: Igor Opaniuk <igor.opaniuk@gmail.com>
4 years agocmd: avb: Fix requested partitions list
Sam Protsenko [Thu, 15 Aug 2019 17:49:47 +0000 (20:49 +0300)]
cmd: avb: Fix requested partitions list

The requested_partitions[] array should contain only boot partitions.
Usually it's only 'boot' partition, as can be seen in [1]. Also, seems
like the requested_partitions[] are only used when there is no 'vbmeta'
partition [2], which is not a regular use-case.

Make requested_partitions[] contain only 'boot' partition as it was
supposed to be, and also make that array to be a local in
do_avb_verify_part() function, as nobody else needs that.

[1] https://android.googlesource.com/platform/external/avb/+/5fbb42a189aa/test/avb_slot_verify_unittest.cc#108
[2] https://android.googlesource.com/platform/external/avb/+/5fbb42a189aa/libavb/avb_slot_verify.c#1461

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>
4 years agolibavb: Fix build warnings after updating the lib
Sam Protsenko [Thu, 15 Aug 2019 20:04:03 +0000 (23:04 +0300)]
libavb: Fix build warnings after updating the lib

After updating libavb to most recent version from AOSP/master, two new
warnings appear:

Warning #1:

    lib/libavb/avb_cmdline.c: In function 'avb_append_options':
    lib/libavb/avb_cmdline.c:365:15: warning: 'dm_verity_mode' may be
                                     used uninitialized in this function
                                     [-Wmaybe-uninitialized]
         new_ret = avb_replace(
                   ^~~~~~~~~~~~
             slot_data->cmdline, "$(ANDROID_VERITY_MODE)", dm_verity_mode);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    lib/libavb/avb_cmdline.c:374:8: warning: 'verity_mode' may be used
                                    uninitialized in this function
                                    [-Wmaybe-uninitialized]
       if (!cmdline_append_option(
            ^~~~~~~~~~~~~~~~~~~~~~
               slot_data, "androidboot.veritymode", verity_mode)) {
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Warning #2:

    lib/libavb/avb_slot_verify.c: In function 'avb_slot_verify':
    lib/libavb/avb_slot_verify.c:1349:23: warning: 'ret' may be used
                                          uninitialized in this function
                                          [-Wmaybe-uninitialized]
       AvbSlotVerifyResult ret;
                           ^~~

Fix those by providing default return values to affected functions.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
4 years agolibavb: Update libavb to current AOSP master
Sam Protsenko [Thu, 15 Aug 2019 20:04:02 +0000 (23:04 +0300)]
libavb: Update libavb to current AOSP master

Update libavb to commit 5fbb42a189aa in AOSP/master, because new version
has support for super partition [1], which we need for implementing
Android dynamic partitions. All changes from previous patches for libavb
in U-Boot are accounted for in this commit:
  - commit ecc6f6bea6a2 ("libavb: Handle wrong hashtree_error_mode in
                          avb_append_options()")
  - commit 897a1d947e7e ("libavb: Update SPDX tag style")
  - commit d8f9d2af96b3 ("avb2.0: add Android Verified Boot 2.0 library")

Tested on X15:

    ## Android Verified Boot 2.0 version 1.1.0
    read_is_device_unlocked not supported yet
    read_rollback_index not supported yet
    read_is_device_unlocked not supported yet
    Verification passed successfully
    AVB verification OK.

Unit test passes:

    $ ./test/py/test.py --bd sandbox --build -k test_avb

      test/py/tests/test_android/test_avb.py ss..s.

[1] https://android.googlesource.com/platform/external/avb/+/49936b4c0109411fdd38bd4ba3a32a01c40439a9

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
Acked-by: Igor Opaniuk <igor.opaniuk@gmail.com>
4 years agomkimage: Set correct FDT type and ramdisk architecture in FIT auto mode
Michal Sojka [Fri, 13 Sep 2019 10:43:12 +0000 (12:43 +0200)]
mkimage: Set correct FDT type and ramdisk architecture in FIT auto mode

When running the following command

    mkimage -f auto -A arm -O linux -T kernel -C none -a 0x8000 -e 0x8000 \
            -d zImage -b zynq-microzed.dtb -i initramfs.cpio image.ub

the type of fdt subimage is the same as of the main kernel image and
the architecture of the initramfs image is not set. Such an image is
refused by U-Boot when booting. This commits sets the mentioned
attributes, allowing to use the "-f auto" mode in this case instead of
writing full .its file.

Following is the diff of mkimage output without and with this commit:

 FIT description: Kernel Image image with one or more FDT blobs
 Created:         Thu Sep 12 23:23:16 2019
  Image 0 (kernel-1)
   Description:
   Created:      Thu Sep 12 23:23:16 2019
   Type:         Kernel Image
   Compression:  uncompressed
   Data Size:    4192744 Bytes = 4094.48 KiB = 4.00 MiB
   Architecture: ARM
   OS:           Linux
   Load Address: 0x00008000
   Entry Point:  0x00008000
  Image 1 (fdt-1)
   Description:  zynq-microzed
   Created:      Thu Sep 12 23:23:16 2019
-  Type:         Kernel Image
+  Type:         Flat Device Tree
   Compression:  uncompressed
   Data Size:    9398 Bytes = 9.18 KiB = 0.01 MiB
   Architecture: ARM
-  OS:           Unknown OS
-  Load Address: unavailable
-  Entry Point:  unavailable
  Image 2 (ramdisk-1)
   Description:  unavailable
   Created:      Thu Sep 12 23:23:16 2019
   Type:         RAMDisk Image
   Compression:  Unknown Compression
   Data Size:    760672 Bytes = 742.84 KiB = 0.73 MiB
-  Architecture: Unknown Architecture
+  Architecture: ARM
   OS:           Linux
   Load Address: unavailable
   Entry Point:  unavailable
  Default Configuration: 'conf-1'
  Configuration 0 (conf-1)
   Description:  zynq-microzed
   Kernel:       kernel-1
   Init Ramdisk: ramdisk-1
   FDT:          fdt-1
   Loadables:    kernel-1

Signed-off-by: Michal Sojka <michal.sojka@cvut.cz>
4 years agodrivers: phy: Handle gracefully NULL pointers
Jean-Jacques Hiblot [Tue, 1 Oct 2019 12:03:26 +0000 (14:03 +0200)]
drivers: phy: Handle gracefully NULL pointers

For some controllers PHYs can be optional. Handling NULL pointers without
crashing nor failing, makes it easy to handle optional PHYs.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
4 years agolinux_compat: fix potential NULL pointer access
Marek Szyprowski [Wed, 2 Oct 2019 12:37:20 +0000 (14:37 +0200)]
linux_compat: fix potential NULL pointer access

malloc_cache_aligned() might return zero, so fix potential NULL pointer
access if __GFP_ZERO flag is set.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Ralph Siemsen <ralph.siemsen@linaro.org>
4 years agotiny-printf: Support vsnprintf()
Simon South [Wed, 2 Oct 2019 14:55:07 +0000 (10:55 -0400)]
tiny-printf: Support vsnprintf()

Add a simple implementation of this function, to allow logging to be
enabled in the SPL or TPL for systems that rely on the tiny printf()
implementation.

To keep the code size small,

- The function is built only when logging is enabled, as it
  (currently) is not needed otherwise; and
- Like the existing implementation of snprintf(), its buffer-size
  parameter is ignored.

Signed-off-by: Simon South <simon@simonsouth.net>
4 years agocommon: Kconfig: Fix typo in TPL_LOG_CONSOLE description
Simon South [Wed, 2 Oct 2019 14:55:06 +0000 (10:55 -0400)]
common: Kconfig: Fix typo in TPL_LOG_CONSOLE description

Signed-off-by: Simon South <simon@simonsouth.net>
4 years agolib: errno: avoid error format-overflow
Heinrich Schuchardt [Sun, 6 Oct 2019 11:58:57 +0000 (13:58 +0200)]
lib: errno: avoid error format-overflow

In cmd/regulator.c an error occurs with GCC 9.2.1 if CONFIG_ERRNO_STR is
not defined:

cmd/regulator.c: In function ‘failure’:
cmd/regulator.c:20:2: error: ‘%s’ directive argument is null
[-Werror=format-overflow=]
   20 |  printf("Error: %d (%s)\n", ret, errno_str(ret));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘constraint’,
    inlined from ‘constraint’ at cmd/regulator.c:111:12:
cmd/regulator.c:115:3: error: ‘%s’ directive argument is null
[-Werror=format-overflow=]
  115 |   printf(" %s (err: %d)\n", errno_str(val), val);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

errno_str() should return a valid string instead of NULL if
CONFIG_ERRNO_STR is not defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agolib: errno: sync error codes
Heinrich Schuchardt [Sun, 6 Oct 2019 11:22:21 +0000 (13:22 +0200)]
lib: errno: sync error codes

Macro ERRNO_MSG() ignores the error number but we should still use the same
constants as in include/linux/errno.h.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agodts: fix MULTI_DTB_FIT compression choice prompt
Baruch Siach [Mon, 7 Oct 2019 12:05:47 +0000 (15:05 +0300)]
dts: fix MULTI_DTB_FIT compression choice prompt

This choice is not about SPL for which we have a separate choice.

Fixes: 95f4bbd581 ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
4 years agoata: ahci allow 64-bit DMA for SATA
Roman Kapl [Mon, 14 Oct 2019 09:21:09 +0000 (11:21 +0200)]
ata: ahci allow 64-bit DMA for SATA

Allow 64-bit DMA on AHCI. If not supported by the host controller, at
least print a message and fail.

Signed-off-by: Roman Kapl <rka@sysgo.com>
4 years agodisk: part_dos: correctly detect DOS PBR
Heinrich Schuchardt [Tue, 15 Oct 2019 18:43:42 +0000 (20:43 +0200)]
disk: part_dos: correctly detect DOS PBR

The signature 0x55 0xAA in bytes 510 and 511 of the first sector can either
indicate a DOS partition table of the first sector of a FAT file system.

The current code tries to check if the partition table is valid by looking
at the boot indicator of the partition entries. But first of all it does
not count from 0 to 3 but only from 0 to 2. And second it misses to
increment the pointer for the partition entry.

If it is a FAT file system can be discovered by looking for the text 'FAT'
at offset 0x36 or 'FAT32' at offset 0x52. In a DOS PBR there are no
partition entries, so those bytes are undefined. Don't require the byte at
offset 0x1BE to differ from 0x00 and 0x80.

With the patch the logic is changed as follows:

If the partition table has either an invalid boot flag for any partition or
has no partition at all, check if the first sector is a DOS PBR by looking
at the FAT* signature.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotest: provide test for errno_str()
Heinrich Schuchardt [Tue, 15 Oct 2019 19:46:04 +0000 (21:46 +0200)]
test: provide test for errno_str()

Provide a unit test for errno_str(). Test that known and unknown error
numbers are handled correctly.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolib: errno: check for unsupported error number
Heinrich Schuchardt [Tue, 15 Oct 2019 19:46:03 +0000 (21:46 +0200)]
lib: errno: check for unsupported error number

If errno_str() is called with an unsupported error number, do not return a
random pointer but a reasonable text.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolib: time: Add microsecond timer
Marek Vasut [Tue, 15 Oct 2019 20:43:41 +0000 (22:43 +0200)]
lib: time: Add microsecond timer

Add get_timer_us(), which is useful e.g. when we need higher
precision timestamps.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
[trini: Fixup arch/arm/mach-bcm283x/include/mach/timer.h]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoNVMe: do PCI enumerate before nvme scan
Patrick Wildt [Thu, 3 Oct 2019 09:10:57 +0000 (11:10 +0200)]
NVMe: do PCI enumerate before nvme scan

Make sure that the PCI busses are enumerated before trying to
find a NVMe device.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agonvme: use page-aligned buffer for identify command
Patrick Wildt [Wed, 16 Oct 2019 06:42:04 +0000 (08:42 +0200)]
nvme: use page-aligned buffer for identify command

Change the stack-allocated buffer for the identification command
to explicitly allocate page-aligned buffers.  Even though the spec
seems to allow having admin queue commands on non page-aligned
buffers, it seems to not be possible on my i.MX8MQ board with a
a Silicon Power P34A80.  Since all of the NVMe drivers I have seen
always do admin commands on a page-aligned buffer, which does work
on my system, it makes sense for us to do that as well.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agonvme: flush dcache on both r/w, and the prp list
Patrick Wildt [Wed, 16 Oct 2019 21:22:50 +0000 (23:22 +0200)]
nvme: flush dcache on both r/w, and the prp list

It's possible that the data cache for the buffer still holds data
to be flushed to memory, since the buffer was probably used as stack
before.  Thus we need to make sure to flush it also on reads, since
it's possible that the cache is automatically flused to memory after
the NVMe DMA transfer happened, thus overwriting the NVMe transfer's
data.  Also add a missing dcache flush for the prp list.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agovirtio: pci: use correct type in virtio_pci_bind()
Heinrich Schuchardt [Wed, 16 Oct 2019 10:59:49 +0000 (12:59 +0200)]
virtio: pci: use correct type in virtio_pci_bind()

For printing as %u we should use an unsigned int.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agocheckpatch.pl: update from Linux kernel v5.4-rc3
Heinrich Schuchardt [Sat, 19 Oct 2019 07:06:38 +0000 (09:06 +0200)]
checkpatch.pl: update from Linux kernel v5.4-rc3

Update from upstream.

Just minor changes like checking that the author has also done a sign-off.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agosplash: fix build breakage with newer llvm-7
Anatolij Gustschin [Wed, 30 Oct 2019 14:04:10 +0000 (15:04 +0100)]
splash: fix build breakage with newer llvm-7

Some configurations (i.e. sandbox) result in unused
splash_display_banner() and we get build errors like:

  common/splash.c:148:20: error: unused function 'splash_display_banner' [-Werror,-Wunused-function]
  static inline void splash_display_banner(void) { }

Drop empty inline function and add guards around the call.

Fixes: d2a8271c8851 ("splash: fix splash banner output")
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reported-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agodts: Kconfig: Fix help for SPL_OF_CONTROL
Walter Lozano [Tue, 22 Oct 2019 14:50:19 +0000 (11:50 -0300)]
dts: Kconfig: Fix help for SPL_OF_CONTROL

As initially this feature was implemented as a negative CONFIG and
later it was redesigned to be positive the help text should be
updated to reflect this change.

This commit updates the help text to match the current implementation.

Signed-off-by: Walter Lozano <wlozano@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMakefile: Fix printing problem in size_check on overflow
Tom Rini [Wed, 23 Oct 2019 19:39:41 +0000 (15:39 -0400)]
Makefile: Fix printing problem in size_check on overflow

When we have an excess size growth, fix the "limit" printf call to pass
in just the limit variable rather than the string bytes to the format
character.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
4 years agogpio: da8xx_gpio: Fix the _gpio_direction_output function
Keerthy [Thu, 24 Oct 2019 08:22:28 +0000 (13:52 +0530)]
gpio: da8xx_gpio: Fix the _gpio_direction_output function

_gpio_direction_output function currently calls gpio_set_value
with the wrong gpio number. gpio_set_value in the uclass driver
expects a different gpio number and the _gpio_direction_output
is currently providing the number specific to the bank.

Hence fix it by calling the _gpio_set_value function instead.

Reported-by: Faiz Abbas <faiz_abbas@ti.com>
Fixes: 8e51c0f254 ("dm: gpio: Add DM compatibility to GPIO driver for Davinci")
Signed-off-by: Keerthy <j-keerthy@ti.com>
4 years agotest/py: Use raw strings more to avoid deprecation warnings
Tom Rini [Thu, 24 Oct 2019 15:59:28 +0000 (11:59 -0400)]
test/py: Use raw strings more to avoid deprecation warnings

We have two further uses of raw string usage in the test/py codebase
that are used under CI.  The first of which is under the bind test and
is a direct update.  The second of which is to strip VT100 codes from
the match buffer.  While switching this to a raw string is also a direct
update, the comment it notes that problems were encountered on Ubuntu
14.04 (and whatever Python 2 version that was) that required slight
tweaks to the regex.  Replace that now that we're saying Python 3.5 is
the minimum.

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agogitlab/travis: Rework how and when we use virtualenv in order to use python3
Tom Rini [Thu, 24 Oct 2019 15:59:27 +0000 (11:59 -0400)]
gitlab/travis: Rework how and when we use virtualenv in order to use python3

As things stand today, we have tools that CI requires where "python"
must be "python2".  We need to use a virtualenv and pip in order to
ensure that our pytest tests can be run.  Rework things slightly so
that:
- On Travis-CI, we install python-pyelftools for the platforms that
  require pyelftools to be installed.
- On GitLab-CI, we move to a newer base image that includes python3-pip
  and continue to use a virtualenv per job that needs it, for the
  correct set of packages.

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agotest/py: Update docs, add requirements.txt for pip
Tom Rini [Thu, 24 Oct 2019 15:59:26 +0000 (11:59 -0400)]
test/py: Update docs, add requirements.txt for pip

To be more closely aligned with Python community best practices, we need
to better document our usage of pip and make use of a requirements.txt
file that shows the versions of the tools that we are using.  This will
aide in ensuring reproducibility of our tests as well.

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agotest/py: Rework test.py to be a different kind of wrapper
Tom Rini [Thu, 24 Oct 2019 15:59:25 +0000 (11:59 -0400)]
test/py: Rework test.py to be a different kind of wrapper

Now that we have moved to being based on pytest for python3 we need to
make our test.py wrapper more robust in terms of only calling python3
rather than possibly finding and using python2.  To do this, change from
execvp()'ing pytest to invoking the package itself via python.  In the
event that pytest is unavailable we still get a user-friendly error:

pkg_resources.DistributionNotFound: The 'pytest' distribution was not found and is required by the application

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agotest/py: Update test_fs to decode check_output calls
Tom Rini [Thu, 24 Oct 2019 15:59:24 +0000 (11:59 -0400)]
test/py: Update test_fs to decode check_output calls

The check_output function from the subprocess Python module by default
returns data as encoded bytes and leaves decoding to the application.
Given our uses of the call, it makes the most sense to immediately
decode the results.

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agotest/py: test_efi_selftest.py: Updates for python 3 support
Tom Rini [Thu, 24 Oct 2019 15:59:23 +0000 (11:59 -0400)]
test/py: test_efi_selftest.py: Updates for python 3 support

- In python 3 you must use raw strings for regex as other forms are
  deprecated and would require further changes to the pattern here.
  In one case this lets us have a simpler match pattern.
- As strings are now Unicode our complex tests (Euro symbol,
  SHIFT+ALT+FN 5) we need to declare that as a bytes string and then
  decode it for use.

Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agotest/py: test_ut.py: Ensure we use bytes
Tom Rini [Thu, 24 Oct 2019 15:59:22 +0000 (11:59 -0400)]
test/py: test_ut.py: Ensure we use bytes

In the case of some unit tests we are working with providing a fake
flash device that we have written some text strings in to.  In this case
we want to tell Python to encode things to bytes for us.

Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agotest/py: Manual python3 fixes
Tom Rini [Thu, 24 Oct 2019 15:59:21 +0000 (11:59 -0400)]
test/py: Manual python3 fixes

- Modern pytest is more visible in telling us about parameters that we
  had not described, so describe a few more.
- ConfigParser.readfp(...) is now configparser.read_file(...)
- As part of the "strings vs bytes" conversions in Python 3, we use the
  default encoding/decoding of utf-8 but in some places tell Python to
  replace problematic conversions rather than throw a fatal error.
- Fix a typo noticed while doing the above ("tot he" -> "to the").
- As suggested by Stephen, re-alphabetize the import list
- Per Heinrich, replace how we write contents in test_fit.py

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agotest/py: Automated conversion to Python 3
Tom Rini [Thu, 24 Oct 2019 15:59:20 +0000 (11:59 -0400)]
test/py: Automated conversion to Python 3

Use the 2to3 tool to perform numerous automatic conversions from Python
2 syntax to Python 3.  Also fix whitespace problems that Python 3
catches that Python 2 did not.

Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agotest/py: Fix pytest4 deprecation warnings
Marek Vasut [Thu, 24 Oct 2019 15:59:19 +0000 (11:59 -0400)]
test/py: Fix pytest4 deprecation warnings

Fix the following spit from pytest:

u-boot/test/py/conftest.py:438: RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly.
  Please use node.get_closest_marker(name) or node.iter_markers(name).
  Docs: https://docs.pytest.org/en/latest/mark.html#updating-code
    for board in mark.args:

In both cases, the later suggestion is applicable.

Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Igor Opaniuk <igor.opaniuk@gmail.com>
[trini: Update for current file with a few more cases, un-pin pytest in CI]
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agotest/py: Split mark to multiple lines
Tom Rini [Thu, 24 Oct 2019 15:59:18 +0000 (11:59 -0400)]
test/py: Split mark to multiple lines

We inconsistently note multiple dependencies today in our tests,
sometimes with a single line that declares multiple and sometimes
multiple single lines.  Current pytest seems to fail on the single line
format so change to multiple declarations.

Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agogitlab-ci: Prepend to PATH rather than replace it
Tom Rini [Thu, 24 Oct 2019 15:59:17 +0000 (11:59 -0400)]
gitlab-ci: Prepend to PATH rather than replace it

Currently we set the entire PATH rather than prepend the new paths that
we need to have searched.  This however breaks parts of the "virtualenv"
that was have set up and need to use as that also will be modifying
PATH.  To fix this, prepend our new locations instead.

Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agogitlab-ci: Fix indentation in some stanzas
Tom Rini [Thu, 24 Oct 2019 15:59:16 +0000 (11:59 -0400)]
gitlab-ci: Fix indentation in some stanzas

In a number of our stanzas we had multi-line commands that were one
space short of alignment, correct this.

Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge tag 'u-boot-clk-23Oct2019' of https://gitlab.denx.de/u-boot/custodians/u-boot-clk
Tom Rini [Wed, 30 Oct 2019 17:13:46 +0000 (13:13 -0400)]
Merge tag 'u-boot-clk-23Oct2019' of https://gitlab.denx.de/u-boot/custodians/u-boot-clk

- Add I2C clocks for i.MX6Q CCF driver
- Fix check in clk_set_default_parents()
- Managed API to get clock from device tree
- Fixes for core clock code (including sandbox regression tests)

4 years agoPrepare v2020.01-rc1 v2020.01-rc1
Tom Rini [Wed, 30 Oct 2019 17:01:05 +0000 (13:01 -0400)]
Prepare v2020.01-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoefi_loader: correct includes in efi_variable.c
Heinrich Schuchardt [Sat, 26 Oct 2019 21:53:48 +0000 (23:53 +0200)]
efi_loader: correct includes in efi_variable.c

'make tests' on an 32bit ARM system leads to

In file included from ../lib/efi_loader/efi_variable.c:9:
../include/malloc.h:364:7: error: conflicting types for ‘memset’
 void* memset(void*, int, size_t);
       ^~~~~~
In file included from ../include/compiler.h:126,
                 from ../include/env.h:12,
                 from ../lib/efi_loader/efi_variable.c:8:
../include/linux/string.h:103:15:
note: previous declaration of ‘memset’ was here
 extern void * memset(void *,int,__kernel_size_t);
               ^~~~~~
In file included from ../lib/efi_loader/efi_variable.c:9:
../include/malloc.h:365:7: error: conflicting types for ‘memcpy’
 void* memcpy(void*, const void*, size_t);
       ^~~~~~
In file included from ../include/compiler.h:126,
                 from ../include/env.h:12,
                 from ../lib/efi_loader/efi_variable.c:8:
../include/linux/string.h:106:15:
note: previous declaration of ‘memcpy’ was here
 extern void * memcpy(void *,const void *,__kernel_size_t);
               ^~~~~~

Use common.h as first include as recommended by the U-Boot coding style
guide.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd: env: extend "env [set|print] -e" to manage UEFI variables
AKASHI Takahiro [Thu, 24 Oct 2019 06:17:13 +0000 (15:17 +0900)]
cmd: env: extend "env [set|print] -e" to manage UEFI variables

With this patch, when setting UEFI variable with "env set -e" command,
we will be able to
- specify vendor guid with "-guid guid",
- specify variable attributes,  BOOTSERVICE_ACCESS, RUNTIME_ACCESS,
  respectively with "-bs" and "-rt",
- append a value instead of overwriting with "-a",
- use memory as variable's value instead of explicit values given
  at the command line with "-i address,size"

If guid is not explicitly given, default value will be used.

Meanwhile, "env print -e," will be modified so that it will NOT dump
a variable's value if '-n' is specified.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoblk: set log2blksz in blk_create_device()
Heinrich Schuchardt [Fri, 25 Oct 2019 10:15:31 +0000 (12:15 +0200)]
blk: set log2blksz in blk_create_device()

The ext4 file system requires log2blksz to be set. So when setting the
block size on the block descriptor we should fill this field too.

This fixes a problem with EFI block devices providing ext4 partitions, cf.
https://lists.denx.de/pipermail/u-boot/2019-October/387702.html.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMerge tag 'mmc-10-29-2019' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc
Tom Rini [Wed, 30 Oct 2019 13:06:33 +0000 (09:06 -0400)]
Merge tag 'mmc-10-29-2019' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc

- fsl_esdhc driver cleanup
- spl_mmc bug fix to avoid access wrong emmc partition

4 years agoMerge branch '2019-10-28-azure-ci-support'
Tom Rini [Wed, 30 Oct 2019 13:05:13 +0000 (09:05 -0400)]
Merge branch '2019-10-28-azure-ci-support'

- Clean up Travis-CI slightly and then add support for Microsoft Azure
  pipelines, all from Bin Meng.

4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Wed, 30 Oct 2019 13:04:52 +0000 (09:04 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi

- H6 dts(i) sync (Clément)
- H6 PIO (Icenowy)
- Fix pll1 clock calculation (Stefan)
- H6 dram, half DQ (Jernej)
- A64 OLinuXino eMMC (Sunil)

4 years agoBring all testings in gitlab and travis CI to Azure Pipelines
Bin Meng [Mon, 28 Oct 2019 14:25:03 +0000 (07:25 -0700)]
Bring all testings in gitlab and travis CI to Azure Pipelines

This expands current Azure Pipelines Windows host tools build
testing to cover all the CI testing in gitlab and travis CI.

Note for some unknown reason, the 'container' cannot be used for
any jobs that have buildman, for buildman does not exit properly
and hangs the job forever. As a workaround, we manually call
docker to run the image to perform the CI tasks.

A complete run on Azure Pipelines takes about 2 hours and 10
minutes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
4 years ago.travis.yml: Remove the unneeded '&' for ls20xx buildman
Bin Meng [Mon, 28 Oct 2019 14:25:02 +0000 (07:25 -0700)]
.travis.yml: Remove the unneeded '&' for ls20xx buildman

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agoarm: mvebu: Avoid generating kwbimage.cfg in the source tree
Bin Meng [Mon, 28 Oct 2019 14:25:01 +0000 (07:25 -0700)]
arm: mvebu: Avoid generating kwbimage.cfg in the source tree

At present some boards generate kwbimage.cfg in the source tree
during the build. This breaks buildman testing on some systems
where the source tree is read-only. Update makefile rules to
generate it in the build tree instead.

Note some other boards have the kwbimage.cfg file written in
advance, hence we need check if the file exists in the build
tree first, otherwise we fall back to one in the source tree.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotools: buildman: Remove useless mkdir() in Make() in test.py
Bin Meng [Mon, 28 Oct 2019 14:25:00 +0000 (07:25 -0700)]
tools: buildman: Remove useless mkdir() in Make() in test.py

In the 'Make' function, the codes tries to create a directory
if current stage is 'build'. But the directory isn't used at
all anywhere.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotools: buildman: Honor output directory when generating boards.cfg
Bin Meng [Mon, 28 Oct 2019 14:24:59 +0000 (07:24 -0700)]
tools: buildman: Honor output directory when generating boards.cfg

buildman always generates boards.cfg in the U-Boot source tree.
When '-o' is given, we should generate boards.cfg to the given
output directory.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agospl: spl_mmc: fix getting raw_sect when boot from emmc boot partition
Peng Fan [Wed, 23 Oct 2019 01:43:30 +0000 (01:43 +0000)]
spl: spl_mmc: fix getting raw_sect when boot from emmc boot partition

On i.MX8, when booting from eMMC boot partition, the whole flash.bin
is stored in boot partition, however SPL switches to user partition
during the init of mmc driver:
  spl_mmc_load() -> mmc_init()

Then it tries to load the container image in
spl_mmc_get_uboot_raw_sector(), but here it reads the data from user
partition and the header is not recognized as a valid header.

So we move spl_mmc_get_uboot_raw_sector after eMMC partition switch
to address this issue.

Anyway put spl_mmc_get_uboot_raw_sector before eMMC partition switch
is not correct, so let's move it after eMMC partition switch.

Reported-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agommc: fsl_esdhc: drop i.MX DDR support code
Yangbo Lu [Mon, 21 Oct 2019 10:09:09 +0000 (18:09 +0800)]
mmc: fsl_esdhc: drop i.MX DDR support code

A previous patch below adding DDR mode support was actually for i.MX
platforms. Now i.MX eSDHC driver is fsl_esdhc_imx.c. For QorIQ eSDHC,
it uses different process for DDR mode, and hasn't been supported.
Let's drop DDR support code for i.MX in fsl_esdhc driver.

0e1bf61 mmc: fsl_esdhc: Add support for DDR mode

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
4 years agommc: fsl_esdhc: remove redundant DM_MMC checking
Yangbo Lu [Mon, 21 Oct 2019 10:09:08 +0000 (18:09 +0800)]
mmc: fsl_esdhc: remove redundant DM_MMC checking

Remove redundant DM_MMC checking which is already in DM_MMC conditional
compile block.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
4 years agommc: fsl_esdhc: make BLK as hard requirement of DM_MMC
Yangbo Lu [Mon, 21 Oct 2019 10:09:07 +0000 (18:09 +0800)]
mmc: fsl_esdhc: make BLK as hard requirement of DM_MMC

U-boot prefers DM_MMC + BLK for MMC. Now eSDHC driver has already
support it, so let's force to use it.

- Drop non-BLK support for DM_MMC introduced by below patch.
  66fa035 mmc: fsl_esdhc: fix probe issue without CONFIG_BLK enabled

- Support only DM_MMC + BLK (assuming BLK is always enabled for DM_MMC).

- Use DM_MMC instead of BLK for conditional compile.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
4 years agoAdd Microsoft Azure Pipelines configuration
Bin Meng [Sun, 27 Oct 2019 12:19:48 +0000 (05:19 -0700)]
Add Microsoft Azure Pipelines configuration

Microsoft Azure Pipelines [1] provides unlimited CI/CD minutes and
10 parallel jobs to every open source project for free.

This adds a configuration file for Azure Pipelines to utilize the
free Windows VM hosted by Microsoft to ensure no build broken in
building U-Boot host tools for Windows.

[1] https://azure.microsoft.com/en-us/blog/announcing-azure-pipelines-with-unlimited-ci-cd-minutes-for-open-source/

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotools: Avoid creating symbolic links for tools/version.h
Bin Meng [Sun, 27 Oct 2019 12:19:47 +0000 (05:19 -0700)]
tools: Avoid creating symbolic links for tools/version.h

When building U-Boot host tools for Windows from Microsoft Azure
Pipelines, the following errors were seen:

  HOSTCC  tools/mkenvimage.o
  In file included from tools/mkenvimage.c:25:
  ./tools/version.h:1:1: error: expected identifier or ‘(’ before ‘.’ token
     1 | ../include/version.h
       | ^
  tools/mkenvimage.c: In function ‘main’:
  tools/mkenvimage.c:117:4: warning: implicit declaration of function ‘usage’ [-Wimplicit-function-declaration]
   117 |    usage(prg);
       |    ^~~~~
  tools/mkenvimage.c:120:35: error: ‘PLAIN_VERSION’ undeclared (first use in this function)
   120 |    printf("%s version %s\n", prg, PLAIN_VERSION);
       |                                   ^~~~~~~~~~~~~
  tools/mkenvimage.c:120:35: note: each undeclared identifier is reported only once for each function it appears in
  make[2]: *** [scripts/Makefile.host:114: tools/mkenvimage.o] Error 1

It turns out tools/version.h is a symbolic link and with Windows
default settings it is unsupported hence the actual content of
tools/version.h is not what file include/version.h has, but the
the linked file path, which breaks the build.

To fix this, remove the symbolic links for tools/version.h. Instead
we perform a copy from include/version.h during the build.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoAdd .gitattributes for line endings
Bin Meng [Sun, 27 Oct 2019 12:19:46 +0000 (05:19 -0700)]
Add .gitattributes for line endings

When building U-Boot host tools for Windows from Microsoft Azure
Pipelines, we see tons of weird warnings and errors emitted from
every Kconfig files:

  Kconfig:6:warning: ignoring unsupported character ''
  Kconfig:6:warning: ignoring unsupported character ''
  Kconfig:8:warning: ignoring unsupported character ''
  Kconfig:9:warning: ignoring unsupported character ''
  Kconfig:10:warning: ignoring unsupported character ''
  Kconfig:10:warning: ignoring unsupported character ''
  Kconfig:13:warning: ignoring unsupported character ''
  arch/Kconfig:1:warning: ignoring unsupported character ''
  arch/Kconfig:2:warning: ignoring unsupported character ''
  arch/Kconfig:2:warning: ignoring unsupported character ''
  arch/Kconfig:4:warning: ignoring unsupported character ''
  ...

After several rounds of experiments, it turns out this is caused
by line endings. Historically, Linux and macOS used linefeed (LF)
characters while Windows used a carriage return plus a linefeed
(CRLF). When Azure Pipelines checks out the U-Boot repo, Git tries
to compensate for the difference by automatically making lines end
in CRLF in the working directory on Windows, which confuses the
Kconfig file parsing logic.

Fortunately Git provides a way for repos to tell Git not to do such
automatical line endings conversion via .gitattributes file below:

* text eol=lf

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
4 years agodoc: Add documentation for how to build U-Boot host tools
Bin Meng [Sun, 27 Oct 2019 12:19:45 +0000 (05:19 -0700)]
doc: Add documentation for how to build U-Boot host tools

This adds a reST document for how to build U-Boot host tools,
including information for both Linux and Windows.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotools: ifwitool: Define __packed when it is not defined
Bin Meng [Sun, 27 Oct 2019 12:19:44 +0000 (05:19 -0700)]
tools: ifwitool: Define __packed when it is not defined

Some compilers may provide __packed define for us.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
4 years agolinux/types.h: Surround 'struct ustat' with __linux__
Bin Meng [Sun, 27 Oct 2019 12:19:43 +0000 (05:19 -0700)]
linux/types.h: Surround 'struct ustat' with __linux__

'struct ustat' uses linux-specific typedefs to declare its memebers:
__kernel_daddr_t and __kernel_ino_t. It is currently not used by any
U-Boot codes, but when we build U-Boot tools for other platform like
Windows, this becomes a problem.

Let's surround it with __linux__.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotools: zynqmpbif: Use compiler builtin instead of linux-specific __swab32
Bin Meng [Sun, 27 Oct 2019 12:19:42 +0000 (05:19 -0700)]
tools: zynqmpbif: Use compiler builtin instead of linux-specific __swab32

__swab32() is a Linux specific macro defined in linux/swab.h. Let's
use the compiler equivalent builtin function __builtin_bswap32() for
better portability.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotools: mtk_image.h: Use portable uintXX_t instead of linux-specific __leXX
Bin Meng [Sun, 27 Oct 2019 12:19:41 +0000 (05:19 -0700)]
tools: mtk_image.h: Use portable uintXX_t instead of linux-specific __leXX

__leXX has Linux kernel specific __attribute__((bitwise)) which is
not portable. Use corresponding uintXX_t instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotools: image.h: Use portable uint32_t instead of linux-specific __be32
Bin Meng [Sun, 27 Oct 2019 12:19:40 +0000 (05:19 -0700)]
tools: image.h: Use portable uint32_t instead of linux-specific __be32

__be32 has Linux kernel specific __attribute__((bitwise)) which is
not portable. Use uint32_t instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
4 years agofdt: Fix alignment issue when reading 64-bits properties from fdt
Jean-Jacques Hiblot [Tue, 22 Oct 2019 08:05:22 +0000 (10:05 +0200)]
fdt: Fix alignment issue when reading 64-bits properties from fdt

The FDT specification [0] gives a requirement of aligning properties on
32-bits. Make sure that the compiler is aware of this constraint when
accessing 64-bits properties.

[0]: https://github.com/devicetree-org/devicetree-specification/blob/master/source/flattened-format.rst

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Update log method for uclass_find_device_by_seq
Kever Yang [Tue, 22 Oct 2019 07:39:47 +0000 (15:39 +0800)]
dm: core: Update log method for uclass_find_device_by_seq

Use log() insted of debug() for uclass_find_device_by_seq function,
since this print is very much and we can filter it out with log()
interface.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Move #define to top of file as per docs:
Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: separate emails in CC list with NULs
Dmitry Torokhov [Tue, 22 Oct 2019 03:09:56 +0000 (20:09 -0700)]
patman: separate emails in CC list with NULs

There is a contributor in Linux kernel with a comma in their name, which
confuses patman and results in invalid to- or cc- addresses on some
patches. To avoid this, let's use \0 as a separator when generating cc
file.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>