Commit Graph

39642 Commits

Author SHA1 Message Date
Paul Burton 3f96f87520 clk: Use dummy clk_get_by_* functions when CONFIG_CLK is disabled
The implementations of clk_get_by_index & clk_get_by_name are only
available when CONFIG_CLK is enabled. Provide the dummies when this is
not the case in order to avoid build failures.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-09-21 15:04:32 +02:00
Paul Burton 639200f6a0 MIPS: Ensure cache ops complete in mips_cache_reset
Ensure that cache operations complete before returning from
mips_cache_reset by placing a completion barrier (sync instruction)
before the return. Without this there is no guarantee that the cache ops
will complete before any subsequent memory accesses, since they are
indexed cache ops & thus not implicitly ordered with memory accesses.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
2016-09-21 15:04:04 +02:00
Paul Burton d608254b0a MIPS: Clear hazard between TagLo writes & cache ops
Writing to the coprocessor 0 TagLo registers introduces an execution
hazard in that we need that write to complete before any cache
instructions execute. Ensure that hazard is cleared by inserting an ehb
instruction between the TagLo writes & cache op loop.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
2016-09-21 15:04:04 +02:00
Paul Burton c5b8412d60 MIPS: Ensure Config.K0=2 applies before any memory accesses
During boot we set Config.K0=2 (uncached) such that any accesses to the
kseg0 memory region are performed uncached before the caches are
initialised. This write to the Config register introduces an execution
hazard between it & any following memory accesses (such as the load of
_gp), which we need to clear in order to ensure those memory accesses
are actually performed uncached. Clear this execution hazard with the
insertion of an ehb execution hazard barrier instruction.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
2016-09-21 15:04:04 +02:00
Paul Burton 566ce04de4 MIPS: Malta: Enable CM & L2 support
Enable support for the MIPS Coherence Manager & L2 caches on the MIPS
Malta board, removing the need for us to attempt to bypass the L2 during
boot (which would fail with recent CPUs that expose L2 config via the CM
anyway).

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
2016-09-21 15:04:04 +02:00
Paul Burton 7953354b07 MIPS: Join the coherent domain when a CM is present
MIPS Linux expects the bootloader to leave the boot CPU a member of the
coherent domain when running on a system with a CM, and we will need to
do so if we wish to make use of IOCUs to have cache-coherent DMA in
U-Boot (and on some systems there is no choice in that matter). When a
CM is present, join the coherent domain after completing cache
initialisation.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
2016-09-21 15:04:04 +02:00
Paul Burton 4baa0ab67d MIPS: L2 cache support
This patch adds support for initialising & maintaining L2 caches on MIPS
systems. The L2 cache configuration may be advertised through either
coprocessor 0 or the MIPS Coherence Manager depending upon the system,
and support for both is included.

