oweals/u-boot.git
8 years agoRe-enable setexpr on Raspberry Pi
Marco Schuster [Sun, 29 Nov 2015 18:30:42 +0000 (19:30 +0100)]
Re-enable setexpr on Raspberry Pi

This patch re-enables the setexpr command, I don't really understand
why it got excluded in the first place.

setexpr can be used e.g. to implement failed-boot-counters and
failovers to rescue firmware.

Signed-off-by: Marco Schuster <m.schuster91@googlemail.com>
8 years agocmd_boot: Add a poweroff command
Michael van Slingerland [Wed, 13 Jan 2016 18:31:17 +0000 (19:31 +0100)]
cmd_boot: Add a poweroff command

Add a 'poweroff' command to boot commands, this only gets enabled if the
board Kconfig does a "select CMD_POWEROFF".

Signed-off-by: Michael van Slingerland <michael@deviousops.nl>
[hdegoede@redhat.com: Make the cmd conditional on a CMD_POWEROFF Kconfig]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
8 years agonet: lpc32xx: fix ignored MDIO busy wait status on read
Vladimir Zapolskiy [Sun, 27 Dec 2015 03:12:24 +0000 (05:12 +0200)]
net: lpc32xx: fix ignored MDIO busy wait status on read

The change fixes PHY write operation, which incorrectly waits for
released busy state before issuing a write operation, this breaks
sequential write/read operation logic, because read operation
starts immediately on request and it completes, when busy state is
gone.

Instead of adding the second preceding busy state check to read
function, do busy state release check after issuing a write operation,
this method of operation is also recommended by the LPC32xx User's
Manual, see MII Mgmt Indicators Register notes:

  For PHY Write if scan is not used:
  1. Write 0 to MCMD
  2. Write PHY address and register address to MADR
  3. Write data to MWTD
  4. Wait for busy bit to be cleared in MIND

Reported-by: Alexandre Messier <amessier@tycoint.com>
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Tested-by: Alexandre Messier <amessier@tycoint.com>
8 years agosniper: Mux configuration cleanup
Paul Kocialkowski [Wed, 23 Dec 2015 10:28:30 +0000 (11:28 +0100)]
sniper: Mux configuration cleanup

This cleans up the mux configuration a bit, setting mmc clock signals to input
enabled and specifying pull-down (0) when pull is not used.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agosniper: Various boot-related env settings, devicetree support
Paul Kocialkowski [Wed, 23 Dec 2015 10:28:29 +0000 (11:28 +0100)]
sniper: Various boot-related env settings, devicetree support

This adds various env settings for more flexible boot possibilities, including
devicetree support and distro defaults config.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
8 years agolpc32xx: devkit3250: update board configuration file
Vladimir Zapolskiy [Sat, 19 Dec 2015 21:41:23 +0000 (23:41 +0200)]
lpc32xx: devkit3250: update board configuration file

The change updates DevKit3250 board powerd by NXP LPC3250 SoC:
* due to increased resulting U-boot image size give more space to
  store loaded and relocated versions,
* add DMA support, which is used by NAND SLC driver,
* add NXP OHCI and PHY drivers to the image,
* add USB, JFFS and FAT commands.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
8 years agoarm: lpc32xx: switch SPL builds to driver model
Vladimir Zapolskiy [Sat, 19 Dec 2015 21:29:26 +0000 (23:29 +0200)]
arm: lpc32xx: switch SPL builds to driver model

For NXP LPC32xx boards the change enables SPL_DM option, this allows
to use any driver model UART driver in SPL images, hence a restriction
on HSUART in SPL image is removed and well as definitions for non-DM
NS16550 driver, its DM version is used instead.

Because SPL_DM requires malloc(), enable CONFIG_SPL_SYS_MALLOC_SIMPLE
for LPC32xx boards.

The change adds about 5KB to the resulting SPL image (for devkit3250
board SPL image is increased from 10672 to 15608 bytes).

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoarm: lpc32xx: switch serial console to driver model
Vladimir Zapolskiy [Sat, 19 Dec 2015 21:29:25 +0000 (23:29 +0200)]
arm: lpc32xx: switch serial console to driver model

On NXP LPC32xx platform for non-SPL builds the change adds
standard (NS16550) and high-speed UARTs to driver model.
Due to specific of DM NS16550 device description UART clock can not be
got in runtime and by default it is set to 13MHz, if board PERIPH_CLK
is different, this should be specified in board configuration file.

For SPL builds HSUARTs are disabled and non-DM NS16550 driver is
compiled, if needed.

The change also updates default configs of devkit3250 and work_92105
boards to reflect updates in platform files.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoserial: lpc32xx hsuart: port driver to driver model
Vladimir Zapolskiy [Sat, 19 Dec 2015 21:29:24 +0000 (23:29 +0200)]
serial: lpc32xx hsuart: port driver to driver model

The change ports NXP LPC32xx 14-clock UART device driver to driver
model.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agotest/fs: error case fixes/enhancements
Stephen Warren [Mon, 14 Dec 2015 22:01:15 +0000 (15:01 -0700)]
test/fs: error case fixes/enhancements

- Use "mkdir -p" to avoid errors when intermediate directories are
  missing.
