ENGR00227425 mx6sl: Need to save all registers before calling C function

Different linker may use r12, we should save/restore all
registers(r0-r12) before calling C function to prevent
these registers from corruption in C code.

Signed-off-by: Anson Huang <b20788@freescale.com>
ENGR00227426 MX6SL-Fix bugs in low power IDLE mode

Need to ensure that DDR IO pads are not floated when
a peripheral that needs DDR is active, for ex SDMA.
Also need to keep IPMUX clock enabled even when ARM
is in WFI, so set the CCGR bits accordingly.

Signed-off-by: Ranjani Vaidyanathan <ra5478@freescale.com>
ENGR00227422: ARM: imx6sl: Adjust ARM and SOC stby voltages

According to the latest specification data, these rails should
go no lower than 900mV in standby mode.  This patch modifies
the existing mx6sl board files and sets the pmic standby voltage
for these rails to be 925mV (extra 25mV to account for pmic accuracy).

Signed-off-by: Robert Lee <robert.lee@freescale.com>
ENGR00225700: ARM: mx6sl: Fix suspend/resume lockup

Currently, the sequence and functionality we use to enter and exit
suspend causes us to hang upon resuming.  It appears that this is being
caused by two things.  The first is the powering off of the 2p5 rail
which powers the IO pullups and  pulldowns.  The DQS pins were
configured as pull downs.  The second is switching the DQS pins from
differential to CMOS mode (and back).  This second problem only
occurs on a few EVK boards.

It is believed that these changes are causing glitches on the mmdc DQS
pins which is putting garbage in the FIFO (or causing some other FIFO
problem).  This patch adds two mmdc0 FIFO resets after exiting the
suspend.  Two are thought to be needed per previous FIFO reset
experience by Mike Kjar.

Since the MMDC0 FIFO will be cleaned each time, we can now remove
the code that configured the DQS lines as pull downs as we no
longer care if they float.

Signed-off-by: Robert Lee <robert.lee@freescale.com>
ENGR00226392 MX6SL Bluetooth: Setup uart2 to enable bluetooth

Setup uart2 to enable bluetooth basic functionality on mx6sl evk board.
DMA mode was not enabled for uart2 operation.

Signed-off-by: Lionel Xu <Lionel.Xu@freescale.com>
ENGR00220469 mmc: sdio: claim host on suspend and release on resuming

issue:
Since there's no sync mechanism between sdio bus suspending and sdio_irq_thread,
it will cause that sdio_irq_thread still makes sdhc request even after sdio bus
suspends.

fix:
On suspending sdio bus, claim host, so that:
1. mmc_sdio_suspend will wait for finishing of sdio_irq_thread.
2. sdio_irq_thread will be blocked even being scheduled.
And release host on resuming.

Acked-by: Aisheng DONG <b29396@freescale.com>
Signed-off-by: Ryan QIAN <b32804@freescale.com>
ENGR00227241 mx6sl: clk: sdhc can not work at lp idle mode

issue:
Once entering low power idle mode, pll2_400 will be bypass which will change
the clk rate of sdhc root clk. so far, there's no mechanism to inform sdhc
for changing of root clk in current driver structure.

fix:
Revert "ENGR00226096 mx6sl: remove high set point for usdhc"

This reverts commit 97aee96a34ca63da0d1d602a19b3a444352e5803.

Acked-by: Robby CAI <r63905@freescale.com>
Signed-off-by: Ryan QIAN <b32804@freescale.com>
Merge remote branch 'fsl-linux-sdk/imx_3.0.35' into imx_3.0.35_android

Conflicts:
	arch/arm/configs/imx6s_updater_defconfig
	arch/arm/include/asm/hardware/coresight.h
	arch/arm/kernel/etm.c
	arch/arm/mach-mx6/board-mx6q_sabresd.c
	arch/arm/mach-mx6/cpu_op-mx6.c
	arch/arm/mach-mx6/mx6_suspend.S
	arch/arm/mach-mx6/pm.c
	arch/arm/mach-mx6/system.c
	arch/arm/plat-mxc/cpufreq.c
	drivers/mfd/mxc-hdmi-core.c
	drivers/power/sabresd_battery.c
	drivers/video/mxc/mxc_ipuv3_fb.c
	drivers/video/mxc_hdmi.c
	include/linux/mfd/mxc-hdmi-core.h
ENGR00227477 mx6qdl: system resume fail due to DDR not accessable

For DQ and DL, we must make sure DDR can be accessed after resume,
our code did NOT get a valid base address for MMDC to exit from
DVFS mode, need to fix it.

According to ARM, we only need to save r0-r3 and r12 before calling
C function.

Signed-off-by: Anson Huang <b20788@freescale.com>
ENGR00227502-1 csi/v4l2: Implement probe and remove function for csi v4l2 driver

Because csi_v4l2 driver will only be loaded when needed(by assign 'csi' in
kernel cmdline), we use standard driver framework to easily bind the device and
driver. Otherwise, we will meet the problem like the crash as below when do
suspend/resume due to the resource of csi not assigned at all if 'csi' not
passed in cmdline.

