platform/kernel/u-boot.git
5 years agobcm968580xref: enable led support
Philippe Reynes [Fri, 22 Mar 2019 16:02:04 +0000 (17:02 +0100)]
bcm968580xref: enable led support

Enable the led support in the configuration
of the board bcm968580xref.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agodt: bcm968580xref: enable led controller
Philippe Reynes [Fri, 22 Mar 2019 16:02:03 +0000 (17:02 +0100)]
dt: bcm968580xref: enable led controller

Enable the led controller in the device tree
of the board bcm968580xref.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agommc: stm32_sdmmc2: Fix r1b timeout issue
Christophe Kerello [Thu, 6 Dec 2018 14:58:10 +0000 (15:58 +0100)]
mmc: stm32_sdmmc2: Fix r1b timeout issue

On response type r1b, if DTIME is not defined or too short,
the Datatimeout and DPSM flag occurs. Like the DPSM is
activated all next data transfer will be frozen.
To avoid this freeze:
    -The driver must define a DTIME on all r1b response type.
    -DTIME of SDMMC must be defined for alls stop transmission
     (for read and write request) even if MMC_RSP_BUSY is not set.
    -If busy timeout occur, an abort request must be sent to
     reinitialize the DPSM.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
5 years agommc: stm32_sdmmc2: Update DT properties with v4.19 bindings
Patrick Delaunay [Fri, 16 Nov 2018 09:25:54 +0000 (10:25 +0100)]
mmc: stm32_sdmmc2: Update DT properties with v4.19 bindings

Some properties name has been updated:
  - st,dirpol becomes st,sig-dir
  - st,negedge becomes st,neg-edge
  - st,pin-ckin becomes st,use-ckin

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Update sdmmc binding for stm32mp157c-ed1
Patrice Chotard [Tue, 12 Feb 2019 16:17:58 +0000 (17:17 +0100)]
ARM: dts: stm32: Update sdmmc binding for stm32mp157c-ed1

Update some sdmmc properties which have been updated with
v4.19 DT bindings:
      - st,dirpol becomes st,sig-dir
      - st,negedge becomes st,neg-edge
      - st,pin-ckin becomes st,use-ckin

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Update sdmmc binding for stm32h743i-eval
Patrice Chotard [Wed, 17 Apr 2019 09:53:29 +0000 (11:53 +0200)]
ARM: dts: stm32: Update sdmmc binding for stm32h743i-eval

Update some sdmmc properties which have been updated with
v4.19 DT bindings:
      - st,dirpol becomes st,sig-dir
      - st,negedge becomes st,neg-edge
      - st,pin-ckin becomes st,use-ckin

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoboard: stm32f746-disco: Get MII/RMII phy_mode from DT
Patrice Chotard [Fri, 22 Feb 2019 14:04:44 +0000 (15:04 +0100)]
board: stm32f746-disco: Get MII/RMII phy_mode from DT

This is needed to make ethernet work on stm32f746-eval which
uses MII mode.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoconfigs: stm32f746-disco: Enable SPI_FLASH_MACRONIX
Patrice Chotard [Fri, 22 Feb 2019 14:04:43 +0000 (15:04 +0100)]
configs: stm32f746-disco: Enable SPI_FLASH_MACRONIX

This config file is shared between stm32f746-disco and stm32f769-disco.
These 2 boards doesn't embed the same qspi flash (Micron n25q128a on
f746-disco, Macronix mx66l51235l on f769-disco).

To be able to use Macronix mx66l51235l on F769-disco, flags
SPI_FLASH_MACRONIX must be enabled.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoconfigs: stm32f746-disco: enable CONFIG_DISTRO_DEFAULTS
Patrice Chotard [Thu, 21 Feb 2019 09:12:08 +0000 (10:12 +0100)]
configs: stm32f746-disco: enable CONFIG_DISTRO_DEFAULTS

Allows to boot linux distribution

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoconfigs: stm32f746-disco: update EXTRA_ENV_SETTINGS
Patrice Chotard [Thu, 21 Feb 2019 09:07:54 +0000 (10:07 +0100)]
configs: stm32f746-disco: update EXTRA_ENV_SETTINGS

Allows to boot linux distribution.

As stm32f746-disco and stm32f769-disco are sharing the same defconfig
file, in case of stm32f769-disco build, "fdtfile=..." must be updated
with the correct stm32f769 DTB file name.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agommc: arm_pl180_mmci: Sync compatible with kernel
Patrice Chotard [Wed, 5 Dec 2018 13:04:32 +0000 (14:04 +0100)]
mmc: arm_pl180_mmci: Sync compatible with kernel

Initially the compatible string was wrongly set to "st,stm32f4xx-sdio".
Use compatible string used by kernel instead and identify mmci variant
using "arm,primecell-periphid" property.

Currently, the DM part of mmci driver is only used by STM32 SoCs,
that's why the switch case gets only one entry. It will be populated
easily with new variant in the future.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agopinctrl: stm32: Add st,stm32f769-pinctrl compatible string
Patrice Chotard [Tue, 11 Dec 2018 13:49:18 +0000 (14:49 +0100)]
pinctrl: stm32: Add st,stm32f769-pinctrl compatible string

Due to DT kernel synchronisation, add new pinctrl compatible
string for stm32f769.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Restore old usart1 clock bindings for stm32f7
Patrice Chotard [Mon, 18 Feb 2019 22:19:45 +0000 (23:19 +0100)]
ARM: dts: stm32: Restore old usart1 clock bindings for stm32f7