If the L2 can be bypassed then we bypass it early in boot & initialise
the L1 caches first, such that we can start making use of the L1
instruction cache as early as possible. Otherwise we initialise the L2
first such that the L1s have no opportunity to generate access to the
uninitialised L2.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
2016-09-21 15:04:04 +02:00
Paul Burton b2b135d980 MIPS: Map CM Global Control Registers
Map the Global Control Registers (GCRs) provided by the MIPS Coherence
Manager (CM) in preparation for using some of them in later patches.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
2016-09-21 15:04:04 +02:00
Paul Burton 5c72e5a62e MIPS: Define register names for cache init
Define names for registers holding cache sizes throughout
mips_cache_reset, in order to make the code easier to read & allow for
changing register assignments more easily.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
2016-09-21 15:04:04 +02:00
Paul Burton f8981277f5 MIPS: If we don't need DDR for cache init, init cache first
On systems where cache initialisation doesn't require zeroed memory (ie.
systems where CONFIG_SYS_MIPS_CACHE_INIT_RAM_LOAD is not defined)
perform cache initialisation prior to lowlevel_init & DDR
initialisation. This allows for DDR initialisation code to run cached &
thus significantly faster.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
2016-09-21 15:04:04 +02:00
Paul Burton 4f9226b403 MIPS: Preserve Config implementation-defined bits
The coprocessor 0 Config register includes 9 implementation defined
bits, which in some processors do things like enable write combining or
other functionality. We ought not to wipe them to 0 during boot. Rather
than doing so, preserve their value & only clear the bits standardised
by the MIPS architecture.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
2016-09-21 15:04:04 +02:00
Paul Burton 33b5c9b209 MIPS: Enable use of the instruction cache earlier
Enable use of the instruction cache immediately after it has been
initialised. This will only take effect if U-Boot was linked to run from
kseg0 rather than kseg1, but when this is the case the data cache
initialisation code will run cached & thus significantly faster.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
2016-09-21 15:04:04 +02:00
Paul Burton 8cb4817d0f MIPS: Probe cache line sizes once during boot
Rather than probing the cache line sizes on every call of any cache
maintenance function, probe them once during boot & store the values in
the global data structure for later use. This will reduce the overhead
of the cache maintenance functions, which isn't a big deal yet but
becomes more important once L2 caches which may expose their properties
via coprocessor 2 or the CM are supported.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
2016-09-21 15:04:04 +02:00
Paul Burton 0dfe04d6c8 MIPS: ath79: Use mach_cpu_init instead of arch_cpu_init
In order to prepare for MIPS arch code making use of arch_cpu_init in a
later patch, stop using it from ath79 SoC code & instead use the new
mach_cpu_init which is provided for this purpose.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
2016-09-21 15:04:04 +02:00
Paul Burton 8ebf50692e board_f: Add a mach_cpu_init callback
Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-09-21 15:04:04 +02:00
Zubair Lutfullah Kakakhel ebf2b9e3df mips: Add MIPSfpga platform support
MIPSfpga is an FPGA based dev platform.

In a nutshell, its a microAptiv cpu core with lots of Xilinx IP blocks

The FPGA dev board used is the Nexys4DDR board by Digilent.

For more information, check the Readme file in board/imgtec/xilfpga

Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
2016-09-21 14:55:14 +02:00
Zubair Lutfullah Kakakhel d4e85377e7 mips: xilfpga: Add device tree files
Mostly the same as the Kernel upstream device tree file except for

- alias for the serial console node
- ethernet node as the ethernet stuff isn't upstream on kernel.org yet
- uart clock-frequency passed directly in the node

Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
2016-09-21 14:55:14 +02:00
Zubair Lutfullah Kakakhel 2f1f05f432 net: emaclite: Enable driver for MIPS
Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-09-21 14:55:14 +02:00
Zubair Lutfullah Kakakhel 611fe0bddb net: emaclite: use __raw_readl/writel instead of weird define
out_be32 and in_be32 are actually #defined to little endian
writel/readl in arch/microblaze.

Just use __raw_writel/readl instead. That is also what is used
in the Linux kernel driver for this IP block

Tested on MIPSfpga. Can tftp a kernel.

Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-09-21 14:55:14 +02:00
Zubair Lutfullah Kakakhel 39e020ef16 net: emaclite: Use ioremap_nocache
Virtual to physical mapping isn't necessarily 1:1 for all architectures

Using ioremap_nocache allows for the arch code to translate the
physical address to a virtual address.

Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-09-21 14:55:14 +02:00
Jacob Chen 2b42903397 mmc: dw_mmc: push/pop all FIFO data if any data request
When DTO interrupt occurred, there are any remaining data still in FIFO
due to RX FIFO threshold is larger than remaining data. It also
causes that dwmmc didn't trigger RXDR interrupt, so is TX.

It's responsibility of driver to read remaining bytes on seeing DTO
interrupt.

Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
2016-09-21 16:00:14 +09:00
Tom Rini a2ed3f452d Merge git://git.denx.de/u-boot-dm 2016-09-20 09:34:53 -04:00
Tom Rini 60c629b836 PowerPC: Update last users of CONFIG_ISO_STRING to Kconfig
There are a few boards that use CONFIG_ISO_STRING as part of a sanity
check during firmware update at run time.  Move this string to Kconfig.

Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-20 09:30:26 -04:00
Tom Rini adf32adb70 PowerPC: Update MIP405/MIP405T to use Kconfig better
Convert CONFIG_MIP405T from SYS_EXTRA_OPTIONS to a real config

