]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agomtd: spi-nor-core: Check for ctrlc() in spi_nor_erase()
Marek Behún [Tue, 5 Oct 2021 13:56:04 +0000 (15:56 +0200)]
mtd: spi-nor-core: Check for ctrlc() in spi_nor_erase()

May it possible to interrupt the spi_nor_erase() function.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
3 years agomtd: spi-nor-core: Call mtd_erase_callback() from spi_nor_erase()
Marek Behún [Tue, 5 Oct 2021 13:56:03 +0000 (15:56 +0200)]
mtd: spi-nor-core: Call mtd_erase_callback() from spi_nor_erase()

The spi_nor_erase() function does not call mtd_erase_callback() as it
should.

The mtdpart code currently implements the subtraction of partition
offset in mtd_erase_callback().

This results in partition offset being added prior calling
spi_nor_erase(), but not subtracted back on return. The result is that
the `mtd erase` command does not erase the whole partition, only some of
it's blocks:

  => mtd erase "Rescue system"
  Erasing 0x00000000 ... 0x006fffff (1792 eraseblock(s))
  jedec_spi_nor spi-nor@0: at 0x100000, len 4096
  jedec_spi_nor spi-nor@0: at 0x201000, len 4096
  jedec_spi_nor spi-nor@0: at 0x302000, len 4096
  jedec_spi_nor spi-nor@0: at 0x403000, len 4096
  jedec_spi_nor spi-nor@0: at 0x504000, len 4096
  jedec_spi_nor spi-nor@0: at 0x605000, len 4096
  jedec_spi_nor spi-nor@0: at 0x706000, len 4096

This is obviously wrong.

Add proper calling of mtd_erase_callback() into the spi_nor_erase()
function.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reported-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
3 years agomtd: spi-nor-core: Don't check for zero length in spi_nor_write() / spi_nor_erase()
Marek Behún [Tue, 5 Oct 2021 13:56:02 +0000 (15:56 +0200)]
mtd: spi-nor-core: Don't check for zero length in spi_nor_write() / spi_nor_erase()

This check is already done in all callers: mtdcore's mtd_write() /
mtd_erase(), legacy spi_nor_write() / spi_flash_erase(). No reason to do
this here as well.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
3 years agomtd: spi-flash: Check for zero length in legacy spi_flash_*()
Marek Behún [Tue, 5 Oct 2021 13:56:01 +0000 (15:56 +0200)]
mtd: spi-flash: Check for zero length in legacy spi_flash_*()

Check for zero length in the legacy spi_flash_read() /
spi_flash_write() / spi_flash_erase() functions.
On zero length, return 0 immediately, don't call the underlying method.

Rationale:
- these legacy functions call the _read(), _write() and _erase() methods
  of struct mtd
- the DM callers of these methods already check for zero length
- making all callers of these methods check for zero length makes it
  possible to remove the check from implementations of these _read(),
  _write() and _erase() methods

Signed-off-by: Marek Behún <marek.behun@nic.cz>
3 years agomtd: spi-nor-core: Check return value of write_disable() in spi_nor_erase()
Marek Behún [Tue, 5 Oct 2021 13:56:00 +0000 (15:56 +0200)]
mtd: spi-nor-core: Check return value of write_disable() in spi_nor_erase()

The cleanup code of spi_nor_erase() function calls write_disable(), but
does not return it's return value even in case of failure. Fix this.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
3 years agomtd: spi-nor-core: Don't overwrite return value if it is non-zero
Marek Behún [Tue, 5 Oct 2021 13:55:59 +0000 (15:55 +0200)]
mtd: spi-nor-core: Don't overwrite return value if it is non-zero

The cleanup code of the spi_nor_erase() function overwrites the ret
variable with return value of clean_bar(), even if the ret variable is
already set. Fix this.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
3 years agomtd: spi-nor-core: Check return value of write_enable() in spi_nor_erase()
Marek Behún [Tue, 5 Oct 2021 13:55:58 +0000 (15:55 +0200)]
mtd: spi-nor-core: Check return value of write_enable() in spi_nor_erase()

The spi_nor_erase() function does not check return value of the
write_enable() call. Fix this.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
3 years agomtd: spi-nor-core: Try cleaning up in case writing BAR failed
Marek Behún [Tue, 5 Oct 2021 13:55:57 +0000 (15:55 +0200)]
mtd: spi-nor-core: Try cleaning up in case writing BAR failed

Use the cleanup codepath of spi_nor_erase() also in the event of failure
of writing the BAR register.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
3 years agomtd: spi-nor: Add support for Spansion S25FL256L
Takahiro Kuwano [Thu, 30 Sep 2021 02:23:37 +0000 (11:23 +0900)]
mtd: spi-nor: Add support for Spansion S25FL256L

The S25FL256L is a part of the S25FL-L family and has the same feature set
as S25FL128L except the density.

The datasheet can be found in the following link.
https://www.cypress.com/file/316171/download

The S25FL256L is 32MB NOR Flash that does not support Bank Address
Register. This fixup is activated if CONFIG_SPI_FLASH_BAR is enabled and
returns ENOTSUPP in setup() hook to avoid further ops.

Tested on Xilinx Zynq-7000 FPGA board.

Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
3 years agomtd: spi-nor-ids: Add GD25LQ256D Chip
Yanhong Wang [Thu, 30 Sep 2021 11:53:01 +0000 (19:53 +0800)]
mtd: spi-nor-ids: Add GD25LQ256D Chip

Add Gigadevice GD25LQ256D SPI NOR chip.
https://www.gigadevice.com/datasheet/gd25lq256d/

