]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
20 months agoboard: cssi: Move all mother board code into common.c
Christophe Leroy [Wed, 5 Apr 2023 16:50:23 +0000 (18:50 +0200)]
board: cssi: Move all mother board code into common.c

All the code used to manage the mother boards will be
common to soon to come CPU board.

Move all that code into common.c

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agoboard: cssi: Refactor EEPROM read
Christophe Leroy [Wed, 5 Apr 2023 14:05:36 +0000 (16:05 +0200)]
board: cssi: Refactor EEPROM read

On cmpc885 board, the ethernet addresses are stored in an
EEPROM that is accessed through SPI.

A 3 bytes command is sent to the chip then the content
gets read. At the time being a single block access is
performed, ignoring the first 3 bytes read.

Reword the SPI transfer to first send 3 bytes then
receive the content of the EEPROM so that there don't be
3 dummy bytes at the beginning of the buffer.

And move the function into common.c so that it can be
reused by the board that will be added in a future patch.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agoboard: cssi: Create dedicated file for common sources
Christophe Leroy [Tue, 4 Apr 2023 10:42:15 +0000 (12:42 +0200)]
board: cssi: Create dedicated file for common sources

In preparation of the new cssi board called cmpcpro which
we be introduce in a future patch, move common
functions into a dedicated file in a common directory.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agoboard: cssi: Migrate to hashed password
Christophe Leroy [Fri, 28 Apr 2023 15:42:33 +0000 (17:42 +0200)]
board: cssi: Migrate to hashed password

Use a hashed password instead of clear text in order to
improve board security.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agospi: mpc8xxx: Add support for SPI on mpc832x
Christophe Leroy [Thu, 2 Mar 2023 15:26:26 +0000 (16:26 +0100)]
spi: mpc8xxx: Add support for SPI on mpc832x

On mpc832x, SPI can be either handled by CPU or QE.
In order to work in CPU mode, bit 17 of SPMODE has to
be set to 1, that bit is called OP.

Also, data is located at a different place than the one expected
by the driver today. In 8 bits mode with REV set, data to be
transmitted is located in the most significant byte while
received data is located in second byte. So perform the
necessary shifts.

In order to differentiate with other CPUs, a new compatible is
added for mpc832x: fsl,mpc832x-spi

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
20 months agogpio: Add QUICC Engine GPIOs driver
Christophe Leroy [Tue, 21 Feb 2023 18:31:11 +0000 (19:31 +0100)]
gpio: Add QUICC Engine GPIOs driver

The mpc832x has GPIOs handled by the QUICC Engine.
The registers are different from the one for the
non QE mpc83xx GPIOs.

Implement a GPIO driver for those.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agoclk: mpc83xx: Fix clocks for mpc832x
Christophe Leroy [Mon, 3 Apr 2023 12:16:56 +0000 (14:16 +0200)]
clk: mpc83xx: Fix clocks for mpc832x

gd->arch.sdhc_clk only exists when CONFIG_FSL_ESDHC is set,
so enclose it inside ifdefs.

gd->arch.qe_clk and gd->arch.brg_clk must be populated when
CONFIG_QE is set.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agopowerpc: mpc83xx: Don't activate MMU when not necessary
Christophe Leroy [Wed, 18 Jan 2023 19:52:38 +0000 (20:52 +0100)]
powerpc: mpc83xx: Don't activate MMU when not necessary

At startup, some RAM is needed (for instance for stack) before
DRAM is initialised.

One way to offer such RAM, used by mpc83xx, is to lock some entries
in the cache. To do that, MMU needs to be activated.

On mpc83xx having a QUICC Engine an alternative is to user some
part of from the Multi User RAM, like done on mpc8xx for instance.
For that, the MMU is not needed.

Activating the MMU is problematic because exception vectors are not
setup yet so in case of ISI or DSI that CPU will crash and reboot.

At the time being, MMU is activated regardless.

Only activate it when locking cache entries to provide initial RAM.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agopowerpc: mpc83xx: Fix soc.h
Christophe Leroy [Tue, 4 Apr 2023 13:09:18 +0000 (15:09 +0200)]
powerpc: mpc83xx: Fix soc.h

There are helpers included in soc.h

Declare them static inline so that soc.h can be
included in several places.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agopowerpc: mpc832x: Fix reset word
Christophe Leroy [Thu, 2 Mar 2023 09:48:58 +0000 (10:48 +0100)]
powerpc: mpc832x: Fix reset word

According to the reference manual, the Reset Configuration
Word Low Register bits 2-3 must be set to 0b10.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agowatchdog: mpc8xxx: Add support for mpc83xx
Christophe Leroy [Mon, 3 Apr 2023 08:39:59 +0000 (10:39 +0200)]
watchdog: mpc8xxx: Add support for mpc83xx

Introduce a new compatible "fsl,pq2pro-wdt"
On mpc83xx, the prescaling factor is 0x10000.

Don't write the watchdog configuration register in
start.S as it can be written only once.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agowatchdog: mpc8xxx: Make it generic
Christophe Leroy [Mon, 3 Apr 2023 08:27:39 +0000 (10:27 +0200)]
watchdog: mpc8xxx: Make it generic

mpc8xx, mpc83xx and mpc86xx have similar watchdog with almost same
memory registers.

Refactor the driver to get the register addresses from the
device tree and use the compatible to know the prescale factor.

Calculate the watchdog setup value from the provided timeout.

Don't declare it anymore as an HW_WATCHDOG, u-boot will start
servicing the watchdog early enough.

On mpc8xx the watchdog configuration register is also used for
configuring the bus monitor. So add it as an option to the watchdog
when it is mpc8xx. When watchdog is not selected, leave the
configuration of the initial SYPCR from Kconfig.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agowatchdog: mpc8xx: Rename it mpc8xxx
Christophe Leroy [Mon, 3 Apr 2023 08:27:39 +0000 (10:27 +0200)]
watchdog: mpc8xx: Rename it mpc8xxx

mpc8xx, mpc83xx and mpc86xx have similar watchdog with almost same
memory registers.

Rename it mpc8xxx which is the generic name used for drivers supporting
several mpc families.

