linux.git
6 years agoMLK-14785 CAAM: Fix gcm.c to work correctly with CAAM
Radu Solea [Tue, 23 May 2017 12:13:50 +0000 (15:13 +0300)]
MLK-14785 CAAM: Fix gcm.c to work correctly with CAAM

CAAM uses DMA to transfer data to and from memory, if
DMA and CPU accessed data share the same cacheline cache
pollution will occur. Marking the result as cacheline aligned
moves it to a separate cache line.

Signed-off-by: Radu Solea <radu.solea@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14611 Fix xcbc unkeyed registration
Radu Solea [Wed, 19 Apr 2017 15:19:14 +0000 (18:19 +0300)]
MLK-14611 Fix xcbc unkeyed registration

AES is a keyed algorithm, XCBC-AES needs a key for operation,
this patch prevents the registration of AES-based transforms
as unkeyed operations.

Signed-off-by: Radu Solea <radu.solea@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14284 Fix CAAM Errata err005766 handling
Radu Solea [Thu, 13 Apr 2017 13:14:06 +0000 (16:14 +0300)]
MLK-14284 Fix CAAM Errata err005766 handling

* Update ERA detection code to check 3 sources CCBVID, CAAMVID and
the device tree.
* Fix bit handling of CAAMVID data to obtain correct results.
* Remove default device tree values.
* Update errata handling to target known affected platforms.

Signed-off-by: Radu Solea <radu.solea@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14611 Fix CBC mode support by returning a correct IV
Radu Solea [Thu, 13 Apr 2017 12:22:41 +0000 (15:22 +0300)]
MLK-14611 Fix CBC mode support by returning a correct IV

Current CBC mode does not return the last cyphertext block
as IV for operation chaining. CTS fails because of incorrect IV.

Signed-off-by: Radu Solea <radu.solea@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14611 Add DES key complexity validation
Radu Solea [Thu, 13 Apr 2017 12:12:27 +0000 (15:12 +0300)]
MLK-14611 Add DES key complexity validation

Signed-off-by: Radu Solea <radu.solea@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoAdd missing NULL checks in CAAM sm
Radu Solea [Wed, 8 Mar 2017 14:34:15 +0000 (16:34 +0200)]
Add missing NULL checks in CAAM sm

    Missing NULL checks in CAAM sm_store and sm_test cause kernel
    crashes if caam init fails.

Signed-off-by: Radu Solea <radu.solea@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13779 crypto: caam - initialize kslock spinlock
Octavian Purdila [Wed, 11 Jan 2017 10:43:48 +0000 (12:43 +0200)]
MLK-13779 crypto: caam - initialize kslock spinlock

Fixes the following lockdep message:

INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.1.30-02225-g55e4b9e #8
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[<800162b0>] (unwind_backtrace) from [<80012ba0>] (show_stack+0x10/0x14)
[<80012ba0>] (show_stack) from [<808d09d0>] (dump_stack+0xa8/0xd4)
[<808d09d0>] (dump_stack) from [<8007aed0>] (__lock_acquire+0x1eb0/0x2224)
[<8007aed0>] (__lock_acquire) from [<8007b840>] (lock_acquire+0xa4/0xd0)
[<8007b840>] (lock_acquire) from [<808dc28c>] (_raw_spin_lock+0x3c/0x4c)
[<808dc28c>] (_raw_spin_lock) from [<80666724>] (sm_keystore_slot_alloc+0x24/0x74)
[<80666724>] (sm_keystore_slot_alloc) from [<806677c8>] (caam_sm_example_init+0x1ec/0xb68)
[<806677c8>] (caam_sm_example_init) from [<80c6ff48>] (caam_sm_test_init+0x50/0x58)
[<80c6ff48>] (caam_sm_test_init) from [<80009770>] (do_one_initcall+0x8c/0x1d8)
[<80009770>] (do_one_initcall) from [<80c26dc8>] (kernel_init_freeable+0x144/0x1e4)
[<80c26dc8>] (kernel_init_freeable) from [<808cbff0>] (kernel_init+0x8/0xe8)
[<808cbff0>] (kernel_init) from [<8000f618>] (ret_from_fork+0x14/0x3c)

Signed-off-by: Octavian Purdila <octavian.purdila@nxp.com>
Reviewed-by: Dan Douglass <dan.douglass@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13095 DCP driver doesn't initialize the DCP clock
Dan Douglass [Wed, 24 Aug 2016 03:52:01 +0000 (22:52 -0500)]
MLK-13095 DCP driver doesn't initialize the DCP clock

Added clock enable and disable to the probe and remove functions
where appropriate.

Signed-off-by: Dan Douglass <dan.douglass@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13073 crypto: dcp: Add DCP support for i.mx6
Dan Douglass [Mon, 15 Aug 2016 03:12:07 +0000 (22:12 -0500)]
MLK-13073 crypto: dcp: Add DCP support for i.mx6

Enable DCP support for imx6 series.

Signed-off-by: Dan Douglass <dan.douglass@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-11922 i.mx6: Linux 3.14.28 CAAM & SNVS enabled by default.
ulises [Wed, 18 Nov 2015 14:10:26 +0000 (08:10 -0600)]
MLK-11922 i.mx6: Linux 3.14.28 CAAM & SNVS enabled by default.
JTAG, DS-5 attachment causes exceptions

Added properties to device tree, in order to enable and disable
alarms. The following are the available alarms:
-JTAG active
-WatchDOG 2 reset
-Internal Boot
-External Tamper Detection pad

(Vipul: Fixed merge conflicts)
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agocrypto: testmgr - Disable rfc4543 test
Herbert Xu [Tue, 16 Jun 2015 05:54:16 +0000 (13:54 +0800)]
crypto: testmgr - Disable rfc4543 test

Because the old rfc4543 implementation always injected an IV into
the AD, while the new one does not, we have to disable the test
while it is converted over to the new AEAD interface.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-12312: CAAM hash algorithms fail registration during initialization
Russell King [Sun, 18 Oct 2015 16:51:25 +0000 (17:51 +0100)]
MLK-12312: CAAM hash algorithms fail registration during initialization

Fix cherry-picked from 5ec908319ab53072d3a2188e62ed2e5d7b846951

crypto: caam - only export the state we really need to export

Avoid exporting lots of state by only exporting what we really require,
which is the buffer containing the set of pending bytes to be hashed,
number of pending bytes, the context buffer, and the function pointer
state.  This reduces down the exported state size to 216 bytes from
576 bytes.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-12302 caam: Secure Memory platform device creation crashes
Dan Douglass [Wed, 20 Jan 2016 19:31:56 +0000 (13:31 -0600)]
MLK-12302 caam: Secure Memory platform device creation crashes

There is new flag that is checked in of_platform_device_create().
The flag is cleared prior to the call now so the device creates
successfully.

