oweals/u-boot.git
8 years agoARM: keystone2: Switch to using the poweroff command
Tom Rini [Wed, 16 Mar 2016 13:19:43 +0000 (09:19 -0400)]
ARM: keystone2: Switch to using the poweroff command

Now that we have a standard way to power off the hardware, switch to
using that rather than our own command.

Cc: Vitaly Andrianov <vitalya@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoARM: keystone2: Split monitor code / command code
Tom Rini [Wed, 16 Mar 2016 13:10:08 +0000 (09:10 -0400)]
ARM: keystone2: Split monitor code / command code

When we switch to including all linker lists in SPL it is important
to not include commands as that may lead to link errors due to other
things we have already discarded.  In this case, we split the code for
supporting the monitor out from the code for loading it.

Cc: Vitaly Andrianov <vitalya@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoARM: DRA7xx: Enable NFS boot command
Andrew F. Davis [Fri, 11 Mar 2016 21:22:20 +0000 (15:22 -0600)]
ARM: DRA7xx: Enable NFS boot command

NFS loading works on DRA7 variants, remove the undefinition.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoti_armv7_common: env: Add NFS loading support to default enviroment
Andrew F. Davis [Fri, 11 Mar 2016 21:04:03 +0000 (15:04 -0600)]
ti_armv7_common: env: Add NFS loading support to default enviroment

NFS loading is similar to net loading except initial files are loaded
over NFS instead of TFTP, this removes the need for multiple different
protocol servers running on the host and allows the use of a single
network file system containing boot related files in their usual
in-filesystem directory. Add defaults for this boot style here.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agospl_nor: fix warning when compiled for 64bit target
Masahiro Yamada [Mon, 29 Feb 2016 11:50:34 +0000 (20:50 +0900)]
spl_nor: fix warning when compiled for 64bit target

Fix "warning: cast to pointer from integer of different size".

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoARM: DRA7: DDR: Enable SR in Power Management Control
Nishanth Menon [Wed, 9 Mar 2016 12:09:56 +0000 (17:39 +0530)]
ARM: DRA7: DDR: Enable SR in Power Management Control

If EMIF is idle for certain amount of DDR cycles, EMIF will put the
DDR in self refresh mode to save power if EMIF_PWR_MGMT_CTRL register
is programmed. And also before entering suspend-resume ddr needs to
be put in self-refresh. Linux kernel does not program this register
before entering suspend and relies on u-boot setting.
So configuring it in u-boot.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Tested-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agokeystone2: env: Set mmc as default boot for k2g-evm
Yan Liu [Wed, 9 Mar 2016 10:09:39 +0000 (15:39 +0530)]
keystone2: env: Set mmc as default boot for k2g-evm

For k2l, k2e and k2hk, ubi is set to default boot in uboot
environment settings; while for k2g, mmc should be the
default boot. This patch is to set mmc as default for k2g-evm

Signed-off-by: Yan Liu <yan-liu@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agokeystone2: env: add env script for booting with an initramfs with firmware
Murali Karicheri [Wed, 9 Mar 2016 10:09:38 +0000 (15:39 +0530)]
keystone2: env: add env script for booting with an initramfs with firmware

This patch updates the env script to include a initramfs with firmware
loaded and provided to kernel through second argument of bootz command
during boot. Defined DEFAULT_FW_INITRAMFS_BOOT_ENV to have all of the
required env variables and use it in evm specific config file.

The K2 linux drivers for PCIe and NetCP (1G, 10G) requires serdes
firmwares. These requires firmware to be available early through the boot
process in some cases to satisfy firmware requests from driver. Hence use
a small initramfs to provide the same and update boot env to accommodate
this in the boot flow. This method is used when rootfs is nfs and ubifs.
This fs contains just lib/firmware folder with all required firmware.

When rootfs is on initramfs, then the filesystem has the firmware under
lib/firmware and this early initramfs is not required and is not used.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agok2g: configs: Add support to save env in MMC
Lokesh Vutla [Wed, 9 Mar 2016 10:09:37 +0000 (15:39 +0530)]
k2g: configs: Add support to save env in MMC

Adding support to save env in MMC on k2g platforms, as it is the
preferred peripheral in saving env.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agok2g: env: Allow use of a script and plain text env files
Lokesh Vutla [Wed, 9 Mar 2016 10:09:36 +0000 (15:39 +0530)]
k2g: env: Allow use of a script and plain text env files

For development purposes, it is easier to use the env import command
and plain text or script files instead of script-images. So allow
u-boot to load env var from a text file or a script file.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoti_armv7_common: env: Consolidate support for loading script and text env files
Lokesh Vutla [Wed, 9 Mar 2016 10:09:35 +0000 (15:39 +0530)]
ti_armv7_common: env: Consolidate support for loading script and text env files

Support for loading bootscript and text env file is duplicated in all TI
platforms. Add this information to DEFAULT_MMC_TI_ARGS so that it can be
reused in all TI platforms.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoam43xx: configs: Enable USB commands for non usb boot also
Mugunthan V N [Wed, 9 Mar 2016 10:09:34 +0000 (15:39 +0530)]
am43xx: configs: Enable USB commands for non usb boot also

