platform/kernel/u-boot.git
10 months agoboard: traverse: ten64: fix allocation order of MAC addresses
Mathew McBride [Fri, 21 Jul 2023 04:39:25 +0000 (04:39 +0000)]
board: traverse: ten64: fix allocation order of MAC addresses

On Ten64 boards, the "serial number" is the MAC address of the
first Gigabit Ethernet interface (labelled GE0 on the appliance),
and counted up from there.

The previous logic did not take into account U-Boot's ordering
of the network interfaces. By setting aliases/ethernetX in the device
tree we can ensure the U-Boot 'ethX' is the same as the labelled
port order on the unit, as well as the one adopted by Linux.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
10 months agoboard: traverse: ten64: init nvme devices in late boot to ensure bootflow availability
Mathew McBride [Fri, 21 Jul 2023 04:39:24 +0000 (04:39 +0000)]
board: traverse: ten64: init nvme devices in late boot to ensure bootflow availability

Ensure nvme devices are scanned before reaching the shell,
otherwise extra user intervention ("nvme scan") is required
before they are visible to bootdev/bootflow.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
10 months agoconfigs: ten64: enable NVME_PCI
Mathew McBride [Fri, 21 Jul 2023 04:39:23 +0000 (04:39 +0000)]
configs: ten64: enable NVME_PCI

This restores NVMe functionality after PCI(e) NVMe support
was split out from the NVMe driver.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
10 months agoboard: ten64: add a bootmenu entries for NAND-based entries
Mathew McBride [Fri, 21 Jul 2023 04:39:22 +0000 (04:39 +0000)]
board: ten64: add a bootmenu entries for NAND-based entries

The recovery-firmware and OpenWrt-NAND do not yet have bootflow
/bootstd entrypoints, so add bootmenu entries to make them
accessible.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
10 months agoboard: traverse: ten64: add NAND based OpenWrt bootcmd
Mathew McBride [Fri, 21 Jul 2023 04:39:21 +0000 (04:39 +0000)]
board: traverse: ten64: add NAND based OpenWrt bootcmd

The default Ten64 MTD configuration reserves two ubifs partitions
for OpenWrt residing on NAND flash. Add the bootcmd for this system
into the default environment.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
10 months agoboard: traverse: ten64: specify bootargs for recovery environment
Mathew McBride [Fri, 21 Jul 2023 04:39:20 +0000 (04:39 +0000)]
board: traverse: ten64: specify bootargs for recovery environment

The recovery environment[1] on the Ten64 is a OpenWrt-
based ramdisk stored on the NAND intended to help with
system setup tasks.

Before the bootargs were not being set for the recovery
command, relying instead on the existing bootargs variable.

Ensure the bootargs are set correctly prior to booting recovery.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
[1] https://ten64doc.traverse.com.au/software/recovery/

Reviewed-by: Peng Fan <peng.fan@nxp.com>
10 months agoboard: traverse: ten64: update DPAA2 (network) binary path on sdcards
Mathew McBride [Fri, 21 Jul 2023 04:39:19 +0000 (04:39 +0000)]
board: traverse: ten64: update DPAA2 (network) binary path on sdcards

Change the firmware on microSD path to "firmware/traverse/ten64"
as per EBBR section 4.2[1].

The Traverse firmware tools now locate the DPAA2 firmware
and configuration files under that path on the rescue
SD card image.
If a user then installs a standard Linux
distribution over the top of that sdcard, (in theory)
it will be left alone by distribution boot tooling.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
[1] https://arm-software.github.io/ebbr/index.html#firmware-partition-filesystem

Reviewed-by: Peng Fan <peng.fan@nxp.com>
10 months agoboard: traverse: ten64: fix DPAA2 (network) DPL corruption issue
Mathew McBride [Fri, 21 Jul 2023 04:39:18 +0000 (04:39 +0000)]
board: traverse: ten64: fix DPAA2 (network) DPL corruption issue

The DPAA2 DPL (data plane layout) file was previously
being loaded into 0x80300000, and set to be applied
just before hand off to the kernel.

When a FIT image with a load_address of 0x80000000 was
booted with bootm, the DPL in memory was overwritten.

Move the DPL load to 0x8E000000 (196MiB away from 0x80000000,
and below the other typical load addr of 0x90000000).