The driver will be made more generic in following patch.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agopowerpc: mpc8xx: Migrate to CONFIG_SYS_CLK_FREQ
Christophe Leroy [Tue, 4 Apr 2023 08:14:33 +0000 (10:14 +0200)]
powerpc: mpc8xx: Migrate to CONFIG_SYS_CLK_FREQ

8xx has CONFIG_8xx_GCLK_FREQ which is similar to
CONFIG_SYS_CLK_FREQ, and doesn't set CONFIG_SYS_CLK_FREQ.

Due to that, get_board_sys_clk() returns 0.

Remove CONFIG_8xx_GCLK_FREQ and use CONFIG_SYS_CLK_FREQ instead.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agoRevert "disk: Use a helper function to reduce duplication"
Tom Rini [Mon, 3 Apr 2023 14:43:37 +0000 (10:43 -0400)]
Revert "disk: Use a helper function to reduce duplication"

Per Takahiro Akashi this is not an equivalent rework, so revert it.

This reverts commit d87bdb82eae66512c222fd93280acaf4dd1cd4be.

Signed-off-by: Tom Rini <trini@konsulko.com>
20 months agoMerge tag 'u-boot-imx-next-20230331' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Fri, 31 Mar 2023 16:50:34 +0000 (12:50 -0400)]
Merge tag 'u-boot-imx-next-20230331' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx into next

u-boot-imx-next-20230331 for next
---------------------------------

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/15819

i.MX patches queued for next:

- Conversions to DM_SERIAL
- Fixes for Toradex boards
- Gateworks Boards
- i.MX8ULP
- EQoS support / fixes, changes in boards

20 months agoMerge branch '2023-03-30-assorted-general-upates' into next
Tom Rini [Fri, 31 Mar 2023 14:04:23 +0000 (10:04 -0400)]
Merge branch '2023-03-30-assorted-general-upates' into next

- RTC cleanups / improvements, run_commandf() cleanups, fs bugfixes,
  socrates config fix, PCI MPS support, GPIO improvements, other code
  cleanups

21 months agotest: fs: Check fat short file name
Stefan Herbrechtsmeier [Wed, 22 Mar 2023 08:46:02 +0000 (09:46 +0100)]
test: fs: Check fat short file name

Ensure that a freshly written fat file with a lower case filename which
fits into the upper case 8.3 short filename is not mangeled with a tilde
and number.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
21 months agoinput: button_kbd: make driver complementary to gpio buttons
Svyatoslav Ryhel [Mon, 20 Mar 2023 19:06:30 +0000 (21:06 +0200)]
input: button_kbd: make driver complementary to gpio buttons

Remove need of dts binding for button keyboard since it reuses
gpio-keys binding. Select gpio-keys driver if button keyboard
is selected since button keyboard can not operate on its own.

Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # HTC One X T30
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agocmd: ums: abort mounting by pressing any key
Svyatoslav Ryhel [Mon, 20 Mar 2023 19:01:43 +0000 (21:01 +0200)]
cmd: ums: abort mounting by pressing any key

This patch introduses config which allows interrupt run of usb
mass storage with any key. This is especially useful on devices
with limited input capabilities like tablets and smatphones which
have only gpio keys in direct access.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agotest: exit: fix run_commandf() warnings
Evgeny Bachinin [Mon, 20 Mar 2023 08:23:14 +0000 (11:23 +0300)]
test: exit: fix run_commandf() warnings

Fix warnings after adding printf-like attribute format for
run_commandf():
warning: too many arguments for format [-Wformat-extra-args]

Signed-off-by: Evgeny Bachinin <EABachinin@sberdevices.ru>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agotest: fdt: fix run_commandf() warnings
Evgeny Bachinin [Mon, 20 Mar 2023 08:23:13 +0000 (11:23 +0300)]
test: fdt: fix run_commandf() warnings

Fix warnings both for 32bit and 64bit architecture after adding
printf-like attribute format for run_commandf():
warning: format ‘%x’ expects argument of type ‘unsigned int’, but
  argument 2 has type ‘ulong {aka long unsigned int}’ [-Wformat=]
  ret = run_commandf("fdt addr -c %08x", addr);
                     ^
Signed-off-by: Evgeny Bachinin <EABachinin@sberdevices.ru>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Fixup testcases added since patch was posted]
Signed-off-by: Tom Rini <trini@konsulko.com>
21 months agounit-test: cover run_commandf() by test-cases
Evgeny Bachinin [Mon, 20 Mar 2023 08:23:12 +0000 (11:23 +0300)]
unit-test: cover run_commandf() by test-cases

As run_commandf() is variadic version of run_command() and just a wrapper,
hence apply similar run_command's test-cases.

Let's avoid warning about empty string passing:
warning: zero-length gnu_printf format string [-Wformat-zero-length]
   assert(run_commandf("") == 0);

Signed-off-by: Evgeny Bachinin <EABachinin@sberdevices.ru>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agocli: run_commandf(): small fixups
Evgeny Bachinin [Mon, 20 Mar 2023 08:23:11 +0000 (11:23 +0300)]
cli: run_commandf(): small fixups

