oweals/u-boot.git
9 years agoi2c, avr32: fix compiler warning "input is not relaxable"
Heiko Schocher [Tue, 17 Nov 2015 11:22:53 +0000 (12:22 +0100)]
i2c, avr32: fix compiler warning "input is not relaxable"

compiling U-Boot for avr32 boards shows since
commit 3d1957f0ea01 "dm: i2c: Add support for multiplexed I2C buses"
this warning:

Building current source for 4 boards (4 threads, 8 jobs per thread)
     avr32:  +   atstk1002
+(atstk1002) drivers/i2c/built-in.o: warning: input is not relaxable
     avr32:  +   grasshopper
+(grasshopper) drivers/i2c/built-in.o: warning: input is not relaxable
     avr32:  +   atngw100
+(atngw100) drivers/i2c/built-in.o: warning: input is not relaxable
     avr32:  +   atngw100mkii
+(atngw100mkii) drivers/i2c/built-in.o: warning: input is not relaxable
    0    4    0 /4      0:00:16  : atngw100mkii

Fix it.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Roger Meier <r.meier@siemens.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
9 years agosunxi: Update new defconfigs
Tom Rini [Sun, 22 Nov 2015 15:46:25 +0000 (10:46 -0500)]
sunxi: Update new defconfigs

After introduction of CONFIG_SYS_NS16550 these defconfig files were
added and need to be updated.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 years agoMerge branch 'master' of http://git.denx.de/u-boot-sunxi
Tom Rini [Sun, 22 Nov 2015 13:20:03 +0000 (08:20 -0500)]
Merge branch 'master' of git.denx.de/u-boot-sunxi

9 years agosunxi: Add support for the Lamobo R1 board
Jelle de Jong [Sun, 18 Oct 2015 14:34:13 +0000 (16:34 +0200)]
sunxi: Add support for the Lamobo R1 board

The lamobo-r1 board, sometimes called the BPI-R1 but not labelled as such
on the PCB, is meant as a A20 based router board. As such the board comes
with a built-in switch chip giving it 5 gigabit ethernet ports, and it
has a large empty area on the pcb with mounting holes which will fit a
2.5 inch harddisk. To complete its networking features it has a
Realtek RTL8192CU for WiFi 802.11 b/g/n.

The dts file is identical to the one submitted upstream.

Signed-off-by: Jelle de Jong <jelledejong@powercraft.nl>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosunxi: Add support for Orangepi Plus and Orangepi PC boards
Hans de Goede [Fri, 20 Nov 2015 15:19:51 +0000 (16:19 +0100)]
sunxi: Add support for Orangepi Plus and Orangepi PC boards

Add defconfig files for the Orangepi Plus and Orangepi PC.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosunxi: Add H3 dts[i] files
Hans de Goede [Fri, 20 Nov 2015 15:03:56 +0000 (16:03 +0100)]
sunxi: Add H3 dts[i] files

These files are based on the current latest upstream kernel work. The
bus_gates bindings may still change, but for u-boot that does not matter
as we do not (yet) use any clock info from devicetree for sunxi u-boot.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosunxi: clock: Set AHB1 clock frequency to 200MHz on Allwinner H3
Siarhei Siamashka [Fri, 20 Nov 2015 05:07:48 +0000 (07:07 +0200)]
sunxi: clock: Set AHB1 clock frequency to 200MHz on Allwinner H3

The 3.4 kernel from the Allwinner SDK is clocking AHB1 at 200MHz
on Allwinner H3 and using PLL6 as the clock source (PLL6/3).
This can be verified by reading the value of the AHB1_APB1_CFG_REG
register via /dev/mem. It always reads as 0x3180 regardless of
the current cpufreq operating point. So this configuration should
be safe for use in U-Boot too.

PLL6 also needs to be configured before it is used as the clock
source, according to the "CCU / Programming Guidelines" section
of the Allwinner manual.

The current low AHB1 clock speed is limiting the USB transfer
speed when booting via FEL. This patch can increase the FEL USB
transfer speed from ~510 KB/s to ~950 KB/s.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosunxi: Add H3 DRAM initialization support
Jens Kuske [Tue, 17 Nov 2015 14:12:59 +0000 (15:12 +0100)]
sunxi: Add H3 DRAM initialization support

Based on existing A23/A33 code and the original H3 boot0.

