]> git.karo-electronics.de Git - karo-tx-uboot.git/log
karo-tx-uboot.git
9 years agotbs2910: Fix error handling in board_mmc_init()
Soeren Moch [Thu, 20 Nov 2014 12:03:32 +0000 (13:03 +0100)]
tbs2910: Fix error handling in board_mmc_init()

When an invalid USDHC port is passed we should return -EINVAL instead of 0.
Also, return the error immediately on fsl_esdhc_initialize() failure.

Based on similar patches by Fabio Estevam for mx6sabresd, mx53loco, wandboard

Signed-off-by: Soeren Moch <smoch@web.de>
Acked-by: Stefano Babic <sbabic@denx.de>
9 years agodm: i2c: Move error reporting into a common function
Simon Glass [Tue, 11 Nov 2014 17:46:17 +0000 (10:46 -0700)]
dm: i2c: Move error reporting into a common function

Factor out the common code to make it easier to adjust it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
Acked-by: Heiko Schocher <hs@denx.de>
9 years agodm: Update documentation to include CONFIG_DM... options
Simon Glass [Tue, 11 Nov 2014 00:16:54 +0000 (17:16 -0700)]
dm: Update documentation to include CONFIG_DM... options

Add documentation for the various driver model options that are now
available.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: arm: spl: Make driver model linker lists available
Simon Glass [Tue, 11 Nov 2014 00:16:52 +0000 (17:16 -0700)]
dm: arm: spl: Make driver model linker lists available

The linker lists feature is useful in SPL as it holds the driver model
platform data. So don't throw away the lists.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agodm: tegra: Add platform data for the GPIO driver
Simon Glass [Tue, 11 Nov 2014 00:16:51 +0000 (17:16 -0700)]
dm: tegra: Add platform data for the GPIO driver

Add platform data for the GPIO driver. It doesn't need to contain anything
since the GPIO driver will actually use information from the CONFIGs for
now. This merely serves to ensure that the GPIO driver is bound.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: tegra: Add platform data for the SPL uart
Simon Glass [Tue, 11 Nov 2014 00:16:50 +0000 (17:16 -0700)]
dm: tegra: Add platform data for the SPL uart

Since we currently don't have device tree available in SPL, add platform
data so the uart works.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: Disable dm_warn() in SPL
Simon Glass [Tue, 11 Nov 2014 00:16:49 +0000 (17:16 -0700)]
dm: Disable dm_warn() in SPL

Since this function can use up quite a bit of space for its strings, disable
it by default in SPL. Use CONFIG_DM_WARN to re-enable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agodm: Allow stdio registration to be dropped
Simon Glass [Tue, 11 Nov 2014 00:16:48 +0000 (17:16 -0700)]
dm: Allow stdio registration to be dropped

Provide a CONFIG_DM_STDIO option to enable registering a serial device
with the stdio library. This is seldom useful in SPL, so disable it by
default when building for SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agodm: Allow device removal features to be dropped
Simon Glass [Tue, 11 Nov 2014 00:16:47 +0000 (17:16 -0700)]
dm: Allow device removal features to be dropped

For SPL we don't expect to need to remove a device. Save some code space
by dropping this feature. The board config can define
CONFIG_DM_DEVICE_REMOVE if this is in fact needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agodm: spl: Allow driver model to be used
Simon Glass [Tue, 11 Nov 2014 00:16:46 +0000 (17:16 -0700)]
dm: spl: Allow driver model to be used

When enabled, set up driver model for SPL. This allows SPL to use the same
drivers as the main U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Tom Rini <trini@ti.com>
9 years agodm: spl: Make simple malloc() available when enabled
Simon Glass [Tue, 11 Nov 2014 00:16:45 +0000 (17:16 -0700)]
dm: spl: Make simple malloc() available when enabled

Set up the simple malloc() implementation when requested, in preference to
the full malloc().

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: arm: spl: Allow simple malloc() in SPL
Simon Glass [Tue, 11 Nov 2014 00:16:44 +0000 (17:16 -0700)]
dm: arm: spl: Allow simple malloc() in SPL

For SPL it is sometimes useful to have a simple malloc() just to permit
driver model to work, in the cases where the full malloc() is not made
available by the board config.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: Split the simple malloc() implementation into its own file
Simon Glass [Tue, 11 Nov 2014 00:16:43 +0000 (17:16 -0700)]
dm: Split the simple malloc() implementation into its own file

The simple malloc() implementation is used when memory is tight. It provides
a simple buffer with an incrementing pointer.

At present the implementation is inside dlmalloc. Move it into its own file
so that it is easier to find.

Rather than using relocation as a signal that the full malloc() is
available, add a special GD_FLG_FULL_MALLOC_INIT flag. This signals that the
simple malloc() should no longer be used.

