]> git.ipfire.org Git - people/ms/u-boot.git/log
people/ms/u-boot.git
7 years agopinctrl: stm32: add stm32h743-pinctrl compatible
Patrice Chotard [Wed, 13 Sep 2017 16:00:04 +0000 (18:00 +0200)] 
pinctrl: stm32: add stm32h743-pinctrl compatible

STM32H7 SoCs uses the same pinctrl block as found into
STM32F7 SoCs

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
7 years agospl: stash bootstage info before jump to next stage
Kever Yang [Wed, 13 Sep 2017 10:24:24 +0000 (18:24 +0800)] 
spl: stash bootstage info before jump to next stage

Since we may jump to next stage like ATF/OP-TEE instead of U-Boot,
we need to stash the bootstage info before it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoboard: STiH410-B2260: add fastboot support
Patrice Chotard [Tue, 5 Sep 2017 09:04:27 +0000 (11:04 +0200)] 
board: STiH410-B2260: add fastboot support

Add usb_gadget_handle_interrupts(), board_usb_init(),
board_usb_cleanup() and g_dnl_board_usb_cable_connected()
callbacks needed for FASTBOOT support

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoARM: dts: STiH410: update ehci and ohci compatible
Patrice Chotard [Tue, 5 Sep 2017 09:04:26 +0000 (11:04 +0200)] 
ARM: dts: STiH410: update ehci and ohci compatible

Update ehci and ohci node's compatible string in order to
use ehci-generic and ohci-generic drivers.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoARM: dts: STiH410: set DWC3 dual role mode to peripheral
Patrice Chotard [Tue, 5 Sep 2017 09:04:25 +0000 (11:04 +0200)] 
ARM: dts: STiH410: set DWC3 dual role mode to peripheral

On STi 96boards, configure by default the micro USB connector
(managed by DWC3 hardware block) in peripheral mode.
This will allow to use fastboot feature.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agousb: dwc3: Add dwc3 glue driver support for STi
Patrice Chotard [Tue, 5 Sep 2017 09:04:24 +0000 (11:04 +0200)] 
usb: dwc3: Add dwc3 glue driver support for STi

This patch adds the ST glue logic to manage the DWC3 HC
on STiH407 SoC family. It configures the internal glue
logic and syscfg registers.

Part of this code been extracted from kernel.org driver
(drivers/usb/dwc3/dwc3-st.c)

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoSTiH410-B2260: enable USB, fastboot, reset, PHY related flags
Patrice Chotard [Tue, 5 Sep 2017 09:04:23 +0000 (11:04 +0200)] 
STiH410-B2260: enable USB, fastboot, reset, PHY related flags

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoSTiH410-B2260: enable USB Host Networking
Patrice Chotard [Tue, 5 Sep 2017 09:04:22 +0000 (11:04 +0200)] 
STiH410-B2260: enable USB Host Networking

Enable USB Host Networking support by enabling Ethernet/USB
adaptors support and by enabling some BOOTP flags

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agousb: phy: Add STi USB2 PHY
Patrice Chotard [Tue, 5 Sep 2017 09:04:21 +0000 (11:04 +0200)] 
usb: phy: Add STi USB2 PHY

This is the generic phy driver for the picoPHY ports
used by USB2/1.1 controllers. It is found on STiH407 SoC
family from STMicroelectronics.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agommc: sti_sdhci: Use reset framework
Patrice Chotard [Tue, 5 Sep 2017 09:04:20 +0000 (11:04 +0200)] 
mmc: sti_sdhci: Use reset framework

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoARM: dts: stih410-family: Add missing reset_names for mmc1 node
Patrice Chotard [Tue, 5 Sep 2017 09:04:19 +0000 (11:04 +0200)] 
ARM: dts: stih410-family: Add missing reset_names for mmc1 node

reset-names property is needed to use the reset
API for STi sdhci driver.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agommc: sti_sdhci: Rework sti_mmc_core_config()
Patrice Chotard [Tue, 5 Sep 2017 09:04:18 +0000 (11:04 +0200)] 
mmc: sti_sdhci: Rework sti_mmc_core_config()

Use struct udevice* as input parameter. Previous
parameters are retrieved through plat and priv data.

This to prepare to use the reset framework.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agopci: Remove unnecessary 'default n' from Kconfig
Tuomas Tynkkynen [Fri, 1 Sep 2017 14:26:02 +0000 (17:26 +0300)] 
pci: Remove unnecessary 'default n' from Kconfig

'default n' is the default anyway so it doesn't need to be specified
explicitly, and the rest of the file doesn't specify it either anywhere.
Drop it.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agopci: layerscape: Remove unused field 'hose' from struct ls_pcie
Tuomas Tynkkynen [Fri, 1 Sep 2017 14:26:01 +0000 (17:26 +0300)] 
pci: layerscape: Remove unused field 'hose' from struct ls_pcie

This field is no longer used since the DM conversion. Drop it.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agopci: tegra: Remove unused field 'hose' from struct tegra_pcie
Tuomas Tynkkynen [Fri, 1 Sep 2017 14:26:00 +0000 (17:26 +0300)] 
pci: tegra: Remove unused field 'hose' from struct tegra_pcie

