platform/kernel/u-boot.git
3 years agoMerge tag 'efi-2021-01-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Tue, 6 Oct 2020 12:36:38 +0000 (08:36 -0400)]
Merge tag 'efi-2021-01-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-01-rc1

The following bugs in the UEFI system are resolved:

* illegal free in EFI_LOAD_FILE2_PROTOCOL implementation
* incorrect documentation of EFI_LOAD_FILE2_PROTOCOL implementation
* output of CRC32 as decimal instead hexadecimal in unit test
* use EfiReservedMemoryType for no-map reserved memory
* avoid unnecessary resets in UEFI unit tests
* call EFI bootmgr even without having /EFI/boot

3 years agoMerge tag 'u-boot-amlogic-20201005' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Tue, 6 Oct 2020 12:36:10 +0000 (08:36 -0400)]
Merge tag 'u-boot-amlogic-20201005' of https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic

- generate unique mac address from SoC serial on S400 board
- Add USB support for GXL and AXG SoCs
- Update Gadget code to use the new GXL and AXG USB glue driver
- Add a VIM3 board support to add dynamic PCIe enable in OS DT
- Fix AXG pinmux with requesting GPIOs
- Add missing GPIOA_18 for AXG pinctrl
- Add Amlogic PWM driver

3 years agoefi_loader: consider no-map property of reserved memory
Heinrich Schuchardt [Thu, 27 Aug 2020 10:52:20 +0000 (12:52 +0200)]
efi_loader: consider no-map property of reserved memory

The device tree may contain a /reserved-memory node. The no-map property
of the sub-nodes signals if the memory may be accessed by the UEFI payload
or not.

