]> git.kernelconcepts.de Git - karo-tx-uboot.git/log
karo-tx-uboot.git
9 years agoarc: move linker script in arch/arc/cpu folder
Alexey Brodkin [Sat, 27 Dec 2014 23:45:37 +0000 (02:45 +0300)]
arc: move linker script in arch/arc/cpu folder

This way we'll be able to use the same one script for either ARC CPU.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
9 years agoarc: relocate - minor refactoring and clean-up
Alexey Brodkin [Fri, 26 Dec 2014 16:36:30 +0000 (19:36 +0300)]
arc: relocate - minor refactoring and clean-up

 * use better symbols for relocatable region boundaries
("__image_copy_start" instead of "CONFIG_SYS_TEXT_BASE")
 * remove useless debug messages because they will only show up in case
of both problem (when normal "if" branch won't be taken) and DEBUG take
place which is pretty rare situation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
9 years agoarc: introduce separate section for interrupt vector table
Igor Guryanov [Wed, 24 Dec 2014 14:17:11 +0000 (17:17 +0300)]
arc: introduce separate section for interrupt vector table

Even though existing implementation works fine in preparation to
submission of ARCv2 architecture we need this change.

In case of ARCv2 interrupt vector table consists of just addresses
of corresponding handlers. And if those addresses will be in .text
section then assembler will encode them as everything in .text section
as middle-endian and then on real execution CPU will read swapped
addresses and will jump into the wild.

Once introduced new section is situated so .text section remains the
first which allows us to use common linker option for linking everything
to a specified CONFIG_SYS_TEXT_BASE.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Igor Guryanov <guryanov@synopsys.com>
9 years agoarc: add dependences on MMU presence
Alexey Brodkin [Wed, 24 Dec 2014 14:00:29 +0000 (17:00 +0300)]
arc: add dependences on MMU presence

Depending on MMU presence in CPU there're differences in HW behavior.
For example address of instruction that caused exception is put in
ECR register if MMU exists and in ERET register otherwise.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Igor Guryanov <guryanov@synopsys.com>
9 years agoarc: interrupts - fix mask setup
Igor Guryanov [Wed, 24 Dec 2014 13:31:26 +0000 (16:31 +0300)]
arc: interrupts - fix mask setup

To disable interrupts we need to reset corresponding flags in STATUS32
register. For this we need to OR flags for interrupts level1 and level2
and then AND with current value in STATUS32.

Before that implementation was incorrect.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Igor Guryanov <guryanov@synopsys.com>
9 years agoarc: add ECR (exception cause register) output
Igor Guryanov [Wed, 24 Dec 2014 13:26:14 +0000 (16:26 +0300)]
arc: add ECR (exception cause register) output

Exception cause register (ECR) contains value that describes a reason
for exception that has happened. This helps a lot to figure-out what
went wrong.

Now we print this register contents when dumping registers.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Igor Guryanov <guryanov@synopsys.com>
9 years agoarc: check caches existence before use
Igor Guryanov [Wed, 24 Dec 2014 13:07:07 +0000 (16:07 +0300)]
arc: check caches existence before use

Some cache operations ({i|d}cache_{enable|disable|status} or
flush_dcache_all) are built and used even if CONFIG_SYS_{I|D}CACHE_OFF
is set.

This is required for force disable of caches on early boot.
What if something was executed before U-boot and enabled caches
(low-level bootloaders, previously run kernel etc.)?

But if CPU doesn't really have caches any attempt to access
cache-related AUX registers triggers instruction error exception.

So for convenience we'll try to avoid exceptions by checking if CPU
actually has caches (we check separately data and instruction cache
existence) at all.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Igor Guryanov <guryanov@synopsys.com>
9 years agoMerge branch 'next' of git://git.denx.de/u-boot-video
Tom Rini [Wed, 14 Jan 2015 21:26:15 +0000 (16:26 -0500)]
Merge branch 'next' of git://git.denx.de/u-boot-video

9 years agonet: Declare physical address as phys_addr_t unsigned type
Michal Simek [Wed, 14 Jan 2015 15:00:39 +0000 (16:00 +0100)]
net: Declare physical address as phys_addr_t unsigned type

Use phys_addr_t instead of int for addresses.
Addresses can't be < 0.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
9 years agoARM: armv8: Fix typo in commentary
Michal Simek [Wed, 14 Jan 2015 14:36:35 +0000 (15:36 +0100)]
ARM: armv8: Fix typo in commentary

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
9 years agodoc: ARM: Use the right function name
Michal Simek [Wed, 14 Jan 2015 14:36:34 +0000 (15:36 +0100)]
doc: ARM: Use the right function name

Trivial fix.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
9 years agoKconfig: move CONFIG_SYS_CLK_FREQ to Kconfig
Alexey Brodkin [Tue, 13 Jan 2015 15:49:01 +0000 (18:49 +0300)]
Kconfig: move CONFIG_SYS_CLK_FREQ to Kconfig

It makes sense to specify CONFIG_SYS_CLK_FREQ in "configs/xx_defconfig"
instead of "include/configs/xxx.h" because then header will be reusable
across boards with different CPU clocks.

Also this nice to have an ability for end user to tune this value
himself via "menuconfig".

For now I'm only applying this change to all ARC configs because
otherwise scope of change will be huge.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Tom Rini <trini@ti.com>
Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Hans de Goede <hdegoede@redhat.com>
cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
9 years agospl: spl_nor: surround Linux-load code with #ifdef CONFIG_SPL_OS_BOOT
Masahiro Yamada [Thu, 8 Jan 2015 10:23:35 +0000 (19:23 +0900)]
spl: spl_nor: surround Linux-load code with #ifdef CONFIG_SPL_OS_BOOT

If CONFIG_SPL_NOR_SUPPORT is defined, spl_nor_load_image() requires
spl_start_uboot(), CONFIG_SYS_OS_BASE, CONFIG_SYS_SPL_ARGS_ADDR,
CONFIG_SYS_FDT_BASE to be defined even if users just want to run
U-Boot, not Linux.  This is inconvenient.

This patch is following the codying style of common/spl/spl_nand.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agoimage: Enable OpenRTOS booting via fitImage
Marek Vasut [Tue, 16 Dec 2014 13:07:22 +0000 (14:07 +0100)]
image: Enable OpenRTOS booting via fitImage

Allow booting the OpenRTOS payloads via fitImage image type.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
9 years agoimage: bootm: Add OpenRTOS image type
Marek Vasut [Tue, 16 Dec 2014 13:07:21 +0000 (14:07 +0100)]
image: bootm: Add OpenRTOS image type

Add separate image type for the Wittenstein OpenRTOS .

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
9 years agoAdd support for Seagate BlackArmor NAS220
Evgeni Dobrev [Mon, 8 Dec 2014 16:49:42 +0000 (17:49 +0100)]
Add support for Seagate BlackArmor NAS220

Add support for Seagate BlackArmor NAS220

Signed-off-by: Evgeni Dobrev <evgeni@studio-punkt.com>
9 years agoarm: vf610: Remove duplicate MTD defines.
Bill Pringlemeir [Wed, 3 Dec 2014 18:40:58 +0000 (13:40 -0500)]
arm: vf610: Remove duplicate MTD defines.

Some MTD defines are repeated twice; once with UBI and then with MTD.
Remove the duplicate MTD defines from the UBI grouping.

Signed-off-by: Bill Pringlemeir <bpringlemeir@nbsps.com>
9 years agolzo: Update dst_len even on error
Simon Glass [Tue, 2 Dec 2014 20:17:40 +0000 (13:17 -0700)]
lzo: Update dst_len even on error

This allows the caller to easily detect how much of the destination buffer
has been used.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agogunzip: Update lenp even on error
Simon Glass [Tue, 2 Dec 2014 20:17:39 +0000 (13:17 -0700)]
gunzip: Update lenp even on error

This allows the caller to easily detect how much of the destination buffer
has been used.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agobzlib: Update destLen even on error
Simon Glass [Tue, 2 Dec 2014 20:17:38 +0000 (13:17 -0700)]
bzlib: Update destLen even on error

This allows the caller to easily detect how much of the destination buffer
has been used.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agobootm: Factor out common parts of image decompression code
Simon Glass [Tue, 2 Dec 2014 20:17:37 +0000 (13:17 -0700)]
bootm: Factor out common parts of image decompression code

Adjust the code so that the error reporting can all be done at the end,
and is the same for each decompression method. Try to detect when
decompression fails due to lack of space. Keep the behaviour of
resetting on failure even though there should be no memory corruption
now.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agobootm: Use print_decomp_msg() in all cases
Simon Glass [Tue, 2 Dec 2014 20:17:36 +0000 (13:17 -0700)]
bootm: Use print_decomp_msg() in all cases

Refactor to allow this function to be used to announce the image being
loaded regardless of compression type and even when there is no
decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agotest: Add unit tests for bootm image decompression
Simon Glass [Tue, 2 Dec 2014 20:17:35 +0000 (13:17 -0700)]
test: Add unit tests for bootm image decompression

Use each compression method (including uncompressed). Test for normal
operation, insufficient space and corrupted data.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agotest: Rename test_compression to ut_compression
Simon Glass [Tue, 2 Dec 2014 20:17:34 +0000 (13:17 -0700)]
test: Rename test_compression to ut_compression

Try to keep the names of the unit test commands consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agobootm: Export bootm_decomp_image()
Simon Glass [Tue, 2 Dec 2014 20:17:33 +0000 (13:17 -0700)]
bootm: Export bootm_decomp_image()

Export this function for testing. Also add a parameter so that values other
than CONFIG_SYS_BOOTM_LEN can be used for the maximum uncompressed size.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agotest: Add DEBUG output option to test-fit.py
Simon Glass [Tue, 2 Dec 2014 20:17:32 +0000 (13:17 -0700)]
test: Add DEBUG output option to test-fit.py

Sometimes it is useful to see the output from U-Boot, so add an option to
make this easier.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agosandbox: Correct ordering of 'sb save' commands
Simon Glass [Tue, 2 Dec 2014 20:17:31 +0000 (13:17 -0700)]
sandbox: Correct ordering of 'sb save' commands

Prior to commit d455d87 there was an inconsistency between the position of
the 'address' parameter in 'sb load' and 'sb save'. This was corrected but
it broke some tests. Fix the tests and also the help for 'sb save'.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agobootm: Move compression progress/error messages into a function
Simon Glass [Tue, 2 Dec 2014 20:17:30 +0000 (13:17 -0700)]
bootm: Move compression progress/error messages into a function

This code is repeated in several places, and does not detect a common
fault where the image is too large. Move it into its own function and
provide a more helpful messages in this case, for compression schemes
which support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agolzma: fix buffer bound check error further
Simon Glass [Tue, 2 Dec 2014 20:17:29 +0000 (13:17 -0700)]
lzma: fix buffer bound check error further

Commit 4d3b8a0d fixed a problem with lzma decompress where it would
run out of bytes to decompress. The algorithm needs to know how many
uncompressed bytes it is expected to produce.

However, the fix introduced a potential buffer overrun, and causes
the compression test to fail (test_compression command in sandbox).

The correct fix seems to be to use the minimum of the expected number
of uncompressed bytes and the amount of output space available. That
way things work normally when there is enough space, and return an
error (without overrunning available space) when there is not.

Signed-off-by: Antonios Vamporakis <ant@area128.com>
CC: Kees Cook <keescook@chromium.org>
CC: Simon Glass <sjg@chromium.org>
CC: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
CC: Luka Perkov <luka@openwrt.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agocommon/memsize.c: Coding style cleanup
Wolfgang Denk [Tue, 21 Oct 2014 20:14:10 +0000 (22:14 +0200)]
common/memsize.c: Coding style cleanup

Prepare code to make later modifications checkpatch-clean.

Signed-off-by: Wolfgang Denk <wd@denx.de>
9 years ago.travis.yml: build u-boot on travis-ci
Meier, Roger [Wed, 19 Nov 2014 14:26:18 +0000 (15:26 +0100)]
.travis.yml: build u-boot on travis-ci

Goal:
  - building all variants of U-Boot with multiple configurations
  - code quality checks and metrics
  - https://travis-ci.org/u-boot/u-boot/builds

9 years agoMerge branch 'buildman' of git://git.denx.de/u-boot-x86
Tom Rini [Wed, 14 Jan 2015 16:00:38 +0000 (11:00 -0500)]
Merge branch 'buildman' of git://git.denx.de/u-boot-x86

Conflicts:
tools/buildman/control.py

Signed-off-by: Tom Rini <trini@ti.com>
9 years agoREADME.scrapyard: fill commit and date fields
Masahiro Yamada [Wed, 14 Jan 2015 03:35:24 +0000 (12:35 +0900)]
README.scrapyard: fill commit and date fields

This commit was generated by the following command:

    scripts/fill_scrapyard.py

The commit-ID of CPCIISER4 removal has been fixed by hand because
the board was removed by commit 370572601027 (ppc4xx: remove CPCIISER4
board), but it was added to README.scrapyard by commit 9a4018e09a2f
(ppc4xx: remove DP405 board).

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
9 years agoscripts: add a utility to fill blank fields of doc/README.scrapyard
Masahiro Yamada [Wed, 14 Jan 2015 03:35:23 +0000 (12:35 +0900)]
scripts: add a utility to fill blank fields of doc/README.scrapyard

We are removing bunch of non-generic boards these days.

Updating doc/README.scrapyard is a really tedious task, but it can
be automated.  I hope this tool will make our life easier.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
9 years agosunxi: usbc: Add support for usb-vbus0 controller by axp drivebus pin
Hans de Goede [Sun, 11 Jan 2015 18:33:35 +0000 (19:33 +0100)]
sunxi: usbc: Add support for usb-vbus0 controller by axp drivebus pin

The axp221 / axp223's N_VBUSEN pin can be configured as an output rather
then an input, and this is used on some boards to control usb-vbus0, add
support for this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: usbc: Add support for usb0 to the common usbc code
Hans de Goede [Wed, 7 Jan 2015 14:26:06 +0000 (15:26 +0100)]
sunxi: usbc: Add support for usb0 to the common usbc code

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: Move usb-controller init code out of ehci-sunxi.c for reuse for otg
Hans de Goede [Wed, 7 Jan 2015 14:08:43 +0000 (15:08 +0100)]
sunxi: Move usb-controller init code out of ehci-sunxi.c for reuse for otg

Most of the usb-controller init code found in ehci-sunxi.c also is necessary
to init the otg usb controller, so move it to a common place.

While at it also update various #ifdefs / defines for sun8i support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: axp221: Add support for controlling the drivebus pin
Hans de Goede [Sun, 11 Jan 2015 18:58:03 +0000 (19:58 +0100)]
sunxi: axp221: Add support for controlling the drivebus pin

The axp221 / axp223's N_VBUSEN pin can be configured as an output rather
then an input, add axp_drivebus_enable() and _disable() functions to set
the pin in output mode and control it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: axp221: Protect axp221_init against multiple calls
Hans de Goede [Sun, 11 Jan 2015 18:43:56 +0000 (19:43 +0100)]
sunxi: axp221: Protect axp221_init against multiple calls

The voltage setting code knows it needs to call axp221_init before calling
the various voltage setting functions.

But users of axp utility functions like axp221_get_sid() do not know this,
so the utility functions always call axp221_init() to ensure that the
p2wi / rsb setup magic has been done.

Since doing this repeatedly is quite expensive, add a check to axp221_init
so that it only does the initialization once.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: axp221: correct ALDO2 description for sun6i
Chen-Yu Tsai [Sat, 3 Jan 2015 02:17:24 +0000 (10:17 +0800)]
sunxi: axp221: correct ALDO2 description for sun6i

ALDO2 is used to power LPDDR2 SDRAM on both the reference design and the
Hummingbird A31, when this type of RAM is present.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosunxi: Hummingbird_A31_defconfig: Enable VGA output through external DAC
Chen-Yu Tsai [Mon, 12 Jan 2015 10:02:12 +0000 (18:02 +0800)]
sunxi: Hummingbird_A31_defconfig: Enable VGA output through external DAC

The Hummingbird A31 uses an external DAC connected to the LCD0 outputs
for the on board VGA output. The DAC has a power control that's toggled
by GPIO.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosunxi: video: Add support for external DAC enable pin
Chen-Yu Tsai [Mon, 12 Jan 2015 10:02:11 +0000 (18:02 +0800)]
sunxi: video: Add support for external DAC enable pin

The external DAC for VGA output might have either a power or reset
control pin that needs to be pulled up, as is the case on the
Hummingbird A31.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosunxi: video: Allow external DACs for VGA on platforms without TV encoders
Chen-Yu Tsai [Mon, 12 Jan 2015 10:02:10 +0000 (18:02 +0800)]
sunxi: video: Allow external DACs for VGA on platforms without TV encoders

Using an external DAC for VGA output was available on sun5i. Since
some other SoCs don't have a builtin TV encoder, but might have
use for a VGA output, enable the option for the platforms that
don't have TV encoders.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosunxi: Enable pre-console buffer
Siarhei Siamashka [Thu, 8 Jan 2015 07:02:32 +0000 (09:02 +0200)]
sunxi: Enable pre-console buffer

This allows to always have a complete log on the VGA/HDMI/LCD console.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agoconsole: Use pre-console buffer to get complete log on all consoles
Siarhei Siamashka [Thu, 8 Jan 2015 07:02:31 +0000 (09:02 +0200)]
console: Use pre-console buffer to get complete log on all consoles

Currently the pre-console buffer can accumulate early log messages
and flush them to the serial console as soon as it becomes available.

This patch just adds one more pre-console buffer flushing point and
does all the same for the other consoles too. This is particularly
useful for the vga/hdmi/lcd console, where we can see all the older
messages now (except for the log messages from SPL).

Naturally, we don't want to get an extra copy of the log messages
on the serial console again at the second flushing point, so the
serial console has to be explicitly filtered out.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Tom Rini <trini@ti.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosun7i: Move psci_arch_init close to text_end
Jan Kiszka [Wed, 31 Dec 2014 12:46:42 +0000 (13:46 +0100)]
sun7i: Move psci_arch_init close to text_end

"adr rX, text_end" only works if the label is close. Adding further code
to the other functions will prevent this. So move the containing
function close to label. No functional change.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosun7i: Add support for taking CPUs offline via PSCI
Jan Kiszka [Wed, 31 Dec 2014 12:46:40 +0000 (13:46 +0100)]
sun7i: Add support for taking CPUs offline via PSCI

Based on the original version by Marc Zyngier. It adds a psci_cpu_off
implementation for the A20 SoC. The mechanism works by first preparing
the calling CPU to go offline (disable and flush cache, disable SMP),
then requesting CPU 0 to pull the plug. The request is sent as FIQ on
SGI15.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Add lvds support
Hans de Goede [Thu, 1 Jan 2015 21:04:34 +0000 (22:04 +0100)]
sunxi: video: Add lvds support

Add support for lvds lcd panels

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agosunxi: add Linksprite pcDuino v1/v2 support
Zoltan HERPAI [Tue, 6 Jan 2015 00:09:18 +0000 (01:09 +0100)]
sunxi: add Linksprite pcDuino v1/v2 support

Add support for a sun4i board built by Linksprite. This addition covers
both v1 and v2 versions. As the board has been working with 408MHz memory
setting in the u-boot-sunxi branch, and has been proven to be running stable
during my tests as well, a respective new DRAM config file is added as well.

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosunxi: video: Add a hpd_delay parameter to configure hpd delay
Hans de Goede [Sun, 28 Dec 2014 08:13:21 +0000 (09:13 +0100)]
sunxi: video: Add a hpd_delay parameter to configure hpd delay

In some extreme cases it may be necessary to wait 1.5 seconds or more for a hpd
signal to show up (and be able to read edid info), but we do not want to
penalize all headless boots with an extra second boot delay, so add a hpd_delay
parameter which can be set through the video-mode env. variable.

While at it raise the default from 300ms to 500ms as 300 may very well be too
low in many cases.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Add VGA output support
Hans de Goede [Thu, 25 Dec 2014 12:58:06 +0000 (13:58 +0100)]
sunxi: video: Add VGA output support

Add support for VGA directly from the sunxi SoC / display engine.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Fallback from HDMI to VGA on boards with VGA
Hans de Goede [Thu, 25 Dec 2014 12:52:04 +0000 (13:52 +0100)]
sunxi: video: Fallback from HDMI to VGA on boards with VGA

If a board has no LCD, but does have VGA fallback to VGA when no HDMI cable
is connected (unless hpd=0).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Add support for using PORTD hsync/vsync pins with tcon1
Hans de Goede [Sat, 27 Dec 2014 14:19:23 +0000 (15:19 +0100)]
sunxi: video: Add support for using PORTD hsync/vsync pins with tcon1

Add support for using PORTD hsync/vsync pins with tcon1, this is a preparation
patch for adding native VGA support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Use sunxi_lcdc_get_clk_delay to calculate tcon1 delay
Hans de Goede [Wed, 24 Dec 2014 18:50:11 +0000 (19:50 +0100)]
sunxi: video: Use sunxi_lcdc_get_clk_delay to calculate tcon1 delay

Use sunxi_lcdc_get_clk_delay to calculate tcon1 delay instead of hardcoding
it to 30. We will still end up using 30 for most modes, but for e.g. 800x600
this makes a (small) difference.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Remove sunxi_display.enabled variable
Hans de Goede [Wed, 24 Dec 2014 18:47:14 +0000 (19:47 +0100)]
sunxi: video: Remove sunxi_display.enabled variable

Having both a sunxi_display.enabled variable and
sunxi_display.monitor == sunxi_monitor_none duplicates state, use
sunxi_display.monitor = sunxi_monitor_none when ever we do not have a display.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: Ippo_q8h defconfigs: Enable the LCD panel found on these tablets.
Hans de Goede [Tue, 23 Dec 2014 15:08:38 +0000 (16:08 +0100)]
sunxi: Ippo_q8h defconfigs: Enable the LCD panel found on these tablets.

Enable the new LCD support on Ippo_q8h tablets.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Tested-by: Chen-Yu Tsai <wens@csie.org>
9 years agosunxi: A13-OLinuXino defconfigs: Enable VGA output, add lcd-mode for 7" LCD
Hans de Goede [Wed, 24 Dec 2014 15:00:38 +0000 (16:00 +0100)]
sunxi: A13-OLinuXino defconfigs: Enable VGA output, add lcd-mode for 7" LCD

Enable VGA output on the A13-OLinuXino and A13-OLinuXinoM now that we've
support for it.

Also add LCD timing and gpio info for the Olimex 7" LCD module. We can safely
put this in the default config on this boards, since by default we will always
use VGA, and the LCD timing info will only get used if the user explicitly
sets monitor=lcd in the video-mode env. variable.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: sunxi-common.h: Reduce bootm_size to take the framebuffer into account
Hans de Goede [Wed, 24 Dec 2014 15:08:30 +0000 (16:08 +0100)]
sunxi: sunxi-common.h: Reduce bootm_size to take the framebuffer into account

Before video output support can be enabled on the A13-OLinuXinoM, bootm_size
must first be reduced to take into account that the framebuffer is shaved of
the top of the DRAM. For other boards this is not an issue since bootm was set
to 256M and all boards have at least 512M except for the A13-OLinuXinoM.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Add support for VGA via external DACs connected to the LCD pins
Hans de Goede [Wed, 24 Dec 2014 11:17:07 +0000 (12:17 +0100)]
sunxi: video: Add support for VGA via external DACs connected to the LCD pins

Add support for external DACs connected to the parallel LCD interface driving
a VGA connector, such as found on the Olimex A13 boards.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Enable video on sun8i, which supports LCD but not HDMI
Hans de Goede [Tue, 23 Dec 2014 22:04:35 +0000 (23:04 +0100)]
sunxi: video: Enable video on sun8i, which supports LCD but not HDMI

The A23 (sun8i) only has lcd output support, so allow building the video code
without HDMI support for use with the A23.

Also the A23 has the same reset bits (and necessity to enable the DRC block)
as the sun6i, so enable those bits for sun8i too.

Note building without HDMI support is useful for the A13 (sun5i variant) too,
as that one does not have HDMI either.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Add lcd output support
Hans de Goede [Sun, 21 Dec 2014 15:28:32 +0000 (16:28 +0100)]
sunxi: video: Add lcd output support

Add lcd output support, see the new Kconfig entries and doc/README.video for
how to enable / configure this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Move sunxi_drc_init
Hans de Goede [Tue, 23 Dec 2014 17:39:52 +0000 (18:39 +0100)]
sunxi: video: Move sunxi_drc_init

Move sunxi_drc_init to directly above sunxi_engines_init, to avoid
unnecessary #ifdef-ery in later patches.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Modify sunxi_lcdc_pll_set to work with both tcon0 and tcon1
Hans de Goede [Sun, 21 Dec 2014 15:27:45 +0000 (16:27 +0100)]
sunxi: video: Modify sunxi_lcdc_pll_set to work with both tcon0 and tcon1

Modify sunxi_lcdc_pll_set to work with both tcon0 and tcon1, this is a
preparation patch for adding lcd support.

While at it also swap the divider search order, searching from low to
high, as the comment above the code says we should do. In cases where there
are multiple solutions this will result in picking a lower pll clock and
divider, which is more stable and saves power.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Prepare for lcd support
Hans de Goede [Sun, 21 Dec 2014 13:49:34 +0000 (14:49 +0100)]
sunxi: video: Prepare for lcd support

Refactor sunxi_mode_set into a bunch of helpers, and make it do a switch
case on sunxi_display.monitor to decide what to do.

Also rename sunxi_lcdc_mode_set to sunxi_lcdc_tcon1_mode_set, as it sets the
timings for tcon1, and for lcd support we need a similar function operating
on tcon0.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Improve monitor video-mode option handling
Hans de Goede [Sun, 21 Dec 2014 13:37:45 +0000 (14:37 +0100)]
sunxi: video: Improve monitor video-mode option handling

Add a sunxi_monitor enum and parse the monitor option string into this enum
once, rather then doing strcmp-s on it in various places. This also adds
checking for it being a valid value.

This also adds new "none" and "lcd" values in preparation for lcd support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: gpio: Add support for gpio pins on the AXP209 pmic
Hans de Goede [Wed, 24 Dec 2014 18:34:38 +0000 (19:34 +0100)]
sunxi: gpio: Add support for gpio pins on the AXP209 pmic

Some boards use GPIO-s on the pmic, one example of this is the A13-OLinuXino
board, which uses gpio0 of the axp209 for the lcd-power signal.

This commit adds support for gpio pins on the AXP209 pmic, the sunxi_gpio.c
changes are universal, adding gpio support for the other AXP pmics (when
necessary) should be a matter of adding the necessary axp_gpio_foo functions
to their resp. drivers, and add "#define AXP_GPIO" to their header file.

Note this commit only adds support for the non device-model version of the
gpio code, patches for adding support to the device-model version are very
welcome.

The string representation for these gpio-s is AXP0-#, the 0 in the AXP0 prefix
is there in case we need to support gpio-s on more then 1 pmic in the future.
At least A80 boards have 2 pmics, and we may end up needing to support gpio-s
on both.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: gpio: Properly sort mux defines by port number
Hans de Goede [Mon, 22 Dec 2014 10:39:57 +0000 (11:39 +0100)]
sunxi: gpio: Properly sort mux defines by port number

Move a few mux defines around so that all the mux defines are properly sorted
by port number.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: video: Set input sync enable
Hans de Goede [Sat, 20 Dec 2014 12:51:16 +0000 (13:51 +0100)]
sunxi: video: Set input sync enable

Add a write to the "unknown" (*) register to enable auto input sync, when
initially adding sunxi hdmi output support this magic write from the android
kernel code was missed, causing lcdc -> hdmi encoder sync problems.

With this write added, we can drop the modesetting retries and the extra
delays added to work around these sync problems.

With the retries dropped there also is no need to 0 all the enable flags at
the beginning of the modeset, as they are initialized to 0 already by
engines_init.

*) "unknown" is the actual name of this register in the android kernel sources

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agosunxi: video: Give hotplug-detect (hpd) signal some time to show up
Hans de Goede [Sat, 20 Dec 2014 14:15:23 +0000 (15:15 +0100)]
sunxi: video: Give hotplug-detect (hpd) signal some time to show up

