u-boot.git
5 years agoMLK-21844-1 DTS: fsl-imx8dx: Add APBH-DMA clock to GPMI node
Ye Li [Wed, 17 Apr 2019 02:56:12 +0000 (19:56 -0700)]
MLK-21844-1 DTS: fsl-imx8dx: Add APBH-DMA clock to GPMI node

Since the apbh-dma driver does not support DM, we add its clock to
GPMI node. So when GPMI is probed, its driver can help to enable
the clock.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-16034-02: enable GPMI NAND driver for i.MX8
Han Xu [Wed, 19 Jul 2017 16:43:08 +0000 (11:43 -0500)]
MLK-16034-02: enable GPMI NAND driver for i.MX8

enable the GPMI NAND driver for i.MX8, the major changes

- register defination for i.mx8
- Makefile change for misc.c
- DMA structure must be 32bit address

Signed-off-by: Han Xu <han.xu@nxp.com>
(cherry picked from commit 474c4270108551647c7064a23abdc2e11d7f37ab)
(cherry picked from commit 029cce25cce94c30dd0305bb9b17ba7f939ee1af)

5 years agoMLK-16034-01: change the maximum oob size
Han Xu [Wed, 19 Jul 2017 16:40:59 +0000 (11:40 -0500)]
MLK-16034-01: change the maximum oob size

change the maximum oob size to 1872 for the MT29F128G08CBCCB raw NAND
chip on i.MX8QXP

Signed-off-by: Han Xu <han.xu@nxp.com>
(cherry picked from commit 58dee6ac965000f93693c36c93fb3d453293c43f)
(cherry picked from commit d297f33f4719502aa415dc7c7002c437a6af6c28)

5 years agoMLK-17153-2 imx8mq_arm2: Resolve malloc memory problem for SPL NAND boot
Ye Li [Tue, 12 Dec 2017 06:02:19 +0000 (00:02 -0600)]
MLK-17153-2 imx8mq_arm2: Resolve malloc memory problem for SPL NAND boot

When using SPL NAND boot, the required malloc memory is larger than SD/eMMC boot.
Since we have used out OCRAM (for ATF) and OCRAM_S, there is no enough memory could be
allocated.

The solution is moving the malloc memory pool to DDR. The malloc pool is initialized in
board_init_r, so we moved the VDD_DRAM adjustment and DDR init to board_init_f. Then the DDR
can setup before memory pool initialization. Because the i2c and PMIC driver needs to malloc
data, this change has to enable malloc_f pool by setting CONFIG_MALLOC_F_ADDR to previous
malloc address on OCRAM_S.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit ab1895fb5e38d216ff86de292a44776099d159ab)
(cherry picked from commit de084efbc91de971f10c745bbc94f960cdb813a9)

5 years agoMLK-17153-1 nand: Update SPL MXS NAND mini driver
Ye Li [Tue, 16 Apr 2019 09:47:18 +0000 (02:47 -0700)]
MLK-17153-1 nand: Update SPL MXS NAND mini driver

Update the mini driver to add support for getting ecc info from ONFI and
support read image data from page unaligned NAND address.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-17109-4 imx8mq_arm2: Add i.MX8MQ DDR3L and DDR4 ARM2 boards support
Ye Li [Wed, 15 Nov 2017 06:58:18 +0000 (00:58 -0600)]
MLK-17109-4 imx8mq_arm2: Add i.MX8MQ DDR3L and DDR4 ARM2 boards support

Add board codes, configurations, DTS and DDR initialization codes for the
DDR3L and DDR4 ARM2 boards.

Supported modules
    - DDR3L ARM2: Two RANK DDR3L, QSPI B, eMMC/SD, RMII ENET, UART.
    - DDR4  ARM2: Two RANK DDR4, SD, NAND, RGMII ENET, UART.
      NAND read/write/erase is ok in u-boot, NAND SPL boot will be tested later
      when tool is ready.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 3c3a9e90faa2c3bbb1bcd9adac5915cfd6f2f204)

5 years agoMLK-17109-3 mxs_nand: Add support for i.MX8M
Ye Li [Thu, 16 Nov 2017 04:58:05 +0000 (22:58 -0600)]
MLK-17109-3 mxs_nand: Add support for i.MX8M

Update the gpmi/apbh_dma/bch drivers and relevant registers for i.MX8M.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 6cb839cabb42b81e37214e00448fc5dac89fd1f1)
(cherry picked from commit 468509f86a2d040398aa6b019bb6644bfb0ef11c)

5 years agoMLK-12693-2 nand: mxs: correct bitflip for erased NAND page
Peng Fan [Sat, 7 May 2016 08:58:24 +0000 (16:58 +0800)]
MLK-12693-2 nand: mxs: correct bitflip for erased NAND page

This patch is a porting of
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/commit/?h=imx_4.1.15_1.0.0_ga&id=e4dacc44d22e9474ec456cb330df525cd805ea38
"
i.MX6QP and i.MX7D BCH module integrated a new feature to detect the
bitflip number for erased NAND page. So for these two platform, set the
erase threshold to gf/2 and if bitflip detected, GPMI driver will
correct the data to all 0xFF.

Also updated the imx6qp dts file to ditinguish the GPMI module for i.MX6Q
with the one for i.MX6QP.
"

In this patch, i.MX6UL is added and threshold changed to use ecc_strength.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 489929be0221bb7d4c46bb5bc6083650b78f73e0)
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 37d7f9614aa357f270312d7ceaab0f7006dc5aea)
(cherry picked from commit 5f50a850dd42d28b6105ee7e1b4b1822e7ba569b)

5 years agoMLK-12693-1 nand: mxs: fix the bitflips for erased page when uncorrectable error
Peng Fan [Fri, 6 May 2016 04:13:38 +0000 (12:13 +0800)]
MLK-12693-1 nand: mxs: fix the bitflips for erased page when uncorrectable error

This patch is porting from linux:
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/commit/?h=imx_4.1.15_1.0.0_ga&id=3d42fcece496224fde59f9343763fb2dfc5b0768

"
We may meet the bitflips in reading an erased page(contains all 0xFF),
this may causes the UBIFS corrupt, please see the log from Elie:

-----------------------------------------------------------------
[    3.831323] UBI warning: ubi_io_read: error -74 (ECC error) while reading 16384 bytes from PEB 443:245760, read only 16384 bytes, retry
[    3.845026] UBI warning: ubi_io_read: error -74 (ECC error) while reading 16384 bytes from PEB 443:245760, read only 16384 bytes, retry
[    3.858710] UBI warning: ubi_io_read: error -74 (ECC error) while reading 16384 bytes from PEB 443:245760, read only 16384 bytes, retry
[    3.872408] UBI error: ubi_io_read: error -74 (ECC error) while reading 16384 bytes from PEB 443:245760, read 16384 bytes
...
[    4.011529] UBIFS error (pid 36): ubifs_recover_leb: corrupt empty space LEB 27:237568, corruption starts at 9815
[    4.021897] UBIFS error (pid 36): ubifs_scanned_corruption: corruption at LEB 27:247383
[    4.030000] UBIFS error (pid 36): ubifs_scanned_corruption: first 6569 bytes from LEB 27:247383
-----------------------------------------------------------------

This patch does a check for the uncorrectable failure in the following steps:

   [0] set the threshold.
       The threshold is set based on the truth:
       "A single 0 bit will lead to gf_len(13 or 14) bits 0 after the BCH
        do the ECC."

        For the sake of safe, we will set the threshold with half the gf_len, and
        do not make it bigger the ECC strength.

   [1] count the bitflips of the current ECC chunk, assume it is N.

   [2] if the (N <= threshold) is true, we continue to read out the page with
       ECC disabled. and we count the bitflips again, assume it is N2.
       (We read out the whole page, not just a chunk, this makes the check
        more strictly, and make the code more simple.)

   [3] if the (N2 <= threshold) is true again, we can regard this is a erased
       page. This is because a real erased page is full of 0xFF(maybe also has
       several bitflips), while a page contains the 0xFF data will definitely
       has many bitflips in the ECC parity areas.

   [4] if the [3] fails, we can regard this is a page filled with the '0xFF'
       data.