As U-boot stm32f clock driver doesn't support new
bindings for auxiliary clocks (clocks = <&rcc 1 ....>),
restore old bindings for usart1 to get console output.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Sync DT with v4.20 kernel for stm32h7
Patrice Chotard [Thu, 6 Dec 2018 10:53:39 +0000 (11:53 +0100)]
ARM: dts: stm32: Sync DT with v4.20 kernel for stm32h7

Synchronize stm32h7 device tree with kernel v4.20.
U-boot DT files and pinctrl bindings are updated,
useless nodes are removed and gpio compatible added.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: Migrate U-boot nodes to U-boot DT files for stm32h7
Patrice Chotard [Thu, 6 Dec 2018 10:59:42 +0000 (11:59 +0100)]
ARM: dts: Migrate U-boot nodes to U-boot DT files for stm32h7

In order to prepare and ease future DT synchronization with kernel
DT, migrate all U-boot specific nodes/properties/addons to
U-boot DT files.

As sdmmc is not yet supported on kernel side, sdmmc nodes
are located in eval-u-boot and disco-u-boot DT files.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Sync DT with v4.20 kernel for stm32f7
Patrice Chotard [Tue, 19 Feb 2019 15:49:05 +0000 (16:49 +0100)]
ARM: dts: stm32: Sync DT with v4.20 kernel for stm32f7

Synchronize stm32f7 device tree with kernel v4.20.

All pinctrl bindings are updated.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Migrate U-boot nodes to U-boot DT files for stm32f7
Patrice Chotard [Mon, 18 Feb 2019 23:37:20 +0000 (00:37 +0100)]
ARM: dts: stm32: Migrate U-boot nodes to U-boot DT files for stm32f7

In order to prepare and ease future DT synchronization with kernel
DT, migrate all U-boot specific nodes/properties/addons to
U-boot DT files.

Migrate also DT nodes which are not yet available on kernel DT side
as ethernet, ltdc and qspi nodes.

Fix ethernet_mii pins and add missing qspi_pins for stm32746g-eval

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Sync DT files with v4.20 kernel for stm32f4
Patrice Chotard [Mon, 18 Feb 2019 21:54:35 +0000 (22:54 +0100)]
ARM: dts: stm32: Sync DT files with v4.20 kernel for stm32f4

Synchronize stm32f7 device tree with kernel v4.20.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM:dts: stm32: sort nodes by alphabetical order in f4 u-boot files
Patrice Chotard [Mon, 18 Feb 2019 21:46:25 +0000 (22:46 +0100)]
ARM:dts: stm32: sort nodes by alphabetical order in f4 u-boot files

Sort nodes alphabetically to be coherent with all others STM32 DT files.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoboard: amlogic-q200: fix Khadas VIM2 README
Neil Armstrong [Wed, 10 Apr 2019 14:22:41 +0000 (16:22 +0200)]
board: amlogic-q200: fix Khadas VIM2 README

The vendor U-boot branch and defconfig was wrong for the
Khadas VIM2, fix this.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoboard: amlogic: enable PHY_REALTEK for selected boards
Neil Armstrong [Wed, 10 Apr 2019 14:41:30 +0000 (16:41 +0200)]
board: amlogic: enable PHY_REALTEK for selected boards

When using the generic PHY on boards using an RGMII Realtek PHY,
gigabit speed is not always reliable.

This patch enables the Realtek PHY driver for such boards.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoboards: meson: add g12a u200
Jerome Brunet [Tue, 12 Feb 2019 13:23:25 +0000 (14:23 +0100)]
boards: meson: add g12a u200

The Amlogic U200 board is based on the Amlogic S905D2 SoC
from the Amlogic G12A SoC family.

The board has the following specifications :
 - Amlogic S905D2 ARM Cortex-A53 quad-core SoC
 - XGB DDR4 SDRAM
 - 10/100 Ethernet (Internal PHY)
 - 1 x USB 3.0 Host
 - eMMC
 - SDcard
 - Infrared receiver
 - SDIO WiFi Module
 - MIPI DSI Connector
 - Audio HAT Connector
 - PCI-E M.2 Connector

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoARM: dts: Import Amlogic G12A u200 DT from Linux 5.1-rc1
Neil Armstrong [Fri, 8 Mar 2019 14:09:40 +0000 (15:09 +0100)]
ARM: dts: Import Amlogic G12A u200 DT from Linux 5.1-rc1

Import Linux 5.1-rc1 DT from 9e98c678c2d6 ("Linux 5.1-rc1") for the
meson-g12a-u200 board, the meson-g12a.dtsi and the corresponding bindings.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoARM: meson: add G12a support
Jerome Brunet [Fri, 8 Feb 2019 15:23:20 +0000 (16:23 +0100)]
ARM: meson: add G12a support

Add support for the Amlogic G12A SoC, which is a mix between the
new physical memory mapping of AXG and the functionnalities of
the previous Amlogic GXL/GXM SoCs.

To handle the internal ethernet PHY, the Amlogic G12A SoCs now
embeds a dedicated PLL to feed the internal PHY.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoclk: meson: add g12a support
Jerome Brunet [Mon, 11 Feb 2019 15:45:01 +0000 (16:45 +0100)]
clk: meson: add g12a support

Add basic support for the Amlogic G12A clock controller based on
the AXG driver.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoclk: create meson directory and move related drivers
Jerome Brunet [Sun, 10 Feb 2019 13:54:30 +0000 (14:54 +0100)]
clk: create meson directory and move related drivers