Signed-off-by: Dan Douglass <dan.douglass@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-11360-01 crypto: caam_snvs: add snvs clock management
Fugang Duan [Fri, 14 Aug 2015 06:46:23 +0000 (14:46 +0800)]
MLK-11360-01 crypto: caam_snvs: add snvs clock management

caam_snvs driver involves snvs HP registers access that needs to
enable snvs clock source. The patch add the clock management.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-11103 Missing register in Secure memory configuration v1
Ulises Cardenas [Fri, 12 Jun 2015 10:54:36 +0000 (05:54 -0500)]
MLK-11103 Missing register in Secure memory configuration v1

Added missing reserved register for caam_secure_mem_v1 struct

Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-10897-1 ARM: imx7d: Add CAAM support for i.mx7d
Dan Douglass [Thu, 14 May 2015 21:28:52 +0000 (16:28 -0500)]
MLK-10897-1 ARM: imx7d: Add CAAM support for i.mx7d

CAAM only has a single clock in i.mx7d. Logic was added to initialize only
the single clock.

The Secure Memory registers moved in CAAM era included in i.mx7d. This
required changes to support access to two different versions of the
register map. The registers are access through a data structure that
overlay the register region. Two new Secure Memory register structures were
created to support the different versions. Logic was also added to
determine which version is implemented based on the CAAM era, and access
functions were added to support register access to the Secure Memory
Command and Status registers.

Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9769-23 Replace SECVIO of_irq_to_resource() with irq_of_parse_and_map()
Victoria Milhoan [Wed, 14 Jan 2015 18:43:12 +0000 (11:43 -0700)]
MLK-9769-23 Replace SECVIO of_irq_to_resource() with irq_of_parse_and_map()

Replace of_irq_to_resource() in the SECVIO module with the simpler
equivalent irq_of_parse_and_map().  Also, add error checking to
to the SECVIO and Job Ring modules. Based on upstream commit
f7578496a671a96e501f16a5104893275e32c33a.

Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-10036 Freescale CAAM: Add support for DSM with Mega/Fast mix on
Victoria Milhoan [Thu, 18 Dec 2014 21:06:50 +0000 (14:06 -0700)]
MLK-10036 Freescale CAAM: Add support for DSM with Mega/Fast mix on

This patch allows CAAM to be enabled as a wakeup source for the
Mega/Fast mix domain. If CAAM is enabled as a wakeup source, it
will continue to be powered on across Deep Sleep Mode (DSM). This
allows CAAM to be functional after the system resumes from DSM.

Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
(cherry picked from commit 290744e3b40a563319324e234fa5a65b49fd4d82)
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9971 Add XCBC-AES support for CAAM in i.MX6 family
Winston Hudson (b45308) [Thu, 27 Jun 2013 20:22:39 +0000 (13:22 -0700)]
MLK-9971 Add XCBC-AES support for CAAM in i.MX6 family

Add XCBC-AES support to the CAAM crypto accelerator core in
the i.MX6 family of SoC devices.

Note that CAAM also goes by sec-4.0 or sec-5.0 in other product families
(such as QorIQ).
Thus the property names are often tied to the sec-4.0+ nomenclature.

Signed-off-by: Winston Hudson (b45308) <winston.h.hudson@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9951 Update CAAM driver era interface
Victoria Milhoan [Thu, 20 Nov 2014 18:28:28 +0000 (11:28 -0700)]
MLK-9951 Update CAAM driver era interface

Add more CAAM era values to the CAAM driver's caam_get_era()
function. Read only 32 bits of data since the data required
to identify the IP_ID and MAJ_REV is located in the first 32
bits of the register. And, update the function for use with
ARM/Little Endian devices.

[<vicki.milhoan@freescale.com>: Edited to apply to 3.14]
Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
(cherry picked from commit 6050d7faf2d0c063195aa9454c130548a9f8058f)
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9710-5 Unregister Secure Memory platform device upon shutdown
Victoria Milhoan [Mon, 3 Nov 2014 22:28:10 +0000 (15:28 -0700)]
MLK-9710-5 Unregister Secure Memory platform device upon shutdown

Unregister Secure Memory platform device when the Secure Memory
module is shut down.  This allows the Secure Memory module to
be inserted again successfully.

Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
(cherry picked from commit 785456f38234e64618ee9c74ab4258f39f00e73c)
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9769-20 Limit AXI pipeline to a depth of one in CAAM for i.MX6 devices
Victoria Milhoan (b42089) [Tue, 26 Mar 2013 21:11:32 +0000 (14:11 -0700)]
MLK-9769-20 Limit AXI pipeline to a depth of one in CAAM for i.MX6 devices

i.MX6 devices have an issue wherein AXI bus transactions may not occur
in the correct order. This isn't a problem running single descriptors,
but can be if running multiple concurrent descriptors. Reworking the CAAM
driver to throttle to single requests is impractical, so this patch limits
the AXI pipeline to a depth of one (from a default of four) to preclude
this situation from occurring.

Signed-off-by: Victoria Milhoan (b42089) <vicki.milhoan@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9769-19 Add ARC4-ECB support for CAAM in i.MX6 family
Winston Hudson [Mon, 17 Nov 2014 17:17:35 +0000 (10:17 -0700)]
MLK-9769-19 Add ARC4-ECB support for CAAM in i.MX6 family

Adds ARC4-ECB Mode support to the CAAM crypto accelerator core in
the i.MX6 family of SoC devices.

Note that CAAM also goes by sec-4.0 or sec-5.0 in other product families
(such as QorIQ).
Thus the property names are often tied to the sec-4.0+ nomenclature.

Signed-off-by: Winston Hudson (b45308) <winston.h.hudson@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9769-18 Add 3DES-ECB-EDE support for CAAM in i.MX6 family
Winston Hudson (b45308) [Thu, 27 Jun 2013 04:08:30 +0000 (21:08 -0700)]
MLK-9769-18 Add 3DES-ECB-EDE support for CAAM in i.MX6 family

Adds 3DES-ECB-EDE Mode support to the CAAM crypto accelerator core in
the i.MX6 family of SoC devices.

Note that CAAM also goes by sec-4.0 or sec-5.0 in other product families
(such as QorIQ).
Thus the property names are often tied to the sec-4.0+ nomenclature.

Signed-off-by: Winston Hudson (b45308) <winston.h.hudson@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9769-17 Add AES-ECB support for CAAM in i.MX6 family
Winston Hudson (b45308) [Thu, 27 Jun 2013 03:49:36 +0000 (20:49 -0700)]
MLK-9769-17 Add AES-ECB support for CAAM in i.MX6 family

Adds AES-ECB (Electronic Codebook) support to the CAAM crypto accelerator
core in the i.MX6 family of SoC devices.