In some cases, such as SPL, even the code space used by the full malloc() is
wasteful. Add a CONFIG_SYS_MALLOC_SIMPLE option to provide only the simple
malloc. In this case the full malloc is not available at all. It saves about
1KB of code space and about 0.5KB of data on Thumb 2.

Acked-by: Tom Rini <trini@ti.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: tegra: Avoid using arch-specific memcpy() in SPL
Simon Glass [Tue, 11 Nov 2014 00:16:42 +0000 (17:16 -0700)]
dm: tegra: Avoid using arch-specific memcpy() in SPL

The faster functions are not actually available in SPL and the code size
likely isn't worth it. Use the normal memcpy() in SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: serial: Support changing the baud rate
Simon Glass [Wed, 29 Oct 2014 19:09:03 +0000 (13:09 -0600)]
dm: serial: Support changing the baud rate

Implement this feature in the uclass so that the baudrate can be changed
with 'setenv baudrate <rate>'.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: at91: Add myself as maintainer for snapper9260
Simon Glass [Wed, 29 Oct 2014 19:09:02 +0000 (13:09 -0600)]
dm: at91: Add myself as maintainer for snapper9260

The old maintainer has left, so take this over.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: at91: Convert snapper9260 to use driver model
Simon Glass [Wed, 29 Oct 2014 19:09:01 +0000 (13:09 -0600)]
dm: at91: Convert snapper9260 to use driver model

Convert this at91sam9260-based board to use driver model. This should serve
as an example for other similar boards. Serial and GPIO are supported so
far.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Andreas Bießmann <andreas.devel@googlemail.com>
9 years agodm: at91: Add driver model support for the serial driver
Simon Glass [Wed, 29 Oct 2014 19:09:00 +0000 (13:09 -0600)]
dm: at91: Add driver model support for the serial driver

Add driver model support while retaining the existing legacy code. This
allows the driver to support boards that have converted to driver model
as well as those that have not.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: at91: Refactor serial driver slightly for driver model
Simon Glass [Wed, 29 Oct 2014 19:08:59 +0000 (13:08 -0600)]
dm: at91: Refactor serial driver slightly for driver model

Before adding driver model support, split out a few of the functions so
that they can be used by the driver model code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Andreas Bießmann <andreas.devel@googlemail.com>
9 years agodm: at91: Add platform data for GPIO on at91sam9260-based boards
Simon Glass [Wed, 29 Oct 2014 19:08:58 +0000 (13:08 -0600)]
dm: at91: Add platform data for GPIO on at91sam9260-based boards

These boards all have the same GPIO arrangement, so add some common platform
data that can be used by all boards. Remove the configs which are no longer
required.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: at91: Add driver model support for atmel GPIO driver
Simon Glass [Wed, 29 Oct 2014 19:08:57 +0000 (13:08 -0600)]
dm: at91: Add driver model support for atmel GPIO driver

Modify this driver to support driver model, with platform data required to
determine the GPIOs that it controls.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: at91: Move snapper9260 to generic baord
Simon Glass [Wed, 29 Oct 2014 19:08:56 +0000 (13:08 -0600)]
dm: at91: Move snapper9260 to generic baord

This works correctly, so switch it over before the deadline.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: at91: Correct text base for snapper9260
Simon Glass [Wed, 29 Oct 2014 19:08:55 +0000 (13:08 -0600)]
dm: at91: Correct text base for snapper9260

The value should be 0x21f00000. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: Rename chromebook-x86 to coreboot
Simon Glass [Thu, 13 Nov 2014 05:42:29 +0000 (22:42 -0700)]
x86: Rename chromebook-x86 to coreboot

Rename this vendor since it is intended to be used on any platform where
coreboot runs at reset and then loads U-Boot.

So far it is only tested on link. When other boards are supported it is
likely that we will need to move to multiple board names, all under the
'coreboot' vendor. So while it would be possible to remove the vendor for
now, that would be short-sighted.

Suggested-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: ivybridge: Implement SDRAM init
Simon Glass [Thu, 13 Nov 2014 05:42:28 +0000 (22:42 -0700)]
x86: ivybridge: Implement SDRAM init

Implement SDRAM init using the Memory Reference Code (mrc.bin) provided in
the board directory and the SDRAM SPD information in the device tree. This
also needs the Intel Management Engine (me.bin) to work. Binary blobs
everywhere: so far we have MRC, ME and microcode.

SDRAM init works by setting up various parameters and calling the MRC. This
in turn does some sort of magic to work out how much memory there is and
the timing parameters to use. It also sets up the DRAM controllers. When
the MRC returns, we use the information it provides to map out the
available memory in U-Boot.

