ARM: add cpufreq transition notifier to adjust loops_per_jiffy for smp

If CONFIG_SMP, cpufreq skips loops_per_jiffy update, because different
arch has different per-cpu loops_per_jiffy definition.

Ported from upsteam v3.7-rc1 ec971ea5f2426a0bf9d5cca9a103743918c12978

Change-Id: I55ad39b54811957b7229cf341a15991bda3fca76
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
[taras@ti.com: ported from v3.7-rc1]
Signed-off-by: Taras Kondratiuk <taras@ti.com>
cpufreq: OMAP: remove loops_per_jiffy recalculate for smp

With ARM smp common code recalculating loops_per_jiffy in a cpufreq
transition notifier call, the loops_per_jiffy recalculate in omap-cpufreq
driver becomes redundant.  Remove it.

Ported from upstream v3.7-rc1 cd664cc3a574b30988476143c1dcc9298b1fa531

Change-Id: Icab6ddd4fb2d222dd4b2f4756e328ef13d205f29
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
[taras@ti.com: ported from v3.7-rc1]
Signed-off-by: Taras Kondratiuk <taras@ti.com>
ARM: OMAP5: UART: Add UART1 support for OMAP5430/5432 ES2.0

OMAP5430/5432 ES2.0 supports UART1, but uses different pins.

Change-Id: Id56360f9b4c9550a7db07c32579ca6b643d6d274
Signed-off-by: Oleg Matcovschi <oleg.matcovschi@ti.com>
Merge branch 'p-linux-omap-3.4' into p-android-omap-3.4

* p-linux-omap-3.4:
  ARM: OMAP5: UART: Add UART1 support for OMAP5430/5432 ES2.0

Change-Id: I94db5c611a6a620a34f0c8a2727b4e495b3e29f4
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
ARM: 7565/1: sched: stop sched_clock() during suspend

The scheduler imposes a requirement to sched_clock()
which is to stop the clock during suspend, if we don't
do that any RT thread will be rescheduled in the future
which might cause any sort of problems.

This became an issue on OMAP when we converted omap-i2c.c
to use threaded IRQs, it turned out that depending on how
much time we spent on suspend, the I2C IRQ thread would
end up being rescheduled so far in the future that I2C
transfers would timeout and, because omap_hsmmc depends
on an I2C-connected device to detect if an MMC card is
inserted in the slot, our rootfs would just vanish.

arch/arm/kernel/sched_clock.c already had an optional
implementation (sched_clock_needs_suspend()) which would
handle scheduler's requirement properly, what this patch
does is simply to make that implementation non-optional.

Note that this has the side-effect that printk timings
won't reflect the actual time spent on suspend so other
methods to measure that will have to be used.

This has been tested with beagleboard XM (OMAP3630) and
pandaboard rev A3 (OMAP4430). Suspend to RAM is now working
after this patch.

Thanks to Kevin Hilman for helping out with debugging.

For reference see:
- https://patchwork.kernel.org/patch/1625361/

Change-Id: I266d616765b12a2d0ad1f7f781533c8362801201
Acked-by: Kevin Hilman <khilman@ti.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
[grygorii.strashko@ti.com - back port from main line K3.8]
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Merge branch 'p-linux-omap-3.4' into p-android-omap-3.4

* p-linux-omap-3.4:
  ARM: 7565/1: sched: stop sched_clock() during suspend

Change-Id: I85126b6da0a99e9f3f53d87f7c3c77e0b0310817
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
ARM: OMAP4: VP: Remove constants that shouldn't be public

An access to the constants should be through *vp_data->vddmin and
*vp_data->vddmax. They are used only in vp44xx_data.c, so remove
them from voltage.h

Change-Id: I8dd5fa8a34f464b8b1c89d178dffcda409c14886
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
ARM: OMAP4: VP: split VP register settings between chips

Add opportunity to tune VP register settings separately for
each chip.

Change-Id: I10730fdaf02579bb3d3cc00524811c4f7f57c80f
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
ARM: OMAP4430: VP: update recommended VP registers settings

