platform/kernel/u-boot.git
3 years agoMerge branch 'net' of https://gitlab.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Mon, 27 Jul 2020 13:40:06 +0000 (09:40 -0400)]
Merge branch 'net' of https://gitlab.denx.de/u-boot/custodians/u-boot-sh

- Convert dc2114x driver to DM.

3 years agoMerge branch '2020-07-27-misc-env-improvements'
Tom Rini [Mon, 27 Jul 2020 13:25:53 +0000 (09:25 -0400)]
Merge branch '2020-07-27-misc-env-improvements'

- Assorted environment fixes.
- Enhance environment in MMC and controlled via OF_CONTROL
- Allow for environment in FAT to use the same device we boot from
  rather than be hard-coded.

3 years agoenv: mmc: add redundancy support in mmc_offset_try_partition
Patrick Delaunay [Mon, 15 Jun 2020 08:38:57 +0000 (10:38 +0200)]
env: mmc: add redundancy support in mmc_offset_try_partition

Manage 2 copy at the end of the partition selected by config
"u-boot,mmc-env-partition" to save the U-Boot environment,
with CONFIG_ENV_SIZE and 2*CONFIG_ENV_SIZE offset.

This patch allows to support redundancy (CONFIG_ENV_OFFSET_REDUND).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoenv: mmc: correct the offset returned by mmc_offset_try_partition
Patrick Delaunay [Mon, 15 Jun 2020 08:38:56 +0000 (10:38 +0200)]
env: mmc: correct the offset returned by mmc_offset_try_partition

The output of the function mmc_offset_try_partition must be a
byte offset in mmc and not a multiple of blksz.

This function is used in mmc_offset(), called by mmc_get_env_addr()
and the offset is used in write_env(), erase_env() and read_env().

In these function, blk_start = offset / mmc->read_bl_len
or /write_bl_len so this offset is not a multiple of blksz.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoenv: mmc: allow support of mmc_get_env_dev with OF_CONTROL
Patrick Delaunay [Mon, 15 Jun 2020 08:38:55 +0000 (10:38 +0200)]
env: mmc: allow support of mmc_get_env_dev with OF_CONTROL

Use the weak function mmc_get_env_dev in mmc_offset_try_partition
function to allow dynamic selection of mmc device to use
and no more use directly the define CONFIG_SYS_MMC_ENV_DEV.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agotest: env: add test for env info sub-command
Patrick Delaunay [Fri, 19 Jun 2020 12:03:37 +0000 (14:03 +0200)]
test: env: add test for env info sub-command

Add a pytest for testing the env info sub-command:

test_env_info: test command with several option that
can be executed on real hardware device without assumption

test_env_info_sandbox: test the result on sandbox
with a known ENV configuration: ready & default & persistent

The quiet option '-q' is used for support in shell test;
for example:
  if env info -p -d -q; then env save; fi

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
3 years agoconfigs: sandbox: Enable sub command 'env info'
Patrick Delaunay [Fri, 19 Jun 2020 12:03:36 +0000 (14:03 +0200)]
configs: sandbox: Enable sub command 'env info'

Enable support for sub command 'env info' in sandbox
with CONFIG_CMD_NVEDIT_INFO. This is aimed primarily
at adding unit test.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocmd: env: check real location for env info command
Patrick Delaunay [Fri, 19 Jun 2020 12:03:35 +0000 (14:03 +0200)]
cmd: env: check real location for env info command

Check the current ENV location, dynamically provided by the weak
function env_get_location to be sure that the environment can be
persistent.

The compilation flag ENV_IS_IN_DEVICE is not enough when the board
dynamically select the available storage location (according boot
device for example).

This patch solves issue for stm32mp1 platform, when the boot device
is USB.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agocmd: env: add option for quiet output on env info
Patrick Delaunay [Fri, 19 Jun 2020 12:03:34 +0000 (14:03 +0200)]
cmd: env: add option for quiet output on env info

The "env info" can be use for test with -d and -p parameter,
in scripting case the output of the command is not needed.

This patch allows to deactivate this output with a new option "-q".

For example, we can save the environment if default
environment is used and persistent storage is managed with:
  if env info -p -d -q; then env save; fi

Without the quiet option, I have the unnecessary traces
First boot:
      Default environment is used
      Environment can be persisted
      Saving Environment to EXT4... File System is consistent

Next boot:
      Environment was loaded from persistent storage
      Environment can be persisted

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agoenv: add failing trace in env_save
Patrick Delaunay [Wed, 24 Jun 2020 08:17:50 +0000 (10:17 +0200)]
env: add failing trace in env_save

Add trace in env save to indicate any errors to end user and avoid
silent output when the command 'env save' is not executed.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoenv: correct overflow check of env_has_init size
Patrick Delaunay [Wed, 24 Jun 2020 07:27:25 +0000 (09:27 +0200)]
env: correct overflow check of env_has_init size

Correct the overflow check of the bit-field env_has_init with
the max value of env_location= ENVL_COUNT and no more with the
size of env_locations.

This bit-field is indexed by this enumerate and not by the position in
the env_locations (only used in env_get_location) and the
2 values are different, depending of thea ctivated CONFIG_ENV_IS_ options.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoenv/fat.c: allow loading from a FAT partition on the MMC boot device
David Woodhouse [Fri, 19 Jun 2020 22:07:17 +0000 (23:07 +0100)]
env/fat.c: allow loading from a FAT partition on the MMC boot device

I don't want to have to specify the device; only the partition.

This allows me to use the same image on internal eMMC or SD card for
Banana Pi R2, and it finds its own environment either way.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
[trini: Add #if/#else/#endif logic around CONFIG_SYS_MMC_ENV_DEV usage,
        whitespace changes]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agonet: dc2114x: Add DM support
