]> git.kernelconcepts.de Git - karo-tx-uboot.git/log
karo-tx-uboot.git
9 years agoPrepare v2014.07-rc4 v2014.07-rc4
Tom Rini [Wed, 2 Jul 2014 17:36:19 +0000 (13:36 -0400)]
Prepare v2014.07-rc4

Signed-off-by: Tom Rini <trini@ti.com>
9 years agousb: ci_udc: use var name ep/ci_ep consistently
Stephen Warren [Tue, 1 Jul 2014 20:22:27 +0000 (14:22 -0600)]
usb: ci_udc: use var name ep/ci_ep consistently

Almost all of ci_udc.c uses variable name "ep" for a struct usb_ep and
"ci_ep" for a struct ci_ep. This is nice and consistent, and helps people
know what type a variable is without searching for the declaration.
handle_ep_complete() doesn't do this, so fix it to be consistent.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
9 years agoUSB: gadget: atmel: zero out allocated requests
Stephen Warren [Tue, 1 Jul 2014 22:59:08 +0000 (16:59 -0600)]
USB: gadget: atmel: zero out allocated requests

A UDC's alloc_request method should zero out the newly allocated request.
Ensure the Atmel driver does so. This issue was found by code inspection,
following the investigation of an intermittent issue with ci_udc, which
was tracked down to failing to zero out allocated requests following some
of my changes. All other UDC drivers already zero out requests in one
way or another.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
9 years agousb: ci_udc: don't memalign() struct ci_req allocations
Stephen Warren [Tue, 1 Jul 2014 17:41:18 +0000 (11:41 -0600)]
usb: ci_udc: don't memalign() struct ci_req allocations

struct ci_req is a purely software structure, and needs no specific
memory alignment. Hence, allocate it with calloc() rather than
memalign(). The use of memalign() was left-over from when struct ci_req
was going to hold the aligned bounce buffer, but this is now dynamically
allocated.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
9 years agousb: ci_udc: remove controller.items array
Stephen Warren [Tue, 1 Jul 2014 17:41:17 +0000 (11:41 -0600)]
usb: ci_udc: remove controller.items array

There's no need to store an array of QTD pointers in the controller.
Since the calculation is so simple, just have ci_get_qtd() perform it
at run-time, rather than pre-calculating everything.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
9 years agousb: ci_udc: fix items array size/stride calculation
Stephen Warren [Tue, 1 Jul 2014 17:41:16 +0000 (11:41 -0600)]
usb: ci_udc: fix items array size/stride calculation

2 QTDs are allocated for each EP. The current allocation scheme aligns
the first QTD in each pair, but simply adds the struct size to calculate
the second QTD's address. This will result in a non-cache-aligned
addresss IF the system's ARCH_DMA_MINALIGN is not 32 bytes (i.e. the
size of struct ept_queue_item).

Similarly, the original ilist_ent_sz calculation aligned the value to
ARCH_DMA_MINALIGN but didn't take the USB HW's 32-byte alignment
requirement into account. This doesn't cause a practical issue unless
ARCH_DMA_MINALIGN < 32 (which I suspect is quite unlikely), but we may
as well fix the code to be explicit, so it's obviously completely
correct.

The new value of ILIST_ENT_SZ takes all alignment requirements into
account, so we can simplify ci_{flush,invalidate}_qtd() by simply using
that macro rather than calling roundup().

Similarly, the calculation of controller.items[i] can be simplified,
since each QTD is evenly spaced at its individual alignment requirement,
rather than each pair being aligned, and entries within the pair being
spaced apart only by structure size.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
9 years agousb: ci_udc: lift ilist size calculations to global scope
Stephen Warren [Tue, 1 Jul 2014 17:41:15 +0000 (11:41 -0600)]
usb: ci_udc: lift ilist size calculations to global scope

This will allow functions other than ci_udc_probe() to make use of the
constants in a future change.

This in turn requires converting the const int variables to #defines,
since the initialization of one global const int can't depend on the
value of another const int; the compiler thinks it's non-constant if
that dependency exists.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
9 years agousb: ci_udc: don't assume QTDs are adjacent when transmitting ZLPs
Stephen Warren [Tue, 1 Jul 2014 17:41:14 +0000 (11:41 -0600)]
usb: ci_udc: don't assume QTDs are adjacent when transmitting ZLPs

Fix ci_ep_submit_next_request()'s ZLP transmission code to explicitly
call ci_get_qtd() to find the address of the other QTD to use. This
will allow us to correctly align each QTD individually in the future,
which may involve leaving a gap between the QTDs.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
9 years agousb: ci_udc: fix ci_flush_{qh,qtd} calls in ci_udc_probe()
Stephen Warren [Tue, 1 Jul 2014 17:41:13 +0000 (11:41 -0600)]
usb: ci_udc: fix ci_flush_{qh,qtd} calls in ci_udc_probe()