"

Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit ceb324a2914487aa517a6c70a06a20b5e3438fda)
(cherry picked from commit 026751697e41c7376414a8716cf0ea4bf998b85f)
(cherry picked from commit 93b481f07b8cb59c733f420bebea77ac484f9036)

5 years agoMLK-12601: mtd: gpmi: provide the option to use legacy bch geometry
Ye Li [Tue, 16 Apr 2019 04:06:04 +0000 (21:06 -0700)]
MLK-12601: mtd: gpmi: provide the option to use legacy bch geometry

Provide an option in DT to use legacy bch geometry, which compatible
with the 3.10 kernel bch setting. To enable the feature, adding
"fsl,legacy-bch-geometry" under gpmi-nand node.

NOTICE: The feature must be enabled/disabled in both u-boot and kernel.

Signed-off-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-12214 NAND:apbh_dma: Fix logically dead code issue
Ye.Li [Wed, 13 Jan 2016 02:06:59 +0000 (10:06 +0800)]
MLK-12214 NAND:apbh_dma: Fix logically dead code issue

The list_first_entry always assumes the list is not empty, it won't return NULL pointer when
the list is empty. So the "if (pdesc == NULL)" becomes a dead code. Fix the issue by calling
the list_empty before the list_first_entry.

(Coverity CID 29934)

Signed-off-by: Ye.Li <ye.li@nxp.com>
(cherry picked from commit ff3923f294cc2e15f436d7520b4042736b1b48a6)
(cherry picked from commit 64c6a7b5d621080b8bd948c061a4f223a8c2d886)
(cherry picked from commit b9846931a2196fa2bf29a9cb0304d11e96c2c40a)

5 years agoMLK-11719-4: mtd: gpmi: change the BCH layout setting for large oob NAND
Ye Li [Tue, 16 Apr 2019 03:50:53 +0000 (20:50 -0700)]
MLK-11719-4: mtd: gpmi: change the BCH layout setting for large oob NAND

The code change updated the NAND driver BCH ECC layout algorithm to
support large oob size NAND chips(oob > 1024 bytes) and proposed a new
way to set ECC layout.

Current implementation requires each chunk size larger than oob size so
the bad block marker (BBM) can be guaranteed located in data chunk. The
ECC layout always using the unbalanced layout(Ecc for both meta and
Data0 chunk), but for the NAND chips with oob larger than 1k, the driver
cannot support because BCH doesn’t support GF 15 for 2K chunk.

The change keeps the data chunk no larger than 1k and adjust the ECC
strength or ECC layout to locate the BBM in data chunk. General idea for
large oob NAND chips is

1.Try all ECC strength from the minimum value required by NAND spec to
the maximum one that works, any ECC makes the BBM locate in data chunk
can be chosen.

2.If none of them works, using separate ECC for meta, which will add one
extra ecc with the same ECC strength as other data chunks. This extra
ECC can guarantee BBM located in data chunk, of course, we need to check
if oob can afford it.

Previous code has two methods for ECC layout setting, the
legacy_calc_ecc_layout and calc_ecc_layout_by_info, the difference
between these two methods is, legacy_calc_ecc_layout set the chunk size
larger chan oob size and then set the maximum ECC strength that oob can
afford. While the calc_ecc_layout_by_info set chunk size and ECC
strength according to NAND spec. It has been proved that the first
method cannot provide safe ECC strength for some modern NAND chips, so
in current code,

1. Driver read NAND parameters first and then chose the proper ECC
layout setting method.

2. If the oob is large or NAND required data chunk larger than oob size,
chose calc_ecc_for_large_oob, otherwise use calc_ecc_layout_by_info

3. legacy_calc_ecc_layout only used for some NAND chips does not contains
necessary information. So this is only a backup plan, it is NOT
recommended to use these NAND chips.

Signed-off-by: Han Xu <b45815@freescale.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-19945 mx6dq: hab: Fix chip version in hab.h code
Breno Lima [Mon, 15 Oct 2018 17:11:26 +0000 (14:11 -0300)]
MLK-19945 mx6dq: hab: Fix chip version in hab.h code

Since commit 8891410c729b ("MLK-19848 mx6dq: Fix chip version issue for
rev1.3") it's not possible to call the HAB API functions on i.MX6DQ
SoC Rev 1.3:

Authenticate image from DDR location 0x12000000...
undefined instruction
pc : [<412c00dc>]          lr : [<8ff560bc>]
reloc pc : [<c8b6d0dc>]    lr : [<178030bc>]
sp : 8ef444a8  ip : 126e8068     fp : 8ff59aa8
r10: 8ffd51e4  r9 : 8ef50eb0     r8 : 006e8000
r7 : 00000000  r6 : 126ea01f     r5 : 0000002b  r4 : 126e8000
r3 : 412c00dd  r2 : 00000001     r1 : 00000001  r0 : 00000063
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...

The hab.h code is defining the HAB API base address according to the
old SoC revision number, thus failing when calling the HAB API
authenticate_image() function.

Fix this issue by using mx6dq rev 1.3 instead of mx6dq rev 1.5.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit adc4d93e6e1726f111e86ca74fb76215215dbc86)

5 years agoMLK-19876 imx: hab: Enable hab.c to authenticate additional images in open configuration
Breno Lima [Tue, 9 Oct 2018 02:25:20 +0000 (23:25 -0300)]
MLK-19876 imx: hab: Enable hab.c to authenticate additional images in open configuration

Currently it's not possible to authenticate additional boot images in HAB
open configuration.

The hab.c code is checking if the SEC_CONFIG[1] fuse is programmed prior
to calling the hab_authenticate_image() API function. Users cannot check
if their additional boot images has been correctly signed prior to closing
their device.

Enable hab.c to authenticate additional boot images in open mode so HAB
events can be retrieved through get_hab_status() function.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 15d3e93bd16b5375f4dbf525ce61f0912ece4c0b)

5 years agoMLK-19263-4 hab: Change calling to ROM API failsafe
Ye Li [Mon, 20 Aug 2018 07:00:33 +0000 (00:00 -0700)]
MLK-19263-4 hab: Change calling to ROM API failsafe

Modify to use hab_rvt_failsafe function for failsafe ROM API, not
directly call its ROM address. This function will wrap the sip call for iMX8M
platforms.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit d6b9992db082920b55c08d33df1cb03942939e7f)

5 years agoMLK-17935: imx: HAB: Validate IVT before authenticating image
Utkarsh Gupta [Tue, 3 Apr 2018 00:41:16 +0000 (19:41 -0500)]
MLK-17935: imx: HAB: Validate IVT before authenticating image

Calling csf_is_valid() with an un-signed image may lead to data abort
as the CSF pointer could be pointing to a garbage address when accessed
in HAB_HDR_LEN(*(const struct hab_hdr *)(ulong)ivt_initial->csf).

Authenticate image from DDR location 0x80800000...
Check CSF for Write Data command before authenticating image
data abort
pc : [<fff5494c>]          lr : [<fff54910>]
reloc pc : [<8780294c>]    lr : [<87802910>]
sp : fdf45dc8  ip : 00000214     fp : 00000000
r10: fffb6170  r9 : fdf4fec0     r8 : 00722020
r7 : 80f20000  r6 : 80800000     r5 : 80800000  r4 : 00720000
r3 : 17a5aca3  r2 : 00000000     r1 : 80f2201f  r0 : 00000019
Flags: NzcV  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...

To avoid such errors during authentication process, validate IVT structure
by calling validate_ivt function which checks the following values in an IVT:

IVT_HEADER = 0x4X2000D1
ENTRY != 0x0
RES1 = 0x0
DCD = 0x0       /* Recommended */
SELF != 0x0     /* Absoulute address of IVT */
CSF != 0x0
RES2 = 0x0

This commit also checks if Image's start address is 4 byte aligned.

commit "0088d127 MLK-14945 HAB: Check if IVT valid before authenticating image"
removed as this patch addresses the issue.

