oweals/u-boot.git
8 years agomips: Add MIPS 74Kc tune
Marek Vasut [Fri, 6 May 2016 18:10:33 +0000 (20:10 +0200)]
mips: Add MIPS 74Kc tune

Add MIPS 74Kc tune Kconfig option.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Wills Wang <wills.wang@live.com>
[added missing tune-y entry in arch/mips/Makefile]
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agomips: Fix compiler warning in cpu.c
Marek Vasut [Thu, 5 May 2016 18:14:00 +0000 (20:14 +0200)]
mips: Fix compiler warning in cpu.c

There really is zero reason for including netdev.h in generic mips CPU code.
Removing the netdev.h from cpu.c also fixes the following compiler warning:

In file included from arch/mips/cpu/cpu.c:10:0:
include/netdev.h:204:41: warning: 'struct eth_device' declared inside parameter list [enabled by default]
 int fecmxc_register_mii_postcall(struct eth_device *dev, int (*cb)(int));
                                         ^
include/netdev.h:204:41: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agoath79: add readonly attribute for ath79_soc_desc
Wills Wang [Tue, 12 Apr 2016 10:24:10 +0000 (18:24 +0800)]
ath79: add readonly attribute for ath79_soc_desc

use 'const' keywork to qualify readonly attribute for lookup-table member

Signed-off-by: Wills Wang <wills.wang@live.com>
8 years agoath79: ar933x: use BIT macro for bit shift operation
Wills Wang [Tue, 12 Apr 2016 03:09:20 +0000 (11:09 +0800)]
ath79: ar933x: use BIT macro for bit shift operation

used a uniform BIT macro for register bit-field shift

Signed-off-by: Wills Wang <wills.wang@live.com>
8 years agoar933x: serial: Remove the explicit pinctrl setting
Wills Wang [Tue, 12 Apr 2016 03:09:19 +0000 (11:09 +0800)]
ar933x: serial: Remove the explicit pinctrl setting

The correct pinctrl is handled automatically so we don't need to do it in
the driver.

Signed-off-by: Wills Wang <wills.wang@live.com>
8 years agoath79: spi: Remove the explicit pinctrl setting
Wills Wang [Tue, 12 Apr 2016 03:09:18 +0000 (11:09 +0800)]
ath79: spi: Remove the explicit pinctrl setting

The correct pinctrl is handled automatically so we don't need to do it in
the driver.

Signed-off-by: Wills Wang <wills.wang@live.com>
8 years agomips: Report reloc information in bdinfo
Tim Chick [Thu, 31 Mar 2016 11:51:20 +0000 (12:51 +0100)]
mips: Report reloc information in bdinfo

Signed-off-by: Tim Chick <tim.chick@mediatek.com>
8 years agodrivers: mtd: add Microchip PIC32 internal non-CFI flash driver.
Purna Chandra Mandal [Fri, 18 Mar 2016 13:06:08 +0000 (18:36 +0530)]
drivers: mtd: add Microchip PIC32 internal non-CFI flash driver.

PIC32 internal flash devices are parallel NOR flash divided into
number of banks to allow erase-programming in one while fetch and
execution continues on other. As the flash banks are memory mapped
stored code can be executed directly from flash (XIP), also there
is additional hardware logic to prefetch and cache contents to
improve execution performance. These flash can also be used to
store user data (like environment).
Flash erase and programming are handled by on-chip NVM controller.

Driver implemented driver model but MTD is not really support.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoflash: add device ID for Microchip PIC32 internal flash.
Purna Chandra Mandal [Fri, 18 Mar 2016 13:06:07 +0000 (18:36 +0530)]
flash: add device ID for Microchip PIC32 internal flash.

Microchip PIC32 has internal parallel flash (non-CFI compliant).
These flash devices do not support any identifier command so no
standard IDs. Added unique IDs to seperate these flash devices
from others supported by U-Boot.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
8 years agomips: ath79: add AP143 reference board
Wills Wang [Wed, 16 Mar 2016 09:00:00 +0000 (17:00 +0800)]
mips: ath79: add AP143 reference board

This patch add board-level code and base DT for AP143.