There are two boards, MIP405 and MIP405T that have a few differences.
Start by checking for CONFIG_TARGET_MIP405.  Then introduce
CONFIG_TARGET_MIP405T and use that not CONFIG_MIP405T.  Next, convert
also convert the usage of CONFIG_ISO_STRING to be based on Kconfig.

Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-20 09:30:25 -04:00
Siva Durga Prasad Paladugu a4d88920e5 Kconfig: Move config IDENT_STRING to Kconfig
Move the config IDENT_STRING to Kconfig and migrate all boards

[sivadur: Migrate zynq boards]
Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
[trini: Update configs, add some default to sunxi Kconfig]
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-20 09:30:23 -04:00
Tom Rini 06066a7df9 configs: Re-sync
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-20 09:30:07 -04:00
Wenyou Yang 6dffdbc3a5 mmc: sdhci: Add the programmable clock mode support
Add the programmable clock mode for the clock generator.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
2016-09-20 06:46:01 +09:00
Peng Fan e492dbb41e mmc: sd: optimize erase
To SD, there is no erase group, then the value erase_grp_size
will be default 1. When erasing SD blocks, the blocks will be
erased one by one, which is time consuming.

We use AU_SIZE as a group to speed up the erasing.

Erasing 4MB with a SD2.0 Card with AU_SIZE 4MB.
`time mmc erase 0x100000 0x2000`
time: 44.856 seconds (before optimization)
time: 0.335 seconds  (after optimization)

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Clemens Gruber <clemens.gruber@pqgruber.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Eric Nelson <eric@nelint.com>
Cc: Stephen Warren <swarren@nvidia.com>
2016-09-20 06:46:01 +09:00
Peng Fan 3697e5992f mmc: sd: extracting erase related information from sd status
Add function to read SD_STATUS information.
According to the information, get erase_timeout/erase_size/erase_offset.
Add a structure sd_ssr to include the erase related information.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Clemens Gruber <clemens.gruber@pqgruber.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Eric Nelson <eric@nelint.com>
Cc: Stephen Warren <swarren@nvidia.com>
2016-09-20 06:46:01 +09:00
Masahiro Yamada 65a25b2086 mmc: sdhci: drop CONFIG_ from CONFIG_SDHCI_CMD_MAX_TIMEOUT
No need for per-SoC adjustment for this parameter.  It should be
determined by the slowest hardware.  Currently, no board overrides
this CONFIG, so 3.2 sec is large enough.  (If not, we can make it
even larger.)

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-09-20 06:46:01 +09:00
Masahiro Yamada d8ce77b28c mmc: sdhci: drop CONFIG_ from CONFIG_SDHCI_CMD_DEFAULT_TIME
This CONFIG is not configurable since it is not guarded by #ifndef.
Nobody has complained about that, so there is no need to keep it as
a CONFIG option.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-09-20 06:46:01 +09:00
Masahiro Yamada 15bd09959f mmc: sdhci: move SDMA capability check to sdhci_setup_cfg()
If CONFIG_BLK is enabled, add_sdhci() is never called.  Move this
quirk handling to sdhci_setup_cfg(), which is now the central place
for hardware capability checks.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-09-20 06:46:01 +09:00
Masahiro Yamada 3137e645e2 mmc: sdhci: move broken voltage quirk handling to sdhci_setup_cfg()
If CONFIG_BLK is enabled, add_sdhci() is never called.  Move this
quirk handling to sdhci_setup_cfg(), which is now the central place
for hardware capability checks.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-09-20 06:46:01 +09:00
Masahiro Yamada 6c67954c93 mmc: sdhci: move error message to more relevant place
"Hardware doesn't specify base clock frequency" may not be only the
error case of sdhci_setup_cfg().  It is better to print this where
the corresponding error is triggered.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-09-20 06:46:01 +09:00
Masahiro Yamada 8d549b61dc mmc: sdhci: move sdhci_reset() call to sdhci_init()
If CONFIG_BLK is enabled, add_sdhci() is never called.
So, sdhci_reset() is not called, either.  This is a problem for
my board as it needs the reset to start from a sane state.

