oweals/u-boot.git
8 years agocgtqmx6eval: Add fastboot support
Otavio Salvador [Thu, 19 Nov 2015 21:02:35 +0000 (19:02 -0200)]
cgtqmx6eval: Add fastboot support

Tested basic fastboot commands, such as:

On the U-boot prompt:

=> fastboot 0

On the host PC:

$ fastboot getvar bootloader-version -i 0x0525
bootloader-version: U-Boot 2015.10-rc2-09654-g8f41d27
finished. total time: 0.000s

$ fastboot reboot -i 0x0525 --> board reboots fine.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>
8 years agocgtqmx6eval: Use SPI NOR to store the environment
Otavio Salvador [Thu, 19 Nov 2015 21:02:34 +0000 (19:02 -0200)]
cgtqmx6eval: Use SPI NOR to store the environment

Congatec boards boot from SPI NOR, so it makes more sense to use
SPI NOR to store the environment variables.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>
8 years agocgtqmx6eval: Add SPI NOR flash support
Otavio Salvador [Thu, 19 Nov 2015 21:02:33 +0000 (19:02 -0200)]
cgtqmx6eval: Add SPI NOR flash support

Add SPI NOR support:

=> sf probe
SF: Detected SST25VF032B with page size 256 Bytes, erase size 4 KiB, total 4 MiB

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>
8 years agoarm: mx6: Reduce SPL malloc pool size
Marek Vasut [Fri, 20 Nov 2015 20:43:24 +0000 (21:43 +0100)]
arm: mx6: Reduce SPL malloc pool size

Using 50 MiB malloc pool in SPL is nonsense. Since the caches are not
enabled in SPL, it takes 2 seconds to init the pool and has no obvious
benefit. Reduce the size to 1 MiB.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Tested-by: Stefano Babic <sbabic@denx.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>
8 years agodm: Add timeline and guide for porting serial drivers
Simon Glass [Fri, 20 Nov 2015 17:48:47 +0000 (10:48 -0700)]
dm: Add timeline and guide for porting serial drivers

Add a README with a brief guide to porting serial drivers over to use
driver model.

Add a timeline also. All serial drivers should be converted by the end
of January 2016.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: test: usb: sandbox: Add keyboard tests for sandbox
Simon Glass [Mon, 9 Nov 2015 06:48:08 +0000 (23:48 -0700)]
dm: test: usb: sandbox: Add keyboard tests for sandbox

Add a test that verifies that USB keyboards work correctly on sandbox.
This verifies some additional parts of the USB stack.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Enable USB keyboard
Simon Glass [Mon, 9 Nov 2015 06:48:07 +0000 (23:48 -0700)]
sandbox: Enable USB keyboard

Enable the USB keyboard on sandbox, now that we have a suitable emulation
driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agousb: sandbox: Add a USB emulation driver
Simon Glass [Mon, 9 Nov 2015 06:48:06 +0000 (23:48 -0700)]
usb: sandbox: Add a USB emulation driver

Add a simple USB keyboard driver for sandbox. It provides a function to
'load' it with input data, which it will then stream through to the normal
U-Boot input subsystem. When the input data is exhausted, the keyboard stops
providing data.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agousb: sandbox: Add support for interrupt operations
Simon Glass [Mon, 9 Nov 2015 06:48:05 +0000 (23:48 -0700)]
usb: sandbox: Add support for interrupt operations

Allow USB device emulation to support interrupt URBs so that we can use USB
keyboards with sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agousb: Avoid open-coded USB constants in usb_kbd.c
Simon Glass [Mon, 9 Nov 2015 06:48:04 +0000 (23:48 -0700)]
usb: Avoid open-coded USB constants in usb_kbd.c

Replace the open-coded values with constants to make it clearer what they
mean.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agousb: Drop unused code in usb_kbd.c
Simon Glass [Mon, 9 Nov 2015 06:48:03 +0000 (23:48 -0700)]
usb: Drop unused code in usb_kbd.c

This was missed in the conversion to driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: test: usb: Add a test for device reordering
Simon Glass [Mon, 9 Nov 2015 06:48:02 +0000 (23:48 -0700)]
dm: test: usb: Add a test for device reordering

Add tests that 'usb tree' produces the right output when a device changes
order on the bus.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: test: usb: Add tests for the 'usb tree' command
Simon Glass [Mon, 9 Nov 2015 06:48:01 +0000 (23:48 -0700)]
dm: test: usb: Add tests for the 'usb tree' command

