omap: remoteproc: correct the rproc data for dsp clkdm

The clock domain name used for dsp in remoteproc data does
not match the one used in the OMAP4 clock data files. The
clkdm field in the rproc data has been updated to use the
correct name for OMAP4.

Change-Id: Ic48f04b36ed8ef1f07eeb0de5902611348c347c2
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Subramaniam C.A <subramaniam.ca@ti.com>
omap: remoteproc: set the load boot address in activate function

This is needed because the register holding the boot address may
lose context if a deep c-state is reached (either during Device
OFF or during suspend) by the power domain where the register
resides.

Save the extracted bootaddr and then populate the boot address
register before taking the remoteproc out of reset in the activate
function to cover both rproc_start and resume paths.

Change-Id: I0ab3a70268877bcf55d053c9144e3fb834b58939
Signed-off-by: Miguel Vadillo <vadillo@ti.com>
rpmsg: omx: use different name for each rproc in device id_table

The rpmsg omx driver currently uses the same name to match a
device during its probe. The cdevs exposed by the driver are
simply created sequentially in the prone based on the discovery
of each device. The devices can be created in a random order
when multiple remote processors are involved, and is merely a
factor of when the remote processor has come up and published
its OMX service.

Userspace is assuming that the second cdev registered is always
for ipu_c1 (/dev/rpmsg-omx1). This is valid only as long as
ipu is the only remote processor being used. ipu_c1 always gets
created second today due to the boot-up sequence of the ipu
cores and the images they are executing, but this may not be
valid always. When dsp is being used, the rpmsg channel devices
for dsp and ipu can be created in any order. This would break
any existing userspace libraries/applications that may be
communicating with different remote processors.

The device id table is updated now to match specific names to
specific processors, so that they always remain the same
irrespective of the boot sequence.
 "rpmsg-omx0"    ipu_c0
 "rpmsg-omx1"    ipu_c1
 "rpmsg-omx2"    dsp

Change-Id: Ia75f944c87b6dffa982ee208dcaadb48f79da42a
Signed-off-by: Juan Gutierrez <jgutierrez@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
OMAP3+: DVFS: ensure proper volt config if curr_volt==new_volt

At times when current_volt is same as new voltage, voltdm_scale is not
invoked. Since, vp_err_gain update and voltdm->curr_volt update is done
as part of vc_prescale and post_scale invoked as part of scale call,
these are left configured to old OPP values even if we are moving
to a new OPP.

Update these when we detect voltdm_scale is not being invoked, but
new OPP Vnom is detected.

Change-Id: Ic45d5a51edb4e5fe526529c6040cd014907b560e
Reported-by: Honda Kenji <x0092217@ti.com>
Reported-by: Maki Tanaka <m-tanaka1@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Thermal Governor: OMAP4: cancel work task while suspending.

Cancel work task while going to suspend and re-schedule after
resume.

Fixes:
	[  331.767303] CPU1: shutdown
	[  331.768310] Resume caused by I/O pad:
	CONTROL_PADCONF_WAKEUPEVENT_4[2]
	[  331.768310]    PD_CORE curr=ON prev=ON logic=ON
	[  331.768310]    PD_L4_PER curr=ON prev=ON logic=ON
	[  331.768310]          I2C1 mode=ENABLED idlest=ON

Change-Id: Ie69f404305e678e93c7b32ddff6ca536b0c9eed3
Tested-by: Ramajayam S <ramajayam.samudi@ti.com>
Signed-off-by: Ambresh K <ambresh@ti.com>
Merge "Thermal Governor: OMAP4: cancel work task while suspending." into p-android-omap-3.0
OMAP4: TWL6032: Stop USB charging if VBUS voltage below limit.

This patch adds ability to set VBUS limit (via sysfs node).
If VBUS below this limit, device stops charging from USB
(and start charging if device VBUS is above this limit).

New sysfs node has been added:
/sys/bus/platform/devices/twl6030_bci/vbus_charge_thres
This node holds VBUS limit value in mV.

Writing to this file cause setting vbus_charge_thres field in
twl6030_bci_device_info structure.

Main work is done by twl6030_usb_autogate_charger() function,
which reads GPADC channel 10 value (VBUS voltage), compare it
with limit value and tunrns on/off USB charger.
This function is called from twl6030_bci_battery_work()
function (also known as twl6030_bci_monitor_work workqueue).
There is also additional check in twl6030_start_usb_charger()
function, to prevent charging from low voltage USB source.

Change-Id: I5b9fb557cf60d69588f8d1234cffb606f185e207
Signed-off-by: Mykola Oleksiienko <x0174904@ti.com>
TI Thermal Governor: Updated the parameters for OMAP hot spot extrapolation

Due to a different OMAP die size between OMAP4460 and OMAP4470, the parameters
used to extrapolate the hot spot temperature from
the on-die sensor and the PCB sensor are different between 4460 and 4470.
When running thermal simulations, it appears that current parameters used on
OMAP4460 are not optimal.

This patch adds the capability to select the slope/const parameters according
to the OMAP44xx silicon revision and aligns these parameters with latest thermal
simulations (28th March 2012).