When using a hdmi powered hdmi to vga dongle, and cold booting a sunxi
device, the hpd detect code would not see the dongle (until a warm reboot),
because the dongle needs some time to boot.

Testing has shown that this dongle needs 213ms to respond on a cold boot,
so wait up to 300ms for a hpd signal to show up before giving up.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agosunxi: video: When using edid use CEA681 extension blocks to select hdmi output
Hans de Goede [Sat, 20 Dec 2014 13:31:45 +0000 (14:31 +0100)]
sunxi: video: When using edid use CEA681 extension blocks to select hdmi output

When using edid use CEA681 edid extension blocks to select between dvi and
hdmi output formats, so that u-boot will automatically do the right thing.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agosunxi: video: Add sunxi_hdmi_edid_get_block helper function
Hans de Goede [Sat, 20 Dec 2014 13:01:48 +0000 (14:01 +0100)]
sunxi: video: Add sunxi_hdmi_edid_get_block helper function

Add a sunxi_hdmi_edid_get_block helper function, this is a preparation patch
for adding support for parsing EDID extension blocks.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agosunxi: video: Add hdmi support
Hans de Goede [Sat, 20 Dec 2014 12:38:06 +0000 (13:38 +0100)]
sunxi: video: Add hdmi support

So far we've been programming the hdmi-encoder to send out dvi data over the
hdmi connector. This works well for most devices, including hdmi devices, but
not all devices accept dvi data on a hdmi input.

