drm/omap: fix plane's channel selection

omap_plane_pre_apply() sets the plane's output channel too late, only
after the plane has already been otherwise configured and enabled. This
causes problems, as at the configuration stage we need to make decisions
based on the output channel.

This may lead to bad plane settings or failing to setup the plane.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
OMAPDSS: DISPC: fix div by zero issue in overlay scaling

omapdrm doesn't always configure the overlays correctly, causing the
overlay setup functions to be called with zero timings. This leads to
division by zero error.

This happens, for example, when a HDMI cable is not connected, but a
user tries to setup a plane with scaling.

Fixing omapdrm is a big job, so for now let's check for the bad timings
in DISPC and return an error.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
usb: dwc3: dwc3-omap: get rid of ->prepare()/->complete()

Enabling the core interrupts in complete is too late for
XHCI, and stops it from proper operation. The root of the
problem is due to a disagreement between dwc3-omap and XHCI
about when IRQs should be enabled.

As it turns out, ->resume's documentation states that:

"... generally the driver is expected to start working
again, responding to hardware events and software requests
(the device itself may be left in a low-power state, waiting
for a runtime resume to occur) ..."

From that we infer that IRQs must be unmasked by the end of
->resume().

Due to that, we will remove ->prepare() and ->complete() and
disable/enable interrupts in ->suspend()/->resume().

Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
usb: dwc3: get rid of ->prepare()/->complete()

Using ->prepare()/->complete() to mask/unmask
IRQs is wrong at least for dwc3. We need to
make sure that by the end of ->resume(), IRQs
are working and ready to fire because a child
device may need working IRQs for its own ->resume()
method.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[george.cherian@ti.com] Ported for 3.14 with a minor fix to
do dwc3_event_buffers_setup() before doing dwc3_gadget_resume()
Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
usb: musb: musb_dsps: fix NULL pointer in suspend

So testing managed to configure musb in DMA mode but not load the
matching cppi41 driver for DMA. This results in

|musb-hdrc musb-hdrc.0.auto: Failed to request rx1.
|musb-hdrc musb-hdrc.0.auto: musb_init_controller failed with status -517
|platform musb-hdrc.0.auto: Driver musb-hdrc requests probe deferral

which is "okay". Once the driver is loaded we re-try probing and
everyone is happy. Until then if you try suspend say
	echo mem > /sys/power/state
then you go boom

