History log of /u-boot/board/toradex/common/tdx-cfg-block.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ba825dad 30-Apr-2024 Tom Rini <trini@konsulko.com>

board: toradex: Remove <common.h> and add needed includes

Remove <common.h> from this board vendor directory and when needed
add missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 12d3257f 08-Mar-2024 Joao Paulo Goncalves <joao.goncalves@toradex.com>

toradex: tdx-cfg-block: add 0087 i.mx8m mini product variant

Add new product id 0087 Verdin iMX8M Mini Quad 2GB IT.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>

# 00653867 31-Jan-2024 Joao Paulo Goncalves <joao.goncalves@toradex.com>

toradex: tdx-cfg-block: add 0086 i.mx8m mini sku

Add new product id 0086 Verdin iMX8M Mini DualLite 2GB IT.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>

# 216ead4d 22-Jan-2024 Joao Paulo Goncalves <joao.goncalves@toradex.com>

toradex: tdx-cfg-block: Add new apalis and colibri pid

Add new apalis imx6 and colibri imx6/imx7 products IDs.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 0bcfda1b 03-Aug-2023 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add verdin am62 skus

Add initial Verdin AM62 Quad 1GB WB IT prototype and launch
configuration SKUs to ConfigBlock handling.

0069: Verdin AM62 Quad 1GB WB IT
0071: Verdin AM62 Solo 512MB
0072: Verdin AM62 Solo 512MB WB IT
0073: Verdin AM62 Dual 1GB ET
0074: Verdin AM62 Dual 1GB IT
0075: Verdin AM62 Dual 1GB WB IT
0076: Verdin AM62 Quad 2GB WB IT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

# a0383427 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: rework display adapter name handling

Rework the rather big array of zero length strings with 4 entries of
actual display adapter names to a array of structs which ties a pid4
to its correspondent human readable string.
Provide an accessor to get the string for a given PID4.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 39e521f7 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: rework carrier board name handling

Rework the rather big array of zero length strings with 4 entries of
actual carrier board names to a array of structs which ties a pid4
to its correspondent human readable string.
Provide an accessor to get the string for a given PID4.
Rework the user of the information to use the accessor.

Note that check_pid8_sanity() is used for early samples of Dahlia and
the development board. Yavia isn't affected.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 94757b47 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: add yavia carrier cfg block info

Add the Yavia Carrier board name string to the known carrier
board list.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 611b94bf 15-May-2023 Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

toradex: tdx-cfg-block: add 0070 verdin i.mx 8m plus quad sku

Add new i.MX 8M Plus Quad SKU to ConfigBlock handling.

0070: Verdin iMX8M Plus Quad 8GB WB IT

This SKU is identical to 0066 but supporting Industrial Temperature range.

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 17ead040 23-Jul-2022 Tom Rini <trini@konsulko.com>

Audit <flash.h> inclusion

A large number of files include <flash.h> as it used to be how various
SPI flash related functions were found, or for other reasons entirely.
In order to migrate some further CONFIG symbols to Kconfig we need to
not include flash.h in cases where we don't have a NOR flash of some
sort enabled. Furthermore, in cases where we are in common code and it
doesn't make sense to try and further refactor the code itself in to new
files we need to guard this inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 4f0c33c4 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Use official SKU names

Up to now in the code we named Toradex SKUs in a slightly different way
compared to the official product name, start using the official names
from now on to avoid misunderstanding.

This has also the nice benefit of the string being shorter, allowing
to fit nicely in 80 columns even adding the product ID when printing
the hardware information.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 8b6dc5d3 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Cleanup interactive cfg block creation

Simplify interactive config block creation code, instead of having a
a long list of questions and a complex tree of preprocessor directive to
guess the exact SKU, just ask the user to select it from a list.

The modules list is filtered out to include only SKUs that are supported
by the specific u-boot binary in execution.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# cdc39c6a 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Use ARRAY_SIZE macro

Use generally available ARRAY_SIZE macro, instead of hand-coding it
every time is needed.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# ea1dc32f 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Remove stale comments about modules availability

Remove comment "not currently on sale" on specific SKUs, this
information does not belong to the code and will never be accurate.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# a2da29a4 21-Jul-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku

Add new i.MX 8M Mini SKU to ConfigBlock handling.

0068: Verdin iMX8M Mini Quad 2GB WB IT No CAN

This SKU is identical to 0055 but without CAN. Mention this in the name
so those modules can be distinguished.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 1cf4e79f 20-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new toradex oui range

Add new Toradex MAC OUI (8c:06:cb), to the config block. With this change
we extend the possible serial-numbers as follows:

For serial-numbers 00000000-16777215 OUI 00:14:2d is taken
For serial-numbers 16777216-33554431 OUI 8c:06:cb is taken

Lower 24-bit of the serial number are used in the NIC part of the
MAC address, the complete serial number can be calculated using the OUI.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 7e27ce16 13-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: extend assembly version

There are two decimal digits reserved to encode the module version and
revision. This code so far implemented A-Z which used 0-25 of this
range.
This commit extends the range to make use of all 99 numbers. After
capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows,
as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 49410351 09-May-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new 8gb apalis-imx8

0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT

This module is identical to its 4GB counterpart
0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
except for the RAM size.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# fc102c87 13-Apr-2022 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: drop colibri pxa270 support

The Colibri PXA270 has been end-of-life since quite a while and would
require more and more maintenance (e.g. DM conversions).

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 47bcc0d0 13-Apr-2022 Denys Drozdov <denys.drozdov@toradex.com>

toradex: apalis-imx8x: drop support for apalis imx8x

Drop Apalis iMX8X platform as it never left sample state and is no
longer supported.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# c9585087 06-Oct-2021 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# ab98ebf7 06-Oct-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# ba825dad 30-Apr-2024 Tom Rini <trini@konsulko.com>

board: toradex: Remove <common.h> and add needed includes

Remove <common.h> from this board vendor directory and when needed
add missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 12d3257f 08-Mar-2024 Joao Paulo Goncalves <joao.goncalves@toradex.com>

toradex: tdx-cfg-block: add 0087 i.mx8m mini product variant

Add new product id 0087 Verdin iMX8M Mini Quad 2GB IT.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>