Signed-off-by: Yanhong Wang <yanhong.wang@starfivetech.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[jagan: updated commit message]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agomtd: spi-nor-ids: Reinstate Micron MT25QL02G
Marek Vasut [Tue, 5 Oct 2021 08:58:47 +0000 (10:58 +0200)]
mtd: spi-nor-ids: Reinstate Micron MT25QL02G

This ID disappeared in 5b66fdb29dc ("mtd: spi: Remove unused files"),
add the ID back, since the chip is used on devices supported by U-Boot.

Fixes: 5b66fdb29dc ("mtd: spi: Remove unused files")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Vignesh R <vigneshr@ti.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agomtd: spinand: macronix: Fix ECC Status Read
Haolin Li [Sun, 5 Sep 2021 14:41:41 +0000 (22:41 +0800)]
mtd: spinand: macronix: Fix ECC Status Read

According to datasheet, the upper four bits are reserved or used for
reflecting the ECC status of the accumulated pages. The error bits
number for the worst segment of the current page is encoded on lower
four bits. Fix it by masking the upper bits.

This same issue has been already fixed in the linux kernel by:
"mtd: spinand: macronix: Fix ECC Status Read"
(sha1: f4cb4d7b46f6409382fd981eec9556e1f3c1dc5d)

Apply the same fix in the U-Boot driver.

Signed-off-by: Haolin Li <li.haolin@qq.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agoMerge tag 'u-boot-amlogic-20211007' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Thu, 7 Oct 2021 13:02:22 +0000 (09:02 -0400)]
Merge tag 'u-boot-amlogic-20211007' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- Add new SoC ID for S905Y2 found in Radxa Zero
- pcie_dw_meson: fix usb fail when pci link fails to go up
- Sync Amlogic DT from Linux 5.14
- dwc3-meson-gxl: add AXG compatible
- dts: keep back HW order for MMC devices since change in Upstream Linux
- Cleanup local AXG DT USB nodes now everything is upstream
- distro_bootcmd: run pci enum for scsi_boot just like it is done for nvme_boot
- New Boards:
  - Odroid-HC4: a variant of Odroid-C4 with 2 SATA ports (via PCIe-SATA bridge)
  - Beelink GS-King X: A variant of the other Beelink board with 2 SATA ports (via USB3-SATA bridge)
  - Banana Pi M5: another credit card SBC
  - JetHub D1/H1: home automation controllers
  - Radxa Zero: another RPi Zero sized SBC

