platform/kernel/u-boot.git
2 years agoconfigs: bcm96753ref_ram_defconfig: enable led support
Philippe Reynes [Thu, 17 Feb 2022 16:17:07 +0000 (17:17 +0100)]
configs: bcm96753ref_ram_defconfig: enable led support

Enable the led support on the refboard bcm96753ref.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2 years agoarch: arm: dts: bcm96753ref: enable led support
Philippe Reynes [Thu, 17 Feb 2022 16:17:06 +0000 (17:17 +0100)]
arch: arm: dts: bcm96753ref: enable led support

Enable the led in the device tree of the refboard bcm96753ref.
It also defines two leds (led_red ad led_green).

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2 years agoarch: arm: dts: bcm6753: add led support
Philippe Reynes [Thu, 17 Feb 2022 16:17:05 +0000 (17:17 +0100)]
arch: arm: dts: bcm6753: add led support

Add a node leds to support the LED IP in the
device tree of the bcm6753.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2 years agodrivers: led: led_bcm6753: initial support
Philippe Reynes [Thu, 17 Feb 2022 16:17:04 +0000 (17:17 +0100)]
drivers: led: led_bcm6753: initial support

Add the support of the LED IP for bcm6357. This
LED IP supports blinking, fading and pulsating,
but for the moment, only blinking is supported.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2 years agobcm96753ref: add initial support
Philippe Reynes [Fri, 11 Feb 2022 18:18:38 +0000 (19:18 +0100)]
bcm96753ref: add initial support

This add the initial support of the broadcom reference
board bcm96753ref with a bcm6753 SoC.

This board has 1 GB of RAM, 256 MB of flash (nand),
2 USB port, 1 UART, and 4 ethernet ports.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2 years agowatchdog: bcm6345: allow to use this driver on arm bcm6753
Philippe Reynes [Fri, 11 Feb 2022 18:18:37 +0000 (19:18 +0100)]
watchdog: bcm6345: allow to use this driver on arm bcm6753

This IP is also used on some arm SoC, so we allow to
use it on arm bcm6753 too.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2 years agonand: brcmnand: add bcm6753 support
Philippe Reynes [Fri, 11 Feb 2022 18:18:36 +0000 (19:18 +0100)]
nand: brcmnand: add bcm6753 support

This adds the nand support for chipset bcm6753.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2 years agogpio: bcm6345: allow to use this driver on arm bcm6753
Philippe Reynes [Fri, 11 Feb 2022 18:18:35 +0000 (19:18 +0100)]
gpio: bcm6345: allow to use this driver on arm bcm6753

This IP is also used on some arm SoC, so we allow to
use it on arm bcm6753 too.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2 years agobcm6753: add initial support
Philippe Reynes [Fri, 11 Feb 2022 18:18:34 +0000 (19:18 +0100)]
bcm6753: add initial support

This add the initial support of the broadcom bcm6753 SoC family.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2 years agoarm64: zynqmp: Fix level of gpio reset for usb on kv260 boards
Michal Simek [Wed, 23 Feb 2022 15:17:42 +0000 (16:17 +0100)]
arm64: zynqmp: Fix level of gpio reset for usb on kv260 boards

Active level is low that's why it should be fixed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/86b3a96ce990b0ee0adab221146b5a5c751bd4a9.1645629459.git.michal.simek@xilinx.com
2 years agoarm64: zynqmp: Enable DP driver for SOMs
Michal Simek [Wed, 23 Feb 2022 15:17:41 +0000 (16:17 +0100)]
arm64: zynqmp: Enable DP driver for SOMs

The main reason is to send pmufw cfg overlay from U-Boot to PMUFW to enable
access to DP. Overlay is sent when cls command is called and for that IP
has to be enabled in carrier cards.
And IP needs to be also enabled in SOM dt because with DTB reselection new
DT is not parsed in pre reloc U-Boot instance. It is called from board_f
via embedded_dtb_select(). That's why bind function is not able to allocate
memory and it ends up with error:
"Video device 'display@fd4a0000' cannot allocate frame buffer memory
-ensure the device is set up before relocation"

To avoid this situation DP is placed also to SOM where bind function is
called and frame buffer memory is allocated and just reused after DTB
reselection. Result is the same. There could be a problem in Linux with
different DP configurations but that's need to be solved there because
console should be on from u-boot already.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/c4f31641f917fddb09d976f56875057c658f264c.1645629459.git.michal.simek@xilinx.com
2 years agoarm64: zynqmp: Switch to ethernet-phy-id in kv260
Michal Simek [Wed, 23 Feb 2022 15:17:40 +0000 (16:17 +0100)]
arm64: zynqmp: Switch to ethernet-phy-id in kv260

Use ethernet-phy-id compatible string to properly describe phy reset on
kv260 boards. Previous description wasn't correct because reset was done
for mdio bus to operate and it was in this case used for different purpose
which was eth phy reset. With ethernet-phy-id phy reset happens only for
the phy via phy framework.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/73b64f1a2b873b4e26bd2b365364bdf313794ae2.1645629459.git.michal.simek@xilinx.com
2 years agoarm64: zynqmp: Use assigned-clock-rates for setting up clock in SOM
Michal Simek [Wed, 23 Feb 2022 15:17:39 +0000 (16:17 +0100)]
arm64: zynqmp: Use assigned-clock-rates for setting up clock in SOM

With limited low level configuration done via psu-init only IPs connected
on SOM are initialized and configured. All IPs connected to carrier card
are not initialized. There is a need to do proper reset, pin configuration
and also clock setting.
The patch targets the last part which is setting up proper clock for USBs
and SDs.
Also setup proper bus width for SD cards.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
Link: https://lore.kernel.org/r/d9f80b2551bd246c3d7ecb09b516806c8dc83ed9.1645629459.git.michal.simek@xilinx.com
2 years agoarm64: zynqmp: Setup clock for DP and DPDMA
Michal Simek [Wed, 23 Feb 2022 15:17:38 +0000 (16:17 +0100)]
arm64: zynqmp: Setup clock for DP and DPDMA

Clocks are coming from shared HW design where these frequencies should be
aligned with PLL setup.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/04454c50d0d13e450976942085d763ab5aa38f98.1645629459.git.michal.simek@xilinx.com
2 years agoarm64: zynqmp: Move usb hub from i2c to usb node
Michal Simek [Wed, 23 Feb 2022 15:17:37 +0000 (16:17 +0100)]
arm64: zynqmp: Move usb hub from i2c to usb node

Based on upstream discussion based on link below usb hub should be placed
to usb node directly as child node. Based on this Linux driver was updated
and the same change should be also reflected in kv260 board.

Link: https://lore.kernel.org/all/CAL_JsqJZBbu+UXqUNdZwg-uv0PAsNg55026PTwhKr5wQtxCjVQ@mail.gmail.com/
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/aa18df1978f161b933e6cdc6cd99c807b5f74398.1645629459.git.michal.simek@xilinx.com
2 years agomicroblaze: Do not place u-boot to reserved memory location
Michal Simek [Tue, 1 Mar 2022 08:13:20 +0000 (09:13 +0100)]
microblaze: Do not place u-boot to reserved memory location