# 00653867 31-Jan-2024 Joao Paulo Goncalves <joao.goncalves@toradex.com>

toradex: tdx-cfg-block: add 0086 i.mx8m mini sku

Add new product id 0086 Verdin iMX8M Mini DualLite 2GB IT.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>

# 216ead4d 22-Jan-2024 Joao Paulo Goncalves <joao.goncalves@toradex.com>

toradex: tdx-cfg-block: Add new apalis and colibri pid

Add new apalis imx6 and colibri imx6/imx7 products IDs.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 0bcfda1b 03-Aug-2023 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add verdin am62 skus

Add initial Verdin AM62 Quad 1GB WB IT prototype and launch
configuration SKUs to ConfigBlock handling.

0069: Verdin AM62 Quad 1GB WB IT
0071: Verdin AM62 Solo 512MB
0072: Verdin AM62 Solo 512MB WB IT
0073: Verdin AM62 Dual 1GB ET
0074: Verdin AM62 Dual 1GB IT
0075: Verdin AM62 Dual 1GB WB IT
0076: Verdin AM62 Quad 2GB WB IT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

# a0383427 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: rework display adapter name handling

Rework the rather big array of zero length strings with 4 entries of
actual display adapter names to a array of structs which ties a pid4
to its correspondent human readable string.
Provide an accessor to get the string for a given PID4.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 39e521f7 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: rework carrier board name handling

Rework the rather big array of zero length strings with 4 entries of
actual carrier board names to a array of structs which ties a pid4
to its correspondent human readable string.
Provide an accessor to get the string for a given PID4.
Rework the user of the information to use the accessor.

Note that check_pid8_sanity() is used for early samples of Dahlia and
the development board. Yavia isn't affected.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 94757b47 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: add yavia carrier cfg block info

Add the Yavia Carrier board name string to the known carrier
board list.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 611b94bf 15-May-2023 Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

toradex: tdx-cfg-block: add 0070 verdin i.mx 8m plus quad sku

Add new i.MX 8M Plus Quad SKU to ConfigBlock handling.

0070: Verdin iMX8M Plus Quad 8GB WB IT

This SKU is identical to 0066 but supporting Industrial Temperature range.

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 17ead040 23-Jul-2022 Tom Rini <trini@konsulko.com>

Audit <flash.h> inclusion

A large number of files include <flash.h> as it used to be how various
SPI flash related functions were found, or for other reasons entirely.
In order to migrate some further CONFIG symbols to Kconfig we need to
not include flash.h in cases where we don't have a NOR flash of some
sort enabled. Furthermore, in cases where we are in common code and it
doesn't make sense to try and further refactor the code itself in to new
files we need to guard this inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 4f0c33c4 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Use official SKU names

Up to now in the code we named Toradex SKUs in a slightly different way
compared to the official product name, start using the official names
from now on to avoid misunderstanding.

This has also the nice benefit of the string being shorter, allowing
to fit nicely in 80 columns even adding the product ID when printing
the hardware information.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 8b6dc5d3 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Cleanup interactive cfg block creation

Simplify interactive config block creation code, instead of having a
a long list of questions and a complex tree of preprocessor directive to
guess the exact SKU, just ask the user to select it from a list.

The modules list is filtered out to include only SKUs that are supported
by the specific u-boot binary in execution.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# cdc39c6a 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Use ARRAY_SIZE macro

Use generally available ARRAY_SIZE macro, instead of hand-coding it
every time is needed.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# ea1dc32f 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Remove stale comments about modules availability

Remove comment "not currently on sale" on specific SKUs, this
information does not belong to the code and will never be accurate.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# a2da29a4 21-Jul-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku

Add new i.MX 8M Mini SKU to ConfigBlock handling.

0068: Verdin iMX8M Mini Quad 2GB WB IT No CAN

This SKU is identical to 0055 but without CAN. Mention this in the name
so those modules can be distinguished.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 1cf4e79f 20-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new toradex oui range

Add new Toradex MAC OUI (8c:06:cb), to the config block. With this change
we extend the possible serial-numbers as follows:

For serial-numbers 00000000-16777215 OUI 00:14:2d is taken
For serial-numbers 16777216-33554431 OUI 8c:06:cb is taken

Lower 24-bit of the serial number are used in the NIC part of the
MAC address, the complete serial number can be calculated using the OUI.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 7e27ce16 13-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: extend assembly version

There are two decimal digits reserved to encode the module version and
revision. This code so far implemented A-Z which used 0-25 of this
range.
This commit extends the range to make use of all 99 numbers. After
capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows,
as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 49410351 09-May-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new 8gb apalis-imx8

0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT

This module is identical to its 4GB counterpart
0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
except for the RAM size.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# fc102c87 13-Apr-2022 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: drop colibri pxa270 support

The Colibri PXA270 has been end-of-life since quite a while and would
require more and more maintenance (e.g. DM conversions).

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 47bcc0d0 13-Apr-2022 Denys Drozdov <denys.drozdov@toradex.com>

toradex: apalis-imx8x: drop support for apalis imx8x

Drop Apalis iMX8X platform as it never left sample state and is no
longer supported.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# c9585087 06-Oct-2021 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# ab98ebf7 06-Oct-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 12d3257f 08-Mar-2024 Joao Paulo Goncalves <joao.goncalves@toradex.com>

toradex: tdx-cfg-block: add 0087 i.mx8m mini product variant

Add new product id 0087 Verdin iMX8M Mini Quad 2GB IT.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>

# 00653867 31-Jan-2024 Joao Paulo Goncalves <joao.goncalves@toradex.com>

toradex: tdx-cfg-block: add 0086 i.mx8m mini sku

Add new product id 0086 Verdin iMX8M Mini DualLite 2GB IT.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>

# 216ead4d 22-Jan-2024 Joao Paulo Goncalves <joao.goncalves@toradex.com>

toradex: tdx-cfg-block: Add new apalis and colibri pid

Add new apalis imx6 and colibri imx6/imx7 products IDs.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 0bcfda1b 03-Aug-2023 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add verdin am62 skus

Add initial Verdin AM62 Quad 1GB WB IT prototype and launch
configuration SKUs to ConfigBlock handling.

