u-boot.git
7 years agoMLK-16889 PCI: imx: disable the ltssm when link is down
Richard Zhu [Fri, 3 Nov 2017 05:52:55 +0000 (13:52 +0800)]
MLK-16889 PCI: imx: disable the ltssm when link is down

Disable the LTSSM when link is down.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16899 imx8mq: evk: Add back LPDDR4 performance register settings
Peng Fan [Mon, 20 Nov 2017 01:57:54 +0000 (09:57 +0800)]
MLK-16899 imx8mq: evk: Add back LPDDR4 performance register settings

Add back LPDDR4 performance register settings

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16880 imx8mq: evk: fix init ram space
Peng Fan [Thu, 16 Nov 2017 12:08:58 +0000 (20:08 +0800)]
MLK-16880 imx8mq: evk: fix init ram space

Fix init ram space. Otherwise uboot will override ATF stack space
and cause unexpected issues.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-14945 HAB: Check if IVT valid before authenticating image
Utkarsh Gupta [Sat, 18 Nov 2017 01:23:08 +0000 (19:23 -0600)]
MLK-14945 HAB: Check if IVT valid before authenticating image

For proper authentication users must check the IVT before authenticating the
kernel image. If the IVT DCD pointer is not 0, display an error as shown below
and return a boot failure.

Authenticate image from DDR location 0x12000000...
Error: DCD pointer must be 0

Authenticate zImage Fail, Please check

Signed-off-by: Utkarsh Gupta <utkarsh.gupta@nxp.com>
7 years agoMLK-16703: HAB : Check if CSF is valid before authenticating image
Utkarsh Gupta [Sat, 18 Nov 2017 01:20:33 +0000 (19:20 -0600)]
MLK-16703: HAB : Check if CSF is valid before authenticating image

For proper authentication users must check if the CSF is valid. This patch
calls the csf_is_valid function prior to authenticating the image to parse
the CSF and returns a failure if an invalid command is found as shown below.

Authenticate image from DDR location 0x12000000...
Check CSF for Write Data command before authenticating image

Error - WRITE Data command found

Authenticate zImage Fail, Please check

Signed-off-by: Utkarsh Gupta <utkarsh.gupta@nxp.com>
7 years agoMLK-16882: imx8qxp: config: add NAND boot environment
Han Xu [Thu, 16 Nov 2017 22:57:29 +0000 (16:57 -0600)]
MLK-16882: imx8qxp: config: add NAND boot environment

add the nand boot related environments for i.MX8QXP ARM2 board.

Signed-off-by: Han Xu <han.xu@nxp.com>
7 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>
7 years agoMA-10621 Fix no error returned when lock/unlock fail
ji.luo [Wed, 15 Nov 2017 05:20:44 +0000 (13:20 +0800)]
MA-10621 Fix no error returned when lock/unlock fail

Make do_fastboot_unlock() and fastboot_lock() return FbLockState
type and correct the compare logic in cb_flashing().

Change-Id: I6df6f39a8aa3197299daa0d64408ac72a54fb5e9
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMLK-16831 imx8m: Remove cpu-idle-states property from kernel FDT for rev A0
Ye Li [Thu, 16 Nov 2017 05:29:33 +0000 (23:29 -0600)]
MLK-16831 imx8m: Remove cpu-idle-states property from kernel FDT for rev A0

Since i.MX8M A0 has HW issue in CPU idle, we must disable the function
when running on A0 chip. This patch checks the CPU rev and remove the
"cpu-idle-states" from cpu nodes to disable the CPU idle.

Signed-off-by: Ye Li <ye.li@nxp.com>
Tested-by: Bai Ping <ping.bai@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMA-10622 add android configure to support mx8qm mek board
Richard Liu [Tue, 14 Nov 2017 12:30:38 +0000 (20:30 +0800)]
MA-10622 add android configure to support mx8qm mek board

Add android configure to support mx8qm mek board on android build.

Change-Id: I6dd885258f58c2f81b81bba87ca56184c653b9a1
Signed-off-by: Richard Liu <xuegang.liu@nxp.com>
7 years agoMLK-16758-4 SPL: Add HAB image authentication to FIT
Ye Li [Thu, 9 Nov 2017 05:23:04 +0000 (23:23 -0600)]
MLK-16758-4 SPL: Add HAB image authentication to FIT

Introduce two board level callback functions to FIT image loading process, and
a SPL_FIT_FOUND flag to differentiate FIT image or RAW image.

Implement functions in imx common SPL codes to call HAB funtion
to authenticate the FIT image. Generally, we have to sign multiple regions
in FIT image:
1. Sign FIT FDT data (configuration)
2. Sign FIT external data (Sub-images)

Because the CSF supports to sign multiple memory blocks, so that we can use one
signature to cover all regions in FIT image and only authenticate once.
The authentication should be done after the entire FIT image is loaded into
memory including all sub-images.
We use "-p" option to generate FIT image to reserve a space for FIT IVT
and FIT CSF, also this help to fix the offset of the external data (u-boot-nodtb.bin,
ATF, u-boot DTB).

The signed FIT image layout is as below:
--------------------------------------------------
|     |     |     |   |           |     |        |
| FIT | FIT | FIT |   | U-BOOT    | ATF | U-BOOT |
| FDT | IVT | CSF |   | nodtb.bin |     |   DTB  |
|     |     |     |   |           |     |        |
--------------------------------------------------

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16787-3 SPL: Add FIT data-position property support
Ye Li [Thu, 9 Nov 2017 05:14:48 +0000 (23:14 -0600)]
MLK-16787-3 SPL: Add FIT data-position property support

For external data, FIT has a optional property "data-position" which
can set the external data to a fixed offset to FIT beginning.
Add the support for this property in SPL FIT.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 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>
7 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.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16802 imx8m: correct mmu mapping
Peng Fan [Sun, 12 Nov 2017 11:33:22 +0000 (19:33 +0800)]
MLK-16802 imx8m: correct mmu mapping