Marek Vasut [Wed, 8 Jul 2020 05:26:14 +0000 (07:26 +0200)]
net: dc2114x: Add DM support

With all the changes in place, add support for DM into the
dc2114x driver.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dc2114x: Split common parts of non-DM functions out
Marek Vasut [Wed, 8 Jul 2020 05:20:14 +0000 (07:20 +0200)]
net: dc2114x: Split common parts of non-DM functions out

Split the common code from the non-DM code, so it can be reused by
the DM code later. As always, the recv() function had to be split
into the actual receiving part and free_pkt part to fit with the
DM.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dc2114x: Split RX path
Marek Vasut [Wed, 8 Jul 2020 05:12:58 +0000 (07:12 +0200)]
net: dc2114x: Split RX path

Split the RX data check from the rest of the RX function, so that
the check can be performed separately from the processing of the
packet and the release of the received packet once the processing
is finished.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dc2114x: Add RX/TX rings into the private data
Marek Vasut [Wed, 8 Jul 2020 05:01:32 +0000 (07:01 +0200)]
net: dc2114x: Add RX/TX rings into the private data

The RX/TX DMA descriptor rings are per-device-instance private data,
so move them into the private data.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dc2114x: Pass PCI BDF into phys_to_bus()
Marek Vasut [Wed, 8 Jul 2020 04:50:41 +0000 (06:50 +0200)]
net: dc2114x: Pass PCI BDF into phys_to_bus()

This is a trick in preparation for adding DM support. By passing in
the PCI BDF into the phys_to_bus() macros and calling that dev, we
can substitute dev with udevice when DM support lands and do minor
adjustment to the macros to support both DM and non-DM operation.
No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dc2114x: Pass private data around
Marek Vasut [Wed, 8 Jul 2020 04:46:09 +0000 (06:46 +0200)]
net: dc2114x: Pass private data around

This patch replaces the various uses of struct eth_device for accessing
device private data with struct dc2114x_priv, which is compatible both
with DM and non-DM operation.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dc2114x: Introduce private data
Marek Vasut [Wed, 8 Jul 2020 04:42:07 +0000 (06:42 +0200)]
net: dc2114x: Introduce private data

Introduce dc2114x_priv, which is a super-structure around eth_device
and tracks per-device state and the device IO address.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dc2114x: Use standard I/O accessors
Marek Vasut [Wed, 8 Jul 2020 04:31:54 +0000 (06:31 +0200)]
net: dc2114x: Use standard I/O accessors

The current dc21x4x driver accesses its memory mapped registers directly
instead of using the standard I/O accessors. This can cause problems on
some systems as the accesses can get out of order. So convert the direct
volatile dereferences to use the normal in/out macros.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dc2114x: Drop update_srom()
Marek Vasut [Sat, 20 Jun 2020 15:54:53 +0000 (17:54 +0200)]
net: dc2114x: Drop update_srom()

This code is never used, remove it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dc2114x: Add Kconfig entries
Marek Vasut [Sat, 20 Jun 2020 15:43:29 +0000 (17:43 +0200)]
net: dc2114x: Add Kconfig entries

Add Kconfig entries for the dc2114x driver and convert various boards.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dc2114x: Support all DC2114x
Marek Vasut [Sat, 20 Jun 2020 15:39:21 +0000 (17:39 +0200)]
net: dc2114x: Support all DC2114x

For the usage in this driver, the chips are identical,
so support all of them.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dc2114x: Use PCI_DEVICE() to define PCI device compat list
Marek Vasut [Sat, 20 Jun 2020 15:36:42 +0000 (17:36 +0200)]
net: dc2114x: Use PCI_DEVICE() to define PCI device compat list