0069: Verdin AM62 Quad 1GB WB IT
0071: Verdin AM62 Solo 512MB
0072: Verdin AM62 Solo 512MB WB IT
0073: Verdin AM62 Dual 1GB ET
0074: Verdin AM62 Dual 1GB IT
0075: Verdin AM62 Dual 1GB WB IT
0076: Verdin AM62 Quad 2GB WB IT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

# a0383427 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: rework display adapter name handling

Rework the rather big array of zero length strings with 4 entries of
actual display adapter names to a array of structs which ties a pid4
to its correspondent human readable string.
Provide an accessor to get the string for a given PID4.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 39e521f7 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: rework carrier board name handling

Rework the rather big array of zero length strings with 4 entries of
actual carrier board names to a array of structs which ties a pid4
to its correspondent human readable string.
Provide an accessor to get the string for a given PID4.
Rework the user of the information to use the accessor.

Note that check_pid8_sanity() is used for early samples of Dahlia and
the development board. Yavia isn't affected.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 94757b47 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: add yavia carrier cfg block info

Add the Yavia Carrier board name string to the known carrier
board list.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 611b94bf 15-May-2023 Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

toradex: tdx-cfg-block: add 0070 verdin i.mx 8m plus quad sku

Add new i.MX 8M Plus Quad SKU to ConfigBlock handling.

0070: Verdin iMX8M Plus Quad 8GB WB IT

This SKU is identical to 0066 but supporting Industrial Temperature range.

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 17ead040 23-Jul-2022 Tom Rini <trini@konsulko.com>

Audit <flash.h> inclusion

A large number of files include <flash.h> as it used to be how various
SPI flash related functions were found, or for other reasons entirely.
In order to migrate some further CONFIG symbols to Kconfig we need to
not include flash.h in cases where we don't have a NOR flash of some
sort enabled. Furthermore, in cases where we are in common code and it
doesn't make sense to try and further refactor the code itself in to new
files we need to guard this inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 4f0c33c4 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Use official SKU names

Up to now in the code we named Toradex SKUs in a slightly different way
compared to the official product name, start using the official names
from now on to avoid misunderstanding.

This has also the nice benefit of the string being shorter, allowing
to fit nicely in 80 columns even adding the product ID when printing
the hardware information.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 8b6dc5d3 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Cleanup interactive cfg block creation

Simplify interactive config block creation code, instead of having a
a long list of questions and a complex tree of preprocessor directive to
guess the exact SKU, just ask the user to select it from a list.

The modules list is filtered out to include only SKUs that are supported
by the specific u-boot binary in execution.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# cdc39c6a 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Use ARRAY_SIZE macro

Use generally available ARRAY_SIZE macro, instead of hand-coding it
every time is needed.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# ea1dc32f 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Remove stale comments about modules availability

Remove comment "not currently on sale" on specific SKUs, this
information does not belong to the code and will never be accurate.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# a2da29a4 21-Jul-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku

Add new i.MX 8M Mini SKU to ConfigBlock handling.

0068: Verdin iMX8M Mini Quad 2GB WB IT No CAN

This SKU is identical to 0055 but without CAN. Mention this in the name
so those modules can be distinguished.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 1cf4e79f 20-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new toradex oui range

Add new Toradex MAC OUI (8c:06:cb), to the config block. With this change
we extend the possible serial-numbers as follows:

For serial-numbers 00000000-16777215 OUI 00:14:2d is taken
For serial-numbers 16777216-33554431 OUI 8c:06:cb is taken

Lower 24-bit of the serial number are used in the NIC part of the
MAC address, the complete serial number can be calculated using the OUI.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 7e27ce16 13-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: extend assembly version

There are two decimal digits reserved to encode the module version and
revision. This code so far implemented A-Z which used 0-25 of this
range.
This commit extends the range to make use of all 99 numbers. After
capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows,
as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 49410351 09-May-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new 8gb apalis-imx8

0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT

This module is identical to its 4GB counterpart
0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
except for the RAM size.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# fc102c87 13-Apr-2022 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: drop colibri pxa270 support

The Colibri PXA270 has been end-of-life since quite a while and would
require more and more maintenance (e.g. DM conversions).

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 47bcc0d0 13-Apr-2022 Denys Drozdov <denys.drozdov@toradex.com>

toradex: apalis-imx8x: drop support for apalis imx8x

Drop Apalis iMX8X platform as it never left sample state and is no
longer supported.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# c9585087 06-Oct-2021 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# ab98ebf7 06-Oct-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 00653867 31-Jan-2024 Joao Paulo Goncalves <joao.goncalves@toradex.com>

toradex: tdx-cfg-block: add 0086 i.mx8m mini sku

Add new product id 0086 Verdin iMX8M Mini DualLite 2GB IT.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>

# 216ead4d 22-Jan-2024 Joao Paulo Goncalves <joao.goncalves@toradex.com>

toradex: tdx-cfg-block: Add new apalis and colibri pid

Add new apalis imx6 and colibri imx6/imx7 products IDs.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 0bcfda1b 03-Aug-2023 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add verdin am62 skus

Add initial Verdin AM62 Quad 1GB WB IT prototype and launch
configuration SKUs to ConfigBlock handling.

0069: Verdin AM62 Quad 1GB WB IT
0071: Verdin AM62 Solo 512MB
0072: Verdin AM62 Solo 512MB WB IT
0073: Verdin AM62 Dual 1GB ET
0074: Verdin AM62 Dual 1GB IT
0075: Verdin AM62 Dual 1GB WB IT
0076: Verdin AM62 Quad 2GB WB IT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

# a0383427 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: rework display adapter name handling

Rework the rather big array of zero length strings with 4 entries of
actual display adapter names to a array of structs which ties a pid4
to its correspondent human readable string.
Provide an accessor to get the string for a given PID4.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 39e521f7 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: rework carrier board name handling

Rework the rather big array of zero length strings with 4 entries of
actual carrier board names to a array of structs which ties a pid4
to its correspondent human readable string.
Provide an accessor to get the string for a given PID4.
Rework the user of the information to use the accessor.

Note that check_pid8_sanity() is used for early samples of Dahlia and
the development board. Yavia isn't affected.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 94757b47 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: add yavia carrier cfg block info