This field is no longer used since the DM conversion. Drop it.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agopci: xilinx: Remove unused field 'hose' from struct xilinx_pcie
Tuomas Tynkkynen [Fri, 1 Sep 2017 14:25:59 +0000 (17:25 +0300)] 
pci: xilinx: Remove unused field 'hose' from struct xilinx_pcie

This field has never been used as the driver has been DM-based since the
beginning. Drop it.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agopci: xilinx: Fix doc comments on config space accessors
Tuomas Tynkkynen [Fri, 1 Sep 2017 14:25:58 +0000 (17:25 +0300)] 
pci: xilinx: Fix doc comments on config space accessors

These take the 'struct udevice *' as an argument, not the
'struct xilinx_pcie *` which is a local variable. Fix the comments to
match the code.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agofs/fat: Reduce stack usage
Tom Rini [Fri, 22 Sep 2017 11:37:43 +0000 (07:37 -0400)] 
fs/fat: Reduce stack usage

We have limited stack in SPL builds.  Drop itrblock and move to
malloc/free of itr to move this off of the stack.  As part of this fix a
double-free issue in fat_size().

Signed-off-by: Tom Rini <trini@konsulko.com>
---
Rework to use malloc/free as moving this to a global overflows some SH
targets.

7 years agoMerge branch 'next' of git://git.denx.de/u-boot-video
Tom Rini [Thu, 21 Sep 2017 11:51:20 +0000 (07:51 -0400)] 
Merge branch 'next' of git://git.denx.de/u-boot-video

7 years agoefi_loader: fix efi_exit
Rob Clark [Wed, 20 Sep 2017 22:23:42 +0000 (18:23 -0400)] 
efi_loader: fix efi_exit

efi_exit() already restores gd, so we shouldn't EFI_EXIT() on the
otherside of the longjmp().

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agonds32: spi: Support spi dm driver.
rick [Mon, 28 Aug 2017 07:08:01 +0000 (15:08 +0800)] 
nds32: spi: Support spi dm driver.

Support spi driver and can detect MX25U1635E flash on AE3XX board.

Verification:

sf probe 0:0 50000000 0
spi_flash_std_probe(sf_Probr.c)
spi_flash_probe_slave(sf_Probr.c)
SF: Detected mx25u1635e with page size 256 Bytes, erase size 4 KiB, total 2 MiB
NDS32 # sf test 0x100000 0x1000
SPI flash test:
0 erase: 34 ticks, 117 KiB/s 0.936 Mbps
1 check: 15 ticks, 266 KiB/s 2.128 Mbps
2 write: 21 ticks, 190 KiB/s 1.520 Mbps
3 read: 11 ticks, 363 KiB/s 2.904 Mbps
Test passed
0 erase: 34 ticks, 117 KiB/s 0.936 Mbps
1 check: 15 ticks, 266 KiB/s 2.128 Mbps
2 write: 21 ticks, 190 KiB/s 1.520 Mbps
3 read: 11 ticks, 363 KiB/s 2.904 Mbps

Signed-off-by: rick <rick@andestech.com>
7 years agonds32: board: Support SPI driver.
rick [Mon, 28 Aug 2017 07:13:09 +0000 (15:13 +0800)] 
nds32: board: Support SPI driver.

Add spi dts node and enable spi dm flash config.

Signed-off-by: rick <rick@andestech.com>
7 years agonds32: mtd: add spi flash id MX25U16335E.
rick [Mon, 28 Aug 2017 02:09:01 +0000 (10:09 +0800)] 
nds32: mtd: add spi flash id MX25U16335E.

To support MACRONIX MX25U1635E 16M-BIT flash.

Signed-off-by: rick <rick@andestech.com>
7 years agonds32: ftmac100: Fix write mac addr fail problem.
rick [Tue, 29 Aug 2017 02:15:05 +0000 (10:15 +0800)] 
nds32: ftmac100: Fix write mac addr fail problem.

After soft reset complete, write mac address immediately will fail.
Add delay to work around this problem.

Signed-off-by: rick <rick@andestech.com>
7 years agonds32: ftmac100 support cache enable.
rick [Tue, 29 Aug 2017 02:12:02 +0000 (10:12 +0800)] 
nds32: ftmac100 support cache enable.

Enable cache and ftmac100 performance can be improved.

Signed-off-by: rick <rick@andestech.com>
7 years agonds32: ftmac100: support cache enable.
rick [Tue, 29 Aug 2017 02:09:00 +0000 (10:09 +0800)] 
nds32: ftmac100: support cache enable.

Add cache inval and flush when rx and tx.

Signed-off-by: rick <rick@andestech.com>
7 years agonds32: bootm: Fix warning of struct tag_serialnr declared
rick [Mon, 28 Aug 2017 05:31:48 +0000 (13:31 +0800)] 
nds32: bootm: Fix warning of struct tag_serialnr declared

move #include <asm/setup.h> from bootm.c to bootm.h

Signed-off-by: rick <rick@andestech.com>
7 years agonds32: board: Fix andestech adp-ae3xx.c make fail problem.
rick [Mon, 28 Aug 2017 03:04:40 +0000 (11:04 +0800)] 
nds32: board: Fix andestech adp-ae3xx.c make fail problem.

Add #include <asm/mach-types.h> to fix it.

Signed-off-by: rick <rick@andestech.com>
7 years agoefi_loader: reenable selftest
Heinrich Schuchardt [Wed, 20 Sep 2017 20:54:58 +0000 (22:54 +0200)] 
efi_loader: reenable selftest

ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling
leads to an error when building with CONFIG_CMD_BOOTEFI_SELFTEST=y
This patch fixes the problem.

