Commit Graph

11786 Commits

Author SHA1 Message Date
Sergey Temerkhanov 5917e7d165 net: Fix incorrect DHCP/BOOTP packets on 64-bit systems
This commit fixes incorrect DHCP/BOOTP packet layout caused by
'ulong' type size difference on 64 and 32-bit architectures.
It also renames NetReadLong()/NetCopyLong() to
net_read_u32/net_copy_u32() accordingly.

Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:35 -06:00
Joe Hershberger bc0571fc10 net: cosmetic: Fix checkpatch.pl failures in net.c
Finish eliminating CamelCase from net.c and other failures

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:35 -06:00
Joe Hershberger a34f207563 net: cosmetic: Fix checkpatch.pl failures in net.h
There were still a few remaining complains in the legacy eth_device
definition that hadn't been addressed.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:35 -06:00
Joe Hershberger 4fd5055f59 net: cosmetic: Clean up cmd_net variables and functions
Make a thorough pass through all variables and function names contained
within common/cmd_net.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:34 -06:00
Joe Hershberger 6a38a5f3df net: cosmetic: Clean up netconsole variables and functions
Make a thorough pass through all variables and function names contained
within netconsole.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:34 -06:00
Joe Hershberger 786eac5f9d net: cosmetic: Clean up DNS variables and functions
Make a thorough pass through all variables and function names contained
within dns.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:34 -06:00
Joe Hershberger 6aede5b750 net: cosmetic: Clean up CDP variables and functions
Make a thorough pass through all variables and function names contained
within cdp.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:34 -06:00
Joe Hershberger 1fd92db83d net: cosmetic: Fix var naming net <-> eth drivers
Update the naming convention used in the network stack functions and
variables that Ethernet drivers use to interact with it.

This cleans up the temporary hacks that were added to this interface
along with the DM support.

This patch has a few remaining checkpatch.pl failures that would be out
of the scope of this patch to fix (drivers that are in gross violation
of checkpatch.pl).

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:33 -06:00
Joe Hershberger 1203fcceec net: cosmetic: Cleanup internal packet buffer names
This patch cleans up the names of internal packet buffer names that are
used within the network stack and the functions that use them.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2015-04-18 11:11:32 -06:00
Joe Hershberger 0adb5b761f net: cosmetic: Name ethaddr variables consistently
Use "_ethaddr" at the end of variables and drop CamelCase.
Make constant values actually 'const'.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:32 -06:00
Joe Hershberger 586cbe51ab net: cosmetic: Fixup var names for DHCP strings
Remove CamelCase variable naming.
Move the definition to the same compilation unit as the primary use.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:32 -06:00
Joe Hershberger 1411157d85 net: cosmetic: Fixup var names related to boot file
The variables around the bootfile were inconsistent and used CamelCase.
Update them to make the code more readable.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:32 -06:00
Joe Hershberger 049a95a775 net: cosmetic: Change IPaddr_t to struct in_addr
This patch is simply clean-up to make the IPv4 type that is used match
what Linux uses. It also attempts to move all variables that are IP
addresses use good naming instead of CamelCase. No functional change.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:32 -06:00
Simon Glass 57f54d55bd dm: test: Allow 'dm test' to select a particular test to run
As well as running all tests, it is useful to be able to run a selected test.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:30 -06:00
Simon Glass aacef25601 dm: usb: sandbox: Enable USB
Enable USB emulation and associated features so that USB can be used in
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:29 -06:00
Simon Glass 7caced5aae dm: usb: Tidy up pipe value decoding
Add a few more shifts/masks to make it easier to decode a pipe value (rather
than just building it). We need this for USB device emulation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:29 -06:00
Simon Glass 8e2b6619c5 dm: usb: Add a generic descriptor struct
This is useful for creating lists of descriptors, and is better than using
void * for this purpose.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:29 -06:00
Simon Glass 78ab40b3e5 dm: usb: exynos: Enable both USB ports on snow
Switch snow over to use both EHCI and XHCI at the same time.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:29 -06:00
Simon Glass 5db439920b dm: usb: sandbox: Add an emulator for USB hub emulation
All USB controllers need a root hub. Add a sandbox emulation for this so
that we can add USB devices to sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:26 -06:00
Simon Glass f4f715360c dm: usb: sandbox: Add an emulator for USB flash devices
This emulator supports USB enumeration and allows a local file to be provided
as the contents of the emulated flash stick. U-Boot can then use the file as
it would a normal device, with all access passing through the usb_stor layer
and the USB stack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:26 -06:00
Simon Glass 019808f97c dm: usb: sandbox: Add a uclass for USB device emulation
With sandbox we want to be able to emulate USB devices so that we can test
the USB stack. Add a uclass to support this. It implements the same
operations as a normal USB device driver, but in this case passes them on
to an emulation driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:26 -06:00
Simon Glass f84c052a3e dm: usb: Move struct usb_string to a common place
This is needed for sandbox USB device emulation, so move it to a place
where it can be found by things other than gadgets.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:26 -06:00
Simon Glass 449230f031 dm: usb: Bind generic USB devices when there is no driver
At present USB devices with no driver model driver cannot be seen in the
device list, and we fail to set them up correctly. This means they cannot
be used.