Add support for sending proper hdmi data over the hdmi output found on most
sunxi boards. This can be turned on by adding monitor=hdmi as option to the
video-mode env. variable.

A follow up patch will determine whether to send dvi or hdmi automatically when
EDID is used.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agosunxi: video: Add DDC & EDID support
Hans de Goede [Fri, 19 Dec 2014 15:05:12 +0000 (16:05 +0100)]
sunxi: video: Add DDC & EDID support

Add DDC & EDID support and use it to automatically select the native mode of
the attached monitor. This can be disabled by adding edid=0 as option
to the video-mode env. variable.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agosunxi: video: Add hpd option
Hans de Goede [Fri, 19 Dec 2014 14:13:57 +0000 (15:13 +0100)]
sunxi: video: Add hpd option

Allow the user to specify hpd=0 as option in the video-mode env. variable,
if hpd is set to 0 then the hdmi output will be brought up even if no cable
is connected.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agosunxi: video: Add support for video-mode environment variable
Hans de Goede [Fri, 19 Dec 2014 13:03:40 +0000 (14:03 +0100)]
sunxi: video: Add support for video-mode environment variable

Add support for the standard video-mode environment variable using the
videomodes.c video_get_ctfb_res_modes() helper function.

This will allow users to specify the resolution e.g. :