U-Boot normally moves itself to the top of RAM. On x86 the RAM is not
generally contiguous, and anyway some RAM may be above 4GB which doesn't
work in 32-bit mode. So we relocate to the top of the largest block of
RAM we can find below 4GB. Memory above 4GB is accessible with special
functions (see physmem).

It would be possible to build U-Boot in 64-bit mode but this wouldn't
necessarily provide any more memory, since the largest block is often below
4GB. Anyway U-Boot doesn't need huge amounts of memory - even a very large
ramdisk seldom exceeds 100-200MB. U-Boot has support for booting 64-bit
kernels directly so this does not pose a limitation in that area. Also there
are probably parts of U-Boot that will not work correctly in 64-bit mode.
The MRC is one.

There is some work remaining in this area. Since memory init is very slow
(over 500ms) it is possible to save the parameters in SPI flash to speed it
up next time. Suspend/resume support is not fully implemented, or at least
it is not efficient.

With this patch, link boots to a prompt.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: ivybridge: Add LAPIC support
Simon Glass [Thu, 13 Nov 2014 05:42:27 +0000 (22:42 -0700)]
x86: ivybridge: Add LAPIC support

The local advanced programmable interrupt controller is not used much in
U-Boot but we do need to set it up. Add basic support for this, which will
be extended as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: Make show_boot_progress() common
Simon Glass [Thu, 13 Nov 2014 05:42:26 +0000 (22:42 -0700)]
x86: Make show_boot_progress() common

This function can probably be used on all x86 boards, so move it into the
common file.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: chromebook_link: Enable GPIO support
Simon Glass [Thu, 13 Nov 2014 05:42:25 +0000 (22:42 -0700)]
x86: chromebook_link: Enable GPIO support

Enable GPIO support and provide the required GPIO setup information to
the driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: ivybridge: Add support for early GPIO init
Simon Glass [Thu, 13 Nov 2014 05:42:24 +0000 (22:42 -0700)]
x86: ivybridge: Add support for early GPIO init

When not relying on Coreboot for GPIO init the GPIOs must be set up
correctly. This is currently done statically through a rather ugly method.
As the GPIOs are figured out they can be moved to the device tree and set
up as needed rather than all at the start.

In this implementation, board files should call ich_gpio_set_gpio_map()
before the GPIO driver is used in order to provide the GPIO information.
We use the early PCI interface so that this driver can now be used before
relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: ivybridge: Add early init for PCH devices
Simon Glass [Thu, 13 Nov 2014 05:42:23 +0000 (22:42 -0700)]
x86: ivybridge: Add early init for PCH devices

Many PCH devices are hard-coded to a particular PCI address. Set these
up early in case they are needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: dts: Add microcode updates for ivybridge CPU
Simon Glass [Thu, 13 Nov 2014 05:42:22 +0000 (22:42 -0700)]
x86: dts: Add microcode updates for ivybridge CPU

Add two microcode updates that are provided for this CPU. The updates
have been converted to a device tree form.

Note: SPDX submission has been done. If this license is approved I will
convert the files to use SPDX.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: ivybridge: Perform Intel microcode update on boot
Simon Glass [Thu, 13 Nov 2014 05:42:21 +0000 (22:42 -0700)]
x86: ivybridge: Perform Intel microcode update on boot

Microcode updates are stored in the device tree. Work through these and
apply any that are needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: ivybridge: Check BIST value on boot
Simon Glass [Thu, 13 Nov 2014 05:42:20 +0000 (22:42 -0700)]
x86: ivybridge: Check BIST value on boot

The built-in self test value should be checked before we continue booting.
Refuse to continue if there is something wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: ivybridge: Perform initial CPU setup
Simon Glass [Thu, 13 Nov 2014 05:42:19 +0000 (22:42 -0700)]
x86: ivybridge: Perform initial CPU setup

Set up the flex ratio (controls speed versus heat output) and a few other
very early things.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: Add msr read/write functions that use a structure
Simon Glass [Thu, 13 Nov 2014 05:42:18 +0000 (22:42 -0700)]
x86: Add msr read/write functions that use a structure

It is convenient to be able to adjust MSRs with a structure that splits the
two 32-bit halves into separate fields, as they are often dealt with
separately. Add a few functions to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: Add clr/setbits functions
Simon Glass [Thu, 13 Nov 2014 05:42:17 +0000 (22:42 -0700)]
x86: Add clr/setbits functions

These are available on other architectures. Make them available on x86 also.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: Tidy up coreboot header usage
Simon Glass [Thu, 13 Nov 2014 05:42:16 +0000 (22:42 -0700)]
x86: Tidy up coreboot header usage