Fixes: ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoMerge git://www.denx.de/git/u-boot-imx
Tom Rini [Wed, 20 Sep 2017 16:32:34 +0000 (12:32 -0400)] 
Merge git://www.denx.de/git/u-boot-imx

7 years agomx6sabresd: Add Serial Download Protocol support
Fabio Estevam [Tue, 5 Sep 2017 23:46:40 +0000 (20:46 -0300)] 
mx6sabresd: Add Serial Download Protocol support

Add Serial Download Protocol support (SDP), which allows loading
SPL and u-boot.img via imx_usb_loader tool as explained in
doc/README.sdp.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
7 years agotoradex: imx6: Move g_dnl_bind_fixup() into common SPL code
Fabio Estevam [Tue, 5 Sep 2017 23:46:39 +0000 (20:46 -0300)] 
toradex: imx6: Move g_dnl_bind_fixup() into common SPL code

Instead of having every board file to add its own g_dnl_bind_fixup()
implementation, move it to the common imx6 SPL code.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Ɓukasz Majewski <lukma@denx.de>
7 years agoboard: ge: bx50v3: set eth0 MAC address
Ian Ray [Tue, 22 Aug 2017 06:03:54 +0000 (09:03 +0300)] 
board: ge: bx50v3: set eth0 MAC address

Define i2c mux configuration.  Add new vpd_reader which is used to read
vital product data.  Read VPD from EEPROM and set eth0 MAC address.

Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Jose Alarcon <jose.alarcon@ge.com>
7 years agodetect and setup solidrun hummingboard2
Dennis Gilmore [Thu, 24 Aug 2017 15:49:43 +0000 (10:49 -0500)] 
detect and setup solidrun hummingboard2

The hummingboard2 is slightly different to the cubox i and to the
hummingboard. The GPIO pin info to probe came from solidruns
for of u-boot on github.
https://github.com/SolidRun/u-boot-imx6/blob/imx6/board/solidrun/mx6_cubox-i/mx6_cubox-i.c#L569-L589
I have tested on a hummingboard-edge witha  imx6 solo and 512mb of
ram.

Signed-off-by: Dennis Gilmore <dgilmore@redhat.com>
7 years agoefi_loader: Some console improvements for vidconsole
Rob Clark [Wed, 13 Sep 2017 22:05:44 +0000 (18:05 -0400)] 
efi_loader: Some console improvements for vidconsole

1) use fputs() to reduce cache flushes from once-per-char to
   once-per-string
2) handle \r, \t, and \b in addition to just \n for tracking
   cursor position
3) cursor row/col are zero based, not one based

Signed-off-by: Rob Clark <robdclark@gmail.com>
[agraf: s/unsigned/unsigned int/]
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: Correctly figure out size for vidconsole
Rob Clark [Wed, 13 Sep 2017 22:05:43 +0000 (18:05 -0400)] 
efi_loader: Correctly figure out size for vidconsole

If stdout is vidconsole, we cannot rely on ANSI escape sequences to
query the size, as vidconsole cannot reply on stdin.  Instead special-
case this if stdout is vidconsole.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: split out escape sequence based size query
Rob Clark [Wed, 13 Sep 2017 22:05:42 +0000 (18:05 -0400)] 
efi_loader: split out escape sequence based size query

We need to do something different for vidconsole, since it cannot
respond to the query on stdin.  Prep work for next patch.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: print GUIDs
Rob Clark [Wed, 13 Sep 2017 22:05:41 +0000 (18:05 -0400)] 
efi_loader: print GUIDs

Utilize printf GUID support to print GUIDs.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: set loaded image code/data type properly
Rob Clark [Wed, 13 Sep 2017 22:05:40 +0000 (18:05 -0400)] 
efi_loader: set loaded image code/data type properly

These should be set according to the image type.  Shell.efi and SCT.efi
use these fields to determine what sort of image they are loading.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: file_path should be variable length
Rob Clark [Wed, 13 Sep 2017 22:05:39 +0000 (18:05 -0400)] 
efi_loader: file_path should be variable length

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: add bootmgr
Rob Clark [Wed, 13 Sep 2017 22:05:38 +0000 (18:05 -0400)] 
efi_loader: add bootmgr

Similar to a "real" UEFI implementation, the bootmgr looks at the
BootOrder and BootXXXX variables to try to find an EFI payload to load
and boot.  This is added as a sub-command of bootefi.

The idea is that the distro bootcmd would first try loading a payload
via the bootmgr, and then if that fails (ie. first boot or corrupted
EFI variables) it would fallback to loading bootaa64.efi.  (Which
would then load fallback.efi which would look for \EFI\*\boot.csv and
populate BootOrder and BootXXXX based on what it found.)

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi variable support
Rob Clark [Wed, 13 Sep 2017 22:05:37 +0000 (18:05 -0400)] 
efi_loader: efi variable support

Add EFI variable support, mapping to u-boot environment variables.
Variables are pretty important for setting up boot order, among other
things.  If the board supports saveenv, then it will be called in
ExitBootServices() to persist variables set by the efi payload.  (For
example, fallback.efi configuring BootOrder and BootXXXX load-option
variables.)