Signed-off-by: Utkarsh Gupta <utkarsh.gupta@nxp.com>
(cherry picked from commit dabffd1b04df3b0393ef6a9a35b5fd816edd8c63)
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit b4bda0ae3c5c5be0524148c1bcdfea908da859d6)

5 years agoMLK-17585 imx8/imx8m: Disable TRUST_OF_CHAIN for secure boot
Ye Li [Wed, 11 Apr 2018 14:09:06 +0000 (07:09 -0700)]
MLK-17585 imx8/imx8m: Disable TRUST_OF_CHAIN for secure boot

In the board common directory, the CONFIG_TRUST_OF_CHAIN is automatically
enabled once the CONFIG_SECURE_BOOT is set. Since we don't support this
trust chain on all i.MX8 platforms, modify the Kconfig to disable it.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 0eea75587e40d461cdddd215bc582526b1529bf6)

5 years agoMLK-18159-12 imx: cmd_dek: Enable DEK only for chips supporting CAAM
Ye Li [Wed, 11 Apr 2018 14:06:42 +0000 (07:06 -0700)]
MLK-18159-12 imx: cmd_dek: Enable DEK only for chips supporting CAAM

Since cmd_dek is using CAAM JR, so enable the CMD_DEK only when
HAS_CAAM is set

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 8a552c8d98df953c13a0144972b8c16ed7684e92)

5 years agoMLK-17044-3 booti: Add kernel image authentication for secure boot
Ye Li [Thu, 30 Nov 2017 07:32:39 +0000 (01:32 -0600)]
MLK-17044-3 booti: Add kernel image authentication for secure boot

When secure boot is enabled, add authenticate_image in booti to authenticate
kernel image.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit f29a143cdb8c74566113737e9be7e1bcd8c625f4)
(cherry picked from commit 1e33f493a55dad7e016f948b932000ec295c6df4)

5 years agoMLK-17044-2 HAB: Add SIP call for ARM64 platform
Ye Li [Thu, 30 Nov 2017 07:29:54 +0000 (01:29 -0600)]
MLK-17044-2 HAB: Add SIP call for ARM64 platform

When current EL is not EL3, the direct calling to HAB will fail because
CAAM/SNVS can't initialize at non-secure mode. In this case, we use
SIP call to run the HAB in ATF.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit bca4e251b6083476e987d92c428136a1c81bcb0b)
(cherry picked from commit e31a75cc78ad2d5e6ab5d58851058ab57de1566d)

5 years agoMLK-16787-2 iMX8M: Add support to enable CONFIG_SECURE_BOOT
Ye Li [Thu, 9 Nov 2017 03:43:56 +0000 (21:43 -0600)]
MLK-16787-2 iMX8M: Add support to enable CONFIG_SECURE_BOOT

Add some SOC level codes and build configurations to use HAB lib for
CONFIG_SECURE_BOOT, like adding the SEC_CONFIG fuse, enable fuse driver,
CAAM clock function, and add CAAM secure RAM to MMU table.

The FSL_CAAM is temporally not enabled for iMX8M when CONFIG_SECURE_BOOT is set,
because we don't need the CAAM driver for SPL.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit a0cba5678b10827bc4b5e4fb2e40945a5c332baa)
(cherry picked from commit 330a3108e3806fc2b9fa500f84ebfb4feb821c6d)

5 years agoMLK-16787-1 HAB: Update hab codes to support ARM64 and i.MX8M
Ye Li [Thu, 9 Nov 2017 03:25:44 +0000 (21:25 -0600)]
MLK-16787-1 HAB: Update hab codes to support ARM64 and i.MX8M

There are some changes to support ARM64 i.MX8M platform in this patches:
1. The hab_rvt base and function vectors are different as i.MX6/7

2. Need to bypass an workaround for i.MX6 to fix problem in MMU.

3. The x18 register needed save & restore before calling any HAB API. According
   to ARM procedure call spec, the x18 is caller saved when it is used as
   temporary register. So calling HAB API may scratch this register, and
   cause crash once accessing the gd pointer.

   On ARMv7, the r9 is callee saved when it is used as variable register. So
   no need to save & restore it.

4. Add SEC_CONFIG fuse for iMX8M

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 5f6ef97a9d13361895180df7014f4e4fb48a5875)
(cherry picked from commit 465407632f436cb55db1d261ee0adb7458220045)

5 years agoMLK-12500-1 HAB: Add kernel image authentication in image loading
Ye Li [Tue, 8 Mar 2016 14:03:47 +0000 (22:03 +0800)]
MLK-12500-1 HAB: Add kernel image authentication in image loading

To support the trust boot chain, we integrate the authentication
into the kernel image loading process. The kernel image will be verified
at its load address. So when signing the kernel image, we need to
use this load address which may change on different platforms.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 3c118b8d6bbe1a25ca8c8bafeb528309f16fc73d)
(cherry picked from commit fd9a9759ed9b3a9fc26b18aff00880382213b1ca)
(cherry picked from commit 98d4faefdb83579d4a5a170e06af5efb64ad2b3c)

5 years agoMLK-18158 imx: hab: Add function to authenticate kernel image
Ye Li [Wed, 11 Apr 2018 10:30:19 +0000 (03:30 -0700)]
MLK-18158 imx: hab: Add function to authenticate kernel image

When loading kernel image, the image size is parsed from header, so it
does not include the CSF and IVT.

Add back the authenticate_image function to wrap the imx_hab_authenticate_image
with calculating IVT offset and full image size.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 86bf433c3d6940ce71749e97a37efbff5ac7a79f)

5 years agoMLK-21842-4 imx8mq_evk: Add QSPI NOR support
Ye Li [Wed, 17 Apr 2019 05:29:30 +0000 (22:29 -0700)]
MLK-21842-4 imx8mq_evk: Add QSPI NOR support

Add QSPI NOR relavant configurations and QSPI clock init to board
codes

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-16238-3 imx8m_evk: enable TMU
Ye Li [Wed, 11 Apr 2018 03:37:16 +0000 (20:37 -0700)]
MLK-16238-3 imx8m_evk: enable TMU

Update defconfig to enable TMU for i.MX8M EVK board.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 339bc1a3a377d52c027ccdb146fe7f1cd0c28882)

5 years agoMLK-16238-2 imx: Update CPU info print to support TMU
Ye Li [Tue, 22 Aug 2017 01:43:55 +0000 (20:43 -0500)]
MLK-16238-2 imx: Update CPU info print to support TMU

Current cpu info common function in imx-common only supports imx-thermal, update
the codes to also support TMU.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 878a4ff40987742a30cf8990b2da98205fd6cff5)
(cherry picked from commit be6ab22634214f36716c239413b9203ab1123376)

5 years agoMLK-16238-1 thermal: Add TMU driver for i.MX8M
Ye Li [Mon, 21 Aug 2017 10:41:12 +0000 (05:41 -0500)]
MLK-16238-1 thermal: Add TMU driver for i.MX8M

Porting the TMU driver from kernel and supporting DM in the driver.
Users need to provide the TMU node and sensors nodes in DTB.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit f883de99b93de8c2fadd382d8cf961667bacd038)
(cherry picked from commit 8e09d0f0ab33d9a52098546b147d41c4c2598c0d)

5 years agoMLK-18159-11 imx8mq_evk: Add Typec USB port and USB host support
Ye Li [Wed, 11 Apr 2018 02:20:32 +0000 (19:20 -0700)]
MLK-18159-11 imx8mq_evk: Add Typec USB port and USB host support

i.MX8MQ EVK has two USB ports, the port 0 is typec, the port 1 is host.
This patch enables both device and host mode (xhci) for typec port by setting tcpc
to relevant UFP/DFP mode. For port 1, it is only supports the host mode (xhci).

PD charge is enabled at default on typec port for the dead battery. In this case,
the typec port only works in device mode.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 27345e2b5e85c11b361dffda37172ad1f141d7ba)

5 years agoMLK-18159-10 xhci-imx8m: Add DM USB support
Ye Li [Wed, 11 Apr 2018 07:50:16 +0000 (00:50 -0700)]
MLK-18159-10 xhci-imx8m: Add DM USB support