There is no need to explicitly write 'arch-coreboot' when including headers,
as when the arch directory points to coreboot the correct files will be
used.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: ivybridge: Add early LPC init so that serial works
Simon Glass [Thu, 13 Nov 2014 05:42:15 +0000 (22:42 -0700)]
x86: ivybridge: Add early LPC init so that serial works

The PCH (Platform Controller Hub) includes an LPC (Low Pin Count) device
which provides a serial port. This is accessible on Chromebooks, so enable
it early in the boot process.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: pci: Allow configuration before relocation
Simon Glass [Thu, 13 Nov 2014 05:42:14 +0000 (22:42 -0700)]
x86: pci: Allow configuration before relocation

Add simple PCI access routines for x86 which permit use before relocation.
The normal PCI stack is still used, but for pre-relocation use there can
only ever be a single hose. After relocation, fall back to the normal
access, although even then on x86 machines there is normally only a single
PCI bus.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: ivybridge: Enable PCI in early init
Simon Glass [Thu, 13 Nov 2014 05:42:13 +0000 (22:42 -0700)]
x86: ivybridge: Enable PCI in early init

Enable PCI so we can access devices that need to be set up before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: Support use of PCI before relocation
Simon Glass [Thu, 13 Nov 2014 05:42:12 +0000 (22:42 -0700)]
x86: Support use of PCI before relocation

Add support for using PCI before SDRAM is available, using early malloc()
and global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: Refactor PCI to permit alternate init
Simon Glass [Thu, 13 Nov 2014 05:42:11 +0000 (22:42 -0700)]
x86: Refactor PCI to permit alternate init

We want access PCI earlier in the init sequence, so refactor the code so
that it does not require use of a BSS variable to work. This will allow us
to use early malloc() to store information about a PCI hose.

Common PCI code moves to arch/x86/cpu/pci.c and a new
board_pci_setup_hose() function is provided by boards to set up the (single)
hose used by that board.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: chromebook_link: Implement CAR support (cache as RAM)
Simon Glass [Thu, 13 Nov 2014 05:42:10 +0000 (22:42 -0700)]
x86: chromebook_link: Implement CAR support (cache as RAM)

Add support for CAR so that we have memory to use prior to DRAM init.
On link there is a total of 128KB of CAR available, although some is
used for the memory reference code.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: Emit post codes in startup code for Chromebooks
Simon Glass [Thu, 13 Nov 2014 05:42:09 +0000 (22:42 -0700)]
x86: Emit post codes in startup code for Chromebooks

On x86 it is common to use 'post codes' which are 8-bit hex values emitted
from the code and visible to the user. Traditionally two 7-segment displays
were made available on the motherboard to show the last post code that was
emitted. This allows diagnosis of a boot problem since it is possible to
see where the code got to before it died.

On modern hardware these codes are not normally visible. On Chromebooks
they are displayed by the Embedded Controller (EC), so it is useful to emit
them. We must enable this feature for the EC to see the codes, so add an
option for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: Build a .rom file which can be flashed to an x86 machine
Simon Glass [Thu, 13 Nov 2014 05:42:08 +0000 (22:42 -0700)]
x86: Build a .rom file which can be flashed to an x86 machine

On x86 machines U-Boot needs to be added to a large ROM image which is
then flashed onto the target board. The ROM has a particular format so it
makes sense for U-Boot to build this image automatically. Unfortunately
it relies on binary blobs so we cannot require this for the default
build as yet.

Create a u-boot.rom output file for this purpose.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: Add chromebook_link board
Simon Glass [Thu, 13 Nov 2014 05:42:07 +0000 (22:42 -0700)]
x86: Add chromebook_link board

This board is a 'bare' version of the existing 'link 'board. It does not
require coreboot to run, but is intended to start directly from the reset
vector.

This initial commit has place holders for a wide range of features. These
will be added in follow-on patches and series. So far it cannot be booted
as there is no ROM image produced, but it does build without errors.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: ifdtool: Allow creation of an empty ROM
Simon Glass [Thu, 13 Nov 2014 05:42:06 +0000 (22:42 -0700)]
x86: ifdtool: Allow creation of an empty ROM

Allow an empty ROM to be created, without needing to provide a descriptor.
The descriptor is not needed on some x86 boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: Allow timer calibration to work on ivybridge
Simon Glass [Thu, 13 Nov 2014 05:42:04 +0000 (22:42 -0700)]
x86: Allow timer calibration to work on ivybridge

Unfortunately MSR_FSB_FREQ is not available on this CPU, and the PIT method
seems to take up to 50ms which is much too long.