Variables are *not* currently exposed at runtime, post ExitBootServices.
On boards without a dedicated device for storage, which the loaded OS
is not trying to also use, this is rather tricky.  One idea, at least
for boards that can persist RAM across reboot, is to keep a "journal"
of modified variables in RAM, and then turn halt into a reboot into
u-boot, plus store variables, plus halt.  Whatever the solution, it
likely involves some per-board support.

Mapping between EFI variables and u-boot variables:

  efi_$guid_$varname = {attributes}(type)value

For example:

  efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported=
     "{ro,boot,run}(blob)0000000000000000"
  efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_BootOrder=
     "(blob)00010000"

The attributes are a comma separated list of these possible
attributes:

  + ro   - read-only
  + boot - boot-services access
  + run  - runtime access

NOTE: with current implementation, no variables are available after
ExitBootServices, and all are persisted (if possible).

If not specified, the attributes default to "{boot}".

The required type is one of:

  + utf8 - raw utf8 string
  + blob - arbitrary length hex string

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: make pool allocations cacheline aligned
Rob Clark [Wed, 13 Sep 2017 22:05:36 +0000 (18:05 -0400)] 
efi_loader: make pool allocations cacheline aligned

This avoids printf() spam about file reads (such as loading an image)
into unaligned buffers (and the associated memcpy()).  And generally
seems like a good idea.

Signed-off-by: Rob Clark <robdclark@gmail.com>
[agraf: use __aligned]
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: support load_image() from a file-path
Rob Clark [Wed, 13 Sep 2017 22:05:35 +0000 (18:05 -0400)] 
efi_loader: support load_image() from a file-path

Previously we only supported the case when the EFI application loaded
the image into memory for us.  But fallback.efi does not do this.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: add file/filesys support
Rob Clark [Wed, 13 Sep 2017 22:05:34 +0000 (18:05 -0400)] 
efi_loader: add file/filesys support

fallback.efi (and probably other things) use UEFI's simple-file-system
protocol and file support to search for OS's to boot.

Signed-off-by: Rob Clark <robdclark@gmail.com>
[agraf: whitespace fixes, unsigned fixes]
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: refactor boot device and loaded_image handling
Rob Clark [Wed, 13 Sep 2017 22:05:33 +0000 (18:05 -0400)] 
efi_loader: refactor boot device and loaded_image handling

Get rid of the hacky fake boot-device and duplicate device-path
constructing (which needs to match what efi_disk and efi_net do).
Instead convert over to use efi_device_path helpers to construct
device-paths, and use that to look up the actual boot device.

Also, extract out a helper to plug things in properly to the
loaded_image.  In a following patch we'll want to re-use this in
efi_load_image() to handle the case of loading an image from a
file_path.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: use proper device-paths for net
Rob Clark [Wed, 13 Sep 2017 22:05:32 +0000 (18:05 -0400)] 
efi_loader: use proper device-paths for net

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: use proper device-paths for partitions
Rob Clark [Wed, 13 Sep 2017 22:05:31 +0000 (18:05 -0400)] 
efi_loader: use proper device-paths for partitions

Also, create disk objects for the disk itself, in addition to the
partitions.  (UEFI terminology is a bit confusing, a "disk" object is
really a partition.)  This helps grub properly identify the boot device
since it is trying to match up partition "disk" object with it's parent
device.

Now instead of seeing devices like:

  /File(sdhci@07864000.blk)/EndEntire
  /File(usb_mass_storage.lun0)/EndEntire

You see:

  /ACPI(133741d0,0)/UnknownMessaging(1d)/EndEntire
  /ACPI(133741d0,0)/UnknownMessaging(1d)/HD(0,800,64000,dd904a8c00000000,1,1)/EndEntire
  /ACPI(133741d0,0)/UnknownMessaging(1d)/HD(1,64800,200000,dd904a8c00000000,1,1)/EndEntire
  /ACPI(133741d0,0)/UnknownMessaging(1d)/HD(2,264800,19a000,dd904a8c00000000,1,1)/EndEntire
  /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/EndEntire
  /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/HD(0,800,60000,38ca680200000000,1,1)/EndEntire
  /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/HD(1,61000,155000,38ca680200000000,1,1)/EndEntire
  /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/HD(2,20fa800,1bbf8800,38ca680200000000,1,1)/EndEntire
  /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/HD(3,1b6800,1f44000,38ca680200000000,1,1)/EndEntire

This is on a board with single USB disk and single sd-card.  The
UnknownMessaging(1d) node in the device-path is the MMC device,
but grub_efi_print_device_path() hasn't been updated yet for some
of the newer device-path sub-types.

This patch is inspired by a patch originally from Peter Jones, but
re-worked to use efi_device_path, so it doesn't much resemble the
original.

Signed-off-by: Rob Clark <robdclark@gmail.com>
[agraf: s/unsigned/unsigned int/]
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: flesh out device-path to text
Rob Clark [Wed, 13 Sep 2017 22:05:30 +0000 (18:05 -0400)] 
efi_loader: flesh out device-path to text

It needs to handle more device-path node types, and also multiple levels
of path hierarchy.  To simplify this, initially construct utf8 string to
a temporary buffer, and then allocate the real utf16 buffer that is
returned.  This should be mostly for debugging or at least not critical-
path so an extra copy won't hurt, and is saner than the alternative.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: drop redundant efi_device_path_protocol
Rob Clark [Wed, 13 Sep 2017 22:05:29 +0000 (18:05 -0400)] 
efi_loader: drop redundant efi_device_path_protocol