Signed-off-by: Wills Wang <wills.wang@live.com>
[updated defconfig, enabled CONFIG_USE_PRIVATE_LIBGCC=y]
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agomips: ath79: add AP121 reference board
Wills Wang [Wed, 16 Mar 2016 08:59:59 +0000 (16:59 +0800)]
mips: ath79: add AP121 reference board

This patch add board-level code and base DT for AP121.

Signed-off-by: Wills Wang <wills.wang@live.com>
[updated defconfig, enabled CONFIG_USE_PRIVATE_LIBGCC=y]
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agodrivers: spi: add spi support for QCA/Atheros ath79 SOCs
Wills Wang [Wed, 16 Mar 2016 08:59:58 +0000 (16:59 +0800)]
drivers: spi: add spi support for QCA/Atheros ath79 SOCs

This patch add a compatible spi driver for ath79 series SOC.

Signed-off-by: Wills Wang <wills.wang@live.com>
Reviewed-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agodrivers: serial: add serial driver for ar933x SOC
Wills Wang [Wed, 16 Mar 2016 08:59:57 +0000 (16:59 +0800)]
drivers: serial: add serial driver for ar933x SOC

This patch add support for ar933x serial.

Signed-off-by: Wills Wang <wills.wang@live.com>
Reviewed-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agodrivers: pinctrl: Add simple pinctrl driver for Qualcomm/Atheros qca953x.
Wills Wang [Wed, 16 Mar 2016 08:59:56 +0000 (16:59 +0800)]
drivers: pinctrl: Add simple pinctrl driver for Qualcomm/Atheros qca953x.

This is a simple pinctrl driver, it just support uart and spi pin-mux now.

Signed-off-by: Wills Wang <wills.wang@live.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[fixed typo in commit subject line]
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agodrivers: pinctrl: Add simple pinctrl driver for Qualcomm/Atheros ar933x.
Wills Wang [Wed, 16 Mar 2016 08:59:55 +0000 (16:59 +0800)]
drivers: pinctrl: Add simple pinctrl driver for Qualcomm/Atheros ar933x.

This is a simple pinctrl driver, it just support uart and spi pin-mux now.

Signed-off-by: Wills Wang <wills.wang@live.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[fixed typo in commit subject line]
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 years agomips: ath79: add support for QCA953x SOCs
Wills Wang [Wed, 16 Mar 2016 08:59:54 +0000 (16:59 +0800)]
mips: ath79: add support for QCA953x SOCs

This patch enable work for qca953x SOC.

Signed-off-by: Wills Wang <wills.wang@live.com>
8 years agomips: ath79: add support for AR933x SOCs
Wills Wang [Wed, 16 Mar 2016 08:59:53 +0000 (16:59 +0800)]
mips: ath79: add support for AR933x SOCs

This patch enable work for ar933x SOC.

Signed-off-by: Wills Wang <wills.wang@live.com>
8 years agomips: add base support for QCA/Atheros ath79 SOCs
Wills Wang [Wed, 16 Mar 2016 08:59:52 +0000 (16:59 +0800)]
mips: add base support for QCA/Atheros ath79 SOCs

This patch add some common code for QCA/Atheros ath79 SOCs such as
DDR tuning, chip reset and CPU detection.

Signed-off-by: Wills Wang <wills.wang@live.com>
8 years agoAdd support for 64-bit MIPS to examples/standalone
Stanislav Galabov [Wed, 17 Feb 2016 13:23:33 +0000 (15:23 +0200)]
Add support for 64-bit MIPS to examples/standalone

Signed-off-by: Stanislav Galabov <sgalabov@gmail.com>
8 years agoFix FreeBSD loader API so that it works on both 32-bit and 64-bit targets.
Stanislav Galabov [Wed, 17 Feb 2016 13:23:31 +0000 (15:23 +0200)]
Fix FreeBSD loader API so that it works on both 32-bit and 64-bit targets.

Specifically tested on MIPS under QEMU (works with all  combination of bit-ness and endian-ness)