Note that CAAM also goes by sec-4.0 or sec-5.0 in other product families
(such as QorIQ).
Thus the property names are often tied to the sec-4.0+ nomenclature.

Signed-off-by: Winston Hudson (b45308) <winston.h.hudson@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9769-16 Add DES-ECB support for CAAM in i.MX6 family
Winston Hudson [Mon, 17 Nov 2014 16:27:30 +0000 (09:27 -0700)]
MLK-9769-16 Add DES-ECB support for CAAM in i.MX6 family

Adds DES-ECB Mode support to the CAAM crypto accelerator core in
the i.MX6 family of SoC devices.

Note that CAAM also goes by sec-4.0 or sec-5.0 in other product families
(such as QorIQ). Thus the property names are often tied to the sec-4.0+
nomenclature.

Signed-off-by: Winston Hudson (b45308) <winston.h.hudson@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9769-14 Add CRYPTO_ALG_KERN_DRIVER_ONLY flag to Freescale CAAM driver
Victoria Milhoan (b42089) [Fri, 29 Mar 2013 07:13:14 +0000 (00:13 -0700)]
MLK-9769-14 Add CRYPTO_ALG_KERN_DRIVER_ONLY flag to Freescale CAAM driver

The CRYPTO_ALG_KERN_DRIVER_ONLY flag is used to indicate that
the crypto algorithm is only available via a kernel driver.
This patch adds the flag only when the flag is available in the
kernel.  Utilizing the flag based on it's availability in the
kernel allows the driver to compile on older kernel versions.

The original community patch is located at
http://permalink.gmane.org/gmane.linux.kernel.cryptoapi/6547
for reference.

Signed-off-by: Victoria Milhoan (b42089) <vicki.milhoan@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9710-15 Correct size of padded key buffers
Steve Cornelius [Fri, 2 Aug 2013 21:19:27 +0000 (14:19 -0700)]
MLK-9710-15 Correct size of padded key buffers

Correct size of padded key buffers for the Secure Memory test module.

Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com>
(cherry picked from commit da77cf5583c064deefd09a5e91851ab4398701a0)
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9710-14 Un-pad cache sizes for blob export/import
Steve Cornelius [Fri, 2 Aug 2013 03:08:19 +0000 (20:08 -0700)]
MLK-9710-14 Un-pad cache sizes for blob export/import

Blob exportation and importation functions were adding padding to
the buffer mapping and cache control functions, which resulted in
incorrect CPU-level views into a DMA-ed blob.

Also, corrected descriptor constructors to use symbolic form of
blob overhead calculation.

Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com>
(cherry picked from commit c5f2cbb1fa51b0142742de77fe0a37c290bd04a0)
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9710-13 Correct size in BLOB_OVERHEAD definition
Steve Cornelius [Fri, 2 Aug 2013 03:06:05 +0000 (20:06 -0700)]
MLK-9710-13 Correct size in BLOB_OVERHEAD definition

Increase the size of BLOB_OVERHEAD.

Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com>
(cherry picked from commit 32aced88dedf1c1c11170d125d3cc546ffefb366)
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9710-12 Adapt sm_test as a black-key handling example
Steve Cornelius [Wed, 24 Jul 2013 03:56:08 +0000 (20:56 -0700)]
MLK-9710-12 Adapt sm_test as a black-key handling example

Converted sm_test to an example that can show:
- key covering
- secret encapsulation as external memory blob
- secret decapsulation from external memory blob
- checks and displays of the handling of key content

Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com>
(cherry picked from commit 45818b72fc4b3fe3fff755b1f9a27cd5519ca2cf)
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9710-11 Add internal key cover and external blob export/import to prototype SM-API
Steve Cornelius [Wed, 24 Jul 2013 03:49:29 +0000 (20:49 -0700)]
MLK-9710-11 Add internal key cover and external blob export/import to prototype SM-API

Extended/amended the prototype SM-API with the following functions:
- Added key covering (blackening) function in-place to a keyslot
- Added export operation to encapsulate data to external memory as a
  secure memory blob (including descriptor capable of secure memory or
  general memory blob generation)
- Removed in-place blob encapsulation
- Added import operation to decapsulate a blob from external memory into
  secure memory (including descriptor capable of general memory or secure
  memory content decapsulation)
- Removed in-place blob decapsulation

[<vicki.milhoan@freescale.com>: Edited to apply to 3.10]
Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com>
Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
(cherry picked from commit c577769ed0347bb4e3428b5696fb7f209af0a7ad)
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9710-18 snvs - make SECVIO module device tree correct
Steve Cornelius [Thu, 25 Sep 2014 23:34:11 +0000 (16:34 -0700)]
MLK-9710-18 snvs - make SECVIO module device tree correct

Converted the prototype 3.0.x SNVS Security Violation Handler
subsystem to be device tree correct/compliant under 3.10 for ARM
platforms. Also, separated out SNVS property detection so as to make
it independent of CAAM, and corrected function namespace accordingly.

Later releases of this subsystem are likely to be separate from the
kernel's CAAM driver space.

[<vicki.milhoan@freescale.com>: Edited to apply to latest 3.10 kernel]
Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com>
Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
(cherry picked from commit c8c128086eae012ced0c96d66f21f36bcbd14f66)
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-12305 Enable CAAM in imx_v7_defconfig
Leonard Crestez [Tue, 6 Mar 2018 18:32:19 +0000 (20:32 +0200)]
MLK-12305 Enable CAAM in imx_v7_defconfig

Enabled CAAM in imx_v7_defconfig.

Signed-off-by: Dan Douglass <dan.douglass@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoENGR00289885 [iMX6Q] Add Secure Memory and SECVIO support.
Dan Douglass [Wed, 27 Nov 2013 09:40:44 +0000 (03:40 -0600)]
ENGR00289885 [iMX6Q] Add Secure Memory and SECVIO support.

1. Pull in secure memory support from 3.0.35 kernel.
2. Pull in SECVIO support from 3.0.35 kernel.
3. Make changes to support device tree.
4. Add device tree setting for SECVIO sources.

[<vicki.milhoan@freescale.com>: Edited to apply to 3.14]
Signed-off-by: Dan Douglass <b41520@freescale.com>
(cherry picked from commit f3bfd42e2db3af8326734bebf750e94e74734f6e)
Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9769-10 Add Blob command bitdefs.
Steve Cornelius [Fri, 19 Oct 2012 21:37:12 +0000 (14:37 -0700)]
MLK-9769-10 Add Blob command bitdefs.

Add bit definitions for Blob protocol protinfo field.

Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9769-11 Add SM register defs, and expanded driver-private storage.
Steve Cornelius [Fri, 19 Oct 2012 21:43:41 +0000 (14:43 -0700)]
MLK-9769-11 Add SM register defs, and expanded driver-private storage.

