]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
8 years agodm: power: Allow regulators to not implement all operations
Simon Glass [Fri, 22 Jan 2016 02:43:59 +0000 (19:43 -0700)]
dm: power: Allow regulators to not implement all operations

Some regulators will not implement any operations (e.g. fixed regulators).
This is not an error, so allow the autoset process to continue when one
of these regulators is found.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: power: Tidy up debugging output and return values
Simon Glass [Fri, 22 Jan 2016 02:43:58 +0000 (19:43 -0700)]
dm: power: Tidy up debugging output and return values

The currect PMIC debugging is a little confusing. Adjust it so that it is
clear whether the operation succeeded or failed. Also, avoid creating a new
error return value when a perfectly good one is already available.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: core: Export uclass_find_device_by_of_offset()
Simon Glass [Fri, 22 Jan 2016 02:43:57 +0000 (19:43 -0700)]
dm: core: Export uclass_find_device_by_of_offset()

It is sometimes useful to be able to find a device before probing it,
perhaps to set up some platform data for it. Allow finding by of_offset
also.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: pinctrl: Add a way for a GPIO driver to obtain a pin function
Simon Glass [Fri, 22 Jan 2016 02:43:56 +0000 (19:43 -0700)]
dm: pinctrl: Add a way for a GPIO driver to obtain a pin function

GPIO drivers want to be able to show if a pin is enabled for input, output,
or is being used by another function. Some drivers can easily find this
and the code is included in the driver. For some SoCs this is more complex.
Conceptually this should be handled by pinctrl rather than GPIO. Most
pinctrl drivers will have this feature anyway.

Add a method by which a GPIO driver can obtain the pin mux value given a
GPIO reference. This avoids repeating the code in two places.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: power: Allow regulators to be omitted from SPL
Simon Glass [Fri, 22 Jan 2016 02:43:55 +0000 (19:43 -0700)]
dm: power: Allow regulators to be omitted from SPL

For some boards the pmic interface is useful but the regulator interface
(which comes with it) is too large. Allow them to be separated such that
SPL can decide which it needs.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agospi: Correct device tree usage in spi_flash_decode_fdt()
Simon Glass [Fri, 22 Jan 2016 02:43:54 +0000 (19:43 -0700)]
spi: Correct device tree usage in spi_flash_decode_fdt()

This function currently searches the entire device tree for a node that
it thinks is relevant. But the node is known and is passed in. Correct the
code and enable it only with driver model, since only driver-model boards
will use it.

This avoids bringing in a large number of strings from fdtdec.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: i2c: Allow muxes to be enabled for SPL separately
Simon Glass [Fri, 22 Jan 2016 02:43:53 +0000 (19:43 -0700)]
dm: i2c: Allow muxes to be enabled for SPL separately

Since I2C muxes are seldom needed in SPL, and the code for this increases
the size somewhat, add a separate option to enable I2C muxes for SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agocros_ec: Disable the Chrome OS EC in SPL
Simon Glass [Fri, 22 Jan 2016 02:43:52 +0000 (19:43 -0700)]
cros_ec: Disable the Chrome OS EC in SPL

This is not used in SPL so don't allow it to be built there, even if I2C
is enabled in SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agogpio: Allow 's' as an abbreviation for 'status'
Simon Glass [Fri, 22 Jan 2016 02:43:51 +0000 (19:43 -0700)]
gpio: Allow 's' as an abbreviation for 'status'

The 'gpio' command allows abbreviations for most subcommands. Allow them
for 'status' also.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: jerry: Drop unused options
Simon Glass [Fri, 22 Jan 2016 02:43:50 +0000 (19:43 -0700)]
rockchip: jerry: Drop unused options

To reduce the SPL image size, drop the LED features. Jerry does not have
an LED and we can leave out GPIO support also.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Disable simple-bus in SPL for firefly-rk3288, jerry
Simon Glass [Fri, 22 Jan 2016 02:43:49 +0000 (19:43 -0700)]
rockchip: Disable simple-bus in SPL for firefly-rk3288, jerry

This is not needed for booting, so drop it from SPL to save about 300 bytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: jerry: Enable the RK808 PMIC and regulator
Simon Glass [Fri, 22 Jan 2016 02:43:48 +0000 (19:43 -0700)]
rockchip: jerry: Enable the RK808 PMIC and regulator

