platform/kernel/u-boot.git
2 years agozstd: Create a function for use from U-Boot
Simon Glass [Sat, 25 Sep 2021 13:03:09 +0000 (07:03 -0600)]
zstd: Create a function for use from U-Boot

The existing zstd API requires the same sequence of calls to perform its
task. Create a helper for U-Boot, to avoid code duplication, as is done
with other compression algorithms. Make use of of this from the image
code.

Note that the zstd code lacks a test in test/compression.c and this should
be added by the maintainer.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agocompiler: Add a comment to host_build()
Simon Glass [Sat, 25 Sep 2021 13:03:08 +0000 (07:03 -0600)]
compiler: Add a comment to host_build()

This function should have a comment explaining what it does. Add one.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoAdd support for an owned buffer
Simon Glass [Sat, 25 Sep 2021 13:03:07 +0000 (07:03 -0600)]
Add support for an owned buffer

When passing a data buffer back from a function, it is not always clear
who owns the buffer, i.e. who is responsible for freeing the memory used.
An example of this is where multiple files are decompressed from the
firmware image, using a temporary buffer for reading (since the
compressed data has to live somewhere) and producing a temporary or
permanent buffer with the resuilts.

Where the firmware image can be memory-mapped, as on x86, the compressed
data does not need to be buffered, but the complexity of having a buffer
which is either allocated or not, makes the code hard to understand.

Introduce a new 'abuf' which supports simple buffer operations:

- encapsulating a buffer and its size
- either allocated with malloc() or not
- able to be reliably freed if necessary
- able to be converted to an allocated buffer if needed

This simple API makes it easier to deal with allocated and memory-mapped
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agolib: Add memdup()
Simon Glass [Sat, 25 Sep 2021 13:03:06 +0000 (07:03 -0600)]
lib: Add memdup()

