oweals/u-boot.git
7 years agopatman: Handle non-ascii characters in names
Chris Packham [Tue, 7 Feb 2017 07:11:00 +0000 (20:11 +1300)]
patman: Handle non-ascii characters in names

When gathering addresses for the Cc list patman would encounter a
UnicodeDecodeError due to non-ascii characters in the author name.
Address this by explicitly using utf-8 when building the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agobuildman: Allow showing the list of boards with -n
Simon Glass [Mon, 23 Jan 2017 12:38:56 +0000 (05:38 -0700)]
buildman: Allow showing the list of boards with -n

As well as showing the number of boards, allow showing the actual list of
boards that would be built, if -v is provided.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agocros_ec: i2c: Add support for version 3 of the EC protocol
Moritz Fischer [Fri, 20 Jan 2017 20:35:03 +0000 (12:35 -0800)]
cros_ec: i2c: Add support for version 3 of the EC protocol

Add support for version 3 of the ec protocol. It basically works by
stitching some additional header in front (special command code),
and having a result and packet_length stitched on for the reply.

Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de
Acked-by: Simon Glass <sjg@chromium.org>
Tested on snow:
Tested-by: Simon Glass <sjg@chromium.org>
7 years agosimple-bus: enable support for of-platdata
Kever Yang [Wed, 18 Jan 2017 12:25:44 +0000 (20:25 +0800)]
simple-bus: enable support for of-platdata

Just do nothing in post_bind if of-platdata enabled,
for there is no dm_scan_fdt_dev().

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fixed subject line typo:
Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: core: Replace of_offset with accessor
Simon Glass [Tue, 17 Jan 2017 23:52:55 +0000 (16:52 -0700)]
dm: core: Replace of_offset with accessor

At present devices use a simple integer offset to record the device tree
node associated with the device. In preparation for supporting a live
device tree, which uses a node pointer instead, refactor existing code to
access this field through an inline function.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agopatman: Format checkpatch messages for IDE throwback
Simon Glass [Tue, 17 Jan 2017 23:52:23 +0000 (16:52 -0700)]
patman: Format checkpatch messages for IDE throwback

It is convenient to be able to deal with checkpatch warnings in the same
way as build warnings. Tools such as emacs and kate can quickly locate
the source file and line automatically.

To achieve this, adjust the format to match the C compiler, and output to
stderr.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodtoc: Replace dot with underscore to avoid compiler errors
Simon Glass [Mon, 16 Jan 2017 04:09:08 +0000 (21:09 -0700)]
dtoc: Replace dot with underscore to avoid compiler errors

If there is a '.' in a compatible string, then dtoc will produce a struct
with a name containing a '.'. This won't work, so replace it with '_'.

Also add a suitable test to the sandbox device tree to catch this.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agocros_ec: i2c: Group i2c write / read into single transaction
Moritz Fischer [Thu, 12 Jan 2017 17:47:30 +0000 (09:47 -0800)]
cros_ec: i2c: Group i2c write / read into single transaction

Replace dm_i2c_write() / dm_i2c_read() with transaction using
struct i2c_msg[2] in order to allow for i2c controller to detect
write/read cycle to emit a repeated start condition.

Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de
Acked-by: Simon Glass <sjg@chromium.org>
Tested on snow:
Tested-by: Simon Glass <sjg@chromium.org>
7 years agocommon: fdt_support: Remove check for mtdparts in fdt_fixup_mtdparts
Ladislav Michl [Mon, 9 Jan 2017 10:17:27 +0000 (11:17 +0100)]
common: fdt_support: Remove check for mtdparts in fdt_fixup_mtdparts

fdt_fixup_mtdparts currently does nothing when partition info is
runtime-generated or compiled-in defaults are used.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Fix nits in commit message:
Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agoarm: socfpga: set the mpuclk divider in the Altera group register
Dinh Nguyen [Tue, 31 Jan 2017 18:33:08 +0000 (12:33 -0600)]
arm: socfpga: set the mpuclk divider in the Altera group register

The mpuclk register in the Altera group of the clock manager
divides the mpu_clk that is generated from the C0 output of the main
pll.

