usb: sunxi: register OTG port as 2.0 instead of 1.1
net sun4i_wmac: Drop obsolete poll_controller assignment.

Failed to compile with netconsole enabled. poll_controller is now
only set in the netdeviceops, not in the netdevice itself.
sun4i-usb: allow USB1.1 devices on OTG USB 2.0 port

When OTG port is USB2.0 type, USB1.1 devices do not work:

[   56.790000] ------------IRQ CONNECT-------------
[   56.790000]
[   56.960000] [sw_hcd]: reset port.
[   57.020000] [sw_hcd]: reset port stopped.
[   57.080000] usb 1-1: new full-speed USB device number 3 using sw_hcd_host0
[   57.080000] usb 1-1: parent hub has no TT
[   57.090000] [sw_hcd]: sw_hcd_h_disable, epnum = 0
[   57.100000] [sw_hcd]: sw_hcd_h_disable, epnum = 0
[   57.110000] [sw_hcd]: reset port.
[   57.170000] [sw_hcd]: reset port stopped.
[   57.230000] usb 1-1: new full-speed USB device number 4 using sw_hcd_host0
[   57.230000] usb 1-1: parent hub has no TT
[   57.240000] [sw_hcd]: sw_hcd_h_disable, epnum = 0
[   57.250000] [sw_hcd]: sw_hcd_h_disable, epnum = 0
[   57.250000] [sw_hcd]: reset port.
[   57.320000] [sw_hcd]: reset port stopped.
[   57.380000] usb 1-1: new full-speed USB device number 5 using sw_hcd_host0
[   57.380000] usb 1-1: parent hub has no TT
[   57.390000] [sw_hcd]: sw_hcd_h_disable, epnum = 0
[   57.400000] [sw_hcd]: sw_hcd_h_disable, epnum = 0
[   57.400000] [sw_hcd]: reset port.
[   57.470000] [sw_hcd]: reset port stopped.
[   57.530000] usb 1-1: new full-speed USB device number 6 using sw_hcd_host0
[   57.530000] usb 1-1: parent hub has no TT
[   57.540000] [sw_hcd]: sw_hcd_h_disable, epnum = 0
[   57.540000] [sw_hcd]: sw_hcd_h_disable, epnum = 0
[   57.550000] hub 1-0:1.0: unable to enumerate USB device on port 1

Enabling .has_tt flag on HCD appears to fix or at least workaround the issue:

[   20.960000] ------------IRQ CONNECT-------------
[   20.960000]
[   21.120000] [sw_hcd]: reset port.
[   21.180000] [sw_hcd]: reset port stopped.
[   21.180000] spurious?
[   21.240000] usb 1-1: new full-speed USB device number 2 using sw_hcd_host0
[   21.240000] [sw_hcd]: reset port.
[   21.300000] [sw_hcd]: reset port stopped.
[   21.360000] [sw_hcd]: sw_hcd_h_disable, epnum = 0
[   21.360000] [sw_hcd]: sw_hcd_h_disable, epnum = 0
[   21.380000] WRN:L1722(drivers/usb/sun4i_usb/hcd/core/sw_hcd_host.c):ERR: sw_hcd_h_ep0_irq, STALLING ENDPOINT
[   21.380000] WRN:L1741(drivers/usb/sun4i_usb/hcd/core/sw_hcd_host.c):ERR: sw_hcd_h_ep0_irq, ep aborting
[   21.390000] WRN:L1722(drivers/usb/sun4i_usb/hcd/core/sw_hcd_host.c):ERR: sw_hcd_h_ep0_irq, STALLING ENDPOINT
[   21.390000] WRN:L1741(drivers/usb/sun4i_usb/hcd/core/sw_hcd_host.c):ERR: sw_hcd_h_ep0_irq, ep aborting
[   21.400000] WRN:L1722(drivers/usb/sun4i_usb/hcd/core/sw_hcd_host.c):ERR: sw_hcd_h_ep0_irq, STALLING ENDPOINT
[   21.400000] WRN:L1741(drivers/usb/sun4i_usb/hcd/core/sw_hcd_host.c):ERR: sw_hcd_h_ep0_irq, ep aborting
[   21.410000] usb 1-1: New USB device found, idVendor=045e, idProduct=0745
[   21.420000] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[   21.420000] usb 1-1: Product: Microsoft\xffffffc2\xffffffae\xffffffae 2.4GHz Transceiver v6.0
[   21.430000] usb 1-1: Manufacturer: Microsoft

