oweals/u-boot.git
8 years agoarm: mvebu: a38x: Weed out floating point use
Marek Vasut [Sat, 30 Apr 2016 12:45:42 +0000 (14:45 +0200)]
arm: mvebu: a38x: Weed out floating point use

For reason unknown, recently, the DDR init code writers are really fond
of hiding some small floating point operating deep in their creations.
This patch removes one from the Marvell A38x code.

Instead of returning size of chip as float from ddr3_get_device_size()
in GiB units, return it as int in MiB units. Since this would interfere
with the huge switch code in ddr3_calc_mem_cs_size(), rework the code
to match the change.

Before this patch, the cs_mem_size variable could have these values:
 ( { 16, 32 } x { 8, 16 } x { 0.01, 0.5, 1, 2, 4, 8 } ) / 8 =
   { 0.000000, 0.001250, 0.002500, 0.005000, 0.062500, 0.125000,
     0.250000, 0.500000, 1.000000, 2.000000, 4.000000, }
The switch code checked for a subset of the resulting RAM sizes, which
is in range 128 MiB ... 2048 MiB.

With this patch, the cs_mem_size variable can have these values:
 ( { 16, 32 } x { 8, 16 } x { 0, 512, 1024, 2048, 4096, 8192 } ) / 8 =
   { 0, 64, 128, 256, 512, 1024, 2048, 4096 }
To retain previous behavior, filter out 0 MiB (invalid size), 64 MiB
and 4096 MiB options.

Removing the floating point stuff also saves 1.5k from text segment:
  clearfog       :  spl/u-boot-spl:all -1592  spl/u-boot-spl:text -1592

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Dirk Eibach <dirk.eibach@gdsys.cc>
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
8 years agoarmv8: ls1043ardb: enable scsi command and pcie to sata converter
Po Liu [Wed, 18 May 2016 02:09:38 +0000 (10:09 +0800)]
armv8: ls1043ardb: enable scsi command and pcie to sata converter

Enable scsi command and pcie to sata chip 88SE9170.

Signed-off-by: Po Liu <po.liu@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agodriver/ddr/fsl: Add workaround for erratum A-010165
Shengzhou Liu [Tue, 10 May 2016 08:03:47 +0000 (16:03 +0800)]
driver/ddr/fsl: Add workaround for erratum A-010165

During DDR-2133 operation, the transmit data eye margins determined
during the memory controller initialization may be sub-optimal, set
DEBUG_29[12] and DEBUG_29[13:16] = 4'b0100 before MEM_EN is set.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarm: ls1021a: Enable CONFIG_OF_LIBFDT and CONFIG_FIT in defconfig
Alison Wang [Wed, 4 May 2016 04:45:55 +0000 (12:45 +0800)]
arm: ls1021a: Enable CONFIG_OF_LIBFDT and CONFIG_FIT in defconfig

In defconfig, enable CONFIG_OF_LIBFDT to support booting DT linux
kernel and enable COFNIG_FIT to support FIT image.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8: ls1043ardb: invert irq pin polarity for AQR105 PHY
Shaohui Xie [Fri, 29 Apr 2016 14:07:21 +0000 (22:07 +0800)]
armv8: ls1043ardb: invert irq pin polarity for AQR105 PHY

To use AQR105 PHY's interrupt, we need to invert the IRQ pin polarity
by setting relative bit in SCFG_INTPCR register, because AQR105
interrupt is low active but GIC accepts high active.

Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agocrypto/fsl: add support for multiple SEC engines initialization
Alex Porosanu [Fri, 29 Apr 2016 12:18:00 +0000 (15:18 +0300)]
crypto/fsl: add support for multiple SEC engines initialization

For SoCs that contain multiple SEC engines, each of them needs
to be initialized (by means of initializing among others the
random number generator).

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarch/arm, arch/powerpc: add # of SEC engines on the SOC
Alex Porosanu [Fri, 29 Apr 2016 12:17:59 +0000 (15:17 +0300)]
arch/arm, arch/powerpc: add # of SEC engines on the SOC

Some SOCs, specifically the ones in the C29x familiy can have
multiple security engines. This patch adds a system configuration
define which indicates the maximum number of SEC engines that
can be found on a SoC.

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarch/arm: add SEC JR0 offset
Alex Porosanu [Fri, 29 Apr 2016 12:17:58 +0000 (15:17 +0300)]
arch/arm: add SEC JR0 offset

Freescale PPC SoCs do not hard-code security engine's Job Ring 0
address, rather a define is used. This patch adds the same
functionality to the ARM based SoCs (i.e. LS1/LS2 and i.MX parts)

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv7: ls102xa: spl: fix the macro name of MMC mode
Qianyu Gong [Wed, 27 Apr 2016 01:44:51 +0000 (09:44 +0800)]
armv7: ls102xa: spl: fix the macro name of MMC mode

