]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
4 years agoboard: stm32mp1: no MTD partitions fixup for serial boot
Patrick Delaunay [Thu, 15 Oct 2020 12:52:30 +0000 (14:52 +0200)]
board: stm32mp1: no MTD partitions fixup for serial boot

Remove the update of the MTD partitions in kernel device tree
for serial boot (USB / UART), and the kernel will use the MTD
partitions define in the loaded DTB because U-Boot can't known the
expected flash layout in this case.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoSPL: stm32mp1: fix spl_mmc_boot_partition not defined
Richard Genoud [Mon, 12 Oct 2020 14:11:09 +0000 (16:11 +0200)]
SPL: stm32mp1: fix spl_mmc_boot_partition not defined

spl_mmc_boot_partition is only defined when
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is defined.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: dts: stm32: Drop QSPI CS2 on DHCOM
Marek Vasut [Wed, 28 Oct 2020 20:37:59 +0000 (21:37 +0100)]
ARM: dts: stm32: Drop QSPI CS2 on DHCOM

The QSPI CS2 is not used on DHCOM, remove the pinmux and flash@1.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: dts: stm32: Fix uSD card-detect GPIO on DHCOM
Marek Vasut [Wed, 28 Oct 2020 20:38:21 +0000 (21:38 +0100)]
ARM: dts: stm32: Fix uSD card-detect GPIO on DHCOM

The uSD slot card-detect GPIO is connected to PG1, fix it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: dts: stm32: Add DHCOM based PicoITX board
Marek Vasut [Tue, 3 Nov 2020 18:14:58 +0000 (19:14 +0100)]
ARM: dts: stm32: Add DHCOM based PicoITX board

Add DT for DH PicoITX unit, which is a bare-bones carrier board for
the DHCOM. The board has ethernet port, USB, CAN, LEDs and a custom
board-to-board expansion connector.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoarm: stm32mp: correct the ALIGN macro usage
Patrick Delaunay [Wed, 4 Nov 2020 08:22:09 +0000 (09:22 +0100)]
arm: stm32mp: correct the ALIGN macro usage

Correct the ALIGN macro usage in mmu_set_region_dcache_behaviour
call: the address must use ALIGN_DOWN and size can use ALIGN macro.

With STM32_SYSRAM_BASE=0x2FFC0000 and MMU_SECTION_SIZE=0x100000 for
STM32MP15x the computed address was 30000000 instead of 2ff00000.

Fixes: 43fe9d2fda24 ("stm32mp1: mmu_set_region_dcache_behaviour")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: dts: stm32: Fix typo in stm32h7-u-boot.dtsi
Patrice Chotard [Fri, 6 Nov 2020 07:12:00 +0000 (08:12 +0100)]
ARM: dts: stm32: Fix typo in stm32h7-u-boot.dtsi

Fix typo "firsct"

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: dts: stm32: Fix timer initialization for stm32 MCU's board
Patrice Chotard [Fri, 6 Nov 2020 07:11:59 +0000 (08:11 +0100)]
ARM: dts: stm32: Fix timer initialization for stm32 MCU's board

Commit 4b2be78ab66c ("time: Fix get_ticks being non-monotonic")
puts in evidence that get_ticks is called before timer initialization.
Fix it by initializing timer before relocation.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: dts: stm32: DT sync with kernel v5.10-rc1 for MCU's boards
Patrice Chotard [Fri, 6 Nov 2020 07:11:58 +0000 (08:11 +0100)]
ARM: dts: stm32: DT sync with kernel v5.10-rc1 for MCU's boards

Device tree alignment with kernel v5.10-rc1.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: dts: sync armv7-m.dtsi with kernel v5.10-rc1
Patrice Chotard [Fri, 6 Nov 2020 07:11:57 +0000 (08:11 +0100)]
ARM: dts: sync armv7-m.dtsi with kernel v5.10-rc1

Since kernel v4.8-rc1, commit 05b23ebc2bd9 ("ARM: dts: armv7-m: remove skeleton.dtsi include"),
skeleton.dtsi file is no more included.

This synchronization is needed to avoid to get 2 memory node
in DTB file if, in DTS file, memory node is declared with the correct
syntax as following:

memory@90000000 {
  device_type = "memory";
  reg = <0x90000000 0x800000>;
  };

Then in DTB, we will have the 2 memory nodes, which is incorrect and
cause misbehavior during DT parsing by U-boot:

memory {
device_type = "memory";
reg = <0x00 0x00>;
};

memory@90000000 {
device_type = "memory";
reg = <0x90000000 0x800000>;
};