Enable this PMIC and regulator, which is used on jerry.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Move firefly and jerry to use the full pinctrl
Simon Glass [Fri, 22 Jan 2016 02:43:47 +0000 (19:43 -0700)]
rockchip: Move firefly and jerry to use the full pinctrl

Use the full pinctrl driver in U-Boot proper.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: pinctrl: Add a full pinctrl driver
Simon Glass [Fri, 22 Jan 2016 02:43:46 +0000 (19:43 -0700)]
rockchip: pinctrl: Add a full pinctrl driver

We can make use of the device tree to configure pinctrl settings. Add this
support for the driver so we can use it in U-Boot proper.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: mmc: Update the driver to use the new clock ID
Simon Glass [Fri, 22 Jan 2016 02:43:45 +0000 (19:43 -0700)]
rockchip: mmc: Update the driver to use the new clock ID

We can use the new clk_get_by_index() function to get the correct clock.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: spi: Avoid setting the pinctrl twice
Simon Glass [Fri, 22 Jan 2016 02:43:44 +0000 (19:43 -0700)]
rockchip: spi: Avoid setting the pinctrl twice

If full pinctrl is enabled we don't need to manually set the pinctrl in the
driver. It will happen automatically. Adjust the code to suit - we will
still use manual mode in SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: spi: Update the driver to use the new clock ID
Simon Glass [Fri, 22 Jan 2016 02:43:43 +0000 (19:43 -0700)]
rockchip: spi: Update the driver to use the new clock ID

We can use the new clk_get_by_index() function to get the correct clock.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: i2c: Update the driver to use the new clock ID
Simon Glass [Fri, 22 Jan 2016 02:43:42 +0000 (19:43 -0700)]
rockchip: i2c: Update the driver to use the new clock ID

We can use the new clk_get_by_index() function to get the correct clock.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: clock: Add a function to find a clock by ID
Simon Glass [Fri, 22 Jan 2016 02:43:41 +0000 (19:43 -0700)]
rockchip: clock: Add a function to find a clock by ID

The current approach of using uclass_get_device() is error-prone. Another
clock (for example a fixed-clock) may cause it to break. Add a function that
does a proper search.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: clk: Add a function to get a peripheral clock rate
Simon Glass [Fri, 22 Jan 2016 02:43:40 +0000 (19:43 -0700)]
rockchip: clk: Add a function to get a peripheral clock rate

It is useful to be able to read the rate of a peripheral clock. Add a
handler for that.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: clock: Rename the general clock variable to gclk_rate
Simon Glass [Fri, 22 Jan 2016 02:43:39 +0000 (19:43 -0700)]
rockchip: clock: Rename the general clock variable to gclk_rate

The current name is confusing and a bit verbose. Rename it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Use a separate clock ID for clocks
Simon Glass [Fri, 22 Jan 2016 02:43:38 +0000 (19:43 -0700)]
rockchip: Use a separate clock ID for clocks

At present we use the same peripheral ID for clocks and pinctrl. While this
works it is probably better to use the device tree clock binding ID for
clocks. We can use the clk_get_by_index() function to find this.

Update the clock drivers and the code that uses them.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: jerry: Disable pmic-int-1 setup to avoid a hang
Simon Glass [Fri, 22 Jan 2016 02:43:37 +0000 (19:43 -0700)]
rockchip: jerry: Disable pmic-int-1 setup to avoid a hang

This hangs when activated (by probing the PMIC). Disable it for now until we
understand the root cause.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Use pwrseq for MMC start-up on jerry
Simon Glass [Fri, 22 Jan 2016 02:43:36 +0000 (19:43 -0700)]
rockchip: Use pwrseq for MMC start-up on jerry

This is defined in the device tree in Linux. Copy over the settings so that
this can be used instead of hard-coding the reset line.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Correct the defconfig order
Simon Glass [Fri, 22 Jan 2016 02:43:35 +0000 (19:43 -0700)]
rockchip: Correct the defconfig order

This has got out of sequence somehow. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: mmc: Use a pwrseq device if available
Simon Glass [Fri, 22 Jan 2016 02:43:34 +0000 (19:43 -0700)]
rockchip: mmc: Use a pwrseq device if available

Use the pwrseq uclass to find a suitable power sequence for the MMC device.
If this is enabled in the device tree, we will pick it up automatically.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Convert the PMU IOMUX registers into an array
Simon Glass [Fri, 22 Jan 2016 02:43:33 +0000 (19:43 -0700)]
rockchip: Convert the PMU IOMUX registers into an array