Move the add_sdhci() call to sdhci_init(), which is visited
by both of the with/without CONFIG_BLK cases.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-09-20 06:46:01 +09:00
Masahiro Yamada 9b1b6d4225 Revert "Increase default of CONFIG_SYS_MALLOC_F_LEN for SPL_OF_CONTROL"
This reverts commit 90c08d9e08.

I took a closer look at this after the commit was applied, and found
CONFIG_SYS_MALLOC_F_LEN=0x2000 was too much.  8KB memory for SPL is
actually too big for some boards.  Perhaps 0x800 is enough, but the
situation varies board by board.

Let's postpone our decision until we come up with a better idea.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-09-19 15:20:09 -04:00
Tom Rini 00709f5697 A20-OLinuXino-Lime2: Enable USB gadget support
Based on A13-OLinuXino, enable DFU and UMS support.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-09-19 11:37:06 -04:00
Simon Glass 8f224b3734 dtoc: Add methods for reading data from properties
Provide easy helpers for reading integer, string and boolean values from
device-tree properties.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:39 -06:00
Simon Glass 20024daee5 dtoc: Correct quotes in fdt_util
The style is to use single quotes for strings where possible. Adjust this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:39 -06:00
Simon Glass babdbde68f dtoc: Support finding the offset of a property
Add a way to find the byte offset of a property within the device tree. This
is only supported with the normal libfdt implementation since fdtget does
not provide this information.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:39 -06:00
Simon Glass da5f74998b dtoc: Support packing the device tree
After any node/property deletion the device tree can be packed to remove
spare space. Add a way to perform this operation.

Note that for fdt_fallback, fdtput automatically packs the device tree after
deletion, so no action is required here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:39 -06:00
Simon Glass 2a70d897ed dtoc: Support deleting device tree properties
Add support for deleting a device tree property. With the fallback
implementation this uses fdtput. With libfdt it uses the API call and
updates the offsets afterwards.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:39 -06:00
Simon Glass 0170804f60 dtoc: Move to using bytearray
Since we want to be able to change the in-memory device tree using libfdt,
use a bytearray instead of a string. This makes interfacing from Python
easier.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:39 -06:00
Simon Glass 346179f0d3 dtoc: Prepare for supporting changing of device trees
For binman we need to support deleting properties in the device tree. This
will change the offsets of nodes after the deletion. In preparation, add
code to keep track of when the offsets are invalid, and regenerate them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:39 -06:00
Simon Glass 6b93c55f59 dtoc: Drop the convert_dash parameter to GetProps()
This is not used anywhere in dtoc, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:39 -06:00
Simon Glass 355c67c35a dtoc: Allow the device tree to be compiled from source
If a source device tree is provide to the Fdt() constructors, compile it
automatically. This will be used in tests, where we want to build a
particular test .dts file and check that it works correctly in binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:39 -06:00
Simon Glass 0faf6144fd patman: Add a library to handle logging and progress
When tools want to display information of varying levels of importance, it
helps to provide the user with control over the verbosity of these messages.
Progress messages work best if they are displayed and then removed from the
display when no-longer relevant.

Add a new tout library (terminal out) to handle these tasks.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:39 -06:00
Simon Glass 1f1864b408 patman: Add a tools library for using temporary files
For tools which want to use input files and temporary output, it is useful
to have the handling of these dealt with in one place. Add a new library
which allows input files to be read, and output files to be written, all
based on a common directory structure.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:38 -06:00
Simon Glass f7a2aeeeb8 dtoc: Move a few more common functions into fdt.py
Some functions have the same code in the subclasses. Move these into the
superclass to avoid duplication.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:38 -06:00
Simon Glass c322a850af dtoc: Move Widen() and GetPhandle() into the base class
These functions are identical in both subclasses. Move them into the base
class.

Note: In fact there is a bug in one version, which was fixed by this patch:

https://patchwork.ozlabs.org/patch/651697/

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:38 -06:00