u-boot.git
5 years agopci: imx: Add DM and DT support
Marek Vasut [Sun, 9 Jun 2019 01:50:55 +0000 (03:50 +0200)]
pci: imx: Add DM and DT support

Add DM support and support for probing the iMX PCI driver from DT.
The legacy non-DM support is retained, however shall be removed once
DM PCI is the only option remaining.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
(cherry picked from commit a11c0f44b77b745519e35d30fc5eecb6206107fb)

5 years agopci: imx: Pass driver private data around
Marek Vasut [Sun, 9 Jun 2019 01:50:54 +0000 (03:50 +0200)]
pci: imx: Pass driver private data around

Pass the driver private data around the driver as much as possible, instead
of having it as a static global variable. This is done in preparation for
the DM conversion, no functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
(cherry picked from commit d2cc2e86f8e12393f2adf47c9a8694475e92e05a)

5 years agopci: imx: Fix potential 64bit memory access clamping
Marek Vasut [Sun, 9 Jun 2019 01:50:53 +0000 (03:50 +0200)]
pci: imx: Fix potential 64bit memory access clamping

The driver limits the config space base to 32bit, however it can be
64bit on 64bit iMX hardware too. Remove that limitation. This patch
has no impact on the iMX6, which is the only SoC currently supported
by this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
(cherry picked from commit 90f87fb5258c57bbb8497ac23454e659169483e4)

5 years agopci: imx: Factor out hard-coded register base addresses
Marek Vasut [Sun, 9 Jun 2019 01:50:52 +0000 (03:50 +0200)]
pci: imx: Factor out hard-coded register base addresses

Pull out hard-coded register base addresses into driver private
structure in preparation for DM conversion. No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
(cherry picked from commit 33f794be36e846a522c7020e642a1e89c0769b17)

5 years agoARM: imx: Call imx_pcie_remove() only for non-DM PCI driver
Marek Vasut [Sun, 9 Jun 2019 01:50:51 +0000 (03:50 +0200)]
ARM: imx: Call imx_pcie_remove() only for non-DM PCI driver

The DM iMX PCI driver has DM_FLAG_OS_PREPARE set and will call
imx_pcie_remove() from the .remove callback. Do not call it from
the architecture code again.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
(cherry picked from commit 42dc1230cdec48d0278dcc683bc14527cbea12c5)

5 years agoMLK-22387 configs: imx7dsabresd: correct the emmc_dev
Haibo Chen [Fri, 9 Aug 2019 06:10:33 +0000 (14:10 +0800)]
MLK-22387 configs: imx7dsabresd: correct the emmc_dev

For imx7d-sdb board, the emmc dev is 2, correct it, so
UUU can work well.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
5 years agoMLK-22417 imx8qxp_mek: Fix build break in fspi defconfig
Ye Li [Fri, 9 Aug 2019 02:51:44 +0000 (19:51 -0700)]
MLK-22417 imx8qxp_mek: Fix build break in fspi defconfig

When CI_UDC DM driver is enabled in SPL, it must enable EHCI host. Then when
building SPL DM USB host, the usb_hub.c requires to enable SPL ENV.
The imx8qxp fspi config save ENV in MMC due to fspi can't write when running with M4.
But MMC driver is not enabled in fspi SPL, so the build was broken.
Fix the issue by adding CONFIG_SPL_ENV_IS_NOWHERE to all defconfig with SPL ENV
is enabled.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22357-4 imx8: Enable usb2 configs on imx8 platform
Sherry Sun [Wed, 31 Jul 2019 19:31:46 +0000 (15:31 -0400)]
MLK-22357-4 imx8: Enable usb2 configs on imx8 platform

Enable the configs of usb2 so that both usb2 and usb3 gadget
drivers are now supported on imx8 plaform. And add
CONFIG_USB_PORT_AUTO to support usb port autodetect function
for SDP/fastboot.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
5 years agoMLK-22357-3 usb: Clear the value of bEndpointAddress before refill it
Sherry Sun [Wed, 31 Jul 2019 21:07:04 +0000 (17:07 -0400)]
MLK-22357-3 usb: Clear the value of bEndpointAddress before refill it

For one usb controller driver, the transport endpoint address won't
change after the driver initialize. So the value of bEndpointAddress
have no need to be cleared.

But when more than one usb controller drivers are used at the same time,
different endpoints address is used by different controller driver
usually, it will cause confusion of endpoint address. So the value of
bEndpointAddress had better been cleared everytime before we refill
endpoint address to it.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
5 years agoMLK-22357-2 sdp/fastboot: Add board_usb_gadget_port_auto() to autodetect the connecte...
Sherry Sun [Fri, 2 Aug 2019 17:58:03 +0000 (13:58 -0400)]
MLK-22357-2 sdp/fastboot: Add board_usb_gadget_port_auto() to autodetect the connected usb port

On imx8 platform, the usb2 and usb3 ports are both supported. Which
means we can use usb2(ci_udc_otg) and usb3(cdns3_generic_peripheral)
gadget driver to run sdp/fastboot/ums at the same time.

For sdp and the fastboot that runs automatically when uboot starts,
board_usb_gadget_port_auto() is added to autodetect usb port, this
means that we don't have to specify which USB port should be used to
download in code, now we can just connect either usb port then it
will download automatically.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
5 years agoMLK-22357-1 usb: Add handle_interrupts function pointer for UCLASS_USB_GADGET_GENERIC
Sherry Sun [Wed, 31 Jul 2019 00:42:02 +0000 (20:42 -0400)]
MLK-22357-1 usb: Add handle_interrupts function pointer for UCLASS_USB_GADGET_GENERIC

Since the orginal way to call interrupts handle function of DM usb
gadget driver is through dm_usb_gadget_handle_interrupts(), when we want
to use two or more different gadget drivers at the same time, it will
cause error of duplicate names.

So here add a handle_interrupts function pointer instead of driectly
call dm_usb_gadget_handle_interrupts(), then the error can be avoided.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
5 years agoMLK-22409 imx8qm_mek: Remove the spl defconfig
Ye Li [Thu, 8 Aug 2019 02:18:53 +0000 (19:18 -0700)]
MLK-22409 imx8qm_mek: Remove the spl defconfig

imx8qm_mek_spl_defconfig was wrongly added when porting android support
from 2018.03. Since we have enabled SPL building in imx8qm_mek_defconfig,
no need to keep this defconfig

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22405 DTS: imx8mn: Add USB gadget nodes and alias
Ye Li [Wed, 7 Aug 2019 07:06:16 +0000 (00:06 -0700)]
MLK-22405 DTS: imx8mn: Add USB gadget nodes and alias