ATF has been moved to OCRAM, it is no longer in DRAM, so
let Uboot could use that space.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16794 imx8qxp: support ddr3 arm2 board
Peng Fan [Fri, 10 Nov 2017 08:38:23 +0000 (16:38 +0800)]
MLK-16794 imx8qxp: support ddr3 arm2 board

Support DDR3 ARM2 board.
Most parts are same as LPDDR4 ARM2 board, so share code
with LPDDR4 ARM2.
The DRAM size is 1GB on DDR3 ARM2 board.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16795 imx8mq_evk: Rename SPL DDR files and public functions
Ye Li [Fri, 10 Nov 2017 06:39:23 +0000 (00:39 -0600)]
MLK-16795 imx8mq_evk: Rename SPL DDR files and public functions

Change to use more generic name for DDR files and public functions used in SPL,
not specified to LPDDR4.

Signed-off-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16797 imx8qm/qxp: Fix memory bank size calculation issue
Ye Li [Fri, 10 Nov 2017 07:49:56 +0000 (01:49 -0600)]
MLK-16797 imx8qm/qxp: Fix memory bank size calculation issue

The calculation of memory bank size is wrong when the memory on the board is
less than 2GB. It causes memory bank exceeding the real DDR end, and cause
crash in kernel. Fix the issue in this patch.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16753-9 imx: mx7: add optee support
Peng Fan [Fri, 10 Nov 2017 05:31:43 +0000 (13:31 +0800)]
MLK-16753-9 imx: mx7: add optee support

Add different defconfigs.
Enable Trustzone.
Update env to runtime boot OP-TEE.
mx7d arm2 board not supported now.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16753-8 imx: mx6ul/ull: add optee support
Peng Fan [Fri, 10 Nov 2017 05:29:49 +0000 (13:29 +0800)]
MLK-16753-8 imx: mx6ul/ull: add optee support

Add different defconfigs.
Enable Trustzone.
Update env to runtime boot OP-TEE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16753-7 imx: mx6sx: add optee support
Peng Fan [Thu, 9 Nov 2017 01:14:12 +0000 (09:14 +0800)]
MLK-16753-7 imx: mx6sx: add optee support

Add different defconfigs.
Enable Trustzone.
Update env to runtime boot OP-TEE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16753-6 imx: mx6sabresd: add optee support
Peng Fan [Thu, 9 Nov 2017 01:10:52 +0000 (09:10 +0800)]
MLK-16753-6 imx: mx6sabresd: add optee support

Add different defconfigs
Enable Trustzone.
Update env to runtime boot OP-TEE.
To 6QP SDB, TZASC enabled, need board rework and new ddr script.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16753-5 imx: mx6qsabreauto: add optee support
Peng Fan [Thu, 9 Nov 2017 01:04:01 +0000 (09:04 +0800)]
MLK-16753-5 imx: mx6qsabreauto: add optee support

Add defconfigs.
Enable Trustzone.
Update env to runtime boot OP-TEE.
To 6QP AUTO, TZASC not enabled now.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16753-4 tools: imximage: add SET_BIT command
Peng Fan [Fri, 3 Nov 2017 09:40:24 +0000 (17:40 +0800)]
MLK-16753-4 tools: imximage: add SET_BIT command

Add SET_BIT command

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16753-3 imx: reserve the high 32M
Peng Fan [Fri, 10 Nov 2017 04:52:49 +0000 (12:52 +0800)]
MLK-16753-3 imx: reserve the high 32M

To i.MX6/7, the high 32M is reserved for OP-TEE case.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16753-2 imx-common: add IMX_OPTEE entry
Peng Fan [Thu, 2 Nov 2017 08:01:19 +0000 (16:01 +0800)]
MLK-16753-2 imx-common: add IMX_OPTEE entry

Add IMX_OPTEE Kconfig entry

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 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>
7 years agoMLK-16793: imx8qxp: config: fix the nand partition size and env offset
Han Xu [Thu, 9 Nov 2017 23:02:20 +0000 (17:02 -0600)]
MLK-16793: imx8qxp: config: fix the nand partition size and env offset

considering the boot binary/kernel size becomes larger, increase the
boot and kernel partition size and accordingly change the offset when
reading data.
Also changed the extra Android misc partition size to 8M which is block
size aligned.

Signed-off-by: Han Xu <han.xu@nxp.com>
7 years agoMLK-16773 imx8m: spl: implement wdog reset
Peng Fan [Tue, 7 Nov 2017 08:57:56 +0000 (16:57 +0800)]
MLK-16773 imx8m: spl: implement wdog reset

Implement wdog reset in SPL stage.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMA-10587 [Android]u-boot: Remove build warning in f_fastboot.c
Zhang Bo [Mon, 6 Nov 2017 06:54:34 +0000 (14:54 +0800)]
MA-10587 [Android]u-boot: Remove build warning in f_fastboot.c

The warnings in f_fastboot.c is because the size of a pointer is 64bits,
while the variables in header structure is 32bits. Need to convert manually
at first.
The function partition_table_valid() is useful only when CONFIG_FSL_FASTBOOT and
CONFIG_FASTBOOT_LOCK are defined.

Change-Id: I480f254465096bd61b9075dff0d3fb6ab4bc44af
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
7 years agoMA-10586 [Android]u-boot: Remove build warning in cmd_fsl_caam.c
Zhang Bo [Mon, 6 Nov 2017 06:44:53 +0000 (14:44 +0800)]
MA-10586 [Android]u-boot: Remove build warning in cmd_fsl_caam.c

This build warning is because unnecessary conversion.

Change-Id: Icfad58b95b62c15021ff57370d73b644133f6697
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
7 years agoMA-10585 [Android]u-boot: Fix build error "error: redefinition of 'init_csu'"
Zhang Bo [Mon, 6 Nov 2017 06:42:05 +0000 (14:42 +0800)]
MA-10585 [Android]u-boot: Fix build error "error: redefinition of 'init_csu'"

This build error in arch/arm/cpu/armv7/mx6/soc.c is introduced by mistake.