ci_udc_probe() initializes a pair of QHs and QTDs for each EP. After
each pair has been initialized, the pair is cache-flushed. The
conversion from QH/QTD index [0..2*NUM_END_POINTS) to EP index
[0..NUM_ENDPOINTS] is incorrect; it simply subtracts 1 (which yields
the QH/QTD index of the first entry in the pair) rather than dividing
by two (which scales the range). Fix this.

On my system, this avoids cache debug prints due to requests to flush
unaligned ranges. This is caused because the flush calls happen before
the items[] array entries are initialized for all but EP0.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
9 years agodfu: free entities when parsing fails
Stephen Warren [Tue, 10 Jun 2014 16:06:41 +0000 (10:06 -0600)]
dfu: free entities when parsing fails

When dfu_init_env_entities() fails part-way through, some entities may
have been added to dfu_list. These are only removed by dfu_free_entities().
If that function isn't called, those stale entities will still exist the
next time dfu_init_env_entities() is called, leading to confusion. Fix
do_dfu() to ensure that dfu_free_entities() is always called, to avoid
this confusion.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Tested-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agousb: eth: smsc95xx: add LAN9500A device ID
Ilya Ledvich [Wed, 12 Mar 2014 08:36:31 +0000 (10:36 +0200)]
usb: eth: smsc95xx: add LAN9500A device ID

Add LAN9500A product ID (0x9e00) in order to support LAN9500A based dongles.
Tested on cm_t335.

Signed-off-by: Ilya Ledvich <ilya@compulab.co.il>
Acked-by: Marek Vasut <marex@denx.de>
9 years agousb: fastboot: fix potential buffer overflow
Jeroen Hofstee [Fri, 13 Jun 2014 22:57:14 +0000 (00:57 +0200)]
usb: fastboot: fix potential buffer overflow

cb_getvar tries to prevent overflowing the response buffer
by using strncat. But strncat takes the number of data bytes
copied as a limit not the total buffer length so it can still
overflow. Pass the correct value instead.

cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
cc: Rob Herring <robh@kernel.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
9 years agousb: xhci: (likely) fix bracket in if condition
Jeroen Hofstee [Wed, 11 Jun 2014 22:31:27 +0000 (00:31 +0200)]
usb: xhci: (likely) fix bracket in if condition

Because of the brackets the & and && is evaluated before
the comparison. This is likely not the intention. Change
it to test the first and second condition to both be true.

cc: Marek Vasut <marex@denx.de>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
9 years agousb:g_dnl:f_thor: remove memset before memcpy
Jeroen Hofstee [Mon, 9 Jun 2014 13:28:58 +0000 (15:28 +0200)]
usb:g_dnl:f_thor: remove memset before memcpy

since ALLOC_CACHE_ALIGN_BUFFER defines a pointer and not a
buffer, the memset with sizeof(rqt) likely does something else
then intended. Since there is a memcpy directly after it with
the full size, drop the memset completely.

Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agousb:composite: clear the whole common buffer
Jeroen Hofstee [Mon, 9 Jun 2014 13:28:59 +0000 (15:28 +0200)]
usb:composite: clear the whole common buffer

Since the struct fsg_common is calloced, reset it completely
with zero's when reused. While at it, make checkpatch happy.

cc: Lukasz Majewski <l.majewski@samsung.com>
cc: Piotr Wilczek <p.wilczek@samsung.com>
cc: Kyungmin Park <kyungmin.park@samsung.com>
cc: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agousb: r8a66597: Fix initilization size of r8a66597 info structure
Yasuhisa Umano [Fri, 18 Apr 2014 02:33:15 +0000 (11:33 +0900)]
usb: r8a66597: Fix initilization size of r8a66597 info structure

Initialization of r8a66597 info structure is not enough.
Because initilization was used size of pointer.
This fixes that use size of r8a6659 info structure.

Signed-off-by: Yasuhisa Umano <yasuhisa.umano.zc@renesas.com>
9 years agousb: r8a66597: Fix initialization hub that using R8A66597_MAX_ROOT_HUB
yasuhisa umano [Fri, 18 Apr 2014 02:33:08 +0000 (11:33 +0900)]
usb: r8a66597: Fix initialization hub that using R8A66597_MAX_ROOT_HUB

This driver is processed as two USB hub despite one.
The number of root hub is defined in R8A66597_MAX_ROOT_HUB.
This fixes that register is accessed by using the definition
of R8A66597_MAX_ROOT_HUB.