This is really the same thing as the efi_device_path struct.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: add device-path utils
Rob Clark [Wed, 13 Sep 2017 22:05:28 +0000 (18:05 -0400)] 
efi_loader: add device-path utils

Helpers to construct device-paths from devices, partitions, files, and
for parsing and manipulating device-paths.

For non-legacy devices, this will use u-boot's device-model to construct
device-paths which include bus hierarchy to construct device-paths.  For
legacy devices we still fake it, but slightly more convincingly.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi: add some more device path structures
Peter Jones [Wed, 13 Sep 2017 22:05:27 +0000 (18:05 -0400)] 
efi: add some more device path structures

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi: add some missing __packed
Rob Clark [Wed, 13 Sep 2017 22:05:26 +0000 (18:05 -0400)] 
efi: add some missing __packed

All of the device-path related structures should be packed.  UEFI
defines the device-path as a byte-aligned data structure.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agopart: extract MBR signature from partitions
Peter Jones [Wed, 13 Sep 2017 22:05:25 +0000 (18:05 -0400)] 
part: extract MBR signature from partitions

EFI client programs need the signature information from the partition
table to determine the disk a partition is on, so we need to fill that
in here.

Signed-off-by: Peter Jones <pjones@redhat.com>
[separated from efi_loader part, and fixed build-errors for non-
 CONFIG_EFI_PARTITION case]
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agopart: move efi_guid_t
Rob Clark [Wed, 13 Sep 2017 22:05:24 +0000 (18:05 -0400)] 
part: move efi_guid_t

Prep work for next patch.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: check notification of ExitBootServices
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:19 +0000 (10:06 +0200)] 
efi_selftest: check notification of ExitBootServices

Check that the notification function of an
EVT_SIGNAL_EXIT_BOOT_SERVICES event is called
exactly once.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: notify when ExitBootServices is invoked
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:18 +0000 (10:06 +0200)] 
efi_loader: notify when ExitBootServices is invoked

All events of type EVT_SIGNAL_EXIT_BOOT_SERVICES have to be
notified when ExitBootServices is invoked.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: test task priority levels
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:17 +0000 (10:06 +0200)] 
efi_selftest: test task priority levels

Run a 10 ms periodic timer and check that it is called 10 times
while waiting for 100 ms single shot timer.

Raise the TPL level to the level of the 10 ms timer and observe
that the notification function is not called again.

Lower the TPL level and check that the queued notification
function is called.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: implement task priority level (TPL)
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:16 +0000 (10:06 +0200)] 
efi_loader: implement task priority level (TPL)

Define variable holding tpl.
Implement RaiseTPL and RestoreTPL.
Implement TPL check in efi_signal_event.
Implement TPL check in efi_wait_for_event.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: provide unit test for event services
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:15 +0000 (10:06 +0200)] 
efi_selftest: provide unit test for event services

This unit test uses timer events to check the implementation
of the following boottime services:
CreateEvent, CloseEvent, WaitForEvent, CheckEvent, SetTimer

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi_set_timer: reset signaled state
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:14 +0000 (10:06 +0200)] 
efi_loader: efi_set_timer: reset signaled state

We should be able to call efi_set_timer repeatedly.
So let us reset the signaled state here.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: implement queueing of the notification function
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:13 +0000 (10:06 +0200)] 
efi_loader: implement queueing of the notification function

For the correct implementation of the task priority level (TPL)
calling the notification function must be queued.

Add a status field 'queued' to events.

In function efi_signal_event set status queued if a notification
function exists and reset it after we have called the function.
A later patch will add a check of the TPL here.

In efi_create_event and efi_close_event unset the queued status.

In function efi_wait_for_event and efi_check_event
queue the notification function.

In efi_timer_check call the efi_notify_event
if the status queued is set.
For all timer events set status signaled.

In efi_console_timer_notify set the signaled state of the
WaitForKey event.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agotest/py: add a test calling the EFI selftest
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:12 +0000 (10:06 +0200)] 
test/py: add a test calling the EFI selftest

A Python test script is provided that runs the EFI selftest
if CONFIG_CMD_EFI_SELFTEST=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: provide an EFI selftest application
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:11 +0000 (10:06 +0200)] 
efi_selftest: provide an EFI selftest application

A testing framework for the EFI API is provided.
It can be executed with the 'bootefi selftest' command.

It is coded in a way that at a later stage we may turn it
into a standalone EFI application. The current build system
does not allow this yet.

All tests use a driver model and are run in three phases:
setup, execute, teardown.

A test may be setup and executed at boottime,
it may be setup at boottime and executed at runtime,
or it may be setup and executed at runtime.

After executing all tests the system is reset.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: allow return value in EFI_CALL
Heinrich Schuchardt [Fri, 15 Sep 2017 08:06:10 +0000 (10:06 +0200)] 
efi_loader: allow return value in EFI_CALL

Macro EFI_CALL was introduced to call an UEFI function.
Unfortunately it does not support return values.
Most UEFI functions have a return value.

So let's rename EFI_CALL to EFI_CALL_VOID and introduce a
new EFI_CALL macro that supports return values.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: fix typo in include/efi.h
Heinrich Schuchardt [Mon, 18 Sep 2017 05:54:50 +0000 (07:54 +0200)] 
efi_loader: fix typo in include/efi.h