While having real drivers that support driver model for all USB devices
is the eventual goal, we are not there yet.

As a stop-gap, add a generic USB driver which is bound when we do not have
a real driver. This allows the device to be set up and shown on the bus.
It also allows ad-hoc code (such as usb_ether) to find these devices and
set them up.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:25 -06:00
Simon Glass 0566e2403d dm: usb: Allow USB drivers to be declared and auto-probed
USB devices in U-Boot are currently probed only after all devices have
been enumerated. Each type of device is probed by custom code, e.g.:

- USB storage
- Keyboard
- Ethernet

With driver model this approach doesn't work very well. We could build
a picture of the bus and then go back and add the devices later, but
this means that the data structures are incomplete for quite a while.
It also does not follow the model of being able to bind a device when we
discover it.

We would prefer to have devices automatically be bound as the device is
enumerated. This allows us to attach drivers to particular USB classes
or product/vendor IDs. This is the method used by Linux.

Add the required #defines from Linux, a way of declaring a USB driver and
the logic to locate the correct driver given the USB device's descriptors.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:25 -06:00
Simon Glass 2e17c87ebb dm: usb: Move USB storage definitions to usb_defs.h
These are better off in a header file so they can be used by other code (e.g.
the sandbox USB storage emulator).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:22 -06:00
Simon Glass 054fe48eb2 dm: usb: Add driver model support for hubs
Adjust the existing hub code to support driver model, and add a USB driver
for hubs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:21 -06:00
Simon Glass 862e75c0db dm: usb: Refactor port resets
Move the port reset code into its own function. Rename usb_hub_reset() to
indicate that is is now a legacy function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:20 -06:00
Simon Glass 79b5888729 dm: usb: Adjust usb_alloc_new_device() to return an error
This function returns NULL on error at present. Adjust it so that we can
return a real error, as is needed with driver model. Also improve the
error handling in its caller, usb_hub_port_connect_change(), and adjust
the code order to prepare for driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:20 -06:00
Simon Glass de31213fb8 dm: usb: Add a uclass for USB controllers
Add a uclass that can represent a USB controller. For now we do not create
devices for things attached to the controller. This will be added later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:20 -06:00
Simon Glass c5785673bc dm: core: Add device children and sibling functions
Add some utility functions to check for children and for the last sibling in
a device's parent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:19 -06:00
Simon Glass 39de843352 dm: core: Rename driver data function to dev_get_driver_data()
The existing get_get_of_data() function provides access to both the driver's
compatible string and its driver data. However only the latter is actually
useful. Update the interface to reflect this and fix up existing users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:19 -06:00
Simon Glass 3479253dad dm: core: Convert driver_bind() to use const
The driver is not modified by driver model, so update driver_bind() to
recognise that.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:19 -06:00
Simon Glass 2c03c4633b dm: core: Support allocating driver-private data for DMA
Some driver want to put DMA buffers in their private data. Add a flag
to tell driver model to align driver-private data to a cache boundary so
that DMA will work correctly in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:19 -06:00
Simon Glass 887bd4164d sandbox: Fix comment for os_open()
This has the wrong #define in the function comment. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:18 -06:00
Simon Glass 72538f4c3e linker_lists: Add a function to access a linker list entry
Once declared, you cannot access a linker_list entry since you do not have
a symbol name for it. Add llsym() macro to provide this. This avoids
searching for the symbol at run-time based on name.