Signed-off-by: Yasuhisa Umano <yasuhisa.umano.zc@renesas.com>
9 years agousb: cosmetic: double const
Jeroen Hofstee [Tue, 17 Jun 2014 19:14:17 +0000 (21:14 +0200)]
usb: cosmetic: double const

For plain array const can be either before or after
the type definition. Adding both is simply redundand.
Remove the later one.

cc: marex@denx.de
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
9 years agousb: ci_udc: fix typo in debug message
Stephen Warren [Wed, 25 Jun 2014 17:03:18 +0000 (11:03 -0600)]
usb: ci_udc: fix typo in debug message

s/ot/to/

Signed-off-by: Stephen Warren <swarren@nvidia.com>
9 years agousb: ci_udc: fix interaction with CONFIG_USB_ETH_CDC
Stephen Warren [Mon, 23 Jun 2014 18:02:48 +0000 (12:02 -0600)]
usb: ci_udc: fix interaction with CONFIG_USB_ETH_CDC

ci_udc.c's usb_gadget_unregister_driver() doesn't call driver->unbind()
unlike other USB gadget drivers. Fix it to do this.

Without this, when ether.c's CDC Ethernet device is torn down,
eth_unbind() is never called, so dev->gadget is never set to NULL.
For some reason, usb_eth_halt() is called both at the end of the first
use of the Ethernet device, and prior to any subsequent use. Since
dev->gadget is never cleared, all calls to usb_eth_halt() attempt to
stop, disconnect, and clean up the device, resulting in double cleanup,
which hangs U-Boot on my Tegra device at least.

ci_udc allocates its own singleton EP0 request object, and cleans it up
during usb_gadget_unregister_driver(). This appears necessary when using
the USB gadget framework in U-Boot, since that does not allocate/free
the EP0 request. However, the CDC Ethernet driver *does* allocate and
free its own EP0 requests. Consequently, we must protect
ci_ep_free_request() against double-freeing the request.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
9 years agoMerge branch 'sandbox' of git://git.denx.de/u-boot-x86
Tom Rini [Tue, 24 Jun 2014 18:06:22 +0000 (14:06 -0400)]
Merge branch 'sandbox' of git://git.denx.de/u-boot-x86