Fix typo in teh EFI_BOOT_SERVICES_CODE description.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: avoid obscure constants in efi_runtime.c
Heinrich Schuchardt [Mon, 18 Sep 2017 20:11:34 +0000 (22:11 +0200)] 
efi_loader: avoid obscure constants in efi_runtime.c

We should use the predefined constants EFI_PAGE_SHIFT
and EFI_PAGE_MASK where applicable.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoEFI: find EFI system partition by legacy MBR partition type
Andre Przywara [Thu, 6 Jul 2017 09:14:03 +0000 (10:14 +0100)] 
EFI: find EFI system partition by legacy MBR partition type

The UEFI spec allows an EFI system partition (ESP, with the bootloader or
kernel EFI apps on it) to reside on a disk using a "legacy" MBR
partitioning scheme.
But in contrast to actual legacy disks the ESP is not marked as
"bootable" using bit 7 in byte 0 of the legacy partition entry, but is
instead using partition *type* 0xef (in contrast to 0x0b or 0x0c for a
normal FAT partition). The EFI spec isn't 100% clear on this, but it even
seems to discourage the use of the bootable flag for ESPs.
Also it seems that some EFI implementations (EDK2?) even seem to ignore
partitions marked as bootable (probably since they believe they contain
legacy boot code).
The Debian installer [1] (*not* mini.iso), for instance, contains such an
MBR, where none of the two partitions are marked bootable, but the ESP
has clearly type 0xef.
Now U-Boot cannot find the ESP on such a disk (USB flash drive) and
fails to load the EFI grub and thus the installer.

Since it all boils down to the distro bootcmds eventually calling
"part list -bootable" to find potential boot partitions, it seems logical
to just add this "partition type is 0xef" condition to the is_bootable()
implementation.

This allows the bog standard arm64 Debian-testing installer to boot from
an USB pen drive on Allwinner A64 boards (Pine64, BananaPi-M64).
(Ubuntu and other distribution installers don't have a legacy MBR, so
U-Boot falls back to El Torito there).

[1] https://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/arm64/iso-cd/
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: usage of always in Makefile
Heinrich Schuchardt [Tue, 5 Sep 2017 01:19:39 +0000 (03:19 +0200)] 
efi_loader: usage of always in Makefile

Variable always should only be appended but not overwritten by
lib/efi_loader/Makefile.

Remove variable efiprogs which is not otherwise used.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoscripts/Makefile.lib: generalize building built in EFI app
Heinrich Schuchardt [Tue, 5 Sep 2017 14:07:17 +0000 (16:07 +0200)] 
scripts/Makefile.lib: generalize building built in EFI app

Replace all occurences of helloworld by generalized forms.
This allows us to build additional EFI applications that are
included into the U-Boot binary without loading
scripts/Makefile.lib with specific filenames.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: rename __efi_hello_world_*
Heinrich Schuchardt [Tue, 5 Sep 2017 01:19:37 +0000 (03:19 +0200)] 
efi_loader: rename __efi_hello_world_*

In scripts/Makefile.lib we build section including helloworld.efi.
This allows to load the EFI binary with command 'bootefi hello'.

scripts/Makefile.lib contains explicit references to strings
containing helloworld and hello_world. This makes it impossible
to generalize the coding to accomodate additional built in
EFI binaries.

Let us rename the variables __efi_hello_world_* to
__efi_helloworld_*.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoscripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:
Heinrich Schuchardt [Sun, 3 Sep 2017 06:17:46 +0000 (08:17 +0200)] 
scripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:

The target
$(obj)/helloworld.so:
exists twice in Makefile.lib.

If you add an echo command to each of the two recipes you get
warnings like:

scripts/Makefile.lib:383: warning:
overriding recipe for target 'drivers/power/battery/helloworld.so'
scripts/Makefile.lib:379: warning:
ignoring old recipe for target 'drivers/power/battery/helloworld.so'

This patch removes the obsolete target.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: Fix efi_exit gd clobbering
Alexander Graf [Sun, 3 Sep 2017 12:14:17 +0000 (14:14 +0200)] 
efi_loader: Fix efi_exit gd clobbering

Commit f494950b (efi_loader: call __efi_exit_check in efi_exit) added a call
to __efi_exit_check inside efi_exit to account for the fact that we're exiting
the efi_exit function via a longjmp call.

However, __efi_exit_check also swizzles gd to the application gd while the
longjmp will put us back into EFI context, so we need the efi (u-boot) gd.

This patch fixes that up by explicitly setting gd back to efi_gd before
doing the longjmp. It also adds a few comments on why it does that.

Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: write protocol GUID in OpenProtocol
Heinrich Schuchardt [Fri, 18 Aug 2017 15:45:16 +0000 (17:45 +0200)] 
efi_loader: write protocol GUID in OpenProtocol

To understand what is happening in OpenProtocol or LocateProtocol
it is necessary to know the protocol interface GUID.
Let's write a debug message.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: call __efi_exit_check in efi_exit
Heinrich Schuchardt [Fri, 25 Aug 2017 17:53:14 +0000 (19:53 +0200)] 
efi_loader: call __efi_exit_check in efi_exit