Microblaze can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in Zynqmp by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location").

This feature was tested with this memory description on kc705:

memory {
device_type = "memory";
reg = <0x80000000 0x40000000>;
};

reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;

alloc@b00000000 {
reg = <0xb0000000 0x10000000>;
no-map;
};

alloc@a8000000 {
reg = <0xa8000000 0x00010000>;
no-map;
};
};

And in U-Boot log you can check u-boot relocation address and reserved
locations.
U-Boot 2022.01-03974-gb1b4c2dea9b9 (Feb 25 2022 - 11:59:48 +0100)

Model: Xilinx MicroBlaze
DRAM:  1 GiB
Flash: 128 MiB
Loading Environment from nowhere... OK
In:    serial
Out:   serial
Err:   serial
Model: Xilinx MicroBlaze
Net:   AXI EMAC: 40c00000, phyaddr 7, interface gmii
eth0: ethernet@40c00000
U-BOOT for microblaze-generic

U-Boot-mONStR> bdi
...
DRAM bank   = 0x00000000
-> start    = 0x80000000
-> size     = 0x40000000
...
relocaddr   = 0xaff69000
...
lmb_dump_all:
 memory.cnt  = 0x1
 memory[0] [0x80000000-0xbfffffff], 0x40000000 bytes flags: 0
 reserved.cnt  = 0x3
 reserved[0] [0xa8000000-0xa800ffff], 0x00010000 bytes flags: 4
 reserved[1] [0xafe87bb0-0xafffffff], 0x00178450 bytes flags: 0
 reserved[2] [0xb0000000-0xbfffffff], 0x10000000 bytes flags: 4

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/ea0a8ccce723478eb518f6fdceb91d4f129efb68.1646122398.git.michal.simek@xilinx.com
2 years agopower: zynqmp: Use zynqmp_pmufw_node() from firmware
Michal Simek [Tue, 1 Mar 2022 08:10:59 +0000 (09:10 +0100)]
power: zynqmp: Use zynqmp_pmufw_node() from firmware

Remove private xpm_configobject[] and use zynqmp_pmufw_node() which
provides the same functionality.
Also add debug messages for easier debugging.

Fixes: e0283cbdfd49 ("power: zynqmp: Add power domain driver for ZynqMP")
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Link: https://lore.kernel.org/r/bddf11459b9b9e849fac9a50db2f1a5fdfae4119.1646122254.git.michal.simek@xilinx.com
2 years agogpio: slg7xl45106: Add support for slg7xl45106 i2c gpo expander
T Karthik Reddy [Wed, 23 Feb 2022 15:21:30 +0000 (16:21 +0100)]
gpio: slg7xl45106: Add support for slg7xl45106 i2c gpo expander

slg7xl45106 is i2c based 8-bit gpo expander, gpo pins are set and get by
writing and reading corresponding gpo bit value into its data register.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/839f475cc75c97ffb3496a4caa93de2faabdbca2.1645629688.git.michal.simek@xilinx.com
2 years agommc: zynq_sdhci: Enable card detect workaround for ZynqMP
Ashok Reddy Soma [Wed, 23 Feb 2022 14:13:32 +0000 (15:13 +0100)]
mmc: zynq_sdhci: Enable card detect workaround for ZynqMP

Card detect state stable issue is observed on few ZynqMP boards(SOM),
so enable the workaround 'commit b6f44082d5cd ("mmc: zynq_sdhci: Wait
till sd card detect state is stable")' for ZynqMP platforms also.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/0bf6154c79f24227d786efc5e2c1f506185b2bce.1645625609.git.michal.simek@xilinx.com
2 years agommc: zynq_sdhci: Change granularity of timeout to 1us
Ashok Reddy Soma [Wed, 23 Feb 2022 14:13:31 +0000 (15:13 +0100)]
mmc: zynq_sdhci: Change granularity of timeout to 1us

The timeout used in 'commit b6f44082d5cd ("mmc: zynq_sdhci: Wait
till sd card detect state is stable")' workaround is 1000ms at a
granularity of 1msec. Change it to 1usec, to not waste time incase the
cd is stable.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/f008d2bcf864702a01564789f14f9cdecb8acd45.1645625609.git.michal.simek@xilinx.com
2 years agommc: zynq_sdhci: Fix timeout issue
Ashok Reddy Soma [Wed, 23 Feb 2022 14:13:30 +0000 (15:13 +0100)]
mmc: zynq_sdhci: Fix timeout issue

In the workaround added with 'commit b6f44082d5cd ("mmc: zynq_sdhci: Wait
till sd card detect state is stable")' the timeout variable has post
decrement. Whenever timeout happens, this post decrement is making
timeout=0xffffffff, so timeout error print and return statement are
never reached. Fix it by decrementing it inside the while loop.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/61fc1160ada0dd622cd29e381a74af7bf3d9a200.1645625609.git.michal.simek@xilinx.com
2 years agoARM: dts: zynq: add NAND flash controller node
Michael Walle [Wed, 23 Feb 2022 14:10:34 +0000 (15:10 +0100)]
ARM: dts: zynq: add NAND flash controller node

Recently, a driver for the ARM Primecell PL35x static memory controller
(including NAND controller) was added in linux. Add the corresponding
device tree node.

Also update cfi-flash registers and location in DT.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/20210616155437.27378-3-michael@walle.cc
Link: https://lore.kernel.org/r/ee81d3846a1ce93f240d61537d404796e5599c1c.1645625433.git.michal.simek@xilinx.com
2 years agomtd: nand: Update driver to match new DT binding
Michal Simek [Wed, 23 Feb 2022 14:10:33 +0000 (15:10 +0100)]
mtd: nand: Update driver to match new DT binding

New binding changed node name from flash@e1000000 to nand-controller@0,0
which should be reflected in the driver. Both names are supported for
backward compatibility.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/61f6edd965e0c0b179184823d5283c6c61a1eb35.1645625433.git.michal.simek@xilinx.com
2 years agodm: pinctrl: Use explicit values for enums
Ashok Reddy Soma [Wed, 23 Feb 2022 14:02:51 +0000 (15:02 +0100)]
dm: pinctrl: Use explicit values for enums

Based on discussion at
https://lore.kernel.org/r/20200318125003.GA2727094@kroah.com we got
recommendation to use explicit values for all enums.

So, add explicit values to all pinctrl related enums for readability.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/dcdb20e7252ea7465e9f984d815e9624c30e9558.1645624969.git.michal.simek@xilinx.com
2 years agoRevert "board: zynqmp: Fix for wrong AMS setting by ROM"
T Karthik Reddy [Wed, 23 Feb 2022 14:01:37 +0000 (15:01 +0100)]
Revert "board: zynqmp: Fix for wrong AMS setting by ROM"

