u-boot.git
4 years agoMLK-19131 configs: imx8mm_evk: add jailhouse boot command
Peng Fan [Mon, 6 Aug 2018 09:47:22 +0000 (17:47 +0800)]
MLK-19131 configs: imx8mm_evk: add jailhouse boot command

Add jailhouse env. Currently need to pass clk_ignore_unused to bootargs
to avoid linux root cell shutdown clocks used by inmates.

If only want a minimal clk being on in inmates, the clks could
be added in clk_inits_on in linux kernel drivers/clk/imx/clk-imx8mm.c
or use init-on-array under clk node.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 7732b3b87423069c1c31d25ec07201098062b717)
(cherry picked from commit 718b0792dfedcf68b6c2e93d3eefe499ec463433)
(cherry picked from commit d18597669c701aebbf0a29c22f68a2347ea4eaf2)
(cherry picked from commit db588bf76ba47ebf872c36efa46dc64443eb657a)

4 years agoMLK-18793 imx8mq: config: add jailhouse env
Peng Fan [Fri, 6 Jul 2018 06:07:02 +0000 (14:07 +0800)]
MLK-18793 imx8mq: config: add jailhouse env

Add jailhouse env. Currently need to pass clk_ignore_unused to bootargs
to avoid linux root cell shutdown clocks used by inmates.

If only want a minimal clk being on in inmates, the clks could
be added in clk_inits_on in linux kernel drivers/clk/imx/clk-imx8mq.c

Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 0d33db00e96e7addb6910a7097a62222ff75480f)
(cherry picked from commit 56ea0d9280b22ce3e260851e88782cb877fad6ec)
(cherry picked from commit a0371a771d102b3f90e043056ecdf477cd31ec20)
(cherry picked from commit b0790eaf28814d484c12c1b971a1518179fbb83a)

4 years agoMLK-18703: crypto: caam: Fix typo for caam blob commands
Aymen Sghaier [Wed, 11 Jul 2018 16:23:18 +0000 (18:23 +0200)]
MLK-18703: crypto: caam: Fix typo for caam blob commands

 This fix a wrong trace error while executing caam genlob command.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
(cherry picked from commit 7b80598100baf38562bee10bb4a19c3c834b945b)
(cherry picked from commit 878d0d145482683bd7d3b89f3cbd74878b5d1064)
(cherry picked from commit 8877fda60d47cd1444f480a3486234ad76a547bb)

4 years agoMLK-18703: crypto: caam: Add TRNG init function call
Aymen Sghaier [Tue, 3 Jul 2018 08:14:37 +0000 (10:14 +0200)]
MLK-18703: crypto: caam: Add TRNG init function call

 Call the TRNG init function at the end of arch_cpu_init()
 Concerned SoCs are: i.MX6, i.MX7 and i.MX8M

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
(cherry picked from commit 996329904c0304a7bfbc6cda8287ab93de77870d)
(cherry picked from commit 5dd4441081f2af6f198a4d43eb1a3e543d986306)
(cherry picked from commit 6427f23dce038ddd995b41ef2300c6d6131ea9a2)

4 years agoMLK-18703: crypto: caam: Add init TRNG into SPL or U-Boot
Aymen Sghaier [Tue, 24 Apr 2018 16:36:02 +0000 (18:36 +0200)]
MLK-18703: crypto: caam: Add init TRNG into SPL or U-Boot

 The following reasons lead to instantiate the TRNG into U-Boot/SPL:

 - On some i.MX platforms Linux Kernel could not instantiate RNG
 - RNG could be used/needed by M4/M0 cores before Kernel stage
 - Having the RNG instantiation implemented only once for
   almost i.MX platforms

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
(cherry picked from commit 1f4134c85f6416cbdadaf5f4ff6321f6c685c74c)
(cherry picked from commit 20bd91de9f4b305adb15dda3a09fd9958557a82b)
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 1d7bbf924f59bb6e7401890b936c501b13222fdc)

4 years agoMLK-18591-2 crypto: caam: Add fsl caam driver
Ye Li [Wed, 6 Jun 2018 10:29:16 +0000 (03:29 -0700)]
MLK-18591-2 crypto: caam: Add fsl caam driver

Add the fsl CAAM driver and new commands to implement DEK blob operations,
like "caam genblob" to generate encrypted blob and "caam decap" to output
orignal plain data.

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

4 years agoMLK-21846-2 imx8mq_evk: Enable USB SDP in SPL
Ye Li [Mon, 22 Apr 2019 04:06:13 +0000 (21:06 -0700)]
MLK-21846-2 imx8mq_evk: Enable USB SDP in SPL

Enable the SPL SDP driver and SPL gadget drivers on iMX8MQ EVK board.

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

4 years agoMLK-18822 imx: Fix bootaux issue when running on ARM64
Ye Li [Wed, 11 Jul 2018 08:41:24 +0000 (01:41 -0700)]
MLK-18822 imx: Fix bootaux issue when running on ARM64

The bootaux from community uses ulong to read private data and write to M4 TCM,
this cause problem on ARM64 platform where the ulong is 8bytes.
Fix it by using u32 to replace ulong.

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

4 years agoMLK-13486: imx: logos: use NXP logo
Peng Fan [Tue, 22 Nov 2016 02:57:13 +0000 (10:57 +0800)]
MLK-13486: imx: logos: use NXP logo

Use NXP logo.
The vendor and board dir not changed, only replace the contents
of freescale.bmp.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 0b381fdf1a45cb06a057724e708ce0bbeee67f4d)
(cherry picked from commit 836461a95ca8df0f41dacf1d390a966624190524)
(cherry picked from commit ffbeb365642907957a385fe970fc69adcf87d600)
(cherry picked from commit 18ec1e8b2be5c0952636960b39edd40f38ffcbc3)
(cherry picked from commit 03d27b84c6a44a1dafca775dfb748f75a5c1d834)

4 years agoMLK-18654-4 imx8mm_evk: Enable SPL SDP for iMX8MM EVK board
Ye Li [Fri, 19 Apr 2019 06:34:13 +0000 (23:34 -0700)]
MLK-18654-4 imx8mm_evk: Enable SPL SDP for iMX8MM EVK board

Enable the SPL SDP for iMX8MM EVK. So that when booting from USB serial
download mode, the SPL will enter SDP to download FIT image from USB host
(uuu tool) and boot into FIT image.

The SDP driver needs larger malloc pool size, so extend the SPL malloc pool
to 12KB and reduce the SPL BSS MAX to 4KB because BSS actual size is about 1KB.

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