Signed-off-by: Stanislav Galabov <sgalabov@gmail.com>
8 years agoUse CONFIG_IDE_SWAP_IO when running on big-endian MIPS (32 or 64-bit) in QEMU so...
Stanislav Galabov [Wed, 17 Feb 2016 13:23:30 +0000 (15:23 +0200)]
Use CONFIG_IDE_SWAP_IO when running on big-endian MIPS (32 or 64-bit) in QEMU so that IDE transfers work properly

Signed-off-by: Stanislav Galabov <sgalabov@gmail.com>
8 years agoProperly calculate ATA_SECTORWORDS, using a fixed-size integer, so it works for both...
Stanislav Galabov [Wed, 17 Feb 2016 13:23:29 +0000 (15:23 +0200)]
Properly calculate ATA_SECTORWORDS, using a fixed-size integer, so it works for both 32-bit and 64-bit targets

Signed-off-by: Stanislav Galabov <sgalabov@gmail.com>
8 years agoMerge git://git.denx.de/u-boot-dm
Tom Rini [Tue, 17 May 2016 17:58:27 +0000 (13:58 -0400)]
Merge git://git.denx.de/u-boot-dm

8 years agoMerge branch 'master' of git://www.denx.de/git/u-boot-imx
Tom Rini [Tue, 17 May 2016 16:10:35 +0000 (12:10 -0400)]
Merge branch 'master' of git://denx.de/git/u-boot-imx

8 years agodm: mmc: test: Add tests for MMC
Simon Glass [Sun, 1 May 2016 19:52:44 +0000 (13:52 -0600)]
dm: mmc: test: Add tests for MMC

Add a simple test which checks that a sandbox-emulated SD card can be used
correctly. This tests plumbing through the MMC stack's block-device
implementaion.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: mmc: Enable building MMC code for sandbox
Simon Glass [Sun, 1 May 2016 19:52:43 +0000 (13:52 -0600)]
dm: sandbox: mmc: Enable building MMC code for sandbox

Enable building the MMC code for sandbox. This increases build
coverage for sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: sandbox: Add an SD-card emulation
Simon Glass [Sun, 1 May 2016 19:52:42 +0000 (13:52 -0600)]
dm: mmc: sandbox: Add an SD-card emulation

Add an emulation of an SD card to sandbox, allowing MMC to be used in tests.
The emulation is very simple, supporting only card detection and reading
test data.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Add support for driver-model block devices
Simon Glass [Sun, 1 May 2016 19:52:41 +0000 (13:52 -0600)]
dm: mmc: Add support for driver-model block devices

Add support for enabling CONFIG_BLK with MMC. This involves changing a
few functions to use struct udevice and adding a MMC block device driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Add a way to bind MMC devices with driver model
Simon Glass [Sun, 1 May 2016 19:52:40 +0000 (13:52 -0600)]
dm: mmc: Add a way to bind MMC devices with driver model

Binding an MMC device when CONFIG_BLK is enabled requires that a block
device be bound as a child of the MMC device. Add a function to do this.
The mmc_create() method will be used only when DM_BLK is disabled.

Add an unbind method also.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Implement the MMC functions for block devices
Simon Glass [Sun, 1 May 2016 19:52:39 +0000 (13:52 -0600)]
dm: mmc: Implement the MMC functions for block devices

Implement the functions in mmc_legacy.c for driver-model block devices, so
that MMC can use driver model for these. This allows CONFIG_BLK to be enabled
with DM_MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Only enable the sandbox MMC driver when valid
Simon Glass [Sun, 1 May 2016 19:52:38 +0000 (13:52 -0600)]
dm: sandbox: Only enable the sandbox MMC driver when valid

This driver will require generic MMC and block-device support in a future
commit. To avoid test errors, make this change now.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Adjust mmc_switch_part() to use a struct mmc
Simon Glass [Sun, 1 May 2016 19:52:37 +0000 (13:52 -0600)]
dm: mmc: Adjust mmc_switch_part() to use a struct mmc

Instead of looking up the MMC device by number, just pass it in. This makes
it possible to use this function with driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Use the correct error code for blk_get_device_by_str()
Simon Glass [Sun, 1 May 2016 19:52:36 +0000 (13:52 -0600)]
dm: blk: Use the correct error code for blk_get_device_by_str()