Add the Yavia Carrier board name string to the known carrier
board list.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 611b94bf 15-May-2023 Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

toradex: tdx-cfg-block: add 0070 verdin i.mx 8m plus quad sku

Add new i.MX 8M Plus Quad SKU to ConfigBlock handling.

0070: Verdin iMX8M Plus Quad 8GB WB IT

This SKU is identical to 0066 but supporting Industrial Temperature range.

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 17ead040 23-Jul-2022 Tom Rini <trini@konsulko.com>

Audit <flash.h> inclusion

A large number of files include <flash.h> as it used to be how various
SPI flash related functions were found, or for other reasons entirely.
In order to migrate some further CONFIG symbols to Kconfig we need to
not include flash.h in cases where we don't have a NOR flash of some
sort enabled. Furthermore, in cases where we are in common code and it
doesn't make sense to try and further refactor the code itself in to new
files we need to guard this inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 4f0c33c4 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Use official SKU names

Up to now in the code we named Toradex SKUs in a slightly different way
compared to the official product name, start using the official names
from now on to avoid misunderstanding.

This has also the nice benefit of the string being shorter, allowing
to fit nicely in 80 columns even adding the product ID when printing
the hardware information.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 8b6dc5d3 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Cleanup interactive cfg block creation

Simplify interactive config block creation code, instead of having a
a long list of questions and a complex tree of preprocessor directive to
guess the exact SKU, just ask the user to select it from a list.

The modules list is filtered out to include only SKUs that are supported
by the specific u-boot binary in execution.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# cdc39c6a 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Use ARRAY_SIZE macro

Use generally available ARRAY_SIZE macro, instead of hand-coding it
every time is needed.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# ea1dc32f 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Remove stale comments about modules availability

Remove comment "not currently on sale" on specific SKUs, this
information does not belong to the code and will never be accurate.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# a2da29a4 21-Jul-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku

Add new i.MX 8M Mini SKU to ConfigBlock handling.

0068: Verdin iMX8M Mini Quad 2GB WB IT No CAN

This SKU is identical to 0055 but without CAN. Mention this in the name
so those modules can be distinguished.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 1cf4e79f 20-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new toradex oui range

Add new Toradex MAC OUI (8c:06:cb), to the config block. With this change
we extend the possible serial-numbers as follows:

For serial-numbers 00000000-16777215 OUI 00:14:2d is taken
For serial-numbers 16777216-33554431 OUI 8c:06:cb is taken

Lower 24-bit of the serial number are used in the NIC part of the
MAC address, the complete serial number can be calculated using the OUI.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 7e27ce16 13-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: extend assembly version

There are two decimal digits reserved to encode the module version and
revision. This code so far implemented A-Z which used 0-25 of this
range.
This commit extends the range to make use of all 99 numbers. After
capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows,
as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 49410351 09-May-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new 8gb apalis-imx8

0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT

This module is identical to its 4GB counterpart
0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
except for the RAM size.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# fc102c87 13-Apr-2022 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: drop colibri pxa270 support

The Colibri PXA270 has been end-of-life since quite a while and would
require more and more maintenance (e.g. DM conversions).

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 47bcc0d0 13-Apr-2022 Denys Drozdov <denys.drozdov@toradex.com>

toradex: apalis-imx8x: drop support for apalis imx8x

Drop Apalis iMX8X platform as it never left sample state and is no
longer supported.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# c9585087 06-Oct-2021 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# ab98ebf7 06-Oct-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 0bcfda1b 03-Aug-2023 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add verdin am62 skus

Add initial Verdin AM62 Quad 1GB WB IT prototype and launch
configuration SKUs to ConfigBlock handling.

0069: Verdin AM62 Quad 1GB WB IT
0071: Verdin AM62 Solo 512MB
0072: Verdin AM62 Solo 512MB WB IT
0073: Verdin AM62 Dual 1GB ET
0074: Verdin AM62 Dual 1GB IT
0075: Verdin AM62 Dual 1GB WB IT
0076: Verdin AM62 Quad 2GB WB IT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

# a0383427 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: rework display adapter name handling

Rework the rather big array of zero length strings with 4 entries of
actual display adapter names to a array of structs which ties a pid4
to its correspondent human readable string.
Provide an accessor to get the string for a given PID4.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 39e521f7 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: rework carrier board name handling

Rework the rather big array of zero length strings with 4 entries of
actual carrier board names to a array of structs which ties a pid4
to its correspondent human readable string.
Provide an accessor to get the string for a given PID4.
Rework the user of the information to use the accessor.

Note that check_pid8_sanity() is used for early samples of Dahlia and
the development board. Yavia isn't affected.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 94757b47 18-Jul-2023 Max Krummenacher <max.krummenacher@toradex.com>

toradex: tdx-cfg-block: add yavia carrier cfg block info

Add the Yavia Carrier board name string to the known carrier
board list.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>

# 611b94bf 15-May-2023 Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

toradex: tdx-cfg-block: add 0070 verdin i.mx 8m plus quad sku

Add new i.MX 8M Plus Quad SKU to ConfigBlock handling.

0070: Verdin iMX8M Plus Quad 8GB WB IT

This SKU is identical to 0066 but supporting Industrial Temperature range.

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 17ead040 23-Jul-2022 Tom Rini <trini@konsulko.com>

Audit <flash.h> inclusion

A large number of files include <flash.h> as it used to be how various
SPI flash related functions were found, or for other reasons entirely.
In order to migrate some further CONFIG symbols to Kconfig we need to
not include flash.h in cases where we don't have a NOR flash of some
sort enabled. Furthermore, in cases where we are in common code and it
doesn't make sense to try and further refactor the code itself in to new
files we need to guard this inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 4f0c33c4 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Use official SKU names

Up to now in the code we named Toradex SKUs in a slightly different way
compared to the official product name, start using the official names
from now on to avoid misunderstanding.

This has also the nice benefit of the string being shorter, allowing
to fit nicely in 80 columns even adding the product ID when printing
the hardware information.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 8b6dc5d3 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Cleanup interactive cfg block creation

