oweals/u-boot.git
6 years agox86: efi: app: Display correct CPU info during boot
Bin Meng [Tue, 12 Jun 2018 15:36:25 +0000 (08:36 -0700)]
x86: efi: app: Display correct CPU info during boot

Currently when EFI application boots, it says:

  CPU: x86_64, vendor <invalid cpu vendor>, device 0h

Fix this by calling x86_cpu_init_f() in arch_cpu_init().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: Rename efi-x86 target to efi-x86_app
Bin Meng [Tue, 12 Jun 2018 15:36:24 +0000 (08:36 -0700)]
x86: Rename efi-x86 target to efi-x86_app

To avoid confusion, let's rename the efi-x86 target to efi-x86_app.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: efi: payload: Add EFI framebuffer driver support
Bin Meng [Tue, 12 Jun 2018 15:36:23 +0000 (08:36 -0700)]
x86: efi: payload: Add EFI framebuffer driver support

This turns on the EFI framebuffer driver support so that a graphics
console can be of additional help.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: video: Add an EFI framebuffer driver
Bin Meng [Tue, 12 Jun 2018 15:36:22 +0000 (08:36 -0700)]
dm: video: Add an EFI framebuffer driver

This adds a DM video driver for U-Boot as the EFI payload. The driver
makes use of all necessary information from the passed EFI GOP info
to create a linear framebuffer device, as if it were initialized by
U-Boot itself.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
6 years agoefi: stub: Pass EFI GOP information to U-Boot payload
Bin Meng [Tue, 12 Jun 2018 15:36:21 +0000 (08:36 -0700)]
efi: stub: Pass EFI GOP information to U-Boot payload

If UEFI BIOS has the graphics output protocol (GOP), let's pass its
information to U-Boot payload so that U-Boot can utilize it (eg:
an EFI framebuffer driver).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: baytrail: Drop EFI-specific test logics
Bin Meng [Tue, 12 Jun 2018 15:36:20 +0000 (08:36 -0700)]
x86: baytrail: Drop EFI-specific test logics

Now that we have generic EFI payload support, drop EFI-specific test
logics in BayTrail Kconfig and codes, and all BayTrail boards too.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: Drop QEMU-specific EFI payload support
Bin Meng [Tue, 12 Jun 2018 15:36:19 +0000 (08:36 -0700)]
x86: Drop QEMU-specific EFI payload support

Now that we have generic EFI payload support for all x86 boards,
drop the QEMU-specific one.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: Add generic EFI payload support
Bin Meng [Tue, 12 Jun 2018 15:36:18 +0000 (08:36 -0700)]
x86: Add generic EFI payload support

It is possible to create a generic EFI payload for all x86 boards.
The payload is configured to include as many generic drivers as
possible. All stuff that touches low-level initialization are not
allowed as such is the EFI BIOS's responsibility. Platform specific
drivers (like gpio, spi, etc) are not included.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: efi: payload: Add arch_cpu_init()
Bin Meng [Tue, 12 Jun 2018 15:36:17 +0000 (08:36 -0700)]
x86: efi: payload: Add arch_cpu_init()

This adds arch_cpu_init() to the payload codes, in preparation for
supporting a generic efi payload.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: efi: Refactor the directory of EFI app and payload support
Bin Meng [Tue, 12 Jun 2018 15:36:16 +0000 (08:36 -0700)]
x86: efi: Refactor the directory of EFI app and payload support

At present the EFI application and payload support codes in the x86
directory is distributed in a hybrid way. For example, the Kconfig
options for both app and payload are in arch/x86/lib/efi/Kconfig,
but the source codes in the same directory get built only for
CONFIG_EFI_STUB.

This refactors the codes by consolidating all the EFI support codes
into arch/x86/cpu/efi, just like other x86 targets.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: doc: Fix reference to EFI doc in U-Boot
Bin Meng [Tue, 12 Jun 2018 15:36:13 +0000 (08:36 -0700)]
x86: doc: Fix reference to EFI doc in U-Boot