Signed-off-by: Jens Kuske <jenskuske@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosunxi: Add basic H3 support
Jens Kuske [Tue, 17 Nov 2015 14:12:58 +0000 (15:12 +0100)]
sunxi: Add basic H3 support

Add initial sun8i H3 support, only uart + mmc are supported for now.

Signed-off-by: Jens Kuske <jenskuske@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosunxi: musb: Implement dfu_usb_get_reset()
Siarhei Siamashka [Sun, 25 Oct 2015 04:44:47 +0000 (06:44 +0200)]
sunxi: musb: Implement dfu_usb_get_reset()

This is necessary to distinguish between the "dfu-util --detach" and
the "dfu-util --reset" requests.

The default weak implementation of dfu_usb_get_reset() unconditionally
reboots the device, but we want to be able to continue the boot.scr
execution after writing the kernel, fdt and ramdisk to RAM via DFU.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosunxi: Enable DFU for RAM
Siarhei Siamashka [Sun, 25 Oct 2015 04:44:46 +0000 (06:44 +0200)]
sunxi: Enable DFU for RAM

The DFU protocol implementation in U-Boot is much faster than the
FEL protocol implementation in the boot ROM on Allwinner devices.
Using DFU instead of FEL improves the USB transfer speed from
500-900 KB/s to 3.2-3.7 MB/s. This is particularly useful for
reducing the time needed for booting systems with large initrd
images.

FEL is still useful for loading the U-Boot bootloader and a boot
script, which may then activate DFU in the following way:

   setenv dfu_alt_info ${dfu_alt_info_ram}
   dfu 0 ram 0
   bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}

The rest of the files can be transferred to the device using the
"dfu-util" tool.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agovexpress64: store env in flash
Ryan Harkin [Wed, 18 Nov 2015 10:39:09 +0000 (10:39 +0000)]
vexpress64: store env in flash

Add support for storing the environment in CFI NOR flash on Juno and FVP
models.

I also removed some config values that are not used by CFI flash parts.

Juno has 1 flash part with 259 sectors.  The first 255 sectors are
0x40000 (256kb) and are followed by 4 sectors of 0x10000 (64KB).

FVP models simulate a 64MB NOR flash part at base address 0x0FFC0000.
This part has 256 x 256kb sectors.  We use the last sector to store the
environment.

To save the NOR flash to a file, the following parameters should be
passed to the model:

    -C bp.flashloader1.fname=${FILENAME}
    -C bp.flashloader1.fnameWrite=${FILENAME}

Foundation models don't simulate the NOR flash, but having NOR support
in the u-boot binary does not harm:  attempting to write to the NOR will
fail gracefully.

Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
9 years agovexpress64: remove #error
Ryan Harkin [Wed, 18 Nov 2015 10:39:08 +0000 (10:39 +0000)]
vexpress64: remove #error

This patch allows vexpress64 targets to be compiled when
CONFIG_SYS_FLASH_CFI is enabled.

I considered using #warning instead of #error, but this just clutters up
the build output and hides real warnings.

Without this patch, you see errors during compilation like this:

include/configs/vexpress_aemv8a.h:42:2: error: #error "Unknown board
variant"
 #error "Unknown board variant"
include/configs/vexpress_aemv8a.h:115:2: error: #error "Unknown board
variant"
 #error "Unknown board variant"
include/configs/vexpress_aemv8a.h:280:2: error: #error "Unknown board
variant"
 #error "Unknown board variant"
make[1]: *** [tools/envcrc.o] Error 1
make: *** [tools] Error 2
In file included from include/config.h:5:0,
                 from tools/envcrc.c:19:

Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
9 years agovexpress64: use 2nd DRAM bank only on juno
Ryan Harkin [Wed, 18 Nov 2015 10:39:07 +0000 (10:39 +0000)]
vexpress64: use 2nd DRAM bank only on juno

This patch makes the 2nd DRAM bank available on Juno only and not on
other vexpress64 targets, eg. the FVP models.

The commit below added a 2nd bank of NOR flash for Juno, but also for
all vexpress64 targets:

    commit 2d0cee1ca2b9d977fa3214896bb2e30cfec77059
    Author: Liviu Dudau <Liviu.Dudau@foss.arm.com>
    Date:   Mon Oct 19 11:08:31 2015 +0100

    vexpress64: Juno: Declare all 8GB of RAM and make them visible to the kernel.

    Juno comes with 8GB RAM, but U-Boot only passes 2GB to the kernel.
    Declare a secondary memory bank and set the sizes correctly.

