]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
4 years agompc8xxx_spi: always use 8-bit characters, don't read or write garbage
Rasmus Villemoes [Tue, 11 Feb 2020 15:20:25 +0000 (15:20 +0000)]
mpc8xxx_spi: always use 8-bit characters, don't read or write garbage

There are a few problems with the current driver.

First, it unconditionally reads from dout/writes to din whether or not
those pointers are NULL. So for example a simple "sf probe" ends up
writing four bytes at address 0:

=> md.l 0x0 8
0000000045454545 45454545 05050505 05050505    EEEEEEEE........
0000001000000000 00000000 07070707 07070707    ................
=> sf probe 0
mpc8xxx_spi_xfer: slave spi@7000:0 dout 0FB53618 din 00000000 bitlen 8
mpc8xxx_spi_xfer: slave spi@7000:0 dout 00000000 din 0FB536B8 bitlen 48
SF: Detected s25sl032p with page size 256 Bytes, erase size 64 KiB, total 4 MiB
=> md.l 0x0 8
00000000ff000000 45454545 05050505 05050505    ....EEEE........
0000001000000000 00000000 07070707 07070707    ................

(here I've change the first debug statement to a printf, and made it
print the din/dout pointers rather than the uints they point at).

Second, as we can also see above, it always writes a full 32 bits,
even if a smaller amount was requested. So for example

=> mw.l $loadaddr 0xaabbccdd 8
=> md.l $loadaddr 8
02000000aabbccdd aabbccdd aabbccdd aabbccdd    ................
02000010aabbccdd aabbccdd aabbccdd aabbccdd    ................
=> sf read $loadaddr 0x400 6
device 0 offset 0x400, size 0x6
mpc8xxx_spi_xfer: slave spi@7000:0 dout 0FB536E8 din 00000000 bitlen 40
mpc8xxx_spi_xfer: slave spi@7000:0 dout 00000000 din 02000000 bitlen 48
SF: 6 bytes @ 0x400 Read: OK
=> sf read 0x02000010 0x400 8
device 0 offset 0x400, size 0x8
mpc8xxx_spi_xfer: slave spi@7000:0 dout 0FB53848 din 00000000 bitlen 40
mpc8xxx_spi_xfer: slave spi@7000:0 dout 00000000 din 02000010 bitlen 64
SF: 8 bytes @ 0x400 Read: OK
=> md.l $loadaddr 8
0200000045454545 45450000 aabbccdd aabbccdd    EEEEEE..........
0200001045454545 45454545 aabbccdd aabbccdd    EEEEEEEE........

Finally, when the bitlen is 24 mod 32 (e.g. requesting to read 3 or 7
bytes), the last three bytes and up being the wrong ones, since the
driver does a full 32 bit read and then shifts the wrong byte out:

=> mw.l $loadaddr 0xaabbccdd 4
=> md.l $loadaddr 4
02000000aabbccdd aabbccdd aabbccdd aabbccdd    ................
=> sf read $loadaddr 0x444 10
device 0 offset 0x444, size 0x10
mpc8xxx_spi_xfer: slave spi@7000:0 dout 0FB536E8 din 00000000 bitlen 40
mpc8xxx_spi_xfer: slave spi@7000:0 dout 00000000 din 02000000 bitlen 128
SF: 16 bytes @ 0x444 Read: OK
=> md.l $loadaddr 4
02000000552d426f 6f742032 3031392e 30342d30    U-Boot 2019.04-0
=> mw.l $loadaddr 0xaabbccdd 4
=> sf read $loadaddr 0x444 0xb
device 0 offset 0x444, size 0xb
mpc8xxx_spi_xfer: slave spi@7000:0 dout 0FB536E8 din 00000000 bitlen 40
mpc8xxx_spi_xfer: slave spi@7000:0 dout 00000000 din 02000000 bitlen 88
SF: 11 bytes @ 0x444 Read: OK
=> md.l $loadaddr 4
02000000552d426f 6f742032 31392e00 aabbccdd    U-Boot 219......

Fix all of that by always using a character size of 8, and reject
transfers that are not a whole number of bytes. While it ends being
more work for the CPU, we're mostly bounded by the speed of the SPI
bus, and we avoid writing to the mode register in every loop.

Based on work by Klaus H. Sørensen.

Cc: Klaus H. Sorensen <khso@prevas.dk>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agompc8xxx_spi: put max_cs to use
Rasmus Villemoes [Tue, 11 Feb 2020 15:20:24 +0000 (15:20 +0000)]
mpc8xxx_spi: put max_cs to use

Currently, max_cs is write-only; it's just set in
mpc8xxx_spi_ofdata_to_platdata and not otherwise used.

My mpc8309 was always resetting during an "sf probe 0". It turns out
dm_gpio_set_dir_flags() was being called with garbage, since nothing
had initialized priv->gpios[0] - our device tree used "cs-gpios"
rather than "gpios", so gpio_request_list_by_name() had returned 0.

That would have been a lot easier to figure out if the chip select
index was sanity checked, so rename max_cs to cs_count, and reject a
xfer with a too large cs index.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agogazerbeam: add clocks property to SPI node
Rasmus Villemoes [Tue, 11 Feb 2020 15:20:23 +0000 (15:20 +0000)]
gazerbeam: add clocks property to SPI node

Prepare for supporting setting different speeds in mpc8xxx_spi.c.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agogpio/mpc83xx_spisel_boot.c: gpio driver for SPISEL_BOOT signal
Klaus H. Sorensen [Tue, 11 Feb 2020 15:20:22 +0000 (15:20 +0000)]
gpio/mpc83xx_spisel_boot.c: gpio driver for SPISEL_BOOT signal

Some SoCs in the mpc83xx family, e.g. mpc8309, have a dedicated spi
chip select, SPISEL_BOOT, that is used by the boot code to boot from
flash.

This chip select will typically be used to select a SPI boot
flash. The SPISEL_BOOT signal is controlled by a single bit in the
SPI_CS register.

Implement a gpio driver for the spi chip select register. This allows a
spi driver capable of using gpios as chip select, to bind a chip select
to SPISEL_BOOT.

