Commit Graph

30163 Commits

Author SHA1 Message Date
Hans de Goede
2b338ef411 usb: Fix maxpacketsize for first descriptor read for low-speed usb devs
This fixes descriptor reading of lowspeed devices through ohci not working.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Marek Vasut <marex@denx.de>
2015-05-06 08:46:56 -06:00
Hans de Goede
cb8a2c148a dm: usb: Set desc_before_addr from ehci dm code
Without this usb-1 device descriptors do not get read properly.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:42 -06:00
Hans de Goede
fcdd8aaa48 dm: usb: Fix finding of first upstream usb-2 hub in the ehci dm code
The ehci driver model code for finding the first upstream usb-2 hub before
this commit has a number of issues:

1) "if (!ttdev->speed != USB_SPEED_HIGH)" does not work because the '!'
   takes presedence over the '!=' this should simply be
   "if (ttdev->speed == USB_SPEED_HIGH)"
2) It makes ttdev point to the first upstream usb-2 hub, but ttdev should
   point to the last usb-1 device before the first usb-2 hub (when going
   upstream from the device), as ttdev is used to find the port of the
   first usb-2 hub to which the the last usb-1 device is connected.
3) parent_devnum however should be set to the devnum of the first usb-2
   hub, so we need to keep pointers around to both usb_device structs.

To complicate things further during enumeration usb_device.dev will point
to the parent udevice, where as during normal use it will point to
the actual udevice, we must handle both cases correctly.

This commit fixes all this making usb-1 devices attached to usb-2 hubs,
including usb-1 devices attached to usb-1 hubs attached to usb-2 hubs, work.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:42 -06:00
Hans de Goede
25c8ebdfcd dm: usb: Use usb_get_bus in dm ehci code
Use usb_get_bus in dm ehci code rather then re-implementing it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:41 -06:00
Hans de Goede
7f1a07538f dm: usb: Copy over usb_device values from usb_scan_device() to final usb_device
Currently we copy over a number of usb_device values stored in the on stack
struct usb_device probed in usb_scan_device() to the final driver-model managed
struct usb_device in usb_child_pre_probe() through usb_device_platdata, and
then call usb_select_config() to fill in the rest.

There are 3 problems with this approach:

1) It does not fill in enough fields before calling usb_select_config(),
specifically it does not fill in ep0's maxpacketsize causing a div by zero
exception in the ehci driver.

2) It unnecessarily redoes a number of usb requests making usb probing slower

3) Calling usb_select_config() a second time fails on some usb-1 devices
plugged into usb-2 hubs, causing u-boot to not recognize these devices.

This commit fixes these issues by removing (*) the usb_select_config() call
from usb_child_pre_probe(), and instead of copying over things field by field
through usb_device_platdata, store a pointer to the in stack usb_device
(which is still valid when usb_child_pre_probe() gets called) and copy
over the entire struct.

*) Except for devices which are explictly instantiated through device-tree
rather then discovered through usb_scan_device() such as emulated usb devices
in the sandbox.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:41 -06:00
Hans de Goede
f78a5c0774 dm: usb: Make usb_get_bus easier to use for callers
Make usb_get_bus easier to use for callers, by directly returning the bus
rather then returning it via a pass-by-ref argument.