Ideally in the future, the DPL lazyapply command
("fsl_mc lazyapply DPL $dpl_addr") should be set to
load the DPL contents into a memory area owned by U-Boot.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
10 months agoboard: traverse: ten64: ensure retimer reset is done on new board revisions
Mathew McBride [Fri, 21 Jul 2023 04:39:17 +0000 (04:39 +0000)]
board: traverse: ten64: ensure retimer reset is done on new board revisions

Board revision C (production) and later require the SFP+
retimer to be turned on (or reset) on boot, by way of issuing
a command to the board's microcontroller (via I2C).

The comparison statement here was incorrect, as the board
ID decrements every revision (from 0xFF downwards),
so this was matching board RevA,B,C instead of Rev >= C.

Another oops that transpired when working on this issue,
is that if the board controller is not called (such as
CONFIG_TEN64_CONTROLLER=n or earlier board rev), then
the retimer udevice was not obtained. So the board
version check has to be moved inside board_cycle_retimer
(which probes/fetches the retimer device) as well.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
10 months agoboard: traverse: ten64: recognize board revision D
Mathew McBride [Fri, 21 Jul 2023 04:39:16 +0000 (04:39 +0000)]
board: traverse: ten64: recognize board revision D

Ten64 board revision D is a variant that removes the USB hub
and PCIe expander/switch, but is otherwise compatible with the
main production "C" version.

At the same time, revise the printf specifiers (PCB version
"1064-0201%s") to reduce the number of string characters related
to the boot printout.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
10 months agoboard: mediatek: add MT7988 reference boards
Weijie Gao [Wed, 19 Jul 2023 09:17:54 +0000 (17:17 +0800)]
board: mediatek: add MT7988 reference boards

This patch adds general board files based on MT7988 SoCs.

MT7988 uses one mmc controller for booting from both SD and eMMC,
and the pins of mmc controller booting from SD are also shared with
one of spi controllers.
So two configs are need for these boot types:

1. mt7988_rfb_defconfig - SPI-NOR, SPI-NAND and eMMC
2. mt7988_sd_rfb_defconfig - SPI-NAND and SD

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

This patch adds basic support for MediaTek MT7988 SoC.
This includes files that will initialize the SoC after boot and
its device tree.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agotools: mtk_image: use uint32_t for ghf header magic and version
Weijie Gao [Wed, 19 Jul 2023 09:17:45 +0000 (17:17 +0800)]
tools: mtk_image: use uint32_t for ghf header magic and version

This patch converts magic and version fields of ghf common header
to one field with the type of uint32_t to make this header flexible
for futher updates.

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

This patch adds support for MediaTek MT7988.

MT7988 features MediaTek NETSYS v3, including three GMACs, and two
of them supports 10Gbps USXGMII.

MT7988 embeds a MT7531 switch (not MCM) which supports accessing
internal registers through MMIO instead of MDIO.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agonet: mediatek: add support for NETSYS v3
Weijie Gao [Wed, 19 Jul 2023 09:17:37 +0000 (17:17 +0800)]
net: mediatek: add support for NETSYS v3

This patch adds support for NETSYS v3 hardware.
Comparing to NETSYS v2, NETSYS v3 has three GMACs.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agonet: mediatek: add USXGMII support
Weijie Gao [Wed, 19 Jul 2023 09:17:31 +0000 (17:17 +0800)]
net: mediatek: add USXGMII support

This patch adds support for USXGMII of SoC.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agoarm: dts: mediatek: add infracfg registers to support GMAC/USB3 Co-PHY
Weijie Gao [Wed, 19 Jul 2023 09:17:27 +0000 (17:17 +0800)]
arm: dts: mediatek: add infracfg registers to support GMAC/USB3 Co-PHY

This patch adds infracfg to eth node to support enabling GMAC2.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agonet: mediatek: add support for GMAC/USB3 PHY mux mode for MT7981
Weijie Gao [Wed, 19 Jul 2023 09:17:22 +0000 (17:17 +0800)]
net: mediatek: add support for GMAC/USB3 PHY mux mode for MT7981

MT7981 has its GMAC2 PHY shared with USB3. To enable GMAC2, mux
register must be set to connect the SGMII phy to GMAC2.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agoarm: dts: medaitek: convert gmac link mode to 2500base-x
Weijie Gao [Wed, 19 Jul 2023 09:17:18 +0000 (17:17 +0800)]
arm: dts: medaitek: convert gmac link mode to 2500base-x