4 years agoMLK-23574-27 imx8mm_evk: Update board codes and add DDR4 support
Ye Li [Thu, 2 Apr 2020 06:58:29 +0000 (23:58 -0700)]
MLK-23574-27 imx8mm_evk: Update board codes and add DDR4 support

Update the board codes to use latest DDR script and support flexspi boot,
USB host/gadget, etc.
Also add DDR4 EVK board support for RAW NAND boot.

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

4 years agoMA-15062 change MACRO name of mcu TCM base address
faqiang.zhu [Tue, 2 Jul 2019 04:36:34 +0000 (12:36 +0800)]
MA-15062 change MACRO name of mcu TCM base address

Change the MACRO name of mcu TCM base address from M4_BOOTROM_BASE_ADDR
to MCU_BOOTROM_BASE_ADDR.
since this MACRO will be used in common code for i.MX chips, the same
MACRO name in other files are also modified.

Change-Id: I433dd78d11c485d0f4cb82bab299f61cb29dce45
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
(cherry picked from commit e2eb616fdbc4ce6475b084ab11b77cd5dcaa6fd2)
(cherry picked from commit 809d03482c951989769a82e317abbeab9b8e4d8b)

4 years agoMA-15062-1 change names of MACROs used to boot MCU on imx8m devices
faqiang.zhu [Tue, 2 Jul 2019 05:32:00 +0000 (13:32 +0800)]
MA-15062-1 change names of MACROs used to boot MCU on imx8m devices

new imx8mn chips have Cortex-M7 inside, not like other imx8m devices
of imx8mm and imx8mq which have Cortex-M4 inside. the names of MACROs
used to boot MCU on imx8m devices is modified to make them more common
to cover M4 and M7.
annotations are also modified based on the differences between M4 and
M7.

Change-Id: Ida272e6ecdf577eeaadb9f1242f4524bd1014cac
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
(cherry picked from commit eb825f8d4fbc2289b9ccf8f457fcba04922c8259)
(cherry picked from commit bd7599d2d34e55395423b4627bfc97eeb3ad742e)

4 years agoLF-3483-2 nand: mxs_nand_spl: Implement the nand_spl_adjust_offset
Ye Li [Wed, 10 Mar 2021 09:15:15 +0000 (01:15 -0800)]
LF-3483-2 nand: mxs_nand_spl: Implement the nand_spl_adjust_offset

Since the mxs_nand_spl has implemented adjust read offset in
nand_spl_load_image, so we don't need to check the bad block in
nand_spl_adjust_offset. Directly return the offset to continue
read by nand_spl_load_image.

Signed-off-by: Ye Li <ye.li@nxp.com>
4 years agoMLK-20664-2 imx8/imx8m: Disable the SPL RAW image support
Ye Li [Thu, 27 Dec 2018 05:51:51 +0000 (21:51 -0800)]
MLK-20664-2 imx8/imx8m: Disable the SPL RAW image support

The RAW image support must be disabled, otherwise a RAW image can be used
to bypass FIT image.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit ca7ebfcf0737699d5f62f97be4b0015c88108ae7)
(cherry picked from commit 9e9524c86a08d5b16bb94c1a30eda378536c4860)
(cherry picked from commit 1759ef0b52f972cff6c2c23014c534c9c8d0d55f)

4 years agoMLK-23574-25 arm: dts: imx8mm: Update iMX8MM DTSi and DDR4/LPDDR4 EVK DTS
Ye Li [Thu, 2 Apr 2020 03:30:07 +0000 (20:30 -0700)]
MLK-23574-25 arm: dts: imx8mm: Update iMX8MM DTSi and DDR4/LPDDR4 EVK DTS

Sync the DTSi file and DDR4/LPDDR4 EVK DTS with latest v5.10.y kernel.
Add nodes in display, flexspi, TMU, etc.

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

4 years agoMLK-18654-3 spl: Un-define the DM USB for SPL
Ye Li [Fri, 22 Jun 2018 02:32:33 +0000 (19:32 -0700)]
MLK-18654-3 spl: Un-define the DM USB for SPL

Since we don't support DM in SPL, undefine the DM USB in SPL build,
so it can use non-DM USB driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 1e02825ab852f31111b875af9b84f82a974df64c)
(cherry picked from commit 62efea1e99a02fc282d0a22c36fddb1b14a09612)
(cherry picked from commit 8a44b2ce1cc80e9c28625b84a7db00c75880b70f)

4 years agoMLK-18654-2 imx: Change USB boot device type
Ye Li [Fri, 22 Jun 2018 02:26:47 +0000 (19:26 -0700)]
MLK-18654-2 imx: Change USB boot device type

The SPL SDP is configured as BOOT_DEVICE_BOARD, so when booting from
USB, change its type to BOOT_DEVICE_BOARD, so we can use SDP.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 433032d7d672d4aa18d1399ffaa9449f00bc7d09)
(cherry picked from commit 4bb666f00b04ab416833ae5c5f17b27a646a07a5)
(cherry picked from commit 06e39d89e45e74c99c68854b1f690a84688b05a1)

4 years agoMLK-23574-23 imx8mm_evk: Change to use non-DM for SPL
Ye Li [Mon, 30 Mar 2020 08:57:59 +0000 (01:57 -0700)]
MLK-23574-23 imx8mm_evk: Change to use non-DM for SPL

The SPL size is huge when enabling DM:
108KB (DM) vs 63KB (Non-DM)

Since we have limited size of OCRAM and TCM, to support full features
we have to disable the DM in SPL and use legacy way as imx_v2019.04
u-boot

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

4 years agoMLK-23574-22 imx8m: clock: Sync clock settings with imx_v2020.04
Ye Li [Mon, 30 Mar 2020 08:56:03 +0000 (01:56 -0700)]
MLK-23574-22 imx8m: clock: Sync clock settings with imx_v2020.04

Sync the clock settings with imx_v2020.04 u-boot:
1. Set ARM clock directly from PLL, bypass CCM.
2. Add mapping between ROOT clock and MXC clock
3. Fix frac pll parameters issue in imx8mm, which violates spec.
4. Add all root clocks
5. Add clock settings for some peripherals:
   like enet/uart/i2c/display/nand/usb to allow not use CCF.

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

4 years agoMLK-18387 pmic: Add Non-DM pmic driver for BD71837
Ye Li [Mon, 30 Mar 2020 08:56:32 +0000 (01:56 -0700)]
MLK-18387 pmic: Add Non-DM pmic driver for BD71837

