OMAP4: PM: setup initial OPP configuration

pm.c setups the initial voltage and frequencies for init devices
on bootup to be careful of invalid device configurations by
custom bootloaders. However, DVFS data structures are not aware
of these - As a result, when doing the first time scale of
a differnt device we could have a following scenario:

At boot - MPU,IVA,Core at OPP100

after pm framework has completed initialization, lets say IVA/AESS
transitions to OPP50, DVFS framework does not have information about
the OPP current frequency/voltage of IVA/MPU and sees that only
IVA is requested, moves the IVA and core to OPP50. This configuration
is invalid as MPU is currently at OPP100 and device should not have
scaled core to OPP50 without looking at OPP100 configuration of
MPU.

To resolve this, we populate the dvfs data structure with the
requisite init devices' frequency configuration by doing a
omap_device_scale.

Change-Id: Ib3048fb7fadec5adabbbcbce56c1ead026953de6
Reported-by: Hemanth V <hemanthv@ti.com>
Tested-by: Akash Choudhari <akashc@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
HACK: OMAP2+: Makefile: sequence SR earlier than idle init

SR should be initialized in sequence before idle initialization
is done and after pm basic inits are complete. PM initialization unfortunately
is not too smart and has to depend on initcall sequencing to ensure
proper dependencies are met. instead of fixing the entire PM init
sequence(which is possible with function pointers being registered and invoked,
but needs an entire revamp of OMAP PM's infrastructure), move SR initialization
up in the chain to ensure this works.

Change-Id: I643f73168753f618ccac6fd34b135aeb93923637
Signed-off-by: Nishanth Menon <nm@ti.com>
OMAP: TILER: Add bounds checking on format inputs

Added bounds checking to validate incoming tiler format.

Change-Id: Icd791cc294ecb1838afb3f91451626debd59c29e
Signed-off-by: Andy Gross <andy.gross@ti.com>
SMC: Update to AG01.06 production release

Last SMC update was to AG01.06 engineering release (see s_version.h)
this is the official patch to production AG01.06.

This update notably brings support for:
  * OMAP4 HW RNG - see new menuconfig option
  * GP devices are okay to be built with this SMC based on testing
      (even though it is not functional for GP devices, the SMC driver
      will no longer keep the device from entering suspend)

Change-Id: I974693ca73a038e2b547917e1a9556299a9bab11
Signed-off-by: Trusted Logic <smc_support@trusted-logic.com>
Signed-off-by: Jeremie Corbier <jeremie.corbier@trusted-logic.com>
Signed-off-by: Bryan Buckley <bryan.buckley@ti.com>

Conflicts:
	security/smc/Makefile
SMC: Fix PA load error 0xffff3020

Fix "Error while loading the PA [0xffff3020]"

Improve synchronous public crypto.

WARNING: using this patch with an older PA binary (before MSHIELD
v1.7.5) will result in a PA load error. This patch is coupled with
changes in the secure PA (cache flush/invalidiation)

Change-Id: I3c3b7c41917b1146d6cb6f29ee33848eb9c3c0dc
Signed-off-by: Trusted Logic <smc_support@trusted-logic.com>
Signed-off-by: Bryan Buckley <bryan.buckley@ti.com>
SMC: Fix regression where AES1 clock would never be disabled

Change-Id: I3b620a573b2eee85c76036bcdab9f851ce9c7513
Signed-off-by: Trusted Logic <smc_support@trusted-logic.com>
Signed-off-by: Jeremie Corbier <jeremie.corbier@trusted-logic.com>
OMAP: HDMI: Correction in HDMI PLL program sequence

Current code sets PLL_GO to 1 and the waits for the PLL_GO to
become 1. This is not required and instead we should wait for
PLL_GO to become zero. As per TRM once PLL operation is over
PLL_GO bit will be reset to zero. After waiting for PLL_GO to
become zero PLL_STATUS register is read to check the PLL LOCK
status.

Change-Id: If077695ee95d07df354d97f2b88cf64db94bc27e
Signed-off-by: Muralidhar Dixit <murali.dixit@ti.com>
OMAP4: DSI: DSI reset removal during enabling

DSI module is made wake up capable in its HWMOD flags but in
The function omapdss_dsi_display_enable(), DSI module is
reset thus values set in DSI_SYSCONFIG is lost because of which
DSI is no longer wakeup capable. This prevents any interrupt from
DSI to be permeated to A9 when A9 sleeping.this reset is not
required while enabling the display thus now it is removed.so it
retains the HWMOD settings.

Now with this fix, the mdelay() within dsi_vc_send_bta_sync(), is removed
and a proper interrupt based implementation is done.

Change-Id: If6c3d25a5ba8003a0bd7732af0fcd81a839293aa
Signed-off-by: Sujeet Kumar Baranwal <s-baranwal@ti.com>
OMAP4: ERRATA: ARM: Fix ARM Errata 742230

Errata 742230: This Errata workaround requires bit 4 to be set in the CP15
diagnostic control register. This patch takes care of this errata fix for GP
devices at CPU init time and at the cpu_resume stage.

Change-Id: I5244bec9544fddc9fff33ca2903f5ec19bcc52a7
Signed-off-by: Ruchika Kharwar <ruchika@ti.com>

Conflicts:
	arch/arm/mach-omap2/Kconfig
OMAP4: ERRATA: ARM: Fix ARM Errata 751472

Errata 751472: This Errata workaround requires bit 11 to be set in the CP15
diagnostic control register. This patch takes care of this errata fix for GP
devices at CPU init time and at the cpu_resume stage.

Change-Id: I3a8d2b825ac59719233275a77c5fbf5175b35bcb
Signed-off-by: Ruchika Kharwar <ruchika@ti.com>
OMAP4: ERRATA: ARM: Fix ARM Errata 743622

Errata 743622: This Errata workaround requires bit 6 to be set in the CP15
diagnostic control register. This patch takes care of this errata fix for GP
devices at CPU init time and at the cpu_resume stage.

Change-Id: I6b9cf510ca631f74da4ce2f31c1190a2216aa5bb
Signed-off-by: Ruchika Kharwar <ruchika@ti.com>
OMAP4: PM: errata: Wkup clk recycling needed after warm reset.

As W/A the call to omap4_trigger_ioctrl() has been added
at PM initialization time for I/O pads daisy chain reseting.

TI EID: i612; IMPACTED: OMAP4430 all revisions

Change-Id: Ifff5cf4ed79e15bbeed97dd2b1cc7d7cf19d2387
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
omap4: control: Add the CONTROL_SMART2IO_PADCONF_2 register definition

This patch adds missing CONTROL_SMART2IO_PADCONF_2 register
definition

Change-Id: I9bec7e1e95e7b86ae6c5c4e0f457370c8db20e4a
Signed-off-by: Ruslan Bilovol <x0155540@ti.com>
serial: Fix wakeup init logic to speed up startup

The synchronize_rcu() call resulting from making every serial driver
wake-up capable (commit b3b708fa) slows boot down on my Tegra2x system
(with CONFIG_PREEMPT disabled).

But this is avoidable since it is the device_set_wakeup_enable() and then
subsequence disable which causes the delay. We might as well just make
the device wakeup capable but not actually enable it for wakeup until
needed.

Effectively the current code does this:

	device_set_wakeup_capable(dev, 1);
	device_set_wakeup_enable(dev, 1);
	device_set_wakeup_enable(dev, 0);

We can just drop the last two lines.

Before this change my boot log says:
[    0.227062] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.702928] serial8250.0: ttyS0 at MMIO 0x70006040 (irq = 69) is a Tegra

