oweals/u-boot.git
4 years agorockchip: px30: enable spl-fifo-mode for both emmc and sdmmc on evb
Heiko Stuebner [Tue, 19 Nov 2019 11:04:02 +0000 (12:04 +0100)]
rockchip: px30: enable spl-fifo-mode for both emmc and sdmmc on evb

As part of loading trustedfirmware, the SPL is required to place portions
of code into the socs sram but the mmc controllers can only do dma
transfers into the regular memory, not sram.

The results of this are not directly visible in u-boot itself, but
manifest as security-relate cpu aborts during boot of for example Linux.

There were a number of attempts to solve this elegantly but so far
discussion is still ongoing, so to make the board at least boot correctly
put both mmc controllers into fifo-mode, which also circumvents the
issue for now.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
4 years agorockchip: dwmmc: add handling for u-boot, spl-fifo-mode
Heiko Stuebner [Tue, 19 Nov 2019 11:04:01 +0000 (12:04 +0100)]
rockchip: dwmmc: add handling for u-boot, spl-fifo-mode

Rockchips dwmmc controllers can't do dma to non-ddr addresses,
like for example the soc-internal sram but during boot parts of
TrustedFirmware need to be placed there from the read FIT image.

So add handling for a u-boot,spl-fifo-mode to not put the mmc
controllers into fifo mode for all time.

The regular fifo-mode property still takes precedent and only
if not set do we check for the spl-specific property.

Suggested-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
4 years agorock960: Enable USB Gadget
Jagan Teki [Tue, 19 Nov 2019 08:26:23 +0000 (13:56 +0530)]
rock960: Enable USB Gadget

Enable DWC3 core, gadget for rock960 board.

This would help to use fastboot by default.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: Setup dwc3_device (for non-dm gadgets)
Jagan Teki [Tue, 19 Nov 2019 08:26:22 +0000 (13:56 +0530)]
rockchip: Setup dwc3_device (for non-dm gadgets)

Setup dwc3_device structure for non-dm gadgets, which is used
in rk3399 platforms.

dwc3_device would have basic regbase, dr_mode, high speed
and 16-bit UTMI+ etc.

Cc: Marek Vasut <marex@denx.de>
Tested-by: Levin Du <djw@t-chip.com.cn>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
(Fix to use CONFIG_USB_DWC3_GADGET instead of CONFIG_USB_DWC3)
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agogadget: rockchip: Add rk3399 USB_GADGET_PRODUCT_NUM
Jagan Teki [Tue, 19 Nov 2019 08:26:21 +0000 (13:56 +0530)]
gadget: rockchip: Add rk3399 USB_GADGET_PRODUCT_NUM

Add 0x330c for rk3399 gadget product number.

Tested-by: Levin Du <djw@t-chip.com.cn>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agousb: dwc3: Add phy interface for dwc3_uboot
Jagan Teki [Tue, 19 Nov 2019 08:26:20 +0000 (13:56 +0530)]
usb: dwc3: Add phy interface for dwc3_uboot

U-Boot has two different variants of dwc3 initializations,
- with dm variant gadget, so the respective dm driver would
  call the dwc3_init in core.
- with non-dm variant gadget, so the usage board file would
  call dwc3_uboot_init in core.

The driver probe would handle all respective gadget properties
including phy interface via phy_type property and then trigger
dwc3_init for dm-variant gadgets.

So, to support the phy interface for non-dm variant gadgets,
the better option is dwc3_uboot_init since there is no
dedicated controller for non-dm variant gadgets.

This patch support for adding phy interface like 8/16-bit UTMI+
code for dwc3_uboot.

This change used Linux phy.h enum list, to make proper code
compatibility.

Cc: Marek Vasut <marex@denx.de>
Tested-by: Levin Du <djw@t-chip.com.cn>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agofastboot: rockchip: Fix rk3328 default mmc device
Jagan Teki [Tue, 19 Nov 2019 08:26:19 +0000 (13:56 +0530)]
fastboot: rockchip: Fix rk3328 default mmc device

Technically the default mmc device for fastboot would
use eMMC if the board support for it.

Rockchip platform access device 0 for eMMC so, use the
same device number for rk3328.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agofastboot: rockchip: Select FASTBOOT_FLASH[_MMC_DEV]
Jagan Teki [Tue, 19 Nov 2019 08:26:18 +0000 (13:56 +0530)]
fastboot: rockchip: Select FASTBOOT_FLASH[_MMC_DEV]

Select CONFIG_FASTBOOT_FLASH, CONFIG_FASTBOOT_FLASH_MMC_DEV
for rockchip SoC plaforms in fastboot Kconfig file instead
of defined it in board defconfig.

This eventually drop the explicit configs defined in
supporting board defconfig files.

Tested-by: Levin Du <djw@t-chip.com.cn>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agogadget: rockchip: Add rk3128 USB_GADGET_PRODUCT_NUM
Jagan Teki [Tue, 19 Nov 2019 08:26:17 +0000 (13:56 +0530)]
gadget: rockchip: Add rk3128 USB_GADGET_PRODUCT_NUM

Add 0x310c for rk3128 gadget product number.