- Fall back to "dd" when "fallocate" fails. For example, fallocate isn't
  supported on ext4.
- Add error checking for test image generation. Without this, the test
  simply plows on spewing all kinds of errors which are hard to
  immediately root-cause.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
8 years agoomap4_panda: Convert to config_distro_bootcmd.h
Tom Rini [Thu, 10 Dec 2015 21:46:03 +0000 (16:46 -0500)]
omap4_panda: Convert to config_distro_bootcmd.h

Based on the am335x_evm conversion, switch to config_distro_bootcmd for
mmc and pxe.  Tested with Fedora 23.

Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoti_armv7_common.h: Add CONFIG_CMD_EXT4_WRITE
Tom Rini [Thu, 10 Dec 2015 21:46:02 +0000 (16:46 -0500)]
ti_armv7_common.h: Add CONFIG_CMD_EXT4_WRITE

Given that with config_distro_defaults.h we always have ext4 read
support, add in write support.

Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoam335x_evm.h: unsed CONFIG_BOOTDELAY
Tom Rini [Thu, 10 Dec 2015 21:46:01 +0000 (16:46 -0500)]
am335x_evm.h: unsed CONFIG_BOOTDELAY

Now that ti_armv7_common.h uses config_distro_defaults.h we don't need
to include it again and then undef CONFIG_BOOTDELAY

Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoext4_common.c: Clean up failure cases in alloc_triple_indirect_block
Tom Rini [Thu, 10 Dec 2015 21:42:21 +0000 (16:42 -0500)]
ext4_common.c: Clean up failure cases in alloc_triple_indirect_block

As noted by Coverity, when we have an error in
alloc_triple_indirect_block we will leak ti_pbuff_start_addr as it's not
being freed.  Further inspection here shows that we could also leak
ti_cbuff_start_addr in one corner case so free that as well.

Reported-by: Coverity (CID 131205, 131206)
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoums: support multiple LUNs at once
Stephen Warren [Mon, 7 Dec 2015 18:38:50 +0000 (11:38 -0700)]
ums: support multiple LUNs at once

Extend the ums command to accept a list of block devices. Each of these
will be exported as a separate LUN. An example use-case would be:

ums 0 mmc 0,0.1,0.2

... which would export LUNs for eMMC 0's user data, boot0, and boot1 HW
partitions. This is useful since it allows the host access to everything
on the eMMC without having to somehow stop the ums command from executing
and restart it with different parameters.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agommc: store hwpart in the block device
Stephen Warren [Mon, 7 Dec 2015 18:38:49 +0000 (11:38 -0700)]
mmc: store hwpart in the block device

This will allow us to have multiple block device structs each referring
to the same eMMC device, yet different HW partitions.

For now, there is still a single block device per eMMC device. As before,
this block device always accesses whichever HW partition was most recently
selected. Clients wishing to make use of multiple block devices referring
to different HW partitions can simply take a copy of this block device
once it points at the correct HW partition, and use each one as they wish.
This feature will be used by the next patch.

In the future, perhaps get_device() could be enhanced to return a
dynamically allocated block device struct, to avoid the client needing to
copy it in order to maintain multiple block devices. However, this would
require all users to be updated to free those block device structs at some
point, which is rather a large change.

Most callers of mmc_switch_part() wish to permanently switch the default
MMC block device's HW partition. Enhance mmc_switch_part() so that it does
this. This removes the need for callers to do this. However,
common/env_mmc.c needs to save and restore the current HW partition. Make
it do this more explicitly.

Replace use of mmc_switch_part() with mmc_select_hwpart() in order to
remove duplicate code that skips the call if that HW partition is already
selected.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoblock: pass block dev not num to read/write/erase()
Stephen Warren [Mon, 7 Dec 2015 18:38:48 +0000 (11:38 -0700)]
block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoarm: move gd handling outside of C code
Albert ARIBAUD [Wed, 25 Nov 2015 16:56:33 +0000 (17:56 +0100)]
arm: move gd handling outside of C code

As of gcc 5.2.1 for Thumb-1, it is not possible any
more to assign gd from C code, as gd is mapped to r9,
and r9 may now be saved in the prolog sequence, and
restored in the epilog sequence, of any C functions.

Therefore arch_setup_gd(), which is supposed to set
r9, may actually have no effect, causing U-Boot to
use a bad address to access GD.

Fix this by never calling arch_setup_gd() for ARM,
and instead setting r9 in arch/arm/lib/crt0.S, to
the value returned by board_init_f_alloc_reserve().

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoFix board init code to respect the C runtime environment
Albert ARIBAUD [Wed, 25 Nov 2015 16:56:32 +0000 (17:56 +0100)]
Fix board init code to respect the C runtime environment

board_init_f_mem() alters the C runtime environment's
stack it is actually already using. This is not a valid
behaviour within a C runtime environment.

Split board_init_f_mem into C functions which do not alter
their own stack and always behave properly with respect to
their C runtime environment.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Thomas Chou <thomas@wytron.com.tw>
8 years agoMerge branch 'master' of git://www.denx.de/git/u-boot-microblaze
Tom Rini [Wed, 13 Jan 2016 23:27:40 +0000 (18:27 -0500)]
Merge branch 'master' of git://denx.de/git/u-boot-microblaze