An example usage is to declare a driver with U_BOOT_DRIVER(), then obtain
a pointer to that driver later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2015-04-18 11:11:18 -06:00
Joe Hershberger 63c9729a13 dm: eth: Provide a way for drivers to manage packet buffers
Some drivers need a chance to manage their receive buffers after the
packet has been handled by the network stack. Add an operation that
will allow the driver to be called in that case.

Reported-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Tested-on: pcduino3
2015-04-18 11:11:18 -06:00
Haikun.Wang@freescale.com a891937110 dm: spi: Convert Freescale DSPI driver to driver model
Move the Freescale DSPI driver over to driver model.

Signed-off-by: Haikun Wang <Haikun.Wang@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:18 -06:00
Simon Glass 3fbb78711c cros_ec: exynos: Match up device tree with kernel version
The U-Boot device trees are slightly different in a few places. Adjust them
to remove most of the differences. Note that U-Boot does not support the
concept of interrupts as distinct from GPIOs, so this difference remains.

For sandbox, use the same keyboard file as for ARM boards and drop the
host emulation bus which seems redundant.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:16 -06:00
Simon Glass ce6adaa4b5 fdt: Drop LPC compatible string in fdtdec
This is not needed now that we have moved chromebook_link and cros_ec to
driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:16 -06:00
Simon Glass 672055e20b fdt: cros_ec: Drop compatible string in fdtdec
This is not needed now that we have moved to driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:16 -06:00
Simon Glass 7e0c77a2b8 cros_ec: Remove unused cros_ec_board_init() function
Now that driver model handles cros_ec init, we can drop this special code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:16 -06:00
Simon Glass 3db02b1b31 exynos: cros_ec: Drop unnecessary init
Since driver model will probe the EC when it is first used, we do not
need to init it explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:15 -06:00
Simon Glass 06fbf10263 sandbox: cros_ec: Drop unnecessary init
Since driver model will probe the EC when it is first used, we do not
need to init it explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:15 -06:00
Simon Glass 60f37fc6aa cros_ec: Drop unused CONFIG_DM_CROS_EC
Since all supported boards enable this option now, we can remove it along
with the old code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:15 -06:00
Simon Glass 90b16d1491 x86: chromebook_link: dts: Add PCH and LPC devices
The PCH (Platform Controller Hub) is on the PCI bus, so show it as such.
The LPC (Low Pin Count) and SPI bus are inside the PCH, so put these in the
right place also.

Rename the compatible strings to be more descriptive since this board is the
only user. Once we are using driver model fully on x86, these will be
dropped.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:15 -06:00
Simon Glass a274e9cac5 dm: x86: Add a uclass for an Low Pin Count (LPC) device
On x86 systems this device is commonly used to provide legacy port access.
It is sort-of a replacement for the old ISA bus.

Add a uclass for this, and allow it to have child devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:14 -06:00
Simon Glass ba4575626e dm: x86: spi: Convert ICH SPI driver to driver model
Convert this driver over to use driver model. Since all x86 platforms use
it, move x86 to use driver model for SPI and SPI flash. Adjust all dependent
code and remove the old x86 spi_init() function.