The iMX8MM EVK board uses BD71837MWV pmic. Add its Non-DM driver to u-boot.

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

4 years agoMLK-21845-4 imx8m: Add imximage for flexspi boot image
Ye Li [Fri, 19 Apr 2019 03:24:42 +0000 (20:24 -0700)]
MLK-21845-4 imx8m: Add imximage for flexspi boot image

Since flexspi has different IVT offset with SD/MMC, add a new imximage
for it.

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

4 years agoMLK-14422 imx7d: wdog: Overwrite the reset_cpu to turn off internal reset signal
Ye Li [Tue, 7 Feb 2017 14:48:01 +0000 (22:48 +0800)]
MLK-14422 imx7d: wdog: Overwrite the reset_cpu to turn off internal reset signal

Set wdog WCR register SRS bit to turn off internal reset signal WDOG_RESET_B_DEB
for mx7d. So that the warm reset is disabled.
The WDA is cleared to output WDOG_B immediately to reset the board.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 6d09863801695d975060fbc240147a9067dbafbf)
(cherry picked from commit cde504077e1ce94d9ad34ece0f3e882972404297)
(cherry picked from commit b0d49a10b23f0b9a7d8cc9299e6eac6b39ce1434)
(cherry picked from commit 2d7a9cf5873ba2e4523deb80ed62dd184e1fe3bc)

4 years agoMLK-19726-2 arm: Don't remove all devices when power domain driver is enabled
Ye Li [Wed, 26 Sep 2018 09:15:00 +0000 (02:15 -0700)]
MLK-19726-2 arm: Don't remove all devices when power domain driver is enabled

Because we power off all devices in board_quiesce_devices which is prior then
executing dm_remove_devices_flags. So any access to HW in dm_remove_devices_flags
will cause problem.
However, some drivers like ethernet which implements the pre_remove callback is always
called without any flags check, and this finally accesses FEC controller.

Since we don't need to remove all devices in u-boot before starting kernel, disable
this feature when power domain is enabled.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 741f2ea182bf293d8270bdc4a217a96db22c414c)
(cherry picked from commit b0eae27fce90f00f407961c5907e0e21cf47ef18)
(cherry picked from commit 30ba253de48f5c3c997d0a661910934f93fe44ad)

4 years agoMLK-21845-3 imx8m: Append HDMI Firmware only for imx8mq
Ye Li [Mon, 22 Apr 2019 08:32:21 +0000 (01:32 -0700)]
MLK-21845-3 imx8m: Append HDMI Firmware only for imx8mq

Since only i.MX8MQ needs HDMI firmware packing into boot image. Change
the imximage.cfg with CONFIG_IMX8MQ used.

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

4 years agoMLK-18044-4: crypto: fsl: refactor for 32 bit version CAAM support on ARM64
Aymen Sghaier [Thu, 3 May 2018 10:17:53 +0000 (12:17 +0200)]
MLK-18044-4: crypto: fsl: refactor for 32 bit version CAAM support on ARM64

Since i.MX CAAM are all 32 bits no matter the ARM arch (32 or 64),
to adapt and not break 64 bits CAAM support,  add a new config
CONFIG_CAAM_64BIT and new relevant type "caam_dma_addr_t".

This config is default enabled when CONFIG_PHYS_64BIT is set except
for iMX8M.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
(cherry picked from commit 043c4ff7524dcf9f8fea1b56eddb8d1a40505d6c)

4 years agoMLK-18044-5: crypto: caam: Add secure memory vid 3 support
Aymen Sghaier [Thu, 3 May 2018 12:19:57 +0000 (14:19 +0200)]
MLK-18044-5: crypto: caam: Add secure memory vid 3 support

  In i.MX8M platforms the secure memory block has a newer version
 than those used in i.MX6/7 platforms, this patch update the driver
 to use the correct registers offsets.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
(cherry picked from commit 0daa9c142a1809b473d101f6db9700574ce3d522)
(cherry picked from commit 7184ec3307c4347a7a7765ba72415580cd65c341)
(cherry picked from commit 020649dd642899665dce8655c395f785f5d243e0)
(cherry picked from commit 9a0187946b470af23b2794eb476c860f3742969c)

4 years agoMLK-18044-3: crypto: Add blob command support for i.MX8M platforms
Aymen Sghaier [Wed, 2 May 2018 08:34:27 +0000 (10:34 +0200)]
MLK-18044-3: crypto: Add blob command support for i.MX8M platforms

 This patch enable blob command for mScale platforms.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
(cherry picked from commit 895669394f6aae633abf6ea3f327d6093562edde)
(cherry picked from commit bac8ed98778c93ef43ce9093efa3b9999d650576)
(cherry picked from commit 2542f195b484dcd09bbf72406c7951bee06b52a5)
(cherry picked from commit 2f4da7efe84fbf60cc8e372077d9509cba341553)

4 years agoMLK-18044-2: crypto: caam: Fix build warnings pointer casting
Aymen Sghaier [Tue, 1 May 2018 16:42:21 +0000 (18:42 +0200)]
MLK-18044-2: crypto: caam: Fix build warnings pointer casting

  Enabling CAAM driver for i.MX8M platforms, a 64 bits architecture,
 lead to casting warnings: from/to pointer to/from integer with
 different size. This patch fix these warnings

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
(cherry picked from commit d02fbc7d2957f4788ced017ccf17fd35ab968121)
(cherry picked from commit 79e90af14af32e86fd7efd3c84e09a0bd572ab5b)
(cherry picked from commit 338786e6c79c2392dfe44c44e94c59fb18d684fd)
(cherry picked from commit e32039db956676619b143cb13aded37fbc0d36d5)

4 years agoMLK-18044-1: crypto: caam: Add CAAM support to i.MX8M platforms
Aymen Sghaier [Tue, 1 May 2018 09:37:22 +0000 (11:37 +0200)]
MLK-18044-1: crypto: caam: Add CAAM support to i.MX8M platforms

This patch enable CAAM support for i.MX8M platforms.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
(cherry picked from commit 1fc92e6e34b06bdee81240ce06326aca1d9c02d8)
(cherry picked from commit b0f889b77b367b69aa0778b1d03a2ec30fdee243)
(cherry picked from commit f5c28e63f19ef99e0fe4d01b176789aacc507d79)
(cherry picked from commit cb43a643894445da481b265fdf63ac32749cfde1)