For this CPU we know the frequency, so add another special case for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: use CONFIG_SYS_COREBOOT to descend into coreboot/ directory
Masahiro Yamada [Thu, 13 Nov 2014 03:28:41 +0000 (12:28 +0900)]
x86: use CONFIG_SYS_COREBOOT to descend into coreboot/ directory

The references of CONFIG_SYS_COREBOOT in arch/x86/cpu/coreboot/Makefile
are redundant because the build system descends into the directory
only when CONFIG_SYS_COREBOOT is defined.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agox86: Replace fill_processor_name() with cpu_get_name()
Simon Glass [Tue, 11 Nov 2014 01:00:26 +0000 (18:00 -0700)]
x86: Replace fill_processor_name() with cpu_get_name()

This implementation has a 'cpu' prefix and returns a pointer to the string,
avoiding the need for copying.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: Remove unnecessary find_fdt(), prepare_fdt() functions
Simon Glass [Tue, 11 Nov 2014 01:00:25 +0000 (18:00 -0700)]
x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: Add processor functions to halt and get stack pointer
Simon Glass [Tue, 11 Nov 2014 01:00:24 +0000 (18:00 -0700)]
x86: Add processor functions to halt and get stack pointer

Add a function to get the stack pointer and another to halt the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: config: Move common x86 configs to a common file
Simon Glass [Tue, 11 Nov 2014 01:00:23 +0000 (18:00 -0700)]
x86: config: Move common x86 configs to a common file

Many of the x86 CONFIG options will be common across different boards. Move
them to a common file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: Add ifdtool for working with Intel Flash Descriptor ROM images
Simon Glass [Tue, 11 Nov 2014 01:00:22 +0000 (18:00 -0700)]
x86: Add ifdtool for working with Intel Flash Descriptor ROM images

Newer Intel chips require a Management Engine which requires a particular
format for the SPI flash that contains the boot loader. Add a tool that
supports creating and modifying these ROM images.

This tool is from Chrome OS but has been cleaned up to use U-Boot style
and to add comments. A few features have been added also.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: gpio: Add a function to read an ID from a list of GPIOs
Simon Glass [Tue, 11 Nov 2014 01:00:21 +0000 (18:00 -0700)]
dm: gpio: Add a function to read an ID from a list of GPIOs

For board IDs a common approach is to set aside several GPIOs for use in
determining the board ID. This can provide information about board features
and the revision.

Add a function that turns a list of GPIOs into an integer by assigning
each GPIO to a single bit.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: serial: Move current serial port pointer to global_data
Simon Glass [Tue, 11 Nov 2014 01:00:20 +0000 (18:00 -0700)]
dm: serial: Move current serial port pointer to global_data

In general we can't store things in the data section until we have inited
SDRAM. Some platforms allow this (e.g. those with SPL) but some don't. Move
the pointer to global_data so that it will work on all platforms.

Without this fix the serial port will not work prior to relocation with
driver model on some platforms.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agofdt: Add a function to decode a variable-sized u32 array
Simon Glass [Tue, 11 Nov 2014 01:00:19 +0000 (18:00 -0700)]
fdt: Add a function to decode a variable-sized u32 array

Sometimes an array can be of variable size up to a maximum. Add a helper
function to decode this.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agoMove early malloc() to before arch_cpu_init()
Simon Glass [Tue, 11 Nov 2014 01:00:18 +0000 (18:00 -0700)]
Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: Fix a warning with gcc 4.4.4
Simon Glass [Thu, 13 Nov 2014 03:27:55 +0000 (20:27 -0700)]
x86: Fix a warning with gcc 4.4.4

This warning appears even though it seems that the compiler could work it
out. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agox86: Save TSC frequency in the global data
Bin Meng [Sun, 9 Nov 2014 14:19:35 +0000 (22:19 +0800)]
x86: Save TSC frequency in the global data

Return the saved TSC frequency in get_tbclk_mhz().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
9 years agox86: Add quick TSC calibration via PIT
Bin Meng [Sun, 9 Nov 2014 14:19:25 +0000 (22:19 +0800)]
x86: Add quick TSC calibration via PIT

Use the same way that Linux does for quick TSC calibration via PIT
when calibration via MSR fails.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agox86: Do TSC MSR calibration only for known/supported CPUs
Bin Meng [Sun, 9 Nov 2014 14:19:13 +0000 (22:19 +0800)]
x86: Do TSC MSR calibration only for known/supported CPUs

Using MSR_PLATFORM_INFO (0xCE) to calibrate TSR will cause #GP on
processors which do not have this MSR. Instead only doing the MSR
calibration for known/supported CPUs.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
9 years agox86: Do CPU identification in the early phase
Bin Meng [Sun, 9 Nov 2014 14:18:56 +0000 (22:18 +0800)]
x86: Do CPU identification in the early phase