Simplify interactive config block creation code, instead of having a
a long list of questions and a complex tree of preprocessor directive to
guess the exact SKU, just ask the user to select it from a list.

The modules list is filtered out to include only SKUs that are supported
by the specific u-boot binary in execution.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# cdc39c6a 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Use ARRAY_SIZE macro

Use generally available ARRAY_SIZE macro, instead of hand-coding it
every time is needed.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# ea1dc32f 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Remove stale comments about modules availability

Remove comment "not currently on sale" on specific SKUs, this
information does not belong to the code and will never be accurate.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# a2da29a4 21-Jul-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku

Add new i.MX 8M Mini SKU to ConfigBlock handling.

0068: Verdin iMX8M Mini Quad 2GB WB IT No CAN

This SKU is identical to 0055 but without CAN. Mention this in the name
so those modules can be distinguished.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 1cf4e79f 20-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new toradex oui range

Add new Toradex MAC OUI (8c:06:cb), to the config block. With this change
we extend the possible serial-numbers as follows:

For serial-numbers 00000000-16777215 OUI 00:14:2d is taken
For serial-numbers 16777216-33554431 OUI 8c:06:cb is taken

Lower 24-bit of the serial number are used in the NIC part of the
MAC address, the complete serial number can be calculated using the OUI.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 7e27ce16 13-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: extend assembly version

There are two decimal digits reserved to encode the module version and
revision. This code so far implemented A-Z which used 0-25 of this
range.
This commit extends the range to make use of all 99 numbers. After
capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows,
as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 49410351 09-May-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new 8gb apalis-imx8

0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT

This module is identical to its 4GB counterpart
0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
except for the RAM size.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# fc102c87 13-Apr-2022 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: drop colibri pxa270 support

The Colibri PXA270 has been end-of-life since quite a while and would
require more and more maintenance (e.g. DM conversions).

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 47bcc0d0 13-Apr-2022 Denys Drozdov <denys.drozdov@toradex.com>

toradex: apalis-imx8x: drop support for apalis imx8x

Drop Apalis iMX8X platform as it never left sample state and is no
longer supported.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# c9585087 06-Oct-2021 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# ab98ebf7 06-Oct-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 611b94bf 15-May-2023 Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

toradex: tdx-cfg-block: add 0070 verdin i.mx 8m plus quad sku

Add new i.MX 8M Plus Quad SKU to ConfigBlock handling.

0070: Verdin iMX8M Plus Quad 8GB WB IT

This SKU is identical to 0066 but supporting Industrial Temperature range.

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 17ead040 23-Jul-2022 Tom Rini <trini@konsulko.com>

Audit <flash.h> inclusion

A large number of files include <flash.h> as it used to be how various
SPI flash related functions were found, or for other reasons entirely.
In order to migrate some further CONFIG symbols to Kconfig we need to
not include flash.h in cases where we don't have a NOR flash of some
sort enabled. Furthermore, in cases where we are in common code and it
doesn't make sense to try and further refactor the code itself in to new
files we need to guard this inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 4f0c33c4 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Use official SKU names

Up to now in the code we named Toradex SKUs in a slightly different way
compared to the official product name, start using the official names
from now on to avoid misunderstanding.

This has also the nice benefit of the string being shorter, allowing
to fit nicely in 80 columns even adding the product ID when printing
the hardware information.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 8b6dc5d3 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Cleanup interactive cfg block creation

Simplify interactive config block creation code, instead of having a
a long list of questions and a complex tree of preprocessor directive to
guess the exact SKU, just ask the user to select it from a list.

The modules list is filtered out to include only SKUs that are supported
by the specific u-boot binary in execution.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# cdc39c6a 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Use ARRAY_SIZE macro

Use generally available ARRAY_SIZE macro, instead of hand-coding it
every time is needed.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# ea1dc32f 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Remove stale comments about modules availability

Remove comment "not currently on sale" on specific SKUs, this
information does not belong to the code and will never be accurate.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# a2da29a4 21-Jul-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku

Add new i.MX 8M Mini SKU to ConfigBlock handling.

0068: Verdin iMX8M Mini Quad 2GB WB IT No CAN

This SKU is identical to 0055 but without CAN. Mention this in the name
so those modules can be distinguished.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 1cf4e79f 20-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new toradex oui range

Add new Toradex MAC OUI (8c:06:cb), to the config block. With this change
we extend the possible serial-numbers as follows:

For serial-numbers 00000000-16777215 OUI 00:14:2d is taken
For serial-numbers 16777216-33554431 OUI 8c:06:cb is taken

Lower 24-bit of the serial number are used in the NIC part of the
MAC address, the complete serial number can be calculated using the OUI.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 7e27ce16 13-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: extend assembly version

There are two decimal digits reserved to encode the module version and
revision. This code so far implemented A-Z which used 0-25 of this
range.
This commit extends the range to make use of all 99 numbers. After
capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows,
as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 49410351 09-May-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new 8gb apalis-imx8

0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT

This module is identical to its 4GB counterpart
0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
except for the RAM size.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# fc102c87 13-Apr-2022 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: drop colibri pxa270 support

The Colibri PXA270 has been end-of-life since quite a while and would
require more and more maintenance (e.g. DM conversions).

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 47bcc0d0 13-Apr-2022 Denys Drozdov <denys.drozdov@toradex.com>

toradex: apalis-imx8x: drop support for apalis imx8x

Drop Apalis iMX8X platform as it never left sample state and is no
longer supported.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# c9585087 06-Oct-2021 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# ab98ebf7 06-Oct-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 17ead040 23-Jul-2022 Tom Rini <trini@konsulko.com>

Audit <flash.h> inclusion

A large number of files include <flash.h> as it used to be how various
SPI flash related functions were found, or for other reasons entirely.
In order to migrate some further CONFIG symbols to Kconfig we need to
not include flash.h in cases where we don't have a NOR flash of some
sort enabled. Furthermore, in cases where we are in common code and it
doesn't make sense to try and further refactor the code itself in to new
files we need to guard this inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 4f0c33c4 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Use official SKU names

Up to now in the code we named Toradex SKUs in a slightly different way
compared to the official product name, start using the official names
from now on to avoid misunderstanding.