Add tests that this command produces the right output, even when a rescan
results in a device disappearing from the bus.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: usb: Remove inactive children after a bus scan
Simon Glass [Mon, 9 Nov 2015 06:48:00 +0000 (23:48 -0700)]
dm: usb: Remove inactive children after a bus scan

Each scan of the USB bus may return different results. Existing driver-model
devices are reused when found, but if a device no longer exists it will stay
around, de-activated, but bound.

Detect these devices and remove them after the scan completes.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: usb: Deprecate usb_get_dev_index()
Simon Glass [Mon, 9 Nov 2015 06:47:59 +0000 (23:47 -0700)]
dm: usb: Deprecate usb_get_dev_index()

This function should not be used with driver model. While there are users
of USB Ethernet that use driver model for USB but not Ethernet, we have
to keep it around. Add a comment to that effect.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoRevert "dm: Export device_remove_children / device_unbind_children"
Simon Glass [Mon, 9 Nov 2015 06:47:58 +0000 (23:47 -0700)]
Revert "dm: Export device_remove_children / device_unbind_children"

This reverts commit bb52b367f6ca4a3a918e77737f4ff6a1089912d9.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoRevert "dm: usb: Use device_unbind_children to clean up usb devs on stop"
Simon Glass [Mon, 9 Nov 2015 06:47:57 +0000 (23:47 -0700)]
Revert "dm: usb: Use device_unbind_children to clean up usb devs on stop"

This reverts commit 6cda369509e0d3fa5f9e33c9d71589c4523799fa.

We want to avoid having the USB stack rely on unbind.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoRevert "dm: usb: Rename usb_find_child to usb_find_emul_child"
Simon Glass [Mon, 9 Nov 2015 06:47:56 +0000 (23:47 -0700)]
Revert "dm: usb: Rename usb_find_child to usb_find_emul_child"

This reverts commit 9b510df703d282effba4f56ac567aa8011d56e6b.

We want to avoid having the USB stack rely on unbind.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: usb: Allow finding a USB emulator for a device
Simon Glass [Mon, 9 Nov 2015 06:47:55 +0000 (23:47 -0700)]
sandbox: usb: Allow finding a USB emulator for a device

Each USB device has an emulator. Currently this can only be found by
supplying the 'pipe' value, which contains the device number. Add a way
to find it directly from the emulated device.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: usb: Allow up to 4 emulated devices on a hub
Simon Glass [Mon, 9 Nov 2015 06:47:54 +0000 (23:47 -0700)]
sandbox: usb: Allow up to 4 emulated devices on a hub

To support more advanced testing, support 4 devices instead of 2.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: usb: Allow dynamic emulated USB device descriptors
Simon Glass [Mon, 9 Nov 2015 06:47:53 +0000 (23:47 -0700)]
sandbox: usb: Allow dynamic emulated USB device descriptors

We would like the serial number to come from the device tree node name of
the emulated device. This avoids them all having the same name. Adjust the
code to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: core: Add safe device iteration macros
Simon Glass [Mon, 9 Nov 2015 06:47:52 +0000 (23:47 -0700)]
dm: core: Add safe device iteration macros

Add iteration macros which support unbinding a device within the loop.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agousb: Refactor USB tree output code for testing
Simon Glass [Mon, 9 Nov 2015 06:47:51 +0000 (23:47 -0700)]
usb: Refactor USB tree output code for testing

Allow the 'usb tree' command to be used from test code, so that we can
verify that it works correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agotest: Record and silence console in tests
Simon Glass [Mon, 9 Nov 2015 06:47:50 +0000 (23:47 -0700)]
test: Record and silence console in tests

When running sandbox tests, silence the console to avoid unwanted output.
Also, record the console in case tests want to check it.

The -v option can be used to enable stdout during tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Enable console recording and silent console
Simon Glass [Mon, 9 Nov 2015 06:47:49 +0000 (23:47 -0700)]
sandbox: Enable console recording and silent console

Allow console recording so that tests can use it. Also allow the console
output to be suppressed, to reduce test output 'noise'.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoconsole: Add a console buffer
Simon Glass [Mon, 9 Nov 2015 06:47:48 +0000 (23:47 -0700)]
console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoAdd a circular memory buffer implementation
Simon Glass [Mon, 9 Nov 2015 06:47:47 +0000 (23:47 -0700)]
Add a circular memory buffer implementation

This will be used to support console recording. It provides for a circular
buffer which can be written at the head and read from the tail. It supports
avoiding data copying by providing raw access to the data.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoDrop config.h header from display_options.c
Simon Glass [Mon, 9 Nov 2015 06:47:46 +0000 (23:47 -0700)]
Drop config.h header from display_options.c