Use this macro to fully fill the PCI device ID table. This is mandatory
for the DM PCI support, which checks all the fields.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Fri, 24 Jul 2020 12:43:08 +0000 (08:43 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Fix SiFive HiFive Unleashed board booting failure problem.
- Enable SiFive fu540 PWM driver.
- Support SiFive fu540: SPI boot.
- Update OpenSBI used for RISC-V CI testing.
- Revert "riscv: Allow use of reset drivers".
- Revert "Revert "riscv: sifive: fu540: Add gpio-restart support"".
- sysreset: syscon:
        - Don't assume default value for offset and mask property.
        - Support value property.
- qemu: Add syscon reboot and poweroff support.
- Fix SIFIVE debug serial dependency.
- Fix linking error when building u-boot-spl with no SMP support.
- AE350 use fdtdec_get_addr_size_auto_noparent to parse smc reg.
- Make memory node available to SPL in hifive-unleashed-a00-u-boot.dtsi
- SiFive fu540 avoid using hardcoded ram base and size.

3 years agoRevert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"
Tom Rini [Fri, 24 Jul 2020 12:42:06 +0000 (08:42 -0400)]
Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"

This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing
changes made to 56d37f1c564107e27d873181d838571b7d7860e7.

Unfortunately this is causing CI failures:
https://travis-ci.org/github/trini/u-boot/jobs/711313649

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoram: sifive: Avoid using hardcoded ram base and size
Bin Meng [Mon, 20 Jul 2020 06:06:35 +0000 (23:06 -0700)]
ram: sifive: Avoid using hardcoded ram base and size

At present the SiFive FU540 RAM driver uses hard-coded memory base
address and size to initialize the DDR controller. This may not be
true when this driver is used on another board based on FU540.

Update the driver to read the memory information from DT and use
that during the initialization.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Leo Liang <ycliang@andestech.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
3 years agoriscv: dts: hifive-unleashed-a00: Make memory node available to SPL
Bin Meng [Mon, 20 Jul 2020 06:06:34 +0000 (23:06 -0700)]
riscv: dts: hifive-unleashed-a00: Make memory node available to SPL

Make memory node available to SPL in prepration to updates to SiFive
DDR RAM driver to read memory information from DT.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
3 years agoriscv: ae350: Use fdtdec_get_addr_size_auto_noparent to parse smc reg
Rick Chen [Fri, 17 Jul 2020 08:24:44 +0000 (16:24 +0800)]
riscv: ae350: Use fdtdec_get_addr_size_auto_noparent to parse smc reg

Use fdtdec_get_addr_size_auto_noparent to read the "reg" property
instead of fdtdec_get_addr. This will increase the compatibility
of dtb parsing.

Signed-off-by: Rick Chen <rick@andestech.com>
Acked-by: Leo Liang <ycliang@andestech.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Leo Liang <ycliang@andestech.com>
3 years agoriscv: Fix linking error when building u-boot-spl with no SMP support
Leo Yu-Chi Liang [Mon, 29 Jun 2020 08:27:28 +0000 (16:27 +0800)]
riscv: Fix linking error when building u-boot-spl with no SMP support

Switch off SMP support when building u-boot-spl would cause linking error as follow:
undefined reference to 'secondary hart relocate' and 'smp_call_function'.
Add macro to wrap up proper code region that needs SMP configuration on.

Signed-off by: Leo Liang <ycliang@andestech.com>
Cc: rick@andestech.com
Reviewed-by: Bin Meng <bin.meng@windriver.com>
3 years agoserial: Fix SIFIVE debug serial dependency
Michal Simek [Fri, 10 Jul 2020 10:41:13 +0000 (12:41 +0200)]
serial: Fix SIFIVE debug serial dependency

The commit 4cc24aeaf420 ("serial: Add missing Kconfig dependencies for
debug consoles") has added incorrect dependency for SIFIVE debug uart which
should depend on SIFIVE driver instead of PL01x.

Fixes: 4cc24aeaf420 ("serial: Add missing Kconfig dependencies for debug consoles")
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Leo Liang <ycliang@andestech.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
3 years agoriscv: qemu: Add syscon reboot and poweroff support
Bin Meng [Tue, 23 Jun 2020 05:29:45 +0000 (22:29 -0700)]
riscv: qemu: Add syscon reboot and poweroff support

This adds syscon reboot and poweroff support to QEMU RISC-V.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
3 years agosysreset: syscon: Support value property
Bin Meng [Tue, 23 Jun 2020 05:29:43 +0000 (22:29 -0700)]
sysreset: syscon: Support value property

Per the DT binding, <mask> and <value> property can have either one
or both, and if <value> is missing, <mask> should be used, which is
what current U-Boot sysreset_syscon driver supports.

This adds support to the <value> property to the driver, and <mask>
semantics is updated to really be a mask to the value if both exist.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
3 years agosysreset: syscon: Don't assume default value for offset and mask property
Bin Meng [Tue, 23 Jun 2020 05:29:42 +0000 (22:29 -0700)]
sysreset: syscon: Don't assume default value for offset and mask property

Per the DT binding, <offset> is a required property. Let's abort
the probe if it is missing. For the <mask> property, current codes
assume a default value of zero, which is not correct either.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
3 years agoRevert "Revert "riscv: sifive: fu540: Add gpio-restart support""
Bin Meng [Mon, 20 Jul 2020 03:06:46 +0000 (20:06 -0700)]
Revert "Revert "riscv: sifive: fu540: Add gpio-restart support""

This reverts commit 23da3c682a84a2ad67a67287979dd4f5259ff607.

Now the build failure of sifive_fu540_defconfig board has been fixed,
revert this "revert patch".

Signed-off-by: Bin Meng <bin.meng@windriver.com>
3 years agoRevert "riscv: Allow use of reset drivers"
Bin Meng [Mon, 20 Jul 2020 03:06:45 +0000 (20:06 -0700)]
Revert "riscv: Allow use of reset drivers"

This reverts commit 958a3f464c7f8ef7e10db9feb663e9e80445ce2f.

A more appropriate change below is already in mainline.
Commit fd31e4fd184f ("riscv: Do not build reset.c if SYSRESET is on")

Revert this patch, so that U-Boot can be built successfully for
SiFive Fu540 board.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Leo Liang <ycliang@andestech.com>
3 years agoazure: gitlab: travis: Update OpenSBI used for RISC-V testing
Bin Meng [Mon, 20 Jul 2020 03:52:23 +0000 (20:52 -0700)]
azure: gitlab: travis: Update OpenSBI used for RISC-V testing

Change to use OpenSBI release v0.8 generic platform images for QEMU
RISC-V CI testing for azure, gitlab and travis-ci.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agosifive: fu540: Enable SF distro bootcmd
Jagan Teki [Wed, 15 Jul 2020 10:09:03 +0000 (15:39 +0530)]
sifive: fu540: Enable SF distro bootcmd

Enable SPI flash(SF) distro boot command in Sifive FU540.

This distro boot will read the boot script at specific
location at the flash and start sourcing the same.

Included the SF device at the last of the target devices
list since all the rest of the devices on the list have
more possibility to boot the distribution due to the
size of the SPI flash is concern.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
3 years agosifive: fu540: Add boot flash script offset, size
Jagan Teki [Wed, 15 Jul 2020 10:09:02 +0000 (15:39 +0530)]
sifive: fu540: Add boot flash script offset, size

HiFive-Unleashed-A00 has SPI flash with 32MiB size.
So, let's use the script offset at the end of 4K.
This way it cannot overlap any offsets being used
by software components in flash layout.

So, SF distrocmd will pick the script at desired
script address and run.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
3 years agosifive: fu540: Mark the default env as SPI flash
Jagan Teki [Wed, 15 Jul 2020 10:09:01 +0000 (15:39 +0530)]
sifive: fu540: Mark the default env as SPI flash

Mark the default U-Boot environment as SPI flash since
this is an on board flash device.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
3 years agoenv: Enable SPI flash env for SiFive FU540
Jagan Teki [Wed, 15 Jul 2020 10:09:00 +0000 (15:39 +0530)]
env: Enable SPI flash env for SiFive FU540

SPI flash device on HiFive Unleashed has 32MiB Size.

This patch adds SPI flash environment after U-Boot proper
partition with a size of 128KiB.

SPI flash partition layout(32MiB):
    0 - 34 : reserved for GPT header
   35 - 39 : unused
   40 - 2087 : loader1 (SPL, FSBL)
 2088 - 10279 : loader2 (U-Boot proper, U-Boot)
10280 - 10535 : environment
10536 - 65494 : rootfs
65528 - 65536 : distro script

Note: the loader1 must start from 40th sector even though
there are 6 free sectors prior since 40th sector is nearest
flash sector boundary. 

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
3 years agosifive: fu540: Add Booting from SPI
Jagan Teki [Wed, 15 Jul 2020 10:08:59 +0000 (15:38 +0530)]
sifive: fu540: Add Booting from SPI

Add booting from SPI for SiFive Unleashed board.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
3 years agosifive: fu540: Add runtime boot mode detection
Jagan Teki [Wed, 15 Jul 2020 10:08:58 +0000 (15:38 +0530)]
sifive: fu540: Add runtime boot mode detection

Add support to detect boot mode at runtime for
SiFive FU540 boards.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: sifive: fu540: Enable SiFive PWM driver
Pragnesh Patel [Fri, 29 May 2020 06:44:52 +0000 (12:14 +0530)]
riscv: sifive: fu540: Enable SiFive PWM driver

This patch enables SiFive PWM driver for the SiFive
Unleashed board.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: Make SiFive HiFive Unleashed board boot again
Bin Meng [Mon, 20 Jul 2020 06:17:07 +0000 (23:17 -0700)]
riscv: Make SiFive HiFive Unleashed board boot again

Commit 40686c394e53 ("riscv: Clean up IPI initialization code")
caused U-Boot failed to boot on SiFive HiFive Unleashed board.

The codes inside arch_cpu_init_dm() may call U-Boot timer APIs
before the call to riscv_init_ipi(). At that time the timer register
base (e.g.: the SiFive CLINT device in this case) is unknown yet.

It might be the name riscv_init_ipi() that misleads people to only
consider it is related to IPI, but in fact the timer capability is
provided by the same SiFive CLINT device that provides the IPI.
Timer capability is needed for both UP and SMP.

Considering that the original refactor does have benefits, that it
makes the IPI code more similar to U-Boot initialization idioms.
It also removes some quite ugly macros. Let's do the minimal revert
instead of a complete revert, plus a fixes to arch_cpu_init_dm() to
consider the SPL case.

Fixes: 40686c394e53 ("riscv: Clean up IPI initialization code")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Leo Liang <ycliang@andestech.com>
3 years agoMerge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm
Tom Rini [Thu, 23 Jul 2020 19:56:06 +0000 (15:56 -0400)]
Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm

binman support for FIT
new UCLASS_SOC
patman switch 'test' command
minor fdt fixes
patman usability improvements

3 years agoMerge tag 'efi-2020-10-rc1-5' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Thu, 23 Jul 2020 12:57:35 +0000 (08:57 -0400)]
Merge tag 'efi-2020-10-rc1-5' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-10-rc1 (5)

The series provides bug fixes for:

* crash in OS when accessing UEFI variables
* returning from UEFI fit images to U-Boot
* error handling for variable services provided by OP-TEE
* error handling in EFI_FILE_PROTOCOL.Read()
* missing function documentation

The first patches needed to use intermediate certificates for
secure boot are added. (The rest of the series requires
updating sbsigntool in our CI systems.)

Logging is enabled in the bootefi command.

3 years agoMerge tag 'u-boot-rockchip-20200722' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Wed, 22 Jul 2020 15:30:52 +0000 (11:30 -0400)]
Merge tag 'u-boot-rockchip-20200722' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip

- New rk3326 board: Hardkernel Odroid Go2;
- Update board config and dts for RockPI 4/N8/N10;
- Update led boot on support for roc-rk3399-pc;
- Enable SPI Flash suppor for rk3328 rock64 board;
- Update rockchip pcie phy to use generic framework;

3 years agorockchip: rock-p-n8/n10: Disable RAM_ROCKCHIP_DEBUG
Jagan Teki [Tue, 21 Jul 2020 15:28:09 +0000 (20:58 +0530)]
rockchip: rock-p-n8/n10: Disable RAM_ROCKCHIP_DEBUG

Disable ram rockchip debug driver for ROCKPi N8/N10 boards
since we have verified ram in many instances with respective
U-Boot versions.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoarm64: dts: rockchip: Add u-boot, spl-boot-order for ROCKPi N10
Jagan Teki [Tue, 21 Jul 2020 15:28:08 +0000 (20:58 +0530)]
arm64: dts: rockchip: Add u-boot, spl-boot-order for ROCKPi N10

Add u-boot,spl-boot-order for ROCKPi N10, so-that it can able
to boot from eMMC and SDMMC in order.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rock-pi-n10: Enable PCI/NVME
Jagan Teki [Tue, 21 Jul 2020 15:28:07 +0000 (20:58 +0530)]
rockchip: rock-pi-n10: Enable PCI/NVME

Enable PCI/NVME for M.2 Slot on RockPI-4 boards.