Signed-off-by: Liviu Dudau <Liviu.Dudau@foss.arm.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Ryan Harkin <ryan.harkin@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Unfortunately, I only fully tested on Juno R0, R1 and the FVP Foundation
model.  Whilst FVP Base AEMV8 models run U-Boot OK, they fail to boot
the kernel.

Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Acked-by: Liviu Dudau <liviu.dudau@foss.arm.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
9 years agovexpress64: compile Juno PCIe conditionally
Ryan Harkin [Wed, 18 Nov 2015 10:39:06 +0000 (10:39 +0000)]
vexpress64: compile Juno PCIe conditionally

Only compile in PCIe support if the board really uses it. Provide
a __weak stub for the init function if e.g. FVP is being built.

Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
9 years agoJuno: don't print PCI debug information by default
Andre Przywara [Fri, 13 Nov 2015 11:25:46 +0000 (11:25 +0000)]
Juno: don't print PCI debug information by default

On a Juno r1 the PCI controller init routine outputs the rather boring
ATR entry information.
Do this only with DEBUG defined to avoid cluttering the user's
terminal.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Ryan Harkin <ryan.harkin@linaro.org>
9 years agoeeprom: Clean up checkpatch issues
Marek Vasut [Tue, 10 Nov 2015 19:53:33 +0000 (20:53 +0100)]
eeprom: Clean up checkpatch issues

Cosmetic fixes to the file, make it checkpatch clean.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Add support for selecting i2c bus
Marek Vasut [Tue, 10 Nov 2015 19:53:32 +0000 (20:53 +0100)]
eeprom: Add support for selecting i2c bus

Add additional parameter into the eeprom command to select
the I2C bus on which the eeprom resides.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Add bus argument to eeprom_init()
Marek Vasut [Tue, 10 Nov 2015 19:53:31 +0000 (20:53 +0100)]
eeprom: Add bus argument to eeprom_init()

Add bus argument to eeprom_init(), so that it can select
the I2C bus number on which the eeprom resides. Any negative
value of the $bus argument will preserve the old behavior.
This is in place so that old code does not randomly break.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
[trini: Wrap i2c_set_bus_num() call with CONFIG_SYS_I2C test]
Signed-off-by: Tom Rini <trini@konsulko.com>
9 years agoeeprom: Pull out the RW loop
Marek Vasut [Tue, 10 Nov 2015 19:53:30 +0000 (20:53 +0100)]
eeprom: Pull out the RW loop

Unify the code for doing read/write into single function, since the
code for both the read and write is almost identical. This again
trims down the code duplication.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Pull out transfer length computation
Marek Vasut [Tue, 10 Nov 2015 19:53:29 +0000 (20:53 +0100)]
eeprom: Pull out transfer length computation

Pull out the code which computes the length of the transfer
into separate code and clean it up a little. This again trims
down the code duplication.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Pull out CONFIG_SYS_EEPROM_PAGE_WRITE_BITS
Marek Vasut [Tue, 10 Nov 2015 19:53:28 +0000 (20:53 +0100)]
eeprom: Pull out CONFIG_SYS_EEPROM_PAGE_WRITE_BITS

Implement default value of 8 for this macro and pull out all of
this macro out of the code. The default value of 8 actually does
implement exactly the same behavior as the previous code which
was in the #else clause of the ifdef.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Suck the ifdef into eeprom_init()
Marek Vasut [Tue, 10 Nov 2015 19:53:27 +0000 (20:53 +0100)]
eeprom: Suck the ifdef into eeprom_init()

Just suck the ugly ifdef around eeprom_init() call into eeprom_init()
function itself. This puts all of the ifdef mess into one place.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Pull out CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
Marek Vasut [Tue, 10 Nov 2015 19:53:26 +0000 (20:53 +0100)]
eeprom: Pull out CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS

Pull this macro to the beginning of the cmd_eeprom.c and remove
another nasty ifdef from the code. Note that this is legal, since
udelay(0) changes the behavior only such that it pings the WDT if
WDT is enabled and otherwise does not wait.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Make eeprom_write_enable() weak
Marek Vasut [Tue, 10 Nov 2015 19:53:25 +0000 (20:53 +0100)]
eeprom: Make eeprom_write_enable() weak