This also removes the error checking from the current callers, as
we already have an assert() for bus not being NULL in usb_get_bus().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:41 -06:00
Hans de Goede
134692af13 dm: usb: Do not use bus->seq before device_probe(bus)
Do not use bus->seq before device_probe(bus), as bus->seq is not set until
after the device_probe() call. This fixes u-boot printing: "USB-1:   " for
each bus it scans.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:41 -06:00
Axel Lin
76382aa2ce dm: i2c-gpio: Remove redundant dm_gpio_set_value() call
dm_gpio_set_dir_flags() will also set gpio output value when switching to
gpio output. So it's not necessary to call dm_gpio_set_value() after
dm_gpio_set_dir_flags() call.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:41 -06:00
Simon Glass
4772511475 dm: rtc: Add tests for real-time clocks
Add some simple tests to verify that the RTC uclass works correctly in
U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:41 -06:00
Simon Glass
fbe07ba0f8 dm: test: dts: Sort the aliases in the test device tree file
Sort these aliases to avoid confusion as to what is present.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2015-05-05 20:58:40 -06:00
Simon Glass
8e7083fc95 dm: rtc: sandbox: Enable real-time clock support
Enable real-time-clock support in sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:40 -06:00
Simon Glass
46af3608ea dm: sandbox: dts: Add a real-time clock attached to I2C
Add an emulated RTC device for sandbox, so that the 'date' command can be
used.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:40 -06:00
Simon Glass
17f0ac609b dm: net: rtc: Support using driver model for rtc in sntp
When setting the date, support driver model RTC also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2015-05-05 20:58:40 -06:00
Simon Glass
f9951eadb6 dm: rtc: Convert 'date' command to support driver model
Adjust this command so that it supports using driver model for I2C, i.e.
CONFIG_DM_I2C. This will permit it to be used in sandbox also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:40 -06:00
Simon Glass
5871416640 dm: rtc: sandbox: Add a driver for the sandbox I2C RTC
Add a driver which communicates with the sandbox I2C emulation RTC device
and permits it to be used in U-Boot. This driver is very simple - it just
reads and writes selected I2C registers in the device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:40 -06:00
Simon Glass
dd18e5d844 dm: rtc: sandbox: Add an emulated I2C RTC device
Add a sandbox I2C emulation device which emulates a real-time clock. The
clock works off an offset from the current system time, and supports setting
and getting the clock, as well as access to byte-width regisers in the RTC.
It does not support changing the system time.

This device can be used for testing the 'date' command on sandbox, as well
as the RTC uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:39 -06:00
Simon Glass
dbeda5b225 dm: rtc: Add a uclass for real-time clocks
Add a uclass for real-time clocks which support getting the current time,
setting it and resetting the chip to a known-working state. Some RTCs have
additional registers which can be used to store settings, so also provide
an interface to these.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:39 -06:00
Simon Glass
94eefdee2f dm: sandbox: Add os_localtime() to obtain the system time
Add a function to read the system time into U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:20 -06:00
Simon Glass
aac5119822 dm: rtc: Split structure definition into its own file
Move the definition of struct rtc_time into a separate file so that sandbox
can include it without requiring common.h and the like.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:20 -06:00
Simon Glass
be47aa6522 dm: Remove unnecessary types in bcd.h
We don't need to use u8, and if we avoid it, it isn't so much of a problem
that rtc.h includes this header. With this change we can include rtc.h from
sandbox files.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:20 -06:00
Simon Glass
714209832d dm: rtc: Rename mktime() and reduce the number of parameters
Most callers unpack the structure and pass each member. It seems better to
pass the whole structure instead, as with the C library. Also add an rtc_
prefix.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
2015-05-05 20:58:20 -06:00
Simon Glass
9f9276c34c dm: rtc: Rename to_tm() to rtc_to_tm() and add error code
Rename this function so that it is clear that it is provided by the RTC.
Also return an error when it cannot function as expected. This is unlikely
to occur since it works for dates since 1752 and many RTCs do not support
such old dates. Still it is better to be accurate.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
2015-05-05 20:58:20 -06:00
Simon Glass
199e87c340 dm: rtc: Rename gregorian day function
Change this function name to something more descriptive. Also return a
failure code if it cannot calculate a correct value.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
2015-05-05 20:58:20 -06:00
Simon Glass
c3ec646dde fdt: Correct warning in fdt_setup_simplefb_node()
Adjust the printf() string to avoid a warning on sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:19 -06:00
Simon Glass
182bf92d19 dm: i2c: Add an explicit test mode to the sandbox I2C driver
At present this driver has a few test features. They are needed for running
the driver model unit tests but are confusing and unnecessary if using
sandbox at the command line. Add a flag to enable the test mode, and don't
enable it by default.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:19 -06:00
Simon Glass
ba3864f803 dm: i2c: Add functions to read and write a register
Add driver model versions of the legacy functions to read and write a
single byte register. These are a useful shortcut in many cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
2015-05-05 20:58:19 -06:00
Simon Glass
1bde67b1f4 dm: i2c: sandbox: Add debugging to the speed limit
Print a debug() message with the I2C speed is exceeded.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
2015-05-05 20:58:19 -06:00
Simon Glass
bc5701e1b4 dm: spi: Correct the comment on spi_get_ops()
This comment should refer to SPI, not serial.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
2015-05-05 20:58:19 -06:00
Simon Glass
527265d8f2 cros_ec: Handle the single duplex requirement in cros_ec
With several chips using the SPI protocol it seems better to put the single
duplex functionality in the EC rather than the SPI driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:19 -06:00
Simon Glass
c4b206dff1 cros_ec: Show the protocol version in the debug message
When starting up, show the protocol version that has been negotiated with
the EC.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:18 -06:00
Simon Glass
60e2809a84 dm: spi: Avoid setting the speed with every transfer
Only set the speed if it has changed from last time. Since the speed will
be 0 when the device is probed it will always be changed on the first
transfer after the device is probed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:18 -06:00
Joe Hershberger
172a31bf87 test: dm: eth: Skip timeouts on ping tests
Indicate to the emulated sandbox Ethernet driver when we expect a
timeout and tell it to leap forward.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:18 -06:00
Joe Hershberger
6f2707c6b1 sandbox: eth: Add a function to skip ping timeouts
When called, the next call to receive will trigger a 10-second leap
forward in time to avoid waiting for time to pass when tests are
evaluating timeout behavior.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:18 -06:00
Joe Hershberger
909bd6d972 sandbox: Add test function to advance time
Add a function that maintains an offset to include in the system timer
values returned from the lib/time.c APIs.