4 years agoMLK-18043 4/4: imx7ulp: Enable support for cmd blob
Franck LENORMAND [Wed, 2 May 2018 10:01:56 +0000 (12:01 +0200)]
MLK-18043 4/4: imx7ulp: Enable support for cmd blob

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
(cherry picked from commit 03cb71cd22ff6ab1e2005a4bcb183c65f49b6e4e)
(cherry picked from commit 5d797db35da7fa3f7971df8811b6a1e800786ced)
(cherry picked from commit dd2e4b027122aa6724985f23319bebd89dfc1f39)
(cherry picked from commit f46d991731bcfbc6db95a4d0c87bf9188c2a636f)

4 years agoMLK-18043 2/4: caam: enable support for iMX7ULP
Franck LENORMAND [Wed, 2 May 2018 10:16:36 +0000 (12:16 +0200)]
MLK-18043 2/4: caam: enable support for iMX7ULP

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
(cherry picked from commit 5f429339ab5a5f0d1f00a2880ce05cf479f11ba5)
(cherry picked from commit c26db25a130ef1f0abd43a3133877f74431eb217)
(cherry picked from commit 62ca8b07d4906ea11380f2638cc4b9d55beae9f6)
(cherry picked from commit 5f253097e98e1770a738027b72296907cdf3c825)

4 years agoMLK-18043 1/4: caam: change JR running loop
Franck LENORMAND [Wed, 2 May 2018 10:16:25 +0000 (12:16 +0200)]
MLK-18043 1/4: caam: change JR running loop

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
(cherry picked from commit 6503c1ed0264fc61945c2b3b5948b793f104fc32)
(cherry picked from commit d1d10af5a15473377fefbca56c1dac293fb06f3b)
(cherry picked from commit 7f2af44c22d2b84913f0f299497a607484b81785)
(cherry picked from commit 893c0652aa368de8660ce864a5ad6acb13254208)

4 years agoMLK-17919: imx: Avoid hardcoded Job Ring Max size
Breno Lima [Fri, 23 Mar 2018 20:25:15 +0000 (17:25 -0300)]
MLK-17919: imx: Avoid hardcoded Job Ring Max size

Prior instantiating RNG we have to ensure if the CAAM job rings are
available. Avoid hardcoded job ring max size and use the definition at
fsl_sec.h

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

4 years agoMLK-17918: imx: Ensure CAAM clock is enabled prior getting out_jr_size
Breno Lima [Fri, 23 Mar 2018 20:21:38 +0000 (17:21 -0300)]
MLK-17918: imx: Ensure CAAM clock is enabled prior getting out_jr_size

Prior calling sec_in32() we have to ensure CAAM clock is enabled, the
function sec_in32() is reading CAAM registers and if CAAM clock is disabled
the system will hang.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit c4da7540e7548f36c6ad90292db7057b828a7956)
(cherry picked from commit e7832c25579cedafe53b1973550664f654d38894)
(cherry picked from commit 037e0f80271fe7b39967a6972e9baf8dd6d2b8bc)
(cherry picked from commit 0ae5c37babdf5f137399039f38d11bba539c0182)

4 years agoMLK-17917: imx: Avoid hardcoded output ring size register offset (ORSR)
Breno Lima [Fri, 23 Mar 2018 20:17:04 +0000 (17:17 -0300)]
MLK-17917: imx: Avoid hardcoded output ring size register offset (ORSR)

The CAAM output ring size register offset is currently defined in fsl_sec.h
as FSL_CAAM_ORSR_JRa_OFFSET, use this definition to avoid hardcoded value in
i.MX common code.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 9d381708210270a1cf9bf25924c8932c436967e8)
(cherry picked from commit 42db685ace092bedc569cd2c846b51b393630759)
(cherry picked from commit 1e51cd2a8e079c9cf06889ec55ab28c5d63bdba5)
(cherry picked from commit f7e7d08fb5144e3ce5f02df5d6f6262be883a683)

4 years agoMLK-17915: cmd: blob: Instantiate RNG before running CMD_BLOB
Breno Lima [Fri, 23 Mar 2018 20:05:47 +0000 (17:05 -0300)]
MLK-17915: cmd: blob: Instantiate RNG before running CMD_BLOB

U-Boot can instantiate CAAM RNG if needed by crypto operations.
Call sec_init() prior running a blob operation to ensure
RNG is correctly instantiated.

Make sure CAAM clock is enabled and check if a job ring is
available for that operation.

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

4 years agoMLK-17914: cmd: blob: Add IMX_HAB and CAAM supported SoCs as dependency
Breno Lima [Fri, 23 Mar 2018 19:25:33 +0000 (16:25 -0300)]
MLK-17914: cmd: blob: Add IMX_HAB and CAAM supported SoCs as dependency

In order to build CMD_BLOB on i.MX CAAM supported devices it's
necessary to select IMX_HAB. Add IMX_HAB and CAAM supported
SoCs as dependency.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 4afb519038d190687cac6d410e9ad65d0655f1c0)
(cherry picked from commit acda6159eefbefaee15b19568fd1c4665c047432)
(cherry picked from commit c9de383878c5e248ae549182a9f2477f5bb2a5f5)
(cherry picked from commit 1ab55bfae6d40503420ddb8ffa435d7ba9bba968)

4 years agoMLK-18169 imx: imx7 Support for Manufacturing Protection
Breno Lima [Tue, 14 Nov 2017 22:10:45 +0000 (20:10 -0200)]
MLK-18169 imx: imx7 Support for Manufacturing Protection

This code was originally developed by Raul Cardenas <raul.casas@nxp.com>
and modified to be applied in U-Boot imx_v2017.03.

More information about the initial submission can be seen
in the link below:
https://lists.denx.de/pipermail/u-boot/2016-February/245273.html

i.MX7D has an a protection feature for Manufacturing process.
This feature uses asymmetric encryption to sign and verify
authenticated software handled between parties. This command
enables the use of such feature.

The private key is unique and generated once per device.
And it is stored in secure memory and only accessible by CAAM.
Therefore, the public key generation and signature functions
are the only functions available for the user.

The manufacturing-protection authentication process can be used to
authenticate the chip to the OEM's server.

Command usage:

Print the public key for the device.
- mfgprot pubk

Generates Signature over given data.
- mfgprot sign <data_address> <data_size>

Signed-off-by: Raul Ulises Cardenas <raul.casas@nxp.com>
Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit db2dbf622d3c711b2fbd85e6814992e023479dad)
(cherry picked from commit 554b7cdcf47a49097cc5417cc6130e469d7ccc20)
(cherry picked from commit 2c8318fbe7a721faec2b2dd04a465dff00ebdde7)

