oweals/u-boot.git
4 years agopci: ensure enumeration of all devices in pci_init
Marek Behún [Tue, 21 May 2019 10:04:31 +0000 (12:04 +0200)]
pci: ensure enumeration of all devices in pci_init

Use the uclass_first_device_check and uclass_next_device_check functions
instead of uclass_first_device and uclass_next_device in pci_init. This
ensures that all PCI devices are tried to be probed. Currently if a
device fails to probe, the enumeration stops and the devices which come
after the failed device are not probed.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Stefan Roese <sr@denx.de>
Cc: Anton Schubert <anton.schubert@gmx.de>
Cc: Dirk Eibach <dirk.eibach@gdsys.cc>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: Phil Sutter <phil@nwl.cc>
Cc: VlaoMao <vlaomao@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoboard: pm9263: Convert to CONFIG_DM_USB and CONFIG_DM_VIDEO
Ilko Iliev [Mon, 11 Mar 2019 12:06:25 +0000 (13:06 +0100)]
board: pm9263: Convert to CONFIG_DM_USB and CONFIG_DM_VIDEO

Convert the board to support the USB and video driver model and remove
the unnecessary code.

4 years agoboard: pm9261: Convert to CONFIG_DM_USB and CONFIG_DM_VIDEO
Ilko Iliev [Mon, 11 Mar 2019 12:06:24 +0000 (13:06 +0100)]
board: pm9261: Convert to CONFIG_DM_USB and CONFIG_DM_VIDEO

Convert the board to support the USB and video driver model and remove
the unnecessary code.

4 years agoMerge tag 'dm-pull-9jul19-take2' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Thu, 11 Jul 2019 22:10:11 +0000 (18:10 -0400)]
Merge tag 'dm-pull-9jul19-take2' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

- Sandbox improvements including .dts refactor
- Minor tracing and PCI improvements
- Various other minor fixes
- Conversion of patman, dtoc and binman to support Python 3