Since common.h will always include this automatically, it is not needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoMove console definitions into a new console.h file
Simon Glass [Mon, 9 Nov 2015 06:47:45 +0000 (23:47 -0700)]
Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: usb: Avoid time delays in sandbox tests
Simon Glass [Mon, 9 Nov 2015 06:47:44 +0000 (23:47 -0700)]
dm: usb: Avoid time delays in sandbox tests

Currently the USB tests take around two seconds to run. Remove these
unnecessary time delays so that the tests run quickly.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Add a way to skip time delays
Simon Glass [Mon, 9 Nov 2015 06:47:43 +0000 (23:47 -0700)]
sandbox: Add a way to skip time delays

Some tests are slow due to delays which are unnecessary on sandbox. The
worst offender is USB where we lose two seconds. Add a way to disable time
delays.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: cros_ec: fix uninitialized use of len
Daniel Schwierzeck [Fri, 6 Nov 2015 13:15:37 +0000 (14:15 +0100)]
sandbox: cros_ec: fix uninitialized use of len

Building with gcc-5.2 raises this warning:

drivers/misc/cros_ec_sandbox.c: In function cros_ec_sandbox_packet:
drivers/misc/cros_ec_sandbox.c:483:5: warning: len may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (len < 0)
     ^

If the function process_cmd() is called with
req_hdr->command == EC_CMD_ENTERING_MODE, the value of len will be
returned uninitialized.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agox86: qemu: Convert to use driver model keyboard
Bin Meng [Thu, 12 Nov 2015 13:33:06 +0000 (05:33 -0800)]
x86: qemu: Convert to use driver model keyboard

Convert to use driver model keyboard on QEMU.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agox86: crownbay: Convert to use driver model keyboard
Bin Meng [Thu, 12 Nov 2015 13:33:05 +0000 (05:33 -0800)]
x86: crownbay: Convert to use driver model keyboard

Convert to use driver model keyboard on Intel Crown Bay.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoinput: Ban digit numbers if 'Num Lock' is not on
Bin Meng [Thu, 12 Nov 2015 13:33:04 +0000 (05:33 -0800)]
input: Ban digit numbers if 'Num Lock' is not on

When 'Num Lock' is not on, we should not send these digit numbers
(0-9 and dot) to the output buffer.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoinput: Change LED state bits to conform i8042 compatible keyboard
Bin Meng [Thu, 12 Nov 2015 13:33:03 +0000 (05:33 -0800)]
input: Change LED state bits to conform i8042 compatible keyboard

When sending LED update command to an i8042 compatible keyboard,
bit1 is 'Num Lock' and bit2 is 'Caps Lock' in the data byte. But
input library defines bit1 as 'Caps Lock' and bit2 as 'Num Lock'.
This causes a wrong LED to be set on an i8042 compatible keyboard.
Change the LED state bits to be i8042 compatible, and change the
keyboard flags as well.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoinput: Call keyboard's update_leds() method when the LEDs change
Bin Meng [Thu, 12 Nov 2015 13:33:02 +0000 (05:33 -0800)]
input: Call keyboard's update_leds() method when the LEDs change

We should request keyboard to turn on/off its LED when detecting
any changes on the LEDs.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Minor changes to allow this to build without CONFIG_DM_KEYBOARD:
Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoinput: Save keyboard's LED state to correct place
Bin Meng [Thu, 12 Nov 2015 13:33:01 +0000 (05:33 -0800)]
input: Save keyboard's LED state to correct place

Currently keyboard's LED state is wrongly saved to config->leds in
process_modifier(). It should really be config->flags.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoinput: Convert 'keyboard' driver to use input library
Simon Glass [Wed, 11 Nov 2015 17:05:48 +0000 (10:05 -0700)]
input: Convert 'keyboard' driver to use input library

This has duplicated scan code tables and logic. We can use the input
library to implement most of the features here.

This needs testing. The only supported board appears to be TQM5200.
Unfortunately no maintainer is listed for this board.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: input: Clean up after i8042 conversion
Simon Glass [Wed, 11 Nov 2015 17:05:47 +0000 (10:05 -0700)]
video: input: Clean up after i8042 conversion

Now that i8042 uses driver model, adjust other mentions of it and remove old
code that is no-longer used. Update the README and unify the keyboard text
into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoi8042: Handle a duplicate power-on-reset response
Simon Glass [Wed, 11 Nov 2015 17:05:46 +0000 (10:05 -0700)]
i8042: Handle a duplicate power-on-reset response

