platform/kernel/u-boot.git
5 years agoARM: imx: apalis_imx6: Drop ad-hoc SATA binding
Marek Vasut [Sun, 12 May 2019 20:43:25 +0000 (22:43 +0200)]
ARM: imx: apalis_imx6: Drop ad-hoc SATA binding

Drop the ad-hoc AHCI binding code, this is superseded by
CONFIG_DWC_AHSATA_AHCI=y resp. drivers/ata/dwc_ahsata.c

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Max Krummenacher <max.krummenacher@toradex.com>
Cc: Stefan Agner <stefan.agner@toradex.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
5 years agoregulator: bd71837: copy the bd71837 pmic driver from NXP imx u-boot
Matti Vaittinen [Tue, 7 May 2019 07:43:39 +0000 (10:43 +0300)]
regulator: bd71837: copy the bd71837 pmic driver from NXP imx u-boot

https://source.codeaurora.org/external/imx/uboot-imx

cherry picked, styled and merged commits:
- MLK-18387 pmic: Add pmic driver for BD71837: e9a3bec2e95a
- MLK-18590 pmic: bd71837: Change to use new fdt API: acdc5c297a96

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agocolibri_imx7: migrate usb to driver model
Igor Opaniuk [Fri, 10 May 2019 09:35:29 +0000 (12:35 +0300)]
colibri_imx7: migrate usb to driver model

Migrate USB to Driver Model (CONFIG_DM_USB=y).

Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
5 years agoconfigs: imx6-engicam: Update the recoveryboot setting
Jagan Teki [Fri, 26 Apr 2019 09:01:46 +0000 (14:31 +0530)]
configs: imx6-engicam: Update the recoveryboot setting

Since recovery boot on mmc can get the mmcpart and mmcroot
dynamically, drop the static definitions and handle it
properly.

Tested-by: Shyam Saini <shyam.saini@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agotoradex apalis/colibri: extend CONFIG_SYS_MALLOC_F_LEN
Igor Opaniuk [Fri, 17 May 2019 14:48:43 +0000 (17:48 +0300)]
toradex apalis/colibri: extend CONFIG_SYS_MALLOC_F_LEN

Extend size of the malloc() pool for use before relocation, from 0x400
(default one) to 0x2000 (CONFIG_SYS_MALLOC_F_LEN=0x2000),
as adding of DM_FLAG_PRE_RELOC flag to simple-bus driver introduced a
regression on multiple boards, because of more intensive usage of malloc()
pool and therefore a broken boot as the size of pool isn't sufficient.

Fixes: 3a7c45f6a7 ("simple-bus: add DM_FLAG_PRE_RELOC flag to simple-bus")
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agoapalis_imx6: add device tree to makefile
Marcel Ziswiler [Tue, 9 Apr 2019 15:21:48 +0000 (17:21 +0200)]
apalis_imx6: add device tree to makefile

Add device tree to Makefile to avoid newly introduced error:

Device Tree Source is not correctly specified.
Please define 'CONFIG_DEFAULT_DEVICE_TREE'
or build with 'DEVICE_TREE=<device_tree>' argument

make[1]: *** [dts/Makefile:28: arch/arm/dts/imx6-apalis.dtb] Error 1
make: *** [Makefile:1009: dts/dt.dtb] Error 2

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
5 years agoapalis/colibri imx6: provide proper fdtfile value
Igor Opaniuk [Thu, 23 May 2019 11:05:50 +0000 (11:05 +0000)]
apalis/colibri imx6: provide proper fdtfile value

Provide proper fdtfile env variable value before invoking distro_bootcmd
command.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
5 years agoARM: dts: i.MX6ULL: U-Boot specific dts for u-boot, dm-spl
Parthiban Nallathambi [Sun, 7 Apr 2019 18:32:42 +0000 (20:32 +0200)]
ARM: dts: i.MX6ULL: U-Boot specific dts for u-boot, dm-spl

u-boot,dm-spl property is specific to U-Boot, so created one
for i.MX6ULL platforms.

Signed-off-by: Parthiban Nallathambi <parthitce@gmail.com>
5 years agopower: pfuze100: Fix off by one error in voltage table handling
Trent Piepho [Thu, 4 Apr 2019 21:52:04 +0000 (21:52 +0000)]
power: pfuze100: Fix off by one error in voltage table handling

The code that sets a regulator by looking up the voltage in a table had
an off by one error.  vsel_mask is a bitmask, not the number of table
entries, so a vsel_mask value of 0x7 indicates there are 8, not 7,
entries in the table.

Cc: Peng Fan <Peng.Fan@freescale.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
5 years agomx7ulp: Add common plugin codes for mx7ulp
Ye Li [Thu, 16 May 2019 03:18:51 +0000 (03:18 +0000)]
mx7ulp: Add common plugin codes for mx7ulp

Add common plugin codes to call ROM's hwcnfg_setup and generate IVT2
header.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoboard: toradex: add colibri imx8qxp 2gb wb it v1.0b module support
Marcel Ziswiler [Fri, 31 May 2019 15:56:39 +0000 (18:56 +0300)]
board: toradex: add colibri imx8qxp 2gb wb it v1.0b module support

This commit adds initial support for the Toradex Colibri iMX8QXP 2GB WB
IT V1.0B module. Unlike the V1.0A early access samples exclusively
booting from SD card, they are now strapped to boot from eFuses which
are factory fused to properly boot from their on-module eMMC. U-Boot
supports either booting from the on-module eMMC or may be used for
recovery purpose using the universal update utility (uuu) aka mfgtools
3.0.

Functionality wise the following is known to be working:
- eMMC and MMC/SD card
- Ethernet
- GPIOs
- I2C

Unfortunately, there is no USB functionality for the i.MX 8QXP as of
yet.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
5 years agoimx: fix building for i.mx8 without spl
Marcel Ziswiler [Fri, 31 May 2019 15:56:38 +0000 (18:56 +0300)]
imx: fix building for i.mx8 without spl