Change-Id: Ieecdc359bcd5a2eb60db4d96bcf06f19e8b2959f
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
7 years agoMA-10581 Add androidboot.verifiedbootstate kernel comdline for Android
ji.luo [Mon, 6 Nov 2017 11:07:11 +0000 (19:07 +0800)]
MA-10581 Add androidboot.verifiedbootstate kernel comdline for Android

Pass the 'androidboot.verifiedbootstate' kernel cmdline according to
the requirement.

Change-Id: Idc87b769e502d7a5779565ddcb3b14b29d8c5487
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-10580 Open lock/unlock feature for evk_6sl and sabresd_7d
ji.luo [Mon, 6 Nov 2017 07:36:30 +0000 (15:36 +0800)]
MA-10580 Open lock/unlock feature for evk_6sl and sabresd_7d

Add configs to open lock/unlock feature for evk_6sl and sabresd_7d.

Change-Id: I18f8917df06290efb553b10c9bbdaeb145f8a423
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMLK-16758-2 imx8qxp_mek: Enable USBOTG1 support on MEK base board for android
Ye Li [Thu, 2 Nov 2017 10:25:27 +0000 (05:25 -0500)]
MLK-16758-2 imx8qxp_mek: Enable USBOTG1 support on MEK base board for android

Android needs to use USBOTG port on MEK base board for fastboot (USB device mode).
Add relevant node to DTS and update configurations to enable the port in android build.

Signed-off-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16758-1 DTS: imx8qxp: Remove duplicated nodes for USB OTG1 and phy
Ye Li [Tue, 31 Oct 2017 09:14:31 +0000 (04:14 -0500)]
MLK-16758-1 DTS: imx8qxp: Remove duplicated nodes for USB OTG1 and phy

There are duplicated nodes for USBOTG1 and its PHY in imx8qxp DTSi,
remove them.

Signed-off-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16756 imx: imx8m: correct SOC type
Peng Fan [Thu, 2 Nov 2017 07:14:18 +0000 (15:14 +0800)]
MLK-16756 imx: imx8m: correct SOC type