Since the DM USB gadget is enabled at default, have to add USB gadget
nodes and alias to DTS, otherwise u-boot will fails to find gadget
devices.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoTEE-427 DTS: imx8mn: add optee node
Clement Faure [Fri, 26 Jul 2019 13:05:19 +0000 (15:05 +0200)]
TEE-427 DTS: imx8mn: add optee node

Add Optee device tree node to enable Optee driver.
The Optee driver is required on imx8mn for the DEK blob encapsulation.

Signed-off-by: Clement Faure <clement.faure@nxp.com>
Acked-by: Ye Li <ye.li@nxp.com>
5 years agoMA-15282-2 Set AIY display as 720p mode
Ji Luo [Mon, 5 Aug 2019 01:24:51 +0000 (09:24 +0800)]
MA-15282-2 Set AIY display as 720p mode

Change the density for 1GB DDR AIY to 160 tvdpi
to match 720p display mode.

Test: boot.

Change-Id: Ie4d30023f66af028d1e3ad7fbeb5b4f7169d2e6c
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMLK-22339: mx6qsabreauto: configs: add default mtdids and mtdparts
Yang-yang Guo [Sat, 3 Aug 2019 09:57:12 +0000 (17:57 +0800)]
MLK-22339: mx6qsabreauto: configs: add default mtdids and mtdparts
configs

set the i.MX6q default mtdids value as
"nor0=8000000.nor,nand0=gpmi-nand", nandbcb can directly write to the
nandboot partition after u-boot brings up.

=> nandbcb update $loadaddr nandboot 924672
Device nor0 not found!
current device is invalid, skip it and check the next one
device 0 offset 0x0, size 0x924672
Erasing at 0x3f00000 -- 100% complete.
NAND fw write: 0x200000 offset, 0x928000 bytes written: OK

Signed-off-by: Yang-yang Guo <alice.guo@nxp.com>
5 years agoMA-15285 Sync config CONFIG_CI_UDC to fix build error
Ji Luo [Fri, 2 Aug 2019 06:44:44 +0000 (14:44 +0800)]
MA-15285 Sync config CONFIG_CI_UDC to fix build error

Add "CONFIG_CI_UDC" for some configs to fix build error.

Test: build.

Change-Id: Id6a39a6ff354b22fdadf9c3096a82c2aec397fc9
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-15282 Set AIY display as 720p mode
Ji Luo [Thu, 1 Aug 2019 10:59:03 +0000 (18:59 +0800)]
MA-15282 Set AIY display as 720p mode

Setting the "androidboot.gui_resolution" will not make AIY use
720p ui resolution, set the "androidboot.displaymode" instead.

Test: boot on AIY.

Change-Id: I6575a77e23308946d02cf5faf56105fccc0b25b8
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-15259-1 Enable trusty for imx8mq_evk
Ji Luo [Tue, 30 Jul 2019 07:56:46 +0000 (15:56 +0800)]
MA-15259-1 Enable trusty for imx8mq_evk

Open configs to enable trusty for imx8mq_evk.

Test: build and boot on imx8mq_evk.

Change-Id: I4770ddeabfe5f97e4c74324c3e2bbdb5ea9b8bde
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-15257 Duplicate configs to enable trusty for imx8mq_evk
Ji Luo [Tue, 30 Jul 2019 06:43:58 +0000 (14:43 +0800)]
MA-15257 Duplicate configs to enable trusty for imx8mq_evk

Duplicate configs to enable trusty for imx8mq_evk.

Test: build.

Change-Id: Iefa6669f91b976e39c9ade6c014546741112c325
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-15217-2 Enable dual bootloader for imx8m
Ji Luo [Mon, 29 Jul 2019 09:15:55 +0000 (17:15 +0800)]
MA-15217-2 Enable dual bootloader for imx8m

Open configs to enable dual bootloader feature for imx8m
platforms.

Test: A/B slot switch and spl recovery mode test.

Change-Id: I12a84bad52b74a2fe04f54dc4950a04b8e118384
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-15217-1 Enable dual bootloader for imx8m
Ji Luo [Mon, 29 Jul 2019 05:20:36 +0000 (13:20 +0800)]
MA-15217-1 Enable dual bootloader for imx8m

Duplicate configs to enable dual bootloader for imx8m.

Change-Id: Iae2ec1f48023ef58970f13a8d1374fdee6b88aeb
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-15180 Refine dual bootloader flow for imx8m
Ji Luo [Mon, 22 Jul 2019 01:14:28 +0000 (09:14 +0800)]
MA-15180 Refine dual bootloader flow for imx8m

We may need to enable the dual bootloader feature on non-trusty
platforms, skip the bootloader rollback index check in spl if
trusty is not enabled.

Don't generate rpmb key in spl, it should be generated in u-boot
proper with u-boot commands.

Test: dual bootloader on imx8mm.

Change-Id: Iac454e0140cd6f4472a66d267d9ba0d40df7102c
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMLK-22351 iMX8DXL: Add iMX8DXL phantom chip MEK board
Ye Li [Wed, 12 Jun 2019 03:27:12 +0000 (20:27 -0700)]
MLK-22351 iMX8DXL: Add iMX8DXL phantom chip MEK board

The iMX8DXL phantom chip is 15x15 iMX8QXP, so we will use 8QXP as SOC,
add configs and codes for the new board.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22336-4 imx8mm/8mn: configs: Move CONFIG_CI_UDC
Sherry Sun [Sat, 27 Jul 2019 01:22:54 +0000 (21:22 -0400)]
MLK-22336-4 imx8mm/8mn: configs: Move CONFIG_CI_UDC

For imx8mm/8mn, the CONFIG_CI_UDC is defined in
include/configs/imx8m*.h, which leads to CONFIG_CI_UDC can not been
enabled in Kconfig, and CONFIG_DM_USB_GADGET which we need selected by
CONFIG_CI_UDC in Kconfig also can not work. So move CONFIG_CI_UDC to
defconfig files.

The CONFIG_USB_GADGET_DUALSPEED is selected by CONFIG_CI_UDC in Kconfig
files too, so we don't need it to be defined in include/configs/imx8m*.h
files.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22336-3 usb: Kconfig: imply DM_USB_GADGET
Sherry Sun [Sat, 27 Jul 2019 01:12:21 +0000 (21:12 -0400)]
MLK-22336-3 usb: Kconfig: imply DM_USB_GADGET

Since the ci_udc driver has been converted to DM driver, the
CONFIG_DM_USB_GADGET should also be selected when CONFIG_CI_UDC
is enabled, then we can use DM ci_udc driver.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22336-2 dts: Add a new usb gadget node on imx6/7/7ulp/8/8mm
Sherry Sun [Thu, 25 Jul 2019 21:20:26 +0000 (17:20 -0400)]
MLK-22336-2 dts: Add a new usb gadget node on imx6/7/7ulp/8/8mm