Now that individual 2.5Gbps SGMII support has been added to
mtk-eth, all boards that use 2.5Gbps link with mt7531 must be
converted to use "2500base-x" instead of "sgmii".

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agonet: mediatek: add support for SGMII 1Gbps auto-negotiation mode
Weijie Gao [Wed, 19 Jul 2023 09:17:13 +0000 (17:17 +0800)]
net: mediatek: add support for SGMII 1Gbps auto-negotiation mode

Existing SGMII support of mtk-eth is actually a MediaTek-specific
2.5Gbps high-speed SGMII (HSGMII) which does not support
auto-negotiation mode.

This patch adds SGMII 1Gbps auto-negotiation mode and rename the
existing HSGMII to 2500basex.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agonet: mediatek: add missing static qualifier
Weijie Gao [Wed, 19 Jul 2023 09:17:07 +0000 (17:17 +0800)]
net: mediatek: add missing static qualifier

mt7531_mmd_ind_read and mt753x_switch_init are defined without static.
Since they're not used outside this file, we should add them back.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
fixup to add static qualifier

10 months agonet: mediatek: fix direct MDIO clause 45 access via SoC
Weijie Gao [Wed, 19 Jul 2023 09:17:03 +0000 (17:17 +0800)]
net: mediatek: fix direct MDIO clause 45 access via SoC

The original direct MDIO clause 45 access via SoC is missing the
data output. This patch adds it back to ensure MDIO clause 45 can
work properly for external PHYs.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agonet: mediatek: optimize the switch reset delay wait time
Weijie Gao [Wed, 19 Jul 2023 09:16:59 +0000 (17:16 +0800)]
net: mediatek: optimize the switch reset delay wait time

Not all switches requires 1 second delay after deasserting reset.
MT7531 requires only maximum 200ms.

This patch defines dedicated reset wait time for each switch chip, and will
significantly improve the boot time for boards using MT7531.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agonet: mediatek: connect switch to PSE only when starting eth is requested
Weijie Gao [Wed, 19 Jul 2023 09:16:54 +0000 (17:16 +0800)]
net: mediatek: connect switch to PSE only when starting eth is requested

So far the switch is initialized in probe stage and is connected to PSE
unconditionally. This will cause all packets being flooded to PSE and may
cause PSE hang before entering linux.

This patch changes the connection between switch and PSE:
- Still initialize switch in probe stage, but disconnect it with PSE
- Connect switch with PSE on eth start
- Disconnect on eth stop

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agopinctrl: mediatek: add pinctrl driver for MT7988 SoC
Weijie Gao [Wed, 19 Jul 2023 09:16:50 +0000 (17:16 +0800)]
pinctrl: mediatek: add pinctrl driver for MT7988 SoC

This patch adds pinctrl and gpio support for MT7988 SoC

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agopinctrl: mediatek: add pinmux_set ops support
Weijie Gao [Wed, 19 Jul 2023 09:16:46 +0000 (17:16 +0800)]
pinctrl: mediatek: add pinmux_set ops support

This patch adds pinmux_set ops for mediatek pinctrl framework

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agopinctrl: mediatek: fix the return value in driving configuration functions
Weijie Gao [Wed, 19 Jul 2023 09:16:42 +0000 (17:16 +0800)]
pinctrl: mediatek: fix the return value in driving configuration functions

The original mediatek pinctrl functions for driving configuration
'mtk_pinconf_drive_set_*' do not return -ENOSUPP even if input
parameters are not supported.
This patch fixes the return value in those functions.

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10 months agopinctrl: mediatek: convert most definitions to const
Weijie Gao [Wed, 19 Jul 2023 09:16:37 +0000 (17:16 +0800)]
pinctrl: mediatek: convert most definitions to const

There exists a situation of the mediatek pinctrl driver that may return
wrong pin function value for the pinmux driver:
- All pin function arrays are defined without const
- Some pin function arrays contain all-zero value, e.g.:
  static int mt7622_spi_funcs[] = { 0, 0, 0, 0, 0, 0, };
- These arrays will be put into .bss section during compilation
- .bss section has no "a" attribute and does not exist in the final binary
  file after objcopy.
- FDT binary blob is appended to the u-boot binary, which occupies the
  .bss section.
- During board_f stage, .bss has not been initialized, and contains the
  data of FDT, which is not full-zero data.
- pinctrl driver is initialized in board_f stage, and it will get wrong
  data if another driver is going to set default pinctrl.

Since pinmux information and soc data are only meant to be read-only, thus
should be declared as const. This will force all pinctrl data being put
into .rodata section. Since .rodata has "a" attribute, even the all-zero
data will be allocated and filled with correct value in to u-boot binary.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
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>