oweals/u-boot.git
4 years agoi2c: designware_i2c: Do more in the probe() method
Simon Glass [Thu, 23 Jan 2020 18:48:26 +0000 (11:48 -0700)]
i2c: designware_i2c: Do more in the probe() method

Move some of the code currently in the ofdata_to_platdata() method to
probe() so that it is not executed when generating ACPI tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoi2c: designware_i2c: Separate out the speed calculation
Simon Glass [Thu, 23 Jan 2020 18:48:25 +0000 (11:48 -0700)]
i2c: designware_i2c: Separate out the speed calculation

We want to be able to calculate the speed separately from actually setting
the speed, so we can generate the required ACPI tables. Split out the
calculation into its own function.

Drop the double underscore on __dw_i2c_set_bus_speed while we are here.
That is reserved for compiler internals.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoi2c: designware_i2c: Move dw_i2c_speed_config to header
Simon Glass [Thu, 23 Jan 2020 18:48:24 +0000 (11:48 -0700)]
i2c: designware_i2c: Move dw_i2c_speed_config to header

This is used to store the speed information for a bus. We want to provide
this to ACPI so that it can tell the kernel. Move this struct to the
header file so it can be accessed by the ACPI i2c implementation being
added later.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoi2c: designware_i2c: Add support for fast-plus speed
Simon Glass [Thu, 23 Jan 2020 18:48:23 +0000 (11:48 -0700)]
i2c: designware_i2c: Add support for fast-plus speed

Fast-plus runs at 1MHz and is used by some devices. Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoi2c: Update drivers to use enum for speed
Simon Glass [Thu, 23 Jan 2020 18:48:22 +0000 (11:48 -0700)]
i2c: Update drivers to use enum for speed

Convert the obvious uses of i2c bus speeds to use the enum.

Use livetree access for code changes.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: stm32: Update to use standard enums for speed
Simon Glass [Thu, 23 Jan 2020 18:48:21 +0000 (11:48 -0700)]
i2c: stm32: Update to use standard enums for speed

Update this driver to use the new standard enums for speed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: omap: Update to use standard enums for speed
Simon Glass [Thu, 23 Jan 2020 18:48:20 +0000 (11:48 -0700)]
i2c: omap: Update to use standard enums for speed

Update this driver to use the new standard enums for speed.

Note: This driver needs to move to driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: kona_i2c: Update to use standard enums for speed
Simon Glass [Thu, 23 Jan 2020 18:48:19 +0000 (11:48 -0700)]
i2c: kona_i2c: Update to use standard enums for speed

Update this driver to use the new standard enums for speed.

Note: This driver needs to move to driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: designware_i2c: Update to use standard enums for speed
Simon Glass [Thu, 23 Jan 2020 18:48:18 +0000 (11:48 -0700)]
i2c: designware_i2c: Update to use standard enums for speed

Update this driver to use the new standard enums for speed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: ast_i2c: Update to use standard enums for speed
Simon Glass [Thu, 23 Jan 2020 18:48:17 +0000 (11:48 -0700)]
i2c: ast_i2c: Update to use standard enums for speed

Update this driver to use the new standard enums for speed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: Add enums for i2c speed and address size
Simon Glass [Thu, 23 Jan 2020 18:48:16 +0000 (11:48 -0700)]
i2c: Add enums for i2c speed and address size

Some drivers define their own speed enums and use their own constants for
speed. It makes sense to have a unified defition of the different speeds.

Since many controllers have to do different things for fast/high speed, it
is a good idea to have an enum for the mode.

Add these as well as an enum for the address mode.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: designware_i2c: Add spike supression
Simon Glass [Thu, 23 Jan 2020 18:48:15 +0000 (11:48 -0700)]
i2c: designware_i2c: Add spike supression

Some versions of this peripheral include a spike-suppression phase of the
bus. Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: designware_i2c: Rewrite timing calculation
Simon Glass [Thu, 23 Jan 2020 18:48:14 +0000 (11:48 -0700)]
i2c: designware_i2c: Rewrite timing calculation

At present the driver can end up with timing parameters which are slightly
faster than those expected. It is possible to optimise the parameters to
get the best possible result.

Create a new function to handle the timing calculation. This uses a table
of defaults for each speed mode rather than writing it in code.

The function works by calculating the 'period' of each bit on the bus in
terms of the input clock to the controller (IC_CLK). It makes sure that
the constraints are met and that the different components of that period
add up correctly.

This code was taken from coreboot which has ended up with this same
driver, but now in a much-different form.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: designware_i2c: Put hold config in a struct
Simon Glass [Thu, 23 Jan 2020 18:48:13 +0000 (11:48 -0700)]
i2c: designware_i2c: Put hold config in a struct

