Tom Rini [Thu, 19 Jun 2014 12:46:21 +0000 (08:46 -0400)]
am335x_evm: Only enable OF_CONTROL/OF_SEPARATE on VBOOT for now
We don't make use of the device tree otherwise yet (and will need to
think how to not break the current multi-board support) and this causes
further breakage with additional changes.
Stephen Warren [Wed, 11 Jun 2014 18:46:16 +0000 (12:46 -0600)]
fs: ext4: fix writing zero-length files
ext4fs_allocate_blocks() always allocates at least one block for a file.
If the file size is zero, this causes total_remaining_blocks to
underflow, which then causes an apparent hang while 2^32 blocks are
allocated.
To solve this, check that total_remaining_blocks is non-zero as part of
the loop condition (i.e. before each loop) rather than at the end of
the loop.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Data written to DTB must be converted to big endian order.
It is usually done by using cpu_to_fdt32(), cpu_to_fdt64(), etc.
fdt_initrd() invoked write_cell(), which always swaps byte order.
It means the function only worked on little endian architectures.
(On big endian architectures, the byte order should be kept as it is)
This commit uses cpu_to_fdt32() and cpu_to_fdt64()
and deletes write_cell().
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
fdt_support: add 'const' qualifier for unchanged argument
In the next commit, I will add a new function, fdt_pack_reg()
which uses get_cells_len().
Beforehand, this commit adds 'const' qualifier to get_cells_len().
Otherwise, a warning message will appear:
warning: passing argument 1 of 'get_cells_len' discards 'const'
qualifier from pointer target type [enabled by default]
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
- Do not use a deep indentation. We have only 80-character
on each line and 1 indentation consumes 8 spaces. Before the
code moves far to the right, you should consider to
fix your code. See Linux Documentation/CodingStyle.
- Add CONFIG_OF_STDOUT_VIA_ALIAS and OF_STDOUT_PATH macros
only to their definition. Do not add them to both
callee and caller. This is a tip to avoid using #ifdef
everywhere.
- OF_STDOUT_PATH and CONFIG_OF_STDOUT_VIA_ALIAS are exclusive.
If both are defined, the former takes precedence.
Do not try to fix-up "linux,stdout-path" property twice.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
fdt_support: refactor with fdt_find_or_add_subnode helper func
Some functions in fdt_support.c do the same routine:
search a node with a given name ("chosen", "memory", etc.)
or newly create it if it does not exist.
So this commit makes that routine to a helper function.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
In function 'flash_erase': 180:21:
warning: variable 'last' set but not used [-Wunused-but-set-variable]
In function 'write_buff': 322:10:
warning: variable 'port_width' set but not used [-Wunused-but-set-variable]
Jon Nalley [Wed, 26 Feb 2014 16:32:21 +0000 (11:32 -0500)]
libfdt: Fix segfault when calling fit_check_format() on corrupt FIT images
It has been observed that fit_check_format() will fail when passed a
corrupt FIT image. This was tracked down to _fdt_string_eq():
return (strlen(p) == len) && (memcmp(p, s, len) == 0);
In the case of a corrupt FIT image one can't depend on 'p' being NULL
terminated. I changed it to use strnlen() to fix the issue.
Dan Murphy [Wed, 2 Oct 2013 19:00:15 +0000 (14:00 -0500)]
ARM: fdt support: Add usbethaddr as an acceptable MAC
A board that has a USB ethernet device only may set the usbetheraddr
and not the ethaddr.
ethaddr will be the default MAC address that is chosen and if that
is not populated then the usbethaddr is looked at. If neither are set
then then device tree blob is not modified.
Vasili Galka [Mon, 16 Jun 2014 14:40:59 +0000 (17:40 +0300)]
Fix bug in io64 target (introduced by commit aba27ac)
From comparison of current logic and the logic that was prior to commit aba27ac, we see that first parameter of FPGA_GET_REG() shall be the
FPGA index and not channel number. The re-factoring in commit aba27ac
accidentally changed that.
Michal Simek [Mon, 16 Jun 2014 22:36:14 +0000 (00:36 +0200)]
configs: iocon: Enabling CONFIG_CMD_FPGAD again
This is a MIME GnuPG-signed message. If you see this text, it means that
your E-mail or Usenet software does not support MIME signed messages.
The Internet standard for MIME PGP messages, RFC 2015, was published in 1996.
To open this message correctly you will need to install E-mail or Usenet
software that supports modern Internet standards.
Darwin Rambo [Mon, 26 May 2014 20:31:12 +0000 (13:31 -0700)]
mmc: free allocated memory on initialization errors
Cleanup to balance malloc/free calls.
Signed-off-by: Darwin Rambo <drambo@broadcom.com> Reviewed-by: Steve Rae <srae@broadcom.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Stephen Warren [Fri, 23 May 2014 19:24:47 +0000 (13:24 -0600)]
cmd_mmc: make mmc dev always re-probe the HW
Currently, U-Boot behaves as follows:
- Begin with no SD card inserted in "mmc 1"
- Execute: mmc dev 1
- This fails, since there is no card
- User plugs in an SD card
- Execute: mmc dev 1
- This still fails, since the HW isn't reprobed.
With this change, U-Boot behaves as follows:
- Begin with no SD card inserted in "mmc 1"
- Execute: mmc dev 1
- This fails, since there is no card
- User plugs in an SD card
- Execute: mmc dev 1
- The newly present SD card is detected
I know that "mmc rescan" will force the HW to be reprobed, but I feel it
makes more sense if "mmc dev" always reprobes the HW after selecting the
current MMC device. This allows scripts to just execute "mmc dev", and
not have to also execute "mmc rescan" to check for media presense.
Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Stephen Warren [Fri, 23 May 2014 19:24:46 +0000 (13:24 -0600)]
cmd_mmc: Use init_mmc_device() from do_mmc_rescan()
The body of init_mmc_device() is now identical to that of do_mmc_rescan()
except for the error codes returned. Modify do_mmc_rescan() to simply
call init_mmc_device() and convert the error codes, to avoid code
duplication.
Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Stephen Warren [Fri, 23 May 2014 19:24:45 +0000 (13:24 -0600)]
cmd_mmc: add force_init parameter to init_mmc_device()
This allows callers to inject mmc->has_init = 0 between finding the
MMC device, and calling mmc_init(), which forces mmc_init() to rescan
the HW. Future changes will use this feature.
Stephen Warren [Fri, 23 May 2014 18:48:11 +0000 (12:48 -0600)]
disk: default to HW partition 0 if not specified
Currently, get_device()/get_dev_hwpart() for MMC devices does not select
an explicit HW partition unless the user explicitly requests one, i.e. by
requesting device "mmc 0.0" rather than just "mmc 0". I think it makes
more sense if the default is to select HW partition 0 (main data area)
if the user didn't request a specific partition. Otherwise, the following
happens, which feels wrong:
Select HW partition 1 (boot0):
mmc dev 0 1
Attempts to access SW partition 1 on HW partition 1 (boot0), rather than
SW partition 1 on HW partition 0 (main data area):
ls mmc 0:1 /
With this patch, the second command above re-selects the main data area.
Many device types don't support HW partitions at all, so if HW partition
0 is selected (either explicitly or as the default) and there's no
select_hwpart function, we simply skip attempting to select a HW
partition.
Some MMC devices (i.e. SD cards) don't support HW partitions. However,
this patch still works, since mmc_start_init() sets the current
partition number to 0, and mmc_select_hwpart() succeeds if the requested
partition is already selected.
Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Stephen Warren [Fri, 23 May 2014 18:48:10 +0000 (12:48 -0600)]
cmd_mmc: default to HW partition 0 if not specified
Currently, "mmc dev 0" does not change the selected HW partition. I
think it makes more sense if "mmc dev 0" is an alias for "mmc dev 0 0",
i.e. that HW partition 0 (main data area) is always selected by default
if the user didn't request a specific partition. Otherwise, the following
happens, which feels wrong:
Select HW partition 1 (boot0):
mmc dev 0 1
Doesn't change the HW partition, so it's still 1 (boot0):
mmc dev 0
With this patch, the second command above re-selects the main data area.
Note that some MMC devices (i.e. SD cards) don't support HW partitions.
However, this patch still works, since mmc_start_init() sets the current
partition number to 0, and mmc_select_hwpart() succeeds if the requested
partition is already selected.
Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Stephen Warren [Fri, 23 May 2014 18:47:06 +0000 (12:47 -0600)]
mmc: return meaningful error codes from mmc_select_hwpart
Rather than just returning -1 everywhere, try to return something
meaningful from mmc_select_hwpart(). Note that most other MMC functions
don't do this, including functions called from mmc_select_hwpart(), so
I'm not sure how effective this will be. Still, it's one less place with
hard-coded -1.
Jeroen Hofstee [Tue, 10 Jun 2014 22:40:25 +0000 (00:40 +0200)]
jffs2:jffs2_1pass.c: remove double braces
Clang interpretes an if condition likeĀ "if ((a = b) == NULL)
as it tries to assign a value in a statement. Hence if you do
"if ((something)) it warns you that you might be confused.
Hence drop the double braces for plane if statements.
Jeroen Hofstee [Tue, 10 Jun 2014 22:34:39 +0000 (00:34 +0200)]
board:keymile: remove unnecessary double braces
Clang interpretes an if condition like "if ((a = b) == NULL)
as it tries to assign a value in a statement. Hence if you do
"if ((something)) it warns you that you might be confused.
Hence drop the double braces for plane if statements.
Clang interpretes an if condition like "if ((a = b) == NULL)
as it tries to assign a value in a statement. Hence if you do
"if ((something)) it warns you that you might be confused.
Hence drop the double braces for plane if statements.
Simon Glass <sjg@chromium.org> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Jeroen Hofstee [Tue, 10 Jun 2014 21:37:23 +0000 (23:37 +0200)]
LzmaTools: don't self assign values
It seems the code tries to trick the compiler the argument
is actually used. However compilers became too smart to
fool them so easily an now warn. Gcc and clang don't seem
to emit a warning when the argument is unused. If so it
should be decorated with unused / (void).
Vasili Galka [Tue, 10 Jun 2014 13:16:14 +0000 (16:16 +0300)]
Remove ${objtree}/include/asm/proc/ link
mkconfig links ${objtree}/include/asm/proc/ to
${srctree}/arch/${arch}/include/asm/proc-armv/. This seems to be a
remnant from the past. Ever since its introduction in 2003 it is used
only in ARM build and always links to same place, so let's simplify
the code, remove it and reference directly where needed.
Successful MAKEALL for ARM and PowerPC verified on Linux.
Jeroen Hofstee [Mon, 9 Jun 2014 09:02:02 +0000 (11:02 +0200)]
common: hash: zero end the string instead of the pointer
if algo->digest_size is zero nothing is set in the str_output
buffer. An attempt is made to zero end the buffer, but the
pointer to the buffer is set to zero instead. I am unaware if
it causes any actual problems, but solves the following warning:
common/hash.c:217:13: warning: expression which evaluates to zero treated as
a null pointer constant of type 'char *' [-Wnon-literal-null-conversion]
str_ptr = '\0';
^~~~
cc: Simon Glass <sjg@chromium.org> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Simon Glass [Sun, 8 Jun 2014 04:07:58 +0000 (22:07 -0600)]
m68k: Fix warnings with gcc 4.6
Most of the warnings seem to be related to using 'int' for size_t. Change
this and fix up the remaining warnings and problems. For bootm, the warning
was masked by others, and there is an actual bug in the code.
Masahiro Yamada [Fri, 6 Jun 2014 05:04:32 +0000 (14:04 +0900)]
kbuild, tools: generate wrapper C sources automatically by Makefile
There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.
The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
Darwin Dingel [Fri, 6 Jun 2014 03:48:26 +0000 (15:48 +1200)]
disk: part_dos.c: Add a PBR check when MBR checking fails
Bug: SDCard with a messed up partition but still has a FAT signature
intact is readable in Linux but unreadable in uboot with 'fatls'.
Fix: When partition info checking fails, there is no checking for a
FAT signature (DOS_PBR) which will fail 'fatls'. FAT signature checking
is done when no valid partition is found in partition table. If FAT
signature is found, the disk will be read as PBR and continue
processing.
Signed-off-by: Darwin Dingel <darwin.dingel@alliedtelesis.co.nz>
Thomas Betker [Thu, 5 Jun 2014 18:07:57 +0000 (20:07 +0200)]
Add run_command_repeatable()
run_command() returns 0 on success and 1 on error. However, there are some
invocations which expect 0 or 1 for success (not repeatable or repeatable)
and -1 for error; add run_command_repeatable() for this purpose.
Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
Thomas Betker [Thu, 5 Jun 2014 18:07:56 +0000 (20:07 +0200)]
Check run_command() return code properly
run_command() returns 0 for success, 1 for failure. Fix places which
assume that failure is indicated by a negative return code.
Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Tested-by: Stefan Roese <sr@denx.de>
Simon Glass [Tue, 3 Jun 2014 04:04:51 +0000 (22:04 -0600)]
fdt: Update functions which write to an FDT to return -ENOSPC
When writing values into an FDT it is possible that there will be
insufficient space. If the caller gets a useful error then it can
potentially deal with the situation.
Adjust these functions to return -ENOSPC when the FDT is full.
Simon Glass [Tue, 3 Jun 2014 04:04:50 +0000 (22:04 -0600)]
fdt: Add DEV_TREE_BIN option to specify a device tree binary file
In some cases, an externally-built device tree binary is required to be
attached to U-Boot. An example is when using image signing, since in that
case the .dtb file must include the public keys.
Add a DEV_TREE_BIN option to the Makefile, and update the documentation.
Usage is something like:
make DEV_TREE_BIN=boot/am335x-boneblack-pubkey.dtb
Simon Glass [Tue, 3 Jun 2014 04:04:47 +0000 (22:04 -0600)]
Check that u-boot.bin size looks correct
Check that the image size matches the size we get from u-boot.bin. If it
doesn't, that generally means that some extra sections are being added to
u-boot.bin, meaning that it is not possible to access data appended to
the U-Boot binary. This is used for device tree, so needs to work.
This problem was introduced by commit b02bfc4. By adding a test we can
prevent a reccurence.
Jeroen Hofstee [Fri, 30 May 2014 13:45:28 +0000 (15:45 +0200)]
tools: include u-boot version of sha256.h
When building tools the u-boot specific sha256.h is required, but the
host version of sha256.h is used when present. This leads to build errors
on FreeBSD which does have a system sha256.h include. Like libfdt_env.h
explicitly include u-boot's sha256.h.
cc: Simon Glass <sjg@chromium.org> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl> Acked-by: Simon Glass <sjg@chromium.org>
Jeroen Hofstee [Fri, 30 May 2014 13:45:27 +0000 (15:45 +0200)]
Makefile: fix clang warnings due to clang support
Building u-boot tools with clang as a host compiler e.g. on
FreeBSD with `gmake HOSTCC=clang CONFIG_USE_PRIVATE_LIBGCC=y tools`
leads to many warnings [1] for every compiler invocation since
commit 598e2d33. Part of mentioned commit imports linux patches:
- kbuild: LLVMLinux: Adapt warnings for compilation with clang
- kbuild: LLVMLinux: Add Kbuild support for building kernel with Clang
No version of clang supports the gcc fno-delete-null-pointer-checks
though, but it is only passed to clang. Gcc does not have the clang
specific Qunused-arguments for the target. Furthermore several
warnings are disabled which aren't encountered in u-boot. Since such
a build has worked for quite some time and works after removing these
changes, just remove the clang specific handling to restore normal
building with clang as hostcc.
[1] Actual warnings
-------------------
GEN include/autoconf.mk.dep
arm-freebsd-gcc: unrecognized option '-Qunused-arguments'
HOSTCC scripts/basic/fixdep
clang: warning: argument unused during compilation:
'-fno-delete-null-pointer-checks'
Lukasz Majewski [Tue, 10 Jun 2014 10:25:59 +0000 (12:25 +0200)]
dfu: Disable default calculation of CRC32
Patch (SHA1: bd694244db7bc969954)
dfu: Introduction of the "dfu_hash_algo" env variable for checksum method
setting
already introduced more generic handling of the crc32 calculation.
Up till now the CRC32 of received data was calculated unconditionally.
This patch changes this and from now - by default the crc32 is NOT
calculated anymore.
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de>
Stephen Warren [Tue, 10 Jun 2014 21:27:39 +0000 (15:27 -0600)]
usb: ci_udc: terminate ep0 INs with a zlp when required
Sometimes, a zero-length packet is required at the end of an IN
transaction so that the host knows the device is done sending data.
Enhance ci_udc to send a zlp when necessary. See the comments for
more details.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Stephen Warren [Tue, 10 Jun 2014 17:02:38 +0000 (11:02 -0600)]
usb: ci_udc: clean up all allocations in unregister
usb_gadget_unregister_driver() is called to tear down the USB device mode
stack. Fix the driver to stop the USB HW (which causes any attached host
to notice the disappearance of the device), and free all allocations
(which obviously prevents memory leaks).
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Stephen Warren [Tue, 10 Jun 2014 17:02:36 +0000 (11:02 -0600)]
usb: ci_udc: fix freeing of ep0 req
ci_ep_alloc_request() avoids allocating multiple request objects for ep0
by keeping a record of the first req allocated for ep0, and always
returning that instead of allocating a new req. However, if this req is
ever freed, the record of the previous allocation is not cleared, so
ci_ep_alloc_request() will keep returning this stale pointer. Fix
ci_ep_free_request() to clear the record of the previous allocation.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
The R7S72100 of ARM SoC that Renesas manufactured has one Ether port.
This has the same IP SH-Ether. This patch adds support of the R7S72100
in SH-Ether.
Currently, flash quad bit is set in "spi_flash_validate_params" and later
at the end in the same api, we write 0 to status register for few flashes,
thereby overriding the quad bit set. This fix moves the quad bit setting
outside this api in "spi_flash_probe_slave"
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com> Reviewed-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Andrew Ruder [Thu, 24 Apr 2014 18:39:32 +0000 (13:39 -0500)]
spi: soft_spi: Support NULL din/dout buffers
This mirrors the conventions used in other SPI drivers (kirkwood,
davinci, atmel, et al) where the din/dout buffer can be NULL when the
received/transmitted data isn't important. This reduces the need for
allocating additional buffers when write-only/read-only functionality is
needed.
In the din == NULL case, the received data is simply not stored. In the
dout == NULL case, zeroes are transmitted.
Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Reviewed-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Tom Rini [Thu, 5 Jun 2014 15:15:30 +0000 (11:15 -0400)]
arm:am43xx: Add TPS65218 support to scale voltages up
This family is supported by the TPS65218 PMIC. Implement a scale_vcores
to set the MPU and CORE voltage correctly to the max frequency that is
supported (and what we will be scaling them to in setup_dplls()).
Lokesh Vutla [Mon, 2 Jun 2014 05:19:03 +0000 (10:49 +0530)]
ARM: AM43xx: Fix UART clocks enabling
After enabling a module, SW has to wait on IDLEST bit
until it is Fully functional. This wait is missing for UART module
and there is a immediate access of UART registers after this. So there
is a chance of hang on this module( This can happen when we are running
from MPU SRAM). So waiting for IDLEST bit.
Lokesh Vutla [Mon, 2 Jun 2014 05:15:38 +0000 (10:45 +0530)]
ARM: AM43xx: Fix mmcboot command in EXTRA_ENV_SETTINGS
loadbootenv expects devtype variable to be set. This is missing in
mmcboot command. With this the following error comes:
U-Boot# run mmcboot
mmc0 is current device
SD/MMC found on device 0
** Bad device usb 0 **
** Bad device usb 0 **
Fixing this by setting devtype as mmc.
Reported-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Jeroen Hofstee [Sat, 31 May 2014 15:08:30 +0000 (17:08 +0200)]
tam3517: fix NAND detection
commit a0a37183bd7 "ARM: omap: merge GPMC initialization code for
all platform" needs CONFIG_NOR, CONFIG_NAND or CONFIG_CMD_ONENAND
to be set to access flash. Add CONFIG_NAND for tam3517 derived
boards to prevent the following error: "nand: error: Unable to
find NAND settings in GPMC Configuration - quitting"