The CPU identification happens in x86_cpu_init_f() and corresponding
fields are saved in the global data for later use.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: Save the BIST value on reset
Simon Glass [Thu, 6 Nov 2014 20:20:10 +0000 (13:20 -0700)]
x86: Save the BIST value on reset

The built in self test value is available in register eax on start-up. Save
it so that it can be accessed later. Unfortunately we must wait until the
global_data is available before we can do this, so there is a little bit of
shuffling to keep it around.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: Fix up some missing prototypes
Simon Glass [Thu, 6 Nov 2014 20:20:08 +0000 (13:20 -0700)]
x86: Fix up some missing prototypes

Some functions are missing prototypes. Fix those that are specific to x86.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: Use the standard arch_cpu_init() function
Simon Glass [Thu, 6 Nov 2014 20:20:06 +0000 (13:20 -0700)]
x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: Use the standard dram_init() function
Simon Glass [Thu, 6 Nov 2014 20:20:05 +0000 (13:20 -0700)]
x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: Tidy up global descriptor table setup
Simon Glass [Thu, 6 Nov 2014 20:20:04 +0000 (13:20 -0700)]
x86: Tidy up global descriptor table setup

This code is a little muddled, so tidy it up. Make sure that we put the
GDT in the right place and set it up properly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: Invalidate TLB as early as possible
Simon Glass [Thu, 6 Nov 2014 20:20:03 +0000 (13:20 -0700)]
x86: Invalidate TLB as early as possible

We should invalidate the TLB right at the start to ensure that we don't get
false address translations even though paging is disabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: Remove board_init16() call which is not used
Simon Glass [Thu, 6 Nov 2014 20:20:01 +0000 (13:20 -0700)]
x86: Remove board_init16() call which is not used

This allows a board to do very early init, but no boards need to do this.
We may as well drop this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agox86: Remove REALMODE_BASE which is no longer used
Simon Glass [Thu, 6 Nov 2014 20:20:00 +0000 (13:20 -0700)]
x86: Remove REALMODE_BASE which is no longer used

This was missed when the real mode support was dropped. Remove it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9 years agofdt: Try to use fdt_address_cells()/fdt_size_cells()
Simon Glass [Fri, 24 Oct 2014 00:58:57 +0000 (18:58 -0600)]
fdt: Try to use fdt_address_cells()/fdt_size_cells()

Use these new functions where possible. They default to a value of 2 so we
cannot use them in some places where we need a default value of 1.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agofdt: Add a function to decode a named memory region
Simon Glass [Fri, 24 Oct 2014 00:58:56 +0000 (18:58 -0600)]
fdt: Add a function to decode a named memory region

Permit decoding of a named memory region from the device tree. This allows
easy run-time configuration of the address of on-chip SRAM, SDRAM, etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agofdt: Change fdt_pack_reg() to static and fix types
Simon Glass [Fri, 24 Oct 2014 00:58:55 +0000 (18:58 -0600)]
fdt: Change fdt_pack_reg() to static and fix types

This function is only called within this file so make it static. Also
fix its argument types to be consistent with its caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agofdt: Add ft_system_setup() function for system device tree additions
Simon Glass [Fri, 24 Oct 2014 00:58:54 +0000 (18:58 -0600)]
fdt: Add ft_system_setup() function for system device tree additions

Add an additional function for adding information to the device tree before
booting. This permits additions which are not board-specific.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agofdt: Tidy up error handling in image_setup_libfdt()
Simon Glass [Fri, 24 Oct 2014 00:58:53 +0000 (18:58 -0600)]
fdt: Tidy up error handling in image_setup_libfdt()

The message about needing to reset should be printed no matter what error
is printed. Also, an error should always be printed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agofdt: Enhance flashmap function to deal with region properties
Simon Glass [Fri, 24 Oct 2014 00:58:52 +0000 (18:58 -0600)]
fdt: Enhance flashmap function to deal with region properties

Flash regions can optionally be compressed or hashed. Add the ability to
read this information from the flashmap.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agofdt: Use the correct return types for fdtdec_decode_region()
Simon Glass [Fri, 24 Oct 2014 00:58:51 +0000 (18:58 -0600)]
fdt: Use the correct return types for fdtdec_decode_region()

Use the correct FDT data types for this function. Also add more debugging.

Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agofdt: Export the fdt_find_or_add_subnode() function
Simon Glass [Fri, 24 Oct 2014 00:58:49 +0000 (18:58 -0600)]
fdt: Export the fdt_find_or_add_subnode() function

This function is useful for ensuring that a node exists. Export it so it
can be used more widely.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agofdt: Report failure of ft_board_setup()
Simon Glass [Fri, 24 Oct 2014 00:58:48 +0000 (18:58 -0600)]
fdt: Report failure of ft_board_setup()

