oweals/u-boot.git
5 years agosandbox: Add an alias for SPI
Simon Glass [Sat, 18 May 2019 17:59:42 +0000 (11:59 -0600)]
sandbox: Add an alias for SPI

At present 'sf probe' does not work since it cannot find SPI bus 0. Add
an alias to correct this, now that we no-longer have the --spi_sf option.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agosandbox: Create a common sandbox DT
Simon Glass [Sat, 18 May 2019 17:59:41 +0000 (11:59 -0600)]
sandbox: Create a common sandbox DT

At present sandbox and sandbox64 have duplicated nodes. This is hard to
maintain since changes in one need to be manually added to the other.

Create a common file to solve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agosandbox: Sync up sandbox64.dts with main DT
Simon Glass [Sat, 18 May 2019 17:59:40 +0000 (11:59 -0600)]
sandbox: Sync up sandbox64.dts with main DT

Various nodes have been added and adjusted with sandbox. Move these
changes over to sandbox64.dts to keep these in sync.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agoAdd a simple script to remove boards
Simon Glass [Sat, 18 May 2019 16:07:17 +0000 (10:07 -0600)]
Add a simple script to remove boards

This script attempts to create a git commit which removes a single board.
It is quite fallible and everything it does needs checking. But it can
help speed up the process.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
5 years agopatman: Update cover-coverage tests for Python 3
Simon Glass [Sat, 18 May 2019 04:00:54 +0000 (22:00 -0600)]
patman: Update cover-coverage tests for Python 3

We need slightly different commands to run code coverage with Python 3.
Update the RunTestCoverage() function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Update the README.entries file
Simon Glass [Sat, 18 May 2019 04:00:53 +0000 (22:00 -0600)]
binman: Update the README.entries file

A few minor changes have been made including one new entry. Update the
documentation with:

   $ binman -E >tools/binman/README.entries

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Document parallel tests
Simon Glass [Sat, 18 May 2019 04:00:52 +0000 (22:00 -0600)]
binman: Document parallel tests

Since binman can run tests in parallel, document this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Read map files as text
Simon Glass [Sat, 18 May 2019 04:00:51 +0000 (22:00 -0600)]
binman: Read map files as text

These files are text files so should be read as such, so that
string-equality assertions work as expected.

With this binman tests work correctly on Python 2 and Python 3:

PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt \
python ./tools/binman/binman -t

Change first line of binman.py to end "python3":

PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman \
python3 ./tools/binman/binman -t

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Fix up a format string in AssertInList()
Simon Glass [Sat, 18 May 2019 04:00:50 +0000 (22:00 -0600)]
binman: Fix up a format string in AssertInList()

Add the missing 's' to the required '%s' here.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Update 'text' entry for Python 3
Simon Glass [Sat, 18 May 2019 04:00:49 +0000 (22:00 -0600)]
binman: Update 'text' entry for Python 3

This code reads a binary value and then uses it as a string to look up
another value. Add conversions to make this work as expected on Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Update fmap code for Python 3
Simon Glass [Sat, 18 May 2019 04:00:48 +0000 (22:00 -0600)]
patman: Update fmap code for Python 3

This needs special care to ensure that the bytes type is used for
binary data. Add conversion code to deal with strings and bytes
correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Update entry_test to support Python 3
Simon Glass [Sat, 18 May 2019 04:00:47 +0000 (22:00 -0600)]
binman: Update entry_test to support Python 3

The reload() function is in a different place in Python 3. Update the code
to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Convert to use bytes type
Simon Glass [Sat, 18 May 2019 04:00:46 +0000 (22:00 -0600)]
binman: Convert to use bytes type

With Python 3 we want to use the 'bytes' type instead of 'str'. Adjust the
code accordingly so that it works on both Python 2 and Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Avoid changing a dict during iteration
Simon Glass [Sat, 18 May 2019 04:00:45 +0000 (22:00 -0600)]
binman: Avoid changing a dict during iteration

This code works OK in Python 2 but Python 3 complains. Adjust it to avoid
deleting elements from a dict while iterating through it.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Allow reading files in text mode
Simon Glass [Sat, 18 May 2019 04:00:44 +0000 (22:00 -0600)]
patman: Allow reading files in text mode

While reading files in binary mode is the norm, sometimes we want to use
text mode. Add an optional parameter to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodtoc: Update dtb_platdata to support Python 3
Simon Glass [Sat, 18 May 2019 04:00:43 +0000 (22:00 -0600)]
dtoc: Update dtb_platdata to support Python 3

The only change needed is to update get_value() to support the 'bytes'
type correctly with Python 3.

With this the dtoc unit tests pass with both Python 2 and 3:

PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt python \
./tools/dtoc/dtoc -t

PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman python3 \
./tools/dtoc/dtoc -t

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodtoc: Update fdt_util for Python 3
Simon Glass [Sat, 18 May 2019 04:00:42 +0000 (22:00 -0600)]
dtoc: Update fdt_util for Python 3