3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Thu, 7 Oct 2021 13:00:45 +0000 (09:00 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

- Reset improvements, enable coherence manager on ae350, k210 clk
  improvements, other fixes

3 years agodoc: boards: amlogic: update for Radxa Zero
Christian Hewitt [Wed, 15 Sep 2021 01:46:59 +0000 (01:46 +0000)]
doc: boards: amlogic: update for Radxa Zero

Add documentation bits for the Radxa Zero

Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
[narmstrong: updated u200 MAINTAINERS]
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoboards: amlogic: add Radxa Zero defconfig
Christian Hewitt [Wed, 15 Sep 2021 01:46:58 +0000 (01:46 +0000)]
boards: amlogic: add Radxa Zero defconfig

Add a defconfig for the Radxa Zero SBC, using an Amlogic S905Y2 chip.

Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
[narmstrong: updated u200 MAINTAINERS & add missing CONFIG_SYS_LOAD_ADDR from defconfig]
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: dts: add support for Radxa Zero
Christian Hewitt [Wed, 15 Sep 2021 01:46:57 +0000 (01:46 +0000)]
ARM: dts: add support for Radxa Zero

Import the initial dts queued for Linux 5.16.y

Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: dts: sort Amlogic Makefile section
Christian Hewitt [Wed, 15 Sep 2021 01:46:56 +0000 (01:46 +0000)]
ARM: dts: sort Amlogic Makefile section

Alpha sort the Amlogic dtb list (same as the kernel).

Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: amlogic: add JetHub D1/H1 docs
Vyacheslav Bocharov [Mon, 20 Sep 2021 08:40:16 +0000 (11:40 +0300)]
ARM: amlogic: add JetHub D1/H1 docs

Fix doc/board/amlogic/index.rst:
- Add S905W to S905X column.
- Add JetHub devices to the corresponding columns.
- Fix tabs to spaces for table alignment

Add doc/board/amlogic files:
- jethub-j100.rst
- jethub-j80.rst

Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: amlogic: add JetHub D1/H1 device support
Vyacheslav Bocharov [Mon, 20 Sep 2021 08:40:15 +0000 (11:40 +0300)]
ARM: amlogic: add JetHub D1/H1 device support

Add support for new home automation devices.

JetHome Jethub D1 (http://jethome.ru/jethub-d1) is a home automation controller with the following features:
- DIN Rail Mounting case
- Amlogic A113X (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 512Mb/1GB DDR3
- 8/16GB eMMC flash
- 1 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth AMPAK AP6255 (Broadcom BCM43455) IEEE 802.11a/b/g/n/ac, Bluetooth 4.2.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and Zigbee 3.0 support.
- 2 x gpio LEDS
- GPIO user Button
- 1 x 1-Wire
- 2 x RS-485
- 4 x dry contact digital GPIO inputs
- 3 x relay GPIO outputs
- DC source with a voltage of 9 to 56 V / Passive POE

JetHome Jethub H1 (http://jethome.ru/jethub-h1) is a home automation controller with the following features:
- Square plastic case
- Amlogic S905W (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 1GB DDR3
- 8/16GB eMMC flash
- 2 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth RTL8822CS IEEE 802.11a/b/g/n/ac, Bluetooth 5.0.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and Zigbee 3.0 support.
- MicroSD 2.x/3.x/4.x DS/HS cards.
- 1 x gpio LED
- ADC user Button
- DC source 5V microUSB with serial console

Patches from:
- JetHub H1
  https://lore.kernel.org/r/20210915085715.1134940-4-adeep@lexina.in
  https://git.kernel.org/amlogic/c/abfaae24ecf3e7f00508b60fa05e2b6789b8f607
- JetHub D1
  https://lore.kernel.org/r/20210915085715.1134940-5-adeep@lexina.in
  https://git.kernel.org/amlogic/c/8e279fb2903990cc6296ec56b3b80b2f854b6c79

Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
[narmstrong: removed unused variable value]
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: amlogic: add JetHub common config header
Vyacheslav Bocharov [Mon, 20 Sep 2021 08:40:14 +0000 (11:40 +0300)]
ARM: amlogic: add JetHub common config header

JetHub devices uses its own boot sequence with "rescue" button

Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: amlogic: add Banana Pi M5
Neil Armstrong [Fri, 17 Sep 2021 07:37:09 +0000 (09:37 +0200)]
ARM: amlogic: add Banana Pi M5

Banana Pi BPI-M5 is a credit card format SBC with the following features:
- Amlogic S905X3 quad core Cortex-A55
- Mali-G31 GPU
- 4GB LPDDR4
- 16GB eMMC flash
- 4 USB 3.0
- 1 GbE ethernet
- HDMI output
- 2x LEDS
- SDCard
- 2.5mm Jack with Stereo Audio + CVBS
- Infrared Received
- ADC Button
- GPIO Button
- 40 pins header + 3pins debug header

[narmstrong: add missing CONFIG_SYS_LOAD_ADDR from defconfig]
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: meson: add Beelink GS-King X board
Neil Armstrong [Fri, 17 Sep 2021 07:37:08 +0000 (09:37 +0200)]
ARM: meson: add Beelink GS-King X board

The Beelink GS-King X is a variant of the GS King boards but with an internal
USB to SATA bridge and advanced audio features.

[narmstrong: add missing CONFIG_SYS_LOAD_ADDR from defconfig]
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agodoc: boards: amlogic: update for Odroid HC4
Neil Armstrong [Fri, 17 Sep 2021 07:37:07 +0000 (09:37 +0200)]
doc: boards: amlogic: update for Odroid HC4

Add documentation bits for the Odroid-HC4.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: amlogic: add support for Odroid-HC4 device
Neil Armstrong [Fri, 17 Sep 2021 07:37:06 +0000 (09:37 +0200)]
ARM: amlogic: add support for Odroid-HC4 device

The Odroid-HC4 is a variant of the Odroid-C4 board but with a PCIe-SATA bridge
instead of the USB3 ports.

[narmstrong: add missing CONFIG_SYS_LOAD_ADDR from defconfig]
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agodistro_bootcmd: run pci enum for scsi_boot just like it is done for nvme_boot
Neil Armstrong [Fri, 17 Sep 2021 07:37:05 +0000 (09:37 +0200)]
distro_bootcmd: run pci enum for scsi_boot just like it is done for nvme_boot

The SCSI device can be a PCIe adapter, so run pcie enum if enabled.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoconfigs: meson64: add SCSI boot target
Neil Armstrong [Fri, 17 Sep 2021 07:37:04 +0000 (09:37 +0200)]
configs: meson64: add SCSI boot target

Add SCSI target to be able to boot from the SATA disks on the Odroid HC4 using
an on-board AHCI PCIe controller.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
3 years agoARM: meson-axg: remove local USB nodes
Neil Armstrong [Fri, 17 Sep 2021 07:37:03 +0000 (09:37 +0200)]
ARM: meson-axg: remove local USB nodes

Drop the local USB nodes after Linux 5.14 sync.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: meson: keep HW order for MMC devices
Neil Armstrong [Fri, 17 Sep 2021 07:37:02 +0000 (09:37 +0200)]
ARM: meson: keep HW order for MMC devices

Since Linux commmit [1], the order is fixed with aliases, in order to keep the
MMC device order, set it back to HW order in U-Boot dtsi files.

[1] ab547c4fb39f ("arm64: dts: amlogic: Assign a fixed index to mmc devices")

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agousb: dwc3: meson-gxl: add AXG compatible
Neil Armstrong [Fri, 17 Sep 2021 07:37:01 +0000 (09:37 +0200)]
usb: dwc3: meson-gxl: add AXG compatible

Upstream Linux uses the "amlogic,meson-axg-usb-ctrl" for AXG SoCs.

This adds it to the compatible list for this driver.

Reported-by: Vyacheslav Bocharov <adeep@lexina.in>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Vyacheslav Bocharov <adeep@lexina.in>
3 years agoARM: meson: Sync Amlogic DT from Linux 5.14
Neil Armstrong [Fri, 17 Sep 2021 07:37:00 +0000 (09:37 +0200)]
ARM: meson: Sync Amlogic DT from Linux 5.14

Import Amlogic DT changes from Linux commit 7d2a07b76933 ("Linux 5.14"),
dt-bindings clock changes and new meson-g12b-gsking-x.dts,
meson-sm1-bananapi-m5 & odroid-hc4 boards.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agopci: pcie_dw_meson: fix usb fail when pci link fails to go up
Neil Armstrong [Wed, 8 Sep 2021 12:32:12 +0000 (14:32 +0200)]
pci: pcie_dw_meson: fix usb fail when pci link fails to go up

On Amlogic A311D, when the PCIe link fails disabling the related clocks
makes USB fail. For an unknown reason, this doesn happen on the S905D3 SoC.

Mimic the Linux behavior by not considering a link failure a probe failure,
and continue even if the PCIe link is down.

Reported-by: Art Nikpal <email2tema@gmail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoARM: meson: Add S905Y2 SOC ID
Christian Hewitt [Fri, 20 Aug 2021 02:18:36 +0000 (02:18 +0000)]
ARM: meson: Add S905Y2 SOC ID

Add the SOC ID for the S905Y2 to board info, see below for before/after
tested with a Radxa Zero board:

SoC:   Amlogic Meson G12A (Unknown) Revision 28:b (30:2)
SoC:   Amlogic Meson G12A (S905Y2) Revision 28:b (30:2)

Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoriscv: ae350: enable Coherence Manager for ae350
Leo Yu-Chi Liang [Thu, 23 Sep 2021 02:34:29 +0000 (10:34 +0800)]
riscv: ae350: enable Coherence Manager for ae350

If Coherence Manager were not set in the beginning,
u-boot-spl would sometimes fail to boot to u-boot proper.

Enable CM and I/D cache at the same time in harts_early_init

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoconfigs: enable SYSRESET_SBI on qemu-riscvXX_smode_defconfig
Heinrich Schuchardt [Sun, 12 Sep 2021 19:11:47 +0000 (21:11 +0200)]
configs: enable SYSRESET_SBI on qemu-riscvXX_smode_defconfig

There should be a platform compiled with the new driver.

Enable CONFIG_SYSRESET_SBI for all QEMU boards using SBI.

If you want to test the SBI sysreset driver, disable
CONFIG_SYSRESET_SYSCON.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 years agosysreset: provide SBI based sysreset driver
Heinrich Schuchardt [Sun, 12 Sep 2021 19:11:46 +0000 (21:11 +0200)]
sysreset: provide SBI based sysreset driver

Provide sysreset driver using the SBI system reset extension.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Samuel Holland <samuel@sholland.org>
3 years agocmd/sbi: use constants instead of numerical values
Heinrich Schuchardt [Sun, 12 Sep 2021 19:11:45 +0000 (21:11 +0200)]
cmd/sbi: use constants instead of numerical values

Use constants for extension IDs.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoriscv: add missing SBI extension definitions
Heinrich Schuchardt [Sun, 12 Sep 2021 19:11:44 +0000 (21:11 +0200)]
riscv: add missing SBI extension definitions

Add the System Reset Extension and the Hart State Management Extension
definitions.

Add missing RFENCE Extension enum values.

The SBI 0.1 extension constants are needed for the sbi command. Remove
an #ifdef.

Cf. https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoriscv: image: Use the first DRAM bank for bootm_low
Samuel Holland [Sun, 12 Sep 2021 16:26:45 +0000 (11:26 -0500)]
riscv: image: Use the first DRAM bank for bootm_low

bootm_low is used as a base address is used to allocate space for the
FDT blob, initrd, cmdline, etc. when booting Linux. Set the default
value for RISC-V to the start of the first DRAM bank, so platforms can
get their DRAM layout from the device tree, and do not need to define
CONFIG_SYS_SDRAM_BASE.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 years agoriscv: Fix setting no-map in reserved memory nodes
Samuel Holland [Sun, 12 Sep 2021 16:05:47 +0000 (11:05 -0500)]
riscv: Fix setting no-map in reserved memory nodes

The no-map property is wrongly skipped if a no-map reserved memory
node follows one without that property. Fix this by not remembering
the absence of a no-map property across loop iterations.

Fixes: d4ea649f179a ("riscv: Provide a mechanism to fix DT for reserved memory")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
3 years agoserial: Add a debug console using the RISC-V SBI interface
Samuel Holland [Sun, 12 Sep 2021 15:56:09 +0000 (10:56 -0500)]
serial: Add a debug console using the RISC-V SBI interface

The RISC-V SBI interface v0.1 provides a function for printing a
character to the console. Even though SBI v0.1 functions are deprecated,
the SBI console is quite useful for early debugging, because it works
without any dcache, memory, or MMIO access in S mode.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoclk: k210: Try harder to get the best config
Sean Anderson [Sat, 11 Sep 2021 17:20:03 +0000 (13:20 -0400)]
clk: k210: Try harder to get the best config

In some cases, the best config cannot be used because the VCO would be
out-of-spec. In these cases, we may need to try a worse combination of r/od
in order to find the best representable config. This also adds a few test
cases to catch this and other (possible) unlikely errors.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: dm: k210: Reduce duplication in test cases
Sean Anderson [Sat, 11 Sep 2021 17:20:02 +0000 (13:20 -0400)]
test: dm: k210: Reduce duplication in test cases

Having to copy-paste the same 3 lines makes adding new test cases
error-prone. Use a macro.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 years agok210: clk: Refactor out_of_spec tests
Sean Anderson [Sat, 11 Sep 2021 17:20:01 +0000 (13:20 -0400)]
k210: clk: Refactor out_of_spec tests

Everything here sits in a while (true) loop. However, this introduces a
couple of layers of indentation. We can simplify the code by introducing a
single goto instead of using continue/break. This will also make adding
loops in the next patch easier.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 years agoclk: k210: Fix checking if ulongs are less than 0
Sean Anderson [Sat, 11 Sep 2021 17:20:00 +0000 (13:20 -0400)]
clk: k210: Fix checking if ulongs are less than 0

The PLL functions take ulong arguments for rate, but still check if that
rate is negative (which is never true). The correct way to handle this is
to use IS_ERR_VALUE (like is already done in k210_clk_set_rate). While
we're at it, we can move the error checking up into the caller of the pll
set/get rate functions.  This also protects our other calculations from
using bogus values for rate.

Fixes: 609bd60b94 ("clk: k210: Rewrite to remove CCF")
Reported-by: Coverity Scan <scan-admin@coverity.com>
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 years agoMerge branch '2021-10-06-assorted-improvements'
Tom Rini [Wed, 6 Oct 2021 16:26:33 +0000 (12:26 -0400)]
Merge branch '2021-10-06-assorted-improvements'

- Use better values for ACPI OEM_VERSION
- Assorted NAND related Kconifg migrations and another dependency fix

3 years agoConvert CONFIG_NAND_OMAP_ECCSCHEME to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:39 +0000 (14:50 -0400)]
Convert CONFIG_NAND_OMAP_ECCSCHEME to Kconfig

The values of CONFIG_NAND_OMAP_ECCSCHEME map to the enum in
include/linux/mtd/omap_gpmc.h for valid ECC schemes.  Make which one we
will use be a choice statement, enumerating the ones which we have
implemented.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_NAND_U_BOOT_LOCATIONS et al to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:38 +0000 (14:50 -0400)]
Convert CONFIG_SYS_NAND_U_BOOT_LOCATIONS et al to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_NAND_U_BOOT_LOCATIONS
   CONFIG_SYS_NAND_U_BOOT_OFFS

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_NAND_FSL_ELBC et al to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:37 +0000 (14:50 -0400)]
Convert CONFIG_NAND_FSL_ELBC et al to Kconfig

This converts the following to Kconfig:
   CONFIG_NAND_FSL_ELBC
   CONFIG_NAND_FSL_IFC

Note that a number of PowerPC platforms had previously enabled
CONFIG_NAND_FSL_ELBC without CONFIG_MTD_RAW_NAND, and now they no longer
enable the option, reducing the size of a few functions.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_NAND_MAX_CHIPS to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:36 +0000 (14:50 -0400)]
Convert CONFIG_SYS_NAND_MAX_CHIPS to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_NAND_MAX_CHIPS

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agonand.h: Cleanup linux/mtd/rawnand.h usage
Tom Rini [Wed, 22 Sep 2021 18:50:35 +0000 (14:50 -0400)]
nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly.  Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_NAND_ONFI_DETECTION to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:34 +0000 (14:50 -0400)]
Convert CONFIG_SYS_NAND_ONFI_DETECTION to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_NAND_ONFI_DETECTION

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_NAND_5_ADDR_CYCLE to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:33 +0000 (14:50 -0400)]
Convert CONFIG_SYS_NAND_5_ADDR_CYCLE to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_NAND_5_ADDR_CYCLE

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_NAND_BAD_BLOCK_POS to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:32 +0000 (14:50 -0400)]
Convert CONFIG_SYS_NAND_BAD_BLOCK_POS to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_NAND_BAD_BLOCK_POS