8 years agoMerge git://git.denx.de/u-boot-net
Tom Rini [Wed, 13 Jan 2016 23:03:05 +0000 (18:03 -0500)]
Merge git://git.denx.de/u-boot-net

8 years agohash.c: Conditionally compile hash_command, static hash_show
Tom Rini [Tue, 5 Jan 2016 13:47:48 +0000 (08:47 -0500)]
hash.c: Conditionally compile hash_command, static hash_show

The function hash_show is now only called by hash_command, so mark it as
static (and drop from hash.h).  We only call hash_command when any of
CONFIG_CMD_CRC32, CONFIG_CMD_SHA1SUM or CONFIG_CMD_HASH are set.  Since
hash.c is linked in unconditionally we must take extra care with
functions that bring in read-only strings as these will not be
discarded.

Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agopart_dos.c: Don't wrap to negative after 2G sectors
Stefan Monnier [Tue, 25 Aug 2015 19:24:13 +0000 (15:24 -0400)]
part_dos.c: Don't wrap to negative after 2G sectors

In order to support large IDE disks we need to make certain types be
lbaint_t now.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Stefan Monnier <monnier@iro.umontreal.ca>
8 years agoimage: check "bootm_low" and "bootm_size" if "initrd_high" is missing
Masahiro Yamada [Thu, 17 Dec 2015 08:19:35 +0000 (17:19 +0900)]
image: check "bootm_low" and "bootm_size" if "initrd_high" is missing

To boot Linux, we should prevent Initramdisk and FDT from going too
high.

Currently, boot_relocate_fdt() checks "fdt_high" environment first,
and then falls back to getenv_bootm_mapsize() + getenv_bootm_low()
if "fdt_high" is missing.

On the other hand, boot_ramdisk_high() only checks "initrd_high" to
get the address limit for the Initramdisk.  We also want to let this
case fall back to getenv_bootm_mapsize() + getenv_bootm_low().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agodm: core: Add a new api to get indexed device address
Mugunthan V N [Wed, 23 Dec 2015 15:09:36 +0000 (20:39 +0530)]
dm: core: Add a new api to get indexed device address

Add new api to get device address based on index.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Acked-by: Jagan Teki <jteki@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agopower: pmic.h: Drop include <spi.h>
Jagan Teki [Tue, 5 Jan 2016 08:14:26 +0000 (13:44 +0530)]
power: pmic.h: Drop include <spi.h>

include/power/pmic.h never used any generic spi code
from include/spi.h, but this has been added in below commit.
"dm: pmic: add implementation of driver model pmic uclass"
(sha1: 4d9057e82be11a862db411c4867e859fe0d4ca2a)

Adding functionalities in include/spi.h will trigger a build
issue as this been added used in include/power/pmic.h

Build issue on trats2 with adding BIT macro on spi.h:
----------------------------------------------------
  CC      lib/asm-offsets.s
In file included from include/power/pmic.h:15:0,
                 from include/power/max77686_pmic.h:11,
                 from include/configs/trats2.h:212,
                 from include/config.h:5,
                 from include/common.h:18,
                 from lib/asm-offsets.c:15:
include/spi.h: In function 'spi_w8r8':
include/spi.h:327:2: warning: implicit declaration of function 'BIT' [-Wimplicit-function-declaration]

Cc: Simon Glass <sjg@chromium.org>
Cc: Przemyslaw Marczak <p.marczak@samsung.com>
Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agodefconfig: am437x_sk_evm: enable spi driver model
Mugunthan V N [Wed, 23 Dec 2015 15:09:49 +0000 (20:39 +0530)]
defconfig: am437x_sk_evm: enable spi driver model

enable spi driver model for am437x_sk_evm as ti_qspi supports
driver model

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agoarm: dts: am4372: add qspi register maps for memory map
Mugunthan V N [Wed, 23 Dec 2015 15:09:48 +0000 (20:39 +0530)]
arm: dts: am4372: add qspi register maps for memory map

Add qspi memory map address to device tree.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agoam43xx_evm: qspi: do not define DM_SPI and DM_SPI_FLASH for spl
Mugunthan V N [Wed, 23 Dec 2015 15:09:47 +0000 (20:39 +0530)]
am43xx_evm: qspi: do not define DM_SPI and DM_SPI_FLASH for spl

Since OMAP's spl doesn't support DM currently, do not define
DM_SPI and DM_SPI_FLASH for spl build.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agodefconfig: dra74_evm: enable spi driver model
Mugunthan V N [Wed, 23 Dec 2015 15:09:46 +0000 (20:39 +0530)]
defconfig: dra74_evm: enable spi driver model

enable spi driver model for dra74_evm as ti_qspi supports
driver model

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agodefconfig: dra72_evm: enable spi driver model
Mugunthan V N [Wed, 23 Dec 2015 15:09:45 +0000 (20:39 +0530)]
defconfig: dra72_evm: enable spi driver model

