]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
16 months agovexpress64: Rework MAINTAINERS file slightly
Tom Rini [Tue, 25 Jul 2023 22:31:53 +0000 (18:31 -0400)]
vexpress64: Rework MAINTAINERS file slightly

Given that we no longer have a configs/vexpress_aemv8a_defconfig file,
drop that and then include at least the aarch64-specific config.h file
here.  Also move Linus and Peter up to the main entry as well so that
they'll get tagged for the board code too and not literally only the
defconfig.

Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoARM: imx: Update MAINTAINERS file on DH electronics i.MX8M Plus DHCOM
Marek Vasut [Tue, 18 Jul 2023 16:14:35 +0000 (18:14 +0200)]
ARM: imx: Update MAINTAINERS file on DH electronics i.MX8M Plus DHCOM

Make use of globs to cover all the DTs and defconfigs.
Fill in missing DH u-boot list name.

Signed-off-by: Marek Vasut <marex@denx.de>
16 months agofreescale: Remove Rajesh Bhagat MAINTAINERS
Sean Anderson [Tue, 18 Oct 2022 18:12:46 +0000 (14:12 -0400)]
freescale: Remove Rajesh Bhagat MAINTAINERS

Rajesh's email bounces. Remove his email from all boards he maintains.
Fortunately, he has co-maintainers on most boards. I have taken the
liberty of volunteering Pramod to maintain the LS1012AFRDM, since he
also maintains the LS1012AFRWY. Let me know if the board should be
orphaned instead.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
16 months agoMerge tag 'efi-2023-10-rc2-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Thu, 3 Aug 2023 16:43:24 +0000 (12:43 -0400)]
Merge tag 'efi-2023-10-rc2-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2023-10-rc2-2

Documentation:

* Move README.falcon to HTML
* Describe usage of QEMU virtio block device
* Add SPDX license identifiers to svg images
* Add more detail to the description of U-Boot boot phases

UEFI:

* Fix buffer overflows
* Fix memory leak in efi_add_memory_map_pg
* Properly check return values of calloc, uuid_str_to_bin,
  efi_parse_pkcs7_header

16 months agoMerge branch '2023-08-03-mediatek-and-ten64-updates'
Tom Rini [Thu, 3 Aug 2023 14:34:04 +0000 (10:34 -0400)]
Merge branch '2023-08-03-mediatek-and-ten64-updates'

Merge in a series for MediaTek update and another for Ten64.

To quote Weijie Gao for MediaTek:
This patch series add support for MediaTek MT7988 SoC with its reference
boards and related drivers.

This patch series add basic boot support on eMMC/SD/SPI-NOR/SPI-NAND for
these boards. The clock, pinctrl drivers and the SoC initializaton code
are also included.

Product spec for MT7988:
https://www.mediatek.com/products/broadband-wifi/mediatek-filogic-880

And to quote Mathew McBride for Ten64:
This is a series of updates for the Ten64 board,
that are part of our firmware releases but not yet upstreamed
into U-Boot.

Changes of note include:

- Turning on standard boot support

  Standard boot improves the user experience over distroboot on Ten64,
  as we had various hacks in our firmware to solve some corner-case
  issues (e.g DTB handling) in distroboot, which are not needed with the
  bootflow system.

- Recognition of the new 'RevD' board variant distributed to OEM
  customers

- Fixing various boot issues related to FIT images and operating systems
  running out of the NAND (OpenWrt, recovery environment).

- A better 'opt-out' solution for fsl_setenv_bootcmd for Layerscape
  platforms booting from TF-A.

  This was discussed when the Ten64 was upstreamed into U-Boot. I think
  declaring fsl_setenv_bootcmd as __weak and allowing individual boards
  to override is the best way to do this without significant rework.
  (We actually depend on a similar feature for the DPAA2/MC firmware
  loading)

Compared to our firmware branch, there is still a few features missing (e.g USB
Hub, fan controller and fixes for the VSC8514). Some of these depend on other
things (like sorting out device tree schemas) so may not appear in mainline
U-Boot for a while yet.

16 months agoboard: ten64: strip extra u-boot compatibles from FDT
Mathew McBride [Fri, 21 Jul 2023 04:39:31 +0000 (04:39 +0000)]
board: ten64: strip extra u-boot compatibles from FDT

The u-boot version of the LS1088A device tree has
an extra compatible (simple-mfd) added to &fsl_mc
to facilitate usage with U-Boot's device model.

Unfortunately FreeBSD will only match the single
"fsl,qoriq-mc" exactly when the node is a "bus"
object, so we need to strip out the extra compatible
before presenting it to the operating system.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
16 months agoboard: ten64: opt out of fsl_setenv_bootcmd
Mathew McBride [Fri, 21 Jul 2023 04:39:30 +0000 (04:39 +0000)]
board: ten64: opt out of fsl_setenv_bootcmd