Since one dts node can only bind to one DM driver in uboot, for usbotg
node, we can not use it for both DM usb host driver and DM usb gadget
driver. So a new usb gadget node is added to each usbotg node, the
original usbotg node is bind to usb host driver as default, and the
new usb gadget node is bind to usb gadet driver as default.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22336-1 usb: ci_udc: Convert driver to DM_USB_GADGET
Sherry Sun [Tue, 23 Jul 2019 19:21:57 +0000 (15:21 -0400)]
MLK-22336-1 usb: ci_udc: Convert driver to DM_USB_GADGET

Convert the ci_udc driver to driver model by using the uclass
UCLASS_USB_GADGET_GENERIC. The clk and power of USB controller and USB
PHY both are initialized by parsing the device tree nodes.

If CONFIG_DM_USB_GADGET is defined, we use the ci_udc driver in DM way,
if it does not defined, we can use ci_udc driver in its original Non-DM
way.

Move some USB PHY register definitions from ehci-mx6.c to
asm/mach-imx/regs-usbphy.h in order to share with DM usb gadget driver.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22179-2 imx8mn_evk: Enable FSPI DQS loopback for high freq
Ye Li [Wed, 3 Jul 2019 08:01:44 +0000 (01:01 -0700)]
MLK-22179-2 imx8mn_evk: Enable FSPI DQS loopback for high freq

There is an divider on imx8mn will always divide 2 to flexspi root clock.
So actual SCLK output to device is 50Mhz on imx8mn not 100Mhz.

After changing the root clock setting to configure SCLK to 100Mhz, found
the read data is not correct. Must enable the internal DQS pad loopback
to fix the problem.

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

5 years agoMLK-22179-1 fsl_fspi: Add a config to enable dummy DQS loopback from pad
Ye Li [Wed, 3 Jul 2019 07:58:13 +0000 (00:58 -0700)]
MLK-22179-1 fsl_fspi: Add a config to enable dummy DQS loopback from pad

Set MCR0 RXCLKSRC to 1 to enable DQS loopback from pad to support
higher frequency.

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

5 years agoMLK-22293-12 mx6q/qp: Update SATA codes and configs for sabre boards
Ye Li [Tue, 23 Jul 2019 03:53:31 +0000 (20:53 -0700)]
MLK-22293-12 mx6q/qp: Update SATA codes and configs for sabre boards

Enable the SCSI and imx AHCI driver in imx6q/qp sabreauto and sabresd
SATA configs. Removed unused codes for old SATA driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22293-11 DTS: imx6q/qp: Add gpr property to sata node
Ye Li [Tue, 23 Jul 2019 03:52:12 +0000 (20:52 -0700)]
MLK-22293-11 DTS: imx6q/qp: Add gpr property to sata node

Because u-boot does not support syscon_regmap_lookup_by_compatible,
we have to add a gpr phandle property to point to iomuxc gpr node.
and uses syscon_regmap_lookup_by_phandle to get gpr node in driver.

This is common implementation in other nodes and better than
by_compatible interface.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22293-10 imx6: Remove AHCI device before boot OS
Ye Li [Tue, 23 Jul 2019 03:51:25 +0000 (20:51 -0700)]
MLK-22293-10 imx6: Remove AHCI device before boot OS

Since we remove SATA device before boot OS, when AHCI is enabled, update
the codes to remove AHCI device.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22293-9 imx6: clock: Enable sata clock for imx AHCI
Ye Li [Tue, 23 Jul 2019 03:50:41 +0000 (20:50 -0700)]
MLK-22293-9 imx6: clock: Enable sata clock for imx AHCI

We reuse current sata clock interface in imx AHCI for imx6q/qp. So
enable them when the config is set

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22293-8 iMX8QM: Clean up SATA and enable AHCI on MEK
Ye Li [Thu, 18 Jul 2019 03:12:47 +0000 (20:12 -0700)]
MLK-22293-8 iMX8QM: Clean up SATA and enable AHCI on MEK

Remove unused old codes and configs for SATA. Enable the iMX AHCI driver
and relevat codes on iMX8QM MEK board. User can access the SATA disk
via SCSI commands.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22293-7 DTS: Update iMX8QM MEK dts to enable SATA
Ye Li [Thu, 18 Jul 2019 03:16:24 +0000 (20:16 -0700)]
MLK-22293-7 DTS: Update iMX8QM MEK dts to enable SATA

Enable the SATA node in iMX8QM MEK DTS file for iMX AHCI driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22293-6 clk-imx8: Add SATA relevant clock for iMX8QM
Ye Li [Fri, 19 Jul 2019 03:41:46 +0000 (20:41 -0700)]
MLK-22293-6 clk-imx8: Add SATA relevant clock for iMX8QM

Add the SATA clocks to clk-imx8, so we can use clk uclass interfaces
to access the clocks in AHCI driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22293-5 env: Update SATA env location driver to use SCSI
Ye Li [Tue, 23 Jul 2019 01:23:05 +0000 (18:23 -0700)]
MLK-22293-5 env: Update SATA env location driver to use SCSI

When DM SCSI is enabled with AHCI, use SCSI device to replace SATA
device to access the peripheral.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22293-4 fastboot: Change to use SCSI interface for sata device
Ye Li [Fri, 19 Jul 2019 03:42:17 +0000 (20:42 -0700)]
MLK-22293-4 fastboot: Change to use SCSI interface for sata device

After enabling AHCI driver and DM SCSI, we need to access SCSI device
for SATA

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22293-3 ata: ahci: Fix nport index issue
Ye Li [Fri, 19 Jul 2019 03:40:23 +0000 (20:40 -0700)]
MLK-22293-3 ata: ahci: Fix nport index issue

Ahci driver set max ports to 2, but the codes has comparing issue if we
only has one port. Also suppress the print of invalid port.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22293-2 ata: Add iMX AHCI driver
Ye Li [Thu, 18 Jul 2019 02:54:55 +0000 (19:54 -0700)]
MLK-22293-2 ata: Add iMX AHCI driver

Add new iMX AHCI driver which is ported from kernel and support
imx6q/qp/imx8qm.
The new driver adapt to SCSI through common AHCI interfaces in ahci.c
So after enabling it, we will use SCSI commands to access the SATA
disk device.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22293-1 Revert "MLK-14938-18 sata: Add i.MX8 SATA support"
Ye Li [Tue, 23 Jul 2019 04:00:25 +0000 (21:00 -0700)]
MLK-22293-1 Revert "MLK-14938-18 sata: Add i.MX8 SATA support"