* vsnprintf() can truncate cmd, hence it makes no sense to launch such
command (it's broken). Moreover, it's better to signalize to the caller
about such case (for facilitating debugging or bug hunting).

* Fix kernel-doc warnings:
  include/command.h:264: info: Scanning doc for run_commandf
  include/command.h:268: warning: contents before sections
  include/command.h:271: warning: No description found for return value
                                  of 'run_commandf'

* Add printf-like format attribute to validate at compile-time the format
string against parameters's type.

* Fix compilation error in case of -Wall, -Werror, -Wextra:
error: variable ‘i’ set but not used [-Werror=unused-but-set-variable]

* Drop extra ret variable.

Signed-off-by: Evgeny Bachinin <EABachinin@sberdevices.ru>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agodrivers: rtc: add max313xx series rtc driver
Chris Packham [Sun, 19 Mar 2023 21:23:44 +0000 (10:23 +1300)]
drivers: rtc: add max313xx series rtc driver

Adding support for Analog Devices MAX313XX series RTCs.

This is ported from the Linux driver and adapted for use in u-boot.
Notable differences are
- handling of tm_year and tm_mon differ
- clock source support is omitted
- hwmon support for the MAX31328 and MAX31343 is omitted
- rtc_ops->reset is added

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agoinclude: kernel.h: port find_closest() from Linux
Chris Packham [Sun, 19 Mar 2023 21:23:43 +0000 (10:23 +1300)]
include: kernel.h: port find_closest() from Linux

The find_closest() macro can be used to find an element in a sorted
array that is closest to an input value. Bring in this macro from
Linux v6.3-rc1-2-g8ca09d5fa354.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agodisk: Use a helper function to reduce duplication
Simon Glass [Sun, 19 Mar 2023 19:29:57 +0000 (08:29 +1300)]
disk: Use a helper function to reduce duplication

Reduce the duplicated code slightly by using a helper function to handle
the common code.

This reduces the code size very slightly.

Signed-off-by: Simon Glass <sjg@chromium.org>
21 months agolib: Fix SYS_TIMER_COUNTS_DOWN description in Kconfig
Marek Vasut [Sun, 19 Mar 2023 03:13:02 +0000 (04:13 +0100)]
lib: Fix SYS_TIMER_COUNTS_DOWN description in Kconfig

The SYS_TIMER_COUNTS_DOWN description contains a typo,
s@rathe@&r@ , fix it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
21 months agogpio: allow passing NULL to gpio_request_by_line_name() to search all gpio controllers
Rasmus Villemoes [Fri, 17 Mar 2023 20:12:22 +0000 (21:12 +0100)]
gpio: allow passing NULL to gpio_request_by_line_name() to search all gpio controllers

The API is more convenient to use if one doesn't have to know upfront
which gpio controller has a line with the name one is searching for,
and arrange to look that device up somehow. Or implement this loop
oneself.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agortc: m41t62: implements read8/write8 operations
Thomas Perrot [Fri, 17 Mar 2023 14:22:41 +0000 (15:22 +0100)]
rtc: m41t62: implements read8/write8 operations

These operations are required by dm_rtc_read and
dm_bootcount_get helpers.

Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agofs: ext4: fix files seen as symlink during deletion
Corentin GUILLEVIC [Fri, 17 Mar 2023 12:15:12 +0000 (13:15 +0100)]
fs: ext4: fix files seen as symlink during deletion

The deletion process handles special case for symlinks whose target are
small enough that it fits in struct ext2_inode.b.symlink. So no block had
been allocated. But the check of file type wrongly considered regular
files as symlink. So, no block was freed. So, the EXT4 partition could be
corrupted because of no free block available.

Signed-off-by: Corentin GUILLEVIC <corentin.guillevic@smile.fr>
21 months agofs: fat: do not mangle short filenames
Stefan Herbrechtsmeier [Fri, 17 Mar 2023 12:04:13 +0000 (13:04 +0100)]
fs: fat: do not mangle short filenames

Do not mangle lower or mixed case filenames which fit into the upper
case 8.3 short filename. This ensures FAT standard compatible short
filenames (SFN) to support systems without long filename (LFN) support
like boot roms (ex. SFN BOOT.BIN instead of BOOT~1.BIN for LFN
boot.bin).

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
21 months agotest: Add test for new command pci_mps
Stephen Carlson [Fri, 10 Mar 2023 19:07:15 +0000 (11:07 -0800)]
test: Add test for new command pci_mps

Adds a test for the new pci_mps command to ensure that it can set the
Maximum Payload Size (MPS) of all devices to 256 bytes in the sandbox
environment. Enables the pci_mps command in the sandbox environment so
that this test can be run.

Signed-off-by: Stephen Carlson <stcarlso@linux.microsoft.com>
21 months agodrivers: pci: sandbox: Add stub sandbox PCI MPS support
Stephen Carlson [Fri, 10 Mar 2023 19:07:14 +0000 (11:07 -0800)]
drivers: pci: sandbox: Add stub sandbox PCI MPS support

Reports the sandbox swapcase PCI Express device to support a 256 byte
Maximum Payload Size for MPS tuning tests.

Signed-off-by: Stephen Carlson <stcarlso@linux.microsoft.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agocmd: pci: Add command to set MPS of all PCIe devices
Stephen Carlson [Fri, 10 Mar 2023 19:07:13 +0000 (11:07 -0800)]
cmd: pci: Add command to set MPS of all PCIe devices

Enable tuning of the PCI Express MPS (Maximum Payload Size) of
each device. The Maximum Read Request Size is not altered.

The SAFE method uses the largest MPS value supported by all devices in the
system for each device. This method is the same algorithm as used by Linux
pci=pcie_bus_safe.

The PEER2PEER method sets all devices to the minimal (128 byte) MPS, which
allows hot plug of devices later that might only support the minimum size,
and ensures compatibility of DMA between two devices on the bus.

Signed-off-by: Stephen Carlson <stcarlso@linux.microsoft.com>
21 months agosysinfo: gpio: fix loop over DT "revisions" array
Rasmus Villemoes [Fri, 10 Mar 2023 10:58:03 +0000 (11:58 +0100)]
sysinfo: gpio: fix loop over DT "revisions" array

There can certainly be a lot more elements in the "revisions" (and
"names") arrays than there are gpios used to form the trinary number
we're searching for; we simply don't know the array size up-front.

Nor do we need to, because the loop body already knows to recognize
-EOVERFLOW as "not that many elements present" (and we have a test
that specifically ensures that dev_read_u32_index() returns exactly
that). So just drop the i < priv->gpio_num condition.

While in here, fix the weird placement of the default: keyword.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
21 months agonvedit: simplify do_env_indirect()
Rasmus Villemoes [Mon, 6 Mar 2023 13:27:21 +0000 (14:27 +0100)]
nvedit: simplify do_env_indirect()

Instead of calling env_get(from) up to three times, just do it once,
computing the value we will put into 'to' and error out if that is
NULL (i.e. no 'from' variable and no default provided).

No functional change.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agoapi: move API related config options into submenu
Heinrich Schuchardt [Fri, 3 Mar 2023 22:31:22 +0000 (23:31 +0100)]
api: move API related config options into submenu

Kconfig settings that are related to the API for standalone applications
should be in the API sub-menu and not on the top level.

CONFIG_STANDALONE_LOAD_ADDR is only relevant if standalone example
applications are built.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
21 months agoKconfig: Sort the BUILD_TARGET list
Marek Vasut [Tue, 28 Feb 2023 06:22:21 +0000 (07:22 +0100)]
Kconfig: Sort the BUILD_TARGET list

Sort the defaults list in BUILD_TARGET Kconfig option. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agoimage: Fix potentially uninitialized data variable
Marek Vasut [Mon, 27 Feb 2023 19:56:31 +0000 (20:56 +0100)]
image: Fix potentially uninitialized data variable

In case fitImage support is disabled, and image_locate_script() is
passed a fitImage, then the 'data' variable is used uninitialized.
Drop into the default: branch of the switch-case statement and do
not return the uninitialized data, and do not modify the return
pointer either, just print an error message.

Reported by clang build:
"
$ make HOSTCC=clang CC=clang KCFLAGS=-Werror sandbox64_defconfig && make HOSTCC=clang CC=clang KCFLAGS=-Werror
...
boot/image-board.c:1006:7: error: variable 'data' is used uninitialized whenever switch case is taken [-Werror,-Wsometimes-uninitialized]
        case IMAGE_FORMAT_LEGACY:
             ^~~~~~~~~~~~~~~~~~~
include/image.h:608:29: note: expanded from macro 'IMAGE_FORMAT_LEGACY'
                                ^~~~
boot/image-board.c:1128:19: note: uninitialized use occurs here
        *datap = (char *)data;
                         ^~~~
boot/image-board.c:1001:11: note: initialize the variable 'data' to silence this warning
        u32 *data;
                 ^
                  = NULL
"

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agopowerpc/mpc85xx: disable legacy format booting
Heiko Schocher [Thu, 23 Feb 2023 06:03:47 +0000 (07:03 +0100)]
powerpc/mpc85xx: disable legacy format booting

disable CONFIG_LEGACY_IMAGE_FORMAT so prevent of booting
not signed fitimages.

Signed-off-by: Heiko Schocher <hs@denx.de>
21 months agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-marvell into...
Tom Rini [Thu, 30 Mar 2023 14:04:21 +0000 (10:04 -0400)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-marvell into next

- mvebu: Fix boot mode detection (Pali)
- mvebu: clearfog: defconfig and eMMC updates (Martin)

21 months agoclk: imx8mp: add pwm clocks support
Tommaso Merciai [Fri, 10 Mar 2023 15:24:24 +0000 (16:24 +0100)]
clk: imx8mp: add pwm clocks support

Add clocks support for the PWM controllers. This is ported from
Linux v6.3.0-rc1

Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
21 months agoarm64: imx8mm: imx8mn: imx8mp: Drop FEC GPR[1] board workaround
Marek Vasut [Mon, 6 Mar 2023 14:53:54 +0000 (15:53 +0100)]
arm64: imx8mm: imx8mn: imx8mp: Drop FEC GPR[1] board workaround

The FEC interface mode is now configured in common board_interface_eth_init()
and called by FEC MAC driver when appropriate. Drop the board side duplicates
if the same functionality.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agoarm64: imx8mp: Drop EQoS GPR[1] board workaround
Marek Vasut [Mon, 6 Mar 2023 14:53:53 +0000 (15:53 +0100)]
arm64: imx8mp: Drop EQoS GPR[1] board workaround

The EQoS interface mode is now configured in common board_interface_eth_init()
and called by EQoS MAC driver when appropriate. Drop the board side duplicates
if the same functionality.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agoarm64: dts: imx8mp: Drop EQoS clock workaround
Marek Vasut [Mon, 6 Mar 2023 14:53:52 +0000 (15:53 +0100)]
arm64: dts: imx8mp: Drop EQoS clock workaround

The assigned-clock no longer have to be dropped, the clock are now
defined in clk-imx8mp.c and used by DWMAC driver to configure the
DWMAC clock. Drop the workarounds from U-Boot specific DT extras.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agoconfigs: verdin-imx8mp: Fix wrong early malloc() heap size
Emanuele Ghidoli [Thu, 16 Feb 2023 11:31:15 +0000 (12:31 +0100)]
configs: verdin-imx8mp: Fix wrong early malloc() heap size

Set, previously unset, CONFIG_SPL_SYS_MALLOC_F_LEN to 0x4000 whose
default value is 0x10000.
Early malloc() uses CRAM_S at 0x184000 (CFG_MALLOC_F_ADDR), this ram
area end at 0x188000.

Fixes: 2bc2f817cea7 ("board: toradex: add verdin imx8m plus support")
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
21 months agoARM: imx: imx8mp: fix enable_i2c_clk
Rasmus Villemoes [Wed, 22 Mar 2023 14:42:05 +0000 (15:42 +0100)]
ARM: imx: imx8mp: fix enable_i2c_clk

In order for i2c_num==4 and 5 to stay invalid for non-imx8mp SOCs, the
i2c_ccgr[] array must be sized by the number of initializers present,
not with a hard-coded 6 which would implicitly initialize the last two
elements with zeroes.

Also, the bounds check is off-by-one.

Fixes: c92c3a4453b8 "ARM: imx: imx8mp: Enable support for i2c5 and i2c6 on i.MX8MP"
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
21 months agocompulab: imx8mm-cl-iot-gate: Fix some function declarations in ddr.h
Ying-Chun Liu (PaulLiu) [Mon, 13 Mar 2023 18:26:20 +0000 (02:26 +0800)]
compulab: imx8mm-cl-iot-gate: Fix some function declarations in ddr.h

We have a few places here that the function declarations do not
match their prototypes, correct them.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP i.MX U-Boot Team <uboot-imx@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reported-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
21 months agonet: fec_mxc: Add board_interface_eth_init() for i.MX8M Mini/Nano/Plus
Marek Vasut [Mon, 6 Mar 2023 14:53:51 +0000 (15:53 +0100)]
net: fec_mxc: Add board_interface_eth_init() for i.MX8M Mini/Nano/Plus

Implement common board_interface_eth_init() and call it from the FEC
driver to configure IOMUXC GPR[1] register according to the PHY mode
obtained from DT. This supports all three interface modes supported by
the i.MX8M Mini/Nano/Plus FEC and supersedes the current board-side
configuration of the same IOMUX GPR[1] duplicated in the board files.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agonet: fec_mxc: Add ref clock setup support for i.MX8M Mini/Nano/Plus
Marek Vasut [Mon, 6 Mar 2023 14:53:50 +0000 (15:53 +0100)]
net: fec_mxc: Add ref clock setup support for i.MX8M Mini/Nano/Plus

The FEC ref clock frequency on i.MX8M Mini/Nano/Plus was so far configured
via ad-hoc board code. Replace that with DM clock clk_set_rate() instead.
This way, the driver claims all its required clock and sets the ref clock
rate, without any need of architecture specific register fiddling.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agonet: dwc_eth_qos: Add board_interface_eth_init() for i.MX8M Plus
Marek Vasut [Mon, 6 Mar 2023 14:53:49 +0000 (15:53 +0100)]
net: dwc_eth_qos: Add board_interface_eth_init() for i.MX8M Plus

Implement common board_interface_eth_init() and call it from the DWMAC
driver to configure IOMUXC GPR[1] register according to the PHY mode
obtained from DT. This supports all three interface modes supported by
the i.MX8M Plus DWMAC and supersedes current board-side configuration
of the same IOMUX GPR[1] duplicated in the board files.

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Marek Vasut <marex@denx.de>
21 months agonet: dwc_eth_qos: Add i.MX8M Plus RMII support
Marek Vasut [Mon, 6 Mar 2023 14:53:48 +0000 (15:53 +0100)]
net: dwc_eth_qos: Add i.MX8M Plus RMII support

With DM clock support in place, it is easy to add RMII support into the
MAC driver. The RMII cannot operate at 1000 Mbps and at 100 and 10 Mbps
the clock frequency is 50 MHz and 5 MHz instead of 25 MHz and 2.5 MHz.

The board DT requires the following adjustments to EQoS node:
  phy-mode = "rmii";
  assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_266M>,
   <&clk IMX8MP_SYS_PLL2_100M>,
   <&clk IMX8MP_SYS_PLL2_50M>;
  assigned-clock-rates = <0>, <100000000>, <50000000>;

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Marek Vasut <marex@denx.de>
21 months agonet: dwc_eth_qos: Add DM CLK support for i.MX8M Plus
Marek Vasut [Mon, 6 Mar 2023 14:53:47 +0000 (15:53 +0100)]
net: dwc_eth_qos: Add DM CLK support for i.MX8M Plus

The DWMAC clock in i.MX8M Plus were so far configured via ad-hoc
architecture code. Replace that with DM clock instead. This way,
the driver claims all its required clock, enables and disables
them, and even gets the CSR clock rate and sets the TX clock rate,
without any need of architecture specific register fiddling. Drop
the architecture specific code while at it too.

The adjustment here is modeled after STM32MP15xx clock handling
in this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agonet: dwc_eth_qos: Set DMA_MODE SWR bit to reset the MAC
Marek Vasut [Mon, 6 Mar 2023 14:53:46 +0000 (15:53 +0100)]
net: dwc_eth_qos: Set DMA_MODE SWR bit to reset the MAC

The driver currently only waits for DMA_MODE SWR bit to clear itself.
This is insufficient e.g. on i.MX8M Plus, where the MAC must be reset
before IOMUX GPR[1] content is latched into the MAC and used. Without
the proper reset, the i.MX8M Plus MAC variant does not take the value
in IOMUX GPR[1] into account, which makes it impossible e.g. to switch
interface mode from RGMII to any other.

Since proper reset is desired in general to put the block into defined
state, always assert the DMA_MODE SWR bit before waiting for the bit
to clear itself.

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Marek Vasut <marex@denx.de>
21 months agonet: dwc_eth_qos: Staticize eqos_inval_buffer_tegra186()
Marek Vasut [Mon, 6 Mar 2023 14:53:45 +0000 (15:53 +0100)]
net: dwc_eth_qos: Staticize eqos_inval_buffer_tegra186()

This function is only used within the driver, staticize it.

Fixes: 149e80f74b6 ("net: dwc_eth_qos: public some functions")
Signed-off-by: Marek Vasut <marex@denx.de>
21 months agonet: dwc_eth_qos: Drop unused dm_gpio_free() on STM32
Marek Vasut [Mon, 6 Mar 2023 14:53:44 +0000 (15:53 +0100)]
net: dwc_eth_qos: Drop unused dm_gpio_free() on STM32

The dm_gpio_free() is never called, because for stm32, the phy_reset_gpio
pointer is never valid. This is because only tegra186 ever claims the
phy_reset_gpio, all other platforms use the PHY framework to reset the
PHY instead. Drop the dm_gpio_free() and dm_gpio_is_valid().

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Marek Vasut <marex@denx.de>
21 months agonet: dwc_eth_qos: Drop bogus return after goto
Marek Vasut [Mon, 6 Mar 2023 14:53:43 +0000 (15:53 +0100)]
net: dwc_eth_qos: Drop bogus return after goto

The return is never triggered due to the goto just above it.
Drop it. No functional change.

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Marek Vasut <marex@denx.de>
21 months agonet: Pull board_interface_eth_init() into common code
Marek Vasut [Mon, 6 Mar 2023 14:53:42 +0000 (15:53 +0100)]
net: Pull board_interface_eth_init() into common code

Move the board_interface_eth_init() into common ethernet uclass code,
since this function could be shared by multiple drivers.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
21 months agoclk: imx8mp: Add EQoS MAC clock
Marek Vasut [Mon, 6 Mar 2023 14:53:41 +0000 (15:53 +0100)]
clk: imx8mp: Add EQoS MAC clock

Add clock for the DWMAC EQoS block. This is used among other things
to configure the MII clock via DM CLK.

Acked-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Marek Vasut <marex@denx.de>
21 months agoRevert "imx: imx8x: colibri: switch to binman"
Andrejs Cainikovs [Fri, 3 Mar 2023 13:26:41 +0000 (14:26 +0100)]
Revert "imx: imx8x: colibri: switch to binman"

This reverts commit bdadc140a127b14a666d2007eddc3f65c8de7d5a.

We do not want this, see [1].

[1] https://lore.kernel.org/all/56cf058164f331ce99ce75b0751b825ee2e07fc0.camel@toradex.com/

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: set bootdelay
Marcel Ziswiler [Fri, 3 Mar 2023 13:26:40 +0000 (14:26 +0100)]
colibri-imx8x: set bootdelay

Set the boot delay to one second.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: set bootaux memory base and size
Andrejs Cainikovs [Fri, 3 Mar 2023 13:26:38 +0000 (14:26 +0100)]
colibri-imx8x: set bootaux memory base and size

Move i.MX auxiliary core memory base and size configuration
to defconfig where it should belong.

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: update env memory layout
Marcel Ziswiler [Fri, 3 Mar 2023 13:26:37 +0000 (14:26 +0100)]
colibri-imx8x: update env memory layout

Update the distro config env memory layout for the Colibri iMX8X:

- kernel_comp_addr_r=0xb0000000 temporary area for uncompressing (ie FIT
images or Image.gz booted using booti)
- kernel_comp_size=0x08000000
- loadaddr=0x95400000 avoiding any reserved areas located before that
- fdt_addr_r = loadaddr + 128MB - allows for 128MB kernel
- scriptaddr = fdt_addr_r + 512KB - allows for 512KB fdt
- ramdisk_addr_r = scriptaddr + 512KB - allows for 512KB script

Idea of memory layout taken from commit a9f1e35bedc4
("apalis-imx8: update env memory layout").

Note that for our regular BSP Layers and Reference Images for Yocto
Project an updated distro boot script is required (see
meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-distro-boot).

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: switch from fatload to load
Andrejs Cainikovs [Fri, 3 Mar 2023 13:26:36 +0000 (14:26 +0100)]
colibri-imx8x: switch from fatload to load

Make sure M4 binary loading works equally well
on ext4 as well as fat file systems.

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: drop obsolete environment variables
Andrejs Cainikovs [Fri, 3 Mar 2023 13:26:34 +0000 (14:26 +0100)]
colibri-imx8x: drop obsolete environment variables

Drop obsolete environment variables boot_file, bootcmd_mfg,
fdt_addr, finduuid, image, mfgtool_args, mmcargs, mmcdev, mmcpart,
panel, sec_boot, vidargs.

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: construct fdtfile dynamically
Andrejs Cainikovs [Fri, 3 Mar 2023 13:26:33 +0000 (14:26 +0100)]
colibri-imx8x: construct fdtfile dynamically

The following expression is used to construct the device tree name:
fdtfile=${soc}-colibri-${fdt_board}.dtb

- soc is set dynamically (either imx8qxp or imx8dx)
- fdt_board can be modified by the user (eval-v3, aster, iris/iris-v2)

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agodefconfig: colibri-imx8x: enable CONFIG_OF_SYSTEM_SETUP
Philippe Schenker [Fri, 3 Mar 2023 13:26:28 +0000 (14:26 +0100)]
defconfig: colibri-imx8x: enable CONFIG_OF_SYSTEM_SETUP

Enable a call to ft_system_setup() which reserves M4 memory region.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: enable fuse command
Andrejs Cainikovs [Fri, 3 Mar 2023 13:26:42 +0000 (14:26 +0100)]
colibri-imx8x: enable fuse command

This command is required for initial SoC provisioning.

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: enable environment bootcount limit
Marcel Ziswiler [Fri, 3 Mar 2023 13:26:39 +0000 (14:26 +0100)]
colibri-imx8x: enable environment bootcount limit

Enable optional environment bootcount limit functionality.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: provide proper CONFIG_SYS_PROMPT
Igor Opaniuk [Fri, 3 Mar 2023 13:26:35 +0000 (14:26 +0100)]
colibri-imx8x: provide proper CONFIG_SYS_PROMPT

Provide proper sys prompt, which should be "Colibri iMX8X #".

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: extract is_imx8dx() from ram detection
Max Krummenacher [Fri, 3 Mar 2023 13:26:32 +0000 (14:26 +0100)]
colibri-imx8x: extract is_imx8dx() from ram detection

Refactor the detection of QXP vs. DX SoC into its own helper function.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: update update_uboot confirmation message
Marcel Ziswiler [Fri, 3 Mar 2023 13:26:31 +0000 (14:26 +0100)]
colibri-imx8x: update update_uboot confirmation message

Update update_uboot confirmation message.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: remove obsolete sdhc related config defines
Marcel Ziswiler [Fri, 3 Mar 2023 13:26:30 +0000 (14:26 +0100)]
colibri-imx8x: remove obsolete sdhc related config defines

Remove obsolete SDHC related config defines. Nowadays, all SDHC related
hardware configuration comes from the device tree.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: remove obsolete net usb start
Marcel Ziswiler [Fri, 3 Mar 2023 13:26:29 +0000 (14:26 +0100)]
colibri-imx8x: remove obsolete net usb start

Remove obsolete net USB start.

While at it also add a comment about enabling distro-boot.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agocolibri-imx8x: Remove baudrate from console argument
Philippe Schenker [Fri, 3 Mar 2023 13:26:27 +0000 (14:26 +0100)]
colibri-imx8x: Remove baudrate from console argument

This commit does remove the options argument from the console
kernel-argument as it prevents the serial driver from outputting
anything.

Do this by switchting to use the variable "setup" as it is done on other
Toradex modules.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agoboard: colibri-imx8x: add 2nd ethernet address
Andrejs Cainikovs [Fri, 3 Mar 2023 13:26:26 +0000 (14:26 +0100)]
board: colibri-imx8x: add 2nd ethernet address

All Colibri iMX8X variants have 2nd RGMII on SoC, so add the address
for 2nd ethernet.

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
21 months agoARM: dts: imx: Add support for DH electronics i.MX8M Plus DHCOM on PDK3
Marek Vasut [Thu, 2 Mar 2023 22:40:44 +0000 (23:40 +0100)]
ARM: dts: imx: Add support for DH electronics i.MX8M Plus DHCOM on PDK3

Add support for DH electronics i.MX8M Plus DHCOM SoM on PDK3 carrier board.
Currently supported are serial console, EQoS and FEC ethernets, eMMC, SD,
SPI NOR and USB 3.0 host.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agomx51evk: Remove unused mx51evk_video.c file
Fabio Estevam [Tue, 14 Mar 2023 11:58:16 +0000 (08:58 -0300)]
mx51evk: Remove unused mx51evk_video.c file

Since commit 1fa43cad8625 ("video: Drop references to CONFIG_VIDEO et al")
the mx51evk_video.c is no longer used.

Remove the unused file.

Signed-off-by: Fabio Estevam <festevam@denx.de>
21 months agomx53loco: Remove unused mx53loco_video.c file
Fabio Estevam [Tue, 14 Mar 2023 11:58:15 +0000 (08:58 -0300)]
mx53loco: Remove unused mx53loco_video.c file

Since commit 1fa43cad8625 ("video: Drop references to CONFIG_VIDEO et al")
the mx53loco_video.c is no longer used.

Remove the unused file.

Signed-off-by: Fabio Estevam <festevam@denx.de>
21 months agoARM: imx: Include on-SoM microSD in list of i.MX6 DHCOM boot devices
Marek Vasut [Sun, 5 Mar 2023 23:21:31 +0000 (00:21 +0100)]
ARM: imx: Include on-SoM microSD in list of i.MX6 DHCOM boot devices

Add mmc1, which is mapped to optional on-SoM microSD socket,
to the list of distro boot command boot devices.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
21 months agoARM: imx: Convert DH i.MX6 DHSOM to DM_SERIAL
Marek Vasut [Sun, 5 Mar 2023 20:48:35 +0000 (21:48 +0100)]
ARM: imx: Convert DH i.MX6 DHSOM to DM_SERIAL

Enable CONFIG_DM_SERIAL on DH i.MX6 DHSOM to convert it to DM serial .

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
21 months agoconfigs: remove gwventana_gw5904_defconfig
Tim Harvey [Tue, 21 Feb 2023 17:18:49 +0000 (09:18 -0800)]
configs: remove gwventana_gw5904_defconfig

Now that the gwventana_emmc_defconfig is the same as the
gwventana_gw5904_defconfig we can remove the latter.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
21 months agoconfigs: gwventana_emmc_defconfig: add MV88E61XX DSA switch support
Tim Harvey [Tue, 21 Feb 2023 17:18:48 +0000 (09:18 -0800)]
configs: gwventana_emmc_defconfig: add MV88E61XX DSA switch support

The MV88E61XX switch is used on the GW5904 which is an eMMC based board.
Adding it here allows us to remove the gwventana_gw5904_defconfig.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
21 months agomisc: imx: remove DM dependency for ocotp driver in SPL
Jean-Marie Lemetayer [Mon, 13 Feb 2023 13:12:25 +0000 (14:12 +0100)]
misc: imx: remove DM dependency for ocotp driver in SPL

The ocotp driver is available for regular and SPL builds using the
(SPL_)MXC_OCOTP configuration. Also, the ocotp driver does not support
the driver model (DM) configuration.

But, for SPL builds, the SPL_MXC_OCOTP configuration depends on
SPL_MISC which implies on SPL_DM.

This commit replaces the dependency on SPL_MISC with SPL_DRIVERS_MISC.
So the only requirement is to have enabled miscellaneous drivers for
the SPL.

Signed-off-by: Jean-Marie Lemetayer <j.lemetayer@kerlink.fr>
21 months agoarm64: dts: imx8mp: Do not delete PHY nodes on i.MX8MP DHCOM PDK2
Marek Vasut [Sat, 11 Feb 2023 22:38:01 +0000 (23:38 +0100)]
arm64: dts: imx8mp: Do not delete PHY nodes on i.MX8MP DHCOM PDK2

The PHY nodes may be activated via DTO in case another SoM variant
is populated into the development kit. Do not delete the nodes.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agoarm64: dts: imx8mp: Add FEC RMII pin mux on i.MX8MP DHCOM
Marek Vasut [Sat, 11 Feb 2023 22:38:00 +0000 (23:38 +0100)]
arm64: dts: imx8mp: Add FEC RMII pin mux on i.MX8MP DHCOM

The i.MX8MP DHCOM SoM may come with either external RGMII PHY or
LAN8740Ai RMII PHY on the SoM attached to FEC MAC. Add pin mux
settings for both options, so that DT overlay can override these
settings on SoM variant with the LAN8740Ai PHY.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agoarm64: dts: imx8mp: Add EQoS RMII pin mux on i.MX8MP DHCOM
Marek Vasut [Sat, 11 Feb 2023 22:37:59 +0000 (23:37 +0100)]
arm64: dts: imx8mp: Add EQoS RMII pin mux on i.MX8MP DHCOM

The i.MX8MP DHCOM SoM may come with either KSZ9131RNXI RGMII PHY
or LAN8740Ai RMII PHY on the SoM attached to EQoS MAC. Add pin
mux settings for both options, so that DT overlay can override
these settings on SoM variant with the LAN8740Ai PHY.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agoarm64: dts: imx8mp: Adjust EQoS PHY address on i.MX8MP DHCOM
Marek Vasut [Sat, 11 Feb 2023 22:37:58 +0000 (23:37 +0100)]
arm64: dts: imx8mp: Adjust EQoS PHY address on i.MX8MP DHCOM

The current variant of the SoM has LAN8740Ai PHY connected to EQoS
strapped to MDIO address 0 , adjust the MDIO address to match the
hardware.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agoarm64: imx8mp: Auto-detect PHY on i.MX8MP DHCOM
Marek Vasut [Sat, 11 Feb 2023 22:10:50 +0000 (23:10 +0100)]
arm64: imx8mp: Auto-detect PHY on i.MX8MP DHCOM

The i.MX8MP DHCOM SoM may be populated with either KSZ9131RNXI RGMII PHY
or LAN8740Ai RMII PHY attached to EQoS MAC, and either external RGMII PHY
or LAN8740Ai RMII PHY attached to FEC MAC. The SoM configuration can be
detected for each MAC by reading RX_CTL pull resistor state early on boot.
Make use of this, detect the exact PHY configuration, and patch control DT
accordingly so that the ethernet is configured correctly in U-Boot.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agoARM: imx: Add 2 GiB DRAM support for DH electronics i.MX8M Plus DHCOM
Marek Vasut [Sat, 11 Feb 2023 21:49:01 +0000 (22:49 +0100)]
ARM: imx: Add 2 GiB DRAM support for DH electronics i.MX8M Plus DHCOM

The DH electronics i.MX8M Plus DHCOM SoM currently supports only 4 GiB
of DRAM population option. Add another population option with 2 GiB of
DRAM. The chips used on the 2 GiB option are 2x K4F6E3S4HM-MGCJ .

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agoARM: imx: Enable LTO for DH electronics i.MX8M Plus DHCOM
Marek Vasut [Sat, 11 Feb 2023 21:48:24 +0000 (22:48 +0100)]
ARM: imx: Enable LTO for DH electronics i.MX8M Plus DHCOM

Enable LTO to reduce the size of SPL, which with multiple DRAM
calibration tables may be close to the limit.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agoconfigs: colibri-imx7: Fix bad block table in flash configuration
Stefan Eichenberger [Fri, 10 Feb 2023 10:33:51 +0000 (11:33 +0100)]
configs: colibri-imx7: Fix bad block table in flash configuration

Make sure that the bad block table in flash is used on Colibri iMX7.
Without this configuration enabled U-Boot corrupts the bad block table
and Linux will update the table on each reboot. The corruption occurs
because if CONFIG_SYS_NAND_USE_FLASH_BBT is not set, U-boot will store
bad blocks out of band, while the Linux driver for the iMX7 will store
them in band in a bad block table.

Fixes: fd8c1fc9430 ("arm: dts: imx7: colibri: add raw NAND support")
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
21 months agodoc: sl-mx8mm: Fix mistake in merge conflict resolution
Frieder Schrempf [Wed, 8 Feb 2023 16:20:33 +0000 (17:20 +0100)]
doc: sl-mx8mm: Fix mistake in merge conflict resolution

There was a conflict between the following two commits, that wasn't
resolved correctly. Fix this.

a93985ddfcc3 ("doc: sl-mx8mm: Update the NXP TF-A source reference")
f0f461287eff ("imx: Suggest the NXP ATF github repo")

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
21 months agoarm: mvebu: Define all options for AXP BOOT_FROM_* macros
Pali Rohár [Wed, 29 Mar 2023 19:03:35 +0000 (21:03 +0200)]
arm: mvebu: Define all options for AXP BOOT_FROM_* macros

Definitions are according to the MV78460 Hardware Specifications.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
21 months agoarm: mvebu: Define all BOOTROM_ERR_MODE_* macros
Pali Rohár [Wed, 29 Mar 2023 19:03:34 +0000 (21:03 +0200)]
arm: mvebu: Define all BOOTROM_ERR_MODE_* macros

A385 BootROM fills into bits [31:28] of register 0x182d0 tracing value,
which represents in which state BootROM currently is. BootROM fills one
of the possible values: 0x2 (CPU initialization), 0x3 (UART detection),
0x6 (UART booting), 0x8 (PCI Express booting), 0x9 (parallel or SPI NOR
booting), 0xA (parallel or SPI NAND booting), 0xB (SATA booting) and 0xE
(SD / eMMC booting).

Meaning of these values matches TRACE_* macros from Marvell soc_spec.h file:
https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/blob/u-boot-2013.01-armada-18.06/tools/marvell/doimage_mv/soc_spec.h

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
21 months agoarm: mvebu: Define all options for A38x BOOT_FROM_* macros
Pali Rohár [Wed, 29 Mar 2023 19:03:33 +0000 (21:03 +0200)]
arm: mvebu: Define all options for A38x BOOT_FROM_* macros

Disassembling A385 BootROM binary reveal how BootROM interprets strapping
pins for Boot Device Mode. All possible options are:

0x00..0x07 -> Parallel NOR
0x08..0x15 -> Parallel NAND
0x16..0x17 -> Parallel NOR
0x18..0x25 -> Parallel NAND
0x26..0x27 -> SPI NAND
0x28..0x29 -> UART xmodem
0x2a..0x2b -> SATA
0x2c..0x2d -> PCI Express
0x2e..0x2f -> Parallel NOR
0x30..0x31 -> SD / eMMC
0x32..0x39 -> SPI NOR
0x3a..0x3c -> Parallel NOR
0x3d..0x3e -> UART debug console
0x3f       -> Invalid

Note that Boot Device Mode Options in A38x Hardware Specifications is
incomplete.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
21 months agoarm: mvebu: Convert BOOT_FROM_* constants to function macros
Pali Rohár [Wed, 29 Mar 2023 19:03:32 +0000 (21:03 +0200)]
arm: mvebu: Convert BOOT_FROM_* constants to function macros

This allows to merge BOOT_FROM_MMC and BOOT_FROM_MMC_ALT constants to one
macro. And also allows to extend other BOOT_FROM_* macros for other
variants.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
21 months agoarm: mvebu: Remove A38x BOOT_FROM_SATA 0x22 constant
Pali Rohár [Wed, 29 Mar 2023 19:03:31 +0000 (21:03 +0200)]
arm: mvebu: Remove A38x BOOT_FROM_SATA 0x22 constant

A385 BootROM treats strapping configuration 0x22 as SPI-NAND. So remove
incorrect definition 0x22 as SATA. SATA on A385 has configuration 0x2A.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
21 months agoarm: mvebu: Remove A38x BOOT_FROM_UART_ALT 0x3f constant
Pali Rohár [Wed, 29 Mar 2023 19:03:30 +0000 (21:03 +0200)]
arm: mvebu: Remove A38x BOOT_FROM_UART_ALT 0x3f constant

A385 BootROM treats strapping configuration 0x3f as invalid. When booting
fails (e.g. because of invalid configuration) then BootROM fallbacks to
UART booting.

Detecting BootROM fallback to UART booting is implemented in U-Boot since
commit 2fd4284051e3 ("ARM: mach-mvebu: handle fall-back to UART boot").

So there is no need to define BOOT_FROM_UART_ALT constant and special
handling for it anymore, remove it.

This change effectively revers commit f3a88e2ca17a ("arm: mvebu: fix boot
from UART on ClearFog Base").

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>