usb: musb: host: do not use (un)map_urb_for_dma hooks if DMA is not used

There is no any sense in using (un)map_urb_for_dma
for non-DMA mode (such as PIO). Do not use these
hooks if CONFIG_MUSB_PIO_ONLY mode selected

Change-Id: I913af2cc0a208a660308124c79007e05365618a4
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
ARM: OMAP: PM: Add more information on error path

Sometimes if some code tries to remove requested
throughput, the message "Invalid Device Structure"
is shown. This message is not informative because
it's unknown for what device it was tried - so
now added more information to that message.

Change-Id: Id26bf385dafd4992c8c3487d9dc38935e0fcd777
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
usb: musb: gadget: use pm autosuspend in musb_gadget_pullup

If musb_gadget_pullup doesn't use pm autosuspend, next may happen:

time |   pseudocode
------------------------------------------------------------
t1   | pm_runtime_put_autosuspend() scedules suspend at 't4'
     |     /* some code running */
t2   | musb_gadget_pullup: pm_runtime_get_sync() <-- cancels requested autosuspend
     |     /* some code running */
t3   | musb_gadget_pullup: pm_runtime_put() <-- suspends device (may happen before t4!)
     |
t4   | <- suspend is expected here, but device may be already suspended between t3 and t4

So use pm autosuspend in musb_gadget_pullup and prevent such situation

Change-Id: I8b9618c6d24bea3810c736f8fc0195802ce79c55
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
USB: musb: do not proceed with interrupt completions if qh is not ready

It's not safe to modify hw_ep if qh is not ready.
This may corrupt data in musb_qh. In RX/TX completions this
may happen on SMP system with current musb host implementation
The main issue is with musb_giveback function. It unlocks and
and after that locks musb->lock so during this time
musb_qh data may be corrupted. This results in null-pointers
dereferences / programming of busy DMA channel / etc in
different places.

This often happens during unlinking URB for ISO and looks like:
CPU0                                  CPU1
...                                   musb_urb_dequeue
...                                      spin_lock_irqsave(&musb->lock)
...                                      (work with musb_qh)
...                                      musb_giveback
...                                         spin_unlock(&musb->lock)
generic_interrupt()                         ...
   spin_lock_irqsave(&musb->lock)           ...
   (work with musb_qh)                      ...
   spin_unlock_irqrestore(&musb->lock)      ...
...                                         spin_lock(&musb->lock)
...                                      (continues work with musb_qh)
...                                      spin_lock_irqrestore(&musb->lock)

Go out from completion if qh is not ready.

Change-Id: I9c9280a7ab7f8e89b2e8bf745800217f903108fc
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
net: ks8851: report link state change

ks8851 is used in blaze/tablet but its driver doesn't report
the change of link state. Now this event is handled properly

Change-Id: I052673b51ef2be854439b41b2f323888df674d09
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
OMAPDSS: DISPC: Use FIR filters other than M19

Pass correct arguments to FIR filter selection.  Previously we
always ended up selecting M19 5-tap filter.

This should improve image quality of scaled layers.

Change-Id: Iabe3219df7dcfd62c713fd92ee9c3d12221bc382
Signed-off-by: Lajos Molnar <lajos@ti.com>
TWL6032: Fix missing VBUS interrupts after OTG-cable insertion

After OTG-cable is plugged there is no possible to connect PC
to the device (not works adb etc) because VBUS interrupts are
missed. This patch fix it.

Change-Id: Ie045508f05069464e415c4e0dc79c448b696ad98
Signed-off-by: Oleksandr Dmytryshyn <oleksandr.dmytryshyn@ti.com>
PM: OPP: Add opp_find_volt_floor/ceil functions

Add functions to find OPP by voltage value
in the same way as it is made for frequency.

Change-Id: Ic7250258de82ca02d4ee27cfa53bafc7de87685f
Signed-off-by: Taras Kondratiuk <taras@ti.com>
OMAP3+: DVFS: Use opp_find_volt functions instead of _volt_to_opp

Currently OMAP DVFS framework uses _volt_to_opp() function
to find OPP by voltage, but it is made in a hacky way,
because it doens't have access to list of OPP.

That function has a few important limitations:

1. It assumes that each OPP has an unique frequency value
   so it skips next OPPs with the same frequency.
   For example OMAP4 L3 bus has several OPPs which have
   same frequency, but different voltage values.
   So the function is not able to find correct OPP for L3.

2. Rounding direction is not predictable.
   By default function rounds up, but if requested voltage is
   higher that highest OPP voltage, then function rounds down.
   In most places where the function is used, code expect that
   it rounds down which is opposite to default behavior.

The patch change _volt_to_opp() function by opp_find_volt_ceil()
and opp_find_volt_floor() functions.

Change-Id: Iadc47b662924cd6277a008e8cb0d207ef5eb5598
Signed-off-by: Taras Kondratiuk <taras@ti.com>
OMAP3+: OPP: Remove unused _volt_to_opp() function