This will allow timeouts to be skipped instantly in tests

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-05-05 20:58:18 -06:00
Tom Rini
905e8f9e53 Prepare v2015.07-rc1
Signed-off-by: Tom Rini <trini@konsulko.com>
2015-05-05 19:52:15 -04:00
Max Krummenacher
1bfb9222ae fw_env.h: include autoconf.h
Without this, when CONFIG_ENV_VARS_UBOOT_CONFIG is active we get
a compile time error when doing 'make env'.
In file included from tools/env/fw_env.c:117:0:
include/env_default.h:110:11: error: expected ‘}’ before ‘CONFIG_SYS_ARCH’

When building U-Boot this is included indirectly by the compiler switch
-include
/home/trdx/git.toradex.com/u-boot-2014.10-toradex/include/linux/kconfig.h

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2015-05-05 19:52:07 -04:00
Tom Rini
d81572c272 Merge git://git.denx.de/u-boot-mpc85xx 2015-05-05 14:57:23 -04:00
Tom Rini
1131d4e22c Merge git://git.denx.de/u-boot-marvell 2015-05-05 10:32:08 -04:00
Stefan Roese
2083db7a75 arm: mvebu: Remove "u-boot.kwb" CONFIG_BUILD_TARGET for non-SPL targets
By removing this default build target, the "u-boot.kwb" target is not
automatically generated. This fixes a temporary build error when using
out-of-tree builds, as buildman does per default (reported by Simon).

When the full SPL support is added for these targets with the DDR training
code, the "u-boot-spl.kwb" image will be generated automatically.

Users providing a special bin_hdr binary (binary.0) file can always add
this binary file and generate the full firmware image by issuing the
"make u-boot.kwb" command directly.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Prafulla Wadaskar <prafulla@marvell.com>
Cc: Luka Perkov <luka.perkov@sartura.hr>
2015-05-05 14:32:05 +02:00
Stefan Roese
144d509378 arm: mvebu: db-mv784mp-gp: Fix ECC I2C address
The macro to select the I2C address for ECC bus-width detection
was defined incorrectly for the Marvell DB-MV784MP-GP board. This
patch changes the macro to the correct value to fix this issue.