Tested-by: Levin Du <djw@t-chip.com.cn>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agogadget: rockchip: USB_GADGET_PRODUCT_NUM
Jagan Teki [Tue, 19 Nov 2019 08:26:16 +0000 (13:56 +0530)]
gadget: rockchip: USB_GADGET_PRODUCT_NUM

Rockchip support differnet or common gadget product number
between Rockchip SoCs like,

0x310a - rk3036
0x320a - rk3229, rk3288
0x330a - rk3328

So, select them on Kconfig based on platform specific
config defined.
   
This eventually drop the explicit configs defined in
supporting board defconfig files.

Tested-by: Levin Du <djw@t-chip.com.cn>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agogadget: Select USB_GADGET_VENDOR_NUM for rockchip
Jagan Teki [Tue, 19 Nov 2019 08:26:15 +0000 (13:56 +0530)]
gadget: Select USB_GADGET_VENDOR_NUM for rockchip

Gadget vendor number, 0x2207 is common across all platfroms
supported in Rockchip SoC.

So, select the same number globally, if ARCH_ROCKCHIP.

This eventually drop the explicit configs defined in supported
board defconfig files.

Tested-by: Levin Du <djw@t-chip.com.cn>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agogadget: Select USB_GADGET_MANUFACTURER for rockchip
Jagan Teki [Tue, 19 Nov 2019 08:26:14 +0000 (13:56 +0530)]
gadget: Select USB_GADGET_MANUFACTURER for rockchip

Select the gadget manufacturer as 'Rockchip' for
all rockchip platform SoC's.

This eventually drop the explicit defined added
on supported board defconfig files.

Tested-by: Levin Du <djw@t-chip.com.cn>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agopower: fan53555: fix fan53555_regulator_set_value
Vasily Khoruzhick [Sun, 17 Nov 2019 18:47:36 +0000 (10:47 -0800)]
power: fan53555: fix fan53555_regulator_set_value

fan53555_regulator_set_value() passes its own dev to pmic_clrsetbits()
instead of its parent (pmic). As result u-boot crashes when you try to
set voltage on fan53555 regulator

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: i2c: don't sent stop bit after each message
Vasily Khoruzhick [Sat, 16 Nov 2019 19:32:57 +0000 (11:32 -0800)]
rockchip: i2c: don't sent stop bit after each message

That's not correct and it breaks SMBUS-style reads and and writes for
some chips (e.g. SYR82X/SYR83X).

Stop bit should be sent only after the last message.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agopower: fan53555: add support for Silergy SYR82X and SYR83X
Vasily Khoruzhick [Sat, 16 Nov 2019 19:32:03 +0000 (11:32 -0800)]
power: fan53555: add support for Silergy SYR82X and SYR83X

SYR82X and SYR83X are almost identical to FAN53555, the only difference
is different die ID and revision, voltage ranges and steps.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoKconfig: Enable building of u-boot.itb on Rockchip platform
Kever Yang [Thu, 17 Oct 2019 19:08:34 +0000 (12:08 -0700)]
Kconfig: Enable building of u-boot.itb on Rockchip platform

For all the Rockchip SoCs with SPL_LOAD_FIT enable, we need to build
u-boot.itb with U-Boot proper and ATF/OPTEE.

All the Rockchip boards with SPL_LOAD_FIT now supports FIT generator to
get ATF/OPTEE binary path from environment and pass the build even if no
ATF/OPTEE binary exist, so we can enable this feature for the rockchip
platform.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: lion-rk3368: Migrate to use common FIT generator
Kever Yang [Fri, 15 Nov 2019 02:40:28 +0000 (10:40 +0800)]
rockchip: lion-rk3368: Migrate to use common FIT generator

The RK3368 lion board ATF can use bl31.elf like RK3399 and get the FIT
source with generic FIT generator script at:
arch/arm/mach-rockchip/make_fit_atf.py

And then we can use 'BL31' environment to get the path of bl31.elf
instead of copy it into U-Boot folder.

CC: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: Convert to use FIT generator for optee
Kever Yang [Fri, 15 Nov 2019 02:27:07 +0000 (10:27 +0800)]
rockchip: Convert to use FIT generator for optee

Use generator script so that we can use environment for TEE source.
$TEE for tee.bin, and if file not exist, the script can report a warning,
and meke the build success without a error.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoPrepare v2020.01-rc3 v2020.01-rc3
Tom Rini [Tue, 19 Nov 2019 02:31:49 +0000 (21:31 -0500)]
Prepare v2020.01-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge tag 'video-for-v2020.01-rc2' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Mon, 18 Nov 2019 15:48:29 +0000 (10:48 -0500)]
Merge tag 'video-for-v2020.01-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-video

- fix i.MX6ULL evk black screen observed while reboot stress tests
- remove "synopsys,dw-mipi-dsi" compatible to reduce the device tree
  differences between Linux and U-Boot for stm32mp1 platform

4 years agoMerge tag 'u-boot-rockchip-20191118' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Mon, 18 Nov 2019 02:15:57 +0000 (21:15 -0500)]
Merge tag 'u-boot-rockchip-20191118' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip

- Add support for rockchip SoC: PX30, RK3308
- Add and migrate to use common dram driver: PX30, RK3328, RK3399
- Add rk3399 board Tinker-s support
- Board config update for Rock960, Rockpro64

4 years agoMerge tag 'dm-pull-14nov19' of git://git.denx.de/u-boot-dm
Tom Rini [Mon, 18 Nov 2019 02:15:23 +0000 (21:15 -0500)]
Merge tag 'dm-pull-14nov19' of git://git.denx.de/u-boot-dm

Add OP-TEE test swuit
Fix patman cc_file output
Minor sandbox/pinctrl changes

4 years agorockchip: dts: tinker: Add tinker-s board support
Michael Trimarchi [Fri, 15 Nov 2019 21:07:24 +0000 (22:07 +0100)]
rockchip: dts: tinker: Add tinker-s board support

Support tinker-s board. The board is equivalent of tinker board
except of emmc.

TODO:
- support of usb current burst when the board is powered from pc

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: dts: tinker: Move u-boot dmc initialization to specific section
Michael Trimarchi [Fri, 15 Nov 2019 21:07:23 +0000 (22:07 +0100)]
rockchip: dts: tinker: Move u-boot dmc initialization to specific section

dmc is used to initialize the memory controller. It's needed by
u-boot. Move it in the specific section

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: imply instead of selecting SPL_SYS_MALLOC_SIMPLE
Thomas Hebb [Fri, 15 Nov 2019 16:48:57 +0000 (08:48 -0800)]
rockchip: imply instead of selecting SPL_SYS_MALLOC_SIMPLE

We shouldn't force which allocator the SPL uses, since there's no
platform requirement for one over the other: in fact, we currently allow
selection of the TPL allocator but not the SPL one!

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: allow DRAM init in SPL
Thomas Hebb [Fri, 15 Nov 2019 16:48:56 +0000 (08:48 -0800)]
rockchip: allow DRAM init in SPL

The common SPL removed SoC-specific code for RK3399's SPL and in the
process caused the previously-unconditional DRAM initialization in
board_init_f() to only happen when compiling a configuration that does not
support TPL, meaning DRAM never gets initialized if TPL is supported but
disabled.

Fix this by omitting the DRAM init in SPL only when we are configured to
also build a TPL. This fixes custom configurations that have disabled
TPL, and it should also unbreak the "ficus-rk3399", "rock960-rk3399",
and "chromebook_bob" defconfigs, although since I don't have any of
those devices I can't confirm they're broken now.

Fixes: b7abef2ecbcc ("rockchip: rk3399: Migrate to use common spl board file")

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: SPL: fix ordering of DRAM init
Thomas Hebb [Fri, 15 Nov 2019 16:48:55 +0000 (08:48 -0800)]
rockchip: SPL: fix ordering of DRAM init

The common SPL code reordered the DRAM initialization before
rockchip_stimer_init(), which as far as I can tell causes the RK3399 to
lock up completely.

Fix this issue in the common code by putting the DRAM init back after
timer init. I have only tested this on the RK3399, but it wouldn't make
any sense for the timer init to require DRAM be set up on any system.

Fixes: b7abef2ecbcc ("rockchip: rk3399: Migrate to use common spl board file")

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agodoc: rockchip: Add documentation for rk3308 based boards
Andy Yan [Thu, 14 Nov 2019 03:23:17 +0000 (11:23 +0800)]
doc: rockchip: Add documentation for rk3308 based boards

Add build documentation for rk3308 based boards.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3308: Add support for ROC-RK3308-CC board
Andy Yan [Thu, 14 Nov 2019 03:23:02 +0000 (11:23 +0800)]
rockchip: rk3308: Add support for ROC-RK3308-CC board

ROC-RK3308-CC is a rk3308 based board designed by
Firelfy, with eMMC and 256MB DDR3 and RTL8188 Wifi
on board.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3308: Add dts for ROC-RK3308-CC
Andy Yan [Thu, 14 Nov 2019 03:22:47 +0000 (11:22 +0800)]
rockchip: rk3308: Add dts for ROC-RK3308-CC

Add dts file for ROC-RK3308-CC from firefly.

Sync form linux rockchip for v5.5-armsoc/dts64:
"arm64: dts: rockchip: Add devicetree for board roc-rk3308-cc"
(sha1: 4403e1237be3af0977aa23ef399e3496316317a0)

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: mkimage: add support for RK3308
Andy Yan [Thu, 14 Nov 2019 03:22:34 +0000 (11:22 +0800)]
rockchip: mkimage: add support for RK3308

Usage:

 (1) tools/mkimage -n rk3308 -T rksd -d tpl/u-boot-tpl.bin idbloader.img
 (2) cat spl/u-boot-spl.bin >> idbloader.img
 (3) upgrade_tool wl 0x40 idbloader.img

Note:
  When use ddr binary from rkbin as tpl, use it replace u-boot-tpl.bin in(1)

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3308: Add sdram driver
Andy Yan [Thu, 14 Nov 2019 03:22:18 +0000 (11:22 +0800)]
rockchip: rk3308: Add sdram driver

A dm based dram driver for rk3308 u-boot
to get capacity.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoboard: rockchip: Add rk3308 evb support
Andy Yan [Thu, 14 Nov 2019 03:21:15 +0000 (11:21 +0800)]
board: rockchip: Add rk3308 evb support