Correct SoC type, otherwise get wrong soc type and access wrong
registers.
If not correct,  met kernel panic:
[    0.000000] Bad mode in Error handler detected on CPU0, code 0xbf000002 -- Sr
[    0.000000] Internal error: Oops - bad mode: 0 [#1] PREEMPT SMP
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.9.51-03585-gc9c62b70db7
[    0.000000] Hardware name: Freescale i.MX8MQ EVK (DT)
[    0.000000] task: ffff000009210700 task.stack: ffff000009200000
[    0.000000] PC is at setup_arch+0xf4/0x550
[    0.000000] LR is at setup_arch+0xf0/0x550
[    0.000000] pc : [<ffff0000090f2714>] lr : [<ffff0000090f2710>] pstate: 00005
[    0.000000] sp : ffff000009203f20
[    0.000000] x29: ffff000009203f20 x28: 00000000410f0018
[    0.000000] x27: 0000000000000400 x26: 00000000fff19b88
[    0.000000] x25: 00000000ff93a0b0 x24: 00000000fff83358
[    0.000000] x23: 0000000000000000 x22: ffff000009207000
[    0.000000] x21: ffff7dfffe800000 x20: ffff000009224000
[    0.000000] x19: ffff000008080000 x18: 0000000000000010
[    0.000000] x17: 0000000000009000 x16: 0000000000001800
[    0.000000] x15: 0000000000000006 x14: ffff00008933cbc7
[    0.000000] x13: ffff00000933cbd5 x12: 0000000000000000
[    0.000000] x11: 0000000000000007 x10: 0101010101010101
[    0.000000] x9 : ffffffffffffffff x8 : 0000000000000008
[    0.000000] x7 : 0000000000000007 x6 : 8000000000000000
[    0.000000] x5 : 0000000000000080 x4 : 000000000000006e
[    0.000000] x3 : 0000000000000000 x2 : 000000000000006e
[    0.000000] x1 : 0000000000000000 x0 : 0000000000000001

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMA-10570[Android] Change bootdelay to 1s for imx8 to avoid stopping at u-boot hardly
Zhang Bo [Thu, 2 Nov 2017 02:04:54 +0000 (10:04 +0800)]
MA-10570[Android] Change bootdelay to 1s for imx8 to avoid stopping at u-boot hardly

The BSP patch "MLK-16467 serial_lpuart: Fix FIFO_RXFE definition in
LPUART driver" disable the FIFO. The UART can only reveive input after some
log output and console is ready. So it is very hard to stop at u-boot if
we set the bootdelay as 0s.

Change the bootdelay time to 1s to avoid stopping at u-boot hardly.

Change-Id: I7134f559b3d43b8f1064171e60fd0098b59358a9
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
7 years agoMLK-16752 imx8mq: Add CPU rev get and use it for ROM_SW_INFO address
Ye Li [Wed, 1 Nov 2017 10:16:31 +0000 (05:16 -0500)]
MLK-16752 imx8mq: Add CPU rev get and use it for ROM_SW_INFO address

Implement the get_cpu_rev function by reading the DIGPROG register
to get the CPU ID. Since this register is not updated for B0,
we need also check ROM version. The ROM version address is different
on B0 (0x83c) and A0 (0x800), so have to check both two.

Additional, the address for ROM_SW_INFO is changed on B0, we have to use
the CPU version to determine the address.

Signed-off-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16749 imx8qm/qxp: Fix mmcpart env variable issue
Ye Li [Wed, 1 Nov 2017 10:41:59 +0000 (05:41 -0500)]
MLK-16749 imx8qm/qxp: Fix mmcpart env variable issue

When booting from flexspi, the mmcpart variable is not defined because
the CONFIG_SYS_MMC_IMG_LOAD_PART binds to SD/eMMC boot image only. This cause we
fails to load kernel image from SD after booting from flexspi.

Signed-off-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16747 imx8m: use SIP to start/check M4
Peng Fan [Wed, 1 Nov 2017 10:09:28 +0000 (18:09 +0800)]
MLK-16747 imx8m: use SIP to start/check M4

Use SIP to start/Check M4.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16739 imx8qm/qxp/mq: Change environment offset to avoid overlay
Ye Li [Tue, 31 Oct 2017 10:58:18 +0000 (05:58 -0500)]
MLK-16739 imx8qm/qxp/mq: Change environment offset to avoid overlay

When M4 images (m4_0 and m4_1) are included into flash.bin, the bin size exceeds
the 1.2MB, which cause overlay with u-boot environment area.
To fix the issue, we change the u-boot environment offset to 4MB for SD and FlexSPI,
and align this for all i.MX8 platforms (i.MX8QM/QXP/MQ).

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16729 tools: fix build break when libpython3-dev is installed
Ye Li [Tue, 31 Oct 2017 02:33:27 +0000 (21:33 -0500)]
MLK-16729 tools: fix build break when libpython3-dev is installed

The u-boot meets break, when host build server has installed swig and libpython3-dev,
but no libpython-dev installed.

tools/libfdt_wrap.c:147:21: fatal error: Python.h: No such file or directory

The root cause is tools/makefile checks the Python.h before building a libfdt Python module.
Since the u-boot is using "python" command not "python3", we should change to check the Python.h
under python2.x directory not every python directory (like python3.x). Otherwise when a python3
develop package is installed, the script will get the file and start to build libfdt if swig
is installed as well.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16732 DTS: imx8qm-arm2: Remove UART0 CTS and RTS pinmux
Ye Li [Mon, 30 Oct 2017 10:08:35 +0000 (05:08 -0500)]
MLK-16732 DTS: imx8qm-arm2: Remove UART0 CTS and RTS pinmux

The lpuart0 is configured as console port on i.MX8QM LPDDR4 ARM2 board,
so its cts/rts pins are not necessary. Since M4_1 core will use lpuart2
as its console. We remove these two pinmux from DTS file.

Signed-off-by: Ye Li <ye.li@nxp.com>
7 years agoMA-10557 [Android] enlarge malloc size
zhang sanshan [Tue, 31 Oct 2017 05:27:54 +0000 (13:27 +0800)]
MA-10557 [Android] enlarge malloc size

uboot will have below error log when verify boot.img
avb_util.c:199: ERROR: Failed to allocate memory.

the default size of malloc is 36M. But we need to load boot.img
with malloc addr. enlarge the size of malloc to 64M.

Change-Id: I64d0403b0cc970128cdfd1eafe7a4680a92f7c25
Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
7 years agoMLK-16728 imx8mq: evk: reserve the tee space when tee enabled
Peng Fan [Mon, 30 Oct 2017 06:34:07 +0000 (14:34 +0800)]
MLK-16728 imx8mq: evk: reserve the tee space when tee enabled

rom_pointer[0] contains the base, rom_pointer[1] contains the size.
When TEE enabled, if not reserve the space, uboot relocation may
overwrite TEE or trigger fault when TZASC enabled.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
7 years agoMA-10552-10 [Android] enable A/B system in android
zhang sanshan [Mon, 30 Oct 2017 09:19:45 +0000 (17:19 +0800)]
MA-10552-10 [Android] enable A/B system in android

CAAM do not work in imx8.
disable FASTBOOT_ENCRYPT_LOCK for lock&unlock and return 0
for fsl avb call back on imx8 device.

Change-Id: I79e2de2571a922ae22c2a52f0beb661762e11dd5
Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
7 years agoMA-10552-7 [Android] enable A/B system in android
zhang sanshan [Sun, 29 Oct 2017 09:02:08 +0000 (17:02 +0800)]
MA-10552-7 [Android] enable A/B system in android

add macro which support A/B boot and AVB.
change CONFIG_ANDROID_THINGS_SUPPORT to CONFIG_ANDROID_AB_SUPPORT

Change-Id: I08688e7b19ec7b8d71c7adcd298ae2ccc1e309c3
Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
7 years agoMA-10552-6 [Android] enable A/B system in android
zhang sanshan [Sun, 29 Oct 2017 08:46:26 +0000 (16:46 +0800)]
MA-10552-6 [Android] enable A/B system in android

support arm64 kernel image when enable AVB.
put the bootimage at hdr->kernel_addr - hdr->page_size.
copy ramdisk and dts to the addr in bootimage header.

Change-Id: I45c2f8238c2bf055130e6e7c2d5b431ca46e431e
Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
7 years agoMLK-16725 imx8mq: clock: Set ARM core clock according to the CPU grade
Ye Li [Mon, 30 Oct 2017 03:16:31 +0000 (22:16 -0500)]
MLK-16725 imx8mq: clock: Set ARM core clock according to the CPU grade

According to the data sheet iMX8MXEC_Rev_E, the imx8mq has two CPU grades:
consumer and industrial, which has different maximum ARM CPU freq for nominal mode.

    consumer:    arm core clock @ 1Ghz
    industrial:  arm core clock @ 800Mhz.

So in u-boot we changed to check the CPU grade fuse and select the frequency for
ARM core clock.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16724 imx8mq: clock: Fix FRAC PLL caculation issue
Ye Li [Mon, 30 Oct 2017 02:53:21 +0000 (21:53 -0500)]
MLK-16724 imx8mq: clock: Fix FRAC PLL caculation issue

According to the FRAC PLL formula, DIVF_VAL = 1 + DIVFI + (DIVFF/224).
But in decode_frac_pll, the DIVFI and DIVFF are both added with 1. Fix it to
align with the formula.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16723 imx8mq: Fix ARM clock print value
Ye Li [Mon, 30 Oct 2017 02:12:57 +0000 (21:12 -0500)]
MLK-16723 imx8mq: Fix ARM clock print value

Since imx8mq uses 25Mhz OSC as PLL's reference clock by default.
There is no 24Mhz used. So fix the ARM clock print value to 800Mhz and 1000Mhz.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoRecover the leading underline of "androidboot.slot_suffix" cmdline
ji.luo [Thu, 19 Oct 2017 01:12:19 +0000 (09:12 +0800)]
Recover the leading underline of "androidboot.slot_suffix" cmdline

The androidboot.slot_suffix kernel cmdline will be used to constitute
the full name of some partitions(like vendor partition), removing the
leading underline will cause these partitions mount failed.

Bug: 65174205

Change-Id: Icda99b51af75633b62c1950e44b5c27f02370ea4
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoPass bootloader metrics to kernel by kernel cmdline
ji.luo [Tue, 10 Oct 2017 10:22:02 +0000 (18:22 +0800)]
Pass bootloader metrics to kernel by kernel cmdline

Pass bootloader metrics (nBLL, nBLE, KD, KL, AVB, ODT, SW)
to kernel by kernel cmdline.

Change-Id: Ibabff6844be86d028548d1ad697d948ef20590f3
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoRemove the leading underline in some slot suffix
ji.luo [Wed, 11 Oct 2017 13:40:06 +0000 (21:40 +0800)]
Remove the leading underline in some slot suffix

Change-Id: I17632f8d175177b5cb0a9165651fb3b732ae1145
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoRefine support for 'fastboot getvar all' command
ji.luo [Thu, 28 Sep 2017 10:54:27 +0000 (18:54 +0800)]
Refine support for 'fastboot getvar all' command

Make the device respond multiple packets after receiving fastboot
command "fastboot getvar all" from the host. It can make the
"fastboot getvar all" work both on Windows host and Linux host.

Change-Id: I428678369134b4228d7544fb3cbcb3469ffec6a1
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoEnable multiple packets sent on fastboot
ji.luo [Thu, 28 Sep 2017 10:49:47 +0000 (18:49 +0800)]
Enable multiple packets sent on fastboot

Change-Id: I2b8fd610258ffcf81fed25184e69a2d7f34c4b88
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoSupport 'fastboot flashing get-unlock-ability' command
ji.luo [Fri, 29 Sep 2017 06:36:17 +0000 (14:36 +0800)]
Support 'fastboot flashing get-unlock-ability' command

Change-Id: I7f3f8061da76a0a4957ff042058173b2a86da4ba
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoRemove leading zeroes of some getvar variables
ji.luo [Fri, 29 Sep 2017 05:15:50 +0000 (13:15 +0800)]
Remove leading zeroes of some getvar variables

Remove the leading zeroes of 'partition-size', 'max-download-size',
'erase-block-size' and 'logical-block-size' variables.

Change-Id: I981cfced2d82a43e87a8f244caf04c6920bff5b2
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years ago[iot] Add ATX support in Trusty OS enabled config
Haoran.Wang [Thu, 21 Sep 2017 04:52:01 +0000 (12:52 +0800)]
[iot] Add ATX support in Trusty OS enabled config

Add ATX support in below boards which support Trusty OS:
 * Argon (iopb)
 * Pico-7d
 * Pico-6ul

Change-Id: I41be527024f2e666cf4d83d01b7c775fc412a2c5
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
7 years ago[iot] Fix non-secure uboot crash before jump to Linux
Haoran.Wang [Mon, 4 Sep 2017 11:25:32 +0000 (19:25 +0800)]
[iot] Fix non-secure uboot crash before jump to Linux

As ARMV7_NONSEC macro enabled so it will init uboot monitor
before jump to Linux and this will bring crash.
So goto Linux directly before this process.

Change-Id: Ieb44f326a4be21c20b662443c713009adb3c376e
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
7 years ago[iot] Refine IMX_TRUSTY_OS config in defconfigs
Haoran.Wang [Thu, 31 Aug 2017 13:47:20 +0000 (21:47 +0800)]
[iot] Refine IMX_TRUSTY_OS config in defconfigs

This will make the CONFIG_IMX_TRUSTY_OS enabled in
the final .config file.

Change-Id: I242959e390cfb518508fb1b3cb8a2d0bd52b1841
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
7 years ago[iot] Add SYS_ARM_CACHE_WRITEALLOC config
Haoran.Wang [Thu, 31 Aug 2017 13:42:27 +0000 (21:42 +0800)]
[iot] Add SYS_ARM_CACHE_WRITEALLOC config

Add SYS_ARM_CACHE_WRITEALLOC into Kconfig as
Trusty OS need inner/outer cache support write/read
alloc.

Change-Id: I75852c074cb3890d20717ae2a991015d436d7c69
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
7 years ago[iot] Init ql-tipc after Trusty OS ready
Haoran.Wang [Mon, 28 Aug 2017 10:30:27 +0000 (18:30 +0800)]
[iot] Init ql-tipc after Trusty OS ready

Init ql-tipc after Trusty OS loaded.
Also release ql-tipc before jump to Linux.

Change-Id: Idf385eb8ccbf6edbd059a779e347cf062e6be39c
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
7 years ago[iot] Export eMMC RPMB interface for Secure Storage proxy
Haoran.Wang [Mon, 28 Aug 2017 10:30:06 +0000 (18:30 +0800)]
[iot] Export eMMC RPMB interface for Secure Storage proxy

Secure Storage service in Trusty OS will compute
the encrypted mmc frame and the rpmb proxy inject the frame
to driver directly. So that need to export RPMB related
interface for Secure Storage proxy use.

Change-Id: I7f69831a20a440f597d323b610fa615fd4344d05
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
7 years ago[iot] Import ql-tipc lib for Trusty OS
Haoran.Wang [Mon, 28 Aug 2017 07:21:44 +0000 (15:21 +0800)]
[iot] Import ql-tipc lib for Trusty OS

The lib provided ql-tipc communication channel with
Trusty OS.
Also the AVB, Keymaster and SecureStorage service
tipc client implement in this lib.

Change-Id: I0ab1ec9ee1b6f272b960c2e944008283c2c9249a
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
7 years agoMA-10479 Remove CONFIG_FSL_BOOTCTL from u-boot
ji.luo [Wed, 18 Oct 2017 11:46:00 +0000 (19:46 +0800)]
MA-10479 Remove CONFIG_FSL_BOOTCTL from u-boot

This function is replaced by AVB, we don't need the
CONFIG_FSL_BOOTCTL anymore.

Change-Id: Ib418a4ec565e2a098f0a0ce574710317619bbebe
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMLK-16689: Add DDR PHY training flow for different frequency
Bai Ping [Wed, 18 Oct 2017 05:36:13 +0000 (13:36 +0800)]
MLK-16689: Add DDR PHY training flow for different frequency

On our i.MX8MQ EVK board, we will support three frequency point:
    1. 3200mts, DDRC core clock is 800MHz;
    2. 400mts, DDRC core clock is 100MHz;
    3. 100mts, DDRC core clock is 25MHz.

The 1D training flow need to be run once for each frequency. The
PHY training updated to support training different frequency point.

Additionally, the DDRC's registers of other frequency also need to
be configured.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
7 years agoMLK-16679: Add 2d training code on imx8mq
Bai Ping [Tue, 10 Oct 2017 03:12:06 +0000 (11:12 +0800)]
MLK-16679: Add 2d training code on imx8mq

Change the DDR calibration flow from 1D training to 2D training.
the hardware can use an this optional 2D training to optimize
the PHY and DRAM setting in both time and voltage.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
7 years agoMA-10482-1 [Android] enable FIT for android
zhang sanshan [Thu, 19 Oct 2017 05:37:15 +0000 (13:37 +0800)]
MA-10482-1 [Android] enable FIT for android

enable FIT to align BSP

Change-Id: I092a775fc3e6ef0377596905cd4ac73222fbd55b
Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
7 years agoMLK-16608: configs: add flexspi config for imx8qm mek
Han Xu [Wed, 18 Oct 2017 20:42:14 +0000 (15:42 -0500)]
MLK-16608: configs: add flexspi config for imx8qm mek

add flexspi config for imx8qm mek board to support boot from octal nor
chip.

Reviewed-by: Frank Li <frank.li@nxp.com>
Signed-off-by: Han Xu <han.xu@nxp.com>
7 years agoMLK-16598-2: configs: add flexspi config for i.mx8qxp mek
Han Xu [Tue, 17 Oct 2017 19:50:46 +0000 (14:50 -0500)]
MLK-16598-2: configs: add flexspi config for i.mx8qxp mek

add flexspi config for i.mx8qxp mek to support boot from octal nor chip.

Reviewed-by: Frank Li <frank.li@nxp.com>
Signed-off-by: Han Xu <han.xu@nxp.com>
7 years agoMLK-16598-1: imx8qxp_mek: add qspi boot config
Han Xu [Tue, 17 Oct 2017 19:48:31 +0000 (14:48 -0500)]
MLK-16598-1: imx8qxp_mek: add qspi boot config

Add boot from QSPI configs for i.mx8qxp mek

Reviewed-by: Frank Li <frank.li@nxp.com>
Signed-off-by: Han Xu <han.xu@nxp.com>
7 years agoMLK-16594-1: imx8qm/qxp: clean-up: Remove unused structures.
Adriana Reus [Mon, 16 Oct 2017 13:36:41 +0000 (16:36 +0300)]
MLK-16594-1: imx8qm/qxp: clean-up: Remove unused structures.

Remove boot device - related structures that are no longer used on
imx8qm/qxp since we now use SCFW API to get the boot device instead of
the AP-ROM information.

Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16594-0: imx8qm/qxp: Use SCFW API instead of info from ROM_SW
Adriana Reus [Mon, 16 Oct 2017 13:08:00 +0000 (16:08 +0300)]
MLK-16594-0: imx8qm/qxp: Use SCFW API instead of info from ROM_SW

In B0 there is no AP-ROM, and the ROM_SW address can no longer be used
to extract data about the boot device.
Use the scfw api in mmc_get_env_dev similarly to the change also made
in get_boot_device: 'commit 0851f23b5d4b ("MLK-16587-2 imx8qm/qxp:
Change to use SCFW API to get boot device")'

Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
7 years agoMA-10477[Android] Remove NAND partition definitions and operations in bcb
Zhang Bo [Wed, 18 Oct 2017 06:23:20 +0000 (14:23 +0800)]
MA-10477[Android] Remove NAND partition definitions and operations in bcb

Remove NAND partitions definitions in .h file.
Remove NAND related bcb operations.

Change-Id: I38774732e80f0402d63ea6d3f862e385f3e01e31
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
7 years agoMA-10476[Android]Remove <board>_nand_defconfig used for android
Zhang Bo [Tue, 17 Oct 2017 09:02:26 +0000 (17:02 +0800)]
MA-10476[Android]Remove <board>_nand_defconfig used for android

Android does not support NAND boot again, remove related defconfig

Change-Id: I1621d4fdab41a7be9dba44044ea379151b2b406c
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
7 years agoMA-10475[Android]Remove NAND support from fastboot
Zhang Bo [Tue, 17 Oct 2017 08:25:26 +0000 (16:25 +0800)]
MA-10475[Android]Remove NAND support from fastboot

Android does not support NAND boot again.

Change-Id: I4da83b50448601d11214af7cb5fbf24e1dc0f0b6
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
7 years agoMA-10474[Android]Remove CONFIG_SECURE_BOOT from boota
Zhang Bo [Tue, 17 Oct 2017 07:54:22 +0000 (15:54 +0800)]
MA-10474[Android]Remove CONFIG_SECURE_BOOT from boota

This function is replaced by AVB, not needed again.

Change-Id: I851292d04261a0cdd7c23a65b58a98fd6ac6f2b4
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
7 years agoMA-10417[Android] load whole boot image once and copy dtb and ramdisk to required...
Zhang Bo [Tue, 10 Oct 2017 12:34:36 +0000 (20:34 +0800)]
MA-10417[Android] load whole boot image once and copy dtb and ramdisk to required address

Load the whole boot image to (hdr->kernel_addr - hdr->page_size) for both arm and arm64,
then copy dtb and ramdisk to hdr->second_addr and hdr->ramdisk_addr.

Change-Id: Ib5388ee09866451ed6cb280946842d7b66a4d1e3
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
7 years agoMLK-16602 imx8mq: enlarge uboot entry
Peng Fan [Wed, 18 Oct 2017 06:06:10 +0000 (14:06 +0800)]
MLK-16602 imx8mq: enlarge uboot entry

Enlarge uboot entry and ENV offset, to leave space for TEE when using
fit.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agofit: If no matching config is found in fit_find_config_node(), use the default one
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:27 +0000 (12:57 +0200)]
fit: If no matching config is found in fit_find_config_node(), use the default one