Without this patch, the default value of the register is 1, so the mpuclk
will always get divided by 2 if the correct value is not set. For example,
on the Arria5 socdk board, the MPU clock is only 525 MHz, and it should be
1.05 GHz.

Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
7 years agodrivers: net: Provide Kconfig menu for PHYLIB
Alex [Tue, 7 Feb 2017 03:17:34 +0000 (19:17 -0800)]
drivers: net: Provide Kconfig menu for PHYLIB

Provide the necessary Kconfig symbols so that PHYLIB support may be
enabled in Kconfig, as opposed to needing to #define these symbols in
C source headers.

BITBANGMII and MV88E6352_SWITCH are left out of the PHYLIB submenu as
they don't seem to explicitly depend on it (i.e. they do not use the
phy_driver class).

Signed-off-by: Alexandru Gagniuc <alex.g@adaptrum.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: phy: Improve the Marvell 151x constants
Joe Hershberger [Fri, 9 Dec 2016 17:54:39 +0000 (11:54 -0600)]
net: phy: Improve the Marvell 151x constants

Use some constants for the phy configuration instead of so many magic
numbers.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: fec_mxc: Fix corruption of device tree blob
Daniel Strnad [Thu, 2 Feb 2017 11:11:40 +0000 (12:11 +0100)]
net: fec_mxc: Fix corruption of device tree blob

Modifying content of dev->name leads to the device tree corruption
because it points to the node name located there.

Signed-off-by: Daniel Strnad <strnadda@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: designware: Fix for use with current Linux device tree for Meson GX
Heiner Kallweit [Fri, 27 Jan 2017 20:25:59 +0000 (21:25 +0100)]
net: designware: Fix for use with current Linux device tree for Meson GX

In Uboot for Meson GX the compatible string in meson-gxbb.dtsi so far is:
compatible = "amlogic,meson6-dwmac", "snps,dwmac";

On Linux in the same dt file it's
compatible = "amlogic,meson-gx-dwmac", "amlogic,meson-gxbb-dwmac", "snps,dwmac";

To avoid breaking ethernet with the next DT synch from Linux to U-Boot
(planned as prerequisite for adding Meson GX MMC driver to U-Boot) add
"amlogic,meson-gx-dwmac" to the compatibility list in the designware
driver.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: phy: dp83867: Add support for MAC impedance configuration
Mugunthan V N [Tue, 24 Jan 2017 17:15:40 +0000 (11:15 -0600)]
net: phy: dp83867: Add support for MAC impedance configuration

Add support for programmable MAC impedance configuration and
fix typo in DT impedance parameters names.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Lokesh Vutla <lokeshvutla@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: phy: vitesse: Fix cis8204 RGMII_ID code
Phil Edworthy [Mon, 12 Dec 2016 15:27:12 +0000 (15:27 +0000)]
net: phy: vitesse: Fix cis8204 RGMII_ID code

Commit 79e86ccb3786c8b20004db3fa10a70049456f580 "vitesse: remove duplicated
argument to ||" correctly removed a redundant check.

However, I believe that the original code was simply wrong, and should have
been checking against RGMII_ID.

To fix this and avoid similar problems in the future, use the
phy_interface_is_rgmii helper function.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: phy: Marvell: Use phy_interface_is_rgmii helper function
Phil Edworthy [Mon, 12 Dec 2016 12:54:15 +0000 (12:54 +0000)]
net: phy: Marvell: Use phy_interface_is_rgmii helper function

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: phy: Add support for Marvell M88E1512
Phil Edworthy [Mon, 12 Dec 2016 12:54:14 +0000 (12:54 +0000)]
net: phy: Add support for Marvell M88E1512

This device also works with the 88E1518 code, so we just adjust
the UID mask accordingly.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: phy: Fix mask so that we can identify Marvell 88E1518
Phil Edworthy [Mon, 12 Dec 2016 12:54:13 +0000 (12:54 +0000)]
net: phy: Fix mask so that we can identify Marvell 88E1518

The mask for the 88E1510 meant that the 88E1518 code would never be
used.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: phy: ti: Fix dp83867 RGMII_TXID interface path
Phil Edworthy [Fri, 9 Dec 2016 10:46:02 +0000 (10:46 +0000)]
net: phy: ti: Fix dp83867 RGMII_TXID interface path

There is code that is specifically for RGMII_TXID interface, but this
will never get used because the code checks that the RGMII interface
is RGMII_ID to RGMII_RXID; RGMII_TXID is after this.