_volt_to_opp() is not used in the code anymore so can be removed

Change-Id: I2a9f4303c8ef31df928c0414cd6c3b09cd58e219
Signed-off-by: Taras Kondratiuk <taras@ti.com>
OMAP4470: OPP/voltage: Add CORE OPP100 to High Perf CORE OPP set

Initially 4470 High Performance CORE OPP set didn't have OPP100 defined.
That's why when some devices need OPP100 VDD_CORE voltage level
to work at higher frequency they have to scale L3 to OPP-OV.

To fill a gap between OPP50 and OPP-OV a new OPP100 have been added.
It has OPP100 voltage level but keeps L3 frequency at 116MHz.

Both 4470's OPP sets share same OPP depencensies tables,
so a new OPP100H is defined to maintain correct depencencies
in both OPP sets.

Change-Id: Iab44165a4f0a8fecf6888e52a307425bd264e5cd
Signed-off-by: Taras Kondratiuk <taras@ti.com>
OMAP: clock: Add dummy round_rate and set_rate functions

Add functions which are going to be used by dummy virtual clocks:
long clk_dummy_round_rate(struct clk *clk, unsigned long rate)
int clk_dummy_set_rate(struct clk *clk, unsigned long rate)

Change-Id: I9bb1e886888a117548d62ef2edd9598bce2723e6
Signed-off-by: Taras Kondratiuk <taras@ti.com>
OMAP4: clock: Add 'virt_lcd_pclk' clock

Add virtual LCD pixel clock which is going to be used for DSS OPPs

Change-Id: Ia42668873d4dbe75deef22e97cec449a00f987d0
Signed-off-by: Vitaly Chernooky <vitaly.chernooky@ti.com>
Signed-off-by: Taras Kondratiuk <taras@ti.com>
OMAP4: OPP: Add DSS OPPs

To generate pixel clock rate higher than 93MHz
DSS has to scale VDD_CORE to at least OPP100 level.

This patch adds two DSS OPPs, for DSS to be able
to control minimum VDD_CORE level.

Change-Id: I98eab1c3b56fcf41026b742cb43c8155b68dd5c4
Signed-off-by: Taras Kondratiuk <taras@ti.com>
OMAPDSS: DSS: Relax L3 bus bandwidth constraint

In a current codebase L3 BW constraint is set if
any display has resution higher or equal FullHD.

Estimated available DSS bandwidth on L3@OPP50 is ~800MB/s.
It is approximately 3 WXGA layers or almost 1.5 FullHD layers at
60fps rate.

This patch relaxes L3 BW constraint and set it only
if current overlays' configuration needs higher BW.

Change-Id: I45afe36876e9898b45e20901d2b5c2633f32b914
Signed-off-by: Taras Kondratiuk <taras@ti.com>
ARM: OMAP: HS USB Host: fix unbalanced pm calls

There is an issue with unbalanced pm calls.
Only EHCI or only OHCI works good but not together.
Issue appears when OHCI suspends whereas EHCI is active
or vice versa - anyway all HSUSBHOST goes to suspend.
This patch fixes this issue.

Change-Id: Ie4c4e4d4ff210c8ceeec4415569660f8646e8ed5
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
usb: host: omap: add tput constrain on probe path

The patch 9f1d7a334 "usb: host: omap: add tput constrain on bus_resume"
added tput constraint on bus_resume, but the EHCI is active after
probe. So until first suspend-resume iteration the constraint was not set

This patch sets tput constraint on probe path

Change-Id: Id30dc6ae5ac831c0ef284710b917f83ef35add05
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
OMAP4470: OPP: Change IVA OPP100 to CORE OPP dependency

From timing closure point only VDD_CORE should be scaled to OPP100
level for IVA to be able to work at OPP100. L3 frequency can stay
at 116MHz.
So CORE OPP100H can be used as dependent OPP for IVA OPP100.

Change-Id: I2493a4c45d81ebfbfd24600a90bd4ea2d3782c24
Signed-off-by: Oleksandr_Tyshchenko <oleksandr.tyshchenko@ti.com>
USB: OHCI: do not poll root hub status if HC is not running

If the OHCI root hub is suspended the clocks may be
not provided to HW and we get errors on OHCI registers
access. So do not poll it in such cases (like is done
for EHCI)

Change-Id: Ic81833a87c479822fe3c7f23792ee7ac7154e248
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
OMAP4: USBTLL: Off mode disconnect workaround (Errata i754)

When resuming from OFF mode, the EHCI controller was performing a
reset resume for ports using the TLL interface because the port
status was being cleared. This was caused by the host controller
not restoring the state of the ID pin in the TLL module correctly.
This issue is workarounded by enabling the ID pin pull-up in the TLL
(because the EHCI controller is always the host) and disabling ID
pin events as these are not required for the TLL connection.

Change-Id: Ibc22d77606e05e4dd138819079028ebcf254039e
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>