platform/kernel/u-boot.git
10 months agoreset: mediatek: add reset definition for MediaTek MT7988 SoC
Weijie Gao [Wed, 19 Jul 2023 09:16:33 +0000 (17:16 +0800)]
reset: mediatek: add reset definition for MediaTek MT7988 SoC

This patch adds reset bits for MediaTek MT7988

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agoclk: mediatek: add clock driver support for MediaTek MT7988 SoC
Weijie Gao [Wed, 19 Jul 2023 09:16:28 +0000 (17:16 +0800)]
clk: mediatek: add clock driver support for MediaTek MT7988 SoC

This patch adds clock driver support for MediaTek MT7988 SoC

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agopwm: mtk: add support for MediaTek MT7988 SoC
Weijie Gao [Wed, 19 Jul 2023 09:16:24 +0000 (17:16 +0800)]
pwm: mtk: add support for MediaTek MT7988 SoC

This patch adds PWM support for MediaTek MT7988 SoC.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agoarm: dts: enable i2c support for MediaTek MT7981
Weijie Gao [Wed, 19 Jul 2023 09:16:19 +0000 (17:16 +0800)]
arm: dts: enable i2c support for MediaTek MT7981

This patch enables i2c support for MediaTek MT7981

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agoi2c: mediatek: fix I2C usability for MT7981
Weijie Gao [Wed, 19 Jul 2023 09:16:15 +0000 (17:16 +0800)]
i2c: mediatek: fix I2C usability for MT7981

MT7981 actually uses MediaTek I2C controller v3 instead of v1.
This patch adds support for I2C controller v3 fix fixes the I2C usability
for MT7981.

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agoreset: mediatek: check malloc return valaue before use
Weijie Gao [Wed, 19 Jul 2023 09:16:11 +0000 (17:16 +0800)]
reset: mediatek: check malloc return valaue before use

This patch add missing return value check for allocating the driver's
private data. -ENOMEM will be returned if malloc() fails.

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agoserial: mtk: initial priv data before using
Weijie Gao [Wed, 19 Jul 2023 09:16:07 +0000 (17:16 +0800)]
serial: mtk: initial priv data before using

This patch ensures driver private data being fully initialized in
_debug_uart_init which is not covered by .priv_auto ops.

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Reviewed-by: Stefan Roese <sr@denx.de>
10 months agospi: mtk_spim: clear IRQ enable bits
Weijie Gao [Wed, 19 Jul 2023 09:16:02 +0000 (17:16 +0800)]
spi: mtk_spim: clear IRQ enable bits

In u-boot we don't use IRQ. Instead, we poll busy bit in SPI_STATUS.

However these IRQ enable bits may be set in previous boot stage (BootROM).

If we leave these bits not cleared, although u-boot has disabled IRQ and
nothing will happen, the linux kernel may encounter panic during
initializing the spim driver due to IRQ event happens before IRQ handler
is properly setup.

This patch clear IRQ bits to prevent this from happening.

Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
10 months agospi: mtk_spim: get spi clk rate only once
Weijie Gao [Wed, 19 Jul 2023 09:15:54 +0000 (17:15 +0800)]
spi: mtk_spim: get spi clk rate only once

We don't really need to switch clk rate during operating SPIM controller.
Get clk rate only once at driver probing.

Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
10 months agoboard: mediatek: update config headers
Weijie Gao [Wed, 19 Jul 2023 09:15:47 +0000 (17:15 +0800)]
board: mediatek: update config headers

Remove unused information from include/configs/mtxxxx.h

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agoarm: mediatek: retrieve ram_base from dts node for armv8 platform
Weijie Gao [Wed, 19 Jul 2023 09:15:41 +0000 (17:15 +0800)]
arm: mediatek: retrieve ram_base from dts node for armv8 platform

Now we use fdtdec_setup_mem_size_base() to get DRAM base from fdt ram node
and update gd->ram_base. CFG_SYS_SDRAM_BASE is unused and will be removed.

Also, since mt7622 always passes fdt to linux kernel, there's no need to
assign value to gd->bd->bi_boot_params.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agoMerge tag 'dm-pull-2aug23' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Wed, 2 Aug 2023 21:33:09 +0000 (17:33 -0400)]
Merge tag 'dm-pull-2aug23' of https://source.denx.de/u-boot/custodians/u-boot-dm

binman fixes for options, etc.
binman template fixes / tweaks

10 months agobinman: Add a temporary hack for duplicate phandles
Simon Glass [Wed, 2 Aug 2023 15:23:13 +0000 (09:23 -0600)]
binman: Add a temporary hack for duplicate phandles

Three boards use a phandle in a FIT generator and the maintainer is
away. For now, add a hack to allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
10 months agocmd/bootdev: print readable status code
Heinrich Schuchardt [Sun, 30 Jul 2023 14:52:30 +0000 (16:52 +0200)]
cmd/bootdev: print readable status code

device_probe() called by the 'bootdev info' command
returns 0 or a negative error code.

itoa() cannot print negative numbers.

Convert the error code to a positive number.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
10 months agoboot: fix bootdev_list()
Heinrich Schuchardt [Sun, 30 Jul 2023 14:29:25 +0000 (16:29 +0200)]
boot: fix bootdev_list()

uclass_get_device_by_name() is meant to return 0 or a negative error code.
simple_itoa() cannot handle negative numbers.

This leads to output like:

    => bootdev list -p

    Seq  Probed  Status  Uclass    Name
    ---  ------  ------  --------  ------------------
      c   [   ]  18446744073709551614  spi_flash spi.bin@0.bootdev

Convert the status to a positive number. Now we get

    Seq  Probed  Status  Uclass    Name
    ---  ------  ------  --------  ------------------
      c   [   ]       2  spi_flash spi.bin@0.bootdev

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
10 months agobinman: Support templates containing phandles
Simon Glass [Sun, 23 Jul 2023 03:43:57 +0000 (21:43 -0600)]
binman: Support templates containing phandles

This provides support for phandles to be copied over from templates. This
is not quite safe, since if the template is instantiated twice (i.e. in
two different nodes), then duplicate phandles will be found. This will
result in an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
10 months agobinman: Remove templates after use
Simon Glass [Sun, 23 Jul 2023 03:43:56 +0000 (21:43 -0600)]
binman: Remove templates after use

It is not necessary to keep templates around after they have been
processed. They can cause confusion and potentially duplicate phandles.

Remove them.

Use the same means of detecting a template node in _ReadImageDesc so that
the two places are consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
10 months agofdt: Allow copying phandles into templates
Simon Glass [Sun, 23 Jul 2023 03:43:55 +0000 (21:43 -0600)]
fdt: Allow copying phandles into templates

Allow phandles to be copied over from a template. This can potentially
cause duplicate phandles, so detect this and report an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
10 months agodtoc: Add some debugging when copying nodes
Simon Glass [Sun, 23 Jul 2023 03:43:54 +0000 (21:43 -0600)]
dtoc: Add some debugging when copying nodes