Add support for rk3308 evaluation board.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm: dts: rockchip: Add dts for rk3308 evb
Andy Yan [Thu, 14 Nov 2019 03:21:14 +0000 (11:21 +0800)]
arm: dts: rockchip: Add dts for rk3308 evb

Add dts for rk3308 evb, sync from the linux kernel
upstream list [0].

[0]https://patchwork.kernel.org/patch/11201555/

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: clk: Add clk driver for rk3308
Finley Xiao [Thu, 14 Nov 2019 03:21:13 +0000 (11:21 +0800)]
rockchip: clk: Add clk driver for rk3308

Add clk controller driver for RK3308 SOC.

This patch depends on Elaine's pll patch[0].

[0]http://patchwork.ozlabs.org/patch/1183718/

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm: rockchip: Add RK3308 SOC support
Andy Yan [Thu, 14 Nov 2019 03:21:12 +0000 (11:21 +0800)]
arm: rockchip: Add RK3308 SOC support

RK3308 is a quad Cortex A35 based SOC with rich audio
interfaces(I2S/PCM/TDM/PDM/SPDIF/VAD/HDMI ARC), which
designed for intelligent voice interaction and audio
input/output processing.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: clk: pll: add common pll setting funcs
Elaine Zhang [Fri, 25 Oct 2019 01:42:17 +0000 (09:42 +0800)]
rockchip: clk: pll: add common pll setting funcs

Common PLL setup function, compatible with different SOC.
Mainly for the subsequent new SOC use.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3399: orangepi: Add init value for vdd_log
Kever Yang [Wed, 13 Nov 2019 03:14:12 +0000 (11:14 +0800)]
rockchip: rk3399: orangepi: Add init value for vdd_log

We should set the init value when vdd_log is enabled, or else the
vdd_log output voltage may not in soc required range.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3399: khadas-edge: Add init value for vdd_log
Kever Yang [Wed, 13 Nov 2019 03:14:11 +0000 (11:14 +0800)]
rockchip: rk3399: khadas-edge: Add init value for vdd_log

We should set the init value when vdd_log is enabled, or else the
vdd_log output voltage may not in soc required range.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3399: rock-pi4: Add init value for vdd_log
Kever Yang [Wed, 13 Nov 2019 03:14:10 +0000 (11:14 +0800)]
rockchip: rk3399: rock-pi4: Add init value for vdd_log

We should set the init value when vdd_log is enabled, or else the
vdd_log output voltage may not in soc required range.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm64: dts: rk3399-rock960: add vdd_log and its init value
Kever Yang [Wed, 13 Nov 2019 03:14:09 +0000 (11:14 +0800)]
arm64: dts: rk3399-rock960: add vdd_log and its init value

Add vdd_log node according to rock960 schematic V13.
This patch affect two boards:
- Rock960 Model A
- Ficus

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
4 years agorockchip: dts: rk3399-firefly: move u-boot, spl-boot-order to to the u-boot.dtsi
Peter Robinson [Sat, 9 Nov 2019 20:30:07 +0000 (20:30 +0000)]
rockchip: dts: rk3399-firefly: move u-boot, spl-boot-order to to the u-boot.dtsi

The u-boot specific device tree directives should be in u-boot.dtsi

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: dts: rk3399-evb: move u-boot, spl-boot-order to to the u-boot.dtsi
Peter Robinson [Sat, 9 Nov 2019 20:30:06 +0000 (20:30 +0000)]
rockchip: dts: rk3399-evb: move u-boot, spl-boot-order to to the u-boot.dtsi

The u-boot specific device tree directives should be in u-boot.dtsi

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: dts: rk3399: move the u-boot, dm-pre-reloc to the u-boot.dtsi
Peter Robinson [Sat, 9 Nov 2019 20:30:05 +0000 (20:30 +0000)]
rockchip: dts: rk3399: move the u-boot, dm-pre-reloc to the u-boot.dtsi

The u-boot specific pieces in the dts files should be in u-boot.dtsi
not the main files, this allows easier sync with upstream. The
rk3399.dtsi has a mix of both so move them all for consistency.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
(Fix with missing pmugrf)
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3399: split rockpro64 out of evb_rk3399
Vasily Khoruzhick [Sat, 9 Nov 2019 19:24:50 +0000 (11:24 -0800)]
rockchip: rk3399: split rockpro64 out of evb_rk3399

rockpro64 needs to setup I/O domains in order for USB to work in u-boot.
Since we currently don't have a driver to do that, split it into its own
board file and initialize I/O domains here.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: clk: fix wrong CONFIG_IS_ENABLED handling
Heiko Stuebner [Fri, 8 Nov 2019 23:06:30 +0000 (00:06 +0100)]
rockchip: clk: fix wrong CONFIG_IS_ENABLED handling

CONFIG_IS_ENABLED() needs the config name like used in Kconfig, so
without the leading CONFIG_. The clock drivers all wrongly check for
CONFIG_RESET_ROCKCHIP, fix that

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: clk: rv1108: remove duplicate reset init
Heiko Stuebner [Fri, 8 Nov 2019 23:06:29 +0000 (00:06 +0100)]
rockchip: clk: rv1108: remove duplicate reset init