Since we are now using the bytes type in Python 3, the conversion in
fdt32_to_cpu() is not necessary, so drop it.

Also use 'int' instead of 'long' to convert the integer value, since
'long' is not present in Python 3.

With this, test_fdt passes with both Python 2 and 3:

PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt python \
./tools/dtoc/test_fdt -t

PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman python3 \
./tools/dtoc/test_fdt -t

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodtoc: Add a unit test for BytesToValue()
Simon Glass [Sat, 18 May 2019 04:00:41 +0000 (22:00 -0600)]
dtoc: Add a unit test for BytesToValue()

Add a simple unit test for one of the cases of this function, so that any
fault can be seen directly, rather than appearing through the failure of
another test.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodtoc: Test full 64-bit properties with FdtCellsToCpu()
Simon Glass [Sat, 18 May 2019 04:00:40 +0000 (22:00 -0600)]
dtoc: Test full 64-bit properties with FdtCellsToCpu()

At present this test does not check the upper 32 bits of the returned
value. Add some additional tests to cover this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodtoc: Use binary mode for reading files
Simon Glass [Sat, 18 May 2019 04:00:39 +0000 (22:00 -0600)]
dtoc: Use binary mode for reading files

The .dtb files are binary so we should open them as binary files. This
allows Python 3 to use the correct 'bytes' type.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodtoc: Convert the Fdt.Node class to Python 3
Simon Glass [Sat, 18 May 2019 04:00:38 +0000 (22:00 -0600)]
dtoc: Convert the Fdt.Node class to Python 3

Update this class to work correctly on Python 3 and to pass its unit
tests. The only required change is to deal with a difference in the
behaviour of sorting with a None value.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodtoc: Convert the Fdt.Prop class to Python 3
Simon Glass [Sat, 18 May 2019 04:00:37 +0000 (22:00 -0600)]
dtoc: Convert the Fdt.Prop class to Python 3

Update this class to work correctly on Python 3 and to pass its unit
tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodtoc: Use byte type instead of str in fdt
Simon Glass [Sat, 18 May 2019 04:00:36 +0000 (22:00 -0600)]
dtoc: Use byte type instead of str in fdt

In Python 3 bytes and str are separate types. Use bytes to ensure that
the code functions correctly with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodtoc: Updates BytesToValue() for Python 3
Simon Glass [Sat, 18 May 2019 04:00:35 +0000 (22:00 -0600)]
dtoc: Updates BytesToValue() for Python 3

The difference between the bytes and str types in Python 3 requires a
number of minor changes to this function. Update it to handle the input
data using the 'bytes' type. Create two useful helper functions which can
be used by other modules too.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodtoc: Move BytesToValue() out of the Prop class
Simon Glass [Sat, 18 May 2019 04:00:34 +0000 (22:00 -0600)]
dtoc: Move BytesToValue() out of the Prop class

This method does not actually use any members of the Prop class. Move it
out of the class so that it is easier to add unit tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodtoc: Use GetBytes() to obtain repeating bytes
Simon Glass [Sat, 18 May 2019 04:00:33 +0000 (22:00 -0600)]
dtoc: Use GetBytes() to obtain repeating bytes

Use this helper function which works on both Python 2 and Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodtoc: Sort platdata output from dtoc
Simon Glass [Sat, 18 May 2019 04:00:32 +0000 (22:00 -0600)]
dtoc: Sort platdata output from dtoc

At present the order of struct field emitted by this tool depends on the
internal workings of a Python dictionary. Sort the fields to remove this
uncertainty, so that tests are deterministic.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodtoc: Adjust code for Python 3
Simon Glass [Sat, 18 May 2019 04:00:31 +0000 (22:00 -0600)]
dtoc: Adjust code for Python 3

Update a few things in this tool so that they support Python 3:
- print statements
- iteritems()
- xrange()

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Don't require Python 2
Simon Glass [Tue, 14 May 2019 21:53:55 +0000 (15:53 -0600)]
patman: Don't require Python 2

Update the shebang to allow either Python 2 or Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Tidy up a few more unicode conversions
Simon Glass [Tue, 14 May 2019 21:53:54 +0000 (15:53 -0600)]
patman: Tidy up a few more unicode conversions

Use the new functions in the tools module to handle conversion.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Adjust functional tests for Python 3
Simon Glass [Tue, 14 May 2019 21:53:53 +0000 (15:53 -0600)]
patman: Adjust functional tests for Python 3

Change the code so that it works on both Python 2 and Python 3. This works
by using unicode instead of latin1 for the test input, and ensuring that
the output is converted to a string rather than a unicode object on
Python 2.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Avoid unicode type in settings unit tests
Simon Glass [Tue, 14 May 2019 21:53:52 +0000 (15:53 -0600)]
patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Sort series output for repeatabily
Simon Glass [Tue, 14 May 2019 21:53:51 +0000 (15:53 -0600)]
patman: Sort series output for repeatabily