Signed-off-by: Stefan Roese <sr@denx.de>
2015-05-05 14:32:05 +02:00
Stefan Roese
2bae75a488 arm: mvebu: Add Armada A38x DB-88F6820-GP board support
This patch adds support for the Marvell DB-88F6820-GP Armada A38x
evaluation board.

Supported peripherals are:
- UART
- Ethernet (mvneta)
- I2C
- SPI (including SPI NOR flash)

Please note that this board support right now only supports the
main U-Boot. Without the bin_hdr integration (DDR training etc). This
will be added in a few days / weeks to complete this board port. But
till then this U-Boot version can be run on the target via the
original Marvell U-Boot via this command:

tftpboot 4000000 db-88f6820-gp/u-boot.bin;go 4000000

Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Tested-by: Dirk Eibach <dirk.eibach@gdsys.cc>
2015-05-05 14:32:05 +02:00
Stefan Roese
60b75324ea arm: mvebu: Add d-cache invalidate before enabling the d-cache
This solves some RX problems that have been seen, when using the
mvneta ethernet driver. The cache needs to be reset into a "clean"
state before using it.

Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Tested-by: Dirk Eibach <dirk.eibach@gdsys.cc>
2015-05-05 14:32:04 +02:00
Stefan Roese
b81d0ea728 arm: mvebu: mv-common.h: Add CONFIG_PREBOOT
This enables the usage of the "preboot" environment variable on Marvell
boards.

Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Tested-by: Dirk Eibach <dirk.eibach@gdsys.cc>
2015-05-05 14:32:04 +02:00
Stefan Roese
e89bf8bcc9 arm: mvebu: Remove coherency configuration
We are not using the coherency feature in U-Boot at all. So lets remove
this configuration from the mbus driver.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Tested-by: Dirk Eibach <dirk.eibach@gdsys.cc>
2015-05-05 14:32:04 +02:00
Stefan Roese
cae9008f69 arm: mvebu: Change network init code to allow a more flexible setup
With the introduction of the Armada 38x support, its necessary to change
the mvneta ethernet driver init call from always 4 times to a
configurable value. Lets make this init call more flexible by moving
the actually used devices to the config header.

Additionally this patch takes care of the slightly different base
addresses for the ethernet controllers on A38x.

Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Tested-by: Dirk Eibach <dirk.eibach@gdsys.cc>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2015-05-05 14:31:49 +02:00
Stefan Roese
9c6d3b7b66 arm: mvebu: Add basic Armada 38x support
This patch adds support for the Marvell Armada 38x SoC family.

Supported peripherals are:
- UART
- Ethernet (mvneta)
- I2C
- SPI (including SPI NOR flash)

Tested on Marvell DB-88F6820-GP evaluation board.

Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Tested-by: Dirk Eibach <dirk.eibach@gdsys.cc>
2015-05-05 14:28:29 +02:00
Stefan Roese
880b15a37b arm: mvebu: Move CONFIG_SPL_LDSCRIPT to common header
This way, new MVEBU boards don't need to specifiy the common location
for the SPL linker script.

Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Tested-by: Dirk Eibach <dirk.eibach@gdsys.cc>
2015-05-05 14:28:29 +02:00
Stefan Roese
f7c0ef073d arm: mvebu: Only define MV88F78X60 for Armada XP
This define is used by the DDR training code for Armada XP. With the
upcoming addition of Armada 38x support, lets only define it for
Armada XP in this common header.

Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Tested-by: Dirk Eibach <dirk.eibach@gdsys.cc>
2015-05-05 14:28:29 +02:00
Stefan Roese
8402b69b7e arm: mvebu: Remove unreferenced define
MAX_MVNETA_DEVS is not used anywhere in U-Boot. So lets remove it.

Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Tested-by: Dirk Eibach <dirk.eibach@gdsys.cc>
2015-05-05 14:28:29 +02:00
Stefan Roese
250eea74b9 arm: mvebu: Change header macros from ARMADA_XP to MVEBU
Since these files will be used for other MVEBU SoC's, lets reflect this
in the headers marcos as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Tested-by: Dirk Eibach <dirk.eibach@gdsys.cc>
2015-05-05 14:28:29 +02:00