Make this function weak and implement it's weak implementation
so that the boards can just reimplement it. This zaps the horrid
CONFIG_SYS_EEPROM_WREN macro.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Pull out address computation
Marek Vasut [Tue, 10 Nov 2015 19:53:24 +0000 (20:53 +0100)]
eeprom: Pull out address computation

Pull out the code computing the EEPROM address into separate function
so that it's not duplicated.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Pull out the I/O code
Marek Vasut [Tue, 10 Nov 2015 19:53:23 +0000 (20:53 +0100)]
eeprom: Pull out the I/O code

Pull out the code which does the I2C or SPI read/write, so that
the beefy ifdef around it is contained in a single function.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Zap CONFIG_SPI_X
Marek Vasut [Tue, 10 Nov 2015 19:53:22 +0000 (20:53 +0100)]
eeprom: Zap CONFIG_SPI_X

This macro is no longer used, so just reap it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Zap eeprom_probe()
Marek Vasut [Tue, 10 Nov 2015 19:53:21 +0000 (20:53 +0100)]
eeprom: Zap eeprom_probe()

Remove this function as it's no longer used.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Zap CONFIG_SYS_EEPROM_X40430
Marek Vasut [Tue, 10 Nov 2015 19:53:20 +0000 (20:53 +0100)]
eeprom: Zap CONFIG_SYS_EEPROM_X40430

Now that the only user of CONFIG_SYS_EEPROM_X40430 was removed,
remove this unused code from cmd_eeprom.c

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Zap CONFIG_SYS_I2C_MULTI_EEPROMS
Marek Vasut [Tue, 10 Nov 2015 19:53:19 +0000 (20:53 +0100)]
eeprom: Zap CONFIG_SYS_I2C_MULTI_EEPROMS

This option only complicates the code unnecessarily, just use
CONFIG_SYS_DEF_EEPROM_ADDR as the default address if there are
only five arguments to eeprom {read/write} if this is defined.
If CONFIG_SYS_DEF_EEPROM_ADDR is not defined, we mandate all
six arguments.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoeeprom: Shuffle code around
Marek Vasut [Tue, 10 Nov 2015 19:53:18 +0000 (20:53 +0100)]
eeprom: Shuffle code around

Just move the code around so that the forward declarations are not
necessary. Also zap a few checkpatch issues where applicable and
zap the use of #ifdef CONFIG_CMD_EEPROM in the code, since this is
always true.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agotricorder: rewrite tricordereeprom command
Andreas Bießmann [Tue, 10 Nov 2015 19:53:17 +0000 (20:53 +0100)]
tricorder: rewrite tricordereeprom command

This rewrite uses lately promoted eeprom_init(int) function to choose the
right I2C bus when writing data to the EEPROM.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
9 years agoARM: keystone2: configs: Correct burn_uboot_sp erase size
Cooper Jr., Franklin [Thu, 19 Nov 2015 13:45:22 +0000 (07:45 -0600)]
ARM: keystone2: configs: Correct burn_uboot_sp erase size

The NOR flash on Keystone 2 evms has a u-boot-spl partition size of
0x80000.

Currently burn_uboot_spi will erase 0x100000 from the spi NOR which will
cause a partial erase of the misc partition.

Fix this by correcting the erase size.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
9 years agoARM: dra7x/am57x: Remove pin input/output config from WAKEUP pins
Cooper Jr., Franklin [Thu, 19 Nov 2015 14:03:54 +0000 (08:03 -0600)]
ARM: dra7x/am57x: Remove pin input/output config from WAKEUP pins

The WAKEUP_X pins are always an input no matter the pinmux mode.
However, the 18th bit that typical configures a pin as an input is
considered reserved for the WAKEUP_X pins. Therefore, for any WAKEUP
pin remove any configuration that sets that pin as an input. Since
those pins are only inputs remove any output configuration from those
pins.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
9 years agonios2: 10m50: change to ns16550 uart
Thomas Chou [Thu, 19 Nov 2015 13:48:15 +0000 (21:48 +0800)]
nios2: 10m50: change to ns16550 uart