enable mmc driver model for dra72_evm as ti_qspi supports
driver model

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agoarm: dts: dra72-evm: add spi-flash comaptible for flash
Mugunthan V N [Wed, 23 Dec 2015 15:09:44 +0000 (20:39 +0530)]
arm: dts: dra72-evm: add spi-flash comaptible for flash

In U-Boot most flashes uses "spi-flash" as compatible to bind the
device to flash driver, so adding "spi-flash" compatible to
m25p80 node.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agoarm: dts: dra7-evm: add spi-flash comaptible for flash
Mugunthan V N [Wed, 23 Dec 2015 15:09:43 +0000 (20:39 +0530)]
arm: dts: dra7-evm: add spi-flash comaptible for flash

In U-Boot most flashes uses "spi-flash" as compatible to bind the
device to flash driver, so adding "spi-flash" compatible to
m25p80 node.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agoarm: dts: am437x-gp-evm: add spi-flash comaptible for flash
Mugunthan V N [Wed, 23 Dec 2015 15:09:42 +0000 (20:39 +0530)]
arm: dts: am437x-gp-evm: add spi-flash comaptible for flash

In U-Boot most flashes uses "spi-flash" as compatible to bind the
device to flash driver, so adding "spi-flash" compatible to
m25p80 node.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agoarm: dts: dra7: add qspi register maps for memory map and control module
Mugunthan V N [Wed, 23 Dec 2015 15:09:41 +0000 (20:39 +0530)]
arm: dts: dra7: add qspi register maps for memory map and control module

Add qspi memory map and control module register maps to device tree.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agodrivers: spi: ti_qspi: convert driver to adopt device driver model
Mugunthan V N [Wed, 23 Dec 2015 15:09:40 +0000 (20:39 +0530)]
drivers: spi: ti_qspi: convert driver to adopt device driver model

adopt ti_qspi driver to device driver model

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agodts: dra7: add spi alias for qspi
Mugunthan V N [Wed, 23 Dec 2015 15:09:39 +0000 (20:39 +0530)]
dts: dra7: add spi alias for qspi

add spi alias for qspi so that spi probes the device and driver
successfully.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agodra7xx_evm: qspi: do not define DM_SPI and DM_SPI_FLASH for spl
Mugunthan V N [Wed, 23 Dec 2015 15:09:38 +0000 (20:39 +0530)]
dra7xx_evm: qspi: do not define DM_SPI and DM_SPI_FLASH for spl

Since OMAP's spl doesn't support DM currently, do not define DM_SPI and
DM_SPI_FLASH for spl build.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agospi: Add support for dual and quad mode
Mugunthan V N [Wed, 23 Dec 2015 15:09:37 +0000 (20:39 +0530)]
spi: Add support for dual and quad mode

spi bus can support dual and quad wire data transfers for tx and
rx. So defining dual and quad modes for both tx and rx. Also add
support to parse bus width used for spi tx and rx transfers.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agodrivers: spi: ti_qspi: prepare driver for DM conversion
Mugunthan V N [Wed, 23 Dec 2015 15:09:35 +0000 (20:39 +0530)]
drivers: spi: ti_qspi: prepare driver for DM conversion

Prepare driver for DM conversion.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agodrivers: spi:ti_qspi: change ti_qspi_slave to ti_qspi_priv for driver model conversion
Mugunthan V N [Wed, 23 Dec 2015 15:09:34 +0000 (20:39 +0530)]
drivers: spi:ti_qspi: change ti_qspi_slave to ti_qspi_priv for driver model conversion

Changing the ti_qspi_priv structure and its instance names from
to priv for driver mode conversion.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agodrivers: spi: ti_qspi: do not hard code chip select for memory map configuration
Mugunthan V N [Wed, 23 Dec 2015 15:09:33 +0000 (20:39 +0530)]
drivers: spi: ti_qspi: do not hard code chip select for memory map configuration

To enable memory map in dra7xx, specific chip select must be
written to control module register. But this hard coded to chip
select 1, fixing it by writing the specific chip select value to
control module register.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agospi: Add SPI_TX_DUAL mode
Jagan Teki [Mon, 28 Dec 2015 17:25:50 +0000 (22:55 +0530)]
spi: Add SPI_TX_DUAL mode

Added SPI_TX_DUAL mode flag.

Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Mugunthan V N <mugunthanvnm@ti.com>
Tested-by: Jagan Teki <jteki@openedev.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agosf: Make IO modes at last in read modes
Jagan Teki [Mon, 28 Dec 2015 16:38:40 +0000 (22:08 +0530)]
sf: Make IO modes at last in read modes

SLOW, FAST, DUAL, DUAL_IO, QUAD, QUAD_IO changed order to
SLOW, FAST, DUAL, QUAD, DUAL_IO, QUAD_IO

Cc: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Tested-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agospi: Minor cleanup
Jagan Teki [Tue, 29 Dec 2015 06:42:30 +0000 (12:12 +0530)]
spi: Minor cleanup

- Add comments on mode_rx
- Tab space's

Cc: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Tested-by: Mugunthan V N <mugunthanvnm@ti.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agospi: Use BIT macro
Jagan Teki [Mon, 28 Dec 2015 16:54:08 +0000 (22:24 +0530)]
spi: Use BIT macro