The calls to __efi_entry_check and __efi_exit_check have to match.
If DEBUG is defined, panic() will be called otherwise.

If debugging is activated some Travis CI builds fail due to an
assertion in EFI_CALL without the patch.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_disk: efi_disk_rw_blocks is not an API function
Heinrich Schuchardt [Sat, 26 Aug 2017 20:33:13 +0000 (22:33 +0200)] 
efi_disk: efi_disk_rw_blocks is not an API function

There is no need to use attribute EFIAPI for
efi_disk_rw_blocks. It is not an API function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: bootefi hello should use loadaddr
Heinrich Schuchardt [Mon, 28 Aug 2017 16:54:30 +0000 (18:54 +0200)] 
efi_loader: bootefi hello should use loadaddr

Command 'bootefi hello' currently uses CONFIG_SYS_LOAD_ADDR
as loading address.

qemu machines have by default 128 MiB RAM.
CONFIG_SYS_LOAD_ADDR for x86 is 0x20000000 (512 MiB).
This causes 'bootefi hello' to fail.

We should use the environment variable loadaddr if available.
It defaults to 0x1000000 (16 MiB) on qemu_x86.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoMerge git://git.denx.de/u-boot-rockchip
Tom Rini [Mon, 18 Sep 2017 19:44:57 +0000 (15:44 -0400)] 
Merge git://git.denx.de/u-boot-rockchip

7 years agorockchip: puma_rk3399: increase serialno_str size
Klaus Goger [Fri, 15 Sep 2017 12:46:04 +0000 (14:46 +0200)] 
rockchip: puma_rk3399: increase serialno_str size

Increase serialno_str to 17 bytes so it can hold the 16 bytes long serial
nummer and the terminating null byte added by snprintf.

Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
7 years agorockchip: ram: rk3399: update reg map for of-platdata
Kever Yang [Thu, 7 Sep 2017 03:20:51 +0000 (11:20 +0800)] 
rockchip: ram: rk3399: update reg map for of-platdata

After Simon's patch, the dtoc can work with 64bit address,
so we need to fix reg number for it.
Depend on Simon's patch set:
https://patchwork.ozlabs.org/cover/807266/

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: sdhci: update reg map for of-platdata
Kever Yang [Thu, 7 Sep 2017 03:20:50 +0000 (11:20 +0800)] 
rockchip: sdhci: update reg map for of-platdata

After Simon's patch, the dtoc can work with 64bit address,
so we need to fix reg number for it.
Depend on Simon's patch set:
https://patchwork.ozlabs.org/cover/807266/

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: dts: rk3368: reduce the number of nodes seen in TPL
Philipp Tomsich [Mon, 14 Aug 2017 17:05:33 +0000 (19:05 +0200)] 
rockchip: dts: rk3368: reduce the number of nodes seen in TPL

The RK3368 TPL stage always returns to the BootROM, so it has no need
for the eMMC, SD and SPI nodes.  This marks those nodes (that should
be included in SPL, but not TPL) as 'u-boot,dm-spl'.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: rk3368: adjust DMC driver for 32/64bit-aware OF_PLATDATA
Philipp Tomsich [Mon, 14 Aug 2017 17:05:32 +0000 (19:05 +0200)] 
rockchip: rk3368: adjust DMC driver for 32/64bit-aware OF_PLATDATA

With the new 32/64bit-aware dtoc, the type of reg is fdt64_t and the
OF_PLATDATA structure layout changes.  This adjusts the DMC driver for
the RK3368 to track these changes.

For the time being (i.e. until regmap_init_mem_platdata works for the
64bit case), we won't use regmap_init_mem_platdata here and simply
access of_plat.reg[] directly.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: timer: update for 32/64bit-aware OF_PLATDATA
Philipp Tomsich [Mon, 14 Aug 2017 17:05:31 +0000 (19:05 +0200)] 
rockchip: timer: update for 32/64bit-aware OF_PLATDATA

With dtoc emitting fdt64_t for addresses (and region sizes), the array
indices for accessing the reg[] array needs to be adjusted.  This
adjusts the Rockchip DM timer driver to correctly handle OF_PLATDATA
given this new structure layout.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: defconfig: puma-rk3399: enable OF_LIVE (live tree)
Philipp Tomsich [Tue, 12 Sep 2017 15:32:29 +0000 (17:32 +0200)] 
rockchip: defconfig: puma-rk3399: enable OF_LIVE (live tree)

With the critical drivers ready for switching to a live tree, we can
now enable it in the defconfig for the RK3399-Q7.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: efuse: change to use dev_read_addr_ptr
Philipp Tomsich [Tue, 12 Sep 2017 15:32:26 +0000 (17:32 +0200)] 
rockchip: efuse: change to use dev_read_addr_ptr

With the dev_read_addr_ptr function available, we can change the
efuse driver to use it (and eliminate the explicit type-cast).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: clk: rk3399: Convert to livetree
Philipp Tomsich [Tue, 12 Sep 2017 15:32:24 +0000 (17:32 +0200)] 
rockchip: clk: rk3399: Convert to livetree

Update the clock driver for the RK3399  to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: dts: rk3399-puma: replace 'rockchip, vbus-gpio' with fixed regulator
Philipp Tomsich [Tue, 12 Sep 2017 15:30:57 +0000 (17:30 +0200)] 
rockchip: dts: rk3399-puma: replace 'rockchip, vbus-gpio' with fixed regulator