It may be a little odd to do this as a GPIO driver, since the signal
is neither GP or I, but it is quite convenient to present it to the
spi driver that way. The alternative it to teach mpc8xxx_spi to handle
the SPISEL_BOOT signal itself (that is how it's done in the linux
kernel, see commit 69b921acae8a)

Signed-off-by: Klaus H. Sorensen <khso@prevas.dk>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agogpio: mpc8xxx: don't do RMW on gpdat register when setting value
Rasmus Villemoes [Tue, 28 Jan 2020 12:04:34 +0000 (12:04 +0000)]
gpio: mpc8xxx: don't do RMW on gpdat register when setting value

The driver correctly handles reading back the value of an output gpio
by reading from the shadow register for output, and from gpdat for
inputs.

Unfortunately, when setting the value of some gpio, we do a RMW cycle
on the gpdat register without taking the shadow register into account,
thus accidentally setting other output gpios (at least those whose
value cannot be read back) to 0 at the same time.

When changing a gpio from input to output, we still need to make sure
it initially has the requested value. So, the procedure is

- update the shadow register
- compute the new gpdir register
- write the bitwise and of the shadow and new gpdir register to gpdat
- write the new gpdir register

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agogpio: mpc8xxx: don't modify gpdat when setting gpio as input
Rasmus Villemoes [Tue, 28 Jan 2020 12:04:33 +0000 (12:04 +0000)]
gpio: mpc8xxx: don't modify gpdat when setting gpio as input

Since some chips don't support reading back the value of output gpios
from the gpdat register, we should not do a RMW cycle (i.e., the
clrbits_be32) on the gpdat register when setting a gpio as input, as
that might accidentally change the value of some other (still
configured as output) gpio.

The extra indirection through mpc8xxx_gpio_set_in() does not help
readability, so just fold the gpdir update into
mpc8xxx_gpio_direction_input().

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agocmd: mmc: fix typo 'a EMMC'
Heinrich Schuchardt [Sun, 29 Mar 2020 19:26:57 +0000 (19:26 +0000)]
cmd: mmc: fix typo 'a EMMC'

%s/a EMMC/an eMMC/g

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agoimage-fit: Allow loading FIT image for VxWorks
Lihua Zhao [Wed, 18 Mar 2020 14:32:07 +0000 (07:32 -0700)]
image-fit: Allow loading FIT image for VxWorks

This adds the check against IH_OS_VXWORKS during FIT image load,
to allow loading FIT image for VxWorks.