To fix this and avoid similar problems in the future, use the
phy_interface_is_rgmii helper function.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agotools: Add tool to add crc8 to a mac address
oliver@schinagl.nl [Fri, 25 Nov 2016 15:30:32 +0000 (16:30 +0100)]
tools: Add tool to add crc8 to a mac address

This patch adds a little tool that takes a generic MAC address and
generates a CRC byte for it. The output is the full MAC address without
any separators, ready written into an EEPROM.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agotools: Allow crc8 to be used
oliver@schinagl.nl [Fri, 25 Nov 2016 15:30:31 +0000 (16:30 +0100)]
tools: Allow crc8 to be used

This patch enables crc8 to be used from within the tools directory using
u-boot/crc.h.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
7 years agonet: core: cosmetic: A MAC address is not limited to SROM
oliver@schinagl.nl [Fri, 25 Nov 2016 15:30:23 +0000 (16:30 +0100)]
net: core: cosmetic: A MAC address is not limited to SROM

Currently, we print that the MAC from the SROM does not match. It can be
many forms of ROM, so lets drop the S.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: cosmetic: Define ethernet name length
oliver@schinagl.nl [Fri, 25 Nov 2016 15:30:21 +0000 (16:30 +0100)]
net: cosmetic: Define ethernet name length

There are various places where the ethernet device name is defined to
several different sizes. Lets add a define and start using it.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: cosmetic: Make the MAC address string less magical
oliver@schinagl.nl [Fri, 25 Nov 2016 15:30:20 +0000 (16:30 +0100)]
net: cosmetic: Make the MAC address string less magical

In u-boot printf has been extended with the %pM formatter to allow
printing of MAC addresses. However buffers that want to store a MAC
address cannot safely get the size. Add a define for this case so the
string of a MAC address can be reliably obtained.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: cosmetic: Do not use magic values for ARP_HLEN
oliver@schinagl.nl [Fri, 25 Nov 2016 15:30:19 +0000 (16:30 +0100)]
net: cosmetic: Do not use magic values for ARP_HLEN