This is easier to deal with when using generic code since it allows us to
use a register index instead of naming each register.

Adjust it, adding an enum to improve readability.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Avoid using MMC code when not booting from MMC
Simon Glass [Fri, 22 Jan 2016 02:43:32 +0000 (19:43 -0700)]
rockchip: Avoid using MMC code when not booting from MMC

This saves some code space in SPL which is useful on jerry.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: Add a power sequencing uclass
Simon Glass [Fri, 22 Jan 2016 02:43:31 +0000 (19:43 -0700)]
dm: Add a power sequencing uclass

Some devices need special sequences to be used when starting up. Add a
uclass for this. Drivers can be added to provide specific features as
needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agopower: Add support for RK808 regulators
Simon Glass [Fri, 22 Jan 2016 02:43:30 +0000 (19:43 -0700)]
power: Add support for RK808 regulators

Add regulator support for the RK808 PMIC. It integrated 4 BUCKs and 8 LDOs
all of which are supported by this driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agopower: Add base support for the RK808 PMIC
Simon Glass [Fri, 22 Jan 2016 02:43:29 +0000 (19:43 -0700)]
power: Add base support for the RK808 PMIC

This Rockchip PMIC provides features suitable for battery-powered
applications. It is commonly used with Rockchip SoCs.

Add a driver which provides register access. The regulator driver will use
this.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodts: Bring in pinctrl device tree binding
Simon Glass [Fri, 22 Jan 2016 02:43:28 +0000 (19:43 -0700)]
dts: Bring in pinctrl device tree binding

Add this binding file since we now use it in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: pmic: Add 'reg status' to show all regulators
Simon Glass [Fri, 22 Jan 2016 02:43:27 +0000 (19:43 -0700)]
dm: pmic: Add 'reg status' to show all regulators

It is convenient to be able to see the status of all regulators in a list.
Add this feature to the 'reg status' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: pinctrl: Add a function to parse PIN_CONFIG flags
Simon Glass [Fri, 22 Jan 2016 02:43:26 +0000 (19:43 -0700)]
dm: pinctrl: Add a function to parse PIN_CONFIG flags

Add a function which produces a flags word from a few common PIN_CONFIG
settings. This is useful for simple pinctrl drivers that don't need to worry
about drive strength, etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: core: Don't set pinctrl for pinctrl devices
Simon Glass [Fri, 22 Jan 2016 02:43:25 +0000 (19:43 -0700)]
dm: core: Don't set pinctrl for pinctrl devices

There is sort-of race condition when a pinctrl device is probed. The pinctrl
function is called which may end up using the same device as is being
probed. This results in operations being used before the device is actually
probed.

For now, disallow pinctrl operations on pinctrl devices while probing. An
alternative solution would be to move the operation to later in the
device_probe() function (for pinctrl devices only) but this needs more
thought.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: kylin: Store env in emmc
Jeffy Chen [Thu, 14 Jan 2016 02:19:41 +0000 (10:19 +0800)]
rockchip: kylin: Store env in emmc

There's a 64K reserved area at the end of the first 4M.
Store env there, so we can use fastboot to flash it.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: kylin: Check fastboot request
Jeffy Chen [Thu, 14 Jan 2016 02:19:40 +0000 (10:19 +0800)]
rockchip: kylin: Check fastboot request

We will save boot mode flag in grf's os_reg[4], if fastboot
requested or fastboot key pressed, try to enter fastboot mode
at preboot stage.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: kylin: Add default gpt partition table
Jeffy Chen [Thu, 14 Jan 2016 02:19:38 +0000 (10:19 +0800)]
rockchip: kylin: Add default gpt partition table

Add default android gpt partition table for kylin board.

Use "gpt write mmc 0 $partitions" to apply.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agorockchip: rk3036: Bind GPIO banks
Jeffy Chen [Thu, 14 Jan 2016 02:19:37 +0000 (10:19 +0800)]
rockchip: rk3036: Bind GPIO banks

Call dm_scan_fdt_node() in rk3036 pinctrl uclass binding.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoARM: bootm: Try to use relocated ramdisk
Jeffy Chen [Thu, 14 Jan 2016 02:19:36 +0000 (10:19 +0800)]
ARM: bootm: Try to use relocated ramdisk