If board_fit_config_name_match() doesn't match any configuration node,
then use the default one (if provided).

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
(cherry picked from commit 02035d0086b3f9114463a9b9df38a5618ffe8a04)

7 years agoMLK-16599 imx8m: support SPL FIT
Peng Fan [Wed, 18 Oct 2017 01:56:36 +0000 (09:56 +0800)]
MLK-16599 imx8m: support SPL FIT

Support SPL FIT. Uboot text base are also modified, because spl
will load fit to address before text base of uboot.

According to new ATF request, modified the SPL stack/bss to OCRAM_S
space.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
7 years agospl: Fix compiling warning on gunzip argument
York Sun [Fri, 15 Sep 2017 15:21:13 +0000 (08:21 -0700)]
spl: Fix compiling warning on gunzip argument

common/spl/spl_fit.c:201:12: warning: passing argument 4 of ‘gunzip’
from incompatible pointer type [-Wincompatible-pointer-types]
       src, &length))

Signed-off-by: York Sun <york.sun@nxp.com>
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
CC: Jean-Jacques Hiblot <jjhiblot@ti.com>
(cherry picked from commit 933f67aa56ea742f014b21bfe50a16a00e97b9bd)

7 years agospl: fit: Add booting OS first
York Sun [Tue, 15 Aug 2017 18:14:45 +0000 (11:14 -0700)]
spl: fit: Add booting OS first

