sunxi:video: add simplefb support

Signed-off-by: Luc Verhaegen <libv@skynet.be>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi:video: claim clocks for simplefb

This allows an updated simplefb driver in the kernel to correctly claim
clocks, so that these do not get automatically disabled by the kernels
clock framework, and so that simplefb actually does something useful for
the kernel on sunxi hw as well.

Currently, only clocks already defined in the dt today are handled. When
a sunxi KMS driver for mainline kernel happens, further clocks will have
to get defined in the sunxi dtses, and more clocks will have to be
claimed from this side as well. It is relatively pointless to try to
claim these clocks today already, as they will most likely be
significantly altered again when KMS happens.

Signed-off-by: Luc Verhaegen <libv@skynet.be>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: Kconfig: Add CONFIG_VIDEO option to enable HDMI console support

And make this default to Y since most boards have a HDMI output.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: display: Fix clock-output-names check failure on sun5i

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: display: Add a 1920x1080 mode

Make it easy to use / test 1920x1080 by flipping a single #if.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: display: Pass around calculated clk_div and clk_double values

Rather then reading them back from the register later.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: display: 16 is not a valid clk_div value

We can use div as a clk_div for the lcdc clk, but not for the hdmi clk, so
don't try to use a clk_div of 16.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: display: Use linux-sunxi 3.4 driver values for tx clk and driver values

I don't know where the value currently in the u-boot sunxi-display driver
come from. But they cause my monitor to not sync at all with 1024x768. Use the
proven to work on many monitors values from the linux-sunxi 3.4 driver instead.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: display: Add sun5i fifo tweak from linux-sunxi 3.4 kernels

This fixes some modes / board combinations giving artifacts due to fifo
underruns.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: Add usb keyboard Kconfig option

For use together with the hdmi console.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: display: Give various display pipeline blocks time to settle

It seems the various display pipeline blocks need about one frame for their
about to become stable enough for the next block in the pipeline to be able
to sync to it. Without the delays this patch adds, things do not sync up
properly on some boards leading to a video-output with an unwanted x and y
offset.

Even with these delays sometimes (once about every 5 boots on my bananapi),
things still do not sync up properly, luckily this can be detected using the
hdmi fifo over / underrun bits. This commits also adds code to retry the
modeset when this happens.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Kconfig: Add EXPERT option

For similar reasons to why the Linux Kernel has an EXPERT option, we too
want an option to allow for tweaking of some options that while normally
should remain hidden, may need to be changed in some cases.

Signed-off-by: Tom Rini <trini@ti.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sun7i: Drop CONFIG_ARMV7_PSCI_NR_CPUS

It is not used anywhere.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: Add arch/arm/cpu/armv7/Kconfig with non-secure and virt options

Add arch/arm/cpu/armv7/Kconfig with non-secure and virt options, so that
we can have CONFIG_ARMV7_SEC_BY_DEFAULT as a proper Kconfig option.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ARM: bootm: Allow booting in secure mode on hyp capable systems

Older Linux kernels will not properly boot in hyp mode, add support for a
bootm_boot_mode environment variable, which can be set to "sec" or "nonsec"
to force booting in secure or non-secure mode when build with non-sec support.

The default behavior can be selected through CONFIG_ARMV7_BOOT_SEC_DEFAULT,
when this is set booting in secure mode is the default. The default setting
for this Kconfig option is N, preserving the current behavior of booting in
non-secure mode by default when non-secure mode is supported.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>

--
Changes in v2:
-Allow changing the default boot mode to secure through defining
 CONFIG_ARMV7_BOOT_SEC_DEFAULT, this is useful for archs which have a Kconfig
 option for compatibility with older kernels
Changes in v3:
-Add an else at the end of the #ifdef NONSEC block so that if do_nonsec_entry
 fails we do not end up re-trying in secure mode
Changes in v4:
-Add a Kconfig option to select to boot in secure or non-secure mode by default
sun7i: Set ARMV7_BOOT_SEC_DEFAULT when OLD_SUNXI_KERNEL_COMPAT is set

Old kernels cannot handle booting in non-secure (hyp) mode, so when
OLD_SUNXI_KERNEL_COMPAT is set, also set ARMV7_BOOT_SEC_DEFAULT.

Note that whether to booting secure or non-secure can always be overriden
using the bootm_boot_mode environment variable.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
--
Changes in v2:
-Use Kconfig rather the a hard-define in include/configs/sun7i.h
sunxi: Add video pll clock functions

This is a preparation patch for adding support for HDMI out.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sun6i-hdmi-hack

Signed-off-by: Hans de Goede <hdegoede@redhat.com>