Return -EINVAL instead of -1 in this function, to provide a more meaningful
error.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Move the device list into a separate file
Simon Glass [Sun, 1 May 2016 19:52:35 +0000 (13:52 -0600)]
dm: mmc: Move the device list into a separate file

At present the MMC subsystem maintains its own list of MMC devices. This
cannot work with driver model, which needs to maintain this itself. Move the
list code into a separate 'legacy' file. The core MMC code remains, and will
be shared with the driver-model implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Set up the device pointer when using the MMC uclass
Simon Glass [Sun, 1 May 2016 19:52:34 +0000 (13:52 -0600)]
dm: mmc: Set up the device pointer when using the MMC uclass

Update the existing drivers to set up this new pointer. This will be required
by the MMC uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Add a comment as to why the bdev member is needed
Simon Glass [Sun, 1 May 2016 19:52:33 +0000 (13:52 -0600)]
dm: blk: Add a comment as to why the bdev member is needed

This member should be explained, since it is not obvious why it is needed.
Add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: part: Drop the block_drvr table
Simon Glass [Sun, 1 May 2016 19:52:32 +0000 (13:52 -0600)]
dm: part: Drop the block_drvr table

This is not needed since we can use the functions provided by the legacy
block device support.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: part: Use the legacy block driver for hardware partition support
Simon Glass [Sun, 1 May 2016 19:52:31 +0000 (13:52 -0600)]
dm: part: Use the legacy block driver for hardware partition support

Drop use of the table in part.c for this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Add functions to select a hardware partition
Simon Glass [Sun, 1 May 2016 19:52:30 +0000 (13:52 -0600)]
dm: blk: Add functions to select a hardware partition

The block device uclass does not currently support selecting a particular
hardware partition but this is needed for MMC. Add it so that the blk API
can support MMC properly.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Use the new select_hwpart() API
Simon Glass [Sun, 1 May 2016 19:52:29 +0000 (13:52 -0600)]
dm: mmc: Use the new select_hwpart() API

Avoid calling directly into the MMC code - use the new API call instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: spl: Use the legacy block interface in SPL
Simon Glass [Sun, 1 May 2016 19:52:28 +0000 (13:52 -0600)]
dm: mmc: spl: Use the legacy block interface in SPL

Bring this in for SPL so that we can use generic code for loading from
block devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Add a function to obtain the block device
Simon Glass [Sun, 1 May 2016 19:52:27 +0000 (13:52 -0600)]
dm: mmc: Add a function to obtain the block device

The MMC block device is contained within struct mmc. But with driver model
this will not be the case. Add a function to obtain the block device. We
can later implement this for CONFIG_BLK.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Implement the select_hwpart() method
Simon Glass [Sun, 1 May 2016 19:52:26 +0000 (13:52 -0600)]
dm: mmc: Implement the select_hwpart() method

Implement this method so that hardware partitions will work correctly with
MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Move mmc_switch_part() above its callers
Simon Glass [Sun, 1 May 2016 19:52:25 +0000 (13:52 -0600)]
dm: mmc: Move mmc_switch_part() above its callers

This function is defined after it is used. In preparation for making it
static, move it up a little. Also drop the printf() which should not appear
in a driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Free the block device name when unbound
Simon Glass [Sun, 1 May 2016 19:52:24 +0000 (13:52 -0600)]
dm: blk: Free the block device name when unbound

Mark the device name as allocated so that it will be freed correctly when the
device is unbound.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: core: Allow device names to be freed automatically
Simon Glass [Sun, 1 May 2016 19:52:23 +0000 (13:52 -0600)]
dm: core: Allow device names to be freed automatically

Some devices have a name that is stored in allocated memory. At present
there is no mechanism to free this memory when the device is unbound.

Add a device flag to track whether a name is allocated and a function to
add the flag. Free the memory when the device is unbound.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Fix allocation of block-device numbering
Simon Glass [Sun, 1 May 2016 19:52:22 +0000 (13:52 -0600)]
dm: blk: Fix allocation of block-device numbering