=> nvme info
Device 0: Vendor: 0x144d Rev: 4L1QCXB7 Prod: S35FNX0J623292
            Type: Hard Disk
            Capacity: 122104.3 MB = 119.2 GB (250069680 x 512)

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rock-pi-n8: Enable on board devices
Suniel Mahesh [Tue, 21 Jul 2020 15:24:43 +0000 (20:54 +0530)]
rockchip: rock-pi-n8: Enable on board devices

Enable common on board devices for ROCKPi N8.

- USB 2.0 Host
- USB 2.0 OTG/Gadget
- HDMI Out

Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: evb_rk3288: Add console settings
Suniel Mahesh [Tue, 21 Jul 2020 15:24:42 +0000 (20:54 +0530)]
rockchip: evb_rk3288: Add console settings

Add console settings like stdin, stdout and stderr as
usbkbd and vidconsole respectively for evb-rk3288 targets.

This would certainly help to detect the attached video
devices (like HDMI) and print the console messages on display.

Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rock-pi-n10: Enable on board devices
Suniel Mahesh [Tue, 21 Jul 2020 15:24:41 +0000 (20:54 +0530)]
rockchip: rock-pi-n10: Enable on board devices

Enable common on board devices for ROCKPi N10.

- USB 2.0 Host
- USB 3.0 Host
- USB 3.0 Gadget
- HDMI Out

Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoarm64: dts: rockchip: Add PCIe for RockPI N10
Jagan Teki [Tue, 21 Jul 2020 15:24:40 +0000 (20:54 +0530)]
arm64: dts: rockchip: Add PCIe for RockPI N10

This patch adds support to enable PCIe for RockPI N10.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoarm: dts: rockchip: Add HDMI out for RockPI N8/N10
Jagan Teki [Tue, 21 Jul 2020 15:24:39 +0000 (20:54 +0530)]
arm: dts: rockchip: Add HDMI out for RockPI N8/N10

This patch adds support to enable HDMI out for
N10 and N8 combinations SBCs.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoARM: dts: rockchip: Add USB for RockPI N8/N10
Jagan Teki [Tue, 21 Jul 2020 15:24:38 +0000 (20:54 +0530)]
ARM: dts: rockchip: Add USB for RockPI N8/N10

Radxa dalang carrier board has 2x USB 2.0 and 1x USB 3.0
ports.

This patch adds support to enable all these USB ports for
N10 and N8 combinations SBCs.

Note that the USB 3.0 port on RockPI N8 combination works
as USB 2.0 OTG since it is driven from RK3288.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoARM: dts: rockchip: Add usb host0 ohci node for rk3288
Jagan Teki [Tue, 21 Jul 2020 15:24:37 +0000 (20:54 +0530)]
ARM: dts: rockchip: Add usb host0 ohci node for rk3288

rk3288 and rk3288w have a usb host0 ohci controller.

Although rk3288 ohci doesn't actually work on hardware, but
rk3288w ohci can work well.

So add usb host0 ohci node in rk3288 dtsi and the quirk in
ohci platform driver will disable ohci on rk3288.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoarm: dts: rockchip: Sync rk3288 dtsi from linux
Suniel Mahesh [Tue, 21 Jul 2020 15:24:36 +0000 (20:54 +0530)]
arm: dts: rockchip: Sync rk3288 dtsi from linux

This sync has changes required to use HDMI CEC pin in U-Boot.

Sync dts from linux v5.8-rc5 commit:
"ARM: dts: rockchip: define the two possible rk3288 CEC pins"
(sha1: 838980dd04e994bf81cf104fa01ae60802146b39)

Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agoARM: dts: rockchip: Sync ROCKPi N8/N10 dts(i) from Linux
Jagan Teki [Tue, 21 Jul 2020 15:24:35 +0000 (20:54 +0530)]
ARM: dts: rockchip: Sync ROCKPi N8/N10 dts(i) from Linux

Sync ROCKPi N8/N10 dts(i) changes from Linux.