In order to support the Amlogic G12A clock controller,
re-architect the clock files into a meson directory.

No functionnal changes.

MAINTAINERS entry is also updated.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agopinctrl: meson: add g12a support
Jerome Brunet [Fri, 8 Feb 2019 16:40:57 +0000 (17:40 +0100)]
pinctrl: meson: add g12a support

Add pinctrl support for the Amlogic G12A SoC, which is
very similar to the Amlogic AXG support but with an additionnal
drive-strength register bank.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoregmap: fix regmap_read_poll_timeout warning about sandbox_timer_add_offset
Neil Armstrong [Thu, 11 Apr 2019 15:01:23 +0000 (17:01 +0200)]
regmap: fix regmap_read_poll_timeout warning about sandbox_timer_add_offset

When fixing sandbox test for regmap_read_poll_timeout(), the
sandbox_timer_add_offset was introduced but only defined in sandbox code
thus generating warnings when used out of sandbox :

include/regmap.h:289:2: note: in expansion of macro 'regmap_read_poll_timeout_test'
regmap_read_poll_timeout_test(map, addr, val, cond, sleep_us, \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/meson_spifc.c:169:8: note: in expansion of macro 'regmap_read_poll_timeout'
ret = regmap_read_poll_timeout(spifc->regmap, REG_SLAVE, data,
        ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/meson_spifc.c: In function 'meson_spifc_txrx':
include/regmap.h:277:4: warning: implicit declaration of function 'sandbox_timer_add_offset' [-Wimplicit-function-declaration]

This fix adds a timer_test_add_offset() only defined in sandbox, and
renames the previous sandbox_timer_add_offset() to it.

Cc: Simon Glass <sjg@chromium.org>
Reported-by: Tom Rini <trini@konsulko.com>
Fixes: df9cf1cc08 ("test: dm: regmap: Fix the long test delay")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoefi_loader: check length in CreateDeviceNode()
Heinrich Schuchardt [Mon, 22 Apr 2019 22:51:01 +0000 (00:51 +0200)]
efi_loader: check length in CreateDeviceNode()

When creating a device path node ensure that the size of the allocated
memory at lest matches the size of the node header.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: check memory type in AllocatePages()
Heinrich Schuchardt [Mon, 22 Apr 2019 22:30:53 +0000 (00:30 +0200)]
efi_loader: check memory type in AllocatePages()

The UEFI specification prescribes that AllocatePages() checks the memory
type.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: need either ACPI table or device tree
Heinrich Schuchardt [Sat, 20 Apr 2019 11:33:55 +0000 (13:33 +0200)]
efi_loader: need either ACPI table or device tree

The EBBR specification prescribes that we should have either an ACPI table
or a device tree but not both. Let us enforce this condition in the
`bootefi` command.

If the bootefi command is called without a device tree parameter use a
previously device tree or fall back to the internal device tree.

The fdt unit test should not be run on boards with an ACPI table.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_selftest: do not run FDT test with ACPI table.
Heinrich Schuchardt [Sat, 20 Apr 2019 11:33:55 +0000 (13:33 +0200)]
efi_selftest: do not run FDT test with ACPI table.

The EBBR specification prescribes that we should have either an ACPI table
or a device tree but not both.

So do not run the device tree unit test on boards with an ACPI table.
Hence there is no need any longer to make it 'on request' only.
Do not pass $fdtcontroladdr to `bootefi selftest`.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agotest/py: pytest.mark.notbuildconfigspec()
Heinrich Schuchardt [Mon, 22 Apr 2019 07:18:55 +0000 (09:18 +0200)]
test/py: pytest.mark.notbuildconfigspec()

We already can let a Python test depend on a build option being set via
@pytest.mark.buildconfigspec(). It may be necessary to let a test depend on
a build option *not* being set. So let's introduce

    @pytest.mark.notbuildconfigspec

for this purpose.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: disable EFI_LOADER on vexpress_ca15_tc2 and ca9x4
Heinrich Schuchardt [Sun, 21 Apr 2019 22:06:20 +0000 (00:06 +0200)]
efi_loader: disable EFI_LOADER on vexpress_ca15_tc2 and ca9x4

vexpress_ca15_tc2_defconfig and vexpress_ca9x4_defconfig do not provide
device trees (as $fdtcontroladdr) as needed to pass our Travis CI tests.

As we are on the move to requiring block devices to be based on the driver
model these boards either will have to be converted to use device trees or
will be kicked out of U-Boot.

So let's disable CONFIG_EFI_LOADER on these boards until the device tree
issue is resolved.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: rework bootmgr/bootefi using load_image API
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:35 +0000 (12:22 +0900)]
efi_loader: rework bootmgr/bootefi using load_image API

In the current implementation, bootefi command and EFI boot manager
don't use load_image API, instead, use more primitive and internal
functions. This will introduce duplicated code and potentially
unknown bugs as well as inconsistent behaviours.

With this patch, do_efibootmgr() and do_boot_efi() are completely
overhauled and re-implemented using load_image API.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Use efi_root as parent handle for the loaded image.
LoadImage() should be called with BootPolicy = true by the boot manager.
Avoid duplicate free_pool().
Eliminate variable memdp which is not needed after anymore due to
"efi_loader: correctly split device path of loaded image".

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: correctly split device path of loaded image
Heinrich Schuchardt [Sat, 20 Apr 2019 19:24:43 +0000 (19:24 +0000)]
efi_loader: correctly split device path of loaded image

When the LoadImage() service is called for an image that is already loaded
to memory the file path may be NULL or it will contain both a device path
as well as a media path. We should not assume that there is no media path.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: carve out do_bootefi_image() from do_bootefi()
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:34 +0000 (12:22 +0900)]
cmd: bootefi: carve out do_bootefi_image() from do_bootefi()

