The mmc_select_mode_and_width() function can be called while the card
is in HS200/HS400 mode and can be used to downgrade the card to lower
mode, e.g. HS. This is used for example by mmc_boot_part_access_chk()
which cannot access the card in HS200/HS400 mode and which is in turn
called by saveenv if env is in the MMC.
In such case, forcing the card clock to legacy frequency cannot work.
Instead, the card must be switched to HS mode first, from which it can
then be reprogrammed as needed.
However, this procedure needs additional code changes, since the current
implementation checks whether the card correctly switched to HS mode in
mmc_set_card_speed(). The check only expects that the card will be going
to HS mode from lower modes, not from higher modes, hence add a parameter
which indicates that the HS200/HS400 to HS downgrade is happening. This
makes the code send the switch command first, reconfigure the controller
next and finally perform the EXT_CSD readback check. The last two steps
cannot be done in reverse order as the card is already in HS mode when
the clock are being switched on the controller side.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
(cherry picked from commit 523f613609545252f08f01f346ba4b0403f78b7c)
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Update the lpddr4 timing config to align with the ddr tool
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit a1433dec3a03a6c944b61600e7b317e2a83f2981)
The normal ready time of M4 side is less than 1s, so we can use
2s as the timeout of connection. The current value is 10s, which seems
a little long if M4 SRTM service does not run.
Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 4792d8967d3c631d055c133303bb6385b822a3ca)
There are two LPCG HW issues reported in TKT322331. Add workaround
for them in u-boot.
1. Back to back LPCG write access must have 4x DSC cycle interval.
2. When DSC clock is gated, LPCG write access may be missed due to
the edge detect is not see by DSC. Two writes shall be performed
to re-enable the clock if DSC clock is gated
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 96186ca0048e6ae261176e5f3ebf02be09bacb08)
When switching ARM root clock source from ARM PLL to 24M OSC,
found the ARM timer may stop on few chips during stress reboot test.
The system counter is still increasing, but ARM timer is stopped.
Add a workaround that switch ARM clock source from ARM PLL to
Sys PLL2 500M clock instead of 24M OSC. Stress reboot test is
passed on all failed chips.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 74770228976c013a3e289b21f6e27334ea97bee4)
Fix coverity issue: CID 2970630: Resource leak (RESOURCE_LEAK)
leaked_storage: Variable cdns going out of scope leaks the storage
it points to.
Memory allocated by devm_kzalloc() won't be freed automatically in
u-boot, free the memory manually here.
Test: Coverity scan pass.
Change-Id: I3000a2385941cef3b8b7e01611cfdc999971a4ca
Signed-off-by: Luo Ji <ji.luo@nxp.com>
Fix coverity issue:
CID 43787: Buffer not null terminated (BUFFER_SIZE_WARNING)
buffer_size_warning: Calling strncpy with a maximum size argument
of 32 bytes on destination array sdev.name of size 32 bytes might
leave the destination string unterminated.
Test: Coverity scan pass.
Change-Id: Ib10e631bab893cb9cd1484082229f806b02849ba
Signed-off-by: Luo Ji <ji.luo@nxp.com>
change the mtd rootfs partition index number for i.MX8QXP lpddr4 validation board.
Signed-off-by: Han Xu <han.xu@nxp.com>
(cherry picked from commit 2d5923f215dfcc74b187e3b7ec4af1d0c9462d45)
Add defconfig file to support dual bootloader for xen.
Test: build and boot on imx8qm_mek.
Change-Id: I21e372b71a9b25e4cbf71cf7f41cfd87296b9afe
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Meet the build error below with ARM2 SPL defconfig
arch/arm/mach-imx/imx8/image.c: In function ‘spl_nor_get_uboot_base’:
arch/arm/mach-imx/imx8/image.c:224:13: error: ‘CONFIG_SYS_UBOOT_BASE’
undeclared (first use in this function)
if (end <= CONFIG_SYS_UBOOT_BASE)
The root cause is we did not add SPL NOR support for ARM2 SPL, but
the codes still use the CONFIG_SYS_UBOOT_BASE.
Fix the issue by adding SPL device support config for each device
relevant function.
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit a96fd317601db7f21402e5f74fe24653e2af8ae7)
Trusty is not supported for xen so we don't need to check
the keyslot package or rollback index in spl. Reassign the
dram address for spl and u-boot to avoid conflicts.
Support serial init functions to enable debug console
in spl when xen is running.
Test: Boot and A/B slot switch on imx8qm_mek.
Change-Id: If6829252f1ec2e32255f951715c8747181951fd0
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Fix resource leak in libavb, coverity issue:
CID 5899691: Resource leak (RESOURCE_LEAK) leaked_storage: Variable
hash_out going out of scope leaks the storage it points to.
CID 5899689: Resource leak (RESOURCE_LEAK) leaked_storage: Variable
hash_buf going out of scope leaks the storage it points to.
CID 5899688: Uninitialized pointer read (UNINIT) uninit_use: Using
uninitialized value digest.
CID 5899692: Structurally dead code (UNREACHABLE) unreachable: This
code cannot be reached: goto out;
Test: Coverity scan pass.
Change-Id: If8e26fdd383c32a9160775006621830b42c0f07e
Signed-off-by: Luo Ji <ji.luo@nxp.com>
Fix coverity issue: CID 5433686: Uninitialized scalar variable (UNINIT)
uninit_use_in_call: Using uninitialized value value when calling
call_imx_sip_ret2.
Test: coverity scan pass.
Change-Id: Id89f8f6f69fb944179b34dca4146fd7636505681
Signed-off-by: Luo Ji <ji.luo@nxp.com>
Fix coverity issue CID 3298992: Double free (USE_AFTER_FREE)
double_free: Calling free frees pointer rsrc_data which has
already been freed.
Check the rsrc_data buffer before free to avoid free NULL
pointer.
Change-Id: I781e87667a5d3bbe25ec12fbae8e3958d9b29244
Signed-off-by: Luo Ji <ji.luo@nxp.com>
The enable pin of USB is controlled by i2c IO expender which is
controlled by M4 image. Add macro to enable virtual i2c function. It
will send i2c message to M4 side to enable USB phy chip.
Change-Id: Ib7ed710d293b002526be3bd233921797eb9c6d41
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
Image size is about 30M and 0x8028000+30M has overlaped with malloc
memory. malloc memory end address is 0x88000000 and need to decrease the
malloc size to reserve enough memory for loading kernel and dtb image.
The memory address 0x90000000~0x92000000 has been reserved for M4 in
SCFW. Need to change the HDMI firmware loading address to 0x84000000
which is aligned with BSP image.
Change-Id: I6f9b6e05a9c9d8b5f7d385632a0ef54a0c20667d
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
We are currently using SC_R_LAST as a marker for imx8 power domain tree
nodes without a resource attached. This value is compiled into dtb as
part of the linux build and used by uboot.
The SC_R_LAST constant changes frequently as SCFW resources are added
(by design) and every time we need to update linux and uboot headers
together or boot can fail.
Fix this by replacing SC_R_LAST usage with a new constant SC_R_NONE
defined to be 0xFFF0.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 93f302a6642adedfdd6336b22d08f32284539e35)
Move spl to 0x8000_0000 will cause cpu1 ~ cpu3 jump to spl when
boot/reboot, revert this patch.
This reverts commit 7d111f4c8bac25c234b0fc24af885421ce8bb188.
Change-Id: I9adcd980b42a7539d6309cafaabff9d079ca993d
Currenlty U1 and U2 low power modes are allowed in device mode.
Allowing U1 and U2 low power modes during data transfers in
device mode is causing U1 exit failure on some USB3 host: which
will transite to SS.inactive instead of U0, then host will send
warm reset and ultimately result in reenumeration. This is observed
on UUU tool with some PC host. Hence disable U1 and U2 low power
modes for now.
USB3 spec 7.5.10.4.2 Exit from Recovery.Configuration
The port shall transition to eSS.Inactive when the following
conditions are met:
1. Either the Ux_EXIT_TIMER or the 6-ms timer
(tRecoveryConfigurationTimeout) times out.
2. For a downstream port, the transition to Recovery is not to
attempt a Hot Reset.
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit ae0cdc741f7313398539f7b576ced73871f6cd71)
The spl is located at ocram which will be lost when suspend/resume,
partition reboot will make A core reboot from the start address of
ATF, which blocks dual bootloader feature on Android Auto.
Move the spl to dram and make the partition reboot from spl to fix this
issue. The memory map will be changed to:
SPL: 0x0000_0000 --------> 0x8000_0000
ATF: 0x8000_0000 --------> 0x8004_0000
U-boot: 0x8002_0000 --------> 0x8006_0000
Test: reboot ok on imx8qm/imx8qxp.
Change-Id: I49e8be51bf427dd00eb7507de22a787c6f6e1582
Signed-off-by: Ji Luo <ji.luo@nxp.com>
The HDMI digital PLL, bus clock and core clock need to change to improve the
firmware loading time. The clock are now set to 800 MHz for DPLL, 200 MHz for
HDMI core, and 100 MHz for HDMI bus.
Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
Currently when SPL load 3rd container, it will do the authentication
unconditionally. But when running SPL on Xen, the seco authentication
is not supported, and cause failure in loading.
Change the parser codes to depend on CONFIG_AHAB_BOOT to do the
authentication.
Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit e38169a27fbe052561c5b369500e80477760ec3e)
Create new config file based on "imx8mq_aiy_android_defconfig"
and enable the CONFIG_IMX_TRUSTY_OS to supprt Trusty OS for AIY.
Also enlarge the malloc poll to 96 MB because calculate hash
with CAAM will consume more heap memory.
Test: Trusty OS boots up and CAAM functions work.
Change-Id: Ia4bdf4c32617cb4d2951b63f34f3a4a83f4af1b5
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Trusty OS will check and require the memory passed from non-secure world
is inner shareable. Change the memory attribute as PTE_BLOCK_INNER_SHARE
in u-boot to meet the requirement.
Test: build and boot on imx8qm/imx8qxp.
Change-Id: I1aac9b430ecc0fa94f9a1f6dd519b34ce6fef7bd
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Check the return values for SCFW APIs and print error logs
if the return value is not "SC_ERR_NONE".
Test: boot on imx8qm.
Change-Id: Ic7008bd2656375875e77dd3c922dafb1be145357
Signed-off-by: Ji Luo <ji.luo@nxp.com>
On iMX8MM, the V flag in TRISTR register only reflect the state of SNSR
value, not the calibrated TEMP value. So checking this flag is not
reliable. Per IC suggestion, change to read the TEMP/AVG_TEMP directly
and check whether it in valid range 10-125C.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit fe41c5fa6af88cce7f5a9723c82d6ad4e61357ce)
Update SCFW API to v1.3 at below commit. A new API sc_pm_set_boot_parm
is added.
commit c5ef21f894de0ac8329f0fe540331a272fcd1461
Author: Chuck Cannon <chuck.cannon@nxp.com>
Date: Tue Feb 26 15:36:53 2019 -0600
SCF-352: Add more to SECO test.
Signed-off-by: Chuck Cannon <chuck.cannon@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit e79209e4174054bb328bae441bf8ab3c1312ee4e)
Set the default environment "panel" as "NULL" to fix the
LVDS0-HDMI not work issue.
Test: LVDS0-HDMI works fine on imx8qm_mek.
Change-Id: I115b0a185717762af911fe1e9237fb26ecbb7e3e
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Fix a typo in path provided for imx-mkimage iMX8QM and iMX8QXP directories.
Reported-by: Marius Grigoras <marius.grigoras@nxp.com>
Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit c75243c1a87a10f003377d9c144bcf412ba80440)
The commands included in introduction guide should not be used as
reference for programming the SRK Hash fuses as they are in big
endian.
Add a note to avoid a possible mistake.
Reported-by: Clement Le Marquis <clement.lemarquis@nxp.com>
Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 137319826cc32d98a9b6890f35dd6670e104c2a5)
Since commit 771b824728ca ("MLK-20919 imx8: ahab: Add command to
close the chip") the U-Boot is able to move the lifecycle from
NXP closed to OEM closed.
Update AHAB guides to use U-Boot ahab_close command instead of SCFW CLI.
As the procedure is now independent of SCFW terminal we can remove
this condition from documentation.
Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 6f93d877e1454024f666a4810d24148cf595429e)
Starting in L4.14.78 release, the OP-TEE CAAM driver does not set the
JROWN_NS field in case LMID is locked.
We need to include the Unlock MID command in CSF file otherwise device
will fail to boot in HAB closed mode.
Add section to avoid crash when OP-TEE is enabled.
Reported-by: Frank Zhang <frank.zhang@nxp.com>
Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit af03284ad38bd03ef1f0d4942842629db93d2c11)
When flexspi is assigned to M4 for XIP, its power up/down will fail.
This is expected so don't need to give warning.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 0803b4a9d4074a5bb101d194633cbdd7510a1e9a)
The CONFIG_QSPI_BOOT has been removed from SPL flexspi build, because
we have to change the u-boot ENV to SD/MMC, and this configuration will
set relevant configurations.
But we don't clean up CONFIG_QSPI_BOOT for SPL completely, SPL still has
some places using it and cause problem to flexspi boot.
Using CONFIG_SPL_SPI_SUPPORT to replace the CONFIG_QSPI_BOOT.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 0491bd4ba21ad620b4c514323a7d6b8a9e10325c)
If resource is not owned, we ignore sid settings.
When support CM41 + android auto on xen, some resources
are owned by CM41, when CM41 releases those resources,
CM41 will program SID for those resources.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Flynn xu <flynn.xu@nxp.com>
(cherry picked from commit cd0ec61b235929d75965c43e82127b73e73e1697)
Partition creation will be done in xen, remove it from uboot.
And add domu-android-auto property
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Flynn xu <flynn.xu@nxp.com>
(cherry picked from commit 23f7a037d14d05c2eea5622bd8ffda2f23d04372)
Update the ddr training code to work with the atf 2.0.
Test: Build and boot on imx8mq aiy 3G board.
Change-Id: I8546c34cfa4aeeed819f7797f8362676e420b41f
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Need to enable SPL NOR support for working with M4 XIP image. Missed
it in previous patch.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 51f7d1e0c46e67355f8361c1bac8322e8c6788a8)
When M4 is booted by ROM, we have to enable RPMSG in kernel, so need
to select the -rpmsg.dtb. If M4 is not enabled, use default kernel dtb.
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 8a57be45e18295ce1b19799723775cf5b205281d)
When using fdt_next_node, the depth variable needs being initialized
first, otherwise we many get undefined depth.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 1ae3d2d3859c5f2610c74cd192da2657e2600aff)
Remove trusty support in domu, since trusty EL3 not ready to handle
tipc being interrupt by xen. But we still leave the memory for trusty,
then it could be easy to add trusty back.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Flynn xu <flynn.xu@nxp.com>
(cherry picked from commit 1623426811bdf59c3d5dcab2be20293910a9bc5d)
The iMX8MQLite new part will not disable DCSS in fuse. So change
the codes to check the DCSS fuse before disable relevant FDT nodes
and u-boot HDMI splash screen.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 9e6ab0397b8d94de8b904250884726e58633066b)
When the temperature is out of sensor's range, the Valid bit won't be
set in TRITSR register. So the polling loop won't go out.
Change the codes to retry 10 times with 100ms interval for the Valid bit.
If the timeout, we give a warning for the invalid data.
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
(cherry picked from commit 7ea2168e06d4f77a872f51a167ee1ed6bf2b0632)
The imx6ul/ull/ulz EVK boards enable eMMC fastboot with ack by default bootcfg.
So when using uuu to burn eMMC, we have to set ack to 1 in "mmc partconf" command.
Add this env for these board, so that uuu can use it to solve the problem by
executing "if env exists emmc_ack; then ; else setenv emmc_ack 0; fi;" to
use the emmc_ack at runtime.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 9a4a67ed9f07e99cf284fe2929c4f12809b5884b)
Current SPL code only support ONFI-compatible NAND, porting the code
from nand_base.c to support legacy full id NAND chips, such as Toshiba
TC58NVG2S0H.
Signed-off-by: Han Xu <han.xu@nxp.com>
(cherry picked from commit 4086c6b9556acbec2a8748578eb4a9e719ab4ae7)
The hash buffer is allocated on stack if we don't use
CAAM to accelerate the hash calculation, don't free
the hash buffer in such case.
Test: Boot ok on imx8qm.
Change-Id: I3b3dcc0e8359848b4f9c58c802d51f0a76931e5e
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Grant user the permission to change the bootargs can be very
dangerous, so add config 'CONFIG_APPEND_BOOTARGS' to guard the
bootargs appending feature.
Test: bootargs can't be appended if "CONFIG_APPEND_BOOTARGS" is
not set.
Change-Id: I6d6879415ca251c806b56490290e5032aef24277
Signed-off-by: Ji Luo <ji.luo@nxp.com>