platform/kernel/u-boot.git
8 years agorockchip: update fastboot usage
Xu Ziyuan [Mon, 18 Jul 2016 01:56:46 +0000 (09:56 +0800)]
rockchip: update fastboot usage

Introduce how to use fastboot feature on rk3288.

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agomkimage: rockchip: add suport for rk33 serial
Kever Yang [Mon, 18 Jul 2016 01:35:26 +0000 (09:35 +0800)]
mkimage: rockchip: add suport for rk33 serial

Add support for rockchip rk33 series Soc like rk3368 and rk3399

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Use rockchip_get_clk() to obtain the SoC clock
Simon Glass [Sun, 17 Jul 2016 21:23:17 +0000 (15:23 -0600)]
rockchip: Use rockchip_get_clk() to obtain the SoC clock

The current code picks the first available clock. In U-Boot proper this is
the oscillator device, not the SoC clock device. As a result the HDMI display
does not work.

Fix this by calling rockchip_get_clk() instead.

Fixes: 135aa950 (clk: convert API to match reset/mailbox style)
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agorockchip: Add a way to obtain the main clock device
Simon Glass [Sun, 17 Jul 2016 21:23:16 +0000 (15:23 -0600)]
rockchip: Add a way to obtain the main clock device

On Rockchip SoCs we typically have a main clock device that uses the Soc
clock driver. There is also a fixed clock for the oscillator. Add a function
to obtain the core clock.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: core: Add a way to find a device by its driver
Simon Glass [Sun, 17 Jul 2016 21:23:15 +0000 (15:23 -0600)]
dm: core: Add a way to find a device by its driver

Some SoCs have a single clock device. Provide a way to find it given its
driver name. This is handled by the linker so will fail if the name is not
found, avoiding strange errors when names change and do not match. It is
also faster than a string comparison.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: rk3288: fix FREF_MIN_HZ constant
Heiko Stübner [Fri, 15 Jul 2016 22:17:17 +0000 (00:17 +0200)]
rockchip: rk3288: fix FREF_MIN_HZ constant

According to the TRM the minimum FREF frequency is 269kHz not MHz.
Adapt the constant accordingly.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agocosmetic: rockchip: rk3288: rename rkclk_configure_cpu
Heiko Stübner [Fri, 15 Jul 2016 22:17:16 +0000 (00:17 +0200)]
cosmetic: rockchip: rk3288: rename rkclk_configure_cpu

The function is very specific to the rk3288 in its arguments
referencing the rk3288 cru and grf and every other rockchip soc
has differing cru and grf registers. So make that function naming
explicit.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agocosmetic: rockchip: sort socs according to numbers
Heiko Stübner [Fri, 15 Jul 2016 22:17:15 +0000 (00:17 +0200)]
cosmetic: rockchip: sort socs according to numbers

Having some sort of ordering proofed helpful in a lot of other places
already. So for a larger number of rockchip socs it might be helpful
as well instead of an ever increasing unsorted list.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agocosmetic: rockchip: rk3036: pinctrl: fix config symbol naming
Heiko Stübner [Fri, 15 Jul 2016 22:17:14 +0000 (00:17 +0200)]
cosmetic: rockchip: rk3036: pinctrl: fix config symbol naming

Rockchip socs are always named rkxxxx in all places, as also shown
by the naming of the rk3036 pinctrl file itself.
Therefore also name the config symbol according to this scheme.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agocosmetic: rockchip: rk3288: pinctrl: fix config symbol naming
Heiko Stübner [Fri, 15 Jul 2016 22:17:13 +0000 (00:17 +0200)]
cosmetic: rockchip: rk3288: pinctrl: fix config symbol naming

The rk3288 pinctrl is very specific to this soc, so should
not hog the generic rockchip naming.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: rk3288: add fastboot support
Xu Ziyuan [Thu, 14 Jul 2016 16:26:59 +0000 (00:26 +0800)]
rockchip: rk3288: add fastboot support

Enable fastboot feature on rk3288.

This path doesn't support the fastboot flash function command entirely.
We will hit "cannot find partition" assertion without specified
partition environment. Define gpt partition layout in specified board
such as firefly-rk3288, then enjoy it!

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agousb: dwc2 : invalidate dcache before starting DMA
Xu Ziyuan [Thu, 14 Jul 2016 06:52:35 +0000 (14:52 +0800)]
usb: dwc2 : invalidate dcache before starting DMA

Invalidate dcache before starting the DMA to ensure coherency. In case
there are any dirty lines from the DMA buffer in the cache, subsequent
cache-line replacements may corrupt the buffer in memory while the DMA
is still going on. Cache-line replacement can happen if the CPU tries to
bring some other memory locations into the cache while the DMA is going
on.

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agousb: dwc2-otg: adjust fifo size via platform data
Xu Ziyuan [Thu, 14 Jul 2016 06:52:33 +0000 (14:52 +0800)]
usb: dwc2-otg: adjust fifo size via platform data

The total FIFO size of some SoCs may be different from the existen, this
patch supports fifo size setting from platform data.

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agousb: rockchip-phy: implement USB2.0 phy control
Xu Ziyuan [Thu, 14 Jul 2016 06:52:32 +0000 (14:52 +0800)]
usb: rockchip-phy: implement USB2.0 phy control

So far, Rockchip SoCs have two kinds of USB2.0 phy, such as Synopsys and
Innosilicon. This patch applys dwc2 usb driver framework to implement
phy_init() and phy_off() methods for Synopsys phy on Rockchip platform.

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Exclude rk_timer for ARM64
Andreas Färber [Thu, 14 Jul 2016 04:22:09 +0000 (06:22 +0200)]
rockchip: Exclude rk_timer for ARM64