Show the operations being performed, when debugging is enabled.

Convert a mistaken 'print' in test_copy_subnodes_from_phandles() while we
are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
10 months agodtoc: Make properties dirty when purging them
Simon Glass [Sun, 23 Jul 2023 03:43:53 +0000 (21:43 -0600)]
dtoc: Make properties dirty when purging them

Without the 'dirty' flag properties are not written back to the
devicetree when synced. This means that new properties copied over to a
node are not always written out.

Fix this and add a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
10 months agobinman: Produce a template-file after processing
Simon Glass [Sun, 23 Jul 2023 03:43:52 +0000 (21:43 -0600)]
binman: Produce a template-file after processing

This file aids debugging when binman fails to get far enough to write out
the final devicetree file. Write it immediate after template processing.

Signed-off-by: Simon Glass <sjg@chromium.org>
10 months agoMakefile: Show binman missing blob message
Jonas Karlman [Tue, 18 Jul 2023 20:34:40 +0000 (20:34 +0000)]
Makefile: Show binman missing blob message

When binman is invoked during a build of U-Boot and an external blob is
missing, the user is usually presented with a generic file not found in
input path message.

Invoke binman with --allow-missing so that binman can show relevant
missing blob help messages. Build continue to fail with missing blobs
unless BINMAN_ALLOW_MISSING=1 is used, same as before.

This changes the following error message during a normal build:

  binman: Filename 'atf-bl31' not found in input path (...)

to the following:

  Image 'itb' is missing external blobs and is non-functional: atf-blob

  /binman/itb/fit/images/atf/atf-blob (bl31.bin):
     See the documentation for your board. You may need to build ARM Trusted
     Firmware and build with BL31=/path/to/bl31.bin

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agobinman: Show filename in missing blob help message
Jonas Karlman [Tue, 18 Jul 2023 20:34:39 +0000 (20:34 +0000)]
binman: Show filename in missing blob help message

Show the filename next to the node path in missing blob help messages,
also show a generic missing blob message when there was no help message
for the help tag.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agobinman: Fix blank line usage for invalid images warning text
Jonas Karlman [Tue, 18 Jul 2023 20:34:37 +0000 (20:34 +0000)]
binman: Fix blank line usage for invalid images warning text

There is no blank line between last missing blob help message and the
header line for optional blob help messages.

  Image 'simple-bin' is missing external blobs and is non-functional: atf-bl31

  /binman/simple-bin/fit/images/@atf-SEQ/atf-bl31:
     See the documentation for your board. You may need to build ARM Trusted
     Firmware and build with BL31=/path/to/bl31.bin
  Image 'simple-bin' is missing external blobs but is still functional: tee-os

  /binman/simple-bin/fit/images/@tee-SEQ/tee-os:
     See the documentation for your board. You may need to build Open Portable
     Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin

  Some images are invalid

With this a blank line is inserted to make the text more readable.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agobinman: Override CheckOptional in fit entry
Jonas Karlman [Tue, 18 Jul 2023 20:34:36 +0000 (20:34 +0000)]
binman: Override CheckOptional in fit entry

Missing optional blobs was not reported for generated entries, e.g.
tee-os on rockchip targets. Implement a CheckOptional to fix this.

After this the following can be shown:

  Image 'simple-bin' is missing optional external blobs but is still functional: tee-os

  /binman/simple-bin/fit/images/@tee-SEQ/tee-os (tee-os):
     See the documentation for your board. You may need to build Open Portable
     Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agobinman: Report missing external blobs using error level
Jonas Karlman [Tue, 18 Jul 2023 20:34:35 +0000 (20:34 +0000)]
binman: Report missing external blobs using error level

Print missing external blobs using error level and missing optional
external blobs using warning level. Also change to only print the header
line in color, red for missing and yellow for optional.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agobinman: Update missing optional external blob warning text
Jonas Karlman [Tue, 18 Jul 2023 20:34:34 +0000 (20:34 +0000)]
binman: Update missing optional external blob warning text

Make it more clear that the missing external blob is optional in the
printed warning message.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agobinman: Update tee-os missing blob help text
Jonas Karlman [Tue, 18 Jul 2023 20:34:34 +0000 (20:34 +0000)]
binman: Update tee-os missing blob help text

