oweals/u-boot.git
8 years agotools: mxsboot: Use more portable cpu_to_le32()
Bin Meng [Mon, 25 Jan 2016 03:38:32 +0000 (19:38 -0800)]
tools: mxsboot: Use more portable cpu_to_le32()

Currently when building mxsboot on certain machines it reports:

  HOSTCC  tools/mxsboot
  tools/mxsboot.c: In function 'mx28_create_sd_image':
  tools/mxsboot.c:560: warning: implicit declaration of function 'htole32'
  /tmp/cchLIV6q.o: In function 'main':
  mxsboot.c:(.text+0x6d8): undefined reference to 'htole32'
  mxsboot.c:(.text+0x6e7): undefined reference to 'htole32'
  mxsboot.c:(.text+0x6f6): undefined reference to 'htole32'
  mxsboot.c:(.text+0x705): undefined reference to 'htole32'
  mxsboot.c:(.text+0x711): undefined reference to 'htole32'
  /tmp/cchLIV6q.o:mxsboot.c:(.text+0x71d): more undefined references to
  'htole32' follow
  collect2: ld returned 1 exit status
  make[1]: *** [tools/mxsboot] Error 1
  make: *** [tools] Error 2

The solution is to use cpu_to_le32() instead which is more portable,
just like other U-Boot tools [1] do.

[1] http://lists.denx.de/pipermail/u-boot/2014-October/192919.html

Suggested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Marek Vasut <marex@denx.de>
8 years agowandboard: fix variable name so PXE boot works
Peter Robinson [Wed, 20 Jan 2016 10:00:16 +0000 (10:00 +0000)]
wandboard: fix variable name so PXE boot works

All boards that support PXE booting use the pxefile_addr_r variable. Standardise
wandboard with this variable as pxe_addr_r isn't used anywhere else so it's a
typo.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Acked-by: Fabio Estevam <fabio.estevam@nxp.com>
8 years agoarm: imx6: Enable DDR calibration on Novena
Marek Vasut [Wed, 16 Dec 2015 14:40:07 +0000 (15:40 +0100)]
arm: imx6: Enable DDR calibration on Novena

Enable the DDR calibration functionality on Novena to deal with the
memory SoDIMM on this board. Moreover, tweak the initial DDR DRAM
parameters so the calibration works properly.

Signed-off-by: Marek Vasut <marex@denx.de>
8 years agoarm: imx6: Add DDR3 calibration code for MX6 Q/D/DL
Marek Vasut [Wed, 16 Dec 2015 14:40:06 +0000 (15:40 +0100)]
arm: imx6: Add DDR3 calibration code for MX6 Q/D/DL