Our bootcmd is the same regardless of where the SoC
loaded it's code from, so we don't want
fsl_setenv_bootcmd to do anything.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
16 months agoarch: arm: fsl-layerscape: allow "opt-out" of fsl_setenv_bootcmd
Mathew McBride [Fri, 21 Jul 2023 04:39:29 +0000 (04:39 +0000)]
arch: arm: fsl-layerscape: allow "opt-out" of fsl_setenv_bootcmd

Allow individual Layerscape boards to opt-out of fsl_setenv_bootcmd
by declaring the original function as weak.

fsl_setenv_bootcmd is used to change the bootcmd based on the
TF-A boot source (e.g QSPI vs SD/MMC) for reasons including
secure boot / integrity measurements and DPAA2 configuration loading.
See previous discussion at [1].

On the Ten64 board, our bootcmd is the same across
all TF-A boot sources so we don't want this behaviour.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
[1] https://patchwork.ozlabs.org/project/uboot/patch/20211110044639.7070-3-matt@traverse.com.au/#2790037

Reviewed-by: Peng Fan <peng.fan@nxp.com>
16 months agoboard: traverse: ten64: adopt standard boot defaults
Mathew McBride [Fri, 21 Jul 2023 04:39:28 +0000 (04:39 +0000)]
board: traverse: ten64: adopt standard boot defaults

With the previous updates to the device tree, Ten64
can use Standard Boot 'out of the box'.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
16 months agoboard: ten64: disable watchdog autostart
Mathew McBride [Fri, 21 Jul 2023 04:39:27 +0000 (04:39 +0000)]
board: ten64: disable watchdog autostart

The watchdog driver was previously enabled but not used
until U-Boot's fsl-ls1088a.dtsi was updated to describe them.

Some Linux distributions (e.g Debian 11) do not engage the
SP805 watchdogs, causing unexpected resets after boot.

To conserve the user experience, turn off the autostart,
and we will provide a mechanism to turn them on at boot
via env vars.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
16 months agoboard: traverse: ten64: set serial# to be 'label' MAC
Mathew McBride [Fri, 21 Jul 2023 04:39:26 +0000 (04:39 +0000)]
board: traverse: ten64: set serial# to be 'label' MAC

The GE0 (first Gigabit Ethernet interface) is used as the
'serial number' for the board and appliance.

To ensure the 'true' board S/N is available regardless of how
the DPAA2 subsystem is configured, use serial# so it is passed in
the device tree.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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

16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 months agoefi_loader: check uuid_str_to_bin return value
Masahisa Kojima [Mon, 31 Jul 2023 08:53:02 +0000 (17:53 +0900)]
efi_loader: check uuid_str_to_bin return value

Check the uuid_str_to_bin return value, skip the node
if the image-type-id property is wrong format.

Addresses-Coverity-ID: 463145 ("Error handling issues")
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agoefi_loader: catch out of memory in file_open
Heinrich Schuchardt [Sun, 30 Jul 2023 12:06:06 +0000 (14:06 +0200)]
efi_loader: catch out of memory in file_open

If calloc() return NULL, don't dereference it.

Fixes: 2a92080d8c44 ("efi_loader: add file/filesys support")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: error handling in efi_disk_add_dev
Heinrich Schuchardt [Sun, 30 Jul 2023 12:03:53 +0000 (14:03 +0200)]
efi_loader: error handling in efi_disk_add_dev

* If an error occurs in efi_disk_add_dev(), don't leak resources.
* If calloc() fails while creating the file system protocol interface,
  signal an error.
* Rename efi_simple_file_system() to efi_create_simple_file_system().
* Drop a little helpful debug message.

Fixes: 2a92080d8c44 ("efi_loader: add file/filesys support")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: memory leak efi_add_memory_map_pg
Heinrich Schuchardt [Sun, 30 Jul 2023 10:59:32 +0000 (12:59 +0200)]
efi_loader: memory leak efi_add_memory_map_pg

Don't leak newlist if we error out.

Fixes: 74c16acce30b ("efi_loader: Don't allocate from memory holes")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: out of memory in efi_mem_carve_out
Heinrich Schuchardt [Sun, 30 Jul 2023 10:27:03 +0000 (12:27 +0200)]
efi_loader: out of memory in efi_mem_carve_out

Handle out of memory situation in efi_mem_carve_out().

Fixes: 5d00995c361c ("efi_loader: Implement memory allocation and map")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: overflow in efi_allocate_pages
Heinrich Schuchardt [Sun, 30 Jul 2023 09:31:08 +0000 (11:31 +0200)]
efi_loader: overflow in efi_allocate_pages

