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.
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.
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.
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.
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.
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.
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>
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>
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>
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>
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
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.
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.
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>
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.
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.
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.
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.
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.
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.
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.
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Simon Glass [Thu, 15 Jun 2017 03:28:27 +0000 (21:28 -0600)]
scsi: Move drivers into new drivers/scsi directory
At present we have the SCSI drivers in the drivers/block and common/
directories. It is better to split them out into their own place. Use
drivers/scsi which is what Linux does.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass [Thu, 15 Jun 2017 03:28:26 +0000 (21:28 -0600)]
sata: Move drivers into new drivers/ata directory
At present we have the SATA and PATA drivers mixed up in the drivers/block
directory. It is better to split them out into their own place. Use
drivers/ata which is what Linux does.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass [Thu, 15 Jun 2017 03:28:25 +0000 (21:28 -0600)]
Kconfig: Add CONFIG_SATA to enable SATA
At present CONFIG_CMD_SATA enables the 'sata' command which also brings
in SATA support. Some boards may wish to enable SATA without the command.
Add a separate CONFIG to permit this.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass [Thu, 15 Jun 2017 03:28:23 +0000 (21:28 -0600)]
scsi: Drop scsi_print_error()
This function is only defined by one driver and is empty. Move it into
the SCSI implementation itself. We could remove it, but it should be
useful for debugging.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass [Wed, 14 Jun 2017 03:10:06 +0000 (21:10 -0600)]
dtoc: Support multiple compatible strings in a node
Sometimes a node will have multiple compatible strings. Drivers may use
one or the other so the best approach seems to be to #define them to be
equivalent.
Update dtoc to support this.
Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Kever Yang <kever.yang@rock-chips.com>
Simon Glass [Fri, 2 Jun 2017 01:39:03 +0000 (19:39 -0600)]
moveconfig: Support looking for implied CONFIG options
Some CONFIG options can be implied by others and this can help to reduce
the size of the defconfig files. For example, CONFIG_X86 implies
CONFIG_CMD_IRQ, so we can put 'imply CMD_IRQ' under 'config X86' and
all x86 boards will have that option, avoiding adding CONFIG_CMD_IRQ to
each of the x86 defconfig files.
Add a -i option which searches for such options.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de>
Simon Glass [Fri, 2 Jun 2017 01:39:02 +0000 (19:39 -0600)]
moveconfig: Support building a simple config database
Add a -b option which scans all the defconfigs and builds a database of
all the CONFIG options used by each. This is useful for querying later.
At present this only works with the separate -b option, which does not
move any configs. It would be possible to adjust the script to build the
database automatically when moving configs, but this might not be useful
as the database does not change that often.
Simon Glass [Fri, 2 Jun 2017 01:38:58 +0000 (19:38 -0600)]
moveconfig: Support providing a path to the defconfig files
It is convenient to provide the full patch to the defconfig files in some
situations, e.g. when the file was generated by a shell command (e.g.
'ls configs/zynq*').
Add support for this, and move the globbing code into a function with its
own documentation.
Simon Glass [Mon, 24 Apr 2017 02:10:45 +0000 (20:10 -0600)]
dm: core: Add uclass_first/next_device_check()
Sometimes it is useful to iterate through all devices in a uclass and
skip over those which do not work correctly (e.g fail to probe). Add two
new functions to provide this feature.
The caller must check the return value each time to make sure that the
device is valid. But the device pointer is always returned.
Sjoerd Simons [Mon, 26 Jun 2017 08:01:46 +0000 (10:01 +0200)]
rockchip: rk3288: Add pinctrl support for the gmac ethernet interface
Add support for the gmac ethernet interface to pinctrl. This hardcodes
the setup to match that of the firefly and Radxa Rock2 boards, using the
RGMII phy mode for gmac interface and GPIO4B0 as the phy reset GPIO.
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Signed-off-by: Romain Perier <romain.perier@collabora.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Kever Yang [Thu, 8 Jun 2017 07:32:05 +0000 (15:32 +0800)]
rockchip: evb-rk3328: enable boot on regulator
Enable all the boot-on regulator in default.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Use fixed regulator for sdmmc-pwren for sdmmc power.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>