commit <afd9eb880414> ("ARM: dts: rockchip: Add Radxa Rock Pi N8 initial
support")

Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: roc-rk3399-pc: Set LED only during POR and pwr_key=y
Jagan Teki [Tue, 21 Jul 2020 15:06:04 +0000 (20:36 +0530)]
rockchip: roc-rk3399-pc: Set LED only during POR and pwr_key=y

ROC-RK3399-PC has specific set of configurations for
on-board led setup.

Due to easiness for user to know the state of the board
roc-rk339-pc board code will setup the low power led
on/off, and waiting for user to press power key and then
glow full power led.

All this needs to happen only during power-on-reset not
for soft reset or WDT.

Also, it is not a proper usage to ask the user to press
the Power key if the board connected remotely, so add
the environment variable 'pwr_key' to check as well.

So, user need to press Power key only
- during POR
- pwr_key=y

Tested-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: Separate the reset cause from display cpuinfo
Jagan Teki [Tue, 21 Jul 2020 15:06:03 +0000 (20:36 +0530)]
rockchip: Separate the reset cause from display cpuinfo

reset cause is a generic functionality based on the soc
cru registers in rockchip. This can be used for printing
the cause of reset in cpuinfo or some other place where
reset cause is needed. 

Other than cpuinfo, reset cause can also be using during
bootcount for checking the specific reset cause and glow
the led based on the reset cause.

So, let's separate the reset cause code from cpuinfo, and
add a check to build it for rk3399, rk3288 since these two
soc are supporting reset cause as of now.

Tested-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: Don't clear the reset status reg
Jagan Teki [Tue, 21 Jul 2020 15:06:02 +0000 (20:36 +0530)]
rockchip: Don't clear the reset status reg

reset reason can be used several stages of U-Boot bootloader
like SPL, U-Boot proper based on the requirements.

Clearing the status register end of get_reset_cause will end
up showing the wrong reset cause when it read the second time.
For example, if board resets, SPL reads the reset status as
RST whereas U-Boot proper reads the status as POR.

However, based on the latest testing clearing reset status
won't be required for determine the last reset cause or
following resets.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: tpl: Remove board_early_init_f()
Kever Yang [Wed, 22 Jul 2020 12:26:30 +0000 (20:26 +0800)]
rockchip: tpl: Remove board_early_init_f()

There is no need for board_early_init_f() in TPL, anything like this
should goes to SPL.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: roc-rk3399-pc: Add custom led_setup()
Jagan Teki [Tue, 21 Jul 2020 15:06:01 +0000 (20:36 +0530)]
rockchip: roc-rk3399-pc: Add custom led_setup()

roc-rk3399-pc has some specific requirements to support LEDS,
environment. board detection and etc prior to U-Boot proper.

So as of now SPL would be a better stage for these custom board
requirements to support unlike TPL. Adding few of these custom
requirements like LEDS in TPL would require extra code pulling
and also the size of TPL can grow.

So, this patch moves the leds code from TPL into SPL Board init
led_setup code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
(split tpl.c change as separate patch)
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rk3399: Add weak led_setup()
Jagan Teki [Tue, 21 Jul 2020 15:06:00 +0000 (20:36 +0530)]
rockchip: rk3399: Add weak led_setup()

Add weak led_setup() so that board which has an uncommon
led setup code that can make use of custom implementation.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rk3288: Add OF board setup
Jagan Teki [Tue, 21 Jul 2020 06:46:38 +0000 (12:16 +0530)]
rockchip: rk3288: Add OF board setup

The new rk3288 revision rk3288w has some changes with respect
to legacy rk3288 like hclk_vio in cru and usb host0 ohci.

Linux clock driver already handle this via rockchip,rk3288w-cru
compatible.

USB ohci host can enable via dts for rk3288w based boards.

So, add fdt board setup code to update cru compatible with
rk3288w-cru compatible if the SOC revision is RK3288W.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: Add rk3288 SoC detection helper
Jagan Teki [Tue, 21 Jul 2020 06:46:37 +0000 (12:16 +0530)]
rockchip: Add rk3288 SoC detection helper

Rockchip SoC's has a new revision chip for rk3288 SoCs.

RK3288 has a new revision chip called RK3288W which is similar
but different hclk_vio clock and fixed OHCI host.

Add common Rockchip SoC detection helper to support this rk3288w
detection.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoarm64: dts: rockchip: Add Radxa ROCK Pi 4C support
Jagan Teki [Mon, 20 Jul 2020 18:55:49 +0000 (00:25 +0530)]
arm64: dts: rockchip: Add Radxa ROCK Pi 4C support

Rock PI 4C has AP6256 Wifi/BT, PoE, miniDP, USB Host enabled
GPIO pin change compared to 4B, 4C.

So, add or enable difference nodes/properties in 4C dts
by including common dtsi.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoarm64: dts: rockchip: Add ROCKPi 4A/4B support
Jagan Teki [Mon, 20 Jul 2020 18:55:48 +0000 (00:25 +0530)]
arm64: dts: rockchip: Add ROCKPi 4A/4B support

Rock PI 4 has 3 variants of hardware platforms called
RockPI 4A, 4B, and 4C.

- Rock PI 4A has no Wif/BT.
- Rock PI 4B has AP6256 Wifi/BT, PoE.
- Rock PI 4C has AP6256 Wifi/BT, PoE, miniDP, USB Host enable
  GPIO pin change compared to 4B, 4C

So move common nodes, properties into dtsi file and include
on respective variant dts files.

Use 4B dts into default rock-pi-4 defconfig until we find any
solution for dynamic detection of these variants.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: firefly-rk3399: enable CONFIG_USB_DWC3
Kever Yang [Wed, 22 Jul 2020 11:46:19 +0000 (19:46 +0800)]
rockchip: firefly-rk3399: enable CONFIG_USB_DWC3

To fix below build error:
drivers/usb/host/built-in.o: In function `xhci_dwc3_remove':
drivers/usb/host/xhci-dwc3.c:174: undefined reference to `dwc3_shutdown_phy'
drivers/usb/host/built-in.o: In function `xhci_dwc3_probe':
drivers/usb/host/xhci-dwc3.c:130: undefined reference to `dwc3_setup_phy'

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rk3399: Add default env to support compressed kernel Image
Kever Yang [Sat, 18 Jul 2020 14:45:19 +0000 (22:45 +0800)]
rockchip: rk3399: Add default env to support compressed kernel Image

Add default kernel_comp_addr_r and kernel_comp_size to support boot
from compressed kernel Image, this space is temporarily used during
decompress according to README.distro.

Reported-by: Tian Yuanhao <tianyuanhao@aliyun.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: sdram: fix dram_init_banksize
Alex Bee [Tue, 14 Jul 2020 23:03:31 +0000 (01:03 +0200)]
rockchip: sdram: fix dram_init_banksize

Currently 2.5 GB is calculated as DRAM size for a 1 GB RK322x board
if CONFIG_SPL_OPTEE is set. This is troublesome when booting a
linux kernel since this size will be injected in FDT of the kernel.

gd->bd->bi_dram[0].start (which is basically CONFIG_SYS_SDRAM_BASE)
must not be taken into consideration for calculation of second bank
size, since this offset is already included in calculation of "top".

After applying this patch 992 MB (1024 MB - 32 MB reserved for
optee-os) is correctly calculated and has also been verified on
2 GB boards.

Signed-off-by: Alex Bee <knaerzche@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agopci: rockchip: Drop legacy PHY driver
Jagan Teki [Thu, 9 Jul 2020 18:11:03 +0000 (23:41 +0530)]
pci: rockchip: Drop legacy PHY driver

Drop the legacy PHY driver and it's associated code since
the PHY handling driver now part of Generic PHY framework.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agopci: rockchip: Switch to generic-phy
Jagan Teki [Thu, 9 Jul 2020 18:11:02 +0000 (23:41 +0530)]
pci: rockchip: Switch to generic-phy

Now, we have a PCIe PHY driver as part of the Generic
PHY framework. Let's use it instead of legacy PHY driver.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agophy: Add Rockchip PCIe PHY driver
Jagan Teki [Thu, 9 Jul 2020 18:11:01 +0000 (23:41 +0530)]
phy: Add Rockchip PCIe PHY driver

Add the Rockchip PCIe PHY driver as part of
Generic PHY framework.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: roc-rk3399-pc: Disable RAM_ROCKCHIP_DEBUG
Jagan Teki [Mon, 13 Jul 2020 20:06:35 +0000 (01:36 +0530)]
rockchip: roc-rk3399-pc: Disable RAM_ROCKCHIP_DEBUG

Disable ram rockchip debug driver for roc-rk3399-pc
boards since we have verified ram in many instances
with respective U-Boot versions.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: ram: fix debug funcfion define when RAM_ROCKCHIP_DEBUG not set
Kever Yang [Mon, 20 Jul 2020 10:34:12 +0000 (18:34 +0800)]
rockchip: ram: fix debug funcfion define when RAM_ROCKCHIP_DEBUG not set

The empty function define should not be in the header file, or else the
build will error with function multi definition after CONFIG_RAM_ROCKCHIP_DEBUG
is disabled.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoram: rk3399: Mark existing prints via RAM_ROCKCHIP_DEBUG
Jagan Teki [Mon, 13 Jul 2020 20:06:34 +0000 (01:36 +0530)]
ram: rk3399: Mark existing prints via RAM_ROCKCHIP_DEBUG

Right now all these debug statements are printing on the
console to make sure proper dram initialization happens.  

Mark them into RAM_ROCKCHIP_DEBUG would be more meaningful
and work like before since the RAM_ROCKCHIP_DEBUG is by
default yet.

No functionality changes.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoram: rk3399: Drop debug stride in driver
Jagan Teki [Mon, 13 Jul 2020 20:06:33 +0000 (01:36 +0530)]
ram: rk3399: Drop debug stride in driver

stride debug is already present in sdram_common.c via
RAM_ROCKCHIP_DEBUG.

So, drop the redundant debug stride code in rk3399 driver.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rock64-rk3328_defconfig: Add SPI Flash support
Johannes Krottmayer [Wed, 8 Jul 2020 22:50:34 +0000 (00:50 +0200)]
rockchip: rock64-rk3328_defconfig: Add SPI Flash support

Add U-Boot SPI Flash support for the PINE64 Rock64 board

Signed-off-by: Johannes Krottmayer <krjdev@gmail.com>
Cc: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoARM: dts: rk3328-rock64: Add SPI Flash support
Johannes Krottmayer [Wed, 8 Jul 2020 22:50:33 +0000 (00:50 +0200)]
ARM: dts: rk3328-rock64: Add SPI Flash support

Add U-Boot SPI Flash support for the PINE64 Rock64 board

Signed-off-by: Johannes Krottmayer <krjdev@gmail.com>
Cc: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoARM: dts: rk3328: Add SPI support
Johannes Krottmayer [Wed, 8 Jul 2020 21:57:40 +0000 (23:57 +0200)]
ARM: dts: rk3328: Add SPI support

Add U-Boot SPI support for the RK3328

Signed-off-by: Johannes Krottmayer <krjdev@gmail.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
(fix checkpatch error for code ident)
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agodrivers: spi: rk_spi: Add support for RK3328
Johannes Krottmayer [Wed, 8 Jul 2020 21:57:39 +0000 (23:57 +0200)]
drivers: spi: rk_spi: Add support for RK3328

Add support for the RK3328 SPI controller

Signed-off-by: Johannes Krottmayer <krjdev@gmail.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agodrivers: clk: rockchip: clk_rk3328: Add SPI support
Johannes Krottmayer [Wed, 8 Jul 2020 21:57:38 +0000 (23:57 +0200)]
drivers: clk: rockchip: clk_rk3328: Add SPI support

Add SPI support for the RK3328 clock driver

Signed-off-by: Johannes Krottmayer <krjdev@gmail.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: roc-rk3399-pc: Update ENV offset, size
Jagan Teki [Tue, 7 Jul 2020 13:50:49 +0000 (19:20 +0530)]
rockchip: roc-rk3399-pc: Update ENV offset, size

Adjust the ENV offset, size to fit into all images
on 16MB flash.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: roc-rk3399-pc: Enable USB Gadget
Jagan Teki [Tue, 7 Jul 2020 13:50:48 +0000 (19:20 +0530)]
rockchip: roc-rk3399-pc: Enable USB Gadget

Enable DWC3 core, gadget for roc-rk3399-pc 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>
3 years agorockchip: rock-pi-4: Enable HDMI output
Jagan Teki [Tue, 7 Jul 2020 13:50:47 +0000 (19:20 +0530)]
rockchip: rock-pi-4: Enable HDMI output

Enable config options to get HDMI output on RockPI-4 boards.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rock-pi-4: Enable USB Gadget
Jagan Teki [Tue, 7 Jul 2020 13:50:46 +0000 (19:20 +0530)]
rockchip: rock-pi-4: Enable USB Gadget

Enable USB gadget for rock-pi-4 boards.

This would help to use fastboot by default.

Note: Connect the Host USB cable (Port A or C) to rock-pi-4
Upper USB 3.0 port.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rock-pi-4: Enable PCI/NVME
Jagan Teki [Tue, 7 Jul 2020 13:50:45 +0000 (19:20 +0530)]
rockchip: rock-pi-4: Enable PCI/NVME

Enable PCI/NVME for M.2 Slot on RockPI-4 boards.

=> nvme info
Device 0: Vendor: 0x144d Rev: 2B2QEXM7 Prod: S4EUNG0MC10012Y
            Type: Hard Disk
            Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)