MMCSD_MODE_FAT has been renamed to MMCSD_MODE_FS by commit 205b4f33.

Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8: fsl-layerscape: spl: fix the macro name of MMC mode
Qianyu Gong [Wed, 27 Apr 2016 01:45:23 +0000 (09:45 +0800)]
armv8: fsl-layerscape: spl: fix the macro name of MMC mode

MMCSD_MODE_FAT has be renmaed to MMCSD_MODE_FS by commit 205b4f33.

Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8: fsl-layerscape: spl: remove duplicate init_early_memctl_regs()
Qianyu Gong [Wed, 27 Apr 2016 01:43:11 +0000 (09:43 +0800)]
armv8: fsl-layerscape: spl: remove duplicate init_early_memctl_regs()

init_early_memctl_regs() is also be called in board_early_init_f().
So remove the duplicated call in spl code.

Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8: ls1043ardb: fix types of variables
Qianyu Gong [Tue, 26 Apr 2016 04:51:43 +0000 (12:51 +0800)]
armv8: ls1043ardb: fix types of variables

Using u16 for cfg_rcw_src and u8 for sd1refclk_sel is enough.

Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8: ls1043a: remove redundant code in board files
Qianyu Gong [Tue, 26 Apr 2016 04:51:42 +0000 (12:51 +0800)]
armv8: ls1043a: remove redundant code in board files

gd->env_addr will be initialized in env_init() in
common/env_nowhere.c if CONFIG_ENV_IS_NOWHERE is defined.
So no need to do it again.

Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8: ls1043a: copy kernel from QSPI when booting with QSPI enabled
Qianyu Gong [Mon, 25 Apr 2016 08:53:53 +0000 (16:53 +0800)]
armv8: ls1043a: copy kernel from QSPI when booting with QSPI enabled

IFC won't be initialized in U-Boot if QSPI is enabled on LS1043AQDS.
So this patch could fix 'sync abort' caused by autoboot that tries to
access IFC address.

Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8/ls1043ardb: fix the limitation of using 'cpld reset'
Qianyu Gong [Mon, 25 Apr 2016 08:38:35 +0000 (16:38 +0800)]
armv8/ls1043ardb: fix the limitation of using 'cpld reset'

The current 'cpld reset' will just write global_rst register
but couldn't switch to NOR boot if the board's switches are
for NAND/SD boot. So need to write rcw source registers for
NOR boot as well.

Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarm: uniform usage of u32 in ls102x caam config
Vincent Siles [Fri, 22 Apr 2016 07:52:07 +0000 (09:52 +0200)]
arm: uniform usage of u32 in ls102x caam config

Mix usage of uint32_t and u32 fixed in favor of u32.

Signed-off-by: Vincent Siles <vincent.siles@provenrun.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarm: Fix SCFG ICID reg addresses
Vincent Siles [Fri, 22 Apr 2016 07:52:06 +0000 (09:52 +0200)]
arm: Fix SCFG ICID reg addresses

On the LS102x boards, in order to initialize the ICID values of
masters, the dev_stream_id array holds absolute offsets from the
base of SCFG.

In ls102xa_config_ssmu_stream_id, the base pointer is cast to
uint32_t * before adding the offset, leading to an invalid address.
Casting it to void * solves the issue.

Signed-off-by: Vincent Siles <vincent.siles@provenrun.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8: fsl-layerscape: Remove unnecessary flushing dcache
Alison Wang [Fri, 22 Apr 2016 02:37:25 +0000 (10:37 +0800)]
armv8: fsl-layerscape: Remove unnecessary flushing dcache

As the issue about the stack will get corrupted when switching between
the early and final mmu tables is fixed by commit 70e21b064, the
workaround to flush dcache is unnecessary and should be removed.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8: ls2080a: update eth prime
Prabhakar Kushwaha [Tue, 19 Apr 2016 03:23:42 +0000 (08:53 +0530)]
armv8: ls2080a: update eth prime

As per new PHY framework, DPNI naming convetion is no more used.
Use new naming convention.

Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8: ls2080: enable sec_init in U-Boot
Aneesh Bansal [Wed, 6 Apr 2016 16:55:51 +0000 (22:25 +0530)]
armv8: ls2080: enable sec_init in U-Boot

Define CONFIG_FSL_CAAM for LS2080 which would enable
call to sec_init() during U-Boot.

Signed-off-by: Aneesh Bansal <aneesh.bansal@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8/ls1043a: update the node for QSPI support
Yuan Yao [Tue, 15 Mar 2016 06:36:44 +0000 (14:36 +0800)]
armv8/ls1043a: update the node for QSPI support

The address value and size value set for QSPI dts node "reg"
property have type of u64 on arm64.