Create a struct to hold the three timing parameters. This will make it
easier to move these calculations into a separate function in a later
patch.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: designware_i2c: Drop scl_sda_cfg parameter
Simon Glass [Thu, 23 Jan 2020 18:48:12 +0000 (11:48 -0700)]
i2c: designware_i2c: Drop scl_sda_cfg parameter

Instead of passing this parameter into __dw_i2c_set_bus_speed(), pass in
the driver's private data, from which the function can obtain that
information. This allows the function to have access to the full state of
the driver.

Signed-off-by: Sicomp_param1mon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoi2c: designware_i2c: Read device-tree properties
Simon Glass [Thu, 23 Jan 2020 18:48:11 +0000 (11:48 -0700)]
i2c: designware_i2c: Read device-tree properties

The i2c controller defines a few timing properties. Read these in and
store them for use by the driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: designware_i2c: Bring in the binding file
Simon Glass [Thu, 23 Jan 2020 18:48:10 +0000 (11:48 -0700)]
i2c: designware_i2c: Bring in the binding file

Bring in this file from Linux v5.4.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: designware_i2c: Use an accurate bus clock instead of MHz
Simon Glass [Thu, 23 Jan 2020 18:48:09 +0000 (11:48 -0700)]
i2c: designware_i2c: Use an accurate bus clock instead of MHz

At present the driver uses an approximation for the bus clock, e.g. 166MHz
instead of 166 2/3 MHz.

This can result in small errors in the resulting I2C speed, perhaps 0.5%
or so.

Adjust the existing code to start from the accurate figure, even if later
rounding reduces this accuracy.

Update the bus speed code to work in KHz instead of MHz, which removes
most of the error.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: designware_i2c: Use an enum for selected speed mode
Simon Glass [Thu, 23 Jan 2020 18:48:08 +0000 (11:48 -0700)]
i2c: designware_i2c: Use an enum for selected speed mode

Group these #defines into an enum to make it easier to understand the
relationship between them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jun Chen <ptchentw@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: designware_i2c: Rename 'max' speed to 'high' speed
Simon Glass [Thu, 23 Jan 2020 18:48:07 +0000 (11:48 -0700)]
i2c: designware_i2c: Rename 'max' speed to 'high' speed

Some SoCs support a higher speed than what is currently called 'max' in
this driver. Rename it to 'high' speed, which is the official name of the
3.4MHz speed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jun Chen <ptchentw@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: designware_i2c: Include clk.h in the header file
Simon Glass [Thu, 23 Jan 2020 18:48:06 +0000 (11:48 -0700)]
i2c: designware_i2c: Include clk.h in the header file

We use struct clk here so really should include this header file to avoid
build errors. Also switch the order of clk.h in the C file to match the
required code style.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com>
Reviewed-by: Jun Chen <ptchentw@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: designware_i2c: Don't allow changing IC_CLK
Simon Glass [Thu, 23 Jan 2020 18:48:05 +0000 (11:48 -0700)]
i2c: designware_i2c: Don't allow changing IC_CLK

If a different input clock is required then the correct way to do this is
with a clock driver. Don't allow boards to override IC_CLK.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: designware_i2c: Add more registers
Simon Glass [Thu, 23 Jan 2020 18:48:04 +0000 (11:48 -0700)]
i2c: designware_i2c: Add more registers

Some versions of this peripherals provide more control of the bus
behaviour. Add definitions for these registers.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com>
Reviewed-by: Jun Chen <ptchentw@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoglobal_data: remove unused mxc_i2c specific field
Baruch Siach [Wed, 25 Dec 2019 15:57:06 +0000 (17:57 +0200)]
global_data: remove unused mxc_i2c specific field

The srdata field is unused since commit 71204e95ce13228 ("i2c: mxc:
refactor i2c driver and support dm").

Cc: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
4 years agocommon: fix regression on block cache init
Angelo Durgehello [Sun, 26 Jan 2020 18:31:22 +0000 (19:31 +0100)]
common: fix regression on block cache init

m68k needs block cache list initialized after relocation.
Other architectures must not be involved.

Fixing regression related to:

commit 1526bcce0f7285087621e16e6720636d01839da8
("common: add blkcache init")

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
4 years agoarm: mvebu: fix A38x breakage from commit bb872dd930cc
Joel Johnson [Sun, 26 Jan 2020 16:48:58 +0000 (09:48 -0700)]
arm: mvebu: fix A38x breakage from commit bb872dd930cc

This function parameter usage of load_addr was incorrectly caught in
the clarifying renames of commit bb872dd930cc, which results in boot
failures on Marvell A38x.

Signed-off-by: Joel Johnson <mrjoel@lixil.net>
Patch-to: Simon Glass <sjg@chromium.org>

4 years agoMerge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Sun, 26 Jan 2020 17:05:11 +0000 (12:05 -0500)]
Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi

- Libre Computer ALL-H3-IT/ALL-H5-CC board (Chen-Yu Tsai)
- Allwinner R40 Ethernet, usb phy enablement (Andre Przywara)
- Sunxi auto load from 128KB MMC offset (Andre Przywara)
- Orange Pi Win Ethernet phy enablement (Jernej Skrabec)

4 years agoconfigs: Orange Pi Win: enable ethernet phy
Jernej Skrabec [Sun, 26 Jan 2020 12:38:34 +0000 (13:38 +0100)]
configs: Orange Pi Win: enable ethernet phy

Orange Pi Win has gigabit ethernet port, but default U-Boot
configuration for that board enabled ethernet driver but
didn't enable realtek phy.

Fix that.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: Automate loading from 128KB MMC offset
Andre Przywara [Fri, 10 Jan 2020 01:47:32 +0000 (01:47 +0000)]
sunxi: Automate loading from 128KB MMC offset

Since commit 067e0b9684d4 ("sunxi: Allow booting from 128KB SD/eMMC offset")
we support having the SPL loaded from either the traditional 8KB SD
card/eMMC offset, or from the alternative location at 128KB. However the
sector to find the U-Boot image was still hard-coded at compile time,
and had to be adjusted for one of the two choices.

Since we can actually override the function to return the sector offset,
we can just check the boot source byte there to select the proper offset
based on from where the SPL was loaded.

This allows the very same binary image to be loaded from either 128KB or
8KB, with the U-Boot proper image always being located just behind the SPL.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: SPL: Factor out sunxi_get_boot_source()
Andre Przywara [Fri, 10 Jan 2020 01:47:31 +0000 (01:47 +0000)]
sunxi: SPL: Factor out sunxi_get_boot_source()

