oweals/u-boot.git
4 years agoarm64: dts: rk3399-puma: Move u-boot properties into -u-boot.dtsi
Jagan Teki [Tue, 28 Apr 2020 10:00:14 +0000 (15:30 +0530)]
arm64: dts: rk3399-puma: Move u-boot properties into -u-boot.dtsi

Move U-Boot specific properties into rk3399-puma u-boot
specific dtsi file.

This would help to sync the devicetrees from Linux whenever
required instead of adding specific nodes.

Cc: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: dts: rock64: Fix XHCI usage
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:54 +0000 (14:52 +0800)]
rockchip: dts: rock64: Fix XHCI usage

If the VBUS regulator is always-on, XHCI will fail to detect USB 3.0
devices; USB 2.0 devices will work however.

Make the VBUS regulator controllable and tie it to only the XHCI. This
makes all three USB ports usable.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3328: Add support for ROC-RK3328-CC board
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:53 +0000 (14:52 +0800)]
rockchip: rk3328: Add support for ROC-RK3328-CC board

The ROC-RK3328-CC from Firefly and Libre Computer Project is a credit
card size development board based on the Rockchip RK3328 SoC, with:

  - 1/2/4 GB DDR4 DRAM
  - eMMC connector for optional module
  - micro SD card slot
  - 1 x USB 3.0 host port
  - 2 x USB 2.0 host port
  - 1 x USB 2.0 OTG port
  - HDMI video output
  - TRRS connector with audio and composite video output
  - gigabit Ethernet
  - consumer IR receiver
  - debug UART pins

The ROC-RK3328-CC has the enable pin of the SD card power switch tied
to GPIO_0_D6. This pin also has the function SDMMC0_PWREN, which is
muxed by default. SDMMC0_PWREN is an active high signal controlled by
the MMC controller, however the switch enable is active low, and
pulled low (enabled) by default to make things work on boot.

As such, we need to mux away from SDMMC0_PWREN and use GPIO to enable
power to the card. The default GPIO state for the pin is pull-down and
input, which doesn't require extra configuration when paired with the
external pull-down and active low switch.

Deal with this by enabling regulator support in SPL, and setting
"u-boot,dm-spl" for the regulator and other device nodes needed for
muxing the pin.

The device tree file is synced from the Linux kernel next-20200324.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: dts: rk3328: Sync device tree files from Linux
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:52 +0000 (14:52 +0800)]
rockchip: dts: rk3328: Sync device tree files from Linux

This syncs rk3328 device tree files from the Linux kernel next-20200324.
The last commit to touch these files is:

    b2411befed60 ("arm64: dts: add bus to rockchip amba nodenames")

Additional changes not yet in the Linux kernel include:

    arm64: dts: rockchip: rk3328: drop #address-cells, #size-cells from grf node
    arm64: dts: rockchip: rk3328: drop non-existent gmac2phy pinmux options
    arm64: dts: rockchip: rk3328: Replace RK805 PMIC node name with "pmic"

Changes include:

  - conversion of raw pin numbers to macros
  - removal of deprecated RK_FUNC_* macros
  - update of device tree binding headers
  - new devices
  - device tree cleanups
  - gmac2phy disabled in -u-boot.dtsi as it is not supported in U-boot

This includes a re-ordering of the USB device nodes compared to upstream
Linux, moving the dwc2 OTG controller after the EHCI/OHCI nodes. This is
currently required as otherwise the dwc2 controller would not be able to
detect devices in some cases. This may be due to lack of USB PHY support
in U-boot.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agorockchip: rk3328: Disable generic PHY support
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:51 +0000 (14:52 +0800)]
rockchip: rk3328: Disable generic PHY support

The USB PHYs on the RK3328 aren't supported, nor are any other generic
PHYs. Because upstream Linux device trees already include the USB PHYs
and references in the USB hosts, this would result in various calls
to the generic PHY API to fail.

