]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
4 months agommc: exynos_dw_mmc: Use dev->name as driver's displayed name
Sam Protsenko [Thu, 8 Aug 2024 03:14:40 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Use dev->name as driver's displayed name

Reduce U-Boot footprint by reusing dev->name as a driver's displayed
name. This changes boot device name (and "mmc info" output) from "EXYNOS
DWMMC" to something like "mmc@12100000".

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Don't call dwmci_setup_cfg() after add_dwmci()
Sam Protsenko [Thu, 8 Aug 2024 03:14:39 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Don't call dwmci_setup_cfg() after add_dwmci()

add_dwmci() is already calling dwmci_setup_cfg() internally, there is no
needed to call dwmci_setup_cfg() again in case when add_dwmci() is used
(for non-DM cases). Fix it by calling dwmci_setup_cfg() only in DM
cases, when add_dwmci() wasn't called. Also, this assignment:

    host->mmc = &plat->mmc;

is wrong in non-DM case when add_dwmci() was called, as it's creating
mmc object internally. Fix that by pulling that assignment into DM case,
when add_dwmci() isn't called.

While at it, add also this missing assignment:

    host->mmc->dev = dev;

Fixes: 3537ee879e04 ("mmc: exynos_dw_mmc: support the Driver mode for Exynos")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Pull all init code into probe function
Sam Protsenko [Thu, 8 Aug 2024 03:14:38 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Pull all init code into probe function

There is no logical sense to split the initialization code between
multiple functions. Pull both do_dwmci_init() and
exynos_dwmci_core_init() into exynos_dwmmc_probe() to make the code more
simple and obvious.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Add support for ARM64 Exynos chips
Sam Protsenko [Thu, 8 Aug 2024 03:14:37 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Add support for ARM64 Exynos chips

Add the compatible entry and corresponding chip data for Exynos7
compatible chips, which covers modern ARM64 based Exynos chips. They
have some differences w.r.t. old ARM32 Exynos chips:
  - CLKSEL register offset is different
  - 64-bit IDMAC descriptor and 64-bit IDMAC registers are used
    (implemented in dw_mmc core driver)

In terms of the driver implementation, the CIU clock is obtained via CCF
framework (as opposed to ad-hoc clock driver implementation for ARM32
chips).

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Set requested freq in get_mmc_clk() callback
Sam Protsenko [Thu, 8 Aug 2024 03:14:36 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Set requested freq in get_mmc_clk() callback

By now exynos_dw_mmc driver was relying on the correct CIU clock
frequency being set on driver init. But dw_mmc core is actually trying
to change CIU clock rate dynamically, on init and in set_ios() callback,
which it's requesting via host->get_mmc_clk() callback (the name is
misleading: although it's called "get_mmc_clk()", it can actually
request both get and set operations). Implement setting the requested
rate for CIU clock in Exynos driver to achieve the correct dw_mmc core
driver operation at all times. DDR mode requires the clock to be twice
as fast (when 8 bit bus is used), so handle this too, to make DDR
function properly.

This change makes the eMMC throughput on E850-96 board twice as fast.
That's because "clock-frequency" is set to 800 MHz in E850-96 device
tree, but for DDR52 mode it should be 416 MHz (and TRM states it should
be 400 MHz for DDR50/8bit mode). The dw_mmc core is requesting 52 MHz
bus_hz for DDR52 mode, and DDR+8bit mode means it should be x2 fast, so:

    f_ciu = 2 * ciu_div * f_bus = 2 * 4 * 52e6 = 416 MHz,

where f_ciu   - freq of clock fed to DW MMC block from CMU (SDCLKIN), Hz
      f_bus   - freq of clock fed to the card (CCLKIN), Hz
      ciu_div - value of internal divider (in DW MMC block).

Another way to work that around would be overriding the
"clock-frequency" property in corresponding dts. But setting the clock
frequency dynamically as it's done here looks much neater.

This implementation follows what's done in Linux kernel dw_mmc-exynos
driver in .set_ios() callback for MMC_TIMING_MMC_DDR52 case.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Read and use DDR timing when available
Sam Protsenko [Thu, 8 Aug 2024 03:14:35 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Read and use DDR timing when available

DDR timing values should be defined in "samsung,dw-mshc-ddr-timing" dts
property, and used when DDR MMC mode is selected. Read that value from
dts and use it. If it's not available, use SDR timing values instead.
This change is following upstream Linux kernel implementation.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Move quirks from struct dwmci_host to chip data
Sam Protsenko [Thu, 8 Aug 2024 03:14:34 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Move quirks from struct dwmci_host to chip data

host->quirks field is only used internally in exynos_dw_mmc.c driver.
To avoid cluttering the scope of struct dwmci_host, move quirks field
into Exynos driver's chip data, where it can be statically defined.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Read common clock-frequency property
Sam Protsenko [Thu, 8 Aug 2024 03:14:33 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Read common clock-frequency property

Instead of using non-standard "bus_hz" dts property, read common
"clock-frequency" property used in upstream Linux kernel. It's safe to
do so, as "clock-frequency" property was already added to corresponding
nodes in all affected Exynos device tree files.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Read common bus-width property
Sam Protsenko [Thu, 8 Aug 2024 03:14:32 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Read common bus-width property

Instead of using non-standard "samsung,bus-width" dts property, read
common "bus-width" property used in upstream Linux kernel. It's safe to
do so, as "bus-width" property was already added to corresponding nodes
in all affected Exynos device tree files.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Refactor fixed CIU clock divider
Sam Protsenko [Thu, 8 Aug 2024 03:14:31 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Refactor fixed CIU clock divider

Some chips like Exynos4412 have fixed internal CIU clock divider.
Instead of reading it from non-standard "div" dts property, store its
value in the driver internally, in static chip data associated with
corresponding compatible. This makes it possible to avoid using
host->div for storing it, so the latter can be removed safely. Also
create a helper function called exynos_dwmmc_get_ciu_div() for getting
the current div value: in case the fixed div is provided in the chip
data it will be used, otherwise the current div value is being read from
CLKSEL register.

The insights for this change were taken from dw_mmc-exynos.c driver in
Linux kernel.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Abstract CLKSEL register
Sam Protsenko [Thu, 8 Aug 2024 03:14:30 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Abstract CLKSEL register

CLKSEL register offset may vary between different Exynos chips, e.g. on
ARM64 vs ARM32 chips. Provide a way to specify its offset value for each
compatible instead of hard-coding its value in read/write calls.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Read upstream SDR timing properties
Sam Protsenko [Thu, 8 Aug 2024 03:14:29 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Read upstream SDR timing properties

The obsolete "samsung,timing" dts property is now split into
"samsung,dw-mshc-ciu-div" (for holding the internal DW MMC divider
value) and "samsung,dw-mshc-sdr-timing" (for actual timing values) in
upstream Linux kernel. Rework the driver to make use of new properties
instead of the old one. All affected dts files were already updated
accordingly.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Convert to use livetree API
Sam Protsenko [Thu, 8 Aug 2024 03:14:28 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Convert to use livetree API

Update the driver to use livetree API instead of FDT one.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Use .of_to_plat for device tree parsing
Sam Protsenko [Thu, 8 Aug 2024 03:14:27 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Use .of_to_plat for device tree parsing

exynos_dwmci_get_config() is called from the probe function and used to
read data from device tree. Make use of .of_to_plat driver callback
instead, and convert exynos_dwmci_get_config() to match its signature.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Obtain and use CIU clock via CCF API
Sam Protsenko [Thu, 8 Aug 2024 03:14:26 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Obtain and use CIU clock via CCF API

New Exynos chips should implement clock drivers using CCF framework. In
that case corresponding CCF functions can be used to get/set the clock
rates. Moreover, already existing get_mmc_clk() and set_mmc_clk() calls
are only implemented for CONFIG_CPU_V7A (i.e. ARM32 chips). In case of
ARM64 chips that config option is not defined, so build will crash on
linking stage, with errors like these:

    ld: drivers/mmc/exynos_dw_mmc.o:
      in function `exynos_dwmci_get_sclk':
      undefined reference to `get_mmc_clk'
    ld: drivers/mmc/exynos_dw_mmc.o:
      in function `exynos_dwmci_set_sclk':
      undefined reference to `set_mmc_clk'

Fix that issue by using CCF clocks API on ARM64 platforms for getting
and setting the source clock (sclk = SDCLKIN = CIU) rate. To implement
this, first extract the existing ARM32 clock control code into helper
functions with more generic signatures to abstract getting/setting the
sclk rate. Then add CCF clock support to those functions for ARM64
platforms.

Fixes: a082a2dde061 ("EXYNOS5: DWMMC: Added FDT support for DWMMC")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Don't call pinmux functions on ARM64 chips
Sam Protsenko [Thu, 8 Aug 2024 03:14:25 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Don't call pinmux functions on ARM64 chips

Pinmux configuration on ARM64 platforms must be performed during startup
in pinctrl driver using info from device tree. exynos_pinmux_config()
and pinmux_decode_periph_id() are only available on ARM32 platforms, so
don't call those functions on ARM64 platforms. Instead of the latter
function, use "non-removable" property from device tree to derive the
dev_index value.

This fixes next linking errors on ARM64 platforms:

    ld: drivers/mmc/exynos_dw_mmc.o:
      in function `exynos_dwmci_get_config':
      undefined reference to `pinmux_decode_periph_id'
    ld: drivers/mmc/exynos_dw_mmc.o:
      in function `do_dwmci_init':
      undefined reference to `exynos_pinmux_config'

Fixes: a082a2dde061 ("EXYNOS5: DWMMC: Added FDT support for DWMMC")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Fix getting private data in exynos_dwmci_board_init()
Sam Protsenko [Thu, 8 Aug 2024 03:14:24 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Fix getting private data in exynos_dwmci_board_init()

In case of CONFIG_DM_MMC, host->priv actually holds (struct udevice *),
and not (struct dwmci_exynos_priv_data *). This makes *priv pointer
invalid and may lead to Synchronous Abort during its dereference later
in exynos_dwmci_board_init(). Fix it by extracting
exynos_dwmmc_get_priv() helper from exynos_dwmci_clksel() and using it
for getting the private data in exynos_dwmci_board_init()

Fixes: 3537ee879e04 ("mmc: exynos_dw_mmc: support the Driver mode for Exynos")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Fix obtaining the base address of controller
Sam Protsenko [Thu, 8 Aug 2024 03:14:23 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Fix obtaining the base address of controller

Getting the base address with outdated fdtdec_get_addr() API and further
casting it to (void *) leads to next build warning on ARM64 platforms:

    In function 'exynos_dwmci_get_config':
        warning: cast to pointer from integer of different size
        [-Wint-to-pointer-cast]
            host->ioaddr = (void *)base;

Use livetree API instead (dev_read_addr_ptr()), which handles this
correctly.

Fixes: a082a2dde061 ("EXYNOS5: DWMMC: Added FDT support for DWMMC")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agoarm: exynos: Add header guard for dwmmc.h
Sam Protsenko [Thu, 8 Aug 2024 03:14:22 +0000 (22:14 -0500)]
arm: exynos: Add header guard for dwmmc.h

Add missing header guard to prevent possible build errors.

Fixes: 77b55e8cfcee ("ARM: exynos: move SoC sources to mach-exynos")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agodt-bindings: exynos: Update bindings doc for DW MMC controller
Sam Protsenko [Thu, 8 Aug 2024 03:14:21 +0000 (22:14 -0500)]
dt-bindings: exynos: Update bindings doc for DW MMC controller

Update the bindings doc for Exynos DW MMC block to follow the upstream
example and reflect the latest changes made in corresponding Linux
kernel bindings.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agoarm: dts: exynos: Add upstream DW MMC properties to all Exynos dts
Sam Protsenko [Thu, 8 Aug 2024 03:14:20 +0000 (22:14 -0500)]
arm: dts: exynos: Add upstream DW MMC properties to all Exynos dts

Some device tree properties for DW MMC block were updated in Linux
kernel. Let's follow its example and rework corresponding properties in
all Exynos device trees. Don't remove outdated properties yet, it'll be
done later once DW MMC driver is updated accordingly to read the updated
properties instead of outdated ones.

Next properties are added:

* samsung,dw-mshc-ciu-div and samsung,dw-mshc-sdr-timing:

  They were derived from outdated samsung,timing property.

* fifo-depth (generic replacement for fifoth_val):

  FIFO depth was calculated from fifoth_val (using expressions from
  FIFOTH register description in TRM):

      fifo-depth = ((fifoth_val >> 16) + 1) * 2

* bus-width: generic replacement for samsung,bus-width
* clock-frequency: generic replacement for bus_hz
* non-removable: generic replacement for samsung,removable = <0>

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Improve coding style
Sam Protsenko [Thu, 8 Aug 2024 03:14:19 +0000 (22:14 -0500)]
mmc: dw_mmc: Improve coding style

Fix most of checkpatch warnings and other obvious style issues.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Fix kernel-doc comments in dwmmc.h
Sam Protsenko [Thu, 8 Aug 2024 03:14:18 +0000 (22:14 -0500)]
mmc: dw_mmc: Fix kernel-doc comments in dwmmc.h

Rework kernel-doc comments in dwmmc.h header so it's actually possible
to generate a proper documentation from it usin scripts/kernel-doc
script, with no errors.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Replace fifoth_val property with fifo-depth
Sam Protsenko [Thu, 8 Aug 2024 03:14:17 +0000 (22:14 -0500)]
mmc: dw_mmc: Replace fifoth_val property with fifo-depth

Replace fifoth_val property with its fifo-depth counterpart in all DW
MMC drivers. fifo-depth is a common property used in upstream Linux
kernel. The FIFOTH register value will be calculated using fifo-depth
value in DW MMC core (dw_mmc.c). This change reduces code duplication in
platform drivers, and pulls common FIFOTH register value calculation
into core dw_mmc driver where it belongs.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Add support for 64-bit IDMAC
Sam Protsenko [Thu, 8 Aug 2024 03:14:16 +0000 (22:14 -0500)]
mmc: dw_mmc: Add support for 64-bit IDMAC

Some DW MMC blocks (e.g. those on modern Exynos chips) support 64-bit
DMA addressing mode. 64-bit DW MMC variants differ from their 32-bit
counterparts:
  - the register layout is a bit different (because there are additional
    IDMAC registers present for storing upper part of 64-bit addresses)
  - DMA descriptor structure is bigger and different from 32-bit one

Introduce all necessary changes to enable support for 64-bit DMA capable
DW MMC blocks. Next changes were made:

  1. Check which DMA address mode is supported in current IP-core
     version. HCON register (bit 27) indicates whether it's 32-bit or
     64-bit addressing. Add boolean .dma_64bit_address field to struct
     dwmci_host and store the result there. dwmci_init_dma() function is
     introduced for doing so, which is called on driver's init.

  2. Add 64-bit DMA descriptor (struct dwmci_idmac64) and use it in
     dwmci_prepare_desc() in case if .dma_64bit_address field is true.
     A new dwmci_set_idma_desc64() function was added for populating that
     descriptor.

  3. Add registers for 64-bit DMA capable blocks. To make the access to
     IDMAC registers universal between 32-bit / 64-bit cases, a new
     struct dwmci_idmac_regs (and corresponding host->regs field) was
     introduced, which abstracts the hardware by being set to
     appropriate offset constants on init. All direct calls to IDMAC
     registers were correspondingly replaced by accessing host->regs.

  4. Allocate and use 64-bit DMA descriptors buffer in case when IDMAC
     is 64-bit capable. Extract all the code (except for the IDMAC
     descriptors buffer allocation) from dwmci_send_cmd() to
     dwmci_send_cmd_common(), so that it's possible to keep IDMAC
     buffer (either 32-bit or 64-bit) on stack during send_cmd routine.

The insights for this implementation were taken from Linux kernel DW MMC
driver.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Improve 32-bit IDMAC descriptor namings
Sam Protsenko [Thu, 8 Aug 2024 03:14:15 +0000 (22:14 -0500)]
mmc: dw_mmc: Improve 32-bit IDMAC descriptor namings

Prepare for adding 64-bit IDMAC descriptors by renaming current 32-bit
descriptor and its fields accordingly. While at it, make use of
virt_to_phys() to make it more obvious in which places the physical
addresses have to be used.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Extract setting the DMA descriptor into a separate routine
Sam Protsenko [Thu, 8 Aug 2024 03:14:14 +0000 (22:14 -0500)]
mmc: dw_mmc: Extract setting the DMA descriptor into a separate routine

Make dwmci_prepare_data() function easier to read by extracting the
preparation of IDMAC descriptor into a dedicated function.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Extract DMA transfer handling code into a separate routine
Sam Protsenko [Thu, 8 Aug 2024 03:14:13 +0000 (22:14 -0500)]
mmc: dw_mmc: Extract DMA transfer handling code into a separate routine

Make dwmci_send_cmd() easier to read by moving the DMA transfer handling
code into a dedicated function.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Extract FIFO data transfer into a separate routine
Sam Protsenko [Thu, 8 Aug 2024 03:14:12 +0000 (22:14 -0500)]
mmc: dw_mmc: Extract FIFO data transfer into a separate routine

FIFO data transfer is implemented as quite a massive chunk of code.
Extract it into a dedicated function to make dwmci_data_transfer()
easier to read and reduce the indentation level of the code.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Extract divider update to a separate function
Sam Protsenko [Thu, 8 Aug 2024 03:14:11 +0000 (22:14 -0500)]
mmc: dw_mmc: Extract divider update to a separate function

Extract the clock divider update into dwmci_update_div() function. It's
a procedure recommended in TRM, so it's better to keep it in a dedicated
function to make the code clearer.

While at it also extract the clock control code into a separate routine
to avoid code duplication in dwmci_setup_bus().

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Extract FIFO init into a separate routine
Sam Protsenko [Thu, 8 Aug 2024 03:14:10 +0000 (22:14 -0500)]
mmc: dw_mmc: Extract FIFO init into a separate routine

Move FIFO threshold initialization into a separate function to make
dwmci_init() more readable.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Extract waiting for data busy into a separate routine
Sam Protsenko [Thu, 8 Aug 2024 03:14:09 +0000 (22:14 -0500)]
mmc: dw_mmc: Extract waiting for data busy into a separate routine

Waiting for data busy is a logically separate operation and should be
implemented as a separate routine. Follow Linux kernel example and
extract it from dwmci_send_cmd(). This way it doesn't clutter
dwmci_send_cmd() function, and can be reused later in other cases.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Move struct idmac to dw_mmc.c
Sam Protsenko [Thu, 8 Aug 2024 03:14:08 +0000 (22:14 -0500)]
mmc: dw_mmc: Move struct idmac to dw_mmc.c

struct idmac is only used in dw_mmc.c, so move it there from dwmmc.h to
avoid cluttering the interface in the header.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Remove unused version field from struct dwmci_host
Sam Protsenko [Thu, 8 Aug 2024 03:14:07 +0000 (22:14 -0500)]
mmc: dw_mmc: Remove unused version field from struct dwmci_host

Nobody seems to use it, so just remove it.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agoam335x_hs_evm_spi_defconfig: Add MAINTAINERS entry
Tom Rini [Thu, 15 Aug 2024 22:07:45 +0000 (16:07 -0600)]
am335x_hs_evm_spi_defconfig: Add MAINTAINERS entry

Add this to the existing entry for similar boards.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 months agodefconfig: Add a config for AM335x High Security EVM with SPI Boot support
Andrew Davis [Wed, 7 Aug 2024 15:26:59 +0000 (10:26 -0500)]
defconfig: Add a config for AM335x High Security EVM with SPI Boot support

Add a new defconfig file for the AM335x High Security EVM. This config
is specific for the case of SPI booting.

Signed-off-by: Andrew Davis <afd@ti.com>
4 months agoscripts/decodecode: update from Linux v6.10
Heinrich Schuchardt [Fri, 9 Aug 2024 18:22:33 +0000 (20:22 +0200)]
scripts/decodecode: update from Linux v6.10

For decoding RISC-V dumps we need to update the script.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
4 months agomaintainers: Update list of maintainers for Corstone-1000
Hugues Kamba Mpiana [Tue, 13 Aug 2024 15:53:05 +0000 (16:53 +0100)]
maintainers: Update list of maintainers for Corstone-1000

- Add new maintainer: Hugues KAMBA MPIANA
- Remove maintainer: Xueliang ZHONG
- Update contact information for current maintainer.

Signed-off-by: Hugues KAMBA MPIANA <hugues.kambampiana@arm.com>
4 months agoMerge tag 'u-boot-imx-master-20240813' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Tue, 13 Aug 2024 16:10:29 +0000 (10:10 -0600)]
Merge tag 'u-boot-imx-master-20240813' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/22014

- Convert tqma6q_mba6 to watchdog DM to fix reset.
- Convert tqma6q_mba6 to PMIC and I2C DM.
- Convert tqma6q_mba6 to OF_UPSTREAM.
- Do not print the board name twice on tqma6.
- Enable CMD_ERASEENV for imx8mm/mp Phytec boards.
- Add imx8ulp binman support.
- Fix imx8 build when CONFIG_IMX_BOOTAUX is set.

4 months agotqma6: Do not print the board name twice
Fabio Estevam [Fri, 9 Aug 2024 17:58:09 +0000 (14:58 -0300)]
tqma6: Do not print the board name twice

Currently, the devicetree model as well as the board variant name
are shown:
...
Model: TQ TQMa6S/DL on MBa6x
Board: TQMa6DL on a MBa6x
...

Unselect the CONFIG_DISPLAY_BOARDINFO option so that the
board name is printed only once in board_late_init() instead.

Signed-off-by: Fabio Estevam <festevam@denx.de>
4 months agotqma6: Convert to PMIC and I2C driver model
Fabio Estevam [Fri, 9 Aug 2024 17:58:08 +0000 (14:58 -0300)]
tqma6: Convert to PMIC and I2C driver model

Currently, the power_init_board() function is not executed because
CONFIG_POWER_LEGACY is not selected.

Convert to PMIC driver model, which allows removing board I2C code in
favor of the I2C driver model.

Signed-off-by: Fabio Estevam <festevam@denx.de>
4 months agoimx6-tqma6: Convert to OF_UPSTREAM
Fabio Estevam [Fri, 9 Aug 2024 15:25:48 +0000 (12:25 -0300)]
imx6-tqma6: Convert to OF_UPSTREAM

Instead of using the local imx6-tqma6 devicetree copies from U-Boot,
convert the imx6-tqma6 target to OF_UPSTREAM so that the upstream
kernel devicetrees can be used instead.

Signed-off-by: Fabio Estevam <festevam@denx.de>
4 months agotqma6q_mba6: Convert to watchdog driver model
Fabio Estevam [Fri, 9 Aug 2024 15:12:47 +0000 (12:12 -0300)]
tqma6q_mba6: Convert to watchdog driver model

Commit 68dcbdd594d4 ("ARM: imx: Add weak default reset_cpu()") caused
the 'reset' command in U-Boot to not cause a board reset.

Fix it by switching to the watchdog driver model via sysreset, which
is the preferred method for implementing the watchdog reset.

Signed-off-by: Fabio Estevam <festevam@denx.de>
4 months agoimx: imx8: fix build when CONFIG_IMX_BOOTAUX is set
Max Krummenacher [Wed, 7 Aug 2024 13:39:11 +0000 (15:39 +0200)]
imx: imx8: fix build when CONFIG_IMX_BOOTAUX is set

Use correct function name.

Fixes: e8cd1f60d964 ("imx: imx8: bootaux: Add i.MX8 M4 boot support")
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
4 months agoimx8ulp_evk: enable binman support
Gary Bisson [Mon, 5 Aug 2024 21:25:11 +0000 (23:25 +0200)]
imx8ulp_evk: enable binman support

Enable binman support and add documentation for the
imx8ul-evk board.

Signed-off-by: Gary Bisson <bisson.gary@gmail.com>
4 months agomach-imx: Add i.MX 8ULP binman support
Gary Bisson [Mon, 5 Aug 2024 21:25:10 +0000 (23:25 +0200)]
mach-imx: Add i.MX 8ULP binman support

- Re-use i.MX 93 Makefile target as similar boot process
- Create imx8ulp-u-boot.dtsi for binman image architecture
- Create both SPL and U-Boot containers configuration

Key differences between the 93 and 8ULP SPL container are:
- No LPDDR training library needed for 8ULP
- 8ULP requires a uPower binary (RISC-V core) for power management
- 8ULP also requires a M33 binary to work properly

Signed-off-by: Gary Bisson <bisson.gary@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
4 months agospl: binman: Disable u_boot_any symbols for i.MX 8ULP boards
Gary Bisson [Mon, 5 Aug 2024 21:25:09 +0000 (23:25 +0200)]
spl: binman: Disable u_boot_any symbols for i.MX 8ULP boards

This is extending commit da96f93cda9 ("spl: binman: Disable u_boot_any
symbols for i.MX93 boards") to i.MX 8ULP boards.

Signed-off-by: Gary Bisson <bisson.gary@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
4 months agotools: imx8image: add upower image support
Gary Bisson [Mon, 5 Aug 2024 21:25:08 +0000 (23:25 +0200)]
tools: imx8image: add upower image support

Part of the upower management was included in a previous commit [1].
This patch only adds the bits required to properly parse a config file
that would include the binary as follows:
IMAGE PWR upower.bin

[1] 6ec65c8558f (tools: image: support i.MX93)

Signed-off-by: Gary Bisson <bisson.gary@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
4 months agotools: imx8image: fix soc variable for ULP
Gary Bisson [Mon, 5 Aug 2024 21:25:07 +0000 (23:25 +0200)]
tools: imx8image: fix soc variable for ULP

Currently the ULP token sets the soc as IMX9, making it impossible to
differentiate the two families of processors.
However, since the 8ULP requires specific binaries like upower which do
not exist in 93, they need to be separated.

Fixes: 6ec65c8558f (tools: image: support i.MX93)
Signed-off-by: Gary Bisson <bisson.gary@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
4 months agoMerge tag 'u-boot-rockchip-20240812' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 12 Aug 2024 13:58:24 +0000 (07:58 -0600)]
Merge tag 'u-boot-rockchip-20240812' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

Please pull the updates for rockchip platform:
- Add board support:
        RK3566: Radxa ROCK 3 Model C
                Radxa ZERO 3W/3E
                Xunlong Orange Pi 3B
        RK3568J: Radxa ROCK 3B
        RK3308B: Radxa ROCK S0
        RK3588: Radxa ROCK 5 ITX
                FriendlyElec CM3588 NAS board
- dw-mmc: allow 4-bit mode;
- dts and config updates;

CI:
https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/pipelines/21997

4 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Mon, 12 Aug 2024 13:58:09 +0000 (07:58 -0600)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

4 months agoMerge tag 'ubifixes-for-v2024-10-rc3' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 12 Aug 2024 13:57:45 +0000 (07:57 -0600)]
Merge tag 'ubifixes-for-v2024-10-rc3' of https://source.denx.de/u-boot/custodians/u-boot-ubi

ubi fixes for v2024.10-rc3

- ubi memleak fixes from Alexander

- ubifs: mount fails after power cycle
  fixed from Ravi
  commit ported from kernel commit 304790c038bc4af4f19774705409db27eafb09fc

  HS: fixed checkpatch Error

  ERROR: Remove Gerrit Change-Id's before submitting upstream
  #213:
  Change-Id: I487ae4d172e228e72ac31d158d668f209142bce0

  removed this line from commit message.

- memleak fixes from Michael in ubifs, missing ubifs_iput(inode) after
  ubifs_iget() calls.

Special thanks to all of them for detecting/fixing and testing
this patches!

4 months agoMerge tag 'efi-2024-10-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 12 Aug 2024 13:57:34 +0000 (07:57 -0600)]
Merge tag 'efi-2024-10-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2024-10-rc3

UEFI:

* efi_loader: use list_count_nodes() in efi_protocols_per_handle()
* efi_loader: correct description of efi_get_distro_fdt_name
* boot: set correct block device name in set_efi_bootdev()
* configs: enable efidebug and EFI http boot on QEMU aarch64

Other:

* Makefile: don't use CFLAGS for environment text file

4 months agoconfigs: rockchip: enable "ums" command for Radxa ROCK 5B
FUKAUMI Naoki [Tue, 6 Aug 2024 03:47:59 +0000 (12:47 +0900)]
configs: rockchip: enable "ums" command for Radxa ROCK 5B

USB Type-C port is configured as "peripheral" port. so enable "ums"
command to use as USB Mass Storage device.
("rockusb" command is already enabled and working)

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoarm: dts: rockchip: remove upstreamed props for Radxa ROCK 5B
FUKAUMI Naoki [Tue, 6 Aug 2024 03:37:42 +0000 (12:37 +0900)]
arm: dts: rockchip: remove upstreamed props for Radxa ROCK 5B

"usb_host1_xhci" and related node were already upstreamed. remove
unnecessary properties from u-boot.dtsi.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoarm: dts: rockchip: remove upstreamed props for Radxa ROCK 3A
FUKAUMI Naoki [Tue, 6 Aug 2024 01:18:42 +0000 (10:18 +0900)]
arm: dts: rockchip: remove upstreamed props for Radxa ROCK 3A

"sfc" node was already upstreamed. remove unnecessary properties from
u-boot.dtsi.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoarm64: dts: rockchip: change spi-max-frequency for Radxa ROCK 3C
FUKAUMI Naoki [Mon, 5 Aug 2024 02:26:01 +0000 (11:26 +0900)]
arm64: dts: rockchip: change spi-max-frequency for Radxa ROCK 3C

SPI NOR flash chip may vary, so use safe(lowest) spi-max-frequency.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Link: https://lore.kernel.org/r/20240623023329.1044-3-naoki@radxa.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[ upstream commit: 06f6dd4d607766a527e37529f2f3f90dd1464293 ]

(cherry picked from commit dd40945a1d0e28ae6eaf9da04f8e2dcebf8233ea)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agorockchip: rk3568-nanopi-r5: Disable SPL_DM_WARN Kconfig option
Jonas Karlman [Fri, 2 Aug 2024 23:48:44 +0000 (23:48 +0000)]
rockchip: rk3568-nanopi-r5: Disable SPL_DM_WARN Kconfig option

With the commit 6afdb1585112 ("dm: core: migrate debug() messages to use
dm_warn") use of DM_WARN/SPL_DM_WARN print a lot of debug messages.

Disable the SPL_DM_WARN Kconfig option to remove verbose logging and
restore normal serial console output during boot.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoboard: rockchip: Add Radxa ROCK 5 ITX
Heiko Stuebner [Fri, 2 Aug 2024 21:00:28 +0000 (23:00 +0200)]
board: rockchip: Add Radxa ROCK 5 ITX

The Rock 5 ITX is a board in ITX form factor using the RK3588 SoC

It can be powered either by 12V, ATX power-supply or PoE.

Notable peripherals are the 4 SATA ports, M.2 M-Key slot, M.2 E-key slot,
2*2.5Gb PCIe-connected Ethernet NICs.

Display options are 2*HDMI, DP via USB-c, eDP + 2*DSI via PCB connectors.

USB ports are 4*USB3 + 2*USB2 on the back panel and 2-port front-panel
connector.

Schematics for the board can be found on
- https://dl.radxa.com/rock5/5itx/radxa_rock_5_itx_X1100_schematic.pdf
- https://dl.radxa.com/rock5/5itx/v1110/radxa_rock_5itx_v1110_schematic.pdf

The naming scheme with the dashes follows Dragan's comment on the mainline
devicetree commit:
    "the name of this board deviates from the standard Radxa naming scheme,
     which is something like "ROCK <number><letter>" thus, "rock-5a" is
     fine, but it should be "rock-5-itx", simply because there's a space
     between "5" and "ITX" in "ROCK 5 ITX"

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 months agousb: dwc3: support USB 3.1 controllers
Caleb Connolly [Tue, 23 Apr 2024 14:15:06 +0000 (16:15 +0200)]
usb: dwc3: support USB 3.1 controllers

The revision is different for these, add the additional check as in
xhci-dwc3 core_init code.

Equivalent upstream Linux patch:
690fb3718a70 ("usb: dwc3: Support Synopsys USB 3.1 IP")

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Marek Vasut <marex@denx.de>
4 months agoMakefile: don't use CFLAGS for environment text file
Heinrich Schuchardt [Fri, 2 Aug 2024 13:50:23 +0000 (15:50 +0200)]
Makefile: don't use CFLAGS for environment text file

We use KCPPFLAGS to let the user set flags when invoking the C precompiler.
These should also be used when generating the environment text file.

Reported-by: Dave Jones <dave.jones@canonical.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 months agoconfigs: enable efidebug and EFI http boot on QEMU aarch64
Ilias Apalodimas [Wed, 7 Aug 2024 13:00:09 +0000 (16:00 +0300)]
configs: enable efidebug and EFI http boot on QEMU aarch64

EFI HTTP is a useful option to have by default and is working reliably on
QEMU. Let's enable it by default, since we have no size limitations.
While at it enable 'efidebug' as well, which is currently needed to
configure the EFI HTTP boot options.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 months agoboot: set correct block device name in set_efi_bootdev()
Heinrich Schuchardt [Wed, 7 Aug 2024 00:13:45 +0000 (02:13 +0200)]
boot: set correct block device name in set_efi_bootdev()

For SATA devices the class name is 'ahci' but the block device name is
'sata'.

Use function blk_get_uclass_name() to retrieve the correct string.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 months agoefi_loader: correct description of efi_get_distro_fdt_name
Heinrich Schuchardt [Tue, 6 Aug 2024 22:11:38 +0000 (00:11 +0200)]
efi_loader: correct description of efi_get_distro_fdt_name

Use the correct function name.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
4 months agoefi_loader: use list_count_nodes() in efi_protocols_per_handle()
Heinrich Schuchardt [Wed, 31 Jul 2024 08:13:04 +0000 (10:13 +0200)]
efi_loader: use list_count_nodes() in efi_protocols_per_handle()

Simplify the code by using the list_count_nodes() function.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
4 months agoubifs: Call ubifs_iput when ubifs_iget is used
Michael Trimarchi [Sat, 10 Aug 2024 12:57:44 +0000 (14:57 +0200)]
ubifs: Call ubifs_iput when ubifs_iget is used

The inode should be freed after a reference is get to avoid
memory leak

Tested-by: Alexander Dahl <ada@thorsis.com>
Link: https://lore.kernel.org/u-boot/b698ec3e-d857-6512-8cc9-4edcab0a41b9@denx.de/T/#t
Link: https://lore.kernel.org/all/8f3a7059-6330-f332-8e9f-729b853e001e@denx.de/T/
Co-developed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
4 months agoubifs: mount fails after power cycle
Ravi Minnikanti [Tue, 30 Jul 2024 09:14:57 +0000 (02:14 -0700)]
ubifs: mount fails after power cycle

When kernel uses file system encryption, fscrypt on UBIFS v5,
after a hard power cycle UBIFS journal replay fails which results in mount failure.

Failure logs:
UBIFS: recovery needed
UBIFS error (pid 0): ubifs_validate_entry: bad directory entry node
UBIFS error (pid 0): replay_bud: bad node is at LEB 890:24576
UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'ubi0:rootfs' errno=-22!

This change is ported from kernel:
commit id: 304790c038bc4af4f19774705409db27eafb09fc

Kernel commit description:
    Kernel commit description:
    ubifs: Relax checks in ubifs_validate_entry()

    With encrypted filenames we store raw binary data, doing
    string tests is no longer possible.

Signed-off-by: rminnikanti <rminnikanti@marvell.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 months agofs: ubifs: Add volume mounted check
Alexander Dahl [Wed, 3 Jul 2024 10:12:58 +0000 (12:12 +0200)]
fs: ubifs: Add volume mounted check

Safety guard in the U-Boot filesystem glue code, because these functions
are called from different parts of the codebase.  For generic filesystem
handling this should have been checked in blk_get_device_part_str()
already.  Commands from cmd/ubifs.c should also check this before
calling those functions, but you never know?!

Signed-off-by: Alexander Dahl <ada@thorsis.com>
4 months agofs: ubifs: Make k(z)alloc/kfree symmetric
Alexander Dahl [Wed, 3 Jul 2024 10:12:57 +0000 (12:12 +0200)]
fs: ubifs: Make k(z)alloc/kfree symmetric

Although kfree() is in fact only a slim wrapper to free() in U-Boot, use
kfree() here, because those structs where allocated with kalloc() or
kzalloc().

Signed-off-by: Alexander Dahl <ada@thorsis.com>
4 months agofs: ubifs: Set pointers to NULL after free
Alexander Dahl [Wed, 3 Jul 2024 10:12:56 +0000 (12:12 +0200)]
fs: ubifs: Set pointers to NULL after free

Global superblock pointer 'ubifs_sb' and volume pointer 'ubi' of type
struct ubi_volume_desc in private member sb->s_fs_info of type struct
ubifs_info, can be allocated and freed at runtime, and allocated and
freed again, depending which console or script commands are run.  In
some cases ubifs_sb is even tested to determine if the filesystem is
mounted.  Reset those pointers to NULL after free to clearly mark them
as not valid.  This avoids potential double free on invalid pointers.

(The ubifs_sb pointer was already reset, but that statement was moved
now to directly after the free() to make it easier to understand.)

Signed-off-by: Alexander Dahl <ada@thorsis.com>
4 months agofs: ubifs: Fix memleak and double free in u-boot wrapper functions
Alexander Dahl [Wed, 3 Jul 2024 10:12:55 +0000 (12:12 +0200)]
fs: ubifs: Fix memleak and double free in u-boot wrapper functions

When mounting ubifs e.g. through command 'ubifsmount' one global static
superblock 'ubifs_sb' is used _and_ the requested volume is opened (like
in Linux).  The pointer returned by 'ubifs_open_volume()' is stored in
that superblock struct and freed later on cmd 'ubifsumount' or another
call to 'ubifsmount' with a different volume, through ubifs_umount() and
ubi_close_volume().

In ubifs_ls(), ubifs_exists(), ubifs_size(), and ubifs_read() the volume
was opened again, which is technically no problem with regard to
refcounting, but here the still valid pointer in sb was overwritten,
leading to a memory leak.  Even worse, when using one of those
functions and calling ubifsumount later, ubi_close_volume() was called
again but now on an already freed pointer, leading to a double free.
This actually crashed with different invalid memory accesses on a board
using the old distro boot and a rather long script handling RAUC
updates.

Example:

    > ubi part UBI
    > ubifsmount ubi0:boot
    > test -e ubi ubi0:boot /boot.scr.uimg
    > ubifsumount

The ubifs specific commands 'ubifsls' and 'ubifsload' check for a
mounted volume by themselves, for the generic fs variants 'ls', 'load',
(and 'size', and 'test -e') this is covered by special ubifs handling in
fs_set_blk_dev() and deeper down blk_get_device_part_str() then.  So for
ubifs_ls(), ubifs_exists(), ubifs_size(), and ubifs_read() we can be
sure the volume is opened and the necessary struct pointer in sb is
valid, so it is not needed to open volume again.

Fixes: 9eefe2a2b37 ("UBIFS: Implement read-only UBIFS support in U-Boot")
Fixes: 29cc5bcadfc ("ubifs: Add functions for generic fs use")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
4 months agoMerge tag 'tpm-master-09082024' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Fri, 9 Aug 2024 20:00:04 +0000 (14:00 -0600)]
Merge tag 'tpm-master-09082024' of https://source.denx.de/u-boot/custodians/u-boot-tpm.git

Back when the TPM subsystem was refactored tpm_tis_wait_init() ended up
being called after tpm_tis_init() which initializes values the former needs.

Since we added more TPM chipsets since then sitting on an i2c bus, this patch
folds in tpm_tis_wait_init into tpm_tis_init and makes sure it's called in the
right order regardless of the bus the TPM sits on.

4 months agoMerge tag 'i2cfixes-v2-for-v2024-10-rc3' of https://source.denx.de/u-boot/custodians...
Tom Rini [Fri, 9 Aug 2024 14:22:32 +0000 (08:22 -0600)]
Merge tag 'i2cfixes-v2-for-v2024-10-rc3' of https://source.denx.de/u-boot/custodians/u-boot-i2c

i2c updates for v2024.10-rc3 (second try)

- i2c: samsung: Support platforms other than EXYNOS4 and EXYNOS5
  from David

- imx_lpi2c: cleanups and support read transfers longer than 256 bytes
  from Fedor

- pca954x: Remove pointer to GD
  from Michal

- i2c: mux: Fix error path in i2c-arb-gpio
  from Michal

4 months agoi2c: imx_lpi2c: Support read transfers longer than 256 bytes
Fedor Ross [Wed, 7 Aug 2024 14:08:01 +0000 (16:08 +0200)]
i2c: imx_lpi2c: Support read transfers longer than 256 bytes

The TXFIFO register of LPI2C only has one byte length, and if the length
of the data that needs to be read exceeds 256 bytes, it needs to be
written to TXFIFO multiple times.

Signed-off-by: Fedor Ross <fedor.ross@ifm.com>
4 months agoi2c: imx_lpi2c: Replace hard-coded bus speed value with bus->speed_hz
Fedor Ross [Wed, 7 Aug 2024 14:08:00 +0000 (16:08 +0200)]
i2c: imx_lpi2c: Replace hard-coded bus speed value with bus->speed_hz

Instead of using the hard-coded bus speed value I2C_SPEED_STANDARD_RATE,
use the actual configured bus speed. This way the bus speed doesn't
change suddenly after calling the imx_lpi2c_probe_chip() function for
example.

Signed-off-by: Fedor Ross <fedor.ross@ifm.com>
4 months agoi2c: imx_lpi2c: Fix a typo in bus_i2c_receive
Fedor Ross [Wed, 7 Aug 2024 14:07:59 +0000 (16:07 +0200)]
i2c: imx_lpi2c: Fix a typo in bus_i2c_receive

Fix a typo in a debug message. It should be 'for' not 'fot' .

Signed-off-by: Fedor Ross <fedor.ross@ifm.com>
4 months agoi2c: samsung: Support platforms other than EXYNOS4 and EXYNOS5
David Virag [Fri, 2 Aug 2024 19:19:16 +0000 (21:19 +0200)]
i2c: samsung: Support platforms other than EXYNOS4 and EXYNOS5

Newer Samsung SoCs (including newer Exynos, ExynosAuto, Google Tensor)
still use these IPs, or slightly newer versions of it.

Make these drivers available on these platforms by guarding
EXYNOS4/EXYNOS5 specific code behind their configs, and using CCF for
clocks on other platforms.

Tested S3C I2C driver on Exynos7885.
This along with extended clock driver should enable S3C I2C on
Exynos850.

Signed-off-by: David Virag <virag.david003@gmail.com>
Tested-by: Henrik Grimler <henrik@grimler.se>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 months agoi2c: samsung: Drop s3c24x0 specific code.
David Virag [Fri, 2 Aug 2024 19:19:15 +0000 (21:19 +0200)]
i2c: samsung: Drop s3c24x0 specific code.

This has been dead code for many years now. Remove it.

Signed-off-by: David Virag <virag.david003@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 months agoi2c: mux: Fix error path in i2c-arb-gpio
Michal Simek [Thu, 1 Aug 2024 08:01:30 +0000 (10:01 +0200)]
i2c: mux: Fix error path in i2c-arb-gpio

There is no reason to use goto and just call return. Better is to call
return directly which is done for some if/else parts.

Also make no sense to setup ret to -ETIMEDOUT and then to 0.
Return timeout directly.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 months agoi2c: pca954x: Remove pointer to GD
Michal Simek [Thu, 1 Aug 2024 07:41:25 +0000 (09:41 +0200)]
i2c: pca954x: Remove pointer to GD

There is no reason to have any pointer to GD that's why remove it.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 months agoarm64: dts: rockchip: add ROCK 5 ITX board
Heiko Stuebner [Fri, 2 Aug 2024 21:00:27 +0000 (23:00 +0200)]
arm64: dts: rockchip: add ROCK 5 ITX board

The ROCK 5 ITX as the name suggests is made in the ITX form factor and
actually built in a form to be used in a regular case even providing
connectors for regular front-panel io.

It can be powered either by 12V, ATX power-supply or PoE.

Notable peripherals are the 4 SATA ports, M.2 M-Key slot, M.2 E-key slot,
2*2.5Gb PCIe-connected Ethernet NICs.

As of yet unsupported display options consist of 2*HDMI, DP via USB-c,
eDP + 2*DSI via PCB connectors.

USB ports are 4*USB3 + 2*USB2 on the back panel and 2-port front-panel
connector.

Schematics for the board can be found on
- https://dl.radxa.com/rock5/5itx/radxa_rock_5_itx_X1100_schematic.pdf
- https://dl.radxa.com/rock5/5itx/v1110/radxa_rock_5itx_v1110_schematic.pdf

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240704153815.837392-3-heiko@sntech.de
[ upstream commit: 31390eb8ffbf2b6be7d789708ec08b635d7a3eb8 ]

(cherry picked from commit 9cff9fef0a295e3b8feb7bc4116a297a842cad01)
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoarm64: dts: rockchip: add thermal zones information on RK3588
Alexey Charkov [Fri, 2 Aug 2024 21:00:26 +0000 (23:00 +0200)]
arm64: dts: rockchip: add thermal zones information on RK3588

This includes the necessary device tree data to allow thermal
monitoring on RK3588(s) using the on-chip TSADC device, along with
trip points for automatic thermal management.

Each of the CPU clusters (one for the little cores and two for
the big cores) get a passive cooling trip point at 85C, which
will trigger DVFS throttling of the respective cluster upon
reaching a high temperature condition.

All zones also have a critical trip point at 115C, which will
trigger a reset.

Signed-off-by: Alexey Charkov <alchark@gmail.com>
Link: https://lore.kernel.org/r/20240617-rk-dts-additions-v5-1-c1f5f3267f1e@gmail.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[ upstream commit: 510cd9e688453166b2bff3999ed21cac97385bb5 ]

(cherry picked from commit 33e7079543d5eee1415b937054e8634000d1bde4)
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoarm64: dts: rockchip: Prepare RK3588 SoC dtsi files for per-variant OPPs
Dragan Simic [Fri, 2 Aug 2024 21:00:25 +0000 (23:00 +0200)]
arm64: dts: rockchip: Prepare RK3588 SoC dtsi files for per-variant OPPs

Rename the Rockchip RK3588 SoC dtsi files and, consequently, adjust their
contents appropriately, to prepare them for the ability to specify different
CPU and GPU OPPs for each of the supported RK3588 SoC variants.

As already discussed, [1][2][3][4] some of the RK3588 SoC variants require
different OPPs, and it makes more sense to have the OPPs already defined when
a board dts(i) file includes one of the SoC variant dtsi files (rk3588.dtsi,
rk3588j.dtsi or rk3588s.dtsi), rather than requiring the board dts(i) file
to also include a separate rk3588*-opp.dtsi file.  The choice of the SoC
variant is already made by the inclusion of the SoC dtsi file into the board
dts(i) file, and it doesn't make much sense to, effectively, allow the board
dts(i) file to include and use an incompatible set of OPPs for the already
selected RK3588 SoC variant.

The new naming scheme for the RK3588 SoC dtsi files uses "-base" and "-extra"
suffixes to denote the DT data shared between all RK5588 SoC variants, and
the DT data shared between the unrestricted SoC variants, respectively.
For example, the DT data for the RK3588 includes both rk3588-base.dtsi and
rk3588-extra.dtsi, because it's an unrestricted SoC variant, while the DT
data for the RK3588S variant includes rk3588-base.dtsi only, because it's
a restricted SoC variant, feature- and interface-wise.  This achieves a more
logical naming of the RK3588 SoC dtsi files, which reflects the way DT data
for the SoC variants is built by "stacking" the SoC variant features made
available through the "-base" and "-extra" SoC dtsi files.  Additionally,
the SoC variant dtsi files (rk3588.dtsi, rk3588j.dtsi and rk3588s.dtsi) are
no longer parents to any other SoC variant dtsi files, which should help with
making the new "stacking" approach cleaner and easier to follow.

The RK3588 pinctrl dtsi files are also renamed in the same way, for the sake
of consistency.  This also keeps the "-base" and "-extra" groups of the dtsi
files together when looked at in a directory listing, which is helpful.

The per-SoC-variant OPPs should go directly into the SoC dtsi files, if no
more than one SoC variant uses those OPPs, or be put into a separate "-opp"
dtsi file that's shared between and included from two or more SoC variant
dtsi files.  An example for the former is the non-shared OPP data that should
go directly into the RK3588J SoC variant dtsi file (i.e. rk3588j.dtsi), and
an example for the latter is the shared OPP data that should be put into
rk3588-opp.dtsi and be included from the RK3588 and RK3588S SoC variant dtsi
files (i.e. rk3588.dtsi and rk3588s.dtsi, respectively).  Consequently, if
the OPPs for the RK3588 and RK3588S SoC variants are ever made different,
the shared rk3588-opp.dtsi file should be deleted and the new OPPs should
be put directly into rk3588.dtsi and rk3588s.dtsi. [4]

No functional changes are introduced, which was validated by decompiling and
comparing all affected dtb files before and after these changes.

As a side note, due to the nature of introduced changes, this commit is best
viewed using the --break-rewrites option for git-log(1).

[1] https://lore.kernel.org/linux-rockchip/646a33e0-5c1b-471c-8183-2c0df40ea51a@cherry.de/
[2] https://lore.kernel.org/linux-rockchip/CABjd4Yxi=+3gkNnH3BysUzzYsji-=-yROtzEc8jM_g0roKB0-w@mail.gmail.com/
[3] https://lore.kernel.org/linux-rockchip/035a274be262528012173d463e25b55f@manjaro.org/
[4] https://lore.kernel.org/linux-rockchip/673dcf47596e7bc8ba065034e339bb1bbf9cdcb0.1716948159.git.dsimic@manjaro.org/T/#u

Signed-off-by: Dragan Simic <dsimic@manjaro.org>
Link: https://lore.kernel.org/r/9ffedc0e2ca7f167d9d795b2a8f43cb9f56a653b.1717923308.git.dsimic@manjaro.org
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[ upstream commit: def88eb4d8365a4aa064d28405d03550a9d0a3be ]

(cherry picked from commit bf8f631f62026a6b844d34c7e0549e4ec3fd4716)
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoarm: dts: rockchip: disable "usb_host0_ohci" to make boot faster for Radxa ROCK 3A
FUKAUMI Naoki [Fri, 2 Aug 2024 02:49:49 +0000 (11:49 +0900)]
arm: dts: rockchip: disable "usb_host0_ohci" to make boot faster for Radxa ROCK 3A

on-board USB 2.0 hub, FE1.1s, has Transaction Translator which can
handle USB 1.x devices via "usb_host0_ehci". so we can omit
"usb_host0_ohci" and make boot faster (a little).

=> usb start
starting USB...
Bus usb@fd000000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@fd800000: USB EHCI 1.00
Bus usb@fd880000: USB EHCI 1.00
Bus usb@fd8c0000: USB OHCI 1.0
scanning bus usb@fd000000 for devices... 1 USB Device(s) found
scanning bus usb@fd800000 for devices... 2 USB Device(s) found
scanning bus usb@fd880000 for devices... 1 USB Device(s) found
scanning bus usb@fd8c0000 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
=> usb tree
USB device tree:
  1  Hub (5 Gb/s, 0mA)
     U-Boot XHCI Host Controller

  1  Hub (480 Mb/s, 0mA)
  |  u-boot EHCI Host Controller
  |
  +-2  Hub (480 Mb/s, 100mA)
        USB 2.0 Hub

  1  Hub (480 Mb/s, 0mA)
     u-boot EHCI Host Controller

  1  Hub (12 Mb/s, 0mA)
  |   U-Boot Root Hub
  |
  +-2  Hub (12 Mb/s, 100mA)
    |  ALCOR Generic USB Hub
    |
    +-3  Mass Storage (12 Mb/s, 300mA)
         JetFlash Mass Storage Device 02K1RNH5MJFV4TX6

=> usb reset
resetting USB...
Host not halted after 16000 microseconds.
Bus usb@fd000000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@fd800000: USB EHCI 1.00
Bus usb@fd880000: USB EHCI 1.00
Bus usb@fd8c0000: USB OHCI 1.0
scanning bus usb@fd000000 for devices... 1 USB Device(s) found
scanning bus usb@fd800000 for devices... 4 USB Device(s) found
scanning bus usb@fd880000 for devices... 1 USB Device(s) found
scanning bus usb@fd8c0000 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
=> usb tree
USB device tree:
  1  Hub (5 Gb/s, 0mA)
     U-Boot XHCI Host Controller

  1  Hub (480 Mb/s, 0mA)
  |  u-boot EHCI Host Controller
  |
  +-2  Hub (480 Mb/s, 100mA)
    |   USB 2.0 Hub
    |
    +-3  Hub (12 Mb/s, 100mA)
      |  ALCOR Generic USB Hub
      |
      +-4  Mass Storage (12 Mb/s, 300mA)
           JetFlash Mass Storage Device 02K1RNH5MJFV4TX6

  1  Hub (480 Mb/s, 0mA)
     u-boot EHCI Host Controller

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

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoboard: rockchip: Add FriendlyElec CM3588 NAS
Jonas Karlman [Wed, 31 Jul 2024 21:12:16 +0000 (21:12 +0000)]
board: rockchip: Add FriendlyElec CM3588 NAS

The CM3588 NAS by FriendlyElec pairs the CM3588 compute module, based
on the Rockchip RK3588 SoC, with the CM3588 NAS Kit carrier board.

Features tested on a CM3588 NAS Kit with 8GB RAM 64GB eMMC module:
- SD-card boot
- eMMC boot
- Ethernet
- PCIe/NVMe
- USB gadget
- USB host

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoarm64: dts: rockchip: Add FriendlyElec CM3588 NAS board
Sebastian Kropatsch [Wed, 31 Jul 2024 21:12:15 +0000 (21:12 +0000)]
arm64: dts: rockchip: Add FriendlyElec CM3588 NAS board

The CM3588 NAS by FriendlyElec pairs the CM3588 compute module, based on
the Rockchip RK3588 SoC, with the CM3588 NAS Kit carrier board.
To reflect the hardware setup, add device tree sources for the SoM and
the NAS daughter board as separate files.

Hardware features:
    - Rockchip RK3588 SoC
    - 4GB/8GB/16GB LPDDR4x RAM
    - 64GB eMMC
    - MicroSD card slot
    - 1x RTL8125B 2.5G Ethernet
    - 4x M.2 M-Key with PCIe 3.0 x1 (via bifurcation) for NVMe SSDs
    - 2x USB 3.0 (USB 3.1 Gen1) Type-A, 1x USB 2.0 Type-A
    - 1x USB 3.0 Type-C with DP AltMode support
    - 2x HDMI 2.1 out, 1x HDMI in
    - MIPI-CSI Connector, MIPI-DSI Connector
    - 40-pin GPIO header
    - 4 buttons: power, reset, recovery, MASK, user button
    - 3.5mm Headphone out, 2.0mm PH-2A Mic in
    - 5V Fan connector, PWM beeper, IR receiver, RTC battery connector

PCIe bifurcation is used to handle all four M.2 sockets at PCIe 3.0 x1
speed. Data lane mapping in the DT is done like described in commit
f8020dfb311d ("phy: rockchip-snps-pcie3: fix bifurcation on rk3588").

This device tree includes support for eMMC, SD card, ethernet, all USB2
and USB3 ports, all four M.2 slots, GPU, beeper, IR, RTC, UART debugging
as well as the buttons and LEDs.
The GPIOs are labeled according to the schematics.

Reviewed-by: Space Meyer <git@the-space.agency>
Signed-off-by: Sebastian Kropatsch <seb-dev@mail.de>
Link: https://lore.kernel.org/r/20240616215354.40999-3-seb-dev@mail.de
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[ upstream commit: e23819cf273c110662fdc392dcb55a75b3888609 ]

(cherry picked from commit c1a8bf31d96d890dd8328ae452fe62971ac555c2)
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoboard: rockchip: Add Xunlong Orange Pi 3B
Ricardo Pardini [Wed, 31 Jul 2024 09:03:31 +0000 (09:03 +0000)]
board: rockchip: Add Xunlong Orange Pi 3B

The Xunlong Orange Pi 3B is a single-board computer based on the
Rockchip RK3566 SoC.

The two hw revisions use different io-voltage for Ethernet PHY and can
be identified using GPIO4_C4:
- v1.1.1: x (internal pull-down)
- v2.1:   PHY_RESET (external pull-up)

Implement rk_board_late_init() to set correct fdtfile env var and
board_fit_config_name_match() to load correct FIT config based on what
board is detected at runtime so a single board target can be used for
both hw revisions.

Minimal DTs that includ DT from dts/upstream is added to support booting
from both hw revision and only set Ethernet PHY io-voltage when the hw
revision is detected at runtime. A side-affect of this is that defconfig
show OF_UPSTREAM=n, however dts/upstream DTs is used for this board.

Features tested on Orange Pi 3B 4GB (v1.1.1 and v2.1):
- SD-card boot
- eMMC boot
- SPI Flash boot
- Ethernet
- PCIe/NVMe
- USB host

Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
Co-developed-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoarm64: dts: rockchip: Add Xunlong Orange Pi 3B
Jonas Karlman [Wed, 31 Jul 2024 09:03:30 +0000 (09:03 +0000)]
arm64: dts: rockchip: Add Xunlong Orange Pi 3B

The Xunlong Orange Pi 3B is a single-board computer based on the
Rockchip RK3566 SoC.

Add initial support for eMMC, SD-card, Ethernet, HDMI, PCIe and USB.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Link: https://lore.kernel.org/r/20240626230319.1425316-3-jonas@kwiboo.se
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[ upstream commit: d79d713d602e8b32cf935ddfdf61769cb74ba1dc ]

(cherry picked from commit 9defe71f2674f82c27a8d4593d8c5851ab5d51e7)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoboard: rockchip: Add Radxa ZERO 3W/3E
Jonas Karlman [Fri, 2 Aug 2024 22:12:23 +0000 (22:12 +0000)]
board: rockchip: Add Radxa ZERO 3W/3E

The Radxa ZERO 3W/3E is an ultra-small, high-performance single board
computer based on the Rockchip RK3566, with a compact form factor and
rich interfaces.

Implement rk_board_late_init() to set correct fdtfile env var and
board_fit_config_name_match() to load correct FIT config based on what
board is detected at runtime so a single board target can be used for
both board models.

Features tested on a ZERO 3W 8GB v1.11:
- SD-card boot
- eMMC boot
- USB gadget
- USB host

Features tested on a ZERO 3E 4GB v1.2:
- SD-card boot
- Ethernet
- USB gadget
- USB host

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Tested-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agodm: adc: Add SPL_ADC Kconfig symbol for use of ADC in SPL
Jonas Karlman [Fri, 2 Aug 2024 22:12:22 +0000 (22:12 +0000)]
dm: adc: Add SPL_ADC Kconfig symbol for use of ADC in SPL

What model of Radxa ZERO 3W/3E board can be identified using ADC at
runtime, add a Kconfig symbol to allow use of ADC in SPL.

This will be used to identify board model in SPL to allow loading
correct FIT configuration and FDT for U-Boot proper at SPL phase.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoarm64: dts: rockchip: add gpio-line-names to radxa-zero-3
Trevor Woerner [Fri, 2 Aug 2024 22:12:21 +0000 (22:12 +0000)]
arm64: dts: rockchip: add gpio-line-names to radxa-zero-3

Add names to the pins of the general-purpose expansion header as given
in the Radxa documentation[1] following the conventions in the kernel[2]
to make it easier for users to correlate pins with functions when using
utilities such as 'gpioinfo'.

[1] https://docs.radxa.com/en/zero/zero3/hardware-design/hardware-interface
[2] https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio.txt

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
Link: https://lore.kernel.org/r/20240620013301.33653-1-twoerner@gmail.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[ upstream commit: f7c742cbe664ebdedc075945e75443683d1175f7 ]

(cherry picked from commit 8b26cf42ba0c74a9c86cebe591a9195f75151d97)
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoarm64: dts: rockchip: fix mmc aliases for Radxa ZERO 3E/3W
FUKAUMI Naoki [Fri, 2 Aug 2024 22:12:20 +0000 (22:12 +0000)]
arm64: dts: rockchip: fix mmc aliases for Radxa ZERO 3E/3W

align with other Radxa products.

- mmc0 is eMMC
- mmc1 is microSD

for ZERO 3E, there is no eMMC, but aliases should start at 0, so mmc0
is microSD as exception.

Fixes: 1a5c8d307c83 ("arm64: dts: rockchip: Add Radxa ZERO 3W/3E")
Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Changes in v3:
- fix syntax error in rk3566-radxa-zero-3e.dts
Changes in v2:
- microSD is mmc0 instead of mmc1 for ZERO 3E

Link: https://lore.kernel.org/r/20240620224435.2752-1-naoki@radxa.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[ upstream commit: 060c1950037e4c54ca4d8186a8f46269e35db901 ]

(cherry picked from commit 8324bc7493e4088013c62bc41f49d6d181575493)
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoarm64: dts: rockchip: Add Radxa ZERO 3W/3E
Jonas Karlman [Fri, 2 Aug 2024 22:12:19 +0000 (22:12 +0000)]
arm64: dts: rockchip: Add Radxa ZERO 3W/3E

The Radxa ZERO 3W/3E is an ultra-small, high-performance single board
computer based on the Rockchip RK3566, with a compact form factor and
rich interfaces.

The ZERO 3W and ZERO 3E are basically the same size and model, but
differ only in storage and network interfaces.

- eMMC (3W)
- SD-card (both)
- Ethernet (3E)
- WiFi/BT (3W)

Add initial support for eMMC, SD-card, Ethernet, HDMI and USB.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Link: https://lore.kernel.org/r/20240521202810.1225636-3-jonas@kwiboo.se
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[ upstream commit: 1a5c8d307c83c808a32686ed51afb4bac2092d39 ]

(cherry picked from commit 1476c5882f8a47b6f0f895c6424dacf6334487ae)
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoboard: rockchip: Add Radxa ROCK 3B
Jonas Karlman [Wed, 31 Jul 2024 07:28:54 +0000 (07:28 +0000)]
board: rockchip: Add Radxa ROCK 3B

The Radxa ROCK 3B is a single-board computer based on the Pico-ITX form
factor (100mm x 75mm). Two versions of the ROCK 3B exists, a community
version based on the RK3568 SoC and an industrial version based on the
RK3568J SoC.

Features tested on ROCK 3B 8GB v1.51 (both variants):
- SD-card boot
- eMMC boot
- SPI Flash boot
- Ethernet
- PCIe/NVMe
- USB gadget
- USB host

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Tested-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoarm64: dts: rockchip: Add Radxa ROCK 3B
Jonas Karlman [Wed, 31 Jul 2024 07:28:53 +0000 (07:28 +0000)]
arm64: dts: rockchip: Add Radxa ROCK 3B

The Radxa ROCK 3B is a single-board computer based on the Pico-ITX form
factor (100mm x 75mm). Two versions of the ROCK 3B exists, a community
version based on the RK3568 SoC and an industrial version based on the
RK3568J SoC.

Add initial support for eMMC, SD-card, Ethernet, HDMI, PCIe and USB.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Link: https://lore.kernel.org/r/20240627211737.1985549-3-jonas@kwiboo.se
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[ upstream commit: 846ef7748fa9124c8eea76e2d5e833fa69b3ef7c ]

(cherry picked from commit 5416329b387d3c13392f84ba35273a402c7010f8)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoboard: rockchip: add Radxa ROCK 3 Model C
Maxim Moskalets [Thu, 8 Aug 2024 19:37:10 +0000 (22:37 +0300)]
board: rockchip: add Radxa ROCK 3 Model C

Based on rock-3a-rk3568_defconfig.
Tested on v1.31 revision.

Board Specifications:
- Rockchip RK3566
- 1/2/4GB LPDDR4 2112MT/s
- eMMC socket
- uSD card slot
- M.2 2230 Connector
- GbE LAN with POE
- 3.5mm jack with mic
- HDMI 2.0, MIPI DSI/CSI
- USB 3.0 Host, USB 2.0 Host/OTG
- 40-pin GPIO expansion ports

Signed-off-by: Maxim Moskalets <maximmosk4@gmail.com>
Suggested-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Tested-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoboard: rockchip: Add Radxa ROCK S0
Jonas Karlman [Tue, 30 Jul 2024 19:48:37 +0000 (19:48 +0000)]
board: rockchip: Add Radxa ROCK S0

Radxa ROCK S0 is a single-board computer based on the Rockchip RK3308B
SoC in an ultra-compact form factor. Add a board target for the board.

Features tested on a ROCK S0 v1.2 with 512 MiB RAM and 8 GiB eMMC:
- SD-card boot
- eMMC boot
- Ethernet
- USB gadget
- USB host

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agoarm64: dts: rockchip: Add Radxa ROCK S0
Jonas Karlman [Tue, 30 Jul 2024 19:48:36 +0000 (19:48 +0000)]
arm64: dts: rockchip: Add Radxa ROCK S0

Radxa ROCK S0 is a single-board computer based on the Rockchip RK3308B
SoC in an ultra-compact form factor.

Add initial support for eMMC, SD-card, Ethernet, WiFi/BT and USB.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Link: https://lore.kernel.org/r/20240521212247.1240226-3-jonas@kwiboo.se
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[ upstream commit: adeb5d2a4ba47910238b3c4f5fd960cc0c26a98b ]

(cherry picked from commit e291d457b0378f2cb3d3ebb597032ca862cdb973)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agorockchip: rk3308-rock-pi-s: Enable LED and IO Domain driver
Jonas Karlman [Tue, 30 Jul 2024 14:51:48 +0000 (14:51 +0000)]
rockchip: rk3308-rock-pi-s: Enable LED and IO Domain driver

Add LED=y and LED_GPIO=y to support the onboard leds.

Add ROCKCHIP_IODOMAIN=y to configure correct io voltage domains.

Add DM_MDIO=y now that the DT contain a Ethernet phy node.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 months agorockchip: rk3308-rock-pi-s: Remove unnecessary u-boot dtsi overrides
Jonas Karlman [Tue, 30 Jul 2024 14:51:47 +0000 (14:51 +0000)]
rockchip: rk3308-rock-pi-s: Remove unnecessary u-boot dtsi overrides

With the emmc and uart0 DT nodes updated to v6.11-rc1 in dts/upstream
there is no longer any need to keep overrides in board u-boot dtsi.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>