setenv video-mode sunxi:video-mode=1280x1024-24@60
saveenv

Also make the reserved fb mem slightly larger to allow 1920x1200 to work.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agosunxi: video: Use video-mode/-timing from videomodes
Hans de Goede [Fri, 19 Dec 2014 12:46:33 +0000 (13:46 +0100)]
sunxi: video: Use video-mode/-timing from videomodes

Switch from fb_videomode to ctfb_res_modes and use the predefined videotimings
from videomodes.c, rather then defining our own.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agoedid: Add struct and defines for cea681 extension blocks
Hans de Goede [Sat, 20 Dec 2014 13:30:27 +0000 (14:30 +0100)]
edid: Add struct and defines for cea681 extension blocks

Add a struct describing the (fixed) bits of cea681 edid extension blocks,
and defines for accessing various bitfields.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agoedid: Add an edid_check_checksum() helper function
Hans de Goede [Mon, 24 Nov 2014 12:47:13 +0000 (13:47 +0100)]
edid: Add an edid_check_checksum() helper function

Add a helper function to check the checksum of an EDID data block.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agovideomodes: Add video_edid_dtd_to_ctfb_res_modes helper function
Hans de Goede [Fri, 19 Dec 2014 14:47:37 +0000 (15:47 +0100)]
videomodes: Add video_edid_dtd_to_ctfb_res_modes helper function