Building with Travis CI complained and stopped with the following error:
+cc1: fatal error: opening output file spl/u-boot-spl.cfgout: No such
file or directory
+compilation terminated.

This fixes commit caceb739ea07 ("imx: build flash.bin for i.MX8") which
took SPL being enabled on i.MX8 for granted.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
5 years agoARM: imx6logic: Stop overwriting fdt_file if manually set
Adam Ford [Wed, 13 Mar 2019 15:49:22 +0000 (10:49 -0500)]
ARM: imx6logic: Stop overwriting fdt_file if manually set

The board file uses the processor type to determine what dtb file
is set.  Unfortunately, if the user wants to manually set this,
it get gets overwritten upon boot.  This patch adds a check to
see if the value is already set and only changes it if the value
is empty.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoPrepare v2019.07-rc4 v2019.07-rc4
Tom Rini [Tue, 11 Jun 2019 01:27:46 +0000 (21:27 -0400)]
Prepare v2019.07-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agoefi_loader: implement event queue
Heinrich Schuchardt [Wed, 5 Jun 2019 19:00:39 +0000 (21:00 +0200)]
efi_loader: implement event queue

Up to now we have only been using a flag queued for events. But this does
not satisfy the requirements of the UEFI spec. Events must be notified in
the sequence of decreasing TPL level and within a TPL level in the sequence
of signaling.

Implement a queue for signaled events.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_selftest: correct event group test
Heinrich Schuchardt [Wed, 5 Jun 2019 20:50:42 +0000 (22:50 +0200)]
efi_selftest: correct event group test

If any member of the event group is signaled, all members must be set to
signaled and their notification functions have to be queued.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: event signaling in ExitBootServices
Heinrich Schuchardt [Fri, 7 Jun 2019 04:47:01 +0000 (06:47 +0200)]
efi_loader: event signaling in ExitBootServices

ExitBootServices() has to stop timer related activity before calling the
events of the EFI_EVENT_GROUP_EXIT_BOOT_SERVICES event group. But our
current implementation was stopping all other events.

All events have to observe the task priority level.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: SignalEvent for event in signaled state
Heinrich Schuchardt [Wed, 5 Jun 2019 23:51:50 +0000 (01:51 +0200)]
efi_loader: SignalEvent for event in signaled state

If an event is already in the signaled state, SignalEvent should not queue
the notification function but simply return EFI_SUCCESS.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: RegisterProtocolNotify event signaling
Heinrich Schuchardt [Fri, 7 Jun 2019 05:43:24 +0000 (07:43 +0200)]
efi_loader: RegisterProtocolNotify event signaling

In a following patch efi_signal_event() will only queue an event if it is
not signaled.