This is a preparatory patch for reworking do_bootefi() in later patch.
All the non-boot-manager-based (that is, bootefi <addr>) code is put
into one function, do_bootefi_image().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: carve out bootmgr code from do_bootefi()
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:33 +0000 (12:22 +0900)]
cmd: bootefi: carve out bootmgr code from do_bootefi()

This is a preparatory patch for reworking do_bootefi() in later patch.
do_bootmgr_exec() is renamed to do_efibootmgr() as we put all the necessary
code into this function.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: move do_bootefi_bootmgr_exec() forward
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:32 +0000 (12:22 +0900)]
cmd: bootefi: move do_bootefi_bootmgr_exec() forward

This is a preparatory patch for reworking do_bootefi() in later patch.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: carve out efi_selftest code from do_bootefi()
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:31 +0000 (12:22 +0900)]
cmd: bootefi: carve out efi_selftest code from do_bootefi()

This is a preparatory patch for reworking do_bootefi() in later patch.

Efi_selftest code is unusual in terms of execution path in do_bootefi(),
which make that function complicated and hard to understand. With this
patch, all efi_selftest related code will be put in a separate function.

The change also includes expanding efi_run_prepare() and efi_run_finish()
in do_bootefi_exec().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: merge efi_install_fdt() and efi_process_fdt()
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:30 +0000 (12:22 +0900)]
cmd: bootefi: merge efi_install_fdt() and efi_process_fdt()

This is a preparatory patch for reworking do_bootefi() in later patch.
For simplicity, merge two functions.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Return error code of efi_install_configuration_table() when aborting from
efi_install_fdt().

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: carve out fdt handling from do_bootefi()
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:29 +0000 (12:22 +0900)]
cmd: bootefi: carve out fdt handling from do_bootefi()

This is a preparatory patch for reworking do_bootefi() in later patch.

Carve out a function to handle the installation of the device tree
as a configuration table in system table.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: rework set_load_options()
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:28 +0000 (12:22 +0900)]
cmd: bootefi: rework set_load_options()

set_load_options() can fail, so it should return error code to stop
invoking an image.
In addition, set_load_options() now takes a handle, instead of
loaded_image_info, to utilize efi_load_image() in a later patch.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: more short texts for protocols in efidebug
Heinrich Schuchardt [Sat, 20 Apr 2019 05:57:28 +0000 (07:57 +0200)]
efi_loader: more short texts for protocols in efidebug

The `efidebug dh` command shows handles and the installed protocols. For
most of the protocols implemented by U-Boot a short text was shown. But for
some only the GUID was displayed.

Provide the missing short texts for the following protocols: HII String,
HII Database, HII Config Routing, Simple Network, PXE Base Code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: consistent naming of protocol GUIDs
Heinrich Schuchardt [Sat, 20 Apr 2019 05:39:11 +0000 (07:39 +0200)]
efi_loader: consistent naming of protocol GUIDs

We should consistently use the same name for protocol GUIDs as defined in
the UEFI specification. Not adhering to this rule has led to duplicate
definitions for the EFI_LOADED_IMAGE_PROTOCOL_GUID.

Adjust misnamed protocol GUIDs.

Adjust the text for the graphics output protocol in the output of the
`efidebug dh` command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: export root node handle
AKASHI Takahiro [Tue, 16 Apr 2019 04:24:20 +0000 (13:24 +0900)]
efi_loader: export root node handle

This is a preparatory patch.
The root node handle will be used as a dummy parent handle when invoking
an EFI image from bootefi/bootmgr command.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Rebased.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: efi_setup_loaded_image() handle missing file name
AKASHI Takahiro [Tue, 16 Apr 2019 15:39:26 +0000 (17:39 +0200)]
efi_loader: efi_setup_loaded_image() handle missing file name

This is a preparatory patch.

efi_dp_split_file_path() is used to create device_path and file_path
from file_path for efi_setup_loaded_image().
In a special case, however, of HARDWARE_DEVICE/MEMORY, it doesn't
work expectedly since this path doesn't contain any FILE_PATH sub-type.

This patch makes a workaround.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Adjust the logic such that for all paths that do no end on a media file
path we return NULL as file_path.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agodt: bcm6858: add led controller
Philippe Reynes [Fri, 22 Mar 2019 16:02:02 +0000 (17:02 +0100)]
dt: bcm6858: add led controller

Add the led controller in the bcm6858 device tree.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agoled: add initial support for bcm6858
Philippe Reynes [Fri, 22 Mar 2019 16:02:01 +0000 (17:02 +0100)]
led: add initial support for bcm6858

The driver add the support of the led IP on bcm6858.
This led IP can drive up to 32 leds, and can handle
blinking.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agoarm: arm64 32bit address relocation
Ibai Erkiaga [Fri, 15 Mar 2019 12:18:41 +0000 (12:18 +0000)]
arm: arm64 32bit address relocation