Since the CONFIG_BLK is defined by DM MMC, to support USB storage,
we have to use DM USB. Add the basic DM support for xhci-imx8m driver.
Also update DTSi to add USB alias seq.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit bff4001d090fabf76d0a9a2060c0dc1386b3cab8)

5 years agoMLK-16066-1 usb: host: add imx8m xhci host driver
Li Jun [Mon, 24 Jul 2017 16:05:20 +0000 (00:05 +0800)]
MLK-16066-1 usb: host: add imx8m xhci host driver

imx8mq usb xhci is a dwc3 based controller, its synopsys PHY
can be controlled by usbmix glue layer. imx8mq has 2 USB3 instance,
this patch enables both two USB3 controllers.

Reviewed-by : Peng Fan <peng.fan@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit cb77028d960277df2dc357a86e6851da74924c1a)
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 5a6326b0498115ca524537d5695ccd582d335157)

5 years agoMLK-17210 usb: imx8m: Add PU power on/off to USB
Ye Li [Wed, 11 Apr 2018 02:33:53 +0000 (19:33 -0700)]
MLK-17210 usb: imx8m: Add PU power on/off to USB

ATF will power off all PUs at default, so for USB, we enable
its PU power for both host and device modes in board_usb_init and
disable the power when usb is stop in board_usb_cleanup.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit 20e8f5ab5e18fa578283ad232e500a47e71fdd28)

5 years agoMLK-16273-1 usb: dwc3: add suspend clock setting interface
Li Jun [Fri, 25 Aug 2017 17:49:51 +0000 (01:49 +0800)]
MLK-16273-1 usb: dwc3: add suspend clock setting interface

Some dwc3 based USB3 IP may have a wrong default suspend clk
setting, so add an interface to correct it by board setting.

Acked-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit 240b636718313e03db505a713e66e3f893cb7727)
(cherry picked from commit ac64f460533f734ac5b2659f8e8ba9fbdd56e539)

5 years agoMLK-17050 imx8m: print out atf commit
Peng Fan [Mon, 4 Dec 2017 07:29:20 +0000 (15:29 +0800)]
MLK-17050 imx8m: print out atf commit

Print out atf commit in U-Boot.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit df89948806c38e38119767a67ef0e18f24ac886b)
(cherry picked from commit 3a17aa1659fbfe675b74ada60a481d93bb557cdc)

5 years agoMLK-16974 imx8m: Modify kernel DTB to limit USB to high-speed for mfgtool
Ye Li [Fri, 24 Nov 2017 07:33:21 +0000 (01:33 -0600)]
MLK-16974 imx8m: Modify kernel DTB to limit USB to high-speed for mfgtool

We found USB issue when using super-speed for mfgtool, temporally work around
the problem to use high-speed only.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit e31f99c05c37ac35080e415cfd8c8e2a1c96f865)
(cherry picked from commit 6134c7ee3967fe303bdb2bb7e981ac698b909c5d)

5 years agoMLK-16246 imx8mq_evk: Update DTB to disable DCSS and HDMI for mfgtool
Ye Li [Wed, 23 Aug 2017 09:40:58 +0000 (04:40 -0500)]
MLK-16246 imx8mq_evk: Update DTB to disable DCSS and HDMI for mfgtool

When booting for mfgtool, we need to disable DCSS and HDMI since the HDMI
firmware won't be loaded by mfgtool. Add the detect in u-boot and update the
DTB.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 1d01cec0296d56ba8436941864d8da81013e0732)
(cherry picked from commit 89512c1b28add9daf8001c51a44b9da826cbb9ad)

5 years agoMLK-21843 fsl_qspi: Fix QSPI driver to adapt spi-mem
Ye Li [Wed, 17 Apr 2019 03:19:42 +0000 (20:19 -0700)]
MLK-21843 fsl_qspi: Fix QSPI driver to adapt spi-mem

After switched to spi-mem the data format passed by xfer is changed for
erase. The address of erase is moved to data phase in SPI_XFER_END.
Update the driver to fix the erase issue

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21842-3 imx8mq_evk: Fix ENET GPR selection bit
Ye Li [Fri, 12 Apr 2019 09:33:41 +0000 (02:33 -0700)]
MLK-21842-3 imx8mq_evk: Fix ENET GPR selection bit

Only the GPR0 bit[13] is used as GPR_ENET1_TX_CLK_SEL, bit[17] is reserved
on imx8mq. So we don't need to clear bit[17].

Add the definition of bit[13] in register file.
Also fix the size of gpr array, should be 48 not 47.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21842-2 ddr: imx8m: Fix ddr4 driver build issue
Ye Li [Tue, 16 Apr 2019 09:17:12 +0000 (02:17 -0700)]
MLK-21842-2 ddr: imx8m: Fix ddr4 driver build issue

Since the parameter of dram_pll_init is changed, update to use new.
Also remove non-existed header file.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21842-1 DTS: imx8mq: Update DTS files for imx8mq and imx8mq EVK
Ye Li [Fri, 12 Apr 2019 09:05:36 +0000 (02:05 -0700)]
MLK-21842-1 DTS: imx8mq: Update DTS files for imx8mq and imx8mq EVK

Update thermal node properties, i2c pinmux, usdhc pinmux,
uart nodes, qspi node, gpmi/apbh-dma nodes and alias.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-18159-6 imx8m: add IMX_BOOTAUX kconfig for imx8m
Ye Li [Mon, 16 Apr 2018 06:47:44 +0000 (23:47 -0700)]
MLK-18159-6 imx8m: add IMX_BOOTAUX kconfig for imx8m

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit c8c5c3469f6ffa4789ae9e10c4a97c232657493c)

5 years agoMLK-18159-5 imx8m: Enable wdog reset for i.MX8MQ
Ye Li [Mon, 16 Apr 2018 03:13:22 +0000 (20:13 -0700)]
MLK-18159-5 imx8m: Enable wdog reset for i.MX8MQ

We will use watch dog to reset system for i.MX8MQ not through the PSCI.
Build watchdog driver for imx8mq.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit e953113b7f253849d1d43385748287cdfd8eaa63)

5 years agoMLK-18159-3 imx: spl: Add eMMC boot support
Ye Li [Wed, 11 Apr 2018 07:53:11 +0000 (00:53 -0700)]
MLK-18159-3 imx: spl: Add eMMC boot support

When boot from eMMC, SPL needs to switch to boot partition for
image loading, have to ensure MMCSD_MODE_EMMCBOOT is used for eMMC port.
So we have to know whether it is boot from eMMC or SD and select corresponding
spl boot mode.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 751e49b3e6baee2b3c7793143853b9da8d78b5a9)

5 years agoMLK-18159-2 fsl_qspi: Add support for i.MX8M
Ye Li [Tue, 10 Apr 2018 10:07:30 +0000 (03:07 -0700)]
MLK-18159-2 fsl_qspi: Add support for i.MX8M

The i.MX8M reuses the QSPI controller from i.MX7D. Add the CONFIG_IMX8M
define to the driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit c0d5846b027a51e8d3d12700a63dec5ce8f3cb9a)

5 years agoMLK-16132-5: board: freescale: common: allow dm be omited by SPL
Peng Fan [Fri, 4 Aug 2017 03:05:05 +0000 (11:05 +0800)]
MLK-16132-5: board: freescale: common: allow dm be omited by SPL

Allow be omited by DM

Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit cbe93dc60b64072d4b945c7634c6ed3560a2ec77)
(cherry picked from commit af4b84a6daf8009b89240ecfb1581b94685629f9)

5 years agoMLK-16132-4: power: pmic/regulator allow dm be omited by SPL
Peng Fan [Fri, 4 Aug 2017 03:04:23 +0000 (11:04 +0800)]
MLK-16132-4: power: pmic/regulator allow dm be omited by SPL

Allow the dm driver be omited by SPL.
Fix wrong config name for pfuze100 regulator.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit cc1f5c2bf70307e9b0449037ba397996ba4c030d)