Cc: Tom Cubie <tom@radxa.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rock-pi-4: Enable USB3 Host
Jagan Teki [Tue, 7 Jul 2020 13:50:44 +0000 (19:20 +0530)]
rockchip: rock-pi-4: Enable USB3 Host

Enable USB3.0 Host support for RockPI-4 boards.

Note that the Upper USB3.0 port is marked as otg and
lower USB3.0 port marked as host, so this below log
capture when USB3.0 mass storage plug in at lower
USB 3.0 port.

Log:
Bus usb@fe380000: USB EHCI 1.00
Bus usb@fe3c0000: USB EHCI 1.00
Bus dwc3: usb maximum-speed not found
Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus dwc3: usb maximum-speed not found
Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@fe380000 for devices... 1 USB Device(s) found
scanning bus usb@fe3c0000 for devices... 1 USB Device(s) found
scanning bus dwc3 for devices... 1 USB Device(s) found
scanning bus dwc3 for devices... cannot reset port 1!?
2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
=> usb tree
USB device tree:
  1  Hub (480 Mb/s, 0mA)
     u-boot EHCI Host Controller

  1  Hub (480 Mb/s, 0mA)
     u-boot EHCI Host Controller

  1  Hub (5 Gb/s, 0mA)
     U-Boot XHCI Host Controller

  1  Hub (5 Gb/s, 0mA)
  |  U-Boot XHCI Host Controller
  |
  +-2  Mass Storage (5 Gb/s, 224mA)
       SanDisk Dual Drive 040130e3ee554b7078843f4eb331646