This has also the nice benefit of the string being shorter, allowing
to fit nicely in 80 columns even adding the product ID when printing
the hardware information.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 8b6dc5d3 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Cleanup interactive cfg block creation

Simplify interactive config block creation code, instead of having a
a long list of questions and a complex tree of preprocessor directive to
guess the exact SKU, just ask the user to select it from a list.

The modules list is filtered out to include only SKUs that are supported
by the specific u-boot binary in execution.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# cdc39c6a 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Use ARRAY_SIZE macro

Use generally available ARRAY_SIZE macro, instead of hand-coding it
every time is needed.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# ea1dc32f 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Remove stale comments about modules availability

Remove comment "not currently on sale" on specific SKUs, this
information does not belong to the code and will never be accurate.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# a2da29a4 21-Jul-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku

Add new i.MX 8M Mini SKU to ConfigBlock handling.

0068: Verdin iMX8M Mini Quad 2GB WB IT No CAN

This SKU is identical to 0055 but without CAN. Mention this in the name
so those modules can be distinguished.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 1cf4e79f 20-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new toradex oui range

Add new Toradex MAC OUI (8c:06:cb), to the config block. With this change
we extend the possible serial-numbers as follows:

For serial-numbers 00000000-16777215 OUI 00:14:2d is taken
For serial-numbers 16777216-33554431 OUI 8c:06:cb is taken

Lower 24-bit of the serial number are used in the NIC part of the
MAC address, the complete serial number can be calculated using the OUI.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 7e27ce16 13-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: extend assembly version

There are two decimal digits reserved to encode the module version and
revision. This code so far implemented A-Z which used 0-25 of this
range.
This commit extends the range to make use of all 99 numbers. After
capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows,
as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 49410351 09-May-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new 8gb apalis-imx8

0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT

This module is identical to its 4GB counterpart
0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
except for the RAM size.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# fc102c87 13-Apr-2022 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: drop colibri pxa270 support

The Colibri PXA270 has been end-of-life since quite a while and would
require more and more maintenance (e.g. DM conversions).

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 47bcc0d0 13-Apr-2022 Denys Drozdov <denys.drozdov@toradex.com>

toradex: apalis-imx8x: drop support for apalis imx8x

Drop Apalis iMX8X platform as it never left sample state and is no
longer supported.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# c9585087 06-Oct-2021 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# ab98ebf7 06-Oct-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 17ead040 23-Jul-2022 Tom Rini <trini@konsulko.com>

Audit <flash.h> inclusion

A large number of files include <flash.h> as it used to be how various
SPI flash related functions were found, or for other reasons entirely.
In order to migrate some further CONFIG symbols to Kconfig we need to
not include flash.h in cases where we don't have a NOR flash of some
sort enabled. Furthermore, in cases where we are in common code and it
doesn't make sense to try and further refactor the code itself in to new
files we need to guard this inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 4f0c33c4 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Use official SKU names

Up to now in the code we named Toradex SKUs in a slightly different way
compared to the official product name, start using the official names
from now on to avoid misunderstanding.

This has also the nice benefit of the string being shorter, allowing
to fit nicely in 80 columns even adding the product ID when printing
the hardware information.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 8b6dc5d3 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Cleanup interactive cfg block creation

Simplify interactive config block creation code, instead of having a
a long list of questions and a complex tree of preprocessor directive to
guess the exact SKU, just ask the user to select it from a list.

The modules list is filtered out to include only SKUs that are supported
by the specific u-boot binary in execution.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# cdc39c6a 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Use ARRAY_SIZE macro

Use generally available ARRAY_SIZE macro, instead of hand-coding it
every time is needed.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# ea1dc32f 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Remove stale comments about modules availability

Remove comment "not currently on sale" on specific SKUs, this
information does not belong to the code and will never be accurate.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# a2da29a4 21-Jul-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku

Add new i.MX 8M Mini SKU to ConfigBlock handling.

0068: Verdin iMX8M Mini Quad 2GB WB IT No CAN

This SKU is identical to 0055 but without CAN. Mention this in the name
so those modules can be distinguished.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 1cf4e79f 20-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new toradex oui range

Add new Toradex MAC OUI (8c:06:cb), to the config block. With this change
we extend the possible serial-numbers as follows:

For serial-numbers 00000000-16777215 OUI 00:14:2d is taken
For serial-numbers 16777216-33554431 OUI 8c:06:cb is taken

Lower 24-bit of the serial number are used in the NIC part of the
MAC address, the complete serial number can be calculated using the OUI.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 7e27ce16 13-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: extend assembly version

There are two decimal digits reserved to encode the module version and
revision. This code so far implemented A-Z which used 0-25 of this
range.
This commit extends the range to make use of all 99 numbers. After
capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows,
as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 49410351 09-May-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new 8gb apalis-imx8

0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT

This module is identical to its 4GB counterpart
0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
except for the RAM size.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# fc102c87 13-Apr-2022 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: drop colibri pxa270 support

The Colibri PXA270 has been end-of-life since quite a while and would
require more and more maintenance (e.g. DM conversions).

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 47bcc0d0 13-Apr-2022 Denys Drozdov <denys.drozdov@toradex.com>

toradex: apalis-imx8x: drop support for apalis imx8x

Drop Apalis iMX8X platform as it never left sample state and is no
longer supported.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# c9585087 06-Oct-2021 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# ab98ebf7 06-Oct-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 4f0c33c4 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Use official SKU names

Up to now in the code we named Toradex SKUs in a slightly different way
compared to the official product name, start using the official names
from now on to avoid misunderstanding.

This has also the nice benefit of the string being shorter, allowing
to fit nicely in 80 columns even adding the product ID when printing
the hardware information.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 8b6dc5d3 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: tdx-cfg-block: Cleanup interactive cfg block creation

Simplify interactive config block creation code, instead of having a
a long list of questions and a complex tree of preprocessor directive to
guess the exact SKU, just ask the user to select it from a list.

The modules list is filtered out to include only SKUs that are supported
by the specific u-boot binary in execution.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# cdc39c6a 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Use ARRAY_SIZE macro

Use generally available ARRAY_SIZE macro, instead of hand-coding it
every time is needed.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# ea1dc32f 21-Jul-2022 Francesco Dolcini <francesco.dolcini@toradex.com>