Note that this does not make full use of the new PCI uclass as yet. We still
scan the bus looking for the device. It should move to finding its details
in the device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:14 -06:00
Simon Glass 8d987abc6a dm: sf: Add driver model read/write/erase methods
Permit use of a udevice to talk to SPI flash. Ultimately we would like
to retire the use of 'struct spi_flash' for this purpose, so create the
new API for those who want to move to it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:14 -06:00
Joe Hershberger 60304592b9 net: Improve error handling
Take a pass at plumbing errors through to the users of the network stack

Currently only the start() function errors will be returned from
NetLoop(). recv() tends not to have errors, so that is likely not worth
adding. send() certainly can return errors, but this patch does not
attempt to plumb them yet. halt() is not expected to error.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:14 -06:00
Joe Hershberger f3e0c3744a sandbox: Enable DHCP and IP defrag
This is now testable via the eth-raw interface

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:13 -06:00
Joe Hershberger e58780dcb7 dm: eth: Add support for aliases
Allow network devices to be referred to as "eth0" instead of
"eth@12345678" when specified in ethact.

Add tests to verify this behavior.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:13 -06:00
Joe Hershberger d87a457be8 sandbox: eth: Add ARP and PING response to sandbox driver
The sandbox driver will now generate response traffic to exercise the
ping command even when no network exists.  This allows the basic data
pathways of the DM to be tested.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:12 -06:00
Joe Hershberger 3ea143abe9 sandbox: eth: Add network support to sandbox
Add basic network support to sandbox which includes a network driver.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:12 -06:00
Joe Hershberger 17591405a7 dm: eth: Pass the packet pointer as a parameter to recv
Stop forcing drivers to call net_process_received_packet() - formerly
called NetReceive(). Now the uclass will handle calling the driver for
each packet until the driver errors or has nothing to return. The uclass
will then pass the good packets off to the network stack by calling
net_process_received_packet().

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2015-04-18 11:11:12 -06:00
Joe Hershberger 2a504df006 net: Clean up network stack names used in DM drivers
Take the opportunity to enforce better names on newly written or
retrofitted Ethernet drivers.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:12 -06:00
Joe Hershberger 05c3e68f85 dm: eth: Add basic driver model support to Ethernet stack
First just add support for MAC drivers.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:12 -06:00
Joe Hershberger d2eaec6006 net: Remove the bd* parameter from net stack functions
This value is not used by the network stack and is available in the
global data, so stop passing it around.  For the one legacy function
that still expects it (init op on old Ethernet drivers) pass in the
global pointer version directly to avoid changing that interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reported-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Trival fix to remove an unneeded variable declaration in 4xx_enet.c)
2015-04-18 11:11:11 -06:00
Joe Hershberger fce6900b49 net: Use int instead of u8 for boolean flag
On some archs masking the parameter is inefficient, so don't use u8.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reported-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:11 -06:00
Joe Hershberger 84eb1fba7b net: Refactor in preparation for driver model
Move some things around and organize things so that the driver model
implementation will fit in more easily.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:10 -06:00
Joe Hershberger ff99743254 net: Remove unneeded "extern" in net.h
Many of the functions in net.h were preceded extern needlessly. Removing
them to limit the number of checkpatch.pl complaints.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:10 -06:00
Joe Hershberger 8b2c9a7157 net: Provide a function to get the current MAC address
The current implementation exposes the eth_device struct to code that
needs to access the MAC address.  Add a wrapper function for this to
abstract away the pointer for this operation.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:10 -06:00
Joe Hershberger 0eb25b6196 common: Make sure arch-specific map_sysmem() is defined
In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:09 -06:00
Simon Glass 801f4f1bbc dm: x86: pci: Convert coreboot to use driver model for pci
Move coreboot-x86 over to driver model for PCI.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:09 -06:00
Simon Glass a33aca10ac dm: sandbox: pci: Enable PCI for sandbox
Enable PCI options so that sandbox can be used for testing this bus with
driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:07 -06:00
Hannes Petermaier 604c7d4a5a common/lcd_console: introduce display/framebuffer rotation
Sometimes, for example if the display is mounted in portrait mode or even if it
is mounted landscape but rotated by 180 degrees, we need to rotate our content
of the display respectively the framebuffer, so that user can read the messages
which are printed out.