If CONFIG_SPL_OS_BOOT is enabled, boot OS if kernel image is found
in FIT structure.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
(cherry picked from commit c8bc3c0c9ff7ce649b2af1416919b50ecf504874)

7 years agospl: fit: Support both external and embedded data
York Sun [Tue, 15 Aug 2017 18:14:44 +0000 (11:14 -0700)]
spl: fit: Support both external and embedded data

SPL supports U-Boot image in FIT format which has data outside of
FIT structure. This adds support for embedded data for normal FIT
images.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
(cherry picked from commit 5fd13d973613d308663f97b51059ecd9179baf09)

7 years agospl: fit: Eanble GZIP support for image decompression
York Sun [Tue, 15 Aug 2017 18:14:43 +0000 (11:14 -0700)]
spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
(cherry picked from commit 7264f2928b46c5f5685e39ed607652c8991e47b6)

7 years agospl: fit: Break out some functions into a common file
Cooper Jr., Franklin [Fri, 16 Jun 2017 22:25:05 +0000 (17:25 -0500)]
spl: fit: Break out some functions into a common file

Some of the functions within spl_fit will be used for non spl purposes.
Instead of duplicating functions simply break the functions to be reused
into its own file.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Only add the new define to image.h, otherwise we see breakage
due to massive include leakage into host tools in some cases]
Signed-off-by: Tom Rini <trini@konsulko.com>
(cherry picked from commit 3863f840fa03f6b93672a5afff74f15d460cb911)