4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 11 Jul 2019 22:09:38 +0000 (18:09 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell

- SPL SATA enhancements to allow booting from RAW SATA device
  needed for Clearfog (Baruch)
- Enable SATA booting on Clearfog (Baruch)
- Misc changes to Turris Omnia (Marek)
- Enable CMD_BOOTZ and increase SYS_BOOTM_LEN on crs305-1g-4s
  (Luka)
- Enable FIT support for db-xc3-24g4xg (Chris)
- Enable DM_SPI on Keymile Kirkwood board with necessary changes
  for this (Pascal)
- Set 38x and 39x AVS on lower frequency (Baruch)

4 years agoMerge tag 'uniphier-v2019.10' of https://gitlab.denx.de/u-boot/custodians/u-boot...
Tom Rini [Thu, 11 Jul 2019 22:08:44 +0000 (18:08 -0400)]
Merge tag 'uniphier-v2019.10' of https://gitlab.denx.de/u-boot/custodians/u-boot-uniphier

UniPhier SoC updates for v2019.10

- import DT updates from Linux

- add UniPhier SPI controller driver

- make U-Boot image for 64bit SoCs position independent

- tidy up various init code for next generation SoCs

- misc cleanups

4 years agoMerge branch '2019-07-11-master-imports'
Tom Rini [Thu, 11 Jul 2019 22:03:52 +0000 (18:03 -0400)]
Merge branch '2019-07-11-master-imports'

- spear platform improvements
- Android BCB support
- Cadence PCIe endpoint driver

4 years agogpio: pca953x: Add TI TCA9539 compatible string
Marek Vasut [Sat, 25 May 2019 20:52:20 +0000 (22:52 +0200)]
gpio: pca953x: Add TI TCA9539 compatible string

Add TI TCA9539 compatible string for yet another I2C GPIO expander.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Peng Fan <van.freenix@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
4 years agoarm: mach-omap2: am33xx: Init pinmux before clock
Marek Vasut [Sat, 25 May 2019 20:40:35 +0000 (22:40 +0200)]
arm: mach-omap2: am33xx: Init pinmux before clock

The board_early_init_f() inits clock before initing pinmux. However,
the clock configuration code might need to adjust PMIC settings of a
PMIC on I2C bus (e.g. board/ti/am335x/board.c does that). If the I2C
bus pin muxing is not configured before attempting to communicate
with the PMIC, the communication will silently fail and the prcm_init()
may configure fast enough CPU clock that the default voltage provided
by the PMIC would be insufficient and the platform would become
unstable.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jean-Jacques Hiblot <jjhiblot@ti.com>
Cc: Tom Rini <trini@konsulko.com>
4 years agodoc: relocate/rename Android README and add BCB overview
Eugeniu Rosca [Thu, 23 May 2019 15:32:23 +0000 (17:32 +0200)]
doc: relocate/rename Android README and add BCB overview

Rename:
 - doc/{README.avb2 => android/avb2.txt}
 - doc/{README.android-fastboot => android/fastboot.txt}

Add a new file documenting the 'bcb' command:
 - doc/android/bcb.txt

The new directory structure has been reviewed by Simon in
https://patchwork.ozlabs.org/patch/1101107/#2176031 .

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocmd: Add 'bcb' command to read/modify/write BCB fields
Eugeniu Rosca [Thu, 23 May 2019 15:32:22 +0000 (17:32 +0200)]
cmd: Add 'bcb' command to read/modify/write BCB fields

'Bootloader Control Block' (BCB) is a well established term/acronym in
the Android namespace which refers to a location in a dedicated raw
(i.e. FS-unaware) flash (e.g. eMMC) partition, usually called "misc",
which is used as media for exchanging messages between Android userspace
(particularly recovery [1]) and an Android-capable bootloader.

On higher level, this allows implementing a subset of Android Bootloader
Requirements [2], amongst which is the Android-specific bootloader
flow [3]. Regardless how the latter is implemented in U-Boot ([3] being
the most memorable example), reading/writing/dumping the BCB fields in
the development process from inside the U-Boot is a convenient feature.
Hence, make it available to the users.

Some usage examples of the new command recorded on R-Car H3ULCB-KF
('>>>' is an overlay on top of the original console output):

=> bcb
bcb - Load/set/clear/test/dump/store Android BCB fields

Usage:
bcb load  <dev> <part>       - load  BCB from mmc <dev>:<part>
bcb set   <field> <val>      - set   BCB <field> to <val>
bcb clear [<field>]          - clear BCB <field> or all fields
bcb test  <field> <op> <val> - test  BCB <field> against <val>
bcb dump  <field>            - dump  BCB <field>
bcb store                    - store BCB back to mmc

Legend:
<dev>   - MMC device index containing the BCB partition
<part>  - MMC partition index or name containing the BCB
<field> - one of {command,status,recovery,stage,reserved}
<op>    - the binary operator used in 'bcb test':
          '=' returns true if <val> matches the string stored in <field>
          '~' returns true if <val> matches a subset of <field>'s string
<val>   - string/text provided as input to bcb {set,test}
          NOTE: any ':' character in <val> will be replaced by line feed
          during 'bcb set' and used as separator by upper layers

=> bcb dump command
Error: Please, load BCB first!
 >>> Users must specify mmc device and partition before any other call

=> bcb load 1 misc
=> bcb load 1 1
 >>> The two calls are equivalent (assuming "misc" has index 1)

=> bcb dump command
00000000: 62 6f 6f 74 6f 6e 63 65 2d 73 68 65 6c 6c 00 72    bootonce-shell.r
00000010: 79 00 72 00 00 00 00 00 00 00 00 00 00 00 00 00    y.r.............
 >>> The output is in binary/string format for convenience
 >>> The output size matches the size of inspected BCB field
 >>> (32 bytes in case of 'command')

=> bcb test command = bootonce-shell && echo true
true
=> bcb test command = bootonce-shell- && echo true
=> bcb test command = bootonce-shel && echo true
 >>> The '=' operator returns 'true' on perfect match

=> bcb test command ~ bootonce-shel && echo true
true
=> bcb test command ~ bootonce-shell && echo true
true
 >>> The '~' operator returns 'true' on substring match

=> bcb set command recovery
=> bcb dump command
00000000: 72 65 63 6f 76 65 72 79 00 73 68 65 6c 6c 00 72    recovery.shell.r
00000010: 79 00 72 00 00 00 00 00 00 00 00 00 00 00 00 00    y.r.............
 >>> The new value is NULL-terminated and stored in the BCB field

=> bcb set recovery "msg1:msg2:msg3"
=> bcb dump recovery
00000040: 6d 73 67 31 0a 6d 73 67 32 0a 6d 73 67 33 00 00    msg1.msg2.msg3..
00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
 >>> --- snip ---
 >>> Every ':' is replaced by line-feed '\n' (0xA). The latter is used
 >>> as separator between individual commands by Android userspace

=> bcb store
 >>> Flush/store the BCB structure to MMC

[1] https://android.googlesource.com/platform/bootable/recovery
[2] https://source.android.com/devices/bootloader
[3] https://patchwork.ozlabs.org/patch/746835/
    ("[U-Boot,5/6] Initial support for the Android Bootloader flow")

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
4 years agoinclude: android_bootloader_message.h: Minimize the diff to AOSP
Eugeniu Rosca [Thu, 23 May 2019 15:32:21 +0000 (17:32 +0200)]
include: android_bootloader_message.h: Minimize the diff to AOSP

Perform the following updates:
 - Relocate the commit id from the file to the description of U-Boot
   commit. The AOSP commit is c784ce50e8c10eaf70e1f97e24e8324aef45faf5.
   This is done to avoid stale references in the file itself. The
   reasoning is in https://patchwork.ozlabs.org/patch/1098056/#2170209.
 - Minimize the diff to AOSP, to decrease the effort of the next AOSP
   backports. The background can be found in:
   https://patchwork.ozlabs.org/patch/1080394/#2168454.
 - Guard the static_assert() calls by #ifndef __UBOOT__ ... #endif,
   to avoid compilation failures of files including the header.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoSPL: Default to disabling legacy image support when using FIT
Tom Rini [Thu, 23 May 2019 11:14:08 +0000 (07:14 -0400)]
SPL: Default to disabling legacy image support when using FIT

When we have a FIT image being used by SPL by default that means the
most common case is that we'll never run into a legacy image.  Disable
legacy image support by default in that case to reclaim space.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoconfigs: Rename CONFIG_IMAGE_FORMAT_LEGACY to CONFIG_LEGACY_IMAGE_FORMAT
Tom Rini [Thu, 23 May 2019 11:14:07 +0000 (07:14 -0400)]
configs: Rename CONFIG_IMAGE_FORMAT_LEGACY to CONFIG_LEGACY_IMAGE_FORMAT

The name CONFIG_LEGACY_IMAGE_FORMAT reads slightly better along with
allowing us to avoid a rather nasty Kbuild/Kconfig issue down the line
with CONFIG_IS_ENABLED(IMAGE_FORMAT_LEGACY).  In a few places outside of
cmd/ switch to using CONFIG_IS_ENABLED() to test what is set.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agotpm: wait for valid status
Roman Kapl [Thu, 16 May 2019 16:32:48 +0000 (18:32 +0200)]
tpm: wait for valid status

The TPM specification says that the EXPECT_DATA bit is not valid until
the VALID bit is set. Wait for that bit to be set. Fixes problems with
Ifineon SPI TPM.

Signed-off-by: Roman Kapl <rka@sysgo.com>
4 years agoarm: spear: Return to BootROM if failing to boot from the main device
Miquel Raynal [Tue, 7 May 2019 12:18:54 +0000 (14:18 +0200)]
arm: spear: Return to BootROM if failing to boot from the main device

Overload the weak function board_boot_order() so that besides choosing
the main boot device, we can fallback on USB boot by returning in the
BootROM, eg. if the NOR flash is empty while it was the primary boot
medium.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: spear: Do not link the _main branch
Miquel Raynal [Tue, 7 May 2019 12:18:53 +0000 (14:18 +0200)]
arm: spear: Do not link the _main branch

The _main call is not supposed to return at all: don't link the
branch.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: spear: Support returning to BootROM
Miquel Raynal [Tue, 7 May 2019 12:18:52 +0000 (14:18 +0200)]
arm: spear: Support returning to BootROM

Implement the weak board_return_to_bootrom() function so that when
enabling the spl_bootrom.c driver, one can make use of usbboot on
spear platforms. All necessary information to return to the BootROM
are stored in the BootROM's stack. The SPL stack pointer is reset so
we save the BootROM's stack pointer into the SPL .data section.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: spear: Simplify start.S organization
Miquel Raynal [Tue, 7 May 2019 12:18:51 +0000 (14:18 +0200)]
arm: spear: Simplify start.S organization

There is no reason to do the few spear-related initialization, in a
different procedure than 'reset'. Spare one branching and get a linear
code flow by removing this indirection.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: spear: Reference the link register with LR instead of R14
Miquel Raynal [Tue, 7 May 2019 12:18:50 +0000 (14:18 +0200)]
arm: spear: Reference the link register with LR instead of R14

The link register is stored in R14. ARM assembly code allows to use
the 'lr' name to reference it instead of 'r14' which is not very
meaningful. Do the substitution to ease the reading.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: spear: Use PUSH/POP mnemonics when relevant
Miquel Raynal [Tue, 7 May 2019 12:18:49 +0000 (14:18 +0200)]
arm: spear: Use PUSH/POP mnemonics when relevant

Quoting ARM "RealView Compilation Tools Assembler Guide v4.0":

        PUSH and POP are synonyms for STMDB and LDM (or LDMIA), with
        the base register sp (r13), and the adjusted address written
        back to the base register.
PUSH and POP are the preferred mnemonic in these cases.

Let's follow this recommandation to ease the reading and substitute
LDMIA/STMDB operations with PUSH/POP mnemonics.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: spear: Purely cosmetic changes in start.S
Miquel Raynal [Tue, 7 May 2019 12:18:48 +0000 (14:18 +0200)]
arm: spear: Purely cosmetic changes in start.S

Before cleaning a bit further the spear/start.S file, apply a few
cosmetic changes: capital letters, comment indentation and small
rewriting.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: spear: Fix the main comment in start.S
Miquel Raynal [Tue, 7 May 2019 12:18:47 +0000 (14:18 +0200)]
arm: spear: Fix the main comment in start.S

This comment describes the board state at the moment where we enter
the SPL. The description is entirely wrong; re-write it to fit the
reality.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: spear: Drop false comment
Miquel Raynal [Tue, 7 May 2019 12:18:46 +0000 (14:18 +0200)]
arm: spear: Drop false comment

SPL BSS lies in SRAM and is actually initialized to 0 by the SPL in
arch/arm/lib/crt0.S:_main(), which is called by cpu_init_crit.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: spear: Call the SPL 'SPL', not 'Xloader'
Miquel Raynal [Tue, 7 May 2019 12:18:45 +0000 (14:18 +0200)]
arm: spear: Call the SPL 'SPL', not 'Xloader'

Rename Xloader as SPL in comments.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: spear: Drop useless board_init_r call
Miquel Raynal [Tue, 7 May 2019 12:18:44 +0000 (14:18 +0200)]
arm: spear: Drop useless board_init_r call

It is clearly stated that board_init_f should *not* call
board_init_r. Indeed, board_init_f should return. The code will
continue through arch/arm/lib/crt0.S which will do more setup before
calling board_init_r.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agospl: Fix typo in kernel doc
Miquel Raynal [Tue, 7 May 2019 12:18:43 +0000 (14:18 +0200)]
spl: Fix typo in kernel doc

Fix a tiny typo in boot_from_devices() kernel doc.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agotest: pci_ep: add basic pci_ep tests
Ramon Fried [Sat, 27 Apr 2019 08:15:24 +0000 (11:15 +0300)]
test: pci_ep: add basic pci_ep tests

Add basic PCI endpoint sandbox testing.

Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agopci_ep: add pci endpoint sandbox driver
Ramon Fried [Sat, 27 Apr 2019 08:15:23 +0000 (11:15 +0300)]
pci_ep: add pci endpoint sandbox driver

Add a dummy PCI endpoint for sandbox.
Supporting only a single function, it allows setting
and reading header configuration.

Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agopci_ep: add Cadence PCIe endpoint driver
Ramon Fried [Sat, 27 Apr 2019 08:15:22 +0000 (11:15 +0300)]
pci_ep: add Cadence PCIe endpoint driver

Add Cadence PCIe endpoint driver supporting configuration
of header, bars and MSI for device.

Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodrivers: pci_ep: Introduce UCLASS_PCI_EP uclass
Ramon Fried [Sat, 27 Apr 2019 08:15:21 +0000 (11:15 +0300)]
drivers: pci_ep: Introduce UCLASS_PCI_EP uclass

Introduce new UCLASS_PCI_EP class for handling PCI endpoint
devices, allowing to set various attributes of the PCI endpoint
device, such as:
* configuration space header
* BAR definitions
* outband memory mapping
* start/stop PCI link

Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoarm: mvebu: set 38x and 39x AVS on lower frequency
Baruch Siach [Wed, 10 Jul 2019 15:23:04 +0000 (18:23 +0300)]
arm: mvebu: set 38x and 39x AVS on lower frequency

Reduce Auto Voltage Scaling VDD limit when core frequency is lower than
1600MHz. This reduces core voltage level from 1.25V to 1.15V, which
saves power.

The code is taken from Marvell's U-Boot 2013.01 revision 18.06.

Reviewed-by: Chris Packham <judge.packham@gmail.com>
Tested-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agokm/spi: remove deprecated SPI flash driver code for KM Kirkwood boards
Pascal Linder [Tue, 18 Jun 2019 06:44:02 +0000 (08:44 +0200)]
km/spi: remove deprecated SPI flash driver code for KM Kirkwood boards

KM Kirkwood boards now implement the driver model for its SPI flash
interface. Therefore, the old board specific claim and release functions
can be deleted. The preprocessor definition CONFIG_SYS_KW_SPI_MPP is yet
unused as well. All its appearances and dependencies are removed in the
kirkwood_spi driver, header files and finally the configuration whitelist.

Signed-off-by: Pascal Linder <pascal.linder@edu.hefr.ch>
Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agokm/spi: activate driver model for SPI flash on KM Kirkwood boards
Pascal Linder [Tue, 18 Jun 2019 06:42:59 +0000 (08:42 +0200)]
km/spi: activate driver model for SPI flash on KM Kirkwood boards

The corresponding configurations are selected in the common Kconfig file.
This is easier than changing every affected board default configuration
file. The default configuration for the PORTL2 board, however, still needs
some modifications to correctly use the driver model.

Signed-off-by: Pascal Linder <pascal.linder@edu.hefr.ch>
Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agokm/spi: add SPI configuration to KM Kirkwood device tree
Pascal Linder [Tue, 18 Jun 2019 06:41:03 +0000 (08:41 +0200)]
km/spi: add SPI configuration to KM Kirkwood device tree

In order to migrate the SPI flash interface to the driver model, the SPI
configuration needs to be added in the KM Kirkwood device tree file.

Signed-off-by: Pascal Linder <pascal.linder@edu.hefr.ch>
Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agokm/spi: overwrite kirkwood_spi weak functions for KM Kirkwood boards
Pascal Linder [Tue, 18 Jun 2019 06:41:02 +0000 (08:41 +0200)]
km/spi: overwrite kirkwood_spi weak functions for KM Kirkwood boards

As the SPI NOR and NAND devices share the same hardware pins, the MPP
configuration has to be changed when claiming/releasing the bus. The
current configuration is saved when claiming and restored when releasing.
Furthermore, a general-purpose output is used to switch the chip-select
signal. This is now also implemented for the DM part of the kirkwood_spi
driver.

Signed-off-by: Pascal Linder <pascal.linder@edu.hefr.ch>
Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agokm/spi: add weak functions to kirkwood_spi driver (DM part)
Pascal Linder [Tue, 18 Jun 2019 06:41:01 +0000 (08:41 +0200)]
km/spi: add weak functions to kirkwood_spi driver (DM part)

The weak functions, known from the legacy code, are added to the DM part
as well. For this purpose, the release operation first needs to be
implemented. KM Kirkwood boards will overwrite those weak functions to
change the MPP configuration when claiming/releasing the bus, because the
hardware pins are shared between the SPI NOR and NAND devices.

Signed-off-by: Pascal Linder <pascal.linder@edu.hefr.ch>
Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agokm: modify Kconfig file organization for KM boards
Pascal Linder [Tue, 18 Jun 2019 11:27:47 +0000 (13:27 +0200)]
km: modify Kconfig file organization for KM boards

As preparation for the upcoming transferring of configurations from header
files to Kconfig, a common Kconfig file for all KM boards was created. For
the moment, it only sources the other three, more specific, Kconfig files.
Therefore, the architecture Kconfig files now include the common Kconfig
file. Also, the configuration selection for KM boards was moved from the
architecture Kconfig files to the board specific Kconfig files.

Signed-off-by: Pascal Linder <pascal.linder@edu.hefr.ch>
Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoARM: mvebu: Enable FIT support for db-xc3-24g4xg
Chris Packham [Fri, 28 Jun 2019 00:30:12 +0000 (12:30 +1200)]
ARM: mvebu: Enable FIT support for db-xc3-24g4xg

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: crs305-1g-4s: Enable CMD_BOOTZ and increase SYS_BOOTM_LEN
Luka Kovacic [Tue, 25 Jun 2019 11:57:53 +0000 (13:57 +0200)]
arm: mvebu: crs305-1g-4s: Enable CMD_BOOTZ and increase SYS_BOOTM_LEN

This change enables CMD_BOOTZ and increases SYS_BOOTM_LEN to
make it easier to work with kernel images.

Signed-off-by: Luka Kovacic <me@lukakovacic.xyz>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: turris_omnia: fix rescue mode bootcmd bootargs setting
Marek Behún [Fri, 24 May 2019 12:57:54 +0000 (14:57 +0200)]
arm: mvebu: turris_omnia: fix rescue mode bootcmd bootargs setting

Rescue mode bootcmd currently only appends the "omniarescue" parameter
to the bootargs variable. We do not want the user to be able to change
rescue mode bootargs. Therefore change this so that bootcmd sets the
bootargs variable in an absolute way (adding console device information
and the omniarescue paramterer).

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: turris_omnia: call pci_init from board init code
Marek Behún [Fri, 24 May 2019 12:57:53 +0000 (14:57 +0200)]
arm: mvebu: turris_omnia: call pci_init from board init code

We always want to enumerate PCIe devices, because withouth this they
won't work in Linux.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: turris_omnia: prefer SCSI booting before USB
Marek Behún [Fri, 24 May 2019 12:57:52 +0000 (14:57 +0200)]
arm: mvebu: turris_omnia: prefer SCSI booting before USB

If SCSI and USB boot options are both available, try to boot from SCSI
first.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: turris_omnia: remove unneeded macro from board config
Marek Behún [Fri, 24 May 2019 12:57:51 +0000 (14:57 +0200)]
arm: mvebu: turris_omnia: remove unneeded macro from board config

This is not needed here since Omnia is using DM_PCI now.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: turris_omnia: change environment address in SPI flash
Marek Behún [Fri, 24 May 2019 12:57:50 +0000 (14:57 +0200)]
arm: mvebu: turris_omnia: change environment address in SPI flash

The U-Boot partition is 1 MiB and environment is 64 KiB. It does not
make sense to have environment at 0xc0000 when it could be at 0xf0000
and we can have more space for U-Boot binary.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: turris_omnia: fix adapters MAC addresses
Marek Behún [Fri, 24 May 2019 12:57:49 +0000 (14:57 +0200)]
arm: mvebu: turris_omnia: fix adapters MAC addresses

The board code reads MAC addresses from the ATSHA204A cryptochip.
For compatibility reasons the ethernet adapters on this SOC are not
enumerated in register address order. But when Omnia was first
manufactured this was done differently.

Change setting of MAC addresses to conform to the description on the
stickers sticked on actual Omnias.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: turris_omnia: set default ethernet adapter
Marek Behún [Fri, 24 May 2019 12:57:48 +0000 (14:57 +0200)]
arm: mvebu: turris_omnia: set default ethernet adapter

Set default value for the ethact variable to the WAN port.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: clearfog: document boot from SATA
Baruch Siach [Thu, 16 May 2019 10:04:03 +0000 (13:04 +0300)]
arm: mvebu: clearfog: document boot from SATA

Document the main U-Boot image offset when booting from SATA disk on the
Clearfog board.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: clearfog: set U-Boot offset for SATA boot
Baruch Siach [Thu, 16 May 2019 10:04:02 +0000 (13:04 +0300)]
arm: mvebu: clearfog: set U-Boot offset for SATA boot

See the offset of U-Boot in raw SATA disk to the same value as the MMC
offset. That is 0x140 sectors from the beginning of the SPL, which is
0x141 sectors from the beginning of the device (after the MBR sector).

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: clearfog: enable SATA in SPL
Baruch Siach [Thu, 16 May 2019 10:04:01 +0000 (13:04 +0300)]
arm: mvebu: clearfog: enable SATA in SPL

Enable SATA peripherals in SPL to allow boot from SATA.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: add support for boot from SATA
Baruch Siach [Thu, 16 May 2019 10:03:58 +0000 (13:03 +0300)]
arm: mvebu: add support for boot from SATA

Add the required Kconfig and macro definitions to allow boot from SATA
on Armada 38x systems.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: fix ahci mbus config in SPL
Baruch Siach [Thu, 16 May 2019 10:03:57 +0000 (13:03 +0300)]
arm: mvebu: fix ahci mbus config in SPL

SPL does not initialize mbus_dram_info. Don't change the ahci mbus
settings of the ROM. This allows the ahci to work in SPL.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agospl: sata: don't force FS_FAT support
Baruch Siach [Thu, 16 May 2019 10:03:55 +0000 (13:03 +0300)]
spl: sata: don't force FS_FAT support

Allow the code to build when FS_FAT is not enabled, and thus
spl_load_image_fat() is not provided.

A subsequent patch should add alternative raw access U-Boot main image
load method.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agospl: sata: fix build with DM_SCSI
Baruch Siach [Thu, 16 May 2019 10:03:54 +0000 (13:03 +0300)]
spl: sata: fix build with DM_SCSI

The init_sata() routine is only present when DM_SCSI is not enabled.
Don't call init_sata() when DM_SCSI is enabled. The code will fall back
to scsi_scan() in this case.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agospl: sata: add default partition and image name
Baruch Siach [Thu, 16 May 2019 10:03:53 +0000 (13:03 +0300)]
spl: sata: add default partition and image name

Add sensible defaults for the FAT partition selection and the main
U-Boot image file name. This allows spl_sata to build when the board
headers does not select them explicitly.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agotrace: trace buffer may exceed 2GiB
Heinrich Schuchardt [Fri, 14 Jun 2019 19:52:22 +0000 (21:52 +0200)]
trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotrace: do not limit trace buffer to 2GiB
Heinrich Schuchardt [Fri, 14 Jun 2019 19:50:55 +0000 (21:50 +0200)]
trace: do not limit trace buffer to 2GiB

There is no good reason to limit the trace buffer to 2GiB on a 64bit
system. Adjust the types of the relevant parameters.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodrivers: pci: add API to issue FLR on a PCI function if supported
Alex Marginean [Fri, 7 Jun 2019 08:24:25 +0000 (11:24 +0300)]
drivers: pci: add API to issue FLR on a PCI function if supported

Adds dm_pci_flr API that issues a Function Level reset on a PCI-e function,
if FLR is supported.

Signed-off-by: Alex Marginean <alexm.osslist@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotest: dm: Add a test for PCI Enhanced Allocation
Alex Marginean [Fri, 7 Jun 2019 08:24:24 +0000 (11:24 +0300)]
test: dm: Add a test for PCI Enhanced Allocation

This test is built on top of the existing swap_case driver.  It adds EA
capability structure support to swap_case and uses that to map BARs.
BAR1 works as it used to, swapping upper/lower case.  BARs 2,4 map to a
couple of magic values.

Signed-off-by: Alex Marginean <alexm.osslist@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
4 years agodrivers: pci: add map_bar support for Enhanced Allocation
Alex Marginean [Fri, 7 Jun 2019 08:24:23 +0000 (11:24 +0300)]
drivers: pci: add map_bar support for Enhanced Allocation

Makes dm_pci_map_bar API available for integrated PCI devices that
support Enhanced Allocation instead of the original PCI BAR mechanism.

Signed-off-by: Alex Marginean <alexm.osslist@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agopci: fixed dm_pci_map_bar comment
Alex Marginean [Fri, 7 Jun 2019 08:24:22 +0000 (11:24 +0300)]
pci: fixed dm_pci_map_bar comment

The comment now indicates that the input argument bar is a register offset,
not a BAR index.
It also mentions which BARs are supported for type 0/1 and that the
function can return 0 on error.

Signed-off-by: Alex Marginean <alexm.osslist@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotrace: make call depth limit customizable
Heinrich Schuchardt [Sun, 2 Jun 2019 11:30:09 +0000 (13:30 +0200)]
trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotrace: conserve gd register
Heinrich Schuchardt [Sun, 2 Jun 2019 11:05:08 +0000 (13:05 +0200)]
trace: conserve gd register

An UEFI application may change the value of the register that gd lives in.
But some of our functions like get_ticks() access this register. So we
have to set the gd register to the U-Boot value when entering a trace
point and set it back to the application value when exiting the trace
point.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotrace: undefined reference to `trace_early_init'
Heinrich Schuchardt [Sat, 1 Jun 2019 22:53:24 +0000 (00:53 +0200)]
trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: doc: add documentation for pre-reloc properties in SPL and TPL
Patrick Delaunay [Tue, 21 May 2019 17:19:13 +0000 (19:19 +0200)]
dm: doc: add documentation for pre-reloc properties in SPL and TPL

Add documentation for the pre-reloc property in SPL and TPL device-tree:
- u-boot,dm-pre-proper
- u-boot,dm-pre-reloc
- u-boot,dm-spl
- u-boot,dm-tpl

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agofdt: Allow indicating a node is for U-Boot proper only
Patrick Delaunay [Tue, 21 May 2019 17:19:12 +0000 (19:19 +0200)]
fdt: Allow indicating a node is for U-Boot proper only

This add missing parts for previous commit 06f94461a9f4
("fdt: Allow indicating a node is for U-Boot proper only")

At present it is not possible to specify that a node should be used before
relocation (in U-Boot proper) without it also ending up in SPL and TPL
device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotest: check u-boot properties in SPL device tree
Patrick Delaunay [Tue, 21 May 2019 17:19:11 +0000 (19:19 +0200)]
test: check u-boot properties in SPL device tree

Add a test to check the management of the U-boot relocation properties
for device tree SPL generation (fdtgrep result) and platdata:
- 'dm-pre-proper' and 'dm-tpl' not included in SPL
- 'dm-pre-reloc' and 'dm-spl' included in SPL

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agofdtdec: test: Fix memory leak
Thierry Reding [Mon, 20 May 2019 16:05:04 +0000 (18:05 +0200)]
fdtdec: test: Fix memory leak

Free the memory allocated to store the test FDT upon test completion to
avoid leaking the memory. We don't bother cleaning up on test failure
since the code is broken in that case and should be fixed, in which case
the leak would also go away.

Reported-by: Tom Rini <tom.rini@gmail.com>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodrivers: serial: lpuart: Enable Little Endian Support
Vabhav Sharma [Thu, 31 Jan 2019 12:08:10 +0000 (12:08 +0000)]
drivers: serial: lpuart: Enable Little Endian Support

By default LPUART driver with compatible string "fsl,ls1021a-lpuart"
support big-endian mode.On NXP SoC like LS1028A LPUART IP is
little-endian,Added support to Fetch LPUART IP Endianness from lpuart
device-tree node.

Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agospi: Avoid using malloc() in a critical function
Simon Glass [Sat, 18 May 2019 17:59:54 +0000 (11:59 -0600)]
spi: Avoid using malloc() in a critical function

In general we should avoid calling malloc() and free() repeatedly in
U-Boot lest we turn it into tianocore. In SPL this can make SPI flash
unusable since free() is often a nop and allocation space is limited.

In any case, these seems no need for malloc() since the number of bytes
is very small, perhaps less than 8.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: d13f5b254a (spi: Extend the core to ease integration of SPI
memory controllers)

4 years agoblk: Allow control of the block cache in TPL
Simon Glass [Sat, 18 May 2019 17:59:53 +0000 (11:59 -0600)]
blk: Allow control of the block cache in TPL

Generally block devices are not enabled in TPL, but in case they are,
add a Kconfig option for the block cache. This allows the setting (default
off) to be found with CONFIG_IS_ENABLED().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobootstage: Add support for TPL record count
Simon Glass [Sat, 18 May 2019 17:59:52 +0000 (11:59 -0600)]
bootstage: Add support for TPL record count

If bootstage is enabled in TPL it lacks a record count and so does not
build. Fix this by adding a new Kconfig option.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agox86: Add a forward struct declaration in coreboot_tables.h
Simon Glass [Sat, 18 May 2019 17:59:51 +0000 (11:59 -0600)]
x86: Add a forward struct declaration in coreboot_tables.h

This struct is not defined in this header file. Add a forward declaration
so that it can be included in any context.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agosandbox: Add documentation on how to run valgrind
Simon Glass [Sat, 18 May 2019 17:59:50 +0000 (11:59 -0600)]
sandbox: Add documentation on how to run valgrind

U-Boot sandbox can run with valgrind to check memory allocations. Add
documentation on how to do this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Correct spi flash operation
Simon Glass [Sat, 18 May 2019 17:59:49 +0000 (11:59 -0600)]
sandbox: Correct spi flash operation

Since the SPI nor conversion, 'sf probe' does not work on sandbox. Fix
this by using the expected compatible string in the flash node.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: cd35365762 (mtd: sf_probe: remove spi-flash compatible)

4 years agosandbox: Add a memory {} node
Simon Glass [Sat, 18 May 2019 17:59:48 +0000 (11:59 -0600)]
sandbox: Add a memory {} node

Add a memory node which indicates the size of sandbox memory.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Allo sdl-config to be overridden
Simon Glass [Sat, 18 May 2019 17:59:47 +0000 (11:59 -0600)]
sandbox: Allo sdl-config to be overridden

When cross-compiling, sometimes sdl-config must come from a different path
from the default. Add a way to override it, by adding SDL_CONFIG to the
environment before building U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Add a comment to board_init_f()
Simon Glass [Sat, 18 May 2019 17:59:46 +0000 (11:59 -0600)]
sandbox: Add a comment to board_init_f()

This function is used for both SPL and TPL. Add a comment to that effect.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: spl: Lower priority of standard loader
Simon Glass [Sat, 18 May 2019 17:59:45 +0000 (11:59 -0600)]
sandbox: spl: Lower priority of standard loader

We normally want to load U-Boot from SPL, but if a board wants to do
something else, it is currently not possible since the standard loader
has the top priority. Lower it to allow other SPL_LOAD_IMAGE_METHOD()
declarations to override it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Quit when hang() is called
Simon Glass [Sat, 18 May 2019 17:59:44 +0000 (11:59 -0600)]
sandbox: Quit when hang() is called

It doesn't make a lot of sense to hang on sandbox when hang() is called,
since the only way out is Ctrl-C. In fact, Ctrl-C does not work if the
terminal is in raw mode, which it will be if the command-line has not been
reached yet. In that case, Ctrl-Z / kill -9 must be used, which is not
very friendly.

Avoid all of this by quiting when hang() is called.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Exit when SYSRESET_POWER_OFF is requested
Simon Glass [Sat, 18 May 2019 17:59:43 +0000 (11:59 -0600)]
sandbox: Exit when SYSRESET_POWER_OFF is requested

At present this returns but it seems better to just exit sandbox
immediately.

Signed-off-by: Simon Glass <sjg@chromium.org>
reset

4 years agosandbox: Add an alias for SPI
Simon Glass [Sat, 18 May 2019 17:59:42 +0000 (11:59 -0600)]
sandbox: Add an alias for SPI

At present 'sf probe' does not work since it cannot find SPI bus 0. Add
an alias to correct this, now that we no-longer have the --spi_sf option.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Create a common sandbox DT
Simon Glass [Sat, 18 May 2019 17:59:41 +0000 (11:59 -0600)]
sandbox: Create a common sandbox DT

At present sandbox and sandbox64 have duplicated nodes. This is hard to
maintain since changes in one need to be manually added to the other.

Create a common file to solve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Sync up sandbox64.dts with main DT
Simon Glass [Sat, 18 May 2019 17:59:40 +0000 (11:59 -0600)]
sandbox: Sync up sandbox64.dts with main DT

Various nodes have been added and adjusted with sandbox. Move these
changes over to sandbox64.dts to keep these in sync.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoAdd a simple script to remove boards
Simon Glass [Sat, 18 May 2019 16:07:17 +0000 (10:07 -0600)]
Add a simple script to remove boards

This script attempts to create a git commit which removes a single board.
It is quite fallible and everything it does needs checking. But it can
help speed up the process.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
4 years agopatman: Update cover-coverage tests for Python 3
Simon Glass [Sat, 18 May 2019 04:00:54 +0000 (22:00 -0600)]
patman: Update cover-coverage tests for Python 3

We need slightly different commands to run code coverage with Python 3.
Update the RunTestCoverage() function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Update the README.entries file
Simon Glass [Sat, 18 May 2019 04:00:53 +0000 (22:00 -0600)]
binman: Update the README.entries file

A few minor changes have been made including one new entry. Update the
documentation with:

   $ binman -E >tools/binman/README.entries

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Document parallel tests
Simon Glass [Sat, 18 May 2019 04:00:52 +0000 (22:00 -0600)]
binman: Document parallel tests

Since binman can run tests in parallel, document this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Read map files as text
Simon Glass [Sat, 18 May 2019 04:00:51 +0000 (22:00 -0600)]
binman: Read map files as text

These files are text files so should be read as such, so that
string-equality assertions work as expected.

With this binman tests work correctly on Python 2 and Python 3:

PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt \
python ./tools/binman/binman -t

Change first line of binman.py to end "python3":

PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman \
python3 ./tools/binman/binman -t

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Fix up a format string in AssertInList()
Simon Glass [Sat, 18 May 2019 04:00:50 +0000 (22:00 -0600)]
binman: Fix up a format string in AssertInList()

Add the missing 's' to the required '%s' here.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Update 'text' entry for Python 3
Simon Glass [Sat, 18 May 2019 04:00:49 +0000 (22:00 -0600)]
binman: Update 'text' entry for Python 3

This code reads a binary value and then uses it as a string to look up
another value. Add conversions to make this work as expected on Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Update fmap code for Python 3
Simon Glass [Sat, 18 May 2019 04:00:48 +0000 (22:00 -0600)]
patman: Update fmap code for Python 3

This needs special care to ensure that the bytes type is used for
binary data. Add conversion code to deal with strings and bytes
correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Update entry_test to support Python 3
Simon Glass [Sat, 18 May 2019 04:00:47 +0000 (22:00 -0600)]
binman: Update entry_test to support Python 3

The reload() function is in a different place in Python 3. Update the code
to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Convert to use bytes type
Simon Glass [Sat, 18 May 2019 04:00:46 +0000 (22:00 -0600)]
binman: Convert to use bytes type

With Python 3 we want to use the 'bytes' type instead of 'str'. Adjust the
code accordingly so that it works on both Python 2 and Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Avoid changing a dict during iteration
Simon Glass [Sat, 18 May 2019 04:00:45 +0000 (22:00 -0600)]
binman: Avoid changing a dict during iteration

This code works OK in Python 2 but Python 3 complains. Adjust it to avoid
deleting elements from a dict while iterating through it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Allow reading files in text mode
Simon Glass [Sat, 18 May 2019 04:00:44 +0000 (22:00 -0600)]
patman: Allow reading files in text mode

While reading files in binary mode is the norm, sometimes we want to use
text mode. Add an optional parameter to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodtoc: Update dtb_platdata to support Python 3
Simon Glass [Sat, 18 May 2019 04:00:43 +0000 (22:00 -0600)]
dtoc: Update dtb_platdata to support Python 3

The only change needed is to update get_value() to support the 'bytes'
type correctly with Python 3.

With this the dtoc unit tests pass with both Python 2 and 3:

PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt python \
./tools/dtoc/dtoc -t

PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman python3 \
./tools/dtoc/dtoc -t

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodtoc: Update fdt_util for Python 3
Simon Glass [Sat, 18 May 2019 04:00:42 +0000 (22:00 -0600)]
dtoc: Update fdt_util for Python 3

Since we are now using the bytes type in Python 3, the conversion in
fdt32_to_cpu() is not necessary, so drop it.

Also use 'int' instead of 'long' to convert the integer value, since
'long' is not present in Python 3.

With this, test_fdt passes with both Python 2 and 3:

PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt python \
./tools/dtoc/test_fdt -t

PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman python3 \
./tools/dtoc/test_fdt -t

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodtoc: Add a unit test for BytesToValue()
Simon Glass [Sat, 18 May 2019 04:00:41 +0000 (22:00 -0600)]
dtoc: Add a unit test for BytesToValue()

Add a simple unit test for one of the cases of this function, so that any
fault can be seen directly, rather than appearing through the failure of
another test.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodtoc: Test full 64-bit properties with FdtCellsToCpu()
Simon Glass [Sat, 18 May 2019 04:00:40 +0000 (22:00 -0600)]
dtoc: Test full 64-bit properties with FdtCellsToCpu()

At present this test does not check the upper 32 bits of the returned
value. Add some additional tests to cover this.

Signed-off-by: Simon Glass <sjg@chromium.org>