9 years agoMerge branch 'master' of git://git.denx.de/u-boot-dm
Tom Rini [Tue, 24 Jun 2014 18:04:33 +0000 (14:04 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-dm

9 years agosandbox: change local_irq_save() to macro
Masahiro Yamada [Thu, 12 Jun 2014 03:26:15 +0000 (12:26 +0900)]
sandbox: change local_irq_save() to macro

local_irq_save() should be a macro, not a function
because local_irq_save() saves flag to the given argument.

GCC is silent about this issue, but Clang warns:

In file included from lib/asm-offsets.c:15:
In file included from include/common.h:20:
In file included from include/linux/bitops.h:110:
arch/sandbox/include/asm/bitops.h:59:17:
 warning: variable 'flags' is uninitialized when used here
      [-Wuninitialized]
        local_irq_save(flags);
                       ^~~~~

That change causes another warning:

In file included from include/linux/bitops.h:110:0,
                 from include/common.h:20,
                 from lib/asm-offsets.c:15:
arch/sandbox/include/asm/bitops.h: In function ‘test_and_set_bit’:
arch/sandbox/include/asm/bitops.h:56:16: warning: unused variable ‘flags’ [-Wunused-variable]

So, flags should be set to __always_unused.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Jeroen Hofstee <jeroen@myspectrum.nl>
9 years agosandbox: terminate os_dirent_ls() result list
Stephen Warren [Wed, 11 Jun 2014 16:26:23 +0000 (10:26 -0600)]
sandbox: terminate os_dirent_ls() result list

Each node in the linked-list that os_dirent_ls() returns has its next
pointer set only when the next node is created. For the last node in the
list, there is no next node, so this never happens, and the next pointer
is never initialized. Explicitly initialize the next pointer so that it
isn't dangling. Without this, "sb ls" might crash.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agosandbox: restore ability to access host fs through standard commands
Stephen Warren [Thu, 12 Jun 2014 16:28:32 +0000 (10:28 -0600)]
sandbox: restore ability to access host fs through standard commands

Commit 95fac6ab4589 "sandbox: Use os functions to read host device tree"
removed the ability for get_device_and_partition() to handle the "host"
device type, and redirect accesses to it to the host filesystem. This
broke some unit tests that use this feature. So, revert that change. The
code added back by this patch is slightly different to pacify checkpatch.

However, we're then left with "host" being both:
- A pseudo device that accesses the hosts real filesystem.
- An emulated block device, which accesses "sectors" inside a file stored
  on the host.

In order to resolve this discrepancy, rename the pseudo device from host
to hostfs, and adjust the unit-tests for this change.

The "help sb" output is modified to reflect this rename, and state where
the host and hostfs devices should be used.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
9 years agox86: Enable 32-bit build using x86_64 multilib toolchain
Vasili Galka [Tue, 10 Jun 2014 13:14:56 +0000 (16:14 +0300)]
x86: Enable 32-bit build using x86_64 multilib toolchain

Until now building the x86 arch boards required 32-bit toolchain. As
many x86_64 toolchains come with 32-bit support (multilib) that's a
good idea to enable build with such toolchains.

The change required was to specify the usage of 32-bit explicitly to
the compiler and the linker (-m32 and -m elf_i386 flags) and locate
the right libgcc path.

Signed-off-by: Vasili Galka <vvv444@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agompc8313: add CONFIG_SYS_GENERIC_BOARD to ids8313 board
Heiko Schocher [Sun, 22 Jun 2014 04:33:30 +0000 (06:33 +0200)]
mpc8313: add CONFIG_SYS_GENERIC_BOARD to ids8313 board

- add CONFIG_SYS_GENERIC_BOARD
- remove CONFIG_OF_CONTROL to boot again

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Kim Phillips <kim.phillips@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agolib, fdt: move fdtdec_get_int() out of lib/fdtdec.c
Heiko Schocher [Sun, 22 Jun 2014 04:33:29 +0000 (06:33 +0200)]
lib, fdt: move fdtdec_get_int() out of lib/fdtdec.c

move fdtdec_get_int() out of lib/fdtdec.c into lib/fdtdec_common.c
as this function is also used, if CONFIG_OF_CONTROL is not
used. Poped up on the ids8313 board using signed FIT images,
and activating CONFIG_SYS_GENERIC_BOARD. Without this patch
it shows on boot:

No valid FDT found - please append one to U-Boot binary, use u-boot-dtb.bin or define CONFIG_OF_EMBED. For sandbox, use -d <file.dtb>

With this patch, it boots again with CONFIG_SYS_GENERIC_BOARD
enabled.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
9 years agodm: Use '*' to indicate a device is activated
Simon Glass [Sat, 24 May 2014 21:21:07 +0000 (15:21 -0600)]
dm: Use '*' to indicate a device is activated

Make both dm enumeration commands support showing whether a driver is active
or not, and use a consistent indicator (an asterisk).

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
9 years agoinclude/dm.h: fix inclusion guard
Jeroen Hofstee [Tue, 10 Jun 2014 21:52:36 +0000 (23:52 +0200)]
include/dm.h: fix inclusion guard

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agoMerge branch 'master' of git://git.denx.de/u-boot-dm
Tom Rini [Sat, 21 Jun 2014 00:03:51 +0000 (20:03 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-dm

9 years agodm: Expand and improve the device lifecycle docs
Simon Glass [Thu, 12 Jun 2014 05:29:55 +0000 (23:29 -0600)]
dm: Expand and improve the device lifecycle docs

The lifecycle of a device is an important part of driver model. Add to the
existing documentation and clarify it.

Reported-by: Jon Loeliger <jdl@jdl.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: Tidy up four minor code nits
Simon Glass [Thu, 12 Jun 2014 05:29:54 +0000 (23:29 -0600)]
dm: Tidy up four minor code nits

There is a spelling mistake and two functions are missing comments
altogether. Also the flags declaration is correct, but doesn't follow
style. Finally, the uclass_get_device() function has some errors in
its documentation.

Fix these problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
9 years agotegra: Enable driver model
Simon Glass [Thu, 12 Jun 2014 05:29:53 +0000 (23:29 -0600)]
tegra: Enable driver model

Enable driver model for Tegra boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
9 years agotegra: dts: Bring in GPIO bindings from linux
Simon Glass [Thu, 12 Jun 2014 05:29:52 +0000 (23:29 -0600)]
tegra: dts: Bring in GPIO bindings from linux

These files are taken from Linux 3.14.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
9 years agodm: Fix printf() strings in the 'dm' command
Simon Glass [Thu, 12 Jun 2014 05:29:51 +0000 (23:29 -0600)]
dm: Fix printf() strings in the 'dm' command

The values here are int, but the map_to_sysmem() call can return a long.
Add a cast to deal with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: Allow driver model tests only for sandbox
Simon Glass [Thu, 12 Jun 2014 05:29:50 +0000 (23:29 -0600)]
dm: Allow driver model tests only for sandbox

The GPIO tests require the sandbox GPIO driver, so cannot be run on other
platforms. Similarly for the 'dm test' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: Cast away the const-ness of the global_data pointer
Simon Glass [Thu, 12 Jun 2014 05:29:49 +0000 (23:29 -0600)]
dm: Cast away the const-ness of the global_data pointer

In a very few cases we need to adjust the driver model root device, such as
when setting it up at initialisation. Add a macro to make this easier.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: Add missing header files in lists and root
Simon Glass [Thu, 12 Jun 2014 05:29:48 +0000 (23:29 -0600)]
dm: Add missing header files in lists and root

These files don't compile in some architectures. Fix it by adding the
missing headers.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: Use case-insensitive comparison for GPIO banks
Simon Glass [Thu, 12 Jun 2014 05:29:47 +0000 (23:29 -0600)]
dm: Use case-insensitive comparison for GPIO banks

We want 'N0' and 'n0' to mean the same thing, so ensure that case is not
considered when naming GPIO banks.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: Update README to encourage conversion to driver model
Simon Glass [Thu, 12 Jun 2014 05:29:46 +0000 (23:29 -0600)]
dm: Update README to encourage conversion to driver model

Add a note to encourage people to convert drivers to use driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: Rename struct device_id to udevice_id
Simon Glass [Thu, 12 Jun 2014 05:29:45 +0000 (23:29 -0600)]
dm: Rename struct device_id to udevice_id

It is best to avoid having any occurence of 'struct device' in driver
model, so rename to achieve this.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agoMakefile: Support include files for .dts files
Simon Glass [Thu, 12 Jun 2014 05:29:44 +0000 (23:29 -0600)]
Makefile: Support include files for .dts files

Linux supports this, and if we are to have compatible device tree files,
U-Boot should also.

Avoid giving the device tree files access to U-Boot's include/ directory.
Only include/dt-bindings is accessible.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agosandbox: Support iotrace feature
Simon Glass [Thu, 12 Jun 2014 05:29:43 +0000 (23:29 -0600)]
sandbox: Support iotrace feature

Support the iotrace feature for sandbox, and enable it, using some dummy
I/O access methods.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agoarm: Support iotrace feature
Simon Glass [Thu, 12 Jun 2014 05:29:42 +0000 (23:29 -0600)]
arm: Support iotrace feature

Support the iotrace feature for ARM, when enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agoAdd an I/O tracing feature
Simon Glass [Thu, 12 Jun 2014 05:29:41 +0000 (23:29 -0600)]
Add an I/O tracing feature

When debugging drivers it is useful to see what I/O accesses were done
and in what order.

Even if the individual accesses are of little interest it can be useful to
verify that the access pattern is consistent each time an operation is
performed. In this case a checksum can be used to characterise the operation
of a driver. The checksum can be compared across different runs of the
operation to verify that the driver is working properly.

In particular, when performing major refactoring of the driver, where the
access pattern should not change, the checksum provides assurance that the
refactoring work has not broken the driver.

Add an I/O tracing feature and associated commands to provide this facility.
It works by sneaking into the io.h heder for an architecture and redirecting
I/O accesses through its tracing mechanism.

For now no commands are provided to examine the trace buffer. The format is
fairly simple, so 'md' is a reasonable substitute.

Note: The checksum feature is only useful for I/O regions where the contents
do not change outside of software control. Where this is not suitable you can
fall back to manually comparing the addresses. It might be useful to enhance
tracing to only checksum the accesses and not the data read/written.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agocosmetic: kbuild: clean-up coding style (sync with Linux 3.16-rc1)
Masahiro Yamada [Mon, 16 Jun 2014 09:56:38 +0000 (18:56 +0900)]
cosmetic: kbuild: clean-up coding style (sync with Linux 3.16-rc1)

Import the following trivial commits from Linux v3.16-rc1:

 bb66fc6 kbuild: trivial - use tabs for code indent where possible
 7eb6e34 kbuild: trivial - remove trailing empty lines
 3fbb43d kbuild: trivial - fix comment block indent
 38385f8 kbuild: trivial - remove trailing spaces

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agocosmetic: autoboot: update old style GNU struct init
Jeroen Hofstee [Sun, 15 Jun 2014 22:17:33 +0000 (00:17 +0200)]
cosmetic: autoboot: update old style GNU struct init

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
9 years agocmd_md5sum.c: remove dead code / fix warning
Jeroen Hofstee [Sun, 15 Jun 2014 22:10:42 +0000 (00:10 +0200)]
cmd_md5sum.c: remove dead code / fix warning

commit ecd729500 "Add parameter to md5sum to save the md5 sum"
adds support to build a string to be saved in the env and tries
to zero end it with str_ptr = '\0'; This does actually set the
pointer to the end of the buffer itself to zero. Since the
string was already zero terminated by the sprintf before it,
just remove the line, preventing a clang warning.

cc: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
9 years agoRemove nios-32 arch remnants
Vasili Galka [Sun, 15 Jun 2014 15:42:09 +0000 (18:42 +0300)]
Remove nios-32 arch remnants

nios-32 arch was removed back in 2010 (1117cbf). Code depending on
its headers (nios.h, nios-io.h) can't possibly compile since then.
As it wasn't fixed till now it is safe to remove.

Signed-off-by: Vasili Galka <vvv444@gmail.com>
9 years agom68k: Remove CONFIG_CMD_BEDBUG related code
Vasili Galka [Sun, 15 Jun 2014 15:41:16 +0000 (18:41 +0300)]
m68k: Remove CONFIG_CMD_BEDBUG related code

This flag does not compile on m68k since 2003 (8bde7f7) when a
required "cmd_bedbug.h" header was removed. Eleven years passed,
lets clean up a little...

Signed-off-by: Vasili Galka <vvv444@gmail.com>
9 years agopmic: tps65090: correct checking i2c bus
Jeroen Hofstee [Sun, 15 Jun 2014 15:17:04 +0000 (17:17 +0200)]
pmic: tps65090: correct checking i2c bus

The function tps65090_init checks the i2c bus of p->bus. However
the pointer p is not intialiased at this point. Check the local
variable bus instead.

cc: Tom Wai-Hong Tam <waihong@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agofix: CONFIG_NETCONSOLE start/handle this stuff only outside SPL
Hannes Petermaier [Fri, 13 Jun 2014 04:25:29 +0000 (06:25 +0200)]
fix: CONFIG_NETCONSOLE start/handle this stuff only outside SPL

SPL stage does not support various networking things, and therefore
CONFIG_NETCONSOLE cannot be built within SPL.

Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at>
9 years agoincludes: move openssl headers to include/u-boot
Jeroen Hofstee [Thu, 12 Jun 2014 20:27:12 +0000 (22:27 +0200)]
includes: move openssl headers to include/u-boot

commit 18b06652cd "tools: include u-boot version of sha256.h"
unconditionally forced the sha256.h from u-boot to be used
for tools instead of the host version. This is fragile though
as it will also include the host version. Therefore move it
to include/u-boot to join u-boot/md5.h etc which were renamed
for the same reason.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
9 years agotest: vboot: explicitly request bash
Stephen Warren [Thu, 12 Jun 2014 16:27:39 +0000 (10:27 -0600)]
test: vboot: explicitly request bash

vboot_test.sh uses Bashisms. Explicitly use #!/bin/bash so the script
doesn't fail if /bin/sh isn't Bash.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agoAdd documentation for verified boot on Beaglebone Black
Simon Glass [Thu, 12 Jun 2014 13:24:54 +0000 (07:24 -0600)]
Add documentation for verified boot on Beaglebone Black

As an example of an end-to-end process for using verified boot in U-Boot,
add a detailed description of the steps to be used for a Beaglebone
Black.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agoEnhance fit_check_sign to check all images
Simon Glass [Thu, 12 Jun 2014 13:24:53 +0000 (07:24 -0600)]
Enhance fit_check_sign to check all images

At present this tool only checks the configuration signing. Have it also
look at each of the images in the configuration and confirm that they
verify.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de> (v1)
9 years agobootm: Move decompression code into its own function
Simon Glass [Thu, 12 Jun 2014 13:24:52 +0000 (07:24 -0600)]
bootm: Move decompression code into its own function

This makes it possible to decompress an image without it being a kernel
and without intending to boot it (as it needed for host tools, for example).

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agoAllow compiling common/bootm.c on with HOSTCC
Simon Glass [Thu, 12 Jun 2014 13:24:51 +0000 (07:24 -0600)]
Allow compiling common/bootm.c on with HOSTCC

We want to use some of the functionality in this file, so make it
build on the host.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agoAvoid including config.h in command.h
Simon Glass [Thu, 12 Jun 2014 13:24:50 +0000 (07:24 -0600)]
Avoid including config.h in command.h

This is not necessary and prevents using this header when building tools.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agoFix small 'case' typo in image-fit.c
Simon Glass [Thu, 12 Jun 2014 13:24:49 +0000 (07:24 -0600)]
Fix small 'case' typo in image-fit.c

This typo makes the comment confusing. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agobootm: Support android boot on sandbox
Simon Glass [Thu, 12 Jun 2014 13:24:48 +0000 (07:24 -0600)]
bootm: Support android boot on sandbox

A small change allows this to operate on sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agoimage: Remove the fit_load_image() property parameter
Simon Glass [Thu, 12 Jun 2014 13:24:47 +0000 (07:24 -0600)]
image: Remove the fit_load_image() property parameter

This can be obtained by looking up the image type, so is redundant. It is
better to centralise this lookup to avoid errors.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agobootm: Split out code from cmd_bootm.c
Simon Glass [Thu, 12 Jun 2014 13:24:46 +0000 (07:24 -0600)]
bootm: Split out code from cmd_bootm.c

This file has code in three different categories:
- Command processing
- OS-specific boot code
- Locating images and setting up to boot

Only the first category really belongs in a file called cmd_bootm.c.

Leave the command processing code where it is. Split out the OS-specific
boot code into bootm_os.c. Split out the other code into bootm.c

Header files and extern declarations are tidied but otherwise no code
changes are made, to make it easier to review.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agoReverse the meaning of the fit_config_verify() return code
Simon Glass [Thu, 12 Jun 2014 13:24:45 +0000 (07:24 -0600)]
Reverse the meaning of the fit_config_verify() return code

It is more common to have 0 mean OK, and -ve mean error. Change this
function to work the same way to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agotools: Check arguments in fit_check_sign/fit_info
Simon Glass [Thu, 12 Jun 2014 13:24:44 +0000 (07:24 -0600)]
tools: Check arguments in fit_check_sign/fit_info

These tools crash if no arguments are provided. Add checks to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
9 years agofdt: Rename the DEV_TREE_BIN Makefile flag to to EXT_DTB
Simon Glass [Thu, 12 Jun 2014 13:24:43 +0000 (07:24 -0600)]
fdt: Rename the DEV_TREE_BIN Makefile flag to to EXT_DTB

This seems like a better name. This is a patch-up to the earlier commit
63b4b5b, and also removes a redundant Makefile change.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agomkimage: Automatically expand FDT in more cases
Simon Glass [Thu, 12 Jun 2014 13:24:42 +0000 (07:24 -0600)]
mkimage: Automatically expand FDT in more cases

The original code did not cover every case and there was a missing negative
sign in one case. Expand the coverage and fix the bug.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agohash: Use uint8_t in preference to u8
Simon Glass [Thu, 12 Jun 2014 13:24:41 +0000 (07:24 -0600)]
hash: Use uint8_t in preference to u8

This type is more readily available on the host compiler, so use it instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agoam335x_evm: Only enable OF_CONTROL/OF_SEPARATE on VBOOT for now
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.

Signed-off-by: Tom Rini <trini@ti.com>
9 years ago.gitignore: drop include/asm/proc from ignore pattern
Masahiro Yamada [Thu, 12 Jun 2014 05:37:35 +0000 (14:37 +0900)]
.gitignore: drop include/asm/proc from ignore pattern

Commit 7d89982b stopped creating symbolic link
arch/${arch}/include/asm/proc.

arch/.gitignore should be updated.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Vasili Galka <vvv444@gmail.com>
9 years agofs: ext4: fix writing zero-length files
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>
9 years agofdt_support: correct the return condition of fdt_initrd()
Masahiro Yamada [Fri, 18 Apr 2014 08:41:05 +0000 (17:41 +0900)]
fdt_support: correct the return condition of fdt_initrd()

Before this commit, fdt_initrd() just returned if initrd
start address is zero.
But it is possible if the RAM is located at address 0.

This commit makes the return condition more reasonable:
Just return if the size of initrd is zero.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agofdt_support: fix an endian bug of fdt_initrd()
Masahiro Yamada [Fri, 18 Apr 2014 08:41:04 +0000 (17:41 +0900)]
fdt_support: fix an endian bug of fdt_initrd()

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>
9 years agofdt_support: fix an endian bug of fdt_fixup_memory_banks
Masahiro Yamada [Fri, 18 Apr 2014 08:41:03 +0000 (17:41 +0900)]
fdt_support: fix an endian bug of fdt_fixup_memory_banks

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_fixup_memory_banks() invoked write_cell(), which always
swaps byte order.
It means the function only worked on little endian architectures.

This commit adds and uses a new helper function, fdt_pack_reg(),
which works on both big endian and little endian architrectures.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agofdt_support: add 'const' qualifier for unchanged argument
Masahiro Yamada [Fri, 18 Apr 2014 08:41:02 +0000 (17:41 +0900)]
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>
9 years agofdt_support: refactor fdt_fixup_stdout() function
Masahiro Yamada [Fri, 18 Apr 2014 08:41:01 +0000 (17:41 +0900)]
fdt_support: refactor fdt_fixup_stdout() function

- 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>
9 years agofdt_support: delete force argument of fdt_chosen()
Masahiro Yamada [Fri, 18 Apr 2014 08:41:00 +0000 (17:41 +0900)]
fdt_support: delete force argument of fdt_chosen()

After all, we have realized "force" argument is completely
useless. fdt_chosen() was always called with force = 1.

We should always want to do the same thing
(set appropriate value to the property)
even if the property already exists.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agofdt_support: delete force argument of fdt_initrd()
Masahiro Yamada [Fri, 18 Apr 2014 08:40:59 +0000 (17:40 +0900)]
fdt_support: delete force argument of fdt_initrd()

After all, we have realized "force" argument is completely
useless. fdt_initrd() was always called with force = 1.

We should always want to do the same thing
(set appropriate value to the property)
even if the property already exists.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agofdt_support: refactor with fdt_find_or_add_subnode helper func
Masahiro Yamada [Fri, 18 Apr 2014 08:40:58 +0000 (17:40 +0900)]
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>
9 years agofdt_support: delete unnecessary DECLARE_GLOBAL_DATA_PTR
Masahiro Yamada [Fri, 18 Apr 2014 08:40:57 +0000 (17:40 +0900)]
fdt_support: delete unnecessary DECLARE_GLOBAL_DATA_PTR

gd->bd is not used in fdt_support.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agofreescale: m5253demo: fix unused-but-set-variable warnings
Masahiro Yamada [Tue, 15 Apr 2014 04:26:34 +0000 (13:26 +0900)]
freescale: m5253demo: fix unused-but-set-variable warnings

Fix the following warning messages:

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]

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: TsiChung Liew <Tsi-Chung.Liew@freescale.com>
9 years agolibfdt: Fix segfault when calling fit_check_format() on corrupt FIT images
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.

Signed-off-by: Tom Rini <trini@ti.com>
9 years agom68k:correct io macros about endian
Chao Fu [Fri, 13 Dec 2013 05:39:07 +0000 (13:39 +0800)]
m68k:correct io macros about endian

M68k is big endian cpu ,so use be_out and be_in in big endian.

Signed-off-by: Chao Fu <b44548@freescale.com>
9 years agom68k: eliminate a warning in cpu_init
Masahiro Yamada [Wed, 16 Oct 2013 04:53:04 +0000 (13:53 +0900)]
m68k: eliminate a warning in cpu_init

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agoARM: fdt support: Add usbethaddr as an acceptable MAC
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.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
9 years agoFix bug in io64 target (introduced by commit aba27ac)
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.

Cc: Stefan Roese <sr@denx.de>
Acked-by: Dirk Eibach <dirk.eibach@gdsys.cc>
Signed-off-by: Vasili Galka <vvv444@gmail.com>
9 years agoconfigs: iocon: Enabling CONFIG_CMD_FPGAD again
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.

Revert changes in iocon.h config file caused by
these two commits:
"configs: iocom: Fix typo on CMD_FPGA command"
(sha1: d0db28f94034ef02c1d6737895766fb3c19de47f)
and
"fpga: Guard the LOADMK functionality with CMD_FPGA_LOADMK"
(sha1: 64e809afeaf1572c3246a5bca198a77d0498fd89)

CONFIG_CMD_FPGAD is own command.

Reported-by: Dirk Eibach <dirk.eibach@gdsys.cc>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
9 years agoMerge branch 'master' of git://git.denx.de/u-boot-mmc
Tom Rini [Thu, 12 Jun 2014 13:02:23 +0000 (09:02 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-mmc

9 years agommc: free allocated memory on initialization errors
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>
9 years agocmd_mmc: make mmc dev always re-probe the HW
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>
9 years agocmd_mmc: Use init_mmc_device() from do_mmc_rescan()
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>
9 years agocmd_mmc: add force_init parameter to init_mmc_device()
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.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
9 years agodisk: default to HW partition 0 if not specified
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>
9 years agocmd_mmc: default to HW partition 0 if not specified
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>
9 years agommc: return meaningful error codes from mmc_select_hwpart
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.

Suggested-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
9 years agoi2c: kona: Resolve Kona I2C driver issue
Steve Rae [Mon, 26 May 2014 19:33:29 +0000 (12:33 -0700)]
i2c: kona: Resolve Kona I2C driver issue

- "i2c mw" command hangs (with some compilers)

Signed-off-by: Steve Rae <srae@broadcom.com>
9 years agocommon/xyzModem.c: move empty statements to newline
Jeroen Hofstee [Tue, 10 Jun 2014 23:04:42 +0000 (01:04 +0200)]
common/xyzModem.c: move empty statements to newline

To prevent a warning for clang the loop without a body
is made more clear by moving it to a line of its own.
This prevents a clang warning.

cc: sbabic@denx.de
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
9 years agojffs2:jffs2_1pass.c: remove double braces
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.

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
9 years agoboard:keymile: remove unnecessary double braces
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.

cc: Holger Brunck <holger.brunck@keymile.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>