Due to code ordering the block devices are not numbered sequentially. Fix
this.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Enable systemace
Simon Glass [Sun, 1 May 2016 17:36:32 +0000 (11:36 -0600)]
dm: sandbox: Enable systemace

Enable building the systemace code for sandbox. This increases build
coverage for sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: systemace: Add driver-mode block-device support
Simon Glass [Sun, 1 May 2016 17:36:31 +0000 (11:36 -0600)]
dm: systemace: Add driver-mode block-device support

Add support for CONFIG_BLK to the systemace driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: systemace: Reorder function to avoid forward declarataions
Simon Glass [Sun, 1 May 2016 17:36:30 +0000 (11:36 -0600)]
dm: systemace: Reorder function to avoid forward declarataions

Move the systemace_get_dev() function below systemace_read() so that we can
avoid a forward declaration.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Add a easier way to create a named block device
Simon Glass [Sun, 1 May 2016 17:36:29 +0000 (11:36 -0600)]
dm: blk: Add a easier way to create a named block device

Add a function that automatically builds the device name given the parent
and a supplied string. Most callers will want to do this, so putting this
functionality in one place makes more sense.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Allow blk_create_device() to allocate the device number
Simon Glass [Sun, 1 May 2016 17:36:28 +0000 (11:36 -0600)]
dm: blk: Allow blk_create_device() to allocate the device number

Allow a devnum parameter of -1 to indicate that the device number should be
alocated automatically. The next highest available device number for that
interface type is used.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Enable SATA
Simon Glass [Sun, 1 May 2016 17:36:27 +0000 (11:36 -0600)]
dm: sandbox: Enable SATA

Enable building the SATA code for sandbox. This increases build coverage
for sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sata: Add support for driver-model block devices
Simon Glass [Sun, 1 May 2016 17:36:26 +0000 (11:36 -0600)]
dm: sata: Add support for driver-model block devices

Add driver-model block-device support to the SATA implementation. This is
just a dummy implementation for now, since the SATA low-level API uses
numbered devices and that doesn't fit with driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Enable SCSI
Simon Glass [Sun, 1 May 2016 17:36:25 +0000 (11:36 -0600)]
dm: sandbox: Enable SCSI

Enable building the SCSI code for sandbox. This increases build coverage
for sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: scsi: Add support for driver-model block devices
Simon Glass [Sun, 1 May 2016 17:36:24 +0000 (11:36 -0600)]
dm: scsi: Add support for driver-model block devices

Add driver-model block-device support to the SCSI implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Enable IDE
Simon Glass [Sun, 1 May 2016 17:36:23 +0000 (11:36 -0600)]
dm: sandbox: Enable IDE

Enable building the IDE code for sandbox. This is for build coverage only.
It does not currently work.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: ide: Add support for driver-model block devices
Simon Glass [Sun, 1 May 2016 17:36:22 +0000 (11:36 -0600)]
dm: ide: Add support for driver-model block devices

Add driver-model block-device support to the IDE implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: part: Drop the get_dev() method
Simon Glass [Sun, 1 May 2016 17:36:21 +0000 (11:36 -0600)]
dm: part: Drop the get_dev() method

This is now handled by the legacy block driver. The get_dev() method is
no-longer used. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Drop the host_get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:20 +0000 (11:36 -0600)]
dm: sandbox: Drop the host_get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Drop the systemace.h header
Simon Glass [Sun, 1 May 2016 17:36:19 +0000 (11:36 -0600)]
dm: blk: Drop the systemace.h header

This has nothing of consequence. Remove it and its only inclusion site.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: systemace: Drop the get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:18 +0000 (11:36 -0600)]
dm: systemace: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sata: Drop the get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:17 +0000 (11:36 -0600)]
dm: sata: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

We cannot yet make sata_dev_desc[] private to common/sata.c as it is used by
the SATA drivers. This will require the SATA interface to be reworked.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: scsi: Drop the get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:16 +0000 (11:36 -0600)]
dm: scsi: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Drop the get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:15 +0000 (11:36 -0600)]
dm: mmc: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: ide: Drop the get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:14 +0000 (11:36 -0600)]
dm: ide: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: usb: Drop the get_dev() function
Simon Glass [Sun, 1 May 2016 17:36:13 +0000 (11:36 -0600)]
dm: usb: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: disk: Use legacy block driver info for block device access
Simon Glass [Sun, 1 May 2016 17:36:12 +0000 (11:36 -0600)]
dm: disk: Use legacy block driver info for block device access