Current relocation code is limited to 21bit PC-relative addressing
which might not be enough for bigger code sizes. The following patch
increases the addressing to 32bit PC-relative. This feature is
specially interesting if U-Boot is build without optimiation (-O0) as
the text section is increased significativelly.

Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
5 years agotravis: Add srecord package
Marek Vasut [Thu, 14 Mar 2019 00:01:24 +0000 (01:01 +0100)]
travis: Add srecord package

At least MIPS Boston currently uses srec_cat tool to fiddle with
srecords. There will be other platforms coming, so install the
tool to prevent build problems.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Tom Rini <trini@konsulko.com>
5 years agoAdd target to generate initial environment
Stefano Babic [Wed, 13 Mar 2019 08:46:45 +0000 (09:46 +0100)]
Add target to generate initial environment

The initial environment is linked to the u-boot binary. Modifying the
environment from User Space with the env tools requires that the tools
are always built together with the bootloader to be sure that they
contain the initial environment in case no environment is stored into
persistent storage or when a board boots with just the default
environment. This makes difficult for distros to provide a general
package to access the environment. A simpler way is if the tools are
generic for all boards and a configuration file is given to provide the
initial environment.

The patch just generates the initial environment by extracting it from
the compiled object. This file can then be used for tools in user space
to initialize the environment.

Signed-off-by: Stefano Babic <sbabic@denx.de>
5 years agospl: ymodem: Add support for loading full fitImages
Marek Vasut [Wed, 6 Mar 2019 21:04:31 +0000 (22:04 +0100)]
spl: ymodem: Add support for loading full fitImages

Add support for loading fully featured fitImages over YModem in SPL.
This is useful when various advanced features of full fitImages are
needed in SPL.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
5 years agofit: load all fragments from the extra configurations
Peter Ujfalusi [Wed, 6 Mar 2019 13:52:27 +0000 (15:52 +0200)]
fit: load all fragments from the extra configurations

Currently only the first fdt is loaded from the extra configuration of
FIT image.
If the configuration have multiple fdt, load them all as well.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agomisc: fs_loader: Replace label with DT phandle
Tien Fong Chee [Tue, 5 Mar 2019 15:29:38 +0000 (23:29 +0800)]
misc: fs_loader: Replace label with DT phandle

In previously label which will be expanded to the node's full path was
used, and now replacing label with most commonly used DT phandle. The
codes were changed accordingly to the use of DT phandle and supporting
multiple instances.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
5 years agoarm: fix hvc call
Ibai Erkiaga [Mon, 25 Feb 2019 10:11:45 +0000 (10:11 +0000)]
arm: fix hvc call

HVC call makes use of 6 mandatory arguments rather than 7 in the same way
as SMC calls. The 7th argument is optional (Client ID) for both HVC and
SMC but is implemented as 16-bit parameter and register R7 or W7. The aim
of this patch is just fix compilation error due to an invalid asm code in
the HVC call so that's why the 7th argument is removed.

The issue does not report any error in a normal build as hvc_call is not
used at all and is optimized by the compiler. Using -O0 triggers the
error so the patch is intended to fix issues on a ongoing effor to build
U-Boot with -O0.

Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
5 years agoSupport boot Android image without address on bootm command
Shawn Guo [Fri, 22 Feb 2019 08:28:06 +0000 (16:28 +0800)]
Support boot Android image without address on bootm command

It works perfectly fine to boot an Android boot.img with bootm command
followed by an explicit address argument that holds the image.  But if
we have boot.img downloaded into default 'loadaddr', and then boot it
using bootm command without the address argument, we will run into
problem, because U-Boot fails to find ramdisk and fdt (second area) in
boot.img.

The current Android image support assumes there is always an address
argument on bootm command.  However just like booting any other images,
'loadaddr' should be used when address argument is missing from bootm
command.  It patches boot_get_ramdisk() and boot_get_fdt() a bit to
support this quite common usage of bootm command for Android image.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agocmd: ximg.c: Add support for getting external data address and length
Tien Fong Chee [Tue, 12 Feb 2019 12:49:30 +0000 (20:49 +0800)]
cmd: ximg.c: Add support for getting external data address and length

This function supports getting both data address and length for
existing FIT subimage and FIT external data.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
5 years agoARMv8: Disable fwcall when PSCI is enabled
Ang, Chee Hong [Tue, 12 Feb 2019 08:27:03 +0000 (00:27 -0800)]
ARMv8: Disable fwcall when PSCI is enabled

When PSCI is enabled, we are expecting U-Boot which now act
as EL3 software will handle all the PSCI calls. We won't need
fwcall as no further HVC or SMC are needed.

Signed-off-by: Ang, Chee Hong <chee.hong.ang@intel.com>
5 years agoARMv8: Allow SiP service extensions on top of PSCI code
Chee Hong Ang [Tue, 12 Feb 2019 08:27:02 +0000 (00:27 -0800)]
ARMv8: Allow SiP service extensions on top of PSCI code

Allow PSCI layer to handle any SiP service functions added by
platform vendors. PSCI layer will look for SiP service function
in the SiP function table located in '._secure_svc_tbl_entries'
section if the SMC function identifier is not found in the PSCI
standard functions table. Use DECLARE_SECURE_SVC macro to declare
and add platform specific SiP service function.
This new section '._secure_svc_tbl_entries' is located next to
'._secure.text' section. Refer to arch/arm/cpu/armv8/u-boot.lds.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
5 years agotest: call hexdump tests via `ut lib`
Heinrich Schuchardt [Mon, 11 Feb 2019 17:29:24 +0000 (18:29 +0100)]
test: call hexdump tests via `ut lib`