Make it a little bit more clear that it is U-Boot that should be built
with TEE=/path/to/tee.bin and not OP-TEE itself.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Wed, 2 Aug 2023 16:13:16 +0000 (12:13 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

+ Fix compilation error for CI when enabling RTL8169 driver
+ Fix compilation error for pci_mmc.c by adding acpi_table header file
+ Support video console and usb keyboard on RISC-V QEMU virt machine
+ Support StarFive JH7110 PCIe driver
+ Enable PCI on Unmatched board

10 months agobinman: elf: Check for ELF_TOOLS availability and remove extra semicolon
Lukas Funke [Tue, 18 Jul 2023 11:53:09 +0000 (13:53 +0200)]
binman: elf: Check for ELF_TOOLS availability and remove extra semicolon

Check if elf tools are available when running DecodeElf(). Also
remove superfuous semicolon at line ending.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Revert part of patch to make binman test pass
Signed-off-by: Simon Glass <sjg@chromium.org>
10 months agoriscv: qemu: Enable usb keyboard as an input device
Bin Meng [Sun, 23 Jul 2023 04:40:41 +0000 (12:40 +0800)]
riscv: qemu: Enable usb keyboard as an input device

This brings PCI xHCI support to QEMU RISC-V and uses a usb keyboard
as one of the input devices.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agoriscv: qemu: Remove out-of-date "riscv, kernel-start" handling
Bin Meng [Sun, 23 Jul 2023 04:40:40 +0000 (12:40 +0800)]
riscv: qemu: Remove out-of-date "riscv, kernel-start" handling

Commit 66ffe57 ("riscv: qemu: detect and boot the kernel passed by QEMU")
added some logic to handle "riscv,kernel-start" in DT and stored the
address to an environment variable kernel_start.

However this "riscv,kernel-start" has never been an upstream DT binding.
The upstream QEMU never generates such a DT either. Presumably U-Boot
development was based on a downstream QEMU fork.

Now we drop all codes in commit 66ffe57, except that BOARD_LATE_INIT
is kept for later use.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agoriscv: qemu: Enable PRE_CONSOLE_BUFFER
Bin Meng [Sun, 23 Jul 2023 04:40:38 +0000 (12:40 +0800)]
riscv: qemu: Enable PRE_CONSOLE_BUFFER

By default the video console only outputs messages after it's ready.
Messages before that won't show on the video console, but U-Boot has
an option to buffer the console messages before it's ready.

Enable this support, and carefully select an address for the buffer.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agoconsole: Print out complete stdio device list
Bin Meng [Sun, 23 Jul 2023 04:40:37 +0000 (12:40 +0800)]
console: Print out complete stdio device list

At present if both CONSOLE_MUX and SYS_CONSOLE_IS_IN_ENV are on,
during boot, the printed out stdio devices are incomplete, e.g.:
with "stdout=serial,vidconsole", only "vidconsole" is printed.

For such case, we can print out the stdio device name from the
environment variables.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
10 months agoconsole: Refactor stdio_print_current_devices() a little bit
Bin Meng [Sun, 23 Jul 2023 04:40:36 +0000 (12:40 +0800)]
console: Refactor stdio_print_current_devices() a little bit

In preparation to future changes, refactor this routine a little bit.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
10 months agoconsole: Make stdio_print_current_devices() static
Bin Meng [Sun, 23 Jul 2023 04:40:35 +0000 (12:40 +0800)]
console: Make stdio_print_current_devices() static

As it is only called in common/console.c

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # qemu-x86_64
10 months agoconsole: kconfig: Drop the redundant VIDEO dependency
Bin Meng [Sun, 23 Jul 2023 04:40:34 +0000 (12:40 +0800)]
console: kconfig: Drop the redundant VIDEO dependency

The VIDEO dependency is described twice in CONSOLE_MUX.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agoriscv: qemu: Enable Bochs video support
Bin Meng [Sun, 23 Jul 2023 04:40:33 +0000 (12:40 +0800)]
riscv: qemu: Enable Bochs video support

Enable video console using the emulated Bochs VGA card.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agoacpi: Add missing RISC-V acpi_table header
Heinrich Schuchardt [Wed, 26 Jul 2023 06:05:13 +0000 (08:05 +0200)]
acpi: Add missing RISC-V acpi_table header

The pci_mmc.c driver can generate ACPI info and therefore includes
asm/acpi_table.h. This file does not exist for the RISC-V architecture
and thus code compilation fails when using this driver on RISC-V

Create an empty include file.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
10 months agoriscv: sifive: initialize PCI on Unmatched
Heinrich Schuchardt [Tue, 25 Jul 2023 10:41:30 +0000 (12:41 +0200)]
riscv: sifive: initialize PCI on Unmatched

The Unmatched board is typically booted from NVMe which requires PCI.
When dropping to a console PCI is not initialized yet. 'pci enum' has to be
called.

Change the configuration to call  pci_init() in board_init_r().

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Rick Chen <rick@andestech.com>
10 months agoconfigs: starfive-jh7110: Add CONFIG_RTL8169
Minda Chen [Thu, 20 Jul 2023 11:37:29 +0000 (19:37 +0800)]
configs: starfive-jh7110: Add CONFIG_RTL8169

Add PCIe device rtl8169 net adapter driver support.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
10 months agonet: rtl8169: Add one device ID 0x8161
Minda Chen [Thu, 20 Jul 2023 11:37:28 +0000 (19:37 +0800)]
net: rtl8169: Add one device ID 0x8161

Add rtl8169 NIC device ID and reorder the device ID.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
10 months agonet: rtl8169: Fix DMA minimal aligned compile warning in RISC-V
Minda Chen [Thu, 20 Jul 2023 11:37:27 +0000 (19:37 +0800)]
net: rtl8169: Fix DMA minimal aligned compile warning in RISC-V

For RISC-V architeture, hardware maintain the dcache coherency.
Software do not flush the cache. So even cache-line size larger
than descriptor size, driver can work.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
10 months agonet: rtl8169: Fix compile warning in rtl8169
Minda Chen [Thu, 20 Jul 2023 11:37:26 +0000 (19:37 +0800)]
net: rtl8169: Fix compile warning in rtl8169

While compiling rtl8169.c, There are many "make pointer from
integer without a cast" compile warnings. fix them with
adding cast.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
10 months agoriscv: dts: starfive: Enable PCIe host controller
Mason Huo [Tue, 25 Jul 2023 09:46:50 +0000 (17:46 +0800)]
riscv: dts: starfive: Enable PCIe host controller

Enable and add pinctrl configuration for PCIe host controller.

Signed-off-by: Mason Huo <mason.huo@starfivetech.com>
Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
10 months agoconfigs: starfive-jh7110: Add support for PCIe host driver
Mason Huo [Tue, 25 Jul 2023 09:46:49 +0000 (17:46 +0800)]
configs: starfive-jh7110: Add support for PCIe host driver

Add PCIe host driver and nvme driver in configure file.

Signed-off-by: Mason Huo <mason.huo@starfivetech.com>
Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
10 months agostarfive: pci: Add StarFive JH7110 pcie driver
Mason Huo [Tue, 25 Jul 2023 09:46:48 +0000 (17:46 +0800)]
starfive: pci: Add StarFive JH7110 pcie driver

Add pcie driver for StarFive JH7110, Also add PLDA
PCIe controller common driver functions.

Several devices are tested:
a) M.2 NVMe SSD
b) Realtek 8169 Ethernet adapter.

Signed-off-by: Mason Huo <mason.huo@starfivetech.com>
Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Acked-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
10 months agoi2c: designware: Add Kconfig for designware_i2c_pci.c
Minda Chen [Tue, 25 Jul 2023 09:46:47 +0000 (17:46 +0800)]
i2c: designware: Add Kconfig for designware_i2c_pci.c

As the Designware_i2c_pci.c uses ACPI APIs, If some SoCs (StarFive
JH7110) contain Designware i2c and PCI but do not use ACPI,
This file cannot be compiled. So add a new Kconfig for
designware_i2c_pci.c, which depends on ACPIGEN

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
10 months agoMerge tag 'x86-pull-20230801' of https://source.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Tue, 1 Aug 2023 15:57:55 +0000 (11:57 -0400)]
Merge tag 'x86-pull-20230801' of https://source.denx.de/u-boot/custodians/u-boot-x86

- MTRR fixes for x86 boards
- Add a little more info to 'cbsysinfo' command

10 months agoMerge tag 'video-20230801' of https://source.denx.de/u-boot/custodians/u-boot-video
Tom Rini [Tue, 1 Aug 2023 14:17:49 +0000 (10:17 -0400)]
Merge tag 'video-20230801' of https://source.denx.de/u-boot/custodians/u-boot-video

 - dm video cosmetic style fix
 - bochs: remove the x86 limitation
 - correct kconfig text for PCI default FB size
 - kconfig: drop the superfluous PCI dependency
 - set up default FB size for Bochs