7 years agocmd: spl: Fix compiling warning
York Sun [Tue, 15 Aug 2017 18:14:42 +0000 (11:14 -0700)]
cmd: spl: Fix compiling warning

Fix warning "cast from pointer to integer of different size".

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
(cherry picked from commit d1f2ee7021dc4a89f43e25f289747a27da0e930f)

7 years agoMakefile: add rules to generate SPL FIT images
Andre Przywara [Wed, 26 Apr 2017 00:32:45 +0000 (01:32 +0100)]
Makefile: add rules to generate SPL FIT images

Some platforms require more complex U-Boot images than we can easily
generate via the mkimage command line, for instance to load additional
image files.
Introduce a CONFIG_SPL_FIT_SOURCE and CONFIG_SPL_FIT_GENERATOR symbol,
which can either hold an .its source file describing the image layout,
or, in the second case, a generator tool (script) to create such
a source file. This script gets passed the list of device tree files
from the CONFIG_OF_LIST variable.
A platform or board can define either of those in their defconfig file
to allow an easy building of such an image.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
(cherry picked from commit 1a12fdc461421b5a385ab5d7926e5425d429d48e)

7 years agoKconfig: fix SPL_FIT dependency
Andre Przywara [Wed, 26 Apr 2017 00:32:38 +0000 (01:32 +0100)]
Kconfig: fix SPL_FIT dependency

SPL_FIT obviously requires libfdt in SPL, so let Kconfig express that by
selecting SPL_OF_LIBFDT.
Also make the actual options that users want (SPL signature and SPL FIT
loading) visible in the menu and let them select the SPL_FIT as a
requirement.
Also remove the now redundant SPL_OF_LIBFDT from those Kconfigs that had
it in for the SPL FIT loading feature.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[Remove change from configs/evb-rk3399_defconfig]
Signed-off-by: Jagan Teki <jagan@openedev.com>
(cherry picked from commit 85c07a5a379e5874aef0e5a0560536a2e6fa6114)

7 years agoSPL: FIT: allow loading multiple images
Andre Przywara [Wed, 26 Apr 2017 00:32:37 +0000 (01:32 +0100)]
SPL: FIT: allow loading multiple images

So far we were not using the FIT image format to its full potential:
The SPL FIT loader was just loading the first image from the /images
node plus one of the listed DTBs.
Now with the refactored loader code it's easy to load an arbitrary
number of images in addition to the two mentioned above.
As described in the FIT image source file format description, iterate
over all images listed at the "loadables" property in the configuration
node and load every image at its desired location.
This allows to load any kind of images:
- firmware images to execute before U-Boot proper (for instance
  ARM Trusted Firmware (ATF))