This reverts commit dfbe492edef421de09617dc26805fc428440924e.
Analog bus control register should be programmed in SPL only. This commit
3414712ba8a ("arm64: zynqmp: Writing correct value to ANALOG_BUS") is
programming the same. So revert this commit.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/215bc936e36f88d2e7c4422ec68cad6d40cb8f68.1645624892.git.michal.simek@xilinx.com
2 years agofru: ops: Add support to read mac addresses from multirecord
Ashok Reddy Soma [Wed, 23 Feb 2022 14:00:59 +0000 (15:00 +0100)]
fru: ops: Add support to read mac addresses from multirecord

Add support to read MAC addresses from mac address multirecord.
Check if multi record is found, then jump to mac address multirecord by
comparing the record type field. If it matches mac address
multirecord(0xD2), then copy mac addresses.

Copy these read MAC address in xilinx_read_eeprom_fru so that they are
updated to eth*addr in board_late_init_xilinx().

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/18f31bc528820934854ea5fd9dc581778fc1e40c.1645624855.git.michal.simek@xilinx.com
2 years agoxilinx: common: Optimise updating ethaddr from eeprom
Ashok Reddy Soma [Wed, 23 Feb 2022 14:00:58 +0000 (15:00 +0100)]
xilinx: common: Optimise updating ethaddr from eeprom

In board_late_init_xilinx() eth*addr are updated from the values read from
eeprom. Ideally the MAC addresses are updated sequencially. So if any
MAC address is invalid, it means there are no further valid values.
So optimise this logic by replacing continue with break.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/efef0d07add5d5777396ea111ad75411dc402db3.1645624855.git.michal.simek@xilinx.com
2 years agofru: ops: Return error from checksum if data is all zero's
Ashok Reddy Soma [Wed, 23 Feb 2022 14:00:57 +0000 (15:00 +0100)]
fru: ops: Return error from checksum if data is all zero's

fru_checksum function is simply adding all the bytes and returning the
sum. If the data passed to this function is all zero's then it will
return 0, and the functions calling this api will assume that checksum
is correct. Ideally this is not good. Fix this by returning error if all
the data is 0's.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/ac0366fe55c60a818a3f9ed33d96826c817d5520.1645624855.git.michal.simek@xilinx.com
2 years agofru: ops: Clear fru table before storing data
Ashok Reddy Soma [Wed, 23 Feb 2022 14:00:56 +0000 (15:00 +0100)]
fru: ops: Clear fru table before storing data