It conflicts with the generic_timer.

Cc: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agomkimage: rockchip: add suport for rk33 serial
Kever Yang [Thu, 14 Jul 2016 03:51:05 +0000 (11:51 +0800)]
mkimage: rockchip: add suport for rk33 serial

Add support for rockchip rk33 series Soc like rk3368 and rk3399

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Clean up CPU selection
Andreas Färber [Thu, 14 Jul 2016 03:09:26 +0000 (05:09 +0200)]
rockchip: Clean up CPU selection

In preparation for RK3368 and RK3399, which need to select ARM64, don't
select CPU_V7 at the ARCH_ROCKCHIP level but at the SoC level instead.

Cc: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoboard: move all the rockchip board in one folder
Kever Yang [Fri, 8 Jul 2016 03:30:58 +0000 (11:30 +0800)]
board: move all the rockchip board in one folder

The 'evb_rk3036' and 'kylin' is not a vendor name, let's replace them
to 'rockchip' which is a real _vendor_ name, and meet the architecure
'board/<vendor>/<board-name>/'.

More boards from rockchip like evb_rk3288, evb_rk3399 will comes later.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Eddie Cai <eddie.cai.kernel@gmail.com>
8 years agorockchip: add basic support for evb-rk3288 board
Xu Ziyuan [Tue, 5 Jul 2016 10:06:30 +0000 (18:06 +0800)]
rockchip: add basic support for evb-rk3288 board

evb-3288 board RK3288-based development board with 2 USB ports, HDMI,
VGA, micro-SD card, audio, WiFi and Gigabit Ethernet. It also includes
on-board 8G eMMC and 2GB of SDRAM. Expansion connector provide access to
display pins, I2C, SPI, UART and GPIOs. This add some basic files
required to allow the board to output serial messaged and can run
command(mmc info etc).

evb-rk3288 also supports booting from eMMC or SD card, the default is eMMC.

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: add option to change method of loading u-boot
Xu Ziyuan [Tue, 12 Jul 2016 11:09:49 +0000 (19:09 +0800)]
rockchip: add option to change method of loading u-boot

If we would like to boot from SD card, we have to implement mmc driver
in SPL stage, and get a slightly large SPL binary. Rockchip SoC's
bootrom code has the ability to load spl and u-boot, then boot.

If CONFIG_ROCKCHIP_SPL_BACK_TO_BROM is enabled, the spl will return to
bootrom in board_init_f(), then bootrom loads u-boot binary.

Loading sequence after rework:
bootrom ==> spl ==> bootrom ==> u-boot

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
Fixed up spelling of U-Boot, boorom, opinion->option, Rochchip:
Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoPrepare v2016.09-rc1 v2016.09-rc1
Tom Rini [Tue, 26 Jul 2016 02:25:52 +0000 (22:25 -0400)]
Prepare v2016.09-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agosandbox: Migrate CONFIG_I2C_EEPROM
Tom Rini [Mon, 25 Jul 2016 22:18:15 +0000 (18:18 -0400)]
sandbox: Migrate CONFIG_I2C_EEPROM

Most users of CONFIG_I2C_EEPROM were migrated to defconfig a while ago,
but sandbox was skipped.  Leave it off for sandbox_spl where it does not
build, but does not need to be either.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoMerge git://git.denx.de/u-boot-nand-flash
Tom Rini [Mon, 25 Jul 2016 18:49:54 +0000 (14:49 -0400)]
Merge git://git.denx.de/u-boot-nand-flash

8 years agoarm64: thunderx_88xx_defconfig: remove unneeded CONFIG_SYS_EXTRA_OPTIONS
Masahiro Yamada [Mon, 25 Jul 2016 13:06:08 +0000 (22:06 +0900)]
arm64: thunderx_88xx_defconfig: remove unneeded CONFIG_SYS_EXTRA_OPTIONS

ARM64 is correctly select'ed in arch/arm/Kconfig, so this line in
the defconfig is unneeded.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agodtoc: Correct the type widening code in fdt_fallback
Simon Glass [Fri, 22 Jul 2016 15:22:49 +0000 (09:22 -0600)]
dtoc: Correct the type widening code in fdt_fallback

This code does not match the fdt version in fdt.py. When dtoc is unable to
use the Python libfdt library, it uses the fallback version, which does not
widen arrays correctly.

Fix this to avoid a warning 'excess elements in array initialize' in
dt-platdata.c which happens on some platforms.

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com>
8 years agohashtable: Fix compiler warning on 32-bit sandbox
Simon Glass [Fri, 22 Jul 2016 15:22:48 +0000 (09:22 -0600)]
hashtable: Fix compiler warning on 32-bit sandbox

This fixes a mismatch between the %zu format and the type used on sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agopart_efi: Fix compiler warning on 32-bit sandbox
Simon Glass [Fri, 22 Jul 2016 15:22:47 +0000 (09:22 -0600)]
part_efi: Fix compiler warning on 32-bit sandbox

This fixes a mismatch between the %zu format and the type used on sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agolzmadec: Use the same type as the lzma call
Simon Glass [Fri, 22 Jul 2016 15:22:46 +0000 (09:22 -0600)]
lzmadec: Use the same type as the lzma call

