]> git.karo-electronics.de Git - karo-tx-uboot.git/log
karo-tx-uboot.git
7 years agotreewide: replace #include <asm-generic/errno.h> with <linux/errno.h>
Masahiro Yamada [Wed, 21 Sep 2016 02:28:57 +0000 (11:28 +0900)]
treewide: replace #include <asm-generic/errno.h> with <linux/errno.h>

Now, include/linux/errno.h is a wrapper of <asm-generic/errno.h>.
Replace all include directives for <asm-generic/errno.h> with
<linux/errno.h>.

<asm-generic/...> is supposed to be included from <asm/...> when
arch-headers fall back into generic implementation. Generally, they
should not be directly included from .c files.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Add drivers/usb/host/xhci-rockchip.c]
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoRemove arch/${ARCH}/include/asm/errno.h
Masahiro Yamada [Wed, 21 Sep 2016 02:28:56 +0000 (11:28 +0900)]
Remove arch/${ARCH}/include/asm/errno.h

Unlike Linux, nothing about errno.h is arch-specific in U-Boot.
As you see, all of arch/${ARCH}/include/asm/errno.h is just a
wrapper of <asm-generic/errno.h>.  Actually, U-Boot does not
export headers to user-space, so we just have to care about the
consistency in the U-Boot tree.