Fill fru table with 0's before using it, to avoid junk data.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e5f15caf9c2102316e39f300d7c9c1ecb6be8439.1645624855.git.michal.simek@xilinx.com
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Sun, 6 Mar 2022 01:46:55 +0000 (20:46 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-sunxi

- Fix ARMv5/F1C100 FEL booting
- Fix F1C100 reset
- Introduce proper F1C100 boot method detection
- Enable SPI booting for F1C100

Boot tested from FEL, SPI, SD card and eMMC (where applicable) on
Pine64-LTS, Pine-H64, BananaPi M1, OrangePi Zero, LicheePi Nano(F1C100).

2 years agoMerge branch '2022-03-04-assorted-minor-fixes'
Tom Rini [Sat, 5 Mar 2022 16:34:31 +0000 (11:34 -0500)]
Merge branch '2022-03-04-assorted-minor-fixes'

- mailmap file updates, OpenSSL code cleanup, assorted TI platform
  fixes, typo fix.

2 years agolib: rsa: use actual OpenSSL 1.1.0 EVP MD API
Yann Droneaud [Tue, 1 Mar 2022 15:12:34 +0000 (16:12 +0100)]
lib: rsa: use actual OpenSSL 1.1.0 EVP MD API

Since OpenSSL 1.1.0, EVP_MD_CTX_create() is EVP_MD_CTX_new()
                     EVP_MD_CTX_destroy() is EVP_MD_CTX_free()
                     EVP_MD_CTX_init() is EVP_MD_CTX_reset()

As there's no need to reset a newly created EVP_MD_CTX, moreover
EVP_DigestSignInit() does the reset, thus call to EVP_MD_CTX_init()
can be dropped.
As there's no need to reset an EVP_MD_CTX before it's destroyed,
as it will be reset by EVP_MD_CTX_free(), call to EVP_MD_CTX_reset()
is not needed and can be dropped.

Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
2 years ago.mailmap: Record all address for main U-Boot contributor
Michal Simek [Tue, 1 Mar 2022 11:43:32 +0000 (12:43 +0100)]
.mailmap: Record all address for main U-Boot contributor

Based on looking at top contributors it was seen that top statistics from
top contributors don't include all contributions from different email
addresses. That's why I checked all top contributors are checked it.

git shortlog -n $START..$END -e -s

The patch is adding mapping for Bin Meng, Marek Vasut, Masahiro Yamada,
Michal Simek, Tom Rini, Wolfgang Denk.
And also use mapping for Stefan Roese and Wolfgang Denk to be properly
counted.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agomkimage: error handling for FIT image
Heinrich Schuchardt [Tue, 1 Mar 2022 07:53:56 +0000 (08:53 +0100)]
mkimage: error handling for FIT image

If parameter -F is given but FIT support is missing, a NULL pointer might
dereferenced (Coverity CID 350249).

If incorrect parameters are given, provide a message and show usage.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agocmd: pwm: fix typo 'eisable' -> 'disable'
Sébastien Szymanski [Fri, 25 Feb 2022 13:48:54 +0000 (14:48 +0100)]
cmd: pwm: fix typo 'eisable' -> 'disable'

Fixed misspelled 'disable' in help text.

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
2 years agoarm: dts: iot2050: Add cfg register space for ringacc and udmap
Jan Kiszka [Wed, 16 Feb 2022 08:06:49 +0000 (09:06 +0100)]
arm: dts: iot2050: Add cfg register space for ringacc and udmap

Recent unrelated fixes (9876ae7db6da) revealed that we were missing bits
from 2af181b53e28 in the IOT2050 dt. Add them, but only for main U-Boot.
SPL loads from QSPI only, thus cannot use DMA.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2 years agoconfigs: j721e_*_evm_a72_defconfig: Enable config for setting mmc speed mode
Aswath Govindraju [Wed, 16 Feb 2022 05:57:24 +0000 (11:27 +0530)]
configs: j721e_*_evm_a72_defconfig: Enable config for setting mmc speed mode

Enable config for setting mmc speed mode from U-Boot command line.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
2 years agoarm: mach-k3: am6_init: Use CONFIG_TI_I2C_BOARD_DETECT
Christian Gmeiner [Tue, 15 Feb 2022 06:47:55 +0000 (07:47 +0100)]
arm: mach-k3: am6_init: Use CONFIG_TI_I2C_BOARD_DETECT

We only want to call do_board_detect() if CONFIG_TI_I2C_BOARD_DETECT
is set. Same as done for am64.

This makes it possible to add a custom am65 based board design to
U-Boot that does not use this board detection mechanism.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
2 years agoconfigs: ti: use standard configuration nodes naming
Romain Naour [Thu, 10 Feb 2022 22:13:36 +0000 (23:13 +0100)]
configs: ti: use standard configuration nodes naming

Currently, any u-boot bootloader for ti armv7 platforms using
DEFAULT_FIT_TI_ARGS to boot with a fitimage (boot_fit = 1)
doesn't boot when built with Yocto Poky (openembedded-core).

  ## Loading kernel from FIT Image at 90000000 ...
  Could not find configuration node
  ERROR: can't get kernel image!

Arago forked the kernel-fitimage class [1] and altered the
configuration nodes naming while adding the OPTEE support by
using FITIMAGE_CONF_BY_NAME by default [2].

The "upstream" kernel-fitimage class from openembedded-core still
add the "conf-" prefix for each configuration nodes [3].

The ITS file format (from doc/uImage.FIT/source_file_format.txt)
is not really accurate with the expected naming of these nodes.
But in practice the "conf-" prefix is widely used.

When the FIT image support has been added for ti armv7 platforms
the naming from Arago has been used [3]. Fix this issue by adding
the prefix expected by the ITS file generated by kernel-fitimage
class from openembedded-core.

[1] http://arago-project.org/git/meta-arago.git?p=meta-arago.git;a=commitdiff;h=719ab1b2098bcdc59c249e3529fa82cb1b9130e6
[2] http://arago-project.org/git/meta-arago.git?p=meta-arago.git;a=commitdiff;h=f23f2876a0cda89241d031bb7ba0b4256ed90035
[3] https://git.openembedded.org/openembedded-core/tree/meta/classes/kernel-fitimage.bbclass?h=yocto-3.1.13#n290
[3] 1e93cc8473e4fe018aececc8ed3bf8fc2b3ff561

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Denys Dmytriyenko <denys@konsulko.com>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Fri, 4 Mar 2022 13:27:32 +0000 (08:27 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- pci_mvebu: Minor cleanup (Pali)
- mvebu: turris_omnia: Enable ext4 write support (Marek)
- a37xx: Misc fixes in PCI and pinctrl (Pali & Marek)
- a38x/rtc: Fix null pointer access (Francios)
- mvebu: x530: clearfog: Fix ODT configuration (Chris)
- kwboot: Fix boot and terminal mode (Pali)

2 years agotools: kwboot: Update references with public links
Pali Rohár [Wed, 2 Mar 2022 10:49:27 +0000 (11:49 +0100)]
tools: kwboot: Update references with public links

Public documents about BootROM of some Marvell SoCs are available in the
public Web Archive. Put this information into source code.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Update doc about Avanta
Pali Rohár [Wed, 2 Mar 2022 10:49:26 +0000 (11:49 +0100)]
tools: kwboot: Update doc about Avanta

Testes proved that current kwboot version supports also Avanta SoCs.
It looks like that Avanta SoCs are using same kwbimage format as Armada.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Update manpage
Pali Rohár [Wed, 2 Mar 2022 10:49:25 +0000 (11:49 +0100)]
tools: kwboot: Update manpage

Document -D, -b, -d, -q and -s options.

Add common examples how to use kwboot.

Add information about Armada 38x BootROM bug for debug console mode and how
to workaround it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Update usage
Pali Rohár [Wed, 2 Mar 2022 10:49:24 +0000 (11:49 +0100)]
tools: kwboot: Update usage

Add all supported Armada SoCs and document -b and -d options in usage.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Add support for backspace key in mini terminal
Pali Rohár [Wed, 2 Mar 2022 10:49:23 +0000 (11:49 +0100)]
tools: kwboot: Add support for backspace key in mini terminal

Marvell BootROM recognize only '\b' byte as backspace. Use terminfo
for retrieving current backspace sequence and replace any occurrence of
backspace sequence by the '\b' byte.

Reading terminfo database is possible via tigetstr() function from system
library libtinfo.so.*. So link kwboot with -ltinfo.

Normally terminfo functions are in <term.h> system header file. But this
header file conflicts with U-Boot "termios_linux.h" header file. So declare
terminfo functions manually.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Fix sending and processing debug message pattern (-d option)
Pali Rohár [Wed, 2 Mar 2022 10:49:22 +0000 (11:49 +0100)]
tools: kwboot: Fix sending and processing debug message pattern (-d option)

-d option is currently broken. In most cases BootROM does not detect this
message pattern. For sending debug message pattern it is needed to do same
steps as for boot message pattern.

Implement sending debug message pattern via same separate thread like it is
for boot message pattern.

Checking if BootROM entered into UART debug mode is different than
detecting UART boot mode. When in boot mode, BootROM sends xmodem NAK
bytes. When in debug mode, BootROM activates console echo and reply back
every written byte (extept \r\n which is interpreted as executing command
and \b which is interpreting as removing the last sent byte).

So in kwboot, check that BootROM send back at least 4 debug message
patterns as a echo reply for debug message patterns which kwboot is sending
in the loop.

Then there is another observation, if host writes too many bytes (as
command) then BootROM command line buffer may overflow after trying to
execute such long command. To workaround this overflow, it is enough to
remove bytes from the input line buffer by sending 3 \b bytes for every
sent character. So do it.

With this change, it is possbile to enter into the UART debug mode with
kwboot -d option.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Use separate thread for sending boot message pattern
Pali Rohár [Wed, 2 Mar 2022 10:49:21 +0000 (11:49 +0100)]
tools: kwboot: Use separate thread for sending boot message pattern

After BootROM successfully detects boot message pattern on UART it waits
until host stop sending data on UART. For example Armada 385 BootROM
requires that host does not send anything on UART at least 24 ms. If host
is still sending something then BootROM waits (possibly infinitely).

BootROM successfully detects boot message pattern if it receives it in
small period of time after power on.

So to ensure that host put BootROM into UART boot mode, host must send
continuous stream of boot message pattern with a small gap (for A385 at
least 24 ms) after series of pattern. But this gap cannot be too often or
too long to ensure that it does not cover whole BootROM time window when it
is detecting for boot message pattern.

Therefore it is needed to do following steps in cycle without any delay:
1. send series of boot message pattern over UART
2. wait until kernel transmit all data
3. sleep small period of time

At the same time, host needs to monitor input queue, data received on the
UART and checking if it contains NAK byte by which BootROM informs that
xmodem transfer is ready.

But it is not possible to wait until kernel transmit all data on UART and
at the same time in the one process to also wait for input data. This is
limitation of POSIX tty API and also by linux kernel that it does not
provide asynchronous function for waiting until all data are transmitted.
There is only synchronous variant tcdrain().

So to correctly implement this handshake on systems with linux kernel, it
is needed to use tcdrain() in separate thread.

Implement sending of boot message pattern in one thread and reading of
reply in the main thread. Use pthread library for threads.

This change makes UART booting on Armada 385 more reliable. It is possible
to start kwboot and power on board after minute and kwboot correctly put
board into UART boot mode.

Old implementation without separate thread has an issue that it read just
one byte from UART input queue and then it send 128 message pattern to the
output queue. If some noise was on UART then kwboot was not able to read
BootROM response as its input queue was just overflowed and kwboot was
sending more data than receiving.

This change basically fixed above issue too.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Cleanup bootmsg and debugmsg variables
Pali Rohár [Wed, 2 Mar 2022 10:49:20 +0000 (11:49 +0100)]
tools: kwboot: Cleanup bootmsg and debugmsg variables

Function kwboot_debugmsg() is always called with kwboot_msg_debug as msg
and function kwboot_bootmsg() with kwboot_msg_debug as msg. Function
kwboot_bootmsg() is never called with NULL msg.

Simplify, cleanup and remove dead code.

No functional change.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Remove msg_req_delay
Pali Rohár [Wed, 2 Mar 2022 10:49:19 +0000 (11:49 +0100)]
tools: kwboot: Remove msg_req_delay

Variable msg_req_delay is set but never used. So completely remove it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Check for return value of kwboot_tty_send() and tcflush()
Pali Rohár [Wed, 2 Mar 2022 10:49:18 +0000 (11:49 +0100)]
tools: kwboot: Check for return value of kwboot_tty_send() and tcflush()

Failure of kwboot_tty_send() and tcflush() functions is fatal, it does not
make sense to continue. So return error back to the caller like in other
places where are called these functions.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
2 years agoARM: mvebu: x530: clearfog: Add ODT configuration
Chris Packham [Tue, 1 Mar 2022 00:53:23 +0000 (13:53 +1300)]
ARM: mvebu: x530: clearfog: Add ODT configuration

Commit 369e532691e0 ("ddr: marvell: a38x: allow board specific ODT
configuration") added the odt_config member to struct
mv_ddr_topology_map ahead of the clk_enable and ck_delay members. This
means that any boards that configured either of clk_enable or ck_delay
needed to have their board topology updated. This affects the x530 and
clearfog boards. Other A38x boards don't touch any of the trailing
members of mv_ddr_topology_map so don't need updating.

Fixes: 369e532691e0 ("ddr: marvell: a38x: allow board specific ODT configuration")
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm64: a37xx: pinctrl: Fix PWM pins indexes
Marek Behún [Mon, 28 Feb 2022 14:59:37 +0000 (15:59 +0100)]
arm64: a37xx: pinctrl: Fix PWM pins indexes

Commit 5534fb4f4833 ("arm64: a37xx: pinctrl: Correct PWM pins
definitions") introduced bogus definitions os PWM pins: all 4 pins have
index 11, instead of having indexes 11, 12, 13, 14.

Fix this.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agodrivers: rtc: fix null pointer access in armada38x_rtc_reset
Francois Berder [Mon, 28 Feb 2022 09:31:45 +0000 (10:31 +0100)]
drivers: rtc: fix null pointer access in armada38x_rtc_reset

Replace null pointer by pointer to device registers when calling
armada38x_rtc_write.

Signed-off-by: Francois Berder <fberder@outlook.fr>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Fix a3700_fdt_fix_pcie_regions() function again
Pali Rohár [Wed, 23 Feb 2022 12:52:32 +0000 (13:52 +0100)]
arm: a37xx: pci: Fix a3700_fdt_fix_pcie_regions() function again

The a3700_fdt_fix_pcie_regions() function still computes nonsense.

It computes the fixup offset from the PCI address taken from the first
row of the "ranges" array, which means that:
- PCI address must equal CPU address (otherwise the computed fix offset
  will be wrong),
- the first row must contain the lowest address.

This is the case for the default device-tree, which is why we didn't
notice it.

It also adds the fixup offset to all PCI and CPU addresses, which is
wrong.

Instead:
1) The fixup offset must be computed from the CPU address, not PCI
   address.

2) The fixup offset must be computed from the row containing the lowest
   CPU address, which is not necessarily contained in the first row.

3) The PCI address - the address to which the PCIe controller remaps the
   address space as seen from the point of view of the PCIe device -
   must be fixed by the fix offset in the same way as the CPU address
   only in the special case when the CPU adn PCI addresses are the same.
   Same addresses means that remapping is disabled, and thus if we
   change the CPU address, we need also to change the PCI address so
   that the remapping is still disabled afterwards.

Consider an example:
  The ranges entries contain:
    PCI address   CPU address
    70000000      EA000000
    E9000000      E9000000
    EB000000      EB000000

  By default CPU PCIe window is at:        E8000000 - F0000000
  Consider the case when TF-A moves it to: F2000000 - FA000000

  Until now the function would take the PCI address of the first entry:
  70000000, and the new base, F2000000, to compute the fix offset:
  F2000000 - 70000000 = 82000000, and then add 8200000 to all addresses,
  resulting in
    PCI address   CPU address
    F2000000      6C000000
    6B000000      6B000000
    6D000000      6D000000
  which is complete nonsense - none of the CPU addresses is in the
  requested window.

  Now it will take the lowest CPU address, which is in second row,
  E9000000, and compute the fix offset F2000000 - E9000000 = 09000000,
  and then add it to all CPU addresses and those PCI addresses which
  equal to their corresponding CPU addresses, resulting in
    PCI address   CPU address
    70000000      F3000000
    F2000000      F2000000
    F4000000      F4000000
  where all of the CPU addresses are in the needed window.

Fixes: 4a82fca8e330 ("arm: a37xx: pci: Fix a3700_fdt_fix_pcie_regions() function")
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_omnia: Enable ext4 write support in defconfig
Marek Behún [Fri, 18 Feb 2022 16:46:25 +0000 (17:46 +0100)]
arm: mvebu: turris_omnia: Enable ext4 write support in defconfig

Enable ext4 write support in Turris Omnia's defconfig. Some users find
it useful.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopci: pci_mvebu: Cleanup macro names
Pali Rohár [Fri, 18 Feb 2022 11:25:23 +0000 (12:25 +0100)]
pci: pci_mvebu: Cleanup macro names

Use "MVPCIE_" prefix instead of generic "PCIE_" prefix for pci_mvebu.c
specific macros. Define offset macros for Root Port registers and use
standard register macros from pci.h when accessing Root Port registers.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopci: pci_mvebu: Remove unused SELECT and lane_mask
Pali Rohár [Fri, 18 Feb 2022 11:25:22 +0000 (12:25 +0100)]
pci: pci_mvebu: Remove unused SELECT and lane_mask

Macro SELECT() is unused and struct mvebu_pcie field lane_mask is unused
too. Remove them.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Fix quitting terminal
Pali Rohár [Fri, 18 Feb 2022 11:24:13 +0000 (12:24 +0100)]
tools: kwboot: Fix quitting terminal

Sometimes kwboot after quitting terminal prints error message:

  terminal: Bad address

This is caused by trying to call write() syscall with count of (size_t)-1
bytes.

When quit sequence is split into more read() calls then number of input
bytes (nin) at the end of cycle can underflow and be negative. Fix it.

Fixes: de7514046ea5 ("tools: kwboot: Fix detection of quit esc sequence")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoMerge branch '2022-03-03-Kconfig-migrations' into next
Tom Rini [Thu, 3 Mar 2022 21:51:24 +0000 (16:51 -0500)]
Merge branch '2022-03-03-Kconfig-migrations' into next

- Assorted Kconfig migrations and related cleanups.

2 years agoConvert CONFIG_CHIP_SELECTS_PER_CTRL to Kconfig
Tom Rini [Fri, 25 Feb 2022 16:19:53 +0000 (11:19 -0500)]
Convert CONFIG_CHIP_SELECTS_PER_CTRL to Kconfig

This converts the following to Kconfig:
   CONFIG_CHIP_SELECTS_PER_CTRL

Cc: Alison Wang <alison.wang@nxp.com>
Cc: Pramod Kumar <pramod.kumar_1@nxp.com>
Cc: Priyanka Jain <priyanka.jain@nxp.com>
Cc: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Cc: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoConvert CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS to Kconfig
Tom Rini [Fri, 25 Feb 2022 16:19:52 +0000 (11:19 -0500)]
Convert CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS to Kconfig

This converts the following to Kconfig:
   CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agonet: Remove CONFIG_BOOTP_DHCP_REQUEST_DELAY
Tom Rini [Fri, 25 Feb 2022 16:19:51 +0000 (11:19 -0500)]
net: Remove CONFIG_BOOTP_DHCP_REQUEST_DELAY

This option is not in use anywhere and the documentation implies it's
for some very old and unlikely to be seen currently issues.  Rather than
update the code so the CONFIG symbol could be easily in Kconfig, remove
the code.

Cc: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Ramon Fried <rfried.dev@gmail.com>
2 years agoConvert CONFIG_BOOTP_MAY_FAIL et al to Kconfig
Tom Rini [Fri, 25 Feb 2022 16:19:50 +0000 (11:19 -0500)]
Convert CONFIG_BOOTP_MAY_FAIL et al to Kconfig

This converts the following to Kconfig:
   CONFIG_BOOTP_MAY_FAIL
   CONFIG_BOOTP_VENDOREX
   CONFIG_BOOTP_BOOTFILESIZE
   CONFIG_BOOTP_NISDOMAIN
   CONFIG_BOOTP_TIMEOFFSET

Cc: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agopowerpc: P1010RDB: Move CONFIG_BOOTMODE out of CONFIG namespace
Tom Rini [Fri, 25 Feb 2022 16:19:49 +0000 (11:19 -0500)]
powerpc: P1010RDB: Move CONFIG_BOOTMODE out of CONFIG namespace

This slight environment modification shouldn't be in the CONFIG
namespace, change it.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoConvert CONFIG_BOOTFILE to Kconfig
Tom Rini [Fri, 25 Feb 2022 16:19:48 +0000 (11:19 -0500)]
Convert CONFIG_BOOTFILE to Kconfig

This converts the following to Kconfig:
   CONFIG_BOOTFILE

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoConvert CONFIG_BOARD_POSTCLK_INIT to Kconfig
Tom Rini [Fri, 25 Feb 2022 16:19:47 +0000 (11:19 -0500)]
Convert CONFIG_BOARD_POSTCLK_INIT to Kconfig

This converts the following to Kconfig:
   CONFIG_BOARD_POSTCLK_INIT

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoConvert CONFIG_BOARD_ECC_SUPPORT to Kconfig
Tom Rini [Fri, 25 Feb 2022 16:19:46 +0000 (11:19 -0500)]
Convert CONFIG_BOARD_ECC_SUPPORT to Kconfig

This converts the following to Kconfig:
   CONFIG_BOARD_ECC_SUPPORT

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoConvert CONFIG_BIOSEMU to Kconfig
Tom Rini [Fri, 25 Feb 2022 16:19:45 +0000 (11:19 -0500)]
Convert CONFIG_BIOSEMU to Kconfig

This converts the following to Kconfig:
   CONFIG_BIOSEMU

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoConvert CONFIG_BOARD_COMMON to Kconfig
Tom Rini [Wed, 23 Feb 2022 17:28:17 +0000 (12:28 -0500)]
Convert CONFIG_BOARD_COMMON to Kconfig

This converts the following to Kconfig:
   CONFIG_BOARD_COMMON

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoarm: exynos: Move BL1/2 SPI flash defines to their user, drop CONFIG
Tom Rini [Wed, 23 Feb 2022 17:28:16 +0000 (12:28 -0500)]
arm: exynos: Move BL1/2 SPI flash defines to their user, drop CONFIG

These particular values are not configurable and today we always set
CONFIG_SECURE_BL1_ONLY.  Move these to where they're used in the code,
and drop from the CONFIG namespace.

Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
2 years agoConvert CONFIG_BTB to Kconfig
Tom Rini [Wed, 23 Feb 2022 17:28:15 +0000 (12:28 -0500)]
Convert CONFIG_BTB to Kconfig

This converts the following to Kconfig:
   CONFIG_BTB

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agopowerpc: Remove unused MPC8540/60ADS code
Tom Rini [Wed, 23 Feb 2022 17:28:14 +0000 (12:28 -0500)]
powerpc: Remove unused MPC8540/60ADS code

Remove some code, primarily CPM2 related, that is now unused since the
removal of MPC8540/60ADS.

Fixes 3913191c8a6b ("powerpc: mpc8540ads: mpc8560ads: Drop support for MPC8540/60ADS")
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch '2022-03-02-scmi-updates' into next
Tom Rini [Thu, 3 Mar 2022 19:16:14 +0000 (14:16 -0500)]
Merge branch '2022-03-02-scmi-updates' into next

- A small set of scmi updates

2 years agoMerge tag 'u-boot-at91-fixes-2022.04-a' of https://source.denx.de/u-boot/custodians...
Tom Rini [Thu, 3 Mar 2022 13:24:37 +0000 (08:24 -0500)]
Merge tag 'u-boot-at91-fixes-2022.04-a' of https://source.denx.de/u-boot/custodians/u-boot-at91

First set of u-boot-atmel fixes for the 2022.04 cycle:

This fixes set includes only a single fix for the Ethernet on sama7g5ek
board which is broken at the moment.

2 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq
Tom Rini [Thu, 3 Mar 2022 13:24:13 +0000 (08:24 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq

Update and fixes for sl28, lx2, pblimage generation for some powerpc
products

2 years agosunxi: f1c100s: Drop SYSRESET to enable reset functionality
Andre Przywara [Wed, 2 Mar 2022 01:30:55 +0000 (01:30 +0000)]
sunxi: f1c100s: Drop SYSRESET to enable reset functionality

The F1C100s DT contains the wrong compatible string for the watchdog,
which breaks reset functionality.
Updating the DT goes via the Linux tree, but to allow reset
functionality meanwhile (useful for development!), disable SYSRESET for
now, to let the old-fashioned watchdog driver kick in and provide the
reset_cpu() implementation.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: f1c100s: Fix FEL registers restore
Andre Przywara [Tue, 1 Mar 2022 12:21:58 +0000 (12:21 +0000)]
sunxi: f1c100s: Fix FEL registers restore

Commit 88998f777531 ("arm: arm926ej-s: Add sunxi code") introduced
the ARM926 version of the code to save and restore some FEL state, to
be able to return to the BROM FEL code after the SPL has run.

However during review a change was made, that happened to mess up the
register restore part, so SCTLR and CPSR ended up with the wrong values,
breaking return to FEL.

Use the same offset that we actually save those registers to, to make
FEL booting actually work on the Lichee Pi Nano.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agomach-sunxi: Enable SPI boot for SUNIV and licheepi nano
Jesse Taube [Sat, 12 Feb 2022 00:32:35 +0000 (19:32 -0500)]
mach-sunxi: Enable SPI boot for SUNIV and licheepi nano

Enable SPI boot in SPL on SUNIV architecture and use
it in the licheepi nano that uses the F1C100s.

Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agomach-sunxi: Add SPL SPI boot for SUNIV
Jesse Taube [Sat, 12 Feb 2022 00:32:34 +0000 (19:32 -0500)]
mach-sunxi: Add SPL SPI boot for SUNIV

The SUNIV SoCs come with a sun6i-style SPI controller at the base address
of sun4i SPI controller. The module clock of the SPI controller is
missing which leaves us running directly from the AHB clock, which is
set to 200MHz.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
[Icenowy: Original implementation]
Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
[Jesse: adaptation to Upstream U-Boot]
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agomach-sunxi: Add boot device detection for SUNIV/F1C100s
Jesse Taube [Sat, 12 Feb 2022 00:32:33 +0000 (19:32 -0500)]
mach-sunxi: Add boot device detection for SUNIV/F1C100s

In contrast to other Allwinner SoCs the F1C100s BROM does not store a
boot source indicator in the eGON header in SRAM. This leaves the SPL
guessing where we were exactly booted from, and for instance trying
the SD card first, even though we booted from SPI flash.

By inspecting the BROM code and by experimentation, Samuel found that the
top of the BROM stack contains unique pointers for each of the boot
sources, which we can use as a boot source indicator.

This patch removes the existing board_boot_order bodge and replace it
with a proper boot source indication function.

The only caveat is that this only works in the SPL, as the SPL header
gets overwritten with the exception vectors, once U-Boot proper takes
over. Always return MMC0 as the boot source, when called from U-Boot
proper, as a placeholder for now, until we find another way.

Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Suggested-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoclk: scmi: register scmi clocks with CCF
Etienne Carriere [Mon, 21 Feb 2022 08:22:42 +0000 (09:22 +0100)]
clk: scmi: register scmi clocks with CCF

Implements SCMI APIs to retrieve the number exposed SCMI clocks using
SCMI_PROTOCOL_ATTRIBUTES messages and the names of the clocks using
SCMI_CLOCK_ATTRIBUTES messages.

This change updates sandbox SCMI clock test driver to manage these
2 new message IDs.

Cc: Lukasz Majewski <lukma@denx.de>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Clement Leger <clement.leger@bootlin.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2 years agofirmware: scmi: fix sandbox and related tests for clock discovery
Etienne Carriere [Mon, 21 Feb 2022 08:22:41 +0000 (09:22 +0100)]
firmware: scmi: fix sandbox and related tests for clock discovery

Updates sandbox SCMI clock driver and tests since enabling CCF will
mandate clock discovery that is all exposed SCMI clocks shall be
discovered at initialization. For this reason, sandbox SCMI clock
driver must emulate all clocks exposed by SCMI server, not only those
effectively consumed by some other U-Boot devices.

Therefore the sandbox SCMI test driver exposes 3 clocks (IDs 0, 1 and 2)
and sandbox SCMI clock consumer driver gets 2 of them.

Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2 years agoscmi: change parameter dev in devm_scmi_process_msg
Etienne Carriere [Mon, 21 Feb 2022 08:22:40 +0000 (09:22 +0100)]
scmi: change parameter dev in devm_scmi_process_msg

Changes devm_scmi_process_msg() first argument from target parent device
to current SCMI device and lookup the SCMI agent device among SCMI device
parents for find the SCMI agent operator needed for communication with
the firmware.

This change is needed in order to support CCF in clk_scmi driver unless
what CCF will fail to find the right udevice related to exposed SCMI
clocks.

This patch allows to simplify the caller sequence, using SCMI device
reference as parameter instead of knowing SCMI uclass topology. This
change also adds some protection in case devm_scmi_process_msg() API
function is called for an invalid device type.

Cc: Lukasz Majewski <lukma@denx.de>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2 years agosandbox: scmi: test against a single scmi agent
Etienne Carriere [Mon, 21 Feb 2022 08:22:39 +0000 (09:22 +0100)]
sandbox: scmi: test against a single scmi agent

As per DT bindings since Linux kernel v5.14, the device tree can define
only 1 SCMI agent node that is named scmi [1]. As a consequence, change
implementation of the SCMI driver test through sandbox architecture to
reflect that.

This change updates sandbox test DT and sandbox SCMI driver accordingly
since all these are impacted.

Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2 years agodoc: binding: scmi: link to latest Linux kernel binding
Etienne Carriere [Mon, 21 Feb 2022 08:22:38 +0000 (09:22 +0100)]
doc: binding: scmi: link to latest Linux kernel binding

Changes SCMI bindings documentation to relate to Linux kernel
source tree that recently changed the bindings description to YAML
format.

Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2 years agoMerge branch '2022-03-02-armv8-fixes-and-cleanups' into next
Tom Rini [Wed, 2 Mar 2022 18:59:33 +0000 (13:59 -0500)]
Merge branch '2022-03-02-armv8-fixes-and-cleanups' into next

To quote the author:
I was looking into the arm64 boot code lately and stumbled upon some
issues. Also Nishanth brought back memories of a lengthy debug session,
which was caused due to U-Boot keeping SErrors masked. As the resulting
patches are all somewhat related, I gathered this series here to address
those problems.

Patches 1 to 3 address exception handling issues, with the SError
enablement being the most prominent fix here.
Patch 4 cleans up asm/io.h. This was on the list before[1], but was
somehow lost when it was intercepted by a shorter version of itself.
Patches 5 and 6 clean up some unnecessarily complicated AArch64 assembly
code.

2 years agoarmv8: Fix and simplify branch_if_master/branch_if_slave
Andre Przywara [Fri, 11 Feb 2022 11:29:39 +0000 (11:29 +0000)]
armv8: Fix and simplify branch_if_master/branch_if_slave

The branch_if_master macro jumps to a label if the CPU is the "master"
core, which we define as having all affinity levels set to 0. To check
for this condition, we need to mask off some bits from the MPIDR
register, then compare the remaining register value against zero.

The implementation of this was slighly broken (it preserved the upper
RES0 bits), overly complicated and hard to understand, especially since
it lacked comments. The same was true for the very similar
branch_if_slave macro.

Use a much shorter assembly sequence for those checks, use the same
masking for both macros (just negate the final branch), and put some
comments on them, to make it clear what the code does.
This allows to drop the second temporary register for branch_if_master,
so we adjust all call sites as well.

Also use the opportunity to remove a misleading comment: the macro
works fine on SoCs with multiple clusters. Judging by the commit
message, the original problem with the Juno SoC stems from the fact that
the master CPU *can* be configured to be from cluster 1, so the
assumption that the master CPU has all affinity values set to 0 does not
hold there. But this is already mentioned above in a comment, so remove
the extra comment.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoarmv8: Simplify switch_el macro
Andre Przywara [Fri, 11 Feb 2022 11:29:38 +0000 (11:29 +0000)]
armv8: Simplify switch_el macro

The switch_el macro is a neat contraption to handle cases where we need
different code depending on the current exception level, but its
implementation was longer than needed.

Simplify it by doing just one comparison, then using the different
condition codes to branch to the desired target. PState.CurrentEL just
holds two bits, and since we don't care about EL0, we can use >, =, < to
select EL3, EL2 and EL1, respectively.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoarm: Clean up asm/io.h
Andre Przywara [Fri, 11 Feb 2022 11:29:37 +0000 (11:29 +0000)]
arm: Clean up asm/io.h

asm/io.h is the header file containing the central MMIO accessor macros.
Judging by the header and the comments, it was apparently once copied
from the Linux kernel, but has deviated since then *heavily*. There is
absolutely no point in staying close to the original Linux code anymore,
so just remove the old cruft, by:
- removing pointless Linux history
- removing commented code
- removing outdated comments
- removing unused definitions (for mem_isa)

This massively improves the readability of the file.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoarmv8: Force SP_ELx stack pointer usage
Andre Przywara [Fri, 11 Feb 2022 11:29:36 +0000 (11:29 +0000)]
armv8: Force SP_ELx stack pointer usage

In ARMv8 we have the choice between two stack pointers to use: SP_EL0 or
SP_ELx, which is banked per exception level. This choice is stored in
the SP field of PState, and can be read and set via the SPSel special
register. When the CPU takes an exception, it automatically switches to
the SP_ELx stack pointer.

Trusted Firmware enters U-Boot typically with SPSel set to 1, so we use
SP_ELx all along as our sole stack pointer, both for normal operation and
for exceptions.

But if we now for some reason enter U-Boot with SPSel cleared, we will
setup and use SP_EL0, which is fine, but leaves SP_ELx uninitialised.
When we now take an exception, we try to save the GPRs to some undefined
location, which will usually end badly.

To make sure we always have SP_ELx pointing to some memory, set SPSel
to 1 in the early boot code, to ensure safe operation at all times.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoarmv8: Always unmask SErrors
Andre Przywara [Fri, 11 Feb 2022 11:29:35 +0000 (11:29 +0000)]
armv8: Always unmask SErrors

The ARMv8 architecture describes the "SError interrupt" as the fourth
kind of exception, next to synchronous exceptions, IRQs, and FIQs.
Those SErrors signal exceptional conditions from which the system might
not easily recover, and are normally generated by the interconnect as a
response to some bus error. A typical situation is access to a
non-existing memory address or device, but it might be deliberately
triggered by a device as well.
The SError interrupt replaces the Armv7 asynchronous abort.

Trusted Firmware enters U-Boot (BL33) typically with SErrors masked,
and we never enable them. However any SError condition still triggers
the SError interrupt, and this condition stays pending, it just won't be
handled. If now later on the Linux kernel unmasks the "A" bit in PState,
it will immediately take the exception, leading to a kernel crash.
This leaves many people scratching their head about the reason for
this, and leads to long debug sessions, possibly looking at the wrong
places (the kernel, but not U-Boot).

To avoid the situation, just unmask SErrors early in the ARMv8 boot
process, so that the U-Boot exception handlers reports them in a timely
manner. As SErrors are typically asynchronous, the register dump does
not need to point at the actual culprit, but it should happen very
shortly after the condition.

For those exceptions to be taken, we also need to route them to EL2,
if U-Boot is running in this exception level.

This removes the respective code snippet from the Freescale lowlevel
routine, as this is now handled in generic ARMv8 code.

Reported-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agocmd: exception: arm64: fix undefined, add faults
Andre Przywara [Fri, 11 Feb 2022 11:29:34 +0000 (11:29 +0000)]
cmd: exception: arm64: fix undefined, add faults

The arm64 version of the exception command was just defining the
undefined exception, but actually copied the AArch32 instruction.

Replace that with an encoding that is guaranteed to be and stay
undefined. Also add instructions to trigger unaligned access faults and
a breakpoint.
This brings ARM64 on par with ARM(32) for the exception command.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoMerge branch '2022-03-02-enable-pylint-in-CI' into next
Tom Rini [Wed, 2 Mar 2022 15:38:00 +0000 (10:38 -0500)]
Merge branch '2022-03-02-enable-pylint-in-CI' into next

To quote the author:
This series adds a new errors-only pylint check and adds it to the CI
systems.

It also fixes the current errors in the U-Boot Python code, disabling
errors where it seems necessary.

A small patch to buildman allows it to build sandbox without any changes
to the default config file

2 years agoAzure/GitLab CI: Add the pylint checker
Simon Glass [Fri, 11 Feb 2022 20:23:26 +0000 (13:23 -0700)]
Azure/GitLab CI: Add the pylint checker

Add a check that new Python code does not regress the pylint score for
any module.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobuildman: Update default config to build for sandbox
Simon Glass [Fri, 11 Feb 2022 20:23:25 +0000 (13:23 -0700)]
buildman: Update default config to build for sandbox

At present the default .buildman file written by buildman does not specify
a default toolchain. Add an 'other' line so this works correctly and
sandbox builds run as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMakefile: Add a way to check for pylint errors
Simon Glass [Fri, 11 Feb 2022 20:23:24 +0000 (13:23 -0700)]
Makefile: Add a way to check for pylint errors

Add a new 'pylint_err' target which only reports errors, not warnings.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: Correct pylint errors
Simon Glass [Fri, 11 Feb 2022 20:23:23 +0000 (13:23 -0700)]
test: Correct pylint errors

Fix pylint errors in all test.

This requires adding a get_spawn() method to the ConsoleBase base, so that
its subclass is happy.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agomoveconfig: Correct pylint errors
Simon Glass [Fri, 11 Feb 2022 20:23:22 +0000 (13:23 -0700)]
moveconfig: Correct pylint errors

Fix two pylint errors in this file.

Note ACTION_SPL_NOT_EXIST is not defined so the dead code can be removed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Correct pylint errors
Simon Glass [Fri, 11 Feb 2022 20:23:21 +0000 (13:23 -0700)]
binman: Correct pylint errors

Fix pylint errors that can be fixed and mask those that seem to be
incorrect.

A complication with binman is that it tries to avoid importing libfdt
(or anything that imports it) unless needed, so that things like help
still work if it is missing.

Note that two tests are duplicated in binman and two others have
duplicate names, so both of these issues are fixed also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodtoc: Correct pylint errors
Simon Glass [Fri, 11 Feb 2022 20:23:20 +0000 (13:23 -0700)]
dtoc: Correct pylint errors

Fix pylint errors in this directory.

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