5 years agoMLK-21841-4 imx8qm_arm2: Add support for iMX8QM validation boards
Ye Li [Fri, 12 Apr 2019 06:34:09 +0000 (23:34 -0700)]
MLK-21841-4 imx8qm_arm2: Add support for iMX8QM validation boards

Add board codes and defconfig files for iMX8QM validation boards,
including: iMX8QM LPDDR4 validation board and DDR4 validation board.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21841-3 imx8qxp_arm2: Add support for iMX8QXP/DX validation boards
Ye Li [Fri, 12 Apr 2019 06:23:07 +0000 (23:23 -0700)]
MLK-21841-3 imx8qxp_arm2: Add support for iMX8QXP/DX validation boards

Add board codes and defconfig files for iMX8QXP/DX validation boards,
including: 8QXP LPDDR4 validation board, 8QXP DDR3 validation board,
8QXP/DX 17x17 LPDDR4/DDR3l validation board.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21841-2 DTS: imx8qm/qxp: Add validation board (ARM2) DTS files
Ye Li [Thu, 11 Apr 2019 05:47:38 +0000 (22:47 -0700)]
MLK-21841-2 DTS: imx8qm/qxp: Add validation board (ARM2) DTS files

Add the DTS files for iMX8QM LPDDR4/DDR4 validation boards,
iMX8QXP 21x21 LPDDR4 validation board and iMX8QXP/DX 17x17 DDR3L/LPDDR4
validation board.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21841-1 DTS: Rename imx8qm/qxp -u-boot.dtsi files
Ye Li [Thu, 11 Apr 2019 05:24:11 +0000 (22:24 -0700)]
MLK-21841-1 DTS: Rename imx8qm/qxp -u-boot.dtsi files

Change the files name from fsl-imx8xx-mek-u-boot.dtsi to fsl-imx8xx-u-boot.dtsi.
Because we don't have any board related modification in these dtsi files, and we
need to include them for validation boards.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-20887 usb: gadget: Fix controller index in UMS
Ye Li [Thu, 31 Jan 2019 10:20:23 +0000 (02:20 -0800)]
MLK-20887 usb: gadget: Fix controller index in UMS

The usb mass storage (f_mass_storage.c) uses fixed usb index 0,
this causes problem while CDNS3 USB controller index is 1.
Modify the API of fsg to pass the controller index.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
5 years agoMLK-21840-2 imx8qm_mek: Add iMX8QM MEK board support
Ye Li [Thu, 11 Apr 2019 01:47:01 +0000 (18:47 -0700)]
MLK-21840-2 imx8qm_mek: Add iMX8QM MEK board support

Add board codes and defconfig file for iMX8QM MEK board. Support
peripherals: UART, USB host, Flexspi, SD/eMMC, ENET, LVDS display,
i2c.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21840-1 DTS: imx8qm_mek: Add DTS files for QM MEK board
Ye Li [Thu, 11 Apr 2019 01:44:44 +0000 (18:44 -0700)]
MLK-21840-1 DTS: imx8qm_mek: Add DTS files for QM MEK board

Add DTS files for iMX8QM MEK board. Porting them from kernel
4.14.98 DTS

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21839 misc: scu: Update SCU driver to adapt all imx8 platforms
Ye Li [Thu, 11 Apr 2019 01:31:53 +0000 (18:31 -0700)]
MLK-21839 misc: scu: Update SCU driver to adapt all imx8 platforms

Since clk and pinctrl will be get (probe) during each device probe,
we don't need to probe them in scu driver. Only need to bind the sub-nodes
(clk and iomuxc) of MU node with their drivers.

After this change, we can adapt scu driver to all imx8 platforms like
8QM, 8QXP. And don't need to care the compatible strings of clk and iomuxc.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21837-2 imx8: clock: Update non-DM clock functions
Ye Li [Wed, 10 Apr 2019 04:06:02 +0000 (21:06 -0700)]
MLK-21837-2 imx8: clock: Update non-DM clock functions

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21838 net: fec_mxc: Update driver to use more clks for iMX8
Ye Li [Wed, 10 Apr 2019 04:00:51 +0000 (21:00 -0700)]
MLK-21838 net: fec_mxc: Update driver to use more clks for iMX8

Add support for more clocks used by iMX8 from DTB:
ref_clock, tx_2x_clock, ahb_clock
And update get clock rate interface to support multiple fec ports.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21837 clk: imx8: Update imx8 clock driver
Ye Li [Wed, 10 Apr 2019 03:30:33 +0000 (20:30 -0700)]
MLK-21837 clk: imx8: Update imx8 clock driver

Update imx8 clock driver to support LPCG and full clocks tree for some
modules aligned with kernel. And add the imx8qm clock tree.

We divide the clock to serveral types: slice, fixed, lpcg, gpr, mux.
Generally slice and fixed clocks are the sources. lpcg, gpr and mux are
the downstream of those sources and are used for gating, muxing or dividing
functions.

Notice: since the clock depends on the power domain of its resource, must power
on the resource firstly, then we can get clock. Otherwise, we can't access lpcg.
Thus, the clock dump only dumps the slice clock.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21831-3 scu_api: Update SCFW API
Ye Li [Wed, 10 Apr 2019 03:26:07 +0000 (20:26 -0700)]
MLK-21831-3 scu_api: Update SCFW API

Update SCFW API to add new APIs and definitions.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21836-3 dts: fsl-imx8dx: Update flexspi node for assigned clock
Ye Li [Wed, 10 Apr 2019 03:03:18 +0000 (20:03 -0700)]
MLK-21836-3 dts: fsl-imx8dx: Update flexspi node for assigned clock

The assigned clock is missed in flexspi node, so that it causes failure
when assigned default clock rate and cause device probe failed.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21836-2 fsl_fspi: Update flexspi driver to use clk uclass interface
Ye Li [Wed, 17 Apr 2019 03:26:55 +0000 (20:26 -0700)]
MLK-21836-2 fsl_fspi: Update flexspi driver to use clk uclass interface

Since iMX8 has implemented the clk uclass driver, so we can parse the
clock from DTB and enable it in driver. Add support to this new interface

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21836-1 fsl_fspi: update fspi driver to adapt spi-mem
Ye Li [Wed, 10 Apr 2019 03:01:00 +0000 (20:01 -0700)]
MLK-21836-1 fsl_fspi: update fspi driver to adapt spi-mem

After switch to spi-mem, the din buffer format is changed
1. For erase command, the address is in data phase.
2. For 4 bytes address device, even we do not enable 4 bytes support,
   it still pass down 4 bytes address.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21835-2 imx8qxp_mek: Adapt to new lpcg functions
Ye Li [Wed, 10 Apr 2019 03:17:56 +0000 (20:17 -0700)]
MLK-21835-2 imx8qxp_mek: Adapt to new lpcg functions

Update QXP MEK board to use new lpcg functions

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21835-1 imx8: lpcg: Update lpcg driver
Ye Li [Wed, 10 Apr 2019 03:07:37 +0000 (20:07 -0700)]
MLK-21835-1 imx8: lpcg: Update lpcg driver

Change the functions names to not camelcase. and add function
to check whether one lpcg gate is on.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-21165 imx8: Workaround LPCG HW issue
Ye Li [Mon, 25 Feb 2019 04:08:43 +0000 (20:08 -0800)]
MLK-21165 imx8: Workaround LPCG HW issue

There are two LPCG HW issues reported in TKT322331. Add workaround
for them in u-boot.
1. Back to back LPCG write access must have 4x DSC cycle interval.
2. When DSC clock is gated, LPCG write access may be missed due to
   the edge detect is not see by DSC. Two writes shall be performed
   to re-enable the clock if DSC clock is gated

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 96186ca0048e6ae261176e5f3ebf02be09bacb08)

5 years agoMLK-20528-1 imx8: Add lpcg driver for iMX8QM/QXP
Ye Li [Wed, 5 Dec 2018 06:22:59 +0000 (22:22 -0800)]
MLK-20528-1 imx8: Add lpcg driver for iMX8QM/QXP

Each module may have one or more lpcg registers for SW/HW enabling its
clocks. Add lpcg register address and its driver for accessing lpcg.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 19f234266e07c18ab8364336779bf2d3d1f51c81)