Signed-off-by: Yuan Yao <yao.yuan@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agosf: Disable 4-KB erase command for SPANSION S25FS-S family
Yuan Yao [Tue, 15 Mar 2016 06:36:43 +0000 (14:36 +0800)]
sf: Disable 4-KB erase command for SPANSION S25FS-S family

The S25FS-S family physical sectors may be configured as a hybrid
combination of eight 4-kB parameter sectors at the top or bottom
of the address space with all but one of the remaining sectors
being uniform size.
The default status of the flash is in this hybrid architecture.
The parameter sectors and the uniform sectors have different erase
commands.
This patch disable the hybrid sector architecture then the flash will
has uniform sector size and uniform erase command.
This configuration is temporary, the flash will revert to hybrid
architecture after power on reset.

Signed-off-by: Yuan Yao <yao.yuan@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agospi: fsl_qspi: Enable Spansion S25FS-S family flashes
Yuan Yao [Tue, 15 Mar 2016 06:36:42 +0000 (14:36 +0800)]
spi: fsl_qspi: Enable Spansion S25FS-S family flashes

The flash type of LS2085AQDS QSPI is S25FS256S. It has special write
any device register command and read any device register command.
This patch enable support for those commands.

Signed-off-by: Yuan Yao <yao.yuan@nxp.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agospi: fsl_qspi: Assign AMBA mem according CS num in dts
Yuan Yao [Tue, 15 Mar 2016 06:36:41 +0000 (14:36 +0800)]
spi: fsl_qspi: Assign AMBA mem according CS num in dts

QSPI controller automatic enable the chipselect signal according the
dest AMBA memory address. Now we distribute the AMBA memory zone
averagely to every chipselect slave device according chipselect
numbers got from dts node.

Signed-off-by: Yuan Yao <yao.yuan@nxp.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agospi: fsl_qspi: Fix issues on arm64
Yuan Yao [Tue, 15 Mar 2016 06:36:40 +0000 (14:36 +0800)]
spi: fsl_qspi: Fix issues on arm64

The address value and size value get from dts "reg" property have
type of u64 on arm64. If we assign those values to "u32" variables,
driver can't work correctly. Converting the type of those variables
to fdt_xxx_t.

Signed-off-by: Yuan Yao <yao.yuan@nxp.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Reviewed-by: York Sun <york.sun@nxp.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 agoarmv8/fdt: add fixup_crypto_node
Alex Porosanu [Mon, 11 Apr 2016 07:42:50 +0000 (10:42 +0300)]
armv8/fdt: add fixup_crypto_node

For Qoriq PPC&ARM v7 platforms, the crypto node is being fixup'ed in
order to update the SEC internal version (aka SEC ERA). This patch
adds the same functionality to the ARMv8 SoCs.

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8: ls2080a: Update MAINTAINERS file
Prabhakar Kushwaha [Sun, 10 Apr 2016 14:56:22 +0000 (20:26 +0530)]
armv8: ls2080a: Update MAINTAINERS file

Update MAINTAINERS file for ls2080aqds and ls2080ardb platforms.

Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8/ls2080ardb: Update DDR timing to support more UDIMMs
Shengzhou Liu [Thu, 7 Apr 2016 06:41:30 +0000 (14:41 +0800)]
armv8/ls2080ardb: Update DDR timing to support more UDIMMs

Optimize DDR timing for good margins to support new Transcend
and Apacer DDR4 UDIMM besides current Micron UDIMM.

Verified 1333MT/s, 1600MT/s, 1866MT/s, 2133MT/s rate with
following UDIMM on LS2080ARDB.
 - Micron UDIMM: MTA18ASF1G72AZ-2G1A1Z
 - Apacer UDIMM: 78.C1GM4.AF10B
 - Transcend UDIMM: TS1GLH72V1H

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agodriver/ddr/fsl: Add workaround for erratum A-009801
Shengzhou Liu [Wed, 16 Mar 2016 05:50:23 +0000 (13:50 +0800)]
driver/ddr/fsl: Add workaround for erratum A-009801

The initial training for the DDRC may provide results that are not
optimized. The workaround provides better read timing margins.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agodrivers/ddr/fsl: update workaround for erratum A-008511
Shengzhou Liu [Wed, 16 Mar 2016 05:50:22 +0000 (13:50 +0800)]
drivers/ddr/fsl: update workaround for erratum A-008511

Per the latest erratum document, update step 4 and step 8, only
DEBUG_29[21] is changed, all other bits should not be changed.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
8 years agoarmv8/ls1043: Add workaround for DDR erratum A-008850
Shengzhou Liu [Thu, 7 Apr 2016 08:22:21 +0000 (16:22 +0800)]
armv8/ls1043: Add workaround for DDR erratum A-008850

Barrier transactions from CCI400 need to be disabled till
the DDR is configured, otherwise it may lead to system hang.
The patch adds workaround to fix the erratum.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
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>