Signed-off-by: Lihua Zhao <lihua.zhao@windriver.com>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoPrepare v2020.04-rc4
Tom Rini [Mon, 30 Mar 2020 23:29:27 +0000 (19:29 -0400)]
Prepare v2020.04-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq
Tom Rini [Mon, 30 Mar 2020 11:46:05 +0000 (07:46 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq

- Fixes env variable for layerscape platforms, disable hs200.
- Fixes board fixup, mux setting, enable gic, fspi on lx2160a, Fixes I2C
  DM Warning on ls1043a, ls1046a
- Fixes RGMII port on ls1046ardb, ls1046ardb and DM_USB Warning on
  ls1012afrdm, ls1021aiot

4 years agoMerge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Mon, 30 Mar 2020 11:45:25 +0000 (07:45 -0400)]
Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi

- SPL SPI support R40, H6 (Andre)
- eMMC boot part on a64-olinuxino (Petr)

4 years agoarm: dts: ls1028a: Use flexspi in octal I/O mode
Kuldeep Singh [Sat, 14 Mar 2020 12:53:55 +0000 (18:23 +0530)]
arm: dts: ls1028a: Use flexspi in octal I/O mode

Configure RX and TX bus-width values to use flexspi in octal I/O mode.
If bus-widths are not specified, then single I/O mode is set by default.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarm: dts: lx2160a: Use flexspi in octal I/O mode
Kuldeep Singh [Sat, 14 Mar 2020 12:53:56 +0000 (18:23 +0530)]
arm: dts: lx2160a: Use flexspi in octal I/O mode

Configure RX and TX bus-width values to use flexspi in octal I/O mode.
If bus-widths are not specified, then single I/O mode is set by default.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: lx2160a: Access flash memory as per spi-mem
Kuldeep Singh [Thu, 12 Mar 2020 09:43:00 +0000 (15:13 +0530)]
configs: lx2160a: Access flash memory as per spi-mem

MC_INIT and BOOT command currently access spi-nor flash memory directly.
As per spi-mem framework, flash memory access via absolute addresses is
no more possible. Use flash APIs to access memory instead of directly
using it.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: lx2160a: Define ENV_ADDR value
Kuldeep Singh [Tue, 4 Feb 2020 06:32:36 +0000 (12:02 +0530)]
configs: lx2160a: Define ENV_ADDR value

CONFIG_ENV_ADDR helps in picking environment from flash before DDR init.
Define the value as 0x20500000 for lx2160ardb and lx2160aqds.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: lx2160a: Enable FSPI support
Kuldeep Singh [Sat, 14 Mar 2020 13:13:41 +0000 (18:43 +0530)]
configs: lx2160a: Enable FSPI support

Enable FSPI controller support. So, flash environment can now be used.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarm: dts: lx2160aqds: Add FSPI node properties
Kuldeep Singh [Mon, 2 Mar 2020 11:09:19 +0000 (16:39 +0530)]
arm: dts: lx2160aqds: Add FSPI node properties

lx2160a-qds has 2 micron "mt35xu512aba" flashes of size 64M each
connected on A0 and B1 i.e on CS0 and CS3. Since flashes are connected
on different buses, only one flash can be probed at a time.

Add fspi node properties aligned with LX2160A-RDB fspi properties.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: ls1012afrwy: adjust env kernel_addr_r
Biwen Li [Fri, 20 Mar 2020 10:26:14 +0000 (18:26 +0800)]
configs: ls1012afrwy: adjust env kernel_addr_r

Adjust environment kernel_addr_r from 0x96000000 to 0x92000000
to fix a bug that failed to boot kernel for ls1012afrwy with 512MiB RAM,
=> tftpboot $kernel_addr_r Image (Image size is 36 MiB)
TFTP error: trying to overwrite reserved memory...

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: ls1021a: Append othbootargs to bootargs
Alison Wang [Mon, 16 Mar 2020 07:59:06 +0000 (15:59 +0800)]
configs: ls1021a: Append othbootargs to bootargs

This patch appends othbootargs to bootargs for LS1021ATWR board.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: disable eMMC HS200 support on layerscape platforms
Yangbo Lu [Tue, 3 Mar 2020 02:32:51 +0000 (10:32 +0800)]
configs: disable eMMC HS200 support on layerscape platforms

The eMMC HS200 speed mode on Layerscape platforms has not been
supported properly. The eSDHC clock tuning has not been implemented
by now. So disable it until it is supported properly in case of
any potential issues.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: ls1012ardb: secure boot: Add PFE config
Priyanka Singh [Fri, 21 Feb 2020 00:27:04 +0000 (05:57 +0530)]
configs: ls1012ardb: secure boot: Add PFE config

Add config to enable the PFE and ETH support.
Also change the pfe secure boot header address.

Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: arm: ls1021aiot: enable CONFIG_DM_USB support
Ran Wang [Fri, 7 Feb 2020 04:42:08 +0000 (12:42 +0800)]
configs: arm: ls1021aiot: enable CONFIG_DM_USB support

Enable CONFIG_DM_USB to remove below compile warning:

===================== WARNING ======================
This board does not use CONFIG_DM_USB. Please update
the board to use CONFIG_DM_USB before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/migration.rst for more info.
====================================================

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: arm64: ls1012afrdm Enable CONFIG_BLK
Ran Wang [Fri, 7 Feb 2020 04:42:07 +0000 (12:42 +0800)]
configs: arm64: ls1012afrdm Enable CONFIG_BLK

With DM_USB enabled, enable CONFIG_BLK to remove this
compile warning for ls1012afrdm based targets:

===================== WARNING ======================
This board does not use CONFIG_DM_USB. Please update
the board to use CONFIG_DM_USB before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/migration.rst for more info.
====================================================

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agodm: arm64: ls1046a: add i2c DM support
Biwen Li [Wed, 5 Feb 2020 14:02:17 +0000 (22:02 +0800)]
dm: arm64: ls1046a: add i2c DM support

This supports i2c DM and enables CONFIG_DM_I2C
for SoC LS1046A

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agodm: arm64: ls1043a: add i2c DM support
Biwen Li [Wed, 5 Feb 2020 14:02:16 +0000 (22:02 +0800)]
dm: arm64: ls1043a: add i2c DM support

This supports i2c DM and enables CONFIG_DM_I2C
for SoC LS1043A

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: ls1012afrwy: fix wrong env of board
Biwen Li [Fri, 20 Mar 2020 09:05:51 +0000 (17:05 +0800)]
configs: ls1012afrwy: fix wrong env of board

Fix wrong environment variable of board for ls1012afrwy

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarmv8: ls1028a: clean up the environment variables
Yuantian Tang [Fri, 20 Mar 2020 06:37:07 +0000 (14:37 +0800)]
armv8: ls1028a: clean up the environment variables

Move the environment variables from command head file to
ls1028ardb specific head file so that they will not mess
up with ls1028aqds board.
Also updated some variable slightly.
There is no function change by this patch.

Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarmv8: ls1028aqds: add some environments
Yuantian Tang [Fri, 20 Mar 2020 06:37:06 +0000 (14:37 +0800)]
armv8: ls1028aqds: add some environments

Add sd and emmc bootcmd environments to facilitate
the boot process.

Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: ls2080aqds: support distro boot
Biwen Li [Thu, 19 Mar 2020 12:01:07 +0000 (20:01 +0800)]
configs: ls2080aqds: support distro boot

Add support of distro boot for ls2080aqds

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: ls1088aqds: support distro boot
Biwen Li [Thu, 19 Mar 2020 11:38:42 +0000 (19:38 +0800)]
configs: ls1088aqds: support distro boot

Add support of distro boot for ls1088aqds

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoboard: fsl: lx2160a: fix SDHC1_DAT4 signal routing
Yangbo Lu [Thu, 19 Mar 2020 07:18:54 +0000 (15:18 +0800)]
board: fsl: lx2160a: fix SDHC1_DAT4 signal routing

The SDHC1_DAT4 signal could be routes to SDHC1_VS or SDHC1
adapter slot for SDHC1 usage. When SDHC1 is selected in RCW,
do not force to route it to SDHC1 adapter slot if find it
has already been configued for SDHC1_VS.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agopci-host-ecam-generic: access config space independent of system-wide bus id
Vladimir Oltean [Fri, 13 Mar 2020 14:53:06 +0000 (16:53 +0200)]
pci-host-ecam-generic: access config space independent of system-wide bus id

The pci-host-ecam-generic code assumes that the ECAM is the first PCI
bus in the system to be probed. Therefore, the system-wide bus number
allocated by U-Boot in sequence for it is going to be zero, which
corresponds to the memory-mapped config spaces found within it.

Reuse the logic from other PCI bus drivers, and assume that U-Boot will
allocate bus numbers in sequence for all buses within the current ECAM.
So the base number of the bus needs to be subtracted when indexing the
correct config space.

Fixes: 3675cb044e68 ("PCI: Add driver for a 'pci-host-ecam-generic' host controller")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoinclude/configs: ls1012afrwy: fix load address of itb with bootm command
Biwen Li [Fri, 13 Mar 2020 02:26:29 +0000 (10:26 +0800)]
include/configs: ls1012afrwy: fix load address of itb with bootm command

The old load address of itb will overwrite uboots reserved memory
on ls1012afrwy with 512 MiB ram

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarmv8/ls1046ardb: RGMII ports require internal delay
Madalin Bucur [Thu, 12 Mar 2020 12:53:46 +0000 (14:53 +0200)]
armv8/ls1046ardb: RGMII ports require internal delay

The correct setting for the RGMII ports on LS1046ARDB is to
enable delay on both Rx and Tx so the interface mode used must
be PHY_INTERFACE_MODE_RGMII_ID. There is a pull-up that turns
on Rx internal delay by default and the u-boot does not
override that (yet) so in u-boot the interface is functional.
In Linux the PHY driver is clearing the Rx delay for the
"rgmii-txid" mode and the reception does not work.
Changing the RGMII mode to internal delay here ensures that
device tree fix-ups for the PHY connection type turn on both
Tx and Rx internal delay in Linux.

Fixes: cc1aa218f510 ("armv8/ls1046a: RGMII PHY requires internal
delay on Tx")
Signed-off-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarmv8/ls1043ardb: RGMII ports require internal delay
Madalin Bucur [Thu, 12 Mar 2020 12:53:45 +0000 (14:53 +0200)]
armv8/ls1043ardb: RGMII ports require internal delay

The correct setting for the RGMII ports on LS1043ARDB is to
enable delay on both Rx and Tx so the interface mode used must
be PHY_INTERFACE_MODE_RGMII_ID. There is a pull-up that turns
on Rx internal delay by default and the u-boot does not
override that (yet) so in u-boot the interface is functional.
In Linux the PHY driver is clearing the Rx delay for the
"rgmii-txid" mode and the reception does not work.
Changing the RGMII mode to internal delay here ensures that
device tree fix-ups for the PHY connection type turn on both
Tx and Rx internal delay in Linux.

Fixes: 5a78a472f666 ("armv8/ls1043a: RGMII PHY requires internal
delay on Tx")
Signed-off-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agonet: fman: add support for all RGMII delay modes
Madalin Bucur [Thu, 12 Mar 2020 12:53:44 +0000 (14:53 +0200)]
net: fman: add support for all RGMII delay modes

The RGMII modes that include internal delay were not all
properly treated in the memac code. Add support for all
RGMII delay modes.

Fixes: 111fd19e3b9e ("fm/mEMAC: add mEMAC frame work")
Signed-off-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agolx2160a: Add dhcp in boot_targets
Meenakshi Aggarwal [Wed, 11 Mar 2020 15:21:47 +0000 (20:51 +0530)]
lx2160a: Add dhcp in boot_targets

Add dhcp in supported boot_targets for lx2160.

Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarmv8: ls1028a: add dhcp boot target device
Yuantian Tang [Tue, 10 Mar 2020 03:31:05 +0000 (11:31 +0800)]
armv8: ls1028a: add dhcp boot target device

Add DHCP boot target device to enable command bootcmd_dhcp.

Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoboard: ls1028ardb: add BOARD_LATE_INIT config
Yuantian Tang [Mon, 9 Mar 2020 06:10:07 +0000 (14:10 +0800)]
board: ls1028ardb: add BOARD_LATE_INIT config

Select BOARD_LATE_INIT config so that many board works can be done
in late init stage.

Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agolx2160a : Remove default VID setting
Meenakshi Aggarwal [Wed, 26 Feb 2020 11:16:48 +0000 (16:46 +0530)]
lx2160a : Remove default VID setting

Set VID to 800 mV for Rev1 and set VID as per switch settings
for Rev2.

Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarmv8: ls1028a: Update secure boot headers offset
Priyanka Singh [Fri, 21 Feb 2020 00:27:03 +0000 (05:57 +0530)]
armv8: ls1028a: Update secure boot headers offset

Update the secure boot headers offsets of Kernel and other
    firmware images for SD and XSPI boot sources used by
    esbc_validate command.

Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agolx2160a : Add emmc in boot_targets environment variable
Meenakshi Aggarwal [Wed, 19 Feb 2020 18:00:45 +0000 (23:30 +0530)]
lx2160a : Add emmc in boot_targets environment variable

Add emmc in supported boot_targets and
Add bootcmd environment variable for emmc boot.

Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarm64: ls1046a: remove fdt_high environment variable
Yuantian Tang [Wed, 19 Feb 2020 09:02:22 +0000 (17:02 +0800)]
arm64: ls1046a: remove fdt_high environment variable

Setting fdt_high and initrd_high to 0xffffffffffffffff leads to
various difficulty to resolve bugs.
Remove them and use bootm_size instead to safely contain a kernel,
device tree and initrd for relocation.

Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarm64: ls1028a: remove fdt_high environment variable
Yuantian Tang [Wed, 19 Feb 2020 09:02:21 +0000 (17:02 +0800)]
arm64: ls1028a: remove fdt_high environment variable

Setting fdt_high and initrd_high to 0xffffffffffffffff leads to
various difficulty to resolve bugs.
Remove them and use bootm_size instead to safely contain a kernel,
device tree and initrd for relocation.

Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoboard: fsl: lx2160a: Add GIC LPI memory reserve fixup
Wasim Khan [Fri, 14 Feb 2020 05:34:36 +0000 (11:04 +0530)]
board: fsl: lx2160a: Add GIC LPI memory reserve fixup

Reserve DDR memory region used for GIC LPI configuration table.

Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: lx2160a: Enable GIC_V3_ITS config
Wasim Khan [Fri, 14 Feb 2020 05:34:35 +0000 (11:04 +0530)]
configs: lx2160a: Enable GIC_V3_ITS config

Enable GIC_V3_ITS config to program GIC LPI
configuration table.

Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoboard: fsl: lx2160a: Program GIC LPI configuration table
Wasim Khan [Fri, 14 Feb 2020 05:34:34 +0000 (11:04 +0530)]
board: fsl: lx2160a: Program GIC LPI configuration table

Program GIC LPI configuration table:

1. Redistributor PROCBASER configuration table (which
is common for all redistributors)

2. Redistributor pending table (PENDBASER), for all the
available redistributors.

Signed-off-by: Manish Tomar <manish.tomar@nxp.com>
Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoboard: lx2160a: Correct board fixup for PCIe nodes
Vikas Singh [Wed, 12 Feb 2020 08:17:09 +0000 (13:47 +0530)]
board: lx2160a: Correct board fixup for PCIe nodes

Update "board_fix_fdt" with correct counter value "i".
This will fix the issue while fetching the "reg_names"
resource from fdt after fixup.

Signed-off-by: Vikas Singh <vikas.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agols1021a: Set CONFIG_SYS_BOOTMAPSZ to the memory for relocation
Alison Wang [Mon, 3 Feb 2020 07:25:19 +0000 (15:25 +0800)]
ls1021a: Set CONFIG_SYS_BOOTMAPSZ to the memory for relocation

This patch sets CONFIG_SYS_BOOTMAPSZ to the amount of memory available
to safely contain a kernel, device tree and initrd for relocation. The
way to set fdt_high as 0xffffffff to disable device tree relocation is
removed.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: a64-olinuxino-emmc: add eMMC boot part config commands
Petr Å tetiar [Sat, 28 Mar 2020 14:38:33 +0000 (20:08 +0530)]
configs: a64-olinuxino-emmc: add eMMC boot part config commands

mmc bootbus and partconf commands are needed in order to be able to
configure booting from separate boot0/boot1 eMMC partitions.

Signed-off-by: Petr Å tetiar <ynezz@true.cz>
[jagan: rebase on master]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agoMerge branch '2020-03-27-master-imports'
Tom Rini [Fri, 27 Mar 2020 21:54:38 +0000 (17:54 -0400)]
Merge branch '2020-03-27-master-imports'

- Update a few MAINTAINERS entries
- cache alignment fix in ext4 code
- Two small test fixes

4 years agotest: typo decompression
Heinrich Schuchardt [Mon, 23 Mar 2020 17:47:47 +0000 (18:47 +0100)]
test: typo decompression

%s/decopmression/decompression/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMAINTAINERS: add myself as maintainer of fs/btrfs
Marek Behún [Wed, 25 Mar 2020 11:04:46 +0000 (12:04 +0100)]
MAINTAINERS: add myself as maintainer of fs/btrfs

Signed-off-by: Marek Behún <marek.behun@nic.cz>
4 years agofs: ext4: Fix alignment of cache buffers
Jan Kiszka [Wed, 25 Mar 2020 20:27:51 +0000 (21:27 +0100)]
fs: ext4: Fix alignment of cache buffers

We need to align the cache buffer to ARCH_DMA_MINALIGN in order to avoid
access errors like

CACHE: Misaligned operation at range [be0231e0be0235e0]

seen on the MCIMX7SABRE.

Fixes: d5aee659f217 ("fs: ext4: cache extent data")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
4 years agoMAINTAINERS: Add usb.h entry to usb
Marek Vasut [Wed, 25 Mar 2020 20:35:53 +0000 (21:35 +0100)]
MAINTAINERS: Add usb.h entry to usb

Add usb.h file into the USB list.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
4 years agotest/py: mmc: Fix 'mmc info' testcase
Harald Seiler [Thu, 26 Mar 2020 17:07:27 +0000 (18:07 +0100)]
test/py: mmc: Fix 'mmc info' testcase

Commit 41e30dcf8796 ("cmd: mmc: Make Mode: printout consistent") fixed
the layout of `mmc info` output.  Reflect this change in the respective
testcase.

Also fix a typo in the documentation.

Fixes: 41e30dcf8796 ("cmd: mmc: Make Mode: printout consistent")
Signed-off-by: Harald Seiler <hws@denx.de>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoRevert "vexpress_ca9x4: Enable use of correct DTB file and restore EFI loader."
Tom Rini [Fri, 27 Mar 2020 15:47:04 +0000 (11:47 -0400)]
Revert "vexpress_ca9x4: Enable use of correct DTB file and restore EFI loader."

Currently this causes failures of the platform when running the EFI
loader tests, so disable it for now.

This reverts commit af827140e5965e5bb2bcad1c53ca8419b428ff6d.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge tag 'u-boot-rockchip-20200327' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Fri, 27 Mar 2020 01:39:59 +0000 (21:39 -0400)]
Merge tag 'u-boot-rockchip-20200327' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip

- Fixed for rv1108 and elgin-rv1108 board
- Fix the keyboard from USB instead of CrOS EC

4 years agorockchip: mkimage: Use an existing macro instead of a decimal value
Miquel Raynal [Wed, 18 Mar 2020 16:22:55 +0000 (17:22 +0100)]
rockchip: mkimage: Use an existing macro instead of a decimal value

Depending on the SoC, a header of four characters is prepended to the
image. There is already a macro defining the number of characters:
RK_SPL_HDR_SIZE, so use it instead of hardcoding "4".

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorv1108: Fix boot regression
Otavio Salvador [Fri, 13 Mar 2020 17:42:48 +0000 (14:42 -0300)]
rv1108: Fix boot regression

Since commit 79030a486128 ("rockchip: Add Single boot image
(with binman, pad_cat)") the following boot regression is seen:

U-Boot 2020.04-rc3-00050-gd16e18ca6c-dirty (Mar 09 2020 - 11:40:07 -0300)

Model: Elgin RV1108 R1 board
DRAM:  128 MiB
initcall sequence 67fd12a0 failed at call 6000b927 (err=-22)

This happens because the above commit missed to include the
"rockchip-u-boot.dtsi" for rv1108, so include this file
like it done for other Rockchip SoC dtsi's.

Fixes: 79030a486128 ("rockchip: Add Single boot image (with binman, pad_cat)")
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoelgin-rv1108: Avoid adc_channel_single_shot error
Otavio Salvador [Fri, 13 Mar 2020 17:42:47 +0000 (14:42 -0300)]
elgin-rv1108: Avoid adc_channel_single_shot error

Currently the following error message is seen during boot:

U-Boot 2020.01-08751-g55759ae141 (Mar 09 2020 - 14:44:52 -0300)

Model: Elgin RV1108 R1 board
DRAM:  128 MiB
APLL: 600000000 DPLL:1200000000 GPLL:1188000000
ACLK_BUS: 148500000 ACLK_PERI:148500000 HCLK_PERI:148500000 PCLK_PERI:74250000
MMC:   dwmmc@30110000: 0
Loading Environment from MMC... OK
In:    serial@10210000
Out:   serial@10210000
Err:   serial@10210000
Model: Elgin RV1108 R1 board
rockchip_dnl_key_pressed: adc_channel_single_shot fail!
....

Since the elgin-rv1108 does not use ADC to read the download
key status, select CONFIG_ROCKCHIP_BOOT_MODE_REG=0 to avoid
such error.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoelgin-rv1108: Use rk_board_late_init() for GPIO settings
Otavio Salvador [Fri, 13 Mar 2020 17:42:46 +0000 (14:42 -0300)]
elgin-rv1108: Use rk_board_late_init() for GPIO settings

Since commit 8e9a8d0d0c8c ("rockchip: elgin-rv1108: use board_early_init_f
for per-boar init") the function that configure the board GPIOs is no
longer called since CONFIG_BOARD_EARLY_INIT_F=y is not selected.

These GPIOs do not need to be configured in such early stagem, so change it
to rk_board_late_init() and also select CONFIG_BOARD_LATE_INIT=y
to fix the regression.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoARM: dts: Activate pullups in the console pins on rv1108-elgin-r1
Otavio Salvador [Fri, 13 Mar 2020 17:42:45 +0000 (14:42 -0300)]
ARM: dts: Activate pullups in the console pins on rv1108-elgin-r1

In order to make the console pins more robust to noise, activate
the pullups and increase its drive strength.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: Change keyboard input from CrOS EC keyboard to a USB keyboard
Peter Robinson [Mon, 2 Mar 2020 07:57:55 +0000 (07:57 +0000)]
rockchip: Change keyboard input from CrOS EC keyboard to a USB keyboard

These boards aren't ChromeOS devices so won't have a cros-ec-keyb
input as it's the keyboard available via the ChromeOS Embedded
Controller. Update them to use a USB keyboard which would actually
be available. Also enable the usb keyboard option for those devices
that don't have it enabled already.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: evb-rv1108: Use syscon API to get grf base
Kever Yang [Wed, 19 Feb 2020 01:46:06 +0000 (09:46 +0800)]
rockchip: evb-rv1108: Use syscon API to get grf base

Use syscon API to get grf base instead of get from dts.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agorockchip: elgin-rv1108: Use syscon API to get grf base
Kever Yang [Wed, 19 Feb 2020 01:46:05 +0000 (09:46 +0800)]
rockchip: elgin-rv1108: Use syscon API to get grf base

Use syscon API to get grf base instead of get from dts.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Otavio Salvador <otavio@ossystems.com.br>
4 years agovexpress_ca9x4: Enable use of correct DTB file and restore EFI loader.
Kristian Amlie [Tue, 25 Feb 2020 17:22:16 +0000 (18:22 +0100)]
vexpress_ca9x4: Enable use of correct DTB file and restore EFI loader.

EFI was disabled in f95b8a4b5f64f because of the missing DTB file,
and indeed, the DTB file is required to load recent versions of GRUB
(2.04) correctly.

Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
4 years agoMerge tag 'efi-2020-04-rc4-5' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 23 Mar 2020 14:14:31 +0000 (10:14 -0400)]
Merge tag 'efi-2020-04-rc4-5' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-04-rc4 (5)

This series contains bug fixes for the UEFI sub-system:

* report correct variable length in GetNextVariable()
* correct copying direction if freestanding memmove()
* remove const for parameter of GetNextVariableName()
* correct function descriptions

Unit tests are added and adjusted.

4 years agoefi_loader: definition of GetNextVariableName()
Heinrich Schuchardt [Sun, 22 Mar 2020 17:28:20 +0000 (18:28 +0100)]
efi_loader: definition of GetNextVariableName()

'vendor' is both an input and an output parameter. So it cannot be
constant.

Fixes: 0bda81bfdc5c ("efi_loader: use const efi_guid_t * for variable services")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_selftest: test CalculateCrc32, CopyMem, SetMem
Heinrich Schuchardt [Sun, 22 Mar 2020 08:32:55 +0000 (09:32 +0100)]
efi_selftest: test CalculateCrc32, CopyMem, SetMem

Provide unit tests for CalculateCrc32(), CopyMem(), SetMem().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: fix freestanding memmove()
Heinrich Schuchardt [Sun, 22 Mar 2020 08:52:48 +0000 (09:52 +0100)]
efi_loader: fix freestanding memmove()

For EFI binaries we have to provide an implementation of memmove() in
efi_freestanding.c.

Before this patch the memmove() function was copying in the wrong
direction.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: description efi_convert_pointer()
Heinrich Schuchardt [Sun, 22 Mar 2020 07:28:15 +0000 (08:28 +0100)]
efi_loader: description efi_convert_pointer()

Correct the description of function efi_convert_pointer().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: simplify logical expression in efi_disk_add_dev()
Heinrich Schuchardt [Thu, 19 Mar 2020 14:45:52 +0000 (15:45 +0100)]
efi_loader: simplify logical expression in efi_disk_add_dev()

To check if a variable is non-zero there is no need for '!= 0'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_selftest: check length reported by GetNextVariableName()
Heinrich Schuchardt [Fri, 20 Mar 2020 18:20:17 +0000 (19:20 +0100)]
efi_selftest: check length reported by GetNextVariableName()

GetNextVariableName should report the length of the variable including the
final 0x0000 in bytes.

Check this in the unit test.

Increase the buffer size for variable names. 40 bytes is too short.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: correct reported length in GetNextVariable()
Heinrich Schuchardt [Fri, 20 Mar 2020 18:04:34 +0000 (19:04 +0100)]
efi_loader: correct reported length in GetNextVariable()

The runtime service GetNextVariable() returns the length of the next
variable including the closing 0x0000. This length should be in bytes.

Comparing the output of EDK2 and U-Boot shows that this is currently not
correctly implemented:

EDK2:
OsIndicationsSupported: 46
PlatformLang: 26
PlatformLangCodes: 36

U-Boot:
OsIndicationsSupported: 23
PlatformLang: 13
PlatformLangCodes: 18

Provide correct length in GetNextVariable().

Fixes: d99a87f84b75 ("efi_loader: implement GetNextVariableName()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: fix function descriptions in efi_disk.c
Heinrich Schuchardt [Thu, 19 Mar 2020 12:49:34 +0000 (13:49 +0100)]
efi_loader: fix function descriptions in efi_disk.c

Use Sphinx style for function descriptions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: description of efi_variable.c
Heinrich Schuchardt [Thu, 19 Mar 2020 17:15:18 +0000 (17:15 +0000)]
efi_loader: description of efi_variable.c

Correct the file description.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agosunxi: Remove no longer needed default options from defconfigs
Andre Przywara [Thu, 20 Feb 2020 17:51:15 +0000 (17:51 +0000)]
sunxi: Remove no longer needed default options from defconfigs

Now that those common Allwinner config symbols are defined automatically
for all boards in their Kconfig files, we can remove the now redundant
definitions from the boards' _defconfig files.

Some boards had a differing definiton for some of those symbols, it
looks like mostly to "merge races" when the symbol was introduced (new
board *_defconfig file missed the "add symbol to all files" patch).

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # Amarula A64-Relic
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: Move common defconfig options to Kconfig
Andre Przywara [Thu, 20 Feb 2020 17:51:14 +0000 (17:51 +0000)]
sunxi: Move common defconfig options to Kconfig

Some config symbols are found in *almost* every _defconfig file for
Allwinner boards, because those options are actually a platform choice,
and not a per-board decision.
Some of these options are older, some have recently been added.

Move those options to be set for all Allwinner boards in their
respective Kconfig files.

The rationales are as follows:
- NR_DRAM_BANKS: All Allwinner SoC map DRAM at one contiguous region of
  address space only, starting at 1 GB. So it's always one bank.
- SPL_{DOS,EFI}_PARTITION: The Allwinner SPL does only support raw MMC
  accesses, we don't care about filesystems or partitions in there, so
  there is no need to define those symbols at all.
- USE_PREBOOT: We start USB early when a keyboard is configured, using the
  preboot env variable, so we need to set this variable.
- SYS_RELOC_GD_ENV_ADDR: We don't specify any ENV_ADDR, so need this
  symbol to be set (according to 8d8ee47e03e).
- SYS_USB_EVENT_POLL_VIA_INT_QUEUE: According to commit eab9433aa55428,
  specifying this reduces the latency of the USB keyboard handling, so
  this was formerly enabled in config headers for all Allwinner boards.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # Amarula A64-Relic
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: Pine H64: Enable SPI booting in defconfig
Andre Przywara [Tue, 28 Jan 2020 00:46:44 +0000 (00:46 +0000)]
sunxi: Pine H64: Enable SPI booting in defconfig

The Pine H64 board comes with some onboard SPI flash chip, which is
perfect for loading SPL, ATF and U-Boot proper from there.

Enable the functionality in the defconfig, so that we use sunxi-fel to
transfer a bootable image to the NOR flash.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: SPL SPI: Add SPI boot support for the Allwinner H6 SoC
Andre Przywara [Tue, 28 Jan 2020 00:46:43 +0000 (00:46 +0000)]
sunxi: SPL SPI: Add SPI boot support for the Allwinner H6 SoC

The Allwinner H6 SoC uses a quite different memory map, also changes the
clocks quite a bit. This requires some changes to the SPL SPI routine,
which hardcodes these values so far.

Using the just introduced helper functions to determine base address
and SPI controller generation, we can cover some of these differences
easily.
The clock setup is different, so requires some explicit code changes
there (reset and clock gate in one register at a different address).
Also we need to change the pinmux function to use a different set of
pins that the H6 uses for SPI0.

Eventually we can enable the H6 to use SPI booting in Kconfig.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: SPL SPI: Add SPI boot support for the Allwinner R40 SoC
Andre Przywara [Tue, 28 Jan 2020 00:46:42 +0000 (00:46 +0000)]
sunxi: SPL SPI: Add SPI boot support for the Allwinner R40 SoC

Now that we can easily select an SoC specific SPI0 base address, adding
support for the Allwinner R40 is fairly trivial:
We set the base address, add this SoC to the ones that use PC23 and
enable it in Kconfig.

This allows booting from SPI flash on R40 boards.

Tested on a Bananapi M2 Berry with SPI flash connected to the header pins.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: SPL SPI: Introduce is_sun6i_gen_spi()
Andre Przywara [Tue, 28 Jan 2020 00:46:41 +0000 (00:46 +0000)]
sunxi: SPL SPI: Introduce is_sun6i_gen_spi()

So far we were using the CONFIG_SUNXI_GEN_SUN6I symbol to select between
the two SPI controller generations used on Allwinner SoCs. This is a
convenience symbol to roughly differentiate between "older" and "newer"
generation of SoCs.

The H6 SoCs is the newest SoC so far, but is sufficiently different to
not define this symbol. However it is using a SPI controller compatible
to the "new gen" SoCs.

To prepare for H6 support, we replace the check for this single symbol
with an explicit function, which can later be extended.
For now we just return CONFIG_SUNXI_GEN_SUN6I in there, so this does not
create a functional change.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: SPL SPI: Split off SPI0 base address
Andre Przywara [Tue, 28 Jan 2020 00:46:40 +0000 (00:46 +0000)]
sunxi: SPL SPI: Split off SPI0 base address

So far on all supported Allwinner SoCs we find the old generation SPI
controller always at address 0x1c05000, and the new generation one at
0x1c68000. However the Allwinner R40 SoC has a new generation SPI at
the old address, and the H6 uses a completely different address.

So split off the base address from the respective SPI registers, by
changing the #defines to just contain offsets.
The base address is provided by a function, so it can easily be extended
later when support for those SoCs materialises.

This does not change the code size (since the toolchain is clever enough
to optimise this properly), also does not bring any functional change at
this point.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agoMerge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Wed, 18 Mar 2020 11:48:53 +0000 (07:48 -0400)]
Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi

- Revert "sunxi: psci: avoid error address-of-packed-member"

4 years agoMerge tag 'efi-2020-04-rc4-4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Wed, 18 Mar 2020 11:48:39 +0000 (07:48 -0400)]
Merge tag 'efi-2020-04-rc4-4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-04-rc4 (4)

This series fixes several bugs:

* consider the /reserved-memory node in the device tree
* consider memory reservations created in ft_board_setup()
* correct output of 'efidebug memmap' on the sandbox
* correct the definition of efi_capsule_header()

Furthermore some definitions needed for future patches are added to
header files.

4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Wed, 18 Mar 2020 11:48:11 +0000 (07:48 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Fix sbi_remote_sfence_vma{,_asid}.
- Avoid calling sbi_clear_ipi().
- Add new SBI v0.2 extensions support.

4 years agoRevert "sunxi: psci: avoid error address-of-packed-member"
Tomasz Duszynski [Sun, 16 Feb 2020 12:17:16 +0000 (13:17 +0100)]
Revert "sunxi: psci: avoid error address-of-packed-member"

Using memcpy() for some MMIO access is generally frowned upon and might
break things on some platforms. Allwinner H3, which fails to boot, being
an example here.

Moreover, fields being accessed are naturally aligned and warnings
produced by GCC have been quiesced for some time already by:

53dc8ae ("gcc-9: silence 'address-of-packed-member' warning")

That said, it should be okay to revert this commit.

This reverts commit 9bd34a69a453d409792e08c00953ce8862145e65.

Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agoefi_loader: correct a definition of struct efi_capsule_header
AKASHI Takahiro [Tue, 17 Mar 2020 02:12:37 +0000 (11:12 +0900)]
efi_loader: correct a definition of struct efi_capsule_header

See UEFI specification, section 8.5.3.
In addition, the structure, efi_capsule_header, should be "packed"
as it is a serialized binary format in a capsule file.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: export a couple of protocol related functions
AKASHI Takahiro [Tue, 17 Mar 2020 02:12:36 +0000 (11:12 +0900)]
efi_loader: export a couple of protocol related functions

This is a preparatory patch.
Those functions will be used in an implementation of UEFI firmware
management protocol as part of my capsule update patch.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: define System Resource Table macros
AKASHI Takahiro [Tue, 17 Mar 2020 02:12:35 +0000 (11:12 +0900)]
efi_loader: define System Resource Table macros

Some of those values will be used in an implementation of UEFI firmware
management protocol as part of my capsule update patch.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: define OsIndicationsSupported flags
AKASHI Takahiro [Tue, 17 Mar 2020 02:12:34 +0000 (11:12 +0900)]
efi_loader: define OsIndicationsSupported flags

These flags are expected to be set in OsIndicationsSupported variable
if corresponding features are supported. See UEFI specification,
section 8.5.4.

In particular, capsule-related flags will be used in my capsule
update patch.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Fix misspelled EFI_OS_INDICATIONS_BOOT_TO_FW_UI.
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd: bootefi: Parse reserved-memory node from DT
Atish Patra [Sat, 14 Mar 2020 00:11:30 +0000 (17:11 -0700)]
cmd: bootefi: Parse reserved-memory node from DT

Currently, bootefi only parses memory reservation block to setup
EFI reserved memory mappings. However, it doesn't parse the
reserved-memory[1] device tree node that also can contain the
reserved memory regions.

Add capability to parse reserved-memory node and update the EFI memory
mappings accordingly.

1. <U-Boot source>/doc/device-tree-bindings/reserved-memory/reserved-memory.txt]

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Fix an endless loop.

The /reserved-memory node may have children without reg property. Remove
a superfluous debug statement.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd: map addresses to sysmem in efidebug memmap
Heinrich Schuchardt [Sat, 14 Mar 2020 07:44:07 +0000 (08:44 +0100)]
cmd: map addresses to sysmem in efidebug memmap

Addresses in the sandbox's device tree are in the sandbox's virtual address
space. If we want to compare memory reservations in the device-tree with
the output of 'efidebug memmap', we need to convert back to this address
space.

Adjust the output of the 'efidebug memmap' command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: create reservations after ft_board_setup
Heinrich Schuchardt [Sat, 14 Mar 2020 09:59:34 +0000 (10:59 +0100)]
efi_loader: create reservations after ft_board_setup

Some memory reservations are made in ft_board_setup(). Ensure that we
create reserved memory map entries after ft_board_setup().

The downside of this patch is that if bootefi is called multiple times with
an devicetree argument superfluous reservations for the old copies of the
device tree will exist. But that is still better than missing a reservation.

Deleting the superfluous reservations is not possible because reservations
in the memory map are rounded to page size and may be coallesced.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoriscv: Implement new SBI v0.2 extensions
Bin Meng [Tue, 10 Mar 2020 02:35:31 +0000 (19:35 -0700)]
riscv: Implement new SBI v0.2 extensions

Few v0.1 SBI calls are being replaced by new SBI calls that follows
v0.2 calling convention.

Implement the replacement extensions and few additional new SBI
function calls that makes way for a better SBI interface in future.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
4 years agoriscv: Introduce a new config for SBI v0.1
Bin Meng [Tue, 10 Mar 2020 02:35:30 +0000 (19:35 -0700)]
riscv: Introduce a new config for SBI v0.1

We now have SBI v0.2 which is more scalable and extendable to handle
future needs for RISC-V supervisor interfaces.

Introduce a new config and move all SBI v0.1 code under that config.
This allows to implement the new replacement SBI extensions cleanly
and remove v0.1 extensions easily in future. Currently, the config
is enabled by default. Once all M-mode software, with v0.1, is no
longer in use, this config option and all relevant code can be easily
removed.

This commit is inspired from Linux kernel patch:
https://patchwork.kernel.org/patch/11407361/

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
4 years agoriscv: Add SBI v0.2 extension definitions
Bin Meng [Tue, 10 Mar 2020 02:35:29 +0000 (19:35 -0700)]
riscv: Add SBI v0.2 extension definitions

Few v0.1 SBI calls are being replaced by new SBI calls that follows
v0.2 calling convention.

This patch just defines these new extensions.

This commit is inspired from Linux kernel patch:
https://patchwork.kernel.org/patch/11407359/

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
4 years agoriscv: Add basic support for SBI v0.2
Bin Meng [Tue, 10 Mar 2020 02:35:28 +0000 (19:35 -0700)]
riscv: Add basic support for SBI v0.2

The SBI v0.2 introduces a base extension which is backward compatible
with v0.1. Implement all helper functions and minimum required SBI
calls from v0.2 for now. All other base extension function will be
added later as per need.

As v0.2 calling convention is backward compatible with v0.1, remove
the v0.1 helper functions and just use v0.2 calling convention.

Add a new Kconfig options CONFIG_SBI for the new SBI v0.2 codes, and
let CONFIG_SBI_IPI depend on it.

This commit is inspired from Linux kernel patch:
https://patchwork.kernel.org/patch/11407363/

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
4 years agoriscv: Mark existing SBI as v0.1 SBI
Bin Meng [Tue, 10 Mar 2020 02:35:27 +0000 (19:35 -0700)]
riscv: Mark existing SBI as v0.1 SBI

As per the new SBI specification, current SBI implementation version
is defined as 0.1 and will be removed/replaced in future. Each of the
function call in 0.1 is defined as a separate extension which makes
easier to replace them one at a time.

Rename existing implementation to reflect that. This patch is just
a preparatory patch for SBI v0.2 and doesn't introduce any functional
changes.

This commit is inspired from Linux kernel patch:
https://patchwork.kernel.org/patch/11407355/

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>