The unit tests in test/lib/hexdump.c are not related to the device tree.
So they should be executed via `ut lib` and not via `ut dm`.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
5 years agomisc: fs_loader: Add support for initializing block device
Tien Fong Chee [Thu, 31 Jan 2019 11:34:13 +0000 (19:34 +0800)]
misc: fs_loader: Add support for initializing block device

Firmware loader would encounter problem if the block device is accessed
before initializing it. This patch would adding the support of probing
block device and initializing block before the block device is accessed by
firmware loader.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agocmd: add exception command
Heinrich Schuchardt [Wed, 26 Dec 2018 16:20:35 +0000 (17:20 +0100)]
cmd: add exception command

The 'exception' command allows to test exception handling.

This implementation supports ARM, x86, RISC-V and the following exceptions:
* 'breakpoint' - prefetch abort exception (ARM 32bit only)
* 'unaligned'  - data abort exception (ARM only)
* 'undefined'  - undefined instruction exception

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agobcm963158: add nand support
Philippe Reynes [Fri, 15 Mar 2019 14:14:47 +0000 (15:14 +0100)]
bcm963158: add nand support

Enable the nand support (driver and command)
in the configuration of the board bcm963158.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agodt: bcm963158: enable nand controller
Philippe Reynes [Fri, 15 Mar 2019 14:14:46 +0000 (15:14 +0100)]
dt: bcm963158: enable nand controller

Enable the nand controller in the device tree
of the board bcm963158.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agodt: bcm63158: add nand controller
Philippe Reynes [Fri, 15 Mar 2019 14:14:45 +0000 (15:14 +0100)]
dt: bcm63158: add nand controller

Add the nand controller in the bcm63158 device tree.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agobcm968580xref: add nand support
Philippe Reynes [Fri, 15 Mar 2019 14:14:44 +0000 (15:14 +0100)]
bcm968580xref: add nand support

Enable the nand support (driver and command)
in the configuration of the board bcm968580xref.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agodt: bcm968580xref: enable nand controller
Philippe Reynes [Fri, 15 Mar 2019 14:14:43 +0000 (15:14 +0100)]
dt: bcm968580xref: enable nand controller

Enable the nand controller in the device tree
of the board bcm968580xref.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agodt: bcm6858: add nand controller
Philippe Reynes [Fri, 15 Mar 2019 14:14:42 +0000 (15:14 +0100)]
dt: bcm6858: add nand controller

Add the nand controller in the bcm6858 device tree.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agobcm968380gerg: add nand support
Philippe Reynes [Fri, 15 Mar 2019 14:14:41 +0000 (15:14 +0100)]
bcm968380gerg: add nand support

Enable the nand support (driver and command)
in the configuration of the board bcm96838gerg.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agodt: bcm968380gerg: enable nand controller
Philippe Reynes [Fri, 15 Mar 2019 14:14:40 +0000 (15:14 +0100)]
dt: bcm968380gerg: enable nand controller

Enable the nand controller in the device tree
of the board bcm96838gerg.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agodt: bcm6838: add nand controller
Philippe Reynes [Fri, 15 Mar 2019 14:14:39 +0000 (15:14 +0100)]
dt: bcm6838: add nand controller

Add the nand controller in the bcm6838 device tree.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agodrivers: nand: brcmnand: add an option to read the write-protect from device tree
Philippe Reynes [Fri, 15 Mar 2019 14:14:38 +0000 (15:14 +0100)]
drivers: nand: brcmnand: add an option to read the write-protect from device tree

The option write-protect may only change on the kernel command line,
we add a property in the device tree to be more flexible.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agodrivers: nand: brcmnand: add parameter parameter-page-big-endian
Philippe Reynes [Fri, 15 Mar 2019 14:14:37 +0000 (15:14 +0100)]
drivers: nand: brcmnand: add parameter parameter-page-big-endian

The parameter page isn't always in big endian, so we add
an option to choose the endiannes of the parameter page.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agodrivers: nand: brcmnand: add initial support
Philippe Reynes [Fri, 15 Mar 2019 14:14:36 +0000 (15:14 +0100)]
drivers: nand: brcmnand: add initial support

The driver brcmnand come from linux kernel 4.18.
Only SoC bcm6838 and bcm6858 are supported.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agocompat linux: import completion from linux 4.18
Philippe Reynes [Fri, 15 Mar 2019 14:14:35 +0000 (15:14 +0100)]
compat linux: import completion from linux 4.18

This patch port the file include/linux/completion.h
from linux 4.18 to u-boot. It define the structure
but all the function are stubbed.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agoinclude: linux: io: define devm_ioremap on board with ioremap
Philippe Reynes [Fri, 15 Mar 2019 14:14:34 +0000 (15:14 +0100)]
include: linux: io: define devm_ioremap on board with ioremap

The macro devm_ioremap is only defined for configuration
that doesn't have ioremap. But this macro may also be
defined on configuration with ioremap.
This patch remove the condition for the macro devm_ioremap,
so it's always defined.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agoarm: asm: io.h: define readX_relaxed and writeX_relaxed
Philippe Reynes [Fri, 15 Mar 2019 14:14:33 +0000 (15:14 +0100)]
arm: asm: io.h: define readX_relaxed and writeX_relaxed

This patch port the function readX_relaxed and
writeX_relaxed from kernel 4.18.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agomtd: nand: provide several helpers to do common NAND operations
Boris Brezillon [Fri, 15 Mar 2019 14:14:32 +0000 (15:14 +0100)]
mtd: nand: provide several helpers to do common NAND operations