- firmware images for management processors (SCP, arisc, ...)
- firmware images for devices like WiFi controllers
- bit files for FPGAs
- additional configuration data
- kernels and/or ramdisks
The actual usage of this feature would be platform and/or board specific.

Also update the FIT documentation to mention the new SPL feature and
provide an example .its file to demonstrate its features.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Lokesh Vutla <lokeshvuta@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Jagan Teki <jagan@openedev.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
(cherry picked from commit 411cf32d200aeca0754ce7083c51391af84cf612)

7 years agoSPL: FIT: factor out spl_load_fit_image()
Andre Przywara [Wed, 26 Apr 2017 00:32:36 +0000 (01:32 +0100)]
SPL: FIT: factor out spl_load_fit_image()

At the moment we load two images from a FIT image: the actual U-Boot
image and the .dtb file. Both times we have very similar code, that deals
with alignment requirements the media we load from imposes upon us.
Factor out this code into a new function, which we just call twice.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Jagan Teki <jagan@openedev.com>
(cherry picked from commit 8baa381882e8b5e8684b331f09b04e2e2784fb0d)

7 years agoSPL: FIT: improve error handling
Andre Przywara [Wed, 26 Apr 2017 00:32:35 +0000 (01:32 +0100)]
SPL: FIT: improve error handling

At the moment we ignore any errors due to missing FIT properties,
instead go ahead and calculate our addresses with the -1 return value.
Fix this and bail out if any of the mandatory properties are missing.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Jagan Teki <jagan@openedev.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
(cherry picked from commit 5c8c8faccf0e660040ada1a9376b74a6807d4f5f)

7 years agoSPL: FIT: rework U-Boot image loading
Andre Przywara [Wed, 26 Apr 2017 00:32:34 +0000 (01:32 +0100)]
SPL: FIT: rework U-Boot image loading

Currently the SPL FIT loader always looks only for the first image in
the /images node a FIT tree, which it loads and later executes.

Generalize this by looking for a "firmware" property in the matched
configuration subnode, or, if that does not exist, for the first string
in the "loadables" property. Then using the string in that property,
load the image of that name from the /images node.
This still loads only one image at the moment, but refactors the code to
allow extending this in a following patch.
To simplify later re-usage, we also generalize the spl_fit_select_index()
function to not return the image location, but just the node offset.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Lokesh Vutla <lokeshvuta@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Jagan Teki <jagan@openedev.com>
(cherry picked from commit 736806fbfa7a0ffc2bc18c1521e42ac578b1ad1e)

7 years agoSPL: FIT: refactor FDT loading
Andre Przywara [Wed, 26 Apr 2017 00:32:33 +0000 (01:32 +0100)]
SPL: FIT: refactor FDT loading

Currently the SPL FIT loader uses the spl_fit_select_fdt() function to
find the offset to the right DTB within the FIT image.
For this it iterates over all subnodes of the /configuration node in
the FIT tree and compares all "description" strings therein using a
board specific matching function.
If that finds a match, it uses the string in the "fdt" property of that
subnode to locate the matching subnode in the /images node, which points
to the DTB data.
Now this works very well, but is quite specific to cover this particular
use case. To open up the door for a more generic usage, let's split this
function into:
1) a function that just returns the node offset for the matching
   configuration node (spl_fit_find_config_node())
2) a function that returns the image data any given property in a given
   configuration node points to, additionally using a given index into
   a possbile list of strings (spl_fit_select_index())
This allows us to replace the specific function above by asking for the
image the _first string of the "fdt" property_ in the matching
configuration subnode points to.

This patch introduces no functional changes, it just refactors the code
to allow reusing it later.

(diff is overly clever here and produces a hard-to-read patch, so I
recommend to throw a look at the result instead).

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Lokesh Vutla <lokeshvuta@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Jagan Teki <jagan@openedev.com>
(cherry picked from commit 4b9340abdc23f25b75282cdc8b84a06c8b10cd27)

7 years agoMA-10469 Fix build error for Android uboot
ji.luo [Tue, 17 Oct 2017 07:52:07 +0000 (15:52 +0800)]
MA-10469 Fix build error for Android uboot

Add FASTBOOT_PARTITION_TEE definition for normal Android, this
will fix the build error in u-boot.

Change-Id: I7800e8370fbabe01d6d25e0a9f2b9e4578a805b0
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-10346 Fix build error for imx6ul-spriot board
ji.luo [Thu, 28 Sep 2017 01:48:51 +0000 (09:48 +0800)]
MA-10346 Fix build error for imx6ul-spriot board

Fix CONFIG_BOOTDELAY redefine error for imx6ul-spriot board.

Change-Id: I949b6b815f9232e88cf72be853c8fca6f544b155
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-10342 Revert "Fix get partition error in fastboot"
ji.luo [Wed, 27 Sep 2017 07:59:52 +0000 (15:59 +0800)]
MA-10342 Revert "Fix get partition error in fastboot"

This reverts commit 82a7723b3f69c2631770d0f30ad16269e9d86389.

The partition 'tos' was hard coded in u-boot so this patch wasn't needed
anymore.

Change-Id: Ie1f651c7c813379dcd8768da0bc9a628d1741fd1
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-10341 Rename physical partition boot0 from bootloader to bootloader0.
Marty Faltesek [Wed, 30 Aug 2017 20:57:23 +0000 (13:57 -0700)]
MA-10341 Rename physical partition boot0 from bootloader to bootloader0.

On the imx7d, the bootloader currently in use resides on physical partition
boot0, and is currently referenced and hard coded as "bootloader".  But
this conflicts with the new bootloader_a and bootloader_b in the gpt, so
that "fastboot flash bootloader ..." flashes to bootloader_a or b. With this
fix boot0 can instead by explicitly referenced as
"fastboot flash bootloader0 ...".

"bootloader0" is currently the only bootloader on the system, but
once a/b bootloading is implemented it is going to be a more SPL-like
that loads either bootloader_a or bootloader_b.

Test: manually verified flashing bootloader0, bootloader, and bootloader_a
      and bootloader_b.

Change-Id: I03a85289f80cdf5f1b80dc07a962a143c6a351e1