4 years agoMLK-16753-1 imx8m: add optee node according to runtime status
Peng Fan [Thu, 2 Nov 2017 05:47:24 +0000 (13:47 +0800)]
MLK-16753-1 imx8m: add optee node according to runtime status

If TEE is enabled according to rom_pointer[0,1] passed to BL33
from ATF, uboot need to add the optee node in dts to let
Kernel could probe the TEE driver.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 4341d35cc99a6226f2671e15154d3148ebf49c47)
(cherry picked from commit 609e6607572225bfff9dcd84928fd061c1682669)
(cherry picked from commit dbdf9dd3b8bb6b8e0a87a07227bc22d6333f8081)

4 years agoLF-3483-1 imx8mp_evk: Allow to use BSS section in board_init_f
Ye Li [Tue, 9 Mar 2021 09:30:34 +0000 (01:30 -0800)]
LF-3483-1 imx8mp_evk: Allow to use BSS section in board_init_f

The SPL framework will clean up the BSS section after board_init_f,
since we have explicitily clean BSS in board_init_f, so directly
call to board_init_r to bypass framework

Signed-off-by: Ye Li <ye.li@nxp.com>
4 years agoMLK-22105-3 imx8m: spl: Move bss clean up before arch_cpu_init
Ye Li [Tue, 25 Jun 2019 09:51:42 +0000 (02:51 -0700)]
MLK-22105-3 imx8m: spl: Move bss clean up before arch_cpu_init

Since rng_init is used arch_cpu_init, we have to clean up BSS section
before it.
Also remove the unnecessary memset to global data, because
board_init_f_init_reserve already memset it. If we memset it in board_init_f,
the gd->malloc_base is reset to 0 and will cause early malloc problem
when CONFIG_MALLOC_F_ADDR is not set.

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

4 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)
(cherry picked from commit c0911b66b697505a2d91bf0e468e47bd2b2c21e3)
(cherry picked from commit 52e6e8bae60329d16bf63a2632fd37097a5438ce)

4 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)
(cherry picked from commit d33e6de01f509d586f5b0673154b185601f5d869)
(cherry picked from commit 59b82a4dc20f4d2db1456e3bf2348645cb9e7b41)

4 years agoMLK-18322 HAB: Add suport for iMX8MM
Ye Li [Thu, 18 Apr 2019 07:20:40 +0000 (00:20 -0700)]
MLK-18322 HAB: Add suport for iMX8MM

The imx8mm has changed the address of rvt_hab, use new address for imx8mm.

The authentication procedure is same as imx8mq. In u-boot, the authentication
uses SIP call to trap ATF to run HAB authenticate.
Need to work with ATF commit:
(commit 7a4d6f90e999ed413d520310cc199901b52b7a04)

Users need to add CONFIG_IMX_HAB=y to defconfig to enable the feature.

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

4 years agoMLK-21251-1 imx: hab: Fix build warnings in 32-bit targets
Breno Lima [Thu, 21 Mar 2019 20:33:02 +0000 (17:33 -0300)]
MLK-21251-1 imx: hab: Fix build warnings in 32-bit targets

When building 32-bit targets with CONFIG_SECURE_BOOT and DEBUG enabled
the following warnings are displayed:

arch/arm/mach-imx/hab.c:840:41: warning: format '%lx' expects argument \
of type 'long unsigned int', but argument 3 has type 'uint32_t \
{aka unsigned int}' [-Wformat=]
   printf("HAB check target 0x%08x-0x%08lx fail\n",
                                     ~~~~^
                                     %08x
          ddr_start, ddr_start + bytes);

arch/arm/mach-imx/hab.c:845:45: warning: format '%x' expects argument \
of type 'unsigned int', but argument 3 has type 'ulong \
{aka long unsigned int}' [-Wformat=]
  printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", ivt_offset, ivt_addr);
                                            ~^
                                            %lx

Fix warnings by providing the correct data type.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Breno Lima <breno.lima@nxp.com>
(cherry picked from commit 050beb8ee3fc4c690c9ce7c4f47adfc6f48dccdf)
(cherry picked from commit e66c03a45b563b53485b8d662d29f2e9a143e433)
(cherry picked from commit b7fd85d897a599121b417fb7d5ba15df1735c439)
(cherry picked from commit 5c3fd537a153292e2cf6e76aaf8a6ff1b3a88f47)

4 years agoMLK-21174 mx7ulp: hab: Add hab_status command for HABv4 M4 boot
Breno Lima [Fri, 15 Mar 2019 21:42:47 +0000 (18:42 -0300)]
MLK-21174 mx7ulp: hab: Add hab_status command for HABv4 M4 boot

When booting in low power or dual boot modes the M4 binary is
authenticated by the M4 ROM code.

Add an option in hab_status command so users can retrieve M4 HAB
failure and warning events.

=> hab_status m4

   Secure boot disabled

   HAB Configuration: 0xf0, HAB State: 0x66
   No HAB Events Found!

Add command documentation in mx6_mx7_secure_boot.txt guide.

As HAB M4 API cannot be called from A7 core the code is parsing
the M4 HAB persistent memory region. The HAB persistent memory
stores HAB events, public keys and others HAB related information.

The HAB persistent memory region addresses and sizes can be found
in AN12263 "HABv4 RVT Guidelines and Recommendations".

Reviewed-by: Utkarsh Gupta <utkarsh.gupta@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Breno Lima <breno.lima@nxp.com>
(cherry picked from commit 0efff16579fabcf57acb9c8857afac8fb58de355)
(cherry picked from commit 4815444f293d8021f8bd62079bd576e88cdef639)
(cherry picked from commit 2d95bff6e4c86af4a2cfc66ab40ccd693f746796)
(cherry picked from commit 980f4009c93928587ac4ef59e072581d688427d8)

4 years agoMLK-21389 imx: hab: Check if IVT header is HABv4
Breno Lima [Mon, 8 Apr 2019 02:15:33 +0000 (23:15 -0300)]
MLK-21389 imx: hab: Check if IVT header is HABv4

The HABv4 implementation in ROM checks if HAB major version
in IVT header is 4.x.

The current implementation in hab.c code is only validating
HAB v4.0 and HAB v4.1 and may be incompatible with newer
HABv4 versions.

Modify verify_ivt_header() function to align with HABv4
implementation in ROM code.

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