In order to do this, introduce a choice for HAS_LARGE/SMALL_BADBLOCK_POS
as those are the only valid values.  Use LARGE as the default as no
in-tree boards use SMALL, but it is possible.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agonand_spl_simple: Drop CONFIG_SYS_NAND_4_ADDR_CYCLE support
Tom Rini [Wed, 22 Sep 2021 18:50:31 +0000 (14:50 -0400)]
nand_spl_simple: Drop CONFIG_SYS_NAND_4_ADDR_CYCLE support

This code is unused, drop it.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_NAND_PAGE_COUNT to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:30 +0000 (14:50 -0400)]
Convert CONFIG_SYS_NAND_PAGE_COUNT to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_NAND_PAGE_COUNT

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SPL_NAND_LOAD et al to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:29 +0000 (14:50 -0400)]
Convert CONFIG_SPL_NAND_LOAD et al to Kconfig

This converts the following to Kconfig:
   CONFIG_SPL_NAND_LOAD
   CONFIG_SYS_NAND_BLOCK_SIZE
   CONFIG_SYS_NAND_PAGE_SIZE
   CONFIG_SYS_NAND_OOBSIZE

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_NAND_LPC32XX_MLC to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:28 +0000 (14:50 -0400)]
Convert CONFIG_NAND_LPC32XX_MLC to Kconfig