Used BIT macro like 1 << nr as BIT(nr) where nr is 0...n

Cc: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Tested-by: Mugunthan V N <mugunthanvnm@ti.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agospi: Fix bit assignment with flags
Jagan Teki [Wed, 16 Dec 2015 10:21:06 +0000 (15:51 +0530)]
spi: Fix bit assignment with flags

Fixed bit assignment with flags members on spi_slave{}

Cc: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Tested-by: Mugunthan V N <mugunthanvnm@ti.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agospi: Move flags macro's to spi_slave{} members
Jagan Teki [Mon, 28 Dec 2015 16:53:14 +0000 (22:23 +0530)]
spi: Move flags macro's to spi_slave{} members

This patch moves flags macro's to respective member
position on spi_slave{}, for better readabilty and
finding the respective member macro's easily.

Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Tested-by: Mugunthan V N <mugunthanvnm@ti.com>
Tested-by: Jagan Teki <jteki@openedev.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agospi: Rename op_mode_rx to mode_rx
Jagan Teki [Wed, 16 Dec 2015 09:54:24 +0000 (15:24 +0530)]
spi: Rename op_mode_rx to mode_rx

Since spi rx mode macro's are renamed to simple and
meaninfull, this patch will rename the respective
structure members.

Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Tested-by: Mugunthan V N <mugunthanvnm@ti.com>
Tested-by: Jagan Teki <jteki@openedev.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agospi: Rename SPI_OPM_RX_* to SPI_RX_*
Jagan Teki [Wed, 16 Dec 2015 09:45:41 +0000 (15:15 +0530)]
spi: Rename SPI_OPM_RX_* to SPI_RX_*

SPI_OPM_RX_AS  - SPI_RX_SLOW
SPI_OPM_RX_AF - SPI_RX_FAST
SPI_OPM_RX_DOUT - SPI_RX_DUAL
SPI_OPM_RX_QOF - SPI_RX_QUAD

Cc: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Tested-by: Mugunthan V N <mugunthanvnm@ti.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agospi: Remove SPI_OPM_RX_DIO|QIOF
Jagan Teki [Wed, 16 Dec 2015 09:31:23 +0000 (15:01 +0530)]
spi: Remove SPI_OPM_RX_DIO|QIOF

SPI_OPM_RX_DIO and SPI_OPM_RX_QIOF are rx IO
commands/opmodes for dual and quad. Usually IO
operation's are referred to flash protocol rather
with spi controller protocol, these are still present
in flash side for the usage of spi-nor controllers.

Cc: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Tested-by: Mugunthan V N <mugunthanvnm@ti.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agospi: Remove SPI_OPM_RX_EXTN
Jagan Teki [Wed, 16 Dec 2015 09:23:59 +0000 (14:53 +0530)]
spi: Remove SPI_OPM_RX_EXTN

SPI_OPM_RX_EXTN is a combination of all rx opmode's
and spi driver shall use any one of the rx mode at
a time not the combination and it is true in case of
flash where spi_flash_table mention combination of
supported read opmodes so-that the required one
will pick based on the rx mode from spi driver.

Cc: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Tested-by: Mugunthan V N <mugunthanvnm@ti.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agosf: Write quad bit along with read status
Jagan Teki [Wed, 16 Dec 2015 08:18:08 +0000 (13:48 +0530)]
sf: Write quad bit along with read status

While setting quad bit on spansion, macronix code
is writing only particular quad bit this may give
wrong functionality with other register bits,
So this patch fix the issue where it with write
previous read reg status along  particular quad bit.

Cc: Vignesh R <vigneshr@ti.com>
Cc: Mugunthan V N <mugunthanvnm@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agosf: Read back and check once macronix quad bit set
Jagan Teki [Tue, 15 Dec 2015 07:12:02 +0000 (12:42 +0530)]
sf: Read back and check once macronix quad bit set

One macronix quad bit set using SR, it's good to
read back and check the written bit and also if
it's already been set check for the bit and return.

Cc: Vignesh R <vigneshr@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agosf: Read back and check once spansion quad bit set
Jagan Teki [Tue, 15 Dec 2015 06:58:39 +0000 (12:28 +0530)]
sf: Read back and check once spansion quad bit set

One spansion quad bit set using CR, it's good to
read back and check the written bit and also if
it's already been set check for the bit and return.

Cc: Vignesh R <vigneshr@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Tested-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agosf: Fix quad bit set for micron devices
Jagan Teki [Mon, 14 Dec 2015 12:45:39 +0000 (18:15 +0530)]
sf: Fix quad bit set for micron devices

Setting up quad bit for micron devices need to do the
same way as other flash devices like spansion, winbond
etc does using enhanced volatile config register so this
patch adds this support instead of printing "QEB is volatile"

Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Peter Pan <peterpandong@micron.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agosf: Use BIT macro
Jagan Teki [Mon, 14 Dec 2015 12:42:04 +0000 (18:12 +0530)]
sf: Use BIT macro

Used BIT macro like 1 << nr as BIT(nr) where nr is 0...n

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agosf: Minor cleanup
Jagan Teki [Mon, 14 Dec 2015 12:33:54 +0000 (18:03 +0530)]
sf: Minor cleanup