4 years agoMLK-20787: imx: hab: Display All HAB events via hab_status command
Utkarsh Gupta [Tue, 5 Feb 2019 21:58:16 +0000 (15:58 -0600)]
MLK-20787: imx: hab: Display All HAB events via hab_status command

Add ability for hab_status command to show All HAB events and not just
HAB failure events

Signed-off-by: Utkarsh Gupta <utkarsh.gupta@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit a9fdc0e4efa5c50ae194f7862d87cf53608afd8c)
(cherry picked from commit 1419cf3144dd6d202b6507a10804809e02c61c69)
(cherry picked from commit 5a2e8022961d2a250af58143ba2d2227fcdc03cb)

4 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)
(cherry picked from commit a4300029173afb872b7e7e38d191ca5528da7fed)
(cherry picked from commit e43b10747b84ac31be2ce48d262d9206d9f10628)

4 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)
(cherry picked from commit 557360b5eeeca9c48f020692005e79d84ce89800)
(cherry picked from commit aee57e99a82443fccee9c5c709c449930f8ea2df)

4 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)
(cherry picked from commit 1f020c859a792296e866cf568bbea98b28435437)
(cherry picked from commit e80a5ca688a7c04bebce9a12492100566812688e)

4 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)
(cherry picked from commit 2077719b22232eac459ea78914644dac20fed1c4)
(cherry picked from commit cabd49ddecf900f03c0e10c8b1b9fb9bfc18f195)

4 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)
(cherry picked from commit dd3c14ba3f814610af05b07ec7cd47dcf0925a49)
(cherry picked from commit 168d1e020595500ea1e39c19c939beaa12b9fa93)

4 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)
(cherry picked from commit 677c332120eff7161532288685c58f246d1f00ff)
(cherry picked from commit 2cd26c924355e6bcf88899d559235bab121837ab)

4 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)
(cherry picked from commit 6643eac10e3654c62a4acd9c5a4c8c0ac5ee4d0b)
(cherry picked from commit 5542819dfa3e9f0d5dc65117add6ccdcf3ed35ee)

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

Add some SOC level codes and build configurations to use HAB lib for
CONFIG_IMX_HAB (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_IMX_HAB 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)
(cherry picked from commit bec1d873ca68d7aa3b4355c490ac085b4ef4f7a5)
(cherry picked from commit a894139e29a8c3ea13cf27a96ae1e1718b20035c)

4 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)
(cherry picked from commit 23cb97d2bcbfbbc80561fda069b7ff805ef00c05)
(cherry picked from commit a763c5ae9fb31930b16e33ab8230e9252b2388fc)

4 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)
(cherry picked from commit 3c0f0eed6cb703cd7d67ec97520b1990b5e35fb2)
(cherry picked from commit 6605ea47d7fbbd4687c8eb636335f4c1165be4e4)

4 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)
(cherry picked from commit b73db85448323521be94f748eaa687d4d3557f38)
(cherry picked from commit 4eca15e065637f6dec82d80fc330c7ed50a841e1)

4 years agoMLK-23574-21 imx8mq_evk: Update iMX8MQ EVK board codes
Ye Li [Thu, 26 Mar 2020 07:24:22 +0000 (00:24 -0700)]
MLK-23574-21 imx8mq_evk: Update iMX8MQ EVK board codes

1. Fix wrong USDHC clock
2. Increase malloc f size to 0x2000
3. Enlarge SPL max size to 148KB
4. Default use distro boot first, if it fails, then try bsp bootcmd

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

4 years agoMLK-23574-20 sysreset: Fix Kconfig issue for SPL
Ye Li [Mon, 30 Mar 2020 08:56:50 +0000 (01:56 -0700)]
MLK-23574-20 sysreset: Fix Kconfig issue for SPL

Should check SPL_SYSRESET if need to enable ARM firmware for PSCI
in SPL.

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

4 years agoMLK-23574-18 imx8m: Update registers map file for all iMX8M platforms
Ye Li [Tue, 9 Mar 2021 00:12:20 +0000 (16:12 -0800)]
MLK-23574-18 imx8m: Update registers map file for all iMX8M platforms

Port the files from imx_v2020.04. Merge to two files (one for imx8mq and
the other for imx8mm/8mn/8mp) into imx-regs.h to align with upstream

Signed-off-by: Ye Li <ye.li@nxp.com>
4 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. Update QSPI node in imx8mq-evk DTS file.

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

4 years agoMLK-16238-3 imx8mq_evk: enable TMU
Ye Li [Wed, 11 Apr 2018 03:37:16 +0000 (20:37 -0700)]
MLK-16238-3 imx8mq_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)
(cherry picked from commit e6e05cb1d56e8a5c7ad9d738d121085e7162a5fa)
(cherry picked from commit e27639ca3482edb449808ecdf258b6d0f94b0dc6)

4 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)
(cherry picked from commit a1fca2fec215aca9cac700bbd40eff6f0bed94fc)
(cherry picked from commit 3d08842f233049ab7b1aa13fcdfd3497aa3e579b)

4 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)
(cherry picked from commit eb7927f1ffbe57b86adaf18bc34ac848428427f3)
(cherry picked from commit 672715020ffa1a77da7d9c837655f5de80467bbc)

4 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)
(cherry picked from commit 4d2664a31ef2b45e6cd3ef6fbb83d81ea04b555e)
(cherry picked from commit c7089ef970fec593c7dd914b707305b8202f8f9f)

4 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.

This is only needed when power domain driver is disabled

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

4 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)
(cherry picked from commit 45cf59ff70696a147e39034c6b8418cb687c9f84)
(cherry picked from commit 5a8bc2f76b81281a57f30602abd32e5a3c51d9d6)

4 years agoMLK-21842-3 imx8mq_evk: Fix ENET GPR and PHY problem
Ye Li [Fri, 12 Apr 2019 09:33:41 +0000 (02:33 -0700)]
MLK-21842-3 imx8mq_evk: Fix ENET GPR and PHY problem

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.

Move the PHY setting after driver's config and only for non-DM case,
otherwise new atheros driver will clean the setting. DM ETH should
use dts to pass the setting.

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

4 years agoMLK-21847 pinctrl: imx8/imx8m: Remove DEVRES selecting
Ye Li [Mon, 22 Apr 2019 07:31:38 +0000 (00:31 -0700)]
MLK-21847 pinctrl: imx8/imx8m: Remove DEVRES selecting

The CONFIG_DEVRES is not a necessary config for pinctrl. We decouple the
dependence from the kconfig. So the DEVRES is not default enabled.