Issue found when synchronizing MCU's STM32 DT from kernel v5.10-rc1.
When using fdtdec_setup_mem_size_base() or fdtdec_setup_memory_banksize()
API, first above memory node is found (with reg = <0x00 0x00>), so
gd->ram_size, gd->ram_base, gd->bd->bi_dram[bank].start and
gd->bd->bi_dram[bank].size are all set to 0 which avoid boards to boot.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Sun, 22 Nov 2020 16:00:11 +0000 (11:00 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usb

- DWC2, DWC3 fixes

4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sun, 22 Nov 2020 15:59:49 +0000 (10:59 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-sh

- Assorted pinctrl updates

4 years agousb: gadget: dwc2_udc_otg: return zero when reset property is not present
Jaehoon Chung [Wed, 21 Oct 2020 12:28:41 +0000 (21:28 +0900)]
usb: gadget: dwc2_udc_otg: return zero when reset property is not present

If reset DT property is not present, -ENOENT is returned.
But it's not really error.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agousb: dwc3: Handle case where setup_phy is not needed
Siva Durga Prasad Paladugu [Wed, 21 Oct 2020 12:17:31 +0000 (14:17 +0200)]
usb: dwc3: Handle case where setup_phy is not needed

If CONFIG_PHY is not enabled then the dwc3_setup_phy()
returns ENOTSUPP which can be still valid and intentional
so modify error check to handle this -ENOTSUPP.

The same error handling exists in drivers/usb/host/xhci-dwc3.c already
added by commit d648a50c0a27 ("dwc3: move phy operation to core.c").

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agousb: dwc2: add "u-boot,force-vbus-detection" for stm32
Patrick Delaunay [Thu, 15 Oct 2020 12:49:37 +0000 (14:49 +0200)]
usb: dwc2: add "u-boot,force-vbus-detection" for stm32

On some board, the ID pin is not connected so the B session must be
overridden with "u-boot,force_b_session_valid" but the VBus sensing
must continue to be handle.

To managed it, this patch adds a new DT field
"u-boot,force-vbus-detection" to use with "u-boot,force_b_session_valid"

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agopinctrl: renesas: Drop unused members from struct sh_pfc_pinctrl
Lad Prabhakar [Wed, 4 Nov 2020 17:27:04 +0000 (17:27 +0000)]
pinctrl: renesas: Drop unused members from struct sh_pfc_pinctrl

Drop unused members from struct sh_pfc_pinctrl.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
4 years agopinctrl: renesas: r8a7795: Optimize pinctrl image size for R8A774E1
Biju Das [Wed, 28 Oct 2020 10:34:25 +0000 (10:34 +0000)]
pinctrl: renesas: r8a7795: Optimize pinctrl image size for R8A774E1

This driver supports both RZ/G2H and R-Car H3 SoCs.
Optimize pinctrl image size for RZ/G2H, when support for R-Car H3
(R8A7795) is not enabled

Based on the similar patch on Linux.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
4 years agopinctrl: renesas: r8a77965: Optimize pinctrl image size for R8A774B1
Biju Das [Wed, 28 Oct 2020 10:34:24 +0000 (10:34 +0000)]
pinctrl: renesas: r8a77965: Optimize pinctrl image size for R8A774B1

This driver supports both RZ/G2N and R-Car M3-N SoCs.
Optimize pinctrl image size for RZ/G2N, when support for R-Car M3-N
(R8A77965) is not enabled.

Based on the simialr patch on Linux.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
4 years agopinctrl: renesas: r8a7796: Optimize pinctrl image size for R8A774A1
Biju Das [Wed, 28 Oct 2020 10:34:23 +0000 (10:34 +0000)]
pinctrl: renesas: r8a7796: Optimize pinctrl image size for R8A774A1

This driver supports both RZ/G2M and R-Car M3-W/W+ SoCs.
Optimize pinctrl image size for RZ/G2M, when support for R-Car M3-W/W+
(R8A7796[01]) is not enabled.

Based on the similar patch on Linux.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
4 years agopinctrl: renesas: r8a77951: Add R8A774E1 PFC support
Biju Das [Wed, 28 Oct 2020 10:34:22 +0000 (10:34 +0000)]
pinctrl: renesas: r8a77951: Add R8A774E1 PFC support

Renesas RZ/G2H (r8a774e1) is pin compatible with R-Car H3 (r8a77951),
however it doesn't have several automotive specific peripherals. Add
a r8a77951 specific pin groups/functions along with common pin
groups/functions for supporting both r8a77951 and r8a774e1 SoC.

PFC changes are synced from mainline linux-5.9 commit
bbf5c979011a ("Linux 5.9").

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
4 years agopinctrl: renesas: r8a77965: Add R8A774B1 PFC support
Biju Das [Wed, 28 Oct 2020 10:34:21 +0000 (10:34 +0000)]
pinctrl: renesas: r8a77965: Add R8A774B1 PFC support

Renesas RZ/G2N (r8a774b1) is pin compatible with R-Car M3-N (r8a77965),
however it doesn't have several automotive specific peripherals. Add
a r8a77965 specific pin groups/functions along with common pin
groups/functions for supporting both r8a77965 and r8a774b1 SoC.

PFC changes are synced from mainline linux-5.9 commit
bbf5c979011a ("Linux 5.9").

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
4 years agoMerge tag 'efi-2021-01-rc3-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 21 Nov 2020 13:04:39 +0000 (08:04 -0500)]
Merge tag 'efi-2021-01-rc3-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-01-rc3 (2)

The parameter check for UEFI service GetNextVariableName() is corrected.

The dependencies of CONFIG_DFU_TFTP are simplified.

The set of supported hash algorithms reported by the EFI_TCG2_PROTOCOL is
corrected.

4 years agoefi_loader: parameter check in GetNextVariableName()
Heinrich Schuchardt [Thu, 19 Nov 2020 18:40:08 +0000 (19:40 +0100)]
efi_loader: parameter check in GetNextVariableName()

If GetNextVariableName() is called with a non-existing combination of
VariableName and VendorGuid, return EFI_INVALID_PARAMETER.

If GetNextVariableName() is called with a string that is not zero
terminated, return EFI_INVALID_PARAMETER.

Reformat a line over 80 characters.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: tcg2 protocol updates
Ilias Apalodimas [Mon, 16 Nov 2020 06:52:41 +0000 (08:52 +0200)]
efi_loader: tcg2 protocol updates

On pull reuqest
https://lists.denx.de/pipermail/u-boot/2020-November/432735.html
V4 of the patchset was sent instead of the v5.
This is the v4->v5 missing diff

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
4 years agodfu: simplify the dependencies of DFU_TFTP
AKASHI Takahiro [Tue, 17 Nov 2020 00:27:16 +0000 (09:27 +0900)]
dfu: simplify the dependencies of DFU_TFTP

Since CONFIG_UPDATE_COMMON always selects CONFIG_DFU_WRITE_ALT, we can
drop the latter from dependencies of CONFIG_DFU_TFTP.

Fixes: 3149e524fc1e ("common: update: add a generic interface for FIT
       image")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoMerge tag 'xilinx-for-v2021.01-rc3' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Fri, 20 Nov 2020 14:00:20 +0000 (09:00 -0500)]
Merge tag 'xilinx-for-v2021.01-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2021.01-rc3

Microblaze:
- Enable GC
- Get rid of xparameters.h and switch to DT for CFI
- Fix config file

tpm:
- Fix TPM code

zynqmp:
- Enable TPM by default
- Remove unused macros

fru:
- Several fixes especially use limit for recording

4 years agofru: common: Record pcie/uuid fields in custom board area
Michal Simek [Fri, 6 Nov 2020 12:58:01 +0000 (13:58 +0100)]
fru: common: Record pcie/uuid fields in custom board area

Add additional fields. They will be just recorded and filled but not shown.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agofru: ops: Do not let parser to write data to not allocated space
Michal Simek [Fri, 6 Nov 2020 12:55:45 +0000 (13:55 +0100)]
fru: ops: Do not let parser to write data to not allocated space

If customs fields in board area are used it will likely go over allocated
space in struct fru_board_data. That's why calculate limit of this
structure to make sure that different data is not rewritten by accident.
When limit is reached stop to record fields.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agofru: common: Switch capture variable with the rest
Michal Simek [Fri, 6 Nov 2020 12:53:01 +0000 (13:53 +0100)]
fru: common: Switch capture variable with the rest

capture variable is bool which is just one byte and it is just causing
unaligned accesses. Better to have it as last entry in the structure.

It also simplify offset calculation for initial header copy.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Enable TPM for xilinx platforms
Michal Simek [Mon, 9 Nov 2020 14:46:57 +0000 (15:46 +0100)]
arm64: zynqmp: Enable TPM for xilinx platforms

TPMs are becoming popular that's why enable drivers and command for it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Get rid of unused macros
Michal Simek [Tue, 10 Nov 2020 12:10:04 +0000 (13:10 +0100)]
arm64: zynqmp: Get rid of unused macros

There is no reason to have these macros. But record offsets of missing
register in the structure for future use.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agotpm: spi: Cleanup source code
Michal Simek [Fri, 6 Nov 2020 14:05:57 +0000 (15:05 +0100)]
tpm: spi: Cleanup source code

There is no need for GD to be used and priv variable is unused.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agomicroblaze: Detect NOR flash based on DT
Michal Simek [Wed, 4 Nov 2020 15:14:06 +0000 (16:14 +0100)]
microblaze: Detect NOR flash based on DT

Remove fixed configuration and detect flash based on DT.

Also increase amount of flash sectors to 2048 because on kc705 flash has
1027 sectors.

Bank # 1: CFI conformant flash (16 x 16)  Size: 128 MB in 1027 Sectors
  Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x8962
  Erase timeout: 4096 ms, write timeout: 2 ms
  Buffer write timeout: 5 ms, buffer size: 1024 bytes

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agomicroblaze: Unify of setting for SPL_NOR/XIP support
Michal Simek [Wed, 4 Nov 2020 15:12:20 +0000 (16:12 +0100)]
microblaze: Unify of setting for SPL_NOR/XIP support

XIP is not enabled in SPL. SPL_NOR is enabled but any macro setting with
using SYS_FLASH_BASE are wrong because it is not aligned with DM.
That's why change these macro and align them with TEXT_BASE macro.
Information should be find at run time based on DT but implementation is
not done yet.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agomicroblaze: Remove CONFIG_SYS_FDT_SIZE
Michal Simek [Wed, 4 Nov 2020 15:08:40 +0000 (16:08 +0100)]
microblaze: Remove CONFIG_SYS_FDT_SIZE

CONFIG_SYS_FDT_SIZE is not use anywhere that's why remove it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agomicroblaze: Get rid of xparameters.h
Michal Simek [Wed, 4 Nov 2020 15:00:38 +0000 (16:00 +0100)]
microblaze: Get rid of xparameters.h

There is no need to use this file anymore. Include it in main config file
and simplify logic based on it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agomicroblaze: Simplify cache handling
Michal Simek [Wed, 4 Nov 2020 14:58:04 +0000 (15:58 +0100)]
microblaze: Simplify cache handling

Enable caches by default. For now just simplify config file but it should
be read from DT or PVRs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agomicroblaze: Clean config file from ifdef mess
Michal Simek [Wed, 4 Nov 2020 14:46:32 +0000 (15:46 +0100)]
microblaze: Clean config file from ifdef mess

A lot of configs has been moved to Kconfig and it ends up in ifdef mess
with no bodies. That's why remove all of them.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agomicroblaze: Enable GCC garbage collector for full U-Boot
Michal Simek [Wed, 4 Nov 2020 13:01:45 +0000 (14:01 +0100)]
microblaze: Enable GCC garbage collector for full U-Boot

GCC's garbage collector works for Microblaze for quite a long time but none
has enabled it.
The same change has be done for example by commit fac4790491f6 ("arc:
Eliminate unused code and data with GCC's garbage collector").

Before:
   text    data     bss     dec     hex filename
 588760   33592   39192  661544   a1828 u-boot

After:
   text    data     bss     dec     hex filename
 504504   32164   38608  575276   8c72c u-boot

Which saves almost 15% of memory footprint.

Also group symbols/functions to proper section.

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoMerge branch '2020-11-18-assorted-fixes'
Tom Rini [Thu, 19 Nov 2020 15:23:50 +0000 (10:23 -0500)]
Merge branch '2020-11-18-assorted-fixes'

- Assorted SquashFS fixes and cleanups
- Fixes for various Coverity issues
- Various fixups to other platforms / code

4 years agofs/squashfs: implement exists() function
Richard Genoud [Tue, 3 Nov 2020 11:11:26 +0000 (12:11 +0100)]
fs/squashfs: implement exists() function

This permits to find a file and use the distro_bootcmd

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_read: remove buggy offset functionality
Richard Genoud [Tue, 3 Nov 2020 11:11:24 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: remove buggy offset functionality

offset is the offset in the file read, not the offset in the destination
buffer.
If the offset is not null, this will lead to a memory corruption.
So, for now, we are returning an error if the offset is used.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_read: don't write beyond buffer size
Richard Genoud [Tue, 3 Nov 2020 11:11:23 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: don't write beyond buffer size

The length of the buffer wasn't taken into account when writing to the
given buffer.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_probe: use sqfs_decompressor_init() return value
Richard Genoud [Tue, 3 Nov 2020 11:11:22 +0000 (12:11 +0100)]
fs/squashfs: sqfs_probe: use sqfs_decompressor_init() return value

sqfs_decompressor_init() returns a value, so it's better to use it than
to force the return value to EINVAL (it could be ENOMEM)

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_probe: reset cur_dev/cur_part_info to NULL on error
Richard Genoud [Tue, 3 Nov 2020 11:11:21 +0000 (12:11 +0100)]
fs/squashfs: sqfs_probe: reset cur_dev/cur_part_info to NULL on error

Resetting the context on error will prevent some checks like:
if (!ctx.cur_dev)
To pass when the probe method has failed

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_probe: fix possible memory leak on error
Richard Genoud [Tue, 3 Nov 2020 11:11:19 +0000 (12:11 +0100)]
fs/squashfs: sqfs_probe: fix possible memory leak on error

If SquashFS magic number is invalid, there's a memory leak.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_read: fix memory leak on finfo.blk_sizes
Richard Genoud [Tue, 3 Nov 2020 11:11:18 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix memory leak on finfo.blk_sizes

finfo.blk_sizes may not be freed in case of error in the for loop
Setting it to null and freeing it at the end makes prevents that from
happening.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_get_abs_path: fix possible memory leak on error
Richard Genoud [Tue, 3 Nov 2020 11:11:17 +0000 (12:11 +0100)]
fs/squashfs: sqfs_get_abs_path: fix possible memory leak on error

if  sqfs_tokenize(rel_tokens, rc, rel); fails, the function exits
without freeing the array base_tokens.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_get_abs_path: fix error check
Richard Genoud [Tue, 3 Nov 2020 11:11:16 +0000 (12:11 +0100)]
fs/squashfs: sqfs_get_abs_path: fix error check

the return value of sqfs_tokenize(rel_tokens, rc, rel); wasn't checked.
(but "ret" value was !)
This is obviouly a typo.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_frag_lookup: simplify error handling
Richard Genoud [Tue, 3 Nov 2020 11:11:15 +0000 (12:11 +0100)]
fs/squashfs: sqfs_frag_lookup: simplify error handling

For consistency with other functions.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_read: fix another memory leak
Richard Genoud [Tue, 3 Nov 2020 11:11:14 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix another memory leak

data_buffer was allocated in a loop and freed only once.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_read: fix memory leak
Richard Genoud [Tue, 3 Nov 2020 11:11:13 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix memory leak

sqfs_closedir() should be called to free memory allocated by
sqfs_opendir()

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_read: remove useless sqfs_closedir()
Richard Genoud [Tue, 3 Nov 2020 11:11:12 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: remove useless sqfs_closedir()

as sqfs_opendir failed, there's no need to call sqfs_closedir

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_read: fix dangling pointer dirs->entry
Richard Genoud [Tue, 3 Nov 2020 11:11:11 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix dangling pointer dirs->entry

dirs->entry shouldn't be left dangling as it could be freed twice.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_size: remove useless sqfs_closedir()
Richard Genoud [Tue, 3 Nov 2020 11:11:10 +0000 (12:11 +0100)]
fs/squashfs: sqfs_size: remove useless sqfs_closedir()

as sqfs_opendir failed, there's no need to call sqfs_closedir

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_size: fix dangling pointer dirs->entry
Richard Genoud [Tue, 3 Nov 2020 11:11:09 +0000 (12:11 +0100)]
fs/squashfs: sqfs_size: fix dangling pointer dirs->entry

dirs->entry shouldn't be left dangling as it could be freed twice.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_concat_tokens: check if malloc succeeds
Richard Genoud [Tue, 3 Nov 2020 11:11:08 +0000 (12:11 +0100)]
fs/squashfs: sqfs_concat_tokens: check if malloc succeeds

memory allocation should always be checked

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_read_inode_table: fix dangling pointer
Richard Genoud [Tue, 3 Nov 2020 11:11:07 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read_inode_table: fix dangling pointer

inode_table should not be left dangling as it may be freed in sqfs_opendir

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_search_dir: fix memory leaks
Richard Genoud [Tue, 3 Nov 2020 11:11:06 +0000 (12:11 +0100)]
fs/squashfs: sqfs_search_dir: fix memory leaks

path, target, res, rem and sym_tokens were not free on error nor success.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_search_dir: fix dangling pointer
Richard Genoud [Tue, 3 Nov 2020 11:11:05 +0000 (12:11 +0100)]
fs/squashfs: sqfs_search_dir: fix dangling pointer

dirs->entry shouldn't be left dangling as it could be freed twice.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_read_directory_table: fix memory leak
Richard Genoud [Tue, 3 Nov 2020 11:11:04 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read_directory_table: fix memory leak

pos_list wasn't freed on every error

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_split_path: fix memory leak and dangling pointers
Richard Genoud [Tue, 3 Nov 2020 11:11:03 +0000 (12:11 +0100)]
fs/squashfs: sqfs_split_path: fix memory leak and dangling pointers

*file and *dir were not freed on error

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_closedir: fix memory leak
Richard Genoud [Tue, 3 Nov 2020 11:11:02 +0000 (12:11 +0100)]
fs/squashfs: sqfs_closedir: fix memory leak

sqfs_dirs wasn't freed anywhere.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_opendir: simplify error handling
Richard Genoud [Tue, 3 Nov 2020 11:11:01 +0000 (12:11 +0100)]
fs/squashfs: sqfs_opendir: simplify error handling

Using only one label permits to prevents bugs when moving code around.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: sqfs_opendir: fix some memory leaks and dangling pointers
Richard Genoud [Tue, 3 Nov 2020 11:11:00 +0000 (12:11 +0100)]
fs/squashfs: sqfs_opendir: fix some memory leaks and dangling pointers

When trying to load an non-existing file, the cpu hangs!

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
4 years agofs/squashfs: fix board hang-up when calling .exists()
Richard Genoud [Tue, 3 Nov 2020 11:10:59 +0000 (12:10 +0100)]
fs/squashfs: fix board hang-up when calling .exists()

add missing squashfs function to prevent dangling or null pointers.
For exemple, when calling test [ -e somefile ], squashfs.exists may be
called.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
4 years agofs: btrfs: initialize @ret to 0 to prevent uninitialized return value
Qu Wenruo [Sat, 31 Oct 2020 01:07:51 +0000 (09:07 +0800)]
fs: btrfs: initialize @ret to 0 to prevent uninitialized return value

In show_dir() if we hit a ROOT_ITEM, we can exit with uninitialized
@ret.

Fix it by initializing it to 0.

Reported-by: Coverity CID 312955
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Marek BehĂșn <marek.behun@nic.cz>
4 years agofs: btrfs: inode: handle uninitialized type before returning it
Qu Wenruo [Sat, 31 Oct 2020 01:07:49 +0000 (09:07 +0800)]
fs: btrfs: inode: handle uninitialized type before returning it

In btrfs_lookup_path() the local variable @type should always be updated
after we hit any file/dir.

But if @filename is NULL from the very beginning, then we don't
initialize it and return it directly.

To prevent such problem from happening, we initialize @type to
BTRFS_FT_UNKNOWN.
For normal execution route, it will get updated for each filename we
resolved.
Buf if we didn't find any path, we check if the type is still FT_UNKNOWN
and ret == 0. If true we know there is something wrong, just return
-EUCLEAN to inform the caller.

Reported-by: Coverity CID 312958
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Marek BehĂșn <marek.behun@nic.cz>
4 years agofs/squashfs: Fix index off by 1 for inode SQFS_LDIR_TYPE
Gerard Koskamp [Fri, 30 Oct 2020 13:41:58 +0000 (13:41 +0000)]
fs/squashfs: Fix index off by 1 for inode SQFS_LDIR_TYPE

I've created a squashfs file system with Yocto (it use squashfs-tools)
and u-boot command sqfsls give the error:'Error while searching inode:
unknown type.'
After some digging in the code I found that the index is off by 1.
This patch fix this issue and I can successful use the sqfsls command.
After search for the squashfs format I found a link talk about a
similar issue but this time in the documentation. The link is:
https://github.com/AgentD/squashfs-tools-ng/commit/e6588526838caece9529

Signed-off-by: Gerard Koskamp <gerard.koskamp@nedap.com>
Tested-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
4 years agodrivers: led: bcm6858: set the correct led polarity register
Steven Lawrance [Thu, 29 Oct 2020 17:27:34 +0000 (18:27 +0100)]
drivers: led: bcm6858: set the correct led polarity register

This change sets the output (hardware) polarity register instead of the
input (software) polarity register for the bcm6858 LED controller.  The
logic was inverted (a LED configued active high behaved as active low).

Signed-off-by: Steven Lawrance <steven.lawrance@softathome.com>
Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
4 years agokm/ppc: use Kconfig for MEMTEST configuration
Holger Brunck [Thu, 29 Oct 2020 12:54:54 +0000 (13:54 +0100)]
km/ppc: use Kconfig for MEMTEST configuration

Also change back SYS_MEMTEST_END to 0x00f00000. 0xe00000 was wrong and
introduced due to the global Kconfig migration of this option in u-boot.

CC: Heiko Schocher <hs@denx.de>
CC: Tom Rini <trini@konsulko.com>
Signed-off-by: Holger Brunck <holger.brunck@hitachi-powergrids.com>
4 years agokm: replace hardcoded address for imported environment
Matteo Ghidoni [Thu, 29 Oct 2020 12:48:01 +0000 (13:48 +0100)]
km: replace hardcoded address for imported environment

Instead of using an hard coded address, make use of an
already defined address for importing the environment
for ramfs and nfs boot. This allows boards having different
mapping to use the same code.

CC: Heiko Schocher <hs@denx.de>
CC: Tom Rini <trini@konsulko.com>
Signed-off-by: Matteo Ghidoni <matteo.ghidoni@hitachi-powergrids.com>
Signed-off-by: Holger Brunck <holger.brunck@hitachi-powergrids.com>
4 years agoenv: typo enougth
Heinrich Schuchardt [Fri, 30 Oct 2020 05:11:12 +0000 (06:11 +0100)]
env: typo enougth

%s/enougth/enough/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agotools: dumpimage: Remove remaining mentions of the -i option
Tyler Hicks [Mon, 26 Oct 2020 15:40:24 +0000 (10:40 -0500)]
tools: dumpimage: Remove remaining mentions of the -i option

The -i option of the dumpimage tool has been removed so it should no
longer be documented in the README file. Refer readers to the tool's
help output rather than maintain a copy of the usage in the README.

Finally, adjust the example dumpfile invocation in imagetool.h to use
the -o option instead of the removed -i option.

Fixes: 12b831879a76 ("tools: dumpimage: Simplify arguments")
Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Cc: Martyn Welch <martyn.welch@collabora.com>
Acked-by: Martyn Welch <martyn.welch@collabora.com>
4 years agocommon: fit: add missing newline
Michael Walle [Mon, 16 Nov 2020 21:01:31 +0000 (22:01 +0100)]
common: fit: add missing newline

The debug statement doesn't end with a newline. Add it.

Signed-off-by: Michael Walle <michael@walle.cc>
4 years agotools: image-host.c: use correct variable for strerrno
Philippe Reynes [Fri, 13 Nov 2020 14:15:18 +0000 (15:15 +0100)]
tools: image-host.c: use correct variable for strerrno

In the function get_random_data, strerrno is called with
the variable ret (which is the return of the function
clock_gettime). It should be called with errnor. This
commit fixes this mistake.

Reported-by: Coverity (CID: 312956)
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotools: image-host.c: use random instead of rand
Philippe Reynes [Fri, 13 Nov 2020 15:37:46 +0000 (16:37 +0100)]
tools: image-host.c: use random instead of rand

According to the manpage of rand, it is recommended
to use random instead of rand. This commit updates
the function get_random_data to use random.

Reported-by: Coverity (CID: 312953)
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoarm: vexpress: don't reset flags in board_init to avoid losing previous ones
Arnaud Aujon Chevallier [Sun, 15 Nov 2020 11:54:10 +0000 (12:54 +0100)]
arm: vexpress: don't reset flags in board_init to avoid losing previous ones

Re-submitted because of missing description and signed-off.

flags reset in board_init caused bugs when executing command like editenv
because the reallocated flag was lost.

Tested-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Arnaud Aujon Chevallier <arnaud@intelibre.fr>
4 years agoenv: mmc: Correct partition comparison in mmc_offset_try_partition
Hoyeonjiki Kim [Tue, 17 Nov 2020 03:32:08 +0000 (12:32 +0900)]
env: mmc: Correct partition comparison in mmc_offset_try_partition

The function mmc_offset_try_partition searches the MMC partition for
locating environment data, by comparing the partition names with config
"u-boot,mmc-env-parition". However, it only compares the first word-size
bytes (size of 'const char *'), which may make the function to find
unintended partition.

Correct the function not to partially compare the partition name with
config "u-boot,mmc-env-partition".

Fixes: c9e87ba66540 ("env: Save environment at the end of an MMC partition")
Signed-off-by: Hoyeonjiki Kim <jigi.kim@gmail.com>
Reviewed-by: Wolfgang Denk <wd@denx.de>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Tue, 17 Nov 2020 14:52:34 +0000 (09:52 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Enable SATA disk on QEMU RISC-V and update doc.
- k210 pinctrl updates:
  - Fix inverted IE and OE for I2C.
  - Rename power domains to match datasheet.

4 years agopinctrl: k210: Rename power domains to match datasheet
Sean Anderson [Fri, 13 Nov 2020 13:43:40 +0000 (08:43 -0500)]
pinctrl: k210: Rename power domains to match datasheet

This renames power domains to match the names on the k210 datasheet.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reported-by: Damien Le Moal <Damien.LeMoal@wdc.com>
Reviewed-by: Rick Chen <rick@andestech.com>
4 years agopinctrl: k210: Fix inverted IE and OE for I2C
Sean Anderson [Fri, 13 Nov 2020 13:43:39 +0000 (08:43 -0500)]
pinctrl: k210: Fix inverted IE and OE for I2C

I2C and SCCB previously shared defaults. However, SCCB needs OE_INV and
IE_INV set, but I2C cannot have those bits set. This adds a separate
default for SCCB.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reported-by: Damien Le Moal <Damien.LeMoal@wdc.com>
4 years agodoc: qemu-riscv: describe attaching a disk image
Heinrich Schuchardt [Wed, 4 Nov 2020 11:59:13 +0000 (12:59 +0100)]
doc: qemu-riscv: describe attaching a disk image

How to add an emulated disk to QEMU may not be known to the user.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
4 years agoriscv: enable SATA disk on QEMU RISC-V
Heinrich Schuchardt [Wed, 4 Nov 2020 11:49:01 +0000 (12:49 +0100)]
riscv: enable SATA disk on QEMU RISC-V

Allow attaching a virtual SATA disk to QEMU RISC-V by implying
AHCI, AHCI_PCI, CMD_SCSI, DM_SCSI, PCI_INIT_R, SCSI, SCSI_AHCI.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
4 years agoriscv: sort SPECIFIC_OPTIONS
Heinrich Schuchardt [Wed, 4 Nov 2020 11:49:00 +0000 (12:49 +0100)]
riscv: sort SPECIFIC_OPTIONS

Sort implied options in BOARD_SPECIFIC_OPTIONS in the same sequence as in
.config.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
4 years agoMerge branch 'pr-2020-11-17' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Tue, 17 Nov 2020 03:53:29 +0000 (22:53 -0500)]
Merge branch 'pr-2020-11-17' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi

- PinePhone support (Samuel)
- V3/S3 support (Icenowy)

4 years agosunxi: dts: sync Allwinner V3s-related DTs from Linux 5.10-rc1
Icenowy Zheng [Mon, 26 Oct 2020 14:19:35 +0000 (22:19 +0800)]
sunxi: dts: sync Allwinner V3s-related DTs from Linux 5.10-rc1

This commit imports device tree files that are related to Allwinner V3
series from Linux commit 3650b228f83a ("Linux 5.10-rc1").

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: allow to use AXP20[39] attached to I2C0 on V3 series
Icenowy Zheng [Mon, 26 Oct 2020 14:19:34 +0000 (22:19 +0800)]
sunxi: allow to use AXP20[39] attached to I2C0 on V3 series

The reference design of Allwinner V3 series uses an
AXP203 or AXP209 PMIC attached to the I2C0 bus of the SoC, although the
first community-available V3s board, Lichee Pi Zero, omitted it.

Allow to introduce support for the PMIC on boards with it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agoclk: sunxi: add compatible string for V3
Icenowy Zheng [Mon, 26 Oct 2020 14:18:02 +0000 (22:18 +0800)]
clk: sunxi: add compatible string for V3

A new compatible string is introduced for V3 CCU, because it has a few
extra features available.

Add the compatible string to the clock driver. As the extra features are
not touched, just share the description struct now.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: gpio: introduce compatible string for V3 GPIO
Icenowy Zheng [Mon, 26 Oct 2020 14:18:01 +0000 (22:18 +0800)]
sunxi: gpio: introduce compatible string for V3 GPIO

A new compatible string is introduced for V3 GPIO, because it has more
pins available than V3s.

Add the compatible string to the GPIO driver.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: add V3/S3 support
Icenowy Zheng [Mon, 26 Oct 2020 14:15:59 +0000 (22:15 +0800)]
sunxi: add V3/S3 support

Allwinner V3/Sochip S3 uses the same die with Allwinner V3s/S3L, but V3 comes
with no co-packaged DDR (DDR3 is usually used externally), and S3L comes
with co-packaged DDR3.

Add support for Allwinner V3/S3 chips by add SoC names to original V3s
choice, and allow to select DDR3.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: a64: Add a defconfig for the PinePhone
Samuel Holland [Tue, 3 Nov 2020 03:32:50 +0000 (21:32 -0600)]
sunxi: a64: Add a defconfig for the PinePhone

The PinePhone is a smartphone produced by Pine64, with an A64 SoC,
2 or 3 GiB LPDDR3 RAM, 16 or 32 GiB eMMC, 720x1440 MIPI-DSI panel,
and Quectel EG25-G modem.

There are two main board revisions: 1.1 for early adopters, and 1.2
for mass production. Since there is code to detect the board revision
at boot, one config/image can support both boards.

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
4 years agosunxi: DT: A64: update device tree files
Samuel Holland [Sat, 24 Oct 2020 15:21:55 +0000 (10:21 -0500)]
sunxi: DT: A64: update device tree files

Import updated device trees from Linux tag v5.9. This picks up new
hardware (PinePhone, PineTab); and it drops the U-Boot specific DTSI
files for the Pinebook and the Teres-I, since the ANX6345 bridge is
now supported upstream.

A couple of headers needed updates for recently-added hardware support.

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: board: Set fdtfile to match the DT chosen by SPL
Samuel Holland [Sat, 24 Oct 2020 15:21:54 +0000 (10:21 -0500)]
sunxi: board: Set fdtfile to match the DT chosen by SPL

Previously, fdtfile was always the value in CONFIG_DEFAULT_DEVICE_TREE.
This meant that, regardless of the DT chosen by SPL (either by changing
the header in the image or by the selection code at runtime), Linux
always used the default DT.

By using the name from the SPL header (which, because of the previous
commit, always matches the DT used by U-Boot proper), Linux also sees
the same board as U-Boot/SPL, even if the boot script later loads a DT
from disk.

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
[Andre: remove no longer needed CONFIG_SPL_LOAD_FIT guards]
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
4 years agosunxi: board: Save the chosen DT name in the SPL header
Samuel Holland [Sat, 24 Oct 2020 15:21:53 +0000 (10:21 -0500)]
sunxi: board: Save the chosen DT name in the SPL header

This overwrites the name loaded from the SPL image. It will be different
if there was previously no name provided, or if a more accurate name was
determined by the board variant selection logic. This means that the DT
name in the SPL header now always matches the DT appended to U-Boot.

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
[Andre: move function under CONFIG_SPL_LOAD_FIT guard]
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
4 years agosunxi: board: Add PinePhone DT selection logic
Samuel Holland [Sat, 24 Oct 2020 15:21:52 +0000 (10:21 -0500)]
sunxi: board: Add PinePhone DT selection logic

There are two different publicly-released revisions of the PinePhone
hardware, versions 1.1 and 1.2; and they need different device trees.
Since some GPIO pins were rerouted, we can use that to distinguish
between them.

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: board: Simplify Pine A64 DT selection logic
Samuel Holland [Sat, 24 Oct 2020 15:21:51 +0000 (10:21 -0500)]
sunxi: board: Simplify Pine A64 DT selection logic

Instead of using an entirely separate matching algorithm, simply update
the name of the DT we want to match. Enabling this logic does not depend
on the FIT config name, only on the initial guess of the board name.

Importantly, the initial guess must be "sun50i-a64-pine64-plus", because
otherwise the logic would trigger when "sun50i-a64-pine64-lts" was
written to the SPL header.

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: board: Add a helper to get the SPL DT name
Samuel Holland [Sat, 24 Oct 2020 15:21:50 +0000 (10:21 -0500)]
sunxi: board: Add a helper to get the SPL DT name

This moves the validity checking and typecasts all to one place away
from the string comparison logic, and it detangles the compile-time
and runtime control flow.

The new helper will also be used by U-Boot proper in a future commit.

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
[Andre: protect new function with CONFIG_SPL_LOAD_FIT]
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
4 years agosunxi: board: Use a more descriptive variable name
Samuel Holland [Sat, 24 Oct 2020 15:21:49 +0000 (10:21 -0500)]
sunxi: board: Use a more descriptive variable name

The variable "cmp_str" always leaves me wondering if it is the DT name
of the current board (yes) or DT name in the FIT config entry (no).

In preparation for expanding the functionality here, rename it to
something that obviously means "this is the DT name we are looking for".

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agoMerge tag 'ti-v2021.01-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
Tom Rini [Mon, 16 Nov 2020 18:42:29 +0000 (13:42 -0500)]
Merge tag 'ti-v2021.01-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti

- Fix Nokia RX-51 boot issues
- Fix CONFIG_LOGLEVEL on K3 devices
- Add phyBOARD REGOR support