We will implement a new imx AHCI driver for imx6q/qp/imx8qm, so
revert previous changes for SATA on imx8qm.
This reverts commit 9f538d64a8f7b216751f722e9c9ab4dc3af598ce.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMA-15208 Remap mmc device id in spl
Ji Luo [Wed, 24 Jul 2019 03:52:18 +0000 (11:52 +0800)]
MA-15208 Remap mmc device id in spl

MMC device id remap function "board_mmc_get_env_dev()" was
removed in u-boot v2019 because we add the mmc device aliases
in dts file. But we still need to remap the mmc device id in
spl or read/write rpmb keyslot package will fail.

This patch adds mmc device id remap function in spl to get the
correct device id.

Test: boot on imx8mm with trusty enabled.

Change-Id: I41c46494326d9eb2658d2cda692968fb895d0292
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-15158 Set spl recovery mode for dual bootloader
Ji Luo [Thu, 18 Jul 2019 05:56:45 +0000 (13:56 +0800)]
MA-15158 Set spl recovery mode for dual bootloader

The A/B slot selection is moved to spl, it may lead to hang
if no bootable slots found. The only way to recover the board
is re-flash images with uuu tool, which is quite inconvenient
for some customers who can't enter serial download mode.

This patch will set "spl recovery mode" which will give us a
chance to re-flash images with fastboot commands.

Test: Enter spl recovery mode and flash images when no bootable
      slots found.

Change-Id: I31278f5212bde7609fe2f49e77b3849e92c0c516
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-15152 erase user data before setting lock/unlock status
faqiang.zhu [Wed, 17 Jul 2019 07:32:00 +0000 (15:32 +0800)]
MA-15152 erase user data before setting lock/unlock status

when conduct fastboot lock/unlock operations, erase the userdata first
and then set lock/unlock status to improve security level.

Change-Id: I74c571c35b88afd6fdd4c287463f7209da8c15ff
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
5 years agoMA-15151 Limit some hwcrypto commands within bootloader
Ji Luo [Wed, 17 Jul 2019 04:21:09 +0000 (12:21 +0800)]
MA-15151 Limit some hwcrypto commands within bootloader

It can be dangerous to export some hwcrypto commands to Linux,
add commands to limit some commands within bootloader.

Test: hwcrypto commands can't be used after locking boot state.

Change-Id: Ib0a96a87f661778c133178840d8dccf49f151c22
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-15017 Add new command to generate bkek from trusty
Ji Luo [Sat, 22 Jun 2019 02:18:01 +0000 (10:18 +0800)]
MA-15017 Add new command to generate bkek from trusty

Add new command to generate bkek from trusty.

Test: generate and dump bkek.

Change-Id: I6b2a30b87c755eecd00ced7c53cfb86e432040de
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-15015 Add sha256_hmac support
Ji Luo [Fri, 21 Jun 2019 00:52:40 +0000 (08:52 +0800)]
MA-15015 Add sha256_hmac support

Add sha256 hmac support in u-boot.

Test: hmac calculation.

Change-Id: I0f1438fed8290620a1bb0663d19c21e20098eb5a
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-15142 Support secure attestation provision
Haoran.Wang [Tue, 16 Jul 2019 05:12:15 +0000 (13:12 +0800)]
MA-15142 Support secure attestation provision

In host end, need encrypt the attestation keys and certs
by manufacture protection public key though  AES-128-ECB.
Then use below 4 set of commands to provision encrypted
RSA attestation and EC attestation:
  * $fastboot stage atte_rsa_key.bin
  * $fastboot oem set-rsa-atte-key-enc
  * $fastboot stage atte_rsa_cert.bin
  * $fastboot oem append-rsa-atte-cert-enc
  * $fastboot stage atte_ec_key.bin
  * $fastboot oem set-ec-atte-key-enc
  * $fastboot stage atte_ec_cert.bin
  * $fastboot oem append-ec-atte-cert-enc

Change-Id: I8a7c64004a17f7dde89f28c3123a2e2b1a6d3346
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
5 years agoMA-15019-1 Support Manufacture Protection public key generation
Ji Luo [Mon, 15 Jul 2019 09:26:30 +0000 (17:26 +0800)]
MA-15019-1 Support Manufacture Protection public key generation

Add new keymaster commands to get Manufacure Production key (mppubk).
Since the mppubk can only be generated in OEM CLOSED imx8q board, so
we can only use this command when the board is HAB/AHAB closed.

Commands to extract the mppubk:
        * $fastboot oem get-mppubk
        * $fastboot get_staged mppubk.bin

Test: Generate and dump the mppubk.bin

Change-Id: Idc59e78ca6345497e744162664b8293f50d1eda4
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-15087-4 Support mmc loader for imx8mn_evk
Haoran.Wang [Tue, 9 Jul 2019 04:16:23 +0000 (12:16 +0800)]
MA-15087-4 Support mmc loader for imx8mn_evk

Align using emmc loader when there is no Trusty OS for Android standard
boot in SD/EMMC.

Add hook for getting correct offset when load uboot.

Change-Id: I5898cf196e734ffaca1a513918a049ce504b14e9
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
5 years agoMA-15087-1 Enable Trusty OS on imx8mn
Haoran.Wang [Mon, 8 Jul 2019 09:08:05 +0000 (17:08 +0800)]
MA-15087-1 Enable Trusty OS on imx8mn

This patch removed the SDP support in imx8mn due
it will cause the memory resource limitation when run
SPL.

This patch also removed ROMAPI loader. Due Trusty OS
need SPL support mmc related features. So fall back to use
mmc loader instead of ROMAPI.

To fix mmc loader, correct the uboot raw loader offset.

Change-Id: If13f6c9133226efd0831a1867377b8ab0abb6327
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
5 years agoMA-15087 Duplicate imx8mn defconfig to trusty one
Haoran.Wang [Mon, 8 Jul 2019 09:06:35 +0000 (17:06 +0800)]
MA-15087 Duplicate imx8mn defconfig to trusty one

Duplicate imx8mn_ddr4_evk_android_defconfig to
imx8mn_ddr4_evk_android_trusty_defconfig to for the one
who support Trusty OS.

Change-Id: I0577324a913abc1a118d2e58bea2534b8873ae88
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
5 years agoMA-14981-1 Add evk_imx8mm 4GB DDR support
Ji Luo [Thu, 13 Jun 2019 06:45:25 +0000 (14:45 +0800)]
MA-14981-1 Add evk_imx8mm 4GB DDR support

Add configs to support evk_imx8mm 4GB DDR board. The 4GB DDR will
be split into two banks, one is 3GB (0x4000_0000~0xffff_0000) and
another is 1GB(0x1_0000_0000~0x1_4000_0000).