rockchip_reset_bind() already does the needed init for the reset
registers, only referenced the wrong cru structure.

So we can get rid of the open-coded reset init and just fix
the correct cru reference.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm: dts: rk3399-rockpro64: slightly increase center voltage
Soeren Moch [Thu, 7 Nov 2019 11:11:22 +0000 (12:11 +0100)]
arm: dts: rk3399-rockpro64: slightly increase center voltage

The rk3399 VD_CENTER voltage domain is not subject to dynamic voltage
scaling. So the regulator reset voltage of 0.9V is used on this board.
Let u-boot initialize the center voltage to 0.95V as it is done for the
VD_LOGIC domain. This avoids instability and occasional linux kernel
Opses on this board.

Signed-off-by: Soeren Moch <smoch@web.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm: dts: rk3399-rockpro64: sync dts from linux kernel
Soeren Moch [Thu, 7 Nov 2019 11:11:21 +0000 (12:11 +0100)]
arm: dts: rk3399-rockpro64: sync dts from linux kernel

The most important change for u-boot is the fix for the vdd-log pwm
voltage regulator to avoid overvoltage for the VD_LOGIC power domain.

Signed-off-by: Soeren Moch <smoch@web.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3399: rock960: Update config for TPL
Peter Robinson [Wed, 6 Nov 2019 11:43:05 +0000 (11:43 +0000)]
rockchip: rk3399: rock960: Update config for TPL

Enable TPL for rock960 like other rk3399 boards.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoconfigs: Rename roc-rk3399-pc -> roc-pc-rk3399 defconfig
Jagan Teki [Sat, 2 Nov 2019 04:49:02 +0000 (10:19 +0530)]
configs: Rename roc-rk3399-pc -> roc-pc-rk3399 defconfig

roc-rk3399-pc_defconfig is committed in below

commit <8a681f4c5aa15db51ad0209734859c9fe7c29cfd> ("rockchip: rk3399:
Add ROC-RK3399-PC support")

which doesn't follow the existing defconfigs on rk3399.

So, rename as followed with other rk3399 defconfigs.

Cc: Levin Du <djw@t-chip.com.cn>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm: dts: rk3399-roc-pc: Sync latest dts changes from Linux
Jagan Teki [Wed, 16 Oct 2019 15:19:40 +0000 (20:49 +0530)]
arm: dts: rk3399-roc-pc: Sync latest dts changes from Linux

Few important regulator power rails fixes are available in
linux-next, so sync them same.

Here is the last commit details:
commit <9f7f9b610e1b7d2dc86c543ab0dfcf781bd42326> ("arm64: dts:
rockchip: Fix roc-rk3399-pc regulator input rails")

Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Levin Du <djw@t-chip.com.cn>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: Init driver otg_data for rk3288 usb phy
Kever Yang [Wed, 16 Oct 2019 09:13:32 +0000 (17:13 +0800)]
rockchip: Init driver otg_data for rk3288 usb phy

RK3288 needs to init the otg_data in board level to make the phy driver
work.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: usb: Migrate to use ofnode
Kever Yang [Wed, 16 Oct 2019 09:13:31 +0000 (17:13 +0800)]
rockchip: usb: Migrate to use ofnode

Migrate to use ofnode_* instead of fdt_* so that we may able to use live
dt for usb udc driver.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: add px30-evb board
Heiko Stuebner [Tue, 16 Jul 2019 20:19:43 +0000 (22:19 +0200)]
rockchip: add px30-evb board

The px30 evb is an evaluation board for the px30 together with a dsi-
connected display. This adds board and config files for it.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: add px30 architecture core
Heiko Stuebner [Tue, 16 Jul 2019 20:18:21 +0000 (22:18 +0200)]
rockchip: add px30 architecture core

Add core architecture code to support the px30 soc.
This includes a separate tpl board file due to very limited
sram size as well as a non-dm sdram driver, as this also has
to fit into the tiny sram.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: add px30 devicetrees
Heiko Stuebner [Tue, 16 Jul 2019 20:12:07 +0000 (22:12 +0200)]
rockchip: add px30 devicetrees

Add px30 related devicetrees synced from the Linux kernel.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: misc: read cpuid either from efuse or otp
Heiko Stuebner [Wed, 25 Sep 2019 18:21:21 +0000 (20:21 +0200)]
rockchip: misc: read cpuid either from efuse or otp

Newer Rockchip socs use a different ip block to handle one-time-
programmable memory, so depending on what got enabled get the cpuid
from either source.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agomisc: add driver for the Rockchip otp controller
Finley Xiao [Wed, 25 Sep 2019 15:57:49 +0000 (17:57 +0200)]
misc: add driver for the Rockchip otp controller

Newer Rockchip socs like the px30 use a different ip block to handle
one-time-programmable memory, so add a misc driver for it as well.

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: mkimage: add support for px30
Kever Yang [Fri, 12 Jul 2019 09:43:34 +0000 (11:43 +0200)]
rockchip: mkimage: add support for px30

Add the table entry for px30 socs.
The px30 has 10K of sram available.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agonet: gmac_rockchip: add support for px30
Heiko Stuebner [Tue, 23 Jul 2019 23:20:29 +0000 (01:20 +0200)]
net: gmac_rockchip: add support for px30

Add the glue code to allow the px30 variant of the Rockchip gmac
to provide network functionality.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: clk: add px30 clock driver
Kever Yang [Thu, 11 Jul 2019 08:42:16 +0000 (10:42 +0200)]
rockchip: clk: add px30 clock driver

The px30 contains 2 separate clock controllers, pmucru and cru.
Add drivers for them.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agopinctrl: rockchip: add px30 pinctrl driver
David Wu [Thu, 11 Jul 2019 08:37:14 +0000 (10:37 +0200)]
pinctrl: rockchip: add px30 pinctrl driver

Add the necessary glue code to allow pinctrl setting on px30 socs.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: add core px30 headers
Heiko Stuebner [Tue, 16 Jul 2019 20:17:13 +0000 (22:17 +0200)]
rockchip: add core px30 headers

Add headers needed by the upcoming px30 support, including two
new dt-binding headers taken from the Linux kernel.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agospl: separate SPL_FRAMEWORK config for spl and tpl
Heiko Stuebner [Tue, 16 Jul 2019 08:12:02 +0000 (10:12 +0200)]
spl: separate SPL_FRAMEWORK config for spl and tpl

Right now enabling SPL_FRAMEWORK will also enable it for the TPL in all
cases, making the TPL bigger. There may be cases where the TPL is really
size constrained due to its underlying ram size.

Therefore introduce a new TPL_FRAMEWORK option and make the relevant
conditionals check for both. The default is set to "y if SPL_FRAMEWORK"
to mimic the previous behaviour where the TPL would always get the
SPL framework if it was enabled in SPL.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rk3399: Fix dram setting to make dram more stable
YouMin Chen [Fri, 15 Nov 2019 03:04:53 +0000 (11:04 +0800)]
ram: rk3399: Fix dram setting to make dram more stable

There are some code different with rockchip vendor code which may lead
to different bugs, including:
1) Fix setting error about LPDDR3 dram size ODT.
2) Set phy io speed to 0x2.
3) Fix setting error about phy_pad_fdbk_drive.
4) Fix setting error about PI_WDQLVL_VREF_EN

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rk3399: update calculate_stride
Kever Yang [Fri, 15 Nov 2019 03:04:52 +0000 (11:04 +0800)]
ram: rk3399: update calculate_stride