This converts the following to Kconfig:
   CONFIG_NAND_LPC32XX_MLC

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agom53menlo: Switch to deriving CONFIG_SYS_NAND_PAGE_COUNT
Tom Rini [Wed, 22 Sep 2021 18:50:27 +0000 (14:50 -0400)]
m53menlo: Switch to deriving CONFIG_SYS_NAND_PAGE_COUNT

Typically platforms will define CONFIG_SYS_NAND_PAGE_COUNT based on
CONFIG_SYS_NAND_BLOCK_SIZE / CONFIG_SYS_NAND_PAGE_SIZE.  Switch to this
in preparation for migrating CONFIG_SYS_NAND namespace to Kconfig.

Cc: Marek Vasut <marex@denx.de>
Cc: Olaf Mandel <o.mandel@menlosystems.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agork3308: Remove unused NAND defines
Tom Rini [Wed, 22 Sep 2021 18:50:26 +0000 (14:50 -0400)]
rk3308: Remove unused NAND defines

These platforms do not currently enable NAND, remove these references.

Cc: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agolib: rsa: fix dependency for SPL_RSA_VERIFY
Oleksandr Suvorov [Thu, 16 Sep 2021 12:03:36 +0000 (15:03 +0300)]
lib: rsa: fix dependency for SPL_RSA_VERIFY

SPL_RSA_VERIFY requires SPL_RSA to be enabled. Add correct
dependency.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
3 years agoacpi: Use U-Boot version for OEM_REVISION
Pali Rohár [Sat, 10 Jul 2021 11:10:01 +0000 (13:10 +0200)]
acpi: Use U-Boot version for OEM_REVISION

OEM_REVISION is 32-bit unsigned number. It should be increased only when
changing software version. Therefore it should not depend on build time.

Change calculation to use U-Boot version numbers and set this revision
to date number.

Prior this change OEM_REVISION was calculated from build date and stored in
the same format.