Test: build and boot with or without trusty.

Change-Id: I02f6465fc5709b15fd76820edb846452d011dd56
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-14948 Append lock status by Android Property
Haoran.Wang [Thu, 6 Jun 2019 04:51:06 +0000 (12:51 +0800)]
MA-14948 Append lock status by Android Property

Follow Bootloader requirement spec in
https://source.android.com/devices/bootloader/unlock-trusty.
Need to pass the flash lock status by androidboot.flash.locked.

This patch fixed the GTS failure
com.google.android.gts.persistentdata.PersistentDataHostTest#testTestGetFlashLockState.

Change-Id: I9a3508f7546b02c998e7668df2a33f864a58db75
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
5 years agoMA-15082 Do not pass btmacaddr from uboot if serial is all zero
yang.tian [Fri, 5 Jul 2019 09:48:33 +0000 (17:48 +0800)]
MA-15082 Do not pass btmacaddr from uboot if serial is all zero

Do not pass BDADDR from uboot cmdline when
serial is all zero, and instead btmacaddr
will be set from persist.service.bdroid.bdaddr
which is set in device's init.freescale.rc

Change-Id: I429c6f369d0b7aaca643443fe505d943a3901215
Signed-off-by: yang.tian <yang.tian@nxp.com>
5 years agoMA-15062-3 enable MCU firmware support on evk_8mn
faqiang.zhu [Tue, 2 Jul 2019 05:58:29 +0000 (13:58 +0800)]
MA-15062-3 enable MCU firmware support on evk_8mn

modify the defconfig file for evk_8mn running Android, to make evk_8mn
be able to be flashed with mcu firmware image and boot up the mcu.

Change-Id: Ic05c1d7800fb4eb7582c0da034af87374d40946a
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
5 years agoMA-15062-2 change mcu firmware partition name
Ji Luo [Tue, 23 Jul 2019 07:19:20 +0000 (15:19 +0800)]
MA-15062-2 change mcu firmware partition name

new imx8mn chips have Cortex-M7 inside, not like any other existing
multi-core i.MX MPU, users may manually flash mcu firmware with
fastboot, partition name need to be specified at the same time, so the
mcu firmware partition name need to be changed. related enum and
variable names are also modified.

Change-Id: Ia801e76fb3a20d0074dbbc1433258358c1a53907
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 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>
5 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

imx-regs-imx8mm.h is used both for imx8mm and imx8mn, while mcu in
imx8mn is Cortex-M7, it's different from Cortex-M4 in imx8mm, 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>
5 years agoMA-14989-1 Add 2GB ddr support for AIY
Ji Luo [Mon, 17 Jun 2019 12:27:40 +0000 (20:27 +0800)]
MA-14989-1 Add 2GB ddr support for AIY

Add support for AIY 2GB DDR size. Wrap support for
3GB DDR board with CONFIG_AIY_LPDDR4_3G because of
the limited ocram size.

Test: build and boot on 2GB AIY board.

Change-Id: I04da60cc0d0b22c6c32ff705bcab4095068ba6ea
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-15198 Fix imx8mn fastboot flash fail
Ji Luo [Tue, 23 Jul 2019 06:44:26 +0000 (14:44 +0800)]
MA-15198 Fix imx8mn fastboot flash fail

Align the eMMC device id to '2' to get correct bootloader0
offset.

Test: bootloader0 partition flash.

Change-Id: Idac6bfe55857e3f80b7e18691bbe3c5e5c453e10
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-14893-2 Add android build target for imx8mn
Ji Luo [Wed, 29 May 2019 05:05:19 +0000 (13:05 +0800)]
MA-14893-2 Add android build target for imx8mn

Add configs to support evk_imx8mn android build.

Test: build and boot on eMMC and sd.

Change-Id: Id5c63b31e45357d791425976358635c18de928eb
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMLK-22298 tcpc: fix tcpc_debug_log usage
Peng Fan [Tue, 23 Jul 2019 06:17:56 +0000 (14:17 +0800)]
MLK-22298 tcpc: fix tcpc_debug_log usage

Adding missed port parameter.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoMA-15181 use correct API in SPL to get mmc index
Haoran.Wang [Mon, 22 Jul 2019 09:45:49 +0000 (17:45 +0800)]
MA-15181 use correct API in SPL to get mmc index

Due SPL doesn't have env, so cannot use mmc_get_env_dev() get
the mmc index.
Following spl_mmc.c get correct mmc index in SPL.

Change-Id: I0f07a9ea35d5b3ba0d638af436238d0cfe925981
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
5 years agoMLK-22287 imx8mn: enable CONFIG_ENV_DEFAULT_NOWHERE at default
Ye Li [Fri, 19 Jul 2019 01:56:56 +0000 (18:56 -0700)]
MLK-22287 imx8mn: enable CONFIG_ENV_DEFAULT_NOWHERE at default

This CONFIG_ENV_DEFAULT_NOWHERE config must be enabled for USB download
when we implemented the override function to select env storage medium.
To avoid adding it to every imx8mn defconfig, enable the config as default
on imx8mn.

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

5 years agoMLK-22283 env: fix NAND ENV build issue introduced by env offset change
Ye Li [Thu, 18 Jul 2019 06:14:59 +0000 (23:14 -0700)]
MLK-22283 env: fix NAND ENV build issue introduced by env offset change

Get below build error in nand env, because we should not call function in
array initialization.

env/nand.c: In function ‘env_nand_save’:
env/nand.c:196:15: error: initializer element is not constant
.offset = env_get_offset(CONFIG_ENV_OFFSET),

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

5 years agoMLK-22279-5 imx8mn_evk: Remove flexspi defconfig
Ye Li [Wed, 17 Jul 2019 06:19:11 +0000 (23:19 -0700)]
MLK-22279-5 imx8mn_evk: Remove flexspi defconfig

Remove the defconfig for flexspi boot, we can use one defconfig
for both SD and flexspi.

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22279-4 imx8mn_evk: Enable multiple env storages
Ye Li [Tue, 16 Jul 2019 09:11:04 +0000 (02:11 -0700)]
MLK-22279-4 imx8mn_evk: Enable multiple env storages

Enable multiple environment storage devices on iMX8MN DDR4 EVK board.
Remove duplicated CONFIG_ENV_OFFSET since we use env_get_offset to
override it.

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

5 years agoMLK-22279-3 imx8mn: override env_get_offset and env_get_location
Ye Li [Mon, 15 Jul 2019 08:16:46 +0000 (01:16 -0700)]
MLK-22279-3 imx8mn: override env_get_offset and env_get_location