Add a function to duplicate a memory region, a little like strdup().

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Fri, 8 Oct 2021 12:02:47 +0000 (08:02 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- a37xx: pci: Increase PCIe IO size from 64 KiB to 1 MiB (Pali)
- phy: marvell: a3700: Misc improvements (Pali)
- a38x serdes cleanup (Pali)
- A3720 PCIe enhancements (Pali & Marek)
- mvebu: mvebu_armada-8k: Puzzle M801 enhancements (Robert)
- mvebu: x530: Remove custom kwbimage.cfg (Chris)
- mvebu: Select SPL_SKIP_LOWLEVEL_INIT on ARMADA_32BIT (Stefan)

2 years agoboard: dh_stm32mp1: Remove gpio_hog_probe_all() from board
Patrice Chotard [Wed, 1 Sep 2021 09:51:43 +0000 (11:51 +0200)]
board: dh_stm32mp1: Remove gpio_hog_probe_all() from board

DM_GPIO_HOG flag has been replaced by GPIO_HOG flag since a while in
commit 49b10cb49262 ("gpio: fixes for gpio-hog support").

And furthermore, gpio_hog_probe_all() is already called in board_r.c.
So gpio_hog_probe() can be removed from stm32mp1.c.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoboard: stm32mp1: Remove gpio_hog_probe_all() from board
Patrice Chotard [Wed, 1 Sep 2021 09:51:42 +0000 (11:51 +0200)]
board: stm32mp1: Remove gpio_hog_probe_all() from board

DM_GPIO_HOG flag has been replaced by GPIO_HOG flag since a while in
commit 49b10cb49262 ("gpio: fixes for gpio-hog support").

And furthermore, gpio_hog_probe_all() is already called in board_r.c.
So gpio_hog_probe() can be removed from stm32mp1.c.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoi2c: stm32f7: compute i2cclk only one time
Patrick Delaunay [Tue, 3 Aug 2021 10:05:15 +0000 (12:05 +0200)]
i2c: stm32f7: compute i2cclk only one time

Compute i2cclk only one time in stm32_i2c_compute_timing()
and remove setup parameter (accessible in i2c_priv).

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoi2c: stm32f7: add support for DNF i2c-digital-filter binding
Patrick Delaunay [Tue, 3 Aug 2021 10:05:14 +0000 (12:05 +0200)]
i2c: stm32f7: add support for DNF i2c-digital-filter binding

Add the support for the i2c-digital-filter binding, allowing to enable
the digital filter via the device-tree and indicate its value in the DT

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoi2c: stm32f7: fix configuration of the digital filter
Patrick Delaunay [Tue, 3 Aug 2021 10:05:13 +0000 (12:05 +0200)]
i2c: stm32f7: fix configuration of the digital filter

The digital filter related computation are present in the driver
however the programming of the filter within the IP is missing.
The maximum value for the DNF is wrong and should be 15 instead of 16.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoi2c: stm32f7: support DT binding i2c-analog-filter
Patrick Delaunay [Tue, 3 Aug 2021 10:05:12 +0000 (12:05 +0200)]
i2c: stm32f7: support DT binding i2c-analog-filter

Replace driver internally coded enabling/disabling of the
analog-filter with the DT binding "i2c-analog-filter".

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoarm: dts: stm32: Add i2c-analog-filter property in I2C nodes for stm32h743
Patrice Chotard [Tue, 3 Aug 2021 10:05:11 +0000 (12:05 +0200)]
arm: dts: stm32: Add i2c-analog-filter property in I2C nodes for stm32h743

Add i2c-analog-filter property in I2C nodes to enable analog
filter feature.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoarm: dts: stm32: Add i2c-analog-filter property in I2C nodes for stm32f746
Patrice Chotard [Tue, 3 Aug 2021 10:05:10 +0000 (12:05 +0200)]
arm: dts: stm32: Add i2c-analog-filter property in I2C nodes for stm32f746

Add i2c-analog-filter property in I2C nodes to enable analog
filter feature.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoi2c: stm32f7: move driver data of each instance in a privdata
Patrick Delaunay [Tue, 3 Aug 2021 10:05:09 +0000 (12:05 +0200)]
i2c: stm32f7: move driver data of each instance in a privdata

Today all the I2C instance point on the same global
variable stm32_i2c_setup according the compatible: i2c_priv->setup =
pointer to the same driver data.

This patch changes this driver data (stm32f7_setup and stm32mp15_setup)
to a const struct and move the timing struct 'setup' as element of i2c
privdata, initialized in stm32_ofdata_to_platdata() with the driver
configuration data.

This patch solves issues when several I2C instance have not the same
clock source or not the same configuration: each timing setup is saved
is the I2C privdata.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agospi: stm32: Add ofdata_to_platdata() callback
Patrice Chotard [Tue, 3 Aug 2021 09:16:40 +0000 (11:16 +0200)]
spi: stm32: Add ofdata_to_platdata() callback

Parse DT in ofdata_to_platdata() callback instead of probe().

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoARM: mvebu: x530: Remove custom kwbimage.cfg
Chris Packham [Thu, 7 Oct 2021 08:39:23 +0000 (21:39 +1300)]
ARM: mvebu: x530: Remove custom kwbimage.cfg

Commit ca1a4c863232 ("mvebu: select boot device at SoC level") made it
unnecessary for the A385 boards to have their own kwbimage.cfg but as
the x530 was in flight at the time it was added with it's own
kwbimage.cfg. Remove the custom kwbimage.cfg as the SoC level file is
suitable.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: mvebu_armada-8k: drop Puzzle M801 early init code
Robert Marko [Mon, 4 Oct 2021 13:12:54 +0000 (15:12 +0200)]
arm: mvebu: mvebu_armada-8k: drop Puzzle M801 early init code

Since the CP1 pinctrl is not properly set in the DTS, there is no
need for setting the pinctrl by writing hardcoded values to the MPP
registers.

So, drop the code relating to that.

Fixes: 87c220d0 ("arm: mvebu: mvebu_armada-8k: Add support for initializing iEi Puzzle-M801 networking")
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: dts: m801: correct CP1 pinctrl
Robert Marko [Mon, 4 Oct 2021 13:12:53 +0000 (15:12 +0200)]
arm: mvebu: dts: m801: correct CP1 pinctrl

Current CP1 pinctrl that is set on the Puzzle M801 is incorrect.
CP1 pins are only used for the SMI bus and the MSS I2C, all other
pins are just GPIO-s.

Due to this being set completely wrong, the pinctrl was actually
ended up being hardcoded in the board_early_init_f() step so that
SMI would work.

That is obviously not the right thing to do, so convert the register
hex values that were being written to individual pin modes and set it
in the DTS.
Add the SMI pins to the CP1 MDIO node as otherwise CP1 pinctrl does
not get probed without an consumer.

Fixes: 2ae2b8a2 ("arm: mvebu: Initial iEi Puzzle-M801 support")
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: Select SPL_SKIP_LOWLEVEL_INIT on ARMADA_32BIT
Stefan Roese [Sun, 3 Oct 2021 09:53:45 +0000 (11:53 +0200)]
arm: mvebu: Select SPL_SKIP_LOWLEVEL_INIT on ARMADA_32BIT

Select SPL_SKIP_LOWLEVEL_INIT on 32bit Armada platforms via Kconfig,
as this was removed from mach/config.h in a2ac2b96 ("Convert
CONFIG_SKIP_LOWLEVEL_INIT et al to Kconfig").

Signed-off-by: Stefan Roese <sr@denx.de>
Fixes: a2ac2b96 ("Convert CONFIG_SKIP_LOWLEVEL_INIT et al to Kconfig")
Cc: Tom Rini <trini@konsulko.com>
Cc: Marek Behún <kabel@kernel.org>
Cc: Pali Rohár <pali@kernel.org>
Tested-by: Pali Rohár <pali@kernel.org>
2 years agoarm: a37xx: pci: Update private structure documentation
Marek Behún [Sat, 25 Sep 2021 22:54:46 +0000 (00:54 +0200)]
arm: a37xx: pci: Update private structure documentation

There were several changes for this structure but the documentation was
not changed at the time. Fix this.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Cosmetic change
Marek Behún [Sat, 25 Sep 2021 22:54:45 +0000 (00:54 +0200)]
arm: a37xx: pci: Cosmetic change

Update indentation in driver's private structure.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Handle propagation of CRSSVE bit from PCIe Root Port
Pali Rohár [Sat, 25 Sep 2021 22:54:44 +0000 (00:54 +0200)]
arm: a37xx: pci: Handle propagation of CRSSVE bit from PCIe Root Port

Now that PCI Bridge (PCIe Root Port) for Aardvark is emulated in U-Boot,
add support for handling and propagation of CRSSVE bit.

When CRSSVE bit is unset (default), driver has to reissue config
read/write request on CRS response.

CRSSVE bit is supported only when CRSVIS bit is provided in read-only
Root Capabilities register. So manually inject this CRSVIS bit into read
response for that register.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Do not automatically enable bus mastering on PCI Bridge
Pali Rohár [Sat, 25 Sep 2021 22:54:43 +0000 (00:54 +0200)]
arm: a37xx: pci: Do not automatically enable bus mastering on PCI Bridge

Now that PCI Bridge is working for the PCIe Root Port, U-Boot's PCI_PNP
code automatically enables memory access and bus mastering when needed.

We do not need to enable it when setting the HW up.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Add support for accessing PCI Bridge on root bus
Pali Rohár [Sat, 25 Sep 2021 22:54:42 +0000 (00:54 +0200)]
arm: a37xx: pci: Add support for accessing PCI Bridge on root bus

Aardvark does not have a real PCIe Root Port device on the root bus.
Instead it has PCIe registers of PCIe Root Port device mapped in
internal Aardvark memory space starting at offset 0xc0.

The PCIe Root Port itself is normally available as a PCI Bridge device
on the root bus with bus number zero. Aardvark instead has the
configuration registers of this PCI Bridge at offset 0x00 of Aardvark's
memory space, but the class code of this device is Mass Storage
Controller (0x010400), instead of PCI Bridge (0x600400), which causes
U-Boot to fail to recognize it as a P2P Bridge

Add a hook into the pcie_advk_read_config() / pcie_advk_write_config()
functions to redirect access for root bus from PIO transfer to this
internal Aardvark memory space. This will allow U-Boot to access
configuration space of this PCI Bridge which represents PCIe Root Port.

Redirect access to PCI Bridge registers in range 0x10 - 0x34 to driver's
internal buffer (cfgcache[]). This is because at those addresses
Aardvark has different registers, incompatible with config space of a
PCI Bridge.

Redirect access to PCI Bridge register PCI_ROM_ADDRESS1 (0x38) to
Aardvark internal address for that register (0x30).

When reading PCI Bridge register PCI_HEADER_TYPE, set it explicitly to
value Type 1 (PCI_HEADER_TYPE_BRIDGE) as PCI Bridge must be of Type 1.

When writing to PCI_PRIMARY_BUS or PCI_SECONDARY_BUS registers on this
PCI Bridge, correctly update driver's first_busno and sec_busno
variables, so that pcie_advk_addr_valid() function can check if address
of any device behind the root bus is valid and that PIO transfers are
started with correct config type (1 vs 0), which is required for
accessing devices behind some PCI bridge after the root bus.

U-Boot's PCI_PNP code sets primary and secondary bus numbers as relative
to the configured bus number of the root bus. This is done so that
U-Boot can support multiple PCIe host bridges or multiple root port
buses, when internal bus numbers are different.

Now that root bus is available, update code in pcie_advk_read_config()
and pcie_advk_write_config() functions to correctly calculate real
Aardvark bus number of the target device from U-Boot's bus number as:
  busno = PCI_BUS(bdf) - dev_seq(bus)

Stefan: Small fix of header masking as suggested by Pali.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Fix pcie_advk_link_up()
Pali Rohár [Sat, 25 Sep 2021 22:54:41 +0000 (00:54 +0200)]
arm: a37xx: pci: Fix pcie_advk_link_up()

Aardvark reports Disabled and Hot Reset LTSSM states as values >= 0x20.
Link is not up in these states, so fix pcie_advk_link_up() function.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a38x: serdes: Update comment about PCIE*_ENABLE_* defines
Pali Rohár [Fri, 24 Sep 2021 20:59:22 +0000 (22:59 +0200)]
arm: mvebu: a38x: serdes: Update comment about PCIE*_ENABLE_* defines

These are part of SOC_CONTROL_REG1 register, not PEX_CAPABILITIES_REG.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a38x: serdes: Remove unused PCIe macros and functions
Pali Rohár [Fri, 24 Sep 2021 20:59:21 +0000 (22:59 +0200)]
arm: mvebu: a38x: serdes: Remove unused PCIe macros and functions

Remove unused PCIe functions from SerDes code. They are unused and are
duplicated either from generic PCIe code or from pci_mvebu.c.

Remove also unused PCIe macros from SerDes code. They are just obfuscated
variants of standards macros in include/pci.h or in pci_mvebu.c.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a38x: serdes: Don't configure PCIe cards in SerDes init code
Pali Rohár [Fri, 24 Sep 2021 20:59:20 +0000 (22:59 +0200)]
arm: mvebu: a38x: serdes: Don't configure PCIe cards in SerDes init code

This code is trying to parse PCIe config space of PCIe card connected on
the other end of link and then is trying to force 5.0 GT/s speed via Target
Link Speed bits in PCIe Root Port Link Control 2 Register on the local part
of link if it sees that card supports 5.0 GT/s via Max Link Speed bits in
Link Capabilities Register.

The code is incorrect for more reasons:
- Accessing config space of an endpoint card cannot be done immediately.
  If the PCIe link is not up, reading vendor/device ID registers will
  return all ones.
- Parsing is incomplete, so it can cause issues even for working cards.

Moreover there is no need to force speed to 5.0 GT/s via Target Link Speed
bits on PCIe Root Port Link Control 2 Register. Hardware changes speed from
2.5 GT/s to 5.0 GT/s autonomously when it is supported.

Most importantly, this code does not change link speed at all, since
because after updating Target Link Speed bits on PCIe Root Port Link
Control 2 Register, it is required to retrain the link, and the code for
that is completely missing.

The code was probably needed for making buggy endpoint cards work. Such a
workaround, though, should be implemented via PCIe subsystem (via quirks,
for example), as buggy cards could also affect other PCIe controllers.

Note that this code is fully unrelated to a38x SerDes code and really
should not have been included in SerDes initialization. Usage of magic
constants without names and comments made this SerDes code hard to read and
understand.

Remove this PCIe application code from low level SerDes code. As this code
is configuring only 5.0 GT/s part, in the worst case, it could leave buggy
cards at the initial speed of 2.5 GT/s (if somehow before this change they
could have been "upgraded" to 5.0 GT/s speed even with missing link
retraining). Compliant cards which just need longer initialization should
work better after this change.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a38x: serdes: Don't overwrite PCI device ID
Pali Rohár [Fri, 24 Sep 2021 20:59:19 +0000 (22:59 +0200)]
arm: mvebu: a38x: serdes: Don't overwrite PCI device ID

PCI device ID is part of the PCIe controller SoC / revision. For Root
Complex mode (which is the default and the only mode supported currently
by U-Boot and Linux kernel), it is PCI device ID of PCIe Root Port device.

If there is some issue with this device ID, it should be set / updated by
PCIe controller driver (pci_mvebu.c), as this register resides in address
space of the controller. It shouldn't be done in SerDes initialization
code.

In the worst case (a specific board for example) it could be done via
U-Boot's weak function board_pex_config().

But it should not be overwritten globally for all A38x devices.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a38x: serdes: Don't set PCIe Common Clock Configuration
Pali Rohár [Fri, 24 Sep 2021 20:59:18 +0000 (22:59 +0200)]
arm: mvebu: a38x: serdes: Don't set PCIe Common Clock Configuration

Enabling Common Clock Configuration bit in PCIe Root Port Link Control
Register should not be done unconditionally. It is enabled by operating
system as part of ASPM. Also after enabling Common Clock Configuration it
is required to do more work, like retraining link. Some cards may be broken
due to this incomplete Common Clock Configuration and some cards are broken
and do not support ASPM at all.

Remove this incomplete code for Common Clock Configuration. It really
should not be done in SerDes code as it is not related to SerDes, but to
PCIe subsystem.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a38x: serdes: Don't overwrite read-only SAR PCIe registers
Pali Rohár [Fri, 24 Sep 2021 20:59:17 +0000 (22:59 +0200)]
arm: mvebu: a38x: serdes: Don't overwrite read-only SAR PCIe registers

Device/Port Type bits of PCIe Root Port PCI Express Capabilities Register
are read-only SAR registers and are initialized according to current mode
configured by PCIe controller. Changing PCIe controller mode (from Root
Complex mode to Endpoint mode or the other way) is possible via PCI
Express Control Register (offset 0x41A00), bit 1 (ConfRoot Complex). This
has to be done in PCIe controller driver (in our case pci_mvebu.c). Note
that default mode is Root Complex.

Maximum Link Speed bits of PCIe Root Port Link Capabilities Register are
platform specific and overwriting them does not make sense. They are set by
PCIe controller according to current SerDes configuration. For A38x it is
5.0 GT/s if SerDes supports appropriate speed.

Maximum Link Width bits of PCIe Root Port Link Capabilities Register are
read-only SAR registers, but unfortunately if this is not set correctly
here, then access PCI config space of the endpoint card behind this Root
Port does not work.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a38x: serdes: Add comments for hws_pex_config() code
Pali Rohár [Fri, 24 Sep 2021 20:59:16 +0000 (22:59 +0200)]
arm: mvebu: a38x: serdes: Add comments for hws_pex_config() code

Add comments to understand what this magic code is doing.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a38x: serdes: Remove duplicate macro SOC_CTRL_REG
Pali Rohár [Fri, 24 Sep 2021 20:59:15 +0000 (22:59 +0200)]
arm: mvebu: a38x: serdes: Remove duplicate macro SOC_CTRL_REG

SoC Control 1 Register (offset 0x18204) is already defined by macro
SOC_CONTROL_REG1.

Use macro SOC_CONTROL_REG1 instead of macro SOC_CTRL_REG in ctrl_pex.c
code and remove the other definition.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a38x: serdes: Add comments and use macros in PCIe code
Pali Rohár [Fri, 24 Sep 2021 20:59:14 +0000 (22:59 +0200)]
arm: mvebu: a38x: serdes: Add comments and use macros in PCIe code

Replace magic register offsets by macros to make code more readable.
Add comments about what this code is doing.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agophy: marvell: a3700: Return correct error code when power up fails
Pali Rohár [Fri, 24 Sep 2021 14:11:57 +0000 (16:11 +0200)]
phy: marvell: a3700: Return correct error code when power up fails

Subroutines in comphy_usb2_power_up() and comphy_sgmii_power_up() functions
may fail. In this case, do not continue execution of current function and
instead jump to the end. Return value in 'ret' variable is already set.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agophy: marvell: a3700: Fix configuring polarity invert bits
Pali Rohár [Fri, 24 Sep 2021 14:11:56 +0000 (16:11 +0200)]
phy: marvell: a3700: Fix configuring polarity invert bits

phy_txd_inv or phy_rxd_inv needs to be set only in case when
appropriate polarity is inverted. Otherwise these bits should be
cleared.

Same change was included in TF-A project:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/9406

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agophy: marvell: a3700: Set TXDCLK_2X_SEL bit during PCIe initialization
Pali Rohár [Fri, 24 Sep 2021 14:11:55 +0000 (16:11 +0200)]
phy: marvell: a3700: Set TXDCLK_2X_SEL bit during PCIe initialization

Marvell Armada 3700 Functional Specifications, section 52.2 PCIe Link
Initialization says that TXDCLK_2X_SEL bit needs to be enabled for PCIe
Root Complex mode.

Same change was included in TF-A project:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/9408

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Increase PCIe IO size from 64 KiB to 1 MiB
Pali Rohár [Thu, 23 Sep 2021 09:07:18 +0000 (11:07 +0200)]
arm: a37xx: pci: Increase PCIe IO size from 64 KiB to 1 MiB

Commit 079b35a26111 ("arm: a37xx: pci: Increase PCIe MEM size from 16 MiB
to 127 MiB") increased size of PCIe MEM to 127 MiB, which is the maximal
possible size for allocated 128 MiB PCIe window. PCIe IO size in that
commit was unchanged.

Armada 3720 PCIe controller supports 32-bit IO space mapping so it is
possible to assign more than 64 KiB if address space for IO.

Currently controller has assigned 127 MiB + 64 KiB memory and therefore
there is 960 KiB of unused memory. So assign it to IO space by increasing
IO window from 64 KiB to 1 MiB.

Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: 079b35a26111 ("arm: a37xx: pci: Increase PCIe MEM size from 16 MiB to 127 MiB")
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopm9263: Remove unused CONFIG_USER_LOWLEVEL_INIT
Patrick Delaunay [Wed, 6 Oct 2021 16:49:47 +0000 (18:49 +0200)]
pm9263: Remove unused CONFIG_USER_LOWLEVEL_INIT

Remove the latest reference of CONFIG_USER_LOWLEVEL_INIT in code

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agostv0991: remove specific CONFIG_STV0991 configs
Patrick Delaunay [Wed, 6 Oct 2021 16:10:32 +0000 (18:10 +0200)]
stv0991: remove specific CONFIG_STV0991 configs

Remove the following STV0991 specific configs:
- CONFIG_STV0991 (never used, only defined in CONFIG_SYS_EXTRA_OPTIONS)
- CONFIG_STV0991_HZ (replaced by generic CONFIG_SYS_HZ)
- CONFIG_STV0991_HZ_CLOCK (replaced by generic CONFIG_SYS_HZ_CLOCK)

This patch allows to reduce the file config_whitelist.txt.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agostm32f429: move CONFIG_BOOTCOMMAND in defconfig
Patrick Delaunay [Wed, 6 Oct 2021 15:16:23 +0000 (17:16 +0200)]
stm32f429: move CONFIG_BOOTCOMMAND in defconfig

Move CONFIG_BOOTCOMMAND defined in Kconfig in the board defconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoconfigs: Move some usb config in defconfig
Patrick Delaunay [Mon, 4 Oct 2021 09:23:41 +0000 (11:23 +0200)]
configs: Move some usb config in defconfig

Using the tools moveconfig.py to move the following config in the
defconfig files:
 CONFIG_USB_HOST_ETHER
 CONFIG_USB_ETHER_ASIX
 CONFIG_USB_ETHER_MCS7830
 CONFIG_USB_ETHER_SMSC95XX

These option are already migrated since the commit f58ad98a621c ("usb: net:
migrate USB Ethernet adapters to Kconfig") and the commit ae3584498bf8
("usb: net: migrate CONFIG_USB_HOST_ETHER to Kconfig").

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoConvert CONFIG_STM32_FLASH to Kconfig
Patrick Delaunay [Mon, 4 Oct 2021 09:05:52 +0000 (11:05 +0200)]
Convert CONFIG_STM32_FLASH to Kconfig

This converts the CONFIG_STM32_FLASH to Kconfig by using
tools/moveconfig.py

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoRevert "configs: stm32mp1: only support SD card after NOR in bootcmd_stm32mp"
Marek Vasut [Mon, 4 Oct 2021 11:48:08 +0000 (13:48 +0200)]
Revert "configs: stm32mp1: only support SD card after NOR in bootcmd_stm32mp"

This reverts commit d5d726d3cc47691ace3c68fa31147ad104aaf579,
which breaks boards which ship with multiple SD/eMMC sockets.

This stm32mp1.h config is not used only by the ST reference
boards, but all the other STM32MP1 based boards in U-Boot, so
changes to this stm32mp1.h cannot break the other boards.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agophy: stm32-usbphyc: stm32: usbphyc: add protection on phy sub-node
Patrick Delaunay [Tue, 14 Sep 2021 12:31:17 +0000 (14:31 +0200)]
phy: stm32-usbphyc: stm32: usbphyc: add protection on phy sub-node

Add protection on presence and order of the phy node sub node
by using the mandatory reg information.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agophy: stm32-usbphyc: use connector for vbus-supply with phy-stm32-usbphyc
Patrick Delaunay [Tue, 14 Sep 2021 12:31:16 +0000 (14:31 +0200)]
phy: stm32-usbphyc: use connector for vbus-supply with phy-stm32-usbphyc

The vbus-supply is an optional property of sub-node connector node.
and no more in the usb phyc node (in first proposed binding).

This regulator for USB VBUS may be needed for host mode.

See the latest kernel binding for details in
Documentation/devicetree/bindings/phy/phy-stm32-usbphyc.yaml.

  usbphyc_port0: usb-phy@0 {
      reg = <0>;
      phy-supply = <&vdd_usb>;
      #phy-cells = <0>;
      connector {
          compatible = "usb-a-connector";
          vbus-supply = <&vbus_sw>;
      };
  };

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoboard: stm32: Remove the bi_boot_params initialization
Patrick Delaunay [Thu, 2 Sep 2021 10:02:07 +0000 (12:02 +0200)]
board: stm32: Remove the bi_boot_params initialization

The stm32 platforms never had to support an ATAGs-based Linux Kernel,
so remove the bi_boot_params initialization.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
Tested-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2 years agoarm: stm32: Disable ATAGs support
Patrick Delaunay [Thu, 2 Sep 2021 10:02:06 +0000 (12:02 +0200)]
arm: stm32: Disable ATAGs support

These platforms never had to support an ATAGs-based Linux Kernel, so
remove the options.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2 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

2 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

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

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

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