tegra: custom user voltage control

initial implementation inspired by coolbho3k's custom voltage control for
galaxy nexus (OMAP4460)

also added some Processor ID debugging code to properly identify tegra3
variants
Overclock: add ultimate edition to allow quadcore up to 1.55 GHz

Also add Tegra3 Gaming Fix to disallow 1 single core to have higher
frequecy than rest
arm: tegra: grouper: enable hotplug and power_down_on_bus_suspend on otg port

Change-Id: I7e70fe90379679710e6ce6e98c5ead7127b66e0d
 arm: tegra: usb: phy: fix hotplug function

Change-Id: I704fc1d0dfb4e36cfe5410d56b14a444d81e33eb
ARM: tegra: enable ARM errata 764369 for Tegra 3

Change-Id: Ied08087db1aa8409036b6a9c1ca3dc793ca7ae00
Signed-off-by: Dima Zavin <dima@android.com>
video: tegra: dc: set 'min_emc_clk_rate' as minimum emc rate during DC is enabled

tegra_dc_program_bandwidth() is called by tegradc.[01]/[abc] work_queue
(e.g. tegradc.0/a is the work_queue for the window A of DC.0).
suspend/early_suspend is called by "suspend" task in kernel. Since
grouper_panel_early_suspend() and tegra_dc_program_bandwidth() are
called by different tasks and we do not have proper synchronisation
mechanism to tell tegra_dc_program_bandwidth() not to disable emc clock
before grouper_panel_early_suspend() is completed, there is a race
condition in the current implementation and might be causing display
screen mess up in a flash when turning off display.

This patch helps to make sure emc clock rate is enough during DC is
enabled.

Change-Id: Ib1334b92fb797f485abde385f8180df70050e02f
Signed-off-by: Haley Teng <hteng@nvidia.com>
ARM: tegra: grouper: set 'min_emc_clk_rate' as 102MHz for DC0

Change-Id: I983e54ddc0408d84b6e3331de90b811c75de1bfa
Signed-off-by: Haley Teng <hteng@nvidia.com>
arm: tegra: Set Core to 0.95V in LP1

When the device prepares for LP1, the Core voltage is set to the
highest value(1.2V for Enterprise and Kai, and 1.3V for AP37 and
Cardhu). This is to set for some of the driver suspend along the
sequence need a higher emc frequency and thus a higher Core voltage.

Since the sequence of drivers suspend depends on the sequence of
their registration in the table, which in turn is platform-dependent,
there is no right place in the LP1 entry path where the Core voltage
can be set to a lower voltage. Hence, the Core voltage remains high
in LP1 resulting in higher power.

Thus, the only safe location where the Core voltage can be lowered is
once all the drivers are suspended and the DRAM is set in self-refresh,
at the final point just before the system is suspended in the IRAM code.
This location at the assembly code ensures that no other module will be
running and thus that nothing will require a higher core voltage. The Core
is set to the lowest possible value since nothing requires it. It is then
restored to the highest voltage as soon as the LP1 resume code is started
so that all drivers are resumed safely.

At the execution point in IRAM during LP1 suspend path, even the I2C clocks
are gated. They must be reset first and then the I2C transaction is performed.
An I2C transaction involves 4 bytes of data, to send the slave address,
the Core voltage register address and 2 bytes of data which has the value
to set the voltage(the second byte is not required for this transaction).
Once these registers are set, the I2C transaction is performed by setting
the I2C transaction register to 0xA02. After sending the I2C transaction,
we wait for about 250us to check the status of the transaction and if not
updated, wait for more time to check again. If after 2ms and the transaction
fails to register, the transaction is aborted and the device is allowed
to enter at high voltage. Since the failure rate of I2C transaction is very
low at this point in execution where there will be no conflicts in the bus,
it is okay to have Core high for some of the LP1 cycles.

However, it is unacceptable for the I2C transaction to fail on the way
from LP1 resume since the device cannot come up with a lower Core
voltage. In this case, the transaction is retried again and again till
it is successful. There is no way but to keep trying as the device
would fail to resume with Core at 0.95V.

Each platform(or each PMU) has different values for the I2C transaction
ie. slave address, Core voltage register and the value to set the
voltage. For the device in IRAM, it cannot access anything in SDRAM
memory, these values needs to be pushed to IRAM memory before the device
starts execution in IRAM. This is done during initialization of suspend
code when it picks values from the board files and copies it to IRAM
part of code, before the whole memory is copied to IRAM.

This new feature is controlled by a KConfig variable TEGRA_LP1_950 which
should be enabled once the board file of the device is updated with the
right values. The device hangs when it does not have the right values for
the I2C transaction.

With this change in Core, LP1 power is reduced by 12mW in Enterprise,
20mW in AP37 and about 24mW in Kai.

Bug 1035684

Change-Id: I4318c66fd70ab227ef0786d6a13286e020e4541d
Signed-off-by: Karthik Ramakrishnan <karthikr@nvidia.com>
(cherry picked from commit ab476f287376fd0ae51a9f298659f5eba19f0296)
Reviewed-on: http://git-master/r/124779
Reviewed-by: Lokesh Pathak <lpathak@nvidia.com>
Tested-by: Lokesh Pathak <lpathak@nvidia.com>
adapted to use for Nexus Grouper from NV reference

Signed-off-by: faux123 <reioux@gmail.com>
arm: tegra: Board files settings for LP1 0.95V CoreV

Set the register values for each of the board files to
keep the Core voltage to 0.95V in LP1.

This change is only for those platforms where LP1 is supported.
Enterprise and Kai are the main platforms for this change. There
is no support for Cardhu for LP1 and so is left blank and the
feature will be skipped for Cardhu platforms, except for AP37.
AP37 with a PM269 board needs this change and so Cardhu board
file is updated with the values specific to AP37.

This change is part of the feature to set VCore to 0.95V
Refer to http://git-master/r/124135 for more details
Bug 1035684

Change-Id: I6d1d984b0e7968b441cebbc37705c25647a4a85a
Signed-off-by: Karthik Ramakrishnan <karthikr@nvidia.com>
(cherry picked from commit b46921e475bd95e729896a6763bc94df1e03ee4a)
Reviewed-on: http://git-master/r/124780
Reviewed-by: Lokesh Pathak <lpathak@nvidia.com>
Tested-by: Lokesh Pathak <lpathak@nvidia.com>
adapted for use on Grouper from NV reference

Signed-off-by: faux123 <reioux@gmail.com>