To use one defconfig for all boot device, we have to runtime set
env offset and return env medium according to the boot device.
This patch overrides the env_get_offset and env_get_location to
implement the feature.

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

5 years agoMLK-22279-2 env: Add a config to enable nowhere as default location
Ye Li [Tue, 16 Jul 2019 09:06:10 +0000 (02:06 -0700)]
MLK-22279-2 env: Add a config to enable nowhere as default location

When booting from USB there is no place to store the environment and
should use default env. However CONFIG_ENV_IS_NOWHERE has dependence
with other env storage config. If we enable multiple storages, NOWHERE
can't be enabled. And saveenv won't be built if NOWHERE is set.

This patch introduces a new CONFIG_ENV_DEFAULT_NOWHERE, that can enable
NOWHERE as a default env location when other storage are not avaliable.
And allow to build saveenv.

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

5 years agoMLK-22279-1 env: Add env_get_offset to override static env offset
Ye Li [Tue, 16 Jul 2019 08:39:40 +0000 (01:39 -0700)]
MLK-22279-1 env: Add env_get_offset to override static env offset

Add env_get_offset interface to override static CONFIG_ENV_OFFSET,
and update env location driver to use env_get_offset. So for different
storage medium, we are able to store the env at different offset.

We don't support this feature when CONFIG_ENV_IS_EMBEDDED is set.

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

5 years agoMA-14898 Fix build warnings
Ji Luo [Thu, 30 May 2019 02:23:10 +0000 (10:23 +0800)]
MA-14898 Fix build warnings

Include correct header files to avoid build warning:
  common/image-android.c:151:68: warning: implicit declaration
  of function ‘mmc_get_env_dev’ [-Wimplicit-function-declaration]
  " androidboot.boot_device_root=mmcblk%d", mmc_map_to_kernel_blk(mmc_get_env_dev()));

Change-Id: I932a178500e7397f72d717efae0dd2d954a909d8
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMLK-22259-4: mx6dlsabreauto: configs: add default mtdids and mtdparts configs
Han Xu [Fri, 12 Jul 2019 21:19:56 +0000 (16:19 -0500)]
MLK-22259-4: mx6dlsabreauto: configs: add default mtdids and mtdparts configs

set the i.MX6DL default mtdids value as
"nor0=8000000.nor,nand0=gpmi-nand", nandbcb can directly write to the
nandboot partition after u-boot brings up.

=> nandbcb update $loadaddr nandboot 912384
Device nor0 not found!
current device is invalid, skip it and check the next one
device 0 offset 0x0, size 0x912384
Erasing at 0x3f00000 -- 100% complete.
NAND fw write: 0x200000 offset, 0x916000 bytes written: OK

Signed-off-by: Han Xu <han.xu@nxp.com>
5 years agoMLK-22259-3: mx6sabre: config: remove space from mtdparts definition
Han Xu [Fri, 12 Jul 2019 20:53:12 +0000 (15:53 -0500)]
MLK-22259-3: mx6sabre: config: remove space from mtdparts definition

there should no extra space in mtdparts definition

Signed-off-by: Han Xu <han.xu@nxp.com>
5 years agoMLK-22259-2: cmd: mtdparts: skip invalid devices rather than quit
Han Xu [Fri, 12 Jul 2019 20:52:58 +0000 (15:52 -0500)]
MLK-22259-2: cmd: mtdparts: skip invalid devices rather than quit

mtdparts quit when invalid mtd devices found. Add thes patches to skip
the invalid devices, so NAND partitions can be alway found to burn boot
images.

For instance,

On i.MX6DL Sabreauto, nand config u-boot didn't enable the weim nor, so
parsing 8000000.nor leads to error:

Device nor0 not found!

With the patches, we can skip this invalid device and still get nand
boot partition table:

Device nor0 not found!
current device is invalid, skip it and check the next one

device nand0 <gpmi-nand>, # parts = 5
0: nandboot 0x04000000 0x00000000 0
1: nandkernel 0x01000000 0x04000000 0
2: nanddtb 0x01000000 0x05000000 0
3: nandtee 0x01000000 0x06000000 0
4: nandrootfs 0xf9000000 0x07000000 0

active partition: nand0,0 - (nandboot) 0x04000000 @ 0x00000000

Signed-off-by: Han Xu <han.xu@nxp.com>
5 years agoMLK-22259-1: cmd: Kconfig: add new option CONFIG_MTDPARTS_SKIP_INVALID
Han Xu [Fri, 12 Jul 2019 20:52:46 +0000 (15:52 -0500)]
MLK-22259-1: cmd: Kconfig: add new option CONFIG_MTDPARTS_SKIP_INVALID

add a new option in mtdparts to skip the invalid devices rather than
just quit

Signed-off-by: Han Xu <han.xu@nxp.com>
5 years agoi.MX6: nand: add nandbcb command for imx
Shyam Saini [Wed, 10 Jul 2019 19:19:45 +0000 (14:19 -0500)]
i.MX6: nand: add nandbcb command for imx

Writing/updating boot image in nand device is not
straight forward in i.MX6 platform and it requires
boot control block(BCB) to be configured.

It becomes difficult to use uboot 'nand' command to
write BCB since it requires platform specific attributes
need to be taken care of.

It is even difficult to use existing msx-nand.c driver by
incorporating BCB attributes like mxs_dma_desc does
because it requires change in mtd and nand command.

So, cmd_nandbcb implemented in arch/arm/mach-imx

BCB contains two data structures, Firmware Configuration Block(FCB)
and Discovered Bad Block Table(DBBT). FCB has nand timings,
DBBT search area, page address of firmware.

On summary, nandbcb update will
- erase the entire partition
- create BCB by creating 2 FCB/DBBT block followed by
  1 FW block based on partition size and erasesize.
- fill FCB/DBBT structures
- write FW/SPL on FW1
- write FCB/DBBT in first 2 blocks

for nand boot, up on reset bootrom look for FCB structure in
first block's if FCB found the nand timings are loaded for
further reads. once FCB read done, DTTB will load and finally
firmware will be loaded which is boot image.

Refer section "NAND Boot" from doc/imx/common/imx6.txt for more usage
information.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Sergey Kubushyn <ksi@koi8.net>
Signed-off-by: Shyam Saini <shyam.saini@amarulasolutions.com>
Signed-off-by: Han Xu <han.xu@nxp.com>
5 years agoarm: i.MX: Add CMD_NANDBCB Kconfig entry
Shyam Saini [Wed, 10 Jul 2019 19:15:49 +0000 (14:15 -0500)]
arm: i.MX: Add CMD_NANDBCB Kconfig entry

Add Kconfig entry for CMD_NANDBCB, and default y on i.MX6
platform with NAND_MXS defined.