These add changes to the driver private areas for the CAAM
controller and CAAM Secure Memory subsystems, and expand register
definitions to include the Secure Memory subsystems as reflected
in multiple areas (controller, rings, secure memory itself).

[<vicki.milhoan@freescale.com>: Edited to apply to 3.14]
Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com>
Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9710-10 Add CCM defs for FIFO_STORE instruction
Steve Cornelius [Wed, 24 Jul 2013 03:47:32 +0000 (20:47 -0700)]
MLK-9710-10 Add CCM defs for FIFO_STORE instruction

Added definitions to enable FIFO_STORE to encode options for storing
keys in AES-CCM mode

[<vicki.milhoan@freescale.com>: Edited to apply to 3.14]
Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com>
(cherry picked from commit a3cd8e5fad274f33fc6f0030413f89a6339b1d5a)
Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9769-9 Adjust RNG timing to support more devices
Victoria Milhoan [Wed, 12 Nov 2014 16:58:24 +0000 (09:58 -0700)]
MLK-9769-9 Adjust RNG timing to support more devices

Adjust RNG timing parameters to support more i.MX6 devices.

Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9769-8 Add a test for the Freescale CAAM Random Number Generator
Victoria Milhoan (b42089) [Fri, 17 Oct 2014 23:30:56 +0000 (16:30 -0700)]
MLK-9769-8 Add a test for the Freescale CAAM Random Number Generator

Freescale's CAAM includes a Random Number Generator.  This change adds
a kernel configuration option to test the RNG's capabilities via the
hw_random framework.

Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-9769-1 caam: remove incorrect comment from job ring module
Victoria Milhoan [Wed, 29 Oct 2014 18:23:05 +0000 (11:23 -0700)]
MLK-9769-1 caam: remove incorrect comment from job ring module

The caam_jr_register() function is no longer part of the CAAM
driver.  This patch removes a comment referencing the function.

Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agocrypto: caam - add allocation failure handling in SPRINTFCAT macro
Horia Geanta [Fri, 18 Apr 2014 10:01:42 +0000 (13:01 +0300)]
crypto: caam - add allocation failure handling in SPRINTFCAT macro

commit 27c5fb7a84242b66bf1e0b2fe6bf40d19bcc5c04 upstream.

GFP_ATOMIC memory allocation could fail.
In this case, avoid NULL pointer dereference and notify user.

Cc: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Horia Geanta <horia.geanta@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Conflicts:
drivers/crypto/caam/error.c
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-17938: pxp: pxp will hang when output height is 8
Guoniu.Zhou [Thu, 29 Mar 2018 03:36:43 +0000 (11:36 +0800)]
MLK-17938: pxp: pxp will hang when output height is 8

When output height is eight, yscale of ps engine will be
over two, it not support by pxp.

According to pxp doc, a factor greater than 2 is not
supported with the bilinear filter. so correct it when
this case happen in order to ensure that pxp will be
not hang up.

Reviewed-by: Robby.cai <robby.cai@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-17487: pxp: fix pxp yuv to yuv generate color dots issue
Guoniu.Zhou [Fri, 23 Mar 2018 03:41:49 +0000 (11:41 +0800)]
MLK-17487: pxp: fix pxp yuv to yuv generate color dots issue

When PxP convert yuyv to nv12 format, some color dots will
introdue to output image. IC recommend that YCBCR_MODE and
BYPASS bit of CSC1_COEF0 should be 1.

Reviewed-by: robby.cai <robby.cai@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16374-4: PxP: add AS and PS engine colorkey support
Guoniu.Zhou [Thu, 7 Sep 2017 02:04:14 +0000 (10:04 +0800)]
MLK-16374-4: PxP: add AS and PS engine colorkey support

Enable PS and AS colorkey function if user enable and
set colorkey parameters of s0 and overlay buffer.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit f2ed3bfca174b3e370fc37cd5f75a67334822093)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16374-3: PxP: improve stride parameter setting compatible
Guoniu.Zhou [Wed, 6 Sep 2017 06:23:13 +0000 (14:23 +0800)]
MLK-16374-3: PxP: improve stride parameter setting compatible

In pxp lib, the unit of stride parameter is pixel and stride
is not equal with width parameter of out buffer in some cases.

In order to use latest pxp lib in old version rootfs, PXP_DEVICE_LEGACY
macro is used to distinguish pxp drvier version. Because the
new pxp driver define a new variable and pxp lib can know this
through PXP_DEVICE_LEGACY, and determine if use it.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 91da74e81cfdd2774b39a7574edf93de3f2a3f25)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16374-2: PxP: add new format support for as and out buffer
Guoniu.Zhou [Tue, 5 Sep 2017 09:58:02 +0000 (17:58 +0800)]
MLK-16374-2: PxP: add new format support for as and out buffer

1) add PXP_PIX_FMT_BGRA32 format support for AS buffer
2) add PXP_PIX_FMT_BGRA32 format support for OUT buffer

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 4eeefd54cdbb8d1d3ffd64bd444ea7b759101a35)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16374-1: PxP: add alpha blending back compatible
Guoniu.Zhou [Mon, 4 Sep 2017 08:42:41 +0000 (16:42 +0800)]
MLK-16374-1: PxP: add alpha blending back compatible

In support of both g2d and pxp lib alpha blending, there
must be two alpha blending versions. So there is one rule
that user should obey for different usage cases.

  1) g2d alpha blending: user should set combine_enable
      member of struct pxp_proc_data.
  2) pxp lib alpha blending: user should set combine_enable
     member of struct pxp_layer_param if the pxp_layer_param
     describe overlay buffer parameters.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 7c62393a556d043f88dd188edac3c0d250039358)
TODO: check patch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16348: PxP: fix background issue
Guoniu.Zhou [Thu, 31 Aug 2017 11:00:47 +0000 (19:00 +0800)]
MLK-16348: PxP: fix background issue

There was no pxp background register setting, so the
background we see always black.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit d3ee45e2671478854a165f34f91fabac247e8a39)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMMFMWK-7674: PxP: add YVU420P support
Guoniu.Zhou [Thu, 31 Aug 2017 01:39:12 +0000 (09:39 +0800)]
MMFMWK-7674: PxP: add YVU420P support

PxP PS engine support YUV420 format, but not YVU420. The difference
between two format is U and V, if we exchange U and V base address,
the PxP driver can also support YVU420 format.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit cbc71da10afe67ae815a97a68e4a1b0dff4693eb)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16276: PxP: Improve code compatibility
Guoniu.Zhou [Fri, 25 Aug 2017 10:57:08 +0000 (18:57 +0800)]
MLK-16276: PxP: Improve code compatibility

