Support p12 Vivante drivers
Add software poweroff support via SNVS
ENGR00267090 mx6sl: System is running at minimum operating voltages

VDD_ARM_IN, VDD_SOC_IN and VDD_PU_IN are at minimum operating voltages of
i.MX6SL when running. Raise these power rails by 25mV for all CPU working
points to compensate the output tolerance from external regulators.

Signed-off-by: Peter Chan <B18700@freescale.com>
ENGR00279566: ARM: i.MX6: Enable L2 cache I/D prefetch function

This patch enable the L2 cache I/D prefetch function on the i.MX6 family.
Based on Android test result, it has the performance improvement:

Before the change:
JB4.3 RC1:
Browser Vellamo scores See The Sun Canvas: 51.16
Browser Vellamo scores Deep Sea Canvas: 65.41
Browser Vellamo scores Aquarium Canvas: 50.23

After the change:
Browser Vellamo scores See The Sun Canvas: 70.28
Browser Vellamo scores Deep Sea Canvas: 78.57
Browser Vellamo scores Aquarium Canvas: 53.73

Signed-off-by: Jason Liu <r64343@freescale.com>
ENGR00267271-1 mx6sl: minimize the VDDHIGH_IN current in deep sleep mode

Minimize the VDDHIGH_IN current by
- Some pads are either have external pullup or may idle at HIGH state. Enable
  internal pulldown will increase leakage current. Do not enable internal
  pulldown to the following pads when suspend: PAD_I2C1_SCL, PAD_I2C1_SDA,
  PAD_I2C2_SCL, PAD_I2C2_SDA, PAD_SD1_CLK, PAD_SD1_CMD, PAD_SD1_DAT0,
  PAD_SD1_DAT1, PAD_SD1_DAT2, PAD_SD1_DAT3, PAD_SD1_DAT4, PAD_SD1_DAT5,
  PAD_SD1_DAT6, PAD_SD1_DAT7, PAD_SD2_CLK, PAD_SD2_CMD, PAD_SD2_DAT0,
  PAD_SD2_DAT1, PAD_SD2_DAT2, PAD_SD2_DAT3, PAD_SD2_DAT4, PAD_SD2_DAT5,
  PAD_SD3_CLK, PAD_SD3_CMD, PAD_SD3_DAT0, PAD_SD3_DAT1, PAD_SD3_DAT2,
  PAD_SD3_DAT3, PAD_FEC_MDIO, PAD_ECSPI1_SS0, PAD_EPDC_PWRCTRL2, PAD_KEY_COL4,
  PAD_KEY_ROW5, PAD_KEY_COL6, PAD_FEC_TX_CLK, PAD_SD2_DAT6, PAD_SD2_DAT7,
  PAD_KEY_ROW7, PAD_KEY_COL7, PAD_REF_CLK_32K
- The pin configurations of SD card detect and write protect should not be
  changed when suspend, remove PAD_SD2_DAT4, PAD_SD2_DAT5 and PAD_KEY_COL7 from
  suspend_enter_pads[]
- LCDIF pins should be configured as GPIO when suspend, add PAD_LCD_ENABLE,
  PAD_LCD_HSYNC, PAD_LCD_VSYNC, PAD_LCD_RESET, PAD_LCD_DAT6, PAD_LCD_DAT7,
  PAD_LCD_DAT8, PAD_LCD_DAT9 to suspend_enter_pads[]
- PAD_WDOG_B is used as a software ON/OFF button detect on EVK. Remove
  MX6SL_PAD_WDOG_B__WDOG1_WDOG_B from mx6sl_brd_pads[]
- PAD_SD1_DAT0 is used by SD1 port, remove MX6SL_PAD_SD1_DAT0__GPIO_5_11
  from mx6sl_uart4_pads[]
- Configure PAD_JTAG_MOD, PAD_JTAG_TCK, PAD_JTAG_TDI, PAD_JTAG_TDO,
  PAD_JTAG_TMS, PAD_JTAG_TRSTB for JTAG function