Since this function can fail, print a message when it does.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agofdt: Allow ft_board_setup() to report failure
Simon Glass [Fri, 24 Oct 2014 00:58:47 +0000 (18:58 -0600)]
fdt: Allow ft_board_setup() to report failure

This function can fail if the device tree runs out of space. Rather than
silently booting with an incomplete device tree, allow the failure to be
detected.

Unfortunately this involves changing a lot of places in the code. I have
not changed behvaiour to return an error where one is not currently
returned, to avoid unexpected breakage.

Eventually it would be nice to allow boards to register functions to be
called to update the device tree. This would avoid all the many functions
to do this. However it's not clear yet if this should be done using driver
model or with a linker list. This work is left for later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agolinux/kernel.h: add typechecking to roundup macro
Masahiro Yamada [Thu, 6 Nov 2014 18:03:30 +0000 (03:03 +0900)]
linux/kernel.h: add typechecking to roundup macro

This commit replaces roundup macro with the one from Linux Kernel.

DEFINE_ALIGN_BUFFER must be fixed because typechecking can not
be used in this context.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agolinux/kernel.h: import more macros
Masahiro Yamada [Thu, 6 Nov 2014 18:03:29 +0000 (03:03 +0900)]
linux/kernel.h: import more macros

These macros seem to be useful for U-Boot too (or at least
harmless).  Imported from Linux 3.18-rc2.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agoinclude: move various macros to include/linux/kernel.h
Masahiro Yamada [Thu, 6 Nov 2014 18:03:28 +0000 (03:03 +0900)]
include: move various macros to include/linux/kernel.h

U-Boot has imported various utility macros from Linux
scattering them to various places without consistency.

In include/common.h are min, max, min3, max3, ARRAY_SIZE, ALIGN,
container_of, DIV_ROUND_UP, etc.
In include/linux/compat.h are min_t, max_t, round_up, round_down,
etc.
We also have duplicated defines of min_t in some *.c files.

Moreover, we are suffering from too cluttered include/common.h.

This commit moves various macros that originate in
include/linux/kernel.h of Linux to their original position.

Note:
This commit simply moves the macros; the macros roundup,
min, max, min2, max3, ARRAY_SIZE are different
from those of Linux at this point.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agoinclude/common.h: remove DIV_ROUND definition
Masahiro Yamada [Thu, 6 Nov 2014 18:03:27 +0000 (03:03 +0900)]
include/common.h: remove DIV_ROUND definition

All the references of DIV_ROUND have been replaced with
DIV_ROUND_CLOSEST.  Remove DIV_ROUND.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agoreplace DIV_ROUND with DIV_ROUND_CLOSEST
Masahiro Yamada [Thu, 6 Nov 2014 18:03:26 +0000 (03:03 +0900)]
replace DIV_ROUND with DIV_ROUND_CLOSEST

The Linux-compatible macro DIV_ROUND_CLOSEST is a bit more flexible
and safer than DIV_ROUND.

For example,
  foo = DIV_ROUND_CLOSEST(x, y++)
works expectedly, but
  foo = DIV_ROUND(x, y++)