After this change macro U_BOOT_BUILD_DATE is not used in other files so
remove it from global autogenerated files and also from Makefile.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge branch '2021-10-05-general-updates'
Tom Rini [Tue, 5 Oct 2021 21:16:23 +0000 (17:16 -0400)]
Merge branch '2021-10-05-general-updates'

- Assorted OPTEE cleanups
- pinctrl, gpio improvements, assorted livetree migrations
- Assorted pytest improvements

3 years agoreboot-mode: migrate uclass to livetree
Patrick Delaunay [Mon, 20 Sep 2021 16:27:20 +0000 (18:27 +0200)]
reboot-mode: migrate uclass to livetree

Use dev_ function to support a live tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodemo: migrate uclass to livetree
Patrick Delaunay [Mon, 20 Sep 2021 15:58:33 +0000 (17:58 +0200)]
demo: migrate uclass to livetree

Use dev_ function to read the sides and colour to support a live tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoremoteproc: migrate uclass to livetree
Patrick Delaunay [Mon, 20 Sep 2021 15:56:06 +0000 (17:56 +0200)]
remoteproc: migrate uclass to livetree

Use dev_ function to read the name and boolean to support a live tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: test: Explain how to run pytests in parallel
Simon Glass [Sun, 19 Sep 2021 21:14:51 +0000 (15:14 -0600)]
doc: test: Explain how to run pytests in parallel

Add documentation for this so people can try it out. At present it does
not fully work.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Allow tpm2 tests to run in parallel
Simon Glass [Sun, 19 Sep 2021 21:14:50 +0000 (15:14 -0600)]
test: Allow tpm2 tests to run in parallel

These tests currently run in a particular sequence, with some of them
depending on the actions of earlier tests.

Add a check for sandbox and reset to a known state at the start of each
test, so that all tests can run in parallel.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Allow hush tests to run in parallel
Simon Glass [Sun, 19 Sep 2021 21:14:49 +0000 (15:14 -0600)]
test: Allow hush tests to run in parallel

The -z tests don't really need to be part of the main set. Separate them
out so we can drop the test setup/cleans functions and thus run all tests
in parallel.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Allow vboot tests to run in parallel
Simon Glass [Sun, 19 Sep 2021 21:14:48 +0000 (15:14 -0600)]
test: Allow vboot tests to run in parallel

Update the tests to use separate working directories, so we can run them
in parallel. It also makes it possible to see the individual output files
after the tests have completed.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest/py: Check hashes produced by mkimage against known values
Alexandru Gagniuc [Wed, 15 Sep 2021 19:33:01 +0000 (14:33 -0500)]
test/py: Check hashes produced by mkimage against known values

