armv8: fsl-layerscape: Fix automatic setting of bootmcd with TF-A
authorAlban Bedel <alban.bedel@aerq.com>
Tue, 17 Nov 2020 15:20:04 +0000 (16:20 +0100)
committerPriyanka Jain <priyanka.jain@nxp.com>
Thu, 10 Dec 2020 08:26:39 +0000 (13:56 +0530)
commitcbf77d201870f2d12227e2d95718a416b16ec98b
treef6f8f8c31ea46974ba0138a29f6ff5f341e5c2d0
parent164941c2c444830dfee6d1575207a590dcba8ae4
armv8: fsl-layerscape: Fix automatic setting of bootmcd with TF-A

When booting from TF-A there is a logic that attempt to detect if the
default environment is used, if this is the case it then set the
`bootcmd` and `mcinitcmd` depending of the device we booted from.
This detection logic is dubious as it access internals of the env
implementation and it doesn't always work correctly.

First of all it detect any valid environment as not being the
default, so after running `env default -a && saveenv` the board
doesn't boot anymore as `bootcmd` is then empty.
But it also fails in some other ways, for example it always detect a
default environment when redundant env is enabled on MMC, so in that
case `bootcmd` is overwritten on every boot.

Instead of increasing the complexity of the detection just check if
`bootcmd` and `mcinitcmd` are set in the environment and set them if
they are not.

Signed-off-by: Alban Bedel <alban.bedel@aerq.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
arch/arm/cpu/armv8/fsl-layerscape/soc.c