Add a video_edid_dtd_to_ctfb_res_modes helper function to convert an EDID
detailed timing to a struct ctfb_res_modes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agovideomodes: Add helper functions to parse video-mode env-var extra options
Hans de Goede [Fri, 19 Dec 2014 13:27:46 +0000 (14:27 +0100)]
videomodes: Add helper functions to parse video-mode env-var extra options

Add 2 helper functions to get strings, respectively integers from the options
value returned by video_get_video_mode() / video_get_ctfb_res_modes().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agovideomodes: Add video_get_ctfb_res_modes helper function
Hans de Goede [Fri, 19 Dec 2014 12:22:47 +0000 (13:22 +0100)]
videomodes: Add video_get_ctfb_res_modes helper function

Add a video_get_ctfb_res_modes() helper function, which uses
video_get_video_mode() to parse the 'video-mode' environment variable and then
looks up the matching mode in res_mode_init and returns the matching mode.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agovideomodes: Add a bunch of high res modes
Hans de Goede [Fri, 19 Dec 2014 10:45:19 +0000 (11:45 +0100)]
videomodes: Add a bunch of high res modes

Add modes useful for hd-tvs and modern monitors.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agovideomodes: Add (vesa) standard timings
Hans de Goede [Fri, 19 Dec 2014 10:11:52 +0000 (11:11 +0100)]
videomodes: Add (vesa) standard timings