With commit aee119bd70b8 ('am43xx_evm: add usb host boot support') usb
commands is removed from U-boot second stage and enbaled only on USB
boot config. Fixing this by enable USB commands for both USB boot and
in second stage u-boot.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoam335x: configs: Fix usb ether boot support
Lokesh Vutla [Wed, 9 Mar 2016 10:09:33 +0000 (15:39 +0530)]
am335x: configs: Fix usb ether boot support

CONFIG_SPL_NET_VCI_STRING is available only with BOOTP. So if
CMD_DHCP is enabled for SPL in usb ether boot, it will not pass
the right vendor name and failing to download the right file.
Also all the net CMD_* are not required in SPL builds. So defining
these only for non-SPL builds.

Reported-by: Yan Liu <yan-liu@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoti_armv7_keystone2: env: Remove securedb.key.bin load
Carlos Hernandez [Wed, 9 Mar 2016 10:09:32 +0000 (15:39 +0530)]
ti_armv7_keystone2: env: Remove securedb.key.bin load

securedb.key.bin is not supported so it should not be loaded by
default init_ubi command.

Signed-off-by: Carlos Hernandez <ceh@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoti_armv7_keystone2: env: Update UBIFS image paths
Carlos Hernandez [Wed, 9 Mar 2016 10:09:31 +0000 (15:39 +0530)]
ti_armv7_keystone2: env: Update UBIFS image paths

UBI images created by OE does not contain boot partition by default,
instead kernel and dtb are placed in /boot directory inside rootfs
partition. So update env commands to load files from correct
location.

Signed-off-by: Carlos Hernandez <ceh@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoti_armv7_keystone2: configs: add usb mass storage support
Mugunthan V N [Wed, 9 Mar 2016 10:09:30 +0000 (15:39 +0530)]
ti_armv7_keystone2: configs: add usb mass storage support

Add USB mass storage support so that kernel can be read from
connected usb storage.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoefi_loader: Pass proper device path in on boot
Alexander Graf [Fri, 4 Mar 2016 00:10:14 +0000 (01:10 +0100)]
efi_loader: Pass proper device path in on boot

EFI payloads can query for the device they were booted from. Because
we have a disconnect between loading binaries and running binaries,
we passed in a dummy device path so far.

Unfortunately that breaks grub2's logic to find its configuration
file from the same device it was booted from.

This patch adds logic to have the "load" command call into our efi
code to set the device path to the one we last loaded a binary from.

With this grub2 properly detects where we got booted from and can
find its configuration file, even when searching by-partition.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Call fdt preparation functions
Alexander Graf [Fri, 4 Mar 2016 00:10:13 +0000 (01:10 +0100)]
efi_loader: Call fdt preparation functions

We have a nice framework around image fils to prepare a device tree
for OS execution. That one patches in missing device tree nodes and
fixes up the memory range bits.

We need to call that one from the EFI boot path too to get all those
nice fixups. This patch adds the call.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoarm: Allow EFI payload code to take exceptions
Alexander Graf [Fri, 4 Mar 2016 00:10:12 +0000 (01:10 +0100)]
arm: Allow EFI payload code to take exceptions

There are 2 ways an EFI payload could return into u-boot:

  - Callback function
  - Exception

While in EFI payload mode, r9 is owned by the payload and may not contain
a valid pointer to gd, so we need to fix it up. We do that properly for the
payload to callback path already.

This patch also adds gd pointer restoral for the exception path.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoarm64: Replace fdt_name env variables with fdtfile
Alexander Graf [Fri, 4 Mar 2016 00:10:11 +0000 (01:10 +0100)]
arm64: Replace fdt_name env variables with fdtfile

The commonly defined environment variable to determine the device tree
file name is called fdtfile rather than fdt_name. Replace all occurences
of fdt_name with fdtfile.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Add MAINTAINERS entry
Alexander Graf [Fri, 4 Mar 2016 00:10:10 +0000 (01:10 +0100)]
efi_loader: Add MAINTAINERS entry

Now that everything's in place, let's add myself as the maintainer for
the efi payload support.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoefi_loader: Add README section in README.efi
Alexander Graf [Fri, 4 Mar 2016 00:10:09 +0000 (01:10 +0100)]
efi_loader: Add README section in README.efi

To preserve all cover letter knowledge of the status on UEFI payload
support, let's add some sections to README.efi.

Signed-off-by: Alexander Graf <agraf@suse.de>
v3 -> v4:

  - Add section about config options
  - s/10kb/10KB/

8 years agoefi_loader: Add distro boot script for removable media
Alexander Graf [Wed, 9 Mar 2016 23:26:15 +0000 (00:26 +0100)]
efi_loader: Add distro boot script for removable media

UEFI defines a simple boot protocol for removable media. There we should look
at the EFI (first GPT FAT) partition and search for /efi/boot/bootXXX.efi with
XXX being different between different platforms (x86, x64, arm, aa64, ...).

This patch implements a simple version of that protocol for the default distro
boot script. With this we can automatically boot from valid UEFI enabled
removable media.

Because from all I could see U-Boot by default doesn't deliver device tree
blobs with its firmware, we also need to load the dtb from somewhere. Traverse
the same EFI partition for an fdt file that fits our current board so that
an OS receives a valid device tree when booted automatically.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoefi_loader: hook up in build environment
Alexander Graf [Fri, 4 Mar 2016 00:10:07 +0000 (01:10 +0100)]
efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoarm64: Allow EFI payload code to take exceptions
Alexander Graf [Fri, 4 Mar 2016 00:10:06 +0000 (01:10 +0100)]
arm64: Allow EFI payload code to take exceptions