In the EBBR specification (https://github.com/arm-software/ebbr) the
modeling of the reserved memory has been clarified.

If a reserved memory node in the device tree has the no-map property map,
create a EfiReservedMemoryType memory map entry else use
EfiBootServicesData.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: QEMU CONFIG_EFI_GRUB_ARM32_WORKAROUND=n
Heinrich Schuchardt [Thu, 17 Sep 2020 17:09:23 +0000 (19:09 +0200)]
efi_loader: QEMU CONFIG_EFI_GRUB_ARM32_WORKAROUND=n

CONFIG_EFI_GRUB_ARM32 is only needed for architectures with caches that are
not managed via CP15 (or for some outdated buggy versions of GRUB). It
makes more sense to disable the setting per architecture than per defconfig.

Move QEMU's CONFIG_EFI_GRUB_ARM32_WORKAROUND=n from defconfig to Kconfig.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi: Fix typo in documentation
Sean Anderson [Mon, 28 Sep 2020 16:08:37 +0000 (12:08 -0400)]
efi: Fix typo in documentation

There is an extra space.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodistro_bootcmd: call EFI bootmgr even without having /EFI/boot
Michael Walle [Tue, 29 Sep 2020 06:54:48 +0000 (08:54 +0200)]
distro_bootcmd: call EFI bootmgr even without having /EFI/boot

Currently, the EFI bootmgr is only called if there is a EFI binary
inside the path for removable media is found, i.e. /EFI/boot/. This
doesn't make sense. It is the duty of the bootmgr to find out the
path and name of the EFI binary to boot. It should be called even
if there is no /EFI/boot directory.

Thus, call the bootmgr before we try to boot the EFI binary inside
the removable media path.

Also remove the ${fdtcontroladdr} parameter because the fallback is
handled in cmd/bootefi.c and that already takes care of correct settings
if the board has ACPI and thus no device tree at all.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: avoid unnecessary reset
Heinrich Schuchardt [Wed, 30 Sep 2020 19:52:09 +0000 (21:52 +0200)]
efi_selftest: avoid unnecessary reset

When we do not execute a test requiring ExitBootServices do not reset the
system after testing.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: print CRC32 of initrd as hexadecimal
Heinrich Schuchardt [Sat, 3 Oct 2020 11:43:45 +0000 (13:43 +0200)]
efi_selftest: print CRC32 of initrd as hexadecimal

Print the CRC32 loaded via the EFI_LOAD_FILE2_PROTOCOL as a hexadecimal
number.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_selftest: enable printing hexadecimal numbers
Heinrich Schuchardt [Sat, 3 Oct 2020 11:12:03 +0000 (13:12 +0200)]
efi_selftest: enable printing hexadecimal numbers

Add code to use %x in efi_st_print().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: illegal free in EFI_LOAD_FILE2_PROTOCOL
Heinrich Schuchardt [Sat, 3 Oct 2020 10:50:52 +0000 (12:50 +0200)]
efi_loader: illegal free in EFI_LOAD_FILE2_PROTOCOL

strsep() changes the address that its first argument points to.
We cannot use the changed address as argument of free().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: description EFI_LOAD_FILE2_PROTOCOL
Heinrich Schuchardt [Sat, 3 Oct 2020 10:44:31 +0000 (12:44 +0200)]
efi_loader: description EFI_LOAD_FILE2_PROTOCOL

U-Boot offers a EFI_LOAD_FILE2_PROTOCOL which the Linux EFI stub can use to
load an initial RAM disk. Update the function comments of the
implementation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 5 Oct 2020 17:11:41 +0000 (13:11 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge branch 'next'
Tom Rini [Mon, 5 Oct 2020 17:05:46 +0000 (13:05 -0400)]
Merge branch 'next'

Bring in the assorted changes that have been staged in the 'next' branch
prior to release.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agopwm: Add driver for Amlogic Meson PWM controller
Neil Armstrong [Thu, 1 Oct 2020 08:04:56 +0000 (10:04 +0200)]
pwm: Add driver for Amlogic Meson PWM controller

This adds the driver for the PWM controller found in the Amlogic SoCs.

This PWM is only a set of Gates, Dividers and Counters:
PWM output is achieved by calculating a clock that permits calculating
two periods (low and high). The counter then has to be set to switch after
N cycles for the first half period.
The hardware has no "polarity" setting. This driver reverses the period
cycles (the low length is inverted with the high length) for
PWM_POLARITY_INVERSED.

Disabling the PWM stops the output immediately (without waiting for the
current period to complete first).

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agopinctrl: meson-axg: add missing GPIOA_18
Neil Armstrong [Fri, 2 Oct 2020 07:32:12 +0000 (09:32 +0200)]
pinctrl: meson-axg: add missing GPIOA_18

Add the missing GPIOA_18 from the missing EE gpio list.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agopinctrl: meson-axg-pmx: fix gpio request
Neil Armstrong [Fri, 2 Oct 2020 07:31:46 +0000 (09:31 +0200)]
pinctrl: meson-axg-pmx: fix gpio request

The AXG pmx driver gpio request offset needs the pin base to have the
correct pin number.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
3 years agoboard: amlogic: vim3: add support for dynamic PCIe enable
Neil Armstrong [Mon, 21 Sep 2020 07:34:15 +0000 (09:34 +0200)]
board: amlogic: vim3: add support for dynamic PCIe enable

The VIM3 on-board  MCU can mux the PCIe/USB3.0 shared differential
lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between
an USB3.0 Type A connector and a M.2 Key M slot.
The PHY driving these differential lines is shared between
the USB3.0 controller and the PCIe Controller, thus only
a single controller can use it.

This adds this dynamic switching right before booting Linux
and the configuration steps in the boards documentation.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: Kevin Hilman <khilman@baylibre.com>
[narmstrong: fixed warning by replacing min() by min_t()]

3 years agoconfigs: vim3: use the vim3 board support
Neil Armstrong [Mon, 21 Sep 2020 07:34:14 +0000 (09:34 +0200)]
configs: vim3: use the vim3 board support

Use the newly added VIM3 board support instead of the generic W400.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoboard: amlogic: add a vim3 specific board support
Neil Armstrong [Mon, 21 Sep 2020 07:34:13 +0000 (09:34 +0200)]
board: amlogic: add a vim3 specific board support

The VIM3 will need a specific code to enable PCIe if enabled in the MCU,
thus add a specific board support for VIM3 & VIM3L.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: dts: sync amlogic G12A/SM1 DT from Linux 5.9-rc1
Neil Armstrong [Mon, 21 Sep 2020 07:34:12 +0000 (09:34 +0200)]
ARM: dts: sync amlogic G12A/SM1 DT from Linux 5.9-rc1

This imports the G12A & SM1 SoC and boards DT changes from the Linux
commit 9123e3a74ec7 ("Linux 5.9-rc1").

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoconfigs: s400: enable USB
Neil Armstrong [Thu, 10 Sep 2020 08:48:19 +0000 (10:48 +0200)]
configs: s400: enable USB

Enable USB Host & Gadget on the Amlogic S400 board.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: dts: meson-axg: add USB nodes for S400
Neil Armstrong [Thu, 10 Sep 2020 08:48:18 +0000 (10:48 +0200)]
ARM: dts: meson-axg: add USB nodes for S400

Add the correcly architectured USB Glue node for Meson AXG and the
S400 board in -u-boot.dtsi until support in upstream Linux then
backported.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoarm: meson-axg: add board_usb_init()/cleanup() for USB gadget
Neil Armstrong [Thu, 10 Sep 2020 08:48:17 +0000 (10:48 +0200)]
arm: meson-axg: add board_usb_init()/cleanup() for USB gadget

Add the board_usb_init()/cleanup() for USB gadget for AXG based
on the code for the G12A architecture.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agophy: meson-gxl-usb: depend on Meson AXG aswell
Neil Armstrong [Thu, 10 Sep 2020 08:48:16 +0000 (10:48 +0200)]
phy: meson-gxl-usb: depend on Meson AXG aswell

Enable build of meson-gxl-usb PHY for the AXG architecture aswell.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agophy: meson-gxl: remove invalid USB3 PHY driver
Neil Armstrong [Thu, 10 Sep 2020 08:48:15 +0000 (10:48 +0200)]
phy: meson-gxl: remove invalid USB3 PHY driver

The registers which are managed by the meson-gxl-usb3 PHY driver are
actually "USB control" registers (which are "glue" registers which
manage OTG detection and routing of the OTG capable port between the
DWC2 peripheral-only controller and the DWC3 host-only controller).

Drop the meson-gxl-usb3 PHY driver now that the dwc3-meson-gxl-usb
driver supports the USB control registers on GXL and GXM SoCs (these
were previously managed by the meson-gxl-usb3 PHY driver).

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: mach-meson: use new DWC3 glue for GXL & GXM
Neil Armstrong [Thu, 10 Sep 2020 08:48:14 +0000 (10:48 +0200)]
ARM: mach-meson: use new DWC3 glue for GXL & GXM

Use the new Amlogic GXL/GXM USB Glue instead of the set of USB3 PHY
and Simple DWC3 wrapper.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agousb: dwc3: add Amlogic GXL & GXL DWC3 Glue
Neil Armstrong [Thu, 10 Sep 2020 08:48:13 +0000 (10:48 +0200)]
usb: dwc3: add Amlogic GXL & GXL DWC3 Glue

The USB support was initialy done with a set of PHYs and dwc3-of-simple
because the architecture of the USB complex was not understood correctly
at the time (and proper documentation was missing...).

But with the G12A family, the USB complex was correctly understood and
implemented correctly.

This adds a proper driver for the glue, based on the G12A one, but with
enough changes to require a different driver in U-Boot.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: dts: sync amlogic AXG/GXL/GXM DT from Linux 5.8-rc1
Neil Armstrong [Thu, 10 Sep 2020 08:48:12 +0000 (10:48 +0200)]
ARM: dts: sync amlogic AXG/GXL/GXM DT from Linux 5.8-rc1

This imports the AXG, GXL & GXM SoC and boards DT changes from the Linux
commit b3a9e3b9622a ("Linux 5.8-rc1").

This change also removes GXL & GXM u-boot.dtsi hacks for USB gadget.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoboard: s400: generate unique mac address from SoC serial
Neil Armstrong [Thu, 10 Sep 2020 08:50:39 +0000 (10:50 +0200)]
board: s400: generate unique mac address from SoC serial

Enable unique mac address generation from SoC serial on S400 board.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoPrepare v2020.10 v2020.10
Tom Rini [Mon, 5 Oct 2020 15:15:32 +0000 (11:15 -0400)]
Prepare v2020.10

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge tag 'u-boot-atmel-2021.01-a' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Mon, 5 Oct 2020 14:54:27 +0000 (10:54 -0400)]
Merge tag 'u-boot-atmel-2021.01-a' of https://gitlab.denx.de/u-boot/custodians/u-boot-atmel into next

First set of u-boot-atmel features for 2021.01 cycle:

This feature set includes a new CPU driver for at91 family, new driver
for PIT64B hardware timer, support for new at91 family SoC named sama7g5
which adds: clock support, including conversion of the clock tree to
CCF; SoC support in mach-at91, pinctrl and mmc drivers update.  The
feature set also includes updates for mmc driver and some other minor
fixes and features regarding building without the old Atmel PIT and the
possibility to read a secondary MAC address from a second i2c EEPROM.

3 years agoMerge tag 'u-boot-stm32-20201003' of https://gitlab.denx.de/u-boot/custodians/u-boot...
Tom Rini [Mon, 5 Oct 2020 14:54:10 +0000 (10:54 -0400)]
Merge tag 'u-boot-stm32-20201003' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm into next

- stm32mp: DT alignment with Linux 5.9-rc4
- stm32mp: convert drivers to APIs which support live DT
- stm32mp: gpio: minor fixes

3 years agocpu: at91: add driver for CPU
Claudiu Beznea [Thu, 1 Oct 2020 10:27:25 +0000 (13:27 +0300)]
cpu: at91: add driver for CPU

Add basic CPU driver use to retrieve information about CPU itself.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
3 years agoMerge branch 'rpi-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-raspberryp...
Tom Rini [Fri, 2 Oct 2020 16:00:39 +0000 (12:00 -0400)]
Merge branch 'rpi-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-raspberrypi into next

3 years agopinctrl: bcm283x: Store the return value of dev_read_u32_default to int
Ovidiu Panait [Tue, 29 Sep 2020 17:27:13 +0000 (20:27 +0300)]
pinctrl: bcm283x: Store the return value of dev_read_u32_default to int

Currently, the return value of dev_read_u32_default is stored in an u32,
causing the subsequent "if (function < 0)" to always be false:

u32 function;
...
function = dev_read_u32_default(config, "brcm,function", -1);
if (function < 0) {
        debug("Failed reading function for pinconfig %s (%d)\n",
                      config->name, function);
        return -EINVAL;
}

Make "function" variable an int to fix this.

Cc: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
3 years agopinctrl: bcm283x: Read address from DT in ofdata_to_platdata
Ovidiu Panait [Tue, 29 Sep 2020 17:27:12 +0000 (20:27 +0300)]
pinctrl: bcm283x: Read address from DT in ofdata_to_platdata

Factor out reading IP base address to ofdata_to_platdata function, which
is designed for this purpose. Also, drop the dev->priv NULL check, since
this is already done by the dm core when allocating space using
priv_auto_alloc_size feature. (in drivers/core/device.c ->
device_ofdata_to_platdata).

Cc: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
3 years agopinctrl: bcm283x: DM_FLAG_PRE_RELOC: Remove OF_CONTROL check
Ovidiu Panait [Tue, 29 Sep 2020 17:27:11 +0000 (20:27 +0300)]
pinctrl: bcm283x: DM_FLAG_PRE_RELOC: Remove OF_CONTROL check

Remove CONFIG_IS_ENABLED(OF_CONTROL) check from DM_FLAG_PRE_RELOC, since
this driver only supports OF_CONTROL.

drivers/pinctrl/broadcom/Kconfig:
config PINCTRL_BCM283X
    depends on ARCH_BCM283X && PINCTRL_FULL && OF_CONTROL

Cc: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
3 years agomailbox: stm32_ipcc: Convert to use APIs which support live DT
Patrick Delaunay [Wed, 9 Sep 2020 15:48:15 +0000 (17:48 +0200)]
mailbox: stm32_ipcc: Convert to use APIs which support live DT

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
driver can support live DT.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agovideo: stm32_dsi: Convert to use APIs which support live DT
Patrick Delaunay [Wed, 9 Sep 2020 15:44:13 +0000 (17:44 +0200)]
video: stm32_dsi: Convert to use APIs which support live DT

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
driver can support live DT.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Yannick Fertré <yannick.fertre@st.com>
3 years agovideo: stm32_ltdc: Convert to use APIs which support live DT
Patrick Delaunay [Wed, 9 Sep 2020 15:44:12 +0000 (17:44 +0200)]
video: stm32_ltdc: Convert to use APIs which support live DT

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
driver can support live DT.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Yannick Fertré <yannick.fertre@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agopinctrl: stm32: Add header with SPDX licence
Patrick Delaunay [Wed, 9 Sep 2020 15:50:15 +0000 (17:50 +0200)]
pinctrl: stm32: Add header with SPDX licence

Cosmetics: Add header with SPDX licence

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agopinctrl: stm32: Convert to use APIs which support live DT
Patrick Delaunay [Wed, 9 Sep 2020 15:50:14 +0000 (17:50 +0200)]
pinctrl: stm32: Convert to use APIs which support live DT

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
driver can support live DT.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agogpio: stm32: check result of ofnode_phandle_args
Patrick Delaunay [Wed, 9 Sep 2020 16:28:34 +0000 (18:28 +0200)]
gpio: stm32: check result of ofnode_phandle_args

Add test on the size of ofnode_phandle_args result to avoid access
to uninitialized elements in args[] field.

This patch avoids the issue when gpio-ranges cell size is not 3 as
expected, for example:
gpio-ranges = <&pinctrl 0>;
instead of
gpio-ranges = <&pinctrl 0 112 16>;

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agogpio: stm32: cosmetic: cleanup gpio_stm32_probe
Patrick Delaunay [Wed, 9 Sep 2020 16:28:33 +0000 (18:28 +0200)]
gpio: stm32: cosmetic: cleanup gpio_stm32_probe

Move the variables definition at the beggining of the function
gpio_stm32_probe().

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoARM: dts: stm32mp1: DT alignment with Linux kernel v5.9-rc4
Patrick Delaunay [Wed, 16 Sep 2020 08:01:32 +0000 (10:01 +0200)]
ARM: dts: stm32mp1: DT alignment with Linux kernel v5.9-rc4

DT alignment with Linux kernel v5.9-rc4 for the STM32MP15x soc
device tree files and the STMicroelectronics boards device tree files.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoboard: tbs2910: Use recommended distroboot addresses
Soeren Moch [Thu, 27 Aug 2020 19:52:46 +0000 (21:52 +0200)]
board: tbs2910: Use recommended distroboot addresses

According to doc/README.distro fdt_addr must not be set when DTB is not
available from hardware. So remove this entry.

Use address 32MB above the start of DRAM for kernel_addr_r. This way
we likely can avoid the self-relocation of the compressed kernel image
before it decompresses to offset 0x8000 from start of DRAM.

Use address 128MB above the start of DRAM for fdt_addr_r, since this is
the maximum location for the end of the kernel. So we avoid overwriting
the DTB.

Use 512k above that for ramdisk_addr_r. This should be enough for the
DTB, rest of DRAM can be used for initrd.

Place boot script / extlinux.conf at offset 0 / 1MB from start of DRAM.
This space is available for processing in U-Boot.

Signed-off-by: Soeren Moch <smoch@web.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agoMerge tag 'u-boot-stm32-20201002' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Fri, 2 Oct 2020 12:42:26 +0000 (08:42 -0400)]
Merge tag 'u-boot-stm32-20201002' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm

- Fixup SPI-NOR boot on AV96 board

3 years agoARM: dts: stm32: Add missing dm-spl props for SPI NOR on AV96
Marek Vasut [Thu, 1 Oct 2020 10:25:55 +0000 (12:25 +0200)]
ARM: dts: stm32: Add missing dm-spl props for SPI NOR on AV96

The u-boot,dm-spl DT props are missing on AV96, hence the pinmux and
flash0 nodes are not included in the reduced SPL DT. This prevents
SPI NOR boot from working at all. Fix this by filling them in.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoMerge branch 'next' of git://git.denx.de/u-boot-usb into next
Tom Rini [Thu, 1 Oct 2020 18:52:56 +0000 (14:52 -0400)]
Merge branch 'next' of git://git.denx.de/u-boot-usb into next

- Assorted XHCI improvements

3 years agoRevert "net: smc911x: Automatically Update ethaddr with MAC"
Tom Rini [Thu, 1 Oct 2020 18:51:58 +0000 (14:51 -0400)]
Revert "net: smc911x: Automatically Update ethaddr with MAC"

Upon further discussion on the mailing list, we should not get in the
situation where the generic code path to set ethaddr/etc correctly does
not work.  Revert this until someone can further debug the smc911x
driver regarding this issue.

This reverts commit 387cbf096e443705fa66776027273ed257ec6ca3.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agousb: xhci-rcar: Add support for R8A774A1 SoC
Lad Prabhakar [Mon, 21 Sep 2020 17:24:09 +0000 (18:24 +0100)]
usb: xhci-rcar: Add support for R8A774A1 SoC

