platform/kernel/u-boot.git
4 years agoARC: HSDK-4xD: tweak memory map
Eugeniy Paltsev [Wed, 25 Mar 2020 09:35:49 +0000 (12:35 +0300)]
ARC: HSDK-4xD: tweak memory map

For HSDK-4xD we do additional AXI bridge tweaking while doing
hsdk_init command:
 - we shrink IOC region.
 - we configure ARC HS CORE SLV1 aperture depending on
   haps_apb_location environment variable.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK-4xD: add CSM configuration support
Eugeniy Paltsev [Mon, 23 Mar 2020 18:50:03 +0000 (21:50 +0300)]
ARC: HSDK-4xD: add CSM configuration support

Add support for CSM enable/disable and CSM relocation via
hsdk_init command. We allow to relocate CSM to the beginning of
any aperture even if HW support finer granularity.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK-4xD: add support for SLC enable/disable
Eugeniy Paltsev [Mon, 23 Mar 2020 17:46:35 +0000 (20:46 +0300)]
ARC: HSDK-4xD: add support for SLC enable/disable

Add support for SLC enable/disable via hsdk_init command.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK-4xD: print timer clock value
Eugeniy Paltsev [Thu, 23 Apr 2020 11:52:43 +0000 (14:52 +0300)]
ARC: HSDK-4xD: print timer clock value

Print timer clock value in hsdk_clock print_all command.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK-4xD: drop additional GPU clock info
Eugeniy Paltsev [Wed, 22 Apr 2020 19:44:24 +0000 (22:44 +0300)]
ARC: HSDK-4xD: drop additional GPU clock info

HSDK-4xD has other GPU type so it consumes only GPU core clock.
Even we have additional GPU clock dividers they are not routed
to anything. So drop information about those additional clocks
in hsdk_clock print_all command.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK-4xD: print info about HDMI clocks
Eugeniy Paltsev [Tue, 21 Apr 2020 23:08:06 +0000 (02:08 +0300)]
ARC: HSDK-4xD: print info about HDMI clocks

HSDK-4xD has HDMI working so let's print info about HDMI clocks.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK-4xD: fix headerize script for HSDK-4xD compatibility
Eugeniy Paltsev [Tue, 21 Apr 2020 22:57:41 +0000 (01:57 +0300)]
ARC: HSDK-4xD: fix headerize script for HSDK-4xD compatibility

ARC HS CPU in HSDK-4xD has ARC ID = 0x54, so fix headerize script
accordingly.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK-4xD: use active low polarity of cpu_start pulse
Eugeniy Paltsev [Thu, 16 Jan 2020 16:22:32 +0000 (19:22 +0300)]
ARC: HSDK-4xD: use active low polarity of cpu_start pulse

Add quirk for HSDK-4xD - due to HW issues HSDK can use any pulse
polarity but HSDK-4xD require active low polarity of cpu_start pulse.

So use low polarity of cpu_start pulse for both board.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK: split HSDK and HSDK-4xD DTS
Eugeniy Paltsev [Tue, 21 Apr 2020 22:29:18 +0000 (01:29 +0300)]
ARC: HSDK: split HSDK and HSDK-4xD DTS

Split HSDK and HSDK-4xD device tree files so they can have
different model names.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK-4xD: add initial board support
Eugeniy Paltsev [Tue, 21 Apr 2020 21:33:40 +0000 (00:33 +0300)]
ARC: HSDK-4xD: add initial board support

Add initial HSDK-4xD board support.
The ARC HS4x/HS4xD Development Kit includes a multicore ARC HS4xD-based
chip that integrates a wide range of interfaces including Ethernet,
HDMI, WiFi, Bluetooth, USB, SDIO, I2C, SPI, UART, I2S, ADC, PWM and
GPIO, as well as a Think Silicon GPU.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK: CGU: add support for timer clock
Eugeniy Paltsev [Thu, 23 Apr 2020 11:50:50 +0000 (14:50 +0300)]
ARC: HSDK: CGU: add support for timer clock

Add support for additional timer clock which belongs to tunnel
domain.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: ARCv2: handle DSP presence in HW
Eugeniy Paltsev [Wed, 22 Apr 2020 15:33:21 +0000 (18:33 +0300)]
ARC: ARCv2: handle DSP presence in HW

In case of DSP extension presence in HW some instructions
(related to integer multiply, multiply-accumulate, and divide
operation) executes on this DSP execution unit. So their
execution will depend on dsp configuration register (DSP_CTRL)
As we want these instructions to execute the same way regardless
of DSP presence we need to set DSP_CTRL properly.

NOTE:
we do the same adjustments in Linux kernel, see in kernel tree:
commit 4827d0cf744e ("ARC: handle DSP presence in HW")

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoMerge branch '2020-04-25-master-imports'
Tom Rini [Sat, 25 Apr 2020 12:20:22 +0000 (08:20 -0400)]
Merge branch '2020-04-25-master-imports'

- Assorted minor fixes
- Actions S700 SoC and Cubieboard7 support

4 years agortc: ds1374: typo Watchdog
Heinrich Schuchardt [Mon, 20 Apr 2020 16:31:21 +0000 (18:31 +0200)]
rtc: ds1374: typo Watchdog

%s/Watchdoc/Watchdog/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agospi: mpc8xxx_spi: fix missing dev_err definition
Rasmus Villemoes [Mon, 20 Apr 2020 14:13:41 +0000 (16:13 +0200)]
spi: mpc8xxx_spi: fix missing dev_err definition

The build currently fails with

drivers/spi/mpc8xxx_spi.c:64:3: warning: implicit declaration of function ‘dev_err’ [-Wimplicit-function-declaration]
...
drivers/spi/built-in.o: In function `mpc8xxx_spi_set_speed':
drivers/spi/mpc8xxx_spi.c:227: undefined reference to `dev_err'