Reviewed-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Shyam Saini <shyam.saini@amarulasolutions.com>
Signed-off-by: Han Xu <han.xu@nxp.com>
5 years agoMA-14916-10 fix fastboot reboot bootloader issue
faqiang.zhu [Tue, 9 Jul 2019 10:52:12 +0000 (18:52 +0800)]
MA-14916-10 fix fastboot reboot bootloader issue

In Android, the reboot bootloader flag is written to misc partition, in
the boot flow, u-boot will check that message to decide whether enter
fastboot mode or not. To be compatible with the common implemention,
keep the fastboot_set_reboot_flag there and redefine it to avoid the
error return value which block the reboot process.

Change-Id: Ifb55236d5a5daf3edd124d3ed01851ff6e916e1a
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
5 years agoMA-14712 change androidboot.storage_type to androidboot.boot_device_root
Jindong [Mon, 13 May 2019 10:10:25 +0000 (18:10 +0800)]
MA-14712 change androidboot.storage_type to androidboot.boot_device_root

storage_type is emmc or sd, which is not friendly
for user space, for example android health HAL need access
/sys/block/mmcblkX/stat.

Replace it with mmcblkX named as boot_device_root.
(Keep storage_type for compatibility now)

Change-Id: I7486d522696e9fe3dde8bdc8834ac11d25df7d79
Signed-off-by: Jindong <jindong.yue@nxp.com>
5 years agoMA-13453-1 Add new board target imx8mq_aiy
Ji Luo [Fri, 5 Jul 2019 04:41:43 +0000 (12:41 +0800)]
MA-13453-1 Add new board target imx8mq_aiy

Add support for new target imx8mq_aiy.

Test: build and boot ok on imx8mq_aiy.

Change-Id: Ie616c3ae5fc5273036e975acd88fccfa8c5c95ee
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoFix P0/EVT boards boot without serial cable connection.
Leonid Lobachev [Mon, 16 Jul 2018 19:30:01 +0000 (12:30 -0700)]
Fix P0/EVT boards boot without serial cable connection.

Change-Id: I5969217e400ab494f9a74662d1d228fcf2e2d465

5 years agoMA-12973 [AUTO] Skip serial init in board_init_f
Ji Luo [Sun, 30 Sep 2018 07:24:09 +0000 (15:24 +0800)]
MA-12973 [AUTO] Skip serial init in board_init_f

Serial init in board_init_f will cost much time, skip it here
because the serial will be initialized again in board_init_r
and it's more faster (after cache is enabled). We will miss
some logs before the serial is ready but it's ok for Android Auto.
This commit will save about 190ms on imx8qm.

Test: boot ok for both imx8qm and imx8qxp.

Change-Id: If6efdc19794aecda862f22b6fec7f7aba2005766
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
5 years agoMA-12421 Fix CAAM not work on Android Things
Ji Luo [Fri, 5 Jul 2019 01:18:36 +0000 (09:18 +0800)]
MA-12421 Fix CAAM not work on Android Things

Blob buffer size is 48 bytes larger than the plain text buffer,
set correct range when flush the dcache. Also use cache aligned
buffer for the blob/plain_text to avoid failure in CAAM.

Change-Id: I8f311b9d21fc7d26d60e9ba23dfb239d2582cedf
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMLK-18591-8 android: Add imx8/imx8m reference boards support
Ye Li [Thu, 7 Jun 2018 14:19:57 +0000 (07:19 -0700)]
MLK-18591-8 android: Add imx8/imx8m reference boards support

Add board level support for android and android auto. Each board has
android/andriod_auto specified header file for defining relevant configuraitons.
And add build targets for their android uboot images building.

Change-Id: Ib7c10404dbca9237ab074427d3cb10d98bfc0ed9
Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMA-14916-4 support dual bootloader for imx8m, imx8q
Ji Luo [Fri, 21 Jun 2019 07:53:50 +0000 (15:53 +0800)]
MA-14916-4 support dual bootloader for imx8m, imx8q

this commit is a merge of three patches from imx_v2018.03 as below:

1.
commit dbcf1e3cc079d2f1b3df6c4c9ec3a34d0c05eb4c
Author: Luo Ji <ji.luo@nxp.com>
Date:   Fri Jun 8 10:31:11 2018 +0800

    [iot] Support dual bootloader in SPL

    Move the A/B slot check to SPL, the A/B slot switch
    workflow is just like what we have in libavb_ab.

    Test: A/B select works fine on imx8m.

2.
commit 71562aae3b8123ccd7503e596e478951568fcd24
Author: Ji Luo <ji.luo@nxp.com>
Date:   Mon Jan 14 18:28:08 2019 +0800

    MA-13938 [Android] imx8q: Support dual bootloader feature

    Support dual bootloader feature for imx8q which uses the
    container format. Move the A/B slot select and verify to
    SPL stage, the bootloader rollback index will be stored
    at the last 8K bytes of eMMC rpmb storage.

    Test: Boot and rbindex verify pass on imx8q.

Change-Id: Ic9410a48092cc05de599dd897fc912177e2a1fe1
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
5 years agoMLK-22258 imx8mn: Update speed grade
Ye Li [Fri, 12 Jul 2019 06:20:02 +0000 (23:20 -0700)]
MLK-22258 imx8mn: Update speed grade

imx8mn speed grade fuse uses new definitions as below. So have
to update get_cpu_speed_grade_hz function to match it.

SPEED_GRADING[5:0]:
SPEED_GRADE[5:4]    SPEED_GRADE[3:0]    MHz
      xx                0000            2300
      xx                0001            2200
      xx                0010            2100
      xx                0011            2000
      xx                0100            1900
      xx                0101            1800
      xx                0110            1700
      xx                0111            1600
      xx                1000            1500
      xx                1001            1400
      xx                1010            1300
      xx                1011            1200
      xx                1100            1100
      xx                1101            1000
      xx                1110             900
      xx                1111             800

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

5 years agoMLK-21297 imx8: Add DEK blob encapsulation
Clement Faure [Tue, 28 May 2019 15:01:07 +0000 (17:01 +0200)]
MLK-21297 imx8: Add DEK blob encapsulation

Add DEK encapsulation support for imx8. The DEK blob is generated by the
SECO through the SCFW API.

Signed-off-by: Clement Faure <clement.faure@nxp.com>
5 years agoMLK-20373-2 dm: serial: introduce puts hook
Peng Fan [Thu, 15 Nov 2018 05:13:14 +0000 (13:13 +0800)]
MLK-20373-2 dm: serial: introduce puts hook

Introduce puts hook for dm serial driver.

