Commit Graph

151 Commits

Author SHA1 Message Date
Kever Yang
c2fdd34569 cmd: gpt: fix the wrong size parse for the last partition
The calculation of "dev_desc->lba - 34  - 1 - offset" is not correct for
size '-', because both fist_usable_lba and last_usable_lba will remain
34 sectors.

We can simply use 0 for size '-' because the part_efi module will decode
the size and auto extend the size to maximum available size.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2016-08-05 20:55:16 -04:00
Max Filippov
e379508435 cmd/bdinfo: extract print_std_bdinfo
print_std_bdinfo outputs typical set of board information entries:
boot params location, memory and flash addresses and sizes, network
interfaces information and configured serial baud rate.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-08-05 07:27:28 -04:00
Max Filippov
4e3fa7d8a1 cmd/bdinfo: extract print_baudrate
print_baudrate outputs serial baud rate.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-08-05 07:27:28 -04:00
Max Filippov
8752e260c4 cmd/bdinfo: extract print_eth_ip_addr
print_eth_ip_addr outputs eth configurations for up to 6 interfaces and
configured IP address.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-08-05 07:27:27 -04:00
Max Filippov
f80e535980 cmd/bdinfo: extract print_bi_flash
print_bi_flash outputs flashstart, flashsize and flashoffset lines.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-08-05 07:27:26 -04:00
Max Filippov
fd60e99f55 cmd/bdinfo: extract print_bi_dram
print_bi_dram outputs start address and size for each DRAM bank.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-08-05 07:27:26 -04:00
Max Filippov
12feb3647e cmd/bdinfo: extract print_bi_mem
print_bi_mem outputs memstart and memsize lines.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-08-05 07:27:26 -04:00
Max Filippov
171e53968c cmd/bdinfo: extract print_bi_boot_params
print_bi_boot_params outputs boot parameters structure location.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-08-05 07:27:25 -04:00
Sumit Garg
7fe1d6a410 crypto/fsl: Update blob cmd to accept 64bit addresses
Update blob cmd to accept 64bit source, key modifier and destination
addresses. Also correct output result print format for fsl specific
implementation of blob cmd.

Signed-off-by: Sumit Garg <sumit.garg@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
2016-08-02 09:45:39 -07:00
Simon Glass
c9f3c5f9c3 dm: usb: Use blk_dread/write() instead of direct calls
Update the USB mass storage code to allow it to work with driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-27 14:15:54 -06:00
Simon Glass
7f7ddf2a88 arm: Show early-malloc() usage in bdinfo
This is useful information to show how close we are to the limit. At present
it is only available by enabling DEBUG in board_r.c.

Make it available with the 'bdinfo' command also.

Note that this affects ARM only. The bdinfo command is different for each
architecture. Rather than duplicating the code it would be better to
refactor it (as was done with global_data).

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-27 14:15:54 -06:00
Tom Rini
fd42e1b589 Merge git://git.denx.de/u-boot-nand-flash 2016-07-25 14:49:54 -04:00
Simon Glass
1bb718cdab 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>
2016-07-25 12:05:54 -04:00
Alexander Graf
492716662f 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>
2016-07-25 12:00:06 -04:00
mario.six@gdsys.cc
c4974632e2 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>
2016-07-25 12:00:05 -04:00
Steve Rae
59441ac3c1 mtd: fix compiler warnings
- add missing declaration
- update debug output format specifiers

Signed-off-by: Steve Rae <steve.rae@raedomain.com>
2016-07-24 20:36:29 -05:00
Boris Brezillon
2dc3c483a9 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>
2016-07-24 20:36:27 -05:00
Ladislav Michl
af32443656 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>
2016-07-22 14:46:15 -04:00
Ladislav Michl
f8f744a3e8 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>
2016-07-22 14:46:14 -04:00
Ladislav Michl
1c2a262a9d cmd: mtdparts: consolidate mtdparts reading from env
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
2016-07-22 14:46:14 -04:00
Ladislav Michl
06a040a31b 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>
2016-07-22 14:46:13 -04:00
Ladislav Michl
c0ac333947 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>
2016-07-22 14:46:13 -04:00
Tom Rini
66669fcf80 Merge git://git.denx.de/u-boot-fsl-qoriq
Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
	arch/arm/cpu/armv8/Makefile
	arch/arm/lib/bootm-fdt.c
2016-07-19 16:38:57 -04:00
Robert P. J. Day
62a3b7dd08 Various, unrelated tree-wide typo fixes.
Fix a number of typos, including:

     * "compatble" -> "compatible"
     * "eanbeld" -> "enabled"
     * "envrionment" -> "environment"
     * "FTD" -> "FDT" (for "flattened device tree")
     * "ommitted" -> "omitted"
     * "overriden" -> "overridden"
     * "partiton" -> "partition"
     * "propogate" -> "propagate"
     * "resourse" -> "resource"
     * "rest in piece" -> "rest in peace"
     * "suport" -> "support"
     * "varible" -> "variable"

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
2016-07-16 09:43:12 -04:00
York Sun
e61a7534e3 armv8: Move secure_ram variable out of generic global data
Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>
2016-07-15 09:01:43 -07:00
Tom Rini
bff97dde8c Merge branch 'master' of git://git.denx.de/u-boot-spi 2016-07-11 18:50:29 -04:00
Vignesh R
96907c0fe5 dm: spi: Read default speed and mode values from DT
In case of DT boot, don't read default speed and mode for SPI from
CONFIG_*, instead read from DT node. This will make sure that boards
with multiple SPI/QSPI controllers can be probed at different
bus frequencies and SPI modes.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
2016-07-09 20:16:34 +05:30
Hans de Goede
e6e188f562 usb: dm: Make "usb info" use usb_for_each_root_dev()
The old dm "usb info" implementation has several issues:

1) NULL pointer deref when a bus has no children
2) Not showing usb devices on busses without an emulated root-hub (otg host)
3) Attempting to show devices on inactive busses
4) "usb info" Would cause some hosts to get re-probed something which only
   "usb reset" should do

TL;DR: proper iterating over usb bus root devs is hard, use the helper
for it.

Reported-by: Bernhard Nortmann <bernhard.nortmann@web.de>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-07-05 14:14:11 +02:00
Hans de Goede
2138fd6d5d usb: dm: Add a usb_for_each_root_dev() helper function
Iterating over usb-root devs and doing something for all of them is
a bit tricky with dm, factor out the proven usb_show_tree() for this
into a helper function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-07-05 14:14:11 +02:00
Masahiro Yamada
f1f9d4fac5 hush: complete renaming CONFIG_SYS_HUSH_PARSER to CONFIG_HUSH_PARSER
There is no more define of CONFIG_SYS_HUSH_PARSER.  Rename some
remaining references and drop the backward compatible Kconfig entry.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-06-24 17:24:34 -04:00
Michael Trimarchi
4f1318b29c common: image: minimal android image iminfo support
We already support iminfo for other images. The idea
of this patch is start to have a minimal support for
android image format. We still need to print id[] array

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-06-24 17:23:07 -04:00
Sergey Kubushyn
92dfd9221c cmd: bootefi: cosmetic
Short help (description) in bootefi command has a trailing "\n" that
breaks the "help" command output (empty line after "bootefi").

Nothing important, doesn't affect anything but better be fixed in the
upcoming release.

Still working on i.MX6 and their siblings NAND U-Boot update -- it
works here but not ready for a submission yet. Anyway it is for the
next cycle, not going to go into this release because it is too big
and may affect something else.

Also have some thoughts about fastboot (using multiple devices) but
this will go into separate email with RFC.