For this we introduce the feature called "CONFIG_LCD_ROTATION", this may be
defined in the board-configuration if needed. After this the lcd_console will
be initialized with a given rotation from "vl_rot" out of "vidinfo_t" which is
provided by the board specific code.

If CONFIG_LCD_ROTATION is not defined, the console will be initialized with
0 degrees rotation.

Signed-off-by: Hannes Petermaier <hannes.petermaier@br-automation.com>
Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at>
Acked-by: Nikita Kiryanov <nikita@compulab.co.il>
[agust: fixed 'struct vidinfo' has no member named 'vl_rot' errors]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2015-04-18 17:40:37 +02:00
Simon Glass 36d0d3b4b4 dm: sandbox: pci: Add a PCI emulation uclass
Since sandbox does not have real devices (unless it borrows those from the
host) it must use emulations. Provide a uclass which permits PCI operations
to be passed through to an emulation device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-16 19:27:43 -06:00
Simon Glass ff3e077bd2 dm: pci: Add a uclass for PCI
Add a uclass for PCI controllers and a generic one for PCI devices. Adjust
the 'pci' command and the existing PCI support to work with this new uclass.
Keep most of the compatibility code in a separate file so that it can be
removed one day.

TODO: Add more header file comments to the new parts of pci.h

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-16 19:27:43 -06:00
Simon Glass aab6724c90 dm: pci: Move common PCI functions into their own file
Driver model will share many functions with the existing PCI implementation.
Move these into their own file to avoid duplication and confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-16 19:27:42 -06:00
Simon Glass 02c07b3741 dm: core: Add a uclass pre_probe() method for devices
Some uclasses want to set up a device before it is probed. Add a method
for this.

An example is with PCI, where a PCI uclass wants to set up its private
data for later use. This allows the device's uclass() method to make calls
whcih use that data (for example, read PCI memory regions from device
tree, set up bus numbers).

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-16 19:27:42 -06:00
Simon Glass e564f054af dm: core: Add dev_get_uclass_priv() to access uclass private data
Add a convenience function to access the private data that a uclass stores
for each of its devices. Convert over most existing uses for consistency
and to provide an example for others.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-16 19:27:42 -06:00
Simon Glass 106cce9604 fdt: Tighten up error handling in fdtdec_get_pci_addr()
This function returns -ENOENT when the property is missing (which the caller
might forgive) and also when the property is present but incorrectly
formatted (which many callers would like to report).

Update the error return value to allow these different situations to be
distinguished.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2015-04-16 19:27:42 -06:00
Simon Glass d4c671cc27 dm: Add a new CPU init function which can use driver model
Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2015-04-16 19:27:41 -06:00
Simon Glass 5f7bfdd630 fdt: Export fdtdec_get_number() for general use
This function is missing a prototype but is more widey useful. Add it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2015-04-16 19:27:41 -06:00
Simon Glass 51e9dad296 x86: Add support for panther (Asus Chromebox)
Support running U-Boot as a coreboot payload. Tested peripherals include:

- Video (HDMI and DisplayPort)
- SATA disk
- Gigabit Ethernet
- SPI flash

USB3 does not work. This may be a problem with the USB3 PCI driver or
something in the USB3 stack and has not been investigated So far this is
disabled. The SD card slot also does not work.

For video, coreboot will need to run the OPROM to set this up.