When using USB gadget driver like CDNS3 or DWC3, without enabling gadget DM
driver, the calling to devm_kzalloc will cause crash if CONFIG_DEVRES is set.

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

4 years agoMLK-14938-22 mxc_gpio: Change to get value from DR register
Ye Li [Fri, 28 Apr 2017 14:36:57 +0000 (09:36 -0500)]
MLK-14938-22 mxc_gpio: Change to get value from DR register

Currently the driver gets value from PSR register, but this register
is only for input mode. For output mode, it always return 0 not the
value we set for output.

This patch changes to use DR register, which returns the DR value for
output mode, and PSR value for input mode.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 4afc3f90943c6b117f79b66d2cd04e64f437b0c2)
(cherry picked from commit 8cca3efba0d508b2c267f8a32b302970dd05244d)
(cherry picked from commit 7980dc9700bdeb610cfa91b4b53abe450c688b9b)
(cherry picked from commit 954119c429b510e02ed37305c91cb22dadae9524)

4 years agoMLK-23574-16 dt-bindings: add dt-binding doc for CDNS3 controller
Sherry Sun [Wed, 21 Aug 2019 14:35:48 +0000 (14:35 +0000)]
MLK-23574-16 dt-bindings: add dt-binding doc for CDNS3 controller

This patch aim at documenting USB related dt-bindings for the
Cadence USB controller.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
(cherry picked from commit e35bb66d2271ee1be70adb72f15143f60a96ebd8)

4 years agoMLK-23574-15 phy: Add USB PHY driver for the cadence USB3
Ye Li [Thu, 19 Mar 2020 03:51:39 +0000 (20:51 -0700)]
MLK-23574-15 phy: Add USB PHY driver for the cadence USB3

The cdns3-usb-phy driver supports both host and peripheral
mode of usb driver which use cadence usb3 IP.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
(cherry picked from commit e9dd44cfb9da496be2802a069b04b1fe495f1bfb)

4 years agoMLK-23574-14 usb: host: Add the USB3 host driver
Sherry Sun [Wed, 21 Aug 2019 14:36:07 +0000 (14:36 +0000)]
MLK-23574-14 usb: host: Add the USB3 host driver

Add the USB3 host driver for NXP imx8 platform, and the
cadence IP is in it. The USB3 host driver support DM
mode, it will probe USB3 host node in dts.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit d15a8ee6dba1705839cb1e86aa0dc03d25e683cd)

4 years agoMLK-23574-13 usb: gadget: Add the cadence USB3 gadget driver
Sherry Sun [Wed, 21 Aug 2019 14:35:56 +0000 (14:35 +0000)]
MLK-23574-13 usb: gadget: Add the cadence USB3 gadget driver

This driver is ported from NXP i.MX U-Boot version imx_v2019.04
and some changes have also been made to adapt to U-Boot.

Add the Cadence USB3 IP(CDNS3) driver for the gadget (device mode).
The CDNS3 gadget driver support DM mode. CONFIG_DM_USB_GADGET should
be enabled when use this driver.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 09d22730a9b022dd6354740d46c6fa155553bbd0)

4 years agoMLK-23574-11 usb: cdns3: remove upstream cadence USB3 driver
Ye Li [Tue, 17 Mar 2020 08:43:26 +0000 (01:43 -0700)]
MLK-23574-11 usb: cdns3: remove upstream cadence USB3 driver

Upstream version is an initial version, it can't be used directly.
We will use downstream version instead.

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

4 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>
(cherry picked from commit 7d1c910d93cd48b95ba9e999cb02c1ad2fdfe68b)

4 years agoMLK-23574-8 clk: imx8: Update imx8 clock driver
Ye Li [Tue, 2 Jul 2019 10:35:41 +0000 (03:35 -0700)]
MLK-23574-8 clk: imx8: Update imx8 clock driver

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

We classify the clock into serveral types: slice, fixed, lpcg, gpr and 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.

This patch replaces the functions defined in imx8qm and imx8qxp with the clock
tables of different clock types. clk-imx8 use unified functions to process these
clock tables.

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

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

4 years agoMLK-23574-7 misc: scu_api: Update SCFW API
Ye Li [Wed, 20 Mar 2019 06:51:56 +0000 (23:51 -0700)]
MLK-23574-7 misc: scu_api: Update SCFW API

Add new API denitions for clock change.

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

4 years agoMLK-23574-6 imx8: Add lpcg driver for iMX8QM/QXP
Ye Li [Tue, 2 Jul 2019 10:28:45 +0000 (03:28 -0700)]
MLK-23574-6 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 d414a8fac97f8793cd75be5e3178eb3b831018d1)

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

Ported the tcpc driver for USB typec port controller from imx_v2019.04
The functionalities in this driver include:
1. USB power delivery support at dead battery
2. Support configure to UFP or DFP mode
3. Support callback 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.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
4 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)
(cherry picked from commit fe490b320c9808f3c81af061d9af8f8ce73da804)
(cherry picked from commit 6257b4f688644198dce7cc6ae8833d4fa0e0308b)

4 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)
(cherry picked from commit 4966b5b61a4034ed4b9ec0d4de3fe384edddbb3a)
(cherry picked from commit 438216632ec197f82dd3ba98f0879c660b4d83e7)

4 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)
(cherry picked from commit a39800dd920f7196a960cb7fbe51edaf0d753b47)
(cherry picked from commit 2f3d9b03246f95a38ace10cd375239e47671a06e)

4 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)
(cherry picked from commit 9c0be2929558498429b31868d67e1d6695546ac9)
(cherry picked from commit 91b0a78c99f939077e9cf33ac8b3a22cebc311b2)

4 years agoMLK-20569 usb: ehci-mx6: configure usb out of suspend state
Peng Fan [Wed, 12 Dec 2018 02:26:33 +0000 (10:26 +0800)]
MLK-20569 usb: ehci-mx6: configure usb out of suspend state

When moving to support partition reboot or android auto on XEN,
linux kernel will runs into runtime suspend state, and the usb
will be configured to low power suspend state by Linux.

Then we reboot and runs into U-Boot, however the usb already in
suspended state and uboot not able to lock the phy pll,
after clearing PHCD to out of suspended state, the phy pll could be
locked and fastboot works.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Suggested-by: Li Jun <jun.li@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 999ae3e37bc8fea05ac984eb043dd925d80f1208)
(cherry picked from commit 93e07b3135685f2123d19003fa3ab75c00fc6948)