Update the calculation of the stride to support all the DRAM case.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rk3399: Sync the io setting from Rockchip vendor code
Kever Yang [Fri, 15 Nov 2019 03:04:51 +0000 (11:04 +0800)]
ram: rk3399: Sync the io setting from Rockchip vendor code

The io setting are updated after some bugfix in different rk3399 boards,
sync the code from vendor.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rockchip: update lpddr4 timing for rk3399
Kever Yang [Fri, 15 Nov 2019 03:04:50 +0000 (11:04 +0800)]
ram: rockchip: update lpddr4 timing for rk3399

Update lpddr timing in lpddr4-400 and lpddr4-800 file from rockchip
vendor code;

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rk3399: add support detect capacity
YouMin Chen [Fri, 15 Nov 2019 03:04:49 +0000 (11:04 +0800)]
ram: rk3399: add support detect capacity

Add capacity detect for rk3399 so that the driver able to detect the
capacity automatically.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rk3399: update the function of sdram_init
YouMin Chen [Fri, 15 Nov 2019 03:04:48 +0000 (11:04 +0800)]
ram: rk3399: update the function of sdram_init

Clean up the sdram_init to keep sync with rockchip source code.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rk3399: fix error about get_ddrc0_con reg addr
YouMin Chen [Fri, 15 Nov 2019 03:04:47 +0000 (11:04 +0800)]
ram: rk3399: fix error about get_ddrc0_con reg addr

Correct the register to its correct name.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rk3399: Clean up code
YouMin Chen [Fri, 15 Nov 2019 03:04:46 +0000 (11:04 +0800)]
ram: rk3399: Clean up code

Clean up rk3399 dram driver source code for more readable.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rk3399: migrate to use common code
YouMin Chen [Fri, 15 Nov 2019 03:04:45 +0000 (11:04 +0800)]
ram: rk3399: migrate to use common code

For there are some structures and functions are common for all rockchip SoCs,
migrate to use the common code so that we can clean up reduandent codes.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rk3328: use common sdram driver
YouMin Chen [Fri, 15 Nov 2019 03:04:44 +0000 (11:04 +0800)]
ram: rk3328: use common sdram driver

RK3328 has a similar controller and phy with PX30, so we can use the
common driver for it and remove the duplicate codes.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: px30: add sdram driver
YouMin Chen [Fri, 15 Nov 2019 03:04:43 +0000 (11:04 +0800)]
ram: px30: add sdram driver

Add the sdram driver for PX30 to support ddr3, ddr4, lpddr2 and lpddr3.