With sandbox on 32-bit the size_t type can be a little inconsistent. Use
the same type as the caller expects to avoid a compiler warning.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agosandbox: Add instructions about building on 32-bit machines
Simon Glass [Fri, 22 Jul 2016 15:22:45 +0000 (09:22 -0600)]
sandbox: Add instructions about building on 32-bit machines

Sandbox is built with 64-bit ints by default. This doesn't work properly on
32-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agotools, rsa: Further minor cleanups on top of c236ebd and 2b9ec7
mario.six@gdsys.cc [Fri, 22 Jul 2016 06:58:40 +0000 (08:58 +0200)]
tools, rsa: Further minor cleanups on top of c236ebd and 2b9ec7

[NOTE: I took v1 of these patches in, and then v2 came out, this commit
is squashing the minor deltas from v1 -> v2 of updates to c236ebd and
2b9ec76 into this commit - trini]

- Added an additional NULL check, as suggested by Simon Glass to
  fit_image_process_sig
- Re-formatted the comment blocks

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
[For merging the chnages from v2 back onto v1]
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoARM: am33xx: Always inhibit init/refresh during DDR phy init
Russ Dill [Thu, 21 Jul 2016 11:28:32 +0000 (04:28 -0700)]
ARM: am33xx: Always inhibit init/refresh during DDR phy init

A couple of commits have modified the am33xx/am437x ddr2/ddr3
initialization path to fix certain issues, but have had the side effect
of causing L3 noc errors during initialization. The two commits are:

69b918 "am33xx,ddr3: fix ddr3 sdram configuration"
fc46ba "arm: am437x: Enable hardware leveling for EMIF"

The EMIF_REG_INITREF_DIS_MASK bit still needs to be set for all
platforms. This delays initialization and refresh until a later stage.
The 500us timer can be programmed for platforms that require it
and for platforms that don't require it. It is currently hardcoded
for 400MHz systems. For systems with a higher memory frequency
this needs to be a larger value, and for systems with a lower
memory frequency this can be a lower value. This can be
considered a separate issue and corrected in a later commit.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoARM: am33xx: Fix DDR init delay placement
Russ Dill [Thu, 21 Jul 2016 11:28:31 +0000 (04:28 -0700)]
ARM: am33xx: Fix DDR init delay placement

The delay needs to be before the write to ref_ctrl register
which initiates refreshes. An improper initialization sequence
generates an L3 noc error.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoefi_loader: Make exposed image loader path absolute
Alexander Graf [Wed, 20 Jul 2016 23:44:46 +0000 (01:44 +0200)]
efi_loader: Make exposed image loader path absolute

When loading an efi image, we pass it the location it was loaded from.

On file system backends, there are no relative paths, so we should always
pass in absolute ones. For network paths, we may be relative.

This fixes distro booting with grub2 for me when it fetches the grub2 config
file from the loader partition.

Reported-by: york sun <york.sun@nxp.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agocommon: fit: Allow U-Boot images to be booted
mario.six@gdsys.cc [Wed, 20 Jul 2016 06:32:50 +0000 (08:32 +0200)]
common: fit: Allow U-Boot images to be booted

In certain circumstances it comes in handy to be able to boot into a second
U-Boot. But as of now it is not possible to boot a U-Boot binary that is inside
a FIT image, which is problematic for projects that e.g. need to guarantee a
unbroken chain of trust from SOC all the way into the OS, since the FIT signing
mechanism cannot be used.

This patch adds the capability to load such FIT images.

An example .its snippet (utilizing signature verification) might look
like the following:

images {
firmware@1 {
description = "2nd stage U-Boot image";
data = /incbin/("u-boot-dtb.img.gz");
type = "firmware";
arch = "arm";
os = "u-boot";
compression = "gzip";
load = <0x8FFFC0>;
entry = <0x900000>;
signature@1 {
algo = "sha256,rsa4096";
key-name-hint = "key";
};
};
};

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agokeystone: k2h/e/l: Fix DMA coherency for QM PDSP
Karicheri, Muralidharan [Tue, 19 Jul 2016 18:39:14 +0000 (14:39 -0400)]
keystone: k2h/e/l: Fix DMA coherency for QM PDSP