We use sets to produce the list of To and Cc lines for a series. This does
not result in stable ordering of the recipients. Sort each list to ensure
that the output is repeatable. This is necessary for tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Move unicode helpers to tools
Simon Glass [Tue, 14 May 2019 21:53:50 +0000 (15:53 -0600)]
patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Support use of stringIO in Python 3
Simon Glass [Tue, 14 May 2019 21:53:49 +0000 (15:53 -0600)]
patman: Support use of stringIO in Python 3

With Python 3 this class has moved. Update the code to handle both cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Handle repeated bytes for Python 3
Simon Glass [Tue, 14 May 2019 21:53:47 +0000 (15:53 -0600)]
binman: Handle repeated bytes for Python 3

The method of multiplying a character by a number works well for creating
a repeated string in Python 2. But in Python 3 we need to use bytes()
instead, to avoid unicode problems, since 'bytes' is no-longer just an
alias of 'str'.

Create a function to handle this detail and call it from the relevant
places in binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Drop an unused input file
Simon Glass [Tue, 14 May 2019 21:53:46 +0000 (15:53 -0600)]
binman: Drop an unused input file

Drop this line which is not used or needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Use binary mode when compressing data
Simon Glass [Tue, 14 May 2019 21:53:45 +0000 (15:53 -0600)]
binman: Use binary mode when compressing data

The lz4 utility inserts binary data in its output which cannot always be
converted to unicode (nor should it be). Fix this by using the new binary
mode for program output.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Provide a way to get program output in binary mode
Simon Glass [Tue, 14 May 2019 21:53:44 +0000 (15:53 -0600)]
patman: Provide a way to get program output in binary mode

At present cros_subprocess and the tools library use a string to obtain
stdout from a program. This works fine on Python 2. With Python 3 we end
up with unicode errors in some cases. Fix this by providing a binary mode,
which returns the data as bytes() instead of a string.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agotools: dtoc: Open all binary files in binary mode
Simon Glass [Tue, 14 May 2019 21:53:43 +0000 (15:53 -0600)]
tools: dtoc: Open all binary files in binary mode

Fix an open() statement to use binary mode, so that it works as expected
with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agotools: binman: Open all binary files in binary mode
Simon Glass [Tue, 14 May 2019 21:53:42 +0000 (15:53 -0600)]
tools: binman: Open all binary files in binary mode

At present some files are opened in text mode despite containing binary
data. This works on Python 2 but not always on Python 3, due to unicode
problems. BC&D are not my favourite people. Adjust the affected open()
statements to use binary mode.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Use items() instead of iteritems()
Simon Glass [Tue, 14 May 2019 21:53:41 +0000 (15:53 -0600)]
binman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Use items() instead of iteritems()
Simon Glass [Tue, 14 May 2019 21:53:40 +0000 (15:53 -0600)]
patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Remove use of Set()
Simon Glass [Tue, 14 May 2019 21:53:39 +0000 (15:53 -0600)]
binman: Remove use of Set()

A new built-in set() is used in both Python 2 and 3 now. Move it to use
that instead of Set().

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Don't show errors for failed tests
Simon Glass [Tue, 14 May 2019 21:53:38 +0000 (15:53 -0600)]
binman: Don't show errors for failed tests

An unfortunate new feature in Python 3.5 causes binman to print errors for
non-existent tests, when the test filter is used. Work around this by
detecting the unwanted tests and removing them from the result.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Convert print statements to Python 3
Simon Glass [Tue, 14 May 2019 21:53:37 +0000 (15:53 -0600)]
binman: Convert print statements to Python 3

Update all print statements to be functions, as required by Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Convert print statements to Python 3
Simon Glass [Tue, 14 May 2019 21:53:36 +0000 (15:53 -0600)]
patman: Convert print statements to Python 3

Update all print statements to be functions, as required by Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Update cros_subprocess to use bytes
Simon Glass [Sat, 11 May 2019 18:46:39 +0000 (12:46 -0600)]
patman: Update cros_subprocess to use bytes