5 years agoMA-14379 [coverity] Resource leak (RESOURCE_LEAK)
Luo Ji [Thu, 14 Mar 2019 09:02:25 +0000 (17:02 +0800)]
MA-14379 [coverity] Resource leak (RESOURCE_LEAK)

Fix coverity issue: CID 2970630: Resource leak (RESOURCE_LEAK)
leaked_storage: Variable cdns going out of scope leaks the storage
it points to.

Memory allocated by devm_kzalloc() won't be freed automatically in
u-boot, free the memory manually here.

Test: Coverity scan pass.

Change-Id: I3000a2385941cef3b8b7e01611cfdc999971a4ca
Signed-off-by: Luo Ji <ji.luo@nxp.com>
(cherry picked from commit ff1364165cbc0a19d554158995bdd9c3ccd0cc20)

5 years agoMA-12160 Check the request status in dequeue for cdns3 driver
Luo Ji [Fri, 13 Jul 2018 10:23:43 +0000 (18:23 +0800)]
MA-12160 Check the request status in dequeue for cdns3 driver

"fastboot reboot bootloader" fails to transmit "OKAY" back to host on
imx8qm because fastboot_tx_write_str() will dequeue the IN request
first before queue it, cdns3 usb driver will always invoke the complete
callback in dequeue, so if we are going to do_reset() in the complete
callback, the device will reboot before we can transmit "OKAY" back to
host in queue.
Check the request status in dequeue first before invoke the complete
callback, this is basically ported from kernel.

Test: No error messages when run "fastboot reboot bootloader" on
      imx8qm_mek.

Change-Id: I085df3bd0f37480b8636585cc1068d5fcae331c1
Signed-off-by: Luo Ji <ji.luo@nxp.com>
(cherry picked from commit 41b5389845b8912689288d52b8cfc9f71dc115e0)

5 years agoMLK-18262 usb: cnds3: gadget: correct maxpacketsize to be 512 for HS
Li Jun [Thu, 10 May 2018 03:12:24 +0000 (11:12 +0800)]
MLK-18262 usb: cnds3: gadget: correct maxpacketsize to be 512 for HS

In case CONFIG_USB_CDNS3_GADGET_FORCE_HIGHSPEED, we should set
the maxpacketsize to be 512 instead of 1024.

Reviewed-by: Ye Li <ye.li@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit 5e05784a89ec2fbbda9298f2c74ade134213b8c4)
(cherry picked from commit 8da7e8dc004ed87d1fd3942959b6d12fc491e86b)

5 years agoMLK-14862 net: eth-uclass: add return value check
Peng Fan [Thu, 11 May 2017 02:21:48 +0000 (10:21 +0800)]
MLK-14862 net: eth-uclass: add return value check

Add return value check

Coverity 392391

Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 3f8052264b97b0bf87452876307ca115b7a518a3)
(cherry picked from commit edd2be5f4b978242bba403f97a9b7e4febbf9bab)

5 years agoMLK-17821-2 imx8: clock: Add cdns3 and usbotg clock enable and disable
Ye Li [Thu, 21 Mar 2019 08:21:29 +0000 (01:21 -0700)]
MLK-17821-2 imx8: clock: Add cdns3 and usbotg clock enable and disable

Implemented the clock enable and disable interfaces for CDNS3 USB
driver and EHCI-MX6 USB otg driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 2f0dc4c503d8ac831fb809ec124e79712defae77)

5 years agoMLK-17821-1 USB: gadget: Add the cadence USB3 gadget driver
Ye Li [Fri, 16 Mar 2018 07:03:40 +0000 (00:03 -0700)]
MLK-17821-1 USB: gadget: Add the cadence USB3 gadget driver

Porting the cadence USB3 (CDNS3) driver from kernel to u-boot. We only support
the gadget (device mode), while the host mode is not supported. Users remains
to use xhci-imx8 driver for host mode.

Some changes in the CDNS3 driver porting:

1. Add match_ep call back to usb_gadget_ops. The CDNS3 gadget driver replies
   on this operation to bind the usb_ep/usb_ss_ep with the endpoint descriptor
   when function layer uses usb_ep_autoconfig to add endpoint descriptors to gadget.
   So that CDNS3 driver can know the EP information and configure the EP once the
   set configuration request is received.

2. U-boot does not have CMA, so it won't allocate uncached memory. Need to flush
   TRB and its DMA buffer before prime to usb controller and after complete transfer.

3. In core.c, we add functions to hook with u-boot. It needs uplayer like
   to pass the register base address of each part of the USB controller.

4. Force the CDNS3 gadget max speed to HS. The SuperSpeed is not supported by u-boot,
   so disable it in gadget driver. A configuration USB_CDNS3_GADGET_FORCE_HIGHSPEED is
   selected.

5. Added gadget_is_cdns3 checking to provide bcdUSB value in device descriptor.

6. Moved some new fields in usb_ep structure to usb_ss_ep, since u-boot does not have them.

7. Remove host part codes as it is not supported by this driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 70514bd095ff9a94e9a523845641381486284257)
(cherry picked from commit db2cc879f7e53ead1e3615c1d61ba0b571e81dfa)

5 years agoMLK-18161-16 fsl_esdhc: Update esdhc driver to support HS400 ES mode
Ye Li [Thu, 19 Apr 2018 09:19:13 +0000 (02:19 -0700)]
MLK-18161-16 fsl_esdhc: Update esdhc driver to support HS400 ES mode

Update for HS400 ES and enable iMX8QM/QXP for HS400 and HS400 ES.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 0768f229e824120c53d40a1c0d062c1f49384100)

5 years agoMLK-18161-15 mmc: Add HS400 Enhanced Strobe mode support
Ye Li [Thu, 19 Apr 2018 09:18:17 +0000 (02:18 -0700)]
MLK-18161-15 mmc: Add HS400 Enhanced Strobe mode support

The eMMC 5.1 supports the HS400 Enhanced Strobe mode, add this
support to mmc.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 0972a7219faefcae27e7c39a9c84f46145148913)

5 years agoMA-10633 [Android] enlarge the timeout for waiting DATA0
zhang sanshan [Thu, 16 Nov 2017 07:38:11 +0000 (15:38 +0800)]
MA-10633 [Android] enlarge the timeout for waiting DATA0

600ms is not enough to erase erase_grp_size for some sdcard.
enlarge to to 1200ms.

Change-Id: Ic980794fa3064f92b479b87380e694f853f83c6a
Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
(cherry picked from commit 4a1db2cd700ea434e25c0692c545e571f5841a00)
(cherry picked from commit 3f4f3e0519c8415409d6186a7e775c9556864001)

5 years agoMLK-17239 mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue
Ye Li [Thu, 19 Apr 2018 04:33:22 +0000 (21:33 -0700)]
MLK-17239 mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue

When sd/mmc work at DDR mode, like HS400/HS400ES/DDR52/DDR50 mode,
the actual clock rate is just half of the expected clock.

This patch set the DDR_EN bit first for DDR mode, hardware divide
the usdhc clock automatically, then follow the original sdr clock
setting method.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 2a8a0cf0f5d2fcb06d217e3d026219532fed5eb7)

5 years agoMLK-21834-2 imx8qxp_mek: Update board codes and config
Ye Li [Thu, 21 Mar 2019 07:45:13 +0000 (00:45 -0700)]
MLK-21834-2 imx8qxp_mek: Update board codes and config

Enable PCIE, ENET no-DM support, video, USB OTG and CDNS USB3,
M4 bootaux, fuse, memtest, thermal.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-20559-7 tcpc: Bypass the tcpc operations for SPL
Ye Li [Thu, 3 Jan 2019 09:06:35 +0000 (01:06 -0800)]
MLK-20559-7 tcpc: Bypass the tcpc operations for SPL

The SPL won't use host mode, and the tcpc is default set as device mode.
So we don't need to access tcpc in SPL.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 69dfae092f22308765c66a072f82c5b67aa8d72e)