The timings for the modes defined in videomodes.c differ (significantly)
from vesa standard timings for these modes.

This commit adds a version with the proper std timings for these modes,
since I do not want to cause regressions, boards which want to use the standard
timings need to define CONFIG_VIDEO_STD_TIMINGS to get the new correct timings.

Since there is no std timing for 960x720 this commit uses the timing used
by the nvidia video drivers for 960x720, which uses a standard pixelclock
of 74.25 MHz rather then the weird 76.335... clock used by the old modes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agovideomodes: Add pixelclock_khz and refresh fields to ctfb_res_modes
Hans de Goede [Fri, 19 Dec 2014 09:38:49 +0000 (10:38 +0100)]
videomodes: Add pixelclock_khz and refresh fields to ctfb_res_modes

Add pixelclock_khz and refresh fields to ctfb_res_modes:

1) pixelclocks are usually referred to in hz, not picoseconds, and e.g
pll-s are also typically programmed in hz, not ps. Converting between the
2 leads to rounding differences, add a pixelclock_khz field to directly
store the *exact* pixelclock for a mode, so that drivers do not need to
resort to rounding tricks to try and guess the exact pixelclock;

2) The video-mode environment variable, as parsed by video_get_video_mode
also contains the vertical refresh rate, add a refresh field, so that
the refresh-rate can be matched when parsing the video-mode environment
variable.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
9 years agosun7i: Add new Bananapro board / defconfig
Hans de Goede [Wed, 31 Dec 2014 10:30:26 +0000 (11:30 +0100)]
sun7i: Add new Bananapro board / defconfig