With this board, bare support (running without coreboot) is not available
as yet.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-16 19:27:40 -06:00
Simon Glass cc285c565a x86: Move common Chromebook config into a separate file
Since Chromebooks mostly have similar configuration, put it in a common
file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2015-04-16 19:27:40 -06:00
Simon Glass 713704f5e4 x86: pci: Add PCI IDs for lynxpoint
Add some new device IDs used by this haswell-based chipset.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2015-04-16 19:27:40 -06:00
Tom Rini 20913018fb Merge branch 'master' of http://git.denx.de/u-boot-sunxi 2015-04-16 12:51:23 -04:00
Paul Kocialkowski 6c739c5d8a sunxi: Complete i2c support for each supported platform
Sunxi platforms come with at least 3 TWI (I2C) controllers and some platforms
even have up to 5. This adds support for every controller on each supported
platform, which is especially useful when using expansion ports on single-board-
computers.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2015-04-15 16:33:17 +02:00
Paul Kocialkowski dd82242b4d i2c: mvtwsi: Support for up to 4 different controllers
Orion5x, Kirkwood and Armada XP platforms come with a single TWSI (I2C) MVTWSI
controller. However, other platforms using MVTWSI may come with more: this is
the case on Allwinner (sunxi) platforms, where up to 4 controllers can be found
on the same chip.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Heiko Schocher <hs@denx.de>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2015-04-15 16:33:17 +02:00
Paul Kocialkowski 940382fe7d power: axp209: Registers definitions in header
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2015-04-15 16:17:17 +02:00
Paul Kocialkowski 558ccc7f50 power: axp152: Registers definitions in header
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2015-04-15 16:17:17 +02:00
Paul Kocialkowski f7c7ab636a power: axp221: Virtual VBUS detect and enable GPIOs to replace separate logic
This converts the VBUS detection and enable logic to GPIO instead of separate
axp functions and checks that have to be used aside usual GPIO functions.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2015-04-15 16:17:17 +02:00
Kishon Vijay Abraham I 2d48aa69bd usb: modify usb_gadget_handle_interrupts to take controller index
Since we support multiple dwc3 controllers to be existent at the same
time, in order to handle the interrupts of a particular dwc3 controller
usb_gadget_handle_interrutps should take controller index as an
argument.

Hence the API of usb_gadget_handle_interrupts is modified to take
controller index as an argument and made the corresponding changes to all
the usb_gadget_handle_interrupts calls.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:11 +02:00
Kishon Vijay Abraham I a69e2c225d include: configs: Enable DWC3 and DFU in AM43xx
Enabled dwc3, dwc3-omap and PHY for dwc3 are enabled. Also enabled
support for DFU.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:11 +02:00
Kishon Vijay Abraham I 7a5a3e37bf include: configs: Enable DWC3 and DFU in DRA7xx
Enabled dwc3, dwc3-omap and PHY for dwc3 are enabled. Also enabled
support for DFU.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:11 +02:00
Kishon Vijay Abraham I 6900aeda52 usb: dwc3: TI PHY: PHY driver for dwc3 in TI platforms
Added a single driver for both USB2 PHY programming and USB3 PHY
programming.

USB3 PHY is taken from drivers/phy/phy-ti-pipe3.c in linux kernel.
commit 56042e : phy: ti-pipe3: Fix suspend/resume and module reload.

USB2 PHY is taken from drivers/phy/phy-omap-usb2.c in linux kernel.
commit eb82a3 : phy: omap-usb2: Balance pm_runtime_enable() on probe
failure and remove.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:10 +02:00
Kishon Vijay Abraham I 53de33fc00 usb: dwc3: dwc3-omap: add interrupt status API to check for interrupts
Added an API to check for interrupt status. This API is generally
called from board file to check for interrupt status.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:10 +02:00
Kishon Vijay Abraham I 57207657a1 dwc3: dwc3-omap: add support for multiple dwc3-omap controllers
Added support for multiple dwc3 omap controllers. This gives uboot
the capability to control multiple dwc3 omap controllers.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:10 +02:00
Kishon Vijay Abraham I c241d7eee4 usb: dwc3: dwc3-omap: change probe and remove to uboot init and uboot exit code
Removed probe and remove that are specific to linux and replaced it with
uboot init and uboot exit. These functions will be invoked from boardfile.

This will change once we have dwc3-omap driver adapted to use the uboot
driver model.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:10 +02:00
Kishon Vijay Abraham I 93c3763810 include: dwc3-omap-uboot: add a structure for populating dwc3-omap platform data
Added a structure to populate dwc3 omap platform data. The board file should
populate these platform data before invoking dwc3 omap driver.