There are 2 ways an EFI payload could return into u-boot:

  - Callback function
  - Exception

While in EFI payload mode, x18 is owned by the payload and may not contain
a valid pointer to gd, so we need to fix it up. We do that properly for the
payload to callback path already.

This patch also adds gd pointer restoral for the exception path.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoarm64: Allow exceptions to return
Alexander Graf [Fri, 4 Mar 2016 00:10:05 +0000 (01:10 +0100)]
arm64: Allow exceptions to return

Our current arm64 exception handlers all panic and never return to the
exception triggering code.

But if any handler wanted to continue execution after fixups, it would
need help from the exception handling code to restore all registers.

This patch implements that help. With this code, exception handlers on
aarch64 can successfully return to the place the exception happened (or
somewhere else if they modify elr).

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Implement memory allocation and map
Alexander Graf [Fri, 4 Mar 2016 00:10:04 +0000 (01:10 +0100)]
efi_loader: Implement memory allocation and map

The EFI loader needs to maintain views of memory - general system memory
windows as well as used locations inside those and potential runtime service
MMIO windows.

To manage all of these, add a few helpers that maintain an internal
representation of the map the similar to how the EFI API later on reports
it to the application.

For allocations, the scheme is very simple. We basically allow allocations
to replace chunks of previously done maps, so that a new LOADER_DATA
allocation for example can remove a piece of the RAM map. When no specific
address is given, we just take the highest possible address in the lowest
RAM map that fits the allocation size.

Signed-off-by: Alexander Graf <agraf@suse.de>
Tested-by: Simon Glass <sjg@chromium.org>
8 years agoefi_loader: Add "bootefi" command
Alexander Graf [Wed, 9 Mar 2016 23:27:20 +0000 (00:27 +0100)]
efi_loader: Add "bootefi" command

In order to execute an EFI application, we need to bridge the gap between
U-Boot's notion of executing images and EFI's notion of doing the same.

The best path forward IMHO here is to stick completely to the way U-Boot
deals with payloads. You manually load them using whatever method to RAM
and then have a simple boot command to execute them. So in our case, you
would do

  # load mmc 0:1 $loadaddr grub.efi
  # bootefi $loadaddr

which then gets you into a grub shell. Fdt information known to U-boot
via the fdt addr command is also passed to the EFI payload.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Guard help text with CONFIG_SYS_LONGHELP]
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoefi_loader: Add disk interfaces
Alexander Graf [Fri, 4 Mar 2016 00:10:02 +0000 (01:10 +0100)]
efi_loader: Add disk interfaces

A EFI applications usually want to access storage devices to load data from.

This patch adds support for EFI disk interfaces. It loops through all block
storage interfaces known to U-Boot and creates an EFI object for each existing
one. EFI applications can then through these objects call U-Boot's read and
write functions.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Update for various DM changes since posting]
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoefi_loader: Add runtime services
Alexander Graf [Fri, 4 Mar 2016 00:10:01 +0000 (01:10 +0100)]
efi_loader: Add runtime services

After booting has finished, EFI allows firmware to still interact with the OS
using the "runtime services". These callbacks live in a separate address space,
since they are available long after U-Boot has been overwritten by the OS.

This patch adds enough framework for arbitrary code inside of U-Boot to become
a runtime service with the right section attributes set. For now, we don't make
use of it yet though.

We could maybe in the future map U-boot environment variables to EFI variables
here.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
8 years agoefi_loader: Add console interface
Alexander Graf [Fri, 4 Mar 2016 00:10:00 +0000 (01:10 +0100)]
efi_loader: Add console interface

One of the basic EFI interfaces is the console interface. Using it an EFI
application can interface with the user. This patch implements an EFI console
interface using getc() and putc().

Today, we only implement text based consoles. We also convert the EFI Unicode
characters to UTF-8 on the fly, hoping that everyone managed to jump on the
train by now.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
8 years agoefi_loader: Add boot time services
Alexander Graf [Fri, 4 Mar 2016 00:09:59 +0000 (01:09 +0100)]
efi_loader: Add boot time services

When an EFI application runs, it has access to a few descriptor and callback
tables to instruct the EFI compliant firmware to do things for it. The bulk
of those interfaces are "boot time services". They handle all object management,
and memory allocation.

This patch adds support for the boot time services and also exposes a system
table, which is the point of entry descriptor table for EFI payloads.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
8 years agoefi_loader: Add PE image loader
Alexander Graf [Fri, 4 Mar 2016 00:09:58 +0000 (01:09 +0100)]
efi_loader: Add PE image loader

EFI uses the PE binary format for its application images. Add support to EFI PE
binaries as well as all necessary bits for the "EFI image loader" interfaces.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
8 years agoinclude/efi_api.h: Add more detailed API definitions
Alexander Graf [Fri, 4 Mar 2016 00:09:57 +0000 (01:09 +0100)]
include/efi_api.h: Add more detailed API definitions

The EFI API header is great, but missing a good chunk of function prototype,
GUID defines and enum declarations.