Since commit f3b5056c4e72 ("efi_loader: split README.efi into two
separate documents"), the original README.efi was renamed to
README.u-boot_on_efi, but x86 doc still refers to the old one.

This updates the x86 doc to reference both README.u-boot_on_efi and
README.uefi.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
6 years agox86: use EFI calling convention for efi_main on x86_64
Ivan Gorinov [Thu, 14 Jun 2018 00:27:39 +0000 (17:27 -0700)]
x86: use EFI calling convention for efi_main on x86_64

UEFI specifies the calling convention used in Microsoft compilers;
first arguments of a function are passed in (%rcx, %rdx, %r8, %r9).

All other compilers use System V ABI by default, passing first integer
arguments of a function in (%rdi, %rsi, %rdx, %rcx, %r8, %r9).

These ABI also specify different sets of registers that must be preserved
across function calls (callee-saved).

GCC allows using the Microsoft calling convention by adding the ms_abi
attribute to a function declaration.

Current EFI implementation in U-Boot specifies EFIAPI for efi_main()
in the test apps but uses default calling convention in lib/efi.

Save efi_main() arguments in the startup code on x86_64;
use EFI calling convention for _relocate() on x86_64;
consistently use EFI calling convention for efi_main() everywhere.

Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
6 years agox86: cherryhill: Fix DTC warning
Bin Meng [Wed, 13 Jun 2018 03:01:14 +0000 (20:01 -0700)]
x86: cherryhill: Fix DTC warning

Fix warning when compiling cherryhill.dts with latest DTC:

  "Warning (avoid_unnecessary_addr_size): /pci/pch@1f,0: unnecessary
   #address-cells/#size-cells without "ranges" or child "reg" property"

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoMerge branch 'master' of git://git.denx.de/u-boot-usb
Tom Rini [Sat, 16 Jun 2018 04:07:37 +0000 (00:07 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-usb

6 years agoMerge tag 'arc-updates-for-2018.07-rc2' of git://git.denx.de/u-boot-arc
Tom Rini [Fri, 15 Jun 2018 13:38:16 +0000 (09:38 -0400)]
Merge tag 'arc-updates-for-2018.07-rc2' of git://git.denx.de/u-boot-arc

Here we just add a tool for HSDK flashable images preparation
together with extensive documentation for HSDK board.

This will help real-life users to update U-Boot on the board.

6 years agoMerge tag 'xilinx-for-v2018.07-rc2' of git://git.denx.de/u-boot-microblaze
Tom Rini [Fri, 15 Jun 2018 13:38:06 +0000 (09:38 -0400)]
Merge tag 'xilinx-for-v2018.07-rc2' of git://git.denx.de/u-boot-microblaze

Xilinx fixes for v2018.07-rc2

Zynq:
- Fix missing watchdog header
- DT fixes

ZynqMP:
- emmc configuration split
- Enable SPD
- Fix PMUFW_INIT_FILE logic
- Coverity fixes in SoC code

timer
- Add timer_get_boot_us

mmc:
- Fix MMC HS200 tuning command

serial:
- Fix scrabled chars with OF_LIVE

6 years agoARC: HSDK: Add readme
Alexey Brodkin [Thu, 14 Jun 2018 21:38:53 +0000 (00:38 +0300)]
ARC: HSDK: Add readme

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: HSDK: Add tool and make target to generate bsp
Eugeniy Paltsev [Mon, 4 Jun 2018 11:52:32 +0000 (14:52 +0300)]
ARC: HSDK: Add tool and make target to generate bsp

HSDK board has preloader that reads SPI flash pages and searches
for a special image header to fetch and load binary.

Add tool, make target (bsp-generate) to generate
update script and u-boot binary image with header for preloader.

Also add script to default environment to apply updates.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoserial: zynq: Make zynq_serial_setbrg static
Michal Simek [Thu, 14 Jun 2018 09:19:57 +0000 (11:19 +0200)]
serial: zynq: Make zynq_serial_setbrg static

This function is used only inside this driver that's why should be
static.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoserial: zynq: Initialize uart only before relocation
Michal Simek [Thu, 14 Jun 2018 08:41:35 +0000 (10:41 +0200)]
serial: zynq: Initialize uart only before relocation

This issue was found when OF_LIVE was enabled that there are scrambled
chars on the console like this:
Chip ID: zu3eg
Watchdog: Started��j�   sdhci@ff160000: 0, sdhci@ff170000: 1
In:    serial@ff010000

I found a solution for this problem exactly the same as I found later in
serial_msm fixed by:
"serial: serial_msm: initialize uart only before relocation"
(sha1: 7e5ad796bcd65772a87da236ae21cd536ae3a4d2)

What it is happening is that output TX fifo still contains chars to be
sent and _uart_zynq_serial_init() resets TX fifo even in the middle of
transfer.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoserial: zynq: Write chars till output fifo is full
Michal Simek [Thu, 14 Jun 2018 07:43:34 +0000 (09:43 +0200)]
serial: zynq: Write chars till output fifo is full

Change logic and put char to fifo till there is a space in output fifo.
Origin logic was that output fifo needs to be empty. It means only one
char was in output queue.
Also remove unused ZYNQ_UART_SR_TXEMPTY macro.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoserial: zynq: Use BIT macros instead of shifts and full hex numbers
Michal Simek [Thu, 14 Jun 2018 09:13:41 +0000 (11:13 +0200)]
serial: zynq: Use BIT macros instead of shifts and full hex numbers

Coding style is checking to use BIT macros instead of shifts.
The patch is also fixing the rest of macros which should be BITs instead
of hex numbers.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agogpio: zynq_gpio: bank description should use unsigned type
Michal Simek [Wed, 13 Jun 2018 11:22:08 +0000 (13:22 +0200)]
gpio: zynq_gpio: bank description should use unsigned type

Use u32 instead of int for max_bank, bank_min and bank_max. These values
can't be negative that's why no reason to use signed type.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm64: zynqmp: Check return value in zynqmp_mmio_rawwrite()
Michal Simek [Wed, 13 Jun 2018 08:38:33 +0000 (10:38 +0200)]
arm64: zynqmp: Check return value in zynqmp_mmio_rawwrite()

There should be return value check from zynqmp_mmio_read() in
zynqmp_mmio_rawwrite() to make sure that errors are propagated properly.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm64: zynqmp: Check return value from calloc
Michal Simek [Wed, 13 Jun 2018 07:42:41 +0000 (09:42 +0200)]
arm64: zynqmp: Check return value from calloc

calloc() can fail and return NULL. The patch is checking return value
and return in case of error.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agommc: zynq: Fix tuning_loop_counter type in arasan_sdhci_execute_tuning()
Michal Simek [Wed, 13 Jun 2018 07:12:29 +0000 (09:12 +0200)]
mmc: zynq: Fix tuning_loop_counter type in arasan_sdhci_execute_tuning()

Code around tuning_loop_counter variable expects to go below zero.
That's why this variable can't use unsigned type.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agogpio: zynq: Do not check unsigned type that is >= 0
Michal Simek [Wed, 13 Jun 2018 07:05:51 +0000 (09:05 +0200)]
gpio: zynq: Do not check unsigned type that is >= 0

There is no reason to check that unsigned type that is >= 0.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agommc: sdhci: Fix MMC HS200 tuning command failures
Siva Durga Prasad Paladugu [Wed, 13 Jun 2018 06:13:01 +0000 (11:43 +0530)]
mmc: sdhci: Fix MMC HS200 tuning command failures

This patch fixes the mmc tuning command failures
when tuning pattern data needs to read back for
comparision against the expected bit pattern.

Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Tested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoarm64: zynqmp: accept an absolute path for PMUFW_INIT_FILE
Luca Ceresoli [Mon, 4 Jun 2018 10:21:01 +0000 (12:21 +0200)]
arm64: zynqmp: accept an absolute path for PMUFW_INIT_FILE

The value of PMUFW_INIT_FILE is prefixed with "$(srctree)/", thus
forcing it to be a relative path inside the U-Boot source tree. Since
the PMUFW is a binary file generated outside of U-Boot, the PMUFW
binary must be copied inside the U-Boot source tree before the
build.

This generates a few problems:

 * if the source tree is shared among different out-of-tree builds,
   they will pollute (and potentially corrupt) each other
 * the source tree cannot be read-only
 * any buildsystem must add a command to copy the PMUFW binary
 * putting an externally-generated binary in the source tree is ugly
   as hell

Avoid these problems by accepting an absolute path for
PMUFW_INIT_FILE. This would be as simple as removing the "$(srctree)/"
prefix, but in order to keep backward compatibility we rather use the
shell and readlink to get the absolute path even when starting from a
relative path.

Since 'readlink -f' produces an empty string if the file does not
exist, we also add a check to ensure the file configured in
PMUFW_INIT_FILE exists. Otherwise the build would exit successfully,
but produce a boot.bin without PMUFW as if PMUFW_INIT_FILE were empty.

Tested in the 12 possible combinations of:
 - PMUFW_INIT_FILE empty, relative, absolute, non-existing
 - building in-tree, in subdir, in other directory

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Emmanuel Vadot <manu@bidouilliste.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm64: zynqmp: Enable SPD ddr support for zcu102 targets
Michal Simek [Mon, 4 Jun 2018 06:27:50 +0000 (08:27 +0200)]
arm64: zynqmp: Enable SPD ddr support for zcu102 targets

zcu102 contains DIMM with SPD on it at 0x51 address.
For example:
i2c dev 13
i2c sdram 51

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agotimer: cadence: Implement timer_get_boot_us
Michal Simek [Wed, 18 Apr 2018 12:03:56 +0000 (14:03 +0200)]
timer: cadence: Implement timer_get_boot_us

This function is required for adding bootstage support.
Also enable it directly for ZynqMP R5 configuration.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Drop #address-cells and #size-cells from gpio-keys
Michal Simek [Fri, 8 Jun 2018 07:36:12 +0000 (09:36 +0200)]
arm: zynq: Drop #address-cells and #size-cells from gpio-keys

dtc is showing some warnings and this change was also done in
the Linux kernel as "Input: gpio-keys - clean up device tree binding
example"
with this fragment in commit message
"Drop #address-cells and #size-cells, which are not required by the
gpio-keys binding documentation, as button sub-nodes are not devices."

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm64: zynqmp: Split emmc configuration into emmc0 and emmc1
Siva Durga Prasad Paladugu [Tue, 5 Jun 2018 09:48:32 +0000 (15:18 +0530)]
arm64: zynqmp: Split emmc configuration into emmc0 and emmc1

This patch splits the current mini emmc configuration into emmc0
and emmc1 configurations because emmc is probed at boot time and on
systems which have only one interface mini configuration is failing on
unused interface. This patch also adds required clock node in dts and
enables CONFIG_MMC_SDHCI_ZYNQ through defconfig.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Add missing watchdog header
Michal Simek [Fri, 8 Jun 2018 11:45:14 +0000 (13:45 +0200)]
arm: zynq: Add missing watchdog header

Add missing header detected by sparse.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoMerge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Tom Rini [Thu, 14 Jun 2018 17:28:03 +0000 (13:28 -0400)]
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2018-06-14

A few minor fixes for the release:

  - Compile fixes
  - HI20 relocations for RISC-V
  - Fix bootefi without load path
  - Fix Runtime Services with certain compilers

6 years agoMerge branch 'master' of git://git.denx.de/u-boot-net
Tom Rini [Thu, 14 Jun 2018 11:20:41 +0000 (07:20 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-net

6 years agousb: sunxi: access ahb_reset0_cfg in CCM using its offset
Vasily Khoruzhick [Thu, 14 Jun 2018 06:19:34 +0000 (23:19 -0700)]
usb: sunxi: access ahb_reset0_cfg in CCM using its offset

struct sunxi_ccm_reg doesn't have ahb_reset0_cfg on sun4i and sun5i,
thus compilation fails with:

drivers/usb/host/ohci-sunxi.c:96:26: error: 'struct sunxi_ccm_reg' has
no member named 'ahb_reset0_cfg'

Access this reg using its offset to fix this issue.

Fixes commit 1ed9c1118 ("usb: sunxi: ehci: get rid of ifdefs")
and commit 56830cee3 ("usb: sunxi: ohci: get rid of ifdefs")

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
6 years agoefi_loader: Allocate memory handle for mem dp
Alexander Graf [Tue, 12 Jun 2018 08:21:16 +0000 (10:21 +0200)]
efi_loader: Allocate memory handle for mem dp

When we boot using memdp (bootefi on an address without previous
load that populates the device path) then the memory device path
we pass in is not backed by any handle.

That can result in weird effects. For example grub gets very grumpy
about this inside the efi_net module and just loops endlessly.

So let's expose a simple handle that the memory device path is backed
on. That way any code that looks for the device the dp is on, finds
one.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: avoid make race condition
Heinrich Schuchardt [Sat, 2 Jun 2018 17:00:41 +0000 (19:00 +0200)]
efi_loader: avoid make race condition

When U-Boot is built with 'make -j' there is not guarantee that targets in
directory arch/ are built before targets in directory lib/. The current
build instruction for EFI binaries in lib/ rely on dependencies in arch/.
If $(EFI_CRT0) or $(EFI_RELOC) is not yet built before trying to build
%.efi an error
    *** No rule to make target '%.efi'
occurs.

With the patch separate copies of $(EFI_CRT0) and $(EFI_RELOC) named
efi_crt0.o and efi_reloc.o are built in lib/efi_loader and
lib/efi_selftest.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: avoid initializer element is not constant
Heinrich Schuchardt [Sat, 9 Jun 2018 15:50:18 +0000 (17:50 +0200)]
efi_loader: avoid initializer element is not constant

When building with -pedantic the current definition of EFI_GUID() causes
an error 'initializer element is not constant'.

Currently EFI_GUID() is used both as an anonymous constant and as an
intializer. A conversion to efi_guid_t is not allowable when using
EFI_GUID() as an initializer. But it is needed when using it as an
anonymous constant.

We should not use EFI_GUID() for anything but an initializer. So let's
introduce a variable where needed and remove the conversion.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: Add a comment about duplicated ELF constants
Simon Glass [Tue, 12 Jun 2018 05:26:40 +0000 (23:26 -0600)]
efi: Add a comment about duplicated ELF constants

These constants are defined in arch-specific code but redefined here. Add
a TODO to clean this up.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Convert runtime reset from switch to if statements
Alexander Graf [Sun, 10 Jun 2018 19:51:02 +0000 (21:51 +0200)]
efi_loader: Convert runtime reset from switch to if statements

We currently handle the UEFI runtime reset / power off case handling via
a switch statement. Compilers (gcc in my case) may opt to handle these via
jump tables which they may conveniently put into .rodata which is not part
of the runtime section, so it will be unreachable when executed.

Fix this by just converting the switch statement into an if/else statement.
It produces smaller code that is faster and also correct because we no
longer refer .rodata from efi runtime code.

Reported-by: Andreas Färber <aferber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoriscv: Add support for HI20 PE relocations
Alexander Graf [Tue, 5 Jun 2018 17:20:32 +0000 (19:20 +0200)]
riscv: Add support for HI20 PE relocations

The PE standard allows for HI20/LOW12 relocations. Within the efi_loader
target we always know that our relocation target is 4k aligned, so we
don't need to worry about the LOW12 part.

This patch adds support for the respective relocations. With this and a
few grub patches I have cooking in parallel I'm able to run grub on RISC-V.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agonet: gem: Check return value from memalign/malloc
Michal Simek [Wed, 13 Jun 2018 13:20:35 +0000 (15:20 +0200)]
net: gem: Check return value from memalign/malloc

Functions can return NULL in case of error that's why checking return
value is needed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: zynq_gem: Initialize phyreg variable
Michal Simek [Wed, 13 Jun 2018 08:33:49 +0000 (10:33 +0200)]
net: zynq_gem: Initialize phyreg variable

In case of phyread()/phy_setup_op() timeout code is working with
uninitialized phyreg variable. Initialize this variable to make sure
that code it not working with random value.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: zynq_gem: Fix return type for phy...()
Michal Simek [Wed, 13 Jun 2018 08:00:30 +0000 (10:00 +0200)]
net: zynq_gem: Fix return type for phy...()

wait_for_bit_le32 returns negative value on failure. Fix phy...() to
handle these failures properly.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: mvgbe: extract common code for SMI wait
Chris Packham [Sat, 9 Jun 2018 08:46:16 +0000 (20:46 +1200)]
net: mvgbe: extract common code for SMI wait

Combine repeated code from smi_reg_read/smi_reg_write into a common
function smi_wait_ready.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: designware: set the PS bit when resetting DMA bus in MII configuration
Quentin Schulz [Mon, 4 Jun 2018 10:17:33 +0000 (12:17 +0200)]
net: designware: set the PS bit when resetting DMA bus in MII configuration

On the SPEAr600 SoC, which has the dwmac1000 variant of the IP block,
the DMA reset never succeeds when a MII PHY is used (no problem with a
GMII PHY). The designware_eth_init() function sets the
DMAMAC_SRST bit in the DMA_BUS_MODE register, and then
polls until this bit clears. When a MII PHY is used, with the current
driver, this bit never clears and the driver therefore doesn't work.

The reason is that the PS bit of the GMAC_CONTROL register should be
correctly configured for the DMA reset to work. When the PS bit is 0,
it tells the MAC we have a GMII PHY, when the PS bit is 1, it tells
the MAC we have a MII PHY.

Doing a DMA reset clears all registers, so the PS bit is cleared as
well. This makes the DMA reset work fine with a GMII PHY. However,
with MII PHY, the PS bit should be set.

We have identified this issue thanks to two SPEAr600 platform:

- One equipped with a GMII PHY, with which the existing driver was
working fine.

- One equipped with a MII PHY, where the current driver fails because
the DMA reset times out.

Note: Taken from https://www.spinics.net/lists/netdev/msg432578.html

Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: phy: mv88e61xx: Force CPU port link up
Chris Packham [Sun, 3 Jun 2018 04:21:26 +0000 (16:21 +1200)]
net: phy: mv88e61xx: Force CPU port link up

When connecting to from a CPU direct to a 88e6097 typically RGMII is
used. In order for traffic to actually pass we need to force the link up
so the CPU MAC on the other end will see the link.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agomvebu: neta: align DMA buffers
Jon Nettleton [Wed, 30 May 2018 05:52:29 +0000 (08:52 +0300)]
mvebu: neta: align DMA buffers

This makes sure the DMA buffers are properly aligned for the
hardware.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Jon Nettleton <jon@solid-run.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: add Socionext AVE ethernet driver support
Kunihiko Hayashi [Thu, 24 May 2018 10:24:37 +0000 (19:24 +0900)]
net: add Socionext AVE ethernet driver support

Add driver for Socionext AVE ethernet controller that includes MAC and
MDIO bus supporting RGMII/RMII modes.
The driver behaves the ethernet driver model (DM_ETH) with devicetree.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: include/phy.h: add new mode for internal phy
Kunihiko Hayashi [Fri, 18 May 2018 02:12:04 +0000 (11:12 +0900)]
net: include/phy.h: add new mode for internal phy

Add the new mode to indicate a built-in PHY.
This will be used by UniPhier AVE ethernet driver.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agodrivers/net/vsc9953: Initialize action RAM in VCAP complex
Radu Bulie [Mon, 21 May 2018 15:02:09 +0000 (10:02 -0500)]
drivers/net/vsc9953: Initialize action RAM in VCAP complex

VCAP tables must be initialized even if no advanced classification
is used. If no initialization is performed, then ECC error will
be observed by the user when the first packet enters the l2switch.
The error is marked in MPIC_EISR0 -bit 29 which means - Internal RAM
multi-bit ECC error.
This patch fixes the aforementioned ECC error by performing the
initialization of VCAP tables.

Signed-off-by: Radu Bulie <radu-andrei.bulie@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: nfs: don't fail when nfs_read_reply returns -NFS_RPC_DROP
Vasily Khoruzhick [Mon, 14 May 2018 15:34:36 +0000 (08:34 -0700)]
net: nfs: don't fail when nfs_read_reply returns -NFS_RPC_DROP

That can happen if duplicate UDP packet arrived, and that's not uncommon.
Anyway, we ignore packets with rpc_id lower than last we sent for other
requests, so it makes sense to do that for read request as well.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: cpsw: ti: Reap completed packets before stopping interface
Alex Kiernan [Sat, 12 May 2018 07:30:02 +0000 (07:30 +0000)]
net: cpsw: ti: Reap completed packets before stopping interface

If you send a final packet just before stopping the interface (e.g. a final
ACK as part of the UDP fastboot protocol), then that packet isn't reliably
delivered onto the wire.

Reap packets prior to stopping the interface to ensure any which are
in-flight make it out. Also remove buffer and len from the call to
cpdma_process() as we weren't using them on their return.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: Protect net_state from reentrant net_loop()
Leonid Iziumtsev [Tue, 8 May 2018 13:55:50 +0000 (15:55 +0200)]
net: Protect net_state from reentrant net_loop()

Global variable "net_state" is used in net_loop() state-machine.
But it happens that some times the net_loop() can be called
multiple times in the same call stack. For example when the
netconsole is enabled and we print the message while some other
net protocol is in action. Netconsole will overwrite the "net_state"
and that will break the logic for earlier started protocol.

To protect the state save and restore "net_state" variable each
time when we enter and exit net_loop().

Signed-off-by: Leonid Iziumtsev <leonid.iziumtsev@se.atlascopco.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet/phy/cortina: Add support for CS4223 PHY
Vicentiu Galanopulo [Wed, 2 May 2018 11:23:38 +0000 (06:23 -0500)]
net/phy/cortina: Add support for CS4223 PHY

Add support for Cortina CS4223 10G PHY
  - As per the CS4223 specs, an EEPROM module is
    connected to the PHY. At startup the PHY reads
    the firmware line and tries to load the firmware
    into the internal memory.
  - This driver reads the EEPROM status
    and checks if firmware has been loaded

Signed-off-by: Vicentiu Galanopulo <vicentiu.galanopulo@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: sunxi: Correct MAC address register order
Joe Hershberger [Tue, 1 May 2018 21:33:55 +0000 (16:33 -0500)]
net: sunxi: Correct MAC address register order

Put the enetaddr data in the same order as it was before the change in
commit ace1520cb5fc ("net: sunxi-emac: Write HW address via function")

Reported-by: Udo Maslo <u.maslo@web.de>
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: Express LINK_LOCAL dependency on LIB_RAND
Joe Hershberger [Mon, 30 Apr 2018 17:45:22 +0000 (12:45 -0500)]
net: Express LINK_LOCAL dependency on LIB_RAND

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agotsec: Fix reading phy registers from DT
Mario Six [Fri, 27 Apr 2018 12:52:57 +0000 (14:52 +0200)]
tsec: Fix reading phy registers from DT

Bus translations should be applied when reading the address of the sgmii
phy registers from the DT. Use ofnode_get_addr_index instead of the
plain ofnode_read_u32_default to fix this.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: Initialize as many ethernet devices as possible
Mario Six [Fri, 27 Apr 2018 12:52:56 +0000 (14:52 +0200)]
net: Initialize as many ethernet devices as possible

On devices that have their first network interface provided by a FPGA,
the initialization of further interfaces will fail if the FPGA is not
yet programmed. This leads to problems during factory setup when the
data is supposed to be loaded over secondary netowork interfaces.

To avoid this, use the uclass_{first,next}_device_check functions to
initialize as many ethernet devices as possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: Always align tx packets
Mario Six [Wed, 28 Mar 2018 12:38:49 +0000 (14:38 +0200)]
net: Always align tx packets

Make sure that TX packets are always cache-aligned.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoMerge git://git.denx.de/u-boot-x86
Tom Rini [Wed, 13 Jun 2018 15:43:59 +0000 (11:43 -0400)]
Merge git://git.denx.de/u-boot-x86

6 years agoARM: DTS: resync a3517.dtsi with Linux 4.17
Adam Ford [Fri, 8 Jun 2018 14:26:30 +0000 (09:26 -0500)]
ARM: DTS: resync a3517.dtsi with Linux 4.17

Linux 4.17 was just released with some minor changes to the
am3517.dtsi.  This patch re-syncs the file.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoARM: am3517_evm: Enable SPL_OF_CONTROL and SPL_OF_PLATDATA
Adam Ford [Fri, 8 Jun 2018 14:22:30 +0000 (09:22 -0500)]
ARM: am3517_evm: Enable SPL_OF_CONTROL and SPL_OF_PLATDATA

The SPL doesn't have much room, so in order to support OF_CONTROL
in SPL, we need the extra functionality of SPL_OF_PLATDATA.

Adding these features allows us to remove a small part of code without
losing the serial port during SPL.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agodra76: fix HDMI HPD pinmux
Tomi Valkeinen [Fri, 8 Jun 2018 09:51:20 +0000 (12:51 +0300)]
dra76: fix HDMI HPD pinmux

The pin used for HDMI HPD should be set to GPIO mode on DRA76, similarly
to all the other DRA7 and AM5 SoCs.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agodra7/am5: remove CEC pin pull-up
Tomi Valkeinen [Fri, 8 Jun 2018 09:51:19 +0000 (12:51 +0300)]
dra7/am5: remove CEC pin pull-up

HDMI CEC pins are set to pull-up, but CEC requires no pull. Fix this.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 years agoenv: Add !ENV_IS_IN_EXT4 dependency to ENV_IS_NOWHERE
Alex Kiernan [Fri, 8 Jun 2018 07:10:27 +0000 (07:10 +0000)]
env: Add !ENV_IS_IN_EXT4 dependency to ENV_IS_NOWHERE

If ENV_IS_IN_EXT4 is set you shouldn't be able to select ENV_IS_NOWHERE.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Petr Vorel <petr.vorel@gmail.com>
6 years agou-boot: Fix several typos
Shyam Saini [Thu, 7 Jun 2018 14:17:19 +0000 (19:47 +0530)]
u-boot: Fix several typos

's/environemnt/environment/' and
's/Environemnt/Environment/'

Signed-off-by: Shyam Saini <shyam@amarulasolutions.com>
6 years agotools: env: Use getline rather than fgets when reading config/script
Alex Kiernan [Thu, 7 Jun 2018 12:20:05 +0000 (12:20 +0000)]
tools: env: Use getline rather than fgets when reading config/script

When reading the config file, or a script file, use getline rather than
fgets so line lengths aren't limited by the size of a compiled in buffer
(128 characters for config, 1024 for scripts).

Rename 'dump' to 'line' so it's clear we're working with a line of text.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agoAM3517_EVM: Fix Environmental location
Adam Ford [Wed, 6 Jun 2018 19:39:50 +0000 (14:39 -0500)]
AM3517_EVM: Fix Environmental location

The am3517-evm boards stores the environment in NAND, but after merging
various configs, the board was trying to load environment variables from
FAT which would ultimately fail and cause some chatter.

This patch removes the ENV_IS_IN_FAT flag to eliminate the noise.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agolib: Add hexdump
Alexey Brodkin [Tue, 5 Jun 2018 14:17:57 +0000 (17:17 +0300)]
lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35  ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e  200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30  sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00  0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00  bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39  fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72  ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65  =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32  rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c  000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75  0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30  t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00  00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>
6 years agofs: btrfs: Fix not all CHUNK_ITEMs being read from CHUNK_TREE
Yevgeny Popovych [Tue, 5 Jun 2018 10:11:01 +0000 (13:11 +0300)]
fs: btrfs: Fix not all CHUNK_ITEMs being read from CHUNK_TREE

This causes errors when translating logical addresses to physical:
  btrfs_map_logical_to_physical: Cannot map logical address <addr> to physical
  btrfs_file_read: Error reading extent

The behavior of btrfs_map_logical_to_physical() is to stop traversing
CHUNK_TREE when it encounters first non-CHUNK_ITEM, which makes
only some portion of CHUNK_ITEMs being read.
Change it to skip over non-chunk items.

Signed-off-by: Yevgeny Popovych <yevgenyp@pointgrab.com>
Cc: Marek Behun <marek.behun@nic.cz>
Cc: Sergey Struzh <sergeys@pointgrab.com>
Reviewed-by: Marek Behun <marek.behun@nic.cz>
6 years agoARM64: meson: Sync DT with Linux 4.17
Neil Armstrong [Tue, 5 Jun 2018 08:10:44 +0000 (10:10 +0200)]
ARM64: meson: Sync DT with Linux 4.17

Synchronize the Linux Device Tree for Amlogic Meson GX boards from Linux 4.17.0

This will enable USB on Amlogic Meson GXL Boards like Khadas VIM, P212 or
LibreTech-CC.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agofs: fat: fix wrong casting to unsigned value of sect_to_cluster()
Seung-Woo Kim [Mon, 4 Jun 2018 11:45:54 +0000 (20:45 +0900)]
fs: fat: fix wrong casting to unsigned value of sect_to_cluster()

After the commit 265edc03d5a1 ("fs/fat: Clean up open-coded sector
<-> cluster conversions"), it is hung up writing new file to FAT16
disk with more than 19 files in armv7. It is because result value
of sect_to_cluster() is not proper by casting from signed value to
unsigned value. Fix the wrong casting of sect_to_cluster().

Reported-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
6 years agousb: sunxi: sun50i: enable OHCI0 clock when OHCI1 is in use
Vasily Khoruzhick [Fri, 8 Jun 2018 02:23:41 +0000 (19:23 -0700)]
usb: sunxi: sun50i: enable OHCI0 clock when OHCI1 is in use

On A64 OHCI1 clock source is OHCI0 clock, so we need to enable OHCI0
clock when OHCI1 is in use.

Fixes commit dd3228170ad7 ("usb: sunxi: Switch to use generic-phy")

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
6 years agousb: sunxi: ohci: get rid of ifdefs
Vasily Khoruzhick [Fri, 8 Jun 2018 02:23:40 +0000 (19:23 -0700)]
usb: sunxi: ohci: get rid of ifdefs

We can use compatibles instead.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
6 years agousb: sunxi: ehci: get rid of ifdefs
Vasily Khoruzhick [Fri, 8 Jun 2018 02:23:39 +0000 (19:23 -0700)]
usb: sunxi: ehci: get rid of ifdefs

We can use compatibles instead.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
6 years agosunxi: clock: Fix EHCI and OHCI clocks on A64
Vasily Khoruzhick [Fri, 8 Jun 2018 02:23:38 +0000 (19:23 -0700)]
sunxi: clock: Fix EHCI and OHCI clocks on A64

EHCI0 is bit 24, EHCI1 - 25, OHCI0 - 28, OHCI1 - 29

Fixes commit fef73766d9ad ("sunxi: clock: Fix OHCI clock gating for H3/H5")

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
6 years agox86: cougarcanyon2: Add missing chipset interrupt information
Bin Meng [Tue, 12 Jun 2018 08:26:47 +0000 (01:26 -0700)]
x86: cougarcanyon2: Add missing chipset interrupt information

Add Panther Point chipset interrupt pin/PIRQ information, and
enable the generation of PIRQ routing table and MP table.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: irq: Support discrete PIRQ routing registers via device tree
Bin Meng [Tue, 12 Jun 2018 08:26:46 +0000 (01:26 -0700)]
x86: irq: Support discrete PIRQ routing registers via device tree

Currently both pirq_reg_to_linkno() and pirq_linkno_to_reg() assume
consecutive PIRQ routing control registers. But this is not always
the case on some platforms. Introduce a new device tree property
intel,pirq-regmap to describe how the PIRQ routing register offset
is mapped to the link number and adjust the irq router driver to
utilize the mapping.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: irq: Parse number of PIRQ links from device tree
Bin Meng [Tue, 12 Jun 2018 08:26:45 +0000 (01:26 -0700)]
x86: irq: Parse number of PIRQ links from device tree

The "intel,pirq-link" property in Intel IRQ router's dt bindings
has two cells, where the second one represents the number of PIRQ
links on the platform. However current driver does not parse this
information from device tree. This adds the codes to do the parse
and save it for future use.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: efi: payload: Minor clean up on error message output
Bin Meng [Sun, 10 Jun 2018 13:25:09 +0000 (06:25 -0700)]
x86: efi: payload: Minor clean up on error message output

If GetMemoryMap() fails, we really want to know EFI_BITS_PER_LONG
instead of BITS_PER_LONG. A space and LF are added in places where
error message is output to improve readability.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: pci: Use a 1:1 mapping for bus <-> phy addresses
Christian Gmeiner [Sun, 10 Jun 2018 13:25:06 +0000 (06:25 -0700)]
dm: pci: Use a 1:1 mapping for bus <-> phy addresses

If U-Boot gets used as coreboot payload all pci resources got
assigned by coreboot. If a dts without any pci ranges gets used
the dm is not able to access pci device memory. To get things
working make use of a 1:1 mapping for bus <-> phy addresses.

This change makes it possible to get the e1000 U-Boot driver
working on a sandybridge device where U-Boot is used as coreboot
payload.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: fixed 'u-boot' in the commit message]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: pci: Make ranges dt property optional
Christian Gmeiner [Sun, 10 Jun 2018 13:25:05 +0000 (06:25 -0700)]
dm: pci: Make ranges dt property optional

If we use U-Boot as coreboot payload with a generic dts without
any ranges specified we fail in pci pre_probe and our pci bus
is not usable.

So convert decode_regions(..) into a void function and do the simple
error handling there.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: fixed 'u-boot' in the commit message and checkpatch warning]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: efi: payload: Enforce toolchain to generate 64-bit EFI payload stub codes
Bin Meng [Sun, 10 Jun 2018 13:25:03 +0000 (06:25 -0700)]
x86: efi: payload: Enforce toolchain to generate 64-bit EFI payload stub codes

Attempting to use a toolchain that is preconfigured to generate code
for the 32-bit architecture (i386), for example, the i386-linux-gcc
toolchain on kernel.org, to compile the 64-bit EFI payload does not
build. This updates the makefile fragments to ensure '-m64' is passed
to toolchain when building the 64-bit EFI payload stub codes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: efi: app: Fix broken EFI application
Bin Meng [Sun, 10 Jun 2018 13:25:02 +0000 (06:25 -0700)]
x86: efi: app: Fix broken EFI application

The EFI application does not boot currently. It's due to the call
to syscon_get_by_driver_data() in cpu_init_r() maps to nowhere as
CONFIG_SYSCON is not included in the configuration.

EFI application is built as a shared library, so GCC won't complain
during the build process if some symbols are not found. GCC will
simply put these symbols into the .plt section and expect dynamic
loader to fix these up.

While we are here, remove some commands and drivers that are not
needed at present.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: Conditionally build the pinctrl_ich6 driver
Bin Meng [Sun, 10 Jun 2018 13:25:01 +0000 (06:25 -0700)]
x86: Conditionally build the pinctrl_ich6 driver

The pinctrl_ich6 driver is currently unconditionally built for all
x86 boards. Let's use a Kconfig option to control the build.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: irq: Change LINK_V2N and LINK_N2V to inline functions
Bin Meng [Mon, 4 Jun 2018 02:04:23 +0000 (19:04 -0700)]
x86: irq: Change LINK_V2N and LINK_N2V to inline functions

LINK_V2N and LINK_N2V are currently defines, so they cannot handle
complex logics. Change to inline functions for future extension.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: irq: Remove chipset specific irq router drivers
Bin Meng [Mon, 4 Jun 2018 02:04:22 +0000 (19:04 -0700)]
x86: irq: Remove chipset specific irq router drivers

At present there are 3 irq router drivers. One is the common one
and the other two are chipset specific for queensbay and quark.
However these are really the same drivers as the core logic is
the same. The two chipset specific drivers configure some registers
that are outside the irq router block which should really be part
of the chipset initialization.

Now we remove these specific drivers and make all x86 boards use
the common one.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: cougarcanyon2: Enable CPU driver and SMP support
Bin Meng [Mon, 4 Jun 2018 02:04:21 +0000 (19:04 -0700)]
x86: cougarcanyon2: Enable CPU driver and SMP support

This enables the 206ax cpu driver on Intel Cougar Canyon 2 board,
so that SMP can be supported too.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: chromebook_link: Remove dm-pre-reloc property in the cpu nodes
Bin Meng [Mon, 4 Jun 2018 02:04:20 +0000 (19:04 -0700)]
x86: chromebook_link: Remove dm-pre-reloc property in the cpu nodes

The 206ax cpu driver does not require pre-relocation flag to work.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: ivybridge: Drop CONFIG_USBDEBUG
Bin Meng [Mon, 4 Jun 2018 02:04:19 +0000 (19:04 -0700)]
x86: ivybridge: Drop CONFIG_USBDEBUG

This is not used anywhere. Clean this up.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: ivybridge: Enable 206ax cpu driver for FSP build
Bin Meng [Mon, 4 Jun 2018 02:04:18 +0000 (19:04 -0700)]
x86: ivybridge: Enable 206ax cpu driver for FSP build

At present this 206ax cpu driver is only built when FSP is not used.
This updates the Makefile to enable the build for both cases.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: cougarcanyon2: Remove CONFIG_HAVE_INTEL_ME
Bin Meng [Mon, 4 Jun 2018 02:04:17 +0000 (19:04 -0700)]
x86: cougarcanyon2: Remove CONFIG_HAVE_INTEL_ME

As README.x86 already mentions, there are two SPI flashes mounted
on Intel Cougar Canyon 2 board, called SPI-0 and SPI-1 respectively.
SPI-0 stores the flash descriptor and the ME firmware. SPI-1 stores
the actual BIOS image which is U-Boot. Building a single image with
both ME firmware and U-Boot does not make sense.

This also describes the exact flash location where the u-boot.rom
should be programmed in the documentation.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: cougarcanyon2: Update dts for SPI lock down
Bin Meng [Mon, 4 Jun 2018 02:04:16 +0000 (19:04 -0700)]
x86: cougarcanyon2: Update dts for SPI lock down

It turns out that like Braswell, Intel FSP for IvyBridge requires
SPI controller settings to be locked down, as the U-Boot ICH SPI
driver fails with the following message on Cougar Canyon 2 board:

  "ICH SPI: Opcode 9f not found"

Update the SPI node property to indicate this fact.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: ivybridge: Imply USB_XHCI_HCD
Bin Meng [Mon, 4 Jun 2018 02:04:15 +0000 (19:04 -0700)]
x86: ivybridge: Imply USB_XHCI_HCD

The Panther Point chipset connected to Ivybridge has xHC integrated,
imply it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agousb: xhci-pci: Fix compiler warning
Bin Meng [Mon, 4 Jun 2018 02:04:14 +0000 (19:04 -0700)]
usb: xhci-pci: Fix compiler warning

This fixes the following compiler warning:

  "warning: cast from pointer to integer of different size
  [-Wpointer-to-int-cast]"

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: baytrail: Correct the comment of IACORE_VIDS bit ranges
Bin Meng [Thu, 24 May 2018 10:05:59 +0000 (03:05 -0700)]
x86: baytrail: Correct the comment of IACORE_VIDS bit ranges

The guaranteed vid bit ranges in IACORE_VIDS MSR is actually
[22:16]. This corrects the comment for it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: acpi: Adopt new version of iASL compiler
Andy Shevchenko [Wed, 23 May 2018 09:38:02 +0000 (12:38 +0300)]
x86: acpi: Adopt new version of iASL compiler

The commit

  f9a88a4c1cd0 ("iASL: Enhance the -tc option (create AML hex file in C)")

in ACPICA project changed a template of the variable that is used
in the generated C-file. Now, instead of hard coded "AmlCode" the
"%s_aml_code" is in use, where the prefix is a lowered case base
name of the output file. In our case it will be "dsdt" producing
a name as "dsdt_aml_code".

The quick solution is to call sed which replaces new name by the
old one to keep compatibility with old version of iASL.

The long term solution would be to modify code to use the new name
because it is more scalable.

Cc: Robert Moore <robert.moore@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Evan Lloyd <evan.lloyd@arm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: fixed two sentences in the commit message]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>