Fixes: 4856cc7a97 (mpc8xxx_spi: implement real ->set_speed)
Fixes: 1a7b462dee (mpc8xxx_spi: put max_cs to use)
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agospl: fit: do not check argument of free()
Heinrich Schuchardt [Mon, 20 Apr 2020 10:44:01 +0000 (12:44 +0200)]
spl: fit: do not check argument of free()

The free() function checks if its argument is NULL. It is superfluous to do
the same check on the calling side.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoMAINTAINERS: add entry for cubieboard7 config
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:37 +0000 (19:28 +0530)]
MAINTAINERS: add entry for cubieboard7 config

This commit adds entry for cubieboard7 config under Actions Semi
OWL family.

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agodoc: boards: add Cubieboard7 documentation
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:36 +0000 (19:28 +0530)]
doc: boards: add Cubieboard7 documentation

This adds build and flash steps for Actions S700
based Cubieboard7 board.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: add Cubieboard7 board support
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:35 +0000 (19:28 +0530)]
arm: add Cubieboard7 board support

The Cubieboard is a single board computer containing a
Actions S700 SoC(with 4 ARMv8 Cortex-A53 cores).

This patch adds respective defconfig alongwith .dts(copied
from Linux v5.5-rc6 with hash "b3a987b0264d").

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoactions: Move defconfig options to Kconfig
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:34 +0000 (19:28 +0530)]
actions: Move defconfig options to Kconfig

This patch moves some of the config options from bubblegum_96_defconfig
to respective Kconfig files.

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: add support Actions Semi S700
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:33 +0000 (19:28 +0530)]
arm: add support Actions Semi S700

This patch adds basic support for Actions Semi based S700
SoC, which is driven by common owl framework.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: dts: actions: s700: add u-boot specific dtsi file
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:32 +0000 (19:28 +0530)]
arm: dts: actions: s700: add u-boot specific dtsi file

Devices like uart and clk are needed to be enabled before relocation.
this patch adds u-boot.dtsi file that mark these device as dm-pre-reloc.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: actions: add S700 SoC device tree
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:31 +0000 (19:28 +0530)]
arm: actions: add S700 SoC device tree

This patch adds .dtsi file(sync with Linux 5.5-rc6 with hash "b3a987b0264d")
and required binding for S700 SoC that is a 64-bit Quad-core ARM
Cortex-A53 cores.

It also provisions dts file to be built based on selected
platform(CONFIG_MACH_S900/S700).

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoclk: actions: Add common clock driver
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:30 +0000 (19:28 +0530)]
clk: actions: Add common clock driver

This patch converts S900 clock driver to something common that can
be used for other SoCs, for instance S700(few of clk registers are same).

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: dts: actions: s900: add u-boot specific dtsi file
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:29 +0000 (19:28 +0530)]
arm: dts: actions: s900: add u-boot specific dtsi file

Devices like uart and clk are needed to be enabled before relocation.
This patch adds u-boot.dtsi file that mark these device as dm-pre-reloc.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: dts: sync dts for Action Semi S900
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:28 +0000 (19:28 +0530)]
arm: dts: sync dts for Action Semi S900

Synchronize device tree bindings with v5.5-rc6 tag with commit id
"b3a987b0264d".

Also, it removes older clock binding defined for S900 along with undocumented
compatible string "actions,s900-serial" from serial driver and adapts clock
driver to cater to new bindings.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoserial: actions: add compatible string
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:27 +0000 (19:28 +0530)]
serial: actions: add compatible string

This patch adds "actions,owl-uart" string to the owl uart driver. It
is also defined in Linux kernel.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: actions: rename sysmap-s900 to sysmap-owl
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:26 +0000 (19:28 +0530)]
arm: actions: rename sysmap-s900 to sysmap-owl

Now that memory maps(for both S700 and S900 SoCs) can be managed using
a common file, rename sysmap-s900 to sysmap-owl to reflect the same.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: actions: Add common framework for Actions Owl Semi SoCs
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:25 +0000 (19:28 +0530)]
arm: actions: Add common framework for Actions Owl Semi SoCs

This commit adds common arch support for Actions Semi Owl
series SoCs and removes the Bubblegum96 board files.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agococcinelle: adjust NULL check before free()
Heinrich Schuchardt [Sun, 19 Apr 2020 09:56:02 +0000 (11:56 +0200)]
coccinelle: adjust NULL check before free()

The free() function checks if its argument is NULL. We should avoid
checking for NULL before calling free like in

    if (result->tds)
        free(result->tds);

The list of relevant functions differs between Linux and U-Boot, e.g. we
use free().

Adjust the list of relevant functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agococcinelle: check for casting malloc output
Heinrich Schuchardt [Sun, 19 Apr 2020 09:07:34 +0000 (11:07 +0200)]
coccinelle: check for casting malloc output

Casting the (void *) output of memory allocation functions before
assignment like in

sata->cmd_hdr_tbl_offset = (void *)malloc(length + align);

is useless.

Adopt the Linux kernel script
scripts/coccinelle/api/alloc/alloc_cast.cocci.

Now 'make coccicheck' generates warnings like:

./drivers/ata/fsl_sata.c:143:29-33:
WARNING: casting value returned by memory allocation function
to (void *) is useless.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agokbuild: cherry-pick kbuild changes from Linux
Masahiro Yamada [Fri, 17 Apr 2020 07:21:36 +0000 (16:21 +0900)]
kbuild: cherry-pick kbuild changes from Linux

b42841b7bb62 kbuild: Get rid of KBUILD_STR
2aedcd098a94 kbuild: suppress annoying "... is up to date." message
9c8fa9bc08f6 kbuild: fix if_change and friends to consider argument order
ebf003f0cfb3 kbuild: Consolidate header generation from ASM offset information
2982c953570b kbuild: remove redundant $(wildcard ...) for cmd_files calculation
8a78756eb545 kbuild: create object directories simpler and faster
4d4b5c2e3b6e treewide: remove explicit rules for *offsets.s
01d509a48b46 kbuild: remove unimportant comments from ./Kbuild

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agokbuild: add FORCE to dependency of $(obj)/dts/dt-platdata.o
Masahiro Yamada [Fri, 17 Apr 2020 07:21:35 +0000 (16:21 +0900)]
kbuild: add FORCE to dependency of $(obj)/dts/dt-platdata.o