Sometimes we seem to get 0xaa twice which causes the config read to fail.
This causes chromebook_link to fail to set up the keyboard.

Add a check for this and read the config again when detected.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoinput: Convert i8042 to driver model
Simon Glass [Wed, 11 Nov 2015 17:05:45 +0000 (10:05 -0700)]
input: Convert i8042 to driver model

Adjust this driver to support driver model. The only users are x86 boards
so this should be safe.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoDrop CONFIG_ISA_KEYBOARD
Simon Glass [Wed, 11 Nov 2015 17:05:44 +0000 (10:05 -0700)]
Drop CONFIG_ISA_KEYBOARD

This option is mentioned but does not do anything. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agox86: Add an i8042 device for boards that have it
Simon Glass [Wed, 11 Nov 2015 17:05:43 +0000 (10:05 -0700)]
x86: Add an i8042 device for boards that have it

Some boards have an i8042 device. Enable the driver for all x86 boards, and
add a device tree node for those which may have this keyboard.

Also adjust the configuration so that i8042 is always separate from the VGA,
and rename the stdin driver accordingly. With this commit the keyboard will
not work, but it is fixed in the next commit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoinput: Add a Kconfig option for the i8042 keyboard
Simon Glass [Wed, 11 Nov 2015 17:05:42 +0000 (10:05 -0700)]
input: Add a Kconfig option for the i8042 keyboard

Add a new option CONFIG_I8042_KEYB which will replace the current
CONFIG_I8042_KBD. This new name fits better with existing drivers.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoinput: i8042: Convert to use the input library
Simon Glass [Wed, 11 Nov 2015 17:05:41 +0000 (10:05 -0700)]
input: i8042: Convert to use the input library

At present the i8042 driver has its own logic and keymaps. In an effort to
unify the code, move it over to use the input library. This changes most of
the keycode-processing logic since it is now in that library. The main
responsibilities of the driver are now to handle the LEDs, deal with the
PS/2 extended keycodes and initialise the the keyboard.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoinput: Allow updating of keyboard LEDs
Simon Glass [Wed, 11 Nov 2015 17:05:40 +0000 (10:05 -0700)]
input: Allow updating of keyboard LEDs

Add a function which returns a new keyboard LED value when the LEDs need
updating.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoinput: Handle caps lock
Simon Glass [Wed, 11 Nov 2015 17:05:39 +0000 (10:05 -0700)]
input: Handle caps lock

When caps lock is enabled we should convert lower case to upper case. Add
this to the input key processing so that caps lock works correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoinput: Adjust structure of code in process_modifier()
Simon Glass [Wed, 11 Nov 2015 17:05:38 +0000 (10:05 -0700)]
input: Adjust structure of code in process_modifier()

Move all the '!release' code into one block so that it is clear that it only
applies on key release.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoinput: Support the German keymap
Simon Glass [Wed, 11 Nov 2015 17:05:37 +0000 (10:05 -0700)]
input: Support the German keymap

Add support for the German keymap, taken from i8042.c. This can be selected
when the input library it initialised.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agosandbox: add a sandbox timer and basic test
Thomas Chou [Fri, 30 Oct 2015 07:35:52 +0000 (15:35 +0800)]
sandbox: add a sandbox timer and basic test

Add a sandbox timer which get time from host os and a basic
test.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agocommon/board_f.c: move mark_bootstage after arch_cpu_init_dm
Thomas Chou [Fri, 30 Oct 2015 07:35:51 +0000 (15:35 +0800)]
common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoinput: Allow repeat filtering to be disabled
Simon Glass [Mon, 19 Oct 2015 03:17:25 +0000 (21:17 -0600)]
input: Allow repeat filtering to be disabled

Generally the input library handles processing of a list of scanned keys.
Repeated keys need to be generated based on a timer in this case, since all
that is provided is a list of keys current depressed.

Keyboards which do their own scanning will resend codes when they want to
inject a repeating key. Provide a function which tells the input library to
accept repeating keys and not to try to second-guess the caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoinput: Add a function to add a keycode to the existing set
Simon Glass [Mon, 19 Oct 2015 03:17:24 +0000 (21:17 -0600)]
input: Add a function to add a keycode to the existing set

Most keyboards can be scanned to produce a list of the keycodes which are
depressed. With the i8042 keyboard this scanning is done internally and
only the processed results are returned.

In this case, when a key is pressed, a 'make' code is sent. When the key
is released a 'break' code is sent. This means that the driver needs to
keep track of which keys are pressed. It also means that any protocol error
can lead to stuck keys.