Set the is_signaled status to false before signaling the event.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoMerge branch 'master' of git://git.denx.de/u-boot-spi
Tom Rini [Mon, 10 Jun 2019 13:43:11 +0000 (09:43 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-spi

- mpc8xxx spi driver fixes (Mario)
- mpc8xxx spi dm conversion (Mario, Jagan)
- SPI DM Migration update (Jagan)

5 years agoMerge tag 'video-updates-for-2019.07-rc3' of git://git.denx.de/u-boot-video
Tom Rini [Mon, 10 Jun 2019 13:41:19 +0000 (09:41 -0400)]
Merge tag 'video-updates-for-2019.07-rc3' of git://git.denx.de/u-boot-video

- mxsfb DM_VIDEO conversion
- splash fix for DM_VIDEO configurations
- meson HDMI fix for boards without hdmi-supply regulator

5 years agoMerge tag 'u-boot-atmel-fixes-2019.07-a' of git://git.denx.de/u-boot-atmel
Tom Rini [Mon, 10 Jun 2019 13:41:00 +0000 (09:41 -0400)]
Merge tag 'u-boot-atmel-fixes-2019.07-a' of git://git.denx.de/u-boot-atmel

First set of u-boot-atmel fixes for 2019.07 cycle

5 years agodm: MIGRATION: Update migration status for SPI
Jagan Teki [Sun, 28 Apr 2019 20:28:54 +0000 (01:58 +0530)]
dm: MIGRATION: Update migration status for SPI

Now, we have few driver are fully converted into dm and few
are partially converted.

So, update the migration status accordingly.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Convert to DM
Jagan Teki [Sun, 28 Apr 2019 20:28:53 +0000 (01:58 +0530)]
spi: mpc8xxx: Convert to DM

Support DM in the MPC8xxx SPI driver, and remove the legacy SPI
interface.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Use get_timer
Mario Six [Sun, 28 Apr 2019 20:28:52 +0000 (01:58 +0530)]
spi: mpc8xxx: Use get_timer

The comment before the transmission loop in conjunction with the
definition of SPI_TIMEOUT as 1000 implies that the loop is supposed to
have a timeout value of 1000 ms. But since there is no mdelay(1) or
similar in the loop body, the loop just runs 1000 times, without regard
for the time elapsed.

To correct this, use the standard get_timer functionality to properly
time out the loop after 1000 ms.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Fix if check
Mario Six [Sun, 28 Apr 2019 20:28:51 +0000 (01:58 +0530)]
spi: mpc8xxx: Fix if check

Decreasing the bit length and increasing the write data pointer should
be done when there are more than 32 bit of data, not 16 bit.

This did not produce incorrect behavior, because the only time where the
two checks produce different outcomes is the case of 16 < bitlen < 32,
and in this case the subsequent transmission is the last one regardless,
hence the additional bit length decrease and write data pointer increase
has no effect anyway.

Still, the correct check is the check for "bitlen > 32", so correct this
behavior.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Re-order transfer setup
Mario Six [Sun, 28 Apr 2019 20:28:50 +0000 (01:58 +0530)]
spi: mpc8xxx: Re-order transfer setup

Minize the time the adapter is disabled (via SPI_MODE_EN
clearing/setting) to just the character length setting, and only set up
the temporary data writing variable right before we need it, so there is
a more clear distinction between setting up the SPI adapter, and setting
up the data to be written.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Document LEN setting better
Mario Six [Sun, 28 Apr 2019 20:28:49 +0000 (01:58 +0530)]
spi: mpc8xxx: Document LEN setting better

Instead of having a table right before the code implementing the length
setting for documentation, have inline comments for the if branches
actually implementing the length setting described table's entries
(which is readable thanks to the set_char_len function).

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Rename variable
Mario Six [Sun, 28 Apr 2019 20:28:48 +0000 (01:58 +0530)]
spi: mpc8xxx: Rename variable

The variable "char_size" holds the number of bits to be transferred in
the current loop iteration. A better name would be "xfer_bitlen", which
we rename this variable to.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Make code more readable
Mario Six [Sun, 28 Apr 2019 20:28:47 +0000 (01:58 +0530)]
spi: mpc8xxx: Make code more readable

Introduce the to_prescale_mod and set_char_len inline functions to make
the code more readable.

Note that the added "if (bitlen > 16)" check does not change the
semantics of the current code, and hence only preserves the current
error (this will be fixed in a later patch in the series).

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Reduce scope of loop variables
Mario Six [Sun, 28 Apr 2019 20:28:46 +0000 (01:58 +0530)]
spi: mpc8xxx: Reduce scope of loop variables

The transmission loop starts with setting some variables, which are only
used inside the loop. Reduce the scope to the loop to make the
declaration and initialization of these variables coincide.

In the case of char_size this also always initializes the variable
immediately with the final value actually used in the loop (instead of
the placeholder value 32).

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Simplify logic a bit
Mario Six [Sun, 28 Apr 2019 20:28:45 +0000 (01:58 +0530)]
spi: mpc8xxx: Simplify logic a bit

We do nothing in the loop if the "not empty" event was not detected. To
simplify the logic, check if this is the case, and skip the execution of
the loop early to reduce the nesting level and flag checking.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Get rid of is_read
Mario Six [Sun, 28 Apr 2019 20:28:44 +0000 (01:58 +0530)]
spi: mpc8xxx: Get rid of is_read

Get rid of the is_read variable, and just keep the state of the "not
empty" and "not full" events in two boolean variables within the loop
body.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Simplify if
Mario Six [Sun, 28 Apr 2019 20:28:43 +0000 (01:58 +0530)]
spi: mpc8xxx: Simplify if

Instead of having a nested if block, just have two branches within the
overarching if block to eliminate one nesting level.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Use IO accessors
Mario Six [Sun, 28 Apr 2019 20:28:42 +0000 (01:58 +0530)]
spi: mpc8xxx: Use IO accessors

Accesses to the register map are currently done by directly reading and
writing the structure.

Switch to the appropriate IO accessors instead.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Replace defines with enums
Mario Six [Sun, 28 Apr 2019 20:28:41 +0000 (01:58 +0530)]
spi: mpc8xxx: Replace defines with enums

Replace pre-processor defines with proper enums, and use the BIT macro
where applicable.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Fix function names in strings
Mario Six [Sun, 28 Apr 2019 20:28:40 +0000 (01:58 +0530)]
spi: mpc8xxx: Fix function names in strings

Replace the function name with a "%s" format string and the __func__
variable in debug statements (as proposed by checkpatch).

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Fix space after cast
Mario Six [Sun, 28 Apr 2019 20:28:39 +0000 (01:58 +0530)]
spi: mpc8xxx: Fix space after cast

Fix all "superfluous space after case" style errors.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Rename camel-case variables
Mario Six [Sun, 28 Apr 2019 20:28:38 +0000 (01:58 +0530)]
spi: mpc8xxx: Rename camel-case variables

There are three variables that have camel-case names, which is not the
preferred naming style.

Give those variables more compliant names instead.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Fix comments
Mario Six [Sun, 28 Apr 2019 20:28:37 +0000 (01:58 +0530)]
spi: mpc8xxx: Fix comments

There are some comments on the same line as the code they document. Put
comments above the code lines they document, so the line length is not
unnecessarily increased.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: mpc8xxx: Use short type names
Mario Six [Sun, 28 Apr 2019 20:28:36 +0000 (01:58 +0530)]
spi: mpc8xxx: Use short type names

The function signatures in the driver are quite long as is. Use short
type names (uint etc.) to make them more readable.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agoids8313: Disable SPI
Mario Six [Fri, 7 Jun 2019 09:35:51 +0000 (11:35 +0200)]
ids8313: Disable SPI

With the recent SPI changes, the ids8313 board won't compile anymore.

Until further information from the manufacturer, disable SPI support, so
that the board will at least compile again.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agoMerge branch 'master' of git://git.denx.de/u-boot-tegra
Tom Rini [Sat, 8 Jun 2019 13:10:31 +0000 (09:10 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-tegra

The bulk of these changes are an effort to unify Tegra186 builds with
builds of prior 64-bit Tegra generations. On top of that there are
various improvements that allow data (such as the MAC address and boot
arguments) to be passed through from early firmware to the kernel on
boot.

5 years agospl: Correct SPL_SIZE_LIMIT Kconfig option
Tom Rini [Sat, 8 Jun 2019 00:39:32 +0000 (20:39 -0400)]
spl: Correct SPL_SIZE_LIMIT Kconfig option

When introduced this limit was an int but was then changed to hex
without noting as much in the prompt nor changing existing users.  Put
this back to an int.

Reported-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
Fixes: 2577015dc5c4 ("spl: add overall SPL size check")
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agoMerge branch '2019-06-07-master-imports'
Tom Rini [Fri, 7 Jun 2019 22:03:18 +0000 (18:03 -0400)]
Merge branch '2019-06-07-master-imports'

- Include Heinrich's series to move the i.MX board size check function
  to be more widely available.
- Include Simon Goldschmidt's patch to make it possible to have a more
  accurate SPL size check applied.

5 years agospl: add overall SPL size check
Simon Goldschmidt [Fri, 24 May 2019 20:07:04 +0000 (22:07 +0200)]
spl: add overall SPL size check

This adds a size check for SPL that can dynamically check generated
SPL binaries (including devicetree) for a size limit that ensures
this image plus global data, heap and stack fit in initial SRAM.

Since some of these sizes are not available to make, a new host tool
'spl_size_limit' is added that dumps the resulting maximum size for
an SPL binary to stdout. This tool is used in toplevel Makefile to
implement the size check on SPL binaries.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
5 years agoconfigs: rk3288: Tinker Board SPL file must fit into 32 KiB
Heinrich Schuchardt [Tue, 2 Apr 2019 17:19:07 +0000 (19:19 +0200)]
configs: rk3288: Tinker Board SPL file must fit into 32 KiB

The SPL image for the Tinker Board has to fit into 32 KiB. This includes
up to 2 KiB for the file header.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoconfigs: define CONFIG_SPL_SIZE_LIMIT
Heinrich Schuchardt [Tue, 2 Apr 2019 17:19:06 +0000 (19:19 +0200)]
configs: define CONFIG_SPL_SIZE_LIMIT

A new configuration variable CONFIG_SPL_SIZE_LIMIT is introduced to define
the board specific maximum size for the SPL file.

Use Makefile function size_check() to implement the test.

Depending on the size of CONFIG_SPL_SIZE_LIMIT an error like the following
is thrown:

spl/u-boot-spl.bin exceeds file size limit:
  limit:  30720 bytes
  actual: 33426 bytes
  excess: 2706 bytes
make: *** [Makefile:1663: spl/u-boot-spl.bin] Error 1

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoimx: move BOARD_SIZE_CHECK to main Makefile
Heinrich Schuchardt [Tue, 2 Apr 2019 17:19:05 +0000 (19:19 +0200)]
imx: move BOARD_SIZE_CHECK to main Makefile

We currently have duplicate definitions for BOARD_SIZE_CHECK in Makefile
and arch/arm/mach-imx/Makefile.

Move the board size check from arch/arm/mach-imx/Makefile to Makefile.

Depending on the value of CONFIG_BOARD_SIZE_LIMIT an error like an error
like the following is thrown:

u-boot-dtb.imx exceeds file size limit:
  limit:  503696 bytes
  actual: 509720 bytes
  excess: 6024 bytes
make: *** [Makefile:1051: u-boot-dtb.imx] Error 1

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
5 years agoMakefile: reusable function for BOARD_SIZE_CHECK
Heinrich Schuchardt [Tue, 2 Apr 2019 17:19:04 +0000 (19:19 +0200)]
Makefile: reusable function for BOARD_SIZE_CHECK

Carve out function size_check from macro BOARD_SIZE_CHECK. This will allow
us to reuse the function for other file size checks.

Depending on the value of CONFIG_BOARD_SIZE_LIMIT an error like the
following is thrown:

u-boot-dtb.img exceeds file size limit:
  limit:  409516 bytes
  actual: 444346 bytes
  excess: 34830 bytes
make: *** [Makefile:1212: u-boot-dtb.img] Error 1

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agolib/vsprintf: allow printing upper case GUIDs
Heinrich Schuchardt [Mon, 29 Apr 2019 06:08:43 +0000 (08:08 +0200)]
lib/vsprintf: allow printing upper case GUIDs

In the UEFI context GUIDs are expected to be rendered in upper case.

The patch uses the formerly unused bit 1 of the parameter str_format
of function uuid_bin_to_str() to indicate if we need upper or lower case
output.

Function uuid_string() in vsprint.c is adjusted to correctly set the bit
depending on the print format code.

%pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
%pUB: 01020304-0506-0708-090A-0B0C0D0E0F10
%pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
%pUL: 04030201-0605-0807-090A-0B0C0D0E0F10

Up to this point only a diagnostic message in mount_ubifs() using '%pUB' is
concerned by the change. Further patches are needed to adjust the UEFI
subsystem.

A unit test is provided inside the ut_print command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoconfigs: stm32mp15: Enable Ethernet feature
Christophe Roullier [Fri, 17 May 2019 13:08:47 +0000 (15:08 +0200)]
configs: stm32mp15: Enable Ethernet feature

This allows to enable Ethernet and use driver for
Synopsys Ethernet QoS device

Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agostm32mp1: Add Ethernet support for stm32mp1 board
Christophe Roullier [Fri, 17 May 2019 13:08:46 +0000 (15:08 +0200)]
stm32mp1: Add Ethernet support for stm32mp1 board

Add default SERVERIP address
Enable noncached memory region required by ethernet driver
Add PXE support

Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
5 years agoARM: dts: stm32: Add Ethernet support on stm32mp1
Christophe Roullier [Fri, 17 May 2019 13:08:45 +0000 (15:08 +0200)]
ARM: dts: stm32: Add Ethernet support on stm32mp1

This patch add Ethernet support on stm32mp157 eval board

Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
5 years agonet: dwc_eth_qos: add Ethernet stm32mp1 support
Christophe Roullier [Fri, 17 May 2019 13:08:44 +0000 (15:08 +0200)]
net: dwc_eth_qos: add Ethernet stm32mp1 support

Synopsys GMAC 4.20 is used. And Phy mode for eval and disco is RMII
with PHY Realtek RTL8211 (RGMII)
We also support some other PHY config on stm32mp157c
PHY_MODE (MII,GMII, RMII, RGMII) and in normal,
PHY wo crystal (25Mhz and 50Mhz), No 125Mhz from PHY config

Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoboard: stm32mp1: Add board_interface_eth_init
Christophe Roullier [Fri, 17 May 2019 13:08:43 +0000 (15:08 +0200)]
board: stm32mp1: Add board_interface_eth_init

Called to configure Ethernet PHY interface selection and
configure clock selection in RCC Ethernet clock tree.

Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
5 years agostm32mp1: clk: use the correct identifier for ethck
Patrick Delaunay [Fri, 17 May 2019 13:08:42 +0000 (15:08 +0200)]
stm32mp1: clk: use the correct identifier for ethck

ETHCK_K is the identifier the kernel clock for ETH in kernel
binding, selected by ETHKSELR / gated by ETHCKEN = BIT(7).
U-Boot driver need to use the same identifier, so change ETHCK
to ETHCK_K.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
5 years agoconfigs: stm32mp15: Enable SPI relative flags
Patrice Chotard [Mon, 13 May 2019 09:02:08 +0000 (11:02 +0200)]
configs: stm32mp15: Enable SPI relative flags

Enable STM32_SPI, SPI, DM_SPI and CMD_SPI flags.
This enables the SPI support for STM32MP15.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agospi: stm32: Add Serial Peripheral Interface driver for STM32MP
Patrice Chotard [Tue, 30 Apr 2019 16:08:28 +0000 (18:08 +0200)]
spi: stm32: Add Serial Peripheral Interface driver for STM32MP

Add SPI driver support for STM32MP SoCs family.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoclk: stm32mp1: Add SPI1 clock entry
Patrice Chotard [Tue, 30 Apr 2019 16:08:27 +0000 (18:08 +0200)]
clk: stm32mp1: Add SPI1 clock entry

Add missing SPI1 clock needed by SPI1 instance.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoboard: stm32mp1: Update power supply check via USB TYPE-C
Patrice Chotard [Tue, 30 Apr 2019 16:09:38 +0000 (18:09 +0200)]
board: stm32mp1: Update power supply check via USB TYPE-C

Add 2 new checks:
 - detect when USB TYPE-C cable is not plugged correctly.
   In this case, GND and VBUS pins are connected but not CC1
   and CC2 pins.

 - detect is an USB Type-C charger supplies more than 3 Amps
   which is not compliant with the USB Type-C specification

In these 2 situations, stop the boot process and let red led
blinks forever.

   V cc1      |   V cc2     | power supply | red led | console message
range (Volts) |range (Volts)|   (Amps)     | blinks  |
--------------|-------------|--------------|---------|-----------------------------------
    > 2.15    |   < 0.2     |     > 3      | for ever| USB TYPE-C charger not compliant with specification
[2.15 - 1.23[ |   < 0.2     |     3        |   NO    | NO
[1.23 - 0.66[ |   < 0.2     |     1.5      | 3 times | WARNING 1.5A power supply detected
[0.66 - 0]    |   < 0.2     |     0.5      | 2 times | WARNING 500mA power supply detected
    < 0.2     |   < 0.2     |              | for ever| ERROR USB TYPE-C connection in unattached mode
    > 0.2     |   > 0.2     |              | for ever| ERROR USB TYPE-C connection in unattached mode

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoconfigs: stm32mp15: Enable WDT flags
Patrice Chotard [Tue, 30 Apr 2019 15:26:23 +0000 (17:26 +0200)]
configs: stm32mp15: Enable WDT flags

This allows to enable WATCHDOG and WDT flags to
be able to reset the watchdog and to support watchdog driver
model.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agowatchdog: stm32mp: Add watchdog driver
Patrice Chotard [Tue, 30 Apr 2019 15:26:22 +0000 (17:26 +0200)]
watchdog: stm32mp: Add watchdog driver

This patch adds IWDG (Independent WatchDoG) support for
STM32MP platform.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Stefan Roese <sr@denx.de>
5 years agoARM: dts: stm32mp: Add iwdg2 support for stm32mp157c
Patrice Chotard [Tue, 30 Apr 2019 15:26:21 +0000 (17:26 +0200)]
ARM: dts: stm32mp: Add iwdg2 support for stm32mp157c

This patch adds independent watchdog support for stm32mp157c
in SPL.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agowatchdog: Kconfig: Sort entry alphabetically
Patrice Chotard [Tue, 30 Apr 2019 15:26:20 +0000 (17:26 +0200)]
watchdog: Kconfig: Sort entry alphabetically

To make adding new entry easier, sort Kconfig entries in
alphabetical order.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Stefan Roese <sr@denx.de>
5 years agostm32mp1: Update env_get_location for NOR support
Patrice Chotard [Thu, 9 May 2019 12:25:36 +0000 (14:25 +0200)]
stm32mp1: Update env_get_location for NOR support

Update env_get_location() to be able to save environment into
NOR (SPI_FLASH).

Series-cc: pde, cke, pch, uboot-stm32

Cover-letter:
Add saveenv support for STM32MP1

This series adds saveenv support for STM32MP1 on several boot
devices. STM32MP1 is able to boot on eMMC, sdcard and NOR
(NAND support is not fully supported).

On eMMC and sdcard, environment is saved in EXT4 partition
On NOR, environment is saved in a dedicated partition
On NAND, environment is saved in a UBI volume.

This series:
  - enables NAND and NOR support on ev1 board
  - enables ENV_IS_IN_SPI_FLASH, ENV_IS_IN_UBI, ENV_IS_IN_EXT4
    flags
  - fixes get_mtdparts()
  - allows to override interface, device and partition for ext4
    environment
  - updates rule to set ENV_IS_NOWHERE value
  - introduce ENV_IS_IN_DEVICE
END

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoconfigs: stm32mp15: Enable ENV_IS_SPI_FLASH
Patrice Chotard [Thu, 24 Jan 2019 10:33:29 +0000 (11:33 +0100)]
configs: stm32mp15: Enable ENV_IS_SPI_FLASH

Add all relative flags needed by ENV_IS_IN_SPI_FLASH

Reserved a 256KB partition in NOR to save the U-Boot
environment.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoconfigs: stm32mp15: Enable ENV_IS_IN_UBI
Patrice Chotard [Tue, 7 May 2019 16:39:22 +0000 (18:39 +0200)]
configs: stm32mp15: Enable ENV_IS_IN_UBI

Add all relative flags needed by ENV_IS_IN_UBI

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agostm32mp1: Increase ENV_SIZE
Patrice Chotard [Tue, 7 May 2019 16:40:47 +0000 (18:40 +0200)]
stm32mp1: Increase ENV_SIZE

Increase ENV_SIZE from 4 to 8 Ko

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agomtd: Fix get_mtdparts()
Patrice Chotard [Wed, 23 Jan 2019 17:12:48 +0000 (18:12 +0100)]
mtd: Fix get_mtdparts()

When ENV_IS_IN_UBI is enable, get_mtdparts is called before relocation.

During first get_mtdparts() call, mtdparts is not available in environment,
it can be retrieved by calling board_mtdparts_default(), but following
env_set() do nothing as we are before relocation. Finally mtdparts is
still not available in environment.

At second get_mtdparts() call, use_defaults is false, but mtdparts is still
not in environment and is NULL.

Remove use_defaults bool, only mtdparts criteria is useful.

Fixes: commit 5ffcd50612f6 ("mtd: Use default mtdparts/mtids when not defined
in the environment")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agostm32mp1: Add env_get_location()
Patrice Chotard [Thu, 2 May 2019 16:28:05 +0000 (18:28 +0200)]
stm32mp1: Add env_get_location()

In case of several environment location support, env_get_location
is needed to select the correct location depending of the boot
device .

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoconfigs: stm32mp15: Enable ENV_IS_IN_EXT4 and all relative flags
Patrick Delaunay [Fri, 15 Feb 2019 17:04:08 +0000 (18:04 +0100)]
configs: stm32mp15: Enable ENV_IS_IN_EXT4 and all relative flags

Enable ENV_IS_IN_EXT4 and all relative flags to be able to
load/save environment in EXT4 partition.

This will allows to load/save environment on both sdcard and eMMC.
As for stm32mp15, bootfs has not the same partition number on sdcard
and on eMMC, we use "auto" key which allows to find the first
partition in device with bootable flag which is partition 4 on sdcard
and partition 2 on eMMC.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoenv: enable saveenv command when one CONFIG_ENV_IS_IN is activated
Patrick Delaunay [Mon, 18 Feb 2019 09:58:16 +0000 (10:58 +0100)]
env: enable saveenv command when one CONFIG_ENV_IS_IN is activated

Introduce ENV_IS_IN_DEVICE to test if one the
CONFIG_ENV_IS_IN_ is defined and support the command
saveenv even if CONFIG_ENV_IS_NOWHERE is activated

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
5 years agoenv: allow ENV_IS_NOWHERE with other storage target
Patrice Chotard [Tue, 7 May 2019 09:24:02 +0000 (11:24 +0200)]
env: allow ENV_IS_NOWHERE with other storage target

Allow U-Boot to get default environment for some boot mode
(USB for example), and to select storage location when it is
booting from flash device;
ENVL_NOWHERE is present in env_locations with other one.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
5 years agoboard: stm32mp1: Add env_ext4_get_dev_part() and env_ext4_get_intf()
Patrice Chotard [Thu, 2 May 2019 16:36:01 +0000 (18:36 +0200)]
board: stm32mp1: Add env_ext4_get_dev_part() and env_ext4_get_intf()

This allows to :
- select the current device to save the environment file
- select the correct EXT4 boot device instance
  and partition to save the environment file.

For EXT4, device is mmc, device instance is 0 for sdcard or 1 for eMMC.
The partition is set to "auto" to select the first partition with
bootable flag.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoenv: ext4: Allow overriding interface, device and partition
Patrice Chotard [Thu, 17 Jan 2019 13:45:26 +0000 (14:45 +0100)]
env: ext4: Allow overriding interface, device and partition

For platform which can boot on different device, this allows
to override interface, device and partition from board code.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agostm32mp1: support dynamic MTDPARTS
Patrice Chotard [Thu, 2 May 2019 16:07:14 +0000 (18:07 +0200)]
stm32mp1: support dynamic MTDPARTS

This patch configure the default value for mtdids and mtparts
dynamically according the presence of nor and nand in
the board device tree

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agostm32mp1: activate NAND and NOR support on EV1
Patrick Delaunay [Mon, 8 Apr 2019 13:30:52 +0000 (15:30 +0200)]
stm32mp1: activate NAND and NOR support on EV1

Add the necessary configuration to have NAND and NOR support on ev1 board
for BASIC boot (with SPL) or for TRUSTED boot (with TF-A).

STM32MP> nand info

Device 0: nand0, sector size 256 KiB
  Page size       4096 b
  OOB size         224 b
  Erase size    262144 b
  subpagesize     4096 b
  options     0x00184200
  bbt options 0x00060000

STM32MP> sf probe
SF: Detected mx66l51235l with page size 256 Bytes, erase size 64 KiB, total 64 MiB

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
5 years agoarm: mach-stm32mp: Add newline to the MAC error message
Manivannan Sadhasivam [Thu, 2 May 2019 07:56:45 +0000 (13:26 +0530)]
arm: mach-stm32mp: Add newline to the MAC error message

Without newline, the error message appears for non prgrammed OTP boards
looks messsy. Hence add it to look more clean.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoboard: stm32mp1: Add Avenger96 board support
Manivannan Sadhasivam [Thu, 2 May 2019 07:56:44 +0000 (13:26 +0530)]
board: stm32mp1: Add Avenger96 board support

Add support for Avenger96 board from Arrow Electronics based on STM32MP157
MPU. This board is one of the Consumer Edition (CE) boards of the 96Boards
family and has the following features:

SoC: STM32MP157AAC
PMIC: STPMIC1A
RAM: 1024 Mbyte @ 533MHz
Storage: eMMC v4.51: 8 Gbyte
         microSD Socket: UHS-1 v3.01
Ethernet Port: 10/100/1000 Mbit/s, IEEE 802.3 Compliant
Wireless: WiFi 5 GHz & 2.4GHz IEEE 802.11a/b/g/n/ac
          Bluetooth®v4.2 (BR/EDR/BLE)
USB: 2x Type A (USB 2.0) Host and 1x Micro B (USB 2.0) OTG
Display: HDMI: WXGA (1366x768)@ 60 fps, HDMI 1.4
LED: 4x User LED, 1x WiFi LED, 1x BT LED

More information about this board can be found in 96Boards website:
https://www.96boards.org/product/avenger96/

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoarm: dts: stm32mp157: Add missing pinctrl definitions
Manivannan Sadhasivam [Thu, 2 May 2019 07:56:43 +0000 (13:26 +0530)]
arm: dts: stm32mp157: Add missing pinctrl definitions

Add missing pinctrl definitions for STM32MP157.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoconfigs: at91: sama5d2_icp: enable CONFIG_SPL_AT91_MCK_BYPASS and resync
Eugen Hristev [Fri, 24 May 2019 06:40:08 +0000 (09:40 +0300)]
configs: at91: sama5d2_icp: enable CONFIG_SPL_AT91_MCK_BYPASS and resync

Enabled CONFIG_SPL_AT91_MCK_BYPASS and resync with savedefconfig

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agospl: at91: add support for SPL_AT91_MCK_BYPASS
Eugen Hristev [Fri, 24 May 2019 06:38:10 +0000 (09:38 +0300)]
spl: at91: add support for SPL_AT91_MCK_BYPASS

By default the configuration of the PMC is to have an external crystal
connected that requires driving on both XIN and XOUT pins.
The bypass configuration means that only XIN will be used, the SoC will not
do any driving, and the XIN needs to be provided with a proper signal.
This is the MOSCXTBY bit in the PMC main clock generator register.
The SPL needs to properly initialize the PMC registers before switching
to external clock signal and raising the clock to the cruise speed.

Also created Kconfig for this specific configuration.
By default this is disabled.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoMerge tag 'efi-2019-07-rc4-2' of git://git.denx.de/u-boot-efi
Tom Rini [Wed, 5 Jun 2019 19:53:18 +0000 (15:53 -0400)]
Merge tag 'efi-2019-07-rc4-2' of git://git.denx.de/u-boot-efi

Pull request for UEFI sub-system for v2019.07-rc4-2

Support for managing the non-volatile attribute of UEFI variables
is added though we do not have a backend for persistence yet.

Error messages for changes of UEFI variables are provided.

UEFI boottime service implementations are corrected.

5 years agoMerge branch '2019-06-05-master-imports'
Tom Rini [Wed, 5 Jun 2019 19:49:09 +0000 (15:49 -0400)]
Merge branch '2019-06-05-master-imports'

- More DaVinci fixes
- BuR platform fix

5 years agoARM: tegra: Mark built-in Ethernet as default on Jetson TX2
Thierry Reding [Mon, 15 Apr 2019 09:32:38 +0000 (11:32 +0200)]
ARM: tegra: Mark built-in Ethernet as default on Jetson TX2

Add an "ethernet" alias that points to the default network interface,
which is the built-in EQoS on Jetson TX2.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agoARM: tegra: Rename pcie-controller to pcie
Thierry Reding [Mon, 15 Apr 2019 09:32:37 +0000 (11:32 +0200)]
ARM: tegra: Rename pcie-controller to pcie

Recent versions of DTC have checks for PCI host bridge device tree nodes
that are named something other than "pci" or "pcie". Fix all occurrences
of such nodes for Tegra boards to avoid potential warnings from DTC.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agop2771-0000: Add support for framebuffer carveouts
Thierry Reding [Mon, 15 Apr 2019 09:32:36 +0000 (11:32 +0200)]
p2771-0000: Add support for framebuffer carveouts

If early firmware initialized the display hardware and the display
controllers are scanning out a framebuffer (e.g. a splash screen), make
sure to pass information about the memory location of that framebuffer
to the kernel before booting to avoid the kernel from using that memory
for the buddy allocator.

This same mechanism can also be used in the kernel to set up early SMMU
mappings and avoid SMMU faults caused by the display controller reading
from memory for which it has no mapping.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agop2371-2180: Add support for framebuffer carveouts
Thierry Reding [Mon, 15 Apr 2019 09:32:35 +0000 (11:32 +0200)]
p2371-2180: Add support for framebuffer carveouts

If early firmware initialized the display hardware and the display
controllers are scanning out a framebuffer (e.g. a splash screen), make
sure to pass information about the memory location of that framebuffer
to the kernel before booting to avoid the kernel from using that memory
for the buddy allocator.

This same mechanism can also be used in the kernel to set up early SMMU
mappings and avoid SMMU faults caused by the display controller reading
from memory for which it has no mapping.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agop2771-0000: Pass Ethernet MAC to the kernel
Thierry Reding [Mon, 15 Apr 2019 09:32:34 +0000 (11:32 +0200)]
p2771-0000: Pass Ethernet MAC to the kernel

Pass the ethernet MAC address to the kernel upon boot. This passes both
the local-mac-address property (as passed to U-Boot from cboot) and the
currently set MAC address via the mac-address property. The latter will
only be set if it is different from the address that was already passed
via the local-mac-address property.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agop2371-2180: Pass Ethernet MAC to the kernel
Thierry Reding [Mon, 15 Apr 2019 09:32:33 +0000 (11:32 +0200)]
p2371-2180: Pass Ethernet MAC to the kernel

Pass the ethernet MAC address to the kernel upon boot. This passes both
the local-mac-address property (as passed to U-Boot from cboot) and the
currently set MAC address via the mac-address property. The latter will
only be set if it is different from the address that was already passed
via the local-mac-address property.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agoARM: tegra: Enable position independent build for 64-bit
Thierry Reding [Mon, 15 Apr 2019 09:32:32 +0000 (11:32 +0200)]
ARM: tegra: Enable position independent build for 64-bit

Note that U-Boot is always chainloaded from cboot starting with L4T
release 28. cboot always loads U-Boot to a fixed address, so making
the builds position independent isn't strictly necessary. However,
position independent builds can be convenient because if U-Boot is
ever loaded to an address different from its link address, it will
still be able to boot.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agoARM: tegra: Import cbootargs value from cboot DTB
Thierry Reding [Mon, 15 Apr 2019 09:32:31 +0000 (11:32 +0200)]
ARM: tegra: Import cbootargs value from cboot DTB

Read the boot arguments passed by cboot via the /chosen/bootargs
property and store it in the cbootargs environment variable.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agoARM: tegra: Implement cboot_get_ethaddr()
Thierry Reding [Mon, 15 Apr 2019 09:32:30 +0000 (11:32 +0200)]
ARM: tegra: Implement cboot_get_ethaddr()

This function will attempt to look up an Ethernet address in the DTB
that was passed in from cboot. It does so by first trying to locate the
default Ethernet device for the board (identified by the "ethernet"
alias) and if found, reads the "local-mac-address" property. If the
"ethernet" alias does not exist, or if it points to a device tree node
that doesn't exist, or if the device tree node that it points to does
not have a "local-mac-address" property or if the value is invalid, it
will fall back to the legacy mechanism of looking for the MAC address
stored in the "nvidia,ethernet-mac" or "nvidia,ether-mac" properties of
the "/chosen" node.

The MAC address is then written to the default Ethernet device for the
board (again identified by the "ethernet" alias) in U-Boot's control
DTB. This allows the device driver for that device to read the MAC
address from the standard location in device tree.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agoARM: tegra: Implement cboot_save_boot_params() in C
Thierry Reding [Mon, 15 Apr 2019 09:32:29 +0000 (11:32 +0200)]
ARM: tegra: Implement cboot_save_boot_params() in C

This is easier to deal with and works just as well for this simple
function.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agoARM: tegra: Unify Tegra186 builds
Thierry Reding [Mon, 15 Apr 2019 09:32:28 +0000 (11:32 +0200)]
ARM: tegra: Unify Tegra186 builds

Tegra186 build are currently dealt with in very special ways, which is
because Tegra186 is fundamentally different in many respects. It is no
longer necessary to do many of the low-level programming because early
boot firmware will already have taken care of it.

Unfortunately, separating Tegra186 builds from the rest in this way
makes it difficult to share code with prior generations of Tegra. With
all of the low-level programming code behind Kconfig guards, the build
for Tegra186 can again be unified.

As a side-effect, and partial reason for this change, other Tegra SoC
generations can now make use of the code that deals with taking over a
boot from earlier bootloaders. This used to be nvtboot, but has been
replaced by cboot nowadays. Rename the files and functions related to
this to avoid confusion. The implemented protocols are unchanged.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agoARM: tegra: Restore DRAM bank count
Thierry Reding [Mon, 15 Apr 2019 09:32:27 +0000 (11:32 +0200)]
ARM: tegra: Restore DRAM bank count

Commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") reduced
the number of DRAM banks supported by U-Boot from 1026 to 8 on P2771-000
boards.

However, as explained in commit a9819b9e33bd ("ARM: tegra: p2771-000:
increase max DRAM bank count"), the platform can have a large number of
unusable chunks of memory (up to 1024), so a total of 1026 DRAM banks
are needed to describe the worst-case situation.

In practice the number of DRAM banks needed will typically be much
lower, but we should be prepared to properly deal with the worst case.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agoARM: tegra: Workaround UDC boot issues only if necessary
Thierry Reding [Mon, 15 Apr 2019 09:32:26 +0000 (11:32 +0200)]
ARM: tegra: Workaround UDC boot issues only if necessary

Resetting the USB device controller on boot is only necessary if the SoC
actually has a UDC controller and U-Boot enables support for it. All the
Tegra boards support UDC via the ChipIdea UDC driver, so make the UDC on
boot workaround depend on the ChipIdea UDC driver.

This prevents a crash on Tegra186 which does not have the ChipIdea UDC.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agoARM: tegra: Support TZ-only access to PMC
Thierry Reding [Mon, 15 Apr 2019 09:32:25 +0000 (11:32 +0200)]
ARM: tegra: Support TZ-only access to PMC

Some devices may restrict access to the PMC to TrustZone software only.
Non-TZ software can detect this and use SMC calls to the firmware that
runs in the TrustZone to perform accesses to PMC registers.

Note that this also fixes reset_cpu() and the enterrcm command on
Tegra186 where they were previously trying to access the PMC at a wrong
physical address.

Based on work by Kalyani Chidambaram <kalyanic@nvidia.com> and Tom
Warren <twarren@nvidia.com>.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
5 years agoARM: tegra: Allow boards to override boot target devices
Thierry Reding [Mon, 15 Apr 2019 09:32:24 +0000 (11:32 +0200)]
ARM: tegra: Allow boards to override boot target devices

Boards may not support all the boot target devices in the default list
for Tegra devices. Allow a board to override the list and default to the
standard list only if the board hasn't specified one itself.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>