10 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Tue, 1 Aug 2023 14:17:23 +0000 (10:17 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- i2c-gpio: Correctly handle new {sda, scl}-gpios bindings (Chris)
- mvebu: x240: Use i2c-gpio instead of built in controller (Chris)

10 months agodrivers: video: tidss: tidss_drv: Use kconfig VIDEO_REMOVE to remove video
Nikhil M Jain [Thu, 27 Jul 2023 06:31:26 +0000 (12:01 +0530)]
drivers: video: tidss: tidss_drv: Use kconfig VIDEO_REMOVE to remove video

Perform removal of DSS if kconfigs VIDEO_REMOVE or SPL_VIDEO_REMOVE is
set by user. Otherwise if above Kconfigs are not selected, it is assumed
that user wants splash screen to be displayed until linux kernel boots
up. In such scenario, leave the power domain of DSS as "on" so that
splash screen stays intact until kernel boots up.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
10 months agodrivers: video: tidss: tidss_drv: Change remove method
Nikhil M Jain [Thu, 27 Jul 2023 06:31:25 +0000 (12:01 +0530)]
drivers: video: tidss: tidss_drv: Change remove method

Change remove method of DSS video driver to disable video port instead
of performing a soft reset, as soft reset takes longer duration. Video
port is disabled by setting enable bit of video port to 0.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
10 months agovideo: bochs: Set the frame buffer size per configuration
Bin Meng [Sun, 23 Jul 2023 04:40:32 +0000 (12:40 +0800)]
video: bochs: Set the frame buffer size per configuration

At present the uclass stored frame buffer size is set to a hard
coded value, but we can calculate the correct value based on what
is configured.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # qemu-x86_64
10 months agovideo: kconfig: Set default FB size for Bochs
Bin Meng [Sun, 23 Jul 2023 04:40:31 +0000 (12:40 +0800)]
video: kconfig: Set default FB size for Bochs

Set up a default frame buffer size of 8MiB for Bochs for non-x86
architecturs as PCI is normally not enumerated before relocation
on these architectures.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agovideo: kconfig: Drop the superfluous dependency
Bin Meng [Sun, 23 Jul 2023 04:40:30 +0000 (12:40 +0800)]
video: kconfig: Drop the superfluous dependency

PCI is always selected by X86 architecture hence "X86 && PCI" does
not make it better.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # qemu-x86_64
10 months agovideo: kconfig: Fix wrong text for the PCI default FB size
Bin Meng [Sun, 23 Jul 2023 04:40:29 +0000 (12:40 +0800)]
video: kconfig: Fix wrong text for the PCI default FB size

There is an example in the VIDEO_PCI_DEFAULT_FB_SIZE help text to
tell people how to calculate its value but the resolution given
does not match the value. Fix it.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agovideo: bochs: Remove the x86 dependency
Bin Meng [Sun, 23 Jul 2023 04:40:28 +0000 (12:40 +0800)]
video: bochs: Remove the x86 dependency

Now that the driver is legacy free, remove the x86 dependency so
that it can be used on non-x86 architectures.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # qemu-x86_64
10 months agovideo: bochs: Avoid using IO instructions to access VGA IO port
Bin Meng [Sun, 23 Jul 2023 04:40:27 +0000 (12:40 +0800)]
video: bochs: Avoid using IO instructions to access VGA IO port

At present the driver uses IO instructions to access the legacy
VGA IO ports, which unfortunately limits the driver to work only
on x86. It turns out the IO instruction is not necessary as Bochs
VGA card remaps the legacy VGA IO ports (0x3c0 -> 0x3df) to its
memory mapped register space from offset 0x400.

Update the driver to use MMIO access for VGA IO port.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # qemu-x86_64
10 months agovideo: bochs: Drop the useless argument of bochs_vga_write()
Bin Meng [Sun, 23 Jul 2023 04:40:26 +0000 (12:40 +0800)]
video: bochs: Drop the useless argument of bochs_vga_write()

bochs_vga_write() takes 'index' as one argument, but never uses it.

While we are here, use macros instead of magic numbers for the
VGA IO port register name and value.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # qemu-x86_64
10 months agovideo: bochs: Drop inclusion of <asm/mtrr.h>
Bin Meng [Sun, 23 Jul 2023 04:40:25 +0000 (12:40 +0800)]
video: bochs: Drop inclusion of <asm/mtrr.h>

The driver does not call any MTRR APIs.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # qemu-x86_64
10 months agodm: video: Cosmetic style fix
Bin Meng [Sun, 23 Jul 2023 04:40:24 +0000 (12:40 +0800)]
dm: video: Cosmetic style fix

Some coding convention fixes for video_post_bind().

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # qemu-x86_64
10 months agox86: Add a little more info to cbsysinfo
Simon Glass [Tue, 25 Jul 2023 21:37:06 +0000 (15:37 -0600)]
x86: Add a little more info to cbsysinfo

Show the number of records in the table and the total table size in
bytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
10 months agox86: Return mtrr_add_request() to its old purpose
Simon Glass [Mon, 31 Jul 2023 06:01:08 +0000 (14:01 +0800)]
x86: Return mtrr_add_request() to its old purpose

This function used to be for adding a list of requests to be actioned on
relocation. Revert it back to this purpose, to avoid problems with boards
which need control of their MTRRs (i.e. those which don't use FSP).

The mtrr_set_next_var() function is available when the next free
variable-MTRR must be set, so this can be used instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Fixes: 3bcd6cf89ef ("x86: mtrr: Skip MSRs that were already programmed..")
Fixes: 596bd0589ad ("x86: mtrr: Do not clear the unused ones..")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
10 months agovideo: vesa: Use mtrr_set_next_var() for graphics memory
Bin Meng [Mon, 31 Jul 2023 06:01:07 +0000 (14:01 +0800)]
video: vesa: Use mtrr_set_next_var() for graphics memory

At present this uses mtrr_add_request() & mtrr_commit() combination
to program the MTRR for graphics memory. This usage has two major
issues as below:

- mtrr_commit() will re-initialize all MTRR registers from index 0,
  using the settings previously added by mtrr_add_request() and saved
  in gd->arch.mtrr_req[], which won't cause any issue but is unnecessary
- The way such combination works is based on the assumption that U-Boot
  has full control with MTRR programming (e.g.: U-Boot without any blob
  that does all low-level initialization on its own, or using FSP2 which
  does not touch MTRR), but this is not the case with FSP. FSP programs
  some MTRRs during its execution but U-Boot does not have the settings
  saved in gd->arch.mtrr_req[] and when doing mtrr_commit() it will
  corrupt what was already programmed previously.

Correct this to use mtrr_set_next_var() instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agovideo: ivybridge: Use mtrr_set_next_var() for graphics memory
Bin Meng [Mon, 31 Jul 2023 06:01:06 +0000 (14:01 +0800)]
video: ivybridge: Use mtrr_set_next_var() for graphics memory

At present this uses mtrr_add_request() & mtrr_commit() combination
to program the MTRR for graphics memory. This usage has two major
issues as below:

- mtrr_commit() will re-initialize all MTRR registers from index 0,
  using the settings previously added by mtrr_add_request() and saved
  in gd->arch.mtrr_req[], which won't cause any issue but is unnecessary
- The way such combination works is based on the assumption that U-Boot
  has full control with MTRR programming (e.g.: U-Boot without any blob
  that does all low-level initialization on its own, or using FSP2 which
  does not touch MTRR), but this is not the case with FSP. FSP programs
  some MTRRs during its execution but U-Boot does not have the settings
  saved in gd->arch.mtrr_req[] and when doing mtrr_commit() it will
  corrupt what was already programmed previously.

Correct this to use mtrr_set_next_var() instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agovideo: broadwell: Use mtrr_set_next_var() for graphics memory
Bin Meng [Mon, 31 Jul 2023 06:01:05 +0000 (14:01 +0800)]
video: broadwell: Use mtrr_set_next_var() for graphics memory

At present this uses mtrr_add_request() & mtrr_commit() combination
to program the MTRR for graphics memory. This usage has two major
issues as below:

- mtrr_commit() will re-initialize all MTRR registers from index 0,
  using the settings previously added by mtrr_add_request() and saved
  in gd->arch.mtrr_req[], which won't cause any issue but is unnecessary
- The way such combination works is based on the assumption that U-Boot
  has full control with MTRR programming (e.g.: U-Boot without any blob
  that does all low-level initialization on its own, or using FSP2 which
  does not touch MTRR), but this is not the case with FSP. FSP programs
  some MTRRs during its execution but U-Boot does not have the settings
  saved in gd->arch.mtrr_req[] and when doing mtrr_commit() it will
  corrupt what was already programmed previously.

Correct this to use mtrr_set_next_var() instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agox86: fsp: Use mtrr_set_next_var() for graphics memory
Bin Meng [Mon, 31 Jul 2023 06:01:04 +0000 (14:01 +0800)]
x86: fsp: Use mtrr_set_next_var() for graphics memory

At present this uses mtrr_add_request() & mtrr_commit() combination
to program the MTRR for graphics memory. This usage has two major
issues as below:

- mtrr_commit() will re-initialize all MTRR registers from index 0,
  using the settings previously added by mtrr_add_request() and saved
  in gd->arch.mtrr_req[], which won't cause any issue but is unnecessary
- The way such combination works is based on the assumption that U-Boot
  has full control with MTRR programming (e.g.: U-Boot without any blob
  that does all low-level initialization on its own, or using FSP2 which
  does not touch MTRR), but this is not the case with FSP. FSP programs
  some MTRRs during its execution but U-Boot does not have the settings
  saved in gd->arch.mtrr_req[] and when doing mtrr_commit() it will
  corrupt what was already programmed previously.

Correct this to use mtrr_set_next_var() instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agox86: Change testing logic of mtrr commit
Bin Meng [Mon, 31 Jul 2023 13:56:02 +0000 (07:56 -0600)]
x86: Change testing logic of mtrr commit

On Coral U-Boot SPL programs some MTRRs and FSPv2 in U-Boot proper
needs to program MTRRs too. With current testing logic of mtrr
commit in init_cache_f_r(), the mtrr commit is skipped which won't
work as the queued mtrr requests include setup for DRAM regions.

Change the logic to allow such configuration.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tweak to put back CONFIG_FSP_VERSION2 at top:
Signed-off-by: Simon Glass <sjg@chromium.org>
10 months agoMerge tag 'u-boot-rockchip-20230731' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 31 Jul 2023 15:31:26 +0000 (11:31 -0400)]
Merge tag 'u-boot-rockchip-20230731' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

- Update dwc3 generic driver and update support for rk3568/rk3328;
- Add boards:
        rk3566: Pine64 Quartz64-A/B, SOQuartz on Model A/Blade/CM4-IO
        rk3568: Radxa E25 Carrier Board
        rk3588: Radxa ROCK5A
- Fixes and updates for chromebook veryon/jerry/speedy;
- SPI support fixes for rk3399/rk3568/rk3588;
- rk3588 usbdp phy support;
- dts and config updates for different boards;

10 months agoboard: rockchip: Add Radxa E25 Carrier Board
Jonas Karlman [Sun, 30 Jul 2023 12:30:26 +0000 (12:30 +0000)]
board: rockchip: Add Radxa E25 Carrier Board

Radxa E25 is a network application carrier board for the Radxa CM3I SoM
with a RK3568 SoC. It features dual 2.5G ethernet, mini PCIe, M.2 B Key,
USB3, eMMC, SD, nano SIM card slot and a 26-pin GPIO header.

Features tested on a Radxa E25 v1.4:
- SD-card boot
- eMMC boot
- USB host
- PCIe/Ethernet adapters is detected
- SATA

Device tree is imported from linux next-20230728.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: FUKAUMI Naoki <naoki@radxa.com>
10 months agoconfigs: rockchip: Enable USB2PHY for RK3328 boards
Jagan Teki [Tue, 6 Jun 2023 17:09:18 +0000 (22:39 +0530)]
configs: rockchip: Enable USB2PHY for RK3328 boards

Enable USB2PHY for all RK3328 boards.

=> usb start
starting USB...
Bus usb@ff5c0000: USB EHCI 1.00
Bus usb@ff5d0000: USB OHCI 1.0
Bus usb@ff600000: generic_phy_get_bulk : no phys property
Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@ff580000: USB DWC2
scanning bus usb@ff5c0000 for devices... 2 USB Device(s) found
scanning bus usb@ff5d0000 for devices... 1 USB Device(s) found
scanning bus usb@ff600000 for devices... 2 USB Device(s) found
scanning bus usb@ff580000 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 2 Storage Device(s) found
=> usb tree
USB device tree:
  1  Hub (480 Mb/s, 0mA)
  |  u-boot EHCI Host Controller
  |
  +-2  Mass Storage (480 Mb/s, 500mA)
       TS-RDF5A Transcend 000000000009

  1  Hub (12 Mb/s, 0mA)
      U-Boot Root Hub

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

  1  Hub (480 Mb/s, 0mA)
  |   U-Boot Root Hub
  |
  +-2  Human Interface (12 Mb/s, 98mA)
       Logitech USB Receiver

=> dm tree -s
 Class     Index  Probed  Driver                Name
-----------------------------------------------------------
 syscon        1  [ + ]   syscon                |-- syscon@ff450000
 phy           0  [ + ]   rockchip_usb2phy      |   `-- usb2phy@100
 clk           2  [ + ]   rockchip_usb2phy_clo  |       |-- usb480m_phy
 phy           1  [ + ]   rockchip_usb2phy_por  |       |-- otg-port
 phy           2  [ + ]   rockchip_usb2phy_por  |       `-- host-port
 sysinfo       0  [ + ]   sysinfo_smbios        |-- smbios
 usb           3  [ + ]   dwc2_usb              |-- usb@ff580000
 usb_hub       3  [ + ]   usb_hub               |   `-- usb_hub
 usb_dev_ge    0  [ + ]   usb_dev_generic_drv   |       `-- generic_bus_3_dev_2
 usb           0  [ + ]   ehci_generic          |-- usb@ff5c0000
 usb_hub       0  [ + ]   usb_hub               |   `-- usb_hub
 usb_mass_s    0  [ + ]   usb_mass_storage      |       `-- usb_mass_storage
 blk           2  [ + ]   usb_storage_blk       |           |-- usb_mass_storage.lun0
 partition     4  [ + ]   blk_partition         |           |   |-- usb_mass_storage.lun0:1
 partition     5  [ + ]   blk_partition         |           |   `-- usb_mass_storage.lun0:2
 bootdev       3  [   ]   usb_bootdev           |           `-- usb_mass_storage.lun0.bootdev
 usb           1  [ + ]   ohci_generic          `-- usb@ff5d0000
 usb_hub       1  [ + ]   usb_hub                   `-- usb_hub

Cc: Tianling Shen <cnsztl@gmail.com>
Cc: David Bauer <mail@david-bauer.net>
Cc: Loic Devulder <ldevulder@suse.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Banglang Huang <banglang.huang@foxmail.com>
Cc: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agoclk: rockchip: rk3328: Handle usb480m phy clock
Jagan Teki [Tue, 6 Jun 2023 17:09:17 +0000 (22:39 +0530)]
clk: rockchip: rk3328: Handle usb480m phy clock

Handle USB480M clock ID in set_rate() and set_parent()
to allow the dt assigned-clocks and assigned-clock-parents
work on rk3328.dtsi

Cc: Lukasz Majewski <lukma@denx.de>
Cc: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agophy: rockchip-inno-usb2: Add USB2 PHY for RK3328
Jagan Teki [Tue, 6 Jun 2023 17:09:16 +0000 (22:39 +0530)]
phy: rockchip-inno-usb2: Add USB2 PHY for RK3328

USB2.0 Host and OTG controllers in RK3328 are using USB2PHY.

Add support for it.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agoconfigs: Enable DWC3 USB 3.0 on RK3328 boards
Jagan Teki [Tue, 6 Jun 2023 17:09:15 +0000 (22:39 +0530)]
configs: Enable DWC3 USB 3.0 on RK3328 boards

Enable USB 3.0 in all RK3328 boards.

=> usb start
starting USB...
Bus usb@ff5c0000: ehci_generic usb@ff5c0000: Failed to get clocks (ret=-19)
Port not available.
Bus usb@ff5d0000: USB OHCI 1.0
Bus usb@ff600000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@ff580000: 1 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
=> usb tree
USB device tree:
  1  Hub (12 Mb/s, 0mA)
      U-Boot Root Hub

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

  1  Hub (480 Mb/s, 0mA)
      U-Boot Root Hub

Cc: Tianling Shen <cnsztl@gmail.com>
Cc: David Bauer <mail@david-bauer.net>
Cc: Loic Devulder <ldevulder@suse.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Banglang Huang <banglang.huang@foxmail.com>
Cc: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agousb: dwc3-generic: Restrict single ctrl node for RK3328
Jagan Teki [Tue, 6 Jun 2023 17:09:14 +0000 (22:39 +0530)]
usb: dwc3-generic: Restrict single ctrl node for RK3328

Like Rockchip RK3568, the RK3328 also have single node to
represent the glue and ctrl for USB 3.0.

So, use the driver data to use single ctrl for RK3328 DWC3.

Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agoconfigs: Drop unused XHCI_DWC3 for RK3328 boards
Jagan Teki [Tue, 6 Jun 2023 17:09:13 +0000 (22:39 +0530)]
configs: Drop unused XHCI_DWC3 for RK3328 boards

Driver support for rk3328 is not supported so drop this
unused XHCI_DWC3.

Cc: Tianling Shen <cnsztl@gmail.com>
Cc: David Bauer <mail@david-bauer.net>
Cc: Loic Devulder <ldevulder@suse.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Banglang Huang <banglang.huang@foxmail.com>
Cc: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agoarm64: dts: rockchip: Drop unused rk3328-xhci node
Jagan Teki [Tue, 6 Jun 2023 17:09:12 +0000 (22:39 +0530)]
arm64: dts: rockchip: Drop unused rk3328-xhci node

rk3328-xhci has been added due to the fact that the upstream
dwc3 is unsupported. Moreover, the driver for rk3328-xhci is
not added to the code tree.

By considering these facts and unsupported rk3328-xhci this
patch is dropping all related code from DT. However, the DWC3
is fixed now in dwc3-generic and RK3328 USB 3.0 is functional
in upcoming patches.

Let's drop it.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agopower: regulator: rk8xx: Add 500us delay after LDO regulator is enabled
Jonas Karlman [Sun, 2 Jul 2023 12:41:15 +0000 (12:41 +0000)]
power: regulator: rk8xx: Add 500us delay after LDO regulator is enabled

A quick power cycle of a LDO regulator during dw-mmc signal voltage
change has shown that SD-card does not always get recognized.

Linux driver use an enable_time of 400us for LDO regulators. Apply a
500us delay when a LDO regulator is enabled to fix possible issues.

Fixes: 94afc1cb466a ("power: regulator: rk8xx: update the driver for rk808 and rk818")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: elaine.zhang<elaine.zhang@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agoarm: mvebu: x240: Use i2c-gpio instead of built in controller
Chris Packham [Tue, 25 Jul 2023 23:13:09 +0000 (11:13 +1200)]
arm: mvebu: x240: Use i2c-gpio instead of built in controller

There is an Errata with the built-in I2C controller where various I2C
hardware errors cause a complete lockup of the CPU (which eventually
results in an watchdog reset).

Put the I2C MPP pins into GPIO mode and use the i2c-gpio driver instead.
This uses a bit-banged implementation of an I2C controller and avoids
triggering the Errata.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
10 months agoi2c: i2c-gpio: Correctly handle new {sda, scl}-gpios bindings
Chris Packham [Tue, 25 Jul 2023 23:13:08 +0000 (11:13 +1200)]
i2c: i2c-gpio: Correctly handle new {sda, scl}-gpios bindings

gpio_request_list_by_name() returns the number of gpios requested.
Notably it swallows the underlying -ENOENT when the "gpios" property
does not exist.

Update the i2c-gpio driver to check for ret == 0 before trying the new
sda-gpios/scl-gpios properties.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
10 months agoboard: rockchip: add Radxa ROCK5A Rk3588 board
Eugen Hristev [Tue, 4 Jul 2023 19:05:12 +0000 (22:05 +0300)]
board: rockchip: add Radxa ROCK5A Rk3588 board

ROCK 5A is a Rockchip RK3588S based SBC (Single Board Computer) by Radxa.

There are tree variants depending on the DRAM size : 4G, 8G and 16G.

Specifications:

     Rockchip Rk3588S SoC
     4x ARM Cortex-A76, 4x ARM Cortex-A55
     4/8/16GB memory LPDDR4x
     Mali G610MC4 GPU
     MIPI CSI 2 multiple lanes connector
     4-lane MIPI DSI connector
     Audio – 3.5mm earphone jack
     eMMC module connector
     uSD slot (up to 128GB)
     2x USB 2.0, 2x USB 3.0
     2x micro HDMI 2.1 ports, one up to 8Kp60, the other up to 4Kp60
     Gigabit Ethernet RJ45 with optional PoE support
     40-pin IO header including UART, SPI, I2C and 5V DC power in
     USB PD over USB Type-C
     Size: 85mm x 56mm (Raspberry Pi 4 form factor)

Kernel commits:
d1824cf95799 ("arm64: dts: rockchip: Add rock-5a board")
991f136c9f8d ("arm64: dts: rockchip: Update sdhci alias for rock-5a")
304c8a759953 ("arm64: dts: rockchip: Remove empty line from rock-5a")
cda0c2ea65a0 ("arm64: dts: rockchip: Fix RX delay for ethernet phy on rk3588s-rock5a")

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agoARM: dts: rockchip: rk3588: Move bootph-all props to common file
Eugen Hristev [Tue, 4 Jul 2023 19:05:11 +0000 (22:05 +0300)]
ARM: dts: rockchip: rk3588: Move bootph-all props to common file

Move bootph-all prop to common SoC dt file, because they are typically used
by multiple boards.
Unreferenced nodes are removed from the SPL device tree during a
normal build.

Suggested-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agorockchip: rk3568-rock-3a: Fix pcie2x1 and pcie3x2 pinctrl override
Jonas Karlman [Mon, 31 Jul 2023 04:28:34 +0000 (04:28 +0000)]
rockchip: rk3568-rock-3a: Fix pcie2x1 and pcie3x2 pinctrl override

The pcie pinctrl override added in the commit a76aa6ffa6cd ("rockchip:
rk3568-rock-3a: Enable PCIe and NVMe support") is causing a pinmux issue
on linux when using a EFI boot flow.

The pcie reset-gpios must however be configured with gpio function, or
the device will freeze running pci enum and nothing is connected.

Adjust the pinctrl override in u-boot.dtsi to fix this issue. PCIe/NVMe
continues to work in both U-Boot and linux after this change.

Also revert disable of sdmmc2 and uart1 to fix use of wifi in linux when
using a EFI boot flow.

Fixes: a76aa6ffa6cd ("rockchip: rk3568-rock-3a: Enable PCIe and NVMe support")
Fixes: 073d911ae64a ("rockchip: rk3568-rock-3a: Sync device tree from linux")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
10 months agorockchip: rk3588-rock-5b: Fix SPI Flash alias
Jonas Karlman [Fri, 28 Jul 2023 12:05:41 +0000 (12:05 +0000)]
rockchip: rk3588-rock-5b: Fix SPI Flash alias

The commit fd6e425be243 ("rockchip: rk3588-rock-5b: Enable boot from SPI
NOR flash") enabled SPI flash support by adding a spi0 alias.

Correct this by adding spi0-spi5 aliases in rk3588s-u-boot.dtsi and
SF_DEFAULT_BUS=5 and SPL_DM_SEQ_ALIAS=y in defconfig. Also enabled
support for parsing and auto discovery of parameters, SFDP.

Fixes: fd6e425be243 ("rockchip: rk3588-rock-5b: Enable boot from SPI NOR flash")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agorockchip: rk3568-rock-3a: Fix SPI Flash alias
Jonas Karlman [Fri, 28 Jul 2023 12:05:40 +0000 (12:05 +0000)]
rockchip: rk3568-rock-3a: Fix SPI Flash alias

The commit 64f79f88a751 ("rockchip: rk3568-rock-3a: Enable boot from SPI
NOR flash") enabled SPI flash support by overriding the spi0 alias.

Correct this by adding a new spi4 alias in rk356x-u-boot.dtsi and
SF_DEFAULT_BUS=4 and SPL_DM_SEQ_ALIAS=y in defconfig. Also enabled
support for parsing and auto discovery of parameters, SFDP.

Fixes: 64f79f88a751 ("rockchip: rk3568-rock-3a: Enable boot from SPI NOR flash")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agodoc: rockchip: Update SPI flashing instruction
Jonas Karlman [Fri, 28 Jul 2023 11:38:40 +0000 (11:38 +0000)]
doc: rockchip: Update SPI flashing instruction

Update documentation on how to write a bootable u-boot-rockchip-spi.bin
image into SPI flash. This removes the reference to a hardcoded and now
obsolete 0x60000 payload offset.

Also remove an obsolete reference to pad_cat.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Quentin Schulz <foss+u-boot@0leil.net>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agorockchip: rk3399-roc-pc: Fix SPL max size and SPI flash payload offset
Jonas Karlman [Fri, 28 Jul 2023 11:38:38 +0000 (11:38 +0000)]
rockchip: rk3399-roc-pc: Fix SPL max size and SPI flash payload offset

TPL max size is limited to 184 KB, SPL is loaded to 0x0 and TF-A is
loaded to 0x40000, this limit SPL max size to 256 KB. With BootRom only
reading first 2 KB per 4 KB page of SPI flash, 880 KB may be needed for
TPL+SPL in a worst-case scenario. (184 KB + 256 KB) x 2 = 880 KB

Use 0xE0000 (896 KB) as the payload offset in SPI flash, this allows
for a payload of 3168 KB before env offset start to overlap.

Also add CONFIG_ROCKCHIP_SPI_IMAGE=y to build a bootable SPI flash
image, u-boot-rockchip-spi.bin.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Quentin Schulz <foss+u-boot@0leil.net>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agorockchip: rk3399-pinephone-pro: Fix SPL max size and SPI flash payload offset
Jonas Karlman [Fri, 28 Jul 2023 11:38:37 +0000 (11:38 +0000)]
rockchip: rk3399-pinephone-pro: Fix SPL max size and SPI flash payload offset

TPL max size is limited to 184 KB, SPL is loaded to 0x0 and TF-A is
loaded to 0x40000, this limit SPL max size to 256 KB. With BootRom only
reading first 2 KB per 4 KB page of SPI flash, 880 KB may be needed for
TPL+SPL in a worst-case scenario. (184 KB + 256 KB) x 2 = 880 KB

Use 0xE0000 (896 KB) as the payload offset in SPI flash, this allows
for a payload of 3168 KB before env offset start to overlap.

Also add CONFIG_ROCKCHIP_SPI_IMAGE=y to build a bootable SPI flash
image, u-boot-rockchip-spi.bin.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Quentin Schulz <foss+u-boot@0leil.net>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agorockchip: rk3399-pinebook-pro: Fix SPL max size and SPI flash payload offset
Jonas Karlman [Fri, 28 Jul 2023 11:38:35 +0000 (11:38 +0000)]
rockchip: rk3399-pinebook-pro: Fix SPL max size and SPI flash payload offset

TPL max size is limited to 184 KB, SPL is loaded to 0x0 and TF-A is
loaded to 0x40000, this limit SPL max size to 256 KB. With BootRom only
reading first 2 KB per 4 KB page of SPI flash, 880 KB may be needed for
TPL+SPL in a worst-case scenario. (184 KB + 256 KB) x 2 = 880 KB

Use 0xE0000 (896 KB) as the payload offset in SPI flash, this allows
for a payload of 3168 KB before env offset start to overlap.

Also add CONFIG_ROCKCHIP_SPI_IMAGE=y to build a bootable SPI flash
image, u-boot-rockchip-spi.bin.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Quentin Schulz <foss+u-boot@0leil.net>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agorockchip: rk3399-rockpro64: Fix SPL max size and SPI flash payload offset
Jonas Karlman [Fri, 28 Jul 2023 11:38:34 +0000 (11:38 +0000)]
rockchip: rk3399-rockpro64: Fix SPL max size and SPI flash payload offset

TPL max size is limited to 184 KB, SPL is loaded to 0x0 and TF-A is
loaded to 0x40000, this limit SPL max size to 256 KB. With BootRom only
reading first 2 KB per 4 KB page of SPI flash, 880 KB may be needed for
TPL+SPL in a worst-case scenario. (184 KB + 256 KB) x 2 = 880 KB

Use 0xE0000 (896 KB) as the payload offset in SPI flash, this allows
for a payload of 3168 KB before env offset start to overlap.

Also remove CONFIG_LTO=y now that there is sufficient space for SPL in
SPI flash, and to fix a build issue reported by Peter Robinson.

Fixes: 5713135ecc75 ("rockchip: rockpro64: Build u-boot-rockchip-spi.bin")
Reported-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Quentin Schulz <foss+u-boot@0leil.net>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agorockchip: rk356x-u-boot: Use relaxed u-boot,spl-boot-order
Jonas Karlman [Fri, 28 Jul 2023 11:53:08 +0000 (11:53 +0000)]
rockchip: rk356x-u-boot: Use relaxed u-boot,spl-boot-order

BootRom will try to load TPL+SPL from media in the following order:
- SPI NOR Flash
- SPI NAND Flash
- NAND Flash
- eMMC
- SDMMC

SPL will try to load FIT from media in the order defined in the device
tree u-boot,spl-boot-order property.

Change the default order to load FIT from to:
- same media as TPL+SPL
- SDMMC
- eMMC

Boards with strict load order requirements should override the
u-boot,spl-boot-order property in the board specific u-boot.dtsi.

Fixes: 42f67fb51cb4 ("rockchip: rk3568: Fix boot device detection")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agorockchip: rk356x-u-boot: Add bootph-all to common pinctrl nodes
Jonas Karlman [Fri, 28 Jul 2023 11:53:07 +0000 (11:53 +0000)]
rockchip: rk356x-u-boot: Add bootph-all to common pinctrl nodes

Add bootph-all prop to common pinctrl nodes for eMMC, FSPI, SD-card and
UART2 that are typically used by multiple boards. Unreferenced nodes are
removed from the SPL device tree during a normal build.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agorockchip: rk3566-radxa-cm3-io: Sync dts from linux v6.4
Jonas Karlman [Fri, 28 Jul 2023 11:53:06 +0000 (11:53 +0000)]
rockchip: rk3566-radxa-cm3-io: Sync dts from linux v6.4

Sync rk3566-radxa-cm3-io.dts from linux v6.4.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agorockchip: rk356x: Sync dtsi from linux v6.4
Jonas Karlman [Fri, 28 Jul 2023 11:53:05 +0000 (11:53 +0000)]
rockchip: rk356x: Sync dtsi from linux v6.4

Sync rk356x.dtsi from linux v6.4.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agoboard: rockchip: Add Pine64 SOQuartz on CM4-IO
Jonas Karlman [Sun, 30 Jul 2023 12:26:48 +0000 (12:26 +0000)]
board: rockchip: Add Pine64 SOQuartz on CM4-IO

The Pine64 SOQuartz compute module is mostly pin-compatible with the RPi
CM4 form factor. Therefore, it can slot into the official Raspberry Pi
CM4 IO carrier board. Add this configuration to U-Boot.

Features tested with a SOQuartz 4GB v1.1 2022-07-11:
- SD-card boot
- eMMC boot
- USB host

Device tree is imported from linux v6.4.

Co-developed-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agoboard: rockchip: Add Pine64 SOQuartz on Blade
Jonas Karlman [Sun, 30 Jul 2023 12:26:47 +0000 (12:26 +0000)]
board: rockchip: Add Pine64 SOQuartz on Blade

The Pine64 SOQuartz Blade board is a carrier board for the SOQuartz
CM4-compatible compute module. It features PoE, an M.2 slot, an SD card
slot, HDMI, USB, serial and ethernet.

Features tested with a SOQuartz 4GB v1.1 2022-07-11:
- SD-card boot
- eMMC boot
- PCIe/NVMe
- USB host

Device tree is imported from linux v6.4.

Co-developed-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agoboard: rockchip: Add Pine64 SOQuartz on Model A
Jonas Karlman [Sun, 30 Jul 2023 12:26:45 +0000 (12:26 +0000)]
board: rockchip: Add Pine64 SOQuartz on Model A

The Pine64 SOQuartz Model A board is a carrier board for the SOQuartz
CM4-compatible compute module. It exposes PCIe, ethernet, USB, HDMI,
CSI, DSI, eDP and a 40 pin GPIO header, and is powered by 12V DC.

Features tested with a SOQuartz 4GB v1.1 2022-07-11:
- SD-card boot
- eMMC boot
- PCIe/NVMe/AHCI
- USB host

Device tree is imported from linux v6.4.

Co-developed-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agoboard: rockchip: Add Pine64 Quartz64-B Board
Jonas Karlman [Sun, 30 Jul 2023 12:26:44 +0000 (12:26 +0000)]
board: rockchip: Add Pine64 Quartz64-B Board

The Pine64 Quartz64 Model B is a credit-card sized single-board
computer based on the Rockchip RK3566 SoC. The board features an M.2
PCIe slot, USB3, USB2, eMMC, SD, ethernet, HDMI, analog audio out, a
40 pin GPIO header and a DSI and CSI port, as well as on-board Wi-Fi.

Features tested on a Quartz64-B 4GB v1.4 2022-06-06:
- SD-card boot
- eMMC boot
- SPI Flash boot
- PCIe/NVMe
- USB host

Device tree is imported from linux v6.4.

Co-developed-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
10 months agoboard: rockchip: Add Pine64 Quartz64-A Board
Jonas Karlman [Sun, 30 Jul 2023 12:26:42 +0000 (12:26 +0000)]
board: rockchip: Add Pine64 Quartz64-A Board

The Pine64 Quartz64 Model A is a single-board computer based on the
Rockchip RK3566 SoC. The board features USB3, SATA, PCIe, HDMI, USB2.0,
CSI, DSI, eDP, eMMC, SD, and an e-paper parallel port, as well as a
20 pin GPIO header.

Features tested on a Quartz64-A 8GB v2.0 2021-04-27:
- SD-card boot
- eMMC boot
- PCIe/NVMe/AHCI
- USB host

Device tree is imported from linux v6.4.

Co-developed-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>