In order to support this type of keyboard, add a function when can be used
to provide a single keycode and either add it to the list of what is pressed
or remove it from the list. Then the normal input_send_keycodes() function
can be used to actually do the decoding work.

Add debugging to display the ASCII characters written to the input queue
also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoinput: Add a few more keyboard keycodes
Simon Glass [Mon, 19 Oct 2015 03:17:23 +0000 (21:17 -0600)]
input: Add a few more keyboard keycodes

The slash and * are missing from the keycode tables. Add these so that
these keypad keys can be used.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoinput: Correct keycode for Ctrl-Y
Simon Glass [Mon, 19 Oct 2015 03:17:22 +0000 (21:17 -0600)]
input: Correct keycode for Ctrl-Y

This code is currently incorrect, perhaps due to a typo. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoi8042: Adjust keyboard init to assume success
Simon Glass [Mon, 19 Oct 2015 03:17:21 +0000 (21:17 -0600)]
i8042: Adjust keyboard init to assume success

Modify i8042_kbd_init() so that the normal pass is sucessful init and
failure exits early. This will make the code easier to extend and is easier
to read.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoi8042: Adjust kbd_reset() to collect all failures
Simon Glass [Mon, 19 Oct 2015 03:17:20 +0000 (21:17 -0600)]
i8042: Adjust kbd_reset() to collect all failures

Rather than lots of 'return' statements, use goto to a single return.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoi8042: Use functions to handle register access
Simon Glass [Mon, 19 Oct 2015 03:17:19 +0000 (21:17 -0600)]
i8042: Use functions to handle register access

At present the register access in kbd_reset() is quite primitive. This makes
it hard to follow.

Create functions to read and write data, both to a single register, and via
the command/data approach.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-on: Intel Crown Bay and QEMU
Tested-by: Bin Meng <bmeng.cn@gmail.com>
8 years agovideo: Drop unused console functions
Simon Glass [Mon, 19 Oct 2015 03:17:18 +0000 (21:17 -0600)]
video: Drop unused console functions

CONFIG_CONSOLE_CURSOR, CONFIG_SYS_CONSOLE_BLINK_COUNT and
CONFIG_CONSOLE_TIME are not used by any board. The implementation is not
great and stands in the way of a refactor of i8042. Drop these for now.
They can be re-introduced quite easily later, perhaps with driver-model
real-time-clock (RTC) support.

When reintroducing, it might be useful to make a few changes:
- Blink time would be more useful than blink count
- The confusing #ifdefs should be avoided
- The time functions should support driver model
- It would be best keyed off console_tstc() or some similar idle loop
    rather than a particular input driver (i8042 in this case)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: cros_ec: Convert cros_ec keyboard driver to driver model
Simon Glass [Mon, 19 Oct 2015 03:17:17 +0000 (21:17 -0600)]
dm: cros_ec: Convert cros_ec keyboard driver to driver model

Adjust the cros_ec keyboard driver to support driver model. Make this the
default for all Exynos boards so that those that use a keyboard will build
correctly with this driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: tegra: Convert keyboard driver to driver model
Simon Glass [Mon, 19 Oct 2015 03:17:16 +0000 (21:17 -0600)]
dm: tegra: Convert keyboard driver to driver model

Adjust the tegra keyboard driver to support driver model, using the new
uclass. Make this the default for all Tegra boards so that those that use
a keyboard will build correctly with this driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: stdio: Plumb in the new keyboard uclass
Simon Glass [Mon, 19 Oct 2015 03:17:15 +0000 (21:17 -0600)]
dm: stdio: Plumb in the new keyboard uclass

When driver model is used for keyboards we must scan the available keyboards
and register them with stdio. Add code to do this.

At some point (once LCD/video is converted) we should be able to convert
stdio to driver model and avoid these dual data structures.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agocros_ec: Use udevice instead of cros_ec_dev for keyboard functions
Simon Glass [Mon, 19 Oct 2015 03:17:14 +0000 (21:17 -0600)]
cros_ec: Use udevice instead of cros_ec_dev for keyboard functions

In preparation for converting the cros_ec keyboard driver to driver model,
adjust the cros_ec functions it will use to use a normal struct udevice.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoinput: Add the keycode translation tables separately
Simon Glass [Mon, 19 Oct 2015 03:17:13 +0000 (21:17 -0600)]
input: Add the keycode translation tables separately

Require the caller to add the keycode translation tables separately so that
it can select which ones to use. In a later patch we will add the option to
add German tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoinput: Return -ENOSPC when there is not space
Simon Glass [Mon, 19 Oct 2015 03:17:12 +0000 (21:17 -0600)]
input: Return -ENOSPC when there is not space