5 years agoMLK-18437-4 tcpc: Enable DRP when setting DFP or UFP
Ye Li [Wed, 30 May 2018 03:53:30 +0000 (20:53 -0700)]
MLK-18437-4 tcpc: Enable DRP when setting DFP or UFP

Enable the DRP, so the tcpc can try to toggle the role. This helps to
determine the current role when we don't know whether device or host is
connected.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 9617e630151731aa42cbad95c70e7f3526cf242e)
(cherry picked from commit ee4a1d71b7b7cd9529f8a13b170a110949b8ef0c)

5 years agoMLK-18437-2 tcpc: Add external PD switch call back
Ye Li [Wed, 30 May 2018 03:37:58 +0000 (20:37 -0700)]
MLK-18437-2 tcpc: Add external PD switch call back

Introduce a callback function to setup external PD switch. When PD
process is enabled, we call this function only when SINK_VBUS is enabled
to avoid system power shut down.
When PD process is disabled, since the tcpc and external PD switch may
still in dead battery mode, set them to exit dead battery.

This patch is used to fix two issues on iMX8MM EVK:

1. When power on the board, by default the PTN5110 and NX20P3483 will
   enter dead battery mode. But for some cases, like timing issue for PTN5110
   and NX20P3483 (refer rework instructions CQ6), and when dual port are plugin
   power sources. There are possibility the PTN5110 does not enter dead battery mode,
   but NX20P3483 is in dead battery. So for the USB2 primary power port, we has to check
   SINK_VBUS before NX20P3483 exits dead battery, otherwise the system power will shut down

2. For the USB1 port, when dual port are plugin power sources. We need to set both
   PTN5110 and NX20P3483 exit dead battery. Otherwise this port can't work for normal
   host/device mode.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 30004c6b35a5f0b8460f534d324f9bde01325373)
(cherry picked from commit baf8c71cb56ea3653948e7441a8005cb2b2e2848)

5 years agoMLK-18289-1 tcpc: Update driver to support two ports logic
Ye Li [Mon, 23 Apr 2018 06:13:28 +0000 (23:13 -0700)]
MLK-18289-1 tcpc: Update driver to support two ports logic

On iMX8MM EVK, there are two USB ports. Both can support USB PD, but
with USB2 has HW priority.

So we Change tcpc_pd_sink_check_charging to public function and
use it to know whether the USB tcpc is power charging.

Additional, add disable_pd to init config. So we can disable PD session
for uncharged or lower priority port.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 867b0263d60bb5385b09cfa21d6f620bea855075)
(cherry picked from commit 2ce601125874bbf32498937495070f32951d5480)

5 years agoMLK-18160 tcpc: Add driver for USB typec port controller (TCPC)
Ye Li [Tue, 10 Apr 2018 13:00:26 +0000 (06:00 -0700)]
MLK-18160 tcpc: Add driver for USB typec port controller (TCPC)

Add an simple driver for USB typec port controller in freescale common codes.
The functionalities in this driver include:

1. Support to set UFP mode, when running as device mode, the
   board level codes can use it to configure the TCPC port to UFP mode.

2. Support to set DFP mode for USB host.

3. Support PD charge with setup PD connection and send/receive PD messages
   to negotiate a proper voltage and current.

4. Support power source with 2 stages of capability. Some power delivery source
   send the source capability by 2 stages: 1st stage send the source capability
   message with only basic 5V PDO, after the 5V power session setup, 2nd stage
   it will send full source capabilities with all PDOs it can support, in this
   case, we should go on to process the following PD source cap to have a new
   power session setup.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit b81241ee369708015008c45f9fb7ed6c1a0b5da9)

5 years agoMLK-21834-1 DTS: Update iMX8QXP MEK board DTS
Ye Li [Wed, 20 Mar 2019 09:59:44 +0000 (02:59 -0700)]
MLK-21834-1 DTS: Update iMX8QXP MEK board DTS

Add i2c alias for i2c mux bus, add mipi lvds i2c nodes, usbotg1, usbotg3,
fec, flexspi, and update iomux.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-18161-1 imx8qm/qxp: Print the CPU temperature
Ye Li [Tue, 17 Apr 2018 07:25:42 +0000 (00:25 -0700)]
MLK-18161-1 imx8qm/qxp: Print the CPU temperature

Using SC thermal sensor to get temperature and print the CPU
temperature at booting.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 3a4f3e43286014110da0d3785a868cb4b25fbc83)

5 years agoMLK-21833 imx8: Update CPU driver for each core name
Ye Li [Wed, 20 Mar 2019 08:42:06 +0000 (01:42 -0700)]
MLK-21833 imx8: Update CPU driver for each core name

Since 8QM has two cluster A53 and A72, so we can't use current core name
for all cores. Change to use compatible string for the core name

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-16208-1 thermal: Add driver to support i.MX8QM/QXP CPU thermal sensor
Ye Li [Wed, 20 Mar 2019 08:19:11 +0000 (01:19 -0700)]
MLK-16208-1 thermal: Add driver to support i.MX8QM/QXP CPU thermal sensor

Add the DM thermal driver for i.MX8QM and QXP. The driver depends on DTB thermal
sensor nodes. Will create device for each thermal in thermal-zones. User can
use the thermal name to get the device from UCLASS_THERMAL.

The driver flag is set to DM_FLAG_PRE_RELOC, to support run it at early stage,
need add "u-boot,dm-pre-reloc" property to the thermal node.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 98005e0b5a46bd17160fac18be2374c15dba54f9)
(cherry picked from commit 0873cbf1aa61d9398b66c9e073ca8434717de131)

5 years agoMLK-21831-2 scu_api: Add sc_misc_get_temp API
Ye Li [Wed, 20 Mar 2019 08:18:34 +0000 (01:18 -0700)]
MLK-21831-2 scu_api: Add sc_misc_get_temp API

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-15324-3 imx8: Add LVDS and DC setup common functions
Ye Li [Mon, 3 Jul 2017 08:58:22 +0000 (03:58 -0500)]
MLK-15324-3 imx8: Add LVDS and DC setup common functions

Add common functions for LVDS/DC setup, video framebuffer init/disable,
LVDS to HDMI card settings, etc. Refactor it from video_imxdpuv1.c.
1. Add power, clocks, PLL relevant setup for LVDS and DC.
2. Configure the LVDS and its PHY settings for the display format and pixel link.
3. Setup the LVDS to HDMI card.
4. Implement the video_hw_init by calling DC driver API to output data to
   specified display panel.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 9317f7ea4d976335a633f7056bbac1f77b01247a)
(cherry picked from commit 11dddc05ba174a4a31810efc0b860d24d385de97)

5 years agoMLK-12437-2 Video: Update the common board_video_skip to support MXS LCD
Ye Li [Tue, 23 Feb 2016 07:19:39 +0000 (15:19 +0800)]
MLK-12437-2 Video: Update the common board_video_skip to support MXS LCD

Update the board_video_skip to use CONFIG_VIDEO_MXS for LCD display support.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit d6d0265b09e66c576ab4c01841166415f834a1ff)
(cherry picked from commit 8fa188c1466e6a74536f1b46fff88bf9b08b0d78)
(cherry picked from commit f56fdb7e6ba51eef3dd7b8c46948ecdad2e17c75)

5 years agoENGR00315894-70 iMX6SX:Video Update MXS LCDIF driver
Ye.Li [Thu, 12 Jun 2014 09:10:32 +0000 (17:10 +0800)]
ENGR00315894-70 iMX6SX:Video Update MXS LCDIF driver

Add a new interface "mxs_lcd_panel_setup" to setup fb parameters and
specifies the LCDIF controller for multiple controllers of iMX6SX.
Pass fb parameters via "videomode" env remains work if the new interface
is not called before video initialization.

Modify LCDIF clock interface "mxs_set_lcdclk" to support multiple
LCDIF controllers on iMX6SX.

Signed-off-by: Ye.Li <B37916@freescale.com>
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
(cherry picked from commit d7f49b9378547c3a57b96bcdb907fc44616beb3d)
(cherry picked from commit e1343191b9de227c582847e7eeb5ce9238be0754)
(cherry picked from commit 9632ebeccc34d663e21bd19f2fe62de51947296e)
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 948c5c95e87a47bb3a80c8e67b67fe70e1e4a569)