if_changed must have FORCE as a prerequisite.

Add $(obj)/dts/dt-platdata.o to 'targets' so that the corresponding
.cmd file is included.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agocache: l2x0: Fix write to incorrect shared-override bit
Ley Foon Tan [Fri, 17 Apr 2020 06:45:35 +0000 (14:45 +0800)]
cache: l2x0: Fix write to incorrect shared-override bit

The existing code write bit-0 for shared attribute override enable bit.
It should be bit-22 based on cache controller specification [1].

[1] http://infocenter.arm.com/help/topic/com.arm.doc.ddi0246f/DDI0246F_l2c310_r3p2_trm.pdf

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
4 years agoREADME: remove references on no more used config CONFIG_SYS_RCAR_I2C*
Patrick Delaunay [Fri, 10 Apr 2020 14:34:41 +0000 (16:34 +0200)]
README: remove references on no more used config CONFIG_SYS_RCAR_I2C*

Remove the references in README on CONFIG_SYS_RCAR_I2C_* not use
in U-Boot drivers/i2c/rcar_i2c.c, since commit a4d9aafadb31 ("i2c:
 rcar_i2c: Remove the driver") and commit a06a0ac36d59 ("i2c: rcar_i2c:
 Add DM and DT capable I2C driver")

Checked by the command: grep -r SYS_RCAR_I2C *
And these CONFIG are only defined in
arch/arm/mach-rmobile/include/mach/rcar-base.h

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocosmetic: README: Fix one CONFIG name
Patrick Delaunay [Fri, 10 Apr 2020 14:34:40 +0000 (16:34 +0200)]
cosmetic: README: Fix one CONFIG name

Only replace CONFIF_ by CONFIG_

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: mmc: Update mmc_get_mmc_dev() to use const *
Simon Glass [Wed, 8 Apr 2020 14:33:00 +0000 (08:33 -0600)]
dm: mmc: Update mmc_get_mmc_dev() to use const *

This function does not modify the device to change it to use const *, so
that callers with a const udevice * can call it without a cast.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agopci: Add a macro to convert BDF from linux to U-Boot
Simon Glass [Wed, 8 Apr 2020 14:32:59 +0000 (08:32 -0600)]
pci: Add a macro to convert BDF from linux to U-Boot

U-Boot's BDF format has its bits in the same position as the device tree
PCI definition.

Some x86 devices use linux format in their register format and it is
useful to be able to convert to U-Boot format. Add a macro for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agouuid: Use const char * where possible
Simon Glass [Wed, 8 Apr 2020 14:32:58 +0000 (08:32 -0600)]
uuid: Use const char * where possible

Update the arguments of these functions so they can be called from code
which uses constant strings.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agolib: Add a function to convert a string to upper case
Simon Glass [Wed, 8 Apr 2020 14:32:56 +0000 (08:32 -0600)]
lib: Add a function to convert a string to upper case

Add a helper function for this operation. Update the strtoul() tests to
check upper case as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotest: Add the beginnings of some string tests
Simon Glass [Wed, 8 Apr 2020 14:32:55 +0000 (08:32 -0600)]
test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agolib: strto: Stop detection when invalid char is used
Michal Simek [Wed, 8 Apr 2020 08:09:16 +0000 (10:09 +0200)]
lib: strto: Stop detection when invalid char is used

This issue has been found when mtd partition are specified. Autodetection
code should stop when the first invalid char is found.

Here is the example of commands:
setenv mtdids nand0=memory-controller@e000e000
setenv mtdparts "mtdparts=nand0:4m(boot),4m(env),64m(kernel),96m(rootfs)"
mtd list

Before:
Zynq> mtd list
List of MTD devices:
* nand0
  - type: NAND flash
  - block size: 0x20000 bytes
  - min I/O: 0x800 bytes
  - OOB size: 64 bytes
  - OOB available: 16 bytes
  - ECC strength: 1 bits
  - ECC step size: 2048 bytes
  - bitflip threshold: 1 bits
  - 0x000000000000-0x000010000000 : "nand0"
  - 0x000000000000-0x000000400000 : "boot"
  - 0x000000400000-0x000000800000 : "env"
  - 0x000000800000-0x000006c00000 : "kernel"
  - 0x000006c00000-0x000010000000 : "rootfs"

Where it is visible that kernel partition has 100m instead of 64m

After:
Zynq> mtd list
* nand0
  - type: NAND flash
  - block size: 0x20000 bytes
  - min I/O: 0x800 bytes
  - OOB size: 64 bytes
  - OOB available: 16 bytes
  - ECC strength: 1 bits
  - ECC step size: 2048 bytes
  - bitflip threshold: 1 bits
  - 0x000000000000-0x000010000000 : "nand0"
  - 0x000000000000-0x000000400000 : "boot"
  - 0x000000400000-0x000000800000 : "env"
  - 0x000000800000-0x000004800000 : "kernel"
  - 0x000004800000-0x00000a800000 : "rootfs"

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Fixes: 0486497e2b5f ("lib: Improve _parse_integer_fixup_radix base 16 detection")
Tested-by: Heiko Schocher <hs@denx.de>
Tested-by: Pali Rohár <pali@kernel.org>
4 years agomtd: nand: pxa3xx: fix raw read when last_chunk_size == 0
Baruch Siach [Sun, 5 Apr 2020 16:19:31 +0000 (19:19 +0300)]
mtd: nand: pxa3xx: fix raw read when last_chunk_size == 0

Commit 6293b0361d9 ("mtd: nand: pxa3xx: add raw read support") added the
local data_len variable in handle_data_pio() to track read size, but
forgot to update the condition of drain_fifo() call. That happens to
work when the layout last_chunk_size != 0. But when last_chunk_size ==
0, drain_fifo() is not called to read the last chunk, which leads to
"Wait timeout!!!" error. Fix this.

Fixes: 6293b0361d9 ("mtd: nand: pxa3xx: add raw read support")
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
4 years agocommon/board_f: Make reserve_mmu generic
Ovidiu Panait [Sun, 29 Mar 2020 17:57:41 +0000 (20:57 +0300)]
common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoarm: asm/cache.c: Introduce arm_reserve_mmu
Ovidiu Panait [Sun, 29 Mar 2020 17:57:40 +0000 (20:57 +0300)]
arm: asm/cache.c: Introduce arm_reserve_mmu

As a preparation for turning reserve_mmu into an arch-specific variant,
introduce arm_reserve_mmu on ARM. It implements the default routine for
reserving memory for MMU TLB and needs to be weakly defined in order to allow
for machines to override it.

Without this decoupling, after introducing arch_reserve_mmu, there would be two
weak definitions for it, one in common/board_f.c and one in
arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocommon/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c
Ovidiu Panait [Sun, 29 Mar 2020 17:57:39 +0000 (20:57 +0300)]
common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMerge tag 'u-boot-stm32-20200424' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Fri, 24 Apr 2020 18:07:59 +0000 (14:07 -0400)]
Merge tag 'u-boot-stm32-20200424' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm

- Solve stm32mp15 pinctrl dts issue (patch conflict in branches master and next)
- Split device tree for DHCOR Som and AV 96 board
- Update PLL4 setting in AV96 board
- Enable bootd, iminfo, imxtract on DHCOM

4 years agoRevert "sunxi: Fix PHY regression on A20-OLinuXino-Lime2 and A20-Olimex-SOM-EVB"
Tom Rini [Fri, 24 Apr 2020 17:13:33 +0000 (13:13 -0400)]
Revert "sunxi: Fix PHY regression on A20-OLinuXino-Lime2 and A20-Olimex-SOM-EVB"

While the change is correct, generally, it was not intended to be pushed
just yet.

This reverts commit b897306341024695d17296efc1f9d83d06368209.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge branch '2020-04-24-master-imports'
Tom Rini [Fri, 24 Apr 2020 17:04:38 +0000 (13:04 -0400)]
Merge branch '2020-04-24-master-imports'

- Assorted minor bugfixes.
- Resync fixdep with Linux v5.7-rc1
- Numerous changes to reduce SPL in various cases including when we have
  read-only env support.
- Allow mkimage to align the header on FIT images to a specific size.

4 years agosunxi: Fix PHY regression on A20-OLinuXino-Lime2 and A20-Olimex-SOM-EVB
Tom Rini [Fri, 24 Apr 2020 16:30:45 +0000 (12:30 -0400)]
sunxi: Fix PHY regression on A20-OLinuXino-Lime2 and A20-Olimex-SOM-EVB

When moving the PHYLIB PHY drivers around in Kconfig we did not at the
same time perform a careful migration of the related drivers and
sub-options.  This lead to the case where previously Kconfig-enabled
driver choices were now disabled on some platforms.  Correct this by
enabling both the PHY driver and sub-option on the above referenced
platforms.

Fixes: af2cbfd6b982 ("drivers: net: Provide Kconfig menu for PHYLIB")
Fixes: 8728c97eff5b ("configs: Re-sync")
Reported-by: Dario <dario86@tutamail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
After checking back on the original commit I can see that these are the
only two platforms to have been broken in the change.

4 years agoARM: stm32: Enable bootd, iminfo, imxtract on DHCOM
Marek Vasut [Wed, 1 Apr 2020 15:13:15 +0000 (17:13 +0200)]
ARM: stm32: Enable bootd, iminfo, imxtract on DHCOM

Enable these standard U-Boot commands for image manipulation and for
starting the default boot command using 'boot' command in U-Boot shell.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agotravis: Correct error checking when building boards
Simon Glass [Sun, 19 Apr 2020 23:02:32 +0000 (17:02 -0600)]
travis: Correct error checking when building boards

At present if buildman reports an error, the travis build still succeeds.

This is because the travis script does not stop when it sees errors; nor
does it automatically return the exit code. Also the current error
checking never triggers since 'ret' is not set.

Fix this by setting 'ret' correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
4 years agomkimage: fit: Free buf directly in fit_extract_data()
Bin Meng [Sat, 18 Apr 2020 08:59:11 +0000 (01:59 -0700)]
mkimage: fit: Free buf directly in fit_extract_data()

If given ptr to free() is NULL, no operation is performed.
Hence we can just free buf directly in fit_extract_data().

Signed-off-by: Bin Meng <bin.meng@windriver.com>
4 years agomkimage: fit: Unmmap the memory before closing fd in fit_import_data()
Lihua Zhao [Sat, 18 Apr 2020 08:59:10 +0000 (01:59 -0700)]
mkimage: fit: Unmmap the memory before closing fd in fit_import_data()

Without calling munmap(), the follow-up call to open() the same file
with a flag O_TRUNC seems not to cause any issue on Linux, but it fails
on Windows with error like below:

    Can't open kernel_fdt.itb.tmp: Permission denied

Fix this by unmapping the memory before closing fd in fit_import_data().

Signed-off-by: Lihua Zhao <lihua.zhao@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
4 years agotools: Remove the out-of-date MinGW support codes
Bin Meng [Sat, 18 Apr 2020 08:59:09 +0000 (01:59 -0700)]
tools: Remove the out-of-date MinGW support codes

MinGW build for U-Boot tools has been broken for years. The official
support of Windows build is now MSYS2. Remove the MinGW support codes.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
4 years agodoc: invalid doc link in rstFlatTable.py
Heinrich Schuchardt [Sat, 18 Apr 2020 00:16:34 +0000 (02:16 +0200)]
doc: invalid doc link in rstFlatTable.py