root@freescale ~$ echo mem > /sys/power/state
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.01 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = 9a8ac000
[00000000] *pgd=9a783831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] PREEMPT
Modules linked in:
CPU: 0    Not tainted  (3.0.35-02115-g08f4436 #233)
PC is at csi_enable_mclk+0x40/0x68
LR is at camera_power+0x1c/0x5c
pc : [<80357f08>]    lr : [<80358154>]    psr: 60000013
sp : 9a8ebe30  ip : 00000009  fp : 00000006
r10: 1c6bddf7  r9 : 00000000  r8 : 00000000
r7 : 00000002  r6 : 804fd0ac  r5 : 9a013000  r4 : 00000000
r3 : 80aa8bbc  r2 : 00000000  r1 : 00000000  r0 : 00000008
...

Signed-off-by: Robby Cai <R63905@freescale.com>
ENGR00227502-2 mx6sl: add csi v4l2 platform device

Add csi v4l2 platform device only when 'csi' is assigned in cmdline.
Because there's pin conflicts between csi and epdc.

Signed-off-by: Robby Cai <R63905@freescale.com>
ENGR00227568 elcdif: fix fb wait for vsync timeout when suspend and resume

When suspend, the lcdif and panel will be stopped. When resume, fb_set_par()
will be called, in which the lcdif and the panel will be re-initialized.
However, fb_set_par() also checks the parameters via mxc_elcdif_fb_par_equal(),
which will probably make fb_set_par() just return with them un-initialized.
And thus, the interrupt will not come. This patch added a varible to check
whether they're running along with mxc_elcdif_fb_par_equal() checking to
fix the issue. If not running, re-initialization will be forcely done.

Signed-off-by: Robby Cai <R63905@freescale.com>
ENGR00225608 Camera: ov5642: improve VGA/XGA@15fps poor quality

- original VGA/XGA@15fps image has many noise.
- new ov5642 firmware can get fine quality

Signed-off-by: Sheng Nan <b38800@freescale.com>
ENGR00227644 imx6: update android default configure

Update the imx6_android_defconfig after merge
the BSP's mainline.

Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
ENGR00227653 Revert "Delay interactive governor to speed up kernel boot"

The updated interactive governor added input
handler callbacks to capture the multitouch, touchpad
device's connect/disconnect/report events.
If using the interactive as default governor,
the interactive's start command will be triggered
when bringup each cpu cores, and the input handler
will be registered. But at this time, the
inputopen_work is not initialized until the
late_initcall. This caused if there's a touch
screen driver registered, and input handler connected
callback be called, the queue work to inputopen_work
will crash.

This reverts commit 2c1d402e9b2f802e33ccb622f41527812cac386f.

Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
ENGR00224912 mxc v4l2 capture:Correct mclk enable/disable

1) Change to enable/disable mclk only in open, release,
suspend and resume functions, since we may simply think that
sensor or mclk will be used soon after cam->open_count is non-zero.
2) Fix a bug when calling ipu_csi_enable_mclk_if() with wrong
parameter(cam->csi should be cam->mclk_source) in mxc_v4l2_close()
and in mxc_v4l2_s_ctrl() with V4L2_CID_MXC_SWITCH_CAM control id.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
ENGR00227472 MXC V4L2 capture:Improve resource lock

1) We get busy_lock semaphore before we get a dqueue event, so, when user
is blocked at DQBUF ioctrl, the user will also be blocked at QBUF ioctrl,
then the video performance will drop. This patch changes to get busy_lock
semaphore to protect DQBUF ioctrl until we successfully get a dqueue event.
2) Use queue_int_lock and dqueue_int_lock spinlocks to protect working_q/
ready_q/done_q in the end of frame interrupt handler camera_callback(), in
case, the handler and VIDIOC_QBUF/VIDIOC_DQBUF ioctrls are called on diff-
erent cores at the same time.
3) Protect ready_q with queue_int_lock spinlock in mxc_streamon(), in case,
VIDIOC_STREAMON and VIDIOC_QBUF ioctrls are called on different cores at
the same time.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
ENGR00224912 mxc v4l2 capture:Correct mclk enable/disable

1) Change to enable/disable mclk only in open, release,
suspend and resume functions, since we may simply think that
sensor or mclk will be used soon after cam->open_count is non-zero.
2) Fix a bug when calling ipu_csi_enable_mclk_if() with wrong
parameter(cam->csi should be cam->mclk_source) in mxc_v4l2_close()
and in mxc_v4l2_s_ctrl() with V4L2_CID_MXC_SWITCH_CAM control id.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
(cherry picked from commit be689b81ac24c0a4373a989664ec51ad77db0ced)
ENGR00227472 MXC V4L2 capture:Improve resource lock

1) We get busy_lock semaphore before we get a dqueue event, so, when user
is blocked at DQBUF ioctrl, the user will also be blocked at QBUF ioctrl,
then the video performance will drop. This patch changes to get busy_lock
semaphore to protect DQBUF ioctrl until we successfully get a dqueue event.
2) Use queue_int_lock and dqueue_int_lock spinlocks to protect working_q/
ready_q/done_q in the end of frame interrupt handler camera_callback(), in
case, the handler and VIDIOC_QBUF/VIDIOC_DQBUF ioctrls are called on diff-
erent cores at the same time.
3) Protect ready_q with queue_int_lock spinlock in mxc_streamon(), in case,
VIDIOC_STREAMON and VIDIOC_QBUF ioctrls are called on different cores at
the same time.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
(cherry picked from commit e92c2307ebcf66badc5db8d4449218e3489a9e78)
ENGR00227681 IPUv3:Use spinlock to protect buf ready reg

There are several channels' buffer ready bits controlled
by a single 32bit register-IPU_CHA_BUFx_RDY. These buffer
ready can be write-one-to-set or write-one-to-clear, which
is controlled by IPU_GPR register. v4l2 capture driver will
touch the buffer ready registers in interrupt context, so,
currently, ipu->mutex_lock is bypassed with the context.
Then, a race condition is that v4l2 capture driver interrupt
context tries to set a channel buffer ready, while, another
context tries to disable another channel(clear buffer ready
bit), which may cause v4l2 capture driver fails to set buffer
ready(SMFC0_FRM_LOST error may happen). This patch uses ipu->
rdy_reg_spin_lock to protect buffer ready registers to fix
the race condition issue and rename ipu->spin_lock to ipu->
int_reg_spin_lock.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>