commit 1f807a9f32aa ("ARM: keystone2: Refactor MSMC macros to avoid
left under a macro KS2_MSMC_SEGMENT_QM_PDSP which is no longer valid.
This, in effect disabled DMA coherency for QM PDSP.

Given that msmc_k2hkle_common_setup is valid for all K2H/K/L/E SoCs,
the #ifdef should been removed in the first place. Do the same.

Fixes: 1f807a9f32aa ("ARM: keystone2: Refactor MSMC macros to avoid #ifdeffery")
Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agocmd: misc: Add support for fractions in sleep
mario.six@gdsys.cc [Tue, 19 Jul 2016 14:20:13 +0000 (16:20 +0200)]
cmd: misc: Add support for fractions in sleep

A feasible way to communicate certain errors for devices that have no
other way of signalling besides LEDs is to flash these LEDs. For errors
in U-Boot, a script that utilizes the led and sleep commands would be a
practicable way, but currently the sleep command can only delay for an
integral amount of seconds, which is too slow to create an easily
noticeable pattern for flashing LEDs.

Therefore, this patch adds support for fractions (down to .001 seconds)
to the sleep command.

The parsing is kept minimal, simplistic and as robust as possible: After
converting the passed string using simple_strtoul and multiplying it
with 1000, we search for the first dot, convert the three characters
after that into a number (if they are not numbers, we ignore the
fractional part and just use the delay we got from simple_strtoul), and
add this number to the delay.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
8 years agomtd: fix compiler warnings
Steve Rae [Wed, 29 Jun 2016 20:50:59 +0000 (13:50 -0700)]
mtd: fix compiler warnings

- add missing declaration
- update debug output format specifiers

Signed-off-by: Steve Rae <steve.rae@raedomain.com>
8 years agomtd: nand: fix bug writing 1 byte less than page size
Hector Palacios [Mon, 18 Jul 2016 07:37:41 +0000 (09:37 +0200)]
mtd: nand: fix bug writing 1 byte less than page size

nand_do_write_ops() determines if it is writing a partial page with the
formula:
part_pagewr = (column || writelen < (mtd->writesize - 1))

When 'writelen' is exactly 1 byte less than the NAND page size the formula
equates to zero, so the code doesn't process it as a partial write, although
it should.
As a consequence the function remains in the while(1) loop with 'writelen'
becoming 0xffffffff and iterating until the watchdog timeout triggers.

To reproduce the issue on a NAND with 2K page (0x800):
=> nand erase.part <partition>
=> nand write $loadaddr <partition> 7ff

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
8 years agosunxi: Enable NAND controller on the CHIP
Boris Brezillon [Wed, 15 Jun 2016 19:09:28 +0000 (21:09 +0200)]
sunxi: Enable NAND controller on the CHIP

Enable the NAND controller in the sun5i-r8-chip.dts.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
8 years agosunxi: nand: Increase CONFIG_SYS_NAND_MAX_ECCPOS value
Boris Brezillon [Wed, 15 Jun 2016 19:09:27 +0000 (21:09 +0200)]
sunxi: nand: Increase CONFIG_SYS_NAND_MAX_ECCPOS value

On some sunxi boards we have NANDs exposing 1664 OOB bytes per page.
Define the CONFIG_SYS_NAND_MAX_ECCPOS value accordingly.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: Increase the max OOB size
Boris Brezillon [Wed, 15 Jun 2016 19:09:26 +0000 (21:09 +0200)]
mtd: nand: Increase the max OOB size

Some NANDs are now exposing 1664 OOB bytes per page. Adjust the
NAND_MAX_OOBSIZE value accordingly.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: Add a full-id entry for the H27QCG8T2E5R‐BCF NAND
Boris Brezillon [Wed, 15 Jun 2016 19:09:25 +0000 (21:09 +0200)]
mtd: nand: Add a full-id entry for the H27QCG8T2E5R‐BCF NAND

Add a full-id entry for the H27QCG8T2E5R‐BCF NAND.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
8 years agosun5i: Add NAND controller to the sun5i DTSI
Maxime Ripard [Wed, 15 Jun 2016 19:09:24 +0000 (21:09 +0200)]
sun5i: Add NAND controller to the sun5i DTSI

Add the NAND controller definition to sun5i.dtsi.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: Add the sunxi NAND controller driver
Boris Brezillon [Wed, 15 Jun 2016 19:09:23 +0000 (21:09 +0200)]
mtd: nand: Add the sunxi NAND controller driver

We already have an SPL driver for the sunxi NAND controller, now add
the normal/standard one.

The source has been copied from Linux 4.6 with a few changes to make
it work in u-boot.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
8 years agomtd: nand: add common DT init code
Brian Norris [Wed, 15 Jun 2016 19:09:22 +0000 (21:09 +0200)]
mtd: nand: add common DT init code

These are already-documented common bindings for NAND chips. Let's
handle them in nand_base.

If NAND controller drivers need to act on this data before bringing up
the NAND chip (e.g., fill out ECC callback functions, change HW modes,
etc.), then they can do so between calling nand_scan_ident() and
nand_scan_tail().

The original commit has been slightly reworked to use the fdtdec_xxx()
helpers (instead of the of_xxxx() ones).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
8 years agosunxi: Add missing macros to configure the NAND controller clk
Boris Brezillon [Wed, 15 Jun 2016 19:09:21 +0000 (21:09 +0200)]
sunxi: Add missing macros to configure the NAND controller clk

We need some macros to manipulate the NAND controller clock.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
8 years agocmd, nand: add an option to disable the verification when writing in raw mode
Boris Brezillon [Wed, 15 Jun 2016 08:42:18 +0000 (10:42 +0200)]
cmd, nand: add an option to disable the verification when writing in raw mode

Modern NANDs do not guarantee that data written in raw mode will not
contain bitflips just after writing them. This is fine since the number
of bitflips should be rather low and thus fixable by the ECC engine,
but since we are reading data in raw mode to verify if they match the
input data we cannot prevent failures if some bits are flipped.

The option of using standard mode to verify the data is not acceptable
either, since one of the usage of raw mode is to allow flashing images
that do not respect the standard NAND page layout or the default ECC
config (this is the case on Allwinner platforms, where the ROM code
tests several hardcoded configs, which are not necessarily matching the
NAND characteristics).

Add an extension to the nand write.raw command allowing one to disable
the verification step.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoARM: uniphier: add clock/reset settings for xHCI of ProXstream2
Masahiro Yamada [Fri, 22 Jul 2016 11:20:11 +0000 (20:20 +0900)]
ARM: uniphier: add clock/reset settings for xHCI of ProXstream2

Deassert resets and enable clock signals of xHCI blocks if the
corresponding CONFIG is enabled.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoARM: uniphier: add PH1-LD21 board data
Masahiro Yamada [Fri, 22 Jul 2016 04:38:33 +0000 (13:38 +0900)]
ARM: uniphier: add PH1-LD21 board data

This has the same silicon die as PH1-LD20, but includes DRAM chips
in its package.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoARM: uniphier: introduce flags to uniphier_board_data structure
Masahiro Yamada [Fri, 22 Jul 2016 04:38:32 +0000 (13:38 +0900)]
ARM: uniphier: introduce flags to uniphier_board_data structure

I need to add more board attributes, so the "flags" member will be
handier than separate boolean ones.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoARM: uniphier: rename outer-cache register macros
Masahiro Yamada [Fri, 22 Jul 2016 04:38:31 +0000 (13:38 +0900)]
ARM: uniphier: rename outer-cache register macros

Sync register macros with Linux code.  This will be helpful to
develop the counterpart of Linux.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoARM: uniphier: clear notification flag before L2 operation
Masahiro Yamada [Fri, 22 Jul 2016 04:38:30 +0000 (13:38 +0900)]
ARM: uniphier: clear notification flag before L2 operation

Clear the flag immediately before cache operation to not depend on
the previous state.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoARM: uniphier: use (devm_)ioremap() instead of map_sysmem()
Masahiro Yamada [Tue, 19 Jul 2016 12:56:13 +0000 (21:56 +0900)]
ARM: uniphier: use (devm_)ioremap() instead of map_sysmem()

This does not have much impact on behavior, but makes code look more
more like Linux.  The use of devm_ioremap() often helps to delete
.remove callbacks entirely.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoARM: uniphier: fix doubled tftpboot commands
Masahiro Yamada [Tue, 19 Jul 2016 02:36:53 +0000 (11:36 +0900)]
ARM: uniphier: fix doubled tftpboot commands

This downloads the same file twice for nothing.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoARM: uniphier: select CONFIG_ARMV8_SPIN_TABLE
Masahiro Yamada [Sat, 16 Jul 2016 16:38:21 +0000 (01:38 +0900)]
ARM: uniphier: select CONFIG_ARMV8_SPIN_TABLE

This is needed when booting Linux without ARM Trusted Firmware.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoARM: dts: uniphier: renumber serial aliases for Gentil/Vodka boards
Masahiro Yamada [Wed, 6 Jul 2016 10:24:09 +0000 (19:24 +0900)]
ARM: dts: uniphier: renumber serial aliases for Gentil/Vodka boards

On these two boards, the serial0 is used for inter-chip connection,
so cannot be used for login console.  The serial2 is used instead
for them, but it is tedious to use because upper level deployment
projects must switch login console per board.

[ Linux commit: 2a4a2aadbaad9dffdb564a2895348f3d8e825416 ]

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
8 years agotest/py: vboot can be run only at Sandbox
Michal Simek [Mon, 18 Jul 2016 06:49:08 +0000 (08:49 +0200)]
test/py: vboot can be run only at Sandbox

Getting this error:
Zynq> sb load hostfs - 100
/home/monstr/data/disk/u-boot/build-zynq_zc706/test.fit
Unknown command 'sb' - try 'help'

because sb command is present only for Sandbox
obj-$(CONFIG_SANDBOX) += host.o

that's why mark this test to be run only at Sandbox

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoarm: omap5: fix build dependency for secure devices
Andreas Dannenberg [Wed, 20 Jul 2016 18:55:59 +0000 (13:55 -0500)]
arm: omap5: fix build dependency for secure devices

Commit 17c2987 introduces an undesired dependency on CONFIG_SPL_LOAD_FIT
when building U-Boot for AM57xx and DRA7xx high-security (HS) devices that
causes the build to break when that option is not active. Fix this issue
by only building the u-boot_HS.img target when building U-Boot into an
actual FIT image.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoarm: am4x: fix build dependency for secure devices
Andreas Dannenberg [Wed, 20 Jul 2016 18:55:58 +0000 (13:55 -0500)]
arm: am4x: fix build dependency for secure devices

Commit e29878f introduces an undesired dependency on CONFIG_SPL_LOAD_FIT
when building U-Boot for AM43xx high-security (HS) devices that causes the
build to break when that option is not active. Fix this issue by only
building the u-boot_HS.img target when building U-Boot into an actual
FIT image.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agofixing typo error in README file. CPU15 -> CP15
yeongjun Kim [Wed, 20 Jul 2016 13:56:12 +0000 (22:56 +0900)]
fixing typo error in README file. CPU15 -> CP15

It looks typo error.
Not CPU15, CP15(CoProcessor15)

Signed-off-by: yeongjun Kim <iam.yeongjunkim@gmail.com>
8 years agospl: fit: Fix the number of bytes read in raw mode
Lokesh Vutla [Tue, 19 Jul 2016 09:26:14 +0000 (14:56 +0530)]
spl: fit: Fix the number of bytes read in raw mode

In raw mode a full sector is to be read even if image covers part of
a sector. Number of sectors are calculated as ROUND_UP(size)/sec_size by FIT
framework. This calculation assumes that image is at the 0th offset of a sector,
which is not true always in FIT case. So, include the image offset while
calculating number of sectors.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agorsa: Fix return value and masked error
mario.six@gdsys.cc [Tue, 19 Jul 2016 09:07:07 +0000 (11:07 +0200)]
rsa: Fix return value and masked error

When signing images, we repeatedly call fit_add_file_data() with
successively increasing size values to include the keys in the DTB.

Unfortunately, if large keys are used (such as 4096 bit RSA keys), this
process fails sometimes, and mkimage needs to be called repeatedly to
integrate the keys into the DTB.

This is because fit_add_file_data actually returns the wrong error
code, and the loop terminates prematurely, instead of trying again with
a larger size value.

This patch corrects the return value by fixing the return value of
fdt_add_bignum, fixes a case where an error is masked by a unconditional
setting of a return value variable, and also removes a error message,
which is misleading, since we actually allow the function to fail. A
(hopefully helpful) comment is also added to explain the lack of error
message.

This is probably related to 1152a05 ("tools: Correct error handling in
fit_image_process_hash()") and the corresponding error reported here:

https://www.mail-archive.com/u-boot@lists.denx.de/msg217417.html

Signed-off-by: Mario Six <mario.six@gdsys.cc>
8 years agotools: Fix return code of fit_image_process_sig()
mario.six@gdsys.cc [Tue, 19 Jul 2016 09:07:06 +0000 (11:07 +0200)]
tools: Fix return code of fit_image_process_sig()

When signing images, we repeatedly call fit_add_file_data() with
successively increasing size values to include the keys in the DTB.

Unfortunately, if large keys are used (such as 4096 bit RSA keys), this
process fails sometimes, and mkimage needs to be called repeatedly to
integrate the keys into the DTB.

This is because fit_add_file_data actually returns the wrong error
code, and the loop terminates prematurely, instead of trying again with
a larger size value.

This patch corrects the return value and also removes a error message,
which is misleading, since we actually allow the function to fail. A
(hopefully helpful) comment is also added to explain the lack of error
message.

This is probably related to 1152a05 ("tools: Correct error handling in
fit_image_process_hash()") and the corresponding error reported here:

https://www.mail-archive.com/u-boot@lists.denx.de/msg217417.html

Signed-off-by: Mario Six <mario.six@gdsys.cc>
8 years agotest/py: use absolute dts path in vboot test
Stephen Warren [Mon, 18 Jul 2016 16:07:25 +0000 (10:07 -0600)]
test/py: use absolute dts path in vboot test

Without this, the test fails if the test is run with a cwd other than the
root of the U-Boot source tree.

Fixes: 8729d582595d ("test: Convert the vboot test to test/py")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoarmv8: spl: Call board_init_r from crt0_64 in SPL
Jeremy Hunt [Mon, 18 Jul 2016 16:01:02 +0000 (12:01 -0400)]
armv8: spl: Call board_init_r from crt0_64 in SPL

As part of the startup process for boards using the SPL, the
meaning of board_init_f changed such that it should return normally
rather than calling board_init_r directly. (see
db910353a126d84fe8dff7a694ea792f50fcfb6a )
This was fixed in 32-bit arm, but broke when SPL was added to
64 bit arm. This fixes crt0_64 so that it calls board_init_r
during the SPL and removes the direct call from board_init_f
from the arm SPL example.

Signed-off-by: Jeremy Hunt <Jeremy.Hunt@DEShawResearch.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoefi_loader: Add debug output for efi_add_memory_map()
Andreas Färber [Sun, 17 Jul 2016 04:57:11 +0000 (06:57 +0200)]
efi_loader: Add debug output for efi_add_memory_map()

Tracing the arguments has been helpful for pinpointing overflows.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
8 years agotools/env: reuse fw_getenv in fw_printenv function
Andreas Fenkart [Sat, 16 Jul 2016 15:06:15 +0000 (17:06 +0200)]
tools/env: reuse fw_getenv in fw_printenv function

Try to avoid adhoc iteration of the environment. Reuse fw_getenv
to find the variables that should be printed. Only use open-coded
iteration when printing all variables.
For backwards compatibility, keep emitting a newline when
printing with value_only.

Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
8 years agotools/env: move envmatch further up in file to avoid forward declarations
Andreas Fenkart [Sat, 16 Jul 2016 15:06:14 +0000 (17:06 +0200)]
tools/env: move envmatch further up in file to avoid forward declarations

forward declaration not needed when re-ordered

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
8 years agotools/env: kernel-doc for fw_printenv, fw_getenv and fw_parse_script
Andreas Fenkart [Sat, 16 Jul 2016 15:06:13 +0000 (17:06 +0200)]
tools/env: kernel-doc for fw_printenv, fw_getenv and fw_parse_script

there are two groups of functions:
- application ready tools: fw_setenv/fw_getenv/fw_parse_script
these are used, when creating a single binary containing multiple
tools (busybox like)
- file access like: open/read/write/close
above functions are implemented on top of these. applications
can use those to modify several variables without creating a
temporary batch script file
tested with "./scripts/kernel-doc -html -v tools/env/fw_env.h"

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
8 years agogdsys: Drop print_fpga_state function
Tom Rini [Fri, 15 Jul 2016 19:51:40 +0000 (15:51 -0400)]
gdsys: Drop print_fpga_state function

On most platforms the print_fpga_state function is never called.  Only
on dlvision-10g do we, so in that case inline it.  Drop it from
everywhere else to avoid extra strings.

Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Reinhard Pfau <reinhard.pfau@gdsys.cc>
Acked-by: Dirk Eibach <dirk.eibach@gdsys.cc>
8 years agotools/env: allow negative offsets
Stefan Agner [Thu, 14 Jul 2016 00:14:38 +0000 (17:14 -0700)]
tools/env: allow negative offsets

A negative value for the offset is treated as a backwards offset for
from the end of the device/partition for block devices. This aligns
the behavior of the config file with the syntax of CONFIG_ENV_OFFSET
where the functionality has been introduced with
commit 5c088ee841f9 ("env_mmc: allow negative CONFIG_ENV_OFFSET").

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
8 years agotools/env: complete environment device config early
Stefan Agner [Thu, 14 Jul 2016 00:14:37 +0000 (17:14 -0700)]
tools/env: complete environment device config early

Currently flash_read completes a crucial part of the environment
device configuration, the device type (mtd_type). This is rather
confusing as flash_io calls flash_read conditionally, and one might
think flash_write, which also makes use of mtd_type, gets called
before flash_read. But since flash_io is always called with O_RDONLY
first, this is not actually the case in reality.

However, it is much cleaner to complete and verify the config early
in parse_config. This also prepares the code for further extension.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Reviewed-by: Andreas Fenkart
8 years agoiso: Fix part info command
Alexander Graf [Wed, 20 Jul 2016 23:31:56 +0000 (01:31 +0200)]
iso: Fix part info command

Partitions on the iso el torito partition table interpreter
only start from partition 1. So when printing out the tables,
let's also start counting at 1.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoigep00x0: Falcon mode
Ladislav Michl [Tue, 12 Jul 2016 18:28:34 +0000 (20:28 +0200)]
igep00x0: Falcon mode

Implement spl_start_uboot to let Falcon mode work.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
8 years agoigep00x0: generate default mtdparts according NAND chip used
Ladislav Michl [Tue, 12 Jul 2016 18:28:33 +0000 (20:28 +0200)]
igep00x0: generate default mtdparts according NAND chip used

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agoigep00x0: UBIize
Ladislav Michl [Tue, 12 Jul 2016 18:28:32 +0000 (20:28 +0200)]
igep00x0: UBIize

Convert IGEP board to use UBI volumes for U-Boot, its environment and
kernel. With exception of first four sectors read by SoC boot
ROM whole (One)NAND is UBI managed.
Also merge NAND and OneNAND defconfigs as now one binary can serve
both flashes.
As code is too big now, drop CONFIG_SPL_EXT_SUPPORT to make it fit.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
8 years agoigep00x0: runtime flash detection
Ladislav Michl [Tue, 12 Jul 2016 18:28:31 +0000 (20:28 +0200)]
igep00x0: runtime flash detection

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agoigep00x0: remove unused empty function omap_rev_string()
Ladislav Michl [Tue, 12 Jul 2016 18:28:30 +0000 (20:28 +0200)]
igep00x0: remove unused empty function omap_rev_string()

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agoigep00x0: remove useless setup_net_chip declaration
Ladislav Michl [Tue, 12 Jul 2016 18:28:29 +0000 (20:28 +0200)]
igep00x0: remove useless setup_net_chip declaration

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agoigep00x0: reorder lan9221 code to remove ifdefs
Ladislav Michl [Tue, 12 Jul 2016 18:28:28 +0000 (20:28 +0200)]
igep00x0: reorder lan9221 code to remove ifdefs

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agoigep00x0: move sysinfo into C file
Ladislav Michl [Tue, 12 Jul 2016 18:28:27 +0000 (20:28 +0200)]
igep00x0: move sysinfo into C file

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agocmd: mtdparts: support runtime generated mtdparts
Ladislav Michl [Tue, 12 Jul 2016 18:28:26 +0000 (20:28 +0200)]
cmd: mtdparts: support runtime generated mtdparts

Some CPUs contains boot ROM code capable reading first few blocks
(where SPL resides) of NAND flash and executing it. It is wise to
create separate partition here for SPL. As block size depends on
NAND chip used, we could either use worst case (biggest) partition
size or base its size on actual block size. This patch adds support
for the latter option.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agocmd: mtdparts: use defaults by default
Ladislav Michl [Tue, 12 Jul 2016 18:28:25 +0000 (20:28 +0200)]
cmd: mtdparts: use defaults by default

Boards which are defining default mtdparts often need them early
in boot process (to load environment from UBI volume, for example).
This is currently solved by adding mtdparts and mtdids variable
definitions also to default environment. With this change, default
partitions are used by default unless explicitely deleted or
redefined.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agocmd: mtdparts: consolidate mtdparts reading from env
Ladislav Michl [Tue, 12 Jul 2016 18:28:24 +0000 (20:28 +0200)]
cmd: mtdparts: consolidate mtdparts reading from env

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agocmd: mtdparts: fix null pointer dereference in parse_mtdparts
Ladislav Michl [Tue, 12 Jul 2016 18:28:23 +0000 (20:28 +0200)]
cmd: mtdparts: fix null pointer dereference in parse_mtdparts

In case there is no mtdparts variable in relocated environment,
NULL is assigned to p, which is later fed to strncpy.
Also function parameter mtdparts is completely ignored, so use it
in case mtdparts variable is not found in environment. This
parameter is checked not to be NULL in caller.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agocmd: mtdparts: fix mtdparts variable presence confusion in mtdparts_init
Ladislav Michl [Tue, 12 Jul 2016 18:28:22 +0000 (20:28 +0200)]
cmd: mtdparts: fix mtdparts variable presence confusion in mtdparts_init

A private buffer is used to read mtdparts variable from non-relocated
environment. A pointer to that buffer is returned unconditionally,
confusing later test for variable presence in the environment.
Fix it by returning NULL when getenv_f fails.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agomtd: OneNAND: initialize mtd->writebufsize to let UBI work
Ladislav Michl [Tue, 12 Jul 2016 18:28:21 +0000 (20:28 +0200)]
mtd: OneNAND: initialize mtd->writebufsize to let UBI work

io_init checks this value and fails with "bad write buffer size 0 for
2048 min. I/O unit"

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agomtd: OneNAND: allow board init function fail
Ladislav Michl [Tue, 12 Jul 2016 18:28:20 +0000 (20:28 +0200)]
mtd: OneNAND: allow board init function fail

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agomtd: OneNAND: add timeout to wait ready loops
Ladislav Michl [Tue, 12 Jul 2016 18:28:19 +0000 (20:28 +0200)]
mtd: OneNAND: add timeout to wait ready loops

Add timeout to onenand_wait ready loop as it hangs here indefinitely
when chip not present. Once there, do the same for onenand_bbt_wait
as well (note: recent Linux driver code does the same)

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agoarmv7: simplify identify_nand_chip
Ladislav Michl [Tue, 12 Jul 2016 18:28:18 +0000 (20:28 +0200)]
armv7: simplify identify_nand_chip

Use newly introduced function

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agoarmv7: armv7: introduce set_gpmc_cs0
Ladislav Michl [Tue, 12 Jul 2016 18:28:17 +0000 (20:28 +0200)]
armv7: armv7: introduce set_gpmc_cs0

Allow boards to runtime detect flash type.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agoarmv7: make gpmc_cfg const
Ladislav Michl [Tue, 12 Jul 2016 18:28:16 +0000 (20:28 +0200)]
armv7: make gpmc_cfg const

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
[trini: Adapt am33xx, duovero, omap_zoom1]
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoarmv7: add reset timeout to identify_nand_chip
Ladislav Michl [Tue, 12 Jul 2016 18:28:15 +0000 (20:28 +0200)]
armv7: add reset timeout to identify_nand_chip

identify_nand_chip hangs forever in loop when NAND is not present.
As IGEPv2 comes either with NAND or OneNAND flash, add reset timeout
to let function fail gracefully allowing caller to know NAND is
not present. On NAND equipped board, reset succeeds on first read,
so 1000 loops seems to be safe timeout.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agospl: zImage support in Falcon mode
Ladislav Michl [Tue, 12 Jul 2016 18:28:14 +0000 (20:28 +0200)]
spl: zImage support in Falcon mode

Other payload than uImage is currently considered to be raw U-Boot
image. Check also for zImage in Falcon mode.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
8 years agospl: support loading from UBI volumes
Ladislav Michl [Tue, 12 Jul 2016 18:28:13 +0000 (20:28 +0200)]
spl: support loading from UBI volumes

Add support for loading from UBI volumes on the top of NAND
and OneNAND.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
8 years agospl: Lightweight UBI and UBI fastmap support
Thomas Gleixner [Tue, 12 Jul 2016 18:28:12 +0000 (20:28 +0200)]
spl: Lightweight UBI and UBI fastmap support

Booting a payload out of NAND FLASH from the SPL is a crux today, as
it requires hard partioned FLASH. Not a brilliant idea with the
reliability of todays NAND FLASH chips.

The upstream UBI + UBI fastmap implementation which is about to
brought to u-boot is too heavy weight for SPLs as it provides way more
functionality than needed for a SPL and does not even fit into the
restricted SPL areas which are loaded from the SoC boot ROM.

So this provides a fast and lightweight implementation of UBI scanning
and UBI fastmap attach. The scan and logical to physical block mapping
code is developed from scratch, while the fastmap implementation is
lifted from the linux kernel source and stripped down to fit the SPL
needs.

The text foot print on the board which I used for development is:

6854 0 0 6854 1abd
drivers/mtd/ubispl/built-in.o

Attaching a NAND chip with 4096 physical eraseblocks (4 blocks are
reserved for the SPL) takes:

In full scan mode:      1172ms
In fastmap mode:          95ms

The code requires quite some storage. The largest and unknown part of
it is the number of fastmap blocks to read. Therefor the data
structure is not put into the BSS. The code requires a pointer to free
memory handed in which is initialized by the UBI attach code itself.

See doc/README.ubispl for further information on how to use it.

This shares the ubi-media.h and crc32 implementation of drivers/mtd/ubi
There is no way to share the fastmap code, as UBISPL only utilizes the
slightly modified functions ubi_attach_fastmap() and ubi_scan_fastmap()
from the original kernel ubi fastmap implementation.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Acked-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoonenand_spl_simple: Add a simple OneNAND read function
Ladislav Michl [Tue, 12 Jul 2016 18:28:11 +0000 (20:28 +0200)]
onenand_spl_simple: Add a simple OneNAND read function

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
8 years agonand_spl_simple: Add a simple NAND read function
Thomas Gleixner [Tue, 12 Jul 2016 18:28:10 +0000 (20:28 +0200)]
nand_spl_simple: Add a simple NAND read function

To support UBI in SPL we need a simple NAND read function. Add one to
nand_spl_simple and keep it as simple as it goes.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Acked-by: Scott Wood <oss@buserror.net>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
8 years agomtd: Sort subsystem directories aplhabeticaly in Makefile
Ladislav Michl [Tue, 12 Jul 2016 18:28:09 +0000 (20:28 +0200)]
mtd: Sort subsystem directories aplhabeticaly in Makefile

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
8 years agoi2c_eeprom: Add reading support
mario.six@gdsys.cc [Wed, 22 Jun 2016 13:14:16 +0000 (15:14 +0200)]
i2c_eeprom: Add reading support

This patch implements the reading functionality for the generic I2C
EEPROM driver, which was just a non-functional stub until now.

Since the page size will be of importance for the writing support, we
add suitable members to the private data structure to keep track of it.

Compatibility strings for a range of at24c* chips are added.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>