MLK-10958 imx: mx6ul support Bus Encryption Engine
authorYe Li <ye.li@nxp.com>
Fri, 23 Mar 2018 08:14:13 +0000 (01:14 -0700)
committerYe Li <ye.li@nxp.com>
Wed, 28 Apr 2021 20:49:33 +0000 (13:49 -0700)
commit772a1ed70504667e8ec081f37b9c0f4b3fa6ac11
tree055e1835a4a629ee35cdc3bdbfe9d625894efd0d
parent95081f7d5cfeebea682c83d6ebc9ae4eefee2a0f
MLK-10958 imx: mx6ul support Bus Encryption Engine

This patch is to support Bus Encryption Engine(BEE) for i.MX 6UL.
Supported feature:
1. SNVS key and soft key
2. CTR and ECB mode
3. Specify address region to bee.

Two commands are included:
bee init [key] [mode] [start] [end] - BEE block initial
    "Example: bee init 1 1 0x80000000 0x80010000\n"
bee test [region]
    "Example: bee test 1\n"

Mapping:
[0x10000000 - (0x10000000 + size - 1)] : [start - (start + size - 1)]
[0x30000000 - (0x30000000 + IRAM_SIZE - 1)] : [IRAM_BASE_ADDR -
(IRAM_BASE_ADDR + IRAM_SIZE - 1)]

Whatever start is, start - (start + size -1) will be fixed mapping to
0x10000000 - (0x10000000 + size - 1)

Since default AES region's protected size is SZ_512M, so
on mx6ul evk board, you can not simply run 'bee init', it will
overlap with uboot execution environment, you can use
'bee init 0 0 0x80000000 0x81000000'.

If want to use bee, Need to define CONFIG_CMD_BEE in board configuration
header file, since CONFIG_CMD_BEE default is not enabled.

This patch also checks fuse bit 25 of bank 0 word 4 before initialize bee.
The bit: 0 means bee enabled, 1 means bee disabled.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 9d592121bebbdb9ded0009a2703c7cab01edfa70)
(cherry picked from commit cd03ba8327d46178900a63310d5ef3edd8034350)
(cherry picked from commit 6c8ed4a65e73747f38d2e16e8a2b8cb0c7cce4af)
arch/arm/include/asm/arch-mx6/mx6_bee.h [new file with mode: 0644]
arch/arm/mach-imx/mx6/Kconfig
arch/arm/mach-imx/mx6/Makefile
arch/arm/mach-imx/mx6/bee.c [new file with mode: 0644]