Change to ns16550 uart for 10m50 devboard based on a new
Altera release.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agons16550: move CONFIG_SYS_NS16550 to Kconfig
Thomas Chou [Thu, 19 Nov 2015 13:48:14 +0000 (21:48 +0800)]
ns16550: move CONFIG_SYS_NS16550 to Kconfig

Move CONFIG_SYS_NS16550 to Kconfig, and run moveconfig.py.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
9 years agons16550: zap CONFIG_NS16550_SERIAL
Thomas Chou [Thu, 19 Nov 2015 13:48:13 +0000 (21:48 +0800)]
ns16550: zap CONFIG_NS16550_SERIAL

Zap CONFIG_NS16550_SERIAL, as the unification of ns16550 drivers
is completed.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agons16550: unify serial_omap
Thomas Chou [Thu, 19 Nov 2015 13:48:12 +0000 (21:48 +0800)]
ns16550: unify serial_omap

Unify serial_omap, and use the generic binding.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agons16550: unify serial_tegra
Thomas Chou [Thu, 19 Nov 2015 13:48:11 +0000 (21:48 +0800)]
ns16550: unify serial_tegra

Unify serial_tegra, and use the generic binding.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agons16550: unify serial_dw
Thomas Chou [Thu, 19 Nov 2015 13:48:10 +0000 (21:48 +0800)]
ns16550: unify serial_dw

Unify serial_dw, and use the generic binding.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agons16550: unify serial_keystone
Thomas Chou [Thu, 19 Nov 2015 13:48:09 +0000 (21:48 +0800)]
ns16550: unify serial_keystone

Unify serial_keystone, and use the generic binding.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agons16550: unify serial_rockchip
Thomas Chou [Thu, 19 Nov 2015 13:48:08 +0000 (21:48 +0800)]
ns16550: unify serial_rockchip

Unify serial_rockchip, and use the generic binding.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Ariel D'Alessandro <ariel@vanguardiasur.com.ar>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agons16550: unify serial_ppc
Thomas Chou [Thu, 19 Nov 2015 13:48:07 +0000 (21:48 +0800)]
ns16550: unify serial_ppc

Unify serial_ppc, and use the generic binding.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Add TODO comment]
Signed-off-by: Tom Rini <trini@konsulko.com>
9 years agons16550: unify serial_x86
Thomas Chou [Thu, 19 Nov 2015 13:48:06 +0000 (21:48 +0800)]
ns16550: unify serial_x86

Unify serial_x86, and use the generic binding.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agons16550: add generic binding to unify the drivers
Thomas Chou [Thu, 19 Nov 2015 13:48:05 +0000 (21:48 +0800)]
ns16550: add generic binding to unify the drivers

Add generic binding to unify ns16550 drivers. There are
several drivers using almost the same code, such as serial_dw,
serial_keystone, serial_omap, serial_ppc, serial_rockchip,
serial_tegra.c, and serial_x86. But each is platform specific.

The key difference between these drivers is the way to get
input clock frequency. With this unified approach, fixed clock
frequency should be extracted from "clock-frequency" property of
device tree blob. If this property is not available, the macro
CONFIG_SYS_NS16550_CLK will be used. It can be a constant or a
function to get clock, eg, get_serial_clock().

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agons16550: change map_sysmem to map_physmem
Thomas Chou [Thu, 19 Nov 2015 13:48:04 +0000 (21:48 +0800)]
ns16550: change map_sysmem to map_physmem

Change map_sysmem() to map_physmem(,,MAP_NOCACHE). Though map_sysmem()
can be used to map system memory, it might be wrong to use it for I/O
ports.  The map_physmem() serves the same purpose to translate physical
address to virtual address with the additional flag to take care of cache
property. Most drivers use map_physmem() since I/O ports access should be
uncached. As ns16550 is a driver, it should use map_physmem() rather
than map_sysmem().

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodebug_uart: restore ns16550 as default
Thomas Chou [Thu, 19 Nov 2015 13:48:03 +0000 (21:48 +0800)]
debug_uart: restore ns16550 as default

Since commit 220e8021af96 ("nios2: convert altera_jtag_uart to
driver model"), the default debug uart was changed. Most people
use ns16550 UART, so restore it as default.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reported-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Reported-by: Ariel D'Alessandro <ariel@vanguardiasur.com.ar>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>