g2d code has different parameter setting about stride parameter.
For compatibility with all cases of using PxP, we need add this
improved feature.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 53c8ffffec181a765f4487a9d1bf2eb05b1b78f7)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16252: PxP: fix video shift issue
Guoniu.Zhou [Fri, 25 Aug 2017 10:48:32 +0000 (18:48 +0800)]
MLK-16252: PxP: fix video shift issue

If pxp use crop x/y valuse as the upper left coordinate in
out buffer, pxp driver only need to write out buffer base
address to pxp out_buf register. If pxp driver use zero as
ps_ulc register value, pxp out_buf register need an offset
added with out buffer base address.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 14c988f1eb7e9471b0875016df29708865727fbb)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16217: PXP: fix pxp rotate yuv formate video issue
Guoniu.Zhou [Fri, 18 Aug 2017 02:09:08 +0000 (10:09 +0800)]
MLK-16217: PXP: fix pxp rotate yuv formate video issue

Because of IC limitation, pxp only can use rotation0 engine to
do rotation operation.

Correct coordinate settings of ps and out buffer.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16045: pxp: add lut function in pxp data flow path
Guoniu.Zhou [Thu, 20 Jul 2017 04:18:42 +0000 (12:18 +0800)]
MLK-16045: pxp: add lut function in pxp data flow path

When do epdc colormap test, the epdc need pxp lut function. But
if the data flow through mux0->mux1...or mux0->mux2..., the pxp
can not trigger interrupt but mux0->mux3... can. This issue only
occures on imx7d, so I set a constant data path when using lut function.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-15962: pxp-v3: fix pxp operation timeout issue
Guoniu.Zhou [Thu, 13 Jul 2017 14:53:51 +0000 (22:53 +0800)]
MLK-15962: pxp-v3: fix pxp operation timeout issue

PxP block on imx6sll, imx6ull is different with imx7d, the node
path_ctrl should be different. So add path_ctrl for 6sll, 6ull.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-15337: pxp-v3: add pxp v3 crop feature
Guoniu.Zhou [Wed, 5 Jul 2017 06:03:06 +0000 (14:03 +0800)]
MLK-15337: pxp-v3: add pxp v3 crop feature

Add pxp v3 crop feature support.
Update the pxp_dma.h file.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-15325: pxp-v3: Modify pxp pitch parameter and csc
Guoniu.Zhou [Wed, 5 Jul 2017 04:20:33 +0000 (12:20 +0800)]
MLK-15325: pxp-v3: Modify pxp pitch parameter and csc
coefficient setting.

Because the caller of pxp-v3 does not set the stride parameter,
this will cause pitch parameter to be zero and pxp can't work.

Correct the csc1 coefficient when use pxp convert YUV to RGB format.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-15027: arm: pxp: Fix uninitialized use of variables
Cristina Ciocan [Thu, 8 Jun 2017 13:47:38 +0000 (16:47 +0300)]
MLK-15027: arm: pxp: Fix uninitialized use of variables

This patch fixes build warning that 2 variables may be used uninitialized
in the pxp_fetch_config() function in drivers/dma/pxp/pxp_dma_v3.c .

The variables in_fmt and out_fmt are passed as parameters to
pxp_fetch_shift_calc() only if shift_bypass is false. This flag cannot be
false unless changed in a code block that also assigns in_fmt and out_fmt.

Since the compiler cannot detect this flow, it shows a warning that in_fmt
and out_fmt are not initialized. Fix this by changing the code flow such
that in_fmt and out_fmt are sent as parameters in the same code block where
they are assigned.

Signed-off-by: Cristina Ciocan <cristina-mihaela.ciocan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14963 PXP: enable pxp interrupt after soft reset
Guoniu.Zhou [Mon, 22 May 2017 11:08:41 +0000 (19:08 +0800)]
MLK-14963 PXP: enable pxp interrupt after soft reset

After soft reset, the irq register value will be zero, so we need set it to
enable all pxp interrupts.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14844 pxp: Add RGB32 format to back-compatible.
Guoniu.Zhou [Mon, 8 May 2017 09:47:24 +0000 (17:47 +0800)]
MLK-14844 pxp: Add RGB32 format to back-compatible.

The latest pxp_dma.h file change PXP_PIX_FMT_RGB32 to PXP_PIX_FMT_XRGB32
format, but the userspace still use PXP_PIX_FMT_RGB32, so add back it and
keep the same with PXP_PIX_FMT_XRGB32 format.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14771 dma: pxp-v3: add new added 2D features support
Guoniu.Zhou [Tue, 2 May 2017 02:59:38 +0000 (10:59 +0800)]
MLK-14771 dma: pxp-v3: add new added 2D features support

 The V3 version PXP has added below new 2D features:
1. Input fetch/store blocks to accept different formats input/output.
2. Add Rotation1 block to do rotation before alpha blending.
3. Add Composite1 block to accept source from input fetch.
4. AS and PS have increased supported pixel formats.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit 4daef24b19890ca65135c48fc24018f64761444f)
(Vipul: Fixed merge conflicts)
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14314-3 pxp-v3: add 'need_yuv_swap' field
Fancy Fang [Thu, 2 Mar 2017 07:51:39 +0000 (15:51 +0800)]
MLK-14314-3 pxp-v3: add 'need_yuv_swap' field

Add 'need_yuv_swap' field to 'pxp_proc_data' structure to
record the yuv formats which needs byte swap.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 28ce43b27faad915e93f47b438d23f4ebfe020b5)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14518-2 pxp: set data path for pxp after reset
Robby Cai [Tue, 28 Mar 2017 10:40:56 +0000 (18:40 +0800)]
MLK-14518-2 pxp: set data path for pxp after reset

it's needed for pxp legacy process, so set it just after
pxp does the reset.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14518-1 pxp: initialize pxp according to recommended flow
Robby Cai [Tue, 21 Mar 2017 12:12:14 +0000 (20:12 +0800)]
MLK-14518-1 pxp: initialize pxp according to recommended flow

use pxp_soft_reset() in probe and resume function because this
implementation follows the recommended flow in the IC spec.
without soft reset, when only use wfe_a process without legacy process it's
likely to meet timeout issue since. In other words, wfe_a process need the
soft reset to work properly.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14369 epdc: sync LUT status to PXP before enable collision detection
Robby Cai [Tue, 28 Feb 2017 13:53:30 +0000 (21:53 +0800)]
MLK-14369 epdc: sync LUT status to PXP before enable collision detection

on imx7d and imx6ull/imx6sll, the collision detection logic is implemented
in PXP WFE (A on imx7d, or B on imx6ull/imx6sll) instead of the logic
implemented on EPDC on previous SoCs (like imx6sl/imx6dl). The driver need
read the LUT status and send this information to PXP WFE (A on imx7d, or B
on imx6ull/imx6sll) engine, so that PXP WFE engine can detect if there is
an active LUT assigned to the pixels affected by current update.
Without this patch, there could possibly be some false collision report due
to the out-of-sync. The patch intends to fix it.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(Vipul: Fixed merge conflicts)
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13198 pxp: imx7d: fix error histogram status report issue
Robby Cai [Thu, 23 Feb 2017 12:50:06 +0000 (20:50 +0800)]
MLK-13198 pxp: imx7d: fix error histogram status report issue