Instead of calling xx_get_dev() functions for each interface type, use the
new legacy block driver which can provide the device through its interface.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sata: Separate the non-command code into its own file
Simon Glass [Sun, 1 May 2016 17:36:11 +0000 (11:36 -0600)]
dm: sata: Separate the non-command code into its own file

At present the SATA command code includes both the command-processing code
and the core SATA functions and data structures.

Separate the latter into its own file, adding functions as needed to avoid
the command code accessing data structures directly.

With this commit:
- All CONFIG option are referenced from the non-command code
- The concept of a 'current SATA device' is confined to the command code

This will make it easier to convert this code to driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: ide: Separate the non-command code into its own file
Simon Glass [Sun, 1 May 2016 17:36:10 +0000 (11:36 -0600)]
dm: ide: Separate the non-command code into its own file

At present the IDE command code includes both the command-processing code
and the core IDE functions and data structures.

Separate the latter into its own file, adding functions as needed to avoid
the command code accessing data structures directly.

With this commit:
- Most CONFIG option are referenced from the non-command code
- The concept of a 'current IDE device' is confined to the command code

This will make it easier to convert this code to driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: scsi: Separate the non-command code into its own file
Simon Glass [Sun, 1 May 2016 17:36:09 +0000 (11:36 -0600)]
dm: scsi: Separate the non-command code into its own file

At present the SCSI command code includes both the command-processing code
and the core SCSI functions and data structures.

Separate the latter into its own file, adding functions as needed to avoid
the command code accessing data structures directly. This functions use the
new legacy block functions.

With this commit:
- There is no CONFIG option referenced from the command code
- The concept of a 'current SCSI device' is confined to the command code

This will make it easier to convert this code to driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Add an implementation of the 'devnum' functions
Simon Glass [Sun, 1 May 2016 17:36:08 +0000 (11:36 -0600)]
dm: mmc: Add an implementation of the 'devnum' functions

Now that the MMC code accesses devices by number, we can implement this same
interface for driver model, allowing MMC to support using driver model for
block devices.

Add the required functions to the uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: mmc: Add a legacy block interface for MMC
Simon Glass [Sun, 1 May 2016 17:36:07 +0000 (11:36 -0600)]
dm: mmc: Add a legacy block interface for MMC

Add a legacy block interface for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: usb: Add a legacy block interface for USB storage
Simon Glass [Sun, 1 May 2016 17:36:06 +0000 (11:36 -0600)]
dm: usb: Add a legacy block interface for USB storage

Add a legacy block interface for USB storage.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Add a legacy host block interface
Simon Glass [Sun, 1 May 2016 17:36:05 +0000 (11:36 -0600)]
dm: sandbox: Add a legacy host block interface

Add a legacy block interface for sandbox host.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: systemace: Add a legacy block interface
Simon Glass [Sun, 1 May 2016 17:36:04 +0000 (11:36 -0600)]
dm: systemace: Add a legacy block interface

Add a legacy block interface for systemace.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: blk: Add a legacy block interface
Simon Glass [Sun, 1 May 2016 17:36:03 +0000 (11:36 -0600)]
dm: blk: Add a legacy block interface

There is quite a bit of duplicated common code related to block devices
in the IDE and SCSI implementations.

Create some helper functions that can be used to reduce the duplication.
These rely on a linker list of interface-type drivers

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: scsi: Rename CONFIG_CMD_SCSI to CONFIG_SCSI
Simon Glass [Sun, 1 May 2016 17:36:02 +0000 (11:36 -0600)]
dm: scsi: Rename CONFIG_CMD_SCSI to CONFIG_SCSI

This option currently enables both the command and the SCSI functionality.
Rename the existing option to CONFIG_SCSI since most of the code relates
to the feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sata: Fix code style problems in cmd/sata.c
Simon Glass [Sun, 1 May 2016 17:36:01 +0000 (11:36 -0600)]
dm: sata: Fix code style problems in cmd/sata.c