Remove an invalid documentation link in rstFlatTable.py. This synchronizes
the file with Linux next-20200413.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agospl: Kconfig: de-dup SPL_DM_GPIO definition
Joel Johnson [Fri, 17 Apr 2020 15:42:29 +0000 (09:42 -0600)]
spl: Kconfig: de-dup SPL_DM_GPIO definition

Two nearly concurrent commits (d4d65e112 and bcee8d676) added a
SPL_DM_GPIO symbol. Resolve the duplication in favor of the version
in drivers/gpio/Kconfig.

Signed-off-by: Joel Johnson <mrjoel@lixil.net>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
4 years agofixdep: Re-sync with Linux 5.7-rc1
Masahiro Yamada [Thu, 16 Apr 2020 05:01:45 +0000 (14:01 +0900)]
fixdep: Re-sync with Linux 5.7-rc1

fixdep is a standalone host program, so we can just re-sync it with
the latest Linux in one commit.

I kept the U-Boot own code block surrounded by
/* hack for U-Boot */ ... /* U-boot hack end */.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agofixdep: handle CONFIG_IS_ENABLE() and friends for TPL
Masahiro Yamada [Thu, 16 Apr 2020 05:01:44 +0000 (14:01 +0900)]
fixdep: handle CONFIG_IS_ENABLE() and friends for TPL