Linux commit 97d90da8a88 ("mtd: nand: provide several helpers
to do common NAND operations")

This is part of the process of removing direct calls to ->cmdfunc()
outside of the core in order to introduce a better interface to execute
NAND operations.

Here we provide several helpers and make use of them to remove all
direct calls to ->cmdfunc(). This way, we can easily modify those
helpers to make use of the new ->exec_op() interface when available.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[miquel.raynal@free-electrons.com: rebased and fixed some conflicts]
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[Philippe Reynes: adapt code to u-boot and only keep new function]

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agomtd: nand: import nand_hw_control_init()
Marc Gonzalez [Fri, 15 Mar 2019 14:14:31 +0000 (15:14 +0100)]
mtd: nand: import nand_hw_control_init()

Linux commit d45bc58dd3b ("mtd: nand: import nand_hw_control_init()")

The code to initialize a struct nand_hw_control is duplicated across
several drivers. Factorize it using an inline function.

Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Philippe Reynes: adapt code to u-boot and only keep new function]

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agomtd: add get/set of_node/flash_node helpers
Brian Norris [Fri, 15 Mar 2019 14:14:30 +0000 (15:14 +0100)]
mtd: add get/set of_node/flash_node helpers

Linux commit 28b8b26b308 ("mtd: add get/set of_node/flash_node helpers")

We are going to begin using the mtd->dev.of_node field for MTD device
nodes, so let's add helpers for it. Also, we'll be making some
conversions on spi_nor (and nand_chip eventually) too, so get that ready
with their own helpers.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Philippe Reynes: only add function nand_set_flash_node and
nand_get_flash_node because others were already backported]

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agoMerge tag 'u-boot-atmel-2019.07-b' of git://git.denx.de/u-boot-atmel
Tom Rini [Mon, 22 Apr 2019 14:28:21 +0000 (10:28 -0400)]
Merge tag 'u-boot-atmel-2019.07-b' of git://git.denx.de/u-boot-atmel

Second set of u-boot-atmel features and fixes for 2019.07 cycle

5 years agoat91: corvus_defconfig: get rid of build warnings
Heiko Schocher [Mon, 15 Apr 2019 11:53:19 +0000 (13:53 +0200)]
at91: corvus_defconfig: get rid of build warnings

fix CONFIG_OF_EMBED and add CONFIG_DM_USB
build warnings.