This file has a few coding style problems. Fix these to make future updates
easier.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: ide: Remove the forward declarations
Simon Glass [Sun, 1 May 2016 17:36:00 +0000 (11:36 -0600)]
dm: ide: Remove the forward declarations

Reorder the code to avoid needing forward declarations. Fix up code style
as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: ide: Correct various code style problems
Simon Glass [Sun, 1 May 2016 17:35:59 +0000 (11:35 -0600)]
dm: ide: Correct various code style problems

Adjust common/ide.c so that it passes most checkpatch.pl checks.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: scsi: Fix up code style
Simon Glass [Sun, 1 May 2016 17:35:58 +0000 (11:35 -0600)]
dm: scsi: Fix up code style

Update the code style of this file so that it passes checkpatch.pl.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: scsi: Remove the forward declarations
Simon Glass [Sun, 1 May 2016 17:35:57 +0000 (11:35 -0600)]
dm: scsi: Remove the forward declarations

Reorder the code to avoid needing forward declarations.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Add dummy SATA functions
Simon Glass [Sun, 1 May 2016 17:35:56 +0000 (11:35 -0600)]
sandbox: Add dummy SATA functions

Add some functions needed by the SATA code. This allows it to be compiled
for sandbox, thus increasing build coverage.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Add dummy SCSI functions
Simon Glass [Sun, 1 May 2016 17:35:55 +0000 (11:35 -0600)]
sandbox: Add dummy SCSI functions

Add some functions needed by the SCSI code. This allows it to be compiled
for sandbox, thus increasing build coverage.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Add string and 16-bit I/O functions
Simon Glass [Sun, 1 May 2016 17:35:54 +0000 (11:35 -0600)]
sandbox: Add string and 16-bit I/O functions

Add outsw() and insw() functions for sandbox, as these are needed by the IDE
code. The functions will not do anything useful if called, but allow the
code to be compiled.

Also add out16() and in16(), required by systemace.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoAllow iotrace byte access to use an address of any size
Simon Glass [Sun, 1 May 2016 17:35:53 +0000 (11:35 -0600)]
Allow iotrace byte access to use an address of any size

If an address is used with readb() and writeb() which is smaller than the
expected size (e.g. 32-bit value on a machine with 64-bit addresses), a
warning results. Fix this by adding a cast.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: Rename disk uclass to ahci
Simon Glass [Sun, 1 May 2016 17:35:52 +0000 (11:35 -0600)]
dm: Rename disk uclass to ahci

This started as 'ahci' and was renamed to 'disk' during code review. But it
seems that this is too generic. Now that we have a 'blk' uclass, we can use
that as the generic piece, and revert to ahci for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agopci: Drop CONFIG_SYS_SCSI_SCAN_BUS_REVERSE
Simon Glass [Sun, 1 May 2016 17:35:51 +0000 (11:35 -0600)]
pci: Drop CONFIG_SYS_SCSI_SCAN_BUS_REVERSE

This option is not used by any board. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: sandbox: Add a board for sandbox without CONFIG_BLK
Simon Glass [Sun, 1 May 2016 17:35:50 +0000 (11:35 -0600)]
dm: sandbox: Add a board for sandbox without CONFIG_BLK

While the driver-model block device support is in progress, it is useful to
build sandbox both with and without CONFIG_BLK. Add a separate board for
the latter.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoRevert "dm: sandbox: Drop the pre-DM host implementation"
Simon Glass [Sun, 1 May 2016 17:35:49 +0000 (11:35 -0600)]
Revert "dm: sandbox: Drop the pre-DM host implementation"

Bring this support back so that sandbox can be compiled with CONFIG_BLK. This
allows sandbox to have greater build coverage during the block-device
transition. This can be removed again later.

This reverts commit 33cf727b1634dbd9cd68a6ebc444a88f053822d7.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agogpio: exynos(s5p): remove gpio_xlate routine
Eric Nelson [Wed, 20 Apr 2016 15:37:39 +0000 (08:37 -0700)]
gpio: exynos(s5p): remove gpio_xlate routine