Instead, just disable generic PHY support for now.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agodt-bindings: power: rk3328-power: sync from upstream Linux kernel
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:50 +0000 (14:52 +0800)]
dt-bindings: power: rk3328-power: sync from upstream Linux kernel

This syncs the rk3328 power domain header file from Linux kernel
next-20200324, to support newer hardware blocks when syncing the
device tree files.

The last non-merge commit to touch it was

    b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to files with no license")

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Loic Devulder <ldevulder@suse.com>
Tested-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agodt-bindings: clock: rk3328: sync from upstream Linux kernel
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:49 +0000 (14:52 +0800)]
dt-bindings: clock: rk3328: sync from upstream Linux kernel

This syncs the rk3328 clock header file from Linux kernel next-20200324,
to support newer hardware blocks when syncing the device tree files.

The last non-merge commit to touch it was

    0dc14b013f79 ("clk: rockchip: add clock id for watchdog pclk on rk3328")

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Loic Devulder <ldevulder@suse.com>
Tested-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agorockchip: dts: rk3328: Move OTG node's hnp-srp-disable to rk3328-u-boot.dtsi
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:48 +0000 (14:52 +0800)]
rockchip: dts: rk3328: Move OTG node's hnp-srp-disable to rk3328-u-boot.dtsi

The "hnp-srp-disable" property for dwc2 is specific to U-boot, not part
of upstream Linux's device tree bindings.

Move it to rk3328-u-boot.dtsi to avoid losing it when syncing device
tree files.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: dts: rk3328-evb: Move gmac2io related nodes to -u-boot.dtsi
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:47 +0000 (14:52 +0800)]
rockchip: dts: rk3328-evb: Move gmac2io related nodes to -u-boot.dtsi

The device tree file for rk3328-evb in the Linux kernel does not have
gmac2io enabled. Instead, gmac2phy is enabled, but that is not supported
in U-boot.

Move the gmac2io related nodes to rk3328-evb-u-boot.dtsi to preserve the
current functionality. When the device tree files are synced, gmac2phy
should be marked as "broken" in -u-boot.dtsi files.

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Loic Devulder <ldevulder@suse.com>
Tested-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agorockchip: dts: rk3328-evb: Move vcc5v0-host-xhci-drv to -u-boot.dtsi
Chen-Yu Tsai [Mon, 27 Apr 2020 06:52:46 +0000 (14:52 +0800)]
rockchip: dts: rk3328-evb: Move vcc5v0-host-xhci-drv to -u-boot.dtsi

USB 3.0 is only supported in U-boot, not in the Linux kernel where the
device tree files are ultimately synced from. While the xhci node was
moved, the external vbus regulator was not.

Move it as well.

Fixes: 2e91e2025c1b ("rockchip: rk3328: migrate u-boot node to -u-boot.dtsi")
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Loic Devulder <ldevulder@suse.com>
Tested-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agorockchip: board: roc-pc-rk3399: Remove support for push button
Suniel Mahesh [Thu, 2 Apr 2020 12:52:30 +0000 (18:22 +0530)]
rockchip: board: roc-pc-rk3399: Remove support for push button

In case of a power interruption, human intervention is required which
is not desirable if the device is installed at a remote location. Drop
yellow LED as it is not much of use. Keep red LED(diy-led) as it is, to
indicate board in full power mode.

Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: px30: Enable CONFIG_RNG_ROCKCHIP
Lin Jinhan [Tue, 31 Mar 2020 09:40:01 +0000 (17:40 +0800)]
rockchip: px30: Enable CONFIG_RNG_ROCKCHIP

CONFIG_RNG_ROCKCHIP/CONFIG_DM_RNG is enabled.

Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3399: Enable CONFIG_RNG_ROCKCHIP
Lin Jinhan [Tue, 31 Mar 2020 09:40:00 +0000 (17:40 +0800)]
rockchip: rk3399: Enable CONFIG_RNG_ROCKCHIP