The cause is the legacy process involves PXP AS engine accidentally to
process data, which results to one pixel at (0,0) to be changed. This
will cause an incorrect histogram calculation.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13917 pxp: fix build error for pxp library in user space
Robby Cai [Mon, 13 Feb 2017 10:01:25 +0000 (18:01 +0800)]
MLK-13917 pxp: fix build error for pxp library in user space

Fix following build error by changing type to '__u64'.

include/uapi/linux/pxp_dma.h:230:2: error: unknown type name 'u64'
   u64 lut_sels;
   ^~~

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13737 pxp: refine dithering setting
Robby Cai [Tue, 10 Jan 2017 09:02:17 +0000 (17:02 +0800)]
MLK-13737 pxp: refine dithering setting

- use different LUT setting and coefficient setting for different quantization
  bits.
- clear CTRL0_MUX14_SEL to 0 only when use dithering algorithm, set to 1 for
  not using dithering module.
- bypass PXP_OUT_AS for dithering and add DITHER_STORE_SIZE setting

Signed-off-by: Robby Cai <robby.cai@nxp.com>
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-12908-2 damengine: pxp: fix the histogram setting for i.mx7d
Robby Cai [Wed, 15 Jun 2016 15:36:59 +0000 (23:36 +0800)]
MLK-12908-2 damengine: pxp: fix the histogram setting for i.mx7d

the commit 1b98a9be39a37c2d3ad239c3a1a3a1af1d4ac637 breaks the setting for
mx7d. The patch fixes it.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-11618: pxp output: Fix warning message
Sandor Yu [Thu, 24 Sep 2015 06:52:02 +0000 (14:52 +0800)]
MLK-11618: pxp output: Fix warning message

Fill device_caps in pxp output driver.

Signed-off-by: Sandor Yu <R01008@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoRevert "MLK-14771 dma: pxp-v3: add new added 2D features support"
Vipul Kumar [Mon, 24 Dec 2018 11:51:52 +0000 (17:21 +0530)]
Revert "MLK-14771 dma: pxp-v3: add new added 2D features support"

This patch reverts commit 26d39e14fb8ff2c8a6251f79d640f6ead1a0443e.

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16283 regulator: pfuze100: add 500us wait time for switch enable
Robin Gong [Mon, 28 Aug 2017 09:24:41 +0000 (17:24 +0800)]
MLK-16283 regulator: pfuze100: add 500us wait time for switch enable

add 500us enable_time for switch to be stable while turned on.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16202-01 driver: regulator: add enable/disable for switch for pfuze100
Robin Gong [Thu, 10 Aug 2017 09:03:45 +0000 (17:03 +0800)]
MLK-16202-01 driver: regulator: add enable/disable for switch for pfuze100

Add enable/disable support for switch regulator on pfuze100.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Bai Ping <ping.bai@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13472: hwmon: mxc_mma8451: add empty sentinel entry at the end of i2c_device_id...
Julien Olivain [Wed, 16 Nov 2016 08:20:25 +0000 (09:20 +0100)]
MLK-13472: hwmon: mxc_mma8451: add empty sentinel entry at the end of i2c_device_id table

This is fixing the build when the driver is enabled as a module, when
CONFIG_MXC_MMA8451=m

Signed-off-by: Julien Olivain <julien.olivain@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14275: regulator: pf1550-regulator-rpmsg: clear 'u32 val' before read value by...
Robin Gong [Mon, 27 Feb 2017 08:25:00 +0000 (16:25 +0800)]
MLK-14275: regulator: pf1550-regulator-rpmsg: clear 'u32 val' before read value by rpmsg

Actually, m4 only fill the least 1byte, so we'd better clear 'val' before
reading by rpmsg, thus the gabage data will not bother us.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
(cherry picked from commit df3428c6588a00fa153a3b6996cc33b21b69efb6)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14638-1 regulator: fixed: add off_on_delay support
Haibo Chen [Fri, 14 Apr 2017 10:51:17 +0000 (18:51 +0800)]
MLK-14638-1 regulator: fixed: add off_on_delay support

Add off_on_delay for fixed regulator. This can assign the delay time
between the regulator disable and regulator enable.

User can define the delay value by using 'off-on-delay' in dts file.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14241-1 regulator: pf1550-regulator-rpmsg: add mutex for pm_qos_add_request reentry
Robin Gong [Sun, 19 Feb 2017 07:50:56 +0000 (15:50 +0800)]
MLK-14241-1 regulator: pf1550-regulator-rpmsg: add mutex for pm_qos_add_request reentry

Multi drivers(mmc, cpufreq..) may access pf1550 regulator rpmsg driver at
the same time, so we have to add mutex for this multi-entry case. Otherwise
the below kernel warning maybe triggered:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 19 at kernel/power/qos.c:453 pf1550_send_message+0x4c/0xf8()
pm_qos_add_request() called for already added request
Modules linked in:
CPU: 0 PID: 19 Comm: kworker/0:1 Not tainted 4.1.33-02293-g80b8c19 #636
Hardware name: Freescale i.MX7ULP (Device Tree)
Workqueue: events od_dbs_timer
[<80015d78>] (unwind_backtrace) from [<8001271c>] (show_stack+0x10/0x14)
[<8001271c>] (show_stack) from [<8082ba50>] (dump_stack+0x88/0x9c)
[<8082ba50>] (dump_stack) from [<800387c8>] (warn_slowpath_common+0x80/0xb0)
[<800387c8>] (warn_slowpath_common) from [<80038828>] (warn_slowpath_fmt+0x30/0x40)
[<80038828>] (warn_slowpath_fmt) from [<80341180>] (pf1550_send_message+0x4c/0xf8)
[<80341180>] (pf1550_send_message) from [<80341504>] (pf1550_get_voltage+0x48/0x5c)
[<80341504>] (pf1550_get_voltage) from [<803370a0>] (_regulator_get_voltage+0x68/0xb4)
[<803370a0>] (_regulator_get_voltage) from [<8033936c>] (_regulator_do_set_voltage+0x5c/0x3e4)
[<8033936c>] (_regulator_do_set_voltage) from [<803397a4>] (regulator_set_voltage+0xb0/0x14c)
[<803397a4>] (regulator_set_voltage) from [<8058dae8>] (imx7ulp_set_target+0x178/0x238)
[<8058dae8>] (imx7ulp_set_target) from [<80584d14>] (__cpufreq_driver_target+0x164/0x294)
[<80584d14>] (__cpufreq_driver_target) from [<8058bb08>] (dbs_check_cpu+0x1a0/0x1e0)
[<8058bb08>] (dbs_check_cpu) from [<805888e8>] (od_dbs_timer+0x80/0x138)
[<805888e8>] (od_dbs_timer) from [<8004bbbc>] (process_one_work+0x118/0x3e4)
[<8004bbbc>] (process_one_work) from [<8004bed4>] (worker_thread+0x4c/0x4f4)
[<8004bed4>] (worker_thread) from [<80050e4c>] (kthread+0xdc/0xf4)
[<80050e4c>] (kthread) from [<8000f528>] (ret_from_fork+0x14/0x2c)
---[ end trace f8281ecde7a0b4ce ]---
------------[ cut here ]------------

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13733-3 regulator: pf1550-regulator-rpmsg: update pf1550-rpmsg interface
Robin Gong [Wed, 18 Jan 2017 06:58:18 +0000 (14:58 +0800)]
MLK-13733-3 regulator: pf1550-regulator-rpmsg: update pf1550-rpmsg interface