does not. (y is incremented twice.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agoARM: remove CONFIG_ARM1136 defines
Masahiro Yamada [Thu, 6 Nov 2014 05:59:37 +0000 (14:59 +0900)]
ARM: remove CONFIG_ARM1136 defines

CONFIG_CPU_ARM1136 was introduced into Kconfig by commit 2e07c249a67e
(kconfig: arm: introduce symbol for ARM CPUs).

This commit removes all the defines of CONFIG_ARM1136 and replaces
the only reference in arch/arm/lib/cache.c with CONFIG_CPU_ARM1136.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agoARM: remove CONFIG_ARM926EJS defines
Masahiro Yamada [Thu, 6 Nov 2014 05:59:36 +0000 (14:59 +0900)]
ARM: remove CONFIG_ARM926EJS defines

CONFIG_CPU_ARM926EJS was introduced into Kconfig by commit 2e07c249a67e
(kconfig: arm: introduce symbol for ARM CPUs).

This commit removes all the defines of CONFIG_ARM926EJS and replaces
the only reference in arch/arm/lib/cache.c with CONFIG_CPU_ARM926EJS.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agoARM: remove CONFIG_ARM920T defines
Masahiro Yamada [Thu, 6 Nov 2014 05:59:35 +0000 (14:59 +0900)]
ARM: remove CONFIG_ARM920T defines

CONFIG_CPU_ARM920T was introduced into Kconfig by commit 2e07c249a67e
(kconfig: arm: introduce symbol for ARM CPUs).

This commit removes all the defines of CONFIG_ARM920T and replaces the
only reference in drivers/usb/host/ohci-hcd.c with CONFIG_CPU_ARM920T.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agoARM: remove CONFIG_ARM1176 defines
Masahiro Yamada [Thu, 6 Nov 2014 05:59:34 +0000 (14:59 +0900)]
ARM: remove CONFIG_ARM1176 defines

CONFIG_ARM1176 is defined for some boards but not referenced at all.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agoARM: remove CONFIG_ARMV7 defines
Masahiro Yamada [Thu, 6 Nov 2014 05:59:33 +0000 (14:59 +0900)]
ARM: remove CONFIG_ARMV7 defines

Some (not all) of ARMv7 boards define CONFIG_ARMV7, which is useless.
Besides, it is never referenced.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
9 years agoimx: imx6q/dlsabreauto: Add PMIC Pfuze100 support
Ye.Li [Thu, 6 Nov 2014 08:29:02 +0000 (16:29 +0800)]
imx: imx6q/dlsabreauto: Add PMIC Pfuze100 support

Add the pfuze100 initialization in power_init_board for imx6q/dl
sabreauto board.

Signed-off-by: Ye.Li <B37916@freescale.com>
9 years agoimx: mx6sxsabresd: Use the pfuze common init function
Ye.Li [Thu, 6 Nov 2014 08:29:01 +0000 (16:29 +0800)]
imx: mx6sxsabresd: Use the pfuze common init function

Modify the pfuze init for mx6sxsabresd to use the shared
"pfuze_common_init" function. And move this initialization to
power_init_board.

Signed-off-by: Ye.Li <B37916@freescale.com>
9 years agoimx: mx6sabresd: Use the pfuze common init function
Ye.Li [Thu, 6 Nov 2014 08:29:00 +0000 (16:29 +0800)]
imx: mx6sabresd: Use the pfuze common init function

Modify the pfuze init for mx6sabresd to use the shared
"pfuze_common_init" function. And move this initialization to
power_init_board.

Signed-off-by: Ye.Li <B37916@freescale.com>
9 years agoimx: mx6sabre common: Factorize the Pfuze init function
Ye.Li [Thu, 6 Nov 2014 08:28:59 +0000 (16:28 +0800)]
imx: mx6sabre common: Factorize the Pfuze init function

Since the Pfuze initializations are similar on various mx6 SABRE
boards. Factorize the initialization to a common function in file
board/freescale/common/pfuze.c. So that all SABRE boards BSP can
share the function.

Signed-off-by: Ye.Li <B37916@freescale.com>
9 years agopower: pfuze100: Update definitions for buck regulators
Ye.Li [Thu, 6 Nov 2014 08:28:58 +0000 (16:28 +0800)]
power: pfuze100: Update definitions for buck regulators

Add definitions for buck regulators (SW1A/B/C) registers and voltage
values.

Signed-off-by: Ye.Li <B37916@freescale.com>
Reviewed-by: Przemyslaw Marczak <p.marczak@samsung.com>
9 years agoimx: mx6sxsabresd: Add board support for USDHC2 and USDHC3
Ye.Li [Tue, 4 Nov 2014 07:36:40 +0000 (15:36 +0800)]
imx: mx6sxsabresd: Add board support for USDHC2 and USDHC3

Add full support for USDHC2, USDHC3, USDHC4 on mx6sx sabresd board.
The default boot socket is USDHC4, so the MMC environment device and
mmcdev variable are set to this device.

Signed-off-by: Ye.Li <B37916@freescale.com>
9 years agommc: fsl_esdhc: Update esdhc driver for iMX6SX
Ye.Li [Tue, 4 Nov 2014 07:35:49 +0000 (15:35 +0800)]
mmc: fsl_esdhc: Update esdhc driver for iMX6SX

The reset value of "uSDHCx_INT_STATUS_EN" register is changed to 0
on iMX6SX. So the fsl_esdhc driver must update to set the register,
otherwise no state can be detected.

Signed-off-by: Ye.Li <B37916@freescale.com>
9 years agomx6sabresd: Access SRC_SBMR1 register via structure
Fabio Estevam [Tue, 18 Nov 2014 13:26:06 +0000 (11:26 -0200)]
mx6sabresd: Access SRC_SBMR1 register via structure

In U-boot it is preferred to access the register via structure pointer, so
convert it such style.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
9 years agotqma6: use imx_ddr_size
Markus Niebel [Tue, 18 Nov 2014 12:22:57 +0000 (13:22 +0100)]
tqma6: use imx_ddr_size

Signed-off-by: Markus Niebel <Markus.Niebel@tq-group.com>