toradex: common: Remove stale comments about modules availability

Remove comment "not currently on sale" on specific SKUs, this
information does not belong to the code and will never be accurate.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# a2da29a4 21-Jul-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add 0068 i.mx 8m mini sku

Add new i.MX 8M Mini SKU to ConfigBlock handling.

0068: Verdin iMX8M Mini Quad 2GB WB IT No CAN

This SKU is identical to 0055 but without CAN. Mention this in the name
so those modules can be distinguished.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

# 1cf4e79f 20-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new toradex oui range

Add new Toradex MAC OUI (8c:06:cb), to the config block. With this change
we extend the possible serial-numbers as follows:

For serial-numbers 00000000-16777215 OUI 00:14:2d is taken
For serial-numbers 16777216-33554431 OUI 8c:06:cb is taken

Lower 24-bit of the serial number are used in the NIC part of the
MAC address, the complete serial number can be calculated using the OUI.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 7e27ce16 13-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: extend assembly version

There are two decimal digits reserved to encode the module version and
revision. This code so far implemented A-Z which used 0-25 of this
range.
This commit extends the range to make use of all 99 numbers. After
capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows,
as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 49410351 09-May-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new 8gb apalis-imx8

0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT

This module is identical to its 4GB counterpart
0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
except for the RAM size.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# fc102c87 13-Apr-2022 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: drop colibri pxa270 support

The Colibri PXA270 has been end-of-life since quite a while and would
require more and more maintenance (e.g. DM conversions).

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 47bcc0d0 13-Apr-2022 Denys Drozdov <denys.drozdov@toradex.com>

toradex: apalis-imx8x: drop support for apalis imx8x

Drop Apalis iMX8X platform as it never left sample state and is no
longer supported.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# c9585087 06-Oct-2021 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# ab98ebf7 06-Oct-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 1cf4e79f 20-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new toradex oui range

Add new Toradex MAC OUI (8c:06:cb), to the config block. With this change
we extend the possible serial-numbers as follows:

For serial-numbers 00000000-16777215 OUI 00:14:2d is taken
For serial-numbers 16777216-33554431 OUI 8c:06:cb is taken

Lower 24-bit of the serial number are used in the NIC part of the
MAC address, the complete serial number can be calculated using the OUI.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 7e27ce16 13-Jun-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: extend assembly version

There are two decimal digits reserved to encode the module version and
revision. This code so far implemented A-Z which used 0-25 of this
range.
This commit extends the range to make use of all 99 numbers. After
capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows,
as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 49410351 09-May-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new 8gb apalis-imx8

0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT

This module is identical to its 4GB counterpart
0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
except for the RAM size.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# fc102c87 13-Apr-2022 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: drop colibri pxa270 support

The Colibri PXA270 has been end-of-life since quite a while and would
require more and more maintenance (e.g. DM conversions).

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 47bcc0d0 13-Apr-2022 Denys Drozdov <denys.drozdov@toradex.com>

toradex: apalis-imx8x: drop support for apalis imx8x

Drop Apalis iMX8X platform as it never left sample state and is no
longer supported.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# c9585087 06-Oct-2021 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# ab98ebf7 06-Oct-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 49410351 09-May-2022 Philippe Schenker <philippe.schenker@toradex.com>

toradex: tdx-cfg-block: add new 8gb apalis-imx8

0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT

This module is identical to its 4GB counterpart
0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
except for the RAM size.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# fc102c87 13-Apr-2022 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: drop colibri pxa270 support

The Colibri PXA270 has been end-of-life since quite a while and would
require more and more maintenance (e.g. DM conversions).

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 47bcc0d0 13-Apr-2022 Denys Drozdov <denys.drozdov@toradex.com>

toradex: apalis-imx8x: drop support for apalis imx8x

Drop Apalis iMX8X platform as it never left sample state and is no
longer supported.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# c9585087 06-Oct-2021 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# ab98ebf7 06-Oct-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# fc102c87 13-Apr-2022 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: drop colibri pxa270 support

The Colibri PXA270 has been end-of-life since quite a while and would
require more and more maintenance (e.g. DM conversions).

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 47bcc0d0 13-Apr-2022 Denys Drozdov <denys.drozdov@toradex.com>

toradex: apalis-imx8x: drop support for apalis imx8x

Drop Apalis iMX8X platform as it never left sample state and is no
longer supported.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# c9585087 06-Oct-2021 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# ab98ebf7 06-Oct-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# c9585087 06-Oct-2021 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add new i.mx 6ull and 8m plus skus

Add new i.MX 6ULL and 8M Plus SKUs to ConfigBlock handling:

0062: Colibri iMX6ULL 1GB IT (eMMC)

0063: Verdin iMX8M Plus Quad 4GB IT

0064: Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT

0065: Verdin iMX8M Plus QuadLite 1GB IT

0066: Verdin iMX8M Plus Quad 8GB Wi-Fi / BT

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# ab98ebf7 06-Oct-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix interactive mode it handling

Restore "Is the module an IT version? [y/N]" for "cfgblock create"
interactive mode command, which was leading to invalid detection
of 0051 Colibri iMX8DX 1GB WB module;

Fixes: a5b5ad4d859b ("toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus")
Related-to: ELB-3482
Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 5f588f83 30-Aug-2021 Tom Rini <trini@konsulko.com>

arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms. We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic. Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# fd90aca3 07-Apr-2021 Denys Drozdov <denys.drozdov@toradex.com>

toradex: configblock: fix module revision in config block

U-boot might display wrong module revision information
for modules with an assembly version 'K'. "cfgblock create"
does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@gmail.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 2a1a2559 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: fix i.mx 8m mini interactive

Now with them first Verdin iMX8M Mini DualLite modules in for bring-up
we got clarity how is_cpu_type() actually behaves.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# a5b5ad4d 28-Oct-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus

Add new i.MX 8M Mini/Plus SKUs to ConfigBlock handling:

0058: Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT

0059: Verdin iMX8M Mini Quad 2GB IT

0060: Verdin iMX8M Mini DualLite 1GB WB IT

0061: Verdin iMX8M Plus Quad 2GB