update driver since m4 side refine the header structure.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13638-4 regulator: fixed: add system pm routines for pinctrl
Peter Chen [Thu, 22 Dec 2016 03:16:09 +0000 (11:16 +0800)]
MLK-13638-4 regulator: fixed: add system pm routines for pinctrl

At some systems, the pinctrl setting will be lost or needs to
set as "sleep" state to save power consumption. So, we need to
configure pinctrl as "sleep" state when system enters suspend,
and as "default" state after system resumes. In this way, the
pinctrl value can be recovered as "default" state after resuming.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-14585-1 power: domain: expose generic_pm_domain structure to clients
Anson Huang [Thu, 30 Mar 2017 22:36:55 +0000 (06:36 +0800)]
MLK-14585-1 power: domain: expose generic_pm_domain structure to clients

In some platforms, accessing registers needs to make sure
power domain is enabled, such as for clock operations, power
domain needs to be enabled first before accessing clock
registers, so some clocks need to know its power domain's
status, it will need to get power domain structure by phandle,
expose the API to support this case.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13793-6 regulator: anatop: fix min dropout for bypass mode
Irina Tirdea [Sun, 12 Feb 2017 19:07:31 +0000 (21:07 +0200)]
MLK-13793-6 regulator: anatop: fix min dropout for bypass mode

In bypass mode, the anatop digital regulators do not have any minimum
dropout value (the input voltage is equal to the output voltage according
to documentation).

Having a min dropout value of 125mV will lead to an increased voltage
for PMIC supplies.

Only set minimum dropout value for ldo enabled mode.

Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoregulator: core: Adjust supplies for bypassed regulators
Leonard Crestez [Fri, 23 Mar 2018 15:50:00 +0000 (17:50 +0200)]
regulator: core: Adjust supplies for bypassed regulators

When a regulator is in bypass mode it's output is equal to it's supply
and it can't do any adjustment. Deal with all set_voltage calls by
propagating them upwards.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoregulator: core: Refactor _regulator_should_adjust_supply condition
Leonard Crestez [Fri, 23 Mar 2018 15:48:40 +0000 (17:48 +0200)]
regulator: core: Refactor _regulator_should_adjust_supply condition

It is difficult to understand what's going on inside a single if
statement so split it into a separate function.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13793-2 regulator: anatop: Do not print error message for EPROBE_DEFER
Irina Tirdea [Thu, 2 Feb 2017 13:35:48 +0000 (15:35 +0200)]
MLK-13793-2 regulator: anatop: Do not print error message for EPROBE_DEFER

An anatop regulator will return -EPROBE_DEFER when trying to register,
if it has a supply from PMIC and this supply is not yet registered.
This does not represent an error since the driver will call probe again
later, so skip the error message in this case.

Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13720-4: regulator: pf1550-regulator-rpmsg: fix "rpmsg_send timeout"
Robin Gong [Thu, 5 Jan 2017 06:15:17 +0000 (14:15 +0800)]
MLK-13720-4: regulator: pf1550-regulator-rpmsg: fix "rpmsg_send timeout"

Sometimes rpmsg callback triggered quickly before reinit_completion, then
cause "rpmsg_send timeout!". Move reinit_completion to the place before
rpmsg_send to make sure the completion is ready before callback triggered.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
(cherry picked from commit 8e44277d3f27e5f46232bd705ee9ef594db42575)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13720-3: regulator: pf1550-regulator-rpmsg: use the specific pf1550 rpmsg channel...
Robin Gong [Thu, 5 Jan 2017 06:09:19 +0000 (14:09 +0800)]
MLK-13720-3: regulator: pf1550-regulator-rpmsg: use the specific pf1550 rpmsg channel name

Since multi rpmsg instances supported now, we can use the specific rpmsg
channel name "rpmsg-regulator-channel" instead of
"rpmsg-openamp-demo-channel".

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
(cherry picked from commit 8a9d73fe43da2833951b428f389aac01aef7cb2a)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13577-4: ARM: configs: imx_v7_defconfig: enable pf1550-regulator-rpmsg driver
Robin Gong [Wed, 7 Dec 2016 03:45:09 +0000 (11:45 +0800)]
MLK-13577-4: ARM: configs: imx_v7_defconfig: enable pf1550-regulator-rpmsg driver

enable pf1550-regulator-rpmsg driver by default.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13636-2 regulator: pf1550-regulator-rmpsg: enable pm_qos to prevent low power...
Robin Gong [Wed, 21 Dec 2016 11:30:06 +0000 (19:30 +0800)]
MLK-13636-2 regulator: pf1550-regulator-rmpsg: enable pm_qos to prevent low power idle

CLKE bit of MU_CR may bring VLS state mess in M4 side, so use pm_qos
instead to prevent i.mx7ulp A7 core enter STOP mode during pf1550 send
command by rpmsg.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13615-1 regulator: pf1550-regulator-rpmsg: should set voltage closest to min_uV
Dong Aisheng [Wed, 14 Dec 2016 22:54:45 +0000 (06:54 +0800)]
MLK-13615-1 regulator: pf1550-regulator-rpmsg: should set voltage closest to min_uV

According to API definition, Set the voltage for the regulator within the
range specified, the driver should select the voltage closest to min_uV.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13577-3 regulator: pf1550-regulator-rpmsg: add pf1550 regulator rpmsg driver
Robin Gong [Wed, 7 Dec 2016 03:41:42 +0000 (11:41 +0800)]
MLK-13577-3 regulator: pf1550-regulator-rpmsg: add pf1550 regulator rpmsg driver

add pf1550 regulator rpmsg driver to control pf1550 on the m4 side
by rpmsg.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13608: mfd: mxc-hdmi-core: fix the dependency of alsa sound
Shengjiu Wang [Wed, 14 Dec 2016 05:02:24 +0000 (13:02 +0800)]
MLK-13608: mfd: mxc-hdmi-core: fix the dependency of alsa sound