This patch extends it to cover more of the EFI API. It's still not 100%
complete, but sufficient enough for our EFI payload interface.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
8 years agodisk/part.c: Expose list of available block drivers
Alexander Graf [Fri, 4 Mar 2016 00:09:56 +0000 (01:09 +0100)]
disk/part.c: Expose list of available block drivers

We have a pretty nice and generic interface to ask for a specific block
device. However, that one is still based around the magic notion that
we know the driver name.

In order to be able to write fully generic disk access code, expose the
currently internal list to other source files so that they can scan through
all available block drivers.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
8 years agoarm64: Only allow dcache disabled in SPL builds
Alexander Graf [Fri, 4 Mar 2016 00:09:55 +0000 (01:09 +0100)]
arm64: Only allow dcache disabled in SPL builds

Now that we have an easy way to describe memory regions and enable the MMU,
there really shouldn't be anything holding people back from running with
caches enabled on AArch64. To make sure people catch early if they're missing
on the caching fun, give them a compile error.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoarm64: Remove non-full-va map code
Alexander Graf [Fri, 4 Mar 2016 00:09:54 +0000 (01:09 +0100)]
arm64: Remove non-full-va map code

By now the code to only have a single page table level with 64k page
size and 42 bit address space is no longer used by any board in tree,
so we can safely remove it.

To clean up code, move the layerscape mmu code to the new defines,
removing redundant field definitions.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agohikey: Add MMU tables
Alexander Graf [Fri, 4 Mar 2016 00:09:53 +0000 (01:09 +0100)]
hikey: Add MMU tables

The hikey runs with dcache disabled today. There really should be no reason
not to use caches on AArch64, so let's add MMU definitions and enable the
dcache.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agodwmmc: Increase retry timeout
Alexander Graf [Fri, 4 Mar 2016 00:09:52 +0000 (01:09 +0100)]
dwmmc: Increase retry timeout

When enable dcache on HiKey, we're running into MMC command timeouts
because our retry loop is now faster than the eMMC (or an external SD
card) can answer.

Increase the retry count to the same as the timeout value for status
reports.

The real fix is obviously to not base this whole thing on a cycle counter
but on real wall time, but that would be slightly more intrusive.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agovexpress64: Add MMU tables
Alexander Graf [Fri, 4 Mar 2016 00:09:51 +0000 (01:09 +0100)]
vexpress64: Add MMU tables

There's no good excuse for running with caches disabled on AArch64,
so let's just move the vexpress64 target to enable the MMU and run
with caches on.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agotegra: Replace home grown mmu code with generic table approach
Alexander Graf [Fri, 4 Mar 2016 00:09:50 +0000 (01:09 +0100)]
tegra: Replace home grown mmu code with generic table approach

Now that we have nice table driven page table creating code that gives
us everything we need, move to that.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agozymqmp: Replace home grown mmu code with generic table approach
Alexander Graf [Fri, 4 Mar 2016 00:09:49 +0000 (01:09 +0100)]
zymqmp: Replace home grown mmu code with generic table approach

Now that we have nice table driven page table creating code that gives
us everything we need, move to that.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agothunderx: Move mmu table into board file
Alexander Graf [Fri, 4 Mar 2016 00:09:48 +0000 (01:09 +0100)]
thunderx: Move mmu table into board file

The MMU range table can vary depending on things we may only find
out at runtime. While the very simple ThunderX variant does not
change, other boards will, so move the definition from a static
entry in a header file to the board file.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoarm64: Make full va map code more dynamic
Alexander Graf [Fri, 4 Mar 2016 00:09:47 +0000 (01:09 +0100)]
arm64: Make full va map code more dynamic

The idea to generate our pages tables from an array of memory ranges
is very sound. However, instead of hard coding the code to create up
to 2 levels of 64k granule page tables, we really should just create
normal 4k page tables that allow us to set caching attributes on 2M
or 4k level later on.

So this patch moves the full_va mapping code to 4k page size and
makes it fully flexible to dynamically create as many levels as
necessary for a map (including dynamic 1G/2M pages). It also adds
support to dynamically split a large map into smaller ones when
some code wants to set dcache attributes.

With all this in place, there is very little reason to create your
own page tables in board specific files.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoarm64: Disable TTBR1 maps in EL1
Alexander Graf [Fri, 4 Mar 2016 00:09:46 +0000 (01:09 +0100)]
arm64: Disable TTBR1 maps in EL1

When running in EL1, AArch64 knows two page table maps. One with addresses
that start with all zeros (TTBR0) and one with addresses that start with all
ones (TTBR1).

In U-Boot we don't care about the high up maps, so just disable them to ensure
we don't walk an invalid page table by accident.

Reported-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agothunderx: Calculate TCR dynamically
Alexander Graf [Fri, 4 Mar 2016 00:09:45 +0000 (01:09 +0100)]
thunderx: Calculate TCR dynamically

Based on the memory map we can determine a lot of hard coded fields of
TCR, like the maximum VA and max PA we want to support. Calculate those
dynamically to reduce the chance for pit falls.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agokc1: Clear reboot mode garbage on cold reset
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:15 +0000 (19:19 +0100)]
kc1: Clear reboot mode garbage on cold reset

