pandora-u-boot.git
6 years agoMerge git://www.denx.de/git/u-boot-marvell
Tom Rini [Wed, 12 Jul 2017 12:16:41 +0000 (08:16 -0400)]
Merge git://www.denx.de/git/u-boot-marvell

6 years agoarm: mvebu: clearfog: fix chip name comment
Baruch Siach [Tue, 4 Jul 2017 17:23:41 +0000 (20:23 +0300)]
arm: mvebu: clearfog: fix chip name comment

The clearfog uses Armada 388.

Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stefan Roese <sr@denx.de>
6 years agotools/kwbimage: fix v1 header verification
Baruch Siach [Tue, 4 Jul 2017 17:23:40 +0000 (20:23 +0300)]
tools/kwbimage: fix v1 header verification

The verify_header callback in kwbimage.c only verifies v0 headers checksum.
Running 'mkimage -l' on a v1 image gives the following misleading output:

GP Header: Size ae000000 LoadAddr 34160600

Implement support for v1 headers. For that, factor out the header checksum code
to a separate main_hdr_checksum_ok() routine. This routine relies on the fact
that the checksum field offset is the same in both v0 and v1 headers. With this
patch applied 'mkimage -l' correctly identifies the image:

Image Type:   MVEBU Boot from sdio Image
Image version:1
Data Size:    398904 Bytes = 389.55 KiB = 0.38 MiB
Load Address: 007fffc0
Entry Point:  00800000

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stefan Roese <sr@denx.de>
6 years agotools/kwbimage.h: make offset marks style consistent
Baruch Siach [Tue, 4 Jul 2017 17:23:39 +0000 (20:23 +0300)]
tools/kwbimage.h: make offset marks style consistent

The offset marking in kwbimage.h is inconsistent. main_hdr_v0 uses decimals,
main_hdr_v1 uses hex without '0x' prefix, secure_hdr_v1 uses hex with '0x'
prefix. Make all offset marks hex with '0x' prefix.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stefan Roese <sr@denx.de>
6 years agotools/kwbimage: update the list of SoCs using v1 header
Baruch Siach [Tue, 4 Jul 2017 17:23:38 +0000 (20:23 +0300)]
tools/kwbimage: update the list of SoCs using v1 header

Armada 38x also uses image header v1.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stefan Roese <sr@denx.de>
6 years agoarm64: mvebu: use single defconfig for Armada8K development boards
Igal Liberman [Tue, 13 Jun 2017 07:35:44 +0000 (10:35 +0300)]
arm64: mvebu: use single defconfig for Armada8K development boards

Currently, Marvell Armada8k development board use 3 different
defconfigs:
        mvebu_db-88f7040-nand_defconfig
        mvebu_db-88f7040_defconfig
        mvebu_db-88f8040_defconfig
Having 3 different defconfigs makes maintenance difficult.

This patch removes the defconfigs mentioned above and introduce
a new defconfig which represents the Armada8k family.

NOTE:
In order not to break automatic tools compilation,
a default device-tree is set in the defconfig (armada-8040-db).
However, when compiling u-boot, the user MUST explicitly export
the DEVICE_TREE for the requested board because using A80x0
device-tree on A70x0 might break the device.

For more information, refer to "doc/README.marvell" (intoduced
in this patch).

Change-Id: I98515b6306498358f3722ecf7ac4c87f236ebbd8
Signed-off-by: Igal Liberman <igall@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
6 years agomarvell: armada385: Add the Turris Omnia board
Marek Behún [Fri, 9 Jun 2017 17:28:45 +0000 (19:28 +0200)]
marvell: armada385: Add the Turris Omnia board

The Turris Omnia is a open-source router created by CZ.NIC.

The code is based on the Marvell/db-88f6820-gp by Stefan Roese
with modifications from Tomas Hlavacek in the CZ.NIC turris-omnia-uboot
repository, which can be found at
https://gitlab.labs.nic.cz/turris/turris-omnia-uboot

By default, the Turris Omnia uses btrfs as the main and only filesystem,
and also loads kernel and device tree from this filesystem. Since U-Boot
does not yet support btrfs, you should not flash your Turris Omnia board
with this unless you know what you are doing.

Signed-off-by: Tomas Hlavacek <tomas.hlavacek@nic.cz>
Signed-off-by: Marek Behun <marek.behun@nic.cz>
 create mode 100644 board/CZ.NIC/turris_omnia/Makefile
 create mode 100644 board/CZ.NIC/turris_omnia/kwbimage.cfg
 create mode 100644 board/CZ.NIC/turris_omnia/turris_omnia.c
 create mode 100644 configs/turris_omnia_defconfig
 create mode 100644 include/configs/turris_omnia.h