- Tab space
- Place all read commands at one place.
- Re-arrange write commands.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agosf: Remove spi_flash_remove
Jagan Teki [Mon, 14 Dec 2015 03:32:06 +0000 (09:02 +0530)]
sf: Remove spi_flash_remove

Use direct call to device_remove instead of exctra
spi_flash_remove defination.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agosf: Rename bank_end to bar_end in read_bar
Jagan Teki [Sun, 13 Dec 2015 17:40:33 +0000 (23:10 +0530)]
sf: Rename bank_end to bar_end in read_bar

bar_end gives more meaningfull compared to bank_end and
spi_flash_write_bar uses bar_end so replaced bank_end with
bar_end in spi_flash_read_bar

Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agosf: Rename spi_flash_set_* functions
Jagan Teki [Sun, 13 Dec 2015 17:34:46 +0000 (23:04 +0530)]
sf: Rename spi_flash_set_* functions

Since quad_mode functions are local to spi flash core,
rename them to a meaningful and readable names.

Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agosf: Move spi_read_cmds_array locally
Jagan Teki [Sun, 13 Dec 2015 16:20:26 +0000 (21:50 +0530)]
sf: Move spi_read_cmds_array locally

Since spi_read_cmds_array is used locally in
spi_flash_scan, so move array to locally used
function instead of defining global array.

Tested-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agospi: Rename SPI_TX_BP|QPP to SPI_TX_BYTE|QUAD
Jagan Teki [Sun, 13 Dec 2015 14:42:45 +0000 (20:12 +0530)]
spi: Rename SPI_TX_BP|QPP to SPI_TX_BYTE|QUAD

Since SPI_TX_* are spi_slave{} members so use spi protocol
notation instead spi flash programming, like

SPI_TX_BP  => SPI_TX_BYTE
SPI_TX_QPP => SPI_TX_QUAD

Cc: Simon Glass <sjg@chromium.org>
Tested-by: Jagan Teki <jteki@openedev.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agospi: Use mode instead of op_mode_tx
Jagan Teki [Sun, 13 Dec 2015 14:40:33 +0000 (20:10 +0530)]
spi: Use mode instead of op_mode_tx

Used mode member from spi_slave{} instead of op_mode_tx.

Cc: Simon Glass <sjg@chromium.org>
Tested-by: Jagan Teki <jteki@openedev.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agospi: make mode visible to both dm and non-dm
Jagan Teki [Mon, 14 Dec 2015 06:45:17 +0000 (12:15 +0530)]
spi: make mode visible to both dm and non-dm

Couldn't find the exact reason to define 'mode' for dm,
probably it is not using in non-dm drivers but it need
to visible both dm and non-dm as mode data is getting
dereferred in spi flash core ie common to both.

Cc: Simon Glass <sjg@chromium.org>
Tested-by: Jagan Teki <jteki@openedev.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agosf: Get spi locally from spi_flash
Jagan Teki [Sat, 12 Dec 2015 06:21:57 +0000 (11:51 +0530)]
sf: Get spi locally from spi_flash

For better code readabilty, get the spi pointer from
spi_flash{} locally and use it instead of direct
dereferring spi pinter as flash->spi->*

Tested-by: Jagan Teki <jteki@openedev.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
8 years agoarm: socfpga: Enable SPL_DM_SEQ_ALIAS for all SOCFPGA configs
Nathan Rossi [Thu, 7 Jan 2016 17:00:48 +0000 (03:00 +1000)]
arm: socfpga: Enable SPL_DM_SEQ_ALIAS for all SOCFPGA configs

This feature is required in SPL to enable support for loading from SPI
flash.

Also clean up the #define in socfpga_common.h.

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Acked: Marek Vasut <marex@denx.de>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Chin-Liang See <clsee@altera.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
8 years agoarm: mvebu: Select SPL_DM_SEQ_ALIAS
Nathan Rossi [Thu, 7 Jan 2016 17:00:47 +0000 (03:00 +1000)]
arm: mvebu: Select SPL_DM_SEQ_ALIAS

Select SPL_DM_SEQ_ALIAS which is required for certain uclasses,
specifically SPI Flash.

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Stefan Roese <sr@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
8 years agoarm: zynq: Enable SPL_DM_SEQ_ALIAS for all Zynq configs
Nathan Rossi [Thu, 7 Jan 2016 17:00:46 +0000 (03:00 +1000)]
arm: zynq: Enable SPL_DM_SEQ_ALIAS for all Zynq configs

This feature is required in SPL to enable support for loading from SPI
flash when the device is booted from QSPI.

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
8 years agospl: dm: Add SPL_DM_SEQ_ALIAS config option
Nathan Rossi [Thu, 7 Jan 2016 17:00:45 +0000 (03:00 +1000)]
spl: dm: Add SPL_DM_SEQ_ALIAS config option

The Device Model sequence alias feature is required by some Uclasses.
Instead of disabling the feature for all SPL targets allow it to be
configured.

The config option is disabled by default to reduce code size for targets
that are not interested or do not require this feature.

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Marek Vasut <marex@denx.de>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
8 years agoMerge git://git.denx.de/u-boot-dm
Tom Rini [Tue, 12 Jan 2016 23:12:42 +0000 (18:12 -0500)]
Merge git://git.denx.de/u-boot-dm