The R8A774A1 is compatible with the generic rcar-gen3-xhci controller.
This patch adds the compatibility flag, to support the xHCI controller.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
3 years agousb: xhci: convert to readx_poll_sleep_timeout()
Chunfeng Yun [Tue, 8 Sep 2020 17:00:03 +0000 (19:00 +0200)]
usb: xhci: convert to readx_poll_sleep_timeout()

Use readx_poll_sleep_timeout() to poll the register status

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agousb: xhci: use macros with parameter to fill ep_info2
Chunfeng Yun [Tue, 8 Sep 2020 17:00:02 +0000 (19:00 +0200)]
usb: xhci: use macros with parameter to fill ep_info2

Use macros with parameter to fill ep_info2, then some macros
for MASK and SHIFT can be removed

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agousb: xhci: convert to TRB_TX_TYPE()
Chunfeng Yun [Tue, 8 Sep 2020 17:00:01 +0000 (19:00 +0200)]
usb: xhci: convert to TRB_TX_TYPE()

Use TRB_TX_TYPE() instead of (TRB_DATA_OUT/IN << TRB_TX_TYPE_SHIFT)

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agousb: xhci: convert to TRB_LEN() and TRB_INTR_TARGET()
Chunfeng Yun [Tue, 8 Sep 2020 17:00:00 +0000 (19:00 +0200)]
usb: xhci: convert to TRB_LEN() and TRB_INTR_TARGET()