CONFIG_RNG_ROCKCHIP/CONFIG_DM_RNG is enabled.

Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rng: Add a driver for random number generator(rng) device
Lin Jinhan [Tue, 31 Mar 2020 09:39:59 +0000 (17:39 +0800)]
rockchip: rng: Add a driver for random number generator(rng) device

Add a driver for the rng device found on rockchip platforms.
Support rng module of crypto v1 and crypto v2.

Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm: dts: rockchip: px30: add and enable rng node
Lin Jinhan [Tue, 31 Mar 2020 09:39:58 +0000 (17:39 +0800)]
arm: dts: rockchip: px30: add and enable rng node

Add enable rng node in px30-evb-u-boot.dtsi.

Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm: dts: rockchip: rk3399: add and enable rng node
Lin Jinhan [Tue, 31 Mar 2020 09:39:57 +0000 (17:39 +0800)]
arm: dts: rockchip: rk3399: add and enable rng node

Add rng node in rk3399-u-boot.dtsi and enable it in
rk3399-evb-u-boot.dtsi.

Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: px30-evb: remove redundant include file
Kever Yang [Tue, 31 Mar 2020 07:33:46 +0000 (15:33 +0800)]
rockchip: px30-evb: remove redundant include file

The file <board name>-u-boot.dtsi inculde automatically by the build
system, no need to add this to dts file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: px30: add -u-boot dtsi for soc
Kever Yang [Tue, 31 Mar 2020 07:32:46 +0000 (15:32 +0800)]
rockchip: px30: add -u-boot dtsi for soc

Add soc level -u-boot.dtst so that boards can share the common nodes.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm: dts: rockchip: rk3399-roc-pc: Enable FE1.1 USB 2.0 HUB on roc-rk3399-pc
Suniel Mahesh [Wed, 25 Mar 2020 15:37:36 +0000 (21:07 +0530)]
arm: dts: rockchip: rk3399-roc-pc: Enable FE1.1 USB 2.0 HUB on roc-rk3399-pc

roc-rk3399-pc has an FE1.1 USB 2.0 HUB which connects two USB ports
(HOST1 and HOST2). For end devices to work we need to enable USB hub
so that HOST detects there presence and enumerates them accordingly.
This requires explicit pinctrl within gpio enablement.

Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: video: Convert to use APIs which support live DT
Kever Yang [Wed, 19 Feb 2020 01:45:38 +0000 (09:45 +0800)]
rockchip: video: Convert to use APIs which support live DT

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
driver can support live DT.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agorockchip: video: Use ofnode_decode_display_timing() to parse timing
Kever Yang [Wed, 19 Feb 2020 01:45:37 +0000 (09:45 +0800)]
rockchip: video: Use ofnode_decode_display_timing() to parse timing

Use ofnode_decode_display_timing() instead of
fdtdec_decode_display_timing() to parse display timing, so that we can
support live DT.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMerge tag 'video-for-v2020.07-rc1' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Mon, 27 Apr 2020 13:41:51 +0000 (09:41 -0400)]
Merge tag 'video-for-v2020.07-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-video

- simple panel 'nv140fhmn49' compatible
- rockchip eDP and LVDS drivers build fix

4 years agovideo: simple_panel: add boe,nv140fhmn49 display
Peter Robinson [Mon, 20 Apr 2020 19:27:32 +0000 (20:27 +0100)]
video: simple_panel: add boe,nv140fhmn49 display

add "boe,nv140fhmn49" display to compatible node.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Cc: Anatolij Gustschin <agust@denx.de>
4 years agodrivers: video: rockchip: fix building eDP and LVDS drivers
Peter Robinson [Mon, 20 Apr 2020 18:18:25 +0000 (19:18 +0100)]
drivers: video: rockchip: fix building eDP and LVDS drivers

The rk_edp.c and rk_lvds.c files reference rk_setreg which is declared in
hardware.h so include it so the drivers build. Adjust rk_lvds.c so
includes are in alphabetical order while updating.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
Tested-by: Vagrant Cascadian <vagrant@debian.org>
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>