Cc: Tom Cubie <tom@radxa.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rockpro64: Enable USB3.0 Host
Jagan Teki [Mon, 20 Jul 2020 09:23:09 +0000 (14:53 +0530)]
rockchip: rockpro64: Enable USB3.0 Host

Enable USB3.0 Host support for RockPro64 boards.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: board: add Hardkernel Odroid Go2 board
Heiko Stuebner [Wed, 1 Jul 2020 09:28:42 +0000 (11:28 +0200)]
rockchip: board: add Hardkernel Odroid Go2 board

Also known as Odroid Go Advance but named Go2 internally by the
vendor it seems.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: px30: sync Odroid Go Advance devicetree from Linux
Heiko Stuebner [Wed, 1 Jul 2020 09:28:41 +0000 (11:28 +0200)]
rockchip: px30: sync Odroid Go Advance devicetree from Linux

Get the devicetree from mainline Linux and include it for U-Boot uses.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: px30: sync the main rk3326 dtsi from mainline
Heiko Stuebner [Wed, 1 Jul 2020 09:28:40 +0000 (11:28 +0200)]
rockchip: px30: sync the main rk3326 dtsi from mainline

The rk3326 is just a trimmed down px30 from a software perspective,
so the mainline rk3326 dtsi also ist just a tiny addition.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agolib: crypto: export and enhance pkcs7_verify_one()
AKASHI Takahiro [Tue, 21 Jul 2020 10:35:21 +0000 (19:35 +0900)]
lib: crypto: export and enhance pkcs7_verify_one()

The function, pkcs7_verify_one(), will be utilized to rework signature
verification logic aiming to support intermediate certificates in
"chain of trust."

To do that, its function interface is expanded, adding an extra argument
which is expected to return the last certificate in trusted chain.
Then, this last one must further be verified with signature database, db
and/or dbx.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
3 years agolib: crypto: add pkcs7_digest()
AKASHI Takahiro [Tue, 21 Jul 2020 10:35:20 +0000 (19:35 +0900)]
lib: crypto: add pkcs7_digest()

This function was nullified when the file, pkcs7_verify.c, was imported
because it calls further linux-specific interfaces inside, hence that
could lead to more files being imported from linux.

We need this function in pkcs7_verify_one() and so simply re-implement it
here instead of re-using the code.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
3 years agolib: crypto: import pkcs7_verify.c from linux
AKASHI Takahiro [Tue, 21 Jul 2020 10:35:19 +0000 (19:35 +0900)]
lib: crypto: import pkcs7_verify.c from linux

The file, pkcs7_verify.c, will now be imported from linux code
(crypto/asymmetric_keys/pkcs7_verify.c in 5.7) and modified to fit
into U-Boot environment.

In particular, pkcs7_verify_one() function will be used in a later patch
to rework signature verification logic aiming to support intermediate
certificates in "chain of trust."

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
3 years agolib: crypto: enable x509_check_for_self_signed()
AKASHI Takahiro [Tue, 21 Jul 2020 10:35:18 +0000 (19:35 +0900)]
lib: crypto: enable x509_check_for_self_signed()

When the file, x509_public_key.c, was imported from linux code in
    commit b4adf627d5b7 ("lib: crypto: add x509 parser"),
x509_check_for_self_signed() was commented out for simplicity.

Now it need be enabled in order to make pkcs7_verify_one(), which will be
imported in a later patch, functional.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
3 years agolib: crypto: add public_key_verify_signature()
AKASHI Takahiro [Tue, 21 Jul 2020 10:35:17 +0000 (19:35 +0900)]
lib: crypto: add public_key_verify_signature()

This function will be called from x509_check_for_self_signed() and
pkcs7_verify_one(), which will be imported from linux in a later patch.

While it does exist in linux code and has a similar functionality of
rsa_verify(), it calls further linux-specific interfaces inside.
That could lead to more files being imported from linux.

So simply re-implement it here instead of re-using the code.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>