Signed-off-by: Stefan Roese <sr@denx.de>
6 years agodrivers/misc: Add basic support for ATSHA204A Crypto module
Marek Behún [Fri, 9 Jun 2017 17:28:44 +0000 (19:28 +0200)]
drivers/misc: Add basic support for ATSHA204A Crypto module

This module can be found on the Turris Omnia board connected
via the I2C interface.

Among some cryptographic functions, the chip has a 512 bit
One Time Programmable memory, 88 byte configuration memory
and 512 byte general purpose memory.

The Turris Omnia stores serial number and device MAC address in
the OTP memory.

This commit adds basic support for reading the EEPROM and also
exposes the chips Random Number Generator.

The driver is based on code by
  Josh Datko, Cryptotronix, jbd@cryptotronix.com
and also
  Tomas Hlavacek, CZ.NIC, tomas.hlavacek@nic.cz

Signed-off-by: Tomas Hlavacek <tomas.hlavacek@nic.cz>
Signed-off-by: Marek Behun <marek.behun@nic.cz>
 create mode 100644 drivers/misc/atsha204a-i2c.c
 create mode 100644 include/atsha204a-i2c.h
Signed-off-by: Stefan Roese <sr@denx.de>
6 years agodrivers/i2c/muxes/pca954x: Add pca9547 I2C mux support
Marek Behún [Fri, 9 Jun 2017 17:28:43 +0000 (19:28 +0200)]
drivers/i2c/muxes/pca954x: Add pca9547 I2C mux support

This I2C mux is found, for example, on the Turris Omnia board.

Signed-off-by: Marek Behun <marek.behun@nic.cz>
Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
6 years agoarch/arm/dts: Add Turris Omnia device tree
Marek Behún [Fri, 9 Jun 2017 17:28:42 +0000 (19:28 +0200)]
arch/arm/dts: Add Turris Omnia device tree

This device tree is taken from mainline Linux kernel commit
7b7db5ab. Added is also a -u-boot.dtsi file with these additions:

  - aliases for I2C and SPI devices are added, because i2cmux and
    SPI flash doesn't work otherwise
  - spi_flash node has been added so that the new DM API works
  - the ATSHA204A node is added in the i2c@5 node
  - "u-boot,dm-pre-reloc"s are added in needed nodes for SPL
    build to work correctly

Signed-off-by: Marek Behun <marek.behun@nic.cz>
 create mode 100644 arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi
 create mode 100644 arch/arm/dts/armada-385-turris-omnia.dts
Signed-off-by: Stefan Roese <sr@denx.de>
6 years agoorion_wdt: Support for the Orion Watchdog
Marek Behún [Fri, 9 Jun 2017 17:28:41 +0000 (19:28 +0200)]
orion_wdt: Support for the Orion Watchdog

The Orion watchdog can be found on some Marvell Armada chips.

This driver is based on the code by Tomas Hlavacek in the CZ.NIC
turris-omnia-uboot repository, which can be found at
https://gitlab.labs.nic.cz/turris/turris-omnia-uboot, and that
one is based on code by Sylver Bruneau. His code is already in
mainline Linux kernel.

The code uses the new driver model API.

Signed-off-by: Tomas Hlavacek <tomas.hlavacek@nic.cz>
Signed-off-by: Marek Behun <marek.behun@nic.cz>
 create mode 100644 drivers/watchdog/orion_wdt.c
Signed-off-by: Stefan Roese <sr@denx.de>
6 years agodriver/ddr: Add support for setting timing in hws_topology_map
Marek Behún [Fri, 9 Jun 2017 17:28:40 +0000 (19:28 +0200)]
driver/ddr: Add support for setting timing in hws_topology_map

The DDR3 training code for Marvell A38X currently computes 1t timing
when given board topology map of the Turris Omnia, but Omnia needs 2t.

This patch adds support for enforcing the 2t timing in struct
hws_topology_map, through a new enum hws_timing, which can assume
following values:
  HWS_TIM_DEFAULT - default behaviour, compute whether to enable 2t
                    from the number of CSs
  HWS_TIM_1T      - enforce 1t
  HWS_TIM_2T      - enforce 2t

This patch also sets all the board topology maps (db-88f6820-amc,
db-88f6820-gp, controlcenterdc and clearfog) to have timing set to
HWS_TIM_DEFAULT.

Signed-off-by: Marek Behun <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
6 years agoam33xx: board: Refactor USB initialization into separate function
Alexandru Gagniuc [Tue, 7 Feb 2017 03:17:33 +0000 (19:17 -0800)]
am33xx: board: Refactor USB initialization into separate function

The declaration of otg*_plat and otg*_board_data is guarded by
CONFIG_USB_MUSB_*, but their use in arch_misc_init is not. The
ifdef flow goes something like:

if (CONFIG_USB_MUSB_* && other_conditions)
declare usb_data
if (other_conditions)
use usb_data