Change-Id: I828291504f6a23a1640c589af2d4913cf00f9745
Signed-off-by: Sebastien Sabatier <s-sabatier1@ti.com>
OMAP4: USB: Update EHCI TLL errata i640

The workaround for EHCI TLL i640 errata has a critical timing window between
clearing the FPR bit in the PORTSC register and cutting the TLL clock. The
register writes to clear the FPR bit and cut the TLL clock need to occur in
back to back instructions otherwise we could still experience a disconnect
as described in the original errata. The ehci_writel function will cause a
L2 cache flush and so when compile takes multiple instructions. Instead of
using ehci_writel use __raw_readl.

Change-Id: Iaacf6987e37a1096b9d1c59fb3e71eb0f1c7aac3
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
I2C: OMAP: NACK without STP

On OMAP4 OMAP_I2C_STAT_NACK is causing a timeout on the next access.
The isr cleans all flags in OMAP_I2C_CON_REG by setting OMAP_I2C_CON_STP
OMAP_I2C_CON_STP is also set in omap_i2c_xfer_msg on the last message.

According to the TI TSR the sequence for OMAP_I2C_STAT_NACK and
OMAP_I2C_STAT_AL are nearly the same.
Removing the OMAP_I2C_CON_STP part in the isr fix the problem.
Tested on OMAP4430 and OMAP3530 (here NACK was not a problem)
Fixes also booting on 2430sdp.

[Picked from http://patches.linaro.org/1899/]

Change-Id: I9bdeba8853ced27659770ad9390bd1b4be573155
Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
TI thermal framework: Remove unused index

This patch removes index information as it is never used.

Change-Id: Ic2bfb1677d8fec2cafa7b47626deb432232a0ef6
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: improve thermal domain manipulations

This patch changes the thermal device data structures
to have a pointer to thermal domain. This way, once
an operation is required on a thermal device, there is
no need to iterate on thermal domains lists.

This patch also centralizes the operations to search and create
thermal domain data structures. Idea is to improve code readability,
having these operations done in one place only.

The patch does not change the code functionality so far.

Change-Id: I482d82feac854270c300273efbef0ef07cdec0b2
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
gccore: fixed power off/on transition.

Simplify the power transition functionality, there is now just
an OFF and ON transition and the initial state is UNKNOWN.

This patch also enables GC320 to power off when at suspend time
(though it does not have an explicit suspend/resume handler).

ON means running at full speed, it enables the GC320 FCK, clears
the GC320 out0 idle state and enables interrupts.

OFF means enabling pulse keeping, setting the idle bit in the out0
GC320 status register and disabling the functional clock for GC320.

However note that this does not explicily power off the GC320 core,
however when the DSS & the system enters suspend the interface clock
appears to be disabled and this results in the GC320 h/w turning off.

Change-Id: I7d3187ca0b5dd803af81c22a8407067a6aaeb5cd
Signed-off-by: Alexei Shlychkov <shlychkov@gmail.com>
Signed-off-by: Tony Lofthouse <a0741364@ti.com>
TI thermal framework: release allocated memory for thermal domains

Upon module exit, release all memory allocated on thermal domains.

Change-Id: I74640cc9a9b74dd9cd0a62253ca2444bd00ac31b
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: No need to return on end of void functions

Remove unnecessary return at the end of void functions

Change-Id: I6e53e8c1d7b7d33e867b836013a0fecb3f38a3c1
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: standardize thermal device ops

This patch changes the .process_temp callback of governor
type of thermal devices. The aim is to make all callbacks
standard. Now, all callbacks receive as first parameter
the affected thermal device.

Change-Id: I9857146e852a7f7d6ac502d044b7f104aa7eb466
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: introduce thermal_device_call helper macro

This patch adds a helper macro to call thermal device callback
functions. It will include some pointer checks before calling
the callback. In case the pointer checks fails, it will return
-EOPNOTSUPP, otherwise the callback return value.

The patch also improves the thermal framework core code by
using this helper macro.

Change-Id: I7db80271ec2509eb14670ae04532cff06cdf002c
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: remove unnecessary checks on thermal domain list

The domain can be fetch from each thermal device. Because of that,
there is no need to check for the emptiness of thermal domain list.

Change-Id: I786b82f6353711c376bcfcb24d0cca5eeb96a8d3
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: avoid free memory not allocated by the fw

Because the objects passed to the thermal framework are already
allocated, it does not make sense to free them inside the thermal
framework. This patch removes all memory release calls to memory
areas not owned by the thermal framework.

Change-Id: Ie49e99b7f6285cf435f5eab7ad26a61257ed86df
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: add helper macro to call ops on several thermal devices

This patch introduces a helper macro to execute same callback of several
thermal devices, linked by a list. It will attempt to reach all devices,
even if some of them are missing the callback or if the callback is
returning error values.

Because of the introduction of this helper, there is no need to have
a specific function to set the cooling level on a list of cooling devices.

Change-Id: I430a885400c17b81e98736c9a0ca1b675493b610
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>