Reboot mode garbage is found on cold reset and might be seen as valid on the
next warm reset, thus it has to be cleared on cold reset.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agokc1: Power off when the power on reason is not a valid one
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:14 +0000 (19:19 +0100)]
kc1: Power off when the power on reason is not a valid one

Some power on reasons are not desirable (e.g. too short press on the power
button), battery plug. Thus, power off the device when one of those occurs.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoinput: TWL6030 input support for power button, USB and charger
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:13 +0000 (19:19 +0100)]
input: TWL6030 input support for power button, USB and charger

This adds support for detecting a few inputs exported by the TWL6030.
Currently-supported inputs are the power button, USB and charger presence.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agopower: twl6030: Power off support
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:12 +0000 (19:19 +0100)]
power: twl6030: Power off support

This adds support for powering off (the omap SoC) from the twl6030.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agopower: twl6030: Remove ifdef around the code
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:11 +0000 (19:19 +0100)]
power: twl6030: Remove ifdef around the code

The TWL6030 power driver is only built when CONFIG_TWL6030_POWER is selected,
thus there is no reason to wrap the code with ifdef.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agokc1: Boot to bootloader (fastboot) on ID pin pull-up
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:10 +0000 (19:19 +0100)]
kc1: Boot to bootloader (fastboot) on ID pin pull-up

USB ID pin pull-up indicates factory (fastboot) cable detection.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agokc1: OMAP4 reboot mode support
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:09 +0000 (19:19 +0100)]
kc1: OMAP4 reboot mode support

This adds support for the omap4 reboot mode mechanism and exports the reboot
mode via an environment variable, that is used in the boot command to make it
possible to boot from the recovery partition or fastboot.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoomap4: Check warm reset for reboot mode validity
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:08 +0000 (19:19 +0100)]
omap4: Check warm reset for reboot mode validity

Since the SAR registers are filled with garbage on cold reset, this checks for a
warm reset to assert the validity of reboot mode.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoomap4: Reboot mode support
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:07 +0000 (19:19 +0100)]
omap4: Reboot mode support

Reboot mode is written to SAR memory before reboot in the form of a string.

This mechanism is supported on OMAP4 by various TI kernels.

It is up to each board to make use of this mechanism or not.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agokc1: MUSB USB controller and fastboot USB gadget support
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:06 +0000 (19:19 +0100)]
kc1: MUSB USB controller and fastboot USB gadget support

This adds support for the MUSB USB dual-role controller in peripheral mode,
with configuration options for the fastboot USB gadget.

At this point, flashing the internal eMMC is support.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agousb: musb-new: omap2430: OMAP4 MUSB USB controller support
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:05 +0000 (19:19 +0100)]
usb: musb-new: omap2430: OMAP4 MUSB USB controller support

This adds support for the OMAP4 MUSB USB controller, with a matching Linux
compat definition, TWL6030 USB device setup and USBOTGHS register setup.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agopower: twl6030: Clear VUSB_IN_PMID bit on USB device setup
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:04 +0000 (19:19 +0100)]
power: twl6030: Clear VUSB_IN_PMID bit on USB device setup

When booting from USB, the bootrom sets the VUSB_IN_PMID bit of the MISC2
register of the TWL6030. However, U-Boot sets the VUSB_IN_VSYS bit to enable
VBUS input. As both bits are contradictory, enabling both disables the input,
according to the TWL6030 TRM.

Thus, we need to clear the VUSB_IN_PMID bit in case of an USB boot (which could
just as well be a memory boot after USB timed out).

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agopower: twl6030: Configure VUSB voltage on USB device setup
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:03 +0000 (19:19 +0100)]
power: twl6030: Configure VUSB voltage on USB device setup

This explicitly sets VUSB voltage to 3.3V when enabling USB.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoomap4: Properly enable USB PHY clocks
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:02 +0000 (19:19 +0100)]
omap4: Properly enable USB PHY clocks

This correctly enables the USB PHY clocks, by enabling CM_ALWON_USBPHY_CLKCTRL
and correctly setting CM_L3INIT_USBPHY_CLKCTRL's value.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoomap-common: clocks-common: Setup USB DPLL when MUSB is in use
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:01 +0000 (19:19 +0100)]
omap-common: clocks-common: Setup USB DPLL when MUSB is in use

On (at least) OMAP4, the USB DPLL is required to be setup for the internal PHY
to work properly. The internal PHY is used by default with the MUSB USB OTG
controller.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoAmazon Kindle Fire (first generation) codename kc1 support
Paul Kocialkowski [Sat, 27 Feb 2016 18:19:00 +0000 (19:19 +0100)]
Amazon Kindle Fire (first generation) codename kc1 support

The Amazon Kindle Fire (first generation) codename kc1 is a tablet that was
released by Amazon back in 2011.

It is using an OMAP4430 SoC GP version, which allows running U-Boot and the
U-Boot SPL from the ground up.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoomap4: Move i2c clocks enable to enable_basic_clocks
Paul Kocialkowski [Sat, 27 Feb 2016 18:18:59 +0000 (19:18 +0100)]
omap4: Move i2c clocks enable to enable_basic_clocks