Thus when CONFIG_USB_MUSB_* is not declared, we try to use the
data structures, but these structures aren't defined.

To fix this, move the USB initialization code into the same #ifdef
which guards the declaration of the data structures. Since the DM_USB
vs legacy cases are completely different, use two versions of
arch_misc_init(), for readability.

Signed-off-by: Alexandru Gagniuc <alex.g@adaptrum.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoconfigs: am335x_evm: Enable FASTBOOT based on kconfig
Alexandru Gagniuc [Tue, 7 Feb 2017 03:17:32 +0000 (19:17 -0800)]
configs: am335x_evm: Enable FASTBOOT based on kconfig

When CONFIG_CMD_FASTBOOT or CONFIG_USB_FUNCTION_FASTBOOT are defined
in am335x_evm.h, a dependency on g_dnl.c is created. This in turn
creates a dependency on having USB gadget enabled.
As a result we can't create configs with USB gadget disabled.

Since these CONFIG_ variables are now part of kconfig, move them to
the board defconfigs, and out of am335x_evm.h. This both preserves
current defaults, and allows creating configs with USB gadget off.

Signed-off-by: Alexandru Gagniuc <alex.g@adaptrum.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoARM: ti816x: Fix enabling GPIO0, enable GPIO1 as well
Tom Rini [Fri, 7 Jul 2017 19:21:45 +0000 (15:21 -0400)]
ARM: ti816x: Fix enabling GPIO0, enable GPIO1 as well

The TI816x has 2 GPIO banks.  For bank 0 we had been clearing the enable
bit when setting BIT(8).  Correct this by setting it to BIT(1) | BIT(8)
after we set and wait for BIT(1) (aka PRCM_MOD_EN).  Enable GPIO1 as
well so that when CMD_GPIO is enabled it won't crash probing the second
bank.  Enable CMD_GPIO on ti816x_evm.

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoti816x: Enable ethernet support
Tom Rini [Wed, 28 Jun 2017 16:12:03 +0000 (12:12 -0400)]
ti816x: Enable ethernet support

The ti816x SoC revision of the ethernet IP block is handled by the
"davinci_emac" driver, rather than the "cpsw" driver as done by later
members of the family.  Enable the relevant plumbing.

Signed-off-by: Sriramakrishnan <srk@ti.com>
Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agomtd: nand: make nand_info array static
Grygorii Strashko [Tue, 27 Jun 2017 00:13:08 +0000 (19:13 -0500)]
mtd: nand: make nand_info array static

Make make nand_info array static, since all direct users of nand_info array
have been converted to use get_nand_dev_by_index() API.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agoarmv8: fsl-layerscape: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:13:07 +0000 (19:13 -0500)]
armv8: fsl-layerscape: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: York Sun <york.sun@nxp.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agoboard: toradex: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:13:06 +0000 (19:13 -0500)]
board: toradex: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agoboard: BuR: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:13:05 +0000 (19:13 -0500)]
board: BuR: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoboard: ronetix: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:13:04 +0000 (19:13 -0500)]
board: ronetix: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agoboard: atmel: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:13:03 +0000 (19:13 -0500)]
board: atmel: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agocmd: mvebu: bubt: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:13:02 +0000 (19:13 -0500)]
cmd: mvebu: bubt: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agomtd: nand: drv: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:13:01 +0000 (19:13 -0500)]
mtd: nand: drv: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agonet: fm: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:13:00 +0000 (19:13 -0500)]
net: fm: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: phy: cortina: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:12:59 +0000 (19:12 -0500)]
net: phy: cortina: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agocmd: nand: remove direct access to struct mtd_info->priv
Grygorii Strashko [Tue, 27 Jun 2017 00:12:58 +0000 (19:12 -0500)]
cmd: nand: remove direct access to struct mtd_info->priv

Replace direct access to struct mtd_info->priv with proper
accessor mtd_to_nand().

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agofs: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:12:57 +0000 (19:12 -0500)]
fs: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agocommon: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:12:56 +0000 (19:12 -0500)]
common: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agocmd: jffs2: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:12:55 +0000 (19:12 -0500)]
cmd: jffs2: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agocmd: bootm: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:12:54 +0000 (19:12 -0500)]
cmd: bootm: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agodfu: dfu_nand: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:12:53 +0000 (19:12 -0500)]
dfu: dfu_nand: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agocommon: env_nand: use get_nand_dev_by_index()
Grygorii Strashko [Tue, 27 Jun 2017 00:12:52 +0000 (19:12 -0500)]
common: env_nand: use get_nand_dev_by_index()

As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agocmd: nand: abstract global variable usage for dm conversion
Mugunthan V N [Tue, 27 Jun 2017 00:12:51 +0000 (19:12 -0500)]
cmd: nand: abstract global variable usage for dm conversion