5 years agoMLK-15324-2 video: imxdpuv1: Add DPU driver for i.MX8
Ye Li [Mon, 3 Jul 2017 08:54:49 +0000 (03:54 -0500)]
MLK-15324-2 video: imxdpuv1: Add DPU driver for i.MX8

Adding new IMXDPUV1 (aka Seeris, Iris-lite) display control driver.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 43541cba14f851c6eebaa84becd42967f94a9cfd)
(cherry picked from commit 02b99a8ce3ed8f7ab1798b946c10b614ae386924)

5 years agoMLK-15324-1 video: cfb_console: Fix 64 bits support problem
Ye Li [Mon, 29 Aug 2016 05:51:01 +0000 (13:51 +0800)]
MLK-15324-1 video: cfb_console: Fix 64 bits support problem

There are some integer to pointer convert. To support 64 bits system,
change the unsigned int to unsigned long.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit c3b5c2df452eac82a970ba304e94550be8e27335)
(cherry picked from commit 8a2330424ce8dff9ba9e51ccf74fa600ea93aeb1)

5 years agoMLK-15026 usb: host: xhci-imx8: add imx8 USB3 driver
Peter Chen [Wed, 7 Jun 2017 09:20:06 +0000 (17:20 +0800)]
MLK-15026 usb: host: xhci-imx8: add imx8 USB3 driver

It is for imx8qm and imx8qxp, and the cadence IP is in it.

Both DM and Non-DM are supported in this driver. The DM support
only probes the USB3 node, but won't parse any properties from node in DTS.
The registers address are still hard coded, that share with non-DM codes.

The DM driver will enable the power of USB3 controller and USB3 PHY. But
for Non-DM driver, users need to power up them in board level codes.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 952d331f7b12ba278d4f6a68b0be2b1e6d1b31b8)

5 years agoMLK-16175-1 usb: ehci-mx6: Turn on the power domain of USB PHY
Ye Li [Wed, 9 Aug 2017 09:54:53 +0000 (04:54 -0500)]
MLK-16175-1 usb: ehci-mx6: Turn on the power domain of USB PHY

Since there is no uclass for USB PHY. The device won't be setup for the USB PHY
node in DTB. And its associated power domain device won't be turned on neither
by DM framework.

This patch modifies the ehci-mx6 driver to enable the power domain device before
access the USB PHY. This is only for DM driver. For non-DM part, users still
need to power on the USB PHY in boards/SoC codes.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 3c59c8ea95d401d06736c68c186aec80e214bee8)
(cherry picked from commit 79122202a4f748b5da654ed6e7ce6a4597eac747)

5 years agoMLK-16118-7 spi: flexspi: Add init_clk_fspi function to setup clock
Ye Li [Tue, 1 Aug 2017 10:08:18 +0000 (05:08 -0500)]
MLK-16118-7 spi: flexspi: Add init_clk_fspi function to setup clock

When the power domain driver is enabled, we need to enable clocks after power
domain on. The clock settings in board level codes must be removed, needs to
set them when the device is probed. Add this weak function in flexspi driver,
that SoC codes can implement the clock settings.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit a4d334e70839021a50dca2ad4ad98ecee16081f9)
(cherry picked from commit 821d6b7b06cba244ac872a7b3af9ee269f464008)

5 years agoMLK-16118-6 net: fec_mxc: Add the init_clk_fec function for non-DM driver
Ye Li [Tue, 1 Aug 2017 10:06:25 +0000 (05:06 -0500)]
MLK-16118-6 net: fec_mxc: Add the init_clk_fec function for non-DM driver

When the power domain driver is enabled, we need to enable clocks after power
domain on. So the clock settings can't set in board_init, needs to set them
when the device is probed. Add this weak function in driver, that SoC codes
can implement the clock settings.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit c0e4ac66196b20f363f711fb18e40b70e3be9240)
(cherry picked from commit 187ea376980be12e69c45bd6e62c7ca1559046f6)

5 years agoMLK-16094-1 pinctrl-imx8: Add compatible string for i.MX8QM
Ye Li [Wed, 20 Mar 2019 03:09:54 +0000 (20:09 -0700)]
MLK-16094-1 pinctrl-imx8: Add compatible string for i.MX8QM

Update pinctrl driver for i.MX8 platform (QM/QXP) to add compatible string
for iMX8QM. So the driver can parse the iomuxc settings from iMX8QM DTB
and set them through IPC to SCU.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-15013-1 ehci-mx6: Add i.MX8 OTG controller support
Ye Li [Tue, 6 Jun 2017 04:03:24 +0000 (23:03 -0500)]
MLK-15013-1 ehci-mx6: Add i.MX8 OTG controller support

The i.MX8 has two USB controllers: USBOH and USB3. The USBOH reuses
previous i.MX6/7. It has same PHY IP as i.MX7ULP but NC registers
are same as i.MX7D. So add its support in ehci-mx6 driver.

Also the driver is updated to remove build warning for 64 bits CPU.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit cf0dd3af4c1d6d96e7394da46258e19cf281c6f0)
(cherry picked from commit f4ebe53335c1df97ae3f00dbc517db4004e5aba0)

5 years agoMLK-14445-5 ehci-mx6: Add OTG ID detecting by GPIO
Ye Li [Thu, 16 Mar 2017 09:00:59 +0000 (17:00 +0800)]
MLK-14445-5 ehci-mx6: Add OTG ID detecting by GPIO

The i.MX7ulp EVK board uses GPIO to detect ID for USB OTG0,
but when using DM USB driver, it is hard coded to use OTG ID pin.
Add a board override function that when extcon property is provided,
the function can check the GPIO to get ID.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 8382781a59fbae1d8ab797d64761136277e291d1)
(cherry picked from commit 2afd266e19b78952d5ea402b7457a47210b7670d)

5 years agoMLK-13450-15 ehci-mx6: Add powerup_fixup implementation
Ye Li [Thu, 17 Nov 2016 08:54:56 +0000 (16:54 +0800)]
MLK-13450-15 ehci-mx6: Add powerup_fixup implementation

When doing port reset, the PR bit of PORTSC1 will be automatically
cleared by our IP, but standard EHCI needs explicit clear by software. The
EHCI-HCD driver follow the EHCI specification, so after 50ms wait, it
clear the PR bit by writting to the PORTSC1 register with value loaded before
setting PR.

This sequence is ok for our IP when the delay time is exact. But when the timer
is slower, some bits like PE, PSPD have been set by controller automatically
after the PR is automatically cleared. So the writing to the PORTSC1 will overwrite
these bits set by controller. And eventually the driver gets wrong status.

We implement the powerup_fixup operation which delays 50ms and will check
the PR until it is cleared by controller. And will update the reg value which is written
to PORTSC register by EHCI-HCD driver. This is much safer than depending on the delay
time to be accurate and aligining with controller's behaiver.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 8dfdf83abaff44efb487f801cd1757a729d427c5)
(cherry picked from commit cafc860907a408156a43fa20169dfc187648618e)
(cherry picked from commit b3ec67eece968431ba7f8307156ae2659907a03b)

5 years agoMLK-13450-14 ehci-mx6: Update EHCI driver to support OTG0 on i.MX7ULP
Ye Li [Thu, 17 Nov 2016 08:39:03 +0000 (16:39 +0800)]
MLK-13450-14 ehci-mx6: Update EHCI driver to support OTG0 on i.MX7ULP

The ULP has two USB controllers. These two controllers have similar NC
registers layout as i.MX7D. But OTG0 uses UTMI PHY simliar as i.MX6, not
the integrated PHY on i.MX7D. The OTG1 needs off-chip HSIC PHY or ULPI PHY
to work.

This patch only supports OTG0 with UTMI PHY.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 1ac22cabb96a14ac4ca58df60ae2025fb5e94db6)
(cherry picked from commit 53cfed1f967e44507a80a0b8c8113ae67188304b)
(cherry picked from commit 6ae64ed7f3fb5dcc204e87c8512ee3796d655189)