For TPL_BUILD, the driver implement full dram init and without DM
support due to the limit of internal SRAM size.
For SPL and U-Boot proper, it's a simple driver with dm for get
dram_info like other SoCs.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rockchip: add common msch reg definition
Kever Yang [Fri, 15 Nov 2019 03:04:42 +0000 (11:04 +0800)]
ram: rockchip: add common msch reg definition

The noc register bit definition may be the same for different SoC while
the offset of the register may be different, add the struction
definition as common code.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rockchip: add phy driver code for PX30
Kever Yang [Fri, 15 Nov 2019 03:04:41 +0000 (11:04 +0800)]
ram: rockchip: add phy driver code for PX30

This sdram_phy_px30.c is based on PX30 SoC, the functions are common
for phy, other SoCs with similar hardware could re-use it.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rockchip: add controller code for PX30
Kever Yang [Fri, 15 Nov 2019 03:04:40 +0000 (11:04 +0800)]
ram: rockchip: add controller code for PX30

This sdram_pctl_px30.c is based on PX30 SoC, the functions are common
for controller, other SoCs with similar hardware could re-use it.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rockchip: Default enable DRAM debug info
Kever Yang [Fri, 15 Nov 2019 03:04:39 +0000 (11:04 +0800)]
ram: rockchip: Default enable DRAM debug info

The debug info for dram is main about the capacity related info which is
very important the board init, so set this default enable.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rockchip: move sdram_debug function into sdram_common
Kever Yang [Fri, 15 Nov 2019 03:04:38 +0000 (11:04 +0800)]
ram: rockchip: move sdram_debug function into sdram_common

The functions for dram info print are part of common code.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rockchip: add common code for sdram driver
Kever Yang [Fri, 15 Nov 2019 03:04:37 +0000 (11:04 +0800)]
ram: rockchip: add common code for sdram driver

There are some function like os_reg setting, capacity detect functions,
can be used as common code for different Rockchip SoCs, add a
sdram_common.c for all these functions.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: sdram: update the sys_reg to sys_reg2
Kever Yang [Fri, 15 Nov 2019 03:04:36 +0000 (11:04 +0800)]
rockchip: sdram: update the sys_reg to sys_reg2

We are using sys_reg2 and sys_reg3 as ddr cap info, sync the variable
name to what we real use to avoid confuse people.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: sdram: extend to use sys_reg3 for capacity info
Kever Yang [Fri, 15 Nov 2019 03:04:35 +0000 (11:04 +0800)]
rockchip: sdram: extend to use sys_reg3 for capacity info

Since we have new DRAM type and to support different DRAM size in different
CS, we need more bits, so introduce sys_reg3 to record the info.
Note that the info in sys_reg3 is extension to sys_reg2 and the info in
sys_reg2 is the same as before. We define the DRAM_INFO with sys_reg3 as
VERSION2.
All the ENC macro are moved to sdram_common.h since the sdram.c only
need to do the info decode.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: sdram: move cap structure and debug function to sdram_common.h
Kever Yang [Fri, 15 Nov 2019 03:04:34 +0000 (11:04 +0800)]
rockchip: sdram: move cap structure and debug function to sdram_common.h

The sdram.h suppose to be helper file for sdram.c which including dram
size decode and some u-boot related dram init interface, and all
structure and function for dram driver move to sdram_common.h

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rockchip: rename sdram_common.c/h to sdram.c
Kever Yang [Fri, 15 Nov 2019 03:04:33 +0000 (11:04 +0800)]
ram: rockchip: rename sdram_common.c/h to sdram.c

rename sdram_common.c in arch/arm/mach-rockchip to sdram.c;
so that we can use the file name sdram_common.c in dram driver for
better understand the code;
clean the related file who has use the header file at the same time.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoram: rockchip: rename sdram.h to sdram_rk3288.h
Kever Yang [Fri, 15 Nov 2019 03:04:32 +0000 (11:04 +0800)]
ram: rockchip: rename sdram.h to sdram_rk3288.h

The header file sdram.h is used for rk3288 and similar SoCs, rename it
to make it more understandable.

Signed-off-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoMerge tag 'efi-2020-01-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Thu, 14 Nov 2019 14:48:26 +0000 (09:48 -0500)]
Merge tag 'efi-2020-01-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-01-rc3

The following changes for the UEFI subsystem are provided:

* allow building UEFI binaries on the sandbox
* enable access to file systems without partition tables
* correctly check the return value of efi_dp_from_file()