This will be removed once dwc3-omap driver is adapted to use the driver model.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:10 +02:00
Kishon Vijay Abraham I 3f52e1b985 usb: dwc3: dwc3-omap: make dwc3-omap build in uboot
*) Changed the included header files to that used in u-boot.
*) Removed extcon_* APIs
*) Removed regulator_* APIs
*) Fixed other misc warnings
*) Added dwc3-omap.h to include the definitions of UTMI modes.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:10 +02:00
Kishon Vijay Abraham I 27d3b89d33 dwc3: core: added an API to invoke irq handlers
Since interrupt support is not present in u-boot, added an
API to handle the interrupts in dwc3 core. This API can be
polled to handle the interrupts.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:10 +02:00
Kishon Vijay Abraham I 793d347f53 dwc3: core: add support for multiple dwc3 controllers
Added support for multiple dwc3 controllers. This gives uboot
the capability to control multiple dwc3 controllers.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:10 +02:00
Kishon Vijay Abraham I da0d9e42a3 include: dwc3-uboot: add a structure for populating platform data
Added a structure to populate dwc3 core platform data. The board file should
populate these platform data before invoking dwc3 driver.
This will be removed once we have dwc3 driver adapted to use the driver model.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:09 +02:00
Kishon Vijay Abraham I 6f80390691 include: usb: composite: add USB_GADGET_DELAYED_STATUS to avoid compilation error
Added USB_GADGET_DELAYED_STATUS to avoid the following compilation error.
error: ‘USB_GADGET_DELAYED_STATUS’ undeclared (first use in this function)
while compiling dwc3/ep0.c

While this is been added only to avoid compilation error, the complete fix
should be something like the one added in linux kernel. The complete fix
will be ported once we have the composite driver in u-boot look similar to
the one in linux kernel.
commit 1b9ba000177ee47bcc5b44c7c34e48e735f5f9b1
Author: Roger Quadros <roger.quadros@nokia.com>
Date:   Mon May 9 13:08:06 2011 +0300

    usb: gadget: composite: Allow function drivers to pause control transfers

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:09 +02:00
Kishon Vijay Abraham I 747a0a5b38 usb: dwc3: gadget: make dwc3 gadget build in uboot
Did a bunch of things to get dwc3/gadget.c compile in u-boot without
build errors and warnings
*) Changed the included header files to that used in u-boot.
*) Used dma_alloc_coherent and dma_free_coherent APIs of u-boot
*) removed sg support
*) remove jiffies and used a simple while loop
*) removed irq support and added a function to call these interrupt handler.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:09 +02:00
Kishon Vijay Abraham I 9848e5740a usb: dwc3: fix dwc3 header files
Changed the header files included in core.h and io.h to the u-boot header
files so that these files can be included in other dwc3 source files and
be compiled in uboot. Also added otg.h which has the defines for dr_mode.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:09 +02:00
Kishon Vijay Abraham I 45d9337ec3 include: usb: modify gadget.h to include udc support
Made changes in gadget.h that is required after adding udc-core.c
except changes that might break other platforms.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
2015-04-14 05:48:08 +02:00
Stephen Warren 927c1fa266 Create API to map between CPU physical and bus addresses
On some SoCs, DMA-capable peripherals see a different address space to
the CPU's physical address space. Create an API to allow platform-agnostic
drivers to convert between the two address spaces when programming DMA
operations.

This API will exist on all platforms, but will have a dummy implementation
when this feature is not required. Other platforms will enable
CONFIG_PHYS_TO_BUS and provide the required implementation.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
2015-04-14 05:47:59 +02:00
Sergey Temerkhanov b12242aceb usb: Convert protocol header structures to use explicitly sized variables
This patch converts USB protocol headers to use explicitly sized
fields like the rest of the code

Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
2015-04-14 05:47:48 +02:00