The Boot ROM write some boot source ID (SD card, eMMC, SPI, ...) into
a certain location in SRAM, so the SPL can easily determine where to
load U-Boot proper from.
Factor out reading this value, as it will come in handy again shortly.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq
Tom Rini [Sat, 25 Jan 2020 17:20:51 +0000 (12:20 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq

Updates and fixes for ls1028a, lx2160a, ls1012a, ls1021a, ls2080a,
ls1088a platforms:
- lx2-rev2 pcie support, enetc related updates, layerscape-pcie fixes

4 years agoMerge branch '2020-01-24-master-imports'
Tom Rini [Sat, 25 Jan 2020 17:04:59 +0000 (12:04 -0500)]
Merge branch '2020-01-24-master-imports'

- Enable fastboot on some MediaTek platforms
- DMA enchancements
- Assorted bugfixes

4 years agomtd: add prototypes for weak function
Patrick Delaunay [Fri, 24 Jan 2020 12:45:56 +0000 (13:45 +0100)]
mtd: add prototypes for weak function

This patch adds a prototype for the weak function
board_mtdparts_default().

It solves one warning when compiling with W=1 on stm32mp1 board:

board/st/stm32mp1/stm32mp1.c:
     warning: no previous prototype for 'board_mtdparts_default'
              [-Wmissing-prototypes]
     void board_mtdparts_default(const char **mtdids,
                                 const char **mtdparts)
          ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agocommon: blk: fix comment about blkcache_read return value
Eric Nelson [Wed, 22 Jan 2020 23:59:55 +0000 (16:59 -0700)]
common: blk: fix comment about blkcache_read return value

The blkcache_read() routine returns 1 (true) to indicate that a block was
found in the cache and returned, or 0 if not.

Signed-off-by: Eric Nelson <eric@nelint.com>
4 years agomeerkat96: fix typo in MAINTAINERS email address
Shawn Guo [Fri, 24 Jan 2020 04:59:42 +0000 (12:59 +0800)]
meerkat96: fix typo in MAINTAINERS email address

There is a typo in meerkat96 MAINTAINERS email address.  Fix it.

Reported-by: Carl Gelfand <carl@novtech.com>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
4 years agogenboardscfg.py: drop python version comment
Baruch Siach [Wed, 22 Jan 2020 12:54:24 +0000 (14:54 +0200)]
genboardscfg.py: drop python version comment

genboardscfg.py requires python 3.x since commit 3bc14098d8fb
("genboardscfg.py: Convert to Python 3").

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agocommon: add blkcache init
Angelo Durgehello [Tue, 21 Jan 2020 09:37:27 +0000 (10:37 +0100)]
common: add blkcache init

On m68k, block_cache list is relocated, but next and prev list
pointers are not adjusted to the relocated struct list_head address,
so the first iteration over the block_cache list hangs.

This patch initializes the block_cache list after relocation.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
Reviewed-by: Eric Nelson <eric@nelint.com>
4 years agonet: macb: Drop local cache flush
Vignesh Raghavendra [Thu, 16 Jan 2020 08:53:48 +0000 (14:23 +0530)]
net: macb: Drop local cache flush

Now that arch specific dma mapping APIs take care of cache
flush/invalidate, drop local cache flush operation.
While at that fix dma_unmap_single() call to match new prototype

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
4 years agomtd: denali: Drop custom dma mapping functions
Vignesh Raghavendra [Thu, 16 Jan 2020 08:53:47 +0000 (14:23 +0530)]
mtd: denali: Drop custom dma mapping functions

Drop local dma_map_single() and dma_unmap_single() and use arch specific
common implementation

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agommc: tmio-common: Drop custom dma mapping functions
Vignesh Raghavendra [Thu, 16 Jan 2020 08:53:46 +0000 (14:23 +0530)]
mmc: tmio-common: Drop custom dma mapping functions

Drop local dma_map_single() and dma_unmap_single() and use arch specific
common implementation

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agoasm: dma-mapping.h: Fix dma mapping functions
Vignesh Raghavendra [Thu, 16 Jan 2020 08:53:45 +0000 (14:23 +0530)]
asm: dma-mapping.h: Fix dma mapping functions

Subsystems such as USB expect dma_map_single() and dma_unmap_single() to
do dcache flush/invalidate operations as required. For example, see
see drivers/usb/gadget/udc/udc-core.c::usb_gadget_map_request().
Currently drivers do this locally, (see drivers/usb/dwc3/ep0.c,
drivers/mtd/nand/raw/denali.c etc..)
Update arch specific dma_map_single() and dma_unmap_single() APIs to do
cache flush/invalidate  operations, so that drivers need not implement
them locally.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Rick Chen <rick@andestech.com>
4 years agofastboot: mt85xx: add command to flash/erase emmc hwpart
mingming lee [Thu, 16 Jan 2020 08:11:42 +0000 (16:11 +0800)]
fastboot: mt85xx: add command to flash/erase emmc hwpart

This patch includes the following:
1. Add fastboot command to erase the whole EMMC_USER
2. Add fastboot command to flash image at EMMC_BOOT1
3. Add fastboot command to erase the whole EMMC_BOOT1
4. Enale CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT for mt8518

Signed-off-by: mingming lee <mingming.lee@mediatek.com>
4 years agoconfigs: mt8518: Enable fastboot related configs
mingming lee [Thu, 16 Jan 2020 08:11:41 +0000 (16:11 +0800)]
configs: mt8518: Enable fastboot related configs

Enable EFI module.
Enable fastboot.

Signed-off-by: mingming lee <mingming.lee@mediatek.com>
4 years agoconfigs: mt8518: enable usb gadget driver
mingming lee [Thu, 16 Jan 2020 08:11:40 +0000 (16:11 +0800)]
configs: mt8518: enable usb gadget driver

Enable board_late_init and usb gadget for mt8518

Signed-off-by: mingming lee <mingming.lee@mediatek.com>
4 years agoconfigs: mt8518: set global variables for fastboot
mingming lee [Thu, 16 Jan 2020 08:11:39 +0000 (16:11 +0800)]
configs: mt8518: set global variables for fastboot

set common fastboot variables for mt8518

Signed-off-by: mingming lee <mingming.lee@mediatek.com>
4 years agoARM: Mediatek: Add board_late_init to init usb gadget driver
mingming lee [Thu, 16 Jan 2020 08:11:38 +0000 (16:11 +0800)]
ARM: Mediatek: Add board_late_init to init usb gadget driver

Add board_late_init function to init usb gadget driver for mt8518

Signed-off-by: mingming lee <mingming.lee@mediatek.com>
4 years agousb: musb-new: mt85xx: add musb-new gadget driver.
mingming lee [Thu, 16 Jan 2020 08:11:37 +0000 (16:11 +0800)]
usb: musb-new: mt85xx: add musb-new gadget driver.

Using musb-new structure for mt85xx gadget driver.
Add gadget driver dts for mt8518 SoCs.

Signed-off-by: mingming lee <mingming.lee@mediatek.com>
4 years agocrypto: make mod_exp_sw() static
Heinrich Schuchardt [Sun, 19 Jan 2020 18:48:04 +0000 (19:48 +0100)]
crypto: make mod_exp_sw() static

Function mod_exp_sw() is only used via the operators of the uclass.
It is not defined in any include.

Make mod_exp_sw() static.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agolib: Kconfig dependencies for pseudo-random library
Heinrich Schuchardt [Sun, 19 Jan 2020 18:28:12 +0000 (19:28 +0100)]
lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agolib: rsa: consider CONFIG_SPL_RSA
Heinrich Schuchardt [Sun, 19 Jan 2020 08:26:22 +0000 (09:26 +0100)]
lib: rsa: consider CONFIG_SPL_RSA

CONFIG_SPL_RSA is meant to control if lib/rsa/* is used for SPL. Adjust
lib/Makefile to consider this setting.

This was correctly setup with commit 51c14cd128f4 ("verified-boot: Minimal
support for booting U-Boot proper from SPL") and got lost with commit
089df18bfe9d ("lib: move hash CONFIG options to Kconfig").

Fixes: 089df18bfe9d ("lib: move hash CONFIG options to Kconfig")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agosunxi: Add Libre Computer ALL-H5-CC H5 board
Chen-Yu Tsai [Sun, 12 Jan 2020 15:36:15 +0000 (23:36 +0800)]
sunxi: Add Libre Computer ALL-H5-CC H5 board

The Libre Computer ALL-H5-CC board is an upgraded version of the
ALL-H3-CC. Changes include:

  - Gigabit Ethernet via external RTL8211E Ethernet PHY
  - 16 MiB SPI NOR flash memory
  - PoE tap header
  - Line out jack removed

Only H5 variant test samples were made available, and the vendor is not
certain whether other SoC variants would be made or not. Furthermore the
board is a minor upgrade compared to the ALL-H3-CC. Thus the device tree
simply includes the one for the ALL-H3-CC, and adds the changes on top.

The device tree was synced over from the Linux kernel, along with other
H3/H5 changes, in a previous patch. Thus only the defconfig and an entry
to the MAINTAINERS file is added.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
[jagan: drop CONFIG_SYS_SPI_U_BOOT_OFFS]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: Add Libre Computer ALL-H3-IT H5 board
Chen-Yu Tsai [Sun, 12 Jan 2020 15:36:14 +0000 (23:36 +0800)]
sunxi: Add Libre Computer ALL-H3-IT H5 board

The Libre Computer ALL-H3-IT board is a small single board computer that
is roughly the same size as the Raspberry Pi Zero, or around 20% smaller
than a credit card.

The board features:

  - H2, H3, or H5 SoC from Allwinner
  - 2 DDR3 DRAM chips
  - Realtek RTL8821CU based WiFi module
  - 128 Mbit SPI-NOR flash
  - micro-SD card slot
  - micro HDMI video output
  - FPC connector for camera sensor module
  - generic Raspberri-Pi style 40 pin GPIO header
  - additional pin headers for extra USB host ports, ananlog audio and
    IR receiver

Only H5 variant test samples were made available, but the vendor does
have plans to include at least an H3 variant. Thus the device tree is
split much like the ALL-H3-CC, with a common dtsi file for the board
design, and separate dts files including the common board file and the
SoC dtsi file. The other variants will be added as they are made
available.

The device tree was synced over from the Linux kernel, along with other
H3/H5 changes, in a previous patch. Thus only the defconfig and an entry
to the MAINTAINERS file is added.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
[jagan: drop CONFIG_SYS_SPI_U_BOOT_OFFS]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: move CONFIG_SYS_SPI_U_BOOT_OFFS out of defconfig
Andre Przywara [Mon, 6 Jan 2020 01:29:10 +0000 (01:29 +0000)]
sunxi: move CONFIG_SYS_SPI_U_BOOT_OFFS out of defconfig

For Allwinner SoCs the CONFIG_SYS_SPI_U_BOOT_OFFS value is not really a
board choice: The boot ROM only loads the SPL from offset 0 of the SPI
NOR flash, and loads at most 32KB. This is a similar situation as on MMC,
so consequently we create our "joint" image (SPL + U-Boot proper) with
that 32KB offset during the build.

So define the value of this symbol to be 32KB by default for every
Allwinner SoC. This removes the definition of this symbol from the
_defconfig files, and avoids every board to define this over and over
again.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: defconfig: R40 boards: enable USB
Andre Przywara [Wed, 1 Jan 2020 23:44:49 +0000 (23:44 +0000)]
sunxi: defconfig: R40 boards: enable USB

Now that the USB PHY on the Allwinner R40 SoC is supported, enable USB
support for the two R40 boards U-Boot supports.
For this we need to add the GPIO pin that powers the USB port(s), also
enable the usual suspects (OHCI/EHCI support).

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agophy: sun4i-usb: Add Allwinner R40 support
Andre Przywara [Wed, 1 Jan 2020 23:44:48 +0000 (23:44 +0000)]
phy: sun4i-usb: Add Allwinner R40 support

Since every Allwinner USB PHY seems to be slightly different from each
other, we need to add the compatible string and the respective data
structure to make it work on the R40/V40 SoC.
Nothing spectacular this time, just one less USB controller than the H3.
Copied from the Linux kernel.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: defconfig: Bananapi M2 Berry: enable Ethernet
Andre Przywara [Wed, 1 Jan 2020 23:44:47 +0000 (23:44 +0000)]
sunxi: defconfig: Bananapi M2 Berry: enable Ethernet

The M2 Berry features the normal Gigabit PHY connected to the SoC's MAC,
so enable the sun8i-emac driver to support Ethernet on the board.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: dts: R40: Update Bananapi M2 Berry .dts
Andre Przywara [Wed, 1 Jan 2020 23:44:46 +0000 (23:44 +0000)]
sunxi: dts: R40: Update Bananapi M2 Berry .dts

Update the .dts file from the kernel, which carries much more nodes,
some of them we need to enable USB and Ethernet support for the board.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: H3/H5 Sync DT files from upstream Linux kernel as of next-20200108
Chen-Yu Tsai [Sun, 12 Jan 2020 15:36:13 +0000 (23:36 +0800)]
sunxi: H3/H5 Sync DT files from upstream Linux kernel as of next-20200108

Sync the device tree files and device tree header files from upstream
Linux kernel, as of 2020-01-08. The commit synced to in the sunxi repo

    98d25b0b266d Merge branch 'sunxi/dt-for-5.6' into sunxi/for-next

which is also part of next-20200108.

Changes brought in include:

  - cleanup of pinmux node names
  - addition of Security ID, MBUS, CSI, crypto engine, video codec,
    pmu, and thermal sensor device nodes for both SoCs
  - addition of deinterlacing engine device node on H3
  - cleanup of RTC device node and addition of its clocks
  - various board cleanups and improvements
    - removal of pinmux node for GPIO lines
    - cpufreq / DVFS
    - HDMI output
    - UART-based Bluetooth
    - audio codec
    - USB ports
  - new boards

Most of the changes don't concern U-boot.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agocommon: Update comment to show progress
Simon Glass [Sat, 28 Dec 2019 17:45:12 +0000 (10:45 -0700)]
common: Update comment to show progress

This file doesn't include any declarations anymore but it does include
other headers. Update the header comment to mention this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Collect all the header files together
Simon Glass [Sat, 28 Dec 2019 17:45:11 +0000 (10:45 -0700)]
common: Collect all the header files together

There are many header files included here. Put them all together since the
blank lines are not useful.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move and rename CONFIG_SYS_SUPPORT_64BIT_DATA
Simon Glass [Sat, 28 Dec 2019 17:45:10 +0000 (10:45 -0700)]
common: Move and rename CONFIG_SYS_SUPPORT_64BIT_DATA

This is not really a CONFIG since it is not intended to be set by boards.
Move it into the compiler header with other similar defines, and rename
it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move ROUND() into kernel.h
Simon Glass [Sat, 28 Dec 2019 17:45:09 +0000 (10:45 -0700)]
common: Move ROUND() into kernel.h

Move this macro in with all the other rounding macros.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move check_member() to kernel.h
Simon Glass [Sat, 28 Dec 2019 17:45:08 +0000 (10:45 -0700)]
common: Move check_member() to kernel.h

The kernel.h file has a number of useful macros including a few related
to structures. Move check_member() there too.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move hang() to the same header as panic()
Simon Glass [Sat, 28 Dec 2019 17:45:07 +0000 (10:45 -0700)]
common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agocommon: Move testdram() into init.h
Simon Glass [Sat, 28 Dec 2019 17:45:06 +0000 (10:45 -0700)]
common: Move testdram() into init.h

This function is called during init so move it to the init header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move RAM-sizing functions to init.h
Simon Glass [Sat, 28 Dec 2019 17:45:05 +0000 (10:45 -0700)]
common: Move RAM-sizing functions to init.h

These functions relate to memory init so move them into the init
header.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Rename and move source()
Simon Glass [Sat, 28 Dec 2019 17:45:04 +0000 (10:45 -0700)]
common: Rename and move source()

This function has a very generic name which does not adequately describe
its purpose. Rename it and move it to image.h, since it relates to reading
a script from an image.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move the image globals into image.h
Simon Glass [Sat, 28 Dec 2019 17:45:03 +0000 (10:45 -0700)]
common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoimage: Rename load_addr, save_addr, save_size
Simon Glass [Sat, 28 Dec 2019 17:45:02 +0000 (10:45 -0700)]
image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move reset_cpu() to the CPU header
Simon Glass [Sat, 28 Dec 2019 17:45:01 +0000 (10:45 -0700)]
common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move reset_misc() function to arch header
Simon Glass [Sat, 28 Dec 2019 17:45:00 +0000 (10:45 -0700)]
common: Move reset_misc() function to arch header

This function is only used on ARM devices. Move it out of the common file
and to a arch-specific header.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move get_tbclk() to time.h
Simon Glass [Sat, 28 Dec 2019 17:44:59 +0000 (10:44 -0700)]
common: Move get_tbclk() to time.h

This function related to timer and most of the timer functions are in
time.h, so move this function there.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move clock functions into a new file
Simon Glass [Sat, 28 Dec 2019 17:44:58 +0000 (10:44 -0700)]
common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move upmconfig() to ppc.h
Simon Glass [Sat, 28 Dec 2019 17:44:57 +0000 (10:44 -0700)]
common: Move upmconfig() to ppc.h

This file is only used by PowerPC so move it to an arch-specific header
file.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move ll_boot_init() to init.h
Simon Glass [Sat, 28 Dec 2019 17:44:56 +0000 (10:44 -0700)]
common: Move ll_boot_init() to init.h

This is an init-related function so belongs in that file. Move it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: arm: Move s_init() to an ARM-specific header
Simon Glass [Sat, 28 Dec 2019 17:44:55 +0000 (10:44 -0700)]
common: arm: Move s_init() to an ARM-specific header

This function is only used on ARM devices so does not belong in the global
common header file. Move it to an ARM header.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move device-tree setup functions to fdt_support.h
Simon Glass [Sat, 28 Dec 2019 17:44:54 +0000 (10:44 -0700)]
common: Move device-tree setup functions to fdt_support.h

These functions relate to setting up the device tree for booting the OS.
The fdt_support.h header file supports similar functions, so move these
there.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move type declarations to linux/types.h
Simon Glass [Sat, 28 Dec 2019 17:44:53 +0000 (10:44 -0700)]
common: Move type declarations to linux/types.h

This file already has lots of type declarations so it seems better to put
all of them there.

Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Drop the symbol_lookup() declaration
Simon Glass [Sat, 28 Dec 2019 17:44:52 +0000 (10:44 -0700)]
common: Drop the symbol_lookup() declaration

This function is not called anywhere so we can drop the declaration. If
it is needed one day, it should be added in its own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Drop CONFIG_HAS_POST
Simon Glass [Sat, 28 Dec 2019 17:44:51 +0000 (10:44 -0700)]
common: Drop CONFIG_HAS_POST

This only exists to control whether the post/ directory is build. It is
just as easy to check this in the Makefile. Remove CONFIG_HAS_POST and use
an ifdef in the Makefile instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Drop CONFIG_POST_STD/ALT_LIST
Simon Glass [Sat, 28 Dec 2019 17:44:50 +0000 (10:44 -0700)]
common: Drop CONFIG_POST_STD/ALT_LIST

These CONFIG options are not used anymore. CONFIG_POST_ALT_LIST just
causes CONFIG_POST_STD_LIST to be set and it causes tests.c to be
compiled. So just make compiling tests.c unconditional.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move CONFIG_SYS_DEF_EEPROM_ADDR out of common.h
Simon Glass [Sat, 28 Dec 2019 17:44:49 +0000 (10:44 -0700)]
common: Move CONFIG_SYS_DEF_EEPROM_ADDR out of common.h

This define seems better suited to the eeprom header file, particularly
as it is only used in the eeprom.c file.

Move it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move reset_phy() to net.h
Simon Glass [Sat, 28 Dec 2019 17:44:48 +0000 (10:44 -0700)]
common: Move reset_phy() to net.h

This is a network function so let's move it into that header.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Drop floppy disk support
Simon Glass [Sat, 28 Dec 2019 17:44:47 +0000 (10:44 -0700)]
common: Drop floppy disk support

This seems pretty old now. It has not been converted to driver model and
is not used by any boards.

Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move jumptable_init() out of common.h
Simon Glass [Sat, 28 Dec 2019 17:44:46 +0000 (10:44 -0700)]
common: Move jumptable_init() out of common.h

This function is defined in exports.c so move it to its header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocommon: Move relocate_code() to init.h
Simon Glass [Sat, 28 Dec 2019 17:44:45 +0000 (10:44 -0700)]
common: Move relocate_code() to init.h

This is an init function so move it out of the common header. Avoid using
the typedef so that we don't have to include the global_data header file.

Also tidy up the function style in comments while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move functions for loading from fat/ext2 to fs.h
Simon Glass [Sat, 28 Dec 2019 17:44:44 +0000 (10:44 -0700)]
common: Move functions for loading from fat/ext2 to fs.h

These are filesystem functions and belong in the filesystem header file.
Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move do_tftpb() to net.h
Simon Glass [Sat, 28 Dec 2019 17:44:43 +0000 (10:44 -0700)]
common: Move do_tftpb() to net.h

This function belongs in the network header file. Move it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move embedded fdt location to fdtdec.h
Simon Glass [Sat, 28 Dec 2019 17:44:42 +0000 (10:44 -0700)]
common: Move embedded fdt location to fdtdec.h

These declarations are only used in fdtdec.c so move them to its header
file.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Drop checkflash() and checkdram()
Simon Glass [Sat, 28 Dec 2019 17:44:41 +0000 (10:44 -0700)]
common: Drop checkflash() and checkdram()

These functions are not used in U-Boot. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move flash_perror() to flash.h
Simon Glass [Sat, 28 Dec 2019 17:44:40 +0000 (10:44 -0700)]
common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agocommon: Move main_loop() to init.h
Simon Glass [Sat, 28 Dec 2019 17:44:39 +0000 (10:44 -0700)]
common: Move main_loop() to init.h

Move this function out of common.h and into a better place.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
4 years agocommon: Drop mdm_init()
Simon Glass [Sat, 28 Dec 2019 17:44:38 +0000 (10:44 -0700)]
common: Drop mdm_init()

This is not used in U-Boot. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
4 years agotools: ftdgrep: correct the find regions loop in do_fdtgrep
Patrick Delaunay [Mon, 13 Jan 2020 08:33:51 +0000 (09:33 +0100)]
tools: ftdgrep: correct the find regions loop in do_fdtgrep

Use realloc and update the loop executed in do_fdtgrep to find all
the regions: only test count > max_region after the second pass.

This patch solve an issue if the number of region found (count)
is greater then the default value (max_region = count = 100):
the second pass is never executed, because the loop stops after
the first pass (i = 0, count > 100, max_regions = 100)
with error -1 and the error message
"Internal error with fdtgrep_find_region".

I also update the error message.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoarm: Add arm handoff header file
Michael Trimarchi [Sun, 5 Jan 2020 15:51:13 +0000 (16:51 +0100)]
arm: Add arm handoff header file

Add an arch-specific handoff header so that we can use the HANDOFF feature
on arm devices.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoserial: ns16550: Use old baud rate divisor for flushing if not given
Patrik Dahlström [Sat, 21 Dec 2019 16:25:12 +0000 (17:25 +0100)]
serial: ns16550: Use old baud rate divisor for flushing if not given

If baud_divisor is not set (i.e. == -1), we should use the baud divisor
already in use for flushing the xmit register. If we don't flush the
xmit register, then SPL will hang.

Signed-off-by: Patrik Dahlström <risca@dalakolonin.se>
4 years agocmd: mtd: solve bad block support in erase command
Patrick Delaunay [Fri, 20 Sep 2019 07:20:12 +0000 (09:20 +0200)]
cmd: mtd: solve bad block support in erase command

This patch modify the loop in mtd erase command to erase one by one
the blocks in the requested area.

It solves issue on "mtd erase" command on nand with existing bad block,
the command is interrupted on the first bad block with the trace:
"Skipping bad block at 0xffffffffffffffff"

In MTD driver (nand/raw), when a bad block is present on the MTD
device, the erase_op.fail_addr is not updated and we have the initial
value MTD_FAIL_ADDR_UNKNOWN = (ULL)-1.

This case seems normal in nand_base.c:nand_erase_nand(),
we have the 2 exit cases during the loop:

1/ we have a bad block (nand_block_checkbad)
instr->state = MTD_ERASE_FAILED
loop interrupted (goto erase_exit)

2/ if block erase failed (status & NAND_STATUS_FAIL)
instr->state = MTD_ERASE_FAILED;
instr->fail_addr =
((loff_t)page << chip->page_shift);
loop interrupted (goto erase_exit)

So erase_op.fail_addr can't be used if bad blocks were present
in the erased area; we need to use mtd_erase only one block to detect
and skip these existing bad blocks (as it is done in nand_util.c).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
4 years agoremoteproc: elf_loader: fix program header parsing
Fabien Dessenne [Wed, 4 Sep 2019 07:53:22 +0000 (09:53 +0200)]
remoteproc: elf_loader: fix program header parsing

Fix an issue where some sections are never loaded : if p_type is
different from PT_LOAD the phdr pointer must be incremented.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Acked-by: Suman Anna <s-anna@ti.com>
4 years agoconfigs: ls1028aqds: enable mdio muxing by default
Alex Marginean [Mon, 2 Dec 2019 10:58:14 +0000 (12:58 +0200)]
configs: ls1028aqds: enable mdio muxing by default

LS1028A QDS boards have a MDIO MUX and they require the driver for it for
PHYs to work.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: fsl-layerscape: secure_boot: Enable setexpr command
Udit Agarwal [Wed, 20 Nov 2019 08:51:27 +0000 (08:51 +0000)]
configs: fsl-layerscape: secure_boot: Enable setexpr command

setexpr command is used while running secure boot
(chain of trust with confidentiality) feature.

Enable CONFIG_CMD_SETEXPR to enable setexpr command.

Signed-off-by: Udit Agarwal <udit.agarwal@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>