Add support for the new Bananapro A20 development board from lemaker.org.
This board features 1G RAM, 2 USB A receptacles, 1 micro USB receptacle for
OTG, 1 micro USB receptacle for power, HDMI, sata, Gbit ethernet, ir receiver,
3.5 mm jack for a/v out, on board microphone, 40 gpio pins and sdio wifi.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: Fix PLL1 running at half speed on sun8i
Hans de Goede [Sat, 27 Dec 2014 16:56:59 +0000 (17:56 +0100)]
sunxi: Fix PLL1 running at half speed on sun8i

PLL1 on sun6i / sun8i also has a p factor which divides the clock by
2^p (to the power p). On sun6i the p factor is ignored, but on sun8i it is
used and we were setting it to 1, resulting in the CPU running at 504 MHz
instead of 1008 MHz, this commit fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: Fix buggy sun6i/sun8i DRAM size detection logic
Siarhei Siamashka [Wed, 24 Dec 2014 16:58:17 +0000 (18:58 +0200)]
sunxi: Fix buggy sun6i/sun8i DRAM size detection logic

After reboot, reset or even short power off, DRAM typically retains
the old stale data for some period of time (for this type of memory,
the bits of data are stored in slowly discharging capacitors).

The current sun6i/sun8i DRAM size detection logic, which is
inherited from the Allwinner code, relies on using a large magic
signature with the hope that it is unique enough and unlikely to
ever accidentally match this leftover garbage data in RAM. But
this approach is inherently unsafe, as can be demonstrated using
the following test program:

/***** A testcase for reproducing the problem ******/

void main(int argc, char *argv[])
{
    size_t size, i;
    uint32_t *buf;
    /* Allocate the buffer */
    if (argc < 2 || !(size = (size_t)atoi(argv[1]) * 1048576) ||
                    !(buf = malloc(size))) {
        printf("Need buffer size in MiB as a cmdline argument\n");
        exit(1);
    }
    /* Fill it with the Allwinner DRAM "magic" values */
    for (i = 0; i < size / 4; i++)
        buf[i] = 0xaa55aa55 + ((uintptr_t)&buf[i] / 4) % 64;
    /* Try to reboot */
    system("reboot");
    /* And wait */
    for (;;) {}
}
/***************************************************/

If this test program is run on the device (giving it a large
chunk of memory), then the DRAM size detection logic in u-boot
gets confused after reboot and fails to initialize DRAM properly.

A better approach is not to rely on luck and abstain from making
any assumptions about the properties of the leftover garbage
data in RAM. Instead just use a more reliable code for testing
whether two different addresses refer to the same memory location.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosun7i: Add defconfig for MSI Primo73 tablet
Siarhei Siamashka [Sat, 27 Dec 2014 07:38:57 +0000 (09:38 +0200)]
sun7i: Add defconfig for MSI Primo73 tablet

This patch uses the same DRAM settings as in the pre-installed
Android firmware. The LCD display is supported too.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosun6i: Add defconfig for MSI Primo81 tablet
Siarhei Siamashka [Sat, 27 Dec 2014 07:38:56 +0000 (09:38 +0200)]
sun6i: Add defconfig for MSI Primo81 tablet

This patch uses the same ZQ and DRAM clock settings as in the
pre-installed Android firmware.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosunxi: Fix CONFIG_UART0_PORT_F build and add it to menuconfig
Siarhei Siamashka [Thu, 25 Dec 2014 00:34:47 +0000 (02:34 +0200)]
sunxi: Fix CONFIG_UART0_PORT_F build and add it to menuconfig