On the RK3399-Q7, we need to turn on the on-module USB hub before using the
USB host interfaces (only the OTG interface is directly connected to the edge
connector).  This drops the deprecated 'rockchip,vbus-gpio' property and uses
a fixed regulator to turn on the USB hub.

References: 26a8b80 "usb: host: xhci-rockchip: use fixed regulator to control vbus"
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: clk: rk3399: add clk_enable function and support USB HOST0/1
Philipp Tomsich [Tue, 12 Sep 2017 15:30:56 +0000 (17:30 +0200)] 
rockchip: clk: rk3399: add clk_enable function and support USB HOST0/1

The generic ehci-driver (ehci-generic.c) will try to enable the clocks
listed in the DTSI. If this fails (e.g. due to clk_enable not being
implemented in a driver and -ENOSYS being returned by the clk-uclass),
the driver will bail our and print an error message.

This implements a minimal clk_enable for the RK3399 and supports the
clocks mandatory for the EHCI controllers; as these are enabled by
default we simply return success.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: rk3368: add the missing target and pinctrl config for sheep board
Andy Yan [Mon, 4 Sep 2017 12:32:58 +0000 (20:32 +0800)] 
rockchip: rk3368: add the missing target and pinctrl config for sheep board

Add the missing target and pinctrl config for rk3368 sheep board

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk3368: add ENV_MEM_LAYOUT to extra env settings
Andy Yan [Mon, 4 Sep 2017 12:32:23 +0000 (20:32 +0800)] 
rockchip: rk3368: add ENV_MEM_LAYOUT to extra env settings

Add the ENV_MEM_LAYOUT_SETTINGS to CONFIG_EXTRA_ENV_SETTINGS

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agork3288: Add Vyasa initial board support
Jagan Teki [Tue, 12 Sep 2017 11:45:47 +0000 (17:15 +0530)] 
rk3288: Add Vyasa initial board support

This patch adds support for Vyasa RK3288 initial board
from Amarula Solutions.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk3399: spl: remove hard-coded addresses for GRF and SGRF
Philipp Tomsich [Tue, 29 Aug 2017 16:24:05 +0000 (18:24 +0200)] 
rockchip: rk3399: spl: remove hard-coded addresses for GRF and SGRF

On the RK3399, we will have either OF_PLATDATA or full OF_CONTROL
enabled: this allows the use of syscon to retrieve the addresses of
GRF and SGRF (except for the early debug UART setup, which runs so
early that the device-model is not initialised).

This removes the hard-coded addresses and goes through syscon to
retrieve the base-addresses of GRF and SGRF. After that, we use
the structure definitions to locate the respective registers.

In addition to this, the inclusion of header files is also cleaned up:
- all headers are included at the beginning (there was a spurious
  inclusion of the grf header from within a function)
- all #include statements for unused headers are removed
- the remaining #include statements are sorted (while keeping common.h
  included in front)

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: lion-rk3368: defconfig: resync w/ OF_LIVE and BOOTSTAGE enabled
Philipp Tomsich [Mon, 11 Sep 2017 20:04:27 +0000 (22:04 +0200)] 
rockchip: lion-rk3368: defconfig: resync w/ OF_LIVE and BOOTSTAGE enabled

This adds OF_LIVE and BOOTSTAGE support for the RK3368-uQ7 and
regenerates the defconfig (picking up a few changes/reorderings) from
upstream Kconfig changes.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: dts: rk3368-lion: add /chosen/tick-timer
Philipp Tomsich [Mon, 11 Sep 2017 20:04:26 +0000 (22:04 +0200)] 
rockchip: dts: rk3368-lion: add /chosen/tick-timer

To support bootstage recording, we want to mark our DM timer as the
tick-timer; this triggers the support for 'trying harder' to read the
timer in the Rockchip DM timer driver, even if the device model isn't
ready yet.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: gpio: remove outdated/misleading comment
Philipp Tomsich [Mon, 11 Sep 2017 20:04:25 +0000 (22:04 +0200)] 
rockchip: gpio: remove outdated/misleading comment

Remove a comment claiming that this driver only supports the RK3288,
as we also use it on the RK3368, RK3399 and (most likely) on other
variants.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Version-changes: 2
- use the dev_read_addr_ptr function in rk_gpio.c

7 years agorockchip: gpio: convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:24 +0000 (22:04 +0200)] 
rockchip: gpio: convert to livetree

Update the Rockchip GPIO-bank driver to support a live tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Version-changes: 2
- use the dev_read_addr_ptr function in rk_gpio.c

7 years agorockchip: i2c: Convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:23 +0000 (22:04 +0200)] 
rockchip: i2c: Convert to livetree

Update the Rockchip I2C driver to support livetree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Heiko Schocher <hs@denx.de>
7 years agorockchip: rk8xx: remove unused header includes
Philipp Tomsich [Mon, 11 Sep 2017 20:04:22 +0000 (22:04 +0200)] 
rockchip: rk8xx: remove unused header includes

Remove header file includes that have been left over after the
conversion to livetree-support.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: sdhci: Convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:21 +0000 (22:04 +0200)] 
rockchip: sdhci: Convert to livetree

Update the Rockchip SDHCI wrapper to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Version-changes: 2
- use the dev_read_addr_ptr function in rockchip_sdhci.c