Settings for vddmax and vddmin were different from recommended.

OMAP4430 Operating Conditions Data Manual Addendum
Revision 0.9 (June 2012).

VDDMAX = nominal voltage of maximum OPP
VDDMIN = retention voltage

Change-Id: Ibf9f46eef76da7858245b028558a69e0de4a645b
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
ARM: OMAP4460: VP: update recommended VP registers settings

Settings for vddmax were different from recommended.

OMAP4460 Operating Conditions Data Manual Addendum
Revision 0.6 (June 2012).

VDDMAX = nominal voltage of maximum OPP
VDDMIN = retention voltage

Change-Id: I21b474155c3d830ace3c38eb36d40f8f52df36e6
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
ARM: OMAP4470: VP: update recommended VP registers settings

Operating Conditions Data Manual Addendum
Revision 0.7 (October 2012).

VDDMAX = nominal voltage of maximum OPP
VDDMIN = retention voltage

Change-Id: If90544dc2fd0493ae10bd9669fa12f01e2e33485
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
ARM: OMAP: DMA: fix wrong memory access during context save/restore

The DMA driver saves/restores all channel's specific registers during
suspend/resume. Number of channel's specific registers specified by
variable "ch_spec_regs" which may have values in range [0..21] or
[0..18]. But  omap2_dma_context_save/omap2_dma_context_restore functions
go out of higher limit range while working with such registers.

for (i = 0; i <= ch_spec_regs; i++)
              ^^ wrong condition

As result system crashes during suspending with:
[   15.487426] Unable to handle kernel paging request at virtual address
41341ea0

Hence, fix it.

Change-Id: I4c4d5952344248d954a08769ee604160a94eee73
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
[taras@ti.com: removed spurious changes]
Signed-off-by: Taras Kondratiuk <taras@ti.com>
apply spi patch: https://lkml.org/lkml/2012/5/10/157
power cleanup
Merge "ARM: add cpufreq transition notifier to adjust loops_per_jiffy for smp" into p-linux-omap-3.4
Merge "cpufreq: OMAP: remove loops_per_jiffy recalculate for smp" into p-linux-omap-3.4
Merge "ARM: OMAP: DMA: fix wrong memory access during context save/restore" into p-linux-omap-3.4
ARM: OMAP3+: voltage: fix highest pwr state selection during AUTO RET
enabling

VD AUTO RET may be enabled when VD usecount==0 and all power domains in
VD have been configured to power state lower then PWRDM_POWER_INACTIVE.
But, VD AUTO RET will never be enabled in case if VD contains at least
one always ON power domain. As result, CORE VD AUTO RET has never been
enabled on OMAP4/5.

Hence, fix it by excluding ALWAYS ON power domains from processing.

Change-Id: Ie2bea70b86b0bbf788206415a6349284c055bcad
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
ARM: OMAP4+: USB: power down MUSB PHY during boot

Now if USB support isn't enabled in defconfig It causes a problem
with core retention as the MUSB module remains enabled if omap-usb2 phy
driver is not used.
This keeps the USB DPLL enabled and prevents l3_init pwrdm from idling.

Fixed by adding a minimal function that disables the USB PHY during
boot.

For ref. see:
https://patchwork.kernel.org/patch/1720871/
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-November/130961.html

Change-Id: I9ae1d8ddfca3ce4bc5f23ca369595e89d6a85cdd
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
[grygorii.strashko@ti.com: back port from K3.8;
add usage of Control Module APIs and definitions]
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
ARM: OMAP: PM: Code cleanup (externs moved to header)

Some code cleanup was made.
Declarations of wakeup_timer_seconds and
wakeup_timer_milliseconds variables moved to header file
to avoid using externs in *.c.
Functionality didn't changed.

Change-Id: Ia647c69c154167be231eaad547bbfe83b50f374f
Signed-off-by: Oleg_Kosheliev <oleg.kosheliev@ti.com>