Change-Id: I75423998c7d8db20949bae6ac46a094dc62c9612
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Flynn xu <flynn.xu@nxp.com>
5 years agoMA-14916-8 [iot] Set power-on write protection for boot1 partition
Luo Ji [Wed, 3 Jul 2019 06:38:16 +0000 (14:38 +0800)]
MA-14916-8 [iot] Set power-on write protection for boot1 partition

The RPMB keyslot is stored in last block of boot1 partition which
is easily erased or tampered, set power-on write protection for this
partition to prevent corruption.

Test: Power-on write protection works as expected on imx8m.

Change-Id: Ib7e1094b979f7d94c0a2817391c5b3b5f3205d76
Signed-off-by: Luo Ji <ji.luo@nxp.com>
5 years agoMA-14916-7 comply with mmc struct definition in avb library
faqiang.zhu [Wed, 3 Jul 2019 06:23:06 +0000 (14:23 +0800)]
MA-14916-7 comply with mmc struct definition in avb library

Driver Module may be used in SPL, with CONFIG_BLK enabled for U-Boot,
CONFIG_SPL_BLK will be enabled, struct mmc definition will be different.
comply with that mmc struct definition in fsl_avbkey.c file to handle
conditions when DM is used in SPL.

Change-Id: I632600556e764b25228ba467a5e5141cf3fc3dfe
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
5 years agoMA-13937 Enable CAAM for imx8q
Ji Luo [Fri, 11 Jan 2019 01:46:53 +0000 (09:46 +0800)]
MA-13937 Enable CAAM for imx8q

The CAAM driver in u-boot will use JR0 by default, but for
imx8q, both JR0 and JR1 are assigned to SECO and  A core
should never access them.
Power on the JR3 in this patchset and use it to complete
the CAAM operations for imx8q.

Test: CAAM self test cases pass for imx8q.

below patches are merged to this commit:
MA-13964 imx8q: Kick the CAAM JR before kicking the SMMU
MA-13969 Fix CAAM build warnings

Change-Id: Ie3d77d1f2910e7f4c257c797c12b5c8a30ad936a
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-13936 Add CAAM self test
Ji Luo [Fri, 11 Jan 2019 01:01:37 +0000 (09:01 +0800)]
MA-13936 Add CAAM self test

Add CAAM RNG generating and BLOB encap/decap
self test cases.

Test: Test cases pass on imx8qm_mek/imx6qp_sabresd.

Change-Id: I538f7b1581b36df83a3006ac133ca9e7b57ab4f0
Signed-off-by: Ji Luo <ji.luo@nxp.com>
5 years agoMA-14916-3: Add mx6/7 reference board support to enable android fastboot
Ye Li [Mon, 21 May 2018 09:32:08 +0000 (02:32 -0700)]
MA-14916-3: Add mx6/7 reference board support to enable android fastboot

this commit is based on the cherrypick of a patch from imx_v2018.03 with
below commit info:
"
commit f15e20eeb42d421d694e75d6f159d908b5606e1f
Author: Ye Li <ye.li@nxp.com>
Date:   Mon May 21 02:32:08 2018 -0700

MLK-18591-7 android: Add mx6/7 reference board support to enable android
fastboot

Add board level support for android fastboot feature. Each board has
a android specified header file for defining android related configuraitons.
And add build targets for their android uboot images building.
"
and then some modification is made to make the compilation pass.
the defconfig files modification is based on corresponding files from
BSP team, ucmd/acmd function is disabled for Android U-Boot.

with defconfig files for 6ul chips, the compilation will terminate with
failure on imx_v2018.03, so no modification was made on them.

Change-Id: Ibe5979239e5e6a78b06f332c9041d1f1de2566fc
Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoMA-14916-1 adapt to the directory change of libavb
faqiang.zhu [Tue, 11 Jun 2019 03:02:32 +0000 (11:02 +0800)]
MA-14916-1 adapt to the directory change of libavb

libavb is now under the directory of lib/, not lib/avb/ as before, to
adapt to this change, some modifications are made:
1. header file inclusion change, including parameter of -I option in
Makefile
2. remove avb_sysdeps_posix.o in Makefile since the functions in
avb_sysdeps_posix.c has beed redefined in fsl_avb_sysdeps_uboot.c

Change-Id: I4216e3ddb4e3e810783e4f46b953eda510c2627b
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
5 years agoMLK-22245 mx6qp: Fix issue caused by moving pre_misc_setting()
Ye Li [Wed, 10 Jul 2019 05:28:40 +0000 (22:28 -0700)]
MLK-22245 mx6qp: Fix issue caused by moving pre_misc_setting()

The commit "MLK-22219 mx6: Place pre_misc_setting() into a common location"
causes iMX6QP boot hang. Because QoS settings in pre_misc_setting depends on
IPU and PRG clocks enabled.
So still calling pre_misc_setting in enable_ipu_clock, and move
enable_ipu_clock to arch_cpu_init

Signed-off-by: Ye Li <ye.li@nxp.com>
5 years agoTEE-346 Add DEK blob encapsulation for imx8m
Clement Faure [Thu, 23 May 2019 14:00:11 +0000 (16:00 +0200)]
TEE-346 Add DEK blob encapsulation for imx8m

Add DEK blob encapsulation support for IMX8M through "dek_blob" command.
On ARMv8, u-boot runs in non-secure, thus cannot encapsulate a DEK blob
for encrypted boot.
The DEK blob is encapsulated by OP-TEE through a trusted application call.
U-boot sends and receives the DEK and the DEK blob binaries through OP-TEE
dynamic shared memory.

To enable the DEK blob encapsulation, add to the defconfig:
CONFIG_SECURE_BOOT=y
CONFIG_FAT_WRITE=y
CONFIG_CMD_DEKBLOB=y

Signed-off-by: Clement Faure <clement.faure@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
5 years agoMLK-22192 imx8mn: Add variant parts support
Ye Li [Thu, 4 Jul 2019 09:20:23 +0000 (02:20 -0700)]
MLK-22192 imx8mn: Add variant parts support

According to datasheet, there are totally 6 variant parts for imx8mn:
Quad, Dual, Solo with core number changed.
QuadLite, DualLite, SoloLite with core number changed and GPU disabled.

Add the support for these variant parts
1. Recognize the variant parts according to fuse
2. Power down disabled cores
3. Remove the cores node and disable GPU node from kernel DTB before
   entering kernel.
4. Since the mscale dummy id has been used out, increase one more bit
   (bit 8) for cpu id.

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

5 years agoMLK-22101 configs: imx8mn: add jailhouse env
Peng Fan [Tue, 25 Jun 2019 01:42:02 +0000 (09:42 +0800)]
MLK-22101 configs: imx8mn: add jailhouse env

Add jailhouse env for booting linux to support jailhouse

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