Rename existing SKU (use correct one):
Verdin iMX8M Nano SoloLite 1GB -> Verdin iMX8M Nano Quad 1GB Wi-Fi

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@toradex.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@toradex.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@toradex.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# db4ab6d4 15-Jul-2020 Igor Opaniuk <igor.opaniuk@toradex.com>

toradex: tdx-cfg-clock: add migration routine from PID8

Add migration routine from PID8 pre-stored values on EEPROM
(including sane value checks).

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 0c6b5588 15-Jul-2020 Igor Opaniuk <igor.opaniuk@toradex.com>

toradex: tdx-cfg-block: add support for EEPROM

This introduces support for EEPROM as a storage for the main Toradex
config block and additional config blocks on extra EEPROM chips (on
carrier board or video adapters).

To enable EEPROM as a storage for the main config block:
TDX_HAVE_EEPROM=y.

For additional EEPROMs please enable this Kconfig symbol:
TDX_CFG_BLOCK_EXTRA=y.

Information about existing EEPROM chips is provided via Device Tree
using aliases.

You can also write configuration for the carrier board using
create_carrier subcommand for cfgblock. Example:

Verdin iMX8MM # cfgblock create_carrier
Supported carrier boards:
UNKNOWN CARRIER = [0]
Verdin Carrier Board = [1]
Choose your carrier board (provide ID): 1
Enter carrier board version (e.g. V1.1B): V1.0A
Enter carrier board serial number: 10622780

Also with barcode:
Verdin iMX8MM # cfgblock create carrier -y 0156100010622780

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 26921f58 15-Jul-2020 Igor Opaniuk <igor.opaniuk@toradex.com>

toradex: tdx-cfg-block: add carrier boards and display adapters

Add defines for supported carrier boards and display adapters.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# c0c3978c 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 842ddf8e 28-Jan-2020 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# 7b51b576 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get() to env.h

Move env_get() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9d364ebd 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: avoid line continuations

Fix issue as reported by checkpatch.pl. Leave long lines as line
continuation in text output is not recommended.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 9d63c7d8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix apalis imx8 target

The Apalis iMX8 was missing the interactive part should a customer have
bricked his module and want to re-create the configuration block. Fix
this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6c297ee8 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: fix colibri imx8x target

The Colibri iMX8X target got re-named late in the cycle which we forgot
to reflect here. Furthermore, it was missing the interactive part should
a customer have bricked his module and want to re-create the
configuration block. Fix this.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# d1aa1444 11-Jul-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: configblock: generic wi-fi/bt handling

Make the interactive Wi-Fi/BT handling generic by pulling it out of the
Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and
Colibri iMX8X.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 42a4f182 11-Jul-2019 Stefan Agner <stefan.agner@toradex.com>

toradex: configblock: initialize MMC before switching partition

If the module is in serial downloader mode, we do no longer read the
environment from eMMC. Therefor, the eMMC is unitialized when trying
to read the config block. Use mmc_init to initialize the selected
MMC device before using it.

Note: In case the MMC has already been initialized, the mmc_init
detects that and returns immediately.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

# 6988a3af 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: add new skus

Add all the latest new SKUs:
- Apalis iMX8 QuadXPlus 2GB Wi-Fi / BT IT
- Apalis iMX8 QuadMax 4GB IT
- Apalis iMX8 QuadPlus 2GB Wi-Fi / BT
- Apalis iMX8 QuadPlus 2GB",
- Colibri iMX8 QuadXPlus 2GB IT
- Colibri iMX8 DualX 1GB Wi-Fi / Bluetooth
- Colibri iMX8 DualX 1GB

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 4adc9fc1 09-Apr-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

board: toradex: tdx-cfg-block: clean-up sku handling

Clean-up handling of several SKUs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 89315f31 09-Apr-2019 Stefan Agner <stefan.agner@toradex.com>

tdx-cfg-block: simplify i.MX 6 module detection

Use CONFIG_TARGET_... at compile time to differentiate between
Apalis iMX6, Colibri iMX6 and Colibri iMX6ULL. Avoid code
duplication by moving question about Wi-Fi / Bluetooth before
IT/non-IT decision.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 08f80555 09-Apr-2019 Gerard Salvatella <gerard.salvatella@toradex.com>

tdx-cfg-block: add support for new colibri iMX6ull skus

Add support for new Colibri iMX6ULL SKUs.

While at it also checkpatch fix the whole files.

Signed-off-by: Gerard Salvatella <gerard.salvatella@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# ccdd3713 25-Mar-2019 Marcel Ziswiler <marcel.ziswiler@toradex.com>

tdx-cfg-block: fix off by one issue

Fix toradex_modules array off by one issue potentially leading to
spurious printout during boot e.g.

Model: Toradex V1.2A,

instead of

Model: Toradex UNKNOWN MODULE V1.2A.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# 587b13c6 25-Mar-2019 Dominik Sliwa <dominik.sliwa@toradex.com>

toradex: configblock: add an -y parameter to 'cfgblock create’

Add an optional -y parameter to 'cfgblock create’ to simplify
automation.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

# bc53fb19 06-Aug-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>


# d826b875 30-May-2018 Stefan Agner <stefan.agner@toradex.com>

board: toradex: add new and upcoming SKUs

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>


# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>


# 723b43da 12-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>


# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>


# bf264cd0 26-Jun-2017 Grygorii Strashko <grygorii.strashko@ti.com>

board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>


# c62db35d 31-May-2017 Simon Glass <sjg@chromium.org>

arm: Add explicit include of <asm/mach-types.h>

Rather than relying on common.h to provide this include, which is going
away at some point, include it explicitly in each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>


# 0e513e78 23-Apr-2017 Simon Glass <sjg@chromium.org>

tegra: Convert MMC to use driver model for operations

Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
Tegra to use driver model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>


# a2777ecb 16-Nov-2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>

toradex: config block handling

Add Toradex factory configuration block handling. The config block is a
data structure which gets stored to flash during production testing. The
structure holds such information as board resp. hardware revision,
product ID and serial number which is used as the NIC part of the
Ethernet MAC address as well. The config block will be read upon boot by
the show_board_info() function, displayed as part of the board
information and passed to Linux via device tree or ATAGs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>