With the addition of GPIO_ACTIVE_LOW parsing in gpio-uclass,
the Exynos/S5P gpio driver doesn't need a custom xlate routine.

Signed-off-by: Eric Nelson <eric@nelint.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Minkyu Kang <mk7.kang@samsung.com>
8 years agogpio: rk: remove gpio_xlate routine
Eric Nelson [Wed, 20 Apr 2016 15:37:38 +0000 (08:37 -0700)]
gpio: rk: remove gpio_xlate routine

With the addition of GPIO_ACTIVE_LOW parsing in gpio-uclass,
the Rockchip gpio driver doesn't need a custom xlate routine.

Signed-off-by: Eric Nelson <eric@nelint.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agogpio: pic32: remove gpio_xlate routine
Eric Nelson [Wed, 20 Apr 2016 15:37:37 +0000 (08:37 -0700)]
gpio: pic32: remove gpio_xlate routine

With the addition of GPIO_ACTIVE_LOW parsing in gpio-uclass,
the pic32 gpio driver doesn't need a custom xlate routine.

Signed-off-by: Eric Nelson <eric@nelint.com>
Acked-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Purna Chandra Mandal <purna.mandal@microchip.com>
8 years agogpio: omap: remove gpio_xlate routine
Eric Nelson [Wed, 20 Apr 2016 15:37:36 +0000 (08:37 -0700)]
gpio: omap: remove gpio_xlate routine

With the addition of GPIO_ACTIVE_LOW parsing in gpio-uclass,
the omap gpio driver doesn't need a custom xlate routine.

Signed-off-by: Eric Nelson <eric@nelint.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agogpio: intel_broadwell: remove gpio_xlate routine
Eric Nelson [Wed, 20 Apr 2016 15:37:35 +0000 (08:37 -0700)]
gpio: intel_broadwell: remove gpio_xlate routine

With the addition of GPIO_ACTIVE_LOW parsing in gpio-uclass,
the intel_broadwell driver doesn't need a custom xlate routine.

Signed-off-by: Eric Nelson <eric@nelint.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agodm: gpio: add a default gpio xlate routine
Eric Nelson [Sun, 24 Apr 2016 23:32:40 +0000 (16:32 -0700)]
dm: gpio: add a default gpio xlate routine

Many drivers use a common form of offset + flags for device
tree nodes. e.g.:
<&gpio1 2 GPIO_ACTIVE_LOW>

This patch adds a common implementation of this type of parsing
and calls it when a gpio driver doesn't supply its' own xlate
routine.

This will allow removal of the driver-specific versions in a
handful of drivers and simplify the addition of new drivers.

Signed-off-by: Eric Nelson <eric@nelint.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agodrivers: usb: common: add common code for usb drivers to use
Mugunthan V N [Tue, 12 Apr 2016 10:31:19 +0000 (16:01 +0530)]
drivers: usb: common: add common code for usb drivers to use

Add common usb code which usb drivers makes use of it.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agodm: gpio: introduce 74x164 driver
Peng Fan [Tue, 3 May 2016 02:02:23 +0000 (10:02 +0800)]
dm: gpio: introduce 74x164 driver

Introduce driver to support "fairchild,74hc595" devices.
1. Take linux drivers/drivers/gpio/gpio-74x164.c as reference.
2. Following the naming used in Linux driver with gen_7x164 as the prefix.
3. Enable CONFIG_DM_74X164 to use this driver.
4. Follow Documentation/devicetree/bindings/gpio/gpio-74x164.txt to add device
   nodes
5. Tested on i.MX6 UltraLite with 74LV595 using gpio command and oscillograph.

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Chin Liang See <clsee@altera.com>
Cc: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agodm: spi: introduce dm api
Peng Fan [Tue, 3 May 2016 02:02:22 +0000 (10:02 +0800)]
dm: spi: introduce dm api

Introduce dm_spi_claim_bus, dm_spi_release_bus and dm_spi_xfer
Convert spi_claim_bus, spi_release_bus and spi_xfer to use
the new API.

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Jagan Teki <jteki@openedev.com>
Acked-by: Simon Glass <sjg@chromium.org>