8 years agosandbox: eth-raw-os.c: Ensure that our interface name is not too long
Tom Rini [Tue, 8 Dec 2015 03:26:34 +0000 (22:26 -0500)]
sandbox: eth-raw-os.c: Ensure that our interface name is not too long

Coverity notes that we do not ensure when we copy ifname we still have
space left to ensure NULL termination.  As cannot control the size of
ifr_name we must make sure that our argument will not overflow the
buffer.

Reported-by: Coverity (CID 131094)
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agodm: core: Add option to configure an offset for the address translation
Stefan Roese [Mon, 14 Dec 2015 15:18:15 +0000 (16:18 +0100)]
dm: core: Add option to configure an offset for the address translation

Some platforms need to ability to configure an offset to the standard
addresses extracted from the device-tree. This patch allows this by
adding a function to DM to configure this offset (if needed).

Signed-off-by: Stefan Roese <sr@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Fixed space before tab:
Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Use the debug UART on rk3036
Simon Glass [Mon, 14 Dec 2015 04:37:00 +0000 (21:37 -0700)]
rockchip: Use the debug UART on rk3036

Rather than using a new debug UART implementation, use the standard one
provided by U-Boot.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Thomas Chou <thomas@wytron.com.tw>
8 years agodm: ns16550: Allow the driver to be omitted if requested
Simon Glass [Mon, 14 Dec 2015 04:36:59 +0000 (21:36 -0700)]
dm: ns16550: Allow the driver to be omitted if requested

Allow the ns16550 debug UART to be used without the full driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Thomas Chou <thomas@wytron.com.tw>
8 years agodm: serial: Allow the UART driver to be dropped from the image
Simon Glass [Mon, 14 Dec 2015 04:36:58 +0000 (21:36 -0700)]
dm: serial: Allow the UART driver to be dropped from the image

In very very space-constrained devices even the full UART driver is too
large. In this case the debug UART can still be used in some cases.

Add options to enable the UART driver in SPL and U-Boot proper. Enable both
options by default.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Thomas Chou <thomas@wytron.com.tw>
8 years agodm: net: usb: Convert mcs7830 driver to support driver model
Simon Glass [Sun, 29 Nov 2015 20:18:11 +0000 (13:18 -0700)]
dm: net: usb: Convert mcs7830 driver to support driver model

Adjust this driver to support driver model for Ethernet.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agodm: net: usb: Refactor mcs7830 driver ready for DM conversion
Simon Glass [Sun, 29 Nov 2015 20:18:10 +0000 (13:18 -0700)]
dm: net: usb: Refactor mcs7830 driver ready for DM conversion

Remove stamp data and create common functions for the main Ethernet
operations. This will make it easier to convert this driver to support
driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agopci: Tidy up comments in pci_bind_bus_devices()
Simon Glass [Sun, 29 Nov 2015 20:18:09 +0000 (13:18 -0700)]
pci: Tidy up comments in pci_bind_bus_devices()

The current comments are confusing. We don't actually bind a generic device
when the device tree has no information. We try to scan available PCI
drivers. Update the comments to reflect this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: Convert PCI MMC over to use DM PCI API
Simon Glass [Sun, 29 Nov 2015 20:18:08 +0000 (13:18 -0700)]
dm: Convert PCI MMC over to use DM PCI API

At present pci_mmc_init() does not correctly use the PCI function since the
list it passes is not terminated. The array size passed to pci_mmc_init() is
actually not used correctly. Fix this and adjust the pci_mmc_init() to scan
all available MMC devices.

Adjust this code to use the new driver model PCI API.

This should move over to the new MMC uclass at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: usb: Convert echi-pci to use new DM PCI API
Simon Glass [Sun, 29 Nov 2015 20:18:07 +0000 (13:18 -0700)]
dm: usb: Convert echi-pci to use new DM PCI API

Convert this driver to use the new driver model PCI API.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Marek Vasut <marex@denx.de>
8 years agodm: ahci: Convert to use new DM PCI API
Simon Glass [Sun, 29 Nov 2015 20:18:06 +0000 (13:18 -0700)]
dm: ahci: Convert to use new DM PCI API

Convert this driver to use the new driver model PCI API.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: pci: Switch to DM API for PCI address mapping
Simon Glass [Sun, 29 Nov 2015 20:18:05 +0000 (13:18 -0700)]
dm: pci: Switch to DM API for PCI address mapping

We should use the new address mapping functions unless we are in
compatibility mode. Disable the old functions by default.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: net: Convert rtl8169 to use DM PCI API
Simon Glass [Sun, 29 Nov 2015 20:18:04 +0000 (13:18 -0700)]
dm: net: Convert rtl8169 to use DM PCI API

Update this driver to use the proper driver-model PCI API functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agodm: pci: Add driver model API functions for address mapping
Simon Glass [Sun, 29 Nov 2015 20:18:03 +0000 (13:18 -0700)]
dm: pci: Add driver model API functions for address mapping