|Unable to handle kernel NULL pointer dereference at virtual address 000003a4
|pgd = cf50c000
|[000003a4] *pgd=8f6a3831, *pte=00000000, *ppte=00000000
|Internal error: Oops: 17 [#1] ARM
|PC is at dsps_suspend+0x18/0x9c [musb_dsps]
|LR is at dsps_suspend+0x18/0x9c [musb_dsps]
|pc : [<bf08e268>] lr : [<bf08e268>] psr: a0000013
|sp : cbd97e00 ip : c0af4394 fp : 00000000
|r10: c0831d90 r9 : 00000002 r8 : cf6da410
|r7 : c03ba4dc r6 : bf08f224 r5 : 00000000 r4 : cbc5fcd0
|r3 : bf08e250 r2 : bf08f264 r1 : cf6da410 r0 : 00000000
|[<bf08e268>] (dsps_suspend [musb_dsps]) from [<c03ba508>] (platform_pm_suspend+0x2c/0x54)
|Code: e1a04000 e9900041 e2800010 eb4caa8e (e59053a4)

because platform_get_drvdata() returns a NULL pointer as long as the
device is not fully probed.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
ARM: dts: am335x-evmsk: enable DMA controller for USB

[ Upstream commit cae2a9e3abf27ad4eb0c0341bf34e4a6349c314f ]

Enable DMA controller for USB

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
ARM: OMAP2+: sleep43xx: Add omap_bus_sync style accesses

According to AM437x Silicon Errata document (SPRZ408, June 2014)
Advisory 11, the SoC also suffers from the potential Asynchronous Bridge
Corruption issues seen on OMAP4, which were corrected by 137d105d5. Add
omap_bus_sync style accesses to DRAM and SRAM to avoid hangs during
suspend/resume by perfoming one strongly ordered write to DRAM and one
to SRAM before calling WFI in the suspend path assembly code.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
ARM: OMAP2: sleep43xx: Access registers to avoid TLB miss

Access the three registers that we need to access after EMIF is placed
in DDR to make sure they are present in TLB to avoid a miss and walk of
page table in DDR, which is not possible once DDR is shut off and will
lead to a hang in suspend path if attempted.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Merge branch 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel into ti-linux-3.14.y

TI-Feature: connectivity
TI-Tree: git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel.git
TI-Branch: connectivity-ti-linux-3.14.y

* 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel:
  ARM: dts: am335x-evmsk: enable DMA controller for USB
  usb: musb: musb_dsps: fix NULL pointer in suspend
  usb: dwc3: get rid of ->prepare()/->complete()
  usb: dwc3: dwc3-omap: get rid of ->prepare()/->complete()

Signed-off-by: Dan Murphy <DMurphy@ti.com>
Merge branch 'pm-ti-linux-3.14.y' of git://git.ti.com/~kristo/ti-linux-kernel/pm-linux-feature-tree into ti-linux-3.14.y

TI-Feature: power_management_base
TI-Tree: git://git.ti.com/~kristo/ti-linux-kernel/pm-linux-feature-tree.git
TI-Branch: pm-ti-linux-3.14.y

* 'pm-ti-linux-3.14.y' of git://git.ti.com/~kristo/ti-linux-kernel/pm-linux-feature-tree:
  ARM: OMAP2: sleep43xx: Access registers to avoid TLB miss
  ARM: OMAP2+: sleep43xx: Add omap_bus_sync style accesses

Signed-off-by: Dan Murphy <DMurphy@ti.com>
Merge branch 'audio-display-ti-linux-3.14.y' of git://git.ti.com/~darrene/ti-linux-kernel/audio-display-linux-feature-tree into ti-linux-3.14.y

TI-Feature: audio-display
TI-Tree: git://git.ti.com/~darrene/ti-linux-kernel/audio-display-linux-feature-tree.git
TI-Branch: audio-display-ti-linux-3.14.y

* 'audio-display-ti-linux-3.14.y' of git://git.ti.com/~darrene/ti-linux-kernel/audio-display-linux-feature-tree:
  OMAPDSS: DISPC: fix div by zero issue in overlay scaling
  drm/omap: fix plane's channel selection

Signed-off-by: Dan Murphy <dmurphy@ti.com>
ARM: dts: AM437x-SK-EVM: Fix DCDC3 voltage

On older PMICs the reset value of the DCDC3 voltage was different.
Fix DCDC3 volatge to 1.5V which is the right value to be supplied by
DCDC3 for all the production boards(Version 1.4+).

Tested-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
ARM: dts: AM437x-GP-EVM: Fix DCDC3 voltage

On older PMICs the reset value of the DCDC3 voltage was different.
Fix DCDC3 volatge to 1.5V which is the right value to be supplied by
DCDC3 for all the production boards(Version 1.4+).

This fixes the boot hang issue during the regulator initialization stage.

Tested-by: Aparna Balasubramanian <aparnab@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
ARM: dts: AM43x-EPOS-EVM: Fix DCDC3 voltage

On older PMICs the reset value of the DCDC3 voltage was different.
Fix DCDC3 volatge to 1.5V which is the right value to be supplied by
DCDC3 for all the production boards(Version 1.4+).

Signed-off-by: Keerthy <j-keerthy@ti.com>
drm/tilcdc: correct the dmachannel tracking logic

dma_channel_completed should be reset to channel 0 when the start function is
called and the dma channel in use should be tracked even when no flip is
pending.

Signed-off-by: Darren Etheridge <detheridge@ti.com>
drm/tilcdc: make frame completion interrupt always enabled

DRM allows vblank handling to be controlled dynamically.  Therefore if vblank
interrupts are not needed by anybody they are disabled.  However on tilcdc a
ping-pong dma is used and there is no way to find out from the hardware which
dma channel will be used for the next frame to program the corresponding dma
registers with the new framebuffer address. The only way currently known is to
use the vsync handler to track the channel currently used.  This means that
disabling the vsync is a bad idea because it is always needed to track the dma
channel.

This patch removes the enable/disable_vblank functions, moves the enabling of
the FRAME0/FRAME1_DONE interrupts into the post_install_interrupt handler so
they are always active and removes the calls to drm_vblank_get,
drm_vblank_put.

Signed-off-by: Darren Etheridge <detheridge@ti.com>
Merge branch 'pm-ti-linux-3.14.y' of git://git.ti.com/~kristo/ti-linux-kernel/pm-linux-feature-tree into ti-linux-3.14.y

TI-Feature: power_management_base
TI-Tree: git://git.ti.com/~kristo/ti-linux-kernel/pm-linux-feature-tree.git
TI-Branch: pm-ti-linux-3.14.y

* 'pm-ti-linux-3.14.y' of git://git.ti.com/~kristo/ti-linux-kernel/pm-linux-feature-tree:
  ARM: dts: AM43x-EPOS-EVM: Fix DCDC3 voltage
  ARM: dts: AM437x-GP-EVM: Fix DCDC3 voltage
  ARM: dts: AM437x-SK-EVM: Fix DCDC3 voltage

Signed-off-by: Dan Murphy <DMurphy@ti.com>
Merge branch 'audio-display-ti-linux-3.14.y' of git://git.ti.com/~darrene/ti-linux-kernel/audio-display-linux-feature-tree into ti-linux-3.14.y

TI-Feature: audio-display
TI-Tree: git://git.ti.com/~darrene/ti-linux-kernel/audio-display-linux-feature-tree.git
TI-Branch: audio-display-ti-linux-3.14.y

* 'audio-display-ti-linux-3.14.y' of git://git.ti.com/~darrene/ti-linux-kernel/audio-display-linux-feature-tree:
  drm/tilcdc: make frame completion interrupt always enabled
  drm/tilcdc: correct the dmachannel tracking logic

Signed-off-by: Dan Murphy <DMurphy@ti.com>