after:
[    0.227264] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.227983] serial8250.0: ttyS0 at MMIO 0x70006040 (irq = 69) is a Tegra

for saving of 450ms.

Change-Id: I1bab007560d888b9fc341efc25bb9cd332be16df
Suggested-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Huzefa Kankroliwala <huzefank@ti.com>
OMAP4: PM: Enforce CPU0 waking from OFF/OSWR first for GP devices also

Note:
Patch with change Id I82c5880ec2d9a98a54755dfbd01aa981cfed9852
introduced this work around by default for all HS devices using PPA
version 1.6.4 or older.

It is determined that for GP devices the same workaround should be employed.

Change-Id: I3d307d7e6a9fb4532bd3017c0a452de8f612b314
Signed-off-by: Bryan Buckley <bryan.buckley@ti.com>
Signed-off-by: Carlos Leija <cileija@ti.com>
ARM: OMAP4: Report clock module timeouts when enabling

When a clock module is enabled, we wait for the idle-status to indicate that
the module is now enabled before continuing. Although the current code returns
an error if the idle-status does not change, we do not display any warning
message to the user. So print a message if the module idle-status does not
change as expected.

Change-Id: Ia6583174ac209f78aeecefc80cd9872d899246a2
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
ARM: OMAP4: Only wait for module ready for clocks enabled via MODULEMODE

Some clocks are enabled by programming the MODULEMODE bit field of the PRCM
CLKCTRL registers. For these clocks, we should wait for the module to
transition from the idle state when we enable them. For other clocks, such as
optional clocks, that are enabled via other bits in the CLKCTRL registers, the
idle state is not updated when we enable them and so we should not wait for
the idle state to change when we enable them. This is causing unnecessary
delays to occur when enabling optional clocks as we are waiting for the idle
state to change and eventually timeout.

Change-Id: Iaa8a86d38a55b4faa95988c48e4bac0e772c7492
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Signed-off-by: Huzefa Kankroliwala <huzefank@ti.com>
USB: OTG : Wake lock holding decision based on usb connect/disconnect

Descpription: Currently the wakelock is held based on usb_cinlimit_mA.
Expected behaviour is that when the cable is disconnected usb_cinlimit_mA
should be zero. But some times when the USB cable is disconnected usb_cinlimit_mA
is still not zero. An additional condition is added to not hold the wake_lock in such
scenerio.

Change-Id: Id7815018354b35ff87224481047d4ee0365d709f
Signed-off-by: Shivasharan Nagalikar <shivasharan.nagalikar@ti.com>
usb: musb: Turn off the PHY while doing interface selection

The OMAP4 TRM says that for USB OTG, interface selection
has to be done before the PHY is activated and is not allowed
to change when the PHY clock is already running.

For charger detection, the interface selection was done with
the PHY kept on, this was resulting in random hotplug failures
at times. This patch corrects the issue.

Change-Id: I2385c4e5d5a3d669452af4507557c158e7b48dfc
Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
USB: MUSB: Fix: Device detection for disconnect-connect in less than a sec

It is observed that when a device is removed and connected with less
than a second time gap, we get the following error message and enumeration
fails:

"musb_stage0_irq 790: unhandled DISCONNECT transition(a_idle)"

This patch changes the delay to invoke musb_do_idle() to 0 (~7ms) so
that hotplug of devices done within a second time frame are also detected.

Change-Id: I84e66716ea43a67806af4857932b46133d665eb5
Signed-off-by: Madhava Chirukuri <x0172945@ti.com>
Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>