For normal TRB fields:
use TRB_LEN(x) instead of ((x) & TRB_LEN_MASK);
and use TRB_INTR_TARGET(x) instead of
(((x) & TRB_INTR_TARGET_MASK) << TRB_INTR_TARGET_SHIFT)

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agousb: xhci: convert to TRB_TYPE()
Chunfeng Yun [Tue, 8 Sep 2020 16:59:59 +0000 (18:59 +0200)]
usb: xhci: convert to TRB_TYPE()

Use TRB_TYPE(p) instead of ((p) << TRB_TYPE_SHIFT)

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agousb: xhci: convert to HCS_MAX_PORTS()
Chunfeng Yun [Tue, 8 Sep 2020 16:59:58 +0000 (18:59 +0200)]
usb: xhci: convert to HCS_MAX_PORTS()

Use HCS_MAX_PORTS(p) instead of
((p & HCS_MAX_PORTS_MASK) >> HCS_MAX_PORTS_SHIFT)

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agousb: xhci: add quirks flag to support MediaTek xHCI 0.96
Chunfeng Yun [Tue, 8 Sep 2020 16:59:57 +0000 (18:59 +0200)]
usb: xhci: add quirks flag to support MediaTek xHCI 0.96

There some vendor quirks for MTK xHCI 0.96 host controller:
1. It defines some extra SW scheduling parameters for HW
   to minimize the scheduling effort for synchronous and
   interrupt endpoints. The parameters are put into reserved
   DWs of slot context and endpoint context.
2. Its TDS in  Normal TRB defines a number of packets that
   remains to be transferred for a TD after processing all
   Max packets in all previous TRBs.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agousb: xhci: create one unified function to calculate TRB TD remainder
Chunfeng Yun [Tue, 8 Sep 2020 16:59:56 +0000 (18:59 +0200)]
usb: xhci: create one unified function to calculate TRB TD remainder

xhci versions 1.0 and later report the untransferred data remaining in a
TD a bit differently than older hosts.

We used to have separate functions for these, and needed to check host
version before calling the right function.

Now Mediatek host has an additional quirk on how it uses the TD Size
field for remaining data. To prevent yet another function for calculating
remainder we instead want to make one quirk friendly unified function.

Porting from the Linux:
c840d6ce772d("xhci: create one unified function to calculate TRB TD remainder.")
124c39371114("xhci: use boolean to indicate last trb in td remainder calculation")

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agousb: xhci: add a member hci_version in xhci_ctrl struct
Chunfeng Yun [Tue, 8 Sep 2020 16:59:55 +0000 (18:59 +0200)]
usb: xhci: add a member hci_version in xhci_ctrl struct

Add a member to save xHCI version, it's used some times.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoMerge branch 'next' of git://git.denx.de/u-boot-sh into next
Tom Rini [Thu, 1 Oct 2020 14:29:39 +0000 (10:29 -0400)]
Merge branch 'next' of git://git.denx.de/u-boot-sh into next

3 years agoMerge branch '2020-09-30-assorted-network-improvements' into next
Tom Rini [Thu, 1 Oct 2020 13:46:10 +0000 (09:46 -0400)]
Merge branch '2020-09-30-assorted-network-improvements' into next

- Generic UDP framework
- TFTP fixes
- dwc_eth_qos, smc911x, smc911x and mscc phy fixes

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 1 Oct 2020 12:55:20 +0000 (08:55 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell

- Espressobin: Fix compatible string check
- Espressobin: Extend README for more MAC addresses

3 years agoMerge tag 'late-bugfix-for-2020.10' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Thu, 1 Oct 2020 12:36:29 +0000 (08:36 -0400)]
Merge tag 'late-bugfix-for-2020.10' of https://gitlab.denx.de/u-boot/custodians/u-boot-i2c

i2c late bugfix for v2020.10
- rcar_i2c: Fix i2c read/write errors
  fixes commit 7c8f821e ("i2c: rcar_i2c: Set the slave address from rcar_i2c_xfer")