Return a useful error instead of -1 when something goes wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoinput: Add a device pointer to the input config
Simon Glass [Mon, 19 Oct 2015 03:17:11 +0000 (21:17 -0600)]
input: Add a device pointer to the input config

The read_keys() method in input is passed a struct input_config. Add a
device pointer there so that we can find out the device that is referred
to with driver model.

Once all drivers are converted we can update the input structure to use
driver model instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: input: Create a keyboard uclass
Simon Glass [Mon, 19 Oct 2015 03:17:10 +0000 (21:17 -0600)]
dm: input: Create a keyboard uclass

Add a uclass for keyboard input, mirroring the existing stdio methods.
This is enabled by a new CONFIG_DM_KEYBOARD option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agodm: usb: Add support for USB keyboards with driver model
Simon Glass [Tue, 8 Sep 2015 17:15:11 +0000 (11:15 -0600)]
dm: usb: Add support for USB keyboards with driver model

Switch USB keyboards over to use driver model instead of scanning with the
horrible usb_get_dev_index() function. This involves creating a new uclass
for keyboards, although so far there is no API.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Turn on CONFIG_DEBUG_UART_NS16550 in defconfigs
Ariel D'Alessandro [Mon, 16 Nov 2015 11:15:50 +0000 (08:15 -0300)]
rockchip: Turn on CONFIG_DEBUG_UART_NS16550 in defconfigs

No UART driver was specified in defconfig, thus
DEBUG_UART_ALTERA_JTAGUART was incorrectly selected by default since
commit 220e8021af96741bd7149ca9895e1f0c8a38d0bb added a new Altera UART
driver.