Add DDR3 calibration code for i.MX6Q, i.MX6D and i.MX6DL. This code
fine-tunes the behavior of the MMDC controller in order to improve
the signal integrity and memory stability.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
8 years agoPrepare v2016.03-rc1 v2016.03-rc1
Tom Rini [Tue, 2 Feb 2016 16:29:50 +0000 (11:29 -0500)]
Prepare v2016.03-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoMerge branch 'master' of git://git.denx.de/u-boot-atmel
Tom Rini [Tue, 2 Feb 2016 12:24:52 +0000 (07:24 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-atmel

8 years agoMerge branch 'master' of git://git.denx.de/u-boot-fsl-qoriq
Tom Rini [Tue, 2 Feb 2016 11:51:05 +0000 (06:51 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-fsl-qoriq

8 years agoboard: atmel: sama5d2_xplained: add SPL support
Wenyou Yang [Mon, 1 Feb 2016 10:18:21 +0000 (18:18 +0800)]
board: atmel: sama5d2_xplained: add SPL support

The sama5d2 Xplained SPL supports the boot medias: spi flash
and SD Card.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
8 years agoarm: at91/spl: mpddrc: use IP version to check configuration
Wenyou Yang [Mon, 1 Feb 2016 10:12:17 +0000 (18:12 +0800)]
arm: at91/spl: mpddrc: use IP version to check configuration

To remove the unnecessary #ifdef-endif, use the mpddrc IP version
to check whether or not the interleaved decoding type is supported.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
8 years agoarm: at91/spl: mpddrc: add mpddrc DDR3-SDRAM initialization
Wenyou Yang [Mon, 1 Feb 2016 10:12:16 +0000 (18:12 +0800)]
arm: at91/spl: mpddrc: add mpddrc DDR3-SDRAM initialization

The DDR3-SDRAM initialization sequence is implemented in
accordance with the DDR3-SRAM/DDR3L-SDRAM initialization section
described in the SAMA5D2 datasheet.

Add registers and definitions of mpddrc controller, which is used
to support DDR3 devices.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
8 years agoarm: at91/spl: mpddrc: add struct atmel_mpddrc_config
Wenyou Yang [Mon, 1 Feb 2016 10:12:15 +0000 (18:12 +0800)]
arm: at91/spl: mpddrc: add struct atmel_mpddrc_config

Add struct atmel_mpddrc_config to accommodate the mpddrc register
configurations, not using the mpddrc register map structure,
struct atmel_mpddrc, in order to increase readability and reduce
run-time memory use.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
8 years agoatmel_nand: Add 32 bit ecc support for sama5d2 chip
Josh Wu [Tue, 24 Nov 2015 08:34:01 +0000 (16:34 +0800)]
atmel_nand: Add 32 bit ecc support for sama5d2 chip

Also if minimum ecc requirment is bigger then what we support, then just
use our maxium pmecc support.
But it is not safe, so we'll output a warning about this.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Scott Wood <scottwood@freescale.com>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
8 years agoatmel_nand_ecc: update pmecc registers according to sama5d2 chip
Josh Wu [Tue, 24 Nov 2015 08:34:00 +0000 (16:34 +0800)]
atmel_nand_ecc: update pmecc registers according to sama5d2 chip

1. add the pmecc register mapping for sama5d2.
2. add the pmecc error location register mapping for sama5d2.
3. add some new field that is different from old ip.
4. add sama5d2 pmecc ip version number.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
8 years agoMakefile: Drop unnecessary -dtb suffixes
Simon Glass [Mon, 1 Feb 2016 01:10:55 +0000 (18:10 -0700)]
Makefile: Drop unnecessary -dtb suffixes

When OF_CONTROL is enabled, u-boot-dtb.* files are the same as u-boot.*
files. So we can use the latter for simplicity.

Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoMakefile: Make u-boot.img the same as u-boot-dtb.img
Simon Glass [Mon, 1 Feb 2016 01:10:54 +0000 (18:10 -0700)]
Makefile: Make u-boot.img the same as u-boot-dtb.img

Create u-boot.img even when OF_CONTROL is enabled, so that this file can be
used in both cases.

Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosocfpga: Simplify Makefile filenames
Simon Glass [Mon, 1 Feb 2016 01:10:53 +0000 (18:10 -0700)]
socfpga: Simplify Makefile filenames

We don't need the -dtb suffix anymore, so drop it.

Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agotegra: Always build a boot image with the same filename
Simon Glass [Mon, 1 Feb 2016 01:10:52 +0000 (18:10 -0700)]
tegra: Always build a boot image with the same filename

Adjust the Makefile to build u-boot-tegra.bin which contains a device tree
if OF_SEPARATE is enabled, and does not if not. This mirrors U-Boot's new
approach of using u-boot.bin to handle both cases.

Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agofdt: Build an SPL binary without device tree
Simon Glass [Mon, 1 Feb 2016 01:10:51 +0000 (18:10 -0700)]
fdt: Build an SPL binary without device tree

At present u-boot-spl.bin holds the plain SPL binary without the device
tree. This is somewhat annoying since you need either u-boot-spl.bin or
u-boot-spl-dtb.bin depending on whether device tree is used.

Adjust the build such that u-boot-spl.bin includes a device tree
(if enabled), and the plain binary is in u-boot-spl-nodtb.bin. For now
u-boot-spl-dtb.bin remains the same.

Tested-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agofdt: Build a U-Boot binary without device tree
Simon Glass [Mon, 1 Feb 2016 01:10:50 +0000 (18:10 -0700)]
fdt: Build a U-Boot binary without device tree

At present u-boot.bin holds the plain U-Boot binary without the device tree.
This is somewhat annoying since you need either u-boot.bin or u-boot-dtb.bin
depending on whether device tree is used.

Adjust the build such that u-boot.bin includes a device tree (if enabled),
and the plain binary is in u-boot-nodtb.bin. For now u-boot-dtb.bin remains
the same.

This should be acceptable since:

- without OF_CONTROL, u-boot.bin still does not include a device tree
- with OF_CONTROL, u-boot-dtb.bin does not change

The main impact is build systems which are set up to use u-boot.bin as
the output file and then add a device tree. These will have to change to use
u-boot-nodtb.bin instead.

Adjust tegra rules so it continues to produce the correct files.

Tested-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agotegra: Clarify generation of -nodtb file with OF_CONTROL
Simon Glass [Mon, 1 Feb 2016 01:10:49 +0000 (18:10 -0700)]
tegra: Clarify generation of -nodtb file with OF_CONTROL

Fix the ALL-y logic in the Makefile so that is clear that we always want
the -nodtb file.

Tested-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agomailmap: fix Ricardo's entry
Masahiro Yamada [Fri, 29 Jan 2016 02:42:53 +0000 (11:42 +0900)]
mailmap: fix Ricardo's entry

Commit df48b23428e9 (".mailmap: Add all the mail alias for Ricardo
Ribalda") assigned two different proper names for the email address
"ricardo.ribalda@uam.es".  This is a completely wrong usage as the
mailmap feature exists for coalescing together commits by the same
person whose name is sometimes spelled differently.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agommc: add missing prototype for mmc_get_env_dev
Clemens Gruber [Tue, 26 Jan 2016 15:20:38 +0000 (16:20 +0100)]
mmc: add missing prototype for mmc_get_env_dev

This is a follow-up patch to e92029c0f4 and adds a prototype for
the weak mmc_get_env_dev function.

Cc: Tom Rini <trini@konsulko.com>
Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
8 years agomalloc: work around some memalign fragmentation issues
Stephen Warren [Mon, 25 Jan 2016 21:03:42 +0000 (14:03 -0700)]
malloc: work around some memalign fragmentation issues

Use of memalign can trigger fragmentation issues such as:

// Internally, this needs to find a free block quite bit larger than s.
// Once the free region is found, any unaligned "padding" immediately
// before and after the block is marked free, so that the allocation
// takes only s bytes (plus malloc header overhead).
p = memalign(a, s);
// If there's little fragmentation so far, this allocation is likely
// located immediately after p.
p2 = malloc(x);
free(p);
// In theory, this should return the same value for p. However, the hole
// left by the free() call is only s in size (plus malloc header overhead)
// whereas memalign searches for a larger block in order to guarantee it
// can adjust the returned pointer to the alignment requirements. Hence,
// the pointer returned, if any, won't be p. If there's little or no space
// left after p2, this allocation will fail.
p = memalign(a, s);

In practice, this issue occurs when running the "dfu" command repeatedly
on NVIDIA Tegra boards, since DFU allocates a large 32M data buffer, and
then initializes the USB controller. If this is the first time USB has
been used in the U-Boot session, this causes a probe of the USB driver,
which causes various allocations, including a strdup() of a GPIO name
when requesting the VBUS GPIO. When DFU is torn down, the USB driver
is left probed, and hence its memory is left allocated. If "dfu" is
executed again, allocation of the 32M data buffer fails as described
above.

In practice, there is a memory hole exactly large enough to hold the 32M
data buffer than DFU needs. However, memalign() can't know that in a
general way. Given that, it's particularly annoying that the allocation
fails!

The issue is that memalign() tries to allocate something larger to
guarantee the ability to align the returned pointer. This patch modifies
memalign() so that if the "general case" over-sized allocation fails,
another allocation is attempted, of the exact size the user desired. If
that allocation just happens to be aligned in the way the user wants,
(and in the case described above, it will be, since the free memory
region is located where a previous identical allocation was located),
the pointer can be returned.

This patch is somewhat related to 806bd245b1ab "dfu: don't keep
freeing/reallocating". That patch worked around the issue by removing
repeated free/memalign within a single execution of "dfu". However,
the same technique can't be applied across multiple invocations, since
there's no reason to keep the DFU buffer allocated while DFU isn't
running. This patch addresses the root-cause a bit more directly.

This problem highlights some of the disadvantages of dynamic allocation
and deferred probing of devices.

This patch isn't checkpatch-clean, since it conforms to the existing
coding style in dlmalloc.c, which is different to the rest of U-Boot.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
8 years ago.travis.yml: rework according to new travis-ci infra
Roger Meier [Mon, 25 Jan 2016 19:22:41 +0000 (20:22 +0100)]
.travis.yml: rework according to new travis-ci infra

- install using addons.apt
- remove MAKEALL
- split mpc85xx boards
- remove TEST_CONFIG_CMD, just info
- fetch mips toolchain via buildman
- remove --list-error-boards param
- conditional script
- use TOOLCHAIN instead of INSTALL_TOOLCHAIN
- add aarch64
- enable notifications via email

Signed-off-by: Roger Meier <r.meier@siemens.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Andreas Färber <afaerber@suse.de>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Heiko Schocher <hs@denx.de>
8 years agoarm8: ls2080: Move the core errata defines out of board specific file
Ashish kumar [Fri, 29 Jan 2016 11:10:08 +0000 (16:40 +0530)]
arm8: ls2080: Move the core errata defines out of board specific file

Valid for core A57

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoMerge branch 'master' of git://git.denx.de/u-boot-mips
Tom Rini [Mon, 1 Feb 2016 21:58:46 +0000 (16:58 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-mips

8 years agoarmv8: ls2080a: Implement workaround for core errata 829520, 833471
Ashish kumar [Wed, 27 Jan 2016 12:39:32 +0000 (18:09 +0530)]
armv8: ls2080a: Implement workaround for core errata 829520, 833471

829520: Code bounded by indirect conditional branch might corrupt
instruction stream.
Workaround: Set CPUACTLR_EL1[4] = 1'b1 to disable the Indirect
Predictor.

833471: VMSR FPSCR functional failure or deadlock.
Workaround: Set CPUACTLR[38] to 1, which forces FPSCR write flush.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoboard: Enable ethernet, tftpboot support to pic32mzdask board.
Purna Chandra Mandal [Thu, 28 Jan 2016 10:00:22 +0000 (15:30 +0530)]
board: Enable ethernet, tftpboot support to pic32mzdask board.

This adds ethernet, TFTP support for PIC32MZ[DA] Starter Kit. Also
custom environment variables/scripts are added to help boot from network.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
8 years agodrivers: net: Add ethernet driver for Microchip PIC32.
Purna Chandra Mandal [Thu, 28 Jan 2016 10:00:21 +0000 (15:30 +0530)]
drivers: net: Add ethernet driver for Microchip PIC32.

This driver implements MAC and MII layer of the ethernet controller.
Network data transfer is handled by controller internal DMA engine.
Ethernet controller is configurable through device-tree file.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
8 years agodrivers: net: phy: add SMSC LAN8740 Phy support.
Purna Chandra Mandal [Thu, 28 Jan 2016 10:00:20 +0000 (15:30 +0530)]
drivers: net: phy: add SMSC LAN8740 Phy support.

Add SMSC LAN8740 Phy support required for PIC32MZDA devices.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agoboard: add SDHCI support for PIC32MZDASK board.
Purna Chandra Mandal [Thu, 28 Jan 2016 10:00:19 +0000 (15:30 +0530)]
board: add SDHCI support for PIC32MZDASK board.

Enable MMC, SDHCI, FAT_FS support for PIC32MZ[DA] StarterKit.
Also add custom scripts, rules to boot Linux from microSD card.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
8 years agodrivers: mmc: add driver for Microchip PIC32 SDHCI controller.
Andrei Pistirica [Thu, 28 Jan 2016 10:00:18 +0000 (15:30 +0530)]
drivers: mmc: add driver for Microchip PIC32 SDHCI controller.

This driver implements platform specific glue and fixups for
PIC32 internal SDHCI controller.

Signed-off-by: Andrei Pistirica <andrei.pistirica@microchip.com>
Signed-off-by: Sandeep Sheriker Mallikarjun <sandeepsheriker.mallikarjun@microchip.com>
Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agoboard: Add Microchip PIC32MZ[DA]-Starter-Kit board.
Purna Chandra Mandal [Thu, 28 Jan 2016 10:00:17 +0000 (15:30 +0530)]
board: Add Microchip PIC32MZ[DA]-Starter-Kit board.

This adds support for Microchip PIC32MZ[DA] StarterKit board
based on a PIC32MZ[DA] family of microcontroller.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agoMIPS: Add support for Microchip PIC32MZ[DA] SoC family.
Purna Chandra Mandal [Thu, 28 Jan 2016 10:00:16 +0000 (15:30 +0530)]
MIPS: Add support for Microchip PIC32MZ[DA] SoC family.

Add Microchip PIC32MZ[DA] SoC family support.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agodrivers: ddr: Add DDR2 SDRAM controller driver for Microchip PIC32.
Purna Chandra Mandal [Thu, 28 Jan 2016 10:00:15 +0000 (15:30 +0530)]
drivers: ddr: Add DDR2 SDRAM controller driver for Microchip PIC32.

This driver initializes PIC32 DDR2 SDRAM controller and internal DDR2 Phy module.
DDR2 controller operates in half-rate mode (upto 533MHZ frequency).

Signed-off-by: Paul Thacker <paul.thacker@microchip.com>
Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agodrivers: serial: add driver for Microchip PIC32 UART controller.
Paul Thacker [Thu, 28 Jan 2016 10:00:14 +0000 (15:30 +0530)]
drivers: serial: add driver for Microchip PIC32 UART controller.

This adds PIC32 UART controller support based on driver model.

Signed-off-by: Paul Thacker <paul.thacker@microchip.com>
Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agodrivers: gpio: add driver for Microchip PIC32 GPIO controller.
Purna Chandra Mandal [Thu, 28 Jan 2016 10:00:13 +0000 (15:30 +0530)]
drivers: gpio: add driver for Microchip PIC32 GPIO controller.

In PIC32 GPIO controller is part of PIC32 pin controller.
PIC32 has ten independently programmable ports and each with multiple pins.
Each of these pins can be configured and used as GPIO, provided they
are not in use for other peripherals.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agodrivers: pinctrl: Add pinctrl driver for Microchip PIC32.
Purna Chandra Mandal [Thu, 28 Jan 2016 10:00:12 +0000 (15:30 +0530)]
drivers: pinctrl: Add pinctrl driver for Microchip PIC32.

In PIC32 pin-controller is a combined gpio-controller, pin-mux and
pin-config module. Remappable peripherals are assigned pins through
per-pin based muxing logic. And pin configuration are performed on
specific port registers which are shared along with gpio controller.
Note, non-remappable peripherals have default pins assigned thus
require no muxing.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agodrivers: clk: Add clock driver for Microchip PIC32 Microcontroller.
Purna Chandra Mandal [Thu, 28 Jan 2016 10:00:11 +0000 (15:30 +0530)]
drivers: clk: Add clock driver for Microchip PIC32 Microcontroller.

PIC32 clock module consists of multiple oscillators, PLLs, mutiplexers
and dividers capable of supplying clock to various controllers
on or off-chip.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agoMIPS: initial infrastructure for Microchip PIC32 architecture
Purna Chandra Mandal [Thu, 28 Jan 2016 10:00:10 +0000 (15:30 +0530)]
MIPS: initial infrastructure for Microchip PIC32 architecture

Create initial directory, Kconfigs needed for PIC32 architecture
support. Also add PIC32 specific register definition required for drivers.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agomalta: Use I/O accessors for SuperI/O controller
Paul Burton [Fri, 29 Jan 2016 13:54:54 +0000 (13:54 +0000)]
malta: Use I/O accessors for SuperI/O controller

Rather than passing the I/O port base address to the Super I/O code,
switch it to using outb such that it makes use of the I/O port base
address automatically.

Drop the extern keyword to satisfy checkpatch whilst here.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
8 years agomalta: Set I/O port base early
Paul Burton [Fri, 29 Jan 2016 13:54:53 +0000 (13:54 +0000)]
malta: Set I/O port base early

Set the I/O port base earlier, from board_early_init_f, in preparation
for it being used by the serial driver.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
8 years agoMIPS: Support dynamic I/O port base address
Paul Burton [Fri, 29 Jan 2016 13:54:52 +0000 (13:54 +0000)]
MIPS: Support dynamic I/O port base address

The existing mips_io_port_base variable isn't suitable for use early
during boot since it will be stored in the .data section which may not
be writable pre-relocation. Fix this by moving the I/O port base address
into struct arch_global_data. In order to avoid adding this field for
all targets, make this dependant upon a new Kconfig entry
CONFIG_DYNAMIC_IO_PORT_BASE. Malta is the only board which sets a
non-zero I/O port base, so select this option only for Malta.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
8 years agoMIPS: Remove SLOW_DOWN_IO
Paul Burton [Fri, 29 Jan 2016 13:54:51 +0000 (13:54 +0000)]
MIPS: Remove SLOW_DOWN_IO

CONF_SLOWDOWN_IO is never set for any target, so remove the dead code in
the SLOW_DOWN_IO macro. This is done in preparation for changes to
mips_io_port_base which can be avoided in this path by removing it
entirely.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
8 years agomips: cache: Bulletproof the code against cornercases
Marek Vasut [Wed, 27 Jan 2016 02:13:59 +0000 (03:13 +0100)]
mips: cache: Bulletproof the code against cornercases

This patch makes sure that the flush/invalidate_dcache_range() functions
can handle corner-case calls like this -- invalidate_dcache_range(0, 0, 0);
This call is valid and is happily produced by USB EHCI code for example.
The expected behavior of the cache function(s) in this case is that they
will do no operation, since the size is zero.

The current implementation though has a problem where such invocation will
result in a hard CPU hang. This is because under such conditions, where the
start_addr = 0 and stop = 0, the addr = 0 and aend = 0xffffffe0 . The loop
will then try to iterate over the entire address space, which in itself is
wrong. But iterating over the entire address space might also hit some odd
address which will cause bus hang. The later happens on the Atheros MIPS.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>
8 years agoMIPS: start.S: fix and optimize instructions
Daniel Schwierzeck [Sat, 9 Jan 2016 21:24:47 +0000 (22:24 +0100)]
MIPS: start.S: fix and optimize instructions

Fix 32 vs 64 bit load/store instructions. Access CP0_WATCHHI as
32 Bit register. Use 64 Bit register access for clearing gd_data
and copying U-Boot.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agoMIPS: initialize board_init_f() argument to zero.
Purna Chandra Mandal [Thu, 21 Jan 2016 14:32:51 +0000 (20:02 +0530)]
MIPS: initialize board_init_f() argument to zero.

Argument boot_flags of board_init_f() should be set to 0 as
$a0 may be utilized in lowlevel_init() or mips_cache_reset()
or previous stage boot-loader.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agoarmv8/ls1043aqds: fix DSPI/QSPI node in dts file
Qianyu Gong [Mon, 1 Feb 2016 05:09:16 +0000 (13:09 +0800)]
armv8/ls1043aqds: fix DSPI/QSPI node in dts file

Fix the lost dts info when merging patches.

Fix DSPI node for 'commit e0579a5852b3 ("armv8/ls1043aqds: add DSPI
support")' and QSPI node for 'commit 166ef1e90ce4 ("armv8/ls1043aqds:
add QSPI support in SD boot")'.

Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agodriver: net: fsl-mc: Update print to reflect correct string
Prabhakar Kushwaha [Wed, 20 Jan 2016 06:34:37 +0000 (12:04 +0530)]
driver: net: fsl-mc: Update print to reflect correct string

Update printf with dpbp_exit to match with previous function call.

Signed-off-by: Itai Katz <itai.katz@nxp.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agodriver: net: fsl-mc: Memset dprc_cfg before configuring
Prabhakar Kushwaha [Wed, 20 Jan 2016 06:34:19 +0000 (12:04 +0530)]
driver: net: fsl-mc: Memset dprc_cfg before configuring

All fields of struct dprc_cfg are not being configured while creating
child container. "Not" configured fields are assumed to be 0.

So memset dprc_cfg before configuring the fields.

Signed-off-by: Itai Katz <itai.katz@nxp.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv7: ls102xa: Increase the supported kernel size
Alison Wang [Fri, 15 Jan 2016 07:29:32 +0000 (15:29 +0800)]
armv7: ls102xa: Increase the supported kernel size

Increase the kernel size supported for LS1021A platform. Define
CONFIG_SYS_BOOTM_LEN to 64M.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoboard: ls2085aqds: Update kernel_size env variable
Prabhakar Kushwaha [Wed, 6 Jan 2016 05:00:18 +0000 (10:30 +0530)]
board: ls2085aqds: Update kernel_size env variable

kernel_size env variable is defined as 0x28000000, it is beyond NOR
flash range. Update kernel_size with 40MB kernel size.

Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarm: novena: Fix EEPROM i2c configuration
Marek Vasut [Tue, 24 Nov 2015 23:36:44 +0000 (00:36 +0100)]
arm: novena: Fix EEPROM i2c configuration

On Novena, the DRAM SPD is connected to i2c1 while the Utility EEPROM
is connected to i2c3. Now that the EEPROM handling in U-Boot is fixed,
also fix this bit on Novena.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Sean Cross <xobs@kosagi.com>
Cc: Stefano Babic <sbabic@denx.de>
8 years agoarm: config: enforce -fno-pic for gcc
Peng Fan [Sat, 30 Jan 2016 04:10:49 +0000 (12:10 +0800)]
arm: config: enforce -fno-pic for gcc

Android's tool chain enable the -mandroid at default.
This option will enable the -fpic, which cause uboot compilation
failure:
"
 LD      u-boot
 u-boot contains unexpected relocations: R_ARM_ABS32
 R_ARM_RELATIVE
"

In my testcase, arm-linux-androideabi-gcc-4.9 internally
enables '-fpic', so when compiling code, there will be
relocation entries using type R_ARM_GOT_BREL and .got
section. When linking all the built-in.o using ld, there
will be R_ARM_ABS32 relocation entry and .got section
in the final u-boot elf image. This can not be handled
by u-boot, since u-boot only expects R_ARM_RELATIVE
relocation entry.
arm-poky-linux-gnueabi-gcc-4.9 default does not enable '-fpic',
so there is not .got section and R_ARM_GOT_BREL in built-in.o.
And in the final u-boot elf image, all relocation entries are
R_ARM_RELATIVE.

we can pass '-fno-pic' to xxx-gcc to disable pic. whether
the toolchain internally enables or disables pic, '-fno-pic'
can work well.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoARM: Disable "DISCARD" for secure section if CONFIG_ARMV7_SECURE_BASE isn't defined
Wang Dongsheng [Mon, 18 Jan 2016 03:02:40 +0000 (11:02 +0800)]
ARM: Disable "DISCARD" for secure section if CONFIG_ARMV7_SECURE_BASE isn't defined

"DISCARD" will remove ._secure.text relocate, but PSCI framework
has already used some absolute address those need to relocate.

Use readelf -t -r u-boot show us:
.__secure_start addr: 601408e4
.__secure_end addr: 60141460

60141140  00000017 R_ARM_RELATIVE
46 _secure_monitor:
47 #ifdef CONFIG_ARMV7_PSCI
48      ldr     r5, =_psci_vectors

60141194  00000017 R_ARM_RELATIVE
6014119c  00000017 R_ARM_RELATIVE
601411a4  00000017 R_ARM_RELATIVE
601411ac  00000017 R_ARM_RELATIVE
64 _psci_table:
66 .word psci_cpu_suspend
...
72 .word psci_migrate

60141344  00000017 R_ARM_RELATIVE
6014145c  00000017 R_ARM_RELATIVE
202 ldr     r5, =psci_text_end

Solutions:
1. Change absolute address to RelAdr.
   Based on LDR (immediate, ARM), we only have 4K offset to jump.
Now PSCI code size is close to 4K size that is LDR limit jump size,
so even if the LDR is based on the current instruction address,
there is also have a risk for RelAdr. If we use two jump steps I
think we can fix this issue, but looks too hack, so give up this way.

2. Enable "DISCARD" only for CONFIG_ARMV7_SECURE_BASE has defined.
   If CONFIG_ARMV7_SECURE_BASE is defined in platform, all of secure
will in the BASE address that is absolute.

Signed-off-by: Wang Dongsheng <dongsheng.wang@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoarm: cache: Implement cache range check for v7
Marek Vasut [Mon, 27 Jul 2015 20:34:17 +0000 (22:34 +0200)]
arm: cache: Implement cache range check for v7

Add code to aid tracking down cache alignment issues.
In case DEBUG is defined in the cache.c, this code will
check alignment of each attempt to flush/invalidate data
cache and print a warning if the alignment is incorrect.
If DEBUG is not defined, this code is optimized out.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Tom Rini <trini@konsulko.com>
8 years agoarmv7: add cacheline sizes where missing
Albert ARIBAUD [Wed, 27 Jan 2016 07:46:11 +0000 (08:46 +0100)]
armv7: add cacheline sizes where missing

Some armv7 targets are missing a cache line size declaration.
In preparation for "arm: cache: Implement cache range check for v7"
patch, add these declarations with the appropriate value for
the target's SoC or CPU.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoarm: Remove S bit from MMU section entry
Marek Vasut [Tue, 29 Dec 2015 18:44:02 +0000 (19:44 +0100)]
arm: Remove S bit from MMU section entry

Restore the old behavior of the MMU section entries configuration,
which is without the S-bit.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Simon Glass <sjg@chromium.org>
8 years agoarm: Replace test for CONFIG_ARMV7 with CONFIG_CPU_V7
Marek Vasut [Tue, 29 Dec 2015 18:44:01 +0000 (19:44 +0100)]
arm: Replace test for CONFIG_ARMV7 with CONFIG_CPU_V7

The arch/arm/lib/cache-cp15.c checks for CONFIG_ARMV7 and if this macro is
set, it configures TTBR0 register. This register must be configured for the
cache on ARMv7 to operate correctly.

The problem is that noone actually sets the CONFIG_ARMV7 macro and thus the
TTBR0 is not configured at all. On SoCFPGA, this produces all sorts of minor
issues which are hard to replicate, for example certain USB sticks are not
detected or QSPI NOR sometimes fails to write pages completely.

The solution is to replace CONFIG_ARMV7 test with CONFIG_CPU_V7 one. This is
correct because the code which added the test(s) for CONFIG_ARMV7 was added
shortly after CONFIG_ARMV7 was replaced by CONFIG_CPU_V7 and this code was
not adjusted correctly to reflect that change.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Simon Glass <sjg@chromium.org>
8 years agovideo: Correct 'tor' typo in comment
Simon Glass [Fri, 15 Jan 2016 01:10:52 +0000 (18:10 -0700)]
video: Correct 'tor' typo in comment

This should be 'rot', not 'tor'.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: test: Add console tests for truetype
Simon Glass [Fri, 15 Jan 2016 01:10:51 +0000 (18:10 -0700)]
video: test: Add console tests for truetype

This adds tests for the different character types, line wrap, scrolling and
backspace.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: sandbox: Enable truetype fonts for sandbox
Simon Glass [Fri, 15 Jan 2016 01:10:50 +0000 (18:10 -0700)]
video: sandbox: Enable truetype fonts for sandbox

Enable this feature so that truetype fonts can be used on the sandbox
console. Update the tests to select the normal/rotated console when needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agovideo: sandbox: Allow selection of font size and console name
Simon Glass [Fri, 15 Jan 2016 01:10:49 +0000 (18:10 -0700)]
video: sandbox: Allow selection of font size and console name

For testing it is useful to be able to select the font size and the console
driver for sandbox. Add this information to platform data and copy it to
the video device when needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Allow selection of the driver and font size
Simon Glass [Fri, 15 Jan 2016 01:10:48 +0000 (18:10 -0700)]
video: Allow selection of the driver and font size

Provide a way for the video console driver to be selected. This is
controlled by the video driver's private data. This can be set up when the
driver is probed so that it is ready for the video_post_probe() method.

The font size is provided as well. The console driver may or may not support
this depending on its capability.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agoLicense: Add the Open Font License
Simon Glass [Fri, 15 Jan 2016 01:10:47 +0000 (18:10 -0700)]
License: Add the Open Font License

This is used by two of the font files. Add this license to permit tracking
of this. The copyright text cannot be added to the .ttf files, so put it
here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agovideo: Add the Cantoraone decorative font
Simon Glass [Fri, 15 Jan 2016 01:10:46 +0000 (18:10 -0700)]
video: Add the Cantoraone decorative font

This font is a little more ornate than normal. Example uses are on security
screens where a feeling of formality is required.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Add the Rufscript handwriting font
Simon Glass [Fri, 15 Jan 2016 01:10:45 +0000 (18:10 -0700)]
video: Add the Rufscript handwriting font

This can be used when a a friendly 'hand-writing' font is needed. It helps
to make the device feel familiar.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Add the AnkaCoder mono-spaced font
Simon Glass [Fri, 15 Jan 2016 01:10:44 +0000 (18:10 -0700)]
video: Add the AnkaCoder mono-spaced font

This can be used when a mono-space font is needed, but the console font
is too small (such as with high-DPI displays).

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Add the Nimbus sans font
Simon Glass [Fri, 15 Jan 2016 01:10:43 +0000 (18:10 -0700)]
video: Add the Nimbus sans font

This provides a good-looking font for user prompts.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Add a console driver that uses TrueType fonts
Simon Glass [Fri, 15 Jan 2016 01:10:42 +0000 (18:10 -0700)]
video: Add a console driver that uses TrueType fonts

The existing 8x16 font is adequate for most purposes. It is small and fast.
However for boot screens where information must be presented to the user,
the console font is not ideal. Common requirements are larger and
better-looking fonts.

This console driver can use TrueType fonts built into U-Boot, and render
them at any size. This can be used in scripts to place text as needed on
the display.

This driver is not really designed to operate with the command line. Much
of U-Boot expects a fixed-width font. But to keep things working correctly,
rudimentary support for the console is provided. The main missing feature is
support for command-line editing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agovideo: Provide a backspace method
Simon Glass [Fri, 15 Jan 2016 01:10:41 +0000 (18:10 -0700)]
video: Provide a backspace method

With proportional fonts the vidconsole uclass cannot itself erase the
previous character. Provide an optional method so that the driver can
handle this operation.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Provide a signal when a new console line is started
Simon Glass [Fri, 15 Jan 2016 01:10:40 +0000 (18:10 -0700)]
video: Provide a signal when a new console line is started

When we start a new line (due to the user pressing return), signal this to
the driver so that it can flush its buffer of character positions.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Provide a left margin for the text console
Simon Glass [Fri, 15 Jan 2016 01:10:39 +0000 (18:10 -0700)]
video: Provide a left margin for the text console

Allow the left margin to be set so that text does not have to be right up
against the left side. On some panels this makes it hard to read.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Handle the 'bell' character
Simon Glass [Fri, 15 Jan 2016 01:10:38 +0000 (18:10 -0700)]
video: Handle the 'bell' character

This can be sent when to many characters are entered. Make sure it is
ignored and does not cause a character to be displayed.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Use fractional units for X coordinates
Simon Glass [Fri, 15 Jan 2016 01:10:37 +0000 (18:10 -0700)]
video: Use fractional units for X coordinates

With anti-aliased fonts we need a more fine-grained horizontal position
than a single pixel. Characters can be positioned to start part-way through
a pixel, with anti-aliasing (greyscale edges) taking care of the visual
effect.

To cope with this, use fractional units (1/256 pixel) for horizontal
positions in the text console.

Signed-off-by: Simon Glass <sjg@chromium.org>
[agust: rebased]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agovideo kconfig console_normal
Simon Glass [Fri, 22 Jan 2016 20:53:37 +0000 (21:53 +0100)]
video kconfig console_normal

Signed-off-by: Simon Glass <sjg@chromium.org>
[agust: rebased on current master]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agoMakefile: Add rules to build in .ttf files
Simon Glass [Fri, 15 Jan 2016 01:10:35 +0000 (18:10 -0700)]
Makefile: Add rules to build in .ttf files

Add rules to allow TrueType files to be compiled into U-Boot for use on
the video console.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agovideo: Add stb TrueType font renderer
Simon Glass [Fri, 15 Jan 2016 01:10:34 +0000 (18:10 -0700)]
video: Add stb TrueType font renderer

This is a header file which provides a fairly light-weight TrueType
rendering implementation. It is pulled from http://nothings.org/. The code
style does not comply with U-Boot but I think it is best to leave alone to
permit the source to be synced later if needed.

The only change is to fix a reference to fabs() which should route through
a macro to allow U-Boot to provide its own version.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoMerge git://git.denx.de/u-boot-dm
Tom Rini [Fri, 29 Jan 2016 18:47:38 +0000 (13:47 -0500)]
Merge git://git.denx.de/u-boot-dm

8 years agotest/py: dfu: allow boardenv to specify test sizes
Stephen Warren [Thu, 28 Jan 2016 20:14:16 +0000 (13:14 -0700)]
test/py: dfu: allow boardenv to specify test sizes

Allow the env__dfu_configs boardenv data to specify the set of DFU
transfer sizes to test. Manually specifying test sizes is useful if you
wish to test multiple DFU configurations (e.g. SD card ext4 filesystem, SD
card whole raw partition, RAM, etc.), but don't want to test every
single transfer size on each, to avoid bloating the overall time taken by
testing. If the boardenv doesn't specify a set of sizes, the built-in list
is used as a default, preserving backwards-compatibility.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: fix a couple typos in comments
Stephen Warren [Thu, 28 Jan 2016 17:18:03 +0000 (10:18 -0700)]
test/py: fix a couple typos in comments

s/updata/update/.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: run sandbox in source directory
Stephen Warren [Thu, 28 Jan 2016 06:57:53 +0000 (23:57 -0700)]
test/py: run sandbox in source directory

Some unit tests expect the cwd of the sandbox process to be the root
of the source tree. Ensure that requirement is met.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: pass test DTB to sandbox
Stephen Warren [Thu, 28 Jan 2016 06:57:52 +0000 (23:57 -0700)]
test/py: pass test DTB to sandbox

This is required for at least "ut dm" to operate correctly.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: correctly log xfail/xpass tests
Stephen Warren [Thu, 28 Jan 2016 06:57:51 +0000 (23:57 -0700)]
test/py: correctly log xfail/xpass tests

Tests can complete in passed, skipped, xpass, xfailed, or failed, states.
Currently the U-Boot log generation code doesn't handle the xfailed or
xpass states since they aren't used. Add support for the remaining states.
Without this, tests that xfail end up being reported as skipped.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: detect another "bad pattern" in console output
Stephen Warren [Thu, 28 Jan 2016 06:57:50 +0000 (23:57 -0700)]
test/py: detect another "bad pattern" in console output

Many error situations in U-Boot print the message:
    ### ERROR ### Please RESET the board ###

Add this to the list of bad patterns the test system detects. One
practical advantage of this change is to detect the case where sandbox
is told to use a particular DTB file, and the file cannot be opened.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: check for bad patterns everywhere we wait
Stephen Warren [Thu, 28 Jan 2016 06:57:49 +0000 (23:57 -0700)]
test/py: check for bad patterns everywhere we wait

Currently, bad patterns are only honored when executing a shell command.
Other cases, such as the initial boot-up of U-Boot or when interacting
with command output rather than gathering all output prior to the shell
prompt, do not currently look for bad patterns in console output. This
patch makes sure that bad patterns are honored everywhere.

One benefit of this change is that if U-Boot sandbox fails to start up,
the error message it emits can be caught immediately, rather than relying
on a (long) timeout when waiting for the expected signon message and/or
command prompt.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest.py: calculate bad patterns on change only
Stephen Warren [Thu, 28 Jan 2016 06:57:48 +0000 (23:57 -0700)]
test.py: calculate bad patterns on change only

A future patch will use the bad_patterns array in multiple places. Rather
than duplicating the code to calculate it, or even sharing it in a
function and simply calling it redundantly when nothing has changed, only
re-calculate the list when some change is made to it. This reduces work.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: fix spawn.expect multiple match handling
Stephen Warren [Thu, 28 Jan 2016 06:57:47 +0000 (23:57 -0700)]
test/py: fix spawn.expect multiple match handling

Multiple patterns may be passed to spawn.expect(). The pattern which
matches at the earliest position should be designated as the match. This
aspect works correctly. When multiple patterns match at the same position,
priority should be given the the earliest entry in the list of patterns.
This aspect does not work correctly. This patch fixes it.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/dm: clear unit test failure count each run
Stephen Warren [Thu, 28 Jan 2016 06:57:46 +0000 (23:57 -0700)]
test/dm: clear unit test failure count each run

The ut command prints a test failure count each time it is executed.
This is stored in a global variable which is never reset. Consequently,
the printed failure count accumulates across runs. Fix this by clearing
the counter each time "ut" is invoked.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: Provide custom IDs when parametrizing tests
Stephen Warren [Tue, 26 Jan 2016 22:26:04 +0000 (15:26 -0700)]
test/py: Provide custom IDs when parametrizing tests

When pytest generates the name for parametrized tests, simple parameter
values (ints, strings) get used directly, but more complex values such
as dicts are not handled. This yields test names such as:

    dfu[env__usb_dev_port0-env__dfu_config0]
    dfu[env__usb_dev_port0-env__dfu_config1]

Add some code to extract a custom fixture ID from the fixture values, so
that we end up with meaningful names such as:

    dfu[micro_b-emmc]
    dfu[devport2-ram]

If the boardenv file doesn't define custom names, the code falls back to
the old algorithm.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: Quote consistency
Stephen Warren [Tue, 26 Jan 2016 20:41:31 +0000 (13:41 -0700)]
test/py: Quote consistency

When converting test/py from " to ', I missed a few places (or added a
few inconsistencies later). Fix these.

Note that only quotes in code are converted; double-quotes in comments
and HTML are left as-is, since English and HTML use " not '.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: use " for docstrings
Stephen Warren [Tue, 26 Jan 2016 20:41:30 +0000 (13:41 -0700)]
test/py: use " for docstrings

Python's coding style docs indicate to use " not ' for docstrings.

test/py has other violations of the coding style docs, since the docs
specify a stranger style than I would expect, but nobody has complained
about those yet:-)

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: make net test aware of USB and PCI enumeration
Stephen Warren [Tue, 26 Jan 2016 18:10:14 +0000 (11:10 -0700)]
test/py: make net test aware of USB and PCI enumeration

The existing net test executes a list of commands supplied by boardenv
variable env__net_pre_commands. The idea was that boardenv would know
whether the Ethernet device was attached to USB, PCI, ... and hence was
the best place to put any commands required to probe the device.

However, this approach doesn't scale well when attempting to use a single
boardenv across multiple branches of U-Boot, some of which require "pci
enum" to enumerate PCI and others of which don't, or don't /yet/ simply
because various upstream changes haven't been merged down.

This patch updates the test to require that the boardenv state which HW
features are required for Ethernet to work, and lets the test itself map
that knowledge to the set of commands to execute. Since this mapping is
part of the test script, which is part of the U-Boot code/branch, this
approach is more scalable. It also feels cleaner, since again boardenv
is only providing data, rather than test logic.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agodistro bootcmd: enumerate PCI before network operations
Stephen Warren [Tue, 26 Jan 2016 18:10:13 +0000 (11:10 -0700)]
distro bootcmd: enumerate PCI before network operations

The PCI bus must be enumerated before PCI devices, such as Ethernet
devices, are known to U-Boot. Enhance the distro boot commands to perform
PCI enumeration when needed.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agodistro bootcmd: make net boot only optionally start USB
Stephen Warren [Tue, 26 Jan 2016 18:10:12 +0000 (11:10 -0700)]
distro bootcmd: make net boot only optionally start USB

Currently, the distro boot commands always enumerate USB devices before
performing network operations. However, depending on the board and end-
user configuration, network devices may not be attached to USB, and so
enumerating USB may not be necessary. Enhance the scripts to make this
step optional, so that the user can decrease boot time if they don't
need USB.

This change is performed by moving the "usb start" invocation into a
standalone variable. If the user desires, they can replace that
variable's value with some no-op command such as "true" instead.

Booting from a USB storage device always needs to enumerate USB devices,
so this action is still hard-coded.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoImplement "pci enum" command for CONFIG_DM_PCI
Stephen Warren [Tue, 26 Jan 2016 18:10:11 +0000 (11:10 -0700)]
Implement "pci enum" command for CONFIG_DM_PCI

With CONFIG_DM_PCI enabled, PCI buses are not enumerated at boot, as they
are without that config option enabled. No command exists to enumerate the
PCI buses. Hence, unless some board-specific code causes PCI enumeration,
PCI-based Ethernet devices are not detected, and network access is not
available.

This patch implements "pci enum" in the CONFIG_DM_PCI case, thus giving a
mechanism whereby PCI can be enumerated.

do_pci()'s handling of case 'e' is moved into a single location before the
dev variable is assigned, in order to skip calculation of dev. The enum
sub-command doesn't need the dev value, and skipping its calculation
avoids an irrelevant error being printed.

Using a command to initialize PCI like this has a disadvantage relative to
enumerating PCI at boot. In particular, Ethernet devices are not probed
during PCI enumeration, but only when used. This defers setting variables
such as ethact, ethaddr, etc. until the first network-related command is
executed. Hopefully this will not cause further issues. Perhaps in the
long term, we need a "net start/enum" command too?

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agotest/py: dfu: error out if USB device already exists
Stephen Warren [Tue, 26 Jan 2016 17:59:43 +0000 (10:59 -0700)]
test/py: dfu: error out if USB device already exists

The DFU test requests U-Boot configure its USB controller in device mode,
then waits for the host machine to enumerate the USB device and create a
device node for it. However, this wait can be fooled if the USB device
node already exists before the test starts, e.g. if some previous software
stack already configured the USB controller into device mode and never
de-configured it. This "previous software stack" could even be another
test/py test, if U-Boot's own USB teardown does not operate correctly. If
this happens, dfu-util may be run before U-Boot is ready to serve DFU
commands, which may cause false test failures.

Enhance the dfu test to fail if the device node exists before it is
expected to.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoARM: tegra: shut down USB device controller at boot
Stephen Warren [Tue, 26 Jan 2016 17:59:42 +0000 (10:59 -0700)]
ARM: tegra: shut down USB device controller at boot

When loading U-Boot into RAM over USB protocols using tools such as
tegrarcm or L4T's exec-uboot.sh/tegraflash.py, Tegra's USB device
mode controller is initialized and enumerated by the host PC running
the tool. Unfortunately, these tools do not shut down the USB
controller before executing the downloaded code, and so the host PC
does not "de-enumerate" the USB device. This patch implements optional
code to shut down the USB controller when U-Boot boots to avoid leaving
a stale USB device present.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: make crash detection more robust
Stephen Warren [Mon, 25 Jan 2016 22:07:58 +0000 (15:07 -0700)]
test/py: make crash detection more robust

test/py contains logic to detect the target crashing and rebooting by
searching the console output for a U-Boot signon message, which will
presumably be emitted when the system boots after the crash/reset.

Currently, this logic only searches for the exact signon message that
was printed by the U-Boot version under test, upon the assumption that
binary is written into flash, and hence will be the version booted after
any reset. However, this is not a valid assumption; some test setups
download the U-Boot-under-test into RAM and boot it from there, and in
such a scenario an arbitrary U-Boot version may be located in flash and
hence run after any reset.

Fix the reset detection logic to match any U-Boot signon message. This
prevents false negatives.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agodm: Remove device_probe_child()
Simon Glass [Mon, 25 Jan 2016 21:58:42 +0000 (14:58 -0700)]
dm: Remove device_probe_child()

This function is not used as the use case for it did not eventuate. Remove
it to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>