Not sure if this is correct or complete fix, as with .has_tt kernel log shows
some warnings. On the other hand, musb uses same flag.

Tested over linux-sunxi-3.4 (+ otg-usb-2.0 patch), compile tested on
linux-sunxi-3.0.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
sunxi-hdmi: Fix Hdmi_mode_support

Hdmi_mode_support translates the past in mode to a CEA-861-D VIC because
Device_Support_VIC should be indexed by a VIC. This patch makes it actually
use the looked up VIC to index Device_Support_VIC.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-hdmi: Add a Hdmi_tv_mode_to_hdmi_mode() helper function

Having the exact same switch-case twice is not really useful.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-hdmi: Simplify audio parameters calculation

All calculations are based on the pixelclock, so instead of this huge
if ... else if ... on the hdmi_mode, simply get the pixel clock from
the mode-table, and use that.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-hdmi: Add 1360x768 mode

Many HD ready but not Full HD LCD tvs have a 1360x768 panel, having this mode
available as hdmi output resolution allows running them at their native
resolution.

Note some tvs have a native resolution of 1366x768, I've tried adding a mode
for that too, and it works, but only with fbcon, X cannot handle the pitch
not being a multiple of 8, and I don't know how to add padding to the
framebuffer, so people should just use 1360x768 with those.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-hdmi: Allow disabling hdmi audio from the kernel cmdline

Disabling hdmi-audio makes things work a lot better with DVI monitors,
as some DVI monitors will mistakenly try to interpret the audio data
as video data.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-disp: Set output-type and output-mode from the kernel cmdline

Because editing uEnv.txt is much simpler / more userfriendly
then dealing with script.bin, and human readable text strings are
way easier to remember then the hardwired mode table.

Note that if the cmdline arguments are not given, or not valid the
fex values are used as a fallback.

Note about the simple_strtol checkpatch warnings, we really want to use
simple_strtol here, as we need the ep to continue parsing after the number.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-disp: Fb_Init: don't assume the lcd driver is always loaded first

Currently the sunxi-disp code depends on the lcd driver always being
loaded first, which is not a good idea. This fixes this. With this it
should be safe to simply build the disp, hdmi and lcd driver into the
kernel (worksforme).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-disp: Remove unused BSP_disp_get_frame_rate function

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-disp: Fix duplication of DISP_SUCCESS and other DISP_XXXX status codes

These were declared (the same) in 2 different header files, causing problems
when both files are included.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-hdmi: s/plus/pulsw/

The "plus" variables store the V/Hsync pulsewidth, so lets give them a more
descriptive name.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-hdmi: Correctly get vsync pulse width from EDID

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-hdmi: Use pr_info instead of custom __inf macro for EDID

As we're going to be actually using EDID we want the EDID messagesto actually
end up in demsg for debugging any problems.

Also print the full info from detailed timing blocks, rather then just
a summary.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-hdmi: Speed up hdmi initialization

Before this patch we started in this useless "idle" state, from where we
would set the next state to be HDMI_State_Wait_Hpd and then return from
hdmi_main_task_loop to Hdmi_run_thread, which would then sleep 2 seconds
before checking if we've a link. So in essence the hdmi code would just
start with sleeping for 2 seconds for no good reason.

This patch gets rid of the idle state, shaving of 2 seconds of hdmi
init time. It also speeds up Hdmi_run_thread when we're not in a stable
state, so that if we're waiting for video-config (which we will get
pretty quickly after being brought up), the config arriving will get
noticed quickly.

This changes the hdmi init time from taking seconds to taking 10s of ms.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-hdmi: Move video-info struct declaration to sunxi_disp_ioctl.h

So that EDID gathered modes can be shared with the sunxi-disp core.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-hdmi: Add interlace and polarity info to video_mode table

Rather then hardcoding it, to allow properly getting this info from EDID
for EDID support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-hdmi: Fix INPUTY and VT to not be a multiple of their real values

We want to use these values in other places too, so having the special
behavior of having them multiplied by certain factors hardcoded in the
video_timing table is no good.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-hdmi: Add a hdmi_get_video_timing function

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