Signed-off-by: Peter Chan <B18700@freescale.com>
ENGR00267271-2 mx6sl: minimize the VDDHIGH_IN current in deep sleep mode

Minimize the VDDHIGH_IN current by
- Use 100K pullup for SD card detect, write protect and charger signals.
  Use 100K internal pullup for PAD_KEY_COL7, PAD_KEY_ROW7, PAD_REF_CLK_32K,
  PAD_SD2_DAT6, PAD_SD2_DAT7, PAD_ECSPI2_MISO, PAD_ECSPI2_MOSI, PAD_ECSPI2_SS0
- Some pads have external pullup resistors. When suspend, disable pull/keeper
  for MX6SL_PAD_FEC_MDIO__GPIO_4_20, MX6SL_PAD_I2C1_SCL__GPIO_3_12,
  MX6SL_PAD_I2C1_SDA__GPIO_3_13, MX6SL_PAD_I2C2_SCL__GPIO_3_14,
  MX6SL_PAD_I2C2_SDA__GPIO_3_15
- Some function pads have external pull resistors. Disable internal pull for
  MX6SL_PAD_JTAG_MOD__SJC_MOD, MX6SL_PAD_JTAG_TCK__SJC_TCK

Signed-off-by: Peter Chan <B18700@freescale.com>
ENGR00290448: Double instantiation of RNG in CAAM Driver

These patches came from Steve Cornelius of STC and are to fix the RNG
instantiation problem in the CAAM driver. His comments:
    Add code to enable the "caam_probe" function to detect if the RNG
    has been instantiated and to skip the instantiation process if
    already completed.

Signed-off-by Jay Monkman <jay.monkman@freescale.com>
ENGR00290449: Cannot build CAAM as a loadable module

These patches come from Winston Hudson of STC and allow building CAAM
as a kernel module. His comments:
    This patch enables the CAAM driver to be built as a single LKM
    (Loadable Kernel Module). Individual components of the CAAM driver
    may be selected from the kernel configuration options, but a
    single monolithic "caam.ko" module is created. Adding or removing
    individual CAAM driver components requires that the module be
    recompiled, unloaded (rmmod caam.ko) then reloaded (insmod
    caam.ko), before the changes take affect. The option to build CAAM
    as part of the kernel is still available, but a kernel recompile
    and reboot is required before the changes take affect. The patch
    was created for the 3.0.x kernel.

    This patch also fixes an issue with the CAAM driver crashing with
    a kernel "opps" during driver initialization. The problem occurs
    when the CAAM RNG initialization fails and the "caam_remove()"
    function called. The driver attemps to release resources that have
    not been allocated. Checks have been added to ensure that resource
    allocation has occurred before attempting to release those
    resources.

Signed-off-by Jay Monkman <jay.monkman@freescale.com>
ENGR00286181 ARM: i.MX6: add more chip revision support

With the new tap-out of i.MX6DQ(TO1.5) and i.MX6DL/SOLO(TO1.2), we need add
more chip revision support in order to report the chip revision correctly.

Signed-off-by: Jason Liu <r64343@freescale.com>
ARM: 7668/1: fix memset-related crashes caused by recent GCC (4.7.2) optimizations

Recent GCC versions (e.g. GCC-4.7.2) perform optimizations based on
assumptions about the implementation of memset and similar functions.
The current ARM optimized memset code does not return the value of
its first argument, as is usually expected from standard implementations.

For instance in the following function:

void debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter)
{
	memset(waiter, MUTEX_DEBUG_INIT, sizeof(*waiter));
	waiter->magic = waiter;
	INIT_LIST_HEAD(&waiter->list);
}

compiled as:

800554d0 <debug_mutex_lock_common>:
800554d0:       e92d4008        push    {r3, lr}
800554d4:       e1a00001        mov     r0, r1
800554d8:       e3a02010        mov     r2, #16 ; 0x10
800554dc:       e3a01011        mov     r1, #17 ; 0x11
800554e0:       eb04426e        bl      80165ea0 <memset>
800554e4:       e1a03000        mov     r3, r0
800554e8:       e583000c        str     r0, [r3, #12]
800554ec:       e5830000        str     r0, [r3]
800554f0:       e5830004        str     r0, [r3, #4]
800554f4:       e8bd8008        pop     {r3, pc}

GCC assumes memset returns the value of pointer 'waiter' in register r0; causing
register/memory corruptions.

This patch fixes the return value of the assembly version of memset.
It adds a 'mov' instruction and merges an additional load+store into
existing load/store instructions.
For ease of review, here is a breakdown of the patch into 4 simple steps:

Step 1
======
Perform the following substitutions:
ip -> r8, then
r0 -> ip,
and insert 'mov ip, r0' as the first statement of the function.
At this point, we have a memset() implementation returning the proper result,
but corrupting r8 on some paths (the ones that were using ip).

Step 2
======
Make sure r8 is saved and restored when (! CALGN(1)+0) == 1:

save r8:
-       str     lr, [sp, #-4]!
+       stmfd   sp!, {r8, lr}

and restore r8 on both exit paths:
-       ldmeqfd sp!, {pc}               @ Now <64 bytes to go.
+       ldmeqfd sp!, {r8, pc}           @ Now <64 bytes to go.
(...)
        tst     r2, #16
        stmneia ip!, {r1, r3, r8, lr}
-       ldr     lr, [sp], #4
+       ldmfd   sp!, {r8, lr}

Step 3
======
Make sure r8 is saved and restored when (! CALGN(1)+0) == 0:

save r8:
-       stmfd   sp!, {r4-r7, lr}
+       stmfd   sp!, {r4-r8, lr}

and restore r8 on both exit paths:
        bgt     3b
-       ldmeqfd sp!, {r4-r7, pc}
+       ldmeqfd sp!, {r4-r8, pc}
(...)
        tst     r2, #16
        stmneia ip!, {r4-r7}
-       ldmfd   sp!, {r4-r7, lr}
+       ldmfd   sp!, {r4-r8, lr}

Step 4
======
Rewrite register list "r4-r7, r8" as "r4-r8".

Signed-off-by: Ivan Djelic <ivan.djelic@parrot.com>
Reviewed-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
(cherry picked from commit 455bd4c430b0c0a361f38e8658a0d6cb469942b5)
ENGR00271136 Fix build break when CONFIG_CLK_DEBUG is disabled

clk structure member name is defined only when CONFIG_CLK_DEBUG is enabled.
Hence need to encapsulate the code with this config.

Patch received from imx community:
https://community.freescale.com/thread/308482

Signed-off-by: xiongweihuang
Signed-off-by: Mahesh Mahadevan <Mahesh.Mahadevan@freescale.com>
ENGR00271359 Add Multi-touch support

The previous behavior of the driver did not work properly with Qt5
QtQuick multi touch-point gestures, due to how touch-points are
reported when removing a touch-point. My interpretation of the
available documentation [1] was that the driver should report all
touch-points between SYN_REPORTs, but it is not explicitly stated so.
I've found another mail-thread [2] where the creator of the protocol
states:

"The protocol defines a generic way of sending a variable amount of
contacts. The contact count is obtained by counting the number of
non-empty finger packets between SYN_REPORT events."-Henrik Rydberg

I think this verifies my assumption that all touch-points should be
reported between SYN_REPORTs, otherwise it can not be used to obtain
the count.

[1] https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt
[2] http://lists.x.org/archives/xorg-devel/2010-March/006466.html

Signed-off-by: Erik Boto <erik.boto@pelagicore.com>
Signed-off-by: Mahesh Mahadevan <Mahesh.Mahadevan@freescale.com>
ENGR00271574 ptp: fix ptp packet parse issue to support VLAN

Previous ptp test environment is base on IPv4, now add VLAN
(virtual local area network) support. Fix the ptp packet parse
issue to support it.

PTP test on VLAN environment:
- Enable kernel config "CONFIG_FEC_1588", and rebuild
- After kernel up, dhcp require IP address for eth0
- Use vconfig to add virtual netdev eth0.n (exp: eth0.5):
    vconfig add eth0 5
- Use ifconfig to config virtual netdev eth5, and config
  real netdev eth0 to 0.0.0.0:
    ifconfig eth0.5 192.168.0.100 netmask 255.255.255.0 up
    ifconfig eth0 0.0.0.0
- If connect switch, enable switch VLAN feature and add the
  related ptp device ports to VID 5.
- Last, run the IXXAT stack V1.05.03:
    ptp_main_1.05.03 -d -o -m -l -w -z -i 0:eth0.5

Signed-off-by: Fugang Duan  <B38611@freescale.com>
ENGR00273500 IPUv3 dev: use wait_event_interruptible for ipu task

The ipu task thread checks outstanding tasks to be done on waiting
event uninterruptibly on the function find_task()'s return value.
However, sleeping on waiting event uninterruptibly contributes to
system load average value. This patch changes wait_event() to
wait_event_interruptible() to avoid the load average value inflation.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
ENGR00274496 mx6sl: csi/v4l: Add YUYV format support as capture format

V4L2_PIX_FMT_YUYV is the original format from camera and the source format
for CSI. This format may be needed on Android to do CSC before encoding.
We can now choose V4L2_PIX_FMT_YUYV, V4L2_PIX_FMT_UYVY, V4L2_PIX_FMT_RGB565
for the v4l capture format.

Signed-off-by: Robby Cai <R63905@freescale.com>
ENGR00276652 ARM: mx6: Use IOMUXC irq instead of #125

Some boards' irq #125 are not pending, so we need to
force irq #32 to be pending manually to ensure CCM is
in correct stat before entering low power mode. Using
irq #32 is more reliable than #125, as we can trigger
it manually. See below commit for detail of CCM LPM
issue:

commit 04b5224599fef16ef3a1856dd1b3205360b772c1

Signed-off-by: Anson Huang <b20788@freescale.com>
ENGR00277003 IPUv3: Update IC RGB2YUV CSC matrix parameters

This patch updates IPUv3 IC RGB to YUV color space conversion
matrix's parameters to align with the default VIV GPU CSC
implementation so that we may pass relevant Android CTS test
cases.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
(cherry picked from commit 17b6dbef8eea2051a6c3819f3690c21948bd0e93)
ENGR00276199 ARM: imx6: Update VDDARM_CAP's voltag for cpufreq table

According to datasheet, VDD_CACHE_CAP must not exceed VDDARM_CAP
by more than 200mV, as all of our i.MX6Q boards' VDD_CACHE_CAP
are connected to VDDSOC_CAP, so we need to follow this rule by
increasing VDDARM_CAP's voltage when necessary.

Signed-off-by: Anson Huang <b20788@freescale.com>
ENGR00278089 mxc v4l2 capture:report field info via VIDIOC_DQBUF

This patch adds logics to report video buffer field information
via VIDIOC_DQBUF ioctrl so that the user space may rely on this
to determine how to go on to process the dqueued video buffers.
Currently, we only support two field types - V4L2_FIELD_INTERLACED
and V4L2_FIELD_NONE.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
ENGR00283795: MX6: UART 1 hangs the system on SARBESD when not used a console

The platform hangs if UART 1 is not used a console on MX6 SABRESD.
The issue is because the UART UFCR register is not initialized and
the driver uses values provided by the bootloader  (U-Boot in this
case). This patch initializes the UFCR register and does not rely
on the default or what is configured by the bootloader.

Test method on MX6 SABRESD:
1. Add 'noconsole' to the kernel command line.
2. SSH to the board and type the below from the SSH window:
   echo Hello >/dev/ttymxc0
3. Platform will hang, with the patch the hang will not be seen.

Signed-off-by: Mahesh Mahadevan <Mahesh.Mahadevan@freescale.com>
(cherry picked from commit e1925c5b8ca74a77322f34772f170563fee76d0d)