When remove sound card build config, there will be error

drivers/built-in.o: In function `mxc_hdmi_register_audio':
vf610_adc.c:(.text+0xd64f8): undefined reference to `_snd_pcm_stream_lock_irqsave'
vf610_adc.c:(.text+0xd6518): undefined reference to `snd_pcm_stream_unlock_irqrestore'
drivers/built-in.o: In function `mxc_hdmi_abort_stream':
vf610_adc.c:(.text+0xd65a4): undefined reference to `_snd_pcm_stream_lock_irqsave'
vf610_adc.c:(.text+0xd65d0): undefined reference to `snd_pcm_stream_unlock_irqrestore'
make: *** [vmlinux] Error 1

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-13387-3 regulator: consumer: add new event macro
Richard Zhu [Mon, 17 Oct 2016 07:17:43 +0000 (15:17 +0800)]
MLK-13387-3 regulator: consumer: add new event macro

Add one new regulator events macro 'REGULATOR_EVENT_AFT_DO_ENABLE'.
1.8v of imx7d pcie phy, should be turned on after
the 1p0d(1.0v) of pcie phy is turned on.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-12928-22: mfd: pf1550: correct VMINSYS_MASK define
Robin Gong [Wed, 13 Jul 2016 01:47:22 +0000 (09:47 +0800)]
MLK-12928-22: mfd: pf1550: correct VMINSYS_MASK define

correct VMINSYS_MASK and _CNFG_REGTEMP_MASK define for regmap

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-12928-21 power: pf1550: fix charger interrupt never caught
Robin Gong [Mon, 27 Jun 2016 08:42:13 +0000 (16:42 +0800)]
MLK-12928-21 power: pf1550: fix charger interrupt never caught

Charger interrupt can't be caught anymore after plug in DC 5V in/out
dozens of times, that caused by VBUS_I or CHG_I pending interrupt not
cleared in time. The root cause is VBUS_I and CHG_I will be triggered in
very narrow window, and VBUS_I/CHG_I act as the sub-interrupt of charger
and share the same interrupt handler. Thus if CHG_I interrupt status is
coming while VBUS_I handler is running, CHG_I interrupt status will never
be cleared, since interrupt has been disabled in ISR. The unclear CHG_I
interrupt status make pf1550 never trigger next interrupt again. So clear
all charger interrupt status in ISR to workaround instead of ack for every
sub-interrupt.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-12928-17 mfd: pf1550: remove DPMI interrupt
Robin Gong [Wed, 12 Oct 2016 06:55:33 +0000 (14:55 +0800)]
MLK-12928-17 mfd: pf1550: remove DPMI interrupt

That's pf1550's internal interrupt, useless for charger.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-12928-16 regulator: pf1550: check device node check
Robin Gong [Wed, 12 Oct 2016 06:53:28 +0000 (14:53 +0800)]
MLK-12928-16 regulator: pf1550: check device node check

Do not probe if the device node is not correct in dts.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-12928-15 mfd/regulator: pf1550: check OTP_SW2_DVS_ENB bit for different voltages
Robin Gong [Mon, 27 Jun 2016 08:13:50 +0000 (16:13 +0800)]
MLK-12928-15 mfd/regulator: pf1550: check OTP_SW2_DVS_ENB bit for different voltages

check OTP_SW2_DVS_ENB bit for the different voltage list while SW2
regulator registered.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-12928-14 mfd: pf1550: add otp read interface
Robin Gong [Tue, 3 May 2016 07:58:46 +0000 (15:58 +0800)]
MLK-12928-14 mfd: pf1550: add otp read interface

add otp read interface to let pf1550 regulator driver or other sub driver
to read out otp register.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-12928-11 mfd: pf1550: add irq ack for pf1550
Robin Gong [Fri, 29 Apr 2016 01:55:33 +0000 (09:55 +0800)]
MLK-12928-11 mfd: pf1550: add irq ack for pf1550

add ".use_ack" ..etc for pf1550 irq, since we have to clear irq status in
pf1550, else no any more interrupt trigged.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-12928-10 mfd: pf1550: correct virtual irqs for every sub-driver of pf1550
Robin Gong [Thu, 28 Apr 2016 13:15:38 +0000 (21:15 +0800)]
MLK-12928-10 mfd: pf1550: correct virtual irqs for every sub-driver of pf1550

Correct virtual irqs macro from zero for every sub-driver of pf1550,
otherwise,below warning will be triggered:
------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at kernel/irq/irqdomain.c:280 irq_domain_associate+0x148/0x1d4()
error: hwirq 0xb is too large for (null)
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.1.15-01689-gb67ecb6-dirty #195
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015e04>] (unwind_backtrace) from [<80012754>] (show_stack+0x10/0x14)
[<80012754>] (show_stack) from [<807909c0>] (dump_stack+0x84/0xc4)
[<807909c0>] (dump_stack) from [<80034914>] (warn_slowpath_common+0x84/0xb4)
[<80034914>] (warn_slowpath_common) from [<80034974>] (warn_slowpath_fmt+0x30/0x40)
[<80034974>] (warn_slowpath_fmt) from [<800717fc>] (irq_domain_associate+0x148/0x1d4)
[<800717fc>] (irq_domain_associate) from [<80071da4>] (irq_create_mapping+0x60/0xc4)
[<80071da4>] (irq_create_mapping) from [<804910a4>] (pf1550_onkey_probe+0xe8/0x230)
[<804910a4>] (pf1550_onkey_probe) from [<803823e8>] (platform_drv_probe+0x44/0xa4)
[<803823e8>] (platform_drv_probe) from [<80380ca0>] (driver_probe_device+0x174/0x2b4)
[<80380ca0>] (driver_probe_device) from [<80380eb0>] (__driver_attach+0x8c/0x90)
[<80380eb0>] (__driver_attach) from [<8037f1e8>] (bus_for_each_dev+0x6c/0xa0)
[<8037f1e8>] (bus_for_each_dev) from [<8038043c>] (bus_add_driver+0x148/0x1f0)
[<8038043c>] (bus_add_driver) from [<803814b4>] (driver_register+0x78/0xf8)
[<803814b4>] (driver_register) from [<80009730>] (do_one_initcall+0x8c/0x1d4)
[<80009730>] (do_one_initcall) from [<80a8bdac>] (kernel_init_freeable+0x144/0x1e4)
[<80a8bdac>] (kernel_init_freeable) from [<8078ca20>] (kernel_init+0x8/0xe8)
[<8078ca20>] (kernel_init) from [<8000f568>] (ret_from_fork+0x14/0x2c)
---[ end trace dc402f301115a3b2 ]---

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>