Now all of include directives for <asm/errno.h> are gone.
Deprecate <asm/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
7 years agotreewide: replace #include <asm/errno.h> with <linux/errno.h>
Masahiro Yamada [Wed, 21 Sep 2016 02:28:55 +0000 (11:28 +0900)]
treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content.  (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoAdd <linux/errno.h> as a wrapper of <asm-generic/errno.h>
Masahiro Yamada [Wed, 21 Sep 2016 02:28:54 +0000 (11:28 +0900)]
Add <linux/errno.h> as a wrapper of <asm-generic/errno.h>

This will be used to consolidate errno.h variants.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agotreewide: use #include <...> to include public headers
Masahiro Yamada [Wed, 21 Sep 2016 02:28:53 +0000 (11:28 +0900)]
treewide: use #include <...> to include public headers

We are supposed to use #include <...> to include headers in the
public include paths.  We should use #include "..." only for headers
in local directories.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agodrivers: squash lines for immediate return
Masahiro Yamada [Tue, 6 Sep 2016 13:17:39 +0000 (22:17 +0900)]
drivers: squash lines for immediate return

Remove unneeded variables and assignments.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoarch, board: squash lines for immediate return
Masahiro Yamada [Tue, 6 Sep 2016 13:17:38 +0000 (22:17 +0900)]
arch, board: squash lines for immediate return

Remove unneeded variables and assignments.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
Reviewed-by: Angelo Dureghello <angelo@sysam.it>
7 years agolibfdt: simplify fdt_del_mem_rsv()
Masahiro Yamada [Tue, 6 Sep 2016 13:17:37 +0000 (22:17 +0900)]
libfdt: simplify fdt_del_mem_rsv()

The variable "err" is unneeded.

[ Device Tree Compiler commit: 36fd7331fb11276c09a6affc0d8cd4977f2fe100 ]

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agox86: squash lines for immediate return
Masahiro Yamada [Tue, 6 Sep 2016 13:17:36 +0000 (22:17 +0900)]
x86: squash lines for immediate return

arch_cpu_init() can be simpler by this refactoring.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agousb: squash lines for immediate return
Masahiro Yamada [Tue, 6 Sep 2016 13:17:35 +0000 (22:17 +0900)]
usb: squash lines for immediate return

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agousb: replace ehci_*_remove() with usb_deregister()
Masahiro Yamada [Tue, 6 Sep 2016 13:17:34 +0000 (22:17 +0900)]
usb: replace ehci_*_remove() with usb_deregister()

The remove callbacks of EHCI drivers are often just a wrapper of
ehci_deregister.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
7 years agovideo: squash lines for immediate return
Masahiro Yamada [Tue, 6 Sep 2016 13:17:33 +0000 (22:17 +0900)]
video: squash lines for immediate return

For vidconsole_post_probe(), it is common coding style to let a
probe method return the value of a register function.

The others will become simple wrapper functions.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
7 years agommc: squash lines for immediate return
Masahiro Yamada [Tue, 6 Sep 2016 13:17:32 +0000 (22:17 +0900)]
mmc: squash lines for immediate return

These functions can be much simpler by squashing lines for immediate
return.

For *_bind() callbacks, they will be a simple wrapper function of an
upper-level bind API.

For mmc_set_{boot_bus_width,part_conf}, they will be a wrapper of
mmc_switch().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
7 years agofs-test.sh: Update expected results
Tom Rini [Fri, 23 Sep 2016 13:29:49 +0000 (09:29 -0400)]
fs-test.sh: Update expected results

Thanks to Stefan Brüns we have more tests and a few more passes too,
update the expected output now.

Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoext4: Revert rejection of 64bit enabled ext4 fs
Stefan Brüns [Sat, 17 Sep 2016 00:10:12 +0000 (02:10 +0200)]
ext4: Revert rejection of 64bit enabled ext4 fs

Enable mounting of ext4 fs with 64bit feature, as it is supported now.
These had been disabled in 6f94ab6656ceffb3f2a972c8de4c554502b6f2b7.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agoext4: Respect group descriptor size when adjusting free counts
Stefan Brüns [Mon, 19 Sep 2016 23:13:01 +0000 (01:13 +0200)]
ext4: Respect group descriptor size when adjusting free counts

Also adjust high 16/32 bits when free inode/block counts are modified.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agoext4: Use helper function to access group descriptor and its fields
Stefan Brüns [Sat, 17 Sep 2016 00:10:10 +0000 (02:10 +0200)]
ext4: Use helper function to access group descriptor and its fields

The descriptor size is variable, thus array indices are not generically
applicable. The larger group descriptors also contain e.g. high parts
of block numbers, which have to be read and written.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agoext4: Use correct descriptor size when reading the block group descriptor
Stefan Brüns [Sat, 17 Sep 2016 00:10:09 +0000 (02:10 +0200)]
ext4: Use correct descriptor size when reading the block group descriptor

The correct descriptor size must be used when calculating offsets, and
also to read the correct amount of data.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agoext4: Add helper functions for block group descriptor field access
Stefan Brüns [Mon, 19 Sep 2016 23:12:42 +0000 (01:12 +0200)]
ext4: Add helper functions for block group descriptor field access

The helper functions encapsulate access of the block group descriptors,
independent of group descriptor size. The helpers also deal with the
endianess of the fields, and with split fields like free_blocks/
free_blocks_high.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agoext4: determine group descriptor size for 64bit feature
Stefan Brüns [Sat, 17 Sep 2016 00:10:07 +0000 (02:10 +0200)]
ext4: determine group descriptor size for 64bit feature

If EXT4_FEATURE_INCOMPAT_64BIT is set, the descriptor can be read from
the superblocks, otherwise it defaults to 32.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agoext4: Update ext2/3/4 superblock, group descriptor and inode structures
Stefan Brüns [Sat, 17 Sep 2016 00:10:06 +0000 (02:10 +0200)]
ext4: Update ext2/3/4 superblock, group descriptor and inode structures

Most importantly, the superblock provides the used group descriptor size,
which is required for the EXT4_FEATURE_INCOMPAT_64BIT.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agoext4: Fix memory leak of journal buffer if block is updated multiple times
Stefan Brüns [Tue, 6 Sep 2016 02:36:56 +0000 (04:36 +0200)]
ext4: Fix memory leak of journal buffer if block is updated multiple times

If the same block is updated multiple times in a row during a single
file system operation, gd_index is decremented to use the same journal
entry again. Avoid loosing the already allocated buffer.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agoext4: Correct block number handling, empty block vs. error code
Stefan Brüns [Tue, 6 Sep 2016 02:36:55 +0000 (04:36 +0200)]
ext4: Correct block number handling, empty block vs. error code

read_allocated block may return block number 0, which is just an indicator
a chunk of the file is not backed by a block, i.e. it is sparse.

During file deletions, just continue with the next logical block, for other
operations treat blocknumber <= 0 as an error.

For writes, blocknumber 0 should never happen, as U-Boot always allocates
blocks for the whole file.  Reading already handles this correctly, i.e. the
read buffer is 0-fillled.

Not treating block 0 as sparse block leads to FS corruption, e.g.
./sandbox/u-boot -c 'host bind 0 ./sandbox/test/fs/3GB.ext4.img ;
ext4write host 0 0 /2.5GB.file 1 '
The 2.5GB.file from the fs test is actually a sparse file.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agoext4: remove duplicated block release code for extents
Stefan Brüns [Tue, 6 Sep 2016 02:36:54 +0000 (04:36 +0200)]
ext4: remove duplicated block release code for extents

The data blocks are identical for files using traditional direct/indirect
block allocation scheme and extent trees, thus this code part can be
common. Only the code to deallocate the indirect blocks to record the
used blocks has to be seperate, respectively the code to release extent
tree index blocks.

Actually the code to release the extent tree index blocks is still missing,
but at least add a FIXME at the appropriate place.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agoext4: initialize full inode for inodes bigger than 128 bytes
Stefan Brüns [Tue, 6 Sep 2016 02:36:53 +0000 (04:36 +0200)]
ext4: initialize full inode for inodes bigger than 128 bytes

Make sure the the extra_isize field (offset 128) is initialized to 0, to
mark any extra data as invalid.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agoext4: Use correct value for inode size even on revision 0 filesystems
Stefan Brüns [Tue, 6 Sep 2016 02:36:52 +0000 (04:36 +0200)]
ext4: Use correct value for inode size even on revision 0 filesystems

fs->inodesz is already correctly (i.e. dependent on fs revision)
initialized in ext4fs_mount.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agoext4: Fix memory leak in case of failure
Stefan Brüns [Tue, 6 Sep 2016 02:36:51 +0000 (04:36 +0200)]
ext4: Fix memory leak in case of failure

temp_ptr should always be freed, even if the function is left via
goto fail.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agoext4: Avoid out-of-bounds access of block bitmap
Stefan Brüns [Tue, 6 Sep 2016 02:36:50 +0000 (04:36 +0200)]
ext4: Avoid out-of-bounds access of block bitmap

If the blocksize is 1024, count is initialized with 1. Incrementing count
by 8 will never match (count == fs->blksz * 8), and ptr may be
incremented beyond the buffer end if the bitmap is filled. Add the
startblock offset after the loop.

Remove the second loop, as only the first iteration will be done.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agoext4: After completely filled group, scan next group from the beginning
Stefan Brüns [Tue, 6 Sep 2016 02:36:49 +0000 (04:36 +0200)]
ext4: After completely filled group, scan next group from the beginning

The last free block of a block group may be in its middle. After it has
been allocated, the next block group should be scanned from its beginning.

The following command triggers the bad behaviour (on a blocksize 1024 fs):

./sandbox/u-boot -c 'i=0; host bind 0 ./disk.raw ;
while test $i -lt 260 ; do echo $i; setexpr i $i + 1;
ext4write host 0:2 0 /X${i} 0x1450; done ;
ext4write host 0:2 0 /X240 0x2000 ; '

When 'X240' is extended from 5200 byte to 8192 byte, the new blocks should
start from the first free block (8811), but it uses the blocks 8098-8103
and 16296-16297 -- 8103 + 1 + 8192 = 16296. This can be shown with
debugfs, commands 'ffb' and 'stat X240'.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agoext4: Do not clear zalloc'ed buffers a second time
Stefan Brüns [Tue, 6 Sep 2016 02:36:48 +0000 (04:36 +0200)]
ext4: Do not clear zalloc'ed buffers a second time

zero_buffer is never written, thus clearing it is pointless.
journal_buffer is completely initialized by ext4fs_devread (or in case
of failure, not used).

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agoext4: Only update number of of unused inodes if GDT_CSUM feature is set
Stefan Brüns [Tue, 6 Sep 2016 02:36:47 +0000 (04:36 +0200)]
ext4: Only update number of of unused inodes if GDT_CSUM feature is set

e2fsck warns about "Group descriptor 0 marked uninitialized without
feature set."
The bg_itable_unused field is only defined if FEATURE_RO_COMPAT_GDT_CSUM
is set, and should be set (kept) zero otherwise.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agoext4: Scan all directory blocks when looking up an entry
Stefan Brüns [Tue, 6 Sep 2016 02:36:46 +0000 (04:36 +0200)]
ext4: Scan all directory blocks when looking up an entry

Scanning only the direct blocks of the directory file may falsely report
an existing file as nonexisting, and worse can also lead to creation
of a duplicate entry on file creation.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agoext4: Avoid corruption of directories with hash tree indexes
Stefan Brüns [Tue, 6 Sep 2016 02:36:45 +0000 (04:36 +0200)]
ext4: Avoid corruption of directories with hash tree indexes

While directories can be read using the old linear scan method, adding a
new file would require updating the index tree (alternatively, the whole
tree could be removed).

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agoext4: Scan all directory blocks for space when inserting a new entry
Stefan Brüns [Tue, 6 Sep 2016 02:36:44 +0000 (04:36 +0200)]
ext4: Scan all directory blocks for space when inserting a new entry

Previously, only the last directory block was scanned for available space.
Instead, scan all blocks back to front, and if no sufficient space is
found, eventually append a new block.
Blocks are only appended if the directory does not use extents or the new
block would require insertion of indirect blocks, as the old code does.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agoext4: Do not crash when trying to grow a directory using extents
Stefan Brüns [Tue, 6 Sep 2016 02:36:43 +0000 (04:36 +0200)]
ext4: Do not crash when trying to grow a directory using extents

The following command crashes u-boot:
./sandbox/u-boot -c 'i=0; host bind 0 ./sandbox/test/fs/3GB.ext4.img ;
  while test $i -lt 200 ; do echo $i; setexpr i $i + 1;
  ext4write host 0 0 /foobar${i} 0; done'

Previously, the code updated the direct_block even for extents, and
fortunately crashed before pushing garbage to the disk.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agoext4: propagate error if creation of directory entry fails
Stefan Brüns [Tue, 6 Sep 2016 02:36:42 +0000 (04:36 +0200)]
ext4: propagate error if creation of directory entry fails

In case the dir entry creation failed, ext4fs_write would later overwrite
a random inode, as inodeno was never initialized.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agoext4: fix possible crash on directory traversal, ignore deleted entries
Stefan Brüns [Tue, 6 Sep 2016 02:36:41 +0000 (04:36 +0200)]
ext4: fix possible crash on directory traversal, ignore deleted entries

The following command triggers a segfault in search_dir:
./sandbox/u-boot -c 'host bind 0 ./sandbox/test/fs/3GB.ext4.img ;
    ext4write host 0 0 /./foo 0x10'

The following command triggers a segfault in check_filename:
./sandbox/u-boot -c 'host bind 0 ./sandbox/test/fs/3GB.ext4.img ;
    ext4write host 0 0 /. 0x10'

"." is the first entry in the directory, thus previous_dir is NULL. The
whole previous_dir block in search_dir seems to be a bad copy from
check_filename(...). As the changed data is not written to disk, the
statement is mostly harmless, save the possible NULL-ptr reference.

Typically a file is unlinked by extending the direntlen of the previous
entry. If the entry is the first entry in the directory block, it is
invalidated by setting inode=0.

The inode==0 case is hard to trigger without crafted filesystems. It only
hits if the first entry in a directory block is deleted and later a lookup
for the entry (by name) is done.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agoext4: fix wrong usage of le32_to_cpu()
Michael Walle [Mon, 29 Aug 2016 08:46:46 +0000 (10:46 +0200)]
ext4: fix wrong usage of le32_to_cpu()

le32_to_cpu() must only convert the revision_level and not the boolean
result.

Signed-off-by: Michael Walle <michael@walle.cc>
7 years agoext4: fix endianess problems in ext4 write support
Michael Walle [Thu, 1 Sep 2016 09:21:40 +0000 (11:21 +0200)]
ext4: fix endianess problems in ext4 write support

All fields were accessed directly instead of using the proper byte swap
functions. Thus, ext4 write support was only usable on little-endian
architectures. Fix this.

Signed-off-by: Michael Walle <michael@walle.cc>
7 years agoext4: use kernel names for byte swaps
Michael Walle [Mon, 29 Aug 2016 08:46:44 +0000 (10:46 +0200)]
ext4: use kernel names for byte swaps

Instead of __{be,le}{16,32}_to_cpu use {be,le}{16,32}_to_cpu.

Signed-off-by: Michael Walle <michael@walle.cc>
7 years agoext4: change structure fields to __le/__be types
Michael Walle [Mon, 29 Aug 2016 08:46:43 +0000 (10:46 +0200)]
ext4: change structure fields to __le/__be types

Change all the types of ext2/4 fields to little endian types and all the
JBD fields to big endian types. Now we can use sparse (make C=1) to check
for statements where we need byteswaps.

Signed-off-by: Michael Walle <michael@walle.cc>
7 years agotest/fs: Check writes using "." (same dir) relative path
Stefan Brüns [Tue, 13 Sep 2016 23:01:31 +0000 (01:01 +0200)]
test/fs: Check writes using "." (same dir) relative path

<path>/<fname> and <path>/./<fname> should reference the same file.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agotest/fs: Check ext4 behaviour if dirent is first entry in directory block
Stefan Brüns [Tue, 13 Sep 2016 23:01:30 +0000 (01:01 +0200)]
test/fs: Check ext4 behaviour if dirent is first entry in directory block

This is a regression test for a crash happening if the first dirent
in the block matches. Code tried to access a predecessor entry which
does not exist.
The crash happened for any block, but "." is always the first entry in
the first directory block and thus easy to check for.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agotest/fs: strip noise from filesystem code prior to checking results
Stefan Brüns [Tue, 13 Sep 2016 23:01:29 +0000 (01:01 +0200)]
test/fs: strip noise from filesystem code prior to checking results

ext4 and fat code emit some diagnostic messages during command execution.
These additional lines force a match window size which strictly is not
necessary.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agotest/fs: remove use of undefined WRITE_FILE variable
Stefan Brüns [Tue, 13 Sep 2016 23:01:28 +0000 (01:01 +0200)]
test/fs: remove use of undefined WRITE_FILE variable

The write file is created from $SMALL_FILE by appending ".w" on all
other occurences in the code.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agotest/fs: Restructure file path specification to allow some flexibility
Stefan Brüns [Tue, 13 Sep 2016 23:01:27 +0000 (01:01 +0200)]
test/fs: Restructure file path specification to allow some flexibility

Instead of providing the full path, specify directory and filename
separately. This allows to specify intermediate directories, required
for some additional tests.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
7 years agocmd/fat: Do not crash on write when <bytes> is not specified
Stefan Brüns [Sun, 11 Sep 2016 20:51:42 +0000 (22:51 +0200)]
cmd/fat: Do not crash on write when <bytes> is not specified

argc is checked, but is off by one. In case <bytes> is not specified,
create an empty file, which is identical to the ext4write behaviour.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofs/fat: Correct description of determine_fatent function
Stefan Brüns [Sun, 11 Sep 2016 20:51:41 +0000 (22:51 +0200)]
fs/fat: Correct description of determine_fatent function

Current description does not match the function behaviour.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agofs/fat: Do not write unmodified fat entries to disk
Stefan Brüns [Sun, 11 Sep 2016 20:51:40 +0000 (22:51 +0200)]
fs/fat: Do not write unmodified fat entries to disk

The code caches 6 sectors of the FAT. On FAT traversal, the old contents
needs to be flushed to disk, but only if any FAT entries had been modified.
Explicitly flag the buffer on modification.

Currently, creating a new file traverses the whole FAT up to the first
free cluster and rewrites the on-disk blocks.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
7 years agofs/fat: Remove two statements without effect
Stefan Brüns [Sun, 11 Sep 2016 20:51:39 +0000 (22:51 +0200)]
fs/fat: Remove two statements without effect

fatlength is a local variable which is no more used after the assignment.
s_name is not used in the function, save the strncpy.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
7 years agoMerge git://git.denx.de/u-boot-rockchip
Tom Rini [Thu, 22 Sep 2016 20:51:19 +0000 (16:51 -0400)]
Merge git://git.denx.de/u-boot-rockchip

7 years agons16650: Make sure we have CONFIG_CLK set before using infrastructure
Tom Rini [Thu, 22 Sep 2016 19:36:45 +0000 (15:36 -0400)]
ns16650: Make sure we have CONFIG_CLK set before using infrastructure

We cannot call on the CONFIG_CLK based clk_get_rate function unless
CONFIG_CLK is set.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoMerge branch 'master' of git://git.denx.de/u-boot-uniphier
Tom Rini [Thu, 22 Sep 2016 17:34:55 +0000 (13:34 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-uniphier

7 years agoARM: dts: uniphier: sync clock/reset controller nodes with Linux
Masahiro Yamada [Wed, 21 Sep 2016 22:42:23 +0000 (07:42 +0900)]
ARM: dts: uniphier: sync clock/reset controller nodes with Linux

Sync device trees with Linux for easier DT life.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoclk: uniphier: allow to have clock node under syscon node
Masahiro Yamada [Wed, 21 Sep 2016 22:42:22 +0000 (07:42 +0900)]
clk: uniphier: allow to have clock node under syscon node

To sync the DT binding with Linux, the register base must be taken
from the parent syscon node.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoclk: uniphier: move U_BOOT_DRIVER entry to core code
Masahiro Yamada [Wed, 21 Sep 2016 22:42:21 +0000 (07:42 +0900)]
clk: uniphier: move U_BOOT_DRIVER entry to core code

Move U_BOOT_DRIVER() entry from the data file (clk-uniphier-mio.c)
to the core support file (clk-uniphier-core.c) because I do not want
to repeat the driver boilerplate when I add more clock data.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoclk: uniphier: constify clock data arrays/structures
Masahiro Yamada [Wed, 21 Sep 2016 22:42:20 +0000 (07:42 +0900)]
clk: uniphier: constify clock data arrays/structures

Clarify these clock data are constant.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: uniphier: add PLL init code for LD11 SoC
Masahiro Yamada [Wed, 21 Sep 2016 22:42:19 +0000 (07:42 +0900)]
ARM: uniphier: add PLL init code for LD11 SoC

 - Initialize PLLs (SPL initializes only DPLL to save the precious
   SPL memory footprint)
 - Adjust CPLL/MPLL to the final tape-out frequency
 - Set the Cortex-A53 clock to the maximum frequency since it is
   running at 500MHz (SPLL/4) on startup

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: uniphier: move CONFIG_SPL_* to defconfig or select
Masahiro Yamada [Tue, 20 Sep 2016 05:27:00 +0000 (14:27 +0900)]
ARM: uniphier: move CONFIG_SPL_* to defconfig or select

As I repeated in the ML, I am unhappy with config entries with bare
defaults.  Kick them out of arch/arm/mach-uniphier/Kconfig.

Currently, CONFIG_SPL_SERIAL_SUPPORT is not user-configurable
(build fails without it), but it should be fixed later anyway,
so I am moving CONFIG_SPL_SERIAL_SUPPORT to defconfigs.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoMerge branch 'master' of git://git.denx.de/u-boot-spi
Tom Rini [Thu, 22 Sep 2016 15:36:45 +0000 (11:36 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-spi

7 years agoMerge branch 'master' of git://www.denx.de/git/u-boot-microblaze
Tom Rini [Thu, 22 Sep 2016 15:36:23 +0000 (11:36 -0400)]
Merge branch 'master' of git://www.denx.de/git/u-boot-microblaze

7 years agoMakefile: rm u-boot.cfg dependencies are missing
Stephen Warren [Mon, 19 Sep 2016 18:20:26 +0000 (12:20 -0600)]
Makefile: rm u-boot.cfg dependencies are missing

Prior to the previous patch, a freshly created .u-boot.cfg.cmd may not
correctly represent all dependencies for u-boot.cfg. The previous change
only solved this issue for fresh builds; when performing an incremental
build, the deficient .u-boot.cfg.cmd is already present, so u-boot.cfg
is not rebuilt, and hence .u-boot.cfg.cmd is not rebuilt with the correct
content.

Solve this by explicitly detecting when the dependency file .u-boot.cfg.d
has not been integrated into .u-boot.cfg.cmd, and force u-boot.cfg to be
rebuilt in this case by deleting it first. This is possible since
if_changed_dep will always delete .u-boot.cfg.d when it executes
successfully, so its presence means either that the previous build was
made by a source tree that contained a Makefile that didn't include the
previous patch, or that the build failed part way through executing
if_changed_dep for u-boot.cfg. Forcing a rebuild of u-boot.cfg is required
in the former case, and will cause no additional work in the latter case,
since the file would be rebuilt anyway for the same reason it was being
rebuilt by the previous build.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
7 years agoMakefile: use if_change_dep for u-boot.cfg
Stephen Warren [Mon, 19 Sep 2016 18:20:25 +0000 (12:20 -0600)]
Makefile: use if_change_dep for u-boot.cfg

cmd_cpp_cfg generates a dependency output, but because it's invoked using
if_changed rather than if_changed_dep, that dependency file is ignored.
This results in Kbuild not knowing about which files u-boot.cfg depends
on, so it may not be rebuilt when required.

A practical result of this is that u-boot.cfg may continue to reference
CONFIG_ options that no longer exist in the source tree, and this can
cause the adhoc config options check to fail.

This change modifies Makefile to use if_changed_dep, which in turn causes
all dependencies to be known to the next make invocation.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
7 years agotest/py/tests/test_vboot.py: Add check that we boot the image
Tom Rini [Sun, 18 Sep 2016 13:46:58 +0000 (09:46 -0400)]
test/py/tests/test_vboot.py: Add check that we boot the image

Make sure that when we're telling bootm to boot an image, and we expect
the image to boot we get the output from sandbox that we attempted to
run Linux and that U-Boot completed its job.

Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
7 years agoimage-fit: Fix fit_get_node_from_config semantics
Paul Burton [Tue, 20 Sep 2016 17:17:12 +0000 (18:17 +0100)]
image-fit: Fix fit_get_node_from_config semantics

Commit bac17b78dace ("image-fit: switch ENOLINK to ENOENT") changed
fit_get_node_from_config to return -ENOENT when a property doesn't
exist, but didn't change any of its callers which check return values.
Notably it didn't change boot_get_ramdisk, which leads to U-Boot failing
to boot FIT images which don't include ramdisks with the following
message:

  Ramdisk image is corrupt or invalid

It also didn't take into account that by returning -ENOENT to denote the
lack of a property we lost the ability to determine from the return
value of fit_get_node_from_config whether it was the property or the
configuration node that was missing, which may potentially lead callers
to accept invalid FIT images.

Fix this by having fit_get_node_from_config return -EINVAL when the
configuration node isn't found and -ENOENT when the property isn't
found, which seems to make semantic sense. Callers that previously
checked for -ENOLINK are adjusted to check for -ENOENT, which fixes the
breakage introduced by commit bac17b78dace ("image-fit: switch ENOLINK
to ENOENT").

The only other user of the return fit_get_node_from_config return value,
indirectly, is bootm_find_os which already checked for -ENOENT. From a
read-through of the code I suspect it ought to have been checking for
-ENOLINK prior to bac17b78dace ("image-fit: switch ENOLINK to ENOENT")
anyway, which would make it right after this patch, but this would be
good to get verified by someone who knows this x86 code or is able to
test it.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Jonathan Gray <jsg@jsg.id.au>
Cc: Marek Vasut <marex@denx.de>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: George McCollister <george.mccollister@gmail.com>
Tested-by: George McCollister <george.mccollister@gmail.com>
7 years agoclk: rk3288: add PWM clock get rate
Kever Yang [Fri, 12 Aug 2016 09:57:05 +0000 (17:57 +0800)]
clk: rk3288: add PWM clock get rate

This patch add clk_get_rate for PWM device.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agoclk: rk3399: add pmucru controller support
Kever Yang [Fri, 12 Aug 2016 09:47:15 +0000 (17:47 +0800)]
clk: rk3399: add pmucru controller support

pmucru is a module like cru which is a clock controller manage some PLL
and module clocks.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agork3399: add a empty "sys_proto.h" header file
Kever Yang [Thu, 1 Sep 2016 02:14:20 +0000 (10:14 +0800)]
rk3399: add a empty "sys_proto.h" header file

driver/usb/dwc3/gadget.c need a "sys_proto.h" header file, add a
empty one to make compile success.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: rk3288: skip lowlevel_init process
Xu Ziyuan [Sat, 27 Aug 2016 13:53:14 +0000 (21:53 +0800)]
rockchip: rk3288: skip lowlevel_init process

lowlevel_init() is never needed for rk3288, so drop it.

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
7 years agoboard: evb-rk3399: enable usb 2.0 host vbus power on board_init
Kever Yang [Wed, 24 Aug 2016 04:02:22 +0000 (12:02 +0800)]
board: evb-rk3399: enable usb 2.0 host vbus power on board_init

rk3399 using one gpio control signal for two usb 2.0 host port,
it's better to enable the power in board file instead of in usb driver.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agoconfig: evb-rk3399: enable fixed regulator
Kever Yang [Wed, 24 Aug 2016 04:02:23 +0000 (12:02 +0800)]
config: evb-rk3399: enable fixed regulator

This patch enable fixed regulator driver for rk3399 evb.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agodts: rk3399-evb: add regulator-fixed for usb host vbus
Kever Yang [Wed, 24 Aug 2016 04:02:21 +0000 (12:02 +0800)]
dts: rk3399-evb: add regulator-fixed for usb host vbus

rk3399 evb using one gpio to enable 5V output for both USB 2.0
host port, let's use fixed regulator for them.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agodts: rk3399: add dwc3_typec node for rk3399
MengDongyang [Wed, 24 Aug 2016 04:02:20 +0000 (12:02 +0800)]
dts: rk3399: add dwc3_typec node for rk3399

rk3399 has two dwc3 controller for type-C port, add the dts node
and enable them.

Signed-off-by: MengDongyang <daniel.meng@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agoconfig: rk3399: add usb related configs
MengDongyang [Wed, 24 Aug 2016 04:02:19 +0000 (12:02 +0800)]
config: rk3399: add usb related configs

This patch to enable configs for usb module
- xhci
- ehci
- usb storage
- usb net

Signed-off-by: MengDongyang <daniel.meng@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Squashed in patch to move to Kconfig:
  https://patchwork.ozlabs.org/patch/672543/
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agousb: host: add Kconfig for USB_XHCI_ROCKCHIP
Kever Yang [Wed, 21 Sep 2016 03:35:42 +0000 (11:35 +0800)]
usb: host: add Kconfig for USB_XHCI_ROCKCHIP

Add a Kconfig for Rockchip xhci controller.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Marek Vasut <marex@denx.de>
7 years agorockchip: select DM_USB for rockchip SoC
MengDongyang [Wed, 24 Aug 2016 04:02:18 +0000 (12:02 +0800)]
rockchip: select DM_USB for rockchip SoC

Select DM_USB to compatible with USB DM driver model.

Signed-off-by: MengDongyang <daniel.meng@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agousb: xhci-rockchip: add rockchip dwc3 controller driver
MengDongyang [Wed, 24 Aug 2016 04:02:17 +0000 (12:02 +0800)]
usb: xhci-rockchip: add rockchip dwc3 controller driver

This patch add support for rockchip dwc3 controller, which corresponding
to the two type-C port on rk3399 evb.
Only support usb2.0 currently for we have not enable the usb3.0 phy
driver and PD(fusb302) driver.

Signed-off-by: MengDongyang <daniel.meng@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agork3288: add arch_cpu_init for rk3288
Kever Yang [Fri, 12 Aug 2016 09:58:12 +0000 (17:58 +0800)]
rk3288: add arch_cpu_init for rk3288

We do some SoC level one time setting initialization in
arch_cpu_init.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agork_pwm: remove grf setting code from driver
Kever Yang [Fri, 12 Aug 2016 09:58:02 +0000 (17:58 +0800)]
rk_pwm: remove grf setting code from driver

We consider the grf setting for pwm controller select as the system
operation instead of driver operation, move it to soc init, let's
remove it from pwm driver first.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agork_pwm: use clock framework API to get module clock
Kever Yang [Fri, 12 Aug 2016 09:57:48 +0000 (17:57 +0800)]
rk_pwm: use clock framework API to get module clock

This patch use clock API instead of hardcode for get pwm clock.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
Fix printf() to debug() nit:
Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: use dummy byte only enable OF_PLATDATA
Xu Ziyuan [Fri, 12 Aug 2016 07:43:48 +0000 (15:43 +0800)]
rockchip: use dummy byte only enable OF_PLATDATA

Add a condition to determine the rk3288_sdram_channel size.

This patch fixes read sdram_channel property failed from DT on rk3288
boards, which not enable OF_PLATDATA.

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
7 years agodts: rk3399: add pinctrl for sdmmc
Kever Yang [Tue, 16 Aug 2016 09:58:14 +0000 (17:58 +0800)]
dts: rk3399: add pinctrl for sdmmc

This patch add pinctrl for sdcard which may not be initialized before
uboot.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agork3399: enable the pwm2/3 pinctrl in board init
Kever Yang [Tue, 16 Aug 2016 09:58:13 +0000 (17:58 +0800)]
rk3399: enable the pwm2/3 pinctrl in board init

There is no interrupt line for each PWM which used by pinctrl to get the
periph_id, so it's not able to enable the default pinctrl setting by pinctrl
framework, let's enable it at board_init().

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agoconfig: evb-rk3399: enable pinctrl driver
Kever Yang [Tue, 16 Aug 2016 09:58:12 +0000 (17:58 +0800)]
config: evb-rk3399: enable pinctrl driver

This patch enable rk3399 pinctrl driver and gpio driver which is sub-node
of pinctrl.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agopinctrl: add driver for rk3399
Kever Yang [Tue, 16 Aug 2016 09:58:11 +0000 (17:58 +0800)]
pinctrl: add driver for rk3399

This patch add pinctrl driver for rk3399.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agork3399: syscon: add support for pmugrf
Kever Yang [Tue, 16 Aug 2016 09:58:10 +0000 (17:58 +0800)]
rk3399: syscon: add support for pmugrf

pmugrf is a module like grf which contain some of the iomux registers
and other registers.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agoconfigs: fsl: Move SPI/SPI-FLASH configs to defconfig
Jagan Teki [Wed, 21 Sep 2016 19:55:48 +0000 (01:25 +0530)]
configs: fsl: Move SPI/SPI-FLASH configs to defconfig

Moved FSL_QSPI/SPI/SPI-FLASH configs from include/configs
into respective used defconfigs.
- CONFIG_FSL_QSPI
- CONFIG_SPI_FLASH
- CONFIG_SPI_FLASH_BAR
- CONFIG_SPI_FLASH_STMICRO

Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
7 years agospi: Kconfig: Move FSL_QSPI entry to non-dm place
Jagan Teki [Sat, 3 Sep 2016 07:28:33 +0000 (12:58 +0530)]
spi: Kconfig: Move FSL_QSPI entry to non-dm place

Since FSL_QSPI driver still supporting non-dm code
better to move the Kconfig from DM undefined place.

Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
7 years agozynqmp: Remove unnnecessary board config file for dc4
Siva Durga Prasad Paladugu [Mon, 1 Aug 2016 04:49:38 +0000 (10:19 +0530)]
zynqmp: Remove unnnecessary board config file for dc4

Remove unnecessary board specific config file for DC4
board.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Acked-by: Jagan Teki <jteki@openedev.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
7 years agoARM64: zynqmp: Use the same name for atf image everywhere
Michal Simek [Wed, 21 Sep 2016 09:42:58 +0000 (11:42 +0200)]
ARM64: zynqmp: Use the same name for atf image everywhere

Use atf-uboot.ub image instead of atf.ub.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
7 years agoARM64: zynqmp: Enable CONFIG_AHCI via Kconfig
Michal Simek [Wed, 7 Sep 2016 11:16:31 +0000 (13:16 +0200)]
ARM64: zynqmp: Enable CONFIG_AHCI via Kconfig

Move CONFIG_AHCI to defconfig.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
7 years agoARM64: zynqmp: Add support for chip ID detection
Michal Simek [Mon, 1 Feb 2016 14:05:58 +0000 (15:05 +0100)]
ARM64: zynqmp: Add support for chip ID detection

Chip ID needs to be known for loading bitstream because
U-Boot checks ID from bitstream header in BIT format.
BIN format is completely unchecked.

The chipid is get from ATF via SMC.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
7 years agofpga: xilinx: zynqmp: Add PL bitstream download support for ZynqMP
Siva Durga Prasad Paladugu [Wed, 13 Jan 2016 10:55:37 +0000 (16:25 +0530)]
fpga: xilinx: zynqmp: Add PL bitstream download support for ZynqMP

Add PL bitstream dowload support for ZynqMP
Bitstream will be validated by uboot and loaded
to PL by invoking an smc instruction to ATF which route this request to
PMU FW which will take care of loading it to PL

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
7 years agoARM64: zynqmp: Fix USB ulpi phy sequence
Michal Simek [Tue, 16 Aug 2016 13:40:05 +0000 (15:40 +0200)]
ARM64: zynqmp: Fix USB ulpi phy sequence

It should be enough to call low(5us)->high pulse for all cases
to provide proper reset. There is no need to call high->low->high.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
7 years agoARM64: zynqmp: Add support for USB ulpi phy reset via mode pins
Michal Simek [Mon, 15 Aug 2016 07:41:36 +0000 (09:41 +0200)]
ARM64: zynqmp: Add support for USB ulpi phy reset via mode pins

Mode pins can be used as output for reset. Xilinx boards are using
this feature as additional way how to reset USB phys and also others
chips on the boards.
Mode1 is used on all these boards for this feature.
Let SPL toggle reset on this pin by default.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
7 years agoARM64: zynqmp: Add support for DFU from SPL
Michal Simek [Fri, 19 Aug 2016 12:14:52 +0000 (14:14 +0200)]
ARM64: zynqmp: Add support for DFU from SPL

SPL needs to have bigger stack size because of USB.
Simple malloc needs to be disabled because dfu code requires different
allocation functions. There is no space in OCM that's why random place
in DDR is used.

BOOTD must be disabled because it is causing compilation error.

All variables are disabled and used only variables valid for DFU because
they are simple huge. Including automatic variables added by
CONFIG_ENV_VARS_UBOOT_CONFIG.
Hardcode addresses for u-boot, atf, kernel and dtb
just for SPL DFU code.

Enable SPL DFU for zcu100.
Create new usb_dfu_spl variable just to run Linux kernel loaded in SPL.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
7 years agoARM: Add new BOOT_DEVICE_DFU boot mode
Michal Simek [Tue, 30 Aug 2016 13:38:57 +0000 (15:38 +0200)]
ARM: Add new BOOT_DEVICE_DFU boot mode

This enum is needed when SPL_DFU is enabled.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
7 years agoARM64: zynqmp: Add USB boot mode
Michal Simek [Fri, 29 Apr 2016 11:00:10 +0000 (13:00 +0200)]
ARM64: zynqmp: Add USB boot mode

Add USB boot mode.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
7 years agoARM64: zynqmp: Move BSS location to the beginning of ram
Michal Simek [Tue, 30 Aug 2016 12:58:46 +0000 (14:58 +0200)]
ARM64: zynqmp: Move BSS location to the beginning of ram

With SPL_DFU support memory layout needs to be cleanup
that's why move bss to the start of memory.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
7 years agospi: zynq: Use variable to remove u32 to u64 conversions
Michal Simek [Thu, 1 Sep 2016 10:51:27 +0000 (12:51 +0200)]
spi: zynq: Use variable to remove u32 to u64 conversions

Current code generates warning when it is compiled for arm64:
Warnings:
In file included from drivers/spi/zynq_spi.c:14:0:
drivers/spi/zynq_spi.c: In function ‘zynq_spi_init_hw’:
drivers/spi/zynq_spi.c:95:9: warning: large integer implicitly truncated
to unsigned type [-Woverflow]
  writel(~ZYNQ_SPI_ENR_SPI_EN_MASK, &regs->enr);
         ^
./arch/arm/include/asm/io.h:146:34: note: in definition of macro
‘writel’
 #define writel(v,c) ({ u32 __v = v; __iowmb(); __arch_putl(__v,c); __v;
})
                                  ^
drivers/spi/zynq_spi.c: In function ‘zynq_spi_release_bus’:
drivers/spi/zynq_spi.c:177:9: warning: large integer implicitly
truncated to unsigned type [-Woverflow]
  writel(~ZYNQ_SPI_ENR_SPI_EN_MASK, &regs->enr);
         ^
./arch/arm/include/asm/io.h:146:34: note: in definition of macro
‘writel’
 #define writel(v,c) ({ u32 __v = v; __iowmb(); __arch_putl(__v,c); __v;
})
                                  ^
This patch is using one variable to do conversion via u32 variable.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>