usb: Remove unnecessary portnr lookup from usb_new_device

If the device has a parent, it is instantiated from usb_hub_port_connect_change
and the portnr is right there in dev->portnr, so there is no need for this
whole dance to look it up.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
usb: Do not power-cycle usb devices on init

Do as the Linux kernel does and power on any ports which are not yet one,
this is enough.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
usb: ehci: Do not disable an already disabled periodic schedule

When periodic_schedules == 0, the schedule is disabled and there is no reason
to disable it again.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
usb: ehci: Move interrupt packet length check to create_int_queue

Preperation patch to use create_int_queue outside of ehci-hcd.c .

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
usb: ehci: Move cache invalidation to poll_int_queue

Preperation patch to use poll_int_queue outside of ehci-hcd.c .

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
usb: Make pollable int support available outside of ehci-hcd.c

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
usb: kbd: Remove unused usb_kbd_generic_poll function

This is not used anywhere, so lets remove it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
usb: kbd: Fix memleak on usb_kbd_deregister()

Free the keyboard hid-report buffer and private data on deregister.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
stdio: Fix memleak on stdio_deregister

stdio_register makes a malloc-ed copy of struct stdio_dev through stdio_clone,
free the malloc-ed memory on stdio_deregister.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
usb: kbd: Cache pipe, interval and packetsize

Instead of looking them up every time we need them.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
usb: kbd: Add (optional) support for using an interrupt queue for polling

Waiting an interrupt packet to complete in usb_kbd_poll_for_event, causes
a 40 ms latency for each call to usb_kbd_testc, which is undesirable.

Using control messages leads to lower (but still not 0) latency, but some
devices do not work well with control messages (e.g. my kvm behaves funny
with them).

This commit adds support for using the int_queue mechanism which at least
the ehci-hcd driver supports. This allows polling with 0 latency, while
using interrupt packets.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
kconfig: Fix compiler warning in menu.c

This fixes the following compiler warning:

In file included from scripts/kconfig/zconf.tab.c:2537:0:
scripts/kconfig/menu.c: In function ‘get_symbol_str’:
scripts/kconfig/menu.c:590:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     jump->offset = strlen(r->s);
                  ^
In file included from scripts/kconfig/zconf.tab.c:2537:0:
scripts/kconfig/menu.c:551:19: note: ‘jump’ was declared here
  struct jump_key *jump;

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
video: add cfb console driver for sunxi

This adds a fixed mode hdmi driver for the sunxi platform. The fixed
mode is a relatively safe 1024x768, more complete EDID handling is
currently not provided as that would mean a significant rewrite of uboot
infrastructure. Only HDMI is supported today, DT based LCD will have to
wait until a KMS driver is out.

This code is enabled when HPD detects an attached monitor, which works
well on even A13, where no HDMI signals are externally available on the
package.

Current config is such that 8MB is shaved off at the top of the RAM.
This avoids several memory handling issues, most significant is the fact
that on linux on ARM you are not allowed to remap known RAM as IO. A
clued in display driver will be able to recycle this reserved RAM in
future though.

cfbconsole was chosen as it provides the most important functionality: a
working u-boot console, allowing for the debugging of certain issues
without the need for a UART. To enable the console on HDMI, add the
following to your boot script:
	setenv stdout serial,vga
	setenv stderr serial,vga
This will sadly only take effect after the environment is read in, which
makes this hdmi console driver less universally useful as hoped.

Signed-off-by: Luc Verhaegen <libv@skynet.be>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
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>