After boot_ramdisk_high(), ramdisk would be relocated to
initrd_start & initrd_end, so use them instead of rd_start & rd_end.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agodm: clk: Add support for decoding clocks from the device tree
Simon Glass [Thu, 21 Jan 2016 02:43:02 +0000 (19:43 -0700)]
dm: clk: Add support for decoding clocks from the device tree

Add a method which can locate a clock for a device, given its index. This
uses the normal device tree bindings to return the clock device and the
first argument which is normally used as a peripheral ID in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
8 years agoclk: add fixed rate clock driver
Masahiro Yamada [Tue, 19 Jan 2016 04:55:28 +0000 (13:55 +0900)]
clk: add fixed rate clock driver

This commit intends to implement "fixed-clock" as in Linux.
(drivers/clk/clk-fixed-rate.c in Linux)

If you need a very simple clock to just provide fixed clock rate
like a crystal oscillator, you do not have to write a new driver.
This driver can support it.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoMerge git://git.denx.de/u-boot-dm
Tom Rini [Thu, 21 Jan 2016 16:49:49 +0000 (11:49 -0500)]
Merge git://git.denx.de/u-boot-dm

8 years agoMerge branch 'master' of git://git.denx.de/u-boot-i2c; branch 'master' of git://git...
Tom Rini [Thu, 21 Jan 2016 14:12:22 +0000 (09:12 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-i2c; branch 'master' of git://git.denx.de/u-boot-nds32

8 years agosunxi: Add support for the I2C controller which is part of the PRCM
Jelle van der Waa [Thu, 14 Jan 2016 13:06:26 +0000 (14:06 +0100)]
sunxi: Add support for the I2C controller which is part of the PRCM

Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
[hdegoede@redhat.com: Minor cleanups]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
applied with fixing 2 checkpatch warnings:
WARNING: please, no space before tabs

Signed-off-by: Heiko Schocher <hs@denx.de>
8 years agoi2c: mvtwsi: Fix mvtwsi not working on sun6i and newer sunxi SoCs
Hans de Goede [Thu, 14 Jan 2016 13:06:25 +0000 (14:06 +0100)]
i2c: mvtwsi: Fix mvtwsi not working on sun6i and newer sunxi SoCs

On sun6i and newer IFLG is a write-clear bit which is cleared by writing 1,
rather then a normal r/w bit which is cleared by writing 0.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
applied with fixing 3 checkpatch warnings
in drivers/i2c/mvtwsi.c:
WARNING: line over 80 characters
ERROR: code indent should use tabs where possible
WARNING: please, no spaces at the start of a line

Signed-off-by: Heiko Schocher <hs@denx.de>
8 years agonds32: Fix compile error.
rick [Tue, 19 Jan 2016 05:52:10 +0000 (13:52 +0800)]
nds32: Fix compile error.

Fix compile error with gcc 4.9.3

Signed-off-by: rick <rick@andestech.com>
Cc: Andes <uboot@andestech.com>
8 years agodm: video: test: Test that bitmap display works correctly
Simon Glass [Tue, 19 Jan 2016 02:52:28 +0000 (19:52 -0700)]
dm: video: test: Test that bitmap display works correctly

Add a test for the 'bmp' command. Test both the uncompressed and compressed
versions of the file, since they use different code paths.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agodm: video: test: Add tests for rotated consoles
Simon Glass [Tue, 19 Jan 2016 02:52:27 +0000 (19:52 -0700)]
dm: video: test: Add tests for rotated consoles

Test that text is displayed correctly when the console is rotated.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agodm: video: test: Add tests for the video uclass
Simon Glass [Tue, 19 Jan 2016 02:52:26 +0000 (19:52 -0700)]
dm: video: test: Add tests for the video uclass

Add tests that check that the video console is working correcty. Also check
that text output produces the expected result. Test coverage includes
character output, wrapping and scrolling.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agodm: video: sandbox: Convert sandbox to use driver model for video
Simon Glass [Tue, 19 Jan 2016 02:52:25 +0000 (19:52 -0700)]
dm: video: sandbox: Convert sandbox to use driver model for video

Now that driver model support is available, convert sandbox over to use it.
We can remove a few of the special hooks that sandbox currently has.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agosandbox: Move CONFIG_VIDEO_SANDBOX_SDL to Kconfig
Simon Glass [Tue, 19 Jan 2016 02:52:24 +0000 (19:52 -0700)]
sandbox: Move CONFIG_VIDEO_SANDBOX_SDL to Kconfig

Move this option to Kconfig. This is quite simple as only sandbox uses the
driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agodm: stdio: video: Plumb the video uclass into stdio
Simon Glass [Tue, 19 Jan 2016 02:52:23 +0000 (19:52 -0700)]
dm: stdio: video: Plumb the video uclass into stdio

Register video drivers with stdio so that they can be used for text output.
This needs to be done explicitly for now. At some point we should be able to
convert stdio itself to driver model and avoid this step.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agodm: video: Implement the bmp command for driver model
Simon Glass [Tue, 19 Jan 2016 02:52:22 +0000 (19:52 -0700)]
dm: video: Implement the bmp command for driver model

This command can use the bitmap display code in the uclass. This is similar
to the code in lcd.c and cfb_console.c. These other copies will go away when
all boards are converted to use driver model for video.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agodm: common: Add memory reservation for the video uclass
Simon Glass [Tue, 19 Jan 2016 02:52:21 +0000 (19:52 -0700)]
dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agocommon: Move LCD and video memory reservation together
Simon Glass [Tue, 19 Jan 2016 02:52:20 +0000 (19:52 -0700)]
common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agodm: video: Add a driver for a rotated text console
Simon Glass [Tue, 19 Jan 2016 02:52:19 +0000 (19:52 -0700)]
dm: video: Add a driver for a rotated text console

Sometimes the console must be rotated. Add a driver which supports rotating
the text clockwise to 90, 180 and 270 degrees. This can support devices
where the display is rotated for mechanical reasons.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agodm: video: Add a 'normal' text console driver
Simon Glass [Tue, 19 Jan 2016 02:52:18 +0000 (19:52 -0700)]
dm: video: Add a 'normal' text console driver

Most of the time we don't need to rotate the display so a simple font
blitting feature is enough for our purposes. Add a simple driver which
supports this function. It provides text output on the console using
the standard 8x16-pixel font.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agodm: video: Add a uclass for the text console
Simon Glass [Tue, 19 Jan 2016 02:52:17 +0000 (19:52 -0700)]
dm: video: Add a uclass for the text console

The existing LCD/video interface suffers from conflating the bitmap display
with text output on that display. As a result the implementation is more
complex than it needs to me.

We can support multiple text console drivers. Create a separate uclass to
support this, with its own API.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agodm: lcd: Avoid using the lcd.h header file with driver model
Simon Glass [Tue, 19 Jan 2016 02:52:16 +0000 (19:52 -0700)]
dm: lcd: Avoid using the lcd.h header file with driver model

The LCD functions and definitions are not used with the driver model video
uclass. When all boards are converted over we can remove the file. For now,
use #ifdef to omit the contents.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agodm: video: Add a video uclass
Simon Glass [Tue, 19 Jan 2016 02:52:15 +0000 (19:52 -0700)]
dm: video: Add a video uclass

U-Boot has separate code for LCDs and 'video' devices. Both now use a
very similar API thanks to earlier work by Nikita Kiryanov. With the driver-
model conversion we should unify these into a single uclass.

Unfortunately there are different features supported by each. This
implementation provides for a common set of features which should serve
most purposes. The intent is to support:

- bitmap devices with 8, 16 and 32 bits per pixel
- text console wih white on black or vice versa
- rotated text console
- bitmap display (BMP format)

More can be added as additional boards are ported over to use driver model
for video.

The name 'video' is chosen for the uclass since it is more generic than LCD.
Another option would be 'display' but that would introduce a third concept
to U-Boot which seems like the wrong approach.

The existing LCD and video init functions are not needed now, so this uclass
makes no attempt to implement them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
8 years agoarm: ls1021atwr: Enable driver model lpuart serial driver
Bin Meng [Thu, 14 Jan 2016 03:39:06 +0000 (19:39 -0800)]
arm: ls1021atwr: Enable driver model lpuart serial driver

Convert ls1021atwr_nor_lpuart to driver model support. As a start,
enable lpuart serial port driver.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alison Wang <alison.wang@nxp.com>
Tested-by: Alison Wang <alison.wang@nxp.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoarm: ls1021atwr: Split off board device tree
Bin Meng [Thu, 14 Jan 2016 03:39:05 +0000 (19:39 -0800)]
arm: ls1021atwr: Split off board device tree

Move /chosen node out of the board device tree.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoserial: lpuart: Add driver model serial support
Bin Meng [Thu, 14 Jan 2016 03:39:04 +0000 (19:39 -0800)]
serial: lpuart: Add driver model serial support

This adds driver model support to lpuart serial driver.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Tested-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
8 years agoserial: lpuart: Prepare the driver for DM conversion
Bin Meng [Thu, 14 Jan 2016 03:39:03 +0000 (19:39 -0800)]
serial: lpuart: Prepare the driver for DM conversion

Create internal routines which take lpuart's register base as
a parameter, in preparation for driver model conversion.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoserial: lpuart: Call local version of setbrg and putc directly
Bin Meng [Thu, 14 Jan 2016 03:39:02 +0000 (19:39 -0800)]
serial: lpuart: Call local version of setbrg and putc directly

There is no need to go through serial driver subsystem, instead
call the driver's setbrg and putc routines directly.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoserial: lpuart: Fix several cosmetic issues
Bin Meng [Thu, 14 Jan 2016 03:39:01 +0000 (19:39 -0800)]
serial: lpuart: Fix several cosmetic issues

Clean up the driver codes a little bit, by:
- Use tab instead of space in the macro defines
- Use single line comment whenever possible
- Fix insertion of blank lines

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoserial: lpuart: Move CONFIG_FSL_LPUART to Kconfig
Bin Meng [Thu, 14 Jan 2016 03:39:00 +0000 (19:39 -0800)]
serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig

LPUART is seen on Freescale VF610 and QorIQ Layerscape devices.
Create a Kconfig option and move it to defconfig for all boards
that have this serial driver.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoarm: ls1021atwr: Convert to driver model and enable serial support
Bin Meng [Thu, 14 Jan 2016 03:38:59 +0000 (19:38 -0800)]
arm: ls1021atwr: Convert to driver model and enable serial support

Convert ls1021atwr_nor to driver model support. As a start, enable
ns16550 serial port driver.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoRevert "fdt_support: Add multi-serial support for stdout fixup"
Bin Meng [Thu, 14 Jan 2016 03:38:58 +0000 (19:38 -0800)]
Revert "fdt_support: Add multi-serial support for stdout fixup"

This reverts commit 3e303f748cf57fb23e8ec95ab7eac0074be50e2b.

The fix up in the /aliases node does not work under the following
scenarios:
- Not every non-DM serial driver was written to have a driver name
  that conforms the format of "serial%d" or "eserial%d".
- With driver model serial, the stdio_devices[] stores the serial
  device node name in the device tree.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: add a test for the sleep command
Stephen Warren [Fri, 15 Jan 2016 18:15:31 +0000 (11:15 -0700)]
test/py: add a test for the sleep command

Execute "sleep", and validate that it sleeps for approximately the correct
amount of time.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: test the ums command
Stephen Warren [Fri, 15 Jan 2016 18:15:30 +0000 (11:15 -0700)]
test/py: test the ums command

This test invokes the "ums" command in U-Boot, and validates that a USB
storage device is enumerated on the test host system, and can be read
from.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: test the shell if command
Stephen Warren [Fri, 15 Jan 2016 18:15:29 +0000 (11:15 -0700)]
test/py: test the shell if command

Migrate all most tests from command_ut.c into the Python test system.
This allows the tests to be run against any U-Boot binary that supports
the if command (i.e. where hush is enabled) without requiring that
binary to be permanently bloated with the code from command_ut.

Some tests in command_ut.c can only be executed from C code, since they
test internal (more unit-level) features of various U-Boot APIs. The
migrated tests can all operate directly from the U-Boot console.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: add test of basic shell functionality
Stephen Warren [Fri, 15 Jan 2016 18:15:28 +0000 (11:15 -0700)]
test/py: add test of basic shell functionality

This tests whether the following features of the U-Boot shell:
- Execution of a directly entered command.
- Compound commands (; delimiter).
- Quoting of arguments containing spaces.
- Executing commands from environment variables.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: test the md/mw commands
Stephen Warren [Fri, 15 Jan 2016 18:15:27 +0000 (11:15 -0700)]
test/py: test the md/mw commands

This tests whether md/mw work, and affect each-other.

Command repeat is also tested.

test/cmd_repeat.sh is removed, since the new Python-based test does
everything it used to.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: add test of setenv/printenv/echo
Stephen Warren [Fri, 15 Jan 2016 18:15:26 +0000 (11:15 -0700)]
test/py: add test of setenv/printenv/echo

This tests basic environment variable functionality.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: test that sandbox exits when asked
Stephen Warren [Fri, 15 Jan 2016 18:15:25 +0000 (11:15 -0700)]
test/py: test that sandbox exits when asked

Test the sandbox port's implementation of the reset command and SIGHUP
handling. These should both cause the U-Boot process to exit gracefully.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: Implement pytest infrastructure
Stephen Warren [Fri, 15 Jan 2016 18:15:24 +0000 (11:15 -0700)]
test/py: Implement pytest infrastructure

This tool aims to test U-Boot by executing U-Boot shell commands using the
console interface. A single top-level script exists to execute or attach
to the U-Boot console, run the entire script of tests against it, and
summarize the results. Advantages of this approach are:

- Testing is performed in the same way a user or script would interact
  with U-Boot; there can be no disconnect.
- There is no need to write or embed test-related code into U-Boot itself.
  It is asserted that writing test-related code in Python is simpler and
  more flexible that writing it all in C.
- It is reasonably simple to interact with U-Boot in this way.

A few simple tests are provided as examples. Soon, we should convert as
many as possible of the other tests in test/* and test/cmd_ut.c too.

The hook scripts, relay control utilities, and udev rules I use for my
own HW setup are published at https://github.com/swarren/uboot-test-hooks.

See README.md for more details!

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org> #v3
8 years agopatman: Add --thread option
Mateusz Kulikowski [Thu, 14 Jan 2016 19:37:41 +0000 (20:37 +0100)]
patman: Add --thread option

Add option to create threaded series of patches.
With it, it will be possible to create patch threads like this:
[PATCH 0/10] Add support for time travel
  [PATCH 1/10] Add Flux Capacitor driver
  [PATCH 2/10] Add Mr. Fusion driver
  (...)

Internally it will call git send-email with --thread option

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoclk: add API to enable clock
Masahiro Yamada [Wed, 13 Jan 2016 04:16:12 +0000 (13:16 +0900)]
clk: add API to enable clock

The most basic thing for clock is to enable it, but it is missing
in this uclass.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoclk: add static qualifier to local functions
Masahiro Yamada [Wed, 13 Jan 2016 04:16:10 +0000 (13:16 +0900)]
clk: add static qualifier to local functions

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoclk: add needed include and declaration to include/clk.h
Masahiro Yamada [Wed, 13 Jan 2016 04:16:09 +0000 (13:16 +0900)]
clk: add needed include and declaration to include/clk.h

This header uses ulong, so it needs to include <linux/types.h>.
Likewise, "struct udevice" must be declared before it is used.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoclk: fix comments in include/clk.h
Masahiro Yamada [Wed, 13 Jan 2016 04:16:08 +0000 (13:16 +0900)]
clk: fix comments in include/clk.h

The comment about get_periph_rate() is the same as that of
set_periph_rate().

I am fixing typos here and there while I am in this file.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoclk: move Kconfig options into sub-menu
Masahiro Yamada [Tue, 12 Jan 2016 07:36:38 +0000 (16:36 +0900)]
clk: move Kconfig options into sub-menu

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agousb: Define USB_MAX_STOR_DEV in only one place
Simon Glass [Thu, 7 Jan 2016 22:16:08 +0000 (15:16 -0700)]
usb: Define USB_MAX_STOR_DEV in only one place

We can define this in the header file and use it in usb_storage.c. There is
no need to define it twice. Remove the #define from usb_storage.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
8 years agotimer: sandbox: work without device tree
Stephen Warren [Wed, 6 Jan 2016 17:33:04 +0000 (10:33 -0700)]
timer: sandbox: work without device tree

A default invocation of sandbox U-Boot apparently uses no device tree,
which means that no timer is registers, which in turn means that the
sleep shell command hangs.

Fix the sandbox timer code to register a device when there's no DT, just
like e.g. the sandbox reset driver does. When there's no DT, the DM uclass
can't initialize clock_rate from DT, so set a default value in the
timer code instead.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agodm: timer: refuse timers with zero clock_rate
Stephen Warren [Wed, 6 Jan 2016 17:33:03 +0000 (10:33 -0700)]
dm: timer: refuse timers with zero clock_rate

If a timer has a zero clock_rate, get_tbclk() will return zero for it,
which will cause tick_to_time() to perform a division-by-zero, which will
crash U-Boot.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agobzip2: Support compression for sandbox
Simon Glass [Tue, 5 Jan 2016 16:31:00 +0000 (09:31 -0700)]
bzip2: Support compression for sandbox

Add the missing code to allow bzip2 compression to be used. This is useful
for sandbox tests. These files are taken from the bzip2 1.0.6 release.
The license text is copied to the top of each file as is done with other
bzip2 files in U-Boot. The only other change is to squash a compiler warning
with nBytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agodm: core: Call uclass post_bind() after the driver's bind() method
Simon Glass [Tue, 5 Jan 2016 16:30:59 +0000 (09:30 -0700)]
dm: core: Call uclass post_bind() after the driver's bind() method

At present the uclass's post_bind() method is called before the driver's
bind() method. This means that the uclass cannot use any of the information
set up by the driver. Move it later in the sequence to permit this.

This is an ordering change which is always fairly major in nature. The main
impact is that devices which have children will not see them appear in their
bind() method. From what I can see, existing drivers do not look at their
children in the bind() method, so this should be safe.

Conceptually this change seems to result in a 'more correct' ordering, since
the uclass (which is broader than the device) gets the last word.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agosandbox: Support the bmp command
Simon Glass [Tue, 5 Jan 2016 16:30:58 +0000 (09:30 -0700)]
sandbox: Support the bmp command

Adjust this command to use map_sysmem() correctly so that it works on
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agotiny-printf: Always print zeroes
Simon Glass [Tue, 5 Jan 2016 16:30:57 +0000 (09:30 -0700)]
tiny-printf: Always print zeroes

At present this does not print zero values in numeric format (hex and
decimal). Add a special case for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agopinctrl: Avoid binding all pinconfig nodes before relocation
Simon Glass [Tue, 29 Dec 2015 12:22:52 +0000 (05:22 -0700)]
pinctrl: Avoid binding all pinconfig nodes before relocation

This can create a large number of pinctrl devices. It chews up early
malloc() memory and takes time. Only bind those which are marked as needed
before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoi2c: Correct command return values
Simon Glass [Tue, 29 Dec 2015 12:22:50 +0000 (05:22 -0700)]
i2c: Correct command return values

We should not return a -ve error code from command functions. Instead,
return CMD_RET_FAILURE. This avoids the "exit not allowed from main input
shell" error messages from the hush shell.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
8 years agodm: mmc: Try to honour the sequence order
Simon Glass [Tue, 29 Dec 2015 12:22:49 +0000 (05:22 -0700)]
dm: mmc: Try to honour the sequence order

At present we add driver-model MMC devices in the order we find them. The
'alias' order is not honoured.

It is difficult to fix this for the case where we have holes in the
sequence. But for the common case where the devices are numbered from 0
without any gaps, we can add the devices to the internal data structures
in this order.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: gpio: Allow the uclass to work without printf()
Simon Glass [Tue, 29 Dec 2015 12:22:48 +0000 (05:22 -0700)]
dm: gpio: Allow the uclass to work without printf()

For SPL we don't really need sprintf() and with tiny-printf this is not
available. Allow this to be dropped in SPL when using tiny-printf.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agotiny-printf: Avoid printing NULL strings
Simon Glass [Tue, 29 Dec 2015 12:22:46 +0000 (05:22 -0700)]
tiny-printf: Avoid printing NULL strings

Add a check for NULL strings to avoid printing junk to the console.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 years agodefconfig: dra74_evm: enable timer driver model
Mugunthan V N [Thu, 24 Dec 2015 10:38:22 +0000 (16:08 +0530)]
defconfig: dra74_evm: enable timer driver model

Enable timer driver model for dra74_evm_defconfig as omap-timer
supports driver model.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoarm: dts: dra7-evm: add tick-timer to chosen node
Mugunthan V N [Thu, 24 Dec 2015 10:38:21 +0000 (16:08 +0530)]
arm: dts: dra7-evm: add tick-timer to chosen node

Specify timer2 to be used as tick-timer in chosen node.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agodefconfig: dra72_evm: enable timer driver model
Mugunthan V N [Thu, 24 Dec 2015 10:38:20 +0000 (16:08 +0530)]
defconfig: dra72_evm: enable timer driver model

Enable timer driver model for dra72_evm_defconfig as omap-timer
supports driver model.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoarm: dts: dra72-evm: add tick-timer to chosen node
Mugunthan V N [Thu, 24 Dec 2015 10:38:19 +0000 (16:08 +0530)]
arm: dts: dra72-evm: add tick-timer to chosen node

Specify timer2 to be used as tick-timer in chosen node.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>