At present the PCI address map functions use the old API. Add new functions
for this so that drivers can be converted.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: test: Convert PCI tests to use the DM PCI API
Simon Glass [Sun, 29 Nov 2015 20:18:02 +0000 (13:18 -0700)]
dm: test: Convert PCI tests to use the DM PCI API

Update these tests to use driver model API functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: tegra: net: Convert tegra boards to driver model for Ethernet
Simon Glass [Sun, 29 Nov 2015 20:18:01 +0000 (13:18 -0700)]
dm: tegra: net: Convert tegra boards to driver model for Ethernet

Adjust all Tegra boards to use driver model for Ethernet, now that the
required drivers are converted.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agodm: pci: Drop the old version of pci_find_class()
Simon Glass [Sun, 29 Nov 2015 20:18:00 +0000 (13:18 -0700)]
dm: pci: Drop the old version of pci_find_class()

Move this function into the compatibility file so that it is not available
by default.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: pci: Drop the old version of pci_find_device/s()
Simon Glass [Sun, 29 Nov 2015 20:17:59 +0000 (13:17 -0700)]
dm: pci: Drop the old version of pci_find_device/s()

Move these functions into the compatibility file so that they are not
available by default.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: x86: pci: Adjust bios_run_on_x86() to use the DM PCI API
Simon Glass [Sun, 29 Nov 2015 20:17:58 +0000 (13:17 -0700)]
dm: x86: pci: Adjust bios_run_on_x86() to use the DM PCI API

This function should take a struct udevice rather than pci_dev_t. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: pci: video: Convert video and pci_rom to use DM PCI API
Simon Glass [Sun, 29 Nov 2015 20:17:57 +0000 (13:17 -0700)]
dm: pci: video: Convert video and pci_rom to use DM PCI API

Adjust these files to use the driver-model PCI API instead of the legacy
functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: Convert bios_interrupts to use DM PCI API
Simon Glass [Sun, 29 Nov 2015 20:17:56 +0000 (13:17 -0700)]
dm: Convert bios_interrupts to use DM PCI API

Adjust this code to use driver model for devices where possible. Since
existing users have not been converted the old code must remain.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: x86: ivybridge: Convert graphics init to use DM PCI API
Simon Glass [Sun, 29 Nov 2015 20:17:55 +0000 (13:17 -0700)]
dm: x86: ivybridge: Convert graphics init to use DM PCI API

Use the driver-model PCI functions here where possible. For now we have to
search for the device with pci_bus_find_bdf() but at some point we can put
this in a proper driver and avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: serial: Convert ns16550 driver to use driver model PCI API
Simon Glass [Sun, 29 Nov 2015 20:17:54 +0000 (13:17 -0700)]
dm: serial: Convert ns16550 driver to use driver model PCI API

Use the driver model version of the function to find the BAR. This updates
the fdtdec function, of which ns16550 is the only user.

The fdtdec_get_pci_bdf() function is dropped for several reasons:
- with driver model we should use 'struct udevice *' rather than passing the
   device tree offset explicitly
- there are no other users in the tree
- the function parses for information which is already available in the PCI
device structure (specifically struct pci_child_platdata which is available
at dev_get_parent_platdata(dev)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: pci: Add a function to read a PCI BAR
Simon Glass [Sun, 29 Nov 2015 20:17:53 +0000 (13:17 -0700)]
dm: pci: Add a function to read a PCI BAR

Add a driver-model function for reading the PCI BAR from a device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: pci: Add a driver-model version of pci_find_class()
Simon Glass [Sun, 29 Nov 2015 20:17:52 +0000 (13:17 -0700)]
dm: pci: Add a driver-model version of pci_find_class()

Add a function which scans the driver model device information rather
than scanning the PCI bus again.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: pci: scsi: Use driver-model PCI API
Simon Glass [Sun, 29 Nov 2015 20:17:51 +0000 (13:17 -0700)]
dm: pci: scsi: Use driver-model PCI API

Adjust the SCSI command to use driver model for its PCI interface.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: pci: Add a driver-model version of pci_find_device()
Simon Glass [Sun, 29 Nov 2015 20:17:50 +0000 (13:17 -0700)]
dm: pci: Add a driver-model version of pci_find_device()

Add a function which scans the driver model device information rather
than scanning the PCI bus again.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: pci: Use driver model PCI API in auto-config
Simon Glass [Sun, 29 Nov 2015 20:17:49 +0000 (13:17 -0700)]
dm: pci: Use driver model PCI API in auto-config

At present we are using legacy functions even in the auto-configuration code
used by driver model. Add a new pci_auto.c version which uses the correct
API.

Create a new pci_internal.h header to hold functions that are used within
the PCI subsystem, but are not exported to other drivers.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: pci: Add a dm_ prefix to pci_bus_find_bdf()
Simon Glass [Sun, 29 Nov 2015 20:17:48 +0000 (13:17 -0700)]
dm: pci: Add a dm_ prefix to pci_bus_find_bdf()

Most driver model PCI functions have a dm_ prefix. At some point, when the
old code is converted to driver model and the old functions are removed, we
will drop that prefix.

For consistency, we should use the dm_ prefix for all driver model
functions. Update pci_bus_find_bdf() accordingly.

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