Since commit f1c6e1922eb5 ("spl: dm: use CONFIG_IS_ENABLED to test for
the DM option"), CONFIG_IS_ENABLED() handles CONFIG_TPL_* options, but
fixdep still cannot because it hard-codes the "SPL_" prefix as follows:

    char tmp_buf[256] = "SPL_"; /* hack for U-Boot */

Take care of the "TPL_" prefix too.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
4 years ago.mailmap: map Ruchika Gupta's mail address
Heinrich Schuchardt [Wed, 15 Apr 2020 18:47:38 +0000 (18:47 +0000)]
.mailmap: map Ruchika Gupta's mail address

Freescale mail addresses are not valid anymore.

Reported-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agodlmalloc: remove unit test support in SPL
Heinrich Schuchardt [Wed, 15 Apr 2020 16:46:23 +0000 (18:46 +0200)]
dlmalloc: remove unit test support in SPL

We cannot run unit tests in SPL. So remove the unit test support.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agolib: do not provide hexdump in SPL
Heinrich Schuchardt [Wed, 15 Apr 2020 16:46:22 +0000 (18:46 +0200)]
lib: do not provide hexdump in SPL

SPL should not be enlarged by building with CONFIG_HEXDUMP=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agocommon: image_sign_info helper functions in SPL
Heinrich Schuchardt [Wed, 15 Apr 2020 16:46:21 +0000 (18:46 +0200)]
common: image_sign_info helper functions in SPL

Do not build image_sign_info helper functions in SPL if not needed.

Fixes: b983cc2da0ba ("lib: rsa: decouple rsa from FIT image verification")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agolib: do not build OID registry in SPL
Heinrich Schuchardt [Wed, 15 Apr 2020 16:46:19 +0000 (18:46 +0200)]
lib: do not build OID registry in SPL

The OID registry is only used by crypto functions that are not built in
SPL. So we should not build it in SPL.

Fixes: a9b45e6e8382 ("lib: add oid registry utility")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agotools: image-host.c: use correct output format
Heinrich Schuchardt [Sat, 11 Apr 2020 16:36:04 +0000 (18:36 +0200)]
tools: image-host.c: use correct output format

When building on a 32bit host the following warning occurs:

tools/image-host.c: In function ‘fit_image_read_data’:
tools/image-host.c:310:42: warning: format ‘%ld’ expects argument of type
‘long int’, but argument 3 has type ‘ssize_t’ {aka ‘int’} [-Wformat=]
   printf("Can't read all file %s (read %ld bytes, expexted %ld)\n",
                                        ~~^
                                        %d
          filename, n, sbuf.st_size);
                    ~

n is of type ssize_t so we should use %zd for printing.

Fixes: 7298e422504e ("mkimage: fit: add support to encrypt image with aes")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMakefile: ARMv7-M has no CPSR register
Heinrich Schuchardt [Fri, 10 Apr 2020 09:10:32 +0000 (11:10 +0200)]
Makefile: ARMv7-M has no CPSR register

Compiling on ARMv7-M fails when trying to address the CPSR register which
is not available on this architecture.

Atomic functions refer to the CPSR register if compiled with
arch/arm/include/asm/proc-armv/system.h. On ARMv7-M we should hence
use arch/arm/thumb1/include/asm/proc-armv/system.h instead.

Cf. https://stackoverflow.com/questions/61097841/error-selected-processor-does-not-support-requested-special-purpose-register

Reported-by: Sicris Rey Embay <sicris.embay@gmail.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoqemu: don't allow to select 32- and 64-bit
Heinrich Schuchardt [Fri, 10 Apr 2020 07:37:21 +0000 (09:37 +0200)]
qemu: don't allow to select 32- and 64-bit

TARGET_QEMU_ARM_64BIT and TARGET_QEMU_ARM_32BIT should be mutually
exclusive.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agofvp: Add support for loading Android boot images via semihosting
Peter Collingbourne [Sat, 4 Apr 2020 02:58:24 +0000 (19:58 -0700)]
fvp: Add support for loading Android boot images via semihosting

FVP now loads an Android boot image named boot.img if available,
otherwise it falls back to the existing code path.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
4 years agomkimage: fit_image: Add option to make fit header align
Kever Yang [Mon, 30 Mar 2020 03:56:24 +0000 (11:56 +0800)]
mkimage: fit_image: Add option to make fit header align

The image is usually stored in block device like emmc, SD card, make the
offset of image data aligned to block(512 byte) can avoid data copy
during boot process.
eg. SPL boot from FIT image with external data:
- SPL read the first block of FIT image, and then parse the header;
- SPL read image data separately;
- The first image offset is the base_offset which is the header size;
- The second image offset is just after the first image;
- If the offset of imge does not aligned, SPL will do memcpy;
The header size is a ramdon number, which is very possible not aligned, so
add '-B size'to specify the align size in hex for better performance.

example usage:
  ./tools/mkimage -E -f u-boot.its -B 0x200 u-boot.itb

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agolibfdt: Make fdtdec_get_child_count() available for HOST
Kever Yang [Mon, 30 Mar 2020 03:56:23 +0000 (11:56 +0800)]
libfdt: Make fdtdec_get_child_count() available for HOST

The tool need to use fdtdec_get_child_count(), make it available for
HOST_CC.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotool: use ALIGN() to align the size
Kever Yang [Mon, 30 Mar 2020 03:56:22 +0000 (11:56 +0800)]
tool: use ALIGN() to align the size

Use the ALIGN() for size align so that the code is more readable.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotools: imx8mimage: remove redundant code
Kever Yang [Mon, 30 Mar 2020 03:56:21 +0000 (11:56 +0800)]
tools: imx8mimage: remove redundant code

The align for fit_size has been done twice, remove the first one for it
does not make any sense.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agotools: kwbimage: use common ALIGN to do the size align
Kever Yang [Mon, 30 Mar 2020 03:56:20 +0000 (11:56 +0800)]
tools: kwbimage: use common ALIGN to do the size align

The ALIGN() is now available at imagetool.h, migrate to use it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agotools: mkimage: use common ALIGN to do the size align
Kever Yang [Mon, 30 Mar 2020 03:56:19 +0000 (11:56 +0800)]
tools: mkimage: use common ALIGN to do the size align

The ALIGN() is now available at imagetool.h, migrate to use it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agotool: aisimage: use ALIGN instead of self defiend macro
Kever Yang [Mon, 30 Mar 2020 03:56:18 +0000 (11:56 +0800)]
tool: aisimage: use ALIGN instead of self defiend macro

The ALIGN() is available at imagetool.h, no need to self define one.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agotool: Move ALIGN_MASK to header as common MACRO
Kever Yang [Mon, 30 Mar 2020 03:56:17 +0000 (11:56 +0800)]
tool: Move ALIGN_MASK to header as common MACRO

The ALIGN code is need by many files who need handle structure or image
align, so move the macro to imagetool.h file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agodocs: Fix conf.py for Sphinx 2.0
Jonathan Corbet [Fri, 20 Mar 2020 06:18:30 +0000 (02:18 -0400)]
docs: Fix conf.py for Sphinx 2.0

commit 3bc8088464712fdcb078eefb68837ccfcc413c88 upstream.

Our version check in Documentation/conf.py never envisioned a world where
Sphinx moved beyond 1.x.  Now that the unthinkable has happened, fix our
version check to handle higher version numbers correctly.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
[rebase for u-boot]
Signed-off-by: Sean Anderson <seanga2@gmail.com>
4 years agoenv/sf.c: drop private CMD_SAVEENV logic
Rasmus Villemoes [Wed, 19 Feb 2020 09:47:43 +0000 (09:47 +0000)]
env/sf.c: drop private CMD_SAVEENV logic

Deciding whether to compile the env_sf_save() function based solely on
CONFIG_SPL_BUILD is wrong: For U-Boot proper, it leads to a build
warning in case CONFIG_CMD_SAVEENV=n (because the env_save_ptr() macro
causes the function to indeed not be referenced anywhere). And for
SPL, when one selects CONFIG_SPL_SAVEENV, one obviously expects to
actually be able to save the environment.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agoenv/ext4.c: remove CONFIG_CMD_SAVEENV ifdef
Rasmus Villemoes [Wed, 19 Feb 2020 09:47:42 +0000 (09:47 +0000)]
env/ext4.c: remove CONFIG_CMD_SAVEENV ifdef

Removing this ifdef/endif pair yields a "defined but unused warning"
for CONFIG_CMD_SAVEENV=n, but that vanishes if we use the ENV_SAVE_PTR
macro instead. This gives slightly better compile testing, and
moreover, it's possible to have

  CONFIG_CMD_SAVEENV=n
  CONFIG_SPL_SAVEENV=y
  SPL_ENV_IS_IN_EXT4=y

in which case env_ext4_save would erroneously not be compiled in.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agoenv/fat.c: remove private CMD_SAVEENV logic
Rasmus Villemoes [Wed, 19 Feb 2020 09:47:41 +0000 (09:47 +0000)]
env/fat.c: remove private CMD_SAVEENV logic

Always compile the env_fat_save() function, and let
CONFIG_IS_ENABLED(SAVEENV) (via the ENV_SAVE_PTR macro) decide whether
it actually ends up being compiled in.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agoenv_internal.h: add alternative ENV_SAVE_PTR macro
Rasmus Villemoes [Wed, 19 Feb 2020 09:47:40 +0000 (09:47 +0000)]
env_internal.h: add alternative ENV_SAVE_PTR macro

The current definition of the env_save_ptr does not take SPL_SAVEENV
into account. Moreover, the way it is implemented means that drivers
need to guard the definitions of their _save methods with ifdefs to
avoid "defined but unused" warnings in case CMD_SAVEENV=n.

The ifdeffery can be avoided by using a "something ? x : NULL"
construction instead and still have the compiler elide the _save
method when it is not referenced. Unfortunately we can't just switch
the existing env_save_ptr macro, since that would give a lot of build
errors unless all the ifdeffery is removed at the same time.
Conversely, removing that ifdeffery first would merely lead to the
"defined but unused" warnings temporarily, but for some storage
drivers it requires a bit more work than just removing their private
CMD_SAVEENV logic.

So introduce an alternative to env_save_ptr, which for lack of a
better name is simply uppercased, allowing one to update storage
drivers piecemeal to both reduce their ifdeffery and honour
CONFIG_SPL_SAVEENV.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agoenv: add SAVEENV as an alias of the CMD_SAVEENV symbol
Rasmus Villemoes [Wed, 19 Feb 2020 09:47:39 +0000 (09:47 +0000)]
env: add SAVEENV as an alias of the CMD_SAVEENV symbol

Currently, testing whether to compile in support for saving the
environment is a bit awkward when one needs to take SPL_SAVEENV into
account, and quite a few storage drivers currently do not honour
SPL_SAVEENV.

To make it a bit easier to decide whether environment saving should be
enabled, introduce SAVEENV as an alias for the CMD_SAVEENV
symbol. Then one can simply use

  CONFIG_IS_ENABLED(SAVEENV)

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agobootcount_ext: Add flag to enable/disable bootcount
Frédéric Danis [Tue, 17 Mar 2020 16:59:09 +0000 (17:59 +0100)]
bootcount_ext: Add flag to enable/disable bootcount

After a successful upgrade, multiple problem during boot sequence may
trigger the altbootcmd process.
This patch adds a version and an upgrade_available entries to the
bootcount file to enable/disable the bootcount check.
When failing to read the bootcount file it will consider that bootcount is
enabled, acting as previously, and update the file accordingly.

The bootcount file is only saved when `upgrade_available` is true, this
allows to save writes to the filesystem.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agomake env_entry::callback conditional on !CONFIG_SPL_BUILD
Rasmus Villemoes [Thu, 27 Feb 2020 13:56:12 +0000 (13:56 +0000)]
make env_entry::callback conditional on !CONFIG_SPL_BUILD

The callback member of struct env_entry is always NULL for an SPL
build. Removing it thus saves a bit of run-time memory in the
SPL (when CONFIG_SPL_ENV_SUPPORT=y) since struct env_entry is embedded
in struct env_entry_node - i.e. about 2KB for the normal case of
512+change hash table entries.

Two small fixups are needed for this, all other references to the
callback member are already under !CONFIG_SPL_BUILD: Don't initialize
.callback in set_flags() - hsearch_r doesn't use that value
anyway. And make env_callback_init() initialize ->callback to NULL for
a new entry instead of relying on an unused or deleted entry having
NULL in ->callback.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolib/hashtable.c: don't test ->callback in SPL
Rasmus Villemoes [Thu, 27 Feb 2020 13:56:11 +0000 (13:56 +0000)]
lib/hashtable.c: don't test ->callback in SPL

In SPL, environment callbacks are not supported, so e->callback is
always NULL. Removing this makes the SPL a little smaller (about 400
bytes in my ppc build) with no functional change.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolib/hashtable.c: create helper for calling env_entry::callback
Rasmus Villemoes [Thu, 27 Feb 2020 13:56:11 +0000 (13:56 +0000)]
lib/hashtable.c: create helper for calling env_entry::callback

This is preparation for compiling out the "call the callback" code and
associated error handling for SPL, where ->callback is always NULL.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoenv: remove callback.o for an SPL build
Rasmus Villemoes [Thu, 27 Feb 2020 13:56:10 +0000 (13:56 +0000)]
env: remove callback.o for an SPL build

env.h says this about about callback declarations (U_BOOT_ENV_CALLBACK):

 * For SPL these are silently dropped to reduce code size, since environment
 * callbacks are not supported with SPL.

So env_callback_init() does a lot of work to not find anything in the
guaranteed empty env_clbk list. Drop callback.o entirely from the link
and stub out the only public function defined in callback.o. This cuts
about 600 bytes from the SPL on my ppc build.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoeth: mtk-eth: add mt7531 switch support in mediatek eth driver
Landen Chao [Tue, 18 Feb 2020 08:49:37 +0000 (16:49 +0800)]
eth: mtk-eth: add mt7531 switch support in mediatek eth driver

mt7531 is a 7-ports switch with 5 embedded giga phys, and uses the same
MAC design of mt7530. The cpu port6 supports SGMII only. The cpu port5
supports RGMII or SGMII in different model.

mt7531 is connected to mt7622 via both RGMII and SGMII interfaces.
In this patch, mt7531 cpu port5 or port6 is configured to maximum
capability to align CPU MAC setting.

The dts has been committed in the commit 6efa450565cdc ("arm: dts:
mediatek: add ethernet and sgmii dts node for mt7622")

Signed-off-by: Landen Chao <landen.chao@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
4 years agowatchdog: mpc8xx_wdt: Allow selection of watchdog mode through environment
Charles Frey [Wed, 19 Feb 2020 16:50:15 +0000 (16:50 +0000)]
watchdog: mpc8xx_wdt: Allow selection of watchdog mode through environment

The mpc8xx watchdog can work either in 'reset mode' or 'NMI mode'.
The selection can be done at startup only.
It is desirable to select the mode without rebuilding U-boot.
It is also desirable to disable the watchdog without rebuilding.

At watchdog startup, check environment variable 'watchdog_mode'.
If it is 'off', the watchdog is not started. If it is 'nmi',
the watchdog is started in NMI mode. Otherwise, it is started
in reset mode which is the default mode.

Signed-off-by: Charles Frey <charles.frey@c-s.fr>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
4 years agoARM: dts: stm32: Split AV96 into DHCOR SoM and AV96 board
Marek Vasut [Tue, 31 Mar 2020 17:51:36 +0000 (19:51 +0200)]
ARM: dts: stm32: Split AV96 into DHCOR SoM and AV96 board

The AV96 is in fact an assembly of DH Electronics DHCOR SoM on top
of an AV96 reference board. Split the DTs to reflect that and make
sure to DHCOR SoM can be reused on other boards easily.

It is also highly recommended to configure the board for the DHCOM
make stm32mp15_dhcom_basic_defconfig
make DEVICE_TREE=stm32mp15xx-dhcor-avenger96
as that permits reusing the board code for the DH components, like
accessing and reading out the ethernet MAC from EEPROM.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Change-Id: I7db47280d4eb0d668eb4e006355240271154f97f

4 years agoARM: dts: stm32: Adjust PLL4 settings on AV96
Marek Vasut [Tue, 31 Mar 2020 17:51:35 +0000 (19:51 +0200)]
ARM: dts: stm32: Adjust PLL4 settings on AV96

The PLL4 is supplying SDMMC12, SDMMC3 and SPDIF with 120 MHz and
FDCAN with 96 MHz. This isn't good for the SDMMC interfaces, which
can not easily divide the clock down to e.g. 50 MHz for high speed
SD and eMMC devices, so those devices end up running at 30 MHz as
that is 120 MHz / 4. Adjust the PLL4 settings such that both PLL4P
and PLL4R run at 100 MHz instead, which is easy to divide to 50MHz
for optimal operation of both SD and eMMC, SPDIF clock are not that
much slower and FDCAN is also unaffected.

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: dts: stm32mp1: remove file stm32mp157-pinctrl.dtsi
Patrick Delaunay [Tue, 21 Apr 2020 10:27:35 +0000 (12:27 +0200)]
ARM: dts: stm32mp1: remove file stm32mp157-pinctrl.dtsi

Remove the unnecessary file stm32mp157-pinctrl.dtsi and
solve all issues introduced by the commit 891483186052b2598 ("Merge branch
 'next'") after a conflict on the patch applied in the next branch in
commit 1a4f57c895cc ("ARM: dts: stm32mp1: DT alignment with Linux 5.6-rc1")

Need to reapplied on stm32mp15-pinctrl.dtsi the the 3 patches
applied previously on file "stm32mp157-pinctrl.dtsi" in v2020.04
- commit 4fdbe6487daa ("ARM: dts: stm32: Add alternate pinmux for SDMMC1
 direction pins")'
- commit 5fdcba64027f ("ARM: dts: stm32: Add alternate pinmux for SDMMC2
 pins 4-7")'
- commit 955de5111112 ("ARM: dts: stm32: Add alternate pinmux for ethernet
 RGMII")'

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agodm: pinctrl: Use right device pointer for configuring pinctrl
Lokesh Vutla [Wed, 22 Apr 2020 17:25:31 +0000 (22:55 +0530)]
dm: pinctrl: Use right device pointer for configuring pinctrl

commit 719cab6d2e2bf ("dm: pinctrl: convert pinctrl-single to livetree")
converted pinctrl driver to livetree. In this conversion, the call to
read pinctrl-single,pins/bits property is provided with pinctrl device
pointer instead of pinctrl config pointer. Because of this none of the
pins gets configured. Fix it by passing the right udevice pointer.

Fixes: 719cab6d2e2bf ("dm: pinctrl: convert pinctrl-single to livetree")
Reported-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Thu, 23 Apr 2020 12:24:47 +0000 (08:24 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Adds few DT related fixes required for Linux EFI stub to work on
  RISC-V.
- Makes SBI v0.2 the default SBI version to work with OpenSBI v0.7.
- Revert "riscv: qemu: clear kernel-start/-end in device tree as
  workaround for BBL"
- Remove unnecessary CONFIG_IS_ENABLED().

4 years agoriscv: Move all fdt fixups together
Atish Patra [Tue, 21 Apr 2020 18:15:04 +0000 (11:15 -0700)]
riscv: Move all fdt fixups together

Keep all the fdt fixups together for better code management.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoriscv: Copy the reserved-memory nodes to final DT
Atish Patra [Tue, 21 Apr 2020 18:15:03 +0000 (11:15 -0700)]
riscv: Copy the reserved-memory nodes to final DT

The DT used by U-Boot may be different from the DT being passed to
the OS if the DT is loaded from external media such as network or
mmc. In that case, the reserved-memory node needs to be copied to
the DT passed to the OS.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoriscv: Setup reserved-memory node for FU540
Atish Patra [Tue, 21 Apr 2020 18:15:02 +0000 (11:15 -0700)]
riscv: Setup reserved-memory node for FU540

FU540 uses OF_SEPARATE instead of OF_PRIOR_STAGE.

Enable OF_BOARD_FIXUP to update the DT with reserved-memory node.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoriscv: Provide a mechanism to fix DT for reserved memory
Atish Patra [Tue, 21 Apr 2020 18:15:01 +0000 (11:15 -0700)]
riscv: Provide a mechanism to fix DT for reserved memory

In RISC-V, M-mode software can reserve physical memory regions
by setting appropriate physical memory protection (PMP) csr. As the
PMP csr are accessible only in M-mode, S-mode U-Boot can not read
this configuration directly. However, M-mode software can pass this
information via reserved-memory node in device tree so that S-mode
software can access this information.

This patch provides a framework to copy to the reserved-memory node
from one DT to another. This will be used to update the DT used by
U-Boot and the DT passed to the next stage OS.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
4 years agofdtdec: Fix boundary check
Atish Patra [Tue, 21 Apr 2020 18:15:00 +0000 (11:15 -0700)]
fdtdec: Fix boundary check

In U-Boot, the reserved memory end address is considered as a inclusive
address. This notion is followed while adding a reserved memory node to
the DT.

For example:
end_address = start_address + size - 1

Follow the same notion and fix the end address computation while checking
for existing nodes.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoriscv: Add boot hartid to device tree
Atish Patra [Tue, 21 Apr 2020 18:14:59 +0000 (11:14 -0700)]
riscv: Add boot hartid to device tree

Linux booting protocol mandates that register "a0" contains the hartid.
However, U-Boot can not pass the hartid via a0 during standard UEFI
protocol. DT nodes are commonly used to pass such information to the OS.

Add a DT node under chosen node to indicate the boot hartid. EFI stub
in Linux kernel will parse this node and pass it to the real kernel
in "a0" before jumping to it.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Bin Meng <bmeng.cn@gmail.com>