Signed-off-by: Ariel D'Alessandro <ariel@vanguardiasur.com.ar>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoMerge branch 'master' of git://git.denx.de/u-boot-spi
Tom Rini [Thu, 19 Nov 2015 18:27:26 +0000 (13:27 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-spi

8 years agoMerge branch 'zynq' of git://www.denx.de/git/u-boot-microblaze
Tom Rini [Thu, 19 Nov 2015 16:25:36 +0000 (11:25 -0500)]
Merge branch 'zynq' of git://denx.de/git/u-boot-microblaze

8 years agoMerge branch 'master' of git://www.denx.de/git/u-boot-microblaze
Tom Rini [Thu, 19 Nov 2015 14:06:44 +0000 (09:06 -0500)]
Merge branch 'master' of git://denx.de/git/u-boot-microblaze

8 years agocommon: mii: Do not allow to exceed max phy limit
Michal Simek [Mon, 19 Oct 2015 13:13:34 +0000 (15:13 +0200)]
common: mii: Do not allow to exceed max phy limit

Phy can have addresses 0-31. Check this boundary to ensure that user
can't call commands on phy address 32 and more.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agozynq: sdhci: Define max clock by macro
Michal Simek [Mon, 28 Sep 2015 23:27:13 +0000 (01:27 +0200)]
zynq: sdhci: Define max clock by macro

zc1571 with silicon can operate on 200MHz maximum frequency. Setup this
frequency by default and fix setting for ep108.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
8 years agonet: zynq: Fix MDC setting for zynq
Michal Simek [Tue, 8 Sep 2015 15:07:01 +0000 (17:07 +0200)]
net: zynq: Fix MDC setting for zynq

Based on spec:
"MDC must not exceed 2.5 MHz (MDC is only active during MDIO read and
write operations)"
Zynq is running on 111MHz. Current setting is 32 which is 111/32=3.47
which is above of 2.5MHz.
Using 48 divider will give us correct setting according spec
(111/48=2.31).

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: zynq: Remove unused MDCCLKDIV2 macro
Michal Simek [Tue, 8 Sep 2015 14:54:39 +0000 (16:54 +0200)]
net: zynq: Remove unused MDCCLKDIV2 macro

Driver cleanup.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: zynq: Fix mdc clock division setting for 100Mbit/s
Michal Simek [Tue, 8 Sep 2015 14:55:42 +0000 (16:55 +0200)]
net: zynq: Fix mdc clock division setting for 100Mbit/s

Using set and clear macro is incorrect because it is not overwritting
origin mdc clock division setup.
For example origin setup is 8(0b001) and new setup is 64(0b100) which
means 0b101 is setup which is 96 divider.
Using writel to rewrite all setting like for 1000Mbit/s case.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: zynq: Wait till packet is sent
Michal Simek [Mon, 17 Aug 2015 07:57:46 +0000 (09:57 +0200)]
net: zynq: Wait till packet is sent

Wait till BD is processed to ensure that packet was sent successfully.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
8 years agonet: zynq: Disable secondary queues
Edgar E. Iglesias [Sat, 26 Sep 2015 06:50:07 +0000 (23:50 -0700)]
net: zynq: Disable secondary queues

Zynq has no priority queues.
ZynqMP has one priority queue and this change is required
to get ethernet working.
This patch was not needed on ep108 for uknown reason even
it should be used.
Tested on Zynq and ZynqMP.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
8 years agonet: zynq: Add dummy packet to fix packet duplication issue
Michal Simek [Mon, 17 Aug 2015 07:58:54 +0000 (09:58 +0200)]
net: zynq: Add dummy packet to fix packet duplication issue

Target is duplicating packets. IP prefetches another BD and process it
when the first one is sent. Adding one dummy BD to the chain fix the
problem with packet duplication.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: zynq: Do not report TX underrun
Michal Simek [Mon, 17 Aug 2015 07:51:34 +0000 (09:51 +0200)]
net: zynq: Do not report TX underrun

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: zynq: Setup BD when structures are filled
Michal Simek [Mon, 17 Aug 2015 07:50:09 +0000 (09:50 +0200)]
net: zynq: Setup BD when structures are filled

Fix incorrect sequence in BD handling.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: zynq: Allocate BD_SPACE in connection to RX_BUF
Michal Simek [Mon, 17 Aug 2015 07:45:53 +0000 (09:45 +0200)]
net: zynq: Allocate BD_SPACE in connection to RX_BUF

BD_SEPRN_SPACE should not have hard coded value and it will be
calculated based on the number of buffer descriptors that we
would like to use.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agodm: sf: Add support for all targets which requires MANUAL_RELOC
Michal Simek [Tue, 27 Oct 2015 12:52:47 +0000 (13:52 +0100)]
dm: sf: Add support for all targets which requires MANUAL_RELOC

It is follow up patch based on
"dm: Add support for all targets which requires MANUAL_RELOC"
(sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)
to update function pointers for DM.

Using post_bind is not ideal but it is one on current option what can be
used. Variable reloc_done has to be used do not call relocation after
every bind. Maybe new core functions should be introduced for this case.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agodm: core: Add missing entries for manual relocation
Michal Simek [Tue, 27 Oct 2015 12:48:08 +0000 (13:48 +0100)]
dm: core: Add missing entries for manual relocation

Patches:
"dm: core: Add a post_bind method for parents"
(sha1: 0118ce79577f9b0881f99a6e4f8a79cd5014cb87)
"dm: core: Add a uclass pre_probe() method for devices"
(sha1: 02c07b3741f1b825934b1a6eb8f23530532dc426)
"dm: core: Allow the uclass to set up a device's child after binding"
(sha1: 081f2fcbd9a95ba10677065359791f8fea3f8c58)
"dm: core: Allow uclass to set up a device's child before it is probed"
(sha1: 83c7e434c9dd3ca81f8b763e23c1881b973bcf2f)

Adds new entries to struct driver and struct uclass_driver without
extending code for manual relocation. This patch fixes it for all
architectures which requires MANUAL_RELOC.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agodm: spi: Add support for all targets which requires MANUAL_RELOC
Michal Simek [Tue, 27 Oct 2015 12:36:42 +0000 (13:36 +0100)]
dm: spi: Add support for all targets which requires MANUAL_RELOC

It is follow up patch based on
"dm: Add support for all targets which requires MANUAL_RELOC"
(sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)
to update function pointers for DM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agomicroblaze: Fix C99/gnu99 compatiblity for inline functions
Nathan Rossi [Fri, 6 Nov 2015 09:25:06 +0000 (19:25 +1000)]
microblaze: Fix C99/gnu99 compatiblity for inline functions

'extern inline' is not portable across various C standards. To ensure
compatiblity with various standards/compilers change the functions to
static inline. This is a portable construct and serves as a comparable
definition to 'extern inline' from the gnu90 standard.

Additionally remove the function prototypes as they are not required due
to the functions being declared static and functions are correctly
ordered based on dependence.

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Tom Rini <trini@konsulko.com>
Acked-by: Mans Rullgard <mans@mansr.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
8 years agomicroblaze: Fix style issues in header files
Nathan Rossi [Fri, 6 Nov 2015 09:25:05 +0000 (19:25 +1000)]
microblaze: Fix style issues in header files

Fix various style issues in MicroBlaze header files. Specifically fixing
style voilations including '__inline__', 'foo * bar' and 'void foo ('.

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Tom Rini <trini@konsulko.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
8 years agonet: zynq: Fix clearing statistic
Michal Simek [Mon, 5 Oct 2015 10:49:48 +0000 (12:49 +0200)]
net: zynq: Fix clearing statistic

Previous loop was completely bogus. Iterration should go just over
statistic counters.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: zynq: Extend register description with offsets
Michal Simek [Mon, 5 Oct 2015 09:49:43 +0000 (11:49 +0200)]
net: zynq: Extend register description with offsets

Extend comments with register offset to help with debuggging.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: zynq: Add support for different PHY interface types
Michal Simek [Wed, 7 Oct 2015 14:42:56 +0000 (16:42 +0200)]
net: zynq: Add support for different PHY interface types

MII is setup by default for all cases. The most of boards are using
RGMII but PHY drivers are not doing any specific setting that's why MII
setting was working fine. With TI DP83867 is necessary to setup
paramaters based on interface type.

Use one setting per board for it which is something what will be removed
when driver is moved to DM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agonet: zynq: Add debug message to phyread/phywrite
Michal Simek [Wed, 7 Oct 2015 14:34:51 +0000 (16:34 +0200)]
net: zynq: Add debug message to phyread/phywrite

Add debug messages to phyread/write to help with PHY debug.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agoARM: zynq: Add target for building bootable SPL image for Zynq
Nathan Rossi [Tue, 17 Nov 2015 12:56:57 +0000 (22:56 +1000)]
ARM: zynq: Add target for building bootable SPL image for Zynq

Add a build target to generate 'boot.bin' which includes SPL. This is
used by the platforms BootROM to load SPL directly.

This change also conditionally changes what the 'boot.bin' target
generates depending on the SoC. Leaving the behaviour unchanged for the
AT91 targets.

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Andreas Bießmann <andreas.devel@googlemail.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agotools: zynqimage: Add Xilinx Zynq boot header generation to mkimage
Nathan Rossi [Tue, 17 Nov 2015 12:56:56 +0000 (22:56 +1000)]
tools: zynqimage: Add Xilinx Zynq boot header generation to mkimage

As with other platforms vendors love to create their own boot header
formats. Xilinx is no different and for the Zynq platform/SoC there
exists the "boot.bin" which is read by the platforms bootrom. This
format is described to a useful extent within the Xilinx Zynq TRM.

This implementation adds support for the 'zynqimage' to mkimage. The
implementation only considers the most common boot header which is
un-encrypted and packed directly after the boot header itself (no
XIP, etc.). However this implementation does take into consideration the
other fields of the header for image dumping use cases (vector table and
register initialization).

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
8 years agoARM64: zynqmp: Enable TI phy by default
Michal Simek [Tue, 10 Nov 2015 09:48:05 +0000 (10:48 +0100)]
ARM64: zynqmp: Enable TI phy by default

Enable TI phy for Xilinx ZynqMP platform.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
8 years agonet: phy: Add support for Texas Instruments DP83867
Edgar E. Iglesias [Sat, 26 Sep 2015 06:46:08 +0000 (23:46 -0700)]
net: phy: Add support for Texas Instruments DP83867

Code is taken from Linux kernel driver (v4.2).

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agoARM: zynq: Choose boot image based on OF_SEPARATE macro
Michal Simek [Mon, 9 Nov 2015 09:39:44 +0000 (10:39 +0100)]
ARM: zynq: Choose boot image based on OF_SEPARATE macro

OF_CONTROL is enabled by default for all Zynq boards.
The difference between two boot images is done by OF_SEPARATE
or OF_EMBED macros.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agozynqmp: mp: Add support for booting R5 from any address
Michal Simek [Fri, 22 May 2015 11:28:23 +0000 (13:28 +0200)]
zynqmp: mp: Add support for booting R5 from any address

Put jump trampoline to TCM at 0 and setup R5 reset address to 0.
Jump trampoline ensures that jump to the right location.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
8 years agoenv_ubi.c: Correct pointer error in env load
Kevin Smith [Fri, 23 Oct 2015 17:51:47 +0000 (17:51 +0000)]
env_ubi.c: Correct pointer error in env load

The variable "buf" in this function is a char array, and the
function ubi_volume_read is expecting a char *.  In the call, the
address of the pointer is being taken, incorrectly passing a
char **.  The compiler warning was being silenced by the cast.
Remove the address operator and the cast.

Signed-off-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Heiko Schocher <hs@denx.de>