The CONFIG_UART0_PORT_F option has been supported since
    http://git.denx.de/?p=u-boot.git;a=commit;h=ff2b47f6a9cc1025

This option is primarily useful only for low level u-boot debugging
on tablets, where normal UART0 is difficult to access and requires
device disassembly and/or soldering.

This patch now allows it to be selected from menuconfig. A dependency on
SPL_FEL is added because u-boot does not support booting from NAND yet
and also booting from SD card is impossible when a MicroSD breakout board
is plugged into the SD slot.

Additionally a compilation problem is fixed:

common/spl/built-in.o: In function `spl_mmc_load_image':
/tmp/u-boot-sunxi/common/spl/spl_mmc.c:94: undefined reference to `mmc_initialize'
/tmp/u-boot-sunxi/common/spl/spl_mmc.c:96: undefined reference to `find_mmc_device'
/tmp/u-boot-sunxi/common/spl/spl_mmc.c:104: undefined reference to `mmc_init'
scripts/Makefile.spl:206: recipe for target 'spl/u-boot-spl' failed

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agosun8i: Add defconfig for Ippo_q8h v1.2
Hans de Goede [Mon, 8 Dec 2014 13:34:29 +0000 (14:34 +0100)]
sun8i: Add defconfig for Ippo_q8h v1.2

We need separate defconfigs for the v5 and v1.2 versions of this board, as
they use different DRAM parameters.

Note they also use different dtb files, as the wifi is different too.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosun8i: Ippo_q8h_v5_defconfig: Enable SPL support
Hans de Goede [Sat, 20 Dec 2014 11:25:14 +0000 (12:25 +0100)]
sun8i: Ippo_q8h_v5_defconfig: Enable SPL support

Now that we've sun8i dram-init support we can enable the SPL for sun8i boards.

While at it also replace CONFIG_DEFAULT_DEVICE_TREE with CONFIG_FDTFILE,
the former is for u-boot's own fdt usage, which we do not use (yet), the later
specifies the fdt to pass to the kernel, which is the one we want.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosun8i: Add dram initialization support
Hans de Goede [Sun, 7 Dec 2014 13:34:27 +0000 (14:34 +0100)]
sun8i: Add dram initialization support

Based on the register / dram_para headers from the Allwinner u-boot / linux
sources + the init sequences from boot0.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: Use memcmp for mctl_mem_matches
Hans de Goede [Mon, 8 Dec 2014 13:17:08 +0000 (14:17 +0100)]
sunxi: Use memcmp for mctl_mem_matches

Use memcmp for mctl_mem_matches instead of DIY.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: Fill memory before comparing it when doing dram init on sun6i
Hans de Goede [Mon, 8 Dec 2014 12:58:53 +0000 (13:58 +0100)]
sunxi: Fill memory before comparing it when doing dram init on sun6i

The sun8i boot0 code fills the DRAM with a "random" pattern before comparing
it at different offsets to do columns, etc. detection. The sun6i boot0 code
does not do it, instead relying on the memory contents being random enough
to begin with for the memcmp to properly detect the wrap-around address, iow
it is working purely by chance. Since our sun6i dram code was modelled after
the boot0 code it contained the same issue.

This commit fixes this by filling the memory with a unique, distinct pattern.

The new mctl_mem_fill function this introduces is added as an inline helper
in dram.h, so that it can be shared with the sun8i dram code.

While at it move mctl_mem_matches to dram.h for re-use in sun8i too.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: Move await_completion dram helper to dram.h
Hans de Goede [Mon, 8 Dec 2014 12:38:21 +0000 (13:38 +0100)]
sunxi: Move await_completion dram helper to dram.h

The await_completion helper is already copy pasted between the sun4i and sun6i
dram code, and we need it for sun8i too, so lets make it an inline helper in
dram.h, rather then adding yet another copy.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosun6i: clock_set_pll5: Calculate k and m rather then hardcoding them
Hans de Goede [Sun, 7 Dec 2014 20:09:31 +0000 (21:09 +0100)]
sun6i: clock_set_pll5: Calculate k and m rather then hardcoding them

Our old hardcoded k and m values are based on PLL5 being configured in steps
of 48 MHz, which is correct for sun6i where the DRAM PLL runs at twice the
DRAM CLK, which is usually configured in 24 MHz step. But on the A23 (sun8i)
the PLL5 runs at half the DRAM CLK, so we require 12 MHz steps.

This commit adjusts clock_set_pll5 to automatically select the best k and m
depending on the requested clk rate.

Suggested-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosun6i: Add a sigma_delta_enable paramter to clock_set_pll5()
Hans de Goede [Sun, 30 Nov 2014 10:58:17 +0000 (11:58 +0100)]
sun6i: Add a sigma_delta_enable paramter to clock_set_pll5()

The sun8i dram code sometimes wants to enable sigma delta mode,
add a parameter to allow this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: axp221: Disable dcdc4 on sun8i (A23)
Hans de Goede [Sat, 13 Dec 2014 13:20:09 +0000 (14:20 +0100)]
sunxi: axp221: Disable dcdc4 on sun8i (A23)

dcdc4 is not used on sun8i, disable it.

While at it also add comments to the other fixed voltages to document what
they are used for.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: axp221: Explicitly turn off unused voltages
Hans de Goede [Sat, 13 Dec 2014 13:02:38 +0000 (14:02 +0100)]
sunxi: axp221: Explicitly turn off unused voltages

Explicitly turn off unused voltages, rather then leaving them as is. Likewise
explictly enabled the dcdc convertors, rather then assuming they are already
enabled at boot.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>