Target code and mkimage share the same hashing infrastructure. If one
is wrong, it's very likely that both are wrong in the same way. Thus
testing won't catch hash regressions. This already happened in
commit 92055e138f28 ("image: Drop if/elseif hash selection in
calculate_hash()"). None of the tests caught that CRC32 was broken.

Instead of testing hash_calculate() against itself, create a FIT with
containing a kernel with pre-calculated hashes. Then check the hashes
produced against the known good hashes.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agogpio: Factor out DT flag translation
Samuel Holland [Sat, 11 Sep 2021 22:05:53 +0000 (17:05 -0500)]
gpio: Factor out DT flag translation

The generic GPIO flags binding is shared across many drivers, some of
which need their own xlate function. Factor out the flag translation
code from gpio_xlate_offs_flags so it does not need to be duplicated.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agogpio: Verify validity of pin offsets from device trees
Samuel Holland [Sat, 11 Sep 2021 22:05:52 +0000 (17:05 -0500)]
gpio: Verify validity of pin offsets from device trees

Translation of an OF GPIO specifier should fail if the pin offset is
larger than the number of pins in the GPIO bank.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agogpio: Verify validity of pin offsets when looking up names
Samuel Holland [Sat, 11 Sep 2021 22:05:51 +0000 (17:05 -0500)]
gpio: Verify validity of pin offsets when looking up names

Translation of a pin name to a device+offset should fail if the offset
is larger than the number of pins in the GPIO bank.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: imx: mx7: Move CONFIG_OPTEE_TZDRAM_SIZE from lib/optee
Alexandru Gagniuc [Tue, 7 Sep 2021 17:07:09 +0000 (12:07 -0500)]
arm: imx: mx7: Move CONFIG_OPTEE_TZDRAM_SIZE from lib/optee

This config is only used by three boards with this SOC. Most other
platforms derive this information from devicetree, and are unlikely
to ever need this config.

Moreover, it is confusing when Kconfig asks for this value under
"Support OPTEE images", but does not do anything with the value.
Move it to imx7 for those boards who still make use of it.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agolib: optee: Remove CONFIG_OPTEE_LOAD_ADDR
Alexandru Gagniuc [Tue, 7 Sep 2021 17:07:08 +0000 (12:07 -0500)]
lib: optee: Remove CONFIG_OPTEE_LOAD_ADDR

This value is not used by u-boot, and it should not. The load address
of an OPTEE image is defined by said image. Either a uImage or a FIT
will have a defined load address and entry point. Those values are the
correct ones, not CONFIG_OPTEE_LOAD_ADDR.

Commit f25006b96e9f ("optee: Add CONFIG_OPTEE_LOAD_ADDR") justifies
this config by requiring its presence in u-boot's .config for other
images as part of a larger build, claiming it is "the best way".

This argument is not persuasive. U-boot's configuration is driven by
platform requirements, not the other way around. It seems more likely
that the argument is conflating tooling issues with Kconfig. Yocto and
buildroot have excellent mechanisms for defining values across the
board (pun intended). u-boot's Kconfig is the wrong place to do it.

Furthermore, it is not "best" for u-boot because it hardcodes a value
which is then not used. In fact the load address that u-boot uses is
the one derived from the OPTEE image.

Confused yet? I sure was. To prevent future confusion, remove
CONFIG_OPTEE_LOAD_ADDR.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agolib: optee: Remove CONFIG_OPTEE_TZDRAM_BASE
Alexandru Gagniuc [Tue, 7 Sep 2021 17:07:07 +0000 (12:07 -0500)]
lib: optee: Remove CONFIG_OPTEE_TZDRAM_BASE

It is no longer used in u-boot. Information about the TZDRAM location
is usually available in the devicetree as "/reserved-memory/" nodes.
Because this isn't used, remove it.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agolib: optee: Avoid CONFIG_TZDRAM_* in optee_verify_bootm_image()
Alexandru Gagniuc [Tue, 7 Sep 2021 17:07:06 +0000 (12:07 -0500)]
lib: optee: Avoid CONFIG_TZDRAM_* in optee_verify_bootm_image()

The configs TZDRAM_BASE and TZDRAM_SIZE are expected to describe the
memory allocated to the OPTEE region. according to according to commit
c5a6e8bd00cc ("optee: Add optee_verify_bootm_image()"). The TZDRAM is
with some limitations, described by "/reserved-memory" nodes in the
devicetree.

Consequently TZDRAM_BASE and TZDRAM_SIZE can point to imaginary
regions which have nothing to do with actual DRAM. They are not used
to configure the hardware or set up the Trust Zone Controller (TZC)
for OP-TEE -- the devicetree values are used instead.

When a valid OP-TEE image does not fall within the region described by
these configs, u-boot will refuse to load it. In fact, it mostly
serves to cause "bootm" to reject perfectly good OP-TEE images.

Ironically, someone has to correctly configure the devicetree for
TZDRAM, then go back and enter the same information in Kconfig for
"bootm". To remedy this, do not use TZDRAM_BASE and TZDRAM_SIZE in the
verification of OPTEE images.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agotee: add a stub for tee_find_device
Patrick Delaunay [Thu, 2 Sep 2021 09:56:17 +0000 (11:56 +0200)]
tee: add a stub for tee_find_device

Add stub for tee_find_device function when CONFIG_TEE is not activated
to simplify the caller code.

This patch allows to remove the CONFIG_IS_ENABLED(OPTEE) tests
for stm32 platform.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@inaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
3 years agolib: optee: remove the duplicate CONFIG_OPTEE
Patrick Delaunay [Thu, 2 Sep 2021 09:56:16 +0000 (11:56 +0200)]
lib: optee: remove the duplicate CONFIG_OPTEE

The configuration CONFIG_OPTEE is defined 2 times:
1- in lib/optee/Kconfig for support of OPTEE images loaded by bootm command
2- in drivers/tee/optee/Kconfig for support of OP-TEE driver.

It is abnormal to have the same CONFIG define for 2 purpose;
and it is difficult to managed correctly their dependencies.

Moreover CONFIG_SPL_OPTEE is defined in common/spl/Kconfig
to manage OPTEE image load in SPL.

This definition causes an issue with the macro CONFIG_IS_ENABLED(OPTEE)
to test the availability of the OP-TEE driver.

This patch cleans the configuration dependency with:
- CONFIG_OPTEE_IMAGE (renamed) => support of OP-TEE image in U-Boot
- CONFIG_SPL_OPTEE_IMAGE (renamed) => support of OP-TEE image in SPL
- CONFIG_OPTEE (same) => support of OP-TEE driver in U-Boot
- CONFIG_OPTEE_LIB (new) => support of OP-TEE library

After this patch, the macro have the correct behavior:
- CONFIG_IS_ENABLED(OPTEE_IMAGE) => Load of OP-TEE image is supported
- CONFIG_IS_ENABLED(OPTEE) => OP-TEE driver is supported

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agopinctrl: single: Add request() api
Bharat Gooty [Tue, 24 Aug 2021 10:16:32 +0000 (15:46 +0530)]
pinctrl: single: Add request() api

Add pinctrl_ops->request api to configure pctrl
pad register in gpio mode.

Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Signed-off-by: Bharat Gooty <bharat.gooty@broadcom.com>
Acked-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopinctrl: single: Parse gpio details from dt
Bharat Gooty [Tue, 24 Aug 2021 10:16:31 +0000 (15:46 +0530)]
pinctrl: single: Parse gpio details from dt

Parse different gpio properties from dt as part of probe
function. This detail is required to enable pinctrl pad
later when gpio lines are requested.

Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Signed-off-by: Bharat Gooty <bharat.gooty@broadcom.com>
Acked-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
3 years agoMerge branch 'next'
Tom Rini [Mon, 4 Oct 2021 15:27:55 +0000 (11:27 -0400)]
Merge branch 'next'

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoPrepare v2021.10
Tom Rini [Mon, 4 Oct 2021 15:09:26 +0000 (11:09 -0400)]
Prepare v2021.10

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agomtd: cqspi: Fix division by zero
Marek Vasut [Tue, 14 Sep 2021 03:21:48 +0000 (05:21 +0200)]
mtd: cqspi: Fix division by zero

Both dummy.nbytes and dummy.buswidth may be zero. By not checking
the later, it is possible to trigger division by zero and a crash.
This does happen with tiny SPI NOR framework in SPL. Fix this by
adding the check and returning zero dummy bytes in such a case.

Fixes: 38b0852b0ea ("spi: cadence-qspi: Add support for octal DTR flashes")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Vignesh R <vigneshr@ti.com>
Cc: Pratyush Yadav <p.yadav@ti.com>
[trini: Drop Pratyush's RB as his requested changes weren't made as
        Marek disagreed]

3 years agoMerge branch '2021-10-03-platform-updates' into next
Tom Rini [Sun, 3 Oct 2021 23:31:04 +0000 (19:31 -0400)]
Merge branch '2021-10-03-platform-updates' into next

- TI K3 updates, add IOT2050 platform
- rtc rx8025 updates, PCI fixes

3 years agoiot2050: Enable watchdog support, but do not auto-start it
Jan Kiszka [Sat, 18 Sep 2021 06:17:56 +0000 (08:17 +0200)]
iot2050: Enable watchdog support, but do not auto-start it

This allows to use the watchdog in custom scripts but does not enforce
that the OS has to support it as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
3 years agowatchdog: rti_wdt: Add support for loading firmware
Jan Kiszka [Sat, 18 Sep 2021 06:17:55 +0000 (08:17 +0200)]
watchdog: rti_wdt: Add support for loading firmware

To avoid the need of extra boot scripting on AM65x for loading a
watchdog firmware, add the required rproc init and loading logic for the
first R5F core to the watchdog start handler. In case the R5F cluster is
in lock-step mode, also initialize the second core. The firmware itself
is embedded into U-Boot binary to ease access to it and ensure it is
properly hashed in case of secure boot.

One possible firmware source is https://github.com/siemens/k3-rti-wdt.

The board is responsible for providing the firmware as additional
loadable via the U-Boot fit image. The driver will pick up its location
from /fit-images/k3-rti-wdt-firmware then.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
3 years agoboard: siemens: Add support for SIMATIC IOT2050 devices
Jan Kiszka [Sat, 18 Sep 2021 06:17:53 +0000 (08:17 +0200)]
board: siemens: Add support for SIMATIC IOT2050 devices

This adds support for the IOT2050 Basic and Advanced devices. The Basic
used the dual-core AM6528 GP processor, the Advanced one the AM6548 HS
quad-core version.

Both variants are booted via a Siemens-provided FSBL that runs on the R5
cores. Consequently, U-Boot support is targeting the A53 cores. U-Boot
SPL, ATF and TEE have to reside in SPI flash.

Full integration into a bootable image can be found on
https://github.com/siemens/meta-iot2050

Based on original board support by Le Jin, Gao Nian and Chao Zeng.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
3 years agoarm: dts: Add IOT2050 device tree files
Jan Kiszka [Sat, 18 Sep 2021 06:17:52 +0000 (08:17 +0200)]
arm: dts: Add IOT2050 device tree files

Prepares for the addition of the IOT2050 board which is based on the TI
AM65x. The board comes in four variants, Basic and Advanced, each as
product generation 1 (SR1.0) and 2 (SR2.x), so there are separate dts
files needed. Furthermore, the SPL has its own device tree.

Based on original board support by Le Jin, Gao Nian and Chao Zeng.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
3 years agopci: pcie_layerscape_fixup_common: lx2_board_fix_fdt can be static
Vladimir Oltean [Fri, 17 Sep 2021 12:11:30 +0000 (15:11 +0300)]
pci: pcie_layerscape_fixup_common: lx2_board_fix_fdt can be static

To avoid W=1 build warnings, declare this function as static, since it
is not used outside of this translation module.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agopci: pcie_layerscape_fixup_common: include fdt_support.h for ft_pci_setup
Vladimir Oltean [Fri, 17 Sep 2021 12:11:29 +0000 (15:11 +0300)]
pci: pcie_layerscape_fixup_common: include fdt_support.h for ft_pci_setup

The function prototype for ft_pci_setup is inside fdt_support.h, we need
to include that header.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agopci: layerscape: ls_pcie_conf_address can be static
Vladimir Oltean [Fri, 17 Sep 2021 12:11:28 +0000 (15:11 +0300)]
pci: layerscape: ls_pcie_conf_address can be static

To avoid W=1 build warnings, declare this function as static, since it
is not used outside of this translation module.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agopci: _dm_pci_phys_to_bus can be static
Vladimir Oltean [Fri, 17 Sep 2021 12:11:27 +0000 (15:11 +0300)]
pci: _dm_pci_phys_to_bus can be static

To avoid W=1 build warnings, declare this function as static, since it
is not used outside of this translation module.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agopci: pci_read_config can be static
Vladimir Oltean [Fri, 17 Sep 2021 12:11:26 +0000 (15:11 +0300)]
pci: pci_read_config can be static

To avoid W=1 build warnings, declare this function as static, since it
is not used outside of this translation module.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agopci: pci_write_config can be static
Vladimir Oltean [Fri, 17 Sep 2021 12:11:25 +0000 (15:11 +0300)]
pci: pci_write_config can be static

To avoid W=1 build warnings, declare this function as static, since it
is not used outside of this translation module.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agopci: pciinfo_header can be static
Vladimir Oltean [Fri, 17 Sep 2021 12:11:24 +0000 (15:11 +0300)]
pci: pciinfo_header can be static

To avoid W=1 build warnings, declare this function as static, since it
is not used outside of this translation module.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agopci: pci_header_show can be static
Vladimir Oltean [Fri, 17 Sep 2021 12:11:23 +0000 (15:11 +0300)]
pci: pci_header_show can be static

To avoid W=1 build warnings, declare this function as static, since it
is not used outside of this translation module.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agopci: pci_bar_show can be static
Vladimir Oltean [Fri, 17 Sep 2021 12:11:22 +0000 (15:11 +0300)]
pci: pci_bar_show can be static

To avoid W=1 build warnings, declare this function as static, since it
is not used outside of this translation module.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agopci: include pci_internal.h inside pci_auto.c
Vladimir Oltean [Fri, 17 Sep 2021 12:11:21 +0000 (15:11 +0300)]
pci: include pci_internal.h inside pci_auto.c

To avoid a build warning with W=1, provide a function prototype for
dm_pciauto_prescan_setup_bridge, which is a non-static function whose
definition is inside pci_auto.c.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>