4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 14 Nov 2019 14:47:29 +0000 (09:47 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell

- Clearfog: Fix SD card booting (Baruch)
- Fix potential dereference NULL pointer in dram_init() (Chris)

4 years agopatman: fix coverletter cc list with nulls
Robert Beckett [Wed, 13 Nov 2019 18:39:45 +0000 (18:39 +0000)]
patman: fix coverletter cc list with nulls

fixes: 8ab452d5877638a97e5bdd521d119403b70b45f5

When compiling list of cover letter cc addresses, using null as a
separater, then encoding to utf-8 results in lots of "\x00" as
separators. patman then doesnt understand that when it comes to
repoting the list to send-email.

Fix this by not encoding to utf-8, as done for the other patch files.

Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agopatman: fix some typos in comments
Anatolij Gustschin [Sun, 27 Oct 2019 16:55:04 +0000 (17:55 +0100)]
patman: fix some typos in comments

s/Subprocress/Subprocess/
s/easiler/easier/
s/repositiory/repository/
s/rangem/range/
s/Retruns/Returns/

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: use correct type reading /proc/self/maps
Heinrich Schuchardt [Sat, 26 Oct 2019 21:17:44 +0000 (23:17 +0200)]
sandbox: use correct type reading /proc/self/maps

Compiling arch/sandbox/cpu/os.c results in an error

../arch/sandbox/cpu/os.c: In function ‘os_find_text_base’:
../arch/sandbox/cpu/os.c:823:12: error: cast to pointer from
integer of different size [-Werror=int-to-pointer-cast]
  823 |     base = (void *)addr;
      |            ^
cc1: all warnings being treated as errors

The size of void* differs from that of unsigned long long on 32bit
systems.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotests: add OP-TEE test suite
Heiko Stuebner [Wed, 23 Oct 2019 14:46:41 +0000 (16:46 +0200)]
tests: add OP-TEE test suite

OP-TEE can get supplied with a devicetree and will then insert
its firmware node and reserved-memory sections into it.
As this devicetree often is not the one supplied to a later
loaded kernel, a previous commit added functionality to transfer
these nodes onto that new devicetree.

To make sure this functionality stays intact, also add a test
for the transfer functionality.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoimage: fdt: copy possible optee nodes to a loaded devicetree
Heiko Stuebner [Wed, 23 Oct 2019 14:46:40 +0000 (16:46 +0200)]
image: fdt: copy possible optee nodes to a loaded devicetree

The loading convention for optee or any other tee on arm64 is as bl32
parameter to the trusted-firmware. So TF-A gets invoked with the TEE as
bl32 and main u-boot as bl33. Once it has done its startup TF-A jumps
into the bl32 for the TEE startup, returns to TF-A and then jumps to bl33.

All of them get passed a devicetree as parameter and all components often
get loaded from a FIT image.

OP-TEE will create additional nodes in that devicetree namely a firmware
node and possibly multiple reserved-memory nodes.

While this devicetree is used in main u-boot, in most cases it won't be
the one passed to the actual kernel. Instead most boot commands will load
a new devicetree from somewhere like mass storage of the network, so if
that happens u-boot should transfer the optee nodes to that new devicetree.

To make that happen introduce optee_copy_fdt_nodes() called from the dt
setup function in image-fdt which after checking for the optee presence
in the u-boot dt will make sure a optee node is present in the kernel dt
and transfer any reserved-memory regions it can find.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
4 years agofdtdec: only create phandle if caller wants it in fdtdec_add_reserved_memory()
Heiko Stuebner [Wed, 23 Oct 2019 14:46:39 +0000 (16:46 +0200)]
fdtdec: only create phandle if caller wants it in fdtdec_add_reserved_memory()

The phandlep pointer returning the phandle to the caller is optional
and if it is not set when calling fdtdec_add_reserved_memory() it is
highly likely that the caller is not interested in a phandle to the
created reserved-memory area and really just wants that area added.

So just don't create a phandle in that case.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agofdtdec: protect against another NULL phandlep in fdtdec_add_reserved_memory()
Heiko Stuebner [Wed, 23 Oct 2019 14:46:38 +0000 (16:46 +0200)]
fdtdec: protect against another NULL phandlep in fdtdec_add_reserved_memory()

The change adding fdtdec_add_reserved_memory() already protected the added
phandle against the phandlep being NULL - making the phandlep var optional.

But in the early code checking for an already existing carveout this check
was not done and thus the phandle assignment could run into trouble,
so add a check there as well, which makes the function still return
successfully if a matching region is found, even though no-one wants to
work with the phandle.

Fixes: c9222a08b3f7 ("fdtdec: Implement fdtdec_add_reserved_memory()")
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agopinctrol: dm: remove the function pinctrl_decode_pin_config
Patrick Delaunay [Wed, 23 Oct 2019 13:44:36 +0000 (15:44 +0200)]
pinctrol: dm: remove the function pinctrl_decode_pin_config

Remove the pinctrl_decode_pin_config() API, because this
function is unused and not compatible with livetree
(it uses fdtdec_get_bool instead of ofnode API).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoarm: mvebu: clearfog: fix boot from SD card
Baruch Siach [Sun, 3 Nov 2019 09:52:39 +0000 (11:52 +0200)]
arm: mvebu: clearfog: fix boot from SD card

Enable gpio0 in SPL to allow the sdhci driver read the SD card-detect
signal.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoARM: mvebu: don't dereference null bd pointer
Chris Packham [Tue, 22 Oct 2019 07:05:25 +0000 (20:05 +1300)]
ARM: mvebu: don't dereference null bd pointer

As mentioned in doc/README.arm-relocation gd->bd is not available in
dram_init() so we shouldn't attempt to access it.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoefi_selftest: enable all UEFI unit tests on the sandbox
Heinrich Schuchardt [Fri, 8 Nov 2019 20:17:58 +0000 (21:17 +0100)]
efi_selftest: enable all UEFI unit tests on the sandbox

As we can build relocation code for the sandbox now we should enable the
unit tests that had to be disabled up to now.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>