I2C is often enabled withing the U-Boot SPL, thus those clocks are required to
be enabled early (especially when the bootrom doesn't enable them for us).

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoomap4: Remove duplicate CM_L3INIT_USBPHY_CLKCTRL reference and whitespace
Paul Kocialkowski [Sat, 27 Feb 2016 18:18:58 +0000 (19:18 +0100)]
omap4: Remove duplicate CM_L3INIT_USBPHY_CLKCTRL reference and whitespace

This removes a duplicate reference to CM_L3INIT_USBPHY_CLKCTRLin
enable_basic_uboot_clocks. Also, a doubled whitespace is removed.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoomap-common: Remove deprecated arch_cpu_init code
Paul Kocialkowski [Sat, 27 Feb 2016 18:18:57 +0000 (19:18 +0100)]
omap-common: Remove deprecated arch_cpu_init code

save_omap_boot_params is called from spl_board_init in the SPL context. Thus,
there is no reason to duplicate that call on arch_cpu_init.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoomap-common: Rename set_muxconf_regs_essential to set_muxconf_regs
Paul Kocialkowski [Sat, 27 Feb 2016 18:18:56 +0000 (19:18 +0100)]
omap-common: Rename set_muxconf_regs_essential to set_muxconf_regs

There is no distinction between essential and non-essential mux configuration,
so it doesn't make sense to have an "essential" prefix.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoomap4: Export jedec sdram timings
Paul Kocialkowski [Sat, 27 Feb 2016 18:18:55 +0000 (19:18 +0100)]
omap4: Export jedec sdram timings

Individual boards might provide their own emif_get_device_timings function and
use the jedec timings in their own way, hence those have to be exported.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoomap4: Export elpidia sdram timings
Paul Kocialkowski [Sat, 27 Feb 2016 18:18:54 +0000 (19:18 +0100)]
omap4: Export elpidia sdram timings

Individual boards might provide their own emif_get_device_timings function and
use the elpidia timings in their own way, hence those have to be exported.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoomap4: Export elpidia sdram device details
Paul Kocialkowski [Sat, 27 Feb 2016 18:18:53 +0000 (19:18 +0100)]
omap4: Export elpidia sdram device details

Individual boards might provide their own emif_get_device_details function and
use elpidia device details in their own way, hence those have to be exported.

This also wraps existing definitions with the proper ifdef logic.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agoomap_hsmmc: Board-specific TWL6030 MMC power initialization
Paul Kocialkowski [Sat, 27 Feb 2016 18:18:52 +0000 (19:18 +0100)]
omap_hsmmc: Board-specific TWL6030 MMC power initialization

Boards using the TWL6030 regulator may not all use the LDOs the same way.
Some might also not use MMC1 at all, so VMMC would't have to be enabled.

This delegates TWL6030 MMC power initializations to board-specific functions,
that may still call twl6030_power_mmc_init for the default behavior.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agopower: twl6030: Device-index-specific MMC power initialization
Paul Kocialkowski [Sat, 27 Feb 2016 18:18:51 +0000 (19:18 +0100)]
power: twl6030: Device-index-specific MMC power initialization

Not every device has multiple MMC slots available, so it makes sense to enable
only the required LDOs for the available slots. Generic code in omap_hsmmc will
enable both VMMC and VAUX1, in doubt.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agopower: twl6030: Enable VAUX1 for eMMC power, depending on BOOT2 value
Paul Kocialkowski [Sat, 27 Feb 2016 18:18:50 +0000 (19:18 +0100)]
power: twl6030: Enable VAUX1 for eMMC power, depending on BOOT2 value

This enables the VAUX1 supply, used for eMMC power in standard configurations.
Its voltage is determined by the value of the BOOT2 pin of the TWL6030.

Note that the TWL6030 might already have enabled this regulator at startup
(depending on the value of the BOOT3 pin of the TWL6030), according to the
TWL6030 datasheet.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agopower: twl6030: Some more explicit registers and values definitions
Paul Kocialkowski [Sat, 27 Feb 2016 18:18:49 +0000 (19:18 +0100)]
power: twl6030: Some more explicit registers and values definitions

This makes the twl6030 mmc and usb-related power registers and values
definitions more explicit and clear and adds prefixes to them.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agosniper: Clear reboot mode garbage on cold reset
Paul Kocialkowski [Sat, 27 Feb 2016 18:26:44 +0000 (19:26 +0100)]
sniper: Clear reboot mode garbage on cold reset

Reboot mode garbage is found on cold reset and might be seen as valid on the
next warm reset, thus it has to be cleared on cold reset.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agosniper: Get rid of reset_misc
Paul Kocialkowski [Sat, 27 Feb 2016 18:26:43 +0000 (19:26 +0100)]
sniper: Get rid of reset_misc

There is no need to set the reboot mode to a particular value prior to reboot,
since valid values will have been caught and cleared earlier.

In addition, this breaks the reboot-bootloader fastboot call, by overriding the
required value for fastboot.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoomap3: Use a define for reboot reason offset
Paul Kocialkowski [Sat, 27 Feb 2016 18:26:42 +0000 (19:26 +0100)]
omap3: Use a define for reboot reason offset

This introduces a define for the offset to the reboot reason, rather than
hardcoding it.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoomap3: String-based reboot mode handling
Paul Kocialkowski [Sat, 27 Feb 2016 18:26:41 +0000 (19:26 +0100)]
omap3: String-based reboot mode handling

This switches reboot mode handling to a string-based interface, that allows more
flexibility to set a common interface with the next generations of OMAP devices.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agospi: omap3: Fix multiple definition of 'priv'
Jagan Teki [Tue, 15 Mar 2016 18:26:33 +0000 (23:56 +0530)]
spi: omap3: Fix multiple definition of 'priv'

Global definition of priv seems no-sense to use it
for non-dm case and pass the pointer to functions
which are common to both dm and non-dm.

So, fix this by removing omap3_spi_slave from non-dm
and make visible to omap3_spi_priv for both dm and non-dm.

Cc: Christophe Ricard <christophe-h.ricard@st.com>
Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agoMerge branch 'master' of git://git.denx.de/u-boot-video
Tom Rini [Tue, 15 Mar 2016 12:01:17 +0000 (08:01 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-video

8 years agoMerge branch 'master' of git://git.denx.de/u-boot-spi
Tom Rini [Tue, 15 Mar 2016 12:01:04 +0000 (08:01 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-spi

8 years agoMerge git://git.denx.de/u-boot-dm
Tom Rini [Mon, 14 Mar 2016 23:21:44 +0000 (19:21 -0400)]
Merge git://git.denx.de/u-boot-dm

8 years agoMerge git://git.denx.de/u-boot-marvell
Tom Rini [Mon, 14 Mar 2016 23:21:35 +0000 (19:21 -0400)]
Merge git://git.denx.de/u-boot-marvell

8 years agoarm64: define _image_binary_end to fix SPL_OF_CONTROL
Masahiro Yamada [Tue, 8 Mar 2016 11:34:44 +0000 (20:34 +0900)]
arm64: define _image_binary_end to fix SPL_OF_CONTROL

To make SPL_OF_CONTROL work on ARM64 SoCs, _image_binary_end must be
defined in the linker script.

 LD      spl/u-boot-spl
lib/built-in.o: In function `fdtdec_setup':
lib/fdtdec.c:1186: undefined reference to `_image_binary_end'
lib/fdtdec.c:1186: undefined reference to `_image_binary_end'
make[1]: *** [spl/u-boot-spl] Error 1
make: *** [spl/u-boot-spl] Error 2

Note:
CONFIG_SPL_SEPARATE_BSS must be defined as well on ARM64 SoCs.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoARM: DRA72-evm: Update mux and VIRTUAL/MANUAL mode timings
Lokesh Vutla [Tue, 8 Mar 2016 04:40:20 +0000 (10:10 +0530)]
ARM: DRA72-evm: Update mux and VIRTUAL/MANUAL mode timings

All the mux configurations needs to be done as part of the IODelay
sequence to avoid glitch. Adding all the mux configuration, MANUAL/VIRTUAL
mode configuration as needed for DRA72-evm.

Also update the mux for SD card detect on DRA74-evm.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoARM: DRA7-evm: Update memory info in banks
Lokesh Vutla [Tue, 8 Mar 2016 03:48:09 +0000 (09:18 +0530)]
ARM: DRA7-evm: Update memory info in banks

Updating the memory banks properly so that DT is populated accordingly.
And updating this only after DDR is properly detected by eeprom, so that
git bisect is still maintained.

Acked-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
8 years agoARM: DRA7: EMIF: Add 4GB DDR settings
Lokesh Vutla [Tue, 8 Mar 2016 03:48:08 +0000 (09:18 +0530)]
ARM: DRA7: EMIF: Add 4GB DDR settings

The REVH and later versions of DRA7-evm uses MICRON MT41K512M16HA-125 memory
chips which is of size 4GB(2GB on EMIF1 and 2GB on EMIF2). Add support for the
same.

Acked-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
8 years agoARM: DRA7: configs: Prepare for detecting memory > 2GB
Lokesh Vutla [Tue, 8 Mar 2016 03:48:07 +0000 (09:18 +0530)]
ARM: DRA7: configs: Prepare for detecting memory > 2GB

Enable configs that are required for detecting memory > 2GB.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
8 years agoARM: DRA7: Move emif settings to board specific files
Lokesh Vutla [Tue, 8 Mar 2016 03:48:06 +0000 (09:18 +0530)]
ARM: DRA7: Move emif settings to board specific files

The newer versions of DRA7 boards has EEPROM populated with DDR
size specified in it. Moving DRA7 specific emif related settings
to board files so that emif settings can be identified based on EEPROM.

Acked-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
8 years agoARM: DRA7: Enable EEPROM support
Lokesh Vutla [Tue, 8 Mar 2016 03:48:05 +0000 (09:18 +0530)]
ARM: DRA7: Enable EEPROM support

Enable EEPROM support for DRA74-evm.

Acked-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
8 years agoti: common: dra7: Add standard access for board description EEPROM
Lokesh Vutla [Tue, 8 Mar 2016 03:48:04 +0000 (09:18 +0530)]
ti: common: dra7: Add standard access for board description EEPROM

DRA7 EVM revH and later EVMs have EEPROM populated that can contain board
description information such as name, revision, DDR definition, etc. Adding
support for this EEPROM format.

Acked-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
8 years agoARM: AM57xx: Update EMIF registers
Lokesh Vutla [Tue, 8 Mar 2016 03:41:35 +0000 (09:11 +0530)]
ARM: AM57xx: Update EMIF registers

There are certain EMIF timing failures seen on the some x15 boards. Updating
the EMIF settings to get rid of these timing failures.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
8 years agoARM: Various: Future-proof serial platdata
Adam Ford [Tue, 8 Mar 2016 03:08:49 +0000 (21:08 -0600)]
ARM: Various: Future-proof serial platdata

A few boards still use ns16550_platdata structures, but assume the structure
is going to be in a specific order. By explicitly naming each entry,
this should also help 'future-proof' in the event the structure changes.

Tested on the Logic PD Torpedo + Wireless.

I only changed a handful of devices that used the same syntax as the Logic
board.  Appologies if I missed one or stepped on toes.  Thanks to Derald Woods
and Alexander Graf.

Signed-off-by: Adam Ford <aford173@gmail.com>
V6: Add fix to arch/arm/cpu/armv7/am33xx/board.c

V5: Add fix to arch/arm/cpu/arm926ejs/lpc32xx/devices.c

V4: Fix subject heading

V3: Remove  reg_offset out in all the structs. It was reverted out, and and if
it did exist, it would get initialized to 0 by default.

V2: I hastily copy-pasted the boards without looking at the UART number.
This addresses 3 boards that use UART3 and not UART1.
Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoARM: OMAP4+: Allow arch specfic code to use early DM
Lokesh Vutla [Mon, 7 Mar 2016 09:19:54 +0000 (14:49 +0530)]
ARM: OMAP4+: Allow arch specfic code to use early DM

Early system initialization is being done before initf_dm is being called
in U-Boot. Then system will fail to boot if any of the DM enabled driver
is being called in this system initialization code. So, rearrange the
code a bit so that DM enabled drivers can be called during early system
initialization.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoARM: DRA7: emif: Enable interleaving for higher address space
Lokesh Vutla [Sat, 5 Mar 2016 12:02:31 +0000 (17:32 +0530)]
ARM: DRA7: emif: Enable interleaving for higher address space

Given that DRA7/OMAP5 SoCs can support more than 2GB of memory,
enable interleaving for this higher memory to increase performance.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoARM: DRA7: emif: Check for enable bits before updating leveling output
Lokesh Vutla [Sat, 5 Mar 2016 12:02:30 +0000 (17:32 +0530)]
ARM: DRA7: emif: Check for enable bits before updating leveling output

Read and write leveling can be enabled independently. Check for these
enable bits before updating the read and write leveling output values.
This will allow to use the combination of software and hardware leveling.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoARM: DRA7: emif: Fix DDR init sequence during warm reset
Lokesh Vutla [Sat, 5 Mar 2016 12:02:29 +0000 (17:32 +0530)]
ARM: DRA7: emif: Fix DDR init sequence during warm reset

Commit (20fae0a - ARM: DRA7: DDR: Enable SR in Power Management Control)
enables Self refresh mode by default and during warm reset the EMIF
contents are preserved. After warm reset EMIF sees that it is idle and
puts DDR in self-refresh. When in SR, leveling operations cannot be done
as DDR can only accept SR exit command, so its hanging during warm reset.
In order to fix this reset the power management control register before
EMIF initialization if it is a warm reset.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoARM: DRA7: emif: Fix updating of refresh ctrl shadow
Lokesh Vutla [Sat, 5 Mar 2016 12:02:28 +0000 (17:32 +0530)]
ARM: DRA7: emif: Fix updating of refresh ctrl shadow

On DRA7, refresh ctrl shadow should be updated with
the final value.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agodm: omap_timer: Fix conversion of address to a pointer
Lokesh Vutla [Sat, 5 Mar 2016 11:10:32 +0000 (16:40 +0530)]
dm: omap_timer: Fix conversion of address to a pointer

OMAP timer driver directly typecasts fdt_addr_t to a pointer. This is
not strictly correct, as it gives a build warning when fdt_addr_t is u64.
So, use map_physmem for a proper typecasts.

This is inspired by commit 167efe01bc5a9 ("dm: ns16550: Use an address
instead of a pointer for the uart base")

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoARM: keystone2: use detected ddr3a size
Vitaly Andrianov [Fri, 4 Mar 2016 16:36:43 +0000 (10:36 -0600)]
ARM: keystone2: use detected ddr3a size

Because KS2 u-boot works in 32 bit address space the existing ram_size
global data field cannot be used. The maximum, which the get_ram_size()
can detect is 2GB only. The ft_board_setup() needs the actual ddr3 size
to fix up dtb.

This commit introduces the ddr3_get_size() which uses SPD data to
calculate the ddr3 size. This function replaces the "ddr3_size"
environment variable, which was used to get the SODIMM size.

For platforms, which don't have SODIMM with SPD and ddr3 is populated to
a board a simple ddr3_get_size function that returns ddr3 size has to be
implemented. See hardware-k2l.h

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoARM: keystone2: use SPD info to configure K2HK and K2E DDR3
Vitaly Andrianov [Fri, 4 Mar 2016 16:36:42 +0000 (10:36 -0600)]
ARM: keystone2: use SPD info to configure K2HK and K2E DDR3

This commit replaces hard-coded EMIF and PHY DDR3 configurations for
predefined SODIMMs to a calculated configuration. The SODIMM parameters
are read from SODIMM's SPD and used to calculated the configuration.

The current commit supports calculation for DDR3 with 1600MHz and 1333MHz
only.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>