Signed-off-by: Sergey Kubushyn <ksi@koi8.net>
2016-06-24 17:23:04 -04:00
Masahiro Yamada
41598c8251 autoboot: add CONFIG_AUTOBOOT to allow to not compile autoboot.c
Since commit bb597c0eeb ("common: bootdelay: move CONFIG_BOOTDELAY
into a Kconfig option"), CONFIG_BOOTDELAY is defined for all boards.

Prior to that commit, it was allowed to unset CONFIG_BOOTDELAY to
not compile common/autoboot.c, as described in common/Makefile:

  # This option is not just y/n - it can have a numeric value
  ifdef CONFIG_BOOTDELAY
  obj-y += autoboot.o
  endif

It was a bit odd to enable/disable code with an integer type option,
but it was how this option worked before that commit, and several
boards actually unset it to opt out of the autoboot feature.

This commit adds a new bool option, CONFIG_AUTOBOOT, and makes
CONFIG_BOOTDELAY depend on it.

I chose "default y" for this option because most boards use the
autoboot.  I added "# CONFIG_AUTOBOOT is not set" for the boards that
had not set CONFIG_BOOTDELAY prior to the bad commit.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-06-20 05:19:09 -04:00
Tom Rini
2313d48445 Merge git://git.denx.de/u-boot-nand-flash 2016-06-20 05:15:52 -04:00
Max Krummenacher
1866be7d28 nand: extend nand torture
nand torture currently works on exactly one nand block which is specified
by giving the byteoffset to the beginning of the block.

Extend this by allowing for a second parameter specifying the byte size
to be tested.

e.g.
==> nand torture 1000000

NAND torture: device 0 offset 0x1000000 size 0x20000 (block size 0x20000)
 Passed: 1, failed: 0

==> nand torture 1000000 40000

NAND torture: device 0 offset 0x1000000 size 0x40000 (block size 0x20000)
 Passed: 2, failed: 0

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
[scottwood: fix usage to show size as optional, and add misssing braces]
Signed-off-by: Scott Wood <oss@buserror.net>
2016-06-19 19:25:12 -05:00
Tom Rini
a10a31ec91 Merge branch 'master' of git://git.denx.de/u-boot-usb
Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
	arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
2016-06-18 23:46:21 -04:00
Peng Fan
7839f5f809 cmd: usb: check if_type before using this device
For legacy usb storage driver, USB_MAX_STOR_DEV is defined as 7.
If we only have one usb disk on board, `usb dev 0` is ok.
But if `usb dev 1`, still ok, then `usb read xxx` will trigger
system fault and reboot.

So check if_type before using this device.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stephen Warren <swarren@nvidia.com>
2016-06-18 00:48:31 +02:00
Michael Trimarchi
666362356e cmd: gpt: add - partition size parsing
This patch try to parse name=userdata,size=-,uuid=${uuid_gpt_userdata};

gpt mmc write 0 $partitions
gpt mmc verify 0 $partitions

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-06-12 13:14:57 -04:00
Heiko Schocher
cddfc97d1f ubi: add new ubi command "ubi detach"
simple detachs ubi from the mtd partition.

Signed-off-by: Heiko Schocher <hs@denx.de>
2016-06-09 13:53:11 -04:00
Alexander Graf
edcef3ba1d efi_loader: Move to normal debug infrastructure
We introduced special "DEBUG_EFI" defines when the efi loader
support was new. After giving it a bit of thought, turns out
we really didn't have to - the normal #define DEBUG infrastructure
works well enough for efi loader as well.

So this patch switches to the common debug() and #define DEBUG
way of printing debug information.

Signed-off-by: Alexander Graf <agraf@suse.de>
2016-06-06 13:39:16 -04:00
Alexander Graf
a86aeaf228 efi_loader: Add exit support
Some times you may want to exit an EFI payload again, for example
to default boot into a PXE installation and decide that you would
rather want to boot from the local disk instead.

This patch adds exit functionality to the EFI implementation, allowing
EFI payloads to exit.

Signed-off-by: Alexander Graf <agraf@suse.de>
2016-06-06 13:39:15 -04:00
Scott Wood
17cb4b8f32 mtd: nand: Add+use mtd_to/from_nand and nand_get/set_controller_data
These functions are part of the Linux 4.6 sync.  They are being added
before the main sync patch in order to make it easier to address the
issue across all NAND drivers (many/most of which do not closely track
their Linux counterparts) separately from other merge issues.

Signed-off-by: Scott Wood <oss@buserror.net>
2016-06-03 20:27:48 -05:00
Scott Wood
b616d9b0a7 nand: Embed mtd_info in struct nand_chip
nand_info[] is now an array of pointers, with the actual mtd_info
instance embedded in struct nand_chip.

This is in preparation for syncing the NAND code with Linux 4.6,
which makes the same change to struct nand_chip.  It's in a separate
commit due to the large amount of changes required to accommodate the
change to nand_info[].

Signed-off-by: Scott Wood <oss@buserror.net>
2016-06-03 20:27:48 -05:00
Scott Wood
151c06ec61 mtd: nand: Remove nand_info_t typedef
This typedef serves no purpose other than causing confusion with
struct nand_chip.

Signed-off-by: Scott Wood <oss@buserror.net>
2016-06-03 20:27:48 -05:00
Tom Rini
e4a94ce4ac Merge git://git.denx.de/u-boot-dm
For odroid-c2 (arch-meson) for now disable designware eth as meson
now needs to do some harder GPIO work.

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
	lib/efi_loader/efi_disk.c

Modified:
	configs/odroid-c2_defconfig
2016-05-27 20:34:12 -04:00
Alexander Graf
0efe1bcf5c efi_loader: Add network access support
We can now successfully boot EFI applications from disk, but users
may want to also run them from a PXE setup.

This patch implements rudimentary network support, allowing a payload
to send and receive network packets.

With this patch, I was able to successfully run grub2 with network
access inside of QEMU's -M xlnx-ep108.

Signed-off-by: Alexander Graf <agraf@suse.de>
2016-05-27 10:01:10 -04:00
Kunihiko Hayashi
dafd64888c cmd: replace the cast of the memory access to a fixed bit type in itest
This patch fixes a bug that long word(.l) memory access in 'itest'
command reads the 8bytes of the actual memory on 64-bit architecture.
The cast to the memory pointer should use a fixed bit type.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-05-27 10:01:07 -04:00
Marek Vasut
04681cb3a4 cmd: disk: Fix unused variable warning
If serial support is not compiled into U-Boot, which may be the case
for some SPL builds, the following warning will be generated in disk.c:

cmd/disk.c: In function 'common_diskboot':
cmd/disk.c:16:6: warning: variable 'dev' set but not used [-Wunused-but-set-variable]
  int dev, part;
      ^
The warning is a result of printf() calls being optimized away, and
thus the whole dev variable becomes indeed unused. Mark the variable
as __maybe_unused .

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-05-27 10:01:06 -04:00
Simon Glass
9cf7b1a74c mmc: Drop dead mmc code for non-generic MMC
All boards that use MMC define CONFIG_GENERIC_MMC now, so we can drop this
old code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-26 20:50:29 -06:00
Andre Przywara
f9a90ace21 arm64: fix arm64 Linux boot image header field sizes
The arm64 Linux boot protocol [1] describes the fields in the Image
header as being 64-bit little endian values.
So fix the endianess conversion to use 64-bit sized operations, for
both image_size and text_offset.
Also we use a local variable for the image_size to avoid both writing
to the header and also accessing it after we actually unmapped it.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm64/booting.txt
2016-05-25 12:52:44 -04:00