Commit 674bb249825a ("net: cosmetic: Replace magic numbers in arp.c with
constants") introduced a nice define to replace the magic value 6 for
the ethernet hardware address. Replace more hardcoded instances of 6
which really reference the ARP_HLEN (iow the MAC/Hardware/Ethernet
address).

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: macb: Remove redundant #ifdef CONFIG_DM_ETH
Wenyou Yang [Wed, 2 Nov 2016 02:06:57 +0000 (10:06 +0800)]
net: macb: Remove redundant #ifdef CONFIG_DM_ETH

Remove the redundant #ifdef CONFIG_DM_ETH/#endif.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: macb: Add the clock support
Wenyou Yang [Wed, 2 Nov 2016 02:06:56 +0000 (10:06 +0800)]
net: macb: Add the clock support

Due to introducing the at91 clock driver, add the clock support.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agonet: Kconfig: Add CONFIG_MACB option
Wenyou Yang [Wed, 2 Nov 2016 02:06:55 +0000 (10:06 +0800)]
net: Kconfig: Add CONFIG_MACB option

Add CONFIG_MACB option in KConfig to be used to select the Cadence
MACB Ethernet driver.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
7 years agox86: make LOAD_FROM_32_BIT visible for platforms
Andy Shevchenko [Sun, 5 Feb 2017 13:52:00 +0000 (16:52 +0300)]
x86: make LOAD_FROM_32_BIT visible for platforms

This option is useful not only for development, but for the platforms
where U-Boot is run from custom ROM bootloader. For example, Intel
Edison is that board.

Make this option visible that platforms can select it if needed.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: qemu: Add a config for 64-bit U-Boot
Bin Meng [Wed, 18 Jan 2017 11:33:04 +0000 (03:33 -0800)]
x86: qemu: Add a config for 64-bit U-Boot

Add a new board config which uses 64-bit U-Boot. Supported features
are the same as the other 64-bit board (Google Chromebook Link).
It is a start for us to test 64-bit U-Boot easily without the need
to access a real hardware.

Note CONFIG_SPL_ENV_SUPPORT is required for QEMU 64-bit as without
this the SPL build fails at the end. This is just a workaround as
CONFIG_SPL_ENV_SUPPORT is not needed at all.

common/built-in.o:(.data.env_htab+0xc): undefined reference to 'env_flags_validate'
lib/built-in.o: In function `hsearch_r':
lib/hashtable.c:380: undefined reference to 'env_callback_init'
lib/hashtable.c:382: undefined reference to 'env_flags_init'
make[1]: *** [spl/u-boot-spl] Error 1

Except those SPL options required by 64-bit, compared to 32-bit
config, the following options are different:

- CONFIG_SYS_MALLOC_F_LEN has to be increased to 0x1000 for SPL.
- CONFIG_DEBUG_UART has to be included due to the weird issue.
  See TODO comments in arch/x86/cpu/x86_64/cpu.c:arch_setup_gd().
  Once this issue gets fixed, debug uart can be optional.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: qemu: Add build options for SPL
Bin Meng [Wed, 18 Jan 2017 11:33:03 +0000 (03:33 -0800)]
x86: qemu: Add build options for SPL

If SPL is used we want to use the generic SPL framework and boot
from SPI via a board-specific means. Add these options to the
board config file.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: qemu: Add a text base for 64-bit U-Boot
Bin Meng [Wed, 18 Jan 2017 11:33:02 +0000 (03:33 -0800)]
x86: qemu: Add a text base for 64-bit U-Boot

Set up the 64-bit U-Boot text base if building for that target.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agotools: binman: Handle optional microcode case in SPL image
Bin Meng [Wed, 18 Jan 2017 11:33:00 +0000 (03:33 -0800)]
tools: binman: Handle optional microcode case in SPL image

On platforms which do not require microcode in SPL, handle such
case like U-Boot proper.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agotools: binman: Call correct init for Entry_u_boot_spl_with_ucode_ptr
Bin Meng [Wed, 18 Jan 2017 11:32:59 +0000 (03:32 -0800)]
tools: binman: Call correct init for Entry_u_boot_spl_with_ucode_ptr

u_boot_spl_with_ucode_ptr is derived from u_boot_with_ucode_ptr,
hence it should call its parent's init.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: qemu: Mark ucode as optional for SPL in u-boot.dtsi
Bin Meng [Wed, 18 Jan 2017 11:32:58 +0000 (03:32 -0800)]
x86: qemu: Mark ucode as optional for SPL in u-boot.dtsi

QEMU does not need ucode and this is indicated in u-boot.dtsi
for U-Boot proper. Now add the same for SPL.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: qemu: Set up device tree for SPL
Bin Meng [Wed, 18 Jan 2017 11:32:57 +0000 (03:32 -0800)]
x86: qemu: Set up device tree for SPL

Add the correct pre-relocation tag so that the required device tree
nodes are present in the SPL device tree.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: qemu: Fix compiler warnings for 64-bit
Bin Meng [Wed, 18 Jan 2017 11:32:56 +0000 (03:32 -0800)]
x86: qemu: Fix compiler warnings for 64-bit

This fixes compiler warnings for QEMU in 64-bit.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: qemu: Hide arch_cpu_init() and print_cpuinfo() for U-Boot proper
Bin Meng [Wed, 18 Jan 2017 11:32:55 +0000 (03:32 -0800)]
x86: qemu: Hide arch_cpu_init() and print_cpuinfo() for U-Boot proper

arch_cpu_init() and print_cpuinfo() should be only available in SPL
build.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: Compile irq.c for 64-bit
Bin Meng [Wed, 18 Jan 2017 11:32:54 +0000 (03:32 -0800)]
x86: Compile irq.c for 64-bit

There is no reason not to compile irq.c for 64-bit.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: spl: Add weak arch_cpu_init_dm()
Bin Meng [Wed, 18 Jan 2017 11:32:53 +0000 (03:32 -0800)]
x86: spl: Add weak arch_cpu_init_dm()

arch_cpu_init_dm() might not be implemented by every platform.
Implement a weak version for SPL.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: Wrap print_ch() with config option
Bin Meng [Wed, 18 Jan 2017 11:32:52 +0000 (03:32 -0800)]
x86: Wrap print_ch() with config option

print_ch() should not be used if DEBUG_UART is off.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: qemu: Add missing DECLARE_GLOBAL_DATA_PTR in e820.c
Bin Meng [Wed, 18 Jan 2017 11:32:51 +0000 (03:32 -0800)]
x86: qemu: Add missing DECLARE_GLOBAL_DATA_PTR in e820.c

DECLARE_GLOBAL_DATA_PTR is missing which causes 64-bit build error.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: link: Add a config for 64-bit U-Boot
Simon Glass [Mon, 16 Jan 2017 14:04:27 +0000 (07:04 -0700)]
x86: link: Add a config for 64-bit U-Boot

Add a new board config which uses 64-bit U-Boot. This is not fully
functional but is it a start. Missing features:

- SDRAM sizing
- Booting linux
- EFI support
- SCSI device init
(and others)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Update compile/link flags to support 64-bit U-Boot
Simon Glass [Mon, 16 Jan 2017 14:04:26 +0000 (07:04 -0700)]
x86: Update compile/link flags to support 64-bit U-Boot

Update config.mk settings to support both 32-bit and 64-bit U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: link: Add build options for SPL
Simon Glass [Mon, 16 Jan 2017 14:04:25 +0000 (07:04 -0700)]
x86: link: Add build options for SPL

If SPL is used we want to use the generic SPL framework and boot from SPI
via a board-specific means. Add these options to the board config file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: link: Set up device tree for SPL
Simon Glass [Mon, 16 Jan 2017 14:04:24 +0000 (07:04 -0700)]
x86: link: Set up device tree for SPL

Add the correct pre-relocation tag so that the required device tree nodes
are present in the SPL device tree.

On x86 it doesn't make a lot of sense to have a separate SPL device tree.
Since everything is in the same ROM we might as well just use the main
device tree in both SPL and U-Boot proper. But we haven't implemented that,
so this is a good first step.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: link: Add SPL declarations to the binman image
Simon Glass [Mon, 16 Jan 2017 14:04:23 +0000 (07:04 -0700)]
x86: link: Add SPL declarations to the binman image

When building for 64-bit we need to put an SPL binary into the image. Update
the binman image description to reflect this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: link: Add a text base for 64-bit U-Boot
Simon Glass [Mon, 16 Jan 2017 14:04:22 +0000 (07:04 -0700)]
x86: link: Add a text base for 64-bit U-Boot

Set up the 64-bit U-Boot text base if building for that target.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Add a dummy setjmp implementation for x86_64
Simon Glass [Mon, 16 Jan 2017 14:04:21 +0000 (07:04 -0700)]
x86: Add a dummy setjmp implementation for x86_64

We don't have the code for this yet. Add a dummy version for now, so that
EFI builds correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Move setjmp to the i386 directory
Simon Glass [Mon, 16 Jan 2017 14:04:20 +0000 (07:04 -0700)]
x86: Move setjmp to the i386 directory

This code is only used in 32-bit mode. Move it so that it does not get
built with 64-bit U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Move call64 to the i386 directory
Simon Glass [Mon, 16 Jan 2017 14:04:19 +0000 (07:04 -0700)]
x86: Move call64 to the i386 directory

This code is only used in 32-bit mode. Move it so that it does not get
built with 64-bit U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Change irq_already_routed to a local variable
Simon Glass [Mon, 16 Jan 2017 14:04:18 +0000 (07:04 -0700)]
x86: Change irq_already_routed to a local variable

This avoids using BSS before SDRAM is set up in SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Move turbo_state to global_data
Simon Glass [Mon, 16 Jan 2017 14:04:17 +0000 (07:04 -0700)]
x86: Move turbo_state to global_data

To avoid using BSS in SPL before SDRAM is set up, move this field to
global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Move pirq_routing_table to global_data
Simon Glass [Mon, 16 Jan 2017 14:04:16 +0000 (07:04 -0700)]
x86: Move pirq_routing_table to global_data

To avoid using BSS in SPL before SDRAM is set up, move this field to
global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Support jumping from SPL to U-Boot
Simon Glass [Mon, 16 Jan 2017 14:04:15 +0000 (07:04 -0700)]
x86: Support jumping from SPL to U-Boot

Add a rough function to handle jumping from 32-bit SPL to 64-bit U-Boot.
This still needs work to clean it up.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Drop interrupt support in 64-bit mode
Simon Glass [Mon, 16 Jan 2017 14:04:14 +0000 (07:04 -0700)]
x86: Drop interrupt support in 64-bit mode

This is not currently supported, so drop the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Don't try to boot Linux from SPL
Simon Glass [Mon, 16 Jan 2017 14:04:13 +0000 (07:04 -0700)]
x86: Don't try to boot Linux from SPL

Booting into linux from 64-bit U-Boot is not yet supported. Avoid bringing
in the bootm code until it is implemented.

Of course 32-bit U-Boot still supports booting into both 32- and 64-bit
kernels.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Don't build 32-bit efi files on x86_64
Simon Glass [Mon, 16 Jan 2017 14:04:12 +0000 (07:04 -0700)]
x86: Don't build 32-bit efi files on x86_64

These cannot be built in this mode, so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Don't build cpu files which are not supported on 64-bit
Simon Glass [Mon, 16 Jan 2017 14:04:11 +0000 (07:04 -0700)]
x86: Don't build cpu files which are not supported on 64-bit

Some files cannot be built with 64-bit and mostly don't make sense in that
context. Disable them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Don't build call64 and setjmp on 64-bit
Simon Glass [Mon, 16 Jan 2017 14:04:10 +0000 (07:04 -0700)]
x86: Don't build call64 and setjmp on 64-bit

These are currently not supported. Calling 64-bit code from 64-bit U-Boot is
much simpler, so this code is not needed. setjmp() is not yet implemented for
64-bit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Don't try to run the VGA BIOS in 64-bit mode
Simon Glass [Mon, 16 Jan 2017 14:04:09 +0000 (07:04 -0700)]
x86: Don't try to run the VGA BIOS in 64-bit mode

This is not supported, so disable it for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: ivybridge: Provide a dummy SDRAM init for 64-bit
Simon Glass [Mon, 16 Jan 2017 14:04:08 +0000 (07:04 -0700)]
x86: ivybridge: Provide a dummy SDRAM init for 64-bit

We don't support SDRAM init in 64-bit mode since it is essentially
impossible to get into that mode before SDRAM set up. Provide dummy functions
for now. At some point we will need to pass the SDRAM parameters through from
SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: ivybridge: Skip SATA init in SPL
Simon Glass [Mon, 16 Jan 2017 14:04:07 +0000 (07:04 -0700)]
x86: ivybridge: Skip SATA init in SPL

This doesn't work at present. Disable it for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Fix up type sizes for 64-bit
Simon Glass [Mon, 16 Jan 2017 14:04:06 +0000 (07:04 -0700)]
x86: Fix up type sizes for 64-bit

Adjust types as needed to support 64-bit compilation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Drop flag_is_changable() on x86_64
Simon Glass [Mon, 16 Jan 2017 14:04:05 +0000 (07:04 -0700)]
x86: Drop flag_is_changable() on x86_64

This doesn't build at present and is not used in a 64-bit build. Disable it
for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Fix up byteorder.h for x86_64
Simon Glass [Mon, 16 Jan 2017 14:04:04 +0000 (07:04 -0700)]
x86: Fix up byteorder.h for x86_64

Remove the very old x86 code and add support for 64-bit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Add SPL build rules for start-up code
Simon Glass [Mon, 16 Jan 2017 14:04:03 +0000 (07:04 -0700)]
x86: Add SPL build rules for start-up code

When SPL is used we need to build the 16-bit start-up code. Add Makefile
rules to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Add a link script for SPL
Simon Glass [Mon, 16 Jan 2017 14:04:02 +0000 (07:04 -0700)]
x86: Add a link script for SPL

If SPL is used it is always build in 32-bit mode. Add a link script to
handle the correct placement of the sections.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Add a link script for 64-bit x86
Simon Glass [Mon, 16 Jan 2017 14:04:01 +0000 (07:04 -0700)]
x86: Add a link script for 64-bit x86

This needs a different image format from 32-bit x86, so add a new link
script.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Fix up CONFIG_X86_64 check
Simon Glass [Mon, 16 Jan 2017 14:04:00 +0000 (07:04 -0700)]
x86: Fix up CONFIG_X86_64 check

When SPL and U-Boot proper have different settings for this flag, we need to
use the correct one. Fix this up in the interrupt code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Support global_data on x86_64
Simon Glass [Mon, 16 Jan 2017 14:03:59 +0000 (07:03 -0700)]
x86: Support global_data on x86_64

At present this is just an ordinary variable. We may consider making it a
fixed register in the future.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Add cpu code for x86_64
Simon Glass [Mon, 16 Jan 2017 14:03:58 +0000 (07:03 -0700)]
x86: Add cpu code for x86_64

There is not much needed at present, but set up a separate directory to put
this code as it grows.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Move the i386 code into its own directory
Simon Glass [Mon, 16 Jan 2017 14:03:57 +0000 (07:03 -0700)]
x86: Move the i386 code into its own directory

Much of the cpu and interrupt code cannot be compiled on 64-bit x86. Move it
into its own directory and build it only in 32-bit mode.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Add an SPL implementation
Simon Glass [Mon, 16 Jan 2017 14:03:56 +0000 (07:03 -0700)]
x86: Add an SPL implementation

SPL needs to set up the machine ready for loading 64-bit U-Boot and jumping
to it. Call the existing init routines in order to accomplish this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Tidy up use of size_t in relocation
Simon Glass [Mon, 16 Jan 2017 14:03:55 +0000 (07:03 -0700)]
x86: Tidy up use of size_t in relocation

Addresses should not be cast to size_t. Use uintptr_t instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Add support for 64-bit relocation
Simon Glass [Mon, 16 Jan 2017 14:03:54 +0000 (07:03 -0700)]
x86: Add support for 64-bit relocation

Add a 64-bit relocation function. SPL loads U-Boot into RAM at a fixed
address and runs it. U-Boot then relocates itself to the top of RAM using
this relocation function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Refactor relocation to prepare for 64-bit
Simon Glass [Mon, 16 Jan 2017 14:03:53 +0000 (07:03 -0700)]
x86: Refactor relocation to prepare for 64-bit

Move the core relocation code into a separate function so that the checking
code can be used for 64-bit relocation also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Do relocation before clearing BSS
Simon Glass [Mon, 16 Jan 2017 14:03:52 +0000 (07:03 -0700)]
x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: board_r: Set the global data pointer after relocation
Simon Glass [Mon, 16 Jan 2017 14:03:51 +0000 (07:03 -0700)]
x86: board_r: Set the global data pointer after relocation

Since 'gd' is just a normal variable on 64-bit x86, it is relocated by the
time we get to board_init_r(). The old 'gd' variable is passed in as
parameter to board_init_r(), presumably for this situation.

Assign it on 64-bit x86 so that gd points to the correct data.

Options to improve this:
- Make gd a fixed register and remove the board_init_r() parameter
- Make all archs use this board_init_r() parameter

The second has a TODO in the code. The first has a TODO in a future commit
('x86: Support global_data on x86_64')

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agoboard_f/r: Use static const for the init sequences
Simon Glass [Mon, 16 Jan 2017 14:03:50 +0000 (07:03 -0700)]
board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: board_f: Update init sequence for 64-bit startup
Simon Glass [Mon, 16 Jan 2017 14:03:49 +0000 (07:03 -0700)]
x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Add 64-bit start-up code
Simon Glass [Mon, 16 Jan 2017 14:03:48 +0000 (07:03 -0700)]
x86: Add 64-bit start-up code

Add code to start up U-Boot in 64-bit mode. It is fairly simple since we are
running from RAM and SPL has done the low-level init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: ivybridge: Allow 32-bit init to move to SPL
Simon Glass [Mon, 16 Jan 2017 14:03:47 +0000 (07:03 -0700)]
x86: ivybridge: Allow 32-bit init to move to SPL

Update the Makefile so that some 32-bit init can be built into SPL rather
than U-Boot proper.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Use X86_32BIT_INIT instead of X86_RESET_VECTOR
Simon Glass [Mon, 16 Jan 2017 14:03:46 +0000 (07:03 -0700)]
x86: Use X86_32BIT_INIT instead of X86_RESET_VECTOR

Use this new option to control the location of 32-bit init. This will allow
us to place this in SPL if needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Use X86_16BIT_INIT instead of X86_RESET_VECTOR
Simon Glass [Mon, 16 Jan 2017 14:03:45 +0000 (07:03 -0700)]
x86: Use X86_16BIT_INIT instead of X86_RESET_VECTOR

Use this new option to control the location of 16-bit init. This will allow
us to place this in SPL if needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Kconfig: Add location options for 16/32-bit init
Simon Glass [Mon, 16 Jan 2017 14:03:44 +0000 (07:03 -0700)]
x86: Kconfig: Add location options for 16/32-bit init

At present all 16/32-bit init is controlled by CONFIG_X86_RESET_VECTOR. If
this is enabled, then U-Boot is the 'first' boot loader and handles execution
from the reset vector through to U-Boot's command prompt. If it is not
enabled then U-Boot starts at the 32-bit entry and skips most of its init,
assuming that the previous boot loader has done this already.

With the move to suport 64-bit operation, we have more cases to consider.
The 16-bit and 32-bit init may be in SPL rather than in U-Boot proper.

Add Kconfig options which control the location of the 16-bit and the 32-bit
init. These are not intended to be user-setting except for experimentation.
Their values should be determined by whether 64-bit U-Boot is used.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Add Kconfig options to build 64-bit U-Boot
Simon Glass [Mon, 16 Jan 2017 14:03:43 +0000 (07:03 -0700)]
x86: Add Kconfig options to build 64-bit U-Boot

Add a new CONFIG_X86_64 option which will eventually cause U-Boot to be
built as a 64-bit application, with SPL doing the 16/32-bit init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: lib: Fix types and casts for 64-bit compilation
Simon Glass [Mon, 16 Jan 2017 14:03:42 +0000 (07:03 -0700)]
x86: lib: Fix types and casts for 64-bit compilation

Fix various compiler warnings in the x86 library code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: fsp: Fix cast for 64-bit compilation
Simon Glass [Mon, 16 Jan 2017 14:03:41 +0000 (07:03 -0700)]
x86: fsp: Fix cast for 64-bit compilation

Fix a cast in get_next_hob() that causes warnings on 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: dts: Mark serial as needed before relocation
Simon Glass [Mon, 16 Jan 2017 14:03:40 +0000 (07:03 -0700)]
x86: dts: Mark serial as needed before relocation

We almost always need the serial port before relocation, so mark it as such.
This will ensure that it appears in the device tree for SPL, if used.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: ivybridge: Fix types for 64-bit compilation
Simon Glass [Mon, 16 Jan 2017 14:03:39 +0000 (07:03 -0700)]
x86: ivybridge: Fix types for 64-bit compilation

Fix a few types that causes warnings on 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: ivybridge: Add more debugging for failures
Simon Glass [Mon, 16 Jan 2017 14:03:38 +0000 (07:03 -0700)]
x86: ivybridge: Add more debugging for failures

Add various debug() messages in places where errors occur. This aids with
debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: ivybridge: Declare global data where it is used
Simon Glass [Mon, 16 Jan 2017 14:03:37 +0000 (07:03 -0700)]
x86: ivybridge: Declare global data where it is used

Some files are missing this declaration. Add it to avoid build errors when
we actually need the declaration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Update mpspec to build on 64-bit machines
Simon Glass [Mon, 16 Jan 2017 14:03:36 +0000 (07:03 -0700)]
x86: Update mpspec to build on 64-bit machines

At present this uses u32 to store an address. We should use unsigned long
and avoid special types in function return values and parameters unless
necessary. This makes the code more portable.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Use unsigned long for address in table generation
Simon Glass [Mon, 16 Jan 2017 14:03:35 +0000 (07:03 -0700)]
x86: Use unsigned long for address in table generation

We should use unsigned long rather than u32 for addresses. Update this so
that the table-generation code builds correctly on 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agospl: Don't create a BSS padding when it is separate
Simon Glass [Mon, 16 Jan 2017 14:03:34 +0000 (07:03 -0700)]
spl: Don't create a BSS padding when it is separate

When BSS does not immediate follow the SPL image we don't need padding
before the device tree. Remove it in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agospl: Allow PCH drivers to be used in SPL
Simon Glass [Mon, 16 Jan 2017 14:03:33 +0000 (07:03 -0700)]
spl: Allow PCH drivers to be used in SPL

Add an option for building Platorm Controller Hub drivers in SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agospl: Allow timer drivers to be used in SPL
Simon Glass [Mon, 16 Jan 2017 14:03:32 +0000 (07:03 -0700)]
spl: Allow timer drivers to be used in SPL

Add a new Kconfig option to allow timer drivers to be used in SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agospl: Allow RTC drivers to be used in SPL
Simon Glass [Mon, 16 Jan 2017 14:03:31 +0000 (07:03 -0700)]
spl: Allow RTC drivers to be used in SPL

Add a new Kconfig option to allow RTC drivers to be used in SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>