nand_info is used all over the file so abstract it with
get_nand_dev_by_index() which will help for DM conversion.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
6 years agoMerge git://git.denx.de/u-boot-dm
Tom Rini [Wed, 12 Jul 2017 00:28:46 +0000 (20:28 -0400)]
Merge git://git.denx.de/u-boot-dm

6 years agoMerge branch 'master' of git://git.denx.de/u-boot-rockchip
Tom Rini [Tue, 11 Jul 2017 18:21:50 +0000 (14:21 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-rockchip

6 years agodm: ofnode: use fdt32_t for DT property value to fix sparse warning
Masahiro Yamada [Thu, 22 Jun 2017 08:57:50 +0000 (17:57 +0900)]
dm: ofnode: use fdt32_t for DT property value to fix sparse warning

DTB is encoded in big endian.  When we retrieve property values,
we need to use fdt32_to_cpu (aka be32_to_cpu) for endian conversion.
This is a bit error-prone, but sparse is useful to detect endian
mismatch.

We need to use (fdt32_t *) instead of (u32 *) for a pointer of a
property value.  Otherwise sparse warns "cast to restricted __be32".

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: include <dm/util.h> from driver/core/dump.c
Masahiro Yamada [Thu, 22 Jun 2017 08:10:11 +0000 (17:10 +0900)]
dm: include <dm/util.h> from driver/core/dump.c

Include <dm/util.h> to fix sparse warnings:
symbol 'dm_dump_all' was not declared. Should it be static?
symbol 'dm_dump_uclass' was not declared. Should it be static?

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
6 years agodm: ofnode: simplify ofnode_read_bool()
Masahiro Yamada [Thu, 22 Jun 2017 07:54:07 +0000 (16:54 +0900)]
dm: ofnode: simplify ofnode_read_bool()

Reuse ofnode_get_property() to simplify the implementation.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
6 years agodm: ofnode: rename ofnode_read_prop() to ofnode_get_property()
Masahiro Yamada [Thu, 22 Jun 2017 07:54:05 +0000 (16:54 +0900)]
dm: ofnode: rename ofnode_read_prop() to ofnode_get_property()

This function returns the pointer to the value of a node property.
The current name ofnode_read_prop() is confusing.  Follow the naming
of_get_property() from Linux.

The return type (const u32 *) is wrong.  DT property values can be
strings as well as integers.  This is why of_get_property/fdt_getprop
returns an opaque pointer.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
6 years agodm: ofnode: simplify ofnode_read_prop()
Masahiro Yamada [Thu, 22 Jun 2017 07:54:04 +0000 (16:54 +0900)]
dm: ofnode: simplify ofnode_read_prop()

The code inside the if-block is the same as of_get_property().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
6 years agodm: ofnode: use ofnode_read_bool() to check property existence
Masahiro Yamada [Thu, 22 Jun 2017 07:54:03 +0000 (16:54 +0900)]
dm: ofnode: use ofnode_read_bool() to check property existence

This will clarify the code.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
6 years agodm: include <dm/util.h> from drivers/core/util.c
Masahiro Yamada [Thu, 22 Jun 2017 07:50:01 +0000 (16:50 +0900)]
dm: include <dm/util.h> from drivers/core/util.c

Fix sparse warnings "... was not declared. Should it be static?"

Also, fix redefinition of dm_warn/dm_dbg.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agofdt: Check for NULL return from fdt_getprop in 'fdt set'
Tom Rini [Tue, 13 Jun 2017 11:10:35 +0000 (07:10 -0400)]
fdt: Check for NULL return from fdt_getprop in 'fdt set'

While the previous pass through fixed one place where we knew that
fdt_getprop would be given a positive len, in the case of 'fdt set' we
do not, so check that we did no get NULL from fdt_getprop().

Cc: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163249)
Fixes 72c98ed1ab48 ("fdt: Add a check to do_fdt() for coverity")
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotegra: fdt: Ensure that the console UART is enabled
Simon Glass [Mon, 12 Jun 2017 12:22:01 +0000 (06:22 -0600)]
tegra: fdt: Ensure that the console UART is enabled

Many tegra boards have the console UART node disabled. With livetree this
prevents serial from working since it does not 'force' the console to be
bound. Updates the affected boards to fix this error.

The boards were checked with:

for b in $(grep  tegra boards.cfg  |grep -v integrator | \
awk '{print $7}' | sort); do
echo $b;
fdtgrep -c nvidia,tegra20-uart b/$b/u-boot.dtb |grep okay;
done

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agotegra: Show a debug message if the LCD PMIC fails to start
Simon Glass [Mon, 12 Jun 2017 12:21:59 +0000 (06:21 -0600)]
tegra: Show a debug message if the LCD PMIC fails to start

This error condition should have a debug() message. Add it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agodm: serial: Add livetree support
Simon Glass [Mon, 12 Jun 2017 12:21:58 +0000 (06:21 -0600)]
dm: serial: Add livetree support

Add support for a live device tree to the core serial uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agodm: serial: Separate out the core serial-device finding code
Simon Glass [Mon, 12 Jun 2017 12:21:57 +0000 (06:21 -0600)]
dm: serial: Separate out the core serial-device finding code

This function is quite long. Move the core code into a separate function
in preparation for adding livetree support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agodm: serial: ns16550: Convert to livetree
Simon Glass [Mon, 12 Jun 2017 12:21:56 +0000 (06:21 -0600)]
dm: serial: ns16550: Convert to livetree

Update this driver to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agotegra: Fix up include file ordering
Simon Glass [Mon, 12 Jun 2017 12:21:39 +0000 (06:21 -0600)]
tegra: Fix up include file ordering

Update these two files so include files in the right order.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agovideo: simple-panel: Add a little more debugging
Simon Glass [Mon, 12 Jun 2017 12:21:38 +0000 (06:21 -0600)]
video: simple-panel: Add a little more debugging

Add some debugging to show when the backlight is enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agodm: video: Update pwm_backlight to support livetree
Simon Glass [Mon, 12 Jun 2017 12:21:37 +0000 (06:21 -0600)]
dm: video: Update pwm_backlight to support livetree

Update this driver to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agodm: video: Sync display on backspace
Simon Glass [Mon, 12 Jun 2017 12:21:36 +0000 (06:21 -0600)]
dm: video: Sync display on backspace

We should sync the display (e.g. flush cache) when backspace is pressed
to ensure that the character is erased correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agotegra: nyan-big: Enable bootstage
Simon Glass [Mon, 12 Jun 2017 12:21:35 +0000 (06:21 -0600)]
tegra: nyan-big: Enable bootstage

Enable full bootstage support so we can time SPL and U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agodm: Fix error handling when unflattening the DT
Simon Glass [Mon, 12 Jun 2017 12:21:34 +0000 (06:21 -0600)]
dm: Fix error handling when unflattening the DT

The error handling code does not current detect an error right away.
Adjust it to return immediately.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agotegra: nyan-big: Enable the debug UART
Simon Glass [Mon, 12 Jun 2017 12:21:33 +0000 (06:21 -0600)]
tegra: nyan-big: Enable the debug UART

Enable this to allow debugging when the serial UART driver is
misconfigured.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agotegra: video: Time the LCD init
Simon Glass [Mon, 12 Jun 2017 12:21:32 +0000 (06:21 -0600)]
tegra: video: Time the LCD init

Calculate the time taken to set up the LCD.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agodm: core: Add functions to obtain node's address/size cells
Simon Glass [Mon, 12 Jun 2017 12:21:31 +0000 (06:21 -0600)]
dm: core: Add functions to obtain node's address/size cells

The of_n_addr_cells() and of_n_size_cells() functions are useful for
getting the size of addresses in a node, but in a few places U-Boot needs
to obtain the actual property value for a node without walking up the
stack. Add functions for this and just the existing code to use it.

Add a comment to the existing ofnode functions which do not do the right
thing with a flat tree.

This fixes a problem reading PCI addresses.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agodm: core: Add dev_read_enabled() to check if a device is enabled
Simon Glass [Mon, 12 Jun 2017 12:21:30 +0000 (06:21 -0600)]
dm: core: Add dev_read_enabled() to check if a device is enabled

This function allows a device's status to be read. This indicates whether
the device should be enabled or disabled.

Note: In normal operation disabled devices will not be present in the
driver-model tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agodm: core: Add dev_read_resource() to read device resources
Simon Glass [Mon, 12 Jun 2017 12:21:29 +0000 (06:21 -0600)]
dm: core: Add dev_read_resource() to read device resources

Add a function which reads resources from a device, such as the device
hardware address. This uses the "reg" property in the device.

Unlike other functions there is little sense in inlining this when
livetree is not being used because it has some logic in it and this would
just bloat the code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agodm: core: Add ofnode_read_string_count()
Simon Glass [Mon, 12 Jun 2017 12:21:28 +0000 (06:21 -0600)]
dm: core: Add ofnode_read_string_count()

This provides a way to find the number of strings in a string list. Add it
and also fix up the comment for ofnode_read_string_index().

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

6 years agobinman: Put our local modules ahead of system modules
Simon Glass [Wed, 21 Jun 2017 03:28:49 +0000 (21:28 -0600)]
binman: Put our local modules ahead of system modules

If a system module is named the same as one of those used by binman we
currently pick the system module. Adjust the ordering so that our modules
are chosen instead.

The module conflict reported was 'tools' from jira-python. I cannot access
that package to test it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Kevin Hilman <khilman@baylibre.com>
Acked-by: Kevin Hilman <khilman@baylibre.com>
6 years agodtoc: Add tests
Simon Glass [Mon, 19 Jun 2017 04:09:06 +0000 (22:09 -0600)]
dtoc: Add tests

Add some tests of dtoc's functionality to make it easier to expand and
enhance the tool.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Stop printing platdata at the start of SPL
Simon Glass [Mon, 19 Jun 2017 04:09:05 +0000 (22:09 -0600)]
sandbox: Stop printing platdata at the start of SPL

Currently we have code which prints out platform data at the start of SPL.
Now that we have tests for dtoc this is probably not necessary. Drop it.
Update test_ofplatdata to check for empty output since it is useful to
check that sandbox_spl works as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodtoc: Add a comment about string replace in conv_name_to_c()
Simon Glass [Mon, 19 Jun 2017 04:09:04 +0000 (22:09 -0600)]
dtoc: Add a comment about string replace in conv_name_to_c()

This function uses several separate string replaces where a regular
expression might seem more reasonable. Add a comment justifying the way it
is currently done.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodtoc: Move the main logic into the dtb_platdata file
Simon Glass [Mon, 19 Jun 2017 04:09:03 +0000 (22:09 -0600)]
dtoc: Move the main logic into the dtb_platdata file

Collect the main logic of dtoc into a function and put it into
dtb_platdata. This will allow tests to use this function instead of
duplicating the code themselves.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodtoc: Move static functions out of the class
Simon Glass [Mon, 19 Jun 2017 04:09:02 +0000 (22:09 -0600)]
dtoc: Move static functions out of the class

Rather than using static functions within the class, move them out of the
class. This will make it slightly easier for tests to call them.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodtoc: Pass include_disabled explicitly
Simon Glass [Mon, 19 Jun 2017 04:09:01 +0000 (22:09 -0600)]
dtoc: Pass include_disabled explicitly

This option is the only one actually used by the dtb_platdata class. Pass
it explicitly to avoid needing to pass the whole option object to the
constructor.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodtoc: Don't handle properties with / in them
Simon Glass [Mon, 19 Jun 2017 04:09:00 +0000 (22:09 -0600)]
dtoc: Don't handle properties with / in them

This conversion appears to not be needed as it does not occur in practice.
Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodtoc: Fix pylint warnings
Simon Glass [Mon, 19 Jun 2017 04:08:59 +0000 (22:08 -0600)]
dtoc: Fix pylint warnings

Unfortunately I neglected to run pylint on this tool with its initial
submission. Fix the warnings.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodtoc: Split out the main class into its own file
Simon Glass [Mon, 19 Jun 2017 04:08:58 +0000 (22:08 -0600)]
dtoc: Split out the main class into its own file

To simplify running tests we should move this class into its own file.
This allows the tests to import it without having to import dtoc.py, which
runs the tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodtoc: Add a comment at the top
Simon Glass [Mon, 19 Jun 2017 04:08:57 +0000 (22:08 -0600)]
dtoc: Add a comment at the top

Add a description of the dtoc tool at the top of the file.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodtoc: Use self._options instead of the global options
Simon Glass [Mon, 19 Jun 2017 04:08:56 +0000 (22:08 -0600)]
dtoc: Use self._options instead of the global options

This class should use the options object passed to it rather than finding
the global one. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agomoveconfig: Allow automatic location and adding of 'imply'
Simon Glass [Fri, 16 Jun 2017 03:39:33 +0000 (21:39 -0600)]
moveconfig: Allow automatic location and adding of 'imply'

By using a Kconfig parser we can find the location of each option in the
Kconfig tree. Using the information from the database we can then
automatically add an 'imply' option into the right place if requested by
the user.

Add a -a option to support adding 'imply' options. Display the location of
any existing 'imply' option so that progress can be examined. Add a -A
option to hide any existing 'imply' options so that already-completed
additions need not be considered further.

Also add documentation for this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agomoveconfig: Allow control of which implying configs are shown
Simon Glass [Fri, 16 Jun 2017 03:39:32 +0000 (21:39 -0600)]
moveconfig: Allow control of which implying configs are shown

Sometimes it is useful to display CONFIG_TARGET or CONFIG_CMD configs. Add
an option to control this.

Also we generally ignore implying configs which affect fewer than 5
boards. But sometimes it is useful to show those those, so add an option
that reduces the minimum to two.

ERRATUM configs are never useful for implying things, so ignore those.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agomoveconfig: Allow piping in 'git show --stat' output
Simon Glass [Fri, 16 Jun 2017 03:39:31 +0000 (21:39 -0600)]
moveconfig: Allow piping in 'git show --stat' output

It is useful to be able to process only a subset of boards to save time.
Often that subset is defined by the defconfig files in a git commit. This
change allows things like:

   # Build the database
   ./tools.moveconfig.py -b

   # Find some implying configs
   ./tools/moveconfig.py -i CONFIG_X

   # Add some 'imply' statements to Kconfig files
   ./tools/moveconfig.py -i CONFIG_X -a CONFIG_A,CONFIG_B

   # Reprocess the defconfig files to see if we can drop some changes
   git show --stat | ./tools/moveconfig.py -s -d -

   # Update the commit, with fewer defconfig changes
   gii commit -au

Where the commit contains defconfig files, this will reprocess them to
take account of the imply statements that you added.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Drop special case console code for sandbox
Simon Glass [Fri, 16 Jun 2017 03:37:54 +0000 (21:37 -0600)]
sandbox: Drop special case console code for sandbox

At present sandbox has a special case where it directly calls os_putc()
when it does not have a console yet.

Now that we have the pre-console buffer enabled we can drop this. Any
early characters will be buffered and output later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
6 years agosandbox: Enable more console options
Simon Glass [Fri, 16 Jun 2017 03:37:53 +0000 (21:37 -0600)]
sandbox: Enable more console options

Enable the pre-console buffer, displaying the model and post-relocation
console announce on sandbox. Also add a model name to the device tree.
This allows testing of these features.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
6 years agoconsole: Use map_sysmem() for the pre-relocation console
Simon Glass [Fri, 16 Jun 2017 03:37:52 +0000 (21:37 -0600)]
console: Use map_sysmem() for the pre-relocation console

At present this feature casts the address to a pointer. Use the
map_sysmem() function so that it will work correctly on sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
6 years agotest: Add a test for snprintf() and the banner/version
Simon Glass [Fri, 16 Jun 2017 03:37:51 +0000 (21:37 -0600)]
test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
6 years agoAllow displaying the U-Boot banner on a video display
Simon Glass [Fri, 16 Jun 2017 03:37:50 +0000 (21:37 -0600)]
Allow displaying the U-Boot banner on a video display

At present the U-Boot banner is only displayed on the serial console. If
this is not visible to the user, the banner does not show. Some devices
have a video display which can usefully display this information.

Add a banner which is printed after relocation only on non-serial devices
if CONFIG_DISPLAY_BOARDINFO_LATE is defined.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
6 years agodisplay_options: Refactor to allow obtaining the banner
Simon Glass [Fri, 16 Jun 2017 18:51:42 +0000 (12:51 -0600)]
display_options: Refactor to allow obtaining the banner

Move the display options code into a separate function so that the U-Boot
banner can be obtained from other code. Adjust the 'version' command to
use 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>
Tested-by: Stephen Warren <swarren@nvidia.com>
6 years agox86: Move link to use driver model for SCSI
Simon Glass [Thu, 15 Jun 2017 03:28:48 +0000 (21:28 -0600)]
x86: Move link to use driver model for SCSI

As a demonstration of how to use SCSI with driver model, move link over
to use this. This patch needs more work, but illustrates the concept.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: scsi: Drop scsi_init() when driver model is used
Simon Glass [Thu, 15 Jun 2017 03:28:47 +0000 (21:28 -0600)]
dm: scsi: Drop scsi_init() when driver model is used

This function should not be used with driver model. Update the code to
reflect this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: ahci: Add a driver for SCSI on AHCI
Simon Glass [Thu, 15 Jun 2017 03:28:46 +0000 (21:28 -0600)]
dm: ahci: Add a driver for SCSI on AHCI

Some AHCI drivers use SCSI under the hood. Rather than making the AHCI
driver be in the SCSI uclass it makes sense to have the AHCI device create
a SCSI device as a child. That way we can handle any AHCI-specific
operations rather than trying to pretend tha the device is just SCSI.

To handle this we need to provide a way for AHCI drivers to bind a SCSI
device as its child, and probe it. Add functions for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: scsi: Split out the bus scanning code
Simon Glass [Thu, 15 Jun 2017 03:28:45 +0000 (21:28 -0600)]
dm: scsi: Split out the bus scanning code

Split out the code that scans a single SCSI bus into a separate function.
This will allow it to be used from driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: scsi: Adjust return value of scsi_exec()
Simon Glass [Thu, 15 Jun 2017 03:28:44 +0000 (21:28 -0600)]
dm: scsi: Adjust return value of scsi_exec()

Change this function to return an error number instead of true/false.
This allows us to return a proper error number.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: scsi: Add operations for SCSI devices
Simon Glass [Thu, 15 Jun 2017 03:28:43 +0000 (21:28 -0600)]
dm: scsi: Add operations for SCSI devices

The SCSI uclass currently has no operations. It just uses the global SCSI
functions. Fix this by adding operations to the only two drivers that use
the uclass, and replacing the global functions with those defined locally
in the SCSI code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: ahci: Create a local version of two SCSI functions
Simon Glass [Thu, 15 Jun 2017 03:28:42 +0000 (21:28 -0600)]
dm: ahci: Create a local version of two SCSI functions

With driver model we need to define implementations of exec() and
bus_reset() separately for each SCSI driver. As a first step, create a
local version of each function in the AHCI driver and call each from its
global version.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: scsi: Document and rename the scsi_scan() parameter
Simon Glass [Thu, 15 Jun 2017 03:28:41 +0000 (21:28 -0600)]
dm: scsi: Document and rename the scsi_scan() parameter

The 'mode' parameter is actually a flag to determine whether to display
a list of devices found during the scan. Rename it to reflect this, add a
function comment and adjust callers to use a boolean.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: scsi: Add a device pointer to scan_exec(), scsi_bus_reset()
Simon Glass [Thu, 15 Jun 2017 03:28:40 +0000 (21:28 -0600)]
dm: scsi: Add a device pointer to scan_exec(), scsi_bus_reset()

With driver model these functions need a device pointer. Add one even
when CONFIG_DM_SCSI is not defined. This avoids having ugly conditional
function prototypes, When CONFIG_DM_SCSI is not defined we can just ignore
the pointer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: scsi: Add operations
Simon Glass [Thu, 15 Jun 2017 03:28:39 +0000 (21:28 -0600)]
dm: scsi: Add operations

Add operations for SCSI. These are not yet implemented, but we have the
struct.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: ahci: Drop use of probe_ent
Simon Glass [Thu, 15 Jun 2017 03:28:38 +0000 (21:28 -0600)]
dm: ahci: Drop use of probe_ent

With driver model we cannot have static data or assume that there is only
one device of each time. Adjust the code so that 'probe_ent' is not needed
with driver model. Add a new ahci_init_dm() function which can init AHCI
for driver model without re-allocating the uclass data. Move over the only
existing driver to use this new function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: ahci: Unwind the confusing init code
Simon Glass [Thu, 15 Jun 2017 03:28:37 +0000 (21:28 -0600)]
dm: ahci: Unwind the confusing init code

Two AHCI drivers use SCSI with CONFIG_DM_SCSI. The SCSI uclass calls
scsi_low_level_init() which is implemented by ahci.c. If
CONFIG_SCSI_AHCI_PLAT is defined it does one thing and if it is not
it does something else.

We don't need to call through scsi_low_level_init() to get the init
completed. Instead, adjust the two drivers to call into AHCI directly.
Drop the post-probe init in the SCSI uclass. This means that driver model
doesn't need to use scsi_low_level_init(). It is a legacy function and
driver model should use a driver's probe() method instead.

While we are here, add a comment to the top of the file explaining what
ahci.c does.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: ahci: Move common code for starting ports into a function
Simon Glass [Thu, 15 Jun 2017 03:28:36 +0000 (21:28 -0600)]
dm: ahci: Move common code for starting ports into a function

This code is duplicated. Create a ahci_start_ports() function to handle
this and call it from both places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: scsi: Indent the confusing #ifdefs
Simon Glass [Thu, 15 Jun 2017 03:28:35 +0000 (21:28 -0600)]
dm: scsi: Indent the confusing #ifdefs

These are very confusing without some sort of indentation. At some point
we will be able to remove them, but for now, indent them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: ahci: Refactor to avoid static variables
Simon Glass [Thu, 15 Jun 2017 03:28:34 +0000 (21:28 -0600)]
dm: ahci: Refactor to avoid static variables

With driver model we need each device to have its own state. As a step
towards this, restrict use of the global 'probe_ent' to just a few places
in the file. This will allow us to add driver-model functions which can
pass the correct data around.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: sata: Move ataid into struct ahci_uc_priv
Simon Glass [Thu, 15 Jun 2017 03:28:33 +0000 (21:28 -0600)]
dm: sata: Move ataid into struct ahci_uc_priv

This array relates to the AHCI controller so should be exist out on its
own in the file. Move it into the structure. Adjust functions that need
access to this to take the structure as a parameter.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: ahci: Rename struct ahci_probe_ent
Simon Glass [Thu, 15 Jun 2017 03:28:32 +0000 (21:28 -0600)]
dm: ahci: Rename struct ahci_probe_ent

This is not a very useful name since once it is probed it still hangs
around. With driver model we will use uclass data for this, so rename the
struct.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agodm: scsi: Use the uclass platform data
Simon Glass [Thu, 15 Jun 2017 03:28:31 +0000 (21:28 -0600)]
dm: scsi: Use the uclass platform data

At present the two driver-model SCSI drivers use device platform data to
store information that relates to the uclass. It is better to use uclass
platform data in this situation. Update the code to do this.

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