At present this function uses lists and strings. This does not work so
well with Python 3, and testing against '' does not work for a bytearray.
Update the code to fix these issues.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-i2c
Tom Rini [Wed, 10 Jul 2019 17:51:53 +0000 (13:51 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-i2c

5 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-ubi
Tom Rini [Wed, 10 Jul 2019 14:40:14 +0000 (10:40 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-ubi

[trini: Migrate sama5d27_som1_ek_qspiflash/sama5d2_xplained_qspiflash
        for CONFIG_ENV_SECT_SIZE]
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agoMerge tag 'u-boot-atmel-2019.10-a' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Tue, 9 Jul 2019 12:16:50 +0000 (08:16 -0400)]
Merge tag 'u-boot-atmel-2019.10-a' of https://gitlab.denx.de/u-boot/custodians/u-boot-atmel

First set of u-boot-atmel features and fixes for 2019.10 cycle

This includes the Atmel QSPI driver and support for the at91 boards.
This is the port of the driver from Linux, mostly done by Tudor Ambarus.

5 years agortc: pcf2127: Fixed bug with rtc settings and getting error time
Chuanhua Han [Mon, 8 Jul 2019 03:45:25 +0000 (11:45 +0800)]
rtc: pcf2127: Fixed bug with rtc settings and getting error time

The previous pcf2127 RTC chip could not read and set the correct time.
When reading the data of internal registers, the read address was the
value of register plus 1. This is because this chip requires the host
to send a stop signal after setting the register address and before
reading the register data.

This patch sets the register address using dm_i2c_write and reads
the register data using the original dm_i2c_xfer in order to generate
a stop signal after the register address is set, and fixes the bug of
the original read and write time.

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Chuanhua Han <chuanhua.han@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoconfigs: sama5d2_xplained: add support QSPI flash boot
Eugen Hristev [Tue, 18 Jun 2019 08:52:11 +0000 (08:52 +0000)]
configs: sama5d2_xplained: add support QSPI flash boot

The spi-nor flash resides on spi bus 1. Update the CONFIG_ENV_SPI_CS
and CONFIG_BOOTCOMMAND accordingly.

Based on original work by Wenyou Yang.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
[tudor.ambarus@microchip.com: amend the commit message.]
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoconfigs: sama5d27_som1_ek: qspi: use common memory layout
Tudor Ambarus [Tue, 18 Jun 2019 08:52:09 +0000 (08:52 +0000)]
configs: sama5d27_som1_ek: qspi: use common memory layout

Use the qspi memory layout defined in at91-sama5_common - it aligns
with the 8 Mbyte flash (sst26vf064b-104i/sn) available in sama5d27_som1_ek.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoconfigs: sama5d27_som1_ek: add qspiflash_defconfig
Tudor Ambarus [Tue, 18 Jun 2019 08:52:06 +0000 (08:52 +0000)]
configs: sama5d27_som1_ek: add qspiflash_defconfig

Add the default config file of QSPI media. The config is based on
sama5d27_som1_ek_mmc_defconfig.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agoconfigs: sama5d2_xplained: add qspiflash_defconfig
Tudor Ambarus [Tue, 18 Jun 2019 08:52:03 +0000 (08:52 +0000)]
configs: sama5d2_xplained: add qspiflash_defconfig

Add the default config file of QSPI media. The config is based on
sama5d2_xplained_mmc_defconfig.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agoARM: at91: sama5: add common environment for QSPI
Cyrille Pitchen [Tue, 18 Jun 2019 08:52:01 +0000 (08:52 +0000)]
ARM: at91: sama5: add common environment for QSPI

Use the same memory layout as we use for the NAND boot on the other boards.

QSPI flashes are present on the following boards:
sama5d2_xplained RevB:  32 Mbyte flash (mx25l3273fm2i-08g)
sama5d2_xplained RevC:   8 Mbyte flash (sst26vf064b-104i/sn)
sama5d27_som1_ek:        8 Mbyte flash (sst26vf064b-104i/sn)
sama5d2_ptc_ek:          8 Mbyte flash (sst26vf064b-104i/sn)

The 8 Mbyte limit is enough to cope with the memory layout used in the NAND
boot. rootfs exceeds the 8 Mbyte limit and will stay in eMMC in the
sama5d2_xplained case. The final scope is to use a single memory layout for
all boot medias.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@microchip.com>
[tudor.ambarus@microchip.com: change memory layout, add commit message]
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoARM: dts: at91: sama5d2_xplained: fix QSPI0 node
Cyrille Pitchen [Tue, 18 Jun 2019 08:51:58 +0000 (08:51 +0000)]
ARM: dts: at91: sama5d2_xplained: fix QSPI0 node

Fix the following:
- use "jedec,spi-nor" binding, we use jedec compatible flashes
- set bus width to 4, we use quad capable flashes
- differentiate bewteen data and clk and cs pins
- drop partions as we don't use them in u-boot.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@microchip.com>
[tudor.ambarus@microchip.com: use "jedec,spi-nor", edit commit message]
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoconfigs: sama5d27_som1_ek: enable qspi controller and flashes
Tudor Ambarus [Tue, 18 Jun 2019 08:51:55 +0000 (08:51 +0000)]
configs: sama5d27_som1_ek: enable qspi controller and flashes

We use a sst spi-nor flash memory on sama5d27_som1_ek. Select
the others for testing purposes.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agoconfigs: sama5d2_xplained: enable qspi controller and flashes
Tudor Ambarus [Tue, 18 Jun 2019 08:51:53 +0000 (08:51 +0000)]
configs: sama5d2_xplained: enable qspi controller and flashes

We have a macronix spi-nor flash on sama5d2_xplained RevB and
a sst spi-nor flash on RevC. Select the rest for testing purposes.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: Add Atmel QuadSPI driver
Tudor Ambarus [Tue, 18 Jun 2019 08:51:50 +0000 (08:51 +0000)]
spi: Add Atmel QuadSPI driver

Backport the driver from linux v5.1-rc5 and adapt it for u-boot.
Tested on sama5d2_xplained Rev B with mx25l25635e spi-nor flash.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agoxilinx_xiic: Fix transfer initialisation
Melin Tomas [Fri, 28 Jun 2019 12:08:40 +0000 (12:08 +0000)]
xilinx_xiic: Fix transfer initialisation

Prior to starting a new transfer, conditionally wait for bus to not
be busy.

Reinitialise controller as otherwise operation is not stable.
For reference, see linux kernel
commit 9656eeebf3f1 ("i2c: Revert i2c: xiic: Do not reset controller before every transfer")

hs: Fixed DOS line endings
    added missing '\n'
    Fixed git commit description style

Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
5 years agoxilinx_xiic: Fix fill tx fifo loop
Melin Tomas [Fri, 28 Jun 2019 12:08:31 +0000 (12:08 +0000)]
xilinx_xiic: Fix fill tx fifo loop

Comparison should be against the actual message length, not loop index.

len is used for stopping while loop, pos is position in message.
stop should be sent when entire message is sent, not when
len and pos meet.

hs: fixed DOS line endings

Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
5 years agoi2c: designware: Get clock rate from clock DM
Ley Foon Tan [Wed, 12 Jun 2019 01:48:04 +0000 (09:48 +0800)]
i2c: designware: Get clock rate from clock DM

Get clock rate from clock DM if CONFIG_CLK is enabled.
Otherwise, uses IC_CLK define.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Acked-by: Marek Vasut <marex@denx.de>
5 years agoi2c: designware_i2c: Restore enable state after set speed
Jun Chen [Wed, 5 Jun 2019 07:23:16 +0000 (15:23 +0800)]
i2c: designware_i2c: Restore enable state after set speed

Before calling __dw_i2c_set_bus_speed(),
the I2C could already be set as ether enable or disable,
we should restore the original setting instead of enable i2c anyway.

This patch fix a bug happened in init function:
    __dw_i2c_init(){
            /* Disable i2c */
            ...
            __dw_i2c_set_bus_speed(i2c_base, NULL, speed);
            writel(slaveaddr, &i2c_base->ic_sar);
            /* Enable i2c */
    }
In this case, enable i2c inside __dw_i2c_set_bus_speed() function
will cause ic_sar write fail.

Signed-off-by: Jun Chen <ptchentw@gmail.com>
5 years agoubispl: introduce separate CONFIG_UBI_SPL_SILENCE_MSG
Markus Klotzbuecher [Wed, 15 May 2019 13:16:00 +0000 (15:16 +0200)]
ubispl: introduce separate CONFIG_UBI_SPL_SILENCE_MSG

This allows to silence ubi and ubispl individually.

Signed-off-by: Markus Klotzbuecher <markus.klotzbuecher@kistler.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Cc: Kyungmin Park <kmpark@infradead.org>
5 years agoubispl: add support for loading volumes by name
Hamish Guthrie [Wed, 15 May 2019 13:15:59 +0000 (15:15 +0200)]
ubispl: add support for loading volumes by name

The motivation is to use the UBI atomic volume rename functionality to
allow double copy software updates on UBI. To that end the SPL is
configured to always load the same volume name (e.g. "u-boot"),
whereas a software updater always installs into the secondary volume
"u-boot_r". After successful installation, these two volume names are
switched.

This extension is protected by #ifdefs as it will somewhat slow down
loading of volumes by id. This is because the code needs to disable
the optimization of ignoring all volume ids which are not
to-be-loaded, since these can only be resolved after attaching.

This adds two vtbl related functions from Linux, which are taken from
the same kernel version as the current main U-Boot UBI code (Linux 4.2
64291f7db5bd8).

Signed-off-by: Hamish Guthrie <hamish.guthrie@kistler.com>
Signed-off-by: Markus Klotzbuecher <markus.klotzbuecher@kistler.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Cc: Kyungmin Park <kmpark@infradead.org>
5 years agoconfigs: migrate ubispl boards to KConfig
Markus Klotzbuecher [Wed, 15 May 2019 13:15:58 +0000 (15:15 +0200)]
configs: migrate ubispl boards to KConfig

Migrate the ubispl configuration for the omap3_igep00x0 and
am335x_igep003x boards to KConfig. Both boards were built with
SOURCE_DATE_EPOCH=0 and found to be equal before and after.

Signed-off-by: Markus Klotzbuecher <markus.klotzbuecher@kistler.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Kyungmin Park <kmpark@infradead.org>
Cc: Javier Martínez Canillas <javier@dowhile0.org>
Cc: Enric Balletbo i Serra <eballetbo@gmail.com>
Acked-by: Enric Balletbo i Serra <eballetbo@gmail.com>
5 years agoubispl: migrate configuration to Kconfig
Markus Klotzbuecher [Wed, 15 May 2019 13:15:57 +0000 (15:15 +0200)]
ubispl: migrate configuration to Kconfig

Move the ubispl configuration to KConfig and drop them from the
whitelist.

Signed-off-by: Markus Klotzbuecher <markus.klotzbuecher@kistler.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Kyungmin Park <kmpark@infradead.org>
Cc: Javier Martínez Canillas <javier@dowhile0.org>
Cc: Enric Balletbo i Serra <eballetbo@gmail.com>
5 years agoubi: fix UBI_SILENCE_MSG
Markus Klotzbuecher [Wed, 15 May 2019 13:15:56 +0000 (15:15 +0200)]
ubi: fix UBI_SILENCE_MSG

 - drop CONFIG_ prefix from kconfig entry
 - fix small compilation issue with CONFIG_UBI_SILENCE_MSG

Signed-off-by: Markus Klotzbuecher <markus.klotzbuecher@kistler.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Cc: Kyungmin Park <kmpark@infradead.org>
5 years agoenv: ubi: support configurable VID offset
Hamish Guthrie [Wed, 15 May 2019 13:15:55 +0000 (15:15 +0200)]
env: ubi: support configurable VID offset

Introduce KConfig CONFIG_ENV_UBI_VID_OFFSET to allow providing custom
VID header offsets for the environment on UBI.

Signed-off-by: Hamish Guthrie <hamish.guthrie@kistler.com>
Signed-off-by: Markus Klotzbuecher <markus.klotzbuecher@kistler.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Cc: Kyungmin Park <kmpark@infradead.org>
5 years agoat91, omap2plus: configs: migrate CONFIG_ENV_ to defconfigs
Markus Klotzbuecher [Wed, 15 May 2019 13:15:54 +0000 (15:15 +0200)]
at91, omap2plus: configs: migrate CONFIG_ENV_ to defconfigs

Enable the extended ENV options for AT91 and OMAP2PLUS in order to be
able to use CONFIG_ENV_UBI_* on these architectures.

As this change also makes the configs ENV_SIZE, ENV_SECT_SIZE,
ENV_OFFSET visible to AT91 and OMAP2PLUS, migrate users of these to
KConfig.

This migration was run using an extended moveconfig.py which evaluates
expressions such as "(512 << 10)". See patch ("moveconfig: expand
simple expressions").

All modified boards were built with SOURCE_DATE_EPOCH=0 before and
after the change and successfully confirmed that the identical binary
is generated (the only exception was igep00x0, which does not define
CONFIG_ENV_IS_IN_UBI in the original board header. Once that is
defined, the test passes too).

hs: rebased patch to:
  68b90e57bc: "configs: tinker-rk3288 disable CONFIG_SPL_I2C_SUPPORT"

Signed-off-by: Markus Klotzbuecher <markus.klotzbuecher@kistler.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Cc: Tom Rini <trini@konsulko.com>
5 years agoenv: ubi: KConfig: add CONFIG_ENV_UBI_VOLUME_REDUND
Markus Klotzbuecher [Wed, 15 May 2019 13:15:53 +0000 (15:15 +0200)]
env: ubi: KConfig: add CONFIG_ENV_UBI_VOLUME_REDUND

Introduce the KConfig option CONFIG_ENV_UBI_VOLUME_REDUND for defining
the name of the UBI volume used to store the redundant environment.

Signed-off-by: Markus Klotzbuecher <markus.klotzbuecher@kistler.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Cc: Kyungmin Park <kmpark@infradead.org>
hs: get rid of stm32mp1* build errors

5 years agomoveconfig: expand simple expressions
Markus Klotzbuecher [Wed, 15 May 2019 13:15:52 +0000 (15:15 +0200)]
moveconfig: expand simple expressions

Add support for expanding simple expressions and sizes such as
"(4 * 1024)", "(512 << 10)" or "(SZ_256K)".

This can help to significantly reduce the number of "suspicious"
moves, such as

 'CONFIG_ENV_SIZE="(64 << 10)"' was removed by savedefconfig.

If the expansion fails, it falls back to the original string.

Signed-off-by: Markus Klotzbuecher <markus.klotzbuecher@kistler.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Heiko Schocher <hs@denx.de>
5 years agoMerge tag 'efi-2019-10-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 8 Jul 2019 20:02:51 +0000 (16:02 -0400)]
Merge tag 'efi-2019-10-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for v2019.10-rc1

Fix a possible overflow for GUID partition tables.

For some runtime services we only have implementations valid at boottime.
So we replace them when leaving boottime. Move this from
SetVirtualAddressMap() to ExitBootServices() as SetVirtualAddressMap() is
not called by all operating systems. Adjust the Python tests accordingly.

Bump the supported UEFI specification version to 2.8.

5 years agoMerge tag 'u-boot-amlogic-20190704' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Mon, 8 Jul 2019 20:02:19 +0000 (16:02 -0400)]
Merge tag 'u-boot-amlogic-20190704' of https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic

- fix khadas-vim README
- add support for unique generated MAC adresses from SoC serial,
  limited to Amlogic GXL/GXM boards for now

5 years agoMerge tag 'mmc-6-23' of https://github.com/MrVan/u-boot
Tom Rini [Mon, 8 Jul 2019 19:49:50 +0000 (15:49 -0400)]
Merge tag 'mmc-6-23' of https://github.com/MrVan/u-boot

- Pull in the series to split fsl_esdhc for i.MX/non-i.MX cleanly

5 years agoPrepare v2019.07 v2019.07
Tom Rini [Mon, 8 Jul 2019 19:23:28 +0000 (15:23 -0400)]
Prepare v2019.07

Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agoMerge tag 'mips-fixes-for-2019.07' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Mon, 8 Jul 2019 11:29:33 +0000 (07:29 -0400)]
Merge tag 'mips-fixes-for-2019.07' of https://gitlab.denx.de/u-boot/custodians/u-boot-mips

- mtmips: network stability fixes for gardena-smart-gateway

5 years agoarm: mediatek: remove arch_misc_init
Weijie Gao [Thu, 16 May 2019 09:19:50 +0000 (17:19 +0800)]
arm: mediatek: remove arch_misc_init

The watchdog of mediatek chips is enabled by bootrom before u-boot is
running. Previously we choose to enable the wdt driver only to disable the
watchdog hardware.

Now wdt service is enabled by default. The function arch_misc_init which is
only used to disable wdt is no longer needed.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
5 years agoboard_r: move initr_watchdog to be called after initr_serial
Weijie Gao [Thu, 16 May 2019 09:19:13 +0000 (17:19 +0800)]
board_r: move initr_watchdog to be called after initr_serial

The initr_watchdog is currently placed before initr_serial. The
initr_watchdog calls printf and printf finally calls ops->putc of a serial
driver.

However, gd->cur_serial_dev points to a udevice allocated in board_f. The
gd->cur_serial_dev->driver->ops->putc points the the code region before
relocation.

Some serial drivers call WATCHDOG_RESET() in ops->putc. When DM is enabled
for watchdog, watchdog_reset() is called. watchdog_reset() calls get_timer
to get current timer.

On some platforms the timer driver is also a DM driver. initr_watchdog is
placed right after initr_dm, which means the timer driver hasn't been
initialized. So dm_timer_init() is called. To create a new udevice, calloc
is called.

However start from ops->putc, u-boot execution flow is redirected into the
memory region before relocation (board_f). In board_f, dlmalloc hasn't
been initialized. The call to calloc will fail, and this will cause DM to
print out an error message, and it will call printf again, causing
recursive error outputs.

This patch places initr_watchdog after initr_serial to solve this issue.

Cc: Stefan Roese <sr@denx.de>
Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
Tested-by: Suniel Mahesh <sunil.m@techveda.org>
5 years agoMerge tag 'dm-pull-7jul19' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Sun, 7 Jul 2019 20:17:56 +0000 (16:17 -0400)]
Merge tag 'dm-pull-7jul19' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

Fix booting for wandboard

5 years agoMerge tag 'video-for-2019.07' of https://gitlab.denx.de/u-boot/custodians/u-boot...
Tom Rini [Sun, 7 Jul 2019 20:17:13 +0000 (16:17 -0400)]
Merge tag 'video-for-2019.07' of https://gitlab.denx.de/u-boot/custodians/u-boot-video

- fix pwm backlight

5 years agoimx6: wandboard: allow booting from MMC 2
Heinrich Schuchardt [Sun, 23 Jun 2019 07:49:43 +0000 (09:49 +0200)]
imx6: wandboard: allow booting from MMC 2

One of the SD-CARD slots on the Wandboard Quad B1 is MMC 2. Enable it as a
boot device.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
5 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Sun, 7 Jul 2019 11:06:03 +0000 (07:06 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usb

- DWC and i.MX6 fixes

5 years agoMerge tag 'rockchip-for-v2019.07-rc5-3' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Sun, 7 Jul 2019 11:05:47 +0000 (07:05 -0400)]
Merge tag 'rockchip-for-v2019.07-rc5-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip

5 years agovideo: backlight: fix pwm inversion
Marc Dietrich [Tue, 2 Jul 2019 20:08:33 +0000 (22:08 +0200)]
video: backlight: fix pwm inversion

set_pwm() will always fail with -ENOSYS if pwm_ops set_invert() is
not implemented, leaving the backlight dark. Fix this by returning
no error if set_invert() is not implemented and no polarity change
is requested.

Fixes: 57e7775413 ("video: backlight: Parse PWM polarity cell")
Signed-off-by: Marc Dietrich <marvin24@gmx.de>
5 years agoefi_loader: detach runtime in ExitBootServices()
Heinrich Schuchardt [Fri, 5 Jul 2019 15:42:16 +0000 (17:42 +0200)]
efi_loader: detach runtime in ExitBootServices()

Linux can be called with a command line parameter efi=novamap, cf.
commit 4e46c2a95621 ("efi/arm/arm64: Allow SetVirtualAddressMap() to be
omitted"). In this case SetVirtualAddressMap() is not called after
ExitBootServices().

OpenBSD 32bit does not call SetVirtualAddressMap() either.

Runtime services must be set to an implementation supported at runtime
in ExitBootServices().

Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Suggested-by: Alexander Graf <agraf@csgraf.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: simplify detaching
Heinrich Schuchardt [Fri, 5 Jul 2019 16:12:21 +0000 (18:12 +0200)]
efi_loader: simplify detaching

We do not need any array typed detach list. Let's simply update the
pointers directly.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: decision on EFI_RT_SUPPORTED_RESET_SYSTEM
Heinrich Schuchardt [Fri, 5 Jul 2019 16:12:16 +0000 (18:12 +0200)]
efi_loader: decision on EFI_RT_SUPPORTED_RESET_SYSTEM

Move the logic determining which board supports reset at runtime to Kconfig.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agotest/py: not all boards support UEFI runtime reset
Heinrich Schuchardt [Fri, 5 Jul 2019 16:16:51 +0000 (18:16 +0200)]
test/py: not all boards support UEFI runtime reset

As not all boards support resets at runtime do not test for it in the
Python tests.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: bump UEFI specification number to 2.8
Heinrich Schuchardt [Fri, 28 Jun 2019 17:31:55 +0000 (19:31 +0200)]
efi_loader: bump UEFI specification number to 2.8

We are implementing UEFI variable RuntimeServicesSupported and set the
unimplemented runtime functions return EFI_UNSUPPORTED as described in UEFI
specification 2.8. So let's also advertise this specification version in
our system table.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Alexander Graf <agraf@csgraf.de>
5 years agoefi_loader: split off detaching SetVirtualAddress()
Heinrich Schuchardt [Sat, 29 Jun 2019 01:32:52 +0000 (03:32 +0200)]
efi_loader: split off detaching SetVirtualAddress()

The runtime services SetVirtualAddress() and ConvertPointer() become
unavailable after SetVirtualAddress(). Other runtime services become
unavailable after ExitBootServices.

Move the update of SetVirtualAddress() and ConvertPointer() to
efi_relocate_runtime_table().

Use functions with the correct signature when detaching.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_selftest: test variable services at runtime
Heinrich Schuchardt [Thu, 20 Jun 2019 14:18:48 +0000 (16:18 +0200)]
efi_selftest: test variable services at runtime

Provide a unit test for the variable services at runtime.

Currently we expect EFI_UNSUPPORTED to be returned as the runtime
implementation is still missing.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: unimplemented runtime services
Heinrich Schuchardt [Thu, 20 Jun 2019 13:40:49 +0000 (15:40 +0200)]
efi_loader: unimplemented runtime services

Unimplemented runtime services should always return EFI_UNSUPPORTED as
described in the UEFI 2.8 spec.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: let the variable driver patch out the runtime
Heinrich Schuchardt [Thu, 20 Jun 2019 13:25:48 +0000 (15:25 +0200)]
efi_loader: let the variable driver patch out the runtime

Our variable services are only provided at boottime. Therefore when
leaving boottime the variable function are replaced by dummy functions
returning EFI_UNSUPPORTED. Move this patching of the runtime table to the
variable services implementation. Executed it in ExitBootServices().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: clean up runtime detaching
Heinrich Schuchardt [Thu, 20 Jun 2019 22:00:02 +0000 (22:00 +0000)]
efi_loader: clean up runtime detaching

The detaching of the runtime will have to move to ExitBootServices() to
encompass operating system that do not call SetVirtualAddressMap().

This patch changes the logic for the relocation of the pointers in the
runtime table such that the relocation becomes independent of the entries
in the detach list.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: remove NULL entries from runtime detach list
Heinrich Schuchardt [Sat, 29 Jun 2019 00:00:16 +0000 (02:00 +0200)]
efi_loader: remove NULL entries from runtime detach list

Some entries in the system table are set to NULL in ExitBootServices(). We
had them in the runtime detach list to avoid relocation of NULL. Let's
instead assign the pointers dynamically in efi_initialize_system_table() to
avoid the relocation entry.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: initialization of variable services
Heinrich Schuchardt [Thu, 20 Jun 2019 11:52:16 +0000 (13:52 +0200)]
efi_loader: initialization of variable services

Provide an initialization routine for variable services.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: move efi_query_variable_info()
Heinrich Schuchardt [Thu, 20 Jun 2019 10:13:05 +0000 (12:13 +0200)]
efi_loader: move efi_query_variable_info()

Let's keep similar things together.

Move efi_query_variable_info() to lib/efi_loader/efi_variable.c

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>