4 years agoMLK-20160-1 usb: ehci-mx6: Fix PHY power up issue on iMX8 platforms
Ye Li [Thu, 1 Nov 2018 07:30:47 +0000 (00:30 -0700)]
MLK-20160-1 usb: ehci-mx6: Fix PHY power up issue on iMX8 platforms

On iMX8 platforms like 8QM/QXP, we must power up the USB PHY resource
before accessing the PHY. However, current init flow access the USB PHY
in ehci_mx6_common_init prior than ehci_usb_phy_mode where the PHY is power
up.

Fix the issue by adding ehci_get_usb_phy function to parse the PHY address
from DTB and power up the PHY before ehci_mx6_common_init.

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

4 years agoMLK-20057 usb: ehci-mx6: Fix usb type issue in DM driver
Ye Li [Wed, 24 Oct 2018 08:08:26 +0000 (01:08 -0700)]
MLK-20057 usb: ehci-mx6: Fix usb type issue in DM driver

Currently the clocks and power of USB controller and USB PHY are both
controlled by ehci-mx6 driver in device probe. However, the function
"ehci_usb_ofdata_to_platdata" calls "ehci_usb_phy_mode"
to access PHY registers when "dr_mode" is set to OTG, both "dr_mode" and
"extcon" properties are not set in DTB. This may cause hang at accessing
USB PHY registers if the power and clocks are not enabled.

Change the usb type logic to more clear way:
1. plat->init_type: The requested USB mode type from uplayers
2. priv->init_type: The USB mode type specified by DTB or by the USB ID pin or
   by external controller like tcpc or GPIO.
3. If two init_type are not same, return failure. Align with non-DM driver.
4. USB PHY access is moved after power and clock enabled.

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

4 years agoMLK-21889-7 EHCI: Enable iMX EHCI driver for iMX8M Nano
Ye Li [Wed, 8 May 2019 07:10:57 +0000 (00:10 -0700)]
MLK-21889-7 EHCI: Enable iMX EHCI driver for iMX8M Nano

Add the IMX8MN to the EHCI-MX7 kconfig dependency.

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

4 years agoMLK-23574-26 ehci-mx6: fix controller index for imx8m and imx8
Ye Li [Thu, 2 Apr 2020 03:37:04 +0000 (20:37 -0700)]
MLK-23574-26 ehci-mx6: fix controller index for imx8m and imx8

The bind codes calculate the address offset for controller index, but
it is wrong for imx8m and imx8. It causes secondary controller fails to
work. So fix this problem, and also change all seq to req_seq.

There is another issue here for imx8, the codes use runtime CPU type check.
One iMX8, this check depends on IPC communication with SCFW, and need
MU driver been probed. But the usbotg is configured with "u-boot,dm_spl"
property for SDP download in SPL, so it will bind in early DM in u-boot
while the MU is not bound at same time, so the CPU type check will hang.
Fix it to use static check.

Signed-off-by: Ye Li <ye.li@nxp.com>
4 years agoMLK-18290-2 ehci-mx6: Update driver to support i.MX8MM
Ye Li [Fri, 11 May 2018 08:26:30 +0000 (01:26 -0700)]
MLK-18290-2 ehci-mx6: Update driver to support i.MX8MM

Since the i.MX8MM reuses the otg controllers on i.MX7D. We can use
CONFIG_USB_EHCI_MX7 for them.

Due the TCPC and load switch are used on Typec circuit. Add the
board_usb_init and board_usb_cleanup to ehci-mx6 DM driver. So
we can implement the TCPC settings in these board functions.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 67699e88aed8bd36e919f54f9555ae15595faaf7)
(cherry picked from commit 13c19c6214ebb69706bb6710ac3ff1db5c2de185)
(cherry picked from commit cacd9a9df22f3c1b985ed6f11a6dea496bfeb636)

4 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)
(cherry picked from commit 395c986a73b1b314313bb726e7f08bab0ffb7916)

4 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)
(cherry picked from commit f20b2f30c855bcb8152d135a4cf259af4e95c79d)

4 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)
(cherry picked from commit 9e49bf5c8cec5cd71e3d256229d638703e1eced9)
(cherry picked from commit 61828bc5e2afe5d4db7dd4c92de2e97aa46e2643)

4 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)
(cherry picked from commit 82d6f24048d789c78834f2233ce008b930336d10)
(cherry picked from commit a53eba21e462e46ae3ab9aa9d2bc6c81cca779fe)

4 years agoMLK-14938-24 mailbox: add imx mu DM mailbox driver
Teo Hall [Mon, 12 Sep 2016 19:15:44 +0000 (14:15 -0500)]
MLK-14938-24 mailbox: add imx mu DM mailbox driver

implement i.MX Messaging Unit driver within the DM Mailbox uclass

Signed-off-by: Teo Hall <teo.hall@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 9caafe21ddf12c9ab994fe9e65dc7afe5e7bab3d)
(cherry picked from commit a360802ec1d1b52ea7d0c91e285ba355d0293140)
(cherry picked from commit 606a91990b69a03a646ec4ba428f5f05e426824c)
(cherry picked from commit 03eea6bd9a40b79aedf6e88695b947d72b418cc5)

4 years agoMLK-14938-23 mailbox: enable mbox_send non-blocking use
Teo Hall [Mon, 12 Sep 2016 19:12:25 +0000 (14:12 -0500)]
MLK-14938-23 mailbox: enable mbox_send non-blocking use

Add a timeout to allow non-blocking use in the
same way as mbox_recv

Signed-off-by: Teo Hall <teo.hall@nxp.com>
(cherry picked from commit c2296701fa91dc8d4144c84c19ffe40dba3df88c)
(cherry picked from commit afcfb7e5105ef01ec46a6c896b20e210a07ee094)
(cherry picked from commit cc86ad157e1c8405a78c392926bf4f96afaae9c1)
(cherry picked from commit 77df5264d279b8390e6ec5765e5080692789c022)

4 years agoMLK-25327-3 spi: nxp_fspi: Support i.MX8DXL flexspi
Ye Li [Tue, 2 Mar 2021 07:45:02 +0000 (23:45 -0800)]
MLK-25327-3 spi: nxp_fspi: Support i.MX8DXL flexspi

Due to a errata on i.MX8DXL flexspi, we can't use AHB read, only can
read data from FIFO.
Add the compatible string for 8DXL and use a flag for the IPS read.

Signed-off-by: Ye Li <ye.li@nxp.com>