On 32bit systems (pages << EFI_PAGE_SHIFT) may lead to an overflow which
does not occur in 64bit arithmetics.

An overflow of (pages << EFI_PAGE_SHIFT) on 64bit systems should be treated
as an error.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agoefi_loader: error handling in tcg2_hash_pe_image()
Heinrich Schuchardt [Mon, 31 Jul 2023 12:11:34 +0000 (14:11 +0200)]
efi_loader: error handling in tcg2_hash_pe_image()

If the hard coded array hash_algo_list[] contains an entry for an
unsupported algorithm, we should not leak resources new_efi and regs.

We should still extend the log with the digests for the supported
algorithms and not write any message.

The same holds true of tcg2_create_digest(): just continue in case
hash_algo_list[] contains an unsupported entry.

Fixes: 163a0d7e2cbd ("efi_loader: add PE/COFF image measurement")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: out of memory in efi_add_memory_map_pg
Heinrich Schuchardt [Sun, 30 Jul 2023 10:36:17 +0000 (12:36 +0200)]
efi_loader: out of memory in efi_add_memory_map_pg

Handle out of memory situation in efi_add_memory_map_pg().

Fixes: 5d00995c361c ("efi_loader: Implement memory allocation and map")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_selftest: remove superfluous assignments
Heinrich Schuchardt [Sun, 30 Jul 2023 08:28:10 +0000 (10:28 +0200)]
efi_selftest: remove superfluous assignments

In test_hii_database_list_package_lists() 'ret' is used for the return code
of EFI API calls and 'result' for the return value of the function. Writing
EFI_ST_FAILURE to ret is superfluous.

Fixes: 4c4fb10da294 ("efi_selftest: add HII database protocols test")
Fixes: ee3c8ba85525 ("efi_selftest: fix memory allocation in HII tests")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: fix an IS_ERR() vs NULL check
Dan Carpenter [Thu, 27 Jul 2023 07:16:20 +0000 (10:16 +0300)]
efi_loader: fix an IS_ERR() vs NULL check

The efi_parse_pkcs7_header() function returns NULL on error so the check
for IS_ERR() should be changed to a NULL check.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agoefi_loader: capsule: enforce guid check in api and capsule_on_disk
AKASHI Takahiro [Thu, 27 Jul 2023 00:38:00 +0000 (09:38 +0900)]
efi_loader: capsule: enforce guid check in api and capsule_on_disk

While UPDATE_CAPSULE api is not fully implemented, this interface and
capsule-on-disk feature should behave in the same way, especially in
handling an empty capsule for fwu multibank, for future enhancement.

So move the guid check into efi_capsule_update_firmware().

Fixed: commit a6aafce494ab ("efi_loader: use efi_update_capsule_firmware() for capsule on disk")
Reported-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reported-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Tested-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: Fix memory corruption on 32bit systems
Dan Carpenter [Wed, 26 Jul 2023 06:54:52 +0000 (09:54 +0300)]
efi_loader: Fix memory corruption on 32bit systems

It's pretty unlikely that anyone is going to be using EFI authentication
on a 32bit system.  However, if you did, the efi_prepare_aligned_image()
function would write 8 bytes of data to the &efi_size variable and it
can only hold 4 bytes so that corrupts memory.

Fixes: 163a0d7e2cbd ("efi_loader: add PE/COFF image measurement")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agodm: Correct DM_FLAG_ comment
Bin Meng [Mon, 31 Jul 2023 14:01:26 +0000 (22:01 +0800)]
dm: Correct DM_FLAG_ comment

The macros are prefixed with DM_FLAG_, not DM_FLAGS_.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agodoc: describe QEMU virtio block device
Heinrich Schuchardt [Sun, 30 Jul 2023 17:39:00 +0000 (19:39 +0200)]
doc: describe QEMU virtio block device

Enhance the description of QEMU block devices

* Describe how to attach a virtio-blk device.
* Sort the command lines for MMC to match the other devices.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agodoc: move README.falcon to HTML
Heinrich Schuchardt [Fri, 28 Jul 2023 20:37:40 +0000 (22:37 +0200)]
doc: move README.falcon to HTML

Move the Falcon mode documentation to HTML.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agodoc: board: ti: Add SPDX License to svg images
Nishanth Menon [Fri, 28 Jul 2023 20:05:07 +0000 (15:05 -0500)]
doc: board: ti: Add SPDX License to svg images

Add Licensing to svg images to clarify the terms.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agodoc: U-Boot boot phases
Heinrich Schuchardt [Fri, 28 Jul 2023 16:44:34 +0000 (18:44 +0200)]
doc: U-Boot boot phases

Add more detail to the description of U-Boot boot phases:

* describe which steps are optional
* mentions alternative boot flows

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
16 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

16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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

16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>