Signed-off-by: Heiko Schocher <hs@denx.de>
5 years agoMerge branch 'master' of git://git.denx.de/u-boot-usb
Tom Rini [Sun, 21 Apr 2019 23:00:04 +0000 (19:00 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-usb

- Various fastboot, dwc2/stm32 updates

5 years agoMerge branch 'master' of git://git.denx.de/u-boot-socfpga
Tom Rini [Sun, 21 Apr 2019 22:59:30 +0000 (18:59 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-socfpga

- Various stratix10, gen5 updates

5 years agousb: dwc2: fix gadget disconnect
Fabrice Gasnier [Wed, 17 Apr 2019 14:46:13 +0000 (16:46 +0200)]
usb: dwc2: fix gadget disconnect

This fixes a disconnect issue detected with fastboot command, when using
dwc2 driver.
- On u-boot side:
uboot>$ fastboot 0
- On USB host PC side, few seconds after
PC>$ fastboot reboot # Get stuck, uboot target never reboots

By enabling DEBUG_ISR logs, the bus suspend interrupt is seen before the
PC command has been issued. When the USB bus suspend occurs, there's a HACK
that disables the fastboot (composite driver). Here is the call stack
upon USB bus suspend:
- dwc2_handle_usb_suspend_intr()
  - dev->driver->disconnect()
    - composite_disconnect()
      - reset_config()
        - f->disable()
          - fastboot_disable()
            - usb_ep_disable(f_fb->out_ep);
            - usb_ep_disable(f_fb->in_ep);
            .. other disable calls.

When the resume interrupt happens, everything has been disabled, then
nothing happens. fastboot command gets stuck on HOST side.

Remove original HACK, that disconnects the composite driver upon
USB bus suspend. Implement disconnect detection instead:
- check GINTSTS OTG interrupt
- read GOTGINT register
- check GOTGINT, SesEndDet bit (e.g. session end)
This is inspired by what is implemented currently in Linux dwc2 driver.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
5 years agousb: reload watchdog during ums command
Patrick Delaunay [Thu, 18 Apr 2019 15:18:39 +0000 (17:18 +0200)]
usb: reload watchdog during ums command

Reload the watchdog in the mass storage command ums
to avoid reboot during the usb waiting loop
when the host doesn't send any request.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
5 years agofastboot: add support for 'getvar platform'
Eugeniu Rosca [Tue, 9 Apr 2019 19:11:40 +0000 (21:11 +0200)]
fastboot: add support for 'getvar platform'

Our R-Car3 Android userspace relies on the output of 'fastboot
getvar platform' and U-Boot currently is not able to handle it:

host $> fastboot getvar platform
getvar:platform FAILED (remote: Variable not implemented)
finished. total time: 0.001s

We either have the option of adding 'fastboot.platform' variable
to the default/saved environment as a workaround or add proper
'fastboot getvar platform' support in U-Boot via this patch.
In the latter case, other platforms can benefit from it too.

Note that R-Car3 already exports 'platform' environment variable via
v2019.01 commit 00e4b57e9e71c3 ("ARM: rmobile: Set environment variable
containing CPU type").

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
5 years agofastboot: Replace literal 32 with PART_NAME_LEN
Alex Kiernan [Tue, 9 Apr 2019 05:30:05 +0000 (05:30 +0000)]
fastboot: Replace literal 32 with PART_NAME_LEN

Where we have to compute partition names, rather than using a hardcoded
32 for the partition name length, replace with PART_NAME_LEN.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Reviewed-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
5 years agostm32mp1: add stusb1600 support for DK1 and DK2 board
Patrick Delaunay [Fri, 29 Mar 2019 14:42:24 +0000 (15:42 +0100)]
stm32mp1: add stusb1600 support for DK1 and DK2 board

The DK1 and DK2 boards use the USB Type-C controller STUSB1600.
This patch updates:
- the device tree to add the I2C node in the DT
- the board stm32mp1 to probe this I2C device and use this controller
  to check cable detection.
- the DWC2 driver to support a new dt property
  "u-boot,force-b-session-valid" which forces B session and
  device mode; it is a workaround because the VBUS sensing and
  ID detection isn't available with stusb1600.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
5 years agostm32mp1: migrate USBOTG device to driver model
Patrick Delaunay [Fri, 29 Mar 2019 14:42:23 +0000 (15:42 +0100)]
stm32mp1: migrate USBOTG device to driver model

Use the DWC2 device driver with DM_USB_GADGET support and
cleanup the USB support in STM32MP1 board.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
5 years agostm32mp1: remove CONFIG_USB_DWC2, HOST support for USBO
Patrick Delaunay [Fri, 29 Mar 2019 14:42:22 +0000 (15:42 +0100)]
stm32mp1: remove CONFIG_USB_DWC2, HOST support for USBO

Remove the HOST support for STM32MP1 USBO device = OTG DWC2.
The current DWC2 driver have no dynamic detection of device,
So it is dangerous to have start 3V3 when PC is
connected to the micro USB connector.

=> it is preferable to have only DEVICE support
   CONFIG_USB_GADGET_DWC2_OTG for OTG port

See DWC3 driver for clean dual role support...

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
5 years agousb: dwc2: add support for STM32MP1
Patrick Delaunay [Fri, 29 Mar 2019 14:42:21 +0000 (15:42 +0100)]
usb: dwc2: add support for STM32MP1

Add compatible "st,stm32mp1-hsotg" and associated driver data to manage
the usb33d-supply and the ST specific register for VBus sensing.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
# Conflicts:
# drivers/usb/gadget/dwc2_udc_otg.c
Reviewed-by: Lukasz Majewski <lukma@denx.de>
5 years agousb: dwc2_udc_otg: Add tx_fifo_sz array support
Patrice Chotard [Fri, 29 Mar 2019 14:42:20 +0000 (15:42 +0100)]
usb: dwc2_udc_otg: Add tx_fifo_sz array support

All TX fifo size can be different, add tx_fifo_sz_array[]
into dwc2_plat_otg_data to be able to set them.

tx_fifo_sz_array[] is 17 Bytes long and can contains max 16
tx fifo size (synopsys IP supports max 16 IN endpoints).
First entry of tx_fifo_sz_array[] is the number of valid
fifo size the array contains.

In case of tx_fifo_sz_array[] doesn't contains the same
number of element than max hardware endpoint, display
a warning message.

Compatibility with board which doesn't use tx_fifo_sz_array[]
(Rockchip rk322x/rk3128/rv1108/rk3288/rk3036) is kept.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
5 years agousb: dwc2_udc_otg: Read MAX_HW_ENDPOINT from HWCFG4 register
Patrick Delaunay [Fri, 29 Mar 2019 14:42:19 +0000 (15:42 +0100)]
usb: dwc2_udc_otg: Read MAX_HW_ENDPOINT from HWCFG4 register

Some DWC2 ip variant doesn't use 16 hardware endpoint as hardcoded
in the driver. Bits INEps [29:26] of HWCFG4 register allows to get
this information.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
5 years agousb: dwc2: Add function for session B check
Patrick Delaunay [Fri, 29 Mar 2019 14:42:18 +0000 (15:42 +0100)]
usb: dwc2: Add function for session B check

Add a new function to check the session B validity, to be use to check
cable connection.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
5 years agousb: dwc2: Add force-b-session-valid support
Patrick Delaunay [Fri, 29 Mar 2019 14:42:17 +0000 (15:42 +0100)]
usb: dwc2: Add force-b-session-valid support

Handle "force-b-session-valid" property from DT.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
5 years agousb: dwc2: force reset assert before to probe the driver
Patrick Delaunay [Fri, 29 Mar 2019 14:42:16 +0000 (15:42 +0100)]
usb: dwc2: force reset assert before to probe the driver

Reset the hardware to be sure of the device state.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
5 years agousb: dwc2: convert driver to DM_USB_GADGET
Patrick Delaunay [Fri, 29 Mar 2019 14:42:15 +0000 (15:42 +0100)]
usb: dwc2: convert driver to DM_USB_GADGET

Minimal conversion to driver model by using the uclass
UCLASS_USB_GADGET_GENERIC based on:
- reset uclass
- clock uclass
- generic uclass.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
5 years agousb: dwc2: remove unused variable regs_otg
Patrick Delaunay [Fri, 29 Mar 2019 14:42:14 +0000 (15:42 +0100)]
usb: dwc2: remove unused variable regs_otg

Remove the global regs_otg variable.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>