3 years agoMerge branch 'master' of git://git.denx.de/u-boot-sh
Tom Rini [Thu, 1 Oct 2020 12:36:09 +0000 (08:36 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-sh

3 years agoarm: mvebu: Espressobin: Fix checks against machine compatible strings
Andre Heider [Tue, 29 Sep 2020 12:34:26 +0000 (14:34 +0200)]
arm: mvebu: Espressobin: Fix checks against machine compatible strings

The patches changing the compatible strings to the ones used by Linux have
not been merged yet, so fix the checks to use the current in-tree ones.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Andre Heider <a.heider@gmail.com>
Reviewed-by: Pali Rohár <pali@kernel.org>
3 years agoarm: mvebu: Espressobin: Instructions for more MAC addresses in README.marvell
Pali Rohár [Fri, 25 Sep 2020 07:54:16 +0000 (09:54 +0200)]
arm: mvebu: Espressobin: Instructions for more MAC addresses in README.marvell

Some Espressobin boards got assigned more than one MAC address. Update
instructions how to correctly store and preserve all MAC addresses.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andre Heider <a.heider@gmail.com>
3 years agoi2c: rcar_i2c: Fix i2c read/write errors
Lad Prabhakar [Wed, 30 Sep 2020 12:24:12 +0000 (13:24 +0100)]
i2c: rcar_i2c: Fix i2c read/write errors

commit 7c8f821e5dde ("i2c: rcar_i2c: Set the slave address from
rcar_i2c_xfer") blindly called rcar_i2c_set_addr() with read argument
always set to 1 during xfer which introduced read/write errors, whereas
earlier rcar_i2c_read_common() called rcar_i2c_set_addr() with read set to
1 and rcar_i2c_write_common() called rcar_i2c_set_addr() with read set 0.

Fixes: 7c8f821e5dde ("i2c: rcar_i2c: Set the slave address from rcar_i2c_xfer")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agosntp: use udp framework
Philippe Reynes [Fri, 18 Sep 2020 12:13:02 +0000 (14:13 +0200)]
sntp: use udp framework

This commits update the support of sntp to use
the framework udp. This change allows to remove
all the reference to sntp in the main network
file net/net.c.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: enable support of generic udp protocol
Philippe Reynes [Fri, 18 Sep 2020 12:13:01 +0000 (14:13 +0200)]
sandbox: enable support of generic udp protocol

This commit enable the support of the generic udp protocol.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agonet: add a generic udp protocol
Philippe Reynes [Fri, 18 Sep 2020 12:13:00 +0000 (14:13 +0200)]
net: add a generic udp protocol

This commit adds a generic udp protocol framework in the
network loop. So protocol based on udp may be implemented
without modifying the network loop (for example custom
wait magic packet).

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agonet: dwc_eth_qos: Convert to use APIs which support live DT
Patrick Delaunay [Wed, 9 Sep 2020 16:30:06 +0000 (18:30 +0200)]
net: dwc_eth_qos: Convert to use APIs which support live DT

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
driver can support live DT.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agophy: add support for stingray PAXB PHY controller
Srinath Mannam [Thu, 2 Apr 2020 10:38:12 +0000 (16:08 +0530)]
phy: add support for stingray PAXB PHY controller

Add support for stingray PAXB PHY controller driver.
This driver supports maximum 8 PAXB phys using pipemux data.

Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agonet: use log_err() for 'No ethernet found' message
Heinrich Schuchardt [Mon, 14 Sep 2020 09:00:18 +0000 (11:00 +0200)]
net: use log_err() for 'No ethernet found' message

Write the 'No ethernet found' message via the log drivers. This allows
suppressing it during output via the syslog driver.

This fixes the problem reported in:

[PATCH 0/4] log: Fix the syslog spam when running tests
https://lists.denx.de/pipermail/u-boot/2020-September/426343.html

Reported-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agonet: tftp: Fix load_block offset calculation
Ley Foon Tan [Tue, 25 Aug 2020 02:26:37 +0000 (10:26 +0800)]
net: tftp: Fix load_block offset calculation

When load the last block, the "len" might not be a block size. This cause
loading the incorrect last block data.

The fix change "len" to tftp_block_size and minus one tftp_block_size
for offset calculation.

Use same offset calculation formula as in store_block().

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: tftp: Fix store_block offset calculation
Ley Foon Tan [Tue, 25 Aug 2020 02:26:36 +0000 (10:26 +0800)]
net: tftp: Fix store_block offset calculation

tftp_cur_block start with 1 for first block, but tftp_cur_block counter is
start with zero when block number is rollover. The existing code
"tftp_cur_block - 1" will cause the block number become -1 in store_block()
when tftp_cur_block is 0 when tftp_cur_block is rollover.

The fix pass in tftp_cur_block to store_block() and minus the
tftp_block_size when do the offset calculation.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: tftp: Fix tftp_prev_block counter update
Ley Foon Tan [Tue, 25 Aug 2020 02:26:35 +0000 (10:26 +0800)]
net: tftp: Fix tftp_prev_block counter update

Fixes missing update to tftp_prev_block counter before increase
tftp_cur_block counter when do the tftpput operation.

tftp_prev_block counter is used in update_block_number() function to
check whether block number (sequence number) is rollover. This bug
cause the tftpput command fail to upload a large file when block
number is greater than 16-bit (0xFFFF).

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: smc911x: Automatically Update ethaddr with MAC
Adam Ford [Tue, 18 Aug 2020 13:19:02 +0000 (08:19 -0500)]
net: smc911x: Automatically Update ethaddr with MAC

The ethernet controller can read the MAC from EEPROM and display it,
but if ethaddr is not set, the ethernet is still unavailable.

This patch checks will automatically set the MAC address if it has
not already been set.

Signed-off-by: Adam Ford <aford173@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
3 years agonet: ftgmac100: Add support for board specific PHY interface address
Thirupathaiah Annapureddy [Tue, 18 Aug 2020 00:08:26 +0000 (17:08 -0700)]
net: ftgmac100: Add support for board specific PHY interface address

ftgmac100 driver is using hard-coded PHY interface address of zero.
Each board can have different PHY interface address (phy_addr).
This commit modifies the driver to make use of board specific address
by leveraging CONFIG_PHY_ADDR.

Signed-off-by: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
3 years agonet: phy: mscc: sync rx/tx delay settings with Linux on vsc85xx
Heiko Stuebner [Tue, 9 Jun 2020 13:37:40 +0000 (15:37 +0200)]
net: phy: mscc: sync rx/tx delay settings with Linux on vsc85xx

The Linux kernel does set the clock delays to
- 0.2 ns (their default, and lowest, hardware value) if delays should
  not be enabled
- 2.0 ns (which causes the data to be sampled at exactly half way between
  clock transitions at 1000 Mbps) if delays should be enabled
depending on the interface mode

See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/phy/mscc/mscc_main.c#n523

So instead of using arbitrary delay values like now, mimic this behaviour.

The behaviour is the same for all of vsc8530/8531/8540/8541 so move that
to a shared function while at it.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
3 years agonet: phy: mscc: make clock-output configurable on vsc85xx
Heiko Stuebner [Tue, 9 Jun 2020 13:37:39 +0000 (15:37 +0200)]
net: phy: mscc: make clock-output configurable on vsc85xx

The vsc8530/8531/8540/8541 phys have a configurable clock output that
can emit 25, 50 and 125 MHz rates, which in turn may be needed for
stable network connections.

This follows a similar change introduced into the Linux kernel at
  https://lore.kernel.org/netdev/20200609133140.1421109-2-heiko@sntech.de

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
3 years agoMerge branch '2020-09-30-add-new-apis' into next
Tom Rini [Wed, 30 Sep 2020 20:11:11 +0000 (16:11 -0400)]
Merge branch '2020-09-30-add-new-apis' into next

- SCMI firmware support
- regmap, GPIO, reset API enhancements

3 years agofirmware: smci: sandbox test for SCMI reset controllers
Etienne Carriere [Wed, 9 Sep 2020 16:44:07 +0000 (18:44 +0200)]
firmware: smci: sandbox test for SCMI reset controllers

Add tests for SCMI reset controllers. A test device driver
sandbox-scmi_devices.c is used to get reset resources, allowing further
resets manipulation.

Change sandbox-smci_agent to emulate 1 reset controller exposed through
an agent. Add DM test scmi_resets to test this reset controller.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoreset: add reset controller driver for SCMI agents
Etienne Carriere [Wed, 9 Sep 2020 16:44:06 +0000 (18:44 +0200)]
reset: add reset controller driver for SCMI agents

This change introduces a reset controller driver for SCMI agent devices.
When SCMI agent and SCMI reset domain drivers are enabled, SCMI agent
binds a reset controller device for each SCMI reset domain protocol
devices enabled in the FDT.

SCMI reset driver is embedded upon CONFIG_RESET_SCMI=y. If enabled,
CONFIG_SCMI_AGENT is also enabled.

SCMI Reset Domain protocol is defined in the SCMI specification [1].

Links: [1] https://developer.arm.com/architectures/system-architectures/software-standards/scmi
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofirmware: scmi: sandbox test for SCMI clocks
Etienne Carriere [Wed, 9 Sep 2020 16:44:05 +0000 (18:44 +0200)]
firmware: scmi: sandbox test for SCMI clocks

Add tests for SCMI clocks. A test device driver sandbox-scmi_devices.c
is used to get clock resources, allowing further clock manipulation.

Change sandbox-smci_agent to emulate 3 clocks exposed through 2 agents.
Add DM test scmi_clocks to test these 3 clocks.
Update DM test sandbox_scmi_agent with load/remove test sequences
factorized by {load|remove}_sandbox_scmi_test_devices() helper functions.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoclk: add clock driver for SCMI agents
Etienne Carriere [Wed, 9 Sep 2020 16:44:04 +0000 (18:44 +0200)]
clk: add clock driver for SCMI agents

This change introduces a clock driver for SCMI agent devices. When
SCMI agent and SCMI clock drivers are enabled, SCMI agent binds a
clock device for each SCMI clock protocol devices enabled in the FDT.

SCMI clock driver is embedded upon CONFIG_CLK_SCMI=y. If enabled,
CONFIG_SCMI_AGENT is also enabled.

SCMI Clock protocol is defined in the SCMI specification [1].

Links: [1] https://developer.arm.com/architectures/system-architectures/software-standards/scmi
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodt-bindings: arm: SCMI bindings documentation
Etienne Carriere [Wed, 9 Sep 2020 16:44:03 +0000 (18:44 +0200)]
dt-bindings: arm: SCMI bindings documentation

Dump SCMI DT bindings documentation from Linux kernel source
tree v5.8-rc1.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofirmware: scmi: support Arm SMCCC transport
Etienne Carriere [Wed, 9 Sep 2020 16:44:02 +0000 (18:44 +0200)]
firmware: scmi: support Arm SMCCC transport

This change implements a SMCCC transport for SCMI exchanges. This
implementation follows the Linux kernel as references implementation
for SCMI message processing, using the SMT format for communication
channel meta-data.

Use of SMCCC transport in SCMI FDT bindings are defined in the Linux
kernel DT bindings since v5.8. SMCCC with SMT is implemented in OP-TEE
from tag 3.9.0 [2].

Links: [2] https://github.com/OP-TEE/optee_os/commit/a58c4d706d23
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofirmware: scmi: mailbox/smt agent device
Etienne Carriere [Wed, 9 Sep 2020 16:44:01 +0000 (18:44 +0200)]
firmware: scmi: mailbox/smt agent device

This change implements a mailbox transport using SMT format for SCMI
exchanges. This implementation follows the Linux kernel and
SCP-firmware [1] as references implementation for SCMI message
processing using SMT format for communication channel meta-data.

Use of mailboxes in SCMI FDT bindings are defined in the Linux kernel
DT bindings since v4.17.

Links: [1] https://github.com/ARM-software/SCP-firmware
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofirmware: add SCMI agent uclass
Etienne Carriere [Wed, 9 Sep 2020 16:44:00 +0000 (18:44 +0200)]
firmware: add SCMI agent uclass

This change introduces SCMI agent uclass to interact with a firmware
using the SCMI protocols [1].

SCMI agent uclass currently supports a single method to request
processing of the SCMI message by an identified server. A SCMI message
is made of a byte payload associated to a protocol ID and a message ID,
all defined by the SCMI specification [1]. On return from process_msg()
method, the caller gets the service response.

SCMI agent uclass defines a post bind generic sequence for all devices.
The sequence binds all the SCMI protocols listed in the FDT for that
SCMI agent device. Currently none, but later change will introduce
protocols.

This change implements a simple sandbox device for the SCMI agent uclass.
The sandbox nicely answers SCMI_NOT_SUPPORTED to SCMI messages.
To prepare for further test support, the sandbox exposes a architecture
function for test application to read the sandbox emulated devices state.
Currently supports 2 SCMI agents, identified by an ID in the FDT device
name. The simplistic DM test does nothing yet.

SCMI agent uclass is designed for platforms that embed a SCMI server in
a firmware hosted somewhere, for example in a companion co-processor or
in the secure world of the executing processor. SCMI protocols allow an
SCMI agent to discover and access external resources as clock, reset
controllers and more. SCMI agent and server communicate following the
SCMI specification [1]. This SCMI agent implementation complies with
the DT bindings defined in the Linux kernel source tree regarding
SCMI agent description since v5.8.

Links: [1] https://developer.arm.com/architectures/system-architectures/software-standards/scmi
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: dm: Add tests for regmap managed API and regmap fields
Jean-Jacques Hiblot [Thu, 24 Sep 2020 04:34:18 +0000 (10:04 +0530)]
test: dm: Add tests for regmap managed API and regmap fields

The tests rely on a dummy driver to allocate and initialize the regmaps
and the regmap fields using the managed API. The first test checks if
the regmap config fields like width, reg_offset_shift, range specifiers,
etc work. The second test checks if regmap fields behave properly (mask
and shift are ok) by peeking into the regmap.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest/py: allow multi-digit index in in_tree()
Pratyush Yadav [Thu, 24 Sep 2020 04:34:17 +0000 (10:04 +0530)]
test/py: allow multi-digit index in in_tree()

When more nodes are added for a uclass the index might go into two or
more digits. This means that there are less spaces printed because they
are used up by the extra digits. Update the regular expression to allow
variable-length spacing between the class name and and index.

This was discovered when adding a simple_bus node in test.dts made
test_bind_unbind_with_uclass() fail because the index went up to 10.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
3 years agoregmap: Add support for regmap fields
Jean-Jacques Hiblot [Thu, 24 Sep 2020 04:34:16 +0000 (10:04 +0530)]
regmap: Add support for regmap fields

A regmap field is an abstraction available in Linux. It provides to access
bitfields in a regmap without having to worry about shifts and masks.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
3 years agoregmap: Allow devices to specify regmap range start and size in config
Pratyush Yadav [Thu, 24 Sep 2020 04:34:15 +0000 (10:04 +0530)]
regmap: Allow devices to specify regmap range start and size in config

Some devices need to calculate the regmap base address at runtime. This
makes it impossible to use device tree to get the regmap base. Instead,
allow devices to specify it in the regmap config. This will create a
regmap with a single range that corresponds to the start and size given
by the driver.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoregmap: Add regmap_init_mem_range()
Pratyush Yadav [Thu, 24 Sep 2020 04:34:14 +0000 (10:04 +0530)]
regmap: Add regmap_init_mem_range()

Right now, the base of a regmap can only be obtained from the device
tree. This makes it impossible for devices which calculate the base at
runtime to use a regmap. An example of such a device is the Cadence
Sierra PHY.

Allow creating a regmap with one range whose start and size can be
specified by the driver based on calculations at runtime.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoregmap: Allow left shifting register offset before access
Pratyush Yadav [Thu, 24 Sep 2020 04:34:13 +0000 (10:04 +0530)]
regmap: Allow left shifting register offset before access

Drivers can configure it to adjust the final read/write location.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoregmap: Allow specifying read/write width
Pratyush Yadav [Thu, 24 Sep 2020 04:34:12 +0000 (10:04 +0530)]
regmap: Allow specifying read/write width

Right now, regmap_read() and regmap_write() read/write a 32-bit value
only. To write other lengths, regmap_raw_read() and regmap_raw_write()
need to be used.

This means that any driver ported from Linux that relies on
regmap_{read,write}() to know the size already has to be updated at each
callsite. This makes the port harder to maintain.

So, allow specifying the read/write width to make it easier to port the
drivers, since now the only change needed is when initializing the
regmap.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoregmap: zero out the regmap on allocation
Pratyush Yadav [Thu, 24 Sep 2020 04:34:11 +0000 (10:04 +0530)]
regmap: zero out the regmap on allocation

Some fields will be introduced in the regmap structure that should be
set to 0 by default. So, once we allocate a regmap, make sure it is
zeroed out to avoid unexpected defaults for those values.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoregmap: Add devm_regmap_init()
Jean-Jacques Hiblot [Thu, 24 Sep 2020 04:34:10 +0000 (10:04 +0530)]
regmap: Add devm_regmap_init()

Most of new linux drivers are using managed-API to allocate resources. To
ease porting drivers from linux to U-Boot, introduce devm_regmap_init() as
a managed API to get a regmap from the device tree.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
3 years agotest: gpio: Add tests for the managed API
Jean-Jacques Hiblot [Fri, 11 Sep 2020 08:13:35 +0000 (13:43 +0530)]
test: gpio: Add tests for the managed API

Add a test to verify that GPIOs can be acquired/released using the managed
API. Also check that the GPIOs are released when the consumer device is
removed.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>